@luna-editor/engine 0.4.4 → 0.5.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.js +35 -113
- package/dist/components/BackgroundLayer.js +5 -7
- package/dist/components/GameScreen.d.ts +2 -8
- package/dist/components/GameScreen.js +7 -41
- package/dist/components/OverlayUI.d.ts +3 -2
- package/dist/components/OverlayUI.js +14 -3
- package/dist/components/PluginComponentProvider.js +1 -1
- package/dist/contexts/DataContext.d.ts +2 -0
- package/dist/contexts/DataContext.js +21 -26
- package/dist/data-api-types.d.ts +8 -6
- package/dist/hooks/useFontLoader.d.ts +2 -9
- package/dist/hooks/useFontLoader.js +87 -126
- package/dist/hooks/usePluginAPI.js +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/plugin/PluginManager.d.ts +1 -4
- package/dist/plugin/PluginManager.js +22 -51
- package/dist/sdk.d.ts +1 -1
- package/dist/types.d.ts +2 -17
- package/package.json +1 -1
- package/dist/contexts/PlaybackTextContext.d.ts +0 -32
- package/dist/contexts/PlaybackTextContext.js +0 -29
- package/dist/hooks/useImagePreloader.d.ts +0 -5
- package/dist/hooks/useImagePreloader.js +0 -53
- package/dist/plugin/luna-react.d.ts +0 -41
- package/dist/plugin/luna-react.js +0 -99
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
export var useImagePreloader = function (displayedCharacters, singleImageUrl) {
|
|
3
|
-
var _a = useState(true),
|
|
4
|
-
isLoading = _a[0],
|
|
5
|
-
setIsLoading = _a[1];
|
|
6
|
-
useEffect(
|
|
7
|
-
function () {
|
|
8
|
-
var imageUrls = [];
|
|
9
|
-
// 複数キャラクター表示の場合
|
|
10
|
-
if (displayedCharacters.length > 0) {
|
|
11
|
-
displayedCharacters.forEach(function (char) {
|
|
12
|
-
if (char.entityState.imageUrl) {
|
|
13
|
-
imageUrls.push(char.entityState.imageUrl);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
} else if (singleImageUrl) {
|
|
17
|
-
// 単一キャラクター表示の場合
|
|
18
|
-
imageUrls.push(singleImageUrl);
|
|
19
|
-
}
|
|
20
|
-
// 画像がない場合は即座に完了
|
|
21
|
-
if (imageUrls.length === 0) {
|
|
22
|
-
setIsLoading(false);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
setIsLoading(true);
|
|
26
|
-
// すべての画像を並列でプリロード
|
|
27
|
-
var loadPromises = imageUrls.map(function (url) {
|
|
28
|
-
return new Promise(function (resolve, reject) {
|
|
29
|
-
var img = new Image();
|
|
30
|
-
img.onload = function () {
|
|
31
|
-
return resolve();
|
|
32
|
-
};
|
|
33
|
-
img.onerror = function () {
|
|
34
|
-
return reject(new Error("Failed to load image: ".concat(url)));
|
|
35
|
-
};
|
|
36
|
-
img.src = url;
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
// すべての画像の読み込みを待つ
|
|
40
|
-
Promise.all(loadPromises)
|
|
41
|
-
.then(function () {
|
|
42
|
-
setIsLoading(false);
|
|
43
|
-
})
|
|
44
|
-
.catch(function (error) {
|
|
45
|
-
console.error("Image preload error:", error);
|
|
46
|
-
// エラーが発生しても続行
|
|
47
|
-
setIsLoading(false);
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
[displayedCharacters, singleImageUrl]
|
|
51
|
-
);
|
|
52
|
-
return isLoading;
|
|
53
|
-
};
|
|
@@ -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
|
-
};
|