@lute-lang/player-web 0.0.0-stage → 0.40.0
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/README.md +44 -2
- package/dist/assets/pixiAssets.d.ts +47 -0
- package/dist/assets/pixiAssetsBackend.d.ts +3 -0
- package/dist/audio/pixiAudio.d.ts +61 -0
- package/dist/audio/pixiSoundBackend.d.ts +3 -0
- package/dist/choice/choiceMenu.d.ts +56 -0
- package/dist/effects/catalogue.d.ts +52 -0
- package/dist/engine/app.d.ts +14 -0
- package/dist/engine/behaviours.d.ts +35 -0
- package/dist/engine/easing.d.ts +24 -0
- package/dist/engine/types.d.ts +70 -0
- package/dist/engine/world.d.ts +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3361 -0
- package/dist/input/gamepad.d.ts +22 -0
- package/dist/input/index.d.ts +7 -0
- package/dist/input/map.d.ts +42 -0
- package/dist/mount.d.ts +31 -0
- package/dist/presenter/index.d.ts +1 -0
- package/dist/presenter/pixiPresenter.d.ts +66 -0
- package/dist/scene/actor.d.ts +26 -0
- package/dist/scene/background.d.ts +24 -0
- package/dist/scene/camera.d.ts +37 -0
- package/dist/scene/cgLayer.d.ts +21 -0
- package/dist/scene/index.d.ts +7 -0
- package/dist/scene/shared.d.ts +36 -0
- package/dist/scene/vfx.d.ts +14 -0
- package/dist/scene/videoLayer.d.ts +21 -0
- package/dist/text/dialogueWindow.d.ts +52 -0
- package/dist/text/richText.d.ts +37 -0
- package/dist/text/segments.d.ts +31 -0
- package/dist/theme.d.ts +7 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/screens/backlog-screen.d.ts +1 -0
- package/dist/ui/screens/backlog.d.ts +25 -0
- package/dist/ui/screens/common.d.ts +68 -0
- package/dist/ui/screens/confirm.d.ts +1 -0
- package/dist/ui/screens/ended.d.ts +1 -0
- package/dist/ui/screens/halted.d.ts +1 -0
- package/dist/ui/screens/hud.d.ts +1 -0
- package/dist/ui/screens/idle.d.ts +1 -0
- package/dist/ui/screens/index.d.ts +4 -0
- package/dist/ui/screens/loading.d.ts +1 -0
- package/dist/ui/screens/menu.d.ts +1 -0
- package/dist/ui/screens/save-load-screen.d.ts +1 -0
- package/dist/ui/screens/save-load.d.ts +14 -0
- package/dist/ui/screens/settings-screen.d.ts +1 -0
- package/dist/ui/screens/settings.d.ts +13 -0
- package/dist/ui/screens/title.d.ts +1 -0
- package/dist/ui/ui.d.ts +65 -0
- package/dist/ui/widgets/base.d.ts +54 -0
- package/dist/ui/widgets/button.d.ts +15 -0
- package/dist/ui/widgets/controls.d.ts +47 -0
- package/dist/ui/widgets/focus-manager.d.ts +1 -0
- package/dist/ui/widgets/index.d.ts +4 -0
- package/dist/ui/widgets/label.d.ts +1 -0
- package/dist/ui/widgets/list.d.ts +50 -0
- package/dist/ui/widgets/panel.d.ts +1 -0
- package/dist/ui/widgets/scroll-list.d.ts +1 -0
- package/dist/ui/widgets/segmented.d.ts +1 -0
- package/dist/ui/widgets/slider.d.ts +1 -0
- package/dist/ui/widgets/toggle.d.ts +1 -0
- package/package.json +48 -4
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PlayerAction } from "@lute-lang/player";
|
|
2
|
+
/** Logical gamepad buttons used by the visual-novel input layer. */
|
|
3
|
+
export interface GamepadState {
|
|
4
|
+
readonly a: boolean;
|
|
5
|
+
readonly b: boolean;
|
|
6
|
+
readonly y: boolean;
|
|
7
|
+
readonly rb: boolean;
|
|
8
|
+
readonly lb: boolean;
|
|
9
|
+
readonly start: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Read the standard mapping indices into the portable gamepad state. */
|
|
12
|
+
export declare function readGamepadState(gamepad: Gamepad): GamepadState;
|
|
13
|
+
/** Poll the first connected gamepad and return edge-triggered actions. */
|
|
14
|
+
export declare function pollGamepad(detector: GamepadEdgeDetector, gamepads: readonly (Gamepad | null)[]): ReadonlyArray<PlayerAction>;
|
|
15
|
+
/** Emits actions only on button press edges, while allowing RB hold state. */
|
|
16
|
+
export declare class GamepadEdgeDetector {
|
|
17
|
+
private previous;
|
|
18
|
+
/** Poll a state and return newly pressed actions. */
|
|
19
|
+
poll(current: GamepadState): ReadonlyArray<PlayerAction>;
|
|
20
|
+
/** Reset edge state after a device disconnect. */
|
|
21
|
+
reset(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { defaultInputMap, resolveKeyboardAction, LongPressRecognizer, SwipeRecognizer, layer, type InputMap, type KeyBinding } from "./map.js";
|
|
2
|
+
export { GamepadEdgeDetector, pollGamepad, readGamepadState, type GamepadState } from "./gamepad.js";
|
|
3
|
+
import { layer } from "./map.js";
|
|
4
|
+
/** Namespaced input layer API. */
|
|
5
|
+
export declare const Input: {
|
|
6
|
+
layer: typeof layer;
|
|
7
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Stream } from "effect";
|
|
2
|
+
import type { PlayerAction } from "@lute-lang/player";
|
|
3
|
+
/** A keyboard binding with optional modifier requirements. */
|
|
4
|
+
export interface KeyBinding {
|
|
5
|
+
readonly action: PlayerAction;
|
|
6
|
+
readonly ctrl?: boolean;
|
|
7
|
+
readonly shift?: boolean;
|
|
8
|
+
readonly alt?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Device mapping table used by Input.layer. */
|
|
11
|
+
export interface InputMap {
|
|
12
|
+
readonly keyboard: Readonly<Record<string, PlayerAction | KeyBinding>>;
|
|
13
|
+
readonly pointer: Readonly<Record<string, PlayerAction>>;
|
|
14
|
+
}
|
|
15
|
+
/** Default keyboard, pointer and gesture table for visual-novel controls. */
|
|
16
|
+
export declare const defaultInputMap: InputMap;
|
|
17
|
+
/** Resolve a keyboard event through a mapping table. */
|
|
18
|
+
export declare function resolveKeyboardAction(event: KeyboardEvent, map?: InputMap): PlayerAction | undefined;
|
|
19
|
+
/** Recognizes a pointer hold without allocating per move event. */
|
|
20
|
+
export declare class LongPressRecognizer {
|
|
21
|
+
private started;
|
|
22
|
+
private emitted;
|
|
23
|
+
/** Start a pointer gesture at timestamp milliseconds. */
|
|
24
|
+
start(at: number): void;
|
|
25
|
+
/** End the gesture and return true when it was a long press. */
|
|
26
|
+
end(at: number, threshold?: number): boolean;
|
|
27
|
+
/** Check a held gesture and emit at most once. */
|
|
28
|
+
check(at: number, threshold?: number): boolean;
|
|
29
|
+
/** Cancel an active gesture. */
|
|
30
|
+
cancel(): void;
|
|
31
|
+
}
|
|
32
|
+
/** Recognizes a vertical swipe from pointer coordinates. */
|
|
33
|
+
export declare class SwipeRecognizer {
|
|
34
|
+
private startY;
|
|
35
|
+
private active;
|
|
36
|
+
/** Begin tracking a pointer. */
|
|
37
|
+
start(y: number): void;
|
|
38
|
+
/** End tracking and return swipe direction when threshold is crossed. */
|
|
39
|
+
end(y: number, threshold?: number): "up" | "down" | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** Attach DOM input listeners and expose their actions as a scoped stream. */
|
|
42
|
+
export declare function layer(element: HTMLElement, map?: InputMap, uiConsumes?: () => boolean, uiPointer?: (event: PointerEvent) => boolean): Stream.Stream<PlayerAction>;
|
package/dist/mount.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Effect, Scope } from "effect";
|
|
2
|
+
import { type Bindings, type LutePlayerHandle, type PlayerAction, type PlayerHost, type PlayerView } from "@lute-lang/player";
|
|
3
|
+
/** A bindings source accepted by the web facade. */
|
|
4
|
+
export type BindingsSource = Bindings | string | {
|
|
5
|
+
readonly url: string;
|
|
6
|
+
};
|
|
7
|
+
/** Options for mounting a browser player. */
|
|
8
|
+
export interface MountOptions {
|
|
9
|
+
readonly bindings: BindingsSource;
|
|
10
|
+
readonly bundleUrl: string;
|
|
11
|
+
readonly wasmUrl: string;
|
|
12
|
+
readonly assetsUrl?: string;
|
|
13
|
+
readonly storageKey?: string;
|
|
14
|
+
readonly host?: PlayerHost;
|
|
15
|
+
}
|
|
16
|
+
/** A scoped web player handle. `view` is the live Effect subscription ref. */
|
|
17
|
+
export interface WebPlayerHandle extends LutePlayerHandle {
|
|
18
|
+
}
|
|
19
|
+
/** Mount a web player in the current Effect scope. */
|
|
20
|
+
export declare const mount: (element: HTMLElement, options: MountOptions) => Effect.Effect<WebPlayerHandle, unknown, Scope.Scope>;
|
|
21
|
+
/** Promise facade for non-Effect hosts; this is the only Promise API. */
|
|
22
|
+
export declare const mountPlayer: (element: HTMLElement, options: MountOptions) => Promise<{
|
|
23
|
+
readonly unmount: () => Promise<void>;
|
|
24
|
+
readonly view: () => Promise<PlayerView>;
|
|
25
|
+
readonly act: (action: PlayerAction) => Promise<void>;
|
|
26
|
+
}>;
|
|
27
|
+
/** Namespace-style web facade. */
|
|
28
|
+
export declare const LuteWeb: {
|
|
29
|
+
mount: typeof mount;
|
|
30
|
+
mountPlayer: typeof mountPlayer;
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PixiPresenter, PixiPresenterTag, presenterLayer, type PresenterOptions } from "./pixiPresenter.js";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Context, Layer, Stream } from "effect";
|
|
2
|
+
import type { Bindings, PlayerAction, Presenter } from "@lute-lang/player";
|
|
3
|
+
import type { PixiAppShape } from "../engine/types.js";
|
|
4
|
+
import type { WorldShape } from "../engine/types.js";
|
|
5
|
+
import { PixiApp } from "../engine/app.js";
|
|
6
|
+
import { World } from "../engine/world.js";
|
|
7
|
+
import { type UiShape } from "../ui/ui.js";
|
|
8
|
+
import { type TextureAssets } from "../scene/shared.js";
|
|
9
|
+
import type { Theme } from "../engine/types.js";
|
|
10
|
+
export interface PresenterOptions {
|
|
11
|
+
readonly pixi: PixiAppShape;
|
|
12
|
+
readonly world: WorldShape;
|
|
13
|
+
readonly ui: UiShape;
|
|
14
|
+
readonly assets: TextureAssets;
|
|
15
|
+
readonly bindings: Bindings;
|
|
16
|
+
readonly theme: Theme;
|
|
17
|
+
readonly titleBackground?: string;
|
|
18
|
+
readonly logger?: (message: string, error?: unknown) => void;
|
|
19
|
+
}
|
|
20
|
+
/** Pixi implementation of the renderer-free player Presenter port. */
|
|
21
|
+
/** Presenter service key. */
|
|
22
|
+
export declare const PixiPresenterTag: Context.Service<PixiPresenter, PixiPresenter>;
|
|
23
|
+
/** Pixi implementation of the renderer-free player Presenter port. */
|
|
24
|
+
export declare class PixiPresenter implements Presenter {
|
|
25
|
+
static readonly layer: (bindings: Bindings, theme: Theme, assets: TextureAssets) => Layer.Layer<PixiPresenter, never, PixiApp | UiShape | World>;
|
|
26
|
+
readonly stage: Presenter["stage"];
|
|
27
|
+
readonly showLine: Presenter["showLine"];
|
|
28
|
+
readonly revealLine: Presenter["revealLine"];
|
|
29
|
+
readonly clearLine: Presenter["clearLine"];
|
|
30
|
+
readonly restore: Presenter["restore"];
|
|
31
|
+
readonly showChoice: Presenter["showChoice"];
|
|
32
|
+
readonly hideChoice: Presenter["hideChoice"];
|
|
33
|
+
readonly showScreen: Presenter["showScreen"];
|
|
34
|
+
readonly hideScreen: Presenter["hideScreen"];
|
|
35
|
+
readonly setUiHidden: Presenter["setUiHidden"];
|
|
36
|
+
readonly applySettings: Presenter["applySettings"];
|
|
37
|
+
readonly capture: Presenter["capture"];
|
|
38
|
+
readonly actions: Stream.Stream<PlayerAction>;
|
|
39
|
+
private readonly pixi;
|
|
40
|
+
private readonly world;
|
|
41
|
+
private readonly ui;
|
|
42
|
+
private readonly assets;
|
|
43
|
+
private readonly bindings;
|
|
44
|
+
private readonly theme;
|
|
45
|
+
private readonly logger;
|
|
46
|
+
private readonly actors;
|
|
47
|
+
private readonly background;
|
|
48
|
+
private readonly cg;
|
|
49
|
+
private readonly video;
|
|
50
|
+
private readonly camera;
|
|
51
|
+
private readonly vfx;
|
|
52
|
+
private readonly dialogue;
|
|
53
|
+
private readonly choice;
|
|
54
|
+
private readonly choiceActions;
|
|
55
|
+
private readonly missing;
|
|
56
|
+
private uiHidden;
|
|
57
|
+
constructor(options: PresenterOptions);
|
|
58
|
+
private defaultSettings;
|
|
59
|
+
private readonly stageCue;
|
|
60
|
+
private readonly upsertActor;
|
|
61
|
+
private readonly exitActor;
|
|
62
|
+
private readonly restoreStage;
|
|
63
|
+
private readonly showChoiceInternal;
|
|
64
|
+
private readonly logMissing;
|
|
65
|
+
}
|
|
66
|
+
export declare const presenterLayer: (bindings: Bindings, theme: Theme, assets: TextureAssets) => Layer.Layer<PixiPresenter, never, PixiApp | UiShape | World>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Container } from "pixi.js";
|
|
3
|
+
import type { Bindings, EffectSpec, Stage } from "@lute-lang/player";
|
|
4
|
+
import type { WorldShape, Theme } from "../engine/types.js";
|
|
5
|
+
import { spriteTexture, type TextureAssets } from "./shared.js";
|
|
6
|
+
/** Resolve the character sprite using costume then emotion fallbacks. */
|
|
7
|
+
export declare const resolveActorTexture: typeof spriteTexture;
|
|
8
|
+
export declare class ActorSprite {
|
|
9
|
+
readonly target: Container;
|
|
10
|
+
readonly actor: Stage["actors"][number];
|
|
11
|
+
private readonly world;
|
|
12
|
+
private readonly bindings;
|
|
13
|
+
private readonly assets;
|
|
14
|
+
private readonly design;
|
|
15
|
+
private readonly theme;
|
|
16
|
+
private readonly logger;
|
|
17
|
+
private readonly logged;
|
|
18
|
+
constructor(parent: Container, actor: Stage["actors"][number], world: WorldShape, bindings: Bindings, assets: TextureAssets, design: {
|
|
19
|
+
readonly width: number;
|
|
20
|
+
readonly height: number;
|
|
21
|
+
}, theme: Theme, logger?: (message: string) => void);
|
|
22
|
+
updateTexture(actor: Stage["actors"][number]): void;
|
|
23
|
+
readonly play: (action: EffectSpec | undefined, instant?: boolean, durationOverride?: number) => Effect.Effect<void>;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare const removeActor: (actor: ActorSprite, action: EffectSpec | undefined, instant?: boolean) => Effect.Effect<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Container } from "pixi.js";
|
|
3
|
+
import type { EffectSpec, Stage } from "@lute-lang/player";
|
|
4
|
+
import type { Bindings } from "@lute-lang/player";
|
|
5
|
+
import type { WorldShape, Theme } from "../engine/types.js";
|
|
6
|
+
import { type TextureAssets } from "./shared.js";
|
|
7
|
+
export declare const backgroundFile: (bindings: Bindings, bg: Stage["bg"]) => string | undefined;
|
|
8
|
+
/** Full-design-resolution background with optional texture crossfade. */
|
|
9
|
+
export declare class Background {
|
|
10
|
+
readonly target: Container;
|
|
11
|
+
private readonly world;
|
|
12
|
+
private readonly bindings;
|
|
13
|
+
private readonly assets;
|
|
14
|
+
private readonly theme;
|
|
15
|
+
private readonly design;
|
|
16
|
+
private readonly logger;
|
|
17
|
+
private readonly logged;
|
|
18
|
+
private current;
|
|
19
|
+
constructor(parent: Container, world: WorldShape, bindings: Bindings, assets: TextureAssets, design: {
|
|
20
|
+
readonly width: number;
|
|
21
|
+
readonly height: number;
|
|
22
|
+
}, theme: Theme, logger?: (message: string) => void);
|
|
23
|
+
readonly set: (bg: Stage["bg"], transition: EffectSpec | undefined, instant?: boolean, durationOverride?: number) => Effect.Effect<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { Bindings, EffectSpec } from "@lute-lang/player";
|
|
3
|
+
import type { Container } from "pixi.js";
|
|
4
|
+
import type { WorldShape } from "../engine/types.js";
|
|
5
|
+
export interface CameraPlacement {
|
|
6
|
+
readonly scale: number;
|
|
7
|
+
readonly x: number;
|
|
8
|
+
readonly y: number;
|
|
9
|
+
}
|
|
10
|
+
/** Compute camera transform around the design-space centre. */
|
|
11
|
+
export declare const framingPlacement: (framing: {
|
|
12
|
+
readonly zoom: number;
|
|
13
|
+
readonly x?: number | null;
|
|
14
|
+
readonly y?: number | null;
|
|
15
|
+
} | undefined, design: {
|
|
16
|
+
readonly width: number;
|
|
17
|
+
readonly height: number;
|
|
18
|
+
}, focus: {
|
|
19
|
+
readonly x: number;
|
|
20
|
+
readonly y: number;
|
|
21
|
+
} | undefined) => CameraPlacement;
|
|
22
|
+
export declare class Camera {
|
|
23
|
+
readonly target: Container;
|
|
24
|
+
private readonly world;
|
|
25
|
+
private readonly bindings;
|
|
26
|
+
private readonly design;
|
|
27
|
+
private readonly actors;
|
|
28
|
+
private readonly logger;
|
|
29
|
+
constructor(target: Container, actors: Container, world: WorldShape, bindings: Bindings, design: {
|
|
30
|
+
readonly width: number;
|
|
31
|
+
readonly height: number;
|
|
32
|
+
}, logger?: (message: string) => void);
|
|
33
|
+
readonly clear: () => void;
|
|
34
|
+
readonly apply: (framingName: string | undefined, focusName: string | undefined) => void;
|
|
35
|
+
readonly move: (move: EffectSpec | undefined, duration: number | undefined, instant?: boolean) => Effect.Effect<void>;
|
|
36
|
+
private findActor;
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Container } from "pixi.js";
|
|
3
|
+
import type { Bindings, EffectSpec, Stage } from "@lute-lang/player";
|
|
4
|
+
import type { WorldShape, Theme } from "../engine/types.js";
|
|
5
|
+
import { cgPlacement, type TextureAssets } from "./shared.js";
|
|
6
|
+
export { cgPlacement };
|
|
7
|
+
export declare class CgLayer {
|
|
8
|
+
readonly target: Container;
|
|
9
|
+
private readonly world;
|
|
10
|
+
private readonly bindings;
|
|
11
|
+
private readonly assets;
|
|
12
|
+
private readonly design;
|
|
13
|
+
private readonly theme;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
private current;
|
|
16
|
+
constructor(parent: Container, world: WorldShape, bindings: Bindings, assets: TextureAssets, design: {
|
|
17
|
+
readonly width: number;
|
|
18
|
+
readonly height: number;
|
|
19
|
+
}, theme: Theme, logger?: (message: string) => void);
|
|
20
|
+
readonly show: (cg: Stage["cg"], transition: EffectSpec | undefined, instant?: boolean, durationOverride?: number) => Effect.Effect<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ActorSprite, resolveActorTexture } from "./actor.js";
|
|
2
|
+
export { Background, backgroundFile } from "./background.js";
|
|
3
|
+
export { Camera, framingPlacement } from "./camera.js";
|
|
4
|
+
export { CgLayer, cgPlacement } from "./cgLayer.js";
|
|
5
|
+
export { VideoLayer, Sequence } from "./videoLayer.js";
|
|
6
|
+
export { Vfx } from "./vfx.js";
|
|
7
|
+
export * from "./shared.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Container, Texture } from "pixi.js";
|
|
2
|
+
import type { Bindings, Stage } from "@lute-lang/player";
|
|
3
|
+
import type { Theme } from "../engine/types.js";
|
|
4
|
+
export interface TextureAssets {
|
|
5
|
+
readonly texture: (file: string) => Texture | undefined;
|
|
6
|
+
readonly video: (file: string) => Texture | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare const assetFile: (bindings: Bindings, assetId: string | undefined) => string | undefined;
|
|
9
|
+
export declare const finite: (value: number | null | undefined, fallback: number) => number;
|
|
10
|
+
export declare const textureFor: (assets: TextureAssets, file: string | undefined) => Texture | undefined;
|
|
11
|
+
export declare const placeholder: (parent: Container, name: string, theme: Theme, width: number, height: number) => Container;
|
|
12
|
+
export declare const spriteTexture: (bindings: Bindings, actor: Stage["actors"][number]) => string | undefined;
|
|
13
|
+
export interface Size {
|
|
14
|
+
readonly width: number;
|
|
15
|
+
readonly height: number;
|
|
16
|
+
}
|
|
17
|
+
export interface Placement {
|
|
18
|
+
readonly x: number;
|
|
19
|
+
readonly y: number;
|
|
20
|
+
readonly scale: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const anchorPlacement: (anchor: {
|
|
23
|
+
readonly x: number;
|
|
24
|
+
readonly y?: number | null;
|
|
25
|
+
readonly scale?: number | null;
|
|
26
|
+
} | undefined, design: Size, texture: Size) => Placement;
|
|
27
|
+
export interface CgPlacement {
|
|
28
|
+
readonly x: number;
|
|
29
|
+
readonly y: number;
|
|
30
|
+
readonly scale: number;
|
|
31
|
+
readonly width: number;
|
|
32
|
+
readonly height: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const cgPlacement: (fit: "cover" | "contain", design: Size, texture: Size, scale: number | undefined, x: number | null | undefined, y: number | null | undefined) => CgPlacement;
|
|
35
|
+
export declare const clearContainer: (container: Container) => void;
|
|
36
|
+
export declare const transitionDuration: (duration: number | undefined, fallback?: number) => number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Container } from "pixi.js";
|
|
3
|
+
import type { EffectSpec } from "@lute-lang/player";
|
|
4
|
+
import type { WorldShape } from "../engine/types.js";
|
|
5
|
+
export declare class Vfx {
|
|
6
|
+
readonly target: Container;
|
|
7
|
+
private readonly world;
|
|
8
|
+
private readonly design;
|
|
9
|
+
constructor(parent: Container, world: WorldShape, design: {
|
|
10
|
+
readonly width: number;
|
|
11
|
+
readonly height: number;
|
|
12
|
+
});
|
|
13
|
+
readonly play: (effect: EffectSpec, duration: number | undefined, instant?: boolean) => Effect.Effect<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Container } from "pixi.js";
|
|
3
|
+
import type { Bindings, Stage } from "@lute-lang/player";
|
|
4
|
+
import type { WorldShape, Theme } from "../engine/types.js";
|
|
5
|
+
import { type TextureAssets } from "./shared.js";
|
|
6
|
+
export declare class VideoLayer {
|
|
7
|
+
readonly target: Container;
|
|
8
|
+
private readonly assets;
|
|
9
|
+
private readonly bindings;
|
|
10
|
+
private readonly design;
|
|
11
|
+
private readonly theme;
|
|
12
|
+
private readonly logger;
|
|
13
|
+
private active;
|
|
14
|
+
constructor(parent: Container, _world: WorldShape, bindings: Bindings, assets: TextureAssets, design: {
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
}, theme: Theme, logger?: (message: string) => void);
|
|
18
|
+
readonly show: (video: Stage["video"], blocking: boolean, skip?: boolean) => Effect.Effect<void>;
|
|
19
|
+
readonly hide: () => Effect.Effect<void>;
|
|
20
|
+
}
|
|
21
|
+
export { VideoLayer as Sequence };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Container } from "pixi.js";
|
|
3
|
+
import type { LineView, PlayMode, Settings } from "@lute-lang/player";
|
|
4
|
+
import type { Theme, WorldShape } from "../engine/types.js";
|
|
5
|
+
import { type TextStyleBindings } from "./richText.js";
|
|
6
|
+
/** Design-space dimensions used to place the dialogue window. */
|
|
7
|
+
export interface DialogueDesign {
|
|
8
|
+
readonly width: number;
|
|
9
|
+
readonly height: number;
|
|
10
|
+
}
|
|
11
|
+
/** Optional visual configuration for the dialogue entity. */
|
|
12
|
+
export interface DialogueWindowOptions {
|
|
13
|
+
readonly nameColors?: Readonly<Record<string, number>>;
|
|
14
|
+
readonly textStyles?: TextStyleBindings;
|
|
15
|
+
readonly boxWidth?: number;
|
|
16
|
+
readonly boxHeight?: number;
|
|
17
|
+
readonly fontSize?: number;
|
|
18
|
+
}
|
|
19
|
+
/** A Pixi dialogue panel with a world-owned typewriter behaviour. */
|
|
20
|
+
export declare class DialogueWindow {
|
|
21
|
+
readonly target: Container;
|
|
22
|
+
private readonly panel;
|
|
23
|
+
private readonly namePlate;
|
|
24
|
+
private readonly nameText;
|
|
25
|
+
private readonly textArea;
|
|
26
|
+
private readonly indicator;
|
|
27
|
+
private readonly world;
|
|
28
|
+
private readonly theme;
|
|
29
|
+
private readonly options;
|
|
30
|
+
private readonly graphemeTexts;
|
|
31
|
+
private timeline;
|
|
32
|
+
private currentLine;
|
|
33
|
+
private revealed;
|
|
34
|
+
private panelOpacity;
|
|
35
|
+
constructor(parent: Container, world: WorldShape, theme: Theme, options?: DialogueWindowOptions);
|
|
36
|
+
/** Shows a line and completes when its reveal behaviour ends. */
|
|
37
|
+
show: (line: LineView, settings: Settings, mode: PlayMode) => Effect.Effect<void>;
|
|
38
|
+
/** Finishes the current typewriter and makes the complete line visible. */
|
|
39
|
+
get reveal(): Effect.Effect<void>;
|
|
40
|
+
/** Removes line content and cancels behaviours attached to the window. */
|
|
41
|
+
get clear(): Effect.Effect<void>;
|
|
42
|
+
/** Changes panel opacity without changing the user's configured setting. */
|
|
43
|
+
setOpacity: (alpha: number) => void;
|
|
44
|
+
/** Hides or shows the complete dialogue entity. */
|
|
45
|
+
setHidden: (hidden: boolean) => void;
|
|
46
|
+
/** Repositions and resizes the panel for a new design resolution. */
|
|
47
|
+
relayout: (design: DialogueDesign) => void;
|
|
48
|
+
private clearTextChildren;
|
|
49
|
+
private buildTextChildren;
|
|
50
|
+
private tintText;
|
|
51
|
+
private typewriterBehaviour;
|
|
52
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Container, Text, type TextStyleOptions } from "pixi.js";
|
|
2
|
+
import type { Segment } from "@lute-lang/player";
|
|
3
|
+
/** Binding values accepted by a named text style. */
|
|
4
|
+
export interface TextStyleBinding {
|
|
5
|
+
readonly fontWeight?: TextStyleOptions["fontWeight"];
|
|
6
|
+
readonly fontStyle?: TextStyleOptions["fontStyle"];
|
|
7
|
+
readonly color?: number | string;
|
|
8
|
+
readonly alpha?: number;
|
|
9
|
+
readonly scale?: number;
|
|
10
|
+
readonly letterSpacing?: number;
|
|
11
|
+
readonly fontFamily?: string;
|
|
12
|
+
readonly fontSize?: number;
|
|
13
|
+
}
|
|
14
|
+
/** The plain map supplied by the bindings decoder. */
|
|
15
|
+
export type TextStyleBindings = Readonly<Record<string, TextStyleBinding>>;
|
|
16
|
+
/** A style-bearing piece of text after line breaking. */
|
|
17
|
+
export interface StyledRun {
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly styles: ReadonlyArray<string>;
|
|
20
|
+
readonly line: number;
|
|
21
|
+
}
|
|
22
|
+
/** True when a grapheme is forbidden at the beginning of a line. */
|
|
23
|
+
export declare const isForbiddenLineStart: (value: string) => boolean;
|
|
24
|
+
/** True when a grapheme is forbidden at the end of a line. */
|
|
25
|
+
export declare const isForbiddenLineEnd: (value: string) => boolean;
|
|
26
|
+
/** Maps one named binding to Pixi's TextStyle options. */
|
|
27
|
+
export declare const mapTextStyle: (names: ReadonlyArray<string>, bindings: TextStyleBindings, base?: TextStyleBinding) => TextStyleBinding;
|
|
28
|
+
/**
|
|
29
|
+
* Breaks styled segments into runs constrained to `width`. Latin text wraps at
|
|
30
|
+
* whitespace; CJK text wraps at grapheme boundaries. Basic kinsoku rules keep
|
|
31
|
+
* punctuation out of line starts and opening punctuation out of line ends.
|
|
32
|
+
*/
|
|
33
|
+
export declare const layoutStyledRuns: (segments: ReadonlyArray<Segment>, width: number, bindings: TextStyleBindings, fallback?: TextStyleBinding, locale?: string) => ReadonlyArray<StyledRun>;
|
|
34
|
+
/** Creates Pixi Text children for laid-out runs and positions them in the box. */
|
|
35
|
+
export declare const renderStyledRuns: (target: Container, runs: ReadonlyArray<StyledRun>, bindings: TextStyleBindings, fallback?: TextStyleBinding, lineHeight?: number) => ReadonlyArray<Text>;
|
|
36
|
+
/** Returns true when a grapheme is CJK-like and should use character wrapping. */
|
|
37
|
+
export declare const isCjkGrapheme: (value: string) => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Segment } from "@lute-lang/player";
|
|
2
|
+
/** A grapheme in the reveal order of a line. Times are seconds from the line start. */
|
|
3
|
+
export interface RevealGrapheme {
|
|
4
|
+
readonly grapheme: string;
|
|
5
|
+
readonly styles: ReadonlyArray<string>;
|
|
6
|
+
readonly segment: number;
|
|
7
|
+
readonly start: number;
|
|
8
|
+
readonly end: number;
|
|
9
|
+
}
|
|
10
|
+
/** A pause in the reveal timeline. */
|
|
11
|
+
export interface RevealPause {
|
|
12
|
+
readonly segment: number;
|
|
13
|
+
readonly start: number;
|
|
14
|
+
readonly end: number;
|
|
15
|
+
}
|
|
16
|
+
/** The immutable, grapheme-aware typewriter timeline. */
|
|
17
|
+
export interface RevealTimeline {
|
|
18
|
+
readonly graphemes: ReadonlyArray<RevealGrapheme>;
|
|
19
|
+
readonly pauses: ReadonlyArray<RevealPause>;
|
|
20
|
+
readonly duration: number;
|
|
21
|
+
readonly locale: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Builds the reveal schedule for a line. `rate` is a multiplier on the line's
|
|
25
|
+
* characters-per-second setting; a zero speed makes every grapheme immediate.
|
|
26
|
+
*/
|
|
27
|
+
export declare const buildRevealTimeline: (segments: ReadonlyArray<Segment>, charactersPerSecond: number, locale?: string) => RevealTimeline;
|
|
28
|
+
/** Alias kept descriptive for callers that treat the result as a reveal plan. */
|
|
29
|
+
export declare const segmentRevealTimeline: typeof buildRevealTimeline;
|
|
30
|
+
/** Returns all graphemes in a string using the same locale-aware segmentation as the timeline. */
|
|
31
|
+
export declare const graphemes: (text: string, locale?: string) => ReadonlyArray<string>;
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Bindings } from "@lute-lang/player";
|
|
2
|
+
import type { Theme } from "./engine/types.js";
|
|
3
|
+
/** Parse a CSS-style six digit colour, returning a supplied fallback on invalid input. */
|
|
4
|
+
export declare const parseColour: (value: unknown, fallback: number) => number;
|
|
5
|
+
/** Build the renderer theme from optional binding UI values. */
|
|
6
|
+
export declare const themeFromBindings: (bindings: Pick<Bindings, "ui"> | undefined) => Theme;
|
|
7
|
+
export declare const defaultTheme: Theme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BacklogScreen } from "./backlog.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Container } from "pixi.js";
|
|
2
|
+
import type { ScreenModel } from "@lute-lang/player";
|
|
3
|
+
import type { Theme } from "../../engine/types.js";
|
|
4
|
+
import { ScreenView, type EmitAction } from "./common.js";
|
|
5
|
+
/** Backlog screen with virtualized entries and voice replay actions. */
|
|
6
|
+
export declare class BacklogScreen extends ScreenView {
|
|
7
|
+
private readonly list;
|
|
8
|
+
constructor(model: Extract<ScreenModel, {
|
|
9
|
+
_tag: "Backlog";
|
|
10
|
+
}>, theme: Theme, emit: EmitAction);
|
|
11
|
+
handleKey(key: string): boolean;
|
|
12
|
+
private row;
|
|
13
|
+
}
|
|
14
|
+
/** In-game quick action bar. */
|
|
15
|
+
export declare class HudScreen extends Container {
|
|
16
|
+
/** Scaled button width and gap in design coordinates. */
|
|
17
|
+
static readonly buttonWidth = 101;
|
|
18
|
+
static readonly gap = 4;
|
|
19
|
+
static readonly totalWidth: number;
|
|
20
|
+
constructor(theme: Theme, emit: EmitAction, state: {
|
|
21
|
+
readonly auto: boolean;
|
|
22
|
+
readonly skip: boolean;
|
|
23
|
+
readonly hidden?: boolean;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Container, Text, Texture } from "pixi.js";
|
|
2
|
+
import type { PlayerAction, ScreenModel } from "@lute-lang/player";
|
|
3
|
+
import type { Theme } from "../../engine/types.js";
|
|
4
|
+
import { Button, FocusManager, Panel } from "../widgets/index.js";
|
|
5
|
+
/** Screen output callback. */
|
|
6
|
+
export type EmitAction = (action: PlayerAction) => void;
|
|
7
|
+
/** Common themed screen container with focus traversal. */
|
|
8
|
+
export declare abstract class ScreenView extends Container {
|
|
9
|
+
readonly focus: FocusManager;
|
|
10
|
+
protected readonly theme: Theme;
|
|
11
|
+
protected readonly emitAction: EmitAction;
|
|
12
|
+
protected readonly panel: Panel;
|
|
13
|
+
protected readonly title: Text;
|
|
14
|
+
protected readonly panelWidth: number;
|
|
15
|
+
protected readonly panelHeight: number;
|
|
16
|
+
constructor(heading: string, theme: Theme, emit: EmitAction, width?: number, height?: number);
|
|
17
|
+
/** Centre this screen inside the configured design coordinates. */
|
|
18
|
+
layout(design: {
|
|
19
|
+
readonly width: number;
|
|
20
|
+
readonly height: number;
|
|
21
|
+
}, full?: boolean): void;
|
|
22
|
+
/** Add a button and register it in keyboard focus order. */
|
|
23
|
+
protected button(text: string, action: PlayerAction, x: number, y: number, disabled?: boolean): Button;
|
|
24
|
+
/** Route key events to focusable controls. */
|
|
25
|
+
handleKey(key: string): boolean;
|
|
26
|
+
/** Clear scene children and focus before rebuilding dynamic content. */
|
|
27
|
+
protected clearContent(): void;
|
|
28
|
+
}
|
|
29
|
+
/** Title screen with continue gating and optional preloaded background texture. */
|
|
30
|
+
export declare class TitleScreen extends ScreenView {
|
|
31
|
+
constructor(model: Extract<ScreenModel, {
|
|
32
|
+
_tag: "Title";
|
|
33
|
+
}>, theme: Theme, emit: EmitAction, gameTitle?: string, textureFor?: (file: string) => Texture | undefined);
|
|
34
|
+
}
|
|
35
|
+
/** Pause menu screen. */
|
|
36
|
+
export declare class MenuScreen extends ScreenView {
|
|
37
|
+
constructor(theme: Theme, emit: EmitAction);
|
|
38
|
+
}
|
|
39
|
+
/** Confirmation modal. */
|
|
40
|
+
export declare class ConfirmScreen extends ScreenView {
|
|
41
|
+
constructor(model: Extract<ScreenModel, {
|
|
42
|
+
_tag: "Confirm";
|
|
43
|
+
}>, theme: Theme, emit: EmitAction);
|
|
44
|
+
}
|
|
45
|
+
/** End-of-story screen. */
|
|
46
|
+
export declare class EndedScreen extends ScreenView {
|
|
47
|
+
constructor(model: Extract<ScreenModel, {
|
|
48
|
+
_tag: "Ended";
|
|
49
|
+
}>, theme: Theme, emit: EmitAction);
|
|
50
|
+
}
|
|
51
|
+
/** Halted/error screen. */
|
|
52
|
+
export declare class HaltedScreen extends ScreenView {
|
|
53
|
+
constructor(model: Extract<ScreenModel, {
|
|
54
|
+
_tag: "Halted";
|
|
55
|
+
}>, theme: Theme, emit: EmitAction);
|
|
56
|
+
}
|
|
57
|
+
/** Loading progress screen. */
|
|
58
|
+
export declare class LoadingScreen extends ScreenView {
|
|
59
|
+
constructor(model: Extract<ScreenModel, {
|
|
60
|
+
_tag: "Loading";
|
|
61
|
+
}>, theme: Theme, emit: EmitAction);
|
|
62
|
+
}
|
|
63
|
+
/** Idle flow menu. */
|
|
64
|
+
export declare class IdleScreen extends ScreenView {
|
|
65
|
+
constructor(model: Extract<ScreenModel, {
|
|
66
|
+
_tag: "Idle";
|
|
67
|
+
}>, theme: Theme, emit: EmitAction);
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConfirmScreen } from "./common.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EndedScreen } from "./common.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HaltedScreen } from "./common.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HudScreen } from "./backlog.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IdleScreen } from "./common.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ScreenView, type EmitAction, TitleScreen, TitleScreen as Title, MenuScreen, MenuScreen as Menu, ConfirmScreen, ConfirmScreen as Confirm, EndedScreen, EndedScreen as Ended, HaltedScreen, HaltedScreen as Halted, LoadingScreen, LoadingScreen as Loading, IdleScreen, IdleScreen as Idle } from "./common.js";
|
|
2
|
+
export { BacklogScreen, BacklogScreen as Backlog, HudScreen, HudScreen as Hud } from "./backlog.js";
|
|
3
|
+
export { SaveLoadScreen, SaveLoadScreen as SaveLoad, SLOTS_PER_PAGE, pageSlots } from "./save-load.js";
|
|
4
|
+
export { SettingsScreen, SettingsScreen as Settings } from "./settings.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoadingScreen } from "./common.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MenuScreen } from "./common.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SaveLoadScreen, SLOTS_PER_PAGE, pageSlots } from "./save-load.js";
|