@luna-editor/engine 0.2.0 → 0.3.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.
- package/dist/Player.d.ts +1 -1
- package/dist/Player.js +504 -77
- package/dist/api/conversationBranch.d.ts +4 -0
- package/dist/api/conversationBranch.js +83 -0
- package/dist/components/BackgroundLayer.d.ts +19 -0
- package/dist/components/BackgroundLayer.js +218 -0
- package/dist/components/ClickWaitIndicator.d.ts +10 -0
- package/dist/components/ClickWaitIndicator.js +31 -0
- package/dist/components/ConversationBranchBox.d.ts +2 -0
- package/dist/components/ConversationBranchBox.js +29 -0
- package/dist/components/DialogueBox.js +16 -1
- package/dist/components/FontSettingsPanel.d.ts +10 -0
- package/dist/components/FontSettingsPanel.js +30 -0
- package/dist/components/FullscreenTextBox.d.ts +6 -0
- package/dist/components/FullscreenTextBox.js +70 -0
- package/dist/components/GameScreen.d.ts +1 -0
- package/dist/components/GameScreen.js +363 -81
- package/dist/components/PluginComponentProvider.d.ts +2 -2
- package/dist/components/PluginComponentProvider.js +3 -3
- package/dist/components/TimeWaitIndicator.d.ts +15 -0
- package/dist/components/TimeWaitIndicator.js +17 -0
- package/dist/contexts/AudioContext.d.ts +1 -0
- package/dist/contexts/AudioContext.js +1 -0
- package/dist/contexts/DataContext.js +69 -11
- package/dist/hooks/useBacklog.js +3 -0
- package/dist/hooks/useConversationBranch.d.ts +16 -0
- package/dist/hooks/useConversationBranch.js +125 -0
- package/dist/hooks/useFontLoader.d.ts +23 -0
- package/dist/hooks/useFontLoader.js +153 -0
- package/dist/hooks/useFullscreenText.d.ts +17 -0
- package/dist/hooks/useFullscreenText.js +120 -0
- package/dist/hooks/usePlayerLogic.d.ts +10 -3
- package/dist/hooks/usePlayerLogic.js +115 -18
- package/dist/hooks/usePluginEvents.d.ts +4 -1
- package/dist/hooks/usePluginEvents.js +16 -11
- package/dist/hooks/usePreloadImages.js +27 -7
- package/dist/hooks/useSoundPlayer.d.ts +15 -0
- package/dist/hooks/useSoundPlayer.js +209 -0
- package/dist/hooks/useTypewriter.d.ts +6 -2
- package/dist/hooks/useTypewriter.js +42 -6
- package/dist/hooks/useVoice.js +4 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/plugin/PluginManager.d.ts +66 -2
- package/dist/plugin/PluginManager.js +349 -79
- package/dist/sdk.d.ts +178 -21
- package/dist/sdk.js +27 -2
- package/dist/types.d.ts +288 -4
- package/dist/utils/branchBlockConverter.d.ts +2 -0
- package/dist/utils/branchBlockConverter.js +21 -0
- package/dist/utils/branchNavigator.d.ts +14 -0
- package/dist/utils/branchNavigator.js +55 -0
- package/dist/utils/facePositionCalculator.js +0 -1
- package/dist/utils/variableManager.d.ts +18 -0
- package/dist/utils/variableManager.js +159 -0
- package/package.json +1 -1
- package/dist/components/ConversationLogUI.d.ts +0 -2
- package/dist/components/ConversationLogUI.js +0 -115
- package/dist/hooks/useConversationLog.d.ts +0 -14
- package/dist/hooks/useConversationLog.js +0 -82
- package/dist/hooks/useUIVisibility.d.ts +0 -9
- package/dist/hooks/useUIVisibility.js +0 -19
- package/dist/plugin/luna-react.d.ts +0 -41
- package/dist/plugin/luna-react.js +0 -99
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useState } from "react";
|
|
3
|
-
import { useDataAPI } from "../contexts/DataContext";
|
|
4
|
-
export const ConversationLogUI = () => {
|
|
5
|
-
const dataAPI = useDataAPI();
|
|
6
|
-
const logs = dataAPI.get("conversationLog", "entries");
|
|
7
|
-
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
8
|
-
const openDialog = useCallback((e) => {
|
|
9
|
-
e.stopPropagation();
|
|
10
|
-
e.preventDefault();
|
|
11
|
-
setIsDialogOpen(true);
|
|
12
|
-
}, []);
|
|
13
|
-
const closeDialog = useCallback((e) => {
|
|
14
|
-
if (e) {
|
|
15
|
-
e.stopPropagation();
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
}
|
|
18
|
-
setIsDialogOpen(false);
|
|
19
|
-
}, []);
|
|
20
|
-
const handleDialogBackdropClick = useCallback((e) => {
|
|
21
|
-
if (e.target === e.currentTarget) {
|
|
22
|
-
closeDialog();
|
|
23
|
-
}
|
|
24
|
-
}, [closeDialog]);
|
|
25
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: openDialog, style: {
|
|
26
|
-
position: "fixed",
|
|
27
|
-
top: "20px",
|
|
28
|
-
right: "20px",
|
|
29
|
-
width: "50px",
|
|
30
|
-
height: "50px",
|
|
31
|
-
background: "rgba(74, 144, 226, 0.9)",
|
|
32
|
-
border: "none",
|
|
33
|
-
borderRadius: "25px",
|
|
34
|
-
color: "white",
|
|
35
|
-
fontSize: "20px",
|
|
36
|
-
cursor: "pointer",
|
|
37
|
-
zIndex: 1000,
|
|
38
|
-
boxShadow: "0 2px 10px rgba(0,0,0,0.3)",
|
|
39
|
-
transition: "all 0.3s ease",
|
|
40
|
-
}, onMouseOver: (e) => {
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
e.currentTarget.style.background = "rgba(74, 144, 226, 1)";
|
|
43
|
-
e.currentTarget.style.transform = "scale(1.1)";
|
|
44
|
-
}, onMouseOut: (e) => {
|
|
45
|
-
e.stopPropagation();
|
|
46
|
-
e.currentTarget.style.background = "rgba(74, 144, 226, 0.9)";
|
|
47
|
-
e.currentTarget.style.transform = "scale(1)";
|
|
48
|
-
}, title: "\u4F1A\u8A71\u30ED\u30B0\u3092\u8868\u793A", children: "\uD83D\uDCDA" }), isDialogOpen && (_jsx("div", { style: {
|
|
49
|
-
position: "fixed",
|
|
50
|
-
top: 0,
|
|
51
|
-
left: 0,
|
|
52
|
-
right: 0,
|
|
53
|
-
bottom: 0,
|
|
54
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
55
|
-
display: "flex",
|
|
56
|
-
justifyContent: "center",
|
|
57
|
-
alignItems: "center",
|
|
58
|
-
zIndex: 10000,
|
|
59
|
-
}, onClick: handleDialogBackdropClick, children: _jsxs("div", { style: {
|
|
60
|
-
width: "80vw",
|
|
61
|
-
maxWidth: "800px",
|
|
62
|
-
maxHeight: "80vh",
|
|
63
|
-
background: "rgba(0, 0, 0, 0.9)",
|
|
64
|
-
border: "1px solid #333",
|
|
65
|
-
borderRadius: "8px",
|
|
66
|
-
padding: "20px",
|
|
67
|
-
color: "white",
|
|
68
|
-
fontFamily: "sans-serif",
|
|
69
|
-
boxShadow: "0 4px 20px rgba(0,0,0,0.5)",
|
|
70
|
-
}, onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { style: {
|
|
71
|
-
display: "flex",
|
|
72
|
-
justifyContent: "space-between",
|
|
73
|
-
alignItems: "center",
|
|
74
|
-
marginBottom: "16px",
|
|
75
|
-
borderBottom: "1px solid #333",
|
|
76
|
-
paddingBottom: "12px",
|
|
77
|
-
}, children: [_jsx("h3", { style: {
|
|
78
|
-
margin: 0,
|
|
79
|
-
fontSize: "1.2em",
|
|
80
|
-
color: "#4A90E2",
|
|
81
|
-
}, children: "\uD83D\uDCDA \u4F1A\u8A71\u30ED\u30B0" }), _jsx("button", { type: "button", onClick: closeDialog, style: {
|
|
82
|
-
background: "#666",
|
|
83
|
-
border: "none",
|
|
84
|
-
color: "white",
|
|
85
|
-
padding: "6px 12px",
|
|
86
|
-
borderRadius: "4px",
|
|
87
|
-
cursor: "pointer",
|
|
88
|
-
}, children: "\u2715 \u9589\u3058\u308B" })] }), _jsx("div", { style: {
|
|
89
|
-
maxHeight: "60vh",
|
|
90
|
-
overflowY: "auto",
|
|
91
|
-
marginBottom: "16px",
|
|
92
|
-
scrollbarWidth: "thin",
|
|
93
|
-
scrollbarColor: "#666 transparent",
|
|
94
|
-
}, children: logs.length > 0 ? (logs.map((log) => (_jsxs("div", { style: {
|
|
95
|
-
marginBottom: "12px",
|
|
96
|
-
padding: "12px",
|
|
97
|
-
background: "rgba(255,255,255,0.1)",
|
|
98
|
-
borderRadius: "4px",
|
|
99
|
-
borderLeft: "3px solid #4A90E2",
|
|
100
|
-
}, children: [_jsx("div", { style: {
|
|
101
|
-
marginBottom: "6px",
|
|
102
|
-
fontSize: "1em",
|
|
103
|
-
}, children: log.speakerName ? (_jsx("strong", { children: log.speakerName })) : (_jsx("em", { children: "\u30CA\u30EC\u30FC\u30B7\u30E7\u30F3" })) }), _jsx("div", { style: {
|
|
104
|
-
fontSize: "1em",
|
|
105
|
-
lineHeight: "1.5",
|
|
106
|
-
}, children: log.content || "(内容なし)" })] }, log.id)))) : (_jsx("div", { style: {
|
|
107
|
-
textAlign: "center",
|
|
108
|
-
color: "#888",
|
|
109
|
-
padding: "20px",
|
|
110
|
-
}, children: "\u307E\u3060\u4F1A\u8A71\u30ED\u30B0\u304C\u3042\u308A\u307E\u305B\u3093" })) }), _jsxs("div", { style: {
|
|
111
|
-
textAlign: "center",
|
|
112
|
-
fontSize: "0.8em",
|
|
113
|
-
color: "#888",
|
|
114
|
-
}, children: [logs.length, "\u4EF6\u306E\u4F1A\u8A71\u3092\u8868\u793A\u4E2D"] })] }) }))] }));
|
|
115
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ConversationLogEntry, PublishedScenario, ScenarioBlock } from "../types";
|
|
2
|
-
interface UseConversationLogOptions {
|
|
3
|
-
scenario: PublishedScenario;
|
|
4
|
-
currentBlockIndex: number;
|
|
5
|
-
currentBlock: ScenarioBlock | null;
|
|
6
|
-
}
|
|
7
|
-
interface UseConversationLogReturn {
|
|
8
|
-
logs: ConversationLogEntry[];
|
|
9
|
-
addLogEntry: (entry: ConversationLogEntry) => void;
|
|
10
|
-
clearLogs: () => void;
|
|
11
|
-
buildInitialHistory: (upToIndex: number) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function useConversationLog({ scenario, currentBlockIndex, currentBlock, }: UseConversationLogOptions): UseConversationLogReturn;
|
|
14
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
export function useConversationLog({ scenario, currentBlockIndex, currentBlock, }) {
|
|
3
|
-
const [logs, setLogs] = useState([]);
|
|
4
|
-
const hasBuiltInitialHistory = useRef(false);
|
|
5
|
-
const processedBlocks = useRef(new Set());
|
|
6
|
-
// ログエントリを追加する関数
|
|
7
|
-
const addLogEntry = useCallback((entry) => {
|
|
8
|
-
setLogs((prevLogs) => {
|
|
9
|
-
// 既存の同じブロックインデックスのエントリを削除(重複防止)
|
|
10
|
-
const filteredLogs = prevLogs.filter((log) => log.blockIndex !== entry.blockIndex);
|
|
11
|
-
// 新しいエントリを追加してソート
|
|
12
|
-
const newLogs = [...filteredLogs, entry];
|
|
13
|
-
return newLogs.sort((a, b) => a.blockIndex - b.blockIndex);
|
|
14
|
-
});
|
|
15
|
-
}, []);
|
|
16
|
-
// ログをクリアする関数
|
|
17
|
-
const clearLogs = useCallback(() => {
|
|
18
|
-
setLogs([]);
|
|
19
|
-
hasBuiltInitialHistory.current = false;
|
|
20
|
-
processedBlocks.current.clear();
|
|
21
|
-
}, []);
|
|
22
|
-
// 初期履歴を構築する関数
|
|
23
|
-
const buildInitialHistory = useCallback((upToIndex) => {
|
|
24
|
-
const conversationBlocks = scenario.blocks
|
|
25
|
-
.slice(0, upToIndex + 1)
|
|
26
|
-
.map((block, index) => ({ block, realIndex: index }))
|
|
27
|
-
.filter(({ block }) => block.blockType === "dialogue" || block.blockType === "narration");
|
|
28
|
-
console.log(`Building conversation history up to index ${upToIndex}, found ${conversationBlocks.length} conversation blocks`);
|
|
29
|
-
conversationBlocks.forEach(({ block, realIndex }) => {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
if (!processedBlocks.current.has(realIndex)) {
|
|
32
|
-
const logEntry = {
|
|
33
|
-
id: `${block.id}_init`,
|
|
34
|
-
timestamp: Date.now(),
|
|
35
|
-
blockIndex: realIndex,
|
|
36
|
-
blockType: block.blockType,
|
|
37
|
-
content: block.content,
|
|
38
|
-
speakerName: (_a = block.speaker) === null || _a === void 0 ? void 0 : _a.name,
|
|
39
|
-
speakerState: (_b = block.speakerState) === null || _b === void 0 ? void 0 : _b.name,
|
|
40
|
-
};
|
|
41
|
-
addLogEntry(logEntry);
|
|
42
|
-
processedBlocks.current.add(realIndex);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
hasBuiltInitialHistory.current = true;
|
|
46
|
-
}, [scenario.blocks, addLogEntry]);
|
|
47
|
-
// 新しいブロックを処理
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
var _a, _b;
|
|
50
|
-
if (!currentBlock || !hasBuiltInitialHistory.current) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// 会話ブロックのみログに追加
|
|
54
|
-
if (currentBlock.blockType === "dialogue" ||
|
|
55
|
-
currentBlock.blockType === "narration") {
|
|
56
|
-
if (!processedBlocks.current.has(currentBlockIndex)) {
|
|
57
|
-
console.log("Adding new conversation block to log:", currentBlock);
|
|
58
|
-
const logEntry = {
|
|
59
|
-
id: `${currentBlock.id}_${Date.now()}`,
|
|
60
|
-
timestamp: Date.now(),
|
|
61
|
-
blockIndex: currentBlockIndex,
|
|
62
|
-
blockType: currentBlock.blockType,
|
|
63
|
-
content: currentBlock.content,
|
|
64
|
-
speakerName: (_a = currentBlock.speaker) === null || _a === void 0 ? void 0 : _a.name,
|
|
65
|
-
speakerState: (_b = currentBlock.speakerState) === null || _b === void 0 ? void 0 : _b.name,
|
|
66
|
-
};
|
|
67
|
-
addLogEntry(logEntry);
|
|
68
|
-
processedBlocks.current.add(currentBlockIndex);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}, [currentBlock, currentBlockIndex, addLogEntry]);
|
|
72
|
-
// シナリオ変更時にリセット
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
clearLogs();
|
|
75
|
-
}, [scenario.id, clearLogs]);
|
|
76
|
-
return {
|
|
77
|
-
logs,
|
|
78
|
-
addLogEntry,
|
|
79
|
-
clearLogs,
|
|
80
|
-
buildInitialHistory,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PluginManager } from "../plugin/PluginManager";
|
|
2
|
-
import type { ComponentType } from "../sdk";
|
|
3
|
-
/**
|
|
4
|
-
* UI コンポーネントの表示状態を管理するフック
|
|
5
|
-
* @param pluginManager - PluginManager インスタンス
|
|
6
|
-
* @param type - コンポーネントタイプ
|
|
7
|
-
* @returns [isVisible, show, hide, toggle]
|
|
8
|
-
*/
|
|
9
|
-
export declare function useUIVisibility(pluginManager: PluginManager, type: ComponentType): [boolean, () => void, () => void, () => void];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* UI コンポーネントの表示状態を管理するフック
|
|
4
|
-
* @param pluginManager - PluginManager インスタンス
|
|
5
|
-
* @param type - コンポーネントタイプ
|
|
6
|
-
* @returns [isVisible, show, hide, toggle]
|
|
7
|
-
*/
|
|
8
|
-
export function useUIVisibility(pluginManager, type) {
|
|
9
|
-
const [isVisible, setIsVisible] = useState(() => pluginManager.getUIVisibility(type));
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
// UI 状態の変更を監視
|
|
12
|
-
const unsubscribe = pluginManager.subscribeUIVisibility(type, setIsVisible);
|
|
13
|
-
return unsubscribe;
|
|
14
|
-
}, [pluginManager, type]);
|
|
15
|
-
const show = () => pluginManager.showUI(type);
|
|
16
|
-
const hide = () => pluginManager.hideUI(type);
|
|
17
|
-
const toggle = () => pluginManager.toggleUIVisibility(type);
|
|
18
|
-
return [isVisible, show, hide, toggle];
|
|
19
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* プラグインAPIからReactインスタンスを設定
|
|
3
|
-
*/
|
|
4
|
-
export declare function setReactRuntime(react: any): void;
|
|
5
|
-
/**
|
|
6
|
-
* JSX Transform用のjsx関数
|
|
7
|
-
*/
|
|
8
|
-
export declare function jsx(type: any, props: any, key?: any): any;
|
|
9
|
-
/**
|
|
10
|
-
* JSX Transform用のjsxs関数(複数子要素用)
|
|
11
|
-
*/
|
|
12
|
-
export declare function jsxs(type: any, props: any, key?: any): any;
|
|
13
|
-
/**
|
|
14
|
-
* Fragment用
|
|
15
|
-
*/
|
|
16
|
-
export declare function Fragment(props: {
|
|
17
|
-
children?: any;
|
|
18
|
-
}): any;
|
|
19
|
-
/**
|
|
20
|
-
* Reactフックと関数のプロキシ
|
|
21
|
-
*/
|
|
22
|
-
export declare const useState: (...args: any[]) => any;
|
|
23
|
-
export declare const useEffect: (...args: any[]) => any;
|
|
24
|
-
export declare const useCallback: (...args: any[]) => any;
|
|
25
|
-
export declare const useMemo: (...args: any[]) => any;
|
|
26
|
-
export declare const useRef: (...args: any[]) => any;
|
|
27
|
-
export declare const useContext: (...args: any[]) => any;
|
|
28
|
-
export declare const useReducer: (...args: any[]) => any;
|
|
29
|
-
export declare const createElement: (...args: any[]) => any;
|
|
30
|
-
declare const _default: {
|
|
31
|
-
createElement: (...args: any[]) => any;
|
|
32
|
-
Fragment: typeof Fragment;
|
|
33
|
-
useState: (...args: any[]) => any;
|
|
34
|
-
useEffect: (...args: any[]) => any;
|
|
35
|
-
useCallback: (...args: any[]) => any;
|
|
36
|
-
useMemo: (...args: any[]) => any;
|
|
37
|
-
useRef: (...args: any[]) => any;
|
|
38
|
-
useContext: (...args: any[]) => any;
|
|
39
|
-
useReducer: (...args: any[]) => any;
|
|
40
|
-
};
|
|
41
|
-
export default _default;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable import/no-anonymous-default-export */
|
|
3
|
-
let runtimeReact = null;
|
|
4
|
-
/**
|
|
5
|
-
* プラグインAPIからReactインスタンスを設定
|
|
6
|
-
*/
|
|
7
|
-
export function setReactRuntime(react) {
|
|
8
|
-
runtimeReact = react;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* JSX Transform用のjsx関数
|
|
12
|
-
*/
|
|
13
|
-
export function jsx(type, props, key) {
|
|
14
|
-
if (!runtimeReact) {
|
|
15
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
16
|
-
}
|
|
17
|
-
return runtimeReact.createElement(type, key ? Object.assign(Object.assign({}, props), { key }) : props);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* JSX Transform用のjsxs関数(複数子要素用)
|
|
21
|
-
*/
|
|
22
|
-
export function jsxs(type, props, key) {
|
|
23
|
-
if (!runtimeReact) {
|
|
24
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
25
|
-
}
|
|
26
|
-
return runtimeReact.createElement(type, key ? Object.assign(Object.assign({}, props), { key }) : props);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Fragment用
|
|
30
|
-
*/
|
|
31
|
-
export function Fragment(props) {
|
|
32
|
-
if (!runtimeReact) {
|
|
33
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
34
|
-
}
|
|
35
|
-
return runtimeReact.createElement(runtimeReact.Fragment, null, props.children);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Reactフックと関数のプロキシ
|
|
39
|
-
*/
|
|
40
|
-
export const useState = (...args) => {
|
|
41
|
-
if (!runtimeReact) {
|
|
42
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
43
|
-
}
|
|
44
|
-
return runtimeReact.useState(...args);
|
|
45
|
-
};
|
|
46
|
-
export const useEffect = (...args) => {
|
|
47
|
-
if (!runtimeReact) {
|
|
48
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
49
|
-
}
|
|
50
|
-
return runtimeReact.useEffect(...args);
|
|
51
|
-
};
|
|
52
|
-
export const useCallback = (...args) => {
|
|
53
|
-
if (!runtimeReact) {
|
|
54
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
55
|
-
}
|
|
56
|
-
return runtimeReact.useCallback(...args);
|
|
57
|
-
};
|
|
58
|
-
export const useMemo = (...args) => {
|
|
59
|
-
if (!runtimeReact) {
|
|
60
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
61
|
-
}
|
|
62
|
-
return runtimeReact.useMemo(...args);
|
|
63
|
-
};
|
|
64
|
-
export const useRef = (...args) => {
|
|
65
|
-
if (!runtimeReact) {
|
|
66
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
67
|
-
}
|
|
68
|
-
return runtimeReact.useRef(...args);
|
|
69
|
-
};
|
|
70
|
-
export const useContext = (...args) => {
|
|
71
|
-
if (!runtimeReact) {
|
|
72
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
73
|
-
}
|
|
74
|
-
return runtimeReact.useContext(...args);
|
|
75
|
-
};
|
|
76
|
-
export const useReducer = (...args) => {
|
|
77
|
-
if (!runtimeReact) {
|
|
78
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
79
|
-
}
|
|
80
|
-
return runtimeReact.useReducer(...args);
|
|
81
|
-
};
|
|
82
|
-
export const createElement = (...args) => {
|
|
83
|
-
if (!runtimeReact) {
|
|
84
|
-
throw new Error("React runtime not initialized. Make sure plugin is loaded properly.");
|
|
85
|
-
}
|
|
86
|
-
return runtimeReact.createElement(...args);
|
|
87
|
-
};
|
|
88
|
-
// デフォルトエクスポート(互換性用)
|
|
89
|
-
export default {
|
|
90
|
-
createElement,
|
|
91
|
-
Fragment,
|
|
92
|
-
useState,
|
|
93
|
-
useEffect,
|
|
94
|
-
useCallback,
|
|
95
|
-
useMemo,
|
|
96
|
-
useRef,
|
|
97
|
-
useContext,
|
|
98
|
-
useReducer,
|
|
99
|
-
};
|