@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
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @number10/jsx-phaser
|
|
2
|
+
|
|
3
|
+
Phaser 4 renderer adapter for the PhaserJSX framework — provides Phaser-specific runtime, mounting, and native components.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
/** @jsxImportSource @number10/jsx-phaser */
|
|
9
|
+
import * as Phaser from 'phaser'
|
|
10
|
+
import { Button, Text, View, mountJSX } from '@number10/jsx-phaser'
|
|
11
|
+
|
|
12
|
+
class GameScene extends Phaser.Scene {
|
|
13
|
+
create() {
|
|
14
|
+
mountJSX(this, App, { width: this.scale.width, height: this.scale.height })
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## What's included
|
|
20
|
+
|
|
21
|
+
- **All `@number10/jsx-components` re-exported** — portable UI components
|
|
22
|
+
- **Phaser-specific components** (`Graphics`, `Particles`, `TileSprite`)
|
|
23
|
+
- **Mount system** (`mountJSX`, scene lifecycle)
|
|
24
|
+
- **Gesture system** (touch, drag, double-tap, long-press)
|
|
25
|
+
- **Theme system** with Phaser-specific defaults and presets
|
|
26
|
+
|
|
27
|
+
## Phaser-native components (Klasse C)
|
|
28
|
+
|
|
29
|
+
These are intentionally NOT portable — they use Phaser GameObjects directly:
|
|
30
|
+
|
|
31
|
+
| Component | API | Notes |
|
|
32
|
+
| ----------------- | ------------------------------------- | ------------------------------------- |
|
|
33
|
+
| `Graphics` | `onDraw(Phaser.GameObjects.Graphics)` | Phaser-native drawing |
|
|
34
|
+
| `Particles` | Phaser particle emitter | Phaser-specific |
|
|
35
|
+
| `TileSprite` | Phaser tile sprite | Phaser-specific |
|
|
36
|
+
| `RefOriginView` | Phaser origin API | Legacy, Phaser-only |
|
|
37
|
+
| `Sprite` (Phaser) | Phaser.GameObjects.Sprite | Has animation callbacks + Phaser refs |
|
|
38
|
+
|
|
39
|
+
⚠️ **Name conflict:** `Sprite` exists in both `@number10/jsx-components` (portable) and `@number10/jsx-phaser` (Phaser-native with animation callbacks).
|
|
40
|
+
⚠️ **Name conflict:** `NineSlice` exists in both `@number10/jsx-components` (portable, `TextureResolver`-based) and `@number10/jsx-phaser` (Phaser-native `Phaser.GameObjects.NineSlice`).
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
GPL-3.0-only
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getDefaultExportFromCjs(x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5
|
+
}
|
|
6
|
+
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
7
|
+
//# sourceMappingURL=_commonjsHelpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const _commonjsHelpers = require("./_commonjsHelpers.cjs");
|
|
3
|
+
const index$1 = require("../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs");
|
|
4
|
+
var fastDeepEqualExports = index$1.__require();
|
|
5
|
+
const index = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(fastDeepEqualExports);
|
|
6
|
+
module.exports = index;
|
|
7
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as requireFastDeepEqual } from "../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js";
|
|
3
|
+
var fastDeepEqualExports = requireFastDeepEqual();
|
|
4
|
+
const index = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
5
|
+
export {
|
|
6
|
+
index as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation utilities — re-exports from @number10/jsx-core.
|
|
3
|
+
*
|
|
4
|
+
* @migration(audit:surface-access) Phase 7 — spring physics + useSpring moved to Core ✅
|
|
5
|
+
*/
|
|
6
|
+
export { animatedSignal, computed, createTween, Easing, isAnimatedSignal, SPRING_PRESETS, SpringPhysics, unwrapSignal, useSpring, useSprings, type AnimatedSignal, type AnimationConfig, type AnimationPreset, type EasingFn, type SpringConfig, type SpringState, type TweenConfig, type TweenHandle, } from '@number10/jsx-core';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,cAAc,EACd,QAAQ,EACR,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/camera/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("phaser");
|
|
4
|
+
const hooks = require("../hooks.cjs");
|
|
5
|
+
const jsxCore = require("@number10/jsx-core");
|
|
6
|
+
function useCameraFX(cameraRef, options = {}) {
|
|
7
|
+
const scene = hooks.useScene();
|
|
8
|
+
const activeFxRef = jsxCore.useRef(/* @__PURE__ */ new Set());
|
|
9
|
+
const baseZoomRef = jsxCore.useRef(null);
|
|
10
|
+
const getCamera = jsxCore.useCallback(() => {
|
|
11
|
+
return cameraRef?.current ?? scene.cameras.main;
|
|
12
|
+
}, [cameraRef, scene]);
|
|
13
|
+
const applyCameraFX = jsxCore.useCallback(
|
|
14
|
+
(fx, config) => {
|
|
15
|
+
const camera = getCamera();
|
|
16
|
+
if (!camera) {
|
|
17
|
+
console.warn("[useCameraFX] No camera available");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (baseZoomRef.current === null) {
|
|
21
|
+
baseZoomRef.current = camera.zoom;
|
|
22
|
+
}
|
|
23
|
+
const cleanup = fx(camera, config);
|
|
24
|
+
if (typeof cleanup === "function") {
|
|
25
|
+
activeFxRef.current.add(cleanup);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
[getCamera]
|
|
29
|
+
);
|
|
30
|
+
const clearCameraFX = jsxCore.useCallback(() => {
|
|
31
|
+
const camera = getCamera();
|
|
32
|
+
activeFxRef.current.forEach((cleanup) => cleanup());
|
|
33
|
+
activeFxRef.current.clear();
|
|
34
|
+
if (!camera) return;
|
|
35
|
+
const cameraWithStops = camera;
|
|
36
|
+
if (typeof cameraWithStops.stopShake === "function") cameraWithStops.stopShake();
|
|
37
|
+
if (typeof cameraWithStops.stopFlash === "function") cameraWithStops.stopFlash();
|
|
38
|
+
if (typeof cameraWithStops.stopFade === "function") cameraWithStops.stopFade();
|
|
39
|
+
if (options.resetZoomOnClear !== false && baseZoomRef.current !== null) {
|
|
40
|
+
camera.setZoom(baseZoomRef.current);
|
|
41
|
+
}
|
|
42
|
+
}, [getCamera, options.resetZoomOnClear]);
|
|
43
|
+
jsxCore.useEffect(() => {
|
|
44
|
+
return () => clearCameraFX();
|
|
45
|
+
}, [clearCameraFX]);
|
|
46
|
+
return { applyCameraFX, clearCameraFX };
|
|
47
|
+
}
|
|
48
|
+
exports.useCameraFX = useCameraFX;
|
|
49
|
+
//# sourceMappingURL=use-camera-fx.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-camera-fx.cjs","sources":["../../src/camera/use-camera-fx.ts"],"sourcesContent":["/**\n * Hook and creators for Phaser camera effects\n */\nimport * as Phaser from 'phaser'\nimport { useCallback, useEffect, useRef, useScene } from '../hooks'\nimport type { RefObject } from '../types'\n\n/**\n * Base camera FX config\n */\nexport interface CameraFXConfig {\n duration?: number\n force?: boolean\n onComplete?: () => void\n}\n\n/**\n * Camera FX creator function signature\n */\ntype CameraFXFn<TConfig extends CameraFXConfig = CameraFXConfig> = (\n camera: Phaser.Cameras.Scene2D.Camera,\n config: TConfig\n) => (() => void) | void\n\nexport function useCameraFX(\n cameraRef?: RefObject<Phaser.Cameras.Scene2D.Camera | null>,\n options: { resetZoomOnClear?: boolean } = {}\n): {\n applyCameraFX: <TConfig extends CameraFXConfig>(fx: CameraFXFn<TConfig>, config: TConfig) => void\n clearCameraFX: () => void\n} {\n const scene = useScene()\n const activeFxRef = useRef<Set<() => void>>(new Set())\n const baseZoomRef = useRef<number | null>(null)\n\n const getCamera = useCallback(() => {\n return cameraRef?.current ?? scene.cameras.main\n }, [cameraRef, scene])\n\n const applyCameraFX = useCallback(\n <TConfig extends CameraFXConfig>(fx: CameraFXFn<TConfig>, config: TConfig) => {\n const camera = getCamera()\n if (!camera) {\n console.warn('[useCameraFX] No camera available')\n return\n }\n\n if (baseZoomRef.current === null) {\n baseZoomRef.current = camera.zoom\n }\n\n const cleanup = fx(camera, config)\n if (typeof cleanup === 'function') {\n activeFxRef.current.add(cleanup)\n }\n },\n [getCamera]\n )\n\n const clearCameraFX = useCallback(() => {\n const camera = getCamera()\n activeFxRef.current.forEach((cleanup) => cleanup())\n activeFxRef.current.clear()\n\n if (!camera) return\n const cameraWithStops = camera as unknown as {\n stopShake?: () => void\n stopFlash?: () => void\n stopFade?: () => void\n }\n if (typeof cameraWithStops.stopShake === 'function') cameraWithStops.stopShake()\n if (typeof cameraWithStops.stopFlash === 'function') cameraWithStops.stopFlash()\n if (typeof cameraWithStops.stopFade === 'function') cameraWithStops.stopFade()\n\n if (options.resetZoomOnClear !== false && baseZoomRef.current !== null) {\n camera.setZoom(baseZoomRef.current)\n }\n }, [getCamera, options.resetZoomOnClear])\n\n useEffect(() => {\n return () => clearCameraFX()\n }, [clearCameraFX])\n\n return { applyCameraFX, clearCameraFX }\n}\n"],"names":["useScene","useRef","useCallback","useEffect"],"mappings":";;;;;AAwBO,SAAS,YACd,WACA,UAA0C,IAI1C;AACA,QAAM,QAAQA,MAAAA,SAAA;AACd,QAAM,cAAcC,QAAAA,OAAwB,oBAAI,KAAK;AACrD,QAAM,cAAcA,QAAAA,OAAsB,IAAI;AAE9C,QAAM,YAAYC,QAAAA,YAAY,MAAM;AAClC,WAAO,WAAW,WAAW,MAAM,QAAQ;AAAA,EAC7C,GAAG,CAAC,WAAW,KAAK,CAAC;AAErB,QAAM,gBAAgBA,QAAAA;AAAAA,IACpB,CAAiC,IAAyB,WAAoB;AAC5E,YAAM,SAAS,UAAA;AACf,UAAI,CAAC,QAAQ;AACX,gBAAQ,KAAK,mCAAmC;AAChD;AAAA,MACF;AAEA,UAAI,YAAY,YAAY,MAAM;AAChC,oBAAY,UAAU,OAAO;AAAA,MAC/B;AAEA,YAAM,UAAU,GAAG,QAAQ,MAAM;AACjC,UAAI,OAAO,YAAY,YAAY;AACjC,oBAAY,QAAQ,IAAI,OAAO;AAAA,MACjC;AAAA,IACF;AAAA,IACA,CAAC,SAAS;AAAA,EAAA;AAGZ,QAAM,gBAAgBA,QAAAA,YAAY,MAAM;AACtC,UAAM,SAAS,UAAA;AACf,gBAAY,QAAQ,QAAQ,CAAC,YAAY,SAAS;AAClD,gBAAY,QAAQ,MAAA;AAEpB,QAAI,CAAC,OAAQ;AACb,UAAM,kBAAkB;AAKxB,QAAI,OAAO,gBAAgB,cAAc,4BAA4B,UAAA;AACrE,QAAI,OAAO,gBAAgB,cAAc,4BAA4B,UAAA;AACrE,QAAI,OAAO,gBAAgB,aAAa,4BAA4B,SAAA;AAEpE,QAAI,QAAQ,qBAAqB,SAAS,YAAY,YAAY,MAAM;AACtE,aAAO,QAAQ,YAAY,OAAO;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,WAAW,QAAQ,gBAAgB,CAAC;AAExCC,UAAAA,UAAU,MAAM;AACd,WAAO,MAAM,cAAA;AAAA,EACf,GAAG,CAAC,aAAa,CAAC;AAElB,SAAO,EAAE,eAAe,cAAA;AAC1B;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RefObject } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook and creators for Phaser camera effects
|
|
4
|
+
*/
|
|
5
|
+
import * as Phaser from 'phaser';
|
|
6
|
+
/**
|
|
7
|
+
* Base camera FX config
|
|
8
|
+
*/
|
|
9
|
+
export interface CameraFXConfig {
|
|
10
|
+
duration?: number;
|
|
11
|
+
force?: boolean;
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Camera FX creator function signature
|
|
16
|
+
*/
|
|
17
|
+
type CameraFXFn<TConfig extends CameraFXConfig = CameraFXConfig> = (camera: Phaser.Cameras.Scene2D.Camera, config: TConfig) => (() => void) | void;
|
|
18
|
+
export declare function useCameraFX(cameraRef?: RefObject<Phaser.Cameras.Scene2D.Camera | null>, options?: {
|
|
19
|
+
resetZoomOnClear?: boolean;
|
|
20
|
+
}): {
|
|
21
|
+
applyCameraFX: <TConfig extends CameraFXConfig>(fx: CameraFXFn<TConfig>, config: TConfig) => void;
|
|
22
|
+
clearCameraFX: () => void;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=use-camera-fx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-camera-fx.d.ts","sourceRoot":"","sources":["../../src/camera/use-camera-fx.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB;AAED;;GAEG;AACH,KAAK,UAAU,CAAC,OAAO,SAAS,cAAc,GAAG,cAAc,IAAI,CACjE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EACrC,MAAM,EAAE,OAAO,KACZ,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAA;AAExB,wBAAgB,WAAW,CACzB,SAAS,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAC3D,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3C;IACD,aAAa,EAAE,CAAC,OAAO,SAAS,cAAc,EAAE,EAAE,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACjG,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B,CAsDA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "phaser";
|
|
2
|
+
import { useScene } from "../hooks.js";
|
|
3
|
+
import { useRef, useCallback, useEffect } from "@number10/jsx-core";
|
|
4
|
+
function useCameraFX(cameraRef, options = {}) {
|
|
5
|
+
const scene = useScene();
|
|
6
|
+
const activeFxRef = useRef(/* @__PURE__ */ new Set());
|
|
7
|
+
const baseZoomRef = useRef(null);
|
|
8
|
+
const getCamera = useCallback(() => {
|
|
9
|
+
return cameraRef?.current ?? scene.cameras.main;
|
|
10
|
+
}, [cameraRef, scene]);
|
|
11
|
+
const applyCameraFX = useCallback(
|
|
12
|
+
(fx, config) => {
|
|
13
|
+
const camera = getCamera();
|
|
14
|
+
if (!camera) {
|
|
15
|
+
console.warn("[useCameraFX] No camera available");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (baseZoomRef.current === null) {
|
|
19
|
+
baseZoomRef.current = camera.zoom;
|
|
20
|
+
}
|
|
21
|
+
const cleanup = fx(camera, config);
|
|
22
|
+
if (typeof cleanup === "function") {
|
|
23
|
+
activeFxRef.current.add(cleanup);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
[getCamera]
|
|
27
|
+
);
|
|
28
|
+
const clearCameraFX = useCallback(() => {
|
|
29
|
+
const camera = getCamera();
|
|
30
|
+
activeFxRef.current.forEach((cleanup) => cleanup());
|
|
31
|
+
activeFxRef.current.clear();
|
|
32
|
+
if (!camera) return;
|
|
33
|
+
const cameraWithStops = camera;
|
|
34
|
+
if (typeof cameraWithStops.stopShake === "function") cameraWithStops.stopShake();
|
|
35
|
+
if (typeof cameraWithStops.stopFlash === "function") cameraWithStops.stopFlash();
|
|
36
|
+
if (typeof cameraWithStops.stopFade === "function") cameraWithStops.stopFade();
|
|
37
|
+
if (options.resetZoomOnClear !== false && baseZoomRef.current !== null) {
|
|
38
|
+
camera.setZoom(baseZoomRef.current);
|
|
39
|
+
}
|
|
40
|
+
}, [getCamera, options.resetZoomOnClear]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
return () => clearCameraFX();
|
|
43
|
+
}, [clearCameraFX]);
|
|
44
|
+
return { applyCameraFX, clearCameraFX };
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
useCameraFX
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=use-camera-fx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-camera-fx.js","sources":["../../src/camera/use-camera-fx.ts"],"sourcesContent":["/**\n * Hook and creators for Phaser camera effects\n */\nimport * as Phaser from 'phaser'\nimport { useCallback, useEffect, useRef, useScene } from '../hooks'\nimport type { RefObject } from '../types'\n\n/**\n * Base camera FX config\n */\nexport interface CameraFXConfig {\n duration?: number\n force?: boolean\n onComplete?: () => void\n}\n\n/**\n * Camera FX creator function signature\n */\ntype CameraFXFn<TConfig extends CameraFXConfig = CameraFXConfig> = (\n camera: Phaser.Cameras.Scene2D.Camera,\n config: TConfig\n) => (() => void) | void\n\nexport function useCameraFX(\n cameraRef?: RefObject<Phaser.Cameras.Scene2D.Camera | null>,\n options: { resetZoomOnClear?: boolean } = {}\n): {\n applyCameraFX: <TConfig extends CameraFXConfig>(fx: CameraFXFn<TConfig>, config: TConfig) => void\n clearCameraFX: () => void\n} {\n const scene = useScene()\n const activeFxRef = useRef<Set<() => void>>(new Set())\n const baseZoomRef = useRef<number | null>(null)\n\n const getCamera = useCallback(() => {\n return cameraRef?.current ?? scene.cameras.main\n }, [cameraRef, scene])\n\n const applyCameraFX = useCallback(\n <TConfig extends CameraFXConfig>(fx: CameraFXFn<TConfig>, config: TConfig) => {\n const camera = getCamera()\n if (!camera) {\n console.warn('[useCameraFX] No camera available')\n return\n }\n\n if (baseZoomRef.current === null) {\n baseZoomRef.current = camera.zoom\n }\n\n const cleanup = fx(camera, config)\n if (typeof cleanup === 'function') {\n activeFxRef.current.add(cleanup)\n }\n },\n [getCamera]\n )\n\n const clearCameraFX = useCallback(() => {\n const camera = getCamera()\n activeFxRef.current.forEach((cleanup) => cleanup())\n activeFxRef.current.clear()\n\n if (!camera) return\n const cameraWithStops = camera as unknown as {\n stopShake?: () => void\n stopFlash?: () => void\n stopFade?: () => void\n }\n if (typeof cameraWithStops.stopShake === 'function') cameraWithStops.stopShake()\n if (typeof cameraWithStops.stopFlash === 'function') cameraWithStops.stopFlash()\n if (typeof cameraWithStops.stopFade === 'function') cameraWithStops.stopFade()\n\n if (options.resetZoomOnClear !== false && baseZoomRef.current !== null) {\n camera.setZoom(baseZoomRef.current)\n }\n }, [getCamera, options.resetZoomOnClear])\n\n useEffect(() => {\n return () => clearCameraFX()\n }, [clearCameraFX])\n\n return { applyCameraFX, clearCameraFX }\n}\n"],"names":[],"mappings":";;;AAwBO,SAAS,YACd,WACA,UAA0C,IAI1C;AACA,QAAM,QAAQ,SAAA;AACd,QAAM,cAAc,OAAwB,oBAAI,KAAK;AACrD,QAAM,cAAc,OAAsB,IAAI;AAE9C,QAAM,YAAY,YAAY,MAAM;AAClC,WAAO,WAAW,WAAW,MAAM,QAAQ;AAAA,EAC7C,GAAG,CAAC,WAAW,KAAK,CAAC;AAErB,QAAM,gBAAgB;AAAA,IACpB,CAAiC,IAAyB,WAAoB;AAC5E,YAAM,SAAS,UAAA;AACf,UAAI,CAAC,QAAQ;AACX,gBAAQ,KAAK,mCAAmC;AAChD;AAAA,MACF;AAEA,UAAI,YAAY,YAAY,MAAM;AAChC,oBAAY,UAAU,OAAO;AAAA,MAC/B;AAEA,YAAM,UAAU,GAAG,QAAQ,MAAM;AACjC,UAAI,OAAO,YAAY,YAAY;AACjC,oBAAY,QAAQ,IAAI,OAAO;AAAA,MACjC;AAAA,IACF;AAAA,IACA,CAAC,SAAS;AAAA,EAAA;AAGZ,QAAM,gBAAgB,YAAY,MAAM;AACtC,UAAM,SAAS,UAAA;AACf,gBAAY,QAAQ,QAAQ,CAAC,YAAY,SAAS;AAClD,gBAAY,QAAQ,MAAA;AAEpB,QAAI,CAAC,OAAQ;AACb,UAAM,kBAAkB;AAKxB,QAAI,OAAO,gBAAgB,cAAc,4BAA4B,UAAA;AACrE,QAAI,OAAO,gBAAgB,cAAc,4BAA4B,UAAA;AACrE,QAAI,OAAO,gBAAgB,aAAa,4BAA4B,SAAA;AAEpE,QAAI,QAAQ,qBAAqB,SAAS,YAAY,YAAY,MAAM;AACtE,aAAO,QAAQ,YAAY,OAAO;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,WAAW,QAAQ,gBAAgB,CAAC;AAExC,YAAU,MAAM;AACd,WAAO,MAAM,cAAA;AAAA,EACf,GAAG,CAAC,aAAa,CAAC;AAElB,SAAO,EAAE,eAAe,cAAA;AAC1B;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("phaser");
|
|
4
|
+
const stencilClipExtension = require("./stencil-clip-extension.cjs");
|
|
5
|
+
stencilClipExtension.installStencilClipExtension();
|
|
6
|
+
exports.installStencilClipExtension = stencilClipExtension.installStencilClipExtension;
|
|
7
|
+
exports.uninstallStencilClipExtension = stencilClipExtension.uninstallStencilClipExtension;
|
|
8
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/clip/index.ts"],"sourcesContent":["export * from './stencil-clip'\nexport * from './stencil-clip-extension'\n\nimport { installStencilClipExtension } from './stencil-clip-extension'\n\ninstallStencilClipExtension()\n"],"names":["installStencilClipExtension"],"mappings":";;;;AAKAA,qBAAAA,4BAAA;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clip/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "phaser";
|
|
2
|
+
import { installStencilClipExtension } from "./stencil-clip-extension.js";
|
|
3
|
+
import { uninstallStencilClipExtension } from "./stencil-clip-extension.js";
|
|
4
|
+
installStencilClipExtension();
|
|
5
|
+
export {
|
|
6
|
+
installStencilClipExtension,
|
|
7
|
+
uninstallStencilClipExtension
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/clip/index.ts"],"sourcesContent":["export * from './stencil-clip'\nexport * from './stencil-clip-extension'\n\nimport { installStencilClipExtension } from './stencil-clip-extension'\n\ninstallStencilClipExtension()\n"],"names":[],"mappings":";;;AAKA,4BAAA;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const _depthByGl = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
const _prerenderHooked = /* @__PURE__ */ new WeakSet();
|
|
5
|
+
function getDepth(gl) {
|
|
6
|
+
let d = _depthByGl.get(gl);
|
|
7
|
+
if (!d) {
|
|
8
|
+
d = { value: 0 };
|
|
9
|
+
_depthByGl.set(gl, d);
|
|
10
|
+
}
|
|
11
|
+
return d;
|
|
12
|
+
}
|
|
13
|
+
function ensurePrerenderReset(gl, game, resetFboState) {
|
|
14
|
+
if (_prerenderHooked.has(game)) return;
|
|
15
|
+
_prerenderHooked.add(game);
|
|
16
|
+
game.events.on("prerender", () => {
|
|
17
|
+
const d = _depthByGl.get(gl);
|
|
18
|
+
if (d) d.value = 0;
|
|
19
|
+
resetFboState(gl);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.ensurePrerenderReset = ensurePrerenderReset;
|
|
23
|
+
exports.getDepth = getDepth;
|
|
24
|
+
//# sourceMappingURL=stencil-clip-depth.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stencil-clip-depth.cjs","sources":["../../src/clip/stencil-clip-depth.ts"],"sourcesContent":["import type * as Phaser from 'phaser'\n\n/**\n * Shared depth counter per GL context.\n * Incremented before each clip's INCR pass, decremented after the DECR pass.\n */\nconst _depthByGl = new WeakMap<WebGLRenderingContext, { value: number }>()\n\nconst _prerenderHooked = new WeakSet<Phaser.Game>()\n\nexport function getDepth(gl: WebGLRenderingContext): { value: number } {\n let d = _depthByGl.get(gl)\n if (!d) {\n d = { value: 0 }\n _depthByGl.set(gl, d)\n }\n return d\n}\n\n/**\n * Registers a per-frame prerender listener that resets stencil clip state.\n * Registered at most once per Phaser.Game instance.\n */\nexport function ensurePrerenderReset(\n gl: WebGLRenderingContext,\n game: Phaser.Game,\n resetFboState: (gl: WebGLRenderingContext) => void\n): void {\n if (_prerenderHooked.has(game)) return\n _prerenderHooked.add(game)\n game.events.on('prerender', () => {\n const d = _depthByGl.get(gl)\n if (d) d.value = 0\n resetFboState(gl)\n })\n}\n"],"names":[],"mappings":";;AAMA,MAAM,iCAAiB,QAAA;AAEvB,MAAM,uCAAuB,QAAA;AAEtB,SAAS,SAAS,IAA8C;AACrE,MAAI,IAAI,WAAW,IAAI,EAAE;AACzB,MAAI,CAAC,GAAG;AACN,QAAI,EAAE,OAAO,EAAA;AACb,eAAW,IAAI,IAAI,CAAC;AAAA,EACtB;AACA,SAAO;AACT;AAMO,SAAS,qBACd,IACA,MACA,eACM;AACN,MAAI,iBAAiB,IAAI,IAAI,EAAG;AAChC,mBAAiB,IAAI,IAAI;AACzB,OAAK,OAAO,GAAG,aAAa,MAAM;AAChC,UAAM,IAAI,WAAW,IAAI,EAAE;AAC3B,QAAI,KAAK,QAAQ;AACjB,kBAAc,EAAE;AAAA,EAClB,CAAC;AACH;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Phaser from 'phaser';
|
|
2
|
+
export declare function getDepth(gl: WebGLRenderingContext): {
|
|
3
|
+
value: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Registers a per-frame prerender listener that resets stencil clip state.
|
|
7
|
+
* Registered at most once per Phaser.Game instance.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensurePrerenderReset(gl: WebGLRenderingContext, game: Phaser.Game, resetFboState: (gl: WebGLRenderingContext) => void): void;
|
|
10
|
+
//# sourceMappingURL=stencil-clip-depth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stencil-clip-depth.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-depth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AAUrC,wBAAgB,QAAQ,CAAC,EAAE,EAAE,qBAAqB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAOrE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,qBAAqB,EACzB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,aAAa,EAAE,CAAC,EAAE,EAAE,qBAAqB,KAAK,IAAI,GACjD,IAAI,CAQN"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const _depthByGl = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
const _prerenderHooked = /* @__PURE__ */ new WeakSet();
|
|
3
|
+
function getDepth(gl) {
|
|
4
|
+
let d = _depthByGl.get(gl);
|
|
5
|
+
if (!d) {
|
|
6
|
+
d = { value: 0 };
|
|
7
|
+
_depthByGl.set(gl, d);
|
|
8
|
+
}
|
|
9
|
+
return d;
|
|
10
|
+
}
|
|
11
|
+
function ensurePrerenderReset(gl, game, resetFboState) {
|
|
12
|
+
if (_prerenderHooked.has(game)) return;
|
|
13
|
+
_prerenderHooked.add(game);
|
|
14
|
+
game.events.on("prerender", () => {
|
|
15
|
+
const d = _depthByGl.get(gl);
|
|
16
|
+
if (d) d.value = 0;
|
|
17
|
+
resetFboState(gl);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
ensurePrerenderReset,
|
|
22
|
+
getDepth
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=stencil-clip-depth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stencil-clip-depth.js","sources":["../../src/clip/stencil-clip-depth.ts"],"sourcesContent":["import type * as Phaser from 'phaser'\n\n/**\n * Shared depth counter per GL context.\n * Incremented before each clip's INCR pass, decremented after the DECR pass.\n */\nconst _depthByGl = new WeakMap<WebGLRenderingContext, { value: number }>()\n\nconst _prerenderHooked = new WeakSet<Phaser.Game>()\n\nexport function getDepth(gl: WebGLRenderingContext): { value: number } {\n let d = _depthByGl.get(gl)\n if (!d) {\n d = { value: 0 }\n _depthByGl.set(gl, d)\n }\n return d\n}\n\n/**\n * Registers a per-frame prerender listener that resets stencil clip state.\n * Registered at most once per Phaser.Game instance.\n */\nexport function ensurePrerenderReset(\n gl: WebGLRenderingContext,\n game: Phaser.Game,\n resetFboState: (gl: WebGLRenderingContext) => void\n): void {\n if (_prerenderHooked.has(game)) return\n _prerenderHooked.add(game)\n game.events.on('prerender', () => {\n const d = _depthByGl.get(gl)\n if (d) d.value = 0\n resetFboState(gl)\n })\n}\n"],"names":[],"mappings":"AAMA,MAAM,iCAAiB,QAAA;AAEvB,MAAM,uCAAuB,QAAA;AAEtB,SAAS,SAAS,IAA8C;AACrE,MAAI,IAAI,WAAW,IAAI,EAAE;AACzB,MAAI,CAAC,GAAG;AACN,QAAI,EAAE,OAAO,EAAA;AACb,eAAW,IAAI,IAAI,CAAC;AAAA,EACtB;AACA,SAAO;AACT;AAMO,SAAS,qBACd,IACA,MACA,eACM;AACN,MAAI,iBAAiB,IAAI,IAAI,EAAG;AAChC,mBAAiB,IAAI,IAAI;AACzB,OAAK,OAAO,GAAG,aAAa,MAAM;AAChC,UAAM,IAAI,WAAW,IAAI,EAAE;AAC3B,QAAI,KAAK,QAAQ;AACjB,kBAAc,EAAE;AAAA,EAClB,CAAC;AACH;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Phaser = require("phaser");
|
|
4
|
+
const stencilClip = require("./stencil-clip.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 addMethod(proto, methodName, fn) {
|
|
23
|
+
const hadOwn = Object.prototype.hasOwnProperty.call(proto, methodName);
|
|
24
|
+
const previous = proto[methodName];
|
|
25
|
+
if (!hadOwn) {
|
|
26
|
+
proto[methodName] = fn;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
restore: () => {
|
|
30
|
+
if (!hadOwn) {
|
|
31
|
+
delete proto[methodName];
|
|
32
|
+
} else {
|
|
33
|
+
proto[methodName] = previous;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function wrapMethod(proto, methodName, wrapper) {
|
|
39
|
+
const original = proto[methodName];
|
|
40
|
+
if (typeof original !== "function") {
|
|
41
|
+
return { restore() {
|
|
42
|
+
} };
|
|
43
|
+
}
|
|
44
|
+
const wrapped = function(...args) {
|
|
45
|
+
return wrapper(original, this, ...args);
|
|
46
|
+
};
|
|
47
|
+
proto[methodName] = wrapped;
|
|
48
|
+
return {
|
|
49
|
+
restore: () => {
|
|
50
|
+
proto[methodName] = original;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
let installed = false;
|
|
55
|
+
let restoreHandles = [];
|
|
56
|
+
function canCreateStencilClipSource(source) {
|
|
57
|
+
if (source.kind === "bitmap") {
|
|
58
|
+
return source.texture !== void 0;
|
|
59
|
+
}
|
|
60
|
+
return source.width !== void 0 && source.height !== void 0;
|
|
61
|
+
}
|
|
62
|
+
function installStencilClipExtension() {
|
|
63
|
+
if (installed) return;
|
|
64
|
+
installed = true;
|
|
65
|
+
const proto = Phaser__namespace.GameObjects.Container.prototype;
|
|
66
|
+
restoreHandles.push(
|
|
67
|
+
addMethod(
|
|
68
|
+
proto,
|
|
69
|
+
"setStencilClip",
|
|
70
|
+
function(source) {
|
|
71
|
+
stencilClip.applyStencilClip(this, source);
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
restoreHandles.push(
|
|
77
|
+
addMethod(
|
|
78
|
+
proto,
|
|
79
|
+
"updateStencilClip",
|
|
80
|
+
function(source) {
|
|
81
|
+
const handle = stencilClip.getStencilClipHandle(this);
|
|
82
|
+
if (handle) handle.update(source);
|
|
83
|
+
else if (canCreateStencilClipSource(source)) stencilClip.applyStencilClip(this, source);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
restoreHandles.push(
|
|
89
|
+
addMethod(proto, "clearStencilClip", function() {
|
|
90
|
+
stencilClip.clearStencilClip(this);
|
|
91
|
+
return this;
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
restoreHandles.push(
|
|
95
|
+
addMethod(proto, "getStencilClipHandle", function() {
|
|
96
|
+
return stencilClip.getStencilClipHandle(this);
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
restoreHandles.push(
|
|
100
|
+
wrapMethod(proto, "destroy", (original, self, ...args) => {
|
|
101
|
+
stencilClip.clearStencilClip(self);
|
|
102
|
+
return original.apply(self, args);
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function uninstallStencilClipExtension() {
|
|
107
|
+
for (const handle of [...restoreHandles].reverse()) handle.restore();
|
|
108
|
+
restoreHandles = [];
|
|
109
|
+
installed = false;
|
|
110
|
+
}
|
|
111
|
+
exports.installStencilClipExtension = installStencilClipExtension;
|
|
112
|
+
exports.uninstallStencilClipExtension = uninstallStencilClipExtension;
|
|
113
|
+
//# sourceMappingURL=stencil-clip-extension.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stencil-clip-extension.cjs","sources":["../../src/clip/stencil-clip-extension.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\nimport * as Phaser from 'phaser'\nimport {\n applyStencilClip,\n clearStencilClip,\n getStencilClipHandle,\n type StencilClipHandle,\n type StencilClipSource,\n type StencilClipUpdate,\n} from './stencil-clip'\n\ntype AnyFn = (...args: unknown[]) => unknown\n\ninterface ExtensionHandle {\n restore(): void\n}\n\nfunction addMethod<T extends object, K extends PropertyKey>(\n proto: T,\n methodName: K,\n fn: unknown\n): ExtensionHandle {\n const hadOwn = Object.prototype.hasOwnProperty.call(proto, methodName)\n const previous = (proto as Record<PropertyKey, unknown>)[methodName]\n\n if (!hadOwn) {\n ;(proto as Record<PropertyKey, unknown>)[methodName] = fn\n }\n\n return {\n restore: () => {\n if (!hadOwn) {\n delete (proto as Record<PropertyKey, unknown>)[methodName]\n } else {\n ;(proto as Record<PropertyKey, unknown>)[methodName] = previous\n }\n },\n }\n}\n\nfunction wrapMethod<T extends object, K extends keyof T & string>(\n proto: T,\n methodName: K,\n wrapper: (original: AnyFn, self: unknown, ...args: unknown[]) => unknown\n): ExtensionHandle {\n const original = proto[methodName] as unknown as AnyFn\n\n if (typeof original !== 'function') {\n return { restore() {} }\n }\n\n const wrapped: AnyFn = function (this: unknown, ...args: unknown[]) {\n return wrapper(original, this, ...args)\n }\n\n ;(proto as Record<string, unknown>)[methodName] = wrapped\n\n return {\n restore: () => {\n ;(proto as Record<string, unknown>)[methodName] = original\n },\n }\n}\n\nlet installed = false\nlet restoreHandles: ExtensionHandle[] = []\n\nfunction canCreateStencilClipSource(source: StencilClipUpdate): source is StencilClipSource {\n if (source.kind === 'bitmap') {\n return source.texture !== undefined\n }\n\n return source.width !== undefined && source.height !== undefined\n}\n\n/** Installs stencil clip helpers on Phaser.GameObjects.Container.prototype. */\nexport function installStencilClipExtension(): void {\n if (installed) return\n installed = true\n\n const proto = Phaser.GameObjects.Container.prototype as Phaser.GameObjects.Container &\n Record<string, unknown>\n\n restoreHandles.push(\n addMethod(\n proto,\n 'setStencilClip',\n function (this: Phaser.GameObjects.Container, source: StencilClipSource) {\n applyStencilClip(this, source)\n return this\n }\n )\n )\n\n restoreHandles.push(\n addMethod(\n proto,\n 'updateStencilClip',\n function (this: Phaser.GameObjects.Container, source: StencilClipUpdate) {\n const handle = getStencilClipHandle(this)\n if (handle) handle.update(source)\n else if (canCreateStencilClipSource(source)) applyStencilClip(this, source)\n return this\n }\n )\n )\n\n restoreHandles.push(\n addMethod(proto, 'clearStencilClip', function (this: Phaser.GameObjects.Container) {\n clearStencilClip(this)\n return this\n })\n )\n\n restoreHandles.push(\n addMethod(proto, 'getStencilClipHandle', function (this: Phaser.GameObjects.Container) {\n return getStencilClipHandle(this)\n })\n )\n\n restoreHandles.push(\n wrapMethod(proto, 'destroy', (original, self, ...args) => {\n clearStencilClip(self as Phaser.GameObjects.Container)\n return original.apply(self, args)\n })\n )\n}\n\n/** Restores Phaser prototypes to their previous state. Intended for tests/HMR. */\nexport function uninstallStencilClipExtension(): void {\n for (const handle of [...restoreHandles].reverse()) handle.restore()\n restoreHandles = []\n installed = false\n}\n\ndeclare global {\n namespace Phaser {\n namespace GameObjects {\n interface Container {\n setStencilClip(source: StencilClipSource): this\n updateStencilClip(source: StencilClipUpdate): this\n clearStencilClip(): this\n getStencilClipHandle(): StencilClipHandle | undefined\n }\n }\n }\n}\n"],"names":["Phaser","applyStencilClip","getStencilClipHandle","clearStencilClip"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,UACP,OACA,YACA,IACiB;AACjB,QAAM,SAAS,OAAO,UAAU,eAAe,KAAK,OAAO,UAAU;AACrE,QAAM,WAAY,MAAuC,UAAU;AAEnE,MAAI,CAAC,QAAQ;AACT,UAAuC,UAAU,IAAI;AAAA,EACzD;AAEA,SAAO;AAAA,IACL,SAAS,MAAM;AACb,UAAI,CAAC,QAAQ;AACX,eAAQ,MAAuC,UAAU;AAAA,MAC3D,OAAO;AACH,cAAuC,UAAU,IAAI;AAAA,MACzD;AAAA,IACF;AAAA,EAAA;AAEJ;AAEA,SAAS,WACP,OACA,YACA,SACiB;AACjB,QAAM,WAAW,MAAM,UAAU;AAEjC,MAAI,OAAO,aAAa,YAAY;AAClC,WAAO,EAAE,UAAU;AAAA,IAAC,EAAA;AAAA,EACtB;AAEA,QAAM,UAAiB,YAA4B,MAAiB;AAClE,WAAO,QAAQ,UAAU,MAAM,GAAG,IAAI;AAAA,EACxC;AAEE,QAAkC,UAAU,IAAI;AAElD,SAAO;AAAA,IACL,SAAS,MAAM;AACX,YAAkC,UAAU,IAAI;AAAA,IACpD;AAAA,EAAA;AAEJ;AAEA,IAAI,YAAY;AAChB,IAAI,iBAAoC,CAAA;AAExC,SAAS,2BAA2B,QAAwD;AAC1F,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,OAAO,YAAY;AAAA,EAC5B;AAEA,SAAO,OAAO,UAAU,UAAa,OAAO,WAAW;AACzD;AAGO,SAAS,8BAAoC;AAClD,MAAI,UAAW;AACf,cAAY;AAEZ,QAAM,QAAQA,kBAAO,YAAY,UAAU;AAG3C,iBAAe;AAAA,IACb;AAAA,MACE;AAAA,MACA;AAAA,MACA,SAA8C,QAA2B;AACvEC,oBAAAA,iBAAiB,MAAM,MAAM;AAC7B,eAAO;AAAA,MACT;AAAA,IAAA;AAAA,EACF;AAGF,iBAAe;AAAA,IACb;AAAA,MACE;AAAA,MACA;AAAA,MACA,SAA8C,QAA2B;AACvE,cAAM,SAASC,YAAAA,qBAAqB,IAAI;AACxC,YAAI,OAAQ,QAAO,OAAO,MAAM;AAAA,iBACvB,2BAA2B,MAAM,EAAGD,aAAAA,iBAAiB,MAAM,MAAM;AAC1E,eAAO;AAAA,MACT;AAAA,IAAA;AAAA,EACF;AAGF,iBAAe;AAAA,IACb,UAAU,OAAO,oBAAoB,WAA8C;AACjFE,kBAAAA,iBAAiB,IAAI;AACrB,aAAO;AAAA,IACT,CAAC;AAAA,EAAA;AAGH,iBAAe;AAAA,IACb,UAAU,OAAO,wBAAwB,WAA8C;AACrF,aAAOD,YAAAA,qBAAqB,IAAI;AAAA,IAClC,CAAC;AAAA,EAAA;AAGH,iBAAe;AAAA,IACb,WAAW,OAAO,WAAW,CAAC,UAAU,SAAS,SAAS;AACxDC,kBAAAA,iBAAiB,IAAoC;AACrD,aAAO,SAAS,MAAM,MAAM,IAAI;AAAA,IAClC,CAAC;AAAA,EAAA;AAEL;AAGO,SAAS,gCAAsC;AACpD,aAAW,UAAU,CAAC,GAAG,cAAc,EAAE,QAAA,UAAkB,QAAA;AAC3D,mBAAiB,CAAA;AACjB,cAAY;AACd;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StencilClipHandle, StencilClipSource, StencilClipUpdate } from './stencil-clip';
|
|
2
|
+
/** Installs stencil clip helpers on Phaser.GameObjects.Container.prototype. */
|
|
3
|
+
export declare function installStencilClipExtension(): void;
|
|
4
|
+
/** Restores Phaser prototypes to their previous state. Intended for tests/HMR. */
|
|
5
|
+
export declare function uninstallStencilClipExtension(): void;
|
|
6
|
+
declare global {
|
|
7
|
+
namespace Phaser {
|
|
8
|
+
namespace GameObjects {
|
|
9
|
+
interface Container {
|
|
10
|
+
setStencilClip(source: StencilClipSource): this;
|
|
11
|
+
updateStencilClip(source: StencilClipUpdate): this;
|
|
12
|
+
clearStencilClip(): this;
|
|
13
|
+
getStencilClipHandle(): StencilClipHandle | undefined;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=stencil-clip-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stencil-clip-extension.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-extension.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAA;AAkEvB,+EAA+E;AAC/E,wBAAgB,2BAA2B,IAAI,IAAI,CAkDlD;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM,CAAC;QACf,UAAU,WAAW,CAAC;YACpB,UAAU,SAAS;gBACjB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;gBAC/C,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;gBAClD,gBAAgB,IAAI,IAAI,CAAA;gBACxB,oBAAoB,IAAI,iBAAiB,GAAG,SAAS,CAAA;aACtD;SACF;KACF;CACF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { applyStencilClip, getStencilClipHandle, clearStencilClip } from "./stencil-clip.js";
|
|
3
|
+
function addMethod(proto, methodName, fn) {
|
|
4
|
+
const hadOwn = Object.prototype.hasOwnProperty.call(proto, methodName);
|
|
5
|
+
const previous = proto[methodName];
|
|
6
|
+
if (!hadOwn) {
|
|
7
|
+
proto[methodName] = fn;
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
restore: () => {
|
|
11
|
+
if (!hadOwn) {
|
|
12
|
+
delete proto[methodName];
|
|
13
|
+
} else {
|
|
14
|
+
proto[methodName] = previous;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function wrapMethod(proto, methodName, wrapper) {
|
|
20
|
+
const original = proto[methodName];
|
|
21
|
+
if (typeof original !== "function") {
|
|
22
|
+
return { restore() {
|
|
23
|
+
} };
|
|
24
|
+
}
|
|
25
|
+
const wrapped = function(...args) {
|
|
26
|
+
return wrapper(original, this, ...args);
|
|
27
|
+
};
|
|
28
|
+
proto[methodName] = wrapped;
|
|
29
|
+
return {
|
|
30
|
+
restore: () => {
|
|
31
|
+
proto[methodName] = original;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
let installed = false;
|
|
36
|
+
let restoreHandles = [];
|
|
37
|
+
function canCreateStencilClipSource(source) {
|
|
38
|
+
if (source.kind === "bitmap") {
|
|
39
|
+
return source.texture !== void 0;
|
|
40
|
+
}
|
|
41
|
+
return source.width !== void 0 && source.height !== void 0;
|
|
42
|
+
}
|
|
43
|
+
function installStencilClipExtension() {
|
|
44
|
+
if (installed) return;
|
|
45
|
+
installed = true;
|
|
46
|
+
const proto = Phaser.GameObjects.Container.prototype;
|
|
47
|
+
restoreHandles.push(
|
|
48
|
+
addMethod(
|
|
49
|
+
proto,
|
|
50
|
+
"setStencilClip",
|
|
51
|
+
function(source) {
|
|
52
|
+
applyStencilClip(this, source);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
restoreHandles.push(
|
|
58
|
+
addMethod(
|
|
59
|
+
proto,
|
|
60
|
+
"updateStencilClip",
|
|
61
|
+
function(source) {
|
|
62
|
+
const handle = getStencilClipHandle(this);
|
|
63
|
+
if (handle) handle.update(source);
|
|
64
|
+
else if (canCreateStencilClipSource(source)) applyStencilClip(this, source);
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
restoreHandles.push(
|
|
70
|
+
addMethod(proto, "clearStencilClip", function() {
|
|
71
|
+
clearStencilClip(this);
|
|
72
|
+
return this;
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
restoreHandles.push(
|
|
76
|
+
addMethod(proto, "getStencilClipHandle", function() {
|
|
77
|
+
return getStencilClipHandle(this);
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
restoreHandles.push(
|
|
81
|
+
wrapMethod(proto, "destroy", (original, self, ...args) => {
|
|
82
|
+
clearStencilClip(self);
|
|
83
|
+
return original.apply(self, args);
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function uninstallStencilClipExtension() {
|
|
88
|
+
for (const handle of [...restoreHandles].reverse()) handle.restore();
|
|
89
|
+
restoreHandles = [];
|
|
90
|
+
installed = false;
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
installStencilClipExtension,
|
|
94
|
+
uninstallStencilClipExtension
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=stencil-clip-extension.js.map
|