@rpgjs/client 5.0.0-alpha.0 → 5.0.0-alpha.10
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/AnimationManager.d.ts +8 -0
- package/dist/RpgClient.d.ts +99 -68
- package/dist/RpgClientEngine.d.ts +86 -4
- package/dist/components/animations/index.d.ts +4 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.js +4 -4
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +6 -2
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +2 -2
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +95 -35
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +45 -186
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +187 -5
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +5 -383
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +384 -28
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +24 -17
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +147 -25
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +16 -2413
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +2395 -88
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +108 -103
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +95 -57
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +62 -12
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +18 -37
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +25 -3
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +87 -314
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +37 -21
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +3 -9
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +317 -6
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +24 -171
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +7 -497
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +8 -9
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +9 -4400
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +4397 -85
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +310 -55
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +169 -15
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +496 -15
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +61 -0
- package/dist/index39.js.map +1 -0
- package/dist/index4.js +18 -5
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +20 -0
- package/dist/index40.js.map +1 -0
- package/dist/index41.js +82 -0
- package/dist/index41.js.map +1 -0
- package/dist/index5.js +2 -1
- package/dist/index5.js.map +1 -1
- package/dist/index6.js +1 -1
- package/dist/index7.js +10 -2
- package/dist/index7.js.map +1 -1
- package/dist/index8.js +24 -6
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +2 -2
- package/dist/presets/animation.d.ts +31 -0
- package/dist/presets/index.d.ts +102 -0
- package/dist/presets/lpc.d.ts +89 -0
- package/dist/services/loadMap.d.ts +123 -2
- package/dist/services/mmorpg.d.ts +7 -3
- package/package.json +14 -12
- package/src/Game/{EffectManager.ts → AnimationManager.ts} +2 -2
- package/src/Game/Object.ts +69 -0
- package/src/RpgClient.ts +101 -67
- package/src/RpgClientEngine.ts +159 -24
- package/src/components/{effects → animations}/animation.ce +3 -5
- package/src/components/{effects → animations}/index.ts +1 -1
- package/src/components/character.ce +74 -33
- package/src/components/index.ts +2 -1
- package/src/components/scenes/draw-map.ce +6 -23
- package/src/components/scenes/event-layer.ce +3 -3
- package/src/core/setup.ts +2 -0
- package/src/index.ts +1 -1
- package/src/module.ts +23 -5
- package/src/presets/animation.ts +46 -0
- package/src/presets/index.ts +5 -1
- package/src/presets/lpc.ts +108 -0
- package/src/services/loadMap.ts +131 -2
- package/src/services/mmorpg.ts +20 -4
- package/tsconfig.json +1 -1
- package/vite.config.ts +1 -1
- package/dist/Game/EffectManager.d.ts +0 -5
- package/dist/components/effects/index.d.ts +0 -4
- package/src/components/scenes/element-map.ce +0 -23
- /package/src/components/{effects → animations}/hit.ce +0 -0
package/dist/index14.js
CHANGED
|
@@ -1,48 +1,108 @@
|
|
|
1
|
-
import { useProps, useDefineProps, computed, effect,
|
|
2
|
-
import {
|
|
1
|
+
import { useProps, useDefineProps, computed, signal, effect, mount, tick, h, Container, loop, Sprite } from 'canvasengine';
|
|
2
|
+
import { Particle } from '@canvasengine/presets';
|
|
3
|
+
import { Direction, ModulesToken } from '@rpgjs/common';
|
|
3
4
|
import { RpgClientEngine } from './index2.js';
|
|
4
|
-
import
|
|
5
|
-
import { RpgGui } from './index9.js';
|
|
5
|
+
import { inject } from './index6.js';
|
|
6
6
|
|
|
7
7
|
function component($$props) {
|
|
8
8
|
useProps($$props);
|
|
9
|
-
useDefineProps($$props);
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
const defineProps = useDefineProps($$props);
|
|
10
|
+
var _a = defineProps(), object = _a.object, id = _a.id;
|
|
11
|
+
var client = inject(RpgClientEngine);
|
|
12
|
+
var hooks = inject(ModulesToken);
|
|
13
|
+
var spritesheets = client.spritesheets;
|
|
14
|
+
var playerId = client.playerId;
|
|
15
|
+
var componentsBehind = client.spriteComponentsBehind;
|
|
16
|
+
var componentsInFront = client.spriteComponentsInFront;
|
|
17
|
+
var isMe = computed(function () { return id() === playerId; });
|
|
18
|
+
var x = object.x, y = object.y, tint = object.tint, direction = object.direction, animationName = object.animationName, animationCurrentIndex = object.animationCurrentIndex, emitParticleTrigger = object.emitParticleTrigger, particleName = object.particleName, graphics = object.graphics, hitbox = object.hitbox;
|
|
19
|
+
var particleSettings = client.particleSettings;
|
|
20
|
+
var canControls = function () { return isMe() && object.canMove(); };
|
|
21
|
+
var keyboardControls = client.globalConfig.keyboardControls;
|
|
22
|
+
var controls = signal({
|
|
23
|
+
down: {
|
|
24
|
+
repeat: true,
|
|
25
|
+
bind: keyboardControls.down,
|
|
26
|
+
keyDown: function () {
|
|
27
|
+
if (canControls())
|
|
28
|
+
client.processInput({ input: Direction.Down });
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
up: {
|
|
32
|
+
repeat: true,
|
|
33
|
+
bind: keyboardControls.up,
|
|
34
|
+
keyDown: function () {
|
|
35
|
+
if (canControls())
|
|
36
|
+
client.processInput({ input: Direction.Up });
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
left: {
|
|
40
|
+
repeat: true,
|
|
41
|
+
bind: keyboardControls.left,
|
|
42
|
+
keyDown: function () {
|
|
43
|
+
if (canControls())
|
|
44
|
+
client.processInput({ input: Direction.Left });
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
right: {
|
|
48
|
+
repeat: true,
|
|
49
|
+
bind: keyboardControls.right,
|
|
50
|
+
keyDown: function () {
|
|
51
|
+
if (canControls())
|
|
52
|
+
client.processInput({ input: Direction.Right });
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
action: {
|
|
56
|
+
bind: keyboardControls.action,
|
|
57
|
+
keyDown: function () {
|
|
58
|
+
if (canControls()) {
|
|
59
|
+
client.processAction({ action: 'action' });
|
|
60
|
+
// particleName.set('hit')
|
|
61
|
+
// emitParticleTrigger.start()
|
|
62
|
+
// object.flash('red')
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
var sheet = function (graphicId) {
|
|
68
|
+
return {
|
|
69
|
+
definition: spritesheets.get(graphicId),
|
|
70
|
+
playing: animationName,
|
|
71
|
+
params: {
|
|
72
|
+
direction: direction
|
|
73
|
+
},
|
|
74
|
+
onFinish: function () {
|
|
75
|
+
animationCurrentIndex.update(function (index) { return index + 1; });
|
|
16
76
|
}
|
|
17
|
-
return t;
|
|
18
77
|
};
|
|
19
|
-
return __assign.apply(this, arguments);
|
|
20
78
|
};
|
|
21
|
-
var
|
|
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; });
|
|
79
|
+
var previousAnimationName = animationName();
|
|
27
80
|
effect(function () {
|
|
28
|
-
|
|
29
|
-
|
|
81
|
+
var currentAnimationName = animationName();
|
|
82
|
+
// If animation changed externally (not through setAnimation), reset the state
|
|
83
|
+
if (currentAnimationName !== previousAnimationName && object.animationIsPlaying && object.animationIsPlaying()) {
|
|
84
|
+
// Check if this is a movement animation (walk, stand) that should interrupt custom animations
|
|
85
|
+
var movementAnimations = ['walk', 'stand'];
|
|
86
|
+
if (movementAnimations.includes(currentAnimationName)) {
|
|
87
|
+
if (typeof object.resetAnimationState === 'function') {
|
|
88
|
+
object.resetAnimationState();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
30
91
|
}
|
|
92
|
+
previousAnimationName = currentAnimationName;
|
|
31
93
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
onGuiInteraction(gui, name, data);
|
|
45
|
-
} }))))]);
|
|
94
|
+
mount(function (element) {
|
|
95
|
+
hooks.callHooks("client-sprite-onInit", element.componentInstance);
|
|
96
|
+
hooks.callHooks("client-sceneMap-onAddSprite", client.sceneMap, element.componentInstance);
|
|
97
|
+
return function () {
|
|
98
|
+
hooks.callHooks("client-sprite-onDestroy", element.componentInstance);
|
|
99
|
+
hooks.callHooks("client-sceneMap-onRemoveSprite", client.sceneMap, element.componentInstance);
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
tick(function () {
|
|
103
|
+
hooks.callHooks("client-sprite-onUpdate");
|
|
104
|
+
});
|
|
105
|
+
let $this = h(Container, { x, y, zIndex: y, viewportFollow: isMe, controls }, [loop(componentsBehind, component => h(Container, null, h(component, { object }))), h(Particle, { emit: emitParticleTrigger, settings: particleSettings, zIndex: 1000, name: particleName }), h(Container, null, loop(graphics, graphicId => h(Sprite, { sheet: sheet(graphicId), direction, tint, hitbox }))), loop(componentsInFront, component => h(Container, null, h(component, { object })))]);
|
|
46
106
|
return $this
|
|
47
107
|
}
|
|
48
108
|
|
package/dist/index14.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index14.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index14.js","sources":["../src/components/character.ce"],"sourcesContent":["<Container x y zIndex={y} viewportFollow={isMe} controls>\n @for (component of componentsBehind) {\n <Container>\n <component object />\n </Container>\n } \n <Particle emit={@emitParticleTrigger} settings={@particleSettings} zIndex={1000} name={particleName} />\n <Container>\n @for (graphicId of graphics) {\n <Sprite sheet={@sheet(@graphicId)} direction tint hitbox />\n }\n </Container>\n @for (component of componentsInFront) {\n <Container>\n <component object />\n </Container>\n } \n</Container>\n\n<script>\n import { signal, effect, mount, computed, tick } from \"canvasengine\";\n import { Particle } from \"@canvasengine/presets\";\n import { GameEngineToken, ModulesToken } from \"@rpgjs/common\";\n import { RpgClientEngine } from \"../RpgClientEngine\";\n import { inject } from \"../core/inject\"; \n import { Direction } from \"@rpgjs/common\";\n import Hit from \"./effects/hit.ce\";\n\n const { object, id } = defineProps();\n \n const client = inject(RpgClientEngine);\n const hooks = inject(ModulesToken);\n\n const spritesheets = client.spritesheets;\n const playerId = client.playerId;\n const componentsBehind = client.spriteComponentsBehind;\n const componentsInFront = client.spriteComponentsInFront;\n const isMe = computed(() => id() === playerId);\n\n const { \n x, \n y, \n tint, \n direction, \n animationName, \n animationCurrentIndex,\n emitParticleTrigger, \n particleName, \n graphics, \n hitbox \n } = object;\n\n const particleSettings = client.particleSettings;\n\n const canControls = () => isMe() && object.canMove()\n const keyboardControls = client.globalConfig.keyboardControls;\n\n const controls = signal({\n down: {\n repeat: true,\n bind: keyboardControls.down,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Down })\n },\n },\n up: {\n repeat: true,\n bind: keyboardControls.up,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Up })\n },\n },\n left: {\n repeat: true,\n bind: keyboardControls.left,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Left })\n },\n },\n right: {\n repeat: true,\n bind: keyboardControls.right,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Right })\n },\n },\n action: {\n bind: keyboardControls.action,\n keyDown() {\n if (canControls()) {\n client.processAction({ action: 'action' })\n // particleName.set('hit') \n // emitParticleTrigger.start()\n // object.flash('red')\n }\n },\n },\n });\n\n const sheet = (graphicId) => {\n return {\n definition: spritesheets.get(graphicId),\n playing: animationName,\n params: {\n direction\n },\n onFinish() {\n animationCurrentIndex.update(index => index + 1)\n }\n };\n }\n\n // Track animation changes to reset animation state when needed\n let previousAnimationName = animationName();\n effect(() => {\n const currentAnimationName = animationName();\n \n // If animation changed externally (not through setAnimation), reset the state\n if (currentAnimationName !== previousAnimationName && object.animationIsPlaying && object.animationIsPlaying()) {\n // Check if this is a movement animation (walk, stand) that should interrupt custom animations\n const movementAnimations = ['walk', 'stand'];\n if (movementAnimations.includes(currentAnimationName)) {\n if (typeof object.resetAnimationState === 'function') {\n object.resetAnimationState();\n }\n }\n }\n \n previousAnimationName = currentAnimationName;\n });\n\n mount((element) => {\n hooks.callHooks(\"client-sprite-onInit\", element.componentInstance)\n hooks.callHooks(\"client-sceneMap-onAddSprite\", client.sceneMap, element.componentInstance)\n\n return () => {\n hooks.callHooks(\"client-sprite-onDestroy\", element.componentInstance)\n hooks.callHooks(\"client-sceneMap-onRemoveSprite\", client.sceneMap, element.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AAC;AACzd,QAAQ,OAAO;AACf;;;;"}
|
package/dist/index15.js
CHANGED
|
@@ -1,191 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 './index31.js';
|
|
5
|
+
import { RpgGui } from './index9.js';
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
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];
|
|
154
16
|
}
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
return __assign.apply(this, arguments);
|
|
188
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
|
+
}
|
|
189
48
|
|
|
190
|
-
export {
|
|
49
|
+
export { component as default };
|
|
191
50
|
//# sourceMappingURL=index15.js.map
|
package/dist/index15.js.map
CHANGED
|
@@ -1 +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,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,IAAI;AACjD;AACA,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;AAChC,SAAS,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE;AACnC,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,MAAM;AACjD;AACA,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;AAChC,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE;AAC7C,EAAE,MAAM,OAAO,GAAG,OAAO,OAAO,KAAK,UAAU;AAC/C,EAAE,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO;AAC/C,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,G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EAAE;AACzC,QAAQ,QAAQ,GAAG,QAAQ,CAAC,QAAQ;AACpC,OAAO,MAAM,IAAI,YAAY,IAAI,QAAQ,EAAE;AAC3C,QAAQ,QAAQ,GAAG,QAAQ,CAAC,UAAU,GAAG,OAAO,CAAC;AACjD,QAAQ,IAAI,QAAQ,YAAY,OAAO,EAAE;AACzC,UAAU,QAAQ,GAAG,MAAM,QAAQ;AACnC;AACA,OAAO,MAAM,IAAI,aAAa,IAAI,QAAQ,EAAE;AAC5C,QAAQ,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC;AACxD;AACA;AACA,IAAI,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK;AACjE,IAAI,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC;AACpC;AACA;AACA,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC;;AAE5B;AACG,IAAC,OAAO,GAAG,MAAM;AACpB,EAAE;AACF,IAAI,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;AAC3B;AACA;AACA,EAAE,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]}
|
|
1
|
+
{"version":3,"file":"index15.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,g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AAI,CAAC;AACnD,CAAC;AACD,IAAI,KAAK,GAAG;AACZ,IAAI,SAAS,EAAE;AACf;AACA,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,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/index16.js
CHANGED
|
@@ -1,9 +1,191 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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);
|
|
5
53
|
}
|
|
54
|
+
return mappedProviders;
|
|
6
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
|
+
};
|
|
7
189
|
|
|
8
|
-
export {
|
|
190
|
+
export { Context, findProvider, findProviders, inject, injector, isInjected, isProvided, mergeConfig, override, provide };
|
|
9
191
|
//# sourceMappingURL=index16.js.map
|