create-pixi-vn 2.0.6 → 2.0.8
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.
- package/package.json +1 -1
- package/template-react-vite-muijoy/src/components/menus/choice-menus.tsx +1 -1
- package/template-react-vite-muijoy/src/components/menus/main-menu.tsx +5 -2
- package/template-react-vite-muijoy/src/components/menus/settings/menus/history.tsx +2 -5
- package/template-react-vite-muijoy/src/components/menus/settings/system-controls.tsx +2 -2
- package/template-react-vite-muijoy/src/components/modals/input-request-dialogues.tsx +1 -1
- package/template-react-vite-muijoy/src/components/quick-tools.tsx +5 -5
- package/template-react-vite-muijoy/src/components/screens/narration/index.tsx +1 -1
- package/template-react-vite-muijoy/src/components/screens/narration/narration-cards.tsx +1 -1
- package/template-react-vite-muijoy/src/constants.ts +2 -0
- package/template-react-vite-muijoy/src/lib/hooks/hotkeys-hooks.ts +5 -5
- package/template-react-vite-muijoy/src/lib/hooks/props-hooks.ts +4 -2
- package/template-react-vite-muijoy/src/lib/hooks/save-hooks.tsx +7 -7
- package/template-react-vite-muijoy/src/lib/query/{interface-query.ts → narration-query.ts} +13 -14
- package/template-react-vite-muijoy/src/lib/query/save-query.ts +4 -4
- package/template-react-vite-muijoy/src/lib/query/settings-query.ts +2 -2
- package/template-react-vite-muijoy/src/routes/__root.tsx +2 -2
- package/template-react-vite-muijoy-ink/src/components/menus/choice-menus.tsx +1 -1
- package/template-react-vite-muijoy-ink/src/components/menus/main-menu.tsx +5 -2
- package/template-react-vite-muijoy-ink/src/components/menus/settings/menus/history.tsx +2 -5
- package/template-react-vite-muijoy-ink/src/components/menus/settings/system-controls.tsx +2 -2
- package/template-react-vite-muijoy-ink/src/components/modals/input-request-dialogues.tsx +1 -1
- package/template-react-vite-muijoy-ink/src/components/quick-tools.tsx +5 -5
- package/template-react-vite-muijoy-ink/src/components/screens/narration/index.tsx +1 -1
- package/template-react-vite-muijoy-ink/src/components/screens/narration/narration-cards.tsx +1 -1
- package/template-react-vite-muijoy-ink/src/constants.ts +2 -0
- package/template-react-vite-muijoy-ink/src/lib/hooks/hotkeys-hooks.ts +5 -5
- package/template-react-vite-muijoy-ink/src/lib/hooks/props-hooks.ts +4 -2
- package/template-react-vite-muijoy-ink/src/lib/hooks/save-hooks.tsx +7 -7
- package/template-react-vite-muijoy-ink/src/lib/query/{interface-query.ts → narration-query.ts} +13 -14
- package/template-react-vite-muijoy-ink/src/lib/query/save-query.ts +4 -4
- package/template-react-vite-muijoy-ink/src/lib/query/settings-query.ts +2 -2
- package/template-react-vite-muijoy-ink/src/routes/__root.tsx +2 -2
- package/template-react-vite-muijoy-ink-tauri/package-lock.json +8 -8
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/choice-menus.tsx +1 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/main-menu.tsx +5 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/menus/history.tsx +2 -5
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/system-controls.tsx +2 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/modals/input-request-dialogues.tsx +1 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/quick-tools.tsx +5 -5
- package/template-react-vite-muijoy-ink-tauri/src/components/screens/narration/index.tsx +1 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/screens/narration/narration-cards.tsx +1 -1
- package/template-react-vite-muijoy-ink-tauri/src/constants.ts +2 -0
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/hotkeys-hooks.ts +5 -5
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/props-hooks.ts +4 -2
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/save-hooks.tsx +7 -7
- package/template-react-vite-muijoy-ink-tauri/src/lib/query/{interface-query.ts → narration-query.ts} +13 -14
- package/template-react-vite-muijoy-ink-tauri/src/lib/query/save-query.ts +4 -4
- package/template-react-vite-muijoy-ink-tauri/src/lib/query/settings-query.ts +2 -2
- package/template-react-vite-muijoy-ink-tauri/src/routes/__root.tsx +2 -2
- package/template-react-vite-muijoy-tauri/src/components/menus/choice-menus.tsx +1 -1
- package/template-react-vite-muijoy-tauri/src/components/menus/main-menu.tsx +5 -2
- package/template-react-vite-muijoy-tauri/src/components/menus/settings/menus/history.tsx +2 -5
- package/template-react-vite-muijoy-tauri/src/components/menus/settings/system-controls.tsx +2 -2
- package/template-react-vite-muijoy-tauri/src/components/modals/input-request-dialogues.tsx +1 -1
- package/template-react-vite-muijoy-tauri/src/components/quick-tools.tsx +5 -5
- package/template-react-vite-muijoy-tauri/src/components/screens/narration/index.tsx +1 -1
- package/template-react-vite-muijoy-tauri/src/components/screens/narration/narration-cards.tsx +1 -1
- package/template-react-vite-muijoy-tauri/src/constants.ts +2 -0
- package/template-react-vite-muijoy-tauri/src/lib/hooks/hotkeys-hooks.ts +5 -5
- package/template-react-vite-muijoy-tauri/src/lib/hooks/props-hooks.ts +4 -2
- package/template-react-vite-muijoy-tauri/src/lib/hooks/save-hooks.tsx +7 -7
- package/template-react-vite-muijoy-tauri/src/lib/query/{interface-query.ts → narration-query.ts} +13 -14
- package/template-react-vite-muijoy-tauri/src/lib/query/save-query.ts +4 -4
- package/template-react-vite-muijoy-tauri/src/lib/query/settings-query.ts +2 -2
- package/template-react-vite-muijoy-tauri/src/routes/__root.tsx +2 -2
package/template-react-vite-muijoy-ink/src/lib/query/{interface-query.ts → narration-query.ts}
RENAMED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
+
import { INTERFACE_DATA_USE_QUERY_KEY } from "@/constants";
|
|
1
2
|
import { type CharacterInterface, narration, stepHistory } from "@drincs/pixi-vn";
|
|
2
3
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
4
|
import { useTranslation } from "react-i18next";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const CAN_GO_BACK_USE_QUEY_KEY = "can_go_back_use_quey_key";
|
|
6
|
+
const CAN_GO_BACK_USE_QUERY_KEY = "can_go_back_use_query_key";
|
|
8
7
|
export function useQueryCanGoBack() {
|
|
9
8
|
return useQuery({
|
|
10
|
-
queryKey: [
|
|
9
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, CAN_GO_BACK_USE_QUERY_KEY],
|
|
11
10
|
queryFn: async () => stepHistory.canGoBack,
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
const
|
|
14
|
+
const CHOICE_MENU_OPTIONS_USE_QUERY_KEY = "choice_menu_options_use_query_key";
|
|
16
15
|
export function useQueryChoiceMenuOptions() {
|
|
17
16
|
const { t } = useTranslation(["narration"]);
|
|
18
17
|
return useQuery({
|
|
19
|
-
queryKey: [
|
|
18
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, CHOICE_MENU_OPTIONS_USE_QUERY_KEY],
|
|
20
19
|
queryFn: async () =>
|
|
21
20
|
narration.choices?.map((option) => ({
|
|
22
21
|
...option,
|
|
@@ -28,10 +27,10 @@ export function useQueryChoiceMenuOptions() {
|
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
const
|
|
30
|
+
const INPUT_VALUE_USE_QUERY_KEY = "input_value_use_query_key";
|
|
32
31
|
export function useQueryInputValue<T>() {
|
|
33
32
|
return useQuery({
|
|
34
|
-
queryKey: [
|
|
33
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, INPUT_VALUE_USE_QUERY_KEY],
|
|
35
34
|
queryFn: async () => ({
|
|
36
35
|
isRequired: narration.isRequiredInput,
|
|
37
36
|
type: narration.inputType,
|
|
@@ -45,13 +44,13 @@ type DialogueModel = {
|
|
|
45
44
|
text?: string;
|
|
46
45
|
character?: CharacterInterface;
|
|
47
46
|
};
|
|
48
|
-
const
|
|
47
|
+
const DIALOGUE_USE_QUERY_KEY = "dialogue_use_query_key";
|
|
49
48
|
export function useQueryDialogue() {
|
|
50
49
|
const { t } = useTranslation(["narration"]);
|
|
51
50
|
const queryClient = useQueryClient();
|
|
52
51
|
|
|
53
52
|
return useQuery<DialogueModel>({
|
|
54
|
-
queryKey: [
|
|
53
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, DIALOGUE_USE_QUERY_KEY],
|
|
55
54
|
queryFn: async ({ queryKey }) => {
|
|
56
55
|
const dialogue = narration.dialogue;
|
|
57
56
|
let text = dialogue?.text;
|
|
@@ -90,21 +89,21 @@ export function useQueryDialogue() {
|
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
const
|
|
92
|
+
const CAN_GO_NEXT_USE_QUERY_KEY = "can_go_next_use_query_key";
|
|
94
93
|
export function useQueryCanGoNext() {
|
|
95
94
|
return useQuery({
|
|
96
|
-
queryKey: [
|
|
95
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, CAN_GO_NEXT_USE_QUERY_KEY],
|
|
97
96
|
queryFn: async () => narration.canContinue && !narration.isRequiredInput,
|
|
98
97
|
});
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
const
|
|
100
|
+
const NARRATIVE_HISTORY_USE_QUERY_KEY = "narrative_history_use_query_key";
|
|
102
101
|
export function useQueryNarrativeHistory({ searchString }: { searchString?: string }) {
|
|
103
102
|
const { t } = useTranslation(["narration"]);
|
|
104
103
|
const normalizedSearch = searchString?.toLowerCase().trim();
|
|
105
104
|
|
|
106
105
|
return useQuery({
|
|
107
|
-
queryKey: [
|
|
106
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, NARRATIVE_HISTORY_USE_QUERY_KEY],
|
|
108
107
|
queryFn: async () => {
|
|
109
108
|
const promises = stepHistory.narrativeHistory.map(async (step) => {
|
|
110
109
|
const character = step.dialogue?.character;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { getLastSaveFromIndexDB, getSaveFromIndexDB } from "@/lib/utils/save-utility";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const SAVES_USE_QUERY_KEY = "saves_use_query_key";
|
|
5
5
|
export function useQuerySaves({ id }: { id: number }) {
|
|
6
6
|
return useQuery({
|
|
7
|
-
queryKey: [
|
|
7
|
+
queryKey: [SAVES_USE_QUERY_KEY, id],
|
|
8
8
|
queryFn: async () => (await getSaveFromIndexDB(id)) || null,
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const LAST_SAVE_USE_QUERY_KEY = "last_save_use_query_key";
|
|
13
13
|
export function useQueryLastSave() {
|
|
14
14
|
return useQuery({
|
|
15
|
-
queryKey: [
|
|
15
|
+
queryKey: [LAST_SAVE_USE_QUERY_KEY],
|
|
16
16
|
queryFn: async () => (await getLastSaveFromIndexDB()) || null,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const IS_FULL_SCREEN_MODE_USE_QUERY_KEY = "is_full_screen_mode_use_query_key";
|
|
4
4
|
|
|
5
5
|
export function useQueryIsFullModeScreen() {
|
|
6
6
|
return useQuery({
|
|
7
|
-
queryKey: [
|
|
7
|
+
queryKey: [IS_FULL_SCREEN_MODE_USE_QUERY_KEY],
|
|
8
8
|
queryFn: async () => document.fullscreenElement !== null,
|
|
9
9
|
});
|
|
10
10
|
}
|
|
@@ -2,11 +2,11 @@ import { PendingComponent } from "@/components/loading";
|
|
|
2
2
|
import { SettingsDialogue } from "@/components/menus/settings";
|
|
3
3
|
import { OfflineAllert } from "@/components/modals/error-allerts";
|
|
4
4
|
import { RootProvider } from "@/components/providers/root-provider";
|
|
5
|
+
import { INTERFACE_DATA_USE_QUERY_KEY } from "@/constants";
|
|
5
6
|
import useInkInitialization from "@/lib/hooks/ink-hooks";
|
|
6
7
|
import { useConfirmBackNavigation } from "@/lib/hooks/navigation-hooks";
|
|
7
8
|
import { useAutoSaveOnPageClose } from "@/lib/hooks/save-hooks";
|
|
8
9
|
import { useI18n } from "@/lib/i18n";
|
|
9
|
-
import { INTERFACE_DATA_USE_QUEY_KEY } from "@/lib/query/interface-query";
|
|
10
10
|
import { SearchParams } from "@/lib/stores/search-param-store";
|
|
11
11
|
import { defineAssets } from "@/lib/utils/assets-utility";
|
|
12
12
|
import { initializeIndexedDB } from "@/lib/utils/db-utility";
|
|
@@ -33,7 +33,7 @@ export const Route = createRootRouteWithContext<RouterContext>()({
|
|
|
33
33
|
const isRefreshSaveExist = await loadRefreshSave();
|
|
34
34
|
if (isRefreshSaveExist) {
|
|
35
35
|
await context.queryClient.invalidateQueries({
|
|
36
|
-
queryKey: [
|
|
36
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY],
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"license": "GPL-3.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@base-ui/react": "^1.5.0",
|
|
13
|
-
"@drincs/pixi-vn": "^1.8.
|
|
14
|
-
"@drincs/pixi-vn-ink": "^1.0.
|
|
13
|
+
"@drincs/pixi-vn": "^1.8.13",
|
|
14
|
+
"@drincs/pixi-vn-ink": "^1.0.5",
|
|
15
15
|
"@drincs/pixi-vn-spine": "^0.2.1",
|
|
16
16
|
"@tailwindcss/vite": "^4.3.0",
|
|
17
17
|
"@tanstack/react-devtools": "^0.10.5",
|
|
@@ -2119,9 +2119,9 @@
|
|
|
2119
2119
|
}
|
|
2120
2120
|
},
|
|
2121
2121
|
"node_modules/@drincs/pixi-vn": {
|
|
2122
|
-
"version": "1.8.
|
|
2123
|
-
"resolved": "https://registry.npmjs.org/@drincs/pixi-vn/-/pixi-vn-1.8.
|
|
2124
|
-
"integrity": "sha512-
|
|
2122
|
+
"version": "1.8.13",
|
|
2123
|
+
"resolved": "https://registry.npmjs.org/@drincs/pixi-vn/-/pixi-vn-1.8.13.tgz",
|
|
2124
|
+
"integrity": "sha512-UFo1cUYmy3FSgqKqjHkA5NpTXSwjk24WMZAkGe9tgoVLcexi1d+TmhJGSt1VloPjw/hHwYKaip2vyrmBACZ1fA==",
|
|
2125
2125
|
"license": "LGPL-2.1",
|
|
2126
2126
|
"workspaces": [
|
|
2127
2127
|
"sandbox"
|
|
@@ -2146,9 +2146,9 @@
|
|
|
2146
2146
|
}
|
|
2147
2147
|
},
|
|
2148
2148
|
"node_modules/@drincs/pixi-vn-ink": {
|
|
2149
|
-
"version": "1.0.
|
|
2150
|
-
"resolved": "https://registry.npmjs.org/@drincs/pixi-vn-ink/-/pixi-vn-ink-1.0.
|
|
2151
|
-
"integrity": "sha512-
|
|
2149
|
+
"version": "1.0.5",
|
|
2150
|
+
"resolved": "https://registry.npmjs.org/@drincs/pixi-vn-ink/-/pixi-vn-ink-1.0.5.tgz",
|
|
2151
|
+
"integrity": "sha512-oYp4xkp2MQJHebyDfnD90U3dtSZ/9ARwMehg1OvMwR7MRbpske9NNM6OJ9ijA68j/1TPJP/LUuDPpdNmDQwcRQ==",
|
|
2152
2152
|
"license": "LGPL-2.1",
|
|
2153
2153
|
"workspaces": [
|
|
2154
2154
|
"playground"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button } from "@/components/ui/button";
|
|
2
2
|
import { useNarrationFunctions } from "@/lib/hooks/narration-hooks";
|
|
3
|
-
import { useQueryChoiceMenuOptions } from "@/lib/query/
|
|
3
|
+
import { useQueryChoiceMenuOptions } from "@/lib/query/narration-query";
|
|
4
4
|
import { GameStatus } from "@/lib/stores/game-status-store";
|
|
5
5
|
import { TextDisplaySettings } from "@/lib/stores/text-display-settings-store";
|
|
6
6
|
import { useDebouncedValue } from "@tanstack/react-pacer";
|
|
@@ -3,11 +3,14 @@ import { Button } from "@/components/ui/button";
|
|
|
3
3
|
import { Card, CardContent } from "@/components/ui/card";
|
|
4
4
|
import { Spinner } from "@/components/ui/spinner";
|
|
5
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CANVAS_UI_LAYER_NAME,
|
|
8
|
+
INTERFACE_DATA_USE_QUERY_KEY,
|
|
9
|
+
overlayTextShadowClass,
|
|
10
|
+
} from "@/constants";
|
|
7
11
|
import { useSetSearchParamState } from "@/lib/hooks/navigation-hooks";
|
|
8
12
|
import { useGameProps } from "@/lib/hooks/props-hooks";
|
|
9
13
|
import { useQuit } from "@/lib/hooks/quit-hooks";
|
|
10
|
-
import { INTERFACE_DATA_USE_QUEY_KEY as INTERFACE_DATA_USE_QUERY_KEY } from "@/lib/query/interface-query";
|
|
11
14
|
import { useQueryLastSave } from "@/lib/query/save-query";
|
|
12
15
|
import { InterfaceSettings } from "@/lib/stores/interface-settings-store";
|
|
13
16
|
import { cn } from "@/lib/utils";
|
package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/menus/history.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { Kbd } from "@/components/ui/kbd";
|
|
12
12
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
13
13
|
import { useImageSrc } from "@/lib/hooks/image-hooks";
|
|
14
|
-
import { useQueryNarrativeHistory } from "@/lib/query/
|
|
14
|
+
import { useQueryNarrativeHistory } from "@/lib/query/narration-query";
|
|
15
15
|
import { cn } from "@/lib/utils";
|
|
16
16
|
import { useDebouncedValue } from "@tanstack/react-pacer";
|
|
17
17
|
import { Check, Search } from "lucide-react";
|
|
@@ -42,10 +42,7 @@ export function HistoryList({ searchString }: { searchString?: string }) {
|
|
|
42
42
|
<Item key={key} variant="outline">
|
|
43
43
|
{item.character && (
|
|
44
44
|
<ItemMedia variant="image">
|
|
45
|
-
<HistoryItemAvatar
|
|
46
|
-
icon={item.icon}
|
|
47
|
-
character={item.character}
|
|
48
|
-
/>
|
|
45
|
+
<HistoryItemAvatar icon={item.icon} character={item.character} />
|
|
49
46
|
</ItemMedia>
|
|
50
47
|
)}
|
|
51
48
|
<ItemContent
|
package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/system-controls.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
|
|
|
14
14
|
import { useLanguageSettings } from "@/lib/hooks/language-settings-hooks";
|
|
15
15
|
import { downloadResourceToTranslate } from "@/lib/i18n";
|
|
16
16
|
import {
|
|
17
|
-
|
|
17
|
+
IS_FULL_SCREEN_MODE_USE_QUERY_KEY,
|
|
18
18
|
useQueryIsFullModeScreen,
|
|
19
19
|
} from "@/lib/query/settings-query";
|
|
20
20
|
import { TextDisplaySettings } from "@/lib/stores/text-display-settings-store";
|
|
@@ -172,7 +172,7 @@ export function FullScreenSettings() {
|
|
|
172
172
|
promise.finally(() => {
|
|
173
173
|
setLoading(false);
|
|
174
174
|
queryClient.invalidateQueries({
|
|
175
|
-
queryKey: [
|
|
175
|
+
queryKey: [IS_FULL_SCREEN_MODE_USE_QUERY_KEY],
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
178
|
}}
|
package/template-react-vite-muijoy-ink-tauri/src/components/modals/input-request-dialogues.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { Button } from "@/components/ui/button";
|
|
|
2
2
|
import { Dialog, DialogContent, DialogFooter } from "@/components/ui/dialog";
|
|
3
3
|
import { Input } from "@/components/ui/input";
|
|
4
4
|
import { useGameProps } from "@/lib/hooks/props-hooks";
|
|
5
|
-
import { useQueryDialogue, useQueryInputValue } from "@/lib/query/
|
|
5
|
+
import { useQueryDialogue, useQueryInputValue } from "@/lib/query/narration-query";
|
|
6
6
|
import { TextDisplaySettings } from "@/lib/stores/text-display-settings-store";
|
|
7
7
|
import { narration } from "@drincs/pixi-vn";
|
|
8
8
|
import { useDebouncedValue } from "@tanstack/react-pacer";
|
|
@@ -5,10 +5,10 @@ import { useNarrationFunctions } from "@/lib/hooks/narration-hooks";
|
|
|
5
5
|
import { useSetSearchParamState } from "@/lib/hooks/navigation-hooks";
|
|
6
6
|
import { useGameProps } from "@/lib/hooks/props-hooks";
|
|
7
7
|
import { useWheelActions } from "@/lib/hooks/quick-tools-hooks";
|
|
8
|
-
import { useQueryCanGoBack } from "@/lib/query/
|
|
8
|
+
import { useQueryCanGoBack } from "@/lib/query/narration-query";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
LAST_SAVE_USE_QUERY_KEY,
|
|
11
|
+
SAVES_USE_QUERY_KEY,
|
|
12
12
|
useQueryLastSave,
|
|
13
13
|
} from "@/lib/query/save-query";
|
|
14
14
|
import { AutoSettings } from "@/lib/stores/auto-settings-store";
|
|
@@ -105,8 +105,8 @@ export function QuickTools() {
|
|
|
105
105
|
className="h-5 px-1 text-[10px] sm:h-6 sm:px-2 sm:text-xs"
|
|
106
106
|
onClick={() => {
|
|
107
107
|
const savePromise = saveGameToIndexDB().then((save) => {
|
|
108
|
-
queryClient.setQueryData([
|
|
109
|
-
queryClient.setQueryData([
|
|
108
|
+
queryClient.setQueryData([SAVES_USE_QUERY_KEY, save.id], save);
|
|
109
|
+
queryClient.setQueryData([LAST_SAVE_USE_QUERY_KEY], save);
|
|
110
110
|
});
|
|
111
111
|
toast.promise(savePromise, {
|
|
112
112
|
loading: t("saving"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChoiceMenu } from "@/components/menus/choice-menus";
|
|
2
2
|
import { NarrationCards } from "@/components/screens/narration/narration-cards";
|
|
3
3
|
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable";
|
|
4
|
-
import { useQueryDialogue } from "@/lib/query/
|
|
4
|
+
import { useQueryDialogue } from "@/lib/query/narration-query";
|
|
5
5
|
|
|
6
6
|
export function NarrationScreen() {
|
|
7
7
|
const { data: { animatedText, text } = {} } = useQueryDialogue();
|
package/template-react-vite-muijoy-ink-tauri/src/components/screens/narration/narration-cards.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { Image } from "@/components/ui/image";
|
|
|
6
6
|
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable";
|
|
7
7
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
8
8
|
import { useNarrationPointerHandlers } from "@/lib/hooks/narration-hooks";
|
|
9
|
-
import { useQueryDialogue } from "@/lib/query/
|
|
9
|
+
import { useQueryDialogue } from "@/lib/query/narration-query";
|
|
10
10
|
import { TextDisplaySettings } from "@/lib/stores/text-display-settings-store";
|
|
11
11
|
import { useSelector } from "@tanstack/react-store";
|
|
12
12
|
import { type RefObject, useCallback, useRef } from "react";
|
|
@@ -9,5 +9,7 @@ export const SFX_CHANNEL_NAME = "sfx";
|
|
|
9
9
|
|
|
10
10
|
export const SKIP_DELAY = 100;
|
|
11
11
|
|
|
12
|
+
export const INTERFACE_DATA_USE_QUERY_KEY = "interface_data_use_query_key";
|
|
13
|
+
|
|
12
14
|
/** Text-shadow that outlines text with black so it remains legible over any image or canvas background. */
|
|
13
15
|
export const overlayTextShadowClass = "[text-shadow:0_0_3px_black,0_0_6px_black]";
|
|
@@ -2,10 +2,10 @@ import { useAlertDialog } from "@/components/providers/alert-dialog-provider";
|
|
|
2
2
|
import { useNarrationFunctions } from "@/lib/hooks/narration-hooks";
|
|
3
3
|
import { useSetSearchParamState } from "@/lib/hooks/navigation-hooks";
|
|
4
4
|
import { useGameProps } from "@/lib/hooks/props-hooks";
|
|
5
|
-
import { useQueryInputValue } from "@/lib/query/
|
|
5
|
+
import { useQueryInputValue } from "@/lib/query/narration-query";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
LAST_SAVE_USE_QUERY_KEY,
|
|
8
|
+
SAVES_USE_QUERY_KEY,
|
|
9
9
|
useQueryLastSave,
|
|
10
10
|
} from "@/lib/query/save-query";
|
|
11
11
|
import { QuickActionsWheelState } from "@/lib/stores/quick-actions-wheel-store";
|
|
@@ -47,8 +47,8 @@ export function useSaveHotkeys(): null {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
const savePromise = saveGameToIndexDB().then((save) => {
|
|
50
|
-
queryClient.setQueryData([
|
|
51
|
-
queryClient.setQueryData([
|
|
50
|
+
queryClient.setQueryData([SAVES_USE_QUERY_KEY, save.id], save);
|
|
51
|
+
queryClient.setQueryData([LAST_SAVE_USE_QUERY_KEY], save);
|
|
52
52
|
});
|
|
53
53
|
toast.promise(savePromise, {
|
|
54
54
|
loading: t("saving"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INTERFACE_DATA_USE_QUERY_KEY } from "@/constants";
|
|
2
2
|
import type { StepLabelProps } from "@drincs/pixi-vn";
|
|
3
3
|
import { useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { useNavigate } from "@tanstack/react-router";
|
|
@@ -18,7 +18,9 @@ export function useGameProps(): StepLabelProps {
|
|
|
18
18
|
toast,
|
|
19
19
|
invalidateInterfaceData: async (delay: number = 0) => {
|
|
20
20
|
if (delay > 0) await new Promise((resolve) => setTimeout(resolve, delay));
|
|
21
|
-
return await queryClient.invalidateQueries({
|
|
21
|
+
return await queryClient.invalidateQueries({
|
|
22
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY],
|
|
23
|
+
});
|
|
22
24
|
},
|
|
23
25
|
};
|
|
24
26
|
}
|
|
@@ -2,7 +2,7 @@ import { SaveNameInput } from "@/components/menus/save-menu/save-forms";
|
|
|
2
2
|
import { useAlertDialog } from "@/components/providers/alert-dialog-provider";
|
|
3
3
|
import { useSetSearchParamState } from "@/lib/hooks/navigation-hooks";
|
|
4
4
|
import { useGameProps } from "@/lib/hooks/props-hooks";
|
|
5
|
-
import {
|
|
5
|
+
import { LAST_SAVE_USE_QUERY_KEY, SAVES_USE_QUERY_KEY } from "@/lib/query/save-query";
|
|
6
6
|
import {
|
|
7
7
|
addRefreshSave,
|
|
8
8
|
deleteSaveFromIndexDB,
|
|
@@ -62,8 +62,8 @@ export function useSaveActions() {
|
|
|
62
62
|
onConfirm: () =>
|
|
63
63
|
deleteSaveFromIndexDB(id)
|
|
64
64
|
.then(() => {
|
|
65
|
-
queryClient.setQueryData([
|
|
66
|
-
queryClient.invalidateQueries({ queryKey: [
|
|
65
|
+
queryClient.setQueryData([SAVES_USE_QUERY_KEY, id], null);
|
|
66
|
+
queryClient.invalidateQueries({ queryKey: [LAST_SAVE_USE_QUERY_KEY] });
|
|
67
67
|
toast.success(t("success_delete"));
|
|
68
68
|
return true;
|
|
69
69
|
})
|
|
@@ -95,8 +95,8 @@ export function useSaveActions() {
|
|
|
95
95
|
id,
|
|
96
96
|
name: tempSaveNameRef.current,
|
|
97
97
|
}).then((save) => {
|
|
98
|
-
queryClient.setQueryData([
|
|
99
|
-
queryClient.setQueryData([
|
|
98
|
+
queryClient.setQueryData([SAVES_USE_QUERY_KEY, save.id], save);
|
|
99
|
+
queryClient.setQueryData([LAST_SAVE_USE_QUERY_KEY], save);
|
|
100
100
|
});
|
|
101
101
|
toast.promise(savePromise, {
|
|
102
102
|
loading: t("saving"),
|
|
@@ -138,8 +138,8 @@ export function useSaveActions() {
|
|
|
138
138
|
id,
|
|
139
139
|
name: tempSaveNameRef.current,
|
|
140
140
|
}).then((save) => {
|
|
141
|
-
queryClient.setQueryData([
|
|
142
|
-
queryClient.setQueryData([
|
|
141
|
+
queryClient.setQueryData([SAVES_USE_QUERY_KEY, save.id], save);
|
|
142
|
+
queryClient.setQueryData([LAST_SAVE_USE_QUERY_KEY], save);
|
|
143
143
|
});
|
|
144
144
|
toast.promise(savePromise, {
|
|
145
145
|
loading: t("saving"),
|
package/template-react-vite-muijoy-ink-tauri/src/lib/query/{interface-query.ts → narration-query.ts}
RENAMED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
+
import { INTERFACE_DATA_USE_QUERY_KEY } from "@/constants";
|
|
1
2
|
import { type CharacterInterface, narration, stepHistory } from "@drincs/pixi-vn";
|
|
2
3
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
4
|
import { useTranslation } from "react-i18next";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const CAN_GO_BACK_USE_QUEY_KEY = "can_go_back_use_quey_key";
|
|
6
|
+
const CAN_GO_BACK_USE_QUERY_KEY = "can_go_back_use_query_key";
|
|
8
7
|
export function useQueryCanGoBack() {
|
|
9
8
|
return useQuery({
|
|
10
|
-
queryKey: [
|
|
9
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, CAN_GO_BACK_USE_QUERY_KEY],
|
|
11
10
|
queryFn: async () => stepHistory.canGoBack,
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
const
|
|
14
|
+
const CHOICE_MENU_OPTIONS_USE_QUERY_KEY = "choice_menu_options_use_query_key";
|
|
16
15
|
export function useQueryChoiceMenuOptions() {
|
|
17
16
|
const { t } = useTranslation(["narration"]);
|
|
18
17
|
return useQuery({
|
|
19
|
-
queryKey: [
|
|
18
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, CHOICE_MENU_OPTIONS_USE_QUERY_KEY],
|
|
20
19
|
queryFn: async () =>
|
|
21
20
|
narration.choices?.map((option) => ({
|
|
22
21
|
...option,
|
|
@@ -28,10 +27,10 @@ export function useQueryChoiceMenuOptions() {
|
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
const
|
|
30
|
+
const INPUT_VALUE_USE_QUERY_KEY = "input_value_use_query_key";
|
|
32
31
|
export function useQueryInputValue<T>() {
|
|
33
32
|
return useQuery({
|
|
34
|
-
queryKey: [
|
|
33
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, INPUT_VALUE_USE_QUERY_KEY],
|
|
35
34
|
queryFn: async () => ({
|
|
36
35
|
isRequired: narration.isRequiredInput,
|
|
37
36
|
type: narration.inputType,
|
|
@@ -45,13 +44,13 @@ type DialogueModel = {
|
|
|
45
44
|
text?: string;
|
|
46
45
|
character?: CharacterInterface;
|
|
47
46
|
};
|
|
48
|
-
const
|
|
47
|
+
const DIALOGUE_USE_QUERY_KEY = "dialogue_use_query_key";
|
|
49
48
|
export function useQueryDialogue() {
|
|
50
49
|
const { t } = useTranslation(["narration"]);
|
|
51
50
|
const queryClient = useQueryClient();
|
|
52
51
|
|
|
53
52
|
return useQuery<DialogueModel>({
|
|
54
|
-
queryKey: [
|
|
53
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, DIALOGUE_USE_QUERY_KEY],
|
|
55
54
|
queryFn: async ({ queryKey }) => {
|
|
56
55
|
const dialogue = narration.dialogue;
|
|
57
56
|
let text = dialogue?.text;
|
|
@@ -90,21 +89,21 @@ export function useQueryDialogue() {
|
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
const
|
|
92
|
+
const CAN_GO_NEXT_USE_QUERY_KEY = "can_go_next_use_query_key";
|
|
94
93
|
export function useQueryCanGoNext() {
|
|
95
94
|
return useQuery({
|
|
96
|
-
queryKey: [
|
|
95
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, CAN_GO_NEXT_USE_QUERY_KEY],
|
|
97
96
|
queryFn: async () => narration.canContinue && !narration.isRequiredInput,
|
|
98
97
|
});
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
const
|
|
100
|
+
const NARRATIVE_HISTORY_USE_QUERY_KEY = "narrative_history_use_query_key";
|
|
102
101
|
export function useQueryNarrativeHistory({ searchString }: { searchString?: string }) {
|
|
103
102
|
const { t } = useTranslation(["narration"]);
|
|
104
103
|
const normalizedSearch = searchString?.toLowerCase().trim();
|
|
105
104
|
|
|
106
105
|
return useQuery({
|
|
107
|
-
queryKey: [
|
|
106
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY, NARRATIVE_HISTORY_USE_QUERY_KEY],
|
|
108
107
|
queryFn: async () => {
|
|
109
108
|
const promises = stepHistory.narrativeHistory.map(async (step) => {
|
|
110
109
|
const character = step.dialogue?.character;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { getLastSaveFromIndexDB, getSaveFromIndexDB } from "@/lib/utils/save-utility";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const SAVES_USE_QUERY_KEY = "saves_use_query_key";
|
|
5
5
|
export function useQuerySaves({ id }: { id: number }) {
|
|
6
6
|
return useQuery({
|
|
7
|
-
queryKey: [
|
|
7
|
+
queryKey: [SAVES_USE_QUERY_KEY, id],
|
|
8
8
|
queryFn: async () => (await getSaveFromIndexDB(id)) || null,
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const LAST_SAVE_USE_QUERY_KEY = "last_save_use_query_key";
|
|
13
13
|
export function useQueryLastSave() {
|
|
14
14
|
return useQuery({
|
|
15
|
-
queryKey: [
|
|
15
|
+
queryKey: [LAST_SAVE_USE_QUERY_KEY],
|
|
16
16
|
queryFn: async () => (await getLastSaveFromIndexDB()) || null,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
2
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const IS_FULL_SCREEN_MODE_USE_QUERY_KEY = "is_full_screen_mode_use_query_key";
|
|
5
5
|
|
|
6
6
|
export function useQueryIsFullModeScreen() {
|
|
7
7
|
return useQuery({
|
|
8
|
-
queryKey: [
|
|
8
|
+
queryKey: [IS_FULL_SCREEN_MODE_USE_QUERY_KEY],
|
|
9
9
|
queryFn: async () => {
|
|
10
10
|
if (window.__TAURI__) {
|
|
11
11
|
return getCurrentWindow().isFullscreen();
|
|
@@ -2,11 +2,11 @@ import { PendingComponent } from "@/components/loading";
|
|
|
2
2
|
import { SettingsDialogue } from "@/components/menus/settings";
|
|
3
3
|
import { OfflineAllert } from "@/components/modals/error-allerts";
|
|
4
4
|
import { RootProvider } from "@/components/providers/root-provider";
|
|
5
|
+
import { INTERFACE_DATA_USE_QUERY_KEY } from "@/constants";
|
|
5
6
|
import useInkInitialization from "@/lib/hooks/ink-hooks";
|
|
6
7
|
import { useConfirmBackNavigation } from "@/lib/hooks/navigation-hooks";
|
|
7
8
|
import { useAutoSaveOnPageClose } from "@/lib/hooks/save-hooks";
|
|
8
9
|
import { useI18n } from "@/lib/i18n";
|
|
9
|
-
import { INTERFACE_DATA_USE_QUEY_KEY } from "@/lib/query/interface-query";
|
|
10
10
|
import { SearchParams } from "@/lib/stores/search-param-store";
|
|
11
11
|
import { defineAssets } from "@/lib/utils/assets-utility";
|
|
12
12
|
import { initializeIndexedDB } from "@/lib/utils/db-utility";
|
|
@@ -33,7 +33,7 @@ export const Route = createRootRouteWithContext<RouterContext>()({
|
|
|
33
33
|
const isRefreshSaveExist = await loadRefreshSave();
|
|
34
34
|
if (isRefreshSaveExist) {
|
|
35
35
|
await context.queryClient.invalidateQueries({
|
|
36
|
-
queryKey: [
|
|
36
|
+
queryKey: [INTERFACE_DATA_USE_QUERY_KEY],
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button } from "@/components/ui/button";
|
|
2
2
|
import { useNarrationFunctions } from "@/lib/hooks/narration-hooks";
|
|
3
|
-
import { useQueryChoiceMenuOptions } from "@/lib/query/
|
|
3
|
+
import { useQueryChoiceMenuOptions } from "@/lib/query/narration-query";
|
|
4
4
|
import { GameStatus } from "@/lib/stores/game-status-store";
|
|
5
5
|
import { TextDisplaySettings } from "@/lib/stores/text-display-settings-store";
|
|
6
6
|
import { useDebouncedValue } from "@tanstack/react-pacer";
|
|
@@ -3,11 +3,14 @@ import { Button } from "@/components/ui/button";
|
|
|
3
3
|
import { Card, CardContent } from "@/components/ui/card";
|
|
4
4
|
import { Spinner } from "@/components/ui/spinner";
|
|
5
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CANVAS_UI_LAYER_NAME,
|
|
8
|
+
INTERFACE_DATA_USE_QUERY_KEY,
|
|
9
|
+
overlayTextShadowClass,
|
|
10
|
+
} from "@/constants";
|
|
7
11
|
import { useSetSearchParamState } from "@/lib/hooks/navigation-hooks";
|
|
8
12
|
import { useGameProps } from "@/lib/hooks/props-hooks";
|
|
9
13
|
import { useQuit } from "@/lib/hooks/quit-hooks";
|
|
10
|
-
import { INTERFACE_DATA_USE_QUEY_KEY as INTERFACE_DATA_USE_QUERY_KEY } from "@/lib/query/interface-query";
|
|
11
14
|
import { useQueryLastSave } from "@/lib/query/save-query";
|
|
12
15
|
import { InterfaceSettings } from "@/lib/stores/interface-settings-store";
|
|
13
16
|
import { cn } from "@/lib/utils";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { Kbd } from "@/components/ui/kbd";
|
|
12
12
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
13
13
|
import { useImageSrc } from "@/lib/hooks/image-hooks";
|
|
14
|
-
import { useQueryNarrativeHistory } from "@/lib/query/
|
|
14
|
+
import { useQueryNarrativeHistory } from "@/lib/query/narration-query";
|
|
15
15
|
import { cn } from "@/lib/utils";
|
|
16
16
|
import { useDebouncedValue } from "@tanstack/react-pacer";
|
|
17
17
|
import { Check, Search } from "lucide-react";
|
|
@@ -42,10 +42,7 @@ export function HistoryList({ searchString }: { searchString?: string }) {
|
|
|
42
42
|
<Item key={key} variant="outline">
|
|
43
43
|
{item.character && (
|
|
44
44
|
<ItemMedia variant="image">
|
|
45
|
-
<HistoryItemAvatar
|
|
46
|
-
icon={item.icon}
|
|
47
|
-
character={item.character}
|
|
48
|
-
/>
|
|
45
|
+
<HistoryItemAvatar icon={item.icon} character={item.character} />
|
|
49
46
|
</ItemMedia>
|
|
50
47
|
)}
|
|
51
48
|
<ItemContent
|
|
@@ -14,7 +14,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
|
|
|
14
14
|
import { useLanguageSettings } from "@/lib/hooks/language-settings-hooks";
|
|
15
15
|
import { downloadResourceToTranslate } from "@/lib/i18n";
|
|
16
16
|
import {
|
|
17
|
-
|
|
17
|
+
IS_FULL_SCREEN_MODE_USE_QUERY_KEY,
|
|
18
18
|
useQueryIsFullModeScreen,
|
|
19
19
|
} from "@/lib/query/settings-query";
|
|
20
20
|
import { TextDisplaySettings } from "@/lib/stores/text-display-settings-store";
|
|
@@ -172,7 +172,7 @@ export function FullScreenSettings() {
|
|
|
172
172
|
promise.finally(() => {
|
|
173
173
|
setLoading(false);
|
|
174
174
|
queryClient.invalidateQueries({
|
|
175
|
-
queryKey: [
|
|
175
|
+
queryKey: [IS_FULL_SCREEN_MODE_USE_QUERY_KEY],
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
178
|
}}
|
|
@@ -2,7 +2,7 @@ import { Button } from "@/components/ui/button";
|
|
|
2
2
|
import { Dialog, DialogContent, DialogFooter } from "@/components/ui/dialog";
|
|
3
3
|
import { Input } from "@/components/ui/input";
|
|
4
4
|
import { useGameProps } from "@/lib/hooks/props-hooks";
|
|
5
|
-
import { useQueryDialogue, useQueryInputValue } from "@/lib/query/
|
|
5
|
+
import { useQueryDialogue, useQueryInputValue } from "@/lib/query/narration-query";
|
|
6
6
|
import { TextDisplaySettings } from "@/lib/stores/text-display-settings-store";
|
|
7
7
|
import { narration } from "@drincs/pixi-vn";
|
|
8
8
|
import { useDebouncedValue } from "@tanstack/react-pacer";
|