@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
@@ -0,0 +1,771 @@
1
+ // behaviors/domain/media.ts
2
+ var MEDIA_THEME = {
3
+ name: "media-fuchsia",
4
+ tokens: {
5
+ colors: {
6
+ primary: "#c026d3",
7
+ "primary-hover": "#a21caf",
8
+ "primary-foreground": "#ffffff",
9
+ accent: "#e879f9",
10
+ "accent-foreground": "#000000",
11
+ success: "#22c55e",
12
+ warning: "#f59e0b",
13
+ error: "#ef4444"
14
+ }
15
+ }
16
+ };
17
+ var galleryBrowsingMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
18
+ // Header: image icon + title + upload button
19
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
20
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
21
+ { type: "icon", name: "image", size: "lg" },
22
+ { type: "typography", variant: "h2", content: "Media Gallery" }
23
+ ] },
24
+ { type: "button", label: "Upload", icon: "upload", variant: "primary", action: "UPLOAD" }
25
+ ] },
26
+ { type: "divider" },
27
+ // Stats row
28
+ { type: "stats", label: "Total Media", icon: "image", entity: "MediaItem" },
29
+ { type: "divider" },
30
+ // Empty state guidance
31
+ { type: "stack", direction: "vertical", gap: "sm", align: "center", children: [
32
+ { type: "icon", name: "image", size: "xl" },
33
+ { type: "typography", variant: "body", content: "Upload your first image to get started" }
34
+ ] },
35
+ // Search
36
+ { type: "search-input", placeholder: "Search media...", icon: "search" },
37
+ // Gallery grid
38
+ {
39
+ type: "data-grid",
40
+ entity: "MediaItem",
41
+ variant: "card",
42
+ columns: 3,
43
+ fields: [
44
+ { name: "title", label: "Title", icon: "film", variant: "h4" },
45
+ { name: "type", label: "Type", icon: "folder", variant: "badge" },
46
+ { name: "createdAt", label: "Added", variant: "caption" }
47
+ ],
48
+ itemActions: [
49
+ { label: "View", event: "VIEW", icon: "eye", variant: "primary" }
50
+ ]
51
+ }
52
+ ] }];
53
+ var GALLERY_BEHAVIOR = {
54
+ name: "std-gallery",
55
+ version: "1.0.0",
56
+ description: "Media gallery with lightbox viewing and upload",
57
+ theme: MEDIA_THEME,
58
+ orbitals: [
59
+ {
60
+ name: "GalleryOrbital",
61
+ entity: {
62
+ name: "MediaItem",
63
+ persistence: "persistent",
64
+ collection: "media_items",
65
+ fields: [
66
+ { name: "id", type: "string", required: true },
67
+ { name: "title", type: "string", default: "" },
68
+ { name: "url", type: "string", default: "" },
69
+ { name: "type", type: "string", default: "image" },
70
+ { name: "thumbnailUrl", type: "string", default: "" },
71
+ { name: "createdAt", type: "string", default: "" }
72
+ ]
73
+ },
74
+ traits: [
75
+ {
76
+ name: "GalleryControl",
77
+ linkedEntity: "MediaItem",
78
+ category: "interaction",
79
+ stateMachine: {
80
+ states: [
81
+ { name: "browsing", isInitial: true },
82
+ { name: "viewing" },
83
+ { name: "uploading" }
84
+ ],
85
+ events: [
86
+ { key: "INIT", name: "Initialize" },
87
+ { key: "VIEW", name: "View Item", payloadSchema: [{ name: "id", type: "string", required: true }] },
88
+ { key: "UPLOAD", name: "Start Upload" },
89
+ { key: "SAVE", name: "Save Upload", payloadSchema: [{ name: "title", type: "string", required: true }, { name: "url", type: "string", required: true }] },
90
+ { key: "CLOSE", name: "Close" },
91
+ { key: "CANCEL", name: "Cancel" }
92
+ ],
93
+ transitions: [
94
+ {
95
+ from: "browsing",
96
+ to: "browsing",
97
+ event: "INIT",
98
+ effects: [
99
+ ["fetch", "MediaItem"],
100
+ galleryBrowsingMainEffect
101
+ ]
102
+ },
103
+ {
104
+ from: "browsing",
105
+ to: "viewing",
106
+ event: "VIEW",
107
+ effects: [
108
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
109
+ // Header with close
110
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
111
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
112
+ { type: "icon", name: "camera", size: "md" },
113
+ { type: "typography", variant: "h3", content: "@entity.title" }
114
+ ] },
115
+ { type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
116
+ ] },
117
+ { type: "divider" },
118
+ // Detail fields
119
+ {
120
+ type: "data-list",
121
+ entity: "MediaItem",
122
+ variant: "detail",
123
+ fields: [
124
+ { name: "title", label: "Title", icon: "film", variant: "h4" },
125
+ { name: "type", label: "Type", icon: "folder", variant: "badge" },
126
+ { name: "url", label: "URL", variant: "body" },
127
+ { name: "createdAt", label: "Created", variant: "caption" }
128
+ ]
129
+ }
130
+ ] }]
131
+ ]
132
+ },
133
+ {
134
+ from: "viewing",
135
+ to: "browsing",
136
+ event: "CLOSE",
137
+ effects: [
138
+ ["render-ui", "modal", null]
139
+ ]
140
+ },
141
+ {
142
+ from: "viewing",
143
+ to: "browsing",
144
+ event: "CANCEL",
145
+ effects: [
146
+ ["render-ui", "modal", null]
147
+ ]
148
+ },
149
+ {
150
+ from: "browsing",
151
+ to: "uploading",
152
+ event: "UPLOAD",
153
+ effects: [
154
+ ["fetch", "MediaItem"],
155
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
156
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
157
+ { type: "icon", name: "upload", size: "md" },
158
+ { type: "typography", variant: "h3", content: "Upload Media" }
159
+ ] },
160
+ { type: "divider" },
161
+ { type: "form-section", entity: "MediaItem", submitEvent: "SAVE", cancelEvent: "CANCEL" }
162
+ ] }]
163
+ ]
164
+ },
165
+ {
166
+ from: "uploading",
167
+ to: "browsing",
168
+ event: "SAVE",
169
+ effects: [
170
+ ["set", "@entity.title", "@payload.title"],
171
+ ["set", "@entity.url", "@payload.url"],
172
+ ["render-ui", "modal", null],
173
+ ["fetch", "MediaItem"],
174
+ galleryBrowsingMainEffect
175
+ ]
176
+ },
177
+ {
178
+ from: "uploading",
179
+ to: "browsing",
180
+ event: "CLOSE",
181
+ effects: [
182
+ ["render-ui", "modal", null]
183
+ ]
184
+ },
185
+ {
186
+ from: "uploading",
187
+ to: "browsing",
188
+ event: "CANCEL",
189
+ effects: [
190
+ ["render-ui", "modal", null]
191
+ ]
192
+ }
193
+ ]
194
+ }
195
+ }
196
+ ],
197
+ pages: [
198
+ {
199
+ name: "GalleryPage",
200
+ path: "/gallery",
201
+ isInitial: true,
202
+ traits: [{ ref: "GalleryControl" }]
203
+ }
204
+ ]
205
+ }
206
+ ]
207
+ };
208
+ var playerIdleMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
209
+ // Header: play icon + title
210
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
211
+ { type: "icon", name: "play", size: "lg" },
212
+ { type: "typography", variant: "h2", content: "Media Player" }
213
+ ] },
214
+ { type: "divider" },
215
+ // Track info card
216
+ { type: "stack", direction: "vertical", gap: "sm", children: [
217
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
218
+ { type: "icon", name: "music", size: "md" },
219
+ { type: "typography", variant: "h3", content: "@entity.title" }
220
+ ] },
221
+ { type: "badge", label: "Stopped", variant: "default" }
222
+ ] },
223
+ { type: "divider" },
224
+ // Volume meter
225
+ { type: "meter", value: 0, label: "Volume", icon: "volume-2" },
226
+ // Controls
227
+ { type: "stack", direction: "horizontal", gap: "md", justify: "center", children: [
228
+ { type: "button", label: "Play", icon: "play", variant: "primary", action: "PLAY" }
229
+ ] }
230
+ ] }];
231
+ var playerPlayingMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
232
+ // Header
233
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
234
+ { type: "icon", name: "play", size: "lg" },
235
+ { type: "typography", variant: "h2", content: "Now Playing" }
236
+ ] },
237
+ { type: "divider" },
238
+ // Track info
239
+ { type: "stack", direction: "vertical", gap: "sm", children: [
240
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
241
+ { type: "icon", name: "music", size: "md" },
242
+ { type: "typography", variant: "h3", content: "@entity.title" }
243
+ ] },
244
+ { type: "badge", label: "Playing", variant: "success" }
245
+ ] },
246
+ { type: "divider" },
247
+ // Playback progress
248
+ { type: "meter", value: "@entity.currentTime", label: "Playback", icon: "clock" },
249
+ // Controls
250
+ { type: "stack", direction: "horizontal", gap: "md", justify: "center", children: [
251
+ { type: "button", label: "Pause", icon: "pause", variant: "secondary", action: "PAUSE" },
252
+ { type: "button", label: "Stop", icon: "square", variant: "ghost", action: "STOP" }
253
+ ] }
254
+ ] }];
255
+ var playerPausedMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
256
+ // Header
257
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
258
+ { type: "icon", name: "pause", size: "lg" },
259
+ { type: "typography", variant: "h2", content: "Paused" }
260
+ ] },
261
+ { type: "divider" },
262
+ // Track info
263
+ { type: "stack", direction: "vertical", gap: "sm", children: [
264
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
265
+ { type: "icon", name: "music", size: "md" },
266
+ { type: "typography", variant: "h3", content: "@entity.title" }
267
+ ] },
268
+ { type: "badge", label: "Paused", variant: "warning" }
269
+ ] },
270
+ { type: "divider" },
271
+ // Playback progress (frozen)
272
+ { type: "meter", value: "@entity.currentTime", label: "Paused", icon: "clock" },
273
+ // Controls
274
+ { type: "stack", direction: "horizontal", gap: "md", justify: "center", children: [
275
+ { type: "button", label: "Resume", icon: "play", variant: "primary", action: "PLAY" },
276
+ { type: "button", label: "Stop", icon: "square", variant: "ghost", action: "STOP" }
277
+ ] }
278
+ ] }];
279
+ var PLAYER_BEHAVIOR = {
280
+ name: "std-player",
281
+ version: "1.0.0",
282
+ description: "Media player with playback controls",
283
+ theme: MEDIA_THEME,
284
+ orbitals: [
285
+ {
286
+ name: "PlayerOrbital",
287
+ entity: {
288
+ name: "PlayerState",
289
+ persistence: "runtime",
290
+ fields: [
291
+ { name: "id", type: "string", required: true },
292
+ { name: "title", type: "string", default: "" },
293
+ { name: "url", type: "string", default: "" },
294
+ { name: "duration", type: "number", default: 0 },
295
+ { name: "currentTime", type: "number", default: 0 },
296
+ { name: "isPlaying", type: "boolean", default: false }
297
+ ]
298
+ },
299
+ traits: [
300
+ {
301
+ name: "PlayerControl",
302
+ linkedEntity: "PlayerState",
303
+ category: "interaction",
304
+ stateMachine: {
305
+ states: [
306
+ { name: "idle", isInitial: true },
307
+ { name: "playing" },
308
+ { name: "paused" }
309
+ ],
310
+ events: [
311
+ { key: "INIT", name: "Initialize" },
312
+ { key: "PLAY", name: "Play" },
313
+ { key: "PAUSE", name: "Pause" },
314
+ { key: "STOP", name: "Stop" }
315
+ ],
316
+ transitions: [
317
+ {
318
+ from: "idle",
319
+ to: "idle",
320
+ event: "INIT",
321
+ effects: [
322
+ ["set", "@entity.currentTime", 0],
323
+ ["set", "@entity.isPlaying", false],
324
+ playerIdleMainEffect
325
+ ]
326
+ },
327
+ {
328
+ from: "idle",
329
+ to: "playing",
330
+ event: "PLAY",
331
+ effects: [
332
+ ["set", "@entity.isPlaying", true],
333
+ playerPlayingMainEffect
334
+ ]
335
+ },
336
+ {
337
+ from: "playing",
338
+ to: "paused",
339
+ event: "PAUSE",
340
+ effects: [
341
+ ["set", "@entity.isPlaying", false],
342
+ playerPausedMainEffect
343
+ ]
344
+ },
345
+ {
346
+ from: "paused",
347
+ to: "playing",
348
+ event: "PLAY",
349
+ effects: [
350
+ ["set", "@entity.isPlaying", true],
351
+ playerPlayingMainEffect
352
+ ]
353
+ },
354
+ {
355
+ from: "playing",
356
+ to: "idle",
357
+ event: "STOP",
358
+ effects: [
359
+ ["set", "@entity.isPlaying", false],
360
+ ["set", "@entity.currentTime", 0],
361
+ playerIdleMainEffect
362
+ ]
363
+ },
364
+ {
365
+ from: "paused",
366
+ to: "idle",
367
+ event: "STOP",
368
+ effects: [
369
+ ["set", "@entity.isPlaying", false],
370
+ ["set", "@entity.currentTime", 0],
371
+ playerIdleMainEffect
372
+ ]
373
+ }
374
+ ]
375
+ }
376
+ }
377
+ ],
378
+ pages: [
379
+ {
380
+ name: "PlayerPage",
381
+ path: "/player",
382
+ isInitial: true,
383
+ traits: [{ ref: "PlayerControl" }]
384
+ }
385
+ ]
386
+ }
387
+ ]
388
+ };
389
+ var playlistBrowsingMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
390
+ // Header: music icon + title
391
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
392
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
393
+ { type: "icon", name: "music", size: "lg" },
394
+ { type: "typography", variant: "h2", content: "Playlist" }
395
+ ] }
396
+ ] },
397
+ { type: "divider" },
398
+ // Playlist stats
399
+ { type: "stats", label: "Tracks", icon: "music", entity: "PlaylistItem" },
400
+ { type: "divider" },
401
+ // Search
402
+ { type: "search-input", placeholder: "Search tracks...", icon: "search" },
403
+ // Track list
404
+ {
405
+ type: "data-list",
406
+ entity: "PlaylistItem",
407
+ variant: "row",
408
+ fields: [
409
+ { name: "title", label: "Title", icon: "music", variant: "h4" },
410
+ { name: "artist", label: "Artist", icon: "user", variant: "body" },
411
+ { name: "duration", label: "Duration", icon: "clock", variant: "badge", format: "duration" },
412
+ { name: "order", label: "#", variant: "caption" }
413
+ ],
414
+ itemActions: [
415
+ { label: "View", event: "VIEW", icon: "eye", variant: "primary" }
416
+ ]
417
+ }
418
+ ] }];
419
+ var PLAYLIST_BEHAVIOR = {
420
+ name: "std-playlist",
421
+ version: "1.0.0",
422
+ description: "Playlist management with track ordering",
423
+ theme: MEDIA_THEME,
424
+ orbitals: [
425
+ {
426
+ name: "PlaylistOrbital",
427
+ entity: {
428
+ name: "PlaylistItem",
429
+ persistence: "persistent",
430
+ collection: "playlist_items",
431
+ fields: [
432
+ { name: "id", type: "string", required: true },
433
+ { name: "title", type: "string", default: "" },
434
+ { name: "artist", type: "string", default: "" },
435
+ { name: "duration", type: "number", default: 0 },
436
+ { name: "order", type: "number", default: 0 }
437
+ ]
438
+ },
439
+ traits: [
440
+ {
441
+ name: "PlaylistControl",
442
+ linkedEntity: "PlaylistItem",
443
+ category: "interaction",
444
+ stateMachine: {
445
+ states: [
446
+ { name: "browsing", isInitial: true },
447
+ { name: "viewing" },
448
+ { name: "editing" }
449
+ ],
450
+ events: [
451
+ { key: "INIT", name: "Initialize" },
452
+ { key: "VIEW", name: "View Track", payloadSchema: [{ name: "id", type: "string", required: true }] },
453
+ { key: "EDIT", name: "Edit Track" },
454
+ { key: "SAVE", name: "Save Track", payloadSchema: [{ name: "title", type: "string", required: true }, { name: "artist", type: "string", required: true }] },
455
+ { key: "BACK", name: "Back to Playlist" }
456
+ ],
457
+ transitions: [
458
+ {
459
+ from: "browsing",
460
+ to: "browsing",
461
+ event: "INIT",
462
+ effects: [
463
+ ["fetch", "PlaylistItem"],
464
+ playlistBrowsingMainEffect
465
+ ]
466
+ },
467
+ {
468
+ from: "browsing",
469
+ to: "viewing",
470
+ event: "VIEW",
471
+ effects: [
472
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
473
+ // Header with back
474
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
475
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
476
+ { type: "icon", name: "music", size: "lg" },
477
+ { type: "typography", variant: "h2", content: "Track Details" }
478
+ ] },
479
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
480
+ { type: "button", label: "Edit", icon: "edit", variant: "primary", action: "EDIT" },
481
+ { type: "button", label: "Back", icon: "arrow-left", variant: "ghost", action: "BACK" }
482
+ ] }
483
+ ] },
484
+ { type: "divider" },
485
+ // Track detail
486
+ {
487
+ type: "data-list",
488
+ entity: "PlaylistItem",
489
+ variant: "detail",
490
+ fields: [
491
+ { name: "title", label: "Title", icon: "music", variant: "h4" },
492
+ { name: "artist", label: "Artist", icon: "user", variant: "body" },
493
+ { name: "duration", label: "Duration", icon: "clock", variant: "badge", format: "duration" },
494
+ { name: "order", label: "Track #", variant: "caption" }
495
+ ]
496
+ }
497
+ ] }]
498
+ ]
499
+ },
500
+ {
501
+ from: "viewing",
502
+ to: "editing",
503
+ event: "EDIT",
504
+ effects: [
505
+ ["fetch", "PlaylistItem"],
506
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
507
+ // Header with back
508
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
509
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
510
+ { type: "icon", name: "edit", size: "lg" },
511
+ { type: "typography", variant: "h2", content: "Edit Track" }
512
+ ] },
513
+ { type: "button", label: "Back", icon: "arrow-left", variant: "ghost", action: "BACK" }
514
+ ] },
515
+ { type: "divider" },
516
+ { type: "form-section", entity: "PlaylistItem" }
517
+ ] }]
518
+ ]
519
+ },
520
+ {
521
+ from: "editing",
522
+ to: "browsing",
523
+ event: "SAVE",
524
+ effects: [
525
+ ["set", "@entity.title", "@payload.title"],
526
+ ["set", "@entity.artist", "@payload.artist"],
527
+ ["fetch", "PlaylistItem"],
528
+ playlistBrowsingMainEffect
529
+ ]
530
+ },
531
+ {
532
+ from: "viewing",
533
+ to: "browsing",
534
+ event: "BACK",
535
+ effects: [
536
+ ["fetch", "PlaylistItem"],
537
+ playlistBrowsingMainEffect
538
+ ]
539
+ },
540
+ {
541
+ from: "editing",
542
+ to: "browsing",
543
+ event: "BACK",
544
+ effects: [
545
+ ["fetch", "PlaylistItem"],
546
+ playlistBrowsingMainEffect
547
+ ]
548
+ }
549
+ ]
550
+ }
551
+ }
552
+ ],
553
+ pages: [
554
+ {
555
+ name: "PlaylistPage",
556
+ path: "/playlist",
557
+ isInitial: true,
558
+ traits: [{ ref: "PlaylistControl" }]
559
+ }
560
+ ]
561
+ }
562
+ ]
563
+ };
564
+ var uploadIdleMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
565
+ // Header: upload icon + title
566
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
567
+ { type: "icon", name: "upload", size: "lg" },
568
+ { type: "typography", variant: "h2", content: "File Upload" }
569
+ ] },
570
+ { type: "divider" },
571
+ // Guidance text
572
+ { type: "stack", direction: "vertical", gap: "sm", align: "center", children: [
573
+ { type: "icon", name: "file-plus", size: "xl" },
574
+ { type: "typography", variant: "body", content: "Select a file to upload" }
575
+ ] },
576
+ // Upload form
577
+ { type: "form-section", entity: "UploadState", submitEvent: "START_UPLOAD" },
578
+ // Explicit start button
579
+ { type: "button", label: "Start Upload", action: "START_UPLOAD", icon: "upload", variant: "primary" }
580
+ ] }];
581
+ var uploadProgressMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
582
+ // Header
583
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
584
+ { type: "icon", name: "upload", size: "lg" },
585
+ { type: "typography", variant: "h2", content: "Uploading..." }
586
+ ] },
587
+ { type: "divider" },
588
+ // File info
589
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
590
+ { type: "icon", name: "file", size: "md" },
591
+ { type: "typography", variant: "h4", content: "@entity.fileName" }
592
+ ] },
593
+ // Progress
594
+ { type: "meter", value: 0, label: "Upload Progress", icon: "upload" },
595
+ { type: "badge", label: "Uploading", variant: "warning" }
596
+ ] }];
597
+ var UPLOAD_BEHAVIOR = {
598
+ name: "std-upload",
599
+ version: "1.0.0",
600
+ description: "File upload tracking with progress indicator",
601
+ theme: MEDIA_THEME,
602
+ orbitals: [
603
+ {
604
+ name: "UploadOrbital",
605
+ entity: {
606
+ name: "UploadState",
607
+ persistence: "runtime",
608
+ fields: [
609
+ { name: "id", type: "string", required: true },
610
+ { name: "fileName", type: "string", default: "" },
611
+ { name: "fileSize", type: "number", default: 0 },
612
+ { name: "progress", type: "number", default: 0 },
613
+ { name: "status", type: "string", default: "idle" }
614
+ ]
615
+ },
616
+ traits: [
617
+ {
618
+ name: "UploadControl",
619
+ linkedEntity: "UploadState",
620
+ category: "interaction",
621
+ stateMachine: {
622
+ states: [
623
+ { name: "idle", isInitial: true },
624
+ { name: "uploading" },
625
+ { name: "completed" },
626
+ { name: "failed" }
627
+ ],
628
+ events: [
629
+ { key: "INIT", name: "Initialize" },
630
+ { key: "START_UPLOAD", name: "Start Upload", payloadSchema: [{ name: "fileName", type: "string", required: true }] },
631
+ { key: "COMPLETE", name: "Upload Complete" },
632
+ { key: "FAIL", name: "Upload Failed" },
633
+ { key: "RETRY", name: "Retry Upload" },
634
+ { key: "RESET", name: "Reset" }
635
+ ],
636
+ transitions: [
637
+ {
638
+ from: "idle",
639
+ to: "idle",
640
+ event: "INIT",
641
+ effects: [
642
+ ["set", "@entity.progress", 0],
643
+ ["set", "@entity.status", "idle"],
644
+ ["fetch", "UploadState"],
645
+ uploadIdleMainEffect
646
+ ]
647
+ },
648
+ {
649
+ from: "idle",
650
+ to: "uploading",
651
+ event: "START_UPLOAD",
652
+ effects: [
653
+ ["set", "@entity.fileName", "@payload.fileName"],
654
+ ["set", "@entity.progress", 0],
655
+ ["set", "@entity.status", "uploading"],
656
+ uploadProgressMainEffect
657
+ ]
658
+ },
659
+ {
660
+ from: "uploading",
661
+ to: "completed",
662
+ event: "COMPLETE",
663
+ effects: [
664
+ ["set", "@entity.progress", 100],
665
+ ["set", "@entity.status", "completed"],
666
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
667
+ // Header
668
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
669
+ { type: "icon", name: "check-circle", size: "lg" },
670
+ { type: "typography", variant: "h2", content: "Upload Complete" }
671
+ ] },
672
+ { type: "divider" },
673
+ // File info
674
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
675
+ { type: "icon", name: "file", size: "md" },
676
+ { type: "typography", variant: "h4", content: "@entity.fileName" }
677
+ ] },
678
+ // Progress full
679
+ { type: "meter", value: 100, label: "Complete", icon: "check" },
680
+ { type: "badge", label: "Completed", variant: "success" },
681
+ { type: "divider" },
682
+ // Reset
683
+ { type: "button", label: "Upload Another", icon: "upload", variant: "primary", action: "RESET" }
684
+ ] }]
685
+ ]
686
+ },
687
+ {
688
+ from: "uploading",
689
+ to: "failed",
690
+ event: "FAIL",
691
+ effects: [
692
+ ["set", "@entity.status", "failed"],
693
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
694
+ // Header
695
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
696
+ { type: "icon", name: "alert-triangle", size: "lg" },
697
+ { type: "typography", variant: "h2", content: "Upload Failed" }
698
+ ] },
699
+ { type: "divider" },
700
+ // File info
701
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
702
+ { type: "icon", name: "file", size: "md" },
703
+ { type: "typography", variant: "h4", content: "@entity.fileName" }
704
+ ] },
705
+ { type: "badge", label: "Failed", variant: "error" },
706
+ { type: "divider" },
707
+ // Retry / Reset
708
+ { type: "stack", direction: "horizontal", gap: "md", children: [
709
+ { type: "button", label: "Retry", icon: "refresh-cw", variant: "primary", action: "RETRY" },
710
+ { type: "button", label: "Reset", icon: "x", variant: "ghost", action: "RESET" }
711
+ ] }
712
+ ] }]
713
+ ]
714
+ },
715
+ {
716
+ from: "failed",
717
+ to: "uploading",
718
+ event: "RETRY",
719
+ effects: [
720
+ ["set", "@entity.progress", 0],
721
+ ["set", "@entity.status", "uploading"],
722
+ uploadProgressMainEffect
723
+ ]
724
+ },
725
+ {
726
+ from: "completed",
727
+ to: "idle",
728
+ event: "RESET",
729
+ effects: [
730
+ ["set", "@entity.progress", 0],
731
+ ["set", "@entity.status", "idle"],
732
+ ["fetch", "UploadState"],
733
+ uploadIdleMainEffect
734
+ ]
735
+ },
736
+ {
737
+ from: "failed",
738
+ to: "idle",
739
+ event: "RESET",
740
+ effects: [
741
+ ["set", "@entity.progress", 0],
742
+ ["set", "@entity.status", "idle"],
743
+ ["fetch", "UploadState"],
744
+ uploadIdleMainEffect
745
+ ]
746
+ }
747
+ ]
748
+ }
749
+ }
750
+ ],
751
+ pages: [
752
+ {
753
+ name: "UploadPage",
754
+ path: "/upload",
755
+ isInitial: true,
756
+ traits: [{ ref: "UploadControl" }]
757
+ }
758
+ ]
759
+ }
760
+ ]
761
+ };
762
+ var MEDIA_BEHAVIORS = [
763
+ GALLERY_BEHAVIOR,
764
+ PLAYER_BEHAVIOR,
765
+ PLAYLIST_BEHAVIOR,
766
+ UPLOAD_BEHAVIOR
767
+ ];
768
+
769
+ export { GALLERY_BEHAVIOR, MEDIA_BEHAVIORS, PLAYER_BEHAVIOR, PLAYLIST_BEHAVIOR, UPLOAD_BEHAVIOR };
770
+ //# sourceMappingURL=media.js.map
771
+ //# sourceMappingURL=media.js.map