@caperjs/core 0.2.2 → 0.2.3
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/build/index.mjs +2 -0
- package/build/plugins/viewport.mjs +52 -0
- package/lib/{CaptionsPlugin-DeGyPecB.js → CaptionsPlugin-WPAcfAkx.js} +13 -12
- package/lib/CaptionsPlugin-WPAcfAkx.js.map +1 -0
- package/lib/{DataAdapter-DeI2kIxC.js → DataAdapter-DS-twowe.js} +11 -11
- package/lib/{DataAdapter-DeI2kIxC.js.map → DataAdapter-DS-twowe.js.map} +1 -1
- package/lib/{DebugRenderer-wjV0tMwL.js → DebugRenderer-D1ryrRYx.js} +2 -2
- package/lib/{DebugRenderer-wjV0tMwL.js.map → DebugRenderer-D1ryrRYx.js.map} +1 -1
- package/lib/{DevToolsPlugin-D4iWQwkO.js → DevToolsPlugin-DH7zX7HU.js} +2 -2
- package/lib/{DevToolsPlugin-D4iWQwkO.js.map → DevToolsPlugin-DH7zX7HU.js.map} +1 -1
- package/lib/{GSAPPlugin-DQTyIwcC.js → GSAPPlugin-BBtRjUqe.js} +2 -2
- package/lib/{GSAPPlugin-DQTyIwcC.js.map → GSAPPlugin-BBtRjUqe.js.map} +1 -1
- package/lib/{LayoutPlugin-vR_h-BaG.js → LayoutPlugin-Co6vcoV4.js} +4 -4
- package/lib/{LayoutPlugin-vR_h-BaG.js.map → LayoutPlugin-Co6vcoV4.js.map} +1 -1
- package/lib/{SpinePlugin-DJ-PpxFj.js → SpinePlugin-uN641Hmk.js} +2 -2
- package/lib/{SpinePlugin-DJ-PpxFj.js.map → SpinePlugin-uN641Hmk.js.map} +1 -1
- package/lib/{StatsPlugin-BYNnKYOm.js → StatsPlugin-vZQRm6wh.js} +4 -4
- package/lib/{StatsPlugin-BYNnKYOm.js.map → StatsPlugin-vZQRm6wh.js.map} +1 -1
- package/lib/{VoiceOverPlugin-BLSbq3DU.js → VoiceOverPlugin-KlZdGj1G.js} +32 -32
- package/lib/{VoiceOverPlugin-BLSbq3DU.js.map → VoiceOverPlugin-KlZdGj1G.js.map} +1 -1
- package/lib/caper.mjs +2107 -353
- package/lib/caper.mjs.map +1 -1
- package/lib/core/Application.d.ts +7 -1
- package/lib/core/Application.d.ts.map +1 -1
- package/lib/core/interfaces/IApplicationOptions.d.ts +1 -1
- package/lib/core/interfaces/IApplicationOptions.d.ts.map +1 -1
- package/lib/core/interfaces/ICoreFunctions.d.ts +1 -0
- package/lib/core/interfaces/ICoreFunctions.d.ts.map +1 -1
- package/lib/display/AnimatedSprite.d.ts +1 -1
- package/lib/display/AnimatedSprite.d.ts.map +1 -1
- package/lib/display/Container.d.ts.map +1 -1
- package/lib/display/SpineAnimation.d.ts +1 -1
- package/lib/display/SpineAnimation.d.ts.map +1 -1
- package/lib/importOrder.containerFirst.test.d.ts +2 -0
- package/lib/importOrder.containerFirst.test.d.ts.map +1 -0
- package/lib/importOrder.displayFirst.test.d.ts +2 -0
- package/lib/importOrder.displayFirst.test.d.ts.map +1 -0
- package/lib/importOrder.mixinsFirst.test.d.ts +2 -0
- package/lib/importOrder.mixinsFirst.test.d.ts.map +1 -0
- package/lib/importOrder.sceneFirst.test.d.ts +2 -0
- package/lib/importOrder.sceneFirst.test.d.ts.map +1 -0
- package/lib/importOrder.toastFirst.test.d.ts +2 -0
- package/lib/importOrder.toastFirst.test.d.ts.map +1 -0
- package/lib/importOrder.uiFirst.test.d.ts +2 -0
- package/lib/importOrder.uiFirst.test.d.ts.map +1 -0
- package/lib/mixins/factory/Factory.d.ts +1 -1
- package/lib/mixins/factory/Factory.d.ts.map +1 -1
- package/lib/mixins/factory/Factory.test.d.ts +1 -0
- package/lib/mixins/factory/Factory.test.d.ts.map +1 -0
- package/lib/mixins/factory/const.d.ts +9 -2
- package/lib/mixins/factory/const.d.ts.map +1 -1
- package/lib/mixins/factory/defaults.d.ts +5 -0
- package/lib/mixins/factory/defaults.d.ts.map +1 -0
- package/lib/mixins/factory/methods.d.ts +1 -1
- package/lib/mixins/factory/methods.d.ts.map +1 -1
- package/lib/mixins/factory/props.d.ts +4 -2
- package/lib/mixins/factory/props.d.ts.map +1 -1
- package/lib/plugins/PopupManagerPlugin.d.ts +1 -1
- package/lib/plugins/PopupManagerPlugin.d.ts.map +1 -1
- package/lib/plugins/ResizerPlugin.d.ts +29 -0
- package/lib/plugins/ResizerPlugin.d.ts.map +1 -1
- package/lib/plugins/ResizerPlugin.test.d.ts +2 -0
- package/lib/plugins/ResizerPlugin.test.d.ts.map +1 -0
- package/lib/plugins/WebEventsPlugin.d.ts +5 -0
- package/lib/plugins/WebEventsPlugin.d.ts.map +1 -1
- package/lib/plugins/WebEventsPlugin.test.d.ts +2 -0
- package/lib/plugins/WebEventsPlugin.test.d.ts.map +1 -0
- package/lib/plugins/captions/CaptionsRenderer.d.ts +1 -1
- package/lib/plugins/captions/CaptionsRenderer.d.ts.map +1 -1
- package/lib/plugins/i18nPlugin.d.ts +29 -3
- package/lib/plugins/i18nPlugin.d.ts.map +1 -1
- package/lib/plugins/i18nPlugin.test.d.ts +2 -0
- package/lib/plugins/i18nPlugin.test.d.ts.map +1 -0
- package/lib/plugins/input/touch/VirtualControls.d.ts.map +1 -1
- package/lib/plugins/spine/pixi-spine/require-shim.d.ts +0 -1
- package/lib/plugins/spine/pixi-spine/require-shim.d.ts.map +1 -1
- package/lib/{registries-aN0y0Xha.js → registries-BLrxALZ0.js} +1124 -2801
- package/lib/registries-BLrxALZ0.js.map +1 -0
- package/lib/ui/Button.d.ts +1 -1
- package/lib/ui/Button.d.ts.map +1 -1
- package/lib/ui/FlexContainer.d.ts +1 -1
- package/lib/ui/FlexContainer.d.ts.map +1 -1
- package/lib/ui/Input.d.ts +2 -2
- package/lib/ui/Input.d.ts.map +1 -1
- package/lib/ui/Joystick.d.ts +1 -1
- package/lib/ui/Joystick.d.ts.map +1 -1
- package/lib/ui/Toast.d.ts +1 -1
- package/lib/ui/Toast.d.ts.map +1 -1
- package/lib/ui/UICanvas.d.ts +11 -1
- package/lib/ui/UICanvas.d.ts.map +1 -1
- package/lib/ui/UICanvas.test.d.ts +2 -0
- package/lib/ui/UICanvas.test.d.ts.map +1 -0
- package/lib/utils/types.d.ts +1 -2
- package/lib/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/Application.ts +15 -2
- package/src/core/interfaces/IApplicationOptions.ts +1 -1
- package/src/core/interfaces/ICoreFunctions.ts +1 -0
- package/src/display/AnimatedSprite.ts +2 -1
- package/src/display/Container.ts +3 -1
- package/src/display/SpineAnimation.ts +3 -2
- package/src/importOrder.containerFirst.test.ts +32 -0
- package/src/importOrder.displayFirst.test.ts +19 -0
- package/src/importOrder.mixinsFirst.test.ts +18 -0
- package/src/importOrder.sceneFirst.test.ts +21 -0
- package/src/importOrder.toastFirst.test.ts +20 -0
- package/src/importOrder.uiFirst.test.ts +24 -0
- package/src/mixins/factory/Factory.test.ts +22 -0
- package/src/mixins/factory/Factory.ts +9 -2
- package/src/mixins/factory/const.ts +18 -11
- package/src/mixins/factory/defaults.ts +28 -0
- package/src/mixins/factory/methods.ts +1 -1
- package/src/mixins/factory/props.ts +5 -3
- package/src/plugins/LookupPlugin.ts +1 -1
- package/src/plugins/PopupManagerPlugin.ts +1 -1
- package/src/plugins/ResizerPlugin.test.ts +84 -0
- package/src/plugins/ResizerPlugin.ts +59 -1
- package/src/plugins/WebEventsPlugin.test.ts +75 -0
- package/src/plugins/WebEventsPlugin.ts +15 -0
- package/src/plugins/captions/CaptionsRenderer.ts +1 -1
- package/src/plugins/i18nPlugin.test.ts +124 -0
- package/src/plugins/i18nPlugin.ts +57 -18
- package/src/plugins/input/keyboard/KeyboardContols.ts +1 -1
- package/src/plugins/input/touch/VirtualControls.ts +2 -2
- package/src/plugins/spine/pixi-spine/require-shim.ts +3 -1
- package/src/ui/Button.ts +5 -1
- package/src/ui/FlexContainer.ts +3 -2
- package/src/ui/Input.ts +5 -2
- package/src/ui/Joystick.ts +1 -1
- package/src/ui/Toast.ts +2 -1
- package/src/ui/Toaster.ts +1 -1
- package/src/ui/UICanvas.test.ts +35 -0
- package/src/ui/UICanvas.ts +46 -8
- package/src/utils/types.ts +1 -1
- package/src/version.ts +1 -1
- package/lib/CaptionsPlugin-DeGyPecB.js.map +0 -1
- package/lib/registries-aN0y0Xha.js.map +0 -1
package/src/ui/Button.ts
CHANGED
|
@@ -12,7 +12,11 @@ import {
|
|
|
12
12
|
import { type LayoutOptions } from '@pixi/layout';
|
|
13
13
|
import type { IApplication } from '../core';
|
|
14
14
|
import { Application } from '../core/Application';
|
|
15
|
-
import { Factory
|
|
15
|
+
import { Factory } from '../mixins/factory/Factory';
|
|
16
|
+
import type { HTMLTextProps, TextProps } from '../mixins/factory/props';
|
|
17
|
+
import { Focusable } from '../mixins/focus';
|
|
18
|
+
import { Interactive } from '../mixins/interaction';
|
|
19
|
+
import { WithSignals } from '../mixins/signals';
|
|
16
20
|
import { Signal } from '../signals';
|
|
17
21
|
import { AudioAsset, bindAllMethods, type SpritesheetAsset, type TextureAsset } from '../utils';
|
|
18
22
|
|
package/src/ui/FlexContainer.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { LayoutOptions, NumberValue } from '@pixi/layout';
|
|
2
2
|
import { BitmapText, Graphics, Container as PIXIContainer, Text } from 'pixi.js';
|
|
3
3
|
import { Application } from '../core/Application';
|
|
4
|
-
import { Container } from '../display';
|
|
5
|
-
import { Factory
|
|
4
|
+
import { Container } from '../display/Container';
|
|
5
|
+
import { Factory } from '../mixins/factory/Factory';
|
|
6
|
+
import { WithSignals } from '../mixins/signals';
|
|
6
7
|
import { Signal } from '../signals';
|
|
7
8
|
import {
|
|
8
9
|
AppTypeOverrides,
|
package/src/ui/Input.ts
CHANGED
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
Texture,
|
|
12
12
|
} from 'pixi.js';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import type { TextProps } from '../mixins/factory/props';
|
|
15
|
+
import { Focusable } from '../mixins/focus';
|
|
16
|
+
import { Interactive } from '../mixins/interaction';
|
|
17
|
+
import { WithSignals } from '../mixins/signals';
|
|
15
18
|
|
|
16
19
|
import {
|
|
17
20
|
EaseString,
|
|
@@ -27,7 +30,7 @@ import {
|
|
|
27
30
|
} from '../utils';
|
|
28
31
|
|
|
29
32
|
import { gsap } from 'gsap';
|
|
30
|
-
import { Container } from '../display';
|
|
33
|
+
import { Container } from '../display/Container';
|
|
31
34
|
import { Signal } from '../signals';
|
|
32
35
|
|
|
33
36
|
/**
|
package/src/ui/Joystick.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* ported to TypeScript and adapted for Caper
|
|
5
5
|
*/
|
|
6
6
|
import { DestroyOptions, FederatedPointerEvent, Graphics, Point, Sprite } from 'pixi.js';
|
|
7
|
-
import { Container } from '../display';
|
|
7
|
+
import { Container } from '../display/Container';
|
|
8
8
|
import { JoystickDirection } from '../plugins';
|
|
9
9
|
import { Signal } from '../signals';
|
|
10
10
|
|
package/src/ui/Toast.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { gsap } from 'gsap';
|
|
2
2
|
import { Graphics, Text } from 'pixi.js';
|
|
3
3
|
import { Container } from '../display/Container';
|
|
4
|
-
import {
|
|
4
|
+
import type { TextStyle } from '../mixins/factory/props';
|
|
5
|
+
import { WithSignals } from '../mixins/signals';
|
|
5
6
|
import { Signal } from '../signals';
|
|
6
7
|
import { Button } from './Button';
|
|
7
8
|
import { Toaster } from './Toaster';
|
package/src/ui/Toaster.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gsap } from 'gsap';
|
|
2
2
|
import { Container } from '../display/Container';
|
|
3
|
-
import { WithSignals } from '../mixins';
|
|
3
|
+
import { WithSignals } from '../mixins/signals';
|
|
4
4
|
import { Signal } from '../signals';
|
|
5
5
|
import { defaultToastConfig, Toast, ToastConfig } from './Toast';
|
|
6
6
|
import { UICanvasEdge } from './UICanvas';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
// UICanvas transitively imports Application → Pixi display graph. Stub it — the
|
|
4
|
+
// pure padding helper needs none of it.
|
|
5
|
+
vi.mock('../core/Application', () => ({
|
|
6
|
+
Application: { getInstance: () => ({}) },
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
import { computeEffectivePadding } from './UICanvas';
|
|
10
|
+
|
|
11
|
+
const zero = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
12
|
+
|
|
13
|
+
describe('computeEffectivePadding', () => {
|
|
14
|
+
it('adds the safe area to the configured padding', () => {
|
|
15
|
+
expect(
|
|
16
|
+
computeEffectivePadding({ top: 10, right: 10, bottom: 10, left: 10 }, { ...zero, top: 44, bottom: 34 }),
|
|
17
|
+
).toEqual({ top: 54, right: 10, bottom: 44, left: 10 });
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('returns the configured padding when there is no safe area', () => {
|
|
21
|
+
expect(computeEffectivePadding({ top: 10, right: 20, bottom: 30, left: 40 }, zero)).toEqual({
|
|
22
|
+
top: 10,
|
|
23
|
+
right: 20,
|
|
24
|
+
bottom: 30,
|
|
25
|
+
left: 40,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('does not compound when applied repeatedly to the same base padding', () => {
|
|
30
|
+
const base = { top: 10, right: 10, bottom: 10, left: 10 };
|
|
31
|
+
const safeArea = { ...zero, top: 44 };
|
|
32
|
+
computeEffectivePadding(base, safeArea);
|
|
33
|
+
expect(computeEffectivePadding(base, safeArea).top).toBe(54);
|
|
34
|
+
});
|
|
35
|
+
});
|
package/src/ui/UICanvas.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { LayoutOptions } from '@pixi/layout';
|
|
2
2
|
import { ContainerChild, Graphics, RenderLayer, Container as PIXIContainer, Text } from 'pixi.js';
|
|
3
3
|
import { Application } from '../core/Application';
|
|
4
|
-
import { Container } from '../display';
|
|
5
|
-
import { Factory
|
|
4
|
+
import { Container } from '../display/Container';
|
|
5
|
+
import { Factory } from '../mixins/factory/Factory';
|
|
6
|
+
import { WithSignals } from '../mixins/signals';
|
|
6
7
|
import type { AppTypeOverrides, Padding, PointLike, Size, SizeLike } from '../utils';
|
|
7
8
|
import {
|
|
8
9
|
bindAllMethods,
|
|
@@ -72,21 +73,46 @@ export type UICanvasConfig = {
|
|
|
72
73
|
padding: Padding;
|
|
73
74
|
size: Size;
|
|
74
75
|
useAppSize: boolean;
|
|
76
|
+
useSafeArea: boolean;
|
|
75
77
|
layout?: Omit<LayoutOptions, 'target'> | null | boolean;
|
|
76
78
|
autoLayoutChildren?: boolean;
|
|
77
79
|
};
|
|
78
80
|
|
|
79
|
-
export const UICanvasConfigKeys: (keyof UICanvasConfig)[] = [
|
|
81
|
+
export const UICanvasConfigKeys: (keyof UICanvasConfig)[] = [
|
|
82
|
+
'debug',
|
|
83
|
+
'padding',
|
|
84
|
+
'size',
|
|
85
|
+
'useAppSize',
|
|
86
|
+
'useSafeArea',
|
|
87
|
+
'layout',
|
|
88
|
+
];
|
|
80
89
|
|
|
81
90
|
export type UICanvasProps = {
|
|
82
91
|
debug: boolean;
|
|
83
92
|
padding: Partial<Padding> | PointLike;
|
|
84
93
|
size?: SizeLike;
|
|
85
94
|
useAppSize?: boolean;
|
|
95
|
+
useSafeArea?: boolean;
|
|
86
96
|
layout?: Omit<LayoutOptions, 'target'> | null | boolean;
|
|
87
97
|
autoLayoutChildren?: boolean;
|
|
88
98
|
};
|
|
89
99
|
|
|
100
|
+
const zeroPadding: Padding = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The padding the canvas actually lays out with: the configured padding plus the
|
|
104
|
+
* device's safe-area insets. Kept separate from `config.padding` so it can be
|
|
105
|
+
* re-derived on every resize without compounding.
|
|
106
|
+
*/
|
|
107
|
+
export function computeEffectivePadding(padding: Padding, safeArea: Padding): Padding {
|
|
108
|
+
return {
|
|
109
|
+
top: padding.top + safeArea.top,
|
|
110
|
+
right: padding.right + safeArea.right,
|
|
111
|
+
bottom: padding.bottom + safeArea.bottom,
|
|
112
|
+
left: padding.left + safeArea.left,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
90
116
|
const defaultLayout = {
|
|
91
117
|
flexGrow: 0,
|
|
92
118
|
flexShrink: 0,
|
|
@@ -124,6 +150,7 @@ export class UICanvas extends _UICanvas {
|
|
|
124
150
|
padding: ensurePadding(config?.padding ?? 0),
|
|
125
151
|
size: config.size !== undefined ? resolveSizeLike(config.size) : { width: 0, height: 0 },
|
|
126
152
|
useAppSize: config.useAppSize === true,
|
|
153
|
+
useSafeArea: config.useSafeArea ?? true,
|
|
127
154
|
autoLayoutChildren: config.autoLayoutChildren ?? true,
|
|
128
155
|
};
|
|
129
156
|
|
|
@@ -414,13 +441,22 @@ export class UICanvas extends _UICanvas {
|
|
|
414
441
|
set padding(value: Partial<Padding> | PointLike) {
|
|
415
442
|
this.config.padding = ensurePadding(value);
|
|
416
443
|
// Update position to account for padding
|
|
444
|
+
this._applyPadding();
|
|
445
|
+
this._updateLayout();
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/** Writes the effective padding (configured padding + safe-area insets) into the layout. */
|
|
449
|
+
private _applyPadding() {
|
|
450
|
+
const padding = computeEffectivePadding(
|
|
451
|
+
this.config.padding,
|
|
452
|
+
this.config.useSafeArea ? this.app.safeArea : zeroPadding,
|
|
453
|
+
);
|
|
417
454
|
this.layout = {
|
|
418
|
-
paddingLeft:
|
|
419
|
-
paddingTop:
|
|
420
|
-
paddingRight:
|
|
421
|
-
paddingBottom:
|
|
455
|
+
paddingLeft: padding.left,
|
|
456
|
+
paddingTop: padding.top,
|
|
457
|
+
paddingRight: padding.right,
|
|
458
|
+
paddingBottom: padding.bottom,
|
|
422
459
|
};
|
|
423
|
-
this._updateLayout();
|
|
424
460
|
}
|
|
425
461
|
|
|
426
462
|
private static isFlexContainer(child: PIXIContainer): boolean {
|
|
@@ -494,6 +530,8 @@ export class UICanvas extends _UICanvas {
|
|
|
494
530
|
}
|
|
495
531
|
|
|
496
532
|
public resize() {
|
|
533
|
+
// Re-derived rather than cached: the safe area changes with the viewport.
|
|
534
|
+
this._applyPadding();
|
|
497
535
|
if (this.config.useAppSize) {
|
|
498
536
|
this.size = { width: this.app.size.width, height: this.app.size.height };
|
|
499
537
|
this.position.set(-this.app.size.width * 0.5, -this.app.size.height * 0.5);
|
package/src/utils/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AssetInitOptions, AssetsManifest, AssetsPreferences, Texture, UnresolvedAsset } from 'pixi.js';
|
|
2
2
|
import { Point } from 'pixi.js';
|
|
3
3
|
import type { Scene } from '../display/Scene';
|
|
4
|
-
import { SceneAssets } from '../display';
|
|
4
|
+
import type { SceneAssets } from '../display/Scene';
|
|
5
5
|
import type { FilterBitmapFontNames, FilterCleanAssetNames, FilterSpineAssetNames } from './typefilters';
|
|
6
6
|
|
|
7
7
|
/**
|
package/src/version.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CaptionsPlugin-DeGyPecB.js","names":[],"sources":["../src/plugins/captions/CaptionsRenderer.ts","../src/plugins/captions/CaptionsPlugin.ts"],"sourcesContent":["import { gsap } from 'gsap';\nimport { BitmapText, Container as PIXIContainer, Sprite, Texture } from 'pixi.js';\nimport { Container } from '../../display';\nimport { type Size } from '../../utils';\nimport { CaptionsPlugin } from './CaptionsPlugin';\n\nexport type CaptionLine = {\n id: string;\n start: number;\n end: number;\n content: string;\n speaker?: string;\n};\n\nexport interface ICaptionRenderer extends PIXIContainer {\n visible: boolean;\n\n start(): void;\n\n stop(): void;\n\n lineBegin(line: CaptionLine): void;\n\n lineEnd(line: CaptionLine): void;\n\n resize(size?: Size): void;\n\n updateSettings(): void;\n\n destroy(): void;\n}\n\nexport class CaptionsRenderer extends Container implements ICaptionRenderer {\n private readonly _bg: Sprite;\n private readonly _text: BitmapText;\n private readonly _size: Size = { width: 0, height: 0 };\n private readonly fontSize = 48;\n\n constructor(private plugin: CaptionsPlugin) {\n super({ autoResize: false });\n\n this._bg = this.add.sprite({ asset: Texture.WHITE, anchor: [0.5, 0] });\n this._bg.tint = this.plugin.options.backgroundColor;\n this._bg.alpha = 0;\n\n this._text = this.add.bitmapText({\n font: plugin.options.fontName,\n resolution: 2,\n roundPixels: true,\n style: {\n fill: this.plugin.options.textColor,\n fontSize: this.fontSize * this.getSizeMultiplier(),\n fontWeight: 'bold',\n align: 'center',\n wordWrapWidth: this.plugin.maxWidth,\n wordWrap: true,\n lineHeight: this.fontSize * this.getSizeMultiplier() * 2 + 20,\n },\n });\n this._text.style.wordWrap = true;\n this._text.alpha = 0;\n this._text.visible = false;\n this._text.anchor.x = 0.5;\n this._text.anchor.y = 0;\n this.addChild(this._text);\n\n if (this.plugin.debug) {\n let isTapping = false;\n this._bg.eventMode = 'static';\n this._bg.on('pointertap', () => {\n if (isTapping) {\n return;\n }\n isTapping = true;\n setTimeout(() => {\n isTapping = false;\n void this.app.voiceover.stopVO();\n }, 100);\n });\n }\n }\n\n public start(): void {\n this._text.visible = true;\n this._bg.visible = true;\n\n gsap.killTweensOf([this._bg, this._text]);\n this.animate({ alpha: this.plugin.options.backgroundAlpha, visible: true, duration: 0.2 }, this._bg);\n this.animate({ alpha: 1, visible: true, duration: 0.2 }, this._text);\n }\n\n public stop(): void {\n gsap.killTweensOf([this._bg, this._text]);\n this.animate({ alpha: 0, visible: false, duration: 0.2 }, [this._bg, this._text]);\n }\n\n public lineBegin(line: CaptionLine): void {\n let text = line.content\n .replace(/<[^>]*>/gi, '') // remove html tags\n .replace(/\\[.*]\\W*/gi, ''); // remove brackets\n if (line.start === 0) {\n text = text.charAt(0).toUpperCase() + text.slice(1);\n }\n this._text.text = text;\n this.resize();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public lineEnd(_line: CaptionLine): void {}\n\n public resize(): void {\n const size = this.app.size;\n const opts = this.plugin.options;\n\n this._size.width = size.width;\n this._size.height = size.height;\n\n this._text.style.fontSize = this.fontSize * this.getSizeMultiplier();\n this._text.style.wordWrapWidth = opts.maxWidth * 2;\n this._text.scale.set(0.5);\n this._text.position.set(this._size.width * 0.5, 0);\n\n this._bg.position.set(this._size.width * 0.5, 0);\n\n let h = this._text.height;\n if (opts.padding.top) {\n h += opts.padding.top;\n }\n if (opts.padding.bottom) {\n h += opts.padding.bottom;\n }\n this._bg.height = h;\n\n this._text.y += opts.padding.top;\n\n if (opts.floating) {\n let w = this._text.width;\n\n if (opts.padding.left) {\n w += opts.padding.left;\n }\n if (opts.padding.right) {\n w += opts.padding.right;\n }\n\n this._bg.x += opts.padding.right * 0.5 - opts.padding.left * 0.5;\n this._bg.width = w;\n } else {\n this._bg.width = size.width;\n }\n\n if (opts.position === 'top') {\n this.position.set(-size.width * 0.5, Math.round(-size.height * 0.5));\n if (opts.floating) {\n this.position.y += Math.round(opts.distance - this._bg.y);\n }\n } else {\n this.position.set(-size.width * 0.5, Math.round(size.height * 0.5 - this._bg.height));\n if (opts.floating) {\n this.position.y -= Math.round(opts.distance + this._bg.y);\n }\n }\n }\n\n updateSettings() {\n if (this.plugin.options.enabled) {\n this._text.style.fill = this.plugin.options.textColor;\n this._bg.tint = this.plugin.options.backgroundColor;\n if (this._bg.visible) {\n this._bg.alpha = this.plugin.options.backgroundAlpha;\n this.resize();\n }\n } else {\n this.stop();\n this._bg.visible = false;\n this._text.visible = false;\n this._bg.alpha = this._text.alpha = 0;\n }\n }\n\n private getSizeMultiplier(): number {\n return this.plugin.options.fontSizeMultiplier;\n }\n}\n","import { Assets, Container, Ticker } from 'pixi.js';\nimport type { ImportListItem, ImportListItemModule, Padding, PointLike } from '../../utils';\nimport { ensurePadding, getDynamicModuleFromImportListItem, isDev, Logger } from '../../utils';\nimport type { IAudioInstance } from '../audio';\nimport type { IPlugin } from '../Plugin';\nimport { Plugin } from '../Plugin';\nimport type { ICaptionRenderer } from './CaptionsRenderer';\nimport { CaptionsRenderer } from './CaptionsRenderer';\n\nconst isDebug = isDev;\n\n/**\n * Type definition for i18n dictionary.\n */\ntype CaptionsDict = Record<string, any>;\n\n/**\n * Type definition for i18n import list item.\n */\ntype CaptionsImportListItem<T> = {\n id: string;\n namedExport?: string;\n options?: any;\n module?: ImportListItemModule<T>;\n} & {\n json?: string;\n};\n\ntype CaptionRendererConstructor = new (owner: CaptionsPlugin) => ICaptionRenderer;\n\n/**\n * Type definition for i18n options.\n */\nexport type CaptionsOptions = {\n renderer: CaptionRendererConstructor;\n defaultLocale: string;\n files: CaptionsImportListItem<CaptionsDict>[];\n fontFile: string;\n fontName: string;\n fontSizeMultiplier: number;\n maxWidth: number;\n textColor: number;\n backgroundColor: number;\n backgroundAlpha: number;\n enabled: boolean;\n floating: boolean;\n distance: number;\n padding: Padding;\n position: 'top' | 'bottom';\n};\n\n/**\n * Default options for i18n module.\n */\nconst defaultOptions: Partial<CaptionsOptions> = {\n renderer: CaptionsRenderer,\n defaultLocale: 'en',\n fontFile: './caper/font/Sans.fnt',\n fontName: 'Sans',\n fontSizeMultiplier: 1,\n maxWidth: 0.8,\n textColor: 0xffffff,\n backgroundColor: 0x0,\n backgroundAlpha: 0.4,\n enabled: true,\n floating: false,\n distance: 0,\n padding: { top: 20, left: 0, bottom: 20, right: 0 },\n position: 'top',\n};\n\nfunction resolveMaxWidth(value: number, appWidth: number) {\n if (value <= 0) {\n return 0;\n }\n if (value > 0 && value <= 1) {\n return appWidth * value;\n }\n return value;\n}\n\n/**\n * Interface for i18n module.\n */\nexport interface ICaptionsPlugin extends IPlugin {\n readonly locale: string;\n view: Container;\n enabled: boolean;\n floating: boolean;\n distance: number;\n padding: Padding;\n position: 'top' | 'bottom';\n backgroundColor: number;\n textColor: number;\n backgroundAlpha: number;\n fontSizeMultiplier: number;\n maxWidth: number;\n options: Partial<CaptionsOptions>;\n\n setLocale(localeId: string): Promise<string>;\n\n loadLocale(localeId: string): Promise<void>;\n\n render(): void;\n}\n\n/**\n * i18n module class.\n */\nexport class CaptionsPlugin extends Plugin<CaptionsOptions> implements ICaptionsPlugin {\n public readonly id = 'captions';\n public view: Container = new Container();\n public renderer: ICaptionRenderer;\n private _dicts: Record<string, CaptionsDict> = {};\n private _locales: string[];\n private _activeCaptionLine = -1;\n private _activeCaptionTime = 0;\n\n private _locale: string;\n\n /**\n * Getter for locale.\n */\n get locale(): string {\n return this._locale;\n }\n\n private _originalOptions: CaptionsOptions;\n\n get options(): CaptionsOptions {\n return this._options;\n }\n\n set options(value: Partial<CaptionsOptions>) {\n this._options = { ...this._options, ...value };\n\n if (value.padding) {\n this._options.padding = ensurePadding(value.padding);\n }\n }\n\n private _activeCaptionId?: string;\n\n get activeCaptionId() {\n return this._activeCaptionId;\n }\n\n private _paused: boolean = false;\n\n get paused(): boolean {\n return this._paused;\n }\n\n set paused(value: boolean) {\n this._paused = value;\n }\n\n get floating(): boolean {\n return this.options.floating;\n }\n\n set floating(value: boolean) {\n this.options.floating = value;\n this.updateRenderer();\n }\n\n public get enabled(): boolean {\n return this.options.enabled;\n }\n\n set enabled(value: boolean) {\n this.options.enabled = value;\n if (this.enabled) {\n this.view.visible = true;\n } else {\n this.view.visible = false;\n }\n }\n\n public get position(): 'top' | 'bottom' {\n return this.options.position;\n }\n\n public set position(value: 'top' | 'bottom') {\n this.options.position = value;\n this.renderer.updateSettings();\n }\n\n set backgroundColor(value: number) {\n this.options.backgroundColor = value;\n this.updateRenderer();\n }\n\n set textColor(value: number) {\n this.options.textColor = value;\n this.updateRenderer();\n }\n\n set backgroundAlpha(value: number) {\n this.options.backgroundAlpha = value;\n this.updateRenderer();\n }\n\n get padding(): Padding {\n return this.options.padding;\n }\n\n set padding(value: Partial<Padding> | PointLike) {\n this.options.padding = ensurePadding(value);\n this.updateRenderer();\n }\n\n get distance(): number {\n return this.options.distance;\n }\n\n set distance(value: number) {\n this.options.distance = value;\n this.updateRenderer();\n }\n\n public get fontSizeMultiplier(): number {\n return this.options.fontSizeMultiplier;\n }\n\n public set fontSizeMultiplier(value: number) {\n this.options.fontSizeMultiplier = value;\n this.renderer.resize();\n }\n\n public get maxWidth(): number {\n return this.options.maxWidth;\n }\n\n public set maxWidth(value: number) {\n this.options.maxWidth = resolveMaxWidth(value, this.app.size.width);\n this.renderer?.resize();\n }\n\n get list(): CaptionsDict {\n return this._dicts[this._locale];\n }\n\n get debug(): boolean {\n return isDebug;\n }\n\n /**\n * Initializes the i18n module.\n * sets the default locale and loads the locale files.\n * @param _app\n * @param options The i18n options.\n * @returns Promise<void>\n */\n public async initialize(options: Partial<CaptionsOptions>): Promise<void> {\n this._options = {\n ...defaultOptions,\n ...options,\n } as CaptionsOptions;\n\n this._originalOptions = { ...this._options };\n\n if (options?.padding) {\n this._options.padding = ensurePadding(options.padding);\n }\n\n this._locale = this.app.i18n.locale;\n this._locales = this.app.i18n.locales;\n\n if (this._options.fontFile) {\n await Assets.load(this._options.fontFile);\n }\n\n if (this._options?.files?.length > 0) {\n const files = this._options.files.filter((file) => this._locales.includes(file.id));\n for (const file of files) {\n await this.loadLocale(file.id);\n }\n }\n\n this.addSignalConnection(this.app.onResize.connect(this.handleResize, 'highest'));\n }\n\n private handleResize() {\n this.maxWidth = this._originalOptions.maxWidth;\n }\n\n public postInitialize(): void {\n this.app.i18n.onLocaleChanged.connect(this._handleLocaleChange);\n this.app.voiceover.onVoiceOverStart.connect(this._handleVoiceOverStart);\n this.app.voiceover.onVoiceOverPaused.connect(this._handleVoiceOverPaused);\n this.app.voiceover.onVoiceOverResumed.connect(this._handleVoiceOverResumed);\n this.app.voiceover.onVoiceOverComplete.connect(this._handleVoiceoverComplete);\n this.app.voiceover.onVoiceOverStopped.connect(this._handleVoiceoverStopped);\n\n this.app.stage.addChild(this.view);\n this._options.maxWidth = resolveMaxWidth(this._originalOptions.maxWidth, this.app.size.width);\n const RendererClass: CaptionRendererConstructor = this.options.renderer;\n this.renderer = this.view.addChild(new RendererClass(this)) as CaptionsRenderer;\n\n this.app.ticker.add(this.update);\n this.app.scenes.onSceneChangeStart.connect(this.stopAllCaptions);\n }\n\n /**\n * Sets the locale.\n * If the locale is not loaded, it will load it first.\n * @param localeId The locale id to set.\n * @returns Promise<string>\n */\n async setLocale(localeId: string) {\n if (this._locale === localeId) {\n return this._locale;\n }\n if (this._activeCaptionId) {\n this.stopCaption(this._activeCaptionId);\n }\n this._activeCaptionId = undefined;\n await this._loadAndSetLocale(localeId);\n this._locale = localeId;\n return this._locale;\n }\n\n /**\n * Loads a locale.\n * @param localeId The locale id to load.\n * @returns Promise<void>\n */\n async loadLocale(localeId: string) {\n if (this._locale === 'localeId') {\n return;\n }\n const file = this._options.files.find((file) => localeId === file.id);\n if (!file) {\n Logger.error(`i18n:: Could not find locale file for ${localeId}`);\n return;\n }\n this._dicts[localeId] = file.json\n ? await Assets.load(file.json)\n : await getDynamicModuleFromImportListItem(file as ImportListItem<CaptionsDict>);\n }\n\n render() {\n this.renderer.resize();\n }\n\n update(ticker: Ticker): void {\n if (this._paused) {\n return;\n }\n const dt: number = ticker.deltaMS / 1000;\n const id = this._activeCaptionId;\n if (id) {\n this._activeCaptionTime += dt;\n const ms = this._activeCaptionTime * 1000;\n const cc = this.list[id];\n const n = cc.length;\n for (let i = 0; i < n; i++) {\n if (ms >= cc[i].start && ms < cc[i].end) {\n if (this._activeCaptionLine !== i) {\n this.playLine(id, i);\n }\n break;\n }\n }\n if (ms >= cc[n - 1].end) {\n this.playLine(id, -1);\n }\n }\n }\n\n public playCaption(id: string): void {\n // remove extension from id\n id = this._getId(id);\n this.playLine(id, 0);\n }\n\n public stopCaption(id: string): void {\n // remove extension from id\n id = this._getId(id);\n if (this._activeCaptionId === id) {\n this.playLine(id, -1);\n }\n }\n\n public stopAllCaptions(): void {\n this.renderer?.stop();\n this._activeCaptionId = undefined;\n this._activeCaptionLine = -1;\n }\n\n private _getId(id: string) {\n return id.replace(/\\.[^/.]+$/, '');\n }\n\n private updateRenderer() {\n if (!this.enabled) {\n return;\n }\n this.renderer.updateSettings();\n }\n\n private _handleLocaleChange() {\n void this.setLocale(this.app.i18n.locale);\n }\n\n private _handleVoiceOverStart(vo: IAudioInstance) {\n this.playCaption(vo.id);\n }\n\n private _handleVoiceOverPaused() {\n this.paused = true;\n }\n\n private _handleVoiceOverResumed() {\n this.paused = false;\n }\n\n private _handleVoiceoverComplete(vo: IAudioInstance) {\n const id = this._getId(vo?.id || '');\n if (this._activeCaptionId === id) {\n this.stopCaption(id);\n }\n }\n\n private _handleVoiceoverStopped() {\n this.stopAllCaptions();\n }\n\n /**\n * Loads and sets a locale.\n * If the locale is not loaded, it will load it first.\n * @param localeId The locale id to load and set.\n */\n private async _loadAndSetLocale(localeId: string) {\n if (!this._dicts[localeId]) {\n await this.loadLocale(localeId);\n }\n }\n\n private playLine(id: string, index: number) {\n const cc = this.list[id];\n const line = cc ? cc[index] : undefined;\n if (line) {\n if (this._activeCaptionId !== id) {\n this._activeCaptionId = id;\n this._activeCaptionTime = 0;\n this._activeCaptionLine = -1;\n this.renderer?.start();\n }\n if (this._activeCaptionLine !== index) {\n this._activeCaptionLine = index;\n this.renderer?.lineBegin({\n id: this._activeCaptionId,\n ...cc[index],\n });\n }\n } else if (this._activeCaptionId === id && cc) {\n this.renderer?.lineEnd({\n id: this._activeCaptionId,\n ...cc[this._activeCaptionLine],\n });\n this.renderer?.stop();\n this._activeCaptionId = undefined;\n this._activeCaptionLine = -1;\n }\n }\n}\n"],"mappings":";;;;AAgCA,IAAa,IAAb,cAAsC,EAAsC;CAM1E,YAAY,GAAgC;AA4B1C,MA3BA,MAAM,EAAE,YAAY,IAAO,CAAC,EADV,KAAA,SAAA,gBAHW;GAAE,OAAO;GAAG,QAAQ;GAAG,kBAC1B,IAK1B,KAAK,MAAM,KAAK,IAAI,OAAO;GAAE,OAAO,EAAQ;GAAO,QAAQ,CAAC,IAAK,EAAE;GAAE,CAAC,EACtE,KAA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