vue-phaserjs 2.38.1 → 2.40.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/LICENSE +201 -201
- package/README.md +3 -3
- package/dist/index.d.ts +540 -613
- package/dist/index.js +21 -19
- package/package.json +13 -15
- package/dist/vue-shims-Bl66Srx_.d.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "./vue-shims-Bl66Srx_.d.ts";
|
|
2
1
|
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, inject, nextTick, onMounted, onUnmounted, openBlock, provide, ref, renderSlot, toValue, useTemplateRef, watch } from "vue";
|
|
3
2
|
import { ID_SEPARATOR, InvalidOperationError, NotFoundError, NotInitializedError, Operation, checkIsPlainObject, takeOne, toKebabCase } from "@esposter/shared";
|
|
4
3
|
import ClickOutside from "phaser4-rex-plugins/plugins/clickoutside.js";
|
|
@@ -10,11 +9,17 @@ const getDepthInsertIndex = (list, depth) => typeof depth === "number" ? list.fi
|
|
|
10
9
|
//#endregion
|
|
11
10
|
//#region src/pushGameObject.ts
|
|
12
11
|
const pushGameObject = (parentContainer, configuration, gameObject) => {
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
else parentContainer.addAt(gameObject,
|
|
12
|
+
const depthInsertIndex = getDepthInsertIndex(parentContainer.list, "depth" in configuration ? configuration.depth : void 0);
|
|
13
|
+
if (depthInsertIndex === -1) parentContainer.add(gameObject);
|
|
14
|
+
else parentContainer.addAt(gameObject, depthInsertIndex);
|
|
16
15
|
};
|
|
17
16
|
//#endregion
|
|
17
|
+
//#region src/util/emit/constants.ts
|
|
18
|
+
const EVENT_PREFIX = "on";
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/util/emit/checkIsEvent.ts
|
|
21
|
+
const checkIsEvent = (property) => property.startsWith("on");
|
|
22
|
+
//#endregion
|
|
18
23
|
//#region src/util/emit/GameObjectEventMap.ts
|
|
19
24
|
const GameObjectEventMap = {
|
|
20
25
|
clickoutside: {},
|
|
@@ -33,22 +38,16 @@ const GameObjectEventMap = {
|
|
|
33
38
|
wheel: { eventIndex: 4 }
|
|
34
39
|
};
|
|
35
40
|
//#endregion
|
|
36
|
-
//#region src/util/emit/constants.ts
|
|
37
|
-
const EVENT_PREFIX = "on";
|
|
38
|
-
//#endregion
|
|
39
41
|
//#region src/util/emit/getEventName.ts
|
|
40
42
|
const getEventName = (event) => {
|
|
41
43
|
if (!event.startsWith("on") || event.length <= 2) throw new InvalidOperationError(Operation.Read, getEventName.name, event);
|
|
42
44
|
return event.slice(2).toLowerCase();
|
|
43
45
|
};
|
|
44
46
|
//#endregion
|
|
45
|
-
//#region src/util/emit/isEvent.ts
|
|
46
|
-
const isEvent = (property) => property.startsWith("on");
|
|
47
|
-
//#endregion
|
|
48
47
|
//#region src/composables/useInitializeGameObjectEvents.ts
|
|
49
48
|
const useInitializeGameObjectEvents = () => {
|
|
50
49
|
const currentInstance = getCurrentInstance();
|
|
51
|
-
const events = new Set(Object.keys(currentInstance?.attrs ?? {}).filter((key) =>
|
|
50
|
+
const events = new Set(Object.keys(currentInstance?.attrs ?? {}).filter((key) => checkIsEvent(key)).map((key) => getEventName(key)));
|
|
52
51
|
const gameObjectEvents = Object.keys(GameObjectEventMap).filter((key) => events.has(key));
|
|
53
52
|
const eventStopHandles = [];
|
|
54
53
|
const initializeGameObjectEvents = (gameObject, emit, scene) => {
|
|
@@ -146,7 +145,8 @@ const useInitializeGameObjectSetters = (gameObject, configuration, emit, setterM
|
|
|
146
145
|
if (value !== void 0) emit(updateEvent, value);
|
|
147
146
|
else if (key in targetGameObject) emit(updateEvent, targetGameObject[key]);
|
|
148
147
|
});
|
|
149
|
-
setterWatchHandles.push(watch(() => toValue(configuration)[key], (newValue) => {
|
|
148
|
+
setterWatchHandles.push(watch(() => toValue(configuration)[key], (newValue, oldValue) => {
|
|
149
|
+
if (newValue === oldValue && (newValue === null || typeof newValue !== "object")) return;
|
|
150
150
|
const updater = () => {
|
|
151
151
|
setter(toValue(gameObject), emit)(newValue);
|
|
152
152
|
emit(updateEvent, newValue);
|
|
@@ -176,7 +176,6 @@ const usePhaserStore = defineStore("phaser", () => {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
const sceneKey = ref();
|
|
179
|
-
const rootSceneKey = sceneKey;
|
|
180
179
|
const isSameScene = (newSceneKey) => newSceneKey === sceneKey.value;
|
|
181
180
|
const switchToScene = async (newSceneKey) => {
|
|
182
181
|
if (isSameScene(newSceneKey)) return;
|
|
@@ -211,7 +210,7 @@ const usePhaserStore = defineStore("phaser", () => {
|
|
|
211
210
|
parallelSceneKeys,
|
|
212
211
|
prioritizedParallelSceneKeys,
|
|
213
212
|
removeParallelScene,
|
|
214
|
-
rootSceneKey,
|
|
213
|
+
rootSceneKey: sceneKey,
|
|
215
214
|
switchToScene
|
|
216
215
|
};
|
|
217
216
|
});
|
|
@@ -1865,15 +1864,18 @@ const onUpdate = (...args) => {
|
|
|
1865
1864
|
pushListener("Update", ...args);
|
|
1866
1865
|
};
|
|
1867
1866
|
//#endregion
|
|
1868
|
-
//#region src/util/
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1867
|
+
//#region src/util/sleepScene.ts
|
|
1868
|
+
const sleepScene = (scene, durationMs) => new Promise((resolve) => {
|
|
1869
|
+
const settle = () => {
|
|
1870
|
+
scene.events.off(Scenes.Events.SHUTDOWN, settle);
|
|
1871
1871
|
resolve();
|
|
1872
|
-
}
|
|
1872
|
+
};
|
|
1873
|
+
scene.time.delayedCall(durationMs, settle);
|
|
1874
|
+
scene.events.once(Scenes.Events.SHUTDOWN, settle);
|
|
1873
1875
|
});
|
|
1874
1876
|
//#endregion
|
|
1875
1877
|
//#region src/models/plugins/TilemapFile.ts
|
|
1876
1878
|
const JSONFile = Loader.FileTypes.JSONFile;
|
|
1877
1879
|
var TilemapFile = class extends JSONFile {};
|
|
1878
1880
|
//#endregion
|
|
1879
|
-
export { AlphaSetterMap, AlphaSingleSetterMap, AnimationSetterMap, _sfc_main as Arc, ArcSetterMap, BaseTextureSetterMap, _sfc_main$1 as BitmapText, BitmapTextSetterMap, BlendModeSetterMap, _sfc_main$2 as Circle, ComputedSizeSetterMap, _sfc_main$3 as Container, ContainerSetterMap, _sfc_main$4 as Curve, CurveSetterMap, DepthSetterMap, DisplaySizeSetterMap, EVENT_PREFIX, _sfc_main$5 as Ellipse, EllipseSetterMap, ExternalSceneStore, FlipSetterMap, _sfc_main$6 as Game, GameObjectEventMap, GameObjectSetterMap, GlobalSetterMap, _sfc_main$7 as Graphics, GraphicsSetterMap, _sfc_main$8 as Image, ImageSetterMap, InjectionKeyMap, _sfc_main$9 as IsoBox, IsoBoxSetterMap, IsoSetterMap, _sfc_main$10 as IsoTriangle, IsoTriangleSetterMap, Lifecycle, _sfc_main$11 as Line, LineSetterMap, MaskSetterMap, _sfc_main$12 as Nineslice, NinesliceSetterMap, OriginSetterMap, _sfc_main$13 as Particles, ParticlesSetterMap, _sfc_main$14 as PathFollower, PathFollowerComponentSetterMap, PathFollowerSetterMap, _sfc_main$15 as Polygon, PolygonSetterMap, _sfc_main$16 as Rectangle, RectangleSetterMap, RenderNodesSetterMap, _sfc_main$17 as RenderTexture, RenderTextureSetterMap, _sfc_main$18 as Scene, ScrollFactorSetterMap, ShapeSetterMap, SizeSetterMap, _sfc_main$19 as Sprite, SpriteSetterMap, _sfc_main$20 as Star, StarSetterMap, TILEMAP_TILED_JSON_EXTERNAL_KEY, _sfc_main$21 as Text, TextSetterMap, TextureCropSetterMap, TextureSetterMap, _sfc_main$22 as TileSprite, TileSpriteSetterMap, TiledJSONExternalFile, _sfc_main$23 as Tilemap, TilemapFile, TilesetFile, TintSetterMap, TransformSetterMap, _sfc_main$24 as Triangle, TriangleSetterMap, TweenSetterMap, _sfc_main$25 as Video, VideoSetterMap, VisibleSetterMap, _sfc_main$26 as Zone, ZoneSetterMap, createSceneClass, getDepthInsertIndex, getEventName, getInitializeGameObjectLifecycleHook, getScene, getUpdateEvent,
|
|
1881
|
+
export { AlphaSetterMap, AlphaSingleSetterMap, AnimationSetterMap, _sfc_main as Arc, ArcSetterMap, BaseTextureSetterMap, _sfc_main$1 as BitmapText, BitmapTextSetterMap, BlendModeSetterMap, _sfc_main$2 as Circle, ComputedSizeSetterMap, _sfc_main$3 as Container, ContainerSetterMap, _sfc_main$4 as Curve, CurveSetterMap, DepthSetterMap, DisplaySizeSetterMap, EVENT_PREFIX, _sfc_main$5 as Ellipse, EllipseSetterMap, ExternalSceneStore, FlipSetterMap, _sfc_main$6 as Game, GameObjectEventMap, GameObjectSetterMap, GlobalSetterMap, _sfc_main$7 as Graphics, GraphicsSetterMap, _sfc_main$8 as Image, ImageSetterMap, InjectionKeyMap, _sfc_main$9 as IsoBox, IsoBoxSetterMap, IsoSetterMap, _sfc_main$10 as IsoTriangle, IsoTriangleSetterMap, Lifecycle, _sfc_main$11 as Line, LineSetterMap, MaskSetterMap, _sfc_main$12 as Nineslice, NinesliceSetterMap, OriginSetterMap, _sfc_main$13 as Particles, ParticlesSetterMap, _sfc_main$14 as PathFollower, PathFollowerComponentSetterMap, PathFollowerSetterMap, _sfc_main$15 as Polygon, PolygonSetterMap, _sfc_main$16 as Rectangle, RectangleSetterMap, RenderNodesSetterMap, _sfc_main$17 as RenderTexture, RenderTextureSetterMap, _sfc_main$18 as Scene, ScrollFactorSetterMap, ShapeSetterMap, SizeSetterMap, _sfc_main$19 as Sprite, SpriteSetterMap, _sfc_main$20 as Star, StarSetterMap, TILEMAP_TILED_JSON_EXTERNAL_KEY, _sfc_main$21 as Text, TextSetterMap, TextureCropSetterMap, TextureSetterMap, _sfc_main$22 as TileSprite, TileSpriteSetterMap, TiledJSONExternalFile, _sfc_main$23 as Tilemap, TilemapFile, TilesetFile, TintSetterMap, TransformSetterMap, _sfc_main$24 as Triangle, TriangleSetterMap, TweenSetterMap, _sfc_main$25 as Video, VideoSetterMap, VisibleSetterMap, _sfc_main$26 as Zone, ZoneSetterMap, checkIsEvent, createSceneClass, getDepthInsertIndex, getEventName, getInitializeGameObjectLifecycleHook, getScene, getUpdateEvent, onCreate, onInit, onNextTick, onPreload, onShutdown, onUpdate, pushGameObject, pushListener, registerTiledJSONExternalLoader, resetLifecycleListeners, runLifecycleListeners, sleepScene, useAnimations, useCameraStore, useGame, useInitializeGameObject, useInitializeGameObjectEvents, useInitializeGameObjectSetters, useInjectSceneKey, useInputStore, usePhaserStore, useTextStore, useTween };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-phaserjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.40.0",
|
|
4
4
|
"description": "A component library to integrate Phaser Framework with Vue.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component-library",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
|
-
"build": "
|
|
48
|
-
"export:gen": "
|
|
47
|
+
"build": "tsdown",
|
|
48
|
+
"export:gen": "generate-exports vue",
|
|
49
49
|
"format": "oxfmt",
|
|
50
50
|
"format:check": "oxfmt --check",
|
|
51
51
|
"lint": "eslint .",
|
|
@@ -55,27 +55,25 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@arethetypeswrong/core": "^0.18.5",
|
|
58
|
-
"@esposter/configuration": "2.
|
|
59
|
-
"@vue/test-utils": "^2.
|
|
60
|
-
"ctix": "^2.8.2",
|
|
58
|
+
"@esposter/configuration": "2.40.0",
|
|
59
|
+
"@vue/test-utils": "^2.5.0",
|
|
61
60
|
"publint": "^0.3.24",
|
|
62
|
-
"tsdown": "^0.
|
|
63
|
-
"type-fest": "^5.
|
|
61
|
+
"tsdown": "^0.23.0",
|
|
62
|
+
"type-fest": "^5.9.0",
|
|
64
63
|
"typedoc": "^0.28.20",
|
|
65
|
-
"vitest": "^
|
|
64
|
+
"vitest": "^5.0.0",
|
|
66
65
|
"vue-tsc": "^3.3.11"
|
|
67
66
|
},
|
|
68
67
|
"peerDependencies": {
|
|
69
|
-
"@esposter/shared": "2.
|
|
70
|
-
"parse-tmx": "2.
|
|
68
|
+
"@esposter/shared": "2.39.0",
|
|
69
|
+
"parse-tmx": "2.39.0",
|
|
71
70
|
"phaser": "^4.2.1",
|
|
72
71
|
"phaser4-rex-plugins": "^4.2.0",
|
|
73
72
|
"pinia": "^4.0.3",
|
|
74
|
-
"vue": "^3.5.
|
|
73
|
+
"vue": "^3.5.42"
|
|
75
74
|
},
|
|
76
75
|
"inlinedDependencies": {
|
|
77
|
-
"
|
|
78
|
-
"type-fest": "5.8.0"
|
|
76
|
+
"type-fest": "5.9.0"
|
|
79
77
|
},
|
|
80
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "09506078db97923eeecb4ff602cf01015f237dc8"
|
|
81
79
|
}
|