@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,860 @@
1
+ // behaviors/domain/game-2d-rpg.ts
2
+ var RPG_THEME = {
3
+ name: "game-rpg-purple",
4
+ tokens: {
5
+ colors: {
6
+ primary: "#7c3aed",
7
+ "primary-hover": "#6d28d9",
8
+ "primary-foreground": "#ffffff",
9
+ accent: "#a78bfa",
10
+ "accent-foreground": "#000000",
11
+ success: "#22c55e",
12
+ warning: "#f59e0b",
13
+ error: "#ef4444"
14
+ }
15
+ }
16
+ };
17
+ var KFLOW_ASSETS = "https://almadar-kflow-assets.web.app/shared";
18
+ var GAME_MANIFEST = {
19
+ terrain: {
20
+ stone: "/terrain/Isometric/stoneSide_N.png",
21
+ dirt: "/terrain/Isometric/dirt_N.png",
22
+ bridge: "/terrain/Isometric/stoneStep_N.png",
23
+ wall: "/terrain/Isometric/stoneWallArchway_N.png"
24
+ },
25
+ units: {
26
+ guardian: "/sprite-sheets/guardian-sprite-sheet-se.png",
27
+ breaker: "/sprite-sheets/breaker-sprite-sheet-se.png",
28
+ archivist: "/sprite-sheets/archivist-sprite-sheet-se.png"
29
+ },
30
+ features: {
31
+ gold_mine: "/world-map/gold_mine.png",
32
+ portal: "/world-map/portal_open.png",
33
+ treasure: "/world-map/treasure_chest_closed.png",
34
+ battle_marker: "/world-map/battle_marker.png",
35
+ power_node: "/world-map/power_node.png"
36
+ }
37
+ };
38
+ var TILES_8X6 = [];
39
+ for (let y = 0; y < 6; y++) {
40
+ for (let x = 0; x < 8; x++) {
41
+ TILES_8X6.push({ x, y, terrain: (x + y) % 3 === 0 ? "stone" : (x + y) % 3 === 1 ? "dirt" : "bridge" });
42
+ }
43
+ }
44
+ var TILES_5X5 = [
45
+ { x: 0, y: 0, terrain: "stone" },
46
+ { x: 1, y: 0, terrain: "dirt" },
47
+ { x: 2, y: 0, terrain: "stone" },
48
+ { x: 3, y: 0, terrain: "dirt" },
49
+ { x: 4, y: 0, terrain: "stone" },
50
+ { x: 0, y: 1, terrain: "dirt" },
51
+ { x: 1, y: 1, terrain: "stone" },
52
+ { x: 2, y: 1, terrain: "dirt" },
53
+ { x: 3, y: 1, terrain: "stone" },
54
+ { x: 4, y: 1, terrain: "dirt" },
55
+ { x: 0, y: 2, terrain: "stone" },
56
+ { x: 1, y: 2, terrain: "dirt" },
57
+ { x: 2, y: 2, terrain: "bridge" },
58
+ { x: 3, y: 2, terrain: "dirt" },
59
+ { x: 4, y: 2, terrain: "stone" },
60
+ { x: 0, y: 3, terrain: "dirt" },
61
+ { x: 1, y: 3, terrain: "stone" },
62
+ { x: 2, y: 3, terrain: "dirt" },
63
+ { x: 3, y: 3, terrain: "stone" },
64
+ { x: 4, y: 3, terrain: "dirt" },
65
+ { x: 0, y: 4, terrain: "stone" },
66
+ { x: 1, y: 4, terrain: "dirt" },
67
+ { x: 2, y: 4, terrain: "stone" },
68
+ { x: 3, y: 4, terrain: "wall" },
69
+ { x: 4, y: 4, terrain: "stone" }
70
+ ];
71
+ var overworldExploringMainEffect = ["render-ui", "main", {
72
+ type: "isometric-canvas",
73
+ tiles: TILES_8X6,
74
+ units: [{ id: "player", x: 3, y: 2, unitType: "guardian" }],
75
+ features: [
76
+ { id: "mine", x: 1, y: 1, featureType: "gold_mine" },
77
+ { id: "portal", x: 6, y: 4, featureType: "portal" },
78
+ { id: "chest", x: 4, y: 0, featureType: "treasure" }
79
+ ],
80
+ scale: 0.4,
81
+ boardWidth: 8,
82
+ boardHeight: 6,
83
+ enableCamera: true,
84
+ tileClickEvent: "MOVE",
85
+ assetBaseUrl: KFLOW_ASSETS,
86
+ assetManifest: GAME_MANIFEST
87
+ }];
88
+ var overworldExploringHud = ["render-ui", "overlay", {
89
+ type: "stack",
90
+ direction: "vertical",
91
+ gap: "md",
92
+ children: [
93
+ { type: "game-hud", position: "top", elements: [
94
+ { label: "Zone", value: "@entity.currentZone", icon: "map-pin" },
95
+ { label: "X", value: "@entity.playerX", icon: "compass" },
96
+ { label: "Y", value: "@entity.playerY", icon: "compass" }
97
+ ] },
98
+ { type: "button", label: "Travel to Zone", action: "TRAVEL", icon: "map", variant: "primary" }
99
+ ]
100
+ }];
101
+ var overworldTravelingMainEffect = ["render-ui", "main", {
102
+ type: "isometric-canvas",
103
+ tiles: TILES_8X6,
104
+ units: [{ id: "player", x: 4, y: 3, unitType: "guardian" }],
105
+ features: [
106
+ { id: "mine", x: 1, y: 1, featureType: "gold_mine" },
107
+ { id: "portal", x: 6, y: 4, featureType: "portal" }
108
+ ],
109
+ scale: 0.4,
110
+ boardWidth: 8,
111
+ boardHeight: 6,
112
+ enableCamera: true,
113
+ assetBaseUrl: KFLOW_ASSETS,
114
+ assetManifest: GAME_MANIFEST
115
+ }];
116
+ var overworldTravelingHud = ["render-ui", "overlay", {
117
+ type: "stack",
118
+ direction: "vertical",
119
+ gap: "md",
120
+ children: [
121
+ { type: "progress-bar", value: 50, max: 100, label: "Travel Progress" },
122
+ { type: "badge", label: "@entity.currentZone", icon: "map-pin", variant: "primary" },
123
+ { type: "button", label: "Arrive", action: "ARRIVE", icon: "flag", variant: "primary" }
124
+ ]
125
+ }];
126
+ var overworldEventMainEffect = ["render-ui", "main", {
127
+ type: "isometric-canvas",
128
+ tiles: TILES_8X6,
129
+ units: [{ id: "player", x: 3, y: 2, unitType: "guardian" }],
130
+ features: [
131
+ { id: "battle", x: 3, y: 2, featureType: "battle_marker" }
132
+ ],
133
+ scale: 0.4,
134
+ boardWidth: 8,
135
+ boardHeight: 6,
136
+ enableCamera: true,
137
+ assetBaseUrl: KFLOW_ASSETS,
138
+ assetManifest: GAME_MANIFEST
139
+ }];
140
+ var overworldEventHud = ["render-ui", "overlay", {
141
+ type: "stack",
142
+ direction: "vertical",
143
+ gap: "md",
144
+ children: [
145
+ { type: "game-hud", position: "top", elements: [
146
+ { label: "Zone", value: "@entity.currentZone", icon: "map-pin" }
147
+ ] },
148
+ { type: "badge", label: "World Event!", icon: "swords", variant: "warning" },
149
+ { type: "button", label: "Resolve Event", action: "RESOLVE_EVENT", icon: "check-circle", variant: "primary" }
150
+ ]
151
+ }];
152
+ var OVERWORLD_BEHAVIOR = {
153
+ name: "std-overworld",
154
+ version: "1.0.0",
155
+ description: "Zone-based world map navigation for RPG overworld",
156
+ theme: RPG_THEME,
157
+ orbitals: [
158
+ {
159
+ name: "OverworldOrbital",
160
+ entity: {
161
+ name: "OverworldData",
162
+ persistence: "runtime",
163
+ fields: [
164
+ { name: "id", type: "string", required: true },
165
+ { name: "currentZone", type: "string", default: "town" },
166
+ { name: "playerX", type: "number", default: 0 },
167
+ { name: "playerY", type: "number", default: 0 }
168
+ ]
169
+ },
170
+ traits: [
171
+ {
172
+ name: "Overworld",
173
+ linkedEntity: "OverworldData",
174
+ category: "interaction",
175
+ stateMachine: {
176
+ states: [
177
+ { name: "Exploring", isInitial: true },
178
+ { name: "Traveling" },
179
+ { name: "Event" }
180
+ ],
181
+ events: [
182
+ { key: "INIT", name: "Initialize" },
183
+ { key: "MOVE", name: "Move", payloadSchema: [
184
+ { name: "dx", type: "number", required: true },
185
+ { name: "dy", type: "number", required: true }
186
+ ] },
187
+ { key: "TRAVEL", name: "Travel", payloadSchema: [
188
+ { name: "zone", type: "string", required: true }
189
+ ] },
190
+ { key: "ARRIVE", name: "Arrive" },
191
+ { key: "TRIGGER_EVENT", name: "Trigger Event" },
192
+ { key: "RESOLVE_EVENT", name: "Resolve Event" }
193
+ ],
194
+ transitions: [
195
+ {
196
+ from: "Exploring",
197
+ to: "Exploring",
198
+ event: "INIT",
199
+ effects: [
200
+ ["fetch", "OverworldData"],
201
+ ["set", "@entity.currentZone", "town"],
202
+ ["set", "@entity.playerX", 0],
203
+ ["set", "@entity.playerY", 0],
204
+ overworldExploringMainEffect,
205
+ overworldExploringHud
206
+ ]
207
+ },
208
+ {
209
+ from: "Exploring",
210
+ to: "Exploring",
211
+ event: "MOVE",
212
+ effects: [
213
+ ["fetch", "OverworldData"],
214
+ ["set", "@entity.playerX", ["+", "@entity.playerX", "@payload.dx"]],
215
+ ["set", "@entity.playerY", ["+", "@entity.playerY", "@payload.dy"]],
216
+ overworldExploringMainEffect,
217
+ overworldExploringHud
218
+ ]
219
+ },
220
+ {
221
+ from: "Exploring",
222
+ to: "Traveling",
223
+ event: "TRAVEL",
224
+ effects: [
225
+ ["set", "@entity.currentZone", "@payload.zone"],
226
+ overworldTravelingMainEffect,
227
+ overworldTravelingHud
228
+ ]
229
+ },
230
+ {
231
+ from: "Traveling",
232
+ to: "Exploring",
233
+ event: "ARRIVE",
234
+ effects: [
235
+ ["fetch", "OverworldData"],
236
+ ["set", "@entity.playerX", 0],
237
+ ["set", "@entity.playerY", 0],
238
+ overworldExploringMainEffect,
239
+ overworldExploringHud
240
+ ]
241
+ },
242
+ {
243
+ from: "Exploring",
244
+ to: "Event",
245
+ event: "TRIGGER_EVENT",
246
+ effects: [
247
+ overworldEventMainEffect,
248
+ overworldEventHud
249
+ ]
250
+ },
251
+ {
252
+ from: "Event",
253
+ to: "Exploring",
254
+ event: "RESOLVE_EVENT",
255
+ effects: [
256
+ ["fetch", "OverworldData"],
257
+ overworldExploringMainEffect,
258
+ overworldExploringHud
259
+ ]
260
+ }
261
+ ]
262
+ }
263
+ }
264
+ ],
265
+ pages: [
266
+ {
267
+ name: "OverworldPage",
268
+ path: "/overworld",
269
+ isInitial: true,
270
+ traits: [{ ref: "Overworld" }]
271
+ }
272
+ ]
273
+ }
274
+ ]
275
+ };
276
+ var questListMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
277
+ // Header: scroll icon + title
278
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
279
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
280
+ { type: "icon", name: "scroll", size: "lg" },
281
+ { type: "typography", variant: "h2", content: "Quests" }
282
+ ] }
283
+ ] },
284
+ { type: "divider" },
285
+ // Quest data list
286
+ {
287
+ type: "data-list",
288
+ entity: "Quest",
289
+ variant: "card",
290
+ fields: [
291
+ { name: "title", label: "Quest", icon: "scroll", variant: "h4" },
292
+ { name: "description", label: "Description", icon: "file-text", variant: "body" },
293
+ { name: "status", label: "Status", icon: "flag", variant: "badge" },
294
+ { name: "reward", label: "Reward", icon: "gem", variant: "body", format: "number" }
295
+ ],
296
+ itemActions: [
297
+ { label: "View", event: "VIEW", icon: "eye", variant: "secondary" }
298
+ ]
299
+ }
300
+ ] }];
301
+ var questDetailModalEffect = ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
302
+ // Modal header
303
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
304
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
305
+ { type: "icon", name: "scroll", size: "md" },
306
+ { type: "typography", variant: "h3", content: "@entity.title" }
307
+ ] },
308
+ { type: "badge", label: "@entity.status", icon: "flag", variant: "accent" }
309
+ ] },
310
+ { type: "divider" },
311
+ // Quest details
312
+ { type: "stack", direction: "vertical", gap: "sm", children: [
313
+ { type: "typography", variant: "body", content: "@entity.description" },
314
+ { type: "stats", label: "Reward", icon: "gem", value: "@entity.reward" }
315
+ ] },
316
+ { type: "divider" },
317
+ // Actions
318
+ { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
319
+ { type: "button", label: "Close", icon: "x", variant: "secondary", action: "CLOSE" }
320
+ ] }
321
+ ] }];
322
+ var closeModalEffect = ["render-ui", "modal", null];
323
+ var QUEST_BEHAVIOR = {
324
+ name: "std-quest",
325
+ version: "1.0.0",
326
+ description: "Quest tracking with status progression",
327
+ theme: RPG_THEME,
328
+ orbitals: [
329
+ {
330
+ name: "QuestOrbital",
331
+ entity: {
332
+ name: "Quest",
333
+ persistence: "persistent",
334
+ collection: "quests",
335
+ fields: [
336
+ { name: "id", type: "string", required: true },
337
+ { name: "title", type: "string", default: "" },
338
+ { name: "description", type: "string", default: "" },
339
+ { name: "status", type: "string", default: "available" },
340
+ { name: "reward", type: "number", default: 0 }
341
+ ]
342
+ },
343
+ traits: [
344
+ {
345
+ name: "QuestTracker",
346
+ linkedEntity: "Quest",
347
+ category: "interaction",
348
+ stateMachine: {
349
+ states: [
350
+ { name: "Available", isInitial: true },
351
+ { name: "Active" },
352
+ { name: "Completed" },
353
+ { name: "Failed" }
354
+ ],
355
+ events: [
356
+ { key: "INIT", name: "Initialize" },
357
+ { key: "ACCEPT", name: "Accept Quest" },
358
+ { key: "COMPLETE", name: "Complete Quest" },
359
+ { key: "FAIL", name: "Fail Quest" },
360
+ { key: "RESET", name: "Reset Quest" },
361
+ { key: "VIEW", name: "View Quest" },
362
+ { key: "CLOSE", name: "Close" },
363
+ { key: "CANCEL", name: "Cancel" }
364
+ ],
365
+ transitions: [
366
+ {
367
+ from: "Available",
368
+ to: "Available",
369
+ event: "INIT",
370
+ effects: [
371
+ ["fetch", "Quest"],
372
+ questListMainEffect
373
+ ]
374
+ },
375
+ {
376
+ from: "Available",
377
+ to: "Active",
378
+ event: "ACCEPT",
379
+ effects: [
380
+ ["fetch", "Quest"],
381
+ ["set", "@entity.status", "active"],
382
+ questListMainEffect
383
+ ]
384
+ },
385
+ {
386
+ from: "Active",
387
+ to: "Completed",
388
+ event: "COMPLETE",
389
+ effects: [
390
+ ["fetch", "Quest"],
391
+ ["set", "@entity.status", "completed"],
392
+ questListMainEffect
393
+ ]
394
+ },
395
+ {
396
+ from: "Active",
397
+ to: "Failed",
398
+ event: "FAIL",
399
+ effects: [
400
+ ["fetch", "Quest"],
401
+ ["set", "@entity.status", "failed"],
402
+ questListMainEffect
403
+ ]
404
+ },
405
+ {
406
+ from: "Completed",
407
+ to: "Available",
408
+ event: "RESET",
409
+ effects: [
410
+ ["fetch", "Quest"],
411
+ ["set", "@entity.status", "available"],
412
+ questListMainEffect
413
+ ]
414
+ },
415
+ {
416
+ from: "Failed",
417
+ to: "Available",
418
+ event: "RESET",
419
+ effects: [
420
+ ["fetch", "Quest"],
421
+ ["set", "@entity.status", "available"],
422
+ questListMainEffect
423
+ ]
424
+ },
425
+ // VIEW from all states
426
+ {
427
+ from: "Available",
428
+ to: "Available",
429
+ event: "VIEW",
430
+ effects: [questDetailModalEffect]
431
+ },
432
+ {
433
+ from: "Active",
434
+ to: "Active",
435
+ event: "VIEW",
436
+ effects: [questDetailModalEffect]
437
+ },
438
+ {
439
+ from: "Completed",
440
+ to: "Completed",
441
+ event: "VIEW",
442
+ effects: [questDetailModalEffect]
443
+ },
444
+ {
445
+ from: "Failed",
446
+ to: "Failed",
447
+ event: "VIEW",
448
+ effects: [questDetailModalEffect]
449
+ },
450
+ // CLOSE from all states
451
+ { from: "Available", to: "Available", event: "CLOSE", effects: [closeModalEffect] },
452
+ { from: "Active", to: "Active", event: "CLOSE", effects: [closeModalEffect] },
453
+ { from: "Completed", to: "Completed", event: "CLOSE", effects: [closeModalEffect] },
454
+ { from: "Failed", to: "Failed", event: "CLOSE", effects: [closeModalEffect] },
455
+ // CANCEL from all states
456
+ { from: "Available", to: "Available", event: "CANCEL", effects: [closeModalEffect] },
457
+ { from: "Active", to: "Active", event: "CANCEL", effects: [closeModalEffect] },
458
+ { from: "Completed", to: "Completed", event: "CANCEL", effects: [closeModalEffect] },
459
+ { from: "Failed", to: "Failed", event: "CANCEL", effects: [closeModalEffect] }
460
+ ]
461
+ }
462
+ }
463
+ ],
464
+ pages: [
465
+ {
466
+ name: "QuestsPage",
467
+ path: "/quests",
468
+ isInitial: true,
469
+ traits: [{ ref: "QuestTracker" }]
470
+ }
471
+ ]
472
+ }
473
+ ]
474
+ };
475
+ var npcIdleMainEffect = ["render-ui", "main", {
476
+ type: "isometric-canvas",
477
+ tiles: TILES_5X5,
478
+ units: [{ id: "npc", x: 2, y: 2, unitType: "archivist" }],
479
+ scale: 0.5,
480
+ boardWidth: 5,
481
+ boardHeight: 5,
482
+ enableCamera: false,
483
+ assetBaseUrl: KFLOW_ASSETS,
484
+ assetManifest: GAME_MANIFEST
485
+ }];
486
+ var npcIdleHud = ["render-ui", "overlay", {
487
+ type: "stack",
488
+ direction: "vertical",
489
+ gap: "md",
490
+ children: [
491
+ { type: "game-hud", position: "top", elements: [
492
+ { label: "NPC", value: "@entity.name", icon: "crown" },
493
+ { label: "Disposition", value: "@entity.disposition", icon: "heart" }
494
+ ] },
495
+ { type: "button", label: "Talk", action: "TALK", icon: "message-circle", variant: "primary" }
496
+ ]
497
+ }];
498
+ var npcTalkingMainEffect = ["render-ui", "main", {
499
+ type: "isometric-canvas",
500
+ tiles: TILES_5X5,
501
+ units: [{ id: "npc", x: 2, y: 2, unitType: "archivist" }],
502
+ scale: 0.5,
503
+ boardWidth: 5,
504
+ boardHeight: 5,
505
+ enableCamera: false,
506
+ assetBaseUrl: KFLOW_ASSETS,
507
+ assetManifest: GAME_MANIFEST
508
+ }];
509
+ var npcTalkingModal = ["render-ui", "modal", {
510
+ type: "stack",
511
+ direction: "vertical",
512
+ gap: "md",
513
+ children: [
514
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
515
+ { type: "icon", name: "message-circle" },
516
+ { type: "typography", variant: "h3", content: "@entity.name" }
517
+ ] },
518
+ { type: "divider" },
519
+ { type: "typography", variant: "body", content: "@entity.dialogue" },
520
+ { type: "badge", label: "@entity.disposition", icon: "heart", variant: "accent" },
521
+ { type: "divider" },
522
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
523
+ { type: "button", label: "Trade", action: "TRADE", icon: "gem", variant: "primary" },
524
+ { type: "button", label: "End Talk", action: "END_TALK", icon: "x", variant: "secondary" }
525
+ ] }
526
+ ]
527
+ }];
528
+ var npcTradingMainEffect = ["render-ui", "main", {
529
+ type: "isometric-canvas",
530
+ tiles: TILES_5X5,
531
+ units: [{ id: "npc", x: 2, y: 2, unitType: "archivist" }],
532
+ scale: 0.5,
533
+ boardWidth: 5,
534
+ boardHeight: 5,
535
+ enableCamera: false,
536
+ assetBaseUrl: KFLOW_ASSETS,
537
+ assetManifest: GAME_MANIFEST
538
+ }];
539
+ var npcTradingModal = ["render-ui", "modal", {
540
+ type: "stack",
541
+ direction: "vertical",
542
+ gap: "md",
543
+ children: [
544
+ { type: "stack", direction: "horizontal", justify: "space-between", children: [
545
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
546
+ { type: "icon", name: "gem" },
547
+ { type: "typography", variant: "h3", content: "Trading" }
548
+ ] },
549
+ { type: "badge", label: "@entity.name", icon: "crown", variant: "primary" }
550
+ ] },
551
+ { type: "divider" },
552
+ { type: "typography", variant: "body", content: "Browse wares and make your trade." },
553
+ { type: "stack", direction: "horizontal", gap: "md", children: [
554
+ { type: "stats", label: "Merchant", icon: "crown", value: "@entity.name" },
555
+ { type: "stats", label: "Disposition", icon: "heart", value: "@entity.disposition" }
556
+ ] },
557
+ { type: "divider" },
558
+ { type: "button", label: "End Trade", action: "END_TRADE", icon: "x", variant: "secondary" }
559
+ ]
560
+ }];
561
+ var NPC_BEHAVIOR = {
562
+ name: "std-npc",
563
+ version: "1.0.0",
564
+ description: "NPC interaction with dialogue and trading",
565
+ theme: RPG_THEME,
566
+ orbitals: [
567
+ {
568
+ name: "NpcOrbital",
569
+ entity: {
570
+ name: "NpcData",
571
+ persistence: "runtime",
572
+ fields: [
573
+ { name: "id", type: "string", required: true },
574
+ { name: "name", type: "string", default: "" },
575
+ { name: "dialogue", type: "string", default: "" },
576
+ { name: "disposition", type: "string", default: "neutral" }
577
+ ]
578
+ },
579
+ traits: [
580
+ {
581
+ name: "NpcInteraction",
582
+ linkedEntity: "NpcData",
583
+ category: "interaction",
584
+ stateMachine: {
585
+ states: [
586
+ { name: "Idle", isInitial: true },
587
+ { name: "Talking" },
588
+ { name: "Trading" }
589
+ ],
590
+ events: [
591
+ { key: "INIT", name: "Initialize" },
592
+ { key: "TALK", name: "Talk" },
593
+ { key: "TRADE", name: "Trade" },
594
+ { key: "END_TALK", name: "End Talk" },
595
+ { key: "END_TRADE", name: "End Trade" },
596
+ { key: "CLOSE", name: "Close" },
597
+ { key: "CANCEL", name: "Cancel" }
598
+ ],
599
+ transitions: [
600
+ {
601
+ from: "Idle",
602
+ to: "Idle",
603
+ event: "INIT",
604
+ effects: [
605
+ ["set", "@entity.dialogue", ""],
606
+ npcIdleMainEffect,
607
+ npcIdleHud
608
+ ]
609
+ },
610
+ {
611
+ from: "Idle",
612
+ to: "Talking",
613
+ event: "TALK",
614
+ effects: [
615
+ npcTalkingMainEffect,
616
+ npcTalkingModal
617
+ ]
618
+ },
619
+ {
620
+ from: "Talking",
621
+ to: "Trading",
622
+ event: "TRADE",
623
+ effects: [
624
+ ["fetch", "NpcData"],
625
+ npcTradingMainEffect,
626
+ npcTradingModal
627
+ ]
628
+ },
629
+ {
630
+ from: "Talking",
631
+ to: "Idle",
632
+ event: "END_TALK",
633
+ effects: [
634
+ ["render-ui", "modal", null],
635
+ npcIdleMainEffect,
636
+ npcIdleHud
637
+ ]
638
+ },
639
+ {
640
+ from: "Trading",
641
+ to: "Idle",
642
+ event: "END_TRADE",
643
+ effects: [
644
+ ["render-ui", "modal", null],
645
+ npcIdleMainEffect,
646
+ npcIdleHud
647
+ ]
648
+ },
649
+ // CLOSE/CANCEL from modal states
650
+ { from: "Talking", to: "Idle", event: "CLOSE", effects: [["render-ui", "modal", null], npcIdleMainEffect, npcIdleHud] },
651
+ { from: "Talking", to: "Idle", event: "CANCEL", effects: [["render-ui", "modal", null], npcIdleMainEffect, npcIdleHud] },
652
+ { from: "Trading", to: "Idle", event: "CLOSE", effects: [["render-ui", "modal", null], npcIdleMainEffect, npcIdleHud] },
653
+ { from: "Trading", to: "Idle", event: "CANCEL", effects: [["render-ui", "modal", null], npcIdleMainEffect, npcIdleHud] }
654
+ ]
655
+ }
656
+ }
657
+ ],
658
+ pages: [
659
+ {
660
+ name: "NpcPage",
661
+ path: "/npc",
662
+ isInitial: true,
663
+ traits: [{ ref: "NpcInteraction" }]
664
+ }
665
+ ]
666
+ }
667
+ ]
668
+ };
669
+ var craftingBrowsingMainEffect = ["render-ui", "main", {
670
+ type: "isometric-canvas",
671
+ tiles: TILES_5X5,
672
+ units: [{ id: "crafter", x: 2, y: 2, unitType: "guardian" }],
673
+ scale: 0.5,
674
+ boardWidth: 5,
675
+ boardHeight: 5,
676
+ enableCamera: false,
677
+ assetBaseUrl: KFLOW_ASSETS,
678
+ assetManifest: GAME_MANIFEST
679
+ }];
680
+ var craftingBrowsingHud = ["render-ui", "overlay", {
681
+ type: "stack",
682
+ direction: "vertical",
683
+ gap: "md",
684
+ children: [
685
+ { type: "game-hud", position: "top", elements: [
686
+ { label: "Recipe", value: "@entity.selectedRecipe", icon: "scroll" },
687
+ { label: "Materials", value: "@entity.materials", icon: "backpack" }
688
+ ] },
689
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
690
+ { type: "button", label: "Select Recipe", action: "SELECT_RECIPE", icon: "scroll", variant: "secondary" },
691
+ { type: "button", label: "Craft", action: "CRAFT", icon: "wand-2", variant: "primary" }
692
+ ] }
693
+ ]
694
+ }];
695
+ var craftingInProgressMainEffect = ["render-ui", "main", {
696
+ type: "isometric-canvas",
697
+ tiles: TILES_5X5,
698
+ units: [{ id: "crafter", x: 2, y: 2, unitType: "guardian" }],
699
+ scale: 0.5,
700
+ boardWidth: 5,
701
+ boardHeight: 5,
702
+ enableCamera: false,
703
+ assetBaseUrl: KFLOW_ASSETS,
704
+ assetManifest: GAME_MANIFEST
705
+ }];
706
+ var craftingInProgressHud = ["render-ui", "overlay", {
707
+ type: "stack",
708
+ direction: "vertical",
709
+ gap: "md",
710
+ children: [
711
+ { type: "typography", variant: "h3", content: "Crafting..." },
712
+ { type: "progress-bar", value: 75, max: 100, label: "Crafting Progress" },
713
+ { type: "stats", label: "Recipe", icon: "scroll", value: "@entity.selectedRecipe" },
714
+ { type: "button", label: "Collect", action: "COLLECT", icon: "gem", variant: "primary" }
715
+ ]
716
+ }];
717
+ var craftingDoneMainEffect = ["render-ui", "main", {
718
+ type: "isometric-canvas",
719
+ tiles: TILES_5X5,
720
+ units: [{ id: "crafter", x: 2, y: 2, unitType: "guardian" }],
721
+ scale: 0.5,
722
+ boardWidth: 5,
723
+ boardHeight: 5,
724
+ enableCamera: false,
725
+ assetBaseUrl: KFLOW_ASSETS,
726
+ assetManifest: GAME_MANIFEST
727
+ }];
728
+ var craftingDoneHud = ["render-ui", "overlay", {
729
+ type: "stack",
730
+ direction: "vertical",
731
+ gap: "md",
732
+ children: [
733
+ { type: "stack", direction: "horizontal", gap: "sm", children: [
734
+ { type: "icon", name: "gem" },
735
+ { type: "typography", variant: "h3", content: "Item Crafted!" }
736
+ ] },
737
+ { type: "stats", label: "Crafted Item", icon: "gem", value: "@entity.result" },
738
+ { type: "badge", label: "@entity.selectedRecipe", icon: "scroll", variant: "success" },
739
+ { type: "button", label: "Back to Recipes", action: "BACK", icon: "arrow-left", variant: "secondary" }
740
+ ]
741
+ }];
742
+ var CRAFTING_BEHAVIOR = {
743
+ name: "std-crafting",
744
+ version: "1.0.0",
745
+ description: "Recipe-based item crafting system",
746
+ theme: RPG_THEME,
747
+ orbitals: [
748
+ {
749
+ name: "CraftingOrbital",
750
+ entity: {
751
+ name: "CraftingData",
752
+ persistence: "runtime",
753
+ fields: [
754
+ { name: "id", type: "string", required: true },
755
+ { name: "selectedRecipe", type: "string", default: "" },
756
+ { name: "materials", type: "string", default: "" },
757
+ { name: "result", type: "string", default: "" }
758
+ ]
759
+ },
760
+ traits: [
761
+ {
762
+ name: "Crafting",
763
+ linkedEntity: "CraftingData",
764
+ category: "interaction",
765
+ stateMachine: {
766
+ states: [
767
+ { name: "Browsing", isInitial: true },
768
+ { name: "Crafting" },
769
+ { name: "Done" }
770
+ ],
771
+ events: [
772
+ { key: "INIT", name: "Initialize" },
773
+ { key: "SELECT_RECIPE", name: "Select Recipe", payloadSchema: [
774
+ { name: "recipe", type: "string", required: true }
775
+ ] },
776
+ { key: "CRAFT", name: "Craft" },
777
+ { key: "COLLECT", name: "Collect Result" },
778
+ { key: "BACK", name: "Back to Browsing" }
779
+ ],
780
+ transitions: [
781
+ {
782
+ from: "Browsing",
783
+ to: "Browsing",
784
+ event: "INIT",
785
+ effects: [
786
+ ["fetch", "CraftingData"],
787
+ ["set", "@entity.selectedRecipe", ""],
788
+ ["set", "@entity.result", ""],
789
+ craftingBrowsingMainEffect,
790
+ craftingBrowsingHud
791
+ ]
792
+ },
793
+ {
794
+ from: "Browsing",
795
+ to: "Browsing",
796
+ event: "SELECT_RECIPE",
797
+ effects: [
798
+ ["fetch", "CraftingData"],
799
+ ["set", "@entity.selectedRecipe", "@payload.recipe"],
800
+ craftingBrowsingMainEffect,
801
+ craftingBrowsingHud
802
+ ]
803
+ },
804
+ {
805
+ from: "Browsing",
806
+ to: "Crafting",
807
+ event: "CRAFT",
808
+ guard: ["!=", "@entity.selectedRecipe", ""],
809
+ effects: [
810
+ craftingInProgressMainEffect,
811
+ craftingInProgressHud
812
+ ]
813
+ },
814
+ {
815
+ from: "Crafting",
816
+ to: "Done",
817
+ event: "COLLECT",
818
+ effects: [
819
+ ["set", "@entity.result", "@entity.selectedRecipe"],
820
+ craftingDoneMainEffect,
821
+ craftingDoneHud
822
+ ]
823
+ },
824
+ {
825
+ from: "Done",
826
+ to: "Browsing",
827
+ event: "BACK",
828
+ effects: [
829
+ ["fetch", "CraftingData"],
830
+ ["set", "@entity.selectedRecipe", ""],
831
+ ["set", "@entity.result", ""],
832
+ craftingBrowsingMainEffect,
833
+ craftingBrowsingHud
834
+ ]
835
+ }
836
+ ]
837
+ }
838
+ }
839
+ ],
840
+ pages: [
841
+ {
842
+ name: "CraftingPage",
843
+ path: "/crafting",
844
+ isInitial: true,
845
+ traits: [{ ref: "Crafting" }]
846
+ }
847
+ ]
848
+ }
849
+ ]
850
+ };
851
+ var GAME_2D_RPG_BEHAVIORS = [
852
+ OVERWORLD_BEHAVIOR,
853
+ QUEST_BEHAVIOR,
854
+ NPC_BEHAVIOR,
855
+ CRAFTING_BEHAVIOR
856
+ ];
857
+
858
+ export { CRAFTING_BEHAVIOR, GAME_2D_RPG_BEHAVIORS, NPC_BEHAVIOR, OVERWORLD_BEHAVIOR, QUEST_BEHAVIOR };
859
+ //# sourceMappingURL=game-2d-rpg.js.map
860
+ //# sourceMappingURL=game-2d-rpg.js.map