@almadar/std 13.2.7 → 13.4.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
+ }
@@ -0,0 +1,418 @@
1
+ {
2
+ "name": "std-stats",
3
+ "version": "2.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, applies the per-metric `filter` predicate to\n@payload.data, then dispatches the chosen aggregation kind. Cards\ndrop into a data-list whose renderItem maps each card to a\nstat-display pattern. The atom owns an auxiliary entity (StatsItem)\nfor UI state — explicit-binding rule applies: every @entity.X is set\nexplicitly via (set @entity.X ...) on each transition.\n\nEach entry in `metrics` (all but `label` optional):\n- label string! card title\n- aggregation count|sum|avg|min|max default count what to compute\n- field string numeric entity field for sum/avg/min/max\n- filter SExpression row predicate (e.g. [\"=\", \"@item.status\", \"active\"])\n Drops rows that don't match BEFORE aggregation.\n Omitted = all rows.\n- format number|currency|percent default number value formatting\n- variant default|primary|success|warning|error|info color\n- icon string lucide icon name\n- prefix string prepended to displayed value (e.g. \"≈ \")\n- suffix string appended (e.g. \" /mo\", \" ms\")\n- max number optional denominator. >0 renders \"value / max\".\n- target number optional progress target. >0 renders a progress bar.\n- trend number signed delta vs previous period. >0 ↑ green, <0 ↓ red.\n\nFor dynamic max/target/trend (computed against @payload.data),\nschema authors today must precompute and pass literal numbers; an\nSExpression-evaluating slot is a future extension.",
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
+ "suffix": {
25
+ "name": "suffix",
26
+ "type": "string"
27
+ },
28
+ "value": {
29
+ "name": "value",
30
+ "type": "number"
31
+ },
32
+ "icon": {
33
+ "name": "icon",
34
+ "type": "string"
35
+ },
36
+ "format": {
37
+ "name": "format",
38
+ "type": "string",
39
+ "values": [
40
+ "number",
41
+ "currency",
42
+ "percent"
43
+ ]
44
+ },
45
+ "max": {
46
+ "name": "max",
47
+ "type": "number"
48
+ },
49
+ "target": {
50
+ "name": "target",
51
+ "type": "number"
52
+ },
53
+ "variant": {
54
+ "name": "variant",
55
+ "type": "string",
56
+ "values": [
57
+ "default",
58
+ "primary",
59
+ "success",
60
+ "warning",
61
+ "error",
62
+ "info"
63
+ ]
64
+ },
65
+ "prefix": {
66
+ "name": "prefix",
67
+ "type": "string"
68
+ },
69
+ "trend": {
70
+ "name": "trend",
71
+ "type": "number"
72
+ },
73
+ "label": {
74
+ "name": "label",
75
+ "type": "string"
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ]
81
+ },
82
+ "traits": [
83
+ {
84
+ "name": "StatsItemStats",
85
+ "category": "interaction",
86
+ "linkedEntity": "StatsItem",
87
+ "stateMachine": {
88
+ "states": [
89
+ {
90
+ "name": "idle",
91
+ "isInitial": true
92
+ }
93
+ ],
94
+ "events": [
95
+ {
96
+ "key": "INIT",
97
+ "name": "Initialize"
98
+ },
99
+ {
100
+ "key": "ITEMS_LOADED",
101
+ "name": "Items Loaded",
102
+ "payloadSchema": [
103
+ {
104
+ "name": "data",
105
+ "type": "[object]"
106
+ },
107
+ {
108
+ "name": "totalCount",
109
+ "type": "number"
110
+ }
111
+ ]
112
+ }
113
+ ],
114
+ "transitions": [
115
+ {
116
+ "from": "idle",
117
+ "to": "idle",
118
+ "event": "INIT",
119
+ "effects": [
120
+ [
121
+ "set",
122
+ "@entity.cards",
123
+ []
124
+ ],
125
+ [
126
+ "render-ui",
127
+ "main",
128
+ {
129
+ "entity": "@entity.cards",
130
+ "fields": [],
131
+ "type": "data-list",
132
+ "renderItem": [
133
+ "fn",
134
+ "card",
135
+ {
136
+ "max": "@card.max",
137
+ "value": "@card.value",
138
+ "type": "stat-display",
139
+ "label": "@card.label",
140
+ "variant": "@card.variant",
141
+ "format": "@card.format",
142
+ "icon": "@card.icon"
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ ]
148
+ },
149
+ {
150
+ "from": "idle",
151
+ "to": "idle",
152
+ "event": "ITEMS_LOADED",
153
+ "effects": [
154
+ [
155
+ "set",
156
+ "@entity.cards",
157
+ [
158
+ "array/map",
159
+ "@config.metrics",
160
+ [
161
+ "fn",
162
+ "metric",
163
+ {
164
+ "format": [
165
+ "object/get",
166
+ "@metric",
167
+ "format",
168
+ "number"
169
+ ],
170
+ "max": [
171
+ "object/get",
172
+ "@metric",
173
+ "max",
174
+ 0.0
175
+ ],
176
+ "trend": [
177
+ "object/get",
178
+ "@metric",
179
+ "trend",
180
+ 0.0
181
+ ],
182
+ "suffix": [
183
+ "object/get",
184
+ "@metric",
185
+ "suffix",
186
+ ""
187
+ ],
188
+ "value": [
189
+ "if",
190
+ [
191
+ "=",
192
+ [
193
+ "object/get",
194
+ "@metric",
195
+ "aggregation",
196
+ "count"
197
+ ],
198
+ "sum"
199
+ ],
200
+ [
201
+ "array/sum",
202
+ [
203
+ "array/filter",
204
+ "@payload.data",
205
+ [
206
+ "object/get",
207
+ "@metric",
208
+ "filter",
209
+ true
210
+ ]
211
+ ],
212
+ [
213
+ "object/get",
214
+ "@metric",
215
+ "field",
216
+ ""
217
+ ]
218
+ ],
219
+ [
220
+ "if",
221
+ [
222
+ "=",
223
+ [
224
+ "object/get",
225
+ "@metric",
226
+ "aggregation",
227
+ "count"
228
+ ],
229
+ "avg"
230
+ ],
231
+ [
232
+ "array/avg",
233
+ [
234
+ "array/filter",
235
+ "@payload.data",
236
+ [
237
+ "object/get",
238
+ "@metric",
239
+ "filter",
240
+ true
241
+ ]
242
+ ],
243
+ [
244
+ "object/get",
245
+ "@metric",
246
+ "field",
247
+ ""
248
+ ]
249
+ ],
250
+ [
251
+ "if",
252
+ [
253
+ "=",
254
+ [
255
+ "object/get",
256
+ "@metric",
257
+ "aggregation",
258
+ "count"
259
+ ],
260
+ "min"
261
+ ],
262
+ [
263
+ "array/min",
264
+ [
265
+ "array/filter",
266
+ "@payload.data",
267
+ [
268
+ "object/get",
269
+ "@metric",
270
+ "filter",
271
+ true
272
+ ]
273
+ ],
274
+ [
275
+ "object/get",
276
+ "@metric",
277
+ "field",
278
+ ""
279
+ ]
280
+ ],
281
+ [
282
+ "if",
283
+ [
284
+ "=",
285
+ [
286
+ "object/get",
287
+ "@metric",
288
+ "aggregation",
289
+ "count"
290
+ ],
291
+ "max"
292
+ ],
293
+ [
294
+ "array/max",
295
+ [
296
+ "array/filter",
297
+ "@payload.data",
298
+ [
299
+ "object/get",
300
+ "@metric",
301
+ "filter",
302
+ true
303
+ ]
304
+ ],
305
+ [
306
+ "object/get",
307
+ "@metric",
308
+ "field",
309
+ ""
310
+ ]
311
+ ],
312
+ [
313
+ "array/len",
314
+ [
315
+ "array/filter",
316
+ "@payload.data",
317
+ [
318
+ "object/get",
319
+ "@metric",
320
+ "filter",
321
+ true
322
+ ]
323
+ ]
324
+ ]
325
+ ]
326
+ ]
327
+ ]
328
+ ],
329
+ "label": [
330
+ "object/get",
331
+ "@metric",
332
+ "label"
333
+ ],
334
+ "variant": [
335
+ "object/get",
336
+ "@metric",
337
+ "variant",
338
+ "default"
339
+ ],
340
+ "icon": [
341
+ "object/get",
342
+ "@metric",
343
+ "icon",
344
+ ""
345
+ ],
346
+ "target": [
347
+ "object/get",
348
+ "@metric",
349
+ "target",
350
+ 0.0
351
+ ],
352
+ "prefix": [
353
+ "object/get",
354
+ "@metric",
355
+ "prefix",
356
+ ""
357
+ ]
358
+ }
359
+ ]
360
+ ]
361
+ ],
362
+ [
363
+ "render-ui",
364
+ "main",
365
+ {
366
+ "renderItem": [
367
+ "fn",
368
+ "card",
369
+ {
370
+ "type": "stat-display",
371
+ "icon": "@card.icon",
372
+ "max": "@card.max",
373
+ "suffix": "@card.suffix",
374
+ "format": "@card.format",
375
+ "value": "@card.value",
376
+ "label": "@card.label",
377
+ "variant": "@card.variant",
378
+ "prefix": "@card.prefix",
379
+ "target": "@card.target",
380
+ "trend": "@card.trend"
381
+ }
382
+ ],
383
+ "type": "data-list",
384
+ "entity": "@entity.cards",
385
+ "fields": []
386
+ }
387
+ ]
388
+ ]
389
+ }
390
+ ]
391
+ },
392
+ "config": {
393
+ "metrics": {
394
+ "type": "[object]",
395
+ "default": []
396
+ },
397
+ "title": {
398
+ "type": "string",
399
+ "default": ""
400
+ }
401
+ },
402
+ "scope": "instance"
403
+ }
404
+ ],
405
+ "pages": [
406
+ {
407
+ "name": "StatsItemStatsPage",
408
+ "path": "/statsitems",
409
+ "traits": [
410
+ {
411
+ "ref": "StatsItemStats"
412
+ }
413
+ ]
414
+ }
415
+ ]
416
+ }
417
+ ]
418
+ }