@number10/phaserjsx 4.3.0 → 4.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.
Files changed (101) hide show
  1. package/README.md +9 -3
  2. package/dist/colors/color-presets.d.ts +1 -1
  3. package/dist/colors/color-presets.d.ts.map +1 -1
  4. package/dist/colors/color-types.d.ts +20 -8
  5. package/dist/colors/color-types.d.ts.map +1 -1
  6. package/dist/colors/color-utils.d.ts +29 -27
  7. package/dist/colors/color-utils.d.ts.map +1 -1
  8. package/dist/colors/index.d.ts +3 -3
  9. package/dist/colors/index.d.ts.map +1 -1
  10. package/dist/colors/preset-manager.d.ts.map +1 -1
  11. package/dist/colors/use-colors.d.ts +0 -4
  12. package/dist/colors/use-colors.d.ts.map +1 -1
  13. package/dist/components/backgroundImage.d.ts.map +1 -1
  14. package/dist/components/custom/ActivityIndicator.d.ts +43 -0
  15. package/dist/components/custom/ActivityIndicator.d.ts.map +1 -0
  16. package/dist/components/custom/Badge.d.ts.map +1 -1
  17. package/dist/components/custom/BottomSheet.d.ts +86 -0
  18. package/dist/components/custom/BottomSheet.d.ts.map +1 -0
  19. package/dist/components/custom/Button.d.ts +25 -2
  20. package/dist/components/custom/Button.d.ts.map +1 -1
  21. package/dist/components/custom/CharTextInput.d.ts +10 -0
  22. package/dist/components/custom/CharTextInput.d.ts.map +1 -1
  23. package/dist/components/custom/Checkbox.d.ts.map +1 -1
  24. package/dist/components/custom/ColorPicker.d.ts +72 -0
  25. package/dist/components/custom/ColorPicker.d.ts.map +1 -0
  26. package/dist/components/custom/Dropdown.d.ts +1 -1
  27. package/dist/components/custom/Dropdown.d.ts.map +1 -1
  28. package/dist/components/custom/Icon.d.ts.map +1 -1
  29. package/dist/components/custom/Icon.test.d.ts +2 -0
  30. package/dist/components/custom/Icon.test.d.ts.map +1 -0
  31. package/dist/components/custom/ListBox.d.ts +77 -0
  32. package/dist/components/custom/ListBox.d.ts.map +1 -0
  33. package/dist/components/custom/MenuButton.d.ts +40 -0
  34. package/dist/components/custom/MenuButton.d.ts.map +1 -0
  35. package/dist/components/custom/NumberInput.d.ts +143 -0
  36. package/dist/components/custom/NumberInput.d.ts.map +1 -0
  37. package/dist/components/custom/PalettePicker.d.ts +96 -0
  38. package/dist/components/custom/PalettePicker.d.ts.map +1 -0
  39. package/dist/components/custom/Popover.d.ts +9 -0
  40. package/dist/components/custom/Popover.d.ts.map +1 -1
  41. package/dist/components/custom/ProgressBar.d.ts.map +1 -1
  42. package/dist/components/custom/ProgressView.d.ts +47 -0
  43. package/dist/components/custom/ProgressView.d.ts.map +1 -0
  44. package/dist/components/custom/RadioButton.d.ts +8 -0
  45. package/dist/components/custom/RadioButton.d.ts.map +1 -1
  46. package/dist/components/custom/RadioGroup.d.ts +4 -0
  47. package/dist/components/custom/RadioGroup.d.ts.map +1 -1
  48. package/dist/components/custom/RatingBar.d.ts +48 -0
  49. package/dist/components/custom/RatingBar.d.ts.map +1 -0
  50. package/dist/components/custom/ScrollSlider.d.ts +7 -1
  51. package/dist/components/custom/ScrollSlider.d.ts.map +1 -1
  52. package/dist/components/custom/ScrollView.d.ts.map +1 -1
  53. package/dist/components/custom/SegmentedControl.d.ts +99 -0
  54. package/dist/components/custom/SegmentedControl.d.ts.map +1 -0
  55. package/dist/components/custom/Toast.d.ts +89 -0
  56. package/dist/components/custom/Toast.d.ts.map +1 -0
  57. package/dist/components/custom/Toggle.d.ts.map +1 -1
  58. package/dist/components/custom/Toolbar.d.ts +134 -0
  59. package/dist/components/custom/Toolbar.d.ts.map +1 -0
  60. package/dist/components/custom/WheelPicker.d.ts +63 -0
  61. package/dist/components/custom/WheelPicker.d.ts.map +1 -0
  62. package/dist/components/custom/index.cjs +39 -1
  63. package/dist/components/custom/index.d.ts +18 -5
  64. package/dist/components/custom/index.d.ts.map +1 -1
  65. package/dist/components/custom/index.js +2 -2
  66. package/dist/components/custom/useOverlayPresence.d.ts +9 -0
  67. package/dist/components/custom/useOverlayPresence.d.ts.map +1 -0
  68. package/dist/components/index.d.ts +16 -5
  69. package/dist/components/index.d.ts.map +1 -1
  70. package/dist/{custom-DMZASXll.js → custom-pRNJ0_kS.js} +17044 -27908
  71. package/dist/custom-pRNJ0_kS.js.map +1 -0
  72. package/dist/{custom-37gL0VZG.cjs → custom-rkdLsk0U.cjs} +17358 -27863
  73. package/dist/custom-rkdLsk0U.cjs.map +1 -0
  74. package/dist/design-tokens/component-size-presets.d.ts +52 -0
  75. package/dist/design-tokens/component-size-presets.d.ts.map +1 -0
  76. package/dist/design-tokens/index.d.ts +2 -0
  77. package/dist/design-tokens/index.d.ts.map +1 -1
  78. package/dist/dev-config.d.ts.map +1 -1
  79. package/dist/index.cjs +61 -254
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.js +2 -242
  82. package/dist/index.js.map +1 -1
  83. package/dist/jsx-runtime.cjs +4 -1
  84. package/dist/jsx-runtime.cjs.map +1 -1
  85. package/dist/jsx-runtime.d.ts.map +1 -1
  86. package/dist/jsx-runtime.js +4 -1
  87. package/dist/jsx-runtime.js.map +1 -1
  88. package/dist/layout/utils/child-utils.d.ts.map +1 -1
  89. package/dist/layout/utils/dimension-calculator.d.ts.map +1 -1
  90. package/dist/scripts/generate-icon-loaders.js +27 -1
  91. package/dist/scripts/generate-icons.d.ts.map +1 -1
  92. package/dist/scripts/generate-icons.js +27 -1
  93. package/dist/theme-custom.d.ts +293 -8
  94. package/dist/theme-custom.d.ts.map +1 -1
  95. package/dist/theme-defaults.d.ts.map +1 -1
  96. package/dist/theme.d.ts +9 -0
  97. package/dist/theme.d.ts.map +1 -1
  98. package/dist/vdom.d.ts.map +1 -1
  99. package/package.json +1 -3
  100. package/dist/custom-37gL0VZG.cjs.map +0 -1
  101. package/dist/custom-DMZASXll.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-rkdLsk0U.cjs","names":["#value"],"sources":["../src/utils/phaser-guards.ts","../src/host.ts","../src/components/appliers/applyGraphics.ts","../src/components/appliers/applyGraphicsLayout.ts","../src/components/appliers/applyPhaser.ts","../src/components/appliers/applyTransform.ts","../src/components/creators/createGraphicsLayout.ts","../src/components/creators/createPhaser.ts","../src/components/creators/createTransform.ts","../src/components/primitives/graphics.ts","../src/components/appliers/applyImage.ts","../src/components/appliers/applyImageLayout.ts","../src/components/creators/createImageLayout.ts","../src/components/primitives/image.ts","../src/components/appliers/applyNineSlice.ts","../src/components/appliers/applyNineSliceLayout.ts","../src/components/creators/createNineSliceLayout.ts","../src/components/primitives/nineslice.ts","../src/particles/emit-zone.ts","../src/particles/preset-registry.ts","../src/particles/utils.ts","../src/components/appliers/applyParticles.ts","../src/components/appliers/applyParticlesLayout.ts","../src/components/creators/createParticlesLayout.ts","../src/components/primitives/particles.ts","../src/components/appliers/applySprite.ts","../src/components/appliers/applySpriteLayout.ts","../src/components/creators/createSpriteLayout.ts","../src/components/primitives/sprite.ts","../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../src/utils/fast-deep-equal.ts","../src/dev-config.ts","../src/viewport-context.ts","../src/layout/utils/size-resolver.ts","../src/components/appliers/applyText.ts","../src/components/appliers/applyTextLayout.ts","../src/components/creators/createTextLayout.ts","../src/components/primitives/text.ts","../src/components/primitives/tilesprite.ts","../src/components/backgroundImage.ts","../src/components/appliers/applyBackground.ts","../src/gestures/gesture-types.ts","../src/gestures/gesture-manager.ts","../src/components/appliers/applyGestures.ts","../src/core-props.ts","../src/layout/appliers/background-applier.ts","../src/layout/appliers/container-applier.ts","../src/layout/appliers/position-applier.ts","../src/layout/utils/spacing-calculator.ts","../src/layout/strategies/base-strategy.ts","../src/layout/strategies/column-layout.ts","../src/layout/strategies/row-layout.ts","../src/layout/strategies/stack-layout.ts","../src/layout/utils/child-utils.ts","../src/layout/utils/dimension-calculator.ts","../src/layout/utils/flex-distributor.ts","../src/layout/layout-engine.ts","../src/components/appliers/applyLayout.ts","../src/colors/color-types.ts","../src/colors/color-utils.ts","../src/colors/color-presets.ts","../src/design-tokens/component-size-presets.ts","../src/design-tokens/design-token-presets.ts","../src/theme-defaults.ts","../src/render-context.ts","../src/hooks.ts","../src/components/custom/View.tsx","../src/components/internal/SceneWrapper.tsx","../src/portal/portal-registry.ts","../src/vdom.ts","../src/theme.ts","../src/components/appliers/applyTooltip.ts","../src/components/creators/createBackground.ts","../src/components/creators/createGestures.ts","../src/components/creators/createLayout.ts","../src/components/primitives/view.ts","../src/components/custom/ActivityIndicator.tsx","../src/components/custom/Badge.tsx","../src/effects/use-effect.ts","../src/effects/effect-registry.ts","../src/components/custom/Button.tsx","../src/components/custom/Checkbox.tsx","../src/colors/use-color-mode.ts","../src/colors/use-colors.ts","../src/colors/color-theme-helpers.ts","../src/colors/preset-manager.ts","../src/components/custom/RefOriginView.tsx","../src/components/custom/Slider.tsx","../src/components/custom/ColorPicker.tsx","../src/design-tokens/use-theme-tokens.ts","../src/components/custom/DebugPanel.tsx","../src/components/custom/Graphics.tsx","../src/components/custom/ScrollSlider.tsx","../src/components/custom/ScrollView.tsx","../src/components/custom/ListBox.tsx","../src/components/custom/Portal.tsx","../src/components/custom/useOverlayPresence.ts","../src/components/custom/Popover.tsx","../src/components/custom/MenuButton.tsx","../src/components/custom/NumberInput.tsx","../src/components/custom/PalettePicker.tsx","../src/components/custom/Particles.tsx","../src/components/custom/ProgressBar.tsx","../src/components/custom/ProgressView.tsx","../src/components/custom/RadioButton.tsx","../src/components/custom/RadioGroup.tsx","../src/components/custom/RatingBar.tsx","../src/components/custom/SegmentedControl.tsx","../src/components/custom/Sprite.tsx","../src/components/custom/Text.tsx","../src/components/custom/TileSprite.tsx","../src/components/custom/WrapText.tsx","../src/components/custom/Toast.tsx","../src/components/custom/Divider.tsx","../src/components/custom/Toolbar.tsx","../src/components/index.ts","../src/utils/svg-texture.ts","../src/utils/texture-registry.ts","../src/hooks-svg.ts","../src/utils/dom-input-manager.ts","../src/utils/KeyboardInputManager.ts","../src/animation/animated-signal.ts","../src/animation/spring-physics.ts","../src/animation/useSpring.ts","../src/components/custom/Accordion.tsx","../src/components/custom/Modal.tsx","../src/components/custom/Dialog.tsx","../src/components/custom/AlertDialog.tsx","../src/components/custom/BottomSheet.tsx","../src/components/custom/CharText/utils.ts","../src/components/custom/CharText/CharText.tsx","../src/components/custom/CharTextInput.tsx","../src/components/custom/TransformOriginView.tsx","../src/components/custom/Dropdown.tsx","../src/components/custom/Image.tsx","../src/components/custom/Icon.tsx","../src/components/custom/Joystick.tsx","../src/components/custom/NineSlice.tsx","../src/components/custom/NineSliceButton.tsx","../src/components/custom/Sidebar.tsx","../src/components/custom/Tabs.tsx","../src/components/custom/Toggle.tsx","../src/components/custom/WheelPicker.tsx"],"sourcesContent":["import type * as Phaser from 'phaser'\n\n/**\n * Duck-typed Phaser guards to avoid instanceof issues when multiple Phaser copies exist.\n */\nexport function isPhaserScene(value: unknown): value is Phaser.Scene {\n if (!value || typeof value !== 'object') return false\n const maybe = value as Phaser.Scene & { sys?: unknown; add?: unknown }\n return typeof maybe.sys === 'object' && typeof maybe.add === 'object'\n}\n\nexport function isPhaserContainer(value: unknown): value is Phaser.GameObjects.Container {\n if (!value || typeof value !== 'object') return false\n const maybe = value as Phaser.GameObjects.Container & {\n list?: unknown\n add?: unknown\n remove?: unknown\n }\n return (\n Array.isArray(maybe.list) &&\n typeof maybe.add === 'function' &&\n typeof maybe.remove === 'function'\n )\n}\n","/**\n * Host layer - Generic bridge between VDOM and Phaser GameObjects\n * Provides type-safe creator/patcher pattern for extensible node types\n */\nimport type * as Phaser from 'phaser'\nimport type { NodeInstance, NodeProps, NodeType } from './core-types'\nimport { isPhaserContainer, isPhaserScene } from './utils/phaser-guards'\n\n/**\n * Host creator function type - creates a node instance from props\n */\nexport type HostCreator<T extends NodeType> = (\n scene: Phaser.Scene,\n props: NodeProps<T>\n) => NodeInstance<T>\n\n/**\n * Host patcher function type - updates node properties\n */\nexport type HostPatcher<T extends NodeType> = (\n node: NodeInstance<T>,\n prev: NodeProps<T>,\n next: NodeProps<T>\n) => void\n\n/**\n * Node descriptor combining creator and patcher\n */\nexport interface NodeDescriptor<T extends NodeType> {\n create: HostCreator<T>\n patch: HostPatcher<T>\n}\n\n/**\n * Internal registry of node descriptors\n */\ntype NodeRegistry = {\n [K in NodeType]: NodeDescriptor<K>\n}\n\n/**\n * Node registry - maps node types to their descriptors\n * Exported for external registration of custom node types\n */\nexport const nodeRegistry: Partial<NodeRegistry> = {}\n\n/**\n * Registers a node descriptor (creator + patcher) for a custom node type\n * @param type - Node type name\n * @param descriptor - Node descriptor with create and patch functions\n */\nexport function register<T extends NodeType>(type: T, descriptor: NodeDescriptor<T>): void {\n nodeRegistry[type] = descriptor as NodeRegistry[T]\n}\n\n/**\n * Host API - Generic interface for VDOM to manage Phaser nodes\n */\nexport const host = {\n /**\n * Creates a node instance using the registered creator for the given type\n * @param type - Node type name\n * @param props - Node properties\n * @param scene - Phaser scene\n * @returns Created node instance\n * @throws Error if no creator registered for the type\n */\n create<T extends NodeType>(type: T, props: NodeProps<T>, scene: Phaser.Scene): NodeInstance<T> {\n const descriptor = nodeRegistry[type] as NodeDescriptor<T> | undefined\n if (!descriptor) {\n throw new Error(`No host descriptor registered for node type \"${String(type)}\"`)\n }\n return descriptor.create(scene, props)\n },\n\n /**\n * Patches node properties with updates using the registered patcher\n * @param type - Node type name\n * @param node - Node to patch\n * @param prev - Previous props\n * @param next - New props\n */\n patch<T extends NodeType>(\n type: T,\n node: NodeInstance<T>,\n prev: NodeProps<T>,\n next: NodeProps<T>\n ): void {\n const descriptor = nodeRegistry[type] as NodeDescriptor<T> | undefined\n if (!descriptor) {\n throw new Error(`No host descriptor registered for node type \"${String(type)}\"`)\n }\n descriptor.patch(node, prev, next)\n },\n\n /**\n * Appends child node to parent container\n * @param parent - Parent container or scene\n * @param child - Child node to append\n */\n append(parent: unknown, child: unknown) {\n // Parent is a Container\n if (isPhaserContainer(parent)) {\n parent.add(child as Phaser.GameObjects.GameObject)\n }\n // Parent is a Scene\n else if (isPhaserScene(parent)) {\n const scene = parent as Phaser.Scene\n scene.add.existing(child as Phaser.GameObjects.GameObject)\n }\n // Fallback: try to add to display list\n else if (parent && typeof parent === 'object' && 'scene' in parent) {\n const gameObject = parent as Phaser.GameObjects.GameObject\n if (gameObject.scene?.children) {\n gameObject.scene.children.add(child as Phaser.GameObjects.GameObject)\n }\n }\n },\n\n /**\n * Removes child node from parent and destroys it\n * @param parent - Parent container\n * @param child - Child node to remove\n */\n remove(parent: unknown, child: unknown) {\n const childObj = child as Phaser.GameObjects.GameObject & { scene?: Phaser.Scene | null }\n\n // Check if child still has a scene (not already destroyed)\n if (!childObj.scene) return\n\n // Remove from parent container first\n if (isPhaserContainer(parent)) {\n parent.remove(childObj, false)\n }\n\n // Destroy the child WITHOUT destroying its children (VDOM handles that)\n if (childObj.destroy) {\n childObj.destroy(false)\n }\n },\n\n /**\n * Performs layout update on container (no-op for native Phaser)\n */\n layout() {\n // Native Phaser containers don't have automatic layout\n // This is a no-op but kept for API compatibility\n },\n}\n","/**\n * Graphics-specific property appliers\n */\nimport type * as Phaser from 'phaser'\nimport type { GameObjectWithLayout } from '../../layout/types'\nimport type { GraphicsBaseProps } from '../primitives/graphics'\n\n/**\n * Graphics node with draw dependencies tracking\n */\ntype GraphicsWithDrawDeps = Phaser.GameObjects.Graphics &\n GameObjectWithLayout & {\n __drawDependencies?: unknown[] | undefined\n }\n\n/**\n * Shallow comparison of dependency arrays\n * @param a - First array\n * @param b - Second array\n * @returns True if arrays are equal\n */\nfunction shallowEqual(a?: unknown[], b?: unknown[]): boolean {\n if (!a || !b) return a === b\n if (a.length !== b.length) return false\n return a.every((val, i) => val === b[i])\n}\n\n/**\n * Apply Graphics-specific props (onDraw, autoClear, dependencies)\n * @param node - Graphics node\n * @param _prev - Previous props (unused, dependencies stored on node)\n * @param next - New props\n */\nexport function applyGraphicsProps(\n node: Phaser.GameObjects.Graphics,\n _prev: Partial<GraphicsBaseProps>,\n next: Partial<GraphicsBaseProps>\n): void {\n // Check if dependencies changed (shallow compare)\n const prevDeps = (node as GraphicsWithDrawDeps).__drawDependencies\n const nextDeps = next.dependencies\n const depsChanged = !shallowEqual(prevDeps, nextDeps)\n\n // Redraw if dependencies changed and onDraw callback exists\n if (depsChanged && next.onDraw) {\n // Clear graphics if autoClear is enabled (default: true)\n if (next.autoClear !== false) {\n node.clear()\n }\n\n // Execute draw callback\n next.onDraw(node, next)\n\n // Update stored dependencies\n ;(node as GraphicsWithDrawDeps).__drawDependencies = nextDeps\n }\n}\n","/**\n * Graphics layout property appliers\n */\nimport type * as Phaser from 'phaser'\nimport type { GameObjectWithLayout } from '../../layout/types'\nimport type { GraphicsBaseProps } from '../primitives/graphics'\n\n/**\n * Apply layout updates for Graphics (width/height changes)\n * @param node - Graphics node\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyGraphicsLayout(\n node: Phaser.GameObjects.Graphics,\n prev: Partial<GraphicsBaseProps>,\n next: Partial<GraphicsBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation (like Text does)\n ;(node as GameObjectWithLayout).__layoutProps = next as GraphicsBaseProps\n\n // Update size provider if dimensions or headless changed\n if (prev.width !== next.width || prev.height !== next.height || prev.headless !== next.headless) {\n ;(node as GameObjectWithLayout).__getLayoutSize = () => {\n if (next.headless ?? true) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: typeof next.width === 'number' ? next.width : 0,\n height: typeof next.height === 'number' ? next.height : 0,\n }\n }\n }\n}\n","/**\n * Applier for Phaser GameObject display properties\n */\nimport type { Display, PhaserProps } from '../../core-props'\n\n/**\n * Generic node type with Phaser GameObject display capabilities\n */\ntype PhaserNode = {\n visible: boolean\n setAlpha: (alpha: number) => void\n setDepth: (depth: number) => void\n}\n\n/**\n * Normalize visible prop to boolean for Phaser GameObject\n * - true / 'visible' → true (rendered)\n * - false / 'invisible' → false (not rendered, but takes space)\n * - 'none' → false (not rendered, no space)\n * @param visible - Visible prop value\n * @returns Boolean for Phaser GameObject.visible\n */\nfunction normalizeVisible(visible: boolean | Display | undefined): boolean {\n if (visible === undefined) return true // default: visible\n if (typeof visible === 'boolean') return visible\n // String values\n if (visible === 'visible') return true\n if (visible === 'invisible' || visible === 'none') return false\n return true\n}\n\n/**\n * Applies Phaser display properties (alpha, depth, visibility)\n * @param node - Node with Phaser GameObject properties\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyPhaserProps<T extends Partial<PhaserNode>>(\n node: T,\n prev: Partial<PhaserProps & { visible?: boolean | Display }>,\n next: Partial<PhaserProps & { visible?: boolean | Display }>\n): void {\n // Alpha\n if (prev.alpha !== next.alpha && typeof next.alpha === 'number') {\n node.setAlpha?.(next.alpha)\n }\n\n // Depth\n if (prev.depth !== next.depth && typeof next.depth === 'number') {\n node.setDepth?.(next.depth)\n }\n\n // Visibility - supports boolean and Display type (from LayoutProps)\n if (prev.visible !== next.visible) {\n const visibleValue = normalizeVisible(next.visible)\n node.visible = visibleValue\n }\n}\n","/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport type { TransformProps } from '../../core-props'\n\n/**\n * Generic node type with transform capabilities\n */\ntype TransformNode = {\n x: number\n y: number\n rotation: number\n scaleX: number\n scaleY: number\n setScale: (x: number, y: number) => void\n}\n\n/**\n * Applies transform properties (position, rotation, scale)\n * @param node - Node with transform properties\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTransformProps<T extends Partial<TransformNode>>(\n node: T,\n prev: Partial<TransformProps>,\n next: Partial<TransformProps>\n): void {\n // Position\n if (prev.x !== next.x && typeof next.x === 'number') {\n node.x = next.x\n }\n if (prev.y !== next.y && typeof next.y === 'number') {\n node.y = next.y\n }\n\n // Rotation\n if (prev.rotation !== next.rotation && typeof next.rotation === 'number') {\n node.rotation = next.rotation\n }\n\n // Scale - handle both unified scale and separate scaleX/scaleY\n const nextScale = next.scale as number | undefined\n const nextScaleX = next.scaleX as number | undefined\n const nextScaleY = next.scaleY as number | undefined\n const prevScale = prev.scale as number | undefined\n const prevScaleX = prev.scaleX as number | undefined\n const prevScaleY = prev.scaleY as number | undefined\n\n if (nextScale !== undefined && nextScale !== prevScale) {\n node.setScale?.(nextScale, nextScale)\n } else if (nextScaleX !== prevScaleX || nextScaleY !== prevScaleY) {\n const currentScaleX = node.scaleX ?? 1\n const currentScaleY = node.scaleY ?? 1\n const sx = nextScaleX ?? currentScaleX\n const sy = nextScaleY ?? currentScaleY\n node.setScale?.(sx, sy)\n }\n}\n","/**\n * Layout system initialization for Graphics component\n */\nimport type * as Phaser from 'phaser'\nimport type { GraphicsBaseProps } from '../primitives/graphics'\n\n/**\n * Setup layout system for Graphics component\n * @param graphics - Phaser Graphics instance\n * @param props - Initial props\n */\nexport function createGraphicsLayout(\n graphics: Phaser.GameObjects.Graphics,\n props: Partial<GraphicsBaseProps>\n): void {\n // Validation: headless=false requires explicit width/height\n if (props.headless === false) {\n if (typeof props.width !== 'number' || typeof props.height !== 'number') {\n throw new Error(\n 'Graphics component requires explicit width and height props when headless=false'\n )\n }\n }\n\n // Setup layout props (for layout system) - store ALL props like Text does\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(graphics as any).__layoutProps = props as GraphicsBaseProps\n\n // Setup layout size provider (returns explicit dimensions)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(graphics as any).__getLayoutSize = () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((graphics as any).__layoutProps?.headless ?? true) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: props.width ?? 0,\n height: props.height ?? 0,\n }\n }\n\n // Store dependencies for comparison in patcher\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(graphics as any).__drawDependencies = props.dependencies\n}\n","/**\n * Creator for Phaser GameObject display properties\n */\nimport type { Display, PhaserProps } from '../../core-props'\n\n/**\n * Normalize visible prop to boolean for Phaser GameObject\n * - true / 'visible' → true (rendered)\n * - false / 'invisible' → false (not rendered, but takes space)\n * - 'none' → false (not rendered, no space)\n * @param visible - Visible prop value\n * @returns Boolean for Phaser GameObject.visible\n */\nfunction normalizeVisible(visible: boolean | Display | undefined): boolean {\n if (visible === undefined) return true // default: visible\n if (typeof visible === 'boolean') return visible\n // String values\n if (visible === 'visible') return true\n if (visible === 'invisible' || visible === 'none') return false\n return true\n}\n\n/**\n * Apply Phaser display properties during node creation\n * @param node - Node with Phaser GameObject capabilities\n * @param props - Initial props\n */\nexport function createPhaser<\n T extends {\n visible: boolean\n setDepth: (depth: number) => void\n setAlpha: (alpha: number) => void\n },\n>(node: T, props: Partial<PhaserProps & { visible?: boolean | Display }>): void {\n // Visibility - supports boolean and Display type (from LayoutProps)\n if (props.visible !== undefined) {\n node.visible = normalizeVisible(props.visible)\n }\n if (props.depth !== undefined) {\n node.setDepth(props.depth)\n }\n if (props.alpha !== undefined) {\n node.setAlpha(props.alpha)\n }\n}\n","/**\n * Shared property creators for component initialization\n * These functions avoid code duplication when creating nodes with initial properties\n */\nimport type { TransformProps } from '../../core-props'\n\n/**\n * Apply transform properties during node creation (geometric transformations only)\n * @param node - Node with transform capabilities\n * @param props - Initial props\n */\nexport function createTransform<\n T extends {\n setScale: (x: number, y: number) => void\n setRotation: (rotation: number) => void\n },\n>(node: T, props: Partial<TransformProps>): void {\n if (props.scaleX !== undefined || props.scaleY !== undefined) {\n node.setScale(\n (props.scaleX as number | undefined) ?? 1,\n (props.scaleY as number | undefined) ?? 1\n )\n }\n if (props.rotation !== undefined) {\n node.setRotation(props.rotation as number)\n }\n}\n","/**\n * Graphics component - Phaser Graphics GameObject (custom shapes)\n * Status: IMPLEMENTED ✅\n *\n * Design Decisions & Answers:\n * ===========================\n *\n * 1. Headless Default: TRUE ✅\n * Rationale: Graphics are typically decorative (custom shapes, effects).\n * They should NOT affect layout unless explicitly configured.\n * Use Cases:\n * - ✅ Headless (default): Debug visualizations, particle trails, decorative effects\n * - ❌ Layout-aware: Custom UI shapes (via headless=false + explicit width/height)\n *\n * 2. View Background vs. Graphics Component: CLEAR SEPARATION ✅\n * View Background (internal):\n * - Special role: Defines container dimensions\n * - Automatically managed by View component\n * - Marked with __isBackground flag\n * - Always excluded from layout calculations\n * Graphics Component (user-facing):\n * - Custom shapes for any purpose\n * - User controls drawing via onDraw callback\n * - Can be headless OR layout-aware (explicit)\n * - Independent GameObject, not tied to View\n *\n * 3. Layout Size Provider: EXPLICIT DIMENSIONS REQUIRED ✅\n * Decision: Option A - Require explicit width/height props for layout participation\n * Reasoning:\n * - Graphics have no inherent dimensions until drawn\n * - Calculating bounds dynamically is expensive (getBounds() forces geometry calc)\n * - Bounds change with every draw call (unstable for layout)\n * - Explicit dimensions = predictable layout behavior\n * Implementation:\n * - If headless=false: Require width/height props (throw error if missing)\n * - __getLayoutSize = () => ({ width: props.width!, height: props.height! })\n *\n * 4. Drawing API: IMPERATIVE CALLBACK ✅\n * Decision: Option A - onDraw callback (imperative)\n * Reasoning:\n * - Simplest API, full Phaser Graphics power\n * - No abstraction overhead\n * - Familiar to Phaser developers\n * - Flexible for complex shapes\n * Interface:\n * onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n * Example:\n * <Graphics onDraw={(g) => {\n * g.fillStyle(0xff0000, 1)\n * g.fillCircle(50, 50, 50)\n * }} />\n * Future: Consider declarative shape components if demand is high\n *\n * 5. Redraw Strategy: DEPENDENCY-BASED ✅\n * Decision: Redraw when dependencies array changes (React useEffect style)\n * Behavior:\n * - autoClear=true (default): Clear graphics before each onDraw call\n * - dependencies=[...]: Only redraw when dependencies change (shallow compare)\n * - No dependencies: Redraw on every patch (expensive!)\n * Implementation:\n * - Store previous dependencies on graphics object\n * - Compare with current dependencies in patcher\n * - Call onDraw only if changed\n *\n * 6. Performance Optimization: GENERATE-TEXTURE PATH 🆕\n * Strategy for static graphics:\n * - Static graphics (no redraw) → Consider generateTexture() optimization\n * - Converts geometry to texture (faster rendering, loses vector quality)\n * - Trade-off: Memory (texture) vs. CPU (redraw)\n * Props:\n * - static?: boolean (if true, generate texture after first draw)\n * - textureKey?: string (cache key for generated texture)\n * Recommendation: Advanced feature, implement later if needed\n *\n * 7. Common Use Cases & Alternatives: DOCUMENTED ✅\n * Use Graphics For:\n * - ✅ Custom complex shapes (polygons, stars, bezier curves)\n * - ✅ Dynamic visualizations (graphs, charts)\n * - ✅ Progress bars with custom shapes\n * - ✅ Debug overlays (hit boxes, grids)\n * Use Alternatives For:\n * - ❌ Simple rectangles → Use View with backgroundColor\n * - ❌ Borders → Use View with borderColor/borderWidth\n * - ❌ Static shapes → Consider Image with pre-rendered texture\n * - ❌ Repeated patterns → Use TileSprite\n *\n * 8. Clear Behavior: CONFIGURABLE ✅\n * Decision: autoClear=true by default\n * Reasoning:\n * - Most use cases: Single shape per Graphics object\n * - Prevents accumulation of draw calls\n * - Override with autoClear=false for additive drawing\n * Edge Case: Multiple draw calls in onDraw → All executed, then cleared on next redraw\n *\n * Implementation Status:\n * ======================\n * [✅] Create graphics with scene.add.graphics()\n * [✅] Apply transform props via applyTransformProps\n * [✅] Setup onDraw callback invocation\n * [✅] Implement dependency-based redraw logic\n * [✅] Handle autoClear flag\n * [✅] Setup layout size provider (explicit width/height)\n * [✅] Validate width/height if headless=false\n * [✅] Example component with interactive demos\n * [❌] generateTexture optimization (future enhancement)\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyGraphicsProps } from '../appliers/applyGraphics'\nimport { applyGraphicsLayout } from '../appliers/applyGraphicsLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createGraphicsLayout } from '../creators/createGraphicsLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Graphics component\n */\nexport interface GraphicsBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /**\n * Drawing callback - receives Graphics instance for custom drawing\n * Called on mount and when dependencies change\n * @param graphics - Phaser Graphics instance\n * @param props - Current props (for accessing dynamic values)\n */\n onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n\n /**\n * If true, graphics is cleared before onDraw is called\n * Default: true (usually what you want)\n */\n autoClear?: boolean\n\n /**\n * Dependencies array - if any value changes, onDraw is re-executed\n * Similar to React useEffect dependencies\n */\n dependencies?: unknown[]\n}\n\n/**\n * Props for Graphics component\n */\nexport interface GraphicsProps\n extends GraphicsBaseProps, PropsDefaultExtension<Phaser.GameObjects.Graphics> {}\n\n/**\n * Graphics creator - creates a Phaser Graphics object\n */\nexport const graphicsCreator: HostCreator<'Graphics'> = (scene, props) => {\n // Create graphics (position set via setPosition below)\n const graphics = scene.add.graphics()\n\n // Set initial position explicitly (Graphics doesn't take x/y in constructor like Text does)\n graphics.setPosition(props.x ?? 0, props.y ?? 0)\n\n // Apply transform props (scale, rotation)\n createTransform(graphics, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(graphics, props)\n\n // Setup layout system (props and size provider)\n createGraphicsLayout(graphics, props)\n\n // Execute initial draw if onDraw callback provided\n if (props.onDraw) {\n props.onDraw(graphics, props)\n }\n return graphics\n}\n\n/**\n * Graphics patcher - updates Graphics properties\n */\nexport const graphicsPatcher: HostPatcher<'Graphics'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply Graphics-specific props (onDraw, autoClear, dependencies)\n applyGraphicsProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applyGraphicsLayout(node, prev, next)\n}\n","/**\n * Applier for Image-specific properties\n */\nimport type * as Phaser from 'phaser'\nimport type { ImageBaseProps } from '../primitives/image'\n\n/**\n * Calculates scale factors for fit modes\n * @param image - Phaser Image object\n * @param targetWidth - Desired width\n * @param targetHeight - Desired height\n * @param fit - Fit mode\n * @returns Scale factors for x and y\n */\nfunction calculateFitScale(\n image: Phaser.GameObjects.Image,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill'\n): { scaleX: number; scaleY: number } {\n const textureWidth = image.width\n const textureHeight = image.height\n\n if (textureWidth === 0 || textureHeight === 0) {\n return { scaleX: 1, scaleY: 1 }\n }\n\n if (fit === 'fill') {\n // Stretch to fill (may distort aspect ratio)\n return {\n scaleX: targetWidth / textureWidth,\n scaleY: targetHeight / textureHeight,\n }\n }\n\n const targetAspect = targetWidth / targetHeight\n const textureAspect = textureWidth / textureHeight\n\n if (fit === 'contain') {\n // Scale to fit within bounds, preserve aspect ratio\n const scale =\n targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n if (fit === 'cover') {\n // Scale to cover bounds, preserve aspect ratio (may crop)\n const scale =\n targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n return { scaleX: 1, scaleY: 1 }\n}\n\n/**\n * Applies Image-specific properties (texture, frame, tint, displaySize, fit)\n * @param image - Phaser Image object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyImageProps(\n image: Phaser.GameObjects.Image,\n prev: Partial<ImageBaseProps>,\n next: Partial<ImageBaseProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n image.setTexture(next.texture, next.frame)\n }\n\n // Apply tint\n if (prev.tint !== next.tint) {\n if (typeof next.tint === 'number') {\n image.setTint(next.tint)\n } else {\n image.clearTint()\n }\n }\n\n // Apply origin if specified\n if (prev.originX !== next.originX || prev.originY !== next.originY) {\n const originX = next.originX ?? image.originX\n const originY = next.originY ?? image.originY\n image.setOrigin(originX, originY)\n }\n\n // Apply displayWidth/displayHeight with fit mode\n const displayWidthChanged = prev.displayWidth !== next.displayWidth\n const displayHeightChanged = prev.displayHeight !== next.displayHeight\n const fitChanged = prev.fit !== next.fit\n\n if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n const { scaleX, scaleY } = calculateFitScale(\n image,\n next.displayWidth,\n next.displayHeight,\n next.fit\n )\n image.setScale(scaleX, scaleY)\n } else if (typeof next.displayWidth === 'number') {\n // Only width specified - preserve aspect ratio\n const scale = next.displayWidth / image.width\n image.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height specified - preserve aspect ratio\n const scale = next.displayHeight / image.height\n image.setScale(scale, scale)\n }\n }\n}\n","/**\n * Layout applier for Image components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { LayoutSize } from '../../layout/index'\nimport type { ImageBaseProps } from '../primitives/image'\n\n/**\n * Applies layout props and updates layout size provider\n * @param image - Phaser Image object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyImageLayout(\n image: Phaser.GameObjects.Image & {\n __layoutProps?: ImageBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n prev: Partial<ImageBaseProps & LayoutProps>,\n next: Partial<ImageBaseProps & LayoutProps>\n): void {\n // Update layout props reference\n image.__layoutProps = next as ImageBaseProps\n\n // Update size provider if headless flag changed\n if (prev.headless !== next.headless) {\n image.__getLayoutSize = () => {\n if (image.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: image.displayWidth,\n height: image.displayHeight,\n }\n }\n }\n}\n","/**\n * Layout creator for Image components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { ImageBaseProps } from '../primitives/image'\n\n/**\n * Creates layout infrastructure for an Image component\n * Attaches layout props and dynamic size provider\n * @param image - Phaser Image object\n * @param props - Image props including layout\n */\nexport function createImageLayout(\n image: Phaser.GameObjects.Image & {\n __layoutProps?: ImageBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<ImageBaseProps>\n): void {\n // Attach layout props for layout calculations\n image.__layoutProps = props as ImageBaseProps\n\n // Attach dynamic size provider\n // Headless images return minimal size 0.01x0.01 (participates in alignment, not spacing)\n // Layout-aware images return actual display dimensions\n image.__getLayoutSize = () => {\n if (image.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: image.displayWidth,\n height: image.displayHeight,\n }\n }\n}\n","/**\n * Image component - Phaser Image GameObject (static texture)\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: TEXTURE RENDERING\n * Purpose: Display static textures in UI layouts (icons, avatars, illustrations)\n * Phaser Type: Phaser.GameObjects.Image (texture-based rendering)\n * Characteristics:\n * - Layout-aware by default (participates in parent layout)\n * - Auto-sizing based on texture dimensions (like HTML <img>)\n * - Supports Phaser texture system (atlases, frames)\n *\n * 2. Headless Default: FALSE ✅\n * Decision: Image participates in layout by default\n * Reasoning:\n * - Images are UI elements (icons, avatars, illustrations)\n * - Should affect parent container dimensions\n * - Similar to Text component behavior\n * Use Cases:\n * - ✅ Layout-aware (default): Icons, avatars, logos, UI illustrations\n * - ❌ Headless (optional): Decorative backgrounds, overlays, parallax layers\n * Usage:\n * <Image texture=\"icon\" /> // Layout-aware\n * <Image texture=\"bg\" headless={true} /> // Decorative (no layout impact)\n *\n * 3. Layout Size Provider: DISPLAY DIMENSIONS ✅\n * Implementation: Uses image.displayWidth and image.displayHeight\n * Behavior:\n * - Returns scaled display dimensions\n * - Rotation is IGNORED for layout-aware images (headless=false)\n * - Rotation only works with headless=true (no layout impact)\n * Reasoning:\n * - Flow layout is incompatible with rotation (causes positioning issues)\n * - Rotated images would overlap siblings in flow layout\n * - Matches Text component behavior\n * Example:\n * <Image texture=\"icon\" /> // ✅ Layout size: 64x64\n * <Image texture=\"icon\" rotation={Math.PI/4} /> // ⚠️ Rotation IGNORED, size: 64x64\n * <Image texture=\"icon\" rotation={Math.PI/4} headless={true} /> // ✅ Rotated, no layout\n * Recommendation: Use rotation only with headless=true or absolute positioning\n *\n * 4. Sizing Strategy: HYBRID APPROACH ✅\n * Auto-Size (default):\n * - No displayWidth/displayHeight → Use texture dimensions\n * - Like HTML <img> natural size\n * Explicit Size:\n * - displayWidth + displayHeight → Scale to fit\n * - fit prop controls aspect ratio handling\n * Example:\n * <Image texture=\"icon\" /> // Auto-size\n * <Image texture=\"icon\" displayWidth={64} displayHeight={64} fit=\"contain\" />\n *\n * 5. Fit Modes: CSS-LIKE BEHAVIOR ✅\n * Decision: Implement CSS object-fit equivalent\n * Modes:\n * - 'fill' (default): Stretch to fill bounds (may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio (letterbox)\n * - 'cover': Scale to cover bounds, preserve aspect ratio (crop)\n * Implementation: Calculate scale in applier based on fit mode\n *\n * 6. Origin Behavior: HEADLESS-AWARE ✅\n * Current: Like Text component\n * - Layout-aware (headless=false): Origin (0, 0) - top-left, UI-friendly\n * - Headless (headless=true): Origin (0.5, 0.5) - centered, game object semantics\n * Reasoning:\n * - UI elements align naturally with top-left origin\n * - Game objects (headless) work better centered\n * - Consistent with Text component behavior\n *\n * 7. Rotation Behavior: LIKE TEXT ✅\n * Decision: Rotation only supported with headless=true\n * Reasoning:\n * - Flow layout is incompatible with rotation\n * - Matches Text component constraints\n * - Props normalized: rotation removed if headless=false\n *\n * 8. Common Patterns:\n * Icon:\n * <View direction=\"row\" gap={10}>\n * <Image texture=\"icon-user\" />\n * <Text text=\"Username\" />\n * </View>\n * Avatar:\n * <Image texture=\"avatar\" displayWidth={64} displayHeight={64} fit=\"cover\" />\n * Background (headless):\n * <Image texture=\"bg\" headless={true} alpha={0.5} />\n *\n * 9. Performance Considerations:\n * - Texture atlases recommended (reduce texture switches)\n * - Static images are efficient (single draw call)\n * - Texture changes trigger re-render\n * - Scaling via displayWidth/displayHeight is GPU-accelerated\n *\n * 10. Known Limitations:\n * - Rotation only supported with headless=true (ignored for layout-aware)\n * - Missing textures show Phaser default (white square)\n * - No built-in loading states\n * - Texture must be preloaded before use\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Image creation with texture/frame support\n * [✅] Transform props (position, scale, alpha)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Origin handling (headless-aware: 0,0 vs 0.5,0.5)\n * [✅] Display size with fit modes (contain/cover/fill)\n * [✅] Tint support\n * [✅] Texture and frame patching\n * [⚠️] Rotation - Only with headless=true (ignored for layout-aware)\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyImageProps } from '../appliers/applyImage'\nimport { applyImageLayout } from '../appliers/applyImageLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createImageLayout } from '../creators/createImageLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Image component\n */\nexport interface ImageBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Tint color applied to image (0xRRGGBB) */\n tint?: number | undefined\n\n /** Display width (scales image to fit) */\n displayWidth?: number | undefined\n\n /** Display height (scales image to fit) */\n displayHeight?: number | undefined\n\n /**\n * How image should fit within bounds (if displayWidth/displayHeight set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Origin X (0-1, default 0.5) */\n originX?: number\n\n /** Origin Y (0-1, default 0.5) */\n originY?: number\n}\n\n/**\n * Props for primitive image component (internal use only)\n * For public API, use ImageProps from custom/Image.tsx\n */\nexport interface ImagePrimitiveProps\n extends ImageBaseProps, PropsDefaultExtension<Phaser.GameObjects.Image> {}\n\n/**\n * Image creator - creates a Phaser Image object\n */\nexport const imageCreator: HostCreator<'Image'> = (scene, props) => {\n const image = scene.add.image(props.x ?? 0, props.y ?? 0, props.texture, props.frame)\n\n // Set origin based on headless flag\n // Headless: (0.5, 0.5) - centered, works naturally with rotation/scale\n // Layout-aware: (0, 0) - top-left, aligns with layout flow\n if (props.headless) {\n image.setOrigin(0.5, 0.5)\n } else {\n image.setOrigin(0, 0)\n }\n\n // Apply custom origin if specified\n if (props.originX !== undefined || props.originY !== undefined) {\n image.setOrigin(props.originX ?? image.originX, props.originY ?? image.originY)\n }\n\n // Normalize props for headless objects\n // Headless objects are positioned as points - no spacing or rotation constraints\n const normalizedProps = { ...props } as Record<string, unknown>\n if (props.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedProps.padding\n delete normalizedProps.margin\n delete normalizedProps.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedProps.rotation !== undefined) {\n delete normalizedProps.rotation\n }\n }\n\n // Apply transform props (scale, rotation if headless)\n createTransform(image, normalizedProps)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(image, normalizedProps)\n\n // Apply image-specific props (tint, displaySize, fit)\n if (props.tint !== undefined) {\n image.setTint(props.tint)\n }\n\n // Apply displayWidth/displayHeight if specified\n if (props.displayWidth !== undefined || props.displayHeight !== undefined) {\n if (props.displayWidth !== undefined && props.displayHeight !== undefined) {\n // Both specified - use fit mode\n const fit = props.fit ?? 'fill'\n const textureWidth = image.width\n const textureHeight = image.height\n\n if (textureWidth > 0 && textureHeight > 0) {\n if (fit === 'fill') {\n image.setDisplaySize(props.displayWidth, props.displayHeight)\n } else if (fit === 'contain') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect > textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n image.setScale(scale)\n } else if (fit === 'cover') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect < textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n image.setScale(scale)\n }\n }\n } else if (props.displayWidth !== undefined) {\n // Only width - preserve aspect ratio\n const scale = props.displayWidth / image.width\n image.setScale(scale)\n } else if (props.displayHeight !== undefined) {\n // Only height - preserve aspect ratio\n const scale = props.displayHeight / image.height\n image.setScale(scale)\n }\n }\n\n // Setup layout system (props and size provider)\n createImageLayout(image, normalizedProps)\n\n // Call onReady callback if provided\n if (props.onReady) {\n props.onReady(image)\n }\n\n return image\n}\n\n/**\n * Image patcher - updates Image properties\n */\nexport const imagePatcher: HostPatcher<'Image'> = (node, prev, next) => {\n // Update origin if headless flag changed\n if (prev.headless !== next.headless) {\n if (next.headless) {\n node.setOrigin(0.5, 0.5) // Headless: centered\n } else {\n node.setOrigin(0, 0) // Layout-aware: top-left\n }\n }\n\n // Normalize props for headless objects\n const normalizedPrev = { ...prev } as Record<string, unknown>\n const normalizedNext = { ...next } as Record<string, unknown>\n\n if (next.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedNext.padding\n delete normalizedNext.margin\n delete normalizedNext.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedNext.rotation !== undefined) {\n delete normalizedNext.rotation\n }\n }\n\n if (prev.headless) {\n delete normalizedPrev.padding\n delete normalizedPrev.margin\n delete normalizedPrev.gap\n } else {\n if (normalizedPrev.rotation !== undefined) {\n delete normalizedPrev.rotation\n }\n }\n\n // Apply transform props (position, rotation only if headless, scale)\n applyTransformProps(node, normalizedPrev, normalizedNext)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, normalizedPrev, normalizedNext)\n\n // Apply image-specific props (texture, frame, tint, displaySize, fit)\n applyImageProps(node, normalizedPrev, normalizedNext)\n\n // Apply layout props and update size provider if needed\n applyImageLayout(node, normalizedPrev, normalizedNext)\n}\n","/**\n * Applier for NineSlice-specific properties\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { NineSliceSpecificProps } from '../primitives/nineslice'\n\n/**\n * Applies NineSlice-specific properties (texture, frame, slice dimensions)\n * @param nineSlice - Phaser NineSlice object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyNineSliceProps(\n nineSlice: Phaser.GameObjects.NineSlice,\n prev: Partial<NineSliceSpecificProps & LayoutProps>,\n next: Partial<NineSliceSpecificProps & LayoutProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n nineSlice.setTexture(next.texture, next.frame)\n }\n\n // Check if slice dimensions changed\n const sliceChanged =\n prev.leftWidth !== next.leftWidth ||\n prev.rightWidth !== next.rightWidth ||\n prev.topHeight !== next.topHeight ||\n prev.bottomHeight !== next.bottomHeight\n\n if (sliceChanged) {\n const width = typeof next.width === 'number' ? next.width : nineSlice.width\n const height = typeof next.height === 'number' ? next.height : nineSlice.height\n\n nineSlice.setSlices(\n width,\n height,\n next.leftWidth ?? prev.leftWidth ?? 0,\n next.rightWidth ?? prev.rightWidth ?? 0,\n next.topHeight ?? prev.topHeight,\n next.bottomHeight ?? prev.bottomHeight\n )\n }\n\n // Check if size changed (independent of slice changes)\n const prevWidth = typeof prev.width === 'number' ? prev.width : nineSlice.width\n const nextWidth = typeof next.width === 'number' ? next.width : nineSlice.width\n const prevHeight = typeof prev.height === 'number' ? prev.height : nineSlice.height\n const nextHeight = typeof next.height === 'number' ? next.height : nineSlice.height\n\n if (prevWidth !== nextWidth || prevHeight !== nextHeight) {\n nineSlice.setSize(nextWidth, nextHeight)\n }\n\n // Check if tint changed\n if (prev.tint !== next.tint) {\n if (next.tint !== undefined) {\n nineSlice.setTint(next.tint)\n } else {\n nineSlice.clearTint()\n }\n }\n}\n","/**\n * Layout applier for NineSlice components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { NineSliceBaseProps } from '../primitives/nineslice'\n\n/**\n * Applies layout properties for NineSlice components\n * Updates layout props when properties change\n * @param nineSlice - Phaser NineSlice object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyNineSliceLayout(\n nineSlice: Phaser.GameObjects.NineSlice & {\n __layoutProps?: NineSliceBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n prev: Partial<NineSliceBaseProps>,\n next: Partial<NineSliceBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation\n nineSlice.__layoutProps = next as NineSliceBaseProps\n\n // Update size provider if dimensions changed\n if (prev.width !== next.width || prev.height !== next.height) {\n nineSlice.__getLayoutSize = () => {\n return {\n width: nineSlice.width,\n height: nineSlice.height,\n }\n }\n }\n}\n","/**\n * Layout creator for NineSlice components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { NineSliceBaseProps } from '../primitives/nineslice'\n\n/**\n * Creates layout infrastructure for a NineSlice component\n * Attaches layout props and dynamic size provider\n * @param nineSlice - Phaser NineSlice object\n * @param props - NineSlice props including layout\n */\nexport function createNineSliceLayout(\n nineSlice: Phaser.GameObjects.NineSlice & {\n __layoutProps?: NineSliceBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<NineSliceBaseProps>\n): void {\n // Attach layout props for layout calculations\n nineSlice.__layoutProps = props as NineSliceBaseProps\n\n // Attach dynamic size provider using NineSlice dimensions\n nineSlice.__getLayoutSize = () => {\n return {\n width: nineSlice.width,\n height: nineSlice.height,\n }\n }\n}\n","/**\n * NineSlice component - Phaser NineSlice GameObject for scalable UI panels\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: SCALABLE UI PANELS\n * Purpose: Create resizable UI elements that preserve border/corner integrity\n * Phaser Type: Phaser.GameObjects.NineSlice (9-slice scaling)\n * Use Cases:\n * - Buttons with fixed corner radius\n * - Dialog boxes with preserved borders\n * - Progress bars with capped ends\n * - Panels that scale without distorting decorative edges\n *\n * 2. Nine-Slice Scaling Concept:\n * Texture divided into 9 regions:\n * ┌─────┬─────────┬─────┐\n * │ TL │ Top │ TR │ (corners + edges)\n * ├─────┼─────────┼─────┤\n * │Left │ Center │Right│ (center scales, edges stretch)\n * ├─────┼─────────┼─────┤\n * │ BL │ Bottom │ BR │ (corners stay fixed)\n * └─────┴─────────┴─────┘\n * Behavior:\n * - Corners: Never scale (preserve pixel-perfect)\n * - Edges: Stretch along one axis (top/bottom: horizontal, left/right: vertical)\n * - Center: Scales in both directions\n * Benefit: UI elements scale to any size without visual distortion\n *\n * 3. Three-Slice Mode (Optional):\n * Feature: Omit topHeight/bottomHeight for horizontal-only slicing\n * Use Case: Horizontal buttons, progress bars\n * Layout:\n * ┌─────┬─────────────────┬─────┐\n * │Left │ Center │Right│\n * └─────┴─────────────────┴─────┘\n * Props: Only leftWidth + rightWidth required\n *\n * 4. Headless Default: FALSE ✅\n * Decision: NineSlice participates in layout by default\n * Reasoning:\n * - NineSlice is a UI element (buttons, panels, containers)\n * - Should affect parent container dimensions\n * - Similar to View component (container semantics)\n * Use Cases:\n * - ✅ Layout-aware (default): Buttons, panels, dialogs, cards\n * - ❌ Headless (optional): Background overlays, decorative frames\n * Usage:\n * <NineSlice texture=\"panel\" leftWidth={16} rightWidth={16} width={200} height={100} />\n * <NineSlice texture=\"frame\" headless={true} /> // Decorative\n *\n * 5. Layout Size Provider:\n * Implementation: Uses explicit width/height (required props)\n * Reasoning:\n * - NineSlice requires explicit dimensions (Phaser constructor param)\n * - No auto-sizing (unlike Text)\n * - Dimensions always known and stable\n * __getLayoutSize:\n * return { width: nineSlice.width, height: nineSlice.height }\n * Note: getBounds() not needed (no rotation typically applied)\n *\n * 6. Slice Configuration:\n * Required Props:\n * - texture: string (texture key)\n * - leftWidth: number (pixels)\n * - rightWidth: number (pixels)\n * - width: number (total width)\n * - height: number (total height)\n * Optional Props:\n * - topHeight: number (9-slice mode, default: 0 for 3-slice)\n * - bottomHeight: number (9-slice mode, default: 0 for 3-slice)\n * - frame: string | number (texture atlas frame)\n * Validation:\n * - Width must be >= leftWidth + rightWidth\n * - Height must be >= topHeight + bottomHeight\n * - Slice widths/heights define source texture regions\n *\n * 7. Inner Bounds Feature:\n * Purpose: Calculate content area excluding slices\n * Use Case: Position children inside panel borders\n * Calculation:\n * innerBounds = {\n * x: leftWidth,\n * y: topHeight,\n * width: totalWidth - leftWidth - rightWidth,\n * height: totalHeight - topHeight - bottomHeight\n * }\n * Access:\n * const ref = useRef<NineSliceRef>(null)\n * <NineSlice ref={ref} ... />\n * console.log(ref.current?.innerBounds) // { x, y, width, height }\n * Pattern: Useful for padding-aware content positioning\n *\n * 8. Ref Extension:\n * Feature: NineSliceRef provides slice metadata\n * Properties:\n * - node: Phaser.GameObjects.NineSlice (the GameObject)\n * - leftWidth, rightWidth, topHeight, bottomHeight: Slice dimensions\n * - innerBounds: Content area calculation\n * Usage:\n * const panelRef = useRef<NineSliceRef>(null)\n * // Access slice info for child positioning\n * const { innerBounds } = panelRef.current\n *\n * 9. Common Patterns:\n * Button:\n * <NineSlice\n * texture=\"button\"\n * leftWidth={16} rightWidth={16}\n * topHeight={16} bottomHeight={16}\n * width={200} height={60}\n * >\n * <Text text=\"Click Me\" />\n * </NineSlice>\n * Dialog Box:\n * <NineSlice\n * texture=\"panel\"\n * leftWidth={32} rightWidth={32}\n * topHeight={32} bottomHeight={32}\n * width={400} height={300}\n * >\n * <View padding={32}> {/* Padding matches slice sizes * }\n * <Text text=\"Dialog Content\" />\n * </View>\n * </NineSlice>\n * Progress Bar (3-slice):\n * <NineSlice\n * texture=\"progressbar\"\n * leftWidth={8} rightWidth={8}\n * width={progress * 200} height={20}\n * />\n *\n * 10. Performance Considerations:\n * - Efficient rendering (single draw call per NineSlice)\n * - Texture atlases recommended (reduce texture switches)\n * - Scaling performance: No geometry regeneration needed\n * - Slice configuration: Calculated once on creation\n * - Dynamic resizing: Efficiently handled by Phaser\n *\n * 11. Known Limitations:\n * - Requires pre-designed 9-slice texture\n * - Slice dimensions must match source texture layout exactly\n * - Rotation not recommended (distorts slice alignment)\n * - Can't animate slice dimensions (only width/height)\n * - No rounded corner support (must be in texture)\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser NineSlice creation with slice configuration\n * [✅] Transform props (position, scale, alpha, depth)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Width/height as layout props (explicit sizing)\n * [✅] Three-slice mode support (optional topHeight/bottomHeight)\n * [✅] NineSliceRef with innerBounds calculation\n * [✅] Slice dimension validation\n * [✅] Theme system integration\n * [✅] Dynamic resizing support (width/height patching)\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyNineSliceProps } from '../appliers/applyNineSlice'\nimport { applyNineSliceLayout } from '../appliers/applyNineSliceLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createNineSliceLayout } from '../creators/createNineSliceLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Inner bounds of a NineSlice - the content area excluding slices\n */\nexport interface NineSliceInnerBounds {\n /**\n * X offset from left edge (equals leftWidth)\n */\n x: number\n /**\n * Y offset from top edge (equals topHeight)\n */\n y: number\n /**\n * Width of inner content area (totalWidth - leftWidth - rightWidth)\n */\n width: number\n /**\n * Height of inner content area (totalHeight - topHeight - bottomHeight)\n */\n height: number\n}\n\n/**\n * Extended NineSlice reference with slice information and inner bounds\n */\nexport interface NineSliceRef {\n /**\n * The underlying Phaser NineSlice GameObject\n */\n node: Phaser.GameObjects.NineSlice | null\n /**\n * Width of the left slice in pixels\n */\n leftWidth: number\n /**\n * Width of the right slice in pixels\n */\n rightWidth: number\n /**\n * Height of the top slice in pixels (0 for 3-slice mode)\n */\n topHeight: number\n /**\n * Height of the bottom slice in pixels (0 for 3-slice mode)\n */\n bottomHeight: number\n /**\n * Inner content bounds excluding slices\n * Useful for positioning content within the NineSlice\n */\n innerBounds: NineSliceInnerBounds\n}\n\n/**\n * NineSlice-specific properties for texture and slice configuration\n */\nexport interface NineSliceSpecificProps {\n /**\n * Texture key to use for the NineSlice\n */\n texture: string\n\n /**\n * Optional tint to apply to the NineSlice\n */\n tint?: number | undefined\n\n /**\n * Optional frame within the texture atlas\n */\n frame?: string | number\n\n /**\n * Width of the left slice (in pixels of source texture)\n */\n leftWidth: number\n\n /**\n * Width of the right slice (in pixels of source texture)\n */\n rightWidth: number\n\n /**\n * Height of the top slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n topHeight?: number\n\n /**\n * Height of the bottom slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n bottomHeight?: number\n}\n\n/**\n * Base props for NineSlice - composing shared prop groups\n * Note: No InteractionProps - interaction should be handled by parent View container\n */\nexport interface NineSliceBaseProps\n extends TransformProps, PhaserProps, LayoutProps, NineSliceSpecificProps {}\n\n/**\n * Props for NineSlice primitive - extends base props with JSX-specific props\n * Renamed to avoid conflict with custom NineSlice wrapper\n */\nexport interface NineSlicePrimitiveProps\n extends NineSliceBaseProps, PropsDefaultExtension<Phaser.GameObjects.NineSlice> {}\n\n/**\n * NineSlice creator - creates a Phaser NineSlice object\n */\nexport const nineSliceCreator: HostCreator<'NineSlice'> = (scene, props) => {\n // For width/height, use a small default that will be overridden by layout system\n // This prevents the NineSlice from being created with huge dimensions\n const initialWidth = typeof props.width === 'number' ? props.width : 64\n const initialHeight = typeof props.height === 'number' ? props.height : 64\n\n const nineSlice = scene.add.nineslice(\n props.x ?? 0,\n props.y ?? 0,\n props.texture,\n props.frame,\n initialWidth,\n initialHeight,\n props.leftWidth,\n props.rightWidth,\n props.topHeight,\n props.bottomHeight\n )\n nineSlice.setOrigin(0, 0) // Top-left origin for easier layout handling as it is in UI\n\n // Apply tint if provided\n if (props.tint !== undefined) {\n nineSlice.setTint(props.tint)\n }\n\n // Apply transform props (scale, rotation)\n createTransform(nineSlice, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(nineSlice, props)\n\n // Setup layout system (props and size provider)\n createNineSliceLayout(nineSlice, props)\n\n return nineSlice\n}\n\n/**\n * NineSlice patcher - updates NineSlice properties\n */\nexport const nineSlicePatcher: HostPatcher<'NineSlice'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply NineSlice-specific props (texture, frame, slice dimensions)\n applyNineSliceProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applyNineSliceLayout(node, prev, next)\n}\n","/**\n * Emit zone helpers for particle emitters\n */\nimport type { SizeValue } from '../core-props'\n\n/**\n * Supported zone shapes\n */\nexport type ParticleZoneShape = 'rect' | 'circle' | 'ellipse' | 'line'\n\n/**\n * Supported death zone modes\n */\nexport type ParticleDeathZoneMode = 'onEnter' | 'onLeave'\n\ntype ZoneConfigBase = {\n shape: ParticleZoneShape\n width?: number\n height?: number\n radius?: number\n x?: number\n y?: number\n endX?: number\n endY?: number\n}\n\n/**\n * Emit zone config\n */\nexport interface ParticleZoneConfig extends ZoneConfigBase {\n type?: 'random' | 'edge'\n}\n\n/**\n * Death zone config\n * Death zones use particle world positions for evaluation,\n * but coordinates should be specified relative to the emitter position\n */\nexport interface ParticleDeathZoneConfig extends ZoneConfigBase {\n /**\n * Death zone mode - evaluated using particle world positions.\n * - onEnter: remove particles when they enter the zone.\n * - onLeave: remove particles when they leave the zone.\n */\n mode?: ParticleDeathZoneMode\n}\n\n/**\n * @deprecated Use ParticleDeathZoneConfig.\n */\nexport type ParticleExclusionZoneConfig = ParticleDeathZoneConfig\n\ntype PointLike = { x: number; y: number }\ntype TransformMatrixLike = {\n applyInverse: (x: number, y: number) => PointLike\n}\nexport type ParticleZoneTransformOwner = {\n getWorldTransformMatrix?: () => TransformMatrixLike\n}\n\nexport type ParticleZoneSource = {\n x?: number\n y?: number\n width?: number\n height?: number\n radius?: number\n contains: (x: number, y: number) => boolean\n getRandomPoint: (point?: PointLike) => PointLike\n getPoints: (quantity?: number, stepRate?: number) => PointLike[]\n}\n\nexport type EmitZoneConfig = {\n type: 'random' | 'edge'\n source: ParticleZoneSource\n}\n\nexport type DeathZoneConfig = {\n type: ParticleDeathZoneMode\n source: ParticleZoneSource\n}\n\ntype ZoneSize = { width?: number; height?: number }\n\nfunction resolveNumericSize(value?: SizeValue): number | undefined {\n return typeof value === 'number' ? value : undefined\n}\n\nfunction resolveZoneSize(zone: ZoneConfigBase, fallback: ZoneSize): ZoneSize {\n const size: ZoneSize = {}\n const width = zone.width ?? fallback.width\n const height = zone.height ?? fallback.height\n if (width !== undefined) size.width = width\n if (height !== undefined) size.height = height\n return size\n}\n\nfunction withPoint(point: PointLike | undefined, x: number, y: number): PointLike {\n if (point) {\n point.x = x\n point.y = y\n return point\n }\n\n return { x, y }\n}\n\nfunction createRectSource(x: number, y: number, width: number, height: number): ParticleZoneSource {\n return {\n x,\n y,\n width,\n height,\n contains: (px, py) => px >= x && px <= x + width && py >= y && py <= y + height,\n getRandomPoint: (point) =>\n withPoint(point, x + Math.random() * width, y + Math.random() * height),\n getPoints: (quantity = 1) => {\n const count = Math.max(1, quantity)\n return Array.from({ length: count }, (_, index) => {\n const progress = count === 1 ? 0 : index / (count - 1)\n const perimeter = 2 * (width + height)\n const distance = progress * perimeter\n\n if (distance <= width) return { x: x + distance, y }\n if (distance <= width + height) return { x: x + width, y: y + distance - width }\n if (distance <= width * 2 + height) {\n return { x: x + width - (distance - width - height), y: y + height }\n }\n return { x, y: y + height - (distance - width * 2 - height) }\n })\n },\n }\n}\n\nfunction createCircleSource(x: number, y: number, radius: number): ParticleZoneSource {\n return {\n x,\n y,\n radius,\n contains: (px, py) => {\n const dx = px - x\n const dy = py - y\n return dx * dx + dy * dy <= radius * radius\n },\n getRandomPoint: (point) => {\n const angle = Math.random() * Math.PI * 2\n const distance = Math.sqrt(Math.random()) * radius\n return withPoint(point, x + Math.cos(angle) * distance, y + Math.sin(angle) * distance)\n },\n getPoints: (quantity = 1) => {\n const count = Math.max(1, quantity)\n return Array.from({ length: count }, (_, index) => {\n const angle = (index / count) * Math.PI * 2\n return { x: x + Math.cos(angle) * radius, y: y + Math.sin(angle) * radius }\n })\n },\n }\n}\n\nfunction createEllipseSource(\n x: number,\n y: number,\n width: number,\n height: number\n): ParticleZoneSource {\n const radiusX = width / 2\n const radiusY = height / 2\n\n return {\n x,\n y,\n width,\n height,\n contains: (px, py) => {\n const dx = (px - x) / radiusX\n const dy = (py - y) / radiusY\n return dx * dx + dy * dy <= 1\n },\n getRandomPoint: (point) => {\n const angle = Math.random() * Math.PI * 2\n const distance = Math.sqrt(Math.random())\n return withPoint(\n point,\n x + Math.cos(angle) * radiusX * distance,\n y + Math.sin(angle) * radiusY * distance\n )\n },\n getPoints: (quantity = 1) => {\n const count = Math.max(1, quantity)\n return Array.from({ length: count }, (_, index) => {\n const angle = (index / count) * Math.PI * 2\n return { x: x + Math.cos(angle) * radiusX, y: y + Math.sin(angle) * radiusY }\n })\n },\n }\n}\n\nfunction createLineSource(x: number, y: number, endX: number, endY: number): ParticleZoneSource {\n return {\n x,\n y,\n contains: (px, py) => {\n const lengthSquared = (endX - x) ** 2 + (endY - y) ** 2\n if (lengthSquared === 0) return px === x && py === y\n\n const progress = Math.max(\n 0,\n Math.min(1, ((px - x) * (endX - x) + (py - y) * (endY - y)) / lengthSquared)\n )\n const closestX = x + progress * (endX - x)\n const closestY = y + progress * (endY - y)\n return Math.hypot(px - closestX, py - closestY) <= 0.5\n },\n getRandomPoint: (point) => {\n const progress = Math.random()\n return withPoint(point, x + (endX - x) * progress, y + (endY - y) * progress)\n },\n getPoints: (quantity = 1) => {\n const count = Math.max(1, quantity)\n return Array.from({ length: count }, (_, index) => {\n const progress = count === 1 ? 0 : index / (count - 1)\n return { x: x + (endX - x) * progress, y: y + (endY - y) * progress }\n })\n },\n }\n}\n\nfunction buildZoneSource(\n zone: ZoneConfigBase,\n fallbackSize: ZoneSize\n): ParticleZoneSource | undefined {\n const baseX = zone.x ?? 0\n const baseY = zone.y ?? 0\n const { width, height } = resolveZoneSize(zone, fallbackSize)\n\n switch (zone.shape) {\n case 'rect':\n return createRectSource(baseX, baseY, width ?? 1, height ?? 1)\n case 'circle':\n return createCircleSource(baseX, baseY, zone.radius ?? 1)\n case 'ellipse':\n return createEllipseSource(baseX, baseY, width ?? 1, height ?? 1)\n case 'line':\n return createLineSource(\n baseX,\n baseY,\n zone.endX ?? baseX + (width ?? 1),\n zone.endY ?? baseY + (height ?? 1)\n )\n default:\n return undefined\n }\n}\n\nfunction getTransformOwner(value: unknown): ParticleZoneTransformOwner | undefined {\n if (!value || typeof value !== 'object') return undefined\n if (typeof (value as ParticleZoneTransformOwner).getWorldTransformMatrix !== 'function') {\n return undefined\n }\n return value as ParticleZoneTransformOwner\n}\n\nfunction createLocalDeathZoneSource(\n source: ParticleZoneSource,\n owner?: unknown\n): ParticleZoneSource {\n const transformOwner = getTransformOwner(owner)\n if (!transformOwner) return source\n\n return {\n ...source,\n contains: (worldX, worldY) => {\n const matrix = transformOwner.getWorldTransformMatrix?.()\n if (!matrix) return source.contains(worldX, worldY)\n\n const localPoint = matrix.applyInverse(worldX, worldY)\n return source.contains(localPoint.x, localPoint.y)\n },\n }\n}\n\n/**\n * Build a Phaser emitZone config from a lightweight zone definition\n */\nexport function buildEmitZone(\n zone: ParticleZoneConfig,\n fallbackSize: ZoneSize = {}\n): EmitZoneConfig | undefined {\n const type = zone.type ?? 'random'\n const source = buildZoneSource(zone, fallbackSize)\n\n if (!source) return undefined\n\n return { type, source }\n}\n\n/**\n * Create an emit zone using layout size as a fallback\n */\nexport function buildEmitZoneFromLayout(\n zone: ParticleZoneConfig,\n width?: SizeValue,\n height?: SizeValue\n): EmitZoneConfig | undefined {\n const fallback: ZoneSize = {}\n const resolvedWidth = resolveNumericSize(width)\n const resolvedHeight = resolveNumericSize(height)\n if (resolvedWidth !== undefined) fallback.width = resolvedWidth\n if (resolvedHeight !== undefined) fallback.height = resolvedHeight\n return buildEmitZone(zone, fallback)\n}\n\n/**\n * Build a Phaser deathZone config from a lightweight death zone definition\n */\nexport function buildDeathZone(\n zone: ParticleDeathZoneConfig,\n fallbackSize: ZoneSize = {},\n owner?: unknown\n): DeathZoneConfig | undefined {\n const type = zone.mode ?? 'onEnter'\n const source = buildZoneSource(zone, fallbackSize)\n\n if (!source) return undefined\n\n return { type, source: createLocalDeathZoneSource(source, owner) }\n}\n\n/**\n * Create death zones using layout size as a fallback\n */\nexport function buildDeathZonesFromLayout(\n zones: ParticleDeathZoneConfig | ParticleDeathZoneConfig[] | undefined,\n width?: SizeValue,\n height?: SizeValue,\n owner?: unknown\n): DeathZoneConfig[] | undefined {\n if (!zones) return undefined\n const list = Array.isArray(zones) ? zones : [zones]\n const fallback: ZoneSize = {}\n const resolvedWidth = resolveNumericSize(width)\n const resolvedHeight = resolveNumericSize(height)\n if (resolvedWidth !== undefined) fallback.width = resolvedWidth\n if (resolvedHeight !== undefined) fallback.height = resolvedHeight\n\n const deathZones = list\n .map((zone) => buildDeathZone(zone, fallback, owner))\n .filter((zone): zone is DeathZoneConfig => Boolean(zone))\n\n return deathZones.length > 0 ? deathZones : undefined\n}\n","/**\n * Particle preset registry - typed presets with extension support\n */\nimport type * as Phaser from 'phaser'\n\n/**\n * Built-in particle preset names\n */\nexport type BuiltInParticlePresetName = 'explosion' | 'trail' | 'rain' | 'snow' | 'sparkle'\n\n/**\n * Extension point for custom particle preset names\n * Use declaration merging to add custom presets:\n * @example\n * ```typescript\n * declare module '@number10/phaserjsx' {\n * interface ParticlePresetExtensions {\n * myPreset: 'myPreset'\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface ParticlePresetExtensions {}\n\n/**\n * Available particle preset names (built-in + extensions)\n */\nexport type ParticlePresetName =\n | BuiltInParticlePresetName\n | (keyof ParticlePresetExtensions extends never ? never : keyof ParticlePresetExtensions)\n\n/**\n * Phaser emitter config alias\n */\nexport type ParticleEmitterConfig = Phaser.Types.GameObjects.Particles.ParticleEmitterConfig\n\n/**\n * Preset definition for component/theme props\n */\nexport interface ParticlePresetDefinition {\n preset?: ParticlePresetName\n config?: ParticleEmitterConfig\n}\n\n/**\n * Map of built-in particle presets to emitter configs\n */\nexport const PARTICLE_PRESET_REGISTRY: Record<BuiltInParticlePresetName, ParticleEmitterConfig> = {\n explosion: {\n speed: { min: 120, max: 320 },\n scale: { start: 1, end: 0 },\n alpha: { start: 1, end: 0 },\n lifespan: 600,\n quantity: 24,\n blendMode: 'ADD',\n },\n trail: {\n speed: { min: 30, max: 80 },\n scale: { start: 0.6, end: 0 },\n alpha: { start: 0.8, end: 0 },\n lifespan: 700,\n frequency: 40,\n },\n rain: {\n speed: { min: 320, max: 520 },\n angle: { min: 80, max: 100 },\n scale: { start: 0.5, end: 0.2 },\n alpha: { start: 0.6, end: 0.1 },\n lifespan: 1000,\n frequency: 20,\n },\n snow: {\n speed: { min: 40, max: 120 },\n angle: { min: 80, max: 100 },\n gravityY: 8,\n scale: { start: 0.6, end: 0.6 },\n alpha: { start: 0.8, end: 0.3 },\n lifespan: 2600,\n frequency: 80,\n },\n sparkle: {\n speed: { min: 20, max: 60 },\n scale: { start: 0.4, end: 0 },\n alpha: { start: 1, end: 0 },\n lifespan: 500,\n frequency: 60,\n blendMode: 'ADD',\n },\n}\n\n/**\n * Resolve a preset name with optional overrides\n * @param preset - Preset name (built-in or extension)\n * @param config - Optional overrides applied last\n * @returns Resolved emitter config\n */\nexport function resolveParticlePreset(\n preset?: ParticlePresetName,\n config: ParticleEmitterConfig = {}\n): ParticleEmitterConfig {\n const base = preset ? PARTICLE_PRESET_REGISTRY[preset as BuiltInParticlePresetName] : undefined\n\n if (preset && !base) {\n console.warn(`[Particles] Preset \"${String(preset)}\" not found in registry`)\n }\n\n return {\n ...(base ?? {}),\n ...config,\n }\n}\n","/**\n * Particle utilities shared across hooks/components\n */\nimport type * as Phaser from 'phaser'\nimport type { DeathZoneConfig, EmitZoneConfig } from './emit-zone'\nimport type { ParticleEmitter, ParticleEmitterManagerLike, ParticlesHandle } from './particle-types'\nimport type { ParticleEmitterConfig } from './preset-registry'\n\nexport function isParticleEmitter(target: ParticlesHandle | null): target is ParticleEmitter {\n return !!target && typeof (target as ParticleEmitter).explode === 'function'\n}\n\nexport function getFirstEmitter(\n manager: ParticleEmitterManagerLike | null\n): ParticleEmitter | null {\n if (!manager) return null\n if (manager.__emitter) return manager.__emitter\n const emitters = (manager as unknown as { emitters?: { list?: unknown[] } | unknown[] }).emitters\n if (Array.isArray(emitters)) {\n return (emitters[0] as ParticleEmitter) ?? null\n }\n if (emitters && 'list' in emitters && Array.isArray(emitters.list)) {\n return (emitters.list[0] as ParticleEmitter) ?? null\n }\n return null\n}\n\nexport function applyEmitterConfig(\n emitter: ParticleEmitter | null,\n config: ParticleEmitterConfig\n): void {\n if (!emitter) return\n const withConfig = emitter as Phaser.GameObjects.Particles.ParticleEmitter & {\n setConfig?: (config: ParticleEmitterConfig) => void\n fromJSON?: (config: ParticleEmitterConfig) => void\n }\n\n if (withConfig.setConfig) {\n withConfig.setConfig(config)\n return\n }\n\n if (withConfig.fromJSON) {\n withConfig.fromJSON(config)\n return\n }\n\n Object.assign(emitter, config)\n}\n\nexport function applyEmitZone(\n emitter: ParticleEmitter | null,\n emitZone: EmitZoneConfig | undefined\n): void {\n if (!emitter || !emitZone) return\n const withZone = emitter as Phaser.GameObjects.Particles.ParticleEmitter & {\n setEmitZone?: (config: EmitZoneConfig) => void\n }\n\n if (withZone.setEmitZone) {\n withZone.setEmitZone(emitZone)\n return\n }\n}\n\nexport function applyDeathZone(\n emitter: ParticleEmitter | null,\n deathZone: DeathZoneConfig | DeathZoneConfig[] | undefined\n): void {\n if (!emitter) return\n const withZone = emitter as Phaser.GameObjects.Particles.ParticleEmitter & {\n setDeathZone?: (config: DeathZoneConfig | DeathZoneConfig[]) => void\n addDeathZone?: (config: DeathZoneConfig | DeathZoneConfig[]) => void\n clearDeathZones?: () => void\n deathZones?: unknown[]\n }\n\n const isDefined = <T>(value: T | null | undefined): value is T =>\n value !== null && value !== undefined\n const normalized = Array.isArray(deathZone)\n ? deathZone.filter(isDefined)\n : deathZone\n ? [deathZone]\n : []\n const hasZone = normalized.length > 0\n\n if (hasZone && withZone.setDeathZone) {\n withZone.setDeathZone(normalized)\n return\n }\n\n if (!hasZone) {\n if (withZone.clearDeathZones) {\n withZone.clearDeathZones()\n return\n }\n if (withZone.deathZones) {\n withZone.deathZones = []\n }\n return\n }\n\n if (withZone.clearDeathZones) {\n withZone.clearDeathZones()\n }\n if (withZone.addDeathZone) {\n withZone.addDeathZone(normalized)\n return\n }\n if (withZone.deathZones) {\n ;(withZone as unknown as { deathZones?: unknown[] }).deathZones = normalized\n }\n}\n\nexport function mergeDeathZones(\n base: unknown | unknown[] | undefined,\n extra: unknown[] | undefined\n): unknown[] | undefined {\n const baseList = Array.isArray(base) ? base : base ? [base] : []\n const extraList = extra ?? []\n const merged = [...baseList, ...extraList]\n return merged.length > 0 ? merged : undefined\n}\n","/**\n * Applier for Particles-specific properties\n */\nimport { buildDeathZonesFromLayout, buildEmitZoneFromLayout } from '../../particles/emit-zone'\nimport type {\n ParticleEmitter,\n ParticleEmitterManagerLike,\n ParticlesHandle,\n} from '../../particles/particle-types'\nimport { resolveParticlePreset } from '../../particles/preset-registry'\nimport {\n applyDeathZone,\n applyEmitZone,\n applyEmitterConfig,\n getFirstEmitter,\n isParticleEmitter,\n mergeDeathZones,\n} from '../../particles/utils'\nimport type { ParticlesBaseProps } from '../primitives/particles'\n\n/**\n * Applies particle props updates (texture, emitter config, emit zone)\n */\nexport function applyParticlesProps(\n manager: ParticlesHandle,\n prev: Partial<ParticlesBaseProps>,\n next: Partial<ParticlesBaseProps>\n): void {\n if (!manager) return\n\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture && 'setTexture' in manager && manager.setTexture) {\n manager.setTexture(next.texture, next.frame)\n }\n\n const configChanged =\n prev.preset !== next.preset ||\n prev.config !== next.config ||\n prev.emitZone !== next.emitZone ||\n prev.zone !== next.zone ||\n prev.deathZones !== next.deathZones ||\n prev.excludeZones !== next.excludeZones ||\n prev.width !== next.width ||\n prev.height !== next.height\n\n if (configChanged) {\n const resolvedConfig = resolveParticlePreset(next.preset, next.config)\n let emitter: ParticleEmitter | null\n\n if (isParticleEmitter(manager)) {\n emitter = manager\n } else {\n const managerLike = manager as ParticleEmitterManagerLike\n emitter = managerLike.__emitter ?? getFirstEmitter(managerLike) ?? null\n if (!emitter && managerLike.createEmitter) {\n const created = managerLike.createEmitter(resolvedConfig)\n emitter = (created as ParticleEmitter | void) ?? null\n }\n managerLike.__emitter = emitter\n }\n\n if (!emitter) return\n\n applyEmitterConfig(emitter, resolvedConfig)\n\n const emitZoneProps = next.emitZone ?? next.zone\n const deathZoneProps = next.deathZones ?? next.excludeZones\n\n if (emitZoneProps) {\n const emitZone = buildEmitZoneFromLayout(emitZoneProps, next.width, next.height)\n if (emitZone) {\n applyEmitZone(emitter, emitZone)\n }\n }\n\n const deathZones = buildDeathZonesFromLayout(deathZoneProps, next.width, next.height, manager)\n const combined = mergeDeathZones(\n (resolvedConfig as unknown as { deathZone?: unknown }).deathZone,\n deathZones\n ) as Parameters<typeof applyDeathZone>[1]\n applyDeathZone(emitter, combined)\n }\n}\n","/**\n * Layout applier for Particles components\n */\nimport type { LayoutProps } from '../../core-props'\nimport type { ParticlesHandle } from '../../particles/particle-types'\nimport type { ParticlesBaseProps } from '../primitives/particles'\n\n/**\n * Applies layout props for Particles\n * Particles are always headless (minimal size)\n */\nexport function applyParticlesLayout(\n particles: ParticlesHandle & {\n __layoutProps?: ParticlesBaseProps\n },\n _prev: Partial<ParticlesBaseProps & LayoutProps>,\n next: Partial<ParticlesBaseProps & LayoutProps>\n): void {\n particles.__layoutProps = next as ParticlesBaseProps\n}\n","/**\n * Layout creator for Particles components\n */\nimport type { LayoutSize } from '../../layout/index'\nimport type { ParticlesHandle } from '../../particles/particle-types'\nimport type { ParticlesBaseProps } from '../primitives/particles'\n\n/**\n * Creates layout infrastructure for a Particles component\n * Particles are always headless (minimal size)\n * @param particles - Phaser ParticleEmitterManager\n * @param props - Particle props\n */\nexport function createParticlesLayout(\n particles: ParticlesHandle & {\n __layoutProps?: ParticlesBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<ParticlesBaseProps>\n): void {\n particles.__layoutProps = props as ParticlesBaseProps\n particles.__getLayoutSize = () => ({ width: 0.01, height: 0.01 })\n}\n","/**\n * Particles component - Phaser ParticleEmitterManager wrapper\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n * - Always headless (does not affect layout)\n * - Emits particles via a single emitter (configurable)\n * - Optional emit zone support (rect, circle, ellipse, line)\n */\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { ParticleDeathZoneConfig, ParticleZoneConfig } from '../../particles/emit-zone'\nimport { buildDeathZonesFromLayout, buildEmitZoneFromLayout } from '../../particles/emit-zone'\nimport type { ParticleEmitterManagerLike, ParticlesHandle } from '../../particles/particle-types'\nimport type { ParticleEmitterConfig, ParticlePresetName } from '../../particles/preset-registry'\nimport { resolveParticlePreset } from '../../particles/preset-registry'\nimport {\n applyDeathZone,\n getFirstEmitter,\n isParticleEmitter,\n mergeDeathZones,\n} from '../../particles/utils'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyParticlesProps } from '../appliers/applyParticles'\nimport { applyParticlesLayout } from '../appliers/applyParticlesLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createParticlesLayout } from '../creators/createParticlesLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Particles component\n */\nexport interface ParticlesBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas or spritesheet */\n frame?: string | number\n\n /** Built-in preset name */\n preset?: ParticlePresetName\n\n /** Optional emitter config overrides */\n config?: ParticleEmitterConfig\n\n /** Optional emit zone: where particles are born */\n emitZone?: ParticleZoneConfig\n\n /**\n * Optional emit zone: where particles are born.\n * @deprecated Use emitZone.\n */\n zone?: ParticleZoneConfig\n\n /** Optional death zones: where particles are removed */\n deathZones?: ParticleDeathZoneConfig | ParticleDeathZoneConfig[] | undefined\n\n /**\n * Optional death zones: where particles are removed.\n * @deprecated Use deathZones.\n */\n excludeZones?: ParticleDeathZoneConfig | ParticleDeathZoneConfig[] | undefined\n}\n\n/**\n * Props for primitive Particles component (internal use only)\n */\nexport interface ParticlesPrimitiveProps\n extends ParticlesBaseProps, PropsDefaultExtension<ParticlesHandle> {}\n\n/**\n * Particles creator - creates a Phaser ParticleEmitterManager with a single emitter\n */\nexport const particlesCreator: HostCreator<'Particles'> = (scene, props) => {\n const resolvedConfig = {\n ...resolveParticlePreset(props.preset, props.config),\n } as ParticleEmitterConfig\n\n const emitZoneProps = props.emitZone ?? props.zone\n const deathZoneProps = props.deathZones ?? props.excludeZones\n\n if (emitZoneProps) {\n const emitZone = buildEmitZoneFromLayout(emitZoneProps, props.width, props.height)\n if (emitZone) {\n const configWithZone = resolvedConfig as unknown as { emitZone?: unknown }\n configWithZone.emitZone = emitZone\n }\n }\n\n // Don't set death zones yet - will be applied after transform\n\n const particles = scene.add.particles(\n props.x ?? 0,\n props.y ?? 0,\n props.texture,\n resolvedConfig\n ) as unknown as ParticlesHandle\n if (props.frame !== undefined) {\n const configWithFrame = resolvedConfig as unknown as { frame?: string | number }\n configWithFrame.frame = props.frame\n if ('setTexture' in particles && particles.setTexture) {\n particles.setTexture(props.texture, props.frame)\n }\n }\n\n const emitter = isParticleEmitter(particles)\n ? particles\n : getFirstEmitter(particles as ParticleEmitterManagerLike)\n\n if (!isParticleEmitter(particles)) {\n ;(particles as ParticleEmitterManagerLike).__emitter = emitter\n }\n\n // Set origin to (0, 0) for consistent coordinate system (top-left)\n if ('setOrigin' in particles && typeof particles.setOrigin === 'function') {\n particles.setOrigin(0, 0)\n }\n\n // Apply transform props\n createTransform(particles, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(particles, props)\n\n // Setup layout system (headless)\n createParticlesLayout(particles, props)\n\n // Now apply death zones with container-relative coordinates\n if (deathZoneProps && emitter) {\n const deathZones = buildDeathZonesFromLayout(\n deathZoneProps,\n props.width,\n props.height,\n particles\n )\n const combinedDeathZones = mergeDeathZones(\n (resolvedConfig as unknown as { deathZone?: unknown }).deathZone,\n deathZones\n )\n if (combinedDeathZones) {\n applyDeathZone(emitter, combinedDeathZones as Parameters<typeof applyDeathZone>[1])\n }\n }\n\n // Call onReady callback if provided\n if (props.onReady) {\n props.onReady(particles)\n }\n\n return particles\n}\n\n/**\n * Particles patcher - updates ParticleEmitterManager properties\n */\nexport const particlesPatcher: HostPatcher<'Particles'> = (node, prev, next) => {\n // Apply transform props\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props\n applyPhaserProps(node, prev, next)\n\n // Apply particle-specific props\n applyParticlesProps(node, prev, next)\n\n // Apply layout props\n applyParticlesLayout(node, prev, next)\n}\n","/**\n * Applier for Sprite-specific properties\n */\nimport type * as Phaser from 'phaser'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Gets original texture dimensions (unscaled)\n * @param sprite - Phaser Sprite object\n * @returns Original width and height\n */\nfunction getOriginalTextureDimensions(sprite: Phaser.GameObjects.Sprite): {\n width: number\n height: number\n} {\n const frame = sprite.frame\n return {\n width: frame.width,\n height: frame.height,\n }\n}\n\n/**\n * Calculates scale factors for fit modes\n * @param sprite - Phaser Sprite object\n * @param targetWidth - Desired width\n * @param targetHeight - Desired height\n * @param fit - Fit mode\n * @returns Scale factors for x and y\n */\nfunction calculateFitScale(\n sprite: Phaser.GameObjects.Sprite,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill'\n): { scaleX: number; scaleY: number } {\n const { width: textureWidth, height: textureHeight } = getOriginalTextureDimensions(sprite)\n\n if (textureWidth === 0 || textureHeight === 0) {\n return { scaleX: 1, scaleY: 1 }\n }\n\n if (fit === 'fill') {\n return {\n scaleX: targetWidth / textureWidth,\n scaleY: targetHeight / textureHeight,\n }\n }\n\n const targetAspect = targetWidth / targetHeight\n const textureAspect = textureWidth / textureHeight\n\n if (fit === 'contain') {\n const scale =\n targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n if (fit === 'cover') {\n const scale =\n targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n return { scaleX: 1, scaleY: 1 }\n}\n\n/**\n * Applies Sprite-specific properties (texture, frame, tint, displaySize, fit, animations)\n * @param sprite - Phaser Sprite object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applySpriteProps(\n sprite: Phaser.GameObjects.Sprite,\n prev: Partial<SpriteBaseProps>,\n next: Partial<SpriteBaseProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n sprite.setTexture(next.texture, next.frame)\n }\n\n // Apply tint\n if (prev.tint !== next.tint) {\n if (typeof next.tint === 'number') {\n sprite.setTint(next.tint)\n } else {\n sprite.clearTint()\n }\n }\n\n // Apply origin if specified\n if (prev.originX !== next.originX || prev.originY !== next.originY) {\n const originX = next.originX ?? sprite.originX\n const originY = next.originY ?? sprite.originY\n sprite.setOrigin(originX, originY)\n }\n\n // Apply displayWidth/displayHeight with fit mode\n const displayWidthChanged = prev.displayWidth !== next.displayWidth\n const displayHeightChanged = prev.displayHeight !== next.displayHeight\n const fitChanged = prev.fit !== next.fit\n\n if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n // Both specified - use fit mode\n const fit = next.fit ?? 'fill'\n\n if (fit === 'fill') {\n // Use setDisplaySize for fill mode (non-uniform scaling)\n sprite.setDisplaySize(next.displayWidth, next.displayHeight)\n } else {\n // Use setScale for contain/cover (uniform scaling)\n const { scaleX, scaleY } = calculateFitScale(\n sprite,\n next.displayWidth,\n next.displayHeight,\n fit\n )\n sprite.setScale(scaleX, scaleY)\n }\n } else if (typeof next.displayWidth === 'number') {\n // Only width - preserve aspect ratio (use original texture width)\n const { width: origWidth } = getOriginalTextureDimensions(sprite)\n const scale = next.displayWidth / origWidth\n sprite.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height - preserve aspect ratio (use original texture height)\n const { height: origHeight } = getOriginalTextureDimensions(sprite)\n const scale = next.displayHeight / origHeight\n sprite.setScale(scale, scale)\n } else {\n // No display size specified - reset to default scale\n sprite.setScale(1)\n }\n }\n\n // Handle animation changes\n const animationChanged =\n prev.animationKey !== next.animationKey ||\n prev.loop !== next.loop ||\n prev.repeatDelay !== next.repeatDelay\n\n if (animationChanged) {\n // Stop previous animation if playing\n if (sprite.anims.isPlaying) {\n sprite.anims.stop()\n }\n\n // Play new animation if specified\n if (next.animationKey) {\n sprite.anims.play({\n key: next.animationKey,\n repeat: next.loop ? -1 : 0,\n repeatDelay: next.repeatDelay ?? 0,\n })\n }\n }\n\n // Update animation callbacks\n const callbacksChanged =\n prev.onAnimationStart !== next.onAnimationStart ||\n prev.onAnimationComplete !== next.onAnimationComplete ||\n prev.onAnimationRepeat !== next.onAnimationRepeat ||\n prev.onAnimationUpdate !== next.onAnimationUpdate\n\n if (callbacksChanged) {\n // Remove old listeners\n sprite.off('animationstart')\n sprite.off('animationcomplete')\n sprite.off('animationrepeat')\n sprite.off('animationupdate')\n\n // Add new listeners\n if (next.onAnimationStart) {\n sprite.on('animationstart', (anim: Phaser.Animations.Animation) => {\n next.onAnimationStart?.(anim.key)\n })\n }\n\n if (next.onAnimationComplete) {\n sprite.on('animationcomplete', (anim: Phaser.Animations.Animation) => {\n next.onAnimationComplete?.(anim.key)\n })\n }\n\n if (next.onAnimationRepeat) {\n sprite.on('animationrepeat', (anim: Phaser.Animations.Animation) => {\n next.onAnimationRepeat?.(anim.key)\n })\n }\n\n if (next.onAnimationUpdate) {\n sprite.on(\n 'animationupdate',\n (anim: Phaser.Animations.Animation, frame: Phaser.Animations.AnimationFrame) => {\n next.onAnimationUpdate?.(anim.key, frame)\n }\n )\n }\n }\n}\n","/**\n * Layout applier for Sprite components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Applies layout props and updates layout size provider\n * Sprites are always headless (return minimal size)\n * @param sprite - Phaser Sprite object\n * @param _prev - Previous props (unused)\n * @param next - New props\n */\nexport function applySpriteLayout(\n sprite: Phaser.GameObjects.Sprite & {\n __layoutProps?: SpriteBaseProps\n },\n _prev: Partial<SpriteBaseProps & LayoutProps>,\n next: Partial<SpriteBaseProps & LayoutProps>\n): void {\n // Update layout props reference\n sprite.__layoutProps = next as SpriteBaseProps\n\n // Note: __getLayoutSize is set once in creator and never changes\n // Sprites are always headless (0.01x0.01)\n}\n","/**\n * Layout creator for Sprite components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Creates layout infrastructure for a Sprite component\n * Attaches layout props and size provider\n * Sprites are always headless (minimal size)\n * @param sprite - Phaser Sprite object\n * @param props - Sprite props including layout\n */\nexport function createSpriteLayout(\n sprite: Phaser.GameObjects.Sprite & {\n __layoutProps?: SpriteBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<SpriteBaseProps>\n): void {\n // Attach layout props for layout calculations\n sprite.__layoutProps = props as SpriteBaseProps\n\n // Attach size provider\n // Sprites are always headless - return minimal size (0.01x0.01)\n // This allows them to participate in alignment but not affect layout dimensions\n sprite.__getLayoutSize = () => {\n return { width: 0.01, height: 0.01 }\n }\n}\n","/**\n * Sprite component - Phaser Sprite GameObject (animated texture)\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: ANIMATED GAME OBJECTS\n * Purpose: Display animated sprites in game scenes (characters, effects, particles)\n * Phaser Type: Phaser.GameObjects.Sprite (animation-capable texture rendering)\n * Characteristics:\n * - Always headless (does not affect parent layout)\n * - Supports Phaser Animation system\n * - Free positioning with rotation/scale\n *\n * 2. Headless Behavior: MANDATORY ✅\n * Decision: Sprites are ALWAYS headless (not configurable)\n * Reasoning:\n * - Sprites are game objects, not UI elements\n * - Should NOT affect parent layout dimensions\n * - Free positioning with full transform support (rotation, scale)\n * Layout Impact: Returns minimal size (0.01x0.01) - participates in alignment only\n * Use Cases:\n * - ✅ Game characters, particles, effects, free-floating objects\n * - ✅ Animated decorations, background elements\n * - ❌ NOT for layout-based UIs (use Image component instead)\n *\n * 3. Layout Size Provider: MINIMAL SIZE ✅\n * Implementation: Always returns { width: 0.01, height: 0.01 }\n * Reasoning:\n * - Sprites don't affect layout spacing\n * - Minimal size allows alignment but no spacing impact\n * - Simpler than getBounds() with same result\n *\n * 4. Animation System: PHASER ANIMATIONS ✅\n * Features:\n * - animationKey: Play pre-registered animation\n * - loop: Repeat animation indefinitely\n * - repeatDelay: Delay between animation repeats (ms)\n * Callbacks:\n * - onAnimationStart: Triggered when animation begins\n * - onAnimationComplete: Triggered when animation ends\n * - onAnimationRepeat: Triggered on each repeat\n * - onAnimationUpdate: Triggered on each frame update\n * Note: Animations must be pre-registered in Phaser AnimationManager\n *\n * 5. Texture & Sizing: LIKE IMAGE ✅\n * Props:\n * - texture: Texture key (required)\n * - frame: Frame from atlas/spritesheet\n * - tint: Color tint (0xRRGGBB)\n * - displayWidth/displayHeight: Scale sprite to fit\n * - fit: 'fill' | 'contain' | 'cover' (aspect ratio handling)\n * Error Handling: Missing texture → Phaser default (white square)\n *\n * 6. Origin Behavior: CENTERED (0.5, 0.5) ✅\n * Decision: Default origin (0.5, 0.5) - centered\n * Reasoning:\n * - Phaser sprite default\n * - Natural for rotation/scale pivot\n * - Game object semantics\n * Override: Use originX/originY props for custom origin\n *\n * 7. Performance: SPRITE BATCHING ✅\n * Strategy:\n * - Leverages Phaser's sprite batching (WebGL)\n * - Props that preserve batching: tint, alpha, scale, position\n * - Props that break batching: custom shaders, blend modes (use sparingly)\n * - Texture atlases strongly recommended for multiple sprites\n *\n * 8. Common Patterns:\n * Character:\n * <Sprite texture=\"player\" animationKey=\"walk\" loop={true} />\n * Particle Effect:\n * <Sprite texture=\"explosion\" animationKey=\"explode\" onAnimationComplete={destroy} />\n * Scaled Sprite:\n * <Sprite texture=\"coin\" displayWidth={32} displayHeight={32} fit=\"contain\" />\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Sprite creation with texture/frame support\n * [✅] Transform props (position, rotation, scale, alpha)\n * [✅] Layout system integration (always headless)\n * [✅] Origin handling (0.5, 0.5 default)\n * [✅] Display size with fit modes (contain/cover/fill)\n * [✅] Tint support\n * [✅] Animation system (play, loop, callbacks)\n * [✅] Texture and frame patching\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applySpriteProps } from '../appliers/applySprite'\nimport { applySpriteLayout } from '../appliers/applySpriteLayout'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createSpriteLayout } from '../creators/createSpriteLayout'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Sprite component\n */\nexport interface SpriteBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas or spritesheet */\n frame?: string | number\n\n /** Tint color applied to sprite (0xRRGGBB) */\n tint?: number\n\n /** Display width (scales sprite to fit) */\n displayWidth?: number\n\n /** Display height (scales sprite to fit) */\n displayHeight?: number\n\n /**\n * How sprite should fit within bounds (if displayWidth/displayHeight set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Animation key to play (pre-registered in Phaser AnimationManager) */\n animationKey?: string\n\n /** Loop animation (default: false) */\n loop?: boolean\n\n /** Delay between animation repeats in ms (default: 0) */\n repeatDelay?: number\n\n /** Callback when animation starts */\n onAnimationStart?: (key: string) => void\n\n /** Callback when animation completes */\n onAnimationComplete?: (key: string) => void\n\n /** Callback when animation repeats */\n onAnimationRepeat?: (key: string) => void\n\n /** Callback on each animation frame update */\n onAnimationUpdate?: (key: string, frame: Phaser.Animations.AnimationFrame) => void\n\n /** Origin X (0-1, default 0.5) */\n originX?: number\n\n /** Origin Y (0-1, default 0.5) */\n originY?: number\n}\n\n/**\n * Props for Sprite component\n */\nexport interface SpriteProps\n extends SpriteBaseProps, PropsDefaultExtension<Phaser.GameObjects.Sprite> {}\n\n/**\n * Sprite creator - creates a Phaser Sprite object with animations\n */\nexport const spriteCreator: HostCreator<'Sprite'> = (scene, props) => {\n const sprite = scene.add.sprite(props.x ?? 0, props.y ?? 0, props.texture, props.frame)\n\n // Set origin - always centered (0.5, 0.5) for sprites\n sprite.setOrigin(0.5, 0.5)\n\n // Apply custom origin if specified\n if (props.originX !== undefined || props.originY !== undefined) {\n sprite.setOrigin(props.originX ?? sprite.originX, props.originY ?? sprite.originY)\n }\n\n // Apply transform props (scale, rotation)\n createTransform(sprite, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(sprite, props)\n\n // Apply sprite-specific props (tint, displaySize, fit)\n if (props.tint !== undefined) {\n sprite.setTint(props.tint)\n }\n\n // Apply displayWidth/displayHeight if specified\n if (props.displayWidth !== undefined || props.displayHeight !== undefined) {\n if (props.displayWidth !== undefined && props.displayHeight !== undefined) {\n // Both specified - use fit mode\n const fit = props.fit ?? 'fill'\n const textureWidth = sprite.width\n const textureHeight = sprite.height\n\n if (textureWidth > 0 && textureHeight > 0) {\n if (fit === 'fill') {\n sprite.setDisplaySize(props.displayWidth, props.displayHeight)\n } else if (fit === 'contain') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect > textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n sprite.setScale(scale)\n } else if (fit === 'cover') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect < textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n sprite.setScale(scale)\n }\n }\n } else if (props.displayWidth !== undefined) {\n const scale = props.displayWidth / sprite.width\n sprite.setScale(scale)\n } else if (props.displayHeight !== undefined) {\n const scale = props.displayHeight / sprite.height\n sprite.setScale(scale)\n }\n }\n\n // Setup animation system\n // Only play if the animation is already registered in the AnimationManager.\n // Calling `sprite.anims.play` with a missing key causes Phaser to log\n // \"Missing animation: <key>\". Many examples register animations in a\n // separate effect that may run after the Sprite is created, so avoid\n // attempting to play until the animation actually exists.\n if (props.animationKey) {\n if (sprite.scene && sprite.scene.anims.exists(props.animationKey)) {\n sprite.anims.play({\n key: props.animationKey,\n repeat: props.loop ? -1 : 0,\n repeatDelay: props.repeatDelay ?? 0,\n })\n }\n }\n\n // Setup animation callbacks\n if (props.onAnimationStart) {\n sprite.on('animationstart', (anim: Phaser.Animations.Animation) => {\n props.onAnimationStart?.(anim.key)\n })\n }\n\n if (props.onAnimationComplete) {\n sprite.on('animationcomplete', (anim: Phaser.Animations.Animation) => {\n props.onAnimationComplete?.(anim.key)\n })\n }\n\n if (props.onAnimationRepeat) {\n sprite.on('animationrepeat', (anim: Phaser.Animations.Animation) => {\n props.onAnimationRepeat?.(anim.key)\n })\n }\n\n if (props.onAnimationUpdate) {\n sprite.on(\n 'animationupdate',\n (anim: Phaser.Animations.Animation, frame: Phaser.Animations.AnimationFrame) => {\n props.onAnimationUpdate?.(anim.key, frame)\n }\n )\n }\n\n // Setup layout system (props and size provider)\n createSpriteLayout(sprite, props)\n\n // Call onReady callback if provided\n if (props.onReady) {\n props.onReady(sprite)\n }\n\n return sprite\n}\n\n/**\n * Sprite patcher - updates Sprite properties\n */\nexport const spritePatcher: HostPatcher<'Sprite'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply sprite-specific props (texture, frame, tint, displaySize, fit, animations)\n applySpriteProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applySpriteLayout(node, prev, next)\n}\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","import * as equalImport from 'fast-deep-equal'\n\ntype EqualFn = (a: unknown, b: unknown) => boolean\n\n// Normalize the CJS export shape for ESM usage.\nconst equal =\n typeof equalImport === 'function'\n ? (equalImport as unknown as EqualFn)\n : (equalImport as { default: EqualFn }).default\n\nexport default equal\n","/**\n * Development and debugging configuration\n * Runtime-configurable settings for debugging and development\n */\n\n/**\n * Simple debounce implementation — avoids pulling in ~1.1 MB of lodash\n * @internal\n */\nfunction debounce<T extends (...args: unknown[]) => void>(\n fn: T,\n delay: number\n): (...args: unknown[]) => void {\n let timeoutId: ReturnType<typeof setTimeout> | undefined\n return (...args: unknown[]) => {\n if (timeoutId !== undefined) clearTimeout(timeoutId)\n timeoutId = setTimeout(() => {\n timeoutId = undefined\n fn(...args)\n }, delay)\n }\n}\n\n/**\n * Development configuration object\n * Can be modified at runtime from user code for debugging\n *\n * @example\n * ```typescript\n * import { DevConfig } from '@number10/phaserjsx'\n *\n * // Enable specific debug categories\n * DevConfig.debug.enabled = true\n * DevConfig.debug.layout = true\n *\n * // Customize visual debugging\n * DevConfig.visual.maskFillColor = 0xff00ff // Pink\n * DevConfig.visual.maskAlpha = 0.3 // Semi-transparent\n * ```\n */\nexport const DevConfig = {\n /**\n * Debug logging configuration\n * Controls console output for different subsystems\n */\n debug: {\n /**\n * Master switch - disables all debug output when false\n * @default false\n */\n enabled: false,\n\n /**\n * Detailed layout calculation logs\n * Shows container sizing, positioning, and flex distribution\n * @default false\n */\n layout: false,\n\n /**\n * Overflow mask positioning logs\n * Shows world coordinate calculations and mask updates\n * @default false\n */\n overflowMask: false,\n\n /**\n * Flex distribution calculations\n * Shows flex space allocation across children\n * @default false\n */\n flex: false,\n\n /**\n * Child sizing and positioning\n * Shows individual child dimension calculations\n * @default false\n */\n positioning: false,\n\n /**\n * VDOM mount/patch/unmount operations\n * Shows virtual DOM updates and reconciliation\n * @default false\n */\n vdom: false,\n\n /**\n * Performance timing measurements\n * Shows execution time for layout operations\n * @default false\n */\n performance: false,\n\n /**\n * Theme system logs\n * Shows theme registry updates and prop merging\n * @default false\n */\n theme: false,\n },\n\n /**\n * VDOM warnings and development checks\n * These help catch common mistakes that lead to performance issues\n */\n warnings: {\n /**\n * Warn when list items (siblings) don't have key props\n * Similar to React's \"Each child in a list should have a unique key prop\" warning\n * @default true (in development)\n */\n missingKeys: false, // temp disable because of detection issues, will re-enable later\n\n /**\n * Warn when props change causes full remount instead of update\n * Detects JSX/callback recreation that prevents VDOM optimization\n * @default true (in development)\n */\n unnecessaryRemounts: false,\n\n /**\n * Warn when VNodes are frozen/sealed and need copying\n * Happens in production builds or with certain bundler optimizations\n * @default false (usually only relevant in production)\n */\n frozenVNodes: false,\n },\n\n /**\n * Visual debugging aids\n * Runtime-configurable visual settings\n */\n visual: {\n /**\n * Show overflow mask areas\n * When true, masks are visible (alpha > 0) for debugging\n * @default false\n */\n showOverflowMasks: false,\n\n /**\n * Mask fill color\n * @default 0xffffff (white, invisible with alpha=0)\n * @example 0xff00ff (pink for debugging)\n */\n maskFillColor: 0xffffff,\n\n /**\n * Mask alpha transparency\n * @default 0.0 (invisible)\n * @example 0.3 (semi-transparent for debugging)\n */\n maskAlpha: 0.0,\n },\n\n /**\n * Performance tuning\n */\n performance: {\n /**\n * Enable deferred layout queue batching\n * When false, deferred updates execute immediately (not batched)\n * @default true\n */\n useDeferredQueue: true,\n\n /**\n * Log deferred queue statistics\n * Shows number of batched callbacks per frame\n * @default false\n */\n logQueueStats: false,\n },\n}\n\n/**\n * Debug logger with category support\n * Only logs when global debug is enabled AND category is enabled\n *\n * @example\n * ```typescript\n * DebugLogger.log('layout', 'Container size:', { width: 100, height: 200 })\n * // Only logs if DevConfig.debug.enabled && DevConfig.debug.layout\n * ```\n */\nexport class DebugLogger {\n /**\n * Debounced console.log instances per category-message combination\n */\n private static debouncedLoggers = new Map<string, (...args: unknown[]) => void>()\n\n /**\n * Log a message with category filtering and debouncing\n * @param category - Debug category to check\n * @param message - Message to log\n * @param args - Additional arguments to log (only first element is used)\n */\n static log(category: keyof typeof DevConfig.debug, message: string, ...args: unknown[]): void {\n if (!DevConfig.debug.enabled) return\n if (category !== 'enabled' && !DevConfig.debug[category]) return\n\n const key = `${String(category)}:${message}`\n let debouncedLog = this.debouncedLoggers.get(key)\n\n // console.log(`[${category}] ${message}`, args[0])\n\n if (!debouncedLog) {\n debouncedLog = debounce(() => {\n console.log(`[${category}] ${message}`, args[0])\n }, 300)\n this.debouncedLoggers.set(key, debouncedLog)\n }\n\n debouncedLog()\n }\n\n /**\n * Log a warning message (always shown, even if debug disabled)\n * @param category - Category for context\n * @param message - Warning message\n * @param args - Additional arguments\n */\n static warn(category: string, message: string, ...args: unknown[]): void {\n console.warn(`[${category}] ${message}`, ...args)\n }\n\n /**\n * Log an error message (always shown, even if debug disabled)\n * @param category - Category for context\n * @param message - Error message\n * @param args - Additional arguments\n */\n static error(category: string, message: string, ...args: unknown[]): void {\n console.error(`[${category}] ${message}`, ...args)\n }\n\n /**\n * Start a performance timer\n * @param category - Debug category to check\n * @param label - Timer label\n */\n static time(category: keyof typeof DevConfig.debug, label: string): void {\n if (!DevConfig.debug.enabled) return\n if (category !== 'enabled' && !DevConfig.debug[category]) return\n\n console.time(`[${category}] ${label}`)\n }\n\n /**\n * End a performance timer\n * @param category - Debug category to check\n * @param label - Timer label\n */\n static timeEnd(category: keyof typeof DevConfig.debug, label: string): void {\n if (!DevConfig.debug.enabled) return\n if (category !== 'enabled' && !DevConfig.debug[category]) return\n\n console.timeEnd(`[${category}] ${label}`)\n }\n}\n\n/**\n * Predefined configuration presets for common debugging scenarios\n *\n * @example\n * ```typescript\n * import { DevPresets } from '@number10/phaserjsx'\n *\n * // Quick activation of overflow debugging\n * DevPresets.debugOverflow()\n *\n * // Revert to production settings\n * DevPresets.production()\n * ```\n */\nexport const DevPresets = {\n /**\n * Production configuration\n * All debugging disabled, optimal performance\n */\n production: (): void => {\n DevConfig.debug.enabled = false\n DevConfig.visual.showOverflowMasks = false\n DevConfig.visual.maskAlpha = 0.0\n DevConfig.visual.maskFillColor = 0xffffff\n DevConfig.performance.logQueueStats = false\n },\n\n /**\n * Debug layout issues\n * Enables layout, positioning, and flex logs\n */\n debugLayout: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.layout = true\n DevConfig.debug.positioning = true\n DevConfig.debug.flex = true\n // Keep other categories off\n DevConfig.debug.overflowMask = false\n DevConfig.debug.vdom = false\n DevConfig.debug.performance = false\n },\n\n /**\n * Debug overflow masking\n * Enables overflow logs and makes masks visible\n */\n debugOverflow: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.overflowMask = true\n DevConfig.visual.showOverflowMasks = true\n DevConfig.visual.maskFillColor = 0xff00ff // Pink\n DevConfig.visual.maskAlpha = 0.3 // Semi-transparent\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.vdom = false\n DevConfig.debug.performance = false\n },\n\n /**\n * Performance profiling\n * Enables performance timing and queue statistics\n */\n profilePerformance: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.performance = true\n DevConfig.performance.logQueueStats = true\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.overflowMask = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.vdom = false\n },\n\n /**\n * Debug VDOM operations\n * Enables virtual DOM mount/patch/unmount logs\n */\n debugVDOM: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.vdom = true\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.overflowMask = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.performance = false\n },\n\n debugTheme: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.theme = true\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.overflowMask = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.performance = false\n DevConfig.debug.vdom = false\n },\n\n /**\n * Enable all debug categories (verbose!)\n * Use with caution - produces lots of console output\n */\n debugAll: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.layout = true\n DevConfig.debug.overflowMask = true\n DevConfig.debug.flex = true\n DevConfig.debug.positioning = true\n DevConfig.debug.vdom = true\n DevConfig.debug.performance = true\n DevConfig.visual.showOverflowMasks = true\n DevConfig.visual.maskFillColor = 0xff00ff\n DevConfig.visual.maskAlpha = 0.3\n DevConfig.performance.logQueueStats = true\n },\n}\n","/**\n * Viewport context - provides screen/canvas dimensions to all components\n * Enables viewport-relative units (vw, vh) in layout calculations\n */\nimport type { ParentType } from './types'\n\n/**\n * Viewport dimensions\n */\nexport interface ViewportSize {\n width: number\n height: number\n}\n\n/**\n * Viewport registry - stores current viewport dimensions\n * Similar to themeRegistry pattern\n */\nclass ViewportRegistry {\n private viewport: ViewportSize = { width: 800, height: 600 }\n private parent: ParentType | undefined\n\n /**\n * Update viewport dimensions\n * @param width - Viewport width in pixels\n * @param height - Viewport height in pixels\n * @param parent - Optional Phaser scene reference\n */\n setViewport(width: number, height: number, parent?: ParentType): void {\n this.viewport = { width, height }\n this.parent = parent\n }\n\n /**\n * Get current viewport dimensions\n * @returns Current viewport size\n */\n getViewport(): ViewportSize {\n return this.viewport\n }\n\n /**\n * Get Phaser scene reference\n * @returns Scene or undefined\n */\n getParent(): ParentType | undefined {\n return this.parent\n }\n}\n\n/**\n * Global viewport registry instance\n */\nexport const viewportRegistry = new ViewportRegistry()\n","/**\n * Size resolution utilities for handling different size value types\n * Supports fixed pixels, percentages, viewport units (vw/vh), auto sizing, and calc() expressions\n */\nimport { DebugLogger } from '../../dev-config'\nimport { viewportRegistry } from '../../viewport-context'\nimport type { CalcExpression, CalcOperand, ParsedSize } from '../types'\n\n// Re-export for convenience\nexport type { ParsedSize } from '../types'\n\n/**\n * Cache for parseSize results to avoid repeated string parsing\n * Key: original size value, Value: parsed size object\n */\nconst parseSizeCache = new Map<unknown, ParsedSize>()\n\n/**\n * Set of size values that already triggered a warning\n * Prevents console spam from repeated warnings for the same invalid value\n */\nconst warnedSizes = new Set<string>()\n\n/**\n * Parse a calc operand (e.g., \"50%\" or \"20px\" or \"100vw\")\n * @param operand - String operand from calc expression\n * @returns Parsed operand\n */\nfunction parseCalcOperand(operand: string): CalcOperand {\n const trimmed = operand.trim()\n\n // Percentage: \"50%\"\n const percentMatch = trimmed.match(/^(\\d+(?:\\.\\d+)?)%$/)\n if (percentMatch && percentMatch[1]) {\n return { type: 'percent', value: parseFloat(percentMatch[1]) }\n }\n\n // Viewport width: \"100vw\"\n const vwMatch = trimmed.match(/^(\\d+(?:\\.\\d+)?)vw$/)\n if (vwMatch && vwMatch[1]) {\n return { type: 'vw', value: parseFloat(vwMatch[1]) }\n }\n\n // Viewport height: \"100vh\"\n const vhMatch = trimmed.match(/^(\\d+(?:\\.\\d+)?)vh$/)\n if (vhMatch && vhMatch[1]) {\n return { type: 'vh', value: parseFloat(vhMatch[1]) }\n }\n\n // Fixed pixels: \"20px\" or \"20\"\n const pixelMatch = trimmed.match(/^(-?\\d+(?:\\.\\d+)?)(?:px)?$/)\n if (pixelMatch && pixelMatch[1]) {\n return { type: 'fixed', value: parseFloat(pixelMatch[1]) }\n }\n\n throw new Error(`[Size] Invalid calc operand: \"${operand}\"`)\n}\n\n/**\n * Parse a calc() expression\n * @param expr - Calc expression string without \"calc(\" prefix\n * @returns Parsed calc expression\n */\nfunction parseCalcExpression(expr: string): CalcExpression {\n // Remove spaces\n expr = expr.replace(/\\s+/g, '')\n\n // Simple recursive parser for calc expressions\n function parseExpression(str: string): CalcExpression | CalcOperand {\n str = str.trim()\n\n // Handle parentheses\n if (str.startsWith('(') && str.endsWith(')')) {\n return parseExpression(str.slice(1, -1))\n }\n\n // Check if it's just an operand\n try {\n return parseCalcOperand(str)\n } catch {\n // Not an operand, continue parsing\n }\n\n // Find operators, respecting precedence: * / before + -\n const operators = ['+', '-', '*', '/']\n let parenDepth = 0\n let lastOpIndex = -1\n let lastOp = ''\n\n for (let i = str.length - 1; i >= 0; i--) {\n const char = str.charAt(i)\n if (char === ')') parenDepth++\n else if (char === '(') parenDepth--\n else if (parenDepth === 0 && operators.includes(char)) {\n // Check precedence: prefer * / over + -\n if (char === '*' || char === '/' || (lastOp !== '*' && lastOp !== '/')) {\n lastOpIndex = i\n lastOp = char\n if (char === '+' || char === '-') break // Lowest precedence, stop here\n }\n }\n }\n\n if (lastOpIndex === -1) {\n throw new Error(`[Size] No valid operator found in calc expression: \"${str}\"`)\n }\n\n const leftStr = str.slice(0, lastOpIndex)\n const rightStr = str.slice(lastOpIndex + 1)\n\n if (!leftStr || !rightStr) {\n throw new Error(`[Size] Invalid calc expression: \"${str}\"`)\n }\n\n return {\n left: parseExpression(leftStr),\n operator: lastOp as '+' | '-' | '*' | '/',\n right: parseExpression(rightStr),\n }\n }\n\n return parseExpression(expr) as CalcExpression\n}\n\n/**\n * Parse a size value into its components\n * Results are cached to avoid repeated string parsing during layout calculations\n * @param size - Size value (number, string, or undefined)\n * @returns Parsed size information\n * @throws Error if string format is invalid\n *\n * @example\n * parseSize(100) // { type: 'fixed', value: 100 }\n * parseSize('50%') // { type: 'percent', value: 50 }\n * parseSize('calc(100% - 40px)') // { type: 'calc', calc: {...} }\n * parseSize(undefined) // { type: 'auto' }\n * parseSize('auto') // { type: 'auto' }\n */\nexport function parseSize(size: number | string | undefined): ParsedSize {\n // Debug: Track parseSize call frequency\n // console.log('parseSize called:', size)\n\n // Check cache first (huge performance win for repeated calls)\n const cached = parseSizeCache.get(size)\n if (cached !== undefined) {\n return cached\n }\n\n // Parse the size value\n const result = parseSizeInternal(size)\n\n // Cache the result for future calls\n parseSizeCache.set(size, result)\n\n return result\n}\n\n/**\n * Internal parsing logic for size values\n * Separated to allow caching in parseSize()\n * @param size - Size value to parse\n * @returns Parsed size information\n */\nfunction parseSizeInternal(size: number | string | undefined): ParsedSize {\n // undefined -> auto (dynamic based on content)\n if (size === undefined) {\n return { type: 'auto' }\n }\n\n // number -> fixed pixel value\n if (typeof size === 'number') {\n return { type: 'fixed', value: size }\n }\n\n // string -> parse format\n if (size === 'auto') {\n return { type: 'auto' }\n }\n\n if (size === 'fill') {\n return { type: 'fill' }\n }\n\n // Calc expression: \"calc(100% - 40px)\"\n const calcMatch = size.match(/^calc\\((.+)\\)$/)\n if (calcMatch && calcMatch[1]) {\n return { type: 'calc', calc: parseCalcExpression(calcMatch[1]) }\n }\n\n // Percentage format: \"50%\", \"75.5%\", \"100%\"\n const percentMatch = size.match(/^(\\d+(?:\\.\\d+)?)%$/)\n if (percentMatch && percentMatch[1]) {\n const value = parseFloat(percentMatch[1])\n if (value < 0 || value > 100) {\n // Only warn once per unique invalid value to prevent console spam\n const warnKey = `percent:${value}`\n if (!warnedSizes.has(warnKey)) {\n warnedSizes.add(warnKey)\n DebugLogger.warn('Size', `Percentage value ${value}% is outside valid range (0-100%)`)\n }\n }\n return { type: 'percent', value }\n }\n\n // Viewport width: \"100vw\", \"50vw\"\n const vwMatch = size.match(/^(\\d+(?:\\.\\d+)?)vw$/)\n if (vwMatch && vwMatch[1]) {\n return { type: 'vw', value: parseFloat(vwMatch[1]) }\n }\n\n // Viewport height: \"100vh\", \"50vh\"\n const vhMatch = size.match(/^(\\d+(?:\\.\\d+)?)vh$/)\n if (vhMatch && vhMatch[1]) {\n return { type: 'vh', value: parseFloat(vhMatch[1]) }\n }\n\n // Unknown format\n throw new Error(\n `[Size] Invalid size format: \"${size}\". Supported formats: number, \"X%\", \"XvW\", \"Xvh\", \"calc(...)\", \"auto\", \"fill\", undefined`\n )\n}\n\n/**\n * Resolve a calc operand to pixel value\n * @param operand - Calc operand or sub-expression\n * @param parentSize - Parent dimension for percentage resolution\n * @param viewportSize - Viewport dimensions for vw/vh resolution\n * @returns Resolved pixel value\n */\nfunction resolveCalcOperand(\n operand: CalcOperand | CalcExpression,\n parentSize?: number,\n viewportSize?: { width: number; height: number }\n): number {\n if ('type' in operand) {\n // It's a CalcOperand\n if (operand.type === 'fixed') {\n return operand.value\n }\n\n // Percentage\n if (operand.type === 'percent') {\n if (parentSize === undefined) {\n return 0\n }\n return (parentSize * operand.value) / 100\n }\n\n // Viewport width\n if (operand.type === 'vw') {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vw without viewport size. Using 0.')\n return 0\n }\n return (viewport.width * operand.value) / 100\n }\n\n // Viewport height\n if (operand.type === 'vh') {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vh without viewport size. Using 0.')\n return 0\n }\n return (viewport.height * operand.value) / 100\n }\n\n return 0\n } else {\n // It's a CalcExpression\n return resolveCalcExpression(operand, parentSize, viewportSize)\n }\n}\n\n/**\n * Resolve a calc expression to pixel value\n * @param calc - Calc expression\n * @param parentSize - Parent dimension for percentage resolution\n * @param viewportSize - Viewport dimensions for vw/vh resolution\n * @returns Resolved pixel value\n */\nfunction resolveCalcExpression(\n calc: CalcExpression,\n parentSize?: number,\n viewportSize?: { width: number; height: number }\n): number {\n const left = resolveCalcOperand(calc.left, parentSize, viewportSize)\n const right = resolveCalcOperand(calc.right, parentSize, viewportSize)\n\n switch (calc.operator) {\n case '+':\n return left + right\n case '-':\n return left - right\n case '*':\n return left * right\n case '/':\n if (right === 0) {\n DebugLogger.error('Size', 'Division by zero in calc expression')\n return 0\n }\n return left / right\n default:\n DebugLogger.error('Size', `Unknown calc operator: ${calc.operator}`)\n return 0\n }\n}\n\n/**\n * Resolve a parsed size to actual pixel value\n * @param parsed - Parsed size information\n * @param parentSize - Parent dimension in pixels (required for percentage and calc)\n * @param contentSize - Content dimension in pixels (fallback for auto)\n * @param parentPadding - Parent padding in the relevant direction (for fill)\n * @param viewportSize - Viewport dimensions for vw/vh resolution\n * @returns Resolved size in pixels\n *\n * @example\n * resolveSize({ type: 'fixed', value: 100 }, 200) // 100\n * resolveSize({ type: 'percent', value: 50 }, 200) // 100 (50% of 200)\n * resolveSize({ type: 'vw', value: 100 }, undefined, undefined, undefined, viewport) // viewport.width\n * resolveSize({ type: 'vh', value: 50 }, undefined, undefined, undefined, viewport) // viewport.height * 0.5\n * resolveSize({ type: 'calc', calc: {...} }, 200) // calc result\n * resolveSize({ type: 'auto' }, 200, 150) // 150 (content size)\n * resolveSize({ type: 'fill' }, 200, undefined, 40) // 160 (200 - 40)\n */\nexport function resolveSize(\n parsed: ParsedSize,\n parentSize?: number,\n contentSize?: number,\n parentPadding?: number,\n viewportSize?: { width: number; height: number }\n): number {\n switch (parsed.type) {\n case 'fixed':\n return parsed.value ?? 100\n\n case 'percent':\n if (parentSize === undefined) {\n // Only warn if we also don't have a fallback content size\n if (contentSize === undefined) {\n DebugLogger.warn(\n 'Size',\n 'Cannot resolve percentage without parent size and no content fallback.'\n )\n return 100\n }\n // Parent size will be available in next layout pass - use content size for now\n return contentSize\n }\n return (parentSize * (parsed.value ?? 0)) / 100\n\n case 'vw': {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vw without viewport size. Using fallback 100px')\n return 100\n }\n return (viewport.width * (parsed.value ?? 0)) / 100\n }\n\n case 'vh': {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vh without viewport size. Using fallback 100px')\n return 100\n }\n return (viewport.height * (parsed.value ?? 0)) / 100\n }\n\n case 'calc':\n if (!parsed.calc) {\n DebugLogger.error('Size', 'Calc type without calc expression')\n return 100\n }\n return resolveCalcExpression(parsed.calc, parentSize, viewportSize)\n\n case 'auto':\n if (contentSize === undefined) {\n DebugLogger.warn('Size', 'Auto size without content size, using fallback 100px')\n return 100\n }\n return contentSize\n\n case 'fill': {\n if (parentSize === undefined) {\n // this would be possible at startup before parent sizes are known, therefore just return 0\n // DebugLogger.warn('Size', 'Fill size without parent size, using fallback 0px')\n return 0\n }\n // Fill = parent size minus padding (content-area)\n if (parentPadding !== undefined && parentPadding > 0) {\n return Math.max(0, parentSize - parentPadding)\n }\n // No padding or already content-area\n return parentSize\n }\n\n default:\n // Should never happen with proper typing\n DebugLogger.error('Size', `Unknown size type: ${(parsed as ParsedSize).type}`)\n return 100\n }\n}\n\n/**\n * Clear the parseSize cache and warning deduplication set\n * Useful for testing or memory management in long-running applications\n *\n * @example\n * ```typescript\n * // Clear caches after major UI rebuild\n * clearSizeCaches()\n * ```\n */\nexport function clearSizeCaches(): void {\n parseSizeCache.clear()\n warnedSizes.clear()\n}\n\n/**\n * Check if a calc expression requires parent context\n * @param calc - Calc expression\n * @returns True if expression contains percentages\n */\nfunction calcRequiresParent(calc: CalcExpression): boolean {\n const checkOperand = (op: CalcOperand | CalcExpression): boolean => {\n if ('type' in op) {\n return op.type === 'percent'\n } else {\n return calcRequiresParent(op)\n }\n }\n return checkOperand(calc.left) || checkOperand(calc.right)\n}\n\n/**\n * Check if a size needs parent context to resolve\n * @param parsed - Parsed size information\n * @returns True if size requires parent dimension\n */\nexport function requiresParent(parsed: ParsedSize): boolean {\n if (parsed.type === 'percent' || parsed.type === 'fill') {\n return true\n }\n\n // Calc expressions might contain percentages\n if (parsed.type === 'calc' && parsed.calc) {\n return calcRequiresParent(parsed.calc)\n }\n\n return false\n}\n\n/**\n * Check if a size can be determined without content measurement\n * @param parsed - Parsed size information\n * @returns True if size is explicitly defined (not auto)\n */\nexport function isExplicit(parsed: ParsedSize): boolean {\n return (\n parsed.type === 'fixed' ||\n parsed.type === 'percent' ||\n parsed.type === 'vw' ||\n parsed.type === 'vh' ||\n parsed.type === 'calc' ||\n parsed.type === 'fill'\n )\n}\n\n/**\n * Clamp a size value to min/max constraints\n * Min/max constraints can be SizeValue (pixels, percentage, viewport units, calc)\n * They are resolved relative to the same parent/viewport context as the size itself\n *\n * @param size - Resolved size in pixels\n * @param minSize - Minimum size constraint (SizeValue or undefined = no constraint)\n * @param maxSize - Maximum size constraint (SizeValue or undefined = no constraint)\n * @param parentSize - Parent dimension for percentage resolution in constraints\n * @param fallbackSize - Fallback size for auto constraints (not typically used for min/max)\n * @param parentPadding - Parent padding for fill constraints (not typically used for min/max)\n * @returns Clamped size in pixels\n *\n * @example\n * clampSize(150, 100, 200) // 150 (within bounds)\n * clampSize(50, 100, 200) // 100 (clamped to min)\n * clampSize(300, 100, 200) // 200 (clamped to max)\n * clampSize(150, undefined, \"80%\", 1000) // 150 (max = 800px)\n * clampSize(1000, undefined, \"80%\", 1000) // 800 (clamped to 80% of parent)\n */\nexport function clampSize(\n size: number,\n minSize?: number | string,\n maxSize?: number | string,\n parentSize?: number,\n fallbackSize?: number,\n parentPadding?: number\n): number {\n let clamped = size\n\n // Resolve and apply minimum constraint\n if (minSize !== undefined) {\n const parsedMin = parseSize(minSize)\n const resolvedMin = resolveSize(parsedMin, parentSize, fallbackSize, parentPadding)\n if (clamped < resolvedMin) {\n clamped = resolvedMin\n }\n }\n\n // Resolve and apply maximum constraint\n if (maxSize !== undefined) {\n const parsedMax = parseSize(maxSize)\n const resolvedMax = resolveSize(parsedMax, parentSize, fallbackSize, parentPadding)\n if (clamped > resolvedMax) {\n clamped = resolvedMax\n }\n }\n\n return clamped\n}\n","/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport equal from '../../utils/fast-deep-equal'\nimport type { TextSpecificProps } from '../../core-props'\nimport { parseSize, resolveSize } from '../../layout/utils/size-resolver'\nimport { viewportRegistry } from '../../viewport-context'\n\n/**\n * Generic node type with text capabilities\n */\ntype TextNode = {\n setText: (text: string) => void\n setStyle: (style: object) => void\n setWordWrapWidth: (width: number, useAdvancedWrap: boolean) => void\n updateText?: () => void // Force Phaser to recalculate text metrics immediately\n active?: boolean // Check if GameObject is still active\n scene?: Phaser.Scene // Access to scene for texture checks\n}\n\n/**\n * Applies text-specific properties (text content, color, font, alignment)\n * @param node - Phaser Text GameObject\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextProps<T extends TextNode>(\n node: T,\n prev: Partial<\n TextSpecificProps & { style?: Phaser.Types.GameObjects.Text.TextStyle | undefined }\n >,\n next: Partial<TextSpecificProps & { style?: Phaser.Types.GameObjects.Text.TextStyle | undefined }>\n): void {\n // Safety check: Ensure node is still active and scene is available\n if (node.active === false || (node.scene && !node.scene.sys.game)) {\n return\n }\n\n let needsUpdate = false\n\n // Text content\n if (prev.text !== next.text && typeof next.text === 'string') {\n node.setText(next.text)\n needsUpdate = true\n }\n\n // Apply style changes if the style object changed\n if (next.style !== undefined && !equal(next.style, prev.style || {})) {\n // Guard against Phaser canvas context errors during theme updates\n try {\n node.setStyle(next.style)\n needsUpdate = true\n } catch (error) {\n console.warn('Failed to apply text style (scene may be transitioning):', error)\n }\n }\n\n // Word wrap width - resolve SizeValue to pixels\n if (next.maxWidth !== prev.maxWidth && next.maxWidth !== undefined) {\n const viewport = viewportRegistry.getViewport()\n const parsedMaxWidth = parseSize(next.maxWidth)\n const resolvedMaxWidth = resolveSize(parsedMaxWidth, viewport?.width, undefined, undefined)\n node.setWordWrapWidth(resolvedMaxWidth, true)\n needsUpdate = true\n }\n\n // Legacy: Support direct Phaser style object\n if (prev.style !== next.style && next.style !== undefined) {\n try {\n node.setStyle(next.style)\n needsUpdate = true\n } catch (error) {\n console.warn('Failed to apply text style (scene may be transitioning):', error)\n }\n }\n\n // Force Phaser to recalculate text metrics immediately\n // This ensures getBounds() returns updated dimensions for layout calculations\n if (needsUpdate && node.updateText) {\n node.updateText()\n }\n}\n","/**\n * Layout applier for text components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { TextBaseProps } from '../primitives/text'\n\n/**\n * Applies layout properties for text components\n * Updates layout props and size provider when text or style changes\n * @param text - Phaser text object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextLayout(\n text: Phaser.GameObjects.Text & {\n __layoutProps?: TextBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n _prev: Partial<TextBaseProps>,\n next: Partial<TextBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation\n text.__layoutProps = next as TextBaseProps\n\n // ALWAYS recreate size provider to ensure VDOM detects size changes\n // Even if function reference changes, VDOM needs to know dimensions might have changed\n // Previously: Only updated if text/style changed - this caused layout not to recalculate\n // when text dimensions changed (e.g., \"9 times\" -> \"10 times\")\n text.__getLayoutSize = () => {\n if (text.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: text.width,\n height: text.height,\n }\n }\n}\n","/**\n * Layout creator for text components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { TextBaseProps } from '../primitives/text'\n\n/**\n * Creates layout infrastructure for a text component\n * Attaches layout props and dynamic size provider\n * @param text - Phaser text object\n * @param props - Text props including layout\n */\nexport function createTextLayout(\n text: Phaser.GameObjects.Text & {\n __layoutProps?: TextBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<TextBaseProps>\n): void {\n // Attach layout props for layout calculations\n text.__layoutProps = props as TextBaseProps\n\n // Attach dynamic size provider\n // Headless text returns minimal size 1x1 (participates in alignment, not spacing)\n // Note: 0x0 causes issues with Phaser internals or layout optimizations\n // Layout-aware text returns actual dimensions (rotation ignored for layout)\n text.__getLayoutSize = () => {\n if (text.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: text.width,\n height: text.height,\n }\n }\n}\n","/**\n * Text component - Phaser Text GameObject for rendering text\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: TEXT RENDERING\n * Purpose: Display styled text in UI layouts\n * Phaser Type: Phaser.GameObjects.Text (bitmap-based text rendering)\n * Characteristics:\n * - Layout-aware by default (participates in parent layout)\n * - Auto-sizing based on text content + font metrics\n * - Supports Phaser text styling (color, font, alignment, etc.)\n *\n * 2. Headless Default: FALSE ✅\n * Decision: Text participates in layout by default\n * Reasoning:\n * - Text is a UI element (labels, paragraphs, buttons)\n * - Should affect parent container dimensions\n * - Similar to HTML text nodes\n * Use Cases:\n * - ✅ Layout-aware (default): Labels, buttons, paragraphs, UI text\n * - ❌ Headless (optional): Floating damage numbers, debug text, tooltips\n * Usage:\n * <Text text=\"Label\" /> // Layout-aware\n * <Text text=\"+100\" headless={true} /> // Floating (no layout impact)\n *\n * 3. Layout Size Provider: UN-ROTATED DIMENSIONS ✅\n * Implementation: Uses text.width and text.height (un-rotated)\n * Behavior:\n * - Returns un-rotated text dimensions\n * - Rotation is IGNORED for layout-aware text (headless=false)\n * - Rotation only works with headless=true (no layout impact)\n * Reasoning:\n * - Flow layout is incompatible with rotation (causes positioning issues)\n * - Rotated text would overlap siblings in flow layout\n * - getBounds() position compensation is complex and error-prone\n * Example:\n * <Text text=\"Hello\" /> // ✅ Layout size: 100x20\n * <Text text=\"World\" rotation={Math.PI/4} /> // ⚠️ Rotation IGNORED, size: 100x20\n * <Text text=\"World\" rotation={Math.PI/4} headless={true} /> // ✅ Rotated, no layout\n * Recommendation: Use rotation only with headless=true or absolute positioning\n *\n * 4. Text Content & Styling:\n * Props:\n * - text: string (required, the text to display)\n * - style: Phaser.Types.GameObjects.Text.TextStyle (font, color, etc.)\n * - fontStyle, align, maxWidth: Convenience props (legacy)\n * Styling Priority:\n * 1. Inline style prop (highest)\n * 2. Individual props (fontStyle, align)\n * 3. Theme defaults (lowest)\n * Example:\n * <Text\n * text=\"Hello\"\n * style={{ fontSize: '24px', color: '#ffffff', fontFamily: 'Arial' }}\n * />\n *\n * 5. Margin Support:\n * Feature: Text supports margin prop (unique among primitives)\n * Reasoning:\n * - Text often needs spacing from siblings (inline elements)\n * - Margin affects layout calculations (added to text dimensions)\n * - Similar to CSS inline element margin\n * Usage:\n * <Text text=\"Label\" margin={{ left: 10, right: 10 }} />\n * <Text text=\"Spaced\" margin={8} /> // All sides\n *\n * 6. Layout Behavior:\n * Sizing:\n * - Auto-size: Text dimensions = rendered text bounds (default)\n * - No explicit width/height props (text size determined by content)\n * - maxWidth prop wraps text (Phaser feature)\n * Positioning:\n * - Positioned by parent layout engine (flexbox-style)\n * - x/y props override layout position (absolute positioning)\n *\n * 7. Origin Behavior:\n * Current: Phaser default origin (0, 0) - top-left\n * Reasoning:\n * - Text aligns naturally with layout flow\n * - Top-left origin simplifies position calculations\n * - Consistent with HTML text rendering\n * Note: Origin affects rotation pivot (if rotation applied)\n *\n * 8. Common Patterns:\n * Label:\n * <View direction=\"row\" gap={10}>\n * <Text text=\"Name:\" />\n * <Text text={userName} />\n * </View>\n * Styled Text:\n * <Text\n * text=\"Title\"\n * style={{ fontSize: '32px', fontWeight: 'bold', color: '#ff0000' }}\n * />\n * Wrapped Text:\n * <Text text={longParagraph} maxWidth={300} />\n * Floating Damage:\n * <Text text=\"-50 HP\" headless={true} alpha={0.8} />\n *\n * 9. Performance Considerations:\n * - Text rendering is relatively expensive (canvas-based)\n * - Frequent text changes trigger re-render\n * - Long text with maxWidth: word-wrap calculation cost\n * - Consider BitmapText for better performance (future component)\n * - Text batching: Multiple Text objects don't batch (separate draw calls)\n *\n * 10. Known Limitations:\n * - Rotation only supported with headless=true (ignored for layout-aware text)\n * → Flow layout is incompatible with rotation\n * - No rich text support (HTML tags, colors within text)\n * - Limited text effects (no shadows, outlines in base component)\n * - WordWrap with maxWidth: Can't specify ellipsis truncation\n * - Changing text frequently: Performance impact\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Text creation with style support\n * [✅] Transform props (position, scale, alpha)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Margin support (unique feature)\n * [✅] Text content and style patching\n * [✅] Theme system integration\n * [⚠️] Rotation - Only with headless=true (ignored for layout-aware text)\n * [❌] Rich text support - Future feature\n * [❌] Text effects (shadow, outline) - Future feature\n */\nimport type * as Phaser from 'phaser'\nimport type {\n EdgeInsets,\n LayoutProps,\n PhaserProps,\n TextSpecificProps,\n TransformProps,\n} from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTextProps } from '../appliers/applyText'\nimport { applyTextLayout } from '../appliers/applyTextLayout'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTextLayout } from '../creators/createTextLayout'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Text - composing shared prop groups\n * Includes optional margin for layout engine use\n */\nexport interface TextBaseProps\n extends TransformProps, PhaserProps, Pick<LayoutProps, 'headless'>, TextSpecificProps {\n margin?: EdgeInsets\n // Legacy: support Phaser's style object directly\n style?: Phaser.Types.GameObjects.Text.TextStyle | undefined\n}\n\n/**\n * Props for Text component - extends base props with JSX-specific props\n */\nexport interface TextProps extends TextBaseProps, PropsDefaultExtension<Phaser.GameObjects.Text> {}\n\n/**\n * Text creator - creates a Phaser Text object\n */\nexport const textCreator: HostCreator<'Text'> = (scene, props) => {\n const text = scene.add.text(props.x ?? 0, props.y ?? 0, props.text ?? '', props.style)\n\n // Set origin based on headless flag\n // Headless: (0.5, 0.5) - centered, works naturally with rotation/scale\n // Layout-aware: (0, 0) - top-left, aligns with layout flow\n if (props.headless) {\n text.setOrigin(0.5, 0.5)\n } else {\n text.setOrigin(0, 0)\n }\n\n // Normalize props for headless objects\n // Headless objects are positioned as points - no spacing or rotation constraints\n const normalizedProps = { ...props } as Record<string, unknown>\n if (props.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedProps.padding\n delete normalizedProps.margin\n delete normalizedProps.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedProps.rotation !== undefined) {\n delete normalizedProps.rotation\n }\n }\n\n // Apply transform props (scale, rotation if headless)\n createTransform(text, normalizedProps)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(text, normalizedProps)\n\n // Setup layout system (props and size provider)\n createTextLayout(text, normalizedProps)\n\n return text\n}\n\n/**\n * Text patcher - updates Text properties\n */\nexport const textPatcher: HostPatcher<'Text'> = (node, prev, next) => {\n // Update origin if headless flag changed\n if (prev.headless !== next.headless) {\n if (next.headless) {\n node.setOrigin(0.5, 0.5) // Headless: centered\n } else {\n node.setOrigin(0, 0) // Layout-aware: top-left\n }\n }\n\n // Normalize props for headless objects\n const normalizedPrev = { ...prev } as Record<string, unknown>\n const normalizedNext = { ...next } as Record<string, unknown>\n\n if (next.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedNext.padding\n delete normalizedNext.margin\n delete normalizedNext.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedNext.rotation !== undefined) {\n delete normalizedNext.rotation\n }\n }\n\n if (prev.headless) {\n delete normalizedPrev.padding\n delete normalizedPrev.margin\n delete normalizedPrev.gap\n } else {\n if (normalizedPrev.rotation !== undefined) {\n delete normalizedPrev.rotation\n }\n }\n\n // Apply transform props (position, rotation only if headless, scale)\n applyTransformProps(node, normalizedPrev, normalizedNext)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, normalizedPrev, normalizedNext)\n\n // Apply text-specific props (text content, color, font, etc.)\n applyTextProps(node, normalizedPrev, normalizedNext)\n\n // Apply layout props and update size provider if needed\n applyTextLayout(node, normalizedPrev, normalizedNext)\n}\n","/**\n * TileSprite component - Phaser TileSprite GameObject (repeating texture pattern)\n * Status: IMPLEMENTED ✅\n *\n * Design Decisions & Answers:\n * ===========================\n *\n * 1. Headless Default: TRUE ✅\n * Rationale: TileSprites are typically backgrounds/patterns (decorative).\n * They fill available space and shouldn't affect parent dimensions.\n * Use Cases:\n * - ✅ Headless (default): Scrolling backgrounds, parallax layers, repeating patterns\n * - ❌ Layout-aware: Rare - textured progress bars, pattern-filled UI blocks\n *\n * 2. Layout Size Provider: SIMPLE DIMENSIONS ✅\n * Decision: Use width/height directly (not getBounds)\n * Reasoning:\n * - TileSprite requires explicit width/height (Phaser constructor param)\n * - Dimensions are always known and stable\n * - getBounds() adds unnecessary overhead\n * - Rotation affects visual but not logical dimensions (pattern stays in rect)\n * Implementation: __getLayoutSize = () => ({ width, height })\n *\n * 3. Tiling Props: DIRECT PHASER MAPPING ✅\n * Decision: Expose Phaser's tilePosition/tileScale props directly\n * Props:\n * - tilePositionX/Y: Offset for scrolling effect (default: 0)\n * - tileScaleX/Y: Tile size multiplier (default: 1)\n * Example:\n * <TileSprite\n * texture=\"clouds\"\n * width={800} height={200}\n * tilePositionX={scrollOffset}\n * tileScaleX={2} // Tiles 2x larger\n * />\n * Note: tilePosition updates are cheap (WebGL texture wrapping, no redraw)\n *\n * 4. Sizing Strategy: HYBRID LAYOUT SUPPORT ✅\n * Decision: Support both explicit and layout-aware sizing\n * Behavior:\n * - Explicit pixels: width={800} height={200} → Fixed size\n * - Layout string: width=\"100%\" height=\"50%\" → Resolved from parent\n * - Layout fill: width={undefined} → Auto-fill parent (if parent sized)\n * Implementation:\n * - Resolve layout size in creator using existing size-resolver\n * - Create TileSprite with resolved pixel dimensions\n * - Update dimensions in patcher if layout props change\n * Phaser Limitation: TileSprite dimensions can't change after creation\n * → Workaround: Recreate TileSprite if dimensions change (expensive!)\n *\n * 5. Performance Characteristics: OPTIMAL FOR PATTERNS ✅\n * Advantages:\n * - WebGL texture wrapping (hardware-accelerated, no CPU cost)\n * - tilePosition updates are free (just shader uniform)\n * - Good for large repeating areas (better than multiple sprites)\n * - No geometry regeneration on scroll\n * Limitations:\n * - Texture must support wrapping (power-of-2 dimensions recommended)\n * - Rotation/scale affects entire area (not individual tiles)\n * - Can't change dimensions dynamically (requires recreation)\n *\n * 6. Animation Support: USER CODE ✅\n * Decision: No built-in animation helpers\n * Reasoning:\n * - Scrolling patterns vary widely (linear, sine wave, parallax)\n * - Simple to implement in user code:\n * const [scroll, setScroll] = useState(0)\n * useEffect(() => {\n * const timer = setInterval(() => setScroll(s => s + 1), 16)\n * return () => clearInterval(timer)\n * }, [])\n * <TileSprite tilePositionX={scroll} />\n * - No need for framework abstraction\n * Future: Consider useScrollingPattern hook if demand is high\n *\n * 7. Common Use Cases & Patterns: DOCUMENTED ✅\n * Best For:\n * - ✅ Scrolling backgrounds (clouds, stars, terrain)\n * - ✅ Infinite repeating patterns (tiles, grids)\n * - ✅ Parallax layers (different scroll speeds)\n * - ✅ Textured fills (progress bars, health bars)\n * Avoid For:\n * - ❌ Static backgrounds → Use Image (simpler)\n * - ❌ Complex patterns → Use Graphics or multiple Sprites\n * - ❌ Animated tiles → Use Sprite with animation\n *\n * 8. Origin Behavior: UI-FRIENDLY DEFAULT 🆕\n * Decision: Default origin (0, 0) like Image (differs from Sprite!)\n * Reasoning:\n * - TileSprites typically used as backgrounds/fills (top-left alignment)\n * - Matches Image component behavior (UI semantics)\n * - Easier layout calculations\n * - Allow override via originX/originY for special cases\n *\n * 9. Rotation & Tiling: DOCUMENTED BEHAVIOR 🆕\n * Behavior:\n * - Rotation rotates entire TileSprite area (not individual tiles)\n * - Tile pattern remains axis-aligned in texture space\n * - Useful for rotated pattern fills, but limited flexibility\n * - For rotated individual tiles, use multiple Sprite instances\n *\n * Implementation Checklist:\n * ========================\n * [✅] Create TileSprite with scene.add.tileSprite(x, y, width, height, texture, frame)\n * [✅] Set origin to (0, 0) by default (UI-friendly)\n * [✅] Apply transform props via applyTransformProps\n * [✅] Setup tilePosition/tileScale props\n * [✅] Setup layout size provider (width/height)\n * [✅] Handle dimension changes via setSize\n * [✅] Support tint, origin props\n * [✅] Document power-of-2 texture recommendation\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { LayoutSize } from '../../layout'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for TileSprite component\n */\nexport interface TileSpriteBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Width of the tile sprite area */\n width: number\n\n /** Height of the tile sprite area */\n height: number\n\n /** Horizontal tile position offset (for scrolling effect) */\n tilePositionX?: number\n\n /** Vertical tile position offset (for scrolling effect) */\n tilePositionY?: number\n\n /** Horizontal tile scale factor */\n tileScaleX?: number\n\n /** Vertical tile scale factor */\n tileScaleY?: number\n\n /** Tint color applied to tiles (0xRRGGBB) */\n tint?: number\n\n /** Origin X (0-1, default 0) */\n originX?: number\n\n /** Origin Y (0-1, default 0) */\n originY?: number\n}\n\n/**\n * Props for TileSprite component\n */\nexport interface TileSpriteProps\n extends TileSpriteBaseProps, PropsDefaultExtension<Phaser.GameObjects.TileSprite> {}\n\ntype TileSpriteNode = Phaser.GameObjects.TileSprite & {\n __layoutProps?: TileSpriteBaseProps\n __getLayoutSize?: () => LayoutSize\n}\n\n/**\n * Creates layout infrastructure for TileSprite.\n */\nfunction createTileSpriteLayout(\n tileSprite: TileSpriteNode,\n props: Partial<TileSpriteBaseProps>\n): void {\n tileSprite.__layoutProps = props as TileSpriteBaseProps\n tileSprite.__getLayoutSize = () => {\n if (tileSprite.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n\n return {\n width: tileSprite.width,\n height: tileSprite.height,\n }\n }\n}\n\nfunction applyTileSpriteProps(\n tileSprite: Phaser.GameObjects.TileSprite,\n prev: Partial<TileSpriteBaseProps>,\n next: Partial<TileSpriteBaseProps>\n): void {\n if ((prev.texture !== next.texture || prev.frame !== next.frame) && next.texture) {\n tileSprite.setTexture(next.texture, next.frame)\n }\n\n if (\n (prev.width !== next.width || prev.height !== next.height) &&\n typeof next.width === 'number' &&\n typeof next.height === 'number'\n ) {\n tileSprite.setSize(next.width, next.height)\n }\n\n if (prev.tilePositionX !== next.tilePositionX && typeof next.tilePositionX === 'number') {\n tileSprite.tilePositionX = next.tilePositionX\n }\n\n if (prev.tilePositionY !== next.tilePositionY && typeof next.tilePositionY === 'number') {\n tileSprite.tilePositionY = next.tilePositionY\n }\n\n if (prev.tileScaleX !== next.tileScaleX && typeof next.tileScaleX === 'number') {\n tileSprite.tileScaleX = next.tileScaleX\n }\n\n if (prev.tileScaleY !== next.tileScaleY && typeof next.tileScaleY === 'number') {\n tileSprite.tileScaleY = next.tileScaleY\n }\n\n if (prev.tint !== next.tint) {\n if (typeof next.tint === 'number') {\n tileSprite.setTint(next.tint)\n } else {\n tileSprite.clearTint()\n }\n }\n\n if (prev.originX !== next.originX || prev.originY !== next.originY) {\n tileSprite.setOrigin(next.originX ?? tileSprite.originX, next.originY ?? tileSprite.originY)\n }\n}\n\n/**\n * TileSprite creator - creates a Phaser TileSprite object.\n */\nexport const tileSpriteCreator: HostCreator<'TileSprite'> = (scene, props) => {\n const tileSprite = scene.add.tileSprite(\n props.x ?? 0,\n props.y ?? 0,\n props.width,\n props.height,\n props.texture,\n props.frame\n )\n\n tileSprite.setOrigin(props.originX ?? 0, props.originY ?? 0)\n\n createTransform(tileSprite, props)\n createPhaser(tileSprite, props)\n applyTileSpriteProps(tileSprite, {}, props)\n createTileSpriteLayout(tileSprite as TileSpriteNode, props)\n\n props.onReady?.(tileSprite)\n\n return tileSprite\n}\n\n/**\n * TileSprite patcher - updates texture, size, tiling and shared display props.\n */\nexport const tileSpritePatcher: HostPatcher<'TileSprite'> = (node, prev, next) => {\n applyTransformProps(node, prev, next)\n applyPhaserProps(node, prev, next)\n applyTileSpriteProps(node, prev, next)\n\n const tileSprite = node as TileSpriteNode\n if (tileSprite.__layoutProps) {\n tileSprite.__layoutProps = next as TileSpriteBaseProps\n }\n}\n","import * as Phaser from 'phaser'\nimport type { BackgroundProps } from '../core-props'\n\nexport type BackgroundImage = Phaser.GameObjects.Image & {\n __isBackground?: boolean\n __backgroundCacheKey?: string\n __backgroundTextureKey?: string\n __backgroundTextureReleased?: boolean\n}\n\ntype BackgroundTextureCacheEntry = {\n textureKey: string\n refs: number\n}\n\nconst sceneBackgroundTextureCaches = new WeakMap<\n Phaser.Scene,\n Map<string, BackgroundTextureCacheEntry>\n>()\n\ntype CornerRadius = NonNullable<BackgroundProps['cornerRadius']>\n\nfunction hasRenderableBackground(props: Partial<BackgroundProps>): boolean {\n const hasBackground = props.backgroundColor !== undefined\n const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== undefined\n return hasBackground || hasBorder\n}\n\nfunction hasRoundedCorners(radius: CornerRadius): boolean {\n if (typeof radius === 'number') {\n return radius !== 0\n }\n\n return (\n (radius.tl ?? 0) !== 0 ||\n (radius.tr ?? 0) !== 0 ||\n (radius.bl ?? 0) !== 0 ||\n (radius.br ?? 0) !== 0\n )\n}\n\nfunction insetCornerRadius(radius: CornerRadius, inset: number): CornerRadius {\n const insetSingleRadius = (value: number | undefined): number => {\n const resolved = value ?? 0\n const sign = resolved < 0 ? -1 : 1\n return sign * Math.max(0, Math.abs(resolved) - inset)\n }\n\n if (typeof radius === 'number') {\n return insetSingleRadius(radius)\n }\n\n return {\n tl: insetSingleRadius(radius.tl),\n tr: insetSingleRadius(radius.tr),\n bl: insetSingleRadius(radius.bl),\n br: insetSingleRadius(radius.br),\n }\n}\n\nfunction drawBackground(\n graphics: Phaser.GameObjects.Graphics,\n props: Partial<BackgroundProps>,\n width: number,\n height: number\n): void {\n const bgColor = props.backgroundColor\n const bgAlpha = props.backgroundAlpha ?? 1\n const cornerRadius = props.cornerRadius ?? 0\n const borderColor = props.borderColor\n const borderWidth = props.borderWidth ?? 0\n const borderAlpha = props.borderAlpha ?? 1\n const hasBorder = borderWidth > 0 && borderColor !== undefined\n const rounded = hasRoundedCorners(cornerRadius)\n\n if (bgColor !== undefined) {\n graphics.fillStyle(bgColor, bgAlpha)\n }\n\n if (hasBorder) {\n graphics.lineStyle(borderWidth, borderColor, borderAlpha)\n }\n\n if (rounded) {\n if (bgColor !== undefined) {\n graphics.fillRoundedRect(0, 0, width, height, cornerRadius)\n }\n if (hasBorder) {\n const inset = borderWidth / 2\n graphics.strokeRoundedRect(\n inset,\n inset,\n Math.max(0, width - borderWidth),\n Math.max(0, height - borderWidth),\n insetCornerRadius(cornerRadius, inset)\n )\n }\n } else {\n if (bgColor !== undefined) {\n graphics.fillRect(0, 0, width, height)\n }\n if (hasBorder) {\n const inset = borderWidth / 2\n graphics.strokeRect(\n inset,\n inset,\n Math.max(0, width - borderWidth),\n Math.max(0, height - borderWidth)\n )\n }\n }\n}\n\nfunction getSceneBackgroundTextureCache(\n scene: Phaser.Scene\n): Map<string, BackgroundTextureCacheEntry> {\n let cache = sceneBackgroundTextureCaches.get(scene)\n\n if (!cache) {\n cache = new Map()\n sceneBackgroundTextureCaches.set(scene, cache)\n }\n\n return cache\n}\n\nfunction hashCacheKey(value: string): string {\n let hash = 2166136261\n\n for (let i = 0; i < value.length; i++) {\n hash ^= value.charCodeAt(i)\n hash = Math.imul(hash, 16777619)\n }\n\n return (hash >>> 0).toString(36)\n}\n\nfunction normalizeCornerRadius(radius: BackgroundProps['cornerRadius']): string {\n if (typeof radius === 'number') {\n return String(radius)\n }\n\n if (!radius) {\n return '0'\n }\n\n return `${radius.tl ?? 0},${radius.tr ?? 0},${radius.bl ?? 0},${radius.br ?? 0}`\n}\n\nexport function getBackgroundImageCacheKey(\n props: Partial<BackgroundProps>,\n width: number,\n height: number\n): string {\n const textureWidth = Math.max(1, Math.ceil(width))\n const textureHeight = Math.max(1, Math.ceil(height))\n return [\n textureWidth,\n textureHeight,\n props.backgroundColor ?? 'none',\n props.backgroundAlpha ?? 1,\n normalizeCornerRadius(props.cornerRadius),\n props.borderWidth ?? 0,\n props.borderColor ?? 'none',\n props.borderAlpha ?? 1,\n ].join('|')\n}\n\nexport function createBackgroundImage(\n scene: Phaser.Scene,\n props: Partial<BackgroundProps>,\n width: number,\n height: number\n): BackgroundImage | undefined {\n if (!hasRenderableBackground(props)) {\n return undefined\n }\n\n const textureWidth = Math.max(1, Math.ceil(width))\n const textureHeight = Math.max(1, Math.ceil(height))\n const cacheKey = getBackgroundImageCacheKey(props, textureWidth, textureHeight)\n const textureKey = `__phaserjsx_bg_${hashCacheKey(cacheKey)}`\n const cache = getSceneBackgroundTextureCache(scene)\n let entry = cache.get(cacheKey)\n\n if (!entry || !scene.textures.exists(entry.textureKey)) {\n const graphics = scene.add.graphics()\n\n drawBackground(graphics, props, textureWidth, textureHeight)\n graphics.generateTexture(textureKey, textureWidth, textureHeight)\n graphics.destroy()\n\n entry = { textureKey, refs: 0 }\n cache.set(cacheKey, entry)\n }\n\n entry.refs++\n\n const background = scene.add.image(0, 0, entry.textureKey) as BackgroundImage\n background.setOrigin(0, 0)\n background.__isBackground = true\n background.__backgroundCacheKey = cacheKey\n background.__backgroundTextureKey = entry.textureKey\n background.once('destroy', () => releaseBackgroundImageTexture(background))\n\n return background\n}\n\nfunction releaseBackgroundImageTexture(background: BackgroundImage): void {\n if (background.__backgroundTextureReleased) {\n return\n }\n\n const scene = background.scene\n const cacheKey = background.__backgroundCacheKey\n\n background.__backgroundTextureReleased = true\n\n if (!scene || !cacheKey) {\n return\n }\n\n const cache = sceneBackgroundTextureCaches.get(scene)\n const entry = cache?.get(cacheKey)\n\n if (!cache || !entry) {\n return\n }\n\n entry.refs--\n\n if (entry.refs <= 0) {\n if (scene.textures.exists(entry.textureKey)) {\n scene.textures.remove(entry.textureKey)\n }\n cache.delete(cacheKey)\n }\n}\n\nexport function destroyBackgroundImage(background: BackgroundImage): void {\n background.destroy()\n}\n","/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport * as Phaser from 'phaser'\nimport type { BackgroundProps, LayoutProps } from '../../core-props'\nimport {\n createBackgroundImage,\n destroyBackgroundImage,\n type BackgroundImage,\n} from '../backgroundImage'\n\n/**\n * Applies background properties (color, alpha, corner radius, border)\n * Handles adding, removing, and updating background graphics on containers\n * @param container - Phaser Container with potential background\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyBackgroundProps(\n container: Phaser.GameObjects.Container & {\n __background?: BackgroundImage\n __getLayoutSize?: () => { width: number; height: number }\n },\n prev: Partial<BackgroundProps & LayoutProps>,\n next: Partial<BackgroundProps & LayoutProps>\n): void {\n const prevBgColor = prev.backgroundColor\n const nextBgColor = next.backgroundColor\n const prevBgAlpha = prev.backgroundAlpha ?? 1\n const nextBgAlpha = next.backgroundAlpha ?? 1\n\n // Get actual layout size if available, fall back to props\n let prevWidth = typeof prev.width === 'number' ? prev.width : 100\n let prevHeight = typeof prev.height === 'number' ? prev.height : 100\n let nextWidth = typeof next.width === 'number' ? next.width : 100\n let nextHeight = typeof next.height === 'number' ? next.height : 100\n\n // Use actual layout size if available (for auto-sized or calculated dimensions)\n if (container.__getLayoutSize) {\n const layoutSize = container.__getLayoutSize()\n prevWidth = layoutSize.width\n prevHeight = layoutSize.height\n nextWidth = layoutSize.width\n nextHeight = layoutSize.height\n }\n\n const prevCornerRadius = prev.cornerRadius ?? 0\n const nextCornerRadius = next.cornerRadius ?? 0\n const prevBorderColor = prev.borderColor\n const nextBorderColor = next.borderColor\n const prevBorderWidth = prev.borderWidth ?? 0\n const nextBorderWidth = next.borderWidth ?? 0\n const prevBorderAlpha = prev.borderAlpha ?? 1\n const nextBorderAlpha = next.borderAlpha ?? 1\n\n const prevHasBorder = prevBorderWidth > 0 && prevBorderColor !== undefined\n const nextHasBorder = nextBorderWidth > 0 && nextBorderColor !== undefined\n const prevHasGraphics = prevBgColor !== undefined || prevHasBorder\n const nextHasGraphics = nextBgColor !== undefined || nextHasBorder\n\n if (prevHasGraphics && !nextHasGraphics) {\n if (container.__background) {\n destroyBackgroundImage(container.__background)\n delete container.__background\n }\n } else if (!prevHasGraphics && nextHasGraphics) {\n if (container.scene) {\n const background = createBackgroundImage(container.scene, next, nextWidth, nextHeight)\n\n if (!background) return\n\n container.addAt(background, 0)\n container.__background = background\n }\n } else if (container.__background && nextHasGraphics) {\n const needsRedraw =\n prevBgColor !== nextBgColor ||\n prevBgAlpha !== nextBgAlpha ||\n prevWidth !== nextWidth ||\n prevHeight !== nextHeight ||\n prevCornerRadius !== nextCornerRadius ||\n prevBorderWidth !== nextBorderWidth ||\n prevBorderColor !== nextBorderColor ||\n prevBorderAlpha !== nextBorderAlpha\n\n if (needsRedraw) {\n const oldBackground = container.__background\n const background = createBackgroundImage(container.scene, next, nextWidth, nextHeight)\n\n if (!background) return\n\n container.addAt(background, 0)\n container.__background = background\n destroyBackgroundImage(oldBackground)\n }\n }\n}\n","/**\n * Type definitions for the gesture system\n */\nimport type * as Phaser from 'phaser'\n\n/**\n * Touch move gesture state\n */\nexport type TouchMoveState = 'start' | 'move' | 'end'\n\n/**\n * Data passed to keyboard event handlers\n */\nexport interface KeyboardEventData {\n /** The original DOM keyboard event */\n event: KeyboardEvent\n /** The key value of the key represented by the event */\n key: string\n /** The code value of the physical key */\n code: string\n /** Whether the Alt key was pressed */\n altKey: boolean\n /** Whether the Ctrl key was pressed */\n ctrlKey: boolean\n /** Whether the Shift key was pressed */\n shiftKey: boolean\n /** Whether the Meta key (Cmd/Win) was pressed */\n metaKey: boolean\n /** Whether this is a repeat event (key held down) */\n repeat: boolean\n\n /**\n * Prevent default browser behavior\n */\n preventDefault(): void\n\n /**\n * Stop event propagation\n */\n stopPropagation(): void\n}\n\n/**\n * Data passed to input event handlers\n */\nexport interface InputEventData {\n /** The current value of the input */\n value: string\n /** The original DOM input event */\n event: Event\n\n /**\n * Prevent default browser behavior\n */\n preventDefault(): void\n\n /**\n * Stop event propagation\n */\n stopPropagation(): void\n}\n\n/**\n * Data passed to focus/blur event handlers\n */\nexport interface FocusEventData {\n /** The original DOM focus event */\n event: FocusEvent\n\n /**\n * Prevent default browser behavior\n */\n preventDefault(): void\n\n /**\n * Stop event propagation\n */\n stopPropagation(): void\n}\n\n/**\n * Data passed to hover event handlers (desktop/mouse only)\n */\nexport interface HoverEventData {\n /** The Phaser pointer that triggered the event */\n pointer: Phaser.Input.Pointer\n /** Local X coordinate relative to container origin (0,0) */\n localX: number\n /** Local Y coordinate relative to container origin (0,0) */\n localY: number\n /** Width of the container's hit area */\n width: number\n /** Height of the container's hit area */\n height: number\n\n /**\n * Stop event propagation to parent containers\n */\n stopPropagation(): void\n\n /**\n * Check if propagation has been stopped\n * @returns true if stopPropagation() was called\n */\n isPropagationStopped(): boolean\n}\n\n/**\n * Data passed to wheel event handlers (desktop/mouse only)\n */\nexport interface WheelEventData {\n /** The Phaser pointer at the time of the wheel event */\n pointer: Phaser.Input.Pointer\n /** Local X coordinate relative to container origin (0,0) */\n localX: number\n /** Local Y coordinate relative to container origin (0,0) */\n localY: number\n /** Wheel scroll delta X (horizontal scrolling) */\n deltaX: number\n /** Wheel scroll delta Y (vertical scrolling) */\n deltaY: number\n /** Wheel scroll delta Z (some mice) */\n deltaZ: number\n /** Delta mode: 0 = pixels, 1 = lines, 2 = pages */\n deltaMode: number\n /** Width of the container's hit area */\n width: number\n /** Height of the container's hit area */\n height: number\n /** Original DOM wheel event */\n originalEvent: WheelEvent\n\n /**\n * Stop event propagation to parent containers\n */\n stopPropagation(): void\n\n /**\n * Check if propagation has been stopped\n * @returns true if stopPropagation() was called\n */\n isPropagationStopped(): boolean\n\n /**\n * Prevent default browser behavior (e.g., page scroll)\n */\n preventDefault(): void\n}\n\n/**\n * Data passed to gesture event handlers\n * Supports DOM-style event propagation control\n */\nexport interface GestureEventData {\n /** The Phaser pointer that triggered the event */\n pointer: Phaser.Input.Pointer\n /** Local X coordinate relative to container origin (0,0) */\n localX: number\n /** Local Y coordinate relative to container origin (0,0) */\n localY: number\n /** Delta X since last move event (only for onTouchMove) */\n dx?: number\n /** Delta Y since last move event (only for onTouchMove) */\n dy?: number\n /** Width of the container's hit area */\n width: number\n /** Height of the container's hit area */\n height: number\n /** Whether pointer is currently inside the container hit area */\n isInside?: boolean\n /** Current state of touch move gesture: 'start' (first move), 'move' (during), 'end' (pointer up) (only for onTouchMove) */\n state?: TouchMoveState\n\n /**\n * Stop event propagation to parent containers\n * Similar to DOM's event.stopPropagation()\n * Default behavior: events bubble up to parent containers\n */\n stopPropagation(): void\n\n /**\n * Check if propagation has been stopped\n * @returns true if stopPropagation() was called\n */\n isPropagationStopped(): boolean\n}\n\n/**\n * Callback functions for gesture events\n */\nexport interface GestureCallbacks {\n /** Called on pointer down + up on the same target (click/tap) */\n onTouch?: (data: GestureEventData) => void\n /** Called when pointer up occurs outside the container (for click-outside detection) */\n onTouchOutside?: (data: GestureEventData) => void\n /** Called during pointer movement - continues even when outside bounds */\n onTouchMove?: (data: GestureEventData) => void\n /** Called when double tap/click is detected */\n onDoubleTap?: (data: GestureEventData) => void\n /** Called when pointer is held down for configured duration */\n onLongPress?: (data: GestureEventData) => void\n /** Called when a key is pressed down */\n onKeyDown?: (data: KeyboardEventData) => void\n /** Called when a key is released */\n onKeyUp?: (data: KeyboardEventData) => void\n /** Called when input value changes */\n onInput?: (data: InputEventData) => void\n /** Called when element receives focus */\n onFocus?: (data: FocusEventData) => void\n /** Called when element loses focus */\n onBlur?: (data: FocusEventData) => void\n /** Called when pointer enters the container (desktop/mouse only) */\n onHoverStart?: (data: HoverEventData) => void\n /** Called when pointer exits the container (desktop/mouse only) */\n onHoverEnd?: (data: HoverEventData) => void\n /** Called when mouse wheel is scrolled over container (desktop/mouse only) */\n onWheel?: (data: WheelEventData) => void\n}\n\n/**\n * Configuration for gesture detection\n */\nexport interface GestureConfig {\n /** Duration in ms to trigger long press (default: 500) */\n longPressDuration?: number\n /** Max time in ms between taps for double tap (default: 300) */\n doubleTapDelay?: number\n /** Max time in ms for a valid touch/click (prevents delayed touch after long hold) (default: 500) */\n maxTouchDuration?: number\n}\n\n/**\n * Default gesture configuration values\n */\nexport const DEFAULT_GESTURE_CONFIG: Required<GestureConfig> = {\n longPressDuration: 500,\n doubleTapDelay: 300,\n maxTouchDuration: 500,\n}\n\n/**\n * Internal state for tracking a registered container\n */\nexport interface GestureContainerState {\n container: Phaser.GameObjects.Container\n callbacks: GestureCallbacks\n config: Required<GestureConfig>\n hitArea: Phaser.Geom.Rectangle\n mountRootId?: number | undefined // Root ID from mountJSX to isolate different mount trees\n\n // State for gesture detection\n lastTapTime?: number | undefined\n longPressTimer?: ReturnType<typeof setTimeout> | undefined\n pointerDownPosition?: { x: number; y: number } | undefined\n pointerDownTime?: number | undefined\n longPressTriggered?: boolean | undefined\n isFirstMove?: boolean | undefined\n}\n","/**\n * Global gesture manager for high-level touch and mouse interactions\n * Uses global Phaser input events to track gestures even when pointer moves outside bounds\n */\nimport * as Phaser from 'phaser'\nimport type {\n GestureCallbacks,\n GestureConfig,\n GestureContainerState,\n GestureEventData,\n HoverEventData,\n WheelEventData,\n} from './gesture-types'\nimport { DEFAULT_GESTURE_CONFIG } from './gesture-types'\n\n// Global counter for unique mount root IDs\nlet nextMountRootId = 1\n\n/**\n * Generate unique mount root ID for mountJSX isolation\n * @returns Unique root ID\n */\nexport function generateMountRootId(): number {\n return nextMountRootId++\n}\n\n/**\n * Manager for gesture detection across all containers in a scene\n * Singleton per scene, stored in scene.data\n */\nexport class GestureManager {\n private scene: Phaser.Scene\n private containers = new Map<Phaser.GameObjects.Container, GestureContainerState>()\n\n // Track pointer positions for delta calculation\n private lastPointerPositions = new Map<number, { x: number; y: number }>()\n\n // Track active pointer down for touch detection\n private activePointerDown: {\n pointerId: number\n container: Phaser.GameObjects.Container\n touchContainer?: Phaser.GameObjects.Container\n longPressContainer?: Phaser.GameObjects.Container\n doubleTapContainer?: Phaser.GameObjects.Container\n startX: number\n startY: number\n } | null = null\n\n // Track which containers were hit during pointer down (for move event filtering)\n private activeContainersForMove = new Map<number, Set<Phaser.GameObjects.Container>>()\n\n // Track hover state for each container (desktop/mouse only)\n private hoveredContainers = new Map<Phaser.GameObjects.Container, boolean>()\n\n // Track pending setTimeout timers for cleanup\n private pendingTimeouts = new Set<number>()\n\n private isInitialized = false\n private isDestroyed = false\n\n constructor(scene: Phaser.Scene) {\n this.scene = scene\n }\n\n /**\n * Initialize global event listeners (called once per scene)\n */\n private initialize(): void {\n if (this.isInitialized) return\n this.isInitialized = true\n\n // Global pointer down - detect which container was hit\n this.scene.input.on('pointerdown', this.handlePointerDown, this)\n\n // Global pointer up - check for touch/tap completion\n this.scene.input.on('pointerup', this.handlePointerUp, this)\n\n // Global pointer move - track deltas and notify all relevant containers\n this.scene.input.on('pointermove', this.handlePointerMove, this)\n\n // Handle pointer up outside canvas (window-level events)\n // This ensures we catch pointer release even when it happens outside the game canvas\n this.handleGlobalPointerUp = this.handleGlobalPointerUp.bind(this)\n window.addEventListener('mouseup', this.handleGlobalPointerUp)\n window.addEventListener('touchend', this.handleGlobalPointerUp)\n\n // Handle mouse wheel events (desktop only)\n // Use window instead of canvas to ensure we catch all wheel events\n this.handleWheel = this.handleWheel.bind(this)\n window.addEventListener('wheel', this.handleWheel, { passive: false })\n\n // Cleanup on scene shutdown\n this.scene.events.once('shutdown', this.destroy, this)\n }\n\n /**\n * Register a container for gesture tracking\n * @param container - Container to track\n * @param callbacks - Gesture event callbacks\n * @param hitArea - Interactive hit area\n * @param config - Gesture configuration\n */\n registerContainer(\n container: Phaser.GameObjects.Container,\n callbacks: GestureCallbacks,\n hitArea: Phaser.Geom.Rectangle,\n config: GestureConfig = {}\n ): void {\n this.initialize()\n\n const state: GestureContainerState = {\n container,\n callbacks,\n config: { ...DEFAULT_GESTURE_CONFIG, ...config },\n hitArea,\n }\n\n this.containers.set(container, state)\n\n // Cleanup when container is destroyed\n container.once('destroy', () => {\n this.unregisterContainer(container)\n })\n }\n\n /**\n * Unregister a container\n * @param container - Container to remove\n */\n unregisterContainer(container: Phaser.GameObjects.Container): void {\n const state = this.containers.get(container)\n if (!state) return\n\n // Clear any pending timers\n if (state.longPressTimer) {\n clearTimeout(state.longPressTimer)\n }\n\n this.containers.delete(container)\n\n // If this was the active pointer down target, clear it\n if (this.activePointerDown?.container === container) {\n this.activePointerDown = null\n }\n\n // Clear hover state\n this.hoveredContainers.delete(container)\n\n // Remove from active move tracking\n for (const hitContainers of this.activeContainersForMove.values()) {\n hitContainers.delete(container)\n }\n }\n\n /**\n * Check if a container is registered\n * @param container - Container to check\n * @returns True if container is registered\n */\n hasContainer(container: Phaser.GameObjects.Container): boolean {\n return this.containers.has(container)\n }\n\n /**\n * Create a gesture event data object with propagation control\n * @param pointer - Phaser pointer\n * @param localX - Local X coordinate\n * @param localY - Local Y coordinate\n * @param width - Hit area width\n * @param height - Hit area height\n * @param options - Optional additional data (dx, dy, isInside, state)\n * @returns Event data with stopPropagation support\n */\n private createEventData(\n pointer: Phaser.Input.Pointer,\n localX: number,\n localY: number,\n width: number,\n height: number,\n options: {\n dx?: number\n dy?: number\n isInside?: boolean\n state?: 'start' | 'move' | 'end'\n } = {}\n ): GestureEventData {\n let propagationStopped = false\n\n return {\n pointer,\n localX,\n localY,\n width,\n height,\n ...options,\n stopPropagation() {\n propagationStopped = true\n },\n isPropagationStopped() {\n return propagationStopped\n },\n }\n }\n\n /**\n * Get effective depth considering entire parent hierarchy\n * @param container - Container to calculate depth for\n * @returns Accumulated depth from container and all parents\n */\n private getEffectiveDepth(container: Phaser.GameObjects.Container): number {\n let depth = container.depth\n let parent = container.parentContainer\n\n // Walk up parent chain and accumulate depths\n while (parent) {\n depth += parent.depth\n parent = parent.parentContainer\n }\n\n return depth\n }\n\n /**\n * Get mount root ID from container hierarchy\n * Walks up to find the topmost container with __mountRootId\n * @param container - Container to check\n * @returns Mount root ID or 0 if none found\n */\n private getRootId(container: Phaser.GameObjects.Container): number {\n let current: Phaser.GameObjects.Container | null = container\n let rootId = 0\n\n while (current) {\n const id = (current as unknown as { __mountRootId?: number }).__mountRootId\n if (id !== undefined) {\n rootId = id\n }\n current = current.parentContainer\n }\n\n return rootId\n }\n\n /**\n * Bubble an event through overlapping containers\n * Iterates all containers at pointer position and calls handler until stopPropagation\n * Sorts containers by their actual display list order (z-index) to respect visual stacking\n * @param pointer - The pointer that triggered the event\n * @param eventType - Type of event for filtering callbacks\n * @param handler - Function to call for each container, returns true if propagation stopped\n * @param filterSet - Optional set of containers to limit bubbling to (for move events)\n * @param skipContainerCheck - Skip the isPointerInContainer check (for final move events)\n */\n private bubbleEvent(\n pointer: Phaser.Input.Pointer,\n eventType: keyof GestureCallbacks,\n handler: (state: GestureContainerState, localPos: { x: number; y: number }) => boolean | void,\n filterSet?: Set<Phaser.GameObjects.Container>,\n skipContainerCheck = false\n ): void {\n // Get all containers at pointer position with their original indices\n const containersArray = Array.from(this.containers.values()).map((state, originalIndex) => ({\n state,\n originalIndex,\n }))\n\n // Sort by: 1) mountRootId (higher = on top), 2) effective depth, 3) display list order\n // This ensures different mountJSX trees are properly isolated\n containersArray.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs (higher = mounted later = on top)\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA // Higher root ID first\n }\n\n // Second: Compare effective depths (accumulated from parent hierarchy)\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA // Higher depth first\n }\n\n // Third: If they share the same parent, compare their indices in the parent's display list\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA // Higher index first (topmost)\n\n // If display list indices are equal, preserve original registration order\n if (diff !== 0) return diff\n }\n\n // Fall back to original registration order (reverse for topmost first)\n return b.originalIndex - a.originalIndex\n })\n\n for (const { state } of containersArray) {\n // Only process containers that have the callback for this event type\n if (!state.callbacks[eventType]) continue\n\n // If filterSet provided, only process containers in the set\n if (filterSet && !filterSet.has(state.container)) continue\n\n // Check if pointer is within this container (unless skipContainerCheck is true)\n if (!skipContainerCheck && !this.isPointerInContainer(pointer, state)) continue\n\n // Calculate local position\n const localPos = this.getLocalPosition(pointer, state.container)\n\n // Call handler and check if propagation was stopped\n const stopped = handler(state, localPos)\n if (stopped) break\n }\n }\n\n /**\n * Update hit area for a container\n * @param container - Container to update\n * @param hitArea - New hit area\n */\n updateHitArea(container: Phaser.GameObjects.Container, hitArea: Phaser.Geom.Rectangle): void {\n const state = this.containers.get(container)\n if (state) {\n state.hitArea = hitArea\n }\n }\n\n /**\n * Update callbacks for a container\n * @param container - Container to update\n * @param callbacks - New callbacks\n */\n updateCallbacks(container: Phaser.GameObjects.Container, callbacks: GestureCallbacks): void {\n const state = this.containers.get(container)\n if (state) {\n state.callbacks = callbacks\n }\n }\n\n /**\n * Handle global pointer down event\n * Registers all containers that were hit for move event tracking\n * Only the topmost gets touch/long-press callbacks\n */\n private handlePointerDown(pointer: Phaser.Input.Pointer): void {\n // Create set to track all hit containers for this pointer\n const hitContainers = new Set<Phaser.GameObjects.Container>()\n\n // Find which containers were hit\n // Sort by: 1) mountRootId, 2) effective depth, 3) display list order\n const containersArray = Array.from(this.containers.values()).map((state, originalIndex) => ({\n state,\n originalIndex,\n }))\n containersArray.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA\n }\n\n // Second: Compare effective depths\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA\n }\n\n // Third: Compare display list indices if same parent\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA // Higher index first (topmost)\n\n // If display list indices are equal, preserve original registration order\n if (diff !== 0) return diff\n }\n\n // Fall back to original registration order (reverse for topmost first)\n return b.originalIndex - a.originalIndex\n })\n\n let isFirstHit = true\n let topmostTouchContainer: Phaser.GameObjects.Container | undefined\n let topmostLongPressContainer: Phaser.GameObjects.Container | undefined\n let topmostDoubleTapContainer: Phaser.GameObjects.Container | undefined\n const pointerDownTime = Date.now()\n\n for (const { state } of containersArray) {\n const isHit = this.isPointerInContainer(pointer, state)\n if (isHit) {\n // Add to hit set (for move event filtering)\n hitContainers.add(state.container)\n\n // Track topmost containers per gesture type\n if (!topmostTouchContainer && state.callbacks.onTouch) {\n topmostTouchContainer = state.container\n state.pointerDownTime = pointerDownTime\n state.longPressTriggered = false\n }\n if (!topmostLongPressContainer && state.callbacks.onLongPress) {\n topmostLongPressContainer = state.container\n state.pointerDownTime = pointerDownTime\n state.longPressTriggered = false\n }\n if (!topmostDoubleTapContainer && state.callbacks.onDoubleTap) {\n topmostDoubleTapContainer = state.container\n state.pointerDownTime = pointerDownTime\n state.longPressTriggered = false\n }\n\n // Only the first (topmost) hit gets touch/long-press handling\n if (isFirstHit) {\n isFirstHit = false\n\n // Store active pointer down for touch detection\n this.activePointerDown = {\n pointerId: pointer.id,\n container: state.container,\n startX: pointer.worldX,\n startY: pointer.worldY,\n }\n\n if (topmostTouchContainer) {\n this.activePointerDown.touchContainer = topmostTouchContainer\n }\n if (topmostLongPressContainer) {\n this.activePointerDown.longPressContainer = topmostLongPressContainer\n }\n if (topmostDoubleTapContainer) {\n this.activePointerDown.doubleTapContainer = topmostDoubleTapContainer\n }\n\n // Store down position for tracking\n state.pointerDownPosition = { x: pointer.worldX, y: pointer.worldY }\n }\n }\n }\n\n // Update active pointer with final topmost gesture targets (in case first hit had none)\n if (this.activePointerDown) {\n if (topmostTouchContainer) {\n this.activePointerDown.touchContainer = topmostTouchContainer\n }\n if (topmostLongPressContainer) {\n this.activePointerDown.longPressContainer = topmostLongPressContainer\n }\n if (topmostDoubleTapContainer) {\n this.activePointerDown.doubleTapContainer = topmostDoubleTapContainer\n }\n }\n\n // Start long press timer on the topmost container that actually has onLongPress\n if (topmostLongPressContainer) {\n const longPressState = this.containers.get(topmostLongPressContainer)\n if (longPressState?.callbacks.onLongPress) {\n const localPos = this.getLocalPosition(pointer, longPressState.container)\n\n longPressState.longPressTimer = setTimeout(() => {\n if (this.activePointerDown?.longPressContainer === longPressState.container) {\n const isInside = this.isPointerInContainer(pointer, longPressState)\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n longPressState.hitArea.width,\n longPressState.hitArea.height,\n { isInside }\n )\n longPressState.callbacks.onLongPress?.(data)\n\n // Mark that long press was triggered to prevent onTouch/onDoubleTap\n longPressState.longPressTriggered = true\n }\n }, longPressState.config.longPressDuration)\n }\n }\n\n // Store hit containers for move event filtering\n if (hitContainers.size > 0) {\n this.activeContainersForMove.set(pointer.id, hitContainers)\n\n // Send initial onTouchMove with 'start' state to all hit containers\n this.bubbleEvent(\n pointer,\n 'onTouchMove',\n (targetState, targetLocalPos) => {\n const isInside = this.isPointerInContainer(pointer, targetState)\n const data = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { dx: 0, dy: 0, isInside, state: 'start' }\n )\n targetState.callbacks.onTouchMove?.(data)\n\n // Mark that first move has been sent\n targetState.isFirstMove = false\n\n return data.isPropagationStopped()\n },\n hitContainers\n )\n }\n }\n\n /**\n * Handle global pointer up event\n */\n private handlePointerUp(pointer: Phaser.Input.Pointer): void {\n if (!this.activePointerDown || this.activePointerDown.pointerId !== pointer.id) {\n return\n }\n\n const activeState = this.containers.get(this.activePointerDown.container)\n if (!activeState) {\n this.activePointerDown = null\n return\n }\n\n const touchState =\n (this.activePointerDown.touchContainer &&\n this.containers.get(this.activePointerDown.touchContainer)) ||\n activeState\n const longPressState =\n this.activePointerDown.longPressContainer &&\n this.containers.get(this.activePointerDown.longPressContainer)\n const doubleTapState =\n this.activePointerDown.doubleTapContainer &&\n this.containers.get(this.activePointerDown.doubleTapContainer)\n\n // Clear long press timer on the actual long-press target\n if (longPressState?.longPressTimer) {\n clearTimeout(longPressState.longPressTimer)\n longPressState.longPressTimer = undefined\n }\n\n const now = Date.now()\n const touchDuration = touchState.pointerDownTime ? now - touchState.pointerDownTime : 0\n const isTouchTooLong = touchDuration > touchState.config.maxTouchDuration\n const longPressWasTriggered =\n !!touchState.longPressTriggered || !!longPressState?.longPressTriggered\n\n // Send final move event to containers that were hit during pointer down\n const last = this.lastPointerPositions.get(pointer.id)\n const dx = last ? pointer.worldX - last.x : 0\n const dy = last ? pointer.worldY - last.y : 0\n const hitContainers = this.activeContainersForMove.get(pointer.id)\n\n this.bubbleEvent(\n pointer,\n 'onTouchMove',\n (targetState, targetLocalPos) => {\n const isInside = this.isPointerInContainer(pointer, targetState)\n const finalMoveData = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { dx, dy, isInside, state: 'end' }\n )\n targetState.callbacks.onTouchMove?.(finalMoveData)\n\n // Reset first move flag for this container\n targetState.isFirstMove = undefined\n\n return finalMoveData.isPropagationStopped()\n },\n hitContainers,\n true // Skip container check for final move event\n )\n\n // Check if pointer is still within the container (basic tap/click detection)\n const isInsideTouchTarget = this.isPointerInContainer(pointer, touchState)\n\n if (isInsideTouchTarget) {\n // Fire onTouch only if:\n // - Long press wasn't triggered\n // - Touch duration is within acceptable range (not held too long)\n const shouldFireTouch = !longPressWasTriggered && !isTouchTooLong\n\n // Bubble onTouch event to parent containers\n if (touchState.callbacks.onTouch && shouldFireTouch) {\n this.bubbleEvent(pointer, 'onTouch', (targetState, targetLocalPos) => {\n const isInside = this.isPointerInContainer(pointer, targetState)\n const data = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { isInside }\n )\n targetState.callbacks.onTouch?.(data)\n return data.isPropagationStopped()\n })\n }\n\n // Check for double tap (also skip if touch was too long)\n if (doubleTapState && shouldFireTouch && this.isPointerInContainer(pointer, doubleTapState)) {\n const timeSinceLastTap = doubleTapState.lastTapTime\n ? now - doubleTapState.lastTapTime\n : Infinity\n\n if (timeSinceLastTap <= doubleTapState.config.doubleTapDelay) {\n this.bubbleEvent(pointer, 'onDoubleTap', (targetState, targetLocalPos) => {\n const isInside = this.isPointerInContainer(pointer, targetState)\n const data = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { isInside }\n )\n targetState.callbacks.onDoubleTap?.(data)\n return data.isPropagationStopped()\n })\n doubleTapState.lastTapTime = undefined // Reset to prevent triple-tap\n } else {\n doubleTapState.lastTapTime = now\n }\n }\n }\n\n // Fire onTouchOutside for ALL containers where pointer is outside\n for (const [container, containerState] of this.containers) {\n if (!containerState.callbacks.onTouchOutside) continue\n\n const isInsideContainer = this.isPointerInContainer(pointer, containerState)\n if (isInsideContainer) continue // Skip if pointer is inside\n\n // Fire onTouchOutside - no touch duration check needed for outside clicks\n const localPos = this.getLocalPosition(pointer, container)\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n containerState.hitArea.width,\n containerState.hitArea.height,\n { isInside: false }\n )\n containerState.callbacks.onTouchOutside(data)\n }\n\n // Reset state\n touchState.longPressTriggered = false\n touchState.pointerDownTime = undefined\n if (longPressState && longPressState !== touchState) {\n longPressState.longPressTriggered = false\n longPressState.pointerDownTime = undefined\n }\n if (doubleTapState && doubleTapState !== touchState && doubleTapState !== longPressState) {\n doubleTapState.longPressTriggered = false\n doubleTapState.pointerDownTime = undefined\n }\n\n this.activePointerDown = null\n activeState.pointerDownPosition = undefined\n\n // Clear active containers for move tracking\n this.activeContainersForMove.delete(pointer.id)\n }\n\n /**\n * Handle pointer up outside canvas (global window events)\n * Ensures touch move 'end' state is sent even when pointer released outside\n * Also handles onTouchOutside for ALL containers\n */\n private handleGlobalPointerUp(_event: MouseEvent | TouchEvent): void {\n // Use setTimeout to let Phaser's handlePointerUp run first (if inside canvas)\n const timerId = window.setTimeout(() => {\n // Remove timer from tracking\n this.pendingTimeouts.delete(timerId)\n\n // Guard: Check if manager is destroyed or scene is invalid\n if (this.isDestroyed || !this.scene || !this.scene.input) {\n return\n }\n\n // CRITICAL: activePointer is a getter that can throw if scene is being destroyed\n // Wrap in try-catch to handle race condition during scene destruction\n let pointer: Phaser.Input.Pointer | null = null\n try {\n pointer = this.scene.input.activePointer\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // Scene is being destroyed, silently ignore\n return\n }\n\n if (!pointer) {\n return\n }\n\n // Fire onTouchOutside for ALL containers that have the callback\n // and where the pointer is NOT inside\n for (const state of this.containers.values()) {\n if (!state.callbacks.onTouchOutside) continue\n\n const isInside = this.isPointerInContainer(pointer, state)\n if (isInside) continue // Skip if pointer is inside\n\n // Check if touch duration is valid\n const touchDuration = state.pointerDownTime ? Date.now() - state.pointerDownTime : 0\n const isTouchTooLong = touchDuration > state.config.maxTouchDuration\n const shouldFire = !state.longPressTriggered && !isTouchTooLong\n\n if (shouldFire) {\n const localPos = this.getLocalPosition(pointer, state.container)\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n state.hitArea.width,\n state.hitArea.height,\n { isInside: false }\n )\n state.callbacks.onTouchOutside?.(data)\n }\n }\n\n // If no activePointerDown, we're done\n if (!this.activePointerDown) return\n\n const state = this.containers.get(this.activePointerDown.container)\n if (!state) {\n this.activePointerDown = null\n return\n }\n\n // Clear long press timer if still pending\n if (state.longPressTimer) {\n clearTimeout(state.longPressTimer)\n state.longPressTimer = undefined\n }\n\n // Send final move event with 'end' state to all active containers\n const last = this.lastPointerPositions.get(pointer.id)\n const dx = last ? pointer.worldX - last.x : 0\n const dy = last ? pointer.worldY - last.y : 0\n const hitContainers = this.activeContainersForMove.get(pointer.id)\n\n this.bubbleEvent(\n pointer,\n 'onTouchMove',\n (targetState, targetLocalPos) => {\n const finalMoveData = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { dx, dy, isInside: false, state: 'end' }\n )\n targetState.callbacks.onTouchMove?.(finalMoveData)\n\n // Reset first move flag for this container\n targetState.isFirstMove = undefined\n\n return finalMoveData.isPropagationStopped()\n },\n hitContainers,\n true // Skip container check for final move event\n )\n\n // Reset state\n state.longPressTriggered = false\n state.pointerDownTime = undefined\n this.activePointerDown = null\n state.pointerDownPosition = undefined\n\n // Clear active containers for this pointer\n this.activeContainersForMove.delete(pointer.id)\n }, 0)\n\n // Track this timer for cleanup\n this.pendingTimeouts.add(timerId)\n }\n\n /**\n * Handle global pointer move event\n * Detects hover state changes and notifies containers with onHoverStart/onHoverEnd\n * Only notifies containers that were hit during pointer down for onTouchMove\n * Bubbles through them until stopPropagation() is called\n */\n private handlePointerMove(pointer: Phaser.Input.Pointer): void {\n // Calculate delta\n const last = this.lastPointerPositions.get(pointer.id)\n const dx = last ? pointer.worldX - last.x : 0\n const dy = last ? pointer.worldY - last.y : 0\n this.lastPointerPositions.set(pointer.id, { x: pointer.worldX, y: pointer.worldY })\n\n // Hover detection for all containers (desktop/mouse only)\n this.detectHoverChanges(pointer)\n\n // Only process touch move if there's an active pointer down\n if (!this.activePointerDown || pointer.id !== this.activePointerDown.pointerId) {\n return\n }\n\n // Get containers that were hit during pointer down\n const hitContainers = this.activeContainersForMove.get(pointer.id)\n if (!hitContainers) return\n\n // Bubble onTouchMove only to containers that were hit at pointer down\n // Sort by: 1) mountRootId, 2) effective depth, 3) display list order\n const containersArray = Array.from(this.containers.values()).map((state, originalIndex) => ({\n state,\n originalIndex,\n }))\n containersArray.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA\n }\n\n // Second: Compare effective depths\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA\n }\n\n // Third: Compare display list indices if same parent\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA // Higher index first (topmost)\n\n // If display list indices are equal, preserve original registration order\n if (diff !== 0) return diff\n }\n\n // Fall back to original registration order (reverse for topmost first)\n return b.originalIndex - a.originalIndex\n })\n\n for (const { state } of containersArray) {\n // Only process if:\n // 1. Container has onTouchMove callback\n // 2. Container was hit during pointer down\n if (!state.callbacks.onTouchMove) continue\n if (!hitContainers.has(state.container)) continue\n\n const localPos = this.getLocalPosition(pointer, state.container)\n const isInside = this.isPointerInContainer(pointer, state)\n\n // Determine state: 'start' for first move, 'move' for subsequent\n const moveState = state.isFirstMove === undefined ? 'start' : 'move'\n if (state.isFirstMove === undefined) {\n state.isFirstMove = false\n }\n\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n state.hitArea.width,\n state.hitArea.height,\n { dx, dy, isInside, state: moveState }\n )\n\n state.callbacks.onTouchMove(data)\n\n // Stop bubbling if propagation was stopped\n if (data.isPropagationStopped()) break\n }\n }\n\n /**\n * Check if pointer is within a container's hit area\n * Also checks parent visibility chain to handle collapsed accordions,\n * and ancestor overflow clip regions to prevent clipped-out children\n * from consuming pointer events outside their visible area.\n */\n private isPointerInContainer(\n pointer: Phaser.Input.Pointer,\n state: GestureContainerState\n ): boolean {\n const container = state.container\n if (!container.visible || container.alpha === 0) return false\n\n // Check parent container visibility chain\n // This prevents interaction with children in collapsed accordions\n let parent = container.parentContainer\n while (parent) {\n if (!parent.visible || parent.alpha === 0) return false\n parent = parent.parentContainer\n }\n\n // Check overflow clip ancestors: if any ancestor has overflow='hidden',\n // the pointer must be within that ancestor's bounds to register a hit.\n // This prevents scrolled-out children from consuming pointer events.\n let clipAncestor = container.parentContainer\n while (clipAncestor) {\n const ext = clipAncestor as Phaser.GameObjects.Container & {\n __layoutProps?: { overflow?: string }\n __getLayoutSize?: () => { width: number; height: number }\n }\n if (ext.__layoutProps?.overflow === 'hidden' && ext.__getLayoutSize) {\n const clipSize = ext.__getLayoutSize()\n const clipLocal = this.getLocalPosition(pointer, clipAncestor)\n if (\n clipLocal.x < 0 ||\n clipLocal.y < 0 ||\n clipLocal.x > clipSize.width ||\n clipLocal.y > clipSize.height\n ) {\n return false\n }\n }\n clipAncestor = clipAncestor.parentContainer\n }\n\n const localPos = this.getLocalPosition(pointer, container)\n return state.hitArea.contains(localPos.x, localPos.y)\n }\n\n /**\n * Convert global pointer position to container local coordinates\n */\n private getLocalPosition(\n pointer: Phaser.Input.Pointer,\n container: Phaser.GameObjects.Container\n ): { x: number; y: number } {\n // Transform world coordinates to container's local space (screen coords break under camera zoom)\n const matrix = container.getWorldTransformMatrix()\n const inverseMatrix = matrix.invert()\n\n const localPos = inverseMatrix.transformPoint(pointer.worldX, pointer.worldY)\n return { x: localPos.x, y: localPos.y }\n }\n\n /**\n * Detect hover state changes for all containers (desktop/mouse only)\n * Called on every pointer move to update hover state\n */\n private detectHoverChanges(pointer: Phaser.Input.Pointer): void {\n for (const [container, state] of this.containers) {\n // Skip if container has no hover callbacks\n if (!state.callbacks.onHoverStart && !state.callbacks.onHoverEnd) {\n continue\n }\n\n // Check if container is active and visible\n if (!container.active) continue\n\n const isInside = this.isPointerInContainer(pointer, state)\n const wasInside = this.hoveredContainers.get(container) ?? false\n\n // Hover start\n if (isInside && !wasInside) {\n this.hoveredContainers.set(container, true)\n if (state.callbacks.onHoverStart) {\n const eventData = this.createHoverEventData(pointer, container, state.hitArea)\n state.callbacks.onHoverStart(eventData)\n }\n }\n\n // Hover end\n if (!isInside && wasInside) {\n this.hoveredContainers.set(container, false)\n if (state.callbacks.onHoverEnd) {\n const eventData = this.createHoverEventData(pointer, container, state.hitArea)\n state.callbacks.onHoverEnd(eventData)\n }\n }\n }\n }\n\n /**\n * Create hover event data\n */\n private createHoverEventData(\n pointer: Phaser.Input.Pointer,\n container: Phaser.GameObjects.Container,\n hitArea: Phaser.Geom.Rectangle\n ): HoverEventData {\n const localPos = this.getLocalPosition(pointer, container)\n\n let propagationStopped = false\n\n return {\n pointer,\n localX: localPos.x,\n localY: localPos.y,\n width: hitArea.width,\n height: hitArea.height,\n stopPropagation: () => {\n propagationStopped = true\n },\n isPropagationStopped: () => propagationStopped,\n }\n }\n\n /**\n * Handle mouse wheel event\n * Bubbles to all containers under the pointer\n */\n private handleWheel(event: WheelEvent): void {\n // Guard: Check if manager is destroyed or scene is invalid\n if (this.isDestroyed || !this.scene || !this.scene.input) {\n return\n }\n\n // Get active pointer and update its position from the wheel event\n // Wrap in try-catch as activePointer getter can throw during scene destruction\n let pointer: Phaser.Input.Pointer | null = null\n try {\n pointer = this.scene.input.activePointer\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // Scene is being destroyed, silently ignore\n return\n }\n\n if (!pointer) return\n\n // Update pointer position from wheel event (it might not be at correct position)\n const canvas = this.scene.game.canvas\n const rect = canvas.getBoundingClientRect()\n const scaleX = canvas.width / rect.width\n const scaleY = canvas.height / rect.height\n pointer.x = (event.clientX - rect.left) * scaleX\n pointer.y = (event.clientY - rect.top) * scaleY\n pointer.updateWorldPoint(pointer.camera ?? this.scene.cameras.main)\n\n // Find all containers under the pointer\n const containersUnderPointer: Array<{\n state: GestureContainerState\n originalIndex: number\n }> = []\n\n Array.from(this.containers.values()).forEach((state, originalIndex) => {\n if (!state.callbacks.onWheel) return\n\n const isInside = this.isPointerInContainer(pointer, state)\n if (isInside) {\n containersUnderPointer.push({ state, originalIndex })\n }\n })\n\n // Sort by z-order (same logic as other events)\n containersUnderPointer.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA\n }\n\n // Second: Compare effective depths\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA\n }\n\n // Third: Compare display list indices if same parent\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA\n if (diff !== 0) return diff\n }\n\n return b.originalIndex - a.originalIndex\n })\n\n // Bubble wheel event through containers\n for (const { state } of containersUnderPointer) {\n const localPos = this.getLocalPosition(pointer, state.container)\n\n let propagationStopped = false\n\n const wheelData: WheelEventData = {\n pointer,\n localX: localPos.x,\n localY: localPos.y,\n deltaX: event.deltaX,\n deltaY: event.deltaY,\n deltaZ: event.deltaZ,\n deltaMode: event.deltaMode,\n width: state.hitArea.width,\n height: state.hitArea.height,\n originalEvent: event,\n stopPropagation: () => {\n propagationStopped = true\n },\n isPropagationStopped: () => propagationStopped,\n preventDefault: () => {\n event.preventDefault()\n },\n }\n\n state.callbacks.onWheel?.(wheelData)\n\n // Stop bubbling if propagation was stopped\n if (propagationStopped) break\n }\n }\n\n /**\n * Cleanup all resources\n */\n private destroy(): void {\n console.log('[GestureManager] destroy() called', {\n pendingTimeouts: this.pendingTimeouts.size,\n containers: this.containers.size,\n })\n\n // Mark as destroyed to prevent any pending callbacks from executing\n this.isDestroyed = true\n\n // Clear all pending setTimeout timers\n for (const timerId of this.pendingTimeouts) {\n clearTimeout(timerId)\n }\n this.pendingTimeouts.clear()\n\n // Clear all container timers\n for (const state of this.containers.values()) {\n if (state.longPressTimer) {\n clearTimeout(state.longPressTimer)\n }\n }\n\n this.containers.clear()\n this.lastPointerPositions.clear()\n this.activePointerDown = null\n this.hoveredContainers.clear()\n\n // Remove event listeners\n if (this.isInitialized) {\n this.scene.input.off('pointerdown', this.handlePointerDown, this)\n this.scene.input.off('pointerup', this.handlePointerUp, this)\n this.scene.input.off('pointermove', this.handlePointerMove, this)\n\n // Remove global window event listeners\n window.removeEventListener('mouseup', this.handleGlobalPointerUp)\n window.removeEventListener('touchend', this.handleGlobalPointerUp)\n\n // Remove wheel event listener\n window.removeEventListener('wheel', this.handleWheel)\n }\n\n this.isInitialized = false\n }\n}\n\n/**\n * Get or create GestureManager for a scene\n * Stored in scene.data to ensure singleton per scene\n */\nexport function getGestureManager(scene: Phaser.Scene): GestureManager {\n // Safety check: ensure scene.data exists\n if (!scene || !scene.data) {\n throw new Error('getGestureManager: Invalid scene or scene.data is undefined')\n }\n\n const key = '__gestureManager__'\n let manager = scene.data.get(key) as GestureManager | undefined\n\n if (!manager) {\n manager = new GestureManager(scene)\n scene.data.set(key, manager)\n }\n\n return manager\n}\n","/**\n * Gesture property appliers for component patching\n * Updates gesture registration when props change\n */\nimport type { LayoutSize } from '@number10/phaserjsx/layout'\nimport * as Phaser from 'phaser'\nimport type { GestureProps, LayoutProps } from '../../core-props'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport type { GestureCallbacks } from '../../gestures/gesture-types'\n\n/**\n * Applies gesture properties when props change\n * Handles enabling/disabling gestures, updating callbacks, and hit area changes\n * @param scene - Scene containing the gesture manager\n * @param container - Phaser Container to update gestures on\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyGesturesProps(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n prev: Partial<GestureProps & LayoutProps>,\n next: Partial<GestureProps & LayoutProps>\n): void {\n // Safety check: ensure scene is valid and not destroyed\n // Note: We skip isActive() check because multiple scenes can coexist (e.g., in docs-site)\n // where only one is \"active\" at a time, but all need functional gesture management\n if (!scene || !scene.sys || !scene.data) {\n console.warn('applyGesturesProps: Invalid scene or scene not initialized')\n return\n }\n\n // Only skip if scene's game instance is null (scene being destroyed)\n if (scene.sys.game === null) {\n return\n }\n\n const hasAnyGesture = !!(\n next.onTouch ||\n next.onTouchOutside ||\n next.onTouchMove ||\n next.onDoubleTap ||\n next.onLongPress ||\n next.onHoverStart ||\n next.onHoverEnd ||\n next.onWheel\n )\n const hadAnyGesture = !!(\n prev.onTouch ||\n prev.onTouchOutside ||\n prev.onTouchMove ||\n prev.onDoubleTap ||\n prev.onLongPress ||\n prev.onHoverStart ||\n prev.onHoverEnd ||\n prev.onWheel\n )\n\n // Auto-enable if callbacks present, unless explicitly disabled\n const prevEnabled = hadAnyGesture && prev.enableGestures !== false\n const nextEnabled = hasAnyGesture && next.enableGestures !== false\n\n const manager = getGestureManager(scene)\n\n // Case 1: Gestures newly enabled\n if (!prevEnabled && nextEnabled && hasAnyGesture) {\n // Register for the first time\n // Use __getLayoutSize for actual calculated dimensions\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n const { width, height } = containerWithLayout.__getLayoutSize\n ? containerWithLayout.__getLayoutSize()\n : (() => {\n const bounds = container.getBounds()\n return { width: bounds.width || 100, height: bounds.height || 100 }\n })()\n\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n const callbacks: GestureCallbacks = {}\n if (next.onTouch) callbacks.onTouch = next.onTouch\n if (next.onTouchOutside) callbacks.onTouchOutside = next.onTouchOutside\n if (next.onTouchMove) callbacks.onTouchMove = next.onTouchMove\n if (next.onDoubleTap) callbacks.onDoubleTap = next.onDoubleTap\n if (next.onLongPress) callbacks.onLongPress = next.onLongPress\n if (next.onHoverStart) callbacks.onHoverStart = next.onHoverStart\n if (next.onHoverEnd) callbacks.onHoverEnd = next.onHoverEnd\n if (next.onWheel) callbacks.onWheel = next.onWheel\n\n const config: { longPressDuration?: number; doubleTapDelay?: number } = {}\n if (next.longPressDuration !== undefined) config.longPressDuration = next.longPressDuration\n if (next.doubleTapDelay !== undefined) config.doubleTapDelay = next.doubleTapDelay\n\n manager.registerContainer(container, callbacks, hitArea, config)\n return\n }\n\n // Case 2: Gestures disabled or no callbacks\n if (prevEnabled && (!nextEnabled || !hasAnyGesture)) {\n manager.unregisterContainer(container)\n return\n }\n\n // Case 3: Gestures still enabled, update callbacks/hit area\n if (nextEnabled && hasAnyGesture) {\n // Update callbacks if any changed\n const callbacksChanged =\n prev.onTouch !== next.onTouch ||\n prev.onTouchOutside !== next.onTouchOutside ||\n prev.onTouchMove !== next.onTouchMove ||\n prev.onDoubleTap !== next.onDoubleTap ||\n prev.onLongPress !== next.onLongPress ||\n prev.onHoverStart !== next.onHoverStart ||\n prev.onHoverEnd !== next.onHoverEnd ||\n prev.onWheel !== next.onWheel\n\n if (callbacksChanged) {\n const callbacks: GestureCallbacks = {}\n if (next.onTouch) callbacks.onTouch = next.onTouch\n if (next.onTouchOutside) callbacks.onTouchOutside = next.onTouchOutside\n if (next.onTouchMove) callbacks.onTouchMove = next.onTouchMove\n if (next.onDoubleTap) callbacks.onDoubleTap = next.onDoubleTap\n if (next.onLongPress) callbacks.onLongPress = next.onLongPress\n if (next.onHoverStart) callbacks.onHoverStart = next.onHoverStart\n if (next.onHoverEnd) callbacks.onHoverEnd = next.onHoverEnd\n if (next.onWheel) callbacks.onWheel = next.onWheel\n\n manager.updateCallbacks(container, callbacks)\n }\n\n // Always update hit area when gestures are enabled\n // This ensures animated size changes (overlayHeight.value) are reflected\n // Use __getLayoutSize for actual calculated dimensions\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n const { width, height } = containerWithLayout.__getLayoutSize\n ? containerWithLayout.__getLayoutSize()\n : (() => {\n const bounds = container.getBounds()\n return { width: bounds.width || 100, height: bounds.height || 100 }\n })()\n\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n manager.updateHitArea(container, hitArea)\n }\n}\n","/**\n * Core prop type definitions for shared component properties\n * These prop groups can be composed to build component-specific props\n */\n\n// Import gesture types first so they can be used in GestureProps\nimport type {\n FocusEventData,\n GestureEventData,\n InputEventData,\n KeyboardEventData,\n TouchMoveState,\n WheelEventData,\n} from './gestures/gesture-types'\n\n// Re-export for public API\nexport type {\n FocusEventData,\n GestureEventData,\n InputEventData,\n KeyboardEventData,\n TouchMoveState,\n WheelEventData,\n}\n\n/**\n * Valid CSS-like size values with type safety\n * - Fixed pixels: number or \"20px\"\n * - Percentage: \"50%\", \"100%\"\n * - Viewport units: \"100vw\", \"50vh\"\n * - Keywords: \"auto\", \"fill\"\n * - Calc expressions: \"calc(100% - 20px)\"\n */\nexport type SizeValue =\n | number\n | 'auto'\n | 'fill'\n | `${number}%`\n | `${number}px`\n | `${number}vw`\n | `${number}vh`\n | `calc(${string})`\n\n/**\n * Flex basis size values (subset of SizeValue, no \"fill\" keyword)\n * - Fixed pixels: number or \"20px\"\n * - Percentage: \"50%\", \"100%\"\n * - Viewport units: \"100vw\", \"50vh\"\n * - Keyword: \"auto\"\n * - Calc expressions: \"calc(50% + 10px)\"\n */\nexport type FlexBasisValue =\n | number\n | 'auto'\n | `${number}%`\n | `${number}px`\n | `${number}vw`\n | `${number}vh`\n | `calc(${string})`\n\n/**\n * Display mode for visibility control\n * - 'visible': Rendered and takes up layout space (default)\n * - 'invisible': Not rendered but takes up layout space (like CSS visibility: hidden)\n * - 'none': Not rendered and does not take up layout space (like CSS display: none)\n */\nexport type Display = 'visible' | 'invisible' | 'none'\n\n/**\n * Transform properties - geometric transformations (position, rotation, scale)\n */\nexport interface TransformProps {\n x?: number\n y?: number\n rotation?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n}\n\n/**\n * Phaser GameObject display properties - rendering and display list API\n */\nexport interface PhaserProps {\n /**\n * Alpha transparency of the game object\n * - 0: Fully transparent\n * - 1: Fully opaque\n */\n alpha?: number\n\n /**\n * Depth (Z-index) of the game object in the display list\n * Higher values are rendered on top of lower values\n * Allows manual control over rendering order independent of child array order\n *\n * @example\n * // Layer system in stack layout\n * <View direction=\"stack\">\n * <View depth={1}>Background</View>\n * <View depth={2}>Content</View>\n * <View depth={3}>Overlay</View>\n * </View>\n */\n depth?: number\n\n /**\n * Callback invoked when GameObject is created and fully initialized\n * Useful for accessing GameObject properties (dimensions, bounds, etc.)\n * without needing useRef\n *\n * @param node - The created Phaser GameObject\n *\n * @example\n * // Display image dimensions\n * <Image\n * texture=\"icon\"\n * onReady={(img) => console.log(`${img.width}x${img.height}`)}\n * />\n *\n * // Access View bounds\n * <View\n * width={200}\n * height={100}\n * onReady={(view) => console.log(view.getBounds())}\n * />\n */\n onReady?: (node: Phaser.GameObjects.GameObject) => void\n\n /**\n * Tooltip configuration callback (desktop/mouse only)\n * Called when hover starts to determine tooltip configuration\n * Return null/undefined to disable tooltip\n * Return string as shortcut for { content: string }\n *\n * Note: Tooltips only work on desktop/mouse devices, not on touch devices (iPhone, iPad)\n *\n * @returns Tooltip configuration, string, or null to disable\n *\n * @example\n * // Simple text tooltip\n * <Button onTooltip={() => \"Click to delete\"} />\n *\n * // With i18n/translation\n * <Button onTooltip={() => t('buttons.delete')} />\n *\n * // Conditional tooltip\n * <Button onTooltip={() => isAdmin ? \"Admin action\" : null} />\n *\n * // Full configuration\n * <Button onTooltip={() => ({\n * content: \"Delete item\",\n * position: \"top\",\n * showDelay: 100\n * })} />\n *\n * // From repository/API\n * <Button onTooltip={() => tooltipRepo.get('delete-btn')} />\n */\n onTooltip?: import('./tooltip/tooltip-types').TooltipCallback\n}\n\n/**\n * Edge insets for margins and padding\n */\nexport interface EdgeInsets {\n top?: number\n right?: number\n bottom?: number\n left?: number\n}\n\n/**\n * Gap insets for horizontal and vertical gaps\n */\nexport interface GapInsets {\n horizontal?: number\n vertical?: number\n}\n\n/**\n * Corner radius specification\n */\nexport interface CornerRadiusInsets {\n tl?: number\n tr?: number\n bl?: number\n br?: number\n}\n\n/**\n * Normalize edge insets - converts number to all-sides object\n * @param value - Number (all sides) or edge insets object\n * @returns Normalized EdgeInsets object\n */\nexport function normalizeEdgeInsets(value: number | EdgeInsets | undefined): EdgeInsets {\n if (value === undefined) {\n return {}\n }\n if (typeof value === 'number') {\n return { top: value, right: value, bottom: value, left: value }\n }\n return value\n}\n\n/**\n * Normalize corner radius - converts number to all-corners object\n * @param value - Number (all corners) or corner radius object\n * @returns Normalized CornerRadiusInsets object or number\n */\nexport function normalizeCornerRadius(\n value: number | CornerRadiusInsets | undefined\n): number | CornerRadiusInsets {\n if (value === undefined) {\n return 0\n }\n if (typeof value === 'number') {\n return value\n }\n return value\n}\n\n/**\n * Normalize gap values - converts number to GapInsets object\n * @param value - Number (uniform gap) or gap insets object\n * @returns Normalized GapInsets object with horizontal and vertical values\n */\nexport function normalizeGap(value: number | GapInsets | undefined): {\n horizontal: number\n vertical: number\n} {\n if (value === undefined) {\n return { horizontal: 0, vertical: 0 }\n }\n if (typeof value === 'number') {\n return { horizontal: value, vertical: value }\n }\n return {\n horizontal: value.horizontal ?? 0,\n vertical: value.vertical ?? 0,\n }\n}\n\n/**\n * Layout properties - sizing, spacing, and layout participation\n */\nexport interface LayoutProps {\n /**\n * Visibility and layout participation\n * - true / 'visible': Rendered and takes layout space (default)\n * - false / 'invisible': Not rendered but takes layout space (like CSS visibility: hidden)\n * - 'none': Not rendered and no layout space (like CSS display: none)\n *\n * @example\n * <View visible={true}>Always visible</View>\n * <View visible={false}>Hidden but occupies space</View>\n * <View visible=\"none\">Hidden and no space</View>\n */\n visible?: boolean | Display\n\n /**\n * If true, object is rendered but excluded from layout calculations\n * Use for decorative elements, sprites, particles, or absolute-positioned objects\n * - true: Object is visual-only, doesn't affect parent/sibling layout\n * - false/undefined: Object participates in layout (default for UI elements)\n *\n * @example\n * // Decorative sprite that doesn't affect layout\n * <Sprite texture=\"particle\" headless={true} />\n *\n * // Text that participates in layout\n * <Text text=\"Label\" headless={false} />\n */\n headless?: boolean\n\n /**\n * Width of the container\n * - number: Fixed width in pixels (e.g., 200)\n * - Percentage: \"50%\", \"100%\"\n * - Viewport: \"100vw\"\n * - Keywords: \"auto\", \"fill\"\n * - Calc: \"calc(100% - 20px)\"\n * - undefined: Auto - size to content\n *\n * @example\n * width={200} // 200px fixed width\n * width=\"75%\" // 75% of parent width\n * width=\"100vw\" // 100% of viewport width\n * width=\"fill\" // Fill available space\n * width=\"calc(50% + 10px)\" // Calculated width\n * width={undefined} // Auto-size to content\n */\n width?: SizeValue | undefined\n\n /**\n * Height of the container\n * - number: Fixed height in pixels (e.g., 100)\n * - Percentage: \"50%\", \"100%\"\n * - Viewport: \"100vh\"\n * - Keywords: \"auto\", \"fill\"\n * - Calc: \"calc(100vh - 50px)\"\n * - undefined: Auto - size to content\n *\n * @example\n * height={100} // 100px fixed height\n * height=\"50%\" // 50% of parent height\n * height=\"100vh\" // 100% of viewport height\n * height=\"fill\" // Fill available space\n * height=\"calc(100% - 20px)\" // Calculated height\n * height={undefined} // Auto-size to content\n */\n height?: SizeValue | undefined\n\n /**\n * Minimum width constraint\n * Prevents element from shrinking below this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed minimum\n * <View flex={1} minWidth={200}>Sidebar</View>\n *\n * // Percentage of parent\n * <View width=\"100%\" minWidth=\"20%\" maxWidth=\"80%\">Flexible</View>\n *\n * // Viewport-based\n * <View flex={1} minWidth=\"200px\">Responsive sidebar</View>\n *\n * // Calc expression\n * <View width=\"100%\" minWidth=\"calc(50% - 20px)\">Dynamic</View>\n */\n minWidth?: SizeValue | undefined\n\n /**\n * Minimum height constraint\n * Prevents element from shrinking below this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed minimum\n * <View height=\"auto\" minHeight={100}>\n * <Text text={dynamicContent} />\n * </View>\n *\n * // Percentage of parent\n * <View height=\"100%\" minHeight=\"30%\">Flexible height</View>\n *\n * // Viewport-based\n * <View flex={1} minHeight=\"50vh\">Half viewport min</View>\n */\n minHeight?: SizeValue | undefined\n\n /**\n * Maximum width constraint\n * Prevents element from growing beyond this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed maximum\n * <View flex={1} maxWidth={800}>\n * <Text text=\"Long content...\" />\n * </View>\n *\n * // Percentage of parent\n * <View width=\"100%\" maxWidth=\"80%\">Responsive</View>\n *\n * // Viewport-based\n * <View flex={1} maxWidth=\"90vw\">Full width modal</View>\n */\n maxWidth?: SizeValue | undefined\n\n /**\n * Maximum height constraint\n * Prevents element from growing beyond this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed maximum\n * <Image texture=\"photo\" width=\"100%\" maxHeight={400} />\n *\n * // Percentage of parent\n * <View height=\"100%\" maxHeight=\"80%\">Constrained</View>\n *\n * // Viewport-based\n * <View flex={1} maxHeight=\"80vh\">Scrollable content</View>\n */\n maxHeight?: SizeValue | undefined\n\n /**\n * * Margin outside the container\n * - number: Uniform margin on all sides\n * - EdgeInsets: Individual margin per side\n * - undefined: No margin\n */\n margin?: number | EdgeInsets | undefined\n\n /**\n * Padding inside the container\n * - number: Uniform padding on all sides\n * - EdgeInsets: Individual padding per side\n * - undefined: No padding\n */\n padding?: number | EdgeInsets | undefined\n\n /**\n * Layout direction for children\n * - 'column': Stack children vertically (default, like SwiftUI's VStack)\n * - 'row': Stack children horizontally (like SwiftUI's HStack)\n * - 'stack': Overlay children at the same position (like SwiftUI's ZStack)\n */\n direction?: 'row' | 'column' | 'stack'\n\n /**\n * Gap between children\n * - number: Uniform gap between all children\n * - GapInsets: Separate horizontal and vertical gaps\n * Applied between each child along the main axis (or both axes for GapInsets)\n */\n gap?: number | GapInsets | undefined\n\n /**\n * Main axis alignment (along direction)\n * - 'start': Align children to start (top for column, left for row)\n * - 'center': Center children along main axis\n * - 'end': Align children to end (bottom for column, right for row)\n * - 'space-between': Distribute children evenly, first at start, last at end\n * - 'space-around': Distribute children evenly with space around each\n * - 'space-evenly': Distribute children with equal space between and around\n */\n justifyContent?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly'\n\n /**\n * Cross axis alignment (perpendicular to direction)\n * - 'start': Align to start (left for column, top for row)\n * - 'center': Center along cross axis\n * - 'end': Align to end (right for column, bottom for row)\n * - 'stretch': Stretch children to fill cross axis (requires fixed container size)\n */\n alignItems?: 'start' | 'center' | 'end' | 'stretch'\n\n /**\n * Flex grow factor - how much of the remaining space this element should take\n * Similar to CSS flexbox flex-grow\n * - 0: Don't grow, use explicit width/height\n * - 1: Take equal share of remaining space\n * - 2+: Take proportionally more space\n *\n * @example\n * // Sidebar fixed, main content fills rest\n * <View direction=\"row\">\n * <View width={200}>Sidebar</View>\n * <View flex={1}>Main</View>\n * </View>\n *\n * // Two columns, second twice as wide\n * <View direction=\"row\">\n * <View flex={1}>Col 1</View>\n * <View flex={2}>Col 2</View>\n * </View>\n */\n flex?: number\n\n /**\n * Flex shrink factor - how much this element should shrink when space is limited\n * Similar to CSS flexbox flex-shrink\n * - 0: Don't shrink, maintain size even if container overflows\n * - 1: Shrink proportionally with other flex items (default)\n * - 2+: Shrink more than other items proportionally\n *\n * @example\n * // Text that can shrink, icon that stays fixed\n * <View direction=\"row\" width={150}>\n * <View width={50} flexShrink={0}>Icon</View>\n * <View flex={1} flexShrink={1}>Long Text...</View>\n * </View>\n *\n * // Two items, second shrinks twice as fast\n * <View direction=\"row\" width={100}>\n * <View width={80} flexShrink={1}>Item 1</View>\n * <View width={80} flexShrink={2}>Item 2</View>\n * </View>\n */\n flexShrink?: number\n\n /**\n * Flex basis - initial size before flex distribution\n * Similar to CSS flexbox flex-basis\n * - number: Fixed initial size in pixels\n * - Percentage: \"50%\", \"100%\"\n * - Viewport: \"100vw\", \"50vh\"\n * - Keyword: \"auto\"\n * - Calc: \"calc(50% + 10px)\"\n * - undefined: Use width/height as basis\n *\n * Defines the starting size before flexGrow/flexShrink is applied\n * Overrides width/height when flex is used\n *\n * @example\n * // Item starts at 200px, then grows with flex\n * <View flex={1} flexBasis={200}>Content</View>\n *\n * // Item starts at 50% of parent, then shrinks if needed\n * <View flexBasis=\"50%\" flexShrink={1}>Content</View>\n *\n * // Auto basis - uses content size\n * <View flex={1} flexBasis=\"auto\">Content</View>\n *\n * // Calc basis\n * <View flex={1} flexBasis=\"calc(100% / 3)\">Content</View>\n */\n flexBasis?: FlexBasisValue | undefined\n\n /**\n * Controls how content that overflows the container bounds is displayed\n * - 'visible': Content can overflow container bounds (default)\n * - 'hidden': Content is clipped to container bounds using Phaser mask\n *\n * @example\n * <View width={100} height={50} overflow=\"hidden\">\n * <Text text=\"This long text will be clipped\" />\n * </View>\n */\n overflow?: 'visible' | 'hidden'\n\n /**\n * Controls wrapping behavior for flex layouts\n * - 'nowrap': All items in single line (default, current behavior)\n * - 'wrap': Items wrap to new line/column when space exhausted\n * - 'wrap-reverse': Items wrap in reverse order\n *\n * Only applies to 'row' and 'column' directions, ignored for 'stack'\n * When wrapping, flex distribution is calculated per line\n *\n * @example\n * // Auto-wrap grid with 100px items\n * <View direction=\"row\" flexWrap=\"wrap\" gap={10} width={400}>\n * {items.map(item => <Card width={100} />)}\n * </View>\n *\n * // Responsive card grid\n * <View direction=\"row\" flexWrap=\"wrap\" gap={15}>\n * {cards.map(card => <View minWidth={180} flex={1}>{card}</View>)}\n * </View>\n */\n flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse'\n\n /**\n * Alignment of wrapped lines in multi-line flex container\n * Only applies when flexWrap !== 'nowrap' and there are multiple lines\n * Controls distribution of lines along cross axis (perpendicular to direction)\n *\n * - 'start': Pack lines to start (top for row, left for column)\n * - 'center': Center lines in container\n * - 'end': Pack lines to end (bottom for row, right for column)\n * - 'space-between': First line at start, last at end, equal space between\n * - 'space-around': Equal space around each line\n * - 'stretch': Lines stretch to fill cross axis (default)\n *\n * Difference from alignItems:\n * - alignItems: Aligns items within each line\n * - alignContent: Aligns the lines themselves within container\n *\n * @example\n * ```tsx\n * // Grid with lines distributed vertically\n * <View\n * direction=\"row\"\n * flexWrap=\"wrap\"\n * alignContent=\"space-between\"\n * height={400}\n * >\n * {items}\n * </View>\n * ```\n */\n alignContent?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'stretch'\n}\n\n/**\n * Background styling properties\n */\nexport interface BackgroundProps {\n backgroundColor?: number | undefined\n backgroundAlpha?: number | undefined\n cornerRadius?: number | CornerRadiusInsets | undefined\n borderWidth?: number | undefined\n borderColor?: number | undefined\n borderAlpha?: number\n}\n\n/**\n * Text-specific styling properties\n */\nexport interface TextSpecificProps {\n text: string | undefined\n /**\n * Maximum width for text wrapping\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n */\n maxWidth?: SizeValue\n}\n\n/**\n * High-level gesture props - unified touch and mouse interaction\n * These provide cross-platform gesture detection with transparent mouse/touch support\n */\nexport interface GestureProps {\n /**\n * Enable gesture system for this container\n * Must be true to receive any gesture events\n * Default: false (no overhead for non-interactive containers)\n */\n enableGestures?: boolean\n\n /**\n * Called on pointer down + up on the same target (click/tap)\n * Works for both mouse click and touch tap\n * Only fires if touch duration is within maxTouchDuration\n */\n onTouch?: (data: GestureEventData) => void\n\n /**\n * Called when pointer up occurs outside the container\n * Useful for click-outside detection (dropdowns, modals, tooltips)\n * Only fires if touch duration is within maxTouchDuration\n * Requires enableGestures: true\n */\n onTouchOutside?: (data: GestureEventData) => void\n\n /**\n * Called during pointer movement - continues even when outside bounds\n * Provides dx/dy deltas for tracking drag operations\n * Includes isInside flag and state ('start' | 'move' | 'end')\n * Requires enableGestures: true\n */\n onTouchMove?: (data: GestureEventData) => void\n\n /**\n * Called when double tap/click is detected within configured delay\n * Optional - only enable if needed to reduce overhead\n */\n onDoubleTap?: (data: GestureEventData) => void\n\n /**\n * Called when pointer is held down for configured duration\n * Optional - only enable if needed to reduce overhead\n */\n onLongPress?: (data: GestureEventData) => void\n\n /**\n * Duration in ms to trigger long press\n * Default: 500ms\n */\n longPressDuration?: number\n\n /**\n * Max time in ms between taps for double tap detection\n * Default: 300ms\n */\n doubleTapDelay?: number\n\n /**\n * Max time in ms for a valid touch/click (prevents delayed touch after long hold)\n * Default: 500ms\n */\n maxTouchDuration?: number\n\n /**\n * Called when a key is pressed down\n * Requires enableGestures: true\n */\n onKeyDown?: (data: KeyboardEventData) => void\n\n /**\n * Called when a key is released\n * Requires enableGestures: true\n */\n onKeyUp?: (data: KeyboardEventData) => void\n\n /**\n * Called when input value changes\n * Requires enableGestures: true\n */\n onInput?: (data: InputEventData) => void\n\n /**\n * Called when element receives focus\n * Requires enableGestures: true\n */\n onFocus?: (data: FocusEventData) => void\n\n /**\n * Called when element loses focus\n * Requires enableGestures: true\n */\n onBlur?: (data: FocusEventData) => void\n\n /**\n * Called when pointer enters the container (desktop/mouse only)\n * Does not work on touch devices (iPhone, iPad)\n * Requires enableGestures: true\n */\n onHoverStart?: (data: import('./gestures/gesture-types').HoverEventData) => void\n\n /**\n * Called when pointer exits the container (desktop/mouse only)\n * Does not work on touch devices (iPhone, iPad)\n * Requires enableGestures: true\n */\n onHoverEnd?: (data: import('./gestures/gesture-types').HoverEventData) => void\n\n /**\n * Called when mouse wheel is scrolled over container (desktop/mouse only)\n * Does not work on touch devices (iPhone, iPad)\n * Provides deltaX/deltaY for scroll amounts\n * Requires enableGestures: true\n */\n onWheel?: (data: WheelEventData) => void\n}\n","/**\n * Background applier - updates background and hit area\n */\nimport type * as Phaser from 'phaser'\nimport {\n createBackgroundImage,\n destroyBackgroundImage,\n getBackgroundImageCacheKey,\n} from '../../components/backgroundImage'\nimport { DebugLogger } from '../../dev-config'\nimport type { GameObjectWithLayout } from '../types'\n\n/**\n * Update background graphics size if present\n * @param container - Phaser container\n * @param width - Background width\n * @param height - Background height\n */\nexport function updateBackground(\n container: Phaser.GameObjects.Container,\n width: number,\n height: number\n): void {\n const background = (container as GameObjectWithLayout).__background\n if (background) {\n const layoutProps = (container as GameObjectWithLayout).__layoutProps\n if (layoutProps) {\n const cacheKey = getBackgroundImageCacheKey(layoutProps, width, height)\n\n if (background.__backgroundCacheKey === cacheKey) {\n return\n }\n\n const nextBackground = createBackgroundImage(container.scene, layoutProps, width, height)\n\n if (!nextBackground) return\n\n container.addAt(nextBackground, 0)\n ;(container as GameObjectWithLayout).__background = nextBackground\n destroyBackgroundImage(background)\n\n DebugLogger.log('layout', 'Background redrawn to:', { width, height })\n }\n }\n}\n\n/**\n * Update interactive hit area if present\n * @param container - Phaser container\n * @param width - Hit area width\n * @param height - Hit area height\n */\nexport function updateHitArea(\n container: Phaser.GameObjects.Container,\n width: number,\n height: number\n): void {\n if (container.input?.hitArea && 'setSize' in container.input.hitArea) {\n const hitArea = container.input.hitArea as Phaser.Geom.Rectangle\n const oldWidth = hitArea.width\n const oldHeight = hitArea.height\n\n // Only update if dimensions actually changed\n if (oldWidth !== width || oldHeight !== height) {\n // Position hit area centered around origin (container's local 0,0)\n // This is needed because Phaser containers treat hit areas relative to their center\n hitArea.setPosition(0, 0)\n hitArea.setSize(width, height)\n\n DebugLogger.log('layout', 'Hit area resized:', {\n from: { x: hitArea.x, y: hitArea.y, width: oldWidth, height: oldHeight },\n to: { x: 0, y: 0, width, height },\n })\n }\n }\n}\n","/**\n * Container applier - applies dimensions to container\n */\nimport type * as Phaser from 'phaser'\nimport { DebugLogger } from '../../dev-config'\nimport type { GameObjectWithLayout, LayoutSize } from '../types'\n\n/**\n * Apply dimensions to container and cache them for child percentage resolution\n * @param container - Phaser container\n * @param width - Container width\n * @param height - Container height\n */\nexport function applyContainerDimensions(\n container: Phaser.GameObjects.Container,\n width: number,\n height: number\n): void {\n const gameObject = container as GameObjectWithLayout & {\n __cachedLayoutSize?: LayoutSize\n __originalGetLayoutSize?: () => LayoutSize\n }\n gameObject.width = width\n gameObject.height = height\n\n // Cache the final layout size - this allows children to query parent size\n // for percentage-based constraints even when layout is recalculated\n gameObject.__cachedLayoutSize = { width, height }\n\n // Override __getLayoutSize to return cached value if available\n // Store original implementation on first call, then always use cache\n if (gameObject.__getLayoutSize && !gameObject.__originalGetLayoutSize) {\n gameObject.__originalGetLayoutSize = gameObject.__getLayoutSize\n gameObject.__getLayoutSize = () =>\n gameObject.__cachedLayoutSize ??\n (gameObject.__originalGetLayoutSize?.() || { width: 0, height: 0 })\n }\n\n DebugLogger.log('layout', 'Container dimensions set to:', { width, height })\n}\n","/**\n * Position applier - applies calculated positions to game objects\n */\nimport { DebugLogger } from '../../dev-config'\nimport type { LayoutChild, Position } from '../types'\n\n/**\n * Apply positions to children\n * @param children - Array of layout children\n * @param positions - Calculated positions for each child\n */\nexport function applyChildPositions(children: LayoutChild[], positions: Position[]): void {\n for (let i = 0; i < children.length; i++) {\n const childData = children[i]\n const position = positions[i]\n\n if (!childData || !position) continue\n\n const { child, size } = childData\n const { x, y } = position\n\n // Apply size (resolved from layout props, including percentages)\n if ('setSize' in child && typeof child.setSize === 'function') {\n if (size.width !== child.width || size.height !== child.height) {\n DebugLogger.log('positioning', 'Setting child', `${i} size: ${size.width}x${size.height}`)\n ;(child as { setSize: (w: number, h: number) => unknown }).setSize(size.width, size.height)\n }\n } else {\n // Fallback: directly set width/height\n child.width = size.width\n child.height = size.height\n if ('displayWidth' in child) (child as { displayWidth: number }).displayWidth = size.width\n if ('displayHeight' in child) (child as { displayHeight: number }).displayHeight = size.height\n }\n\n // Apply position\n if (child.setPosition) {\n DebugLogger.log('positioning', 'Setting child', ` ${i} position: (${x}, ${y})`)\n child.setPosition(x, y)\n }\n }\n}\n","/**\n * Spacing and alignment calculation utilities\n * Handles justifyContent and alignItems positioning logic\n */\nimport type { LayoutProps } from '../../core-props'\n\n/**\n * Justify content calculation result\n */\nexport interface JustifyResult {\n mainStart: number\n spaceBetween: number\n}\n\n/**\n * Calculate main axis starting position and spacing between children\n * @param justifyContent - Justify content value\n * @param remainingSpace - Space remaining after children are placed\n * @param childCount - Number of children\n * @returns Main axis starting offset and spacing between children\n */\nexport function calculateJustifyContent(\n justifyContent: LayoutProps['justifyContent'],\n remainingSpace: number,\n childCount: number\n): JustifyResult {\n let mainStart: number\n let spaceBetween = 0\n\n switch (justifyContent) {\n case 'start':\n mainStart = 0\n break\n case 'center':\n mainStart = Math.max(0, remainingSpace / 2)\n break\n case 'end':\n mainStart = Math.max(0, remainingSpace)\n break\n case 'space-between':\n mainStart = 0\n spaceBetween = childCount > 1 ? remainingSpace / (childCount - 1) : 0\n break\n case 'space-around':\n spaceBetween = childCount > 0 ? remainingSpace / childCount : 0\n mainStart = spaceBetween / 2\n break\n case 'space-evenly':\n spaceBetween = childCount > 0 ? remainingSpace / (childCount + 1) : 0\n mainStart = spaceBetween\n break\n default:\n // 'start' is default\n mainStart = 0\n break\n }\n\n return { mainStart, spaceBetween }\n}\n\n/**\n * Calculate cross axis position for a child\n * @param alignItems - Align items value\n * @param contentArea - Available space on cross axis\n * @param childSize - Size of child on cross axis\n * @param marginStart - Margin at start of cross axis (top for row, left for column)\n * @param marginEnd - Margin at end of cross axis (bottom for row, right for column)\n * @returns Cross axis position\n */\nexport function calculateAlignItems(\n alignItems: LayoutProps['alignItems'],\n contentArea: number,\n childSize: number,\n marginStart: number,\n marginEnd: number\n): number {\n switch (alignItems) {\n case 'start':\n return marginStart\n case 'center':\n return (contentArea - childSize) / 2\n case 'end':\n return contentArea - childSize - marginEnd\n case 'stretch':\n // Stretch: position at start (size is stretched in layout engine)\n return marginStart\n default:\n return marginStart\n }\n}\n","/**\n * Base strategy interface for layout algorithms\n * Defines the contract for all layout strategies\n */\nimport type { LayoutChild, LayoutContext, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\n\n/**\n * Layout strategy interface\n * Each direction (row, column, stack) implements this interface\n */\nexport interface LayoutStrategy {\n /**\n * Calculate content dimensions for this layout strategy\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics (maxWidth, maxHeight, totalMainSize)\n */\n calculateMetrics(children: LayoutChild[], context: LayoutContext): ContentMetrics\n\n /**\n * Calculate position for a child at given index\n * @param child - Layout child\n * @param index - Child index\n * @param context - Layout context\n * @param currentMain - Current position on main axis\n * @returns Position (x, y) and updated currentMain value\n */\n positionChild(\n child: LayoutChild,\n index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number }\n}\n\n/**\n * Abstract base class for layout strategies\n * Provides common functionality for all strategies\n */\nexport abstract class BaseLayoutStrategy implements LayoutStrategy {\n abstract calculateMetrics(children: LayoutChild[], context: LayoutContext): ContentMetrics\n\n abstract positionChild(\n child: LayoutChild,\n index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number }\n\n /**\n * Helper: Normalize margin values\n * @param child - Layout child\n * @returns Normalized margin values\n */\n protected getMarginValues(child: LayoutChild) {\n return {\n top: child.margin.top ?? 0,\n right: child.margin.right ?? 0,\n bottom: child.margin.bottom ?? 0,\n left: child.margin.left ?? 0,\n }\n }\n\n /**\n * Helper: Calculate total child size including margins\n * @param child - Layout child\n * @returns Total width and height including margins\n */\n protected getTotalChildSize(child: LayoutChild) {\n const margin = this.getMarginValues(child)\n return {\n width: margin.left + child.size.width + margin.right,\n height: margin.top + child.size.height + margin.bottom,\n }\n }\n}\n","/**\n * Column layout strategy (vertical stacking)\n * Like SwiftUI's VStack\n */\nimport type { LayoutChild, LayoutContext, LayoutLine, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\nimport { parseSize, resolveSize } from '../utils/size-resolver'\nimport { calculateAlignItems } from '../utils/spacing-calculator'\nimport { BaseLayoutStrategy } from './base-strategy'\n\n/**\n * Column layout strategy - stacks children vertically\n */\nexport class ColumnLayoutStrategy extends BaseLayoutStrategy {\n /**\n * Calculate content dimensions for column layout\n * For flex children, uses a minimum default size to avoid chicken-egg sizing issues\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics\n */\n calculateMetrics(children: LayoutChild[], _context: LayoutContext): ContentMetrics {\n const FLEX_CHILD_MIN_SIZE = 100 // Minimum size for flex children in content calculation\n let maxWidth = 0\n let totalMainSize = 0\n\n for (const child of children) {\n const total = this.getTotalChildSize(child)\n maxWidth = Math.max(maxWidth, total.width)\n\n // Check if this child participates in flexbox (flex, flexShrink, or flexBasis)\n const props = child.child.__layoutProps\n const isFlexItem =\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n // If flex child already has a resolved size (> 10), use it; otherwise use minimum\n const childHeight = isFlexItem && child.size.height <= 10 ? FLEX_CHILD_MIN_SIZE : total.height\n\n totalMainSize += childHeight\n }\n\n return {\n maxWidth,\n maxHeight: 0, // Not used for column\n totalMainSize,\n }\n }\n\n /**\n * Position a child in column layout\n * @param child - Layout child\n * @param _index - Child index (unused for column layout)\n * @param context - Layout context\n * @param currentMain - Current Y position\n * @returns Position and next main axis value\n */\n positionChild(\n child: LayoutChild,\n _index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number } {\n const margin = this.getMarginValues(child)\n const isHeadless = child.child.__layoutProps?.headless\n\n let x: number\n let y: number\n let nextMain: number\n\n if (isHeadless) {\n // Headless: calculate position directly using alignItems/justifyContent on full parent size\n const parentWidth = context.parentSize?.width ?? context.contentArea.width\n const parentHeight = context.parentSize?.height ?? context.contentArea.height\n\n // justifyContent on main axis (vertical) - manual calculation\n const justify = context.containerProps.justifyContent ?? 'start'\n let mainAxisOffset = 0\n if (justify === 'center') {\n mainAxisOffset = (parentHeight - child.size.height) / 2\n } else if (justify === 'end') {\n mainAxisOffset = parentHeight - child.size.height\n }\n // start and space-* variants use 0 for single item\n y = mainAxisOffset\n\n // alignItems on cross axis (horizontal)\n const crossAxisOffset = calculateAlignItems(\n context.containerProps.alignItems,\n parentWidth,\n child.size.width,\n 0,\n 0\n )\n x = crossAxisOffset\n\n // Don't advance currentMain for headless (they don't participate in flow)\n nextMain = currentMain\n } else {\n // Normal: use container padding and contentArea\n currentMain += margin.top\n y = context.padding.top + currentMain\n\n const alignOffset = calculateAlignItems(\n context.containerProps.alignItems,\n context.contentArea.width,\n child.size.width,\n margin.left,\n margin.right\n )\n x = context.padding.left + alignOffset\n\n nextMain = currentMain + child.size.height + margin.bottom\n }\n\n return {\n position: { x, y },\n nextMain,\n }\n }\n\n /**\n * Wrap children into lines based on available height\n * Used when flexWrap is 'wrap' or 'wrap-reverse'\n * @param children - Layout children to wrap\n * @param availableHeight - Available height for each line\n * @param gap - Gap between children\n * @returns Array of layout lines\n */\n wrapChildren(children: LayoutChild[], availableHeight: number, gap: number): LayoutLine[] {\n const lines: LayoutLine[] = []\n let currentLine: LayoutChild[] = []\n let currentLineHeight = 0\n let currentLineWidth = 0\n\n for (const child of children) {\n // Skip headless children in wrapping calculation\n if (child.child.__layoutProps?.headless) {\n continue\n }\n\n const margin = this.getMarginValues(child)\n const props = child.child.__layoutProps\n\n // For flex items with no size, use flexBasis or minHeight as hint for wrapping\n let effectiveHeight = child.size.height\n if (effectiveHeight <= 0 && props) {\n if (props.flexBasis !== undefined && typeof props.flexBasis === 'number') {\n effectiveHeight = props.flexBasis\n } else if (props.minHeight !== undefined) {\n // Resolve minHeight SizeValue to number\n const parsed = parseSize(props.minHeight)\n effectiveHeight = resolveSize(parsed, availableHeight, 100, undefined)\n } else if (props.flex && props.flex > 0) {\n // Use a reasonable default for flex items with no size hint\n effectiveHeight = 100\n }\n }\n\n const childHeight = effectiveHeight + margin.top + margin.bottom\n const childWidth = child.size.width + margin.left + margin.right\n\n const gapSpace = currentLine.length > 0 ? gap : 0\n const requiredSpace = currentLineHeight + childHeight + gapSpace\n\n // Check if we need to wrap to a new line (column)\n if (requiredSpace > availableHeight && currentLine.length > 0) {\n // Save current line\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineHeight,\n crossAxisSize: currentLineWidth,\n })\n\n // Start new line\n currentLine = [child]\n currentLineHeight = childHeight\n currentLineWidth = childWidth\n } else {\n // Add to current line\n currentLine.push(child)\n currentLineHeight = requiredSpace\n currentLineWidth = Math.max(currentLineWidth, childWidth)\n }\n }\n\n // Add remaining line\n if (currentLine.length > 0) {\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineHeight,\n crossAxisSize: currentLineWidth,\n })\n }\n\n return lines\n }\n}\n","/**\n * Row layout strategy (horizontal stacking)\n * Like SwiftUI's HStack\n */\nimport type { LayoutChild, LayoutContext, LayoutLine, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\nimport { parseSize, resolveSize } from '../utils/size-resolver'\nimport { calculateAlignItems } from '../utils/spacing-calculator'\nimport { BaseLayoutStrategy } from './base-strategy'\n\n/**\n * Row layout strategy - stacks children horizontally\n */\nexport class RowLayoutStrategy extends BaseLayoutStrategy {\n /**\n * Calculate content dimensions for row layout\n * For flex children, uses a minimum default size to avoid chicken-egg sizing issues\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics\n */\n calculateMetrics(children: LayoutChild[], _context: LayoutContext): ContentMetrics {\n const FLEX_CHILD_MIN_SIZE = 100 // Minimum size for flex children in content calculation\n let maxHeight = 0\n let totalMainSize = 0\n\n for (const child of children) {\n const total = this.getTotalChildSize(child)\n maxHeight = Math.max(maxHeight, total.height)\n\n // Check if this child participates in flexbox (flex, flexShrink, or flexBasis)\n const props = child.child.__layoutProps\n const isFlexItem =\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n // If flex child already has a resolved size (> 10), use it; otherwise use minimum\n const childWidth = isFlexItem && child.size.width <= 10 ? FLEX_CHILD_MIN_SIZE : total.width\n\n totalMainSize += childWidth\n }\n\n return {\n maxWidth: 0, // Not used for row\n maxHeight,\n totalMainSize,\n }\n }\n\n /**\n * Position a child in row layout\n * @param child - Layout child\n * @param _index - Child index (unused for row layout)\n * @param context - Layout context\n * @param currentMain - Current X position\n * @returns Position and next main axis value\n */\n positionChild(\n child: LayoutChild,\n _index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number } {\n const margin = this.getMarginValues(child)\n const isHeadless = child.child.__layoutProps?.headless\n\n let x: number\n let y: number\n let nextMain: number\n\n if (isHeadless) {\n // Headless: calculate position directly using alignItems/justifyContent on full parent size\n const parentWidth = context.parentSize?.width ?? context.contentArea.width\n const parentHeight = context.parentSize?.height ?? context.contentArea.height\n\n // justifyContent on main axis (horizontal)\n const justify = context.containerProps.justifyContent ?? 'start'\n let mainAxisOffset = 0\n if (justify === 'center') {\n mainAxisOffset = (parentWidth - child.size.width) / 2\n } else if (justify === 'end') {\n mainAxisOffset = parentWidth - child.size.width\n }\n x = mainAxisOffset\n\n // alignItems on cross axis (vertical)\n const crossAxisOffset = calculateAlignItems(\n context.containerProps.alignItems,\n parentHeight,\n child.size.height,\n 0,\n 0\n )\n y = crossAxisOffset\n\n // Don't advance currentMain for headless\n nextMain = currentMain\n } else {\n // Normal: use container padding and contentArea\n currentMain += margin.left\n x = context.padding.left + currentMain\n\n const alignOffset = calculateAlignItems(\n context.containerProps.alignItems,\n context.contentArea.height,\n child.size.height,\n margin.top,\n margin.bottom\n )\n y = context.padding.top + alignOffset\n\n nextMain = currentMain + child.size.width + margin.right\n }\n\n return {\n position: { x, y },\n nextMain,\n }\n }\n\n /**\n * Wrap children into lines based on available width\n * Used when flexWrap is 'wrap' or 'wrap-reverse'\n * @param children - Layout children to wrap\n * @param availableWidth - Available width for each line\n * @param gap - Gap between children\n * @returns Array of layout lines\n */\n wrapChildren(children: LayoutChild[], availableWidth: number, gap: number): LayoutLine[] {\n const lines: LayoutLine[] = []\n let currentLine: LayoutChild[] = []\n let currentLineWidth = 0\n let currentLineHeight = 0\n\n for (const child of children) {\n // Skip headless children in wrapping calculation\n if (child.child.__layoutProps?.headless) {\n continue\n }\n\n const margin = this.getMarginValues(child)\n const props = child.child.__layoutProps\n\n // For flex items with no size, use flexBasis or minWidth as hint for wrapping\n let effectiveWidth = child.size.width\n if (effectiveWidth <= 0 && props) {\n if (props.flexBasis !== undefined && typeof props.flexBasis === 'number') {\n effectiveWidth = props.flexBasis\n } else if (props.minWidth !== undefined) {\n // Resolve minWidth SizeValue to number\n const parsed = parseSize(props.minWidth)\n effectiveWidth = resolveSize(parsed, availableWidth, 100, undefined)\n } else if (props.flex && props.flex > 0) {\n // Use a reasonable default for flex items with no size hint\n effectiveWidth = 100\n }\n }\n\n const childWidth = effectiveWidth + margin.left + margin.right\n const childHeight = child.size.height + margin.top + margin.bottom\n\n const gapSpace = currentLine.length > 0 ? gap : 0\n const requiredSpace = currentLineWidth + childWidth + gapSpace\n\n // Check if we need to wrap to a new line\n if (requiredSpace > availableWidth && currentLine.length > 0) {\n // Save current line\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineWidth,\n crossAxisSize: currentLineHeight,\n })\n\n // Start new line\n currentLine = [child]\n currentLineWidth = childWidth\n currentLineHeight = childHeight\n } else {\n // Add to current line\n currentLine.push(child)\n currentLineWidth = requiredSpace\n currentLineHeight = Math.max(currentLineHeight, childHeight)\n }\n }\n\n // Add remaining line\n if (currentLine.length > 0) {\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineWidth,\n crossAxisSize: currentLineHeight,\n })\n }\n\n return lines\n }\n}\n","/**\n * Stack layout strategy (overlay positioning)\n * Like SwiftUI's ZStack - all children positioned at same location\n */\nimport type { LayoutChild, LayoutContext, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\nimport { BaseLayoutStrategy } from './base-strategy'\n\n/**\n * Stack layout strategy - overlays all children at the same position\n */\nexport class StackLayoutStrategy extends BaseLayoutStrategy {\n /**\n * Calculate content dimensions for stack layout\n * For stack, we track max dimensions as children overlay\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics\n */\n calculateMetrics(children: LayoutChild[], _context: LayoutContext): ContentMetrics {\n let maxWidth = 0\n let maxHeight = 0\n\n for (const child of children) {\n const total = this.getTotalChildSize(child)\n maxWidth = Math.max(maxWidth, total.width)\n maxHeight = Math.max(maxHeight, total.height)\n }\n\n return {\n maxWidth,\n maxHeight,\n totalMainSize: 0, // Not applicable for stack\n }\n }\n\n /**\n * Position a child in stack layout\n * All children positioned at same location, aligned via alignItems\n * @param child - Layout child\n * @param _index - Child index (unused for stack layout)\n * @param context - Layout context\n * @param currentMain - Current position (unused for stack)\n * @returns Position and unchanged currentMain\n */\n positionChild(\n child: LayoutChild,\n _index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number } {\n const margin = this.getMarginValues(child)\n const { alignItems } = context.containerProps\n\n let x: number\n let y: number\n\n // Position based on alignItems (applies to both axes for stack)\n switch (alignItems) {\n case 'start':\n x = context.padding.left + margin.left\n y = context.padding.top + margin.top\n break\n case 'center':\n x = context.padding.left + (context.contentArea.width - child.size.width) / 2\n y = context.padding.top + (context.contentArea.height - child.size.height) / 2\n break\n case 'end':\n x = context.padding.left + context.contentArea.width - child.size.width - margin.right\n y = context.padding.top + context.contentArea.height - child.size.height - margin.bottom\n break\n case 'stretch':\n // TODO: Implement stretch - for now behave like start\n x = context.padding.left + margin.left\n y = context.padding.top + margin.top\n break\n default:\n x = context.padding.left + margin.left\n y = context.padding.top + margin.top\n break\n }\n\n // Apply explicit x/y offsets if provided\n const childX = child.child.__layoutProps?.x\n const childY = child.child.__layoutProps?.y\n\n if (childX !== undefined) {\n x += childX\n }\n if (childY !== undefined) {\n y += childY\n }\n\n return {\n position: { x, y },\n nextMain: currentMain, // Stack doesn't advance main axis\n }\n }\n}\n","/**\n * Utility functions for working with layout children\n */\nimport type * as Phaser from 'phaser'\nimport type { EdgeInsets, LayoutProps } from '../../core-props'\nimport { DebugLogger } from '../../dev-config'\nimport type { GameObjectWithLayout, LayoutChild, LayoutSize } from '../types'\nimport { clampSize, parseSize, resolveSize } from './size-resolver'\n\n/**\n * Check if a child should participate in layout calculations\n * Headless objects participate in layout (for alignment) but report size 0\n * @param child - Child game object\n * @returns True if child should be included in layout\n */\nexport function isLayoutChild(child: GameObjectWithLayout): boolean {\n // Skip background graphics (special role - defines container dimensions)\n if (child.__isBackground) return false\n\n // Check display mode from __layoutProps (visible prop)\n const displayMode = child.__layoutProps?.visible\n\n // Skip children with visible=\"none\" - they don't take up space (like CSS display: none)\n // Note: visible=false / \"invisible\" still occupies space (like CSS visibility: hidden)\n // Note: alpha=0 is different - it renders transparent but still occupies space\n if (displayMode === 'none') return false\n\n // Require __getLayoutSize for layout participation\n // Note: Headless objects still participate, they just report size 0\n return typeof child.__getLayoutSize === 'function'\n}\n\n/**\n * Get effective margin for a child\n * Normalizes margin to EdgeInsets (supports number for all sides)\n * Headless objects have no margin (positioned as point)\n * @param child - Child game object\n * @returns Edge insets\n */\nexport function getMargin(child: GameObjectWithLayout): EdgeInsets {\n const margin = child.__layoutProps?.margin\n if (typeof margin === 'number') {\n return { top: margin, right: margin, bottom: margin, left: margin }\n }\n return margin ?? {}\n}\n\nfunction getHorizontalMargin(margin: EdgeInsets): number {\n return (margin.left ?? 0) + (margin.right ?? 0)\n}\n\nfunction getVerticalMargin(margin: EdgeInsets): number {\n return (margin.top ?? 0) + (margin.bottom ?? 0)\n}\n\n/**\n * Get effective size of a child\n * Calls __getLayoutSize if available, otherwise falls back to layoutProps or default\n * Note: String sizes (percentages) are resolved later with parent context\n * @param child - Child game object\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n * @returns Width and height in pixels\n */\nexport function getChildSize(\n child: GameObjectWithLayout,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): LayoutSize {\n // For flex children, we still need to calculate their actual size\n // (especially for cross-axis dimension in row/column layouts)\n // The main-axis size will be overridden by flex distribution anyway\n\n // If __layoutProps exists, use it (has priority for explicit layout configuration)\n if (\n child.__layoutProps &&\n (child.__layoutProps.width !== undefined || child.__layoutProps.height !== undefined)\n ) {\n const layoutWidth = child.__layoutProps.width\n const layoutHeight = child.__layoutProps.height\n const margin = getMargin(child)\n\n // Resolve width\n const parsedWidth = parseSize(layoutWidth)\n let width = resolveSize(\n parsedWidth,\n parentSize?.width,\n child.width ?? 100,\n parentPadding?.horizontal\n )\n if (parsedWidth.type === 'fill') {\n width = Math.max(0, width - getHorizontalMargin(margin))\n }\n\n // Resolve height\n const parsedHeight = parseSize(layoutHeight)\n let height = resolveSize(\n parsedHeight,\n parentSize?.height,\n child.height ?? 20,\n parentPadding?.vertical\n )\n if (parsedHeight.type === 'fill') {\n height = Math.max(0, height - getVerticalMargin(margin))\n }\n\n // Apply min/max constraints\n const { minWidth, maxWidth, minHeight, maxHeight } = child.__layoutProps\n width = clampSize(\n width,\n minWidth,\n maxWidth,\n parentSize?.width,\n child.width,\n parentPadding?.horizontal\n )\n height = clampSize(\n height,\n minHeight,\n maxHeight,\n parentSize?.height,\n child.height,\n parentPadding?.vertical\n )\n\n return { width, height }\n }\n\n // Use dynamic size provider if available\n if (child.__getLayoutSize) {\n let size = child.__getLayoutSize()\n\n // Apply constraints if layoutProps exist (even without explicit width/height)\n if (child.__layoutProps) {\n const { minWidth, maxWidth, minHeight, maxHeight } = child.__layoutProps\n size = {\n width: clampSize(\n size.width,\n minWidth,\n maxWidth,\n parentSize?.width,\n child.width,\n parentPadding?.horizontal\n ),\n height: clampSize(\n size.height,\n minHeight,\n maxHeight,\n parentSize?.height,\n child.height,\n parentPadding?.vertical\n ),\n }\n }\n\n return size\n }\n\n // Fallback to current dimensions or default\n let width = child.width ?? 100\n let height = child.height ?? 20\n\n // Apply constraints if layoutProps exist\n if (child.__layoutProps) {\n const { minWidth, maxWidth, minHeight, maxHeight } = child.__layoutProps\n width = clampSize(\n width,\n minWidth,\n maxWidth,\n parentSize?.width,\n child.width,\n parentPadding?.horizontal\n )\n height = clampSize(\n height,\n minHeight,\n maxHeight,\n parentSize?.height,\n child.height,\n parentPadding?.vertical\n )\n }\n\n return { width, height }\n}\n\n/**\n * Process a child container by recursively calculating its layout\n * @param child - Child game object to process\n * @param calculateLayoutFn - Layout calculation function (passed to avoid circular dependency)\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n */\nexport function processNestedContainer(\n child: GameObjectWithLayout,\n calculateLayoutFn: (\n container: Phaser.GameObjects.Container,\n props: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n ) => void,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): void {\n if (!('list' in child) || !Array.isArray((child as Phaser.GameObjects.Container).list)) {\n return\n }\n\n const childContainer = child as Phaser.GameObjects.Container\n const childLayoutProps = child.__layoutProps ?? {}\n\n DebugLogger.log('layout', 'Child is a container, calculating nested layout first')\n\n calculateLayoutFn(childContainer, childLayoutProps, parentSize, parentPadding)\n}\n\n/**\n * Filter and prepare children for layout calculations\n * Skips background elements and processes nested containers\n * @param children - Raw children from container\n * @param calculateLayoutFn - Layout calculation function for nested containers\n * @returns Prepared layout children with size and margin data\n */\nexport function prepareLayoutChildren(\n children: GameObjectWithLayout[],\n calculateLayoutFn: (container: Phaser.GameObjects.Container, props: LayoutProps) => void\n): LayoutChild[] {\n const layoutChildren: LayoutChild[] = []\n\n for (const child of children) {\n // Skip background rectangles\n if (child.__isBackground) {\n DebugLogger.log('layout', 'Skipping background')\n continue\n }\n\n // Process nested containers first\n processNestedContainer(child, calculateLayoutFn)\n\n const size = getChildSize(child)\n const margin = getMargin(child)\n\n layoutChildren.push({ child, size, margin })\n }\n\n return layoutChildren\n}\n\n/**\n * Extract margin values with defaults\n * @param margin - Edge insets\n * @returns Individual margin values\n */\nexport function extractMarginValues(margin: EdgeInsets) {\n return {\n top: margin.top ?? 0,\n right: margin.right ?? 0,\n bottom: margin.bottom ?? 0,\n left: margin.left ?? 0,\n }\n}\n","/**\n * Dimension calculation utilities for layout system\n * Handles content size tracking and container dimension computation\n */\nimport type { EdgeInsets, LayoutProps } from '../../core-props'\nimport type { LayoutChild } from '../types'\nimport { clampSize, parseSize, resolveSize } from './size-resolver'\n\n/**\n * Content dimension metrics\n */\nexport interface ContentMetrics {\n maxWidth: number\n maxHeight: number\n totalMainSize: number\n}\n\n/**\n * Padding values (normalized)\n */\nexport interface PaddingValues {\n left: number\n top: number\n right: number\n bottom: number\n}\n\nfunction normalizeMargin(margin?: number | EdgeInsets): EdgeInsets {\n if (typeof margin === 'number') {\n return {\n left: margin,\n top: margin,\n right: margin,\n bottom: margin,\n }\n }\n return margin ?? {}\n}\n\nfunction getHorizontalMargin(margin: EdgeInsets): number {\n return (margin.left ?? 0) + (margin.right ?? 0)\n}\n\nfunction getVerticalMargin(margin: EdgeInsets): number {\n return (margin.top ?? 0) + (margin.bottom ?? 0)\n}\n\n/**\n * Calculate content dimensions based on children and layout direction\n * For flex children, uses a minimum default size to avoid chicken-egg sizing issues\n * @param children - Array of layout children with size and margin info\n * @param direction - Layout direction ('row', 'column', or 'stack')\n * @returns Content metrics including max dimensions and total main axis size\n */\nexport function calculateContentDimensions(\n children: LayoutChild[],\n direction: 'row' | 'column' | 'stack'\n): ContentMetrics {\n const FLEX_CHILD_MIN_SIZE = 100 // Minimum size for flex children in content calculation\n let maxWidth = 0\n let maxHeight = 0\n let totalMainSize = 0\n\n for (const { size, margin, child } of children) {\n const marginTop = margin.top ?? 0\n const marginBottom = margin.bottom ?? 0\n const marginLeft = margin.left ?? 0\n const marginRight = margin.right ?? 0\n\n // Check if this child has flex property\n const hasFlex = (child.__layoutProps?.flex ?? 0) > 0\n\n if (direction === 'row') {\n const childWidth = hasFlex ? FLEX_CHILD_MIN_SIZE : size.width\n totalMainSize += marginLeft + childWidth + marginRight\n const childTotalHeight = marginTop + size.height + marginBottom\n maxHeight = Math.max(maxHeight, childTotalHeight)\n } else if (direction === 'column') {\n const childTotalWidth = marginLeft + size.width + marginRight\n maxWidth = Math.max(maxWidth, childTotalWidth)\n const childHeight = hasFlex ? FLEX_CHILD_MIN_SIZE : size.height\n totalMainSize += marginTop + childHeight + marginBottom\n } else if (direction === 'stack') {\n // For stack, track max dimensions (children overlay)\n const childTotalWidth = marginLeft + size.width + marginRight\n const childTotalHeight = marginTop + size.height + marginBottom\n maxWidth = Math.max(maxWidth, childTotalWidth)\n maxHeight = Math.max(maxHeight, childTotalHeight)\n }\n }\n\n return { maxWidth, maxHeight, totalMainSize }\n}\n\n/**\n * Calculate final container dimensions\n * @param props - Layout properties\n * @param metrics - Content metrics from calculateContentDimensions\n * @param padding - Normalized padding values\n * @param direction - Layout direction\n * @param gap - Gap between children (horizontal and vertical)\n * @param childCount - Number of children\n * @param parentSize - Parent dimensions for percentage resolution\n * @param parentPadding - Parent padding for 'fill' resolution\n * @returns Container width and height in pixels\n */\nexport function calculateContainerSize(\n props: LayoutProps,\n metrics: ContentMetrics,\n padding: PaddingValues,\n direction: 'row' | 'column' | 'stack',\n gap: { horizontal: number; vertical: number },\n childCount: number,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): { width: number; height: number } {\n // Add gaps to total main size (not applicable for stack)\n let totalMainSizeWithGaps = metrics.totalMainSize\n if (direction !== 'stack' && childCount > 1) {\n const gapValue = direction === 'row' ? gap.horizontal : gap.vertical\n totalMainSizeWithGaps += gapValue * (childCount - 1)\n }\n\n // Calculate content-based default sizes\n const contentWidth =\n direction === 'row'\n ? totalMainSizeWithGaps + padding.left + padding.right\n : metrics.maxWidth + padding.left + padding.right\n\n const contentHeight =\n direction === 'row'\n ? metrics.maxHeight + padding.top + padding.bottom\n : totalMainSizeWithGaps + padding.top + padding.bottom\n\n // Resolve width\n const parsedWidth = parseSize(props.width)\n let width = resolveSize(parsedWidth, parentSize?.width, contentWidth, parentPadding?.horizontal)\n const margin = normalizeMargin(props.margin)\n if (parsedWidth.type === 'fill') {\n width = Math.max(0, width - getHorizontalMargin(margin))\n }\n\n // Resolve height\n const parsedHeight = parseSize(props.height)\n let height = resolveSize(parsedHeight, parentSize?.height, contentHeight, parentPadding?.vertical)\n if (parsedHeight.type === 'fill') {\n height = Math.max(0, height - getVerticalMargin(margin))\n }\n\n // Apply min/max constraints to container size\n // Note: parentSize is already the content-area of the parent container (after padding),\n // so we should NOT apply parentPadding again for percentage-based constraints\n width = clampSize(\n width,\n props.minWidth,\n props.maxWidth,\n parentSize?.width,\n contentWidth,\n undefined // Don't use parentPadding - parentSize is already content-area\n )\n height = clampSize(\n height,\n props.minHeight,\n props.maxHeight,\n parentSize?.height,\n contentHeight,\n undefined // Don't use parentPadding - parentSize is already content-area\n )\n\n return { width, height }\n}\n\n/**\n * Normalize padding from EdgeInsets or number to PaddingValues\n * @param padding - Edge insets (may be undefined, partial, or a single number for all sides)\n * @returns Normalized padding with all values defined\n */\nexport function normalizePadding(padding?: number | EdgeInsets): PaddingValues {\n if (typeof padding === 'number') {\n return {\n left: padding,\n top: padding,\n right: padding,\n bottom: padding,\n }\n }\n return {\n left: padding?.left ?? 0,\n top: padding?.top ?? 0,\n right: padding?.right ?? 0,\n bottom: padding?.bottom ?? 0,\n }\n}\n","/**\n * Flex distribution utilities - handles flexbox logic (grow, shrink, basis) for layout children\n */\nimport type { LayoutChild } from '../types'\nimport { parseSize, resolveSize } from './size-resolver'\n\n/**\n * Flex item data structure\n */\ninterface FlexItem {\n child: LayoutChild\n index: number\n flexGrow: number\n flexShrink: number\n flexBasis: number\n minSize: number | undefined\n maxSize: number | undefined\n isFrozen: boolean\n targetSize: number\n}\n\n/**\n * Calculate flex distribution for children\n * Implements flexbox algorithm with grow, shrink, and basis support\n * Respects min/max constraints during distribution\n * @param children - Layout children\n * @param availableSpace - Total available space on main axis\n * @param direction - Layout direction ('row' or 'column')\n * @returns Updated children with flex sizes resolved\n */\nexport function distributeFlexSpace(\n children: LayoutChild[],\n availableSpace: number,\n direction: 'row' | 'column' | 'stack'\n): LayoutChild[] {\n if (direction === 'stack') {\n return children // Stack doesn't use flex\n }\n\n // Phase 1: Identify flex items and non-flex items\n const flexItems: FlexItem[] = []\n let nonFlexSpace = 0\n\n children.forEach((layoutChild, index) => {\n const props = layoutChild.child.__layoutProps\n const hasExplicitFlex = props?.flex !== undefined\n const hasExplicitShrink = props?.flexShrink !== undefined\n const hasExplicitBasis = props?.flexBasis !== undefined\n\n const flexGrow = props?.flex ?? 0\n // Only default flexShrink to 1 if element explicitly participates in flex\n const flexShrink =\n props?.flexShrink !== undefined\n ? props.flexShrink\n : hasExplicitFlex || hasExplicitBasis\n ? 1\n : 0\n const flexBasis = props?.flexBasis\n\n const margin = layoutChild.margin\n const marginSize =\n direction === 'row'\n ? (margin.left ?? 0) + (margin.right ?? 0)\n : (margin.top ?? 0) + (margin.bottom ?? 0)\n\n // Resolve min/max constraints from SizeValue to pixels\n const minSizeValue = direction === 'row' ? props?.minWidth : props?.minHeight\n const maxSizeValue = direction === 'row' ? props?.maxWidth : props?.maxHeight\n const currentSize = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n\n const minSize =\n minSizeValue !== undefined\n ? resolveSize(parseSize(minSizeValue), availableSpace, currentSize, undefined)\n : undefined\n const maxSize =\n maxSizeValue !== undefined\n ? resolveSize(parseSize(maxSizeValue), availableSpace, currentSize, undefined)\n : undefined\n\n // Calculate flex-basis\n let basisSize: number\n if (flexBasis !== undefined) {\n // Use explicit flex-basis\n const parsedBasis = parseSize(flexBasis)\n const currentSize = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n basisSize = resolveSize(parsedBasis, availableSpace, currentSize, undefined)\n } else {\n // Use width/height as flex-basis\n basisSize = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n }\n\n // Determine if this is a flex item\n // An item is a flex item if it explicitly sets flex, flexShrink, or flexBasis\n const isFlexItem = hasExplicitFlex || hasExplicitShrink || hasExplicitBasis\n\n if (isFlexItem) {\n flexItems.push({\n child: layoutChild,\n index,\n flexGrow,\n flexShrink,\n flexBasis: basisSize,\n minSize,\n maxSize,\n isFrozen: false,\n targetSize: basisSize,\n })\n\n nonFlexSpace += marginSize\n } else {\n // Non-flex item - uses its current size\n const size = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n nonFlexSpace += size + marginSize\n }\n })\n\n // No flex items - return as is\n if (flexItems.length === 0) {\n return children\n }\n\n // Phase 2: Calculate total flex-basis\n let totalFlexBasis = flexItems.reduce((sum, item) => sum + item.flexBasis, 0)\n let freeSpace = availableSpace - nonFlexSpace - totalFlexBasis\n\n // Phase 3: Flex distribution (grow or shrink)\n const updatedChildren = [...children]\n\n if (freeSpace > 0) {\n // GROW: Distribute positive free space\n distributeGrow(flexItems, freeSpace)\n } else if (freeSpace < 0) {\n // SHRINK: Distribute negative free space\n distributeShrink(flexItems, freeSpace)\n } else {\n // Exact fit - use flex-basis\n flexItems.forEach((item) => {\n item.targetSize = item.flexBasis\n })\n }\n\n // Phase 4: Apply calculated sizes\n flexItems.forEach((item) => {\n if (direction === 'row') {\n updatedChildren[item.index] = {\n ...item.child,\n size: {\n ...item.child.size,\n width: item.targetSize,\n },\n }\n } else {\n updatedChildren[item.index] = {\n ...item.child,\n size: {\n ...item.child.size,\n height: item.targetSize,\n },\n }\n }\n })\n\n return updatedChildren\n}\n\n/**\n * Distribute positive free space using flex-grow\n * @param flexItems - Flex items to distribute space among\n * @param freeSpace - Positive free space to distribute\n */\nfunction distributeGrow(flexItems: FlexItem[], freeSpace: number): void {\n let remainingSpace = freeSpace\n const MAX_ITERATIONS = 10\n\n for (let iteration = 0; iteration < MAX_ITERATIONS; iteration++) {\n // Calculate total flex-grow of unfrozen items\n const totalFlexGrow = flexItems\n .filter((item) => !item.isFrozen)\n .reduce((sum, item) => sum + item.flexGrow, 0)\n\n if (totalFlexGrow === 0 || remainingSpace <= 0) {\n break\n }\n\n let hasViolations = false\n\n // Distribute space proportionally\n for (const item of flexItems) {\n if (item.isFrozen) continue\n\n const growShare = (remainingSpace * item.flexGrow) / totalFlexGrow\n let targetSize = item.flexBasis + growShare\n\n // Apply min/max constraints\n if (item.minSize !== undefined && targetSize < item.minSize) {\n targetSize = item.minSize\n item.isFrozen = true\n hasViolations = true\n } else if (item.maxSize !== undefined && targetSize > item.maxSize) {\n targetSize = item.maxSize\n item.isFrozen = true\n hasViolations = true\n }\n\n item.targetSize = targetSize\n }\n\n if (!hasViolations) {\n break // All items distributed without violations\n }\n\n // Recalculate remaining space for next iteration\n remainingSpace = freeSpace\n for (const item of flexItems) {\n if (item.isFrozen) {\n remainingSpace -= item.targetSize - item.flexBasis\n }\n }\n }\n\n // Set targetSize for any remaining unfrozen items\n for (const item of flexItems) {\n if (!item.isFrozen) {\n // Already set in loop\n }\n }\n}\n\n/**\n * Distribute negative free space using flex-shrink\n * @param flexItems - Flex items to shrink\n * @param freeSpace - Negative free space (deficit)\n */\nfunction distributeShrink(flexItems: FlexItem[], freeSpace: number): void {\n let remainingSpace = Math.abs(freeSpace)\n const MAX_ITERATIONS = 10\n\n for (let iteration = 0; iteration < MAX_ITERATIONS; iteration++) {\n // Calculate scaled flex-shrink (shrink * basis)\n const totalScaledShrink = flexItems\n .filter((item) => !item.isFrozen)\n .reduce((sum, item) => sum + item.flexShrink * item.flexBasis, 0)\n\n if (totalScaledShrink === 0 || remainingSpace <= 0) {\n break\n }\n\n let hasViolations = false\n\n // Distribute shrinkage proportionally\n for (const item of flexItems) {\n if (item.isFrozen) continue\n\n const scaledShrink = item.flexShrink * item.flexBasis\n const shrinkShare = (remainingSpace * scaledShrink) / totalScaledShrink\n let targetSize = item.flexBasis - shrinkShare\n\n // Apply min/max constraints\n if (item.minSize !== undefined && targetSize < item.minSize) {\n targetSize = item.minSize\n item.isFrozen = true\n hasViolations = true\n } else if (item.maxSize !== undefined && targetSize > item.maxSize) {\n targetSize = item.maxSize\n item.isFrozen = true\n hasViolations = true\n }\n\n item.targetSize = targetSize\n }\n\n if (!hasViolations) {\n break // All items shrunk without violations\n }\n\n // Recalculate remaining space for next iteration\n remainingSpace = Math.abs(freeSpace)\n for (const item of flexItems) {\n if (item.isFrozen) {\n remainingSpace -= item.flexBasis - item.targetSize\n }\n }\n }\n\n // Set targetSize for any remaining unfrozen items\n for (const item of flexItems) {\n if (!item.isFrozen) {\n // Already set in loop\n }\n }\n}\n\n/**\n * Check if any children have flex properties (flex, flexShrink, or flexBasis)\n * @param children - Layout children\n * @returns True if at least one child participates in flexbox\n */\nexport function hasFlexChildren(children: LayoutChild[]): boolean {\n return children.some((child) => {\n const props = child.child.__layoutProps\n return (\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n )\n })\n}\n","/**\n * Layout engine - main orchestrator for layout calculations\n * Uses strategy pattern to handle different layout directions\n */\nimport * as Phaser from 'phaser'\nimport type { StencilClipHandle, StencilClipShape } from '../clip'\nimport type { LayoutProps } from '../core-props'\nimport { normalizeGap } from '../core-props'\nimport { DebugLogger } from '../dev-config'\nimport { updateBackground, updateHitArea } from './appliers/background-applier'\nimport { applyContainerDimensions } from './appliers/container-applier'\nimport { applyChildPositions } from './appliers/position-applier'\nimport type { LayoutStrategy } from './strategies/base-strategy'\nimport { ColumnLayoutStrategy } from './strategies/column-layout'\nimport { RowLayoutStrategy } from './strategies/row-layout'\nimport { StackLayoutStrategy } from './strategies/stack-layout'\nimport type {\n GameObjectWithLayout,\n LayoutChild,\n LayoutContext,\n LayoutLine,\n Position,\n} from './types'\nimport { getChildSize, getMargin, isLayoutChild, processNestedContainer } from './utils/child-utils'\nimport { calculateContainerSize, normalizePadding } from './utils/dimension-calculator'\nimport { distributeFlexSpace, hasFlexChildren } from './utils/flex-distributor'\nimport { clampSize, parseSize, resolveSize } from './utils/size-resolver'\nimport { calculateAlignItems, calculateJustifyContent } from './utils/spacing-calculator'\n\n/**\n * Callback function for deferred layout updates\n * Executed after all layouts are complete in next frame\n */\ntype DeferredUpdateCallback = () => void\n\n/**\n * Central processor for deferred layout updates\n * Collects all updates that require final world coordinates or completed parent layouts\n * Executes them in batch via single requestAnimationFrame for optimal performance\n *\n * Use cases:\n * - Overflow mask positioning (needs world coordinates)\n * - Scroll position updates (needs final content size)\n * - Animation initialization (needs final positions)\n * - Custom effects requiring complete layout\n * - Gesture hit area updates (needs final layout size)\n */\nexport class DeferredLayoutQueue {\n private static callbacks: DeferredUpdateCallback[] = []\n private static scheduled = false\n\n /**\n * Schedule a callback to execute after current layout pass completes\n * All callbacks are batched and executed in single requestAnimationFrame\n * @param callback - Function to execute in next frame\n */\n static defer(callback: DeferredUpdateCallback): void {\n this.callbacks.push(callback)\n\n // Schedule flush if not already scheduled (only 1 requestAnimationFrame per frame)\n if (!this.scheduled) {\n this.scheduled = true\n requestAnimationFrame(() => this.flush())\n }\n }\n\n /**\n * Execute all pending callbacks in batch\n * Called once per frame via requestAnimationFrame\n */\n private static flush(): void {\n this.scheduled = false\n\n // Copy and clear callbacks before execution to prevent infinite loops\n const callbacks = [...this.callbacks]\n this.callbacks = []\n\n // Execute all callbacks with error isolation\n for (const callback of callbacks) {\n try {\n callback()\n } catch (error) {\n DebugLogger.error('DeferredLayoutQueue', 'Error in deferred callback:', error)\n }\n }\n }\n}\n\n/**\n * Entry for batched layout calculation\n */\ninterface LayoutBatchEntry {\n container: Phaser.GameObjects.Container\n containerProps: LayoutProps\n parentSize: { width: number; height: number } | undefined\n parentPadding: { horizontal: number; vertical: number } | undefined\n}\n\n/**\n * Batches layout calculations to reduce redundant recalculations\n * Prevents multiple calculations of same container within single synchronous call stack\n * Does NOT defer to next frame - executes immediately after current stack completes\n *\n * Benefits:\n * - Prevents multiple calculations of same container in one update\n * - Bottom-up execution order prevents redundant parent recalculations\n * - No visual flickering (executes in same frame)\n *\n * Usage:\n * - VDOM patches: LayoutBatchQueue.schedule() instead of direct calculateLayout()\n * - Appliers: LayoutBatchQueue.schedule() instead of direct calculateLayout()\n * - Tests: Set LayoutBatchQueue.synchronous = true for immediate execution\n */\nexport class LayoutBatchQueue {\n private static pending = new Map<Phaser.GameObjects.Container, LayoutBatchEntry>()\n private static scheduled = false\n\n /**\n * Enable synchronous mode for testing\n * When true, layouts execute immediately instead of batching\n */\n static synchronous = false\n\n /**\n * Schedule a layout calculation to execute after current call stack\n * Uses microtask (Promise) instead of requestAnimationFrame to avoid flickering\n * If container is already scheduled, updates entry with latest props\n * @param container - Container to calculate layout for\n * @param containerProps - Layout props\n * @param parentSize - Optional parent size for percentage resolution\n * @param parentPadding - Optional parent padding for fill resolution\n */\n static schedule(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n ): void {\n // Synchronous mode for tests - execute immediately\n if (this.synchronous) {\n calculateLayoutImmediate(container, containerProps, parentSize, parentPadding)\n return\n }\n\n // Update or add entry (latest props win if scheduled multiple times)\n this.pending.set(container, { container, containerProps, parentSize, parentPadding })\n\n // Schedule flush if not already scheduled\n // Use microtask (Promise.resolve) instead of requestAnimationFrame\n // This executes in SAME FRAME after current call stack, preventing flickering\n if (!this.scheduled) {\n this.scheduled = true\n Promise.resolve().then(() => this.flush())\n }\n }\n\n /**\n * Execute all pending layout calculations immediately\n * Processes in bottom-up order (deepest children first)\n * This prevents redundant parent recalculations\n */\n static flush(): void {\n this.scheduled = false\n\n if (this.pending.size === 0) return\n\n DebugLogger.time('performance', 'LayoutBatchQueue.flush')\n\n // Copy and clear pending entries\n const entries = Array.from(this.pending.values())\n this.pending.clear()\n\n // Sort bottom-up (deepest containers first)\n // This ensures children are laid out before parents\n entries.sort((a, b) => {\n const depthA = getContainerDepth(a.container)\n const depthB = getContainerDepth(b.container)\n return depthB - depthA // Higher depth = deeper = execute first\n })\n\n // Execute layout calculations in optimal order\n for (const entry of entries) {\n try {\n // Only calculate if container still exists and is active\n if (entry.container.active) {\n calculateLayoutImmediate(\n entry.container,\n entry.containerProps,\n entry.parentSize,\n entry.parentPadding\n )\n }\n } catch (error) {\n DebugLogger.error('LayoutBatchQueue', 'Error calculating layout:', error)\n }\n }\n\n DebugLogger.timeEnd('performance', 'LayoutBatchQueue.flush')\n }\n}\n\n/**\n * Get depth of container in scene hierarchy\n * Root containers have depth 0, children have depth 1, etc.\n * @param container - Container to get depth for\n * @returns Depth level (0 = root)\n */\nfunction getContainerDepth(container: Phaser.GameObjects.Container): number {\n let depth = 0\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let current: Phaser.GameObjects.Container | null = (container as any).parentContainer || null\n\n while (current) {\n depth++\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n current = (current as any).parentContainer || null\n }\n\n return depth\n}\n\n/**\n * Applies or updates a stencil-buffer clip on a container when overflow='hidden'.\n *\n * Replaces the previous filter/geometry-mask approach. The stencil clip:\n * - Needs no separate Graphics game object or world-position tracking\n * - Supports arbitrary nesting via INCR/DECR (each level is its own stencil depth)\n * - Evaluates the world transform at render time, so scroll/animation is free\n * - Supports rounded rectangles via an SDF fragment shader (u_radii=0 → plain rect)\n *\n * @param container - Phaser container to apply the clip to.\n * @param containerProps - Layout props (reads overflow and cornerRadius).\n * @param width - Final container width.\n * @param height - Final container height.\n */\nfunction applyOverflowMask(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps & {\n cornerRadius?: number | { tl?: number; tr?: number; bl?: number; br?: number }\n },\n width: number,\n height: number\n): void {\n const ext = container as typeof container & { __overflowClip?: StencilClipHandle }\n\n if (containerProps.overflow === 'hidden') {\n if (!ext.__overflowClip) {\n const shapeBase: StencilClipShape = { width, height }\n if (containerProps.cornerRadius !== undefined)\n shapeBase.cornerRadius = containerProps.cornerRadius\n container.setStencilClip(shapeBase)\n const handle = container.getStencilClipHandle()\n if (!handle) return\n ext.__overflowClip = handle\n DebugLogger.log('overflowMask', 'Created stencil clip')\n } else {\n const update: Partial<StencilClipShape> = {\n width,\n height,\n cornerRadius: containerProps.cornerRadius ?? 0,\n }\n container.updateStencilClip(update)\n }\n } else if (ext.__overflowClip) {\n container.clearStencilClip()\n delete ext.__overflowClip\n DebugLogger.log('overflowMask', 'Removed stencil clip')\n }\n}\n\n/**\n * Strategy map - reusable strategy instances\n */\nconst strategies: Record<string, LayoutStrategy> = {\n column: new ColumnLayoutStrategy(),\n row: new RowLayoutStrategy(),\n stack: new StackLayoutStrategy(),\n}\n\n/**\n * Invalidates parent layout if container size changed after recalculation\n * Propagates layout changes up the hierarchy to ensure parent containers adapt\n * @param container - Container that was just laid out\n * @param oldSize - Size before layout calculation\n * @param newWidth - New width after layout\n * @param newHeight - New height after layout\n */\ntype LayoutSize = { width: number; height: number }\ntype LayoutCycleState = {\n last: LayoutSize\n prev?: LayoutSize\n count: number\n lastTime: number\n}\n\nconst LAYOUT_CYCLE_EPSILON = 0.5\nconst LAYOUT_CYCLE_TIME_MS = 20\nconst LAYOUT_CYCLE_MAX = 5\nconst LAYOUT_MAX_SIZE = 200000\nconst layoutCycleGuard = new WeakMap<Phaser.GameObjects.Container, LayoutCycleState>()\nconst deferredParentInvalidations = new WeakSet<Phaser.GameObjects.Container>()\n\nfunction isCloseSize(a: LayoutSize, b: LayoutSize, epsilon: number): boolean {\n return Math.abs(a.width - b.width) < epsilon && Math.abs(a.height - b.height) < epsilon\n}\n\nfunction invalidateParentLayoutIfNeeded(\n container: Phaser.GameObjects.Container,\n oldSize: { width: number; height: number } | undefined,\n newWidth: number,\n newHeight: number\n): void {\n // Skip if no old size (first layout) or size unchanged\n if (\n !oldSize ||\n (Math.abs(oldSize.width - newWidth) < LAYOUT_CYCLE_EPSILON &&\n Math.abs(oldSize.height - newHeight) < LAYOUT_CYCLE_EPSILON)\n ) {\n return\n }\n\n if (\n !Number.isFinite(newWidth) ||\n !Number.isFinite(newHeight) ||\n newWidth > LAYOUT_MAX_SIZE ||\n newHeight > LAYOUT_MAX_SIZE\n ) {\n const containerWithProps = container as Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n list?: unknown[]\n }\n DebugLogger.warn('layout', 'Runaway layout size detected, skipping parent invalidation', {\n oldSize,\n newSize: { width: newWidth, height: newHeight },\n containerProps: containerWithProps.__layoutProps,\n childCount: containerWithProps.list?.length ?? 0,\n })\n return\n }\n\n const newSize = { width: newWidth, height: newHeight }\n const now = Date.now()\n\n // Size changed - need to recalculate parent layout\n const parent = container.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n __getLayoutSize?: () => { width: number; height: number }\n })\n | undefined\n\n if (!parent || !parent.__layoutProps) {\n return // No layout parent to invalidate\n }\n\n const guard = layoutCycleGuard.get(container)\n if (guard) {\n const repeatsPrev = guard.prev ? isCloseSize(guard.prev, newSize, LAYOUT_CYCLE_EPSILON) : false\n if (repeatsPrev && now - guard.lastTime < LAYOUT_CYCLE_TIME_MS) {\n guard.count += 1\n } else {\n guard.count = 0\n }\n guard.prev = guard.last\n guard.last = newSize\n guard.lastTime = now\n layoutCycleGuard.set(container, guard)\n\n if (guard.count >= LAYOUT_CYCLE_MAX) {\n DebugLogger.log('layout', 'Layout cycle detected, deferring parent invalidation', {\n container,\n oldSize,\n newSize,\n })\n guard.count = 0\n guard.lastTime = 0\n layoutCycleGuard.set(container, guard)\n deferParentLayoutInvalidation(container)\n return\n }\n } else {\n layoutCycleGuard.set(container, {\n last: newSize,\n count: 0,\n lastTime: now,\n })\n }\n\n DebugLogger.log(\n 'layout',\n 'Container size changed, invalidating parent:',\n `${oldSize.width}x${oldSize.height} -> ${newWidth}x${newHeight}`\n )\n invalidateParentLayout(container)\n}\n\nfunction deferParentLayoutInvalidation(container: Phaser.GameObjects.Container): void {\n if (deferredParentInvalidations.has(container)) {\n return\n }\n\n deferredParentInvalidations.add(container)\n DeferredLayoutQueue.defer(() => {\n deferredParentInvalidations.delete(container)\n invalidateParentLayout(container)\n })\n}\n\nfunction invalidateParentLayout(container: Phaser.GameObjects.Container): void {\n const parent = container.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n __getLayoutSize?: () => { width: number; height: number }\n })\n | undefined\n\n if (!parent || !parent.__layoutProps) {\n return\n }\n\n const grandParent = parent.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n __getLayoutSize?: () => { width: number; height: number }\n })\n | undefined\n\n let grandParentSize: { width: number; height: number } | undefined\n if (grandParent && grandParent.__getLayoutSize) {\n const totalSize = grandParent.__getLayoutSize()\n const padding = (grandParent.__layoutProps?.padding ?? 0) as\n | number\n | { left?: number; right?: number; top?: number; bottom?: number }\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n grandParentSize = {\n width: totalSize.width - normPadding.left - normPadding.right,\n height: totalSize.height - normPadding.top - normPadding.bottom,\n }\n }\n\n calculateLayout(parent, parent.__layoutProps, grandParentSize)\n}\n\n/**\n * Calculate layout for a container and its children immediately (internal)\n * DO NOT CALL DIRECTLY - Use calculateLayout() which batches for performance\n * @param container - Phaser container with children\n * @param containerProps - Layout props of the container\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n */\nfunction calculateLayoutImmediate(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): void {\n const children = container.list as GameObjectWithLayout[]\n\n // Store old size before layout calculation for parent invalidation\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => { width: number; height: number }\n }\n const oldContainerSize = containerWithLayout.__getLayoutSize?.()\n\n // Debug: Track excessive layout calls\n // console.log('[LAYOUT] calculateLayout called for container with', children?.length ?? 0, 'children')\n\n if (!children || !Array.isArray(children)) {\n return\n }\n\n // Performance timing\n DebugLogger.time('performance', 'calculateLayout')\n\n // 1. Extract layout parameters\n const direction = containerProps.direction ?? 'column'\n const padding = normalizePadding(containerProps.padding)\n const gap = normalizeGap(containerProps.gap)\n const justifyContent = containerProps.justifyContent ?? 'start'\n\n DebugLogger.log('layout', `Direction: ${direction}, Padding:`, padding)\n\n // 2a. Pre-calculate container size if possible (needed for percentage children and nested containers)\n // This allows percentage-based child sizes to resolve correctly and nested containers\n // to receive the correct content-area as their parent size\n let currentContainerSize: { width: number; height: number } | undefined\n\n // Try to calculate width early if we have explicit width or can resolve from parent\n const parsedWidth = parseSize(containerProps.width)\n const canCalculateWidth =\n parsedWidth.type === 'fixed' ||\n (parentSize?.width !== undefined &&\n (parsedWidth.type === 'percent' ||\n parsedWidth.type === 'fill' ||\n parsedWidth.type === 'calc'))\n\n const width = canCalculateWidth\n ? resolveSize(parsedWidth, parentSize?.width, container.width, parentPadding?.horizontal)\n : undefined\n\n // Try to calculate height early if we have explicit height or can resolve from parent\n const parsedHeight = parseSize(containerProps.height)\n const canCalculateHeight =\n parsedHeight.type === 'fixed' ||\n (parentSize?.height !== undefined &&\n (parsedHeight.type === 'percent' ||\n parsedHeight.type === 'fill' ||\n parsedHeight.type === 'calc'))\n\n const height = canCalculateHeight\n ? resolveSize(parsedHeight, parentSize?.height, container.height, parentPadding?.vertical)\n : undefined\n\n // Set currentContainerSize if we could calculate at least one dimension\n if (width !== undefined || height !== undefined) {\n // Apply constraints\n const clampedWidth =\n width !== undefined\n ? clampSize(\n width,\n containerProps.minWidth,\n containerProps.maxWidth,\n parentSize?.width,\n container.width,\n parentPadding?.horizontal\n )\n : container.width\n const clampedHeight =\n height !== undefined\n ? clampSize(\n height,\n containerProps.minHeight,\n containerProps.maxHeight,\n parentSize?.height,\n container.height,\n parentPadding?.vertical\n )\n : container.height\n\n currentContainerSize = {\n width: clampedWidth,\n height: clampedHeight,\n }\n }\n\n // Calculate available content size (container minus padding) for child size resolution\n // This allows 'fill' and percentage sizes to resolve correctly relative to content area\n const availableContentSize = currentContainerSize\n ? {\n width: currentContainerSize.width - padding.left - padding.right,\n height: currentContainerSize.height - padding.top - padding.bottom,\n }\n : undefined\n\n DebugLogger.log('layout', 'Pre-calculated container size:', currentContainerSize)\n DebugLogger.log('layout', 'Available content size (for fill):', availableContentSize)\n\n // 2. Prepare layout children (filter backgrounds, headless objects, process nested containers)\n const layoutChildren: LayoutChild[] = []\n\n for (const child of children) {\n // Skip non-layout children (backgrounds, headless objects, missing __getLayoutSize)\n if (!isLayoutChild(child)) {\n DebugLogger.log('layout', 'Skipping non-layout child:', {\n isBackground: child.__isBackground,\n headless: child.__layoutProps?.headless,\n hasLayoutSize: typeof child.__getLayoutSize === 'function',\n })\n continue\n } // Skip processing nested containers with flex (they need parent size first)\n const hasFlex = (child.__layoutProps?.flex ?? 0) > 0\n if (!hasFlex) {\n // Process nested containers - pass content-area (size minus padding) as parent size\n // This ensures nested children see the correct available space\n const parentSizeForNested = currentContainerSize\n ? {\n width: currentContainerSize.width - padding.left - padding.right,\n height: currentContainerSize.height - padding.top - padding.bottom,\n }\n : parentSize\n ? {\n width: parentSize.width - (parentPadding?.horizontal ?? 0),\n height: parentSize.height - (parentPadding?.vertical ?? 0),\n }\n : undefined\n\n processNestedContainer(\n child,\n calculateLayout,\n parentSizeForNested,\n undefined // No padding offset needed since we pass content-area\n )\n }\n\n // Get child size - pass content-area (container size minus padding) for % and fill\n // This way percentages and fill are relative to available content space\n const contentAreaForChild = currentContainerSize\n ? {\n width: currentContainerSize.width - padding.left - padding.right,\n height: currentContainerSize.height - padding.top - padding.bottom,\n }\n : parentSize\n ? {\n width: parentSize.width - (parentPadding?.horizontal ?? 0),\n height: parentSize.height - (parentPadding?.vertical ?? 0),\n }\n : undefined\n\n const size = getChildSize(child, contentAreaForChild, undefined)\n const margin = getMargin(child)\n\n layoutChildren.push({ child, size, margin })\n }\n\n // 3. Select strategy based on direction\n const strategy = strategies[direction]\n if (!strategy) {\n DebugLogger.error('Layout', `Unknown direction: ${direction}`)\n return\n }\n\n // 4. Build layout context (will be used after we know container dimensions)\n const contextPartial = {\n containerProps,\n padding,\n gap,\n children: layoutChildren,\n }\n\n // 5. Calculate metrics using strategy\n const metrics = strategy.calculateMetrics(layoutChildren, contextPartial as LayoutContext)\n\n // 5a. Check if wrapping is enabled\n const flexWrap = containerProps.flexWrap ?? 'nowrap'\n const shouldWrap = flexWrap !== 'nowrap' && direction !== 'stack'\n\n // 6. Calculate container dimensions (with parent size and padding for resolution)\n const { width: containerWidth, height: containerHeight } = calculateContainerSize(\n containerProps,\n metrics,\n padding,\n direction,\n gap,\n layoutChildren.length,\n parentSize,\n parentPadding\n )\n\n // 6a. Distribute flex space if there are flex children (skip if wrapping - will be done per line)\n let finalLayoutChildren = layoutChildren\n if (hasFlexChildren(layoutChildren) && !shouldWrap) {\n const contentSize =\n direction === 'row'\n ? containerWidth - padding.left - padding.right\n : containerHeight - padding.top - padding.bottom\n\n // Subtract gap space (gap appears between children, so n-1 gaps for n children)\n const gapValue = direction === 'row' ? gap.horizontal : gap.vertical\n const totalGapSpace = layoutChildren.length > 1 ? gapValue * (layoutChildren.length - 1) : 0\n const availableMainSpace = contentSize - totalGapSpace\n\n finalLayoutChildren = distributeFlexSpace(layoutChildren, availableMainSpace, direction)\n\n // Process nested flex containers now that they have their size\n for (const layoutChild of finalLayoutChildren) {\n const props = layoutChild.child.__layoutProps\n const isFlexItem =\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n if (isFlexItem) {\n // Temporarily set explicit size based on flex calculation\n const originalProps = { ...layoutChild.child.__layoutProps }\n if (direction === 'row') {\n layoutChild.child.__layoutProps = {\n ...layoutChild.child.__layoutProps,\n width: layoutChild.size.width,\n }\n } else {\n layoutChild.child.__layoutProps = {\n ...layoutChild.child.__layoutProps,\n height: layoutChild.size.height,\n }\n }\n\n processNestedContainer(\n layoutChild.child,\n calculateLayout,\n {\n width: containerWidth,\n height: containerHeight,\n },\n {\n horizontal: padding.left + padding.right,\n vertical: padding.top + padding.bottom,\n }\n )\n\n // Restore original props\n layoutChild.child.__layoutProps = originalProps\n }\n }\n\n // Recalculate metrics with updated sizes\n const updatedMetrics = strategy.calculateMetrics(\n finalLayoutChildren,\n contextPartial as LayoutContext\n )\n metrics.totalMainSize = updatedMetrics.totalMainSize\n if (direction === 'column') {\n metrics.maxWidth = updatedMetrics.maxWidth\n } else if (direction === 'row') {\n metrics.maxHeight = updatedMetrics.maxHeight\n }\n }\n\n // 7. Calculate content area\n const contentArea = {\n width: containerWidth - padding.left - padding.right,\n height: containerHeight - padding.top - padding.bottom,\n }\n\n // 8. Complete layout context\n const context: LayoutContext = {\n ...contextPartial,\n children: finalLayoutChildren,\n contentArea,\n parentSize: {\n width: containerWidth,\n height: containerHeight,\n },\n }\n\n // 9. Calculate spacing for justifyContent\n const availableMainSpace = direction === 'row' ? contentArea.width : contentArea.height\n // Calculate total gap space (gaps between children, not before first or after last)\n const gapValue = direction === 'row' ? gap.horizontal : gap.vertical\n const totalGapSpace =\n finalLayoutChildren.length > 1 ? gapValue * (finalLayoutChildren.length - 1) : 0\n const remainingSpace = availableMainSpace - metrics.totalMainSize - totalGapSpace\n\n let mainStart = 0\n let spaceBetween = 0\n\n // For stack direction, justifyContent is not applicable\n if (direction !== 'stack') {\n const justifyResult = calculateJustifyContent(\n justifyContent,\n remainingSpace,\n finalLayoutChildren.length\n )\n mainStart = justifyResult.mainStart\n spaceBetween = justifyResult.spaceBetween\n }\n\n // 9a. Apply stretch if alignItems is 'stretch'\n const alignItems = containerProps.alignItems ?? 'start'\n if (alignItems === 'stretch' && direction !== 'stack') {\n for (const layoutChild of finalLayoutChildren) {\n const margin = getMargin(layoutChild.child)\n const child = layoutChild.child\n\n if (direction === 'row') {\n // Stretch height to full cross-axis (minus margins)\n const stretchHeight = contentArea.height - (margin.top ?? 0) - (margin.bottom ?? 0)\n layoutChild.size.height = Math.max(0, stretchHeight)\n\n // If child is a container with layout props, update its height prop and recalculate nested layout\n if (child.__layoutProps) {\n const originalHeight = child.__layoutProps.height\n child.__layoutProps = { ...child.__layoutProps, height: stretchHeight }\n\n // Recalculate nested container layout with new height\n processNestedContainer(child, calculateLayout, {\n width: containerWidth,\n height: containerHeight,\n })\n\n // Restore original height prop (in case it was percentage or undefined)\n child.__layoutProps = { ...child.__layoutProps, height: originalHeight }\n }\n } else if (direction === 'column') {\n // Stretch width to full cross-axis (minus margins)\n const stretchWidth = contentArea.width - (margin.left ?? 0) - (margin.right ?? 0)\n layoutChild.size.width = Math.max(0, stretchWidth)\n\n // If child is a container with layout props, update its width prop and recalculate nested layout\n if (child.__layoutProps) {\n const originalWidth = child.__layoutProps.width\n child.__layoutProps = { ...child.__layoutProps, width: stretchWidth }\n\n // Recalculate nested container layout with new width\n processNestedContainer(child, calculateLayout, {\n width: containerWidth,\n height: containerHeight,\n })\n\n // Restore original width prop (in case it was percentage or undefined)\n child.__layoutProps = { ...child.__layoutProps, width: originalWidth }\n }\n }\n }\n }\n\n // 10. Handle wrapping if enabled\n const positions: Position[] = []\n let adjustedContainerWidth = containerWidth\n let adjustedContainerHeight = containerHeight\n\n if (shouldWrap && 'wrapChildren' in strategy) {\n // Wrap children into multiple lines\n const availableMainSize = direction === 'row' ? contentArea.width : contentArea.height\n const mainGapValue = direction === 'row' ? gap.horizontal : gap.vertical\n const lines = (strategy as RowLayoutStrategy | ColumnLayoutStrategy).wrapChildren(\n finalLayoutChildren,\n availableMainSize,\n mainGapValue\n )\n\n if (flexWrap === 'wrap-reverse') {\n lines.reverse()\n }\n\n // Calculate total cross size needed for all lines\n const totalCrossSize = lines.reduce(\n (sum: number, line: LayoutLine) => sum + line.crossAxisSize,\n 0\n )\n const crossGapValue = direction === 'row' ? gap.vertical : gap.horizontal\n const totalLineGaps = (lines.length - 1) * crossGapValue\n\n // Adjust container dimensions if auto-sizing and wrapping occurred\n if (\n direction === 'row' &&\n (containerProps.height === undefined || containerProps.height === 'auto')\n ) {\n // For row direction with auto-height, calculate height based on wrapped lines\n adjustedContainerHeight = totalCrossSize + totalLineGaps + padding.top + padding.bottom\n } else if (\n direction === 'column' &&\n (containerProps.width === undefined || containerProps.width === 'auto')\n ) {\n // For column direction with auto-width, calculate width based on wrapped lines\n adjustedContainerWidth = totalCrossSize + totalLineGaps + padding.left + padding.right\n }\n\n const availableCrossSize = direction === 'row' ? contentArea.height : contentArea.width\n const freeCrossSpace = availableCrossSize - totalCrossSize - totalLineGaps\n\n // Apply alignContent to distribute lines\n const alignContent = containerProps.alignContent ?? 'stretch'\n let crossOffset = 0\n let lineCrossSpacing = 0\n\n if (alignContent === 'center') {\n crossOffset = freeCrossSpace / 2\n } else if (alignContent === 'end') {\n crossOffset = freeCrossSpace\n } else if (alignContent === 'space-between' && lines.length > 1) {\n lineCrossSpacing = freeCrossSpace / (lines.length - 1)\n } else if (alignContent === 'space-around') {\n lineCrossSpacing = freeCrossSpace / lines.length\n crossOffset = lineCrossSpacing / 2\n }\n\n // Position children line by line\n for (const line of lines) {\n // Apply flex distribution per line if line has flex children\n let lineChildren = line.children\n if (hasFlexChildren(line.children)) {\n const lineGapSpace = (line.children.length - 1) * mainGapValue\n const lineAvailableSpace = availableMainSize - lineGapSpace\n lineChildren = distributeFlexSpace(line.children, lineAvailableSpace, direction)\n\n // Update line main size after flex distribution\n line.mainAxisSize = lineChildren.reduce((sum: number, child: LayoutChild) => {\n const size = direction === 'row' ? child.size.width : child.size.height\n const margin = getMargin(child.child)\n const marginSize =\n direction === 'row'\n ? (margin.left ?? 0) + (margin.right ?? 0)\n : (margin.top ?? 0) + (margin.bottom ?? 0)\n return sum + size + marginSize\n }, 0)\n }\n\n // Calculate line-specific justifyContent\n const lineMainSize = line.mainAxisSize\n const lineAvailableMain = availableMainSize\n const lineRemainingSpace = lineAvailableMain - lineMainSize\n const lineGapSpace = (line.children.length - 1) * mainGapValue\n const lineFreeSpace = lineRemainingSpace - lineGapSpace\n\n const lineJustifyResult = calculateJustifyContent(\n justifyContent,\n lineFreeSpace,\n line.children.length\n )\n\n let lineMainOffset = lineJustifyResult.mainStart\n const lineSpaceBetween = lineJustifyResult.spaceBetween\n\n // Position each child in the line\n for (let i = 0; i < lineChildren.length; i++) {\n const child = lineChildren[i]\n if (!child) continue\n\n const margin = getMargin(child.child)\n\n let x: number\n let y: number\n\n if (direction === 'row') {\n // Main axis: horizontal\n lineMainOffset += margin.left ?? 0\n x = padding.left + lineMainOffset\n\n // Cross axis: vertical\n const childCrossOffset = calculateAlignItems(\n alignItems,\n line.crossAxisSize,\n child.size.height,\n margin.top ?? 0,\n margin.bottom ?? 0\n )\n y = padding.top + crossOffset + childCrossOffset\n\n lineMainOffset += child.size.width + (margin.right ?? 0)\n if (i < lineChildren.length - 1) {\n lineMainOffset += mainGapValue + lineSpaceBetween\n }\n } else {\n // Main axis: vertical\n lineMainOffset += margin.top ?? 0\n y = padding.top + lineMainOffset\n\n // Cross axis: horizontal\n const childCrossOffset = calculateAlignItems(\n alignItems,\n line.crossAxisSize,\n child.size.width,\n margin.left ?? 0,\n margin.right ?? 0\n )\n x = padding.left + crossOffset + childCrossOffset\n\n lineMainOffset += child.size.height + (margin.bottom ?? 0)\n if (i < lineChildren.length - 1) {\n lineMainOffset += mainGapValue + lineSpaceBetween\n }\n }\n\n // Find child index in original array for correct position assignment\n const childIndex = finalLayoutChildren.indexOf(child)\n if (childIndex !== -1) {\n positions[childIndex] = { x, y }\n }\n }\n\n // Move to next line\n crossOffset += line.crossAxisSize + crossGapValue + lineCrossSpacing\n }\n } else {\n // No wrapping - use original single-line positioning\n let currentMain = mainStart\n\n for (let i = 0; i < finalLayoutChildren.length; i++) {\n const child = finalLayoutChildren[i]\n if (!child) continue\n\n const result = strategy.positionChild(child, i, context, currentMain)\n\n positions.push(result.position)\n currentMain = result.nextMain\n\n // Add gap and space-between spacing (not for stack)\n if (direction !== 'stack' && i < finalLayoutChildren.length - 1) {\n currentMain += gapValue + spaceBetween\n }\n }\n }\n\n // 11. Apply positions to children\n applyChildPositions(finalLayoutChildren, positions)\n\n // 12. Apply container dimensions (use adjusted dimensions if wrapping changed them)\n applyContainerDimensions(container, adjustedContainerWidth, adjustedContainerHeight)\n\n // 13. Update background and hit area\n updateBackground(container, adjustedContainerWidth, adjustedContainerHeight)\n\n updateHitArea(container, adjustedContainerWidth, adjustedContainerHeight)\n\n // 14. Apply overflow mask if needed\n applyOverflowMask(container, containerProps, adjustedContainerWidth, adjustedContainerHeight)\n\n // End performance timing\n DebugLogger.timeEnd('performance', 'calculateLayout')\n\n // 15. Propagate layout changes to parent if size changed\n // This ensures parent containers resize when child content changes\n invalidateParentLayoutIfNeeded(\n container,\n oldContainerSize,\n adjustedContainerWidth,\n adjustedContainerHeight\n )\n}\n\n/**\n * Calculate layout for a container and its children\n * Batches layout calculations for optimal performance\n * Multiple calls within same frame are deduplicated and executed bottom-up\n * @param container - Phaser container with children\n * @param containerProps - Layout props of the container\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n */\nexport function calculateLayout(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): void {\n LayoutBatchQueue.schedule(container, containerProps, parentSize, parentPadding)\n}\n","/**\n * Layout property applier for updating container layout configuration\n */\nimport * as Phaser from 'phaser'\nimport equal from '../../utils/fast-deep-equal'\nimport type { BackgroundProps, LayoutProps } from '../../core-props'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport { calculateLayout, type LayoutSize } from '../../layout/index'\n\n/**\n * Updates gesture hit area based on current layout size\n * Called after layout recalculation to sync hit area with actual container size\n * @param node - Container with potential gesture registration\n */\nfunction updateGestureHitAreaIfNeeded(node: Phaser.GameObjects.Container): void {\n const containerWithLayout = node as typeof node & {\n __getLayoutSize?: () => LayoutSize\n scene: Phaser.Scene\n }\n\n // Only update if container has gesture system enabled and layout size available\n if (!containerWithLayout.__getLayoutSize) return\n\n try {\n const manager = getGestureManager(containerWithLayout.scene)\n const size = containerWithLayout.__getLayoutSize()\n const hitArea = new Phaser.Geom.Rectangle(0, 0, size.width, size.height)\n manager.updateHitArea(node, hitArea)\n } catch {\n // Gesture manager or container not registered, ignore\n }\n}\n\n/**\n * Layout-relevant props that trigger layout recalculation when changed\n */\nconst LAYOUT_RELEVANT_PROPS: (keyof LayoutProps)[] = [\n 'width',\n 'height',\n 'minWidth',\n 'maxWidth',\n 'minHeight',\n 'maxHeight',\n 'flex',\n 'margin',\n 'padding',\n 'gap',\n 'direction',\n 'justifyContent',\n 'alignItems',\n 'overflow',\n]\n\n/**\n * Object props that need deep comparison\n */\nconst DEEP_COMPARE_PROPS = new Set(['margin', 'padding'])\n\n/**\n * Check if any layout-relevant prop changed\n * Uses shallow equality for primitives and deep equality for objects\n * @param prev - Previous props\n * @param next - New props\n * @returns True if any layout prop changed\n */\nfunction hasLayoutPropsChanged(\n prev: Partial<LayoutProps & BackgroundProps>,\n next: Partial<LayoutProps & BackgroundProps>\n): boolean {\n for (const prop of LAYOUT_RELEVANT_PROPS) {\n const oldVal = prev[prop]\n const newVal = next[prop]\n\n // Use deep comparison for object props (margin, padding)\n if (DEEP_COMPARE_PROPS.has(prop as string)) {\n if (!equal(oldVal, newVal)) {\n return true\n }\n } else {\n // Shallow comparison for primitives\n if (oldVal !== newVal) {\n return true\n }\n }\n }\n return false\n}\n\n/**\n * Calculates parent size and padding from parent container's layout\n * Falls back to viewport size for root containers without a parent\n * @param node - Container node to get parent info for\n * @returns Parent size and padding if parent is a layout container\n */\nfunction getParentLayoutContext(node: Phaser.GameObjects.Container): {\n parentSize?: { width: number; height: number }\n parentPadding?: { horizontal: number; vertical: number }\n} {\n const parent = node.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n __getLayoutSize?: () => LayoutSize\n })\n | undefined\n\n // If has layout parent, use its content-area\n if (parent && parent.__layoutProps && parent.__getLayoutSize) {\n const parentSize = parent.__getLayoutSize()\n const padding = parent.__layoutProps.padding ?? 0\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n\n return {\n parentSize: {\n width: parentSize.width - normPadding.left - normPadding.right,\n height: parentSize.height - normPadding.top - normPadding.bottom,\n },\n // Parent already provides content-area, no padding offset needed\n }\n }\n\n // Fallback: Root container without layout parent - use viewport as parent size\n // This allows percentage-based sizing/constraints to work on root containers\n if (node.scene) {\n return {\n parentSize: {\n width: node.scene.scale.width,\n height: node.scene.scale.height,\n },\n }\n }\n\n return {}\n}\n\n/**\n * Applies layout property changes to a container\n * Handles width, height, direction, padding, margin updates\n * Triggers layout recalculation when:\n * 1. Layout-relevant props changed, OR\n * 2. This is being called from host.patch (which means VDOM will handle child changes)\n * @param node - Phaser container node\n * @param prev - Previous layout props\n * @param next - New layout props\n */\nexport function applyLayoutProps(\n node: Phaser.GameObjects.Container & { __layoutProps?: LayoutProps & BackgroundProps },\n prev: Partial<LayoutProps & BackgroundProps>,\n next: Partial<LayoutProps & BackgroundProps>\n): void {\n // Update stored layout props (includes visible for display control)\n node.__layoutProps = next as LayoutProps & BackgroundProps\n\n // IMPORTANT: We only recalculate if container's own props changed\n // Children changes are handled by VDOM patchVNode() which has smarter detection\n // This prevents double-calculation while still catching container prop changes\n if (hasLayoutPropsChanged(prev, next)) {\n // Get parent layout context for percentage/fill resolution\n const { parentSize, parentPadding } = getParentLayoutContext(node)\n calculateLayout(node, next, parentSize, parentPadding)\n // Update gesture hit area after layout recalculation\n // This ensures hit area matches actual container size (important for auto-sized containers)\n updateGestureHitAreaIfNeeded(node)\n }\n // Note: If children changed (text content, child added/removed, etc.),\n // the VDOM layer will detect that and call calculateLayout separately\n}\n","/**\n * Color system types for PhaserJSX UI\n * Provides semantic color tokens with named shade levels\n */\n\n/**\n * Named shade levels for color scales\n * Uses semantic names instead of numeric values\n */\nexport type ShadeLevel = 'lightest' | 'light' | 'medium' | 'dark' | 'darkest'\n\n/**\n * Hex color with conversion method for Phaser compatibility\n * Wraps a string value and provides toNumber() for Phaser color integration\n */\nexport class HexColor {\n readonly #value: string\n\n constructor(hex: string) {\n this.#value = hex\n }\n\n /**\n * Convert to Phaser number format\n * @returns Color as number (0xffffff)\n */\n toNumber(): number {\n return parseInt(this.#value.replace('#', ''), 16)\n }\n\n /**\n * Return the hex string value\n * @returns Hex color string\n */\n toString(): string {\n return this.#value\n }\n\n /**\n * Primitive string value for coercion contexts\n * @returns Hex color string\n */\n valueOf(): string {\n return this.#value\n }\n\n /**\n * Create a HexColor from a hex string\n * @param hex - Hex color string\n */\n static from(hex: string): HexColor {\n return new HexColor(hex)\n }\n}\n\n/**\n * Color shade scale with semantic naming\n * Each color token has multiple shades for different use cases\n * Uses HexColor type for VS Code color picker support and .toNumber() method\n * DEFAULT is an alias for medium\n * @example\n * ```typescript\n * const primaryShade: ColorShade = {\n * lightest: HexColor.from('#e3f2fd'),\n * light: HexColor.from('#90caf9'),\n * medium: HexColor.from('#42a5f5'),\n * dark: HexColor.from('#1976d2'),\n * darkest: HexColor.from('#0d47a1'),\n * DEFAULT: HexColor.from('#42a5f5'), // alias to medium\n * }\n * // Usage:\n * backgroundColor: colors.primary.DEFAULT.toNumber() // same as medium\n * backgroundColor: colors.primary.medium.toNumber()\n * ```\n */\nexport interface ColorShade {\n /** Lightest shade - backgrounds, hover states */\n lightest: HexColor\n /** Light shade - secondary elements */\n light: HexColor\n /** Medium shade - interactive elements (also available as DEFAULT) */\n medium: HexColor\n /** Dark shade - borders, dividers */\n dark: HexColor\n /** Darkest shade - text, emphasis */\n darkest: HexColor\n /** DEFAULT shade - alias for medium */\n readonly DEFAULT: HexColor\n}\n\n/**\n * Complete color token system with semantic color categories\n * Designed for global theme usage with nested theme support\n */\nexport interface ColorTokens {\n /** Primary brand color - main actions and emphasis */\n primary: ColorShade\n /** Secondary brand color - supporting actions */\n secondary: ColorShade\n /** Accent color - highlights and special elements */\n accent: ColorShade\n\n /** Success state color - confirmations, positive feedback */\n success: ColorShade\n /** Warning state color - cautions, alerts */\n warning: ColorShade\n /** Error state color - errors, destructive actions */\n error: ColorShade\n /** Info state color - informational messages */\n info: ColorShade\n\n /** Background colors - main app backgrounds */\n background: ColorShade\n /** Surface colors - cards, panels, elevated elements */\n surface: ColorShade\n /** Text colors - typography hierarchy */\n text: ColorShade\n /** Border colors - dividers, outlines */\n border: ColorShade\n}\n\n/**\n * Color mode enum for light/dark theme switching\n */\nexport type ColorMode = 'light' | 'dark'\n\n/**\n * RGB color representation\n */\nexport interface RGBColor {\n r: number\n g: number\n b: number\n}\n","/**\n * Color utility functions for PhaserJSX UI\n * Provides conversion between formats and color manipulation\n */\n\nimport type { TextStyleToken } from '../design-tokens'\nimport { HexColor, type RGBColor } from './color-types'\n\n/**\n * Convert hex string to Phaser number format\n * @param hex - Hex color string (e.g., '#ffffff' or 'ffffff')\n * @returns Phaser color number (e.g., 0xffffff)\n * @example\n * ```typescript\n * hexToNumber('#ff0000') // returns 0xff0000\n * hexToNumber('00ff00') // returns 0x00ff00\n * ```\n */\nexport function hexToNumber(hex: string): number {\n const cleaned = hex.replace('#', '')\n return parseInt(cleaned, 16)\n}\n\n/**\n * Convert Phaser number format to hex string\n * @param num - Phaser color number (e.g., 0xffffff)\n * @param withHash - Include '#' prefix (default: true)\n * @returns Hex color string (e.g., '#ffffff')\n * @example\n * ```typescript\n * numberToHex(0xff0000) // returns '#ff0000'\n * numberToHex(0x00ff00, false) // returns '00ff00'\n * ```\n */\nexport function numberToHex(num: number, withHash = true): string {\n const hex = normalizeColorNumber(num).toString(16).padStart(6, '0')\n return withHash ? `#${hex}` : hex\n}\n\n/**\n * Normalize a color number to Phaser's 0x000000-0xffffff RGB range.\n * @param color - Color number to normalize\n * @returns RGB color number in the 24-bit range\n */\nexport function normalizeColorNumber(color: number): number {\n if (!Number.isFinite(color)) return 0x000000\n return Math.max(0, Math.round(color)) & 0xffffff\n}\n\n/**\n * Convert RGB values to Phaser number format\n * @param r - Red component (0-255)\n * @param g - Green component (0-255)\n * @param b - Blue component (0-255)\n * @returns Phaser color number\n * @example\n * ```typescript\n * rgbToNumber(255, 0, 0) // returns 0xff0000 (red)\n * rgbToNumber(0, 255, 0) // returns 0x00ff00 (green)\n * rgbToNumber(255, 255, 255) // returns 0xffffff (white)\n * ```\n */\nexport function rgbToNumber(r: number, g: number, b: number): number {\n return ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)\n}\n\n/**\n * Convert Phaser number to RGB components\n * @param num - Phaser color number\n * @returns RGB color object\n * @example\n * ```typescript\n * numberToRgb(0xff0000) // returns { r: 255, g: 0, b: 0 }\n * numberToRgb(0x00ff00) // returns { r: 0, g: 255, b: 0 }\n * ```\n */\nexport function numberToRgb(num: number): RGBColor {\n const normalized = normalizeColorNumber(num)\n\n return {\n r: (normalized >> 16) & 0xff,\n g: (normalized >> 8) & 0xff,\n b: normalized & 0xff,\n }\n}\n\n/**\n * HSL color representation\n */\nexport interface HSLColor {\n /** Hue in normalized range (0.0 to 1.0) */\n h: number\n /** Saturation in normalized range (0.0 to 1.0) */\n s: number\n /** Lightness in normalized range (0.0 to 1.0) */\n l: number\n}\n\n/**\n * Convert RGB values to HSL values (normalized 0.0 to 1.0)\n * @param r - Red component (0-255)\n * @param g - Green component (0-255)\n * @param b - Blue component (0-255)\n * @returns HSL color values with normalized components\n * @example\n * ```typescript\n * rgbToHsl(255, 0, 0) // returns { h: 0, s: 1, l: 0.5 }\n * rgbToHsl(0, 255, 0) // returns { h: 0.333..., s: 1, l: 0.5 }\n * ```\n */\nexport function rgbToHsl(r: number, g: number, b: number): HSLColor {\n const red = r / 255\n const green = g / 255\n const blue = b / 255\n const max = Math.max(red, green, blue)\n const min = Math.min(red, green, blue)\n const delta = max - min\n const light = (max + min) / 2\n\n if (delta === 0) {\n return { h: 0, s: 0, l: light }\n }\n\n const saturationValue = light > 0.5 ? delta / (2 - max - min) : delta / (max + min)\n let hueValue: number\n if (max === red) {\n hueValue = (green - blue) / delta + (green < blue ? 6 : 0)\n } else if (max === green) {\n hueValue = (blue - red) / delta + 2\n } else {\n hueValue = (red - green) / delta + 4\n }\n return { h: hueValue / 6, s: saturationValue, l: light }\n}\n\n/**\n * Convert normalized HSL values to RGB components.\n * @param h - Hue in normalized range (0.0 to 1.0)\n * @param s - Saturation in normalized range (0.0 to 1.0)\n * @param l - Lightness in normalized range (0.0 to 1.0)\n * @returns RGB color object\n */\nexport function hslToRgb(h: number, s: number, l: number): RGBColor {\n const hue = (((Number.isFinite(h) ? h : 0) % 1) + 1) % 1\n const saturation = Math.max(0, Math.min(1, Number.isFinite(s) ? s : 0))\n const lightness = Math.max(0, Math.min(1, Number.isFinite(l) ? l : 0))\n\n if (saturation === 0) {\n const value = Math.round(lightness * 255)\n return { r: value, g: value, b: value }\n }\n\n const hueToRgb = (p: number, q: number, t: number): number => {\n let next = t\n if (next < 0) next += 1\n if (next > 1) next -= 1\n if (next < 1 / 6) return p + (q - p) * 6 * next\n if (next < 1 / 2) return q\n if (next < 2 / 3) return p + (q - p) * (2 / 3 - next) * 6\n return p\n }\n\n const q =\n lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation\n const p = 2 * lightness - q\n\n return {\n r: Math.round(hueToRgb(p, q, hue + 1 / 3) * 255),\n g: Math.round(hueToRgb(p, q, hue) * 255),\n b: Math.round(hueToRgb(p, q, hue - 1 / 3) * 255),\n }\n}\n\n/**\n * Convert normalized HSL values to Phaser number format.\n * @param h - Hue in normalized range (0.0 to 1.0)\n * @param s - Saturation in normalized range (0.0 to 1.0)\n * @param l - Lightness in normalized range (0.0 to 1.0)\n * @returns Phaser color number\n */\nexport function hslToNumber(h: number, s: number, l: number): number {\n const rgb = hslToRgb(h, s, l)\n return rgbToNumber(rgb.r, rgb.g, rgb.b)\n}\n\n/**\n * Convert Phaser number format to normalized HSL values.\n * @param color - Phaser color number\n * @returns HSL color values with normalized components\n */\nexport function numberToHsl(color: number): HSLColor {\n const rgb = numberToRgb(color)\n return rgbToHsl(rgb.r, rgb.g, rgb.b)\n}\n\n/**\n * Lighten a color by a given amount\n * @param color - Phaser color number\n * @param amount - Amount to lighten (0.0 to 1.0, where 1.0 is white)\n * @returns Lightened color number\n * @example\n * ```typescript\n * lighten(0x0000ff, 0.3) // returns lighter blue\n * lighten(0xff0000, 0.5) // returns light red/pink\n * ```\n */\nexport function lighten(color: number, amount: number): number {\n const rgb = numberToRgb(color)\n const factor = Math.max(0, Math.min(1, amount))\n\n const r = Math.round(rgb.r + (255 - rgb.r) * factor)\n const g = Math.round(rgb.g + (255 - rgb.g) * factor)\n const b = Math.round(rgb.b + (255 - rgb.b) * factor)\n\n return rgbToNumber(r, g, b)\n}\n\n/**\n * Darken a color by a given amount\n * @param color - Phaser color number\n * @param amount - Amount to darken (0.0 to 1.0, where 1.0 is black)\n * @returns Darkened color number\n * @example\n * ```typescript\n * darken(0x0000ff, 0.3) // returns darker blue\n * darken(0xff0000, 0.5) // returns dark red\n * ```\n */\nexport function darken(color: number, amount: number): number {\n const rgb = numberToRgb(color)\n const factor = 1 - Math.max(0, Math.min(1, amount))\n\n const r = Math.round(rgb.r * factor)\n const g = Math.round(rgb.g * factor)\n const b = Math.round(rgb.b * factor)\n\n return rgbToNumber(r, g, b)\n}\n\n/**\n * Lighten a hex color by a given amount\n * @param hex - Hex color (e.g., '#ffffff' or 'ffffff')\n * @param amount - Amount to lighten (0.0 to 1.0, where 1.0 is white)\n * @returns Lightened hex color string with '#' prefix\n * @example\n * ```typescript\n * lightenHex('#0000ff', 0.3) // returns lighter blue\n * lightenHex('#ff0000', 0.5) // returns light red/pink\n * ```\n */\nexport function lightenHex(hex: string, amount: number): HexColor {\n const num = hexToNumber(hex)\n const lightened = lighten(num, amount)\n return HexColor.from(numberToHex(lightened))\n}\n\n/**\n * Darken a hex color by a given amount\n * @param hex - Hex color (e.g., '#ffffff' or 'ffffff')\n * @param amount - Amount to darken (0.0 to 1.0, where 1.0 is black)\n * @returns Darkened hex color string with '#' prefix\n * @example\n * ```typescript\n * darkenHex('#0000ff', 0.3) // returns darker blue\n * darkenHex('#ff0000', 0.5) // returns dark red\n * ```\n */\nexport function darkenHex(hex: string, amount: number): HexColor {\n const num = hexToNumber(hex)\n const darkened = darken(num, amount)\n return HexColor.from(numberToHex(darkened))\n}\n\n/**\n * Convert color to rgba string for Phaser Text style\n * @param color - Phaser color number\n * @param alphaValue - Alpha value (0.0 to 1.0, default: 1.0)\n * @returns RGBA string usable in Text style (e.g., 'rgba(255, 0, 0, 0.5)')\n * @example\n * ```typescript\n * alpha(0xff0000, 1.0) // returns 'rgba(255, 0, 0, 1)'\n * alpha(0x00ff00, 0.5) // returns 'rgba(0, 255, 0, 0.5)'\n * alpha(0x0000ff) // returns 'rgba(0, 0, 255, 1)'\n * ```\n */\nexport function alpha(color: number, alphaValue = 1.0): string {\n const rgb = numberToRgb(color)\n const a = Math.max(0, Math.min(1, alphaValue))\n return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${a})`\n}\n\n/**\n * Calculate relative luminance of a color (WCAG formula)\n * @param color - Phaser color number\n * @returns Relative luminance (0.0 to 1.0)\n */\nfunction getLuminance(color: number): number {\n const rgb = numberToRgb(color)\n\n // Convert to sRGB\n const rsRGB = rgb.r / 255\n const gsRGB = rgb.g / 255\n const bsRGB = rgb.b / 255\n\n // Apply gamma correction\n const r = rsRGB <= 0.03928 ? rsRGB / 12.92 : Math.pow((rsRGB + 0.055) / 1.055, 2.4)\n const g = gsRGB <= 0.03928 ? gsRGB / 12.92 : Math.pow((gsRGB + 0.055) / 1.055, 2.4)\n const b = bsRGB <= 0.03928 ? bsRGB / 12.92 : Math.pow((bsRGB + 0.055) / 1.055, 2.4)\n\n // Calculate luminance\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n\n/**\n * Calculate contrast ratio between two colors (WCAG 2.0)\n * @param foreground - Foreground color (e.g., text)\n * @param background - Background color\n * @returns Contrast ratio (1 to 21)\n * @example\n * ```typescript\n * getContrastRatio(0x000000, 0xffffff) // returns 21 (black on white)\n * getContrastRatio(0xffffff, 0xffffff) // returns 1 (white on white)\n * ```\n */\nexport function getContrastRatio(foreground: number, background: number): number {\n const l1 = getLuminance(foreground)\n const l2 = getLuminance(background)\n\n const lighter = Math.max(l1, l2)\n const darker = Math.min(l1, l2)\n\n return (lighter + 0.05) / (darker + 0.05)\n}\n\n/**\n * Ensure minimum contrast ratio by adjusting foreground color\n * Uses binary search for efficiency (O(log n) vs O(n))\n * @param foreground - Foreground color to adjust\n * @param background - Background color (fixed)\n * @param minRatio - Minimum contrast ratio (default: 4.5 for WCAG AA)\n * @returns Adjusted foreground color meeting contrast requirements\n * @example\n * ```typescript\n * // Ensure text is readable on background\n * const textColor = ensureContrast(0x888888, 0xffffff, 4.5)\n * ```\n */\nexport function ensureContrast(foreground: number, background: number, minRatio = 4.5): number {\n // If contrast is already sufficient, return original\n if (getContrastRatio(foreground, background) >= minRatio) {\n return foreground\n }\n\n // Determine if we should lighten or darken\n const bgLuminance = getLuminance(background)\n const shouldLighten = bgLuminance < 0.5\n\n // Binary search for the minimal adjustment needed\n let low = 0\n let high = 1\n\n while (high - low > 0.01) {\n const mid = (low + high) / 2\n const adjusted = shouldLighten ? lighten(foreground, mid) : darken(foreground, mid)\n\n if (getContrastRatio(adjusted, background) >= minRatio) {\n high = mid\n } else {\n low = mid\n }\n }\n\n return shouldLighten ? lighten(foreground, high) : darken(foreground, high)\n}\n\n/**\n * Create a TextStyleToken by merging base style with overrides to ensure required properties are set\n * @param baseStyle\n * @param overrides\n * @returns\n */\nexport function createTextStyle(\n baseStyle: Partial<TextStyleToken> | undefined,\n overrides: Partial<TextStyleToken>\n): TextStyleToken {\n const base = baseStyle ?? {}\n return {\n fontSize: overrides.fontSize ?? base.fontSize ?? '14px',\n color: overrides.color ?? base.color ?? '#ffffff',\n ...(base.fontFamily && { fontFamily: base.fontFamily }),\n ...(base.align && { align: base.align }),\n ...overrides,\n }\n}\n","/**\n * Color preset definitions for PhaserJSX UI\n * Provides pre-configured color palettes with light/dark mode support\n */\n\nimport { HexColor, type ColorShade, type ColorTokens } from './color-types'\nimport { hexToNumber, hslToNumber, numberToHex, numberToHsl } from './color-utils'\n\n/**\n * Base ColorShade without DEFAULT property\n */\ntype ColorShadeBase = Omit<ColorShade, 'DEFAULT'>\n\n/** Neutral color hex values per shade level */\ntype NeutralHexValues = Record<'lightest' | 'light' | 'medium' | 'dark' | 'darkest', string>\n\n/** Light mode neutral color definitions */\nconst LIGHT_NEUTRALS = {\n background: {\n lightest: '#ffffff',\n light: '#fafafa',\n medium: '#f0f0f0',\n dark: '#e5e5e5',\n darkest: '#d0d0d0',\n },\n surface: {\n lightest: '#f5f5f5',\n light: '#ebebeb',\n medium: '#e0e0e0',\n dark: '#d5d5d5',\n darkest: '#c8c8c8',\n },\n text: {\n lightest: '#9e9e9e',\n light: '#757575',\n medium: '#616161',\n dark: '#424242',\n darkest: '#212121',\n },\n border: {\n lightest: '#d5d5d5',\n light: '#c0c0c0',\n medium: '#a8a8a8',\n dark: '#8e8e8e',\n darkest: '#6e6e6e',\n },\n} as const satisfies Record<string, NeutralHexValues>\n\n/** Dark mode neutral color definitions */\nconst DARK_NEUTRALS = {\n background: {\n lightest: '#3a3a3a',\n light: '#2e2e2e',\n medium: '#1e1e1e',\n dark: '#161616',\n darkest: '#0a0a0a',\n },\n surface: {\n lightest: '#4a4a4a',\n light: '#3e3e3e',\n medium: '#333333',\n dark: '#2a2a2a',\n darkest: '#222222',\n },\n text: {\n lightest: '#ffffff',\n light: '#e8e8e8',\n medium: '#cccccc',\n dark: '#a0a0a0',\n darkest: '#808080',\n },\n border: {\n lightest: '#757575',\n light: '#616161',\n medium: '#4a4a4a',\n dark: '#3a3a3a',\n darkest: '#2e2e2e',\n },\n} as const satisfies Record<string, NeutralHexValues>\n\n/**\n * Convert neutral hex values to a full ColorShade with DEFAULT alias\n * @param shades - Record of shade level to hex string\n * @returns ColorShade with HexColor instances and DEFAULT pointing to medium\n */\nfunction toColorShade(shades: NeutralHexValues): ColorShade {\n return {\n lightest: HexColor.from(shades.lightest),\n light: HexColor.from(shades.light),\n medium: HexColor.from(shades.medium),\n dark: HexColor.from(shades.dark),\n darkest: HexColor.from(shades.darkest),\n DEFAULT: HexColor.from(shades.medium),\n }\n}\n\n/**\n * Create a ColorShade with DEFAULT pointing to medium\n * @param shade - ColorShade object without DEFAULT\n * @returns ColorShade with DEFAULT set to medium\n */\nfunction addDefault(shade: ColorShadeBase): ColorShade {\n return { ...shade, DEFAULT: shade.medium }\n}\n\n/**\n * Generate a complete color scale from a base color using HSL-based perceptual scaling\n * Creates shades from lightest to darkest with DEFAULT pointing to medium\n * @param baseColor - The base color in hex format (e.g., '#2196f3')\n * @returns Complete ColorShade with all semantic levels as HexColor objects\n * @example\n * ```typescript\n * const primaryScale = generateColorScale('#2196f3')\n * // Usage: colors.primary.medium.toNumber()\n * // DEFAULT also works: colors.primary.DEFAULT.toNumber()\n * ```\n */\nexport function generateColorScale(baseColor: string): ColorShade {\n const num = hexToNumber(baseColor)\n const hsl = numberToHsl(num)\n\n return addDefault({\n lightest: HexColor.from(numberToHex(hslToNumber(hsl.h, hsl.s, 0.92))),\n light: HexColor.from(numberToHex(hslToNumber(hsl.h, hsl.s * 0.7, 0.72))),\n medium: HexColor.from(baseColor),\n dark: HexColor.from(numberToHex(hslToNumber(hsl.h, hsl.s * 0.8, 0.35))),\n darkest: HexColor.from(numberToHex(hslToNumber(hsl.h, hsl.s * 0.6, 0.15))),\n })\n}\n\n/**\n * Color preset configuration\n * Defines a complete set of semantic colors for a theme\n */\nexport interface ColorPreset {\n /** Preset name for identification */\n name: string\n /** Complete color token set */\n colors: ColorTokens\n}\n\n/**\n * Ocean Blue Preset\n * Clean, professional blue-based palette\n */\nexport const oceanBluePreset: ColorPreset = {\n name: 'oceanBlue',\n colors: {\n // Brand colors\n primary: generateColorScale('#2196f3'), // Material Blue\n secondary: generateColorScale('#607d8b'), // Blue Grey\n accent: generateColorScale('#00bcd4'), // Cyan\n\n // Feedback colors\n success: generateColorScale('#4caf50'), // Green\n warning: generateColorScale('#ff9800'), // Orange\n error: generateColorScale('#f44336'), // Red\n info: generateColorScale('#2196f3'), // Blue (same as primary)\n\n // Neutral colors - designed for light mode\n background: toColorShade(LIGHT_NEUTRALS.background),\n surface: toColorShade(LIGHT_NEUTRALS.surface),\n text: toColorShade(LIGHT_NEUTRALS.text),\n border: toColorShade(LIGHT_NEUTRALS.border),\n },\n}\n\n/**\n * Forest Green Preset\n * Nature-inspired green-based palette\n */\nexport const forestGreenPreset: ColorPreset = {\n name: 'forestGreen',\n colors: {\n // Brand colors\n primary: generateColorScale('#4caf50'), // Green\n secondary: generateColorScale('#8bc34a'), // Light Green\n accent: generateColorScale('#ff8f00'), // Amber (warm earth tone)\n\n // Feedback colors\n success: generateColorScale('#66bb6a'), // Light Green\n warning: generateColorScale('#ffa726'), // Orange\n error: generateColorScale('#ef5350'), // Red\n info: generateColorScale('#29b6f6'), // Light Blue\n\n // Neutral colors - green-tinted\n background: toColorShade({\n lightest: '#ffffff',\n light: '#f1f8e9',\n medium: '#dcedc8',\n dark: '#c5e1a5',\n darkest: '#aed581',\n }),\n surface: toColorShade({\n lightest: '#ffffff',\n light: '#f9fbe7',\n medium: '#f0f4c3',\n dark: '#e6ee9c',\n darkest: '#dce775',\n }),\n text: toColorShade({\n lightest: '#9e9e9e',\n light: '#757575',\n medium: '#616161',\n dark: '#424242',\n darkest: '#1b5e20',\n }),\n border: toColorShade({\n lightest: '#dcedc8',\n light: '#c5e1a5',\n medium: '#aed581',\n dark: '#9ccc65',\n darkest: '#7cb342',\n }),\n },\n}\n\n/**\n * Midnight Preset\n * Dark, elegant purple-based palette\n */\nexport const midnightPreset: ColorPreset = {\n name: 'midnight',\n colors: {\n // Brand colors\n primary: generateColorScale('#9c27b0'), // Purple\n secondary: generateColorScale('#673ab7'), // Deep Purple\n accent: generateColorScale('#e91e63'), // Pink\n\n // Feedback colors\n success: generateColorScale('#66bb6a'), // Green\n warning: generateColorScale('#ffa726'), // Orange\n error: generateColorScale('#ef5350'), // Red\n info: generateColorScale('#42a5f5'), // Blue\n\n // Neutral colors - designed for dark mode\n background: toColorShade(DARK_NEUTRALS.background),\n surface: toColorShade(DARK_NEUTRALS.surface),\n text: toColorShade(DARK_NEUTRALS.text),\n border: toColorShade(DARK_NEUTRALS.border),\n },\n}\n\n/**\n * Apply light mode overrides to a preset\n * Adjusts neutral colors for optimal light mode appearance\n * @param preset - Base preset to modify\n * @returns New preset with light mode neutral colors\n */\nexport function applyLightMode(preset: ColorPreset): ColorPreset {\n return {\n ...preset,\n colors: {\n ...preset.colors,\n background: toColorShade(LIGHT_NEUTRALS.background),\n surface: toColorShade(LIGHT_NEUTRALS.surface),\n text: toColorShade(LIGHT_NEUTRALS.text),\n border: toColorShade(LIGHT_NEUTRALS.border),\n },\n }\n}\n\n/**\n * Apply dark mode overrides to a preset\n * Adjusts neutral colors for optimal dark mode appearance\n * @param preset - Base preset to modify\n * @returns New preset with dark mode neutral colors\n */\nexport function applyDarkMode(preset: ColorPreset): ColorPreset {\n return {\n ...preset,\n colors: {\n ...preset.colors,\n background: toColorShade(DARK_NEUTRALS.background),\n surface: toColorShade(DARK_NEUTRALS.surface),\n text: toColorShade(DARK_NEUTRALS.text),\n border: toColorShade(DARK_NEUTRALS.border),\n },\n }\n}\n\n/**\n * All available presets\n */\nexport const presets = {\n oceanBlue: oceanBluePreset,\n forestGreen: forestGreenPreset,\n midnight: midnightPreset,\n} as const\n\n/**\n * Preset names for type safety\n */\nexport type PresetName = keyof typeof presets\n\n/**\n * Get a preset by name\n * @param name - Preset name\n * @returns Color preset\n * @example\n * ```typescript\n * const preset = getPreset('oceanBlue')\n * const primaryColor = preset.colors.primary.DEFAULT\n * ```\n */\nexport function getPreset(name: PresetName): ColorPreset {\n return presets[name]\n}\n\n/**\n * Get a preset with color mode applied\n * @param name - Preset name\n * @param mode - Color mode ('light' or 'dark')\n * @returns Color preset with mode-specific neutral colors\n * @example\n * ```typescript\n * const darkPreset = getPresetWithMode('oceanBlue', 'dark')\n * const bgColor = darkPreset.colors.background.DEFAULT\n * ```\n */\nexport function getPresetWithMode(name: PresetName, mode: 'light' | 'dark'): ColorPreset {\n const preset = getPreset(name)\n return mode === 'light' ? applyLightMode(preset) : applyDarkMode(preset)\n}\n","/**\n * Component size presets for consistent cross-component sizing\n * All interactive controls draw from these shared token sets\n *\n * Design philosophy:\n * - Height steps: 32 → 40 → 48 (8px increments, aligns with 4px grid)\n * - Padding H steps: 12 → 16 → 20 (4px increments)\n * - Radius steps: 6 → 8 → 10 (2px increments for visual distinction at each size)\n * - All values divisible by 2 for pixel-perfect rendering\n */\nimport type { ViewTheme } from '../theme-base'\n\n/**\n * Shared size preset for standard interactive controls\n * (Button, SegmentedControl segments, Toolbar items, NumberInput buttons, etc.)\n */\nexport interface ControlSizePreset {\n height: number\n paddingH: number\n paddingV: number\n radius: number\n gap: number\n iconSize: number\n}\n\nexport const controlSizePresets: Record<'sm' | 'md' | 'lg', ControlSizePreset> = {\n sm: { height: 32, paddingH: 12, paddingV: 6, radius: 6, gap: 6, iconSize: 15 },\n md: { height: 40, paddingH: 16, paddingV: 8, radius: 8, gap: 8, iconSize: 18 },\n lg: { height: 48, paddingH: 20, paddingV: 10, radius: 10, gap: 10, iconSize: 22 },\n}\n\n/**\n * Compact size preset for smaller interactive controls\n * (SegmentedControl segments, NumberInput buttons, ContextMenu items)\n * Scale: 28 → 34 → 40 (6px increments, aligns with 2px grid for tight layouts)\n */\nexport const compactControlSizePresets: Record<'sm' | 'md' | 'lg', ControlSizePreset> = {\n sm: { height: 28, paddingH: 8, paddingV: 4, radius: 5, gap: 4, iconSize: 14 },\n md: { height: 34, paddingH: 10, paddingV: 6, radius: 6, gap: 5, iconSize: 16 },\n lg: { height: 40, paddingH: 14, paddingV: 8, radius: 7, gap: 6, iconSize: 20 },\n}\n\n/**\n * Toolbar item size presets (density-based, not sm/md/lg)\n * Toolbar uses density: 'compact' | 'normal' instead of size scale\n */\nexport interface ToolbarItemSizePreset {\n width: number\n height: number\n compactWidth: number\n compactHeight: number\n iconSize: number\n compactIconSize: number\n}\n\nexport const toolbarSizePresets: ToolbarItemSizePreset = {\n width: 42,\n height: 36,\n compactWidth: 34,\n compactHeight: 34,\n iconSize: compactControlSizePresets.md.iconSize,\n compactIconSize: compactControlSizePresets.sm.iconSize,\n}\n\n/**\n * Size preset for compact indicators\n * (Badge, Tag, small labels)\n */\nexport interface IndicatorSizePreset {\n height: number\n paddingH: number\n radius: number\n fontSize: string\n}\n\nexport const indicatorSizePresets: Record<'sm' | 'md' | 'lg', IndicatorSizePreset> = {\n sm: { height: 16, paddingH: 6, radius: 4, fontSize: '10px' },\n md: { height: 20, paddingH: 8, radius: 6, fontSize: '12px' },\n lg: { height: 24, paddingH: 10, radius: 8, fontSize: '14px' },\n}\n\n/**\n * Min-width scale aligned with control heights\n * sm ≈ 2.25× height, md ≈ 2.3× height, lg ≈ 2.4× height\n */\nexport const controlMinWidthPresets: Record<'sm' | 'md' | 'lg', number> = {\n sm: 72,\n md: 92,\n lg: 116,\n}\n\n/** Build ViewTheme padding from horizontal + vertical preset values */\nexport function controlPadding(preset: ControlSizePreset): ViewTheme['padding'] {\n return {\n top: preset.paddingV,\n bottom: preset.paddingV,\n left: preset.paddingH,\n right: preset.paddingH,\n }\n}\n","/**\n * Default design token presets\n * Provides sensible defaults for text styles, spacing, sizes, and radius\n */\nimport type { RadiusTokens, SizeTokens, SpacingTokens, TextStyleTokens } from './design-token-types'\n\n/**\n * Default spacing scale\n * Based on 4px base unit\n */\nexport const defaultSpacingTokens: SpacingTokens = {\n xs: 4,\n sm: 8,\n md: 16,\n lg: 24,\n xl: 32,\n xxl: 48,\n}\n\n/**\n * Default size scale\n * For width, height, icon sizes, etc.\n */\nexport const defaultSizeTokens: SizeTokens = {\n xs: 16,\n sm: 24,\n md: 32,\n lg: 48,\n xl: 64,\n xxl: 96,\n}\n\n/**\n * Default border radius scale\n */\nexport const defaultRadiusTokens: RadiusTokens = {\n none: 0,\n sm: 4,\n md: 8,\n lg: 16,\n xl: 24,\n xxl: 48,\n}\n\n/**\n * Create text style tokens with the given base text color\n * @param textColor - Base text color (hex string)\n * @returns TextStyleTokens with color applied\n */\nexport function createTextStyleTokens(textColor: string): TextStyleTokens {\n return {\n DEFAULT: {\n fontSize: '16px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n small: {\n fontSize: '12px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n medium: {\n fontSize: '16px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n large: {\n fontSize: '20px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n title: {\n fontSize: '28px',\n color: textColor,\n fontFamily: 'Arial',\n fontStyle: 'bold',\n align: 'left',\n },\n heading: {\n fontSize: '36px',\n color: textColor,\n fontFamily: 'Arial',\n fontStyle: 'bold',\n align: 'left',\n },\n caption: {\n fontSize: '10px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n }\n}\n\n/**\n * Default text style tokens (white text)\n */\nexport const defaultTextStyleTokens: TextStyleTokens = createTextStyleTokens('#ffffff')\n","/**\n * Default theme values for all components\n * This file contains the default theme configuration\n * Uses oceanBlue preset with light mode for consistent, semantic colors\n */\nimport { getPresetWithMode, type PresetName } from './colors/color-presets'\nimport type { ColorTokens } from './colors/color-types'\nimport { ensureContrast, numberToHex } from './colors/color-utils'\nimport {\n compactControlSizePresets,\n controlMinWidthPresets,\n controlPadding,\n controlSizePresets,\n toolbarSizePresets,\n} from './design-tokens/component-size-presets'\nimport { createTextStyleTokens } from './design-tokens/design-token-presets'\nimport type { Theme } from './theme-base'\nimport './theme-custom' // Import to activate declaration merging\n\nfunction buildDefaultTheme(colors: ColorTokens): Theme {\n const textStyles = createTextStyleTokens(colors.text.DEFAULT.toString())\n const buttonPrimaryBackground = colors.primary.dark.toNumber()\n const buttonPrimaryForeground = ensureContrast(\n colors.text.lightest.toNumber(),\n buttonPrimaryBackground\n )\n const buttonSecondaryBackground = colors.surface.lightest.toNumber()\n const buttonSecondaryForeground = ensureContrast(\n colors.text.dark.toNumber(),\n buttonSecondaryBackground\n )\n const buttonDisabledBackground = colors.surface.medium.toNumber()\n const buttonDisabledForeground = ensureContrast(\n colors.text.light.toNumber(),\n buttonDisabledBackground\n )\n const buttonOutlineForeground = ensureContrast(\n colors.primary.light.toNumber(),\n colors.surface.dark.toNumber()\n )\n const buttonGhostForeground = ensureContrast(\n colors.text.light.toNumber(),\n colors.surface.light.toNumber()\n )\n const buttonDangerBackground = colors.error.dark.toNumber()\n const buttonDangerForeground = ensureContrast(\n colors.text.lightest.toNumber(),\n buttonDangerBackground\n )\n\n /** Shared defaults for primitive components (alpha + visible). */\n const primitiveVisible = { alpha: 1, visible: true } as const\n /** Shared text primitive with default style. */\n const textPrimitive = { text: '', alpha: 1, visible: true, style: textStyles.DEFAULT } as const\n\n /**\n * Default theme values for all built-in and custom components\n */\n return {\n // Primitives (lowercase + uppercase share same defaults)\n view: primitiveVisible,\n View: primitiveVisible,\n text: textPrimitive,\n Text: textPrimitive,\n nineslice: primitiveVisible,\n NineSlice: primitiveVisible,\n sprite: primitiveVisible,\n Sprite: primitiveVisible,\n image: primitiveVisible,\n Image: primitiveVisible,\n graphics: primitiveVisible,\n Graphics: primitiveVisible,\n tilesprite: primitiveVisible,\n TileSprite: primitiveVisible,\n particles: primitiveVisible,\n Particles: primitiveVisible,\n Icon: {\n size: 24,\n tint: colors.border.dark.toNumber(),\n },\n ActivityIndicator: {\n variant: 'spinner',\n size: 'medium',\n color: colors.primary.DEFAULT.toNumber(),\n trackColor: colors.primary.DEFAULT.toNumber(),\n animationSpeed: 2.4,\n lineWidth: 3,\n gap: 8,\n dotCount: 3,\n dotSize: 7,\n pulseScale: 1,\n labelStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n labels: {\n loading: '',\n },\n },\n BottomSheet: {\n backdropAlpha: 0,\n backdropColor: 0x000000,\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 1,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n panelCornerRadius: 16,\n handleWidth: 36,\n handleHeight: 5,\n handleColor: colors.border.dark.toNumber(),\n },\n RadioButton: {\n selectedColor: colors.primary.DEFAULT.toNumber(),\n color: colors.border.dark.toNumber(),\n borderWidth: 2,\n gap: 8,\n size: 18,\n innerSize: 8,\n disabledAlpha: 0.5,\n labelPosition: 'right',\n labelStyle: {\n color: colors.text.DEFAULT.toString(),\n fontSize: '14px',\n },\n },\n Checkbox: {\n checkedColor: colors.primary.DEFAULT.toNumber(),\n indeterminateColor: colors.primary.medium.toNumber(),\n color: colors.border.medium.toNumber(),\n gap: 10,\n size: 20,\n disabledAlpha: 0.5,\n labelPosition: 'right',\n labelStyle: {\n color: colors.text.DEFAULT.toString(),\n fontSize: '14px',\n },\n },\n ColorPicker: {\n backgroundColor: colors.surface.dark.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 8,\n padding: 14,\n gap: 18,\n previewSize: 116,\n previewGap: 10,\n previewBorderWidth: 2,\n previewCornerRadius: 8,\n trackLength: 280,\n trackHeight: 14,\n gradientSteps: 32,\n controlGap: 12,\n controlBackgroundColor: colors.surface.medium.toNumber(),\n controlBackgroundAlpha: 0.65,\n closeButtonSize: 24,\n closeButtonCornerRadius: 5,\n thumbSize: 18,\n thumbBorderColor: colors.surface.lightest.toNumber(),\n swatchSize: 18,\n swatchGap: 6,\n swatchCornerRadius: 4,\n labelStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n valueStyle: {\n ...textStyles.small,\n color: colors.text.DEFAULT.toString(),\n },\n titleStyle: {\n ...textStyles.medium,\n color: colors.text.DEFAULT.toString(),\n fontStyle: 'bold',\n },\n hexStyle: {\n ...textStyles.small,\n color: colors.text.lightest.toString(),\n fontStyle: 'bold',\n },\n labels: {\n title: 'Color Picker',\n tone: 'Tone',\n vivid: 'Vivid',\n muted: 'Muted',\n hue: 'Hue',\n saturation: 'Saturation',\n lightness: 'Lightness',\n close: 'X',\n },\n RadioButton: {\n labelStyle: {\n ...textStyles.small,\n color: colors.text.DEFAULT.toString(),\n },\n size: 16,\n innerSize: 7,\n gap: 6,\n },\n },\n PalettePicker: {\n columns: 6,\n swatchSize: 28,\n swatchGap: 8,\n rowGap: 8,\n itemWidth: 28,\n swatchCornerRadius: 5,\n swatchBorderColor: colors.border.medium.toNumber(),\n swatchBorderWidth: 1,\n swatchSelectedBorderColor: colors.surface.lightest.toNumber(),\n swatchSelectedBorderWidth: 3,\n swatchDisabledAlpha: 0.45,\n selectedCheckColor: colors.surface.lightest.toNumber(),\n disabledAlpha: 0.5,\n showTitle: true,\n showHex: false,\n padding: 0,\n gap: 10,\n titleStyle: {\n ...textStyles.medium,\n color: colors.text.DEFAULT.toString(),\n fontStyle: 'bold',\n },\n emptyStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n hexStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n labels: {\n title: 'Palette',\n empty: 'No colors',\n },\n },\n NumberInput: {\n gap: 10,\n padding: 0,\n valueWidth: 78,\n controlHeight: 34,\n controlGap: 0,\n buttonControlSize: 34,\n buttonGap: 0,\n buttonPlacement: 'split',\n buttonDirection: 'row',\n buttonVariant: 'secondary',\n buttonSize: 'small',\n buttonTextStyle: {\n ...textStyles.DEFAULT,\n fontStyle: 'bold',\n },\n buttonIndicatorColor: colors.text.DEFAULT.toNumber(),\n buttonIndicatorActiveColor: colors.surface.DEFAULT.toNumber(),\n labelPosition: 'left',\n valueBackgroundColor: colors.surface.light.toNumber(),\n valueBackgroundAlpha: 1,\n valueBorderColor: colors.border.medium.toNumber(),\n valueBorderWidth: 1,\n valueCornerRadius: 0,\n valuePadding: { left: 6, right: 6, top: 4, bottom: 4 },\n disabledAlpha: 0.5,\n repeatOnHold: true,\n holdDelay: 350,\n repeatInterval: 90,\n labelStyle: {\n ...textStyles.medium,\n color: colors.text.DEFAULT.toString(),\n },\n valueStyle: {\n ...textStyles.medium,\n color: colors.text.DEFAULT.toString(),\n fontStyle: 'bold',\n },\n labels: {\n decrement: '-',\n increment: '+',\n value: 'Value',\n },\n Button: {\n minWidth: 34,\n width: 34,\n height: 34,\n padding: 0,\n cornerRadius: 0,\n backgroundColor: colors.primary.medium.toNumber(),\n borderColor: colors.primary.dark.toNumber(),\n borderWidth: 1,\n textStyle: {\n ...textStyles.DEFAULT,\n fontStyle: 'bold',\n },\n },\n },\n SegmentedControl: {\n orientation: 'horizontal',\n size: 'medium',\n variant: 'solid',\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 0.95,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: controlSizePresets.md.radius,\n padding: 3,\n gap: controlSizePresets.md.gap,\n segmentGap: 0,\n segmentWidth: controlMinWidthPresets.md,\n segmentHeight: compactControlSizePresets.md.height,\n segmentPadding: controlPadding(compactControlSizePresets.md),\n segmentCornerRadius: compactControlSizePresets.md.radius,\n segmentStyle: {\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 0,\n borderWidth: 0,\n },\n segmentHoverStyle: {\n backgroundColor: colors.surface.medium.toNumber(),\n backgroundAlpha: 0.55,\n },\n segmentSelectedStyle: {\n backgroundColor: colors.primary.medium.toNumber(),\n backgroundAlpha: 1,\n borderColor: colors.primary.dark.toNumber(),\n borderWidth: 1,\n },\n segmentDisabledStyle: {\n alpha: 0.45,\n },\n iconGap: compactControlSizePresets.sm.gap + 2, // 6px — slightly wider than segment gap for readability\n iconSize: compactControlSizePresets.md.iconSize,\n disabledAlpha: 0.5,\n labelPosition: 'none',\n labelStyle: {\n ...textStyles.medium,\n color: colors.text.DEFAULT.toString(),\n },\n textStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n fontStyle: 'bold',\n },\n selectedTextStyle: {\n color: colors.text.lightest.toString(),\n fontStyle: 'bold',\n },\n disabledTextStyle: {\n color: colors.text.lightest.toString(),\n },\n labels: {\n group: 'Options',\n },\n },\n ListBox: {\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 0.95,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: controlSizePresets.md.radius,\n padding: 2,\n itemHeight: 36,\n itemGap: 1,\n itemPadding: {\n left: compactControlSizePresets.md.paddingH,\n right: compactControlSizePresets.md.paddingH,\n top: compactControlSizePresets.md.paddingV,\n bottom: compactControlSizePresets.md.paddingV,\n },\n itemCornerRadius: compactControlSizePresets.md.radius,\n itemStyle: {\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 0,\n borderWidth: 0,\n },\n itemHoverStyle: {\n backgroundColor: colors.surface.medium.toNumber(),\n backgroundAlpha: 0.55,\n },\n itemSelectedStyle: {\n backgroundColor: colors.primary.medium.toNumber(),\n backgroundAlpha: 1,\n borderColor: colors.primary.dark.toNumber(),\n borderWidth: 1,\n },\n itemDisabledStyle: {\n alpha: 0.45,\n },\n disabledAlpha: 0.5,\n textStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n selectedTextStyle: {\n color: colors.text.lightest.toString(),\n fontStyle: 'bold',\n },\n disabledTextStyle: {\n color: colors.text.lightest.toString(),\n },\n emptyStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n labels: {\n empty: 'No items',\n },\n },\n Toolbar: {\n orientation: 'horizontal',\n density: 'normal',\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 0.92,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: controlSizePresets.md.radius,\n padding: 4,\n gap: controlSizePresets.sm.gap,\n itemGap: controlSizePresets.sm.gap,\n groupGap: controlSizePresets.lg.gap,\n itemWidth: toolbarSizePresets.width,\n itemHeight: toolbarSizePresets.height,\n compactItemWidth: toolbarSizePresets.compactWidth,\n compactItemHeight: toolbarSizePresets.compactHeight,\n buttonVariant: 'secondary',\n activeButtonVariant: 'primary',\n menuButtonVariant: 'outline',\n buttonSize: 'small',\n compactButtonSize: 'small',\n iconSize: toolbarSizePresets.iconSize,\n compactIconSize: toolbarSizePresets.compactIconSize,\n separatorColor: colors.border.medium.toNumber(),\n separatorThickness: 1,\n separatorLength: 26,\n disabledAlpha: 0.55,\n textStyle: {\n ...textStyles.small,\n color: colors.text.DEFAULT.toString(),\n fontStyle: 'bold',\n },\n activeTextStyle: {\n color: colors.text.DEFAULT.toString(),\n fontStyle: 'bold',\n },\n disabledTextStyle: {\n color: colors.text.lightest.toString(),\n },\n menuIndicatorStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n labels: {\n overflow: 'More',\n menuIndicator: 'v',\n },\n Icon: {\n tint: colors.text.DEFAULT.toNumber(),\n },\n Button: {\n minWidth: 0,\n padding: {\n left: 8,\n right: 8,\n top: controlSizePresets.sm.paddingV,\n bottom: controlSizePresets.sm.paddingV,\n },\n cornerRadius: controlSizePresets.sm.radius,\n gap: controlSizePresets.sm.gap,\n },\n },\n MenuButton: {\n buttonVariant: 'secondary',\n buttonSize: 'medium',\n placement: 'bottom-start',\n width: 220,\n gap: 6,\n iconGap: 8,\n },\n Badge: {\n tone: 'neutral',\n variant: 'solid',\n size: 'medium',\n maxCount: 99,\n disabledAlpha: 0.5,\n textStyle: {\n fontFamily: 'Arial',\n },\n },\n Tag: {\n tone: 'neutral',\n variant: 'soft',\n size: 'medium',\n closeSize: 16,\n disabledAlpha: 0.5,\n textStyle: {\n fontFamily: 'Arial',\n },\n },\n Popover: {\n placement: 'bottom',\n offset: 8,\n depth: 1100,\n closeOnOutside: true,\n closeOnEscape: true,\n viewportPadding: 8,\n openDuration: 120,\n closeDuration: 100,\n backgroundColor: colors.surface.dark.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 8,\n padding: 10,\n gap: 8,\n },\n ContextMenu: {\n width: 220,\n itemHeight: 34,\n itemGap: 8,\n itemPadding: { left: 10, right: 10, top: 6, bottom: 6 },\n itemCornerRadius: 5,\n backgroundColor: colors.surface.dark.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 8,\n padding: 6,\n gap: 2,\n textStyle: {\n ...textStyles.small,\n color: colors.text.medium.toString(),\n },\n disabledTextColor: colors.text.lightest.toString(),\n dangerTextColor: colors.error.darkest.toString(),\n dangerBackgroundColor: colors.error.dark.toNumber(),\n },\n ProgressView: {\n width: 'fill',\n barHeight: 24,\n gap: 8,\n labelStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n percentageStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n labels: {\n cancel: 'Cancel',\n loading: 'Loading...',\n },\n },\n ProgressBar: {\n width: 240,\n height: 22,\n orientation: 'horizontal',\n labelPosition: 'right',\n trackColor: colors.surface.dark.toNumber(),\n fillColor: colors.success.DEFAULT.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 11,\n gap: 8,\n disabledAlpha: 0.5,\n labelStyle: {\n color: colors.text.DEFAULT.toString(),\n fontSize: '13px',\n },\n },\n RatingBar: {\n size: 'medium',\n gap: 4,\n iconSize: 24,\n filledColor: '#fbbf24',\n emptyColor: '#475569',\n disabledAlpha: 0.5,\n },\n ScrollSlider: {\n borderColor: colors.border.medium.toNumber(),\n trackColor: colors.surface.dark.toNumber(),\n trackCornerRadius: 0,\n thumbColor: colors.primary.DEFAULT.toNumber(),\n thumbActiveColor: colors.primary.dark.toNumber(),\n thumbBorderColor: colors.primary.light.toNumber(),\n thumbBorderWidth: 1,\n thumbCornerRadius: 0,\n borderWidth: 1,\n cornerRadius: 0,\n minThumbSize: 30,\n size: 24,\n },\n Button: {\n variant: 'primary',\n size: 'medium',\n disabledColor: buttonDisabledBackground,\n disabledTextColor: numberToHex(buttonDisabledForeground),\n disabledIconTint: buttonDisabledForeground,\n disabledAlpha: 0.48,\n minWidth: controlMinWidthPresets.md,\n height: controlSizePresets.md.height,\n backgroundColor: buttonPrimaryBackground,\n backgroundAlpha: 1,\n borderColor: colors.primary.darkest.toNumber(),\n borderWidth: 1,\n cornerRadius: controlSizePresets.md.radius,\n gap: controlSizePresets.md.gap,\n padding: controlPadding(controlSizePresets.md),\n justifyContent: 'center',\n alignItems: 'center',\n effect: 'press',\n effectConfig: { intensity: 0.94, time: 140 },\n iconSize: controlSizePresets.md.iconSize,\n textStyle: {\n ...textStyles.medium,\n color: numberToHex(buttonPrimaryForeground),\n fontStyle: 'bold',\n },\n Text: {\n style: {\n ...textStyles.medium,\n color: numberToHex(buttonPrimaryForeground),\n fontStyle: 'bold',\n },\n },\n Icon: {\n size: controlSizePresets.md.iconSize,\n tint: buttonPrimaryForeground,\n },\n // Variant overrides (flat keys, resolved by Button component)\n primary: {\n backgroundColor: buttonPrimaryBackground,\n borderColor: colors.primary.darkest.toNumber(),\n textStyle: { color: numberToHex(buttonPrimaryForeground), fontStyle: 'bold' },\n Icon: { tint: buttonPrimaryForeground },\n },\n secondary: {\n backgroundColor: buttonSecondaryBackground,\n backgroundAlpha: 0.92,\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n textStyle: { color: numberToHex(buttonSecondaryForeground), fontStyle: 'bold' },\n Icon: { tint: buttonSecondaryForeground },\n },\n outline: {\n backgroundColor: colors.primary.dark.toNumber(),\n backgroundAlpha: 0.08,\n borderColor: buttonOutlineForeground,\n borderWidth: 2,\n textStyle: { color: numberToHex(buttonOutlineForeground), fontStyle: 'bold' },\n Icon: { tint: buttonOutlineForeground },\n },\n ghost: {\n backgroundColor: colors.surface.light.toNumber(),\n backgroundAlpha: 0.18,\n borderColor: colors.border.medium.toNumber(),\n borderAlpha: 0.35,\n borderWidth: 1,\n textStyle: { color: numberToHex(buttonGhostForeground), fontStyle: 'bold' },\n Icon: { tint: buttonGhostForeground },\n },\n danger: {\n backgroundColor: buttonDangerBackground,\n borderColor: colors.error.darkest.toNumber(),\n textStyle: { color: numberToHex(buttonDangerForeground), fontStyle: 'bold' },\n Icon: { tint: buttonDangerForeground },\n },\n // Size overrides (flat keys, resolved by Button component)\n small: {\n minWidth: controlMinWidthPresets.sm,\n height: controlSizePresets.sm.height,\n padding: controlPadding(controlSizePresets.sm),\n cornerRadius: controlSizePresets.sm.radius,\n gap: controlSizePresets.sm.gap,\n iconSize: controlSizePresets.sm.iconSize,\n textStyle: { fontSize: '12px' },\n Icon: { size: controlSizePresets.sm.iconSize },\n },\n medium: {\n minWidth: controlMinWidthPresets.md,\n height: controlSizePresets.md.height,\n padding: controlPadding(controlSizePresets.md),\n cornerRadius: controlSizePresets.md.radius,\n gap: controlSizePresets.md.gap,\n iconSize: controlSizePresets.md.iconSize,\n Icon: { size: controlSizePresets.md.iconSize },\n },\n large: {\n minWidth: controlMinWidthPresets.lg,\n height: controlSizePresets.lg.height,\n padding: controlPadding(controlSizePresets.lg),\n cornerRadius: controlSizePresets.lg.radius,\n gap: controlSizePresets.lg.gap,\n iconSize: controlSizePresets.lg.iconSize,\n textStyle: { fontSize: '18px' },\n Icon: { size: controlSizePresets.lg.iconSize },\n },\n },\n Sidebar: {\n variant: 'solid',\n size: 'md',\n backgroundColor: colors.surface.light.toNumber(),\n backgroundAlpha: 1,\n padding: 16,\n gap: 8,\n dividerColor: colors.border.light.toNumber(),\n itemGap: 8,\n sectionGap: 10,\n headerStyle: {\n gap: 10,\n padding: { bottom: 6 },\n width: 'fill',\n },\n footerStyle: {\n gap: 8,\n padding: { top: 6 },\n width: 'fill',\n },\n sectionStyle: {\n gap: 8,\n padding: { top: 4, bottom: 8 },\n width: 'fill',\n titleStyle: {\n ...textStyles.medium,\n color: colors.text.dark.toString(),\n fontStyle: 'bold',\n },\n },\n itemStyle: {\n gap: 8,\n padding: { top: 8, bottom: 8, left: 10, right: 10 },\n width: 'fill',\n cornerRadius: 8,\n backgroundColor: colors.surface.lightest.toNumber(),\n textStyle: {\n ...textStyles.medium,\n color: colors.text.dark.toString(),\n },\n active: {\n backgroundColor: colors.primary.lightest.toNumber(),\n borderColor: colors.primary.light.toNumber(),\n borderWidth: 1,\n backgroundAlpha: 0.9,\n },\n disabledAlpha: 0.5,\n },\n badgeStyle: {\n backgroundColor: colors.primary.light.toNumber(),\n backgroundAlpha: 0.15,\n cornerRadius: 6,\n padding: { top: 4, bottom: 4, left: 8, right: 8 },\n textStyle: {\n ...textStyles.small,\n color: colors.primary.dark.toString(),\n fontStyle: 'bold',\n },\n },\n variants: {\n solid: {\n backgroundColor: colors.surface.light.toNumber(),\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n },\n muted: {\n backgroundColor: colors.surface.medium.toNumber(),\n backgroundAlpha: 0.85,\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n },\n ghost: {\n backgroundColor: colors.background.lightest.toNumber(),\n backgroundAlpha: 0.6,\n borderWidth: 0,\n },\n inset: {\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 1,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n },\n },\n sizes: {\n sm: {\n padding: 10,\n gap: 6,\n },\n md: {\n padding: 16,\n gap: 8,\n },\n lg: {\n padding: { top: 20, bottom: 20, left: 16, right: 16 },\n gap: 12,\n },\n },\n },\n Accordion: {\n effect: 'none',\n effectConfig: { magnitude: 0.02, time: 150 },\n headerStyle: {\n backgroundColor: colors.surface.dark.toNumber(),\n padding: 10,\n gap: 10,\n cornerRadius: 5,\n width: 'fill',\n },\n contentStyle: {\n backgroundColor: colors.surface.light.toNumber(),\n padding: 10,\n cornerRadius: 5,\n width: 'fill',\n },\n Icon: {\n size: 24,\n },\n textStyle: {\n color: colors.text.DEFAULT.toString(),\n fontSize: '18px',\n },\n },\n Tabs: {\n tabListStyle: {\n backgroundColor: colors.surface.dark.toNumber(),\n padding: { left: 8, right: 8, top: 8, bottom: 0 },\n cornerRadius: { tl: 6, tr: 6, bl: 0, br: 0 },\n width: 'fill',\n gap: 10,\n alignItems: 'end',\n justifyContent: 'start',\n },\n tabStyle: {\n backgroundColor: colors.surface.medium.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n padding: { left: 8, right: 8, top: 8, bottom: 3 },\n cornerRadius: { tl: 6, tr: 6, bl: 0, br: 0 },\n },\n tabActiveStyle: {\n padding: { left: 8, right: 8, top: 8, bottom: 8 },\n backgroundColor: colors.primary.DEFAULT.toNumber(),\n borderColor: colors.primary.dark.toNumber(),\n borderWidth: 2,\n },\n tabDisabledStyle: {\n alpha: 0.4,\n },\n panelStyle: {\n backgroundColor: colors.surface.light.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n padding: 10,\n cornerRadius: { tl: 0, tr: 0, bl: 6, br: 6 },\n width: 'fill',\n },\n },\n NineSliceButton: {},\n CharText: {\n charSpacing: 0,\n cursorColor: colors.secondary.DEFAULT.toNumber(),\n cursorWidth: 3,\n cursorBlinkSpeed: 200,\n selectionAlpha: 0.3,\n lineHeight: 1.2,\n wordWrap: true,\n textStyle: textStyles.DEFAULT,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 2,\n cornerRadius: 6,\n padding: 10,\n },\n CharTextInput: {\n charSpacing: 2,\n cursorColor: colors.secondary.DEFAULT.toNumber(),\n cursorWidth: 3,\n cursorBlinkSpeed: 200,\n selectionColor: colors.accent.light.toNumber(),\n selectionAlpha: 0.5,\n lineHeight: 1.2,\n wordWrap: false,\n disabledColor: colors.border.dark.toNumber(),\n disabledBackgroundColor: colors.surface.medium.toNumber(),\n disabledBorderColor: colors.border.light.toNumber(),\n disabledAlpha: 0.6,\n focusedBorderColor: colors.primary.DEFAULT.toNumber(),\n backgroundColor: colors.surface.lightest.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 7,\n padding: { left: 10, right: 10, top: 8, bottom: 8 },\n textStyle: {\n ...textStyles.DEFAULT,\n color: colors.text.dark.toString(),\n },\n placeholderStyle: {\n ...textStyles.DEFAULT,\n color: colors.text.light.toString(),\n },\n },\n Dropdown: {\n trigger: {\n backgroundColor: colors.surface.light.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 7,\n padding: { left: 12, right: 10, top: 9, bottom: 9 },\n width: 'fill',\n gap: 8,\n },\n triggerHover: {\n borderColor: colors.primary.DEFAULT.toNumber(),\n },\n triggerOpen: {\n borderColor: colors.primary.DEFAULT.toNumber(),\n borderWidth: 2,\n backgroundColor: colors.surface.lightest.toNumber(),\n },\n triggerDisabled: {\n backgroundColor: colors.surface.light.toNumber(),\n alpha: 0.5,\n },\n arrow: {\n color: colors.text.dark.toNumber(),\n size: 12,\n strokeWidth: 2,\n },\n selectionIndicator: {\n color: colors.primary.dark.toNumber(),\n size: 16,\n strokeWidth: 2,\n },\n overlay: {\n backgroundColor: colors.surface.lightest.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 7,\n maxHeight: 300,\n padding: 6,\n },\n option: {\n padding: { left: 10, right: 10, top: 8, bottom: 8 },\n cornerRadius: 5,\n gap: 8,\n },\n optionSelected: {\n backgroundColor: colors.primary.lightest.toNumber(),\n borderColor: colors.primary.light.toNumber(),\n borderWidth: 1,\n backgroundAlpha: 0.9,\n Text: {\n style: {\n ...textStyles.DEFAULT,\n color: colors.text.dark.toString(),\n fontStyle: 'bold',\n },\n },\n },\n optionDisabled: {\n alpha: 0.3,\n },\n textStyle: textStyles.DEFAULT,\n placeholderStyle: {\n ...textStyles.DEFAULT,\n color: colors.text.light.toString(),\n },\n filterInput: {\n backgroundColor: colors.surface.lightest.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 6,\n padding: { left: 10, right: 10, top: 6, bottom: 6 },\n //height: 32,\n },\n animationConfig: 'stiff',\n optionGap: 2,\n },\n Slider: {\n // Track styling\n trackColor: colors.surface.dark.toNumber(),\n trackFilledColor: colors.primary.dark.toNumber(),\n trackHeight: 6,\n trackBorderRadius: 3,\n trackLength: 200,\n trackHoverColor: colors.surface.dark.toNumber(),\n\n // Thumb styling\n thumbColor: colors.primary.light.toNumber(),\n thumbSize: 20,\n thumbBorderColor: colors.border.light.toNumber(),\n thumbBorderWidth: 2,\n thumbHoverColor: colors.primary.light.toNumber(),\n thumbActiveColor: colors.primary.dark.toNumber(),\n thumbDragScale: 1.1,\n\n // Marks/Ticks\n markColor: colors.border.medium.toNumber(),\n markHeight: 8,\n markWidth: 2,\n\n // Value label\n labelStyle: textStyles.small,\n labelOffset: 10,\n valueLabel: {\n backgroundColor: colors.background.dark.toNumber(),\n textStyle: { ...textStyles.small, color: colors.text.light.toString() },\n padding: { left: 6, right: 6, top: 4, bottom: 4 },\n cornerRadius: 4,\n offset: 8,\n },\n\n // RangeSlider specific\n minDistance: 0,\n\n // States\n disabledAlpha: 0.4,\n\n // Animation & Effects\n animationConfig: { tension: 300, friction: 30 } as const,\n },\n Toggle: {\n width: 50,\n height: 28,\n thumbSize: 24,\n trackColorOff: colors.surface.dark.toNumber(),\n trackColorOn: colors.primary.DEFAULT.toNumber(),\n trackBorderColorOff: colors.border.medium.toNumber(),\n trackBorderColorOn: colors.primary.dark.toNumber(),\n trackBorderWidth: 1,\n thumbColor: colors.surface.lightest.toNumber(),\n thumbBorderColor: colors.border.light.toNumber(),\n thumbBorderWidth: 1,\n disabledColor: colors.border.medium.toNumber(),\n disabledAlpha: 0.5,\n padding: 2,\n duration: 200,\n gap: 8,\n labelStyle: textStyles.DEFAULT,\n labelPosition: 'right',\n },\n Modal: {\n backdropColor: 0x000000,\n backdropOpacity: 0.5,\n },\n Dialog: {\n backgroundColor: colors.surface.DEFAULT.toNumber(),\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n cornerRadius: 8,\n padding: 0,\n maxWidth: 600,\n showClose: true,\n Header: {\n padding: { left: 24, right: 24, top: 20, bottom: 16 },\n gap: 12,\n textStyle: textStyles.heading,\n closeButton: {\n size: 32,\n cornerRadius: 4,\n backgroundColor: colors.surface.dark.toNumber(),\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n },\n },\n Content: {\n padding: { left: 24, right: 24, top: 16, bottom: 16 },\n gap: 12,\n },\n Actions: {\n padding: { left: 24, right: 24, top: 16, bottom: 20 },\n gap: 12,\n justifyContent: 'end',\n },\n },\n AlertDialog: {\n maxWidth: 500,\n },\n Toast: {\n variant: 'info',\n width: 320,\n minHeight: 58,\n gap: 10,\n contentGap: 2,\n accentWidth: 4,\n prefixWidth: 24,\n padding: { left: 10, right: 10, top: 9, bottom: 9 },\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 0.98,\n borderColor: colors.border.dark.toNumber(),\n borderWidth: 1,\n cornerRadius: 8,\n closeButtonSize: 24,\n titleStyle: {\n ...textStyles.small,\n color: colors.text.lightest.toString(),\n fontStyle: 'bold',\n },\n messageStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n },\n closeTextStyle: {\n ...textStyles.small,\n color: colors.text.light.toString(),\n fontStyle: 'normal',\n },\n labels: {\n close: 'x',\n },\n variants: {\n info: {\n accentColor: colors.info.DEFAULT.toNumber(),\n borderColor: colors.info.dark.toNumber(),\n },\n success: {\n accentColor: colors.success.DEFAULT.toNumber(),\n borderColor: colors.success.dark.toNumber(),\n },\n warning: {\n accentColor: colors.warning.DEFAULT.toNumber(),\n borderColor: colors.warning.dark.toNumber(),\n },\n error: {\n accentColor: colors.error.DEFAULT.toNumber(),\n borderColor: colors.error.dark.toNumber(),\n },\n },\n Button: {\n ghost: {\n padding: 0,\n backgroundAlpha: 0,\n textStyle: {\n color: colors.text.light.toString(),\n fontStyle: 'bold',\n },\n },\n },\n },\n NotificationStack: {\n position: 'top-right',\n width: 320,\n gap: 8,\n offset: 16,\n duration: 4000,\n depth: 1200,\n },\n WrapText: {\n wrap: true,\n paddingOffset: 0,\n textStyle: textStyles.DEFAULT,\n },\n WheelPicker: {\n size: 'medium',\n textColor: colors.text.light.toString(),\n overlayAlpha: 0.85,\n backgroundColor: colors.surface.darkest.toNumber(),\n backgroundAlpha: 0.95,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 8,\n itemHeight: 40,\n visibleItems: 5,\n itemPadding: { left: 12, right: 12 },\n disabledAlpha: 0.5,\n textStyle: {\n ...textStyles.medium,\n color: colors.text.light.toString(),\n },\n selectedTextStyle: {\n ...textStyles.medium,\n color: colors.text.lightest.toString(),\n fontStyle: 'bold',\n },\n disabledTextStyle: {\n color: colors.text.lightest.toString(),\n },\n labels: {\n empty: 'No items',\n },\n },\n Tooltip: {\n position: 'top',\n showDelay: 1000,\n hideDelay: 500,\n offset: 8,\n textStyle: {\n fontSize: '12px',\n fontFamily: 'Arial',\n color: colors.text.dark.toString(),\n backgroundColor: colors.warning.medium.toString(),\n padding: { x: 2, y: 2 },\n },\n cornerRadius: 8,\n animation: {\n fadeIn: 200,\n fadeOut: 200,\n move: { dx: 0, dy: -20 },\n pulse: false,\n },\n },\n }\n}\n\n// Get oceanBlue preset with light mode\nconst preset = getPresetWithMode('oceanBlue', 'light')\n\n/**\n * Default theme values for all built-in and custom components (oceanBlue / light)\n */\nexport const defaultTheme: Theme = buildDefaultTheme(preset.colors)\n\n/**\n * Create a default theme for any preset + mode combination\n * Useful when apps want the library defaults but re-colored by their own palette\n */\nexport function createDefaultTheme(\n presetName: PresetName = 'oceanBlue',\n mode: 'light' | 'dark' = 'light'\n): Theme {\n const presetForMode = getPresetWithMode(presetName, mode)\n return buildDefaultTheme(presetForMode.colors)\n}\n","/**\n * Render context - isolates global state per mount point\n * Stored in scene.data to ensure proper isolation between multiple mounts\n */\nimport type * as Phaser from 'phaser'\nimport { DebugLogger } from './dev-config'\nimport type { Ctx } from './hooks'\nimport type { ParentType } from './types'\nimport { isPhaserContainer, isPhaserScene } from './utils/phaser-guards'\n\n/**\n * Layout batch entry for deferred recalculation\n */\ninterface LayoutBatchEntry {\n container: Phaser.GameObjects.Container\n containerProps: unknown\n parentSize: { width: number; height: number } | undefined\n parentPadding: { horizontal: number; vertical: number } | undefined\n}\n\n/**\n * Render context - encapsulates all previously global state\n * Each mount point gets its own isolated context\n */\nexport class RenderContext {\n // Hook context stack (replaces global CURRENT)\n private currentCtx: Ctx | null = null\n\n // Texture management per mount\n private textureScene: Phaser.Scene | null = null\n private textures = new Map<\n string,\n { refCount: number; promise: Promise<void> | null; loaded: boolean }\n >()\n\n // Viewport dimensions per mount\n private viewport: { width: number; height: number } = { width: 800, height: 600 }\n private viewportParent: ParentType | undefined\n\n // Deferred layout callbacks per mount\n private deferredCallbacks: (() => void)[] = []\n private deferredScheduled = false\n\n // Layout batch queue per mount\n private layoutBatchMap = new Map<Phaser.GameObjects.Container, LayoutBatchEntry>()\n private batchScheduled = false\n\n // Track if context is shutting down\n private isShuttingDown = false\n\n constructor(public scene: Phaser.Scene) {\n this.textureScene = scene\n }\n\n /**\n * Check if context is shutting down\n */\n isShutdown(): boolean {\n return this.isShuttingDown\n }\n\n /**\n * Mark context as shutting down\n */\n shutdown(): void {\n this.isShuttingDown = true\n this.deferredCallbacks = []\n this.layoutBatchMap.clear()\n }\n\n /**\n * Get current hook context\n */\n getCurrent(): Ctx | null {\n return this.currentCtx\n }\n\n /**\n * Set current hook context\n */\n setCurrent(ctx: Ctx | null): void {\n this.currentCtx = ctx\n }\n\n /**\n * Get texture scene\n */\n getTextureScene(): Phaser.Scene | null {\n return this.textureScene\n }\n\n /**\n * Get textures map\n */\n getTextures(): Map<string, { refCount: number; promise: Promise<void> | null; loaded: boolean }> {\n return this.textures\n }\n\n /**\n * Set viewport dimensions\n */\n setViewport(width: number, height: number, parent?: ParentType): void {\n this.viewport = { width, height }\n this.viewportParent = parent\n }\n\n /**\n * Get viewport dimensions\n */\n getViewport(): { width: number; height: number } {\n return this.viewport\n }\n\n /**\n * Get viewport parent\n */\n getViewportParent(): ParentType | undefined {\n return this.viewportParent\n }\n\n /**\n * Defer a layout callback to next frame\n */\n deferLayout(callback: () => void): void {\n if (this.isShuttingDown) return\n this.deferredCallbacks.push(callback)\n if (!this.deferredScheduled) {\n this.deferredScheduled = true\n requestAnimationFrame(() => this.flushDeferred())\n }\n }\n\n /**\n * Flush all deferred layout callbacks\n */\n private flushDeferred(): void {\n if (this.isShuttingDown) return\n this.deferredScheduled = false\n const callbacks = [...this.deferredCallbacks]\n this.deferredCallbacks = []\n for (const callback of callbacks) {\n try {\n callback()\n } catch (error) {\n DebugLogger.error('RenderContext', 'Error in deferred callback:', error)\n }\n }\n }\n\n /**\n * Get layout batch map\n */\n getLayoutBatch(): Map<Phaser.GameObjects.Container, LayoutBatchEntry> {\n return this.layoutBatchMap\n }\n\n /**\n * Clear layout batch\n */\n clearLayoutBatch(): void {\n this.layoutBatchMap.clear()\n }\n\n /**\n * Check if batch is scheduled\n */\n isBatchScheduled(): boolean {\n return this.batchScheduled\n }\n\n /**\n * Set batch scheduled flag\n */\n setBatchScheduled(scheduled: boolean): void {\n this.batchScheduled = scheduled\n }\n}\n\n/**\n * Get or create RenderContext for a scene or container\n * Uses scene.data to store contexts, ensuring proper isolation\n * @param parentOrScene - Scene or Container to get context for\n * @returns RenderContext instance\n */\nexport function getRenderContext(\n parentOrScene: Phaser.Scene | Phaser.GameObjects.Container\n): RenderContext {\n const scene = isPhaserScene(parentOrScene) ? parentOrScene : parentOrScene.scene\n\n if (!scene || !scene.data || !scene.sys || !scene.sys.settings.active) {\n throw new Error('getRenderContext: Invalid scene or scene.data is undefined')\n }\n\n // Use unique key per container to support multiple mounts in same scene\n // For scene-level mounts, use a default key\n const containerKey = isPhaserContainer(parentOrScene)\n ? `__renderContext_${parentOrScene.name || (parentOrScene as unknown as { id?: number }).id || 'container'}__`\n : '__renderContext_scene__'\n\n let context = scene.data.get(containerKey) as RenderContext | undefined\n\n if (!context) {\n context = new RenderContext(scene)\n scene.data.set(containerKey, context)\n\n // Cleanup on scene shutdown\n scene.events.once('shutdown', () => {\n if (context) {\n context.shutdown()\n }\n scene.data.remove(containerKey)\n })\n }\n\n return context\n}\n\n/**\n * Get RenderContext from a parent (used internally by hooks)\n * @param parent - Parent scene or container\n * @returns RenderContext instance\n */\nexport function getContextFromParent(parent: ParentType): RenderContext {\n if (!parent) {\n throw new Error('getContextFromParent: Parent is null or undefined')\n }\n return getRenderContext(parent as Phaser.Scene | Phaser.GameObjects.Container)\n}\n","/**\n * Tiny hook runtime to enable function components with local subtree re-render.\n * It is independent from React/Preact renderers.\n */\nimport type * as Phaser from 'phaser'\nimport type { BackgroundImage } from './components/backgroundImage'\nimport type { Signal } from '@preact/signals-core'\nimport type { BackgroundProps, LayoutProps, TransformProps } from './core-props'\nimport type { LayoutSize } from './layout/types'\nimport { getContextFromParent } from './render-context'\nimport type { PartialTheme } from './theme'\nimport type { ParentType, VNodeLike } from './types'\nimport { normalizeVNodeLike, patchVNode } from './vdom'\nimport { isPhaserScene } from './utils/phaser-guards'\n\ntype Cleanup = void | (() => void)\n\n/**\n * Get current hook context from active render\n * Must be called during component render\n * @returns Current context or null if not in render\n */\nexport function getCurrent(): Ctx | null {\n // This is a bit tricky: we need to get the context from somewhere\n // Since we removed the global CURRENT, we need a way to access it\n // The solution: store it in a module-level variable that's managed by withHooks\n // This is a temporary bridge solution\n return _currentCtx\n}\n\n// Module-level current context (managed by withHooks only)\nlet _currentCtx: Ctx | null = null\n\nexport type Ctx = {\n index: number\n slots: unknown[]\n effects: (() => Cleanup)[]\n cleanups: Cleanup[]\n vnode: VNode | null // The rendered VNode (output of component function)\n componentVNode: VNode // The component VNode itself (with type = function)\n parent: ParentType\n function: (props: unknown) => VNodeLike\n updater?: (() => void) | undefined\n isFactory: boolean\n lastProps?: unknown // Store last props for memoization\n memoized?: boolean // Whether component uses memoization (default: true)\n theme?: PartialTheme | undefined // Theme context for this component\n disposed?: boolean // Flag to prevent updates after disposal\n}\n\nexport type VNode = {\n type: unknown\n props?: Record<string, unknown> | undefined\n children?: (VNode | null | undefined | false)[]\n __node?: unknown\n __ctx?: Ctx\n __parent?: unknown\n __key?: string | number | null\n __addConfig?: {\n expand?: boolean\n proportion?: number\n align?: string\n padding?: number | { left?: number; right?: number; top?: number; bottom?: number }\n }\n __memo?: boolean // Opt-out of memoization (false = always re-render)\n __theme?: PartialTheme // Theme override for this VNode and its children\n __staticChildren?: boolean // True when children are static JSX (not from .map())\n}\n\n/**\n * Executes a render function with hooks context\n * @param ctx - The context to use for hooks\n * @param render - The render function to execute\n * @returns The result of the render function\n */\nexport function withHooks<T>(ctx: Ctx, render: () => T): T {\n // Check scene validity before accessing render context\n const scene = isPhaserScene(ctx.parent) ? ctx.parent : ctx.parent.scene\n if (!scene || !scene.sys || !scene.sys.settings.active) {\n // Scene is shutting down, return a safe default\n return null as T\n }\n\n const renderContext = getContextFromParent(ctx.parent)\n\n // Check if render context is shutting down\n if (renderContext.isShutdown()) {\n return null as T\n }\n\n const prev = renderContext.getCurrent()\n const prevModule = _currentCtx\n renderContext.setCurrent(ctx)\n _currentCtx = ctx\n ctx.index = 0\n ctx.effects = []\n const out = render()\n renderContext.setCurrent(prev)\n _currentCtx = prevModule\n return out\n}\n\n/**\n * State hook for managing component state\n * @param initial - Initial state value or initializer function\n * @returns Tuple of current state and setter function\n */\nexport function useState<T>(initial: T): [T, (v: T | ((p: T) => T)) => void] {\n // Get current context from the active render context\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n if (i >= c.slots.length)\n c.slots[i] = typeof initial === 'function' ? (initial as () => T)() : initial\n const value = c.slots[i] as T\n const set = (v: T | ((p: T) => T)) => {\n const next = typeof v === 'function' ? (v as (p: T) => T)(c.slots[i] as T) : v\n if (Object.is(next, c.slots[i])) return\n c.slots[i] = next\n scheduleUpdate(c)\n }\n return [value, set]\n}\n\n/**\n * Ref hook for storing mutable values\n * @param val - Initial ref value\n * @returns Ref object with current property\n */\nexport function useRef<T>(val: T): { current: T } {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n if (i >= c.slots.length) c.slots[i] = { current: val }\n return c.slots[i] as { current: T }\n}\n\n/**\n * Hook to force component re-render when signals change\n * @param signals - Array of signals to watch for changes\n * @param throttleMs - Optional throttle time in milliseconds\n *\n * ⚠️ IMPORTANT: Obey performance, massive redraw could have an effect!\n */\nexport function useForceRedraw(throttleMs: number, ...signals: Signal<unknown>[]): void\nexport function useForceRedraw(...signals: Signal<unknown>[]): void\nexport function useForceRedraw(first: number | Signal<unknown>, ...rest: Signal<unknown>[]): void {\n const [, setForceRedraw] = useState<unknown>(0)\n\n // Check if first parameter is throttle time\n const throttleMs = typeof first === 'number' ? first : undefined\n const signals = typeof first === 'number' ? rest : [first, ...rest]\n\n useEffect(() => {\n const unsubscribes: (() => void)[] = []\n let lastUpdate = 0\n\n const triggerUpdate = () => {\n const now = Date.now()\n if (throttleMs && now - lastUpdate < throttleMs) return\n lastUpdate = now\n setForceRedraw({})\n }\n\n for (const signal of signals) {\n if (signal && typeof signal === 'object' && 'subscribe' in signal) {\n const subscriptions = signal.subscribe(triggerUpdate)\n unsubscribes.push(subscriptions)\n }\n }\n\n return () => {\n unsubscribes.forEach((unsubscribe) => unsubscribe())\n }\n }, [throttleMs, ...signals])\n}\n\n/**\n * Memoization hook for expensive computations\n * @param fn - Function to memoize\n * @param deps - Dependency array\n * @returns Memoized value\n */\nexport function useMemo<T>(fn: () => T, deps: readonly unknown[]): T {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n const slot = (c.slots[i] ?? (c.slots[i] = { deps: undefined, value: undefined as T })) as {\n deps?: readonly unknown[]\n value: T\n }\n if (!depsChanged(slot.deps, deps)) return slot.value\n slot.value = fn()\n slot.deps = deps\n return slot.value\n}\n\n/**\n * Callback memoization hook\n * @param fn - Callback function to memoize\n * @param deps - Dependency array\n * @returns Memoized callback\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCallback<T extends (...args: any[]) => any>(fn: T, deps: readonly unknown[]): T {\n return useMemo(() => fn, deps)\n}\n\n/**\n * Hook to access current theme context\n * Returns the theme that was passed down through the VDOM tree\n * @returns Current theme context or undefined if no theme is set\n */\nexport function useTheme(): PartialTheme | undefined {\n return getCurrent()?.theme\n}\n\n/**\n * Hook to access current Phaser scene\n * Returns the scene from the render context\n * @returns Current Phaser scene\n */\nexport function useScene(): Phaser.Scene {\n const ctx = getCurrent()\n if (!ctx) throw new Error('useScene must be called within a component')\n\n const renderContext = getContextFromParent(ctx.parent)\n return renderContext.scene\n}\n\n/**\n * Hook to get the current viewport size from the render context\n * Useful for responsive layouts and percentage-based calculations\n * @returns Viewport dimensions { width, height }\n */\nexport function useViewportSize(): { width: number; height: number } {\n const ctx = getCurrent()\n if (!ctx) {\n throw new Error('useViewportSize must be called within a component')\n }\n const renderContext = getContextFromParent(ctx.parent)\n return renderContext.getViewport()\n}\n\n/**\n * Utility function to get layout size from a container\n * Useful for imperative access to computed layout dimensions\n * @param container - Phaser container with layout\n * @returns Layout size or undefined if container has no layout\n */\nexport function getLayoutSize(\n container: Phaser.GameObjects.Container | null | undefined\n): LayoutSize | undefined {\n if (!container) return undefined\n const withLayout = container as Phaser.GameObjects.Container & {\n __getLayoutSize?: () => LayoutSize\n }\n return withLayout.__getLayoutSize?.()\n}\n\n/**\n * Hook to get layout size from a ref\n * Returns current layout dimensions of a container (updated after layout calculation)\n * Useful for accessing computed dimensions after flexbox/percentage layout\n * @param ref - Ref to a Phaser container\n * @returns Current layout size or undefined\n */\nexport function useLayoutSize(ref: {\n current: Phaser.GameObjects.Container | null\n}): LayoutSize | undefined {\n return getLayoutSize(ref.current)\n}\n\n/**\n * Utility function to get layout props from a container\n * Returns the layout/background/transform props that were applied\n * @param container - Phaser container with layout\n * @returns Layout props or undefined if container has no layout\n */\nexport function getLayoutProps(\n container: Phaser.GameObjects.Container | null | undefined\n): (LayoutProps & BackgroundProps & TransformProps) | undefined {\n if (!container) return undefined\n const withLayout = container as Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps & BackgroundProps & TransformProps\n }\n return withLayout.__layoutProps\n}\n\n/**\n * Utility function to get background object from a container\n * Returns the Image object used for backgroundColor, border, cornerRadius\n * Useful for custom animations or modifications\n * @param container - Phaser container with background\n * @returns Background image or undefined if container has no background\n */\nexport function getBackgroundGraphics(\n container: Phaser.GameObjects.Container | null | undefined\n): BackgroundImage | undefined {\n if (!container) return undefined\n const withBackground = container as Phaser.GameObjects.Container & {\n __background?: BackgroundImage\n }\n return withBackground.__background\n}\n\n/**\n * Hook to get background image from a ref\n * Returns the Image object used for rendering the background\n * Useful for animating background properties (tint, alpha, etc.)\n * @param ref - Ref to a Phaser container\n * @returns Background image or undefined\n */\nexport function useBackgroundGraphics(ref: {\n current: Phaser.GameObjects.Container | null\n}): BackgroundImage | undefined {\n return getBackgroundGraphics(ref.current)\n}\n\n/**\n * Utility function to get layout rectangle (position + size) from a container\n * Returns local position (x, y) combined with layout size\n * @param container - Phaser container with layout\n * @returns Layout rectangle { x, y, width, height } or undefined\n */\nexport function getLayoutRect(\n container: Phaser.GameObjects.Container | null | undefined\n): { x: number; y: number; width: number; height: number } | undefined {\n if (!container) return undefined\n const size = getLayoutSize(container)\n if (!size) return undefined\n return {\n x: container.x,\n y: container.y,\n width: size.width,\n height: size.height,\n }\n}\n\n/**\n * Hook to get layout rectangle from a ref\n * Returns local position and computed layout dimensions\n * Combines container position with layout size for convenience\n * @param ref - Ref to a Phaser container\n * @returns Layout rectangle { x, y, width, height } or undefined\n */\nexport function useLayoutRect(ref: {\n current: Phaser.GameObjects.Container | null\n}): { x: number; y: number; width: number; height: number } | undefined {\n return getLayoutRect(ref.current)\n}\n\n/**\n * Utility function to get world layout rectangle from a container\n * Returns absolute bounding box in scene coordinates\n * Combines layout size with world transform matrix for accurate positioning\n * Accounts for parent transforms (position, scale, rotation)\n *\n * Note: Uses getLayoutSize() for dimensions (not getBounds() which only checks children)\n * and getWorldTransformMatrix() for absolute position in world space.\n *\n * @param container - Phaser container with layout\n * @returns World layout rectangle { x, y, width, height } or undefined\n */\nexport function getWorldLayoutRect(\n container: Phaser.GameObjects.Container | null | undefined\n): { x: number; y: number; width: number; height: number } | undefined {\n if (!container) return undefined\n\n // Get layout size (actual container dimensions from layout system)\n const size = getLayoutSize(container)\n if (!size) return undefined\n\n // Get world transform matrix for absolute position\n const matrix = container.getWorldTransformMatrix()\n\n // World position (top-left corner with origin 0,0)\n const worldX = matrix.tx\n const worldY = matrix.ty\n\n // Apply world scale to layout dimensions\n const worldWidth = size.width * Math.abs(matrix.scaleX)\n const worldHeight = size.height * Math.abs(matrix.scaleY)\n\n return {\n x: worldX,\n y: worldY,\n width: worldWidth,\n height: worldHeight,\n }\n}\n\n/**\n * Hook to get world layout rectangle from a ref\n * Returns absolute position in scene coordinates and computed layout dimensions\n * Useful for positioning elements relative to screen or other world-space objects\n * @param ref - Ref to a Phaser container\n * @returns World layout rectangle { x, y, width, height } or undefined\n */\nexport function useWorldLayoutRect(ref: {\n current: Phaser.GameObjects.Container | null\n}): { x: number; y: number; width: number; height: number } | undefined {\n return getWorldLayoutRect(ref.current)\n}\n\n/**\n * Effect hook for side effects with cleanup\n * @param fn - Effect function that optionally returns cleanup\n * @param deps - Optional dependency array\n */\nexport function useEffect(fn: () => Cleanup, deps?: readonly unknown[] | undefined) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n const slot = (c.slots[i] ??\n (c.slots[i] = { deps: undefined, cleanup: undefined as Cleanup })) as {\n deps?: readonly unknown[] | undefined\n cleanup: Cleanup\n }\n c.effects.push(() => {\n if (!depsChanged(slot.deps, deps)) return\n if (typeof slot.cleanup === 'function') slot.cleanup()\n slot.cleanup = fn()\n if (deps !== undefined) {\n slot.deps = deps\n }\n })\n}\n\n/**\n * Layout effect hook - runs after layout calculations complete\n * Executes via requestAnimationFrame after all layout updates\n * Use this when you need access to final layout dimensions (useLayoutRect, etc.)\n * @param fn - Effect function that optionally returns cleanup\n * @param deps - Optional dependency array\n */\nexport function useLayoutEffect(fn: () => Cleanup, deps?: readonly unknown[] | undefined) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n const slot = (c.slots[i] ??\n (c.slots[i] = { deps: undefined, cleanup: undefined as Cleanup })) as {\n deps?: readonly unknown[] | undefined\n cleanup: Cleanup\n }\n c.effects.push(() => {\n if (!depsChanged(slot.deps, deps)) return\n if (typeof slot.cleanup === 'function') slot.cleanup()\n\n // Defer execution until layout calculations complete\n // Use requestAnimationFrame to run after layout pass finishes\n requestAnimationFrame(() => {\n slot.cleanup = fn()\n })\n\n if (deps !== undefined) {\n slot.deps = deps\n }\n })\n}\n\n/**\n * Checks if dependency arrays have changed\n * @param a - Previous dependencies\n * @param b - Current dependencies\n * @returns true if changed, false otherwise\n */\nfunction depsChanged(a?: readonly unknown[], b?: readonly unknown[]) {\n if (!a || !b) return true\n if (a.length !== b.length) return true\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return true\n }\n return false\n}\n\n/**\n * Shallow comparison for props objects\n * Used for component memoization (React.memo equivalent)\n * @param a - Previous props\n * @param b - Current props\n * @returns true if props are shallowly equal\n */\nexport function shallowEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true\n\n // Handle null/undefined\n if (a == null || b == null) return false\n\n // Must both be objects\n if (typeof a !== 'object' || typeof b !== 'object') return false\n\n const keysA = Object.keys(a)\n const keysB = Object.keys(b)\n\n // Different number of keys\n if (keysA.length !== keysB.length) return false\n\n // Check each key\n for (const key of keysA) {\n if (\n !Object.prototype.hasOwnProperty.call(b, key) ||\n !Object.is((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])\n ) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Check if component should update based on props comparison\n * Similar to React.memo() - skips re-render if props haven't changed\n * @param ctx - Component context\n * @param newProps - New props to compare\n * @returns true if component should re-render\n */\nexport function shouldComponentUpdate(ctx: Ctx, newProps: unknown): boolean {\n // Always update if memoization disabled (ctx.memoized = false or __memo = false)\n if (ctx.memoized === false) return true\n\n // Check VNode-level opt-out\n if (ctx.componentVNode.__memo === false) return true\n\n // First render or no previous props\n if (ctx.lastProps === undefined) {\n ctx.lastProps = newProps\n return true\n }\n\n // Compare props (shallow)\n const hasChanged = !shallowEqual(ctx.lastProps, newProps)\n\n // Update stored props\n ctx.lastProps = newProps\n\n return hasChanged\n}\n\n/**\n * Hook to manually trigger a component redraw\n * @returns Function to trigger redraw\n */\nexport function useRedraw(): () => void {\n const c = getCurrent()\n return () => {\n if (c != null) scheduleUpdate(c)\n }\n}\n\n/**\n * Schedules a component update on next microtask\n * @param c - Component context to update\n */\nfunction scheduleUpdate(c: Ctx) {\n if (c.updater) return\n c.updater = () => {\n c.updater = undefined\n\n // Skip update if context has been disposed\n if (c.disposed) {\n return\n }\n\n // Get scene and check if it's still valid\n const scene = isPhaserScene(c.parent) ? c.parent : c.parent.scene\n if (!scene || !scene.sys || !scene.sys.settings.active) {\n // Scene is being shut down or destroyed, skip update\n return\n }\n\n // Use component VNode props, merging with children\n const componentProps = c.componentVNode.props ?? {}\n const propsWithChildren = c.componentVNode.children?.length\n ? { ...componentProps, children: c.componentVNode.children }\n : componentProps\n\n // Render the component to get the new VNode\n const nextVNode = normalizeVNodeLike(withHooks(c, () => c.function(propsWithChildren)))\n\n // Patch the existing rendered tree\n patchVNode(c.parent, c.vnode, nextVNode)\n\n c.vnode = nextVNode\n\n // Run effects after patching\n for (const run of c.effects) run()\n }\n queueMicrotask(c.updater)\n} /**\n * Disposes component context and runs cleanups\n * @param c - Context to dispose\n */\nexport function disposeCtx(c: Ctx) {\n // Mark as disposed to prevent pending updates\n c.disposed = true\n\n // Run all cleanup functions from cleanups array\n for (const cl of c.cleanups) {\n if (typeof cl === 'function') cl()\n }\n\n // Run all cleanup functions from slots (effects)\n for (const slot of c.slots) {\n if (\n slot &&\n typeof slot === 'object' &&\n 'cleanup' in slot &&\n typeof slot.cleanup === 'function'\n ) {\n slot.cleanup()\n }\n }\n\n // Clear cleanups array to prevent duplicate cleanup calls\n c.cleanups.length = 0\n\n // NOTE: We intentionally do NOT clear slots, effects, or updater\n // because the context might still be referenced by pending updates\n // The disposed flag will prevent any queued updates from executing\n}\n\n// SVG texture hooks have been moved to hooks-svg.ts for global texture management\n// Import them from there: import { useSVGTexture, useSVGTextures, type SVGTextureConfig } from './hooks-svg'\n","/** @jsxImportSource ../.. */\n/**\n * View component wrapper - strict type-safe wrapper around primitive view\n * This component is the public API for View, with controlled prop interface\n */\nimport type * as Phaser from 'phaser'\nimport type {\n BackgroundProps,\n GestureProps,\n LayoutProps,\n PhaserProps,\n TransformProps,\n} from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\nimport type { VNodeLike } from '../../vdom'\n\n/**\n * Props for View component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface ViewProps\n extends\n TransformProps,\n PhaserProps,\n LayoutProps,\n BackgroundProps,\n GestureProps,\n PropsDefaultExtension<Phaser.GameObjects.Container> {\n /** Child components */\n children?: ChildrenType\n}\n\n/**\n * View component\n * Primary layout container with background styling and gesture support\n *\n * @example\n * ```tsx\n * <View direction=\"row\" gap={10} padding={20}>\n * <Text text=\"Hello\" />\n * <Text text=\"World\" />\n * </View>\n *\n * <View backgroundColor={0x3498db} cornerRadius={8}>\n * <Text text=\"Card\" />\n * </View>\n *\n * <View enableGestures={true} onTouch={() => console.log('clicked')}>\n * <Text text=\"Button\" />\n * </View>\n * ```\n */\nexport function View(props: ViewProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('View', localTheme, props)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <view {...themed} theme={nestedTheme} />\n}\n","/**\n * SceneWrapper - Internal component that provides scene dimensions\n * Enables percentage-based sizing for mounted components\n * Used automatically by mountJSX unless disableAutoSize is true\n */\n/** @jsxImportSource ../.. */\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../custom/View'\n\n/**\n * Props for SceneWrapper\n */\nexport interface SceneWrapperProps {\n /** Scene/container width in pixels */\n width: number\n /** Scene/container height in pixels */\n height: number\n /** Child component to render */\n children: VNodeLike\n}\n\n/**\n * Internal wrapper that provides scene dimensions to child components\n * This allows child components to use percentage-based widths/heights\n * @param props - SceneWrapper properties\n * @returns View with absolute dimensions\n */\nexport function SceneWrapper(props: SceneWrapperProps) {\n const { width, height, children } = props\n\n return (\n <View width={width} height={height}>\n {children}\n </View>\n )\n}\n","/**\n * Portal registry - manages portal trees and depth ordering\n */\nimport type * as Phaser from 'phaser'\nimport type { VNode } from '../hooks'\nimport type { PortalTree } from './portal-types'\n\n/**\n * Global portal registry\n * Manages all portal trees across scenes with depth-based ordering\n */\nclass PortalRegistry {\n private portals: Map<string, PortalTree> = new Map()\n private idCounter = 0\n private portalRoots: Map<Phaser.Scene, Phaser.GameObjects.Container> = new Map()\n private viewportSizes: Map<Phaser.Scene, { width: number; height: number }> = new Map()\n\n /**\n * Generate unique portal ID\n * @returns Unique portal ID\n */\n generateId(): string {\n return `portal-${++this.idCounter}`\n }\n\n /**\n * Get or create portal root container for scene\n * This container sits at very high depth to ensure portals are above regular content\n * @param scene - Phaser scene\n * @returns Portal root container\n */\n private getOrCreatePortalRoot(scene: Phaser.Scene): Phaser.GameObjects.Container {\n let root = this.portalRoots.get(scene)\n if (!root) {\n root = scene.add.container(0, 0)\n root.setDepth(999999) // Very high depth to be above normal content\n\n // Set very high mountRootId so GestureManager prioritizes portals over normal UI\n // This ensures portal events are processed first in event bubbling\n ;(root as unknown as { __mountRootId?: number }).__mountRootId = 999999\n\n this.portalRoots.set(scene, root)\n }\n return root\n }\n\n /**\n * Register a new portal tree\n * @param id - Portal ID\n * @param depth - Z-depth (higher = foreground)\n * @param scene - Phaser scene\n * @param vnode - Root VNode\n * @param mountedNode - Mounted GameObject\n * @returns Portal container\n */\n register(\n id: string,\n depth: number,\n scene: Phaser.Scene,\n vnode: VNode,\n mountedNode: Phaser.GameObjects.GameObject\n ): Phaser.GameObjects.Container {\n // Get portal root container for this scene\n const portalRoot = this.getOrCreatePortalRoot(scene)\n\n // Create container for this portal as child of portal root\n const container = scene.add.container(0, 0)\n container.setDepth(depth)\n portalRoot.add(container)\n\n // Store portal tree\n const portal: PortalTree = {\n id,\n depth,\n container,\n vnode,\n scene,\n mountedNode,\n }\n\n this.portals.set(id, portal)\n\n // Re-sort all portals in scene by depth to maintain input priority\n this.sortPortalsByDepth(scene)\n\n return container\n }\n\n /**\n * Sort portals in scene by depth (highest to lowest)\n * Ensures correct input event order within portal root\n * Phaser processes input from LAST to FIRST child in DisplayList\n * So highest depth should be LAST in the list to receive events first\n * @param scene - Phaser scene\n */\n private sortPortalsByDepth(scene: Phaser.Scene): void {\n const portalRoot = this.portalRoots.get(scene)\n if (!portalRoot) return\n\n const scenePortals = this.getByScene(scene)\n // Sort by depth DESCENDING - highest depth should be last in DisplayList\n scenePortals.sort((a, b) => b.depth - a.depth)\n\n // Remove all from portal root\n portalRoot.removeAll(false)\n\n // Add back in reverse order: lowest depth first, highest depth last\n for (let i = scenePortals.length - 1; i >= 0; i--) {\n const portal = scenePortals[i]\n if (portal) {\n portalRoot.add(portal.container)\n }\n }\n }\n\n /**\n * Unregister and cleanup portal\n * @param id - Portal ID\n */\n unregister(id: string): void {\n const portal = this.portals.get(id)\n if (!portal) return\n\n // Cleanup container and mounted node\n portal.container.destroy()\n\n this.portals.delete(id)\n\n // Cleanup portal root if no more portals in scene\n const scenePortals = this.getByScene(portal.scene)\n if (scenePortals.length === 0) {\n const root = this.portalRoots.get(portal.scene)\n if (root) {\n root.destroy()\n this.portalRoots.delete(portal.scene)\n }\n }\n }\n\n /**\n * Get portal by ID\n * @param id - Portal ID\n * @returns Portal tree or undefined\n */\n get(id: string): PortalTree | undefined {\n return this.portals.get(id)\n }\n\n /**\n * Get all portals sorted by depth (ascending)\n * @returns Sorted portal trees\n */\n getByDepth(): PortalTree[] {\n return Array.from(this.portals.values()).sort((a, b) => a.depth - b.depth)\n }\n\n /**\n * Get all portals for a specific scene\n * @param scene - Phaser scene\n * @returns Portal trees in scene\n */\n getByScene(scene: Phaser.Scene): PortalTree[] {\n return Array.from(this.portals.values()).filter((p) => p.scene === scene)\n }\n\n /**\n * Clear all portals\n */\n clear(): void {\n for (const portal of this.portals.values()) {\n portal.container.destroy()\n }\n this.portals.clear()\n }\n\n /**\n * Set viewport size for a scene\n * Used by Portal system to know screen dimensions for centering\n * @param scene - Phaser scene\n * @param width - Viewport width\n * @param height - Viewport height\n */\n setViewportSize(scene: Phaser.Scene, width: number, height: number): void {\n this.viewportSizes.set(scene, { width, height })\n }\n\n /**\n * Get viewport size for a scene\n * @param scene - Phaser scene\n * @returns Viewport size or default 800x600\n */\n getViewportSize(scene: Phaser.Scene): { width: number; height: number } {\n return this.viewportSizes.get(scene) ?? { width: 800, height: 600 }\n }\n\n /**\n * Get portal count\n * @returns Number of registered portals\n */\n get size(): number {\n return this.portals.size\n }\n}\n\n/**\n * Global portal registry instance\n */\nexport const portalRegistry = new PortalRegistry()\n","/**\n * VDOM + mount/patch/unmount and host integration.\n * This file glues JSX VNodes to Phaser GameObjects using the host bridge.\n */\nimport equal from './utils/fast-deep-equal'\nimport * as Phaser from 'phaser'\nimport { SceneWrapper } from './components/internal/SceneWrapper'\nimport type { NodeProps, NodeType } from './core-types'\nimport { DebugLogger, DevConfig } from './dev-config'\nimport { generateMountRootId, getGestureManager } from './gestures/gesture-manager'\nimport { disposeCtx, shouldComponentUpdate, withHooks, type Ctx, type VNode } from './hooks'\nimport { host } from './host'\nimport { Fragment } from './jsx-runtime'\nimport { calculateLayout, type LayoutSize } from './layout/index'\nimport { portalRegistry } from './portal'\nimport { getRenderContext } from './render-context'\nimport { getThemedProps } from './theme'\nimport type { ParentType, Ref, VNodeLike } from './types'\nimport { isPhaserContainer, isPhaserScene } from './utils/phaser-guards'\nexport type { VNodeLike } from './types'\n\n/**\n * Registry for active mountJSX instances to enable complete remounting\n * Stores parent, type, and props for each mount to enable theme-triggered remounts\n */\ninterface MountRegistryEntry {\n id: number\n parent: ParentType\n type: NodeType | ((props: unknown) => VNodeLike)\n props: MountProps & Record<string, unknown>\n rootNode: Phaser.GameObjects.GameObject\n vnode: VNode\n}\n\nclass MountRegistry {\n private entries: Map<number, MountRegistryEntry> = new Map()\n private nextId = 1\n\n /**\n * Register a new mountJSX instance\n * @param parent - Parent container or scene\n * @param type - Component type or node type\n * @param props - Mount props\n * @param rootNode - Root game object\n * @returns Registry ID for this mount\n */\n register(\n parent: ParentType,\n type: NodeType | ((props: unknown) => VNodeLike),\n props: MountProps & Record<string, unknown>,\n rootNode: Phaser.GameObjects.GameObject,\n vnode: VNode\n ): number {\n const id = this.nextId++\n this.entries.set(id, { id, parent, type, props, rootNode, vnode })\n DebugLogger.log('vdom', `Registered mount ${id}`)\n return id\n }\n\n /**\n * Unregister a mountJSX instance\n * @param id - Registry ID\n */\n unregister(id: number): void {\n const entry = this.entries.get(id)\n if (entry) {\n DebugLogger.log('vdom', `Unregistered mount ${id}`)\n this.entries.delete(id)\n }\n }\n\n /**\n * Get a specific mount entry by registry ID\n * @param id - Registry ID\n * @returns Mount entry or undefined if not found\n */\n getEntry(id: number): MountRegistryEntry | undefined {\n return this.entries.get(id)\n }\n\n /**\n * Find a mount entry by parent and optional key\n * If key is provided, matches parent AND key\n * If key is omitted, returns first mount with matching parent (backward compatibility)\n * Validates that scene is still active and objects are not destroyed\n * @param parent - Parent container or scene\n * @param key - Optional unique key to distinguish multiple mounts on same parent\n * @returns Mount entry or undefined if not found or invalid\n */\n findByParentAndKey(parent: ParentType, key?: string): MountRegistryEntry | undefined {\n for (const entry of this.entries.values()) {\n // Validate scene is still active\n const scene = isPhaserScene(entry.parent)\n ? entry.parent\n : (entry.parent as Phaser.GameObjects.GameObject).scene\n\n // Skip if scene is invalid or shutting down\n if (!scene || !scene.sys || !scene.sys.settings.active) {\n // Scene was destroyed, remove from registry\n DebugLogger.log('vdom', `Removing mount ${entry.id} - scene inactive`)\n this.unregister(entry.id)\n continue\n }\n\n // Skip if rootNode was destroyed or scene reference changed (scene restart)\n if (!entry.rootNode.active || entry.rootNode.scene !== scene) {\n DebugLogger.log('vdom', `Removing mount ${entry.id} - rootNode destroyed or scene changed`)\n this.unregister(entry.id)\n continue\n }\n\n const entryKey = (entry.props as MountProps).key\n\n // If key is provided, match both parent AND key\n if (key !== undefined) {\n if (entry.parent === parent && entryKey === key) {\n return entry\n }\n } else {\n // If key is omitted, return first mount with matching parent (backward compat)\n if (entry.parent === parent) {\n return entry\n }\n }\n }\n return undefined\n }\n\n /**\n * Get all active mount entries\n * @returns Array of mount entries\n */\n getAllEntries(): MountRegistryEntry[] {\n return Array.from(this.entries.values())\n }\n\n /**\n * Get count of active mounts\n * @returns Number of registered mounts\n */\n getCount(): number {\n return this.entries.size\n }\n\n /**\n * Get statistics about active mounts\n * @returns Object with mount statistics\n */\n getStats(): {\n totalMounts: number\n byType: Map<string, number>\n byParent: Map<ParentType, number>\n byKey: Map<string, number>\n mounts: Array<{\n id: number\n type: string\n key?: string\n parentType: string\n propsKeys: string[]\n }>\n } {\n const byType = new Map<string, number>()\n const byParent = new Map<ParentType, number>()\n const byKey = new Map<string, number>()\n const mounts: Array<{\n id: number\n type: string\n key?: string\n parentType: string\n propsKeys: string[]\n }> = []\n\n for (const entry of this.entries.values()) {\n // Count by type\n const typeName = typeof entry.type === 'string' ? entry.type : entry.type.name || 'Component'\n byType.set(typeName, (byType.get(typeName) ?? 0) + 1)\n\n // Count by parent\n byParent.set(entry.parent, (byParent.get(entry.parent) ?? 0) + 1)\n\n // Count by key\n const key = (entry.props as MountProps).key\n if (key) {\n byKey.set(key, (byKey.get(key) ?? 0) + 1)\n }\n\n // Collect mount info\n const parentType = isPhaserScene(entry.parent) ? 'Scene' : 'Container'\n const mountInfo: {\n id: number\n type: string\n key?: string\n parentType: string\n propsKeys: string[]\n } = {\n id: entry.id,\n type: typeName,\n parentType,\n propsKeys: Object.keys(entry.props),\n }\n if (key !== undefined) {\n mountInfo.key = key\n }\n mounts.push(mountInfo)\n }\n\n return {\n totalMounts: this.entries.size,\n byType,\n byParent,\n byKey,\n mounts,\n }\n }\n\n /**\n * Clear all entries (for testing)\n */\n clear(): void {\n this.entries.clear()\n this.nextId = 1\n }\n}\n\n/**\n * Global mount registry instance\n */\nconst mountRegistry = new MountRegistry()\n\n/**\n * Get statistics about active mountJSX instances\n * Useful for debugging and monitoring mount registry state\n * @returns Object with mount statistics including counts by type, parent, and key\n */\nexport function getMountStats() {\n return mountRegistry.getStats()\n}\n\n/**\n * Remount all active mountJSX instances\n * Completely unmounts and remounts every registered root\n * Used when theme changes require full VDOM rebuild\n */\nexport function remountAll(): void {\n const entries = mountRegistry.getAllEntries()\n\n if (entries.length === 0) {\n DebugLogger.log('vdom', 'No mounts to remount')\n return\n }\n\n console.log(`[REMOUNT] Starting remount of ${entries.length} root(s)`)\n\n entries.forEach((entry) => {\n try {\n // Find the current VNode stored in the scene\n const scene = isPhaserScene(entry.parent)\n ? entry.parent\n : (entry.parent as Phaser.GameObjects.GameObject).scene\n\n if (!scene || !scene.sys) {\n console.warn('[REMOUNT] Scene is invalid, skipping remount')\n return\n }\n\n const currentVNode = (scene as unknown as { __rootVNode?: VNode }).__rootVNode\n\n // Clear all children from the root container first\n if (isPhaserContainer(entry.rootNode)) {\n // Remove all children from container\n const children = entry.rootNode.getAll()\n children.forEach((child) => {\n ;(entry.rootNode as Phaser.GameObjects.Container).remove(child, true) // true = destroy child\n })\n }\n\n // Unmount the VDOM tree (this cleans up hooks, contexts, etc.)\n if (currentVNode) {\n // Recursively unmount children but skip the final host.remove\n // since we already cleared the container above\n const flatChildren = flattenChildren(currentVNode.children)\n flatChildren.forEach(unmount)\n\n // Clean up component context if it exists\n if (currentVNode.__ctx) {\n disposeCtx(currentVNode.__ctx)\n delete currentVNode.__ctx\n }\n }\n\n // Create and mount a fresh VDOM tree\n const { width, height, disableAutoSize = false, ...componentProps } = entry.props\n\n // Update viewport dimensions\n const renderContext = getRenderContext(entry.parent)\n renderContext.setViewport(width, height, scene)\n portalRegistry.setViewportSize(scene, width, height)\n\n // Create VNode with or without SceneWrapper\n let vnode: VNode\n\n if (disableAutoSize) {\n vnode = { type: entry.type, props: { ...componentProps, width, height }, children: [] }\n } else {\n const componentVNode: VNode = {\n type: entry.type,\n props: componentProps,\n children: [],\n }\n\n vnode = {\n type: SceneWrapper,\n props: {\n width,\n height,\n children: componentVNode,\n },\n children: [],\n }\n }\n\n // Store new root VNode on the scene\n ;(scene as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n\n // Mount the new VDOM tree into the EXISTING parent container\n const rootNode = mount(entry.parent, vnode)\n\n if (isPhaserContainer(rootNode)) {\n ;(rootNode as unknown as { __mountRootId?: number }).__mountRootId = generateMountRootId()\n }\n\n // Update registry with new root node and restore registry ID\n entry.rootNode = rootNode\n entry.vnode = vnode\n ;(rootNode as unknown as { __registryId?: number }).__registryId = entry.id\n ;(rootNode as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n\n console.log('[REMOUNT] Successfully remounted entry', entry.id)\n } catch (error) {\n console.error('[REMOUNT] Failed to remount entry', entry.id, error)\n }\n })\n\n console.log('[REMOUNT] Remount complete')\n}\n\n/**\n * Base props that mountJSX requires for scene dimensions\n * Provides viewport size for percentage-based sizing\n */\nexport interface MountProps {\n /** Scene/container width in pixels */\n width: number\n /** Scene/container height in pixels */\n height: number\n /** Disable automatic SceneWrapper (default: false) */\n disableAutoSize?: boolean\n /** Unique key to distinguish multiple mounts on same parent */\n key?: string\n}\n\n/**\n * Combined props type: MountProps + Component-specific props\n * Use this for type-safe mountJSX calls\n */\nexport type MountComponentProps<P = Record<string, never>> = MountProps & P\n\n/**\n * Returned handle from mountJSX\n * Extends the root GameObject with a typed unmount helper\n */\nexport interface MountHandle extends Phaser.GameObjects.GameObject {\n unmount: () => void\n}\n\n/**\n * Normalizes a component return into a single VNode or null.\n * Wraps arrays into a Fragment VNode for consistent mounting.\n */\nexport function normalizeVNodeLike(rendered: VNodeLike): VNode | null {\n if (!rendered) return null\n if (Array.isArray(rendered)) {\n const flat = (rendered as unknown[]).flat(Infinity) as (VNode | null | undefined | false)[]\n return { type: Fragment, props: {}, children: flat }\n }\n return rendered as VNode\n}\n\n/**\n * Flattens nested arrays iteratively (performance optimized)\n * Handles arrays that weren't flattened by jsx-runtime (e.g., from Fragment)\n * @param children - Array that may contain nested arrays\n * @returns Flattened array\n */\nfunction flattenChildren(\n children: (VNode | null | false | undefined)[] | undefined\n): (VNode | null | false | undefined)[] {\n if (!children) return []\n return children.flat(Infinity) as (VNode | null | false | undefined)[]\n}\n\n/**\n * Checks if a child should be skipped during mounting\n * Filters out falsy values, empty strings, and whitespace-only strings\n * @param child - Child to check\n * @returns true if child should be skipped\n */\nfunction shouldSkipChild(child: unknown): boolean {\n if (child == null || child === false) return true\n if (typeof child === 'string') {\n const trimmed = child.trim()\n if (trimmed === '') {\n if (child !== '') {\n console.warn('JSX: Ignoring whitespace-only string in component children')\n }\n return true\n }\n }\n return false\n}\n\n/**\n * Checks if a set of VNode siblings are likely list items that need keys\n * Heuristics: multiple siblings of same type, or array index patterns\n * Static children (from jsxs()) are already excluded before this check\n * @param children - Array of child VNodes\n * @returns true if children look like a list that should have keys\n */\nfunction looksLikeList(children: (VNode | null | false | undefined)[]): boolean {\n const validChildren = children.filter((c) => c != null && c !== false) as VNode[]\n\n // Require at least 5+ children of same type to reduce false positives\n // 2-4 items are often static JSX siblings, not dynamic lists\n if (validChildren.length < 5) return false\n\n // Check if all children have the same type (strong indicator of list)\n const types = new Set(validChildren.map((c) => c.type))\n if (types.size === 1) return true\n\n // Check if many children are missing keys (50%+ threshold)\n const missingKeys = validChildren.filter((c) => !c.__key).length\n return missingKeys / validChildren.length >= 0.5\n}\n\n/**\n * Warns about missing key props in list-like children\n * Helps detect performance issues from VDOM reconciliation problems\n * @param parent - Parent VNode\n * @param children - Child VNodes to check\n */\nfunction warnMissingKeys(parent: VNode, children: (VNode | null | false | undefined)[]): void {\n if (!DevConfig.warnings.missingKeys) return\n\n // Skip warning if children are marked as static (from jsxs())\n if (parent.__staticChildren) return\n\n if (!looksLikeList(children)) return\n\n const validChildren = children.filter((c) => c != null && c !== false) as VNode[]\n const withoutKeys = validChildren.filter((c) => !c.__key)\n\n if (withoutKeys.length === 0) return\n\n const parentPath = buildComponentPath(parent)\n const firstChild = withoutKeys[0]\n if (!firstChild) return\n\n const childType =\n typeof firstChild.type === 'string'\n ? firstChild.type\n : (firstChild.type as { name?: string })?.name || 'Component'\n\n console.warn(\n `[PhaserJSX] Missing key props: ${withoutKeys.length}/${validChildren.length} <${childType}> children in <${parentPath}> don't have keys.`\n /*\n + `\\nThis can cause:\n` +\n ` • Unnecessary component recreation instead of updates\n` +\n ` • State loss in conditional rendering\n` +\n ` • Performance degradation with lists\n` +\n `\\nAdd unique key props to each child, e.g.:\\n` +\n ` <${childType} key=\"unique-id\" />\\n` +\n `\\nTo disable this warning: DevConfig.warnings.missingKeys = false`\n*/\n )\n}\n\n/**\n * Warns when a component remounts unnecessarily due to key/type mismatch\n * Helps detect inline JSX creation or callback recreation issues\n * @param oldV - Previous VNode\n * @param newV - New VNode\n */\nfunction warnUnnecessaryRemount(oldV: VNode, newV: VNode): void {\n if (!DevConfig.warnings.unnecessaryRemounts) return\n\n // Only warn for components (not primitives)\n if (typeof oldV.type !== 'function' && typeof newV.type !== 'function') return\n\n const oldPath = buildComponentPath(oldV)\n const reason = oldV.__key !== newV.__key ? 'key changed' : 'type changed'\n\n console.warn(\n `[PhaserJSX] Unnecessary remount: <${oldPath}> remounted because ${reason}.\\n` +\n `This often happens when:\n` +\n ` • JSX elements are created inline: prefix={<Icon />} (create new object every render)\n` +\n ` • Callbacks are not memoized: onClick={() => handler()} (new function every render)\n` +\n `\\nSolutions:\n` +\n ` • Memoize JSX: const icon = useMemo(() => <Icon />, [])\n` +\n ` • Memoize callbacks: const handleClick = useCallback(() => handler(), [])\n` +\n ` • Add stable key props: key=\"my-component\"\n` +\n `\\nTo disable this warning: DevConfig.warnings.unnecessaryRemounts = false`\n )\n}\n\n/**\n * Builds a component path string by walking up the VNode tree\n * Stops at the first parent with a key prop for easier debugging\n * @param vnode - VNode to start from\n * @returns Path string like \"ParentWithKey[myKey] > Child > Grandchild\"\n */\nfunction buildComponentPath(vnode: VNode): string {\n const path: string[] = []\n let current: VNode | undefined = vnode\n\n while (current) {\n const typeName =\n typeof current.type === 'string'\n ? current.type\n : (current.type as { name?: string })?.name || 'Component'\n const key = current.props?.key\n\n if (key) {\n // Found a keyed parent - add it with key and stop\n path.unshift(`${typeName}[key=\"${key}\"]`)\n break\n } else {\n path.unshift(typeName)\n }\n\n // Walk up to parent VNode (if stored)\n current = (current as VNode & { __parentVNode?: VNode }).__parentVNode\n }\n\n return path.join(' > ')\n}\n\n/**\n * Safely sets __theme on a VNode, handling frozen/sealed objects\n * Creates a shallow copy if the object is not extensible\n * @param vnode - VNode to set theme on\n * @param theme - Theme object to set\n * @returns Original VNode if extensible, or shallow copy with theme\n */\nfunction setThemeSafe<T extends VNode>(vnode: T, theme: Record<string, unknown>): T {\n // Check if object can be modified\n if (Object.isExtensible(vnode)) {\n vnode.__theme = theme\n return vnode\n }\n\n // Object is frozen/sealed - create shallow copy with theme\n if (DevConfig.warnings.frozenVNodes) {\n const componentPath = buildComponentPath(vnode)\n console.warn(\n `[PhaserJSX] Frozen VNode detected at <${componentPath}>. ` +\n `Creating shallow copy to apply theme. ` +\n `This may happen in production builds or with certain bundler optimizations.`\n )\n }\n\n // Create shallow copy with theme\n return { ...vnode, __theme: theme }\n}\n\n/**\n * Safely sets a property on a VNode, handling frozen/sealed objects\n * Creates a shallow copy if the object is not extensible\n * @param vnode - VNode to set property on\n * @param key - Property key to set\n * @param value - Value to set\n * @returns Original VNode if extensible, or shallow copy with property\n */\nfunction setVNodePropSafe<T extends VNode, K extends string>(vnode: T, key: K, value: unknown): T {\n // Check if object can be modified\n if (Object.isExtensible(vnode)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(vnode as any)[key] = value\n return vnode\n }\n\n // Object is frozen/sealed - create shallow copy with property\n if (DevConfig.warnings.frozenVNodes) {\n const componentPath = buildComponentPath(vnode)\n console.warn(\n `[PhaserJSX] Frozen VNode detected at <${componentPath}>. ` +\n `Creating shallow copy to set property '${key}'. ` +\n `This may happen in production builds or with certain bundler optimizations.`\n )\n }\n\n // Create shallow copy with property\n return { ...vnode, [key]: value } as T\n}\n\n/**\n * Updates gesture hit area based on current layout size\n * Called after layout recalculation to sync hit area with actual container size\n * @param container - Container with potential gesture registration\n */\nfunction updateGestureHitAreaAfterLayout(container: Phaser.GameObjects.Container): void {\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n // Only update if container has gesture system enabled and layout size available\n if (!containerWithLayout.__getLayoutSize) return\n\n try {\n const manager = getGestureManager(container.scene)\n\n // Check if container is actually registered with gesture manager\n // If not, skip the update - this prevents overwriting hit areas of other containers\n if (!manager.hasContainer(container)) return\n\n // Use actual container dimensions after layout, not __getLayoutSize\n // __getLayoutSize may return 0x0 for containers with fill sizing before parent is laid out\n const width = container.width\n const height = container.height\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n manager.updateHitArea(container, hitArea)\n } catch {\n // Gesture manager or container not registered, ignore\n }\n}\n\n/**\n * Layout-relevant props that trigger layout recalculation when changed\n * These are the props that affect container/child sizing and positioning\n */\nconst LAYOUT_PROPS = [\n 'width',\n 'height',\n 'minWidth',\n 'maxWidth',\n 'minHeight',\n 'maxHeight',\n 'flex',\n 'margin',\n 'padding',\n 'gap',\n 'direction',\n 'justifyContent',\n 'alignItems',\n 'overflow',\n 'visible', // visible=\"none\" removes element from layout (like CSS display: none)\n] as const\n\n/**\n * Object props that need deep comparison\n * These props are objects and should be compared by value, not by reference\n */\nconst DEEP_COMPARE_PROPS = new Set(['margin', 'padding'])\n\n/**\n * Check if layout-relevant props changed between two VNodes\n * Uses shallow equality for primitives and deep equality for objects\n * @param oldV - Previous VNode\n * @param newV - New VNode\n * @returns True if any layout prop changed\n */\nfunction hasLayoutPropsChanged(oldV: VNode, newV: VNode): boolean {\n const oldProps = oldV.props ?? {}\n const newProps = newV.props ?? {}\n\n // Check each layout-relevant prop\n for (const prop of LAYOUT_PROPS) {\n const oldVal = oldProps[prop]\n const newVal = newProps[prop]\n\n // Use deep comparison for object props (margin, padding)\n if (DEEP_COMPARE_PROPS.has(prop)) {\n if (!equal(oldVal, newVal)) {\n return true\n }\n } else {\n // Shallow comparison for primitives\n if (oldVal !== newVal) {\n return true\n }\n }\n }\n\n return false\n}\n\n/**\n * Attaches or detaches a ref to a node\n * @param ref - Ref callback or object\n * @param value - Value to set (null for detach)\n */\nfunction attachRef<T>(ref: Ref<T> | undefined, value: T | null): void {\n if (!ref) return\n if (typeof ref === 'function') {\n ref(value)\n } else {\n ref.current = value\n }\n}\n\n/**\n * Creates a VNode element (alternative to JSX)\n * @param type - Element type (string or component)\n * @param props - Element props\n * @param children - Child elements\n * @returns VNode object\n */\nexport function createElement(\n type: string | ((props: Record<string, unknown>) => VNode),\n props: Record<string, unknown> | null,\n ...children: VNode[]\n): VNode {\n const flat = ([] as unknown[]).concat(...children).filter((c) => c != null)\n return { type, props: props ?? {}, children: flat as VNode[] }\n}\n\n/**\n * Mounts a VNode to the scene or parent container\n * @param parentOrScene - Scene or parent container\n * @param vnode - Virtual node to mount\n * @returns Created Phaser GameObject\n */\nexport function mount(parentOrScene: ParentType, vnode: VNode): Phaser.GameObjects.GameObject {\n // Guard against invalid virtual nodes\n if (!vnode || typeof vnode !== 'object') {\n // Create a dummy invisible container to prevent crashes\n console.error(\n '❌ Invalid VNode (not an object):',\n vnode,\n '\\n📍 This typically happens with raw text nodes in JSX.',\n '\\n💡 Solution: Wrap in <Text> component or use {expression} syntax'\n )\n // Return a dummy container to prevent cascade failures\n const dummy = (parentOrScene as Phaser.Scene).add.container(0, 0)\n dummy.setVisible(false)\n return dummy as Phaser.GameObjects.GameObject\n }\n if (vnode.type === undefined || vnode.type === null) {\n const componentPath = buildComponentPath(vnode)\n console.error(\n '❌ VNode with undefined/null type',\n `\\n📍 Component path: ${componentPath}`,\n '\\n💡 Invalid value:',\n vnode,\n '\\nℹ️ Check for empty JSX expressions {} or conditional renders returning undefined.',\n '\\n💡 Solution: Use {condition && <Component />} or provide fallback'\n )\n // Return a dummy container to prevent cascade failures\n const dummy = (parentOrScene as Phaser.Scene).add.container(0, 0)\n dummy.setVisible(false)\n return dummy as Phaser.GameObjects.GameObject\n }\n\n // Fragment - mount children directly without creating a container\n if (vnode.type === Fragment) {\n // Mount all children directly to parent\n let firstNode: Phaser.GameObjects.GameObject | undefined\n const flatChildren = flattenChildren(vnode.children)\n flatChildren.forEach((c) => {\n if (!shouldSkipChild(c)) {\n // Type guard: c is VNode at this point\n let child = c as VNode\n // Track parent VNode for error messages\n child = setVNodePropSafe(child, '__parentVNode', vnode)\n // Propagate theme to children\n if (!child.__theme && vnode.__theme) {\n const themed = setThemeSafe(child, vnode.__theme)\n if (themed !== child) {\n // VNode was frozen, replace it in parent's children array\n flatChildren[flatChildren.indexOf(child)] = themed\n }\n }\n const childNode = mount(parentOrScene, child)\n if (!firstNode) firstNode = childNode\n }\n })\n // Store a marker so we know this is a fragment during unmount/patch\n vnode = setVNodePropSafe(vnode, '__node', firstNode)\n vnode = setVNodePropSafe(vnode, '__parent', parentOrScene)\n // Fragment must have at least one child to work properly\n if (!firstNode) {\n throw new Error('Fragment must have at least one child element')\n }\n return firstNode\n }\n\n // Function component\n if (typeof vnode.type === 'function') {\n // Debug log for theme\n if (vnode.__theme) {\n DebugLogger.log(\n 'vdom',\n `Function component ${vnode.type.name} mounting with __theme:`,\n vnode.__theme\n )\n }\n\n // Extract scene early for potential null-return handling\n const scene = isPhaserScene(parentOrScene)\n ? parentOrScene\n : (parentOrScene as Phaser.GameObjects.GameObject).scene\n\n const ctx: Ctx = {\n index: 0,\n slots: [],\n effects: [],\n cleanups: [],\n vnode, // Will be updated to rendered VNode below\n componentVNode: vnode, // Keep reference to component VNode\n parent: parentOrScene,\n function: vnode.type as (props: unknown) => VNodeLike,\n isFactory: false,\n theme: vnode.__theme, // Inherit theme from parent or use vnode's theme\n }\n // Store context on the component vnode for patching\n vnode = setVNodePropSafe(vnode, '__ctx', ctx)\n // Pass children to the component via props\n const propsWithChildren = vnode.children?.length\n ? { ...(vnode.props ?? {}), children: vnode.children }\n : vnode.props\n const renderedRaw = withHooks(ctx, () =>\n (vnode.type as (props: unknown) => VNodeLike)(propsWithChildren)\n )\n let rendered = normalizeVNodeLike(renderedRaw)\n\n // Handle null/undefined returns (e.g., from Portal component)\n if (!rendered) {\n // Component returned null - this is valid (e.g., Portal)\n ctx.vnode = rendered\n // IMPORTANT: Run effects even if component returns null (e.g., Portal needs useEffect)\n for (const run of ctx.effects) run()\n // Return a dummy container that won't be used\n const dummyContainer = scene.add.container(0, 0)\n dummyContainer.visible = false\n return dummyContainer\n }\n\n // Propagate theme to rendered VNode\n if (ctx.theme && !rendered.__theme) {\n const themed = setThemeSafe(rendered, ctx.theme)\n if (themed !== rendered) {\n // VNode was frozen, use the copy\n return mount(parentOrScene, themed)\n }\n }\n\n // Check if this is a VNode factory (renders immediately without using hooks)\n if (ctx.slots.length === 0 && ctx.effects.length === 0) {\n // This is a simple factory function, not a real component\n ctx.isFactory = true\n // Keep reference to the rendered output so unmounting works without recursion\n ctx.vnode = rendered\n // Copy __addConfig from component VNode to rendered VNode\n if (vnode.__addConfig) {\n rendered = setVNodePropSafe(rendered, '__addConfig', vnode.__addConfig)\n }\n // Mount the rendered VNode directly without creating a component context\n return mount(parentOrScene, rendered)\n }\n\n // Copy __addConfig from component VNode to rendered VNode\n if (vnode.__addConfig) {\n rendered = setVNodePropSafe(rendered, '__addConfig', vnode.__addConfig)\n }\n const node = mount(parentOrScene, rendered)\n ctx.cleanups.push(() => unmount(rendered))\n ctx.vnode = rendered\n for (const run of ctx.effects) run()\n return node\n }\n // Host node\n // Check if parentOrScene is already a Phaser.Scene\n const scene = (parentOrScene as { sys?: unknown }).sys\n ? (parentOrScene as Phaser.Scene) // It's a Scene\n : ((parentOrScene as { scene?: unknown }).scene as Phaser.Scene) // It's a game object with .scene\n\n // Apply theme to props and extract nested themes for children\n const nodeType = vnode.type as NodeType\n const { props: themedProps, nestedTheme } = getThemedProps(\n nodeType,\n vnode.__theme,\n vnode.props ?? {}\n )\n\n // Debug: Log themed props for View\n if (\n nodeType === 'View' &&\n (themedProps.backgroundColor !== undefined || themedProps.cornerRadius !== undefined)\n ) {\n DebugLogger.log('theme', 'VDOM Mount - Themed props for View:', {\n backgroundColor: themedProps.backgroundColor,\n cornerRadius: themedProps.cornerRadius,\n hasTheme: !!vnode.__theme,\n originalProps: vnode.props,\n })\n }\n\n const node = host.create(nodeType, themedProps as NodeProps, scene)\n vnode = setVNodePropSafe(vnode, '__node', node)\n vnode = setVNodePropSafe(vnode, '__parent', parentOrScene) // Store parent for unmounting\n\n // Attach ref after node creation\n const ref = vnode.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n attachRef(ref, node)\n\n host.append(parentOrScene, node)\n\n // Flatten children to support nested arrays\n const flatChildren = flattenChildren(vnode.children)\n\n // Warn about missing keys during initial mount\n if (flatChildren.length > 0) {\n warnMissingKeys(vnode, flatChildren)\n }\n\n flatChildren.forEach((c, index) => {\n if (!shouldSkipChild(c)) {\n // Type guard: c is VNode at this point\n let child = c as VNode\n\n // Additional validation: check if child is actually a VNode object\n if (!child || typeof child !== 'object' || !child.type) {\n const componentPath = buildComponentPath(vnode)\n console.warn(\n `❌ Invalid child at index ${index}`,\n `\\n📍 Component path: ${componentPath}`,\n `\\n💡 Invalid value:`,\n child,\n '\\nℹ️ This child will be skipped. Use {expression} or <Text> for text content.'\n )\n return // Skip this child instead of throwing\n }\n\n // Track parent VNode for error messages\n child = setVNodePropSafe(child, '__parentVNode', vnode)\n\n // Skip theme propagation for primitives (strings, numbers, booleans)\n if (typeof child === 'object') {\n // Merge parent's nested theme with child's existing theme\n if (Object.keys(nestedTheme).length > 0) {\n const mergedTheme = child.__theme ? { ...nestedTheme, ...child.__theme } : nestedTheme\n const themed = setThemeSafe(child, mergedTheme)\n if (themed !== child) {\n flatChildren[flatChildren.indexOf(child)] = themed\n }\n } else if (!child.__theme && vnode.__theme) {\n // Fallback: Propagate theme to children (inherit parent's theme if child doesn't have one)\n const themed = setThemeSafe(child, vnode.__theme)\n if (themed !== child) {\n flatChildren[flatChildren.indexOf(child)] = themed\n }\n }\n }\n mount(node as ParentType, child)\n }\n })\n\n // Calculate layout after all children are mounted\n // Check if this is a Container (has list property)\n if (node && 'list' in node && Array.isArray((node as Phaser.GameObjects.Container).list)) {\n const container = node as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n }\n\n // Get parent size for percentage/fill resolution\n let parentSize: { width: number; height: number } | undefined\n if (isPhaserContainer(parentOrScene)) {\n const parentContainer = parentOrScene as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n __getLayoutSize?: () => { width: number; height: number }\n }\n // Get parent's content-area (size minus padding) for percentage resolution\n if (parentContainer.__getLayoutSize) {\n const parentTotalSize = parentContainer.__getLayoutSize()\n const padding = (parentContainer.__layoutProps?.padding ?? 0) as\n | number\n | { left?: number; right?: number; top?: number; bottom?: number }\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n parentSize = {\n width: parentTotalSize.width - normPadding.left - normPadding.right,\n height: parentTotalSize.height - normPadding.top - normPadding.bottom,\n }\n }\n }\n\n calculateLayout(container, container.__layoutProps ?? {}, parentSize)\n\n // Defer gesture hit area update to next frame after layout completes\n // This ensures __getLayoutSize() returns correct dimensions (not 0x0)\n const renderContext = getRenderContext(parentOrScene)\n renderContext.deferLayout(() => updateGestureHitAreaAfterLayout(container))\n }\n\n return node\n}\n\n/**\n * Unmounts a VNode and cleans up resources\n * @param vnode - VNode to unmount\n */\nexport function unmount(vnode: VNode | null | undefined | false): void {\n if (!vnode || (vnode as unknown) === false) return\n\n // Fragment - just unmount children\n if (vnode.type === Fragment) {\n const flatChildren = flattenChildren(vnode.children)\n flatChildren.forEach(unmount)\n return\n }\n\n if (typeof vnode.type === 'function') {\n const ctx = (vnode as VNode & { __ctx?: Ctx }).__ctx\n if (ctx) {\n disposeCtx(ctx)\n // Clear context reference to prevent memory leak\n delete (vnode as VNode & { __ctx?: Ctx }).__ctx\n }\n if (ctx?.vnode) unmount(ctx.vnode)\n return\n }\n\n // Detach ref before cleanup\n const ref = vnode.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n attachRef(ref, null)\n\n // Clean up children FIRST (before removing from parent)\n const flatChildren = flattenChildren(vnode.children)\n flatChildren.forEach(unmount)\n\n // Unregister from mount registry if this is a root node\n const node = vnode.__node as Phaser.GameObjects.GameObject & { __registryId?: number }\n if (node?.__registryId !== undefined) {\n mountRegistry.unregister(node.__registryId)\n delete node.__registryId\n }\n\n // Then remove from parent/scene\n const parent = vnode.__parent\n if (parent) host.remove(parent as ParentType, vnode.__node as Phaser.GameObjects.GameObject)\n\n // NOTE: We intentionally do NOT delete __node, __parent, __theme here\n // because these VNodes might still be referenced elsewhere (e.g., in closures)\n // The Phaser GameObject is destroyed by host.remove(), so the memory will be freed\n // The VNode references will be garbage collected when all references are gone\n}\n\n/**\n * Patches VNode tree with updates\n * @param parent - Parent container or scene\n * @param oldV - Previous VNode (can be null if previous render returned null)\n * @param newV - New VNode (can be null if new render returns null)\n */\nexport function patchVNode(parent: ParentType, oldV: VNode | null, newV: VNode | null) {\n // Handle null cases (e.g., Modal closing/opening)\n if (!oldV && !newV) return\n if (!oldV && newV) {\n mount(parent, newV)\n return\n }\n if (oldV && !newV) {\n unmount(oldV)\n return\n }\n\n // Both non-null from here on (TypeScript guard)\n if (!oldV || !newV) return\n\n // Check if keys differ - if so, unmount old and mount new\n if (oldV.__key !== newV.__key) {\n warnUnnecessaryRemount(oldV, newV)\n unmount(oldV)\n mount(parent, newV)\n\n // CRITICAL: Recalculate parent layout after key change\n // Key change means complete element replacement - parent dimensions may have changed\n if (parent && typeof parent === 'object' && 'list' in parent) {\n const parentContainer = parent as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n __getLayoutSize?: () => { width: number; height: number }\n }\n if (parentContainer.__layoutProps) {\n // Get grandparent size for percentage/fill resolution\n let grandparentSize: { width: number; height: number } | undefined\n const grandparent = parentContainer.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n __getLayoutSize?: () => { width: number; height: number }\n })\n | undefined\n\n if (grandparent && grandparent.__layoutProps && grandparent.__getLayoutSize) {\n const gpSize = grandparent.__getLayoutSize()\n const gpPadding = (grandparent.__layoutProps.padding ?? 0) as\n | number\n | { left?: number; right?: number; top?: number; bottom?: number }\n const normGpPadding =\n typeof gpPadding === 'number'\n ? { left: gpPadding, right: gpPadding, top: gpPadding, bottom: gpPadding }\n : {\n left: gpPadding.left ?? 0,\n right: gpPadding.right ?? 0,\n top: gpPadding.top ?? 0,\n bottom: gpPadding.bottom ?? 0,\n }\n grandparentSize = {\n width: gpSize.width - normGpPadding.left - normGpPadding.right,\n height: gpSize.height - normGpPadding.top - normGpPadding.bottom,\n }\n }\n\n calculateLayout(parentContainer, parentContainer.__layoutProps, grandparentSize)\n\n // Defer gesture hit area update\n const renderContext = getRenderContext(parent)\n renderContext.deferLayout(() => updateGestureHitAreaAfterLayout(parentContainer))\n }\n }\n\n return\n }\n\n // Fragment - patch children directly\n if (oldV.type === Fragment && newV.type === Fragment) {\n // Transfer theme from newV to oldV\n if (newV.__theme !== undefined) {\n const themed = setThemeSafe(oldV, newV.__theme)\n if (themed !== oldV) {\n // oldV was frozen - this shouldn't happen in normal operation\n console.error('[PhaserJSX] Cannot patch frozen Fragment VNode')\n }\n }\n\n const a = flattenChildren(oldV.children)\n const b = flattenChildren(newV.children)\n const len = Math.max(a.length, b.length)\n for (let i = 0; i < len; i++) {\n const c1 = a[i]\n const c2 = b[i]\n const isValidC1 = c1 != null && c1 !== false\n const isValidC2 = c2 != null && c2 !== false\n if (!isValidC1 && isValidC2) {\n // Propagate theme to new child (only for objects)\n if (typeof c2 === 'object' && newV.__theme && !c2.__theme) {\n const themed = setThemeSafe(c2, newV.__theme)\n if (themed !== c2) {\n b[i] = themed\n }\n }\n mount(parent, c2)\n } else if (isValidC1 && !isValidC2) {\n unmount(c1)\n } else if (isValidC1 && isValidC2) {\n // Propagate theme to both children (only for objects)\n if (typeof c1 === 'object' && typeof c2 === 'object' && newV.__theme) {\n let themed1 = setThemeSafe(c1, newV.__theme)\n let themed2 = setThemeSafe(c2, newV.__theme)\n if (themed1 !== c1) a[i] = themed1\n if (themed2 !== c2) b[i] = themed2\n }\n patchVNode(parent, c1, c2)\n }\n }\n return\n }\n\n // Function components\n if (typeof oldV.type === 'function' || typeof newV.type === 'function') {\n if (oldV.type === newV.type) {\n const ctx = (oldV as VNode & { __ctx?: Ctx }).__ctx\n if (!ctx) {\n // No context means this is a VNode factory (like RexSizer), not a real component\n // Render both and patch the results\n // Type guard: both oldV and newV are non-null and have same type\n if (!newV || !oldV) return\n const propsWithChildren = newV.children?.length\n ? { ...(newV.props ?? {}), children: newV.children }\n : newV.props\n const oldRenderedRaw = (oldV.type as (props: unknown) => VNodeLike)(\n oldV.children?.length ? { ...(oldV.props ?? {}), children: oldV.children } : oldV.props\n )\n const newRenderedRaw = (newV.type as (props: unknown) => VNodeLike)(propsWithChildren)\n const oldRendered = normalizeVNodeLike(oldRenderedRaw)\n const newRendered = normalizeVNodeLike(newRenderedRaw)\n patchVNode(parent, oldRendered, newRendered)\n return\n }\n // Real component with context - update component VNode props if changed\n if (newV.props !== undefined) {\n ctx.componentVNode.props = newV.props\n }\n if (newV.children !== undefined) {\n ctx.componentVNode.children = newV.children\n }\n const previousTheme = ctx.theme\n // Update theme in context if it changed\n if (newV.__theme !== undefined) {\n ctx.theme = newV.__theme\n }\n // Transfer context to newV so future patches work\n const newVWithCtx = setVNodePropSafe(newV, '__ctx', ctx)\n\n // Build props for comparison (merge props + children)\n const propsWithChildren = ctx.componentVNode.children?.length\n ? { ...(ctx.componentVNode.props ?? {}), children: ctx.componentVNode.children }\n : ctx.componentVNode.props\n\n const themeChanged = !Object.is(previousTheme, ctx.theme)\n\n // Check if component should update (memoization)\n const propsChanged = shouldComponentUpdate(ctx, propsWithChildren)\n if (!themeChanged && !propsChanged) {\n // Props haven't changed - skip re-render\n return\n }\n\n // Re-render with updated props (use newVWithCtx for type safety)\n const renderedNextRaw = withHooks(ctx, () =>\n (newVWithCtx.type as (props: unknown) => VNodeLike)(propsWithChildren)\n )\n const renderedNext = normalizeVNodeLike(renderedNextRaw)\n\n // Handle null returns (e.g., from Portal component)\n if (!renderedNext) {\n ctx.vnode = renderedNext\n for (const run of ctx.effects) run()\n return\n }\n\n // Propagate theme to rendered VNode if not already set\n if (ctx.theme && !renderedNext.__theme) {\n const themed = setThemeSafe(renderedNext, ctx.theme)\n if (themed !== renderedNext) {\n // Update context to use themed copy\n patchVNode(parent, ctx.vnode, themed)\n ctx.vnode = themed\n for (const run of ctx.effects) run()\n return\n }\n }\n\n patchVNode(parent, ctx.vnode, renderedNext)\n ctx.vnode = renderedNext\n for (const run of ctx.effects) run()\n\n return\n }\n unmount(oldV)\n mount(parent, newV)\n return\n }\n // Host nodes\n if (oldV.type !== newV.type) {\n unmount(oldV)\n mount(parent, newV)\n return\n }\n const nodeType = oldV.type as NodeType\n newV = setVNodePropSafe(newV, '__node', oldV.__node)\n newV = setVNodePropSafe(newV, '__parent', parent)\n\n // Transfer theme from newV to oldV (theme may have changed)\n // Transfer theme from newV to oldV, or inherit from oldV if newV has no theme\n // This ensures theme updates are properly applied during patching\n if (newV.__theme !== undefined) {\n const themed = setThemeSafe(oldV, newV.__theme)\n if (themed !== oldV) {\n // oldV was frozen - this shouldn't happen during patch\n console.error('[PhaserJSX] Cannot patch frozen VNode in host node')\n }\n } else if (oldV.__theme !== undefined) {\n // IMPORTANT: If newV doesn't have a theme, inherit from oldV\n // This happens when a function component re-renders and creates new VNodes\n // without explicitly propagating the theme\n const themed = setThemeSafe(newV, oldV.__theme)\n if (themed !== newV) {\n // newV was frozen - we need to use the copy\n // This is a problem because we can't replace newV in the parent\n console.error('[PhaserJSX] Cannot inherit theme to frozen VNode')\n }\n }\n\n // Update ref if it changed\n const oldRef = oldV.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n const newRef = newV.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n if (oldRef !== newRef) {\n attachRef(oldRef, null)\n attachRef(newRef, oldV.__node as Phaser.GameObjects.GameObject)\n }\n\n // Apply theme to props before patching (merge explicit props with theme)\n DebugLogger.log(\n 'vdom',\n `Patching ${nodeType}: oldV.__theme:`,\n oldV.__theme,\n 'newV.__theme:',\n newV.__theme\n )\n const { props: oldThemedProps } = getThemedProps(nodeType, oldV.__theme, oldV.props ?? {})\n const { props: newThemedProps, nestedTheme: newNestedTheme } = getThemedProps(\n nodeType,\n newV.__theme,\n newV.props ?? {}\n )\n DebugLogger.log(\n 'vdom',\n `Patching ${nodeType}: oldThemedProps.gap:`,\n (oldThemedProps as { gap?: number }).gap\n )\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n host.patch(nodeType, oldV.__node as any, oldThemedProps, newThemedProps)\n\n const a = flattenChildren(oldV.children)\n const b = flattenChildren(newV.children)\n const len = Math.max(a.length, b.length)\n let childrenChanged = false\n\n // Warn about missing keys in list-like children\n if (b.length > 0) {\n warnMissingKeys(newV, b)\n }\n\n // Check if the container's own layout props changed\n const containerLayoutChanged = hasLayoutPropsChanged(oldV, newV)\n\n // CRITICAL: If number of valid children changed, trigger layout recalculation\n // This catches cases where children are added/removed without layout prop changes\n const oldValidChildCount = a.filter((c) => c != null && c !== false).length\n const newValidChildCount = b.filter((c) => c != null && c !== false).length\n if (oldValidChildCount !== newValidChildCount) {\n childrenChanged = true\n }\n\n for (let i = 0; i < len; i++) {\n const c1 = a[i],\n c2 = b[i]\n // Filter out false/null/undefined children\n const isValidC1 = c1 != null && c1 !== false\n const isValidC2 = c2 != null && c2 !== false\n if (!isValidC1 && isValidC2) {\n // Merge parent's nested theme for new child (only for objects)\n if (typeof c2 === 'object') {\n if (Object.keys(newNestedTheme).length > 0) {\n const mergedTheme = c2.__theme ? { ...newNestedTheme, ...c2.__theme } : newNestedTheme\n const themed = setThemeSafe(c2, mergedTheme)\n if (themed !== c2) {\n b[i] = themed\n }\n } else if (!c2.__theme && newV.__theme) {\n const themed = setThemeSafe(c2, newV.__theme)\n if (themed !== c2) {\n b[i] = themed\n }\n }\n }\n mount(oldV.__node as ParentType, c2)\n childrenChanged = true\n } else if (isValidC1 && !isValidC2) {\n unmount(c1)\n childrenChanged = true\n } else if (isValidC1 && isValidC2) {\n // Merge parent's nested theme with child's theme (only for objects)\n // IMPORTANT: Update both c1 (for patch comparison) and c2 (for future renders)\n if (typeof c1 === 'object' && typeof c2 === 'object') {\n if (Object.keys(newNestedTheme).length > 0) {\n const mergedTheme = c2.__theme ? { ...newNestedTheme, ...c2.__theme } : newNestedTheme\n let themed1 = setThemeSafe(c1, mergedTheme)\n let themed2 = setThemeSafe(c2, mergedTheme)\n if (themed1 !== c1) a[i] = themed1\n if (themed2 !== c2) b[i] = themed2\n } else if (newV.__theme) {\n // Fallback: Propagate theme to child (inherit parent's theme)\n // IMPORTANT: Always propagate, even if child has theme, because parent theme might have changed\n let themed1 = setThemeSafe(c1, newV.__theme)\n let themed2 = setThemeSafe(c2, newV.__theme)\n if (themed1 !== c1) a[i] = themed1\n if (themed2 !== c2) b[i] = themed2\n }\n }\n\n // Check if this child has layout-relevant changes\n const childLayoutChanged = hasLayoutPropsChanged(c1, c2)\n\n // Check if text content changed (text nodes have dynamic sizing)\n const textContentChanged =\n c1.props?.text !== c2.props?.text || !equal(c1.props?.style, c2.props?.style)\n\n // Recursively patch the child\n patchVNode(oldV.__node as ParentType, c1, c2)\n\n // Mark as changed if:\n // 1. Layout props changed, OR\n // 2. Text content changed (affects text dimensions), OR\n // 3. Child has dynamic sizing (__getLayoutSize) and might have changed\n if (childLayoutChanged) {\n childrenChanged = true\n } else if (textContentChanged) {\n // Text content changed - dimensions likely changed\n childrenChanged = true\n } else if (c1.__node && typeof c1.__node === 'object' && '__getLayoutSize' in c1.__node) {\n // Child has dynamic sizing (e.g., text), assume size might have changed\n // Note: This is a fallback - should be caught by textContentChanged\n childrenChanged = true\n }\n }\n }\n\n // Recalculate layout if:\n // 1. Container's own layout props changed, OR\n // 2. Children structurally changed or have layout-relevant changes\n const shouldRecalculateLayout = containerLayoutChanged || childrenChanged\n\n if (\n shouldRecalculateLayout &&\n oldV.__node &&\n typeof oldV.__node === 'object' &&\n 'list' in oldV.__node\n ) {\n const container = oldV.__node as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n }\n if (container.__layoutProps) {\n // Get parent content-area (size minus padding) for percentage/fill resolution\n let parentSize: { width: number; height: number } | undefined\n if (isPhaserContainer(parent)) {\n const parentContainer = parent as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n __getLayoutSize?: () => { width: number; height: number }\n }\n // Use parent's layout size minus padding (content-area)\n if (parentContainer.__getLayoutSize) {\n const parentTotalSize = parentContainer.__getLayoutSize()\n const padding = (parentContainer.__layoutProps?.padding ?? 0) as\n | number\n | { left?: number; right?: number; top?: number; bottom?: number }\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n parentSize = {\n width: parentTotalSize.width - normPadding.left - normPadding.right,\n height: parentTotalSize.height - normPadding.top - normPadding.bottom,\n }\n }\n }\n\n calculateLayout(container, container.__layoutProps, parentSize)\n\n // Defer gesture hit area update to next frame after layout completes\n const renderContext = getRenderContext(parent)\n renderContext.deferLayout(() => updateGestureHitAreaAfterLayout(container))\n }\n }\n}\n\n/**\n * Mounts a component by type and props\n * Automatically wraps component in SceneWrapper unless disableAutoSize is true\n * @param parentOrScene - Phaser scene or parent container\n * @param type - Component type (function or string)\n * @param props - Component props including width and height\n * @returns Created Phaser GameObject\n */\n\nexport function mountJSX<T extends NodeType>(\n parentOrScene: ParentType,\n type: T,\n props: MountComponentProps<NodeProps<T>>\n): MountHandle\n\nexport function mountJSX<P = Record<string, never>>(\n parentOrScene: ParentType,\n type: (props: P & MountProps) => VNodeLike,\n props: MountComponentProps<P>\n): MountHandle\n\nexport function mountJSX(\n parentOrScene: ParentType,\n type: NodeType | ((props: unknown) => VNodeLike),\n props: MountProps & Record<string, unknown> = { width: 0, height: 0 }\n): MountHandle {\n // Check if a mount already exists for this parent (and key if provided)\n const key = (props as MountProps).key\n const existingMount = mountRegistry.findByParentAndKey(parentOrScene, key)\n\n if (existingMount) {\n // Warn if type changed (suggests missing key)\n if (existingMount.type !== type) {\n const oldTypeName =\n typeof existingMount.type === 'string'\n ? existingMount.type\n : existingMount.type.name || 'Component'\n const newTypeName = typeof type === 'string' ? type : type.name || 'Component'\n console.warn(\n `[PhaserJSX] mountJSX type mismatch: Attempting to patch <${oldTypeName}> with <${newTypeName}>.\\n` +\n `This usually means you're missing a 'key' prop to distinguish multiple mounts on the same parent.\\n` +\n `Solution: Add unique keys like { key: 'sidebar', ... } and { key: 'main', ... }`\n )\n }\n\n // Patch existing mount with new props\n // Check if MountProps (width, height) have changed - if so, update them\n const newWidth = props.width ?? existingMount.props.width\n const newHeight = props.height ?? existingMount.props.height\n const dimensionsChanged =\n newWidth !== existingMount.props.width || newHeight !== existingMount.props.height\n\n // Extract mount-only props (disableAutoSize, key) but keep width/height for component\n const { disableAutoSize: _d, key: _k, ...componentProps } = props\n\n // Update stored props in registry (including dimensions if changed)\n if (dimensionsChanged) {\n existingMount.props = {\n ...existingMount.props,\n ...componentProps,\n width: newWidth,\n height: newHeight,\n }\n } else {\n existingMount.props = { ...existingMount.props, ...componentProps }\n }\n\n // Create new VNode with updated props for patching\n let newVNode: VNode\n\n if ((existingMount.props as MountProps).disableAutoSize) {\n // Without wrapper - pass width/height directly to component\n newVNode = {\n type: existingMount.type,\n props: {\n ...componentProps,\n width: existingMount.props.width,\n height: existingMount.props.height,\n },\n children: [],\n }\n } else {\n // With SceneWrapper - pass width/height to both wrapper AND component\n const componentVNode: VNode = {\n type: existingMount.type,\n props: {\n ...componentProps,\n width: existingMount.props.width,\n height: existingMount.props.height,\n },\n children: [],\n }\n\n newVNode = {\n type: SceneWrapper,\n props: {\n width: existingMount.props.width,\n height: existingMount.props.height,\n children: componentVNode,\n },\n children: [],\n }\n }\n\n // Patch existing VNode\n patchVNode(parentOrScene, existingMount.vnode, newVNode)\n\n // Update stored VNode\n existingMount.vnode = newVNode\n\n const handle = existingMount.rootNode as MountHandle\n handle.unmount = () => unmountJSX(handle)\n\n DebugLogger.log(\n 'vdom',\n `Patched existing mount ${existingMount.id} on same parent (type: ${typeof type === 'string' ? type : type.name})`\n )\n return handle\n }\n\n // Extract MountProps and component props\n // Note: width/height are passed to BOTH SceneWrapper AND component for full access\n const { width, height, disableAutoSize = false, key: _key, ...componentProps } = props\n\n // Extract scene and set viewport dimensions\n const scene = isPhaserScene(parentOrScene)\n ? parentOrScene\n : (parentOrScene as Phaser.GameObjects.GameObject).scene\n\n if (scene) {\n const renderContext = getRenderContext(parentOrScene)\n renderContext.setViewport(width, height, scene)\n\n // Also set viewport for portal system (for Modal centering, etc.)\n portalRegistry.setViewportSize(scene, width, height)\n }\n\n // Create VNode with or without SceneWrapper\n let vnode: VNode\n\n if (disableAutoSize) {\n // Without wrapper: mount component directly with width/height\n vnode = { type, props: { ...componentProps, width, height }, children: [] }\n } else {\n // With wrapper (DEFAULT): pass width/height to both wrapper AND component\n const componentVNode: VNode = {\n type,\n props: {\n ...componentProps,\n width,\n height,\n },\n children: [],\n }\n\n vnode = {\n type: SceneWrapper,\n props: {\n width,\n height,\n children: componentVNode,\n },\n children: [],\n }\n }\n\n // Store root VNode on the scene for debug access (non-intrusive)\n if (scene) {\n ;(scene as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n }\n\n // Mark root container with unique mount ID for gesture isolation\n // This ensures different mountJSX calls create separate gesture trees\n const rootNode = mount(parentOrScene, vnode)\n if (isPhaserContainer(rootNode)) {\n ;(rootNode as unknown as { __mountRootId?: number }).__mountRootId = generateMountRootId()\n }\n\n // Store root VNode on the mounted node to allow typed unmounting later\n ;(rootNode as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n\n // Register this mount in the registry for theme-triggered remounts\n const registryId = mountRegistry.register(parentOrScene, type, props, rootNode, vnode)\n\n // Store registry ID on root node for cleanup\n ;(rootNode as unknown as { __registryId?: number }).__registryId = registryId\n\n const handle = rootNode as MountHandle\n handle.unmount = () => unmountJSX(handle)\n\n return handle\n}\n\n/**\n * Convenience helper to unmount a tree created via mountJSX without manual casting\n * Accepts either the root GameObject returned from mountJSX or the owning scene\n * @param target - Root GameObject or Phaser scene that holds the mounted JSX tree\n */\nexport function unmountJSX(target: Phaser.Scene | Phaser.GameObjects.GameObject): void {\n const scene = isPhaserScene(target) ? target : target.scene\n const targetWithVNode = target as unknown as { __rootVNode?: VNode; __registryId?: number }\n const sceneWithVNode = scene as unknown as { __rootVNode?: VNode }\n\n // Prefer VNode stored directly on the root node (supports multiple mounts per scene)\n const rootVNode = targetWithVNode.__rootVNode ?? sceneWithVNode?.__rootVNode\n\n if (rootVNode) {\n unmount(rootVNode)\n\n // Clear stored references to avoid reusing a stale VNode after unmount\n if (targetWithVNode.__rootVNode === rootVNode) {\n delete targetWithVNode.__rootVNode\n }\n if (sceneWithVNode?.__rootVNode === rootVNode) {\n delete sceneWithVNode.__rootVNode\n }\n return\n }\n\n // Fallback: use registry entry if available (in case __rootVNode was cleared)\n if (targetWithVNode.__registryId !== undefined) {\n const entry = mountRegistry.getEntry(targetWithVNode.__registryId)\n if (entry?.vnode) {\n unmount(entry.vnode)\n return\n }\n }\n\n DebugLogger.log('vdom', 'unmountJSX called but no root VNode found on target')\n}\n","/**\n * Global theme system for PhaserJSX\n * Provides type-safe theming with inheritance and component-specific styles\n */\nimport type { ColorTokens } from './colors'\nimport { getPresetWithMode } from './colors/color-presets'\nimport type { NodeType } from './core-types'\nimport { DebugLogger } from './dev-config'\nimport type { ComponentThemes, PartialTheme, Theme } from './theme-base'\nimport './theme-custom' // Import to activate declaration merging\nimport { createDefaultTheme, defaultTheme } from './theme-defaults'\nimport { remountAll } from './vdom'\n\n// Re-export all types and interfaces\nexport type {\n BuiltInComponentThemes,\n ComponentThemes,\n CustomComponentThemes,\n GraphicsTheme,\n ImageTheme,\n NestedComponentThemes,\n NineSliceTheme,\n PartialTheme,\n SpriteTheme,\n TextTheme,\n Theme,\n TileSpriteTheme,\n ViewTheme,\n} from './theme-base'\nexport { createDefaultTheme, defaultTheme }\n\n/**\n * Global theme registry\n * Stores the current global theme and custom component themes\n */\nclass ThemeRegistry {\n private globalTheme: Theme = { ...defaultTheme }\n private customThemes: Map<string, Record<string, unknown>> = new Map()\n private colorTokens: ColorTokens | undefined = undefined\n private colorMode: 'light' | 'dark' = 'light'\n private currentPresetName: string | undefined = undefined\n private listeners: Set<() => void> = new Set()\n private cachedComponentNames: Set<string> | null = null\n\n /** Invalidate the cached component name set after mutations */\n private invalidateComponentNamesCache(): void {\n this.cachedComponentNames = null\n }\n\n /**\n * Get all known component names (built-in + custom), cached for performance.\n * Used by extractNestedThemes to avoid rebuilding the set on every render.\n * @returns Set of all registered component names\n */\n getAllComponentNames(): Set<string> {\n if (this.cachedComponentNames) return this.cachedComponentNames\n\n const internalPrimitiveNames = new Set([\n 'view',\n 'text',\n 'nineslice',\n 'sprite',\n 'image',\n 'graphics',\n 'tilesprite',\n 'particles',\n ])\n\n this.cachedComponentNames = new Set(\n Object.keys(this.globalTheme)\n .concat(Array.from(this.customThemes.keys()))\n .filter((key) => key !== '__colorPreset' && !internalPrimitiveNames.has(key))\n )\n return this.cachedComponentNames\n }\n\n /**\n * Get the complete global theme\n */\n getGlobalTheme(): Readonly<Theme> {\n return { ...this.globalTheme, ...Object.fromEntries(this.customThemes) } as Theme\n }\n\n /**\n * Update global theme (deep merge)\n * @param theme - Partial theme to merge with current global theme\n */\n updateGlobalTheme(theme: PartialTheme): void {\n for (const [component, styles] of Object.entries(theme)) {\n const key = component as keyof Theme\n if (key in this.globalTheme) {\n // Merge existing full theme with partial overrides.\n // 'key in this.globalTheme' ensures the entry exists (non-undefined).\n const existing = this.globalTheme[key]\n // Spread of full defaults + partial overrides satisfies the component theme type.\n // TypeScript cannot infer this because `styles` is Record<string, unknown> from\n // Object.entries on PartialTheme (union of partials). The runtime behavior is safe.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.globalTheme[key] = { ...existing, ...styles } as any\n DebugLogger.log('theme', `Updated ${component} theme:`, this.globalTheme[key])\n } else {\n // Custom component\n const existing = this.customThemes.get(component) ?? {}\n this.customThemes.set(component, { ...existing, ...styles })\n }\n }\n\n this.notifyListeners()\n this.invalidateComponentNamesCache()\n }\n\n /**\n * Set the entire global theme (replaces current theme)\n * @param theme - Complete theme to set\n */\n setGlobalTheme(theme: Theme): void {\n this.globalTheme = { ...theme }\n this.invalidateComponentNamesCache()\n }\n\n /**\n * Reset global theme to default values\n */\n resetGlobalTheme(): void {\n this.globalTheme = { ...defaultTheme }\n this.customThemes.clear()\n this.invalidateComponentNamesCache()\n }\n\n /**\n * Register a custom component theme\n * @param componentName - Name of the custom component\n * @param defaultStyles - Default styles for the component\n */\n registerCustomComponent<T extends Record<string, unknown>>(\n componentName: string,\n defaultStyles: T\n ): void {\n this.customThemes.set(componentName, defaultStyles)\n this.invalidateComponentNamesCache()\n }\n\n /**\n * Get theme for a specific component\n * @param componentName - Component name\n * @returns Theme for the component\n */\n getComponentTheme<K extends keyof ComponentThemes>(componentName: K): ComponentThemes[K] {\n if (componentName in this.globalTheme) {\n const theme = this.globalTheme[componentName as NodeType] as ComponentThemes[K]\n return theme\n }\n return (this.customThemes.get(componentName as string) ?? {}) as ComponentThemes[K]\n }\n\n /**\n * Get all registered custom component names\n * @returns Set of custom component names\n */\n getCustomComponentNames(): Set<string> {\n return new Set(this.customThemes.keys())\n }\n\n /**\n * Set color tokens for the global theme\n * @param colors - ColorTokens to use globally\n */\n setColorTokens(colors: ColorTokens | undefined): void {\n this.colorTokens = colors\n }\n\n /**\n * Get current color tokens\n * @returns Current ColorTokens or undefined\n */\n getColorTokens(): ColorTokens | undefined {\n return this.colorTokens\n }\n\n /**\n * Get current color mode\n * @returns Current color mode\n */\n getColorMode(): 'light' | 'dark' {\n return this.colorMode\n }\n\n /**\n * Set color mode and trigger complete remount\n * Updates color tokens if a preset is active\n * Triggers complete remount of all active mountJSX instances\n * @param mode - Color mode to set\n */\n setColorMode(mode: 'light' | 'dark'): void {\n if (this.colorMode !== mode) {\n this.colorMode = mode\n\n // If a preset is active, reload color tokens with the new mode\n if (this.currentPresetName) {\n const preset = getPresetWithMode(\n this.currentPresetName as 'oceanBlue' | 'forestGreen' | 'midnight',\n mode\n )\n this.colorTokens = preset.colors\n }\n\n // Skip notifyListeners() - we're doing a complete remount instead\n // This prevents unnecessary re-renders and flickering\n\n // Trigger complete remount of all VDOM trees to apply new theme\n // Using setTimeout(0) to ensure all synchronous state updates complete first\n setTimeout(() => {\n remountAll()\n }, 0)\n }\n }\n\n /**\n * Get current preset name\n * @returns Current preset name or undefined\n */\n getCurrentPresetName(): string | undefined {\n return this.currentPresetName\n }\n\n /**\n * Set current preset name\n * @param name - Preset name\n * @param skipNotify - If true, skip notifying listeners (used during remount)\n */\n setCurrentPresetName(name: string | undefined, skipNotify = false): void {\n if (this.currentPresetName !== name) {\n this.currentPresetName = name\n if (!skipNotify) {\n this.notifyListeners()\n }\n }\n }\n\n /**\n * Subscribe to theme changes\n * @param listener - Callback to invoke on theme change\n * @returns Unsubscribe function\n */\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener)\n return () => {\n this.listeners.delete(listener)\n }\n }\n\n /**\n * Notify all listeners of theme change\n */\n private notifyListeners(): void {\n this.listeners.forEach((listener) => listener())\n }\n}\n\n/**\n * Global theme registry instance\n */\nexport const themeRegistry = new ThemeRegistry()\n\n/**\n * Deep merge two theme objects\n * @param base - Base theme\n * @param override - Override theme\n * @returns Merged theme\n */\nexport function mergeThemes(base: PartialTheme, override: PartialTheme): PartialTheme {\n const result: PartialTheme = { ...base }\n\n for (const [component, styles] of Object.entries(override)) {\n if (component in result) {\n result[component as keyof ComponentThemes] = {\n ...result[component as keyof ComponentThemes],\n ...styles,\n } as never\n } else {\n result[component as keyof ComponentThemes] = styles as never\n }\n }\n\n return result\n}\n\n/**\n * Helper to create a partial theme with type safety\n * Optionally accepts a color preset to automatically populate color tokens\n * @param theme - Partial theme definition\n * @param colorPreset - Optional color preset to apply\n * @returns The same theme (for type checking)\n * @example\n * ```typescript\n * import { getPreset } from './colors'\n *\n * const preset = getPreset('oceanBlue')\n * const theme = createTheme({\n * Button: {\n * backgroundColor: preset.colors.primary.DEFAULT\n * }\n * }, preset)\n * ```\n */\nexport function createTheme(\n theme: PartialTheme,\n colorPreset?: { name: string; colors: ColorTokens; mode?: 'light' | 'dark' }\n): PartialTheme {\n if (colorPreset) {\n // Store color tokens in registry for useColors hook\n themeRegistry.setColorTokens(colorPreset.colors)\n\n // Add preset metadata to theme\n return {\n ...theme,\n __colorPreset: {\n name: colorPreset.name,\n mode: colorPreset.mode ?? 'light',\n },\n }\n }\n\n return theme\n}\n\n/**\n * Get themed props for a component, merging global theme, local theme override, and explicit props\n * Explicit props take highest priority, then local theme, then global theme\n * Also extracts nested component themes to pass down to children\n * @param componentName - Component name\n * @param localTheme - Local theme override (from theme prop in VDOM tree)\n * @param explicitProps - Explicit props passed to component\n * @returns Object with merged props and nested themes for child components\n */\nfunction deepMergeDefined<T extends object>(base: T, override: Partial<T>): T {\n const result = { ...base }\n for (const key in override) {\n const value = override[key]\n if (value !== undefined) {\n if (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n typeof base[key] === 'object' &&\n base[key] !== null\n ) {\n // Deep merge for nested objects (e.g. style)\n ;(result as unknown as Record<string, unknown>)[key] = deepMergeDefined(\n base[key] as object,\n value as object\n )\n } else {\n ;(result as unknown as Record<string, unknown>)[key] = value\n }\n }\n }\n return result as T\n}\n\n/**\n * Helper to extract nested component themes from a theme object\n * Separates own props from nested component themes\n * Detects nested themes by checking if the property value is an object\n * and the key starts with uppercase (convention for component names)\n * @param theme - Theme object that might contain nested themes\n * @returns Object with ownProps and nestedThemes\n */\nfunction extractNestedThemes<T extends object>(\n theme: T\n): { ownProps: T; nestedThemes: PartialTheme } {\n const ownProps = { ...theme }\n const nestedThemes: PartialTheme = {}\n\n const allComponentNames = themeRegistry.getAllComponentNames()\n\n for (const key in ownProps) {\n // Check if this key is a registered component theme.\n if (allComponentNames.has(key)) {\n nestedThemes[key as keyof ComponentThemes] = (ownProps as never)[key]\n delete (ownProps as never)[key]\n }\n }\n\n return { ownProps, nestedThemes }\n}\n\nexport function getThemedProps<\n K extends keyof ComponentThemes,\n P extends Partial<ComponentThemes[K]>,\n>(\n componentName: K,\n localTheme: PartialTheme | undefined,\n explicitProps: P\n): { props: ComponentThemes[K] & P; nestedTheme: PartialTheme } {\n // Start with global theme for this component\n const globalComponentTheme = themeRegistry.getComponentTheme(componentName)\n\n // Extract nested themes from global theme\n const { ownProps: globalOwnProps, nestedThemes: globalNestedThemes } =\n extractNestedThemes(globalComponentTheme)\n\n // Apply local theme override if provided\n // IMPORTANT: localTheme can be either:\n // 1. Parent's nested theme (propagated down)\n // 2. Component's own theme (from theme prop via __theme)\n // We need to check if localTheme contains this component's theme OR nested themes\n const localComponentTheme = localTheme?.[componentName] ?? {}\n\n const { ownProps: localOwnProps, nestedThemes: localNestedThemes } =\n extractNestedThemes(localComponentTheme)\n\n // Also extract nested themes directly from localTheme (for theme prop case)\n const { nestedThemes: localThemeNested } = extractNestedThemes(localTheme ?? {})\n\n // Extract nested themes from explicit props\n const { ownProps: explicitOwnProps, nestedThemes: explicitNestedThemes } =\n extractNestedThemes(explicitProps)\n\n // Merge: global < local < explicit, but only defined values\n const mergedProps = {\n ...deepMergeDefined(globalOwnProps as object, localOwnProps),\n ...deepMergeDefined({}, explicitOwnProps),\n } as ComponentThemes[K] & P\n\n // Merge nested themes: global < localComponent < localTheme < explicit\n const mergedNestedThemes = mergeThemes(\n mergeThemes(mergeThemes(globalNestedThemes, localNestedThemes), localThemeNested),\n explicitNestedThemes\n )\n\n DebugLogger.log(\n 'theme',\n `getThemedProps(${String(componentName)}): FINAL mergedProps:`,\n mergedProps\n )\n\n return {\n props: mergedProps,\n nestedTheme: mergedNestedThemes,\n }\n}\n","/**\n * Tooltip applier for component patching\n * Manages native Phaser text tooltip rendering with animations\n */\nimport * as Phaser from 'phaser'\nimport type { HoverEventData } from '../../gestures/gesture-types'\nimport { themeRegistry } from '../../theme'\nimport type { TooltipCallback, TooltipConfig } from '../../tooltip/tooltip-types'\nimport { createBackgroundImage } from '../backgroundImage'\n\n/**\n * Internal state for tooltip management per container\n */\ninterface TooltipState {\n isVisible: boolean\n tooltip: Phaser.GameObjects.Container | null\n activeTweens: Phaser.Tweens.Tween[]\n showTimer: ReturnType<typeof setTimeout> | null\n hideTimer: ReturnType<typeof setTimeout> | null\n autoDismissTimer: ReturnType<typeof setTimeout> | null\n currentConfig: TooltipConfig | null\n}\n\n// Map to store tooltip state for each container\nconst tooltipStates = new Map<Phaser.GameObjects.Container, TooltipState>()\n\n/**\n * Calculate tooltip position based on target bounds and preferred position\n * Auto-adjusts if tooltip would go out of viewport bounds\n */\nfunction calculateTooltipPosition(\n targetBounds: Phaser.Geom.Rectangle,\n position: 'top' | 'bottom' | 'left' | 'right',\n offset: number,\n tooltipWidth: number,\n tooltipHeight: number\n): { x: number; y: number } {\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n let x = 0\n let y = 0\n\n switch (position) {\n case 'top':\n x = targetBounds.centerX - tooltipWidth / 2\n y = targetBounds.top - tooltipHeight - offset\n break\n case 'bottom':\n x = targetBounds.centerX - tooltipWidth / 2\n y = targetBounds.bottom + offset\n break\n case 'left':\n x = targetBounds.left - tooltipWidth - offset\n y = targetBounds.centerY - tooltipHeight / 2\n break\n case 'right':\n x = targetBounds.right + offset\n y = targetBounds.centerY - tooltipHeight / 2\n break\n }\n\n // Clamp to viewport bounds (with small padding)\n x = Math.max(8, Math.min(x, viewport.width - tooltipWidth - 8))\n y = Math.max(8, Math.min(y, viewport.height - tooltipHeight - 8))\n\n return { x, y }\n}\n\n/**\n * Show native Phaser text tooltip with animations\n */\nfunction showTooltip(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n config: TooltipConfig\n): void {\n const state = tooltipStates.get(container)\n if (!state || state.isVisible) return\n\n state.isVisible = true\n state.currentConfig = config\n\n const theme = themeRegistry.getGlobalTheme()\n const tooltipTheme = theme.Tooltip || {}\n\n const position = config.position ?? tooltipTheme.position ?? 'top'\n const offset = config.offset ?? tooltipTheme.offset ?? 8\n\n const content = config.content\n\n // Get target bounds\n const targetBounds = container.getBounds()\n\n // Create text without background first to measure\n const textStyle: Phaser.Types.GameObjects.Text.TextStyle = tooltipTheme.textStyle ?? {\n fontSize: '14px',\n fontFamily: 'Arial',\n color: '#ffffff',\n padding: { x: 8, y: 4 },\n }\n\n // Remove backgroundColor from textStyle, we'll draw it manually\n const { backgroundColor: bgColor, ...styleWithoutBg } = textStyle\n\n const text = scene.add.text(0, 0, content, styleWithoutBg)\n text.setOrigin(0.5)\n\n // Measure text with padding\n const padding = textStyle.padding ?? { x: 8, y: 4 }\n const paddingX = typeof padding === 'number' ? padding : (padding.x ?? 8)\n const paddingY = typeof padding === 'number' ? padding : (padding.y ?? 4)\n const textWidth = text.width\n const textHeight = text.height\n const bgWidth = textWidth + paddingX * 2\n const bgHeight = textHeight + paddingY * 2\n\n // Parse background color\n const bg = bgColor ?? '#000000dd'\n let fillColor = 0x000000\n let fillAlpha = 0.87\n\n if (typeof bg === 'string') {\n if (bg.startsWith('#')) {\n // Handle hex with optional alpha\n const hex = bg.slice(1)\n if (hex.length === 8) {\n fillColor = parseInt(hex.slice(0, 6), 16)\n fillAlpha = parseInt(hex.slice(6, 8), 16) / 255\n } else if (hex.length === 6) {\n fillColor = parseInt(hex, 16)\n fillAlpha = 1\n }\n }\n }\n\n const background = createBackgroundImage(\n scene,\n {\n backgroundColor: fillColor,\n backgroundAlpha: fillAlpha,\n cornerRadius: tooltipTheme.cornerRadius ?? 6,\n },\n bgWidth,\n bgHeight\n )\n\n if (!background) {\n text.destroy()\n return\n }\n\n background.setOrigin(0.5, 0.5)\n\n // Create container for background + text\n const tooltipContainer = scene.add.container(0, 0, [background, text])\n tooltipContainer.setDepth(10000)\n\n // Measure container bounds\n const textBounds = tooltipContainer.getBounds()\n\n // Calculate position\n const pos = calculateTooltipPosition(\n targetBounds,\n position,\n offset,\n textBounds.width,\n textBounds.height\n )\n\n // Animation config - merge config with theme defaults\n const themeAnim = tooltipTheme.animation || {}\n const anim = config.animation || {}\n const fadeInDuration = anim.fadeIn ?? themeAnim.fadeIn ?? 200\n const moveOffset = {\n dx: anim.move?.dx ?? themeAnim.move?.dx ?? 0,\n dy: anim.move?.dy ?? themeAnim.move?.dy ?? 0,\n }\n const pulse = anim.pulse ?? themeAnim.pulse ?? false\n const pulseScale = anim.pulseScale ?? [0.75, 1.25]\n\n // Set initial position (with move offset if enabled)\n tooltipContainer.setPosition(\n pos.x + textBounds.width / 2 - moveOffset.dx,\n pos.y + textBounds.height / 2 - moveOffset.dy\n )\n tooltipContainer.setAlpha(0)\n\n state.tooltip = tooltipContainer\n\n // Fade in animation\n const fadeTween = scene.tweens.add({\n targets: tooltipContainer,\n alpha: 1,\n x: pos.x + textBounds.width / 2,\n y: pos.y + textBounds.height / 2,\n duration: fadeInDuration,\n ease: 'Cubic.Out',\n })\n state.activeTweens.push(fadeTween)\n\n // Pulse animation\n if (pulse) {\n const pulseTween = scene.tweens.add({\n targets: tooltipContainer,\n scale: { from: pulseScale[0], to: pulseScale[1] },\n duration: 600,\n yoyo: true,\n repeat: -1,\n ease: 'Sine.InOut',\n })\n state.activeTweens.push(pulseTween)\n }\n\n // Auto-dismiss timer if configured\n if (config.autoDismiss && config.autoDismiss > 0) {\n state.autoDismissTimer = setTimeout(() => {\n hideTooltip(container)\n }, config.autoDismiss)\n }\n}\n\n/**\n * Hide tooltip for a container\n */\nfunction hideTooltip(container: Phaser.GameObjects.Container): void {\n const state = tooltipStates.get(container)\n if (!state || !state.isVisible) return\n\n state.isVisible = false\n const config = state.currentConfig\n state.currentConfig = null\n\n // Clear auto-dismiss timer\n if (state.autoDismissTimer) {\n clearTimeout(state.autoDismissTimer)\n state.autoDismissTimer = null\n }\n\n if (!state.tooltip) return\n\n const tooltip = state.tooltip\n const scene = tooltip.scene\n\n // Get theme defaults for fade out\n const theme = themeRegistry.getGlobalTheme()\n const tooltipTheme = theme.Tooltip || {}\n const themeAnim = tooltipTheme.animation || {}\n const anim = config?.animation || {}\n const fadeOutDuration = anim.fadeOut ?? themeAnim.fadeOut ?? 200\n\n // Stop all existing tweens\n state.activeTweens.forEach((tween) => tween.stop())\n state.activeTweens = []\n\n // Fade out animation\n scene.tweens.add({\n targets: tooltip,\n alpha: 0,\n duration: fadeOutDuration,\n ease: 'Cubic.In',\n onComplete: () => {\n tooltip.destroy()\n },\n })\n\n state.tooltip = null\n}\n\n/**\n * Apply tooltip functionality to a container\n * Sets up hover handlers and manages tooltip lifecycle\n */\nexport function applyTooltip(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n nextCallback: TooltipCallback | undefined,\n existingOnHoverStart?: (data: HoverEventData) => void,\n existingOnHoverEnd?: (data: HoverEventData) => void\n): {\n onHoverStart: (data: HoverEventData) => void\n onHoverEnd: (data: HoverEventData) => void\n} {\n // Initialize state if needed\n if (!tooltipStates.has(container)) {\n tooltipStates.set(container, {\n isVisible: false,\n tooltip: null,\n activeTweens: [],\n showTimer: null,\n hideTimer: null,\n autoDismissTimer: null,\n currentConfig: null,\n })\n\n // Cleanup on container destroy\n container.once('destroy', () => {\n const state = tooltipStates.get(container)\n if (state) {\n if (state.showTimer) clearTimeout(state.showTimer)\n if (state.hideTimer) clearTimeout(state.hideTimer)\n if (state.autoDismissTimer) clearTimeout(state.autoDismissTimer)\n state.activeTweens.forEach((tween) => tween.stop())\n hideTooltip(container)\n tooltipStates.delete(container)\n }\n })\n }\n\n const state = tooltipStates.get(container)\n if (!state) {\n throw new Error('applyTooltip: state not initialized')\n }\n\n const theme = themeRegistry.getGlobalTheme()\n const tooltipTheme = theme.Tooltip || {}\n\n // Create hover handlers\n const onHoverStart = (data: HoverEventData) => {\n // Call existing handler if present\n if (existingOnHoverStart) existingOnHoverStart(data)\n\n // Get tooltip config\n if (!nextCallback) return\n\n const result = nextCallback()\n if (!result) return // null/undefined = no tooltip\n\n const config: TooltipConfig = typeof result === 'string' ? { content: result } : result\n\n if (config.disabled) return\n\n // Clear any pending hide/auto-dismiss timers\n if (state.hideTimer) {\n clearTimeout(state.hideTimer)\n state.hideTimer = null\n }\n if (state.autoDismissTimer) {\n clearTimeout(state.autoDismissTimer)\n state.autoDismissTimer = null\n }\n\n // Start show timer\n const showDelay = config.showDelay ?? tooltipTheme.showDelay ?? 500\n state.showTimer = setTimeout(() => {\n showTooltip(scene, container, config)\n }, showDelay)\n }\n\n const onHoverEnd = (data: HoverEventData) => {\n // Call existing handler if present\n if (existingOnHoverEnd) existingOnHoverEnd(data)\n\n // Clear any pending show timer\n if (state.showTimer) {\n clearTimeout(state.showTimer)\n state.showTimer = null\n }\n\n // Start hide timer\n const hideDelay = state.currentConfig?.hideDelay ?? tooltipTheme.hideDelay ?? 0\n if (hideDelay > 0) {\n state.hideTimer = setTimeout(() => {\n hideTooltip(container)\n }, hideDelay)\n } else {\n hideTooltip(container)\n }\n }\n\n return { onHoverStart, onHoverEnd }\n}\n","/**\n * Shared property creators for component initialization\n * These functions avoid code duplication when creating nodes with initial properties\n */\nimport type * as Phaser from 'phaser'\nimport type { BackgroundProps } from '../../core-props'\nimport { createBackgroundImage, type BackgroundImage } from '../backgroundImage'\n\n/**\n * Create background graphics for container-based components\n * @param scene - Phaser scene\n * @param container - Container to add background to\n * @param props - Props with background settings\n */\nexport function createBackground(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container & { __background?: BackgroundImage },\n props: Partial<\n BackgroundProps & { width?: number | string | undefined; height?: number | string | undefined }\n >\n): void {\n const hasBackground = props.backgroundColor !== undefined\n const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== undefined\n\n if (hasBackground || hasBorder) {\n const width = typeof props.width === 'number' ? props.width : 100\n const height = typeof props.height === 'number' ? props.height : 100\n\n const background = createBackgroundImage(scene, props, width, height)\n\n if (!background) return\n\n container.addAt(background, 0)\n container.__background = background\n }\n}\n","/**\n * Gesture setup for component initialization\n * Registers containers with the GestureManager for high-level gesture detection\n */\nimport type { LayoutSize } from '@number10/phaserjsx/layout/types'\nimport * as Phaser from 'phaser'\nimport type { GestureProps, LayoutProps } from '../../core-props'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport type { GestureCallbacks } from '../../gestures/gesture-types'\n\n/**\n * Setup gesture tracking for container-based components\n * Only registers if enableGestures is true and at least one gesture callback exists\n * @param scene - Scene containing the gesture manager\n * @param container - Container to make gesture-aware\n * @param props - Props with gesture settings\n */\nexport function createGestures(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n props: Partial<GestureProps & LayoutProps>\n): void {\n // Check if any gesture callback is defined\n const hasAnyGesture = !!(\n props.onTouch ||\n props.onTouchOutside ||\n props.onTouchMove ||\n props.onDoubleTap ||\n props.onLongPress ||\n props.onHoverStart ||\n props.onHoverEnd ||\n props.onWheel\n )\n\n // Auto-enable gestures if callbacks are provided, unless explicitly disabled\n const shouldEnable = hasAnyGesture && props.enableGestures !== false\n\n if (!shouldEnable) {\n return\n }\n\n // Get scene's gesture manager\n const manager = getGestureManager(scene)\n\n // Get actual calculated container size from layout system\n // Use __getLayoutSize if available (set by createLayout), otherwise fallback to getBounds\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n const { width, height } = containerWithLayout.__getLayoutSize\n ? containerWithLayout.__getLayoutSize()\n : (() => {\n // Fallback to getBounds if __getLayoutSize not available yet\n const bounds = container.getBounds()\n return { width: bounds.width || 100, height: bounds.height || 100 }\n })()\n\n // Create hit area with origin at (0,0) - matches our component system\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n // Build callbacks object\n const callbacks: GestureCallbacks = {}\n if (props.onTouch) callbacks.onTouch = props.onTouch\n if (props.onTouchOutside) callbacks.onTouchOutside = props.onTouchOutside\n if (props.onTouchMove) callbacks.onTouchMove = props.onTouchMove\n if (props.onDoubleTap) callbacks.onDoubleTap = props.onDoubleTap\n if (props.onLongPress) callbacks.onLongPress = props.onLongPress\n if (props.onHoverStart) callbacks.onHoverStart = props.onHoverStart\n if (props.onHoverEnd) callbacks.onHoverEnd = props.onHoverEnd\n if (props.onWheel) callbacks.onWheel = props.onWheel\n\n // Build config (only include defined values)\n const config: { longPressDuration?: number; doubleTapDelay?: number; maxTouchDuration?: number } =\n {}\n if (props.longPressDuration !== undefined) config.longPressDuration = props.longPressDuration\n if (props.doubleTapDelay !== undefined) config.doubleTapDelay = props.doubleTapDelay\n if (props.maxTouchDuration !== undefined) config.maxTouchDuration = props.maxTouchDuration\n\n // Register with manager\n manager.registerContainer(container, callbacks, hitArea, config)\n}\n","/**\n * Layout creator for initializing container layout system\n */\nimport type { BackgroundProps, LayoutProps, TransformProps } from '../../core-props'\nimport { normalizeGap } from '../../core-props'\nimport {\n getChildSize,\n parseSize,\n resolveSize,\n type GameObjectWithLayout,\n type LayoutSize,\n} from '../../layout/index'\n\n/**\n * Creates layout infrastructure for a container\n * Attaches layout props and dynamic size provider\n * @param container - Phaser container\n * @param props - Layout props\n */\nexport function createLayout(\n container: Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps & BackgroundProps & TransformProps\n __getLayoutSize?: () => LayoutSize\n width?: number | string\n height?: number | string\n },\n props: Partial<LayoutProps & BackgroundProps & TransformProps>\n): void {\n // Attach layout props for layout calculations (includes visible for display control)\n container.__layoutProps = props as LayoutProps & BackgroundProps & TransformProps\n\n // Attach dynamic size provider\n // This returns the calculated dimensions after layout\n container.__getLayoutSize = () => {\n const children = container.list as GameObjectWithLayout[]\n\n const direction = props.direction ?? 'column'\n const paddingRaw = props.padding ?? {}\n const padding =\n typeof paddingRaw === 'number'\n ? { left: paddingRaw, top: paddingRaw, right: paddingRaw, bottom: paddingRaw }\n : paddingRaw\n const paddingLeft = padding.left ?? 0\n const paddingTop = padding.top ?? 0\n const paddingRight = padding.right ?? 0\n const paddingBottom = padding.bottom ?? 0\n const gapNormalized = normalizeGap(props.gap)\n\n let maxWidth = 0\n let maxHeight = 0\n let totalMainSize = 0\n\n // Count non-background children\n let childCount = 0\n\n for (const child of children) {\n if (child.__isBackground) {\n continue\n }\n\n childCount++\n\n const marginRaw = child.__layoutProps?.margin ?? {}\n const margin =\n typeof marginRaw === 'number'\n ? { top: marginRaw, right: marginRaw, bottom: marginRaw, left: marginRaw }\n : marginRaw\n const marginTop = margin.top ?? 0\n const marginBottom = margin.bottom ?? 0\n const marginLeft = margin.left ?? 0\n const marginRight = margin.right ?? 0\n\n const childSize = getChildSize(child)\n\n if (direction === 'row') {\n // Horizontal layout\n totalMainSize += marginLeft + childSize.width + marginRight\n const childTotalHeight = marginTop + childSize.height + marginBottom\n maxHeight = Math.max(maxHeight, childTotalHeight)\n } else {\n // Vertical layout (column)\n const childTotalWidth = marginLeft + childSize.width + marginRight\n maxWidth = Math.max(maxWidth, childTotalWidth)\n totalMainSize += marginTop + childSize.height + marginBottom\n }\n }\n\n // Add gaps to total main size\n if (childCount > 1) {\n const gapValue = direction === 'row' ? gapNormalized.horizontal : gapNormalized.vertical\n totalMainSize += gapValue * (childCount - 1)\n }\n\n const defaultWidth =\n direction === 'row'\n ? totalMainSize + paddingLeft + paddingRight\n : maxWidth + paddingLeft + paddingRight\n const defaultHeight =\n direction === 'row'\n ? maxHeight + paddingTop + paddingBottom\n : totalMainSize + paddingTop + paddingBottom\n\n // Resolve width (handle percentage and auto)\n const parsedWidth = parseSize(props.width)\n const finalWidth = resolveSize(parsedWidth, undefined, defaultWidth)\n\n // Resolve height (handle percentage and auto)\n const parsedHeight = parseSize(props.height)\n const finalHeight = resolveSize(parsedHeight, undefined, defaultHeight)\n\n return {\n width: finalWidth,\n height: finalHeight,\n }\n }\n}\n","/**\n * View component - Phaser Container with background Graphics and layout system\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: LAYOUT CONTAINER\n * Purpose: Primary layout primitive for UI composition\n * Composition: Phaser.Container + Background Graphics (optional)\n * Responsibilities:\n * - Layout orchestration (flexbox-style positioning of children)\n * - Visual styling (background color, borders, corner radius)\n * - Gesture handling (touch/mouse interaction)\n * - Dimension management (defines its own size + provides context for children)\n *\n * 2. Headless Behavior: NEVER HEADLESS ⚠️\n * Decision: View cannot be headless (always participates in layout)\n * Reasoning:\n * - View IS the layout system - it defines layout context for children\n * - Background Graphics has special role (__isBackground flag)\n * - Graphics is internal to View, excluded from child layout calculations\n * - If you need non-layout container, use raw Phaser.Container directly\n *\n * 3. Layout System Architecture:\n * Two-part system:\n * A) Background Graphics (special role):\n * - Defines View dimensions (not a layout child!)\n * - Marked with __isBackground = true\n * - Filtered out in layout calculations (see isLayoutChild helper)\n * - Automatically resized to match container dimensions\n * B) Layout Engine:\n * - Processes children (Views, Text, Images, etc.)\n * - Applies flexbox-style layout (row/column/stack)\n * - Respects headless flag on children\n * - Updates child positions/sizes based on layout props\n *\n * 4. Background Graphics vs. Graphics Component:\n * Distinction:\n * - View Background: Internal, auto-managed, defines dimensions, __isBackground=true\n * - Graphics Component: User-facing, custom shapes, typically headless=true\n * - Both use Phaser.Graphics but completely different purposes\n *\n * 5. Layout Size Provider:\n * Implementation: __getLayoutSize returns explicit or calculated dimensions\n * Behavior:\n * - Explicit width/height: Use those values\n * - Auto-size (undefined): Calculate from children + padding\n * - Percentage/fill: Resolve from parent context\n * - Critical: Background Graphics updates to match final size\n *\n * 6. Gesture System Integration:\n * Features:\n * - enableGestures: true enables touch/mouse interaction\n * - Hit area automatically sized to container dimensions\n * - Updated after layout recalculation (deferred queue)\n * - Supports: onTouch, onTouchMove, onDoubleTap, onLongPress\n * - Cross-platform (transparent mouse/touch support)\n *\n * 7. Styling Props:\n * Background:\n * - backgroundColor/backgroundAlpha: Fill color\n * - cornerRadius: Rounded corners (number or per-corner object)\n * - borderColor/borderWidth/borderAlpha: Stroke\n * Auto-defaults:\n * - backgroundAlpha defaults to 1 if backgroundColor set\n * - borderWidth defaults to 1 if borderColor set\n *\n * 8. Common Patterns:\n * Layout Container:\n * <View direction=\"row\" gap={10} padding={20}>\n * <View flex={1}>Left</View>\n * <View flex={2}>Right</View>\n * </View>\n * Styled Box:\n * <View backgroundColor={0x3498db} cornerRadius={8} padding={16}>\n * <Text text=\"Card Content\" />\n * </View>\n * Interactive Area:\n * <View enableGestures={true} onTouch={() => console.log('clicked')}>\n * <Text text=\"Button\" />\n * </View>\n *\n * 9. Performance Considerations:\n * - Background Graphics redrawn only when visual props change\n * - Layout calculations batched (LayoutBatchQueue)\n * - Gesture hit areas updated in deferred queue (post-layout)\n * - Overflow masking (overflow=\"hidden\") adds Phaser mask overhead\n *\n * 10. Known Limitations:\n * - Background Graphics cannot be independently positioned/rotated\n * - Nested View layout recalculations can be expensive (use sparingly)\n * - Gesture system requires scene pointer plugin (auto-enabled)\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Container creation\n * [✅] Background Graphics with styling (color, border, radius)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Transform props (position, rotation, scale, alpha)\n * [✅] Gesture system (enableGestures, interaction callbacks)\n * [✅] Auto-defaults for background/border alpha\n * [✅] Overflow masking support\n * [✅] Theme system integration\n * [✅] Deferred layout queue for gesture updates\n */\nimport * as Phaser from 'phaser'\nimport type {\n BackgroundProps,\n GestureProps,\n LayoutProps,\n PhaserProps,\n TransformProps,\n} from '../../core-props'\nimport { DebugLogger } from '../../dev-config'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsContainerExtension, PropsDefaultExtension } from '../../types'\nimport { applyBackgroundProps } from '../appliers/applyBackground'\nimport { applyGesturesProps } from '../appliers/applyGestures'\nimport { applyLayoutProps } from '../appliers/applyLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTooltip } from '../appliers/applyTooltip'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport type { BackgroundImage } from '../backgroundImage'\nimport { createBackground } from '../creators/createBackground'\nimport { createGestures } from '../creators/createGestures'\nimport { createLayout } from '../creators/createLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Normalize background props - apply auto-defaults for alpha and border width\n * @param props - Original props\n * @returns Normalized props with auto-defaults applied\n */\nfunction normalizeBackgroundProps<T>(props: T): T {\n // Only process if props contain background/border properties\n const bgProps = props as unknown as Partial<BackgroundProps>\n const hasBackground = bgProps.backgroundColor !== undefined\n const hasBorder = bgProps.borderColor !== undefined\n\n // If no background/border props, return as-is\n if (!hasBackground && !hasBorder) {\n return props\n }\n\n // Only apply defaults if the prop is explicitly undefined or 0 (theme default)\n // This allows users to override with explicit values\n const normalized = { ...props } as T & Partial<BackgroundProps>\n\n if (hasBackground && bgProps.backgroundAlpha === undefined) {\n normalized.backgroundAlpha = 1\n }\n\n if (hasBorder) {\n if (bgProps.borderWidth === undefined || bgProps.borderWidth === 0) {\n normalized.borderWidth = 1\n }\n if (bgProps.borderAlpha === undefined || bgProps.borderAlpha === 0) {\n normalized.borderAlpha = 1\n }\n }\n\n return normalized as T\n}\n\n/**\n * Base props for View - composing shared prop groups\n */\nexport interface ViewBaseProps\n extends TransformProps, PhaserProps, LayoutProps, BackgroundProps, GestureProps {}\n\n/**\n * Props for View (Container) component - extends base props with JSX-specific props\n */\nexport interface ViewProps\n extends\n ViewBaseProps,\n PropsDefaultExtension<Phaser.GameObjects.Container>,\n PropsContainerExtension {}\n\n/**\n * View creator - creates a Phaser Container with optional background and interaction\n */\nexport const viewCreator: HostCreator<'View'> = (scene, props) => {\n // Debug: Log props to verify theme values\n if (props.backgroundColor !== undefined || props.cornerRadius !== undefined) {\n DebugLogger.log('theme', 'View Creator - Props received:', {\n backgroundColor: props.backgroundColor,\n cornerRadius: props.cornerRadius,\n width: props.width,\n height: props.height,\n })\n }\n\n // Normalize props early - apply auto-defaults for background/border\n const normalizedProps = normalizeBackgroundProps(props)\n\n const container = scene.add.container(normalizedProps.x ?? 0, normalizedProps.y ?? 0)\n\n // Apply transform props (scale, rotation)\n createTransform(container, normalizedProps)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(container, normalizedProps)\n\n // Add background if backgroundColor is provided\n createBackground(\n scene,\n container as typeof container & { __background?: BackgroundImage },\n normalizedProps\n )\n\n // Setup layout system (props and size provider)\n // Must be before createGestures so __getLayoutSize is available\n createLayout(container, normalizedProps)\n\n // Tooltip support - inject hover handlers if onTooltip is present\n if (normalizedProps.onTooltip) {\n const handlers = applyTooltip(\n scene,\n container,\n normalizedProps.onTooltip,\n normalizedProps.onHoverStart,\n normalizedProps.onHoverEnd\n )\n normalizedProps.onHoverStart = handlers.onHoverStart\n normalizedProps.onHoverEnd = handlers.onHoverEnd\n }\n\n // Setup gesture system (high-level touch/mouse gestures)\n createGestures(scene, container, normalizedProps)\n\n // Debug: Log layout props storage\n DebugLogger.log(\n 'layout',\n 'View creator storing __layoutProps with padding:',\n normalizedProps.padding\n )\n\n return container\n}\n\n/**\n * View patcher - updates View properties\n */\nexport const viewPatcher: HostPatcher<'View'> = (node, prev, next) => {\n // Normalize props early - apply auto-defaults for background/border\n const normalizedPrev = normalizeBackgroundProps(prev)\n const normalizedNext = normalizeBackgroundProps(next)\n\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, normalizedPrev, normalizedNext)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, normalizedPrev, normalizedNext)\n\n // Background updates\n const container = node as Phaser.GameObjects.Container & {\n __background?: BackgroundImage\n }\n\n applyBackgroundProps(container, normalizedPrev, normalizedNext)\n\n // Tooltip support (integrates with gesture system)\n // Apply before gestures so hover handlers can be injected\n if (container.scene && container.scene.data) {\n if (normalizedNext.onTooltip) {\n const handlers = applyTooltip(\n container.scene,\n container,\n normalizedNext.onTooltip,\n normalizedNext.onHoverStart,\n normalizedNext.onHoverEnd\n )\n // Inject hover handlers for tooltip\n normalizedNext.onHoverStart = handlers.onHoverStart\n normalizedNext.onHoverEnd = handlers.onHoverEnd\n }\n }\n\n // Gesture event handlers (high-level touch/mouse gestures)\n // Safety check: ensure container has valid scene before applying gestures\n if (container.scene && container.scene.data) {\n applyGesturesProps(container.scene, container, normalizedPrev, normalizedNext)\n }\n\n // Apply layout props and recalculate if needed\n applyLayoutProps(container, normalizedPrev, normalizedNext)\n}\n","/** @jsxImportSource ../.. */\n/**\n * ActivityIndicator component — indeterminate loading spinner.\n */\nimport { useEffect, useScene, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, Text, View, type ViewProps } from '../index'\n\nexport type ActivityIndicatorVariant = 'spinner' | 'dots' | 'pulse'\nexport type ActivityIndicatorSize = 'small' | 'medium' | 'large'\n\nexport interface ActivityIndicatorLabels {\n loading?: string\n}\n\nexport interface ActivityIndicatorThemeSlot extends ViewTheme {\n variant?: ActivityIndicatorVariant\n size?: ActivityIndicatorSize\n color?: number\n trackColor?: number\n lineWidth?: number\n gap?: number\n dotCount?: number\n dotSize?: number\n pulseScale?: number\n animationSpeed?: number\n labelStyle?: Phaser.Types.GameObjects.Text.TextStyle\n labels?: ActivityIndicatorLabels\n}\n\nexport interface ActivityIndicatorProps extends Omit<ViewProps, 'children'> {\n /** Visual variant. */\n variant?: ActivityIndicatorVariant\n /** Size preset. */\n size?: ActivityIndicatorSize\n /** Foreground color of the spinner arc / dots / pulse. */\n color?: number\n /** Track (background) color for the spinner ring. */\n trackColor?: number\n /** Optional visible label below the indicator. */\n label?: string\n /** Localized labels. */\n labels?: ActivityIndicatorLabels\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nfunction getSizeConfig(size: ActivityIndicatorSize): {\n containerSize: number\n lineWidth: number\n dotSize: number\n dotCount: number\n} {\n switch (size) {\n case 'small':\n return { containerSize: 20, lineWidth: 2, dotSize: 5, dotCount: 3 }\n case 'large':\n return { containerSize: 48, lineWidth: 4, dotSize: 10, dotCount: 3 }\n default:\n return { containerSize: 32, lineWidth: 3, dotSize: 7, dotCount: 3 }\n }\n}\n\nfunction drawSpinnerArc(\n g: Phaser.GameObjects.Graphics,\n cx: number,\n cy: number,\n radius: number,\n lineWidth: number,\n color: number,\n trackColor: number,\n angle: number\n): void {\n g.clear()\n\n // Track ring (faint)\n g.lineStyle(lineWidth, trackColor, 0.3)\n g.beginPath()\n g.arc(cx, cy, radius, 0, Math.PI * 2)\n g.strokePath()\n\n // Spinning arc\n const sweep = Math.PI * 0.75\n const start = angle\n const end = start + sweep\n\n g.lineStyle(lineWidth, color, 1)\n g.beginPath()\n g.arc(cx, cy, radius, start, end)\n g.strokePath()\n}\n\nfunction drawDots(\n g: Phaser.GameObjects.Graphics,\n cx: number,\n cy: number,\n dotSize: number,\n color: number,\n count: number,\n activeIndex: number\n): void {\n g.clear()\n const spacing = dotSize * 2.2\n const totalWidth = count * spacing - spacing\n const startX = cx - totalWidth / 2\n\n for (let i = 0; i < count; i++) {\n const alpha = i === activeIndex ? 1 : 0.3\n g.fillStyle(color, alpha)\n g.fillCircle(startX + i * spacing, cy, dotSize / 2)\n }\n}\n\nfunction drawPulse(\n g: Phaser.GameObjects.Graphics,\n cx: number,\n cy: number,\n radius: number,\n color: number,\n progress: number\n): void {\n g.clear()\n\n // Outer ring\n g.lineStyle(2, color, 0.2)\n g.beginPath()\n g.arc(cx, cy, radius, 0, Math.PI * 2)\n g.strokePath()\n\n // Pulsing inner circle\n const pulseRadius = radius * 0.5 * (0.5 + 0.5 * Math.sin(progress * Math.PI * 2))\n const alpha = 0.3 + 0.7 * Math.abs(Math.cos(progress * Math.PI))\n g.fillStyle(color, alpha)\n g.fillCircle(cx, cy, pulseRadius)\n}\n\n/**\n * ActivityIndicator — indeterminate loading indicator.\n */\nexport function ActivityIndicator(props: ActivityIndicatorProps): VNodeLike {\n const {\n variant,\n size,\n color: colorOverride,\n trackColor: trackColorOverride,\n label,\n labels: labelOverrides,\n theme,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('ActivityIndicator', mergedLocalTheme, {})\n const themedControl = themed as unknown as ActivityIndicatorThemeSlot\n const scene = useScene()\n const [tick, setTick] = useState(0)\n\n const resolvedVariant = variant ?? themedControl.variant ?? 'spinner'\n const resolvedSize = size ?? themedControl.size ?? 'medium'\n const { containerSize, lineWidth, dotSize, dotCount } = getSizeConfig(resolvedSize)\n const resolvedColor = colorOverride ?? themedControl.color ?? 0x60a5fa\n const resolvedTrackColor = trackColorOverride ?? themedControl.trackColor ?? resolvedColor\n const speed = (themedControl.animationSpeed ?? 2.4) * (resolvedVariant === 'dots' ? 0.25 : 1) // Slow down dots variant for better visibility\n\n const labels = {\n ...(themedControl.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n const labelText = label ?? labels.loading\n const labelStyle = themedControl.labelStyle ?? { color: '#9fb3c8', fontSize: '13px' }\n\n // Animation tick\n useEffect(() => {\n const interval = 1000 / 60 // ~60fps\n const timer = scene.time.addEvent({\n delay: interval,\n loop: true,\n callback: () => setTick((t) => t + 1),\n })\n return () => timer.remove()\n }, [scene])\n\n const progress = (tick * speed * 0.01) % 1\n\n const renderIndicator = () => {\n const cx = containerSize / 2\n const cy = containerSize / 2\n const radius = (containerSize - lineWidth) / 2\n const angle = tick * 0.05\n const activeDot = Math.floor(((tick * speed) / 10) % dotCount)\n\n return (\n <Graphics\n width={containerSize}\n height={containerSize}\n onDraw={(g) => {\n switch (resolvedVariant) {\n case 'dots':\n drawDots(g, cx, cy, dotSize, resolvedColor, dotCount, activeDot)\n break\n case 'pulse':\n drawPulse(g, cx, cy, radius, resolvedColor, progress)\n break\n default:\n drawSpinnerArc(g, cx, cy, radius, lineWidth, resolvedColor, resolvedTrackColor, angle)\n }\n }}\n dependencies={[tick, resolvedVariant, resolvedColor]}\n />\n )\n }\n\n return (\n <View\n direction=\"column\"\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={themedControl.gap ?? 8}\n {...viewProps}\n theme={nestedTheme}\n >\n {renderIndicator()}\n {labelText ? <Text text={labelText} style={labelStyle} /> : null}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Badge and Tag components - compact labels for counts, status, filters, and inventory metadata.\n */\nimport { useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Button, Text, View, type ViewProps } from '../index'\n\nexport type BadgeTone = 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info'\nexport type BadgeVariant = 'solid' | 'soft' | 'outline'\nexport type BadgeSize = 'small' | 'medium' | 'large'\n\nexport interface BadgeToneColors {\n backgroundColor: number\n softBackgroundColor: number\n borderColor: number\n textColor: string\n outlineTextColor: string\n}\n\nexport interface BadgeSizeConfig {\n height: number\n padding: ViewProps['padding']\n fontSize: number\n cornerRadius: number\n gap: number\n dotSize: number\n}\n\nexport interface BadgeFormatOptions {\n count?: number\n maxCount?: number\n}\n\nexport interface BadgeProps extends Omit<ViewProps, 'children'> {\n /** Badge content. Use children for custom content, or label/count for text content. */\n children?: ChildrenType\n /** Text or number shown inside the badge. */\n label?: string | number\n /** Numeric count. Values above maxCount render as maxCount+. */\n count?: number\n /** Maximum count before compact overflow formatting is used. */\n maxCount?: number\n /** Render as a compact status dot without text. */\n dot?: boolean\n /** Semantic color tone. */\n tone?: BadgeTone\n /** Visual style variant. */\n variant?: BadgeVariant\n /** Size preset. */\n size?: BadgeSize\n /** Text style override for generated label/count content. */\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n /** Disabled state. */\n disabled?: boolean\n /** Alpha applied while disabled. */\n disabledAlpha?: number\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nexport interface TagProps extends Omit<BadgeProps, 'count' | 'maxCount' | 'dot'> {\n /** Selected/active tag state. */\n selected?: boolean\n /** Optional close/remove action. */\n onRemove?: () => void\n /** Text used for the close affordance. */\n closeLabel?: string\n}\n\nconst DEFAULT_TONES: Record<BadgeTone, BadgeToneColors> = {\n neutral: {\n backgroundColor: 0x475569,\n softBackgroundColor: 0x1e293b,\n borderColor: 0x64748b,\n textColor: '#ffffff',\n outlineTextColor: '#cbd5e1',\n },\n primary: {\n backgroundColor: 0x2563eb,\n softBackgroundColor: 0x1e3a8a,\n borderColor: 0x60a5fa,\n textColor: '#ffffff',\n outlineTextColor: '#93c5fd',\n },\n success: {\n backgroundColor: 0x16a34a,\n softBackgroundColor: 0x14532d,\n borderColor: 0x4ade80,\n textColor: '#ffffff',\n outlineTextColor: '#86efac',\n },\n warning: {\n backgroundColor: 0xf59e0b,\n softBackgroundColor: 0x78350f,\n borderColor: 0xfbbf24,\n textColor: '#111827',\n outlineTextColor: '#fde68a',\n },\n danger: {\n backgroundColor: 0xdc2626,\n softBackgroundColor: 0x7f1d1d,\n borderColor: 0xf87171,\n textColor: '#ffffff',\n outlineTextColor: '#fecaca',\n },\n info: {\n backgroundColor: 0x0891b2,\n softBackgroundColor: 0x164e63,\n borderColor: 0x22d3ee,\n textColor: '#ffffff',\n outlineTextColor: '#a5f3fc',\n },\n}\n\nconst DEFAULT_SIZES: Record<BadgeSize, BadgeSizeConfig> = {\n small: {\n height: 22,\n padding: { left: 8, right: 8, top: 3, bottom: 3 },\n fontSize: 12,\n cornerRadius: 11,\n gap: 5,\n dotSize: 8,\n },\n medium: {\n height: 26,\n padding: { left: 10, right: 10, top: 4, bottom: 4 },\n fontSize: 14,\n cornerRadius: 13,\n gap: 6,\n dotSize: 10,\n },\n large: {\n height: 32,\n padding: { left: 13, right: 13, top: 5, bottom: 5 },\n fontSize: 18,\n cornerRadius: 16,\n gap: 8,\n dotSize: 12,\n },\n}\n\nexport function formatBadgeCount({ count, maxCount = 99 }: BadgeFormatOptions): string {\n if (!Number.isFinite(count)) return '0'\n\n const normalizedCount = Math.max(0, Math.floor(count ?? 0))\n const normalizedMax = Math.max(0, Math.floor(maxCount))\n\n return normalizedCount > normalizedMax ? `${normalizedMax}+` : `${normalizedCount}`\n}\n\nexport function getBadgeText(props: Pick<BadgeProps, 'label' | 'count' | 'maxCount'>): string {\n if (props.count !== undefined) return formatBadgeCount(props)\n if (props.label !== undefined) return `${props.label}`\n return ''\n}\n\nfunction resolveBadgeColors(\n tone: BadgeTone,\n variant: BadgeVariant\n): {\n backgroundColor: number\n backgroundAlpha: number\n borderColor: number\n borderWidth: number\n textColor: string\n} {\n const toneColors = DEFAULT_TONES[tone]\n\n if (variant === 'outline') {\n return {\n backgroundColor: 0x000000,\n backgroundAlpha: 0,\n borderColor: toneColors.borderColor,\n borderWidth: 1,\n textColor: toneColors.outlineTextColor,\n }\n }\n\n if (variant === 'soft') {\n return {\n backgroundColor: toneColors.softBackgroundColor,\n backgroundAlpha: 1,\n borderColor: toneColors.borderColor,\n borderWidth: 1,\n textColor: toneColors.outlineTextColor,\n }\n }\n\n return {\n backgroundColor: toneColors.backgroundColor,\n backgroundAlpha: 1,\n borderColor: toneColors.borderColor,\n borderWidth: 0,\n textColor: toneColors.textColor,\n }\n}\n\nexport interface BadgeTextStyleOptions {\n size: BadgeSize\n textColor: string\n themedTextStyle?: Phaser.Types.GameObjects.Text.TextStyle | undefined\n explicitTextStyle?: Phaser.Types.GameObjects.Text.TextStyle | undefined\n}\n\nexport function getBadgeSizeConfig(size: BadgeSize): BadgeSizeConfig {\n return DEFAULT_SIZES[size]\n}\n\nexport function resolveBadgeTextStyle(\n options: BadgeTextStyleOptions\n): Phaser.Types.GameObjects.Text.TextStyle {\n const sizeConfig = getBadgeSizeConfig(options.size)\n\n return {\n color: options.textColor,\n fontSize: `${sizeConfig.fontSize}px`,\n ...(options.themedTextStyle ?? {}),\n ...(options.explicitTextStyle ?? {}),\n }\n}\n\nexport function Badge(props: BadgeProps): VNodeLike {\n const {\n children,\n label,\n count,\n maxCount,\n dot = false,\n tone: explicitTone,\n variant: explicitVariant,\n size: explicitSize,\n textStyle: explicitTextStyle,\n disabled = false,\n disabledAlpha: explicitDisabledAlpha,\n theme,\n width,\n height,\n padding,\n gap,\n cornerRadius,\n backgroundColor,\n backgroundAlpha,\n borderColor,\n borderWidth,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Badge', mergedLocalTheme, {})\n const tone = explicitTone ?? themed.tone ?? 'neutral'\n const variant = explicitVariant ?? themed.variant ?? 'solid'\n const size = explicitSize ?? themed.size ?? 'medium'\n const sizeConfig = getBadgeSizeConfig(size)\n const colors = resolveBadgeColors(tone, variant)\n const disabledAlpha = explicitDisabledAlpha ?? themed.disabledAlpha ?? 0.5\n const effectiveAlpha = disabled ? disabledAlpha : alpha\n const resolvedMaxCount = maxCount ?? themed.maxCount ?? 99\n const text =\n count !== undefined\n ? formatBadgeCount({ count, maxCount: resolvedMaxCount })\n : label !== undefined\n ? `${label}`\n : ''\n const resolvedTextStyle = resolveBadgeTextStyle({\n size,\n textColor: colors.textColor,\n themedTextStyle: themed.textStyle,\n explicitTextStyle,\n })\n const dotSize = themed.dotSize ?? sizeConfig.dotSize\n\n if (dot) {\n return (\n <View\n {...viewProps}\n width={width ?? dotSize}\n height={height ?? dotSize}\n backgroundColor={backgroundColor ?? themed.backgroundColor ?? colors.backgroundColor}\n backgroundAlpha={backgroundAlpha ?? themed.backgroundAlpha ?? colors.backgroundAlpha}\n borderColor={borderColor ?? themed.borderColor ?? colors.borderColor}\n borderWidth={borderWidth ?? themed.borderWidth ?? colors.borderWidth}\n cornerRadius={cornerRadius ?? themed.cornerRadius ?? dotSize / 2}\n {...(effectiveAlpha !== undefined ? { alpha: effectiveAlpha } : {})}\n theme={nestedTheme}\n />\n )\n }\n\n return (\n <View\n {...viewProps}\n width={width ?? themed.width ?? 'auto'}\n height={height ?? themed.height ?? sizeConfig.height}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={gap ?? themed.gap ?? sizeConfig.gap}\n padding={padding ?? themed.padding ?? sizeConfig.padding}\n backgroundColor={backgroundColor ?? themed.backgroundColor ?? colors.backgroundColor}\n backgroundAlpha={backgroundAlpha ?? themed.backgroundAlpha ?? colors.backgroundAlpha}\n borderColor={borderColor ?? themed.borderColor ?? colors.borderColor}\n borderWidth={borderWidth ?? themed.borderWidth ?? colors.borderWidth}\n cornerRadius={cornerRadius ?? themed.cornerRadius ?? sizeConfig.cornerRadius}\n {...(effectiveAlpha !== undefined ? { alpha: effectiveAlpha } : {})}\n theme={nestedTheme}\n >\n {children ?? <Text text={text} style={resolvedTextStyle} />}\n </View>\n )\n}\n\nexport function Tag(props: TagProps): VNodeLike {\n const {\n selected = false,\n onRemove,\n closeLabel = 'x',\n tone,\n variant,\n size,\n theme,\n children,\n label,\n textStyle,\n ...badgeProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Tag', mergedLocalTheme, {})\n const resolvedTone = tone ?? themed.tone ?? (selected ? 'primary' : 'neutral')\n const resolvedVariant = variant ?? themed.variant ?? (selected ? 'solid' : 'soft')\n const resolvedSize = size ?? themed.size ?? 'medium'\n const colors = resolveBadgeColors(resolvedTone, resolvedVariant)\n const closeSize = themed.closeSize ?? 16\n const resolvedTextStyle = resolveBadgeTextStyle({\n size: resolvedSize,\n textColor: colors.textColor,\n themedTextStyle: themed.textStyle,\n explicitTextStyle: textStyle,\n })\n const text = label !== undefined ? `${label}` : ''\n\n return (\n <Badge\n {...badgeProps}\n tone={resolvedTone}\n variant={resolvedVariant}\n size={resolvedSize}\n textStyle={resolvedTextStyle}\n theme={nestedTheme}\n >\n {label !== undefined && <Text text={text} style={resolvedTextStyle} />}\n {children}\n {onRemove && (\n <Button\n width={closeSize}\n height={closeSize}\n minWidth={closeSize}\n padding={0}\n cornerRadius={closeSize / 2}\n onClick={onRemove}\n theme={nestedTheme}\n label={closeLabel}\n textStyle={resolvedTextStyle}\n />\n )}\n </Badge>\n )\n}\n","/**\n * Custom hook for Phaser game object effects (shake, pulse, etc.)\n * Manages multiple concurrent effects with proper cleanup\n */\nimport * as Phaser from 'phaser'\nimport { useEffect, useRef } from '../hooks'\n\n/**\n * Ref object type\n */\ntype RefObject<T> = { current: T }\n\n/**\n * Effect configuration\n */\nexport interface EffectConfig {\n magnitude?: number\n time?: number\n intensity?: number\n duration?: number\n direction?: 'left' | 'right' | 'up' | 'down'\n angle?: number\n onComplete?: () => void\n}\n\n/**\n * Position state manager for effects that need to track original position\n * Allows multiple position-based effects to run synchronously\n */\ninterface PositionState {\n originalX: number\n originalY: number\n originalAlpha: number\n originalScaleX: number\n originalScaleY: number\n originalRotation: number\n originX: number\n originY: number\n effectCount: number\n scaleOffsetX: number\n scaleOffsetY: number\n rotationOffset: number\n initialized: boolean\n}\n\n/**\n * WeakMap to store position state for game objects\n * This allows multiple effects to share the same position data\n */\nconst positionStates = new WeakMap<Phaser.GameObjects.Container, PositionState>()\n\n/**\n * Get or create position state for a game object\n * @param obj - Game object\n * @returns Position state\n */\nfunction getPositionState(obj: Phaser.GameObjects.Container): PositionState {\n if (!positionStates.has(obj)) {\n positionStates.set(obj, {\n originalX: obj.x,\n originalY: obj.y,\n originalAlpha: obj.alpha,\n originalScaleX: obj.scaleX,\n originalScaleY: obj.scaleY,\n originalRotation: obj.rotation,\n originX: obj.originX ?? 0,\n originY: obj.originY ?? 0,\n effectCount: 0,\n scaleOffsetX: 0,\n scaleOffsetY: 0,\n rotationOffset: 0,\n initialized: false,\n })\n }\n const state = positionStates.get(obj)\n if (!state) {\n throw new Error('Position state not found')\n }\n return state\n}\n\n/**\n * Increment effect count (called when effect starts)\n * Stores original values only on first effect to prevent race conditions\n * @param obj - Game object\n */\nfunction incrementEffectCount(obj: Phaser.GameObjects.Container): void {\n const state = getPositionState(obj)\n\n // Store original values only when first effect starts\n if (state.effectCount === 0 && !state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n state.effectCount++\n}\n\n/**\n * Decrement effect count (called when effect completes)\n * Resets to original position when count reaches 0\n * @param obj - Game object\n */\nfunction decrementEffectCount(obj: Phaser.GameObjects.Container): void {\n const state = getPositionState(obj)\n state.effectCount--\n\n // Reset to original position, scale, alpha and rotation when all effects are done\n if (state.effectCount <= 0) {\n obj.setPosition(state.originalX, state.originalY)\n obj.setScale(state.originalScaleX, state.originalScaleY)\n obj.setAlpha(state.originalAlpha)\n obj.setRotation(state.originalRotation)\n state.effectCount = 0\n state.scaleOffsetX = 0\n state.scaleOffsetY = 0\n state.rotationOffset = 0\n state.initialized = false\n }\n}\n\n/**\n * Calculate position offset for origin-aware scaling\n * @param obj - Game object\n * @param state - Position state\n * @param currentScaleX - Current X scale\n * @param currentScaleY - Current Y scale\n * @returns Position offsets {x, y}\n */\nfunction calculateScaleOffset(\n obj: Phaser.GameObjects.Container,\n state: PositionState,\n currentScaleX: number,\n currentScaleY: number\n): { x: number; y: number } {\n const width = obj.width\n const height = obj.height\n\n // Calculate offset based on origin (default 0,0 = top-left)\n const offsetX = width * (currentScaleX - state.originalScaleX) * state.originX\n const offsetY = height * (currentScaleY - state.originalScaleY) * state.originY\n\n return { x: offsetX, y: offsetY }\n}\n\n/**\n * Apply origin-aware scale to object\n * @param obj - Game object\n * @param state - Position state\n * @param scaleX - Target X scale\n * @param scaleY - Target Y scale\n */\nfunction applyScaleWithOrigin(\n obj: Phaser.GameObjects.Container,\n state: PositionState,\n scaleX: number,\n scaleY: number\n): void {\n const newOffset = calculateScaleOffset(obj, state, scaleX, scaleY)\n\n // Calculate the delta from previous offset to preserve other tween effects\n const deltaX = newOffset.x - state.scaleOffsetX\n const deltaY = newOffset.y - state.scaleOffsetY\n\n state.scaleOffsetX = newOffset.x\n state.scaleOffsetY = newOffset.y\n\n obj.setScale(scaleX, scaleY)\n // Adjust position by delta to preserve other effects (like Float changing Y)\n obj.setPosition(obj.x - deltaX, obj.y - deltaY)\n}\n\n/**\n * Effect callback function\n * @param obj - The Phaser game object to apply effect to\n * @param config - Effect configuration\n */\nexport type EffectFn = (obj: Phaser.GameObjects.Container, config: EffectConfig) => void\n\n/**\n * This is a no-op effect function\n */\nexport const createNoneEffect: EffectFn = () => {\n // nothing to do\n}\n\n/**\n * Create a shake effect\n * @param obj - Game object to shake\n * @param config - Effect config (magnitude, time)\n */\nexport const createShakeEffect: EffectFn = (obj, config) => {\n const { magnitude = 5, time = 200, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseX = state.originalX\n const baseY = state.originalY\n\n scene.tweens.add({\n targets: obj,\n duration: time,\n x: 0, // required for tween to start\n onUpdate: (tween) => {\n // Use tween progress (0 to 1) for decay calculation\n const progress = tween.progress\n const decayFactor = Math.pow(1 - progress, 2)\n const mag = magnitude * decayFactor\n\n // Apply shake relative to original position, considering scale offset\n const newX = baseX + Phaser.Math.Between(-mag, mag) - state.scaleOffsetX\n const newY = baseY + Phaser.Math.Between(-mag, mag) - state.scaleOffsetY\n obj.setPosition(newX, newY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a pulse effect (scale animation)\n * @param obj - Game object to pulse\n * @param config - Effect config (intensity, time)\n */\nexport const createPulseEffect: EffectFn = (obj, config) => {\n const { intensity = 1.2, time = 300, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time / 2,\n ease: 'Quad.easeOut',\n yoyo: true,\n repeat: 0,\n onUpdate: () => {\n // Use helper function for origin-aware scaling\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a fade effect\n * @param obj - Game object to fade\n * @param config - Effect config (time, duration)\n */\nexport const createFadeEffect: EffectFn = (obj, config) => {\n const { time = 300, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const originalAlpha = state.originalAlpha\n\n scene.tweens.add({\n targets: obj,\n alpha: originalAlpha * 0.5,\n duration: time / 2,\n ease: 'Quad.easeInOut',\n yoyo: true,\n repeat: 0,\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a fade-in effect (alpha from 0 to original)\n * @param obj - Game object to fade in\n * @param config - Effect config (time)\n */\nexport const createFadeInEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetAlpha = state.originalAlpha\n\n obj.setAlpha(0)\n\n scene.tweens.add({\n targets: obj,\n alpha: targetAlpha,\n duration: time,\n ease: 'Quad.easeOut',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a fade-out effect (alpha from original to 0)\n * @param obj - Game object to fade out\n * @param config - Effect config (time)\n */\nexport const createFadeOutEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n incrementEffectCount(obj)\n\n const scene = obj.scene\n\n scene.tweens.add({\n targets: obj,\n alpha: 0,\n duration: time,\n ease: 'Quad.easeIn',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a bounce effect (elastic bounce feedback)\n * @param obj - Game object to bounce\n * @param config - Effect config (intensity, time)\n */\nexport const createBounceEffect: EffectFn = (obj, config) => {\n const { intensity = 1.3, time = 600, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time,\n ease: 'Elastic.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a flash effect (quick scale pulse for visibility)\n * @param obj - Game object to flash\n * @param config - Effect config (time, intensity)\n */\nexport const createFlashEffect: EffectFn = (obj, config) => {\n const { time = 200, intensity = 1.15, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time / 2,\n ease: 'Quad.easeOut',\n yoyo: true,\n repeat: 0,\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a wobble effect (rotation-based shake)\n * @param obj - Game object to wobble\n * @param config - Effect config (magnitude, time)\n */\nexport const createWobbleEffect: EffectFn = (obj, config) => {\n const { magnitude = 0.1, time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + magnitude,\n duration: time / 4,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 1,\n onComplete: () => {\n obj.setRotation(baseRotation)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a jello effect (squash & stretch)\n * @param obj - Game object for jello effect\n * @param config - Effect config (intensity, time)\n */\nexport const createJelloEffect: EffectFn = (obj, config) => {\n const { intensity = 0.15, time = 600, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseScaleX = state.originalScaleX\n const baseScaleY = state.originalScaleY\n\n let step = 0\n const steps = [\n { scaleX: baseScaleX * (1 + intensity), scaleY: baseScaleY * (1 - intensity * 0.5) },\n { scaleX: baseScaleX * (1 - intensity * 0.5), scaleY: baseScaleY * (1 + intensity) },\n { scaleX: baseScaleX * (1 + intensity * 0.3), scaleY: baseScaleY * (1 - intensity * 0.3) },\n { scaleX: baseScaleX, scaleY: baseScaleY },\n ]\n\n const runStep = () => {\n if (step >= steps.length) {\n decrementEffectCount(obj)\n userOnComplete?.()\n return\n }\n\n const currentStep = steps[step]\n if (!currentStep) return\n\n scene.tweens.add({\n targets: obj,\n scaleX: currentStep.scaleX,\n scaleY: currentStep.scaleY,\n duration: time / steps.length,\n ease: 'Sine.easeInOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n step++\n runStep()\n },\n })\n }\n\n runStep()\n}\n\n/**\n * Create a press effect (scale down + bounce back, like button press)\n * @param obj - Game object to press\n * @param config - Effect config (intensity, time)\n */\nexport const createPressEffect: EffectFn = (obj, config) => {\n const { intensity = 0.9, time = 200, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time / 2,\n ease: 'Quad.easeIn',\n yoyo: true,\n repeat: 0,\n easeReturn: 'Back.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a tada effect (attention grabber with scale + rotation)\n * @param obj - Game object for tada effect\n * @param config - Effect config (intensity, time)\n */\nexport const createTadaEffect: EffectFn = (obj, config) => {\n const { intensity = 1.1, time = 600, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n const baseScaleX = state.originalScaleX\n const baseScaleY = state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + 0.05,\n scaleX: intensity * baseScaleX,\n scaleY: intensity * baseScaleY,\n duration: time / 6,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 2,\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n obj.setRotation(baseRotation)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a swing effect (pendulum animation)\n * @param obj - Game object to swing\n * @param config - Effect config (magnitude, time)\n */\nexport const createSwingEffect: EffectFn = (obj, config) => {\n const { magnitude = 0.15, time = 800, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + magnitude,\n duration: time / 4,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 1,\n onComplete: () => {\n obj.setRotation(baseRotation)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a wiggle effect (gentle horizontal shake)\n * @param obj - Game object to wiggle\n * @param config - Effect config (magnitude, time)\n */\nexport const createWiggleEffect: EffectFn = (obj, config) => {\n const { magnitude = 3, time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseX = state.originalX\n\n scene.tweens.add({\n targets: obj,\n x: baseX + magnitude,\n duration: time / 6,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 2,\n onComplete: () => {\n obj.setPosition(baseX, state.originalY)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a slide-in effect\n * @param obj - Game object to slide in\n * @param config - Effect config (direction, time)\n */\nexport const createSlideInEffect: EffectFn = (obj, config) => {\n const { direction = 'left', time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetX = state.originalX\n const targetY = state.originalY\n\n // Calculate start position based on direction\n let startX = targetX\n let startY = targetY\n const distance = 200\n\n switch (direction) {\n case 'left':\n startX = targetX - distance\n break\n case 'right':\n startX = targetX + distance\n break\n case 'up':\n startY = targetY - distance\n break\n case 'down':\n startY = targetY + distance\n break\n }\n\n obj.setPosition(startX, startY)\n\n scene.tweens.add({\n targets: obj,\n x: targetX,\n y: targetY,\n duration: time,\n ease: 'Quad.easeOut',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a slide-out effect\n * @param obj - Game object to slide out\n * @param config - Effect config (direction, time)\n */\nexport const createSlideOutEffect: EffectFn = (obj, config) => {\n const { direction = 'right', time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const startX = state.originalX\n const startY = state.originalY\n const distance = 200\n\n // Calculate target position based on direction\n let targetX = startX\n let targetY = startY\n\n switch (direction) {\n case 'left':\n targetX = startX - distance\n break\n case 'right':\n targetX = startX + distance\n break\n case 'up':\n targetY = startY - distance\n break\n case 'down':\n targetY = startY + distance\n break\n }\n\n scene.tweens.add({\n targets: obj,\n x: targetX,\n y: targetY,\n duration: time,\n ease: 'Quad.easeIn',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a zoom-in effect (scale from 0 to 1)\n * @param obj - Game object to zoom in\n * @param config - Effect config (time)\n */\nexport const createZoomInEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = state.originalScaleX\n const targetScaleY = state.originalScaleY\n\n obj.setScale(0, 0)\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time,\n ease: 'Back.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a zoom-out effect (scale from 1 to 0)\n * @param obj - Game object to zoom out\n * @param config - Effect config (time)\n */\nexport const createZoomOutEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n\n scene.tweens.add({\n targets: obj,\n scaleX: 0,\n scaleY: 0,\n duration: time,\n ease: 'Back.easeIn',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a flip-in effect (3D flip from edge)\n * @param obj - Game object to flip in\n * @param config - Effect config (time)\n */\nexport const createFlipInEffect: EffectFn = (obj, config) => {\n const { time = 500, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = state.originalScaleX\n\n obj.setScale(0, state.originalScaleY)\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n duration: time,\n ease: 'Back.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a flip-out effect (3D flip to edge)\n * @param obj - Game object to flip out\n * @param config - Effect config (time)\n */\nexport const createFlipOutEffect: EffectFn = (obj, config) => {\n const { time = 500, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n\n scene.tweens.add({\n targets: obj,\n scaleX: 0,\n duration: time,\n ease: 'Back.easeIn',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a float effect (gentle up/down motion, for idle items)\n * @param obj - Game object to float\n * @param config - Effect config (magnitude, time)\n */\nexport const createFloatEffect: EffectFn = (obj, config) => {\n const { magnitude = 10, time = 2000 } = config\n\n const state = getPositionState(obj)\n // Initialize original values if not done yet (without incrementing count)\n if (!state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n const scene = obj.scene\n const baseY = state.originalY\n\n scene.tweens.add({\n targets: obj,\n y: baseY - magnitude,\n duration: time,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: -1, // infinite loop\n onUpdate: () => {\n // Keep x position stable, considering scale offset\n obj.setX(state.originalX - state.scaleOffsetX)\n },\n })\n\n // Note: For infinite effects, user must manually stop tween or unmount component\n}\n\n/**\n * Create a breathe effect (slow pulsing for idle/important objects)\n * @param obj - Game object to breathe\n * @param config - Effect config (intensity, time)\n */\nexport const createBreatheEffect: EffectFn = (obj, config) => {\n const { intensity = 1.05, time = 2000 } = config\n\n const state = getPositionState(obj)\n // Initialize original values if not done yet (without incrementing count)\n if (!state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: -1, // infinite loop\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n })\n\n // Note: For infinite effects, user must manually stop tween or unmount component\n}\n\n/**\n * Create a spin effect (continuous rotation)\n * @param obj - Game object to spin\n * @param config - Effect config (time for one full rotation)\n */\nexport const createSpinEffect: EffectFn = (obj, config) => {\n const { time = 2000 } = config\n\n const state = getPositionState(obj)\n // Initialize original values if not done yet (without incrementing count)\n if (!state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + Math.PI * 2,\n duration: time,\n ease: 'Linear',\n repeat: -1, // infinite loop\n })\n\n // Note: For infinite effects, user must manually stop tween or unmount component\n}\n\n/**\n * Hook for applying effects to game objects\n * Handles cleanup of tweens on unmount\n * @param ref - RefObject pointing to a Phaser game object\n * @returns Function to trigger effects\n */\nexport function useGameObjectEffect(ref: RefObject<Phaser.GameObjects.Container | null>) {\n const tweenIdsRef = useRef<Phaser.Tweens.Tween[]>([])\n\n /**\n * Apply an effect to the game object\n * @param effect - Effect function to apply\n * @param config - Effect configuration\n */\n const applyEffect = (effect: EffectFn, config: EffectConfig = {}) => {\n if (!ref.current) return\n\n // Store tween reference for cleanup\n const scene = ref.current.scene\n const tweenCountBefore = scene.tweens.getTweensOf(ref.current).length\n\n effect(ref.current, config)\n\n const tweenCountAfter = scene.tweens.getTweensOf(ref.current).length\n if (tweenCountAfter > tweenCountBefore) {\n const newTweens = scene.tweens.getTweensOf(ref.current).slice(tweenCountBefore)\n tweenIdsRef.current.push(...newTweens)\n }\n }\n\n /**\n * Stop all active effects/tweens\n */\n const stopEffects = () => {\n if (!ref.current) return\n\n const scene = ref.current.scene\n const tweens = scene.tweens.getTweensOf(ref.current)\n\n tweens.forEach((tween: Phaser.Tweens.Tween) => {\n if (!tween.isDestroyed()) {\n tween.stop()\n tween.remove()\n }\n })\n\n tweenIdsRef.current = []\n\n // Reset to original state if there's a state\n const obj = ref.current\n if (positionStates.has(obj)) {\n const state = positionStates.get(obj)\n if (state) {\n obj.setPosition(state.originalX, state.originalY)\n obj.setScale(state.originalScaleX, state.originalScaleY)\n obj.setAlpha(state.originalAlpha)\n obj.setRotation(state.originalRotation)\n state.effectCount = 0\n state.scaleOffsetX = 0\n state.scaleOffsetY = 0\n state.rotationOffset = 0\n state.initialized = false\n }\n }\n }\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n tweenIdsRef.current.forEach((tween) => {\n if (!tween.isDestroyed()) {\n tween.stop()\n }\n })\n tweenIdsRef.current = []\n }\n }, [])\n\n return { applyEffect, stopEffects }\n}\n","/**\n * Effect Repository - Centralized effect configuration and application\n * Provides reusable effect system for any component\n *\n * @example\n * ```typescript\n * // In component props/theme\n * interface MyComponentProps extends EffectDefinition {\n * // ... other props\n * }\n *\n * // In component implementation\n * const { applyEffect } = useGameObjectEffect(ref)\n * const resolved = resolveEffect(props, theme)\n * applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n * ```\n */\nimport {\n createBounceEffect,\n createBreatheEffect,\n createFadeEffect,\n createFadeInEffect,\n createFadeOutEffect,\n createFlashEffect,\n createFlipInEffect,\n createFlipOutEffect,\n createFloatEffect,\n createJelloEffect,\n createNoneEffect,\n createPressEffect,\n createPulseEffect,\n createShakeEffect,\n createSlideInEffect,\n createSlideOutEffect,\n createSpinEffect,\n createSwingEffect,\n createTadaEffect,\n createWiggleEffect,\n createWobbleEffect,\n createZoomInEffect,\n createZoomOutEffect,\n type EffectConfig,\n type EffectFn,\n} from './use-effect'\n\n/**\n * Built-in effect names\n */\nexport type BuiltInEffectName =\n | 'none'\n | 'pulse'\n | 'shake'\n | 'bounce'\n | 'press'\n | 'flash'\n | 'jello'\n | 'fade'\n | 'fadeIn'\n | 'fadeOut'\n | 'wobble'\n | 'tada'\n | 'swing'\n | 'wiggle'\n | 'slideIn'\n | 'slideOut'\n | 'zoomIn'\n | 'zoomOut'\n | 'flipIn'\n | 'flipOut'\n | 'float'\n | 'breathe'\n | 'spin'\n\n/**\n * Extension point for custom effect names\n * Use declaration merging to add custom effects:\n * @example\n * ```typescript\n * declare module '@number10/phaserjsx' {\n * interface EffectNameExtensions {\n * myCustom: 'myCustom'\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface EffectNameExtensions {}\n\n/**\n * Available effect names (built-in + extensions)\n */\nexport type EffectName =\n | BuiltInEffectName\n | (keyof EffectNameExtensions extends never ? never : keyof EffectNameExtensions)\n\n/**\n * Effect configuration with name and config\n */\nexport interface EffectDefinition {\n effect?: EffectName\n effectConfig?: EffectConfig\n}\n\n/**\n * Map of effect names to effect functions\n */\nexport const EFFECT_REGISTRY: Record<BuiltInEffectName, EffectFn | null> = {\n none: createNoneEffect,\n pulse: createPulseEffect,\n shake: createShakeEffect,\n bounce: createBounceEffect,\n press: createPressEffect,\n flash: createFlashEffect,\n jello: createJelloEffect,\n fade: createFadeEffect,\n fadeIn: createFadeInEffect,\n fadeOut: createFadeOutEffect,\n wobble: createWobbleEffect,\n tada: createTadaEffect,\n swing: createSwingEffect,\n wiggle: createWiggleEffect,\n slideIn: createSlideInEffect,\n slideOut: createSlideOutEffect,\n zoomIn: createZoomInEffect,\n zoomOut: createZoomOutEffect,\n flipIn: createFlipInEffect,\n flipOut: createFlipOutEffect,\n float: createFloatEffect,\n breathe: createBreatheEffect,\n spin: createSpinEffect,\n}\n\n/**\n * Default effect configuration\n */\nexport const DEFAULT_EFFECT: Required<EffectDefinition> = {\n effect: 'pulse',\n effectConfig: { intensity: 1.1, time: 100 },\n}\n\n/**\n * Apply an effect by name with configuration\n * @param applyEffect - The applyEffect function from useGameObjectEffect hook\n * @param effectName - Name of the effect to apply\n * @param effectConfig - Optional configuration for the effect\n * @returns true if effect was applied, false otherwise\n */\nexport function applyEffectByName(\n applyEffect: (effect: EffectFn, config?: EffectConfig) => void,\n effectName?: EffectName,\n effectConfig?: EffectConfig\n): boolean {\n const name = effectName ?? DEFAULT_EFFECT.effect\n const config = effectConfig ?? DEFAULT_EFFECT.effectConfig\n const effectFn = EFFECT_REGISTRY[name]\n\n if (effectFn) {\n applyEffect(effectFn, config)\n return true\n }\n\n return false\n}\n\n/**\n * Resolve effect definition with priority: props > theme > default\n * @param props - Props-level effect definition\n * @param theme - Theme-level effect definition\n * @returns Resolved effect definition\n */\nexport function resolveEffect(\n props?: EffectDefinition,\n theme?: EffectDefinition\n): Required<EffectDefinition> {\n return {\n effect: props?.effect ?? theme?.effect ?? DEFAULT_EFFECT.effect,\n effectConfig: props?.effectConfig ?? theme?.effectConfig ?? DEFAULT_EFFECT.effectConfig,\n }\n}\n","/** @jsxImportSource ../.. */\n/**\n * Generic Button component with variant and size support\n * Icon-agnostic - accepts children or content slots\n */\nimport type { ViewProps } from '..'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useRef, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\n\n/**\n * Button variant theme\n */\nexport type ButtonVariantTheme = ViewTheme &\n EffectDefinition & {\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n iconSize?: number\n disabledColor?: number\n disabledTextColor?: string\n disabledIconTint?: number\n disabledAlpha?: number\n }\nexport type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger'\nexport type ButtonSize = 'small' | 'medium' | 'large'\n\nexport type ButtonTheme = ButtonVariantTheme & {\n variant?: ButtonVariant\n size?: ButtonSize\n variants?: Partial<Record<ButtonVariant, ButtonVariantTheme>>\n sizes?: Partial<Record<ButtonSize, ButtonVariantTheme>>\n} & Partial<Record<ButtonVariant, ButtonVariantTheme>> &\n Partial<Record<ButtonSize, ButtonVariantTheme>>\n\n/**\n * Props for Button component\n */\nexport interface ButtonProps extends ViewProps, EffectDefinition {\n /** Button content - can be text, icons, or any JSX */\n children?: ChildrenType | undefined\n /** Convenience text label. Children take precedence when provided. */\n label?: string | number | undefined\n /** Backward-compatible alias for label. */\n text?: string | number | undefined\n /** Click handler */\n onClick?: (() => void) | undefined\n /** Disabled state */\n disabled?: boolean | undefined\n /** Visual variant */\n variant?: ButtonVariant | undefined\n /** Size variant */\n size?: ButtonSize | undefined\n /** Text style for generated label/text content and nested Text defaults. */\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle | undefined\n /** Icon size for nested Icon defaults. */\n iconSize?: number | undefined\n /** Alpha applied while disabled. */\n disabledAlpha?: number | undefined\n}\n\nfunction mergeButtonTheme(\n base: ButtonTheme,\n override: ButtonVariantTheme | undefined\n): ButtonTheme {\n return override\n ? ({\n ...base,\n ...override,\n textStyle:\n base.textStyle || override.textStyle\n ? { ...(base.textStyle ?? {}), ...(override.textStyle ?? {}) }\n : undefined,\n Text:\n base.Text || override.Text\n ? {\n ...(base.Text ?? {}),\n ...(override.Text ?? {}),\n style:\n base.Text?.style || override.Text?.style\n ? { ...(base.Text?.style ?? {}), ...(override.Text?.style ?? {}) }\n : undefined,\n }\n : undefined,\n Icon:\n base.Icon || override.Icon\n ? { ...(base.Icon ?? {}), ...(override.Icon ?? {}) }\n : undefined,\n } as ButtonTheme)\n : base\n}\n\nfunction resolveButtonSlotTheme<TName extends ButtonVariant | ButtonSize>(\n theme: ButtonTheme,\n group: 'variants' | 'sizes',\n name: TName | undefined\n): ButtonVariantTheme | undefined {\n if (!name) return undefined\n\n return {\n ...(theme[group]?.[name as never] ?? {}),\n ...(theme[name] ?? {}),\n } as ButtonVariantTheme\n}\n\nfunction buildButtonContentTheme(theme: ButtonTheme): PartialTheme {\n const textTheme = theme.Text ?? {}\n const iconTheme = theme.Icon ?? {}\n const mergedTextStyle =\n theme.textStyle || textTheme.style\n ? {\n ...(textTheme.style ?? {}),\n ...(theme.textStyle ?? {}),\n }\n : undefined\n\n return {\n Text: mergedTextStyle ? { ...textTheme, style: mergedTextStyle } : textTheme,\n Icon: {\n ...iconTheme,\n ...(theme.iconSize !== undefined ? { size: theme.iconSize } : {}),\n },\n }\n}\n\n/**\n * Generic Button component\n * Provides variant, size, and disabled state support\n * Content is fully customizable via children prop\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" onClick={() => console.log('clicked')}>\n * Click me\n * </Button>\n *\n * <Button variant=\"outline\" size=\"small\">\n * <Icon type=\"check\" />\n * <Text text=\"Confirm\" />\n * </Button>\n * ```\n */\nexport function Button(props: ButtonProps): VNodeLike {\n const {\n children,\n label,\n text,\n onClick,\n disabled = false,\n variant,\n size,\n width,\n height,\n textStyle,\n iconSize,\n disabledAlpha,\n alpha,\n theme,\n onTouch,\n ...restProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Button', mergedLocalTheme, {})\n const ref = useRef<Phaser.GameObjects.Container | null>(null)\n\n // Setup effect system\n const { applyEffect } = useGameObjectEffect(ref)\n\n const themedButton = themed as unknown as ButtonTheme\n\n // Merge base theme with variant and size overrides\n const resolvedVariant = variant ?? themedButton.variant ?? 'primary'\n const resolvedSize = size ?? themedButton.size ?? 'medium'\n const variantTheme = mergeButtonTheme(\n { ...themedButton },\n resolveButtonSlotTheme(themedButton, 'variants', resolvedVariant)\n )\n const sizeTheme = mergeButtonTheme(\n variantTheme,\n resolveButtonSlotTheme(themedButton, 'sizes', resolvedSize)\n )\n\n const resolvedTextStyle =\n sizeTheme.textStyle || textStyle\n ? { ...(sizeTheme.textStyle ?? {}), ...(textStyle ?? {}) }\n : undefined\n const resolvedIconSize = iconSize ?? sizeTheme.iconSize\n const resolvedDisabledAlpha = disabledAlpha ?? sizeTheme.disabledAlpha ?? 0.5\n const resolvedDisabledTextColor =\n sizeTheme.disabledTextColor ?? themedButton.disabledTextColor ?? resolvedTextStyle?.color\n const resolvedDisabledIconTint =\n sizeTheme.disabledIconTint ?? themedButton.disabledIconTint ?? sizeTheme.Icon?.tint\n const effectiveTextStyle =\n disabled && resolvedDisabledTextColor\n ? { ...(resolvedTextStyle ?? {}), color: resolvedDisabledTextColor }\n : resolvedTextStyle\n const contentStyleProps: Partial<ButtonTheme> = {\n ...(effectiveTextStyle ? { textStyle: effectiveTextStyle } : {}),\n ...(resolvedIconSize !== undefined ? { iconSize: resolvedIconSize } : {}),\n ...(disabled && resolvedDisabledIconTint !== undefined\n ? { Icon: { ...(sizeTheme.Icon ?? {}), tint: resolvedDisabledIconTint } }\n : {}),\n }\n\n // Apply disabled state styling\n const effectiveTheme = disabled\n ? {\n ...sizeTheme,\n backgroundColor:\n sizeTheme.disabledColor ?? themedButton.disabledColor ?? sizeTheme.backgroundColor,\n backgroundAlpha: resolvedDisabledAlpha,\n ...(alpha !== undefined ? { alpha } : {}),\n ...contentStyleProps,\n }\n : {\n ...sizeTheme,\n ...(alpha !== undefined ? { alpha } : {}),\n ...contentStyleProps,\n }\n\n const handleTouch: ViewProps['onTouch'] | undefined = !disabled\n ? (event) => {\n // Apply effect: props override theme, theme overrides default\n const resolved = resolveEffect(props, effectiveTheme)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n onTouch?.(event)\n onClick?.()\n }\n : undefined\n\n const generatedText = label ?? text\n const content =\n children ??\n (generatedText !== undefined ? (\n <Text\n text={`${generatedText}`}\n {...(effectiveTextStyle ? { style: effectiveTextStyle } : {})}\n />\n ) : null)\n\n const contentTheme = mergeThemes(nestedTheme, buildButtonContentTheme(effectiveTheme))\n\n // Filter out non-View props from theme\n const {\n disabledColor: _disabledColor,\n disabledTextColor: _disabledTextColor,\n disabledIconTint: _disabledIconTint,\n disabledAlpha: _disabledAlpha,\n effect: _effect,\n effectConfig: _effectConfig,\n textStyle: _textStyle,\n iconSize: _iconSize,\n variant: _variant,\n size: _size,\n variants: _variants,\n sizes: _sizes,\n primary: _primary,\n secondary: _secondary,\n outline: _outline,\n ghost: _ghost,\n danger: _danger,\n small: _small,\n medium: _medium,\n large: _large,\n Text: _Text,\n Icon: _Icon,\n ...viewThemeProps\n } = effectiveTheme\n\n return (\n <View\n ref={ref}\n enableGestures={!disabled}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n {...viewThemeProps}\n width={width ?? effectiveTheme.width}\n height={height ?? effectiveTheme.height}\n {...restProps}\n {...(handleTouch && { onTouch: handleTouch })}\n theme={contentTheme}\n >\n {content}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Checkbox component - binary or tristate selection control.\n */\nimport type * as Phaser from 'phaser'\nimport { useEffect, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, Text, View } from '../index'\n\nexport type CheckboxState = boolean | 'indeterminate'\nexport type CheckboxLabelPosition = 'left' | 'right' | 'none'\n\nexport interface CheckboxIndicatorRenderProps {\n checked: CheckboxState\n disabled: boolean\n size: number\n color: number\n checkedColor: number\n indeterminateColor: number\n}\n\nexport interface CheckboxProps {\n /** Unique key for VDOM identification */\n key?: string | number | undefined\n /** Label text rendered next to the indicator */\n label?: string\n /** Controlled checked state */\n checked?: CheckboxState\n /** Initial state for uncontrolled checkboxes */\n defaultChecked?: CheckboxState\n /** Enables unchecked -> checked -> indeterminate cycling */\n tristate?: boolean\n /** Disabled state */\n disabled?: boolean\n /** Label position relative to the indicator */\n labelPosition?: CheckboxLabelPosition\n /** Optional custom indicator content */\n indicator?: ChildrenType\n /** Render function for custom indicators */\n renderIndicator?: (props: CheckboxIndicatorRenderProps) => ChildrenType\n /** Optional theme overrides */\n theme?: PartialTheme\n /** Callback when checked state changes */\n onChange?: (checked: CheckboxState) => void\n}\n\nexport function getNextCheckedState(checked: CheckboxState, tristate: boolean): CheckboxState {\n if (!tristate) return checked === true ? false : true\n if (checked === false) return true\n if (checked === true) return 'indeterminate'\n return false\n}\n\nexport function normalizeCheckedState(checked: CheckboxState, tristate: boolean): CheckboxState {\n return checked === 'indeterminate' && !tristate ? false : checked\n}\n\nfunction drawDefaultIndicator(\n graphics: Phaser.GameObjects.Graphics,\n indicatorProps: CheckboxIndicatorRenderProps\n): void {\n const { checked, disabled, size, color, checkedColor, indeterminateColor } = indicatorProps\n const borderWidth = Math.max(2, Math.round(size * 0.1))\n const inset = Math.max(4, Math.round(size * 0.22))\n const radius = Math.max(2, Math.round(size * 0.15))\n const alpha = disabled ? 0.45 : 1\n\n graphics.clear()\n graphics.lineStyle(borderWidth, checked === false ? color : checkedColor, alpha)\n graphics.strokeRoundedRect(\n borderWidth / 2,\n borderWidth / 2,\n size - borderWidth,\n size - borderWidth,\n radius\n )\n\n if (checked === true) {\n graphics.lineStyle(borderWidth + 1, checkedColor, alpha)\n graphics.beginPath()\n graphics.moveTo(inset, size * 0.52)\n graphics.lineTo(size * 0.43, size - inset)\n graphics.lineTo(size - inset, inset)\n graphics.strokePath()\n }\n\n if (checked === 'indeterminate') {\n graphics.lineStyle(borderWidth + 1, indeterminateColor, alpha)\n graphics.beginPath()\n graphics.moveTo(inset, size / 2)\n graphics.lineTo(size - inset, size / 2)\n graphics.strokePath()\n }\n}\n\nexport function Checkbox(props: CheckboxProps): VNodeLike {\n const localTheme = useTheme()\n const mergedLocalTheme = props.theme ? mergeThemes(localTheme ?? {}, props.theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Checkbox', mergedLocalTheme, {})\n const size = themed.size ?? 20\n const gap = themed.gap ?? 8\n const labelPosition = props.labelPosition ?? themed.labelPosition ?? 'right'\n const disabled = props.disabled ?? false\n const disabledAlpha = themed.disabledAlpha ?? 0.5\n const tristate = props.tristate ?? false\n const initialChecked = normalizeCheckedState(\n props.checked ?? props.defaultChecked ?? false,\n tristate\n )\n const [checked, setChecked] = useState<CheckboxState>(initialChecked)\n\n useEffect(() => {\n if (props.checked !== undefined) {\n setChecked(normalizeCheckedState(props.checked, tristate))\n }\n }, [props.checked, tristate])\n\n const indicatorProps: CheckboxIndicatorRenderProps = {\n checked,\n disabled,\n size,\n color: themed.color ?? 0x777777,\n checkedColor: themed.checkedColor ?? 0x4caf50,\n indeterminateColor: themed.indeterminateColor ?? themed.checkedColor ?? 0x4caf50,\n }\n\n const handleToggle = () => {\n if (disabled) return\n\n const nextChecked = getNextCheckedState(checked, tristate)\n if (props.checked === undefined) setChecked(nextChecked)\n props.onChange?.(nextChecked)\n }\n\n const indicator = props.indicator ?? props.renderIndicator?.(indicatorProps) ?? (\n <Graphics\n width={size}\n height={size}\n headless={false}\n dependencies={[\n indicatorProps.checked,\n indicatorProps.disabled,\n indicatorProps.size,\n indicatorProps.color,\n indicatorProps.checkedColor,\n indicatorProps.indeterminateColor,\n ]}\n onDraw={(graphics) => drawDefaultIndicator(graphics, indicatorProps)}\n />\n )\n\n const label =\n props.label && labelPosition !== 'none' ? (\n <Text text={props.label} style={themed.labelStyle} alpha={disabled ? disabledAlpha : 1} />\n ) : null\n\n return (\n <View\n key={props.key}\n direction=\"row\"\n alignItems=\"center\"\n enableGestures={!disabled}\n onTouch={handleToggle}\n theme={nestedTheme}\n gap={gap}\n alpha={disabled ? disabledAlpha : 1}\n >\n {labelPosition === 'left' && label}\n {indicator}\n {labelPosition !== 'left' && label}\n </View>\n )\n}\n","/**\n * Color mode management for dynamic theme switching\n */\nimport { useEffect, useState } from '../hooks'\nimport { themeRegistry } from '../theme'\n\n/**\n * Hook to manage color mode (light/dark) dynamically\n * @returns Object with current mode, toggle function, and setter\n * @example\n * ```typescript\n * function ThemeToggle() {\n * const { colorMode, toggleColorMode } = useColorMode()\n *\n * return (\n * <Button onClick={toggleColorMode}>\n * {colorMode === 'light' ? 'Dark' : 'Light'} Mode\n * </Button>\n * )\n * }\n * ```\n */\nexport function useColorMode(): {\n colorMode: 'light' | 'dark'\n setColorMode: (mode: 'light' | 'dark') => void\n toggleColorMode: () => void\n} {\n const [colorMode, setColorModeState] = useState<'light' | 'dark'>(themeRegistry.getColorMode())\n\n useEffect(() => {\n // Subscribe to theme registry changes\n const unsubscribe = themeRegistry.subscribe(() => {\n setColorModeState(themeRegistry.getColorMode())\n })\n\n return unsubscribe\n }, [])\n\n const setColorMode = (mode: 'light' | 'dark') => {\n themeRegistry.setColorMode(mode)\n }\n\n const toggleColorMode = () => {\n const newMode = colorMode === 'light' ? 'dark' : 'light'\n setColorMode(newMode)\n }\n\n return {\n colorMode,\n setColorMode,\n toggleColorMode,\n }\n}\n","/**\n * Color system hooks for component usage\n */\nimport { useEffect, useRef, useState, useTheme } from '../hooks'\nimport { themeRegistry } from '../theme'\nimport { getPresetWithMode } from './color-presets'\nimport type { ColorTokens } from './color-types'\n\n/**\n * Hook to access color tokens from theme context\n * Automatically updates when color mode or preset changes\n * @returns Current ColorTokens or undefined\n * @deprecated Use `useThemeTokens()` instead for access to colors, text styles, spacing, and more\n * @example\n * ```typescript\n * // Old way (deprecated):\n * const colors = useColors()\n *\n * // New way:\n * const tokens = useThemeTokens()\n * const colors = tokens?.colors\n * ```\n */\nexport function useColors(): ColorTokens | undefined {\n const localTheme = useTheme()\n\n // Track latest localTheme via ref to avoid re-subscribing on every render\n const localThemeRef = useRef(localTheme)\n localThemeRef.current = localTheme\n\n const [colors, setColors] = useState<ColorTokens | undefined>(\n localTheme?.__colorPreset\n ? getPresetWithMode(\n localTheme.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n localTheme.__colorPreset.mode ?? 'light'\n ).colors\n : themeRegistry.getColorTokens()\n )\n\n useEffect(() => {\n const unsubscribe = themeRegistry.subscribe(() => {\n const current = localThemeRef.current\n if (current?.__colorPreset) {\n const currentMode = themeRegistry.getColorMode()\n const preset = getPresetWithMode(\n current.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n currentMode\n )\n setColors(preset.colors)\n } else {\n setColors(themeRegistry.getColorTokens())\n }\n })\n return unsubscribe\n }, []) // Subscribe once, read latest theme via ref\n\n return colors\n}\n\n/**\n * Hook to subscribe to theme changes without accessing colors\n * Use this in parent components that don't need colors themselves\n * but want to ensure children re-render when theme changes\n *\n * Note: Since useColors() now triggers re-renders automatically,\n * this hook is mainly useful if you don't need the colors themselves\n * but still want to react to theme changes.\n *\n * @example\n * ```typescript\n * function ParentComponent() {\n * useThemeSubscription() // Children will re-render on theme changes\n * return <ChildThatUsesColors />\n * }\n * ```\n */\nexport function useThemeSubscription(): void {\n const [, forceUpdate] = useState(0)\n\n useEffect(() => {\n const unsubscribe = themeRegistry.subscribe(() => {\n forceUpdate((n) => n + 1)\n })\n return unsubscribe\n }, [])\n}\n","/**\n * Helper functions for color system integration with theme\n */\nimport type { ColorTokens } from './color-types'\nimport { alpha } from './color-utils'\n\n/**\n * Convert ColorTokens to a theme-compatible object\n * Maps semantic color names to Phaser number format for View/Button components\n * @param colors - ColorTokens to convert\n * @returns Object with backgroundColor, borderColor, etc.\n * @example\n * ```typescript\n * const colors = getPreset('oceanBlue').colors\n * const buttonTheme = {\n * ...colorsToTheme(colors, 'primary'),\n * padding: 8,\n * }\n * // Returns: { backgroundColor: 0x2196f3, borderColor: 0x... }\n * ```\n */\nexport function colorsToTheme(\n colors: ColorTokens,\n colorKey: keyof Pick<\n ColorTokens,\n 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info'\n >,\n options: {\n /** Which shade to use for background (default: 'DEFAULT') */\n backgroundShade?: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT'\n /** Which shade to use for border (default: 'dark') */\n borderShade?: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT'\n /** Include border color (default: true) */\n includeBorder?: boolean\n } = {}\n): {\n backgroundColor: number\n borderColor?: number\n} {\n const { backgroundShade = 'DEFAULT', borderShade = 'dark', includeBorder = true } = options\n\n const result: { backgroundColor: number; borderColor?: number } = {\n backgroundColor: colors[colorKey][backgroundShade].toNumber(),\n }\n\n if (includeBorder) {\n result.borderColor = colors[colorKey][borderShade].toNumber()\n }\n\n return result\n}\n\n/**\n * Get text color from ColorTokens as hex string for Phaser Text style\n * @param colors - ColorTokens to use\n * @param shade - Which text shade to use (default: 'DEFAULT')\n * @param alphaValue - Optional alpha value (0-1)\n * @returns Hex string or rgba string for Text style\n * @example\n * ```typescript\n * const colors = getPreset('oceanBlue').colors\n * const textStyle = {\n * color: getTextColor(colors),\n * fontSize: '18px'\n * }\n * ```\n */\nexport function getTextColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT',\n alphaValue?: number\n): string {\n const color = colors.text[shade]\n return alphaValue !== undefined ? alpha(color.toNumber(), alphaValue) : color.toString()\n}\n\n/**\n * Get background color from ColorTokens\n * @param colors - ColorTokens to use\n * @param shade - Which shade to use (default: 'DEFAULT')\n * @returns Phaser color number\n */\nexport function getBackgroundColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT'\n): number {\n return colors.background[shade].toNumber()\n}\n\n/**\n * Get surface color from ColorTokens\n * @param colors - ColorTokens to use\n * @param shade - Which shade to use (default: 'DEFAULT')\n * @returns Phaser color number\n */\nexport function getSurfaceColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT'\n): number {\n return colors.surface[shade].toNumber()\n}\n\n/**\n * Get border color from ColorTokens\n * @param colors - ColorTokens to use\n * @param shade - Which shade to use (default: 'DEFAULT')\n * @returns Phaser color number\n */\nexport function getBorderColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT'\n): number {\n return colors.border[shade].toNumber()\n}\n","/**\n * Dynamic color preset management\n */\nimport { themeRegistry } from '../theme'\nimport { createDefaultTheme } from '../theme-defaults'\nimport { remountAll } from '../vdom'\nimport type { PresetName } from './color-presets'\nimport { getPresetWithMode } from './color-presets'\n\n/**\n * Set the active color preset globally\n * Applies the preset with the current color mode and updates all components\n * Triggers complete remount of all active mountJSX instances\n * @param presetName - Name of the preset to apply\n * @param colorMode - Optional color mode to apply together with the preset\n * @example\n * ```typescript\n * // Switch to forest green theme\n * setColorPreset('forestGreen')\n *\n * // Apply preset and force dark mode in one go\n * setColorPreset('midnight', 'dark')\n *\n * // Current mode (light/dark) is preserved\n * ```\n */\nexport function setColorPreset(presetName: PresetName, colorMode?: 'light' | 'dark'): void {\n const targetMode = colorMode ?? themeRegistry.getColorMode()\n const preset = getPresetWithMode(presetName, targetMode)\n\n // Update color tokens WITHOUT notifying listeners\n // We skip listener notifications to prevent unnecessary re-renders\n themeRegistry.setColorTokens(preset.colors)\n themeRegistry.setGlobalTheme(createDefaultTheme(presetName, targetMode))\n themeRegistry.setCurrentPresetName(presetName, true) // true = skip notify\n\n // If caller asked for a specific mode different from current\n if (colorMode && themeRegistry.getColorMode() !== colorMode) {\n themeRegistry.setColorMode(colorMode)\n // setColorMode already schedules remountAll internally\n } else {\n // Trigger complete remount of all VDOM trees to apply new preset\n setTimeout(() => {\n remountAll()\n }, 0)\n }\n}\n\n/**\n * Get the currently active preset name\n * @returns Current preset name or undefined\n */\nexport function getCurrentPreset(): string | undefined {\n return themeRegistry.getCurrentPresetName()\n}\n\n/**\n * Set the active color mode globally (without changing the preset)\n * @param mode - Color mode to apply\n */\nexport function setColorMode(mode: 'light' | 'dark'): void {\n themeRegistry.setColorMode(mode)\n}\n\n/**\n * Get all available preset names\n * @returns Array of preset names\n * @example\n * ```typescript\n * const presets = getAvailablePresets() // ['oceanBlue', 'forestGreen', 'midnight']\n * ```\n */\nexport function getAvailablePresets(): PresetName[] {\n return ['oceanBlue', 'forestGreen', 'midnight']\n}\n","/** @jsxImportSource ../.. */\n/**\n * RefOriginView - ref-based component for imperative transforms with custom origin point\n *\n * Returns a ref to the pivot container, enabling imperative manipulation\n * (e.g., Phaser tweens) with correct origin point. Uses nested Views to\n * calculate and maintain the pivot point based on actual rendered dimensions.\n *\n * Use TransformOriginView instead for declarative/reactive transforms via props.\n *\n * @example\n * const ref = useRef<Phaser.GameObjects.Container>(null)\n * useEffect(() => {\n * ref.current?.scene.tweens.add({ targets: ref.current, rotation: Math.PI * 2 })\n * }, [])\n * <RefOriginView ref={ref} originX={0.5} originY={0.5} width={200} height={100}>\n * <Text>Rotates around center</Text>\n * </RefOriginView>\n */\nimport type { ChildrenType } from '@number10/phaserjsx/types'\nimport type * as Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport { useRef, useState } from '../../hooks'\nimport { getRenderContext } from '../../render-context'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\n\n/**\n * Extended ViewProps with origin support\n */\nexport interface RefOriginViewProps extends Omit<ViewProps, 'x' | 'y' | 'children'> {\n /**\n * Origin X for rotation and scale (0 = left, 0.5 = center, 1 = right)\n * @default 0.5\n */\n originX?: number\n /**\n * Origin Y for rotation and scale (0 = top, 0.5 = center, 1 = bottom)\n * @default 0.5\n */\n originY?: number\n /**\n * X position of the view\n */\n x?: number\n /**\n * Y position of the view\n */\n y?: number\n /**\n * Children nodes.\n */\n children?: ChildrenType\n}\n\n/**\n * RefOriginView component - ref-based transforms around custom origin point\n *\n * Returns ref to middle View positioned at the origin point, enabling\n * imperative transformations. Calculates actual dimensions after layout.\n *\n * Uses nested View structure internally:\n * - Outer View: Defines bounding box and position\n * - Middle View: Positioned at origin point, receives ref (transform target)\n * - Inner View: Contains actual content, offset by negative padding\n *\n * @param props - RefOriginView props\n * @returns JSX element\n */\nexport function RefOriginView({\n originX = 0.5,\n originY = 0.5,\n x = 0,\n y = 0,\n width,\n height,\n ref,\n padding,\n children,\n ...viewProps\n}: RefOriginViewProps): VNodeLike {\n // Ref to outer View to get computed dimensions after layout\n const outerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const [numericDimension, setNumericWidth] = useState<{ x: number; y: number }>({ x: 0, y: 0 })\n\n /**\n * Handler for outer View - calculates and updates pivot position based on actual size\n */\n const handleOuterRef = (container: Phaser.GameObjects.Container | null) => {\n if (!container) return\n outerRef.current = container\n\n getRenderContext(container.scene).deferLayout(() => {\n // Use layout dimensions or fallback to getBounds\n const width = container.width\n const height = container.height\n const actualWidth = Number.isNaN(width) ? 0 : width\n const actualHeight = Number.isNaN(height) ? 0 : height\n if (actualHeight !== numericDimension.y || actualWidth !== numericDimension.x)\n setNumericWidth({ x: actualWidth, y: actualHeight })\n })\n }\n\n // Calculate pivot point position (relative to outer View)\n const pivotX = numericDimension.x * originX\n const pivotY = numericDimension.y * originY\n\n // Calculate offset for inner content (to center it around pivot)\n const offsetX = -numericDimension.x * originX\n const offsetY = -numericDimension.y * originY\n\n return (\n <View\n ref={handleOuterRef}\n direction=\"stack\"\n width={width}\n height={height}\n x={x}\n y={y}\n padding={padding}\n >\n {/* Middle View: Positioned at origin point, receives ref for rotation */}\n <View\n ref={ref as ((instance: Phaser.GameObjects.Container | null) => void) | undefined}\n x={pivotX}\n y={pivotY}\n width={0}\n height={0}\n padding={{ left: offsetX, top: offsetY }}\n margin={0}\n direction=\"stack\"\n backgroundColor={0xff88ff}\n >\n {/* Inner View: Contains actual content with all original props */}\n <View width={width} height={height} {...viewProps} direction=\"stack\" padding={0} margin={0}>\n {children}\n </View>\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Slider/Range component\n * Provides interactive value selection with horizontal/vertical orientation\n */\nimport type * as Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport type { GestureEventData } from '../../core-props'\nimport { applyEffectByName, useGameObjectEffect, type EffectDefinition } from '../../effects'\nimport { useEffect, useMemo, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, Text, View } from '../index'\nimport { RefOriginView } from './RefOriginView'\n\n/**\n * Slider mark/tick definition\n */\nexport interface SliderMark {\n /** Value at this mark */\n value: number\n /** Optional label to display */\n label?: VNodeLike\n /** Custom style for this mark */\n style?: {\n color?: number\n height?: number\n width?: number\n }\n}\n\n/**\n * Props for Slider component\n */\nexport interface SliderProps extends Omit<ViewProps, 'children'>, EffectDefinition {\n /** Current value (controlled) */\n value?: number\n\n /** Default value (uncontrolled) */\n defaultValue?: number\n\n /** Minimum value */\n min?: number\n\n /** Maximum value */\n max?: number\n\n /** Step increment (default: 1) */\n step?: number\n\n /** Orientation */\n orientation?: 'horizontal' | 'vertical'\n\n /** Reverse direction (right-to-left or bottom-to-top) */\n reverse?: boolean\n\n /** Disabled state */\n disabled?: boolean\n\n /** Show value label on thumb */\n showValue?: boolean\n\n /** Value label offset (x, y) relative to thumb - overrides theme */\n valueLabelOffset?: { x?: number; y?: number }\n\n /** Custom value formatter for label */\n formatValue?: (value: number) => string\n\n /** Marks/ticks to display */\n marks?: SliderMark[] | boolean\n\n /** Snap to marks/steps */\n snap?: boolean\n\n /** Track length (overrides theme default) */\n trackLength?: number\n\n /** Custom thumb renderer */\n renderThumb?: (value: number, isDragging: boolean) => ChildrenType\n\n /** Custom track renderer */\n renderTrack?: (fillPercentage: number) => ChildrenType\n\n /** Callback when value changes */\n onChange?: (value: number) => void\n\n /** Callback when dragging starts */\n onChangeStart?: (value: number) => void\n\n /** Callback when dragging ends */\n onChangeEnd?: (value: number) => void\n}\n\n/**\n * Props for RangeSlider component\n */\nexport interface RangeSliderProps extends Omit<ViewProps, 'children'>, EffectDefinition {\n /** Current value range (controlled) */\n value?: [number, number]\n\n /** Default value range (uncontrolled) */\n defaultValue?: [number, number]\n\n /** Minimum value */\n min?: number\n\n /** Maximum value */\n max?: number\n\n /** Step increment (default: 1) */\n step?: number\n\n /** Orientation */\n orientation?: 'horizontal' | 'vertical'\n\n /** Reverse direction (right-to-left or bottom-to-top) */\n reverse?: boolean\n\n /** Disabled state */\n disabled?: boolean\n\n /** Show value labels on thumbs */\n showValue?: boolean\n\n /** Value label offset for first thumb (x, y) - overrides theme */\n valueLabelOffset1?: { x?: number; y?: number }\n\n /** Value label offset for second thumb (x, y) - overrides theme */\n valueLabelOffset2?: { x?: number; y?: number }\n\n /** Custom value formatter for labels */\n formatValue?: (value: number) => string\n\n /** Marks/ticks to display */\n marks?: SliderMark[] | boolean\n\n /** Snap to marks/steps */\n snap?: boolean\n\n /** Track length (overrides theme default) */\n trackLength?: number\n\n /** Minimum distance between thumbs */\n minDistance?: number\n\n /** Custom thumb renderer */\n renderThumb?: (value: number, isDragging: boolean, thumbIndex?: number) => ChildrenType\n\n /** Custom track renderer */\n renderTrack?: (startPercentage: number, endPercentage?: number) => ChildrenType\n\n /** Callback when value changes */\n onChange?: (value: [number, number]) => void\n\n /** Callback when dragging starts */\n onChangeStart?: (value: [number, number]) => void\n\n /** Callback when dragging ends */\n onChangeEnd?: (value: [number, number]) => void\n}\n\n/**\n * Internal props for BaseSlider\n */\ninterface BaseSliderProps extends Omit<ViewProps, 'children'>, EffectDefinition {\n mode: 'single' | 'range'\n value?: number | [number, number]\n defaultValue?: number | [number, number]\n min?: number\n max?: number\n step?: number\n orientation?: 'horizontal' | 'vertical'\n reverse?: boolean\n disabled?: boolean\n showValue?: boolean\n valueLabelOffset?: { x?: number; y?: number }\n valueLabelOffset1?: { x?: number; y?: number }\n valueLabelOffset2?: { x?: number; y?: number }\n formatValue?: (value: number) => string\n marks?: SliderMark[] | boolean\n snap?: boolean\n trackLength?: number\n minDistance?: number\n renderThumb?: (value: number, isDragging: boolean, thumbIndex?: number) => ChildrenType\n renderTrack?: (startOrFillPercentage: number, endPercentage?: number) => ChildrenType\n onChange?: ((value: number) => void) | ((value: [number, number]) => void)\n onChangeStart?: ((value: number) => void) | ((value: [number, number]) => void)\n onChangeEnd?: ((value: number) => void) | ((value: [number, number]) => void)\n}\n\n/**\n * Default thumb component - circular shape with border\n * @param props - Thumb properties\n * @returns JSX element\n */\nfunction DefaultThumb(props: {\n size: number\n color: number\n borderColor?: number\n borderWidth?: number\n isDragging: boolean\n dragScale?: number\n}) {\n const { size, color, borderColor, borderWidth = 0, isDragging, dragScale = 1.1 } = props\n const scale = isDragging ? dragScale : 1.0\n\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n\n // Border\n if (borderWidth > 0 && borderColor !== undefined) {\n g.fillStyle(borderColor, 1)\n g.fillCircle(0, 0, size / 2)\n }\n\n // Fill\n g.fillStyle(color, 1)\n g.fillCircle(0, 0, (size - borderWidth * 2) / 2)\n }}\n scale={scale}\n />\n )\n}\n\n/**\n * Base slider implementation - shared between Slider and RangeSlider\n * @param props - Base slider properties\n * @returns Slider JSX element\n */\nfunction BaseSlider(props: BaseSliderProps) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Slider', localTheme, {})\n\n const mode = props.mode\n const isRange = mode === 'range'\n\n // State management - controlled vs uncontrolled\n const defaultSingleValue = (props.defaultValue as number | undefined) ?? props.min ?? 0\n const defaultRangeValue: [number, number] = (props.defaultValue as\n | [number, number]\n | undefined) ?? [props.min ?? 0, props.max ?? 100]\n\n const [internalValue, setInternalValue] = useState<number | [number, number]>(\n isRange ? defaultRangeValue : defaultSingleValue\n )\n\n const isControlled = props.value !== undefined\n const value = isControlled ? props.value : internalValue\n\n const min = props.min ?? 0\n const max = props.max ?? 100\n\n // Extract values for single/range mode\n const singleValue = !isRange ? (value as number) : 0\n const rangeValue: [number, number] = isRange ? (value as [number, number]) : [min, max]\n const step = props.step ?? 1\n const orientation = props.orientation ?? 'horizontal'\n const reverse = props.reverse ?? false\n const disabled = props.disabled ?? false\n const snap = props.snap ?? true\n const minDistance = props.minDistance ?? step\n\n const trackLength = props.trackLength ?? themed.trackLength ?? 200\n const trackHeight = themed.trackHeight ?? 6\n const thumbSize = themed.thumbSize ?? 20\n\n const trackRef = useRef<Phaser.GameObjects.Container | null>(null)\n const thumb1Ref = useRef<Phaser.GameObjects.Container | null>(null)\n const thumb2Ref = useRef<Phaser.GameObjects.Container | null>(null)\n const [isDragging1, setIsDragging1] = useState(false)\n const [isDragging2, setIsDragging2] = useState(false)\n const virtualPos1Ref = useRef(0)\n const virtualPos2Ref = useRef(0)\n\n const { applyEffect: applyEffect1 } = useGameObjectEffect(thumb1Ref)\n const { applyEffect: applyEffect2 } = useGameObjectEffect(thumb2Ref)\n\n // Clamp value to valid range\n const clampValue = (val: number): number => {\n return Math.max(min, Math.min(max, val))\n }\n\n // Snap value to step\n const snapToStep = (val: number): number => {\n const steps = Math.round((val - min) / step)\n return min + steps * step\n }\n\n // Value to percentage (0-1)\n const valueToPercentage = (val: number): number => {\n if (max === min) return 0\n return (val - min) / (max - min)\n }\n\n // Position (pixels) to value - respects reverse\n const positionToValue = (pos: number, length: number): number => {\n const actualPos = reverse ? length - pos : pos\n const percentage = Math.max(0, Math.min(1, actualPos / length))\n return min + percentage * (max - min)\n }\n\n // Value to position (pixels) - respects reverse\n const valueToPosition = (val: number): number => {\n const percentage = valueToPercentage(val)\n const pos = percentage * trackLength\n return reverse ? trackLength - pos : pos\n }\n\n // Calculate thumb positions from values\n const thumb1Value = (isRange ? rangeValue[0] : singleValue) ?? 0\n const thumb2Value = (isRange ? rangeValue[1] : 0) ?? 0\n\n const thumb1PositionFromValue = valueToPosition(thumb1Value)\n const thumb2PositionFromValue = isRange ? valueToPosition(thumb2Value) : 0\n\n // During drag, calculate position directly from delta\n const [currentDragPos1, setCurrentDragPos1] = useState(thumb1PositionFromValue)\n const [currentDragPos2, setCurrentDragPos2] = useState(thumb2PositionFromValue)\n\n // Sync drag positions with values when not dragging (controlled component support)\n useEffect(() => {\n if (!isDragging1) {\n setCurrentDragPos1(thumb1PositionFromValue)\n }\n }, [thumb1PositionFromValue, isDragging1])\n\n useEffect(() => {\n if (!isDragging2 && isRange) {\n setCurrentDragPos2(thumb2PositionFromValue)\n }\n }, [thumb2PositionFromValue, isRange, isDragging2])\n\n // Generate marks if marks={true}\n const marksArray = useMemo<SliderMark[]>(() => {\n if (!props.marks) return []\n if (Array.isArray(props.marks)) return props.marks\n\n // Auto-generate marks\n const marks: SliderMark[] = []\n for (let val = min; val <= max; val += step) {\n marks.push({ value: val })\n }\n return marks\n }, [props.marks, min, max, step])\n\n // Handle track touch/click - jump to position\n const handleTrackTouch = (data: GestureEventData) => {\n if (disabled) return\n data.stopPropagation()\n\n const localPos = orientation === 'horizontal' ? (data.localX ?? 0) : (data.localY ?? 0)\n const newValue = positionToValue(localPos, trackLength)\n const snappedValue = snap ? snapToStep(newValue) : newValue\n const clampedValue = clampValue(snappedValue)\n\n if (isRange) {\n // Find closest thumb\n const dist1 = Math.abs(clampedValue - rangeValue[0])\n const dist2 = Math.abs(clampedValue - rangeValue[1])\n const useThumb1 = dist1 <= dist2\n\n const newRangeValue: [number, number] = useThumb1\n ? [clampedValue, rangeValue[1]]\n : [rangeValue[0], clampedValue]\n\n // Enforce min distance\n if (newRangeValue[1] - newRangeValue[0] < minDistance) {\n return\n }\n\n if (!isControlled) {\n setInternalValue(newRangeValue)\n }\n ;(props.onChange as ((v: [number, number]) => void) | undefined)?.(newRangeValue)\n } else {\n if (!isControlled) {\n setInternalValue(clampedValue)\n }\n ;(props.onChange as ((v: number) => void) | undefined)?.(clampedValue)\n }\n }\n\n // Handle thumb drag\n const handleThumbDrag = (thumbIndex: number) => (data: GestureEventData) => {\n if (disabled) return\n data.stopPropagation()\n\n const isThumb1 = thumbIndex === 0\n const isDragging = isThumb1 ? isDragging1 : isDragging2\n const setIsDragging = isThumb1 ? setIsDragging1 : setIsDragging2\n const virtualPosRef = isThumb1 ? virtualPos1Ref : virtualPos2Ref\n const setCurrentDragPos = isThumb1 ? setCurrentDragPos1 : setCurrentDragPos2\n const currentThumbPos = isThumb1 ? currentDragPos1 : currentDragPos2\n const applyEffect = isThumb1 ? applyEffect1 : applyEffect2\n\n if (data.state === 'start') {\n setIsDragging(true)\n virtualPosRef.current = currentThumbPos\n\n if (isRange) {\n ;(props.onChangeStart as ((v: [number, number]) => void) | undefined)?.(rangeValue)\n } else {\n ;(props.onChangeStart as ((v: number) => void) | undefined)?.(singleValue)\n }\n return\n }\n\n if (data.state === 'end') {\n setIsDragging(false)\n\n if (isRange) {\n ;(props.onChangeEnd as ((v: [number, number]) => void) | undefined)?.(rangeValue)\n } else {\n ;(props.onChangeEnd as ((v: number) => void) | undefined)?.(singleValue)\n }\n\n applyEffectByName(applyEffect, 'none')\n return\n }\n\n if (!isDragging) return\n\n // Use frame-to-frame delta\n const delta = orientation === 'horizontal' ? (data.dx ?? 0) : (data.dy ?? 0)\n\n // Update virtual position (can exceed bounds)\n virtualPosRef.current += delta\n\n // Clamp visual position to track bounds\n const newPos = Math.max(0, Math.min(trackLength, virtualPosRef.current))\n\n // Calculate and update value\n let newValue = positionToValue(newPos, trackLength)\n newValue = snap ? snapToStep(newValue) : newValue\n\n if (isRange) {\n let newRangeValue: [number, number] = isThumb1\n ? [newValue, rangeValue[1]]\n : [rangeValue[0], newValue]\n\n // Enforce bounds and min distance\n if (isThumb1) {\n newRangeValue[0] = clampValue(newRangeValue[0])\n if (newRangeValue[1] - newRangeValue[0] < minDistance) {\n newRangeValue[0] = newRangeValue[1] - minDistance\n }\n newRangeValue[0] = clampValue(newRangeValue[0])\n } else {\n newRangeValue[1] = clampValue(newRangeValue[1])\n if (newRangeValue[1] - newRangeValue[0] < minDistance) {\n newRangeValue[1] = newRangeValue[0] + minDistance\n }\n newRangeValue[1] = clampValue(newRangeValue[1])\n }\n\n // Update position to reflect clamped value\n const clampedPos = valueToPosition(isThumb1 ? newRangeValue[0] : newRangeValue[1])\n setCurrentDragPos(snap ? clampedPos : newPos)\n\n if (!isControlled) {\n setInternalValue(newRangeValue)\n }\n ;(props.onChange as ((v: [number, number]) => void) | undefined)?.(newRangeValue)\n } else {\n const clampedValue = clampValue(newValue)\n const snappedPos = valueToPosition(clampedValue)\n setCurrentDragPos(snap ? snappedPos : newPos)\n\n if (!isControlled) {\n setInternalValue(clampedValue)\n }\n ;(props.onChange as ((v: number) => void) | undefined)?.(clampedValue)\n }\n }\n\n const formatValue = props.formatValue ?? ((v: number) => v.toString())\n\n const isHorizontal = orientation === 'horizontal'\n\n const finalAlpha = disabled ? (themed.disabledAlpha ?? 0.4) : (props.alpha ?? 1)\n\n // Calculate value label offsets with smart defaults for RangeSlider\n // Labels are centered (origin 0.5, 0.5), so offset is from thumb center\n const defaultThemeOffset = themed.valueLabel?.offset ?? 8\n const labelGap = thumbSize + 8 // Gap from thumb edge + small padding\n\n // For single slider: label follows reverse direction (left if reversed, right if normal)\n // For range slider: labels on opposite sides (flipped if reversed)\n const labelOffset1 = {\n x:\n props.valueLabelOffset1?.x ??\n props.valueLabelOffset?.x ??\n (isRange\n ? isHorizontal\n ? reverse\n ? labelGap\n : -labelGap\n : labelGap\n : isHorizontal\n ? reverse\n ? -labelGap\n : labelGap\n : labelGap),\n y:\n props.valueLabelOffset1?.y ??\n props.valueLabelOffset?.y ??\n (isRange\n ? !isHorizontal\n ? reverse\n ? labelGap\n : -labelGap\n : -defaultThemeOffset\n : !isHorizontal\n ? reverse\n ? labelGap\n : -defaultThemeOffset\n : -defaultThemeOffset),\n }\n const labelOffset2 = {\n x:\n props.valueLabelOffset2?.x ??\n (isRange ? (isHorizontal ? (reverse ? -labelGap : labelGap) : labelGap) : labelGap),\n y:\n props.valueLabelOffset2?.y ??\n (isRange\n ? !isHorizontal\n ? reverse\n ? -labelGap\n : labelGap\n : -defaultThemeOffset\n : -defaultThemeOffset),\n }\n\n // Calculate fill track dimensions\n const fillStartPercentage = isRange ? valueToPercentage(rangeValue[0]) : 0\n const fillEndPercentage = isRange\n ? valueToPercentage(rangeValue[1])\n : valueToPercentage(singleValue)\n\n const fillStartPos = reverse\n ? trackLength - fillEndPercentage * trackLength\n : fillStartPercentage * trackLength\n const fillEndPos = reverse\n ? trackLength - fillStartPercentage * trackLength\n : fillEndPercentage * trackLength\n const fillLength = fillEndPos - fillStartPos\n\n return (\n <View\n {...props}\n direction={isHorizontal ? 'column' : 'row'}\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={8}\n alpha={finalAlpha}\n theme={nestedTheme}\n >\n {/* Track Container */}\n <View\n ref={trackRef}\n width={isHorizontal ? trackLength : trackHeight}\n height={isHorizontal ? trackHeight : trackLength}\n backgroundColor={themed.trackColor ?? 0x444444}\n cornerRadius={themed.trackBorderRadius ?? trackHeight / 2}\n alignItems=\"start\"\n padding={0}\n direction=\"stack\"\n onTouch={handleTrackTouch}\n theme={nestedTheme}\n >\n {/* Filled Track */}\n {props.renderTrack ? (\n <View>\n {props.renderTrack(fillStartPercentage, isRange ? fillEndPercentage : undefined)}\n </View>\n ) : (\n <View\n x={isHorizontal ? fillStartPos : 0}\n y={isHorizontal ? 0 : fillStartPos}\n width={isHorizontal ? fillLength : trackHeight}\n height={isHorizontal ? trackHeight : fillLength}\n backgroundColor={themed.trackFilledColor ?? 0x4dabf7}\n cornerRadius={themed.trackBorderRadius ?? trackHeight / 2}\n theme={nestedTheme}\n />\n )}\n\n {/* Marks/Ticks */}\n <View direction=\"stack\" theme={nestedTheme}>\n {marksArray.map((mark) => {\n const markPercentage = valueToPercentage(mark.value)\n const markPos = reverse\n ? trackLength - markPercentage * trackLength\n : markPercentage * trackLength\n\n const markHeight = mark.style?.height ?? themed.markHeight ?? 8\n const markWidth = mark.style?.width ?? themed.markWidth ?? 2\n const markColor = mark.style?.color ?? themed.markColor ?? 0x888888\n\n return (\n <View\n key={mark.value}\n x={isHorizontal ? markPos - markWidth / 2 : trackHeight / 2 - markWidth / 2}\n y={isHorizontal ? trackHeight / 2 - markHeight / 2 : markPos - markWidth / 2}\n width={isHorizontal ? markWidth : markHeight}\n height={isHorizontal ? markHeight : markWidth}\n backgroundColor={markColor}\n theme={nestedTheme}\n direction=\"stack\"\n >\n {mark.label}\n </View>\n )\n })}\n </View>\n\n {/* Thumb 1 (or single thumb) */}\n <View\n ref={thumb1Ref}\n x={isHorizontal ? currentDragPos1 : 0}\n y={isHorizontal ? 0 : currentDragPos1}\n direction=\"stack\"\n theme={nestedTheme}\n >\n <View\n x={-thumbSize}\n y={-thumbSize}\n width={thumbSize * 2}\n height={thumbSize * 2}\n onTouchMove={handleThumbDrag(0)}\n />\n <View\n x={isHorizontal ? 0 : trackHeight / 2}\n y={isHorizontal ? trackHeight / 2 : 0}\n width={thumbSize}\n height={thumbSize}\n direction=\"stack\"\n theme={nestedTheme}\n >\n {props.renderThumb ? (\n props.renderThumb(thumb1Value, isDragging1, 0)\n ) : (\n <DefaultThumb\n size={thumbSize}\n color={themed.thumbColor ?? 0x4dabf7}\n borderColor={themed.thumbBorderColor ?? 0xffffff}\n borderWidth={themed.thumbBorderWidth ?? 2}\n isDragging={isDragging1}\n dragScale={themed.thumbDragScale ?? 1.1}\n />\n )}\n </View>\n\n {props.showValue ? (\n <RefOriginView\n x={labelOffset1.x}\n y={labelOffset1.y}\n width={0}\n height={0}\n originX={0.5}\n originY={0.5}\n >\n <View\n width={100}\n height={50}\n x={-50}\n y={-25}\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <View\n backgroundColor={themed.valueLabel?.backgroundColor ?? 0x000000}\n padding={themed.valueLabel?.padding ?? { left: 6, right: 6, top: 4, bottom: 4 }}\n cornerRadius={themed.valueLabel?.cornerRadius ?? 4}\n theme={nestedTheme}\n >\n <Text\n text={formatValue(thumb1Value)}\n style={themed.valueLabel?.textStyle ?? { color: '#ffffff', fontSize: '12px' }}\n theme={nestedTheme}\n />\n </View>\n </View>\n </RefOriginView>\n ) : null}\n </View>\n\n {/* Thumb 2 (range mode only) */}\n {isRange ? (\n <View\n ref={thumb2Ref}\n x={isHorizontal ? currentDragPos2 : 0}\n y={isHorizontal ? 0 : currentDragPos2}\n direction=\"stack\"\n theme={nestedTheme}\n >\n <View\n x={-thumbSize}\n y={-thumbSize}\n width={thumbSize * 2}\n height={thumbSize * 2}\n onTouchMove={handleThumbDrag(1)}\n />\n <View\n x={isHorizontal ? 0 : trackHeight / 2}\n y={isHorizontal ? trackHeight / 2 : 0}\n width={thumbSize}\n height={thumbSize}\n direction=\"stack\"\n theme={nestedTheme}\n >\n {props.renderThumb ? (\n props.renderThumb(thumb2Value, isDragging2, 1)\n ) : (\n <DefaultThumb\n size={thumbSize}\n color={themed.thumbColor ?? 0x4dabf7}\n borderColor={themed.thumbBorderColor ?? 0xffffff}\n borderWidth={themed.thumbBorderWidth ?? 2}\n isDragging={isDragging2}\n dragScale={themed.thumbDragScale ?? 1.1}\n />\n )}\n </View>\n\n {props.showValue ? (\n <RefOriginView\n x={labelOffset2.x}\n y={labelOffset2.y}\n width={0}\n height={0}\n originX={0.5}\n originY={0.5}\n >\n <View\n width={100}\n height={50}\n x={-50}\n y={-25}\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <View\n backgroundColor={themed.valueLabel?.backgroundColor ?? 0x000000}\n padding={themed.valueLabel?.padding ?? { left: 6, right: 6, top: 4, bottom: 4 }}\n cornerRadius={themed.valueLabel?.cornerRadius ?? 4}\n theme={nestedTheme}\n >\n <Text\n text={formatValue(thumb2Value)}\n style={themed.valueLabel?.textStyle ?? { color: '#ffffff', fontSize: '12px' }}\n theme={nestedTheme}\n />\n </View>\n </View>\n </RefOriginView>\n ) : null}\n </View>\n ) : null}\n </View>\n </View>\n )\n}\n\n/**\n * Slider component - interactive single value selection\n * @param props - Slider properties\n * @returns Slider JSX element\n */\nexport function Slider(props: SliderProps): VNodeLike {\n return <BaseSlider {...props} mode=\"single\" />\n}\n\n/**\n * RangeSlider component - interactive range selection with two thumbs\n * @param props - RangeSlider properties\n * @returns RangeSlider JSX element\n */\nexport function RangeSlider(props: RangeSliderProps): VNodeLike {\n return <BaseSlider {...props} mode=\"range\" />\n}\n","/** @jsxImportSource ../.. */\n/**\n * ColorPicker component\n * HSL color selection with themed preview, gradient sliders, and optional tone controls.\n */\nimport * as Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport { darken, hslToNumber, lighten, numberToHex, numberToHsl, numberToRgb } from '../../colors'\nimport { useEffect, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, RadioGroup, Text, View } from '../index'\nimport { Slider } from './Slider'\n\nexport type ColorPickerTone = 'vivid' | 'muted'\n\nexport interface ColorPickerState {\n /** Hue in degrees, 0 to 360 */\n hue: number\n /** Saturation percentage, 0 to 100 */\n saturation: number\n /** Lightness percentage, 0 to 100 */\n lightness: number\n /** Last selected tone preset */\n tone: ColorPickerTone\n}\n\nexport interface ColorPickerLabels {\n title?: string\n tone?: string\n vivid?: string\n muted?: string\n hue?: string\n saturation?: string\n lightness?: string\n close?: string\n formatHue?: (value: number) => string\n formatSaturation?: (value: number) => string\n formatLightness?: (value: number) => string\n formatRgb?: (rgb: { r: number; g: number; b: number }) => string\n}\n\nexport interface ColorPickerProps extends Omit<ViewProps, 'children'> {\n /** Current color as Phaser color number (controlled mode). */\n value?: number\n /** Initial color as Phaser color number (uncontrolled mode). */\n defaultValue?: number\n /** Callback fired when the selected color changes. */\n onChange?: (color: number, state: ColorPickerState) => void\n /** Current tone preset (controlled mode). */\n tone?: ColorPickerTone\n /** Initial tone preset. */\n defaultTone?: ColorPickerTone\n /** Callback fired when the tone preset changes. */\n onToneChange?: (tone: ColorPickerTone) => void\n /** Callback for the optional close button. */\n onClose?: () => void\n /** Show close button. Defaults to true when onClose is provided. */\n showCloseButton?: boolean\n /** Show vivid/muted tone controls. */\n showTone?: boolean\n /** Show generated shade swatches. */\n showSwatches?: boolean\n /** Show RGB text below the preview. */\n showRgbLabel?: boolean\n /** Localized labels and value formatters. */\n labels?: ColorPickerLabels\n /** Slider track length in pixels. */\n trackLength?: number\n /** Preview swatch size in pixels. */\n previewSize?: number\n /** Number of color steps used for gradient tracks. */\n gradientSteps?: number\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nconst DEFAULT_LABELS: Required<\n Omit<ColorPickerLabels, 'formatHue' | 'formatSaturation' | 'formatLightness' | 'formatRgb'>\n> = {\n title: 'Color Picker',\n tone: 'Tone',\n vivid: 'Vivid',\n muted: 'Muted',\n hue: 'Hue',\n saturation: 'Saturation',\n lightness: 'Lightness',\n close: 'X',\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, value))\n}\n\nfunction colorPickerHslToNumber(hue: number, saturation: number, lightness: number): number {\n return hslToNumber(\n clamp(hue, 0, 360) / 360,\n clamp(saturation, 0, 100) / 100,\n clamp(lightness, 0, 100) / 100\n )\n}\n\nfunction numberToHslValues(color: number): Omit<ColorPickerState, 'tone'> {\n const hsl = numberToHsl(color)\n\n return {\n hue: Math.round(hsl.h * 360),\n saturation: Math.round(hsl.s * 100),\n lightness: Math.round(hsl.l * 100),\n }\n}\n\n/**\n * ColorPicker component\n * Provides an HSL color picker using the existing Slider and RadioGroup controls.\n */\nexport function ColorPicker(props: ColorPickerProps): VNodeLike {\n const {\n value,\n defaultValue = 0x2f80ed,\n onChange,\n tone,\n defaultTone = 'vivid',\n onToneChange,\n onClose,\n showCloseButton,\n showTone = true,\n showSwatches = true,\n showRgbLabel = true,\n labels: labelOverrides,\n trackLength: trackLengthProp,\n previewSize: previewSizeProp,\n gradientSteps: gradientStepsProp,\n theme,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('ColorPicker', mergedLocalTheme, {})\n\n const initialHsl = numberToHslValues(value ?? defaultValue)\n const [hue, setHue] = useState(initialHsl.hue)\n const [saturation, setSaturation] = useState(initialHsl.saturation)\n const [lightness, setLightness] = useState(initialHsl.lightness)\n const [internalTone, setInternalTone] = useState<ColorPickerTone>(tone ?? defaultTone)\n const lastEmittedColor = useRef<number | undefined>(undefined)\n\n const resolvedTone = tone ?? internalTone\n const currentColor = colorPickerHslToNumber(hue, saturation, lightness)\n const rgb = numberToRgb(currentColor)\n const hexLabel = numberToHex(currentColor).toUpperCase()\n\n const labels = {\n ...DEFAULT_LABELS,\n ...(themed.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n\n const labelStyle = themed.labelStyle ?? { color: '#ffffff', fontSize: '12px' }\n const valueStyle = themed.valueStyle ?? labelStyle\n const titleStyle = themed.titleStyle ?? { color: '#ffffff', fontSize: '16px', fontStyle: 'bold' }\n const trackLength = trackLengthProp ?? themed.trackLength ?? 280\n const trackHeight = themed.trackHeight ?? 14\n const previewSize = previewSizeProp ?? themed.previewSize ?? 116\n const gradientSteps = gradientStepsProp ?? themed.gradientSteps ?? 32\n const borderColor = themed.borderColor ?? 0x354052\n const surfaceColor = themed.backgroundColor ?? 0x17202e\n const overlayColor = themed.controlBackgroundColor ?? 0x223047\n const thumbBorderColor = themed.thumbBorderColor ?? 0xffffff\n const swatchSize = themed.swatchSize ?? 18\n const shouldShowCloseButton = showCloseButton ?? onClose !== undefined\n\n useEffect(() => {\n if (value === undefined || value === lastEmittedColor.current) return\n\n const next = numberToHslValues(value)\n setHue(next.hue)\n setSaturation(next.saturation)\n setLightness(next.lightness)\n }, [value])\n\n useEffect(() => {\n if (tone !== undefined && tone !== internalTone) {\n setInternalTone(tone)\n }\n }, [tone, internalTone])\n\n const emitChange = (\n nextHue: number,\n nextSaturation: number,\n nextLightness: number,\n nextTone = resolvedTone\n ) => {\n const nextColor = colorPickerHslToNumber(nextHue, nextSaturation, nextLightness)\n lastEmittedColor.current = nextColor\n onChange?.(nextColor, {\n hue: nextHue,\n saturation: nextSaturation,\n lightness: nextLightness,\n tone: nextTone,\n })\n }\n\n const updateColor = (\n nextHue: number,\n nextSaturation: number,\n nextLightness: number,\n nextTone = resolvedTone\n ) => {\n const roundedHue = Math.round(clamp(nextHue, 0, 360))\n const roundedSaturation = Math.round(clamp(nextSaturation, 0, 100))\n const roundedLightness = Math.round(clamp(nextLightness, 0, 100))\n\n setHue(roundedHue)\n setSaturation(roundedSaturation)\n setLightness(roundedLightness)\n emitChange(roundedHue, roundedSaturation, roundedLightness, nextTone)\n }\n\n const updateFromColor = (color: number) => {\n const next = numberToHslValues(color)\n updateColor(next.hue, next.saturation, next.lightness)\n }\n\n const updateTone = (nextTone: ColorPickerTone) => {\n const nextSaturation =\n nextTone === 'muted'\n ? Math.round(saturation * 0.6)\n : Math.round(clamp(saturation / 0.6, Math.max(saturation, 70), 100))\n\n if (tone === undefined) {\n setInternalTone(nextTone)\n }\n\n onToneChange?.(nextTone)\n updateColor(hue, nextSaturation, lightness, nextTone)\n }\n\n const swatches = [\n darken(currentColor, 0.35),\n darken(currentColor, 0.15),\n currentColor,\n lighten(currentColor, 0.2),\n lighten(currentColor, 0.4),\n ]\n const thumbSize = themed.thumbSize ?? 18\n const thumbRadius = thumbSize / 2\n const thumbShadowOffset = Math.max(1, Math.round(thumbRadius * 0.22))\n\n const sliderTheme: PartialTheme = mergeThemes(nestedTheme, {\n Slider: {\n trackHeight,\n trackBorderRadius: trackHeight / 2,\n thumbSize,\n thumbBorderWidth: 2,\n thumbBorderColor,\n },\n })\n\n const renderGradientTrack = (getColor: (progress: number) => number) => () => (\n <View width={trackLength} height={trackHeight}>\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n const stepWidth = trackLength / gradientSteps\n\n for (let i = 0; i < gradientSteps; i += 1) {\n const progress = gradientSteps === 1 ? 1 : i / (gradientSteps - 1)\n g.fillStyle(getColor(progress), 1)\n g.fillRect(i * stepWidth, 0, stepWidth + 1, trackHeight)\n }\n }}\n />\n </View>\n )\n\n const renderThumb = (color: number) => (_value: number, isDragging: boolean) => (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n g.fillStyle(0x000000, 0.32)\n g.fillCircle(0, thumbShadowOffset, thumbRadius)\n g.fillStyle(color, 1)\n g.fillCircle(0, 0, thumbRadius)\n g.lineStyle(2, thumbBorderColor, 1)\n g.strokeCircle(0, 0, thumbRadius)\n\n if (isDragging) {\n g.lineStyle(2, color, 0.7)\n g.strokeCircle(0, 0, thumbRadius + 4)\n }\n }}\n scale={isDragging ? 1.2 : 1}\n />\n )\n\n const renderValueRow = (label: string, valueText: string) => (\n <View direction=\"row\" width={trackLength} justifyContent=\"space-between\">\n <Text text={label} style={labelStyle} />\n <Text text={valueText} style={valueStyle} />\n </View>\n )\n\n return (\n <View\n {...viewProps}\n direction=\"row\"\n gap={themed.gap ?? 18}\n padding={themed.padding ?? 14}\n backgroundColor={surfaceColor}\n borderColor={borderColor}\n borderWidth={themed.borderWidth ?? 1}\n cornerRadius={themed.cornerRadius ?? 8}\n alignItems=\"center\"\n theme={nestedTheme}\n >\n <View gap={themed.previewGap ?? 10} width={Math.max(previewSize, 132)}>\n <View\n width={previewSize}\n height={previewSize}\n backgroundColor={currentColor}\n borderColor={borderColor}\n borderWidth={themed.previewBorderWidth ?? 2}\n cornerRadius={themed.previewCornerRadius ?? 8}\n alignItems=\"center\"\n justifyContent=\"center\"\n theme={nestedTheme}\n >\n <Text text={hexLabel} style={themed.hexStyle ?? { ...valueStyle, fontStyle: 'bold' }} />\n </View>\n\n {showRgbLabel ? (\n <Text\n text={labels.formatRgb ? labels.formatRgb(rgb) : `rgb ${rgb.r}, ${rgb.g}, ${rgb.b}`}\n style={labelStyle}\n />\n ) : null}\n\n {showSwatches ? (\n <View direction=\"row\" gap={themed.swatchGap ?? 6}>\n {swatches.map((swatch, index) => (\n <View\n key={`swatch-${index}`}\n width={swatchSize}\n height={swatchSize}\n backgroundColor={swatch}\n borderColor={borderColor}\n borderWidth={1}\n cornerRadius={themed.swatchCornerRadius ?? 4}\n onTouch={() => updateFromColor(swatch)}\n theme={nestedTheme}\n />\n ))}\n </View>\n ) : null}\n </View>\n\n <View gap={themed.controlGap ?? 12} theme={sliderTheme}>\n <View\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n width={trackLength}\n >\n <Text text={labels.title} style={titleStyle} />\n\n {shouldShowCloseButton ? (\n <View\n width={themed.closeButtonSize ?? 24}\n height={themed.closeButtonSize ?? 24}\n alignItems=\"center\"\n justifyContent=\"center\"\n backgroundColor={overlayColor}\n backgroundAlpha={themed.controlBackgroundAlpha ?? 0.65}\n borderColor={borderColor}\n borderWidth={1}\n cornerRadius={themed.closeButtonCornerRadius ?? 5}\n onTouch={() => onClose?.()}\n theme={nestedTheme}\n >\n <Text text={labels.close} style={labelStyle} />\n </View>\n ) : null}\n </View>\n\n {showTone ? (\n <View direction=\"row\" gap={12} alignItems=\"center\">\n <Text text={labels.tone} style={labelStyle} />\n <RadioGroup\n direction=\"row\"\n options={[\n { value: 'vivid', label: labels.vivid },\n { value: 'muted', label: labels.muted },\n ]}\n value={resolvedTone}\n onChange={(nextTone) => updateTone(nextTone as ColorPickerTone)}\n />\n </View>\n ) : null}\n\n <View gap={6}>\n {renderValueRow(labels.hue, labels.formatHue?.(hue) ?? `${Math.round(hue)}deg`)}\n <Slider\n value={hue}\n onChange={(nextHue: number) => updateColor(nextHue, saturation, lightness)}\n min={0}\n max={360}\n step={1}\n trackLength={trackLength}\n renderTrack={renderGradientTrack((progress) =>\n colorPickerHslToNumber(progress * 360, 100, 50)\n )}\n renderThumb={renderThumb(colorPickerHslToNumber(hue, 100, 50))}\n />\n </View>\n\n <View gap={6}>\n {renderValueRow(\n labels.saturation,\n labels.formatSaturation?.(saturation) ?? `${Math.round(saturation)}%`\n )}\n <Slider\n value={saturation}\n onChange={(nextSaturation: number) => updateColor(hue, nextSaturation, lightness)}\n min={0}\n max={100}\n step={1}\n trackLength={trackLength}\n renderTrack={renderGradientTrack((progress) =>\n colorPickerHslToNumber(hue, progress * 100, lightness)\n )}\n renderThumb={renderThumb(currentColor)}\n />\n </View>\n\n <View gap={6}>\n {renderValueRow(\n labels.lightness,\n labels.formatLightness?.(lightness) ?? `${Math.round(lightness)}%`\n )}\n <Slider\n value={lightness}\n onChange={(nextLightness: number) => updateColor(hue, saturation, nextLightness)}\n min={0}\n max={100}\n step={1}\n trackLength={trackLength}\n renderTrack={renderGradientTrack((progress) =>\n colorPickerHslToNumber(hue, saturation, progress * 100)\n )}\n renderThumb={renderThumb(currentColor)}\n />\n </View>\n </View>\n </View>\n )\n}\n","/**\n * Hook to access complete design token system\n * Combines colors with text styles, spacing, sizes, and radius tokens\n */\nimport { getPresetWithMode } from '../colors/color-presets'\nimport { useEffect, useState, useTheme } from '../hooks'\nimport { themeRegistry } from '../theme'\nimport {\n createTextStyleTokens,\n defaultRadiusTokens,\n defaultSizeTokens,\n defaultSpacingTokens,\n} from './design-token-presets'\nimport type { DesignTokens } from './design-token-types'\n\n/**\n * Hook to access complete design token system from theme context\n * Provides colors, text styles, spacing, sizes, and radius tokens\n * Automatically updates when color mode or preset changes\n * @returns Current DesignTokens or undefined\n * @example\n * ```typescript\n * function MyComponent() {\n * const tokens = useThemeTokens()\n *\n * if (!tokens) return null\n *\n * return (\n * <View\n * backgroundColor={tokens.colors.surface.DEFAULT}\n * padding={tokens.spacing.lg}\n * cornerRadius={tokens.radius.md}\n * >\n * <Text text=\"Title\" style={tokens.textStyles.title} />\n * <Text text=\"Body text\" style={tokens.textStyles.DEFAULT} />\n * </View>\n * )\n * }\n * ```\n */\nexport function useThemeTokens(): DesignTokens | undefined {\n const localTheme = useTheme()\n\n // Initialize design tokens state\n const getInitialTokens = (): DesignTokens | undefined => {\n // Check if local theme has color preset info\n if (localTheme?.__colorPreset) {\n const preset = getPresetWithMode(\n localTheme.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n localTheme.__colorPreset.mode ?? 'light'\n )\n return {\n colors: preset.colors,\n textStyles: createTextStyleTokens(preset.colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n }\n }\n\n // Fall back to global tokens\n const colors = themeRegistry.getColorTokens()\n if (!colors) return undefined\n\n return {\n colors,\n textStyles: createTextStyleTokens(colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n }\n }\n\n const [tokens, setTokens] = useState<DesignTokens | undefined>(getInitialTokens())\n const [, forceUpdate] = useState(0)\n\n useEffect(() => {\n // Subscribe to theme changes (mode/preset switches)\n const unsubscribe = themeRegistry.subscribe(() => {\n // Check if local theme has preset\n if (localTheme?.__colorPreset) {\n const currentMode = themeRegistry.getColorMode()\n const preset = getPresetWithMode(\n localTheme.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n currentMode\n )\n setTokens({\n colors: preset.colors,\n textStyles: createTextStyleTokens(preset.colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n })\n } else {\n // Use global tokens\n const colors = themeRegistry.getColorTokens()\n if (colors) {\n setTokens({\n colors,\n textStyles: createTextStyleTokens(colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n })\n }\n }\n // Force re-render when theme changes\n forceUpdate((n) => n + 1)\n })\n\n return unsubscribe\n }, [localTheme])\n\n return tokens\n}\n","/** @jsxImportSource ../.. */\n/**\n * DebugPanel component - lightweight runtime diagnostics for Phaser + PhaserJSX\n * Renders selected metrics as text rows or a compact single-line summary.\n */\nimport * as Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport { useThemeTokens } from '../../design-tokens/use-theme-tokens'\nimport { DevConfig } from '../../dev-config'\nimport { useEffect, useMemo, useScene, useState } from '../../hooks'\nimport { getMountStats, type VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\n\nexport type DebugPanelPreset = 'fps' | 'perf' | 'vdom' | 'textures' | 'full'\n\nexport type DebugMetricKey =\n | 'fps'\n | 'frameMs'\n | 'phaserVersion'\n | 'renderer'\n | 'viewport'\n | 'textureCount'\n | 'mountsTotal'\n | 'mountsByType'\n | 'mountsByParent'\n | 'mountsByKey'\n | 'debugFlags'\n\ntype DebugValue = string | number\n\ntype DebugSnapshot = Record<DebugMetricKey, DebugValue>\n\nexport interface DebugPanelProps extends Omit<ViewProps, 'children'> {\n /** Optional ready-made metric set. Ignored when `metrics` is set. */\n preset?: DebugPanelPreset\n /** Explicit metric selection (takes precedence over `preset`). */\n metrics?: DebugMetricKey[]\n /** Refresh interval in milliseconds. */\n intervalMs?: number\n /** Render all metrics in one line (instead of key/value rows). */\n compact?: boolean\n /** Maximum rows to render in non-compact mode. */\n maxRows?: number\n /** Optional metric label overrides. */\n labels?: Partial<Record<DebugMetricKey, string>>\n /** Optional formatter overrides per metric. */\n formatters?: Partial<Record<DebugMetricKey, (value: DebugValue) => string>>\n /** Optional props forwarded to each inner row View (column mode only). */\n innerProps?: Omit<ViewProps, 'children'>\n}\n\nconst PRESET_METRICS: Record<DebugPanelPreset, DebugMetricKey[]> = {\n fps: ['fps', 'frameMs'],\n perf: ['fps', 'frameMs', 'renderer', 'viewport'],\n vdom: ['mountsTotal', 'mountsByType', 'mountsByParent', 'mountsByKey'],\n textures: ['textureCount'],\n full: [\n 'fps',\n 'frameMs',\n 'phaserVersion',\n 'renderer',\n 'viewport',\n 'textureCount',\n 'mountsTotal',\n 'mountsByType',\n 'mountsByParent',\n 'mountsByKey',\n 'debugFlags',\n ],\n}\n\nconst DEFAULT_LABELS: Record<DebugMetricKey, string> = {\n fps: 'FPS',\n frameMs: 'Frame ms',\n phaserVersion: 'Phaser',\n renderer: 'Renderer',\n viewport: 'Viewport',\n textureCount: 'Textures',\n mountsTotal: 'Mounts',\n mountsByType: 'Mounts/type',\n mountsByParent: 'Mounts/parent',\n mountsByKey: 'Mounts/key',\n debugFlags: 'Debug flags',\n}\n\nfunction resolveRendererName(scene: Phaser.Scene): string {\n const renderer = scene.renderer as unknown as {\n type?: number\n constructor?: { name?: string }\n }\n const canvasType = (Phaser as unknown as { CANVAS?: number }).CANVAS\n\n if (renderer.type === Phaser.WEBGL) return 'WebGL'\n if (canvasType !== undefined && renderer.type === canvasType) return 'Canvas'\n if (renderer.constructor?.name) return renderer.constructor.name\n if (typeof renderer.type === 'number') return `Type ${renderer.type}`\n return 'Unknown'\n}\n\nfunction resolveTextureCount(scene: Phaser.Scene): number {\n const manager = scene.textures as unknown as {\n getTextureKeys?: () => string[]\n list?: Record<string, unknown>\n }\n\n const keys =\n typeof manager.getTextureKeys === 'function'\n ? manager.getTextureKeys()\n : Object.keys(manager.list ?? {})\n\n const internalKeys = new Set(['__DEFAULT', '__MISSING', '__NORMAL', '__WHITE'])\n return keys.filter((key) => !internalKeys.has(key.toUpperCase())).length\n}\n\nfunction resolveFrameStats(scene: Phaser.Scene): { fps: number; frameMs: number } {\n const loop = (\n scene.game as unknown as {\n loop?: {\n actualFps?: number\n fps?: number\n delta?: number\n frameDelta?: number\n }\n }\n ).loop\n\n const rawFps = loop?.actualFps ?? loop?.fps ?? 0\n const rawFrameMs = loop?.delta ?? loop?.frameDelta ?? 0\n\n const fps = Number.isFinite(rawFps) ? Number(rawFps.toFixed(1)) : 0\n const frameMs = Number.isFinite(rawFrameMs) ? Number(rawFrameMs.toFixed(2)) : 0\n\n return { fps, frameMs }\n}\n\nfunction summarizeMap(map: Map<unknown, number>, maxEntries = 3): string {\n const summary = Array.from(map.entries())\n .sort((a, b) => b[1] - a[1])\n .slice(0, maxEntries)\n .map(([key, value]) => `${String(key)}:${value}`)\n .join(' | ')\n\n return summary || '-'\n}\n\nfunction resolveDebugFlags(): string {\n const debugConfig = DevConfig.debug\n if (!debugConfig.enabled) return 'off'\n\n const enabledFlags = Object.entries(debugConfig)\n .filter(([key, value]) => key !== 'enabled' && value)\n .map(([key]) => key)\n\n return enabledFlags.length ? enabledFlags.join(',') : 'enabled'\n}\n\nfunction collectSnapshot(scene: Phaser.Scene): DebugSnapshot {\n const { fps, frameMs } = resolveFrameStats(scene)\n const mountStats = getMountStats()\n\n return {\n fps,\n frameMs,\n phaserVersion: Phaser.VERSION,\n renderer: resolveRendererName(scene),\n viewport: `${scene.scale.width.toFixed(0)}x${scene.scale.height.toFixed(0)}`,\n textureCount: resolveTextureCount(scene),\n mountsTotal: mountStats.totalMounts,\n mountsByType: summarizeMap(mountStats.byType),\n mountsByParent: summarizeMap(mountStats.byParent),\n mountsByKey: summarizeMap(mountStats.byKey),\n debugFlags: resolveDebugFlags(),\n }\n}\n\nfunction formatDefault(value: DebugValue): string {\n return typeof value === 'number' ? String(value) : value\n}\n\n/**\n * DebugPanel component\n * Shows selected diagnostics from Phaser + PhaserJSX as overlay-ready content.\n */\nexport function DebugPanel(props: DebugPanelProps): VNodeLike {\n const scene = useScene()\n\n const {\n preset = 'fps',\n metrics,\n intervalMs = 250,\n compact = false,\n maxRows,\n labels,\n formatters,\n innerProps,\n ...viewProps\n } = props\n\n const selectedMetrics = useMemo(() => {\n const source = metrics && metrics.length > 0 ? metrics : PRESET_METRICS[preset]\n return Array.from(new Set(source))\n }, [metrics, preset])\n\n const [snapshot, setSnapshot] = useState<DebugSnapshot>(collectSnapshot(scene))\n\n useEffect(() => {\n const delay = Math.max(50, intervalMs)\n setSnapshot(collectSnapshot(scene))\n\n const timer = window.setInterval(() => {\n setSnapshot(collectSnapshot(scene))\n }, delay)\n\n return () => {\n window.clearInterval(timer)\n }\n }, [scene, intervalMs, selectedMetrics])\n\n const tokens = useThemeTokens()\n\n const rowStyle = tokens?.textStyles.small\n const valueStyle = tokens?.textStyles.small\n\n const rows = selectedMetrics.map((metric) => {\n const rawValue = snapshot[metric]\n const label = labels?.[metric] ?? DEFAULT_LABELS[metric]\n const formatter = formatters?.[metric]\n const value = formatter ? formatter(rawValue) : formatDefault(rawValue)\n return { metric, label, value }\n })\n\n const limitedRows = typeof maxRows === 'number' ? rows.slice(0, Math.max(1, maxRows)) : rows\n\n if (compact) {\n const compactText = limitedRows.map((row) => `${row.label} ${row.value}`).join(' | ')\n return (\n <View {...viewProps}>\n <Text text={compactText} style={valueStyle} />\n </View>\n )\n }\n\n return (\n <View direction=\"column\" gap={4} {...viewProps}>\n {limitedRows.map((row) => (\n <View key={`debug-${row.metric}`} direction=\"row\" gap={8} {...innerProps}>\n <Text text={`${row.label}:`} style={rowStyle} />\n <Text text={row.value} style={valueStyle} />\n </View>\n ))}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Graphics component wrapper - strict type-safe wrapper around primitive graphics\n * This component is the public API for Graphics, with controlled prop interface\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\nimport type { VNodeLike } from '@number10/phaserjsx/vdom'\n\n/**\n * Props for Graphics component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface GraphicsProps\n extends\n TransformProps,\n PhaserProps,\n Omit<LayoutProps, 'direction' | 'justifyContent' | 'alignItems' | 'gap' | 'flexWrap'>,\n PropsDefaultExtension<Phaser.GameObjects.Graphics> {\n /**\n * Drawing callback - receives Graphics instance for custom drawing\n * Called on mount and when dependencies change\n * @param graphics - Phaser Graphics instance\n * @param props - Current props (for accessing dynamic values)\n */\n onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsProps) => void\n\n /**\n * If true, graphics is cleared before onDraw is called\n * Default: true (usually what you want)\n */\n autoClear?: boolean\n\n /**\n * Dependencies array - if any value changes, onDraw is re-executed\n * Similar to React useEffect dependencies\n */\n dependencies?: unknown[]\n\n /** Children are not supported for Graphics component */\n children?: ChildrenType\n}\n\n/**\n * Graphics component\n * Renders custom vector shapes via imperative drawing API\n *\n * @example\n * ```tsx\n * <Graphics\n * onDraw={(g) => {\n * g.fillStyle(0xff0000, 1)\n * g.fillCircle(50, 50, 50)\n * }}\n * />\n * ```\n */\nexport function Graphics(props: GraphicsProps): VNodeLike {\n const localTheme = useTheme()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('Graphics', localTheme, props as any)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <graphics {...themed} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * ScrollSlider component for scrollable content areas\n */\nimport * as Phaser from 'phaser'\nimport type { GestureEventData } from '../../core-props'\nimport { useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { VNodeLike } from '../../vdom'\nimport type { LayoutSize } from '../index'\nimport { View } from '../index'\n\n/** Size variants for the scroll slider */\nexport type SliderSize = 'large' | 'medium' | 'small' | 'tiny' | 'micro' | 'nano' | undefined\n\ntype ScrollSliderSizeTheme = {\n borderWidth?: number\n size?: number\n}\n\n/**\n * Calculate slider dimensions based on size variant and theme\n * @param size - Size variant\n * @param theme - Optional resolved ScrollSlider theme values\n * @returns Calculated dimensions\n */\nexport function calculateSliderSize(size: SliderSize, theme?: ScrollSliderSizeTheme) {\n const themed = theme ?? getThemedProps('ScrollSlider', undefined, {}).props\n const sizeFactor =\n size === 'large'\n ? 1.25\n : size === 'small'\n ? 0.75\n : size === 'tiny'\n ? 0.5\n : size === 'micro'\n ? 0.25\n : size === 'nano'\n ? 0.125\n : 1 // medium or undefined\n const border = (themed.borderWidth ?? 1) * sizeFactor\n const outer = (themed.size ?? 24) * sizeFactor\n const dimension = outer - border * 2\n\n return { border, outer, dimension }\n}\n\n/**\n * Props for ScrollSlider component\n */\nexport interface ScrollSliderProps {\n /** Direction of the slider */\n direction: 'vertical' | 'horizontal'\n /** Whether to a size variant, default is medium */\n size?: SliderSize\n /** Current scroll position in pixels */\n scrollPosition: number\n /** Viewport size in pixels */\n viewportSize: number\n /** Content size in pixels */\n contentSize: number\n /** Callback when slider is scrolled, returns new scroll position in pixels */\n onScroll: (scrollPosition: number) => void\n /** Enable momentum scrolling for thumb dragging */\n momentum?: boolean\n /** Callback when momentum (or drag end without momentum) finishes */\n onMomentumEnd?: () => void\n}\n\n/**\n * ScrollSlider component providing slider functionality for ScrollView\n * @param props - ScrollSlider properties\n * @returns JSX element\n */\nexport function ScrollSlider(props: ScrollSliderProps): VNodeLike {\n const {\n direction,\n scrollPosition,\n viewportSize,\n contentSize,\n onScroll,\n momentum = true,\n onMomentumEnd,\n } = props\n const localTheme = useTheme()\n const { props: themed } = getThemedProps('ScrollSlider', localTheme, {})\n const sliderRef = useRef<Phaser.GameObjects.Container | null>(null)\n const isDraggingRef = useRef(false)\n const [isDragging, setIsDragging] = useState(false)\n const trackContainerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const velocityRef = useRef(0)\n const lastTimeRef = useRef(0)\n const tweenRef = useRef<Phaser.Tweens.Tween | null>(null)\n\n const isVertical = direction === 'vertical'\n const { border, outer, dimension } = calculateSliderSize(props.size, themed)\n const sizeFactor = outer / (themed.size ?? 24)\n const thumbBorderWidth = Math.min(\n (themed.thumbBorderWidth ?? 1) * sizeFactor,\n Math.max(0, dimension / 3)\n )\n const outerRadius = themed.cornerRadius ?? outer / 2\n const trackRadius = themed.trackCornerRadius ?? dimension / 2\n const thumbRadius = themed.thumbCornerRadius ?? dimension / 2\n\n // Get actual resolved track size from the container after layout\n const containerWithLayout = trackContainerRef.current as\n | (Phaser.GameObjects.Container & {\n __getLayoutSize?: () => LayoutSize\n })\n | null\n\n const resolvedTrackSize = containerWithLayout?.__getLayoutSize\n ? isVertical\n ? containerWithLayout.__getLayoutSize().height\n : containerWithLayout.__getLayoutSize().width\n : containerWithLayout && containerWithLayout.width > 0 && containerWithLayout.height > 0\n ? isVertical\n ? containerWithLayout.height\n : containerWithLayout.width\n : 800 // fallback\n\n const trackSizeInner = resolvedTrackSize - border * 2\n const minThumbSize = themed.minThumbSize ?? 20\n\n // Calculate thumb size based on viewport to content ratio\n const maxScroll = Math.max(0, contentSize - viewportSize)\n const visibleRatio = contentSize > 0 ? viewportSize / contentSize : 1\n const thumbSize = Math.max(minThumbSize, trackSizeInner * visibleRatio)\n const thumbRange = trackSizeInner - thumbSize\n\n // Calculate thumb position from scroll position\n const thumbPosition = maxScroll > 0 ? (scrollPosition / maxScroll) * thumbRange : 0\n\n const handleThumbTouchMove = (data: GestureEventData) => {\n // Stop event propagation to prevent ScrollView from receiving the event\n data.stopPropagation()\n\n if (data.state === 'start') {\n isDraggingRef.current = true\n setIsDragging(true)\n velocityRef.current = 0\n lastTimeRef.current = Date.now()\n // Stop any ongoing momentum tween\n if (tweenRef.current) {\n tweenRef.current.stop()\n tweenRef.current = null\n }\n return\n }\n\n if (data.state === 'end') {\n isDraggingRef.current = false\n setIsDragging(false)\n if (momentum && Math.abs(velocityRef.current) > 0.1) {\n startMomentum(scrollPosition)\n } else if (onMomentumEnd) {\n onMomentumEnd()\n }\n return\n }\n\n if (!isDraggingRef.current) return\n\n const delta = isVertical ? (data.dy ?? 0) : (data.dx ?? 0)\n const now = Date.now()\n const deltaTime = now - lastTimeRef.current\n if (deltaTime > 0) {\n velocityRef.current = (delta / deltaTime) * 1000 // pixels per second\n lastTimeRef.current = now\n }\n\n const newThumbPos = Math.max(0, Math.min(thumbRange, thumbPosition + delta))\n const newScrollPos = thumbRange > 0 ? (newThumbPos / thumbRange) * maxScroll : 0\n\n onScroll(newScrollPos)\n }\n\n const startMomentum = (startPos: number) => {\n if (!sliderRef.current?.scene) return\n\n const scene = sliderRef.current.scene\n const duration = Math.min(1000, Math.max(200, Math.abs(velocityRef.current))) // 200-1000ms\n const targetScrollPos = Math.max(\n 0,\n Math.min(maxScroll, startPos + velocityRef.current * (duration / 1000))\n )\n\n tweenRef.current = scene.tweens.add({\n targets: { pos: startPos },\n pos: targetScrollPos,\n duration,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { pos: number }\n onScroll(target.pos)\n },\n onComplete: () => {\n tweenRef.current = null\n if (onMomentumEnd) {\n onMomentumEnd()\n }\n },\n })\n }\n\n const handleBackgroundTouch = (data: GestureEventData) => {\n // Stop event propagation to prevent ScrollView from receiving the event\n data.stopPropagation()\n\n // localY/localX is relative to the background view which has the full trackSizeInner dimensions\n const localPos = isVertical ? (data.localY ?? 0) : (data.localX ?? 0)\n\n // Calculate the center position of where the thumb should be\n const targetThumbCenter = Math.max(\n thumbSize / 2,\n Math.min(trackSizeInner - thumbSize / 2, localPos)\n )\n\n // Convert to thumb position (top-left corner)\n const targetThumbPos = targetThumbCenter - thumbSize / 2\n\n // Calculate scroll position in pixels from thumb position\n const targetScrollPos = thumbRange > 0 ? (targetThumbPos / thumbRange) * maxScroll : 0\n\n onScroll(Math.max(0, Math.min(maxScroll, targetScrollPos)))\n }\n\n return (\n <View\n ref={trackContainerRef}\n width={isVertical ? outer : '100%'}\n height={isVertical ? '100%' : outer}\n backgroundColor={themed.borderColor ?? 0x000000}\n cornerRadius={outerRadius}\n padding={border}\n >\n <View\n ref={sliderRef}\n width={isVertical ? dimension : '100%'}\n height={isVertical ? '100%' : dimension}\n backgroundColor={themed.trackColor ?? 0xdddddd}\n cornerRadius={trackRadius}\n direction=\"stack\"\n padding={0}\n >\n <View\n width={isVertical ? dimension : '100%'}\n height={isVertical ? '100%' : dimension}\n x={0}\n y={0}\n backgroundColor={themed.trackColor ?? 0xaaaaaa}\n cornerRadius={trackRadius}\n enableGestures={true}\n onTouch={handleBackgroundTouch}\n />\n <View\n width={isVertical ? dimension : thumbSize}\n height={isVertical ? thumbSize : dimension}\n x={isVertical ? 0 : thumbPosition}\n y={isVertical ? thumbPosition : 0}\n backgroundColor={\n isDragging\n ? (themed.thumbActiveColor ?? themed.thumbColor ?? 0xeeeebb)\n : (themed.thumbColor ?? 0xeeeebb)\n }\n borderColor={themed.thumbBorderColor}\n borderWidth={thumbBorderWidth}\n cornerRadius={thumbRadius}\n enableGestures={true}\n onTouchMove={handleThumbTouchMove}\n />\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * ScrollView component providing a scrollable area with optional sliders\n */\nimport * as Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport type { GestureEventData, WheelEventData } from '../../core-props'\nimport { useEffect, useLayoutEffect, useRedraw, useRef, useState, useTheme } from '../../hooks'\nimport { getRenderContext } from '../../render-context'\nimport { getThemedProps } from '../../theme'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\nimport { calculateSliderSize, ScrollSlider, type SliderSize } from './ScrollSlider'\n\n/**\n * Scroll information data\n */\nexport interface ScrollInfo {\n /** Current horizontal scroll position */\n dx: number\n /** Current vertical scroll position */\n dy: number\n /** Viewport width */\n viewportWidth: number\n /** Viewport height */\n viewportHeight: number\n /** Content width */\n contentWidth: number\n /** Content height */\n contentHeight: number\n /** Maximum horizontal scroll */\n maxScrollX: number\n /** Maximum vertical scroll */\n maxScrollY: number\n}\n\n/**\n * Snap configuration types\n */\nexport type SnapMode = { positions: number[]; threshold?: number }\nexport type SnapAlignment = 'start' | 'center' | 'end'\n\n/**\n * Props for ScrollView component\n */\nexport interface ScrollViewProps extends ViewProps {\n /** Whether to show the vertical scroll slider (default: auto) */\n showVerticalSlider?: boolean | 'auto' | undefined\n /** Whether to show the vertical scroll slider (default: auto) */\n showHorizontalSlider?: boolean | 'auto' | undefined\n /** Size variant for the scroll sliders */\n sliderSize?: SliderSize\n /** Initial scroll position; with snap enabled you can optionally set snapIndex instead of dx/dy */\n scroll?: { dx?: number | undefined; dy?: number | undefined; snapIndex?: number | undefined }\n /** Callback when scroll information changes */\n onScrollInfoChange?: (info: ScrollInfo) => void\n /** Snap behavior: false (disabled), 'auto' (to items), or manual positions */\n snap?: SnapMode | undefined\n /** Alignment for snapping */\n snapAlignment?: SnapAlignment\n /** Threshold for snap (pixels) */\n snapThreshold?: number\n /** Enable momentum scrolling */\n momentum?: boolean\n /** Callback fired when snapping lands on a target (index is from snap.positions) */\n onSnap?: (index: number) => void\n /** Callback to deliver the slider size */\n onSliderSize?: (size: { width: number; height: number }) => void\n}\n\n/**\n * ScrollView component providing a scrollable area with an optional vertical slider\n * @param props - ScrollView properties\n * @returns JSX element\n */\nexport function ScrollView(props: ScrollViewProps): VNodeLike {\n const {\n children,\n showVerticalSlider = 'auto',\n showHorizontalSlider = 'auto',\n scroll: initialScroll,\n onScrollInfoChange,\n snap = false,\n snapAlignment = 'start',\n snapThreshold = 20,\n momentum = true,\n onSnap,\n onSliderSize,\n sliderSize: sliderSizeVariant,\n ...viewProps\n } = props\n const localTheme = useTheme()\n const { props: sliderTheme } = getThemedProps('ScrollSlider', localTheme, {})\n\n const [scroll, setScroll] = useState({\n dx: initialScroll?.dx ?? 0,\n dy: initialScroll?.dy ?? 0,\n })\n const scrollRef = useRef(scroll)\n const hasMountedRef = useRef(false)\n const lastAppliedSnapIndexRef = useRef<number | undefined>(initialScroll?.snapIndex)\n\n const contentRef = useRef<Phaser.GameObjects.Container | null>(null)\n const viewportRef = useRef<Phaser.GameObjects.Container | null>(null)\n\n const [contentHeight, setContentHeight] = useState(0)\n const [contentWidth, setContentWidth] = useState(0)\n\n // State for momentum scrolling\n const velocityRef = useRef({ vx: 0, vy: 0 })\n const lastTimeRef = useRef(0)\n const pendingDeltaRef = useRef({ dx: 0, dy: 0 })\n const scheduledFrameRef = useRef<number | null>(null)\n const tweenRef = useRef<Phaser.Tweens.Tween | null>(null)\n const wheelSnapTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const WHEEL_SNAP_DELAY = 200\n\n // Calculate if scrolling is needed\n const viewportHeight = viewportRef.current?.height ?? 0\n const viewportWidth = viewportRef.current?.width ?? 0\n const effectiveContentHeight = Math.max(contentHeight, viewportHeight)\n const effectiveContentWidth = Math.max(contentWidth, viewportWidth)\n\n // Use epsilon threshold to avoid floating-point precision issues\n const epsilon = 0.5\n const needsVerticalScroll = effectiveContentHeight > viewportHeight + epsilon\n const needsHorizontalScroll = effectiveContentWidth > viewportWidth + epsilon\n\n const showVerticalSliderActual =\n showVerticalSlider === true || (needsVerticalScroll && showVerticalSlider === 'auto')\n const showHorizontalSliderActual =\n showHorizontalSlider === true || (needsHorizontalScroll && showHorizontalSlider === 'auto')\n\n // Get slider size, considering size variant and theme\n const { outer: sliderSize } = calculateSliderSize(sliderSizeVariant, sliderTheme)\n onSliderSize?.({\n width: showVerticalSliderActual ? sliderSize : 0,\n height: showHorizontalSliderActual ? sliderSize : 0,\n })\n\n const maxScrollY = Math.max(0, effectiveContentHeight - viewportHeight)\n const maxScrollX = Math.max(0, effectiveContentWidth - viewportWidth)\n\n const updateScroll = (\n value:\n | { dx: number; dy: number }\n | ((prev: { dx: number; dy: number }) => { dx: number; dy: number })\n ) => {\n setScroll((prev) => {\n const next = typeof value === 'function' ? value(prev) : value\n if (Math.abs(next.dx - prev.dx) < 0.001 && Math.abs(next.dy - prev.dy) < 0.001) {\n scrollRef.current = prev\n return prev\n }\n scrollRef.current = next\n return next\n })\n }\n\n const stopActiveTween = () => {\n if (tweenRef.current) {\n tweenRef.current.stop()\n tweenRef.current = null\n }\n }\n\n const resolvedSnapThreshold =\n typeof snap === 'object' && 'positions' in snap\n ? (snap.threshold ?? snapThreshold)\n : snapThreshold\n const effectiveSnapThreshold =\n resolvedSnapThreshold === undefined || resolvedSnapThreshold < 0\n ? Infinity\n : resolvedSnapThreshold\n\n // Update scroll when props.scroll changes or when layout info is available\n useLayoutEffect(() => {\n if (!initialScroll) return\n // console.log('ScrollView: applying initial scroll', initialScroll)\n const allowAnimate = hasMountedRef.current\n\n // If snapIndex is provided and manual snap positions are used, align to that index\n if (snap && typeof snap === 'object' && 'positions' in snap) {\n const { x: xTargets, y: yTargets } = getSnapTargets()\n const hasTargets = xTargets.length > 0 || yTargets.length > 0\n\n if (initialScroll.snapIndex !== undefined && hasTargets) {\n const maxIdx = Math.max(xTargets.length, yTargets.length) - 1\n const clampedIdx = Math.max(0, Math.min(initialScroll.snapIndex, maxIdx))\n\n const targetX = xTargets[clampedIdx]\n const targetY = yTargets[clampedIdx]\n\n const nextDx =\n targetX !== undefined\n ? alignTargetPosition(targetX, viewportWidth, maxScrollX)\n : (initialScroll.dx ?? scrollRef.current.dx)\n const nextDy =\n targetY !== undefined\n ? alignTargetPosition(targetY, viewportHeight, maxScrollY)\n : (initialScroll.dy ?? scrollRef.current.dy)\n\n const shouldAnimate =\n allowAnimate &&\n (clampedIdx !== lastAppliedSnapIndexRef.current ||\n Math.abs(scrollRef.current.dx - nextDx) > 0.5 ||\n Math.abs(scrollRef.current.dy - nextDy) > 0.5)\n\n lastAppliedSnapIndexRef.current = clampedIdx\n\n if (shouldAnimate && contentRef.current?.scene) {\n stopActiveTween()\n const scene = contentRef.current.scene\n tweenRef.current = scene.tweens.add({\n targets: { dx: scrollRef.current.dx, dy: scrollRef.current.dy },\n dx: nextDx,\n dy: nextDy,\n duration: 220,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { dx: number; dy: number }\n updateScroll({ dx: target.dx, dy: target.dy })\n },\n onComplete: () => {\n tweenRef.current = null\n if (onSnap) {\n onSnap(clampedIdx)\n }\n },\n })\n } else {\n updateScroll({ dx: nextDx, dy: nextDy })\n if (onSnap) {\n onSnap(clampedIdx)\n }\n }\n hasMountedRef.current = true\n return\n }\n }\n\n // Fallback to provided dx/dy: TODO: what if when only one of dx/dy is provided? Animation ?\n if (initialScroll.dx !== undefined && initialScroll.dy !== undefined) {\n const nextDx = initialScroll.dx\n const nextDy = initialScroll.dy\n const shouldAnimate =\n allowAnimate &&\n (Math.abs(scrollRef.current.dx - nextDx) > 0.5 ||\n Math.abs(scrollRef.current.dy - nextDy) > 0.5)\n\n if (shouldAnimate && contentRef.current?.scene) {\n stopActiveTween()\n const scene = contentRef.current.scene\n tweenRef.current = scene.tweens.add({\n targets: { dx: scrollRef.current.dx, dy: scrollRef.current.dy },\n dx: nextDx,\n dy: nextDy,\n duration: 220,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { dx: number; dy: number }\n updateScroll({ dx: target.dx, dy: target.dy })\n },\n onComplete: () => {\n tweenRef.current = null\n },\n })\n } else {\n updateScroll({ dx: nextDx, dy: nextDy })\n }\n }\n\n hasMountedRef.current = true\n }, [initialScroll, snap, viewportWidth, viewportHeight, maxScrollX, maxScrollY])\n\n // Notify parent of scroll info changes\n useEffect(() => {\n if (onScrollInfoChange && viewportWidth > 0 && viewportHeight > 0) {\n onScrollInfoChange({\n dx: scroll.dx,\n dy: scroll.dy,\n viewportWidth,\n viewportHeight,\n contentWidth: effectiveContentWidth,\n contentHeight: effectiveContentHeight,\n maxScrollX,\n maxScrollY,\n })\n }\n }, [\n scroll,\n viewportWidth,\n viewportHeight,\n effectiveContentWidth,\n effectiveContentHeight,\n maxScrollX,\n maxScrollY,\n ])\n\n // Update content dimensions after layout\n useEffect(() => {\n const update = () => {\n if (contentRef.current) {\n const newHeight = contentRef.current.height\n const newWidth = contentRef.current.width\n if (newHeight !== contentHeight) {\n setContentHeight(newHeight)\n }\n if (newWidth !== contentWidth) {\n setContentWidth(newWidth)\n }\n }\n // Defer again for next layout\n if (contentRef.current?.scene) {\n getRenderContext(contentRef.current.scene).deferLayout(update)\n }\n }\n if (contentRef.current?.scene) {\n getRenderContext(contentRef.current.scene).deferLayout(update)\n }\n }, [])\n\n const calc = (deltaX: number, deltaY: number) => {\n if (!contentRef.current || !viewportRef.current) return\n\n // Get viewport and content dimensions\n const viewportHeight = viewportRef.current.height\n const viewportWidth = viewportRef.current.width\n const contentHeight = contentRef.current.height\n const contentWidth = contentRef.current.width\n const currentScroll = scrollRef.current\n // Calculate new scroll position\n const maxScrollY = Math.max(0, contentHeight - viewportHeight)\n const maxScrollX = Math.max(0, contentWidth - viewportWidth)\n const newScrollY = Math.max(0, Math.min(maxScrollY, currentScroll.dy - deltaY))\n const newScrollX = Math.max(0, Math.min(maxScrollX, currentScroll.dx - deltaX))\n\n if (\n Math.abs(newScrollX - currentScroll.dx) < 0.001 &&\n Math.abs(newScrollY - currentScroll.dy) < 0.001\n ) {\n return\n }\n\n updateScroll({ dx: newScrollX, dy: newScrollY })\n }\n\n const flushPendingScroll = () => {\n scheduledFrameRef.current = null\n const pending = pendingDeltaRef.current\n if (pending.dx === 0 && pending.dy === 0) return\n\n const dx = pending.dx\n const dy = pending.dy\n pendingDeltaRef.current = { dx: 0, dy: 0 }\n calc(dx, dy)\n }\n\n const queueScrollDelta = (deltaX: number, deltaY: number) => {\n if (deltaX === 0 && deltaY === 0) return\n\n pendingDeltaRef.current = {\n dx: pendingDeltaRef.current.dx + deltaX,\n dy: pendingDeltaRef.current.dy + deltaY,\n }\n\n if (scheduledFrameRef.current === null) {\n scheduledFrameRef.current = requestAnimationFrame(flushPendingScroll)\n }\n }\n\n const startMomentum = () => {\n if (!contentRef.current?.scene) return\n\n const scene = contentRef.current.scene\n const velocity = velocityRef.current\n const duration = Math.min(1000, Math.max(200, Math.abs(velocity.vx) + Math.abs(velocity.vy))) // 200-1000ms\n const currentScroll = scrollRef.current\n const baseTargetDx = Math.max(\n 0,\n Math.min(maxScrollX, currentScroll.dx - velocity.vx * (duration / 1000))\n )\n const baseTargetDy = Math.max(\n 0,\n Math.min(maxScrollY, currentScroll.dy - velocity.vy * (duration / 1000))\n )\n const snappedTarget = snap ? calculateSnapDestination(baseTargetDx, baseTargetDy) : null\n\n stopActiveTween()\n\n tweenRef.current = scene.tweens.add({\n targets: { dx: currentScroll.dx, dy: currentScroll.dy },\n dx: snappedTarget?.dx ?? baseTargetDx,\n dy: snappedTarget?.dy ?? baseTargetDy,\n duration,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { dx: number; dy: number }\n updateScroll({ dx: target.dx, dy: target.dy })\n },\n onComplete: () => {\n tweenRef.current = null\n if (snappedTarget && snappedTarget.index >= 0 && onSnap) {\n onSnap(snappedTarget.index)\n }\n },\n })\n }\n\n type SnapTarget = { position: number; size: number }\n\n const getSnapTargets = (): { x: SnapTarget[]; y: SnapTarget[] } => {\n const viewportHeightCurrent = viewportRef.current?.height ?? viewportHeight\n const viewportWidthCurrent = viewportRef.current?.width ?? viewportWidth\n\n if (typeof snap === 'object' && 'positions' in snap) {\n const sorted = [...snap.positions].sort((a, b) => a - b)\n const inferredSizeY =\n sorted.length > 1\n ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0))\n : viewportHeightCurrent || 0\n const inferredSizeX =\n sorted.length > 1\n ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0))\n : viewportWidthCurrent || 0\n const targetsX = sorted.map((position, index) => {\n const next = sorted[index + 1]\n const size =\n next !== undefined\n ? Math.max(0, next - position)\n : inferredSizeX > 0\n ? inferredSizeX\n : viewportWidthCurrent || 0\n return { position, size }\n })\n const targetsY = sorted.map((position, index) => {\n const next = sorted[index + 1]\n const size =\n next !== undefined\n ? Math.max(0, next - position)\n : inferredSizeY > 0\n ? inferredSizeY\n : viewportHeightCurrent || 0\n return { position, size }\n })\n return { x: targetsX, y: targetsY }\n }\n\n return { x: [], y: [] }\n }\n\n const findNearestSnap = (\n current: number,\n targets: SnapTarget[],\n viewportSize: number,\n maxScroll: number\n ): { position: number; index: number } => {\n if (targets.length === 0) return { position: current, index: -1 }\n\n let nearest = current\n let minDistance = Infinity\n let nearestIndex = -1\n\n for (let index = 0; index < targets.length; index++) {\n const { position, size } = targets[index] ?? { position: 0, size: 0 }\n let adjustedPos = position\n\n if (snapAlignment === 'center') {\n adjustedPos = position + size / 2 - viewportSize / 2\n } else if (snapAlignment === 'end') {\n adjustedPos = position + size - viewportSize\n }\n\n adjustedPos = Math.max(0, Math.min(maxScroll, adjustedPos))\n const distance = Math.abs(current - adjustedPos)\n\n if (distance < minDistance && distance <= effectiveSnapThreshold) {\n minDistance = distance\n nearest = adjustedPos\n nearestIndex = index\n } else if (distance < minDistance && effectiveSnapThreshold === Infinity) {\n minDistance = distance\n nearest = adjustedPos\n nearestIndex = index\n }\n }\n\n return { position: nearest, index: nearestIndex }\n }\n\n const calculateSnapDestination = (baseDx: number, baseDy: number) => {\n const { x: xTargets, y: yTargets } = getSnapTargets()\n const viewportHeightLocal = viewportRef.current?.height ?? 0\n const viewportWidthLocal = viewportRef.current?.width ?? 0\n const snapXTargets = maxScrollX > epsilon ? xTargets : []\n const snapYTargets = maxScrollY > epsilon ? yTargets : []\n\n const snapX = findNearestSnap(baseDx, snapXTargets, viewportWidthLocal, maxScrollX)\n const snapY = findNearestSnap(baseDy, snapYTargets, viewportHeightLocal, maxScrollY)\n\n // Prefer Y index if available, otherwise X\n const snapIndex = snapY.index >= 0 ? snapY.index : snapX.index\n\n return { dx: snapX.position, dy: snapY.position, index: snapIndex }\n }\n\n const alignTargetPosition = (target: SnapTarget, viewportSize: number, maxScroll: number) => {\n let adjustedPos = target.position\n if (snapAlignment === 'center') {\n adjustedPos = target.position + target.size / 2 - viewportSize / 2\n } else if (snapAlignment === 'end') {\n adjustedPos = target.position + target.size - viewportSize\n }\n return Math.max(0, Math.min(maxScroll, adjustedPos))\n }\n\n const applySnap = () => {\n if (!contentRef.current?.scene || !snap) return\n\n const currentScroll = scrollRef.current\n const {\n dx: targetDx,\n dy: targetDy,\n index: snapIndex,\n } = calculateSnapDestination(currentScroll.dx, currentScroll.dy)\n\n if (targetDx === currentScroll.dx && targetDy === currentScroll.dy) {\n if (snapIndex >= 0 && onSnap) {\n onSnap(snapIndex)\n }\n return\n }\n\n const scene = contentRef.current.scene\n stopActiveTween()\n\n tweenRef.current = scene.tweens.add({\n targets: { dx: currentScroll.dx, dy: currentScroll.dy },\n dx: targetDx,\n dy: targetDy,\n duration: 250,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { dx: number; dy: number }\n updateScroll({ dx: target.dx, dy: target.dy })\n },\n onComplete: () => {\n tweenRef.current = null\n if (snapIndex >= 0 && onSnap) {\n onSnap(snapIndex)\n }\n },\n })\n }\n\n const handleVerticalScroll = (scrollPos: number) => {\n const clampedScrollPos = Math.max(0, Math.min(maxScrollY, scrollPos))\n updateScroll((prev) => ({ ...prev, dy: clampedScrollPos }))\n }\n\n const handleHorizontalScroll = (scrollPos: number) => {\n const clampedScrollPos = Math.max(0, Math.min(maxScrollX, scrollPos))\n updateScroll((prev) => ({ ...prev, dx: clampedScrollPos }))\n }\n\n const handleSliderMomentumEnd = () => {\n if (snap) {\n applySnap()\n }\n }\n\n const handleTouchMove = (data: GestureEventData) => {\n // Process start and move events, ignore end\n if (data.state === 'end') {\n const velocity = velocityRef.current\n if (momentum && (Math.abs(velocity.vx) > 0.1 || Math.abs(velocity.vy) > 0.1)) {\n startMomentum()\n } else if (snap) {\n applySnap()\n }\n return\n }\n if (data.state === 'start') {\n stopActiveTween()\n if (scheduledFrameRef.current !== null) {\n cancelAnimationFrame(scheduledFrameRef.current)\n scheduledFrameRef.current = null\n }\n pendingDeltaRef.current = { dx: 0, dy: 0 }\n velocityRef.current = { vx: 0, vy: 0 }\n lastTimeRef.current = Date.now()\n data.stopPropagation()\n return\n }\n data.stopPropagation()\n\n const deltaX = data.dx ?? 0\n const deltaY = data.dy ?? 0\n\n // Calculate velocity for momentum\n const now = Date.now()\n const deltaTime = now - lastTimeRef.current\n if (deltaTime > 0) {\n const newVx = (deltaX / deltaTime) * 1000 // pixels per second\n const newVy = (deltaY / deltaTime) * 1000\n velocityRef.current = { vx: newVx, vy: newVy }\n lastTimeRef.current = now\n }\n\n queueScrollDelta(deltaX, deltaY)\n }\n\n const handleWheel = (data: WheelEventData) => {\n data.stopPropagation()\n data.preventDefault()\n\n stopActiveTween()\n queueScrollDelta(-data.deltaX, -data.deltaY)\n\n if (snap) {\n if (wheelSnapTimeoutRef.current) {\n clearTimeout(wheelSnapTimeoutRef.current)\n }\n wheelSnapTimeoutRef.current = setTimeout(() => applySnap(), WHEEL_SNAP_DELAY)\n }\n }\n\n // Force redraw after mount to ensure dimensions are calculated\n // and show content after that to avoid visual glitches\n const redraw = useRedraw()\n const [visible, setVisible] = useState(false)\n\n useLayoutEffect(() => {\n // Force multiple redraws to ensure container dimensions are properly calculated\n // First redraw after initial mount\n redraw()\n setVisible(true)\n return () => {\n if (scheduledFrameRef.current !== null) {\n cancelAnimationFrame(scheduledFrameRef.current)\n scheduledFrameRef.current = null\n }\n pendingDeltaRef.current = { dx: 0, dy: 0 }\n if (wheelSnapTimeoutRef.current) {\n clearTimeout(wheelSnapTimeoutRef.current)\n }\n stopActiveTween()\n }\n }, [showVerticalSliderActual, showHorizontalSliderActual])\n\n const resolvedVisible =\n viewProps.visible === 'none' ? 'none' : visible ? (viewProps.visible ?? true) : false\n\n return (\n <View {...viewProps} visible={resolvedVisible}>\n <View direction=\"row\" width=\"100%\" height=\"100%\" gap={0} padding={0}>\n {/* ScrollView takes remaining space */}\n <View flex={1} height={'100%'} direction=\"column\">\n <View\n ref={viewportRef}\n flex={1}\n width=\"100%\"\n //backgroundColor={0x0000ff}\n //backgroundAlpha={0.3}\n onTouchMove={handleTouchMove}\n onWheel={handleWheel}\n overflow=\"hidden\"\n direction=\"stack\"\n >\n {/* main scroll view area, can be greater than parent */}\n <View ref={contentRef} x={-scroll.dx} y={-scroll.dy}>\n {children}\n </View>\n\n {/* Invisible blocker overlay - same size as content, scrolls with content\n Blocks touches to masked content outside visible viewport area */}\n <View\n width={effectiveContentWidth}\n height={effectiveContentHeight}\n x={-scroll.dx}\n y={-scroll.dy}\n enableGestures={true}\n backgroundAlpha={0}\n onTouch={(data) => {\n const viewport = viewportRef.current\n if (!viewport) return\n\n // Get viewport world position using transform matrix\n const worldMatrix = viewport.getWorldTransformMatrix()\n const vpWorldX = worldMatrix.tx\n const vpWorldY = worldMatrix.ty\n\n // Get viewport size from layout\n const vpSize = (\n viewport as unknown as {\n __getLayoutSize?: () => { width: number; height: number }\n }\n ).__getLayoutSize?.() ?? {\n width: viewportWidth,\n height: viewportHeight,\n }\n\n // Get touch position in world coordinates\n const touchX = data.pointer?.worldX ?? 0\n const touchY = data.pointer?.worldY ?? 0\n\n // Check if touch is within viewport bounds\n // Use small epsilon for floating point comparison\n const epsilon = 0.1\n const inBounds =\n touchX >= vpWorldX - epsilon &&\n touchX <= vpWorldX + vpSize.width + epsilon &&\n touchY >= vpWorldY - epsilon &&\n touchY <= vpWorldY + vpSize.height + epsilon\n\n if (!inBounds) {\n // Touch outside viewport - block it\n data.stopPropagation()\n }\n // If in bounds, let it pass through to children below\n }}\n />\n </View>\n {/* Horizontal slider at the bottom */}\n <View visible={showHorizontalSliderActual ? true : 'none'}>\n <ScrollSlider\n direction=\"horizontal\"\n size={sliderSizeVariant}\n scrollPosition={scroll.dx}\n viewportSize={viewportWidth}\n contentSize={contentWidth}\n onScroll={handleHorizontalScroll}\n momentum={momentum}\n onMomentumEnd={handleSliderMomentumEnd}\n />\n </View>\n </View>\n\n {/* Vertical slider on the right */}\n <View height={'100%'} direction=\"column\" visible={showVerticalSliderActual ? true : 'none'}>\n <View flex={1}>\n <ScrollSlider\n direction=\"vertical\"\n size={sliderSizeVariant}\n scrollPosition={scroll.dy}\n viewportSize={viewportHeight}\n contentSize={effectiveContentHeight}\n onScroll={handleVerticalScroll}\n momentum={momentum}\n onMomentumEnd={handleSliderMomentumEnd}\n />\n </View>\n {showHorizontalSliderActual && (\n // Placeholder corner for potential icon - matches slider dimensions\n <View\n width={sliderSize}\n height={sliderSize}\n //backgroundAlpha={0.3}\n //backgroundColor={0xff0000}\n />\n )}\n </View>\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * ListBox component — scrollable single-selection list with hover states.\n * Keyboard navigation is deferred until a focus-management system is in place.\n */\nimport type { ViewProps } from '..'\nimport { useEffect, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\nimport { ScrollView, type ScrollViewProps } from './ScrollView'\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface ListBoxLabels {\n empty?: string\n}\n\nexport interface ListBoxItem {\n /** Unique item value used for selection. */\n value: string\n /** Visible label. Falls back to value when no children/renderItem provided. */\n label?: string\n /** Disabled items cannot be selected. */\n disabled?: boolean\n}\n\nexport interface ListBoxItemRenderProps {\n item: ListBoxItem\n selected: boolean\n disabled: boolean\n hovered: boolean\n index: number\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n}\n\nexport interface ListBoxThemeSlot extends ViewTheme {\n itemHeight?: number\n itemGap?: number\n itemPadding?: ViewTheme['padding']\n itemCornerRadius?: number\n itemStyle?: ViewTheme\n itemHoverStyle?: ViewTheme\n itemSelectedStyle?: ViewTheme\n itemDisabledStyle?: ViewTheme\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n selectedTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n disabledTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n emptyStyle?: Phaser.Types.GameObjects.Text.TextStyle\n disabledAlpha?: number\n labels?: ListBoxLabels\n}\n\nexport interface ListBoxProps extends Omit<ViewProps, 'children'> {\n /** Available items. */\n items: ListBoxItem[]\n /** Selected value in controlled mode. */\n value?: string\n /** Initial selected value in uncontrolled mode. */\n defaultValue?: string\n /** Called when a selectable item is selected. */\n onChange?: (value: string) => void\n /** Render custom item content. */\n renderItem?: (props: ListBoxItemRenderProps) => ChildrenType\n /** Enable hover state tracking and hover styling. Default true. */\n hoverable?: boolean\n /** Localized labels. */\n labels?: ListBoxLabels\n /** Disabled state for the whole control. */\n disabled?: boolean\n /** Maximum visible items before scrolling. If unset, the list grows to fit. */\n maxVisibleItems?: number\n /** Props forwarded to the underlying ScrollView (sliderSize, momentum, etc.). */\n scrollViewProps?: Pick<\n ScrollViewProps,\n | 'sliderSize'\n | 'showVerticalSlider'\n | 'showHorizontalSlider'\n | 'momentum'\n | 'snap'\n | 'snapAlignment'\n | 'snapThreshold'\n | 'onSnap'\n >\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\n// ─── Helpers ─────────────────────────────────────────────────────────────────\n\n/**\n * Finds an item by its value in the items array.\n */\nexport function findListBoxItem(\n items: ListBoxItem[],\n value: string | undefined\n): ListBoxItem | undefined {\n if (value === undefined) return undefined\n return items.find((item) => item.value === value)\n}\n\n/**\n * Resolves the effective value considering controlled/uncontrolled mode and disabled items.\n */\nexport function resolveListBoxValue(\n items: ListBoxItem[],\n value?: string,\n defaultValue?: string\n): string {\n if (value !== undefined) {\n return findListBoxItem(items, value)?.value ?? ''\n }\n\n const defaultItem = findListBoxItem(items, defaultValue)\n if (defaultItem) return defaultItem.value\n\n return items.find((item) => !item.disabled)?.value ?? items[0]?.value ?? ''\n}\n\nfunction mergeViewTheme(...themes: Array<ViewTheme | undefined>): ViewTheme {\n return Object.assign({}, ...themes.filter(Boolean))\n}\n\nfunction mergeTextStyle(\n ...styles: Array<Phaser.Types.GameObjects.Text.TextStyle | undefined>\n): Phaser.Types.GameObjects.Text.TextStyle | undefined {\n const merged = Object.assign({}, ...styles.filter(Boolean))\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\nfunction omitListBoxThemeProps(theme: ListBoxThemeSlot): ViewTheme {\n const {\n itemHeight: _ih,\n itemGap: _ig,\n itemPadding: _ip,\n itemCornerRadius: _icr,\n itemStyle: _is,\n itemHoverStyle: _ihs,\n itemSelectedStyle: _iss,\n itemDisabledStyle: _ids,\n textStyle: _ts,\n selectedTextStyle: _sts,\n disabledTextStyle: _dts,\n emptyStyle: _es,\n disabledAlpha: _da,\n labels: _l,\n ...viewTheme\n } = theme\n return viewTheme\n}\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\n/**\n * ListBox — scrollable single-selection list.\n */\nexport function ListBox(props: ListBoxProps): VNodeLike {\n const {\n items,\n value,\n defaultValue,\n onChange,\n renderItem,\n hoverable = true,\n scrollViewProps,\n labels: labelOverrides,\n disabled = false,\n maxVisibleItems,\n theme,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('ListBox', mergedLocalTheme, {})\n const themedControl = themed as unknown as ListBoxThemeSlot\n const [hoveredValue, setHoveredValue] = useState<string | undefined>(undefined)\n\n const isControlled = value !== undefined\n const initialValue = resolveListBoxValue(items, value, defaultValue)\n const [internalValue, setInternalValue] = useState(initialValue)\n const currentValue = isControlled\n ? resolveListBoxValue(items, value)\n : resolveListBoxValue(items, internalValue)\n\n useEffect(() => {\n if (!isControlled && internalValue !== currentValue) {\n setInternalValue(currentValue)\n }\n }, [isControlled, internalValue, currentValue])\n\n const labels = {\n ...(themedControl.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n\n // ── Text styles ──────────────────────────────────────────────────────────\n\n const textStyle = mergeTextStyle({ color: '#e0e7ff', fontSize: '14px' }, themedControl.textStyle)\n const selectedTextStyle = mergeTextStyle(textStyle, themedControl.selectedTextStyle)\n const disabledTextStyle = mergeTextStyle(textStyle, themedControl.disabledTextStyle)\n const emptyStyle = themedControl.emptyStyle ?? { color: '#6b7280', fontSize: '14px' }\n const finalAlpha = disabled ? (themedControl.disabledAlpha ?? 0.5) : alpha\n\n // ── Commit value ─────────────────────────────────────────────────────────\n\n const commitValue = (nextValue: string) => {\n const item = findListBoxItem(items, nextValue)\n if (!item || item.disabled || disabled) return\n\n if (!isControlled) {\n setInternalValue(nextValue)\n }\n\n onChange?.(nextValue)\n }\n\n // ── Item sizes ───────────────────────────────────────────────────────────\n\n const itemHeight = themedControl.itemHeight ?? 36\n const itemGap = themedControl.itemGap ?? 1\n const totalItemHeight = items.length * (itemHeight + itemGap) - (items.length > 0 ? itemGap : 0)\n const listHeight =\n maxVisibleItems && maxVisibleItems > 0\n ? Math.min(totalItemHeight, maxVisibleItems * (itemHeight + itemGap))\n : totalItemHeight\n\n // ── Render items ─────────────────────────────────────────────────────────\n\n const rootThemeProps = omitListBoxThemeProps(themedControl)\n\n const renderListItem = (item: ListBoxItem, index: number) => {\n const selected = item.value === currentValue\n const itemDisabled = disabled || !!item.disabled\n const hovered = hoverable ? hoveredValue === item.value : false\n const selectable = !itemDisabled\n\n const itemStyle = mergeViewTheme(\n { height: itemHeight },\n themedControl.itemStyle,\n hoverable && hovered && !selected && !itemDisabled ? themedControl.itemHoverStyle : undefined,\n selected ? themedControl.itemSelectedStyle : undefined,\n itemDisabled ? themedControl.itemDisabledStyle : undefined\n )\n\n const effectiveTextStyle = itemDisabled\n ? disabledTextStyle\n : selected\n ? selectedTextStyle\n : textStyle\n\n const contentTheme = mergeThemes(nestedTheme, {\n Text: effectiveTextStyle ? { style: effectiveTextStyle } : {},\n })\n\n const content = renderItem?.({\n item,\n selected,\n disabled: itemDisabled,\n hovered,\n index,\n ...(effectiveTextStyle ? { textStyle: effectiveTextStyle } : {}),\n })\n\n const hoverHandlers =\n hoverable && selectable && (themedControl.itemHoverStyle || themedControl.itemSelectedStyle)\n ? {\n onHoverStart: () => setHoveredValue(item.value),\n onHoverEnd: () =>\n setHoveredValue((current) => (current === item.value ? undefined : current)),\n }\n : {}\n\n return (\n <View\n key={item.value}\n width={'fill'}\n direction=\"row\"\n alignItems=\"center\"\n padding={themedControl.itemPadding}\n cornerRadius={themedControl.itemCornerRadius}\n {...itemStyle}\n enableGestures={selectable}\n onTouch={() => commitValue(item.value)}\n {...hoverHandlers}\n theme={contentTheme}\n >\n {content ?? (\n <Text\n text={item.label ?? item.value}\n {...(effectiveTextStyle ? { style: effectiveTextStyle } : {})}\n />\n )}\n </View>\n )\n }\n\n const emptyLabel = labels.empty ?? 'No items'\n\n return (\n <View\n {...viewProps}\n {...rootThemeProps}\n {...(finalAlpha !== undefined ? { alpha: finalAlpha } : {})}\n theme={nestedTheme}\n overflow=\"hidden\"\n >\n {items.length === 0 ? (\n <View alignItems=\"center\" justifyContent=\"center\" height={itemHeight * 3}>\n <Text text={emptyLabel} style={emptyStyle} />\n </View>\n ) : (\n <ScrollView\n height={listHeight > 0 ? listHeight : undefined}\n width=\"fill\"\n theme={nestedTheme}\n {...scrollViewProps}\n >\n <View direction=\"column\" gap={itemGap} width=\"fill\" theme={nestedTheme}>\n {items.map(renderListItem)}\n </View>\n </ScrollView>\n )}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Portal component - renders children into a separate tree at specified depth\n * Enables overlays, modals, tooltips without affecting parent tree layout\n */\nimport * as Phaser from 'phaser'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport type { VNode } from '../../hooks'\nimport { useEffect, useMemo, useRef, useScene } from '../../hooks'\nimport { DeferredLayoutQueue } from '../../layout/layout-engine'\nimport type { LayoutSize } from '../../layout/types'\nimport { portalRegistry } from '../../portal'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { mount, patchVNode, unmount } from '../../vdom'\n\n/**\n * Props for Portal component\n */\nexport interface PortalProps {\n /** Unique key for VDOM identification */\n key?: string | number | undefined\n /** Content to render in portal */\n children: ChildrenType\n /** Z-depth for portal (higher = foreground) */\n depth?: number\n /** Optional custom portal ID */\n id?: string\n /** Block events (click-through and scrolling) - default: true */\n blockEvents?: boolean\n}\n\n/**\n * Portal component\n * Renders child VNode into a separate container tree at specified depth.\n * Automatically injects event blockers to prevent click-through and scrolling.\n *\n * @example\n * ```tsx\n * // Basic portal (automatically blocks events in content area)\n * <Portal depth={1000}>\n * <View>Overlay content</View>\n * </Portal>\n *\n * // Non-blocking portal (allows click-through)\n * <Portal depth={500} blockEvents={false}>\n * <View>Info overlay - clickable background</View>\n * </Portal>\n *\n * // Portal with custom event handling (original handlers are preserved)\n * <Portal depth={1000}>\n * <View onTouch={(e) => console.log('clicked')}>\n * Content\n * </View>\n * </Portal>\n * ```\n */\nexport function Portal(props: PortalProps): VNodeLike {\n const portalId = useMemo(() => props.id ?? portalRegistry.generateId(), [props.id])\n const depth = props.depth ?? 1000\n const scene = useScene()\n const blockEvents = props.blockEvents ?? true\n const mountedNodesRef = useRef<Phaser.GameObjects.GameObject[]>([])\n const previousChildrenRef = useRef<VNode[]>([])\n const normalizeChildren = (children: ChildrenType): VNode[] => {\n if (!children) return []\n const flat = Array.isArray(children) ? (children as unknown[]).flat(Infinity) : [children]\n return flat.filter(\n (child): child is VNode => !!child && typeof child === 'object' && 'type' in child\n )\n }\n\n // Initial mount effect - runs once\n useEffect(() => {\n // Register portal with depth-based container first\n const portalContainer = portalRegistry.register(\n portalId,\n depth,\n scene,\n { type: 'View', props: {}, children: [] },\n scene.add.container(0, 0)\n )\n\n // Create invisible blocker container if blockEvents enabled\n let blockerContainer: Phaser.GameObjects.Container | null = null\n if (blockEvents) {\n blockerContainer = scene.add.container(0, 0)\n portalContainer.add(blockerContainer)\n // Set depth to be behind content (will be adjusted after mount)\n blockerContainer.setDepth(-1)\n }\n\n // Mount children directly (preserves absolute positioning)\n const children = normalizeChildren(props.children)\n const mountedNodes: Phaser.GameObjects.GameObject[] = []\n\n for (const child of children) {\n if (child) {\n const mountedNode = mount(portalContainer, child)\n if (mountedNode) {\n portalContainer.add(mountedNode)\n mountedNodes.push(mountedNode)\n }\n }\n }\n\n mountedNodesRef.current = mountedNodes\n previousChildrenRef.current = children\n\n // Register event blocker on invisible container AFTER layout completes\n const gestureManager = getGestureManager(scene)\n if (blockEvents && blockerContainer) {\n const blocker = blockerContainer\n DeferredLayoutQueue.defer(() => {\n // Get layout dimensions from first mounted child (content)\n const firstChild = portalContainer.getAt(1) as Phaser.GameObjects.Container & {\n __cachedLayoutSize?: LayoutSize\n __getLayoutSize?: () => LayoutSize\n }\n\n if (!firstChild) return\n\n // Get dimensions from layout system\n const { width, height } = firstChild.__cachedLayoutSize\n ? firstChild.__cachedLayoutSize\n : firstChild.__getLayoutSize\n ? firstChild.__getLayoutSize()\n : (() => {\n const bounds = firstChild.getBounds()\n return { width: bounds.width, height: bounds.height }\n })()\n\n // Position blocker at same location as content\n const x = firstChild.x\n const y = firstChild.y\n blocker.setPosition(x, y)\n\n // Register blocker container (not content!) with event blockers\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n gestureManager.registerContainer(\n blocker,\n {\n onTouch: (e) => {\n e.stopPropagation()\n },\n onTouchMove: (e) => {\n e.stopPropagation()\n },\n },\n hitArea\n )\n })\n }\n\n // Cleanup on unmount\n return () => {\n if (blockEvents && blockerContainer) {\n gestureManager.unregisterContainer(blockerContainer)\n }\n portalRegistry.unregister(portalId)\n }\n }, [portalId, depth, scene, blockEvents])\n\n // Update effect - patches children when they change\n useEffect(() => {\n const portal = portalRegistry.get(portalId)\n if (!portal) return\n\n const portalContainer = portal.container\n\n const newChildren = normalizeChildren(props.children)\n const oldChildren = previousChildrenRef.current\n\n // Patch each child\n const maxLen = Math.max(oldChildren.length, newChildren.length)\n for (let i = 0; i < maxLen; i++) {\n const oldChild = oldChildren[i] as VNode | null | undefined\n const newChild = newChildren[i] as VNode | null | undefined\n\n if (oldChild && newChild) {\n // Patch existing child\n patchVNode(portalContainer, oldChild, newChild)\n } else if (!oldChild && newChild) {\n // Mount new child\n const mountedNode = mount(portalContainer, newChild)\n if (mountedNode) {\n portalContainer.add(mountedNode)\n mountedNodesRef.current.push(mountedNode)\n }\n } else if (oldChild && !newChild) {\n // Unmount removed child\n unmount(oldChild)\n }\n }\n\n previousChildrenRef.current = newChildren\n }, [props.children, portalId])\n\n // Portal renders nothing in parent tree\n return null\n}\n","import { useCallback, useEffect, useRef, useState } from '../../hooks'\n\nexport type OverlayPresencePhase = 'entering' | 'entered' | 'exiting' | 'exited'\n\nexport interface OverlayPresenceState {\n isPresent: boolean\n phase: OverlayPresencePhase\n finishEnter: () => void\n finishExit: () => void\n}\n\nexport function useOverlayPresence(show: boolean): OverlayPresenceState {\n const [isPresent, setIsPresent] = useState(show)\n const [phase, setPhase] = useState<OverlayPresencePhase>(show ? 'entered' : 'exited')\n const previousShow = useRef(show)\n\n useEffect(() => {\n if (show) {\n setIsPresent(true)\n if (!previousShow.current) {\n setPhase('entering')\n }\n } else if (previousShow.current) {\n setPhase('exiting')\n }\n\n previousShow.current = show\n }, [show])\n\n const finishEnter = useCallback(() => {\n setPhase((current) => (current === 'entering' ? 'entered' : current))\n }, [])\n\n const finishExit = useCallback(() => {\n setIsPresent(false)\n setPhase('exited')\n }, [])\n\n return { isPresent, phase, finishEnter, finishExit }\n}\n","/** @jsxImportSource ../.. */\n/**\n * Popover and ContextMenu components - portal-based overlays that do not participate in parent layout.\n */\nimport type * as Phaser from 'phaser'\nimport {\n createFadeInEffect,\n createFadeOutEffect,\n useGameObjectEffect,\n type EffectFn,\n} from '../../effects/use-effect'\nimport type { GestureEventData } from '../../gestures/gesture-types'\nimport { useEffect, useRef, useScene, useState, useTheme } from '../../hooks'\nimport { DeferredLayoutQueue } from '../../layout/layout-engine'\nimport type { GameObjectWithLayout, LayoutSize } from '../../layout/types'\nimport { portalRegistry } from '../../portal'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { ChildrenType, Ref } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View, type ViewProps } from '../index'\nimport { Portal } from './Portal'\nimport { useOverlayPresence } from './useOverlayPresence'\n\nexport type PopoverPlacement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n\nexport interface OverlayAnchorRect {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport interface OverlayContentSize {\n width: number\n height: number\n}\n\nexport interface OverlayPositionOptions {\n anchor: OverlayAnchorRect\n content: OverlayContentSize\n placement: PopoverPlacement\n offset: number\n viewport?: OverlayContentSize | undefined\n viewportPadding?: number | undefined\n}\n\nexport interface OverlayPosition {\n x: number\n y: number\n placement: PopoverPlacement\n}\n\nexport interface PopoverProps {\n /** Unique key for VDOM identification. */\n key?: string | number | undefined\n /** Trigger content rendered in normal layout. */\n trigger: ChildrenType\n /** Overlay content rendered through Portal. */\n children: ChildrenType\n /** Controlled open state. */\n isOpen?: boolean\n /** Initial open state for uncontrolled usage. */\n defaultOpen?: boolean\n /** Called when open state should change. */\n onOpenChange?: (open: boolean) => void\n /** Placement relative to the trigger. */\n placement?: PopoverPlacement\n /** Distance between trigger and content. */\n offset?: number\n /** Portal depth. */\n depth?: number\n /** Close when clicking outside. */\n closeOnOutside?: boolean\n /** Close on Escape key. */\n closeOnEscape?: boolean\n /** Disable trigger interaction. */\n disabled?: boolean\n /** Optional fixed width override. By default Popover measures its content after layout. */\n contentWidth?: number\n /** Optional fixed height override. By default Popover measures its content after layout. */\n contentHeight?: number\n /** Use trigger width for content width. */\n matchTriggerWidth?: boolean\n /** Padding inside the viewport clamp. */\n viewportPadding?: number\n /** Custom effect for showing overlay content. */\n openEffect?: EffectFn\n /** Custom effect for hiding overlay content. */\n closeEffect?: EffectFn\n /** Open animation duration in milliseconds. */\n openDuration?: number\n /** Close animation duration in milliseconds. */\n closeDuration?: number\n /** Props applied to the trigger wrapper. */\n triggerProps?: Omit<ViewProps, 'children'>\n /** Props applied to the content wrapper. */\n contentProps?: Omit<ViewProps, 'children'>\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nexport interface ContextMenuItem {\n id: string\n label: string\n disabled?: boolean\n danger?: boolean\n prefix?: ChildrenType\n suffix?: ChildrenType\n onSelect?: () => void\n}\n\nexport interface ContextMenuProps extends Omit<\n PopoverProps,\n 'children' | 'contentWidth' | 'contentHeight' | 'contentProps' | 'matchTriggerWidth'\n> {\n /** Menu items shown in the context menu. */\n items: ContextMenuItem[]\n /** Menu width. */\n width?: number\n /** Called when an item is selected. */\n onSelect?: (item: ContextMenuItem) => void\n}\n\nfunction getMainPlacement(placement: PopoverPlacement): 'top' | 'bottom' | 'left' | 'right' {\n return placement.split('-')[0] as 'top' | 'bottom' | 'left' | 'right'\n}\n\nfunction getCrossPlacement(placement: PopoverPlacement): 'center' | 'start' | 'end' {\n return (placement.split('-')[1] as 'start' | 'end' | undefined) ?? 'center'\n}\n\nexport function calculateOverlayPosition(options: OverlayPositionOptions): OverlayPosition {\n const { anchor, content, placement, offset } = options\n const main = getMainPlacement(placement)\n const cross = getCrossPlacement(placement)\n\n let x: number\n let y: number\n\n if (main === 'top' || main === 'bottom') {\n y = main === 'top' ? anchor.y - content.height - offset : anchor.y + anchor.height + offset\n\n if (cross === 'start') x = anchor.x\n else if (cross === 'end') x = anchor.x + anchor.width - content.width\n else x = anchor.x + (anchor.width - content.width) / 2\n } else {\n x = main === 'left' ? anchor.x - content.width - offset : anchor.x + anchor.width + offset\n\n if (cross === 'start') y = anchor.y\n else if (cross === 'end') y = anchor.y + anchor.height - content.height\n else y = anchor.y + (anchor.height - content.height) / 2\n }\n\n const viewport = options.viewport\n if (viewport) {\n const padding = options.viewportPadding ?? 8\n x = Math.min(Math.max(padding, x), Math.max(padding, viewport.width - content.width - padding))\n y = Math.min(\n Math.max(padding, y),\n Math.max(padding, viewport.height - content.height - padding)\n )\n }\n\n return { x, y, placement }\n}\n\nfunction getLayoutSize(container: Phaser.GameObjects.Container | null): LayoutSize {\n const withLayout = container as GameObjectWithLayout | null\n return (\n withLayout?.__getLayoutSize?.() ?? withLayout?.__cachedLayoutSize ?? { width: 0, height: 0 }\n )\n}\n\nfunction getWorldPosition(container: Phaser.GameObjects.Container): { x: number; y: number } {\n const withMatrix = container as Phaser.GameObjects.Container & {\n getWorldTransformMatrix?: () => { tx: number; ty: number }\n }\n const matrix = withMatrix.getWorldTransformMatrix?.()\n if (matrix) return { x: matrix.tx, y: matrix.ty }\n return { x: container.x ?? 0, y: container.y ?? 0 }\n}\n\nfunction getAnchorRect(container: Phaser.GameObjects.Container | null): OverlayAnchorRect {\n if (!container) return { x: 0, y: 0, width: 0, height: 0 }\n\n const size = getLayoutSize(container)\n const position = getWorldPosition(container)\n\n return {\n x: position.x,\n y: position.y,\n width: size.width,\n height: size.height,\n }\n}\n\nconst FALLBACK_CONTENT_SIZE: OverlayContentSize = { width: 220, height: 120 }\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null): void {\n if (!ref) return\n if (typeof ref === 'function') {\n ref(value)\n return\n }\n ref.current = value\n}\n\nexport function Popover(props: PopoverProps): VNodeLike {\n const localTheme = useTheme()\n const mergedLocalTheme = props.theme ? mergeThemes(localTheme ?? {}, props.theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Popover', mergedLocalTheme, {})\n const scene = useScene()\n const triggerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const contentRef = useRef<Phaser.GameObjects.Container | null>(null)\n const [measuredContentSize, setMeasuredContentSize] = useState<OverlayContentSize | null>(null)\n const [internalOpen, setInternalOpen] = useState(props.defaultOpen ?? false)\n const isControlled = props.isOpen !== undefined\n const isOpen = isControlled ? props.isOpen === true : internalOpen\n const presence = useOverlayPresence(isOpen)\n const { applyEffect: contentAnimation, stopEffects: stopContentEffects } =\n useGameObjectEffect(contentRef)\n\n const placement = props.placement ?? themed.placement ?? 'bottom'\n const offset = props.offset ?? themed.offset ?? 8\n const depth = props.depth ?? themed.depth ?? 1100\n const closeOnOutside = props.closeOnOutside ?? themed.closeOnOutside ?? true\n const closeOnEscape = props.closeOnEscape ?? themed.closeOnEscape ?? true\n const viewportPadding = props.viewportPadding ?? themed.viewportPadding ?? 8\n const openEffect = props.openEffect ?? themed.openEffect ?? createFadeInEffect\n const closeEffect = props.closeEffect ?? themed.closeEffect ?? createFadeOutEffect\n const openDuration = props.openDuration ?? themed.openDuration ?? 120\n const closeDuration = props.closeDuration ?? themed.closeDuration ?? 100\n const explicitContentWidth = props.contentWidth ?? themed.contentWidth\n const explicitContentHeight = props.contentHeight ?? themed.contentHeight\n const viewport = portalRegistry.getViewportSize(scene)\n const anchor = getAnchorRect(triggerRef.current)\n const measuredWidth = measuredContentSize?.width ?? FALLBACK_CONTENT_SIZE.width\n const measuredHeight = measuredContentSize?.height ?? FALLBACK_CONTENT_SIZE.height\n const needsMeasurement = explicitContentWidth === undefined || explicitContentHeight === undefined\n const isPositionReady = !needsMeasurement || measuredContentSize !== null\n const contentWidth = props.matchTriggerWidth\n ? Math.max(anchor.width, explicitContentWidth ?? measuredWidth)\n : (explicitContentWidth ?? measuredWidth)\n const contentHeight = explicitContentHeight ?? measuredHeight\n const overlayPosition = calculateOverlayPosition({\n anchor,\n content: { width: contentWidth, height: contentHeight },\n placement,\n offset,\n viewport,\n viewportPadding,\n })\n\n const setOpen = (open: boolean) => {\n if (props.disabled && open) return\n if (!isControlled) setInternalOpen(open)\n props.onOpenChange?.(open)\n }\n\n const toggleOpen = (event: GestureEventData) => {\n event.stopPropagation()\n setOpen(!isOpen)\n }\n\n const close = (event?: GestureEventData) => {\n event?.stopPropagation()\n setOpen(false)\n }\n\n const contentProps = props.contentProps ?? {}\n const contentPropsRef = contentProps.ref as Ref<Phaser.GameObjects.Container> | undefined\n const contentPropsAlpha = contentProps.alpha\n const handleContentRef = (container: Phaser.GameObjects.Container | null) => {\n contentRef.current = container\n assignRef(contentPropsRef, container)\n }\n\n useEffect(() => {\n if (!closeOnEscape || !isOpen) return\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpen(false)\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n return () => window.removeEventListener('keydown', handleKeyDown)\n }, [closeOnEscape, isOpen])\n\n useEffect(() => {\n if (!presence.isPresent) return\n\n DeferredLayoutQueue.defer(() => {\n const size = getLayoutSize(contentRef.current)\n if (size.width <= 0 || size.height <= 0) return\n\n setMeasuredContentSize((current) => {\n if (current?.width === size.width && current?.height === size.height) return current\n return { width: size.width, height: size.height }\n })\n })\n }, [presence.isPresent, props.children, explicitContentWidth, explicitContentHeight])\n\n useEffect(() => {\n const content = contentRef.current\n if (!content || !presence.isPresent) return\n\n if (presence.phase === 'entering') {\n if (!isPositionReady) return\n\n stopContentEffects()\n content.setVisible(true)\n contentAnimation(openEffect, {\n time: openDuration,\n onComplete: presence.finishEnter,\n })\n } else if (presence.phase === 'exiting') {\n stopContentEffects()\n contentAnimation(closeEffect, {\n time: closeDuration,\n onComplete: () => {\n contentRef.current?.setVisible(false)\n setMeasuredContentSize(null)\n presence.finishExit()\n },\n })\n }\n }, [presence.phase, presence.isPresent, isPositionReady, openDuration, closeDuration])\n\n return (\n <>\n <View\n {...(props.triggerProps ?? {})}\n ref={triggerRef}\n enableGestures={!props.disabled}\n onTouch={toggleOpen}\n >\n {props.trigger}\n </View>\n\n {presence.isPresent && (\n <Portal depth={depth} blockEvents={false}>\n {closeOnOutside && (\n <View\n width={viewport.width}\n height={viewport.height}\n backgroundColor={0x000000}\n backgroundAlpha={0}\n onTouch={close}\n onTouchMove={(event: GestureEventData) => event.stopPropagation()}\n />\n )}\n <View\n direction=\"column\"\n backgroundColor={themed.backgroundColor ?? 0x111827}\n borderColor={themed.borderColor ?? 0x334155}\n borderWidth={themed.borderWidth ?? 1}\n cornerRadius={themed.cornerRadius ?? 8}\n padding={themed.padding ?? 10}\n gap={themed.gap ?? 8}\n {...contentProps}\n ref={handleContentRef}\n x={overlayPosition.x}\n y={overlayPosition.y}\n {...(props.matchTriggerWidth || explicitContentWidth !== undefined\n ? { width: contentWidth }\n : {})}\n {...(isPositionReady\n ? contentPropsAlpha !== undefined\n ? { alpha: contentPropsAlpha }\n : {}\n : { alpha: 0 })}\n onTouch={(event: GestureEventData) => event.stopPropagation()}\n theme={nestedTheme}\n >\n {props.children}\n </View>\n </Portal>\n )}\n </>\n )\n}\n\nexport function ContextMenu(props: ContextMenuProps): VNodeLike {\n const {\n items,\n width: explicitWidth,\n onSelect,\n isOpen: explicitOpen,\n defaultOpen,\n onOpenChange,\n ...popoverProps\n } = props\n const localTheme = useTheme()\n const mergedLocalTheme = props.theme ? mergeThemes(localTheme ?? {}, props.theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('ContextMenu', mergedLocalTheme, {})\n const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false)\n const isControlled = explicitOpen !== undefined\n const isOpen = isControlled ? explicitOpen === true : internalOpen\n const width = explicitWidth ?? themed.width ?? 220\n const itemHeight = themed.itemHeight ?? 34\n\n const setOpen = (open: boolean) => {\n if (!isControlled) setInternalOpen(open)\n onOpenChange?.(open)\n }\n\n const handleSelect = (item: ContextMenuItem) => {\n if (item.disabled) return\n item.onSelect?.()\n onSelect?.(item)\n setOpen(false)\n }\n\n return (\n <Popover\n {...popoverProps}\n isOpen={isOpen}\n onOpenChange={setOpen}\n contentWidth={width}\n contentHeight={Math.max(1, items.length) * itemHeight + 20}\n contentProps={{\n padding: themed.padding ?? 6,\n gap: themed.gap ?? 2,\n backgroundColor: themed.backgroundColor,\n borderColor: themed.borderColor,\n borderWidth: themed.borderWidth,\n cornerRadius: themed.cornerRadius,\n theme: nestedTheme,\n }}\n >\n {items.map((item) => {\n const textColor = item.disabled\n ? (themed.disabledTextColor ?? '#64748b')\n : item.danger\n ? (themed.dangerTextColor ?? '#fecaca')\n : (themed.textStyle?.color ?? '#f8fafc')\n\n return (\n <View\n key={item.id}\n width=\"fill\"\n height={itemHeight}\n direction=\"row\"\n alignItems=\"center\"\n gap={themed.itemGap ?? 8}\n padding={themed.itemPadding ?? { left: 10, right: 10, top: 6, bottom: 6 }}\n cornerRadius={themed.itemCornerRadius ?? 5}\n backgroundColor={item.danger ? (themed.dangerBackgroundColor ?? 0x1f2937) : 0x000000}\n backgroundAlpha={item.danger ? 0.35 : 0}\n enableGestures={!item.disabled}\n onTouch={(event: GestureEventData) => {\n event.stopPropagation()\n handleSelect(item)\n }}\n >\n {item.prefix}\n <View flex={1}>\n <Text text={item.label} style={{ ...(themed.textStyle ?? {}), color: textColor }} />\n </View>\n {item.suffix}\n </View>\n )\n })}\n </Popover>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * MenuButton component\n * A button that opens a context menu / popover with a list of actions.\n */\nimport { useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\nimport { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from './Button'\nimport { ContextMenu, type ContextMenuItem, type ContextMenuProps } from './Popover'\n\nexport interface MenuButtonTriggerRenderProps {\n isOpen: boolean\n disabled: boolean\n}\n\n/**\n * Props for MenuButton component\n */\nexport interface MenuButtonProps extends Omit<\n ContextMenuProps,\n 'items' | 'onSelect' | 'trigger' | 'isOpen'\n> {\n /** Unique key for VDOM identification. */\n key?: string | number | undefined\n /** Menu items shown when the button is clicked. */\n items: ContextMenuItem[]\n /** Called when an item is selected. */\n onSelect?: (item: ContextMenuItem) => void\n /** Button content. Takes precedence over icon/label convenience rendering. */\n children?: ChildrenType | undefined\n /** Convenience label for the default button. */\n label?: string | number | undefined\n /** Optional icon/glyph content. */\n icon?: ChildrenType\n /** Custom trigger renderer. Replaces the default Button. */\n trigger?: (props: MenuButtonTriggerRenderProps) => ChildrenType\n /** Controlled open state. */\n open?: boolean\n /** Button visual variant. */\n buttonVariant?: ButtonVariant\n /** Button size variant. */\n buttonSize?: ButtonSize\n /** Additional props for the generated default Button. */\n buttonProps?: Omit<\n ButtonProps,\n 'children' | 'label' | 'text' | 'onClick' | 'disabled' | 'variant' | 'size' | 'theme'\n >\n}\n\n/**\n * MenuButton component\n */\nexport function MenuButton(props: MenuButtonProps): VNodeLike {\n const {\n items,\n onSelect,\n children,\n label,\n icon,\n trigger,\n open: explicitOpen,\n defaultOpen,\n onOpenChange,\n placement,\n width,\n buttonVariant,\n buttonSize,\n buttonProps,\n disabled = false,\n theme,\n ...contextMenuProps\n } = props\n\n const localTheme = useTheme()\n const mergedTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('MenuButton', mergedTheme, {})\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false)\n const isControlled = explicitOpen !== undefined\n const isOpen = isControlled ? explicitOpen : internalOpen\n\n const handleOpenChange = (open: boolean) => {\n if (!isControlled) {\n setInternalOpen(open)\n }\n onOpenChange?.(open)\n }\n\n const handleSelect = (item: ContextMenuItem) => {\n onSelect?.(item)\n }\n\n const renderTrigger = () => {\n if (trigger) {\n return trigger({ isOpen, disabled })\n }\n\n if (children !== undefined) {\n return (\n <Button\n {...buttonProps}\n variant={buttonVariant ?? themed.buttonVariant ?? 'secondary'}\n size={buttonSize ?? themed.buttonSize ?? 'medium'}\n disabled={disabled}\n theme={nestedTheme}\n >\n {children}\n </Button>\n )\n }\n\n const hasIcon = icon !== undefined\n const hasLabel = label !== undefined\n\n return (\n <Button\n {...buttonProps}\n variant={buttonVariant ?? themed.buttonVariant ?? 'secondary'}\n size={buttonSize ?? themed.buttonSize ?? 'medium'}\n disabled={disabled}\n label={!hasIcon ? label : undefined}\n theme={nestedTheme}\n >\n {hasIcon && (\n <View\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={themed.iconGap ?? 8}\n >\n {icon}\n {hasLabel && <Text text={String(label)} />}\n </View>\n )}\n </Button>\n )\n }\n\n const contextMenuWidth = width ?? themed.width\n\n return (\n <ContextMenu\n {...contextMenuProps}\n items={items}\n onSelect={handleSelect}\n isOpen={isOpen}\n onOpenChange={handleOpenChange}\n placement={placement ?? themed.placement ?? 'bottom-start'}\n {...(contextMenuWidth !== undefined ? { width: contextMenuWidth } : {})}\n disabled={disabled}\n theme={nestedTheme}\n trigger={renderTrigger()}\n />\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * NumberInput component\n * Numeric stepper control without free-form text entry.\n */\nimport type { ViewProps } from '..'\nimport type { GestureEventData } from '../../core-props'\nimport { useEffect, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, Text, View, type GraphicsProps } from '../index'\nimport { Button, type ButtonSize, type ButtonVariant } from './Button'\n\nexport interface NumberInputLabels {\n /** Text used for the decrement button. */\n decrement?: string\n /** Text used for the increment button. */\n increment?: string\n /** Accessible/visible value label when label prop is omitted. */\n value?: string\n}\n\nexport type NumberInputLabelPosition = 'left' | 'right' | 'top' | 'bottom' | 'none'\nexport type NumberInputButtonPlacement = 'split' | 'left' | 'right'\nexport type NumberInputButtonDirection = 'row' | 'column'\nexport type NumberInputButtonAction = 'decrement' | 'increment'\nexport type NumberInputIndicatorDirection = 'left' | 'right' | 'up' | 'down'\nexport type NumberInputIndicatorVariant = 'sign' | 'chevron'\n\nexport interface NumberInputButtonRenderProps {\n action: NumberInputButtonAction\n disabled: boolean\n value: number\n nextValue: number\n size: number\n color: number\n activeColor: number\n}\n\nexport interface NumberInputValueRenderProps {\n value: number\n displayText: string\n min?: number\n max?: number\n step: number\n disabled: boolean\n canDecrement: boolean\n canIncrement: boolean\n valueWidth: number\n controlHeight: number\n}\n\nexport interface NumberInputIndicatorProps extends Omit<\n GraphicsProps,\n 'children' | 'dependencies' | 'onDraw'\n> {\n /** Indicator variant. Sign draws minus/plus; chevron draws an arrow. */\n variant?: NumberInputIndicatorVariant\n /** NumberInput action. Used by the sign variant. */\n action?: NumberInputButtonAction\n /** Chevron direction. Defaults from action when omitted. */\n direction?: NumberInputIndicatorDirection\n /** Indicator square size. */\n size?: number\n /** Stroke and border color. */\n color?: number\n /** Optional active stroke color. */\n activeColor?: number\n /** Disabled visual state. */\n disabled?: boolean\n /** Draw a framed background behind the glyph. */\n framed?: boolean\n /** Alpha applied to the framed background. */\n backgroundAlpha?: number\n /** Alpha applied to the frame border. */\n borderAlpha?: number\n}\n\nexport interface NumberInputProps extends Omit<ViewProps, 'children'> {\n /** Current value in controlled mode. */\n value?: number\n /** Initial value in uncontrolled mode. */\n defaultValue?: number\n /** Callback fired when the value changes. */\n onChange?: (value: number) => void\n /** Minimum allowed value. */\n min?: number\n /** Maximum allowed value. */\n max?: number\n /** Step used by increment and decrement controls. */\n step?: number\n /** Decimal precision. Defaults to precision inferred from step. */\n precision?: number\n /** Optional visible label. */\n label?: string\n /** Label placement relative to the numeric control. */\n labelPosition?: NumberInputLabelPosition\n /** Formatter for the displayed value. */\n formatValue?: (value: number) => string\n /** Render custom value content while preserving the NumberInput value frame. */\n renderValue?: (props: NumberInputValueRenderProps) => ChildrenType\n /** Localized button/value labels. */\n labels?: NumberInputLabels\n /** Custom decrement button content. Children take precedence over labels.decrement. */\n decrementContent?: ChildrenType\n /** Custom increment button content. Children take precedence over labels.increment. */\n incrementContent?: ChildrenType\n /** Render step button content with action, disabled state, size, and theme colors. */\n renderButtonContent?: (props: NumberInputButtonRenderProps) => ChildrenType\n /** Disable all interactions. */\n disabled?: boolean\n /** Placement of the decrement/increment buttons around the value display. */\n buttonPlacement?: NumberInputButtonPlacement\n /** Direction used when both buttons are placed on one side. */\n buttonDirection?: NumberInputButtonDirection\n /** Variant forwarded to the internal Button controls. */\n buttonVariant?: ButtonVariant\n /** Size forwarded to the internal Button controls. */\n buttonSize?: ButtonSize\n /** Text style forwarded to generated button labels. */\n buttonTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n /** Color passed to renderButtonContent and NumberInputIndicator examples. */\n buttonIndicatorColor?: number\n /** Active color passed to renderButtonContent and NumberInputIndicator examples. */\n buttonIndicatorActiveColor?: number\n /** Enable repeated changes after a long press. */\n repeatOnHold?: boolean\n /** Delay before hold repeat starts in milliseconds. */\n holdDelay?: number\n /** Interval used while holding a button in milliseconds. */\n repeatInterval?: number\n /** Width of the displayed value area. */\n valueWidth?: number\n /** Height of the control row. */\n controlHeight?: number\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nexport interface NumberInputValueOptions {\n min?: number\n max?: number\n step?: number\n precision?: number\n}\n\nconst DEFAULT_LABELS: Required<NumberInputLabels> = {\n decrement: '-',\n increment: '+',\n value: 'Value',\n}\n\nfunction getDefaultIndicatorDirection(\n action: NumberInputButtonAction\n): NumberInputIndicatorDirection {\n return action === 'decrement' ? 'left' : 'right'\n}\n\nfunction drawChevronPath(\n g: Phaser.GameObjects.Graphics,\n direction: NumberInputIndicatorDirection,\n size: number\n): void {\n const center = size / 2\n const inset = size * 0.32\n const outer = size * 0.68\n const start = size * 0.3\n const end = size * 0.7\n\n g.beginPath()\n\n if (direction === 'left') {\n g.moveTo(outer, start)\n g.lineTo(inset, center)\n g.lineTo(outer, end)\n } else if (direction === 'right') {\n g.moveTo(inset, start)\n g.lineTo(outer, center)\n g.lineTo(inset, end)\n } else if (direction === 'up') {\n g.moveTo(start, outer)\n g.lineTo(center, inset)\n g.lineTo(end, outer)\n } else {\n g.moveTo(start, inset)\n g.lineTo(center, outer)\n g.lineTo(end, inset)\n }\n\n g.strokePath()\n}\n\nfunction drawSignPath(\n g: Phaser.GameObjects.Graphics,\n action: NumberInputButtonAction,\n size: number\n): void {\n const center = size / 2\n const lineStart = size * 0.3\n const lineEnd = size * 0.7\n\n g.beginPath()\n g.moveTo(lineStart, center)\n g.lineTo(lineEnd, center)\n g.strokePath()\n\n if (action === 'increment') {\n g.beginPath()\n g.moveTo(center, lineStart)\n g.lineTo(center, lineEnd)\n g.strokePath()\n }\n}\n\n/**\n * NumberInputIndicator component\n * Small Graphics-based sign or chevron indicator for NumberInput buttons.\n */\nexport function NumberInputIndicator(props: NumberInputIndicatorProps): VNodeLike {\n const {\n variant = 'sign',\n action = 'increment',\n direction,\n size = 24,\n color = 0xffffff,\n activeColor = color,\n disabled = false,\n framed = false,\n backgroundAlpha = 0.12,\n borderAlpha = 1,\n ...viewProps\n } = props\n\n const resolvedDirection = direction ?? getDefaultIndicatorDirection(action)\n\n return (\n <Graphics\n {...viewProps}\n width={size}\n height={size}\n dependencies={[\n variant,\n action,\n resolvedDirection,\n size,\n color,\n activeColor,\n disabled,\n framed,\n backgroundAlpha,\n borderAlpha,\n ]}\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n const alpha = disabled ? 0.45 : 1\n const inset = Math.max(3, Math.round(size * 0.16))\n const stroke = Math.max(2, Math.round(size * 0.12))\n const iconColor = disabled ? color : activeColor\n\n g.clear()\n\n if (framed) {\n g.fillStyle(iconColor, backgroundAlpha * alpha)\n g.lineStyle(2, iconColor, borderAlpha * alpha)\n g.fillRoundedRect(inset, inset, size - inset * 2, size - inset * 2, size * 0.18)\n g.strokeRoundedRect(inset, inset, size - inset * 2, size - inset * 2, size * 0.18)\n }\n\n g.lineStyle(stroke, iconColor, alpha)\n\n if (variant === 'chevron') {\n drawChevronPath(g, resolvedDirection, size)\n } else {\n drawSignPath(g, action, size)\n }\n }}\n />\n )\n}\n\nfunction isFiniteNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value)\n}\n\nfunction getOrderedBounds(min?: number, max?: number): { min: number; max: number } {\n const resolvedMin = isFiniteNumber(min) ? min : -Infinity\n const resolvedMax = isFiniteNumber(max) ? max : Infinity\n\n return {\n min: Math.min(resolvedMin, resolvedMax),\n max: Math.max(resolvedMin, resolvedMax),\n }\n}\n\nfunction getDecimalPlaces(value: number): number {\n if (!Number.isFinite(value) || Number.isInteger(value)) return 0\n\n const [, decimals = ''] = value.toString().split('.')\n return decimals.length\n}\n\nexport function getNumberInputPrecision(step = 1, precision?: number): number {\n if (isFiniteNumber(precision) && precision >= 0) {\n return Math.floor(precision)\n }\n\n return getDecimalPlaces(Math.abs(step))\n}\n\nexport function normalizeNumberInputValue(\n value: number,\n options: NumberInputValueOptions = {}\n): number {\n const { min, max } = getOrderedBounds(options.min, options.max)\n const fallback = Number.isFinite(min) ? min : Number.isFinite(max) ? max : 0\n const rawValue = isFiniteNumber(value) ? value : fallback\n const clamped = Math.max(min, Math.min(max, rawValue))\n const precision = getNumberInputPrecision(options.step, options.precision)\n const factor = 10 ** precision\n\n return Math.round(clamped * factor) / factor\n}\n\nexport function getNextNumberInputValue(\n currentValue: number,\n direction: -1 | 1,\n options: NumberInputValueOptions = {}\n): number {\n const step = isFiniteNumber(options.step) && options.step > 0 ? options.step : 1\n return normalizeNumberInputValue(currentValue + step * direction, options)\n}\n\n/**\n * NumberInput component\n * Displays a numeric value with decrement/increment controls.\n */\nexport function NumberInput(props: NumberInputProps): VNodeLike {\n const {\n value,\n defaultValue,\n onChange,\n min,\n max,\n step = 1,\n precision,\n label,\n labelPosition,\n formatValue,\n renderValue,\n labels: labelOverrides,\n decrementContent,\n incrementContent,\n renderButtonContent,\n disabled = false,\n buttonPlacement,\n buttonDirection,\n buttonVariant,\n buttonSize,\n buttonTextStyle,\n buttonIndicatorColor,\n buttonIndicatorActiveColor,\n repeatOnHold,\n holdDelay,\n repeatInterval,\n valueWidth,\n controlHeight,\n theme,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('NumberInput', mergedLocalTheme, {})\n\n const valueOptions: NumberInputValueOptions = {\n ...(min !== undefined ? { min } : {}),\n ...(max !== undefined ? { max } : {}),\n step,\n ...(precision !== undefined ? { precision } : {}),\n }\n const initialValue = normalizeNumberInputValue(defaultValue ?? value ?? min ?? 0, valueOptions)\n const [internalValue, setInternalValue] = useState(initialValue)\n const currentValueRef = useRef(initialValue)\n const holdIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null)\n const isControlled = value !== undefined\n const currentValue = normalizeNumberInputValue(isControlled ? value : internalValue, valueOptions)\n currentValueRef.current = currentValue\n\n useEffect(() => {\n if (!isControlled && internalValue !== currentValue) {\n setInternalValue(currentValue)\n }\n }, [isControlled, internalValue, currentValue])\n\n useEffect(() => {\n return () => stopHoldRepeat()\n }, [])\n\n const labels = {\n ...DEFAULT_LABELS,\n ...(themed.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n\n const resolvedLabelPosition = labelPosition ?? themed.labelPosition ?? 'left'\n const resolvedButtonPlacement = buttonPlacement ?? themed.buttonPlacement ?? 'split'\n const resolvedButtonDirection = buttonDirection ?? themed.buttonDirection ?? 'row'\n const resolvedButtonVariant = buttonVariant ?? themed.buttonVariant ?? 'secondary'\n const resolvedButtonSize = buttonSize ?? themed.buttonSize ?? 'small'\n const resolvedButtonTextStyle = buttonTextStyle ??\n themed.buttonTextStyle ?? { color: '#111827', fontSize: '16px' }\n const resolvedButtonIndicatorColor =\n buttonIndicatorColor ?? themed.buttonIndicatorColor ?? 0xffffff\n const resolvedButtonIndicatorActiveColor =\n buttonIndicatorActiveColor ?? themed.buttonIndicatorActiveColor ?? resolvedButtonIndicatorColor\n const resolvedRepeatOnHold = repeatOnHold ?? themed.repeatOnHold ?? true\n const resolvedHoldDelay = holdDelay ?? themed.holdDelay ?? 350\n const resolvedRepeatInterval = repeatInterval ?? themed.repeatInterval ?? 90\n const resolvedValueWidth = valueWidth ?? themed.valueWidth ?? 78\n const resolvedControlHeight = controlHeight ?? themed.controlHeight ?? 34\n const labelStyle = themed.labelStyle ?? { color: '#ffffff', fontSize: '14px' }\n const valueStyle = themed.valueStyle ?? { color: '#ffffff', fontSize: '14px' }\n const buttonControlSize = themed.buttonControlSize ?? resolvedControlHeight\n const displayText = formatValue?.(currentValue) ?? `${currentValue}`\n const visibleLabel = label ?? labels.value\n const showLabel = resolvedLabelPosition !== 'none' && visibleLabel.length > 0\n\n const decrementValue = getNextNumberInputValue(currentValue, -1, valueOptions)\n const incrementValue = getNextNumberInputValue(currentValue, 1, valueOptions)\n const canDecrement = decrementValue !== currentValue\n const canIncrement = incrementValue !== currentValue\n const valueContent = renderValue?.({\n value: currentValue,\n displayText,\n ...(min !== undefined ? { min } : {}),\n ...(max !== undefined ? { max } : {}),\n step,\n disabled,\n canDecrement,\n canIncrement,\n valueWidth: resolvedValueWidth,\n controlHeight: resolvedControlHeight,\n })\n\n const commitValue = (nextValue: number) => {\n const normalized = normalizeNumberInputValue(nextValue, valueOptions)\n if (normalized === currentValueRef.current) return\n\n currentValueRef.current = normalized\n\n if (!isControlled) {\n setInternalValue(normalized)\n }\n\n onChange?.(normalized)\n }\n\n const commitStep = (direction: -1 | 1) => {\n commitValue(getNextNumberInputValue(currentValueRef.current, direction, valueOptions))\n }\n\n const stopHoldRepeat = () => {\n if (!holdIntervalRef.current) return\n clearInterval(holdIntervalRef.current)\n holdIntervalRef.current = null\n }\n\n const startHoldRepeat = (direction: -1 | 1) => {\n if (!resolvedRepeatOnHold || disabled) return\n\n stopHoldRepeat()\n commitStep(direction)\n holdIntervalRef.current = setInterval(() => {\n commitStep(direction)\n }, resolvedRepeatInterval)\n }\n\n const handleHoldMove = (event: GestureEventData) => {\n if (event.state === 'end') {\n stopHoldRepeat()\n }\n }\n\n const renderStepButton = (stepDirection: -1 | 1) => {\n const isDecrement = stepDirection === -1\n const action: NumberInputButtonAction = isDecrement ? 'decrement' : 'increment'\n const canChange = isDecrement ? canDecrement : canIncrement\n const content = isDecrement ? decrementContent : incrementContent\n const text = isDecrement ? labels.decrement : labels.increment\n const nextValue = isDecrement ? decrementValue : incrementValue\n const isButtonDisabled = disabled || !canChange\n const renderedContent =\n content ??\n renderButtonContent?.({\n action,\n disabled: isButtonDisabled,\n value: currentValue,\n nextValue,\n size: buttonControlSize,\n color: resolvedButtonIndicatorColor,\n activeColor: resolvedButtonIndicatorActiveColor,\n })\n\n return (\n <Button\n key={isDecrement ? 'decrement' : 'increment'}\n label={renderedContent ? undefined : text}\n width={buttonControlSize}\n height={buttonControlSize}\n variant={resolvedButtonVariant}\n size={resolvedButtonSize}\n textStyle={resolvedButtonTextStyle}\n disabled={isButtonDisabled}\n onClick={() => commitStep(stepDirection)}\n onLongPress={() => startHoldRepeat(stepDirection)}\n onTouchMove={handleHoldMove}\n longPressDuration={resolvedHoldDelay}\n >\n {renderedContent}\n </Button>\n )\n }\n\n const stepButtons = (\n <View\n direction={resolvedButtonDirection}\n alignItems=\"center\"\n gap={themed.buttonGap ?? themed.controlGap ?? 0}\n theme={nestedTheme}\n >\n {renderStepButton(-1)}\n {renderStepButton(1)}\n </View>\n )\n\n const valueDisplay = (\n <View\n width={resolvedValueWidth}\n height={resolvedControlHeight}\n alignItems=\"center\"\n justifyContent=\"center\"\n backgroundColor={themed.valueBackgroundColor ?? 0x000000}\n backgroundAlpha={themed.valueBackgroundAlpha ?? 0.12}\n borderColor={themed.valueBorderColor ?? themed.borderColor}\n borderWidth={themed.valueBorderWidth ?? 1}\n cornerRadius={themed.valueCornerRadius ?? themed.cornerRadius ?? 6}\n padding={themed.valuePadding ?? { left: 8, right: 8, top: 4, bottom: 4 }}\n theme={nestedTheme}\n >\n {valueContent ?? <Text text={displayText} style={valueStyle} />}\n </View>\n )\n\n const control =\n resolvedButtonPlacement === 'left' ? (\n <View direction=\"row\" alignItems=\"center\" gap={themed.controlGap ?? 0} theme={nestedTheme}>\n {stepButtons}\n {valueDisplay}\n </View>\n ) : resolvedButtonPlacement === 'right' ? (\n <View direction=\"row\" alignItems=\"center\" gap={themed.controlGap ?? 0} theme={nestedTheme}>\n {valueDisplay}\n {stepButtons}\n </View>\n ) : (\n <View direction=\"row\" alignItems=\"center\" gap={themed.controlGap ?? 0} theme={nestedTheme}>\n {renderStepButton(-1)}\n {valueDisplay}\n {renderStepButton(1)}\n </View>\n )\n\n const labelNode = showLabel ? <Text text={visibleLabel} style={labelStyle} /> : null\n const isVertical = resolvedLabelPosition === 'top' || resolvedLabelPosition === 'bottom'\n const finalAlpha = disabled ? (themed.disabledAlpha ?? 0.5) : viewProps.alpha\n const content =\n resolvedLabelPosition === 'right' || resolvedLabelPosition === 'bottom' ? (\n <>\n {control}\n {labelNode}\n </>\n ) : (\n <>\n {labelNode}\n {control}\n </>\n )\n\n return (\n <View\n {...viewProps}\n direction={isVertical ? 'column' : 'row'}\n alignItems=\"center\"\n gap={themed.gap ?? 10}\n padding={themed.padding ?? 0}\n {...(finalAlpha !== undefined ? { alpha: finalAlpha } : {})}\n theme={nestedTheme}\n >\n {content}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * PalettePicker component\n * Fixed color palette picker for theme colors, recent colors, and curated swatches.\n */\nimport type * as Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport { ensureContrast, normalizeColorNumber, numberToHex } from '../../colors'\nimport { useEffect, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, Text, View } from '../index'\n\nexport type PalettePickerColor = number | PalettePickerOption\n\nexport interface PalettePickerLabels {\n title?: string\n empty?: string\n formatHex?: (color: number) => string\n}\n\nexport interface PalettePickerOption {\n /** Phaser color number. */\n value: number\n /** Optional label for custom renderers and accessibility-adjacent UI. */\n label?: string\n /** Disabled colors are shown but cannot be selected. */\n disabled?: boolean\n}\n\nexport interface NormalizedPalettePickerOption extends PalettePickerOption {\n value: number\n hex: string\n}\n\nexport interface PalettePickerSwatchRenderProps {\n option: NormalizedPalettePickerOption\n color: number\n hex: string\n selected: boolean\n disabled: boolean\n index: number\n size: number\n selectedBorderColor: number\n checkColor: number\n}\n\nexport interface PalettePickerProps extends Omit<ViewProps, 'children'> {\n /** Palette colors as numbers or option objects. */\n colors: PalettePickerColor[]\n /** Current color in controlled mode. */\n value?: number\n /** Initial color in uncontrolled mode. */\n defaultValue?: number\n /** Called when a selectable color is selected. */\n onChange?: (color: number, option: NormalizedPalettePickerOption) => void\n /** Number of columns before wrapping into a new row. */\n columns?: number\n /** Swatch width and height in pixels. */\n swatchSize?: number\n /** Show title text from labels.title. */\n showTitle?: boolean\n /** Show hex text below each swatch. */\n showHex?: boolean\n /** Localized labels and formatters. */\n labels?: PalettePickerLabels\n /** Disabled state for the whole control. */\n disabled?: boolean\n /** Render custom swatch content. */\n renderSwatch?: (props: PalettePickerSwatchRenderProps) => ChildrenType\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nexport interface PalettePickerThemeSlot extends ViewTheme {\n columns?: number\n swatchSize?: number\n swatchGap?: number\n rowGap?: number\n itemWidth?: ViewTheme['width']\n swatchCornerRadius?: ViewTheme['cornerRadius']\n swatchBorderColor?: number\n swatchBorderWidth?: number\n swatchSelectedBorderColor?: number\n swatchSelectedBorderWidth?: number\n swatchDisabledAlpha?: number\n selectedCheckColor?: number\n disabledAlpha?: number\n titleStyle?: Phaser.Types.GameObjects.Text.TextStyle\n emptyStyle?: Phaser.Types.GameObjects.Text.TextStyle\n hexStyle?: Phaser.Types.GameObjects.Text.TextStyle\n labels?: PalettePickerLabels\n showTitle?: boolean\n showHex?: boolean\n}\n\nconst DEFAULT_LABELS: Required<Omit<PalettePickerLabels, 'formatHex'>> = {\n title: 'Palette',\n empty: 'No colors',\n}\n\nexport function normalizePalettePickerColor(\n color: PalettePickerColor\n): NormalizedPalettePickerOption {\n const option = typeof color === 'number' ? { value: color } : color\n const value = normalizeColorNumber(option.value)\n\n return {\n ...option,\n value,\n hex: numberToHex(value).toUpperCase(),\n }\n}\n\nexport function normalizePalettePickerColors(\n colors: PalettePickerColor[]\n): NormalizedPalettePickerOption[] {\n return colors.map(normalizePalettePickerColor)\n}\n\nexport function resolvePalettePickerValue(\n colors: NormalizedPalettePickerOption[],\n value?: number,\n defaultValue?: number\n): number | undefined {\n if (value !== undefined) {\n const normalizedValue = normalizeColorNumber(value)\n return colors.some((color) => color.value === normalizedValue) ? normalizedValue : undefined\n }\n\n if (defaultValue !== undefined) {\n const normalizedDefault = normalizeColorNumber(defaultValue)\n const defaultOption = colors.find((color) => color.value === normalizedDefault)\n if (defaultOption) return defaultOption.value\n }\n\n return colors.find((color) => !color.disabled)?.value ?? colors[0]?.value\n}\n\nexport function chunkPalettePickerColors<T>(colors: T[], columns: number): T[][] {\n const safeColumns = Math.max(1, Math.floor(columns))\n const rows: T[][] = []\n\n for (let index = 0; index < colors.length; index += safeColumns) {\n rows.push(colors.slice(index, index + safeColumns))\n }\n\n return rows\n}\n\nexport function getPalettePickerContrastColor(color: number, preferred = 0xffffff): number {\n return ensureContrast(preferred, color, 4.5)\n}\n\nfunction getSelectable(option: NormalizedPalettePickerOption, disabled: boolean): boolean {\n return !disabled && !option.disabled\n}\n\n/**\n * PalettePicker component\n */\nexport function PalettePicker(props: PalettePickerProps): VNodeLike {\n const {\n colors,\n value,\n defaultValue,\n onChange,\n columns,\n swatchSize,\n showTitle,\n showHex,\n labels: labelOverrides,\n disabled = false,\n renderSwatch,\n theme,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('PalettePicker', mergedLocalTheme, {})\n const themedPicker = themed as unknown as PalettePickerThemeSlot\n const normalizedColors = normalizePalettePickerColors(colors)\n const isControlled = value !== undefined\n const initialValue = resolvePalettePickerValue(normalizedColors, value, defaultValue)\n const [internalValue, setInternalValue] = useState<number | undefined>(initialValue)\n const currentValue = isControlled\n ? resolvePalettePickerValue(normalizedColors, value)\n : resolvePalettePickerValue(normalizedColors, internalValue)\n\n useEffect(() => {\n if (!isControlled && internalValue !== currentValue) {\n setInternalValue(currentValue)\n }\n }, [isControlled, internalValue, currentValue])\n\n const labels = {\n ...DEFAULT_LABELS,\n ...(themedPicker.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n const resolvedColumns = Math.max(1, Math.floor(columns ?? themedPicker.columns ?? 6))\n const resolvedSwatchSize = swatchSize ?? themedPicker.swatchSize ?? 28\n const resolvedShowTitle = showTitle ?? themedPicker.showTitle ?? true\n const resolvedShowHex = showHex ?? themedPicker.showHex ?? false\n const swatchGap = themedPicker.swatchGap ?? 8\n const rowGap = themedPicker.rowGap ?? swatchGap\n const itemWidth =\n themedPicker.itemWidth ??\n (resolvedShowHex ? Math.max(56, resolvedSwatchSize) : resolvedSwatchSize)\n const titleStyle = themedPicker.titleStyle ?? {\n color: '#ffffff',\n fontSize: '14px',\n fontStyle: 'bold',\n }\n const emptyStyle = themedPicker.emptyStyle ?? { color: '#9fb3c8', fontSize: '13px' }\n const hexStyle = themedPicker.hexStyle ?? { color: '#9fb3c8', fontSize: '11px' }\n const finalAlpha = disabled ? (themedPicker.disabledAlpha ?? 0.5) : alpha\n const rows = chunkPalettePickerColors(normalizedColors, resolvedColumns)\n\n const commitColor = (option: NormalizedPalettePickerOption) => {\n if (!getSelectable(option, disabled)) return\n\n if (!isControlled) {\n setInternalValue(option.value)\n }\n\n onChange?.(option.value, option)\n }\n\n const renderDefaultSwatch = (props: PalettePickerSwatchRenderProps) => (\n <View\n width={props.size}\n height={props.size}\n backgroundColor={props.color}\n borderColor={props.selected ? props.selectedBorderColor : themedPicker.swatchBorderColor}\n borderWidth={\n props.selected\n ? (themedPicker.swatchSelectedBorderWidth ?? 3)\n : (themedPicker.swatchBorderWidth ?? 1)\n }\n cornerRadius={themedPicker.swatchCornerRadius ?? 5}\n alignItems=\"center\"\n justifyContent=\"center\"\n alpha={props.disabled ? (themedPicker.swatchDisabledAlpha ?? 0.45) : 1}\n theme={nestedTheme}\n >\n {props.selected ? (\n <Graphics\n width={props.size}\n height={props.size}\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n g.lineStyle(Math.max(2, Math.round(props.size * 0.09)), props.checkColor, 1)\n g.beginPath()\n g.moveTo(props.size * 0.25, props.size * 0.52)\n g.lineTo(props.size * 0.43, props.size * 0.7)\n g.lineTo(props.size * 0.77, props.size * 0.3)\n g.strokePath()\n }}\n />\n ) : null}\n </View>\n )\n\n const renderOption = (option: NormalizedPalettePickerOption, index: number) => {\n const selected = currentValue === option.value\n const optionDisabled = disabled || !!option.disabled\n const selectable = getSelectable(option, disabled)\n const selectedBorderColor = ensureContrast(\n themedPicker.swatchSelectedBorderColor ?? 0xffffff,\n option.value,\n 3\n )\n const checkColor = getPalettePickerContrastColor(\n option.value,\n themedPicker.selectedCheckColor ?? 0xffffff\n )\n const swatchProps: PalettePickerSwatchRenderProps = {\n option,\n color: option.value,\n hex: option.hex,\n selected,\n disabled: optionDisabled,\n index,\n size: resolvedSwatchSize,\n selectedBorderColor,\n checkColor,\n }\n const swatchContent = renderSwatch?.(swatchProps) ?? renderDefaultSwatch(swatchProps)\n const hexText = labels.formatHex?.(option.value) ?? option.hex\n\n return (\n <View\n key={`${option.value}-${index}`}\n width={itemWidth}\n alignItems=\"center\"\n gap={4}\n enableGestures={selectable}\n {...(selectable ? { onTouch: () => commitColor(option) } : {})}\n theme={nestedTheme}\n >\n {swatchContent}\n {resolvedShowHex ? <Text text={hexText} style={hexStyle} /> : null}\n </View>\n )\n }\n\n return (\n <View\n {...viewProps}\n direction=\"column\"\n gap={themedPicker.gap ?? 10}\n padding={themedPicker.padding ?? 0}\n {...(themedPicker.backgroundColor !== undefined\n ? { backgroundColor: themedPicker.backgroundColor }\n : {})}\n {...(themedPicker.backgroundAlpha !== undefined\n ? { backgroundAlpha: themedPicker.backgroundAlpha }\n : {})}\n {...(themedPicker.borderColor !== undefined ? { borderColor: themedPicker.borderColor } : {})}\n {...(themedPicker.borderWidth !== undefined ? { borderWidth: themedPicker.borderWidth } : {})}\n {...(themedPicker.cornerRadius !== undefined\n ? { cornerRadius: themedPicker.cornerRadius }\n : {})}\n {...(finalAlpha !== undefined ? { alpha: finalAlpha } : {})}\n theme={nestedTheme}\n >\n {resolvedShowTitle ? <Text text={labels.title} style={titleStyle} /> : null}\n\n {normalizedColors.length === 0 ? (\n <Text text={labels.empty} style={emptyStyle} />\n ) : (\n <View direction=\"column\" gap={rowGap} theme={nestedTheme}>\n {rows.map((row, rowIndex) => (\n <View key={`row-${rowIndex}`} direction=\"row\" gap={swatchGap} theme={nestedTheme}>\n {row.map((option, columnIndex) =>\n renderOption(option, rowIndex * resolvedColumns + columnIndex)\n )}\n </View>\n ))}\n </View>\n )}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Particles component wrapper - typed wrapper around primitive particles\n */\nimport type { VNodeLike } from '@number10/phaserjsx/vdom'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { ParticleDeathZoneConfig, ParticleZoneConfig } from '../../particles/emit-zone'\nimport type { ParticlesHandle } from '../../particles/particle-types'\nimport type { ParticleEmitterConfig, ParticlePresetName } from '../../particles/preset-registry'\nimport type { PropsDefaultExtension } from '../../types'\n\nexport interface ParticlesProps\n extends\n TransformProps,\n PhaserProps,\n Omit<LayoutProps, 'direction' | 'justifyContent' | 'alignItems' | 'gap' | 'flexWrap'>,\n PropsDefaultExtension<ParticlesHandle> {\n texture: string\n frame?: string | number\n preset?: ParticlePresetName\n config?: ParticleEmitterConfig\n /** Where particles are born */\n emitZone?: ParticleZoneConfig\n /**\n * Where particles are born.\n * @deprecated Use emitZone.\n */\n zone?: ParticleZoneConfig\n /** Where particles are removed */\n deathZones?: ParticleDeathZoneConfig | ParticleDeathZoneConfig[] | undefined\n /**\n * Where particles are removed.\n * @deprecated Use deathZones.\n */\n excludeZones?: ParticleDeathZoneConfig | ParticleDeathZoneConfig[] | undefined\n}\n\nexport function Particles(props: ParticlesProps): VNodeLike {\n return <particles {...props} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * ProgressBar component - determinate progress indicator for health, loading, cooldowns, and XP.\n */\nimport { useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View, type ViewProps } from '../index'\n\nexport type ProgressBarOrientation = 'horizontal' | 'vertical'\nexport type ProgressBarLabelPosition = 'none' | 'inside' | 'top' | 'bottom' | 'left' | 'right'\n\nexport interface ProgressBarFormatProps {\n value: number\n min: number\n max: number\n ratio: number\n percent: number\n}\n\nexport interface ProgressBarProps extends Omit<ViewProps, 'children'> {\n /** Current progress value */\n value: number\n /** Minimum value used for normalization */\n min?: number\n /** Maximum value used for normalization */\n max?: number\n /** Progress direction */\n orientation?: ProgressBarOrientation\n /** Optional static label prefix */\n label?: string\n /** Show formatted value text */\n showValue?: boolean\n /** Position of the label/value text */\n labelPosition?: ProgressBarLabelPosition\n /** Custom formatter for value text */\n formatValue?: (props: ProgressBarFormatProps) => string\n /** Track/background color */\n trackColor?: number\n /** Filled progress color */\n fillColor?: number\n /** Border color around the track */\n borderColor?: number\n /** Border width around the track */\n borderWidth?: number\n /** Track corner radius */\n cornerRadius?: number\n /** Text style for label/value */\n labelStyle?: Phaser.Types.GameObjects.Text.TextStyle\n /** Disabled state */\n disabled?: boolean\n /** Alpha applied while disabled */\n disabledAlpha?: number\n /** Theme overrides */\n theme?: PartialTheme\n}\n\nexport function clampProgressValue(value: number, min: number, max: number): number {\n if (!Number.isFinite(value)) return min\n return Math.min(Math.max(value, min), max)\n}\n\nexport function getProgressRatio(value: number, min: number, max: number): number {\n if (!Number.isFinite(min) || !Number.isFinite(max) || min === max) return 0\n\n const normalizedMin = Math.min(min, max)\n const normalizedMax = Math.max(min, max)\n const clamped = clampProgressValue(value, normalizedMin, normalizedMax)\n\n return (clamped - normalizedMin) / (normalizedMax - normalizedMin)\n}\n\nfunction formatDefaultValue(props: ProgressBarFormatProps): string {\n return `${Math.round(props.percent)}%`\n}\n\nexport function ProgressBar(props: ProgressBarProps): VNodeLike {\n const {\n value,\n min = 0,\n max = 100,\n orientation: explicitOrientation,\n label,\n showValue,\n labelPosition: explicitLabelPosition,\n formatValue,\n trackColor: explicitTrackColor,\n fillColor: explicitFillColor,\n borderColor: explicitBorderColor,\n borderWidth: explicitBorderWidth,\n cornerRadius: explicitCornerRadius,\n labelStyle: explicitLabelStyle,\n disabled = false,\n disabledAlpha: explicitDisabledAlpha,\n theme,\n width,\n height,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('ProgressBar', mergedLocalTheme, {})\n\n const orientation = explicitOrientation ?? themed.orientation ?? 'horizontal'\n const ratio = getProgressRatio(value, min, max)\n const percent = ratio * 100\n const labelPosition =\n explicitLabelPosition ?? themed.labelPosition ?? (showValue || label ? 'right' : 'none')\n const shouldShowText = labelPosition !== 'none' && Boolean(showValue || label)\n const text = shouldShowText\n ? [\n label,\n showValue\n ? (formatValue ?? themed.formatValue ?? formatDefaultValue)({\n value,\n min,\n max,\n ratio,\n percent,\n })\n : undefined,\n ]\n .filter(Boolean)\n .join(' ')\n : ''\n\n const resolvedWidth = width ?? themed.width ?? (orientation === 'horizontal' ? 240 : 24)\n const resolvedHeight = height ?? themed.height ?? (orientation === 'horizontal' ? 22 : 160)\n const trackColor = explicitTrackColor ?? themed.trackColor ?? 0x1f2937\n const fillColor = explicitFillColor ?? themed.fillColor ?? 0x22c55e\n const borderColor = explicitBorderColor ?? themed.borderColor ?? 0x334155\n const borderWidth = explicitBorderWidth ?? themed.borderWidth ?? 1\n const cornerRadius =\n explicitCornerRadius ?? themed.cornerRadius ?? (orientation === 'horizontal' ? 11 : 8)\n const labelStyle = explicitLabelStyle ??\n themed.labelStyle ?? { color: '#ffffff', fontSize: '12px' }\n const disabledAlpha = explicitDisabledAlpha ?? themed.disabledAlpha ?? 0.5\n const effectiveAlpha = disabled ? disabledAlpha : alpha\n const rootDirection =\n labelPosition === 'left' || labelPosition === 'right'\n ? 'row'\n : labelPosition === 'top' || labelPosition === 'bottom'\n ? 'column'\n : 'column'\n\n const labelNode = shouldShowText ? <Text text={text} style={labelStyle} /> : null\n const fillProps =\n orientation === 'horizontal'\n ? { width: `${percent}%` as const, height: 'fill' as const }\n : { width: 'fill' as const, height: `${percent}%` as const }\n\n const track = (\n <View\n width={resolvedWidth}\n height={resolvedHeight}\n direction={orientation === 'horizontal' ? 'stack' : 'column'}\n justifyContent={orientation === 'vertical' ? 'end' : 'start'}\n backgroundColor={trackColor}\n borderColor={borderColor}\n borderWidth={borderWidth}\n cornerRadius={cornerRadius}\n overflow=\"hidden\"\n theme={nestedTheme}\n >\n <View {...fillProps} backgroundColor={fillColor} cornerRadius={cornerRadius} />\n {labelPosition === 'inside' && shouldShowText && (\n <View width=\"fill\" height=\"fill\" justifyContent=\"center\" alignItems=\"center\">\n {labelNode}\n </View>\n )}\n </View>\n )\n\n return (\n <View\n {...viewProps}\n direction={rootDirection}\n alignItems=\"center\"\n gap={themed.gap ?? 8}\n {...(effectiveAlpha !== undefined ? { alpha: effectiveAlpha } : {})}\n theme={nestedTheme}\n >\n {labelPosition === 'top' || labelPosition === 'left' ? labelNode : null}\n {track}\n {labelPosition !== 'inside' && (labelPosition === 'bottom' || labelPosition === 'right')\n ? labelNode\n : null}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * ProgressView component — composite progress indicator.\n * Renders a determinate ProgressBar or an indeterminate ActivityIndicator\n * with optional label, percentage, and cancel button.\n */\nimport { useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { VNodeLike } from '../../vdom'\nimport { Button, Text, View, type ViewProps } from '../index'\nimport { ActivityIndicator } from './ActivityIndicator'\nimport type { ButtonSize } from './Button'\nimport { ProgressBar, type ProgressBarProps } from './ProgressBar'\n\nexport interface ProgressViewLabels {\n cancel?: string\n loading?: string\n}\n\nexport interface ProgressViewThemeSlot extends ViewTheme {\n width?: ViewTheme['width']\n barHeight?: number\n gap?: number\n labelStyle?: Phaser.Types.GameObjects.Text.TextStyle\n percentageStyle?: Phaser.Types.GameObjects.Text.TextStyle\n cancelButtonSize?: ButtonSize\n labels?: ProgressViewLabels\n}\n\nexport interface ProgressViewProps extends Omit<ViewProps, 'children'> {\n /** Current progress value (determinate mode). */\n value?: number\n /** Minimum value used for normalization (default 0). */\n min?: number\n /** Maximum value used for normalization (default 100). */\n max?: number\n /** Switch to indeterminate ActivityIndicator when true. */\n indeterminate?: boolean\n /** Optional label above the bar. */\n label?: string\n /** Show percentage text next to the bar. */\n showPercentage?: boolean\n /** Show a cancel button below the bar. */\n showCancel?: boolean\n /** Called when the cancel button is clicked. */\n onCancel?: () => void\n /** Localized labels. */\n labels?: ProgressViewLabels\n /** Props forwarded to the underlying ProgressBar. */\n progressBarProps?: Omit<\n ProgressBarProps,\n 'value' | 'min' | 'max' | 'label' | 'showValue' | 'labelPosition' | 'labelStyle' | 'theme'\n >\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\n/**\n * ProgressView — determinate or indeterminate progress with label and cancel.\n */\nexport function ProgressView(props: ProgressViewProps): VNodeLike {\n const {\n value,\n min = 0,\n max = 100,\n indeterminate = false,\n label,\n showPercentage = false,\n showCancel = false,\n onCancel,\n labels: labelOverrides,\n progressBarProps,\n theme,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('ProgressView', mergedLocalTheme, {})\n const themedControl = themed as unknown as ProgressViewThemeSlot\n\n const labels = {\n ...(themedControl.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n\n const gap = themedControl.gap ?? 8\n const barHeight = themedControl.barHeight ?? 24\n const labelStyle = themedControl.labelStyle ?? { color: '#e0e7ff', fontSize: '14px' }\n const percentageStyle = themedControl.percentageStyle ?? {\n color: '#9fb3c8',\n fontSize: '13px',\n }\n\n const percentage =\n value !== undefined ? Math.round(((value - min) / (max - min)) * 100) : undefined\n\n return (\n <View\n direction=\"column\"\n gap={gap}\n width={themedControl.width ?? 'fill'}\n {...viewProps}\n theme={nestedTheme}\n >\n {/* Label row */}\n {(label || showPercentage) && !indeterminate ? (\n <View direction=\"row\" justifyContent=\"space-between\" width=\"fill\">\n {label ? <Text text={label} style={labelStyle} /> : <View />}\n {showPercentage && percentage !== undefined ? (\n <Text text={`${percentage}%`} style={percentageStyle} />\n ) : null}\n </View>\n ) : null}\n\n {/* Indicator */}\n {indeterminate ? (\n <ActivityIndicator\n {...(label || labels.loading ? { label: label ?? labels.loading } : {})}\n theme={nestedTheme}\n />\n ) : (\n <ProgressBar\n value={value ?? 0}\n min={min}\n max={max}\n height={barHeight}\n width=\"fill\"\n {...progressBarProps}\n theme={nestedTheme}\n />\n )}\n\n {/* Cancel button */}\n {showCancel && onCancel ? (\n <View alignItems=\"center\" width=\"fill\">\n <Button\n variant=\"ghost\"\n size={themedControl.cancelButtonSize ?? 'small'}\n onClick={onCancel}\n >\n <Text text={labels.cancel ?? 'Cancel'} />\n </Button>\n </View>\n ) : null}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * RadioButton component - Selectable option with circle indicator and label\n */\nimport { useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\n\nexport type RadioButtonLabelPosition = 'left' | 'right' | 'none'\n\n/**\n * Props for RadioButton component\n */\nexport interface RadioButtonProps {\n /** Unique key for VDOM identification */\n key?: string | number | undefined\n /** Label text for the radio button */\n label: string\n /** Whether this radio button is selected */\n selected?: boolean\n /** Disabled state */\n disabled?: boolean\n /** Label position relative to the indicator */\n labelPosition?: RadioButtonLabelPosition\n /** Optional theme overrides */\n theme?: PartialTheme\n /** Callback when radio button is clicked */\n onClick?: () => void\n}\n\n/**\n * RadioButton component - displays a selectable circle with label\n * @param props - RadioButton properties\n * @returns RadioButton JSX element\n */\nexport function RadioButton(props: RadioButtonProps): VNodeLike {\n const localTheme = useTheme()\n const mergedLocalTheme = props.theme ? mergeThemes(localTheme ?? {}, props.theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('RadioButton', mergedLocalTheme, {})\n const size = themed.size ?? 18\n const innerSize = themed.innerSize ?? Math.max(6, Math.round(size * 0.45))\n const innerRadius = innerSize * 0.5\n const outerRadius = size * 0.5\n const borderWidth = themed.borderWidth ?? Math.max(2, Math.round(size * 0.11))\n const selected = props.selected ?? false\n const disabled = props.disabled ?? false\n const disabledAlpha = themed.disabledAlpha ?? 0.5\n const labelPosition = props.labelPosition ?? themed.labelPosition ?? 'right'\n const selectedColor = themed.selectedColor ?? 0x2196f3\n const idleColor = themed.color ?? 0x757575\n const activeColor = selected ? selectedColor : idleColor\n const indicatorFillColor = themed.backgroundColor\n const gap = themed.gap ?? 8\n const label =\n labelPosition !== 'none' ? (\n <Text text={props.label} style={themed.labelStyle} alpha={disabled ? disabledAlpha : 1} />\n ) : null\n\n const handleClick = () => {\n if (disabled) return\n props.onClick?.()\n }\n\n return (\n <View\n key={props.key}\n direction=\"row\"\n alignItems=\"center\"\n enableGestures={!disabled}\n onTouch={handleClick}\n theme={nestedTheme}\n gap={gap}\n alpha={disabled ? disabledAlpha : 1}\n >\n {labelPosition === 'left' && label}\n <View\n width={size}\n height={size}\n {...(indicatorFillColor !== undefined && { backgroundColor: indicatorFillColor })}\n borderColor={activeColor}\n borderWidth={borderWidth}\n alignItems=\"center\"\n justifyContent=\"center\"\n padding={0}\n cornerRadius={outerRadius}\n >\n <View\n width={innerSize}\n height={innerSize}\n backgroundColor={selectedColor}\n visible={selected}\n cornerRadius={innerRadius}\n />\n </View>\n\n {labelPosition !== 'left' && label}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * RadioGroup component - Manages a group of radio buttons with single-selection logic\n */\n\nimport { useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\nimport { RadioButton } from './RadioButton'\n\n// import { getThemedProps, Text, useState, View } from '@number10/phaserjsx'\n\n/**\n * Option item for RadioGroup\n */\nexport interface RadioGroupOption {\n /** Unique value for this option */\n value: string\n /** Display label for this option */\n label: string\n}\n\n/**\n * Props for RadioGroup component\n */\nexport interface RadioGroupProps {\n /** Array of options to display */\n options: RadioGroupOption[]\n /** Currently selected value */\n value?: string\n /** Initial selected value for uncontrolled groups */\n defaultValue?: string\n /** Callback when selection changes */\n onChange?: (value: string) => void\n /** Layout direction (default: 'column') */\n direction?: 'row' | 'column'\n /** Disabled state for all options */\n disabled?: boolean\n}\n\n/**\n * RadioGroup component - displays a group of radio buttons with single-selection\n * @param props - RadioGroup properties\n * @returns RadioGroup JSX element\n */\nexport function RadioGroup(props: RadioGroupProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('RadioButton', localTheme, {})\n\n const [internalSelected, setInternalSelected] = useState<string>(\n props.value ?? props.defaultValue ?? ''\n )\n const selected = props.value ?? internalSelected\n\n const handleSelect = (value: string) => {\n if (props.disabled) return\n if (props.value === undefined) {\n setInternalSelected(value)\n }\n props.onChange?.(value)\n }\n\n return (\n <View direction={props.direction ?? 'column'} theme={nestedTheme} gap={themed.gap}>\n {props.options.map((option) => {\n const isSelected = selected === option.value\n\n return (\n <RadioButton\n key={option.value}\n label={option.label}\n selected={isSelected}\n disabled={props.disabled ?? false}\n onClick={() => handleSelect(option.value)}\n />\n )\n })}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * RatingBar component — star rating input (1–N).\n */\nimport { useEffect, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View, type ViewProps } from '../index'\n\nexport type RatingBarSize = 'small' | 'medium' | 'large'\n\nexport interface RatingBarLabels {\n rating?: string\n}\n\nexport interface RatingBarIconRenderProps {\n filled: boolean\n index: number\n size: RatingBarSize\n}\n\nexport interface RatingBarThemeSlot extends ViewTheme {\n size?: RatingBarSize\n gap?: number\n iconSize?: number\n filledColor?: string\n emptyColor?: string\n disabledAlpha?: number\n labelStyle?: Phaser.Types.GameObjects.Text.TextStyle\n labels?: RatingBarLabels\n}\n\nexport interface RatingBarProps extends Omit<ViewProps, 'children'> {\n /** Current rating value in controlled mode. */\n value?: number\n /** Initial rating value in uncontrolled mode. */\n defaultValue?: number\n /** Maximum number of stars (default 5). */\n max?: number\n /** Called when rating changes. */\n onChange?: (value: number) => void\n /** Size preset. */\n size?: RatingBarSize\n /** Custom star icon renderer. */\n renderIcon?: (props: RatingBarIconRenderProps) => ChildrenType\n /** Localized labels. */\n labels?: RatingBarLabels\n /** Disabled state. */\n disabled?: boolean\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nfunction getSizeConfig(size: RatingBarSize): { iconSize: number; fontSize: string } {\n switch (size) {\n case 'small':\n return { iconSize: 16, fontSize: '16px' }\n case 'large':\n return { iconSize: 32, fontSize: '32px' }\n default:\n return { iconSize: 24, fontSize: '24px' }\n }\n}\n\nfunction clampRating(value: number, max: number): number {\n return Math.max(0, Math.min(max, Math.round(value)))\n}\n\n/**\n * RatingBar — star rating input.\n */\nexport function RatingBar(props: RatingBarProps): VNodeLike {\n const {\n value,\n defaultValue = 0,\n max = 5,\n onChange,\n size,\n renderIcon,\n labels: labelOverrides,\n disabled = false,\n theme,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('RatingBar', mergedLocalTheme, {})\n const themedControl = themed as unknown as RatingBarThemeSlot\n\n const resolvedSize = size ?? themedControl.size ?? 'medium'\n const sizeConfig = getSizeConfig(resolvedSize)\n const iconSize = themedControl.iconSize ?? sizeConfig.iconSize\n const gap = themedControl.gap ?? 4\n\n const isControlled = value !== undefined\n const initialValue = clampRating(value ?? defaultValue, max)\n const [internalValue, setInternalValue] = useState(initialValue)\n const currentValue = isControlled ? clampRating(value ?? 0, max) : internalValue\n\n useEffect(() => {\n if (isControlled) {\n setInternalValue(clampRating(value ?? 0, max))\n }\n }, [isControlled, value, max])\n\n const labels = { ...(themedControl.labels ?? {}), ...(labelOverrides ?? {}) }\n const filledColor = themedControl.filledColor ?? '#fbbf24'\n const emptyColor = themedControl.emptyColor ?? '#475569'\n const finalAlpha = disabled ? (themedControl.disabledAlpha ?? 0.5) : alpha\n\n const commitValue = (nextValue: number) => {\n if (disabled) return\n const clamped = clampRating(nextValue, max)\n if (!isControlled) {\n setInternalValue(clamped)\n }\n onChange?.(clamped)\n }\n\n const indices = Array.from({ length: max }, (_, i) => i)\n\n return (\n <View\n direction=\"row\"\n alignItems=\"center\"\n gap={gap}\n {...viewProps}\n {...(finalAlpha !== undefined ? { alpha: finalAlpha } : {})}\n theme={nestedTheme}\n >\n {indices.map((i) => {\n const filled = i < currentValue\n const content = renderIcon?.({ filled, index: i, size: resolvedSize })\n\n return (\n <View\n key={i}\n width={iconSize}\n height={iconSize}\n alignItems=\"center\"\n justifyContent=\"center\"\n enableGestures={!disabled}\n onTouch={() => commitValue(i + 1)}\n theme={nestedTheme}\n >\n {content ?? (\n <Text\n text={filled ? '★' : '☆'}\n style={{ color: filled ? filledColor : emptyColor, fontSize: sizeConfig.fontSize }}\n />\n )}\n </View>\n )\n })}\n {labels.rating ? <Text text={labels.rating} style={themedControl.labelStyle} /> : null}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * SegmentedControl component\n * Compact single-selection control for short mode, filter, and toolbar choices.\n */\nimport type { ViewProps } from '..'\nimport { compactControlSizePresets } from '../../design-tokens/component-size-presets'\nimport { useEffect, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\n\nexport type SegmentedControlOrientation = 'horizontal' | 'vertical'\nexport type SegmentedControlSize = 'small' | 'medium' | 'large'\nexport type SegmentedControlVariant = 'solid' | 'soft' | 'outline'\nexport type SegmentedControlLabelPosition = 'left' | 'top' | 'none'\n\nexport interface SegmentedControlLabels {\n /** Optional visible group label. */\n group?: string\n}\n\nexport interface SegmentedControlOption {\n /** Unique option value. */\n value: string\n /** Visible text for this segment. Falls back to value when no icon/children are provided. */\n label?: string\n /** Optional leading icon or glyph content. */\n icon?: ChildrenType\n /** Full custom segment content. Takes precedence over icon and label. */\n children?: ChildrenType\n /** Disabled options cannot be selected. */\n disabled?: boolean\n}\n\nexport interface SegmentedControlOptionRenderProps {\n option: SegmentedControlOption\n selected: boolean\n disabled: boolean\n hovered: boolean\n index: number\n size: SegmentedControlSize\n variant: SegmentedControlVariant\n orientation: SegmentedControlOrientation\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n iconSize?: number\n}\n\nexport interface SegmentedControlThemeSlot extends ViewTheme {\n orientation?: SegmentedControlOrientation\n size?: SegmentedControlSize\n variant?: SegmentedControlVariant\n segmentWidth?: ViewTheme['width']\n segmentHeight?: ViewTheme['height']\n segmentGap?: number\n segmentPadding?: ViewTheme['padding']\n segmentCornerRadius?: ViewTheme['cornerRadius']\n segmentStyle?: ViewTheme\n segmentHoverStyle?: ViewTheme\n segmentSelectedStyle?: ViewTheme\n segmentDisabledStyle?: ViewTheme\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n selectedTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n disabledTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n labelStyle?: Phaser.Types.GameObjects.Text.TextStyle\n iconGap?: number\n iconSize?: number\n disabledAlpha?: number\n labelPosition?: SegmentedControlLabelPosition\n labels?: SegmentedControlLabels\n}\n\nexport interface SegmentedControlProps extends Omit<ViewProps, 'children'> {\n /** Available segments. */\n options: SegmentedControlOption[]\n /** Selected value in controlled mode. */\n value?: string\n /** Initial selected value in uncontrolled mode. */\n defaultValue?: string\n /** Called when a selectable segment is selected. */\n onChange?: (value: string) => void\n /** Layout orientation. */\n orientation?: SegmentedControlOrientation\n /** Size preset. */\n size?: SegmentedControlSize\n /** Visual variant. */\n variant?: SegmentedControlVariant\n /** Optional visible group label. Takes precedence over labels.group. */\n label?: string\n /** Position of the optional visible group label. */\n labelPosition?: SegmentedControlLabelPosition\n /** Localized labels. */\n labels?: SegmentedControlLabels\n /** Disabled state for the whole control. */\n disabled?: boolean\n /** Fixed segment width. */\n segmentWidth?: ViewProps['width']\n /** Fixed segment height. */\n segmentHeight?: ViewProps['height']\n /** Render custom segment content. */\n renderOption?: (props: SegmentedControlOptionRenderProps) => ChildrenType\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nexport function findSegmentedControlOption(\n options: SegmentedControlOption[],\n value: string | undefined\n): SegmentedControlOption | undefined {\n if (value === undefined) return undefined\n return options.find((option) => option.value === value)\n}\n\nexport function resolveSegmentedControlValue(\n options: SegmentedControlOption[],\n value?: string,\n defaultValue?: string\n): string {\n if (value !== undefined) {\n return findSegmentedControlOption(options, value)?.value ?? ''\n }\n\n const defaultOption = findSegmentedControlOption(options, defaultValue)\n if (defaultOption) return defaultOption.value\n\n return options.find((option) => !option.disabled)?.value ?? options[0]?.value ?? ''\n}\n\nexport function isSegmentedControlOptionSelectable(\n option: SegmentedControlOption,\n currentValue: string,\n disabled = false\n): boolean {\n return !disabled && !option.disabled && option.value !== currentValue\n}\n\nfunction mergeViewTheme(...themes: Array<ViewTheme | undefined>): ViewTheme {\n return Object.assign({}, ...themes.filter(Boolean))\n}\n\nfunction mergeTextStyle(\n ...styles: Array<Phaser.Types.GameObjects.Text.TextStyle | undefined>\n): Phaser.Types.GameObjects.Text.TextStyle | undefined {\n const merged = Object.assign({}, ...styles.filter(Boolean))\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\nfunction omitSegmentedControlThemeProps(theme: SegmentedControlThemeSlot): ViewTheme {\n const {\n orientation: _orientation,\n size: _size,\n variant: _variant,\n segmentWidth: _segmentWidth,\n segmentHeight: _segmentHeight,\n segmentGap: _segmentGap,\n segmentPadding: _segmentPadding,\n segmentCornerRadius: _segmentCornerRadius,\n segmentStyle: _segmentStyle,\n segmentHoverStyle: _segmentHoverStyle,\n segmentSelectedStyle: _segmentSelectedStyle,\n segmentDisabledStyle: _segmentDisabledStyle,\n textStyle: _textStyle,\n selectedTextStyle: _selectedTextStyle,\n disabledTextStyle: _disabledTextStyle,\n labelStyle: _labelStyle,\n iconGap: _iconGap,\n iconSize: _iconSize,\n disabledAlpha: _disabledAlpha,\n labelPosition: _labelPosition,\n labels: _labels,\n ...viewTheme\n } = theme\n\n return viewTheme\n}\n\nfunction getSegmentedControlSizeTheme(\n size: SegmentedControlSize\n): Pick<\n SegmentedControlThemeSlot,\n 'segmentWidth' | 'segmentHeight' | 'segmentPadding' | 'textStyle' | 'iconSize'\n> {\n const { sm, lg } = compactControlSizePresets\n switch (size) {\n case 'small':\n return {\n segmentWidth: 72,\n segmentHeight: sm.height,\n segmentPadding: {\n left: sm.paddingH,\n right: sm.paddingH,\n top: sm.paddingV,\n bottom: sm.paddingV,\n },\n iconSize: sm.iconSize,\n textStyle: { fontSize: '12px' },\n }\n case 'large':\n return {\n segmentWidth: 108,\n segmentHeight: lg.height,\n segmentPadding: {\n left: lg.paddingH,\n right: lg.paddingH,\n top: lg.paddingV,\n bottom: lg.paddingV,\n },\n iconSize: lg.iconSize,\n textStyle: { fontSize: '16px' },\n }\n default:\n return {}\n }\n}\n\nfunction getSegmentedControlVariantTheme(\n variant: SegmentedControlVariant\n): Pick<\n SegmentedControlThemeSlot,\n | 'backgroundColor'\n | 'backgroundAlpha'\n | 'borderColor'\n | 'borderWidth'\n | 'segmentStyle'\n | 'segmentHoverStyle'\n | 'segmentSelectedStyle'\n | 'textStyle'\n | 'selectedTextStyle'\n> {\n switch (variant) {\n case 'soft':\n return {\n backgroundColor: 0x0f172a,\n backgroundAlpha: 0.78,\n borderColor: 0x334155,\n segmentStyle: {\n backgroundColor: 0x1e293b,\n backgroundAlpha: 0,\n borderWidth: 0,\n },\n segmentHoverStyle: {\n backgroundColor: 0x334155,\n backgroundAlpha: 0.7,\n },\n segmentSelectedStyle: {\n backgroundColor: 0x334155,\n backgroundAlpha: 1,\n borderColor: 0x64748b,\n borderWidth: 1,\n },\n textStyle: {\n color: '#cbd5e1',\n },\n selectedTextStyle: {\n color: '#ffffff',\n fontStyle: 'bold',\n },\n }\n case 'outline':\n return {\n backgroundColor: 0x000000,\n backgroundAlpha: 0,\n borderColor: 0x60a5fa,\n borderWidth: 1,\n segmentStyle: {\n backgroundColor: 0x000000,\n backgroundAlpha: 0,\n borderColor: 0x60a5fa,\n borderWidth: 0,\n },\n segmentHoverStyle: {\n backgroundColor: 0x1d4ed8,\n backgroundAlpha: 0.12,\n },\n segmentSelectedStyle: {\n backgroundColor: 0x1d4ed8,\n backgroundAlpha: 0.2,\n borderColor: 0x93c5fd,\n borderWidth: 1,\n },\n textStyle: {\n color: '#bfdbfe',\n },\n selectedTextStyle: {\n color: '#ffffff',\n fontStyle: 'bold',\n },\n }\n default:\n return {}\n }\n}\n\n/**\n * SegmentedControl component\n */\nexport function SegmentedControl(props: SegmentedControlProps): VNodeLike {\n const {\n options,\n value,\n defaultValue,\n onChange,\n orientation,\n size,\n variant,\n label,\n labelPosition,\n labels: labelOverrides,\n disabled = false,\n segmentWidth,\n segmentHeight,\n renderOption,\n theme,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('SegmentedControl', mergedLocalTheme, {})\n const themedControl = themed as unknown as SegmentedControlThemeSlot\n const isControlled = value !== undefined\n const initialValue = resolveSegmentedControlValue(options, value, defaultValue)\n const [internalValue, setInternalValue] = useState(initialValue)\n const [hoveredValue, setHoveredValue] = useState<string | undefined>(undefined)\n const currentValue = isControlled\n ? resolveSegmentedControlValue(options, value)\n : resolveSegmentedControlValue(options, internalValue)\n\n useEffect(() => {\n if (!isControlled && internalValue !== currentValue) {\n setInternalValue(currentValue)\n }\n }, [isControlled, internalValue, currentValue])\n\n const labels = {\n ...(themedControl.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n const resolvedOrientation = orientation ?? themedControl.orientation ?? 'horizontal'\n const resolvedSize = size ?? themedControl.size ?? 'medium'\n const resolvedVariant = variant ?? themedControl.variant ?? 'solid'\n const sizeTheme = getSegmentedControlSizeTheme(resolvedSize)\n const variantTheme = getSegmentedControlVariantTheme(resolvedVariant)\n const resolvedLabelPosition = labelPosition ?? themedControl.labelPosition ?? 'none'\n const resolvedSegmentWidth = segmentWidth ?? sizeTheme.segmentWidth ?? themedControl.segmentWidth\n const resolvedSegmentHeight =\n segmentHeight ?? sizeTheme.segmentHeight ?? themedControl.segmentHeight\n const visibleLabel = label ?? labels.group\n const showLabel = resolvedLabelPosition !== 'none' && visibleLabel !== undefined\n const rootThemeProps = mergeViewTheme(\n omitSegmentedControlThemeProps(themedControl),\n omitSegmentedControlThemeProps(variantTheme)\n )\n const rootDirection = resolvedLabelPosition === 'left' ? 'row' : 'column'\n const segmentDirection = resolvedOrientation === 'horizontal' ? 'row' : 'column'\n const segmentGap = themedControl.segmentGap ?? 0\n const textStyle = mergeTextStyle(\n { color: '#dbeafe', fontSize: '13px' },\n themedControl.textStyle,\n variantTheme.textStyle,\n sizeTheme.textStyle\n )\n const selectedTextStyle = mergeTextStyle(\n textStyle,\n themedControl.selectedTextStyle,\n variantTheme.selectedTextStyle\n )\n const disabledTextStyle = mergeTextStyle(textStyle, themedControl.disabledTextStyle)\n const labelStyle = themedControl.labelStyle ?? { color: '#9fb3c8', fontSize: '13px' }\n const finalAlpha = disabled ? (themedControl.disabledAlpha ?? 0.5) : alpha\n\n const commitValue = (nextValue: string) => {\n const option = findSegmentedControlOption(options, nextValue)\n if (!option || !isSegmentedControlOptionSelectable(option, currentValue, disabled)) return\n\n if (!isControlled) {\n setInternalValue(nextValue)\n }\n\n onChange?.(nextValue)\n }\n\n const renderSegment = (option: SegmentedControlOption, index: number) => {\n const selected = option.value === currentValue\n const optionDisabled = disabled || !!option.disabled\n const hovered = hoveredValue === option.value\n const selectable = isSegmentedControlOptionSelectable(option, currentValue, disabled)\n const generatedLabel = option.label ?? (option.icon ? undefined : option.value)\n const segmentStyle = mergeViewTheme(\n {\n height: resolvedSegmentHeight,\n width: resolvedSegmentWidth,\n padding: sizeTheme.segmentPadding ?? themedControl.segmentPadding,\n cornerRadius: themedControl.segmentCornerRadius,\n },\n themedControl.segmentStyle,\n variantTheme.segmentStyle,\n hovered && !selected && !optionDisabled ? themedControl.segmentHoverStyle : undefined,\n hovered && !selected && !optionDisabled ? variantTheme.segmentHoverStyle : undefined,\n selected ? themedControl.segmentSelectedStyle : undefined,\n selected ? variantTheme.segmentSelectedStyle : undefined,\n optionDisabled ? themedControl.segmentDisabledStyle : undefined\n )\n const effectiveTextStyle = optionDisabled\n ? disabledTextStyle\n : selected\n ? selectedTextStyle\n : textStyle\n const resolvedIconSize = sizeTheme.iconSize ?? themedControl.iconSize\n const contentTheme = mergeThemes(nestedTheme, {\n Text: effectiveTextStyle ? { style: effectiveTextStyle } : {},\n Icon: {\n ...(resolvedIconSize !== undefined ? { size: resolvedIconSize } : {}),\n },\n })\n const content =\n renderOption?.({\n option,\n selected,\n disabled: optionDisabled,\n hovered,\n index,\n size: resolvedSize,\n variant: resolvedVariant,\n orientation: resolvedOrientation,\n ...(effectiveTextStyle ? { textStyle: effectiveTextStyle } : {}),\n ...(resolvedIconSize !== undefined ? { iconSize: resolvedIconSize } : {}),\n }) ?? option.children\n const hoverHandlers =\n selectable && (themedControl.segmentHoverStyle || variantTheme.segmentHoverStyle)\n ? {\n onHoverStart: () => setHoveredValue(option.value),\n onHoverEnd: () =>\n setHoveredValue((current) => (current === option.value ? undefined : current)),\n }\n : {}\n\n return (\n <View\n key={option.value}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={themedControl.iconGap ?? 6}\n {...segmentStyle}\n enableGestures={selectable}\n onTouch={() => commitValue(option.value)}\n {...hoverHandlers}\n theme={contentTheme}\n >\n {content ?? (\n <>\n {option.icon}\n {generatedLabel !== undefined ? (\n <Text\n text={generatedLabel}\n {...(effectiveTextStyle ? { style: effectiveTextStyle } : {})}\n />\n ) : null}\n </>\n )}\n </View>\n )\n }\n\n const control = (\n <View\n {...rootThemeProps}\n direction={segmentDirection}\n gap={segmentGap}\n {...(finalAlpha !== undefined ? { alpha: finalAlpha } : {})}\n theme={nestedTheme}\n >\n {options.map(renderSegment)}\n </View>\n )\n\n return (\n <View\n {...viewProps}\n direction={rootDirection}\n alignItems=\"center\"\n gap={themedControl.gap ?? 8}\n theme={nestedTheme}\n >\n {showLabel ? <Text text={visibleLabel} style={labelStyle} /> : null}\n {control}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Sprite component wrapper - strict type-safe wrapper around primitive sprite\n * This component is the public API for Sprite, with controlled prop interface\n */\nimport type { VNodeLike } from '@number10/phaserjsx/vdom'\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\n\n/**\n * Props for Sprite component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface SpriteProps\n extends\n TransformProps,\n PhaserProps,\n Omit<LayoutProps, 'direction' | 'justifyContent' | 'alignItems' | 'gap' | 'flexWrap'>,\n PropsDefaultExtension<Phaser.GameObjects.Sprite> {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas or spritesheet */\n frame?: string | number\n\n /** Tint color applied to sprite (0xRRGGBB) */\n tint?: number\n\n /** Display width (scales sprite to fit) */\n displayWidth?: number\n\n /** Display height (scales sprite to fit) */\n displayHeight?: number\n\n /**\n * How sprite should fit within bounds (if displayWidth/displayHeight set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Animation key to play (pre-registered in Phaser AnimationManager) */\n animationKey?: string\n\n /** Loop animation (default: false) */\n loop?: boolean\n\n /** Delay between animation repeats in ms (default: 0) */\n repeatDelay?: number\n\n /** Callback when animation starts */\n onAnimationStart?: (key: string) => void\n\n /** Callback when animation completes */\n onAnimationComplete?: (key: string) => void\n\n /** Callback when animation repeats */\n onAnimationRepeat?: (key: string) => void\n\n /** Callback on each animation frame update */\n onAnimationUpdate?: (key: string, frame: Phaser.Animations.AnimationFrame) => void\n\n /** Origin X (0-1, default 0.5) */\n originX?: number\n\n /** Origin Y (0-1, default 0.5) */\n originY?: number\n\n /** Children are not supported for Sprite component */\n children?: ChildrenType\n}\n\n/**\n * Sprite component\n * Displays animated sprites with Phaser animation system\n *\n * @example\n * ```tsx\n * // Basic sprite\n * <Sprite texture=\"player\" frame=\"idle\" />\n *\n * // Animated sprite\n * <Sprite\n * texture=\"player\"\n * animationKey=\"walk\"\n * loop={true}\n * />\n *\n * // Scaled sprite with fit\n * <Sprite\n * texture=\"coin\"\n * displayWidth={32}\n * displayHeight={32}\n * fit=\"contain\"\n * />\n * ```\n */\nexport function Sprite(props: SpriteProps): VNodeLike {\n const localTheme = useTheme()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('Sprite', localTheme, props as any)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <sprite {...themed} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * Text component wrapper - strict type-safe wrapper around primitive text\n * This component is the public API for Text, with controlled prop interface\n */\nimport type * as Phaser from 'phaser'\nimport type { EdgeInsets, PhaserProps, TextSpecificProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\nimport type { VNodeLike } from '../../vdom'\n\n/**\n * Props for Text component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface TextProps\n extends\n Omit<TransformProps, 'scaleX' | 'scaleY' | 'scale' | 'rotation'>,\n PhaserProps,\n TextSpecificProps,\n PropsDefaultExtension<Phaser.GameObjects.Text> {\n /** Children are not supported for Text component */\n children?: ChildrenType\n /** Margin for layout system */\n margin?: EdgeInsets\n /** Legacy Phaser style object */\n style?: Phaser.Types.GameObjects.Text.TextStyle | undefined\n}\n\n/**\n * Text component\n * Renders text with full styling support\n *\n * @example\n * ```tsx\n * <Text text=\"Hello World\" />\n * ```\n */\nexport function Text(props: TextProps): VNodeLike {\n const localTheme = useTheme()\n // Cast props to any for getThemedProps to handle optional style prop\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('Text', localTheme, props as any)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <text {...themed} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * TileSprite component wrapper - strict type-safe wrapper around primitive tilesprite\n * This component is the public API for TileSprite, with controlled prop interface\n */\nimport type { VNodeLike } from '@number10/phaserjsx/vdom'\nimport type * as Phaser from 'phaser'\nimport type { PhaserProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\n\n/**\n * Props for TileSprite component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface TileSpriteProps\n extends TransformProps, PhaserProps, PropsDefaultExtension<Phaser.GameObjects.TileSprite> {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Width of the tile sprite area */\n width: number\n\n /** Height of the tile sprite area */\n height: number\n\n /** Horizontal tile position offset (for scrolling effect) */\n tilePositionX?: number\n\n /** Vertical tile position offset (for scrolling effect) */\n tilePositionY?: number\n\n /** Horizontal tile scale factor */\n tileScaleX?: number\n\n /** Vertical tile scale factor */\n tileScaleY?: number\n\n /** Tint color applied to tiles (0xRRGGBB) */\n tint?: number\n\n /** Origin X (0-1, default 0) */\n originX?: number\n\n /** Origin Y (0-1, default 0) */\n originY?: number\n\n /** Children are not supported for TileSprite component */\n children?: ChildrenType\n}\n\n/**\n * TileSprite component\n * Displays repeating texture patterns for backgrounds and effects\n *\n * @example\n * ```tsx\n * // Scrolling background\n * <TileSprite\n * texture=\"clouds\"\n * width={800}\n * height={200}\n * tilePositionX={scrollOffset}\n * />\n *\n * // Scaled tiles\n * <TileSprite\n * texture=\"pattern\"\n * width={400}\n * height={400}\n * tileScaleX={2}\n * tileScaleY={2}\n * />\n * ```\n */\nexport function TileSprite(props: TileSpriteProps): VNodeLike {\n const localTheme = useTheme()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('TileSprite', localTheme, props as any)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <tilesprite {...themed} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * WrapText component - Text that automatically wraps to parent container width\n * Eliminates boilerplate for text wrapping by detecting parent dimensions\n * @module components/custom/WrapText\n */\nimport { useCallback, useEffect, useRef, useScene, useState, useTheme } from '../../hooks'\nimport { getRenderContext } from '../../render-context'\nimport { getThemedProps } from '../../theme'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View, type TextProps } from '../index'\n\n/**\n * WrapText component props\n */\nexport interface WrapTextProps extends TextProps {\n /** Enable/disable automatic wrapping (default: true) */\n wrap?: boolean\n /** Optional cache key to persist measured width across remounts */\n cacheKey?: string\n}\n\nconst widthCache = new Map<string, number>()\n\n/**\n * WrapText component\n * Automatically wraps text based on parent container width\n *\n * **IMPORTANT:** Parent container MUST have explicit width!\n * - Use `width={300}` or `width=\"fill\"` on parent\n * - `maxWidth` alone does NOT work (layout system limitation)\n *\n * @param props - WrapText props\n * @returns WrapText component\n *\n * @example\n * ```tsx\n * // ✅ CORRECT: Parent with explicit width\n * <View width={400}>\n * <WrapText text=\"This text will wrap at 400px\" />\n * </View>\n *\n * // ✅ CORRECT: Parent with fill (if its parent has size)\n * <View width=\"fill\">\n * <WrapText text=\"This text wraps to parent width\" />\n * </View>\n *\n * // ❌ WRONG: Only maxWidth (text won't wrap correctly)\n * <View maxWidth={400}>\n * <WrapText text=\"This won't work as expected\" />\n * </View>\n *\n * // With styling\n * <View width={300}>\n * <WrapText\n * text=\"Styled text\"\n * style={{ fontSize: '16px', color: '#333' }}\n * align=\"center\"\n * />\n * </View>\n *\n * // Disable wrapping\n * <View width={300}>\n * <WrapText text=\"Single line\" wrap={false} />\n * </View>\n *\n * // With padding offset\n * <View width={400} padding={24}>\n * <WrapText text=\"Text\" paddingOffset={48} />\n * </View>\n * ```\n */\nexport function WrapText(props: WrapTextProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed } = getThemedProps('WrapText', localTheme, {})\n const scene = useScene()\n\n const wrap = props.wrap ?? themed.wrap ?? true\n const paddingOffset = themed.paddingOffset ?? 0\n\n // Get parent container width for text wrapping\n type ContainerWithLayout = Phaser.GameObjects.Container & {\n __getLayoutSize?: () => { width: number; height: number }\n }\n const textKey = typeof props.text === 'string' ? props.text : null\n let cacheKey: string | null = null\n if (typeof props.cacheKey === 'string') {\n cacheKey = props.cacheKey\n } else if (typeof props.key === 'string') {\n cacheKey = textKey ? `${props.key}::${textKey}` : props.key\n } else if (textKey) {\n cacheKey = textKey\n }\n\n const cachedWidth = cacheKey ? (widthCache.get(cacheKey) ?? 0) : 0\n\n // Start with cached width (if any) to prevent layout flash across remounts\n const [containerWidth, setContainerWidth] = useState(cachedWidth)\n const lastWidthRef = useRef(cachedWidth)\n const containerRef = useRef<ContainerWithLayout | null>(null)\n const measureRafRef = useRef<number | null>(null)\n\n const measureWidth = useCallback(\n (container: ContainerWithLayout) => {\n if (!wrap) return\n\n const performMeasure = () => {\n if (!container.__getLayoutSize) return\n\n const size = container.__getLayoutSize()\n const nextWidth = size.width\n\n if (nextWidth > 0 && nextWidth !== lastWidthRef.current && nextWidth !== containerWidth) {\n lastWidthRef.current = nextWidth\n if (cacheKey) {\n widthCache.set(cacheKey, nextWidth)\n }\n setContainerWidth(nextWidth)\n }\n }\n\n // Schedule measure after layout to allow layout to settle\n if (measureRafRef.current !== null) {\n return\n }\n\n if (!container.scene) return\n measureRafRef.current = 1\n getRenderContext(container.scene).deferLayout(() => {\n measureRafRef.current = null\n performMeasure()\n })\n },\n [containerWidth, wrap]\n )\n\n // Use ref callback to detect container mount/changes\n const containerRefCallback = useCallback(\n (container: ContainerWithLayout | null) => {\n if (containerRef.current === container) return\n\n containerRef.current = container\n\n if (!container || !wrap) {\n return\n }\n\n if (containerWidth > 0) {\n return\n }\n\n measureWidth(container)\n },\n [containerWidth, measureWidth, wrap]\n )\n\n // Re-measure if wrap toggles on while mounted and width not yet captured\n useEffect(() => {\n if (!wrap || containerWidth > 0) return\n\n const container = containerRef.current\n if (container) {\n measureWidth(container)\n }\n }, [containerWidth, measureWidth, wrap])\n\n // Listen to scene resize events to re-measure container width\n useEffect(() => {\n if (!scene || !wrap) return\n\n const handleResize = () => {\n const container = containerRef.current\n if (container) {\n // Reset width to trigger re-measurement\n lastWidthRef.current = 0\n setContainerWidth(0)\n // Schedule new measurement\n measureWidth(container)\n }\n }\n\n scene.scale.on('resize', handleResize)\n return () => {\n scene.scale.off('resize', handleResize)\n }\n }, [scene, wrap, measureWidth])\n\n useEffect(() => {\n return () => {\n measureRafRef.current = null\n }\n }, [])\n\n // Calculate effective text width; fall back to last known width when container is temporarily hidden\n const measuredWidth = containerWidth > 0 ? containerWidth : lastWidthRef.current\n const textWidth = measuredWidth > paddingOffset ? measuredWidth - paddingOffset : 0\n\n // Merge themed style with prop style\n const textStyle = {\n ...themed.textStyle,\n ...props.style,\n }\n\n // Add wordWrap if enabled and width available\n const finalStyle =\n wrap && textWidth > 0\n ? {\n ...textStyle,\n wordWrap: { useAdvancedWrap: true, width: textWidth },\n }\n : textStyle\n\n // Build Text props conditionally to satisfy exactOptionalPropertyTypes\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const textProps: any = { text: props.text, style: finalStyle }\n //if (props.align !== undefined) textProps.align = props.align\n if (props.alpha !== undefined) textProps.alpha = props.alpha\n //if (props.visible !== undefined) textProps.visible = props.visible\n if (props.x !== undefined) textProps.x = props.x\n if (props.y !== undefined) textProps.y = props.y\n //if (props.rotation !== undefined) textProps.rotation = props.rotation\n //if (props.scale !== undefined) textProps.scale = props.scale\n\n return (\n <View ref={containerRefCallback} width={'fill'}>\n <Text {...textProps} />\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Toast and NotificationStack components.\n * Compact transient feedback for saves, errors, confirmations, and status updates.\n */\nimport type { EdgeInsets, GapInsets } from '../../core-props'\nimport { useEffect, useMemo, useScene, useTheme } from '../../hooks'\nimport { portalRegistry } from '../../portal'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Button, Text, View, type ViewProps } from '../index'\nimport { Portal } from './Portal'\nimport { WrapText } from './WrapText'\n\nexport type ToastVariant = 'info' | 'success' | 'warning' | 'error'\nexport type NotificationStackPosition =\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'top'\n | 'bottom'\n\nexport interface ToastLabels {\n close?: string\n}\n\nexport interface ToastVariantTheme extends ViewTheme {\n accentColor?: number\n prefix?: ChildrenType\n titleStyle?: Phaser.Types.GameObjects.Text.TextStyle\n messageStyle?: Phaser.Types.GameObjects.Text.TextStyle\n}\n\nexport interface ToastThemeSlot extends ViewTheme {\n variant?: ToastVariant\n width?: ViewProps['width']\n minHeight?: ViewProps['height']\n gap?: number\n contentGap?: number\n accentWidth?: number\n prefixWidth?: number\n titleStyle?: Phaser.Types.GameObjects.Text.TextStyle\n messageStyle?: Phaser.Types.GameObjects.Text.TextStyle\n closeButtonSize?: number\n closeTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n labels?: ToastLabels\n variants?: Partial<Record<ToastVariant, ToastVariantTheme>>\n}\n\nexport interface ToastItem {\n id: string\n variant?: ToastVariant\n title?: string\n message?: string\n content?: ChildrenType\n prefix?: ChildrenType\n suffix?: ChildrenType\n action?: ChildrenType\n dismissible?: boolean\n duration?: number\n autoDismiss?: boolean\n}\n\nexport interface ToastProps extends Omit<ViewProps, 'children'> {\n variant?: ToastVariant\n title?: string\n message?: string\n children?: ChildrenType\n prefix?: ChildrenType\n suffix?: ChildrenType\n action?: ChildrenType\n dismissible?: boolean\n onDismiss?: () => void\n labels?: ToastLabels\n theme?: PartialTheme\n}\n\nexport interface NotificationStackProps extends Omit<ViewProps, 'children'> {\n items: ToastItem[]\n position?: NotificationStackPosition\n width?: ViewProps['width']\n gap?: number\n offset?: number\n duration?: number\n depth?: number\n labels?: ToastLabels\n onDismiss?: (id: string) => void\n theme?: PartialTheme\n}\n\nexport interface NotificationStackAlignment {\n justifyContent: NonNullable<ViewProps['justifyContent']>\n alignItems: NonNullable<ViewProps['alignItems']>\n}\n\nexport interface ToastContentWidthOptions {\n width: ViewProps['width']\n padding: ViewProps['padding']\n gap: number\n accentWidth: number\n hasPrefix: boolean\n prefixWidth: number\n hasClose: boolean\n closeButtonSize: number\n minContentWidth?: number\n}\n\nexport function resolveNotificationStackAlignment(\n position: NotificationStackPosition\n): NotificationStackAlignment {\n const justifyContent = position.startsWith('bottom') ? 'end' : 'start'\n\n if (position.endsWith('left')) return { justifyContent, alignItems: 'start' }\n if (position.endsWith('right')) return { justifyContent, alignItems: 'end' }\n return { justifyContent, alignItems: 'center' }\n}\n\nexport function getToastAutoDismissDuration(item: ToastItem, fallbackDuration: number): number {\n if (item.autoDismiss === false) return 0\n return item.duration ?? fallbackDuration\n}\n\nfunction getHorizontalPadding(padding: ViewProps['padding']): number {\n if (typeof padding === 'number') return padding * 2\n if (!padding) return 0\n\n const edgeInsets = padding as EdgeInsets\n return (edgeInsets.left ?? 0) + (edgeInsets.right ?? 0)\n}\n\nfunction getHorizontalGap(gap: ViewProps['gap']): number {\n if (typeof gap === 'number') return gap\n if (!gap) return 0\n\n return (gap as GapInsets).horizontal ?? 0\n}\n\nexport function getToastContentWidth(options: ToastContentWidthOptions): number | undefined {\n if (typeof options.width !== 'number') return undefined\n\n const columnCount = 1 + 1 + (options.hasPrefix ? 1 : 0) + (options.hasClose ? 1 : 0)\n const totalGap = Math.max(0, columnCount - 1) * options.gap\n const reservedWidth =\n getHorizontalPadding(options.padding) +\n options.accentWidth +\n (options.hasPrefix ? options.prefixWidth : 0) +\n (options.hasClose ? options.closeButtonSize : 0) +\n totalGap\n\n return Math.max(options.minContentWidth ?? 96, options.width - reservedWidth)\n}\n\nfunction isPositiveDuration(duration: number): boolean {\n return Number.isFinite(duration) && duration > 0\n}\n\nexport function Toast(props: ToastProps): VNodeLike {\n const {\n variant,\n title,\n message,\n children,\n prefix,\n suffix,\n action,\n dismissible = true,\n onDismiss,\n labels,\n theme,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Toast', mergedTheme, {})\n const themedToast = themed as ToastThemeSlot\n const resolvedVariant = variant ?? themedToast.variant ?? 'info'\n const variantTheme = themedToast.variants?.[resolvedVariant] ?? {}\n const resolvedWidth = viewProps.width ?? themedToast.width ?? 320\n const resolvedPadding = viewProps.padding ??\n themedToast.padding ?? { left: 10, right: 10, top: 9, bottom: 9 }\n const resolvedGap = getHorizontalGap(viewProps.gap ?? themedToast.gap ?? 10)\n const accentWidth = themedToast.accentWidth ?? 4\n const prefixWidth = themedToast.prefixWidth ?? 24\n const closeButtonSize = themedToast.closeButtonSize ?? 22\n\n const resolvedPrefix = prefix ?? variantTheme.prefix\n const resolvedTitleStyle =\n themedToast.titleStyle || variantTheme.titleStyle\n ? { ...(themedToast.titleStyle ?? {}), ...(variantTheme.titleStyle ?? {}) }\n : undefined\n const resolvedMessageStyle =\n themedToast.messageStyle || variantTheme.messageStyle\n ? { ...(themedToast.messageStyle ?? {}), ...(variantTheme.messageStyle ?? {}) }\n : undefined\n const closeLabel = labels?.close ?? themedToast.labels?.close ?? 'x'\n const hasTextContent = title !== undefined || message !== undefined || children !== undefined\n const hasCloseButton = dismissible && onDismiss !== undefined\n const contentWidth = getToastContentWidth({\n width: resolvedWidth,\n padding: resolvedPadding,\n gap: resolvedGap,\n accentWidth,\n hasPrefix: resolvedPrefix !== undefined,\n prefixWidth,\n hasClose: hasCloseButton,\n closeButtonSize,\n })\n\n return (\n <View\n {...viewProps}\n direction=\"row\"\n alignItems=\"stretch\"\n gap={resolvedGap}\n width={resolvedWidth}\n minHeight={viewProps.minHeight ?? themedToast.minHeight ?? 58}\n padding={resolvedPadding}\n backgroundColor={\n viewProps.backgroundColor ?? variantTheme.backgroundColor ?? themedToast.backgroundColor\n }\n backgroundAlpha={\n viewProps.backgroundAlpha ?? variantTheme.backgroundAlpha ?? themedToast.backgroundAlpha\n }\n borderColor={viewProps.borderColor ?? variantTheme.borderColor ?? themedToast.borderColor}\n borderWidth={viewProps.borderWidth ?? variantTheme.borderWidth ?? themedToast.borderWidth}\n cornerRadius={viewProps.cornerRadius ?? variantTheme.cornerRadius ?? themedToast.cornerRadius}\n theme={nestedTheme}\n >\n <View\n width={accentWidth}\n backgroundColor={variantTheme.accentColor ?? variantTheme.borderColor ?? 0x38bdf8}\n cornerRadius={2}\n />\n\n {resolvedPrefix && (\n <View width={prefixWidth} alignItems=\"center\" justifyContent=\"center\" padding={{ top: 1 }}>\n {resolvedPrefix}\n </View>\n )}\n\n {hasTextContent && (\n <View\n {...(contentWidth === undefined ? { flex: 1 } : {})}\n width={contentWidth ?? 'fill'}\n flexShrink={1}\n gap={themedToast.contentGap ?? 2}\n justifyContent=\"center\"\n overflow=\"hidden\"\n >\n {title !== undefined && <Text text={title} style={resolvedTitleStyle} />}\n {message !== undefined && <WrapText text={message} style={resolvedMessageStyle} />}\n {children}\n </View>\n )}\n\n {action}\n {suffix}\n\n {hasCloseButton && (\n <View alignItems=\"center\" justifyContent=\"center\" padding={{ top: 1 }}>\n <Button\n variant=\"ghost\"\n maxWidth={closeButtonSize}\n maxHeight={closeButtonSize}\n cornerRadius={closeButtonSize}\n padding={0}\n onClick={onDismiss}\n >\n <Text text={closeLabel} />\n </Button>\n </View>\n )}\n </View>\n )\n}\n\nexport function NotificationStack(props: NotificationStackProps): VNodeLike {\n const {\n items,\n position,\n width,\n gap,\n offset,\n duration,\n depth,\n labels,\n onDismiss,\n theme,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('NotificationStack', mergedTheme, {})\n const scene = useScene()\n const viewport = scene ? portalRegistry.getViewportSize(scene) : { width: 800, height: 600 }\n\n const resolvedPosition = position ?? themed.position ?? 'top-right'\n const resolvedDuration = duration ?? themed.duration ?? 4000\n const resolvedGap = gap ?? themed.gap ?? 8\n const resolvedOffset = offset ?? themed.offset ?? 16\n const resolvedWidth = width ?? themed.width ?? 320\n const alignment = resolveNotificationStackAlignment(resolvedPosition)\n const scheduleKey = useMemo(\n () =>\n items\n .map((item) => `${item.id}:${getToastAutoDismissDuration(item, resolvedDuration)}`)\n .join('|'),\n [items, resolvedDuration]\n )\n\n useEffect(() => {\n if (!onDismiss || items.length === 0) return\n\n const timeouts = items\n .map((item) => {\n const itemDuration = getToastAutoDismissDuration(item, resolvedDuration)\n if (!isPositiveDuration(itemDuration)) return null\n\n return setTimeout(() => onDismiss(item.id), itemDuration)\n })\n .filter((timeout): timeout is ReturnType<typeof setTimeout> => timeout !== null)\n\n return () => {\n timeouts.forEach((timeout) => clearTimeout(timeout))\n }\n }, [scheduleKey, onDismiss])\n\n return (\n <Portal depth={depth ?? themed.depth ?? 1200} blockEvents={false}>\n <View\n {...viewProps}\n width={viewport.width}\n height={viewport.height}\n direction=\"column\"\n justifyContent={alignment.justifyContent}\n alignItems={alignment.alignItems}\n padding={viewProps.padding ?? resolvedOffset}\n theme={nestedTheme}\n >\n <View direction=\"column\" gap={resolvedGap} width={resolvedWidth}>\n {items.map((item) => (\n <Toast\n key={item.id}\n {...(item.variant !== undefined ? { variant: item.variant } : {})}\n {...(item.title !== undefined ? { title: item.title } : {})}\n {...(item.message !== undefined ? { message: item.message } : {})}\n {...(item.prefix !== undefined ? { prefix: item.prefix } : {})}\n {...(item.suffix !== undefined ? { suffix: item.suffix } : {})}\n {...(item.action !== undefined ? { action: item.action } : {})}\n {...(item.dismissible !== undefined ? { dismissible: item.dismissible } : {})}\n {...(onDismiss ? { onDismiss: () => onDismiss(item.id) } : {})}\n {...(labels !== undefined ? { labels } : {})}\n theme={nestedTheme}\n >\n {item.content}\n </Toast>\n ))}\n </View>\n </View>\n </Portal>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Divider component - Simple visual separator\n * Test component to validate TSX support in packages/ui\n */\nimport type { SizeValue } from '@number10/phaserjsx/core-props'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\n\n/**\n * Props for Divider component\n */\nexport interface DividerProps {\n /** Orientation of the divider */\n orientation?: 'horizontal' | 'vertical'\n /** Thickness of the divider line */\n thickness?: SizeValue | undefined\n /** Color of the divider */\n color?: number\n /** Length of the divider (defaults to 100%) */\n length?: SizeValue | undefined\n}\n\n/**\n * Divider component - renders a simple line separator\n * @param props - Divider properties\n * @returns Divider JSX element\n */\nexport function Divider(props: DividerProps): VNodeLike {\n const { orientation = 'horizontal', thickness = 1, color = 0xcccccc, length } = props\n\n const isHorizontal = orientation === 'horizontal'\n\n return (\n <View\n width={isHorizontal ? (length ?? '100%') : thickness}\n height={isHorizontal ? thickness : (length ?? '100%')}\n backgroundColor={color}\n />\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Toolbar and ToolButtonGroup components\n * Compact action/toggle button groups for editor tools, HUD controls, and debug panels.\n */\nimport type { ViewProps } from '..'\nimport { toolbarSizePresets } from '../../design-tokens/component-size-presets'\nimport { useEffect, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Button, Text, View, type ButtonProps } from '../index'\nimport type { ButtonSize, ButtonVariant } from './Button'\nimport { Divider } from './Divider'\nimport { MenuButton } from './MenuButton'\nimport type { ContextMenuItem } from './Popover'\n\nexport type ToolbarOrientation = 'horizontal' | 'vertical'\nexport type ToolbarDensity = 'compact' | 'normal'\nexport type ToolbarItemType = 'action' | 'toggle' | 'separator' | 'menu'\n\nexport interface ToolbarLabels {\n overflow?: string\n menuIndicator?: string\n}\n\ninterface ToolbarBaseItem {\n /** Unique item id. Required for action, toggle, and menu items. */\n id?: string\n /** Item type. Omitted type defaults to action. */\n type?: ToolbarItemType\n /** Visible or tooltip label. */\n label?: string\n /** Optional icon/glyph content. */\n icon?: ChildrenType\n /** Full custom button content. Takes precedence over icon and label. */\n children?: ChildrenType\n /** Hide generated label text while keeping label available for tooltips. */\n showLabel?: boolean\n /** Disabled item state. */\n disabled?: boolean\n /** Tooltip text. Falls back to label when labels are hidden. */\n tooltip?: string\n /** Item-specific button variant. */\n buttonVariant?: ButtonVariant\n /** Item-specific button size. */\n buttonSize?: ButtonSize\n /** Button prop overrides. */\n buttonProps?: Omit<ButtonProps, 'children' | 'label' | 'onClick' | 'disabled'>\n /** Called before Toolbar onSelect. */\n onSelect?: (id: string) => void\n}\n\nexport interface ToolbarActionItem extends ToolbarBaseItem {\n type?: 'action'\n id: string\n}\n\nexport interface ToolbarToggleItem extends ToolbarBaseItem {\n type: 'toggle'\n id: string\n /** Controlled pressed state for this toggle. */\n pressed?: boolean\n /** Initial pressed state for uncontrolled toolbars. */\n defaultPressed?: boolean\n /** Allow clicking an active toggle to clear it. */\n allowDeselect?: boolean\n /** Called when the toggle pressed state changes. */\n onToggle?: (pressed: boolean, id: string) => void\n}\n\nexport interface ToolbarMenuItem extends ToolbarBaseItem {\n type: 'menu'\n id: string\n /** Future-facing menu item payload; render with MenuButton when overlay behavior is needed. */\n items?: ContextMenuItem[]\n}\n\nexport interface ToolbarSeparatorItem {\n type: 'separator'\n id?: string\n length?: ViewProps['width']\n thickness?: number\n}\n\nexport type ToolbarItem =\n | ToolbarActionItem\n | ToolbarToggleItem\n | ToolbarMenuItem\n | ToolbarSeparatorItem\n\nexport interface ToolbarThemeSlot extends ViewTheme {\n orientation?: ToolbarOrientation\n density?: ToolbarDensity\n itemWidth?: ViewTheme['width']\n itemHeight?: ViewTheme['height']\n compactItemWidth?: ViewTheme['width']\n compactItemHeight?: ViewTheme['height']\n itemGap?: number\n groupGap?: number\n buttonVariant?: ButtonVariant\n activeButtonVariant?: ButtonVariant\n menuButtonVariant?: ButtonVariant\n buttonSize?: ButtonSize\n compactButtonSize?: ButtonSize\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n activeTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n disabledTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n menuIndicatorStyle?: Phaser.Types.GameObjects.Text.TextStyle\n iconSize?: number\n compactIconSize?: number\n separatorColor?: number\n separatorThickness?: number\n separatorLength?: ViewProps['width']\n disabledAlpha?: number\n labels?: ToolbarLabels\n}\n\nexport interface ToolbarProps extends Omit<ViewProps, 'children'> {\n /** Toolbar items. */\n items: ToolbarItem[]\n /** Active tool id in controlled mode. */\n activeId?: string\n /** Initial active tool id in uncontrolled mode. */\n defaultActiveId?: string\n /** Called when an action, toggle, or menu trigger is selected. */\n onSelect?: (id: string, item: Exclude<ToolbarItem, ToolbarSeparatorItem>) => void\n /** Called when a toggle item changes pressed state. */\n onToggle?: (id: string, pressed: boolean, item: ToolbarToggleItem) => void\n /** Layout orientation. */\n orientation?: ToolbarOrientation\n /** Density preset. */\n density?: ToolbarDensity\n /** Hide generated labels for compact icon-only toolbars. */\n showLabels?: boolean\n /** Disable the entire toolbar. */\n disabled?: boolean\n /** Localized labels. */\n labels?: ToolbarLabels\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\nexport function isToolbarSeparatorItem(item: ToolbarItem): item is ToolbarSeparatorItem {\n return item.type === 'separator'\n}\n\nexport function isToolbarToggleItem(item: ToolbarItem): item is ToolbarToggleItem {\n return item.type === 'toggle'\n}\n\nexport function isToolbarMenuItem(item: ToolbarItem): item is ToolbarMenuItem {\n return item.type === 'menu'\n}\n\nexport function getToolbarItemId(item: ToolbarItem, index: number): string {\n return isToolbarSeparatorItem(item) ? (item.id ?? `separator-${index}`) : item.id\n}\n\nexport function resolveToolbarActiveId(\n items: ToolbarItem[],\n activeId?: string\n): string | undefined {\n if (!activeId) return undefined\n return items.some((item) => !isToolbarSeparatorItem(item) && item.id === activeId)\n ? activeId\n : undefined\n}\n\nfunction getDefaultPressedId(items: ToolbarItem[]): string | undefined {\n return items.find(\n (item): item is ToolbarToggleItem => isToolbarToggleItem(item) && !!item.defaultPressed\n )?.id\n}\n\nfunction mergeTextStyle(\n ...styles: Array<Phaser.Types.GameObjects.Text.TextStyle | undefined>\n): Phaser.Types.GameObjects.Text.TextStyle | undefined {\n const merged = Object.assign({}, ...styles.filter(Boolean))\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\nfunction getDensityTheme(\n density: ToolbarDensity\n): Pick<ToolbarThemeSlot, 'itemWidth' | 'itemHeight' | 'buttonSize' | 'iconSize'> {\n if (density === 'compact') {\n return {\n itemWidth: toolbarSizePresets.compactWidth,\n itemHeight: toolbarSizePresets.compactHeight,\n buttonSize: 'small',\n iconSize: toolbarSizePresets.compactIconSize,\n }\n }\n\n return {}\n}\n\n/**\n * Toolbar component\n */\nexport function Toolbar(props: ToolbarProps): VNodeLike {\n const {\n items,\n activeId,\n defaultActiveId,\n onSelect,\n onToggle,\n orientation,\n density,\n showLabels,\n disabled = false,\n labels: labelOverrides,\n theme,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Toolbar', mergedLocalTheme, {})\n const themedToolbar = themed as unknown as ToolbarThemeSlot\n const isControlled = activeId !== undefined\n const initialActiveId =\n resolveToolbarActiveId(items, activeId ?? defaultActiveId) ?? getDefaultPressedId(items)\n const [internalActiveId, setInternalActiveId] = useState<string | undefined>(initialActiveId)\n const currentActiveId = isControlled\n ? resolveToolbarActiveId(items, activeId)\n : resolveToolbarActiveId(items, internalActiveId)\n\n useEffect(() => {\n if (!isControlled && internalActiveId !== currentActiveId) {\n setInternalActiveId(currentActiveId)\n }\n }, [isControlled, internalActiveId, currentActiveId])\n\n const labels = {\n ...(themedToolbar.labels ?? {}),\n ...(labelOverrides ?? {}),\n }\n const resolvedOrientation = orientation ?? themedToolbar.orientation ?? 'horizontal'\n const resolvedDensity = density ?? themedToolbar.density ?? 'normal'\n const densityTheme = getDensityTheme(resolvedDensity)\n const itemWidth =\n themedToolbar[resolvedDensity === 'compact' ? 'compactItemWidth' : 'itemWidth'] ??\n densityTheme.itemWidth ??\n themedToolbar.itemWidth ??\n 40\n const itemHeight =\n themedToolbar[resolvedDensity === 'compact' ? 'compactItemHeight' : 'itemHeight'] ??\n densityTheme.itemHeight ??\n themedToolbar.itemHeight ??\n 36\n const resolvedButtonSize =\n (resolvedDensity === 'compact' ? themedToolbar.compactButtonSize : undefined) ??\n densityTheme.buttonSize ??\n themedToolbar.buttonSize ??\n 'small'\n const resolvedIconSize =\n (resolvedDensity === 'compact' ? themedToolbar.compactIconSize : undefined) ??\n densityTheme.iconSize ??\n themedToolbar.iconSize\n const resolvedShowLabels = showLabels ?? resolvedDensity !== 'compact'\n const finalAlpha = disabled ? (themedToolbar.disabledAlpha ?? 0.55) : alpha\n const textStyle = themedToolbar.textStyle ?? { color: '#e2e8f0', fontSize: '13px' }\n const activeTextStyle = mergeTextStyle(textStyle, themedToolbar.activeTextStyle)\n const disabledTextStyle = mergeTextStyle(textStyle, themedToolbar.disabledTextStyle)\n const menuIndicatorStyle = themedToolbar.menuIndicatorStyle ?? {\n color: '#94a3b8',\n fontSize: '10px',\n }\n const mainDirection = resolvedOrientation === 'horizontal' ? 'row' : 'column'\n const separatorOrientation = resolvedOrientation === 'horizontal' ? 'vertical' : 'horizontal'\n const separatorLength =\n themedToolbar.separatorLength ?? (resolvedOrientation === 'horizontal' ? itemHeight : itemWidth)\n\n const handlePress = (item: Exclude<ToolbarItem, ToolbarSeparatorItem>) => {\n if (disabled || item.disabled) return\n\n if (isToolbarToggleItem(item)) {\n const pressed = item.pressed ?? currentActiveId === item.id\n const nextPressed = pressed && item.allowDeselect ? false : true\n\n if (!isControlled && item.pressed === undefined) {\n setInternalActiveId(nextPressed ? item.id : undefined)\n }\n\n item.onToggle?.(nextPressed, item.id)\n onToggle?.(item.id, nextPressed, item)\n }\n\n item.onSelect?.(item.id)\n onSelect?.(item.id, item)\n }\n\n const renderItemContent = (\n item: Exclude<ToolbarItem, ToolbarSeparatorItem>,\n pressed: boolean,\n itemDisabled: boolean\n ) => {\n if (item.children) return item.children\n\n const shouldShowLabel = item.showLabel ?? resolvedShowLabels\n const effectiveTextStyle = itemDisabled\n ? disabledTextStyle\n : pressed\n ? activeTextStyle\n : textStyle\n\n return (\n <>\n {item.icon}\n {shouldShowLabel && item.label ? (\n <Text text={item.label} {...(effectiveTextStyle ? { style: effectiveTextStyle } : {})} />\n ) : null}\n {isToolbarMenuItem(item) ? (\n <Text text={labels.menuIndicator ?? 'v'} style={menuIndicatorStyle} />\n ) : null}\n </>\n )\n }\n\n const renderToolbarItem = (item: ToolbarItem, index: number) => {\n const key = getToolbarItemId(item, index)\n\n if (isToolbarSeparatorItem(item)) {\n return (\n <View key={key} alignItems=\"center\" justifyContent=\"center\" theme={nestedTheme}>\n <Divider\n orientation={separatorOrientation}\n length={item.length ?? separatorLength}\n thickness={item.thickness ?? themedToolbar.separatorThickness ?? 1}\n color={themedToolbar.separatorColor ?? 0x475569}\n />\n </View>\n )\n }\n\n const itemDisabled = disabled || !!item.disabled\n const pressed = isToolbarToggleItem(item)\n ? (item.pressed ?? currentActiveId === item.id)\n : currentActiveId === item.id\n const tooltipText = item.tooltip ?? (!resolvedShowLabels ? item.label : undefined)\n const buttonVariant =\n item.buttonVariant ??\n (pressed\n ? (themedToolbar.activeButtonVariant ?? 'primary')\n : isToolbarMenuItem(item)\n ? (themedToolbar.menuButtonVariant ?? themedToolbar.buttonVariant ?? 'secondary')\n : (themedToolbar.buttonVariant ?? 'secondary'))\n const effectiveTextStyle = itemDisabled\n ? disabledTextStyle\n : pressed\n ? activeTextStyle\n : textStyle\n const buttonTheme = mergeThemes(nestedTheme, {\n Button: {\n ...(effectiveTextStyle ? { textStyle: effectiveTextStyle } : {}),\n ...(resolvedIconSize !== undefined ? { iconSize: resolvedIconSize } : {}),\n },\n })\n\n if (isToolbarMenuItem(item)) {\n return (\n <MenuButton\n key={key}\n items={item.items ?? []}\n onSelect={() => {\n item.onSelect?.(item.id)\n onSelect?.(item.id, item)\n }}\n placement={resolvedOrientation === 'horizontal' ? 'bottom-start' : 'right-start'}\n disabled={itemDisabled}\n theme={buttonTheme}\n trigger={({ isOpen }) => (\n <Button\n variant={buttonVariant}\n size={item.buttonSize ?? resolvedButtonSize}\n disabled={itemDisabled}\n width={itemWidth}\n height={itemHeight}\n theme={buttonTheme}\n {...item.buttonProps}\n {...(tooltipText ? { onTooltip: () => tooltipText } : {})}\n >\n <View\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={themedToolbar.gap ?? 6}\n >\n {renderItemContent(item, isOpen, itemDisabled)}\n </View>\n </Button>\n )}\n />\n )\n }\n\n return (\n <Button\n key={key}\n width={itemWidth}\n height={itemHeight}\n variant={buttonVariant}\n size={item.buttonSize ?? resolvedButtonSize}\n disabled={itemDisabled}\n {...item.buttonProps}\n onClick={() => handlePress(item)}\n {...(tooltipText ? { onTooltip: () => tooltipText } : {})}\n theme={buttonTheme}\n >\n <View\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={themedToolbar.gap ?? 6}\n >\n {renderItemContent(item, pressed, itemDisabled)}\n </View>\n </Button>\n )\n }\n\n return (\n <View\n {...viewProps}\n direction={mainDirection}\n alignItems=\"center\"\n gap={themedToolbar.itemGap ?? 6}\n padding={themedToolbar.padding ?? 4}\n backgroundColor={themedToolbar.backgroundColor}\n backgroundAlpha={themedToolbar.backgroundAlpha}\n borderColor={themedToolbar.borderColor}\n borderWidth={themedToolbar.borderWidth}\n cornerRadius={themedToolbar.cornerRadius}\n {...(finalAlpha !== undefined ? { alpha: finalAlpha } : {})}\n theme={nestedTheme}\n >\n {items.map(renderToolbarItem)}\n </View>\n )\n}\n\n/**\n * ToolButtonGroup is an alias for Toolbar when a button-group name fits the UI better.\n */\nexport function ToolButtonGroup(props: ToolbarProps): VNodeLike {\n return <Toolbar {...props} />\n}\n","/**\n * Built-in component implementations\n * Exports creators, patchers, props and registration function for all components\n */\nimport { register } from '../host'\nimport { graphicsCreator, graphicsPatcher } from './primitives/graphics'\nimport { imageCreator, imagePatcher } from './primitives/image'\nimport { nineSliceCreator, nineSlicePatcher } from './primitives/nineslice'\nimport { particlesCreator, particlesPatcher } from './primitives/particles'\nimport { spriteCreator, spritePatcher } from './primitives/sprite'\nimport { textCreator, textPatcher } from './primitives/text'\nimport { tileSpriteCreator, tileSpritePatcher } from './primitives/tilesprite'\nimport { viewCreator, viewPatcher } from './primitives/view'\n\n/**\n * Component type constants for JSX usage (legacy primitives)\n * Note: All primitive components now have custom wrappers\n * Use lowercase primitives internally or import wrappers from custom\n */\n\n/**\n * Registers all built-in components with the host\n * This should be called during library initialization\n */\nexport function registerBuiltins() {\n // Register primitives (lowercase) - internal use\n register('view' as 'View', { create: viewCreator, patch: viewPatcher })\n register('text' as 'Text', { create: textCreator, patch: textPatcher })\n register('nineslice' as 'NineSlice', { create: nineSliceCreator, patch: nineSlicePatcher })\n register('particles' as 'Particles', { create: particlesCreator, patch: particlesPatcher })\n register('sprite' as 'Sprite', { create: spriteCreator, patch: spritePatcher })\n register('image' as 'Image', { create: imageCreator, patch: imagePatcher })\n register('graphics' as 'Graphics', { create: graphicsCreator, patch: graphicsPatcher })\n register('tilesprite' as 'TileSprite', { create: tileSpriteCreator, patch: tileSpritePatcher })\n\n // Register uppercase variants for backward compatibility\n register('View', { create: viewCreator, patch: viewPatcher })\n register('Text', { create: textCreator, patch: textPatcher })\n register('NineSlice', { create: nineSliceCreator, patch: nineSlicePatcher })\n register('Particles', { create: particlesCreator, patch: particlesPatcher })\n register('Sprite', { create: spriteCreator, patch: spritePatcher })\n register('Image', { create: imageCreator, patch: imagePatcher })\n register('Graphics', { create: graphicsCreator, patch: graphicsPatcher })\n register('TileSprite', { create: tileSpriteCreator, patch: tileSpritePatcher })\n\n // Register internal SceneWrapper component (for mountJSX auto-sizing)\n // SceneWrapper is a function component, not a primitive, so it doesn't need creators\n // It will be handled by the function component path in mount()\n}\n\n// Re-export layout types\nexport { type LayoutSize } from './../layout/types'\n\n// Re-export custom components (public API)\nexport {\n ActivityIndicator,\n type ActivityIndicatorLabels,\n type ActivityIndicatorProps,\n type ActivityIndicatorSize,\n type ActivityIndicatorThemeSlot,\n type ActivityIndicatorVariant,\n} from './custom/ActivityIndicator'\nexport {\n Badge,\n formatBadgeCount,\n getBadgeSizeConfig,\n getBadgeText,\n resolveBadgeTextStyle,\n Tag,\n type BadgeFormatOptions,\n type BadgeProps,\n type BadgeSize,\n type BadgeSizeConfig,\n type BadgeTextStyleOptions,\n type BadgeTone,\n type BadgeToneColors,\n type BadgeVariant,\n type TagProps,\n} from './custom/Badge'\nexport { Button, type ButtonProps } from './custom/Button'\nexport {\n Checkbox,\n type CheckboxIndicatorRenderProps,\n type CheckboxLabelPosition,\n type CheckboxProps,\n type CheckboxState,\n} from './custom/Checkbox'\nexport {\n ColorPicker,\n type ColorPickerLabels,\n type ColorPickerProps,\n type ColorPickerState,\n type ColorPickerTone,\n} from './custom/ColorPicker'\nexport {\n DebugPanel,\n type DebugMetricKey,\n type DebugPanelPreset,\n type DebugPanelProps,\n} from './custom/DebugPanel'\nexport { Graphics, type GraphicsProps } from './custom/Graphics'\nexport {\n findListBoxItem,\n ListBox,\n resolveListBoxValue,\n type ListBoxItem,\n type ListBoxItemRenderProps,\n type ListBoxLabels,\n type ListBoxProps,\n type ListBoxThemeSlot,\n} from './custom/ListBox'\nexport {\n MenuButton,\n type MenuButtonProps,\n type MenuButtonTriggerRenderProps,\n} from './custom/MenuButton'\nexport {\n getNextNumberInputValue,\n getNumberInputPrecision,\n normalizeNumberInputValue,\n NumberInput,\n NumberInputIndicator,\n type NumberInputButtonAction,\n type NumberInputButtonDirection,\n type NumberInputButtonPlacement,\n type NumberInputButtonRenderProps,\n type NumberInputIndicatorDirection,\n type NumberInputIndicatorProps,\n type NumberInputIndicatorVariant,\n type NumberInputLabelPosition,\n type NumberInputLabels,\n type NumberInputProps,\n type NumberInputValueOptions,\n type NumberInputValueRenderProps,\n} from './custom/NumberInput'\nexport {\n chunkPalettePickerColors,\n getPalettePickerContrastColor,\n normalizePalettePickerColor,\n normalizePalettePickerColors,\n PalettePicker,\n resolvePalettePickerValue,\n type NormalizedPalettePickerOption,\n type PalettePickerColor,\n type PalettePickerLabels,\n type PalettePickerOption,\n type PalettePickerProps,\n type PalettePickerSwatchRenderProps,\n type PalettePickerThemeSlot,\n} from './custom/PalettePicker'\nexport { Particles, type ParticlesProps } from './custom/Particles'\nexport {\n calculateOverlayPosition,\n ContextMenu,\n Popover,\n type ContextMenuItem,\n type ContextMenuProps,\n type OverlayAnchorRect,\n type OverlayContentSize,\n type OverlayPosition,\n type OverlayPositionOptions,\n type PopoverPlacement,\n type PopoverProps,\n} from './custom/Popover'\nexport {\n clampProgressValue,\n getProgressRatio,\n ProgressBar,\n type ProgressBarFormatProps,\n type ProgressBarLabelPosition,\n type ProgressBarOrientation,\n type ProgressBarProps,\n} from './custom/ProgressBar'\nexport {\n ProgressView,\n type ProgressViewLabels,\n type ProgressViewProps,\n type ProgressViewThemeSlot,\n} from './custom/ProgressView'\nexport { RadioButton, type RadioButtonProps } from './custom/RadioButton'\nexport { RadioGroup, type RadioGroupOption, type RadioGroupProps } from './custom/RadioGroup'\nexport {\n RatingBar,\n type RatingBarIconRenderProps,\n type RatingBarLabels,\n type RatingBarProps,\n type RatingBarSize,\n type RatingBarThemeSlot,\n} from './custom/RatingBar'\nexport {\n findSegmentedControlOption,\n isSegmentedControlOptionSelectable,\n resolveSegmentedControlValue,\n SegmentedControl,\n type SegmentedControlLabelPosition,\n type SegmentedControlLabels,\n type SegmentedControlOption,\n type SegmentedControlOptionRenderProps,\n type SegmentedControlOrientation,\n type SegmentedControlProps,\n type SegmentedControlSize,\n type SegmentedControlThemeSlot,\n type SegmentedControlVariant,\n} from './custom/SegmentedControl'\nexport { Sprite, type SpriteProps } from './custom/Sprite'\nexport { Text, type TextProps } from './custom/Text'\nexport { TileSprite, type TileSpriteProps } from './custom/TileSprite'\nexport {\n getToastAutoDismissDuration,\n NotificationStack,\n resolveNotificationStackAlignment,\n Toast,\n type NotificationStackAlignment,\n type NotificationStackPosition,\n type NotificationStackProps,\n type ToastItem,\n type ToastLabels,\n type ToastProps,\n type ToastThemeSlot,\n type ToastVariant,\n type ToastVariantTheme,\n} from './custom/Toast'\nexport {\n getToolbarItemId,\n isToolbarMenuItem,\n isToolbarSeparatorItem,\n isToolbarToggleItem,\n resolveToolbarActiveId,\n Toolbar,\n ToolButtonGroup,\n type ToolbarActionItem,\n type ToolbarDensity,\n type ToolbarItem,\n type ToolbarItemType,\n type ToolbarLabels,\n type ToolbarMenuItem,\n type ToolbarOrientation,\n type ToolbarProps,\n type ToolbarSeparatorItem,\n type ToolbarThemeSlot,\n type ToolbarToggleItem,\n} from './custom/Toolbar'\nexport { View, type ViewProps } from './custom/View'\n\n// Re-export primitive creators/patchers for advanced use cases\nexport { textCreator, textPatcher, type TextBaseProps } from './primitives/text'\nexport { viewCreator, viewPatcher, type ViewBaseProps } from './primitives/view'\n\n// Re-export NineSlice primitive (internal use only - prefer custom wrapper)\nexport {\n nineSliceCreator,\n nineSlicePatcher,\n type NineSliceBaseProps,\n type NineSliceInnerBounds,\n type NineSlicePrimitiveProps,\n type NineSliceRef,\n} from './primitives/nineslice'\n\n// Re-export Sprite primitive (internal use only - prefer custom wrapper)\nexport { particlesCreator, particlesPatcher, type ParticlesBaseProps } from './primitives/particles'\nexport { spriteCreator, spritePatcher, type SpriteBaseProps } from './primitives/sprite'\n\n// Re-export Image primitive (internal use only - prefer custom wrapper)\nexport {\n imageCreator,\n imagePatcher,\n type ImageBaseProps,\n type ImagePrimitiveProps,\n} from './primitives/image'\n\n// Re-export Graphics primitive (internal use only - prefer custom wrapper)\nexport { graphicsCreator, graphicsPatcher, type GraphicsBaseProps } from './primitives/graphics'\n\n// Re-export TileSprite primitive (internal use only - prefer custom wrapper)\nexport {\n tileSpriteCreator,\n tileSpritePatcher,\n type TileSpriteBaseProps,\n} from './primitives/tilesprite'\n","/**\n * SVG to Phaser Texture Utilities\n * Provides conversion from SVG strings/URLs to Phaser texture resources\n */\nimport type * as Phaser from 'phaser'\n\n/**\n * Preprocesses SVG string to ensure tinting works correctly\n * Replaces fill/stroke=\"currentColor\" and other colors with white (#FFFFFF)\n * This allows Phaser's tint to work by multiplication (white × tint = tint color)\n * @param svg - Raw SVG string\n * @returns Preprocessed SVG string with white fills/strokes\n */\nfunction preprocessSvgForTinting(svg: string): string {\n return (\n svg\n // Replace fill=\"currentColor\" with fill=\"#FFFFFF\"\n .replace(/fill=\"currentColor\"/gi, 'fill=\"#FFFFFF\"')\n // Replace fill='currentColor' with fill='#FFFFFF'\n .replace(/fill='currentColor'/gi, \"fill='#FFFFFF'\")\n // Replace fill:currentColor in style attributes\n .replace(/fill:\\s*currentColor/gi, 'fill: #FFFFFF')\n // Replace stroke=\"currentColor\" with stroke=\"#FFFFFF\" (for outline icons like Lucide)\n .replace(/stroke=\"currentColor\"/gi, 'stroke=\"#FFFFFF\"')\n // Replace stroke='currentColor' with stroke='#FFFFFF'\n .replace(/stroke='currentColor'/gi, \"stroke='#FFFFFF'\")\n // Replace stroke:currentColor in style attributes\n .replace(/stroke:\\s*currentColor/gi, 'stroke: #FFFFFF')\n // Replace black fills (common fallback)\n .replace(/fill=\"#000000\"/gi, 'fill=\"#FFFFFF\"')\n .replace(/fill=\"#000\"/gi, 'fill=\"#FFFFFF\"')\n .replace(/fill='#000000'/gi, \"fill='#FFFFFF'\")\n .replace(/fill='#000'/gi, \"fill='#FFFFFF'\")\n // Replace black strokes\n .replace(/stroke=\"#000000\"/gi, 'stroke=\"#FFFFFF\"')\n .replace(/stroke=\"#000\"/gi, 'stroke=\"#FFFFFF\"')\n .replace(/stroke='#000000'/gi, \"stroke='#FFFFFF'\")\n .replace(/stroke='#000'/gi, \"stroke='#FFFFFF'\")\n )\n}\n\n/**\n * Converts an SVG (string or URL) into a Phaser texture\n *\n * Supports multiple input formats:\n * - Raw SVG string (must start with '<svg')\n * - data:image/svg+xml URL\n * - External URL (http/https)\n *\n * The function creates a canvas element, renders the SVG at the specified dimensions,\n * and registers it as a Phaser texture. If a texture with the same key already exists,\n * it will be replaced.\n *\n * @param scene - Phaser scene instance\n * @param key - Unique texture key for registration\n * @param svgOrUrl - SVG string or URL\n * @param width - Desired texture width in pixels (default: 32)\n * @param height - Desired texture height in pixels (default: 32)\n * @throws {Error} If SVG loading or canvas rendering fails\n * @example\n * ```typescript\n * // Raw SVG string\n * await svgToTexture(scene, 'my-icon', '<svg>...</svg>', 64, 64)\n *\n * // URL\n * await svgToTexture(scene, 'external-icon', 'https://example.com/icon.svg')\n * ```\n */\nexport async function svgToTexture(\n scene: Phaser.Scene,\n key: string,\n svgOrUrl: string,\n width: number = 32,\n height: number = 32\n): Promise<void> {\n const trimmed = svgOrUrl.trim()\n let finalUrl: string\n let shouldRevokeUrl = false\n\n // Detect input type: raw SVG string or URL\n // SVG strings can start with <!-- comment --> or <svg\n const isSvgString = trimmed.startsWith('<svg') || trimmed.startsWith('<!--')\n\n if (isSvgString && trimmed.includes('<svg')) {\n // Raw SVG string - preprocess for tinting, then create blob URL\n const processedSvg = preprocessSvgForTinting(trimmed)\n const blob = new Blob([processedSvg], { type: 'image/svg+xml' })\n finalUrl = URL.createObjectURL(blob)\n shouldRevokeUrl = true\n } else {\n // Already a URL (data: or http/https)\n finalUrl = svgOrUrl\n }\n\n // Load SVG as HTMLImageElement\n const img = await new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image()\n image.crossOrigin = 'anonymous'\n image.onload = () => resolve(image)\n image.onerror = () => reject(new Error(`Failed to load SVG: ${key}`))\n image.src = finalUrl\n })\n\n // Create canvas and render scaled SVG\n const canvas = document.createElement('canvas')\n canvas.width = width\n canvas.height = height\n\n const ctx = canvas.getContext('2d')\n if (!ctx) {\n throw new Error('Failed to get canvas 2D context')\n }\n\n ctx.clearRect(0, 0, width, height)\n ctx.drawImage(img, 0, 0, width, height)\n\n // Remove existing texture if present\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n\n // Register canvas as Phaser texture\n scene.textures.addCanvas(key, canvas)\n\n // Cleanup blob URL after canvas is added\n if (shouldRevokeUrl) {\n URL.revokeObjectURL(finalUrl)\n }\n\n // Force texture refresh to ensure GL texture is created\n const texture = scene.textures.get(key)\n if (texture && texture.source[0]) {\n texture.source[0].update()\n }\n}\n","/**\n * Texture Registry for managing SVG texture loading and reference counting\n * Prevents race conditions when multiple components request the same texture\n */\nimport type * as Phaser from 'phaser'\nimport { svgToTexture } from './svg-texture'\n\ninterface TextureRequest {\n key: string\n svg: string\n width: number\n height: number\n}\n\ninterface TextureEntry {\n refCount: number\n promise: Promise<void> | null\n loaded: boolean\n}\n\n/**\n * Global texture registry to manage texture loading and cleanup\n * Uses reference counting per scene to ensure textures are only removed when no longer needed\n */\nclass TextureRegistry {\n // Map of scene -> textures in that scene\n private sceneTextures = new Map<Phaser.Scene, Map<string, TextureEntry>>()\n\n /**\n * Get or create texture map for a scene\n */\n private getTextureMap(scene: Phaser.Scene): Map<string, TextureEntry> {\n let textures = this.sceneTextures.get(scene)\n if (!textures) {\n textures = new Map()\n this.sceneTextures.set(scene, textures)\n }\n return textures\n }\n\n /**\n * Request a texture in a specific scene, incrementing reference count\n * Loads the texture if it's the first request in this scene\n */\n async requestTexture(scene: Phaser.Scene, request: TextureRequest): Promise<void> {\n const { key } = request\n const textures = this.getTextureMap(scene)\n let entry = textures.get(key)\n\n if (!entry) {\n // First request for this texture in this scene\n entry = {\n refCount: 0,\n promise: null,\n loaded: false,\n }\n textures.set(key, entry)\n }\n\n entry.refCount++\n\n if (!entry.loaded && !entry.promise) {\n // Start loading\n entry.promise = svgToTexture(scene, request.key, request.svg, request.width, request.height)\n .then(() => {\n if (entry) {\n entry.loaded = true\n entry.promise = null\n }\n })\n .catch((err) => {\n if (entry) {\n entry.promise = null\n }\n throw err\n })\n }\n\n // Wait for loading if in progress\n if (entry.promise) {\n await entry.promise\n }\n }\n\n /**\n * Release a texture in a specific scene, decrementing reference count\n * Removes the texture if reference count reaches zero\n */\n releaseTexture(scene: Phaser.Scene, key: string) {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return\n\n const entry = textures.get(key)\n if (!entry) return\n\n entry.refCount--\n if (entry.refCount <= 0) {\n // No more references, remove texture\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n textures.delete(key)\n }\n }\n\n /**\n * Check if a texture is loaded in a specific scene\n */\n isTextureLoaded(scene: Phaser.Scene, key: string): boolean {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return false\n const entry = textures.get(key)\n return entry?.loaded ?? false\n }\n\n /**\n * Get all loaded textures in a specific scene\n */\n getLoadedTextures(scene: Phaser.Scene): string[] {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return []\n return Array.from(textures.entries())\n .filter(([, entry]) => entry.loaded)\n .map(([key]) => key)\n }\n\n /**\n * Release all textures in a specific scene\n * Called automatically when scene shuts down\n */\n releaseScene(scene: Phaser.Scene) {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return\n\n for (const key of textures.keys()) {\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n }\n this.sceneTextures.delete(scene)\n }\n\n /**\n * Release all textures from all scenes\n * Use with caution - removes all textures from all Phaser scenes\n */\n releaseAll() {\n for (const [scene, textures] of this.sceneTextures.entries()) {\n for (const key of textures.keys()) {\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n }\n }\n this.sceneTextures.clear()\n }\n}\n\n// Global instance\nexport const textureRegistry = new TextureRegistry()\n","/**\n * SVG Texture Hooks - Per-scene texture management for SVG-based images\n * Each Phaser Scene maintains its own texture registry for isolation\n */\nimport type * as Phaser from 'phaser'\nimport { getCurrent, useEffect, useMemo, useState } from './hooks'\nimport type { ParentType } from './types'\nimport { textureRegistry } from './utils/texture-registry'\nimport { isPhaserScene } from './utils/phaser-guards'\n\n/**\n * SVG texture configuration for loading\n */\nexport interface SVGTextureConfig {\n key: string\n svg: string\n width?: number\n height?: number\n}\n\n/**\n * Manually release a global SVG texture from memory\n * Only call this if you're sure no component needs the texture anymore\n *\n * @param key - The texture key to release\n * @example\n * ```ts\n * // In a Phaser scene\n * import { releaseSVGTexture } from '@number10/phaserjsx'\n *\n * // When changing levels or cleaning up\n * releaseSVGTexture('icon-bell')\n * ```\n */\nexport function releaseSVGTexture(scene: Phaser.Scene, key: string): void {\n textureRegistry.releaseTexture(scene, key)\n}\n\n/**\n * Manually release multiple global SVG textures from memory\n * Only call this if you're sure no component needs these textures anymore\n *\n * @param keys - Array of texture keys to release\n * @example\n * ```ts\n * // In a Phaser scene\n * import { releaseSVGTextures } from '@number10/phaserjsx'\n *\n * // Clean up all icon textures when changing scenes\n * releaseSVGTextures(['icon-bell', 'icon-settings', 'icon-user'])\n * ```\n */\nexport function releaseSVGTextures(scene: Phaser.Scene, keys: string[]): void {\n for (const key of keys) {\n textureRegistry.releaseTexture(scene, key)\n }\n}\n\n/**\n * Manually release ALL global SVG textures from memory\n * Use with caution - this clears all textures managed by the texture registry\n *\n * @example\n * ```ts\n * // In a Phaser scene shutdown or cleanup\n * import { releaseAllSVGTextures } from '@number10/phaserjsx'\n *\n * // When changing to a different scene or restarting\n * releaseAllSVGTextures()\n * ```\n */\nexport function releaseAllSVGTextures(): void {\n textureRegistry.releaseAll()\n}\n\n/**\n * Hook to load a single SVG as a Phaser texture\n *\n * Automatically handles:\n * - Scene detection from component context\n * - Texture loading and registration\n * - Cleanup on unmount (removes texture from Phaser)\n *\n * @param key - Unique texture key\n * @param svg - SVG string or URL\n * @param width - Texture width in pixels (default: 32)\n * @param height - Texture height in pixels (default: 32)\n * @returns true when texture is loaded and ready to use\n * @example\n * ```tsx\n * function MyIcon() {\n * const ready = useSVGTexture('icon-bell', bellIconSvg, 32, 32)\n * return ready ? <Image texture=\"icon-bell\" /> : null\n * }\n * ```\n */\nexport function useSVGTexture(\n key: string,\n svg: string,\n width: number = 32,\n height: number = 32\n): boolean {\n const [ready, setReady] = useState(false)\n\n // Get scene from render context (isolated per mount point)\n const ctx = (getCurrent() as unknown as { parent: ParentType }) || {}\n const scene = isPhaserScene(ctx.parent)\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject | undefined)?.scene\n\n useEffect(() => {\n if (!scene) return\n\n let cancelled = false\n setReady(false)\n\n // Request texture (with reference counting per scene)\n textureRegistry\n .requestTexture(scene, { key, svg, width, height })\n .then(() => {\n if (!cancelled) {\n setReady(true)\n }\n })\n .catch((err) => {\n if (!cancelled) console.error(`Failed to load SVG texture '${key}':`, err)\n })\n\n // Cleanup: release texture reference\n return () => {\n cancelled = true\n // textureRegistry.releaseTexture(scene, key)\n }\n }, [scene, key, svg, width, height])\n\n return ready\n}\n\n/**\n * Hook to load multiple SVG textures\n *\n * Automatically handles:\n * - Scene detection from component context\n * - Parallel texture loading\n * - Cleanup on unmount (removes all textures from Phaser)\n *\n * @param configs - Array of SVG texture configurations\n * @returns true when all textures are loaded and ready to use\n * @example\n * ```tsx\n * function MyIcons() {\n * const ready = useSVGTextures([\n * { key: 'icon-bell', svg: bellSvg, width: 32, height: 32 },\n * { key: 'icon-settings', svg: settingsSvg, width: 24 },\n * ])\n * return ready ? (\n * <>\n * <Image texture=\"icon-bell\" />\n * <Image texture=\"icon-settings\" />\n * </>\n * ) : null\n * }\n * ```\n */\nexport function useSVGTextures(configs: SVGTextureConfig[]): boolean {\n const [ready, setReady] = useState(false)\n\n // Get scene from render context (isolated per mount point)\n const ctx = (getCurrent() as unknown as { parent: ParentType }) || {}\n const scene = isPhaserScene(ctx.parent)\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject | undefined)?.scene\n\n // Create stable key from configs to detect changes\n const configKey = useMemo(\n () => configs.map((c) => `${c.key}:${c.width ?? 32}:${c.height ?? 32}`).join('|'),\n [configs]\n )\n\n useEffect(() => {\n if (!scene || configs.length === 0) return\n\n let cancelled = false\n setReady(false)\n\n // Request all textures (with reference counting per scene)\n const loadSequentially = async () => {\n for (const config of configs) {\n if (cancelled) break\n await textureRegistry.requestTexture(scene, {\n key: config.key,\n svg: config.svg,\n width: config.width ?? 32,\n height: config.height ?? 32,\n })\n }\n }\n\n loadSequentially()\n .then(() => {\n if (!cancelled) {\n setReady(true)\n }\n })\n .catch((err) => {\n if (!cancelled) console.error('Failed to load SVG textures:', err)\n })\n\n // Cleanup: release all texture references\n return () => {\n cancelled = true\n // Textures are global and shared across mounts - don't release them\n // for (const config of configs) {\n // textureRegistry.releaseTexture(config.key)\n // }\n }\n }, [scene, configKey])\n\n return ready\n}\n","/**\n * DOM input element manager for text input overlay\n * Handles creation, positioning, and lifecycle of DOM input elements\n */\nimport type * as Phaser from 'phaser'\n\n/**\n * Configuration for DOM input element\n */\nexport interface DOMInputConfig {\n /** Input type (text, password, email, etc.) */\n type?: string\n /** Placeholder text */\n placeholder?: string\n /** Initial value */\n value?: string\n /** Whether input is disabled */\n disabled?: boolean\n /** Maximum length of input */\n maxLength?: number\n /** Autocomplete behavior */\n autocomplete?: string\n /** Autocorrect behavior (Safari) */\n autocorrect?: string\n /** Autocapitalize behavior (mobile) */\n autocapitalize?: string\n /** Spellcheck behavior */\n spellcheck?: boolean\n /** CSS styles to apply */\n styles?: Partial<CSSStyleDeclaration>\n /** Input event callback */\n onInput?: (value: string, event: Event) => void\n /** Keyboard event callbacks */\n onKeyDown?: (event: KeyboardEvent) => void\n onKeyUp?: (event: KeyboardEvent) => void\n /** Focus event callbacks */\n onFocus?: (event: FocusEvent) => void\n onBlur?: (event: FocusEvent) => void\n}\n\n/**\n * DOM input element wrapper with automatic positioning\n */\nexport class DOMInputElement {\n private input: HTMLInputElement\n private container: Phaser.GameObjects.Container\n private scene: Phaser.Scene\n private scrollHandler: () => void\n private resizeHandler: () => void\n private throttledScrollHandler: () => void\n private throttledResizeHandler: () => void\n private intersectionObserver: IntersectionObserver | null = null\n private isDestroyed = false\n private lastValues = { left: 0, top: 0, width: 0, height: 0 }\n private counter = 0\n private scrollThrottleTimeout: number | null = null\n private resizeThrottleTimeout: number | null = null\n\n constructor(container: Phaser.GameObjects.Container, config: DOMInputConfig = {}) {\n this.container = container\n this.scene = container.scene\n\n // Create input element\n this.input = document.createElement('input')\n this.input.type = config.type ?? 'text'\n if (config.placeholder) this.input.placeholder = config.placeholder\n if (config.value) this.input.value = config.value\n if (config.disabled) this.input.disabled = config.disabled\n if (config.maxLength) this.input.maxLength = config.maxLength\n if (config.autocomplete) this.input.setAttribute('autocomplete', config.autocomplete)\n if (config.autocorrect) this.input.setAttribute('autocorrect', config.autocorrect)\n if (config.autocapitalize) this.input.setAttribute('autocapitalize', config.autocapitalize)\n if (config.spellcheck !== undefined)\n this.input.setAttribute('spellcheck', config.spellcheck.toString())\n\n // Apply default styles\n this.applyDefaultStyles()\n\n // Apply custom styles\n if (config.styles) {\n Object.assign(this.input.style, config.styles)\n }\n\n // Add to DOM - use document.body for absolute positioning\n document.body.appendChild(this.input)\n\n // Setup event listeners\n if (config.onInput) {\n this.input.addEventListener('input', (e) => {\n config.onInput?.(this.input.value, e)\n })\n }\n\n if (config.onKeyDown) {\n this.input.addEventListener('keydown', config.onKeyDown)\n }\n\n if (config.onKeyUp) {\n this.input.addEventListener('keyup', config.onKeyUp)\n }\n\n if (config.onFocus) {\n this.input.addEventListener('focus', (e) => {\n config.onFocus?.(e)\n })\n }\n\n if (config.onBlur) {\n this.input.addEventListener('blur', (e) => {\n config.onBlur?.(e)\n })\n }\n\n // Initial position update\n this.updatePosition()\n\n // Bind handlers for page scrolling and resizing\n this.scrollHandler = this.updatePosition.bind(this)\n this.resizeHandler = this.updatePosition.bind(this)\n\n // Throttled handlers to limit update frequency\n this.throttledScrollHandler = this.throttle(this.scrollHandler, 20) // ~50fps max\n this.throttledResizeHandler = this.throttle(this.resizeHandler, 20) // ~50fps max\n\n // Setup event listeners immediately (always active)\n // Use capture phase to catch scroll events from any scrollable ancestor\n document.addEventListener('scroll', this.throttledScrollHandler, {\n passive: true,\n capture: true,\n })\n window.addEventListener('resize', this.throttledResizeHandler, { passive: true })\n\n // Setup IntersectionObserver to detect when canvas moves in viewport\n this.setupIntersectionObserver()\n\n // Cleanup on container destroy\n this.container.once('destroy', () => {\n this.destroy()\n })\n\n // Cleanup on scene shutdown\n this.scene.events.once('shutdown', () => {\n this.destroy()\n })\n }\n\n /**\n * Setup IntersectionObserver to detect canvas position changes\n */\n private setupIntersectionObserver(): void {\n const canvas = this.scene.game.canvas\n\n this.intersectionObserver = new IntersectionObserver(\n () => {\n // Canvas moved in viewport, update position\n this.updatePosition()\n },\n {\n threshold: [0, 0.1, 0.5, 0.9, 1.0], // Trigger on various visibility changes\n }\n )\n\n this.intersectionObserver.observe(canvas)\n }\n\n /**\n * Throttle function to limit call frequency\n * @param func - Function to throttle\n * @param delay - Minimum delay between calls in ms\n * @returns Throttled function\n */\n private throttle(func: () => void, delay: number): () => void {\n let timeoutId: number | null = null\n return () => {\n if (timeoutId !== null) return\n timeoutId = window.setTimeout(() => {\n func()\n timeoutId = null\n }, delay)\n }\n }\n\n /**\n * Apply default styles to input element\n */\n private applyDefaultStyles(): void {\n Object.assign(this.input.style, {\n position: 'absolute',\n pointerEvents: 'auto',\n boxSizing: 'border-box',\n fontFamily: 'Arial, sans-serif',\n fontSize: '16px',\n padding: '0px',\n margin: '0px',\n border: 'none',\n borderRadius: '0px',\n backgroundColor: 'transparent',\n color: 'transparent',\n outline: 'none',\n caretColor: 'transparent',\n } as Partial<CSSStyleDeclaration>)\n\n // Inject CSS to disable selection highlighting\n const styleId = 'phaserjsx-input-no-selection'\n if (!document.getElementById(styleId)) {\n const style = document.createElement('style')\n style.id = styleId\n style.textContent = `\n input[type=\"text\"]::selection,\n input[type=\"password\"]::selection,\n input[type=\"email\"]::selection {\n background: transparent !important;\n color: transparent !important;\n }\n `\n document.head.appendChild(style)\n }\n }\n\n /**\n * Update input element position to match Phaser container\n */\n private updatePosition(): void {\n if (this.isDestroyed || !this.container.scene) return\n\n const canvas = this.scene.game.canvas\n const canvasRect = canvas.getBoundingClientRect()\n\n // Get container world position\n const worldTransform = this.container.getWorldTransformMatrix()\n const worldX = worldTransform.tx\n const worldY = worldTransform.ty\n\n // Get container dimensions - prefer actual computed size over layoutProps\n // This ensures minHeight, maxHeight, and other constraints are respected\n const containerWidth = this.container.width ?? 200\n const containerHeight = this.container.height ?? 40\n\n // Calculate position relative to canvas\n const scale = this.scene.game.scale\n const zoom = this.scene.cameras.main.zoom\n\n // Calculate position and size with proper scaling\n const left = Math.round(canvasRect.left + worldX * zoom * scale.displayScale.x)\n const top = Math.round(canvasRect.top + worldY * zoom * scale.displayScale.y)\n const width = Math.round(containerWidth * zoom * scale.displayScale.x)\n const height = Math.round(containerHeight * zoom * scale.displayScale.y)\n this.counter++\n\n // apply only if changed to minimize layout thrashing\n if (\n this.lastValues.left === left &&\n this.lastValues.top === top &&\n this.lastValues.width === width &&\n this.lastValues.height === height\n ) {\n return\n }\n this.lastValues = { left, top, width, height }\n\n /* // Debug output for testing purposes\n console.log('[DOMInputElement] Updating position', {\n counter: this.counter,\n left,\n top,\n width,\n height,\n })\n */\n\n // Apply position and size\n this.input.style.left = `${left}px`\n this.input.style.top = `${top}px`\n this.input.style.width = `${width}px`\n this.input.style.height = `${height}px`\n }\n\n /**\n * Get the DOM input element\n */\n getElement(): HTMLInputElement {\n return this.input\n }\n\n /**\n * Set input value\n */\n setValue(value: string): void {\n if (!this.isDestroyed) {\n this.input.value = value\n }\n }\n\n /**\n * Get input value\n */\n getValue(): string {\n return this.isDestroyed ? '' : this.input.value\n }\n\n /**\n * Focus the input\n */\n focus(): void {\n if (!this.isDestroyed) {\n this.input.focus()\n }\n }\n\n /**\n * Blur the input\n */\n blur(): void {\n if (!this.isDestroyed) {\n this.input.blur()\n }\n }\n\n /**\n * Set disabled state\n */\n setDisabled(disabled: boolean): void {\n if (!this.isDestroyed) {\n this.input.disabled = disabled\n }\n }\n\n /**\n * Set placeholder\n */\n setPlaceholder(placeholder: string): void {\n if (!this.isDestroyed) {\n this.input.placeholder = placeholder\n }\n }\n\n /**\n * Update styles\n */\n setStyles(styles: Partial<CSSStyleDeclaration>): void {\n if (!this.isDestroyed) {\n Object.assign(this.input.style, styles)\n }\n }\n\n /**\n * Destroy the input element and cleanup\n */\n destroy(): void {\n if (this.isDestroyed) return\n this.isDestroyed = true\n\n // Clear any pending throttle timeouts\n if (this.scrollThrottleTimeout !== null) {\n clearTimeout(this.scrollThrottleTimeout)\n }\n if (this.resizeThrottleTimeout !== null) {\n clearTimeout(this.resizeThrottleTimeout)\n }\n\n // Disconnect IntersectionObserver\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect()\n this.intersectionObserver = null\n }\n\n // Remove event listeners\n document.removeEventListener('scroll', this.throttledScrollHandler, { capture: true })\n window.removeEventListener('resize', this.throttledResizeHandler)\n\n // Remove from DOM\n if (this.input.parentElement) {\n this.input.parentElement.removeChild(this.input)\n }\n }\n}\n","import { DOMInputElement, type DOMInputConfig } from './dom-input-manager'\n\nexport type KeyboardInputManagerConfig = {\n onInput?: (value: string, event: Event) => void\n onKeyDown?: (event: KeyboardEvent) => void\n onKeyUp?: (event: KeyboardEvent) => void\n onFocus?: () => void\n onBlur?: () => void\n maxLength?: number\n disabled?: boolean\n debug?: boolean | undefined\n}\n\n/**\n * Manages hidden DOM input for keyboard events\n */\nexport class KeyboardInputManager {\n private domInput: DOMInputElement | null = null\n private container: Phaser.GameObjects.Container\n private config: KeyboardInputManagerConfig\n\n constructor(container: Phaser.GameObjects.Container, config: KeyboardInputManagerConfig) {\n this.container = container\n this.config = config\n this.create()\n }\n\n /**\n * Create hidden DOM input element\n */\n private create(): void {\n const debugStyle: Partial<CSSStyleDeclaration> = this.config.debug\n ? {\n opacity: '0.3',\n backgroundColor: 'rgba(0,0,0,0.3)',\n border: '4px dashed red',\n color: 'white',\n }\n : {}\n\n const domConfig: DOMInputConfig = {\n type: 'text',\n value: '',\n ...(this.config.disabled !== undefined && { disabled: this.config.disabled }),\n ...(this.config.maxLength !== undefined && { maxLength: this.config.maxLength }),\n onInput: (value, event) => {\n this.config.onInput?.(value, event)\n },\n onKeyDown: (event) => {\n this.config.onKeyDown?.(event)\n },\n onKeyUp: (event) => {\n this.config.onKeyUp?.(event)\n },\n onFocus: () => {\n this.config.onFocus?.()\n },\n onBlur: () => {\n this.config.onBlur?.()\n },\n styles: {\n // need to debug until successful at all\n opacity: '0.0',\n // pointerEvents: 'none',\n position: 'absolute',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n ...debugStyle,\n } as Partial<CSSStyleDeclaration>,\n autocomplete: 'off',\n autocorrect: 'off',\n autocapitalize: 'off',\n spellcheck: false,\n }\n\n this.domInput = new DOMInputElement(this.container, domConfig)\n }\n\n /**\n * Update DOM input value programmatically\n */\n setValue(value: string): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.value = value\n }\n }\n\n /**\n * Focus the DOM input\n */\n focus(): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.focus()\n }\n }\n\n /**\n * Blur the DOM input\n */\n blur(): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.blur()\n }\n }\n\n /**\n * Check if DOM input is focused\n */\n isFocused(): boolean {\n const element = this.domInput?.getElement()\n return element === document.activeElement\n }\n\n /**\n * Set pointer events (auto when not focused, none when focused)\n */\n setPointerEvents(enabled: boolean): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.style.pointerEvents = enabled ? 'auto' : 'none'\n }\n }\n\n /**\n * Destroy the DOM input\n */\n destroy(): void {\n this.domInput?.destroy()\n this.domInput = null\n }\n}\n","/**\n * Signal-based animation utilities\n * Provides reactive signals that trigger direct DOM updates without VDOM traversal\n */\nimport { signal, type Signal } from '@preact/signals-core'\n\n/**\n * Animated signal that holds a numeric value\n * Can be used in JSX props for direct updates without VDOM\n */\nexport interface AnimatedSignal extends Signal<number> {\n /** Mark as animated signal for VDOM detection */\n __isAnimated: true\n}\n\n/**\n * Creates an animated signal\n * @param initialValue - Initial numeric value\n * @returns Animated signal\n */\nexport function animatedSignal(initialValue: number): AnimatedSignal {\n const sig = signal(initialValue) as AnimatedSignal\n sig.__isAnimated = true\n return sig\n}\n\n/**\n * Type guard to check if value is an animated signal\n * @param value - Value to check\n * @returns True if value is an animated signal\n */\nexport function isAnimatedSignal(value: unknown): value is AnimatedSignal {\n return (\n typeof value === 'object' &&\n value !== null &&\n '__isAnimated' in value &&\n (value as AnimatedSignal).__isAnimated === true\n )\n}\n\n/**\n * Unwraps signal value or returns raw value\n * Type-safe overloads ensure correct return types\n * @param value - Signal or raw value\n * @returns Unwrapped value\n */\nfunction unwrapSignal(value: AnimatedSignal): number\nfunction unwrapSignal(value: number): number\nfunction unwrapSignal(value: string): string\nfunction unwrapSignal(value: number | AnimatedSignal): number\nfunction unwrapSignal(value: string | AnimatedSignal): string | number\nfunction unwrapSignal(value: number | string | AnimatedSignal): number | string\nfunction unwrapSignal(\n value: number | string | AnimatedSignal | undefined\n): number | string | undefined {\n if (value === undefined) return undefined\n return isAnimatedSignal(value) ? value.value : value\n}\n\nexport { unwrapSignal }\n","/**\n * Spring physics engine for smooth, natural animations\n * Based on spring-damper system with configurable tension, friction, and mass\n */\n\n/**\n * Configuration for spring physics behavior\n */\nexport interface SpringConfig {\n /** Spring stiffness (higher = faster, snappier). Default: 170 */\n tension?: number\n /** Damping force (higher = less oscillation). Default: 26 */\n friction?: number\n /** Mass of the animated object (higher = slower). Default: 1 */\n mass?: number\n /** Velocity threshold below which animation stops. Default: 0.01 */\n restVelocity?: number\n /** Distance threshold below which animation stops. Default: 0.01 */\n restDelta?: number\n /** Clamp values to prevent overshoot. Default: false */\n clamp?: boolean\n}\n\n/**\n * Spring physics state\n */\nexport interface SpringState {\n /** Current value */\n value: number\n /** Current velocity */\n velocity: number\n}\n\n/**\n * Default spring configuration (similar to react-spring)\n */\nexport const DEFAULT_SPRING_CONFIG: Required<SpringConfig> = {\n tension: 170,\n friction: 26,\n mass: 1,\n restVelocity: 0.01,\n restDelta: 0.01,\n clamp: false,\n}\n\n/**\n * Preset spring configurations for common use cases\n * Note: clamp prevents overshoot but can make animations feel less natural\n * For UI animations, consider enabling clamp to prevent visual artifacts\n */\nexport const SPRING_PRESETS = {\n /** Gentle, slow animation */\n gentle: { tension: 120, friction: 14 },\n /** Moderate, balanced animation (default) */\n default: { tension: 170, friction: 26 },\n /** Fast, snappy animation */\n wobbly: { tension: 180, friction: 12 },\n /** Very fast, bouncy animation */\n stiff: { tension: 210, friction: 20 },\n /** Slow, smooth animation */\n slow: { tension: 280, friction: 60 },\n /** Instant, no animation */\n instant: { tension: 1000, friction: 100 },\n} as const\n\n/**\n * Type for animation preset keys\n */\nexport type AnimationPreset = keyof typeof SPRING_PRESETS\n/**\n * Type for animation configuration (preset name or custom config)\n */\nexport type AnimationConfig = AnimationPreset | SpringConfig\n\n/**\n * Spring physics engine\n * Implements spring-damper physics for smooth, natural animations\n */\nexport class SpringPhysics {\n private config: Required<SpringConfig>\n\n /**\n * Creates a new spring physics engine\n * @param config - Spring configuration\n */\n constructor(config: SpringConfig = {}) {\n this.config = { ...DEFAULT_SPRING_CONFIG, ...config }\n }\n\n /**\n * Updates spring configuration\n * @param config - Partial config to merge with current\n */\n updateConfig(config: Partial<SpringConfig>): void {\n this.config = { ...this.config, ...config }\n }\n\n /**\n * Performs one physics step\n * Uses semi-implicit Euler integration for stability\n * @param state - Current spring state\n * @param target - Target value\n * @param deltaTime - Time delta in seconds\n * @returns New spring state\n */\n step(state: SpringState, target: number, deltaTime: number): SpringState {\n const { tension, friction, mass, clamp } = this.config\n\n // Calculate spring force (Hooke's law)\n const springForce = -tension * (state.value - target)\n\n // Calculate damping force\n const dampingForce = -friction * state.velocity\n\n // Calculate acceleration (F = ma → a = F/m)\n const acceleration = (springForce + dampingForce) / mass\n\n // Update velocity (semi-implicit Euler)\n const newVelocity = state.velocity + acceleration * deltaTime\n\n // Update position\n let newValue = state.value + newVelocity * deltaTime\n\n // Clamp if enabled\n if (clamp) {\n const min = Math.min(state.value, target)\n const max = Math.max(state.value, target)\n newValue = Math.max(min, Math.min(max, newValue))\n }\n\n return {\n value: newValue,\n velocity: newVelocity,\n }\n }\n\n /**\n * Checks if spring has reached rest state\n * @param state - Current spring state\n * @param target - Target value\n * @returns True if spring is at rest\n */\n isAtRest(state: SpringState, target: number): boolean {\n const { restVelocity, restDelta } = this.config\n const isVelocitySmall = Math.abs(state.velocity) <= restVelocity\n const isDisplacementSmall = Math.abs(state.value - target) <= restDelta\n return isVelocitySmall && isDisplacementSmall\n }\n\n /**\n * Snaps spring to target if at rest\n * @param state - Current spring state\n * @param target - Target value\n * @returns Adjusted state (snapped if at rest)\n */\n snapIfAtRest(state: SpringState, target: number): SpringState {\n if (this.isAtRest(state, target)) {\n return { value: target, velocity: 0 }\n }\n return state\n }\n}\n","/**\n * Spring animation hook\n * Provides physics-based animations using signals for direct updates\n */\nimport { computed, type Signal } from '@preact/signals-core'\nimport type * as Phaser from 'phaser'\nimport { getCurrent, useEffect, useRef } from '../hooks'\nimport type { ParentType } from '../types'\nimport { isPhaserScene } from '../utils/phaser-guards'\nimport { animatedSignal, type AnimatedSignal } from './animated-signal'\nimport {\n SPRING_PRESETS,\n SpringPhysics,\n type SpringConfig,\n type SpringState,\n} from './spring-physics'\n\n/**\n * Spring animation hook\n * Creates an animated signal that smoothly transitions to target values\n *\n * @param initialValue - Initial value\n * @param config - Spring configuration or preset name\n * @returns Tuple of [animated signal, setter function]\n *\n * @example\n * ```tsx\n * // ✓ SAFE - leaf node\n * const [x, setX] = useSpring(0, 'wobbly')\n * <View x={x} width={50} height={50} backgroundColor={0xff0000} />\n *\n * // ✓ SAFE - transform properties\n * const [scale, setScale] = useSpring(1, 'default')\n * <View scale={scale}><Text text=\"Hello\" /></View>\n *\n * // ✗ UNSAFE - container with percentage children\n * const [width, setWidth] = useSpring(200, 'wobbly')\n * <View width={width}><NineSlice width=\"100%\" /></View> // BREAKS!\n * ```\n */\nexport function useSpring(\n initialValue: number,\n config?: SpringConfig | keyof typeof SPRING_PRESETS,\n onComplete?: () => void\n): [AnimatedSignal, (target: number | ((prev: number) => number)) => void] {\n // Resolve config\n const resolvedConfig =\n typeof config === 'string' ? SPRING_PRESETS[config] : (config ?? SPRING_PRESETS.default)\n\n // Create animated signal\n const valueSignal = useRef<AnimatedSignal | null>(null)\n if (valueSignal.current === null) {\n valueSignal.current = animatedSignal(initialValue)\n }\n\n // Get scene from render context (DURING RENDER, while getCurrent() is available)\n const ctx = getCurrent() as { parent: ParentType } | null\n const scene = ctx\n ? isPhaserScene(ctx.parent)\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject).scene\n : null\n\n // Physics state\n const state = useRef<SpringState>({ value: initialValue, velocity: 0 })\n const target = useRef<Signal<number>>({ value: initialValue } as Signal<number>)\n const physics = useRef(new SpringPhysics(resolvedConfig))\n const updateListenerRef = useRef<((time: number, delta: number) => void) | null>(null)\n const sceneRef = useRef<Phaser.Scene | null>(scene)\n const wasAtRest = useRef<boolean>(true) // Track if previously at rest\n\n // Update scene ref if it changes (shouldn't happen, but defensive)\n if (scene && sceneRef.current !== scene) {\n sceneRef.current = scene\n }\n\n // Setter function - stable reference across renders\n const setValue = (newTarget: number | ((prev: number) => number)) => {\n const nextTarget = typeof newTarget === 'function' ? newTarget(target.current.value) : newTarget\n target.current.value = nextTarget\n }\n\n useEffect(() => {\n const scene = sceneRef.current\n if (!scene) {\n console.warn('useSpring: Phaser scene not found in context')\n return\n }\n\n // Physics update loop\n const updateListener = (_time: number, delta: number) => {\n const currentTarget = target.current.value\n const currentState = state.current\n\n // Check if at rest\n const atRest = physics.current.isAtRest(currentState, currentTarget)\n\n // Call onComplete if just reached rest\n if (atRest && !wasAtRest.current && onComplete) {\n onComplete()\n }\n wasAtRest.current = atRest\n\n // Skip if already at rest\n if (atRest) {\n // Snap to target\n const snapped = physics.current.snapIfAtRest(currentState, currentTarget)\n if (snapped.value !== currentState.value && valueSignal.current) {\n state.current = snapped\n valueSignal.current.value = snapped.value\n }\n return\n }\n\n // Perform physics step\n const deltaSeconds = delta / 1000\n const newState = physics.current.step(currentState, currentTarget, deltaSeconds)\n\n // Update state and signal\n if (valueSignal.current) {\n state.current = newState\n valueSignal.current.value = newState.value\n }\n }\n\n updateListenerRef.current = updateListener\n scene.events.on('update', updateListener)\n\n // Cleanup\n return () => {\n if (sceneRef.current && updateListenerRef.current) {\n sceneRef.current.events.off('update', updateListenerRef.current)\n }\n }\n }, [])\n\n if (!valueSignal.current) {\n throw new Error('useSpring: Failed to initialize animated signal')\n }\n\n return [valueSignal.current, setValue]\n}\n\n/**\n * Multi-spring animation hook\n * Creates multiple animated signals that share the same configuration\n * @param initialValues - Object with initial values\n * @param config - Spring configuration or preset name\n * @returns Tuple of [animated signals object, setter function]\n *\n * @example\n * ```tsx\n * const [pos, setPos] = useSprings({ x: 0, y: 0 }, 'wobbly')\n * <View x={pos.x} y={pos.y} />\n * setPos({ x: 100, y: 200 })\n * ```\n */\nexport function useSprings<T extends Record<string, number>>(\n initialValues: T,\n config?: SpringConfig | keyof typeof SPRING_PRESETS\n): [\n { [K in keyof T]: AnimatedSignal },\n (values: Partial<{ [K in keyof T]: number | ((prev: number) => number) }>) => void,\n] {\n const keys = Object.keys(initialValues) as (keyof T)[]\n const springsMap = useRef<\n Map<\n keyof T,\n {\n signal: AnimatedSignal\n target: { value: number }\n state: SpringState\n physics: SpringPhysics\n }\n >\n >(new Map())\n const updateListenerRef = useRef<((time: number, delta: number) => void) | null>(null)\n const sceneRef = useRef<Phaser.Scene | null>(null)\n\n // Resolve config\n const resolvedConfig =\n typeof config === 'string' ? SPRING_PRESETS[config] : (config ?? SPRING_PRESETS.default)\n\n // Initialize springs manually (can't use hooks in loops!)\n keys.forEach((key) => {\n if (!springsMap.current.has(key)) {\n const initialValue = initialValues[key] as number\n const signal = animatedSignal(initialValue)\n const target = { value: initialValue }\n const state = { value: initialValue, velocity: 0 }\n const physics = new SpringPhysics(resolvedConfig)\n springsMap.current.set(key, { signal, target, state, physics })\n }\n })\n\n // Get scene from render context (DURING RENDER, while getCurrent() is available)\n const ctx = getCurrent() as { parent: ParentType } | null\n const scene = ctx\n ? isPhaserScene(ctx.parent)\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject).scene\n : null\n\n // Update scene ref if it changes (shouldn't happen, but defensive)\n if (scene && sceneRef.current !== scene) {\n sceneRef.current = scene\n }\n\n // Setup physics update loop\n useEffect(() => {\n const scene = sceneRef.current\n if (!scene) {\n console.warn('useSprings: Phaser scene not found in context')\n return\n }\n\n const updateListener = (_time: number, delta: number) => {\n const deltaSeconds = delta / 1000\n\n springsMap.current.forEach((spring) => {\n const currentTarget = spring.target.value\n const currentState = spring.state\n\n // Skip if already at rest\n if (spring.physics.isAtRest(currentState, currentTarget)) {\n const snapped = spring.physics.snapIfAtRest(currentState, currentTarget)\n if (snapped.value !== currentState.value) {\n spring.state = snapped\n spring.signal.value = snapped.value\n }\n return\n }\n\n // Perform physics step\n const newState = spring.physics.step(currentState, currentTarget, deltaSeconds)\n spring.state = newState\n spring.signal.value = newState.value\n })\n }\n\n updateListenerRef.current = updateListener\n scene.events.on('update', updateListener)\n\n return () => {\n if (sceneRef.current && updateListenerRef.current) {\n sceneRef.current.events.off('update', updateListenerRef.current)\n }\n }\n }, [])\n\n // Build result object\n const signals = {} as { [K in keyof T]: AnimatedSignal }\n keys.forEach((key) => {\n const spring = springsMap.current.get(key)\n if (spring) {\n signals[key] = spring.signal\n }\n })\n\n // Setter function\n const setValues = (values: Partial<{ [K in keyof T]: number | ((prev: number) => number) }>) => {\n Object.entries(values).forEach(([key, value]) => {\n const spring = springsMap.current.get(key as keyof T)\n if (spring) {\n const nextTarget = typeof value === 'function' ? value(spring.target.value) : value\n spring.target.value = nextTarget as number\n }\n })\n }\n\n return [signals, setValues]\n}\n\n/**\n * Export presets for convenience\n */\nexport { computed, SPRING_PRESETS }\n","/** @jsxImportSource ../.. */\nimport type { ViewProps } from '..'\nimport { useSpring, type AnimationConfig } from '../../animation'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useForceRedraw, useLayoutEffect, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\n\n/**\n * Props for Accordion component\n */\nexport interface AccordionProps extends ViewProps, EffectDefinition {\n /** Title as string or custom JSX element */\n title?: string | ChildrenType\n /** Initial open state (default: false) */\n defaultOpen?: boolean\n /** Controlled open state */\n isOpen?: boolean\n /** Callback when accordion is toggled */\n onToggle?: (isOpen: boolean) => void\n /** Enable smooth height animation (default: false) */\n animated?: boolean\n /** Maximum height for animation (default: 200) */\n maxHeight?: number\n /** Automatically measure content height for animation. Note: Creates a duplicate invisible container for measurement. */\n autoHeight?: boolean\n /** Spring animation config (preset name or custom config, default: 'gentle') */\n animationConfig?: AnimationConfig\n /** Callback when accordion animation ends */\n onAnimationEnd?: () => void\n}\n\n/**\n * Accordion component - collapsible header with content\n * @param props - Accordion properties\n * @returns Accordion JSX element\n */\nexport function Accordion(props: AccordionProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Accordion', localTheme, {})\n\n const [internalOpen, setInternalOpen] = useState<boolean>(props.defaultOpen ?? false)\n const isOpen = props.isOpen !== undefined ? props.isOpen : internalOpen\n\n const ref = useRef<Phaser.GameObjects.Container | null>(null)\n const measurementRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect } = useGameObjectEffect(ref)\n\n const autoHeight = props.autoHeight ?? themed.animated ?? false\n const maxHeight = props.maxHeight ?? 200\n const animated = props.animated ?? themed.animated ?? false\n const animationConfig = props.animationConfig ?? themed.animationConfig ?? 'gentle'\n\n const [measuredHeight, setMeasuredHeight] = useState<number>(maxHeight)\n\n // Measure content height when opened\n useLayoutEffect(() => {\n if (autoHeight && isOpen && measurementRef.current) {\n const height = measurementRef.current.height\n setMeasuredHeight(height)\n setContentHeight(height)\n }\n }, [isOpen, autoHeight])\n\n // Animate content height if enabled\n const [contentHeight, setContentHeight] = useSpring(\n animated\n ? isOpen\n ? autoHeight\n ? measuredHeight\n : maxHeight\n : 0\n : isOpen\n ? autoHeight\n ? measuredHeight\n : maxHeight\n : 0,\n animationConfig,\n props.onAnimationEnd\n )\n if (animated) {\n useForceRedraw(20, contentHeight)\n }\n\n const animatedContentHeight = Math.max(0, contentHeight.value)\n const resolvedContentHeight = animated ? animatedContentHeight : isOpen ? undefined : 0\n const resolvedContentVisible = animated ? animatedContentHeight > 0.5 : isOpen\n\n const handleToggle = () => {\n const newState = !isOpen\n setInternalOpen(newState)\n if (animated) {\n const targetHeight = autoHeight ? measuredHeight : maxHeight\n setContentHeight(newState ? targetHeight : 0)\n }\n props.onToggle?.(newState)\n\n // Apply effect: props override theme, theme overrides default\n const resolved = resolveEffect(props, themed as EffectDefinition)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n }\n\n const headerTheme = themed.headerStyle ?? {}\n const contentTheme = themed.contentStyle ?? {}\n const textStyle = themed.textStyle\n\n return (\n <View\n key={props.key}\n width={props.width}\n height={props.height}\n direction=\"column\"\n {...themed}\n theme={nestedTheme}\n >\n {/* Header */}\n <View\n ref={ref}\n direction=\"row\"\n alignItems=\"center\"\n enableGestures={true}\n onTouch={handleToggle}\n {...headerTheme}\n >\n {typeof props.title === 'string' ? (\n <Text text={props.title} {...(textStyle && { style: textStyle })} />\n ) : (\n props.title\n )}\n </View>\n\n {/* Invisible measurement container */}\n {autoHeight && (\n <View visible={false} direction=\"stack\" headless={true} width={0} height={0}>\n <View ref={measurementRef} {...contentTheme}>\n {props.children}\n </View>\n </View>\n )}\n\n {/* Content */}\n <View\n direction=\"column\"\n height={resolvedContentHeight}\n overflow=\"hidden\"\n visible={resolvedContentVisible}\n {...contentTheme}\n >\n {props.children}\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Modal component for overlay dialogs\n * Renders content in a Portal with backdrop and animations\n * @module components/custom/Modal\n */\nimport {\n createFadeInEffect,\n createFadeOutEffect,\n useGameObjectEffect,\n type EffectFn,\n} from '../../effects/use-effect'\nimport type { GestureEventData } from '../../gestures/gesture-types'\nimport { useCallback, useEffect, useRef, useScene, useState, useTheme } from '../../hooks'\nimport { portalRegistry } from '../../portal'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\nimport { Portal } from './Portal'\n\n/**\n * ModalPortal component props\n */\nexport interface ModalProps {\n /** Unique key for VDOM identification */\n key?: string\n /** request if modal should change its open/close state */\n show: boolean\n /** Callback when modal should start closing (backdrop/Escape) */\n onRequestClose?: (() => void) | undefined\n /** Callback when modal has been opened (at start of animation) */\n onOpen?: (() => void) | undefined\n /** Callback when modal has been closed (at end of animation) */\n onClosed?: (() => void) | undefined\n /** Close on backdrop click (default: true) */\n closeOnBackdrop?: boolean | undefined\n /** Close on Escape key (default: true) */\n closeOnEscape?: boolean | undefined\n /** Portal depth (default: 1000) */\n depth?: number | undefined\n /** Custom effect for showing modal content (default: fade in) */\n viewOpenEffect?: EffectFn | undefined\n /** Custom effect for hiding modal content (default: fade out) */\n viewCloseEffect?: EffectFn | undefined\n /** Modal content */\n children?: ChildrenType\n}\n\n/**\n * Modal component with backdrop and animations\n * Uses Portal for rendering above main UI\n * @param props - Modal props\n * @returns Modal component\n */\nexport function Modal(props: ModalProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Modal', localTheme, {})\n const scene = useScene()\n\n const closeOnBackdrop = props.closeOnBackdrop ?? true\n const closeOnEscape = props.closeOnEscape ?? true\n\n const viewOpenEffect = props.viewOpenEffect ?? createFadeInEffect\n const viewCloseEffect = props.viewCloseEffect ?? createFadeOutEffect\n\n const openDurationMs = (themed as { openDuration?: number }).openDuration ?? 320\n const closeDurationMs = (themed as { closeDuration?: number }).closeDuration ?? 260\n\n // Get viewport size from portal registry\n const viewport = scene ? portalRegistry.getViewportSize(scene) : { width: 800, height: 600 }\n\n const backdropRef = useRef<Phaser.GameObjects.Container | null>(null)\n const viewRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect: viewAnimation, stopEffects: stopViewEffects } = useGameObjectEffect(viewRef)\n const { applyEffect: backdropAnimation, stopEffects: stopBackdropEffects } =\n useGameObjectEffect(backdropRef)\n\n const [isVisible, setIsVisible] = useState(false)\n const hasMountedRef = useRef(false)\n const closeRequestedRef = useRef(false)\n const animationPhaseRef = useRef<'opening' | 'closing' | null>(null)\n\n const requestClose = useCallback(() => {\n closeRequestedRef.current = true\n if (props.onRequestClose) {\n props.onRequestClose()\n } else {\n props.onClosed?.()\n }\n }, [props.onClosed, props.onRequestClose])\n\n useEffect(() => {\n if (!viewRef.current || !backdropRef.current) {\n return\n }\n viewRef.current.setVisible(false)\n backdropRef.current.setVisible(false)\n hasMountedRef.current = true\n }, [])\n\n useEffect(() => {\n const view = viewRef.current\n const backdrop = backdropRef.current\n\n if (!view || !backdrop || !hasMountedRef.current) {\n return\n }\n\n stopViewEffects()\n stopBackdropEffects()\n\n if (props.show) {\n animationPhaseRef.current = 'opening'\n closeRequestedRef.current = false\n\n view.setVisible(true)\n backdrop.setVisible(true)\n setIsVisible(true)\n\n props.onOpen?.()\n\n viewAnimation(viewOpenEffect, {\n time: openDurationMs,\n onComplete: () => {\n animationPhaseRef.current = null\n },\n })\n\n backdropAnimation(createFadeInEffect, {\n time: openDurationMs,\n })\n } else if (isVisible || animationPhaseRef.current === 'opening') {\n animationPhaseRef.current = 'closing'\n\n viewAnimation(viewCloseEffect, {\n time: closeDurationMs,\n onComplete: () => {\n view.setVisible(false)\n setIsVisible(false)\n animationPhaseRef.current = null\n\n const shouldNotifyCloseComplete =\n props.onRequestClose !== undefined || !closeRequestedRef.current\n\n if (shouldNotifyCloseComplete) {\n props.onClosed?.()\n }\n\n closeRequestedRef.current = false\n },\n })\n\n backdropAnimation(createFadeOutEffect, {\n time: closeDurationMs,\n onComplete: () => {\n backdrop.setVisible(false)\n },\n })\n } else {\n view.setVisible(false)\n backdrop.setVisible(false)\n }\n }, [props.show])\n\n // Handle Escape key\n useEffect(() => {\n if (!closeOnEscape || !props.show) return\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n requestClose()\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n return () => window.removeEventListener('keydown', handleKeyDown)\n }, [closeOnEscape, props.show, requestClose])\n\n const handleBackdropClick = (e: GestureEventData) => {\n // Stop propagation to prevent click-through\n e.stopPropagation()\n if (closeOnBackdrop) {\n requestClose()\n }\n }\n\n const handleBackdropMove = (e: GestureEventData) => {\n // Stop propagation to prevent scrolling through modal\n e.stopPropagation()\n }\n\n return (\n <Portal {...(props.key && { key: props.key })} depth={props.depth ?? 1000} blockEvents={false}>\n {/* Backdrop - blocks all events below */}\n <View\n ref={backdropRef}\n width={viewport.width}\n height={viewport.height}\n backgroundColor={themed.backdropColor ?? 0x000000}\n alpha={themed.backdropOpacity ?? 0.5}\n onTouch={handleBackdropClick}\n onTouchMove={handleBackdropMove}\n visible={isVisible}\n />\n\n {/* Content Container (centered) */}\n <View\n ref={viewRef}\n width={viewport.width}\n height={viewport.height}\n direction=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n visible={isVisible}\n >\n {/* Content Wrapper (prevents backdrop click) */}\n <View onTouch={(e: GestureEventData) => e.stopPropagation()} theme={nestedTheme}>\n {props.children}\n </View>\n </View>\n </Portal>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Dialog component - structured modal with header, content, and actions\n * Provides consistent layout and styling for dialog patterns\n * @module components/custom/Dialog\n */\nimport type { SizeValue } from '@number10/phaserjsx/core-props'\nimport type { GestureEventData } from '../../gestures/gesture-types'\nimport { useRef, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View } from '../index'\nimport { Modal } from './Modal'\n\n/**\n * Dialog component props\n */\nexport interface DialogProps {\n /** Unique key for VDOM identification */\n key?: string\n /** Ref to the container */\n forwardRef?: (ref: Phaser.GameObjects.Container | null) => void\n /** Whether dialog is visible */\n isOpen: boolean\n /** Callback when dialog should close */\n onClose?: (() => void) | undefined\n /** Close on backdrop click (default: true) */\n closeOnBackdrop?: boolean | undefined\n /** Close on Escape key (default: true) */\n closeOnEscape?: boolean | undefined\n /** Portal depth (default: 1000) */\n depth?: number | undefined\n\n /** Dialog title */\n title: string\n /** Optional prefix content (e.g., Icon) */\n prefix?: ChildrenType\n /** Show close button in header (default: true) */\n showClose?: boolean\n /** Maximum width of dialog (default: 600) */\n maxWidth?: SizeValue\n\n /** Dialog content */\n children: ChildrenType\n /** Optional action buttons in footer */\n actions?: ChildrenType\n}\n\n/**\n * Dialog component with structured layout\n * Provides header with title/icon, content area, and action footer\n *\n * @param props - Dialog props\n * @returns Dialog component\n *\n * @example\n * ```tsx\n * <Dialog\n * isOpen={isOpen}\n * onClose={onClose}\n * title=\"Settings\"\n * prefix={<Icon type=\"gear\" />}\n * actions={\n * <>\n * <Button onClick={onCancel}>Cancel</Button>\n * <Button onClick={onSave}>Save</Button>\n * </>\n * }\n * >\n * <Text>Dialog content...</Text>\n * </Dialog>\n * ```\n */\nexport function Dialog(props: DialogProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Dialog', localTheme, {})\n const internalRef = useRef<Phaser.GameObjects.Container | null>(null)\n\n const showClose = props.showClose ?? themed.showClose ?? true\n const maxWidth = props.maxWidth ?? themed.maxWidth ?? 600\n const prefix = props.prefix ?? themed.prefix\n\n const refCallback = (ref: Phaser.GameObjects.Container | null) => {\n internalRef.current = ref\n props.forwardRef?.(ref)\n }\n\n return (\n <Modal\n {...(props.key && { key: props.key })}\n show={props.isOpen}\n onClosed={props.onClose}\n closeOnBackdrop={props.closeOnBackdrop}\n closeOnEscape={props.closeOnEscape}\n depth={props.depth}\n >\n <View\n ref={refCallback}\n width={maxWidth}\n maxWidth={maxWidth}\n backgroundColor={themed.backgroundColor ?? 0xffffff}\n cornerRadius={themed.cornerRadius ?? 8}\n padding={0}\n direction=\"column\"\n theme={nestedTheme}\n >\n {/* Header */}\n <View direction=\"column\" gap={0} width={'fill'}>\n <View\n direction=\"row\"\n width={'fill'}\n alignItems=\"center\"\n gap={themed.Header?.gap ?? 12}\n padding={themed.Header?.padding ?? 16}\n >\n {/* Prefix (Icon) */}\n {prefix && prefix}\n\n {/* Title */}\n <View flex={1}>\n <Text text={props.title} style={themed.Header?.textStyle} />\n </View>\n\n {/* Close Button */}\n {showClose && props.onClose && (\n <View\n width={themed.Header?.closeButton?.size ?? 32}\n height={themed.Header?.closeButton?.size ?? 32}\n justifyContent=\"center\"\n alignItems=\"center\"\n cornerRadius={themed.Header?.closeButton?.cornerRadius ?? 4}\n backgroundColor={themed.Header?.closeButton?.backgroundColor}\n borderColor={themed.Header?.closeButton?.borderColor}\n borderWidth={themed.Header?.closeButton?.borderWidth}\n onTouch={(e: GestureEventData) => {\n e.stopPropagation()\n props.onClose?.()\n }}\n >\n {themed.closeIcon ?? <Text text=\"X\" />}\n </View>\n )}\n </View>\n {/* Header Divider */}\n <View height={1} width=\"fill\" backgroundColor={themed.Header?.borderColor ?? 0xe0e0e0} />\n </View>\n\n {/* Content */}\n <View\n width={'fill'}\n padding={themed.Content?.padding ?? 16}\n direction=\"column\"\n gap={themed.Content?.gap ?? 12}\n >\n {props.children}\n </View>\n\n {/* Actions Footer */}\n {props.actions && (\n <View direction=\"column\" gap={0} width={'fill'}>\n {/* Actions Divider */}\n <View\n height={1}\n width=\"fill\"\n backgroundColor={themed.Actions?.borderColor ?? 0xe0e0e0}\n />\n <View\n direction=\"row\"\n justifyContent={themed.Actions?.justifyContent ?? 'end'}\n gap={themed.Actions?.gap ?? 8}\n padding={themed.Actions?.padding ?? 16}\n >\n {props.actions}\n </View>\n </View>\n )}\n </View>\n </Modal>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * AlertDialog component - simple confirm/alert dialog with predefined actions\n * Provides variants with automatic styling and button configuration\n * @module components/custom/AlertDialog\n */\nimport { useCallback, useEffect, useMemo, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text } from '../index'\nimport { Button, type ButtonVariant } from './Button'\nimport { Dialog } from './Dialog'\nimport { WrapText } from './WrapText'\n\n/**\n * AlertDialog component props\n */\nexport interface AlertDialogProps {\n /** Unique key for VDOM identification */\n key?: string\n\n /** Whether dialog is visible */\n isOpen: boolean\n /** Callback when dialog should close */\n onClose?: () => void\n\n /** Dialog title */\n title: string\n /** Optional description text */\n description?: string\n\n /** Optional custom prefix (overrides variant icon from theme) */\n prefix?: ChildrenType\n\n /** Visual variant - determines styling and default icons */\n variant?: 'info' | 'warning' | 'destructive' | 'success'\n\n /** Cancel button text (default: \"Cancel\") */\n cancelText?: string\n /** Confirm button text (default: \"OK\") */\n confirmText?: string\n /** Show cancel button (default: true) */\n showCancel?: boolean\n\n /** Callback when confirm button is clicked */\n onConfirm?: () => void | Promise<void>\n /** Close dialog after confirm (default: true) */\n closeOnConfirm?: boolean\n\n /** Override loading state (for async onConfirm) */\n loading?: boolean\n}\n\n/**\n * AlertDialog component\n * Simple confirm/alert dialogs with variants and predefined actions\n *\n * @param props - AlertDialog props\n * @returns AlertDialog component\n *\n * @example\n * ```tsx\n * // With theme icon (variant)\n * <AlertDialog\n * isOpen={isOpen}\n * variant=\"destructive\"\n * title=\"Delete Item?\"\n * description=\"This cannot be undone.\"\n * onConfirm={handleDelete}\n * onClose={onClose}\n * />\n *\n * // With custom icon\n * <AlertDialog\n * isOpen={isOpen}\n * prefix={<Icon type=\"warning\" />}\n * title=\"Warning\"\n * onConfirm={handleAction}\n * onClose={onClose}\n * />\n * ```\n */\nexport function AlertDialog(props: AlertDialogProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed } = getThemedProps('AlertDialog', localTheme, {})\n\n const [isLoading, setIsLoading] = useState(false)\n const showCancel = props.showCancel ?? true\n const closeOnConfirm = props.closeOnConfirm ?? true\n const loading = props.loading ?? isLoading\n\n // Get variant-specific theme configuration\n const variantTheme = props.variant && themed.variants?.[props.variant]\n\n // Props override theme, theme overrides nothing\n const prefix = props.prefix ?? variantTheme?.prefix\n const buttonVariant: ButtonVariant | undefined = variantTheme?.buttonVariant\n\n // Handle confirm with async support (memoized to prevent re-creating on every render)\n const handleConfirm = useCallback(async () => {\n if (!props.onConfirm) return\n\n try {\n setIsLoading(true)\n const result = props.onConfirm()\n\n // Check if it's a promise\n if (result instanceof Promise) {\n await result\n }\n\n // Close dialog after successful confirm (if enabled)\n if (closeOnConfirm) {\n props.onClose?.()\n }\n } catch (error) {\n console.error('AlertDialog confirm error:', error)\n } finally {\n setIsLoading(false)\n }\n }, [props.onConfirm, closeOnConfirm, props.onClose])\n\n // Cleanup loading state when dialog closes\n useEffect(() => {\n if (!props.isOpen) {\n setIsLoading(false)\n }\n }, [props.isOpen])\n\n // Memoize actions to prevent unnecessary re-renders\n const actions = useMemo(\n () => (\n <>\n {showCancel && (\n <Button\n // TODO: find out why immediate close bother the button click animation\n onClick={() => setTimeout(() => props.onClose?.(), 200)}\n disabled={loading}\n >\n <Text text={props.cancelText ?? 'Cancel'} />\n </Button>\n )}\n {props.onConfirm && (\n <Button\n variant={buttonVariant}\n onClick={() => setTimeout(() => handleConfirm(), 200)}\n disabled={loading}\n >\n <Text text={props.confirmText ?? 'OK'} />\n </Button>\n )}\n </>\n ),\n [\n showCancel,\n props.onClose,\n props.cancelText,\n loading,\n props.onConfirm,\n buttonVariant,\n handleConfirm,\n props.confirmText,\n ]\n )\n\n // Memoize content to prevent unnecessary re-renders\n const content = useMemo(\n () => (props.description ? <WrapText text={props.description} /> : null),\n [props.description]\n )\n\n return (\n <Dialog\n {...(props.key && { key: props.key })}\n isOpen={props.isOpen}\n onClose={props.onClose}\n title={props.title}\n prefix={prefix}\n maxWidth={themed.maxWidth ?? 400}\n showClose={true}\n actions={actions}\n closeOnBackdrop={false}\n closeOnEscape={false}\n >\n {content}\n </Dialog>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * BottomSheet component — slide-up panel with backdrop and drag-to-dismiss.\n */\nimport type { CornerRadiusInsets } from '@number10/phaserjsx/core-props'\nimport type { GestureEventData, TouchMoveState } from '../../gestures/gesture-types'\nimport { useRef, useScene, useState, useTheme } from '../../hooks'\nimport { portalRegistry } from '../../portal'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\nimport { Portal } from './Portal'\n\n/// The default portal depth for BottomSheet — can be overridden via props.\nexport const BottomSheetDepth = 1100\n\nexport interface BottomSheetLabels {\n close?: string\n handle?: string\n}\n\n/** Props passed to renderHandle function for custom handle rendering. */\nexport interface HandleRenderProps {\n width: number\n height: number\n color: number\n cornerRadius: number\n}\n\nexport interface BottomSheetThemeSlot extends ViewTheme {\n backdropAlpha?: number\n backdropColor?: number\n panelCornerRadius?: number | CornerRadiusInsets\n handleWidth?: number\n handleHeight?: number\n handleColor?: number\n handleCornerRadius?: number\n handleAreaHeight?: number\n handleAreaColor?: number\n dismissThreshold?: number\n labels?: BottomSheetLabels\n}\n\nexport interface BottomSheetProps {\n /** Unique key for VDOM identification. */\n key?: string | number | undefined\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled usage. */\n defaultOpen?: boolean\n /** Called when open state changes. */\n onOpenChange?: (open: boolean) => void\n /** Sheet content. */\n children: ChildrenType\n /** Height as fraction of viewport (0–1). Default 0.5. */\n height?: number\n /** Drag distance in pixels to trigger dismiss. Default is half the available drag distance. */\n dismissThreshold?: number\n /** Show drag handle. Default true. */\n showHandle?: boolean\n /** Portal depth. */\n depth?: number\n /** Whether tapping the backdrop closes the sheet. Default false. */\n closeOnBackdrop?: boolean\n /** Backdrop alpha when closeOnBackdrop is active. Default 0.5. */\n backdropAlpha?: number\n /** Height of the drag-handle touch area in px. Also used as max-drag cap. Default 32. */\n handleAreaHeight?: number\n /** Custom handle renderer. Receives themed dimensions. Falls back to default bar. */\n renderHandle?: VNodeLike | ((props: HandleRenderProps) => VNodeLike)\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\n/**\n * BottomSheet — slide-up panel with backdrop and drag-to-dismiss.\n *\n * Portal lifecycle: once opened, the Portal stays mounted to avoid\n * duplicate backdrop issues from mount/unmount races in the VDOM.\n * Visibility is controlled via conditional children, not by returning null.\n */\nexport function BottomSheet(props: BottomSheetProps): VNodeLike {\n const {\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n children,\n height: heightFraction = 0.5,\n dismissThreshold,\n showHandle = true,\n depth = BottomSheetDepth,\n closeOnBackdrop = false,\n backdropAlpha,\n handleAreaHeight = 32,\n renderHandle,\n theme,\n } = props\n\n const localTheme = useTheme()\n const scene = useScene()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('BottomSheet', mergedLocalTheme, {})\n const themedControl = themed as unknown as BottomSheetThemeSlot\n\n const isControlled = controlledOpen !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? !!controlledOpen : internalOpen\n\n const viewport = scene ? portalRegistry.getViewportSize(scene) : { width: 800, height: 600 }\n const viewportHeight = viewport.height\n const viewportWidth = viewport.width\n const panelHeight = Math.round(viewportHeight * Math.min(1, Math.max(0.1, heightFraction)))\n const maxDrag = Math.max(0, panelHeight - handleAreaHeight)\n const explicitDismissThreshold = dismissThreshold ?? themedControl.dismissThreshold\n\n const [dragOffset, setDragOffset] = useState(0)\n const dragStartY = useRef(0)\n const dragDistanceRef = useRef(0)\n const possibleDragDistanceRef = useRef(maxDrag)\n\n // Track whether portal has ever been mounted — once true, stays true\n // to prevent duplicate Portal instances from mount/unmount races.\n const [portalEverMounted, setPortalEverMounted] = useState(false)\n\n const commitOpen = (nextOpen: boolean) => {\n if (!isControlled) setInternalOpen(nextOpen)\n onOpenChange?.(nextOpen)\n }\n\n // Open: ensure portal is mounted\n if (isOpen && !portalEverMounted) {\n setPortalEverMounted(true)\n }\n\n const handleTouchMove = (data: GestureEventData) => {\n data.stopPropagation()\n\n const state: TouchMoveState | undefined = data.state\n if (!state) return\n\n if (state === 'start') {\n dragStartY.current = data.pointer.worldY\n dragDistanceRef.current = 0\n possibleDragDistanceRef.current = Math.max(0, viewportHeight - data.pointer.worldY)\n setDragOffset(0)\n } else if (state === 'move') {\n const rawDelta = Math.max(0, data.pointer.worldY - dragStartY.current)\n // Cap drag so the handle area stays visible and interactive\n const nextOffset = Math.min(rawDelta, maxDrag)\n dragDistanceRef.current = rawDelta\n setDragOffset(nextOffset)\n } else if (state === 'end') {\n const finalDelta = Math.max(dragDistanceRef.current, data.pointer.worldY - dragStartY.current)\n const threshold = explicitDismissThreshold ?? possibleDragDistanceRef.current / 2\n if (finalDelta > threshold) {\n commitOpen(false)\n }\n dragDistanceRef.current = 0\n setDragOffset(0)\n }\n }\n\n // Never mounted and not opening → render nothing\n if (!portalEverMounted && !isOpen) return null\n\n // Keep Portal children mounted after first open. Portal owns its own VDOM subtree,\n // so stable children prevent theme loss when reopening the sheet.\n const isOverlayVisible = isOpen || dragOffset > 0\n\n const cornerRadius = themedControl.panelCornerRadius ?? 16\n const handleW = themedControl.handleWidth ?? 36\n const handleH = themedControl.handleHeight ?? 5\n const handleColor = themedControl.handleColor ?? 0x64748b\n const handleCornerRadius = themedControl.handleCornerRadius ?? 2\n const handleAreaColor = themedControl.handleAreaColor\n\n // Panel sits at bottom: y = viewportHeight - panelHeight + drag (drag pulls down)\n // When closed (isOpen=false and dragOffset=0), panelY is irrelevant (showContent=false)\n const panelY = isOpen ? viewportHeight - panelHeight + dragOffset : viewportHeight - panelHeight\n\n return (\n <Portal depth={depth} blockEvents={false}>\n <View\n width={viewportWidth}\n height={viewportHeight}\n backgroundColor={themedControl.backdropColor ?? 0x000000}\n backgroundAlpha={backdropAlpha ?? themedControl.backdropAlpha ?? 0.5}\n enableGestures\n visible={isOpen && closeOnBackdrop}\n onTouch={() => commitOpen(false)}\n />\n\n <View\n width={viewportWidth}\n height={panelHeight}\n y={panelY}\n backgroundColor={themedControl.backgroundColor}\n backgroundAlpha={themedControl.backgroundAlpha ?? 1}\n borderColor={themedControl.borderColor}\n borderWidth={themedControl.borderWidth}\n cornerRadius={cornerRadius}\n direction=\"column\"\n enableGestures\n visible={isOverlayVisible}\n onTouch={(event: GestureEventData) => event.stopPropagation()}\n onTouchMove={(event: GestureEventData) => event.stopPropagation()}\n theme={nestedTheme}\n >\n {showHandle ? (\n <View\n width={viewportWidth}\n height={handleAreaHeight}\n alignItems=\"center\"\n justifyContent=\"center\"\n backgroundColor={handleAreaColor}\n enableGestures\n onTouch={(event: GestureEventData) => event.stopPropagation()}\n onTouchMove={handleTouchMove}\n >\n {renderHandle ? (\n typeof renderHandle === 'function' ? (\n renderHandle({\n width: handleW,\n height: handleH,\n color: handleColor,\n cornerRadius: handleCornerRadius,\n })\n ) : (\n renderHandle\n )\n ) : (\n <View\n width={handleW}\n height={handleH}\n backgroundColor={handleColor}\n cornerRadius={handleCornerRadius}\n />\n )}\n </View>\n ) : null}\n\n <View flex={1} width={'fill'} overflow=\"hidden\" theme={nestedTheme}>\n {children}\n </View>\n </View>\n </Portal>\n )\n}\n\n/**\n * Pre-built handle renderers for use with {@link BottomSheetProps.renderHandle}.\n *\n * @example\n * ```tsx\n * <BottomSheet renderHandle={BottomSheetHandle.Bar} />\n * <BottomSheet renderHandle={BottomSheetHandle.Pill} />\n * <BottomSheet renderHandle={(h) => <View width={h.width} height={h.height} backgroundColor={0xff0000} cornerRadius={4} />} />\n * ```\n */\nexport const BottomSheetHandle = {\n /** Default bar — uses themed width, height, color, cornerRadius. */\n Bar: (props: HandleRenderProps): VNodeLike => (\n <View\n width={props.width}\n height={props.height}\n backgroundColor={props.color}\n cornerRadius={props.cornerRadius}\n />\n ),\n /** Pill variant — cornerRadius for a fully rounded look. */\n Pill: (props: HandleRenderProps): VNodeLike => (\n <View\n width={props.width * 2}\n height={props.height * 3}\n backgroundColor={props.color}\n cornerRadius={props.height * 1.5}\n />\n ),\n /** Gripper variant*/\n Grip: (props: HandleRenderProps): VNodeLike => (\n <View gap={props.height}>\n <View\n width={props.width * 2}\n height={props.height}\n backgroundColor={props.color}\n cornerRadius={props.cornerRadius}\n />\n <View\n width={props.width * 2}\n height={props.height}\n backgroundColor={props.color}\n cornerRadius={props.cornerRadius}\n />\n <View\n width={props.width * 2}\n height={props.height}\n backgroundColor={props.color}\n cornerRadius={props.cornerRadius}\n />\n </View>\n ),\n}\n","import type { CharInfo, LineInfo } from './types'\n\ntype MutableRefObject<T> = { current: T }\n\n/**\n * Break text into lines based on width constraints\n */\nexport const breakIntoLines = (\n text: string,\n scene: Phaser.Scene,\n effectiveMaxWidth: number,\n textStyle: Phaser.Types.GameObjects.Text.TextStyle | undefined,\n charSpacing: number,\n multiline: boolean,\n wordWrap: boolean\n): LineInfo[] => {\n const lines: LineInfo[] = []\n let currentLine: CharInfo[] = []\n let currentX = 0\n let currentLineIndex = 0\n let charIndex = 0\n\n for (let i = 0; i < text.length; i++) {\n const char = text.charAt(i)\n\n // Create temporary text object to measure\n const tempText = scene.add.text(0, 0, char, textStyle ?? {})\n const charWidth = tempText.width\n const charHeight = tempText.height\n tempText.destroy()\n\n // Check for explicit line break\n if (char === '\\n') {\n // Finish current line without adding the newline character itself\n // The newline serves as a line terminator, not a visible character\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = []\n currentLineIndex++\n currentX = 0\n charIndex++\n continue\n }\n\n // Check if we need to wrap (check with spacing included for existing chars)\n const nextX = currentX + charWidth\n const wouldExceedWidth = currentLine.length > 0 ? nextX > effectiveMaxWidth : false\n\n if (multiline && wouldExceedWidth) {\n // Try word wrap\n if (wordWrap && char !== ' ') {\n // Find last space in current line\n let lastSpaceIdx = -1\n for (let j = currentLine.length - 1; j >= 0; j--) {\n if (currentLine[j]?.char === ' ') {\n lastSpaceIdx = j\n break\n }\n }\n\n if (lastSpaceIdx >= 0) {\n // Break at space - remove space and everything after it\n const charsToMove = currentLine.splice(lastSpaceIdx + 1)\n // Remove the space itself from current line\n currentLine.splice(lastSpaceIdx, 1)\n\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = charsToMove\n currentLineIndex++\n\n // Recalculate X for moved chars\n currentX = 0\n for (const movedChar of currentLine) {\n movedChar.x = currentX\n movedChar.lineIndex = currentLineIndex\n movedChar.lineCharIndex = currentLine.indexOf(movedChar)\n currentX += movedChar.width + charSpacing\n }\n } else {\n // No space found, hard break - current char goes to next line\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = []\n currentLineIndex++\n currentX = 0\n }\n } else {\n // Hard break (or at space) - current char goes to next line\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = []\n currentLineIndex++\n currentX = 0\n }\n }\n\n // Add char to current line\n const charInfo: CharInfo = {\n char,\n textObject: null,\n x: currentX,\n y: 0,\n width: charWidth,\n height: charHeight,\n lineIndex: currentLineIndex,\n charIndex,\n lineCharIndex: currentLine.length,\n }\n\n currentLine.push(charInfo)\n currentX += charWidth + charSpacing\n charIndex++\n }\n\n // Add last line\n if (currentLine.length > 0) {\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n }\n\n return lines\n}\n\n/**\n * Create LineInfo from array of CharInfo\n */\nexport const createLineInfo = (\n chars: CharInfo[],\n lineIndex: number,\n charSpacing: number\n): LineInfo => {\n if (chars.length === 0) {\n return {\n chars: [],\n startCharIndex: 0,\n endCharIndex: 0,\n y: 0,\n width: 0,\n height: 0,\n lineIndex,\n }\n }\n\n const width = chars.reduce((sum, char, idx) => {\n return sum + char.width + (idx < chars.length - 1 ? charSpacing : 0)\n }, 0)\n\n const height = Math.max(...chars.map((c) => c.height))\n\n return {\n chars,\n startCharIndex: chars[0]?.charIndex ?? 0,\n endCharIndex: chars[chars.length - 1]?.charIndex ?? 0,\n y: 0,\n width,\n height,\n lineIndex,\n }\n}\n\n/**\n * Position lines vertically with lineHeight spacing\n */\nexport const positionLinesVertically = (lines: LineInfo[], lineHeight: number): void => {\n let currentY = 0\n\n for (const line of lines) {\n line.y = currentY\n\n // Update Y position for all chars in line\n for (const char of line.chars) {\n char.y = currentY\n }\n\n // Calculate spacing to next line\n const lineHeightPx = line.height * lineHeight\n currentY += lineHeightPx\n }\n}\n\n/**\n * Handle text overflow with maxLines limit\n */\nexport const handleOverflow = (\n lines: LineInfo[],\n maxLines?: number,\n textOverflow?: 'clip' | 'ellipsis'\n): LineInfo[] => {\n if (!maxLines || lines.length <= maxLines) {\n return lines\n }\n\n const visibleLines = lines.slice(0, maxLines)\n\n if (textOverflow === 'ellipsis' && visibleLines.length > 0) {\n const lastLine = visibleLines[maxLines - 1]\n if (lastLine) {\n // Add ellipsis indicator by modifying last chars\n const ellipsis = '...'\n if (lastLine.chars.length > ellipsis.length) {\n // Replace last chars with ellipsis\n for (let i = 0; i < ellipsis.length; i++) {\n const charIdx = lastLine.chars.length - ellipsis.length + i\n const char = lastLine.chars[charIdx]\n if (char) {\n char.char = ellipsis[i] ?? '.'\n }\n }\n }\n }\n }\n\n return visibleLines\n}\n\n/**\n * Get cursor position from pointer world coordinates\n */\nexport const getPositionFromPointer = (\n worldX: number,\n worldY: number,\n chars: CharInfo[],\n cursorPosition: number\n): number => {\n for (let i = 0; i < chars.length; i++) {\n const charInfo = chars[i]\n if (charInfo?.textObject) {\n const bounds = charInfo.textObject.getBounds()\n if (\n worldX >= bounds.left &&\n worldX <= bounds.right &&\n worldY >= bounds.top &&\n worldY <= bounds.bottom\n ) {\n return charInfo.charIndex + 1\n }\n }\n }\n\n if (chars.length === 0) {\n return 0\n }\n\n const firstChar = chars[0]\n const lastChar = chars[chars.length - 1]\n\n if (firstChar?.textObject && lastChar?.textObject) {\n const firstBounds = firstChar.textObject.getBounds()\n const lastBounds = lastChar.textObject.getBounds()\n\n if (worldX < firstBounds.left) {\n return 0\n } else if (worldX > lastBounds.right) {\n // Return position after last character in original text\n return lastChar.charIndex + 1\n }\n }\n\n return cursorPosition\n}\n\n/**\n * Get a text object from pool or create new one\n */\nexport const getTextObject = (\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n textStyle: Phaser.Types.GameObjects.Text.TextStyle | undefined,\n textObjectPool: MutableRefObject<Phaser.GameObjects.Text[]>,\n activeTextObjects: MutableRefObject<Phaser.GameObjects.Text[]>\n): Phaser.GameObjects.Text => {\n let textObj = textObjectPool.current.pop()\n if (textObj != null) {\n textObj.setVisible(true)\n } else {\n textObj = scene.add.text(0, 0, '', textStyle ?? {})\n textObj.setOrigin(0, 0)\n container.add(textObj)\n }\n activeTextObjects.current.push(textObj)\n return textObj\n}\n\n/**\n * Return a text object to pool (make invisible)\n */\nexport const returnToPool = (\n textObj: Phaser.GameObjects.Text,\n textObjectPool: MutableRefObject<Phaser.GameObjects.Text[]>,\n activeTextObjects: MutableRefObject<Phaser.GameObjects.Text[]>\n): void => {\n textObj.setVisible(false)\n const index = activeTextObjects.current.indexOf(textObj)\n if (index > -1) {\n activeTextObjects.current.splice(index, 1)\n }\n textObjectPool.current.push(textObj)\n}\n","/** @jsxImportSource ../../.. */\nimport type { GestureEventData } from '../../../core-props'\nimport { useGameObjectEffect } from '../../../effects'\nimport { useEffect, useLayoutEffect, useRef, useState } from '../../../hooks'\nimport { getThemedProps } from '../../../theme'\nimport type { VNodeLike } from '../../../vdom'\nimport { View } from '../../index'\nimport type { CharInfo, CharTextAPI, CharTextProps } from './types'\nimport {\n breakIntoLines,\n createLineInfo,\n getPositionFromPointer,\n getTextObject,\n handleOverflow,\n positionLinesVertically,\n returnToPool,\n} from './utils'\n\n/**\n * CharText component - renders text using individual Phaser Text GameObjects per character\n * @param props - CharText properties\n * @returns CharText JSX element\n */\nexport function CharText(props: CharTextProps): VNodeLike {\n const { props: themed } = getThemedProps('CharText', undefined, {})\n const internalRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect: _applyEffect } = useGameObjectEffect(internalRef)\n\n // Character state management\n const [chars, setChars] = useState<CharInfo[]>([])\n const charsRef = useRef<CharInfo[]>([])\n const [internalText, setInternalText] = useState('')\n const [width, setWidth] = useState(0)\n const [height, setHeight] = useState(0)\n const [containerReady, setContainerReady] = useState(false)\n\n // Object pool for text objects to avoid creating/destroying on every text change\n const textObjectPool = useRef<Phaser.GameObjects.Text[]>([])\n const activeTextObjects = useRef<Phaser.GameObjects.Text[]>([])\n\n // Track when container is ready\n useEffect(() => {\n if (internalRef.current && !containerReady) {\n setContainerReady(true)\n }\n })\n\n // Sync external ref with internal ref when container becomes available\n useEffect(() => {\n if (!containerReady || !internalRef.current) return\n\n const currentRef = props.forwardRef\n currentRef?.(internalRef.current)\n\n // Cleanup: reset external ref on unmount or ref change\n return () => {\n currentRef?.(null)\n }\n }, [containerReady, props.forwardRef])\n\n // Cursor management\n const cursorRef = useRef<Phaser.GameObjects.Rectangle | null>(null)\n const cursorTweenRef = useRef<Phaser.Tweens.Tween | null>(null)\n\n // Selection management\n const selectionRefs = useRef<Phaser.GameObjects.Rectangle[]>([])\n const dragStartPosRef = useRef<number>(-1)\n\n // Track if we're in controlled mode\n const isControlled = props.text !== undefined\n const displayedText = isControlled ? (props.text ?? '') : internalText\n\n // Keep charsRef in sync with chars state\n useEffect(() => {\n charsRef.current = chars\n }, [chars])\n\n // Cleanup all text objects on unmount\n useEffect(() => {\n return () => {\n // Destroy all pooled text objects\n textObjectPool.current.forEach((textObj) => {\n if (textObj && textObj.scene) {\n textObj.destroy()\n }\n })\n textObjectPool.current = []\n\n // Destroy all active text objects\n activeTextObjects.current.forEach((textObj) => {\n if (textObj && textObj.scene) {\n textObj.destroy()\n }\n })\n activeTextObjects.current = []\n\n // Also destroy any remaining in chars\n charsRef.current.forEach((charInfo) => {\n if (charInfo.textObject && charInfo.textObject.scene) {\n charInfo.textObject.destroy()\n }\n })\n }\n }, [])\n\n // Extract style and spacing from props/theme\n const textStyle = props.textStyle ?? themed.textStyle\n const charSpacing = props.charSpacing ?? themed.charSpacing ?? 0\n const padding = props.padding ?? themed.padding ?? 0\n const padLeft = typeof padding === 'number' ? padding : (padding.left ?? 0)\n const padRight = typeof padding === 'number' ? padding : (padding.right ?? 0)\n const horizontalPadding = padLeft + padRight\n const padTop = typeof padding === 'number' ? padding : (padding.top ?? 0)\n const padBottom = typeof padding === 'number' ? padding : (padding.bottom ?? 0)\n const verticalPadding = padTop + padBottom\n\n const showCursor = props.showCursor ?? false\n const cursorPosition = props.cursorPosition ?? displayedText.length\n const cursorColor = props.cursorColor ?? themed.cursorColor ?? 0xffffff\n const cursorWidth = props.cursorWidth ?? themed.cursorWidth ?? 2\n const cursorBlinkSpeed = props.cursorBlinkSpeed ?? themed.cursorBlinkSpeed ?? 530\n\n const selectionStart = props.selectionStart ?? -1\n const selectionEnd = props.selectionEnd ?? -1\n const selectionColor = props.selectionColor ?? themed.selectionColor ?? 0x4a90e2\n const selectionAlpha = props.selectionAlpha ?? themed.selectionAlpha ?? 0.3\n\n const multiline = props.multiline ?? false\n const lineHeight = props.lineHeight ?? themed.lineHeight ?? 1.2\n const maxLines = props.maxLines\n const textOverflow = props.textOverflow ?? 'clip'\n const wordWrap = props.wordWrap ?? themed.wordWrap ?? true\n\n /**\n * Text manipulation API\n */\n const api: CharTextAPI = {\n insertChar: (char: string, index: number) => {\n const newText = displayedText.slice(0, index) + char + displayedText.slice(index)\n if (isControlled) {\n props.onChange?.(newText)\n } else {\n setInternalText(newText)\n props.onChange?.(newText)\n }\n },\n deleteChar: (index: number) => {\n if (index < 0 || index >= displayedText.length) return\n const newText = displayedText.slice(0, index) + displayedText.slice(index + 1)\n if (isControlled) {\n props.onChange?.(newText)\n } else {\n setInternalText(newText)\n props.onChange?.(newText)\n }\n },\n replaceChar: (index: number, char: string) => {\n if (index < 0 || index >= displayedText.length) return\n const newText = displayedText.slice(0, index) + char + displayedText.slice(index + 1)\n if (isControlled) {\n props.onChange?.(newText)\n } else {\n setInternalText(newText)\n props.onChange?.(newText)\n }\n },\n setText: (text: string) => {\n if (isControlled) {\n props.onChange?.(text)\n } else {\n setInternalText(text)\n props.onChange?.(text)\n }\n },\n getText: () => displayedText,\n clear: () => {\n if (isControlled) {\n props.onChange?.('')\n } else {\n setInternalText('')\n props.onChange?.('')\n }\n },\n getCharAtPosition: (worldX: number, worldY: number) => {\n for (let i = 0; i < chars.length; i++) {\n const charInfo = chars[i]\n if (charInfo?.textObject) {\n const bounds = charInfo.textObject.getBounds()\n if (\n worldX >= bounds.left &&\n worldX <= bounds.right &&\n worldY >= bounds.top &&\n worldY <= bounds.bottom\n ) {\n return charInfo.charIndex\n }\n }\n }\n return null\n },\n canFitChar: (char: string, position: number) => {\n // Only applies to single-line mode\n if (multiline) return true\n\n // If no maxWidth set, always fits\n const effectiveMaxWidth =\n props.maxWidth !== undefined && typeof props.maxWidth === 'number'\n ? props.maxWidth\n : props.width !== undefined && typeof props.width === 'number'\n ? props.width\n : Infinity\n\n if (effectiveMaxWidth === Infinity) return true\n\n // Calculate available content width (excluding padding)\n const availableWidth = effectiveMaxWidth - horizontalPadding\n\n if (!internalRef.current) return false\n\n const scene = internalRef.current.scene\n\n // Build the text that would result from inserting the character\n const textWithChar = displayedText.slice(0, position) + char + displayedText.slice(position)\n\n // Calculate total width of the new text\n let totalWidth = 0\n for (let i = 0; i < textWithChar.length; i++) {\n const c = textWithChar.charAt(i)\n const tempText = scene.add.text(0, 0, c, textStyle ?? {})\n const charWidth = tempText.width\n tempText.destroy()\n\n totalWidth += charWidth\n if (i < textWithChar.length - 1) {\n totalWidth += charSpacing\n }\n }\n\n return totalWidth <= availableWidth\n },\n }\n\n // Store API in ref for external access (future use)\n const apiRef = useRef<CharTextAPI>(api)\n apiRef.current = api\n\n // Expose API to parent via callback\n useEffect(() => {\n if (containerReady && props.onApiReady) {\n props.onApiReady(api)\n }\n }, [containerReady, props.onApiReady])\n\n /**\n * Create or update character GameObjects based on text prop\n */\n useLayoutEffect(() => {\n if (!internalRef.current) return\n\n const container = internalRef.current\n const scene = container.scene\n\n // Get the previous displayed text from chars state\n const prevText = chars.map((c) => c.char).join('')\n\n // Check if text has changed\n if (displayedText === prevText) return\n\n const startX = padLeft\n const startY = padTop\n\n // Get effective max width (use container width if multiline and no explicit maxWidth)\n // Important: maxWidth is the content area width, not including padding\n const effectiveMaxWidth =\n multiline && props.maxWidth !== undefined && typeof props.maxWidth === 'number'\n ? props.maxWidth - horizontalPadding\n : multiline && props.width !== undefined && typeof props.width === 'number'\n ? props.width - horizontalPadding\n : Infinity\n\n let lines: import('./types').LineInfo[]\n let allChars: CharInfo[]\n\n if (multiline) {\n // Multi-line layout\n // TODO: Consider wrapping in ScrollView for better overflow handling\n // when content exceeds available height. This would allow scrolling\n // through long text instead of clipping at maxLines.\n lines = breakIntoLines(\n displayedText,\n scene,\n effectiveMaxWidth,\n textStyle,\n charSpacing,\n multiline,\n wordWrap\n )\n positionLinesVertically(lines, lineHeight)\n lines = handleOverflow(lines, maxLines, textOverflow)\n\n // Flatten lines to chars array\n allChars = []\n for (const line of lines) {\n for (const charInfo of line.chars) {\n allChars.push(charInfo)\n }\n }\n } else {\n // Single-line layout (original logic)\n allChars = []\n let currentX = 0\n\n for (let i = 0; i < displayedText.length; i++) {\n const char = displayedText.charAt(i)\n const tempText = scene.add.text(0, 0, char, textStyle ?? {})\n const charWidth = tempText.width\n const charHeight = tempText.height\n tempText.destroy()\n\n allChars.push({\n char,\n textObject: null,\n x: currentX,\n y: 0,\n width: charWidth,\n height: charHeight,\n lineIndex: 0,\n charIndex: i,\n lineCharIndex: i,\n })\n\n currentX += charWidth + charSpacing\n }\n\n lines = allChars.length > 0 ? [createLineInfo(allChars, 0, charSpacing)] : []\n }\n\n // Assign text objects to characters, reusing from pool\n const usedTextObjects: Phaser.GameObjects.Text[] = []\n for (const charInfo of allChars) {\n const textObj = getTextObject(scene, container, textStyle, textObjectPool, activeTextObjects)\n textObj.setText(charInfo.char)\n textObj.setPosition(startX + charInfo.x, startY + charInfo.y)\n charInfo.textObject = textObj\n usedTextObjects.push(textObj)\n }\n\n // Return unused active text objects to pool\n const currentActive = [...activeTextObjects.current]\n for (const textObj of currentActive) {\n if (!usedTextObjects.includes(textObj)) {\n returnToPool(textObj, textObjectPool, activeTextObjects)\n }\n }\n\n // Calculate total dimensions\n const calculatedWidth = lines.length > 0 ? Math.max(...lines.map((l) => l.width)) : 0\n\n // Calculate height: last line Y position + actual character height (not lineHeight multiplied)\n // This ensures the container height exactly fits the content without extra spacing after last line\n let calculatedHeight = 0\n if (lines.length > 0) {\n const lastLine = lines[lines.length - 1]\n if (lastLine) {\n // Height is Y position of last line + its character height\n calculatedHeight = lastLine.y + lastLine.height\n }\n }\n\n // Update state\n setChars(allChars)\n setWidth(calculatedWidth + horizontalPadding)\n setHeight(calculatedHeight + verticalPadding)\n }, [\n displayedText,\n textStyle,\n charSpacing,\n padLeft,\n padTop,\n horizontalPadding,\n verticalPadding,\n multiline,\n lineHeight,\n maxLines,\n textOverflow,\n wordWrap,\n props.maxWidth,\n props.width,\n ])\n\n /**\n * Update cursor position and visibility\n */\n useLayoutEffect(() => {\n if (!internalRef.current || !showCursor) {\n // Hide cursor if not needed\n if (cursorRef.current) {\n cursorRef.current.setVisible(false)\n if (cursorTweenRef.current) {\n cursorTweenRef.current.stop()\n cursorTweenRef.current = null\n }\n }\n return\n }\n\n const container = internalRef.current\n const scene = container.scene\n\n // Wait for chars to be ready\n if (chars.length === 0 && displayedText.length > 0) return\n\n const startX = padLeft\n const startY = padTop\n\n // Find the character at cursor position to get correct line Y\n const clampedPosition = Math.max(0, Math.min(cursorPosition, displayedText.length))\n\n // Find the character right before the cursor position (charIndex < clampedPosition)\n // The cursor is positioned AFTER this character\n let charBeforeCursor: CharInfo | null = null\n\n for (const char of chars) {\n if (char.charIndex < clampedPosition) {\n if (!charBeforeCursor || char.charIndex > charBeforeCursor.charIndex) {\n charBeforeCursor = char\n }\n }\n }\n\n // Check if cursor is after a newline character in the text\n const charBeforeCursorInText =\n clampedPosition > 0 ? displayedText.charAt(clampedPosition - 1) : null\n const isAfterNewline = charBeforeCursorInText === '\\n'\n\n // Position cursor based on the character before it\n const { cursorX, cursorY } = (() => {\n if (charBeforeCursor) {\n if (isAfterNewline) {\n // Cursor should be at start of next line\n const nextLineIndex = charBeforeCursor.lineIndex + 1\n\n // Find first char of next line\n const firstCharOfNextLine = chars.find((c) => c.lineIndex === nextLineIndex)\n\n if (firstCharOfNextLine) {\n // Next line has content\n return {\n cursorX: startX + firstCharOfNextLine.x,\n cursorY: startY + firstCharOfNextLine.y,\n }\n }\n\n // Empty line after newline - cursor at start of virtual next line\n const lineHeightPx = charBeforeCursor.height * lineHeight\n return {\n cursorX: startX,\n cursorY: startY + charBeforeCursor.y + lineHeightPx,\n }\n }\n\n // Normal character - cursor goes after it\n return {\n cursorX: startX + charBeforeCursor.x + charBeforeCursor.width + charSpacing,\n cursorY: startY + charBeforeCursor.y,\n }\n }\n\n if (chars.length > 0 && chars[0]) {\n // Cursor at position 0 (before first char)\n const firstChar = chars[0]\n return {\n cursorX: startX + firstChar.x,\n cursorY: startY + firstChar.y,\n }\n }\n\n // No chars at all\n return {\n cursorX: startX,\n cursorY: startY,\n }\n })()\n\n // Get cursor height\n let cursorHeight = 20\n if (isAfterNewline) {\n // For newline, use height of next line if it exists\n const nextLineIndex = charBeforeCursor ? charBeforeCursor.lineIndex + 1 : 0\n const firstCharOfNextLine = chars.find((c) => c.lineIndex === nextLineIndex)\n if (firstCharOfNextLine) {\n cursorHeight = firstCharOfNextLine.height\n } else if (charBeforeCursor) {\n // Use height from current line, not doubled\n cursorHeight = charBeforeCursor.height\n } else if (chars.length > 0 && chars[0]) {\n cursorHeight = chars[0].height\n }\n } else if (charBeforeCursor) {\n cursorHeight = charBeforeCursor.height\n } else if (chars.length > 0 && chars[0]) {\n cursorHeight = chars[0].height\n }\n\n // console.log('cursorPosition', cursorPosition, 'cursorX', cursorX, 'cursorY', cursorY)\n\n // Create or update cursor rectangle\n if (!cursorRef.current) {\n cursorRef.current = scene.add.rectangle(\n cursorX,\n cursorY,\n cursorWidth,\n cursorHeight,\n cursorColor\n )\n cursorRef.current.setOrigin(0, 0)\n container.add(cursorRef.current)\n\n // Create blinking tween\n cursorTweenRef.current = scene.tweens.add({\n targets: cursorRef.current,\n alpha: { from: 1, to: 0 },\n duration: cursorBlinkSpeed,\n yoyo: true,\n repeat: -1,\n })\n } else {\n // Update existing cursor\n cursorRef.current.setPosition(cursorX, cursorY)\n cursorRef.current.setSize(cursorWidth, cursorHeight)\n cursorRef.current.setFillStyle(cursorColor)\n cursorRef.current.setVisible(true)\n\n // Restart blink animation\n if (cursorTweenRef.current) {\n cursorTweenRef.current.stop()\n }\n cursorRef.current.setAlpha(1)\n cursorTweenRef.current = scene.tweens.add({\n targets: cursorRef.current,\n alpha: { from: 1, to: 0 },\n duration: cursorBlinkSpeed,\n yoyo: true,\n repeat: -1,\n })\n }\n\n // Cleanup\n return () => {\n if (cursorTweenRef.current) {\n cursorTweenRef.current.stop()\n }\n }\n }, [\n showCursor,\n cursorPosition,\n chars,\n displayedText.length,\n cursorColor,\n cursorWidth,\n cursorBlinkSpeed,\n padLeft,\n padTop,\n charSpacing,\n ])\n\n /**\n * Render selection background\n */\n useLayoutEffect(() => {\n if (!internalRef.current) return\n\n const container = internalRef.current\n const scene = container.scene\n\n // Clear old selection rectangles\n selectionRefs.current.forEach((rect) => rect.destroy())\n selectionRefs.current = []\n\n // Check if we have a valid selection\n if (selectionStart < 0 || selectionEnd < 0 || selectionStart >= selectionEnd) {\n return\n }\n\n // Wait for chars to be ready\n if (chars.length === 0) return\n\n const startX = padLeft\n const startY = padTop\n\n // Group selected characters by line\n const lineGroups = new Map<number, CharInfo[]>()\n\n // Filter chars by their charIndex (text position), not array index\n for (const char of chars) {\n if (char && char.charIndex >= selectionStart && char.charIndex < selectionEnd) {\n const lineIndex = char.lineIndex\n if (!lineGroups.has(lineIndex)) {\n lineGroups.set(lineIndex, [])\n }\n lineGroups.get(lineIndex)?.push(char)\n }\n }\n\n // Create one selection rectangle per line\n for (const [_lineIndex, lineChars] of lineGroups) {\n if (lineChars.length === 0) continue\n\n const firstChar = lineChars[0]\n const lastChar = lineChars[lineChars.length - 1]\n\n if (firstChar && lastChar) {\n const selectionX = startX + firstChar.x\n const selectionY = startY + firstChar.y\n const selectionWidth =\n lastChar.x + lastChar.width - firstChar.x + (lineChars.length > 1 ? charSpacing : 0)\n const selectionHeight = firstChar.height\n\n // Create selection rectangle for this line\n const selectionRect = scene.add.rectangle(\n selectionX,\n selectionY,\n selectionWidth,\n selectionHeight,\n selectionColor,\n selectionAlpha\n )\n selectionRect.setOrigin(0, 0)\n container.add(selectionRect)\n\n // Move selection behind text\n container.moveDown(selectionRect)\n\n selectionRefs.current.push(selectionRect)\n }\n }\n\n // Cleanup\n return () => {\n selectionRefs.current.forEach((rect) => rect.destroy())\n selectionRefs.current = []\n }\n }, [\n selectionStart,\n selectionEnd,\n chars,\n selectionColor,\n selectionAlpha,\n padLeft,\n padTop,\n charSpacing,\n ])\n\n return (\n <View\n ref={internalRef}\n width={width}\n height={height}\n enableGestures={!props.disabled && showCursor}\n onTouch={(data: GestureEventData) => {\n if (!showCursor) return\n const pos = getPositionFromPointer(\n data.pointer.worldX,\n data.pointer.worldY,\n chars,\n cursorPosition\n )\n dragStartPosRef.current = pos\n props.onCursorPositionChange?.(pos)\n props.onSelectionChange?.(-1, -1)\n data.stopPropagation()\n }}\n onTouchMove={(data: GestureEventData) => {\n if (!showCursor) return\n if (data.state === 'start') {\n dragStartPosRef.current = getPositionFromPointer(\n data.pointer.worldX,\n data.pointer.worldY,\n chars,\n cursorPosition\n )\n } else if (data.state === 'move' && dragStartPosRef.current >= 0) {\n const currentPos = getPositionFromPointer(\n data.pointer.worldX,\n data.pointer.worldY,\n chars,\n cursorPosition\n )\n if (currentPos !== dragStartPosRef.current) {\n const start = Math.min(dragStartPosRef.current, currentPos)\n const end = Math.max(dragStartPosRef.current, currentPos)\n props.onSelectionChange?.(start, end)\n }\n } else if (data.state === 'end') {\n dragStartPosRef.current = -1\n }\n data.stopPropagation()\n }}\n {...props}\n {...themed}\n />\n )\n}\n","/** @jsxImportSource ../.. */\nimport type { ViewProps } from '..'\nimport { useEffect, useLayoutEffect, useRedraw, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport { KeyboardInputManager } from '../../utils/KeyboardInputManager'\nimport type { VNodeLike } from '../../vdom'\nimport { CharText, type CharTextAPI } from './CharText'\n\n/**\n * Props for CharTextInput component\n */\nexport interface CharTextInputProps extends Omit<ViewProps, 'children'> {\n /** Input value (controlled) */\n value?: string\n\n /** Placeholder text when empty */\n placeholder?: string\n\n /** Whether input is disabled */\n disabled?: boolean\n\n /** Maximum length of input */\n maxLength?: number\n\n /** Enable multi-line text input */\n multiline?: boolean\n\n /** Text style for characters */\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n\n /** Text style for placeholder characters */\n placeholderStyle?: Phaser.Types.GameObjects.Text.TextStyle\n\n /** Spacing between characters */\n charSpacing?: number\n\n /** Line height multiplier for multi-line */\n lineHeight?: number\n\n /** Maximum number of lines (multi-line only) */\n maxLines?: number\n\n /** How to handle text overflow when maxLines is reached */\n textOverflow?: 'clip' | 'ellipsis'\n\n /** Word wrap behavior (default: true) */\n wordWrap?: boolean\n\n /** Cursor color */\n cursorColor?: number\n\n /** Cursor width in pixels */\n cursorWidth?: number\n\n /** Cursor blink speed in milliseconds */\n cursorBlinkSpeed?: number\n\n /** Selection background color */\n selectionColor?: number\n\n /** Selection background alpha */\n selectionAlpha?: number\n\n /** Border color while focused */\n focusedBorderColor?: number\n\n /** Background color while disabled */\n disabledBackgroundColor?: number\n\n /** Border color while disabled */\n disabledBorderColor?: number\n\n /** Alpha applied while disabled */\n disabledAlpha?: number\n\n /** show html input area */\n debugHtmlInput?: boolean\n\n /** Called when input value changes */\n onChange?: (value: string) => void\n\n /** Called when input receives focus */\n onFocus?: () => void\n\n /** Called when input loses focus */\n onBlur?: () => void\n\n /** Called when Enter key is pressed */\n onSubmit?: (value: string) => void\n}\n\n/**\n * CharTextInput component - text input using CharText for rendering\n * @param props - CharTextInput properties\n * @returns CharTextInput JSX element\n *\n * TODO: For multiline mode with height constraints, consider wrapping CharText\n * in a ScrollView component. This would provide:\n * - Automatic scrolling when content exceeds available height\n * - Better UX for long text input\n * - No need for maxLines clipping\n * - Scroll-to-cursor behavior on input\n */\nexport function CharTextInput(props: CharTextInputProps): VNodeLike {\n const localTheme = useTheme()\n const mergedLocalTheme = props.theme ? mergeThemes(localTheme ?? {}, props.theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('CharTextInput', mergedLocalTheme, {})\n const inputProps = { ...themed, ...props } as CharTextInputProps\n const containerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const inputManagerRef = useRef<KeyboardInputManager | null>(null)\n const charTextApiRef = useRef<CharTextAPI | null>(null)\n\n // Internal state for uncontrolled mode\n const [internalValue, setInternalValue] = useState(inputProps.value ?? '')\n const [cursorPosition, setCursorPosition] = useState(0)\n const [selectionAnchor, setSelectionAnchor] = useState(-1) // -1 = no selection, else anchor position\n const [isFocused, setIsFocused] = useState(false)\n\n // Refs for current values (used in event handlers to avoid stale closures)\n const refCurrentValue = useRef(inputProps.value ?? '')\n const refCursorPosition = useRef(0)\n const refSelectionAnchor = useRef(-1)\n\n // Use controlled value if provided\n const currentValue = inputProps.value !== undefined ? inputProps.value : internalValue\n const isControlled = inputProps.value !== undefined\n\n // Sync refs with state\n refCurrentValue.current = currentValue\n refCursorPosition.current = cursorPosition\n refSelectionAnchor.current = selectionAnchor\n\n // Calculate selection start/end from anchor and cursor\n const selectionStart = selectionAnchor >= 0 ? Math.min(selectionAnchor, cursorPosition) : -1\n const selectionEnd = selectionAnchor >= 0 ? Math.max(selectionAnchor, cursorPosition) : -1\n\n const redraw = useRedraw()\n\n useLayoutEffect(() => {\n // Force multiple redraws to ensure container dimensions are properly calculated\n // First redraw after initial mount to have containerRef set and html input created\n if (!containerRef.current) return\n redraw()\n }, [containerRef.current])\n\n /**\n * Setup keyboard input manager\n */\n useEffect(() => {\n if (!containerRef.current) return\n\n const container = containerRef.current\n\n inputManagerRef.current = new KeyboardInputManager(container, {\n ...(inputProps.maxLength !== undefined && { maxLength: inputProps.maxLength }),\n ...(inputProps.disabled !== undefined && { disabled: inputProps.disabled }),\n debug: inputProps.debugHtmlInput ?? false,\n onInput: (_value, _event) => {\n // Ignored - we handle all input via onKeyDown\n },\n onKeyDown: (event) => {\n // Handle special keys\n if (event.key === 'Enter') {\n if (!inputProps.multiline) {\n event.preventDefault()\n inputProps.onSubmit?.(refCurrentValue.current)\n } else {\n // Insert newline\n event.preventDefault()\n handleCharacterInput('\\n')\n // Force immediate redraw to show cursor on new line\n redraw()\n }\n } else if (event.key === 'Backspace') {\n handleBackspace(event)\n } else if (event.key === 'Delete') {\n handleDelete(event)\n } else if (event.key === 'ArrowLeft') {\n handleArrowLeft(event)\n } else if (event.key === 'ArrowRight') {\n handleArrowRight(event)\n } else if (event.key === 'ArrowUp') {\n handleArrowUp(event)\n } else if (event.key === 'ArrowDown') {\n handleArrowDown(event)\n } else if (event.key === 'Home') {\n handleHome(event)\n } else if (event.key === 'End') {\n handleEnd(event)\n } else if (event.key === 'a' && (event.ctrlKey || event.metaKey)) {\n handleSelectAll(event)\n } else if (isPrintableKey(event)) {\n // Handle printable characters\n event.preventDefault()\n handleCharacterInput(event.key)\n }\n // TODO: Copy/Paste with Ctrl+C/V or Cmd+C/V\n },\n onFocus: () => {\n setIsFocused(true)\n inputManagerRef.current?.setPointerEvents(false)\n setCursorPosition(currentValue.length)\n inputProps.onFocus?.()\n },\n onBlur: () => {\n setIsFocused(false)\n setSelectionAnchor(-1)\n inputManagerRef.current?.setPointerEvents(true)\n inputProps.onBlur?.()\n },\n })\n\n return () => {\n inputManagerRef.current?.destroy()\n inputManagerRef.current = null\n }\n }, [\n containerRef.current,\n inputProps.maxLength,\n inputProps.disabled,\n inputProps.multiline,\n isControlled,\n ])\n\n /**\n * Check if key event represents a printable character\n */\n const isPrintableKey = (event: KeyboardEvent): boolean => {\n // Ignore if modifier keys are pressed (except Shift)\n if (event.ctrlKey || event.metaKey || event.altKey) {\n return false\n }\n\n // Single printable character\n if (event.key.length === 1) {\n return true\n }\n\n return false\n }\n\n /**\n * Handle printable character input\n */\n const handleCharacterInput = (char: string) => {\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n let newValue: string\n let newCursorPos: number\n\n if (anchor >= 0) {\n // Replace selection with new character\n const selStart = Math.min(anchor, cursorPosition)\n const selEnd = Math.max(anchor, cursorPosition)\n newValue = currentValue.slice(0, selStart) + char + currentValue.slice(selEnd)\n newCursorPos = selStart + char.length\n } else {\n // Insert at cursor position\n newValue = currentValue.slice(0, cursorPosition) + char + currentValue.slice(cursorPosition)\n newCursorPos = cursorPosition + char.length\n }\n\n // Enforce maxLength\n if (inputProps.maxLength !== undefined && newValue.length > inputProps.maxLength) {\n return\n }\n\n // Check if newline would exceed maxLines (multiline mode)\n if (inputProps.multiline && char === '\\n' && inputProps.maxLines !== undefined) {\n const lineCount = newValue.split('\\n').length\n if (lineCount > inputProps.maxLines) {\n return\n }\n }\n\n // Check if character fits (single-line only)\n if (!inputProps.multiline && charTextApiRef.current) {\n // For selection replacement, we need to check if the char fits at the selection start\n const insertPosition = anchor >= 0 ? Math.min(anchor, cursorPosition) : cursorPosition\n if (!charTextApiRef.current.canFitChar(char, insertPosition)) {\n return\n }\n }\n\n updateValue(newValue)\n\n // Update cursor position in both state and ref for immediate effect\n setCursorPosition(newCursorPos)\n refCursorPosition.current = newCursorPos\n\n setSelectionAnchor(-1)\n refSelectionAnchor.current = -1\n }\n\n /**\n * Handle backspace key\n */\n const handleBackspace = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (anchor >= 0) {\n // Delete selection\n const selStart = Math.min(anchor, cursorPosition)\n const selEnd = Math.max(anchor, cursorPosition)\n const newValue = currentValue.slice(0, selStart) + currentValue.slice(selEnd)\n updateValue(newValue)\n setCursorPosition(selStart)\n setSelectionAnchor(-1)\n } else if (cursorPosition > 0) {\n // Delete character before cursor\n const newValue =\n currentValue.slice(0, cursorPosition - 1) + currentValue.slice(cursorPosition)\n updateValue(newValue)\n const newPos = cursorPosition - 1\n setCursorPosition(newPos)\n }\n }\n\n /**\n * Handle delete key\n */\n const handleDelete = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (anchor >= 0) {\n // Delete selection\n const selStart = Math.min(anchor, cursorPosition)\n const selEnd = Math.max(anchor, cursorPosition)\n const newValue = currentValue.slice(0, selStart) + currentValue.slice(selEnd)\n updateValue(newValue)\n setCursorPosition(selStart)\n setSelectionAnchor(-1)\n } else if (cursorPosition < currentValue.length) {\n // Delete character after cursor\n const newValue =\n currentValue.slice(0, cursorPosition) + currentValue.slice(cursorPosition + 1)\n updateValue(newValue)\n }\n }\n\n /**\n * Handle arrow left key\n */\n const handleArrowLeft = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (event.shiftKey) {\n // Extend/start selection to the left\n if (anchor < 0) {\n // Start new selection - anchor at current position\n setSelectionAnchor(cursorPosition)\n }\n if (cursorPosition > 0) {\n setCursorPosition(cursorPosition - 1)\n }\n } else {\n // Move cursor (clear selection)\n\n setSelectionAnchor(-1)\n if (cursorPosition > 0) {\n setCursorPosition(cursorPosition - 1)\n }\n }\n }\n\n /**\n * Handle arrow right key\n */\n const handleArrowRight = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (event.shiftKey) {\n // Extend/start selection to the right\n if (anchor < 0) {\n // Start new selection - anchor at current position\n setSelectionAnchor(cursorPosition)\n }\n if (cursorPosition < currentValue.length) {\n setCursorPosition(cursorPosition + 1)\n }\n } else {\n setSelectionAnchor(-1)\n if (cursorPosition < currentValue.length) {\n setCursorPosition(cursorPosition + 1)\n }\n }\n }\n\n /**\n * Handle arrow up key (multiline)\n */\n const handleArrowUp = (event: KeyboardEvent) => {\n event.preventDefault()\n }\n\n /**\n * Handle arrow down key (multiline)\n */\n const handleArrowDown = (event: KeyboardEvent) => {\n event.preventDefault()\n }\n\n /**\n * Handle home key\n */\n const handleHome = (event: KeyboardEvent) => {\n event.preventDefault()\n setSelectionAnchor(-1)\n setCursorPosition(0)\n }\n\n /**\n * Handle end key\n */\n const handleEnd = (event: KeyboardEvent) => {\n event.preventDefault()\n const currentValue = refCurrentValue.current\n setSelectionAnchor(-1)\n setCursorPosition(currentValue.length)\n }\n\n /**\n * Handle select all (Ctrl+A / Cmd+A)\n */\n const handleSelectAll = (event: KeyboardEvent) => {\n event.preventDefault()\n const currentValue = refCurrentValue.current\n setSelectionAnchor(0)\n setCursorPosition(currentValue.length)\n }\n\n /**\n * Update value (controlled or uncontrolled)\n */\n const updateValue = (newValue: string) => {\n if (isControlled) {\n inputProps.onChange?.(newValue)\n } else {\n setInternalValue(newValue)\n inputProps.onChange?.(newValue)\n }\n }\n\n /**\n * Handle cursor position change from CharText click\n */\n const handleCursorPositionChange = (position: number) => {\n setCursorPosition(position)\n setSelectionAnchor(-1)\n\n // Focus DOM input\n // inputManagerRef.current?.focus()\n }\n\n /**\n * Handle selection change from CharText drag\n */\n const handleSelectionChange = (start: number, end: number) => {\n if (start >= 0 && end > start) {\n setSelectionAnchor(start)\n setCursorPosition(end)\n } else {\n setSelectionAnchor(-1)\n }\n\n // Focus DOM input\n // inputManagerRef.current?.focus()\n }\n\n // Build CharText props - extract CharTextInput-specific props and pass rest to CharText\n const {\n value: _value,\n placeholder: _placeholder,\n placeholderStyle,\n focusedBorderColor,\n disabledBackgroundColor,\n disabledBorderColor,\n disabledAlpha,\n onChange: _onChange,\n onFocus: _onFocus,\n onBlur: _onBlur,\n onSubmit: _onSubmit,\n ...viewProps\n } = inputProps\n\n // Determine displayed text: actual value, or placeholder if empty and not focused\n const isPlaceholderVisible = currentValue.length === 0 && !!inputProps.placeholder && !isFocused\n const displayText = currentValue || (isPlaceholderVisible ? (inputProps.placeholder ?? '') : '')\n const textStyle = isPlaceholderVisible\n ? { ...(inputProps.textStyle ?? {}), ...(placeholderStyle ?? {}) }\n : inputProps.textStyle\n const disabled = inputProps.disabled ?? false\n const focusedViewProps = isFocused\n ? {\n borderColor: focusedBorderColor ?? inputProps.borderColor,\n borderWidth: Math.max(2, inputProps.borderWidth ?? 1),\n }\n : {}\n const disabledViewProps = disabled\n ? {\n backgroundColor: disabledBackgroundColor ?? inputProps.backgroundColor,\n borderColor: disabledBorderColor ?? inputProps.borderColor,\n alpha: inputProps.alpha ?? disabledAlpha ?? 0.6,\n }\n : {}\n\n return (\n <CharText\n forwardRef={(r) => (containerRef.current = r)}\n {...viewProps}\n {...focusedViewProps}\n {...disabledViewProps}\n theme={nestedTheme}\n text={displayText}\n {...(textStyle !== undefined && { textStyle })}\n showCursor={isFocused}\n cursorPosition={cursorPosition}\n selectionStart={selectionStart}\n selectionEnd={selectionEnd}\n onCursorPositionChange={handleCursorPositionChange}\n onSelectionChange={handleSelectionChange}\n onApiReady={(api) => (charTextApiRef.current = api)}\n />\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * TransformOriginView - declarative transform component with custom origin point\n *\n * Applies transformations (rotation, scale) around a configurable origin point.\n * Unlike OriginView which returns a ref for imperative manipulation,\n * TransformOriginView applies transforms declaratively via props.\n *\n * Perfect for:\n * - Spring animations with useSpring\n * - Reactive transforms based on state/signals\n * - Declarative rotation/scale around center or custom origin\n *\n * @example\n * const [rotation, setRotation] = useSpring(0, 'gentle')\n * <TransformOriginView width={100} height={100} rotation={rotation.value}>\n * <View backgroundColor={0xff0000} />\n * </TransformOriginView>\n */\nimport type { ViewProps } from '..'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\n\n/**\n * Extended ViewProps with origin support for declarative transforms\n */\nexport interface TransformOriginViewProps extends Omit<ViewProps, 'children'> {\n /**\n * Origin X for rotation and scale (0 = left, 0.5 = center, 1 = right)\n * @default 0.5\n */\n originX?: number\n /**\n * Origin Y for rotation and scale (0 = top, 0.5 = center, 1 = bottom)\n * @default 0.5\n */\n originY?: number\n /**\n * Child elements to render with centered origin\n */\n children?: VNodeLike\n}\n\n/**\n * TransformOriginView component - declarative transforms around custom origin point\n *\n * Uses three nested Views to apply rotation/scale around configurable origin:\n * - Outer View: Defines bounding box, receives layout/position props\n * - Middle View: Positioned at origin point, receives transform/visual props\n * - Inner View: Contains content, offset to align with origin\n *\n * @param props - TransformOriginView props\n * @returns JSX element\n */\nexport function TransformOriginView({\n originX = 0.5,\n originY = 0.5,\n width,\n height,\n x = 0,\n y = 0,\n children,\n // Transform props go to middle View\n rotation,\n scale,\n scaleX,\n scaleY,\n // Visual props go to middle View\n backgroundColor,\n backgroundAlpha,\n cornerRadius,\n borderWidth,\n borderColor,\n borderAlpha,\n // All other ViewProps go to outer View\n ...outerViewProps\n}: TransformOriginViewProps): VNodeLike {\n if (typeof width !== 'number' || typeof height !== 'number') {\n throw new Error('TransformOriginView requires numeric width and height')\n }\n\n const offsetX = width * originX\n const offsetY = height * originY\n\n // Only pass defined transform/visual props to middle View\n const middleViewProps: Partial<ViewProps> = {}\n if (rotation !== undefined) middleViewProps.rotation = rotation\n if (scale !== undefined) middleViewProps.scale = scale\n if (scaleX !== undefined) middleViewProps.scaleX = scaleX\n if (scaleY !== undefined) middleViewProps.scaleY = scaleY\n if (backgroundColor !== undefined) middleViewProps.backgroundColor = backgroundColor\n if (backgroundAlpha !== undefined) middleViewProps.backgroundAlpha = backgroundAlpha\n if (cornerRadius !== undefined) middleViewProps.cornerRadius = cornerRadius\n if (borderWidth !== undefined) middleViewProps.borderWidth = borderWidth\n if (borderColor !== undefined) middleViewProps.borderColor = borderColor\n if (borderAlpha !== undefined) middleViewProps.borderAlpha = borderAlpha\n\n return (\n <View\n x={x}\n y={y}\n width={width}\n height={height}\n padding={0}\n direction=\"stack\"\n {...outerViewProps}\n >\n <View\n x={offsetX}\n y={offsetY}\n width={width}\n height={height}\n padding={0}\n direction=\"stack\"\n {...middleViewProps}\n >\n <View\n x={-offsetX}\n y={-offsetY}\n width={width}\n height={height}\n padding={0}\n direction=\"stack\"\n backgroundAlpha={0}\n >\n {children}\n </View>\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Dropdown/Select component\n * Provides single and multi-select functionality with filtering\n */\nimport type * as Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport { useSpring, type AnimationConfig } from '../../animation'\nimport type { GestureEventData } from '../../core-props'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useForceRedraw, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, Text, View } from '../index'\nimport { CharTextInput } from './CharTextInput'\nimport { Popover, type PopoverPlacement } from './Popover'\nimport { ScrollView } from './ScrollView'\nimport { TransformOriginView } from './TransformOriginView'\n\n/**\n * Option type for Dropdown\n */\nexport interface DropdownOption<T = string> {\n /** Unique value */\n value: T\n /** Display label */\n label: string\n /** Disabled state */\n disabled?: boolean\n /** Custom prefix content (e.g., Icon) */\n prefix?: ChildrenType\n /** Custom suffix content */\n suffix?: ChildrenType\n}\n\n/**\n * Props for Dropdown component\n */\nexport interface DropdownProps<T = string> extends Omit<ViewProps, 'children'>, EffectDefinition {\n /** Available options */\n options: DropdownOption<T>[]\n\n /** @deprecated Dropdown overlays are portal-based; this legacy prop is ignored. */\n stackLayout?: boolean\n\n /** Selected value (controlled) */\n value?: T | T[]\n\n /** Default selected value (uncontrolled) */\n defaultValue?: T | T[]\n\n /** Placeholder text when nothing selected */\n placeholder?: string\n\n /** Multi-select mode */\n multiple?: boolean\n\n /** Enable filter */\n isFilterable?: boolean\n\n /** Filtering placeholder */\n filterInputPlaceholder?: string\n\n /** Disabled state */\n disabled?: boolean\n\n /** Maximum height of dropdown list */\n maxHeight?: number\n\n /** Position of dropdown (default: 'bottom') */\n placement?: 'top' | 'bottom'\n\n /** Custom render function for selected value */\n renderValue?: (selected: DropdownOption<T> | DropdownOption<T>[] | null) => ChildrenType\n\n /** Custom render function for option */\n renderOption?: (option: DropdownOption<T>, isSelected: boolean) => ChildrenType\n\n /** Custom arrow/indicator (default: simple Graphics triangle) */\n arrow?: ChildrenType\n\n /** Callback when selection changes */\n onChange?: (value: T | T[]) => void\n\n /** Callback when dropdown opens */\n onOpen?: () => void\n\n /** Callback when dropdown closes */\n onClose?: () => void\n\n /** Animation config for expand/collapse */\n animationConfig?: AnimationConfig\n\n /** Close on select (default: true for single, false for multi) */\n closeOnSelect?: boolean\n}\n\n/**\n * Default arrow component - chevron indicator.\n */\nfunction DefaultArrow(props: { color?: number; size?: number; strokeWidth?: number }) {\n const color = props.color ?? 0xffffff\n const size = props.size ?? 8\n const strokeWidth = props.strokeWidth ?? Math.max(2, Math.round(size * 0.16))\n\n return (\n <Graphics\n width={size}\n height={size}\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n g.lineStyle(strokeWidth, color, 1)\n g.beginPath()\n g.moveTo(size * 0.18, size * 0.35)\n g.lineTo(size * 0.5, size * 0.68)\n g.lineTo(size * 0.82, size * 0.35)\n g.strokePath()\n }}\n />\n )\n}\n\nfunction DefaultOptionIndicator(props: {\n selected: boolean\n multiple: boolean\n disabled: boolean\n color?: number\n size?: number\n strokeWidth?: number\n}) {\n const size = props.size ?? 16\n const color = props.color ?? 0xffffff\n const strokeWidth = props.strokeWidth ?? 2\n const alpha = props.disabled ? 0.4 : 1\n\n return (\n <Graphics\n width={size}\n height={size}\n dependencies={[props.selected, props.multiple, props.disabled, color, size, strokeWidth]}\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n\n if (props.multiple) {\n g.lineStyle(strokeWidth, color, props.selected ? alpha : alpha * 0.55)\n g.strokeRoundedRect(\n strokeWidth / 2,\n strokeWidth / 2,\n size - strokeWidth,\n size - strokeWidth,\n 3\n )\n\n if (!props.selected) return\n } else if (!props.selected) {\n return\n }\n\n g.lineStyle(strokeWidth + 1, color, alpha)\n g.beginPath()\n g.moveTo(size * 0.22, size * 0.52)\n g.lineTo(size * 0.43, size * 0.72)\n g.lineTo(size * 0.8, size * 0.28)\n g.strokePath()\n }}\n />\n )\n}\n\n/**\n * Dropdown/Select component\n * Themeable dropdown with single/multi-select, Filtering, and custom rendering\n *\n * @example\n * ```tsx\n * // Single select\n * <Dropdown\n * options={[\n * { value: '1', label: 'Option 1' },\n * { value: '2', label: 'Option 2' },\n * ]}\n * value={selected}\n * onChange={setSelected}\n * placeholder=\"Select an option\"\n * />\n *\n * // Multi-select with filtering\n * <Dropdown\n * options={options}\n * multiple={true}\n * isFiltering={true}\n * value={selectedValues}\n * onChange={setSelectedValues}\n * />\n * ```\n */\nexport function Dropdown<T = string>(props: DropdownProps<T>): VNodeLike {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Dropdown', localTheme, {})\n\n // State management\n const [isOpen, setIsOpen] = useState(false)\n const [internalValue, setInternalValue] = useState<T | T[]>(\n props.defaultValue ?? (props.multiple ? [] : ('' as T))\n )\n const [filterQuery, setFilterQuery] = useState('')\n\n // Refs\n const triggerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const scrollViewRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect } = useGameObjectEffect(triggerRef)\n\n // Controlled vs uncontrolled\n const isControlled = props.value !== undefined\n const currentValue = isControlled ? props.value : internalValue\n\n // Merge theme props\n const triggerTheme = themed.trigger ?? {}\n const overlayTheme = themed.overlay ?? {}\n const optionTheme = themed.option ?? {}\n const textStyle = themed.textStyle\n const placeholderStyle = themed.placeholderStyle\n const animationConfig = props.animationConfig ?? themed.animationConfig ?? 'gentle'\n const maxHeight = props.maxHeight ?? overlayTheme.maxHeight ?? 300\n const arrowConfig = themed.arrow ?? {}\n const arrowSize = arrowConfig.size ?? 12\n const indicatorConfig = themed.selectionIndicator ?? {}\n const indicatorSize = indicatorConfig.size ?? 16\n const indicatorColor = indicatorConfig.color ?? arrowConfig.color\n const indicatorStrokeWidth = indicatorConfig.strokeWidth ?? 2\n const placement = props.placement ?? 'bottom'\n const popoverPlacement: PopoverPlacement = placement === 'top' ? 'top-start' : 'bottom-start'\n\n // Get selected options\n const getSelectedOptions = (): DropdownOption<T>[] => {\n if (props.multiple) {\n const values = currentValue as T[]\n return props.options.filter((opt) => values.includes(opt.value))\n } else {\n const option = props.options.find((opt) => opt.value === currentValue)\n return option ? [option] : []\n }\n }\n\n const selectedOptions = getSelectedOptions()\n\n // Arrow rotation animation\n const targetRotation = isOpen ? Math.PI : 0\n const [arrowRotation, setArrowRotation] = useSpring(targetRotation, animationConfig)\n useForceRedraw(20, arrowRotation)\n\n const openDropdown = () => {\n if (props.disabled) return\n if (isOpen) return\n\n setIsOpen(true)\n setArrowRotation(Math.PI)\n setFilterQuery('')\n props.onOpen?.()\n\n const resolved = resolveEffect(props, themed as EffectDefinition)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n }\n\n // Close dropdown (for click outside)\n const handleClose = () => {\n if (!isOpen) return\n\n setIsOpen(false)\n setArrowRotation(0)\n setFilterQuery('')\n props.onClose?.()\n }\n\n const handleOpenChange = (open: boolean) => {\n if (open) {\n openDropdown()\n } else {\n handleClose()\n }\n }\n\n // Select option\n const handleSelect = (value: T, event?: GestureEventData) => {\n // Stop propagation to prevent closing dropdown when clicking options\n event?.stopPropagation()\n\n if (props.multiple) {\n const values = currentValue as T[]\n const newValues = values.includes(value)\n ? values.filter((v) => v !== value)\n : [...values, value]\n\n if (!isControlled) {\n setInternalValue(newValues)\n }\n props.onChange?.(newValues)\n\n const shouldClose = props.closeOnSelect ?? false\n if (shouldClose) {\n handleClose()\n }\n } else {\n if (!isControlled) {\n setInternalValue(value)\n }\n props.onChange?.(value)\n\n const shouldClose = props.closeOnSelect ?? true\n if (shouldClose) {\n handleClose()\n }\n }\n }\n\n // Render selected value\n const renderSelectedValue = () => {\n if (props.renderValue) {\n return props.renderValue(selectedOptions.length > 0 ? selectedOptions : null)\n }\n\n if (selectedOptions.length === 0) {\n return <Text text={props.placeholder ?? 'Select...'} style={placeholderStyle} />\n }\n\n if (props.multiple) {\n const label = `${selectedOptions.length} selected`\n return <Text text={label} style={textStyle} />\n }\n\n return <Text text={selectedOptions[0]?.label ?? ''} style={textStyle} />\n }\n\n // Calculate trigger state styles\n const getTriggerStyle = () => {\n if (props.disabled) {\n return { ...triggerTheme, ...(themed.triggerDisabled ?? {}) }\n }\n if (isOpen) {\n return { ...triggerTheme, ...(themed.triggerOpen ?? {}) }\n }\n return triggerTheme\n }\n\n const triggerStyle = getTriggerStyle()\n\n // Render ALL options, use visible prop to show/hide based on filter\n // No useMemo - re-render on every filter change to ensure proper updates\n const renderedOptions = (() => {\n return props.options.map((option, _index) => {\n const isSelected = props.multiple\n ? (currentValue as T[]).includes(option.value)\n : currentValue === option.value\n const isDisabled = option.disabled ?? false\n\n // Check if option matches current filter\n const matchesFilter = props.isFilterable\n ? option.label.toLowerCase().includes(filterQuery.toLowerCase())\n : true\n\n const optionStyle = {\n ...optionTheme,\n ...(isSelected ? (themed.optionSelected ?? {}) : {}),\n ...(isDisabled ? (themed.optionDisabled ?? {}) : {}),\n }\n\n // Extract nested theme for selected option (for Text component)\n const optionNestedTheme = isSelected ? themed.optionSelected : undefined\n\n return (\n <View\n key={String(option.value)}\n width={'fill'}\n direction=\"row\"\n alignItems=\"center\"\n enableGestures={!isDisabled}\n visible={matchesFilter ? true : 'none'}\n onTouch={(data) => {\n data.stopPropagation()\n if (!isDisabled) handleSelect(option.value, data)\n }}\n theme={optionNestedTheme}\n {...optionStyle}\n >\n {/* Custom render or default */}\n {props.renderOption ? (\n props.renderOption(option, isSelected)\n ) : (\n <>\n <DefaultOptionIndicator\n selected={isSelected}\n multiple={props.multiple === true}\n disabled={isDisabled}\n color={indicatorColor ?? 0xffffff}\n size={indicatorSize}\n strokeWidth={indicatorStrokeWidth}\n />\n {option.prefix}\n <Text text={option.label} />\n {option.suffix}\n </>\n )}\n </View>\n )\n })\n })()\n\n // Render trigger\n const trigger = (\n <View\n ref={triggerRef}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n {...triggerStyle}\n >\n <View flex={1}>{renderSelectedValue()}</View>\n\n {/* Arrow */}\n <TransformOriginView\n width={arrowSize}\n height={arrowSize}\n rotation={arrowRotation.value}\n originX={0.5}\n originY={0.5}\n >\n {props.arrow ? (\n props.arrow\n ) : (\n <DefaultArrow\n color={arrowConfig.color ?? 0xffffff}\n size={arrowSize}\n strokeWidth={arrowConfig.strokeWidth ?? 2}\n />\n )}\n </TransformOriginView>\n </View>\n )\n\n // Render filter input\n const filterInput = props.isFilterable && (\n <CharTextInput\n value={filterQuery}\n onChange={(newValue) => {\n setFilterQuery(newValue)\n }}\n placeholder={props.filterInputPlaceholder ?? 'Filter...'}\n height={themed.filterInput?.height ?? 32}\n margin={placement === 'top' ? { top: 8 } : { bottom: 8 }}\n {...(themed.filterInput ?? {})}\n />\n )\n\n // Render options list\n const optionsList = (\n <View flex={1} width={'fill'}>\n <ScrollView\n ref={scrollViewRef}\n showVerticalSlider=\"auto\"\n height=\"fill\"\n width=\"100%\"\n onTouch={() => {\n // Blur active element (CharTextInput) to allow scrolling\n if (document.activeElement instanceof HTMLElement) {\n document.activeElement.blur()\n }\n }}\n >\n <View\n direction=\"column\"\n gap={themed.optionGap ?? 2}\n width=\"100%\"\n theme={\n textStyle\n ? {\n Text: { style: textStyle },\n }\n : undefined\n }\n >\n {renderedOptions}\n </View>\n </ScrollView>\n </View>\n )\n\n // Render overlay\n const overlay = (\n <View\n direction=\"column\"\n width=\"fill\"\n height={maxHeight}\n overflow=\"hidden\"\n theme={nestedTheme}\n {...overlayTheme}\n >\n {placement === 'top' ? (\n <>\n {optionsList}\n {filterInput}\n </>\n ) : (\n <>\n {filterInput}\n {optionsList}\n </>\n )}\n </View>\n )\n\n const popoverTheme: PartialTheme = {\n ...nestedTheme,\n Popover: {\n backgroundColor: 0x000000,\n backgroundAlpha: 0,\n borderWidth: 0,\n cornerRadius: 0,\n padding: 0,\n gap: 0,\n },\n }\n\n return (\n <View direction=\"column\" width={props.width || 'fill'} height=\"auto\" ref={props.ref}>\n <Popover\n trigger={trigger}\n isOpen={isOpen}\n onOpenChange={handleOpenChange}\n placement={popoverPlacement}\n offset={4}\n matchTriggerWidth\n contentHeight={maxHeight}\n contentProps={{\n height: maxHeight,\n backgroundAlpha: 0,\n borderWidth: 0,\n padding: 0,\n gap: 0,\n cornerRadius: 0,\n }}\n triggerProps={{ width: props.width ?? 'fill' }}\n closeOnOutside\n closeOnEscape\n disabled={props.disabled === true}\n theme={popoverTheme}\n >\n {overlay}\n </Popover>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Image component wrapper - strict type-safe wrapper around primitive image\n * This component is the public API for Image, with controlled prop interface\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\nimport type { VNodeLike } from '../../vdom'\n\n/**\n * Props for Image component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface ImageProps\n extends\n Omit<TransformProps, 'scaleX' | 'scaleY' | 'scale'>,\n PhaserProps,\n Omit<LayoutProps, 'direction' | 'justifyContent' | 'alignItems' | 'gap' | 'flexWrap'>,\n PropsDefaultExtension<Phaser.GameObjects.Image> {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Tint color applied to image (0xRRGGBB) */\n tint?: number | undefined\n\n /**\n * How image should fit within bounds (if width/height set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Origin X (0-1, default based on headless: 0 for layout, 0.5 for headless) */\n originX?: number\n\n /** Origin Y (0-1, default based on headless: 0 for layout, 0.5 for headless) */\n originY?: number\n\n /** Children are not supported for Image component */\n children?: ChildrenType\n}\n\n/**\n * Image component\n * Displays Phaser textures as visual elements\n *\n * @example\n * ```tsx\n * // Basic image with layout size\n * <Image texture=\"avatar\" width={64} height={64} />\n *\n * // Atlas frame\n * <Image texture=\"sprites\" frame=\"player\" width={32} height={32} />\n *\n * // Tinted image\n * <Image texture=\"icon\" width={48} height={48} tint={0xff0000} />\n *\n * // Fit modes\n * <Image texture=\"photo\" width={200} height={200} fit=\"cover\" />\n * <Image texture=\"logo\" width={100} height={100} fit=\"contain\" />\n * ```\n */\nexport function Image(props: ImageProps): VNodeLike {\n const localTheme = useTheme()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('Image', localTheme, props as any)\n\n // Map width/height to displayWidth/displayHeight for Phaser Image\n // LayoutProps uses width/height (can be number, percentage, etc.)\n // Phaser Image uses displayWidth/displayHeight (number only)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const mappedProps: any = { ...themed }\n\n // Extract numeric width/height values for display sizing\n if (typeof props.width === 'number') {\n mappedProps.displayWidth = props.width\n }\n if (typeof props.height === 'number') {\n mappedProps.displayHeight = props.height\n }\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <image {...mappedProps} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * Generic Icon component with pluggable loader system\n * Supports any icon library through a loader function\n */\nimport { useEffect, useState } from '../../hooks'\nimport { useSVGTexture } from '../../hooks-svg'\nimport type { VNodeLike } from '../../vdom'\nimport { Image, type ImageProps } from './Image'\n\n/**\n * Icon loader function type\n * Takes an icon type string and returns a promise resolving to SVG string\n */\nexport interface IconLoaderFn<T extends string = string> {\n (type: T): Promise<string>\n}\n\n/**\n * Props for the generic Icon component\n */\nexport interface IconProps<T extends string = string> extends Omit<\n ImageProps,\n 'texture' | 'displayWidth' | 'displayHeight'\n> {\n /** The icon type/name to load */\n type: T | undefined\n /** Loader function that fetches the icon SVG */\n loader: IconLoaderFn<T>\n /** Icon size in pixels (default: 32) */\n size?: number\n}\n\n/**\n * Generic Icon component\n * Loads and displays an icon using the provided loader function\n *\n * @example\n * ```tsx\n * <Icon\n * type=\"check\"\n * loader={myIconLoader}\n * size={24}\n * />\n * ```\n */\nexport function Icon<T extends string = string>(props: IconProps<T>): VNodeLike {\n const { type, loader, size = 32, ...imageProps } = props\n const [loadedIcon, setLoadedIcon] = useState<{ type: T; svg: string } | null>(null)\n\n useEffect(() => {\n let cancelled = false\n\n if (type == null) {\n setLoadedIcon(null)\n return\n }\n\n setLoadedIcon((current) => (current?.type === type ? current : null))\n\n loader(type)\n .then((svg) => {\n if (!cancelled) {\n setLoadedIcon({ type, svg })\n }\n })\n .catch((err) => {\n if (!cancelled) {\n console.error(`Failed to load icon ${type}:`, err)\n }\n })\n\n return () => {\n cancelled = true\n }\n }, [type, loader])\n\n const currentIcon = loadedIcon?.type === type ? loadedIcon : null\n const svg = currentIcon?.svg ?? null\n\n // Include size in texture key to prevent conflicts with different sizes\n const textureKey = type != null ? `icon-${type}-${size}` : ''\n const ready = svg ? useSVGTexture(textureKey, svg, size, size) : false\n\n return <Image texture={ready ? textureKey : ''} width={size} height={size} {...imageProps} />\n}\n\n/**\n * Factory function to create a typed Icon component with a specific loader\n * This allows creating strongly-typed icon components for specific icon libraries\n *\n * @param loader - The icon loader function\n * @returns A typed Icon component that doesn't require the loader prop\n *\n * @example\n * ```tsx\n * // Define your loader\n * async function myIconLoader(type: MyIconType): Promise<string> {\n * const module = await import(`./icons/${type}.svg`)\n * return module.default\n * }\n *\n * // Create typed component\n * export const MyIcon = createIconComponent<MyIconType>(myIconLoader)\n *\n * // Use without loader prop\n * <MyIcon type=\"check\" size={24} />\n * ```\n */\nexport function createIconComponent<T extends string>(loader: IconLoaderFn<T>) {\n return function TypedIcon(props: Omit<IconProps<T>, 'loader'>) {\n return <Icon {...props} loader={loader} />\n }\n}\n\n/**\n * Hook to preload an icon and check if it's ready\n * Useful for loading icons before they're displayed\n *\n * @param type - The icon type to load\n * @param loader - The icon loader function\n * @returns true when the icon is loaded and ready to use\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const iconReady = useIconPreload('check', myIconLoader)\n *\n * return iconReady ? <Icon type=\"check\" loader={myIconLoader} /> : <Text text=\"Loading...\" />\n * }\n * ```\n */\nexport function useIconPreload<T extends string>(type: T, loader: IconLoaderFn<T>): boolean {\n const [loadedIcon, setLoadedIcon] = useState<{ type: T; svg: string } | null>(null)\n\n useEffect(() => {\n let cancelled = false\n\n setLoadedIcon((current) => (current?.type === type ? current : null))\n\n loader(type)\n .then((svg) => {\n if (!cancelled) {\n setLoadedIcon({ type, svg })\n }\n })\n .catch((err) => {\n if (!cancelled) {\n console.error(`Failed to load icon ${type}:`, err)\n }\n })\n\n return () => {\n cancelled = true\n }\n }, [type, loader])\n\n return loadedIcon?.type === type\n}\n","/** @jsxImportSource ../.. */\n/**\n * Joystick component - Interactive directional input control\n * Provides touch/mouse-based joystick functionality with customizable themes\n */\nimport type { GestureEventData, SizeValue } from '@number10/phaserjsx/core-props'\nimport { RefOriginView } from '.'\nimport { getLayoutSize, useLayoutEffect, useMemo, useRef, useState } from '../../hooks'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, View } from '../index'\n\n/**\n * Theme configuration for Joystick component\n */\nexport interface JoystickTheme {\n /** Visual theme variant */\n theme: 'default' | 'neon' | 'target' | 'glass' | 'military'\n /** Optional tint color (0xRRGGBB) */\n tint?: number\n}\n\n/**\n * Creates theme-specific graphics for joystick base and thumb\n * @param joystickTheme - Theme configuration\n * @param radius - Radius of the joystick\n * @returns Object containing base, thumb graphics and rotation flag\n */\nfunction joystickThemeFactory(\n joystickTheme: JoystickTheme | undefined,\n radius: number\n): { base: VNodeLike; thumb: VNodeLike; rotateThumb: boolean } {\n // Custom Joystick Themes\n /**\n * Creates neon-themed base graphics\n * @param radius - Base radius\n * @param color - Neon color\n * @returns Neon base graphics\n */\n function createNeonBase(radius: number, color: number = 0x00ff00): VNodeLike {\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Outer glow\n g.fillStyle(color, 0.1)\n g.fillCircle(0, 0, radius + 10)\n // Main circle with gradient effect\n g.fillStyle(0x000000, 0.4)\n g.fillCircle(0, 0, radius)\n // Neon ring\n g.lineStyle(3, color, 1)\n g.strokeCircle(0, 0, radius)\n g.lineStyle(1, color, 0.5)\n g.strokeCircle(0, 0, radius - 5)\n // Directional indicators\n for (let i = 0; i < 4; i++) {\n const angle = (i * 90 * Math.PI) / 180\n const x1 = Math.cos(angle) * (radius - 15)\n const y1 = Math.sin(angle) * (radius - 15)\n const x2 = Math.cos(angle) * (radius - 5)\n const y2 = Math.sin(angle) * (radius - 5)\n g.lineStyle(2, color, 0.7)\n g.lineBetween(x1, y1, x2, y2)\n }\n }}\n />\n )\n }\n\n function createNeonThumb(radius: number, color: number = 0x00ff00): VNodeLike {\n const r = radius * 0.4\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Glow effect\n g.fillStyle(color, 0.2)\n g.fillCircle(0, 0, r + 5)\n // Center\n g.fillStyle(color, 0.8)\n g.fillCircle(0, 0, r)\n // Bright outline\n g.lineStyle(2, color, 1)\n g.strokeCircle(0, 0, r)\n // Crosshair\n g.lineStyle(2, 0x000000, 0.8)\n g.moveTo(0, -r * 0.6)\n g.lineTo(0, r * 0.6)\n g.moveTo(-r * 0.6, 0)\n g.lineTo(r * 0.6, 0)\n g.strokePath()\n }}\n />\n )\n }\n\n function createTargetBase(radius: number, tint: number = 0xff0000): VNodeLike {\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Background\n g.fillStyle(0x000000, 0.3)\n g.fillCircle(0, 0, radius)\n // Target rings\n for (let i = 0; i < 3; i++) {\n const r = radius - i * 20\n g.lineStyle(2, tint, 0.6 - i * 0.15)\n g.strokeCircle(0, 0, r)\n }\n // Crosshair lines\n g.lineStyle(1, tint, 0.5)\n g.moveTo(-radius, 0)\n g.lineTo(radius, 0)\n g.moveTo(0, -radius)\n g.lineTo(0, radius)\n g.strokePath()\n // Center dot\n g.fillStyle(tint, 0.8)\n g.fillCircle(0, 0, 5)\n }}\n />\n )\n }\n\n function createTargetThumb(radius: number, tint: number = 0xff0000): VNodeLike {\n const r = radius * 0.35\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Outer circle\n g.fillStyle(tint, 0.7)\n g.fillCircle(0, 0, r)\n // Inner circle\n g.fillStyle(0xffffff, 0.9)\n g.fillCircle(0, 0, r * 0.5)\n // Center dot\n g.fillStyle(tint, 1)\n g.fillCircle(0, 0, r * 0.2)\n // Direction indicator\n g.lineStyle(3, tint, 1)\n g.beginPath()\n g.moveTo(0, -r)\n g.lineTo(r * 0.3, -r * 0.6)\n g.lineTo(-r * 0.3, -r * 0.6)\n g.closePath()\n g.fillPath()\n }}\n />\n )\n }\n\n function createGlassBase(radius: number, tint: number = 0xffffff): VNodeLike {\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Glass effect with gradient - use tint for subtle coloring\n g.fillStyle(tint, 0.15)\n g.fillCircle(0, 0, radius)\n // Glossy highlight\n g.fillStyle(tint, 0.3)\n g.fillCircle(-radius * 0.3, -radius * 0.3, radius * 0.4)\n // Border\n g.lineStyle(2, tint, 0.5)\n g.strokeCircle(0, 0, radius)\n g.lineStyle(1, tint, 0.3)\n g.strokeCircle(0, 0, radius - 3)\n }}\n />\n )\n }\n\n function createGlassThumb(radius: number, tint: number = 0xffffff): VNodeLike {\n const r = radius * 0.4\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Shadow\n g.fillStyle(0x000000, 0.2)\n g.fillCircle(r * 0.1, r * 0.1, r)\n // Main glass sphere - subtle tinting\n g.fillStyle(tint, 0.4)\n g.fillCircle(0, 0, r)\n // Highlight\n g.fillStyle(tint, 0.6)\n g.fillCircle(-r * 0.3, -r * 0.3, r * 0.4)\n // Border\n g.lineStyle(2, tint, 0.7)\n g.strokeCircle(0, 0, r)\n }}\n />\n )\n }\n\n function createMilitaryBase(radius: number, tint: number = 0x00ff00): VNodeLike {\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Dark background\n g.fillStyle(0x1a1a1a, 0.8)\n g.fillCircle(0, 0, radius)\n // Grid lines\n g.lineStyle(1, tint, 0.3)\n const step = 20\n for (let i = -radius; i <= radius; i += step) {\n g.moveTo(-radius, i)\n g.lineTo(radius, i)\n g.moveTo(i, -radius)\n g.lineTo(i, radius)\n }\n g.strokePath()\n // Radar sweep effect\n g.lineStyle(2, tint, 0.6)\n g.strokeCircle(0, 0, radius)\n g.strokeCircle(0, 0, radius * 0.66)\n g.strokeCircle(0, 0, radius * 0.33)\n // Corner markers\n const corners = [\n { x: -radius * 0.7, y: -radius * 0.7 },\n { x: radius * 0.7, y: -radius * 0.7 },\n { x: -radius * 0.7, y: radius * 0.7 },\n { x: radius * 0.7, y: radius * 0.7 },\n ]\n g.lineStyle(3, tint, 0.8)\n corners.forEach(({ x, y }) => {\n g.moveTo(x - 10, y)\n g.lineTo(x + 10, y)\n g.moveTo(x, y - 10)\n g.lineTo(x, y + 10)\n })\n g.strokePath()\n }}\n />\n )\n }\n\n function createMilitaryThumb(radius: number, tint: number = 0x00ff00): VNodeLike {\n const r = radius * 0.3\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n // Base\n g.fillStyle(tint, 0.9)\n g.fillCircle(0, 0, r)\n // Directional arrow\n g.fillStyle(0x000000, 1)\n g.beginPath()\n g.moveTo(0, -r)\n g.lineTo(r * 0.5, r * 0.3)\n g.lineTo(-r * 0.5, r * 0.3)\n g.closePath()\n g.fillPath()\n // Border\n g.lineStyle(2, 0x000000, 0.8)\n g.strokeCircle(0, 0, r)\n }}\n />\n )\n }\n\n function createDefaultBase(radius: number, tint: number = 0x00ff00): VNodeLike {\n const size = { width: radius * 2, height: radius * 2 }\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.fillStyle(0x0, 0.25)\n g.lineStyle(1, tint)\n g.fillCircle(0, 0, size.width / 2)\n g.strokeCircle(0, 0, size.width / 2)\n }}\n />\n )\n }\n function createDefaultThumb(radius: number, tint: number = 0x00ff00): VNodeLike {\n const size = { width: radius * 2, height: radius * 2 }\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n const r = size.width * 0.2\n g.lineStyle(2, 0x000000, 1)\n g.moveTo(0, -r)\n g.lineTo(0, r)\n g.moveTo(-r, 0)\n g.lineTo(r, 0)\n g.strokePath()\n g.lineStyle(2, tint, 0.75)\n g.strokeCircle(0, 0, r * 1.1)\n }}\n />\n )\n }\n\n const theme = joystickTheme != null ? joystickTheme.theme : 'default'\n const tint = (joystickTheme != null ? joystickTheme.tint : 0x00ff00) ?? 0x00ff00\n\n switch (theme) {\n case 'neon':\n return {\n base: createNeonBase(radius, tint),\n thumb: createNeonThumb(radius, tint),\n rotateThumb: false,\n }\n case 'target':\n return {\n base: createTargetBase(radius, tint),\n thumb: createTargetThumb(radius, tint),\n rotateThumb: true,\n }\n case 'glass':\n return {\n base: createGlassBase(radius, tint),\n thumb: createGlassThumb(radius, tint),\n rotateThumb: false,\n }\n case 'military':\n return {\n base: createMilitaryBase(radius, tint),\n thumb: createMilitaryThumb(radius, tint),\n rotateThumb: true,\n }\n case 'default':\n default:\n return {\n base: createDefaultBase(radius, tint),\n thumb: createDefaultThumb(radius, tint),\n rotateThumb: false,\n }\n }\n}\n\n// Joystick component\n/**\n * Props for Joystick component\n */\nexport type JoystickProps = {\n /** Width of the joystick area */\n width: SizeValue\n /** Height of the joystick area */\n height: SizeValue\n /** Default theme, used if base and thumb are not provided */\n joystickTheme?: JoystickTheme\n /** Custom base graphic */\n base?: VNodeLike\n /** Custom thumb graphic */\n thumb?: VNodeLike\n /** Minimum force to trigger movement (0.0 to 1.0) */\n minForce?: number\n /** Enable thumb rotation based on angle */\n rotateThumb?: boolean\n /** Callback when joystick is moved, providing angle and force */\n onMove?: (active: boolean, angle: number, force: number) => void\n /** Callback when joystick is tapped */\n onTap?: () => void\n}\n\n/**\n * Joystick component for touch/mouse input\n * Provides directional input with customizable themes and graphics\n * @param props - Joystick properties\n * @returns Joystick JSX element\n */\nexport function Joystick(props: JoystickProps): VNodeLike {\n const outerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const [center, setCenter] = useState<{ x: number; y: number }>({ x: 0, y: 0 })\n const [size, setSize] = useState<{ width: number; height: number }>({ width: 0, height: 0 })\n const thumbRef = useRef<Phaser.GameObjects.Container | null>(null)\n const forceExceededMinimumRef = useRef(false)\n const activeTweenRef = useRef<Phaser.Tweens.Tween | null>(null)\n const isDraggingRef = useRef(false)\n const currentThumbPosRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 })\n\n // Determine size and center\n useLayoutEffect(() => {\n const size = getLayoutSize(outerRef.current)\n if (size != null) {\n const newCenter = { x: size.width / 2, y: size.height / 2 }\n setCenter(newCenter)\n setSize({ width: size.width, height: size.height })\n // Set initial thumb position only if not dragging\n if (!isDraggingRef.current && !activeTweenRef.current) {\n currentThumbPosRef.current = newCenter\n if (thumbRef.current != null) {\n thumbRef.current.setPosition(newCenter.x, newCenter.y)\n }\n }\n }\n }, [outerRef])\n\n // Extract theme values to prevent unnecessary re-renders\n const themeType = props.joystickTheme?.theme\n const themeTint = props.joystickTheme?.tint\n const sizeKey = `${size.width}x${size.height}`\n\n const elements = useMemo(() => {\n if (props.base != null && props.thumb)\n return {\n base: props.base,\n thumb: props.thumb,\n rotateThumb: props.rotateThumb ?? false,\n }\n if (size.width === 0 || size.height === 0)\n return {\n base: null,\n thumb: null,\n rotateThumb: false,\n }\n const radius = Math.min(size.width, size.height) / 2\n return joystickThemeFactory(props.joystickTheme, radius)\n }, [props.base, props.thumb, props.rotateThumb, themeType, themeTint, sizeKey])\n\n const touchMove = (data: GestureEventData) => {\n data.stopPropagation()\n if (thumbRef.current == null) return\n\n if (data.state === 'start') {\n forceExceededMinimumRef.current = false\n isDraggingRef.current = true\n }\n\n if (data.state === 'end') {\n isDraggingRef.current = false\n // Stop any existing tween\n if (activeTweenRef.current) {\n activeTweenRef.current.stop()\n activeTweenRef.current = null\n }\n\n // Tween back to center with smooth animation\n if (thumbRef.current.scene) {\n activeTweenRef.current = thumbRef.current.scene.tweens.add({\n targets: thumbRef.current,\n x: center.x,\n y: center.y,\n angle: 0,\n duration: 150,\n ease: 'Cubic.easeOut',\n onComplete: () => {\n activeTweenRef.current = null\n currentThumbPosRef.current = { x: center.x, y: center.y }\n },\n })\n }\n\n // Call onMove with active = false\n props.onMove?.(false, 0, 0)\n return\n }\n\n // calculate offset from center\n let offsetX = data.localX - data.width / 2 + center.x\n let offsetY = data.localY - data.height / 2 + center.y\n\n // clamp to radius\n const radius = size.width / 2\n const dx = offsetX - center.x\n const dy = offsetY - center.y\n const dist = Math.sqrt(dx * dx + dy * dy)\n\n // Calculate angle and force\n const angle = Math.atan2(dy, dx) * (180 / Math.PI) // Convert to degrees\n const rawForce = Math.min(dist / radius, 1.0) // Normalize to 0.0 - 1.0\n\n // Apply minForce (dead zone)\n const minForce = props.minForce ?? 0.2\n const force = rawForce < minForce ? 0 : (rawForce - minForce) / (1 - minForce)\n\n // Track if force exceeded minimum during this touch\n if (force > 0) {\n forceExceededMinimumRef.current = true\n }\n\n // Clamp thumb position to radius\n if (dist > radius) {\n const angleRad = Math.atan2(dy, dx)\n offsetX = center.x + Math.cos(angleRad) * radius\n offsetY = center.y + Math.sin(angleRad) * radius\n }\n\n // Stop any active tween when user moves thumb\n if (activeTweenRef.current) {\n activeTweenRef.current.stop()\n activeTweenRef.current = null\n }\n\n thumbRef.current.setPosition(offsetX, offsetY)\n currentThumbPosRef.current = { x: offsetX, y: offsetY }\n\n // Rotate thumb based on angle if enabled\n if (props.rotateThumb || elements.rotateThumb) {\n thumbRef.current.setAngle(angle + 90) // +90 because default points up\n }\n\n // Call onMove with active = true only if force is above threshold\n if (force > 0) {\n props.onMove?.(true, angle, force)\n } else {\n props.onMove?.(true, 0, 0)\n }\n }\n\n const handleTouch = () => {\n // Tap only if force never exceeded minForce\n if (!forceExceededMinimumRef.current) {\n props.onTap?.()\n }\n }\n\n return (\n <View ref={outerRef} width={props.width} height={props.height}>\n <RefOriginView\n width={props.width}\n height={props.height}\n originX={0.5}\n originY={0.5}\n onTouchMove={touchMove}\n onTouch={handleTouch}\n direction=\"stack\"\n >\n <View x={center.x} y={center.y}>\n {elements.base}\n </View>\n <View ref={thumbRef} x={currentThumbPosRef.current.x} y={currentThumbPosRef.current.y}>\n {elements.thumb}\n </View>\n </RefOriginView>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * NineSlice component wrapper - strict type-safe wrapper around primitive nineslice\n * This component is the public API for NineSlice, with controlled prop interface\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\nimport type { VNodeLike } from '../../vdom'\n\n/**\n * Props for NineSlice component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface NineSliceProps\n extends\n Omit<TransformProps, 'scaleX' | 'scaleY' | 'scale'>,\n PhaserProps,\n Omit<LayoutProps, 'direction' | 'justifyContent' | 'alignItems' | 'gap' | 'flexWrap'>,\n PropsDefaultExtension<Phaser.GameObjects.NineSlice> {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Tint color applied to NineSlice (0xRRGGBB) */\n tint?: number | undefined\n\n /**\n * Width of the left slice (in pixels of source texture)\n * Defines the non-stretching left border/corner area\n */\n leftWidth: number\n\n /**\n * Width of the right slice (in pixels of source texture)\n * Defines the non-stretching right border/corner area\n */\n rightWidth: number\n\n /**\n * Height of the top slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n topHeight?: number\n\n /**\n * Height of the bottom slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n bottomHeight?: number\n\n /** Children are not supported for NineSlice component */\n children?: ChildrenType\n}\n\n/**\n * NineSlice component\n * Displays scalable 9-slice textures with preserved corners\n *\n * @example\n * ```tsx\n * // Basic 9-slice panel\n * <NineSlice\n * texture=\"ui\"\n * frame=\"panel\"\n * width={300}\n * height={200}\n * leftWidth={20}\n * rightWidth={20}\n * topHeight={20}\n * bottomHeight={20}\n * />\n *\n * // 3-slice horizontal bar (no vertical slicing)\n * <NineSlice\n * texture=\"ui\"\n * frame=\"bar\"\n * width={400}\n * height={60}\n * leftWidth={15}\n * rightWidth={15}\n * />\n *\n * // Tinted panel\n * <NineSlice\n * texture=\"ui\"\n * frame=\"button\"\n * width={250}\n * height={100}\n * leftWidth={14}\n * rightWidth={14}\n * topHeight={14}\n * bottomHeight={14}\n * tint={0xff6600}\n * />\n * ```\n */\nexport function NineSlice(props: NineSliceProps): VNodeLike {\n const localTheme = useTheme()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('NineSlice', localTheme, props as any)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return <nineslice {...(themed as any)} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * NineSliceButton - Convenience component for creating buttons with NineSlice backgrounds\n *\n * This component simplifies the creation of scalable buttons by automatically handling\n * the stack layout pattern and inner content positioning.\n */\nimport type { ViewProps } from '..'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useLayoutEffect, useRef, useState } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { VNodeLike } from '../../vdom'\nimport { NineSlice } from './NineSlice'\nimport { View } from './View'\n\n/**\n * Props for NineSliceButton component\n *\n * @remarks\n * This component creates a button with a NineSlice background and a content area.\n * The content area is automatically sized to exclude the slice borders.\n *\n * **IMPORTANT - Atlas/Texture Configuration:**\n *\n * The slice dimensions (leftWidth, rightWidth, topHeight, bottomHeight) must match\n * the actual design of your texture asset in the texture atlas. These values define\n * which parts of the source image are the \"corners\" and \"edges\" vs the \"center\".\n *\n * **Things to consider:**\n * - Inspect your texture atlas to determine the correct slice values\n * - The slice values are in pixels of the SOURCE texture, not the scaled button\n * - Sum of leftWidth + rightWidth should be less than the source texture width\n * - Sum of topHeight + bottomHeight should be less than the source texture height\n * - Width and height props define the FINAL size of the button after scaling\n * - The center area will stretch, but corners and edges maintain their size\n *\n * @example\n * ```tsx\n * // For a button texture that is 64x32 in the atlas with 8px corners:\n * <NineSliceButton\n * texture=\"ui\"\n * frame=\"button-green\"\n * width={200} // Final button width\n * height={80} // Final button height\n * leftWidth={8} // Left edge is 8px in source texture\n * rightWidth={8} // Right edge is 8px in source texture\n * topHeight={8} // Top edge is 8px in source texture\n * bottomHeight={8} // Bottom edge is 8px in source texture\n * onClick={() => console.log('clicked')}\n * >\n * <Text text=\"Click Me\" />\n * </NineSliceButton>\n * ```\n *\n * @example\n * ```tsx\n * // Horizontal-only (3-slice) button - omit topHeight/bottomHeight:\n * <NineSliceButton\n * texture=\"ui\"\n * frame=\"progress-bar\"\n * width={300}\n * height={40}\n * leftWidth={10}\n * rightWidth={10}\n * >\n * <Text text=\"Progress: 75%\" />\n * </NineSliceButton>\n * ```\n */\nexport interface NineSliceButtonProps extends ViewProps, EffectDefinition {\n /**\n * Texture key from the loaded texture atlas\n * Must be loaded before use (e.g., in a preload scene)\n */\n texture: string\n\n /**\n * Frame name or index within the texture atlas\n * Optional if the texture is not an atlas\n */\n frame?: string | number\n\n /**\n * Width of the left slice in pixels of the SOURCE texture\n * This defines the non-stretching left border/corner area\n */\n leftWidth: number\n\n /**\n * Width of the right slice in pixels of the SOURCE texture\n * This defines the non-stretching right border/corner area\n */\n rightWidth: number\n\n /**\n * Height of the top slice in pixels of the SOURCE texture\n * This defines the non-stretching top border/corner area\n * Optional - omit for 3-slice (horizontal only) mode\n */\n topHeight?: number\n\n /**\n * Height of the bottom slice in pixels of the SOURCE texture\n * This defines the non-stretching bottom border/corner area\n * Optional - omit for 3-slice (horizontal only) mode\n */\n bottomHeight?: number\n\n /**\n * Click handler for button interaction\n */\n onClick?: () => void\n\n //* Optional disabled state - if true, button will not respond to clicks */\n disabled?: boolean\n}\n\n/**\n * NineSliceButton component - creates a scalable button with NineSlice background\n *\n * This is a convenience wrapper around NineSlice + View that handles:\n * - Stack layout for background and content\n * - Automatic inner content area calculation\n * - Click interaction handling\n * - Proper content alignment\n *\n * @param props - NineSliceButton properties\n * @returns JSX element representing a button with NineSlice background\n *\n * @example\n * ```tsx\n * <NineSliceButton\n * texture=\"ui\"\n * frame=\"button-blue\"\n * width={250}\n * height={100}\n * leftWidth={20}\n * rightWidth={20}\n * topHeight={15}\n * bottomHeight={15}\n * onClick={() => console.log('Button clicked!')}\n * alignItems=\"center\"\n * justifyContent=\"center\"\n * >\n * <Text text=\"Click Me!\" style={{ fontSize: 24 }} />\n * </NineSliceButton>\n * ```\n */\n\nexport function NineSliceButton(props: NineSliceButtonProps): VNodeLike {\n const {\n texture,\n frame,\n leftWidth,\n rightWidth,\n topHeight,\n bottomHeight,\n onClick,\n disabled,\n visible,\n // Inner view layout props - used for content area, get here and not passed to outer View\n children: innerChildren,\n direction: innerDirection,\n gap: innerGap,\n padding: innerPadding,\n borderWidth: innerBorderWidth,\n borderColor: innerBorderColor,\n alignItems: innerAlignItems,\n justifyContent: innerJustifyContent,\n // Rest goes to outer view\n ...viewProps\n } = props\n\n const { props: themed } = getThemedProps('NineSliceButton', undefined, {})\n const ref = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect, stopEffects } = useGameObjectEffect(ref)\n\n // Force redraw after mount to ensure dimensions are calculated\n // and show content after that to avoid visual glitches\n const [show, setShow] = useState(false)\n\n useLayoutEffect(() => {\n // redraw to catch any layout adjustments and slider dimensions\n setShow(true)\n }, [])\n\n const innerWidth = (ref.current?.width ?? 0) - leftWidth - rightWidth\n const innerHeight = (ref.current?.height ?? 0) - (topHeight ?? 0) - (bottomHeight ?? 0)\n\n const handleTouch =\n !disabled && onClick\n ? () => {\n onClick?.()\n\n // Stop any running effects to prevent position drift\n stopEffects()\n\n // Apply effect: props override theme, theme overrides default\n const resolved = resolveEffect(props, themed as EffectDefinition)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n }\n : undefined\n\n return (\n <View\n ref={ref}\n direction=\"stack\"\n backgroundAlpha={0.0}\n enableGestures={!disabled}\n visible={show && (visible ?? true)}\n {...themed}\n {...viewProps}\n {...(handleTouch && { onTouch: handleTouch })}\n >\n <NineSlice\n texture={texture}\n {...(frame !== undefined && { frame })}\n width=\"100%\"\n height=\"100%\"\n leftWidth={leftWidth}\n rightWidth={rightWidth}\n {...(topHeight !== undefined && { topHeight })}\n {...(bottomHeight !== undefined && { bottomHeight })}\n />\n <View\n backgroundAlpha={0.0}\n direction={innerDirection ?? 'column'}\n x={leftWidth}\n y={topHeight ?? 0}\n width={innerWidth}\n height={innerHeight}\n alignItems={innerAlignItems ?? 'center'}\n justifyContent={innerJustifyContent ?? 'center'}\n {...(innerGap !== undefined && { gap: innerGap })}\n {...(innerPadding !== undefined && { padding: innerPadding })}\n {...(innerBorderWidth !== undefined && { borderWidth: innerBorderWidth })}\n {...(innerBorderColor !== undefined && { borderColor: innerBorderColor })}\n >\n {innerChildren}\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\nimport type * as Phaser from 'phaser'\n/**\n * Sidebar component - High-level container with typical sidebar styling\n */\nimport type { ViewProps } from '..'\nimport type { VNode } from '../../hooks'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Divider } from './Divider'\nimport { ScrollView } from './ScrollView'\nimport { Text } from './Text'\nimport { View } from './View'\n\nexport type SidebarVariant = 'solid' | 'muted' | 'ghost' | 'inset'\nexport type SidebarSize = 'sm' | 'md' | 'lg'\n\nexport interface SidebarNavItem {\n key?: string\n label?: string\n icon?: ChildrenType\n badge?: ChildrenType | number\n active?: boolean\n disabled?: boolean\n onSelect?: (key: string | undefined) => void\n content?: ChildrenType\n}\n\nexport interface SidebarSection {\n key?: string\n title?: string | ChildrenType\n items?: SidebarNavItem[]\n footer?: ChildrenType\n content?: ChildrenType\n}\n\n/**\n * Props for Sidebar component - extends ViewProps for full flexibility\n */\nexport interface SidebarProps extends ViewProps {\n /** Visual variant */\n variant?: SidebarVariant\n /** Size preset for padding/gaps */\n size?: SidebarSize\n /** Pinned header content */\n header?: ChildrenType\n /** Pinned footer content */\n footer?: ChildrenType\n /** Structured navigation sections */\n sections?: SidebarSection[]\n /** Enable internal scroll area for long content */\n scrollable?: boolean\n /** Render dividers between sections */\n showDividers?: boolean\n /** Override item spacing */\n itemGap?: number\n /** Override section spacing */\n sectionGap?: number\n}\n\ninterface SidebarTheme extends ViewTheme {\n variant?: SidebarVariant\n size?: SidebarSize\n variants?: Partial<Record<SidebarVariant, ViewTheme>>\n sizes?: Partial<Record<SidebarSize, ViewTheme>>\n dividerColor?: number\n dividerAlpha?: number\n headerStyle?: ViewTheme\n footerStyle?: ViewTheme\n sectionStyle?: ViewTheme & {\n titleStyle?: Phaser.Types.GameObjects.Text.TextStyle\n }\n itemStyle?: ViewTheme & {\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n active?: ViewTheme\n disabledAlpha?: number\n }\n badgeStyle?: ViewTheme & {\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n }\n scrollable?: boolean\n itemGap?: number\n sectionGap?: number\n}\n\n/**\n * Sidebar component - pre-configured container for navigation/options\n * Adds variants, size presets, and optional header/sections/footer slots.\n */\nexport function Sidebar(props: SidebarProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themedProps, nestedTheme } = getThemedProps('Sidebar', localTheme, {})\n const themed = themedProps as SidebarTheme\n\n const resolvedVariant = props.variant ?? themed.variant ?? 'solid'\n const resolvedSize = props.size ?? themed.size ?? 'md'\n\n const variantTheme = themed.variants?.[resolvedVariant] ?? {}\n const sizeTheme = themed.sizes?.[resolvedSize] ?? {}\n\n const {\n variants: _variants,\n sizes: _sizes,\n headerStyle,\n footerStyle,\n sectionStyle,\n itemStyle,\n badgeStyle,\n dividerColor,\n dividerAlpha: _dividerAlpha,\n scrollable: themedScrollable,\n itemGap: themedItemGap,\n sectionGap: themedSectionGap,\n variant: _variant,\n size: _size,\n ...baseTheme\n } = themed\n\n const effectiveGap = props.gap ?? (sizeTheme.gap as number | undefined) ?? themed.gap\n const sectionGap = props.sectionGap ?? themedSectionGap ?? effectiveGap ?? 8\n const itemGap = props.itemGap ?? themedItemGap ?? 8\n const scrollable = props.scrollable ?? themedScrollable ?? false\n const showDividers = props.showDividers ?? false\n const dividerColorValue = dividerColor ?? 0xcccccc\n\n const combinedProps: ViewProps = {\n ...baseTheme,\n ...variantTheme,\n ...sizeTheme,\n ...props,\n direction: props.direction ?? 'column',\n alignItems: props.alignItems ?? 'start',\n gap: effectiveGap,\n }\n\n const { titleStyle, ...sectionContainer } = sectionStyle ?? {}\n const {\n textStyle: itemTextStyle,\n active: activeItemStyle,\n disabledAlpha,\n ...itemContainer\n } = itemStyle ?? {}\n const { textStyle: badgeTextStyle, ...badgeContainer } = badgeStyle ?? {}\n\n const normalizeChildren = (child: ChildrenType | null): VNode[] => {\n if (!child) return []\n const flat = Array.isArray(child) ? (child as unknown[]).flat(Infinity) : [child]\n return flat.filter(\n (node): node is VNode => !!node && typeof node === 'object' && 'type' in node\n )\n }\n\n const renderTitle = (title?: string | ChildrenType) => {\n if (!title) return null\n return typeof title === 'string' ? <Text text={title} style={titleStyle} /> : title\n }\n\n const renderBadge = (badge?: ChildrenType | number) => {\n if (badge === undefined || badge === null) return null\n const badgeContent =\n typeof badge === 'number' ? <Text text={`${badge}`} style={badgeTextStyle} /> : badge\n return (\n <View\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n {...badgeContainer}\n padding={badgeContainer.padding ?? 6}\n >\n {badgeContent}\n </View>\n )\n }\n\n const renderItems = (items?: SidebarNavItem[], sectionKey?: string) => {\n if (!items?.length) return null\n return items.map((item, itemIndex) => {\n const key = item.key ?? `${sectionKey ?? 'section'}-item-${itemIndex}`\n const activeProps = item.active ? (activeItemStyle ?? {}) : {}\n const disabledProps =\n item.disabled && disabledAlpha !== undefined ? { alpha: disabledAlpha } : {}\n\n const content: ChildrenType | null =\n item.content ?? (item.label ? <Text text={item.label} style={itemTextStyle} /> : null)\n const iconNodes = normalizeChildren(item.icon ?? null)\n const contentNodes = normalizeChildren(content)\n const badgeNodes = normalizeChildren(renderBadge(item.badge))\n const handleTouch = item.disabled ? undefined : () => item.onSelect?.(item.key ?? key)\n\n return (\n <View\n key={key}\n direction=\"row\"\n alignItems=\"center\"\n gap={itemContainer.gap ?? itemGap}\n enableGestures={!item.disabled}\n {...(handleTouch && { onTouch: handleTouch })}\n {...itemContainer}\n {...activeProps}\n {...disabledProps}\n >\n {[...iconNodes, ...contentNodes, ...badgeNodes]}\n </View>\n )\n })\n }\n\n const renderSections = () => {\n if (!props.sections?.length) return null\n const lastSectionIndex = props.sections.length - 1\n return props.sections.map((section, index) => {\n const sectionKey = section.key ?? `section-${index}`\n return (\n <View key={sectionKey} direction=\"column\" gap={sectionGap} {...sectionContainer}>\n {renderTitle(section.title)}\n {section.content ?? null}\n {renderItems(section.items, sectionKey)}\n {section.footer ?? null}\n {showDividers && index < lastSectionIndex ? (\n <Divider\n color={dividerColorValue}\n thickness={1}\n length={'100%'}\n orientation=\"horizontal\"\n />\n ) : null}\n </View>\n )\n })\n }\n\n const sectionsContent = renderSections()\n const hasSections = !!props.sections?.length\n const primaryContent = sectionsContent ?? (!hasSections ? props.children : null) ?? null\n const extraContent = hasSections ? (props.children ?? null) : null\n const contentNodes = [...normalizeChildren(primaryContent), ...normalizeChildren(extraContent)]\n\n return (\n <View\n {...combinedProps}\n theme={nestedTheme}\n backgroundColor={themed.backgroundColor}\n backgroundAlpha={themed.backgroundAlpha}\n padding={themed.padding}\n gap={themed.gap}\n >\n {props.header ? <View {...headerStyle}>{props.header}</View> : null}\n\n {scrollable ? (\n <ScrollView\n flex={1}\n width={'fill'}\n height={'fill'}\n showVerticalSlider={'auto'}\n showHorizontalSlider={false}\n sliderSize={'tiny'}\n theme={nestedTheme}\n >\n <View direction=\"column\" gap={effectiveGap} width={'fill'}>\n {contentNodes}\n </View>\n </ScrollView>\n ) : (\n contentNodes\n )}\n\n {props.footer ? <View {...footerStyle}>{props.footer}</View> : null}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Tabs component - horizontal tab list with switchable panels\n */\nimport type { ViewProps } from '..'\nimport type { VNode } from '../../hooks'\nimport { useLayoutEffect, useLayoutRect, useMemo, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { View } from '../index'\nimport { ScrollView, type ScrollViewProps } from './ScrollView'\n\n/**\n * Props for Tab header\n */\nexport interface TabProps extends Omit<ViewProps, 'children'> {\n /** Tab header content */\n children?: ChildrenType\n /** Disabled tab */\n disabled?: boolean\n}\n\n/**\n * Props for Tab panel\n */\nexport interface TabPanelProps extends Omit<ViewProps, 'children'> {\n /** Panel content */\n children?: ChildrenType\n}\n\n/**\n * Props for Tabs container\n */\nexport interface TabsProps extends Omit<ViewProps, 'children'> {\n /** Tab and TabPanel children */\n children?: ChildrenType\n /** Controlled active index */\n activeIndex?: number\n /** Uncontrolled default index */\n defaultIndex?: number\n /** Called when active tab changes */\n onChange?: (index: number) => void\n /** Enable horizontal scrolling for the tab list */\n scrollableTabs?: boolean\n /** ScrollView props applied to the tab list when scrollableTabs is enabled */\n tabListScrollProps?: Omit<ScrollViewProps, 'children'>\n}\n\n/**\n * Tab marker component - used inside Tabs\n */\nexport function Tab(_props: TabProps): VNodeLike {\n return null\n}\n\n/**\n * TabPanel marker component - used inside Tabs\n */\nexport function TabPanel(_props: TabPanelProps): VNodeLike {\n return null\n}\n\nconst normalizeChildren = (children: ChildrenType): VNode[] => {\n if (!children) return []\n const flat = Array.isArray(children) ? (children as unknown[]).flat(Infinity) : [children]\n return flat.filter(\n (child): child is VNode => !!child && typeof child === 'object' && 'type' in child\n )\n}\n\n/**\n * Tabs component\n */\nexport function Tabs(props: TabsProps): VNodeLike {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Tabs', localTheme, {})\n\n const [internalIndex, setInternalIndex] = useState(props.defaultIndex ?? 0)\n const rawIndex = props.activeIndex ?? internalIndex\n\n const { tabs, panels } = useMemo(() => {\n const nodes = normalizeChildren(props.children)\n const collectedTabs: VNode[] = []\n const collectedPanels: VNode[] = []\n\n for (const node of nodes) {\n if (node.type === Tab) collectedTabs.push(node)\n if (node.type === TabPanel) collectedPanels.push(node)\n }\n\n return { tabs: collectedTabs, panels: collectedPanels }\n }, [props.children])\n\n const panelCount = Math.min(tabs.length, panels.length)\n const safeIndex = panelCount > 0 ? Math.min(Math.max(rawIndex, 0), panelCount - 1) : 0\n\n const handleSelect = (index: number) => {\n if (props.activeIndex === undefined) {\n setInternalIndex(index)\n }\n if (index !== safeIndex) {\n props.onChange?.(index)\n }\n }\n\n const tabListStyle = themed.tabListStyle ?? {}\n const tabStyle = themed.tabStyle ?? {}\n const tabActiveStyle = themed.tabActiveStyle ?? {}\n const tabDisabledStyle = themed.tabDisabledStyle ?? {}\n const panelStyle = themed.panelStyle ?? {}\n\n const {\n children: _children,\n activeIndex: _activeIndex,\n defaultIndex: _defaultIndex,\n onChange: _onChange,\n ...viewProps\n } = props\n\n const activePanel = panels[safeIndex]\n const activePanelProps = (activePanel?.props as TabPanelProps | undefined) ?? {}\n const panelChildren = activePanel?.children ?? activePanelProps.children\n const { children: _panelChildren, ...panelViewProps } = activePanelProps\n const scrollableTabs = props.scrollableTabs ?? true\n const tabListScrollProps = props.tabListScrollProps ?? {}\n\n const tabListContent = (\n <View {...tabListStyle} direction=\"row\" width={scrollableTabs ? 'auto' : '100%'}>\n {tabs.slice(0, panelCount).map((tab, index) => {\n const tabProps = (tab.props as TabProps | undefined) ?? {}\n const { disabled, onTouch, enableGestures, ...tabViewProps } = tabProps\n const tabChildren = tab.children ?? tabProps.children\n const isActive = index === safeIndex\n const combinedTabStyle = {\n ...tabStyle,\n ...(isActive ? tabActiveStyle : {}),\n ...(disabled ? tabDisabledStyle : {}),\n ...tabViewProps,\n }\n const tabKey = tab.__key ?? tabProps.key ?? index\n\n return (\n <View\n key={tabKey as string | number}\n {...combinedTabStyle}\n enableGestures={!disabled && (enableGestures ?? true)}\n onTouch={(data) => {\n if (disabled) return\n handleSelect(index)\n onTouch?.(data)\n }}\n >\n {tabChildren}\n </View>\n )\n })}\n </View>\n )\n\n // Measure tab height for scrollable tab list - a little hacky but works\n const [tabHeight, setTabHeight] = useState<number>(0)\n const [sliderHeight, setSliderHeight] = useState<number>(0)\n const ref = useRef<Phaser.GameObjects.Container | null>(null)\n useLayoutEffect(() => {\n const layout = useLayoutRect(ref)\n if (layout) setTabHeight(layout.height)\n }, [props, ref])\n\n return (\n <View {...themed} {...viewProps} direction=\"column\" theme={nestedTheme}>\n {scrollableTabs ? (\n <ScrollView\n width=\"100%\"\n height={tabHeight + sliderHeight}\n showHorizontalSlider=\"auto\"\n showVerticalSlider={false}\n sliderSize=\"nano\"\n theme={nestedTheme}\n onSliderSize={(size) => setSliderHeight(size.height)}\n {...tabListScrollProps}\n >\n <View ref={ref}>{tabListContent}</View>\n </ScrollView>\n ) : (\n tabListContent\n )}\n\n {activePanel ? (\n <View {...panelStyle} {...panelViewProps}>\n {panelChildren}\n </View>\n ) : null}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Toggle/Switch component - Binary on/off control with animated thumb\n * Provides smooth animations and flexible theming\n */\nimport type * as Phaser from 'phaser'\nimport { numberToRgb, rgbToNumber } from '../../colors/color-utils'\nimport { useEffect, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Graphics, Text, View } from '../index'\n\n/**\n * Interpolate between two colors\n * @param color1 - Start color\n * @param color2 - End color\n * @param progress - Interpolation progress (0.0 to 1.0)\n * @returns Interpolated color\n */\nfunction interpolateColor(color1: number, color2: number, progress: number): number {\n const rgb1 = numberToRgb(color1)\n const rgb2 = numberToRgb(color2)\n\n const r = Math.round(rgb1.r + (rgb2.r - rgb1.r) * progress)\n const g = Math.round(rgb1.g + (rgb2.g - rgb1.g) * progress)\n const b = Math.round(rgb1.b + (rgb2.b - rgb1.b) * progress)\n\n return rgbToNumber(r, g, b)\n}\n\n/**\n * Props for Toggle component\n */\nexport interface ToggleProps {\n /** Whether the toggle is checked/on */\n checked?: boolean\n /** Callback when toggle state changes */\n onChange?: (checked: boolean) => void\n /** Optional label text */\n label?: string\n /** Label position relative to toggle */\n labelPosition?: 'left' | 'right' | 'none'\n /** Disabled state */\n disabled?: boolean\n /** Optional prefix content (e.g., Icon) */\n prefix?: ChildrenType\n /** Optional suffix content */\n suffix?: ChildrenType\n /** Theme overrides */\n theme?: PartialTheme\n}\n\n/**\n * Toggle/Switch component\n * Animated on/off switch with customizable appearance\n *\n * @example\n * ```tsx\n * // Basic toggle\n * <Toggle checked={isEnabled} onChange={setIsEnabled} label=\"Enable feature\" />\n *\n * // With custom positioning\n * <Toggle\n * checked={value}\n * onChange={setValue}\n * label=\"Dark Mode\"\n * labelPosition=\"left\"\n * />\n *\n * // With icons\n * <Toggle\n * checked={value}\n * onChange={setValue}\n * prefix={<Icon type=\"sun\" />}\n * suffix={<Icon type=\"moon\" />}\n * />\n * ```\n */\nexport function Toggle(props: ToggleProps): VNodeLike {\n const localTheme = useTheme()\n const mergedLocalTheme = props.theme ? mergeThemes(localTheme ?? {}, props.theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('Toggle', mergedLocalTheme, {})\n\n // Theme values with defaults - use refs for values used in closures\n const width = useRef(themed.width ?? 50)\n const height = useRef(themed.height ?? 28)\n const thumbSize = useRef(themed.thumbSize ?? 24)\n const trackColorOff = useRef(themed.trackColorOff ?? 0x999999)\n const trackColorOn = useRef(themed.trackColorOn ?? 0x4caf50)\n const trackBorderColorOff = useRef(themed.trackBorderColorOff ?? 0x777777)\n const trackBorderColorOn = useRef(themed.trackBorderColorOn ?? themed.trackColorOn ?? 0x4caf50)\n const trackBorderWidth = useRef(themed.trackBorderWidth ?? 1)\n const thumbColor = useRef(themed.thumbColor ?? 0xffffff)\n const thumbBorderColor = useRef(themed.thumbBorderColor ?? 0xd1d5db)\n const thumbBorderWidth = useRef(themed.thumbBorderWidth ?? 1)\n const disabledColor = useRef(themed.disabledColor ?? 0x666666)\n const disabledAlpha = useRef(themed.disabledAlpha ?? 0.5)\n const padding = useRef(themed.padding ?? 2)\n const duration = useRef(themed.duration ?? 200)\n const gap = themed.gap ?? 8\n const labelPosition = props.labelPosition ?? themed.labelPosition ?? 'right'\n\n // Update refs when theme changes\n width.current = themed.width ?? 50\n height.current = themed.height ?? 28\n thumbSize.current = themed.thumbSize ?? 24\n trackColorOff.current = themed.trackColorOff ?? 0x999999\n trackColorOn.current = themed.trackColorOn ?? 0x4caf50\n trackBorderColorOff.current = themed.trackBorderColorOff ?? 0x777777\n trackBorderColorOn.current = themed.trackBorderColorOn ?? themed.trackColorOn ?? 0x4caf50\n trackBorderWidth.current = themed.trackBorderWidth ?? 1\n thumbColor.current = themed.thumbColor ?? 0xffffff\n thumbBorderColor.current = themed.thumbBorderColor ?? 0xd1d5db\n thumbBorderWidth.current = themed.thumbBorderWidth ?? 1\n disabledColor.current = themed.disabledColor ?? 0x666666\n disabledAlpha.current = themed.disabledAlpha ?? 0.5\n padding.current = themed.padding ?? 2\n duration.current = themed.duration ?? 200\n\n // Calculate positions\n const thumbRadius = thumbSize.current / 2\n const trackRadius = height.current / 2\n const thumbOffsetOff = padding.current + thumbRadius\n const thumbOffsetOn = width.current - padding.current - thumbRadius\n\n // State\n const initialChecked = props.checked !== undefined ? props.checked : false\n const [checked, setChecked] = useState<boolean>(initialChecked)\n const [isAnimating, setIsAnimating] = useState(false)\n const [thumbX, setThumbX] = useState<number>(initialChecked ? thumbOffsetOn : thumbOffsetOff)\n\n // Refs\n const trackRef = useRef<Phaser.GameObjects.Graphics | null>(null)\n const thumbRef = useRef<Phaser.GameObjects.Graphics | null>(null)\n const containerRef = useRef<Phaser.GameObjects.Container | null>(null)\n\n const drawTrackShape = (g: Phaser.GameObjects.Graphics, color: number, borderColor: number) => {\n const borderInset = trackBorderWidth.current / 2\n\n g.clear()\n g.fillStyle(color, 1)\n g.fillRoundedRect(0, 0, width.current, height.current, trackRadius)\n\n if (trackBorderWidth.current > 0) {\n g.lineStyle(trackBorderWidth.current, borderColor, 1)\n g.strokeRoundedRect(\n borderInset,\n borderInset,\n width.current - trackBorderWidth.current,\n height.current - trackBorderWidth.current,\n Math.max(0, trackRadius - borderInset)\n )\n }\n }\n\n const getTrackColor = (targetChecked: boolean): number => {\n if (props.disabled && !targetChecked) {\n return disabledColor.current\n }\n\n return targetChecked ? trackColorOn.current : trackColorOff.current\n }\n\n const getTrackBorderColor = (targetChecked: boolean): number => {\n return targetChecked ? trackBorderColorOn.current : trackBorderColorOff.current\n }\n\n // Sync with controlled prop\n useEffect(() => {\n if (props.checked !== undefined && props.checked !== checked) {\n animateToggle(props.checked)\n }\n }, [props.checked, checked])\n\n // Keep the thumb aligned when theme-driven dimensions or padding change.\n useEffect(() => {\n if (!isAnimating) {\n setThumbX(checked ? thumbOffsetOn : thumbOffsetOff)\n }\n }, [checked, thumbOffsetOn, thumbOffsetOff, isAnimating])\n\n /**\n * Animate toggle transition\n */\n const animateToggle = (newChecked: boolean) => {\n const track = trackRef.current\n const container = containerRef.current\n\n if (!track || !container) return\n\n const scene = container.scene\n if (!scene) return\n\n setIsAnimating(true)\n\n const endX = newChecked ? thumbOffsetOn : thumbOffsetOff\n\n // Animate thumb position via state\n const startX = thumbX\n\n scene.tweens.addCounter({\n from: 0,\n to: 1,\n duration: duration.current,\n ease: 'Cubic.easeOut',\n onUpdate: (tween: Phaser.Tweens.Tween) => {\n const progress = tween.getValue() as number\n const currentX = startX + (endX - startX) * progress\n setThumbX(currentX)\n },\n onComplete: () => {\n setThumbX(endX)\n setIsAnimating(false)\n },\n })\n\n // Animate track color\n const startColor = checked ? trackColorOn.current : trackColorOff.current\n const endColor = newChecked ? trackColorOn.current : trackColorOff.current\n\n scene.tweens.add({\n targets: { value: 0 },\n value: 1,\n duration: duration.current,\n ease: 'Cubic.easeOut',\n onUpdate: (tween: Phaser.Tweens.Tween) => {\n const progress = (tween.getValue() as number) ?? 0\n const currentColor = interpolateColor(startColor, endColor, progress)\n\n const currentBorderColor = interpolateColor(\n getTrackBorderColor(checked),\n getTrackBorderColor(newChecked),\n progress\n )\n\n drawTrackShape(\n track,\n props.disabled && !newChecked ? disabledColor.current : currentColor,\n currentBorderColor\n )\n },\n })\n\n setChecked(newChecked)\n }\n\n /**\n * Handle toggle click\n */\n const handleClick = () => {\n if (props.disabled || isAnimating) return\n\n const newChecked = !checked\n animateToggle(newChecked)\n props.onChange?.(newChecked)\n }\n\n /**\n * Draw track graphics\n */\n const drawTrack = (g: Phaser.GameObjects.Graphics) => {\n g.clear()\n drawTrackShape(g, getTrackColor(checked), getTrackBorderColor(checked))\n }\n\n /**\n * Draw thumb graphics\n */\n const drawThumb = (g: Phaser.GameObjects.Graphics) => {\n g.clear()\n g.fillStyle(thumbColor.current, 1)\n g.fillCircle(0, 0, thumbRadius)\n\n if (thumbBorderWidth.current > 0) {\n g.lineStyle(thumbBorderWidth.current, thumbBorderColor.current, 1)\n g.strokeCircle(0, 0, Math.max(0, thumbRadius - thumbBorderWidth.current / 2))\n }\n }\n\n // Build toggle element\n const toggleElement = (\n <View\n direction=\"stack\"\n width={width.current}\n height={height.current}\n enableGestures={!props.disabled}\n onTouch={handleClick}\n alpha={props.disabled ? disabledAlpha.current : 1}\n >\n {/* Track */}\n <Graphics\n ref={trackRef}\n width={width.current}\n height={height.current}\n dependencies={[\n checked,\n width.current,\n height.current,\n trackColorOff.current,\n trackColorOn.current,\n trackBorderColorOff.current,\n trackBorderColorOn.current,\n trackBorderWidth.current,\n disabledColor.current,\n padding.current,\n props.disabled,\n ]}\n onDraw={drawTrack}\n />\n\n {/* Thumb - position controlled by state */}\n <Graphics\n ref={thumbRef}\n width={thumbSize.current}\n height={thumbSize.current}\n x={thumbX}\n y={height.current / 2}\n dependencies={[\n thumbSize.current,\n thumbColor.current,\n thumbBorderColor.current,\n thumbBorderWidth.current,\n ]}\n onDraw={drawThumb}\n />\n </View>\n )\n\n // Build label if provided\n const labelElement =\n props.label && labelPosition !== 'none' ? (\n <Text\n text={props.label}\n style={themed.labelStyle}\n alpha={props.disabled ? disabledAlpha.current : 1}\n />\n ) : null\n\n // Render with label positioning\n if (!props.label || labelPosition === 'none') {\n return (\n <View ref={containerRef} direction=\"row\" alignItems=\"center\" gap={gap} theme={nestedTheme}>\n {props.prefix}\n {toggleElement}\n {props.suffix}\n </View>\n )\n }\n\n return (\n <View ref={containerRef} direction=\"row\" alignItems=\"center\" gap={gap} theme={nestedTheme}>\n {labelPosition === 'left' && labelElement}\n {props.prefix}\n {toggleElement}\n {props.suffix}\n {labelPosition === 'right' && labelElement}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * WheelPicker component — SwiftUI-style scrollable cylinder picker.\n * Items snap to center with no additional overlays — selected styling is text-only.\n */\nimport { useEffect, useMemo, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps, mergeThemes } from '../../theme'\nimport type { PartialTheme, ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport type { VNodeLike } from '../../vdom'\nimport { Text, View, type ViewProps } from '../index'\nimport { ScrollView } from './ScrollView'\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface WheelPickerLabels {\n empty?: string\n}\n\nexport type WheelPickerSize = 'small' | 'medium' | 'large'\n\nexport interface WheelPickerItem {\n value: string\n label: string\n disabled?: boolean\n}\n\nexport interface WheelPickerItemRenderProps {\n item: WheelPickerItem\n selected: boolean\n disabled: boolean\n index: number\n distanceFromCenter: number // 0 = center, 1 = far edge\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n}\n\nexport interface WheelPickerThemeSlot extends ViewTheme {\n size?: WheelPickerSize\n itemHeight?: number\n visibleItems?: number\n itemPadding?: ViewTheme['padding']\n textColor?: string\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n selectedTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n disabledTextStyle?: Phaser.Types.GameObjects.Text.TextStyle\n overlayAlpha?: number\n disabledAlpha?: number\n labels?: WheelPickerLabels\n}\n\nexport interface WheelPickerProps extends Omit<ViewProps, 'children'> {\n /** Available items. */\n items: WheelPickerItem[]\n /** Selected value in controlled mode. */\n value?: string\n /** Initial selected value in uncontrolled mode. */\n defaultValue?: string\n /** Called when the snapped item changes. */\n onChange?: (value: string) => void\n /** Number of items visible at once (odd numbers look best: 3, 5, 7). */\n visibleItems?: number\n /** Size preset controlling item height and text sizing. */\n size?: WheelPickerSize\n /** Loop items infinitely. */\n loop?: boolean\n /** Render custom item content. */\n renderItem?: (props: WheelPickerItemRenderProps) => ChildrenType\n /** Localized labels. */\n labels?: WheelPickerLabels\n /** Disabled state. */\n disabled?: boolean\n /** Theme overrides. */\n theme?: PartialTheme\n}\n\n// ─── Helpers ─────────────────────────────────────────────────────────────────\n\nfunction findWheelPickerItem(\n items: WheelPickerItem[],\n value: string | undefined\n): WheelPickerItem | undefined {\n if (value === undefined) return undefined\n return items.find((i) => i.value === value)\n}\n\nfunction mergeTextStyle(\n ...styles: Array<Phaser.Types.GameObjects.Text.TextStyle | undefined>\n): Phaser.Types.GameObjects.Text.TextStyle | undefined {\n const merged = Object.assign({}, ...styles.filter(Boolean))\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\nfunction getSizeConfig(size: WheelPickerSize): {\n itemHeight: number\n textFontSize: string\n selectedTextFontSize: string\n} {\n switch (size) {\n case 'small':\n return { itemHeight: 30, textFontSize: '13px', selectedTextFontSize: '14px' }\n case 'large':\n return { itemHeight: 52, textFontSize: '20px', selectedTextFontSize: '22px' }\n default:\n return { itemHeight: 40, textFontSize: '16px', selectedTextFontSize: '18px' }\n }\n}\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\n/**\n * WheelPicker — scrollable snap-to-center picker with fade edges.\n */\nexport function WheelPicker(props: WheelPickerProps): VNodeLike {\n const {\n items,\n value,\n defaultValue,\n onChange,\n visibleItems = 5,\n size,\n renderItem,\n labels: labelOverrides,\n disabled = false,\n theme,\n alpha,\n ...viewProps\n } = props\n\n const localTheme = useTheme()\n const mergedLocalTheme = theme ? mergeThemes(localTheme ?? {}, theme) : localTheme\n const { props: themed, nestedTheme } = getThemedProps('WheelPicker', mergedLocalTheme, {})\n const themedControl = themed as unknown as WheelPickerThemeSlot\n\n const resolvedSize = size ?? themedControl.size ?? 'medium'\n const sizeConfig = getSizeConfig(resolvedSize)\n const itemHeight = themedControl.itemHeight ?? sizeConfig.itemHeight\n const containerHeight = visibleItems * itemHeight\n const halfVisible = Math.floor(visibleItems / 2)\n\n // Controlled / uncontrolled\n const isControlled = value !== undefined\n const initialValue = value ?? defaultValue ?? items[0]?.value ?? ''\n const [internalValue, setInternalValue] = useState(initialValue)\n\n useEffect(() => {\n if (isControlled) {\n setInternalValue(value ?? '')\n }\n }, [isControlled, value])\n\n const currentValue = isControlled ? (value ?? '') : internalValue\n\n const labels = { ...(themedControl.labels ?? {}), ...(labelOverrides ?? {}) }\n\n // Text style — from theme, no hardcoded colors\n const textStyle = mergeTextStyle(\n {\n fontSize: sizeConfig.textFontSize,\n ...(themedControl.textColor ? { color: themedControl.textColor } : {}),\n },\n themedControl.textStyle\n )\n const selectedTextStyle = textStyle\n const disabledTextStyle = mergeTextStyle(textStyle, themedControl.disabledTextStyle)\n\n // Calculate snap positions — each item center position in the scroll content\n // We pad top/bottom with empty space so the first/last item can reach center\n const topPad = halfVisible * itemHeight\n const snapPositions = useMemo(\n () => items.map((_, i) => topPad + i * itemHeight),\n [items, topPad, itemHeight]\n )\n\n const initialSnapIndex = useMemo(\n () => items.findIndex((i) => i.value === initialValue),\n [items, initialValue]\n )\n const hasInitialSnapRef = useRef(false)\n const currentSnapIndex = useMemo(\n () => items.findIndex((i) => i.value === currentValue),\n [items, currentValue]\n )\n const lastControlledValueRef = useRef<string | undefined>(isControlled ? currentValue : undefined)\n\n // Programmatic scroll target (tap-to-center). Reset after ScrollView consumes it.\n const [pendingSnapIndex, setPendingSnapIndex] = useState<number | undefined>(undefined)\n const scrollTarget = useMemo(() => {\n if (pendingSnapIndex !== undefined) {\n return { snapIndex: pendingSnapIndex }\n }\n if (!hasInitialSnapRef.current) {\n hasInitialSnapRef.current = true\n return { snapIndex: initialSnapIndex >= 0 ? initialSnapIndex : 0 }\n }\n if (isControlled && currentValue !== lastControlledValueRef.current) {\n lastControlledValueRef.current = currentValue\n return { snapIndex: currentSnapIndex >= 0 ? currentSnapIndex : 0 }\n }\n lastControlledValueRef.current = isControlled ? currentValue : undefined\n return undefined\n }, [pendingSnapIndex, initialSnapIndex, isControlled, currentValue, currentSnapIndex])\n\n const commitValue = (nextValue: string, scrollToIndex?: number) => {\n const item = findWheelPickerItem(items, nextValue)\n if (!item || item.disabled || disabled) return\n\n if (scrollToIndex !== undefined) {\n setPendingSnapIndex(scrollToIndex)\n }\n\n if (!isControlled) {\n setInternalValue(nextValue)\n }\n onChange?.(nextValue)\n }\n\n const handleSnap = (index: number) => {\n // ScrollView has landed on this index — clear any pending programmatic scroll\n setPendingSnapIndex(undefined)\n const item = items[index]\n if (item && !item.disabled && !disabled) {\n if (!isControlled) {\n setInternalValue(item.value)\n }\n onChange?.(item.value)\n }\n }\n\n // Render items\n const renderPickerItem = (item: WheelPickerItem, index: number) => {\n const selected = item.value === currentValue\n const itemDisabled = disabled || !!item.disabled\n const effectiveStyle = itemDisabled\n ? disabledTextStyle\n : selected\n ? selectedTextStyle\n : textStyle\n\n const content = renderItem?.({\n item,\n selected,\n disabled: itemDisabled,\n index,\n distanceFromCenter: 0, // Will be inaccurate in static render; dynamic alpha is done via overlays\n ...(effectiveStyle ? { textStyle: effectiveStyle } : {}),\n })\n\n return (\n <View\n key={item.value}\n width=\"fill\"\n height={itemHeight}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n padding={themedControl.itemPadding}\n enableGestures={!itemDisabled}\n onTouch={() => commitValue(item.value, index)}\n >\n {content ?? (\n <Text text={item.label} {...(effectiveStyle ? { style: effectiveStyle } : {})} />\n )}\n </View>\n )\n }\n\n const finalAlpha = disabled ? (themedControl.disabledAlpha ?? 0.5) : alpha\n const emptyLabel = labels.empty ?? 'No items'\n\n return (\n <View\n width={viewProps.width ?? 'fill'}\n height={containerHeight}\n overflow=\"hidden\"\n cornerRadius={themedControl.cornerRadius ?? 8}\n backgroundColor={themedControl.backgroundColor}\n backgroundAlpha={themedControl.backgroundAlpha}\n borderColor={themedControl.borderColor}\n borderWidth={themedControl.borderWidth}\n direction=\"stack\"\n {...viewProps}\n {...(finalAlpha !== undefined ? { alpha: finalAlpha } : {})}\n theme={nestedTheme}\n >\n {items.length === 0 ? (\n <View width=\"fill\" height=\"fill\" alignItems=\"center\" justifyContent=\"center\">\n <Text text={emptyLabel} style={textStyle} />\n </View>\n ) : (\n <>\n <ScrollView\n width=\"fill\"\n height=\"fill\"\n showVerticalSlider={false}\n showHorizontalSlider={false}\n momentum\n snap={{ positions: snapPositions, threshold: itemHeight }}\n snapAlignment=\"center\"\n {...(scrollTarget ? { scroll: scrollTarget } : {})}\n onSnap={handleSnap}\n theme={nestedTheme}\n >\n <View width=\"fill\" height={topPad} />\n <View direction=\"column\" width=\"fill\" theme={nestedTheme}>\n {items.map(renderPickerItem)}\n </View>\n <View width=\"fill\" height={topPad} />\n </ScrollView>\n\n {/* Stationary overlay mask: blocks top and bottom, center is transparent */}\n <View\n width=\"fill\"\n height={halfVisible * itemHeight}\n backgroundColor={themedControl.backgroundColor ?? 0x000000}\n backgroundAlpha={themedControl.overlayAlpha ?? 0.85}\n y={0}\n />\n <View\n width=\"fill\"\n height={halfVisible * itemHeight}\n backgroundColor={themedControl.backgroundColor ?? 0x000000}\n backgroundAlpha={themedControl.overlayAlpha ?? 0.85}\n y={containerHeight - halfVisible * itemHeight}\n />\n </>\n )}\n </View>\n )\n}\n"],"x_google_ignoreList":[29],"mappings":";;;;;;;;;AAKA,SAAgB,cAAc,OAAuC;CACnE,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,QAAQ;CACd,OAAO,OAAO,MAAM,QAAQ,YAAY,OAAO,MAAM,QAAQ;AAC/D;AAEA,SAAgB,kBAAkB,OAAuD;CACvF,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,QAAQ;CAKd,OACE,MAAM,QAAQ,MAAM,IAAI,KACxB,OAAO,MAAM,QAAQ,cACrB,OAAO,MAAM,WAAW;AAE5B;;;;;;;ACqBA,IAAa,eAAsC,CAAC;;;;;;AAOpD,SAAgB,SAA6B,MAAS,YAAqC;CACzF,aAAa,QAAQ;AACvB;;;;AAKA,IAAa,OAAO;;;;;;;;;CASlB,OAA2B,MAAS,OAAqB,OAAsC;EAC7F,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