Skip to content

Commit c2a8b24

Browse files
committed
doc strings
1 parent d2d47c8 commit c2a8b24

5 files changed

Lines changed: 24 additions & 0 deletions

File tree

app/lib/zustand/clipboard.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { Node } from "@xyflow/react";
22
import { create } from "zustand";
33

4+
/**
5+
* Clipboard state interface for managing copied nodes and their last paste position.
6+
*/
47
interface ClipboardState {
58
copiedNodes: Node[];
69
lastPastePosition: { x: number; y: number } | null;
@@ -9,6 +12,11 @@ interface ClipboardState {
912
hasCopiedNodes: () => boolean;
1013
}
1114

15+
/**
16+
* Clipboard state management using Zustand.
17+
* This store manages copied nodes and their last paste position.
18+
* It provides methods to set copied nodes, clear the clipboard, and check if there are copied
19+
*/
1220
export const useClipboardStore = create<ClipboardState>((set, get) => ({
1321
copiedNodes: [],
1422
lastPastePosition: null,

app/lib/zustand/game.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ interface GameState {
1414
init: (level: LevelId) => void;
1515
}
1616

17+
/**
18+
* Game state management using Zustand.
19+
* This store manages the game state, including pause/play status,
20+
* current level, level completion status, and dialog visibility.
21+
*/
1722
export const useGameStore = create<GameState>((set, get) => ({
1823
isPaused: false,
1924
pause: () => set({ isPaused: true }),

app/lib/zustand/key.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ interface KeyState {
99
setKeyReleasedFunction: (keyFunction: (key: string) => boolean) => void;
1010
}
1111

12+
/**
13+
* This store allows us the make key events more flexible.
14+
* It allows us to set custom functions for key down, pressed, and released events.
15+
*/
1216
export const useKeyStore = create<KeyState>((set) => ({
1317
isKeyDown: () => false,
1418
setKeyDownFunction: (keyFunction) => set({ isKeyDown: keyFunction }),

app/lib/zustand/mouse.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ interface MouseState {
66
setMousePosFunction: (mouseFunction: () => Vec2) => void;
77
}
88

9+
/**
10+
* Unified mouse position management using Zustand.
11+
* This store allows us to set a custom function to retrieve the mouse position,
12+
*/
913
export const useMouseStore = create<MouseState>((set) => ({
1014
getMousePos: () => ({ x: 0, y: 0 }) as Vec2,
1115
setMousePosFunction: (mouseFunction) => set({ getMousePos: mouseFunction }),

app/lib/zustand/time.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ interface TimeState {
77
setDeltaTimeFunction: (timeFunction: () => number) => void;
88
}
99

10+
/**
11+
* This store allows re-exports of the time functions from the game engine.
12+
*/
1013
export const useTimeStore = create<TimeState>((set) => ({
1114
getTime: () => 0,
1215
setTimeFunction: (timeFunction) => set({ getTime: timeFunction }),

0 commit comments

Comments
 (0)