@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,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxCore = require("@number10/jsx-core");
|
|
4
|
+
const signalsCore = require("@preact/signals-core");
|
|
5
|
+
function applySignalAlpha(node, key, prevValue, nextValue, apply) {
|
|
6
|
+
node.__signalEffects?.get(key)?.();
|
|
7
|
+
if (jsxCore.isAnimatedSignal(nextValue)) {
|
|
8
|
+
apply(nextValue.value);
|
|
9
|
+
const cleanup = signalsCore.effect(() => {
|
|
10
|
+
apply(nextValue.value);
|
|
11
|
+
});
|
|
12
|
+
if (!node.__signalEffects) {
|
|
13
|
+
node.__signalEffects = /* @__PURE__ */ new Map();
|
|
14
|
+
}
|
|
15
|
+
node.__signalEffects.set(key, cleanup);
|
|
16
|
+
} else if (typeof nextValue === "number" && nextValue !== prevValue) {
|
|
17
|
+
apply(nextValue);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function normalizeVisible(visible) {
|
|
21
|
+
if (visible === void 0) return true;
|
|
22
|
+
if (typeof visible === "boolean") return visible;
|
|
23
|
+
if (visible === "visible") return true;
|
|
24
|
+
if (visible === "invisible" || visible === "none") return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
function applyPhaserProps(node, prev, next) {
|
|
28
|
+
applySignalAlpha(node, "alpha", prev.alpha, next.alpha, (v) => {
|
|
29
|
+
node.setAlpha?.(v);
|
|
30
|
+
});
|
|
31
|
+
if (prev.depth !== next.depth && typeof next.depth === "number") {
|
|
32
|
+
node.setDepth?.(next.depth);
|
|
33
|
+
}
|
|
34
|
+
if (prev.visible !== next.visible) {
|
|
35
|
+
const visibleValue = normalizeVisible(next.visible);
|
|
36
|
+
node.visible = visibleValue;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.applyPhaserProps = applyPhaserProps;
|
|
40
|
+
//# sourceMappingURL=applyPhaser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPhaser.cjs","sources":["../../../src/components/appliers/applyPhaser.ts"],"sourcesContent":["/**\n * Applier for Phaser GameObject display properties\n *\n * Supports AnimatedSignal values — subscribes to signal changes and updates\n * native node properties directly, bypassing VDOM re-renders.\n */\nimport { isAnimatedSignal } from '@number10/jsx-core'\nimport { effect } from '@preact/signals-core'\nimport type { Display, PhaserProps, TransformProps } from '../../core-props'\n\n// Combined type — alpha comes from TransformProps, rest from PhaserProps\ntype PhaserDisplayProps = Partial<TransformProps & PhaserProps & { visible?: boolean | Display }>\n\n/**\n * Generic node type with Phaser GameObject display capabilities\n */\ntype PhaserNode = {\n visible: boolean\n setAlpha: (alpha: number) => void\n setDepth: (depth: number) => void\n}\n\ninterface SignalEffectNode {\n __signalEffects?: Map<string, () => void>\n}\n\n/**\n * Applies a prop value that may be an AnimatedSignal.\n * Subscribes to signal changes for live updates without VDOM re-renders.\n */\nfunction applySignalAlpha<T extends SignalEffectNode>(\n node: T,\n key: string,\n prevValue: unknown,\n nextValue: unknown,\n apply: (value: number) => void\n): void {\n node.__signalEffects?.get(key)?.()\n\n if (isAnimatedSignal(nextValue)) {\n apply(nextValue.value)\n const cleanup = effect(() => {\n apply(nextValue.value)\n })\n if (!node.__signalEffects) {\n node.__signalEffects = new Map()\n }\n node.__signalEffects.set(key, cleanup)\n } else if (typeof nextValue === 'number' && nextValue !== prevValue) {\n apply(nextValue)\n }\n}\n\n/**\n * Normalize visible prop to boolean for Phaser GameObject\n * - true / 'visible' → true (rendered)\n * - false / 'invisible' → false (not rendered, but takes space)\n * - 'none' → false (not rendered, no space)\n * @param visible - Visible prop value\n * @returns Boolean for Phaser GameObject.visible\n */\nfunction normalizeVisible(visible: boolean | Display | undefined): boolean {\n if (visible === undefined) return true // default: visible\n if (typeof visible === 'boolean') return visible\n // String values\n if (visible === 'visible') return true\n if (visible === 'invisible' || visible === 'none') return false\n return true\n}\n\n/**\n * Applies Phaser display properties (alpha, depth, visibility)\n * @param node - Node with Phaser GameObject properties\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyPhaserProps<T extends Partial<PhaserNode & SignalEffectNode>>(\n node: T,\n prev: PhaserDisplayProps,\n next: PhaserDisplayProps\n): void {\n // Alpha — supports AnimatedSignal for tween/spring-driven opacity\n applySignalAlpha(node, 'alpha', prev.alpha, next.alpha, (v) => {\n node.setAlpha?.(v)\n })\n\n // Depth\n if (prev.depth !== next.depth && typeof next.depth === 'number') {\n node.setDepth?.(next.depth)\n }\n\n // Visibility - supports boolean and Display type (from LayoutProps)\n if (prev.visible !== next.visible) {\n const visibleValue = normalizeVisible(next.visible)\n node.visible = visibleValue\n }\n}\n"],"names":["isAnimatedSignal","effect"],"mappings":";;;;AA8BA,SAAS,iBACP,MACA,KACA,WACA,WACA,OACM;AACN,OAAK,iBAAiB,IAAI,GAAG,IAAA;AAE7B,MAAIA,QAAAA,iBAAiB,SAAS,GAAG;AAC/B,UAAM,UAAU,KAAK;AACrB,UAAM,UAAUC,YAAAA,OAAO,MAAM;AAC3B,YAAM,UAAU,KAAK;AAAA,IACvB,CAAC;AACD,QAAI,CAAC,KAAK,iBAAiB;AACzB,WAAK,sCAAsB,IAAA;AAAA,IAC7B;AACA,SAAK,gBAAgB,IAAI,KAAK,OAAO;AAAA,EACvC,WAAW,OAAO,cAAc,YAAY,cAAc,WAAW;AACnE,UAAM,SAAS;AAAA,EACjB;AACF;AAUA,SAAS,iBAAiB,SAAiD;AACzE,MAAI,YAAY,OAAW,QAAO;AAClC,MAAI,OAAO,YAAY,UAAW,QAAO;AAEzC,MAAI,YAAY,UAAW,QAAO;AAClC,MAAI,YAAY,eAAe,YAAY,OAAQ,QAAO;AAC1D,SAAO;AACT;AAQO,SAAS,iBACd,MACA,MACA,MACM;AAEN,mBAAiB,MAAM,SAAS,KAAK,OAAO,KAAK,OAAO,CAAC,MAAM;AAC7D,SAAK,WAAW,CAAC;AAAA,EACnB,CAAC;AAGD,MAAI,KAAK,UAAU,KAAK,SAAS,OAAO,KAAK,UAAU,UAAU;AAC/D,SAAK,WAAW,KAAK,KAAK;AAAA,EAC5B;AAGA,MAAI,KAAK,YAAY,KAAK,SAAS;AACjC,UAAM,eAAe,iBAAiB,KAAK,OAAO;AAClD,SAAK,UAAU;AAAA,EACjB;AACF;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Display, PhaserProps, TransformProps } from '../../core-props';
|
|
2
|
+
type PhaserDisplayProps = Partial<TransformProps & PhaserProps & {
|
|
3
|
+
visible?: boolean | Display;
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Generic node type with Phaser GameObject display capabilities
|
|
7
|
+
*/
|
|
8
|
+
type PhaserNode = {
|
|
9
|
+
visible: boolean;
|
|
10
|
+
setAlpha: (alpha: number) => void;
|
|
11
|
+
setDepth: (depth: number) => void;
|
|
12
|
+
};
|
|
13
|
+
interface SignalEffectNode {
|
|
14
|
+
__signalEffects?: Map<string, () => void>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Applies Phaser display properties (alpha, depth, visibility)
|
|
18
|
+
* @param node - Node with Phaser GameObject properties
|
|
19
|
+
* @param prev - Previous props
|
|
20
|
+
* @param next - New props
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyPhaserProps<T extends Partial<PhaserNode & SignalEffectNode>>(node: T, prev: PhaserDisplayProps, next: PhaserDisplayProps): void;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=applyPhaser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPhaser.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyPhaser.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAG5E,KAAK,kBAAkB,GAAG,OAAO,CAAC,cAAc,GAAG,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAAE,CAAC,CAAA;AAEjG;;GAEG;AACH,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAED,UAAU,gBAAgB;IACxB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAA;CAC1C;AA8CD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,OAAO,CAAC,UAAU,GAAG,gBAAgB,CAAC,EAC/E,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,kBAAkB,GACvB,IAAI,CAgBN"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isAnimatedSignal } from "@number10/jsx-core";
|
|
2
|
+
import { effect } from "@preact/signals-core";
|
|
3
|
+
function applySignalAlpha(node, key, prevValue, nextValue, apply) {
|
|
4
|
+
node.__signalEffects?.get(key)?.();
|
|
5
|
+
if (isAnimatedSignal(nextValue)) {
|
|
6
|
+
apply(nextValue.value);
|
|
7
|
+
const cleanup = effect(() => {
|
|
8
|
+
apply(nextValue.value);
|
|
9
|
+
});
|
|
10
|
+
if (!node.__signalEffects) {
|
|
11
|
+
node.__signalEffects = /* @__PURE__ */ new Map();
|
|
12
|
+
}
|
|
13
|
+
node.__signalEffects.set(key, cleanup);
|
|
14
|
+
} else if (typeof nextValue === "number" && nextValue !== prevValue) {
|
|
15
|
+
apply(nextValue);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function normalizeVisible(visible) {
|
|
19
|
+
if (visible === void 0) return true;
|
|
20
|
+
if (typeof visible === "boolean") return visible;
|
|
21
|
+
if (visible === "visible") return true;
|
|
22
|
+
if (visible === "invisible" || visible === "none") return false;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
function applyPhaserProps(node, prev, next) {
|
|
26
|
+
applySignalAlpha(node, "alpha", prev.alpha, next.alpha, (v) => {
|
|
27
|
+
node.setAlpha?.(v);
|
|
28
|
+
});
|
|
29
|
+
if (prev.depth !== next.depth && typeof next.depth === "number") {
|
|
30
|
+
node.setDepth?.(next.depth);
|
|
31
|
+
}
|
|
32
|
+
if (prev.visible !== next.visible) {
|
|
33
|
+
const visibleValue = normalizeVisible(next.visible);
|
|
34
|
+
node.visible = visibleValue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
applyPhaserProps
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=applyPhaser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPhaser.js","sources":["../../../src/components/appliers/applyPhaser.ts"],"sourcesContent":["/**\n * Applier for Phaser GameObject display properties\n *\n * Supports AnimatedSignal values — subscribes to signal changes and updates\n * native node properties directly, bypassing VDOM re-renders.\n */\nimport { isAnimatedSignal } from '@number10/jsx-core'\nimport { effect } from '@preact/signals-core'\nimport type { Display, PhaserProps, TransformProps } from '../../core-props'\n\n// Combined type — alpha comes from TransformProps, rest from PhaserProps\ntype PhaserDisplayProps = Partial<TransformProps & PhaserProps & { visible?: boolean | Display }>\n\n/**\n * Generic node type with Phaser GameObject display capabilities\n */\ntype PhaserNode = {\n visible: boolean\n setAlpha: (alpha: number) => void\n setDepth: (depth: number) => void\n}\n\ninterface SignalEffectNode {\n __signalEffects?: Map<string, () => void>\n}\n\n/**\n * Applies a prop value that may be an AnimatedSignal.\n * Subscribes to signal changes for live updates without VDOM re-renders.\n */\nfunction applySignalAlpha<T extends SignalEffectNode>(\n node: T,\n key: string,\n prevValue: unknown,\n nextValue: unknown,\n apply: (value: number) => void\n): void {\n node.__signalEffects?.get(key)?.()\n\n if (isAnimatedSignal(nextValue)) {\n apply(nextValue.value)\n const cleanup = effect(() => {\n apply(nextValue.value)\n })\n if (!node.__signalEffects) {\n node.__signalEffects = new Map()\n }\n node.__signalEffects.set(key, cleanup)\n } else if (typeof nextValue === 'number' && nextValue !== prevValue) {\n apply(nextValue)\n }\n}\n\n/**\n * Normalize visible prop to boolean for Phaser GameObject\n * - true / 'visible' → true (rendered)\n * - false / 'invisible' → false (not rendered, but takes space)\n * - 'none' → false (not rendered, no space)\n * @param visible - Visible prop value\n * @returns Boolean for Phaser GameObject.visible\n */\nfunction normalizeVisible(visible: boolean | Display | undefined): boolean {\n if (visible === undefined) return true // default: visible\n if (typeof visible === 'boolean') return visible\n // String values\n if (visible === 'visible') return true\n if (visible === 'invisible' || visible === 'none') return false\n return true\n}\n\n/**\n * Applies Phaser display properties (alpha, depth, visibility)\n * @param node - Node with Phaser GameObject properties\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyPhaserProps<T extends Partial<PhaserNode & SignalEffectNode>>(\n node: T,\n prev: PhaserDisplayProps,\n next: PhaserDisplayProps\n): void {\n // Alpha — supports AnimatedSignal for tween/spring-driven opacity\n applySignalAlpha(node, 'alpha', prev.alpha, next.alpha, (v) => {\n node.setAlpha?.(v)\n })\n\n // Depth\n if (prev.depth !== next.depth && typeof next.depth === 'number') {\n node.setDepth?.(next.depth)\n }\n\n // Visibility - supports boolean and Display type (from LayoutProps)\n if (prev.visible !== next.visible) {\n const visibleValue = normalizeVisible(next.visible)\n node.visible = visibleValue\n }\n}\n"],"names":[],"mappings":";;AA8BA,SAAS,iBACP,MACA,KACA,WACA,WACA,OACM;AACN,OAAK,iBAAiB,IAAI,GAAG,IAAA;AAE7B,MAAI,iBAAiB,SAAS,GAAG;AAC/B,UAAM,UAAU,KAAK;AACrB,UAAM,UAAU,OAAO,MAAM;AAC3B,YAAM,UAAU,KAAK;AAAA,IACvB,CAAC;AACD,QAAI,CAAC,KAAK,iBAAiB;AACzB,WAAK,sCAAsB,IAAA;AAAA,IAC7B;AACA,SAAK,gBAAgB,IAAI,KAAK,OAAO;AAAA,EACvC,WAAW,OAAO,cAAc,YAAY,cAAc,WAAW;AACnE,UAAM,SAAS;AAAA,EACjB;AACF;AAUA,SAAS,iBAAiB,SAAiD;AACzE,MAAI,YAAY,OAAW,QAAO;AAClC,MAAI,OAAO,YAAY,UAAW,QAAO;AAEzC,MAAI,YAAY,UAAW,QAAO;AAClC,MAAI,YAAY,eAAe,YAAY,OAAQ,QAAO;AAC1D,SAAO;AACT;AAQO,SAAS,iBACd,MACA,MACA,MACM;AAEN,mBAAiB,MAAM,SAAS,KAAK,OAAO,KAAK,OAAO,CAAC,MAAM;AAC7D,SAAK,WAAW,CAAC;AAAA,EACnB,CAAC;AAGD,MAAI,KAAK,UAAU,KAAK,SAAS,OAAO,KAAK,UAAU,UAAU;AAC/D,SAAK,WAAW,KAAK,KAAK;AAAA,EAC5B;AAGA,MAAI,KAAK,YAAY,KAAK,SAAS;AACjC,UAAM,eAAe,iBAAiB,KAAK,OAAO;AAClD,SAAK,UAAU;AAAA,EACjB;AACF;"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getOriginalTextureDimensions(sprite) {
|
|
4
|
+
const frame = sprite.frame;
|
|
5
|
+
return {
|
|
6
|
+
width: frame.width,
|
|
7
|
+
height: frame.height
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function calculateFitScale(sprite, targetWidth, targetHeight, fit = "fill") {
|
|
11
|
+
const { width: textureWidth, height: textureHeight } = getOriginalTextureDimensions(sprite);
|
|
12
|
+
if (textureWidth === 0 || textureHeight === 0) {
|
|
13
|
+
return { scaleX: 1, scaleY: 1 };
|
|
14
|
+
}
|
|
15
|
+
if (fit === "fill") {
|
|
16
|
+
return {
|
|
17
|
+
scaleX: targetWidth / textureWidth,
|
|
18
|
+
scaleY: targetHeight / textureHeight
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const targetAspect = targetWidth / targetHeight;
|
|
22
|
+
const textureAspect = textureWidth / textureHeight;
|
|
23
|
+
if (fit === "contain") {
|
|
24
|
+
const scale = targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
25
|
+
return { scaleX: scale, scaleY: scale };
|
|
26
|
+
}
|
|
27
|
+
if (fit === "cover") {
|
|
28
|
+
const scale = targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
29
|
+
return { scaleX: scale, scaleY: scale };
|
|
30
|
+
}
|
|
31
|
+
return { scaleX: 1, scaleY: 1 };
|
|
32
|
+
}
|
|
33
|
+
function applySpriteProps(sprite, prev, next) {
|
|
34
|
+
const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame;
|
|
35
|
+
if (textureChanged && next.texture) {
|
|
36
|
+
sprite.setTexture(next.texture, next.frame);
|
|
37
|
+
}
|
|
38
|
+
if (prev.tint !== next.tint) {
|
|
39
|
+
if (typeof next.tint === "number") {
|
|
40
|
+
sprite.setTint(next.tint);
|
|
41
|
+
} else {
|
|
42
|
+
sprite.clearTint();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (prev.originX !== next.originX || prev.originY !== next.originY) {
|
|
46
|
+
const originX = next.originX ?? sprite.originX;
|
|
47
|
+
const originY = next.originY ?? sprite.originY;
|
|
48
|
+
sprite.setOrigin(originX, originY);
|
|
49
|
+
}
|
|
50
|
+
const displayWidthChanged = prev.displayWidth !== next.displayWidth;
|
|
51
|
+
const displayHeightChanged = prev.displayHeight !== next.displayHeight;
|
|
52
|
+
const fitChanged = prev.fit !== next.fit;
|
|
53
|
+
if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {
|
|
54
|
+
if (typeof next.displayWidth === "number" && typeof next.displayHeight === "number") {
|
|
55
|
+
const fit = next.fit ?? "fill";
|
|
56
|
+
if (fit === "fill") {
|
|
57
|
+
sprite.setDisplaySize(next.displayWidth, next.displayHeight);
|
|
58
|
+
} else {
|
|
59
|
+
const { scaleX, scaleY } = calculateFitScale(
|
|
60
|
+
sprite,
|
|
61
|
+
next.displayWidth,
|
|
62
|
+
next.displayHeight,
|
|
63
|
+
fit
|
|
64
|
+
);
|
|
65
|
+
sprite.setScale(scaleX, scaleY);
|
|
66
|
+
}
|
|
67
|
+
} else if (typeof next.displayWidth === "number") {
|
|
68
|
+
const { width: origWidth } = getOriginalTextureDimensions(sprite);
|
|
69
|
+
const scale = next.displayWidth / origWidth;
|
|
70
|
+
sprite.setScale(scale);
|
|
71
|
+
} else if (typeof next.displayHeight === "number") {
|
|
72
|
+
const { height: origHeight } = getOriginalTextureDimensions(sprite);
|
|
73
|
+
const scale = next.displayHeight / origHeight;
|
|
74
|
+
sprite.setScale(scale, scale);
|
|
75
|
+
} else {
|
|
76
|
+
sprite.setScale(1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const animationChanged = prev.animationKey !== next.animationKey || prev.loop !== next.loop || prev.repeatDelay !== next.repeatDelay;
|
|
80
|
+
if (animationChanged) {
|
|
81
|
+
if (sprite.anims.isPlaying) {
|
|
82
|
+
sprite.anims.stop();
|
|
83
|
+
}
|
|
84
|
+
if (next.animationKey) {
|
|
85
|
+
sprite.anims.play({
|
|
86
|
+
key: next.animationKey,
|
|
87
|
+
repeat: next.loop ? -1 : 0,
|
|
88
|
+
repeatDelay: next.repeatDelay ?? 0
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const callbacksChanged = prev.onAnimationStart !== next.onAnimationStart || prev.onAnimationComplete !== next.onAnimationComplete || prev.onAnimationRepeat !== next.onAnimationRepeat || prev.onAnimationUpdate !== next.onAnimationUpdate;
|
|
93
|
+
if (callbacksChanged) {
|
|
94
|
+
sprite.off("animationstart");
|
|
95
|
+
sprite.off("animationcomplete");
|
|
96
|
+
sprite.off("animationrepeat");
|
|
97
|
+
sprite.off("animationupdate");
|
|
98
|
+
if (next.onAnimationStart) {
|
|
99
|
+
sprite.on("animationstart", (anim) => {
|
|
100
|
+
next.onAnimationStart?.(anim.key);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (next.onAnimationComplete) {
|
|
104
|
+
sprite.on("animationcomplete", (anim) => {
|
|
105
|
+
next.onAnimationComplete?.(anim.key);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (next.onAnimationRepeat) {
|
|
109
|
+
sprite.on("animationrepeat", (anim) => {
|
|
110
|
+
next.onAnimationRepeat?.(anim.key);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (next.onAnimationUpdate) {
|
|
114
|
+
sprite.on(
|
|
115
|
+
"animationupdate",
|
|
116
|
+
(anim, frame) => {
|
|
117
|
+
next.onAnimationUpdate?.(anim.key, frame);
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.applySpriteProps = applySpriteProps;
|
|
124
|
+
//# sourceMappingURL=applySprite.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applySprite.cjs","sources":["../../../src/components/appliers/applySprite.ts"],"sourcesContent":["/**\n * Applier for Sprite-specific properties\n */\nimport type * as Phaser from 'phaser'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Gets original texture dimensions (unscaled)\n * @param sprite - Phaser Sprite object\n * @returns Original width and height\n */\nfunction getOriginalTextureDimensions(sprite: Phaser.GameObjects.Sprite): {\n width: number\n height: number\n} {\n const frame = sprite.frame\n return {\n width: frame.width,\n height: frame.height,\n }\n}\n\n/**\n * Calculates scale factors for fit modes\n * @param sprite - Phaser Sprite object\n * @param targetWidth - Desired width\n * @param targetHeight - Desired height\n * @param fit - Fit mode\n * @returns Scale factors for x and y\n */\nfunction calculateFitScale(\n sprite: Phaser.GameObjects.Sprite,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill'\n): { scaleX: number; scaleY: number } {\n const { width: textureWidth, height: textureHeight } = getOriginalTextureDimensions(sprite)\n\n if (textureWidth === 0 || textureHeight === 0) {\n return { scaleX: 1, scaleY: 1 }\n }\n\n if (fit === 'fill') {\n return {\n scaleX: targetWidth / textureWidth,\n scaleY: targetHeight / textureHeight,\n }\n }\n\n const targetAspect = targetWidth / targetHeight\n const textureAspect = textureWidth / textureHeight\n\n if (fit === 'contain') {\n const scale =\n targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n if (fit === 'cover') {\n const scale =\n targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n return { scaleX: 1, scaleY: 1 }\n}\n\n/**\n * Applies Sprite-specific properties (texture, frame, tint, displaySize, fit, animations)\n * @param sprite - Phaser Sprite object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applySpriteProps(\n sprite: Phaser.GameObjects.Sprite,\n prev: Partial<SpriteBaseProps>,\n next: Partial<SpriteBaseProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n sprite.setTexture(next.texture, next.frame)\n }\n\n // Apply tint\n if (prev.tint !== next.tint) {\n if (typeof next.tint === 'number') {\n sprite.setTint(next.tint)\n } else {\n sprite.clearTint()\n }\n }\n\n // Apply origin if specified\n if (prev.originX !== next.originX || prev.originY !== next.originY) {\n const originX = next.originX ?? sprite.originX\n const originY = next.originY ?? sprite.originY\n sprite.setOrigin(originX, originY)\n }\n\n // Apply displayWidth/displayHeight with fit mode\n const displayWidthChanged = prev.displayWidth !== next.displayWidth\n const displayHeightChanged = prev.displayHeight !== next.displayHeight\n const fitChanged = prev.fit !== next.fit\n\n if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n // Both specified - use fit mode\n const fit = next.fit ?? 'fill'\n\n if (fit === 'fill') {\n // Use setDisplaySize for fill mode (non-uniform scaling)\n sprite.setDisplaySize(next.displayWidth, next.displayHeight)\n } else {\n // Use setScale for contain/cover (uniform scaling)\n const { scaleX, scaleY } = calculateFitScale(\n sprite,\n next.displayWidth,\n next.displayHeight,\n fit\n )\n sprite.setScale(scaleX, scaleY)\n }\n } else if (typeof next.displayWidth === 'number') {\n // Only width - preserve aspect ratio (use original texture width)\n const { width: origWidth } = getOriginalTextureDimensions(sprite)\n const scale = next.displayWidth / origWidth\n sprite.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height - preserve aspect ratio (use original texture height)\n const { height: origHeight } = getOriginalTextureDimensions(sprite)\n const scale = next.displayHeight / origHeight\n sprite.setScale(scale, scale)\n } else {\n // No display size specified - reset to default scale\n sprite.setScale(1)\n }\n }\n\n // Handle animation changes\n const animationChanged =\n prev.animationKey !== next.animationKey ||\n prev.loop !== next.loop ||\n prev.repeatDelay !== next.repeatDelay\n\n if (animationChanged) {\n // Stop previous animation if playing\n if (sprite.anims.isPlaying) {\n sprite.anims.stop()\n }\n\n // Play new animation if specified\n if (next.animationKey) {\n sprite.anims.play({\n key: next.animationKey,\n repeat: next.loop ? -1 : 0,\n repeatDelay: next.repeatDelay ?? 0,\n })\n }\n }\n\n // Update animation callbacks\n const callbacksChanged =\n prev.onAnimationStart !== next.onAnimationStart ||\n prev.onAnimationComplete !== next.onAnimationComplete ||\n prev.onAnimationRepeat !== next.onAnimationRepeat ||\n prev.onAnimationUpdate !== next.onAnimationUpdate\n\n if (callbacksChanged) {\n // Remove old listeners\n sprite.off('animationstart')\n sprite.off('animationcomplete')\n sprite.off('animationrepeat')\n sprite.off('animationupdate')\n\n // Add new listeners\n if (next.onAnimationStart) {\n sprite.on('animationstart', (anim: Phaser.Animations.Animation) => {\n next.onAnimationStart?.(anim.key)\n })\n }\n\n if (next.onAnimationComplete) {\n sprite.on('animationcomplete', (anim: Phaser.Animations.Animation) => {\n next.onAnimationComplete?.(anim.key)\n })\n }\n\n if (next.onAnimationRepeat) {\n sprite.on('animationrepeat', (anim: Phaser.Animations.Animation) => {\n next.onAnimationRepeat?.(anim.key)\n })\n }\n\n if (next.onAnimationUpdate) {\n sprite.on(\n 'animationupdate',\n (anim: Phaser.Animations.Animation, frame: Phaser.Animations.AnimationFrame) => {\n next.onAnimationUpdate?.(anim.key, frame)\n }\n )\n }\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SpriteBaseProps } from '../primitives/sprite';
|
|
2
|
+
/**
|
|
3
|
+
* Applier for Sprite-specific properties
|
|
4
|
+
*/
|
|
5
|
+
import type * as Phaser from 'phaser';
|
|
6
|
+
/**
|
|
7
|
+
* Applies Sprite-specific properties (texture, frame, tint, displaySize, fit, animations)
|
|
8
|
+
* @param sprite - Phaser Sprite object
|
|
9
|
+
* @param prev - Previous props
|
|
10
|
+
* @param next - New props
|
|
11
|
+
*/
|
|
12
|
+
export declare function applySpriteProps(sprite: Phaser.GameObjects.Sprite, prev: Partial<SpriteBaseProps>, next: Partial<SpriteBaseProps>): void;
|
|
13
|
+
//# sourceMappingURL=applySprite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applySprite.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applySprite.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AA+D3D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,EACjC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,EAC9B,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAC7B,IAAI,CA8HN"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
function getOriginalTextureDimensions(sprite) {
|
|
2
|
+
const frame = sprite.frame;
|
|
3
|
+
return {
|
|
4
|
+
width: frame.width,
|
|
5
|
+
height: frame.height
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function calculateFitScale(sprite, targetWidth, targetHeight, fit = "fill") {
|
|
9
|
+
const { width: textureWidth, height: textureHeight } = getOriginalTextureDimensions(sprite);
|
|
10
|
+
if (textureWidth === 0 || textureHeight === 0) {
|
|
11
|
+
return { scaleX: 1, scaleY: 1 };
|
|
12
|
+
}
|
|
13
|
+
if (fit === "fill") {
|
|
14
|
+
return {
|
|
15
|
+
scaleX: targetWidth / textureWidth,
|
|
16
|
+
scaleY: targetHeight / textureHeight
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const targetAspect = targetWidth / targetHeight;
|
|
20
|
+
const textureAspect = textureWidth / textureHeight;
|
|
21
|
+
if (fit === "contain") {
|
|
22
|
+
const scale = targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
23
|
+
return { scaleX: scale, scaleY: scale };
|
|
24
|
+
}
|
|
25
|
+
if (fit === "cover") {
|
|
26
|
+
const scale = targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth;
|
|
27
|
+
return { scaleX: scale, scaleY: scale };
|
|
28
|
+
}
|
|
29
|
+
return { scaleX: 1, scaleY: 1 };
|
|
30
|
+
}
|
|
31
|
+
function applySpriteProps(sprite, prev, next) {
|
|
32
|
+
const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame;
|
|
33
|
+
if (textureChanged && next.texture) {
|
|
34
|
+
sprite.setTexture(next.texture, next.frame);
|
|
35
|
+
}
|
|
36
|
+
if (prev.tint !== next.tint) {
|
|
37
|
+
if (typeof next.tint === "number") {
|
|
38
|
+
sprite.setTint(next.tint);
|
|
39
|
+
} else {
|
|
40
|
+
sprite.clearTint();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (prev.originX !== next.originX || prev.originY !== next.originY) {
|
|
44
|
+
const originX = next.originX ?? sprite.originX;
|
|
45
|
+
const originY = next.originY ?? sprite.originY;
|
|
46
|
+
sprite.setOrigin(originX, originY);
|
|
47
|
+
}
|
|
48
|
+
const displayWidthChanged = prev.displayWidth !== next.displayWidth;
|
|
49
|
+
const displayHeightChanged = prev.displayHeight !== next.displayHeight;
|
|
50
|
+
const fitChanged = prev.fit !== next.fit;
|
|
51
|
+
if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {
|
|
52
|
+
if (typeof next.displayWidth === "number" && typeof next.displayHeight === "number") {
|
|
53
|
+
const fit = next.fit ?? "fill";
|
|
54
|
+
if (fit === "fill") {
|
|
55
|
+
sprite.setDisplaySize(next.displayWidth, next.displayHeight);
|
|
56
|
+
} else {
|
|
57
|
+
const { scaleX, scaleY } = calculateFitScale(
|
|
58
|
+
sprite,
|
|
59
|
+
next.displayWidth,
|
|
60
|
+
next.displayHeight,
|
|
61
|
+
fit
|
|
62
|
+
);
|
|
63
|
+
sprite.setScale(scaleX, scaleY);
|
|
64
|
+
}
|
|
65
|
+
} else if (typeof next.displayWidth === "number") {
|
|
66
|
+
const { width: origWidth } = getOriginalTextureDimensions(sprite);
|
|
67
|
+
const scale = next.displayWidth / origWidth;
|
|
68
|
+
sprite.setScale(scale);
|
|
69
|
+
} else if (typeof next.displayHeight === "number") {
|
|
70
|
+
const { height: origHeight } = getOriginalTextureDimensions(sprite);
|
|
71
|
+
const scale = next.displayHeight / origHeight;
|
|
72
|
+
sprite.setScale(scale, scale);
|
|
73
|
+
} else {
|
|
74
|
+
sprite.setScale(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const animationChanged = prev.animationKey !== next.animationKey || prev.loop !== next.loop || prev.repeatDelay !== next.repeatDelay;
|
|
78
|
+
if (animationChanged) {
|
|
79
|
+
if (sprite.anims.isPlaying) {
|
|
80
|
+
sprite.anims.stop();
|
|
81
|
+
}
|
|
82
|
+
if (next.animationKey) {
|
|
83
|
+
sprite.anims.play({
|
|
84
|
+
key: next.animationKey,
|
|
85
|
+
repeat: next.loop ? -1 : 0,
|
|
86
|
+
repeatDelay: next.repeatDelay ?? 0
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const callbacksChanged = prev.onAnimationStart !== next.onAnimationStart || prev.onAnimationComplete !== next.onAnimationComplete || prev.onAnimationRepeat !== next.onAnimationRepeat || prev.onAnimationUpdate !== next.onAnimationUpdate;
|
|
91
|
+
if (callbacksChanged) {
|
|
92
|
+
sprite.off("animationstart");
|
|
93
|
+
sprite.off("animationcomplete");
|
|
94
|
+
sprite.off("animationrepeat");
|
|
95
|
+
sprite.off("animationupdate");
|
|
96
|
+
if (next.onAnimationStart) {
|
|
97
|
+
sprite.on("animationstart", (anim) => {
|
|
98
|
+
next.onAnimationStart?.(anim.key);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (next.onAnimationComplete) {
|
|
102
|
+
sprite.on("animationcomplete", (anim) => {
|
|
103
|
+
next.onAnimationComplete?.(anim.key);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (next.onAnimationRepeat) {
|
|
107
|
+
sprite.on("animationrepeat", (anim) => {
|
|
108
|
+
next.onAnimationRepeat?.(anim.key);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (next.onAnimationUpdate) {
|
|
112
|
+
sprite.on(
|
|
113
|
+
"animationupdate",
|
|
114
|
+
(anim, frame) => {
|
|
115
|
+
next.onAnimationUpdate?.(anim.key, frame);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
applySpriteProps
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=applySprite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applySprite.js","sources":["../../../src/components/appliers/applySprite.ts"],"sourcesContent":["/**\n * Applier for Sprite-specific properties\n */\nimport type * as Phaser from 'phaser'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Gets original texture dimensions (unscaled)\n * @param sprite - Phaser Sprite object\n * @returns Original width and height\n */\nfunction getOriginalTextureDimensions(sprite: Phaser.GameObjects.Sprite): {\n width: number\n height: number\n} {\n const frame = sprite.frame\n return {\n width: frame.width,\n height: frame.height,\n }\n}\n\n/**\n * Calculates scale factors for fit modes\n * @param sprite - Phaser Sprite object\n * @param targetWidth - Desired width\n * @param targetHeight - Desired height\n * @param fit - Fit mode\n * @returns Scale factors for x and y\n */\nfunction calculateFitScale(\n sprite: Phaser.GameObjects.Sprite,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill'\n): { scaleX: number; scaleY: number } {\n const { width: textureWidth, height: textureHeight } = getOriginalTextureDimensions(sprite)\n\n if (textureWidth === 0 || textureHeight === 0) {\n return { scaleX: 1, scaleY: 1 }\n }\n\n if (fit === 'fill') {\n return {\n scaleX: targetWidth / textureWidth,\n scaleY: targetHeight / textureHeight,\n }\n }\n\n const targetAspect = targetWidth / targetHeight\n const textureAspect = textureWidth / textureHeight\n\n if (fit === 'contain') {\n const scale =\n targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n if (fit === 'cover') {\n const scale =\n targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n return { scaleX: 1, scaleY: 1 }\n}\n\n/**\n * Applies Sprite-specific properties (texture, frame, tint, displaySize, fit, animations)\n * @param sprite - Phaser Sprite object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applySpriteProps(\n sprite: Phaser.GameObjects.Sprite,\n prev: Partial<SpriteBaseProps>,\n next: Partial<SpriteBaseProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n sprite.setTexture(next.texture, next.frame)\n }\n\n // Apply tint\n if (prev.tint !== next.tint) {\n if (typeof next.tint === 'number') {\n sprite.setTint(next.tint)\n } else {\n sprite.clearTint()\n }\n }\n\n // Apply origin if specified\n if (prev.originX !== next.originX || prev.originY !== next.originY) {\n const originX = next.originX ?? sprite.originX\n const originY = next.originY ?? sprite.originY\n sprite.setOrigin(originX, originY)\n }\n\n // Apply displayWidth/displayHeight with fit mode\n const displayWidthChanged = prev.displayWidth !== next.displayWidth\n const displayHeightChanged = prev.displayHeight !== next.displayHeight\n const fitChanged = prev.fit !== next.fit\n\n if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n // Both specified - use fit mode\n const fit = next.fit ?? 'fill'\n\n if (fit === 'fill') {\n // Use setDisplaySize for fill mode (non-uniform scaling)\n sprite.setDisplaySize(next.displayWidth, next.displayHeight)\n } else {\n // Use setScale for contain/cover (uniform scaling)\n const { scaleX, scaleY } = calculateFitScale(\n sprite,\n next.displayWidth,\n next.displayHeight,\n fit\n )\n sprite.setScale(scaleX, scaleY)\n }\n } else if (typeof next.displayWidth === 'number') {\n // Only width - preserve aspect ratio (use original texture width)\n const { width: origWidth } = getOriginalTextureDimensions(sprite)\n const scale = next.displayWidth / origWidth\n sprite.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height - preserve aspect ratio (use original texture height)\n const { height: origHeight } = getOriginalTextureDimensions(sprite)\n const scale = next.displayHeight / origHeight\n sprite.setScale(scale, scale)\n } else {\n // No display size specified - reset to default scale\n sprite.setScale(1)\n }\n }\n\n // Handle animation changes\n const animationChanged =\n prev.animationKey !== next.animationKey ||\n prev.loop !== next.loop ||\n prev.repeatDelay !== next.repeatDelay\n\n if (animationChanged) {\n // Stop previous animation if playing\n if (sprite.anims.isPlaying) {\n sprite.anims.stop()\n }\n\n // Play new animation if specified\n if (next.animationKey) {\n sprite.anims.play({\n key: next.animationKey,\n repeat: next.loop ? -1 : 0,\n repeatDelay: next.repeatDelay ?? 0,\n })\n }\n }\n\n // Update animation callbacks\n const callbacksChanged =\n prev.onAnimationStart !== next.onAnimationStart ||\n prev.onAnimationComplete !== next.onAnimationComplete ||\n prev.onAnimationRepeat !== next.onAnimationRepeat ||\n prev.onAnimationUpdate !== next.onAnimationUpdate\n\n if (callbacksChanged) {\n // Remove old listeners\n sprite.off('animationstart')\n sprite.off('animationcomplete')\n sprite.off('animationrepeat')\n sprite.off('animationupdate')\n\n // Add new listeners\n if (next.onAnimationStart) {\n sprite.on('animationstart', (anim: Phaser.Animations.Animation) => {\n next.onAnimationStart?.(anim.key)\n })\n }\n\n if (next.onAnimationComplete) {\n sprite.on('animationcomplete', (anim: Phaser.Animations.Animation) => {\n next.onAnimationComplete?.(anim.key)\n })\n }\n\n if (next.onAnimationRepeat) {\n sprite.on('animationrepeat', (anim: Phaser.Animations.Animation) => {\n next.onAnimationRepeat?.(anim.key)\n })\n }\n\n if (next.onAnimationUpdate) {\n sprite.on(\n 'animationupdate',\n (anim: Phaser.Animations.Animation, frame: Phaser.Animations.AnimationFrame) => {\n next.onAnimationUpdate?.(anim.key, frame)\n }\n )\n }\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function applySpriteLayout(sprite, _prev, next) {
|
|
4
|
+
sprite.__layoutProps = next;
|
|
5
|
+
}
|
|
6
|
+
exports.applySpriteLayout = applySpriteLayout;
|
|
7
|
+
//# sourceMappingURL=applySpriteLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applySpriteLayout.cjs","sources":["../../../src/components/appliers/applySpriteLayout.ts"],"sourcesContent":["/**\n * Layout applier for Sprite components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Applies layout props and updates layout size provider\n * Sprites are always headless (return minimal size)\n * @param sprite - Phaser Sprite object\n * @param _prev - Previous props (unused)\n * @param next - New props\n */\nexport function applySpriteLayout(\n sprite: Phaser.GameObjects.Sprite & {\n __layoutProps?: SpriteBaseProps\n },\n _prev: Partial<SpriteBaseProps & LayoutProps>,\n next: Partial<SpriteBaseProps & LayoutProps>\n): void {\n // Update layout props reference\n sprite.__layoutProps = next as SpriteBaseProps\n\n // Note: __getLayoutSize is set once in creator and never changes\n // Sprites are always headless (0.01x0.01)\n}\n"],"names":[],"mappings":";;AAcO,SAAS,kBACd,QAGA,OACA,MACM;AAEN,SAAO,gBAAgB;AAIzB;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LayoutProps } from '../../core-props';
|
|
2
|
+
import { SpriteBaseProps } from '../primitives/sprite';
|
|
3
|
+
/**
|
|
4
|
+
* Layout applier for Sprite components
|
|
5
|
+
*/
|
|
6
|
+
import type * as Phaser from 'phaser';
|
|
7
|
+
/**
|
|
8
|
+
* Applies layout props and updates layout size provider
|
|
9
|
+
* Sprites are always headless (return minimal size)
|
|
10
|
+
* @param sprite - Phaser Sprite object
|
|
11
|
+
* @param _prev - Previous props (unused)
|
|
12
|
+
* @param next - New props
|
|
13
|
+
*/
|
|
14
|
+
export declare function applySpriteLayout(sprite: Phaser.GameObjects.Sprite & {
|
|
15
|
+
__layoutProps?: SpriteBaseProps;
|
|
16
|
+
}, _prev: Partial<SpriteBaseProps & LayoutProps>, next: Partial<SpriteBaseProps & LayoutProps>): void;
|
|
17
|
+
//# sourceMappingURL=applySpriteLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applySpriteLayout.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applySpriteLayout.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,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG;IAClC,aAAa,CAAC,EAAE,eAAe,CAAA;CAChC,EACD,KAAK,EAAE,OAAO,CAAC,eAAe,GAAG,WAAW,CAAC,EAC7C,IAAI,EAAE,OAAO,CAAC,eAAe,GAAG,WAAW,CAAC,GAC3C,IAAI,CAMN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applySpriteLayout.js","sources":["../../../src/components/appliers/applySpriteLayout.ts"],"sourcesContent":["/**\n * Layout applier for Sprite components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Applies layout props and updates layout size provider\n * Sprites are always headless (return minimal size)\n * @param sprite - Phaser Sprite object\n * @param _prev - Previous props (unused)\n * @param next - New props\n */\nexport function applySpriteLayout(\n sprite: Phaser.GameObjects.Sprite & {\n __layoutProps?: SpriteBaseProps\n },\n _prev: Partial<SpriteBaseProps & LayoutProps>,\n next: Partial<SpriteBaseProps & LayoutProps>\n): void {\n // Update layout props reference\n sprite.__layoutProps = next as SpriteBaseProps\n\n // Note: __getLayoutSize is set once in creator and never changes\n // Sprites are always headless (0.01x0.01)\n}\n"],"names":[],"mappings":"AAcO,SAAS,kBACd,QAGA,OACA,MACM;AAEN,SAAO,gBAAgB;AAIzB;"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxCore = require("@number10/jsx-core");
|
|
4
|
+
const fastDeepEqual = require("../../utils/fast-deep-equal.cjs");
|
|
5
|
+
const RESETTABLE_TEXT_STYLE_DEFAULTS = {
|
|
6
|
+
fontStyle: "normal",
|
|
7
|
+
fontWeight: "normal"
|
|
8
|
+
};
|
|
9
|
+
function clampAlpha(value) {
|
|
10
|
+
if (!Number.isFinite(value)) return 1;
|
|
11
|
+
return Math.max(0, Math.min(1, value));
|
|
12
|
+
}
|
|
13
|
+
function parseTextBackgroundColor(value) {
|
|
14
|
+
if (typeof value === "number") {
|
|
15
|
+
const rgb = jsxCore.numberToRgb(value);
|
|
16
|
+
return { red: rgb.r, green: rgb.g, blue: rgb.b, alpha: 1 };
|
|
17
|
+
}
|
|
18
|
+
const normalized = value.trim();
|
|
19
|
+
if (normalized.length === 0) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (normalized.startsWith("#")) {
|
|
23
|
+
const hex = normalized.slice(1);
|
|
24
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
25
|
+
const r = hex[0] ?? "0";
|
|
26
|
+
const g = hex[1] ?? "0";
|
|
27
|
+
const b = hex[2] ?? "0";
|
|
28
|
+
const a = hex[3] ?? "f";
|
|
29
|
+
return {
|
|
30
|
+
red: parseInt(r + r, 16),
|
|
31
|
+
green: parseInt(g + g, 16),
|
|
32
|
+
blue: parseInt(b + b, 16),
|
|
33
|
+
alpha: parseInt(a + a, 16) / 255
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (hex.length === 6 || hex.length === 8) {
|
|
37
|
+
return {
|
|
38
|
+
red: parseInt(hex.slice(0, 2), 16),
|
|
39
|
+
green: parseInt(hex.slice(2, 4), 16),
|
|
40
|
+
blue: parseInt(hex.slice(4, 6), 16),
|
|
41
|
+
alpha: hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const rgbaMatch = normalized.match(
|
|
46
|
+
/^rgba?\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*(?:,\s*([0-9.]+)\s*)?\)$/i
|
|
47
|
+
);
|
|
48
|
+
if (rgbaMatch) {
|
|
49
|
+
return {
|
|
50
|
+
red: Math.max(0, Math.min(255, Number(rgbaMatch[1]))),
|
|
51
|
+
green: Math.max(0, Math.min(255, Number(rgbaMatch[2]))),
|
|
52
|
+
blue: Math.max(0, Math.min(255, Number(rgbaMatch[3]))),
|
|
53
|
+
alpha: clampAlpha(Number(rgbaMatch[4] ?? 1))
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
function normalizeTextStyleBackground(style, alphaValue) {
|
|
59
|
+
if (style === void 0 || alphaValue === void 0 || style.backgroundColor === void 0) {
|
|
60
|
+
return style;
|
|
61
|
+
}
|
|
62
|
+
const parsed = parseTextBackgroundColor(style.backgroundColor);
|
|
63
|
+
if (!parsed) {
|
|
64
|
+
return style;
|
|
65
|
+
}
|
|
66
|
+
const effectiveAlpha = clampAlpha(parsed.alpha * clampAlpha(alphaValue));
|
|
67
|
+
const colorNumber = parsed.red << 16 | parsed.green << 8 | parsed.blue;
|
|
68
|
+
return {
|
|
69
|
+
...style,
|
|
70
|
+
backgroundColor: jsxCore.alpha(colorNumber, effectiveAlpha)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function getTextViewport(node) {
|
|
74
|
+
const surfaceViewport = node.__surfaceContext?.viewport;
|
|
75
|
+
if (typeof surfaceViewport?.width === "number" && typeof surfaceViewport?.height === "number") {
|
|
76
|
+
return surfaceViewport;
|
|
77
|
+
}
|
|
78
|
+
const width = node.scene?.scale?.width;
|
|
79
|
+
const height = node.scene?.scale?.height;
|
|
80
|
+
return {
|
|
81
|
+
width: typeof width === "number" ? width : 800,
|
|
82
|
+
height: typeof height === "number" ? height : 600
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function normalizeResettableTextStyle(nextStyle, prevStyle) {
|
|
86
|
+
if (nextStyle === void 0) {
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
let resolvedStyle = nextStyle;
|
|
90
|
+
for (const key of Object.keys(RESETTABLE_TEXT_STYLE_DEFAULTS)) {
|
|
91
|
+
if (nextStyle[key] !== void 0 || prevStyle?.[key] === void 0) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (resolvedStyle === nextStyle) {
|
|
95
|
+
resolvedStyle = { ...nextStyle };
|
|
96
|
+
}
|
|
97
|
+
resolvedStyle[key] = RESETTABLE_TEXT_STYLE_DEFAULTS[key];
|
|
98
|
+
}
|
|
99
|
+
return resolvedStyle;
|
|
100
|
+
}
|
|
101
|
+
function applyTextProps(node, prev, next) {
|
|
102
|
+
if (node.active === false || node.scene && !node.scene.sys.game) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
let needsUpdate = false;
|
|
106
|
+
if (prev.text !== next.text && typeof next.text === "string") {
|
|
107
|
+
node.setText(next.text);
|
|
108
|
+
needsUpdate = true;
|
|
109
|
+
}
|
|
110
|
+
const styleChanged = next.style !== void 0 && !fastDeepEqual(next.style, prev.style || {});
|
|
111
|
+
const alphaChanged = next.style?.backgroundColor !== void 0 && clampAlpha(next.alpha ?? 1) !== clampAlpha(prev.alpha ?? 1);
|
|
112
|
+
if (styleChanged || alphaChanged) {
|
|
113
|
+
try {
|
|
114
|
+
const resettableStyle = normalizeResettableTextStyle(next.style, prev.style);
|
|
115
|
+
const resolvedStyle = normalizeTextStyleBackground(resettableStyle, next.alpha);
|
|
116
|
+
if (resolvedStyle !== void 0) {
|
|
117
|
+
node.setStyle(resolvedStyle);
|
|
118
|
+
needsUpdate = true;
|
|
119
|
+
}
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.warn("Failed to apply text style (scene may be transitioning):", error);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (next.maxWidth !== prev.maxWidth && next.maxWidth !== void 0) {
|
|
125
|
+
const viewport = getTextViewport(node);
|
|
126
|
+
const parsedMaxWidth = jsxCore.parseSize(next.maxWidth);
|
|
127
|
+
const resolvedMaxWidth = jsxCore.resolveSize(
|
|
128
|
+
parsedMaxWidth,
|
|
129
|
+
viewport.width,
|
|
130
|
+
void 0,
|
|
131
|
+
void 0,
|
|
132
|
+
viewport
|
|
133
|
+
);
|
|
134
|
+
node.setWordWrapWidth(resolvedMaxWidth, true);
|
|
135
|
+
needsUpdate = true;
|
|
136
|
+
}
|
|
137
|
+
if (needsUpdate && node.updateText) {
|
|
138
|
+
node.updateText();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.applyTextProps = applyTextProps;
|
|
142
|
+
//# sourceMappingURL=applyText.cjs.map
|