@jgengine/react 0.7.0 → 0.9.0

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 (45) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/chat.d.ts +52 -0
  3. package/dist/chat.js +68 -0
  4. package/dist/chatBubbles.d.ts +15 -0
  5. package/dist/chatBubbles.js +45 -0
  6. package/dist/components.d.ts +1 -0
  7. package/dist/components.js +35 -22
  8. package/dist/display.d.ts +14 -0
  9. package/dist/display.js +45 -0
  10. package/dist/dragLayer.d.ts +6 -1
  11. package/dist/dragLayer.js +64 -31
  12. package/dist/engineStore.d.ts +1 -1
  13. package/dist/engineStore.js +10 -2
  14. package/dist/fogOverlay.d.ts +21 -0
  15. package/dist/fogOverlay.js +34 -0
  16. package/dist/gameIcons.d.ts +12 -0
  17. package/dist/gameIcons.js +282 -0
  18. package/dist/hooks.d.ts +59 -2
  19. package/dist/hooks.js +170 -12
  20. package/dist/hudLayout.d.ts +61 -0
  21. package/dist/hudLayout.js +488 -0
  22. package/dist/hudViewport.d.ts +21 -0
  23. package/dist/hudViewport.js +17 -0
  24. package/dist/identity.d.ts +65 -0
  25. package/dist/identity.js +94 -0
  26. package/dist/index.d.ts +10 -0
  27. package/dist/index.js +10 -0
  28. package/dist/liveBind.d.ts +4 -10
  29. package/dist/liveBind.js +28 -16
  30. package/dist/map.d.ts +27 -7
  31. package/dist/map.js +152 -43
  32. package/dist/preview.d.ts +6 -0
  33. package/dist/preview.js +1 -0
  34. package/dist/selectSnapshot.d.ts +7 -0
  35. package/dist/selectSnapshot.js +16 -0
  36. package/dist/settings.d.ts +75 -0
  37. package/dist/settings.js +61 -0
  38. package/dist/skillCheckPaint.d.ts +4 -0
  39. package/dist/skillCheckPaint.js +28 -0
  40. package/dist/social.d.ts +108 -0
  41. package/dist/social.js +119 -0
  42. package/dist/voice.d.ts +58 -0
  43. package/dist/voice.js +130 -0
  44. package/llms.txt +1633 -0
  45. package/package.json +11 -6
@@ -0,0 +1,21 @@
1
+ import type { FogCells } from "@jgengine/core/world/fog";
2
+ export interface FogCellRect {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export interface FogPaintSurface {
9
+ fillStyle: string | CanvasGradient | CanvasPattern;
10
+ fillRect(x: number, y: number, width: number, height: number): void;
11
+ clearRect(x: number, y: number, width: number, height: number): void;
12
+ }
13
+ export declare function forEachUnrevealedFogCell(fog: FogCells, visit: (col: number, row: number) => void): number;
14
+ export declare function paintFogOverlay(surface: FogPaintSurface, canvasSize: {
15
+ width: number;
16
+ height: number;
17
+ }, fog: FogCells, cellRect: (col: number, row: number) => FogCellRect | null, fill?: string): number;
18
+ export declare function createFogDataUrl(fog: FogCells, canvasSize: {
19
+ width: number;
20
+ height: number;
21
+ }, cellRect: (col: number, row: number) => FogCellRect | null, fill?: string): string | null;
@@ -0,0 +1,34 @@
1
+ export function forEachUnrevealedFogCell(fog, visit) {
2
+ let count = 0;
3
+ for (let row = 0; row < fog.rows; row += 1) {
4
+ for (let col = 0; col < fog.cols; col += 1) {
5
+ if (fog.revealed[row * fog.cols + col])
6
+ continue;
7
+ visit(col, row);
8
+ count += 1;
9
+ }
10
+ }
11
+ return count;
12
+ }
13
+ export function paintFogOverlay(surface, canvasSize, fog, cellRect, fill = "rgba(11, 15, 20, 0.82)") {
14
+ surface.clearRect(0, 0, canvasSize.width, canvasSize.height);
15
+ surface.fillStyle = fill;
16
+ return forEachUnrevealedFogCell(fog, (col, row) => {
17
+ const rect = cellRect(col, row);
18
+ if (rect === null)
19
+ return;
20
+ surface.fillRect(rect.x, rect.y, rect.width, rect.height);
21
+ });
22
+ }
23
+ export function createFogDataUrl(fog, canvasSize, cellRect, fill = "rgba(11, 15, 20, 0.82)") {
24
+ if (typeof document === "undefined")
25
+ return null;
26
+ const canvas = document.createElement("canvas");
27
+ canvas.width = Math.max(1, Math.floor(canvasSize.width));
28
+ canvas.height = Math.max(1, Math.floor(canvasSize.height));
29
+ const context = canvas.getContext("2d");
30
+ if (context === null)
31
+ return null;
32
+ paintFogOverlay(context, { width: canvas.width, height: canvas.height }, fog, cellRect, fill);
33
+ return canvas.toDataURL();
34
+ }
@@ -0,0 +1,12 @@
1
+ export declare const GAME_ICON_NAMES: readonly ["sword", "dagger", "axe", "hammer", "bow", "arrow", "staff", "wand", "spear", "crossbow", "gun", "bomb", "shield", "helmet", "chestplate", "boots", "gauntlet", "ring", "amulet", "cloak", "backpack", "torch", "potionRed", "potionBlue", "scroll", "tome", "meat", "bread", "apple", "fish", "wood", "stone", "ore", "ingot", "gem", "crystal", "coin", "key", "chest", "feather", "fire", "frost", "lightning", "poison", "leaf", "skull", "heart", "star", "eye", "wing", "hourglass", "buffArrow", "debuffArrow", "map", "flag", "gear", "crosshairIcon", "pickaxe", "fist", "arrowUp", "arrowDown", "arrowLeft", "arrowRight", "jump", "sprint", "crouch", "hardDrop", "swap", "rotateCw", "rotateCcw", "restart", "hand", "pin", "pause", "menu", "skip", "check", "cross"];
2
+ export type GameIconName = (typeof GAME_ICON_NAMES)[number];
3
+ export declare function isGameIconName(value: string): value is GameIconName;
4
+ export declare function GameIcon({ name, size, color, className, }: {
5
+ name: GameIconName;
6
+ size?: number;
7
+ color?: string;
8
+ className?: string;
9
+ }): import("react").JSX.Element;
10
+ export declare function iconForItemId(itemId: string): GameIconName | null;
11
+ /** Control glyph for a semantic action name (`hardDrop`, `sprint`, `shiftLeft`), or null when no rule matches. */
12
+ export declare function iconForAction(action: string): GameIconName | null;
@@ -0,0 +1,282 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const GAME_ICON_NAMES = [
3
+ "sword",
4
+ "dagger",
5
+ "axe",
6
+ "hammer",
7
+ "bow",
8
+ "arrow",
9
+ "staff",
10
+ "wand",
11
+ "spear",
12
+ "crossbow",
13
+ "gun",
14
+ "bomb",
15
+ "shield",
16
+ "helmet",
17
+ "chestplate",
18
+ "boots",
19
+ "gauntlet",
20
+ "ring",
21
+ "amulet",
22
+ "cloak",
23
+ "backpack",
24
+ "torch",
25
+ "potionRed",
26
+ "potionBlue",
27
+ "scroll",
28
+ "tome",
29
+ "meat",
30
+ "bread",
31
+ "apple",
32
+ "fish",
33
+ "wood",
34
+ "stone",
35
+ "ore",
36
+ "ingot",
37
+ "gem",
38
+ "crystal",
39
+ "coin",
40
+ "key",
41
+ "chest",
42
+ "feather",
43
+ "fire",
44
+ "frost",
45
+ "lightning",
46
+ "poison",
47
+ "leaf",
48
+ "skull",
49
+ "heart",
50
+ "star",
51
+ "eye",
52
+ "wing",
53
+ "hourglass",
54
+ "buffArrow",
55
+ "debuffArrow",
56
+ "map",
57
+ "flag",
58
+ "gear",
59
+ "crosshairIcon",
60
+ "pickaxe",
61
+ "fist",
62
+ "arrowUp",
63
+ "arrowDown",
64
+ "arrowLeft",
65
+ "arrowRight",
66
+ "jump",
67
+ "sprint",
68
+ "crouch",
69
+ "hardDrop",
70
+ "swap",
71
+ "rotateCw",
72
+ "rotateCcw",
73
+ "restart",
74
+ "hand",
75
+ "pin",
76
+ "pause",
77
+ "menu",
78
+ "skip",
79
+ "check",
80
+ "cross",
81
+ ];
82
+ export function isGameIconName(value) {
83
+ return GAME_ICON_NAMES.includes(value);
84
+ }
85
+ const ROTATE_45 = "rotate(45 12 12)";
86
+ const ICONS = {
87
+ sword: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("polygon", { points: "12,2 14.6,15 9.4,15" }), _jsx("rect", { x: "7", y: "15", width: "10", height: "1.8", rx: "0.5" }), _jsx("rect", { x: "10.7", y: "16.8", width: "2.6", height: "4", rx: "1" }), _jsx("circle", { cx: "12", cy: "21.6", r: "1.6" })] })),
88
+ dagger: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("polygon", { points: "12,6 13.7,15 10.3,15" }), _jsx("rect", { x: "8.5", y: "15", width: "7", height: "1.4", rx: "0.4" }), _jsx("rect", { x: "10.8", y: "16.4", width: "2.4", height: "3.2", rx: "1" }), _jsx("circle", { cx: "12", cy: "20.2", r: "1.3" })] })),
89
+ axe: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("rect", { x: "11", y: "6", width: "2", height: "15", rx: "1" }), _jsx("path", { d: "M12,3 C17,3 21,6.5 20,10.5 C19,13 15,12.5 12,10 Z" })] })),
90
+ hammer: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("rect", { x: "11", y: "9", width: "2", height: "13", rx: "1" }), _jsx("rect", { x: "6", y: "3", width: "12", height: "6", rx: "1.5" })] })),
91
+ bow: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M8,2 C3,7 3,17 8,22 C9,22 9.8,21 9,20 C5.5,16 5.5,8 9,4 C9.8,3 9,2 8,2 Z" }), _jsx("rect", { x: "7.6", y: "2", width: "0.9", height: "20" })] })),
92
+ arrow: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("rect", { x: "11", y: "6", width: "2", height: "14", rx: "1" }), _jsx("polygon", { points: "12,1 15,6 9,6" }), _jsx("polygon", { points: "12,19.5 8.5,23 11,19" }), _jsx("polygon", { points: "12,19.5 15.5,23 13,19" })] })),
93
+ staff: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "11", y: "6", width: "2", height: "16", rx: "1" }), _jsx("circle", { cx: "12", cy: "4", r: "3" })] })),
94
+ wand: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("rect", { x: "11.3", y: "10", width: "1.4", height: "11", rx: "0.7" }), _jsx("path", { d: "M12,1 L13,5.6 L17.5,6.5 L13,7.4 L12,12 L11,7.4 L6.5,6.5 L11,5.6 Z" })] })),
95
+ spear: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("rect", { x: "11.2", y: "6", width: "1.6", height: "15", rx: "0.8" }), _jsx("polygon", { points: "12,1 14,7 12,10.3 10,7" })] })),
96
+ crossbow: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M7,3 C2,6 2,18 7,21 C8,21 8.6,20 7.8,19 C4.5,16 4.5,8 7.8,5 C8.6,4 8,3 7,3 Z" }), _jsx("rect", { x: "6.7", y: "3", width: "0.9", height: "18" }), _jsx("rect", { x: "7", y: "10.8", width: "15", height: "2.4", rx: "1" }), _jsx("polygon", { points: "22,12 18,10.2 18,13.8" })] })),
97
+ gun: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "9", y: "9", width: "13", height: "3.2", rx: "1" }), _jsx("rect", { x: "5", y: "12", width: "4.4", height: "9.5", rx: "1.6", transform: "rotate(18 7.2 16.7)" }), _jsx("circle", { cx: "8.6", cy: "13.6", r: "1.3" })] })),
98
+ bomb: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "14.5", r: "7" }), _jsx("rect", { x: "14.2", y: "3", width: "1.6", height: "6", rx: "0.8", transform: "rotate(35 15 9)" }), _jsx("circle", { cx: "17", cy: "3.4", r: "1.5" })] })),
99
+ shield: (_jsx("path", { fillRule: "evenodd", d: "M12,2 L19,5 L19,12 C19,17 15.5,20.5 12,22 C8.5,20.5 5,17 5,12 L5,5 Z M12,8 L14.3,11 L12,14 L9.7,11 Z" })),
100
+ helmet: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M4,13.2 C4,6.3 7.5,3 12,3 C16.5,3 20,6.3 20,13.2 L20,15 L4,15 Z M7.2,10.2 L16.8,10.2 L16.8,12 L7.2,12 Z" }), _jsx("rect", { x: "3", y: "14.6", width: "18", height: "1.8", rx: "0.9" })] })),
101
+ chestplate: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M6,7 L18,7 L20,10 L18,22 L6,22 L4,10 Z M11.3,8.5 L12.7,8.5 L12.7,20.5 L11.3,20.5 Z" }), _jsx("circle", { cx: "5.2", cy: "8", r: "2.6" }), _jsx("circle", { cx: "18.8", cy: "8", r: "2.6" })] })),
102
+ boots: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M7,3 L15,3 L15,14 L20,16.2 L20,19.2 L5,19.2 L5,16 L7,14 Z" }), _jsx("rect", { x: "4", y: "19", width: "17", height: "2", rx: "0.6" })] })),
103
+ gauntlet: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "6", y: "10", width: "12", height: "9", rx: "3" }), _jsx("rect", { x: "4", y: "18", width: "14", height: "3", rx: "1.2" }), _jsx("rect", { x: "6.6", y: "4", width: "2.4", height: "7", rx: "1.2" }), _jsx("rect", { x: "9.8", y: "3.4", width: "2.4", height: "7.6", rx: "1.2" }), _jsx("rect", { x: "13", y: "3.4", width: "2.4", height: "7.6", rx: "1.2" }), _jsx("rect", { x: "16.2", y: "4.4", width: "2.2", height: "6.6", rx: "1.1" }), _jsx("rect", { x: "2.6", y: "12.5", width: "4.6", height: "3.4", rx: "1.5", transform: "rotate(-25 4.9 14.2)" })] })),
104
+ ring: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M12,10 C15.6,10 18.5,12.9 18.5,16.5 C18.5,20.1 15.6,23 12,23 C8.4,23 5.5,20.1 5.5,16.5 C5.5,12.9 8.4,10 12,10 Z M12,13.2 C10.1,13.2 8.7,14.7 8.7,16.5 C8.7,18.3 10.1,19.8 12,19.8 C13.9,19.8 15.3,18.3 15.3,16.5 C15.3,14.7 13.9,13.2 12,13.2 Z" }), _jsx("polygon", { points: "12,3.5 15.2,7.5 12,11 8.8,7.5" })] })),
105
+ amulet: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M12,2.5 C13.4,2.5 14.5,3.6 14.5,5 C14.5,6.4 13.4,7.5 12,7.5 C10.6,7.5 9.5,6.4 9.5,5 C9.5,3.6 10.6,2.5 12,2.5 Z M12,3.9 C11.4,3.9 10.9,4.4 10.9,5 C10.9,5.6 11.4,6.1 12,6.1 C12.6,6.1 13.1,5.6 13.1,5 C13.1,4.4 12.6,3.9 12,3.9 Z" }), _jsx("polygon", { points: "12,7 16.5,11.5 14.3,19.5 9.7,19.5 7.5,11.5" })] })),
106
+ cloak: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12,2 C9,2 7,4 7,6.2 L4,20 C4,21.5 5.5,22 7,21 L12,18 L17,21 C18.5,22 20,21.5 20,20 L17,6.2 C17,4 15,2 12,2 Z" }), _jsx("circle", { cx: "12", cy: "7", r: "1.2" })] })),
107
+ backpack: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "6", y: "8", width: "12", height: "13", rx: "3" }), _jsx("rect", { x: "7", y: "4", width: "10", height: "6.5", rx: "3" }), _jsx("rect", { x: "7.6", y: "2", width: "1.7", height: "7.5", rx: "0.8" }), _jsx("rect", { x: "14.7", y: "2", width: "1.7", height: "7.5", rx: "0.8" }), _jsx("rect", { x: "9", y: "15", width: "6", height: "4.4", rx: "1.4" })] })),
108
+ torch: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "10.6", y: "10", width: "2.8", height: "12", rx: "1.2" }), _jsx("rect", { x: "9.8", y: "13.2", width: "4.4", height: "1.2", rx: "0.5" }), _jsx("rect", { x: "9.8", y: "17", width: "4.4", height: "1.2", rx: "0.5" }), _jsx("path", { d: "M12,1 C9.2,4 8.2,6.8 9.8,9 C9.9,7.6 10.7,7.2 11,8.1 C11.4,6.6 12.6,6.2 12.2,8.3 C14.2,7 14.8,4 12,1 Z" })] })),
109
+ potionRed: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "10.7", y: "3", width: "2.6", height: "3", rx: "0.8" }), _jsx("rect", { x: "10.3", y: "1.4", width: "3.4", height: "2", rx: "0.8" }), _jsx("path", { d: "M9,6 L15,6 L18,14 C18,19 15,22 12,22 C9,22 6,19 6,14 Z" })] })),
110
+ potionBlue: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "9.2", y: "1.4", width: "5.6", height: "2", rx: "0.8" }), _jsx("path", { d: "M9.5,3 L14.5,3 L14.5,18 C14.5,20.5 12,21.6 12,21.6 C12,21.6 9.5,20.5 9.5,18 Z" })] })),
111
+ scroll: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M5,9 L19,9 L19,15 L5,15 Z M6.6,10.6 L17.4,10.6 L17.4,11.3 L6.6,11.3 Z M6.6,12.5 L17.4,12.5 L17.4,13.2 L6.6,13.2 Z" }), _jsx("circle", { cx: "5", cy: "12", r: "2.6" }), _jsx("circle", { cx: "19", cy: "12", r: "2.6" })] })),
112
+ tome: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M4,4 L20,4 L20,21 L4,21 Z M7.1,5.5 L8,5.5 L8,19.5 L7.1,19.5 Z" }), _jsx("polygon", { points: "15,2 17.2,2 17.2,8.5 16.1,7 15,8.5" }), _jsx("rect", { x: "10.6", y: "11", width: "2.8", height: "3.4", rx: "0.6" })] })),
113
+ meat: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M6,4 C4,7 4,11 7,13 C9,15 15,15 17,13 C20,11 20,7 18,4 C15,1 9,1 6,4 Z" }), _jsx("rect", { x: "10.6", y: "13", width: "2.8", height: "6", rx: "1.2" }), _jsx("circle", { cx: "9.6", cy: "20.3", r: "1.8" }), _jsx("circle", { cx: "14.4", cy: "20.3", r: "1.8" })] })),
114
+ bread: (_jsx("path", { fillRule: "evenodd", d: "M3,15 C3,9 7,6 12,6 C17,6 21,9 21,15 C21,19 17,21 12,21 C7,21 3,19 3,15 Z M8.2,7.4 L10,7.4 L8.6,11.4 L6.8,11.4 Z M11.1,6.6 L12.9,6.6 L11.5,10.8 L9.7,10.8 Z M14,7.4 L15.8,7.4 L14.4,11.4 L12.6,11.4 Z" })),
115
+ apple: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12,7.6 C8,7.6 5,10.6 5,14.9 C5,19 8,22 12,22 C16,22 19,19 19,14.9 C19,11.4 16.8,8.8 13.9,8 Z" }), _jsx("rect", { x: "11.3", y: "2.6", width: "1.4", height: "4", rx: "0.6", transform: "rotate(14 12 4.6)" }), _jsx("path", { d: "M12.9,3.6 C14.2,2.6 16.2,3 16.2,5 C14.2,5.4 13.2,4.8 12.9,3.6 Z" })] })),
116
+ fish: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M3,12 C6,7 12,6 16,9 C18,10.5 18,13.5 16,15 C12,18 6,17 3,12 Z M7.4,11 C6.75,11 6.2,11.55 6.2,12.2 C6.2,12.85 6.75,13.4 7.4,13.4 C8.05,13.4 8.6,12.85 8.6,12.2 C8.6,11.55 8.05,11 7.4,11 Z" }), _jsx("polygon", { points: "16,9 21,6 21,18 16,15" }), _jsx("polygon", { points: "9,7.4 11,4 13,8" })] })),
117
+ wood: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M2,6.5 L22,6.5 L22,11 L2,11 Z M6.4,8.75 C6.4,7.75 5.6,6.95 4.6,6.95 C3.6,6.95 2.8,7.75 2.8,8.75 C2.8,9.75 3.6,10.55 4.6,10.55 C5.6,10.55 6.4,9.75 6.4,8.75 Z" }), _jsx("path", { fillRule: "evenodd", d: "M2,13.5 L22,13.5 L22,18 L2,18 Z M6.4,15.75 C6.4,14.75 5.6,13.95 4.6,13.95 C3.6,13.95 2.8,14.75 2.8,15.75 C2.8,16.75 3.6,17.55 4.6,17.55 C5.6,17.55 6.4,16.75 6.4,15.75 Z" })] })),
118
+ stone: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "4,20 3,13 8,8 14,9 13,15 9,20" }), _jsx("polygon", { points: "12,21 11,14 16,10 21,12 20,18 16,21" })] })),
119
+ ore: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "4,20 3,12 9,7 17,8 20,14 17,20 10,22" }), _jsx("polygon", { points: "12,7 14,1 16,8 13,9.5" })] })),
120
+ ingot: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "3,21 21,21 19,17 5,17" }), _jsx("polygon", { points: "4,16.5 20,16.5 18,12.5 6,12.5" }), _jsx("polygon", { points: "5,12 19,12 17,8 7,8" })] })),
121
+ gem: (_jsx("path", { fillRule: "evenodd", d: "M12,2 L19,9 L15,22 L9,22 L5,9 Z M9,9 L12,9 L10.4,13 Z" })),
122
+ crystal: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "7,22 5,10 8,3 11,10 9,22" }), _jsx("polygon", { points: "14,22 12,6 15,1 18,7 16,22" }), _jsx("polygon", { points: "3,22 2,15 4,11 6,15 5,22" })] })),
123
+ coin: (_jsx("path", { fillRule: "evenodd", d: "M12,3 C16.97,3 21,7.03 21,12 C21,16.97 16.97,21 12,21 C7.03,21 3,16.97 3,12 C3,7.03 7.03,3 12,3 Z M12,5.4 C8.35,5.4 5.4,8.35 5.4,12 C5.4,15.65 8.35,18.6 12,18.6 C15.65,18.6 18.6,15.65 18.6,12 C18.6,8.35 15.65,5.4 12,5.4 Z M12,7.6 C9.57,7.6 7.6,9.57 7.6,12 C7.6,14.43 9.57,16.4 12,16.4 C14.43,16.4 16.4,14.43 16.4,12 C16.4,9.57 14.43,7.6 12,7.6 Z" })),
124
+ key: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M8,3 C10.32,3 12.2,4.88 12.2,7.2 C12.2,9.52 10.32,11.4 8,11.4 C5.68,11.4 3.8,9.52 3.8,7.2 C3.8,4.88 5.68,3 8,3 Z M8,5.1 C6.84,5.1 5.9,6.04 5.9,7.2 C5.9,8.36 6.84,9.3 8,9.3 C9.16,9.3 10.1,8.36 10.1,7.2 C10.1,6.04 9.16,5.1 8,5.1 Z" }), _jsx("rect", { x: "7", y: "10", width: "2", height: "10.5", rx: "0.6" }), _jsx("rect", { x: "9", y: "16", width: "3.2", height: "1.7" }), _jsx("rect", { x: "9", y: "19", width: "2.4", height: "1.7" })] })),
125
+ chest: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M3,11 C3,7 6,5 12,5 C18,5 21,7 21,11 Z" }), _jsx("rect", { x: "3", y: "11", width: "18", height: "9", rx: "1.5" }), _jsx("rect", { x: "3", y: "13.4", width: "18", height: "1.4" }), _jsx("rect", { x: "10.4", y: "12.6", width: "3.2", height: "3.6", rx: "0.8" })] })),
126
+ feather: (_jsx("path", { fillRule: "evenodd", d: "M17,3 C10,3 5,9 5,16 C5,19 7,21 9,21 C9,19 9,17 10,16 C13,17 17,15 18,11 C19,8 19,5 17,3 Z M9.4,19.6 L16,6 L16.7,6.4 L10.1,20 Z" })),
127
+ fire: (_jsx("path", { d: "M12,2 C8,7 5,11 6,15.5 C6.8,19 9.7,21.5 12.5,21.5 C16,21.5 19,18.7 18.6,14.8 C18.3,12 16.7,10.5 16.8,12.7 C16.9,14.4 15.8,15.3 14.9,14.2 C14,13 14.6,10.8 13.3,8.5 C12.5,7 11.7,5.5 12,2 Z" })),
128
+ frost: (_jsx("g", { children: [0, 60, 120].map((deg) => (_jsxs("g", { transform: `rotate(${deg} 12 12)`, children: [_jsx("rect", { x: "11.2", y: "2", width: "1.6", height: "20", rx: "0.8" }), _jsx("rect", { x: "9.4", y: "2.6", width: "5.2", height: "1.4" }), _jsx("rect", { x: "9.4", y: "20", width: "5.2", height: "1.4" })] }, deg))) })),
129
+ lightning: _jsx("polygon", { points: "13,2 5,14 11,14 9,22 19,9 12,9 14.5,2" }),
130
+ poison: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12,3 C16,9 19,13 19,16.5 C19,20.5 15.9,23 12,23 C8.1,23 5,20.5 5,16.5 C5,13 8,9 12,3 Z" }), _jsx("circle", { cx: "17.4", cy: "6", r: "1.6" }), _jsx("circle", { cx: "19.8", cy: "9.6", r: "1.1" })] })),
131
+ leaf: (_jsx("path", { fillRule: "evenodd", d: "M4,20 C4,10 11,3 20,3 C20,13 13,20 4,20 Z M5.4,18.9 L18.3,4.7 L18.9,5.3 L6,19.5 Z" })),
132
+ skull: (_jsx("path", { fillRule: "evenodd", d: "M6,12 C6,6 8.5,3 12,3 C15.5,3 18,6 18,12 L18,15 L15.4,15 L15.4,17 L13,17 L13,19 L11,19 L11,17 L8.6,17 L8.6,15 L6,15 Z M9.3,11 C8.36,11 7.6,11.76 7.6,12.7 C7.6,13.64 8.36,14.4 9.3,14.4 C10.24,14.4 11,13.64 11,12.7 C11,11.76 10.24,11 9.3,11 Z M14.7,11 C13.76,11 13,11.76 13,12.7 C13,13.64 13.76,14.4 14.7,14.4 C15.64,14.4 16.4,13.64 16.4,12.7 C16.4,11.76 15.64,11 14.7,11 Z M12,12.8 L13,15.2 L11,15.2 Z" })),
133
+ heart: (_jsx("path", { d: "M12,21 C4,15 2,10.5 2,7.2 C2,4 4.5,2 7.2,2 C9.3,2 11,3.3 12,5.2 C13,3.3 14.7,2 16.8,2 C19.5,2 22,4 22,7.2 C22,10.5 20,15 12,21 Z" })),
134
+ star: (_jsx("polygon", { points: "12,1.5 14.47,8.6 21.99,8.75 15.99,13.3 18.17,20.49 12,16.2 5.83,20.49 8.0,13.3 2.01,8.75 9.53,8.6" })),
135
+ eye: (_jsx("path", { fillRule: "evenodd", d: "M2,12 C6,5 18,5 22,12 C18,19 6,19 2,12 Z M15,12 C15,13.66 13.66,15 12,15 C10.34,15 9,13.66 9,12 C9,10.34 10.34,9 12,9 C13.66,9 15,10.34 15,12 Z" })),
136
+ wing: (_jsx("path", { d: "M2,20 C4,20.5 10,21 15,20 C15,20 13,19.5 11,18 C15,19 19,17 20,14 C19,15.5 17,16 15,15 C19,14 21,10 21,6 C20,9 18,11 15,10 C13,9 14,6 13,2 C9,5 10,10 8,14 C6,18 2,20 2,20 Z" })),
137
+ hourglass: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "5", y: "2", width: "14", height: "2", rx: "1" }), _jsx("rect", { x: "5", y: "20", width: "14", height: "2", rx: "1" }), _jsx("polygon", { points: "6,4 18,4 12,12" }), _jsx("polygon", { points: "6,20 18,20 12,12" })] })),
138
+ buffArrow: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12,3 L19,10.5 L16.7,10.5 L12,6.3 L7.3,10.5 L5,10.5 Z" }), _jsx("path", { d: "M12,10.5 L19,18 L16.7,18 L12,13.8 L7.3,18 L5,18 Z" })] })),
139
+ debuffArrow: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M5,6 L7.3,6 L12,10.2 L16.7,6 L19,6 L12,13.5 Z" }), _jsx("path", { d: "M5,13.5 L7.3,13.5 L12,17.7 L16.7,13.5 L19,13.5 L12,21 Z" })] })),
140
+ map: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M4,4 L9,6 L14,4 L20,6 L20,20 L15,18 L10,20 L4,18 Z M9.2,6.5 L9.9,6.5 L9.9,19.2 L9.2,19.2 Z M14.1,4.5 L14.8,4.5 L14.8,17.5 L14.1,17.5 Z" }), _jsx("rect", { x: "11.3", y: "12", width: "1.4", height: "5", rx: "0.7", transform: "rotate(45 12 14.5)" }), _jsx("rect", { x: "11.3", y: "12", width: "1.4", height: "5", rx: "0.7", transform: "rotate(-45 12 14.5)" })] })),
141
+ flag: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "5", y: "2", width: "1.8", height: "20", rx: "0.6" }), _jsx("path", { d: "M6.8,3 L19,6.5 L15,8.2 L19,10 L6.8,13.2 Z" })] })),
142
+ gear: (_jsxs(_Fragment, { children: [[0, 45, 90, 135, 180, 225, 270, 315].map((deg) => (_jsx("rect", { x: "11.2", y: "1.4", width: "1.6", height: "4.2", rx: "0.4", transform: `rotate(${deg} 12 12)` }, deg))), _jsx("path", { fillRule: "evenodd", d: "M12,6 C15.31,6 18,8.69 18,12 C18,15.31 15.31,18 12,18 C8.69,18 6,15.31 6,12 C6,8.69 8.69,6 12,6 Z M12,9.5 C10.62,9.5 9.5,10.62 9.5,12 C9.5,13.38 10.62,14.5 12,14.5 C13.38,14.5 14.5,13.38 14.5,12 C14.5,10.62 13.38,9.5 12,9.5 Z" })] })),
143
+ crosshairIcon: (_jsxs(_Fragment, { children: [_jsx("path", { fillRule: "evenodd", d: "M12,4 C16.42,4 20,7.58 20,12 C20,16.42 16.42,20 12,20 C7.58,20 4,16.42 4,12 C4,7.58 7.58,4 12,4 Z M12,6.6 C9.02,6.6 6.6,9.02 6.6,12 C6.6,14.98 9.02,17.4 12,17.4 C14.98,17.4 17.4,14.98 17.4,12 C17.4,9.02 14.98,6.6 12,6.6 Z" }), _jsx("rect", { x: "11.2", y: "1", width: "1.6", height: "3.4" }), _jsx("rect", { x: "11.2", y: "19.6", width: "1.6", height: "3.4" }), _jsx("rect", { x: "1", y: "11.2", width: "3.4", height: "1.6" }), _jsx("rect", { x: "19.6", y: "11.2", width: "3.4", height: "1.6" }), _jsx("circle", { cx: "12", cy: "12", r: "1.3" })] })),
144
+ pickaxe: (_jsxs("g", { transform: ROTATE_45, children: [_jsx("rect", { x: "11", y: "8", width: "2", height: "14", rx: "1" }), _jsx("path", { d: "M4,5 C7,2 10,2 12,4 C10,6 8,7 5,8.2 C4,7.5 3.4,6 4,5 Z" }), _jsx("path", { d: "M20,5 C17,2 14,2 12,4 C14,6 16,7 19,8.2 C20,7.5 20.6,6 20,5 Z" })] })),
145
+ fist: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "5", y: "9", width: "13", height: "9", rx: "4" }), _jsx("rect", { x: "8", y: "17", width: "7", height: "4", rx: "1.5" }), _jsx("circle", { cx: "7.6", cy: "9.3", r: "2.1" }), _jsx("circle", { cx: "10.3", cy: "8.7", r: "2.2" }), _jsx("circle", { cx: "13", cy: "8.7", r: "2.2" }), _jsx("circle", { cx: "15.6", cy: "9.3", r: "2" }), _jsx("path", { d: "M3,13 C1.5,13 1,15 2,16.5 C3,18 5,17.5 6,16 L7,13.5 C6,12.5 4,12.5 3,13 Z" })] })),
146
+ arrowUp: _jsx("polygon", { points: "12,3 19.5,11 14.4,11 14.4,21 9.6,21 9.6,11 4.5,11" }),
147
+ arrowDown: _jsx("polygon", { points: "12,21 4.5,13 9.6,13 9.6,3 14.4,3 14.4,13 19.5,13" }),
148
+ arrowLeft: _jsx("polygon", { points: "3,12 11,4.5 11,9.6 21,9.6 21,14.4 11,14.4 11,19.5" }),
149
+ arrowRight: _jsx("polygon", { points: "21,12 13,4.5 13,9.6 3,9.6 3,14.4 13,14.4 13,19.5" }),
150
+ jump: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "12,2 19,9.5 14.3,9.5 14.3,16.5 9.7,16.5 9.7,9.5 5,9.5" }), _jsx("rect", { x: "5", y: "19", width: "14", height: "2.4", rx: "1.2" })] })),
151
+ sprint: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "3.5,4.5 10.5,12 3.5,19.5 7.3,19.5 14.3,12 7.3,4.5" }), _jsx("polygon", { points: "11.5,4.5 18.5,12 11.5,19.5 15.3,19.5 22.3,12 15.3,4.5" })] })),
152
+ crouch: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "4.5,3.5 12,10.5 19.5,3.5 19.5,7.3 12,14.3 4.5,7.3" }), _jsx("polygon", { points: "4.5,11.5 12,18.5 19.5,11.5 19.5,15.3 12,22.3 4.5,15.3" })] })),
153
+ hardDrop: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "12,16.5 5,9 9.7,9 9.7,2 14.3,2 14.3,9 19,9" }), _jsx("rect", { x: "5", y: "19", width: "14", height: "2.4", rx: "1.2" })] })),
154
+ swap: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "21,7.5 14.5,2 14.5,5.4 4,5.4 4,9.6 14.5,9.6 14.5,13" }), _jsx("polygon", { points: "3,16.5 9.5,11 9.5,14.4 20,14.4 20,18.6 9.5,18.6 9.5,22" })] })),
155
+ rotateCw: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12,4.4 A8.1,8.1 0 1,1 3.9,12.5 L6.7,12.5 A5.3,5.3 0 1,0 12,7.2 Z" }), _jsx("polygon", { points: "11.2,2 16.9,5.8 11.2,9.6" })] })),
156
+ rotateCcw: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12,4.4 A8.1,8.1 0 1,0 20.1,12.5 L17.3,12.5 A5.3,5.3 0 1,1 12,7.2 Z" }), _jsx("polygon", { points: "12.8,2 7.1,5.8 12.8,9.6" })] })),
157
+ restart: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12,4.4 A8.1,8.1 0 1,0 20.1,12.5 L17.3,12.5 A5.3,5.3 0 1,1 12,7.2 Z" }), _jsx("polygon", { points: "12.8,2 7.1,5.8 12.8,9.6" }), _jsx("circle", { cx: "12", cy: "12.5", r: "2" })] })),
158
+ hand: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "6.9", y: "9.6", width: "10.2", height: "11.4", rx: "4" }), _jsx("rect", { x: "7.5", y: "4", width: "2.5", height: "8", rx: "1.25" }), _jsx("rect", { x: "10.75", y: "2.8", width: "2.5", height: "9.2", rx: "1.25" }), _jsx("rect", { x: "14", y: "4", width: "2.5", height: "8", rx: "1.25" }), _jsx("rect", { x: "3.8", y: "11.6", width: "4.6", height: "3.2", rx: "1.6", transform: "rotate(-28 6.1 13.2)" })] })),
159
+ pin: (_jsx("path", { fillRule: "evenodd", d: "M12,2 C16,2 19,5 19,9 C19,14 12,22 12,22 C12,22 5,14 5,9 C5,5 8,2 12,2 Z M12,6.4 C10.56,6.4 9.4,7.56 9.4,9 C9.4,10.44 10.56,11.6 12,11.6 C13.44,11.6 14.6,10.44 14.6,9 C14.6,7.56 13.44,6.4 12,6.4 Z" })),
160
+ pause: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "6", y: "4", width: "4.2", height: "16", rx: "1.3" }), _jsx("rect", { x: "13.8", y: "4", width: "4.2", height: "16", rx: "1.3" })] })),
161
+ menu: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "4", y: "5", width: "16", height: "2.8", rx: "1.4" }), _jsx("rect", { x: "4", y: "10.6", width: "16", height: "2.8", rx: "1.4" }), _jsx("rect", { x: "4", y: "16.2", width: "16", height: "2.8", rx: "1.4" })] })),
162
+ skip: (_jsxs(_Fragment, { children: [_jsx("polygon", { points: "5,4.5 15,12 5,19.5" }), _jsx("rect", { x: "16", y: "4.5", width: "3.2", height: "15", rx: "1.2" })] })),
163
+ check: _jsx("polygon", { points: "3.5,13.5 6.3,10.7 9.5,13.9 17.7,4.5 20.5,7 9.5,19.5" }),
164
+ cross: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "10.6", y: "2.5", width: "2.8", height: "19", rx: "1.4", transform: "rotate(45 12 12)" }), _jsx("rect", { x: "10.6", y: "2.5", width: "2.8", height: "19", rx: "1.4", transform: "rotate(-45 12 12)" })] })),
165
+ };
166
+ export function GameIcon({ name, size = 24, color, className, }) {
167
+ const style = { color, display: "block" };
168
+ return (_jsx("svg", { viewBox: "0 0 24 24", width: size, height: size, "data-jgui": "icon", "data-icon": name, className: className, style: style, fill: "currentColor", children: ICONS[name] }));
169
+ }
170
+ const ITEM_ID_RULES = [
171
+ [["crossbow"], "crossbow"],
172
+ [["longbow", "shortbow", "recurve", "bow"], "bow"],
173
+ [["dagger", "knife", "shiv"], "dagger"],
174
+ [["greatsword", "broadsword", "sword", "blade", "saber", "sabre"], "sword"],
175
+ [["axe", "hatchet"], "axe"],
176
+ [["hammer", "mace", "club", "maul"], "hammer"],
177
+ [["spear", "lance", "pike", "javelin"], "spear"],
178
+ [["staff", "rod"], "staff"],
179
+ [["wand"], "wand"],
180
+ [["pistol", "rifle", "musket", "gun"], "gun"],
181
+ [["arrow", "bolt"], "arrow"],
182
+ [["bomb", "grenade", "dynamite", "tnt"], "bomb"],
183
+ [["shield", "buckler"], "shield"],
184
+ [["helmet", "helm", "hood", "cap"], "helmet"],
185
+ [["chestplate", "breastplate", "cuirass", "armor", "armour", "vest"], "chestplate"],
186
+ [["boots", "greaves", "shoe", "sabaton"], "boots"],
187
+ [["gauntlet", "glove", "vambrace"], "gauntlet"],
188
+ [["ring", "band"], "ring"],
189
+ [["amulet", "necklace", "pendant", "locket"], "amulet"],
190
+ [["cloak", "cape", "mantle"], "cloak"],
191
+ [["backpack", "rucksack", "satchel", "bag", "pack"], "backpack"],
192
+ [["torch"], "torch"],
193
+ [["potionred", "redpotion", "healthpotion", "healingpotion"], "potionRed"],
194
+ [["potionblue", "bluepotion", "manapotion", "energypotion"], "potionBlue"],
195
+ [["potion", "elixir", "brew", "flask", "vial"], "potionRed"],
196
+ [["scroll"], "scroll"],
197
+ [["tome", "grimoire", "spellbook", "book"], "tome"],
198
+ [["meat", "drumstick", "steak"], "meat"],
199
+ [["bread", "loaf", "baguette"], "bread"],
200
+ [["apple"], "apple"],
201
+ [["fish", "salmon", "trout"], "fish"],
202
+ [["wood", "log", "timber", "plank"], "wood"],
203
+ [["ore"], "ore"],
204
+ [["ingot", "bar"], "ingot"],
205
+ [["gem", "jewel", "sapphire", "ruby", "emerald"], "gem"],
206
+ [["crystal", "shard"], "crystal"],
207
+ [["coin", "gold", "currency", "gil", "credit"], "coin"],
208
+ [["key"], "key"],
209
+ [["chest", "crate", "coffer"], "chest"],
210
+ [["feather", "plume", "quill"], "feather"],
211
+ [["stone", "rock", "pebble", "boulder"], "stone"],
212
+ [["fire", "flame", "burn", "ember"], "fire"],
213
+ [["frost", "ice", "snow", "chill"], "frost"],
214
+ [["lightning", "thunder", "shock", "static"], "lightning"],
215
+ [["poison", "venom", "toxic", "acid"], "poison"],
216
+ [["leaf", "herb", "plant", "grass"], "leaf"],
217
+ [["skull", "bone"], "skull"],
218
+ [["heart", "life"], "heart"],
219
+ [["star"], "star"],
220
+ [["eye"], "eye"],
221
+ [["wing", "feathers"], "wing"],
222
+ [["hourglass", "time", "clock", "sand"], "hourglass"],
223
+ [["buff", "boost"], "buffArrow"],
224
+ [["debuff", "weaken", "curse"], "debuffArrow"],
225
+ [["map"], "map"],
226
+ [["flag", "banner", "pennant"], "flag"],
227
+ [["gear", "cog", "sprocket"], "gear"],
228
+ [["crosshair", "target", "scope", "reticle"], "crosshairIcon"],
229
+ [["pickaxe", "pick"], "pickaxe"],
230
+ [["fist", "punch", "knuckle"], "fist"],
231
+ ];
232
+ export function iconForItemId(itemId) {
233
+ const id = itemId.toLowerCase();
234
+ for (const [keywords, icon] of ITEM_ID_RULES) {
235
+ for (const keyword of keywords) {
236
+ if (id.includes(keyword))
237
+ return icon;
238
+ }
239
+ }
240
+ return null;
241
+ }
242
+ const ACTION_RULES = [
243
+ [["rotatecw", "rotateright", "spincw"], "rotateCw"],
244
+ [["rotateccw", "rotateleft", "spinccw"], "rotateCcw"],
245
+ [["rotate", "spin"], "rotateCw"],
246
+ [["harddrop", "slam"], "hardDrop"],
247
+ [["softdrop"], "arrowDown"],
248
+ [["jump", "hop", "leap"], "jump"],
249
+ [["sprint", "dash", "boost"], "sprint"],
250
+ [["crouch", "sneak", "duck", "slide"], "crouch"],
251
+ [["hold", "swap", "stash", "switch"], "swap"],
252
+ [["restart", "reset", "retry", "again", "newrun", "newgame"], "restart"],
253
+ [["pause"], "pause"],
254
+ [["menu", "options", "settings"], "menu"],
255
+ [["endturn", "skip", "pass"], "skip"],
256
+ [["ping", "waypoint", "marker"], "pin"],
257
+ [["ability", "cast", "spell", "power", "special"], "lightning"],
258
+ [["interact", "use", "activate", "talk", "grab", "pickup"], "hand"],
259
+ [["attack", "strike", "melee", "punch", "hit"], "sword"],
260
+ [["shoot", "fire", "aim"], "crosshairIcon"],
261
+ [["mine", "dig"], "pickaxe"],
262
+ [["build", "place"], "hammer"],
263
+ [["inventory", "backpack", "bag"], "backpack"],
264
+ [["map"], "map"],
265
+ [["confirm", "accept", "submit"], "check"],
266
+ [["cancel", "close", "dismiss"], "cross"],
267
+ [["up", "forward"], "arrowUp"],
268
+ [["down", "back"], "arrowDown"],
269
+ [["left"], "arrowLeft"],
270
+ [["right"], "arrowRight"],
271
+ ];
272
+ /** Control glyph for a semantic action name (`hardDrop`, `sprint`, `shiftLeft`), or null when no rule matches. */
273
+ export function iconForAction(action) {
274
+ const id = action.toLowerCase();
275
+ for (const [keywords, icon] of ACTION_RULES) {
276
+ for (const keyword of keywords) {
277
+ if (id.includes(keyword))
278
+ return icon;
279
+ }
280
+ }
281
+ return null;
282
+ }
package/dist/hooks.d.ts CHANGED
@@ -1,10 +1,13 @@
1
+ import { AxisChannel, type AxisChannelConfig } from "@jgengine/core/input/axisInput";
1
2
  import type { GameContext } from "@jgengine/core/runtime/gameContext";
2
3
  import type { AbilityKit, AbilitySlotSnapshot } from "@jgengine/core/combat/abilityKit";
3
4
  import type { EventMeter } from "@jgengine/core/stats/eventMeter";
4
5
  import type { GameEvents } from "@jgengine/core/game/events";
5
6
  import type { FeedEntry } from "@jgengine/core/game/feed";
6
7
  import type { QuestInstance } from "@jgengine/core/game/quest";
7
- import type { FriendEntry, PartyMemberEntry, PresenceInfo } from "@jgengine/core/game/social";
8
+ import type { ChatMessage } from "@jgengine/core/game/chat";
9
+ import type { FriendEntry, FriendRequestEntry, PartyInviteEntry, PartyMemberEntry, PresenceInfo, WorldInvite } from "@jgengine/core/game/social";
10
+ import { type MatchFilter, type SessionListing } from "@jgengine/core/multiplayer/matchmaking";
8
11
  import type { LeaderboardScope } from "@jgengine/core/game/leaderboard";
9
12
  import type { InventorySlot } from "@jgengine/core/inventory/inventoryModel";
10
13
  import type { StatValue } from "@jgengine/core/scene/entityStats";
@@ -14,7 +17,8 @@ import type { RosterEntry } from "@jgengine/core/scene/roster";
14
17
  import type { WorldItemRecord } from "@jgengine/core/game/worldItem";
15
18
  import type { ClockSnapshot, SimClock } from "@jgengine/core/time/simClock";
16
19
  import { type PositionedPrompt } from "@jgengine/core/interaction/proximityPrompt";
17
- export declare function useGameStore<T>(selector: (ctx: GameContext) => T): T;
20
+ import { type GamePhase } from "@jgengine/core/game/gamePhase";
21
+ export declare function useGameStore<T>(selector: (ctx: GameContext) => T, isEqual?: (previous: T, next: T) => boolean): T;
18
22
  export declare function useGame(): {
19
23
  commands: GameContext["game"]["commands"];
20
24
  events: GameEvents;
@@ -23,6 +27,11 @@ export declare function usePlayer(): {
23
27
  userId: string;
24
28
  isNew: boolean;
25
29
  };
30
+ /** Live run phase + a setter that also gates the shell's touch controls. `menu`/`paused`/`ended` hide the touch dock; `playing` shows it. */
31
+ export declare function useGamePhase(): {
32
+ phase: GamePhase;
33
+ setPhase: (phase: GamePhase) => void;
34
+ };
26
35
  export declare function useSceneEntities(): readonly SceneEntity[];
27
36
  export declare function useSceneObjects(): readonly SceneObject[];
28
37
  export declare function useWorldItems(): readonly WorldItemRecord[];
@@ -40,6 +49,30 @@ export declare function useQuestJournal(): QuestInstance[];
40
49
  export declare function useFriends(): FriendEntry[];
41
50
  export declare function useParty(): PartyMemberEntry[];
42
51
  export declare function usePresence(userId: string): PresenceInfo;
52
+ export declare function useWorldInvites(): WorldInvite[];
53
+ export declare function useChat(channelId: string, options?: {
54
+ limit?: number;
55
+ }): ChatMessage[];
56
+ export declare function useFriendRequests(): FriendRequestEntry[];
57
+ export declare function usePartyInvites(): PartyInviteEntry[];
58
+ export interface WorldBrowserState {
59
+ listings: SessionListing[];
60
+ loading: boolean;
61
+ error: string | null;
62
+ refresh(): void;
63
+ }
64
+ /**
65
+ * Polls a host-supplied session fetcher (e.g. createWsBackend().browse) and
66
+ * filters through matchmaking's browseSessions. fetchSessions must be
67
+ * identity-stable (wrap in useCallback at the call site) or every render
68
+ * refetches.
69
+ */
70
+ export declare function useWorldBrowser(options: {
71
+ fetchSessions: () => Promise<readonly SessionListing[]>;
72
+ filter?: MatchFilter;
73
+ limit?: number;
74
+ refreshMs?: number;
75
+ }): WorldBrowserState;
43
76
  export declare function useRoster(userId?: string): readonly RosterEntry[];
44
77
  export declare function useLeaderboard(stat: string, options: {
45
78
  scope: LeaderboardScope;
@@ -54,6 +87,8 @@ export declare function useGameClock(): ClockSnapshot & {
54
87
  controls: SimClock;
55
88
  };
56
89
  export declare function useActivePrompt<T extends PositionedPrompt>(prompts?: readonly T[]): T | null;
90
+ export declare function abilityKitNeedsHeartbeat(kit: AbilityKit, resourceAvailable?: number): boolean;
91
+ export declare function eventMeterNeedsHeartbeat(meter: EventMeter, previous: EventMeterView | null): boolean;
57
92
  export interface AbilitySlotBindingOptions {
58
93
  intervalMs?: number;
59
94
  }
@@ -66,3 +101,25 @@ export interface EventMeterView {
66
101
  ready: boolean;
67
102
  }
68
103
  export declare function useEventMeter(meter: EventMeter, options?: AbilitySlotBindingOptions): EventMeterView;
104
+ type HeldKeyEventTarget = Pick<Window, "addEventListener" | "removeEventListener">;
105
+ export declare function createHeldKeyTracker(target: HeldKeyEventTarget): {
106
+ isDown: (code: string) => boolean;
107
+ dispose: () => void;
108
+ };
109
+ /**
110
+ * Held-key predicate backed by window keydown/keyup/blur listeners (blur clears held state so a
111
+ * released-off-window key doesn't stick). SSR-safe: listeners attach in an effect, never at module
112
+ * scope. The returned predicate is stable across renders.
113
+ */
114
+ export declare function useHeldKeys(): (code: string) => boolean;
115
+ export interface UseAxisChannelResult {
116
+ channel: AxisChannel;
117
+ isDown: (code: string) => boolean;
118
+ }
119
+ /**
120
+ * Wires useHeldKeys into a fresh AxisChannel, ready for a per-frame `channel.sample(dt, isDown)`.
121
+ * The channel is recreated when `config` identity changes, so pass a stable config (useMemo/module
122
+ * constant at the call site) unless a rebind is intended.
123
+ */
124
+ export declare function useAxisChannel(config: AxisChannelConfig): UseAxisChannelResult;
125
+ export {};