@caperjs/core 0.4.0 → 0.5.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/build/index.d.mts +29 -0
- package/build/internal/manifest.mjs +2 -2
- package/build/internal/validate.mjs +2 -1
- package/build/plugins/assetTypes.mjs +0 -6
- package/build/plugins/caperConfig.mjs +5 -3
- package/build/plugins/lists.mjs +0 -15
- package/lib/{CaptionsPlugin-cSJj-R9M.js → CaptionsPlugin-CDbGZrN9.js} +11 -11
- package/lib/CaptionsPlugin-CDbGZrN9.js.map +1 -0
- package/lib/{DataAdapter-D2tc6hx9.js → DataAdapter-BTlNzWqg.js} +2 -2
- package/lib/{DataAdapter-D2tc6hx9.js.map → DataAdapter-BTlNzWqg.js.map} +1 -1
- package/lib/{DebugRenderer-CGUKy6Fy.js → DebugRenderer-eSVpon4c.js} +2 -2
- package/lib/{DebugRenderer-CGUKy6Fy.js.map → DebugRenderer-eSVpon4c.js.map} +1 -1
- package/lib/{DevToolsPlugin-B8GX3H9b.js → DevToolsPlugin-Ci6r9j-m.js} +2 -2
- package/lib/{DevToolsPlugin-B8GX3H9b.js.map → DevToolsPlugin-Ci6r9j-m.js.map} +1 -1
- package/lib/{GSAPPlugin-Br9AjuTD.js → GSAPPlugin-C8zo-fyt.js} +2 -2
- package/lib/{GSAPPlugin-Br9AjuTD.js.map → GSAPPlugin-C8zo-fyt.js.map} +1 -1
- package/lib/{LayoutPlugin-BX3OP7pw.js → LayoutPlugin-Cs2lcXKb.js} +4 -4
- package/lib/{LayoutPlugin-BX3OP7pw.js.map → LayoutPlugin-Cs2lcXKb.js.map} +1 -1
- package/lib/{SpinePlugin-C-JDdXpf.js → SpinePlugin-CLgSXBQm.js} +2 -2
- package/lib/{SpinePlugin-C-JDdXpf.js.map → SpinePlugin-CLgSXBQm.js.map} +1 -1
- package/lib/{StatsPlugin-yJlJtoQ2.js → StatsPlugin-D_90U3BG.js} +4 -4
- package/lib/{StatsPlugin-yJlJtoQ2.js.map → StatsPlugin-D_90U3BG.js.map} +1 -1
- package/lib/{VoiceOverPlugin-DjSZp4Ko.js → VoiceOverPlugin-CAE1dtOw.js} +33 -33
- package/lib/{VoiceOverPlugin-DjSZp4Ko.js.map → VoiceOverPlugin-CAE1dtOw.js.map} +1 -1
- package/lib/caper.mjs +87 -87
- package/lib/caper.mjs.map +1 -1
- package/lib/{const-C3sxeYhl.js → const-BTDpIdRO.js} +192 -199
- package/lib/const-BTDpIdRO.js.map +1 -0
- package/lib/display/Container.d.ts +1 -28
- package/lib/display/Container.d.ts.map +1 -1
- package/lib/display/ParticleContainer.d.ts +20 -29
- package/lib/display/ParticleContainer.d.ts.map +1 -1
- package/lib/display/ParticleContainer.test.d.ts +2 -0
- package/lib/display/ParticleContainer.test.d.ts.map +1 -0
- package/lib/display/SpineAnimation.d.ts +1 -2
- package/lib/display/SpineAnimation.d.ts.map +1 -1
- package/lib/display/SpineAnimation.test.d.ts +1 -0
- package/lib/display/SpineAnimation.test.d.ts.map +1 -0
- package/lib/mixins/factory/const.d.ts.map +1 -1
- package/lib/mixins/focus.d.ts.map +1 -1
- package/lib/mixins/index.d.ts +1 -0
- package/lib/mixins/index.d.ts.map +1 -1
- package/lib/mixins/lifecycle.d.ts +56 -0
- package/lib/mixins/lifecycle.d.ts.map +1 -0
- package/lib/plugins/FullScreenPlugin.d.ts.map +1 -1
- package/lib/plugins/KeyboardPlugin.d.ts.map +1 -1
- package/lib/plugins/Plugin.d.ts.map +1 -1
- package/lib/plugins/WebEventsPlugin.d.ts +1 -0
- package/lib/plugins/WebEventsPlugin.d.ts.map +1 -1
- package/lib/plugins/audio/AudioInstance.d.ts +3 -3
- package/lib/plugins/audio/AudioInstance.d.ts.map +1 -1
- package/lib/plugins/captions/CaptionsRenderer.d.ts.map +1 -1
- package/lib/plugins/focus/FocusManagerPlugin.d.ts.map +1 -1
- package/lib/{registries-BfV-VF7a.js → registries-nN_hU44y.js} +109 -77
- package/lib/registries-nN_hU44y.js.map +1 -0
- package/lib/utils/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/core/Application.ts +2 -2
- package/src/display/Container.ts +5 -72
- package/src/display/ParticleContainer.test.ts +127 -0
- package/src/display/ParticleContainer.ts +28 -62
- package/src/display/SpineAnimation.test.ts +79 -0
- package/src/display/SpineAnimation.ts +4 -6
- package/src/mixins/factory/const.ts +2 -1
- package/src/mixins/focus.ts +0 -2
- package/src/mixins/index.ts +4 -0
- package/src/mixins/lifecycle.ts +160 -0
- package/src/plugins/DataAdapter.ts +1 -1
- package/src/plugins/FullScreenPlugin.test.ts +9 -0
- package/src/plugins/FullScreenPlugin.ts +0 -1
- package/src/plugins/KeyboardPlugin.ts +0 -1
- package/src/plugins/Plugin.ts +0 -2
- package/src/plugins/TimerPlugin.ts +1 -1
- package/src/plugins/WebEventsPlugin.test.ts +13 -0
- package/src/plugins/WebEventsPlugin.ts +12 -1
- package/src/plugins/audio/AudioInstance.ts +2 -2
- package/src/plugins/captions/CaptionsPlugin.test.ts +48 -3
- package/src/plugins/captions/CaptionsPlugin.ts +5 -5
- package/src/plugins/captions/CaptionsRenderer.ts +0 -1
- package/src/plugins/focus/FocusManagerPlugin.ts +0 -1
- package/src/ui/Input.ts +2 -2
- package/src/utils/types.ts +0 -1
- package/src/version.ts +1 -1
- package/lib/CaptionsPlugin-cSJj-R9M.js.map +0 -1
- package/lib/const-C3sxeYhl.js.map +0 -1
- package/lib/registries-BfV-VF7a.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"const-C3sxeYhl.js","names":[],"sources":["../src/utils/debug.ts","../src/utils/number.ts","../src/display/ParticleContainer.ts","../src/display/Svg.ts","../src/mixins/factory/utils.ts","../src/display/AnimatedSprite.ts","../src/display/SpineAnimation.ts","../src/mixins/focus.ts","../src/mixins/interaction.ts","../src/ui/Button.ts","../src/ui/FlexContainer.ts","../src/ui/Toast.ts","../src/ui/Toaster.ts","../src/ui/UICanvas.ts","../src/mixins/factory/registry.ts","../src/mixins/factory/ui-registry.ts","../src/mixins/factory/schema.ts","../src/mixins/factory/const.ts"],"sourcesContent":["import { Graphics, Text } from 'pixi.js';\n\n// --- Color palette ---\nexport const DebugColors = {\n bounds: 0x00ffff, // cyan — container bounds\n innerBounds: 0x00ff00, // green — content/child bounds\n outerBounds: 0xff0000, // red — outer/padding bounds\n direction: 0xffff00, // yellow — flow direction indicators\n gap: 0xff00ff, // magenta — gap/spacing fills\n region: 0x0078ff, // blue — grid regions\n} as const;\n\nexport const DebugAlpha = {\n stroke: 0.6,\n fill: 0.1,\n fillActive: 0.2,\n crosshair: 0.5,\n} as const;\n\n/**\n * Creates a Graphics object pre-configured for debug overlays.\n * Non-interactive, excluded from layout, labeled for identification.\n */\nexport function createDebugGraphics(label?: string): Graphics {\n const g = new Graphics();\n g.eventMode = 'none';\n g.interactiveChildren = false;\n g.layout = false;\n g.label = label ?? 'DebugGraphics';\n return g;\n}\n\n/**\n * Creates a small monospace Text label for debug overlays.\n * Dark stroke ensures readability over any background.\n */\nexport function createDebugLabel(text: string, color: number = DebugColors.bounds): Text {\n const label = new Text({\n text,\n style: {\n fontFamily: 'monospace',\n fontSize: 10,\n fill: color,\n stroke: { color: 0x000000, width: 2 },\n },\n });\n label.eventMode = 'none';\n label.layout = false;\n label.label = 'DebugLabel';\n return label;\n}\n\n// --- Registry ---\n// Tracks active debug items. A future DebugPanel can iterate\n// getDebugRegistry() to render a color → label legend.\ntype DebugEntry = { label: string; color: number };\nconst _registry = new Map<string, DebugEntry>();\n\nexport function registerDebug(id: string, label: string, color: number): void {\n _registry.set(id, { label, color });\n}\n\nexport function unregisterDebug(id: string): void {\n _registry.delete(id);\n}\n\nexport function getDebugRegistry(): ReadonlyMap<string, DebugEntry> {\n return _registry;\n}\n","export function getZeroPaddedNumber(num: number, zeroPad: number = 0): string {\n return num.toString().padStart(zeroPad, '0');\n}\n","import { DestroyOptions, ParticleContainerOptions, ParticleContainer as PIXIParticleContainer, Ticker } from 'pixi.js';\n\nimport { Application } from '../core/Application';\nimport { Signal } from '../signals';\nimport type { AppTypeOverrides, Size } from '../utils';\nimport { bindAllMethods } from '../utils';\n\n/**\n * Configuration for the Container class.\n */\nexport interface ParticleContainerConfig extends ParticleContainerOptions {\n autoUpdate: boolean;\n priority: number;\n}\n\nexport const ParticleContainerConfigKeys: (keyof ParticleContainerConfig)[] = ['autoUpdate', 'priority'];\n\nconst defaultConfig: ParticleContainerConfig = { autoUpdate: true, priority: 0 };\n\nexport interface IParticleContainer {\n app: AppTypeOverrides['App'];\n\n onDestroy: Signal<() => void>;\n\n destroy(options?: DestroyOptions): void;\n\n added(): Promise<void> | void;\n\n update(ticker?: Ticker | number): void;\n}\n\n/**\n * The Container class extends the _Container class (which includes the Animated and Factory mixins) and implements the IContainer interface.\n * It represents a container for PIXI.js display objects.\n */\nexport class ParticleContainer extends PIXIParticleContainer implements IParticleContainer {\n onDestroy: Signal<() => void> = new Signal();\n static __caper_method_binding_root = true;\n private __config: ParticleContainerConfig;\n\n /**\n * The constructor for the Container class.\n * @param config - The configuration for the container.\n */\n constructor(config: Partial<ParticleContainerConfig> = {}) {\n super(config);\n this.__config = { ...defaultConfig, ...config };\n // Bind all methods of this class to the current instance.\n bindAllMethods(this);\n // Add an event listener for the 'added' event.\n this.on('added', this._added);\n this.on('removed', this._removed);\n }\n\n /**\n * Get the application instance.\n */\n public get app(): AppTypeOverrides['App'] {\n return Application.getInstance() as AppTypeOverrides['App'];\n }\n /**\n * Update the container. This method is meant to be overridden by subclasses.\n * @param ticker\n */\n public update(ticker?: Ticker | number) {\n void ticker;\n }\n\n /**\n * Resize the container. This method is meant to be overridden by subclasses.\n * @param size\n */\n public resize(size?: Size) {\n void size;\n }\n\n /**\n * This method is called when the container is added to the stage. It is meant to be overridden by subclasses.\n */\n public added() {}\n\n destroy(options?: DestroyOptions): void {\n if (this.__config.autoUpdate) {\n this.app.ticker.remove(this.update, this);\n }\n this.onDestroy.emit();\n super.destroy(options);\n }\n\n public removed() {}\n /**\n * This method is called when the container is added to the stage. It sets up auto-resizing and auto-updating if enabled.\n */\n private _added() {\n if (this.__config.autoUpdate) {\n this.app.ticker.add(this.update, this, this.__config.priority);\n }\n this.added();\n }\n\n private _removed() {\n if (this.__config.autoUpdate) {\n this.app.ticker.remove(this.update, this);\n }\n this.removed();\n }\n}\n","import { Assets, Graphics, GraphicsContext } from 'pixi.js';\n\nexport class Svg extends Graphics {\n constructor(ctx: string | GraphicsContext) {\n super(typeof ctx === 'string' ? Assets.get(ctx) : ctx);\n const bounds = this.getLocalBounds();\n this.pivot.set((bounds.x + bounds.width) / 2, (bounds.y + bounds.height) / 2);\n }\n}\n","import { Assets, Graphics, Sprite, Spritesheet, Texture } from 'pixi.js';\nimport { Logger, PointLike, resolvePointLike } from '../../utils';\n\nimport { Application } from '../../core/Application';\nimport { PositionProps, ScaleProps, TextureProps } from './props';\n\nlet errorTexture: Texture | undefined;\n\nexport function resolveUnknownKeys(props: any, entity: any) {\n for (const key in props) {\n try {\n (entity as any)[key] = props[key];\n } catch (e) {\n Logger.warn(`Error setting property ${key}`, e);\n }\n }\n}\n\nexport function getErrorTexture() {\n if (!errorTexture) {\n const gfx = new Graphics();\n gfx.rect(0, 0, 100, 100);\n gfx.fill({ color: 0xff0000 });\n gfx.stroke({ color: 0xffffff, width: 1, alignment: 0 });\n // draw an X across the rectangle\n gfx.moveTo(0, 0);\n gfx.lineTo(100, 100);\n gfx.moveTo(100, 0);\n gfx.lineTo(0, 100);\n gfx.stroke({ color: 0xffffff, width: 2, alignment: 0.5 });\n errorTexture = Application.getInstance().renderer.generateTexture(gfx);\n gfx.destroy();\n }\n return errorTexture;\n}\n\nexport function resolveTexture(props?: Partial<TextureProps>): Texture {\n let texture: Texture | undefined;\n const asset = props?.asset;\n const assetAsString = asset as string;\n const sheet = props?.sheet;\n if (asset instanceof Texture) {\n texture = asset;\n } else if (!sheet || sheet?.length === 0) {\n if (Assets.cache.has(assetAsString)) {\n texture = Assets.get(assetAsString)!;\n } else if (Assets.get(assetAsString)) {\n texture = Assets.get(assetAsString).texture!;\n } else {\n Logger.error('Asset \"' + asset + '\" not loaded into Pixi cache');\n texture = getErrorTexture();\n //throw new Error('Asset \"' + asset + '\" not loaded into Pixi cache');\n }\n } else {\n if (!Assets.get(sheet)) {\n // throw new Error('Spritesheet \"' + sheet + '\" not loaded into Pixi cache');\n Logger.error('Spritesheet \"' + sheet + '\" not loaded into Pixi cache');\n return getErrorTexture();\n } else {\n const spriteSheet: Spritesheet = Assets.get(sheet) as Spritesheet;\n const textures = spriteSheet.textures;\n if (textures !== undefined) {\n // eslint-disable-next-line no-prototype-builtins\n if (textures.hasOwnProperty(assetAsString)) {\n texture = textures[assetAsString];\n } else if (spriteSheet.linkedSheets !== undefined && spriteSheet.linkedSheets.length > 0) {\n for (const linkedSheet of spriteSheet.linkedSheets) {\n // eslint-disable-next-line no-prototype-builtins\n if (linkedSheet.textures !== undefined && linkedSheet.textures.hasOwnProperty(assetAsString)) {\n texture = linkedSheet.textures[assetAsString];\n break;\n }\n }\n if (texture === undefined) {\n Logger.error(\n 'Asset \"' + asset + '\" not found inside spritesheet \"' + asset + \"' or any of its linked sheets\",\n );\n texture = getErrorTexture();\n }\n } else {\n Logger.error('Asset \"' + asset + '\" not found inside spritesheet \"' + sheet + \"'\");\n texture = getErrorTexture();\n }\n } else {\n Logger.error('Spritesheet \"' + sheet + '\" loaded but textures arent?!');\n texture = getErrorTexture();\n }\n }\n }\n return texture || new Sprite().texture;\n}\n\nexport function resolvePosition(props: Partial<PositionProps>, entity: any) {\n const pos = resolvePointLike(props.position, false, props.x, props.y);\n entity.x = pos.x;\n entity.y = pos.y;\n}\n\nexport function resolveScale(props: Partial<ScaleProps>, entity: any) {\n if (!props) {\n return;\n }\n if (props.scale === undefined) {\n if (props.scaleX === undefined && props.scaleY === undefined) {\n return;\n }\n if (props.scaleX === undefined) {\n props.scaleX = 1;\n }\n if (props.scaleY === undefined) {\n props.scaleY = 1;\n }\n }\n const scale = resolvePointLike(props.scale, false, props.scaleX, props.scaleY);\n entity.scale.set(scale.x, scale.y);\n}\n\nexport function resolveAnchor(anchor: PointLike | undefined, entity: any) {\n if (anchor !== undefined) {\n const anchorPoint = resolvePointLike(anchor);\n entity.anchor.set(anchorPoint.x, anchorPoint.y);\n }\n}\n\nexport function resolvePivot(pivot: PointLike | undefined, entity: any) {\n if (pivot !== undefined) {\n const pivotPoint = resolvePointLike(pivot);\n entity.pivot.set(pivotPoint.x, pivotPoint.y);\n }\n}\n","import { AnimatedSprite as PIXIAnimatedSprite, Texture, Ticker } from 'pixi.js';\nimport type { AnimatedSpriteProps } from '../mixins/factory/props';\nimport { resolveTexture } from '../mixins/factory/utils';\nimport { Signal } from '../signals';\nimport {\n bindAllMethods,\n getFirstMapEntry,\n getLastMapEntry,\n getNextMapEntry,\n getPreviousMapEntry,\n getZeroPaddedNumber,\n type SpritesheetAsset,\n} from '../utils';\n\nexport class AnimatedSprite extends PIXIAnimatedSprite {\n onAnimationChange: Signal<(currentAnimation: string) => void> = new Signal();\n onAnimationStart: Signal<() => void> = new Signal();\n onAnimationStop: Signal<() => void> = new Signal();\n onAnimationLoop: Signal<() => void> = new Signal();\n onAnimationComplete: Signal<() => void> = new Signal();\n onAnimationFrameChange: Signal<() => void> = new Signal();\n public defaultTexturePrefix: string = '';\n public defaultSheet: string | undefined;\n public defaultAnimation: string;\n public defaultAnimationSpeed: number;\n public defaultZeroPad: number | undefined;\n public autoPlay: boolean;\n public currentAnimation: string;\n protected _animations: Map<string, Texture[]>;\n\n constructor(protected config?: Partial<AnimatedSpriteProps>) {\n // get default animation\n const animations = config?.animations ?? {};\n const defaultAnimationName = config?.animation ?? Object.keys(animations)[0];\n const defaultAnimation = animations[defaultAnimationName as string];\n const defaultSheet = config?.sheet;\n const defaultTexturePrefix = config?.texturePrefix || '';\n const defaultZeroPad = config?.zeroPad;\n const defaultStartIndex = config?.startIndex ?? 0;\n\n super(\n AnimatedSprite.generateTexturesFromProps(\n defaultAnimationName,\n defaultAnimation,\n defaultTexturePrefix,\n defaultSheet,\n defaultZeroPad,\n defaultStartIndex,\n ),\n config?.autoUpdate !== false,\n );\n bindAllMethods(this);\n this.defaultSheet = defaultSheet;\n this.defaultTexturePrefix = defaultTexturePrefix;\n this.defaultZeroPad = defaultZeroPad;\n this._generateAnimations();\n this.currentAnimation = this.defaultAnimation = defaultAnimationName;\n this.autoPlay = config?.autoPlay ?? true;\n this.loop = config?.loop ?? true;\n this.updateAnchor = config?.updateAnchor ?? false;\n this.animationSpeed = this.defaultAnimationSpeed = config?.animationSpeed ?? 1;\n this.on('added', this._added);\n }\n\n protected _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 speed(): number {\n return this.animationSpeed;\n }\n\n set speed(value: number) {\n this.animationSpeed = this.defaultAnimationSpeed = value;\n }\n\n protected _isReversed: boolean = false;\n\n get isReversed(): boolean {\n return this._isReversed;\n }\n\n static generateTexturesFromProps(\n animationName: string,\n props?: Partial<AnimatedSpriteProps>,\n defaultTexturePrefix = '',\n defaultSheet: SpritesheetAsset | undefined = undefined,\n defaultZeroPad?: number,\n defaultStartIndex?: number,\n ): Texture[] {\n const textures: Texture[] = [];\n let asset = '';\n const sheet = props?.sheet ?? defaultSheet;\n if (props?.numFrames > 1) {\n const idx = props?.startIndex ?? defaultStartIndex ?? 0;\n for (let i = idx; i < idx + props?.numFrames; i++) {\n asset = `${defaultTexturePrefix}${props?.texturePrefix ?? animationName}${getZeroPaddedNumber(i, props?.zeroPad ?? defaultZeroPad)}`;\n textures.push(\n resolveTexture({\n asset,\n sheet,\n }),\n );\n }\n } else {\n asset = `${defaultTexturePrefix}${props?.texturePrefix ?? animationName}`;\n textures.push(\n resolveTexture({\n asset,\n sheet,\n }),\n );\n }\n return textures;\n }\n\n reverse() {\n this._isReversed = !this._isReversed;\n if (this._isReversed) {\n this.setAnimation(`${this.currentAnimation}_reverse`);\n } else {\n this.setAnimation(this.currentAnimation.split('_reverse')[0]);\n }\n }\n\n setAnimation(animationName: string, autoPlay: boolean = true) {\n if (!this._animations.has(animationName)) {\n throw new Error(`Animation ${animationName} does not exist`);\n }\n this.textures = this._animations.get(animationName) as Texture[];\n this.currentAnimation = animationName;\n const animSpeed = this.config?.animations?.[animationName.split('_reverse')[0]]?.animationSpeed;\n if (animSpeed) {\n this.animationSpeed = animSpeed;\n } else {\n this.animationSpeed = this.defaultAnimationSpeed;\n }\n this.onAnimationChange.emit(animationName);\n if (autoPlay) {\n this.play();\n }\n }\n\n play() {\n super.play();\n this.onAnimationStart?.emit();\n }\n\n stop() {\n super.stop();\n this.onAnimationStop?.emit();\n }\n\n nextAnimation() {\n const entry = getNextMapEntry(this._animations, this.currentAnimation) ?? getFirstMapEntry(this._animations);\n if (entry) {\n this.setAnimation(entry[0]);\n }\n }\n\n previousAnimation() {\n const entry = getPreviousMapEntry(this._animations, this.currentAnimation) ?? getLastMapEntry(this._animations);\n if (entry) {\n this.setAnimation(entry[0]);\n }\n }\n\n update(ticker: Ticker) {\n if (this._paused) {\n return;\n }\n super.update(ticker);\n }\n\n private _generateAnimations() {\n this._animations = new Map();\n const animations = this.config?.animations ?? {};\n if (animations) {\n for (const [key, value] of Object.entries(animations)) {\n this._animations.set(\n key,\n AnimatedSprite.generateTexturesFromProps(\n key,\n value,\n this.defaultTexturePrefix,\n this.defaultSheet,\n this.defaultZeroPad,\n ),\n );\n }\n if (this.config?.reversible) {\n for (const [key, value] of Object.entries(animations)) {\n const textures = AnimatedSprite.generateTexturesFromProps(\n key,\n value,\n this.defaultTexturePrefix,\n this.defaultSheet,\n this.defaultZeroPad,\n );\n textures.reverse();\n this._animations.set(`${key}_reverse`, textures);\n }\n }\n }\n }\n\n private _added() {\n this.onLoop = () => {\n this.onAnimationLoop.emit();\n };\n this.onComplete = () => {\n this.onAnimationComplete.emit();\n };\n this.onFrameChange = () => {\n this.onAnimationFrameChange.emit();\n };\n\n if (this.autoPlay) {\n this.play();\n }\n }\n}\n","import { type AnimationStateListener, type Event, type TrackEntry } from '@esotericsoftware/spine-core';\nimport { Application } from '../core/Application';\nimport type { SpineProps } from '../mixins/factory/props';\nimport { Factory } from '../mixins/factory/Factory';\nimport { WithSignals } from '../mixins/signals';\nimport { Signal } from '../signals';\nimport { type AppTypeOverrides, bindAllMethods, Spine } from '../utils';\n\nconst _SpineAnimation = WithSignals(Factory());\n\nexport interface ISpineAnimation<ANames extends string = string> extends InstanceType<typeof _SpineAnimation> {\n readonly spine: Spine;\n readonly animationNames: ANames[];\n readonly app: AppTypeOverrides['App'];\n readonly onAnimationComplete: Signal<(entry: TrackEntry) => void>;\n readonly onAnimationStart: Signal<(entry: TrackEntry) => void>;\n readonly onAnimationInterrupt: Signal<(entry: TrackEntry) => void>;\n readonly onAnimationDispose: Signal<(entry: TrackEntry) => void>;\n readonly onAnimationEnd: Signal<(entry: TrackEntry) => void>;\n readonly onAnimationEvent: Signal<(entry: TrackEntry, event: Event) => void>;\n readonly onPaused: Signal<(entry: TrackEntry | null) => void>;\n readonly onResumed: Signal<(entry: TrackEntry | null) => void>;\n setAnimation(name: ANames, loop?: boolean, trackIndex?: number): void;\n getCurrentAnimation(trackIndex?: number): ANames;\n pause(): void;\n resume(): void;\n togglePause(): void;\n}\n\nexport class SpineAnimation<ANames extends string = string> extends _SpineAnimation {\n spine: Spine;\n paused: boolean;\n\n onAnimationComplete: Signal<(entry: TrackEntry) => void> = new Signal();\n onAnimationStart: Signal<(entry: TrackEntry) => void> = new Signal();\n onAnimationInterrupt: Signal<(entry: TrackEntry) => void> = new Signal();\n onAnimationDispose: Signal<(entry: TrackEntry) => void> = new Signal();\n onAnimationEnd: Signal<(entry: TrackEntry) => void> = new Signal();\n onAnimationEvent: Signal<(entry: TrackEntry, event: Event) => void> = new Signal();\n\n onPaused: Signal<(entry: TrackEntry | null) => void> = new Signal();\n onResumed: Signal<(entry: TrackEntry | null) => void> = new Signal();\n\n protected _stateListener: AnimationStateListener;\n\n get app(): AppTypeOverrides['App'] {\n return Application.getInstance();\n }\n\n get animationNames(): ANames[] {\n return this.spine.state.data.skeletonData.animations.map((a) => a.name) as ANames[];\n }\n\n get currentEntry() {\n return this.spine.state.getCurrent(0);\n }\n\n get elapsedAnimationTime() {\n if (this.currentEntry) {\n return this.currentEntry.trackTime;\n }\n return -1;\n }\n\n public constructor(props?: Partial<SpineProps>) {\n super();\n bindAllMethods(this);\n let data = props?.data;\n let spineData: { skeleton: string; atlas: string } | string = '';\n if (typeof data === 'string') {\n // get the spine data from cache\n // check if '.json' is the last part of the asset string, and add it if not\n let ext = data.slice(-5);\n if (ext !== '.json' && ext !== '.skel') {\n ext = '.json';\n } else {\n data = data.substring(0, data.length - 5);\n }\n spineData = { skeleton: data + ext, atlas: data + '.atlas' };\n }\n this.spine = (window as any).Spine.from(spineData);\n this.add.existing(this.spine);\n\n if (props) {\n if (props.autoUpdate !== undefined) this.spine.autoUpdate = props.autoUpdate;\n if (props.animationName) this.setAnimation(props.animationName as ANames, props.loop, props.trackIndex ?? 0);\n }\n\n this.addSignalConnection(this.app.actions('toggle_pause').connect(this.togglePause));\n\n if (props?.paused) {\n this.pause();\n }\n\n this._stateListener = {\n start: this._handleAnimationStart,\n interrupt: this._handleAnimationInterrupt,\n dispose: this._handleAnimationDispose,\n end: this._handleAnimationEnd,\n event: this._handleAnimationEvent,\n complete: this._handleAnimationComplete,\n };\n\n this.spine.state.addListener(this._stateListener);\n }\n\n destroy() {\n this.spine.state.removeListener(this._stateListener);\n super.destroy();\n }\n\n getCurrentAnimation(trackIndex: number = 0): ANames {\n return (this.spine.state.getCurrent(trackIndex)?.animation?.name as ANames) || ('' as ANames);\n }\n\n setAnimation(name: ANames, loop = false, trackIndex: number = 0) {\n this.spine.state.setAnimation(trackIndex, name, loop);\n }\n\n pause() {\n this.paused = true;\n this.spine.autoUpdate = false;\n\n if (this.currentEntry) {\n this.currentEntry.timeScale = 0;\n }\n this.onPaused.emit(this.currentEntry);\n }\n\n resume() {\n this.paused = false;\n this.spine.autoUpdate = true;\n if (this.currentEntry) {\n this.currentEntry.timeScale = 1;\n }\n this.onResumed.emit(this.currentEntry);\n }\n\n togglePause() {\n if (this.paused) {\n this.resume();\n } else {\n this.pause();\n }\n }\n\n // protected methods\n protected _handleAnimationComplete(entry: TrackEntry) {\n this.onAnimationComplete.emit(entry);\n }\n\n protected _handleAnimationStart(entry: TrackEntry) {\n this.onAnimationStart.emit(entry);\n }\n\n protected _handleAnimationInterrupt(entry: TrackEntry) {\n this.onAnimationInterrupt.emit(entry);\n }\n\n protected _handleAnimationDispose(entry: TrackEntry) {\n this.onAnimationDispose.emit(entry);\n }\n\n protected _handleAnimationEnd(entry: TrackEntry) {\n this.onAnimationEnd.emit(entry);\n }\n\n protected _handleAnimationEvent(entry: TrackEntry, event: Event) {\n this.onAnimationEvent.emit(entry, event);\n }\n}\n","import type { DestroyOptions, PointerEvents } from 'pixi.js';\nimport { Container, FederatedEvent } from 'pixi.js';\nimport type { Constructor, PointLike } from '../utils';\n\nimport { Application } from '../core/Application';\nimport type { IFocusable } from '../plugins';\nimport { Signal } from '../signals';\n\n/**\n * The Focusable function is a higher-order function that adds focus-related functionality to a given class.\n *\n * @param {TBase extends Constructor<Container>} Base - The base class to add focus functionality to.\n *\n * @returns {TBase & Constructor<IFocusable>} The modified class with focus functionality.\n */\nexport function Focusable<TBase extends Constructor<Container>>(Base: TBase): TBase & Constructor<IFocusable> {\n return class extends Base implements IFocusable {\n _accessibleDiv: HTMLElement;\n isFocused = false;\n isKeyDown = false;\n focusEnabled = true;\n tabIndex = 0;\n // pixi accessibility options\n accessible = false;\n accessibleType: keyof HTMLElementTagNameMap | undefined = 'button';\n accessibleTitle = 'Focusable';\n accessibleHint = 'Press enter to focus';\n accessiblePointerEvents: PointerEvents = 'auto';\n accessibleChildren = true;\n // signals\n onFocus = new Signal<(focusable: IFocusable) => void>();\n onFocusIn = new Signal<(focusable: IFocusable) => void>();\n onFocusOut = new Signal<(focusable: IFocusable) => void>();\n onBlur = new Signal<(focusable: IFocusable) => void>();\n\n private _eventsDisabled: boolean = false;\n\n constructor(...args: any[]) {\n super(...args);\n this.eventMode = 'static';\n this.on('mouseover', this._onMouseOver);\n this.on('mousedown', this._onMouseDown);\n this.on('click', this._handleClick);\n this.on('tap', this._handleClick);\n }\n\n get app() {\n return Application.getInstance();\n }\n\n public destroy(options?: DestroyOptions): void {\n this.off('mouseover', this._onMouseOver);\n this.off('mousedown', this._onMouseDown);\n this.off('click', this._handleClick);\n this.off('tap', this._handleClick);\n super.destroy(options);\n }\n\n public focusIn() {\n if (this.app.focus.active) {\n // @ts-expect-error Argument of type { type: string; } is not assignable to parameter of type FederatedPointerEvent\n this.emit('pointerover', { type: 'pointerover' });\n }\n }\n\n public blur() {\n if (!this.isKeyDown) {\n window.removeEventListener('keyup', this._handleKeyUp.bind(this));\n }\n }\n\n public focusOut() {\n if (!this.isKeyDown) {\n window.removeEventListener('keyup', this._handleKeyUp.bind(this));\n }\n if (this.app.focus.active) {\n // @ts-expect-error Argument of type { type: string; } is not assignable to parameter of type FederatedPointerEvent\n this.emit('pointerout', { type: 'pointerout' });\n }\n }\n\n public click() {}\n\n public getFocusPosition() {\n return null;\n }\n\n public getFocusArea() {\n return this.getBounds();\n }\n\n public getFocusSize(): PointLike | null {\n return [this.getFocusArea().width, this.getFocusArea().height];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected _onMouseOver(_e: MouseEvent) {\n this.app.focus.setFocus(this);\n }\n\n protected _onMouseDown(e: FederatedEvent) {\n this._maybeEmit('pointerdown', e);\n }\n\n protected _handleClick(e: FederatedEvent) {\n this._maybeEmit('click', e);\n this.click();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected _handleKeyUp(_e: KeyboardEvent) {}\n\n private _maybeEmit(type: string, e: FederatedEvent) {\n if (this._eventsDisabled || e.type) {\n return;\n }\n this._eventsDisabled = true;\n this.emit(type, { type });\n this._eventsDisabled = false;\n }\n } as unknown as TBase & Constructor<IFocusable>;\n}\n\nFocusable.INITTED = false;\n","import type { AllFederatedEventMap, DestroyOptions } from 'pixi.js';\nimport { Container, FederatedEvent } from 'pixi.js';\nimport { Signal } from '../signals';\n\nimport { type Constructor } from '../utils';\n\n// gets all the event names from the PIXI event map\ntype InteractionEventName = keyof AllFederatedEventMap;\n\nexport type InteractionSignal = Signal<(event: FederatedEvent) => void>;\n\n/**\n * Represents an interactive element.\n */\nexport interface IInteractive {\n onInteraction: (eventName: InteractionEventName) => InteractionSignal;\n}\n\n/**\n * Adds interactive functionality to a container.\n *\n * @param {Constructor<Container>} Base - The base container class.\n * @returns {Constructor<IInteractive>} - The extended container class with interactive functionality.\n */\nexport function Interactive<TBase extends Constructor<Container>>(Base: TBase): TBase & Constructor<IInteractive> {\n return class extends Base implements IInteractive {\n private _signals: Map<InteractionEventName, InteractionSignal> = new Map();\n\n constructor(...args: any[]) {\n super(...args);\n this._emitSignal = this._emitSignal.bind(this);\n this.eventMode = 'static';\n }\n\n /**\n * Handles interaction events and returns the corresponding signal.\n *\n * @param {InteractionEventName} eventName - The name of the interaction event.\n * @return {InteractionSignal} The signal associated with the interaction event.\n */\n public onInteraction(eventName: InteractionEventName) {\n if (!this._signals.has(eventName)) {\n const signal = new Signal<(event: FederatedEvent) => void>();\n this._signals.set(eventName, signal);\n this.on(eventName, this._emitSignal);\n }\n return this._signals.get(eventName) as InteractionSignal;\n }\n\n public destroy(options: DestroyOptions): void {\n for (const eventName of this._signals.keys()) {\n this.off(eventName, this._emitSignal);\n }\n this._signals.clear();\n super.destroy(options);\n }\n\n /**\n * Emits a signal with the given event.\n *\n * @param {FederatedEvent} event - The event to emit.\n *\n * @return {void}\n */\n private _emitSignal(event: FederatedEvent) {\n const signalName = event.type as InteractionEventName;\n const signal = this._signals.get(signalName);\n\n if (signal) {\n signal.emit(event);\n }\n }\n } as unknown as TBase & Constructor<IInteractive>;\n}\n","import {\n BitmapText,\n Cursor,\n DestroyOptions,\n FederatedEvent,\n FederatedPointerEvent,\n HTMLText,\n Sprite,\n Text,\n} from 'pixi.js';\n\nimport { type LayoutOptions } from '@pixi/layout';\nimport type { IApplication } from '../core';\nimport { Application } from '../core/Application';\nimport { Factory } from '../mixins/factory/Factory';\nimport type { HTMLTextProps, TextProps } from '../mixins/factory/props';\nimport { Focusable } from '../mixins/focus';\nimport { Interactive } from '../mixins/interaction';\nimport { WithSignals } from '../mixins/signals';\nimport { Signal } from '../signals';\nimport { AudioAsset, bindAllMethods, type SpritesheetAsset, type TextureAsset } from '../utils';\n\nexport type ButtonCallback = (() => void) | (() => Promise<void>);\nexport type ButtonAction = { id: string | number; data?: any };\n\nexport type ButtonActionOrCallback = ButtonAction | ButtonCallback;\n\ntype ButtonTextureId = 'default' | 'hover' | 'active' | 'disabled';\n\nexport interface IButton {\n // signals\n onDown: Signal<() => void>;\n onUp: Signal<() => void>;\n onUpOutside: Signal<() => void>;\n onOut: Signal<() => void>;\n onOver: Signal<() => void>;\n onClick: Signal<() => void>;\n onEnabled: Signal<() => void>;\n onDisabled: Signal<() => void>;\n onDestroy: Signal<() => void>;\n onKeyboardEvent: Signal<(key: string) => void>;\n // visual\n view: Sprite;\n // whether the button is down\n isDown: boolean;\n isOver: boolean;\n //\n id: string;\n}\n\nexport type ButtonConfig = {\n id: string;\n textures: {\n default: TextureAsset;\n hover?: TextureAsset;\n active?: TextureAsset;\n disabled?: TextureAsset;\n };\n sounds?: {\n hover?: AudioAsset;\n out?: AudioAsset;\n down?: AudioAsset;\n click?: AudioAsset;\n };\n actions?: {\n hover?: ButtonActionOrCallback;\n out?: ButtonActionOrCallback;\n down?: ButtonActionOrCallback;\n click?: ButtonActionOrCallback;\n };\n textLabel?: Partial<TextProps | HTMLTextProps> & { type?: 'text' | 'html' | 'bitmap' };\n cursor: Cursor;\n disabledCursor: Cursor;\n sheet: SpritesheetAsset;\n enabled: boolean;\n layout?: Omit<LayoutOptions, 'target'> | null | boolean;\n};\n\nexport const ButtonConfigKeys: (keyof ButtonConfig)[] = [\n 'textures',\n 'sounds',\n 'actions',\n 'cursor',\n 'disabledCursor',\n 'sheet',\n 'enabled',\n 'layout',\n 'textLabel',\n];\n\n// Create a new class that extends Container and includes the Interactive and Focusable mixins.\nconst _Button = Focusable(Interactive(WithSignals(Factory())));\n\n/**\n * @class\n * @extends {Container}\n * A class representing a button.\n */\nexport class Button extends _Button implements IButton {\n // signals\n public onDown = new Signal<() => void>();\n public onUp = new Signal<() => void>();\n public onUpOutside = new Signal<() => void>();\n public onOut = new Signal<() => void>();\n public onOver = new Signal<() => void>();\n public onClick = new Signal<() => void>();\n public onEnabled = new Signal<() => void>();\n public onDisabled = new Signal<() => void>();\n public onKeyboardEvent = new Signal<(key: string) => void>();\n public onDestroy = new Signal<() => void>();\n public id: string;\n // visual\n public view: Sprite;\n // whether the button is down\n public isDown: boolean;\n public isOver: boolean;\n // config\n protected config: ButtonConfig;\n // a set of unique callbacks for when the button is down\n protected _isDownCallbacks: Map<string, () => void> = new Map();\n private _isDownListenerAdded: boolean = false;\n private _pointerId?: number;\n private _textLabel?: Text | HTMLText | BitmapText;\n private _lastClickEvent?: FederatedEvent;\n\n /**\n * The text label of the button.\n * @returns {Text | HTMLText | BitmapText | undefined} The text label instance.\n */\n get textLabel() {\n return this._textLabel;\n }\n\n /**\n * @constructor\n * @param {Partial<ButtonConfig>} config - The configuration for the button.\n */\n constructor(config: Partial<ButtonConfig>) {\n super();\n\n bindAllMethods(this);\n\n this.config = Object.assign(\n {\n id: 'button',\n textures: { default: '' },\n sheet: undefined,\n enabled: true,\n cursor: 'default',\n disabledCursor: 'not-allowed',\n },\n config,\n ) as ButtonConfig;\n\n this.id = this.config.id;\n\n // Allow layout to be set via config, but default to false\n if (config.layout !== undefined) {\n this.layout = config.layout;\n } else {\n this.layout = false;\n }\n\n // Create a sprite with the default texture and add it to the container.\n this.view = this.add.sprite({\n asset: this.config.textures.default,\n sheet: this.config.sheet ?? undefined,\n });\n\n this.cursor = this.config.cursor;\n this.enabled = config.enabled !== false;\n\n if (this.layout?.style.transformOrigin !== 'top left') {\n this.layout = { transformOrigin: 'top left' };\n if (this.app.renderer.layout) {\n this.app.renderer.layout.update(this);\n }\n }\n\n if (this.config.textLabel) {\n this.addLabel(this.config.textLabel);\n }\n\n // Set up interaction handlers.\n // make them high priority so they run before any other interaction handlers\n this.addSignalConnection(\n this.onInteraction('pointerover').connect(this.handlePointerOver, -1),\n this.onInteraction('pointerout').connect(this.handlePointerOut, -1),\n this.onInteraction('pointerup').connect(this.handlePointerUp, -1),\n this.onInteraction('click').connect(this.handleClick, -1),\n this.onInteraction('tap').connect(this.handleClick, -1),\n this.onInteraction('pointerdown').connect(this.handlePointerDown, -1),\n );\n\n this.on('removed', this._resetPressState);\n }\n\n // enabled state\n protected _enabled: boolean;\n\n /**\n * Sets the enabled state of the button.\n * @param {boolean} enabled - Whether the button is enabled.\n */\n public set enabled(enabled: boolean) {\n if (this._enabled === enabled) {\n return;\n }\n this._enabled = enabled;\n this.cursor = this._enabled ? this.config.cursor : this.config.disabledCursor;\n this.focusEnabled = enabled;\n if (this._enabled) {\n this.view.texture = this.make.texture({\n asset: this.config.textures.default,\n sheet: this.config.sheet ?? undefined,\n });\n this.onEnabled.emit();\n } else {\n this._resetPressState();\n this.view.texture = this.make.texture({\n asset: this.config.textures.disabled || this.config.textures.default,\n sheet: this.config.sheet ?? undefined,\n });\n this.onDisabled.emit();\n }\n }\n\n /**\n * Clears any in-progress press: removes the window-level release listener and\n * resets press tracking. Called when the button is disabled, removed, or\n * destroyed mid-press so a stale pointerId can't block future presses.\n */\n private _resetPressState() {\n window.removeEventListener('pointerup', this.handlePointerUpOutside);\n this.off('pointerupoutside', this.handlePointerUpOutside);\n this.isDown = false;\n this._pointerId = undefined;\n }\n\n public addLabel<T extends Text | HTMLText | BitmapText>(\n config: (Partial<TextProps | HTMLTextProps> & { type?: 'text' | 'html' | 'bitmap' }) | T,\n ): T {\n if (config instanceof Text || config instanceof HTMLText || config instanceof BitmapText) {\n config.anchor.set(0.5, 0.5);\n this._textLabel = this.add.existing(config) as T;\n this._textLabel.layout = false;\n } else {\n config.anchor = 0.5;\n switch (config.type) {\n case 'bitmap':\n this._textLabel = this.add.bitmapText({ ...config, layout: false }) as BitmapText;\n break;\n case 'html':\n this._textLabel = this.add.htmlText({ ...config, layout: false }) as HTMLText;\n break;\n default:\n this._textLabel = this.add.text({ ...config, layout: false }) as Text;\n break;\n }\n }\n\n this.positionLabel();\n\n return this._textLabel as T;\n }\n\n public positionLabel() {\n if (this._textLabel) {\n this._textLabel.position.set(this.view.width * 0.5, this.view.height * 0.5);\n }\n }\n\n public get enabled() {\n return this._enabled;\n }\n\n get app(): IApplication {\n return Application.getInstance();\n }\n\n destroy(options?: DestroyOptions) {\n this.onDestroy.emit();\n this._resetPressState();\n if (this._isDownListenerAdded) {\n this.app.ticker.remove(this._handleIsDownCallbacks);\n this._isDownListenerAdded = false;\n }\n super.destroy(options);\n }\n\n focusOut() {\n super.focusOut();\n this.isDown = false;\n this.isOver = false;\n }\n\n blur() {\n super.blur();\n this.isDown = false;\n this.isOver = false;\n }\n\n public getFocusArea() {\n return this.view.getBounds().clone();\n }\n\n addIsDownCallback(callbackId: string, callback: () => void) {\n this._isDownCallbacks.set(callbackId, callback);\n this._checkIsDownCallbacks();\n }\n\n removeIsDownCallback(callbackId: string) {\n this._isDownCallbacks.delete(callbackId);\n this._checkIsDownCallbacks();\n }\n\n setTexture(textureId: ButtonTextureId, texture: TextureAsset) {\n this.config.textures[textureId] = texture;\n if (textureId === 'default') {\n this.view.texture = this.make.texture({\n asset: this.config.textures.default,\n sheet: this.config.sheet,\n });\n }\n\n this.positionLabel();\n }\n\n /**\n * Sets the texture of the button to the hover texture and emits the onOver event.\n */\n protected handlePointerOver() {\n if (!this._enabled) {\n return;\n }\n if (!this.isOver) {\n this.isOver = true;\n }\n if (this.isDown) {\n return;\n }\n this.view.texture = this.make.texture({\n asset: this.config.textures.hover || this.config.textures.default,\n sheet: this.config.sheet,\n });\n this.onOver.emit();\n if (this.config.sounds?.hover) {\n void this.app.audio.play(this.config.sounds.hover, 'sfx');\n }\n if (this.config.actions?.hover) {\n this._doAction(this.config.actions.hover);\n }\n }\n\n /**\n * Sets the texture of the button to the default texture and emits the onOut event.\n */\n protected handlePointerOut() {\n this.isOver = false;\n if (!this._enabled) {\n return;\n }\n if (this.isDown) {\n return;\n }\n this.view.texture = this.make.texture({ asset: this.config.textures.default, sheet: this.config.sheet });\n\n if (this.config.sounds?.out) {\n void this.app.audio.play(this.config.sounds.out, 'sfx');\n }\n this.onOut.emit();\n }\n\n /**\n * Sets the isDown property to true and changes the texture of the button.\n */\n protected handlePointerDown(e: FederatedEvent) {\n if (!this._enabled && !this.isKeyDown) {\n return;\n }\n if (!this.isDown && this._pointerId === undefined) {\n this._pointerId = (e as FederatedPointerEvent).pointerId;\n\n window.removeEventListener('pointerup', this.handlePointerUpOutside);\n this.off('pointerupoutside', this.handlePointerUpOutside);\n\n window.addEventListener('pointerup', this.handlePointerUpOutside);\n this.on('pointerupoutside', this.handlePointerUpOutside);\n\n this.isDown = true;\n this.view.texture = this.make.texture({\n asset: this.config.textures.active || this.config.textures.hover || this.config.textures.default,\n sheet: this.config.sheet,\n });\n this.onDown.emit();\n if (this.config.sounds?.down) {\n void this.app.audio.play(this.config.sounds.down, 'sfx');\n }\n if (this.config.actions?.down) {\n this._doAction(this.config.actions.down);\n }\n }\n }\n\n /**\n * Removes the keyup event listener and emits the onPress and onUp events.\n */\n protected handlePointerUp(e: FederatedEvent) {\n if (!this._enabled || !this.isOver || (e as FederatedPointerEvent).pointerId !== this._pointerId) {\n return;\n }\n window.removeEventListener('pointerup', this.handlePointerUpOutside);\n\n this.view.texture = this.make.texture({ asset: this.config.textures.default, sheet: this.config.sheet });\n this.onUp.emit();\n\n this._pointerId = undefined;\n }\n\n protected handleClick(e?: FederatedEvent) {\n if (!this._enabled) {\n return;\n }\n const pointerId = (e as FederatedPointerEvent | undefined)?.pointerId;\n if (pointerId !== undefined && !this.isDown) {\n // a pointer press that was cancelled (e.g. disabled mid-press) must not click\n return;\n }\n if (e !== undefined && e === this._lastClickEvent) {\n // accessibility dispatches one event instance as both 'click' and 'tap'\n return;\n }\n this._lastClickEvent = e;\n this.isDown = false;\n this.onClick.emit();\n if (this.config.sounds?.click) {\n void this.app.audio.play(this.config.sounds.click, 'sfx');\n }\n if (this.config.actions?.click) {\n this._doAction(this.config.actions.click);\n }\n }\n\n /**\n * Handles the pointer up event.\n */\n protected handlePointerUpOutside(e: PointerEvent | FederatedPointerEvent) {\n if (e.pointerId !== this._pointerId) {\n return;\n }\n const wasEnabled = this._enabled;\n this._resetPressState();\n this.isOver = false;\n if (wasEnabled) {\n this.view.texture = this.make.texture({ asset: this.config.textures.default, sheet: this.config.sheet });\n this.onUpOutside.emit();\n }\n }\n\n private _doAction(action: ButtonActionOrCallback) {\n if (typeof action === 'function') {\n void action();\n } else {\n action.data ??= {};\n if (!action.data.button) {\n action.data.button = this;\n }\n this.app.action(action.id, action.data);\n }\n }\n\n private _checkIsDownCallbacks() {\n // check if there are any callbacks, if there are, add the ticker listener\n if (!this._isDownListenerAdded && this._isDownCallbacks.size > 0) {\n this._isDownListenerAdded = true;\n this.app.ticker.add(this._handleIsDownCallbacks);\n } else if (this._isDownListenerAdded && this._isDownCallbacks.size === 0) {\n this.app.ticker.remove(this._handleIsDownCallbacks);\n this._isDownListenerAdded = false;\n }\n }\n\n private _handleIsDownCallbacks() {\n if (this.isDown) {\n this._isDownCallbacks.forEach((callback) => {\n callback();\n });\n }\n }\n}\n","import type { LayoutOptions, NumberValue } from '@pixi/layout';\nimport { BitmapText, Graphics, Container as PIXIContainer, Text } from 'pixi.js';\nimport { Application } from '../core/Application';\nimport { Container } from '../display/Container';\nimport { Factory } from '../mixins/factory/Factory';\nimport { WithSignals } from '../mixins/signals';\nimport { Signal } from '../signals';\nimport {\n AppTypeOverrides,\n bindAllMethods,\n type ContainerLike,\n createDebugGraphics,\n createDebugLabel,\n DebugAlpha,\n DebugColors,\n registerDebug,\n unregisterDebug,\n} from '../utils';\n\nconst _FlexContainer = WithSignals(Factory());\n\nexport function isText(child: PIXIContainer): child is Text | BitmapText {\n return child instanceof Text || child instanceof BitmapText;\n}\n\nexport interface FlexContainerConfig {\n bindTo?: ContainerLike;\n bindToAppSize?: boolean;\n autoLayoutChildren?: boolean;\n layout?: Omit<LayoutOptions, 'target'> | null | boolean;\n debug?: boolean;\n}\n\nexport const FlexContainerConfigKeys: (keyof FlexContainerConfig)[] = [\n 'bindTo',\n 'bindToAppSize',\n 'autoLayoutChildren',\n 'debug',\n];\n\nexport type FlexWrap = 'wrap' | 'nowrap' | 'wrap-reverse' | undefined;\nexport type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse' | undefined;\nexport type AlignItems = 'center' | 'flex-start' | 'flex-end' | 'stretch' | 'baseline' | undefined;\nexport type JustifyContent =\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n | 'flex-start'\n | 'flex-end'\n | undefined;\n\nexport type SizeNumber = NumberValue | 'auto' | 'intrinsic';\n\nexport class FlexContainer extends _FlexContainer {\n public onLayoutComplete = new Signal<() => void>();\n public config: Partial<FlexContainerConfig>;\n private _debugGraphics: Graphics | null = null;\n private _debugLabel: Text | null = null;\n\n constructor(config: Partial<FlexContainerConfig> = {}) {\n super();\n\n if (!this.app.config.useLayout) {\n throw new Error('You must set useLayout to true in your app config to use FlexContainer');\n }\n\n bindAllMethods(this);\n\n this.config = {\n autoLayoutChildren: true,\n ...config,\n };\n\n // Set up layout\n this.layout = this.createLayout(config);\n\n // Set up event listeners\n this.on('added', this.handleAdded);\n this.on('childAdded', this.handleChildAdded);\n this.on('childRemoved', this.handleChildRemoved);\n\n if (this.config.bindToAppSize) {\n this.app.onResize.connect(this.handleResize);\n }\n\n if (this.config.bindTo && 'on' in this.config.bindTo) {\n (this.config.bindTo as PIXIContainer).on('layout', this.handleBindToResize);\n }\n }\n\n private createLayout(config: Partial<FlexContainerConfig>): Omit<LayoutOptions, 'target'> | null | boolean {\n if (config?.layout === true) {\n config.layout = {};\n }\n const layout: Omit<LayoutOptions, 'target'> | null | boolean = { ...(config?.layout ?? {}) };\n\n if (this.config.bindToAppSize) {\n layout.width = this.app.size.width;\n layout.height = this.app.size.height;\n } else if (this.config.bindTo) {\n layout.width = this.config.bindTo.width;\n layout.height = this.config.bindTo.height;\n }\n\n return layout;\n }\n\n private handleAdded() {\n this.updateLayout();\n }\n\n private _updateLayout() {\n this.app.ticker.addOnce(this.updateLayout);\n }\n\n private handleChildAdded(child: PIXIContainer) {\n if (this.config.autoLayoutChildren) {\n if (!(child.layout as unknown as boolean)) {\n // No layout yet — set isLeaf (original behavior)\n child.layout = { isLeaf: true };\n } else if (isText(child) && !child.layout?.style?.isLeaf) {\n // Text/BitmapText with existing layout props (e.g. marginTop) but missing isLeaf.\n // Without isLeaf, Yoga won't measure the text's intrinsic bounds.\n // The layout setter merges, so existing props are preserved.\n child.layout = { isLeaf: true };\n }\n }\n\n Container.childAdded(child);\n child.on('layout', this._updateLayout);\n this._updateLayout();\n }\n\n private handleChildRemoved(child: PIXIContainer) {\n child.off('layout', this._updateLayout);\n Container.childRemoved(child);\n this._updateLayout();\n }\n\n private handleResize() {\n if (this.config.bindToAppSize) {\n this.layout = {\n width: this.app.size.width,\n height: this.app.size.height,\n };\n }\n this._updateLayout();\n }\n\n private handleBindToResize() {\n if (!this.config.bindTo) return;\n this.layout = {\n width: this.config.bindTo.width,\n height: this.config.bindTo.height,\n };\n this._updateLayout();\n }\n\n public updateLayout() {\n if (this.destroyed || !this.layout || !this.app?.renderer.layout) return;\n this.app.renderer.layout.update(this);\n this.onLayoutComplete.emit();\n if (this.config.debug) {\n this.drawDebug();\n }\n }\n\n public get app(): AppTypeOverrides['App'] {\n return Application.getInstance();\n }\n\n /**\n * Set multiple layout properties at once, triggering a single deferred layout update.\n */\n public configure(styles: Partial<Omit<LayoutOptions, 'target'>>): void {\n this.layout = styles;\n this._updateLayout();\n }\n\n // Convenience getters/setters for common layout properties\n get gap(): number {\n return (this.layout?.style?.gap as number) ?? 0;\n }\n\n set gap(value: number) {\n this.layout = { gap: value };\n this._updateLayout();\n }\n\n get flexWrap(): FlexWrap {\n return this.layout?.style?.flexWrap as FlexWrap;\n }\n\n set flexWrap(value: FlexWrap) {\n this.layout = { flexWrap: value };\n this._updateLayout();\n }\n\n get flexDirection(): FlexDirection {\n return this.layout?.style?.flexDirection as FlexDirection;\n }\n\n set flexDirection(value: FlexDirection) {\n this.layout = { flexDirection: value };\n this._updateLayout();\n }\n\n get alignItems(): AlignItems {\n return this.layout?.style?.alignItems as AlignItems;\n }\n\n set alignItems(value: AlignItems) {\n this.layout = { alignItems: value };\n this._updateLayout();\n }\n\n get justifyContent(): JustifyContent {\n return this.layout?.style?.justifyContent as JustifyContent;\n }\n\n set justifyContent(value: JustifyContent) {\n this.layout = { justifyContent: value };\n this._updateLayout();\n }\n\n get size(): { width: SizeNumber; height: SizeNumber } {\n return {\n width: this.layout?.style?.width as SizeNumber,\n height: this.layout?.style?.height as SizeNumber,\n };\n }\n\n set size(size: { width: SizeNumber; height: SizeNumber } | [SizeNumber, SizeNumber] | SizeNumber) {\n if (Array.isArray(size)) {\n size = { width: size[0], height: size[1] };\n }\n if (typeof size === 'number' || typeof size === 'string') {\n size = { width: size, height: size };\n }\n this.layout = { ...size };\n this._updateLayout();\n }\n\n get layoutWidth(): SizeNumber {\n return this.layout?.style?.width as SizeNumber;\n }\n\n set layoutWidth(width: SizeNumber) {\n this.layout = { width };\n this._updateLayout();\n }\n\n get layoutHeight(): SizeNumber {\n return this.layout?.style?.height as SizeNumber;\n }\n\n set layoutHeight(height: SizeNumber) {\n this.layout = { height };\n this._updateLayout();\n }\n\n // Padding convenience\n get padding(): NumberValue | undefined {\n return this.layout?.style?.padding as NumberValue | undefined;\n }\n\n set padding(value: NumberValue) {\n this.layout = { padding: value };\n this._updateLayout();\n }\n\n get paddingTop(): NumberValue | undefined {\n return this.layout?.style?.paddingTop as NumberValue | undefined;\n }\n\n set paddingTop(value: NumberValue) {\n this.layout = { paddingTop: value };\n this._updateLayout();\n }\n\n get paddingRight(): NumberValue | undefined {\n return this.layout?.style?.paddingRight as NumberValue | undefined;\n }\n\n set paddingRight(value: NumberValue) {\n this.layout = { paddingRight: value };\n this._updateLayout();\n }\n\n get paddingBottom(): NumberValue | undefined {\n return this.layout?.style?.paddingBottom as NumberValue | undefined;\n }\n\n set paddingBottom(value: NumberValue) {\n this.layout = { paddingBottom: value };\n this._updateLayout();\n }\n\n get paddingLeft(): NumberValue | undefined {\n return this.layout?.style?.paddingLeft as NumberValue | undefined;\n }\n\n set paddingLeft(value: NumberValue) {\n this.layout = { paddingLeft: value };\n this._updateLayout();\n }\n\n // Margin convenience\n get margin(): NumberValue | undefined {\n return this.layout?.style?.margin as NumberValue | undefined;\n }\n\n set margin(value: NumberValue) {\n this.layout = { margin: value };\n this._updateLayout();\n }\n\n get marginTop(): NumberValue | undefined {\n return this.layout?.style?.marginTop as NumberValue | undefined;\n }\n\n set marginTop(value: NumberValue) {\n this.layout = { marginTop: value };\n this._updateLayout();\n }\n\n get marginRight(): NumberValue | undefined {\n return this.layout?.style?.marginRight as NumberValue | undefined;\n }\n\n set marginRight(value: NumberValue) {\n this.layout = { marginRight: value };\n this._updateLayout();\n }\n\n get marginBottom(): NumberValue | undefined {\n return this.layout?.style?.marginBottom as NumberValue | undefined;\n }\n\n set marginBottom(value: NumberValue) {\n this.layout = { marginBottom: value };\n this._updateLayout();\n }\n\n get marginLeft(): NumberValue | undefined {\n return this.layout?.style?.marginLeft as NumberValue | undefined;\n }\n\n set marginLeft(value: NumberValue) {\n this.layout = { marginLeft: value };\n this._updateLayout();\n }\n\n // --- Debug visualization ---\n get debug(): boolean {\n return this.config.debug ?? false;\n }\n\n set debug(value: boolean) {\n this.config.debug = value;\n if (value) {\n const uid = `FlexContainer:${this.uid}`;\n registerDebug(uid, this.label || 'FlexContainer', DebugColors.bounds);\n this.drawDebug();\n } else {\n unregisterDebug(`FlexContainer:${this.uid}`);\n if (this._debugGraphics) {\n this._debugGraphics.clear();\n }\n if (this._debugLabel) {\n this._debugLabel.visible = false;\n }\n }\n }\n\n private drawDebug() {\n // Create or re-add debug graphics if orphaned by removeChildren()\n if (!this._debugGraphics || this._debugGraphics.parent !== this) {\n if (!this._debugGraphics) {\n this._debugGraphics = createDebugGraphics(`${this.label ?? 'FlexContainer'}:debug`);\n }\n this.addChild(this._debugGraphics);\n this._debugGraphics.layout = false; // override auto-isLeaf from handleChildAdded\n }\n if (!this._debugLabel || this._debugLabel.parent !== this) {\n if (!this._debugLabel) {\n this._debugLabel = createDebugLabel(this.label || 'FlexContainer', DebugColors.bounds);\n }\n this.addChild(this._debugLabel);\n this._debugLabel.layout = false;\n }\n\n // Update label text in case label changed\n this._debugLabel.text = this.label || 'FlexContainer';\n this._debugLabel.visible = true;\n\n // Ensure debug graphics render on top\n this.setChildIndex(this._debugGraphics, this.children.length - 1);\n this.setChildIndex(this._debugLabel, this.children.length - 1);\n\n this._debugGraphics.clear();\n\n const computedLayout = this.layout?.computedLayout;\n if (!computedLayout) return;\n\n const w = computedLayout.width;\n const h = computedLayout.height;\n const direction = (this.layout?.style?.flexDirection as string) ?? 'row';\n const gap = (this.layout?.style?.gap as number) ?? 0;\n\n // 1. Container bounds (cyan)\n this._debugGraphics\n .rect(0, 0, w, h)\n .stroke({ width: 1, color: DebugColors.bounds, alpha: DebugAlpha.stroke, pixelLine: true });\n\n // 2. Padding visualization (red subtle fill)\n const pt = (this.layout?.style?.paddingTop as number) ?? 0;\n const pr = (this.layout?.style?.paddingRight as number) ?? 0;\n const pb = (this.layout?.style?.paddingBottom as number) ?? 0;\n const pl = (this.layout?.style?.paddingLeft as number) ?? 0;\n if (pt > 0) {\n this._debugGraphics.rect(0, 0, w, pt).fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n if (pb > 0) {\n this._debugGraphics.rect(0, h - pb, w, pb).fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n if (pl > 0) {\n this._debugGraphics.rect(0, pt, pl, h - pt - pb).fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n if (pr > 0) {\n this._debugGraphics\n .rect(w - pr, pt, pr, h - pt - pb)\n .fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n\n // 3. Flex direction arrow (yellow)\n const arrowLen = Math.min(w, h, 40);\n const cx = w / 2;\n const cy = h / 2;\n const isRow = direction === 'row' || direction === 'row-reverse';\n if (isRow) {\n const dir = direction === 'row' ? 1 : -1;\n const startX = cx - (dir * arrowLen) / 2;\n const endX = cx + (dir * arrowLen) / 2;\n this._debugGraphics\n .moveTo(startX, cy)\n .lineTo(endX, cy)\n .moveTo(endX, cy)\n .lineTo(endX - dir * 6, cy - 4)\n .moveTo(endX, cy)\n .lineTo(endX - dir * 6, cy + 4)\n .stroke({ width: 1, color: DebugColors.direction, alpha: 0.8, pixelLine: true });\n } else {\n const dir = direction === 'column' ? 1 : -1;\n const startY = cy - (dir * arrowLen) / 2;\n const endY = cy + (dir * arrowLen) / 2;\n this._debugGraphics\n .moveTo(cx, startY)\n .lineTo(cx, endY)\n .moveTo(cx, endY)\n .lineTo(cx - 4, endY - dir * 6)\n .moveTo(cx, endY)\n .lineTo(cx + 4, endY - dir * 6)\n .stroke({ width: 1, color: DebugColors.direction, alpha: 0.8, pixelLine: true });\n }\n\n // 4. Gap indicators between children (magenta fills)\n if (gap > 0) {\n for (let i = 0; i < this.children.length - 1; i++) {\n const child = this.children[i];\n if (child === this._debugGraphics || child === this._debugLabel) continue;\n if (!child.layout?.computedLayout) continue;\n const cl = child.layout.computedLayout;\n if (isRow) {\n const gapX = cl.left + cl.width;\n this._debugGraphics.rect(gapX, 0, gap, h).fill({ color: DebugColors.gap, alpha: DebugAlpha.fill });\n } else {\n const gapY = cl.top + cl.height;\n this._debugGraphics.rect(0, gapY, w, gap).fill({ color: DebugColors.gap, alpha: DebugAlpha.fill });\n }\n }\n }\n\n // 5. Child bounding boxes (green outlines)\n for (const child of this.children) {\n if (child === this._debugGraphics || child === this._debugLabel) continue;\n if (!child.layout?.computedLayout) continue;\n const cl = child.layout.computedLayout;\n this._debugGraphics\n .rect(cl.left, cl.top, cl.width, cl.height)\n .stroke({ width: 1, color: DebugColors.innerBounds, alpha: 0.4, pixelLine: true });\n }\n\n // Position label at top-left with slight offset\n this._debugLabel.position.set(2, 2);\n }\n\n destroy() {\n // Clean up debug\n if (this.config.debug) {\n unregisterDebug(`FlexContainer:${this.uid}`);\n }\n if (this._debugGraphics) {\n this._debugGraphics.destroy();\n this._debugGraphics = null;\n }\n if (this._debugLabel) {\n this._debugLabel.destroy();\n this._debugLabel = null;\n }\n\n this.off('added', this.handleAdded);\n this.off('childAdded', this.handleChildAdded);\n this.off('childRemoved', this.handleChildRemoved);\n\n if (this.config.bindToAppSize) {\n this.app.onResize.disconnect(this.handleResize);\n }\n\n if (this.config.bindTo && 'off' in this.config.bindTo) {\n (this.config.bindTo as PIXIContainer).off('layout', this.handleBindToResize);\n }\n\n super.destroy();\n }\n}\n","import { gsap } from 'gsap';\nimport { Graphics, Text } from 'pixi.js';\nimport { Container } from '../display/Container';\nimport type { TextStyle } from '../mixins/factory/props';\nimport { WithSignals } from '../mixins/signals';\nimport { Signal } from '../signals';\nimport { Button } from './Button';\nimport { Toaster } from './Toaster';\n\n/**\n * Types of toasts that can be displayed, each with its own color indicator.\n */\nexport type ToastType = 'info' | 'success' | 'warning' | 'error';\n\n/**\n * Position options for the close button within a toast.\n */\nexport type CloseButtonPosition = 'top right' | 'top left';\n\n/**\n * Configuration interface for creating a Toast notification.\n *\n * @example\n * ```typescript\n * // Basic toast with default settings\n * const config: ToastConfig = {\n * message: \"Operation successful!\",\n * type: \"success\"\n * };\n *\n * // Custom styled toast with shadow and close button\n * const config: ToastConfig = {\n * message: \"Custom notification\",\n * backgroundColor: 0x9b59b6,\n * backgroundAlpha: 1,\n * cornerRadius: 8,\n * shadow: {\n * color: 0x000000,\n * alpha: 0.2,\n * offset: { x: 4, y: 4 }\n * },\n * closeButton: {\n * show: true,\n * position: 'top right'\n * }\n * };\n * ```\n */\nexport interface ToastConfig {\n /** Optional custom Toast class to use instead of the default */\n class?: typeof Toast;\n /** The message to display in the toast */\n message: string;\n /** Type of toast, determines the color indicator */\n type?: ToastType;\n /** Duration in milliseconds before auto-closing (if autoClose is true) */\n duration?: number;\n /** Custom text style options */\n style?: TextStyle;\n /** Width of the toast in pixels */\n width?: number;\n /** Height of the toast in pixels */\n height?: number;\n /** Background color in hex format */\n backgroundColor?: number;\n /** Background opacity (0-1) */\n backgroundAlpha?: number;\n /** Corner radius for rounded corners */\n cornerRadius?: number;\n /** Padding around the content */\n padding?: number;\n /** Whether the toast should automatically close after duration */\n autoClose?: boolean;\n /** Custom colors for each toast type's indicator */\n textColors?: Record<ToastType, number>;\n /** Horizontal text alignment */\n textAlign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n verticalAlign?: 'top' | 'middle' | 'bottom';\n /** Width of the colored type indicator bar */\n colorBarWidth?: number;\n /** Shadow configuration for depth effect */\n shadow?: {\n /** Shadow color in hex format */\n color?: number;\n /** Shadow opacity (0-1) */\n alpha?: number;\n /** Shadow offset from the toast */\n offset?: { x: number; y: number };\n };\n /** Close button configuration */\n closeButton?: {\n /** Whether to show the close button */\n show?: boolean;\n /** Position of the close button */\n position?: CloseButtonPosition;\n /** Custom button class to use */\n class?: typeof Button;\n /** Size of the close button */\n size?: number;\n /** Offset from the edges */\n offset?: number;\n };\n}\n\nexport const defaultToastConfig: Partial<ToastConfig> = {\n type: 'info',\n duration: 3000,\n width: 300,\n height: 80,\n backgroundColor: 0x000000,\n backgroundAlpha: 0.8,\n cornerRadius: 0,\n padding: 10,\n autoClose: true,\n textAlign: 'center',\n verticalAlign: 'middle',\n colorBarWidth: 6,\n shadow: {\n color: 0x000000,\n alpha: 0.2,\n offset: { x: 1, y: 3 },\n },\n closeButton: {\n show: false,\n position: 'top right',\n size: 12,\n offset: 4,\n },\n style: {\n fill: 0xffffff,\n fontSize: 16,\n wordWrap: true,\n },\n textColors: {\n info: 0x3498db,\n success: 0x2ecc71,\n warning: 0xf1c40f,\n error: 0xe74c3c,\n },\n};\n\nexport class Toast extends WithSignals(Container) {\n public readonly onToastClosed = new Signal<() => void>();\n protected background: Graphics;\n protected shadow: Graphics;\n protected textDisplay: Text;\n protected closeButton?: Button;\n protected config: ToastConfig;\n protected timeline?: gsap.core.Timeline;\n protected closeTimeout?: any;\n protected isHiding: boolean = false;\n\n protected view: Container;\n\n private _toaster: Toaster;\n\n set toaster(value: Toaster) {\n this._toaster = value;\n }\n\n get toaster(): Toaster {\n return this._toaster;\n }\n\n set text(value: string) {\n this.textDisplay.text = value;\n this.alignText();\n }\n\n constructor(config: Partial<ToastConfig> = {}) {\n super();\n this.config = { ...defaultToastConfig, ...config } as ToastConfig;\n this.initialize();\n }\n\n protected initialize(): void {\n this.view = this.add.container();\n // Create shadow first so it's behind everything\n if (this.config.shadow) {\n this.shadow = this.view.add\n .graphics()\n .roundRect(\n this.config.shadow.offset?.x ?? 4,\n this.config.shadow.offset?.y ?? 4,\n this.config.width!,\n this.config.height!,\n this.config.cornerRadius!,\n )\n .fill({\n color: this.config.shadow.color ?? 0x000000,\n alpha: this.config.shadow.alpha ?? 0.2,\n });\n }\n\n // Create background\n this.background = this.view.add\n .graphics()\n .roundRect(0, 0, this.config.width!, this.config.height!, this.config.cornerRadius!)\n .fill({\n color: this.config.backgroundColor!,\n alpha: this.config.backgroundAlpha!,\n });\n\n // Create a container for the colored indicator with mask\n if (this.config.type) {\n // Create a mask with the same rounded rectangle as the background\n const mask = new Graphics()\n .roundRect(0, 0, this.config.width!, this.config.height!, this.config.cornerRadius!)\n .fill({ color: 0xffffff });\n\n // Create the colored indicator\n const indicator = this.view.add\n .graphics()\n .rect(0, 0, this.config.colorBarWidth!, this.config.height!)\n .fill({ color: this.config.textColors![this.config.type] });\n\n // Apply the mask to the indicator\n indicator.mask = mask;\n\n // Add both the mask and indicator to the container\n this.view.addChild(mask);\n this.view.addChild(indicator);\n }\n\n // Add close button if enabled\n if (this.config.closeButton?.show) {\n this.addCloseButton();\n }\n\n // Create text with adjusted padding to account for color bar and close button\n const leftPadding = this.config.type ? this.config.colorBarWidth! + this.config.padding! : this.config.padding!;\n const rightPadding =\n this.config.closeButton?.show && this.config.closeButton.position === 'top right'\n ? this.config.closeButton.size! + this.config.closeButton.offset! * 2\n : this.config.padding!;\n\n this.textDisplay = this.view.add.text({\n text: this.config.message,\n style: {\n ...defaultToastConfig.style,\n ...this.config.style,\n wordWrapWidth: this.config.style?.wordWrapWidth ?? this.config.width! - leftPadding - rightPadding,\n },\n x: leftPadding,\n y: this.config.padding!,\n });\n\n this.alignText();\n\n this.view.pivot.set(this.config.width! * 0.5, this.config.height! * 0.5);\n\n this.view.position.set(this.config.width! * 0.5, this.config.height! * 0.5);\n // Set initial state\n this.alpha = 0;\n\n this.addChild(this.view);\n }\n\n protected addCloseButton(): void {\n const ButtonClass = this.config.closeButton?.class || Button;\n const size = this.config.closeButton?.size ?? 12;\n const offset = this.config.closeButton?.offset ?? 4;\n const position = this.config.closeButton?.position ?? 'top right';\n\n this.closeButton = this.view.add.existing(\n new ButtonClass({\n cursor: 'pointer',\n }),\n );\n\n // Position the close button\n const x = position === 'top right' ? this.config.width! - size * 0.5 - offset : size * 0.5 + offset;\n const y = size * 0.5 + offset;\n\n this.closeButton.position.set(x, y);\n\n // Connect close button to hide\n this.closeButton.onClick.connect(() => {\n void this.hide();\n });\n }\n\n public alignText(): void {\n switch (this.config.textAlign) {\n case 'left':\n this.textDisplay.anchor.set(0, 0.5);\n break;\n case 'center':\n this.textDisplay.anchor.set(0.5, 0.5);\n this.textDisplay.x = this.config.width! / 2;\n break;\n case 'right':\n this.textDisplay.anchor.set(1, 0.5);\n break;\n }\n\n switch (this.config.verticalAlign) {\n case 'top':\n this.textDisplay.y = this.config.padding!;\n break;\n case 'middle':\n this.textDisplay.y = this.config.height! * 0.5;\n break;\n case 'bottom':\n this.textDisplay.y = this.config.height! - this.textDisplay.height - this.config.padding!;\n break;\n }\n }\n\n public getShowAnimation(): gsap.core.Timeline {\n const tl = gsap.timeline({ paused: true });\n tl.to(this, {\n alpha: 1,\n duration: 0.4,\n ease: 'power2.out',\n });\n\n return tl;\n }\n\n public getHideAnimation(): gsap.core.Timeline {\n const tl = gsap.timeline({ paused: true });\n tl.to(this, {\n alpha: 0,\n duration: 0.25,\n ease: 'power2.in',\n });\n\n return tl;\n }\n\n public async show(): Promise<Toast> {\n this.timeline = this.getShowAnimation();\n await this.timeline.play();\n\n if (this.config.autoClose) {\n this.closeTimeout = setTimeout(() => {\n void this.hide();\n }, this.config.duration);\n }\n return this;\n }\n\n public async hide(): Promise<Toast> {\n // Prevent multiple hide calls\n if (this.isHiding || this.destroyed) {\n return this;\n }\n this.isHiding = true;\n\n if (this.closeTimeout) {\n clearTimeout(this.closeTimeout);\n this.closeTimeout = undefined;\n }\n\n try {\n // Create a new timeline for hiding\n const tl = this.getHideAnimation();\n await tl.play();\n // Only emit if we haven't been destroyed during animation\n if (!this.destroyed) {\n this.onToastClosed.emit();\n }\n } catch (error) {\n // Handle any animation errors gracefully\n console.warn('Toast hide animation error:', error);\n if (!this.destroyed) {\n this.onToastClosed.emit();\n }\n }\n\n return this;\n }\n\n public destroy(): void {\n // Prevent any ongoing animations or timeouts\n this.isHiding = true;\n\n if (this.closeTimeout) {\n clearTimeout(this.closeTimeout);\n this.closeTimeout = undefined;\n }\n\n // Kill any active GSAP animations immediately\n gsap.killTweensOf(this);\n\n if (this.timeline) {\n this.timeline.kill();\n this.timeline = undefined;\n }\n\n // Emit close if we're being destroyed without hiding\n if (!this.destroyed && !this.isHiding) {\n this.onToastClosed.emit();\n }\n\n super.destroy({ children: true });\n }\n}\n","import { gsap } from 'gsap';\nimport { Container } from '../display/Container';\nimport { WithSignals } from '../mixins/signals';\nimport { Signal } from '../signals';\nimport { defaultToastConfig, Toast, ToastConfig } from './Toast';\nimport { UICanvasEdge } from './UICanvas';\n\n/**\n * Configuration interface for the Toaster component, which manages toast notifications.\n *\n * @example\n * ```typescript\n * // Basic toaster in top-right corner\n * const config: ToasterConfig = {\n * position: 'top right',\n * maxToasts: 3\n * };\n *\n * // Custom toaster with specific spacing and offset\n * const config: ToasterConfig = {\n * position: 'bottom center',\n * maxToasts: 5,\n * spacing: 15,\n * offset: { x: 20, y: 30 },\n * stackDirection: 'up'\n * };\n * ```\n */\nexport interface ToasterConfig {\n /** Position of toasts relative to the screen edges */\n position?: UICanvasEdge;\n /** Maximum number of toasts to show at once */\n maxToasts?: number;\n /** Vertical spacing between toasts */\n spacing?: number;\n /** Distance from screen edges, can be a number for equal x/y or an object for different values */\n offset?: { x: number; y: number } | number;\n /** Direction in which new toasts should stack */\n stackDirection?: 'up' | 'down';\n\n animationSpeed: number;\n}\n\nconst defaultConfig: ToasterConfig = {\n position: 'bottom right',\n maxToasts: 5,\n spacing: 10,\n offset: { x: 20, y: 20 },\n stackDirection: 'up',\n animationSpeed: 1,\n};\n\n/**\n * Toaster component that manages the display and positioning of toast notifications.\n *\n * @example\n * ```typescript\n * // Create a toaster\n * const toaster = new Toaster({\n * position: 'top right',\n * maxToasts: 3\n * });\n *\n * // Show a basic toast\n * toaster.show({\n * message: \"Operation successful!\",\n * type: \"success\"\n * });\n *\n * // Show a custom toast\n * toaster.show({\n * message: \"Custom notification\",\n * backgroundColor: 0x9b59b6,\n * shadow: {\n * color: 0x000000,\n * alpha: 0.2,\n * offset: { x: 4, y: 4 }\n * }\n * });\n *\n * // Hide all toasts\n * toaster.hideAll();\n * ```\n */\nexport class Toaster extends WithSignals(Container) {\n /** Emitted when a new toast is added */\n public readonly onToastAdded = new Signal<(toast: Toast) => void>();\n /** Emitted when a toast is removed */\n public readonly onToastRemoved = new Signal<(toast: Toast) => void>();\n /** Emitted when all toasts are removed */\n public readonly onAllToastsRemoved = new Signal<() => void>();\n\n public config: ToasterConfig;\n public defaultToastConfig: Partial<ToastConfig>;\n private toasts: Toast[] = [];\n private container: Container;\n\n /**\n * Get the current number of visible toasts\n */\n public get size(): number {\n return this.toasts.length;\n }\n\n get toastPosition(): UICanvasEdge {\n return this.config.position ?? 'top right';\n }\n\n get stackDirection(): 'up' | 'down' {\n return this.config.stackDirection ?? 'up';\n }\n\n get spacing(): number {\n return this.config.spacing ?? 10;\n }\n\n get offset(): { x: number; y: number } | number {\n return this.config.offset ?? { x: 20, y: 20 };\n }\n\n get maxToasts(): number {\n return this.config.maxToasts ?? 5;\n }\n\n get toastConfig(): Partial<ToastConfig> {\n return this.defaultToastConfig ?? {};\n }\n\n /**\n * Create a new Toaster instance to manage toast notifications.\n *\n * @param config - Configuration for the Toaster's position, spacing, and behavior\n * @param defaultToastConfig - Default configuration applied to all toasts shown by this Toaster\n *\n * @example\n * ```typescript\n * // Basic toaster with default settings\n * const toaster = new Toaster();\n *\n * // Toaster with custom position and behavior\n * const toaster = new Toaster({\n * position: 'bottom center',\n * maxToasts: 3,\n * spacing: 15,\n * offset: { x: 20, y: 30 },\n * stackDirection: 'up'\n * });\n *\n * // Toaster with custom defaults for all toasts\n * const toaster = new Toaster(\n * {\n * position: 'top right',\n * maxToasts: 5\n * },\n * {\n * backgroundColor: 0x000000,\n * backgroundAlpha: 0.8,\n * cornerRadius: 8,\n * shadow: {\n * color: 0x000000,\n * alpha: 0.2,\n * offset: { x: 4, y: 4 }\n * },\n * closeButton: {\n * show: true,\n * position: 'top right'\n * }\n * }\n * );\n *\n * // The defaultToastConfig will be applied to all toasts,\n * // but can be overridden per toast:\n * toaster.show({ message: \"Uses default config\" });\n * toaster.show({\n * message: \"Custom config\",\n * backgroundColor: 0x9b59b6 // Overrides default\n * });\n * ```\n */\n constructor(config: Partial<ToasterConfig> = {}, defaultToastConfig: Partial<ToastConfig> = {}) {\n super({ autoResize: true });\n this.config = { ...defaultConfig, ...config } as ToasterConfig;\n this.defaultToastConfig = { ...defaultToastConfig } as Partial<ToastConfig>;\n this.initialize();\n this.resize();\n }\n\n protected initialize(): void {\n this.container = this.add.container();\n }\n\n /**\n * Display a new toast notification\n * @param config Configuration for the toast to display\n * @returns Promise that resolves with the created toast\n */\n public async show(\n config: Partial<ToastConfig> = this.defaultToastConfig,\n overrideDefaults: boolean = false,\n ): Promise<Toast> {\n // Remove oldest toast if we exceed max before creating new one\n if (this.size >= this.config.maxToasts!) {\n const oldestToast = this.toasts[0];\n // Wait for the hide animation to complete\n await oldestToast.hide();\n // Wait for removal to complete\n await this.removeToast(oldestToast);\n }\n\n if (!overrideDefaults && this.defaultToastConfig) {\n config = {\n ...this.defaultToastConfig,\n ...config,\n style:\n this.defaultToastConfig.style || config.style\n ? { ...(this.defaultToastConfig.style ?? {}), ...(config.style ?? {}) }\n : this.defaultToastConfig.style,\n textColors:\n this.defaultToastConfig.textColors || config.textColors\n ? { ...(this.defaultToastConfig.textColors ?? {}), ...(config.textColors ?? {}) }\n : defaultToastConfig.textColors,\n shadow:\n this.defaultToastConfig.shadow || config.shadow\n ? { ...(this.defaultToastConfig.shadow ?? {}), ...(config.shadow ?? {}) }\n : this.defaultToastConfig.shadow,\n closeButton:\n this.defaultToastConfig.closeButton || config.closeButton\n ? { ...(this.defaultToastConfig.closeButton ?? {}), ...(config.closeButton ?? {}) }\n : defaultToastConfig.closeButton,\n } as ToastConfig;\n }\n // Create new toast\n const ToastClass = config.class ?? Toast;\n const toast = new ToastClass(config);\n\n toast.toaster = this;\n\n // Add to container and array first\n this.container.addChild(toast);\n this.toasts.push(toast);\n this.positionToast(toast, this.toasts.length - 1, false);\n\n // Connect to close signal\n toast.onToastClosed.connectOnce(() => this.removeToast(toast));\n\n // Position all toasts including the new one\n this.positionToasts();\n\n // Emit signal\n this.onToastAdded.emit(toast);\n\n // Show the toast and return it\n return toast.show();\n }\n\n /**\n * Hide all currently visible toasts with animation\n * @returns Promise that resolves when all toasts are hidden\n */\n public async hideAll(): Promise<void> {\n // Create a copy of the array to avoid modification during iteration\n const toastsToHide = [...this.toasts];\n\n // Hide all toasts simultaneously\n await Promise.all(toastsToHide.map((toast) => toast.hide()));\n\n this.onAllToastsRemoved.emit();\n }\n\n /**\n * Remove all toasts (alias for hideAll)\n */\n public async removeAll(): Promise<void> {\n return this.hideAll();\n }\n\n protected async removeToast(toast: Toast): Promise<void> {\n const index = this.toasts.indexOf(toast);\n if (index === -1 || toast.destroyed) {\n return;\n }\n\n // Remove from array first\n this.toasts.splice(index, 1);\n\n // Position remaining toasts\n this.positionToasts();\n\n // Remove from container and destroy\n if (!toast.destroyed) {\n this.container.removeChild(toast);\n toast.destroy();\n }\n\n // Emit signal\n this.onToastRemoved.emit(toast);\n }\n\n /**\n * Update positions of all toasts\n * @param animate Whether to animate the position changes\n * @param skipLast Whether to skip positioning the last toast\n */\n public positionToasts(animate: boolean = true, skipLast: boolean = false): void {\n // Create a copy of the array to avoid modification during iteration\n const validToasts = this.toasts.filter(\n (toast, index) => toast && !toast.destroyed && (skipLast ? index !== this.toasts.length - 1 : true),\n );\n\n validToasts.forEach((toast, index) => {\n this.positionToast(toast, index, animate);\n });\n }\n\n /**\n * Position a single toast\n * @param toast The toast to position\n * @param index The index of the toast in the toasts array\n * @param animate Whether to animate the position changes\n */\n protected positionToast(toast: Toast, index: number, animate: boolean = true): void {\n // Early return if toast is destroyed or invalid\n if (!toast?.parent || toast.destroyed) {\n return;\n }\n\n const { position, spacing, offset, stackDirection } = this.config;\n const offsetX = typeof offset === 'number' ? offset : offset!.x;\n const offsetY = typeof offset === 'number' ? offset : offset!.y;\n let x = this.app.size.width * 0.5;\n let y = this.app.size.height * 0.5;\n\n // Calculate base position\n switch (position) {\n case 'top right':\n case 'right top':\n x += this.app.size.width * 0.5 - toast.width - offsetX;\n y -= this.app.size.height * 0.5 - offsetY;\n break;\n case 'top left':\n case 'left top':\n x -= this.app.size.width * 0.5 - offsetX;\n y -= this.app.size.height * 0.5 - offsetY;\n break;\n case 'bottom right':\n case 'right bottom':\n x += this.app.size.width * 0.5 - toast.width - offsetX;\n y += this.app.size.height * 0.5 - toast.height - offsetY;\n break;\n case 'bottom left':\n case 'left bottom':\n x -= this.app.size.width * 0.5 - offsetX;\n y += this.app.size.height * 0.5 - toast.height - offsetY;\n break;\n case 'top':\n case 'top center':\n x += -toast.width * 0.5;\n y -= this.app.size.height * 0.5 - offsetY;\n break;\n case 'bottom':\n case 'bottom center':\n x += -toast.width * 0.5;\n y += this.app.size.height * 0.5 - toast.height - offsetY;\n break;\n }\n\n // Apply stacking offset\n if (stackDirection === 'down') {\n y += index * (toast.height + spacing!);\n } else {\n y -= index * (toast.height + spacing!);\n }\n\n try {\n // Animate to position\n if (animate) {\n gsap.to(toast, {\n x,\n y,\n duration: 0.3 / this.config.animationSpeed,\n ease: 'power2.out',\n });\n } else {\n toast.position.set(x, y);\n }\n } catch (error) {\n console.warn('Error positioning toast:', error);\n }\n }\n\n /**\n * Handle window resize events\n */\n public resize(): void {\n this.position.set(-this.app.size.width * 0.5, -this.app.size.height * 0.5);\n this.positionToasts(false); // Don't animate on resize\n }\n\n public destroy(): void {\n // Kill any active GSAP animations\n this.toasts.forEach((toast) => {\n gsap.killTweensOf(toast);\n });\n\n this.hideAll();\n this.toasts = [];\n super.destroy({ children: true });\n }\n}\n","import type { LayoutOptions } from '@pixi/layout';\nimport { ContainerChild, Graphics, RenderLayer, Container as PIXIContainer, Text } from 'pixi.js';\nimport { Application } from '../core/Application';\nimport { Container } from '../display/Container';\nimport { Factory } from '../mixins/factory/Factory';\nimport { WithSignals } from '../mixins/signals';\nimport type { AppTypeOverrides, Padding, PointLike, Size, SizeLike } from '../utils';\nimport {\n bindAllMethods,\n createDebugGraphics,\n createDebugLabel,\n DebugAlpha,\n DebugColors,\n ensurePadding,\n Logger,\n registerDebug,\n resolveSizeLike,\n unregisterDebug,\n} from '../utils';\nimport { FlexContainer } from './FlexContainer';\n\nexport type UICanvasEdge =\n | 'top right'\n | 'top left'\n | 'top center'\n | 'top'\n | 'bottom right'\n | 'bottom left'\n | 'bottom center'\n | 'bottom'\n | 'left top'\n | 'left bottom'\n | 'left center'\n | 'left'\n | 'right top'\n | 'right bottom'\n | 'right center'\n | 'right'\n | 'center';\n\nexport interface UICanvasChildSettings {\n align: UICanvasEdge;\n padding: Padding;\n}\n\n/** Anchor box handed to a binding's placement callback, in canvas-local space\n * (origin = canvas top-left), derived from the anchor's computed layout so it\n * never lags the render transform. */\nexport interface UICanvasBindRect {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/** Places a bound (free-floating) element from its anchor's rect. Both the\n * rect and the element's `position` are in canvas-local space. */\nexport type UICanvasBindFn = (rect: UICanvasBindRect, child: PIXIContainer) => void;\n\ninterface UICanvasBinding {\n child: PIXIContainer;\n anchor: PIXIContainer;\n place: UICanvasBindFn;\n}\n\nexport interface UICanvasChildProps {\n align: UICanvasEdge;\n padding: Partial<Padding> | PointLike;\n}\n\nexport type UICanvasConfig = {\n debug: boolean;\n padding: Padding;\n size: Size;\n useAppSize: boolean;\n useSafeArea: boolean;\n layout?: Omit<LayoutOptions, 'target'> | null | boolean;\n autoLayoutChildren?: boolean;\n};\n\nexport const UICanvasConfigKeys: (keyof UICanvasConfig)[] = [\n 'debug',\n 'padding',\n 'size',\n 'useAppSize',\n 'useSafeArea',\n 'layout',\n];\n\nexport type UICanvasProps = {\n debug: boolean;\n padding: Partial<Padding> | PointLike;\n size?: SizeLike;\n useAppSize?: boolean;\n useSafeArea?: boolean;\n layout?: Omit<LayoutOptions, 'target'> | null | boolean;\n autoLayoutChildren?: boolean;\n};\n\nconst zeroPadding: Padding = { top: 0, right: 0, bottom: 0, left: 0 };\n\n/**\n * The padding the canvas actually lays out with: the configured padding plus the\n * device's safe-area insets. Kept separate from `config.padding` so it can be\n * re-derived on every resize without compounding.\n */\nexport function computeEffectivePadding(padding: Padding, safeArea: Padding): Padding {\n return {\n top: padding.top + safeArea.top,\n right: padding.right + safeArea.right,\n bottom: padding.bottom + safeArea.bottom,\n left: padding.left + safeArea.left,\n };\n}\n\nconst defaultLayout = {\n flexGrow: 0,\n flexShrink: 0,\n autoLayoutChildren: true,\n};\n\nconst _UICanvas = WithSignals(Factory());\n\nexport class UICanvas extends _UICanvas {\n public config: UICanvasConfig;\n protected settingsMap = new Map<PIXIContainer, UICanvasChildSettings>();\n protected _childMap = new Map<PIXIContainer, PIXIContainer>();\n protected _debugGraphics: Graphics | null = null;\n protected _debugLabel: Text | null = null;\n protected _regionLabels: Text[] = [];\n private _disableAddChildError: boolean = false;\n private _positionContainers: Map<UICanvasEdge, Container>;\n private _bindings: UICanvasBinding[] = [];\n\n public topRow: FlexContainer;\n public middleRow: FlexContainer;\n public bottomRow: FlexContainer;\n\n constructor(config: Partial<UICanvasProps>) {\n super();\n\n if (!this.app.config.useLayout) {\n throw new Error('You must set useLayout to true in your app config to use UICanvas');\n }\n\n bindAllMethods(this);\n this._positionContainers = new Map();\n this.config = {\n debug: config.debug === true,\n padding: ensurePadding(config?.padding ?? 0),\n size: config.size !== undefined ? resolveSizeLike(config.size) : { width: 0, height: 0 },\n useAppSize: config.useAppSize === true,\n useSafeArea: config.useSafeArea ?? true,\n autoLayoutChildren: config.autoLayoutChildren ?? true,\n };\n\n if (config.layout) {\n if (typeof config.layout === 'boolean') {\n this.config.layout = config.layout;\n } else {\n this.config.layout = { ...defaultLayout, ...config.layout };\n }\n } else {\n this.config.layout = { ...defaultLayout };\n }\n\n if (this.config.useAppSize) {\n this.config.size = this.app.size;\n }\n this.layout = {\n width: this.config.size.width,\n height: this.config.size.height,\n flexDirection: 'column',\n justifyContent: 'space-between',\n ...(typeof this.config.layout === 'object' ? this.config.layout : {}),\n };\n\n this.on('childRemoved', this._childRemoved);\n this.once('added', this._added);\n\n this.addSignalConnection(this.app.onResize.connect(this.resize));\n\n this._initializeLayout();\n this._updateLayout();\n\n if (this.config.debug) {\n registerDebug(`UICanvas:${this.uid}`, this.label || 'UICanvas', DebugColors.outerBounds);\n }\n }\n\n private _updateLayout() {\n this.app.ticker.addOnce(this.updateLayout);\n }\n\n private _initializeLayout() {\n this._disableAddChildError = true;\n // Create top row\n this.topRow = this.add.flexContainer({\n label: 'Top',\n layout: {\n width: '100%',\n height: 'auto',\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'flex-start',\n },\n });\n\n // Create middle row\n this.middleRow = this.add.flexContainer({\n label: 'Middle',\n layout: {\n width: '100%',\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n });\n\n // Create bottom row\n this.bottomRow = this.add.flexContainer({\n label: 'Bottom',\n layout: {\n width: '100%',\n height: 'auto',\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'flex-end',\n },\n });\n\n this._disableAddChildError = false;\n\n // Create the 9 actual position containers\n const topLeft = this._createPositionContainer(\n this.topRow,\n {\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n flexGrow: 0,\n flexShrink: 0,\n },\n 'Left',\n );\n const topCenter = this._createPositionContainer(\n this.topRow,\n {\n justifyContent: 'center',\n alignItems: 'flex-start',\n flexGrow: 1,\n flexShrink: 0,\n },\n 'Center',\n );\n const topRight = this._createPositionContainer(\n this.topRow,\n {\n justifyContent: 'flex-end',\n alignItems: 'flex-start',\n flexGrow: 0,\n flexShrink: 0,\n },\n 'Right',\n );\n\n const middleLeft = this._createPositionContainer(\n this.middleRow,\n {\n justifyContent: 'flex-start',\n alignItems: 'center',\n flexDirection: 'row',\n flexGrow: 0,\n flexShrink: 0,\n },\n 'Left',\n );\n const center = this._createPositionContainer(\n this.middleRow,\n {\n justifyContent: 'center',\n alignItems: 'center',\n flexDirection: 'row',\n flexGrow: 1,\n flexShrink: 0,\n },\n 'Center',\n );\n const middleRight = this._createPositionContainer(\n this.middleRow,\n {\n justifyContent: 'flex-end',\n alignItems: 'center',\n flexDirection: 'row',\n flexGrow: 0,\n flexShrink: 0,\n },\n 'Right',\n );\n\n const bottomLeft = this._createPositionContainer(\n this.bottomRow,\n {\n justifyContent: 'flex-start',\n alignItems: 'flex-end',\n flexDirection: 'row',\n flexGrow: 0,\n flexShrink: 0,\n },\n 'Left',\n );\n const bottomCenter = this._createPositionContainer(\n this.bottomRow,\n {\n justifyContent: 'center',\n alignItems: 'flex-end',\n flexGrow: 1,\n flexShrink: 0,\n flexDirection: 'row',\n },\n 'Center',\n );\n const bottomRight = this._createPositionContainer(\n this.bottomRow,\n {\n justifyContent: 'flex-end',\n alignItems: 'flex-end',\n flexDirection: 'row',\n flexGrow: 0,\n flexShrink: 0,\n },\n 'Right',\n );\n\n // Map all edge variants to the appropriate containers\n this._positionContainers.set('top left', topLeft);\n this._positionContainers.set('left top', topLeft);\n\n this._positionContainers.set('top center', topCenter);\n this._positionContainers.set('top', topCenter);\n\n this._positionContainers.set('top right', topRight);\n this._positionContainers.set('right top', topRight);\n\n this._positionContainers.set('left center', middleLeft);\n this._positionContainers.set('left', middleLeft);\n this._positionContainers.set('left bottom', bottomLeft);\n\n this._positionContainers.set('center', center);\n\n this._positionContainers.set('right center', middleRight);\n this._positionContainers.set('right', middleRight);\n this._positionContainers.set('right bottom', bottomRight);\n\n this._positionContainers.set('bottom left', bottomLeft);\n\n this._positionContainers.set('bottom center', bottomCenter);\n this._positionContainers.set('bottom', bottomCenter);\n\n this._positionContainers.set('bottom right', bottomRight);\n }\n\n private _createPositionContainer(parent: FlexContainer, layout: Partial<LayoutOptions>, label: string): Container {\n const container = parent.add.container({\n layout: {\n width: 'auto',\n height: 'auto',\n ...layout,\n },\n });\n container.label = label;\n container.on('childAdded', this._updateLayout);\n container.on('childRemoved', this._updateLayout);\n container.on('layout', this._updateLayout);\n return container;\n }\n\n protected _canvasChildren: PIXIContainer[] = [];\n\n public get canvasChildren(): PIXIContainer[] {\n return this._canvasChildren;\n }\n\n /**\n * Get the application instance.\n */\n public get app(): AppTypeOverrides['App'] {\n return Application.getInstance();\n }\n\n destroy() {\n // Must be set before any child.destroy() call — PixiJS's destroy cascade\n // calls child.removeFromParent() → parent.removeChild() internally.\n this._disableAddChildError = true;\n\n // Clean up debug\n if (this.config.debug) {\n unregisterDebug(`UICanvas:${this.uid}`);\n }\n if (this._debugGraphics) {\n this._debugGraphics.destroy();\n this._debugGraphics = null;\n }\n if (this._debugLabel) {\n this._debugLabel.destroy();\n this._debugLabel = null;\n }\n for (const rl of this._regionLabels) {\n rl.destroy();\n }\n this._regionLabels = [];\n\n this.canvasChildren?.forEach((child) => {\n child.off('layout', this._updateLayout);\n });\n\n this.children.forEach((child) => {\n child.off('layout', this._updateLayout);\n });\n\n this.off('childAdded', this._updateLayout);\n this.off('childRemoved', this._updateLayout);\n\n this._positionContainers.forEach((container) => {\n container.off('childAdded', this._updateLayout);\n container.off('childRemoved', this._updateLayout);\n });\n\n this._bindings = [];\n\n super.destroy();\n }\n\n set size(value: SizeLike) {\n this.config.size = value === undefined ? { width: 0, height: 0 } : resolveSizeLike(value);\n\n this.layout = { width: this.config.size.width, height: this.config.size.height };\n\n this.updateLayout();\n }\n\n set padding(value: Partial<Padding> | PointLike) {\n this.config.padding = ensurePadding(value);\n // Update position to account for padding\n this._applyPadding();\n this._updateLayout();\n }\n\n /** Writes the effective padding (configured padding + safe-area insets) into the layout. */\n private _applyPadding() {\n const padding = computeEffectivePadding(\n this.config.padding,\n this.config.useSafeArea ? this.app.safeArea : zeroPadding,\n );\n this.layout = {\n paddingLeft: padding.left,\n paddingTop: padding.top,\n paddingRight: padding.right,\n paddingBottom: padding.bottom,\n };\n }\n\n private static isFlexContainer(child: PIXIContainer): boolean {\n return child instanceof FlexContainer;\n }\n\n /**\n * Removes all the children from the container\n */\n public removeChildren = (beginIndex?: number, endIndex?: number): PIXIContainer[] => {\n return super.removeChildren(beginIndex, endIndex) as PIXIContainer[];\n };\n\n /**\n * Removes a child from the container at the specified index\n */\n public removeChildAt = <U extends PIXIContainer | RenderLayer>(index: number): U => {\n return super.removeChildAt(index) as U;\n };\n\n /**\n * Adds a child to the container at the specified index\n */\n public addChildAt = <U extends PIXIContainer | RenderLayer>(_child: U, _index: number): U => {\n throw new Error(\n `UICanvas: Do not call addChildAt() directly. Use addElement(child, { align }) instead.\\n` +\n `Example: uiCanvas.addElement(myChild, { align: 'top right' })`,\n );\n };\n\n /**\n * Sets the index of the child in the container\n */\n public setChildIndex = <U extends PIXIContainer>(_child: U, _index: number): void => {\n throw new Error(\n `UICanvas: Do not call setChildIndex() directly. Use reorderElement(child, index), bringToFront(child), or sendToBack(child) instead.\\n` +\n `Example: uiCanvas.reorderElement(myChild, 0)`,\n );\n };\n\n /**\n * Gets the index of a child in the container\n */\n public getChildIndex = <U extends PIXIContainer>(child: U): number => {\n return super.getChildIndex(child);\n };\n\n /**\n * Gets the child at the specified index\n */\n public getChildAt = <U extends PIXIContainer | RenderLayer>(index: number): U => {\n return super.getChildAt(index) as U;\n };\n\n public addChild<U extends (ContainerChild | RenderLayer)[]>(...children: U): U[0] {\n if (this._disableAddChildError) {\n return super.addChild(...children);\n }\n throw new Error(\n `UICanvas: Do not call addChild() directly. Use addElement(child, { align }) instead.\\n` +\n `Example: uiCanvas.addElement(myChild, { align: 'top right' })`,\n );\n }\n\n /**\n * Removes one or more children from the container\n */\n public removeChild(..._children: (PIXIContainer | RenderLayer)[]): PIXIContainer {\n if (this._disableAddChildError) {\n return super.removeChild(...(_children as PIXIContainer[]));\n }\n throw new Error(`UICanvas: Do not call removeChild() directly. Use removeElement(child) instead.`);\n }\n\n public resize() {\n // Re-derived rather than cached: the safe area changes with the viewport.\n this._applyPadding();\n if (this.config.useAppSize) {\n this.size = { width: this.app.size.width, height: this.app.size.height };\n this.position.set(-this.app.size.width * 0.5, -this.app.size.height * 0.5);\n } else {\n this._updateLayout();\n }\n }\n\n public updateLayout() {\n if (this.destroyed || !this.layout || !this.app?.renderer.layout) return;\n this.app.renderer.layout.update(this);\n\n this._positionContainers.forEach((container) => {\n this.app.renderer.layout.update(container);\n });\n\n if (this.config.useAppSize) {\n this.position.set(-this.config.size.width * 0.5, -this.config.size.height * 0.5);\n }\n\n this._updateBindings();\n\n if (this.config.debug) {\n this.app.ticker.addOnce(this.drawDebug);\n }\n }\n\n /**\n * Bind a free-floating element to a UICanvas-managed anchor without adding it\n * to the flex flow. The element is parented to the canvas as a `layout: false`\n * child (so it never re-measures a region — it can't \"shift everything left\"),\n * and `place` re-runs on every layout pass with the anchor's current box in\n * canvas-local space. Use it for popovers, tooltips, and dropdowns anchored to\n * laid-out chrome. Idempotent per child — binding the same child again replaces\n * the previous binding.\n *\n * The bound element must NOT be a `@pixi/layout` node: re-enabling `.layout` on\n * it (a layout-enabled direct child of the canvas joins the column flow and\n * bottom-docks + reflows the canvas). Position its own subtree manually.\n */\n public bindElement(child: PIXIContainer, anchor: PIXIContainer, place: UICanvasBindFn): void {\n if (child.parent !== this) {\n this._disableAddChildError = true;\n super.addChild(child);\n this._disableAddChildError = false;\n }\n child.layout = false;\n this._bindings = this._bindings.filter((b) => b.child !== child);\n this._bindings.push({ child, anchor, place });\n this._updateLayout();\n }\n\n /** Remove a binding created by `bindElement` and detach the element. */\n public unbindElement(child: PIXIContainer): void {\n const had = this._bindings.some((b) => b.child === child);\n this._bindings = this._bindings.filter((b) => b.child !== child);\n if (had && child.parent === this) {\n this._disableAddChildError = true;\n super.removeChild(child);\n this._disableAddChildError = false;\n }\n }\n\n private _updateBindings(): void {\n for (const { child, anchor, place } of this._bindings) {\n const rect = this._anchorRect(anchor);\n if (rect) place(rect, child);\n }\n }\n\n /** The anchor's box in canvas-local space, summed from the computed-layout\n * offsets up to this canvas — deterministic and free of render-transform lag\n * (the same source the debug overlay uses to draw regions). */\n private _anchorRect(anchor: PIXIContainer): UICanvasBindRect | null {\n const own = anchor.layout?.computedLayout;\n if (!own) return null;\n let left = 0;\n let top = 0;\n for (let node: PIXIContainer | null = anchor; node && node !== this; node = node.parent) {\n const cl = node.layout?.computedLayout;\n if (cl) {\n left += cl.left;\n top += cl.top;\n }\n }\n return { left, top, width: own.width, height: own.height };\n }\n\n public addElement<U extends PIXIContainer = PIXIContainer>(\n child: PIXIContainer,\n settings?: Partial<UICanvasChildProps>,\n ): U {\n const position = settings?.align ?? 'top left';\n const container = this._positionContainers.get(position);\n\n if (!container) {\n Logger.error(`UICanvas:: Invalid position \"${position}\" for element`);\n return child as U;\n }\n\n if (UICanvas.isFlexContainer(child as PIXIContainer)) {\n this.addSignalConnection((child as unknown as FlexContainer).onLayoutComplete.connect(this._updateLayout));\n }\n\n this.settingsMap.set(child, {\n align: position,\n padding: settings?.padding ? ensurePadding(settings.padding) : { top: 0, left: 0, bottom: 0, right: 0 },\n });\n\n this._childMap.set(child, container);\n this._canvasChildren = Array.from(this._childMap.keys());\n\n container.add.existing(child);\n this._childAdded(child);\n\n return child as U;\n }\n\n public removeElement(child: PIXIContainer): PIXIContainer {\n const container = this._childMap.get(child);\n if (!container) {\n throw new Error(\n `UICanvas: Cannot remove element — it was not added via addElement().\\n` +\n `Child label: \"${child.label ?? '(unlabeled)'}\"`,\n );\n }\n\n container.removeChild(child);\n child.off('layout', this._updateLayout);\n this.settingsMap.delete(child);\n this._childMap.delete(child);\n this._canvasChildren = Array.from(this._childMap.keys());\n this._updateLayout();\n return child;\n }\n\n /**\n * Reorders an element within its region container, changing its position in\n * the flex layout and paint order.\n */\n public reorderElement<U extends PIXIContainer>(child: U, index: number): U {\n const container = this._childMap.get(child);\n if (!container) {\n throw new Error(\n `UICanvas: Cannot reorder element — it was not added via addElement().\\n` +\n `Child label: \"${child.label ?? '(unlabeled)'}\"`,\n );\n }\n\n container.setChildIndex(child, index);\n this._updateLayout();\n return child;\n }\n\n /** Moves an element to the last index (painted/laid-out last) within its region. */\n public bringToFront<U extends PIXIContainer>(child: U): U {\n const container = this._childMap.get(child);\n if (!container) {\n throw new Error(\n `UICanvas: Cannot reorder element — it was not added via addElement().\\n` +\n `Child label: \"${child.label ?? '(unlabeled)'}\"`,\n );\n }\n\n return this.reorderElement(child, container.children.length - 1);\n }\n\n /** Moves an element to the first index (painted/laid-out first) within its region. */\n public sendToBack<U extends PIXIContainer>(child: U): U {\n return this.reorderElement(child, 0);\n }\n\n private _childAdded(child: PIXIContainer) {\n if (this.config.autoLayoutChildren) {\n if (!child.layout) {\n child.layout = true;\n }\n if (!child.layout?.style?.width) {\n child.layout = { width: 'auto' };\n }\n if (!child.layout?.style?.height) {\n child.layout = { height: 'auto' };\n }\n }\n child.on('layout', this._updateLayout);\n Container.childAdded(child);\n this._updateLayout();\n }\n\n private _childRemoved(child: any) {\n this.settingsMap.delete(child);\n this._childMap.delete(child as PIXIContainer);\n this._canvasChildren = Array.from(this._childMap.keys());\n Container.childRemoved(child);\n }\n\n private _added() {\n this._updateLayout();\n }\n\n // --- Debug visualization ---\n get debug(): boolean {\n return this.config.debug;\n }\n\n set debug(value: boolean) {\n this.config.debug = value;\n if (value) {\n const uid = `UICanvas:${this.uid}`;\n registerDebug(uid, this.label || 'UICanvas', DebugColors.outerBounds);\n this.drawDebug();\n } else {\n unregisterDebug(`UICanvas:${this.uid}`);\n if (this._debugGraphics) {\n this._debugGraphics.clear();\n }\n if (this._debugLabel) {\n this._debugLabel.visible = false;\n }\n for (const rl of this._regionLabels) {\n rl.visible = false;\n }\n }\n }\n\n private drawDebug() {\n // Lazily create debug graphics as a child of this canvas\n if (!this._debugGraphics) {\n this._disableAddChildError = true;\n this._debugGraphics = createDebugGraphics(`${this.label ?? 'UICanvas'}:debug`);\n super.addChild(this._debugGraphics);\n this._debugGraphics.layout = false;\n this._disableAddChildError = false;\n }\n\n if (!this._debugLabel) {\n this._disableAddChildError = true;\n this._debugLabel = createDebugLabel(this.label || 'UICanvas', DebugColors.outerBounds);\n super.addChild(this._debugLabel);\n this._debugLabel.layout = false;\n this._disableAddChildError = false;\n }\n\n this._debugLabel.text = this.label || 'UICanvas';\n this._debugLabel.visible = true;\n this._debugLabel.position.set(2, 2);\n\n this._debugGraphics.clear();\n\n const w = this.config.size.width;\n const h = this.config.size.height;\n const pad = this.config.padding;\n\n // 1. Outer bounds (red)\n this._debugGraphics\n .rect(0, 0, w, h)\n .stroke({ width: 1, color: DebugColors.outerBounds, alpha: DebugAlpha.stroke, pixelLine: true });\n\n // 2. Padding areas (red subtle fill)\n if (pad.top > 0) {\n this._debugGraphics.rect(0, 0, w, pad.top).fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n if (pad.bottom > 0) {\n this._debugGraphics\n .rect(0, h - pad.bottom, w, pad.bottom)\n .fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n if (pad.left > 0) {\n this._debugGraphics\n .rect(0, pad.top, pad.left, h - pad.top - pad.bottom)\n .fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n if (pad.right > 0) {\n this._debugGraphics\n .rect(w - pad.right, pad.top, pad.right, h - pad.top - pad.bottom)\n .fill({ color: DebugColors.outerBounds, alpha: DebugAlpha.fill });\n }\n\n // 3. Inner bounds (green)\n const innerX = pad.left;\n const innerY = pad.top;\n const innerW = w - pad.left - pad.right;\n const innerH = h - pad.top - pad.bottom;\n this._debugGraphics\n .rect(innerX, innerY, innerW, innerH)\n .stroke({ width: 1, color: DebugColors.innerBounds, alpha: DebugAlpha.stroke, pixelLine: true });\n\n // 4. 9-grid region visualization\n // Build a name map from edge → container for labeling\n const edgeNames = new Map<Container, string>();\n this._positionContainers.forEach((container, edge) => {\n // Use the shortest edge name for each unique container\n if (!edgeNames.has(container) || edge.length < edgeNames.get(container)!.length) {\n edgeNames.set(container, edge);\n }\n });\n\n const uniqueContainers = [...new Set(this._positionContainers.values())];\n\n // Ensure we have enough region labels\n while (this._regionLabels.length < uniqueContainers.length) {\n this._disableAddChildError = true;\n const rl = createDebugLabel('', DebugColors.region);\n super.addChild(rl);\n rl.layout = false;\n this._regionLabels.push(rl);\n this._disableAddChildError = false;\n }\n\n uniqueContainers.forEach((container, i) => {\n if (!container.layout?.computedLayout) return;\n const cl = container.layout.computedLayout;\n const parent = container.parent;\n if (!parent?.layout?.computedLayout) return;\n const parentCL = parent.layout.computedLayout;\n\n const rx = parentCL.left + cl.left;\n const ry = parentCL.top + cl.top;\n const rw = cl.width;\n const rh = cl.height;\n const hasChildren = container.children.length > 0;\n\n // Region fill (different alpha for occupied vs empty)\n this._debugGraphics!\n .rect(rx, ry, rw, rh)\n .fill({ color: DebugColors.region, alpha: hasChildren ? DebugAlpha.fillActive : DebugAlpha.fill })\n .stroke({ width: 1, color: DebugColors.region, alpha: 0.3, pixelLine: true });\n\n // Region label\n const rl = this._regionLabels[i];\n rl.text = edgeNames.get(container) ?? '';\n rl.visible = true;\n rl.position.set(rx + 2, ry + 2);\n });\n\n // Hide unused region labels\n for (let i = uniqueContainers.length; i < this._regionLabels.length; i++) {\n this._regionLabels[i].visible = false;\n }\n\n // 5. Center crosshairs\n const centerX = w / 2;\n const centerY = h / 2;\n this._debugGraphics\n .moveTo(centerX, centerY - 10)\n .lineTo(centerX, centerY + 10)\n .stroke({ width: 1, color: DebugColors.outerBounds, alpha: DebugAlpha.crosshair, pixelLine: true })\n .moveTo(centerX - 10, centerY)\n .lineTo(centerX + 10, centerY)\n .stroke({ width: 1, color: DebugColors.outerBounds, alpha: DebugAlpha.crosshair, pixelLine: true });\n }\n}\n","/**\n * Runtime registry for `this.add.entity(id, props)` lookups.\n *\n * The Vite plugin's entity discovery emits a `virtual:caper-entities` module\n * with static imports by default (`defaultDynamic: false` in\n * `discoverLocalClassFiles`). The `caper-runtime` virtual module pulls that\n * list onto `globalThis.Caper.entityList` before the Application starts, so\n * by the time any scene fires `initialize()` and calls `this.add.entity`,\n * the list is in place.\n *\n * This registry is populated lazily on first lookup — no explicit bootstrap\n * step needed. Entities declared with `defineEntity({ dynamic: true })` have\n * an async `module` function and are skipped: the sync factory API can't\n * wait for them. That's an intentional tradeoff — if a project needs code-\n * split entities, they use `add.existing(new Foo(...), props)` with a\n * manual lazy import instead.\n */\n\ntype EntityConstructor = new (props?: unknown) => unknown;\n\ntype EntityListItem = {\n id: string;\n active?: boolean;\n module?: EntityConstructor | (() => Promise<unknown>);\n};\n\nlet registry: Map<string, EntityConstructor> | null = null;\n\nfunction ensureRegistry(): Map<string, EntityConstructor> {\n if (registry) return registry;\n registry = new Map();\n const list: EntityListItem[] =\n (globalThis as unknown as { Caper?: { get?: (key: string) => unknown } }).Caper?.get?.(\n 'entityList',\n ) as EntityListItem[] | undefined ?? [];\n for (const item of list) {\n if (item.active === false) continue;\n if (typeof item.module === 'function' && item.module.prototype) {\n registry.set(item.id, item.module as EntityConstructor);\n }\n // Dynamic (arrow-function) modules have no prototype — skipped, since\n // `this.add.entity` is sync and can't await a dynamic import.\n }\n return registry;\n}\n\nexport function getEntityCtor(id: string): EntityConstructor | undefined {\n return ensureRegistry().get(id);\n}\n\nexport function getRegisteredEntityIds(): string[] {\n return [...ensureRegistry().keys()];\n}\n\n/**\n * Reset the registry. Test-only — production code should rely on the lazy\n * initialization from `globalThis.Caper.entityList`.\n */\nexport function _resetEntityRegistry(): void {\n registry = null;\n}\n","/**\n * Runtime registry for `this.add.ui(id, props)` lookups.\n *\n * Mirrors the entity registry pattern exactly. The Vite plugin's UI\n * discovery emits a `virtual:caper-uis` module with static imports by\n * default (`defaultDynamic: false`). The `caper-runtime` virtual module\n * pulls that list onto `globalThis.Caper.uiList` before the Application\n * starts.\n *\n * Populated lazily on first lookup — no explicit bootstrap step needed.\n */\n\ntype UIConstructor = new (props?: unknown) => unknown;\n\ntype UIListItem = {\n id: string;\n active?: boolean;\n module?: UIConstructor | (() => Promise<unknown>);\n};\n\nlet registry: Map<string, UIConstructor> | null = null;\n\nfunction ensureRegistry(): Map<string, UIConstructor> {\n if (registry) return registry;\n registry = new Map();\n const list: UIListItem[] =\n (globalThis as unknown as { Caper?: { get?: (key: string) => unknown } }).Caper?.get?.(\n 'uiList',\n ) as UIListItem[] | undefined ?? [];\n for (const item of list) {\n if (item.active === false) continue;\n if (typeof item.module === 'function' && item.module.prototype) {\n registry.set(item.id, item.module as UIConstructor);\n }\n // Dynamic (arrow-function) modules have no prototype — skipped, since\n // `this.add.ui` is sync and can't await a dynamic import.\n }\n return registry;\n}\n\nexport function getUICtor(id: string): UIConstructor | undefined {\n return ensureRegistry().get(id);\n}\n\nexport function getRegisteredUIIds(): string[] {\n return [...ensureRegistry().keys()];\n}\n\n/**\n * Reset the registry. Test-only.\n */\nexport function _resetUIRegistry(): void {\n registry = null;\n}\n","// Import from source files directly (not via the `../../utils` barrel) so\n// the test runtime doesn't transitively pull in display/Container → the\n// Factory mixin chain → const.ts. That cycle is fine for bundled builds\n// but breaks vitest module evaluation when the test imports from here.\nimport { omitKeys } from '../../utils/object';\nimport {\n resolveAnchor,\n resolvePivot,\n resolvePosition,\n resolveScale,\n resolveUnknownKeys,\n} from './utils';\n\n/**\n * Common prop resolvers the schema helper can apply after constructing an\n * instance. Each entry corresponds to one of the `resolveXxx` utilities and\n * reads its inputs from the raw props object — so `'position'` consumes\n * `{ position, x, y }`, `'scale'` consumes `{ scale, scaleX, scaleY }`,\n * etc.\n */\nexport type FactoryApply = 'position' | 'scale' | 'pivot' | 'anchor';\n\n/**\n * Schema describing a single factory method. Owned by the method's entry in\n * `defaultFactoryMethods`; `buildFactoryMethod` consumes it to produce a\n * typed `(props?: Props) => Instance` function with the standard\n * resolve-position / resolve-scale / resolve-pivot / resolve-anchor\n * post-construct pipeline and an automatic unknown-keys passthrough.\n *\n * The point of pushing every method through this shape is to collapse the\n * copy-paste construction boilerplate in [const.ts](./const.ts): each\n * method becomes (a) `build` — the bespoke constructor call that may\n * reshape the props before handing them to Pixi — and (b) a list of which\n * common resolvers to run. Everything else (unknowns passthrough, optional\n * props guard, etc.) is centralized.\n */\nexport interface FactorySchema<Props, Instance> {\n /**\n * Bespoke construction. Receives the raw Caper-shaped props (possibly\n * undefined) and returns a new instance. Any reshaping Caper does for DX\n * — Sprite's `{asset, sheet}` → texture resolution, Text's top-level\n * style flattening, Container's config/extras split — lives here.\n */\n build: (props: Props | undefined) => Instance;\n\n /**\n * Which common resolvers to run on the instance after `build` returns.\n * Defaults to `['position', 'scale', 'pivot']` when omitted — the lowest\n * common denominator that every display object supports. Classes with an\n * `anchor` field (Sprite, Text, AnimatedSprite, Spine) opt in to\n * `'anchor'` explicitly.\n */\n applies?: readonly FactoryApply[];\n\n /**\n * Keys the `build` callback already consumed — excluded from the\n * unknown-keys passthrough so Caper doesn't try to set them on the\n * instance a second time. For example, Sprite's schema excludes `asset`\n * and `sheet` (consumed by `resolveTexture`), Text's schema excludes\n * `text`, `roundPixels`, `resolution`, `style`, `anchor`, and `pivot`.\n */\n exclude?: readonly string[];\n}\n\nconst DEFAULT_APPLIES: readonly FactoryApply[] = ['position', 'scale', 'pivot'];\n\n/**\n * Keys automatically excluded from the unknown-keys passthrough because\n * they're either consumed by a resolver listed in `applies` or are a\n * shorthand alias for one that is. Listed here so individual schemas don't\n * have to re-declare them.\n */\nconst RESOLVER_KEYS: readonly string[] = [\n 'position',\n 'x',\n 'y',\n 'scale',\n 'scaleX',\n 'scaleY',\n 'pivot',\n 'anchor',\n];\n\n/**\n * Build a typed factory method from a schema. The return type preserves\n * the `(props?: Props) => Instance` shape TypeScript uses to drive\n * autocomplete on `this.add.*({...})` call sites.\n *\n * Behavior mirrors the hand-written factory method pattern:\n * 1. Call `schema.build(props)` to get the instance.\n * 2. If props were passed, apply each resolver in `schema.applies`\n * (position / scale / pivot / anchor).\n * 3. Forward any remaining keys to `resolveUnknownKeys` for the common\n * pass-through surface (`alpha`, `visible`, `label`, `eventMode`, etc.)\n * minus any keys the `build` callback already consumed.\n *\n * @example\n * ```ts\n * sprite: buildFactoryMethod<Partial<SpriteProps>, Sprite>({\n * build: (props) => new Sprite(props ? resolveTexture(props) : undefined),\n * applies: ['position', 'scale', 'pivot', 'anchor'],\n * exclude: ['asset', 'sheet'],\n * }),\n * ```\n */\nexport function buildFactoryMethod<Props, Instance>(\n schema: FactorySchema<Props, Instance>,\n): (props?: Props) => Instance {\n const applies = schema.applies ?? DEFAULT_APPLIES;\n const applyPosition = applies.includes('position');\n const applyScale = applies.includes('scale');\n const applyPivot = applies.includes('pivot');\n const applyAnchor = applies.includes('anchor');\n const excludeKeys = [...RESOLVER_KEYS, ...(schema.exclude ?? [])];\n\n return (props?: Props): Instance => {\n const instance = schema.build(props);\n if (props === undefined || props === null) return instance;\n\n // Post-construct resolvers. Each reads from the raw props object so the\n // schema doesn't have to pre-extract them.\n const rawProps = props as unknown as Record<string, unknown>;\n if (applyPosition) {\n resolvePosition(\n { position: rawProps.position as never, x: rawProps.x as never, y: rawProps.y as never },\n instance as unknown as object,\n );\n }\n if (applyScale) {\n resolveScale(\n {\n scale: rawProps.scale as never,\n scaleX: rawProps.scaleX as never,\n scaleY: rawProps.scaleY as never,\n },\n instance as unknown as object,\n );\n }\n if (applyPivot) {\n resolvePivot(rawProps.pivot as never, instance as unknown as object);\n }\n if (applyAnchor) {\n resolveAnchor(rawProps.anchor as never, instance as unknown as object);\n }\n\n // Forward any remaining keys via the passthrough. Excludes the keys\n // already handled by the resolvers above plus anything the schema's\n // `build` callback consumed.\n const rest = omitKeys(excludeKeys, rawProps);\n resolveUnknownKeys(rest, instance);\n return instance;\n };\n}\n","import { BitmapText, Graphics, HTMLText, Sprite, Text, TilingSprite } from 'pixi.js';\n\nimport { AnimatedSprite } from '../../display/AnimatedSprite';\nimport { Container, ContainerConfigKeys } from '../../display/Container';\nimport { ParticleContainer, ParticleContainerConfigKeys } from '../../display/ParticleContainer';\nimport { SpineAnimation } from '../../display/SpineAnimation';\nimport { Svg } from '../../display/Svg';\nimport type { ButtonConfig } from '../../ui/Button';\nimport { Button, ButtonConfigKeys } from '../../ui/Button';\nimport type { FlexContainerConfig } from '../../ui/FlexContainer';\nimport { FlexContainer, FlexContainerConfigKeys } from '../../ui/FlexContainer';\nimport type { ToastConfig } from '../../ui/Toast';\nimport type { ToasterConfig } from '../../ui/Toaster';\nimport { Toaster } from '../../ui/Toaster';\nimport type { UICanvasProps } from '../../ui/UICanvas';\nimport { UICanvas, UICanvasConfigKeys } from '../../ui/UICanvas';\nimport type { EntityId, EntityInstance, EntityProps, UIId, UIInstance, UIProps } from '../../utils';\nimport { pluck, resolvePointLike, Spine, WithRequiredProps } from '../../utils';\n\nimport { setDefaultFactoryMethods } from './defaults';\nimport type { EntityFactoryProps } from './props';\nimport {\n AnimatedSpriteProps,\n BitmapTextProps,\n ButtonProps,\n ContainerProps,\n ExistingProps,\n FlexContainerProps,\n GraphicsProps,\n HTMLTextProps,\n ParticleContainerProps,\n SpineProps,\n SpriteProps,\n SvgProps,\n TextProps,\n TilingSpriteProps,\n UICanvasFactoryProps,\n} from './props';\nimport { getEntityCtor, getRegisteredEntityIds } from './registry';\nimport { getUICtor, getRegisteredUIIds } from './ui-registry';\nimport { buildFactoryMethod } from './schema';\nimport {\n resolveAnchor,\n resolvePivot,\n resolvePosition,\n resolveScale,\n resolveTexture,\n resolveUnknownKeys,\n} from './utils';\n\n/**\n * Keys consumed by text-family factory builds (`text`, `htmlText`,\n * `bitmapText`). Shared here so the three schemas don't drift — each one\n * flattens `{text, style, roundPixels, resolution, anchor, pivot}` into\n * the Pixi constructor options in `build`, so all those keys must be\n * excluded from the schema's unknown-keys passthrough.\n */\nconst TEXT_CONSUMED_KEYS = ['text', 'roundPixels', 'resolution', 'style', 'anchor', 'pivot'] as const;\n\n/**\n * Factory method table consumed by the `Factory()` mixin. Almost every\n * entry is built via `buildFactoryMethod({ build, applies, exclude })`:\n * the `build` callback owns the bespoke constructor call (including any\n * DX reshaping Caper applies — asset-name resolution, text style\n * flattening, config-vs-extras splits), and the helper centralizes\n * position/scale/pivot/anchor + unknown-keys passthrough.\n *\n * The five bespoke entries (`existing`, `texture`, `svg`, `toaster`,\n * `entity`) don't fit the `(props?) → instance` shape — `existing` takes\n * `(entity, props)`, `texture` is a plain resolver re-bind, `svg` takes\n * a required `ctx` field, `toaster` takes two config objects, and\n * `entity` takes `(id, props)` with a generic narrowed to discovered\n * entity ids — so they stay hand-written.\n */\nexport const defaultFactoryMethods = {\n existing: <TEntity>(entity: TEntity, props?: Partial<ExistingProps>): TEntity => {\n if (!props) return entity;\n const { position, x, y, pivot, scale, scaleX, scaleY, ...rest } = props;\n resolvePosition({ position, x, y }, entity);\n resolveScale({ scale, scaleX, scaleY }, entity);\n resolvePivot(pivot, entity);\n resolveUnknownKeys(rest, entity);\n return entity;\n },\n\n container: buildFactoryMethod({\n build: (props?: Partial<ContainerProps>): Container =>\n new Container(props ? pluck(props, ContainerConfigKeys) : undefined),\n applies: ['position', 'scale', 'pivot'],\n exclude: ContainerConfigKeys as readonly string[],\n }),\n\n particleContainer: buildFactoryMethod({\n build: (props?: Partial<ParticleContainerProps>): ParticleContainer =>\n new ParticleContainer(props ? pluck(props, ParticleContainerConfigKeys) : undefined),\n applies: ['position', 'scale', 'pivot'],\n exclude: ParticleContainerConfigKeys as readonly string[],\n }),\n\n texture: resolveTexture,\n\n sprite: buildFactoryMethod({\n build: (props?: Partial<SpriteProps>) =>\n new Sprite(props ? resolveTexture(props) : undefined),\n applies: ['position', 'scale', 'pivot', 'anchor'],\n exclude: ['asset', 'sheet'],\n }),\n\n tilingSprite: buildFactoryMethod({\n build: (props?: Partial<TilingSpriteProps>) =>\n new TilingSprite(props ? resolveTexture(props) : undefined),\n applies: ['position', 'scale', 'pivot', 'anchor'],\n exclude: ['asset', 'sheet'],\n }),\n\n animatedSprite: buildFactoryMethod({\n // AnimatedSprite's Caper-side constructor consumes the full props bag\n // (animations, autoPlay, autoUpdate, sheet, texturePrefix, etc.), so\n // the schema's `build` just forwards them. Position/scale/pivot are\n // applied by the helper from the same object.\n build: (props?: Partial<AnimatedSpriteProps>): AnimatedSprite => new AnimatedSprite(props),\n applies: ['position', 'scale', 'pivot'],\n exclude: [\n 'sheet',\n 'texturePrefix',\n 'zeroPad',\n 'animations',\n 'autoPlay',\n 'autoUpdate',\n 'defaultAnimation',\n 'reversible',\n 'animationSpeed',\n 'startIndex',\n 'animation',\n ],\n }),\n\n graphics: buildFactoryMethod({\n build: (_props?: Partial<GraphicsProps>) => new Graphics(),\n applies: ['position', 'scale', 'pivot'],\n }),\n\n svg(props: WithRequiredProps<SvgProps, 'ctx'>) {\n const entity = new Svg(props.ctx);\n const { position, x, y, pivot, scale, scaleX, scaleY, ctx: _ctx, ...rest } = props;\n resolvePosition({ position, x, y }, entity);\n resolveScale({ scale, scaleX, scaleY }, entity);\n resolvePivot(pivot, entity);\n resolveUnknownKeys(rest, entity);\n return entity;\n },\n\n text: buildFactoryMethod({\n // Text flattens Pixi's nested `style: {...}` into top-level props for\n // DX (e.g. `{fontFamily, fontSize, fill}` without the `style:` wrapper\n // — see TextStyle type in props.ts). The build callback rebuilds the\n // Pixi-shape options object, including `anchor`/`pivot` pre-resolved\n // via `resolvePointLike(..., true)` the way the hand-written method\n // did. Post-construct resolvers handle position/scale/pivot.\n build: (props?: Partial<TextProps>) =>\n new Text(\n props\n ? {\n text: props.text,\n roundPixels: props.roundPixels,\n resolution: props.resolution,\n style: props.style,\n anchor: props.anchor ? resolvePointLike(props.anchor, true) : undefined,\n pivot: props.pivot ? resolvePointLike(props.pivot, true) : undefined,\n }\n : {},\n ),\n applies: ['position', 'scale', 'pivot'],\n exclude: [...TEXT_CONSUMED_KEYS],\n }),\n\n htmlText: buildFactoryMethod({\n build: (props?: Partial<HTMLTextProps>) =>\n new HTMLText(\n props\n ? {\n text: props.text,\n roundPixels: props.roundPixels,\n resolution: props.resolution,\n style: props.style,\n anchor: props.anchor ? resolvePointLike(props.anchor, true) : undefined,\n pivot: props.pivot ? resolvePointLike(props.pivot, true) : undefined,\n }\n : {},\n ),\n applies: ['position', 'scale', 'pivot'],\n exclude: [...TEXT_CONSUMED_KEYS],\n }),\n\n bitmapText: buildFactoryMethod({\n // BitmapText's ctor doesn't take `resolution` — that's the only field\n // that differs from Text/HTMLText here.\n build: (props?: Partial<BitmapTextProps>) =>\n new BitmapText(\n props\n ? {\n text: props.text,\n roundPixels: props.roundPixels,\n style: props.style,\n anchor: props.anchor ? resolvePointLike(props.anchor, true) : undefined,\n pivot: props.pivot ? resolvePointLike(props.pivot, true) : undefined,\n }\n : {},\n ),\n applies: ['position', 'scale', 'pivot'],\n exclude: [...TEXT_CONSUMED_KEYS],\n }),\n\n button: buildFactoryMethod({\n build: (props?: Partial<ButtonProps>): Button =>\n new Button((props ? pluck(props, ButtonConfigKeys) : undefined) as Partial<ButtonConfig>),\n applies: ['position', 'scale', 'pivot'],\n exclude: ButtonConfigKeys as readonly string[],\n }),\n\n flexContainer: buildFactoryMethod({\n // FlexContainer takes the full props bag (minus position/scale/pivot)\n // as its constructor config — historical: the hand-written method\n // passed `props as Partial<FlexContainerConfig>` directly rather than\n // plucking FlexContainerConfigKeys. Preserving that shape.\n build: (props?: Partial<FlexContainerProps>): FlexContainer =>\n new FlexContainer(props as Partial<FlexContainerConfig>),\n applies: ['position', 'scale', 'pivot'],\n exclude: FlexContainerConfigKeys as readonly string[],\n }),\n\n uiCanvas: buildFactoryMethod({\n build: (props?: Partial<UICanvasFactoryProps>): UICanvas =>\n // UICanvas's ctor takes Partial<UICanvasProps>, which is a superset\n // of UICanvasConfig — the pluck narrows, so cast back.\n new UICanvas(props ? (pluck(props, UICanvasConfigKeys) as Partial<UICanvasProps>) : ({} as Partial<UICanvasProps>)),\n applies: ['position', 'scale', 'pivot'],\n exclude: UICanvasConfigKeys as readonly string[],\n }),\n\n spine: buildFactoryMethod({\n build: (props?: Partial<SpineProps>): Spine => {\n // Resolve Caper's `{data: 'spine/foo'}` shorthand into the Pixi\n // `{skeleton, atlas}` pair expected by Spine.from().\n let spineData: { skeleton: string; atlas: string } | string = '';\n const data = props?.data;\n if (typeof data === 'string') {\n // If the asset name is missing an extension, default to .json. If\n // it has one, strip it so we can re-append both skeleton + atlas\n // paths from the base name.\n let ext = data.slice(-5);\n if (ext !== '.json' && ext !== '.skel') {\n ext = '.json';\n } else {\n spineData = data.substring(0, data.length - 5);\n }\n spineData = { skeleton: data + ext, atlas: data + '.atlas' };\n }\n const entity: Spine = (window as unknown as { Spine: { from: (d: unknown) => Spine } }).Spine.from(\n spineData,\n );\n // Spine-specific post-construct setup. Has to happen here (not in\n // `applies`) because the helper doesn't know about spine state.\n if (props?.autoUpdate !== undefined) entity.autoUpdate = props.autoUpdate;\n if (props?.animationName) {\n entity.state.setAnimation(props.trackIndex ?? 0, props.animationName, props.loop);\n }\n return entity;\n },\n applies: ['position', 'scale', 'pivot', 'anchor'],\n exclude: ['data', 'autoUpdate', 'animationName', 'trackIndex', 'loop'],\n }),\n\n spineAnimation: <ANames extends string = string>(\n props?: Partial<SpineProps>,\n ): SpineAnimation<ANames> => {\n // Hand-written rather than schema-driven because `buildFactoryMethod`\n // can't carry the `<ANames>` generic through to the call site —\n // kitchen-sink's SpineScene narrows the animation-name union via\n // `this.add.spineAnimation<CharacterAnimations>({...})`, which\n // requires the method itself to declare the generic.\n const entity = new SpineAnimation<ANames>(props);\n if (!props) return entity;\n const { position, x, y, anchor, pivot, scale, scaleX, scaleY, ...rest } = props;\n resolvePosition({ position, x, y }, entity);\n resolveScale({ scale, scaleX, scaleY }, entity);\n resolveAnchor(anchor, entity);\n resolvePivot(pivot, entity);\n resolveUnknownKeys(rest, entity);\n return entity;\n },\n\n toaster: (toasterConfig?: Partial<ToasterConfig>, defaultToastConfig: Partial<ToastConfig> = {}): Toaster => {\n return new Toaster(toasterConfig, defaultToastConfig);\n },\n\n /**\n * Construct an entity from the auto-discovered registry. `id` is narrowed\n * to the union of entity ids declared under `src/entities/` (see the\n * generated `caper-app.d.ts`), and `props` is typed from the entity's\n * constructor signature via `ConstructorParameters<typeof Entity>[0]`.\n *\n * Throws if `id` isn't registered. Discovery runs at build time, so the\n * only way to hit this at runtime is a stale virtual module — fail loud\n * and list the known ids so the user can see what's wrong.\n *\n * @example\n * this.add.entity('actor', { color: 0xff0000, x: 50, y: 100 });\n */\n entity: <K extends EntityId>(\n id: K,\n props?: EntityProps<K> & EntityFactoryProps,\n ): EntityInstance<K> => {\n const Ctor = getEntityCtor(id as string);\n if (!Ctor) {\n const known = getRegisteredEntityIds();\n throw new Error(\n `[caper] Unknown entity id '${String(id)}'. ` +\n `Known: ${known.length > 0 ? known.map((k) => `'${k}'`).join(', ') : '(none — discovery may have failed)'}`,\n );\n }\n const instance = new (Ctor as new (props?: EntityProps<K>) => EntityInstance<K>)(props);\n if (props) {\n const { position, x, y, pivot, scale, scaleX, scaleY, alpha, visible } = props as EntityFactoryProps;\n resolvePosition({ position, x, y }, instance);\n resolveScale({ scale, scaleX, scaleY }, instance);\n resolvePivot(pivot, instance);\n if (alpha !== undefined) (instance as unknown as { alpha: number }).alpha = alpha;\n if (visible !== undefined) (instance as unknown as { visible: boolean }).visible = visible;\n }\n return instance;\n },\n\n /**\n * Construct a UI element from the auto-discovered registry. `id` is\n * narrowed to the union of UI ids declared under `src/ui/` (see the\n * generated `caper-app.d.ts`), and `props` is typed from the UI\n * element's constructor signature via `ConstructorParameters<...>[0]`.\n *\n * @example\n * this.add.ui('close-button', { x: 100, y: 50 });\n */\n ui: <K extends UIId>(\n id: K,\n props?: UIProps<K> & EntityFactoryProps,\n ): UIInstance<K> => {\n const Ctor = getUICtor(id as string);\n if (!Ctor) {\n const known = getRegisteredUIIds();\n throw new Error(\n `[caper] Unknown ui id '${String(id)}'. ` +\n `Known: ${known.length > 0 ? known.map((k) => `'${k}'`).join(', ') : '(none — discovery may have failed)'}`,\n );\n }\n const instance = new (Ctor as new (props?: UIProps<K>) => UIInstance<K>)(props);\n if (props) {\n const { position, x, y, pivot, scale, scaleX, scaleY, alpha, visible } = props as EntityFactoryProps;\n resolvePosition({ position, x, y }, instance);\n resolveScale({ scale, scaleX, scaleY }, instance);\n resolvePivot(pivot, instance);\n if (alpha !== undefined) (instance as unknown as { alpha: number }).alpha = alpha;\n if (visible !== undefined) (instance as unknown as { visible: boolean }).visible = visible;\n }\n return instance;\n },\n};\n\n// Hand the table to the import-free registration slot the moment it exists, so\n// `Factory()` can read it without importing this module. See ./defaults.ts.\nsetDefaultFactoryMethods(defaultFactoryMethods);\n"],"mappings":";;;;;AAGA,IAAa,IAAc;CACzB,QAAQ;CACR,aAAa;CACb,aAAa;C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