@almadar/std 7.4.1 → 7.4.3

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.
Files changed (32) hide show
  1. package/behaviors/registry/atoms/std-modal.orb +15 -9
  2. package/behaviors/registry/atoms/std-wizard.orb +306 -293
  3. package/behaviors/registry/molecules/std-detail.orb +513 -292
  4. package/behaviors/registry/molecules/std-geospatial.orb +543 -406
  5. package/behaviors/registry/molecules/std-inventory.orb +489 -445
  6. package/behaviors/registry/molecules/std-list.orb +492 -616
  7. package/behaviors/registry/molecules/std-messaging.orb +511 -327
  8. package/behaviors/registry/molecules/std-wizard-form.orb +2 -101
  9. package/dist/behaviors/behaviors-registry.json +1976 -719
  10. package/dist/behaviors/exports-reader.js +71 -11
  11. package/dist/behaviors/exports-reader.js.map +1 -1
  12. package/dist/behaviors/functions/index.d.ts +11 -3
  13. package/dist/behaviors/functions/index.js +67 -11
  14. package/dist/behaviors/functions/index.js.map +1 -1
  15. package/dist/behaviors/index.d.ts +1 -1
  16. package/dist/behaviors/index.js +72 -12
  17. package/dist/behaviors/index.js.map +1 -1
  18. package/dist/behaviors/query.js +71 -11
  19. package/dist/behaviors/query.js.map +1 -1
  20. package/dist/behaviors/registry/atoms/std-modal.orb +15 -9
  21. package/dist/behaviors/registry/atoms/std-wizard.orb +306 -293
  22. package/dist/behaviors/registry/molecules/std-detail.orb +513 -292
  23. package/dist/behaviors/registry/molecules/std-geospatial.orb +543 -406
  24. package/dist/behaviors/registry/molecules/std-inventory.orb +489 -445
  25. package/dist/behaviors/registry/molecules/std-list.orb +492 -616
  26. package/dist/behaviors/registry/molecules/std-messaging.orb +511 -327
  27. package/dist/behaviors/registry/molecules/std-wizard-form.orb +2 -101
  28. package/dist/behaviors-registry.json +1976 -719
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +72 -12
  31. package/dist/index.js.map +1 -1
  32. package/package.json +1 -1
@@ -6,10 +6,6 @@
6
6
  {
7
7
  "name": "ListItemOrbital",
8
8
  "uses": [
9
- {
10
- "from": "std/behaviors/std-browse",
11
- "as": "Browse"
12
- },
13
9
  {
14
10
  "from": "std/behaviors/std-confirmation",
15
11
  "as": "Confirmation"
@@ -26,11 +22,13 @@
26
22
  "fields": [
27
23
  {
28
24
  "name": "id",
29
- "type": "string"
25
+ "type": "string",
26
+ "required": true
30
27
  },
31
28
  {
32
29
  "name": "name",
33
- "type": "string"
30
+ "type": "string",
31
+ "required": true
34
32
  },
35
33
  {
36
34
  "name": "description",
@@ -49,709 +47,587 @@
49
47
  {
50
48
  "name": "createdAt",
51
49
  "type": "string"
50
+ },
51
+ {
52
+ "name": "pendingId",
53
+ "type": "string",
54
+ "default": ""
52
55
  }
53
56
  ]
54
57
  },
55
58
  "traits": [
56
59
  {
57
- "ref": "Browse.traits.BrowseItemBrowse",
58
60
  "name": "ListItemBrowse",
61
+ "category": "interaction",
59
62
  "linkedEntity": "ListItem",
63
+ "emits": [
64
+ {
65
+ "event": "ListItemLoaded",
66
+ "description": "Fired when the ListItem collection finishes loading; payload.data holds the list",
67
+ "scope": "internal",
68
+ "payload": [
69
+ {
70
+ "name": "data",
71
+ "type": "[ListItem]"
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "event": "ListItemLoadFailed",
77
+ "description": "Fired when the ListItem collection fails to load",
78
+ "scope": "internal",
79
+ "payload": [
80
+ {
81
+ "name": "error",
82
+ "type": "string"
83
+ },
84
+ {
85
+ "name": "code",
86
+ "type": "string"
87
+ }
88
+ ]
89
+ }
90
+ ],
60
91
  "listens": [
61
92
  {
62
- "event": "LIST_ITEM_CREATED",
93
+ "event": "ITEM_CREATED",
63
94
  "triggers": "INIT",
64
95
  "source": {
65
96
  "kind": "trait",
66
- "trait": "ListItemCreate"
97
+ "trait": "ListItemPersistor"
67
98
  }
68
99
  },
69
100
  {
70
- "event": "LIST_ITEM_UPDATED",
101
+ "event": "ITEM_UPDATED",
71
102
  "triggers": "INIT",
72
103
  "source": {
73
104
  "kind": "trait",
74
- "trait": "ListItemEdit"
105
+ "trait": "ListItemPersistor"
75
106
  }
76
107
  },
77
108
  {
78
- "event": "CONFIRM_DELETE",
109
+ "event": "ITEM_DELETED",
79
110
  "triggers": "INIT",
80
111
  "source": {
81
112
  "kind": "trait",
82
- "trait": "ListItemDelete"
113
+ "trait": "ListItemPersistor"
83
114
  }
84
115
  }
85
116
  ],
86
- "effects": {
87
- "INIT": [
88
- [
89
- "ref",
90
- "ListItem"
91
- ],
92
- [
93
- "render-ui",
94
- "main",
95
- {
96
- "type": "stack",
97
- "direction": "vertical",
98
- "children": [
117
+ "stateMachine": {
118
+ "states": [
119
+ {
120
+ "name": "loading",
121
+ "isInitial": true
122
+ },
123
+ {
124
+ "name": "browsing"
125
+ },
126
+ {
127
+ "name": "error"
128
+ }
129
+ ],
130
+ "events": [
131
+ {
132
+ "key": "INIT",
133
+ "name": "Initialize"
134
+ },
135
+ {
136
+ "key": "ListItemLoaded",
137
+ "name": "ListItem loaded",
138
+ "payload": [
139
+ {
140
+ "name": "data",
141
+ "type": "[ListItem]"
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ "key": "ListItemLoadFailed",
147
+ "name": "ListItem load failed",
148
+ "payload": [
149
+ {
150
+ "name": "error",
151
+ "type": "string",
152
+ "required": true
153
+ },
154
+ {
155
+ "name": "code",
156
+ "type": "string"
157
+ }
158
+ ]
159
+ }
160
+ ],
161
+ "transitions": [
162
+ {
163
+ "from": "loading",
164
+ "to": "loading",
165
+ "event": "INIT",
166
+ "effects": [
167
+ [
168
+ "fetch",
169
+ "ListItem",
99
170
  {
171
+ "emit": {
172
+ "success": "ListItemLoaded",
173
+ "failure": "ListItemLoadFailed"
174
+ }
175
+ }
176
+ ],
177
+ [
178
+ "render-ui",
179
+ "main",
180
+ {
181
+ "className": "py-12",
182
+ "children": [
183
+ {
184
+ "size": "lg",
185
+ "type": "spinner"
186
+ },
187
+ {
188
+ "variant": "caption",
189
+ "color": "muted",
190
+ "content": "Loading list…",
191
+ "type": "typography"
192
+ }
193
+ ],
194
+ "direction": "vertical",
195
+ "type": "stack",
100
196
  "gap": "md",
101
- "justify": "space-between",
102
- "align": "center",
103
- "direction": "horizontal",
197
+ "align": "center"
198
+ }
199
+ ]
200
+ ]
201
+ },
202
+ {
203
+ "from": "loading",
204
+ "to": "browsing",
205
+ "event": "ListItemLoaded",
206
+ "effects": [
207
+ [
208
+ "render-ui",
209
+ "main",
210
+ {
104
211
  "children": [
105
212
  {
213
+ "direction": "horizontal",
214
+ "justify": "between",
106
215
  "children": [
107
216
  {
108
- "type": "icon",
109
- "name": "list",
110
- "size": "lg"
217
+ "direction": "horizontal",
218
+ "gap": "md",
219
+ "type": "stack",
220
+ "children": [
221
+ {
222
+ "size": "lg",
223
+ "name": "list",
224
+ "type": "icon"
225
+ },
226
+ {
227
+ "variant": "h2",
228
+ "type": "typography",
229
+ "content": "ListItems"
230
+ }
231
+ ]
111
232
  },
112
233
  {
113
- "type": "typography",
114
- "content": "ListItems",
115
- "variant": "h2"
234
+ "action": "CREATE",
235
+ "label": "Create",
236
+ "icon": "plus",
237
+ "type": "button",
238
+ "variant": "primary"
116
239
  }
117
240
  ],
118
- "align": "center",
119
- "gap": "sm",
120
241
  "type": "stack",
121
- "direction": "horizontal"
242
+ "gap": "md"
122
243
  },
123
244
  {
124
- "type": "stack",
125
- "gap": "sm",
126
- "direction": "horizontal",
127
- "children": [
245
+ "type": "divider"
246
+ },
247
+ {
248
+ "type": "data-grid",
249
+ "fields": [
128
250
  {
129
- "label": "Create ListItem",
130
- "type": "button",
131
- "variant": "primary",
132
- "icon": "plus",
133
- "event": "CREATE"
251
+ "variant": "h4",
252
+ "label": "Name",
253
+ "icon": "list",
254
+ "name": "name"
255
+ },
256
+ {
257
+ "label": "Description",
258
+ "variant": "caption",
259
+ "name": "description"
260
+ },
261
+ {
262
+ "variant": "badge",
263
+ "name": "status",
264
+ "label": "Status"
265
+ }
266
+ ],
267
+ "itemActions": [
268
+ {
269
+ "event": "EDIT",
270
+ "variant": "ghost",
271
+ "label": "Edit"
272
+ },
273
+ {
274
+ "label": "Delete",
275
+ "event": "DELETE",
276
+ "variant": "danger"
134
277
  }
135
- ]
278
+ ],
279
+ "entity": "@payload.data"
136
280
  }
137
281
  ],
138
- "type": "stack"
139
- },
140
- {
141
- "type": "divider"
142
- },
282
+ "type": "stack",
283
+ "className": "max-w-5xl mx-auto w-full",
284
+ "gap": "lg",
285
+ "direction": "vertical"
286
+ }
287
+ ]
288
+ ]
289
+ },
290
+ {
291
+ "from": "loading",
292
+ "to": "error",
293
+ "event": "ListItemLoadFailed",
294
+ "effects": [
295
+ [
296
+ "render-ui",
297
+ "main",
143
298
  {
144
- "entity": "ListItem",
145
- "emptyTitle": "No listitems yet",
146
- "emptyDescription": "Create your first listitem to get started.",
147
- "itemActions": [
148
- {
149
- "size": "sm",
150
- "variant": "ghost",
151
- "label": "View",
152
- "event": "VIEW"
153
- },
299
+ "gap": "md",
300
+ "children": [
154
301
  {
155
- "label": "Edit",
156
- "size": "sm",
157
- "event": "EDIT",
158
- "variant": "ghost"
302
+ "size": "xl",
303
+ "name": "alert-triangle",
304
+ "color": "destructive",
305
+ "type": "icon"
159
306
  },
160
307
  {
161
- "event": "DELETE",
162
- "size": "sm",
163
- "variant": "danger",
164
- "label": "Delete"
165
- }
166
- ],
167
- "columns": [
168
- {
169
- "icon": "list",
170
- "label": "Name",
171
- "variant": "h4",
172
- "name": "name"
308
+ "type": "typography",
309
+ "variant": "h3",
310
+ "content": "Failed to load list"
173
311
  },
174
312
  {
175
- "name": "description",
176
- "variant": "badge",
177
- "label": "Description",
178
- "colorMap": {
179
- "pending": "warning",
180
- "active": "success",
181
- "archived": "neutral",
182
- "error": "destructive",
183
- "done": "success",
184
- "draft": "warning",
185
- "completed": "success",
186
- "inactive": "neutral",
187
- "scheduled": "warning",
188
- "disabled": "neutral",
189
- "cancelled": "destructive",
190
- "failed": "destructive"
191
- }
313
+ "type": "typography",
314
+ "content": "@payload.error",
315
+ "color": "muted",
316
+ "variant": "body"
192
317
  },
193
318
  {
194
- "variant": "caption",
195
- "label": "Status",
196
- "name": "status"
319
+ "type": "button",
320
+ "icon": "rotate-ccw",
321
+ "action": "INIT",
322
+ "label": "Retry",
323
+ "variant": "primary"
197
324
  }
198
325
  ],
199
- "type": "data-grid",
200
- "emptyIcon": "inbox"
326
+ "type": "stack",
327
+ "align": "center",
328
+ "direction": "vertical",
329
+ "className": "py-12"
330
+ }
331
+ ]
332
+ ]
333
+ },
334
+ {
335
+ "from": "browsing",
336
+ "to": "loading",
337
+ "event": "INIT",
338
+ "effects": [
339
+ [
340
+ "fetch",
341
+ "ListItem",
342
+ {
343
+ "emit": {
344
+ "failure": "ListItemLoadFailed",
345
+ "success": "ListItemLoaded"
346
+ }
201
347
  }
202
348
  ],
203
- "gap": "lg",
204
- "className": "max-w-5xl mx-auto w-full"
205
- }
206
- ]
349
+ [
350
+ "render-ui",
351
+ "main",
352
+ {
353
+ "size": "lg",
354
+ "type": "spinner"
355
+ }
356
+ ]
357
+ ]
358
+ },
359
+ {
360
+ "from": "error",
361
+ "to": "loading",
362
+ "event": "INIT",
363
+ "effects": [
364
+ [
365
+ "fetch",
366
+ "ListItem",
367
+ {
368
+ "emit": {
369
+ "failure": "ListItemLoadFailed",
370
+ "success": "ListItemLoaded"
371
+ }
372
+ }
373
+ ],
374
+ [
375
+ "render-ui",
376
+ "main",
377
+ {
378
+ "type": "spinner",
379
+ "size": "lg"
380
+ }
381
+ ]
382
+ ]
383
+ }
207
384
  ]
208
- }
385
+ },
386
+ "scope": "collection"
209
387
  },
210
388
  {
211
389
  "ref": "Modal.traits.ModalRecordModal",
212
390
  "name": "ListItemCreate",
213
391
  "linkedEntity": "ListItem",
392
+ "config": {
393
+ "title": "Create ListItem",
394
+ "fields": [
395
+ "name",
396
+ "description",
397
+ "status"
398
+ ],
399
+ "mode": "create",
400
+ "icon": "plus-circle"
401
+ },
214
402
  "events": {
215
403
  "SAVE": "LIST_ITEM_CREATED",
216
404
  "OPEN": "CREATE"
217
- },
218
- "effects": {
219
- "CREATE": [
220
- [
221
- "fetch",
222
- "ListItem"
223
- ],
224
- [
225
- "render-ui",
226
- "modal",
227
- {
228
- "children": [
229
- {
230
- "type": "stack",
231
- "children": [
232
- {
233
- "type": "icon",
234
- "size": "md",
235
- "name": "plus-circle"
236
- },
237
- {
238
- "type": "typography",
239
- "content": "Create ListItem",
240
- "variant": "h3"
241
- }
242
- ],
243
- "direction": "horizontal",
244
- "gap": "sm"
245
- },
246
- {
247
- "type": "divider"
248
- },
249
- {
250
- "entity": "ListItem",
251
- "type": "form-section",
252
- "submitEvent": "SAVE",
253
- "fields": [
254
- "name",
255
- "description",
256
- "status"
257
- ],
258
- "cancelEvent": "CLOSE",
259
- "mode": "create"
260
- }
261
- ],
262
- "type": "stack",
263
- "gap": "md",
264
- "direction": "vertical"
265
- }
266
- ]
267
- ],
268
- "INIT": [
269
- [
270
- "ref",
271
- "ListItem"
272
- ]
273
- ],
274
- "CLOSE": [
275
- [
276
- "render-ui",
277
- "modal",
278
- null
279
- ],
280
- [
281
- "render-ui",
282
- "main",
283
- {
284
- "type": "box"
285
- }
286
- ],
287
- [
288
- "notify",
289
- "Cancelled",
290
- "info"
291
- ]
292
- ],
293
- "LIST_ITEM_CREATED": [
294
- [
295
- "persist",
296
- "create",
297
- "ListItem",
298
- "@payload.data"
299
- ],
300
- [
301
- "render-ui",
302
- "modal",
303
- null
304
- ],
305
- [
306
- "render-ui",
307
- "main",
308
- {
309
- "type": "box"
310
- }
311
- ]
312
- ]
313
405
  }
314
406
  },
315
407
  {
316
408
  "ref": "Modal.traits.ModalRecordModal",
317
409
  "name": "ListItemEdit",
318
410
  "linkedEntity": "ListItem",
319
- "events": {
320
- "SAVE": "LIST_ITEM_UPDATED",
321
- "OPEN": "EDIT"
322
- },
323
- "effects": {
324
- "LIST_ITEM_UPDATED": [
325
- [
326
- "persist",
327
- "update",
328
- "ListItem",
329
- "@payload.data"
330
- ],
331
- [
332
- "render-ui",
333
- "modal",
334
- null
335
- ],
336
- [
337
- "render-ui",
338
- "main",
339
- {
340
- "type": "box"
341
- }
342
- ]
343
- ],
344
- "CLOSE": [
345
- [
346
- "render-ui",
347
- "modal",
348
- null
349
- ],
350
- [
351
- "render-ui",
352
- "main",
353
- {
354
- "type": "box"
355
- }
356
- ],
357
- [
358
- "notify",
359
- "Cancelled",
360
- "info"
361
- ]
362
- ],
363
- "INIT": [
364
- [
365
- "ref",
366
- "ListItem"
367
- ]
368
- ],
369
- "EDIT": [
370
- [
371
- "fetch",
372
- "ListItem",
373
- {
374
- "id": "@payload.id"
375
- }
376
- ],
377
- [
378
- "render-ui",
379
- "modal",
380
- {
381
- "type": "stack",
382
- "children": [
383
- {
384
- "gap": "sm",
385
- "type": "stack",
386
- "direction": "horizontal",
387
- "children": [
388
- {
389
- "name": "edit",
390
- "size": "md",
391
- "type": "icon"
392
- },
393
- {
394
- "content": "Edit ListItem",
395
- "type": "typography",
396
- "variant": "h3"
397
- }
398
- ]
399
- },
400
- {
401
- "type": "divider"
402
- },
403
- {
404
- "entity": "ListItem",
405
- "type": "form-section",
406
- "submitEvent": "SAVE",
407
- "fields": [
408
- "name",
409
- "description",
410
- "status"
411
- ],
412
- "entityId": "@entity.id",
413
- "mode": "edit",
414
- "cancelEvent": "CLOSE"
415
- }
416
- ],
417
- "direction": "vertical",
418
- "gap": "md"
419
- }
420
- ]
411
+ "config": {
412
+ "mode": "edit",
413
+ "title": "Edit ListItem",
414
+ "icon": "edit",
415
+ "fields": [
416
+ "name",
417
+ "description",
418
+ "status"
421
419
  ]
422
- }
423
- },
424
- {
425
- "ref": "Modal.traits.ModalRecordModal",
426
- "name": "ListItemView",
427
- "linkedEntity": "ListItem",
428
- "events": {
429
- "SAVE": "LIST_ITEM_VIEWED",
430
- "OPEN": "VIEW"
431
420
  },
432
- "effects": {
433
- "INIT": [
434
- [
435
- "ref",
436
- "ListItem"
437
- ]
438
- ],
439
- "CLOSE": [
440
- [
441
- "render-ui",
442
- "modal",
443
- null
444
- ],
445
- [
446
- "render-ui",
447
- "main",
448
- {
449
- "type": "box"
450
- }
451
- ],
452
- [
453
- "notify",
454
- "Cancelled",
455
- "info"
456
- ]
457
- ],
458
- "LIST_ITEM_VIEWED": [
459
- [
460
- "render-ui",
461
- "modal",
462
- null
463
- ],
464
- [
465
- "render-ui",
466
- "main",
467
- {
468
- "type": "box"
469
- }
470
- ]
471
- ],
472
- "VIEW": [
473
- [
474
- "fetch",
475
- "ListItem",
476
- {
477
- "id": "@payload.id"
478
- }
479
- ],
480
- [
481
- "render-ui",
482
- "modal",
483
- {
484
- "gap": "md",
485
- "children": [
486
- {
487
- "gap": "sm",
488
- "type": "stack",
489
- "children": [
490
- {
491
- "size": "md",
492
- "name": "eye",
493
- "type": "icon"
494
- },
495
- {
496
- "content": "@entity.name",
497
- "type": "typography",
498
- "variant": "h3"
499
- }
500
- ],
501
- "align": "center",
502
- "direction": "horizontal"
503
- },
504
- {
505
- "type": "divider"
506
- },
507
- {
508
- "direction": "horizontal",
509
- "type": "stack",
510
- "gap": "md",
511
- "children": [
512
- {
513
- "variant": "caption",
514
- "content": "Name",
515
- "type": "typography"
516
- },
517
- {
518
- "content": "@entity.name",
519
- "type": "typography",
520
- "variant": "body"
521
- }
522
- ]
523
- },
524
- {
525
- "direction": "horizontal",
526
- "gap": "md",
527
- "type": "stack",
528
- "children": [
529
- {
530
- "variant": "caption",
531
- "content": "Description",
532
- "type": "typography"
533
- },
534
- {
535
- "type": "typography",
536
- "content": "@entity.description",
537
- "variant": "body"
538
- }
539
- ]
540
- },
541
- {
542
- "gap": "md",
543
- "children": [
544
- {
545
- "variant": "caption",
546
- "type": "typography",
547
- "content": "Status"
548
- },
549
- {
550
- "content": "@entity.status",
551
- "variant": "body",
552
- "type": "typography"
553
- }
554
- ],
555
- "direction": "horizontal",
556
- "type": "stack"
557
- },
558
- {
559
- "direction": "horizontal",
560
- "type": "stack",
561
- "gap": "md",
562
- "children": [
563
- {
564
- "variant": "caption",
565
- "content": "Created At",
566
- "type": "typography"
567
- },
568
- {
569
- "content": "@entity.createdAt",
570
- "variant": "body",
571
- "type": "typography"
572
- }
573
- ]
574
- },
575
- {
576
- "type": "divider"
577
- },
578
- {
579
- "direction": "horizontal",
580
- "children": [
581
- {
582
- "event": "EDIT",
583
- "label": "Edit",
584
- "icon": "edit",
585
- "variant": "primary",
586
- "type": "button"
587
- },
588
- {
589
- "event": "CLOSE",
590
- "type": "button",
591
- "label": "Close",
592
- "variant": "ghost"
593
- }
594
- ],
595
- "justify": "end",
596
- "type": "stack",
597
- "gap": "sm"
598
- }
599
- ],
600
- "direction": "vertical",
601
- "type": "stack"
602
- }
603
- ]
604
- ]
421
+ "events": {
422
+ "OPEN": "EDIT",
423
+ "SAVE": "LIST_ITEM_UPDATED"
605
424
  }
606
425
  },
607
426
  {
608
427
  "ref": "Confirmation.traits.ConfirmActionConfirmation",
609
428
  "name": "ListItemDelete",
610
429
  "linkedEntity": "ListItem",
430
+ "config": {
431
+ "icon": "alert-triangle",
432
+ "confirmLabel": "Delete",
433
+ "title": "Delete ListItem",
434
+ "alertMessage": "This action cannot be undone."
435
+ },
611
436
  "events": {
612
437
  "REQUEST": "DELETE",
613
438
  "CONFIRM": "CONFIRM_DELETE"
614
- },
615
- "effects": {
616
- "CONFIRM_DELETE": [
617
- [
618
- "persist",
619
- "delete",
620
- "ListItem",
621
- "@entity.pendingId"
622
- ],
623
- [
624
- "render-ui",
625
- "modal",
626
- null
627
- ],
628
- [
629
- "render-ui",
630
- "main",
439
+ }
440
+ },
441
+ {
442
+ "name": "ListItemPersistor",
443
+ "category": "lifecycle",
444
+ "linkedEntity": "ListItem",
445
+ "emits": [
446
+ {
447
+ "event": "ITEM_CREATED",
448
+ "scope": "external",
449
+ "payload": [
631
450
  {
632
- "type": "box"
451
+ "name": "id",
452
+ "type": "string",
453
+ "required": true
633
454
  }
634
- ],
635
- [
636
- "ref",
637
- "ListItem"
638
455
  ]
639
- ],
640
- "CANCEL": [
641
- [
642
- "render-ui",
643
- "modal",
644
- null
645
- ],
646
- [
647
- "render-ui",
648
- "main",
456
+ },
457
+ {
458
+ "event": "ITEM_UPDATED",
459
+ "scope": "external",
460
+ "payload": [
649
461
  {
650
- "type": "box"
462
+ "name": "id",
463
+ "type": "string",
464
+ "required": true
651
465
  }
652
- ],
653
- [
654
- "ref",
655
- "ListItem"
656
466
  ]
657
- ],
658
- "DELETE": [
659
- [
660
- "set",
661
- "@entity.pendingId",
662
- "@payload.id"
663
- ],
664
- [
665
- "fetch",
666
- "ListItem",
467
+ },
468
+ {
469
+ "event": "ITEM_DELETED",
470
+ "scope": "external",
471
+ "payload": [
667
472
  {
668
- "id": "@payload.id"
473
+ "name": "id",
474
+ "type": "string",
475
+ "required": true
669
476
  }
670
- ],
671
- [
672
- "render-ui",
673
- "modal",
674
- {
675
- "direction": "vertical",
676
- "type": "stack",
677
- "children": [
678
- {
679
- "direction": "horizontal",
680
- "children": [
681
- {
682
- "type": "icon",
683
- "size": "md",
684
- "name": "alert-triangle"
685
- },
686
- {
687
- "content": "Delete ListItem",
688
- "variant": "h3",
689
- "type": "typography"
690
- }
691
- ],
692
- "gap": "sm",
693
- "type": "stack",
694
- "align": "center"
695
- },
696
- {
697
- "type": "divider"
698
- },
477
+ ]
478
+ }
479
+ ],
480
+ "listens": [
481
+ {
482
+ "event": "LIST_ITEM_CREATED",
483
+ "triggers": "DO_CREATE",
484
+ "source": {
485
+ "kind": "trait",
486
+ "trait": "ListItemCreate"
487
+ }
488
+ },
489
+ {
490
+ "event": "LIST_ITEM_UPDATED",
491
+ "triggers": "DO_UPDATE",
492
+ "source": {
493
+ "kind": "trait",
494
+ "trait": "ListItemEdit"
495
+ }
496
+ },
497
+ {
498
+ "event": "CONFIRM_DELETE",
499
+ "triggers": "DO_DELETE",
500
+ "source": {
501
+ "kind": "trait",
502
+ "trait": "ListItemDelete"
503
+ }
504
+ }
505
+ ],
506
+ "stateMachine": {
507
+ "states": [
508
+ {
509
+ "name": "idle",
510
+ "isInitial": true
511
+ }
512
+ ],
513
+ "events": [
514
+ {
515
+ "key": "INIT",
516
+ "name": "Initialize"
517
+ },
518
+ {
519
+ "key": "DO_CREATE",
520
+ "name": "Do Create",
521
+ "payload": [
522
+ {
523
+ "name": "data",
524
+ "type": "ListItem"
525
+ }
526
+ ]
527
+ },
528
+ {
529
+ "key": "DO_UPDATE",
530
+ "name": "Do Update",
531
+ "payload": [
532
+ {
533
+ "name": "data",
534
+ "type": "ListItem"
535
+ }
536
+ ]
537
+ },
538
+ {
539
+ "key": "DO_DELETE",
540
+ "name": "Do Delete",
541
+ "payload": [
542
+ {
543
+ "name": "id",
544
+ "type": "string",
545
+ "required": true
546
+ }
547
+ ]
548
+ },
549
+ {
550
+ "key": "ITEM_CREATED",
551
+ "name": "Item Created"
552
+ },
553
+ {
554
+ "key": "ITEM_UPDATED",
555
+ "name": "Item Updated"
556
+ },
557
+ {
558
+ "key": "ITEM_DELETED",
559
+ "name": "Item Deleted"
560
+ }
561
+ ],
562
+ "transitions": [
563
+ {
564
+ "from": "idle",
565
+ "to": "idle",
566
+ "event": "INIT"
567
+ },
568
+ {
569
+ "from": "idle",
570
+ "to": "idle",
571
+ "event": "DO_CREATE",
572
+ "effects": [
573
+ [
574
+ "persist",
575
+ "create",
576
+ "ListItem",
577
+ "@payload.data"
578
+ ],
579
+ [
580
+ "emit",
581
+ "ITEM_CREATED",
699
582
  {
700
- "type": "alert",
701
- "message": "This action cannot be undone.",
702
- "variant": "danger"
703
- },
583
+ "id": "@payload.data.id"
584
+ }
585
+ ]
586
+ ]
587
+ },
588
+ {
589
+ "from": "idle",
590
+ "to": "idle",
591
+ "event": "DO_UPDATE",
592
+ "effects": [
593
+ [
594
+ "persist",
595
+ "update",
596
+ "ListItem",
597
+ "@payload.data"
598
+ ],
599
+ [
600
+ "emit",
601
+ "ITEM_UPDATED",
704
602
  {
705
- "direction": "horizontal",
706
- "gap": "sm",
707
- "type": "stack",
708
- "justify": "end",
709
- "children": [
710
- {
711
- "variant": "ghost",
712
- "event": "CANCEL",
713
- "label": "Cancel",
714
- "type": "button"
715
- },
716
- {
717
- "type": "button",
718
- "event": "CONFIRM_DELETE",
719
- "icon": "check",
720
- "label": "Delete",
721
- "variant": "danger"
722
- }
723
- ]
603
+ "id": "@payload.data.id"
724
604
  }
605
+ ]
606
+ ]
607
+ },
608
+ {
609
+ "from": "idle",
610
+ "to": "idle",
611
+ "event": "DO_DELETE",
612
+ "effects": [
613
+ [
614
+ "persist",
615
+ "delete",
616
+ "ListItem",
617
+ "@payload.id"
725
618
  ],
726
- "gap": "md"
727
- }
728
- ]
729
- ],
730
- "INIT": [
731
- [
732
- "ref",
733
- "ListItem"
734
- ]
735
- ],
736
- "CLOSE": [
737
- [
738
- "render-ui",
739
- "modal",
740
- null
741
- ],
742
- [
743
- "render-ui",
744
- "main",
745
- {
746
- "type": "box"
747
- }
748
- ],
749
- [
750
- "ref",
751
- "ListItem"
752
- ]
619
+ [
620
+ "emit",
621
+ "ITEM_DELETED",
622
+ {
623
+ "id": "@payload.id"
624
+ }
625
+ ]
626
+ ]
627
+ }
753
628
  ]
754
- }
629
+ },
630
+ "scope": "instance"
755
631
  }
756
632
  ],
757
633
  "pages": [
@@ -769,10 +645,10 @@
769
645
  "ref": "ListItemEdit"
770
646
  },
771
647
  {
772
- "ref": "ListItemView"
648
+ "ref": "ListItemDelete"
773
649
  },
774
650
  {
775
- "ref": "ListItemDelete"
651
+ "ref": "ListItemPersistor"
776
652
  }
777
653
  ]
778
654
  }