@number10/jsx-phaser 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +667 -0
- package/README.md +44 -0
- package/dist/_virtual/_commonjsHelpers.cjs +7 -0
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/index.cjs +7 -0
- package/dist/_virtual/index.cjs.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/animation/index.d.ts +7 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/camera/index.d.ts +5 -0
- package/dist/camera/index.d.ts.map +1 -0
- package/dist/camera/use-camera-fx.cjs +49 -0
- package/dist/camera/use-camera-fx.cjs.map +1 -0
- package/dist/camera/use-camera-fx.d.ts +25 -0
- package/dist/camera/use-camera-fx.d.ts.map +1 -0
- package/dist/camera/use-camera-fx.js +49 -0
- package/dist/camera/use-camera-fx.js.map +1 -0
- package/dist/clip/index.cjs +8 -0
- package/dist/clip/index.cjs.map +1 -0
- package/dist/clip/index.d.ts +3 -0
- package/dist/clip/index.d.ts.map +1 -0
- package/dist/clip/index.js +9 -0
- package/dist/clip/index.js.map +1 -0
- package/dist/clip/stencil-clip-depth.cjs +24 -0
- package/dist/clip/stencil-clip-depth.cjs.map +1 -0
- package/dist/clip/stencil-clip-depth.d.ts +10 -0
- package/dist/clip/stencil-clip-depth.d.ts.map +1 -0
- package/dist/clip/stencil-clip-depth.js +24 -0
- package/dist/clip/stencil-clip-depth.js.map +1 -0
- package/dist/clip/stencil-clip-extension.cjs +113 -0
- package/dist/clip/stencil-clip-extension.cjs.map +1 -0
- package/dist/clip/stencil-clip-extension.d.ts +18 -0
- package/dist/clip/stencil-clip-extension.d.ts.map +1 -0
- package/dist/clip/stencil-clip-extension.js +96 -0
- package/dist/clip/stencil-clip-extension.js.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.cjs +46 -0
- package/dist/clip/stencil-clip-fbo-bridge.cjs.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts +7 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.js +46 -0
- package/dist/clip/stencil-clip-fbo-bridge.js.map +1 -0
- package/dist/clip/stencil-clip-renderer.cjs +300 -0
- package/dist/clip/stencil-clip-renderer.cjs.map +1 -0
- package/dist/clip/stencil-clip-renderer.d.ts +7 -0
- package/dist/clip/stencil-clip-renderer.d.ts.map +1 -0
- package/dist/clip/stencil-clip-renderer.js +300 -0
- package/dist/clip/stencil-clip-renderer.js.map +1 -0
- package/dist/clip/stencil-clip-state.cjs +84 -0
- package/dist/clip/stencil-clip-state.cjs.map +1 -0
- package/dist/clip/stencil-clip-state.d.ts +28 -0
- package/dist/clip/stencil-clip-state.d.ts.map +1 -0
- package/dist/clip/stencil-clip-state.js +84 -0
- package/dist/clip/stencil-clip-state.js.map +1 -0
- package/dist/clip/stencil-clip-types.d.ts +67 -0
- package/dist/clip/stencil-clip-types.d.ts.map +1 -0
- package/dist/clip/stencil-clip.cjs +138 -0
- package/dist/clip/stencil-clip.cjs.map +1 -0
- package/dist/clip/stencil-clip.d.ts +53 -0
- package/dist/clip/stencil-clip.d.ts.map +1 -0
- package/dist/clip/stencil-clip.js +122 -0
- package/dist/clip/stencil-clip.js.map +1 -0
- package/dist/colors/use-color-mode.cjs +28 -0
- package/dist/colors/use-color-mode.cjs.map +1 -0
- package/dist/colors/use-color-mode.d.ts +22 -0
- package/dist/colors/use-color-mode.d.ts.map +1 -0
- package/dist/colors/use-color-mode.js +28 -0
- package/dist/colors/use-color-mode.js.map +1 -0
- package/dist/colors/use-colors.cjs +45 -0
- package/dist/colors/use-colors.cjs.map +1 -0
- package/dist/colors/use-colors.d.ts +36 -0
- package/dist/colors/use-colors.d.ts.map +1 -0
- package/dist/colors/use-colors.js +45 -0
- package/dist/colors/use-colors.js.map +1 -0
- package/dist/components/DebugPanel.cjs +88 -0
- package/dist/components/DebugPanel.cjs.map +1 -0
- package/dist/components/DebugPanel.d.ts +45 -0
- package/dist/components/DebugPanel.d.ts.map +1 -0
- package/dist/components/DebugPanel.js +71 -0
- package/dist/components/DebugPanel.js.map +1 -0
- package/dist/components/appliers/applyBackground.cjs +89 -0
- package/dist/components/appliers/applyBackground.cjs.map +1 -0
- package/dist/components/appliers/applyBackground.d.ts +18 -0
- package/dist/components/appliers/applyBackground.d.ts.map +1 -0
- package/dist/components/appliers/applyBackground.js +89 -0
- package/dist/components/appliers/applyBackground.js.map +1 -0
- package/dist/components/appliers/applyGestures.cjs +85 -0
- package/dist/components/appliers/applyGestures.cjs.map +1 -0
- package/dist/components/appliers/applyGestures.d.ts +12 -0
- package/dist/components/appliers/applyGestures.d.ts.map +1 -0
- package/dist/components/appliers/applyGestures.js +68 -0
- package/dist/components/appliers/applyGestures.js.map +1 -0
- package/dist/components/appliers/applyGraphics.cjs +21 -0
- package/dist/components/appliers/applyGraphics.cjs.map +1 -0
- package/dist/components/appliers/applyGraphics.d.ts +13 -0
- package/dist/components/appliers/applyGraphics.d.ts.map +1 -0
- package/dist/components/appliers/applyGraphics.js +21 -0
- package/dist/components/appliers/applyGraphics.js.map +1 -0
- package/dist/components/appliers/applyGraphicsLayout.cjs +18 -0
- package/dist/components/appliers/applyGraphicsLayout.cjs.map +1 -0
- package/dist/components/appliers/applyGraphicsLayout.d.ts +13 -0
- package/dist/components/appliers/applyGraphicsLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyGraphicsLayout.js +18 -0
- package/dist/components/appliers/applyGraphicsLayout.js.map +1 -0
- package/dist/components/appliers/applyImage.cjs +92 -0
- package/dist/components/appliers/applyImage.cjs.map +1 -0
- package/dist/components/appliers/applyImage.d.ts +47 -0
- package/dist/components/appliers/applyImage.d.ts.map +1 -0
- package/dist/components/appliers/applyImage.js +92 -0
- package/dist/components/appliers/applyImage.js.map +1 -0
- package/dist/components/appliers/applyImageLayout.cjs +18 -0
- package/dist/components/appliers/applyImageLayout.cjs.map +1 -0
- package/dist/components/appliers/applyImageLayout.d.ts +18 -0
- package/dist/components/appliers/applyImageLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyImageLayout.js +18 -0
- package/dist/components/appliers/applyImageLayout.js.map +1 -0
- package/dist/components/appliers/applyLayout.cjs +108 -0
- package/dist/components/appliers/applyLayout.cjs.map +1 -0
- package/dist/components/appliers/applyLayout.d.ts +19 -0
- package/dist/components/appliers/applyLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyLayout.js +91 -0
- package/dist/components/appliers/applyLayout.js.map +1 -0
- package/dist/components/appliers/applyNineSlice.cjs +37 -0
- package/dist/components/appliers/applyNineSlice.cjs.map +1 -0
- package/dist/components/appliers/applyNineSlice.d.ts +14 -0
- package/dist/components/appliers/applyNineSlice.d.ts.map +1 -0
- package/dist/components/appliers/applyNineSlice.js +37 -0
- package/dist/components/appliers/applyNineSlice.js.map +1 -0
- package/dist/components/appliers/applyNineSliceLayout.cjs +18 -0
- package/dist/components/appliers/applyNineSliceLayout.cjs.map +1 -0
- package/dist/components/appliers/applyNineSliceLayout.d.ts +18 -0
- package/dist/components/appliers/applyNineSliceLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyNineSliceLayout.js +18 -0
- package/dist/components/appliers/applyNineSliceLayout.js.map +1 -0
- package/dist/components/appliers/applyParticles.cjs +46 -0
- package/dist/components/appliers/applyParticles.cjs.map +1 -0
- package/dist/components/appliers/applyParticles.d.ts +7 -0
- package/dist/components/appliers/applyParticles.d.ts.map +1 -0
- package/dist/components/appliers/applyParticles.js +46 -0
- package/dist/components/appliers/applyParticles.js.map +1 -0
- package/dist/components/appliers/applyParticlesLayout.cjs +7 -0
- package/dist/components/appliers/applyParticlesLayout.cjs.map +1 -0
- package/dist/components/appliers/applyParticlesLayout.d.ts +11 -0
- package/dist/components/appliers/applyParticlesLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyParticlesLayout.js +7 -0
- package/dist/components/appliers/applyParticlesLayout.js.map +1 -0
- package/dist/components/appliers/applyPhaser.cjs +40 -0
- package/dist/components/appliers/applyPhaser.cjs.map +1 -0
- package/dist/components/appliers/applyPhaser.d.ts +24 -0
- package/dist/components/appliers/applyPhaser.d.ts.map +1 -0
- package/dist/components/appliers/applyPhaser.js +40 -0
- package/dist/components/appliers/applyPhaser.js.map +1 -0
- package/dist/components/appliers/applySprite.cjs +124 -0
- package/dist/components/appliers/applySprite.cjs.map +1 -0
- package/dist/components/appliers/applySprite.d.ts +13 -0
- package/dist/components/appliers/applySprite.d.ts.map +1 -0
- package/dist/components/appliers/applySprite.js +124 -0
- package/dist/components/appliers/applySprite.js.map +1 -0
- package/dist/components/appliers/applySpriteLayout.cjs +7 -0
- package/dist/components/appliers/applySpriteLayout.cjs.map +1 -0
- package/dist/components/appliers/applySpriteLayout.d.ts +17 -0
- package/dist/components/appliers/applySpriteLayout.d.ts.map +1 -0
- package/dist/components/appliers/applySpriteLayout.js +7 -0
- package/dist/components/appliers/applySpriteLayout.js.map +1 -0
- package/dist/components/appliers/applyText.cjs +142 -0
- package/dist/components/appliers/applyText.cjs.map +1 -0
- package/dist/components/appliers/applyText.d.ts +32 -0
- package/dist/components/appliers/applyText.d.ts.map +1 -0
- package/dist/components/appliers/applyText.js +142 -0
- package/dist/components/appliers/applyText.js.map +1 -0
- package/dist/components/appliers/applyTextLayout.cjs +16 -0
- package/dist/components/appliers/applyTextLayout.cjs.map +1 -0
- package/dist/components/appliers/applyTextLayout.d.ts +18 -0
- package/dist/components/appliers/applyTextLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyTextLayout.js +16 -0
- package/dist/components/appliers/applyTextLayout.js.map +1 -0
- package/dist/components/appliers/applyTooltip.cjs +247 -0
- package/dist/components/appliers/applyTooltip.cjs.map +1 -0
- package/dist/components/appliers/applyTooltip.d.ts +16 -0
- package/dist/components/appliers/applyTooltip.d.ts.map +1 -0
- package/dist/components/appliers/applyTooltip.js +247 -0
- package/dist/components/appliers/applyTooltip.js.map +1 -0
- package/dist/components/appliers/applyTransform.cjs +61 -0
- package/dist/components/appliers/applyTransform.cjs.map +1 -0
- package/dist/components/appliers/applyTransform.d.ts +24 -0
- package/dist/components/appliers/applyTransform.d.ts.map +1 -0
- package/dist/components/appliers/applyTransform.js +61 -0
- package/dist/components/appliers/applyTransform.js.map +1 -0
- package/dist/components/backgroundImage.cjs +411 -0
- package/dist/components/backgroundImage.cjs.map +1 -0
- package/dist/components/backgroundImage.d.ts +14 -0
- package/dist/components/backgroundImage.d.ts.map +1 -0
- package/dist/components/backgroundImage.js +411 -0
- package/dist/components/backgroundImage.js.map +1 -0
- package/dist/components/creators/createBackground.cjs +18 -0
- package/dist/components/creators/createBackground.cjs.map +1 -0
- package/dist/components/creators/createBackground.d.ts +20 -0
- package/dist/components/creators/createBackground.d.ts.map +1 -0
- package/dist/components/creators/createBackground.js +18 -0
- package/dist/components/creators/createBackground.js.map +1 -0
- package/dist/components/creators/createGestures.cjs +51 -0
- package/dist/components/creators/createGestures.cjs.map +1 -0
- package/dist/components/creators/createGestures.d.ts +11 -0
- package/dist/components/creators/createGestures.d.ts.map +1 -0
- package/dist/components/creators/createGestures.js +34 -0
- package/dist/components/creators/createGestures.js.map +1 -0
- package/dist/components/creators/createGraphicsLayout.cjs +24 -0
- package/dist/components/creators/createGraphicsLayout.cjs.map +1 -0
- package/dist/components/creators/createGraphicsLayout.d.ts +12 -0
- package/dist/components/creators/createGraphicsLayout.d.ts.map +1 -0
- package/dist/components/creators/createGraphicsLayout.js +24 -0
- package/dist/components/creators/createGraphicsLayout.js.map +1 -0
- package/dist/components/creators/createImageLayout.cjs +16 -0
- package/dist/components/creators/createImageLayout.cjs.map +1 -0
- package/dist/components/creators/createImageLayout.d.ts +17 -0
- package/dist/components/creators/createImageLayout.d.ts.map +1 -0
- package/dist/components/creators/createImageLayout.js +16 -0
- package/dist/components/creators/createImageLayout.js.map +1 -0
- package/dist/components/creators/createLayout.cjs +61 -0
- package/dist/components/creators/createLayout.cjs.map +1 -0
- package/dist/components/creators/createLayout.d.ts +15 -0
- package/dist/components/creators/createLayout.d.ts.map +1 -0
- package/dist/components/creators/createLayout.js +61 -0
- package/dist/components/creators/createLayout.js.map +1 -0
- package/dist/components/creators/createNineSliceLayout.cjs +16 -0
- package/dist/components/creators/createNineSliceLayout.cjs.map +1 -0
- package/dist/components/creators/createNineSliceLayout.d.ts +17 -0
- package/dist/components/creators/createNineSliceLayout.d.ts.map +1 -0
- package/dist/components/creators/createNineSliceLayout.js +16 -0
- package/dist/components/creators/createNineSliceLayout.js.map +1 -0
- package/dist/components/creators/createParticlesLayout.cjs +8 -0
- package/dist/components/creators/createParticlesLayout.cjs.map +1 -0
- package/dist/components/creators/createParticlesLayout.d.ts +14 -0
- package/dist/components/creators/createParticlesLayout.d.ts.map +1 -0
- package/dist/components/creators/createParticlesLayout.js +8 -0
- package/dist/components/creators/createParticlesLayout.js.map +1 -0
- package/dist/components/creators/createPhaser.cjs +36 -0
- package/dist/components/creators/createPhaser.cjs.map +1 -0
- package/dist/components/creators/createPhaser.d.ts +14 -0
- package/dist/components/creators/createPhaser.d.ts.map +1 -0
- package/dist/components/creators/createPhaser.js +36 -0
- package/dist/components/creators/createPhaser.js.map +1 -0
- package/dist/components/creators/createSpriteLayout.cjs +10 -0
- package/dist/components/creators/createSpriteLayout.cjs.map +1 -0
- package/dist/components/creators/createSpriteLayout.d.ts +18 -0
- package/dist/components/creators/createSpriteLayout.d.ts.map +1 -0
- package/dist/components/creators/createSpriteLayout.js +10 -0
- package/dist/components/creators/createSpriteLayout.js.map +1 -0
- package/dist/components/creators/createTextLayout.cjs +16 -0
- package/dist/components/creators/createTextLayout.cjs.map +1 -0
- package/dist/components/creators/createTextLayout.d.ts +17 -0
- package/dist/components/creators/createTextLayout.d.ts.map +1 -0
- package/dist/components/creators/createTextLayout.js +16 -0
- package/dist/components/creators/createTextLayout.js.map +1 -0
- package/dist/components/creators/createTransform.cjs +83 -0
- package/dist/components/creators/createTransform.cjs.map +1 -0
- package/dist/components/creators/createTransform.d.ts +26 -0
- package/dist/components/creators/createTransform.d.ts.map +1 -0
- package/dist/components/creators/createTransform.js +83 -0
- package/dist/components/creators/createTransform.js.map +1 -0
- package/dist/components/custom/Graphics.cjs +13 -0
- package/dist/components/custom/Graphics.cjs.map +1 -0
- package/dist/components/custom/Graphics.d.ts +50 -0
- package/dist/components/custom/Graphics.d.ts.map +1 -0
- package/dist/components/custom/Graphics.js +13 -0
- package/dist/components/custom/Graphics.js.map +1 -0
- package/dist/components/custom/NineSlice.cjs +13 -0
- package/dist/components/custom/NineSlice.cjs.map +1 -0
- package/dist/components/custom/NineSlice.d.ts +87 -0
- package/dist/components/custom/NineSlice.d.ts.map +1 -0
- package/dist/components/custom/NineSlice.js +13 -0
- package/dist/components/custom/NineSlice.js.map +1 -0
- package/dist/components/custom/Particles.cjs +8 -0
- package/dist/components/custom/Particles.cjs.map +1 -0
- package/dist/components/custom/Particles.d.ts +28 -0
- package/dist/components/custom/Particles.d.ts.map +1 -0
- package/dist/components/custom/Particles.js +8 -0
- package/dist/components/custom/Particles.js.map +1 -0
- package/dist/components/custom/RefOriginView.cjs +67 -0
- package/dist/components/custom/RefOriginView.cjs.map +1 -0
- package/dist/components/custom/RefOriginView.d.ts +49 -0
- package/dist/components/custom/RefOriginView.d.ts.map +1 -0
- package/dist/components/custom/RefOriginView.js +67 -0
- package/dist/components/custom/RefOriginView.js.map +1 -0
- package/dist/components/custom/Sprite.cjs +13 -0
- package/dist/components/custom/Sprite.cjs.map +1 -0
- package/dist/components/custom/Sprite.d.ts +79 -0
- package/dist/components/custom/Sprite.d.ts.map +1 -0
- package/dist/components/custom/Sprite.js +13 -0
- package/dist/components/custom/Sprite.js.map +1 -0
- package/dist/components/custom/TileSprite.cjs +13 -0
- package/dist/components/custom/TileSprite.cjs.map +1 -0
- package/dist/components/custom/TileSprite.d.ts +65 -0
- package/dist/components/custom/TileSprite.d.ts.map +1 -0
- package/dist/components/custom/TileSprite.js +13 -0
- package/dist/components/custom/TileSprite.js.map +1 -0
- package/dist/components/custom/index.d.ts +15 -0
- package/dist/components/custom/index.d.ts.map +1 -0
- package/dist/components/index.cjs +33 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/internal/SceneWrapper.cjs +10 -0
- package/dist/components/internal/SceneWrapper.cjs.map +1 -0
- package/dist/components/internal/SceneWrapper.d.ts +20 -0
- package/dist/components/internal/SceneWrapper.d.ts.map +1 -0
- package/dist/components/internal/SceneWrapper.js +10 -0
- package/dist/components/internal/SceneWrapper.js.map +1 -0
- package/dist/components/primitives/graphics.cjs +29 -0
- package/dist/components/primitives/graphics.cjs.map +1 -0
- package/dist/components/primitives/graphics.d.ts +146 -0
- package/dist/components/primitives/graphics.d.ts.map +1 -0
- package/dist/components/primitives/graphics.js +29 -0
- package/dist/components/primitives/graphics.js.map +1 -0
- package/dist/components/primitives/image.cjs +110 -0
- package/dist/components/primitives/image.cjs.map +1 -0
- package/dist/components/primitives/image.d.ts +170 -0
- package/dist/components/primitives/image.d.ts.map +1 -0
- package/dist/components/primitives/image.js +110 -0
- package/dist/components/primitives/image.js.map +1 -0
- package/dist/components/primitives/nineslice.cjs +42 -0
- package/dist/components/primitives/nineslice.cjs.map +1 -0
- package/dist/components/primitives/nineslice.d.ts +271 -0
- package/dist/components/primitives/nineslice.d.ts.map +1 -0
- package/dist/components/primitives/nineslice.js +42 -0
- package/dist/components/primitives/nineslice.js.map +1 -0
- package/dist/components/primitives/particles.cjs +77 -0
- package/dist/components/primitives/particles.cjs.map +1 -0
- package/dist/components/primitives/particles.d.ts +47 -0
- package/dist/components/primitives/particles.d.ts.map +1 -0
- package/dist/components/primitives/particles.js +77 -0
- package/dist/components/primitives/particles.js.map +1 -0
- package/dist/components/primitives/sprite.cjs +100 -0
- package/dist/components/primitives/sprite.cjs.map +1 -0
- package/dist/components/primitives/sprite.d.ts +147 -0
- package/dist/components/primitives/sprite.d.ts.map +1 -0
- package/dist/components/primitives/sprite.js +100 -0
- package/dist/components/primitives/sprite.js.map +1 -0
- package/dist/components/primitives/text.cjs +73 -0
- package/dist/components/primitives/text.cjs.map +1 -0
- package/dist/components/primitives/text.d.ts +155 -0
- package/dist/components/primitives/text.d.ts.map +1 -0
- package/dist/components/primitives/text.js +73 -0
- package/dist/components/primitives/text.js.map +1 -0
- package/dist/components/primitives/tilesprite.cjs +77 -0
- package/dist/components/primitives/tilesprite.cjs.map +1 -0
- package/dist/components/primitives/tilesprite.d.ts +157 -0
- package/dist/components/primitives/tilesprite.d.ts.map +1 -0
- package/dist/components/primitives/tilesprite.js +77 -0
- package/dist/components/primitives/tilesprite.js.map +1 -0
- package/dist/components/primitives/vectorDraw.cjs +73 -0
- package/dist/components/primitives/vectorDraw.cjs.map +1 -0
- package/dist/components/primitives/vectorDraw.d.ts +4 -0
- package/dist/components/primitives/vectorDraw.d.ts.map +1 -0
- package/dist/components/primitives/vectorDraw.js +73 -0
- package/dist/components/primitives/vectorDraw.js.map +1 -0
- package/dist/components/primitives/view.cjs +105 -0
- package/dist/components/primitives/view.cjs.map +1 -0
- package/dist/components/primitives/view.d.ts +23 -0
- package/dist/components/primitives/view.d.ts.map +1 -0
- package/dist/components/primitives/view.js +105 -0
- package/dist/components/primitives/view.js.map +1 -0
- package/dist/core-props.d.ts +105 -0
- package/dist/core-props.d.ts.map +1 -0
- package/dist/core-types.d.ts +71 -0
- package/dist/core-types.d.ts.map +1 -0
- package/dist/design-tokens/resolve-theme-tokens.cjs +27 -0
- package/dist/design-tokens/resolve-theme-tokens.cjs.map +1 -0
- package/dist/design-tokens/resolve-theme-tokens.d.ts +9 -0
- package/dist/design-tokens/resolve-theme-tokens.d.ts.map +1 -0
- package/dist/design-tokens/resolve-theme-tokens.js +27 -0
- package/dist/design-tokens/resolve-theme-tokens.js.map +1 -0
- package/dist/design-tokens/use-theme-tokens.cjs +26 -0
- package/dist/design-tokens/use-theme-tokens.cjs.map +1 -0
- package/dist/design-tokens/use-theme-tokens.d.ts +28 -0
- package/dist/design-tokens/use-theme-tokens.d.ts.map +1 -0
- package/dist/design-tokens/use-theme-tokens.js +26 -0
- package/dist/design-tokens/use-theme-tokens.js.map +1 -0
- package/dist/effects/index.d.ts +2 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/phaser-effects-bridge.cjs +48 -0
- package/dist/effects/phaser-effects-bridge.cjs.map +1 -0
- package/dist/effects/phaser-effects-bridge.d.ts +2 -0
- package/dist/effects/phaser-effects-bridge.d.ts.map +1 -0
- package/dist/effects/phaser-effects-bridge.js +30 -0
- package/dist/effects/phaser-effects-bridge.js.map +1 -0
- package/dist/effects/use-effect.cjs +155 -0
- package/dist/effects/use-effect.cjs.map +1 -0
- package/dist/effects/use-effect.d.ts +30 -0
- package/dist/effects/use-effect.d.ts.map +1 -0
- package/dist/effects/use-effect.js +155 -0
- package/dist/effects/use-effect.js.map +1 -0
- package/dist/fx/convenience-hooks/index.d.ts +7 -0
- package/dist/fx/convenience-hooks/index.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-blur.cjs +18 -0
- package/dist/fx/convenience-hooks/use-blur.cjs.map +1 -0
- package/dist/fx/convenience-hooks/use-blur.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-blur.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-blur.js +18 -0
- package/dist/fx/convenience-hooks/use-blur.js.map +1 -0
- package/dist/fx/convenience-hooks/use-glow.cjs +18 -0
- package/dist/fx/convenience-hooks/use-glow.cjs.map +1 -0
- package/dist/fx/convenience-hooks/use-glow.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-glow.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-glow.js +18 -0
- package/dist/fx/convenience-hooks/use-glow.js.map +1 -0
- package/dist/fx/convenience-hooks/use-shadow.cjs +18 -0
- package/dist/fx/convenience-hooks/use-shadow.cjs.map +1 -0
- package/dist/fx/convenience-hooks/use-shadow.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-shadow.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-shadow.js +18 -0
- package/dist/fx/convenience-hooks/use-shadow.js.map +1 -0
- package/dist/fx/fx-creators/blur.cjs +20 -0
- package/dist/fx/fx-creators/blur.cjs.map +1 -0
- package/dist/fx/fx-creators/blur.d.ts +37 -0
- package/dist/fx/fx-creators/blur.d.ts.map +1 -0
- package/dist/fx/fx-creators/blur.js +20 -0
- package/dist/fx/fx-creators/blur.js.map +1 -0
- package/dist/fx/fx-creators/color-matrix.cjs +47 -0
- package/dist/fx/fx-creators/color-matrix.cjs.map +1 -0
- package/dist/fx/fx-creators/color-matrix.d.ts +31 -0
- package/dist/fx/fx-creators/color-matrix.d.ts.map +1 -0
- package/dist/fx/fx-creators/color-matrix.js +47 -0
- package/dist/fx/fx-creators/color-matrix.js.map +1 -0
- package/dist/fx/fx-creators/glow.cjs +27 -0
- package/dist/fx/fx-creators/glow.cjs.map +1 -0
- package/dist/fx/fx-creators/glow.d.ts +36 -0
- package/dist/fx/fx-creators/glow.d.ts.map +1 -0
- package/dist/fx/fx-creators/glow.js +27 -0
- package/dist/fx/fx-creators/glow.js.map +1 -0
- package/dist/fx/fx-creators/index.d.ts +10 -0
- package/dist/fx/fx-creators/index.d.ts.map +1 -0
- package/dist/fx/fx-creators/pixelate.cjs +20 -0
- package/dist/fx/fx-creators/pixelate.cjs.map +1 -0
- package/dist/fx/fx-creators/pixelate.d.ts +24 -0
- package/dist/fx/fx-creators/pixelate.d.ts.map +1 -0
- package/dist/fx/fx-creators/pixelate.js +20 -0
- package/dist/fx/fx-creators/pixelate.js.map +1 -0
- package/dist/fx/fx-creators/shadow.cjs +28 -0
- package/dist/fx/fx-creators/shadow.cjs.map +1 -0
- package/dist/fx/fx-creators/shadow.d.ts +43 -0
- package/dist/fx/fx-creators/shadow.d.ts.map +1 -0
- package/dist/fx/fx-creators/shadow.js +28 -0
- package/dist/fx/fx-creators/shadow.js.map +1 -0
- package/dist/fx/fx-creators/vignette.cjs +20 -0
- package/dist/fx/fx-creators/vignette.cjs.map +1 -0
- package/dist/fx/fx-creators/vignette.d.ts +33 -0
- package/dist/fx/fx-creators/vignette.d.ts.map +1 -0
- package/dist/fx/fx-creators/vignette.js +20 -0
- package/dist/fx/fx-creators/vignette.js.map +1 -0
- package/dist/fx/fx-registry.cjs +43 -0
- package/dist/fx/fx-registry.cjs.map +1 -0
- package/dist/fx/fx-registry.d.ts +59 -0
- package/dist/fx/fx-registry.d.ts.map +1 -0
- package/dist/fx/fx-registry.js +43 -0
- package/dist/fx/fx-registry.js.map +1 -0
- package/dist/fx/index.d.ts +51 -0
- package/dist/fx/index.d.ts.map +1 -0
- package/dist/fx/use-fx.cjs +54 -0
- package/dist/fx/use-fx.cjs.map +1 -0
- package/dist/fx/use-fx.d.ts +53 -0
- package/dist/fx/use-fx.d.ts.map +1 -0
- package/dist/fx/use-fx.js +54 -0
- package/dist/fx/use-fx.js.map +1 -0
- package/dist/gestures/gesture-manager.cjs +773 -0
- package/dist/gestures/gesture-manager.cjs.map +1 -0
- package/dist/gestures/gesture-manager.d.ts +158 -0
- package/dist/gestures/gesture-manager.d.ts.map +1 -0
- package/dist/gestures/gesture-manager.js +773 -0
- package/dist/gestures/gesture-manager.js.map +1 -0
- package/dist/gestures/gesture-types.cjs +9 -0
- package/dist/gestures/gesture-types.cjs.map +1 -0
- package/dist/gestures/gesture-types.d.ts +232 -0
- package/dist/gestures/gesture-types.d.ts.map +1 -0
- package/dist/gestures/gesture-types.js +9 -0
- package/dist/gestures/gesture-types.js.map +1 -0
- package/dist/hooks.cjs +193 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.ts +151 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +146 -0
- package/dist/hooks.js.map +1 -0
- package/dist/host.cjs +85 -0
- package/dist/host.cjs.map +1 -0
- package/dist/host.d.ts +78 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +85 -0
- package/dist/host.js.map +1 -0
- package/dist/index.cjs +614 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +273 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.cjs +20 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +8 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +8 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.cjs +16 -0
- package/dist/jsx-runtime.cjs.map +1 -0
- package/dist/jsx-runtime.d.ts +9 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +7 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/jsx-types.d.ts +40 -0
- package/dist/jsx-types.d.ts.map +1 -0
- package/dist/layout/appliers/background-applier.cjs +40 -0
- package/dist/layout/appliers/background-applier.cjs.map +1 -0
- package/dist/layout/appliers/background-applier.d.ts +16 -0
- package/dist/layout/appliers/background-applier.d.ts.map +1 -0
- package/dist/layout/appliers/background-applier.js +40 -0
- package/dist/layout/appliers/background-applier.js.map +1 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/layout-engine-test-utils.d.ts +24 -0
- package/dist/layout/layout-engine-test-utils.d.ts.map +1 -0
- package/dist/layout/phaser-layout-bridge.cjs +41 -0
- package/dist/layout/phaser-layout-bridge.cjs.map +1 -0
- package/dist/layout/phaser-layout-bridge.d.ts +9 -0
- package/dist/layout/phaser-layout-bridge.d.ts.map +1 -0
- package/dist/layout/phaser-layout-bridge.js +40 -0
- package/dist/layout/phaser-layout-bridge.js.map +1 -0
- package/dist/layout/types.d.ts +14 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs +39 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +39 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/particles/emit-zone.cjs +205 -0
- package/dist/particles/emit-zone.cjs.map +1 -0
- package/dist/particles/emit-zone.d.ts +88 -0
- package/dist/particles/emit-zone.d.ts.map +1 -0
- package/dist/particles/emit-zone.js +205 -0
- package/dist/particles/emit-zone.js.map +1 -0
- package/dist/particles/index.d.ts +8 -0
- package/dist/particles/index.d.ts.map +1 -0
- package/dist/particles/particle-types.d.ts +25 -0
- package/dist/particles/particle-types.d.ts.map +1 -0
- package/dist/particles/preset-registry.cjs +57 -0
- package/dist/particles/preset-registry.cjs.map +1 -0
- package/dist/particles/preset-registry.d.ts +49 -0
- package/dist/particles/preset-registry.d.ts.map +1 -0
- package/dist/particles/preset-registry.js +57 -0
- package/dist/particles/preset-registry.js.map +1 -0
- package/dist/particles/use-particles.cjs +67 -0
- package/dist/particles/use-particles.cjs.map +1 -0
- package/dist/particles/use-particles.d.ts +19 -0
- package/dist/particles/use-particles.d.ts.map +1 -0
- package/dist/particles/use-particles.js +67 -0
- package/dist/particles/use-particles.js.map +1 -0
- package/dist/particles/utils.cjs +82 -0
- package/dist/particles/utils.cjs.map +1 -0
- package/dist/particles/utils.d.ts +10 -0
- package/dist/particles/utils.d.ts.map +1 -0
- package/dist/particles/utils.js +82 -0
- package/dist/particles/utils.js.map +1 -0
- package/dist/phaser-bridges.cjs +148 -0
- package/dist/phaser-bridges.cjs.map +1 -0
- package/dist/phaser-bridges.d.ts +78 -0
- package/dist/phaser-bridges.d.ts.map +1 -0
- package/dist/phaser-bridges.js +131 -0
- package/dist/phaser-bridges.js.map +1 -0
- package/dist/phaser-host-adapter.cjs +148 -0
- package/dist/phaser-host-adapter.cjs.map +1 -0
- package/dist/phaser-host-adapter.d.ts +30 -0
- package/dist/phaser-host-adapter.d.ts.map +1 -0
- package/dist/phaser-host-adapter.js +148 -0
- package/dist/phaser-host-adapter.js.map +1 -0
- package/dist/phaser-runtime-types.d.ts +89 -0
- package/dist/phaser-runtime-types.d.ts.map +1 -0
- package/dist/phaser-surface-adapter.cjs +488 -0
- package/dist/phaser-surface-adapter.cjs.map +1 -0
- package/dist/phaser-surface-adapter.d.ts +74 -0
- package/dist/phaser-surface-adapter.d.ts.map +1 -0
- package/dist/phaser-surface-adapter.js +471 -0
- package/dist/phaser-surface-adapter.js.map +1 -0
- package/dist/phaser-vdom-runtime.cjs +63 -0
- package/dist/phaser-vdom-runtime.cjs.map +1 -0
- package/dist/phaser-vdom-runtime.d.ts +2 -0
- package/dist/phaser-vdom-runtime.d.ts.map +1 -0
- package/dist/phaser-vdom-runtime.js +63 -0
- package/dist/phaser-vdom-runtime.js.map +1 -0
- package/dist/plugin.cjs +182 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.ts +161 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +165 -0
- package/dist/plugin.js.map +1 -0
- package/dist/render-context.cjs +106 -0
- package/dist/render-context.cjs.map +1 -0
- package/dist/render-context.d.ts +66 -0
- package/dist/render-context.d.ts.map +1 -0
- package/dist/render-context.js +106 -0
- package/dist/render-context.js.map +1 -0
- package/dist/scene-backgrounds.cjs +285 -0
- package/dist/scene-backgrounds.cjs.map +1 -0
- package/dist/scene-backgrounds.d.ts +69 -0
- package/dist/scene-backgrounds.d.ts.map +1 -0
- package/dist/scene-backgrounds.js +268 -0
- package/dist/scene-backgrounds.js.map +1 -0
- package/dist/theme-base.d.ts +133 -0
- package/dist/theme-base.d.ts.map +1 -0
- package/dist/theme-custom.d.ts +13 -0
- package/dist/theme-custom.d.ts.map +1 -0
- package/dist/theme-defaults.cjs +29 -0
- package/dist/theme-defaults.cjs.map +1 -0
- package/dist/theme-defaults.d.ts +1 -0
- package/dist/theme-defaults.d.ts.map +1 -0
- package/dist/theme-defaults.js +28 -0
- package/dist/theme-defaults.js.map +1 -0
- package/dist/theme.cjs +34 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.ts +36 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +32 -0
- package/dist/theme.js.map +1 -0
- package/dist/tooltip/tooltip-types.d.ts +6 -0
- package/dist/tooltip/tooltip-types.d.ts.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/KeyboardInputManager.cjs +112 -0
- package/dist/utils/KeyboardInputManager.cjs.map +1 -0
- package/dist/utils/KeyboardInputManager.d.ts +48 -0
- package/dist/utils/KeyboardInputManager.d.ts.map +1 -0
- package/dist/utils/KeyboardInputManager.js +112 -0
- package/dist/utils/KeyboardInputManager.js.map +1 -0
- package/dist/utils/dom-input-manager.cjs +253 -0
- package/dist/utils/dom-input-manager.cjs.map +1 -0
- package/dist/utils/dom-input-manager.d.ts +113 -0
- package/dist/utils/dom-input-manager.d.ts.map +1 -0
- package/dist/utils/dom-input-manager.js +253 -0
- package/dist/utils/dom-input-manager.js.map +1 -0
- package/dist/utils/fast-deep-equal.cjs +7 -0
- package/dist/utils/fast-deep-equal.cjs.map +1 -0
- package/dist/utils/fast-deep-equal.d.ts +4 -0
- package/dist/utils/fast-deep-equal.d.ts.map +1 -0
- package/dist/utils/fast-deep-equal.js +7 -0
- package/dist/utils/fast-deep-equal.js.map +1 -0
- package/dist/utils/image-subtexture-registry.cjs +98 -0
- package/dist/utils/image-subtexture-registry.cjs.map +1 -0
- package/dist/utils/image-subtexture-registry.d.ts +17 -0
- package/dist/utils/image-subtexture-registry.d.ts.map +1 -0
- package/dist/utils/image-subtexture-registry.js +98 -0
- package/dist/utils/image-subtexture-registry.js.map +1 -0
- package/dist/utils/phaser-guards.cjs +15 -0
- package/dist/utils/phaser-guards.cjs.map +1 -0
- package/dist/utils/phaser-guards.d.ts +7 -0
- package/dist/utils/phaser-guards.d.ts.map +1 -0
- package/dist/utils/phaser-guards.js +15 -0
- package/dist/utils/phaser-guards.js.map +1 -0
- package/dist/utils/svg-texture.cjs +48 -0
- package/dist/utils/svg-texture.cjs.map +1 -0
- package/dist/utils/svg-texture.d.ts +34 -0
- package/dist/utils/svg-texture.d.ts.map +1 -0
- package/dist/utils/svg-texture.js +48 -0
- package/dist/utils/svg-texture.js.map +1 -0
- package/dist/utils/texture-registry.cjs +117 -0
- package/dist/utils/texture-registry.cjs.map +1 -0
- package/dist/utils/texture-registry.d.ts +53 -0
- package/dist/utils/texture-registry.d.ts.map +1 -0
- package/dist/utils/texture-registry.js +117 -0
- package/dist/utils/texture-registry.js.map +1 -0
- package/dist/vdom-host-types.d.ts +12 -0
- package/dist/vdom-host-types.d.ts.map +1 -0
- package/dist/vdom-registry.d.ts +27 -0
- package/dist/vdom-registry.d.ts.map +1 -0
- package/dist/vdom-utils.d.ts +16 -0
- package/dist/vdom-utils.d.ts.map +1 -0
- package/dist/vdom.cjs +36 -0
- package/dist/vdom.cjs.map +1 -0
- package/dist/vdom.d.ts +23 -0
- package/dist/vdom.d.ts.map +1 -0
- package/dist/vdom.js +36 -0
- package/dist/vdom.js.map +1 -0
- package/dist/vector/PhaserVectorDrawContext.cjs +97 -0
- package/dist/vector/PhaserVectorDrawContext.cjs.map +1 -0
- package/dist/vector/PhaserVectorDrawContext.d.ts +27 -0
- package/dist/vector/PhaserVectorDrawContext.d.ts.map +1 -0
- package/dist/vector/PhaserVectorDrawContext.js +97 -0
- package/dist/vector/PhaserVectorDrawContext.js.map +1 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { resolveThemeTokens } from "./design-tokens/resolve-theme-tokens.js";
|
|
3
|
+
import { getGestureManager } from "./gestures/gesture-manager.js";
|
|
4
|
+
import { isPhaserScene } from "./utils/phaser-guards.js";
|
|
5
|
+
class PhaserScheduler {
|
|
6
|
+
constructor(scene) {
|
|
7
|
+
this.scene = scene;
|
|
8
|
+
}
|
|
9
|
+
scene;
|
|
10
|
+
requestAnimationFrame(callback) {
|
|
11
|
+
const handler = (_time, delta) => callback(delta);
|
|
12
|
+
this.scene.events.once("update", handler);
|
|
13
|
+
return {
|
|
14
|
+
cancel: () => this.scene.events.off("update", handler)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
onFrame(callback) {
|
|
18
|
+
const handler = (_time, delta) => callback(delta);
|
|
19
|
+
this.scene.events.on("update", handler);
|
|
20
|
+
return {
|
|
21
|
+
cancel: () => this.scene.events.off("update", handler)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
setTimeout(callback, delay) {
|
|
25
|
+
const timer = this.scene.time.addEvent({
|
|
26
|
+
delay,
|
|
27
|
+
callback,
|
|
28
|
+
loop: false
|
|
29
|
+
});
|
|
30
|
+
return { cancel: () => timer.destroy() };
|
|
31
|
+
}
|
|
32
|
+
setInterval(callback, interval) {
|
|
33
|
+
const timer = this.scene.time.addEvent({
|
|
34
|
+
delay: interval,
|
|
35
|
+
callback,
|
|
36
|
+
loop: true
|
|
37
|
+
});
|
|
38
|
+
return { cancel: () => timer.destroy() };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const PHASER_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
42
|
+
"gesture",
|
|
43
|
+
"input",
|
|
44
|
+
"textures",
|
|
45
|
+
"svg-textures",
|
|
46
|
+
"clipping",
|
|
47
|
+
"effects",
|
|
48
|
+
"fx"
|
|
49
|
+
]);
|
|
50
|
+
const viewportRegistry = {};
|
|
51
|
+
function toFiniteNumber(value) {
|
|
52
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
53
|
+
}
|
|
54
|
+
class PhaserTextureResolver {
|
|
55
|
+
constructor(scene) {
|
|
56
|
+
this.scene = scene;
|
|
57
|
+
}
|
|
58
|
+
scene;
|
|
59
|
+
async load(key, url) {
|
|
60
|
+
if (this.scene.textures.exists(key)) return;
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
this.scene.load.image(key, url);
|
|
63
|
+
this.scene.load.once("complete", () => resolve());
|
|
64
|
+
if (!this.scene.load.isLoading()) {
|
|
65
|
+
this.scene.load.start();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async loadAtlas(key, imageUrl, dataUrl) {
|
|
70
|
+
if (this.scene.textures.exists(key)) return;
|
|
71
|
+
return new Promise((resolve) => {
|
|
72
|
+
this.scene.load.atlas(key, imageUrl, dataUrl);
|
|
73
|
+
this.scene.load.once("complete", () => resolve());
|
|
74
|
+
if (!this.scene.load.isLoading()) {
|
|
75
|
+
this.scene.load.start();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async loadSVG(key, svg, width, height) {
|
|
80
|
+
if (this.scene.textures.exists(key)) return;
|
|
81
|
+
const { textureRegistry } = await import("./utils/texture-registry.js");
|
|
82
|
+
await textureRegistry.requestTexture(this.scene, { key, svg, width, height });
|
|
83
|
+
}
|
|
84
|
+
isLoaded(key) {
|
|
85
|
+
return this.scene.textures.exists(key);
|
|
86
|
+
}
|
|
87
|
+
getFrameNames(key) {
|
|
88
|
+
const texture = this.scene.textures.get(key);
|
|
89
|
+
if (!texture) return [];
|
|
90
|
+
const frameNames = typeof texture.getFrameNames === "function" ? texture.getFrameNames() : texture.frames ? Object.keys(texture.frames) : [];
|
|
91
|
+
return frameNames.filter((name) => name !== "__BASE" && name !== "__MISSING");
|
|
92
|
+
}
|
|
93
|
+
getFrameRect(key, frame) {
|
|
94
|
+
const f = this.scene.textures.getFrame(key, frame);
|
|
95
|
+
if (!f) return void 0;
|
|
96
|
+
return { x: f.cutX, y: f.cutY, width: f.cutWidth, height: f.cutHeight };
|
|
97
|
+
}
|
|
98
|
+
getFrameInfo(key, frame) {
|
|
99
|
+
const f = this.scene.textures.getFrame(key, frame);
|
|
100
|
+
if (!f) return void 0;
|
|
101
|
+
const sourceWidth = toFiniteNumber(f.sourceSizeW) ?? toFiniteNumber(f.realWidth);
|
|
102
|
+
const sourceHeight = toFiniteNumber(f.sourceSizeH) ?? toFiniteNumber(f.realHeight);
|
|
103
|
+
const spriteX = toFiniteNumber(f.x);
|
|
104
|
+
const spriteY = toFiniteNumber(f.y);
|
|
105
|
+
const spriteW = toFiniteNumber(f.width) ?? toFiniteNumber(f.cutWidth);
|
|
106
|
+
const spriteH = toFiniteNumber(f.height) ?? toFiniteNumber(f.cutHeight);
|
|
107
|
+
return {
|
|
108
|
+
name: frame,
|
|
109
|
+
rect: {
|
|
110
|
+
x: toFiniteNumber(f.cutX) ?? 0,
|
|
111
|
+
y: toFiniteNumber(f.cutY) ?? 0,
|
|
112
|
+
width: toFiniteNumber(f.cutWidth) ?? 0,
|
|
113
|
+
height: toFiniteNumber(f.cutHeight) ?? 0
|
|
114
|
+
},
|
|
115
|
+
rotated: f.rotated === true,
|
|
116
|
+
trimmed: f.trimmed === true,
|
|
117
|
+
sourceSize: sourceWidth !== void 0 && sourceHeight !== void 0 ? { width: sourceWidth, height: sourceHeight } : void 0,
|
|
118
|
+
spriteSourceRect: spriteX !== void 0 && spriteY !== void 0 && spriteW !== void 0 && spriteH !== void 0 ? { x: spriteX, y: spriteY, w: spriteW, h: spriteH } : void 0
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
getTextureSize(key) {
|
|
122
|
+
const texture = this.scene.textures.get(key);
|
|
123
|
+
if (!texture) return void 0;
|
|
124
|
+
const [source] = texture.source;
|
|
125
|
+
if (!source) return void 0;
|
|
126
|
+
return { width: source.width, height: source.height };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function createPhaserSurfaceContext(scene, adapter, vdom) {
|
|
130
|
+
const context = {
|
|
131
|
+
viewport: {
|
|
132
|
+
width: scene.scale.width,
|
|
133
|
+
height: scene.scale.height
|
|
134
|
+
},
|
|
135
|
+
scheduler: new PhaserScheduler(scene),
|
|
136
|
+
capabilities: PHASER_CAPABILITIES,
|
|
137
|
+
themeTokens: resolveThemeTokens(void 0),
|
|
138
|
+
raw: scene,
|
|
139
|
+
textureLoader: new PhaserTextureResolver(scene),
|
|
140
|
+
debugSnapshotCollector: () => ({}),
|
|
141
|
+
...adapter ? { adapter } : {},
|
|
142
|
+
...vdom ? { vdom } : {}
|
|
143
|
+
};
|
|
144
|
+
viewportRegistry.viewport = context.viewport;
|
|
145
|
+
return context;
|
|
146
|
+
}
|
|
147
|
+
class PhaserSurfaceAdapter {
|
|
148
|
+
/** All root surfaces managed by this adapter, keyed by id */
|
|
149
|
+
surfaces = /* @__PURE__ */ new Map();
|
|
150
|
+
/** Monotonic id source to avoid collisions after surfaces are destroyed */
|
|
151
|
+
nextSurfaceId = 1;
|
|
152
|
+
/** Portal root container per scene — high-depth container above normal UI */
|
|
153
|
+
portalRoots = /* @__PURE__ */ new Map();
|
|
154
|
+
/** Resize handlers registered per surface */
|
|
155
|
+
resizeHandlers = /* @__PURE__ */ new Map();
|
|
156
|
+
/** Destroy handlers registered per surface */
|
|
157
|
+
destroyHandlers = /* @__PURE__ */ new Map();
|
|
158
|
+
/** Track whether a surface is still alive (backed by live Phaser objects) */
|
|
159
|
+
alive = /* @__PURE__ */ new Set();
|
|
160
|
+
/** Renderer-bound VDOM operations — set by the runtime after construction */
|
|
161
|
+
vdom;
|
|
162
|
+
/**
|
|
163
|
+
* Set the renderer's VDOM operations.
|
|
164
|
+
* Called by the Phaser VDOM runtime after construction to avoid circular imports.
|
|
165
|
+
*/
|
|
166
|
+
setVDOM(ops) {
|
|
167
|
+
this.vdom = ops;
|
|
168
|
+
}
|
|
169
|
+
createRoot(options) {
|
|
170
|
+
const id = options.id ?? `surface-${this.nextSurfaceId++}`;
|
|
171
|
+
const kind = options.kind ?? "root";
|
|
172
|
+
const zIndex = options.zIndex ?? (kind === "root" ? 0 : 100);
|
|
173
|
+
if (this.surfaces.has(id)) {
|
|
174
|
+
throw new Error(`Root surface "${id}" already exists`);
|
|
175
|
+
}
|
|
176
|
+
if (kind === "portal" && !options.parent) {
|
|
177
|
+
throw new Error("Portal root surfaces require a parent RootSurface");
|
|
178
|
+
}
|
|
179
|
+
const target = options.target;
|
|
180
|
+
let scene;
|
|
181
|
+
if (kind === "portal" && options.parent) {
|
|
182
|
+
if (!options.parent.context?.raw) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
"Phaser portal root surfaces require a parent RootSurface with a valid context.raw (Phaser.Scene)"
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
const parentScene = this.resolveScene(options.parent.context.raw);
|
|
188
|
+
scene = options.target ? this.resolveScene(options.target) : parentScene;
|
|
189
|
+
if (scene !== parentScene) {
|
|
190
|
+
throw new Error(
|
|
191
|
+
"Phaser portal root surfaces must use the same Phaser.Scene as their parent"
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
} else if (target) {
|
|
195
|
+
scene = this.resolveScene(target);
|
|
196
|
+
} else {
|
|
197
|
+
throw new Error("Root surfaces require a target (Phaser.Scene)");
|
|
198
|
+
}
|
|
199
|
+
const context = createPhaserSurfaceContext(scene, this, this.vdom);
|
|
200
|
+
let rootContainer;
|
|
201
|
+
if (kind === "root") {
|
|
202
|
+
rootContainer = scene.add.container(0, 0);
|
|
203
|
+
rootContainer.setDepth(zIndex);
|
|
204
|
+
} else {
|
|
205
|
+
const portalRoot = this.getOrCreatePortalRoot(scene);
|
|
206
|
+
rootContainer = scene.add.container(0, 0);
|
|
207
|
+
rootContainer.setDepth(zIndex);
|
|
208
|
+
portalRoot.add(rootContainer);
|
|
209
|
+
}
|
|
210
|
+
rootContainer.__surfaceZIndex = zIndex;
|
|
211
|
+
const surface = {
|
|
212
|
+
id,
|
|
213
|
+
kind,
|
|
214
|
+
zIndex,
|
|
215
|
+
context,
|
|
216
|
+
root: rootContainer,
|
|
217
|
+
...options.parent ? { parent: options.parent } : {}
|
|
218
|
+
};
|
|
219
|
+
const surfaceContext = { ...context, rootSurface: surface };
|
|
220
|
+
surface.context = surfaceContext;
|
|
221
|
+
rootContainer.__surfaceContext = surfaceContext;
|
|
222
|
+
this.surfaces.set(id, surface);
|
|
223
|
+
this.alive.add(id);
|
|
224
|
+
if (kind === "portal") {
|
|
225
|
+
this.resortPortalSurfaces(scene);
|
|
226
|
+
}
|
|
227
|
+
const onResize = (_gameSize) => {
|
|
228
|
+
const updatedContext = createPhaserSurfaceContext(scene, this, this.vdom);
|
|
229
|
+
surface.context = updatedContext;
|
|
230
|
+
rootContainer.__surfaceContext = updatedContext;
|
|
231
|
+
};
|
|
232
|
+
scene.scale.on("resize", onResize);
|
|
233
|
+
this.resizeHandlers.set(id, {
|
|
234
|
+
cancel: () => scene.scale.off("resize", onResize)
|
|
235
|
+
});
|
|
236
|
+
const onShutdown = () => {
|
|
237
|
+
this.unregisterSurface(surface);
|
|
238
|
+
if (surface.kind === "portal") {
|
|
239
|
+
this.cleanupPortalRootIfEmpty(surface);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
scene.events.once("shutdown", onShutdown);
|
|
243
|
+
this.destroyHandlers.set(id, {
|
|
244
|
+
cancel: () => scene.events.off("shutdown", onShutdown)
|
|
245
|
+
});
|
|
246
|
+
return surface;
|
|
247
|
+
}
|
|
248
|
+
updateRoot(surface, options) {
|
|
249
|
+
const container = surface.root;
|
|
250
|
+
if (options.zIndex !== void 0) {
|
|
251
|
+
container.setDepth(options.zIndex);
|
|
252
|
+
surface.zIndex = options.zIndex;
|
|
253
|
+
container.__surfaceZIndex = options.zIndex;
|
|
254
|
+
if (surface.kind === "portal") {
|
|
255
|
+
const scene = surface.context.raw;
|
|
256
|
+
if (scene) {
|
|
257
|
+
this.resortPortalSurfaces(scene);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (options.width !== void 0 || options.height !== void 0) {
|
|
262
|
+
const ctx = surface.context;
|
|
263
|
+
const viewport = {
|
|
264
|
+
width: options.width ?? ctx.viewport.width,
|
|
265
|
+
height: options.height ?? ctx.viewport.height
|
|
266
|
+
};
|
|
267
|
+
surface.context = { ...ctx, viewport };
|
|
268
|
+
surface.root.__surfaceContext = surface.context;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
destroyRoot(surface) {
|
|
272
|
+
const childSurfaces = Array.from(this.surfaces.values()).filter((candidate) => {
|
|
273
|
+
return candidate.parent?.id === surface.id;
|
|
274
|
+
});
|
|
275
|
+
for (const childSurface of childSurfaces) {
|
|
276
|
+
this.destroyRoot(childSurface);
|
|
277
|
+
}
|
|
278
|
+
if (surface.kind === "portal") {
|
|
279
|
+
this.syncPortalEventBlocking(surface, false);
|
|
280
|
+
}
|
|
281
|
+
this.unregisterSurface(surface);
|
|
282
|
+
const container = surface.root;
|
|
283
|
+
container?.destroy();
|
|
284
|
+
if (surface.kind === "portal") {
|
|
285
|
+
this.cleanupPortalRootIfEmpty(surface);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
sortRoots(roots) {
|
|
289
|
+
const sorted = [...roots].sort((a, b) => a.zIndex - b.zIndex);
|
|
290
|
+
for (const surface of sorted) {
|
|
291
|
+
const container = surface.root;
|
|
292
|
+
const parent = container.parentContainer;
|
|
293
|
+
if (parent) {
|
|
294
|
+
parent.remove(container, false);
|
|
295
|
+
parent.add(container);
|
|
296
|
+
} else {
|
|
297
|
+
const displayList = container.scene?.children;
|
|
298
|
+
if (displayList?.remove && displayList.add) {
|
|
299
|
+
displayList.remove(container, false);
|
|
300
|
+
displayList.add(container);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
isAlive(surface) {
|
|
306
|
+
if (!this.alive.has(surface.id)) return false;
|
|
307
|
+
const scene = surface.context.raw;
|
|
308
|
+
return !!(scene && scene.sys && scene.sys.settings.active);
|
|
309
|
+
}
|
|
310
|
+
onDestroy(surface, callback) {
|
|
311
|
+
const scene = surface.context.raw;
|
|
312
|
+
scene.events.once("shutdown", callback);
|
|
313
|
+
return {
|
|
314
|
+
cancel: () => scene.events.off("shutdown", callback)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Find a root surface by its renderer-native target (Phaser.Scene).
|
|
319
|
+
* Returns the first root surface (kind='root') for the given scene.
|
|
320
|
+
*
|
|
321
|
+
* @migration(audit:scene-portal-mount) Phase 6B — enables Portal to find parent RootSurface.
|
|
322
|
+
*/
|
|
323
|
+
getRootByTarget(target) {
|
|
324
|
+
const scene = target;
|
|
325
|
+
if (!scene) return void 0;
|
|
326
|
+
for (const surface of this.surfaces.values()) {
|
|
327
|
+
if (surface.context.raw === scene && surface.kind === "root") {
|
|
328
|
+
return surface;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return void 0;
|
|
332
|
+
}
|
|
333
|
+
syncPortalEventBlocking(surface, blockEvents) {
|
|
334
|
+
if (surface.kind !== "portal") return;
|
|
335
|
+
if (!this.alive.has(surface.id)) return;
|
|
336
|
+
const scene = surface.context.raw;
|
|
337
|
+
const container = surface.root;
|
|
338
|
+
if (!scene || !container) return;
|
|
339
|
+
const gestureManager = getGestureManager(scene);
|
|
340
|
+
if (!blockEvents) {
|
|
341
|
+
gestureManager.unregisterContainer(container);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const hitArea = this.resolvePortalHitArea(container);
|
|
345
|
+
if (!hitArea) {
|
|
346
|
+
gestureManager.unregisterContainer(container);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const callbacks = {
|
|
350
|
+
onTouch: (event) => {
|
|
351
|
+
event.stopPropagation();
|
|
352
|
+
},
|
|
353
|
+
onTouchMove: (event) => {
|
|
354
|
+
event.stopPropagation();
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
if (gestureManager.hasContainer(container)) {
|
|
358
|
+
gestureManager.updateCallbacks(container, callbacks);
|
|
359
|
+
gestureManager.updateHitArea(container, hitArea);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
gestureManager.registerContainer(container, callbacks, hitArea);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Get or create the high-depth portal root container for a scene.
|
|
366
|
+
* This is the parent container for all portal overlays in that scene.
|
|
367
|
+
*/
|
|
368
|
+
getOrCreatePortalRoot(scene) {
|
|
369
|
+
if (!scene || !scene.add) {
|
|
370
|
+
throw new Error(
|
|
371
|
+
`[PhaserSurfaceAdapter] Cannot create portal root: scene is ${scene === null ? "null" : scene === void 0 ? "undefined" : "missing .add"}. Verify that the parent RootSurface was created with a valid Phaser.Scene target.`
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
let root = this.portalRoots.get(scene);
|
|
375
|
+
if (!root) {
|
|
376
|
+
root = scene.add.container(0, 0);
|
|
377
|
+
root.setDepth(999999);
|
|
378
|
+
root.__surfaceZIndex = 999999;
|
|
379
|
+
this.portalRoots.set(scene, root);
|
|
380
|
+
}
|
|
381
|
+
return root;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Keep portal siblings ordered by surface zIndex within the shared portal root.
|
|
385
|
+
* Phaser container children render primarily by list order, not by child depth.
|
|
386
|
+
*/
|
|
387
|
+
resortPortalSurfaces(scene) {
|
|
388
|
+
const portalSurfaces = Array.from(this.surfaces.values()).filter(
|
|
389
|
+
(surface) => surface.kind === "portal" && surface.context.raw === scene
|
|
390
|
+
);
|
|
391
|
+
if (portalSurfaces.length <= 1) return;
|
|
392
|
+
this.sortRoots(portalSurfaces);
|
|
393
|
+
}
|
|
394
|
+
resolveScene(target) {
|
|
395
|
+
if (!isPhaserScene(target)) {
|
|
396
|
+
throw new Error("PhaserSurfaceAdapter requires a Phaser.Scene target");
|
|
397
|
+
}
|
|
398
|
+
return target;
|
|
399
|
+
}
|
|
400
|
+
unregisterSurface(surface) {
|
|
401
|
+
this.alive.delete(surface.id);
|
|
402
|
+
this.surfaces.delete(surface.id);
|
|
403
|
+
this.resizeHandlers.get(surface.id)?.cancel();
|
|
404
|
+
this.resizeHandlers.delete(surface.id);
|
|
405
|
+
this.destroyHandlers.get(surface.id)?.cancel();
|
|
406
|
+
this.destroyHandlers.delete(surface.id);
|
|
407
|
+
if (this.surfaces.size === 0) {
|
|
408
|
+
delete viewportRegistry.viewport;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Clean up portal root container if no portal surfaces remain for its scene.
|
|
413
|
+
*/
|
|
414
|
+
cleanupPortalRootIfEmpty(surface) {
|
|
415
|
+
const scene = surface.context.raw;
|
|
416
|
+
const hasPortalSurfaces = Array.from(this.surfaces.values()).some(
|
|
417
|
+
(s) => s.id !== surface.id && s.kind === "portal" && s.context.raw === scene
|
|
418
|
+
);
|
|
419
|
+
if (!hasPortalSurfaces) {
|
|
420
|
+
const root = this.portalRoots.get(scene);
|
|
421
|
+
if (root) {
|
|
422
|
+
root.destroy();
|
|
423
|
+
this.portalRoots.delete(scene);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
resolvePortalHitArea(container) {
|
|
428
|
+
const children = this.getPortalChildren(container);
|
|
429
|
+
if (children.length === 0) return null;
|
|
430
|
+
let minX = Infinity;
|
|
431
|
+
let minY = Infinity;
|
|
432
|
+
let maxX = -Infinity;
|
|
433
|
+
let maxY = -Infinity;
|
|
434
|
+
for (const child of children) {
|
|
435
|
+
if (!this.isBoundsProvider(child)) continue;
|
|
436
|
+
const bounds = child.getBounds();
|
|
437
|
+
if (bounds.width <= 0 || bounds.height <= 0) continue;
|
|
438
|
+
minX = Math.min(minX, bounds.x);
|
|
439
|
+
minY = Math.min(minY, bounds.y);
|
|
440
|
+
maxX = Math.max(maxX, bounds.x + bounds.width);
|
|
441
|
+
maxY = Math.max(maxY, bounds.y + bounds.height);
|
|
442
|
+
}
|
|
443
|
+
if (!Number.isFinite(minX) || !Number.isFinite(minY)) {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
const matrix = container.getWorldTransformMatrix().invert();
|
|
447
|
+
const topLeft = matrix.transformPoint(minX, minY);
|
|
448
|
+
const bottomRight = matrix.transformPoint(maxX, maxY);
|
|
449
|
+
return new Phaser.Geom.Rectangle(
|
|
450
|
+
Math.min(topLeft.x, bottomRight.x),
|
|
451
|
+
Math.min(topLeft.y, bottomRight.y),
|
|
452
|
+
Math.abs(bottomRight.x - topLeft.x),
|
|
453
|
+
Math.abs(bottomRight.y - topLeft.y)
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
getPortalChildren(container) {
|
|
457
|
+
const directChildren = Array.isArray(container.list) ? container.list : container.getAll?.() ?? [];
|
|
458
|
+
return directChildren.filter(
|
|
459
|
+
(child) => !!child && typeof child === "object" && "active" in child
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
isBoundsProvider(child) {
|
|
463
|
+
return typeof child.getBounds === "function";
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
export {
|
|
467
|
+
PhaserSurfaceAdapter,
|
|
468
|
+
createPhaserSurfaceContext,
|
|
469
|
+
viewportRegistry
|
|
470
|
+
};
|
|
471
|
+
//# sourceMappingURL=phaser-surface-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaser-surface-adapter.js","sources":["../src/phaser-surface-adapter.ts"],"sourcesContent":["/**\n * Phaser SurfaceAdapter — renderer-specific implementation of SurfaceAdapter.\n *\n * Bridges Phaser.Scene to the renderer-neutral SurfaceContext / RootSurface contracts.\n * Owns root and portal surface lifecycle for the Phaser renderer.\n *\n * @migration(audit:scene-portal-mount) Phase 1 — completed replacement of the\n * legacy portal registry root-management path.\n */\n\nimport type {\n AtlasFrameInfo,\n CreateRootSurfaceOptions,\n FrameRect,\n HostCancelHandle,\n HostScheduler,\n RootSurface,\n Size,\n SurfaceAdapter,\n SurfaceContext,\n SurfaceTarget,\n TextureResolver,\n UpdateRootSurfaceOptions,\n VDOMOperations,\n} from '@number10/jsx-core'\nimport * as Phaser from 'phaser'\nimport { resolveThemeTokens } from './design-tokens/resolve-theme-tokens'\nimport { getGestureManager } from './gestures/gesture-manager'\nimport type { ContainerLike } from './phaser-runtime-types'\nimport { isPhaserScene } from './utils/phaser-guards'\n\n// ---------------------------------------------------------------------------\n// Phaser-specific scheduler\n// ---------------------------------------------------------------------------\n\n/**\n * Phaser implementation of HostScheduler.\n * Wraps scene.events.update, scene.time.addEvent for frame/timer tick sources.\n */\nclass PhaserScheduler implements HostScheduler {\n constructor(private readonly scene: Phaser.Scene) {}\n\n requestAnimationFrame(callback: (dt: number) => void): HostCancelHandle {\n // Phaser's update event carries (time: number, delta: number)\n const handler = (_time: number, delta: number) => callback(delta)\n this.scene.events.once('update', handler)\n return {\n cancel: () => this.scene.events.off('update', handler),\n }\n }\n\n onFrame(callback: (dt: number) => void): HostCancelHandle {\n const handler = (_time: number, delta: number) => callback(delta)\n this.scene.events.on('update', handler)\n return {\n cancel: () => this.scene.events.off('update', handler),\n }\n }\n\n setTimeout(callback: () => void, delay: number): HostCancelHandle {\n const timer = this.scene.time.addEvent({\n delay,\n callback,\n loop: false,\n })\n return { cancel: () => timer.destroy() }\n }\n\n setInterval(callback: () => void, interval: number): HostCancelHandle {\n const timer = this.scene.time.addEvent({\n delay: interval,\n callback,\n loop: true,\n })\n return { cancel: () => timer.destroy() }\n }\n}\n\n// ---------------------------------------------------------------------------\n// SurfaceContext factory\n// ---------------------------------------------------------------------------\n\n/**\n * Default capabilities for Phaser 4 renderer.\n */\nconst PHASER_CAPABILITIES: ReadonlySet<string> = new Set([\n 'gesture',\n 'input',\n 'textures',\n 'svg-textures',\n 'clipping',\n 'effects',\n 'fx',\n])\n\n/**\n * Backward-compat viewport registry exposed by the legacy UI package.\n * Stores the most recently active surface viewport for debug tooling.\n */\nexport const viewportRegistry: {\n viewport?: SurfaceContext['viewport']\n} = {}\n\nfunction toFiniteNumber(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n}\n\n// ---------------------------------------------------------------------------\n// PhaserTextureResolver — TextureResolver via scene.textures\n// ---------------------------------------------------------------------------\n\nclass PhaserTextureResolver implements TextureResolver {\n constructor(private scene: Phaser.Scene) {}\n\n async load(key: string, url: string): Promise<void> {\n if (this.scene.textures.exists(key)) return\n return new Promise((resolve) => {\n this.scene.load.image(key, url)\n this.scene.load.once('complete', () => resolve())\n if (!this.scene.load.isLoading()) {\n this.scene.load.start()\n }\n })\n }\n\n async loadAtlas(key: string, imageUrl: string, dataUrl: string): Promise<void> {\n if (this.scene.textures.exists(key)) return\n return new Promise((resolve) => {\n this.scene.load.atlas(key, imageUrl, dataUrl)\n this.scene.load.once('complete', () => resolve())\n if (!this.scene.load.isLoading()) {\n this.scene.load.start()\n }\n })\n }\n\n async loadSVG(key: string, svg: string, width: number, height: number): Promise<void> {\n if (this.scene.textures.exists(key)) return\n const { textureRegistry } = await import('./utils/texture-registry')\n await textureRegistry.requestTexture(this.scene, { key, svg, width, height })\n }\n\n isLoaded(key: string): boolean {\n return this.scene.textures.exists(key)\n }\n\n getFrameNames(key: string): string[] {\n const texture = this.scene.textures.get(key) as {\n getFrameNames?: () => string[]\n frames?: Record<string, unknown>\n } | null\n if (!texture) return []\n\n const frameNames =\n typeof texture.getFrameNames === 'function'\n ? texture.getFrameNames()\n : texture.frames\n ? Object.keys(texture.frames)\n : []\n\n return frameNames.filter((name) => name !== '__BASE' && name !== '__MISSING')\n }\n\n getFrameRect(key: string, frame: string): FrameRect | undefined {\n const f = this.scene.textures.getFrame(key, frame)\n if (!f) return undefined\n return { x: f.cutX, y: f.cutY, width: f.cutWidth, height: f.cutHeight }\n }\n\n getFrameInfo(key: string, frame: string): AtlasFrameInfo | undefined {\n const f = this.scene.textures.getFrame(key, frame) as unknown as Record<string, unknown> | null\n if (!f) return undefined\n\n const sourceWidth = toFiniteNumber(f.sourceSizeW) ?? toFiniteNumber(f.realWidth)\n const sourceHeight = toFiniteNumber(f.sourceSizeH) ?? toFiniteNumber(f.realHeight)\n const spriteX = toFiniteNumber(f.x)\n const spriteY = toFiniteNumber(f.y)\n const spriteW = toFiniteNumber(f.width) ?? toFiniteNumber(f.cutWidth)\n const spriteH = toFiniteNumber(f.height) ?? toFiniteNumber(f.cutHeight)\n\n return {\n name: frame,\n rect: {\n x: toFiniteNumber(f.cutX) ?? 0,\n y: toFiniteNumber(f.cutY) ?? 0,\n width: toFiniteNumber(f.cutWidth) ?? 0,\n height: toFiniteNumber(f.cutHeight) ?? 0,\n },\n rotated: f.rotated === true,\n trimmed: f.trimmed === true,\n sourceSize:\n sourceWidth !== undefined && sourceHeight !== undefined\n ? { width: sourceWidth, height: sourceHeight }\n : undefined,\n spriteSourceRect:\n spriteX !== undefined &&\n spriteY !== undefined &&\n spriteW !== undefined &&\n spriteH !== undefined\n ? { x: spriteX, y: spriteY, w: spriteW, h: spriteH }\n : undefined,\n }\n }\n\n getTextureSize(key: string): Size | undefined {\n const texture = this.scene.textures.get(key)\n if (!texture) return undefined\n const [source] = texture.source\n if (!source) return undefined\n return { width: source.width, height: source.height }\n }\n}\n\n/**\n * Creates a SurfaceContext from a Phaser.Scene.\n */\nexport function createPhaserSurfaceContext(\n scene: Phaser.Scene,\n adapter?: SurfaceAdapter,\n vdom?: VDOMOperations\n): SurfaceContext {\n const context: SurfaceContext = {\n viewport: {\n width: scene.scale.width,\n height: scene.scale.height,\n },\n scheduler: new PhaserScheduler(scene),\n capabilities: PHASER_CAPABILITIES,\n themeTokens: resolveThemeTokens(undefined) as unknown as Record<string, unknown>,\n raw: scene,\n textureLoader: new PhaserTextureResolver(scene),\n debugSnapshotCollector: () => ({}) as Record<string, string | number>,\n ...(adapter ? { adapter } : {}),\n ...(vdom ? { vdom } : {}),\n }\n\n viewportRegistry.viewport = context.viewport\n return context\n}\n\n// ---------------------------------------------------------------------------\n// PhaserSurfaceAdapter\n// ---------------------------------------------------------------------------\n\n/**\n * Phaser implementation of the SurfaceAdapter contract.\n *\n * Manages root containers for mountJSX (Portal 0) and <Portal> overlays.\n * Each RootSurface wraps a Phaser.Container with depth/z-order management.\n */\nexport class PhaserSurfaceAdapter implements SurfaceAdapter {\n /** All root surfaces managed by this adapter, keyed by id */\n private surfaces = new Map<string, RootSurface>()\n\n /** Monotonic id source to avoid collisions after surfaces are destroyed */\n private nextSurfaceId = 1\n\n /** Portal root container per scene — high-depth container above normal UI */\n private portalRoots = new Map<Phaser.Scene, ContainerLike>()\n\n /** Resize handlers registered per surface */\n private resizeHandlers = new Map<string, HostCancelHandle>()\n\n /** Destroy handlers registered per surface */\n private destroyHandlers = new Map<string, HostCancelHandle>()\n\n /** Track whether a surface is still alive (backed by live Phaser objects) */\n private alive = new Set<string>()\n\n /** Renderer-bound VDOM operations — set by the runtime after construction */\n private vdom: VDOMOperations | undefined\n\n /**\n * Set the renderer's VDOM operations.\n * Called by the Phaser VDOM runtime after construction to avoid circular imports.\n */\n setVDOM(ops: VDOMOperations): void {\n this.vdom = ops\n }\n\n createRoot(options: CreateRootSurfaceOptions): RootSurface {\n const id = options.id ?? `surface-${this.nextSurfaceId++}`\n const kind = options.kind ?? 'root'\n const zIndex = options.zIndex ?? (kind === 'root' ? 0 : 100)\n\n if (this.surfaces.has(id)) {\n throw new Error(`Root surface \"${id}\" already exists`)\n }\n\n if (kind === 'portal' && !options.parent) {\n throw new Error('Portal root surfaces require a parent RootSurface')\n }\n\n // Resolve target scene\n const target = options.target as Phaser.Scene | undefined\n\n // For portal roots, use parent's target if not explicitly provided\n let scene: Phaser.Scene\n if (kind === 'portal' && options.parent) {\n if (!options.parent.context?.raw) {\n throw new Error(\n 'Phaser portal root surfaces require a parent RootSurface with a valid context.raw (Phaser.Scene)'\n )\n }\n const parentScene = this.resolveScene(options.parent.context.raw)\n scene = options.target ? this.resolveScene(options.target) : parentScene\n if (scene !== parentScene) {\n throw new Error(\n 'Phaser portal root surfaces must use the same Phaser.Scene as their parent'\n )\n }\n } else if (target) {\n scene = this.resolveScene(target)\n } else {\n throw new Error('Root surfaces require a target (Phaser.Scene)')\n }\n\n const context = createPhaserSurfaceContext(scene, this, this.vdom)\n\n // Create root container\n let rootContainer: ContainerLike\n if (kind === 'root') {\n // Portal 0 / main mount: create a container at normal depth\n rootContainer = scene.add.container(0, 0) as unknown as ContainerLike\n rootContainer.setDepth(zIndex)\n } else {\n // Portal overlay: create container as child of portal root\n const portalRoot = this.getOrCreatePortalRoot(scene)\n rootContainer = scene.add.container(0, 0) as unknown as ContainerLike\n rootContainer.setDepth(zIndex)\n portalRoot.add(rootContainer as unknown as Phaser.GameObjects.GameObject)\n }\n\n // @migration(audit:scene-portal-mount) Phase 6C — __surfaceZIndex replaces __mountRootId.\n // GestureManager uses this for event prioritization (higher = on top).\n ;(rootContainer as unknown as { __surfaceZIndex?: number }).__surfaceZIndex = zIndex\n\n const surface: RootSurface = {\n id,\n kind,\n zIndex,\n context,\n root: rootContainer,\n ...(options.parent ? { parent: options.parent } : {}),\n }\n\n const surfaceContext = { ...context, rootSurface: surface }\n ;(surface as { context: SurfaceContext }).context = surfaceContext\n ;(rootContainer as unknown as { __surfaceContext?: SurfaceContext }).__surfaceContext =\n surfaceContext\n\n this.surfaces.set(id, surface)\n this.alive.add(id)\n\n if (kind === 'portal') {\n this.resortPortalSurfaces(scene)\n }\n\n // Hook scene resize to update viewport\n const onResize = (_gameSize: unknown) => {\n const updatedContext = createPhaserSurfaceContext(scene, this, this.vdom)\n ;(surface as { context: SurfaceContext }).context = updatedContext\n ;(rootContainer as unknown as { __surfaceContext?: SurfaceContext }).__surfaceContext =\n updatedContext\n }\n scene.scale.on('resize', onResize)\n this.resizeHandlers.set(id, {\n cancel: () => scene.scale.off('resize', onResize),\n })\n\n const onShutdown = () => {\n this.unregisterSurface(surface)\n if (surface.kind === 'portal') {\n this.cleanupPortalRootIfEmpty(surface)\n }\n }\n scene.events.once('shutdown', onShutdown)\n this.destroyHandlers.set(id, {\n cancel: () => scene.events.off('shutdown', onShutdown),\n })\n\n return surface\n }\n\n updateRoot(surface: RootSurface, options: UpdateRootSurfaceOptions): void {\n const container = surface.root as ContainerLike\n\n if (options.zIndex !== undefined) {\n container.setDepth(options.zIndex)\n ;(surface as { zIndex: number }).zIndex = options.zIndex\n ;(container as unknown as { __surfaceZIndex?: number }).__surfaceZIndex = options.zIndex\n\n if (surface.kind === 'portal') {\n const scene = surface.context.raw as Phaser.Scene | undefined\n if (scene) {\n this.resortPortalSurfaces(scene)\n }\n }\n }\n\n if (options.width !== undefined || options.height !== undefined) {\n const ctx = surface.context\n const viewport = {\n width: options.width ?? ctx.viewport.width,\n height: options.height ?? ctx.viewport.height,\n }\n ;(surface as { context: SurfaceContext }).context = { ...ctx, viewport }\n ;(surface.root as unknown as { __surfaceContext?: SurfaceContext }).__surfaceContext =\n surface.context\n }\n }\n\n destroyRoot(surface: RootSurface): void {\n const childSurfaces = Array.from(this.surfaces.values()).filter((candidate) => {\n return candidate.parent?.id === surface.id\n })\n for (const childSurface of childSurfaces) {\n this.destroyRoot(childSurface)\n }\n\n if (surface.kind === 'portal') {\n this.syncPortalEventBlocking(surface, false)\n }\n\n this.unregisterSurface(surface)\n\n const container = surface.root as ContainerLike | undefined\n container?.destroy()\n\n // Clean up portal root if no more portal surfaces for this scene\n if (surface.kind === 'portal') {\n this.cleanupPortalRootIfEmpty(surface)\n }\n }\n\n sortRoots(roots: readonly RootSurface[]): void {\n // Re-add in ascending order so the highest zIndex is added last.\n const sorted = [...roots].sort((a, b) => a.zIndex - b.zIndex)\n\n for (const surface of sorted) {\n const container = surface.root as ContainerLike\n // Phaser processes input from LAST to FIRST in DisplayList,\n // so highest depth should be LAST (last in sort → added last)\n // Re-adding to parent moves it to top of display list\n const parent = container.parentContainer\n if (parent) {\n parent.remove(container as unknown as Phaser.GameObjects.GameObject, false)\n parent.add(container as unknown as Phaser.GameObjects.GameObject)\n } else {\n const displayList = container.scene?.children as\n | {\n remove?: (child: unknown, destroyChild?: boolean) => void\n add?: (child: unknown) => void\n }\n | undefined\n if (displayList?.remove && displayList.add) {\n displayList.remove(container, false)\n displayList.add(container)\n }\n }\n }\n }\n\n isAlive(surface: RootSurface): boolean {\n if (!this.alive.has(surface.id)) return false\n const scene = surface.context.raw as Phaser.Scene | undefined\n return !!(scene && scene.sys && scene.sys.settings.active)\n }\n\n onDestroy(surface: RootSurface, callback: () => void): HostCancelHandle {\n const scene = surface.context.raw as Phaser.Scene\n scene.events.once('shutdown', callback)\n return {\n cancel: () => scene.events.off('shutdown', callback),\n }\n }\n\n /**\n * Find a root surface by its renderer-native target (Phaser.Scene).\n * Returns the first root surface (kind='root') for the given scene.\n *\n * @migration(audit:scene-portal-mount) Phase 6B — enables Portal to find parent RootSurface.\n */\n getRootByTarget(target: SurfaceTarget): RootSurface | undefined {\n const scene = target as Phaser.Scene | undefined\n if (!scene) return undefined\n\n for (const surface of this.surfaces.values()) {\n if (surface.context.raw === scene && surface.kind === 'root') {\n return surface\n }\n }\n return undefined\n }\n\n syncPortalEventBlocking(surface: RootSurface, blockEvents: boolean): void {\n if (surface.kind !== 'portal') return\n if (!this.alive.has(surface.id)) return\n\n const scene = surface.context.raw as Phaser.Scene | undefined\n const container = surface.root as Phaser.GameObjects.Container | undefined\n if (!scene || !container) return\n\n const gestureManager = getGestureManager(scene)\n if (!blockEvents) {\n gestureManager.unregisterContainer(container)\n return\n }\n\n const hitArea = this.resolvePortalHitArea(container)\n if (!hitArea) {\n gestureManager.unregisterContainer(container)\n return\n }\n\n const callbacks = {\n onTouch: (event: { stopPropagation(): void }) => {\n event.stopPropagation()\n },\n onTouchMove: (event: { stopPropagation(): void }) => {\n event.stopPropagation()\n },\n }\n\n if (gestureManager.hasContainer(container)) {\n gestureManager.updateCallbacks(container, callbacks)\n gestureManager.updateHitArea(container, hitArea)\n return\n }\n\n gestureManager.registerContainer(container, callbacks, hitArea)\n }\n\n /**\n * Get or create the high-depth portal root container for a scene.\n * This is the parent container for all portal overlays in that scene.\n */\n private getOrCreatePortalRoot(scene: Phaser.Scene): ContainerLike {\n if (!scene || !scene.add) {\n throw new Error(\n `[PhaserSurfaceAdapter] Cannot create portal root: scene is ${scene === null ? 'null' : scene === undefined ? 'undefined' : 'missing .add'}. ` +\n `Verify that the parent RootSurface was created with a valid Phaser.Scene target.`\n )\n }\n let root = this.portalRoots.get(scene)\n if (!root) {\n root = scene.add.container(0, 0) as unknown as ContainerLike\n root.setDepth(999999)\n ;(root as unknown as { __surfaceZIndex?: number }).__surfaceZIndex = 999999\n this.portalRoots.set(scene, root)\n }\n return root\n }\n\n /**\n * Keep portal siblings ordered by surface zIndex within the shared portal root.\n * Phaser container children render primarily by list order, not by child depth.\n */\n private resortPortalSurfaces(scene: Phaser.Scene): void {\n const portalSurfaces = Array.from(this.surfaces.values()).filter(\n (surface) => surface.kind === 'portal' && surface.context.raw === scene\n )\n if (portalSurfaces.length <= 1) return\n this.sortRoots(portalSurfaces)\n }\n\n private resolveScene(target: unknown): Phaser.Scene {\n if (!isPhaserScene(target)) {\n throw new Error('PhaserSurfaceAdapter requires a Phaser.Scene target')\n }\n return target\n }\n\n private unregisterSurface(surface: RootSurface): void {\n this.alive.delete(surface.id)\n this.surfaces.delete(surface.id)\n this.resizeHandlers.get(surface.id)?.cancel()\n this.resizeHandlers.delete(surface.id)\n this.destroyHandlers.get(surface.id)?.cancel()\n this.destroyHandlers.delete(surface.id)\n\n if (this.surfaces.size === 0) {\n delete viewportRegistry.viewport\n }\n }\n\n /**\n * Clean up portal root container if no portal surfaces remain for its scene.\n */\n private cleanupPortalRootIfEmpty(surface: RootSurface): void {\n const scene = surface.context.raw as Phaser.Scene\n const hasPortalSurfaces = Array.from(this.surfaces.values()).some(\n (s) => s.id !== surface.id && s.kind === 'portal' && s.context.raw === scene\n )\n if (!hasPortalSurfaces) {\n const root = this.portalRoots.get(scene)\n if (root) {\n root.destroy()\n this.portalRoots.delete(scene)\n }\n }\n }\n\n private resolvePortalHitArea(\n container: Phaser.GameObjects.Container\n ): Phaser.Geom.Rectangle | null {\n const children = this.getPortalChildren(container)\n if (children.length === 0) return null\n\n let minX = Infinity\n let minY = Infinity\n let maxX = -Infinity\n let maxY = -Infinity\n\n for (const child of children) {\n if (!this.isBoundsProvider(child)) continue\n const bounds = child.getBounds()\n if (bounds.width <= 0 || bounds.height <= 0) continue\n minX = Math.min(minX, bounds.x)\n minY = Math.min(minY, bounds.y)\n maxX = Math.max(maxX, bounds.x + bounds.width)\n maxY = Math.max(maxY, bounds.y + bounds.height)\n }\n\n if (!Number.isFinite(minX) || !Number.isFinite(minY)) {\n return null\n }\n\n const matrix = container.getWorldTransformMatrix().invert()\n const topLeft = matrix.transformPoint(minX, minY)\n const bottomRight = matrix.transformPoint(maxX, maxY)\n\n return new Phaser.Geom.Rectangle(\n Math.min(topLeft.x, bottomRight.x),\n Math.min(topLeft.y, bottomRight.y),\n Math.abs(bottomRight.x - topLeft.x),\n Math.abs(bottomRight.y - topLeft.y)\n )\n }\n\n private getPortalChildren(\n container: Phaser.GameObjects.Container\n ): Phaser.GameObjects.GameObject[] {\n const directChildren = Array.isArray(container.list)\n ? container.list\n : (container.getAll?.() ?? [])\n return directChildren.filter(\n (child): child is Phaser.GameObjects.GameObject =>\n !!child && typeof child === 'object' && 'active' in child\n )\n }\n\n private isBoundsProvider(\n child: Phaser.GameObjects.GameObject\n ): child is Phaser.GameObjects.GameObject & {\n getBounds(): { x: number; y: number; width: number; height: number }\n } {\n return typeof (child as { getBounds?: unknown }).getBounds === 'function'\n }\n}\n"],"names":[],"mappings":";;;;AAuCA,MAAM,gBAAyC;AAAA,EAC7C,YAA6B,OAAqB;AAArB,SAAA,QAAA;AAAA,EAAsB;AAAA,EAAtB;AAAA,EAE7B,sBAAsB,UAAkD;AAEtE,UAAM,UAAU,CAAC,OAAe,UAAkB,SAAS,KAAK;AACh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AAU,IAAI,IAC/C,UAAU,OACT,UAAU,SAAA,KAAc,CAAA;AAC7B,WAAO,eAAe;AAAA,MACpB,CAAC,UACC,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,YAAY;AAAA,IAAA;AAAA,EAE1D;AAAA,EAEQ,iBACN,OAGA;AACA,WAAO,OAAQ,MAAkC,cAAc;AAAA,EACjE;AACF;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vdom = require("@number10/jsx-core/vdom");
|
|
4
|
+
const SceneWrapper = require("./components/internal/SceneWrapper.cjs");
|
|
5
|
+
const phaserBridges = require("./phaser-bridges.cjs");
|
|
6
|
+
const phaserHostAdapter$1 = require("./phaser-host-adapter.cjs");
|
|
7
|
+
const phaserSurfaceAdapter$1 = require("./phaser-surface-adapter.cjs");
|
|
8
|
+
const renderContext = require("./render-context.cjs");
|
|
9
|
+
const theme = require("./theme.cjs");
|
|
10
|
+
const jsxCore = require("@number10/jsx-core");
|
|
11
|
+
function wrapRootVNode(type, props) {
|
|
12
|
+
const { width, height, disableAutoSize = false, key: _key, ...componentProps } = props;
|
|
13
|
+
if (disableAutoSize) {
|
|
14
|
+
return {
|
|
15
|
+
type,
|
|
16
|
+
props: { ...componentProps, width, height },
|
|
17
|
+
children: []
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const componentVNode = {
|
|
21
|
+
type,
|
|
22
|
+
props: { ...componentProps, width, height },
|
|
23
|
+
children: []
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
type: SceneWrapper.SceneWrapper,
|
|
27
|
+
props: { width, height, children: componentVNode },
|
|
28
|
+
children: [],
|
|
29
|
+
__theme: theme.themeRegistry.getGlobalTheme()
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const phaserHostAdapter = new phaserHostAdapter$1.PhaserHostAdapter();
|
|
33
|
+
const phaserSurfaceAdapter = new phaserSurfaceAdapter$1.PhaserSurfaceAdapter();
|
|
34
|
+
const phaserVDOMRuntime = vdom.createVDOMRuntime(
|
|
35
|
+
{
|
|
36
|
+
hostAdapter: phaserHostAdapter,
|
|
37
|
+
surfaceAdapter: phaserSurfaceAdapter
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
createDummyNode: phaserBridges.createDummyNode,
|
|
41
|
+
getHostContext: phaserBridges.deriveHostContext,
|
|
42
|
+
resolveProps: (type, theme$1, props) => theme.getThemedProps(type, theme$1, props),
|
|
43
|
+
attachSurfaceContext: phaserBridges.attachSurfaceContext,
|
|
44
|
+
getParentContentSize: phaserBridges.getParentContentSize,
|
|
45
|
+
afterLayout: (container, parent) => {
|
|
46
|
+
const renderContext$1 = renderContext.getRenderContext(parent);
|
|
47
|
+
renderContext$1.deferLayout(() => phaserBridges.updateGestureHitAreaAfterLayout(container));
|
|
48
|
+
},
|
|
49
|
+
wrapRootVNode,
|
|
50
|
+
extractSurfaceTarget: (parent) => phaserBridges.extractScene(parent) ?? parent,
|
|
51
|
+
isSurfaceTarget: phaserBridges.isSceneTarget
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
phaserSurfaceAdapter.setVDOM({
|
|
55
|
+
mount: phaserVDOMRuntime.mount,
|
|
56
|
+
patchVNode: phaserVDOMRuntime.patchVNode,
|
|
57
|
+
unmount: phaserVDOMRuntime.unmount
|
|
58
|
+
});
|
|
59
|
+
jsxCore.setThemeRemountHandler(() => {
|
|
60
|
+
phaserVDOMRuntime.remountAll();
|
|
61
|
+
});
|
|
62
|
+
exports.phaserVDOMRuntime = phaserVDOMRuntime;
|
|
63
|
+
//# sourceMappingURL=phaser-vdom-runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaser-vdom-runtime.cjs","sources":["../src/phaser-vdom-runtime.ts"],"sourcesContent":["import type {\n LayoutContainer,\n MountProps,\n Props,\n SurfaceTarget,\n VDOMOperations,\n VNode,\n VNodeLike,\n} from '@number10/jsx-core'\nimport { createVDOMRuntime } from '@number10/jsx-core/vdom'\nimport { SceneWrapper } from './components/internal/SceneWrapper'\nimport type { NodeType } from './core-types'\nimport {\n attachSurfaceContext,\n createDummyNode,\n deriveHostContext,\n extractScene,\n getParentContentSize,\n isSceneTarget,\n updateGestureHitAreaAfterLayout,\n} from './phaser-bridges'\nimport { PhaserHostAdapter } from './phaser-host-adapter'\nimport { PhaserSurfaceAdapter } from './phaser-surface-adapter'\nimport { getRenderContext } from './render-context'\nimport { getThemedProps, setThemeRemountHandler, themeRegistry } from './theme'\nimport type { PhaserPartialTheme } from './theme-base'\nimport type { ParentType } from './types'\n\nfunction wrapRootVNode(\n type: NodeType | ((props: unknown) => VNodeLike),\n props: MountProps & Record<string, unknown>\n): VNode {\n const { width, height, disableAutoSize = false, key: _key, ...componentProps } = props\n\n if (disableAutoSize) {\n return {\n type,\n props: { ...componentProps, width, height },\n children: [],\n }\n }\n\n const componentVNode: VNode = {\n type,\n props: { ...componentProps, width, height },\n children: [],\n }\n\n return {\n type: SceneWrapper,\n props: { width, height, children: componentVNode },\n children: [],\n __theme: themeRegistry.getGlobalTheme() as Record<string, unknown>,\n }\n}\n\nconst phaserHostAdapter = new PhaserHostAdapter()\nconst phaserSurfaceAdapter = new PhaserSurfaceAdapter()\n\nexport const phaserVDOMRuntime = createVDOMRuntime(\n {\n hostAdapter: phaserHostAdapter,\n surfaceAdapter: phaserSurfaceAdapter,\n },\n {\n createDummyNode,\n getHostContext: deriveHostContext,\n resolveProps: (type: string, theme: PhaserPartialTheme | undefined, props: Props) =>\n getThemedProps(type as never, theme as never, props as never),\n attachSurfaceContext,\n getParentContentSize,\n afterLayout: (container: LayoutContainer, parent: unknown) => {\n const renderContext = getRenderContext(parent as ParentType)\n renderContext.deferLayout(() => updateGestureHitAreaAfterLayout(container))\n },\n wrapRootVNode,\n extractSurfaceTarget: (parent: unknown) => (extractScene(parent) ?? parent) as SurfaceTarget,\n isSurfaceTarget: isSceneTarget,\n }\n)\n\n// Register Phaser's VDOM operations on the adapter for portable components\nphaserSurfaceAdapter.setVDOM({\n mount: phaserVDOMRuntime.mount as VDOMOperations['mount'],\n patchVNode: phaserVDOMRuntime.patchVNode as VDOMOperations['patchVNode'],\n unmount: phaserVDOMRuntime.unmount as VDOMOperations['unmount'],\n})\n\nsetThemeRemountHandler(() => {\n phaserVDOMRuntime.remountAll()\n})\n"],"names":["SceneWrapper","themeRegistry","PhaserHostAdapter","PhaserSurfaceAdapter","createVDOMRuntime","createDummyNode","deriveHostContext","theme","getThemedProps","attachSurfaceContext","getParentContentSize","renderContext","getRenderContext","updateGestureHitAreaAfterLayout","extractScene","isSceneTarget","setThemeRemountHandler"],"mappings":";;;;;;;;;;AA4BA,SAAS,cACP,MACA,OACO;AACP,QAAM,EAAE,OAAO,QAAQ,kBAAkB,OAAO,KAAK,MAAM,GAAG,eAAA,IAAmB;AAEjF,MAAI,iBAAiB;AACnB,WAAO;AAAA,MACL;AAAA,MACA,OAAO,EAAE,GAAG,gBAAgB,OAAO,OAAA;AAAA,MACnC,UAAU,CAAA;AAAA,IAAC;AAAA,EAEf;AAEA,QAAM,iBAAwB;AAAA,IAC5B;AAAA,IACA,OAAO,EAAE,GAAG,gBAAgB,OAAO,OAAA;AAAA,IACnC,UAAU,CAAA;AAAA,EAAC;AAGb,SAAO;AAAA,IACL,MAAMA,aAAAA;AAAAA,IACN,OAAO,EAAE,OAAO,QAAQ,UAAU,eAAA;AAAA,IAClC,UAAU,CAAA;AAAA,IACV,SAASC,MAAAA,cAAc,eAAA;AAAA,EAAe;AAE1C;AAEA,MAAM,oBAAoB,IAAIC,oBAAAA,kBAAA;AAC9B,MAAM,uBAAuB,IAAIC,uBAAAA,qBAAA;AAE1B,MAAM,oBAAoBC,KAAAA;AAAAA,EAC/B;AAAA,IACE,aAAa;AAAA,IACb,gBAAgB;AAAA,EAAA;AAAA,EAElB;AAAA,IAAA,iBACEC,cAAAA;AAAAA,IACA,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