@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,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class DOMInputElement {
|
|
4
|
+
input;
|
|
5
|
+
container;
|
|
6
|
+
scene;
|
|
7
|
+
scrollHandler;
|
|
8
|
+
resizeHandler;
|
|
9
|
+
throttledScrollHandler;
|
|
10
|
+
throttledResizeHandler;
|
|
11
|
+
intersectionObserver = null;
|
|
12
|
+
isDestroyed = false;
|
|
13
|
+
lastValues = { left: 0, top: 0, width: 0, height: 0 };
|
|
14
|
+
counter = 0;
|
|
15
|
+
scrollThrottleTimeout = null;
|
|
16
|
+
resizeThrottleTimeout = null;
|
|
17
|
+
constructor(container, config = {}) {
|
|
18
|
+
this.container = container;
|
|
19
|
+
this.scene = container.scene;
|
|
20
|
+
this.input = document.createElement("input");
|
|
21
|
+
this.input.type = config.type ?? "text";
|
|
22
|
+
if (config.placeholder) this.input.placeholder = config.placeholder;
|
|
23
|
+
if (config.value) this.input.value = config.value;
|
|
24
|
+
if (config.disabled) this.input.disabled = config.disabled;
|
|
25
|
+
if (config.maxLength) this.input.maxLength = config.maxLength;
|
|
26
|
+
if (config.autocomplete) this.input.setAttribute("autocomplete", config.autocomplete);
|
|
27
|
+
if (config.autocorrect) this.input.setAttribute("autocorrect", config.autocorrect);
|
|
28
|
+
if (config.autocapitalize) this.input.setAttribute("autocapitalize", config.autocapitalize);
|
|
29
|
+
if (config.spellcheck !== void 0)
|
|
30
|
+
this.input.setAttribute("spellcheck", config.spellcheck.toString());
|
|
31
|
+
this.applyDefaultStyles();
|
|
32
|
+
if (config.styles) {
|
|
33
|
+
Object.assign(this.input.style, config.styles);
|
|
34
|
+
}
|
|
35
|
+
document.body.appendChild(this.input);
|
|
36
|
+
if (config.onInput) {
|
|
37
|
+
this.input.addEventListener("input", (e) => {
|
|
38
|
+
config.onInput?.(this.input.value, e);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (config.onKeyDown) {
|
|
42
|
+
this.input.addEventListener("keydown", config.onKeyDown);
|
|
43
|
+
}
|
|
44
|
+
if (config.onKeyUp) {
|
|
45
|
+
this.input.addEventListener("keyup", config.onKeyUp);
|
|
46
|
+
}
|
|
47
|
+
if (config.onFocus) {
|
|
48
|
+
this.input.addEventListener("focus", (e) => {
|
|
49
|
+
config.onFocus?.(e);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (config.onBlur) {
|
|
53
|
+
this.input.addEventListener("blur", (e) => {
|
|
54
|
+
config.onBlur?.(e);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
this.updatePosition();
|
|
58
|
+
this.scrollHandler = this.updatePosition.bind(this);
|
|
59
|
+
this.resizeHandler = this.updatePosition.bind(this);
|
|
60
|
+
this.throttledScrollHandler = this.throttle(this.scrollHandler, 20);
|
|
61
|
+
this.throttledResizeHandler = this.throttle(this.resizeHandler, 20);
|
|
62
|
+
document.addEventListener("scroll", this.throttledScrollHandler, {
|
|
63
|
+
passive: true,
|
|
64
|
+
capture: true
|
|
65
|
+
});
|
|
66
|
+
window.addEventListener("resize", this.throttledResizeHandler, { passive: true });
|
|
67
|
+
this.setupIntersectionObserver();
|
|
68
|
+
this.container.once("destroy", () => {
|
|
69
|
+
this.destroy();
|
|
70
|
+
});
|
|
71
|
+
this.scene.events.once("shutdown", () => {
|
|
72
|
+
this.destroy();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Setup IntersectionObserver to detect canvas position changes
|
|
77
|
+
*/
|
|
78
|
+
setupIntersectionObserver() {
|
|
79
|
+
const canvas = this.scene.game.canvas;
|
|
80
|
+
this.intersectionObserver = new IntersectionObserver(
|
|
81
|
+
() => {
|
|
82
|
+
this.updatePosition();
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
threshold: [0, 0.1, 0.5, 0.9, 1]
|
|
86
|
+
// Trigger on various visibility changes
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
this.intersectionObserver.observe(canvas);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Throttle function to limit call frequency
|
|
93
|
+
* @param func - Function to throttle
|
|
94
|
+
* @param delay - Minimum delay between calls in ms
|
|
95
|
+
* @returns Throttled function
|
|
96
|
+
*/
|
|
97
|
+
throttle(func, delay) {
|
|
98
|
+
let timeoutId = null;
|
|
99
|
+
return () => {
|
|
100
|
+
if (timeoutId !== null) return;
|
|
101
|
+
timeoutId = window.setTimeout(() => {
|
|
102
|
+
func();
|
|
103
|
+
timeoutId = null;
|
|
104
|
+
}, delay);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Apply default styles to input element
|
|
109
|
+
*/
|
|
110
|
+
applyDefaultStyles() {
|
|
111
|
+
Object.assign(this.input.style, {
|
|
112
|
+
position: "absolute",
|
|
113
|
+
pointerEvents: "auto",
|
|
114
|
+
boxSizing: "border-box",
|
|
115
|
+
fontFamily: "Arial, sans-serif",
|
|
116
|
+
fontSize: "16px",
|
|
117
|
+
padding: "0px",
|
|
118
|
+
margin: "0px",
|
|
119
|
+
border: "none",
|
|
120
|
+
borderRadius: "0px",
|
|
121
|
+
backgroundColor: "transparent",
|
|
122
|
+
color: "transparent",
|
|
123
|
+
outline: "none",
|
|
124
|
+
caretColor: "transparent"
|
|
125
|
+
});
|
|
126
|
+
const styleId = "phaserjsx-input-no-selection";
|
|
127
|
+
if (!document.getElementById(styleId)) {
|
|
128
|
+
const style = document.createElement("style");
|
|
129
|
+
style.id = styleId;
|
|
130
|
+
style.textContent = `
|
|
131
|
+
input[type="text"]::selection,
|
|
132
|
+
input[type="password"]::selection,
|
|
133
|
+
input[type="email"]::selection {
|
|
134
|
+
background: transparent !important;
|
|
135
|
+
color: transparent !important;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
document.head.appendChild(style);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Update input element position to match Phaser container
|
|
143
|
+
*/
|
|
144
|
+
updatePosition() {
|
|
145
|
+
if (this.isDestroyed || !this.container.scene) return;
|
|
146
|
+
const canvas = this.scene.game.canvas;
|
|
147
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
148
|
+
const worldTransform = this.container.getWorldTransformMatrix();
|
|
149
|
+
const worldX = worldTransform.tx;
|
|
150
|
+
const worldY = worldTransform.ty;
|
|
151
|
+
const containerWidth = this.container.width ?? 200;
|
|
152
|
+
const containerHeight = this.container.height ?? 40;
|
|
153
|
+
const scale = this.scene.game.scale;
|
|
154
|
+
const zoom = this.scene.cameras.main.zoom;
|
|
155
|
+
const left = Math.round(canvasRect.left + worldX * zoom * scale.displayScale.x);
|
|
156
|
+
const top = Math.round(canvasRect.top + worldY * zoom * scale.displayScale.y);
|
|
157
|
+
const width = Math.round(containerWidth * zoom * scale.displayScale.x);
|
|
158
|
+
const height = Math.round(containerHeight * zoom * scale.displayScale.y);
|
|
159
|
+
this.counter++;
|
|
160
|
+
if (this.lastValues.left === left && this.lastValues.top === top && this.lastValues.width === width && this.lastValues.height === height) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this.lastValues = { left, top, width, height };
|
|
164
|
+
this.input.style.left = `${left}px`;
|
|
165
|
+
this.input.style.top = `${top}px`;
|
|
166
|
+
this.input.style.width = `${width}px`;
|
|
167
|
+
this.input.style.height = `${height}px`;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get the DOM input element
|
|
171
|
+
*/
|
|
172
|
+
getElement() {
|
|
173
|
+
return this.input;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Set input value
|
|
177
|
+
*/
|
|
178
|
+
setValue(value) {
|
|
179
|
+
if (!this.isDestroyed) {
|
|
180
|
+
this.input.value = value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get input value
|
|
185
|
+
*/
|
|
186
|
+
getValue() {
|
|
187
|
+
return this.isDestroyed ? "" : this.input.value;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Focus the input
|
|
191
|
+
*/
|
|
192
|
+
focus() {
|
|
193
|
+
if (!this.isDestroyed) {
|
|
194
|
+
this.input.focus();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Blur the input
|
|
199
|
+
*/
|
|
200
|
+
blur() {
|
|
201
|
+
if (!this.isDestroyed) {
|
|
202
|
+
this.input.blur();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Set disabled state
|
|
207
|
+
*/
|
|
208
|
+
setDisabled(disabled) {
|
|
209
|
+
if (!this.isDestroyed) {
|
|
210
|
+
this.input.disabled = disabled;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Set placeholder
|
|
215
|
+
*/
|
|
216
|
+
setPlaceholder(placeholder) {
|
|
217
|
+
if (!this.isDestroyed) {
|
|
218
|
+
this.input.placeholder = placeholder;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Update styles
|
|
223
|
+
*/
|
|
224
|
+
setStyles(styles) {
|
|
225
|
+
if (!this.isDestroyed) {
|
|
226
|
+
Object.assign(this.input.style, styles);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Destroy the input element and cleanup
|
|
231
|
+
*/
|
|
232
|
+
destroy() {
|
|
233
|
+
if (this.isDestroyed) return;
|
|
234
|
+
this.isDestroyed = true;
|
|
235
|
+
if (this.scrollThrottleTimeout !== null) {
|
|
236
|
+
clearTimeout(this.scrollThrottleTimeout);
|
|
237
|
+
}
|
|
238
|
+
if (this.resizeThrottleTimeout !== null) {
|
|
239
|
+
clearTimeout(this.resizeThrottleTimeout);
|
|
240
|
+
}
|
|
241
|
+
if (this.intersectionObserver) {
|
|
242
|
+
this.intersectionObserver.disconnect();
|
|
243
|
+
this.intersectionObserver = null;
|
|
244
|
+
}
|
|
245
|
+
document.removeEventListener("scroll", this.throttledScrollHandler, { capture: true });
|
|
246
|
+
window.removeEventListener("resize", this.throttledResizeHandler);
|
|
247
|
+
if (this.input.parentElement) {
|
|
248
|
+
this.input.parentElement.removeChild(this.input);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.DOMInputElement = DOMInputElement;
|
|
253
|
+
//# sourceMappingURL=dom-input-manager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-input-manager.cjs","sources":["../../src/utils/dom-input-manager.ts"],"sourcesContent":["/**\n * DOM input element manager for text input overlay\n * Handles creation, positioning, and lifecycle of DOM input elements\n */\nimport type * as Phaser from 'phaser'\n\n/**\n * Configuration for DOM input element\n */\nexport interface DOMInputConfig {\n /** Input type (text, password, email, etc.) */\n type?: string\n /** Placeholder text */\n placeholder?: string\n /** Initial value */\n value?: string\n /** Whether input is disabled */\n disabled?: boolean\n /** Maximum length of input */\n maxLength?: number\n /** Autocomplete behavior */\n autocomplete?: string\n /** Autocorrect behavior (Safari) */\n autocorrect?: string\n /** Autocapitalize behavior (mobile) */\n autocapitalize?: string\n /** Spellcheck behavior */\n spellcheck?: boolean\n /** CSS styles to apply */\n styles?: Partial<CSSStyleDeclaration>\n /** Input event callback */\n onInput?: (value: string, event: Event) => void\n /** Keyboard event callbacks */\n onKeyDown?: (event: KeyboardEvent) => void\n onKeyUp?: (event: KeyboardEvent) => void\n /** Focus event callbacks */\n onFocus?: (event: FocusEvent) => void\n onBlur?: (event: FocusEvent) => void\n}\n\n/**\n * DOM input element wrapper with automatic positioning\n */\nexport class DOMInputElement {\n private input: HTMLInputElement\n private container: Phaser.GameObjects.Container\n private scene: Phaser.Scene\n private scrollHandler: () => void\n private resizeHandler: () => void\n private throttledScrollHandler: () => void\n private throttledResizeHandler: () => void\n private intersectionObserver: IntersectionObserver | null = null\n private isDestroyed = false\n private lastValues = { left: 0, top: 0, width: 0, height: 0 }\n private counter = 0\n private scrollThrottleTimeout: number | null = null\n private resizeThrottleTimeout: number | null = null\n\n constructor(container: Phaser.GameObjects.Container, config: DOMInputConfig = {}) {\n this.container = container\n this.scene = container.scene\n\n // Create input element\n this.input = document.createElement('input')\n this.input.type = config.type ?? 'text'\n if (config.placeholder) this.input.placeholder = config.placeholder\n if (config.value) this.input.value = config.value\n if (config.disabled) this.input.disabled = config.disabled\n if (config.maxLength) this.input.maxLength = config.maxLength\n if (config.autocomplete) this.input.setAttribute('autocomplete', config.autocomplete)\n if (config.autocorrect) this.input.setAttribute('autocorrect', config.autocorrect)\n if (config.autocapitalize) this.input.setAttribute('autocapitalize', config.autocapitalize)\n if (config.spellcheck !== undefined)\n this.input.setAttribute('spellcheck', config.spellcheck.toString())\n\n // Apply default styles\n this.applyDefaultStyles()\n\n // Apply custom styles\n if (config.styles) {\n Object.assign(this.input.style, config.styles)\n }\n\n // Add to DOM - use document.body for absolute positioning\n document.body.appendChild(this.input)\n\n // Setup event listeners\n if (config.onInput) {\n this.input.addEventListener('input', (e) => {\n config.onInput?.(this.input.value, e)\n })\n }\n\n if (config.onKeyDown) {\n this.input.addEventListener('keydown', config.onKeyDown)\n }\n\n if (config.onKeyUp) {\n this.input.addEventListener('keyup', config.onKeyUp)\n }\n\n if (config.onFocus) {\n this.input.addEventListener('focus', (e) => {\n config.onFocus?.(e)\n })\n }\n\n if (config.onBlur) {\n this.input.addEventListener('blur', (e) => {\n config.onBlur?.(e)\n })\n }\n\n // Initial position update\n this.updatePosition()\n\n // Bind handlers for page scrolling and resizing\n this.scrollHandler = this.updatePosition.bind(this)\n this.resizeHandler = this.updatePosition.bind(this)\n\n // Throttled handlers to limit update frequency\n this.throttledScrollHandler = this.throttle(this.scrollHandler, 20) // ~50fps max\n this.throttledResizeHandler = this.throttle(this.resizeHandler, 20) // ~50fps max\n\n // Setup event listeners immediately (always active)\n // Use capture phase to catch scroll events from any scrollable ancestor\n document.addEventListener('scroll', this.throttledScrollHandler, {\n passive: true,\n capture: true,\n })\n window.addEventListener('resize', this.throttledResizeHandler, { passive: true })\n\n // Setup IntersectionObserver to detect when canvas moves in viewport\n this.setupIntersectionObserver()\n\n // Cleanup on container destroy\n this.container.once('destroy', () => {\n this.destroy()\n })\n\n // Cleanup on scene shutdown\n this.scene.events.once('shutdown', () => {\n this.destroy()\n })\n }\n\n /**\n * Setup IntersectionObserver to detect canvas position changes\n */\n private setupIntersectionObserver(): void {\n const canvas = this.scene.game.canvas\n\n this.intersectionObserver = new IntersectionObserver(\n () => {\n // Canvas moved in viewport, update position\n this.updatePosition()\n },\n {\n threshold: [0, 0.1, 0.5, 0.9, 1.0], // Trigger on various visibility changes\n }\n )\n\n this.intersectionObserver.observe(canvas)\n }\n\n /**\n * Throttle function to limit call frequency\n * @param func - Function to throttle\n * @param delay - Minimum delay between calls in ms\n * @returns Throttled function\n */\n private throttle(func: () => void, delay: number): () => void {\n let timeoutId: number | null = null\n return () => {\n if (timeoutId !== null) return\n timeoutId = window.setTimeout(() => {\n func()\n timeoutId = null\n }, delay)\n }\n }\n\n /**\n * Apply default styles to input element\n */\n private applyDefaultStyles(): void {\n Object.assign(this.input.style, {\n position: 'absolute',\n pointerEvents: 'auto',\n boxSizing: 'border-box',\n fontFamily: 'Arial, sans-serif',\n fontSize: '16px',\n padding: '0px',\n margin: '0px',\n border: 'none',\n borderRadius: '0px',\n backgroundColor: 'transparent',\n color: 'transparent',\n outline: 'none',\n caretColor: 'transparent',\n } as Partial<CSSStyleDeclaration>)\n\n // Inject CSS to disable selection highlighting\n const styleId = 'phaserjsx-input-no-selection'\n if (!document.getElementById(styleId)) {\n const style = document.createElement('style')\n style.id = styleId\n style.textContent = `\n input[type=\"text\"]::selection,\n input[type=\"password\"]::selection,\n input[type=\"email\"]::selection {\n background: transparent !important;\n color: transparent !important;\n }\n `\n document.head.appendChild(style)\n }\n }\n\n /**\n * Update input element position to match Phaser container\n */\n private updatePosition(): void {\n if (this.isDestroyed || !this.container.scene) return\n\n const canvas = this.scene.game.canvas\n const canvasRect = canvas.getBoundingClientRect()\n\n // Get container world position\n const worldTransform = this.container.getWorldTransformMatrix()\n const worldX = worldTransform.tx\n const worldY = worldTransform.ty\n\n // Get container dimensions - prefer actual computed size over layoutProps\n // This ensures minHeight, maxHeight, and other constraints are respected\n const containerWidth = this.container.width ?? 200\n const containerHeight = this.container.height ?? 40\n\n // Calculate position relative to canvas\n const scale = this.scene.game.scale\n const zoom = this.scene.cameras.main.zoom\n\n // Calculate position and size with proper scaling\n const left = Math.round(canvasRect.left + worldX * zoom * scale.displayScale.x)\n const top = Math.round(canvasRect.top + worldY * zoom * scale.displayScale.y)\n const width = Math.round(containerWidth * zoom * scale.displayScale.x)\n const height = Math.round(containerHeight * zoom * scale.displayScale.y)\n this.counter++\n\n // apply only if changed to minimize layout thrashing\n if (\n this.lastValues.left === left &&\n this.lastValues.top === top &&\n this.lastValues.width === width &&\n this.lastValues.height === height\n ) {\n return\n }\n this.lastValues = { left, top, width, height }\n\n /* // Debug output for testing purposes\n console.log('[DOMInputElement] Updating position', {\n counter: this.counter,\n left,\n top,\n width,\n height,\n })\n */\n\n // Apply position and size\n this.input.style.left = `${left}px`\n this.input.style.top = `${top}px`\n this.input.style.width = `${width}px`\n this.input.style.height = `${height}px`\n }\n\n /**\n * Get the DOM input element\n */\n getElement(): HTMLInputElement {\n return this.input\n }\n\n /**\n * Set input value\n */\n setValue(value: string): void {\n if (!this.isDestroyed) {\n this.input.value = value\n }\n }\n\n /**\n * Get input value\n */\n getValue(): string {\n return this.isDestroyed ? '' : this.input.value\n }\n\n /**\n * Focus the input\n */\n focus(): void {\n if (!this.isDestroyed) {\n this.input.focus()\n }\n }\n\n /**\n * Blur the input\n */\n blur(): void {\n if (!this.isDestroyed) {\n this.input.blur()\n }\n }\n\n /**\n * Set disabled state\n */\n setDisabled(disabled: boolean): void {\n if (!this.isDestroyed) {\n this.input.disabled = disabled\n }\n }\n\n /**\n * Set placeholder\n */\n setPlaceholder(placeholder: string): void {\n if (!this.isDestroyed) {\n this.input.placeholder = placeholder\n }\n }\n\n /**\n * Update styles\n */\n setStyles(styles: Partial<CSSStyleDeclaration>): void {\n if (!this.isDestroyed) {\n Object.assign(this.input.style, styles)\n }\n }\n\n /**\n * Destroy the input element and cleanup\n */\n destroy(): void {\n if (this.isDestroyed) return\n this.isDestroyed = true\n\n // Clear any pending throttle timeouts\n if (this.scrollThrottleTimeout !== null) {\n clearTimeout(this.scrollThrottleTimeout)\n }\n if (this.resizeThrottleTimeout !== null) {\n clearTimeout(this.resizeThrottleTimeout)\n }\n\n // Disconnect IntersectionObserver\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect()\n this.intersectionObserver = null\n }\n\n // Remove event listeners\n document.removeEventListener('scroll', this.throttledScrollHandler, { capture: true })\n window.removeEventListener('resize', this.throttledResizeHandler)\n\n // Remove from DOM\n if (this.input.parentElement) {\n this.input.parentElement.removeChild(this.input)\n }\n }\n}\n"],"names":[],"mappings":";;AA2CO,MAAM,gBAAgB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,uBAAoD;AAAA,EACpD,cAAc;AAAA,EACd,aAAa,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,EAAA;AAAA,EAClD,UAAU;AAAA,EACV,wBAAuC;AAAA,EACvC,wBAAuC;AAAA,EAE/C,YAAY,WAAyC,SAAyB,IAAI;AAChF,SAAK,YAAY;AACjB,SAAK,QAAQ,UAAU;AAGvB,SAAK,QAAQ,SAAS,cAAc,OAAO;AAC3C,SAAK,MAAM,OAAO,OAAO,QAAQ;AACjC,QAAI,OAAO,YAAa,MAAK,MAAM,cAAc,OAAO;AACxD,QAAI,OAAO,MAAO,MAAK,MAAM,QAAQ,OAAO;AAC5C,QAAI,OAAO,SAAU,MAAK,MAAM,WAAW,OAAO;AAClD,QAAI,OAAO,UAAW,MAAK,MAAM,YAAY,OAAO;AACpD,QAAI,OAAO,aAAc,MAAK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AAC5B,WAAK,MAAM,cAAc,YAAY,KAAK,KAAK;AAAA,IACjD;AAAA,EACF;AACF;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM input element manager for text input overlay
|
|
3
|
+
* Handles creation, positioning, and lifecycle of DOM input elements
|
|
4
|
+
*/
|
|
5
|
+
import type * as Phaser from 'phaser';
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for DOM input element
|
|
8
|
+
*/
|
|
9
|
+
export interface DOMInputConfig {
|
|
10
|
+
/** Input type (text, password, email, etc.) */
|
|
11
|
+
type?: string;
|
|
12
|
+
/** Placeholder text */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Initial value */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** Whether input is disabled */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Maximum length of input */
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
/** Autocomplete behavior */
|
|
21
|
+
autocomplete?: string;
|
|
22
|
+
/** Autocorrect behavior (Safari) */
|
|
23
|
+
autocorrect?: string;
|
|
24
|
+
/** Autocapitalize behavior (mobile) */
|
|
25
|
+
autocapitalize?: string;
|
|
26
|
+
/** Spellcheck behavior */
|
|
27
|
+
spellcheck?: boolean;
|
|
28
|
+
/** CSS styles to apply */
|
|
29
|
+
styles?: Partial<CSSStyleDeclaration>;
|
|
30
|
+
/** Input event callback */
|
|
31
|
+
onInput?: (value: string, event: Event) => void;
|
|
32
|
+
/** Keyboard event callbacks */
|
|
33
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
34
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
35
|
+
/** Focus event callbacks */
|
|
36
|
+
onFocus?: (event: FocusEvent) => void;
|
|
37
|
+
onBlur?: (event: FocusEvent) => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* DOM input element wrapper with automatic positioning
|
|
41
|
+
*/
|
|
42
|
+
export declare class DOMInputElement {
|
|
43
|
+
private input;
|
|
44
|
+
private container;
|
|
45
|
+
private scene;
|
|
46
|
+
private scrollHandler;
|
|
47
|
+
private resizeHandler;
|
|
48
|
+
private throttledScrollHandler;
|
|
49
|
+
private throttledResizeHandler;
|
|
50
|
+
private intersectionObserver;
|
|
51
|
+
private isDestroyed;
|
|
52
|
+
private lastValues;
|
|
53
|
+
private counter;
|
|
54
|
+
private scrollThrottleTimeout;
|
|
55
|
+
private resizeThrottleTimeout;
|
|
56
|
+
constructor(container: Phaser.GameObjects.Container, config?: DOMInputConfig);
|
|
57
|
+
/**
|
|
58
|
+
* Setup IntersectionObserver to detect canvas position changes
|
|
59
|
+
*/
|
|
60
|
+
private setupIntersectionObserver;
|
|
61
|
+
/**
|
|
62
|
+
* Throttle function to limit call frequency
|
|
63
|
+
* @param func - Function to throttle
|
|
64
|
+
* @param delay - Minimum delay between calls in ms
|
|
65
|
+
* @returns Throttled function
|
|
66
|
+
*/
|
|
67
|
+
private throttle;
|
|
68
|
+
/**
|
|
69
|
+
* Apply default styles to input element
|
|
70
|
+
*/
|
|
71
|
+
private applyDefaultStyles;
|
|
72
|
+
/**
|
|
73
|
+
* Update input element position to match Phaser container
|
|
74
|
+
*/
|
|
75
|
+
private updatePosition;
|
|
76
|
+
/**
|
|
77
|
+
* Get the DOM input element
|
|
78
|
+
*/
|
|
79
|
+
getElement(): HTMLInputElement;
|
|
80
|
+
/**
|
|
81
|
+
* Set input value
|
|
82
|
+
*/
|
|
83
|
+
setValue(value: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get input value
|
|
86
|
+
*/
|
|
87
|
+
getValue(): string;
|
|
88
|
+
/**
|
|
89
|
+
* Focus the input
|
|
90
|
+
*/
|
|
91
|
+
focus(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Blur the input
|
|
94
|
+
*/
|
|
95
|
+
blur(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Set disabled state
|
|
98
|
+
*/
|
|
99
|
+
setDisabled(disabled: boolean): void;
|
|
100
|
+
/**
|
|
101
|
+
* Set placeholder
|
|
102
|
+
*/
|
|
103
|
+
setPlaceholder(placeholder: string): void;
|
|
104
|
+
/**
|
|
105
|
+
* Update styles
|
|
106
|
+
*/
|
|
107
|
+
setStyles(styles: Partial<CSSStyleDeclaration>): void;
|
|
108
|
+
/**
|
|
109
|
+
* Destroy the input element and cleanup
|
|
110
|
+
*/
|
|
111
|
+
destroy(): void;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=dom-input-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-input-manager.d.ts","sourceRoot":"","sources":["../../src/utils/dom-input-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AAErC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4BAA4B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACrC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/C,+BAA+B;IAC/B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aA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Ac,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAMzC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI;IAMrD;;OAEG;IACH,OAAO,IAAI,IAAI;CA2BhB"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
class DOMInputElement {
|
|
2
|
+
input;
|
|
3
|
+
container;
|
|
4
|
+
scene;
|
|
5
|
+
scrollHandler;
|
|
6
|
+
resizeHandler;
|
|
7
|
+
throttledScrollHandler;
|
|
8
|
+
throttledResizeHandler;
|
|
9
|
+
intersectionObserver = null;
|
|
10
|
+
isDestroyed = false;
|
|
11
|
+
lastValues = { left: 0, top: 0, width: 0, height: 0 };
|
|
12
|
+
counter = 0;
|
|
13
|
+
scrollThrottleTimeout = null;
|
|
14
|
+
resizeThrottleTimeout = null;
|
|
15
|
+
constructor(container, config = {}) {
|
|
16
|
+
this.container = container;
|
|
17
|
+
this.scene = container.scene;
|
|
18
|
+
this.input = document.createElement("input");
|
|
19
|
+
this.input.type = config.type ?? "text";
|
|
20
|
+
if (config.placeholder) this.input.placeholder = config.placeholder;
|
|
21
|
+
if (config.value) this.input.value = config.value;
|
|
22
|
+
if (config.disabled) this.input.disabled = config.disabled;
|
|
23
|
+
if (config.maxLength) this.input.maxLength = config.maxLength;
|
|
24
|
+
if (config.autocomplete) this.input.setAttribute("autocomplete", config.autocomplete);
|
|
25
|
+
if (config.autocorrect) this.input.setAttribute("autocorrect", config.autocorrect);
|
|
26
|
+
if (config.autocapitalize) this.input.setAttribute("autocapitalize", config.autocapitalize);
|
|
27
|
+
if (config.spellcheck !== void 0)
|
|
28
|
+
this.input.setAttribute("spellcheck", config.spellcheck.toString());
|
|
29
|
+
this.applyDefaultStyles();
|
|
30
|
+
if (config.styles) {
|
|
31
|
+
Object.assign(this.input.style, config.styles);
|
|
32
|
+
}
|
|
33
|
+
document.body.appendChild(this.input);
|
|
34
|
+
if (config.onInput) {
|
|
35
|
+
this.input.addEventListener("input", (e) => {
|
|
36
|
+
config.onInput?.(this.input.value, e);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (config.onKeyDown) {
|
|
40
|
+
this.input.addEventListener("keydown", config.onKeyDown);
|
|
41
|
+
}
|
|
42
|
+
if (config.onKeyUp) {
|
|
43
|
+
this.input.addEventListener("keyup", config.onKeyUp);
|
|
44
|
+
}
|
|
45
|
+
if (config.onFocus) {
|
|
46
|
+
this.input.addEventListener("focus", (e) => {
|
|
47
|
+
config.onFocus?.(e);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (config.onBlur) {
|
|
51
|
+
this.input.addEventListener("blur", (e) => {
|
|
52
|
+
config.onBlur?.(e);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
this.updatePosition();
|
|
56
|
+
this.scrollHandler = this.updatePosition.bind(this);
|
|
57
|
+
this.resizeHandler = this.updatePosition.bind(this);
|
|
58
|
+
this.throttledScrollHandler = this.throttle(this.scrollHandler, 20);
|
|
59
|
+
this.throttledResizeHandler = this.throttle(this.resizeHandler, 20);
|
|
60
|
+
document.addEventListener("scroll", this.throttledScrollHandler, {
|
|
61
|
+
passive: true,
|
|
62
|
+
capture: true
|
|
63
|
+
});
|
|
64
|
+
window.addEventListener("resize", this.throttledResizeHandler, { passive: true });
|
|
65
|
+
this.setupIntersectionObserver();
|
|
66
|
+
this.container.once("destroy", () => {
|
|
67
|
+
this.destroy();
|
|
68
|
+
});
|
|
69
|
+
this.scene.events.once("shutdown", () => {
|
|
70
|
+
this.destroy();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Setup IntersectionObserver to detect canvas position changes
|
|
75
|
+
*/
|
|
76
|
+
setupIntersectionObserver() {
|
|
77
|
+
const canvas = this.scene.game.canvas;
|
|
78
|
+
this.intersectionObserver = new IntersectionObserver(
|
|
79
|
+
() => {
|
|
80
|
+
this.updatePosition();
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
threshold: [0, 0.1, 0.5, 0.9, 1]
|
|
84
|
+
// Trigger on various visibility changes
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
this.intersectionObserver.observe(canvas);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Throttle function to limit call frequency
|
|
91
|
+
* @param func - Function to throttle
|
|
92
|
+
* @param delay - Minimum delay between calls in ms
|
|
93
|
+
* @returns Throttled function
|
|
94
|
+
*/
|
|
95
|
+
throttle(func, delay) {
|
|
96
|
+
let timeoutId = null;
|
|
97
|
+
return () => {
|
|
98
|
+
if (timeoutId !== null) return;
|
|
99
|
+
timeoutId = window.setTimeout(() => {
|
|
100
|
+
func();
|
|
101
|
+
timeoutId = null;
|
|
102
|
+
}, delay);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Apply default styles to input element
|
|
107
|
+
*/
|
|
108
|
+
applyDefaultStyles() {
|
|
109
|
+
Object.assign(this.input.style, {
|
|
110
|
+
position: "absolute",
|
|
111
|
+
pointerEvents: "auto",
|
|
112
|
+
boxSizing: "border-box",
|
|
113
|
+
fontFamily: "Arial, sans-serif",
|
|
114
|
+
fontSize: "16px",
|
|
115
|
+
padding: "0px",
|
|
116
|
+
margin: "0px",
|
|
117
|
+
border: "none",
|
|
118
|
+
borderRadius: "0px",
|
|
119
|
+
backgroundColor: "transparent",
|
|
120
|
+
color: "transparent",
|
|
121
|
+
outline: "none",
|
|
122
|
+
caretColor: "transparent"
|
|
123
|
+
});
|
|
124
|
+
const styleId = "phaserjsx-input-no-selection";
|
|
125
|
+
if (!document.getElementById(styleId)) {
|
|
126
|
+
const style = document.createElement("style");
|
|
127
|
+
style.id = styleId;
|
|
128
|
+
style.textContent = `
|
|
129
|
+
input[type="text"]::selection,
|
|
130
|
+
input[type="password"]::selection,
|
|
131
|
+
input[type="email"]::selection {
|
|
132
|
+
background: transparent !important;
|
|
133
|
+
color: transparent !important;
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
document.head.appendChild(style);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Update input element position to match Phaser container
|
|
141
|
+
*/
|
|
142
|
+
updatePosition() {
|
|
143
|
+
if (this.isDestroyed || !this.container.scene) return;
|
|
144
|
+
const canvas = this.scene.game.canvas;
|
|
145
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
146
|
+
const worldTransform = this.container.getWorldTransformMatrix();
|
|
147
|
+
const worldX = worldTransform.tx;
|
|
148
|
+
const worldY = worldTransform.ty;
|
|
149
|
+
const containerWidth = this.container.width ?? 200;
|
|
150
|
+
const containerHeight = this.container.height ?? 40;
|
|
151
|
+
const scale = this.scene.game.scale;
|
|
152
|
+
const zoom = this.scene.cameras.main.zoom;
|
|
153
|
+
const left = Math.round(canvasRect.left + worldX * zoom * scale.displayScale.x);
|
|
154
|
+
const top = Math.round(canvasRect.top + worldY * zoom * scale.displayScale.y);
|
|
155
|
+
const width = Math.round(containerWidth * zoom * scale.displayScale.x);
|
|
156
|
+
const height = Math.round(containerHeight * zoom * scale.displayScale.y);
|
|
157
|
+
this.counter++;
|
|
158
|
+
if (this.lastValues.left === left && this.lastValues.top === top && this.lastValues.width === width && this.lastValues.height === height) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
this.lastValues = { left, top, width, height };
|
|
162
|
+
this.input.style.left = `${left}px`;
|
|
163
|
+
this.input.style.top = `${top}px`;
|
|
164
|
+
this.input.style.width = `${width}px`;
|
|
165
|
+
this.input.style.height = `${height}px`;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get the DOM input element
|
|
169
|
+
*/
|
|
170
|
+
getElement() {
|
|
171
|
+
return this.input;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Set input value
|
|
175
|
+
*/
|
|
176
|
+
setValue(value) {
|
|
177
|
+
if (!this.isDestroyed) {
|
|
178
|
+
this.input.value = value;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get input value
|
|
183
|
+
*/
|
|
184
|
+
getValue() {
|
|
185
|
+
return this.isDestroyed ? "" : this.input.value;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Focus the input
|
|
189
|
+
*/
|
|
190
|
+
focus() {
|
|
191
|
+
if (!this.isDestroyed) {
|
|
192
|
+
this.input.focus();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Blur the input
|
|
197
|
+
*/
|
|
198
|
+
blur() {
|
|
199
|
+
if (!this.isDestroyed) {
|
|
200
|
+
this.input.blur();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Set disabled state
|
|
205
|
+
*/
|
|
206
|
+
setDisabled(disabled) {
|
|
207
|
+
if (!this.isDestroyed) {
|
|
208
|
+
this.input.disabled = disabled;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Set placeholder
|
|
213
|
+
*/
|
|
214
|
+
setPlaceholder(placeholder) {
|
|
215
|
+
if (!this.isDestroyed) {
|
|
216
|
+
this.input.placeholder = placeholder;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Update styles
|
|
221
|
+
*/
|
|
222
|
+
setStyles(styles) {
|
|
223
|
+
if (!this.isDestroyed) {
|
|
224
|
+
Object.assign(this.input.style, styles);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Destroy the input element and cleanup
|
|
229
|
+
*/
|
|
230
|
+
destroy() {
|
|
231
|
+
if (this.isDestroyed) return;
|
|
232
|
+
this.isDestroyed = true;
|
|
233
|
+
if (this.scrollThrottleTimeout !== null) {
|
|
234
|
+
clearTimeout(this.scrollThrottleTimeout);
|
|
235
|
+
}
|
|
236
|
+
if (this.resizeThrottleTimeout !== null) {
|
|
237
|
+
clearTimeout(this.resizeThrottleTimeout);
|
|
238
|
+
}
|
|
239
|
+
if (this.intersectionObserver) {
|
|
240
|
+
this.intersectionObserver.disconnect();
|
|
241
|
+
this.intersectionObserver = null;
|
|
242
|
+
}
|
|
243
|
+
document.removeEventListener("scroll", this.throttledScrollHandler, { capture: true });
|
|
244
|
+
window.removeEventListener("resize", this.throttledResizeHandler);
|
|
245
|
+
if (this.input.parentElement) {
|
|
246
|
+
this.input.parentElement.removeChild(this.input);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
export {
|
|
251
|
+
DOMInputElement
|
|
252
|
+
};
|
|
253
|
+
//# sourceMappingURL=dom-input-manager.js.map
|