@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,68 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { getGestureManager } from "../../gestures/gesture-manager.js";
|
|
3
|
+
function applyGesturesProps(scene, container, prev, next) {
|
|
4
|
+
if (!scene || !scene.sys || !scene.data) {
|
|
5
|
+
console.warn("applyGesturesProps: Invalid scene or scene not initialized");
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (scene.sys.game === null) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const hasAnyGesture = !!(next.onTouch || next.onTouchOutside || next.onTouchMove || next.onDoubleTap || next.onLongPress || next.onHoverStart || next.onHoverEnd || next.onWheel);
|
|
12
|
+
const hadAnyGesture = !!(prev.onTouch || prev.onTouchOutside || prev.onTouchMove || prev.onDoubleTap || prev.onLongPress || prev.onHoverStart || prev.onHoverEnd || prev.onWheel);
|
|
13
|
+
const prevEnabled = hadAnyGesture && prev.enableGestures !== false;
|
|
14
|
+
const nextEnabled = hasAnyGesture && next.enableGestures !== false;
|
|
15
|
+
const manager = getGestureManager(scene);
|
|
16
|
+
if (!prevEnabled && nextEnabled && hasAnyGesture) {
|
|
17
|
+
const containerWithLayout = container;
|
|
18
|
+
const { width, height } = containerWithLayout.__getLayoutSize ? containerWithLayout.__getLayoutSize() : (() => {
|
|
19
|
+
const bounds = container.getBounds();
|
|
20
|
+
return { width: bounds.width || 100, height: bounds.height || 100 };
|
|
21
|
+
})();
|
|
22
|
+
const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height);
|
|
23
|
+
const callbacks = {};
|
|
24
|
+
if (next.onTouch) callbacks.onTouch = next.onTouch;
|
|
25
|
+
if (next.onTouchOutside) callbacks.onTouchOutside = next.onTouchOutside;
|
|
26
|
+
if (next.onTouchMove) callbacks.onTouchMove = next.onTouchMove;
|
|
27
|
+
if (next.onDoubleTap) callbacks.onDoubleTap = next.onDoubleTap;
|
|
28
|
+
if (next.onLongPress) callbacks.onLongPress = next.onLongPress;
|
|
29
|
+
if (next.onHoverStart) callbacks.onHoverStart = next.onHoverStart;
|
|
30
|
+
if (next.onHoverEnd) callbacks.onHoverEnd = next.onHoverEnd;
|
|
31
|
+
if (next.onWheel) callbacks.onWheel = next.onWheel;
|
|
32
|
+
const config = {};
|
|
33
|
+
if (next.longPressDuration !== void 0) config.longPressDuration = next.longPressDuration;
|
|
34
|
+
if (next.doubleTapDelay !== void 0) config.doubleTapDelay = next.doubleTapDelay;
|
|
35
|
+
manager.registerContainer(container, callbacks, hitArea, config);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (prevEnabled && (!nextEnabled || !hasAnyGesture)) {
|
|
39
|
+
manager.unregisterContainer(container);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (nextEnabled && hasAnyGesture) {
|
|
43
|
+
const callbacksChanged = prev.onTouch !== next.onTouch || prev.onTouchOutside !== next.onTouchOutside || prev.onTouchMove !== next.onTouchMove || prev.onDoubleTap !== next.onDoubleTap || prev.onLongPress !== next.onLongPress || prev.onHoverStart !== next.onHoverStart || prev.onHoverEnd !== next.onHoverEnd || prev.onWheel !== next.onWheel;
|
|
44
|
+
if (callbacksChanged) {
|
|
45
|
+
const callbacks = {};
|
|
46
|
+
if (next.onTouch) callbacks.onTouch = next.onTouch;
|
|
47
|
+
if (next.onTouchOutside) callbacks.onTouchOutside = next.onTouchOutside;
|
|
48
|
+
if (next.onTouchMove) callbacks.onTouchMove = next.onTouchMove;
|
|
49
|
+
if (next.onDoubleTap) callbacks.onDoubleTap = next.onDoubleTap;
|
|
50
|
+
if (next.onLongPress) callbacks.onLongPress = next.onLongPress;
|
|
51
|
+
if (next.onHoverStart) callbacks.onHoverStart = next.onHoverStart;
|
|
52
|
+
if (next.onHoverEnd) callbacks.onHoverEnd = next.onHoverEnd;
|
|
53
|
+
if (next.onWheel) callbacks.onWheel = next.onWheel;
|
|
54
|
+
manager.updateCallbacks(container, callbacks);
|
|
55
|
+
}
|
|
56
|
+
const containerWithLayout = container;
|
|
57
|
+
const { width, height } = containerWithLayout.__getLayoutSize ? containerWithLayout.__getLayoutSize() : (() => {
|
|
58
|
+
const bounds = container.getBounds();
|
|
59
|
+
return { width: bounds.width || 100, height: bounds.height || 100 };
|
|
60
|
+
})();
|
|
61
|
+
const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height);
|
|
62
|
+
manager.updateHitArea(container, hitArea);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
applyGesturesProps
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=applyGestures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyGestures.js","sources":["../../../src/components/appliers/applyGestures.ts"],"sourcesContent":["/**\n * Gesture property appliers for component patching\n * Updates gesture registration when props change\n */\nimport type { LayoutSize } from '@number10/jsx-core'\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"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function shallowEqual(a, b) {
|
|
4
|
+
if (!a || !b) return a === b;
|
|
5
|
+
if (a.length !== b.length) return false;
|
|
6
|
+
return a.every((val, i) => val === b[i]);
|
|
7
|
+
}
|
|
8
|
+
function applyGraphicsProps(node, _prev, next) {
|
|
9
|
+
const prevDeps = node.__drawDependencies;
|
|
10
|
+
const nextDeps = next.dependencies;
|
|
11
|
+
const depsChanged = !shallowEqual(prevDeps, nextDeps);
|
|
12
|
+
if (depsChanged && next.onDraw) {
|
|
13
|
+
if (next.autoClear !== false) {
|
|
14
|
+
node.clear();
|
|
15
|
+
}
|
|
16
|
+
next.onDraw(node, next);
|
|
17
|
+
node.__drawDependencies = nextDeps;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.applyGraphicsProps = applyGraphicsProps;
|
|
21
|
+
//# sourceMappingURL=applyGraphics.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyGraphics.cjs","sources":["../../../src/components/appliers/applyGraphics.ts"],"sourcesContent":["/**\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"],"names":[],"mappings":";;AAqBA,SAAS,aAAa,GAAe,GAAwB;AAC3D,MAAI,CAAC,KAAK,CAAC,UAAU,MAAM;AAC3B,MAAI,EAAE,WAAW,EAAE,OAAQ,QAAO;AAClC,SAAO,EAAE,MAAM,CAAC,KAAK,MAAM,QAAQ,EAAE,CAAC,CAAC;AACzC;AAQO,SAAS,mBACd,MACA,OACA,MACM;AAEN,QAAM,WAAY,KAA8B;AAChD,QAAM,WAAW,KAAK;AACtB,QAAM,cAAc,CAAC,aAAa,UAAU,QAAQ;AAGpD,MAAI,eAAe,KAAK,QAAQ;AAE9B,QAAI,KAAK,cAAc,OAAO;AAC5B,WAAK,MAAA;AAAA,IACP;AAGA,SAAK,OAAO,MAAM,IAAI;AAGpB,SAA8B,qBAAqB;AAAA,EACvD;AACF;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphicsBaseProps } from '../primitives/graphics';
|
|
2
|
+
/**
|
|
3
|
+
* Graphics-specific property appliers
|
|
4
|
+
*/
|
|
5
|
+
import type * as Phaser from 'phaser';
|
|
6
|
+
/**
|
|
7
|
+
* Apply Graphics-specific props (onDraw, autoClear, dependencies)
|
|
8
|
+
* @param node - Graphics node
|
|
9
|
+
* @param _prev - Previous props (unused, dependencies stored on node)
|
|
10
|
+
* @param next - New props
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyGraphicsProps(node: Phaser.GameObjects.Graphics, _prev: Partial<GraphicsBaseProps>, next: Partial<GraphicsBaseProps>): void;
|
|
13
|
+
//# sourceMappingURL=applyGraphics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyGraphics.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyGraphics.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAsB/D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EACjC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,EACjC,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAC/B,IAAI,CAmBN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function shallowEqual(a, b) {
|
|
2
|
+
if (!a || !b) return a === b;
|
|
3
|
+
if (a.length !== b.length) return false;
|
|
4
|
+
return a.every((val, i) => val === b[i]);
|
|
5
|
+
}
|
|
6
|
+
function applyGraphicsProps(node, _prev, next) {
|
|
7
|
+
const prevDeps = node.__drawDependencies;
|
|
8
|
+
const nextDeps = next.dependencies;
|
|
9
|
+
const depsChanged = !shallowEqual(prevDeps, nextDeps);
|
|
10
|
+
if (depsChanged && next.onDraw) {
|
|
11
|
+
if (next.autoClear !== false) {
|
|
12
|
+
node.clear();
|
|
13
|
+
}
|
|
14
|
+
next.onDraw(node, next);
|
|
15
|
+
node.__drawDependencies = nextDeps;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
applyGraphicsProps
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=applyGraphics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyGraphics.js","sources":["../../../src/components/appliers/applyGraphics.ts"],"sourcesContent":["/**\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"],"names":[],"mappings":"AAqBA,SAAS,aAAa,GAAe,GAAwB;AAC3D,MAAI,CAAC,KAAK,CAAC,UAAU,MAAM;AAC3B,MAAI,EAAE,WAAW,EAAE,OAAQ,QAAO;AAClC,SAAO,EAAE,MAAM,CAAC,KAAK,MAAM,QAAQ,EAAE,CAAC,CAAC;AACzC;AAQO,SAAS,mBACd,MACA,OACA,MACM;AAEN,QAAM,WAAY,KAA8B;AAChD,QAAM,WAAW,KAAK;AACtB,QAAM,cAAc,CAAC,aAAa,UAAU,QAAQ;AAGpD,MAAI,eAAe,KAAK,QAAQ;AAE9B,QAAI,KAAK,cAAc,OAAO;AAC5B,WAAK,MAAA;AAAA,IACP;AAGA,SAAK,OAAO,MAAM,IAAI;AAGpB,SAA8B,qBAAqB;AAAA,EACvD;AACF;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function applyGraphicsLayout(node, prev, next) {
|
|
4
|
+
node.__layoutProps = next;
|
|
5
|
+
if (prev.width !== next.width || prev.height !== next.height || prev.headless !== next.headless) {
|
|
6
|
+
node.__getLayoutSize = () => {
|
|
7
|
+
if (next.headless ?? true) {
|
|
8
|
+
return { width: 0.01, height: 0.01 };
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
width: typeof next.width === "number" ? next.width : 0,
|
|
12
|
+
height: typeof next.height === "number" ? next.height : 0
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.applyGraphicsLayout = applyGraphicsLayout;
|
|
18
|
+
//# sourceMappingURL=applyGraphicsLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyGraphicsLayout.cjs","sources":["../../../src/components/appliers/applyGraphicsLayout.ts"],"sourcesContent":["/**\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"],"names":[],"mappings":";;AAaO,SAAS,oBACd,MACA,MACA,MACM;AAEJ,OAA8B,gBAAgB;AAGhD,MAAI,KAAK,UAAU,KAAK,SAAS,KAAK,WAAW,KAAK,UAAU,KAAK,aAAa,KAAK,UAAU;AAC7F,SAA8B,kBAAkB,MAAM;AACtD,UAAI,KAAK,YAAY,MAAM;AACzB,eAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,MAChC;AACA,aAAO;AAAA,QACL,OAAO,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ;AAAA,QACrD,QAAQ,OAAO,KAAK,WAAW,WAAW,KAAK,SAAS;AAAA,MAAA;AAAA,IAE5D;AAAA,EACF;AACF;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphicsBaseProps } from '../primitives/graphics';
|
|
2
|
+
/**
|
|
3
|
+
* Graphics layout property appliers
|
|
4
|
+
*/
|
|
5
|
+
import type * as Phaser from 'phaser';
|
|
6
|
+
/**
|
|
7
|
+
* Apply layout updates for Graphics (width/height changes)
|
|
8
|
+
* @param node - Graphics node
|
|
9
|
+
* @param prev - Previous props
|
|
10
|
+
* @param next - New props
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyGraphicsLayout(node: Phaser.GameObjects.Graphics, prev: Partial<GraphicsBaseProps>, next: Partial<GraphicsBaseProps>): void;
|
|
13
|
+
//# sourceMappingURL=applyGraphicsLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyGraphicsLayout.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyGraphicsLayout.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EACjC,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAChC,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAC/B,IAAI,CAgBN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function applyGraphicsLayout(node, prev, next) {
|
|
2
|
+
node.__layoutProps = next;
|
|
3
|
+
if (prev.width !== next.width || prev.height !== next.height || prev.headless !== next.headless) {
|
|
4
|
+
node.__getLayoutSize = () => {
|
|
5
|
+
if (next.headless ?? true) {
|
|
6
|
+
return { width: 0.01, height: 0.01 };
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
width: typeof next.width === "number" ? next.width : 0,
|
|
10
|
+
height: typeof next.height === "number" ? next.height : 0
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
applyGraphicsLayout
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=applyGraphicsLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyGraphicsLayout.js","sources":["../../../src/components/appliers/applyGraphicsLayout.ts"],"sourcesContent":["/**\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"],"names":[],"mappings":"AAaO,SAAS,oBACd,MACA,MACA,MACM;AAEJ,OAA8B,gBAAgB;AAGhD,MAAI,KAAK,UAAU,KAAK,SAAS,KAAK,WAAW,KAAK,UAAU,KAAK,aAAa,KAAK,UAAU;AAC7F,SAA8B,kBAAkB,MAAM;AACtD,UAAI,KAAK,YAAY,MAAM;AACzB,eAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,MAChC;AACA,aAAO;AAAA,QACL,OAAO,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ;AAAA,QACrD,QAAQ,OAAO,KAAK,WAAW,WAAW,KAAK,SAAS;AAAA,MAAA;AAAA,IAE5D;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const imageSubtextureRegistry = require("../../utils/image-subtexture-registry.cjs");
|
|
4
|
+
function getImageSourceDimensions(image, sourceRect) {
|
|
5
|
+
if (sourceRect) {
|
|
6
|
+
return {
|
|
7
|
+
width: Math.max(0, sourceRect.w),
|
|
8
|
+
height: Math.max(0, sourceRect.h)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
width: image.frame.width,
|
|
13
|
+
height: image.frame.height
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function calculateImageFitScale(image, targetWidth, targetHeight, fit = "fill", sourceRect) {
|
|
17
|
+
const { width: textureWidth, height: textureHeight } = getImageSourceDimensions(image, sourceRect);
|
|
18
|
+
if (textureWidth === 0 || textureHeight === 0) {
|
|
19
|
+
return { scaleX: 1, scaleY: 1 };
|
|
20
|
+
}
|
|
21
|
+
if (fit === "fill") {
|
|
22
|
+
return {
|
|
23
|
+
scaleX: targetWidth / textureWidth,
|
|
24
|
+
scaleY: targetHeight / textureHeight
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const targetAspect = targetWidth / targetHeight;
|
|
28
|
+
const textureAspect = textureWidth / textureHeight;
|
|
29
|
+
if (fit === "contain") {
|
|
30
|
+
const scale = targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
31
|
+
return { scaleX: scale, scaleY: scale };
|
|
32
|
+
}
|
|
33
|
+
if (fit === "cover") {
|
|
34
|
+
const scale = targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
35
|
+
return { scaleX: scale, scaleY: scale };
|
|
36
|
+
}
|
|
37
|
+
return { scaleX: 1, scaleY: 1 };
|
|
38
|
+
}
|
|
39
|
+
function applyImageProps(image, prev, next) {
|
|
40
|
+
const derivedImage = image;
|
|
41
|
+
const prevSR = prev.sourceRect;
|
|
42
|
+
const nextSR = next.sourceRect;
|
|
43
|
+
const sourceRectChanged = prevSR?.x !== nextSR?.x || prevSR?.y !== nextSR?.y || prevSR?.w !== nextSR?.w || prevSR?.h !== nextSR?.h;
|
|
44
|
+
const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame;
|
|
45
|
+
if ((textureChanged || sourceRectChanged) && next.texture) {
|
|
46
|
+
const nextSource = imageSubtextureRegistry.retainImageSubTexture(image.scene, next.texture, next.frame, nextSR);
|
|
47
|
+
image.setTexture(nextSource.texture, nextSource.frame);
|
|
48
|
+
imageSubtextureRegistry.releaseImageSubTexture(image.scene, derivedImage.__subTextureCacheKey);
|
|
49
|
+
derivedImage.__subTextureCacheKey = nextSource.cacheKey;
|
|
50
|
+
}
|
|
51
|
+
if (prev.tint !== next.tint) {
|
|
52
|
+
if (typeof next.tint === "number") {
|
|
53
|
+
image.setTint(next.tint);
|
|
54
|
+
} else {
|
|
55
|
+
image.clearTint();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (prev.originX !== next.originX || prev.originY !== next.originY) {
|
|
59
|
+
const originX = next.originX ?? image.originX;
|
|
60
|
+
const originY = next.originY ?? image.originY;
|
|
61
|
+
image.setOrigin(originX, originY);
|
|
62
|
+
}
|
|
63
|
+
const displayWidthChanged = prev.displayWidth !== next.displayWidth;
|
|
64
|
+
const displayHeightChanged = prev.displayHeight !== next.displayHeight;
|
|
65
|
+
const fitChanged = prev.fit !== next.fit;
|
|
66
|
+
if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged || sourceRectChanged) {
|
|
67
|
+
if (typeof next.displayWidth === "number" && typeof next.displayHeight === "number") {
|
|
68
|
+
const { scaleX, scaleY } = calculateImageFitScale(
|
|
69
|
+
image,
|
|
70
|
+
next.displayWidth,
|
|
71
|
+
next.displayHeight,
|
|
72
|
+
next.fit,
|
|
73
|
+
nextSR
|
|
74
|
+
);
|
|
75
|
+
image.setScale(scaleX, scaleY);
|
|
76
|
+
} else if (typeof next.displayWidth === "number") {
|
|
77
|
+
const { width } = getImageSourceDimensions(image, nextSR);
|
|
78
|
+
const scale = width > 0 ? next.displayWidth / width : 1;
|
|
79
|
+
image.setScale(scale);
|
|
80
|
+
} else if (typeof next.displayHeight === "number") {
|
|
81
|
+
const { height } = getImageSourceDimensions(image, nextSR);
|
|
82
|
+
const scale = height > 0 ? next.displayHeight / height : 1;
|
|
83
|
+
image.setScale(scale, scale);
|
|
84
|
+
} else {
|
|
85
|
+
image.setScale(1, 1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.applyImageProps = applyImageProps;
|
|
90
|
+
exports.calculateImageFitScale = calculateImageFitScale;
|
|
91
|
+
exports.getImageSourceDimensions = getImageSourceDimensions;
|
|
92
|
+
//# sourceMappingURL=applyImage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyImage.cjs","sources":["../../../src/components/appliers/applyImage.ts"],"sourcesContent":["/**\n * Applier for Image-specific properties\n */\nimport type * as Phaser from 'phaser'\nimport {\n releaseImageSubTexture,\n retainImageSubTexture,\n} from '../../utils/image-subtexture-registry'\nimport type { ImageBaseProps } from '../primitives/image'\n\ntype DerivedTextureImage = Phaser.GameObjects.Image & {\n __subTextureCacheKey?: string | undefined\n}\n\n/**\n * Gets the effective source dimensions for scaling.\n * Cropped images must scale against the crop size, not the full frame size.\n * @param image - Phaser Image object\n * @param sourceRect - Optional crop rectangle relative to the frame origin\n * @returns Original source width and height\n */\nexport function getImageSourceDimensions(\n image: Phaser.GameObjects.Image,\n sourceRect?: { x: number; y: number; w: number; h: number }\n): { width: number; height: number } {\n if (sourceRect) {\n return {\n width: Math.max(0, sourceRect.w),\n height: Math.max(0, sourceRect.h),\n }\n }\n\n return {\n width: image.frame.width,\n height: image.frame.height,\n }\n}\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 * @param sourceRect - Optional crop rectangle relative to the frame origin\n * @returns Scale factors for x and y\n */\nexport function calculateImageFitScale(\n image: Phaser.GameObjects.Image,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill',\n sourceRect?: { x: number; y: number; w: number; h: number }\n): { scaleX: number; scaleY: number } {\n const { width: textureWidth, height: textureHeight } = getImageSourceDimensions(image, sourceRect)\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 const derivedImage = image as DerivedTextureImage\n const prevSR = prev.sourceRect\n const nextSR = next.sourceRect\n const sourceRectChanged =\n prevSR?.x !== nextSR?.x ||\n prevSR?.y !== nextSR?.y ||\n prevSR?.w !== nextSR?.w ||\n prevSR?.h !== nextSR?.h\n\n // Check if the underlying source changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if ((textureChanged || sourceRectChanged) && next.texture) {\n const nextSource = retainImageSubTexture(image.scene, next.texture, next.frame, nextSR)\n image.setTexture(nextSource.texture, nextSource.frame)\n releaseImageSubTexture(image.scene, derivedImage.__subTextureCacheKey)\n derivedImage.__subTextureCacheKey = nextSource.cacheKey\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 (\n displayWidthChanged ||\n displayHeightChanged ||\n fitChanged ||\n textureChanged ||\n sourceRectChanged\n ) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n const { scaleX, scaleY } = calculateImageFitScale(\n image,\n next.displayWidth,\n next.displayHeight,\n next.fit,\n nextSR\n )\n image.setScale(scaleX, scaleY)\n } else if (typeof next.displayWidth === 'number') {\n // Only width specified - preserve aspect ratio\n const { width } = getImageSourceDimensions(image, nextSR)\n const scale = width > 0 ? next.displayWidth / width : 1\n image.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height specified - preserve aspect ratio\n const { height } = getImageSourceDimensions(image, nextSR)\n const scale = height > 0 ? next.displayHeight / height : 1\n image.setScale(scale, scale)\n } else {\n image.setScale(1, 1)\n }\n }\n}\n"],"names":["retainImageSubTexture","releaseImageSubTexture"],"mappings":"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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ImageBaseProps } from '../primitives/image';
|
|
2
|
+
/**
|
|
3
|
+
* Applier for Image-specific properties
|
|
4
|
+
*/
|
|
5
|
+
import type * as Phaser from 'phaser';
|
|
6
|
+
/**
|
|
7
|
+
* Gets the effective source dimensions for scaling.
|
|
8
|
+
* Cropped images must scale against the crop size, not the full frame size.
|
|
9
|
+
* @param image - Phaser Image object
|
|
10
|
+
* @param sourceRect - Optional crop rectangle relative to the frame origin
|
|
11
|
+
* @returns Original source width and height
|
|
12
|
+
*/
|
|
13
|
+
export declare function getImageSourceDimensions(image: Phaser.GameObjects.Image, sourceRect?: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
w: number;
|
|
17
|
+
h: number;
|
|
18
|
+
}): {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Calculates scale factors for fit modes
|
|
24
|
+
* @param image - Phaser Image object
|
|
25
|
+
* @param targetWidth - Desired width
|
|
26
|
+
* @param targetHeight - Desired height
|
|
27
|
+
* @param fit - Fit mode
|
|
28
|
+
* @param sourceRect - Optional crop rectangle relative to the frame origin
|
|
29
|
+
* @returns Scale factors for x and y
|
|
30
|
+
*/
|
|
31
|
+
export declare function calculateImageFitScale(image: Phaser.GameObjects.Image, targetWidth: number, targetHeight: number, fit?: 'fill' | 'contain' | 'cover', sourceRect?: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
w: number;
|
|
35
|
+
h: number;
|
|
36
|
+
}): {
|
|
37
|
+
scaleX: number;
|
|
38
|
+
scaleY: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Applies Image-specific properties (texture, frame, tint, displaySize, fit)
|
|
42
|
+
* @param image - Phaser Image object
|
|
43
|
+
* @param prev - Previous props
|
|
44
|
+
* @param next - New props
|
|
45
|
+
*/
|
|
46
|
+
export declare function applyImageProps(image: Phaser.GameObjects.Image, prev: Partial<ImageBaseProps>, next: Partial<ImageBaseProps>): void;
|
|
47
|
+
//# sourceMappingURL=applyImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyImage.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyImage.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AAKrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAMzD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,EAC/B,UAAU,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAYnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,EAC/B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,GAAG,GAAE,MAAM,GAAG,SAAS,GAAG,OAAgB,EAC1C,UAAU,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAiCpC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,EAC/B,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,EAC7B,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,GAC5B,IAAI,CAsEN"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { retainImageSubTexture, releaseImageSubTexture } from "../../utils/image-subtexture-registry.js";
|
|
2
|
+
function getImageSourceDimensions(image, sourceRect) {
|
|
3
|
+
if (sourceRect) {
|
|
4
|
+
return {
|
|
5
|
+
width: Math.max(0, sourceRect.w),
|
|
6
|
+
height: Math.max(0, sourceRect.h)
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
width: image.frame.width,
|
|
11
|
+
height: image.frame.height
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function calculateImageFitScale(image, targetWidth, targetHeight, fit = "fill", sourceRect) {
|
|
15
|
+
const { width: textureWidth, height: textureHeight } = getImageSourceDimensions(image, sourceRect);
|
|
16
|
+
if (textureWidth === 0 || textureHeight === 0) {
|
|
17
|
+
return { scaleX: 1, scaleY: 1 };
|
|
18
|
+
}
|
|
19
|
+
if (fit === "fill") {
|
|
20
|
+
return {
|
|
21
|
+
scaleX: targetWidth / textureWidth,
|
|
22
|
+
scaleY: targetHeight / textureHeight
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const targetAspect = targetWidth / targetHeight;
|
|
26
|
+
const textureAspect = textureWidth / textureHeight;
|
|
27
|
+
if (fit === "contain") {
|
|
28
|
+
const scale = targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
29
|
+
return { scaleX: scale, scaleY: scale };
|
|
30
|
+
}
|
|
31
|
+
if (fit === "cover") {
|
|
32
|
+
const scale = targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
33
|
+
return { scaleX: scale, scaleY: scale };
|
|
34
|
+
}
|
|
35
|
+
return { scaleX: 1, scaleY: 1 };
|
|
36
|
+
}
|
|
37
|
+
function applyImageProps(image, prev, next) {
|
|
38
|
+
const derivedImage = image;
|
|
39
|
+
const prevSR = prev.sourceRect;
|
|
40
|
+
const nextSR = next.sourceRect;
|
|
41
|
+
const sourceRectChanged = prevSR?.x !== nextSR?.x || prevSR?.y !== nextSR?.y || prevSR?.w !== nextSR?.w || prevSR?.h !== nextSR?.h;
|
|
42
|
+
const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame;
|
|
43
|
+
if ((textureChanged || sourceRectChanged) && next.texture) {
|
|
44
|
+
const nextSource = retainImageSubTexture(image.scene, next.texture, next.frame, nextSR);
|
|
45
|
+
image.setTexture(nextSource.texture, nextSource.frame);
|
|
46
|
+
releaseImageSubTexture(image.scene, derivedImage.__subTextureCacheKey);
|
|
47
|
+
derivedImage.__subTextureCacheKey = nextSource.cacheKey;
|
|
48
|
+
}
|
|
49
|
+
if (prev.tint !== next.tint) {
|
|
50
|
+
if (typeof next.tint === "number") {
|
|
51
|
+
image.setTint(next.tint);
|
|
52
|
+
} else {
|
|
53
|
+
image.clearTint();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (prev.originX !== next.originX || prev.originY !== next.originY) {
|
|
57
|
+
const originX = next.originX ?? image.originX;
|
|
58
|
+
const originY = next.originY ?? image.originY;
|
|
59
|
+
image.setOrigin(originX, originY);
|
|
60
|
+
}
|
|
61
|
+
const displayWidthChanged = prev.displayWidth !== next.displayWidth;
|
|
62
|
+
const displayHeightChanged = prev.displayHeight !== next.displayHeight;
|
|
63
|
+
const fitChanged = prev.fit !== next.fit;
|
|
64
|
+
if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged || sourceRectChanged) {
|
|
65
|
+
if (typeof next.displayWidth === "number" && typeof next.displayHeight === "number") {
|
|
66
|
+
const { scaleX, scaleY } = calculateImageFitScale(
|
|
67
|
+
image,
|
|
68
|
+
next.displayWidth,
|
|
69
|
+
next.displayHeight,
|
|
70
|
+
next.fit,
|
|
71
|
+
nextSR
|
|
72
|
+
);
|
|
73
|
+
image.setScale(scaleX, scaleY);
|
|
74
|
+
} else if (typeof next.displayWidth === "number") {
|
|
75
|
+
const { width } = getImageSourceDimensions(image, nextSR);
|
|
76
|
+
const scale = width > 0 ? next.displayWidth / width : 1;
|
|
77
|
+
image.setScale(scale);
|
|
78
|
+
} else if (typeof next.displayHeight === "number") {
|
|
79
|
+
const { height } = getImageSourceDimensions(image, nextSR);
|
|
80
|
+
const scale = height > 0 ? next.displayHeight / height : 1;
|
|
81
|
+
image.setScale(scale, scale);
|
|
82
|
+
} else {
|
|
83
|
+
image.setScale(1, 1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
applyImageProps,
|
|
89
|
+
calculateImageFitScale,
|
|
90
|
+
getImageSourceDimensions
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=applyImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyImage.js","sources":["../../../src/components/appliers/applyImage.ts"],"sourcesContent":["/**\n * Applier for Image-specific properties\n */\nimport type * as Phaser from 'phaser'\nimport {\n releaseImageSubTexture,\n retainImageSubTexture,\n} from '../../utils/image-subtexture-registry'\nimport type { ImageBaseProps } from '../primitives/image'\n\ntype DerivedTextureImage = Phaser.GameObjects.Image & {\n __subTextureCacheKey?: string | undefined\n}\n\n/**\n * Gets the effective source dimensions for scaling.\n * Cropped images must scale against the crop size, not the full frame size.\n * @param image - Phaser Image object\n * @param sourceRect - Optional crop rectangle relative to the frame origin\n * @returns Original source width and height\n */\nexport function getImageSourceDimensions(\n image: Phaser.GameObjects.Image,\n sourceRect?: { x: number; y: number; w: number; h: number }\n): { width: number; height: number } {\n if (sourceRect) {\n return {\n width: Math.max(0, sourceRect.w),\n height: Math.max(0, sourceRect.h),\n }\n }\n\n return {\n width: image.frame.width,\n height: image.frame.height,\n }\n}\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 * @param sourceRect - Optional crop rectangle relative to the frame origin\n * @returns Scale factors for x and y\n */\nexport function calculateImageFitScale(\n image: Phaser.GameObjects.Image,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill',\n sourceRect?: { x: number; y: number; w: number; h: number }\n): { scaleX: number; scaleY: number } {\n const { width: textureWidth, height: textureHeight } = getImageSourceDimensions(image, sourceRect)\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 const derivedImage = image as DerivedTextureImage\n const prevSR = prev.sourceRect\n const nextSR = next.sourceRect\n const sourceRectChanged =\n prevSR?.x !== nextSR?.x ||\n prevSR?.y !== nextSR?.y ||\n prevSR?.w !== nextSR?.w ||\n prevSR?.h !== nextSR?.h\n\n // Check if the underlying source changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if ((textureChanged || sourceRectChanged) && next.texture) {\n const nextSource = retainImageSubTexture(image.scene, next.texture, next.frame, nextSR)\n image.setTexture(nextSource.texture, nextSource.frame)\n releaseImageSubTexture(image.scene, derivedImage.__subTextureCacheKey)\n derivedImage.__subTextureCacheKey = nextSource.cacheKey\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 (\n displayWidthChanged ||\n displayHeightChanged ||\n fitChanged ||\n textureChanged ||\n sourceRectChanged\n ) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n const { scaleX, scaleY } = calculateImageFitScale(\n image,\n next.displayWidth,\n next.displayHeight,\n next.fit,\n nextSR\n )\n image.setScale(scaleX, scaleY)\n } else if (typeof next.displayWidth === 'number') {\n // Only width specified - preserve aspect ratio\n const { width } = getImageSourceDimensions(image, nextSR)\n const scale = width > 0 ? next.displayWidth / width : 1\n image.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height specified - preserve aspect ratio\n const { height } = getImageSourceDimensions(image, nextSR)\n const scale = height > 0 ? next.displayHeight / height : 1\n image.setScale(scale, scale)\n } else {\n image.setScale(1, 1)\n }\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function applyImageLayout(image, prev, next) {
|
|
4
|
+
image.__layoutProps = next;
|
|
5
|
+
if (prev.headless !== next.headless) {
|
|
6
|
+
image.__getLayoutSize = () => {
|
|
7
|
+
if (image.__layoutProps?.headless) {
|
|
8
|
+
return { width: 0.01, height: 0.01 };
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
width: image.displayWidth,
|
|
12
|
+
height: image.displayHeight
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.applyImageLayout = applyImageLayout;
|
|
18
|
+
//# sourceMappingURL=applyImageLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyImageLayout.cjs","sources":["../../../src/components/appliers/applyImageLayout.ts"],"sourcesContent":["/**\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"],"names":[],"mappings":";;AAcO,SAAS,iBACd,OAIA,MACA,MACM;AAEN,QAAM,gBAAgB;AAGtB,MAAI,KAAK,aAAa,KAAK,UAAU;AACnC,UAAM,kBAAkB,MAAM;AAC5B,UAAI,MAAM,eAAe,UAAU;AACjC,eAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,MAChC;AACA,aAAO;AAAA,QACL,OAAO,MAAM;AAAA,QACb,QAAQ,MAAM;AAAA,MAAA;AAAA,IAElB;AAAA,EACF;AACF;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LayoutProps } from '../../core-props';
|
|
2
|
+
import { LayoutSize } from '../../layout/index';
|
|
3
|
+
import { ImageBaseProps } from '../primitives/image';
|
|
4
|
+
/**
|
|
5
|
+
* Layout applier for Image components
|
|
6
|
+
*/
|
|
7
|
+
import type * as Phaser from 'phaser';
|
|
8
|
+
/**
|
|
9
|
+
* Applies layout props and updates layout size provider
|
|
10
|
+
* @param image - Phaser Image object
|
|
11
|
+
* @param prev - Previous props
|
|
12
|
+
* @param next - New props
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyImageLayout(image: Phaser.GameObjects.Image & {
|
|
15
|
+
__layoutProps?: ImageBaseProps;
|
|
16
|
+
__getLayoutSize?: () => LayoutSize;
|
|
17
|
+
}, prev: Partial<ImageBaseProps & LayoutProps>, next: Partial<ImageBaseProps & LayoutProps>): void;
|
|
18
|
+
//# sourceMappingURL=applyImageLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyImageLayout.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyImageLayout.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,GAAG;IAChC,aAAa,CAAC,EAAE,cAAc,CAAA;IAC9B,eAAe,CAAC,EAAE,MAAM,UAAU,CAAA;CACnC,EACD,IAAI,EAAE,OAAO,CAAC,cAAc,GAAG,WAAW,CAAC,EAC3C,IAAI,EAAE,OAAO,CAAC,cAAc,GAAG,WAAW,CAAC,GAC1C,IAAI,CAgBN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function applyImageLayout(image, prev, next) {
|
|
2
|
+
image.__layoutProps = next;
|
|
3
|
+
if (prev.headless !== next.headless) {
|
|
4
|
+
image.__getLayoutSize = () => {
|
|
5
|
+
if (image.__layoutProps?.headless) {
|
|
6
|
+
return { width: 0.01, height: 0.01 };
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
width: image.displayWidth,
|
|
10
|
+
height: image.displayHeight
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
applyImageLayout
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=applyImageLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyImageLayout.js","sources":["../../../src/components/appliers/applyImageLayout.ts"],"sourcesContent":["/**\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"],"names":[],"mappings":"AAcO,SAAS,iBACd,OAIA,MACA,MACM;AAEN,QAAM,gBAAgB;AAGtB,MAAI,KAAK,aAAa,KAAK,UAAU;AACnC,UAAM,kBAAkB,MAAM;AAC5B,UAAI,MAAM,eAAe,UAAU;AACjC,eAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,MAChC;AACA,aAAO;AAAA,QACL,OAAO,MAAM;AAAA,QACb,QAAQ,MAAM;AAAA,MAAA;AAAA,IAElB;AAAA,EACF;AACF;"}
|