@rpgjs/client 5.0.0-beta.26 → 5.0.0-beta.28
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/CHANGELOG.md +47 -0
- package/dist/Game/AnimationManager.js.map +1 -1
- package/dist/Game/ClientVisuals.js.map +1 -1
- package/dist/Game/Map.js +2 -2
- package/dist/Game/Map.js.map +1 -1
- package/dist/Game/Object.js +1 -1
- package/dist/Game/Object.js.map +1 -1
- package/dist/Game/ProjectileManager.js.map +1 -1
- package/dist/Gui/Gui.d.ts +36 -17
- package/dist/Gui/Gui.js +40 -22
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/Gui/NotificationManager.js.map +1 -1
- package/dist/RpgClient.d.ts +3 -64
- package/dist/RpgClientEngine.js +1 -1
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.133.0 → _@oxc-project_runtime@0.139.0}/helpers/esm/decorate.js +2 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.133.0 → _@oxc-project_runtime@0.139.0}/helpers/esm/decorateMetadata.js +2 -2
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/fx.ce.js.map +1 -1
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/character-hitbox.js +1 -1
- package/dist/components/character.ce.js +3 -1
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/bar.ce.js.map +1 -1
- package/dist/components/dynamics/image.ce.js.map +1 -1
- package/dist/components/dynamics/parse-value.js +1 -1
- package/dist/components/dynamics/parse-value.js.map +1 -1
- package/dist/components/dynamics/shape-utils.js +1 -1
- package/dist/components/dynamics/shape.ce.js.map +1 -1
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/index.js +17 -16
- package/dist/components/gui/input-field.ce.js.map +1 -1
- package/dist/components/gui/input.ce.js.map +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +4 -2
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/index.js +4 -3
- package/dist/components/interaction-components.ce.js.map +1 -1
- package/dist/components/player-components-utils.js +1 -1
- package/dist/components/player-components-utils.js.map +1 -1
- package/dist/components/player-components.ce.js.map +1 -1
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/index.js +3 -2
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/components/scenes/weather-tick-lifecycle.js.map +1 -1
- package/dist/core/inject.d.ts +4 -4
- package/dist/core/inject.js.map +1 -1
- package/dist/core/setup.d.ts +3 -3
- package/dist/core/setup.js +1 -1
- package/dist/core/setup.js.map +1 -1
- package/dist/core/setup.spec.d.ts +1 -0
- package/dist/i18n.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/module.d.ts +2 -2
- package/dist/module.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_di@3.1.0/node_modules/@signe/di/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js.map +1 -1
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js +7 -7
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -1
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +1 -1
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js +2 -2
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -1
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -1
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -1
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +1 -1
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -1
- package/dist/presets/faceset.js.map +1 -1
- package/dist/presets/rmspritesheet.js.map +1 -1
- package/dist/public-api-types.spec.d.ts +1 -0
- package/dist/services/AbstractSocket.d.ts +3 -3
- package/dist/services/AbstractSocket.js.map +1 -1
- package/dist/services/cameraFollow.js +1 -1
- package/dist/services/cameraFollow.js.map +1 -1
- package/dist/services/interactions.js.map +1 -1
- package/dist/services/loadMap.d.ts +3 -7
- package/dist/services/loadMap.js +2 -2
- package/dist/services/loadMap.js.map +1 -1
- package/dist/services/mapStreaming.d.ts +2 -16
- package/dist/services/mapStreaming.js.map +1 -1
- package/dist/services/mmorpg-connection.js +1 -1
- package/dist/services/mmorpg-connection.js.map +1 -1
- package/dist/services/mmorpg.d.ts +4 -26
- package/dist/services/mmorpg.js.map +1 -1
- package/dist/services/pointerContext.js +2 -1
- package/dist/services/pointerContext.js.map +1 -1
- package/dist/services/save.js.map +1 -1
- package/dist/services/standalone.d.ts +2 -98
- package/dist/services/standalone.js.map +1 -1
- package/dist/utils/getEntityProp.js.map +1 -1
- package/dist/utils/syncHitbox.js.map +1 -1
- package/package.json +10 -10
- package/src/Game/Object.spec.ts +1 -1
- package/src/Game/Object.ts +4 -4
- package/src/Gui/Gui.spec.ts +26 -1
- package/src/Gui/Gui.ts +104 -40
- package/src/RpgClient.ts +2 -63
- package/src/core/inject.ts +6 -5
- package/src/core/setup.spec.ts +35 -0
- package/src/core/setup.ts +8 -6
- package/src/index.ts +12 -1
- package/src/module.ts +2 -2
- package/src/public-api-types.spec.ts +37 -0
- package/src/services/AbstractSocket.ts +2 -2
- package/src/services/loadMap.ts +8 -8
- package/src/services/mapStreaming.ts +7 -5
- package/src/services/mmorpg.ts +6 -7
- package/src/services/standalone.ts +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -22,10 +22,10 @@ export * from './Sound';
|
|
|
22
22
|
export * from './Resource';
|
|
23
23
|
export * from './decorators/spritesheet';
|
|
24
24
|
export * from './utils/getEntityProp';
|
|
25
|
-
export { Context } from '@signe/di';
|
|
26
25
|
export { KeyboardControls, Input } from 'canvasengine';
|
|
27
26
|
export { Control } from './services/keyboardControls';
|
|
28
27
|
export { defineModule } from '@rpgjs/common';
|
|
28
|
+
export type { RpgClassProvider, RpgContext, RpgExistingProvider, RpgFactoryProvider, RpgProvider, RpgProviders, RpgProviderToken, RpgReadableSignal, RpgValueProvider, RpgWritableSignal, } from '@rpgjs/common';
|
|
29
29
|
export { RpgClientObject } from './Game/Object';
|
|
30
30
|
export { RpgClientPlayer } from './Game/Player';
|
|
31
31
|
export { RpgClientEvent } from './Game/Event';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Context } from "./node_modules/.pnpm/@signe_di@3.1.0/node_modules/@signe/di/dist/index.js";
|
|
2
1
|
import { clearInject, context, inject, setInject } from "./core/inject.js";
|
|
3
2
|
import { AbstractWebsocket, WebSocketToken } from "./services/AbstractSocket.js";
|
|
4
3
|
import { getKeyboardControlBind, isKeyboardActionConfig, keyboardEventMatchesBind, normalizeActionInput, resolveKeyboardActionInput, resolveKeyboardDirectionInput } from "./services/actionInput.js";
|
|
@@ -53,4 +52,4 @@ import { Spritesheet } from "./decorators/spritesheet.js";
|
|
|
53
52
|
import { withMobile } from "./components/gui/mobile/index.js";
|
|
54
53
|
import { Input, KeyboardControls } from "canvasengine";
|
|
55
54
|
import { defineModule } from "@rpgjs/common";
|
|
56
|
-
export { AbstractWebsocket, __ce_component as BoxComponent, BridgeWebsocket, __ce_component$1 as CharacterComponent, ClientVisualRegistry,
|
|
55
|
+
export { AbstractWebsocket, __ce_component as BoxComponent, BridgeWebsocket, __ce_component$1 as CharacterComponent, ClientVisualRegistry, Control, __ce_component$2 as DialogboxComponent, __ce_component$3 as EquipMenuComponent, __ce_component$4 as EventLayerComponent, __ce_component$5 as ExitMenuComponent, __ce_component$6 as GameoverComponent, GlobalConfigToken, __ce_component$7 as HpBar, __ce_component$8 as HudComponent, Input, __ce_component$9 as InputComponent, __ce_component$10 as InputFieldComponent, __ce_component$11 as ItemsMenuComponent, KeyboardControls, __ce_component$12 as LightHalo, LoadMapService, LoadMapToken, __ce_component$13 as MainMenuComponent, MapStreamClientController, __ce_component$14 as NotificationComponent, __ce_component$15 as OptionsMenuComponent, PrebuiltComponentAnimations, Presets, ProjectileManager, RpgClientBuiltinI18n, RpgClientEngine, RpgClientEvent, RpgClientInteractions, RpgClientObject, RpgClientPlayer, RpgGui, RpgResource, RpgSound, SaveClientService, SaveClientToken, __ce_component$16 as SaveLoadComponent, __ce_component$17 as SceneMap, __ce_component$18 as ShopComponent, __ce_component$19 as SkillsMenuComponent, Sound, Spritesheet, __ce_component$20 as TitleScreenComponent, WebSocketToken, clearInject, context, createClientPointerContext, defineModule, dragToTile, draggable, getEntityProp, getKeyboardControlBind, getSoundMetadata, hoverPopover, inject, isKeyboardActionConfig, keyboardEventMatchesBind, normalizeActionInput, provideClientGlobalConfig, provideClientMapStreaming, provideClientModules, provideGlobalConfig, provideI18n, provideLoadMap, provideMmorpg, provideRpg, provideSaveClient, resolveKeyboardActionInput, resolveKeyboardDirectionInput, selectable, setInject, startGame, withMobile };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RpgFactoryProvider } from '@rpgjs/common';
|
|
2
2
|
import { RpgClient } from './RpgClient';
|
|
3
3
|
/**
|
|
4
4
|
* Type for client modules that can be either:
|
|
@@ -41,7 +41,7 @@ export type RpgClientModule = RpgClient | (new () => any);
|
|
|
41
41
|
* provideClientModules([MyClientModule])
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export declare function provideClientModules(modules: RpgClientModule[]):
|
|
44
|
+
export declare function provideClientModules(modules: RpgClientModule[]): RpgFactoryProvider;
|
|
45
45
|
export declare const GlobalConfigToken = "GlobalConfigToken";
|
|
46
46
|
export declare function provideGlobalConfig(config: any): {
|
|
47
47
|
provide: string;
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":[],"sources":["../src/module.ts"],"sourcesContent":["import { findModules, provideModules, registerI18nMessages } from \"@rpgjs/common\";\nimport { FactoryProvider } from \"@signe/di\";\nimport { RpgClientEngine } from \"./RpgClientEngine\";\nimport { RpgClient } from \"./RpgClient\";\nimport { inject } from \"@signe/di\";\nimport { RpgGui } from \"./Gui/Gui\";\nimport { getSoundMetadata } from \"./Sound\";\n\n/**\n * Type for client modules that can be either:\n * - An object implementing RpgClient interface\n * - A class decorated with @RpgModule decorator\n */\nexport type RpgClientModule = RpgClient | (new () => any);\n\n/**\n * Provides client modules configuration to Dependency Injection\n * \n * This function accepts an array of client modules that can be either:\n * - Objects implementing the RpgClient interface\n * - Classes decorated with the @RpgModule decorator (which will be instantiated)\n * \n * @param modules - Array of client modules (objects or classes)\n * @returns FactoryProvider configuration for DI\n * @example\n * ```ts\n * // Using an object\n * provideClientModules([\n * {\n * engine: {\n * onConnected(engine) {\n * console.log('Client connected')\n * }\n * }\n * }\n * ])\n * \n * // Using a decorated class\n * @RpgModule<RpgClient>({\n * engine: {\n * onStart(engine) {\n * console.log('Client started')\n * }\n * }\n * })\n * class MyClientModule {}\n * \n * provideClientModules([MyClientModule])\n * ```\n */\nexport function provideClientModules(modules: RpgClientModule[]): FactoryProvider {\n return provideModules(modules, \"client\", (modules, context) => {\n const mainModuleClient = findModules(context, 'Client')\n modules = [...mainModuleClient, ...modules]\n modules = modules.map((module) => {\n // If module is a class (constructor function), instantiate it\n // The RpgModule decorator adds properties to the prototype, which will be accessible via the instance\n if (typeof module === 'function') {\n const instance = new module() as any;\n // Copy all enumerable properties (including from prototype) to a plain object\n const moduleObj: any = {};\n for (const key in instance) {\n moduleObj[key] = instance[key];\n }\n module = moduleObj;\n }\n if ('client' in module) {\n module = module.client as any;\n }\n if (module.i18n) {\n registerI18nMessages(context, module.i18n, \"client-module\", 10);\n }\n if (module.spritesheets) {\n const spritesheets = [...module.spritesheets];\n module.spritesheets = {\n load: (engine: RpgClientEngine) => {\n spritesheets.forEach((spritesheet) => {\n engine.addSpriteSheet(spritesheet);\n });\n },\n };\n }\n if (module.spritesheetResolver) {\n const resolver = module.spritesheetResolver;\n module.spritesheetResolver = {\n load: (engine: RpgClientEngine) => {\n engine.setSpritesheetResolver(resolver);\n },\n };\n }\n if (module.sounds) {\n const sounds = [...module.sounds];\n module.sounds = {\n load: (engine: RpgClientEngine) => {\n sounds.forEach((sound) => {\n // Check if it's a class decorated with @Sound\n if (typeof sound === 'function' || (sound && sound.constructor && sound.constructor !== Object)) {\n const metadata = getSoundMetadata(sound);\n if (metadata) {\n // Handle single sound\n if (metadata.id && metadata.sound) {\n engine.addSound({\n id: metadata.id,\n src: metadata.sound,\n loop: metadata.loop,\n volume: metadata.volume,\n });\n }\n // Handle multiple sounds\n if (metadata.sounds) {\n Object.entries(metadata.sounds).forEach(([soundId, soundSrc]) => {\n engine.addSound({\n id: soundId,\n src: soundSrc,\n loop: metadata.loop,\n volume: metadata.volume,\n });\n });\n }\n } else {\n // Not a decorated class, treat as regular sound object\n engine.addSound(sound);\n }\n } else {\n // Regular sound object\n engine.addSound(sound);\n }\n });\n },\n };\n }\n if (module.soundResolver) {\n const resolver = module.soundResolver;\n module.soundResolver = {\n load: (engine: RpgClientEngine) => {\n engine.setSoundResolver(resolver);\n },\n };\n }\n if (module.gui) {\n const gui = [...module.gui];\n module.gui = {\n load: (engine: RpgClientEngine) => {\n const guiService = inject(engine.context, RpgGui) as RpgGui;\n gui.forEach((gui) => {\n guiService.add(gui);\n });\n },\n };\n }\n if (module.componentAnimations) {\n const componentAnimations = [...module.componentAnimations];\n module.componentAnimations = {\n load: (engine: RpgClientEngine) => {\n componentAnimations.forEach((componentAnimation) => {\n engine.addComponentAnimation(componentAnimation);\n });\n },\n };\n }\n if (module.clientVisuals) {\n const clientVisuals = { ...module.clientVisuals };\n module.clientVisuals = {\n load: (engine: RpgClientEngine) => {\n engine.registerClientVisuals(clientVisuals);\n },\n };\n }\n if (module.projectiles) {\n const projectiles = { ...module.projectiles };\n module.projectiles = {\n ...projectiles,\n load: (engine: RpgClientEngine) => {\n if (projectiles.components) {\n Object.entries(projectiles.components).forEach(([type, component]) => {\n engine.registerProjectileComponent(type, component);\n });\n }\n },\n };\n }\n if (module.interactions) {\n const interactions = module.interactions;\n module.interactions = {\n ...interactions,\n load: (engine: RpgClientEngine) => {\n if (typeof interactions === \"function\") {\n interactions(engine);\n return;\n }\n interactions.load?.(engine);\n interactions.setup?.(engine);\n if (Array.isArray(interactions.use)) {\n interactions.use.forEach(([matcher, behavior]) => {\n engine.interactions.use(matcher, behavior);\n });\n }\n },\n };\n }\n if (module.transitions) {\n const transitions = [...module.transitions];\n module.transitions = {\n load: (engine: RpgClientEngine) => {\n const guiService = inject(engine.context, RpgGui) as RpgGui;\n transitions.forEach((transition) => {\n guiService.add({\n name: transition.id,\n component: transition.component,\n data: transition.props || {}\n });\n });\n },\n };\n }\n if (module.particles) {\n const particles = [...module.particles];\n module.particles = {\n load: (engine: RpgClientEngine) => {\n particles.forEach((particle) => {\n engine.addParticle(particle);\n });\n },\n };\n }\n if (module.sprite) {\n const sprite = {...module.sprite};\n module.sprite = {\n ...sprite,\n load: (engine: RpgClientEngine) => {\n if (sprite.componentsBehind) {\n sprite.componentsBehind.forEach((component) => {\n engine.addSpriteComponentBehind(component);\n });\n }\n if (sprite.componentsInFront) {\n sprite.componentsInFront.forEach((component) => {\n engine.addSpriteComponentInFront(component);\n });\n }\n if (sprite.components) {\n Object.entries(sprite.components).forEach(([id, component]) => {\n engine.registerSpriteComponent(id, component);\n });\n }\n if (sprite.eventComponent) {\n engine.addEventComponentResolver(sprite.eventComponent);\n }\n },\n };\n }\n return module;\n });\n return modules\n });\n}\n\nexport const GlobalConfigToken = \"GlobalConfigToken\";\n\nexport function provideGlobalConfig(config: any) {\n return {\n provide: GlobalConfigToken,\n useValue: config ?? {},\n };\n}\n\nexport function provideClientGlobalConfig(config: any = {}) {\n config.keyboardControls = {\n up: 'up',\n down: 'down',\n left: 'left',\n right: 'right',\n action: 'space',\n dash: 'shift',\n escape: 'escape',\n ...(config.keyboardControls ?? {}),\n }\n return provideGlobalConfig(config)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,qBAAqB,SAA6C;CAChF,OAAO,eAAe,SAAS,WAAW,SAAS,YAAY;EAE7D,UAAU,CAAC,GADc,YAAY,SAAS,QAChC,GAAkB,GAAG,OAAO;EAC1C,UAAU,QAAQ,KAAK,WAAW;GAGhC,IAAI,OAAO,WAAW,YAAY;IAChC,MAAM,WAAW,IAAI,OAAO;IAE5B,MAAM,YAAiB,CAAC;IACxB,KAAK,MAAM,OAAO,UAChB,UAAU,OAAO,SAAS;IAE5B,SAAS;GACX;GACA,IAAI,YAAY,QACd,SAAS,OAAO;GAElB,IAAI,OAAO,MACT,qBAAqB,SAAS,OAAO,MAAM,iBAAiB,EAAE;GAEhE,IAAI,OAAO,cAAc;IACvB,MAAM,eAAe,CAAC,GAAG,OAAO,YAAY;IAC5C,OAAO,eAAe,EACpB,OAAO,WAA4B;KACjC,aAAa,SAAS,gBAAgB;MACpC,OAAO,eAAe,WAAW;KACnC,CAAC;IACH,EACF;GACF;GACA,IAAI,OAAO,qBAAqB;IAC9B,MAAM,WAAW,OAAO;IACxB,OAAO,sBAAsB,EAC3B,OAAO,WAA4B;KACjC,OAAO,uBAAuB,QAAQ;IACxC,EACF;GACF;GACA,IAAI,OAAO,QAAQ;IACjB,MAAM,SAAS,CAAC,GAAG,OAAO,MAAM;IAChC,OAAO,SAAS,EACd,OAAO,WAA4B;KACjC,OAAO,SAAS,UAAU;MAExB,IAAI,OAAO,UAAU,cAAe,SAAS,MAAM,eAAe,MAAM,gBAAgB,QAAS;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AAkB,SAAS,cAAc;OAC9C,OAAO,0BAA0B,SAAS;MAC5C,CAAC;MAEH,IAAI,OAAO,YACT,OAAO,QAAQ,OAAO,UAAU,EAAE,SAAS,CAAC,IAAI,eAAe;OAC7D,OAAO,wBAAwB,IAAI,SAAS;MAC9C,CAAC;MAEH,IAAI,OAAO,gBACT,OAAO,0BAA0B,OAAO,cAAc;KAE1D;IACF;GACF;GACA,OAAO;EACT,CAAC;EACD,OAAO;CACT,CAAC;AACH;AAEA,IAAa,oBAAoB;AAEjC,SAAgB,oBAAoB,QAAa;CAC/C,OAAO;EACL,SAAS;EACT,UAAU,UAAU,CAAC;CACvB;AACF;AAEA,SAAgB,0BAA0B,SAAc,CAAC,GAAG;CAC1D,OAAO,mBAAmB;EACxB,IAAI;EACJ,MAAM;EACN,MAAM;EACN,OAAO;EACP,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,GAAI,OAAO,oBAAoB,CAAC;CAClC;CACA,OAAO,oBAAoB,MAAM;AACnC"}
|
|
1
|
+
{"version":3,"file":"module.js","names":[],"sources":["../src/module.ts"],"sourcesContent":["import { findModules, provideModules, registerI18nMessages } from \"@rpgjs/common\";\nimport type { RpgFactoryProvider } from \"@rpgjs/common\";\nimport { RpgClientEngine } from \"./RpgClientEngine\";\nimport { RpgClient } from \"./RpgClient\";\nimport { inject } from \"@signe/di\";\nimport { RpgGui } from \"./Gui/Gui\";\nimport { getSoundMetadata } from \"./Sound\";\n\n/**\n * Type for client modules that can be either:\n * - An object implementing RpgClient interface\n * - A class decorated with @RpgModule decorator\n */\nexport type RpgClientModule = RpgClient | (new () => any);\n\n/**\n * Provides client modules configuration to Dependency Injection\n * \n * This function accepts an array of client modules that can be either:\n * - Objects implementing the RpgClient interface\n * - Classes decorated with the @RpgModule decorator (which will be instantiated)\n * \n * @param modules - Array of client modules (objects or classes)\n * @returns FactoryProvider configuration for DI\n * @example\n * ```ts\n * // Using an object\n * provideClientModules([\n * {\n * engine: {\n * onConnected(engine) {\n * console.log('Client connected')\n * }\n * }\n * }\n * ])\n * \n * // Using a decorated class\n * @RpgModule<RpgClient>({\n * engine: {\n * onStart(engine) {\n * console.log('Client started')\n * }\n * }\n * })\n * class MyClientModule {}\n * \n * provideClientModules([MyClientModule])\n * ```\n */\nexport function provideClientModules(modules: RpgClientModule[]): RpgFactoryProvider {\n return provideModules(modules, \"client\", (modules, context) => {\n const mainModuleClient = findModules(context, 'Client')\n modules = [...mainModuleClient, ...modules]\n modules = modules.map((module) => {\n // If module is a class (constructor function), instantiate it\n // The RpgModule decorator adds properties to the prototype, which will be accessible via the instance\n if (typeof module === 'function') {\n const instance = new module() as any;\n // Copy all enumerable properties (including from prototype) to a plain object\n const moduleObj: any = {};\n for (const key in instance) {\n moduleObj[key] = instance[key];\n }\n module = moduleObj;\n }\n if ('client' in module) {\n module = module.client as any;\n }\n if (module.i18n) {\n registerI18nMessages(context, module.i18n, \"client-module\", 10);\n }\n if (module.spritesheets) {\n const spritesheets = [...module.spritesheets];\n module.spritesheets = {\n load: (engine: RpgClientEngine) => {\n spritesheets.forEach((spritesheet) => {\n engine.addSpriteSheet(spritesheet);\n });\n },\n };\n }\n if (module.spritesheetResolver) {\n const resolver = module.spritesheetResolver;\n module.spritesheetResolver = {\n load: (engine: RpgClientEngine) => {\n engine.setSpritesheetResolver(resolver);\n },\n };\n }\n if (module.sounds) {\n const sounds = [...module.sounds];\n module.sounds = {\n load: (engine: RpgClientEngine) => {\n sounds.forEach((sound) => {\n // Check if it's a class decorated with @Sound\n if (typeof sound === 'function' || (sound && sound.constructor && sound.constructor !== Object)) {\n const metadata = getSoundMetadata(sound);\n if (metadata) {\n // Handle single sound\n if (metadata.id && metadata.sound) {\n engine.addSound({\n id: metadata.id,\n src: metadata.sound,\n loop: metadata.loop,\n volume: metadata.volume,\n });\n }\n // Handle multiple sounds\n if (metadata.sounds) {\n Object.entries(metadata.sounds).forEach(([soundId, soundSrc]) => {\n engine.addSound({\n id: soundId,\n src: soundSrc,\n loop: metadata.loop,\n volume: metadata.volume,\n });\n });\n }\n } else {\n // Not a decorated class, treat as regular sound object\n engine.addSound(sound);\n }\n } else {\n // Regular sound object\n engine.addSound(sound);\n }\n });\n },\n };\n }\n if (module.soundResolver) {\n const resolver = module.soundResolver;\n module.soundResolver = {\n load: (engine: RpgClientEngine) => {\n engine.setSoundResolver(resolver);\n },\n };\n }\n if (module.gui) {\n const gui = [...module.gui];\n module.gui = {\n load: (engine: RpgClientEngine) => {\n const guiService = inject(engine.context, RpgGui) as RpgGui;\n gui.forEach((gui) => {\n guiService.add(gui);\n });\n },\n };\n }\n if (module.componentAnimations) {\n const componentAnimations = [...module.componentAnimations];\n module.componentAnimations = {\n load: (engine: RpgClientEngine) => {\n componentAnimations.forEach((componentAnimation) => {\n engine.addComponentAnimation(componentAnimation);\n });\n },\n };\n }\n if (module.clientVisuals) {\n const clientVisuals = { ...module.clientVisuals };\n module.clientVisuals = {\n load: (engine: RpgClientEngine) => {\n engine.registerClientVisuals(clientVisuals);\n },\n };\n }\n if (module.projectiles) {\n const projectiles = { ...module.projectiles };\n module.projectiles = {\n ...projectiles,\n load: (engine: RpgClientEngine) => {\n if (projectiles.components) {\n Object.entries(projectiles.components).forEach(([type, component]) => {\n engine.registerProjectileComponent(type, component);\n });\n }\n },\n };\n }\n if (module.interactions) {\n const interactions = module.interactions;\n module.interactions = {\n ...interactions,\n load: (engine: RpgClientEngine) => {\n if (typeof interactions === \"function\") {\n interactions(engine);\n return;\n }\n interactions.load?.(engine);\n interactions.setup?.(engine);\n if (Array.isArray(interactions.use)) {\n interactions.use.forEach(([matcher, behavior]) => {\n engine.interactions.use(matcher, behavior);\n });\n }\n },\n };\n }\n if (module.transitions) {\n const transitions = [...module.transitions];\n module.transitions = {\n load: (engine: RpgClientEngine) => {\n const guiService = inject(engine.context, RpgGui) as RpgGui;\n transitions.forEach((transition) => {\n guiService.add({\n name: transition.id,\n component: transition.component,\n data: transition.props || {}\n });\n });\n },\n };\n }\n if (module.particles) {\n const particles = [...module.particles];\n module.particles = {\n load: (engine: RpgClientEngine) => {\n particles.forEach((particle) => {\n engine.addParticle(particle);\n });\n },\n };\n }\n if (module.sprite) {\n const sprite = {...module.sprite};\n module.sprite = {\n ...sprite,\n load: (engine: RpgClientEngine) => {\n if (sprite.componentsBehind) {\n sprite.componentsBehind.forEach((component) => {\n engine.addSpriteComponentBehind(component);\n });\n }\n if (sprite.componentsInFront) {\n sprite.componentsInFront.forEach((component) => {\n engine.addSpriteComponentInFront(component);\n });\n }\n if (sprite.components) {\n Object.entries(sprite.components).forEach(([id, component]) => {\n engine.registerSpriteComponent(id, component);\n });\n }\n if (sprite.eventComponent) {\n engine.addEventComponentResolver(sprite.eventComponent);\n }\n },\n };\n }\n return module;\n });\n return modules\n });\n}\n\nexport const GlobalConfigToken = \"GlobalConfigToken\";\n\nexport function provideGlobalConfig(config: any) {\n return {\n provide: GlobalConfigToken,\n useValue: config ?? {},\n };\n}\n\nexport function provideClientGlobalConfig(config: any = {}) {\n config.keyboardControls = {\n up: 'up',\n down: 'down',\n left: 'left',\n right: 'right',\n action: 'space',\n dash: 'shift',\n escape: 'escape',\n ...(config.keyboardControls ?? {}),\n }\n return provideGlobalConfig(config)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,qBAAqB,SAAgD;CACnF,OAAO,eAAe,SAAS,WAAW,SAAS,YAAY;EAE7D,UAAU,CAAC,GADc,YAAY,SAAS,QAChC,GAAkB,GAAG,OAAO;EAC1C,UAAU,QAAQ,KAAK,WAAW;GAGhC,IAAI,OAAO,WAAW,YAAY;IAChC,MAAM,WAAW,IAAI,OAAO;IAE5B,MAAM,YAAiB,CAAC;IACxB,KAAK,MAAM,OAAO,UAChB,UAAU,OAAO,SAAS;IAE5B,SAAS;GACX;GACA,IAAI,YAAY,QACd,SAAS,OAAO;GAElB,IAAI,OAAO,MACT,qBAAqB,SAAS,OAAO,MAAM,iBAAiB,EAAE;GAEhE,IAA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isComputed(value) {
|
|
|
234
234
|
return isSignal(value) && !!value.dependencies;
|
|
235
235
|
}
|
|
236
236
|
//#endregion
|
|
237
|
-
export { isArraySubject, isComputed, isObjectSubject, isSignal, signal };
|
|
237
|
+
export { ArraySubject, ObjectSubject, isArraySubject, isComputed, isObjectSubject, isSignal, signal };
|
|
238
238
|
|
|
239
239
|
//# sourceMappingURL=index.js.map
|
package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["BehaviorSubject2","BehaviorSubject3"],"sources":["../../../../../../../../../../node_modules/.pnpm/@signe+reactive@3.1.0/node_modules/@signe/reactive/dist/index.js"],"sourcesContent":["// src/ArraySubject.ts\nimport { BehaviorSubject } from \"rxjs\";\nvar ArraySubject = class extends BehaviorSubject {\n constructor(items = []) {\n super({ type: \"init\", items });\n this._items = [];\n this.createProxy(items);\n }\n createProxy(items) {\n this._items = new Proxy(items, {\n get: (target, prop, receiver) => {\n const origMethod = target[prop];\n if (typeof origMethod === \"function\") {\n return (...args) => {\n let changeType = \"update\";\n let index = void 0;\n let isMutateFn = false;\n let itemsToEmit = [];\n let changeSplice = true;\n switch (prop) {\n case \"push\":\n index = target.length;\n changeType = \"add\";\n isMutateFn = true;\n break;\n case \"pop\":\n index = target.length - 1;\n changeType = \"remove\";\n isMutateFn = true;\n break;\n case \"unshift\":\n index = 0;\n changeType = \"add\";\n isMutateFn = true;\n break;\n case \"shift\":\n index = 0;\n changeType = \"remove\";\n isMutateFn = true;\n break;\n case \"splice\":\n index = args[0];\n const deleteCount = args[1];\n const newItems = args.slice(2);\n itemsToEmit = newItems;\n if (deleteCount > 0 && newItems.length === 0) {\n changeType = \"remove\";\n } else if (deleteCount === 0 && newItems.length > 0) {\n changeType = \"add\";\n } else if (deleteCount === 0 && newItems.length === 0) {\n changeSplice = false;\n } else {\n changeType = \"update\";\n }\n isMutateFn = true;\n break;\n }\n const result = origMethod.apply(target, args);\n if (isMutateFn && changeSplice) {\n if (prop === \"splice\") {\n this.next({ type: changeType, index, items: itemsToEmit });\n } else {\n this.next({ type: changeType, index, items: args });\n }\n }\n return result;\n };\n }\n return Reflect.get(target, prop, receiver);\n },\n set: (target, prop, value) => {\n const index = !isNaN(Number(prop)) ? Number(prop) : void 0;\n target[prop] = value;\n this.next({ type: \"update\", index, items: [value] });\n return true;\n }\n });\n }\n get items() {\n return this._items;\n }\n set items(newItems) {\n this.createProxy(newItems);\n this.next({ type: \"reset\", items: newItems });\n }\n};\nvar isArraySubject = (value) => {\n return \"_items\" in value;\n};\n\n// src/ObjectSubject.ts\nimport { BehaviorSubject as BehaviorSubject2 } from \"rxjs\";\nvar ObjectSubject = class extends BehaviorSubject2 {\n constructor(obj = {}) {\n super({ type: \"init\", value: obj });\n this.createProxy(obj);\n }\n createProxy(obj) {\n this._obj = new Proxy(obj, {\n get: (target, prop, receiver) => {\n return Reflect.get(target, prop, receiver);\n },\n set: (target, prop, value, receiver) => {\n const key = prop;\n const changeType = key in target ? \"update\" : \"add\";\n target[key] = value;\n this.next({ type: changeType, key, value });\n return true;\n },\n deleteProperty: (target, prop) => {\n const key = prop;\n if (key in target) {\n const value = target[key];\n delete target[key];\n this.next({ type: \"remove\", key, value });\n return true;\n }\n return false;\n }\n });\n }\n get obj() {\n return this._obj;\n }\n set obj(newObj) {\n this.createProxy(newObj);\n this.next({ type: \"reset\", value: newObj });\n }\n};\nvar isObjectSubject = (value) => {\n return \"_obj\" in value;\n};\n\n// src/signal.ts\nimport { BehaviorSubject as BehaviorSubject3, combineLatest, filter, finalize, map, Observable } from \"rxjs\";\nvar getGlobalReactiveStore = () => {\n const globalKey = \"__REACTIVE_STORE__\";\n if (typeof globalThis !== \"undefined\") {\n if (!globalThis[globalKey]) {\n globalThis[globalKey] = {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n return globalThis[globalKey];\n }\n let globalObj;\n if (typeof window !== \"undefined\") {\n globalObj = window;\n } else if (typeof process !== \"undefined\" && process.versions && process.versions.node) {\n globalObj = Function(\"return this\")();\n } else if (typeof self !== \"undefined\") {\n globalObj = self;\n } else {\n console.warn(\"Unable to find global object, using local instance\");\n return {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n return globalObj[globalKey];\n};\nvar reactiveStore = getGlobalReactiveStore();\nvar trackDependency = (signal2) => {\n if (reactiveStore.currentDependencyTracker) {\n reactiveStore.currentDependencyTracker(signal2);\n }\n};\nfunction signal(defaultValue, options) {\n let subject;\n if (Array.isArray(defaultValue)) {\n subject = new ArraySubject(defaultValue);\n } else if (typeof defaultValue === \"object\" && defaultValue !== null) {\n subject = new ObjectSubject(defaultValue);\n } else {\n subject = new BehaviorSubject3(defaultValue);\n }\n const getValue = () => {\n if (subject instanceof ArraySubject) {\n return subject.items;\n } else if (subject instanceof ObjectSubject) {\n return subject.obj;\n }\n return subject.value;\n };\n const fn = function() {\n trackDependency(fn);\n return getValue();\n };\n fn.set = (value) => {\n const currentValue = getValue();\n let shouldEmit = true;\n if (options?.equal) {\n shouldEmit = !options.equal(currentValue, value);\n } else {\n shouldEmit = currentValue !== value;\n }\n if (shouldEmit) {\n if (subject instanceof ArraySubject) {\n subject.items = value;\n } else if (subject instanceof ObjectSubject) {\n subject.obj = value;\n } else {\n subject.next(value);\n }\n }\n };\n fn._isFrozen = false;\n fn.freeze = () => {\n fn._isFrozen = true;\n };\n fn.unfreeze = () => {\n fn._isFrozen = false;\n if (subject instanceof ArraySubject) {\n subject.next({ type: \"init\", items: subject.items });\n } else if (subject instanceof ObjectSubject) {\n subject.next({ type: \"init\", value: subject.obj });\n } else {\n subject.next(subject.value);\n }\n };\n fn.mutate = (mutateFn) => {\n const value = getValue();\n mutateFn(value);\n };\n fn.update = (updateFn) => {\n const updatedValue = updateFn(getValue());\n fn.set(updatedValue);\n };\n fn.observable = subject.asObservable().pipe(\n filter(() => !fn._isFrozen)\n );\n fn._subject = subject;\n return fn;\n}\nfunction isSignal(value) {\n return !!(value && value.observable);\n}\nfunction isComputed(value) {\n return isSignal(value) && !!value.dependencies;\n}\nfunction computed(computeFunction, disposableFn) {\n const dependencies = /* @__PURE__ */ new Set();\n let init = true;\n let lastComputedValue;\n const previousTracker = reactiveStore.currentDependencyTracker;\n reactiveStore.currentDependencyTracker = (signal2) => {\n dependencies.add(signal2);\n };\n lastComputedValue = computeFunction();\n if (computeFunction[\"isEffect\"]) {\n disposableFn = lastComputedValue;\n }\n reactiveStore.currentDependencyTracker = previousTracker;\n const observables = [...dependencies].map((dep) => {\n if (isComputed(dep) && \"dependencies\" in dep) {\n const computedDep = dep;\n if (computedDep.dependencies.size === 0) {\n return new BehaviorSubject3(computedDep()).asObservable();\n }\n }\n return dep.observable;\n });\n const computedObservable = combineLatest(observables).pipe(\n filter(() => !init),\n map(() => computeFunction()),\n finalize(() => disposableFn?.())\n );\n const fn = function() {\n trackDependency(fn);\n return lastComputedValue;\n };\n fn.observable = computedObservable;\n fn.subscription = computedObservable.subscribe((value) => {\n lastComputedValue = value;\n });\n fn.dependencies = dependencies;\n reactiveStore.currentSubscriptionsTracker?.(fn.subscription);\n init = false;\n return fn;\n}\nfunction linkedSignal(computationOrOptions, simpleOptions) {\n const dependencies = /* @__PURE__ */ new Set();\n let init = true;\n let lastComputedValue;\n let computeFunction;\n let sourceSignal;\n let computationFn;\n let equalFn;\n let previousValue;\n let isOverridden = false;\n let overriddenValue;\n let lastComputedBeforeOverride;\n let depVersion = 0;\n let overrideDepVersion = null;\n if (typeof computationOrOptions === \"function\") {\n computeFunction = computationOrOptions;\n equalFn = simpleOptions?.equal;\n } else {\n const options = computationOrOptions;\n sourceSignal = options.source;\n computationFn = options.computation;\n equalFn = options.equal;\n if (typeof sourceSignal === \"function\" && !isSignal(sourceSignal)) {\n const sourceFn = sourceSignal;\n computeFunction = () => {\n const sourceValue = sourceFn();\n if (computationFn.length > 1) {\n const result = computationFn(sourceValue, previousValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n } else {\n const result = computationFn(sourceValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n }\n };\n } else {\n const source = typeof sourceSignal === \"function\" ? sourceSignal : sourceSignal;\n computeFunction = () => {\n const sourceValue = source();\n if (computationFn.length > 1) {\n const result = computationFn(sourceValue, previousValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n } else {\n const result = computationFn(sourceValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n }\n };\n }\n }\n const previousTracker = reactiveStore.currentDependencyTracker;\n reactiveStore.currentDependencyTracker = (signal2) => {\n dependencies.add(signal2);\n };\n if (sourceSignal && typeof sourceSignal === \"function\" && !isSignal(sourceSignal)) {\n lastComputedValue = computeFunction();\n lastComputedBeforeOverride = lastComputedValue;\n } else if (sourceSignal && isSignal(sourceSignal)) {\n dependencies.add(sourceSignal);\n lastComputedValue = computeFunction();\n lastComputedBeforeOverride = lastComputedValue;\n } else {\n lastComputedValue = computeFunction();\n lastComputedBeforeOverride = lastComputedValue;\n }\n reactiveStore.currentDependencyTracker = previousTracker;\n const subject = new BehaviorSubject3(lastComputedValue);\n const observables = [...dependencies].map((dep) => {\n if (isComputed(dep) && \"dependencies\" in dep) {\n const computedDep = dep;\n if (computedDep.dependencies.size === 0) {\n return new BehaviorSubject3(computedDep()).asObservable();\n }\n }\n return dep.observable;\n });\n let linkedObservable;\n if (observables.length > 0) {\n linkedObservable = combineLatest(observables).pipe(\n filter(() => !init),\n map(() => {\n const computed2 = computeFunction();\n if (equalFn) {\n if (!equalFn(lastComputedValue, computed2)) {\n lastComputedValue = computed2;\n isOverridden = false;\n }\n } else {\n if (lastComputedValue !== computed2) {\n lastComputedValue = computed2;\n isOverridden = false;\n }\n }\n return lastComputedValue;\n })\n );\n } else {\n linkedObservable = subject.asObservable().pipe(\n filter(() => !init)\n );\n }\n const fn = function() {\n trackDependency(fn);\n if (isOverridden && dependencies.size > 0) {\n if (overrideDepVersion !== depVersion) {\n const computed2 = computeFunction();\n isOverridden = false;\n overriddenValue = void 0;\n lastComputedValue = computed2;\n lastComputedBeforeOverride = computed2;\n overrideDepVersion = null;\n return computed2;\n }\n return overriddenValue;\n }\n if (isOverridden) {\n return overriddenValue;\n }\n if (dependencies.size === 0) {\n const computed2 = computeFunction();\n lastComputedValue = computed2;\n lastComputedBeforeOverride = computed2;\n }\n return lastComputedValue;\n };\n fn.observable = new Observable((observer) => {\n const depSubscription = linkedObservable.subscribe((value) => {\n if (dependencies.size > 0) {\n depVersion++;\n isOverridden = false;\n overrideDepVersion = null;\n lastComputedValue = value;\n lastComputedBeforeOverride = value;\n } else {\n lastComputedValue = value;\n lastComputedBeforeOverride = value;\n }\n observer.next(value);\n });\n let subjectSubscription;\n if (dependencies.size === 0) {\n subjectSubscription = subject.pipe(\n filter(() => !init)\n ).subscribe((value) => {\n observer.next(value);\n });\n }\n observer.next(lastComputedValue);\n return () => {\n depSubscription.unsubscribe();\n if (subjectSubscription) {\n subjectSubscription.unsubscribe();\n }\n };\n });\n fn.subscription = fn.observable.subscribe(() => {\n });\n fn.dependencies = dependencies;\n fn._subject = subject;\n fn.set = (value) => {\n if (!isOverridden) {\n lastComputedBeforeOverride = lastComputedValue;\n overrideDepVersion = depVersion;\n if (computationFn && sourceSignal) {\n const sourceValue = untracked(() => {\n if (typeof sourceSignal === \"function\") {\n const source = sourceSignal;\n return isSignal(source) ? source() : sourceSignal();\n }\n return sourceSignal();\n });\n previousValue = {\n source: sourceValue,\n value\n };\n }\n }\n isOverridden = true;\n overriddenValue = value;\n lastComputedValue = value;\n subject.next(value);\n };\n reactiveStore.currentSubscriptionsTracker?.(fn.subscription);\n init = false;\n return fn;\n}\nfunction untracked(fn) {\n const prevDepTracker = reactiveStore.currentDependencyTracker;\n const prevSubTracker = reactiveStore.currentSubscriptionsTracker;\n reactiveStore.currentDependencyTracker = null;\n reactiveStore.currentSubscriptionsTracker = null;\n try {\n return fn();\n } finally {\n reactiveStore.currentDependencyTracker = prevDepTracker;\n reactiveStore.currentSubscriptionsTracker = prevSubTracker;\n }\n}\n\n// src/effect.ts\nfunction effect(fn) {\n fn[\"isEffect\"] = true;\n return computed(fn);\n}\nexport {\n ArraySubject,\n ObjectSubject,\n computed,\n effect,\n isArraySubject,\n isComputed,\n isObjectSubject,\n isSignal,\n linkedSignal,\n signal,\n untracked\n};\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0],"mappings":";;AAEA,IAAI,eAAe,cAAc,gBAAgB;CAC/C,YAAY,QAAQ,CAAC,GAAG;EACtB,MAAM;GAAE,MAAM;GAAQ;EAAM,CAAC;EAC7B,KAAK,SAAS,CAAC;EACf,KAAK,YAAY,KAAK;CACxB;CACA,YAAY,OAAO;EACjB,KAAK,SAAS,IAAI,MAAM,OAAO;GAC7B,MAAM,QAAQ,MAAM,aAAa;IAC/B,MAAM,aAAa,OAAO;IAC1B,IAAI,OAAO,eAAe,YACxB,QAAQ,GAAG,SAAS;KAClB,IAAI,aAAa;KACjB,IAAI,QAAQ,KAAK;KACjB,IAAI,aAAa;KACjB,IAAI,cAAc,CAAC;KACnB,IAAI,eAAe;KACnB,QAAQ,MAAR;MACE,KAAK;OACH,QAAQ,OAAO;OACf,aAAa;OACb,aAAa;OACb;MACF,KAAK;OACH,QAAQ,OAAO,SAAS;OACxB,aAAa;OACb,aAAa;OACb;MACF,KAAK;OACH,QAAQ;OACR,aAAa;OACb,aAAa;OACb;MACF,KAAK;OACH,QAAQ;OACR,aAAa;OACb,aAAa;OACb;MACF,KAAK;OACH,QAAQ,KAAK;OACb,MAAM,cAAc,KAAK;OACzB,MAAM,WAAW,KAAK,MAAM,CAAC;OAC7B,cAAc;OACd,IAAI,cAAc,KAAK,SAAS,WAAW,GACzC,aAAa;YACR,IAAI,gBAAgB,KAAK,SAAS,SAAS,GAChD,aAAa;YACR,IAAI,g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names":["BehaviorSubject2","BehaviorSubject3"],"sources":["../../../../../../../../../../node_modules/.pnpm/@signe+reactive@3.1.0/node_modules/@signe/reactive/dist/index.js"],"sourcesContent":["// src/ArraySubject.ts\nimport { BehaviorSubject } from \"rxjs\";\nvar ArraySubject = class extends BehaviorSubject {\n constructor(items = []) {\n super({ type: \"init\", items });\n this._items = [];\n this.createProxy(items);\n }\n createProxy(items) {\n this._items = new Proxy(items, {\n get: (target, prop, receiver) => {\n const origMethod = target[prop];\n if (typeof origMethod === \"function\") {\n return (...args) => {\n let changeType = \"update\";\n let index = void 0;\n let isMutateFn = false;\n let itemsToEmit = [];\n let changeSplice = true;\n switch (prop) {\n case \"push\":\n index = target.length;\n changeType = \"add\";\n isMutateFn = true;\n break;\n case \"pop\":\n index = target.length - 1;\n changeType = \"remove\";\n isMutateFn = true;\n break;\n case \"unshift\":\n index = 0;\n changeType = \"add\";\n isMutateFn = true;\n break;\n case \"shift\":\n index = 0;\n changeType = \"remove\";\n isMutateFn = true;\n break;\n case \"splice\":\n index = args[0];\n const deleteCount = args[1];\n const newItems = args.slice(2);\n itemsToEmit = newItems;\n if (deleteCount > 0 && newItems.length === 0) {\n changeType = \"remove\";\n } else if (deleteCount === 0 && newItems.length > 0) {\n changeType = \"add\";\n } else if (deleteCount === 0 && newItems.length === 0) {\n changeSplice = false;\n } else {\n changeType = \"update\";\n }\n isMutateFn = true;\n break;\n }\n const result = origMethod.apply(target, args);\n if (isMutateFn && changeSplice) {\n if (prop === \"splice\") {\n this.next({ type: changeType, index, items: itemsToEmit });\n } else {\n this.next({ type: changeType, index, items: args });\n }\n }\n return result;\n };\n }\n return Reflect.get(target, prop, receiver);\n },\n set: (target, prop, value) => {\n const index = !isNaN(Number(prop)) ? Number(prop) : void 0;\n target[prop] = value;\n this.next({ type: \"update\", index, items: [value] });\n return true;\n }\n });\n }\n get items() {\n return this._items;\n }\n set items(newItems) {\n this.createProxy(newItems);\n this.next({ type: \"reset\", items: newItems });\n }\n};\nvar isArraySubject = (value) => {\n return \"_items\" in value;\n};\n\n// src/ObjectSubject.ts\nimport { BehaviorSubject as BehaviorSubject2 } from \"rxjs\";\nvar ObjectSubject = class extends BehaviorSubject2 {\n constructor(obj = {}) {\n super({ type: \"init\", value: obj });\n this.createProxy(obj);\n }\n createProxy(obj) {\n this._obj = new Proxy(obj, {\n get: (target, prop, receiver) => {\n return Reflect.get(target, prop, receiver);\n },\n set: (target, prop, value, receiver) => {\n const key = prop;\n const changeType = key in target ? \"update\" : \"add\";\n target[key] = value;\n this.next({ type: changeType, key, value });\n return true;\n },\n deleteProperty: (target, prop) => {\n const key = prop;\n if (key in target) {\n const value = target[key];\n delete target[key];\n this.next({ type: \"remove\", key, value });\n return true;\n }\n return false;\n }\n });\n }\n get obj() {\n return this._obj;\n }\n set obj(newObj) {\n this.createProxy(newObj);\n this.next({ type: \"reset\", value: newObj });\n }\n};\nvar isObjectSubject = (value) => {\n return \"_obj\" in value;\n};\n\n// src/signal.ts\nimport { BehaviorSubject as BehaviorSubject3, combineLatest, filter, finalize, map, Observable } from \"rxjs\";\nvar getGlobalReactiveStore = () => {\n const globalKey = \"__REACTIVE_STORE__\";\n if (typeof globalThis !== \"undefined\") {\n if (!globalThis[globalKey]) {\n globalThis[globalKey] = {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n return globalThis[globalKey];\n }\n let globalObj;\n if (typeof window !== \"undefined\") {\n globalObj = window;\n } else if (typeof process !== \"undefined\" && process.versions && process.versions.node) {\n globalObj = Function(\"return this\")();\n } else if (typeof self !== \"undefined\") {\n globalObj = self;\n } else {\n console.warn(\"Unable to find global object, using local instance\");\n return {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = {\n currentDependencyTracker: null,\n currentSubscriptionsTracker: null\n };\n }\n return globalObj[globalKey];\n};\nvar reactiveStore = getGlobalReactiveStore();\nvar trackDependency = (signal2) => {\n if (reactiveStore.currentDependencyTracker) {\n reactiveStore.currentDependencyTracker(signal2);\n }\n};\nfunction signal(defaultValue, options) {\n let subject;\n if (Array.isArray(defaultValue)) {\n subject = new ArraySubject(defaultValue);\n } else if (typeof defaultValue === \"object\" && defaultValue !== null) {\n subject = new ObjectSubject(defaultValue);\n } else {\n subject = new BehaviorSubject3(defaultValue);\n }\n const getValue = () => {\n if (subject instanceof ArraySubject) {\n return subject.items;\n } else if (subject instanceof ObjectSubject) {\n return subject.obj;\n }\n return subject.value;\n };\n const fn = function() {\n trackDependency(fn);\n return getValue();\n };\n fn.set = (value) => {\n const currentValue = getValue();\n let shouldEmit = true;\n if (options?.equal) {\n shouldEmit = !options.equal(currentValue, value);\n } else {\n shouldEmit = currentValue !== value;\n }\n if (shouldEmit) {\n if (subject instanceof ArraySubject) {\n subject.items = value;\n } else if (subject instanceof ObjectSubject) {\n subject.obj = value;\n } else {\n subject.next(value);\n }\n }\n };\n fn._isFrozen = false;\n fn.freeze = () => {\n fn._isFrozen = true;\n };\n fn.unfreeze = () => {\n fn._isFrozen = false;\n if (subject instanceof ArraySubject) {\n subject.next({ type: \"init\", items: subject.items });\n } else if (subject instanceof ObjectSubject) {\n subject.next({ type: \"init\", value: subject.obj });\n } else {\n subject.next(subject.value);\n }\n };\n fn.mutate = (mutateFn) => {\n const value = getValue();\n mutateFn(value);\n };\n fn.update = (updateFn) => {\n const updatedValue = updateFn(getValue());\n fn.set(updatedValue);\n };\n fn.observable = subject.asObservable().pipe(\n filter(() => !fn._isFrozen)\n );\n fn._subject = subject;\n return fn;\n}\nfunction isSignal(value) {\n return !!(value && value.observable);\n}\nfunction isComputed(value) {\n return isSignal(value) && !!value.dependencies;\n}\nfunction computed(computeFunction, disposableFn) {\n const dependencies = /* @__PURE__ */ new Set();\n let init = true;\n let lastComputedValue;\n const previousTracker = reactiveStore.currentDependencyTracker;\n reactiveStore.currentDependencyTracker = (signal2) => {\n dependencies.add(signal2);\n };\n lastComputedValue = computeFunction();\n if (computeFunction[\"isEffect\"]) {\n disposableFn = lastComputedValue;\n }\n reactiveStore.currentDependencyTracker = previousTracker;\n const observables = [...dependencies].map((dep) => {\n if (isComputed(dep) && \"dependencies\" in dep) {\n const computedDep = dep;\n if (computedDep.dependencies.size === 0) {\n return new BehaviorSubject3(computedDep()).asObservable();\n }\n }\n return dep.observable;\n });\n const computedObservable = combineLatest(observables).pipe(\n filter(() => !init),\n map(() => computeFunction()),\n finalize(() => disposableFn?.())\n );\n const fn = function() {\n trackDependency(fn);\n return lastComputedValue;\n };\n fn.observable = computedObservable;\n fn.subscription = computedObservable.subscribe((value) => {\n lastComputedValue = value;\n });\n fn.dependencies = dependencies;\n reactiveStore.currentSubscriptionsTracker?.(fn.subscription);\n init = false;\n return fn;\n}\nfunction linkedSignal(computationOrOptions, simpleOptions) {\n const dependencies = /* @__PURE__ */ new Set();\n let init = true;\n let lastComputedValue;\n let computeFunction;\n let sourceSignal;\n let computationFn;\n let equalFn;\n let previousValue;\n let isOverridden = false;\n let overriddenValue;\n let lastComputedBeforeOverride;\n let depVersion = 0;\n let overrideDepVersion = null;\n if (typeof computationOrOptions === \"function\") {\n computeFunction = computationOrOptions;\n equalFn = simpleOptions?.equal;\n } else {\n const options = computationOrOptions;\n sourceSignal = options.source;\n computationFn = options.computation;\n equalFn = options.equal;\n if (typeof sourceSignal === \"function\" && !isSignal(sourceSignal)) {\n const sourceFn = sourceSignal;\n computeFunction = () => {\n const sourceValue = sourceFn();\n if (computationFn.length > 1) {\n const result = computationFn(sourceValue, previousValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n } else {\n const result = computationFn(sourceValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n }\n };\n } else {\n const source = typeof sourceSignal === \"function\" ? sourceSignal : sourceSignal;\n computeFunction = () => {\n const sourceValue = source();\n if (computationFn.length > 1) {\n const result = computationFn(sourceValue, previousValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n } else {\n const result = computationFn(sourceValue);\n previousValue = {\n source: sourceValue,\n value: result\n };\n return result;\n }\n };\n }\n }\n const previousTracker = reactiveStore.currentDependencyTracker;\n reactiveStore.currentDependencyTracker = (signal2) => {\n dependencies.add(signal2);\n };\n if (sourceSignal && typeof sourceSignal === \"function\" && !isSignal(sourceSignal)) {\n lastComputedValue = computeFunction();\n lastComputedBeforeOverride = lastComputedValue;\n } else if (sourceSignal && isSignal(sourceSignal)) {\n dependencies.add(sourceSignal);\n lastComputedValue = computeFunction();\n lastComputedBeforeOverride = lastComputedValue;\n } else {\n lastComputedValue = computeFunction();\n lastComputedBeforeOverride = lastComputedValue;\n }\n reactiveStore.currentDependencyTracker = previousTracker;\n const subject = new BehaviorSubject3(lastComputedValue);\n const observables = [...dependencies].map((dep) => {\n if (isComputed(dep) && \"dependencies\" in dep) {\n const computedDep = dep;\n if (computedDep.dependencies.size === 0) {\n return new BehaviorSubject3(computedDep()).asObservable();\n }\n }\n return dep.observable;\n });\n let linkedObservable;\n if (observables.length > 0) {\n linkedObservable = combineLatest(observables).pipe(\n filter(() => !init),\n map(() => {\n const computed2 = computeFunction();\n if (equalFn) {\n if (!equalFn(lastComputedValue, computed2)) {\n lastComputedValue = computed2;\n isOverridden = false;\n }\n } else {\n if (lastComputedValue !== computed2) {\n lastComputedValue = computed2;\n isOverridden = false;\n }\n }\n return lastComputedValue;\n })\n );\n } else {\n linkedObservable = subject.asObservable().pipe(\n filter(() => !init)\n );\n }\n const fn = function() {\n trackDependency(fn);\n if (isOverridden && dependencies.size > 0) {\n if (overrideDepVersion !== depVersion) {\n const computed2 = computeFunction();\n isOverridden = false;\n overriddenValue = void 0;\n lastComputedValue = computed2;\n lastComputedBeforeOverride = computed2;\n overrideDepVersion = null;\n return computed2;\n }\n return overriddenValue;\n }\n if (isOverridden) {\n return overriddenValue;\n }\n if (dependencies.size === 0) {\n const computed2 = computeFunction();\n lastComputedValue = computed2;\n lastComputedBeforeOverride = computed2;\n }\n return lastComputedValue;\n };\n fn.observable = new Observable((observer) => {\n const depSubscription = linkedObservable.subscribe((value) => {\n if (dependencies.size > 0) {\n depVersion++;\n isOverridden = false;\n overrideDepVersion = null;\n lastComputedValue = value;\n lastComputedBeforeOverride = value;\n } else {\n lastComputedValue = value;\n lastComputedBeforeOverride = value;\n }\n observer.next(value);\n });\n let subjectSubscription;\n if (dependencies.size === 0) {\n subjectSubscription = subject.pipe(\n filter(() => !init)\n ).subscribe((value) => {\n observer.next(value);\n });\n }\n observer.next(lastComputedValue);\n return () => {\n depSubscription.unsubscribe();\n if (subjectSubscription) {\n subjectSubscription.unsubscribe();\n }\n };\n });\n fn.subscription = fn.observable.subscribe(() => {\n });\n fn.dependencies = dependencies;\n fn._subject = subject;\n fn.set = (value) => {\n if (!isOverridden) {\n lastComputedBeforeOverride = lastComputedValue;\n overrideDepVersion = depVersion;\n if (computationFn && sourceSignal) {\n const sourceValue = untracked(() => {\n if (typeof sourceSignal === \"function\") {\n const source = sourceSignal;\n return isSignal(source) ? source() : sourceSignal();\n }\n return sourceSignal();\n });\n previousValue = {\n source: sourceValue,\n value\n };\n }\n }\n isOverridden = true;\n overriddenValue = value;\n lastComputedValue = value;\n subject.next(value);\n };\n reactiveStore.currentSubscriptionsTracker?.(fn.subscription);\n init = false;\n return fn;\n}\nfunction untracked(fn) {\n const prevDepTracker = reactiveStore.currentDependencyTracker;\n const prevSubTracker = reactiveStore.currentSubscriptionsTracker;\n reactiveStore.currentDependencyTracker = null;\n reactiveStore.currentSubscriptionsTracker = null;\n try {\n return fn();\n } finally {\n reactiveStore.currentDependencyTracker = prevDepTracker;\n reactiveStore.currentSubscriptionsTracker = prevSubTracker;\n }\n}\n\n// src/effect.ts\nfunction effect(fn) {\n fn[\"isEffect\"] = true;\n return computed(fn);\n}\nexport {\n ArraySubject,\n ObjectSubject,\n computed,\n effect,\n isArraySubject,\n isComputed,\n isObjectSubject,\n isSignal,\n linkedSignal,\n signal,\n untracked\n};\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0],"mappings":";;AAE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K;OAE/C,aAAa,iBAAiB;EAEhC,IAAI,YACF,IAAI,mBAAmB,cACrB,QAAQ,QAAQ;OACX,IAAI,mBAAmB,eAC5B,QAAQ,MAAM;OAEd,QAAQ,KAAK,KAAK;CAGxB;CACA,GAAG,YAAY;CACf,GAAG,eAAe;EAChB,GAAG,YAAY;CACjB;CACA,GAAG,iBAAiB;EAClB,GAAG,YAAY;EACf,IAAI,mBAAmB,cACrB,QAAQ,KAAK;GAAE,MAAM;GAAQ,OAAO,QAAQ;EAAM,CAAC;OAC9C,IAAI,mBAAmB,eAC5B,QAAQ,KAAK;GAAE,MAAM;GAAQ,OAAO,QAAQ;EAAI,CAAC;OAEjD,QAAQ,KAAK,QAAQ,KAAK;CAE9B;CACA,GAAG,UAAU,aAAa;EAExB,SADc,SACD,CAAC;CAChB;CACA,GAAG,UAAU,aAAa;EACxB,MAAM,eAAe,SAAS,SAAS,CAAC;EACxC,GAAG,IAAI,YAAY;CACrB;CACA,GAAG,aAAa,QAAQ,aAAa,CAAC,CAAC,KACrC,aAAa,CAAC,GAAG,SAAS,CAC5B;CACA,GAAG,WAAW;CACd,OAAO;AACT;AACA,SAAS,SAAS,OAAO;CACvB,OAAO,CAAC,EAAE,SAAS,MAAM;AAC3B;AACA,SAAS,WAAW,OAAO;CACzB,OAAO,SAAS,KAAK,KAAK,CAAC,CAAC,MAAM;AACpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { signal } from "../../../../../@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js";
|
|
2
2
|
import { id, persist, sync } from "../../../../../@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js";
|
|
3
3
|
import { __decorateClass } from "./chunk-EUXUH3YW.js";
|
|
4
|
-
import { booleanType, enumType, numberType, objectType, stringType } from "../../../../../zod@3.25.76/node_modules/zod/v3/types.js";
|
|
4
|
+
import { boolean as booleanType, enum as enumType, number as numberType, object as objectType, string as stringType } from "../../../../../zod@3.25.76/node_modules/zod/v3/types.js";
|
|
5
5
|
import zod_default from "../../../../../zod@3.25.76/node_modules/zod/index.js";
|
|
6
6
|
//#region ../../node_modules/.pnpm/@signe+room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js
|
|
7
7
|
function Request2(options, bodyValidation) {
|
|
@@ -693,6 +693,6 @@ WorldRoom = __decorateClass([Room({
|
|
|
693
693
|
throttleSync: 500
|
|
694
694
|
})], WorldRoom);
|
|
695
695
|
//#endregion
|
|
696
|
-
export { ClientIo, ServerIo };
|
|
696
|
+
export { ClientIo, Guard, MockConnection, Request2 as Request, Room, ServerIo, WorldRoom, request };
|
|
697
697
|
|
|
698
698
|
//# sourceMappingURL=index.js.map
|