@vworlds/vecs-phaser-server 1.0.25 → 1.0.27

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.
@@ -0,0 +1,4 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ export declare class PhaserServerModule extends Module<undefined> {
3
+ init(): void;
4
+ }
@@ -0,0 +1,20 @@
1
+ import { Module, PRE_STORE } from "@vworlds/vecs";
2
+ import { phaserRenderableComponents, Position as RenderPosition, Rotation as RenderRotation, } from "@vworlds/vecs-phaser";
3
+ import { Position as PhysicsPosition, Rotation as PhysicsRotation } from "@vworlds/vecs-physics";
4
+ export class PhaserServerModule extends Module {
5
+ init() {
6
+ const world = this.world;
7
+ world.setExclusiveComponents(...phaserRenderableComponents);
8
+ world
9
+ .system("phaser.sync.position")
10
+ .with(PhysicsPosition, RenderPosition)
11
+ .phase(PRE_STORE)
12
+ .update(PhysicsPosition, (e, p) => e.set(RenderPosition, { x: p.x, y: p.y }));
13
+ world
14
+ .system("phaser.sync.rotation")
15
+ .with(PhysicsRotation, RenderRotation)
16
+ .phase(PRE_STORE)
17
+ .update(PhysicsRotation, (e, r) => e.set(RenderRotation, { angle: r.angle }));
18
+ }
19
+ }
20
+ //# sourceMappingURL=PhaserServerModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhaserServerModule.js","sourceRoot":"","sources":["../src/PhaserServerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,0BAA0B,EAC1B,QAAQ,IAAI,cAAc,EAC1B,QAAQ,IAAI,cAAc,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEjG,MAAM,OAAO,kBAAmB,SAAQ,MAAiB;IAChD,IAAI;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,KAAK,CAAC,sBAAsB,CAAC,GAAG,0BAA0B,CAAC,CAAC;QAE5D,KAAK;aACF,MAAM,CAAC,sBAAsB,CAAC;aAC9B,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC;aACrC,KAAK,CAAC,SAAS,CAAC;aAChB,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEhF,KAAK;aACF,MAAM,CAAC,sBAAsB,CAAC;aAC9B,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC;aACrC,KAAK,CAAC,SAAS,CAAC;aAChB,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAClF,CAAC;CACF"}
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { PhaserServerModule } from "./PhaserServerModule.js";
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { PhaserServerModule } from "./PhaserServerModule.js";
2
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,35 +1,23 @@
1
1
  {
2
2
  "name": "@vworlds/vecs-phaser-server",
3
- "version": "1.0.25",
4
- "private": false,
3
+ "version": "1.0.27",
5
4
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
5
+ "main": "./index.js",
6
+ "types": "./index.d.ts",
8
7
  "exports": {
9
8
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
9
+ "types": "./index.d.ts",
10
+ "import": "./index.js"
12
11
  }
13
12
  },
14
- "files": [
15
- "dist",
16
- "README.md",
17
- "LICENSE",
18
- "CHANGELOG.md"
19
- ],
20
- "scripts": {
21
- "build": "rimraf dist && tsc -p tsconfig.build.json",
22
- "typecheck": "tsc --noEmit",
23
- "lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --no-error-on-unmatched-pattern",
24
- "test": "vitest run --passWithNoTests"
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/vworlds/vecs.git"
25
16
  },
26
17
  "dependencies": {
27
- "@vworlds/vecs-phaser": "1.0.25",
28
- "@vworlds/vecs-physics": "1.0.25",
29
- "@vworlds/vecs-server": "1.0.25"
30
- },
31
- "publishConfig": {
32
- "access": "public"
18
+ "@vworlds/vecs-phaser": "1.0.27",
19
+ "@vworlds/vecs-physics": "1.0.27",
20
+ "@vworlds/vecs-server": "1.0.27"
33
21
  },
34
22
  "license": "MIT"
35
23
  }
package/CHANGELOG.md DELETED
@@ -1,13 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `@vworlds/vecs-phaser-server` will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
-
7
- ## [Unreleased]
8
-
9
- ### Added
10
-
11
- - Added `registerRenderExclusivity` to enforce one active Phaser renderable component per entity.
12
- - Added shape builder helpers for creating networked render entities with transform and style components.
13
- - Added `syncPhysicsPose` for copying vecs-physics `Position` and `Rotation` into Phaser render pose components.
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 vworlds
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # @vworlds/vecs-phaser-server
2
-
3
- Thin pure-ECS server helpers: render-component exclusivity wiring (`registerRenderExclusivity`),
4
- shape entity builders (`createArc`, `createRectangle`, …), and a physics-to-render pose-sync
5
- system (`syncPhysicsPose`). No `phaser` dependency.
6
-
7
- Depends on `@vworlds/vecs-phaser` and `@vworlds/vecs-server`.
@@ -1,29 +0,0 @@
1
- import { type Entity } from "@vworlds/vecs";
2
- import { Alpha, Arc, Depth, Ellipse, FillStyle, Line, Polygon, Position, Rectangle, Rotation, Scale, Star, StrokeStyle, Text, Triangle } from "@vworlds/vecs-phaser";
3
- import { type ServerWorld } from "@vworlds/vecs-server";
4
- export interface RenderProps {
5
- alpha?: Partial<Alpha>;
6
- depth?: Partial<Depth>;
7
- fillStyle?: Partial<FillStyle>;
8
- position?: Partial<Position>;
9
- rotation?: Partial<Rotation>;
10
- scale?: Partial<Scale>;
11
- strokeStyle?: Partial<StrokeStyle>;
12
- }
13
- export type ArcProps = Partial<Arc> & RenderProps;
14
- export type EllipseProps = Partial<Ellipse> & RenderProps;
15
- export type LineProps = Partial<Line> & RenderProps;
16
- export type PolygonProps = Partial<Polygon> & RenderProps;
17
- export type RectangleProps = Partial<Rectangle> & RenderProps;
18
- export type StarProps = Partial<Star> & RenderProps;
19
- export type TextProps = Partial<Text> & RenderProps;
20
- export type TriangleProps = Partial<Triangle> & RenderProps;
21
- export declare function registerRenderExclusivity(world: ServerWorld): void;
22
- export declare function createArc(world: ServerWorld, props?: ArcProps): Entity;
23
- export declare function createEllipse(world: ServerWorld, props?: EllipseProps): Entity;
24
- export declare function createRectangle(world: ServerWorld, props?: RectangleProps): Entity;
25
- export declare function createPolygon(world: ServerWorld, props?: PolygonProps): Entity;
26
- export declare function createLine(world: ServerWorld, props?: LineProps): Entity;
27
- export declare function createTriangle(world: ServerWorld, props?: TriangleProps): Entity;
28
- export declare function createStar(world: ServerWorld, props?: StarProps): Entity;
29
- export declare function createText(world: ServerWorld, props?: TextProps): Entity;
package/dist/builders.js DELETED
@@ -1,130 +0,0 @@
1
- import { Alpha, Arc, Depth, Ellipse, FillStyle, Line, phaserRenderableComponents, Polygon, Position, Rectangle, Rotation, Scale, Star, StrokeStyle, Text, Triangle, } from "@vworlds/vecs-phaser";
2
- import { Networked } from "@vworlds/vecs-server";
3
- export function registerRenderExclusivity(world) {
4
- world.setExclusiveComponents(...phaserRenderableComponents);
5
- }
6
- export function createArc(world, props = {}) {
7
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
8
- return createRenderable(world, Arc, shape, {
9
- alpha,
10
- depth,
11
- fillStyle,
12
- position,
13
- rotation,
14
- scale,
15
- strokeStyle,
16
- });
17
- }
18
- export function createEllipse(world, props = {}) {
19
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
20
- return createRenderable(world, Ellipse, shape, {
21
- alpha,
22
- depth,
23
- fillStyle,
24
- position,
25
- rotation,
26
- scale,
27
- strokeStyle,
28
- });
29
- }
30
- export function createRectangle(world, props = {}) {
31
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
32
- return createRenderable(world, Rectangle, shape, {
33
- alpha,
34
- depth,
35
- fillStyle,
36
- position,
37
- rotation,
38
- scale,
39
- strokeStyle,
40
- });
41
- }
42
- export function createPolygon(world, props = {}) {
43
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
44
- return createRenderable(world, Polygon, shape, {
45
- alpha,
46
- depth,
47
- fillStyle,
48
- position,
49
- rotation,
50
- scale,
51
- strokeStyle,
52
- });
53
- }
54
- export function createLine(world, props = {}) {
55
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
56
- return createRenderable(world, Line, shape, {
57
- alpha,
58
- depth,
59
- fillStyle,
60
- position,
61
- rotation,
62
- scale,
63
- strokeStyle,
64
- });
65
- }
66
- export function createTriangle(world, props = {}) {
67
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
68
- return createRenderable(world, Triangle, shape, {
69
- alpha,
70
- depth,
71
- fillStyle,
72
- position,
73
- rotation,
74
- scale,
75
- strokeStyle,
76
- });
77
- }
78
- export function createStar(world, props = {}) {
79
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
80
- return createRenderable(world, Star, shape, {
81
- alpha,
82
- depth,
83
- fillStyle,
84
- position,
85
- rotation,
86
- scale,
87
- strokeStyle,
88
- });
89
- }
90
- export function createText(world, props = {}) {
91
- const { alpha, depth, fillStyle, position, rotation, scale, strokeStyle, ...shape } = props;
92
- return createRenderable(world, Text, shape, {
93
- alpha,
94
- depth,
95
- fillStyle,
96
- position,
97
- rotation,
98
- scale,
99
- strokeStyle,
100
- });
101
- }
102
- function createRenderable(world, Shape, shapeProps, renderProps) {
103
- const entity = world.entity().add(Networked).set(Shape, shapeProps);
104
- applyRenderProps(entity, renderProps);
105
- return entity;
106
- }
107
- function applyRenderProps(entity, props) {
108
- if (props.position !== undefined) {
109
- entity.set(Position, props.position);
110
- }
111
- if (props.rotation !== undefined) {
112
- entity.set(Rotation, props.rotation);
113
- }
114
- if (props.scale !== undefined) {
115
- entity.set(Scale, props.scale);
116
- }
117
- if (props.alpha !== undefined) {
118
- entity.set(Alpha, props.alpha);
119
- }
120
- if (props.depth !== undefined) {
121
- entity.set(Depth, props.depth);
122
- }
123
- if (props.fillStyle !== undefined) {
124
- entity.set(FillStyle, props.fillStyle);
125
- }
126
- if (props.strokeStyle !== undefined) {
127
- entity.set(StrokeStyle, props.strokeStyle);
128
- }
129
- }
130
- //# sourceMappingURL=builders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"builders.js","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,GAAG,EACH,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAI,EACJ,0BAA0B,EAC1B,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAC;AAqBnE,MAAM,UAAU,yBAAyB,CAAC,KAAkB;IAC1D,KAAK,CAAC,sBAAsB,CAAC,GAAG,0BAA0B,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAkB,EAAE,QAAkB,EAAE;IAChE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAC5F,OAAO,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;QACzC,KAAK;QACL,KAAK;QACL,SAAS;QACT,QAAQ;QACR,QAAQ;QACR,KAAK;QACL,WAAW;KACZ,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAkB,EAAE,QAAsB,EAAE;IACxE,MAAM,EAAE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K,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./builders.js";
2
- export * from "./pose.js";
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from "./builders.js";
2
- export * from "./pose.js";
3
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
package/dist/pose.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Entity, type System } from "@vworlds/vecs";
2
- import { type ServerWorld } from "@vworlds/vecs-server";
3
- export interface SyncPhysicsPoseOptions {
4
- phase?: Entity | string;
5
- }
6
- export declare function syncPhysicsPose(world: ServerWorld, options?: SyncPhysicsPoseOptions): System;
package/dist/pose.js DELETED
@@ -1,35 +0,0 @@
1
- import { DependsOn, insertPhaseAfter, Phase } from "@vworlds/vecs";
2
- import { Position as RenderPosition, Rotation as RenderRotation } from "@vworlds/vecs-phaser";
3
- import { Position as PhysicsPosition, Rotation as PhysicsRotation } from "@vworlds/vecs-physics";
4
- const DEFAULT_PHYSICS_POST_PHASE = "physics-post";
5
- const DEFAULT_SYNC_PHASE = "phaser-pose-sync";
6
- export function syncPhysicsPose(world, options = {}) {
7
- return world
8
- .system("PhaserSyncPhysicsPose")
9
- .with(PhysicsPosition)
10
- .phase(resolvePhase(world, options.phase))
11
- .each([PhysicsPosition, PhysicsRotation, RenderPosition, RenderRotation], (entity, components) => {
12
- const [physicsPosition, physicsRotation, renderPosition, renderRotation] = components;
13
- if (renderPosition === undefined ||
14
- renderPosition.x !== physicsPosition.x ||
15
- renderPosition.y !== physicsPosition.y) {
16
- entity.set(RenderPosition, { x: physicsPosition.x, y: physicsPosition.y });
17
- }
18
- if (physicsRotation !== undefined &&
19
- (renderRotation === undefined || renderRotation.angle !== physicsRotation.angle)) {
20
- entity.set(RenderRotation, { angle: physicsRotation.angle });
21
- }
22
- });
23
- }
24
- function resolvePhase(world, phase) {
25
- if (phase !== undefined) {
26
- return phase;
27
- }
28
- const physicsPostPhase = world.entity(DEFAULT_PHYSICS_POST_PHASE).add(Phase);
29
- const syncPhase = world.entity(DEFAULT_SYNC_PHASE).add(Phase);
30
- if (syncPhase.get(DependsOn)?.target !== physicsPostPhase) {
31
- insertPhaseAfter(syncPhase, physicsPostPhase);
32
- }
33
- return syncPhase;
34
- }
35
- //# sourceMappingURL=pose.js.map
package/dist/pose.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"pose.js","sourceRoot":"","sources":["../src/pose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,gBAAgB,EAAE,KAAK,EAAe,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOjG,MAAM,0BAA0B,GAAG,cAAc,CAAC;AAClD,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,UAAkC,EAAE;IACtF,OAAO,KAAK;SACT,MAAM,CAAC,uBAAuB,CAAC;SAC/B,IAAI,CAAC,eAAe,CAAC;SACrB,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;SACzC,IAAI,CACH,CAAC,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,CAAC,EAClE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACrB,MAAM,CAAC,eAAe,EAAE,eAAe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