@rpgjs/client 4.2.2 → 5.0.0-alpha.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/Game/EffectManager.d.ts +5 -0
- package/dist/Game/Event.d.ts +4 -0
- package/dist/Game/Map.d.ts +7 -0
- package/dist/Game/Player.d.ts +4 -0
- package/dist/Gui/Gui.d.ts +23 -0
- package/{lib → dist}/RpgClient.d.ts +9 -6
- package/dist/RpgClientEngine.d.ts +43 -0
- package/dist/components/effects/index.d.ts +4 -0
- package/dist/components/gui/index.d.ts +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/core/inject.d.ts +5 -0
- package/dist/core/setup.d.ts +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/index10.js +8 -0
- package/dist/index10.js.map +1 -0
- package/dist/index11.js +10 -0
- package/dist/index11.js.map +1 -0
- package/dist/index12.js +8 -0
- package/dist/index12.js.map +1 -0
- package/dist/index13.js +17 -0
- package/dist/index13.js.map +1 -0
- package/dist/index14.js +50 -0
- package/dist/index14.js.map +1 -0
- package/dist/index15.js +191 -0
- package/dist/index15.js.map +1 -0
- package/dist/index16.js +9 -0
- package/dist/index16.js.map +1 -0
- package/dist/index17.js +387 -0
- package/dist/index17.js.map +1 -0
- package/dist/index18.js +31 -0
- package/dist/index18.js.map +1 -0
- package/dist/index19.js +24 -0
- package/dist/index19.js.map +1 -0
- package/dist/index2.js +112 -0
- package/dist/index2.js.map +1 -0
- package/dist/index20.js +2421 -0
- package/dist/index20.js.map +1 -0
- package/dist/index21.js +114 -0
- package/dist/index21.js.map +1 -0
- package/dist/index22.js +109 -0
- package/dist/index22.js.map +1 -0
- package/dist/index23.js +71 -0
- package/dist/index23.js.map +1 -0
- package/dist/index24.js +21 -0
- package/dist/index24.js.map +1 -0
- package/dist/index25.js +41 -0
- package/dist/index25.js.map +1 -0
- package/dist/index26.js +5 -0
- package/dist/index26.js.map +1 -0
- package/dist/index27.js +322 -0
- package/dist/index27.js.map +1 -0
- package/dist/index28.js +25 -0
- package/dist/index28.js.map +1 -0
- package/dist/index29.js +11 -0
- package/dist/index29.js.map +1 -0
- package/dist/index3.js +87 -0
- package/dist/index3.js.map +1 -0
- package/dist/index30.js +11 -0
- package/dist/index30.js.map +1 -0
- package/dist/index31.js +174 -0
- package/dist/index31.js.map +1 -0
- package/dist/index32.js +501 -0
- package/dist/index32.js.map +1 -0
- package/dist/index33.js +12 -0
- package/dist/index33.js.map +1 -0
- package/dist/index34.js +4403 -0
- package/dist/index34.js.map +1 -0
- package/dist/index35.js +91 -0
- package/dist/index35.js.map +1 -0
- package/dist/index36.js +61 -0
- package/dist/index36.js.map +1 -0
- package/dist/index37.js +20 -0
- package/dist/index37.js.map +1 -0
- package/dist/index38.js +20 -0
- package/dist/index38.js.map +1 -0
- package/dist/index4.js +54 -0
- package/dist/index4.js.map +1 -0
- package/dist/index5.js +15 -0
- package/dist/index5.js.map +1 -0
- package/dist/index6.js +17 -0
- package/dist/index6.js.map +1 -0
- package/dist/index7.js +31 -0
- package/dist/index7.js.map +1 -0
- package/dist/index8.js +90 -0
- package/dist/index8.js.map +1 -0
- package/dist/index9.js +76 -0
- package/dist/index9.js.map +1 -0
- package/dist/module.d.ts +14 -0
- package/dist/presets/index.d.ts +22 -0
- package/{lib/Presets/AnimationSpritesheet.d.ts → dist/presets/rmspritesheet.d.ts} +6 -2
- package/dist/services/AbstractSocket.d.ts +15 -0
- package/dist/services/loadMap.d.ts +14 -0
- package/dist/services/mmorpg.d.ts +32 -0
- package/dist/services/standalone.d.ts +34 -0
- package/package.json +25 -42
- package/src/Game/EffectManager.ts +20 -0
- package/src/Game/Event.ts +5 -0
- package/src/Game/Map.ts +10 -0
- package/src/Game/Object.ts +16 -0
- package/src/Game/Player.ts +5 -0
- package/src/Gui/Gui.ts +80 -534
- package/src/RpgClient.ts +9 -5
- package/src/RpgClientEngine.ts +135 -815
- package/src/components/character.ce +104 -0
- package/src/components/effects/animation.ce +19 -0
- package/src/components/effects/hit.ce +87 -0
- package/src/components/effects/index.ts +7 -0
- package/src/components/gui/dialogbox/index.ce +194 -0
- package/src/components/gui/dialogbox/itemMenu.ce +23 -0
- package/src/components/gui/dialogbox/selection.ce +67 -0
- package/src/components/gui/index.ts +5 -0
- package/src/components/index.ts +3 -0
- package/src/components/scenes/canvas.ce +51 -0
- package/src/components/scenes/draw-map.ce +56 -0
- package/src/components/scenes/element-map.ce +23 -0
- package/src/components/scenes/event-layer.ce +20 -0
- package/src/core/inject.ts +17 -0
- package/src/core/setup.ts +18 -0
- package/src/index.ts +13 -29
- package/src/module.ts +93 -0
- package/src/presets/index.ts +5 -0
- package/src/{Presets/AnimationSpritesheet.ts → presets/rmspritesheet.ts} +4 -5
- package/src/services/AbstractSocket.ts +14 -0
- package/src/services/loadMap.ts +33 -0
- package/src/services/mmorpg.ts +64 -0
- package/src/services/standalone.ts +101 -0
- package/src/types/canvas-engine.d.ts +26 -0
- package/tsconfig.json +8 -3
- package/vite.config.ts +34 -0
- package/CHANGELOG.md +0 -177
- package/LICENSE +0 -19
- package/browser/React-f6f9b1de.js +0 -157
- package/browser/index-e74a289f.js +0 -44225
- package/browser/manifest.json +0 -21
- package/browser/rpg.client.js +0 -40
- package/browser/rpg.client.umd.cjs +0 -44414
- package/lib/Components/AbstractComponent.d.ts +0 -32
- package/lib/Components/AbstractComponent.js +0 -93
- package/lib/Components/AbstractComponent.js.map +0 -1
- package/lib/Components/BarComponent.d.ts +0 -21
- package/lib/Components/BarComponent.js +0 -169
- package/lib/Components/BarComponent.js.map +0 -1
- package/lib/Components/Component.d.ts +0 -124
- package/lib/Components/Component.js +0 -425
- package/lib/Components/Component.js.map +0 -1
- package/lib/Components/DebugComponent.d.ts +0 -11
- package/lib/Components/DebugComponent.js +0 -32
- package/lib/Components/DebugComponent.js.map +0 -1
- package/lib/Components/ImageComponent.d.ts +0 -11
- package/lib/Components/ImageComponent.js +0 -30
- package/lib/Components/ImageComponent.js.map +0 -1
- package/lib/Components/ShapeComponent.d.ts +0 -11
- package/lib/Components/ShapeComponent.js +0 -57
- package/lib/Components/ShapeComponent.js.map +0 -1
- package/lib/Components/TextComponent.d.ts +0 -11
- package/lib/Components/TextComponent.js +0 -35
- package/lib/Components/TextComponent.js.map +0 -1
- package/lib/Components/TileComponent.d.ts +0 -10
- package/lib/Components/TileComponent.js +0 -40
- package/lib/Components/TileComponent.js.map +0 -1
- package/lib/Effects/Animation.d.ts +0 -55
- package/lib/Effects/Animation.js +0 -233
- package/lib/Effects/Animation.js.map +0 -1
- package/lib/Effects/AnimationCharacter.d.ts +0 -7
- package/lib/Effects/AnimationCharacter.js +0 -9
- package/lib/Effects/AnimationCharacter.js.map +0 -1
- package/lib/Effects/Spinner.d.ts +0 -7
- package/lib/Effects/Spinner.js +0 -18
- package/lib/Effects/Spinner.js.map +0 -1
- package/lib/Effects/Timeline.d.ts +0 -151
- package/lib/Effects/Timeline.js +0 -369
- package/lib/Effects/Timeline.js.map +0 -1
- package/lib/Effects/TransitionScene.d.ts +0 -18
- package/lib/Effects/TransitionScene.js +0 -50
- package/lib/Effects/TransitionScene.js.map +0 -1
- package/lib/GameEngine.d.ts +0 -68
- package/lib/GameEngine.js +0 -254
- package/lib/GameEngine.js.map +0 -1
- package/lib/Gui/Gui.d.ts +0 -110
- package/lib/Gui/Gui.js +0 -490
- package/lib/Gui/Gui.js.map +0 -1
- package/lib/Gui/React.d.ts +0 -15
- package/lib/Gui/React.js +0 -113
- package/lib/Gui/React.js.map +0 -1
- package/lib/Gui/Vue.d.ts +0 -13
- package/lib/Gui/Vue.js +0 -114
- package/lib/Gui/Vue.js.map +0 -1
- package/lib/Interfaces/Character.d.ts +0 -6
- package/lib/Interfaces/Character.js +0 -2
- package/lib/Interfaces/Character.js.map +0 -1
- package/lib/Interfaces/Scene.d.ts +0 -10
- package/lib/Interfaces/Scene.js +0 -2
- package/lib/Interfaces/Scene.js.map +0 -1
- package/lib/KeyboardControls.d.ts +0 -367
- package/lib/KeyboardControls.js +0 -714
- package/lib/KeyboardControls.js.map +0 -1
- package/lib/Logger.d.ts +0 -1
- package/lib/Logger.js +0 -4
- package/lib/Logger.js.map +0 -1
- package/lib/Presets/AnimationSpritesheet.js +0 -39
- package/lib/Presets/AnimationSpritesheet.js.map +0 -1
- package/lib/Presets/Scene.d.ts +0 -3
- package/lib/Presets/Scene.js +0 -5
- package/lib/Presets/Scene.js.map +0 -1
- package/lib/Renderer.d.ts +0 -62
- package/lib/Renderer.js +0 -300
- package/lib/Renderer.js.map +0 -1
- package/lib/Resources.d.ts +0 -22
- package/lib/Resources.js +0 -38
- package/lib/Resources.js.map +0 -1
- package/lib/RpgClient.js +0 -2
- package/lib/RpgClient.js.map +0 -1
- package/lib/RpgClientEngine.d.ts +0 -257
- package/lib/RpgClientEngine.js +0 -674
- package/lib/RpgClientEngine.js.map +0 -1
- package/lib/Scene/EventLayer.d.ts +0 -4
- package/lib/Scene/EventLayer.js +0 -8
- package/lib/Scene/EventLayer.js.map +0 -1
- package/lib/Scene/Map.d.ts +0 -109
- package/lib/Scene/Map.js +0 -319
- package/lib/Scene/Map.js.map +0 -1
- package/lib/Scene/Scene.d.ts +0 -184
- package/lib/Scene/Scene.js +0 -250
- package/lib/Scene/Scene.js.map +0 -1
- package/lib/Scene/SceneData.d.ts +0 -4
- package/lib/Scene/SceneData.js +0 -8
- package/lib/Scene/SceneData.js.map +0 -1
- package/lib/Sound/RpgSound.d.ts +0 -11
- package/lib/Sound/RpgSound.js +0 -46
- package/lib/Sound/RpgSound.js.map +0 -1
- package/lib/Sound/Sound.d.ts +0 -78
- package/lib/Sound/Sound.js +0 -12
- package/lib/Sound/Sound.js.map +0 -1
- package/lib/Sound/Sounds.d.ts +0 -2
- package/lib/Sound/Sounds.js +0 -6
- package/lib/Sound/Sounds.js.map +0 -1
- package/lib/Sprite/Character.d.ts +0 -18
- package/lib/Sprite/Character.js +0 -131
- package/lib/Sprite/Character.js.map +0 -1
- package/lib/Sprite/Player.d.ts +0 -3
- package/lib/Sprite/Player.js +0 -4
- package/lib/Sprite/Player.js.map +0 -1
- package/lib/Sprite/Spritesheet.d.ts +0 -365
- package/lib/Sprite/Spritesheet.js +0 -13
- package/lib/Sprite/Spritesheet.js.map +0 -1
- package/lib/Sprite/Spritesheets.d.ts +0 -3
- package/lib/Sprite/Spritesheets.js +0 -6
- package/lib/Sprite/Spritesheets.js.map +0 -1
- package/lib/Tilemap/CommonLayer.d.ts +0 -10
- package/lib/Tilemap/CommonLayer.js +0 -17
- package/lib/Tilemap/CommonLayer.js.map +0 -1
- package/lib/Tilemap/ImageLayer.d.ts +0 -4
- package/lib/Tilemap/ImageLayer.js +0 -16
- package/lib/Tilemap/ImageLayer.js.map +0 -1
- package/lib/Tilemap/Tile.d.ts +0 -21
- package/lib/Tilemap/Tile.js +0 -67
- package/lib/Tilemap/Tile.js.map +0 -1
- package/lib/Tilemap/TileLayer.d.ts +0 -13
- package/lib/Tilemap/TileLayer.js +0 -122
- package/lib/Tilemap/TileLayer.js.map +0 -1
- package/lib/Tilemap/TileSet.d.ts +0 -7
- package/lib/Tilemap/TileSet.js +0 -24
- package/lib/Tilemap/TileSet.js.map +0 -1
- package/lib/Tilemap/index.d.ts +0 -28
- package/lib/Tilemap/index.js +0 -151
- package/lib/Tilemap/index.js.map +0 -1
- package/lib/clientEntryPoint.d.ts +0 -89
- package/lib/clientEntryPoint.js +0 -48
- package/lib/clientEntryPoint.js.map +0 -1
- package/lib/index.d.ts +0 -26
- package/lib/index.js +0 -27
- package/lib/index.js.map +0 -1
- package/lib/inject.d.ts +0 -23
- package/lib/inject.js +0 -30
- package/lib/inject.js.map +0 -1
- package/rpg.toml +0 -14
- package/src/Components/AbstractComponent.ts +0 -120
- package/src/Components/BarComponent.ts +0 -181
- package/src/Components/Component.ts +0 -515
- package/src/Components/DebugComponent.ts +0 -36
- package/src/Components/ImageComponent.ts +0 -30
- package/src/Components/ShapeComponent.ts +0 -64
- package/src/Components/TextComponent.ts +0 -33
- package/src/Components/TileComponent.ts +0 -43
- package/src/Effects/Animation.ts +0 -310
- package/src/Effects/AnimationCharacter.ts +0 -7
- package/src/Effects/Spinner.ts +0 -19
- package/src/Effects/Timeline.ts +0 -378
- package/src/Effects/TransitionScene.ts +0 -59
- package/src/GameEngine.ts +0 -289
- package/src/Gui/React.ts +0 -145
- package/src/Gui/Vue.ts +0 -154
- package/src/Interfaces/Character.ts +0 -7
- package/src/Interfaces/Scene.ts +0 -9
- package/src/KeyboardControls.ts +0 -748
- package/src/Logger.ts +0 -3
- package/src/Presets/Scene.ts +0 -3
- package/src/Renderer.ts +0 -334
- package/src/Resources.ts +0 -39
- package/src/Scene/EventLayer.ts +0 -9
- package/src/Scene/Map.ts +0 -402
- package/src/Scene/Scene.ts +0 -305
- package/src/Scene/SceneData.ts +0 -13
- package/src/Sound/RpgSound.ts +0 -50
- package/src/Sound/Sound.ts +0 -91
- package/src/Sound/Sounds.ts +0 -7
- package/src/Sprite/Character.ts +0 -157
- package/src/Sprite/Player.ts +0 -3
- package/src/Sprite/Spritesheet.ts +0 -392
- package/src/Sprite/Spritesheets.ts +0 -8
- package/src/Tilemap/CommonLayer.ts +0 -20
- package/src/Tilemap/ImageLayer.ts +0 -20
- package/src/Tilemap/Tile.ts +0 -80
- package/src/Tilemap/TileLayer.ts +0 -142
- package/src/Tilemap/TileSet.ts +0 -40
- package/src/Tilemap/index.ts +0 -175
- package/src/clientEntryPoint.ts +0 -150
- package/src/inject.ts +0 -34
- package/src/types/howler.d.ts +0 -73
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RpgCommonMap } from '@rpgjs/common';
|
|
2
|
+
import { RpgClientPlayer } from './Player';
|
|
3
|
+
import { RpgClientEvent } from './Event';
|
|
4
|
+
export declare class RpgClientMap extends RpgCommonMap<RpgClientPlayer> {
|
|
5
|
+
players: import('canvasengine').WritableObjectSignal<Record<string, RpgClientPlayer>>;
|
|
6
|
+
events: import('canvasengine').WritableObjectSignal<Record<string, RpgClientEvent>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context } from '@signe/di';
|
|
2
|
+
interface GuiOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
component: any;
|
|
5
|
+
display?: boolean;
|
|
6
|
+
data?: any;
|
|
7
|
+
}
|
|
8
|
+
export declare class RpgGui {
|
|
9
|
+
private context;
|
|
10
|
+
private webSocket;
|
|
11
|
+
gui: import('canvasengine').WritableArraySignal<any>;
|
|
12
|
+
constructor(context: Context);
|
|
13
|
+
_initialize(): Promise<void>;
|
|
14
|
+
guiInteraction(guiId: string, name: string, data: any): void;
|
|
15
|
+
guiClose(guiId: string, data?: any): void;
|
|
16
|
+
add(gui: GuiOptions): void;
|
|
17
|
+
get(id: string | GuiOptions): any;
|
|
18
|
+
exists(id: string): boolean;
|
|
19
|
+
getAll(): any;
|
|
20
|
+
display(id: string, data?: {}): void;
|
|
21
|
+
hide(id: string): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SceneMap } from './Scene/Map.js';
|
|
3
|
-
import { RpgClientEngine } from './RpgClientEngine.js';
|
|
4
|
-
import { RpgComponent } from './Components/Component.js';
|
|
1
|
+
import { RpgClientEngine } from './RpgClientEngine';
|
|
5
2
|
import { Loader } from 'pixi.js';
|
|
6
3
|
type RpgClass<T = any> = new (...args: any[]) => T;
|
|
4
|
+
type RpgComponent = any;
|
|
5
|
+
type SceneMap = any;
|
|
7
6
|
export interface RpgClientEngineHooks {
|
|
8
7
|
/**
|
|
9
8
|
* When the engine is started. If you send false, you prevent the client from connecting to the server
|
|
@@ -203,7 +202,7 @@ export interface RpgClient {
|
|
|
203
202
|
* @prop { { client: null | Function, server: null | Function }[]} [imports]
|
|
204
203
|
* @memberof RpgClient
|
|
205
204
|
*/
|
|
206
|
-
imports?:
|
|
205
|
+
imports?: any;
|
|
207
206
|
/**
|
|
208
207
|
* Object containing the hooks concerning the engine
|
|
209
208
|
*
|
|
@@ -253,7 +252,7 @@ export interface RpgClient {
|
|
|
253
252
|
* @prop {Array<Class>} [spritesheets]
|
|
254
253
|
* @memberof RpgClient
|
|
255
254
|
* */
|
|
256
|
-
spritesheets?:
|
|
255
|
+
spritesheets?: any[];
|
|
257
256
|
/**
|
|
258
257
|
* Array containing the list of VueJS components
|
|
259
258
|
*
|
|
@@ -352,5 +351,9 @@ export interface RpgClient {
|
|
|
352
351
|
scenes?: {
|
|
353
352
|
map: RpgSceneMapHooks;
|
|
354
353
|
};
|
|
354
|
+
effects?: {
|
|
355
|
+
id: string;
|
|
356
|
+
component: any;
|
|
357
|
+
}[];
|
|
355
358
|
}
|
|
356
359
|
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Context } from '@signe/di';
|
|
2
|
+
import { EffectManager } from './Game/EffectManager';
|
|
3
|
+
export declare class RpgClientEngine<T = any> {
|
|
4
|
+
context: Context;
|
|
5
|
+
private guiService;
|
|
6
|
+
private webSocket;
|
|
7
|
+
private loadMapService;
|
|
8
|
+
private hooks;
|
|
9
|
+
private sceneMap;
|
|
10
|
+
private selector;
|
|
11
|
+
globalConfig: T;
|
|
12
|
+
sceneComponent: any;
|
|
13
|
+
stopProcessingInput: boolean;
|
|
14
|
+
width: import('canvasengine').WritableSignal<string>;
|
|
15
|
+
height: import('canvasengine').WritableSignal<string>;
|
|
16
|
+
spritesheets: Map<string, any>;
|
|
17
|
+
sounds: Map<string, any>;
|
|
18
|
+
effects: any[];
|
|
19
|
+
particleSettings: {
|
|
20
|
+
emitters: any[];
|
|
21
|
+
};
|
|
22
|
+
constructor(context: Context);
|
|
23
|
+
start(): Promise<void>;
|
|
24
|
+
private initListeners;
|
|
25
|
+
private loadScene;
|
|
26
|
+
addSpriteSheet<T = any>(spritesheetClass: any, id?: string): any;
|
|
27
|
+
addSound(sound: any, id?: string): any;
|
|
28
|
+
addParticle(particle: any): any;
|
|
29
|
+
addEffect(effect: {
|
|
30
|
+
component: any;
|
|
31
|
+
id: string;
|
|
32
|
+
}): {
|
|
33
|
+
component: any;
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
getEffect(id: string): EffectManager;
|
|
37
|
+
processInput({ input }: {
|
|
38
|
+
input: number;
|
|
39
|
+
}): void;
|
|
40
|
+
processAction({ action }: {
|
|
41
|
+
action: number;
|
|
42
|
+
}): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Context } from '@signe/di';
|
|
2
|
+
export declare let context: Context | null;
|
|
3
|
+
export declare function inject<T>(service: (new (...args: any[]) => T) | string, _context?: Context): T;
|
|
4
|
+
export declare function setInject(_context: Context): void;
|
|
5
|
+
export declare function clearInject(): void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './RpgClientEngine';
|
|
2
|
+
export type * from './RpgClient';
|
|
3
|
+
export * from './services/standalone';
|
|
4
|
+
export * from './services/mmorpg';
|
|
5
|
+
export * from './core/setup';
|
|
6
|
+
export * from './core/inject';
|
|
7
|
+
export * from './services/loadMap';
|
|
8
|
+
export * from './module';
|
|
9
|
+
export * from './Gui/Gui';
|
|
10
|
+
export * from './components/gui';
|
|
11
|
+
export * from './components/effects';
|
|
12
|
+
export * from './presets';
|
|
13
|
+
export * from './components';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { RpgClientEngine } from './index2.js';
|
|
2
|
+
export { provideRpg } from './index3.js';
|
|
3
|
+
export { provideMmorpg } from './index4.js';
|
|
4
|
+
export { startGame } from './index5.js';
|
|
5
|
+
export { clearInject, context, inject, setInject } from './index6.js';
|
|
6
|
+
export { LoadMapService, LoadMapToken, provideLoadMap } from './index7.js';
|
|
7
|
+
export { GlobalConfigToken, provideClientGlobalConfig, provideClientModules, provideGlobalConfig } from './index8.js';
|
|
8
|
+
export { RpgGui } from './index9.js';
|
|
9
|
+
export { PrebuiltGui } from './index10.js';
|
|
10
|
+
export { PrebuiltEffects } from './index11.js';
|
|
11
|
+
export { Presets } from './index12.js';
|
|
12
|
+
export { default as EventLayerComponent } from './index13.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/index10.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index10.js","sources":["../src/components/gui/index.ts"],"sourcesContent":["import Dialogbox from \"./dialogbox/index.ce\";\n\nexport const PrebuiltGui = {\n Dialogbox\n}"],"names":["Dialogbox"],"mappings":";;AAEO,MAAM,WAAc,GAAA;AAAA,aACvBA;AACJ;;;;"}
|
package/dist/index11.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index11.js","sources":["../src/components/effects/index.ts"],"sourcesContent":["import Hit from \"./hit.ce\";\nimport Animation from \"./animation.ce\";\n\nexport const PrebuiltEffects = {\n Hit,\n Animation\n}"],"names":["Hit","Animation"],"mappings":";;;AAGO,MAAM,eAAkB,GAAA;AAAA,OAC3BA,WAAA;AAAA,aACAC;AACJ;;;;"}
|
package/dist/index12.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index12.js","sources":["../src/presets/index.ts"],"sourcesContent":["import { RMSpritesheet } from \"./rmspritesheet\";\n\nexport const Presets = {\n RMSpritesheet\n}"],"names":[],"mappings":";;AAEO,MAAM,OAAU,GAAA;AAAA,EACnB;AACJ;;;;"}
|
package/dist/index13.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useProps, useDefineProps, h, Container, loop } from 'canvasengine';
|
|
2
|
+
import { inject } from './index6.js';
|
|
3
|
+
import { RpgClientEngine } from './index2.js';
|
|
4
|
+
import component$1 from './index35.js';
|
|
5
|
+
|
|
6
|
+
function component($$props) {
|
|
7
|
+
useProps($$props);
|
|
8
|
+
useDefineProps($$props);
|
|
9
|
+
var engine = inject(RpgClientEngine);
|
|
10
|
+
var players = engine.sceneMap.players;
|
|
11
|
+
var events = engine.sceneMap.events;
|
|
12
|
+
let $this = h(Container, { sortableChildren: true }, [loop(events, (event, id) => h(component$1, { id: id, object: event, isMe: false })), loop(players, (player, id) => h(component$1, { id: id, object: player, isMe: true }))]);
|
|
13
|
+
return $this
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { component as default };
|
|
17
|
+
//# sourceMappingURL=index13.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index13.js","sources":["../src/components/scenes/event-layer.ce"],"sourcesContent":["<Container sortableChildren={true}>\n @for ((event,id) of events) {\n <Character id={id} object={event} isMe={false} />\n }\n\n @for ((player,id) of players) {\n <Character id={id} object={player} isMe={true} />\n }\n</Container>\n\n<script>\n import { effect, signal, computed, mount } from 'canvasengine'\n import { inject } from \"../../core/inject\";\n import { RpgClientEngine } from \"../../RpgClientEngine\";\n import Character from \"../character.ce\";\n \n const engine = inject(RpgClientEngine);\n const players = engine.sceneMap.players\n const events = engine.sceneMap.events\n</script>"],"names":["Character"],"mappings":";;;;;AAQqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAA4B,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AAC5C,IAAI,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO;AACrC,IAAI,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC7B,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAACA,WAAS,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,CAACA,WAAS,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACrO,QAAQ,OAAO;AACf;;;;"}
|
package/dist/index14.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useProps, useDefineProps, computed, effect, h, Canvas, loop, Viewport, cond, Container } from 'canvasengine';
|
|
2
|
+
import { inject } from './index6.js';
|
|
3
|
+
import { RpgClientEngine } from './index2.js';
|
|
4
|
+
import component$1 from './index28.js';
|
|
5
|
+
import { RpgGui } from './index9.js';
|
|
6
|
+
|
|
7
|
+
function component($$props) {
|
|
8
|
+
useProps($$props);
|
|
9
|
+
useDefineProps($$props);
|
|
10
|
+
var __assign = (this && this.__assign) || function () {
|
|
11
|
+
__assign = Object.assign || function(t) {
|
|
12
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
13
|
+
s = arguments[i];
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
return __assign.apply(this, arguments);
|
|
20
|
+
};
|
|
21
|
+
var engine = inject(RpgClientEngine);
|
|
22
|
+
var guiService = inject(RpgGui);
|
|
23
|
+
var sceneData = engine.sceneMap.data;
|
|
24
|
+
var gui = guiService.gui;
|
|
25
|
+
var worldWidth = computed(function () { var _a; return (_a = sceneData()) === null || _a === void 0 ? void 0 : _a.width; });
|
|
26
|
+
var worldHeight = computed(function () { var _a; return (_a = sceneData()) === null || _a === void 0 ? void 0 : _a.height; });
|
|
27
|
+
effect(function () {
|
|
28
|
+
if (sceneData() && !sceneData().component) {
|
|
29
|
+
throw new Error("Warning ! You need to define a component for the scene. Use provideLoadMap() to define a component for the scene.");
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var onGuiFinish = function (gui, data) {
|
|
33
|
+
guiService.guiClose(gui.name, data);
|
|
34
|
+
};
|
|
35
|
+
var onGuiInteraction = function (gui, name, data) {
|
|
36
|
+
guiService.guiInteraction(gui.name, name, data);
|
|
37
|
+
};
|
|
38
|
+
var clamp = {
|
|
39
|
+
direction: "all"
|
|
40
|
+
};
|
|
41
|
+
let $this = h(Canvas, { width: computed(() => engine.width()), height: computed(() => engine.height()) }, [h(Viewport, { worldWidth, worldHeight, clamp }, cond(sceneData, () => h(component$1))), loop(gui, gui => h(Container, { display: 'flex' }, cond(gui.display, () => h(gui.component, { ...gui.data(), onFinish: (data) => {
|
|
42
|
+
onGuiFinish(gui, data);
|
|
43
|
+
}, onInteraction: (name, data) => {
|
|
44
|
+
onGuiInteraction(gui, name, data);
|
|
45
|
+
} }))))]);
|
|
46
|
+
return $this
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { component as default };
|
|
50
|
+
//# sourceMappingURL=index14.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index14.js","sources":["../src/components/scenes/canvas.ce"],"sourcesContent":["<Canvas width={@engine.width} height={@engine.height}>\n <Viewport worldWidth worldHeight clamp>\n @if (sceneData) {\n <SceneMap />\n }\n </Viewport>\n @for (gui of gui) {\n <Container display=\"flex\">\n @if (gui.display) {\n <gui.component ...gui.data() onFinish={(data) => {\n onGuiFinish(gui, data)\n }} onInteraction={(name, data) => {\n onGuiInteraction(gui, name, data)\n }} /> \n }\n </Container>\n } \n</Canvas>\n\n<script>\n import { signal, computed, effect } from \"canvasengine\";\n import { inject } from \"../../core/inject\";\n import { RpgClientEngine } from \"../../RpgClientEngine\";\n import SceneMap from './draw-map.ce'\n import { RpgGui } from \"../../Gui/Gui\";\n\n const engine = inject(RpgClientEngine);\n const guiService = inject(RpgGui);\n const sceneData = engine.sceneMap.data\n const gui = guiService.gui\n const worldWidth = computed(() => sceneData()?.width)\n const worldHeight = computed(() => sceneData()?.height)\n\n effect(() => {\n if (sceneData() && !sceneData().component) {\n throw new Error(\"Warning ! You need to define a component for the scene. Use provideLoadMap() to define a component for the scene.\")\n }\n })\n\n const onGuiFinish = (gui, data) => {\n guiService.guiClose(gui.name, data)\n }\n\n const onGuiInteraction = (gui, name, data) => {\n guiService.guiInteraction(gui.name, name, data)\n }\n \n const clamp = {\n direction: \"all\"\n }\n</script>\n"],"names":["SceneMap"],"mappings":";;;;;;AAYqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAA4B,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,QAAQ,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,YAAY;AAC9D,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,CAAC,EAAE;AAC5C,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;AAC5B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3E,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3B;AACA,QAAQ,OAAO,CAAC;AAChB,KAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,CAAC;AACD,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AACpC,IAAI,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;AAC/B,IAAI,S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QAAQ,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAACA,WAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,KAAK;AACzU,UAAU,WAAW,CAAC,GAAG,EAAE,IAAI;AAC/B,SAAS,EAAE,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK;AAC1C,UAAU,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI;AAC1C,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAChB,QAAQ,OAAO;AACf;;;;"}
|
package/dist/index15.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/inject.ts
|
|
5
|
+
function provide(context, name, value) {
|
|
6
|
+
context.set("inject:" + name, value);
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
__name(provide, "provide");
|
|
10
|
+
function isInjected(context, name) {
|
|
11
|
+
return context.get("injected:" + name) === true;
|
|
12
|
+
}
|
|
13
|
+
__name(isInjected, "isInjected");
|
|
14
|
+
function isProvided(context, name) {
|
|
15
|
+
return context.get("inject:" + name) !== void 0;
|
|
16
|
+
}
|
|
17
|
+
__name(isProvided, "isProvided");
|
|
18
|
+
function inject(context, service, args = []) {
|
|
19
|
+
const isClass = typeof service === "function";
|
|
20
|
+
const name = isClass ? service.name : service;
|
|
21
|
+
const value = context.get("inject:" + name);
|
|
22
|
+
if (value) {
|
|
23
|
+
context.set("injected:" + name, true);
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
throw new Error(`Injection provider ${name} not found`);
|
|
27
|
+
}
|
|
28
|
+
__name(inject, "inject");
|
|
29
|
+
function override(providers, newProvider, options) {
|
|
30
|
+
let { upsert = false, key } = options ?? {};
|
|
31
|
+
if (!key) {
|
|
32
|
+
key = typeof newProvider === "function" ? newProvider.name : newProvider.provide;
|
|
33
|
+
}
|
|
34
|
+
const flatProviders = providers.flat();
|
|
35
|
+
const exists = flatProviders.some((provider) => {
|
|
36
|
+
if (typeof provider === "function") {
|
|
37
|
+
return provider.name === key;
|
|
38
|
+
} else if (typeof provider === "object") {
|
|
39
|
+
return provider.provide === key;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
});
|
|
43
|
+
const mappedProviders = flatProviders.map((provider) => {
|
|
44
|
+
if (typeof provider === "function" && provider.name === key) {
|
|
45
|
+
return newProvider;
|
|
46
|
+
} else if (typeof provider === "object" && provider.provide === key) {
|
|
47
|
+
return newProvider;
|
|
48
|
+
}
|
|
49
|
+
return provider;
|
|
50
|
+
});
|
|
51
|
+
if (upsert && !exists) {
|
|
52
|
+
mappedProviders.push(newProvider);
|
|
53
|
+
}
|
|
54
|
+
return mappedProviders;
|
|
55
|
+
}
|
|
56
|
+
__name(override, "override");
|
|
57
|
+
function findProviders(providers, name) {
|
|
58
|
+
const results = [];
|
|
59
|
+
for (const provider of providers) {
|
|
60
|
+
if (Array.isArray(provider)) {
|
|
61
|
+
results.push(...findProviders(provider, name));
|
|
62
|
+
} else if (findProvider(provider, name)) {
|
|
63
|
+
results.push(provider);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return results;
|
|
67
|
+
}
|
|
68
|
+
__name(findProviders, "findProviders");
|
|
69
|
+
function findProvider(providers, name) {
|
|
70
|
+
if (!Array.isArray(providers)) {
|
|
71
|
+
if (typeof providers === "object" && "provide" in providers) {
|
|
72
|
+
const provider = providers;
|
|
73
|
+
const providerName = typeof provider.provide === "function" ? provider.provide.name : provider.provide;
|
|
74
|
+
if (name instanceof RegExp) {
|
|
75
|
+
if (name.test(providerName)) return providers;
|
|
76
|
+
} else {
|
|
77
|
+
if (providerName === name) return providers;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
for (const provider of providers) {
|
|
83
|
+
if (Array.isArray(provider)) {
|
|
84
|
+
const found = findProvider(provider, name);
|
|
85
|
+
if (found) return found;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (typeof provider === "object" && "provide" in provider) {
|
|
89
|
+
const providerName = typeof provider.provide === "function" ? provider.provide.name : provider.provide;
|
|
90
|
+
if (name instanceof RegExp) {
|
|
91
|
+
if (name.test(providerName)) return provider;
|
|
92
|
+
} else {
|
|
93
|
+
if (providerName === name) return provider;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
__name(findProvider, "findProvider");
|
|
100
|
+
|
|
101
|
+
// src/merge-config.ts
|
|
102
|
+
function processProvider(mergedConfig, baseConfig, provider) {
|
|
103
|
+
if (Array.isArray(provider)) {
|
|
104
|
+
for (const nestedProvider of provider) {
|
|
105
|
+
processProvider(mergedConfig, baseConfig, nestedProvider);
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const existingProvider = findProvider(baseConfig.providers, provider.provide);
|
|
110
|
+
if (existingProvider) {
|
|
111
|
+
mergedConfig.providers = override(mergedConfig.providers, provider);
|
|
112
|
+
} else {
|
|
113
|
+
mergedConfig.providers.push(provider);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
__name(processProvider, "processProvider");
|
|
117
|
+
function mergeConfig(baseConfig, config) {
|
|
118
|
+
const mergedConfig = {
|
|
119
|
+
...baseConfig,
|
|
120
|
+
...config,
|
|
121
|
+
providers: [
|
|
122
|
+
...baseConfig.providers
|
|
123
|
+
]
|
|
124
|
+
// Start with a copy of base providers
|
|
125
|
+
};
|
|
126
|
+
for (const provider of config.providers) {
|
|
127
|
+
processProvider(mergedConfig, baseConfig, provider);
|
|
128
|
+
}
|
|
129
|
+
return mergedConfig;
|
|
130
|
+
}
|
|
131
|
+
__name(mergeConfig, "mergeConfig");
|
|
132
|
+
|
|
133
|
+
// src/provider.ts
|
|
134
|
+
async function injector(context, providers) {
|
|
135
|
+
providers = providers.flat();
|
|
136
|
+
for (const provider of providers) {
|
|
137
|
+
let token;
|
|
138
|
+
let instance;
|
|
139
|
+
if (typeof provider === "function") {
|
|
140
|
+
token = provider;
|
|
141
|
+
instance = new provider(context);
|
|
142
|
+
} else {
|
|
143
|
+
token = provider.provide;
|
|
144
|
+
const provideUserClass = provider.useClass;
|
|
145
|
+
const isClass = typeof provideUserClass === "function";
|
|
146
|
+
if (isClass) {
|
|
147
|
+
instance = new provideUserClass(context);
|
|
148
|
+
} else if ("useValue" in provider) {
|
|
149
|
+
instance = provider.useValue;
|
|
150
|
+
} else if ("useFactory" in provider) {
|
|
151
|
+
instance = provider.useFactory?.(context);
|
|
152
|
+
if (instance instanceof Promise) {
|
|
153
|
+
instance = await instance;
|
|
154
|
+
}
|
|
155
|
+
} else if ("useExisting" in provider) {
|
|
156
|
+
instance = inject(context, provider.useExisting);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const name = typeof token === "function" ? token.name : token;
|
|
160
|
+
provide(context, name, instance);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
__name(injector, "injector");
|
|
164
|
+
|
|
165
|
+
// src/context.ts
|
|
166
|
+
var Context = class {
|
|
167
|
+
static {
|
|
168
|
+
__name(this, "Context");
|
|
169
|
+
}
|
|
170
|
+
/** Internal storage for injected values */
|
|
171
|
+
values = {};
|
|
172
|
+
/**
|
|
173
|
+
* Sets a value in the context
|
|
174
|
+
* @param key - Unique identifier for the value
|
|
175
|
+
* @param value - Value to store
|
|
176
|
+
*/
|
|
177
|
+
set(key, value) {
|
|
178
|
+
this.values[key] = value;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Retrieves a value from the context
|
|
182
|
+
* @param key - Unique identifier for the value
|
|
183
|
+
* @returns The stored value or undefined if not found
|
|
184
|
+
*/
|
|
185
|
+
get(key) {
|
|
186
|
+
return this.values[key];
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export { Context, findProvider, findProviders, inject, injector, isInjected, isProvided, mergeConfig, override, provide };
|
|
191
|
+
//# sourceMappingURL=index15.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index15.js","sources":["../../../node_modules/.pnpm/@signe+di@2.3.3/node_modules/@signe/di/dist/index.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/inject.ts\nfunction provide(context, name, value) {\n context.set(\"inject:\" + name, value);\n return value;\n}\n__name(provide, \"provide\");\nfunction isInjected(context, name) {\n return context.get(\"injected:\" + name) === true;\n}\n__name(isInjected, \"isInjected\");\nfunction isProvided(context, name) {\n return context.get(\"inject:\" + name) !== void 0;\n}\n__name(isProvided, \"isProvided\");\nfunction inject(context, service, args = []) {\n const isClass = typeof service === \"function\";\n const name = isClass ? service.name : service;\n const value = context.get(\"inject:\" + name);\n if (value) {\n context.set(\"injected:\" + name, true);\n return value;\n }\n throw new Error(`Injection provider ${name} not found`);\n}\n__name(inject, \"inject\");\nfunction override(providers, newProvider, options) {\n let { upsert = false, key } = options ?? {};\n if (!key) {\n key = typeof newProvider === \"function\" ? newProvider.name : newProvider.provide;\n }\n const flatProviders = providers.flat();\n const exists = flatProviders.some((provider) => {\n if (typeof provider === \"function\") {\n return provider.name === key;\n } else if (typeof provider === \"object\") {\n return provider.provide === key;\n }\n return false;\n });\n const mappedProviders = flatProviders.map((provider) => {\n if (typeof provider === \"function\" && provider.name === key) {\n return newProvider;\n } else if (typeof provider === \"object\" && provider.provide === key) {\n return newProvider;\n }\n return provider;\n });\n if (upsert && !exists) {\n mappedProviders.push(newProvider);\n }\n return mappedProviders;\n}\n__name(override, \"override\");\nfunction findProviders(providers, name) {\n const results = [];\n for (const provider of providers) {\n if (Array.isArray(provider)) {\n results.push(...findProviders(provider, name));\n } else if (findProvider(provider, name)) {\n results.push(provider);\n }\n }\n return results;\n}\n__name(findProviders, \"findProviders\");\nfunction findProvider(providers, name) {\n if (!Array.isArray(providers)) {\n if (typeof providers === \"object\" && \"provide\" in providers) {\n const provider = providers;\n const providerName = typeof provider.provide === \"function\" ? provider.provide.name : provider.provide;\n if (name instanceof RegExp) {\n if (name.test(providerName)) return providers;\n } else {\n if (providerName === name) return providers;\n }\n }\n return null;\n }\n for (const provider of providers) {\n if (Array.isArray(provider)) {\n const found = findProvider(provider, name);\n if (found) return found;\n continue;\n }\n if (typeof provider === \"object\" && \"provide\" in provider) {\n const providerName = typeof provider.provide === \"function\" ? provider.provide.name : provider.provide;\n if (name instanceof RegExp) {\n if (name.test(providerName)) return provider;\n } else {\n if (providerName === name) return provider;\n }\n }\n }\n return null;\n}\n__name(findProvider, \"findProvider\");\n\n// src/merge-config.ts\nfunction processProvider(mergedConfig, baseConfig, provider) {\n if (Array.isArray(provider)) {\n for (const nestedProvider of provider) {\n processProvider(mergedConfig, baseConfig, nestedProvider);\n }\n return;\n }\n const existingProvider = findProvider(baseConfig.providers, provider.provide);\n if (existingProvider) {\n mergedConfig.providers = override(mergedConfig.providers, provider);\n } else {\n mergedConfig.providers.push(provider);\n }\n}\n__name(processProvider, \"processProvider\");\nfunction mergeConfig(baseConfig, config) {\n const mergedConfig = {\n ...baseConfig,\n ...config,\n providers: [\n ...baseConfig.providers\n ]\n // Start with a copy of base providers\n };\n for (const provider of config.providers) {\n processProvider(mergedConfig, baseConfig, provider);\n }\n return mergedConfig;\n}\n__name(mergeConfig, \"mergeConfig\");\n\n// src/provider.ts\nasync function injector(context, providers) {\n providers = providers.flat();\n for (const provider of providers) {\n let token;\n let instance;\n if (typeof provider === \"function\") {\n token = provider;\n instance = new provider(context);\n } else {\n token = provider.provide;\n const provideUserClass = provider.useClass;\n const isClass = typeof provideUserClass === \"function\";\n if (isClass) {\n instance = new provideUserClass(context);\n } else if (\"useValue\" in provider) {\n instance = provider.useValue;\n } else if (\"useFactory\" in provider) {\n instance = provider.useFactory?.(context);\n if (instance instanceof Promise) {\n instance = await instance;\n }\n } else if (\"useExisting\" in provider) {\n instance = inject(context, provider.useExisting);\n }\n }\n const name = typeof token === \"function\" ? token.name : token;\n provide(context, name, instance);\n }\n}\n__name(injector, \"injector\");\n\n// src/context.ts\nvar Context = class {\n static {\n __name(this, \"Context\");\n }\n /** Internal storage for injected values */\n values = {};\n /**\n * Sets a value in the context\n * @param key - Unique identifier for the value\n * @param value - Value to store\n */\n set(key, value) {\n this.values[key] = value;\n }\n /**\n * Retrieves a value from the context\n * @param key - Unique identifier for the value\n * @returns The stored value or undefined if not found\n */\n get(key) {\n return this.values[key];\n }\n};\nexport {\n Context,\n findProvider,\n findProviders,\n inject,\n injector,\n isInjected,\n isProvided,\n mergeConfig,\n override,\n provide\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc;AACrC,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,KAAK,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;;AAExF;AACA,SAAS,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE;AACvC,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,EAAE,KAAK,CAAC;AACtC,EAAE,OAAO,KAAK;AACd;AACA,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;AAC1B,SAAS,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE;AACnC,EAAE,OAAO,OAAO,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E,MAAM,GAAG,EAAE;AACb;AACA;AACA;AACA;AACA;AACA,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,GAAG,CAAC,GAAG,EAAE;AACX,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;AAC3B;AACA;;;;","x_google_ignoreList":[0]}
|
package/dist/index16.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index16.js","sources":["../src/services/AbstractSocket.ts"],"sourcesContent":["import { Context } from \"@signe/di\";\n\nexport const WebSocketToken = \"websocket\";\n\nexport abstract class AbstractWebsocket {\n constructor(protected context: Context) {}\n\n abstract connection(listeners?: (data: any) => void): Promise<void>;\n abstract emit(event: string, data: any): void;\n abstract on(event: string, callback: (data: any) => void): void;\n abstract off(event: string, callback: (data: any) => void): void;\n abstract updateProperties(params: { room: string, host?: string }): void;\n abstract reconnect(listeners?: (data: any) => void): void;\n}\n"],"names":[],"mappings":"AAEO,MAAM,cAAiB,GAAA;AAEvB,MAAe,iBAAkB,CAAA;AAAA,EACtC,YAAsB,OAAkB,EAAA;AAAlB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA;AAQxB;;;;"}
|