@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,411 @@
|
|
|
1
|
+
import { isAnimatedSignal, resolveBorderSides, resolveCornerRadii, isUniformBorder, drawBorderGeometry, hasAnyCornerRadius } from "@number10/jsx-core";
|
|
2
|
+
import "phaser";
|
|
3
|
+
import { PhaserVectorDrawContext } from "../vector/PhaserVectorDrawContext.js";
|
|
4
|
+
const sceneBackgroundTextureCaches = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
class OffsetVectorDrawContext {
|
|
6
|
+
constructor(base, dx, dy) {
|
|
7
|
+
this.base = base;
|
|
8
|
+
this.dx = dx;
|
|
9
|
+
this.dy = dy;
|
|
10
|
+
}
|
|
11
|
+
base;
|
|
12
|
+
dx;
|
|
13
|
+
dy;
|
|
14
|
+
clear() {
|
|
15
|
+
this.base.clear();
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
fillStyle(color, alpha) {
|
|
19
|
+
this.base.fillStyle(color, alpha);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
lineStyle(width, color, alpha) {
|
|
23
|
+
this.base.lineStyle(width, color, alpha);
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
27
|
+
this.base.arc(x + this.dx, y + this.dy, radius, startAngle, endAngle, anticlockwise);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
fillCircle(x, y, radius) {
|
|
31
|
+
this.base.fillCircle(x + this.dx, y + this.dy, radius);
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
strokeCircle(x, y, radius) {
|
|
35
|
+
this.base.strokeCircle(x + this.dx, y + this.dy, radius);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
fillCircleStyled(x, y, radius, color, alpha) {
|
|
39
|
+
this.base.fillCircleStyled(x + this.dx, y + this.dy, radius, color, alpha);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
fillRect(x, y, width, height) {
|
|
43
|
+
this.base.fillRect(x + this.dx, y + this.dy, width, height);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
strokeRect(x, y, width, height) {
|
|
47
|
+
this.base.strokeRect(x + this.dx, y + this.dy, width, height);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
fillRoundedRect(x, y, width, height, radius) {
|
|
51
|
+
this.base.fillRoundedRect(x + this.dx, y + this.dy, width, height, radius);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
strokeRoundedRect(x, y, width, height, radius) {
|
|
55
|
+
this.base.strokeRoundedRect(x + this.dx, y + this.dy, width, height, radius);
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
beginPath() {
|
|
59
|
+
this.base.beginPath();
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
moveTo(x, y) {
|
|
63
|
+
this.base.moveTo(x + this.dx, y + this.dy);
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
lineTo(x, y) {
|
|
67
|
+
this.base.lineTo(x + this.dx, y + this.dy);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
closePath() {
|
|
71
|
+
this.base.closePath();
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
fillPath() {
|
|
75
|
+
this.base.fillPath();
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
strokePath() {
|
|
79
|
+
this.base.strokePath();
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
lineBetween(x1, y1, x2, y2) {
|
|
83
|
+
this.base.lineBetween(x1 + this.dx, y1 + this.dy, x2 + this.dx, y2 + this.dy);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
strokeLine(x1, y1, x2, y2, width, color, alpha) {
|
|
87
|
+
this.base.strokeLine(
|
|
88
|
+
x1 + this.dx,
|
|
89
|
+
y1 + this.dy,
|
|
90
|
+
x2 + this.dx,
|
|
91
|
+
y2 + this.dy,
|
|
92
|
+
width,
|
|
93
|
+
color,
|
|
94
|
+
alpha
|
|
95
|
+
);
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
fillArc(cx, cy, r, startAngle, endAngle, color, alpha) {
|
|
99
|
+
this.base.fillArc(cx + this.dx, cy + this.dy, r, startAngle, endAngle, color, alpha);
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function hasAdvancedBorder(props) {
|
|
104
|
+
const border = props.border;
|
|
105
|
+
if (!border) return false;
|
|
106
|
+
const w = resolveBorderSides(border.width);
|
|
107
|
+
return w.top > 0 || w.right > 0 || w.bottom > 0 || w.left > 0;
|
|
108
|
+
}
|
|
109
|
+
function normalizeBorderForCache(border) {
|
|
110
|
+
const width = border.width;
|
|
111
|
+
const widthStr = typeof width === "number" ? String(width) : `${width?.top ?? 0},${width?.right ?? 0},${width?.bottom ?? 0},${width?.left ?? 0}`;
|
|
112
|
+
return [
|
|
113
|
+
border.color ?? "none",
|
|
114
|
+
widthStr,
|
|
115
|
+
border.style ?? "solid",
|
|
116
|
+
border.dash?.join(",") ?? "",
|
|
117
|
+
border.dashOffset ?? 0,
|
|
118
|
+
border.cap ?? "",
|
|
119
|
+
border.join ?? "",
|
|
120
|
+
border.align ?? "center"
|
|
121
|
+
].join("|");
|
|
122
|
+
}
|
|
123
|
+
function hasRenderableBackground(props) {
|
|
124
|
+
const hasBackground = props.backgroundColor !== void 0;
|
|
125
|
+
const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== void 0;
|
|
126
|
+
const hasAdvanced = hasAdvancedBorder(props);
|
|
127
|
+
return hasBackground || hasBorder || hasAdvanced;
|
|
128
|
+
}
|
|
129
|
+
function hasRoundedCorners(radius) {
|
|
130
|
+
if (typeof radius === "number") {
|
|
131
|
+
return radius !== 0;
|
|
132
|
+
}
|
|
133
|
+
return (radius.tl ?? 0) !== 0 || (radius.tr ?? 0) !== 0 || (radius.bl ?? 0) !== 0 || (radius.br ?? 0) !== 0;
|
|
134
|
+
}
|
|
135
|
+
function insetCornerRadius(radius, inset) {
|
|
136
|
+
const insetSingleRadius = (value) => {
|
|
137
|
+
const resolved = value ?? 0;
|
|
138
|
+
const sign = resolved < 0 ? -1 : 1;
|
|
139
|
+
return sign * Math.max(0, Math.abs(resolved) - inset);
|
|
140
|
+
};
|
|
141
|
+
if (typeof radius === "number") {
|
|
142
|
+
return insetSingleRadius(radius);
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
tl: insetSingleRadius(radius.tl),
|
|
146
|
+
tr: insetSingleRadius(radius.tr),
|
|
147
|
+
bl: insetSingleRadius(radius.bl),
|
|
148
|
+
br: insetSingleRadius(radius.br)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function offsetCornerRadius(radius, offset) {
|
|
152
|
+
const shiftSingleRadius = (value) => Math.max(0, (value ?? 0) - offset);
|
|
153
|
+
if (typeof radius === "number") {
|
|
154
|
+
return shiftSingleRadius(radius);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
tl: shiftSingleRadius(radius.tl),
|
|
158
|
+
tr: shiftSingleRadius(radius.tr),
|
|
159
|
+
bl: shiftSingleRadius(radius.bl),
|
|
160
|
+
br: shiftSingleRadius(radius.br)
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function resolveBackgroundPadding(props) {
|
|
164
|
+
const border = props.border;
|
|
165
|
+
if (!border) return { left: 0, top: 0, right: 0, bottom: 0 };
|
|
166
|
+
const sides = resolveBorderSides(border.width);
|
|
167
|
+
const align = border.align ?? "center";
|
|
168
|
+
const dotDiameterOverride = border.style === "dotted" ? border.dash?.[1] : void 0;
|
|
169
|
+
const resolveSidePadding = (sideWidth) => {
|
|
170
|
+
const dotRadius = dotDiameterOverride !== void 0 ? dotDiameterOverride / 2 : sideWidth / 2;
|
|
171
|
+
if (align === "inside") {
|
|
172
|
+
return Math.max(0, dotRadius - sideWidth / 2);
|
|
173
|
+
}
|
|
174
|
+
if (align === "outside") {
|
|
175
|
+
return sideWidth / 2 + dotRadius;
|
|
176
|
+
}
|
|
177
|
+
return dotRadius;
|
|
178
|
+
};
|
|
179
|
+
return {
|
|
180
|
+
left: resolveSidePadding(sides.left),
|
|
181
|
+
top: resolveSidePadding(sides.top),
|
|
182
|
+
right: resolveSidePadding(sides.right),
|
|
183
|
+
bottom: resolveSidePadding(sides.bottom)
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function drawAdvancedBorder(graphics, w, h, cornerRadius, border, offsetX = 0, offsetY = 0) {
|
|
187
|
+
const sides = resolveBorderSides(border.width);
|
|
188
|
+
const corners = resolveCornerRadii(cornerRadius);
|
|
189
|
+
const maxSw = Math.max(sides.top, sides.right, sides.bottom, sides.left);
|
|
190
|
+
if (maxSw <= 0) return;
|
|
191
|
+
const isSolidUniform = isUniformBorder(sides) && (border.style ?? "solid") === "solid";
|
|
192
|
+
if (!isSolidUniform) {
|
|
193
|
+
const ctx = new OffsetVectorDrawContext(new PhaserVectorDrawContext(graphics), offsetX, offsetY);
|
|
194
|
+
drawBorderGeometry(ctx, { box: { x: 0, y: 0, w, h }, sides, corners }, border);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const color = border.color ?? 16777215;
|
|
198
|
+
const alpha = typeof border.alpha === "number" ? border.alpha : 1;
|
|
199
|
+
const lineWidth = sides.top;
|
|
200
|
+
const rounded = hasAnyCornerRadius(corners);
|
|
201
|
+
const alignOff = (lw) => {
|
|
202
|
+
if (border.align === "inside") return lw / 2;
|
|
203
|
+
if (border.align === "outside") return -lw / 2;
|
|
204
|
+
return 0;
|
|
205
|
+
};
|
|
206
|
+
const offset = alignOff(lineWidth);
|
|
207
|
+
graphics.lineStyle(lineWidth, color, alpha);
|
|
208
|
+
if (rounded) {
|
|
209
|
+
graphics.strokeRoundedRect(
|
|
210
|
+
offsetX + offset,
|
|
211
|
+
offsetY + offset,
|
|
212
|
+
Math.max(0, w - offset * 2),
|
|
213
|
+
Math.max(0, h - offset * 2),
|
|
214
|
+
offsetCornerRadius(cornerRadius, offset)
|
|
215
|
+
);
|
|
216
|
+
} else {
|
|
217
|
+
graphics.strokeRect(
|
|
218
|
+
offsetX + offset,
|
|
219
|
+
offsetY + offset,
|
|
220
|
+
Math.max(0, w - offset * 2),
|
|
221
|
+
Math.max(0, h - offset * 2)
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function drawBackground(graphics, props, width, height, offsetX = 0, offsetY = 0) {
|
|
226
|
+
if (width <= 0 || height <= 0) return;
|
|
227
|
+
const unwrap = (v, fallback) => v !== void 0 && isAnimatedSignal(v) ? v.value : v ?? fallback;
|
|
228
|
+
const bgColor = props.backgroundColor;
|
|
229
|
+
const bgAlpha = unwrap(props.backgroundAlpha, 1);
|
|
230
|
+
const cornerRadius = props.cornerRadius ?? 0;
|
|
231
|
+
const advancedBorder = hasAdvancedBorder(props);
|
|
232
|
+
const borderWidth = advancedBorder ? resolveBorderSides(props.border?.width).top : props.borderWidth ?? 0;
|
|
233
|
+
const borderAlpha = advancedBorder ? unwrap(props.border?.alpha, 1) : unwrap(props.borderAlpha, 1);
|
|
234
|
+
const hasLegacyBorder = !advancedBorder && borderWidth > 0 && props.borderColor !== void 0;
|
|
235
|
+
const resolvedBorderColor = hasLegacyBorder ? props.borderColor : void 0;
|
|
236
|
+
const rounded = hasRoundedCorners(cornerRadius);
|
|
237
|
+
if (bgColor !== void 0) {
|
|
238
|
+
graphics.fillStyle(bgColor, bgAlpha);
|
|
239
|
+
}
|
|
240
|
+
if (hasLegacyBorder) {
|
|
241
|
+
graphics.lineStyle(borderWidth, resolvedBorderColor ?? 42, borderAlpha);
|
|
242
|
+
}
|
|
243
|
+
if (rounded) {
|
|
244
|
+
if (bgColor !== void 0) {
|
|
245
|
+
graphics.fillRoundedRect(offsetX, offsetY, width, height, cornerRadius);
|
|
246
|
+
}
|
|
247
|
+
if (hasLegacyBorder) {
|
|
248
|
+
const inset = borderWidth / 2;
|
|
249
|
+
graphics.strokeRoundedRect(
|
|
250
|
+
offsetX + inset,
|
|
251
|
+
offsetY + inset,
|
|
252
|
+
Math.max(0, width - borderWidth),
|
|
253
|
+
Math.max(0, height - borderWidth),
|
|
254
|
+
insetCornerRadius(cornerRadius, inset)
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
if (bgColor !== void 0) {
|
|
259
|
+
graphics.fillRect(offsetX, offsetY, width, height);
|
|
260
|
+
}
|
|
261
|
+
if (hasLegacyBorder) {
|
|
262
|
+
const inset = borderWidth / 2;
|
|
263
|
+
graphics.strokeRect(
|
|
264
|
+
offsetX + inset,
|
|
265
|
+
offsetY + inset,
|
|
266
|
+
Math.max(0, width - borderWidth),
|
|
267
|
+
Math.max(0, height - borderWidth)
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (advancedBorder && props.border) {
|
|
272
|
+
drawAdvancedBorder(graphics, width, height, cornerRadius, props.border, offsetX, offsetY);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function getSceneBackgroundTextureCache(scene) {
|
|
276
|
+
let cache = sceneBackgroundTextureCaches.get(scene);
|
|
277
|
+
if (!cache) {
|
|
278
|
+
cache = /* @__PURE__ */ new Map();
|
|
279
|
+
sceneBackgroundTextureCaches.set(scene, cache);
|
|
280
|
+
}
|
|
281
|
+
return cache;
|
|
282
|
+
}
|
|
283
|
+
function hashCacheKey(value) {
|
|
284
|
+
let hash = 2166136261;
|
|
285
|
+
for (let i = 0; i < value.length; i++) {
|
|
286
|
+
hash ^= value.charCodeAt(i);
|
|
287
|
+
hash = Math.imul(hash, 16777619);
|
|
288
|
+
}
|
|
289
|
+
return (hash >>> 0).toString(36);
|
|
290
|
+
}
|
|
291
|
+
function normalizeCornerRadius(radius) {
|
|
292
|
+
if (typeof radius === "number") {
|
|
293
|
+
return String(radius);
|
|
294
|
+
}
|
|
295
|
+
if (!radius) {
|
|
296
|
+
return "0";
|
|
297
|
+
}
|
|
298
|
+
return `${radius.tl ?? 0},${radius.tr ?? 0},${radius.bl ?? 0},${radius.br ?? 0}`;
|
|
299
|
+
}
|
|
300
|
+
function clearExistingCanvasTexture(scene, textureKey) {
|
|
301
|
+
if (!scene.textures.exists(textureKey)) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const texture = scene.textures.get(textureKey);
|
|
305
|
+
const source = texture?.getSourceImage?.();
|
|
306
|
+
if (!source || typeof source.getContext !== "function") {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const canvas = source;
|
|
310
|
+
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
311
|
+
if (!ctx) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
ctx.clearRect(0, 0, canvas.width ?? 0, canvas.height ?? 0);
|
|
315
|
+
}
|
|
316
|
+
function getBackgroundImageCacheKey(props, width, height) {
|
|
317
|
+
const padding = resolveBackgroundPadding(props);
|
|
318
|
+
const textureWidth = Math.max(1, Math.ceil(width + padding.left + padding.right));
|
|
319
|
+
const textureHeight = Math.max(1, Math.ceil(height + padding.top + padding.bottom));
|
|
320
|
+
const advanced = hasAdvancedBorder(props) && props.border;
|
|
321
|
+
const borderSuffix = advanced ? normalizeBorderForCache(props.border ?? {}) : "";
|
|
322
|
+
return [
|
|
323
|
+
textureWidth,
|
|
324
|
+
textureHeight,
|
|
325
|
+
props.backgroundColor ?? "none",
|
|
326
|
+
1,
|
|
327
|
+
// backgroundAlpha — handled via Image.alpha
|
|
328
|
+
normalizeCornerRadius(props.cornerRadius),
|
|
329
|
+
props.borderWidth ?? 0,
|
|
330
|
+
props.borderColor ?? "none",
|
|
331
|
+
1,
|
|
332
|
+
// borderAlpha — handled via Image.alpha
|
|
333
|
+
advanced ? `adv:${borderSuffix}` : ""
|
|
334
|
+
].join("|");
|
|
335
|
+
}
|
|
336
|
+
function createBackgroundImage(scene, props, width, height) {
|
|
337
|
+
if (!hasRenderableBackground(props)) {
|
|
338
|
+
return void 0;
|
|
339
|
+
}
|
|
340
|
+
const padding = resolveBackgroundPadding(props);
|
|
341
|
+
const textureWidth = Math.max(1, Math.ceil(width + padding.left + padding.right));
|
|
342
|
+
const textureHeight = Math.max(1, Math.ceil(height + padding.top + padding.bottom));
|
|
343
|
+
const cacheKey = getBackgroundImageCacheKey(props, width, height);
|
|
344
|
+
const textureKey = `__phaserjsx_bg_${hashCacheKey(cacheKey)}`;
|
|
345
|
+
const cache = getSceneBackgroundTextureCache(scene);
|
|
346
|
+
let entry = cache.get(cacheKey);
|
|
347
|
+
if (!entry || !scene.textures.exists(entry.textureKey)) {
|
|
348
|
+
const graphics = scene.add.graphics();
|
|
349
|
+
clearExistingCanvasTexture(scene, textureKey);
|
|
350
|
+
drawBackground(
|
|
351
|
+
graphics,
|
|
352
|
+
{ ...props, backgroundAlpha: 1, borderAlpha: 1 },
|
|
353
|
+
width,
|
|
354
|
+
height,
|
|
355
|
+
padding.left,
|
|
356
|
+
padding.top
|
|
357
|
+
);
|
|
358
|
+
graphics.generateTexture(textureKey, textureWidth, textureHeight);
|
|
359
|
+
graphics.destroy();
|
|
360
|
+
entry = { textureKey, refs: 0 };
|
|
361
|
+
cache.set(cacheKey, entry);
|
|
362
|
+
}
|
|
363
|
+
entry.refs++;
|
|
364
|
+
const bgAlpha = Math.max(
|
|
365
|
+
0,
|
|
366
|
+
Math.min(
|
|
367
|
+
1,
|
|
368
|
+
props.backgroundAlpha !== void 0 && isAnimatedSignal(props.backgroundAlpha) ? props.backgroundAlpha.value : props.backgroundAlpha ?? 1
|
|
369
|
+
)
|
|
370
|
+
);
|
|
371
|
+
const background = scene.add.image(0, 0, entry.textureKey);
|
|
372
|
+
background.setOrigin(0, 0);
|
|
373
|
+
background.setPosition(-padding.left, -padding.top);
|
|
374
|
+
background.alpha = bgAlpha;
|
|
375
|
+
background.__isBackground = true;
|
|
376
|
+
background.__backgroundCacheKey = cacheKey;
|
|
377
|
+
background.__backgroundTextureKey = entry.textureKey;
|
|
378
|
+
background.__backgroundOffsetX = -padding.left;
|
|
379
|
+
background.__backgroundOffsetY = -padding.top;
|
|
380
|
+
background.once("destroy", () => releaseBackgroundImageTexture(background));
|
|
381
|
+
return background;
|
|
382
|
+
}
|
|
383
|
+
function releaseBackgroundImageTexture(background) {
|
|
384
|
+
if (background.__backgroundTextureReleased) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const scene = background.scene;
|
|
388
|
+
const cacheKey = background.__backgroundCacheKey;
|
|
389
|
+
background.__backgroundTextureReleased = true;
|
|
390
|
+
if (!scene || !cacheKey) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const cache = sceneBackgroundTextureCaches.get(scene);
|
|
394
|
+
const entry = cache?.get(cacheKey);
|
|
395
|
+
if (!cache || !entry) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
entry.refs--;
|
|
399
|
+
if (entry.refs <= 0) {
|
|
400
|
+
cache.delete(cacheKey);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function destroyBackgroundImage(background) {
|
|
404
|
+
background.destroy();
|
|
405
|
+
}
|
|
406
|
+
export {
|
|
407
|
+
createBackgroundImage,
|
|
408
|
+
destroyBackgroundImage,
|
|
409
|
+
getBackgroundImageCacheKey
|
|
410
|
+
};
|
|
411
|
+
//# sourceMappingURL=backgroundImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backgroundImage.js","sources":["../../src/components/backgroundImage.ts"],"sourcesContent":["import {\n drawBorderGeometry,\n hasAnyCornerRadius,\n isAnimatedSignal,\n isUniformBorder,\n resolveBorderSides,\n resolveCornerRadii,\n type BorderPropsV2,\n type VectorDrawContext,\n} from '@number10/jsx-core'\nimport * as Phaser from 'phaser'\nimport type { BackgroundProps } from '../core-props'\nimport { PhaserVectorDrawContext } from '../vector/PhaserVectorDrawContext'\n\nexport type BackgroundImage = Phaser.GameObjects.Image & {\n __isBackground?: boolean\n __backgroundCacheKey?: string\n __backgroundTextureKey?: string\n __backgroundTextureReleased?: boolean\n __backgroundOffsetX?: number\n __backgroundOffsetY?: number\n}\n\ntype BackgroundTextureCacheEntry = {\n textureKey: string\n refs: number\n}\n\nconst sceneBackgroundTextureCaches = new WeakMap<\n Phaser.Scene,\n Map<string, BackgroundTextureCacheEntry>\n>()\n\ntype CornerRadius = NonNullable<BackgroundProps['cornerRadius']>\ntype RenderPadding = { left: number; top: number; right: number; bottom: number }\n\nclass OffsetVectorDrawContext implements VectorDrawContext {\n constructor(\n private readonly base: VectorDrawContext,\n private readonly dx: number,\n private readonly dy: number\n ) {}\n\n clear(): this {\n this.base.clear()\n return this\n }\n\n fillStyle(color: number, alpha?: number): this {\n this.base.fillStyle(color, alpha)\n return this\n }\n\n lineStyle(width: number, color: number, alpha?: number): this {\n this.base.lineStyle(width, color, alpha)\n return this\n }\n\n arc(\n x: number,\n y: number,\n radius: number,\n startAngle: number,\n endAngle: number,\n anticlockwise?: boolean\n ): this {\n this.base.arc(x + this.dx, y + this.dy, radius, startAngle, endAngle, anticlockwise)\n return this\n }\n\n fillCircle(x: number, y: number, radius: number): this {\n this.base.fillCircle(x + this.dx, y + this.dy, radius)\n return this\n }\n\n strokeCircle(x: number, y: number, radius: number): this {\n this.base.strokeCircle(x + this.dx, y + this.dy, radius)\n return this\n }\n\n fillCircleStyled(x: number, y: number, radius: number, color: number, alpha: number): this {\n this.base.fillCircleStyled(x + this.dx, y + this.dy, radius, color, alpha)\n return this\n }\n\n fillRect(x: number, y: number, width: number, height: number): this {\n this.base.fillRect(x + this.dx, y + this.dy, width, height)\n return this\n }\n\n strokeRect(x: number, y: number, width: number, height: number): this {\n this.base.strokeRect(x + this.dx, y + this.dy, width, height)\n return this\n }\n\n fillRoundedRect(x: number, y: number, width: number, height: number, radius: number): this {\n this.base.fillRoundedRect(x + this.dx, y + this.dy, width, height, radius)\n return this\n }\n\n strokeRoundedRect(x: number, y: number, width: number, height: number, radius: number): this {\n this.base.strokeRoundedRect(x + this.dx, y + this.dy, width, height, radius)\n return this\n }\n\n beginPath(): this {\n this.base.beginPath()\n return this\n }\n\n moveTo(x: number, y: number): this {\n this.base.moveTo(x + this.dx, y + this.dy)\n return this\n }\n\n lineTo(x: number, y: number): this {\n this.base.lineTo(x + this.dx, y + this.dy)\n return this\n }\n\n closePath(): this {\n this.base.closePath()\n return this\n }\n\n fillPath(): this {\n this.base.fillPath()\n return this\n }\n\n strokePath(): this {\n this.base.strokePath()\n return this\n }\n\n lineBetween(x1: number, y1: number, x2: number, y2: number): this {\n this.base.lineBetween(x1 + this.dx, y1 + this.dy, x2 + this.dx, y2 + this.dy)\n return this\n }\n\n strokeLine(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n width: number,\n color: number,\n alpha: number\n ): this {\n this.base.strokeLine(\n x1 + this.dx,\n y1 + this.dy,\n x2 + this.dx,\n y2 + this.dy,\n width,\n color,\n alpha\n )\n return this\n }\n\n fillArc(\n cx: number,\n cy: number,\n r: number,\n startAngle: number,\n endAngle: number,\n color: number,\n alpha: number\n ): this {\n this.base.fillArc(cx + this.dx, cy + this.dy, r, startAngle, endAngle, color, alpha)\n return this\n }\n}\n\n/**\n * Check whether the props contain a BorderPropsV2 with renderable width.\n */\nfunction hasAdvancedBorder(props: Partial<BackgroundProps>): boolean {\n const border = props.border\n if (!border) return false\n const w = resolveBorderSides(border.width)\n return w.top > 0 || w.right > 0 || w.bottom > 0 || w.left > 0\n}\n\n/**\n * Normalize a BorderPropsV2 for cache key purposes (strip animated alpha).\n */\nfunction normalizeBorderForCache(border: BorderPropsV2): string {\n const width = border.width\n const widthStr =\n typeof width === 'number'\n ? String(width)\n : `${width?.top ?? 0},${width?.right ?? 0},${width?.bottom ?? 0},${width?.left ?? 0}`\n return [\n border.color ?? 'none',\n widthStr,\n border.style ?? 'solid',\n border.dash?.join(',') ?? '',\n border.dashOffset ?? 0,\n border.cap ?? '',\n border.join ?? '',\n border.align ?? 'center',\n ].join('|')\n}\n\nfunction hasRenderableBackground(props: Partial<BackgroundProps>): boolean {\n const hasBackground = props.backgroundColor !== undefined\n const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== undefined\n const hasAdvanced = hasAdvancedBorder(props)\n return hasBackground || hasBorder || hasAdvanced\n}\n\nfunction hasRoundedCorners(radius: CornerRadius): boolean {\n if (typeof radius === 'number') {\n return radius !== 0\n }\n\n return (\n (radius.tl ?? 0) !== 0 ||\n (radius.tr ?? 0) !== 0 ||\n (radius.bl ?? 0) !== 0 ||\n (radius.br ?? 0) !== 0\n )\n}\n\nfunction insetCornerRadius(radius: CornerRadius, inset: number): CornerRadius {\n const insetSingleRadius = (value: number | undefined): number => {\n const resolved = value ?? 0\n const sign = resolved < 0 ? -1 : 1\n return sign * Math.max(0, Math.abs(resolved) - inset)\n }\n\n if (typeof radius === 'number') {\n return insetSingleRadius(radius)\n }\n\n return {\n tl: insetSingleRadius(radius.tl),\n tr: insetSingleRadius(radius.tr),\n bl: insetSingleRadius(radius.bl),\n br: insetSingleRadius(radius.br),\n }\n}\n\nfunction offsetCornerRadius(radius: CornerRadius, offset: number): CornerRadius {\n const shiftSingleRadius = (value: number | undefined): number =>\n Math.max(0, (value ?? 0) - offset)\n\n if (typeof radius === 'number') {\n return shiftSingleRadius(radius)\n }\n\n return {\n tl: shiftSingleRadius(radius.tl),\n tr: shiftSingleRadius(radius.tr),\n bl: shiftSingleRadius(radius.bl),\n br: shiftSingleRadius(radius.br),\n }\n}\n\nfunction resolveBackgroundPadding(props: Partial<BackgroundProps>): RenderPadding {\n const border = props.border\n if (!border) return { left: 0, top: 0, right: 0, bottom: 0 }\n\n const sides = resolveBorderSides(border.width)\n const align = border.align ?? 'center'\n const dotDiameterOverride = border.style === 'dotted' ? border.dash?.[1] : undefined\n\n const resolveSidePadding = (sideWidth: number): number => {\n const dotRadius = dotDiameterOverride !== undefined ? dotDiameterOverride / 2 : sideWidth / 2\n if (align === 'inside') {\n return Math.max(0, dotRadius - sideWidth / 2)\n }\n if (align === 'outside') {\n return sideWidth / 2 + dotRadius\n }\n return dotRadius\n }\n\n return {\n left: resolveSidePadding(sides.left),\n top: resolveSidePadding(sides.top),\n right: resolveSidePadding(sides.right),\n bottom: resolveSidePadding(sides.bottom),\n }\n}\n\n/**\n * Draw an advanced border using either the core geometry fallback (for\n * asymmetric, dashed, dotted, and other problematic cases) or native\n * Phaser stroke (for simple symmetric solid borders).\n *\n * ## Core Fallback\n *\n * All asymmetric, dashed, and dotted borders are routed through\n * {@link drawBorderGeometry} from `@number10/jsx-core`. This ensures:\n * - Single source of truth for border geometry\n * - Consistent dotted rendering (real round circles)\n * - Proper dashed arc-following on rounded corners\n *\n * ## Native Path\n *\n * Only symmetric solid borders use the native Phaser `strokeRect` /\n * `strokeRoundedRect` for optimal performance.\n */\nfunction drawAdvancedBorder(\n graphics: Phaser.GameObjects.Graphics,\n w: number,\n h: number,\n cornerRadius: CornerRadius,\n border: BorderPropsV2,\n offsetX = 0,\n offsetY = 0\n): void {\n const sides = resolveBorderSides(border.width)\n const corners = resolveCornerRadii(cornerRadius)\n const maxSw = Math.max(sides.top, sides.right, sides.bottom, sides.left)\n if (maxSw <= 0) return\n\n const isSolidUniform = isUniformBorder(sides) && (border.style ?? 'solid') === 'solid'\n\n if (!isSolidUniform) {\n // Route through core: asymmetric, dashed, dotted, rounded-complex\n const ctx = new OffsetVectorDrawContext(new PhaserVectorDrawContext(graphics), offsetX, offsetY)\n drawBorderGeometry(ctx, { box: { x: 0, y: 0, w, h }, sides, corners }, border)\n return\n }\n\n // --- Native path: symmetric solid only ---\n const color = border.color ?? 0xffffff\n const alpha = typeof border.alpha === 'number' ? border.alpha : 1\n const lineWidth = sides.top\n const rounded = hasAnyCornerRadius(corners)\n\n const alignOff = (lw: number): number => {\n if (border.align === 'inside') return lw / 2\n if (border.align === 'outside') return -lw / 2\n return 0\n }\n const offset = alignOff(lineWidth)\n graphics.lineStyle(lineWidth, color, alpha)\n if (rounded) {\n graphics.strokeRoundedRect(\n offsetX + offset,\n offsetY + offset,\n Math.max(0, w - offset * 2),\n Math.max(0, h - offset * 2),\n offsetCornerRadius(cornerRadius, offset)\n )\n } else {\n graphics.strokeRect(\n offsetX + offset,\n offsetY + offset,\n Math.max(0, w - offset * 2),\n Math.max(0, h - offset * 2)\n )\n }\n}\n\nfunction drawBackground(\n graphics: Phaser.GameObjects.Graphics,\n props: Partial<BackgroundProps>,\n width: number,\n height: number,\n offsetX = 0,\n offsetY = 0\n): void {\n if (width <= 0 || height <= 0) return\n\n const unwrap = (v: unknown, fallback: number): number =>\n v !== undefined && isAnimatedSignal(v) ? v.value : ((v as number) ?? fallback)\n const bgColor = props.backgroundColor\n const bgAlpha = unwrap(props.backgroundAlpha, 1)\n const cornerRadius = props.cornerRadius ?? 0\n const advancedBorder = hasAdvancedBorder(props)\n const borderWidth = advancedBorder\n ? resolveBorderSides(props.border?.width).top\n : (props.borderWidth ?? 0)\n const borderAlpha = advancedBorder ? unwrap(props.border?.alpha, 1) : unwrap(props.borderAlpha, 1)\n const hasLegacyBorder = !advancedBorder && borderWidth > 0 && props.borderColor !== undefined\n const resolvedBorderColor = hasLegacyBorder ? (props.borderColor as number) : undefined\n const rounded = hasRoundedCorners(cornerRadius)\n\n if (bgColor !== undefined) {\n graphics.fillStyle(bgColor, bgAlpha)\n }\n\n if (hasLegacyBorder) {\n graphics.lineStyle(borderWidth, resolvedBorderColor ?? 42, borderAlpha)\n }\n\n if (rounded) {\n if (bgColor !== undefined) {\n graphics.fillRoundedRect(offsetX, offsetY, width, height, cornerRadius)\n }\n if (hasLegacyBorder) {\n const inset = borderWidth / 2\n graphics.strokeRoundedRect(\n offsetX + inset,\n offsetY + inset,\n Math.max(0, width - borderWidth),\n Math.max(0, height - borderWidth),\n insetCornerRadius(cornerRadius, inset)\n )\n }\n } else {\n if (bgColor !== undefined) {\n graphics.fillRect(offsetX, offsetY, width, height)\n }\n if (hasLegacyBorder) {\n const inset = borderWidth / 2\n graphics.strokeRect(\n offsetX + inset,\n offsetY + inset,\n Math.max(0, width - borderWidth),\n Math.max(0, height - borderWidth)\n )\n }\n }\n\n // Draw advanced border on top of background fill\n if (advancedBorder && props.border) {\n drawAdvancedBorder(graphics, width, height, cornerRadius, props.border, offsetX, offsetY)\n }\n}\n\nfunction getSceneBackgroundTextureCache(\n scene: Phaser.Scene\n): Map<string, BackgroundTextureCacheEntry> {\n let cache = sceneBackgroundTextureCaches.get(scene)\n\n if (!cache) {\n cache = new Map()\n sceneBackgroundTextureCaches.set(scene, cache)\n }\n\n return cache\n}\n\nfunction hashCacheKey(value: string): string {\n let hash = 2166136261\n\n for (let i = 0; i < value.length; i++) {\n hash ^= value.charCodeAt(i)\n hash = Math.imul(hash, 16777619)\n }\n\n return (hash >>> 0).toString(36)\n}\n\nfunction normalizeCornerRadius(radius: BackgroundProps['cornerRadius']): string {\n if (typeof radius === 'number') {\n return String(radius)\n }\n\n if (!radius) {\n return '0'\n }\n\n return `${radius.tl ?? 0},${radius.tr ?? 0},${radius.bl ?? 0},${radius.br ?? 0}`\n}\n\nfunction clearExistingCanvasTexture(scene: Phaser.Scene, textureKey: string): void {\n if (!scene.textures.exists(textureKey)) {\n return\n }\n\n const texture = scene.textures.get(textureKey)\n const source = texture?.getSourceImage?.()\n\n if (!source || typeof (source as { getContext?: unknown }).getContext !== 'function') {\n return\n }\n\n const canvas = source as {\n width?: number\n height?: number\n getContext: (\n type: string,\n options?: { willReadFrequently?: boolean }\n ) => CanvasRenderingContext2D | null\n }\n const ctx = canvas.getContext('2d', { willReadFrequently: true })\n if (!ctx) {\n return\n }\n\n ctx.clearRect(0, 0, canvas.width ?? 0, canvas.height ?? 0)\n}\n\nexport function getBackgroundImageCacheKey(\n props: Partial<BackgroundProps>,\n width: number,\n height: number\n): string {\n // Alpha is applied via Image.alpha, not baked into the texture,\n // so always use 1 for the cache key.\n const padding = resolveBackgroundPadding(props)\n const textureWidth = Math.max(1, Math.ceil(width + padding.left + padding.right))\n const textureHeight = Math.max(1, Math.ceil(height + padding.top + padding.bottom))\n const advanced = hasAdvancedBorder(props) && props.border\n const borderSuffix = advanced ? normalizeBorderForCache(props.border ?? {}) : ''\n return [\n textureWidth,\n textureHeight,\n props.backgroundColor ?? 'none',\n 1, // backgroundAlpha — handled via Image.alpha\n normalizeCornerRadius(props.cornerRadius),\n props.borderWidth ?? 0,\n props.borderColor ?? 'none',\n 1, // borderAlpha — handled via Image.alpha\n advanced ? `adv:${borderSuffix}` : '',\n ].join('|')\n}\n\nexport function createBackgroundImage(\n scene: Phaser.Scene,\n props: Partial<BackgroundProps>,\n width: number,\n height: number\n): BackgroundImage | undefined {\n if (!hasRenderableBackground(props)) {\n return undefined\n }\n\n const padding = resolveBackgroundPadding(props)\n const textureWidth = Math.max(1, Math.ceil(width + padding.left + padding.right))\n const textureHeight = Math.max(1, Math.ceil(height + padding.top + padding.bottom))\n const cacheKey = getBackgroundImageCacheKey(props, width, height)\n const textureKey = `__phaserjsx_bg_${hashCacheKey(cacheKey)}`\n const cache = getSceneBackgroundTextureCache(scene)\n let entry = cache.get(cacheKey)\n\n if (!entry || !scene.textures.exists(entry.textureKey)) {\n const graphics = scene.add.graphics()\n\n clearExistingCanvasTexture(scene, textureKey)\n\n // Draw texture with alpha=1 — the actual alpha is applied via Image.alpha\n // so that animated signals can update it without recreating the texture.\n drawBackground(\n graphics,\n { ...props, backgroundAlpha: 1, borderAlpha: 1 },\n width,\n height,\n padding.left,\n padding.top\n )\n graphics.generateTexture(textureKey, textureWidth, textureHeight)\n graphics.destroy()\n\n entry = { textureKey, refs: 0 }\n cache.set(cacheKey, entry)\n }\n\n entry.refs++\n\n const bgAlpha = Math.max(\n 0,\n Math.min(\n 1,\n props.backgroundAlpha !== undefined && isAnimatedSignal(props.backgroundAlpha)\n ? props.backgroundAlpha.value\n : (props.backgroundAlpha ?? 1)\n )\n )\n const background = scene.add.image(0, 0, entry.textureKey) as BackgroundImage\n background.setOrigin(0, 0)\n background.setPosition(-padding.left, -padding.top)\n background.alpha = bgAlpha as number\n background.__isBackground = true\n background.__backgroundCacheKey = cacheKey\n background.__backgroundTextureKey = entry.textureKey\n background.__backgroundOffsetX = -padding.left\n background.__backgroundOffsetY = -padding.top\n background.once('destroy', () => releaseBackgroundImageTexture(background))\n\n return background\n}\n\nfunction releaseBackgroundImageTexture(background: BackgroundImage): void {\n if (background.__backgroundTextureReleased) {\n return\n }\n\n const scene = background.scene\n const cacheKey = background.__backgroundCacheKey\n\n background.__backgroundTextureReleased = true\n\n if (!scene || !cacheKey) {\n return\n }\n\n const cache = sceneBackgroundTextureCaches.get(scene)\n const entry = cache?.get(cacheKey)\n\n if (!cache || !entry) {\n return\n }\n\n entry.refs--\n\n if (entry.refs <= 0) {\n // NOTE: Do NOT call scene.textures.remove() here.\n // Removing a texture from Phaser's texture manager while live Image\n // game objects still reference it causes a null-texture crash in\n // Phaser's rendering pipeline (TexturerImage.run → resolution of null).\n // This happens when multiple tabs share the same background cache key\n // and the VDOM processes children in an order where one tab's old\n // background is destroyed after another tab's new background was\n // created with the same texture key. The eager removal nulls the\n // texture on the newly created Image before it renders.\n //\n // Instead, we simply drop the cache entry and let Phaser manage the\n // texture lifecycle. Background textures are typically small\n // solid-color textures (a few KB), so the memory cost of keeping\n // them in the texture manager is negligible.\n cache.delete(cacheKey)\n }\n}\n\nexport function destroyBackgroundImage(background: BackgroundImage): void {\n background.destroy()\n}\n"],"names":[],"mappings":";;;AA4BA,MAAM,mDAAmC,QAAA;AAQzC,MAAM,wBAAqD;AAAA,EACzD,YACmB,MACA,IACA,IACjB;AAHiB,SAAA,OAAA;AACA,SAAA,KAAA;AACA,SAAA,KAAA;AAAA,EAChB;AAAA,EAHgB;AAAA,EACA;AAAA,EACA;AAAA,EAGnB,QAAc;AACZ,SAAK,KAAK,MAAA;AACV,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,OAAe,OAAsB;AAC7C,SAAK,KAAK,UAAU,OAAO,KAAK;AAChC,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,OAAe,OAAe,OAAsB;AAC5D,SAAK,KAAK,UAA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AAC,OAAO;AACpB;AAAA,EACF;AAEA,QAAM;AAEN,MAAI,MAAM,QAAQ,GAAG;AAenB,UAAM,OAAO,QAAQ;AAAA,EACvB;AACF;AAEO,SAAS,uBAAuB,YAAmC;AACxE,aAAW,QAAA;AACb;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const backgroundImage = require("../backgroundImage.cjs");
|
|
4
|
+
function createBackground(scene, container, props) {
|
|
5
|
+
const hasBackground = props.backgroundColor !== void 0;
|
|
6
|
+
const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== void 0;
|
|
7
|
+
const hasAdvanced = props.border !== void 0 && (typeof props.border.width === "number" ? props.border.width > 0 : true);
|
|
8
|
+
if (hasBackground || hasBorder || hasAdvanced) {
|
|
9
|
+
const width = typeof props.width === "number" ? props.width : 100;
|
|
10
|
+
const height = typeof props.height === "number" ? props.height : 100;
|
|
11
|
+
const background = backgroundImage.createBackgroundImage(scene, props, width, height);
|
|
12
|
+
if (!background) return;
|
|
13
|
+
container.addAt(background, 0);
|
|
14
|
+
container.__background = background;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.createBackground = createBackground;
|
|
18
|
+
//# sourceMappingURL=createBackground.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBackground.cjs","sources":["../../../src/components/creators/createBackground.ts"],"sourcesContent":["/**\n * Shared property creators for component initialization\n * These functions avoid code duplication when creating nodes with initial properties\n */\nimport type * as Phaser from 'phaser'\nimport type { BackgroundProps } from '../../core-props'\nimport { createBackgroundImage, type BackgroundImage } from '../backgroundImage'\n\n/**\n * Create background graphics for container-based components\n * @param scene - Phaser scene\n * @param container - Container to add background to\n * @param props - Props with background settings\n */\nexport function createBackground(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container & { __background?: BackgroundImage },\n props: Partial<\n BackgroundProps & { width?: number | string | undefined; height?: number | string | undefined }\n >\n): void {\n const hasBackground = props.backgroundColor !== undefined\n const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== undefined\n const hasAdvanced =\n props.border !== undefined &&\n (typeof props.border.width === 'number' ? props.border.width > 0 : true)\n\n if (hasBackground || hasBorder || hasAdvanced) {\n const width = typeof props.width === 'number' ? props.width : 100\n const height = typeof props.height === 'number' ? props.height : 100\n\n const background = createBackgroundImage(scene, props, width, height)\n\n if (!background) return\n\n container.addAt(background, 0)\n container.__background = background\n }\n}\n"],"names":["createBackgroundImage"],"mappings":";;;AAcO,SAAS,iBACd,OACA,WACA,OAGM;AACN,QAAM,gBAAgB,MAAM,oBAAoB;AAChD,QAAM,aAAa,MAAM,eAAe,KAAK,KAAK,MAAM,gBAAgB;AACxE,QAAM,cACJ,MAAM,WAAW,WAChB,OAAO,MAAM,OAAO,UAAU,WAAW,MAAM,OAAO,QAAQ,IAAI;AAErE,MAAI,iBAAiB,aAAa,aAAa;AAC7C,UAAM,QAAQ,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;AAC9D,UAAM,SAAS,OAAO,MAAM,WAAW,WAAW,MAAM,SAAS;AAEjE,UAAM,aAAaA,gBAAAA,sBAAsB,OAAO,OAAO,OAAO,MAAM;AAEpE,QAAI,CAAC,WAAY;AAEjB,cAAU,MAAM,YAAY,CAAC;AAC7B,cAAU,eAAe;AAAA,EAC3B;AACF;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BackgroundProps } from '../../core-props';
|
|
2
|
+
import { BackgroundImage } from '../backgroundImage';
|
|
3
|
+
/**
|
|
4
|
+
* Shared property creators for component initialization
|
|
5
|
+
* These functions avoid code duplication when creating nodes with initial properties
|
|
6
|
+
*/
|
|
7
|
+
import type * as Phaser from 'phaser';
|
|
8
|
+
/**
|
|
9
|
+
* Create background graphics for container-based components
|
|
10
|
+
* @param scene - Phaser scene
|
|
11
|
+
* @param container - Container to add background to
|
|
12
|
+
* @param props - Props with background settings
|
|
13
|
+
*/
|
|
14
|
+
export declare function createBackground(scene: Phaser.Scene, container: Phaser.GameObjects.Container & {
|
|
15
|
+
__background?: BackgroundImage;
|
|
16
|
+
}, props: Partial<BackgroundProps & {
|
|
17
|
+
width?: number | string | undefined;
|
|
18
|
+
height?: number | string | undefined;
|
|
19
|
+
}>): void;
|
|
20
|
+
//# sourceMappingURL=createBackground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBackground.d.ts","sourceRoot":"","sources":["../../../src/components/creators/createBackground.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEhF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,GAAG;IAAE,YAAY,CAAC,EAAE,eAAe,CAAA;CAAE,EAC5E,KAAK,EAAE,OAAO,CACZ,eAAe,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAChG,GACA,IAAI,CAkBN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createBackgroundImage } from "../backgroundImage.js";
|
|
2
|
+
function createBackground(scene, container, props) {
|
|
3
|
+
const hasBackground = props.backgroundColor !== void 0;
|
|
4
|
+
const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== void 0;
|
|
5
|
+
const hasAdvanced = props.border !== void 0 && (typeof props.border.width === "number" ? props.border.width > 0 : true);
|
|
6
|
+
if (hasBackground || hasBorder || hasAdvanced) {
|
|
7
|
+
const width = typeof props.width === "number" ? props.width : 100;
|
|
8
|
+
const height = typeof props.height === "number" ? props.height : 100;
|
|
9
|
+
const background = createBackgroundImage(scene, props, width, height);
|
|
10
|
+
if (!background) return;
|
|
11
|
+
container.addAt(background, 0);
|
|
12
|
+
container.__background = background;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
createBackground
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=createBackground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBackground.js","sources":["../../../src/components/creators/createBackground.ts"],"sourcesContent":["/**\n * Shared property creators for component initialization\n * These functions avoid code duplication when creating nodes with initial properties\n */\nimport type * as Phaser from 'phaser'\nimport type { BackgroundProps } from '../../core-props'\nimport { createBackgroundImage, type BackgroundImage } from '../backgroundImage'\n\n/**\n * Create background graphics for container-based components\n * @param scene - Phaser scene\n * @param container - Container to add background to\n * @param props - Props with background settings\n */\nexport function createBackground(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container & { __background?: BackgroundImage },\n props: Partial<\n BackgroundProps & { width?: number | string | undefined; height?: number | string | undefined }\n >\n): void {\n const hasBackground = props.backgroundColor !== undefined\n const hasBorder = (props.borderWidth ?? 0) > 0 && props.borderColor !== undefined\n const hasAdvanced =\n props.border !== undefined &&\n (typeof props.border.width === 'number' ? props.border.width > 0 : true)\n\n if (hasBackground || hasBorder || hasAdvanced) {\n const width = typeof props.width === 'number' ? props.width : 100\n const height = typeof props.height === 'number' ? props.height : 100\n\n const background = createBackgroundImage(scene, props, width, height)\n\n if (!background) return\n\n container.addAt(background, 0)\n container.__background = background\n }\n}\n"],"names":[],"mappings":";AAcO,SAAS,iBACd,OACA,WACA,OAGM;AACN,QAAM,gBAAgB,MAAM,oBAAoB;AAChD,QAAM,aAAa,MAAM,eAAe,KAAK,KAAK,MAAM,gBAAgB;AACxE,QAAM,cACJ,MAAM,WAAW,WAChB,OAAO,MAAM,OAAO,UAAU,WAAW,MAAM,OAAO,QAAQ,IAAI;AAErE,MAAI,iBAAiB,aAAa,aAAa;AAC7C,UAAM,QAAQ,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;AAC9D,UAAM,SAAS,OAAO,MAAM,WAAW,WAAW,MAAM,SAAS;AAEjE,UAAM,aAAa,sBAAsB,OAAO,OAAO,OAAO,MAAM;AAEpE,QAAI,CAAC,WAAY;AAEjB,cAAU,MAAM,YAAY,CAAC;AAC7B,cAAU,eAAe;AAAA,EAC3B;AACF;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Phaser = require("phaser");
|
|
4
|
+
const gestureManager = require("../../gestures/gesture-manager.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const Phaser__namespace = /* @__PURE__ */ _interopNamespaceDefault(Phaser);
|
|
22
|
+
function createGestures(scene, container, props) {
|
|
23
|
+
const hasAnyGesture = !!(props.onTouch || props.onTouchOutside || props.onTouchMove || props.onDoubleTap || props.onLongPress || props.onHoverStart || props.onHoverEnd || props.onWheel);
|
|
24
|
+
const shouldEnable = hasAnyGesture && props.enableGestures !== false;
|
|
25
|
+
if (!shouldEnable) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const manager = gestureManager.getGestureManager(scene);
|
|
29
|
+
const containerWithLayout = container;
|
|
30
|
+
const { width, height } = containerWithLayout.__getLayoutSize ? containerWithLayout.__getLayoutSize() : (() => {
|
|
31
|
+
const bounds = container.getBounds();
|
|
32
|
+
return { width: bounds.width || 100, height: bounds.height || 100 };
|
|
33
|
+
})();
|
|
34
|
+
const hitArea = new Phaser__namespace.Geom.Rectangle(0, 0, width, height);
|
|
35
|
+
const callbacks = {};
|
|
36
|
+
if (props.onTouch) callbacks.onTouch = props.onTouch;
|
|
37
|
+
if (props.onTouchOutside) callbacks.onTouchOutside = props.onTouchOutside;
|
|
38
|
+
if (props.onTouchMove) callbacks.onTouchMove = props.onTouchMove;
|
|
39
|
+
if (props.onDoubleTap) callbacks.onDoubleTap = props.onDoubleTap;
|
|
40
|
+
if (props.onLongPress) callbacks.onLongPress = props.onLongPress;
|
|
41
|
+
if (props.onHoverStart) callbacks.onHoverStart = props.onHoverStart;
|
|
42
|
+
if (props.onHoverEnd) callbacks.onHoverEnd = props.onHoverEnd;
|
|
43
|
+
if (props.onWheel) callbacks.onWheel = props.onWheel;
|
|
44
|
+
const config = {};
|
|
45
|
+
if (props.longPressDuration !== void 0) config.longPressDuration = props.longPressDuration;
|
|
46
|
+
if (props.doubleTapDelay !== void 0) config.doubleTapDelay = props.doubleTapDelay;
|
|
47
|
+
if (props.maxTouchDuration !== void 0) config.maxTouchDuration = props.maxTouchDuration;
|
|
48
|
+
manager.registerContainer(container, callbacks, hitArea, config);
|
|
49
|
+
}
|
|
50
|
+
exports.createGestures = createGestures;
|
|
51
|
+
//# sourceMappingURL=createGestures.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGestures.cjs","sources":["../../../src/components/creators/createGestures.ts"],"sourcesContent":["/**\n * Gesture setup for component initialization\n * Registers containers with the GestureManager for high-level gesture detection\n */\nimport type { LayoutSize } from '@number10/jsx-core'\nimport * as Phaser from 'phaser'\nimport type { GestureProps, LayoutProps } from '../../core-props'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport type { GestureCallbacks } from '../../gestures/gesture-types'\n\n/**\n * Setup gesture tracking for container-based components\n * Only registers if enableGestures is true and at least one gesture callback exists\n * @param scene - Scene containing the gesture manager\n * @param container - Container to make gesture-aware\n * @param props - Props with gesture settings\n */\nexport function createGestures(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n props: Partial<GestureProps & LayoutProps>\n): void {\n // Check if any gesture callback is defined\n const hasAnyGesture = !!(\n props.onTouch ||\n props.onTouchOutside ||\n props.onTouchMove ||\n props.onDoubleTap ||\n props.onLongPress ||\n props.onHoverStart ||\n props.onHoverEnd ||\n props.onWheel\n )\n\n // Auto-enable gestures if callbacks are provided, unless explicitly disabled\n const shouldEnable = hasAnyGesture && props.enableGestures !== false\n\n if (!shouldEnable) {\n return\n }\n\n // Get scene's gesture manager\n const manager = getGestureManager(scene)\n\n // Get actual calculated container size from layout system\n // Use __getLayoutSize if available (set by createLayout), otherwise fallback to getBounds\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n const { width, height } = containerWithLayout.__getLayoutSize\n ? containerWithLayout.__getLayoutSize()\n : (() => {\n // Fallback to getBounds if __getLayoutSize not available yet\n const bounds = container.getBounds()\n return { width: bounds.width || 100, height: bounds.height || 100 }\n })()\n\n // Create hit area with origin at (0,0) - matches our component system\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n // Build callbacks object\n const callbacks: GestureCallbacks = {}\n if (props.onTouch) callbacks.onTouch = props.onTouch\n if (props.onTouchOutside) callbacks.onTouchOutside = props.onTouchOutside\n if (props.onTouchMove) callbacks.onTouchMove = props.onTouchMove\n if (props.onDoubleTap) callbacks.onDoubleTap = props.onDoubleTap\n if (props.onLongPress) callbacks.onLongPress = props.onLongPress\n if (props.onHoverStart) callbacks.onHoverStart = props.onHoverStart\n if (props.onHoverEnd) callbacks.onHoverEnd = props.onHoverEnd\n if (props.onWheel) callbacks.onWheel = props.onWheel\n\n // Build config (only include defined values)\n const config: { longPressDuration?: number; doubleTapDelay?: number; maxTouchDuration?: number } =\n {}\n if (props.longPressDuration !== undefined) config.longPressDuration = props.longPressDuration\n if (props.doubleTapDelay !== undefined) config.doubleTapDelay = props.doubleTapDelay\n if (props.maxTouchDuration !== undefined) config.maxTouchDuration = props.maxTouchDuration\n\n // Register with manager\n manager.registerContainer(container, callbacks, hitArea, config)\n}\n"],"names":["getGestureManager","Phaser"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,eACd,OACA,WACA,OACM;AAEN,QAAM,gBAAgB,CAAC,EACrB,MAAM,WACN,MAAM,kBACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,gBACN,MAAM,cACN,MAAM;AAIR,QAAM,eAAe,iBAAiB,MAAM,mBAAmB;AAE/D,MAAI,CAAC,cAAc;AACjB;AAAA,EACF;AAGA,QAAM,UAAUA,eAAAA,kBAAkB,KAAK;AAIvC,QAAM,sBAAsB;AAI5B,QAAM,EAAE,OAAO,WAAW,oBAAoB,kBAC1C,oBAAoB,gBAAA,KACnB,MAAM;AAEL,UAAM,SAAS,UAAU,UAAA;AACzB,WAAO,EAAE,OAAO,OAAO,SAAS,KAAK,QAAQ,OAAO,UAAU,IAAA;AAAA,EAChE,GAAA;AAGJ,QAAM,UAAU,IAAIC,kBAAO,KAAK,UAAU,GAAG,GAAG,OAAO,MAAM;AAG7D,QAAM,YAA8B,CAAA;AACpC,MAAI,MAAM,QAAS,WAAU,UAAU,MAAM;AAC7C,MAAI,MAAM,eAAgB,WAAU,iBAAiB,MAAM;AAC3D,MAAI,MAAM,YAAa,WAAU,cAAc,MAAM;AACrD,MAAI,MAAM,YAAa,WAAU,cAAc,MAAM;AACrD,MAAI,MAAM,YAAa,WAAU,cAAc,MAAM;AACrD,MAAI,MAAM,aAAc,WAAU,eAAe,MAAM;AACvD,MAAI,MAAM,WAAY,WAAU,aAAa,MAAM;AACnD,MAAI,MAAM,QAAS,WAAU,UAAU,MAAM;AAG7C,QAAM,SACJ,CAAA;AACF,MAAI,MAAM,sBAAsB,OAAW,QAAO,oBAAoB,MAAM;AAC5E,MAAI,MAAM,mBAAmB,OAAW,QAAO,iBAAiB,MAAM;AACtE,MAAI,MAAM,qBAAqB,OAAW,QAAO,mBAAmB,MAAM;AAG1E,UAAQ,kBAAkB,WAAW,WAAW,SAAS,MAAM;AACjE;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GestureProps, LayoutProps } from '../../core-props';
|
|
2
|
+
import * as Phaser from 'phaser';
|
|
3
|
+
/**
|
|
4
|
+
* Setup gesture tracking for container-based components
|
|
5
|
+
* Only registers if enableGestures is true and at least one gesture callback exists
|
|
6
|
+
* @param scene - Scene containing the gesture manager
|
|
7
|
+
* @param container - Container to make gesture-aware
|
|
8
|
+
* @param props - Props with gesture settings
|
|
9
|
+
*/
|
|
10
|
+
export declare function createGestures(scene: Phaser.Scene, container: Phaser.GameObjects.Container, props: Partial<GestureProps & LayoutProps>): void;
|
|
11
|
+
//# sourceMappingURL=createGestures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGestures.d.ts","sourceRoot":"","sources":["../../../src/components/creators/createGestures.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAIjE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACvC,KAAK,EAAE,OAAO,CAAC,YAAY,GAAG,WAAW,CAAC,GACzC,IAAI,CA4DN"}
|