@almadar/std 2.1.1 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/behaviors/async.d.ts +12 -7
  2. package/dist/behaviors/async.js +1085 -312
  3. package/dist/behaviors/async.js.map +1 -1
  4. package/dist/behaviors/data-management.d.ts +27 -13
  5. package/dist/behaviors/data-management.js +600 -244
  6. package/dist/behaviors/data-management.js.map +1 -1
  7. package/dist/behaviors/domain/commerce.d.ts +51 -0
  8. package/dist/behaviors/domain/commerce.js +1093 -0
  9. package/dist/behaviors/domain/commerce.js.map +1 -0
  10. package/dist/behaviors/domain/content.d.ts +51 -0
  11. package/dist/behaviors/domain/content.js +1294 -0
  12. package/dist/behaviors/domain/content.js.map +1 -0
  13. package/dist/behaviors/domain/dashboard.d.ts +45 -0
  14. package/dist/behaviors/domain/dashboard.js +783 -0
  15. package/dist/behaviors/domain/dashboard.js.map +1 -0
  16. package/dist/behaviors/domain/education.d.ts +41 -0
  17. package/dist/behaviors/domain/education.js +738 -0
  18. package/dist/behaviors/domain/education.js.map +1 -0
  19. package/dist/behaviors/domain/finance.d.ts +49 -0
  20. package/dist/behaviors/domain/finance.js +660 -0
  21. package/dist/behaviors/domain/finance.js.map +1 -0
  22. package/dist/behaviors/domain/game-2d-platformer.d.ts +50 -0
  23. package/dist/behaviors/domain/game-2d-platformer.js +810 -0
  24. package/dist/behaviors/domain/game-2d-platformer.js.map +1 -0
  25. package/dist/behaviors/domain/game-2d-puzzle.d.ts +42 -0
  26. package/dist/behaviors/domain/game-2d-puzzle.js +622 -0
  27. package/dist/behaviors/domain/game-2d-puzzle.js.map +1 -0
  28. package/dist/behaviors/domain/game-2d-rpg.d.ts +48 -0
  29. package/dist/behaviors/domain/game-2d-rpg.js +860 -0
  30. package/dist/behaviors/domain/game-2d-rpg.js.map +1 -0
  31. package/dist/behaviors/domain/game-2d-strategy.d.ts +48 -0
  32. package/dist/behaviors/domain/game-2d-strategy.js +692 -0
  33. package/dist/behaviors/domain/game-2d-strategy.js.map +1 -0
  34. package/dist/behaviors/domain/geospatial.d.ts +35 -0
  35. package/dist/behaviors/domain/geospatial.js +634 -0
  36. package/dist/behaviors/domain/geospatial.js.map +1 -0
  37. package/dist/behaviors/domain/healthcare.d.ts +36 -0
  38. package/dist/behaviors/domain/healthcare.js +1068 -0
  39. package/dist/behaviors/domain/healthcare.js.map +1 -0
  40. package/dist/behaviors/domain/iot.d.ts +45 -0
  41. package/dist/behaviors/domain/iot.js +589 -0
  42. package/dist/behaviors/domain/iot.js.map +1 -0
  43. package/dist/behaviors/domain/media.d.ts +41 -0
  44. package/dist/behaviors/domain/media.js +771 -0
  45. package/dist/behaviors/domain/media.js.map +1 -0
  46. package/dist/behaviors/domain/scheduling.d.ts +41 -0
  47. package/dist/behaviors/domain/scheduling.js +930 -0
  48. package/dist/behaviors/domain/scheduling.js.map +1 -0
  49. package/dist/behaviors/domain/simulation.d.ts +36 -0
  50. package/dist/behaviors/domain/simulation.js +706 -0
  51. package/dist/behaviors/domain/simulation.js.map +1 -0
  52. package/dist/behaviors/domain/social.d.ts +41 -0
  53. package/dist/behaviors/domain/social.js +840 -0
  54. package/dist/behaviors/domain/social.js.map +1 -0
  55. package/dist/behaviors/domain/workflow.d.ts +41 -0
  56. package/dist/behaviors/domain/workflow.js +879 -0
  57. package/dist/behaviors/domain/workflow.js.map +1 -0
  58. package/dist/behaviors/feedback.d.ts +10 -5
  59. package/dist/behaviors/feedback.js +279 -194
  60. package/dist/behaviors/feedback.js.map +1 -1
  61. package/dist/behaviors/game-core.d.ts +15 -8
  62. package/dist/behaviors/game-core.js +412 -80
  63. package/dist/behaviors/game-core.js.map +1 -1
  64. package/dist/behaviors/game-entity.d.ts +17 -10
  65. package/dist/behaviors/game-entity.js +544 -237
  66. package/dist/behaviors/game-entity.js.map +1 -1
  67. package/dist/behaviors/game-ui.d.ts +16 -8
  68. package/dist/behaviors/game-ui.js +451 -316
  69. package/dist/behaviors/game-ui.js.map +1 -1
  70. package/dist/behaviors/index.d.ts +18 -1
  71. package/dist/behaviors/index.js +18905 -2140
  72. package/dist/behaviors/index.js.map +1 -1
  73. package/dist/behaviors/infrastructure.d.ts +9 -8
  74. package/dist/behaviors/infrastructure.js +597 -169
  75. package/dist/behaviors/infrastructure.js.map +1 -1
  76. package/dist/behaviors/registry.d.ts +11 -11
  77. package/dist/behaviors/registry.js +18904 -2139
  78. package/dist/behaviors/registry.js.map +1 -1
  79. package/dist/behaviors/types.d.ts +19 -2
  80. package/dist/behaviors/types.js.map +1 -1
  81. package/dist/behaviors/ui-interaction.d.ts +20 -14
  82. package/dist/behaviors/ui-interaction.js +928 -518
  83. package/dist/behaviors/ui-interaction.js.map +1 -1
  84. package/dist/index.js +18906 -2141
  85. package/dist/index.js.map +1 -1
  86. package/package.json +1 -1
@@ -0,0 +1,706 @@
1
+ // behaviors/domain/simulation.ts
2
+ var SIMULATION_THEME = {
3
+ name: "simulation-lime",
4
+ tokens: {
5
+ colors: {
6
+ primary: "#65a30d",
7
+ "primary-hover": "#4d7c0f",
8
+ "primary-foreground": "#ffffff",
9
+ accent: "#84cc16",
10
+ "accent-foreground": "#000000",
11
+ success: "#22c55e",
12
+ warning: "#f59e0b",
13
+ error: "#ef4444"
14
+ }
15
+ }
16
+ };
17
+ var agentSimIdleMainEffect = [
18
+ "render-ui",
19
+ "main",
20
+ { type: "stack", direction: "vertical", gap: "lg", children: [
21
+ // Header: cpu icon + title + start button
22
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
23
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
24
+ { type: "icon", name: "cpu", size: "lg" },
25
+ { type: "typography", variant: "h2", content: "Agent Simulation" }
26
+ ] },
27
+ { type: "button", label: "Start", icon: "play", variant: "primary", action: "START" }
28
+ ] },
29
+ { type: "divider" },
30
+ // Agent identity
31
+ { type: "stack", direction: "horizontal", gap: "md", children: [
32
+ { type: "stats", label: "Agent", value: "@entity.name", icon: "cpu" },
33
+ { type: "stats", label: "Status", value: "@entity.state", icon: "activity" }
34
+ ] },
35
+ { type: "divider" },
36
+ // Position and energy
37
+ { type: "stack", direction: "horizontal", gap: "md", children: [
38
+ { type: "stats", label: "X", value: "@entity.x", icon: "move" },
39
+ { type: "stats", label: "Y", value: "@entity.y", icon: "move" },
40
+ { type: "stats", label: "Energy", value: "@entity.energy", icon: "zap" }
41
+ ] },
42
+ // Energy meter
43
+ { type: "meter", value: "@entity.energy", max: 100, label: "Energy", icon: "zap" }
44
+ ] }
45
+ ];
46
+ var agentSimRunningMainEffect = [
47
+ "render-ui",
48
+ "main",
49
+ { type: "stack", direction: "vertical", gap: "lg", children: [
50
+ // Header: running indicator + pause/stop controls
51
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
52
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
53
+ { type: "icon", name: "activity", size: "lg" },
54
+ { type: "typography", variant: "h2", content: "Simulation Running" }
55
+ ] },
56
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
57
+ { type: "button", label: "Pause", icon: "pause", variant: "secondary", action: "PAUSE" },
58
+ { type: "button", label: "Stop", icon: "square", variant: "danger", action: "STOP" }
59
+ ] }
60
+ ] },
61
+ { type: "divider" },
62
+ // Live stats
63
+ { type: "stack", direction: "horizontal", gap: "md", children: [
64
+ { type: "stats", label: "Agent", value: "@entity.name", icon: "cpu" },
65
+ { type: "badge", label: "Running", variant: "success" }
66
+ ] },
67
+ { type: "divider" },
68
+ // Position and energy readout
69
+ { type: "stack", direction: "horizontal", gap: "md", children: [
70
+ { type: "stats", label: "X", value: "@entity.x", icon: "move" },
71
+ { type: "stats", label: "Y", value: "@entity.y", icon: "move" },
72
+ { type: "stats", label: "Energy", value: "@entity.energy", icon: "zap" }
73
+ ] },
74
+ // Energy meter (drains over time)
75
+ { type: "meter", value: "@entity.energy", max: 100, label: "Energy Remaining", icon: "zap" }
76
+ ] }
77
+ ];
78
+ var agentSimPausedMainEffect = [
79
+ "render-ui",
80
+ "main",
81
+ { type: "stack", direction: "vertical", gap: "lg", children: [
82
+ // Header: paused indicator + resume/stop controls
83
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
84
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
85
+ { type: "icon", name: "pause", size: "lg" },
86
+ { type: "typography", variant: "h2", content: "Simulation Paused" }
87
+ ] },
88
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
89
+ { type: "button", label: "Resume", icon: "play", variant: "primary", action: "RESUME" },
90
+ { type: "button", label: "Stop", icon: "square", variant: "danger", action: "STOP" }
91
+ ] }
92
+ ] },
93
+ { type: "divider" },
94
+ // Status
95
+ { type: "stack", direction: "horizontal", gap: "md", children: [
96
+ { type: "stats", label: "Agent", value: "@entity.name", icon: "cpu" },
97
+ { type: "badge", label: "Paused", variant: "warning" }
98
+ ] },
99
+ { type: "divider" },
100
+ // Frozen stats
101
+ { type: "stack", direction: "horizontal", gap: "md", children: [
102
+ { type: "stats", label: "X", value: "@entity.x", icon: "move" },
103
+ { type: "stats", label: "Y", value: "@entity.y", icon: "move" },
104
+ { type: "stats", label: "Energy", value: "@entity.energy", icon: "zap" }
105
+ ] },
106
+ { type: "meter", value: "@entity.energy", max: 100, label: "Energy Remaining", icon: "zap" }
107
+ ] }
108
+ ];
109
+ var agentSimCompletedMainEffect = [
110
+ "render-ui",
111
+ "main",
112
+ { type: "stack", direction: "vertical", gap: "lg", children: [
113
+ // Header: completed + reset
114
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
115
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
116
+ { type: "icon", name: "bar-chart-2", size: "lg" },
117
+ { type: "typography", variant: "h2", content: "Simulation Complete" }
118
+ ] },
119
+ { type: "button", label: "Reset", icon: "refresh-cw", variant: "primary", action: "RESET" }
120
+ ] },
121
+ { type: "divider" },
122
+ // Final results
123
+ { type: "stack", direction: "horizontal", gap: "md", children: [
124
+ { type: "stats", label: "Agent", value: "@entity.name", icon: "cpu" },
125
+ { type: "badge", label: "Completed", variant: "default" }
126
+ ] },
127
+ { type: "divider" },
128
+ // Final position and energy
129
+ { type: "stack", direction: "horizontal", gap: "md", children: [
130
+ { type: "stats", label: "Final X", value: "@entity.x", icon: "move" },
131
+ { type: "stats", label: "Final Y", value: "@entity.y", icon: "move" },
132
+ { type: "stats", label: "Final Energy", value: "@entity.energy", icon: "zap" }
133
+ ] },
134
+ { type: "meter", value: "@entity.energy", max: 100, label: "Final Energy", icon: "zap" }
135
+ ] }
136
+ ];
137
+ var AGENT_SIM_BEHAVIOR = {
138
+ name: "std-agent-sim",
139
+ version: "1.0.0",
140
+ description: "Agent-based simulation with tick-driven updates",
141
+ theme: SIMULATION_THEME,
142
+ orbitals: [
143
+ {
144
+ name: "AgentSimOrbital",
145
+ entity: {
146
+ name: "SimAgent",
147
+ persistence: "runtime",
148
+ fields: [
149
+ { name: "id", type: "string", required: true },
150
+ { name: "name", type: "string", default: "" },
151
+ { name: "x", type: "number", default: 0 },
152
+ { name: "y", type: "number", default: 0 },
153
+ { name: "state", type: "string", default: "idle" },
154
+ { name: "energy", type: "number", default: 100 }
155
+ ]
156
+ },
157
+ traits: [
158
+ {
159
+ name: "AgentSimControl",
160
+ linkedEntity: "SimAgent",
161
+ category: "interaction",
162
+ stateMachine: {
163
+ states: [
164
+ { name: "idle", isInitial: true },
165
+ { name: "running" },
166
+ { name: "paused" },
167
+ { name: "completed" }
168
+ ],
169
+ events: [
170
+ { key: "INIT", name: "Initialize" },
171
+ { key: "START", name: "Start Simulation" },
172
+ { key: "PAUSE", name: "Pause Simulation" },
173
+ { key: "RESUME", name: "Resume Simulation" },
174
+ { key: "STOP", name: "Stop Simulation" },
175
+ { key: "RESET", name: "Reset Simulation" }
176
+ ],
177
+ transitions: [
178
+ {
179
+ from: "idle",
180
+ to: "idle",
181
+ event: "INIT",
182
+ effects: [
183
+ ["set", "@entity.x", 0],
184
+ ["set", "@entity.y", 0],
185
+ ["set", "@entity.energy", 100],
186
+ ["set", "@entity.state", "idle"],
187
+ agentSimIdleMainEffect
188
+ ]
189
+ },
190
+ {
191
+ from: "idle",
192
+ to: "running",
193
+ event: "START",
194
+ effects: [
195
+ ["set", "@entity.state", "running"],
196
+ agentSimRunningMainEffect
197
+ ]
198
+ },
199
+ {
200
+ from: "running",
201
+ to: "paused",
202
+ event: "PAUSE",
203
+ effects: [
204
+ ["set", "@entity.state", "paused"],
205
+ agentSimPausedMainEffect
206
+ ]
207
+ },
208
+ {
209
+ from: "paused",
210
+ to: "running",
211
+ event: "RESUME",
212
+ effects: [
213
+ ["set", "@entity.state", "running"],
214
+ agentSimRunningMainEffect
215
+ ]
216
+ },
217
+ {
218
+ from: "running",
219
+ to: "completed",
220
+ event: "STOP",
221
+ effects: [
222
+ ["set", "@entity.state", "completed"],
223
+ agentSimCompletedMainEffect
224
+ ]
225
+ },
226
+ {
227
+ from: "paused",
228
+ to: "completed",
229
+ event: "STOP",
230
+ effects: [
231
+ ["set", "@entity.state", "completed"],
232
+ agentSimCompletedMainEffect
233
+ ]
234
+ },
235
+ {
236
+ from: "completed",
237
+ to: "idle",
238
+ event: "RESET",
239
+ effects: [
240
+ ["set", "@entity.x", 0],
241
+ ["set", "@entity.y", 0],
242
+ ["set", "@entity.energy", 100],
243
+ ["set", "@entity.state", "idle"],
244
+ agentSimIdleMainEffect
245
+ ]
246
+ }
247
+ ]
248
+ },
249
+ ticks: [
250
+ {
251
+ name: "AgentTick",
252
+ interval: "frame",
253
+ guard: ["=", "@state", "running"],
254
+ effects: [
255
+ ["set", "@entity.energy", ["-", "@entity.energy", 1]]
256
+ ]
257
+ }
258
+ ]
259
+ }
260
+ ],
261
+ pages: [
262
+ {
263
+ name: "SimulationPage",
264
+ path: "/simulation",
265
+ isInitial: true,
266
+ traits: [{ ref: "AgentSimControl" }]
267
+ }
268
+ ]
269
+ }
270
+ ]
271
+ };
272
+ var ruleEngineBrowsingMainEffect = [
273
+ "render-ui",
274
+ "main",
275
+ { type: "stack", direction: "vertical", gap: "lg", children: [
276
+ // Header: settings icon + title + create button
277
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
278
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
279
+ { type: "icon", name: "settings", size: "lg" },
280
+ { type: "typography", variant: "h2", content: "Simulation Rules" }
281
+ ] },
282
+ { type: "button", label: "Create", icon: "plus", variant: "primary", action: "CREATE" }
283
+ ] },
284
+ { type: "divider" },
285
+ // Search
286
+ { type: "search-input", placeholder: "Search rules...", icon: "search" },
287
+ // Rules data list
288
+ {
289
+ type: "data-list",
290
+ entity: "SimRule",
291
+ fields: [
292
+ { name: "name", label: "Rule", icon: "tag", variant: "h4" },
293
+ { name: "condition", label: "Condition", icon: "git-branch", variant: "body" },
294
+ { name: "action", label: "Action", icon: "zap", variant: "body" },
295
+ { name: "priority", label: "Priority", icon: "bar-chart-2", variant: "badge", format: "number" },
296
+ { name: "isActive", label: "Active", icon: "check-circle", variant: "badge" }
297
+ ],
298
+ itemActions: [
299
+ { label: "Edit", event: "EDIT", icon: "edit" }
300
+ ]
301
+ }
302
+ ] }
303
+ ];
304
+ var ruleEngineFormModalEffect = [
305
+ "render-ui",
306
+ "modal",
307
+ { type: "stack", direction: "vertical", gap: "lg", children: [
308
+ // Modal header
309
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
310
+ { type: "icon", name: "edit", size: "md" },
311
+ { type: "typography", variant: "h3", content: "Rule Editor" }
312
+ ] },
313
+ { type: "divider" },
314
+ // Form
315
+ {
316
+ type: "form-section",
317
+ entity: "SimRule",
318
+ submitEvent: "SAVE",
319
+ cancelEvent: "CANCEL"
320
+ }
321
+ ] }
322
+ ];
323
+ var RULE_ENGINE_BEHAVIOR = {
324
+ name: "std-rule-engine",
325
+ version: "1.0.0",
326
+ description: "Rule management for simulation engines",
327
+ theme: SIMULATION_THEME,
328
+ orbitals: [
329
+ {
330
+ name: "RuleEngineOrbital",
331
+ entity: {
332
+ name: "SimRule",
333
+ persistence: "persistent",
334
+ collection: "sim_rules",
335
+ fields: [
336
+ { name: "id", type: "string", required: true },
337
+ { name: "name", type: "string", default: "" },
338
+ { name: "condition", type: "string", default: "" },
339
+ { name: "action", type: "string", default: "" },
340
+ { name: "priority", type: "number", default: 0 },
341
+ { name: "isActive", type: "boolean", default: true }
342
+ ]
343
+ },
344
+ traits: [
345
+ {
346
+ name: "RuleEngineControl",
347
+ linkedEntity: "SimRule",
348
+ category: "interaction",
349
+ stateMachine: {
350
+ states: [
351
+ { name: "browsing", isInitial: true },
352
+ { name: "creating" },
353
+ { name: "editing" }
354
+ ],
355
+ events: [
356
+ { key: "INIT", name: "Initialize" },
357
+ { key: "CREATE", name: "New Rule" },
358
+ { key: "EDIT", name: "Edit Rule", payloadSchema: [{ name: "id", type: "string", required: true }] },
359
+ { key: "SAVE", name: "Save Rule", payloadSchema: [{ name: "name", type: "string", required: true }, { name: "condition", type: "string", required: true }, { name: "action", type: "string", required: true }] },
360
+ { key: "CLOSE", name: "Close" },
361
+ { key: "CANCEL", name: "Cancel" }
362
+ ],
363
+ transitions: [
364
+ {
365
+ from: "browsing",
366
+ to: "browsing",
367
+ event: "INIT",
368
+ effects: [
369
+ ["fetch", "SimRule"],
370
+ ruleEngineBrowsingMainEffect
371
+ ]
372
+ },
373
+ {
374
+ from: "browsing",
375
+ to: "creating",
376
+ event: "CREATE",
377
+ effects: [
378
+ ["fetch", "SimRule"],
379
+ ruleEngineFormModalEffect
380
+ ]
381
+ },
382
+ {
383
+ from: "creating",
384
+ to: "browsing",
385
+ event: "SAVE",
386
+ effects: [
387
+ ["set", "@entity.name", "@payload.name"],
388
+ ["set", "@entity.condition", "@payload.condition"],
389
+ ["set", "@entity.action", "@payload.action"],
390
+ ["render-ui", "modal", null],
391
+ ["fetch", "SimRule"],
392
+ ruleEngineBrowsingMainEffect
393
+ ]
394
+ },
395
+ {
396
+ from: "creating",
397
+ to: "browsing",
398
+ event: "CLOSE",
399
+ effects: [
400
+ ["render-ui", "modal", null]
401
+ ]
402
+ },
403
+ {
404
+ from: "creating",
405
+ to: "browsing",
406
+ event: "CANCEL",
407
+ effects: [
408
+ ["render-ui", "modal", null]
409
+ ]
410
+ },
411
+ {
412
+ from: "browsing",
413
+ to: "editing",
414
+ event: "EDIT",
415
+ effects: [
416
+ ["fetch", "SimRule"],
417
+ ruleEngineFormModalEffect
418
+ ]
419
+ },
420
+ {
421
+ from: "editing",
422
+ to: "browsing",
423
+ event: "SAVE",
424
+ effects: [
425
+ ["set", "@entity.name", "@payload.name"],
426
+ ["set", "@entity.condition", "@payload.condition"],
427
+ ["set", "@entity.action", "@payload.action"],
428
+ ["render-ui", "modal", null],
429
+ ["fetch", "SimRule"],
430
+ ruleEngineBrowsingMainEffect
431
+ ]
432
+ },
433
+ {
434
+ from: "editing",
435
+ to: "browsing",
436
+ event: "CLOSE",
437
+ effects: [
438
+ ["render-ui", "modal", null]
439
+ ]
440
+ },
441
+ {
442
+ from: "editing",
443
+ to: "browsing",
444
+ event: "CANCEL",
445
+ effects: [
446
+ ["render-ui", "modal", null]
447
+ ]
448
+ }
449
+ ]
450
+ }
451
+ }
452
+ ],
453
+ pages: [
454
+ {
455
+ name: "RulesPage",
456
+ path: "/rules",
457
+ isInitial: true,
458
+ traits: [{ ref: "RuleEngineControl" }]
459
+ }
460
+ ]
461
+ }
462
+ ]
463
+ };
464
+ var timeStepIdleMainEffect = [
465
+ "render-ui",
466
+ "main",
467
+ { type: "stack", direction: "vertical", gap: "lg", children: [
468
+ // Header: clock icon + title + start button
469
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
470
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
471
+ { type: "icon", name: "cpu", size: "lg" },
472
+ { type: "typography", variant: "h2", content: "Time Control" }
473
+ ] },
474
+ { type: "button", label: "Start", icon: "play", variant: "primary", action: "START" }
475
+ ] },
476
+ { type: "divider" },
477
+ // Config stats
478
+ { type: "stack", direction: "horizontal", gap: "md", children: [
479
+ { type: "stats", label: "Current Step", value: "@entity.step", icon: "hash" },
480
+ { type: "stats", label: "Max Steps", value: "@entity.maxSteps", icon: "bar-chart-2" },
481
+ { type: "stats", label: "Speed", value: "@entity.speed", icon: "zap" }
482
+ ] },
483
+ { type: "divider" },
484
+ // Progress bar at zero
485
+ { type: "progress-bar", value: 0, label: "Progress" }
486
+ ] }
487
+ ];
488
+ var timeStepRunningMainEffect = [
489
+ "render-ui",
490
+ "main",
491
+ { type: "stack", direction: "vertical", gap: "lg", children: [
492
+ // Header: activity icon + title + pause/stop
493
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
494
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
495
+ { type: "icon", name: "activity", size: "lg" },
496
+ { type: "typography", variant: "h2", content: "Running" }
497
+ ] },
498
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
499
+ { type: "button", label: "Pause", icon: "pause", variant: "secondary", action: "PAUSE" },
500
+ { type: "button", label: "Stop", icon: "square", variant: "danger", action: "STOP" }
501
+ ] }
502
+ ] },
503
+ { type: "divider" },
504
+ // Live stats
505
+ { type: "stack", direction: "horizontal", gap: "md", children: [
506
+ { type: "stats", label: "Step", value: "@entity.step", icon: "hash" },
507
+ { type: "stats", label: "Max", value: "@entity.maxSteps", icon: "bar-chart-2" },
508
+ { type: "stats", label: "Speed", value: "@entity.speed", icon: "zap" },
509
+ { type: "badge", label: "Running", variant: "success" }
510
+ ] },
511
+ { type: "divider" },
512
+ // Progress bar
513
+ { type: "progress-bar", value: "@entity.step", max: "@entity.maxSteps", label: "Simulation Progress" },
514
+ // Line chart for step progression
515
+ { type: "line-chart", label: "Step Over Time", entity: "TimeStepState", field: "step" }
516
+ ] }
517
+ ];
518
+ var timeStepPausedMainEffect = [
519
+ "render-ui",
520
+ "main",
521
+ { type: "stack", direction: "vertical", gap: "lg", children: [
522
+ // Header: paused + resume/stop
523
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
524
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
525
+ { type: "icon", name: "pause", size: "lg" },
526
+ { type: "typography", variant: "h2", content: "Paused" }
527
+ ] },
528
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
529
+ { type: "button", label: "Resume", icon: "play", variant: "primary", action: "RESUME" },
530
+ { type: "button", label: "Stop", icon: "square", variant: "danger", action: "STOP" }
531
+ ] }
532
+ ] },
533
+ { type: "divider" },
534
+ // Stats with paused badge
535
+ { type: "stack", direction: "horizontal", gap: "md", children: [
536
+ { type: "stats", label: "Step", value: "@entity.step", icon: "hash" },
537
+ { type: "stats", label: "Max", value: "@entity.maxSteps", icon: "bar-chart-2" },
538
+ { type: "badge", label: "Paused", variant: "warning" }
539
+ ] },
540
+ { type: "divider" },
541
+ { type: "progress-bar", value: "@entity.step", max: "@entity.maxSteps", label: "Simulation Progress" }
542
+ ] }
543
+ ];
544
+ var timeStepCompletedMainEffect = [
545
+ "render-ui",
546
+ "main",
547
+ { type: "stack", direction: "vertical", gap: "lg", children: [
548
+ // Header: completed + reset
549
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
550
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
551
+ { type: "icon", name: "bar-chart-2", size: "lg" },
552
+ { type: "typography", variant: "h2", content: "Simulation Done" }
553
+ ] },
554
+ { type: "button", label: "Reset", icon: "refresh-cw", variant: "primary", action: "RESET" }
555
+ ] },
556
+ { type: "divider" },
557
+ // Final stats
558
+ { type: "stack", direction: "horizontal", gap: "md", children: [
559
+ { type: "stats", label: "Total Steps", value: "@entity.step", icon: "hash" },
560
+ { type: "stats", label: "Max Steps", value: "@entity.maxSteps", icon: "bar-chart-2" },
561
+ { type: "badge", label: "Completed", variant: "default" }
562
+ ] },
563
+ { type: "divider" },
564
+ { type: "progress-bar", value: "@entity.step", max: "@entity.maxSteps", label: "Final Progress" }
565
+ ] }
566
+ ];
567
+ var TIME_STEP_BEHAVIOR = {
568
+ name: "std-time-step",
569
+ version: "1.0.0",
570
+ description: "Time-step control for simulations with tick increment",
571
+ theme: SIMULATION_THEME,
572
+ orbitals: [
573
+ {
574
+ name: "TimeStepOrbital",
575
+ entity: {
576
+ name: "TimeStepState",
577
+ persistence: "runtime",
578
+ fields: [
579
+ { name: "id", type: "string", required: true },
580
+ { name: "step", type: "number", default: 0 },
581
+ { name: "maxSteps", type: "number", default: 1e3 },
582
+ { name: "speed", type: "number", default: 1 },
583
+ { name: "isRunning", type: "boolean", default: false }
584
+ ]
585
+ },
586
+ traits: [
587
+ {
588
+ name: "TimeStepControl",
589
+ linkedEntity: "TimeStepState",
590
+ category: "interaction",
591
+ stateMachine: {
592
+ states: [
593
+ { name: "idle", isInitial: true },
594
+ { name: "running" },
595
+ { name: "paused" },
596
+ { name: "completed" }
597
+ ],
598
+ events: [
599
+ { key: "INIT", name: "Initialize" },
600
+ { key: "START", name: "Start" },
601
+ { key: "PAUSE", name: "Pause" },
602
+ { key: "RESUME", name: "Resume" },
603
+ { key: "STOP", name: "Stop" },
604
+ { key: "RESET", name: "Reset" }
605
+ ],
606
+ transitions: [
607
+ {
608
+ from: "idle",
609
+ to: "idle",
610
+ event: "INIT",
611
+ effects: [
612
+ ["set", "@entity.step", 0],
613
+ ["set", "@entity.isRunning", false],
614
+ timeStepIdleMainEffect
615
+ ]
616
+ },
617
+ {
618
+ from: "idle",
619
+ to: "running",
620
+ event: "START",
621
+ effects: [
622
+ ["set", "@entity.isRunning", true],
623
+ ["set", "@entity.step", 0],
624
+ timeStepRunningMainEffect
625
+ ]
626
+ },
627
+ {
628
+ from: "running",
629
+ to: "paused",
630
+ event: "PAUSE",
631
+ effects: [
632
+ ["set", "@entity.isRunning", false],
633
+ timeStepPausedMainEffect
634
+ ]
635
+ },
636
+ {
637
+ from: "paused",
638
+ to: "running",
639
+ event: "RESUME",
640
+ effects: [
641
+ ["set", "@entity.isRunning", true],
642
+ timeStepRunningMainEffect
643
+ ]
644
+ },
645
+ {
646
+ from: "running",
647
+ to: "completed",
648
+ event: "STOP",
649
+ effects: [
650
+ ["set", "@entity.isRunning", false],
651
+ timeStepCompletedMainEffect
652
+ ]
653
+ },
654
+ {
655
+ from: "paused",
656
+ to: "completed",
657
+ event: "STOP",
658
+ effects: [
659
+ ["set", "@entity.isRunning", false],
660
+ timeStepCompletedMainEffect
661
+ ]
662
+ },
663
+ {
664
+ from: "completed",
665
+ to: "idle",
666
+ event: "RESET",
667
+ effects: [
668
+ ["set", "@entity.step", 0],
669
+ ["set", "@entity.isRunning", false],
670
+ timeStepIdleMainEffect
671
+ ]
672
+ }
673
+ ]
674
+ },
675
+ ticks: [
676
+ {
677
+ name: "StepTick",
678
+ interval: "frame",
679
+ guard: ["=", "@state", "running"],
680
+ effects: [
681
+ ["set", "@entity.step", ["+", "@entity.step", 1]]
682
+ ]
683
+ }
684
+ ]
685
+ }
686
+ ],
687
+ pages: [
688
+ {
689
+ name: "TimeStepPage",
690
+ path: "/time-step",
691
+ isInitial: true,
692
+ traits: [{ ref: "TimeStepControl" }]
693
+ }
694
+ ]
695
+ }
696
+ ]
697
+ };
698
+ var SIMULATION_BEHAVIORS = [
699
+ AGENT_SIM_BEHAVIOR,
700
+ RULE_ENGINE_BEHAVIOR,
701
+ TIME_STEP_BEHAVIOR
702
+ ];
703
+
704
+ export { AGENT_SIM_BEHAVIOR, RULE_ENGINE_BEHAVIOR, SIMULATION_BEHAVIORS, TIME_STEP_BEHAVIOR };
705
+ //# sourceMappingURL=simulation.js.map
706
+ //# sourceMappingURL=simulation.js.map