@al8b/player 0.1.0 → 0.1.13

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/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
- "name": "@al8b/player",
3
- "version": "0.1.0",
4
- "description": "Player control API for L8B - lifecycle, performance, and host communication",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.mjs",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
13
- }
14
- },
15
- "scripts": {
16
- "build": "tsup",
17
- "clean": "bun --bun ../../../scripts/clean-package.mjs dist .turbo node_modules",
18
- "test": "vitest run --passWithNoTests"
19
- },
20
- "devDependencies": {
21
- "tsup": "^8.0.0",
22
- "typescript": "^5.9.3"
23
- },
24
- "publishConfig": {
25
- "access": "public"
26
- }
2
+ "name": "@al8b/player",
3
+ "version": "0.1.13",
4
+ "description": "Player control API for L8B - lifecycle, performance, and host communication",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "tsup",
17
+ "clean": "bun --bun ../../../scripts/clean-package.mjs dist .turbo node_modules",
18
+ "test": "vitest run --passWithNoTests"
19
+ },
20
+ "devDependencies": {
21
+ "tsup": "^8.0.0",
22
+ "typescript": "^5.9.3"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ }
27
27
  }
@@ -1,19 +0,0 @@
1
- $ tsup
2
- CLI Building entry: src/index.ts
3
- CLI Using tsconfig: tsconfig.json
4
- CLI tsup v8.5.1
5
- CLI Using tsup config: /home/runner/work/l8b/l8b/packages/core/player/tsup.config.ts
6
- CLI Target: es2022
7
- CLI Cleaning output folder
8
- CJS Build start
9
- ESM Build start
10
- CJS dist/index.js 2.53 KB
11
- CJS dist/index.js.map 2.84 KB
12
- CJS ⚡️ Build success in 78ms
13
- ESM dist/index.mjs 1.56 KB
14
- ESM dist/index.mjs.map 2.70 KB
15
- ESM ⚡️ Build success in 77ms
16
- DTS Build start
17
- DTS ⚡️ Build success in 4112ms
18
- DTS dist/index.d.ts 1.17 KB
19
- DTS dist/index.d.mts 1.17 KB
@@ -1,9 +0,0 @@
1
- $ vitest run --passWithNoTests
2
-
3
-  RUN  v4.1.2 /home/runner/work/l8b/l8b/packages/core/player
4
-
5
- No test files found, exiting with code 0
6
-
7
- include: **/*.{test,spec}.?(c|m)[jt]s?(x)
8
- exclude: **/node_modules/**, **/.git/**
9
-
package/README.md DELETED
@@ -1,21 +0,0 @@
1
- # @al8b/player
2
-
3
- Player control bridge for L8B. It exposes the runtime-to-host lifecycle hooks used by game code for pause/resume, performance settings, and outbound messages.
4
-
5
- ## Public API
6
-
7
- - `PlayerService`
8
- - Type: `PlayerDelegate`
9
-
10
- ## Notes
11
-
12
- - Consumed by `@al8b/runtime` to build the script-facing `player.*` API.
13
- - This package is intentionally small and host-integration focused.
14
-
15
- ## Scripts
16
-
17
- ```bash
18
- bun run build
19
- bun run test
20
- bun run clean
21
- ```
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export { PlayerService } from "./player-service";
2
- export type { PlayerDelegate } from "./types";
@@ -1,56 +0,0 @@
1
- /**
2
- * PlayerService - Controls player UX from LootiScript
3
- *
4
- * Provides game scripts with the ability to control the player lifecycle
5
- * (quit, pause, resume, exit), adjust performance (fps, update_rate),
6
- * and communicate with the host application (postMessage).
7
- */
8
-
9
- import type { PlayerDelegate } from "./types";
10
-
11
- export class PlayerService {
12
- private delegate: PlayerDelegate;
13
- private interfaceCache: Record<string, any> | null = null;
14
-
15
- constructor(delegate: PlayerDelegate) {
16
- this.delegate = delegate;
17
- }
18
-
19
- /**
20
- * Get interface for game code (LootiScript `player.*`)
21
- */
22
- getInterface(): Record<string, any> {
23
- if (this.interfaceCache) {
24
- return this.interfaceCache;
25
- }
26
-
27
- const iface: Record<string, any> = {
28
- pause: () => this.delegate.pause(),
29
- resume: () => this.delegate.resume(),
30
- postMessage: (message: any) => this.delegate.postMessage(message),
31
- setFps: (fps: number) => {
32
- if (typeof fps === "number" && isFinite(fps) && fps > 0) {
33
- this.delegate.setUpdateRate(fps);
34
- }
35
- },
36
- };
37
-
38
- Object.defineProperty(iface, "fps", {
39
- get: () => this.delegate.getFps(),
40
- enumerable: true,
41
- });
42
-
43
- Object.defineProperty(iface, "update_rate", {
44
- get: () => this.delegate.getUpdateRate(),
45
- set: (value: number) => {
46
- if (typeof value === "number" && isFinite(value) && value > 0) {
47
- this.delegate.setUpdateRate(value);
48
- }
49
- },
50
- enumerable: true,
51
- });
52
-
53
- this.interfaceCache = iface;
54
- return this.interfaceCache;
55
- }
56
- }
package/src/types.ts DELETED
@@ -1,20 +0,0 @@
1
- /**
2
- * Delegate interface for PlayerService.
3
- *
4
- * The orchestrator provides concrete implementations of these callbacks
5
- * so the PlayerService stays decoupled from runtime internals.
6
- */
7
- export interface PlayerDelegate {
8
- /** Pause the game loop */
9
- pause: () => void;
10
- /** Resume the game loop */
11
- resume: () => void;
12
- /** Send an arbitrary message to the host application */
13
- postMessage: (message: any) => void;
14
- /** Get current FPS */
15
- getFps: () => number;
16
- /** Get target update rate (Hz) */
17
- getUpdateRate: () => number;
18
- /** Set target update rate (Hz) */
19
- setUpdateRate: (rate: number) => void;
20
- }
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src",
6
- "ignoreDeprecations": "5.0"
7
- },
8
- "include": [
9
- "src/**/*"
10
- ],
11
- "exclude": [
12
- "node_modules",
13
- "dist",
14
- "**/*.test.ts"
15
- ]
16
- }
package/tsup.config.ts DELETED
@@ -1,9 +0,0 @@
1
- import { defineConfig } from "tsup";
2
-
3
- export default defineConfig({
4
- entry: ["src/index.ts"],
5
- format: ["cjs", "esm"],
6
- dts: true,
7
- clean: true,
8
- sourcemap: true,
9
- });