@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,840 @@
1
+ // behaviors/domain/social.ts
2
+ var SOCIAL_THEME = {
3
+ name: "social-sky",
4
+ tokens: {
5
+ colors: {
6
+ primary: "#0284c7",
7
+ "primary-hover": "#0369a1",
8
+ "primary-foreground": "#ffffff",
9
+ accent: "#38bdf8",
10
+ "accent-foreground": "#000000",
11
+ success: "#22c55e",
12
+ warning: "#f59e0b",
13
+ error: "#ef4444"
14
+ }
15
+ }
16
+ };
17
+ var feedBrowsingMainEffects = [
18
+ ["fetch", "FeedPost"],
19
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
20
+ // Header row: icon + title + create button
21
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
22
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
23
+ { type: "icon", name: "users", size: "lg" },
24
+ { type: "typography", variant: "h2", content: "Feed" }
25
+ ] },
26
+ { type: "button", label: "New Post", icon: "send", variant: "primary", action: "CREATE" }
27
+ ] },
28
+ { type: "divider" },
29
+ // Stats row
30
+ { type: "stack", direction: "horizontal", gap: "md", children: [
31
+ { type: "stats", label: "Total Posts", icon: "message-circle", entity: "FeedPost" },
32
+ { type: "stats", label: "Engagement", icon: "heart", entity: "FeedPost" },
33
+ { type: "stats", label: "Authors", icon: "user-plus", entity: "FeedPost" }
34
+ ] },
35
+ // Search
36
+ { type: "search-input", placeholder: "Search posts...", icon: "at-sign", event: "VIEW" },
37
+ { type: "divider" },
38
+ // Post list
39
+ {
40
+ type: "data-list",
41
+ entity: "FeedPost",
42
+ fields: [
43
+ { name: "author", label: "Author", icon: "users", variant: "h4" },
44
+ { name: "content", label: "Content", icon: "message-circle", variant: "body" },
45
+ { name: "timestamp", label: "Posted", icon: "clock", variant: "caption" },
46
+ { name: "likeCount", label: "Likes", icon: "heart", variant: "badge", format: "number" }
47
+ ],
48
+ actions: [
49
+ { label: "View", event: "VIEW" }
50
+ ]
51
+ }
52
+ ] }]
53
+ ];
54
+ var FEED_BEHAVIOR = {
55
+ name: "std-feed",
56
+ version: "1.0.0",
57
+ description: "Social feed with post browsing and creation",
58
+ theme: SOCIAL_THEME,
59
+ orbitals: [
60
+ {
61
+ name: "FeedOrbital",
62
+ entity: {
63
+ name: "FeedPost",
64
+ persistence: "persistent",
65
+ collection: "feed_posts",
66
+ fields: [
67
+ { name: "id", type: "string", required: true },
68
+ { name: "author", type: "string", default: "" },
69
+ { name: "content", type: "string", default: "" },
70
+ { name: "timestamp", type: "string", default: "" },
71
+ { name: "likeCount", type: "number", default: 0 }
72
+ ]
73
+ },
74
+ traits: [
75
+ {
76
+ name: "FeedManager",
77
+ linkedEntity: "FeedPost",
78
+ category: "interaction",
79
+ stateMachine: {
80
+ states: [
81
+ { name: "browsing", isInitial: true },
82
+ { name: "viewing" },
83
+ { name: "creating" }
84
+ ],
85
+ events: [
86
+ { key: "INIT", name: "Initialize" },
87
+ { key: "VIEW", name: "View Post", payloadSchema: [{ name: "id", type: "string", required: true }] },
88
+ { key: "CREATE", name: "Create Post" },
89
+ { key: "SUBMIT", name: "Submit Post", payloadSchema: [
90
+ { name: "content", type: "string", required: true },
91
+ { name: "author", type: "string", required: true }
92
+ ] },
93
+ { key: "LIKE", name: "Like Post" },
94
+ { key: "CANCEL", name: "Cancel" },
95
+ { key: "CLOSE", name: "Close" }
96
+ ],
97
+ transitions: [
98
+ {
99
+ from: "browsing",
100
+ to: "browsing",
101
+ event: "INIT",
102
+ effects: [...feedBrowsingMainEffects]
103
+ },
104
+ {
105
+ from: "browsing",
106
+ to: "viewing",
107
+ event: "VIEW",
108
+ effects: [
109
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
110
+ // Post detail header
111
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
112
+ { type: "icon", name: "message-circle", size: "md" },
113
+ { type: "typography", variant: "h3", content: "@entity.id" }
114
+ ] },
115
+ { type: "divider" },
116
+ // Post content
117
+ { type: "stack", direction: "vertical", gap: "sm", children: [
118
+ { type: "typography", variant: "label", content: "Author" },
119
+ { type: "typography", variant: "body", content: "@entity.author" },
120
+ { type: "typography", variant: "label", content: "Content" },
121
+ { type: "typography", variant: "body", content: "@entity.content" }
122
+ ] },
123
+ // Like count badge
124
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
125
+ { type: "icon", name: "heart", size: "sm" },
126
+ { type: "badge", label: "@entity.likeCount", variant: "info" }
127
+ ] },
128
+ { type: "divider" },
129
+ // Actions
130
+ { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
131
+ { type: "button", label: "Like", icon: "heart", variant: "secondary", action: "LIKE" },
132
+ { type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
133
+ ] }
134
+ ] }]
135
+ ]
136
+ },
137
+ {
138
+ from: "viewing",
139
+ to: "viewing",
140
+ event: "LIKE",
141
+ effects: [
142
+ ["set", "@entity.likeCount", ["+", "@entity.likeCount", 1]],
143
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
144
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
145
+ { type: "icon", name: "message-circle", size: "md" },
146
+ { type: "typography", variant: "h3", content: "@entity.id" }
147
+ ] },
148
+ { type: "divider" },
149
+ { type: "stack", direction: "vertical", gap: "sm", children: [
150
+ { type: "typography", variant: "label", content: "Author" },
151
+ { type: "typography", variant: "body", content: "@entity.author" },
152
+ { type: "typography", variant: "label", content: "Content" },
153
+ { type: "typography", variant: "body", content: "@entity.content" }
154
+ ] },
155
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
156
+ { type: "icon", name: "heart", size: "sm" },
157
+ { type: "badge", label: "@entity.likeCount", variant: "info" }
158
+ ] },
159
+ { type: "divider" },
160
+ { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
161
+ { type: "button", label: "Like", icon: "heart", variant: "secondary", action: "LIKE" },
162
+ { type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
163
+ ] }
164
+ ] }]
165
+ ]
166
+ },
167
+ {
168
+ from: "viewing",
169
+ to: "browsing",
170
+ event: "CLOSE",
171
+ effects: [
172
+ ["render-ui", "modal", null]
173
+ ]
174
+ },
175
+ {
176
+ from: "viewing",
177
+ to: "browsing",
178
+ event: "CANCEL",
179
+ effects: [
180
+ ["render-ui", "modal", null]
181
+ ]
182
+ },
183
+ {
184
+ from: "browsing",
185
+ to: "creating",
186
+ event: "CREATE",
187
+ effects: [
188
+ ["fetch", "FeedPost"],
189
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
190
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
191
+ { type: "icon", name: "send", size: "md" },
192
+ { type: "typography", variant: "h3", content: "New Post" }
193
+ ] },
194
+ { type: "divider" },
195
+ {
196
+ type: "form-section",
197
+ entity: "FeedPost",
198
+ title: "New Post",
199
+ submitEvent: "SUBMIT",
200
+ cancelEvent: "CANCEL"
201
+ }
202
+ ] }]
203
+ ]
204
+ },
205
+ {
206
+ from: "creating",
207
+ to: "browsing",
208
+ event: "SUBMIT",
209
+ effects: [
210
+ ["set", "@entity.content", "@payload.content"],
211
+ ["set", "@entity.author", "@payload.author"],
212
+ ["set", "@entity.likeCount", 0],
213
+ ["render-ui", "modal", null],
214
+ ...feedBrowsingMainEffects
215
+ ]
216
+ },
217
+ {
218
+ from: "creating",
219
+ to: "browsing",
220
+ event: "CANCEL",
221
+ effects: [
222
+ ["render-ui", "modal", null]
223
+ ]
224
+ }
225
+ ]
226
+ }
227
+ }
228
+ ],
229
+ pages: [
230
+ {
231
+ name: "FeedPage",
232
+ path: "/feed",
233
+ isInitial: true,
234
+ traits: [{ ref: "FeedManager" }]
235
+ }
236
+ ]
237
+ }
238
+ ]
239
+ };
240
+ var messagingBrowsingMainEffects = [
241
+ ["fetch", "Message"],
242
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
243
+ // Header: icon + title + compose button
244
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
245
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
246
+ { type: "icon", name: "message-circle", size: "lg" },
247
+ { type: "typography", variant: "h2", content: "Messages" }
248
+ ] },
249
+ { type: "button", label: "Compose", icon: "send", variant: "primary", action: "COMPOSE" }
250
+ ] },
251
+ { type: "divider" },
252
+ // Stats: total messages + unread indicator
253
+ { type: "stack", direction: "horizontal", gap: "md", children: [
254
+ { type: "stats", label: "Total Messages", icon: "message-circle", entity: "Message" },
255
+ { type: "stats", label: "Unread", icon: "bell", entity: "Message" }
256
+ ] },
257
+ // Search
258
+ { type: "search-input", placeholder: "Search conversations...", icon: "at-sign", event: "OPEN_CHAT" },
259
+ { type: "divider" },
260
+ // Message list (compact, conversation-style)
261
+ {
262
+ type: "data-list",
263
+ entity: "Message",
264
+ fields: [
265
+ { name: "sender", label: "From", icon: "user-plus", variant: "h4" },
266
+ { name: "content", label: "Message", icon: "message-circle", variant: "body" },
267
+ { name: "timestamp", label: "Time", icon: "clock", variant: "caption" },
268
+ { name: "isRead", label: "Read", icon: "check", variant: "badge" }
269
+ ],
270
+ actions: [
271
+ { label: "Open", event: "OPEN_CHAT" }
272
+ ]
273
+ },
274
+ { type: "divider" },
275
+ // Compose area: quick message input
276
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
277
+ { type: "search-input", placeholder: "Type a message...", icon: "message-circle", entity: "Message" },
278
+ { type: "button", label: "Send", action: "COMPOSE", icon: "send", variant: "primary" }
279
+ ] }
280
+ ] }]
281
+ ];
282
+ var MESSAGING_BEHAVIOR = {
283
+ name: "std-messaging",
284
+ version: "1.0.0",
285
+ description: "Messaging system with conversation flow",
286
+ theme: SOCIAL_THEME,
287
+ orbitals: [
288
+ {
289
+ name: "MessagingOrbital",
290
+ entity: {
291
+ name: "Message",
292
+ persistence: "persistent",
293
+ collection: "messages",
294
+ fields: [
295
+ { name: "id", type: "string", required: true },
296
+ { name: "sender", type: "string", default: "" },
297
+ { name: "content", type: "string", default: "" },
298
+ { name: "timestamp", type: "string", default: "" },
299
+ { name: "isRead", type: "boolean", default: false }
300
+ ]
301
+ },
302
+ traits: [
303
+ {
304
+ name: "MessagingFlow",
305
+ linkedEntity: "Message",
306
+ category: "interaction",
307
+ stateMachine: {
308
+ states: [
309
+ { name: "browsing", isInitial: true },
310
+ { name: "chatting" },
311
+ { name: "composing" }
312
+ ],
313
+ events: [
314
+ { key: "INIT", name: "Initialize" },
315
+ { key: "OPEN_CHAT", name: "Open Chat", payloadSchema: [{ name: "id", type: "string", required: true }] },
316
+ { key: "COMPOSE", name: "Compose Message" },
317
+ { key: "SEND", name: "Send Message", payloadSchema: [
318
+ { name: "content", type: "string", required: true },
319
+ { name: "sender", type: "string", required: true }
320
+ ] },
321
+ { key: "MARK_READ", name: "Mark as Read" },
322
+ { key: "CANCEL", name: "Cancel" },
323
+ { key: "CLOSE", name: "Close" }
324
+ ],
325
+ transitions: [
326
+ {
327
+ from: "browsing",
328
+ to: "browsing",
329
+ event: "INIT",
330
+ effects: [...messagingBrowsingMainEffects]
331
+ },
332
+ {
333
+ from: "browsing",
334
+ to: "chatting",
335
+ event: "OPEN_CHAT",
336
+ effects: [
337
+ ["set", "@entity.isRead", true],
338
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
339
+ // Conversation header
340
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
341
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
342
+ { type: "icon", name: "message-circle", size: "md" },
343
+ { type: "typography", variant: "h3", content: "Conversation" }
344
+ ] },
345
+ { type: "badge", label: "Read", variant: "success" }
346
+ ] },
347
+ { type: "divider" },
348
+ // Message detail
349
+ { type: "stack", direction: "vertical", gap: "sm", children: [
350
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
351
+ { type: "icon", name: "user-plus", size: "sm" },
352
+ { type: "typography", variant: "label", content: "From" },
353
+ { type: "typography", variant: "body", content: "@entity.sender" }
354
+ ] },
355
+ { type: "typography", variant: "body", content: "@entity.content" },
356
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
357
+ { type: "icon", name: "clock", size: "sm" },
358
+ { type: "typography", variant: "caption", content: "@entity.timestamp" }
359
+ ] }
360
+ ] },
361
+ { type: "divider" },
362
+ // Actions
363
+ { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
364
+ { type: "button", label: "Mark Read", icon: "check", variant: "secondary", action: "MARK_READ" },
365
+ { type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
366
+ ] }
367
+ ] }]
368
+ ]
369
+ },
370
+ {
371
+ from: "chatting",
372
+ to: "chatting",
373
+ event: "MARK_READ",
374
+ effects: [
375
+ ["set", "@entity.isRead", true],
376
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
377
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
378
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
379
+ { type: "icon", name: "message-circle", size: "md" },
380
+ { type: "typography", variant: "h3", content: "Conversation" }
381
+ ] },
382
+ { type: "badge", label: "Read", variant: "success" }
383
+ ] },
384
+ { type: "divider" },
385
+ { type: "stack", direction: "vertical", gap: "sm", children: [
386
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
387
+ { type: "icon", name: "user-plus", size: "sm" },
388
+ { type: "typography", variant: "label", content: "From" },
389
+ { type: "typography", variant: "body", content: "@entity.sender" }
390
+ ] },
391
+ { type: "typography", variant: "body", content: "@entity.content" },
392
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
393
+ { type: "icon", name: "clock", size: "sm" },
394
+ { type: "typography", variant: "caption", content: "@entity.timestamp" }
395
+ ] }
396
+ ] },
397
+ { type: "divider" },
398
+ { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
399
+ { type: "button", label: "Mark Read", icon: "check", variant: "secondary", action: "MARK_READ" },
400
+ { type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
401
+ ] }
402
+ ] }]
403
+ ]
404
+ },
405
+ {
406
+ from: "chatting",
407
+ to: "browsing",
408
+ event: "CLOSE",
409
+ effects: [
410
+ ["render-ui", "modal", null]
411
+ ]
412
+ },
413
+ {
414
+ from: "chatting",
415
+ to: "browsing",
416
+ event: "CANCEL",
417
+ effects: [
418
+ ["render-ui", "modal", null]
419
+ ]
420
+ },
421
+ {
422
+ from: "browsing",
423
+ to: "composing",
424
+ event: "COMPOSE",
425
+ effects: [
426
+ ["fetch", "Message"],
427
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
428
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
429
+ { type: "icon", name: "send", size: "md" },
430
+ { type: "typography", variant: "h3", content: "New Message" }
431
+ ] },
432
+ { type: "divider" },
433
+ {
434
+ type: "form-section",
435
+ entity: "Message",
436
+ title: "New Message",
437
+ submitEvent: "SEND",
438
+ cancelEvent: "CANCEL"
439
+ }
440
+ ] }]
441
+ ]
442
+ },
443
+ {
444
+ from: "composing",
445
+ to: "browsing",
446
+ event: "SEND",
447
+ effects: [
448
+ ["set", "@entity.content", "@payload.content"],
449
+ ["set", "@entity.sender", "@payload.sender"],
450
+ ["set", "@entity.isRead", false],
451
+ ["render-ui", "modal", null],
452
+ ...messagingBrowsingMainEffects
453
+ ]
454
+ },
455
+ {
456
+ from: "composing",
457
+ to: "browsing",
458
+ event: "CANCEL",
459
+ effects: [
460
+ ["render-ui", "modal", null]
461
+ ]
462
+ }
463
+ ]
464
+ }
465
+ }
466
+ ],
467
+ pages: [
468
+ {
469
+ name: "MessagesPage",
470
+ path: "/messages",
471
+ isInitial: true,
472
+ traits: [{ ref: "MessagingFlow" }]
473
+ }
474
+ ]
475
+ }
476
+ ]
477
+ };
478
+ var profileViewingMainEffects = [
479
+ ["fetch", "UserProfile"],
480
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
481
+ // Header: avatar area + title + edit button
482
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
483
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
484
+ { type: "icon", name: "users", size: "lg" },
485
+ { type: "typography", variant: "h2", content: "Profile" }
486
+ ] },
487
+ { type: "button", label: "Edit", icon: "edit", variant: "secondary", action: "EDIT" }
488
+ ] },
489
+ { type: "divider" },
490
+ // Profile stats
491
+ { type: "stack", direction: "horizontal", gap: "md", children: [
492
+ { type: "stats", label: "Profiles", icon: "users", entity: "UserProfile" },
493
+ { type: "stats", label: "Active", icon: "user-plus", entity: "UserProfile" }
494
+ ] },
495
+ { type: "divider" },
496
+ // Profile card: structured detail display
497
+ { type: "stack", direction: "vertical", gap: "md", children: [
498
+ // Display name row
499
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
500
+ { type: "icon", name: "user-plus", size: "md" },
501
+ { type: "stack", direction: "vertical", gap: "xs", children: [
502
+ { type: "typography", variant: "label", content: "Display Name" },
503
+ { type: "typography", variant: "h3", content: "@entity.displayName" }
504
+ ] }
505
+ ] },
506
+ // Bio row
507
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
508
+ { type: "icon", name: "message-circle", size: "md" },
509
+ { type: "stack", direction: "vertical", gap: "xs", children: [
510
+ { type: "typography", variant: "label", content: "Bio" },
511
+ { type: "typography", variant: "body", content: "@entity.bio" }
512
+ ] }
513
+ ] },
514
+ // Avatar URL row
515
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
516
+ { type: "icon", name: "image", size: "md" },
517
+ { type: "stack", direction: "vertical", gap: "xs", children: [
518
+ { type: "typography", variant: "label", content: "Avatar" },
519
+ { type: "typography", variant: "caption", content: "@entity.avatarUrl" }
520
+ ] }
521
+ ] },
522
+ // Join date row
523
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
524
+ { type: "icon", name: "clock", size: "md" },
525
+ { type: "stack", direction: "vertical", gap: "xs", children: [
526
+ { type: "typography", variant: "label", content: "Member Since" },
527
+ { type: "typography", variant: "caption", content: "@entity.joinDate" }
528
+ ] }
529
+ ] }
530
+ ] }
531
+ ] }]
532
+ ];
533
+ var PROFILE_BEHAVIOR = {
534
+ name: "std-profile",
535
+ version: "1.0.0",
536
+ description: "User profile viewing and editing",
537
+ theme: SOCIAL_THEME,
538
+ orbitals: [
539
+ {
540
+ name: "ProfileOrbital",
541
+ entity: {
542
+ name: "UserProfile",
543
+ persistence: "persistent",
544
+ collection: "user_profiles",
545
+ fields: [
546
+ { name: "id", type: "string", required: true },
547
+ { name: "displayName", type: "string", default: "" },
548
+ { name: "bio", type: "string", default: "" },
549
+ { name: "avatarUrl", type: "string", default: "" },
550
+ { name: "joinDate", type: "string", default: "" }
551
+ ]
552
+ },
553
+ traits: [
554
+ {
555
+ name: "ProfileManager",
556
+ linkedEntity: "UserProfile",
557
+ category: "interaction",
558
+ stateMachine: {
559
+ states: [
560
+ { name: "viewing", isInitial: true },
561
+ { name: "editing" }
562
+ ],
563
+ events: [
564
+ { key: "INIT", name: "Initialize" },
565
+ { key: "EDIT", name: "Edit Profile" },
566
+ { key: "UPDATE", name: "Update Profile", payloadSchema: [
567
+ { name: "displayName", type: "string", required: true },
568
+ { name: "bio", type: "string", required: true },
569
+ { name: "avatarUrl", type: "string", required: true }
570
+ ] },
571
+ { key: "CANCEL", name: "Cancel" },
572
+ { key: "CLOSE", name: "Close" }
573
+ ],
574
+ transitions: [
575
+ {
576
+ from: "viewing",
577
+ to: "viewing",
578
+ event: "INIT",
579
+ effects: [...profileViewingMainEffects]
580
+ },
581
+ {
582
+ from: "viewing",
583
+ to: "editing",
584
+ event: "EDIT",
585
+ effects: [
586
+ ["fetch", "UserProfile"],
587
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
588
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
589
+ { type: "icon", name: "edit", size: "md" },
590
+ { type: "typography", variant: "h3", content: "Edit Profile" }
591
+ ] },
592
+ { type: "divider" },
593
+ {
594
+ type: "form-section",
595
+ entity: "UserProfile",
596
+ title: "Edit Profile",
597
+ submitEvent: "UPDATE",
598
+ cancelEvent: "CANCEL"
599
+ }
600
+ ] }]
601
+ ]
602
+ },
603
+ {
604
+ from: "editing",
605
+ to: "viewing",
606
+ event: "UPDATE",
607
+ effects: [
608
+ ["set", "@entity.displayName", "@payload.displayName"],
609
+ ["set", "@entity.bio", "@payload.bio"],
610
+ ["set", "@entity.avatarUrl", "@payload.avatarUrl"],
611
+ ["render-ui", "modal", null],
612
+ ...profileViewingMainEffects
613
+ ]
614
+ },
615
+ {
616
+ from: "editing",
617
+ to: "viewing",
618
+ event: "CANCEL",
619
+ effects: [
620
+ ["render-ui", "modal", null]
621
+ ]
622
+ },
623
+ {
624
+ from: "editing",
625
+ to: "viewing",
626
+ event: "CLOSE",
627
+ effects: [
628
+ ["render-ui", "modal", null]
629
+ ]
630
+ }
631
+ ]
632
+ }
633
+ }
634
+ ],
635
+ pages: [
636
+ {
637
+ name: "ProfilePage",
638
+ path: "/profile",
639
+ isInitial: true,
640
+ traits: [{ ref: "ProfileManager" }]
641
+ }
642
+ ]
643
+ }
644
+ ]
645
+ };
646
+ var reactionsBrowsingMainEffects = [
647
+ ["fetch", "Reaction"],
648
+ ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
649
+ // Header: icon + title
650
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
651
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
652
+ { type: "icon", name: "heart", size: "lg" },
653
+ { type: "typography", variant: "h2", content: "Reactions" }
654
+ ] },
655
+ { type: "badge", label: "Live", variant: "success" }
656
+ ] },
657
+ { type: "divider" },
658
+ // Stats row: totals
659
+ { type: "stack", direction: "horizontal", gap: "md", children: [
660
+ { type: "stats", label: "Total Reactions", icon: "heart", entity: "Reaction" },
661
+ { type: "stats", label: "Users Reacting", icon: "users", entity: "Reaction" },
662
+ { type: "stats", label: "Targets", icon: "share-2", entity: "Reaction" }
663
+ ] },
664
+ { type: "divider" },
665
+ // Chart: reaction distribution over time
666
+ { type: "line-chart", entity: "Reaction", label: "Reaction Trends", icon: "trending-up" },
667
+ { type: "divider" },
668
+ // Reaction grid: each reaction as a card
669
+ {
670
+ type: "data-grid",
671
+ entity: "Reaction",
672
+ cols: 3,
673
+ gap: "md",
674
+ fields: [
675
+ { name: "reactionType", label: "Type", icon: "heart", variant: "badge" },
676
+ { name: "userId", label: "User", icon: "user-plus", variant: "body" },
677
+ { name: "targetId", label: "Target", icon: "share-2", variant: "caption" },
678
+ { name: "timestamp", label: "When", icon: "clock", variant: "caption" }
679
+ ],
680
+ actions: [
681
+ { label: "React", event: "REACT" }
682
+ ]
683
+ },
684
+ // Engagement meter
685
+ { type: "meter", value: 0, label: "Engagement Level", icon: "activity", entity: "Reaction" }
686
+ ] }]
687
+ ];
688
+ var REACTIONS_BEHAVIOR = {
689
+ name: "std-reactions",
690
+ version: "1.0.0",
691
+ description: "Reaction system with add and remove",
692
+ theme: SOCIAL_THEME,
693
+ orbitals: [
694
+ {
695
+ name: "ReactionsOrbital",
696
+ entity: {
697
+ name: "Reaction",
698
+ persistence: "persistent",
699
+ collection: "reactions",
700
+ fields: [
701
+ { name: "id", type: "string", required: true },
702
+ { name: "reactionType", type: "string", default: "" },
703
+ { name: "userId", type: "string", default: "" },
704
+ { name: "targetId", type: "string", default: "" },
705
+ { name: "timestamp", type: "string", default: "" }
706
+ ]
707
+ },
708
+ traits: [
709
+ {
710
+ name: "ReactionManager",
711
+ linkedEntity: "Reaction",
712
+ category: "interaction",
713
+ stateMachine: {
714
+ states: [
715
+ { name: "browsing", isInitial: true },
716
+ { name: "reacting" }
717
+ ],
718
+ events: [
719
+ { key: "INIT", name: "Initialize" },
720
+ { key: "REACT", name: "Add Reaction", payloadSchema: [
721
+ { name: "reactionType", type: "string", required: true },
722
+ { name: "userId", type: "string", required: true },
723
+ { name: "targetId", type: "string", required: true }
724
+ ] },
725
+ { key: "CONFIRM", name: "Confirm Reaction" },
726
+ { key: "REMOVE", name: "Remove Reaction" },
727
+ { key: "CANCEL", name: "Cancel" },
728
+ { key: "CLOSE", name: "Close" }
729
+ ],
730
+ transitions: [
731
+ {
732
+ from: "browsing",
733
+ to: "browsing",
734
+ event: "INIT",
735
+ effects: [...reactionsBrowsingMainEffects]
736
+ },
737
+ {
738
+ from: "browsing",
739
+ to: "reacting",
740
+ event: "REACT",
741
+ effects: [
742
+ ["set", "@entity.reactionType", "@payload.reactionType"],
743
+ ["set", "@entity.userId", "@payload.userId"],
744
+ ["set", "@entity.targetId", "@payload.targetId"],
745
+ ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
746
+ // Confirm reaction header
747
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
748
+ { type: "icon", name: "heart", size: "md" },
749
+ { type: "typography", variant: "h3", content: "Confirm Reaction" }
750
+ ] },
751
+ { type: "divider" },
752
+ // Reaction details
753
+ { type: "stack", direction: "vertical", gap: "sm", children: [
754
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
755
+ { type: "typography", variant: "label", content: "Type" },
756
+ { type: "badge", label: "@entity.reactionType", variant: "info" }
757
+ ] },
758
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
759
+ { type: "icon", name: "user-plus", size: "sm" },
760
+ { type: "typography", variant: "label", content: "User" },
761
+ { type: "typography", variant: "body", content: "@entity.userId" }
762
+ ] },
763
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
764
+ { type: "icon", name: "share-2", size: "sm" },
765
+ { type: "typography", variant: "label", content: "Target" },
766
+ { type: "typography", variant: "body", content: "@entity.targetId" }
767
+ ] }
768
+ ] },
769
+ { type: "divider" },
770
+ // Actions: confirm, remove, close
771
+ { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
772
+ { type: "button", label: "Confirm", icon: "check", variant: "primary", action: "CONFIRM" },
773
+ { type: "button", label: "Remove", icon: "trash-2", variant: "danger", action: "REMOVE" },
774
+ { type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
775
+ ] }
776
+ ] }]
777
+ ]
778
+ },
779
+ {
780
+ from: "reacting",
781
+ to: "browsing",
782
+ event: "CONFIRM",
783
+ effects: [
784
+ ["render-ui", "modal", null],
785
+ ...reactionsBrowsingMainEffects
786
+ ]
787
+ },
788
+ {
789
+ from: "reacting",
790
+ to: "browsing",
791
+ event: "REMOVE",
792
+ effects: [
793
+ ["set", "@entity.reactionType", ""],
794
+ ["set", "@entity.userId", ""],
795
+ ["set", "@entity.targetId", ""],
796
+ ["render-ui", "modal", null],
797
+ ...reactionsBrowsingMainEffects
798
+ ]
799
+ },
800
+ {
801
+ from: "reacting",
802
+ to: "browsing",
803
+ event: "CANCEL",
804
+ effects: [
805
+ ["render-ui", "modal", null]
806
+ ]
807
+ },
808
+ {
809
+ from: "reacting",
810
+ to: "browsing",
811
+ event: "CLOSE",
812
+ effects: [
813
+ ["render-ui", "modal", null]
814
+ ]
815
+ }
816
+ ]
817
+ }
818
+ }
819
+ ],
820
+ pages: [
821
+ {
822
+ name: "ReactionsPage",
823
+ path: "/reactions",
824
+ isInitial: true,
825
+ traits: [{ ref: "ReactionManager" }]
826
+ }
827
+ ]
828
+ }
829
+ ]
830
+ };
831
+ var SOCIAL_BEHAVIORS = [
832
+ FEED_BEHAVIOR,
833
+ MESSAGING_BEHAVIOR,
834
+ PROFILE_BEHAVIOR,
835
+ REACTIONS_BEHAVIOR
836
+ ];
837
+
838
+ export { FEED_BEHAVIOR, MESSAGING_BEHAVIOR, PROFILE_BEHAVIOR, REACTIONS_BEHAVIOR, SOCIAL_BEHAVIORS };
839
+ //# sourceMappingURL=social.js.map
840
+ //# sourceMappingURL=social.js.map