@almadar/std 2.1.1 → 2.4.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.
Files changed (86) hide show
  1. package/dist/behaviors/async.d.ts +12 -7
  2. package/dist/behaviors/async.js +1085 -312
  3. package/dist/behaviors/async.js.map +1 -1
  4. package/dist/behaviors/data-management.d.ts +27 -13
  5. package/dist/behaviors/data-management.js +600 -244
  6. package/dist/behaviors/data-management.js.map +1 -1
  7. package/dist/behaviors/domain/commerce.d.ts +51 -0
  8. package/dist/behaviors/domain/commerce.js +1093 -0
  9. package/dist/behaviors/domain/commerce.js.map +1 -0
  10. package/dist/behaviors/domain/content.d.ts +51 -0
  11. package/dist/behaviors/domain/content.js +1294 -0
  12. package/dist/behaviors/domain/content.js.map +1 -0
  13. package/dist/behaviors/domain/dashboard.d.ts +45 -0
  14. package/dist/behaviors/domain/dashboard.js +783 -0
  15. package/dist/behaviors/domain/dashboard.js.map +1 -0
  16. package/dist/behaviors/domain/education.d.ts +41 -0
  17. package/dist/behaviors/domain/education.js +738 -0
  18. package/dist/behaviors/domain/education.js.map +1 -0
  19. package/dist/behaviors/domain/finance.d.ts +49 -0
  20. package/dist/behaviors/domain/finance.js +660 -0
  21. package/dist/behaviors/domain/finance.js.map +1 -0
  22. package/dist/behaviors/domain/game-2d-platformer.d.ts +50 -0
  23. package/dist/behaviors/domain/game-2d-platformer.js +810 -0
  24. package/dist/behaviors/domain/game-2d-platformer.js.map +1 -0
  25. package/dist/behaviors/domain/game-2d-puzzle.d.ts +42 -0
  26. package/dist/behaviors/domain/game-2d-puzzle.js +622 -0
  27. package/dist/behaviors/domain/game-2d-puzzle.js.map +1 -0
  28. package/dist/behaviors/domain/game-2d-rpg.d.ts +48 -0
  29. package/dist/behaviors/domain/game-2d-rpg.js +860 -0
  30. package/dist/behaviors/domain/game-2d-rpg.js.map +1 -0
  31. package/dist/behaviors/domain/game-2d-strategy.d.ts +48 -0
  32. package/dist/behaviors/domain/game-2d-strategy.js +692 -0
  33. package/dist/behaviors/domain/game-2d-strategy.js.map +1 -0
  34. package/dist/behaviors/domain/geospatial.d.ts +35 -0
  35. package/dist/behaviors/domain/geospatial.js +634 -0
  36. package/dist/behaviors/domain/geospatial.js.map +1 -0
  37. package/dist/behaviors/domain/healthcare.d.ts +36 -0
  38. package/dist/behaviors/domain/healthcare.js +1068 -0
  39. package/dist/behaviors/domain/healthcare.js.map +1 -0
  40. package/dist/behaviors/domain/iot.d.ts +45 -0
  41. package/dist/behaviors/domain/iot.js +589 -0
  42. package/dist/behaviors/domain/iot.js.map +1 -0
  43. package/dist/behaviors/domain/media.d.ts +41 -0
  44. package/dist/behaviors/domain/media.js +771 -0
  45. package/dist/behaviors/domain/media.js.map +1 -0
  46. package/dist/behaviors/domain/scheduling.d.ts +41 -0
  47. package/dist/behaviors/domain/scheduling.js +930 -0
  48. package/dist/behaviors/domain/scheduling.js.map +1 -0
  49. package/dist/behaviors/domain/simulation.d.ts +36 -0
  50. package/dist/behaviors/domain/simulation.js +706 -0
  51. package/dist/behaviors/domain/simulation.js.map +1 -0
  52. package/dist/behaviors/domain/social.d.ts +41 -0
  53. package/dist/behaviors/domain/social.js +840 -0
  54. package/dist/behaviors/domain/social.js.map +1 -0
  55. package/dist/behaviors/domain/workflow.d.ts +41 -0
  56. package/dist/behaviors/domain/workflow.js +879 -0
  57. package/dist/behaviors/domain/workflow.js.map +1 -0
  58. package/dist/behaviors/feedback.d.ts +10 -5
  59. package/dist/behaviors/feedback.js +279 -194
  60. package/dist/behaviors/feedback.js.map +1 -1
  61. package/dist/behaviors/game-core.d.ts +15 -8
  62. package/dist/behaviors/game-core.js +412 -80
  63. package/dist/behaviors/game-core.js.map +1 -1
  64. package/dist/behaviors/game-entity.d.ts +17 -10
  65. package/dist/behaviors/game-entity.js +544 -237
  66. package/dist/behaviors/game-entity.js.map +1 -1
  67. package/dist/behaviors/game-ui.d.ts +16 -8
  68. package/dist/behaviors/game-ui.js +451 -316
  69. package/dist/behaviors/game-ui.js.map +1 -1
  70. package/dist/behaviors/index.d.ts +18 -1
  71. package/dist/behaviors/index.js +18905 -2140
  72. package/dist/behaviors/index.js.map +1 -1
  73. package/dist/behaviors/infrastructure.d.ts +9 -8
  74. package/dist/behaviors/infrastructure.js +597 -169
  75. package/dist/behaviors/infrastructure.js.map +1 -1
  76. package/dist/behaviors/registry.d.ts +11 -11
  77. package/dist/behaviors/registry.js +18904 -2139
  78. package/dist/behaviors/registry.js.map +1 -1
  79. package/dist/behaviors/types.d.ts +19 -2
  80. package/dist/behaviors/types.js.map +1 -1
  81. package/dist/behaviors/ui-interaction.d.ts +20 -14
  82. package/dist/behaviors/ui-interaction.js +928 -518
  83. package/dist/behaviors/ui-interaction.js.map +1 -1
  84. package/dist/index.js +18906 -2141
  85. package/dist/index.js.map +1 -1
  86. package/package.json +1 -1
@@ -1,85 +1,437 @@
1
1
  // behaviors/data-management.ts
2
+ var DATA_ZINC_THEME = {
3
+ name: "data-zinc",
4
+ tokens: {
5
+ colors: {
6
+ primary: "#3f3f46",
7
+ "primary-hover": "#27272a",
8
+ "primary-foreground": "#ffffff",
9
+ accent: "#71717a",
10
+ "accent-foreground": "#ffffff",
11
+ success: "#22c55e",
12
+ warning: "#f59e0b",
13
+ error: "#ef4444"
14
+ }
15
+ }
16
+ };
17
+ var PRODUCT_MAIN_VIEW = ["render-ui", "main", {
18
+ type: "stack",
19
+ direction: "vertical",
20
+ gap: "md",
21
+ children: [
22
+ {
23
+ type: "stack",
24
+ direction: "horizontal",
25
+ gap: "sm",
26
+ align: "center",
27
+ children: [
28
+ { type: "icon", name: "database", size: "lg" },
29
+ { type: "typography", variant: "h2", content: "Products" },
30
+ { type: "badge", label: "Paginated", variant: "info" }
31
+ ]
32
+ },
33
+ { type: "divider" },
34
+ {
35
+ type: "stack",
36
+ direction: "horizontal",
37
+ gap: "sm",
38
+ children: [
39
+ { type: "stats", label: "Page", value: "@entity.page" },
40
+ { type: "stats", label: "Page Size", value: "@entity.pageSize" },
41
+ { type: "stats", label: "Total", value: "@entity.totalItems" },
42
+ { type: "stats", label: "Total Pages", value: "@entity.totalPages" }
43
+ ]
44
+ },
45
+ { type: "progress-bar", value: "@entity.page", max: "@entity.totalPages", label: "Page Progress", icon: "book-open" },
46
+ {
47
+ type: "data-grid",
48
+ entity: "Product",
49
+ columns: ["name", "price"],
50
+ itemActions: [{ label: "Refresh", event: "INIT" }]
51
+ },
52
+ {
53
+ type: "stack",
54
+ direction: "horizontal",
55
+ gap: "sm",
56
+ justify: "center",
57
+ children: [
58
+ { type: "button", label: "Previous", action: "PREV_PAGE", variant: "secondary", icon: "arrow-left" },
59
+ { type: "button", label: "Next", action: "NEXT_PAGE", variant: "secondary", icon: "arrow-right" }
60
+ ]
61
+ }
62
+ ]
63
+ }];
64
+ var FILE_IDLE_MAIN_VIEW = ["render-ui", "main", {
65
+ type: "stack",
66
+ direction: "vertical",
67
+ gap: "md",
68
+ children: [
69
+ {
70
+ type: "stack",
71
+ direction: "horizontal",
72
+ gap: "sm",
73
+ align: "center",
74
+ children: [
75
+ { type: "icon", name: "folder", size: "lg" },
76
+ { type: "typography", variant: "h2", content: "Files" }
77
+ ]
78
+ },
79
+ { type: "divider" },
80
+ {
81
+ type: "data-list",
82
+ entity: "File",
83
+ fields: ["name", "size"],
84
+ itemActions: [
85
+ { label: "Select", event: "SELECT" },
86
+ { label: "View", event: "VIEW" }
87
+ ]
88
+ }
89
+ ]
90
+ }];
91
+ var FILE_SELECTED_MAIN_VIEW = ["render-ui", "main", {
92
+ type: "stack",
93
+ direction: "vertical",
94
+ gap: "md",
95
+ children: [
96
+ {
97
+ type: "stack",
98
+ direction: "horizontal",
99
+ gap: "sm",
100
+ align: "center",
101
+ children: [
102
+ { type: "icon", name: "folder", size: "lg" },
103
+ { type: "typography", variant: "h2", content: "Files" },
104
+ { type: "badge", label: "Selected", variant: "success" }
105
+ ]
106
+ },
107
+ { type: "divider" },
108
+ {
109
+ type: "data-list",
110
+ entity: "File",
111
+ fields: ["name", "size", "isSelected"],
112
+ itemActions: [
113
+ { label: "Deselect", event: "DESELECT" },
114
+ { label: "View", event: "VIEW" }
115
+ ]
116
+ }
117
+ ]
118
+ }];
119
+ var FILE_DETAIL_MODAL = ["render-ui", "modal", {
120
+ type: "stack",
121
+ direction: "vertical",
122
+ gap: "md",
123
+ children: [
124
+ {
125
+ type: "stack",
126
+ direction: "horizontal",
127
+ gap: "sm",
128
+ align: "center",
129
+ children: [
130
+ { type: "icon", name: "file", size: "lg" },
131
+ { type: "typography", variant: "h3", content: "File Details" }
132
+ ]
133
+ },
134
+ { type: "divider" },
135
+ {
136
+ type: "stack",
137
+ direction: "vertical",
138
+ gap: "sm",
139
+ children: [
140
+ { type: "typography", variant: "body", content: "@entity.name" },
141
+ { type: "stats", label: "Size", value: "@entity.size" }
142
+ ]
143
+ },
144
+ {
145
+ type: "stack",
146
+ direction: "horizontal",
147
+ gap: "sm",
148
+ justify: "end",
149
+ children: [
150
+ { type: "button", label: "Close", event: "CLOSE", variant: "secondary" }
151
+ ]
152
+ }
153
+ ]
154
+ }];
155
+ var CONTACT_MAIN_VIEW = ["render-ui", "main", {
156
+ type: "stack",
157
+ direction: "vertical",
158
+ gap: "md",
159
+ children: [
160
+ {
161
+ type: "stack",
162
+ direction: "horizontal",
163
+ gap: "sm",
164
+ align: "center",
165
+ children: [
166
+ { type: "icon", name: "table", size: "lg" },
167
+ { type: "typography", variant: "h2", content: "Contacts" }
168
+ ]
169
+ },
170
+ { type: "divider" },
171
+ {
172
+ type: "stack",
173
+ direction: "horizontal",
174
+ gap: "sm",
175
+ children: [
176
+ { type: "stats", label: "Sort By", value: "@entity.sortField" },
177
+ { type: "stats", label: "Direction", value: "@entity.sortDirection" }
178
+ ]
179
+ },
180
+ {
181
+ type: "stack",
182
+ direction: "horizontal",
183
+ gap: "sm",
184
+ children: [
185
+ { type: "button", label: "Sort by Name", event: "SORT", variant: "secondary", icon: "arrow-up" },
186
+ { type: "button", label: "Toggle Direction", event: "TOGGLE_DIRECTION", variant: "secondary", icon: "filter" },
187
+ { type: "button", label: "Clear Sort", event: "CLEAR_SORT", variant: "ghost", icon: "x" }
188
+ ]
189
+ },
190
+ {
191
+ type: "data-grid",
192
+ entity: "Contact",
193
+ columns: ["name", "email"],
194
+ itemActions: [{ label: "Refresh", event: "INIT" }]
195
+ }
196
+ ]
197
+ }];
198
+ var TASK_BROWSING_MAIN_VIEW = ["render-ui", "main", {
199
+ type: "stack",
200
+ direction: "vertical",
201
+ gap: "md",
202
+ children: [
203
+ {
204
+ type: "stack",
205
+ direction: "horizontal",
206
+ gap: "sm",
207
+ align: "center",
208
+ children: [
209
+ { type: "icon", name: "table", size: "lg" },
210
+ { type: "typography", variant: "h2", content: "Tasks" }
211
+ ]
212
+ },
213
+ { type: "divider" },
214
+ {
215
+ type: "stack",
216
+ direction: "horizontal",
217
+ gap: "sm",
218
+ children: [
219
+ { type: "badge", label: "All", variant: "primary", icon: "filter" },
220
+ { type: "button", label: "Filter", action: "FILTER", variant: "secondary", icon: "filter" },
221
+ { type: "button", label: "Clear Filters", action: "CLEAR_FILTERS", variant: "ghost", icon: "x" }
222
+ ]
223
+ },
224
+ {
225
+ type: "data-grid",
226
+ entity: "Task",
227
+ columns: ["title", "status", "priority"],
228
+ itemActions: [{ label: "Refresh", event: "INIT" }]
229
+ }
230
+ ]
231
+ }];
232
+ var TASK_FILTERED_MAIN_VIEW = ["render-ui", "main", {
233
+ type: "stack",
234
+ direction: "vertical",
235
+ gap: "md",
236
+ children: [
237
+ {
238
+ type: "stack",
239
+ direction: "horizontal",
240
+ gap: "sm",
241
+ align: "center",
242
+ children: [
243
+ { type: "icon", name: "filter", size: "lg" },
244
+ { type: "typography", variant: "h2", content: "Tasks" },
245
+ { type: "badge", label: "Filtered", variant: "warning" }
246
+ ]
247
+ },
248
+ { type: "divider" },
249
+ {
250
+ type: "stack",
251
+ direction: "horizontal",
252
+ gap: "sm",
253
+ children: [
254
+ { type: "badge", label: "Filtered", variant: "warning", icon: "filter" },
255
+ { type: "badge", label: "@entity.status", variant: "info" },
256
+ { type: "button", label: "Change Filter", action: "FILTER", variant: "secondary", icon: "filter" },
257
+ { type: "button", label: "Clear Filters", action: "CLEAR_FILTERS", variant: "ghost", icon: "x" }
258
+ ]
259
+ },
260
+ {
261
+ type: "data-grid",
262
+ entity: "Task",
263
+ columns: ["title", "status", "priority"],
264
+ itemActions: [{ label: "View", event: "VIEW" }]
265
+ }
266
+ ]
267
+ }];
268
+ var ARTICLE_IDLE_MAIN_VIEW = ["render-ui", "main", {
269
+ type: "stack",
270
+ direction: "vertical",
271
+ gap: "md",
272
+ children: [
273
+ {
274
+ type: "stack",
275
+ direction: "horizontal",
276
+ gap: "sm",
277
+ align: "center",
278
+ children: [
279
+ { type: "icon", name: "search", size: "lg" },
280
+ { type: "typography", variant: "h2", content: "Search Articles" }
281
+ ]
282
+ },
283
+ { type: "divider" },
284
+ { type: "search-input", placeholder: "Search articles...", event: "SEARCH", icon: "search" },
285
+ {
286
+ type: "data-list",
287
+ entity: "Article",
288
+ fields: ["title", "content"],
289
+ itemActions: [{ label: "View", event: "VIEW" }]
290
+ }
291
+ ]
292
+ }];
293
+ var ARTICLE_SEARCHING_MAIN_VIEW = ["render-ui", "main", {
294
+ type: "stack",
295
+ direction: "vertical",
296
+ gap: "md",
297
+ children: [
298
+ {
299
+ type: "stack",
300
+ direction: "horizontal",
301
+ gap: "sm",
302
+ align: "center",
303
+ children: [
304
+ { type: "icon", name: "search", size: "lg" },
305
+ { type: "typography", variant: "h2", content: "Search Articles" },
306
+ { type: "badge", label: "Active Search", variant: "info" }
307
+ ]
308
+ },
309
+ { type: "divider" },
310
+ {
311
+ type: "stack",
312
+ direction: "horizontal",
313
+ gap: "sm",
314
+ align: "center",
315
+ children: [
316
+ { type: "search-input", placeholder: "Search articles...", event: "SEARCH", icon: "search" },
317
+ { type: "button", label: "Clear", event: "CLEAR_SEARCH", variant: "ghost", icon: "x" }
318
+ ]
319
+ },
320
+ {
321
+ type: "data-list",
322
+ entity: "Article",
323
+ fields: ["title", "content"],
324
+ itemActions: [{ label: "View", event: "VIEW" }]
325
+ }
326
+ ]
327
+ }];
2
328
  var PAGINATION_BEHAVIOR = {
3
329
  name: "std-pagination",
4
330
  version: "1.0.0",
5
331
  description: "Page-based navigation for large data sets",
332
+ theme: DATA_ZINC_THEME,
6
333
  orbitals: [
7
334
  {
8
335
  name: "PaginationOrbital",
9
336
  entity: {
10
- name: "PaginationState",
11
- persistence: "runtime",
337
+ name: "Product",
338
+ persistence: "persistent",
339
+ collection: "products",
12
340
  fields: [
13
341
  { name: "id", type: "string", required: true },
342
+ { name: "name", type: "string", default: "" },
343
+ { name: "price", type: "number", default: 0 },
14
344
  { name: "page", type: "number", default: 1 },
15
345
  { name: "pageSize", type: "number", default: 20 },
16
346
  { name: "totalItems", type: "number", default: 0 },
17
- { name: "defaultPageSize", type: "number", default: 20 }
347
+ { name: "totalPages", type: "number", default: 1 }
18
348
  ]
19
349
  },
20
350
  traits: [
21
351
  {
22
- name: "Pagination",
23
- linkedEntity: "PaginationState",
352
+ name: "PaginationControl",
353
+ linkedEntity: "Product",
24
354
  category: "interaction",
25
355
  stateMachine: {
26
- states: [{ name: "Active", isInitial: true }],
356
+ states: [{ name: "browsing", isInitial: true }],
27
357
  events: [
28
358
  { key: "INIT", name: "Initialize" },
29
359
  { key: "NEXT_PAGE", name: "Next Page" },
30
360
  { key: "PREV_PAGE", name: "Previous Page" },
31
- { key: "GO_TO_PAGE", name: "Go to Page" },
32
- { key: "SET_PAGE_SIZE", name: "Set Page Size" }
361
+ { key: "GO_TO_PAGE", name: "Go to Page", payloadSchema: [{ name: "page", type: "number", required: true }] },
362
+ { key: "SET_PAGE_SIZE", name: "Set Page Size", payloadSchema: [{ name: "size", type: "number", required: true }] }
33
363
  ],
34
364
  transitions: [
35
365
  {
36
- from: "Active",
37
- to: "Active",
366
+ from: "browsing",
367
+ to: "browsing",
38
368
  event: "INIT",
39
369
  effects: [
370
+ ["fetch", "Product"],
40
371
  ["set", "@entity.page", 1],
41
- ["set", "@entity.pageSize", "@entity.defaultPageSize"]
372
+ PRODUCT_MAIN_VIEW
42
373
  ]
43
374
  },
44
375
  {
45
- from: "Active",
46
- to: "Active",
376
+ from: "browsing",
377
+ to: "browsing",
47
378
  event: "NEXT_PAGE",
48
379
  guard: ["<", "@entity.page", ["math/ceil", ["/", "@entity.totalItems", "@entity.pageSize"]]],
49
- effects: [["set", "@entity.page", ["+", "@entity.page", 1]]]
380
+ effects: [
381
+ ["fetch", "Product"],
382
+ ["set", "@entity.page", ["+", "@entity.page", 1]],
383
+ PRODUCT_MAIN_VIEW
384
+ ]
50
385
  },
51
386
  {
52
- from: "Active",
53
- to: "Active",
387
+ from: "browsing",
388
+ to: "browsing",
54
389
  event: "PREV_PAGE",
55
390
  guard: [">", "@entity.page", 1],
56
- effects: [["set", "@entity.page", ["-", "@entity.page", 1]]]
391
+ effects: [
392
+ ["fetch", "Product"],
393
+ ["set", "@entity.page", ["-", "@entity.page", 1]],
394
+ PRODUCT_MAIN_VIEW
395
+ ]
57
396
  },
58
397
  {
59
- from: "Active",
60
- to: "Active",
398
+ from: "browsing",
399
+ to: "browsing",
61
400
  event: "GO_TO_PAGE",
62
401
  guard: [
63
402
  "and",
64
403
  [">=", "@payload.page", 1],
65
404
  ["<=", "@payload.page", ["math/ceil", ["/", "@entity.totalItems", "@entity.pageSize"]]]
66
405
  ],
67
- effects: [["set", "@entity.page", "@payload.page"]]
406
+ effects: [
407
+ ["fetch", "Product"],
408
+ ["set", "@entity.page", "@payload.page"],
409
+ PRODUCT_MAIN_VIEW
410
+ ]
68
411
  },
69
412
  {
70
- from: "Active",
71
- to: "Active",
413
+ from: "browsing",
414
+ to: "browsing",
72
415
  event: "SET_PAGE_SIZE",
73
416
  effects: [
417
+ ["fetch", "Product"],
74
418
  ["set", "@entity.pageSize", "@payload.size"],
75
- ["set", "@entity.page", 1]
419
+ ["set", "@entity.page", 1],
420
+ PRODUCT_MAIN_VIEW
76
421
  ]
77
422
  }
78
423
  ]
79
424
  }
80
425
  }
81
426
  ],
82
- pages: []
427
+ pages: [
428
+ {
429
+ name: "ProductsPage",
430
+ path: "/products",
431
+ isInitial: true,
432
+ traits: [{ ref: "PaginationControl" }]
433
+ }
434
+ ]
83
435
  }
84
436
  ]
85
437
  };
@@ -87,135 +439,112 @@ var SELECTION_BEHAVIOR = {
87
439
  name: "std-selection",
88
440
  version: "1.0.0",
89
441
  description: "Single or multi-selection management",
442
+ theme: DATA_ZINC_THEME,
90
443
  orbitals: [
91
444
  {
92
445
  name: "SelectionOrbital",
93
446
  entity: {
94
- name: "SelectionState",
95
- persistence: "runtime",
447
+ name: "File",
448
+ persistence: "persistent",
449
+ collection: "files",
96
450
  fields: [
97
451
  { name: "id", type: "string", required: true },
98
- { name: "selected", type: "array", default: [] },
99
- { name: "lastSelected", type: "string", default: null },
100
- { name: "mode", type: "string", default: "multi" },
101
- { name: "maxSelection", type: "number", default: null }
452
+ { name: "name", type: "string", default: "" },
453
+ { name: "size", type: "number", default: 0 },
454
+ { name: "isSelected", type: "boolean", default: false }
102
455
  ]
103
456
  },
104
457
  traits: [
105
458
  {
106
- name: "Selection",
107
- linkedEntity: "SelectionState",
459
+ name: "SelectionControl",
460
+ linkedEntity: "File",
108
461
  category: "interaction",
109
462
  stateMachine: {
110
- states: [{ name: "Active", isInitial: true }],
463
+ states: [
464
+ { name: "idle", isInitial: true },
465
+ { name: "selected" },
466
+ { name: "viewing" }
467
+ ],
111
468
  events: [
112
469
  { key: "INIT", name: "Initialize" },
113
- { key: "SELECT", name: "Select" },
470
+ { key: "SELECT", name: "Select", payloadSchema: [{ name: "id", type: "string", required: true }] },
114
471
  { key: "DESELECT", name: "Deselect" },
115
- { key: "TOGGLE", name: "Toggle" },
116
- { key: "SELECT_ALL", name: "Select All" },
117
- { key: "CLEAR", name: "Clear" }
472
+ { key: "VIEW", name: "View", payloadSchema: [{ name: "id", type: "string", required: true }] },
473
+ { key: "CLOSE", name: "Close" },
474
+ { key: "CANCEL", name: "Cancel" }
118
475
  ],
119
476
  transitions: [
120
477
  {
121
- from: "Active",
122
- to: "Active",
478
+ from: "idle",
479
+ to: "idle",
123
480
  event: "INIT",
124
481
  effects: [
125
- ["set", "@entity.selected", []],
126
- ["set", "@entity.lastSelected", null]
482
+ ["fetch", "File"],
483
+ FILE_IDLE_MAIN_VIEW
127
484
  ]
128
485
  },
129
486
  {
130
- from: "Active",
131
- to: "Active",
487
+ from: "idle",
488
+ to: "selected",
132
489
  event: "SELECT",
133
490
  effects: [
134
- [
135
- "if",
136
- ["=", "@entity.mode", "single"],
137
- [
138
- "do",
139
- ["set", "@entity.selected", ["@payload.id"]],
140
- ["set", "@entity.lastSelected", "@payload.id"]
141
- ],
142
- [
143
- "if",
144
- [
145
- "or",
146
- ["not", "@entity.maxSelection"],
147
- ["<", ["array/len", "@entity.selected"], "@entity.maxSelection"]
148
- ],
149
- [
150
- "do",
151
- ["set", "@entity.selected", ["array/append", "@entity.selected", "@payload.id"]],
152
- ["set", "@entity.lastSelected", "@payload.id"]
153
- ],
154
- ["notify", "in_app", "Maximum selection reached"]
155
- ]
156
- ]
491
+ ["fetch", "File"],
492
+ ["set", "@entity.isSelected", true],
493
+ FILE_SELECTED_MAIN_VIEW
157
494
  ]
158
495
  },
159
496
  {
160
- from: "Active",
161
- to: "Active",
162
- event: "DESELECT",
497
+ from: "selected",
498
+ to: "selected",
499
+ event: "SELECT",
163
500
  effects: [
164
- ["set", "@entity.selected", ["array/filter", "@entity.selected", ["fn", "id", ["!=", "@id", "@payload.id"]]]]
501
+ ["fetch", "File"],
502
+ ["set", "@entity.isSelected", true],
503
+ FILE_SELECTED_MAIN_VIEW
165
504
  ]
166
505
  },
167
506
  {
168
- from: "Active",
169
- to: "Active",
170
- event: "TOGGLE",
507
+ from: "selected",
508
+ to: "idle",
509
+ event: "DESELECT",
171
510
  effects: [
172
- [
173
- "if",
174
- ["array/includes", "@entity.selected", "@payload.id"],
175
- ["set", "@entity.selected", ["array/filter", "@entity.selected", ["fn", "id", ["!=", "@id", "@payload.id"]]]],
176
- [
177
- "if",
178
- ["or", ["=", "@entity.mode", "single"], [
179
- "or",
180
- ["not", "@entity.maxSelection"],
181
- ["<", ["array/len", "@entity.selected"], "@entity.maxSelection"]
182
- ]],
183
- [
184
- "set",
185
- "@entity.selected",
186
- [
187
- "if",
188
- ["=", "@entity.mode", "single"],
189
- ["@payload.id"],
190
- ["array/append", "@entity.selected", "@payload.id"]
191
- ]
192
- ],
193
- ["notify", "in_app", "Maximum selection reached"]
194
- ]
195
- ]
511
+ ["fetch", "File"],
512
+ ["set", "@entity.isSelected", false],
513
+ FILE_IDLE_MAIN_VIEW
196
514
  ]
197
515
  },
198
516
  {
199
- from: "Active",
200
- to: "Active",
201
- event: "SELECT_ALL",
202
- guard: ["=", "@entity.mode", "multi"],
203
- effects: [["set", "@entity.selected", "@payload.ids"]]
517
+ from: "idle",
518
+ to: "viewing",
519
+ event: "VIEW",
520
+ effects: [
521
+ ["fetch", "File"],
522
+ FILE_DETAIL_MODAL
523
+ ]
204
524
  },
205
525
  {
206
- from: "Active",
207
- to: "Active",
208
- event: "CLEAR",
526
+ from: "selected",
527
+ to: "viewing",
528
+ event: "VIEW",
209
529
  effects: [
210
- ["set", "@entity.selected", []],
211
- ["set", "@entity.lastSelected", null]
530
+ ["fetch", "File"],
531
+ FILE_DETAIL_MODAL
212
532
  ]
213
- }
533
+ },
534
+ { from: "viewing", to: "idle", event: "CLOSE", effects: [["render-ui", "modal", null]] },
535
+ { from: "viewing", to: "idle", event: "CANCEL", effects: [["render-ui", "modal", null]] }
214
536
  ]
215
537
  }
216
538
  }
217
539
  ],
218
- pages: []
540
+ pages: [
541
+ {
542
+ name: "FilesPage",
543
+ path: "/files",
544
+ isInitial: true,
545
+ traits: [{ ref: "SelectionControl" }]
546
+ }
547
+ ]
219
548
  }
220
549
  ]
221
550
  };
@@ -223,281 +552,308 @@ var SORT_BEHAVIOR = {
223
552
  name: "std-sort",
224
553
  version: "1.0.0",
225
554
  description: "Sorting by field with direction toggle",
555
+ theme: DATA_ZINC_THEME,
226
556
  orbitals: [
227
557
  {
228
558
  name: "SortOrbital",
229
559
  entity: {
230
- name: "SortState",
231
- persistence: "runtime",
560
+ name: "Contact",
561
+ persistence: "persistent",
562
+ collection: "contacts",
232
563
  fields: [
233
564
  { name: "id", type: "string", required: true },
234
- { name: "sortField", type: "string", default: null },
235
- { name: "sortDirection", type: "string", default: "asc" },
236
- { name: "defaultField", type: "string", default: null },
237
- { name: "defaultDirection", type: "string", default: "asc" }
565
+ { name: "name", type: "string", default: "" },
566
+ { name: "email", type: "string", default: "" },
567
+ { name: "sortField", type: "string", default: "name" },
568
+ { name: "sortDirection", type: "string", default: "asc" }
238
569
  ]
239
570
  },
240
571
  traits: [
241
572
  {
242
- name: "Sort",
243
- linkedEntity: "SortState",
573
+ name: "SortControl",
574
+ linkedEntity: "Contact",
244
575
  category: "interaction",
245
576
  stateMachine: {
246
- states: [{ name: "Active", isInitial: true }],
577
+ states: [{ name: "browsing", isInitial: true }],
247
578
  events: [
248
579
  { key: "INIT", name: "Initialize" },
249
- { key: "SORT", name: "Sort" },
580
+ { key: "SORT", name: "Sort", payloadSchema: [{ name: "field", type: "string", required: true }] },
250
581
  { key: "TOGGLE_DIRECTION", name: "Toggle Direction" },
251
582
  { key: "CLEAR_SORT", name: "Clear Sort" }
252
583
  ],
253
584
  transitions: [
254
585
  {
255
- from: "Active",
256
- to: "Active",
586
+ from: "browsing",
587
+ to: "browsing",
257
588
  event: "INIT",
258
589
  effects: [
259
- ["set", "@entity.sortField", "@entity.defaultField"],
260
- ["set", "@entity.sortDirection", "@entity.defaultDirection"]
590
+ ["fetch", "Contact"],
591
+ ["set", "@entity.sortField", "name"],
592
+ ["set", "@entity.sortDirection", "asc"],
593
+ CONTACT_MAIN_VIEW
261
594
  ]
262
595
  },
263
596
  {
264
- from: "Active",
265
- to: "Active",
597
+ from: "browsing",
598
+ to: "browsing",
266
599
  event: "SORT",
267
600
  effects: [
268
- [
269
- "if",
270
- ["=", "@entity.sortField", "@payload.field"],
271
- ["set", "@entity.sortDirection", ["if", ["=", "@entity.sortDirection", "asc"], "desc", "asc"]],
272
- [
273
- "do",
274
- ["set", "@entity.sortField", "@payload.field"],
275
- ["set", "@entity.sortDirection", "asc"]
276
- ]
277
- ]
601
+ ["fetch", "Contact"],
602
+ ["set", "@entity.sortField", "@payload.field"],
603
+ CONTACT_MAIN_VIEW
278
604
  ]
279
605
  },
280
606
  {
281
- from: "Active",
282
- to: "Active",
607
+ from: "browsing",
608
+ to: "browsing",
283
609
  event: "TOGGLE_DIRECTION",
284
- guard: ["!=", "@entity.sortField", null],
285
610
  effects: [
286
- ["set", "@entity.sortDirection", ["if", ["=", "@entity.sortDirection", "asc"], "desc", "asc"]]
611
+ ["fetch", "Contact"],
612
+ ["set", "@entity.sortDirection", ["if", ["=", "@entity.sortDirection", "asc"], "desc", "asc"]],
613
+ CONTACT_MAIN_VIEW
287
614
  ]
288
615
  },
289
616
  {
290
- from: "Active",
291
- to: "Active",
617
+ from: "browsing",
618
+ to: "browsing",
292
619
  event: "CLEAR_SORT",
293
620
  effects: [
294
- ["set", "@entity.sortField", null],
295
- ["set", "@entity.sortDirection", "asc"]
621
+ ["fetch", "Contact"],
622
+ ["set", "@entity.sortField", "name"],
623
+ ["set", "@entity.sortDirection", "asc"],
624
+ CONTACT_MAIN_VIEW
296
625
  ]
297
626
  }
298
627
  ]
299
628
  }
300
629
  }
301
630
  ],
302
- pages: []
631
+ pages: [
632
+ {
633
+ name: "ContactsPage",
634
+ path: "/contacts",
635
+ isInitial: true,
636
+ traits: [{ ref: "SortControl" }]
637
+ }
638
+ ]
303
639
  }
304
640
  ]
305
641
  };
306
642
  var FILTER_BEHAVIOR = {
307
643
  name: "std-filter",
308
644
  version: "1.0.0",
309
- description: "Query Singleton pattern for explicit filtering - use with entity-table query prop",
645
+ description: "Query Singleton pattern for explicit filtering",
646
+ theme: DATA_ZINC_THEME,
310
647
  orbitals: [
311
648
  {
312
649
  name: "FilterOrbital",
313
650
  entity: {
314
- name: "QueryState",
315
- persistence: "runtime",
651
+ name: "Task",
652
+ persistence: "persistent",
653
+ collection: "tasks",
316
654
  fields: [
317
655
  { name: "id", type: "string", required: true },
318
- { name: "status", type: "string", default: null },
319
- { name: "priority", type: "string", default: null },
320
- { name: "search", type: "string", default: "" },
321
- { name: "sortBy", type: "string", default: "createdAt" },
322
- { name: "sortOrder", type: "string", default: "desc" },
323
- { name: "entityType", type: "string", default: "" },
324
- { name: "filters", type: "array", default: [] },
325
- { name: "columns", type: "array", default: [] }
656
+ { name: "title", type: "string", default: "" },
657
+ { name: "status", type: "string", default: "open" },
658
+ { name: "priority", type: "string", default: "medium" }
326
659
  ]
327
660
  },
328
661
  traits: [
329
662
  {
330
- name: "Filter",
331
- linkedEntity: "QueryState",
663
+ name: "FilterControl",
664
+ linkedEntity: "Task",
332
665
  category: "interaction",
333
666
  stateMachine: {
334
- states: [{ name: "Active", isInitial: true }],
667
+ states: [
668
+ { name: "browsing", isInitial: true },
669
+ { name: "filtered" }
670
+ ],
335
671
  events: [
336
672
  { key: "INIT", name: "Initialize" },
337
- { key: "FILTER", name: "Filter" },
338
- { key: "SEARCH", name: "Search" },
339
- { key: "SORT", name: "Sort" },
340
- { key: "CLEAR_FILTERS", name: "Clear Filters" }
673
+ { key: "FILTER", name: "Filter", payloadSchema: [{ name: "status", type: "string", required: true }] },
674
+ { key: "CLEAR_FILTERS", name: "Clear Filters" },
675
+ { key: "VIEW", name: "View", payloadSchema: [{ name: "id", type: "string", required: true }] }
341
676
  ],
342
677
  transitions: [
343
678
  {
344
- from: "Active",
345
- to: "Active",
679
+ from: "browsing",
680
+ to: "browsing",
346
681
  event: "INIT",
347
682
  effects: [
348
- ["render-ui", "sidebar", {
349
- type: "filter-group",
350
- entity: "@entity.entityType",
351
- query: "@QueryState",
352
- filters: "@entity.filters"
353
- }],
354
- ["render-ui", "main", {
355
- type: "entity-table",
356
- entity: "@entity.entityType",
357
- query: "@QueryState",
358
- columns: "@entity.columns"
359
- }]
683
+ ["fetch", "Task"],
684
+ TASK_BROWSING_MAIN_VIEW
360
685
  ]
361
686
  },
362
687
  {
363
- from: "Active",
364
- to: "Active",
688
+ from: "browsing",
689
+ to: "filtered",
365
690
  event: "FILTER",
366
691
  effects: [
367
- ["set", "@QueryState.status", "@payload.status"],
368
- ["set", "@QueryState.priority", "@payload.priority"]
692
+ ["fetch", "Task"],
693
+ ["set", "@entity.status", "@payload.status"],
694
+ TASK_FILTERED_MAIN_VIEW
369
695
  ]
370
696
  },
371
697
  {
372
- from: "Active",
373
- to: "Active",
374
- event: "SEARCH",
375
- effects: [["set", "@QueryState.search", "@payload.searchTerm"]]
698
+ from: "filtered",
699
+ to: "filtered",
700
+ event: "FILTER",
701
+ effects: [
702
+ ["fetch", "Task"],
703
+ ["set", "@entity.status", "@payload.status"],
704
+ TASK_FILTERED_MAIN_VIEW
705
+ ]
376
706
  },
377
707
  {
378
- from: "Active",
379
- to: "Active",
380
- event: "SORT",
708
+ from: "filtered",
709
+ to: "browsing",
710
+ event: "CLEAR_FILTERS",
381
711
  effects: [
382
- ["set", "@QueryState.sortBy", "@payload.field"],
383
- ["set", "@QueryState.sortOrder", "@payload.order"]
712
+ ["set", "@entity.status", "open"],
713
+ ["fetch", "Task"],
714
+ TASK_BROWSING_MAIN_VIEW
384
715
  ]
385
716
  },
717
+ // VIEW self-transitions
386
718
  {
387
- from: "Active",
388
- to: "Active",
389
- event: "CLEAR_FILTERS",
719
+ from: "browsing",
720
+ to: "browsing",
721
+ event: "VIEW",
722
+ effects: [
723
+ ["fetch", "Task"],
724
+ TASK_BROWSING_MAIN_VIEW
725
+ ]
726
+ },
727
+ {
728
+ from: "filtered",
729
+ to: "filtered",
730
+ event: "VIEW",
390
731
  effects: [
391
- ["set", "@QueryState.status", null],
392
- ["set", "@QueryState.priority", null],
393
- ["set", "@QueryState.search", ""]
732
+ ["fetch", "Task"],
733
+ TASK_FILTERED_MAIN_VIEW
394
734
  ]
395
735
  }
396
736
  ]
397
737
  }
398
738
  }
399
739
  ],
400
- pages: []
740
+ pages: [
741
+ {
742
+ name: "TasksPage",
743
+ path: "/tasks",
744
+ isInitial: true,
745
+ traits: [{ ref: "FilterControl" }]
746
+ }
747
+ ]
401
748
  }
402
749
  ]
403
750
  };
404
751
  var SEARCH_BEHAVIOR = {
405
752
  name: "std-search",
406
753
  version: "1.0.0",
407
- description: "Search with debounce - updates QueryState.search field",
754
+ description: "Search behavior for entity lists",
755
+ theme: DATA_ZINC_THEME,
408
756
  orbitals: [
409
757
  {
410
758
  name: "SearchOrbital",
411
759
  entity: {
412
- name: "SearchState",
413
- persistence: "runtime",
760
+ name: "Article",
761
+ persistence: "persistent",
762
+ collection: "articles",
414
763
  fields: [
415
764
  { name: "id", type: "string", required: true },
416
- { name: "search", type: "string", default: "" },
417
- { name: "isSearching", type: "boolean", default: false },
418
- { name: "minLength", type: "number", default: 2 },
419
- { name: "debounceMs", type: "number", default: 300 },
420
- { name: "placeholder", type: "string", default: "Search..." }
765
+ { name: "title", type: "string", default: "" },
766
+ { name: "content", type: "string", default: "" },
767
+ { name: "searchTerm", type: "string", default: "" }
421
768
  ]
422
769
  },
423
770
  traits: [
424
771
  {
425
- name: "Search",
426
- linkedEntity: "SearchState",
772
+ name: "SearchControl",
773
+ linkedEntity: "Article",
427
774
  category: "interaction",
428
775
  stateMachine: {
429
776
  states: [
430
- { name: "Idle", isInitial: true },
431
- { name: "Searching" }
777
+ { name: "idle", isInitial: true },
778
+ { name: "searching" }
432
779
  ],
433
780
  events: [
434
781
  { key: "INIT", name: "Initialize" },
435
- { key: "SEARCH", name: "Search" },
782
+ { key: "SEARCH", name: "Search", payloadSchema: [{ name: "term", type: "string", required: true }] },
436
783
  { key: "CLEAR_SEARCH", name: "Clear Search" },
437
- { key: "SEARCH_COMPLETE", name: "Search Complete" }
784
+ { key: "VIEW", name: "View", payloadSchema: [{ name: "id", type: "string", required: true }] }
438
785
  ],
439
786
  transitions: [
440
787
  {
441
- from: "Idle",
442
- to: "Idle",
788
+ from: "idle",
789
+ to: "idle",
443
790
  event: "INIT",
444
791
  effects: [
445
- ["set", "@entity.search", ""],
446
- ["set", "@entity.isSearching", false],
447
- ["render-ui", "main", {
448
- type: "search-input",
449
- query: "@SearchState",
450
- placeholder: "@entity.placeholder"
451
- }]
792
+ ["fetch", "Article"],
793
+ ARTICLE_IDLE_MAIN_VIEW
452
794
  ]
453
795
  },
454
796
  {
455
- from: "Idle",
456
- to: "Searching",
797
+ from: "idle",
798
+ to: "searching",
457
799
  event: "SEARCH",
458
- guard: [">=", ["str/len", "@payload.term"], "@entity.minLength"],
459
800
  effects: [
460
- ["set", "@entity.search", "@payload.term"],
461
- ["set", "@entity.isSearching", true],
462
- ["async/debounce", "@entity.debounceMs", ["emit", "SEARCH_COMPLETE"]]
801
+ ["fetch", "Article"],
802
+ ["set", "@entity.searchTerm", "@payload.term"],
803
+ ARTICLE_SEARCHING_MAIN_VIEW
463
804
  ]
464
805
  },
465
806
  {
466
- from: "Idle",
467
- to: "Idle",
807
+ from: "searching",
808
+ to: "searching",
468
809
  event: "SEARCH",
469
- guard: ["<", ["str/len", "@payload.term"], "@entity.minLength"],
470
- effects: [["set", "@entity.search", "@payload.term"]]
810
+ effects: [
811
+ ["fetch", "Article"],
812
+ ["set", "@entity.searchTerm", "@payload.term"],
813
+ ARTICLE_SEARCHING_MAIN_VIEW
814
+ ]
471
815
  },
472
816
  {
473
- from: "Searching",
474
- to: "Idle",
475
- event: "SEARCH_COMPLETE",
476
- effects: [["set", "@entity.isSearching", false]]
817
+ from: "searching",
818
+ to: "idle",
819
+ event: "CLEAR_SEARCH",
820
+ effects: [
821
+ ["set", "@entity.searchTerm", ""],
822
+ ["fetch", "Article"],
823
+ ARTICLE_IDLE_MAIN_VIEW
824
+ ]
477
825
  },
826
+ // VIEW self-transitions
478
827
  {
479
- from: "Idle",
480
- to: "Idle",
481
- event: "CLEAR_SEARCH",
828
+ from: "idle",
829
+ to: "idle",
830
+ event: "VIEW",
482
831
  effects: [
483
- ["set", "@entity.search", ""],
484
- ["set", "@entity.isSearching", false]
832
+ ["fetch", "Article"],
833
+ ARTICLE_IDLE_MAIN_VIEW
485
834
  ]
486
835
  },
487
836
  {
488
- from: "Searching",
489
- to: "Idle",
490
- event: "CLEAR_SEARCH",
837
+ from: "searching",
838
+ to: "searching",
839
+ event: "VIEW",
491
840
  effects: [
492
- ["set", "@entity.search", ""],
493
- ["set", "@entity.isSearching", false]
841
+ ["fetch", "Article"],
842
+ ARTICLE_SEARCHING_MAIN_VIEW
494
843
  ]
495
844
  }
496
845
  ]
497
846
  }
498
847
  }
499
848
  ],
500
- pages: []
849
+ pages: [
850
+ {
851
+ name: "ArticlesPage",
852
+ path: "/articles",
853
+ isInitial: true,
854
+ traits: [{ ref: "SearchControl" }]
855
+ }
856
+ ]
501
857
  }
502
858
  ]
503
859
  };