@kvyverse/world-runtime 0.6.2 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -2
- package/README.md +2 -2
- package/dist/{BallCollider-DdxrnexK.js → BallCollider-3L5vOrcL.js} +3 -3
- package/dist/{CapsuleCollider-XlGZqg_O.js → CapsuleCollider-CBTsR-Ys.js} +3 -3
- package/dist/{ChatModule-DzNY_v-3.js → ChatModule-BFNVVLA8.js} +65 -40
- package/dist/{Collider-ElnvKET2.js → Collider-CPUCG3RA.js} +2 -2
- package/dist/{ConeCollider-CQfGphDa.js → ConeCollider-C3XU3Y9X.js} +3 -3
- package/dist/{ConvexMeshCollider-0Q2u7QAL.js → ConvexMeshCollider-DzNV4HTO.js} +2 -2
- package/dist/{CuboidCollider-Cm7kKRMA.js → CuboidCollider-Dp1DZoFM.js} +2 -2
- package/dist/{CylinderCollider-P2oZeEyb.js → CylinderCollider-C0h_nhB5.js} +3 -3
- package/dist/{FpsCameraController-CuYDbMHJ.js → FpsCameraController-2GNWJM5D.js} +1 -1
- package/dist/{MeshInstansing-CSd1gjpu.js → MeshInstansing-Bxij0Yc9.js} +1 -1
- package/dist/{PointerLockCameraControls-Cq0m2NLS.js → PointerLockCameraControls-DIK3cVmo.js} +1 -1
- package/dist/{RapierDebugRenderer-BSsFENi2.js → RapierDebugRenderer-BQy_m-3C.js} +1 -1
- package/dist/{RapierFpsPlayerController-By_mnB5m.js → RapierFpsPlayerController-DthD8dw9.js} +1 -1
- package/dist/{RapierPhysics-C22OXUaE.js → RapierPhysics-yrsRPFS3.js} +3 -3
- package/dist/{Rigidbody-BHRxJKXd.js → Rigidbody-DLhN8ddv.js} +1 -1
- package/dist/{ScalingToFro-CmXQHfR5.js → ScalingToFro-BD-E5-uR.js} +1 -1
- package/dist/{SightInteractableArea-C7xBqoQo.js → SightInteractableArea-BK8IXNIl.js} +7 -7
- package/dist/{SimpleWASDMovement-BYu0AFeG.js → SimpleWASDMovement-C2m53YYH.js} +1 -1
- package/dist/{Spinning-DDhlLF3g.js → Spinning-sgUhHld8.js} +1 -1
- package/dist/{StartAnimation-BbY1HgSj.js → StartAnimation-B9eomOS2.js} +1 -1
- package/dist/{TrimeshCollider-CGirnNOf.js → TrimeshCollider-7dIs_xtZ.js} +1 -1
- package/dist/addons/AddonsRuntime.d.ts +3 -4
- package/dist/addons/lib-registry.d.ts +2 -1
- package/dist/behaviours/player/SightInteractableArea.d.ts +2 -2
- package/dist/{chat.module-descriptor-BMy5jpOU.js → chat.module-descriptor-CGeOaq16.js} +3 -3
- package/dist/{get-scale-from-obj-bFMquHMV.js → get-scale-from-obj-B7JlVPni.js} +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +100 -69
- package/dist/{lib-registry-B-NnzKUx.js → lib-registry-CPwXvdYs.js} +8 -1
- package/dist/modules/chat/ChatDom.d.ts +16 -10
- package/dist/modules/contracts/platform.module-api.d.ts +60 -0
- package/dist/modules/index.d.ts +6 -0
- package/dist/modules/optional-module-descriptor.d.ts +7 -0
- package/dist/modules/platform/NullPlatformModule.d.ts +16 -0
- package/dist/modules/registry.d.ts +4 -0
- package/dist/version.gen.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API of the `platform` module — the world's link to the Kvyverse
|
|
3
|
+
* platform. Off the platform (self-hosted export) every call is a safe no-op:
|
|
4
|
+
* nothing throws, reads resolve to empty values.
|
|
5
|
+
*/
|
|
6
|
+
export interface PlatformModuleApi {
|
|
7
|
+
/** The world runs on the platform and the link is established. */
|
|
8
|
+
readonly available: boolean;
|
|
9
|
+
readonly player: PlatformPlayerApi;
|
|
10
|
+
/** Parameters this world was opened with; empty when opened from its own page. */
|
|
11
|
+
readonly openedWith: Readonly<WorldOpenParams>;
|
|
12
|
+
/**
|
|
13
|
+
* The world that switched to this one with `openWorld`; `null` when the
|
|
14
|
+
* player came straight to this page (a reload included).
|
|
15
|
+
*/
|
|
16
|
+
readonly referrer: WorldName | null;
|
|
17
|
+
/**
|
|
18
|
+
* Asks the platform to put another world of the same author on this page,
|
|
19
|
+
* in place of this one. `state` reaches it as its `openedWith`. Resolves to
|
|
20
|
+
* `false` when the platform refuses (another author, no such world) or off
|
|
21
|
+
* the platform; on success this world is torn down.
|
|
22
|
+
*/
|
|
23
|
+
openWorld: (world: WorldName, state?: WorldOpenParams) => Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Checks a name that came at runtime (a chat command, player input) against
|
|
26
|
+
* the author's worlds: resolves to its url-name, typed as `WorldName`, or
|
|
27
|
+
* `null` when there is no such world of this author, or off the platform.
|
|
28
|
+
* Takes a url-name or an id.
|
|
29
|
+
*/
|
|
30
|
+
resolveWorld: (world: string) => Promise<WorldName | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Asks the platform to open an external link. The platform shows the address
|
|
33
|
+
* and asks the player; resolves to `false` when they decline, when the
|
|
34
|
+
* address is not http(s), or off the platform.
|
|
35
|
+
*/
|
|
36
|
+
openLink: (url: string) => Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
/** Parameters a world is opened with. Values are strings. */
|
|
39
|
+
export type WorldOpenParams = Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Filled in by the Kvyverse editor for the author's own world: `worlds` lists
|
|
42
|
+
* the author's worlds. Not filled (anywhere else) — any string.
|
|
43
|
+
*/
|
|
44
|
+
export interface WorldNamesRegister {
|
|
45
|
+
}
|
|
46
|
+
/** Url-name of one of the author's worlds: what `openWorld` takes and `referrer` holds. */
|
|
47
|
+
export type WorldName = WorldNamesRegister extends {
|
|
48
|
+
worlds: infer TWorld extends string;
|
|
49
|
+
} ? TWorld : string;
|
|
50
|
+
export interface PlatformPlayerApi {
|
|
51
|
+
/** Display name of the current player; `null` for a guest or off-platform. */
|
|
52
|
+
readonly username: string | null;
|
|
53
|
+
/** Server-side storage for this world + player pair. */
|
|
54
|
+
readonly storage: PlatformPlayerStorageApi;
|
|
55
|
+
}
|
|
56
|
+
/** Storage of one world for one player. Never throws: no platform — no value. */
|
|
57
|
+
export interface PlatformPlayerStorageApi {
|
|
58
|
+
get: () => Promise<string | null>;
|
|
59
|
+
save: (data: string) => Promise<void>;
|
|
60
|
+
}
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -7,13 +7,16 @@ import { UtilsModule } from "./UtilsModule";
|
|
|
7
7
|
import type { AddonsRuntime } from "../addons/AddonsRuntime";
|
|
8
8
|
import type { AddonsConfig } from "../addons/types";
|
|
9
9
|
import type { EnvMode } from "./EnvModule";
|
|
10
|
+
import type { PlatformModuleApi } from "./contracts/platform.module-api";
|
|
10
11
|
import type { KvyverseModules } from "./registry";
|
|
12
|
+
import type { ContextModule } from "three-start";
|
|
11
13
|
export type { ChatModule } from "./chat/ChatModule";
|
|
12
14
|
export type { ChatDom, ChatDomOptions } from "./chat/ChatDom";
|
|
13
15
|
export { ControlsModule } from "./controls/ControlsModule";
|
|
14
16
|
export { EnvModule } from "./EnvModule";
|
|
15
17
|
export { HtmlHudModule } from "./HtmlHudModule";
|
|
16
18
|
export { InputSystemModule } from "./InputSystemModule";
|
|
19
|
+
export { NullPlatformModule } from "./platform/NullPlatformModule";
|
|
17
20
|
export { SoundsModule } from "./SoundsModule";
|
|
18
21
|
export { UtilsModule } from "./UtilsModule";
|
|
19
22
|
export { isMobileDevice } from "./is-mobile-device";
|
|
@@ -25,6 +28,7 @@ export type CoreWorldModules = {
|
|
|
25
28
|
env: EnvModule;
|
|
26
29
|
html: HtmlHudModule;
|
|
27
30
|
input: InputSystemModule;
|
|
31
|
+
platform: ContextModule & PlatformModuleApi;
|
|
28
32
|
sounds: SoundsModule;
|
|
29
33
|
utils: UtilsModule;
|
|
30
34
|
};
|
|
@@ -35,6 +39,8 @@ export interface CreateWorldModulesOptions {
|
|
|
35
39
|
addons: AddonsRuntime;
|
|
36
40
|
/** `settings.addons.json → modules`: which pluggable modules are on, and how. */
|
|
37
41
|
modules?: AddonsConfig["modules"];
|
|
42
|
+
/** `world.platform`: the host's implementation; omitted off the platform, and it turns no-op. */
|
|
43
|
+
platform?: ContextModule & PlatformModuleApi;
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
46
|
* Assembles the world's ctx modules: core ones always, pluggable ones per config.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KvyverseModules } from "./registry";
|
|
1
2
|
import type { ContextModule } from "three-start";
|
|
2
3
|
import type { LibId } from "../addons/lib-registry";
|
|
3
4
|
/**
|
|
@@ -22,6 +23,12 @@ export type ModuleJsonSchema = Record<string, unknown>;
|
|
|
22
23
|
*/
|
|
23
24
|
export interface OptionalModuleDescriptor<TConfig = unknown> {
|
|
24
25
|
id: OptionalModuleId;
|
|
26
|
+
/**
|
|
27
|
+
* Key in `ctx.modules`, when it differs from the config key `id` (physics is
|
|
28
|
+
* configured as `modules.physics` but lives on `ctx.modules.rapier`, named
|
|
29
|
+
* after the engine). Defaults to `id`.
|
|
30
|
+
*/
|
|
31
|
+
ctxKey?: keyof KvyverseModules;
|
|
25
32
|
/** Config value → normalized config; `null` means the module is off. */
|
|
26
33
|
normalize: (raw: unknown) => TConfig | null;
|
|
27
34
|
/** Config for an on-demand enable (a behaviour pulled the module in without config). */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ContextModule } from "three-start";
|
|
2
|
+
import type { PlatformModuleApi, PlatformPlayerApi, WorldOpenParams } from "../contracts/platform.module-api";
|
|
3
|
+
/**
|
|
4
|
+
* `world.platform` без платформы: self-hosted экспорт, мир без моста. Все вызовы
|
|
5
|
+
* безопасны — чтения пустые, записи ничего не делают. Мир на платформе получает
|
|
6
|
+
* вместо него реализацию хоста, переданную в `createWorldModules({ platform })`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NullPlatformModule extends ContextModule implements PlatformModuleApi {
|
|
9
|
+
readonly available = false;
|
|
10
|
+
readonly player: PlatformPlayerApi;
|
|
11
|
+
readonly openedWith: Readonly<WorldOpenParams>;
|
|
12
|
+
readonly referrer: null;
|
|
13
|
+
openWorld(): Promise<boolean>;
|
|
14
|
+
resolveWorld(): Promise<null>;
|
|
15
|
+
openLink(): Promise<boolean>;
|
|
16
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ContextModule } from "three-start";
|
|
1
2
|
import type { RapierPhysics } from "./physics/RapierPhysics";
|
|
2
3
|
import type { AddonsRuntime } from "../addons/AddonsRuntime";
|
|
3
4
|
import type { ChatModule } from "./chat/ChatModule";
|
|
@@ -5,6 +6,7 @@ import type { ControlsModule } from "./controls/ControlsModule";
|
|
|
5
6
|
import type { EnvModule } from "./EnvModule";
|
|
6
7
|
import type { HtmlHudModule } from "./HtmlHudModule";
|
|
7
8
|
import type { InputSystemModule } from "./InputSystemModule";
|
|
9
|
+
import type { PlatformModuleApi } from "./contracts/platform.module-api";
|
|
8
10
|
import type { SoundsModule } from "./SoundsModule";
|
|
9
11
|
import type { UtilsModule } from "./UtilsModule";
|
|
10
12
|
/**
|
|
@@ -23,6 +25,8 @@ export interface KvyverseModules {
|
|
|
23
25
|
controls: ControlsModule;
|
|
24
26
|
env: EnvModule;
|
|
25
27
|
html: HtmlHudModule;
|
|
28
|
+
/** Реализацию даёт тот, кто собирает мир: хост на платформе или пустая. */
|
|
29
|
+
platform: ContextModule & PlatformModuleApi;
|
|
26
30
|
sounds: SoundsModule;
|
|
27
31
|
utils: UtilsModule;
|
|
28
32
|
rapier: RapierPhysics;
|
package/dist/version.gen.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const RUNTIME_VERSION = "0.6.
|
|
1
|
+
export declare const RUNTIME_VERSION = "0.6.8";
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvyverse/world-runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Runtime for worlds exported from the Kvyverse platform for self-hosting",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Kvyverse, Inc.",
|
|
7
7
|
"homepage": "https://kvyverse.com",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/index.js",
|