@almadar/std 13.2.6 → 13.3.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.
@@ -0,0 +1,275 @@
1
+ {
2
+ "name": "std-graphs",
3
+ "version": "1.0.0",
4
+ "description": "std-graphs — embeddable chart atom. Drops into a dashboard molecule\nalongside std-stats / std-browse; wire its ITEMS_LOADED listener to\nthe upstream collection's success emit, then configure `chartType` +\n`categoryField` + (`valueField` | `aggregation`) per call-site to\ndeclare WHAT to chart.\n\nAggregation runs in the lolo state machine: ITEMS_LOADED groups\n@payload.data by @config.categoryField (array/groupBy returns\n{<category>: [<rows>]}) then array/maps over (object/entries result)\nto apply the configured aggregation (count | sum | avg | min | max)\nper bucket. The resulting chart-data array of {label, value} drops\ninto the existing chart pattern with no aggregator component required.\n\nThe `ChartPoint` type alias narrows the entity field to the exact\nshape the `chart` pattern's `data` prop expects (`{label, value}`),\nso no `Record<string, unknown>` cast lands at the call site —\nschema authors keep strict typing end-to-end.",
5
+ "orbitals": [
6
+ {
7
+ "name": "GraphItemOrbital",
8
+ "entity": {
9
+ "name": "GraphItem",
10
+ "persistence": "runtime",
11
+ "fields": [
12
+ {
13
+ "name": "id",
14
+ "type": "string",
15
+ "required": true
16
+ },
17
+ {
18
+ "name": "chartData",
19
+ "type": "array",
20
+ "default": [],
21
+ "items": {
22
+ "type": "object",
23
+ "properties": {
24
+ "value": {
25
+ "name": "value",
26
+ "type": "number"
27
+ },
28
+ "label": {
29
+ "name": "label",
30
+ "type": "string"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ]
36
+ },
37
+ "traits": [
38
+ {
39
+ "name": "GraphItemGraph",
40
+ "category": "interaction",
41
+ "linkedEntity": "GraphItem",
42
+ "stateMachine": {
43
+ "states": [
44
+ {
45
+ "name": "idle",
46
+ "isInitial": true
47
+ }
48
+ ],
49
+ "events": [
50
+ {
51
+ "key": "INIT",
52
+ "name": "Initialize"
53
+ },
54
+ {
55
+ "key": "ITEMS_LOADED",
56
+ "name": "Items Loaded",
57
+ "payloadSchema": [
58
+ {
59
+ "name": "data",
60
+ "type": "[object]"
61
+ },
62
+ {
63
+ "name": "totalCount",
64
+ "type": "number"
65
+ }
66
+ ]
67
+ }
68
+ ],
69
+ "transitions": [
70
+ {
71
+ "from": "idle",
72
+ "to": "idle",
73
+ "event": "INIT",
74
+ "effects": [
75
+ [
76
+ "set",
77
+ "@entity.chartData",
78
+ []
79
+ ],
80
+ [
81
+ "render-ui",
82
+ "main",
83
+ {
84
+ "chartType": "@config.chartType",
85
+ "height": "@config.height",
86
+ "type": "chart",
87
+ "subtitle": "@config.subtitle",
88
+ "showLegend": "@config.showLegend",
89
+ "title": "@config.title",
90
+ "data": "@entity.chartData",
91
+ "showValues": "@config.showValues"
92
+ }
93
+ ]
94
+ ]
95
+ },
96
+ {
97
+ "from": "idle",
98
+ "to": "idle",
99
+ "event": "ITEMS_LOADED",
100
+ "effects": [
101
+ [
102
+ "set",
103
+ "@entity.chartData",
104
+ [
105
+ "array/map",
106
+ [
107
+ "object/entries",
108
+ [
109
+ "array/groupBy",
110
+ "@payload.data",
111
+ "@config.categoryField"
112
+ ]
113
+ ],
114
+ [
115
+ "fn",
116
+ "entry",
117
+ {
118
+ "value": [
119
+ "if",
120
+ [
121
+ "=",
122
+ "@config.aggregation",
123
+ "sum"
124
+ ],
125
+ [
126
+ "array/sum",
127
+ [
128
+ "object/get",
129
+ "@entry",
130
+ "1"
131
+ ],
132
+ "@config.valueField"
133
+ ],
134
+ [
135
+ "if",
136
+ [
137
+ "=",
138
+ "@config.aggregation",
139
+ "avg"
140
+ ],
141
+ [
142
+ "array/avg",
143
+ [
144
+ "object/get",
145
+ "@entry",
146
+ "1"
147
+ ],
148
+ "@config.valueField"
149
+ ],
150
+ [
151
+ "if",
152
+ [
153
+ "=",
154
+ "@config.aggregation",
155
+ "min"
156
+ ],
157
+ [
158
+ "array/min",
159
+ [
160
+ "object/get",
161
+ "@entry",
162
+ "1"
163
+ ],
164
+ "@config.valueField"
165
+ ],
166
+ [
167
+ "if",
168
+ [
169
+ "=",
170
+ "@config.aggregation",
171
+ "max"
172
+ ],
173
+ [
174
+ "array/max",
175
+ [
176
+ "object/get",
177
+ "@entry",
178
+ "1"
179
+ ],
180
+ "@config.valueField"
181
+ ],
182
+ [
183
+ "array/len",
184
+ [
185
+ "object/get",
186
+ "@entry",
187
+ "1"
188
+ ]
189
+ ]
190
+ ]
191
+ ]
192
+ ]
193
+ ],
194
+ "label": [
195
+ "object/get",
196
+ "@entry",
197
+ "0"
198
+ ]
199
+ }
200
+ ]
201
+ ]
202
+ ],
203
+ [
204
+ "render-ui",
205
+ "main",
206
+ {
207
+ "chartType": "@config.chartType",
208
+ "type": "chart",
209
+ "height": "@config.height",
210
+ "subtitle": "@config.subtitle",
211
+ "data": "@entity.chartData",
212
+ "title": "@config.title",
213
+ "showLegend": "@config.showLegend",
214
+ "showValues": "@config.showValues"
215
+ }
216
+ ]
217
+ ]
218
+ }
219
+ ]
220
+ },
221
+ "config": {
222
+ "chartType": {
223
+ "type": "string",
224
+ "default": "bar"
225
+ },
226
+ "height": {
227
+ "type": "number",
228
+ "default": 280.0
229
+ },
230
+ "valueField": {
231
+ "type": "string",
232
+ "default": ""
233
+ },
234
+ "title": {
235
+ "type": "string",
236
+ "default": ""
237
+ },
238
+ "aggregation": {
239
+ "type": "string",
240
+ "default": "count"
241
+ },
242
+ "categoryField": {
243
+ "type": "string",
244
+ "default": ""
245
+ },
246
+ "subtitle": {
247
+ "type": "string",
248
+ "default": ""
249
+ },
250
+ "showValues": {
251
+ "type": "boolean",
252
+ "default": false
253
+ },
254
+ "showLegend": {
255
+ "type": "boolean",
256
+ "default": true
257
+ }
258
+ },
259
+ "scope": "instance"
260
+ }
261
+ ],
262
+ "pages": [
263
+ {
264
+ "name": "GraphItemGraphPage",
265
+ "path": "/graphitems",
266
+ "traits": [
267
+ {
268
+ "ref": "GraphItemGraph"
269
+ }
270
+ ]
271
+ }
272
+ ]
273
+ }
274
+ ]
275
+ }
@@ -106,6 +106,16 @@
106
106
  "to": "idle",
107
107
  "event": "INIT",
108
108
  "effects": [
109
+ [
110
+ "set",
111
+ "@entity.currentPage",
112
+ 1.0
113
+ ],
114
+ [
115
+ "set",
116
+ "@entity.totalPages",
117
+ 1.0
118
+ ],
109
119
  [
110
120
  "fetch",
111
121
  "PagedItem",
@@ -119,11 +129,11 @@
119
129
  "render-ui",
120
130
  "main",
121
131
  {
122
- "pageChangeEvent": "@config.event",
123
- "type": "pagination",
124
- "showPageSize": false,
125
132
  "totalPages": "@entity.totalPages",
126
- "currentPage": "@entity.currentPage"
133
+ "type": "pagination",
134
+ "currentPage": "@entity.currentPage",
135
+ "pageChangeEvent": "@config.event",
136
+ "showPageSize": false
127
137
  }
128
138
  ]
129
139
  ]
@@ -139,8 +149,8 @@
139
149
  {
140
150
  "type": "pagination",
141
151
  "currentPage": "@entity.currentPage",
142
- "pageChangeEvent": "@config.event",
143
152
  "totalPages": "@entity.totalPages",
153
+ "pageChangeEvent": "@config.event",
144
154
  "showPageSize": false
145
155
  }
146
156
  ]
@@ -160,10 +170,10 @@
160
170
  "render-ui",
161
171
  "main",
162
172
  {
163
- "pageChangeEvent": "@config.event",
164
- "totalPages": "@entity.totalPages",
165
173
  "type": "pagination",
166
174
  "currentPage": "@entity.currentPage",
175
+ "pageChangeEvent": "@config.event",
176
+ "totalPages": "@entity.totalPages",
167
177
  "showPageSize": false
168
178
  }
169
179
  ]
@@ -192,9 +202,9 @@
192
202
  {
193
203
  "pageChangeEvent": "@config.event",
194
204
  "totalPages": "@entity.totalPages",
195
- "showPageSize": false,
196
205
  "currentPage": "@entity.currentPage",
197
- "type": "pagination"
206
+ "type": "pagination",
207
+ "showPageSize": false
198
208
  }
199
209
  ]
200
210
  ]
@@ -202,13 +212,13 @@
202
212
  ]
203
213
  },
204
214
  "config": {
205
- "event": {
206
- "type": "string",
207
- "default": "PAGE"
208
- },
209
215
  "pageSize": {
210
216
  "type": "number",
211
217
  "default": 10.0
218
+ },
219
+ "event": {
220
+ "type": "string",
221
+ "default": "PAGE"
212
222
  }
213
223
  },
214
224
  "scope": "instance"
@@ -0,0 +1,329 @@
1
+ {
2
+ "name": "std-stats",
3
+ "version": "1.0.0",
4
+ "description": "std-stats — embeddable analytics-card atom. Drop into a dashboard\nmolecule alongside std-browse / std-search / std-filter; wire its\nITEMS_LOADED listener to the upstream collection's success emit, then\nconfigure `metrics` per call-site to declare WHICH aggregations to\nshow.\n\nAggregation runs in the lolo state machine (no custom React component\nbeyond stat-display): the ITEMS_LOADED transition uses array/map over\n@config.metrics with a chained `if` to dispatch each metric to the\nright reducer (array/len | array/sum | array/avg | array/min |\narray/max), and the resulting cards array drops into a data-list\nwhose renderItem maps each card to a stat-display pattern. The atom\nowns its own auxiliary entity (StatsItem) for UI state — explicit-\nbinding rule applies: every @entity.X is set explicitly via\n(set @entity.X ...) on each transition.\n\nEach entry in `metrics` is `{ aggregation, field, label, icon,\nformat, variant, max }` where:\n- aggregation ∈ count|sum|avg|min|max (default count)\n- field is the numeric entity field for sum/avg/min/max\n- label is the card title (required)\n- icon, format (number|currency|percent), variant\n (default|primary|success|warning|error|info), max are pass-through\n to the stat-display render.",
5
+ "orbitals": [
6
+ {
7
+ "name": "StatsItemOrbital",
8
+ "entity": {
9
+ "name": "StatsItem",
10
+ "persistence": "runtime",
11
+ "fields": [
12
+ {
13
+ "name": "id",
14
+ "type": "string",
15
+ "required": true
16
+ },
17
+ {
18
+ "name": "cards",
19
+ "type": "array",
20
+ "default": [],
21
+ "items": {
22
+ "type": "object",
23
+ "properties": {
24
+ "max": {
25
+ "name": "max",
26
+ "type": "number"
27
+ },
28
+ "label": {
29
+ "name": "label",
30
+ "type": "string"
31
+ },
32
+ "value": {
33
+ "name": "value",
34
+ "type": "number"
35
+ },
36
+ "variant": {
37
+ "name": "variant",
38
+ "type": "string",
39
+ "values": [
40
+ "default",
41
+ "primary",
42
+ "success",
43
+ "warning",
44
+ "error",
45
+ "info"
46
+ ]
47
+ },
48
+ "icon": {
49
+ "name": "icon",
50
+ "type": "string"
51
+ },
52
+ "format": {
53
+ "name": "format",
54
+ "type": "string",
55
+ "values": [
56
+ "number",
57
+ "currency",
58
+ "percent"
59
+ ]
60
+ }
61
+ }
62
+ }
63
+ }
64
+ ]
65
+ },
66
+ "traits": [
67
+ {
68
+ "name": "StatsItemStats",
69
+ "category": "interaction",
70
+ "linkedEntity": "StatsItem",
71
+ "stateMachine": {
72
+ "states": [
73
+ {
74
+ "name": "idle",
75
+ "isInitial": true
76
+ }
77
+ ],
78
+ "events": [
79
+ {
80
+ "key": "INIT",
81
+ "name": "Initialize"
82
+ },
83
+ {
84
+ "key": "ITEMS_LOADED",
85
+ "name": "Items Loaded",
86
+ "payloadSchema": [
87
+ {
88
+ "name": "data",
89
+ "type": "[object]"
90
+ },
91
+ {
92
+ "name": "totalCount",
93
+ "type": "number"
94
+ }
95
+ ]
96
+ }
97
+ ],
98
+ "transitions": [
99
+ {
100
+ "from": "idle",
101
+ "to": "idle",
102
+ "event": "INIT",
103
+ "effects": [
104
+ [
105
+ "set",
106
+ "@entity.cards",
107
+ []
108
+ ],
109
+ [
110
+ "render-ui",
111
+ "main",
112
+ {
113
+ "type": "data-list",
114
+ "fields": [],
115
+ "entity": "@entity.cards",
116
+ "renderItem": [
117
+ "fn",
118
+ "card",
119
+ {
120
+ "label": "@card.label",
121
+ "format": "@card.format",
122
+ "type": "stat-display",
123
+ "variant": "@card.variant",
124
+ "value": "@card.value",
125
+ "max": "@card.max",
126
+ "icon": "@card.icon"
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ ]
132
+ },
133
+ {
134
+ "from": "idle",
135
+ "to": "idle",
136
+ "event": "ITEMS_LOADED",
137
+ "effects": [
138
+ [
139
+ "set",
140
+ "@entity.cards",
141
+ [
142
+ "array/map",
143
+ "@config.metrics",
144
+ [
145
+ "fn",
146
+ "metric",
147
+ {
148
+ "icon": [
149
+ "object/get",
150
+ "@metric",
151
+ "icon",
152
+ ""
153
+ ],
154
+ "variant": [
155
+ "object/get",
156
+ "@metric",
157
+ "variant",
158
+ "default"
159
+ ],
160
+ "value": [
161
+ "if",
162
+ [
163
+ "=",
164
+ [
165
+ "object/get",
166
+ "@metric",
167
+ "aggregation",
168
+ "count"
169
+ ],
170
+ "sum"
171
+ ],
172
+ [
173
+ "array/sum",
174
+ "@payload.data",
175
+ [
176
+ "object/get",
177
+ "@metric",
178
+ "field",
179
+ ""
180
+ ]
181
+ ],
182
+ [
183
+ "if",
184
+ [
185
+ "=",
186
+ [
187
+ "object/get",
188
+ "@metric",
189
+ "aggregation",
190
+ "count"
191
+ ],
192
+ "avg"
193
+ ],
194
+ [
195
+ "array/avg",
196
+ "@payload.data",
197
+ [
198
+ "object/get",
199
+ "@metric",
200
+ "field",
201
+ ""
202
+ ]
203
+ ],
204
+ [
205
+ "if",
206
+ [
207
+ "=",
208
+ [
209
+ "object/get",
210
+ "@metric",
211
+ "aggregation",
212
+ "count"
213
+ ],
214
+ "min"
215
+ ],
216
+ [
217
+ "array/min",
218
+ "@payload.data",
219
+ [
220
+ "object/get",
221
+ "@metric",
222
+ "field",
223
+ ""
224
+ ]
225
+ ],
226
+ [
227
+ "if",
228
+ [
229
+ "=",
230
+ [
231
+ "object/get",
232
+ "@metric",
233
+ "aggregation",
234
+ "count"
235
+ ],
236
+ "max"
237
+ ],
238
+ [
239
+ "array/max",
240
+ "@payload.data",
241
+ [
242
+ "object/get",
243
+ "@metric",
244
+ "field",
245
+ ""
246
+ ]
247
+ ],
248
+ [
249
+ "array/len",
250
+ "@payload.data"
251
+ ]
252
+ ]
253
+ ]
254
+ ]
255
+ ],
256
+ "format": [
257
+ "object/get",
258
+ "@metric",
259
+ "format",
260
+ "number"
261
+ ],
262
+ "label": [
263
+ "object/get",
264
+ "@metric",
265
+ "label"
266
+ ],
267
+ "max": [
268
+ "object/get",
269
+ "@metric",
270
+ "max",
271
+ 0.0
272
+ ]
273
+ }
274
+ ]
275
+ ]
276
+ ],
277
+ [
278
+ "render-ui",
279
+ "main",
280
+ {
281
+ "type": "data-list",
282
+ "entity": "@entity.cards",
283
+ "fields": [],
284
+ "renderItem": [
285
+ "fn",
286
+ "card",
287
+ {
288
+ "icon": "@card.icon",
289
+ "label": "@card.label",
290
+ "variant": "@card.variant",
291
+ "format": "@card.format",
292
+ "max": "@card.max",
293
+ "type": "stat-display",
294
+ "value": "@card.value"
295
+ }
296
+ ]
297
+ }
298
+ ]
299
+ ]
300
+ }
301
+ ]
302
+ },
303
+ "config": {
304
+ "metrics": {
305
+ "type": "[object]",
306
+ "default": []
307
+ },
308
+ "title": {
309
+ "type": "string",
310
+ "default": ""
311
+ }
312
+ },
313
+ "scope": "instance"
314
+ }
315
+ ],
316
+ "pages": [
317
+ {
318
+ "name": "StatsItemStatsPage",
319
+ "path": "/statsitems",
320
+ "traits": [
321
+ {
322
+ "ref": "StatsItemStats"
323
+ }
324
+ ]
325
+ }
326
+ ]
327
+ }
328
+ ]
329
+ }