@almadar/std 2.1.0 → 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 +4 -1
@@ -1,512 +1,663 @@
1
1
  // behaviors/ui-interaction.ts
2
+ var UI_SLATE_THEME = {
3
+ name: "ui-slate",
4
+ tokens: {
5
+ colors: {
6
+ primary: "#475569",
7
+ "primary-hover": "#334155",
8
+ "primary-foreground": "#ffffff",
9
+ accent: "#64748b",
10
+ "accent-foreground": "#ffffff",
11
+ success: "#22c55e",
12
+ warning: "#f59e0b",
13
+ error: "#ef4444"
14
+ }
15
+ }
16
+ };
17
+ var LIST_MAIN_VIEW = ["render-ui", "main", {
18
+ type: "stack",
19
+ direction: "vertical",
20
+ gap: "lg",
21
+ children: [
22
+ { type: "stack", direction: "horizontal", gap: "md", children: [
23
+ { type: "icon", name: "list", size: "lg" },
24
+ { type: "typography", content: "Items", variant: "heading" },
25
+ { type: "button", label: "Create", event: "CREATE", variant: "primary", icon: "plus" }
26
+ ] },
27
+ { type: "divider" },
28
+ { type: "data-grid", entity: "Item", columns: ["name", "status", "createdAt"], itemActions: [
29
+ { label: "View", event: "VIEW" },
30
+ { label: "Edit", event: "EDIT" },
31
+ { label: "Delete", event: "DELETE", variant: "danger" }
32
+ ] }
33
+ ]
34
+ }];
2
35
  var LIST_BEHAVIOR = {
3
36
  name: "std-list",
4
37
  version: "1.0.0",
5
38
  description: "Entity list management with CRUD operations",
39
+ theme: UI_SLATE_THEME,
6
40
  orbitals: [
7
41
  {
8
42
  name: "ListOrbital",
9
43
  entity: {
10
- name: "ListState",
11
- persistence: "runtime",
44
+ name: "Item",
45
+ persistence: "persistent",
46
+ collection: "items",
12
47
  fields: [
13
48
  { name: "id", type: "string", required: true },
14
- { name: "selectedId", type: "string", default: null },
15
- { name: "entityType", type: "string", default: "" },
16
- { name: "title", type: "string", default: "Items" },
17
- { name: "columns", type: "array", default: [] }
49
+ { name: "name", type: "string", default: "" },
50
+ { name: "status", type: "enum", default: "active", values: ["active", "inactive", "archived"] },
51
+ { name: "createdAt", type: "date", default: "" }
18
52
  ]
19
53
  },
20
54
  traits: [
21
55
  {
22
- name: "List",
23
- linkedEntity: "ListState",
56
+ name: "ListManagement",
57
+ linkedEntity: "Item",
24
58
  category: "interaction",
59
+ // When composed with other behaviors, add emits for cross-trait events:
60
+ // emits: [{ event: 'ITEM_CREATED', scope: 'external', payloadSchema: [...] }]
25
61
  stateMachine: {
26
62
  states: [
27
- { name: "Browsing", isInitial: true },
28
- { name: "Creating" },
29
- { name: "Viewing" },
30
- { name: "Editing" },
31
- { name: "Deleting" }
63
+ { name: "browsing", isInitial: true },
64
+ { name: "creating" },
65
+ { name: "viewing" },
66
+ { name: "editing" },
67
+ { name: "deleting" }
32
68
  ],
33
69
  events: [
34
70
  { key: "INIT", name: "Initialize" },
35
71
  { key: "CREATE", name: "Create" },
36
- { key: "VIEW", name: "View" },
37
- { key: "EDIT", name: "Edit" },
38
- { key: "DELETE", name: "Delete" },
39
- { key: "CONFIRM_DELETE", name: "Confirm Delete" },
72
+ { key: "VIEW", name: "View", payloadSchema: [{ name: "id", type: "string", required: true }] },
73
+ { key: "EDIT", name: "Edit", payloadSchema: [{ name: "id", type: "string", required: true }] },
74
+ { key: "DELETE", name: "Delete", payloadSchema: [{ name: "id", type: "string", required: true }] },
75
+ { key: "CONFIRM_DELETE", name: "Confirm Delete", payloadSchema: [{ name: "id", type: "string", required: true }] },
40
76
  { key: "CANCEL", name: "Cancel" },
41
- { key: "SAVE", name: "Save" }
77
+ { key: "CLOSE", name: "Close" },
78
+ { key: "SAVE", name: "Save", payloadSchema: [{ name: "data", type: "object", required: true }] }
42
79
  ],
43
80
  transitions: [
44
81
  {
45
- from: "Browsing",
46
- to: "Browsing",
82
+ from: "browsing",
83
+ to: "browsing",
47
84
  event: "INIT",
48
85
  effects: [
49
- ["render-ui", "main", {
50
- type: "page-header",
51
- title: "@entity.title",
52
- actions: [{ label: "Create", event: "CREATE", variant: "primary" }]
53
- }],
54
- ["render-ui", "main", {
55
- type: "entity-table",
56
- entity: "@entity.entityType",
57
- columns: "@entity.columns",
58
- itemActions: [
59
- { label: "View", event: "VIEW", placement: "row" },
60
- { label: "Edit", event: "EDIT", placement: "row" },
61
- { label: "Delete", event: "DELETE", variant: "danger", placement: "row" }
62
- ]
63
- }]
86
+ ["fetch", "Item"],
87
+ LIST_MAIN_VIEW
64
88
  ]
65
89
  },
66
90
  {
67
- from: "Browsing",
68
- to: "Creating",
91
+ from: "browsing",
92
+ to: "creating",
69
93
  event: "CREATE",
70
94
  effects: [
95
+ ["fetch", "Item"],
71
96
  ["render-ui", "modal", {
72
- type: "form-section",
73
- entity: "@entity.entityType",
74
- mode: "create",
75
- onSubmit: "SAVE",
76
- onCancel: "CANCEL"
97
+ type: "stack",
98
+ direction: "vertical",
99
+ gap: "md",
100
+ children: [
101
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
102
+ { type: "icon", name: "plus-circle", size: "md" },
103
+ { type: "typography", content: "Create Item", variant: "heading" }
104
+ ] },
105
+ { type: "divider" },
106
+ { type: "form-section", entity: "Item", mode: "create", submitEvent: "SAVE", cancelEvent: "CANCEL" }
107
+ ]
77
108
  }]
78
109
  ]
79
110
  },
80
111
  {
81
- from: "Browsing",
82
- to: "Viewing",
112
+ from: "browsing",
113
+ to: "viewing",
83
114
  event: "VIEW",
84
115
  effects: [
85
- ["set", "@entity.selectedId", "@payload.id"],
86
- ["render-ui", "drawer", {
87
- type: "detail-panel",
88
- entity: "@entity.entityType",
89
- data: "@payload.id",
90
- actions: [
91
- { label: "Edit", event: "EDIT" },
92
- { label: "Close", event: "CANCEL" }
116
+ ["fetch", "Item", { id: "@payload.id" }],
117
+ ["render-ui", "modal", {
118
+ type: "stack",
119
+ direction: "vertical",
120
+ gap: "md",
121
+ children: [
122
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
123
+ { type: "icon", name: "eye", size: "md" },
124
+ { type: "typography", content: "@Item.name", variant: "heading" },
125
+ { type: "badge", label: "@Item.status", variant: "outline" }
126
+ ] },
127
+ { type: "divider" },
128
+ { type: "detail-panel", entity: "Item", fields: ["name", "status", "createdAt"] },
129
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
130
+ { type: "button", label: "Edit", event: "EDIT", actionPayload: { id: "@payload.id" }, variant: "primary", icon: "pencil" },
131
+ { type: "button", label: "Close", event: "CLOSE", variant: "secondary" }
132
+ ] }
93
133
  ]
94
134
  }]
95
135
  ]
96
136
  },
97
137
  {
98
- from: "Browsing",
99
- to: "Editing",
138
+ from: "browsing",
139
+ to: "editing",
100
140
  event: "EDIT",
101
141
  effects: [
102
- ["set", "@entity.selectedId", "@payload.id"],
103
- ["render-ui", "drawer", {
104
- type: "form-section",
105
- entity: "@entity.entityType",
106
- initialData: "@payload.id",
107
- mode: "edit",
108
- onSubmit: "SAVE",
109
- onCancel: "CANCEL"
142
+ ["fetch", "Item", { id: "@payload.id" }],
143
+ ["render-ui", "modal", {
144
+ type: "stack",
145
+ direction: "vertical",
146
+ gap: "md",
147
+ children: [
148
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
149
+ { type: "icon", name: "pencil", size: "md" },
150
+ { type: "typography", content: "Edit Item", variant: "heading" }
151
+ ] },
152
+ { type: "divider" },
153
+ { type: "form-section", entity: "Item", entityId: "@payload.id", submitEvent: "SAVE", cancelEvent: "CANCEL" }
154
+ ]
110
155
  }]
111
156
  ]
112
157
  },
113
158
  {
114
- from: "Viewing",
115
- to: "Editing",
159
+ from: "viewing",
160
+ to: "editing",
116
161
  event: "EDIT",
117
162
  effects: [
118
- ["render-ui", "drawer", {
119
- type: "form-section",
120
- entity: "@entity.entityType",
121
- initialData: "@entity.selectedId",
122
- mode: "edit",
123
- onSubmit: "SAVE",
124
- onCancel: "CANCEL"
163
+ ["fetch", "Item", { id: "@payload.id" }],
164
+ ["render-ui", "modal", {
165
+ type: "stack",
166
+ direction: "vertical",
167
+ gap: "md",
168
+ children: [
169
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
170
+ { type: "icon", name: "pencil", size: "md" },
171
+ { type: "typography", content: "Edit Item", variant: "heading" }
172
+ ] },
173
+ { type: "divider" },
174
+ { type: "form-section", entity: "Item", entityId: "@payload.id", submitEvent: "SAVE", cancelEvent: "CANCEL" }
175
+ ]
125
176
  }]
126
177
  ]
127
178
  },
128
179
  {
129
- from: "Browsing",
130
- to: "Deleting",
180
+ from: "browsing",
181
+ to: "deleting",
131
182
  event: "DELETE",
132
183
  effects: [
133
- ["set", "@entity.selectedId", "@payload.id"],
184
+ ["fetch", "Item", { id: "@payload.id" }],
134
185
  ["render-ui", "modal", {
135
- type: "confirm-dialog",
136
- isOpen: true,
137
- onClose: "CANCEL",
138
- onConfirm: "CONFIRM_DELETE",
139
- title: "Delete Confirmation",
140
- message: "Are you sure you want to delete this item?",
141
- confirmText: "Delete",
142
- variant: "danger"
186
+ type: "stack",
187
+ direction: "vertical",
188
+ gap: "md",
189
+ children: [
190
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
191
+ { type: "icon", name: "alert-triangle", size: "md" },
192
+ { type: "typography", content: "Delete Confirmation", variant: "heading" }
193
+ ] },
194
+ { type: "divider" },
195
+ { type: "typography", content: "Are you sure you want to delete this item?", variant: "body" },
196
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
197
+ { type: "button", label: "Delete", event: "CONFIRM_DELETE", actionPayload: { id: "@payload.id" }, variant: "primary", icon: "trash" },
198
+ { type: "button", label: "Cancel", event: "CANCEL", variant: "secondary" }
199
+ ] }
200
+ ]
143
201
  }]
144
202
  ]
145
203
  },
146
204
  {
147
- from: "Creating",
148
- to: "Browsing",
205
+ from: "creating",
206
+ to: "browsing",
149
207
  event: "SAVE",
150
208
  effects: [
151
- ["persist", "create", "@entity.entityType", "@payload.data"],
152
- ["notify", "in_app", "Created successfully"],
153
- ["emit", "INIT"]
209
+ ["persist", "create", "Item", "@payload.data"],
210
+ ["fetch", "Item"],
211
+ ["render-ui", "modal", null]
154
212
  ]
155
213
  },
156
214
  {
157
- from: "Editing",
158
- to: "Browsing",
215
+ from: "editing",
216
+ to: "browsing",
159
217
  event: "SAVE",
160
218
  effects: [
161
- ["persist", "update", "@entity.entityType", "@payload.data"],
162
- ["notify", "in_app", "Updated successfully"],
163
- ["emit", "INIT"]
219
+ ["persist", "update", "Item", "@payload.data"],
220
+ ["fetch", "Item"],
221
+ ["render-ui", "modal", null]
164
222
  ]
165
223
  },
166
224
  {
167
- from: "Deleting",
168
- to: "Browsing",
225
+ from: "deleting",
226
+ to: "browsing",
169
227
  event: "CONFIRM_DELETE",
170
228
  effects: [
171
- ["persist", "delete", "@entity.entityType", "@entity.selectedId"],
172
- ["notify", "in_app", "Deleted successfully"],
173
- ["emit", "INIT"]
229
+ ["persist", "delete", "Item", { id: "@payload.id" }],
230
+ ["fetch", "Item"],
231
+ ["render-ui", "modal", null]
174
232
  ]
175
233
  },
176
- {
177
- from: "Creating",
178
- to: "Browsing",
179
- event: "CANCEL",
180
- effects: []
181
- },
182
- {
183
- from: "Viewing",
184
- to: "Browsing",
185
- event: "CANCEL",
186
- effects: []
187
- },
188
- {
189
- from: "Editing",
190
- to: "Browsing",
191
- event: "CANCEL",
192
- effects: []
193
- },
194
- {
195
- from: "Deleting",
196
- to: "Browsing",
197
- event: "CANCEL",
198
- effects: []
199
- }
234
+ // CANCEL transitions (close modal + re-fetch collection)
235
+ { from: "creating", to: "browsing", event: "CANCEL", effects: [["fetch", "Item"], ["render-ui", "modal", null]] },
236
+ { from: "viewing", to: "browsing", event: "CANCEL", effects: [["fetch", "Item"], ["render-ui", "modal", null]] },
237
+ { from: "editing", to: "browsing", event: "CANCEL", effects: [["fetch", "Item"], ["render-ui", "modal", null]] },
238
+ { from: "deleting", to: "browsing", event: "CANCEL", effects: [["fetch", "Item"], ["render-ui", "modal", null]] },
239
+ // CLOSE transitions (alias for CANCEL on view states)
240
+ { from: "creating", to: "browsing", event: "CLOSE", effects: [["fetch", "Item"], ["render-ui", "modal", null]] },
241
+ { from: "viewing", to: "browsing", event: "CLOSE", effects: [["fetch", "Item"], ["render-ui", "modal", null]] },
242
+ { from: "editing", to: "browsing", event: "CLOSE", effects: [["fetch", "Item"], ["render-ui", "modal", null]] },
243
+ { from: "deleting", to: "browsing", event: "CLOSE", effects: [["fetch", "Item"], ["render-ui", "modal", null]] }
200
244
  ]
201
245
  }
202
246
  }
203
247
  ],
204
- pages: []
248
+ pages: [
249
+ {
250
+ name: "ItemsPage",
251
+ path: "/items",
252
+ isInitial: true,
253
+ traits: [{ ref: "ListManagement" }]
254
+ }
255
+ ]
205
256
  }
206
257
  ]
207
258
  };
259
+ var DETAIL_LIST_VIEW = ["render-ui", "main", {
260
+ type: "stack",
261
+ direction: "vertical",
262
+ gap: "lg",
263
+ children: [
264
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
265
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
266
+ { type: "icon", name: "file-text", size: "lg" },
267
+ { type: "typography", content: "Records", variant: "h2" }
268
+ ] },
269
+ { type: "button", label: "Create", action: "CREATE", variant: "primary", icon: "plus" }
270
+ ] },
271
+ { type: "divider" },
272
+ {
273
+ type: "data-list",
274
+ entity: "Record",
275
+ fields: [
276
+ { name: "name", label: "Name", icon: "file-text", variant: "h4" },
277
+ { name: "description", label: "Description", icon: "align-left", variant: "body" },
278
+ { name: "status", label: "Status", icon: "circle", variant: "badge" }
279
+ ],
280
+ actions: [
281
+ { label: "View", event: "SELECT", icon: "eye", variant: "secondary" }
282
+ ]
283
+ }
284
+ ]
285
+ }];
286
+ var DETAIL_MAIN_VIEW = ["render-ui", "main", {
287
+ type: "stack",
288
+ direction: "vertical",
289
+ gap: "lg",
290
+ children: [
291
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
292
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
293
+ { type: "icon", name: "file-text", size: "lg" },
294
+ { type: "typography", content: "@entity.name", variant: "h2" }
295
+ ] },
296
+ { type: "badge", label: "@entity.status", variant: "outline" }
297
+ ] },
298
+ { type: "divider" },
299
+ {
300
+ type: "data-list",
301
+ entity: "Record",
302
+ fields: [
303
+ { name: "name", label: "Name", icon: "file-text", variant: "h4" },
304
+ { name: "description", label: "Description", icon: "align-left", variant: "body" },
305
+ { name: "status", label: "Status", icon: "circle", variant: "badge" }
306
+ ]
307
+ },
308
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
309
+ { type: "button", label: "Edit", action: "EDIT", variant: "primary", icon: "pencil" },
310
+ { type: "button", label: "Delete", action: "DELETE", variant: "secondary", icon: "trash" },
311
+ { type: "button", label: "Back", action: "BACK", variant: "ghost", icon: "arrow-left" }
312
+ ] }
313
+ ]
314
+ }];
208
315
  var DETAIL_BEHAVIOR = {
209
316
  name: "std-detail",
210
317
  version: "1.0.0",
211
318
  description: "Single entity view with edit/delete capabilities",
319
+ theme: UI_SLATE_THEME,
212
320
  orbitals: [
213
321
  {
214
322
  name: "DetailOrbital",
215
323
  entity: {
216
- name: "DetailState",
217
- persistence: "runtime",
324
+ name: "Record",
325
+ persistence: "persistent",
326
+ collection: "records",
218
327
  fields: [
219
328
  { name: "id", type: "string", required: true },
220
- { name: "entityId", type: "string", default: null },
221
- { name: "isLoading", type: "boolean", default: false },
222
- { name: "hasChanges", type: "boolean", default: false },
223
- { name: "entityType", type: "string", default: "" },
224
- { name: "fields", type: "array", default: [] },
225
- { name: "returnUrl", type: "string", default: "/" }
329
+ { name: "name", type: "string", default: "" },
330
+ { name: "description", type: "string", default: "" },
331
+ { name: "status", type: "string", default: "active" }
226
332
  ]
227
333
  },
228
334
  traits: [
229
335
  {
230
- name: "Detail",
231
- linkedEntity: "DetailState",
336
+ name: "DetailView",
337
+ linkedEntity: "Record",
232
338
  category: "interaction",
339
+ // When composed: emits: [{ event: 'RECORD_UPDATED', ... }, { event: 'RECORD_DELETED', ... }]
233
340
  stateMachine: {
234
341
  states: [
235
- { name: "Viewing", isInitial: true },
236
- { name: "Editing" },
237
- { name: "Deleting" }
342
+ { name: "browsing", isInitial: true },
343
+ { name: "viewing" },
344
+ { name: "creating" },
345
+ { name: "editing" },
346
+ { name: "deleting" }
238
347
  ],
239
348
  events: [
240
349
  { key: "INIT", name: "Initialize" },
350
+ { key: "SELECT", name: "Select Record" },
351
+ { key: "CREATE", name: "Create Record" },
352
+ { key: "BACK", name: "Back to List" },
241
353
  { key: "EDIT", name: "Edit" },
242
- { key: "SAVE", name: "Save" },
354
+ { key: "SAVE", name: "Save", payloadSchema: [{ name: "data", type: "object", required: true }] },
243
355
  { key: "CANCEL", name: "Cancel" },
356
+ { key: "CLOSE", name: "Close" },
244
357
  { key: "DELETE", name: "Delete" },
245
358
  { key: "CONFIRM_DELETE", name: "Confirm Delete" }
246
359
  ],
247
360
  transitions: [
248
361
  {
249
- from: "Viewing",
250
- to: "Viewing",
362
+ from: "browsing",
363
+ to: "browsing",
251
364
  event: "INIT",
252
365
  effects: [
253
- ["render-ui", "main", {
254
- type: "page-header",
255
- title: "@entity.name",
256
- actions: [
257
- { label: "Edit", event: "EDIT" },
258
- { label: "Delete", event: "DELETE", variant: "danger" }
366
+ ["fetch", "Record"],
367
+ DETAIL_LIST_VIEW
368
+ ]
369
+ },
370
+ {
371
+ from: "browsing",
372
+ to: "viewing",
373
+ event: "SELECT",
374
+ effects: [
375
+ ["fetch", "Record"],
376
+ DETAIL_MAIN_VIEW
377
+ ]
378
+ },
379
+ {
380
+ from: "viewing",
381
+ to: "browsing",
382
+ event: "BACK",
383
+ effects: [
384
+ ["fetch", "Record"],
385
+ DETAIL_LIST_VIEW
386
+ ]
387
+ },
388
+ {
389
+ from: "browsing",
390
+ to: "creating",
391
+ event: "CREATE",
392
+ effects: [
393
+ ["render-ui", "modal", {
394
+ type: "stack",
395
+ direction: "vertical",
396
+ gap: "md",
397
+ children: [
398
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
399
+ { type: "icon", name: "plus", size: "md" },
400
+ { type: "typography", content: "New Record", variant: "h3" }
401
+ ] },
402
+ { type: "divider" },
403
+ { type: "form-section", entity: "Record", mode: "create", submitEvent: "SAVE", cancelEvent: "CANCEL" }
259
404
  ]
260
- }],
261
- ["render-ui", "main", {
262
- type: "detail-panel",
263
- entity: "@entity.entityType",
264
- fieldNames: "@entity.fields"
265
405
  }]
266
406
  ]
267
407
  },
268
408
  {
269
- from: "Viewing",
270
- to: "Editing",
409
+ from: "creating",
410
+ to: "browsing",
411
+ event: "SAVE",
412
+ effects: [
413
+ ["persist", "create", "Record", "@payload.data"],
414
+ ["fetch", "Record"],
415
+ ["render-ui", "modal", null],
416
+ DETAIL_LIST_VIEW
417
+ ]
418
+ },
419
+ {
420
+ from: "viewing",
421
+ to: "editing",
271
422
  event: "EDIT",
272
423
  effects: [
273
- ["render-ui", "main", {
274
- type: "form-section",
275
- entity: "@entity.entityType",
276
- mode: "edit",
277
- fields: "@entity.fields",
278
- onSubmit: "SAVE",
279
- onCancel: "CANCEL"
424
+ ["fetch", "Record"],
425
+ ["render-ui", "modal", {
426
+ type: "stack",
427
+ direction: "vertical",
428
+ gap: "md",
429
+ children: [
430
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
431
+ { type: "icon", name: "pencil", size: "md" },
432
+ { type: "typography", content: "Edit Record", variant: "h3" }
433
+ ] },
434
+ { type: "divider" },
435
+ { type: "form-section", entity: "Record", mode: "edit", submitEvent: "SAVE", cancelEvent: "CANCEL" }
436
+ ]
280
437
  }]
281
438
  ]
282
439
  },
283
440
  {
284
- from: "Editing",
285
- to: "Viewing",
441
+ from: "editing",
442
+ to: "viewing",
286
443
  event: "SAVE",
287
444
  effects: [
288
- ["persist", "update", "@entity.entityType", "@payload.data"],
289
- ["notify", "in_app", "Updated successfully"],
290
- ["emit", "INIT"]
445
+ ["persist", "update", "Record", "@payload.data"],
446
+ ["render-ui", "modal", null]
291
447
  ]
292
448
  },
293
449
  {
294
- from: "Editing",
295
- to: "Viewing",
296
- event: "CANCEL",
297
- effects: [["emit", "INIT"]]
298
- },
299
- {
300
- from: "Viewing",
301
- to: "Deleting",
450
+ from: "viewing",
451
+ to: "deleting",
302
452
  event: "DELETE",
303
453
  effects: [
304
454
  ["render-ui", "modal", {
305
- type: "confirm-dialog",
306
- isOpen: true,
307
- onClose: "CANCEL",
308
- onConfirm: "CONFIRM",
309
- title: "Delete Confirmation",
310
- message: "Are you sure you want to delete this item?"
455
+ type: "stack",
456
+ direction: "vertical",
457
+ gap: "md",
458
+ children: [
459
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
460
+ { type: "icon", name: "alert-triangle", size: "md" },
461
+ { type: "typography", content: "Delete Confirmation", variant: "h3" }
462
+ ] },
463
+ { type: "divider" },
464
+ { type: "typography", content: "Are you sure you want to delete this record?", variant: "body" },
465
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
466
+ { type: "button", label: "Delete", action: "CONFIRM_DELETE", variant: "primary", icon: "trash" },
467
+ { type: "button", label: "Cancel", action: "CANCEL", variant: "secondary" }
468
+ ] }
469
+ ]
311
470
  }]
312
471
  ]
313
472
  },
314
473
  {
315
- from: "Deleting",
316
- to: "Viewing",
474
+ from: "deleting",
475
+ to: "browsing",
317
476
  event: "CONFIRM_DELETE",
318
477
  effects: [
319
- ["persist", "delete", "@entity.entityType", "@entity.id"],
320
- ["navigate", "@entity.returnUrl"]
478
+ ["persist", "delete", "Record"],
479
+ ["fetch", "Record"],
480
+ ["render-ui", "modal", null],
481
+ DETAIL_LIST_VIEW
321
482
  ]
322
483
  },
323
- {
324
- from: "Deleting",
325
- to: "Viewing",
326
- event: "CANCEL",
327
- effects: []
328
- }
484
+ // Modal close transitions
485
+ { from: "creating", to: "browsing", event: "CANCEL", effects: [["render-ui", "modal", null], DETAIL_LIST_VIEW] },
486
+ { from: "creating", to: "browsing", event: "CLOSE", effects: [["render-ui", "modal", null], DETAIL_LIST_VIEW] },
487
+ { from: "editing", to: "viewing", event: "CANCEL", effects: [["render-ui", "modal", null]] },
488
+ { from: "editing", to: "viewing", event: "CLOSE", effects: [["render-ui", "modal", null]] },
489
+ { from: "deleting", to: "viewing", event: "CANCEL", effects: [["render-ui", "modal", null]] },
490
+ { from: "deleting", to: "viewing", event: "CLOSE", effects: [["render-ui", "modal", null]] }
329
491
  ]
330
492
  }
331
493
  }
332
494
  ],
333
- pages: []
495
+ pages: [
496
+ {
497
+ name: "RecordsPage",
498
+ path: "/records",
499
+ isInitial: true,
500
+ traits: [{ ref: "DetailView" }]
501
+ }
502
+ ]
334
503
  }
335
504
  ]
336
505
  };
506
+ var FORM_EDITING_VIEW = ["render-ui", "main", {
507
+ type: "stack",
508
+ direction: "vertical",
509
+ gap: "lg",
510
+ children: [
511
+ { type: "stack", direction: "horizontal", gap: "md", children: [
512
+ { type: "icon", name: "file-plus", size: "lg" },
513
+ { type: "typography", content: "New Entry", variant: "heading" }
514
+ ] },
515
+ { type: "divider" },
516
+ { type: "form-section", entity: "FormEntry", mode: "create", submitEvent: "SUBMIT" }
517
+ ]
518
+ }];
337
519
  var FORM_BEHAVIOR = {
338
520
  name: "std-form",
339
521
  version: "1.0.0",
340
522
  description: "Form state management with validation and submission",
523
+ theme: UI_SLATE_THEME,
341
524
  orbitals: [
342
525
  {
343
526
  name: "FormOrbital",
344
527
  entity: {
345
- name: "FormState",
346
- persistence: "runtime",
528
+ name: "FormEntry",
529
+ persistence: "persistent",
530
+ collection: "entries",
347
531
  fields: [
348
532
  { name: "id", type: "string", required: true },
349
- { name: "values", type: "object", default: {} },
350
- { name: "errors", type: "object", default: {} },
351
- { name: "touched", type: "object", default: {} },
352
- { name: "isDirty", type: "boolean", default: false },
353
- { name: "isSubmitting", type: "boolean", default: false },
354
- { name: "entityType", type: "string", default: "" },
355
- { name: "fields", type: "array", default: [] },
356
- { name: "mode", type: "string", default: "create" },
357
- { name: "validation", type: "object", default: {} },
358
- { name: "cancelEvent", type: "string", default: "CANCEL" },
359
- { name: "submitEvent", type: "string", default: "SUBMIT_SUCCESS" }
533
+ { name: "name", type: "string", default: "" },
534
+ { name: "value", type: "string", default: "" },
535
+ { name: "status", type: "string", default: "draft" }
360
536
  ]
361
537
  },
362
538
  traits: [
363
539
  {
364
- name: "Form",
365
- linkedEntity: "FormState",
540
+ name: "FormFlow",
541
+ linkedEntity: "FormEntry",
366
542
  category: "interaction",
543
+ // When composed: emits: [{ event: 'FORM_SUBMITTED', ... }]
367
544
  stateMachine: {
368
545
  states: [
369
- { name: "Idle", isInitial: true },
370
- { name: "Editing" },
371
- { name: "Validating" },
372
- { name: "Submitting" },
373
- { name: "Success", isTerminal: true },
374
- { name: "Error" }
546
+ { name: "idle", isInitial: true },
547
+ { name: "editing" },
548
+ { name: "submitting" },
549
+ { name: "success" },
550
+ { name: "error" }
375
551
  ],
376
552
  events: [
377
553
  { key: "INIT", name: "Initialize" },
378
- { key: "FIELD_CHANGE", name: "Field Change" },
379
- { key: "FIELD_BLUR", name: "Field Blur" },
380
- { key: "SUBMIT", name: "Submit" },
381
- { key: "VALIDATION_PASSED", name: "Validation Passed" },
382
- { key: "VALIDATION_FAILED", name: "Validation Failed" },
554
+ { key: "SUBMIT", name: "Submit", payloadSchema: [{ name: "data", type: "object", required: true }] },
383
555
  { key: "SUBMIT_SUCCESS", name: "Submit Success" },
384
- { key: "SUBMIT_ERROR", name: "Submit Error" },
385
- { key: "RESET", name: "Reset" }
556
+ { key: "SUBMIT_ERROR", name: "Submit Error", payloadSchema: [{ name: "message", type: "string", required: true }] },
557
+ { key: "RESET", name: "Reset" },
558
+ { key: "RETRY", name: "Retry" }
386
559
  ],
387
560
  transitions: [
388
561
  {
389
- from: "Idle",
390
- to: "Editing",
562
+ from: "idle",
563
+ to: "editing",
391
564
  event: "INIT",
392
565
  effects: [
393
- ["render-ui", "main", {
394
- type: "form-section",
395
- entity: "@entity.entityType",
396
- fields: "@entity.fields",
397
- initialData: "@entity.values",
398
- onSubmit: "SUBMIT",
399
- onCancel: "@entity.cancelEvent"
400
- }]
401
- ]
402
- },
403
- {
404
- from: "Editing",
405
- to: "Editing",
406
- event: "FIELD_CHANGE",
407
- effects: [
408
- ["set", "@entity.values", ["object/set", "@entity.values", "@payload.field", "@payload.value"]],
409
- ["set", "@entity.isDirty", true]
410
- ]
411
- },
412
- {
413
- from: "Editing",
414
- to: "Editing",
415
- event: "FIELD_BLUR",
416
- effects: [
417
- ["set", "@entity.touched", ["object/set", "@entity.touched", "@payload.field", true]]
566
+ ["fetch", "FormEntry"],
567
+ FORM_EDITING_VIEW
418
568
  ]
419
569
  },
420
570
  {
421
- from: "Editing",
422
- to: "Validating",
571
+ from: "editing",
572
+ to: "submitting",
423
573
  event: "SUBMIT",
424
574
  effects: [
425
- [
426
- "let",
427
- [["result", ["validate/check", "@entity.values", "@entity.validation"]]],
428
- [
429
- "if",
430
- "@result.valid",
431
- ["emit", "VALIDATION_PASSED"],
432
- [
433
- "do",
434
- ["set", "@entity.errors", "@result.errors"],
435
- ["emit", "VALIDATION_FAILED"]
436
- ]
575
+ ["persist", "create", "FormEntry", "@payload.data"],
576
+ ["render-ui", "main", {
577
+ type: "stack",
578
+ direction: "vertical",
579
+ gap: "md",
580
+ children: [
581
+ { type: "icon", name: "loader", size: "lg" },
582
+ { type: "typography", content: "Saving", variant: "heading" },
583
+ { type: "typography", content: "Please wait...", variant: "body" },
584
+ { type: "progress-bar", value: 50 }
437
585
  ]
438
- ]
439
- ]
440
- },
441
- {
442
- from: "Validating",
443
- to: "Submitting",
444
- event: "VALIDATION_PASSED",
445
- effects: [
446
- ["set", "@entity.isSubmitting", true],
447
- [
448
- "if",
449
- ["=", "@entity.mode", "create"],
450
- ["persist", "create", "@entity.entityType", "@entity.values"],
451
- ["persist", "update", "@entity.entityType", "@entity.values"]
452
- ]
586
+ }]
453
587
  ]
454
588
  },
455
589
  {
456
- from: "Validating",
457
- to: "Editing",
458
- event: "VALIDATION_FAILED",
590
+ from: "submitting",
591
+ to: "success",
592
+ event: "SUBMIT_SUCCESS",
459
593
  effects: [
460
- ["notify", "in_app", "Please fix the validation errors"]
594
+ ["render-ui", "main", {
595
+ type: "stack",
596
+ direction: "vertical",
597
+ gap: "md",
598
+ children: [
599
+ { type: "icon", name: "check-circle", size: "lg" },
600
+ { type: "typography", content: "Success", variant: "heading" },
601
+ { type: "typography", content: "Entry saved successfully.", variant: "body" },
602
+ { type: "button", label: "Start Over", event: "RESET", variant: "primary", icon: "refresh-cw" }
603
+ ]
604
+ }]
461
605
  ]
462
606
  },
463
607
  {
464
- from: "Submitting",
465
- to: "Success",
466
- event: "SUBMIT_SUCCESS",
608
+ from: "submitting",
609
+ to: "error",
610
+ event: "SUBMIT_ERROR",
467
611
  effects: [
468
- ["set", "@entity.isSubmitting", false],
469
- ["notify", "in_app", "Saved successfully"],
470
- ["emit", "@entity.submitEvent", { data: "@entity.values" }]
612
+ ["render-ui", "main", {
613
+ type: "stack",
614
+ direction: "vertical",
615
+ gap: "md",
616
+ children: [
617
+ { type: "icon", name: "x-circle", size: "lg" },
618
+ { type: "typography", content: "Error", variant: "heading" },
619
+ { type: "typography", content: "Failed to save. Please try again.", variant: "body" },
620
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
621
+ { type: "button", label: "Retry", event: "RETRY", variant: "primary", icon: "refresh-cw" },
622
+ { type: "button", label: "Reset", event: "RESET", variant: "secondary" }
623
+ ] }
624
+ ]
625
+ }]
471
626
  ]
472
627
  },
473
628
  {
474
- from: "Submitting",
475
- to: "Error",
476
- event: "SUBMIT_ERROR",
629
+ from: "error",
630
+ to: "editing",
631
+ event: "RETRY",
477
632
  effects: [
478
- ["set", "@entity.isSubmitting", false],
479
- ["set", "@entity.errors", { _form: "@payload.error" }],
480
- ["notify", "in_app", "@payload.error"]
633
+ ["fetch", "FormEntry"],
634
+ FORM_EDITING_VIEW
481
635
  ]
482
636
  },
483
637
  {
484
- from: "Editing",
485
- to: "Idle",
638
+ from: "success",
639
+ to: "idle",
486
640
  event: "RESET",
487
- effects: [
488
- ["set", "@entity.values", {}],
489
- ["set", "@entity.errors", {}],
490
- ["set", "@entity.touched", {}],
491
- ["set", "@entity.isDirty", false]
492
- ]
641
+ effects: []
493
642
  },
494
643
  {
495
- from: "Error",
496
- to: "Idle",
644
+ from: "error",
645
+ to: "idle",
497
646
  event: "RESET",
498
- effects: [
499
- ["set", "@entity.values", {}],
500
- ["set", "@entity.errors", {}],
501
- ["set", "@entity.touched", {}],
502
- ["set", "@entity.isDirty", false]
503
- ]
647
+ effects: []
504
648
  }
505
649
  ]
506
650
  }
507
651
  }
508
652
  ],
509
- pages: []
653
+ pages: [
654
+ {
655
+ name: "FormPage",
656
+ path: "/entries/new",
657
+ isInitial: true,
658
+ traits: [{ ref: "FormFlow" }]
659
+ }
660
+ ]
510
661
  }
511
662
  ]
512
663
  };
@@ -514,120 +665,210 @@ var MODAL_BEHAVIOR = {
514
665
  name: "std-modal",
515
666
  version: "1.0.0",
516
667
  description: "Modal dialog with open/close state management",
668
+ theme: UI_SLATE_THEME,
517
669
  orbitals: [
518
670
  {
519
671
  name: "ModalOrbital",
520
672
  entity: {
521
- name: "ModalState",
673
+ name: "ModalContent",
522
674
  persistence: "runtime",
675
+ collection: "modals",
523
676
  fields: [
524
677
  { name: "id", type: "string", required: true },
525
- { name: "content", type: "object", default: null }
678
+ { name: "title", type: "string", default: "" },
679
+ { name: "message", type: "string", default: "" }
526
680
  ]
527
681
  },
528
682
  traits: [
529
683
  {
530
- name: "Modal",
531
- linkedEntity: "ModalState",
684
+ name: "ModalControl",
685
+ linkedEntity: "ModalContent",
532
686
  category: "interaction",
533
687
  stateMachine: {
534
688
  states: [
535
- { name: "Closed", isInitial: true },
536
- { name: "Open" }
689
+ { name: "closed", isInitial: true },
690
+ { name: "open" }
537
691
  ],
538
692
  events: [
693
+ { key: "INIT", name: "Initialize" },
539
694
  { key: "OPEN", name: "Open" },
540
695
  { key: "CLOSE", name: "Close" },
696
+ { key: "CANCEL", name: "Cancel" },
541
697
  { key: "CONFIRM", name: "Confirm" }
542
698
  ],
543
699
  transitions: [
544
700
  {
545
- from: "Closed",
546
- to: "Open",
701
+ from: "closed",
702
+ to: "closed",
703
+ event: "INIT",
704
+ effects: [
705
+ ["render-ui", "main", {
706
+ type: "stack",
707
+ direction: "vertical",
708
+ gap: "md",
709
+ children: [
710
+ { type: "icon", name: "message-square", size: "lg" },
711
+ { type: "typography", content: "Ready", variant: "heading" },
712
+ { type: "typography", content: "Click to open dialog.", variant: "body" },
713
+ { type: "button", label: "Open Dialog", event: "OPEN", variant: "primary", icon: "external-link" }
714
+ ]
715
+ }]
716
+ ]
717
+ },
718
+ {
719
+ from: "closed",
720
+ to: "open",
547
721
  event: "OPEN",
548
722
  effects: [
549
- ["set", "@entity.content", "@payload.content"],
550
723
  ["render-ui", "modal", {
551
- type: "modal",
552
- isOpen: true,
553
- onClose: "CLOSE"
724
+ type: "stack",
725
+ direction: "vertical",
726
+ gap: "md",
727
+ children: [
728
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
729
+ { type: "icon", name: "help-circle", size: "md" },
730
+ { type: "typography", content: "@entity.title", variant: "heading" }
731
+ ] },
732
+ { type: "divider" },
733
+ { type: "typography", content: "@entity.message", variant: "body" },
734
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
735
+ { type: "button", label: "Confirm", event: "CONFIRM", variant: "primary", icon: "check" },
736
+ { type: "button", label: "Cancel", event: "CANCEL", variant: "secondary" }
737
+ ] }
738
+ ]
554
739
  }]
555
740
  ]
556
741
  },
557
742
  {
558
- from: "Open",
559
- to: "Closed",
743
+ from: "open",
744
+ to: "closed",
560
745
  event: "CLOSE",
561
- effects: []
746
+ effects: [["render-ui", "modal", null]]
562
747
  },
563
748
  {
564
- from: "Open",
565
- to: "Closed",
749
+ from: "open",
750
+ to: "closed",
751
+ event: "CANCEL",
752
+ effects: [["render-ui", "modal", null]]
753
+ },
754
+ {
755
+ from: "open",
756
+ to: "closed",
566
757
  event: "CONFIRM",
567
- effects: []
758
+ effects: [["render-ui", "modal", null]]
568
759
  }
569
760
  ]
570
761
  }
571
762
  }
572
763
  ],
573
- pages: []
764
+ pages: [
765
+ {
766
+ name: "ModalDemoPage",
767
+ path: "/modal",
768
+ isInitial: true,
769
+ traits: [{ ref: "ModalControl" }]
770
+ }
771
+ ]
574
772
  }
575
773
  ]
576
774
  };
577
775
  var DRAWER_BEHAVIOR = {
578
776
  name: "std-drawer",
579
777
  version: "1.0.0",
580
- description: "Side drawer panel for detail views and forms",
778
+ description: "Side drawer panel for detail views",
779
+ theme: UI_SLATE_THEME,
581
780
  orbitals: [
582
781
  {
583
782
  name: "DrawerOrbital",
584
783
  entity: {
585
- name: "DrawerState",
784
+ name: "DrawerItem",
586
785
  persistence: "runtime",
786
+ collection: "draweritems",
587
787
  fields: [
588
788
  { name: "id", type: "string", required: true },
589
- { name: "content", type: "object", default: null }
789
+ { name: "title", type: "string", default: "" }
590
790
  ]
591
791
  },
592
792
  traits: [
593
793
  {
594
- name: "Drawer",
595
- linkedEntity: "DrawerState",
794
+ name: "DrawerControl",
795
+ linkedEntity: "DrawerItem",
596
796
  category: "interaction",
597
797
  stateMachine: {
598
798
  states: [
599
- { name: "Closed", isInitial: true },
600
- { name: "Open" }
799
+ { name: "closed", isInitial: true },
800
+ { name: "open" }
601
801
  ],
602
802
  events: [
803
+ { key: "INIT", name: "Initialize" },
603
804
  { key: "OPEN", name: "Open" },
604
- { key: "CLOSE", name: "Close" }
805
+ { key: "CLOSE", name: "Close" },
806
+ { key: "CANCEL", name: "Cancel" }
605
807
  ],
606
808
  transitions: [
607
809
  {
608
- from: "Closed",
609
- to: "Open",
810
+ from: "closed",
811
+ to: "closed",
812
+ event: "INIT",
813
+ effects: [
814
+ ["render-ui", "main", {
815
+ type: "stack",
816
+ direction: "vertical",
817
+ gap: "md",
818
+ children: [
819
+ { type: "icon", name: "sidebar", size: "lg" },
820
+ { type: "typography", content: "Drawer", variant: "heading" },
821
+ { type: "typography", content: "Select an item to open the drawer.", variant: "body" }
822
+ ]
823
+ }]
824
+ ]
825
+ },
826
+ {
827
+ from: "closed",
828
+ to: "open",
610
829
  event: "OPEN",
611
830
  effects: [
612
- ["set", "@entity.content", "@payload.content"],
613
- ["render-ui", "drawer", {
614
- type: "drawer",
615
- isOpen: true,
616
- onClose: "CLOSE"
831
+ ["fetch", "DrawerItem"],
832
+ ["render-ui", "modal", {
833
+ type: "stack",
834
+ direction: "vertical",
835
+ gap: "md",
836
+ children: [
837
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
838
+ { type: "icon", name: "info", size: "md" },
839
+ { type: "typography", content: "@entity.title", variant: "heading" }
840
+ ] },
841
+ { type: "divider" },
842
+ { type: "data-list", entity: "DrawerItem", fields: ["title"] },
843
+ { type: "button", label: "Close", event: "CLOSE", variant: "secondary", icon: "x" }
844
+ ]
617
845
  }]
618
846
  ]
619
847
  },
620
848
  {
621
- from: "Open",
622
- to: "Closed",
849
+ from: "open",
850
+ to: "closed",
623
851
  event: "CLOSE",
624
- effects: []
852
+ effects: [["render-ui", "modal", null]]
853
+ },
854
+ {
855
+ from: "open",
856
+ to: "closed",
857
+ event: "CANCEL",
858
+ effects: [["render-ui", "modal", null]]
625
859
  }
626
860
  ]
627
861
  }
628
862
  }
629
863
  ],
630
- pages: []
864
+ pages: [
865
+ {
866
+ name: "DrawerDemoPage",
867
+ path: "/drawer",
868
+ isInitial: true,
869
+ traits: [{ ref: "DrawerControl" }]
870
+ }
871
+ ]
631
872
  }
632
873
  ]
633
874
  };
@@ -635,373 +876,542 @@ var TABS_BEHAVIOR = {
635
876
  name: "std-tabs",
636
877
  version: "1.0.0",
637
878
  description: "Tabbed navigation within a page",
879
+ theme: UI_SLATE_THEME,
638
880
  orbitals: [
639
881
  {
640
882
  name: "TabsOrbital",
641
883
  entity: {
642
- name: "TabsState",
884
+ name: "TabContent",
643
885
  persistence: "runtime",
886
+ collection: "tabcontents",
644
887
  fields: [
645
888
  { name: "id", type: "string", required: true },
646
- { name: "activeTab", type: "string", default: null },
647
- { name: "tabs", type: "array", default: [] },
648
- { name: "defaultTab", type: "string", default: null }
889
+ { name: "activeTab", type: "string", default: "overview" }
649
890
  ]
650
891
  },
651
892
  traits: [
652
893
  {
653
- name: "Tabs",
654
- linkedEntity: "TabsState",
894
+ name: "TabNavigation",
895
+ linkedEntity: "TabContent",
655
896
  category: "interaction",
656
897
  stateMachine: {
657
- states: [{ name: "Active", isInitial: true }],
898
+ states: [{ name: "active", isInitial: true }],
658
899
  events: [
659
900
  { key: "INIT", name: "Initialize" },
660
- { key: "SELECT_TAB", name: "Select Tab" }
901
+ { key: "SELECT_TAB", name: "Select Tab", payloadSchema: [{ name: "tabId", type: "string", required: true }] }
661
902
  ],
662
903
  transitions: [
663
904
  {
664
- from: "Active",
665
- to: "Active",
905
+ from: "active",
906
+ to: "active",
666
907
  event: "INIT",
667
908
  effects: [
668
- ["set", "@entity.activeTab", "@entity.defaultTab"],
909
+ ["fetch", "TabContent"],
669
910
  ["render-ui", "main", {
670
- type: "tabs",
671
- tabs: "@entity.tabs",
672
- activeTab: "@entity.activeTab",
673
- onTabChange: "SELECT_TAB"
911
+ type: "stack",
912
+ direction: "vertical",
913
+ gap: "lg",
914
+ children: [
915
+ { type: "stack", direction: "horizontal", gap: "md", children: [
916
+ { type: "icon", name: "layers", size: "lg" },
917
+ { type: "typography", content: "Tabs", variant: "h2" },
918
+ { type: "button", label: "Add Tab", action: "SELECT_TAB", icon: "plus", variant: "primary" }
919
+ ] },
920
+ { type: "divider" },
921
+ {
922
+ type: "tabs",
923
+ entity: "TabContent",
924
+ onTabChange: "SELECT_TAB",
925
+ tabs: [
926
+ { id: "overview", label: "Overview" },
927
+ { id: "details", label: "Details" },
928
+ { id: "settings", label: "Settings" }
929
+ ]
930
+ }
931
+ ]
674
932
  }]
675
933
  ]
676
934
  },
677
935
  {
678
- from: "Active",
679
- to: "Active",
936
+ from: "active",
937
+ to: "active",
680
938
  event: "SELECT_TAB",
681
- effects: [["set", "@entity.activeTab", "@payload.tabId"]]
939
+ effects: [
940
+ ["set", "@entity.activeTab", "@payload.tabId"]
941
+ ]
682
942
  }
683
943
  ]
684
944
  }
685
945
  }
686
946
  ],
687
- pages: []
947
+ pages: [
948
+ {
949
+ name: "TabsPage",
950
+ path: "/tabs",
951
+ isInitial: true,
952
+ traits: [{ ref: "TabNavigation" }]
953
+ }
954
+ ]
688
955
  }
689
956
  ]
690
957
  };
958
+ var WIZARD_STEPS = ["Basic Info", "Details", "Review"];
959
+ var WIZARD_STEP1_VIEW = ["render-ui", "main", {
960
+ type: "stack",
961
+ direction: "vertical",
962
+ gap: "lg",
963
+ children: [
964
+ { type: "stack", direction: "horizontal", gap: "md", children: [
965
+ { type: "icon", name: "clipboard", size: "lg" },
966
+ { type: "typography", content: "Setup Wizard", variant: "heading" },
967
+ { type: "badge", label: "Step 1 of 3", variant: "outline" }
968
+ ] },
969
+ { type: "wizard-progress", steps: WIZARD_STEPS, currentStep: 0 },
970
+ { type: "divider" },
971
+ { type: "form-section", entity: "WizardEntry", submitEvent: "NEXT" }
972
+ ]
973
+ }];
974
+ var WIZARD_STEP2_VIEW = ["render-ui", "main", {
975
+ type: "stack",
976
+ direction: "vertical",
977
+ gap: "lg",
978
+ children: [
979
+ { type: "stack", direction: "horizontal", gap: "md", children: [
980
+ { type: "icon", name: "clipboard", size: "lg" },
981
+ { type: "typography", content: "Setup Wizard", variant: "heading" },
982
+ { type: "badge", label: "Step 2 of 3", variant: "outline" }
983
+ ] },
984
+ { type: "wizard-progress", steps: WIZARD_STEPS, currentStep: 1 },
985
+ { type: "divider" },
986
+ { type: "form-section", entity: "WizardEntry", submitEvent: "NEXT", cancelEvent: "PREV" }
987
+ ]
988
+ }];
989
+ var WIZARD_REVIEW_VIEW = ["render-ui", "main", {
990
+ type: "stack",
991
+ direction: "vertical",
992
+ gap: "lg",
993
+ children: [
994
+ { type: "stack", direction: "horizontal", gap: "md", children: [
995
+ { type: "icon", name: "clipboard", size: "lg" },
996
+ { type: "typography", content: "Setup Wizard", variant: "heading" },
997
+ { type: "badge", label: "Step 3 of 3", variant: "outline" }
998
+ ] },
999
+ { type: "wizard-progress", steps: WIZARD_STEPS, currentStep: 2 },
1000
+ { type: "divider" },
1001
+ { type: "data-list", entity: "WizardEntry", fields: ["name", "category", "details", "status"] },
1002
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
1003
+ { type: "button", label: "Back", event: "PREV", variant: "secondary", icon: "arrow-left" },
1004
+ { type: "button", label: "Complete", event: "COMPLETE", variant: "primary", icon: "check" }
1005
+ ] }
1006
+ ]
1007
+ }];
691
1008
  var WIZARD_BEHAVIOR = {
692
1009
  name: "std-wizard",
693
1010
  version: "1.0.0",
694
- description: "Multi-step wizard flow - each step is a state",
1011
+ description: "Multi-step wizard flow",
1012
+ theme: UI_SLATE_THEME,
695
1013
  orbitals: [
696
1014
  {
697
1015
  name: "WizardOrbital",
698
1016
  entity: {
699
- name: "WizardState",
700
- persistence: "runtime",
1017
+ name: "WizardEntry",
1018
+ persistence: "persistent",
1019
+ collection: "wizardentries",
701
1020
  fields: [
702
1021
  { name: "id", type: "string", required: true },
703
- { name: "stepData", type: "object", default: {} },
704
- { name: "entityType", type: "string", default: "" },
705
- { name: "step1Fields", type: "array", default: [] },
706
- { name: "step2Fields", type: "array", default: [] },
707
- { name: "completionUrl", type: "string", default: "/" }
1022
+ { name: "name", type: "string", default: "" },
1023
+ { name: "category", type: "string", default: "" },
1024
+ { name: "details", type: "string", default: "" },
1025
+ { name: "status", type: "string", default: "draft" }
708
1026
  ]
709
1027
  },
710
1028
  traits: [
711
1029
  {
712
- name: "Wizard",
713
- linkedEntity: "WizardState",
1030
+ name: "WizardFlow",
1031
+ linkedEntity: "WizardEntry",
714
1032
  category: "interaction",
1033
+ // When composed: emits: [{ event: 'WIZARD_COMPLETED', ... }]
715
1034
  stateMachine: {
716
1035
  states: [
717
- { name: "Step1", isInitial: true },
718
- { name: "Step2" },
719
- { name: "Step3" },
720
- { name: "Complete", isTerminal: true }
1036
+ { name: "step1", isInitial: true },
1037
+ { name: "step2" },
1038
+ { name: "review" },
1039
+ { name: "complete" }
721
1040
  ],
722
1041
  events: [
723
1042
  { key: "INIT", name: "Initialize" },
724
- { key: "NEXT", name: "Next" },
1043
+ { key: "NEXT", name: "Next", payloadSchema: [{ name: "data", type: "object", required: true }] },
725
1044
  { key: "PREV", name: "Previous" },
726
1045
  { key: "COMPLETE", name: "Complete" }
727
1046
  ],
728
1047
  transitions: [
729
1048
  {
730
- from: "Step1",
731
- to: "Step1",
1049
+ from: "step1",
1050
+ to: "step1",
732
1051
  event: "INIT",
733
1052
  effects: [
734
- ["render-ui", "main", {
735
- type: "wizard-progress",
736
- steps: ["Step 1", "Step 2", "Step 3"],
737
- currentStep: 0
738
- }],
739
- ["render-ui", "main", {
740
- type: "form-section",
741
- entity: "@entity.entityType",
742
- fields: "@entity.step1Fields",
743
- onSubmit: "NEXT"
744
- }]
1053
+ ["fetch", "WizardEntry"],
1054
+ WIZARD_STEP1_VIEW
745
1055
  ]
746
1056
  },
747
1057
  {
748
- from: "Step1",
749
- to: "Step2",
1058
+ from: "step1",
1059
+ to: "step2",
750
1060
  event: "NEXT",
751
1061
  effects: [
752
- ["set", "@entity.stepData.step1", "@payload"],
753
- ["render-ui", "main", {
754
- type: "wizard-progress",
755
- steps: ["Step 1", "Step 2", "Step 3"],
756
- currentStep: 1
757
- }],
758
- ["render-ui", "main", {
759
- type: "form-section",
760
- entity: "@entity.entityType",
761
- fields: "@entity.step2Fields",
762
- onSubmit: "NEXT",
763
- onCancel: "PREV"
764
- }]
1062
+ ["fetch", "WizardEntry"],
1063
+ WIZARD_STEP2_VIEW
765
1064
  ]
766
1065
  },
767
1066
  {
768
- from: "Step2",
769
- to: "Step1",
1067
+ from: "step2",
1068
+ to: "step1",
770
1069
  event: "PREV",
771
- effects: [["emit", "INIT"]]
1070
+ effects: [
1071
+ ["fetch", "WizardEntry"],
1072
+ WIZARD_STEP1_VIEW
1073
+ ]
772
1074
  },
773
1075
  {
774
- from: "Step2",
775
- to: "Step3",
1076
+ from: "step2",
1077
+ to: "review",
776
1078
  event: "NEXT",
777
1079
  effects: [
778
- ["set", "@entity.stepData.step2", "@payload"],
779
- ["render-ui", "main", {
780
- type: "wizard-progress",
781
- steps: ["Step 1", "Step 2", "Step 3"],
782
- currentStep: 2
783
- }],
784
- ["render-ui", "main", {
785
- type: "detail-panel",
786
- entity: "@entity.entityType",
787
- fieldNames: ["step1", "step2"],
788
- title: "Review"
789
- }]
1080
+ ["fetch", "WizardEntry"],
1081
+ WIZARD_REVIEW_VIEW
790
1082
  ]
791
1083
  },
792
1084
  {
793
- from: "Step3",
794
- to: "Step2",
1085
+ from: "review",
1086
+ to: "step2",
795
1087
  event: "PREV",
796
- effects: []
1088
+ effects: [
1089
+ ["fetch", "WizardEntry"],
1090
+ WIZARD_STEP2_VIEW
1091
+ ]
797
1092
  },
798
1093
  {
799
- from: "Step3",
800
- to: "Complete",
1094
+ from: "review",
1095
+ to: "complete",
801
1096
  event: "COMPLETE",
802
1097
  effects: [
803
- ["persist", "create", "@entity.entityType", "@entity.stepData"],
804
- ["notify", "in_app", "Wizard completed!"],
805
- ["navigate", "@entity.completionUrl"]
1098
+ ["persist", "create", "WizardEntry", {}],
1099
+ ["render-ui", "main", {
1100
+ type: "stack",
1101
+ direction: "vertical",
1102
+ gap: "md",
1103
+ children: [
1104
+ { type: "icon", name: "check-circle", size: "lg" },
1105
+ { type: "typography", content: "Complete", variant: "heading" },
1106
+ { type: "typography", content: "Your entry has been submitted.", variant: "body" },
1107
+ { type: "button", label: "Start New", event: "INIT", variant: "primary", icon: "plus" }
1108
+ ]
1109
+ }]
1110
+ ]
1111
+ },
1112
+ {
1113
+ from: "complete",
1114
+ to: "step1",
1115
+ event: "INIT",
1116
+ effects: [
1117
+ ["fetch", "WizardEntry"],
1118
+ WIZARD_STEP1_VIEW
806
1119
  ]
807
1120
  }
808
1121
  ]
809
1122
  }
810
1123
  }
811
1124
  ],
812
- pages: []
1125
+ pages: [
1126
+ {
1127
+ name: "WizardPage",
1128
+ path: "/wizard",
1129
+ isInitial: true,
1130
+ traits: [{ ref: "WizardFlow" }]
1131
+ }
1132
+ ]
813
1133
  }
814
1134
  ]
815
1135
  };
1136
+ var MASTER_LIST_VIEW = ["render-ui", "main", {
1137
+ type: "stack",
1138
+ direction: "horizontal",
1139
+ gap: "lg",
1140
+ children: [
1141
+ { type: "stack", direction: "vertical", gap: "md", children: [
1142
+ { type: "stack", direction: "horizontal", gap: "md", children: [
1143
+ { type: "icon", name: "layout", size: "lg" },
1144
+ { type: "typography", content: "Assets", variant: "h2" }
1145
+ ] },
1146
+ { type: "data-list", entity: "Asset", fields: ["name", "type", "description"], itemActions: [{ label: "View", event: "SELECT" }] }
1147
+ ] },
1148
+ { type: "divider" },
1149
+ { type: "stack", direction: "vertical", gap: "md", align: "center", children: [
1150
+ { type: "icon", name: "file-text", size: "xl" },
1151
+ { type: "typography", content: "Select an item to view details", variant: "body" }
1152
+ ] }
1153
+ ]
1154
+ }];
1155
+ var MASTER_DETAIL_SELECTED_VIEW = ["render-ui", "main", {
1156
+ type: "stack",
1157
+ direction: "horizontal",
1158
+ gap: "lg",
1159
+ children: [
1160
+ { type: "stack", direction: "vertical", gap: "md", children: [
1161
+ { type: "stack", direction: "horizontal", gap: "md", children: [
1162
+ { type: "icon", name: "layout", size: "lg" },
1163
+ { type: "typography", content: "Assets", variant: "h2" }
1164
+ ] },
1165
+ { type: "data-list", entity: "Asset", fields: ["name", "type"], itemActions: [{ label: "View", event: "SELECT" }] }
1166
+ ] },
1167
+ { type: "divider" },
1168
+ { type: "stack", direction: "vertical", gap: "md", children: [
1169
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
1170
+ { type: "icon", name: "file-text", size: "md" },
1171
+ { type: "typography", content: "@entity.name", variant: "h3" },
1172
+ { type: "badge", label: "@entity.type", variant: "outline" }
1173
+ ] },
1174
+ { type: "stack", direction: "horizontal", gap: "md", children: [
1175
+ { type: "stat-card", label: "Name", value: "@entity.name", icon: "tag" },
1176
+ { type: "stat-card", label: "Type", value: "@entity.type", icon: "folder" }
1177
+ ] },
1178
+ { type: "data-list", entity: "Asset", fields: ["name", "type", "description"] },
1179
+ { type: "button", label: "Back", action: "DESELECT", variant: "secondary", icon: "arrow-left" }
1180
+ ] }
1181
+ ]
1182
+ }];
816
1183
  var MASTER_DETAIL_BEHAVIOR = {
817
1184
  name: "std-masterdetail",
818
1185
  version: "1.0.0",
819
1186
  description: "Master-detail layout with synchronized list and detail views",
1187
+ theme: UI_SLATE_THEME,
820
1188
  orbitals: [
821
1189
  {
822
1190
  name: "MasterDetailOrbital",
823
1191
  entity: {
824
- name: "MasterDetailState",
825
- persistence: "runtime",
1192
+ name: "Asset",
1193
+ persistence: "persistent",
1194
+ collection: "assets",
826
1195
  fields: [
827
1196
  { name: "id", type: "string", required: true },
828
- { name: "selectedId", type: "string", default: null },
829
- { name: "entityType", type: "string", default: "" },
830
- { name: "masterColumns", type: "array", default: [] },
831
- { name: "detailFields", type: "array", default: [] }
1197
+ { name: "name", type: "string", default: "" },
1198
+ { name: "type", type: "string", default: "" },
1199
+ { name: "description", type: "string", default: "" }
832
1200
  ]
833
1201
  },
834
1202
  traits: [
835
1203
  {
836
- name: "MasterDetail",
837
- linkedEntity: "MasterDetailState",
1204
+ name: "MasterDetailNav",
1205
+ linkedEntity: "Asset",
838
1206
  category: "interaction",
839
1207
  stateMachine: {
840
1208
  states: [
841
- { name: "NoSelection", isInitial: true },
842
- { name: "Selected" }
1209
+ { name: "browsing", isInitial: true },
1210
+ { name: "selected" }
843
1211
  ],
844
1212
  events: [
845
1213
  { key: "INIT", name: "Initialize" },
846
- { key: "SELECT", name: "Select" },
1214
+ { key: "SELECT", name: "Select", payloadSchema: [{ name: "id", type: "string", required: true }] },
847
1215
  { key: "DESELECT", name: "Deselect" }
848
1216
  ],
849
1217
  transitions: [
850
1218
  {
851
- from: "NoSelection",
852
- to: "NoSelection",
1219
+ from: "browsing",
1220
+ to: "browsing",
853
1221
  event: "INIT",
854
1222
  effects: [
855
- ["render-ui", "main", {
856
- type: "master-detail",
857
- master: "@entity.entityType",
858
- detail: "@entity.selectedId",
859
- hasSelection: "@entity.hasSelection"
860
- }],
861
- ["render-ui", "main", {
862
- type: "empty-state",
863
- message: "Select an item to view details"
864
- }]
1223
+ ["fetch", "Asset"],
1224
+ MASTER_LIST_VIEW
865
1225
  ]
866
1226
  },
867
1227
  {
868
- from: "NoSelection",
869
- to: "Selected",
1228
+ from: "browsing",
1229
+ to: "selected",
870
1230
  event: "SELECT",
871
1231
  effects: [
872
- ["set", "@entity.selectedId", "@payload.id"],
873
- ["render-ui", "main", {
874
- type: "detail-panel",
875
- entity: "@entity.entityType",
876
- data: "@payload.id",
877
- fieldNames: "@entity.detailFields"
878
- }]
1232
+ ["fetch", "Asset"],
1233
+ MASTER_DETAIL_SELECTED_VIEW
879
1234
  ]
880
1235
  },
881
1236
  {
882
- from: "Selected",
883
- to: "Selected",
1237
+ from: "selected",
1238
+ to: "selected",
884
1239
  event: "SELECT",
885
1240
  effects: [
886
- ["set", "@entity.selectedId", "@payload.id"],
887
- ["render-ui", "main", {
888
- type: "detail-panel",
889
- entity: "@entity.entityType",
890
- data: "@payload.id",
891
- fieldNames: "@entity.detailFields"
892
- }]
1241
+ ["fetch", "Asset"],
1242
+ MASTER_DETAIL_SELECTED_VIEW
893
1243
  ]
894
1244
  },
895
1245
  {
896
- from: "Selected",
897
- to: "NoSelection",
1246
+ from: "selected",
1247
+ to: "browsing",
898
1248
  event: "DESELECT",
899
1249
  effects: [
900
- ["set", "@entity.selectedId", null],
901
- ["render-ui", "main", {
902
- type: "empty-state",
903
- message: "Select an item to view details"
904
- }]
1250
+ ["fetch", "Asset"],
1251
+ MASTER_LIST_VIEW
905
1252
  ]
906
1253
  }
907
1254
  ]
908
1255
  }
909
1256
  }
910
1257
  ],
911
- pages: []
1258
+ pages: [
1259
+ {
1260
+ name: "AssetsPage",
1261
+ path: "/assets",
1262
+ isInitial: true,
1263
+ traits: [{ ref: "MasterDetailNav" }]
1264
+ }
1265
+ ]
912
1266
  }
913
1267
  ]
914
1268
  };
1269
+ var FILTER_DEFAULT_VIEW = ["render-ui", "main", {
1270
+ type: "stack",
1271
+ direction: "vertical",
1272
+ gap: "lg",
1273
+ children: [
1274
+ { type: "stack", direction: "horizontal", gap: "md", children: [
1275
+ { type: "icon", name: "search", size: "lg" },
1276
+ { type: "typography", content: "Items", variant: "heading" }
1277
+ ] },
1278
+ { type: "search-input", placeholder: "Search items...", event: "SEARCH" },
1279
+ { type: "divider" },
1280
+ { type: "data-grid", entity: "FilterableItem", columns: ["name", "category", "status"], itemActions: [
1281
+ { label: "Refresh", event: "INIT" }
1282
+ ] }
1283
+ ]
1284
+ }];
1285
+ var FILTER_ACTIVE_VIEW = ["render-ui", "main", {
1286
+ type: "stack",
1287
+ direction: "vertical",
1288
+ gap: "lg",
1289
+ children: [
1290
+ { type: "stack", direction: "horizontal", gap: "md", children: [
1291
+ { type: "icon", name: "filter", size: "lg" },
1292
+ { type: "typography", content: "Items", variant: "heading" },
1293
+ { type: "badge", label: "Filtered", variant: "outline" },
1294
+ { type: "button", label: "Clear", event: "CLEAR_FILTERS", variant: "secondary", icon: "x" }
1295
+ ] },
1296
+ { type: "search-input", placeholder: "Search items...", event: "SEARCH" },
1297
+ { type: "divider" },
1298
+ { type: "data-grid", entity: "FilterableItem", columns: ["name", "category", "status"], itemActions: [
1299
+ { label: "View", event: "VIEW" }
1300
+ ] }
1301
+ ]
1302
+ }];
915
1303
  var FILTER_BEHAVIOR = {
916
1304
  name: "std-filter-ui",
917
1305
  version: "1.0.0",
918
1306
  description: "Filter and search management for lists",
1307
+ theme: UI_SLATE_THEME,
919
1308
  orbitals: [
920
1309
  {
921
1310
  name: "FilterOrbital",
922
1311
  entity: {
923
- name: "FilterState",
924
- persistence: "runtime",
1312
+ name: "FilterableItem",
1313
+ persistence: "persistent",
1314
+ collection: "filterableitems",
925
1315
  fields: [
926
1316
  { name: "id", type: "string", required: true },
927
- { name: "filters", type: "object", default: {} },
928
- { name: "searchTerm", type: "string", default: "" },
929
- { name: "filterConfig", type: "array", default: [] }
1317
+ { name: "name", type: "string", default: "" },
1318
+ { name: "category", type: "string", default: "" },
1319
+ { name: "status", type: "string", default: "active" }
930
1320
  ]
931
1321
  },
932
1322
  traits: [
933
1323
  {
934
- name: "Filter",
935
- linkedEntity: "FilterState",
1324
+ name: "FilterControl",
1325
+ linkedEntity: "FilterableItem",
936
1326
  category: "interaction",
937
1327
  stateMachine: {
938
1328
  states: [
939
- { name: "Idle", isInitial: true },
940
- { name: "Filtering" }
1329
+ { name: "idle", isInitial: true },
1330
+ { name: "filtering" }
941
1331
  ],
942
1332
  events: [
943
1333
  { key: "INIT", name: "Initialize" },
944
- { key: "SET_FILTER", name: "Set Filter" },
1334
+ { key: "SET_FILTER", name: "Set Filter", payloadSchema: [{ name: "field", type: "string", required: true }, { name: "value", type: "string", required: true }] },
945
1335
  { key: "CLEAR_FILTERS", name: "Clear Filters" },
946
- { key: "SEARCH", name: "Search" }
1336
+ { key: "SEARCH", name: "Search", payloadSchema: [{ name: "term", type: "string", required: true }] },
1337
+ { key: "VIEW", name: "View", payloadSchema: [{ name: "id", type: "string", required: true }] }
947
1338
  ],
948
1339
  transitions: [
949
1340
  {
950
- from: "Idle",
951
- to: "Idle",
1341
+ from: "idle",
1342
+ to: "idle",
952
1343
  event: "INIT",
953
1344
  effects: [
954
- ["render-ui", "main", {
955
- type: "filter-group",
956
- entity: "@entity.entityType",
957
- filters: "@entity.filterConfig",
958
- onFilterChange: "SET_FILTER",
959
- onClearAll: "CLEAR_FILTERS"
960
- }]
1345
+ ["fetch", "FilterableItem"],
1346
+ FILTER_DEFAULT_VIEW
961
1347
  ]
962
1348
  },
963
1349
  {
964
- from: "Idle",
965
- to: "Filtering",
1350
+ from: "idle",
1351
+ to: "filtering",
966
1352
  event: "SET_FILTER",
967
1353
  effects: [
968
- ["set", "@entity.filters", ["object/set", "@entity.filters", "@payload.field", "@payload.value"]],
969
- ["emit", "FILTER_CHANGED", "@entity.filters"]
1354
+ ["fetch", "FilterableItem"],
1355
+ FILTER_ACTIVE_VIEW
970
1356
  ]
971
1357
  },
972
1358
  {
973
- from: "Filtering",
974
- to: "Idle",
1359
+ from: "filtering",
1360
+ to: "filtering",
975
1361
  event: "SET_FILTER",
976
1362
  effects: [
977
- ["set", "@entity.filters", ["object/set", "@entity.filters", "@payload.field", "@payload.value"]],
978
- ["emit", "FILTER_CHANGED", "@entity.filters"]
1363
+ ["fetch", "FilterableItem"],
1364
+ FILTER_ACTIVE_VIEW
979
1365
  ]
980
1366
  },
981
1367
  {
982
- from: "Filtering",
983
- to: "Idle",
1368
+ from: "filtering",
1369
+ to: "idle",
984
1370
  event: "CLEAR_FILTERS",
985
1371
  effects: [
986
- ["set", "@entity.filters", {}],
987
- ["set", "@entity.searchTerm", ""],
988
- ["emit", "FILTER_CHANGED", {}]
1372
+ ["fetch", "FilterableItem"],
1373
+ FILTER_DEFAULT_VIEW
989
1374
  ]
990
1375
  },
991
1376
  {
992
- from: "Idle",
993
- to: "Filtering",
1377
+ from: "idle",
1378
+ to: "filtering",
994
1379
  event: "SEARCH",
995
1380
  effects: [
996
- ["set", "@entity.searchTerm", "@payload.term"],
997
- ["emit", "SEARCH_CHANGED", "@payload.term"]
1381
+ ["fetch", "FilterableItem"],
1382
+ FILTER_ACTIVE_VIEW
1383
+ ]
1384
+ },
1385
+ {
1386
+ from: "filtering",
1387
+ to: "filtering",
1388
+ event: "VIEW",
1389
+ effects: [
1390
+ ["fetch", "FilterableItem"],
1391
+ FILTER_ACTIVE_VIEW
1392
+ ]
1393
+ },
1394
+ {
1395
+ from: "idle",
1396
+ to: "idle",
1397
+ event: "VIEW",
1398
+ effects: [
1399
+ ["fetch", "FilterableItem"],
1400
+ FILTER_DEFAULT_VIEW
998
1401
  ]
999
1402
  }
1000
1403
  ]
1001
1404
  }
1002
1405
  }
1003
1406
  ],
1004
- pages: []
1407
+ pages: [
1408
+ {
1409
+ name: "FilterPage",
1410
+ path: "/filter",
1411
+ isInitial: true,
1412
+ traits: [{ ref: "FilterControl" }]
1413
+ }
1414
+ ]
1005
1415
  }
1006
1416
  ]
1007
1417
  };