@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 @@
|
|
|
1
|
+
{"version":3,"file":"applyText.cjs","sources":["../../../src/components/appliers/applyText.ts"],"sourcesContent":["/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport { numberToRgb, parseSize, resolveSize, alpha as withAlpha } from '@number10/jsx-core'\nimport type { TextSpecificProps } from '../../core-props'\nimport equal from '../../utils/fast-deep-equal'\n\n/**\n * Generic node type with text capabilities\n */\ntype TextNode = {\n setText: (text: string) => void\n setStyle: (style: Phaser.Types.GameObjects.Text.TextStyle) => void\n setWordWrapWidth: (width: number, useAdvancedWrap: boolean) => void\n updateText?: () => void // Force Phaser to recalculate text metrics immediately\n active?: boolean // Check if GameObject is still active\n scene?: Phaser.Scene // Access to scene for texture checks\n __surfaceContext?: {\n viewport?: { width: number; height: number }\n }\n}\n\ntype TextStyle = Phaser.Types.GameObjects.Text.TextStyle\ntype TextProps = Partial<TextSpecificProps & { alpha?: number; style?: TextStyle | undefined }>\ntype ResettableTextStyleKey = 'fontStyle' | 'fontWeight'\n\n/**\n * TextStyle with phaserjsx extensions (fontWeight maps to fontStyle at runtime)\n */\ntype TextStyleResettable = TextStyle & Record<ResettableTextStyleKey, string | undefined>\n\nconst RESETTABLE_TEXT_STYLE_DEFAULTS: Record<ResettableTextStyleKey, string> = {\n fontStyle: 'normal',\n fontWeight: 'normal',\n}\n\nfunction clampAlpha(value: number): number {\n if (!Number.isFinite(value)) return 1\n return Math.max(0, Math.min(1, value))\n}\n\nfunction parseTextBackgroundColor(\n value: string | number\n): { red: number; green: number; blue: number; alpha: number } | null {\n if (typeof value === 'number') {\n const rgb = numberToRgb(value)\n return { red: rgb.r, green: rgb.g, blue: rgb.b, alpha: 1 }\n }\n\n const normalized = value.trim()\n if (normalized.length === 0) {\n return null\n }\n\n if (normalized.startsWith('#')) {\n const hex = normalized.slice(1)\n if (hex.length === 3 || hex.length === 4) {\n const r = hex[0] ?? '0'\n const g = hex[1] ?? '0'\n const b = hex[2] ?? '0'\n const a = hex[3] ?? 'f'\n return {\n red: parseInt(r + r, 16),\n green: parseInt(g + g, 16),\n blue: parseInt(b + b, 16),\n alpha: parseInt(a + a, 16) / 255,\n }\n }\n\n if (hex.length === 6 || hex.length === 8) {\n return {\n red: parseInt(hex.slice(0, 2), 16),\n green: parseInt(hex.slice(2, 4), 16),\n blue: parseInt(hex.slice(4, 6), 16),\n alpha: hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1,\n }\n }\n }\n\n const rgbaMatch = normalized.match(\n /^rgba?\\(\\s*([0-9.]+)\\s*,\\s*([0-9.]+)\\s*,\\s*([0-9.]+)\\s*(?:,\\s*([0-9.]+)\\s*)?\\)$/i\n )\n if (rgbaMatch) {\n return {\n red: Math.max(0, Math.min(255, Number(rgbaMatch[1]))),\n green: Math.max(0, Math.min(255, Number(rgbaMatch[2]))),\n blue: Math.max(0, Math.min(255, Number(rgbaMatch[3]))),\n alpha: clampAlpha(Number(rgbaMatch[4] ?? 1)),\n }\n }\n\n return null\n}\n\nfunction normalizeTextStyleBackground(\n style: TextStyle | undefined,\n alphaValue: number | undefined\n) {\n if (style === undefined || alphaValue === undefined || style.backgroundColor === undefined) {\n return style\n }\n\n const parsed = parseTextBackgroundColor(style.backgroundColor as string | number)\n if (!parsed) {\n return style\n }\n\n const effectiveAlpha = clampAlpha(parsed.alpha * clampAlpha(alphaValue))\n const colorNumber = (parsed.red << 16) | (parsed.green << 8) | parsed.blue\n\n return {\n ...style,\n backgroundColor: withAlpha(colorNumber, effectiveAlpha),\n } satisfies TextStyle\n}\n\nfunction getTextViewport(node: TextNode): { width: number; height: number } {\n const surfaceViewport = node.__surfaceContext?.viewport\n if (typeof surfaceViewport?.width === 'number' && typeof surfaceViewport?.height === 'number') {\n return surfaceViewport\n }\n\n const width = node.scene?.scale?.width\n const height = node.scene?.scale?.height\n\n return {\n width: typeof width === 'number' ? width : 800,\n height: typeof height === 'number' ? height : 600,\n }\n}\n\nfunction normalizeResettableTextStyle(\n nextStyle: TextStyle | undefined,\n prevStyle: TextStyle | undefined\n): TextStyle | undefined {\n if (nextStyle === undefined) {\n return undefined\n }\n\n let resolvedStyle = nextStyle as TextStyleResettable\n\n for (const key of Object.keys(RESETTABLE_TEXT_STYLE_DEFAULTS) as ResettableTextStyleKey[]) {\n if (\n (nextStyle as TextStyleResettable)[key] !== undefined ||\n (prevStyle as TextStyleResettable | undefined)?.[key] === undefined\n ) {\n continue\n }\n\n if (resolvedStyle === (nextStyle as TextStyleResettable)) {\n resolvedStyle = { ...nextStyle } as TextStyleResettable\n }\n\n resolvedStyle[key] = RESETTABLE_TEXT_STYLE_DEFAULTS[key]\n }\n\n return resolvedStyle as TextStyle\n}\n\n/**\n * Applies text-specific properties (text content, color, font, alignment)\n * @param node - Phaser Text GameObject\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextProps<T extends TextNode>(\n node: T,\n prev: TextProps,\n next: TextProps\n): void {\n // Safety check: Ensure node is still active and scene is available\n if (node.active === false || (node.scene && !node.scene.sys.game)) {\n return\n }\n\n let needsUpdate = false\n\n // Text content\n if (prev.text !== next.text && typeof next.text === 'string') {\n node.setText(next.text)\n needsUpdate = true\n }\n\n const styleChanged = next.style !== undefined && !equal(next.style, prev.style || {})\n const alphaChanged =\n next.style?.backgroundColor !== undefined &&\n clampAlpha(next.alpha ?? 1) !== clampAlpha(prev.alpha ?? 1)\n\n if (styleChanged || alphaChanged) {\n // Guard against Phaser canvas context errors during theme updates\n try {\n const resettableStyle = normalizeResettableTextStyle(next.style, prev.style)\n const resolvedStyle = normalizeTextStyleBackground(resettableStyle, next.alpha)\n if (resolvedStyle !== undefined) {\n node.setStyle(resolvedStyle)\n needsUpdate = true\n }\n } catch (error) {\n console.warn('Failed to apply text style (scene may be transitioning):', error)\n }\n }\n\n // Word wrap width - resolve SizeValue to pixels\n if (next.maxWidth !== prev.maxWidth && next.maxWidth !== undefined) {\n const viewport = getTextViewport(node)\n const parsedMaxWidth = parseSize(next.maxWidth)\n const resolvedMaxWidth = resolveSize(\n parsedMaxWidth,\n viewport.width,\n undefined,\n undefined,\n viewport\n )\n node.setWordWrapWidth(resolvedMaxWidth, true)\n needsUpdate = true\n }\n\n // Force Phaser to recalculate text metrics immediately\n // This ensures getBounds() returns updated dimensions for layout calculations\n if (needsUpdate && node.updateText) {\n node.updateText()\n }\n}\n"],"names":["numberToRgb","withAlpha","equal","parseSize","resolveSize"],"mappings":";;;;AAgCA,MAAM,iCAAyE;AAAA,EAC7E,WAAW;AAAA,EACX,YAAY;AACd;AAEA,SAAS,WAAW,OAAuB;AACzC,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACpC,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC;AACvC;AAEA,SAAS,yBACP,OACoE;AACpE,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,MAAMA,QAAAA,YAAY,KAAK;AAC7B,WAAO,EAAE,KAAK,IAAI,GAAG,OAAO,IAAI,GAAG,MAAM,IAAI,GAAG,OAAO,EAAA;AAAA,EACzD;AAEA,QAAM,aAAa,MAAM,KAAA;AACzB,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,WAAW,WAAW,GAAG,GAAG;AAC9B,UAAM,MAAM,WAAW,MAAM,CAAC;AAC9B,QAAI,IAAI,WAAW,KAAK,IAAI,WAAW,GAAG;AACxC,YAAM,IAAI,IAAI,CAAC,KAAK;AACpB,YAAM,IAAI,IAAI,CAAC,KAAK;AACpB,YAAM,IAAI,IAAI,CAAC,KAAK;AACpB,YAAM,IAAI,IAAI,CAAC,KAAK;AACpB,aAAO;AAAA,QACL,KAAK,SAAS,IAAI,GAAG,EAAE;AAAA,QACvB,OAAO,SAAS,IAAI,GAAG,EAAE;AAAA,QACzB,MAAM,SAAS,IAAI,GAAG,EAAE;AAAA,QACxB,OAAO,SAAS,IAAI,GAAG,EAAE,IAAI;AAAA,MAAA;AAAA,IAEjC;AAEA,QAAI,IAAI,WAAW,KAAK,IAAI,WAAW,GAAG;AACxC,aAAO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UAAI,kBAAkB,QAAW;AAC/B,aAAK,SAAS,aAAa;AAC3B,sBAAc;AAAA,MAChB;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,KAAK,4DAA4D,KAAK;AAAA,IAChF;AAAA,EACF;AAGA,MAAI,KAAK,aAAa,KAAK,YAAY,KAAK,aAAa,QAAW;AAClE,UAAM,WAAW,gBAAgB,IAAI;AACrC,UAAM,iBAAiBC,QAAAA,UAAU,KAAK,QAAQ;AAC9C,UAAM,mBAAmBC,QAAAA;AAAAA,MACvB;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAEF,SAAK,iBAAiB,kBAAkB,IAAI;AAC5C,kBAAc;AAAA,EAChB;AAIA,MAAI,eAAe,KAAK,YAAY;AAClC,SAAK,WAAA;AAAA,EACP;AACF;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TextSpecificProps } from '../../core-props';
|
|
2
|
+
/**
|
|
3
|
+
* Generic node type with text capabilities
|
|
4
|
+
*/
|
|
5
|
+
type TextNode = {
|
|
6
|
+
setText: (text: string) => void;
|
|
7
|
+
setStyle: (style: Phaser.Types.GameObjects.Text.TextStyle) => void;
|
|
8
|
+
setWordWrapWidth: (width: number, useAdvancedWrap: boolean) => void;
|
|
9
|
+
updateText?: () => void;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
scene?: Phaser.Scene;
|
|
12
|
+
__surfaceContext?: {
|
|
13
|
+
viewport?: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type TextStyle = Phaser.Types.GameObjects.Text.TextStyle;
|
|
20
|
+
type TextProps = Partial<TextSpecificProps & {
|
|
21
|
+
alpha?: number;
|
|
22
|
+
style?: TextStyle | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Applies text-specific properties (text content, color, font, alignment)
|
|
26
|
+
* @param node - Phaser Text GameObject
|
|
27
|
+
* @param prev - Previous props
|
|
28
|
+
* @param next - New props
|
|
29
|
+
*/
|
|
30
|
+
export declare function applyTextProps<T extends TextNode>(node: T, prev: TextProps, next: TextProps): void;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=applyText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyText.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyText.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGzD;;GAEG;AACH,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,KAAK,IAAI,CAAA;IAClE,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,CAAA;IACnE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAA;IACpB,gBAAgB,CAAC,EAAE;QACjB,QAAQ,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KAC7C,CAAA;CACF,CAAA;AAED,KAAK,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAA;AACxD,KAAK,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,CAAC,CAAA;AAwI/F;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAC/C,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,SAAS,GACd,IAAI,CAqDN"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { parseSize, resolveSize, alpha, numberToRgb } from "@number10/jsx-core";
|
|
2
|
+
import equal from "../../utils/fast-deep-equal.js";
|
|
3
|
+
const RESETTABLE_TEXT_STYLE_DEFAULTS = {
|
|
4
|
+
fontStyle: "normal",
|
|
5
|
+
fontWeight: "normal"
|
|
6
|
+
};
|
|
7
|
+
function clampAlpha(value) {
|
|
8
|
+
if (!Number.isFinite(value)) return 1;
|
|
9
|
+
return Math.max(0, Math.min(1, value));
|
|
10
|
+
}
|
|
11
|
+
function parseTextBackgroundColor(value) {
|
|
12
|
+
if (typeof value === "number") {
|
|
13
|
+
const rgb = numberToRgb(value);
|
|
14
|
+
return { red: rgb.r, green: rgb.g, blue: rgb.b, alpha: 1 };
|
|
15
|
+
}
|
|
16
|
+
const normalized = value.trim();
|
|
17
|
+
if (normalized.length === 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
if (normalized.startsWith("#")) {
|
|
21
|
+
const hex = normalized.slice(1);
|
|
22
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
23
|
+
const r = hex[0] ?? "0";
|
|
24
|
+
const g = hex[1] ?? "0";
|
|
25
|
+
const b = hex[2] ?? "0";
|
|
26
|
+
const a = hex[3] ?? "f";
|
|
27
|
+
return {
|
|
28
|
+
red: parseInt(r + r, 16),
|
|
29
|
+
green: parseInt(g + g, 16),
|
|
30
|
+
blue: parseInt(b + b, 16),
|
|
31
|
+
alpha: parseInt(a + a, 16) / 255
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (hex.length === 6 || hex.length === 8) {
|
|
35
|
+
return {
|
|
36
|
+
red: parseInt(hex.slice(0, 2), 16),
|
|
37
|
+
green: parseInt(hex.slice(2, 4), 16),
|
|
38
|
+
blue: parseInt(hex.slice(4, 6), 16),
|
|
39
|
+
alpha: hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const rgbaMatch = normalized.match(
|
|
44
|
+
/^rgba?\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*(?:,\s*([0-9.]+)\s*)?\)$/i
|
|
45
|
+
);
|
|
46
|
+
if (rgbaMatch) {
|
|
47
|
+
return {
|
|
48
|
+
red: Math.max(0, Math.min(255, Number(rgbaMatch[1]))),
|
|
49
|
+
green: Math.max(0, Math.min(255, Number(rgbaMatch[2]))),
|
|
50
|
+
blue: Math.max(0, Math.min(255, Number(rgbaMatch[3]))),
|
|
51
|
+
alpha: clampAlpha(Number(rgbaMatch[4] ?? 1))
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function normalizeTextStyleBackground(style, alphaValue) {
|
|
57
|
+
if (style === void 0 || alphaValue === void 0 || style.backgroundColor === void 0) {
|
|
58
|
+
return style;
|
|
59
|
+
}
|
|
60
|
+
const parsed = parseTextBackgroundColor(style.backgroundColor);
|
|
61
|
+
if (!parsed) {
|
|
62
|
+
return style;
|
|
63
|
+
}
|
|
64
|
+
const effectiveAlpha = clampAlpha(parsed.alpha * clampAlpha(alphaValue));
|
|
65
|
+
const colorNumber = parsed.red << 16 | parsed.green << 8 | parsed.blue;
|
|
66
|
+
return {
|
|
67
|
+
...style,
|
|
68
|
+
backgroundColor: alpha(colorNumber, effectiveAlpha)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function getTextViewport(node) {
|
|
72
|
+
const surfaceViewport = node.__surfaceContext?.viewport;
|
|
73
|
+
if (typeof surfaceViewport?.width === "number" && typeof surfaceViewport?.height === "number") {
|
|
74
|
+
return surfaceViewport;
|
|
75
|
+
}
|
|
76
|
+
const width = node.scene?.scale?.width;
|
|
77
|
+
const height = node.scene?.scale?.height;
|
|
78
|
+
return {
|
|
79
|
+
width: typeof width === "number" ? width : 800,
|
|
80
|
+
height: typeof height === "number" ? height : 600
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function normalizeResettableTextStyle(nextStyle, prevStyle) {
|
|
84
|
+
if (nextStyle === void 0) {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
let resolvedStyle = nextStyle;
|
|
88
|
+
for (const key of Object.keys(RESETTABLE_TEXT_STYLE_DEFAULTS)) {
|
|
89
|
+
if (nextStyle[key] !== void 0 || prevStyle?.[key] === void 0) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (resolvedStyle === nextStyle) {
|
|
93
|
+
resolvedStyle = { ...nextStyle };
|
|
94
|
+
}
|
|
95
|
+
resolvedStyle[key] = RESETTABLE_TEXT_STYLE_DEFAULTS[key];
|
|
96
|
+
}
|
|
97
|
+
return resolvedStyle;
|
|
98
|
+
}
|
|
99
|
+
function applyTextProps(node, prev, next) {
|
|
100
|
+
if (node.active === false || node.scene && !node.scene.sys.game) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
let needsUpdate = false;
|
|
104
|
+
if (prev.text !== next.text && typeof next.text === "string") {
|
|
105
|
+
node.setText(next.text);
|
|
106
|
+
needsUpdate = true;
|
|
107
|
+
}
|
|
108
|
+
const styleChanged = next.style !== void 0 && !equal(next.style, prev.style || {});
|
|
109
|
+
const alphaChanged = next.style?.backgroundColor !== void 0 && clampAlpha(next.alpha ?? 1) !== clampAlpha(prev.alpha ?? 1);
|
|
110
|
+
if (styleChanged || alphaChanged) {
|
|
111
|
+
try {
|
|
112
|
+
const resettableStyle = normalizeResettableTextStyle(next.style, prev.style);
|
|
113
|
+
const resolvedStyle = normalizeTextStyleBackground(resettableStyle, next.alpha);
|
|
114
|
+
if (resolvedStyle !== void 0) {
|
|
115
|
+
node.setStyle(resolvedStyle);
|
|
116
|
+
needsUpdate = true;
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.warn("Failed to apply text style (scene may be transitioning):", error);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (next.maxWidth !== prev.maxWidth && next.maxWidth !== void 0) {
|
|
123
|
+
const viewport = getTextViewport(node);
|
|
124
|
+
const parsedMaxWidth = parseSize(next.maxWidth);
|
|
125
|
+
const resolvedMaxWidth = resolveSize(
|
|
126
|
+
parsedMaxWidth,
|
|
127
|
+
viewport.width,
|
|
128
|
+
void 0,
|
|
129
|
+
void 0,
|
|
130
|
+
viewport
|
|
131
|
+
);
|
|
132
|
+
node.setWordWrapWidth(resolvedMaxWidth, true);
|
|
133
|
+
needsUpdate = true;
|
|
134
|
+
}
|
|
135
|
+
if (needsUpdate && node.updateText) {
|
|
136
|
+
node.updateText();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
applyTextProps
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=applyText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyText.js","sources":["../../../src/components/appliers/applyText.ts"],"sourcesContent":["/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport { numberToRgb, parseSize, resolveSize, alpha as withAlpha } from '@number10/jsx-core'\nimport type { TextSpecificProps } from '../../core-props'\nimport equal from '../../utils/fast-deep-equal'\n\n/**\n * Generic node type with text capabilities\n */\ntype TextNode = {\n setText: (text: string) => void\n setStyle: (style: Phaser.Types.GameObjects.Text.TextStyle) => void\n setWordWrapWidth: (width: number, useAdvancedWrap: boolean) => void\n updateText?: () => void // Force Phaser to recalculate text metrics immediately\n active?: boolean // Check if GameObject is still active\n scene?: Phaser.Scene // Access to scene for texture checks\n __surfaceContext?: {\n viewport?: { width: number; height: number }\n }\n}\n\ntype TextStyle = Phaser.Types.GameObjects.Text.TextStyle\ntype TextProps = Partial<TextSpecificProps & { alpha?: number; style?: TextStyle | undefined }>\ntype ResettableTextStyleKey = 'fontStyle' | 'fontWeight'\n\n/**\n * TextStyle with phaserjsx extensions (fontWeight maps to fontStyle at runtime)\n */\ntype TextStyleResettable = TextStyle & Record<ResettableTextStyleKey, string | undefined>\n\nconst RESETTABLE_TEXT_STYLE_DEFAULTS: Record<ResettableTextStyleKey, string> = {\n fontStyle: 'normal',\n fontWeight: 'normal',\n}\n\nfunction clampAlpha(value: number): number {\n if (!Number.isFinite(value)) return 1\n return Math.max(0, Math.min(1, value))\n}\n\nfunction parseTextBackgroundColor(\n value: string | number\n): { red: number; green: number; blue: number; alpha: number } | null {\n if (typeof value === 'number') {\n const rgb = numberToRgb(value)\n return { red: rgb.r, green: rgb.g, blue: rgb.b, alpha: 1 }\n }\n\n const normalized = value.trim()\n if (normalized.length === 0) {\n return null\n }\n\n if (normalized.startsWith('#')) {\n const hex = normalized.slice(1)\n if (hex.length === 3 || hex.length === 4) {\n const r = hex[0] ?? '0'\n const g = hex[1] ?? '0'\n const b = hex[2] ?? '0'\n const a = hex[3] ?? 'f'\n return {\n red: parseInt(r + r, 16),\n green: parseInt(g + g, 16),\n blue: parseInt(b + b, 16),\n alpha: parseInt(a + a, 16) / 255,\n }\n }\n\n if (hex.length === 6 || hex.length === 8) {\n return {\n red: parseInt(hex.slice(0, 2), 16),\n green: parseInt(hex.slice(2, 4), 16),\n blue: parseInt(hex.slice(4, 6), 16),\n alpha: hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1,\n }\n }\n }\n\n const rgbaMatch = normalized.match(\n /^rgba?\\(\\s*([0-9.]+)\\s*,\\s*([0-9.]+)\\s*,\\s*([0-9.]+)\\s*(?:,\\s*([0-9.]+)\\s*)?\\)$/i\n )\n if (rgbaMatch) {\n return {\n red: Math.max(0, Math.min(255, Number(rgbaMatch[1]))),\n green: Math.max(0, Math.min(255, Number(rgbaMatch[2]))),\n blue: Math.max(0, Math.min(255, Number(rgbaMatch[3]))),\n alpha: clampAlpha(Number(rgbaMatch[4] ?? 1)),\n }\n }\n\n return null\n}\n\nfunction normalizeTextStyleBackground(\n style: TextStyle | undefined,\n alphaValue: number | undefined\n) {\n if (style === undefined || alphaValue === undefined || style.backgroundColor === undefined) {\n return style\n }\n\n const parsed = parseTextBackgroundColor(style.backgroundColor as string | number)\n if (!parsed) {\n return style\n }\n\n const effectiveAlpha = clampAlpha(parsed.alpha * clampAlpha(alphaValue))\n const colorNumber = (parsed.red << 16) | (parsed.green << 8) | parsed.blue\n\n return {\n ...style,\n backgroundColor: withAlpha(colorNumber, effectiveAlpha),\n } satisfies TextStyle\n}\n\nfunction getTextViewport(node: TextNode): { width: number; height: number } {\n const surfaceViewport = node.__surfaceContext?.viewport\n if (typeof surfaceViewport?.width === 'number' && typeof surfaceViewport?.height === 'number') {\n return surfaceViewport\n }\n\n const width = node.scene?.scale?.width\n const height = node.scene?.scale?.height\n\n return {\n width: typeof width === 'number' ? width : 800,\n height: typeof height === 'number' ? height : 600,\n }\n}\n\nfunction normalizeResettableTextStyle(\n nextStyle: TextStyle | undefined,\n prevStyle: TextStyle | undefined\n): TextStyle | undefined {\n if (nextStyle === undefined) {\n return undefined\n }\n\n let resolvedStyle = nextStyle as TextStyleResettable\n\n for (const key of Object.keys(RESETTABLE_TEXT_STYLE_DEFAULTS) as ResettableTextStyleKey[]) {\n if (\n (nextStyle as TextStyleResettable)[key] !== undefined ||\n (prevStyle as TextStyleResettable | undefined)?.[key] === undefined\n ) {\n continue\n }\n\n if (resolvedStyle === (nextStyle as TextStyleResettable)) {\n resolvedStyle = { ...nextStyle } as TextStyleResettable\n }\n\n resolvedStyle[key] = RESETTABLE_TEXT_STYLE_DEFAULTS[key]\n }\n\n return resolvedStyle as TextStyle\n}\n\n/**\n * Applies text-specific properties (text content, color, font, alignment)\n * @param node - Phaser Text GameObject\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextProps<T extends TextNode>(\n node: T,\n prev: TextProps,\n next: TextProps\n): void {\n // Safety check: Ensure node is still active and scene is available\n if (node.active === false || (node.scene && !node.scene.sys.game)) {\n return\n }\n\n let needsUpdate = false\n\n // Text content\n if (prev.text !== next.text && typeof next.text === 'string') {\n node.setText(next.text)\n needsUpdate = true\n }\n\n const styleChanged = next.style !== undefined && !equal(next.style, prev.style || {})\n const alphaChanged =\n next.style?.backgroundColor !== undefined &&\n clampAlpha(next.alpha ?? 1) !== clampAlpha(prev.alpha ?? 1)\n\n if (styleChanged || alphaChanged) {\n // Guard against Phaser canvas context errors during theme updates\n try {\n const resettableStyle = normalizeResettableTextStyle(next.style, prev.style)\n const resolvedStyle = normalizeTextStyleBackground(resettableStyle, next.alpha)\n if (resolvedStyle !== undefined) {\n node.setStyle(resolvedStyle)\n needsUpdate = true\n }\n } catch (error) {\n console.warn('Failed to apply text style (scene may be transitioning):', error)\n }\n }\n\n // Word wrap width - resolve SizeValue to pixels\n if (next.maxWidth !== prev.maxWidth && next.maxWidth !== undefined) {\n const viewport = getTextViewport(node)\n const parsedMaxWidth = parseSize(next.maxWidth)\n const resolvedMaxWidth = resolveSize(\n parsedMaxWidth,\n viewport.width,\n undefined,\n undefined,\n viewport\n )\n node.setWordWrapWidth(resolvedMaxWidth, true)\n needsUpdate = true\n }\n\n // Force Phaser to recalculate text metrics immediately\n // This ensures getBounds() returns updated dimensions for layout calculations\n if (needsUpdate && node.updateText) {\n node.updateText()\n }\n}\n"],"names":["withAlpha"],"mappings":";;AAgCA,MAAM,iCAAyE;AAAA,EAC7E,WAAW;AAAA,EACX,YAAY;AACd;AAEA,SAAS,WAAW,OAAuB;AACzC,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACpC,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC;AACvC;AAEA,SAAS,yBACP,OACoE;AACpE,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,MAAM,YAAY,KAAK;AAC7B,WAAO,EAAE,KAAK,IAAI,GAAG,OAAO,IAAI,GAAG,MAAM,IAAI,GAAG,OAAO,EAAA;AAAA,EACzD;AA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, _prev, next) {
|
|
4
|
+
text.__layoutProps = next;
|
|
5
|
+
text.__getLayoutSize = () => {
|
|
6
|
+
if (text.__layoutProps?.headless) {
|
|
7
|
+
return { width: 0.01, height: 0.01 };
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
width: text.width,
|
|
11
|
+
height: text.height
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.applyTextLayout = applyTextLayout;
|
|
16
|
+
//# sourceMappingURL=applyTextLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyTextLayout.cjs","sources":["../../../src/components/appliers/applyTextLayout.ts"],"sourcesContent":["/**\n * Layout applier for text components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { TextBaseProps } from '../primitives/text'\n\n/**\n * Applies layout properties for text components\n * Updates layout props and size provider when text or style changes\n * @param text - Phaser text object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextLayout(\n text: Phaser.GameObjects.Text & {\n __layoutProps?: TextBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n _prev: Partial<TextBaseProps>,\n next: Partial<TextBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation\n text.__layoutProps = next as TextBaseProps\n\n // ALWAYS recreate size provider to ensure VDOM detects size changes\n // Even if function reference changes, VDOM needs to know dimensions might have changed\n // Previously: Only updated if text/style changed - this caused layout not to recalculate\n // when text dimensions changed (e.g., \"9 times\" -> \"10 times\")\n text.__getLayoutSize = () => {\n if (text.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: text.width,\n height: text.height,\n }\n }\n}\n"],"names":[],"mappings":";;AAcO,SAAS,gBACd,MAIA,OACA,MACM;AAEN,OAAK,gBAAgB;AAMrB,OAAK,kBAAkB,MAAM;AAC3B,QAAI,KAAK,eAAe,UAAU;AAChC,aAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,IAChC;AACA,WAAO;AAAA,MACL,OAAO,KAAK;AAAA,MACZ,QAAQ,KAAK;AAAA,IAAA;AAAA,EAEjB;AACF;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LayoutSize } from '../../layout/index';
|
|
2
|
+
import { TextBaseProps } from '../primitives/text';
|
|
3
|
+
/**
|
|
4
|
+
* Layout applier for text components
|
|
5
|
+
*/
|
|
6
|
+
import type * as Phaser from 'phaser';
|
|
7
|
+
/**
|
|
8
|
+
* Applies layout properties for text components
|
|
9
|
+
* Updates layout props and size provider when text or style changes
|
|
10
|
+
* @param text - Phaser text object
|
|
11
|
+
* @param prev - Previous props
|
|
12
|
+
* @param next - New props
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyTextLayout(text: Phaser.GameObjects.Text & {
|
|
15
|
+
__layoutProps?: TextBaseProps;
|
|
16
|
+
__getLayoutSize?: () => LayoutSize;
|
|
17
|
+
}, _prev: Partial<TextBaseProps>, next: Partial<TextBaseProps>): void;
|
|
18
|
+
//# sourceMappingURL=applyTextLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyTextLayout.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyTextLayout.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,GAAG;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,UAAU,CAAA;CACnC,EACD,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,EAC7B,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,GAC3B,IAAI,CAiBN"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function applyTextLayout(text, _prev, next) {
|
|
2
|
+
text.__layoutProps = next;
|
|
3
|
+
text.__getLayoutSize = () => {
|
|
4
|
+
if (text.__layoutProps?.headless) {
|
|
5
|
+
return { width: 0.01, height: 0.01 };
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
width: text.width,
|
|
9
|
+
height: text.height
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
applyTextLayout
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=applyTextLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyTextLayout.js","sources":["../../../src/components/appliers/applyTextLayout.ts"],"sourcesContent":["/**\n * Layout applier for text components\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { TextBaseProps } from '../primitives/text'\n\n/**\n * Applies layout properties for text components\n * Updates layout props and size provider when text or style changes\n * @param text - Phaser text object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextLayout(\n text: Phaser.GameObjects.Text & {\n __layoutProps?: TextBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n _prev: Partial<TextBaseProps>,\n next: Partial<TextBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation\n text.__layoutProps = next as TextBaseProps\n\n // ALWAYS recreate size provider to ensure VDOM detects size changes\n // Even if function reference changes, VDOM needs to know dimensions might have changed\n // Previously: Only updated if text/style changed - this caused layout not to recalculate\n // when text dimensions changed (e.g., \"9 times\" -> \"10 times\")\n text.__getLayoutSize = () => {\n if (text.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: text.width,\n height: text.height,\n }\n }\n}\n"],"names":[],"mappings":"AAcO,SAAS,gBACd,MAIA,OACA,MACM;AAEN,OAAK,gBAAgB;AAMrB,OAAK,kBAAkB,MAAM;AAC3B,QAAI,KAAK,eAAe,UAAU;AAChC,aAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,IAChC;AACA,WAAO;AAAA,MACL,OAAO,KAAK;AAAA,MACZ,QAAQ,KAAK;AAAA,IAAA;AAAA,EAEjB;AACF;"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("phaser");
|
|
4
|
+
const theme = require("../../theme.cjs");
|
|
5
|
+
const backgroundImage = require("../backgroundImage.cjs");
|
|
6
|
+
function getTooltipTheme() {
|
|
7
|
+
return theme.themeRegistry.getComponentTheme("Tooltip");
|
|
8
|
+
}
|
|
9
|
+
const tooltipStates = /* @__PURE__ */ new Map();
|
|
10
|
+
function calculateTooltipPosition(targetBounds, position, offset, tooltipWidth, tooltipHeight) {
|
|
11
|
+
const viewport = {
|
|
12
|
+
width: window.innerWidth,
|
|
13
|
+
height: window.innerHeight
|
|
14
|
+
};
|
|
15
|
+
let x = 0;
|
|
16
|
+
let y = 0;
|
|
17
|
+
switch (position) {
|
|
18
|
+
case "top":
|
|
19
|
+
x = targetBounds.centerX - tooltipWidth / 2;
|
|
20
|
+
y = targetBounds.top - tooltipHeight - offset;
|
|
21
|
+
break;
|
|
22
|
+
case "bottom":
|
|
23
|
+
x = targetBounds.centerX - tooltipWidth / 2;
|
|
24
|
+
y = targetBounds.bottom + offset;
|
|
25
|
+
break;
|
|
26
|
+
case "left":
|
|
27
|
+
x = targetBounds.left - tooltipWidth - offset;
|
|
28
|
+
y = targetBounds.centerY - tooltipHeight / 2;
|
|
29
|
+
break;
|
|
30
|
+
case "right":
|
|
31
|
+
x = targetBounds.right + offset;
|
|
32
|
+
y = targetBounds.centerY - tooltipHeight / 2;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
x = Math.max(8, Math.min(x, viewport.width - tooltipWidth - 8));
|
|
36
|
+
y = Math.max(8, Math.min(y, viewport.height - tooltipHeight - 8));
|
|
37
|
+
return { x, y };
|
|
38
|
+
}
|
|
39
|
+
function showTooltip(scene, container, config) {
|
|
40
|
+
const state = tooltipStates.get(container);
|
|
41
|
+
if (!state || state.isVisible) return;
|
|
42
|
+
state.isVisible = true;
|
|
43
|
+
state.currentConfig = config;
|
|
44
|
+
const tooltipTheme = getTooltipTheme();
|
|
45
|
+
const position = config.position ?? tooltipTheme.position ?? "top";
|
|
46
|
+
const offset = config.offset ?? tooltipTheme.offset ?? 8;
|
|
47
|
+
const content = config.content;
|
|
48
|
+
const targetBounds = container.getBounds();
|
|
49
|
+
const textStyle = tooltipTheme.textStyle ?? {
|
|
50
|
+
fontSize: "14px",
|
|
51
|
+
fontFamily: "Arial",
|
|
52
|
+
color: "#ffffff",
|
|
53
|
+
padding: { x: 8, y: 4 }
|
|
54
|
+
};
|
|
55
|
+
const { backgroundColor: bgColor, ...styleWithoutBg } = textStyle;
|
|
56
|
+
const text = scene.add.text(
|
|
57
|
+
0,
|
|
58
|
+
0,
|
|
59
|
+
content,
|
|
60
|
+
styleWithoutBg
|
|
61
|
+
);
|
|
62
|
+
text.setOrigin(0.5);
|
|
63
|
+
const padding = textStyle.padding ?? { x: 8, y: 4 };
|
|
64
|
+
const paddingX = typeof padding === "number" ? padding : padding.x ?? 8;
|
|
65
|
+
const paddingY = typeof padding === "number" ? padding : padding.y ?? 4;
|
|
66
|
+
const textWidth = text.width;
|
|
67
|
+
const textHeight = text.height;
|
|
68
|
+
const bgWidth = textWidth + paddingX * 2;
|
|
69
|
+
const bgHeight = textHeight + paddingY * 2;
|
|
70
|
+
const bg = bgColor ?? "#000000dd";
|
|
71
|
+
let fillColor = 0;
|
|
72
|
+
let fillAlpha = 0.87;
|
|
73
|
+
if (typeof bg === "string") {
|
|
74
|
+
if (bg.startsWith("#")) {
|
|
75
|
+
const hex = bg.slice(1);
|
|
76
|
+
if (hex.length === 8) {
|
|
77
|
+
fillColor = parseInt(hex.slice(0, 6), 16);
|
|
78
|
+
fillAlpha = parseInt(hex.slice(6, 8), 16) / 255;
|
|
79
|
+
} else if (hex.length === 6) {
|
|
80
|
+
fillColor = parseInt(hex, 16);
|
|
81
|
+
fillAlpha = 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const background = backgroundImage.createBackgroundImage(
|
|
86
|
+
scene,
|
|
87
|
+
{
|
|
88
|
+
backgroundColor: fillColor,
|
|
89
|
+
backgroundAlpha: fillAlpha,
|
|
90
|
+
cornerRadius: tooltipTheme.cornerRadius ?? 6
|
|
91
|
+
},
|
|
92
|
+
bgWidth,
|
|
93
|
+
bgHeight
|
|
94
|
+
);
|
|
95
|
+
if (!background) {
|
|
96
|
+
text.destroy();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
background.setOrigin(0.5, 0.5);
|
|
100
|
+
const tooltipContainer = scene.add.container(0, 0, [background, text]);
|
|
101
|
+
tooltipContainer.setDepth(1e4);
|
|
102
|
+
const textBounds = tooltipContainer.getBounds();
|
|
103
|
+
const pos = calculateTooltipPosition(
|
|
104
|
+
targetBounds,
|
|
105
|
+
position,
|
|
106
|
+
offset,
|
|
107
|
+
textBounds.width,
|
|
108
|
+
textBounds.height
|
|
109
|
+
);
|
|
110
|
+
const themeAnim = tooltipTheme.animation || {};
|
|
111
|
+
const anim = config.animation || {};
|
|
112
|
+
const fadeInDuration = anim.fadeIn ?? themeAnim.fadeIn ?? 200;
|
|
113
|
+
const moveOffset = {
|
|
114
|
+
dx: anim.move?.dx ?? themeAnim.move?.dx ?? 0,
|
|
115
|
+
dy: anim.move?.dy ?? themeAnim.move?.dy ?? 0
|
|
116
|
+
};
|
|
117
|
+
const pulse = anim.pulse ?? themeAnim.pulse ?? false;
|
|
118
|
+
const pulseScale = anim.pulseScale ?? [0.75, 1.25];
|
|
119
|
+
tooltipContainer.setPosition(
|
|
120
|
+
pos.x + textBounds.width / 2 - moveOffset.dx,
|
|
121
|
+
pos.y + textBounds.height / 2 - moveOffset.dy
|
|
122
|
+
);
|
|
123
|
+
tooltipContainer.setAlpha(0);
|
|
124
|
+
state.tooltip = tooltipContainer;
|
|
125
|
+
const fadeTween = scene.tweens.add({
|
|
126
|
+
targets: tooltipContainer,
|
|
127
|
+
alpha: 1,
|
|
128
|
+
x: pos.x + textBounds.width / 2,
|
|
129
|
+
y: pos.y + textBounds.height / 2,
|
|
130
|
+
duration: fadeInDuration,
|
|
131
|
+
ease: "Cubic.Out"
|
|
132
|
+
});
|
|
133
|
+
state.activeTweens.push(fadeTween);
|
|
134
|
+
if (pulse) {
|
|
135
|
+
const pulseTween = scene.tweens.add({
|
|
136
|
+
targets: tooltipContainer,
|
|
137
|
+
scale: { from: pulseScale[0], to: pulseScale[1] },
|
|
138
|
+
duration: 600,
|
|
139
|
+
yoyo: true,
|
|
140
|
+
repeat: -1,
|
|
141
|
+
ease: "Sine.InOut"
|
|
142
|
+
});
|
|
143
|
+
state.activeTweens.push(pulseTween);
|
|
144
|
+
}
|
|
145
|
+
if (config.autoDismiss && config.autoDismiss > 0) {
|
|
146
|
+
state.autoDismissTimer = setTimeout(() => {
|
|
147
|
+
hideTooltip(container);
|
|
148
|
+
}, config.autoDismiss);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function hideTooltip(container) {
|
|
152
|
+
const state = tooltipStates.get(container);
|
|
153
|
+
if (!state || !state.isVisible) return;
|
|
154
|
+
state.isVisible = false;
|
|
155
|
+
const config = state.currentConfig;
|
|
156
|
+
state.currentConfig = null;
|
|
157
|
+
if (state.autoDismissTimer) {
|
|
158
|
+
clearTimeout(state.autoDismissTimer);
|
|
159
|
+
state.autoDismissTimer = null;
|
|
160
|
+
}
|
|
161
|
+
if (!state.tooltip) return;
|
|
162
|
+
const tooltip = state.tooltip;
|
|
163
|
+
const scene = tooltip.scene;
|
|
164
|
+
const tooltipTheme = getTooltipTheme();
|
|
165
|
+
const themeAnim = tooltipTheme.animation || {};
|
|
166
|
+
const anim = config?.animation || {};
|
|
167
|
+
const fadeOutDuration = anim.fadeOut ?? themeAnim.fadeOut ?? 200;
|
|
168
|
+
state.activeTweens.forEach((tween) => tween.stop());
|
|
169
|
+
state.activeTweens = [];
|
|
170
|
+
scene.tweens.add({
|
|
171
|
+
targets: tooltip,
|
|
172
|
+
alpha: 0,
|
|
173
|
+
duration: fadeOutDuration,
|
|
174
|
+
ease: "Cubic.In",
|
|
175
|
+
onComplete: () => {
|
|
176
|
+
tooltip.destroy();
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
state.tooltip = null;
|
|
180
|
+
}
|
|
181
|
+
function applyTooltip(scene, container, nextCallback, existingOnHoverStart, existingOnHoverEnd) {
|
|
182
|
+
if (!tooltipStates.has(container)) {
|
|
183
|
+
tooltipStates.set(container, {
|
|
184
|
+
isVisible: false,
|
|
185
|
+
tooltip: null,
|
|
186
|
+
activeTweens: [],
|
|
187
|
+
showTimer: null,
|
|
188
|
+
hideTimer: null,
|
|
189
|
+
autoDismissTimer: null,
|
|
190
|
+
currentConfig: null
|
|
191
|
+
});
|
|
192
|
+
container.once("destroy", () => {
|
|
193
|
+
const state2 = tooltipStates.get(container);
|
|
194
|
+
if (state2) {
|
|
195
|
+
if (state2.showTimer) clearTimeout(state2.showTimer);
|
|
196
|
+
if (state2.hideTimer) clearTimeout(state2.hideTimer);
|
|
197
|
+
if (state2.autoDismissTimer) clearTimeout(state2.autoDismissTimer);
|
|
198
|
+
state2.activeTweens.forEach((tween) => tween.stop());
|
|
199
|
+
hideTooltip(container);
|
|
200
|
+
tooltipStates.delete(container);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const state = tooltipStates.get(container);
|
|
205
|
+
if (!state) {
|
|
206
|
+
throw new Error("applyTooltip: state not initialized");
|
|
207
|
+
}
|
|
208
|
+
const tooltipTheme = getTooltipTheme();
|
|
209
|
+
const onHoverStart = (data) => {
|
|
210
|
+
if (existingOnHoverStart) existingOnHoverStart(data);
|
|
211
|
+
if (!nextCallback) return;
|
|
212
|
+
const result = nextCallback();
|
|
213
|
+
if (!result) return;
|
|
214
|
+
const config = typeof result === "string" ? { content: result } : result;
|
|
215
|
+
if (config.disabled) return;
|
|
216
|
+
if (state.hideTimer) {
|
|
217
|
+
clearTimeout(state.hideTimer);
|
|
218
|
+
state.hideTimer = null;
|
|
219
|
+
}
|
|
220
|
+
if (state.autoDismissTimer) {
|
|
221
|
+
clearTimeout(state.autoDismissTimer);
|
|
222
|
+
state.autoDismissTimer = null;
|
|
223
|
+
}
|
|
224
|
+
const showDelay = config.showDelay ?? tooltipTheme.showDelay ?? 500;
|
|
225
|
+
state.showTimer = setTimeout(() => {
|
|
226
|
+
showTooltip(scene, container, config);
|
|
227
|
+
}, showDelay);
|
|
228
|
+
};
|
|
229
|
+
const onHoverEnd = (data) => {
|
|
230
|
+
if (existingOnHoverEnd) existingOnHoverEnd(data);
|
|
231
|
+
if (state.showTimer) {
|
|
232
|
+
clearTimeout(state.showTimer);
|
|
233
|
+
state.showTimer = null;
|
|
234
|
+
}
|
|
235
|
+
const hideDelay = state.currentConfig?.hideDelay ?? tooltipTheme.hideDelay ?? 0;
|
|
236
|
+
if (hideDelay > 0) {
|
|
237
|
+
state.hideTimer = setTimeout(() => {
|
|
238
|
+
hideTooltip(container);
|
|
239
|
+
}, hideDelay);
|
|
240
|
+
} else {
|
|
241
|
+
hideTooltip(container);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
return { onHoverStart, onHoverEnd };
|
|
245
|
+
}
|
|
246
|
+
exports.applyTooltip = applyTooltip;
|
|
247
|
+
//# sourceMappingURL=applyTooltip.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyTooltip.cjs","sources":["../../../src/components/appliers/applyTooltip.ts"],"sourcesContent":["/**\n * Tooltip applier for component patching\n * Manages native Phaser text tooltip rendering with animations\n */\nimport * as Phaser from 'phaser'\nimport type { HoverEventData } from '../../gestures/gesture-types'\nimport { themeRegistry, type Theme } from '../../theme'\nimport type { TooltipCallback, TooltipConfig } from '../../tooltip/tooltip-types'\nimport { createBackgroundImage } from '../backgroundImage'\n\ntype TooltipTheme = NonNullable<Theme['Tooltip']>\n\nfunction getTooltipTheme(): TooltipTheme {\n return themeRegistry.getComponentTheme<TooltipTheme>('Tooltip')\n}\n\n/**\n * Internal state for tooltip management per container\n */\ninterface TooltipState {\n isVisible: boolean\n tooltip: Phaser.GameObjects.Container | null\n activeTweens: Phaser.Tweens.Tween[]\n showTimer: ReturnType<typeof setTimeout> | null\n hideTimer: ReturnType<typeof setTimeout> | null\n autoDismissTimer: ReturnType<typeof setTimeout> | null\n currentConfig: TooltipConfig | null\n}\n\n// Map to store tooltip state for each container\nconst tooltipStates = new Map<Phaser.GameObjects.Container, TooltipState>()\n\n/**\n * Calculate tooltip position based on target bounds and preferred position\n * Auto-adjusts if tooltip would go out of viewport bounds\n */\nfunction calculateTooltipPosition(\n targetBounds: Phaser.Geom.Rectangle,\n position: 'top' | 'bottom' | 'left' | 'right',\n offset: number,\n tooltipWidth: number,\n tooltipHeight: number\n): { x: number; y: number } {\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n let x = 0\n let y = 0\n\n switch (position) {\n case 'top':\n x = targetBounds.centerX - tooltipWidth / 2\n y = targetBounds.top - tooltipHeight - offset\n break\n case 'bottom':\n x = targetBounds.centerX - tooltipWidth / 2\n y = targetBounds.bottom + offset\n break\n case 'left':\n x = targetBounds.left - tooltipWidth - offset\n y = targetBounds.centerY - tooltipHeight / 2\n break\n case 'right':\n x = targetBounds.right + offset\n y = targetBounds.centerY - tooltipHeight / 2\n break\n }\n\n // Clamp to viewport bounds (with small padding)\n x = Math.max(8, Math.min(x, viewport.width - tooltipWidth - 8))\n y = Math.max(8, Math.min(y, viewport.height - tooltipHeight - 8))\n\n return { x, y }\n}\n\n/**\n * Show native Phaser text tooltip with animations\n */\nfunction showTooltip(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n config: TooltipConfig\n): void {\n const state = tooltipStates.get(container)\n if (!state || state.isVisible) return\n\n state.isVisible = true\n state.currentConfig = config\n\n const tooltipTheme = getTooltipTheme()\n\n const position = config.position ?? tooltipTheme.position ?? 'top'\n const offset = config.offset ?? tooltipTheme.offset ?? 8\n\n const content = config.content\n\n // Get target bounds\n const targetBounds = container.getBounds()\n\n // Create text without background first to measure\n const textStyle = tooltipTheme.textStyle ?? {\n fontSize: '14px',\n fontFamily: 'Arial',\n color: '#ffffff',\n padding: { x: 8, y: 4 },\n }\n\n // Remove backgroundColor from textStyle, we'll draw it manually\n const { backgroundColor: bgColor, ...styleWithoutBg } = textStyle\n\n const text = scene.add.text(\n 0,\n 0,\n content,\n styleWithoutBg as Phaser.Types.GameObjects.Text.TextStyle\n )\n text.setOrigin(0.5)\n\n // Measure text with padding\n const padding = textStyle.padding ?? { x: 8, y: 4 }\n const paddingX = typeof padding === 'number' ? padding : (padding.x ?? 8)\n const paddingY = typeof padding === 'number' ? padding : (padding.y ?? 4)\n const textWidth = text.width\n const textHeight = text.height\n const bgWidth = textWidth + paddingX * 2\n const bgHeight = textHeight + paddingY * 2\n\n // Parse background color\n const bg = bgColor ?? '#000000dd'\n let fillColor = 0x000000\n let fillAlpha = 0.87\n\n if (typeof bg === 'string') {\n if (bg.startsWith('#')) {\n // Handle hex with optional alpha\n const hex = bg.slice(1)\n if (hex.length === 8) {\n fillColor = parseInt(hex.slice(0, 6), 16)\n fillAlpha = parseInt(hex.slice(6, 8), 16) / 255\n } else if (hex.length === 6) {\n fillColor = parseInt(hex, 16)\n fillAlpha = 1\n }\n }\n }\n\n const background = createBackgroundImage(\n scene,\n {\n backgroundColor: fillColor,\n backgroundAlpha: fillAlpha,\n cornerRadius: tooltipTheme.cornerRadius ?? 6,\n },\n bgWidth,\n bgHeight\n )\n\n if (!background) {\n text.destroy()\n return\n }\n\n background.setOrigin(0.5, 0.5)\n\n // Create container for background + text\n const tooltipContainer = scene.add.container(0, 0, [background, text])\n tooltipContainer.setDepth(10000)\n\n // Measure container bounds\n const textBounds = tooltipContainer.getBounds()\n\n // Calculate position\n const pos = calculateTooltipPosition(\n targetBounds,\n position,\n offset,\n textBounds.width,\n textBounds.height\n )\n\n // Animation config - merge config with theme defaults\n const themeAnim = tooltipTheme.animation || {}\n const anim = config.animation || {}\n const fadeInDuration = anim.fadeIn ?? themeAnim.fadeIn ?? 200\n const moveOffset = {\n dx: anim.move?.dx ?? themeAnim.move?.dx ?? 0,\n dy: anim.move?.dy ?? themeAnim.move?.dy ?? 0,\n }\n const pulse = anim.pulse ?? themeAnim.pulse ?? false\n const pulseScale = anim.pulseScale ?? [0.75, 1.25]\n\n // Set initial position (with move offset if enabled)\n tooltipContainer.setPosition(\n pos.x + textBounds.width / 2 - moveOffset.dx,\n pos.y + textBounds.height / 2 - moveOffset.dy\n )\n tooltipContainer.setAlpha(0)\n\n state.tooltip = tooltipContainer\n\n // Fade in animation\n const fadeTween = scene.tweens.add({\n targets: tooltipContainer,\n alpha: 1,\n x: pos.x + textBounds.width / 2,\n y: pos.y + textBounds.height / 2,\n duration: fadeInDuration,\n ease: 'Cubic.Out',\n })\n state.activeTweens.push(fadeTween)\n\n // Pulse animation\n if (pulse) {\n const pulseTween = scene.tweens.add({\n targets: tooltipContainer,\n scale: { from: pulseScale[0], to: pulseScale[1] },\n duration: 600,\n yoyo: true,\n repeat: -1,\n ease: 'Sine.InOut',\n })\n state.activeTweens.push(pulseTween)\n }\n\n // Auto-dismiss timer if configured\n if (config.autoDismiss && config.autoDismiss > 0) {\n state.autoDismissTimer = setTimeout(() => {\n hideTooltip(container)\n }, config.autoDismiss)\n }\n}\n\n/**\n * Hide tooltip for a container\n */\nfunction hideTooltip(container: Phaser.GameObjects.Container): void {\n const state = tooltipStates.get(container)\n if (!state || !state.isVisible) return\n\n state.isVisible = false\n const config = state.currentConfig\n state.currentConfig = null\n\n // Clear auto-dismiss timer\n if (state.autoDismissTimer) {\n clearTimeout(state.autoDismissTimer)\n state.autoDismissTimer = null\n }\n\n if (!state.tooltip) return\n\n const tooltip = state.tooltip\n const scene = tooltip.scene\n\n // Get theme defaults for fade out\n const tooltipTheme = getTooltipTheme()\n const themeAnim = tooltipTheme.animation || {}\n const anim = config?.animation || {}\n const fadeOutDuration = anim.fadeOut ?? themeAnim.fadeOut ?? 200\n\n // Stop all existing tweens\n state.activeTweens.forEach((tween) => tween.stop())\n state.activeTweens = []\n\n // Fade out animation\n scene.tweens.add({\n targets: tooltip,\n alpha: 0,\n duration: fadeOutDuration,\n ease: 'Cubic.In',\n onComplete: () => {\n tooltip.destroy()\n },\n })\n\n state.tooltip = null\n}\n\n/**\n * Apply tooltip functionality to a container\n * Sets up hover handlers and manages tooltip lifecycle\n */\nexport function applyTooltip(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n nextCallback: TooltipCallback | undefined,\n existingOnHoverStart?: (data: HoverEventData) => void,\n existingOnHoverEnd?: (data: HoverEventData) => void\n): {\n onHoverStart: (data: HoverEventData) => void\n onHoverEnd: (data: HoverEventData) => void\n} {\n // Initialize state if needed\n if (!tooltipStates.has(container)) {\n tooltipStates.set(container, {\n isVisible: false,\n tooltip: null,\n activeTweens: [],\n showTimer: null,\n hideTimer: null,\n autoDismissTimer: null,\n currentConfig: null,\n })\n\n // Cleanup on container destroy\n container.once('destroy', () => {\n const state = tooltipStates.get(container)\n if (state) {\n if (state.showTimer) clearTimeout(state.showTimer)\n if (state.hideTimer) clearTimeout(state.hideTimer)\n if (state.autoDismissTimer) clearTimeout(state.autoDismissTimer)\n state.activeTweens.forEach((tween) => tween.stop())\n hideTooltip(container)\n tooltipStates.delete(container)\n }\n })\n }\n\n const state = tooltipStates.get(container)\n if (!state) {\n throw new Error('applyTooltip: state not initialized')\n }\n\n const tooltipTheme = getTooltipTheme()\n\n // Create hover handlers\n const onHoverStart = (data: HoverEventData) => {\n // Call existing handler if present\n if (existingOnHoverStart) existingOnHoverStart(data)\n\n // Get tooltip config\n if (!nextCallback) return\n\n const result = nextCallback()\n if (!result) return // null/undefined = no tooltip\n\n const config: TooltipConfig = typeof result === 'string' ? { content: result } : result\n\n if (config.disabled) return\n\n // Clear any pending hide/auto-dismiss timers\n if (state.hideTimer) {\n clearTimeout(state.hideTimer)\n state.hideTimer = null\n }\n if (state.autoDismissTimer) {\n clearTimeout(state.autoDismissTimer)\n state.autoDismissTimer = null\n }\n\n // Start show timer\n const showDelay = config.showDelay ?? tooltipTheme.showDelay ?? 500\n state.showTimer = setTimeout(() => {\n showTooltip(scene, container, config)\n }, showDelay)\n }\n\n const onHoverEnd = (data: HoverEventData) => {\n // Call existing handler if present\n if (existingOnHoverEnd) existingOnHoverEnd(data)\n\n // Clear any pending show timer\n if (state.showTimer) {\n clearTimeout(state.showTimer)\n state.showTimer = null\n }\n\n // Start hide timer\n const hideDelay = state.currentConfig?.hideDelay ?? tooltipTheme.hideDelay ?? 0\n if (hideDelay > 0) {\n state.hideTimer = setTimeout(() => {\n hideTooltip(container)\n }, hideDelay)\n } else {\n hideTooltip(container)\n }\n }\n\n return { onHoverStart, onHoverEnd }\n}\n"],"names":["themeRegistry","createBackgroundImage","state"],"mappings":";;;;;AAYA,SAAS,kBAAgC;AACvC,SAAOA,MAAAA,cAAc,kBAAgC,SAAS;AAChE;AAgBA,MAAM,oCAAoB,IAAA;AAM1B,SAAS,yBACP,cACA,UACA,QACA,cACA,eAC0B;AAC1B,QAAM,WAAW;AAAA,IACf,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,EAAA;AAGjB,MAAI,IAAI;AACR,MAAI,IAAI;AAER,UAAQ,UAAA;AAAA,IACN,KAAK;AACH,UAAI,aAAa,UAAU,eAAe;AAC1C,UAAI,aAAa,MAAM,gBAAgB;AACvC;AAAA,IACF,KAAK;AACH,UAAI,aAAa,UAAU,eAAe;AAC1C,UAAI,aAAa,SAAS;AAC1B;AAAA,IACF,KAAK;AACH,UAAI,aAAa,OAAO,eAAe;AACvC,UAAI,aAAa,UAAU,gBAAgB;AAC3C;AAAA,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wB,OAAO,WAAW,WAAW,EAAE,SAAS,WAAW;AAEjF,QAAI,OAAO,SAAU;AAGrB,QAAI,MAAM,WAAW;AACnB,mBAAa,MAAM,SAAS;AAC5B,YAAM,YAAY;AAAA,IACpB;AACA,QAAI,MAAM,kBAAkB;AAC1B,mBAAa,MAAM,gBAAgB;AACnC,YAAM,mBAAmB;AAAA,IAC3B;AAGA,UAAM,YAAY,OAAO,aAAa,aAAa,aAAa;AAChE,UAAM,YAAY,WAAW,MAAM;AACjC,kBAAY,OAAO,WAAW,MAAM;AAAA,IACtC,GAAG,SAAS;AAAA,EACd;AAEA,QAAM,aAAa,CAAC,SAAyB;AAE3C,QAAI,uCAAuC,IAAI;AAG/C,QAAI,MAAM,WAAW;AACnB,mBAAa,MAAM,SAAS;AAC5B,YAAM,YAAY;AAAA,IACpB;AAGA,UAAM,YAAY,MAAM,eAAe,aAAa,aAAa,aAAa;AAC9E,QAAI,YAAY,GAAG;AACjB,YAAM,YAAY,WAAW,MAAM;AACjC,oBAAY,SAAS;AAAA,MACvB,GAAG,SAAS;AAAA,IACd,OAAO;AACL,kBAAY,SAAS;AAAA,IACvB;AAAA,EACF;AAEA,SAAO,EAAE,cAAc,WAAA;AACzB;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HoverEventData } from '../../gestures/gesture-types';
|
|
2
|
+
import { TooltipCallback } from '../../tooltip/tooltip-types';
|
|
3
|
+
/**
|
|
4
|
+
* Tooltip applier for component patching
|
|
5
|
+
* Manages native Phaser text tooltip rendering with animations
|
|
6
|
+
*/
|
|
7
|
+
import * as Phaser from 'phaser';
|
|
8
|
+
/**
|
|
9
|
+
* Apply tooltip functionality to a container
|
|
10
|
+
* Sets up hover handlers and manages tooltip lifecycle
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyTooltip(scene: Phaser.Scene, container: Phaser.GameObjects.Container, nextCallback: TooltipCallback | undefined, existingOnHoverStart?: (data: HoverEventData) => void, existingOnHoverEnd?: (data: HoverEventData) => void): {
|
|
13
|
+
onHoverStart: (data: HoverEventData) => void;
|
|
14
|
+
onHoverEnd: (data: HoverEventData) => void;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=applyTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/appliers/applyTooltip.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAElE,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,6BAA6B,CAAA;AAiRjF;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACvC,YAAY,EAAE,eAAe,GAAG,SAAS,EACzC,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,EACrD,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GAClD;IACD,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;IAC5C,UAAU,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;CAC3C,CAwFA"}
|