@number10/jsx-phaser 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +667 -0
- package/README.md +44 -0
- package/dist/_virtual/_commonjsHelpers.cjs +7 -0
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/index.cjs +7 -0
- package/dist/_virtual/index.cjs.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/animation/index.d.ts +7 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/camera/index.d.ts +5 -0
- package/dist/camera/index.d.ts.map +1 -0
- package/dist/camera/use-camera-fx.cjs +49 -0
- package/dist/camera/use-camera-fx.cjs.map +1 -0
- package/dist/camera/use-camera-fx.d.ts +25 -0
- package/dist/camera/use-camera-fx.d.ts.map +1 -0
- package/dist/camera/use-camera-fx.js +49 -0
- package/dist/camera/use-camera-fx.js.map +1 -0
- package/dist/clip/index.cjs +8 -0
- package/dist/clip/index.cjs.map +1 -0
- package/dist/clip/index.d.ts +3 -0
- package/dist/clip/index.d.ts.map +1 -0
- package/dist/clip/index.js +9 -0
- package/dist/clip/index.js.map +1 -0
- package/dist/clip/stencil-clip-depth.cjs +24 -0
- package/dist/clip/stencil-clip-depth.cjs.map +1 -0
- package/dist/clip/stencil-clip-depth.d.ts +10 -0
- package/dist/clip/stencil-clip-depth.d.ts.map +1 -0
- package/dist/clip/stencil-clip-depth.js +24 -0
- package/dist/clip/stencil-clip-depth.js.map +1 -0
- package/dist/clip/stencil-clip-extension.cjs +113 -0
- package/dist/clip/stencil-clip-extension.cjs.map +1 -0
- package/dist/clip/stencil-clip-extension.d.ts +18 -0
- package/dist/clip/stencil-clip-extension.d.ts.map +1 -0
- package/dist/clip/stencil-clip-extension.js +96 -0
- package/dist/clip/stencil-clip-extension.js.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.cjs +46 -0
- package/dist/clip/stencil-clip-fbo-bridge.cjs.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts +7 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.js +46 -0
- package/dist/clip/stencil-clip-fbo-bridge.js.map +1 -0
- package/dist/clip/stencil-clip-renderer.cjs +300 -0
- package/dist/clip/stencil-clip-renderer.cjs.map +1 -0
- package/dist/clip/stencil-clip-renderer.d.ts +7 -0
- package/dist/clip/stencil-clip-renderer.d.ts.map +1 -0
- package/dist/clip/stencil-clip-renderer.js +300 -0
- package/dist/clip/stencil-clip-renderer.js.map +1 -0
- package/dist/clip/stencil-clip-state.cjs +84 -0
- package/dist/clip/stencil-clip-state.cjs.map +1 -0
- package/dist/clip/stencil-clip-state.d.ts +28 -0
- package/dist/clip/stencil-clip-state.d.ts.map +1 -0
- package/dist/clip/stencil-clip-state.js +84 -0
- package/dist/clip/stencil-clip-state.js.map +1 -0
- package/dist/clip/stencil-clip-types.d.ts +67 -0
- package/dist/clip/stencil-clip-types.d.ts.map +1 -0
- package/dist/clip/stencil-clip.cjs +138 -0
- package/dist/clip/stencil-clip.cjs.map +1 -0
- package/dist/clip/stencil-clip.d.ts +53 -0
- package/dist/clip/stencil-clip.d.ts.map +1 -0
- package/dist/clip/stencil-clip.js +122 -0
- package/dist/clip/stencil-clip.js.map +1 -0
- package/dist/colors/use-color-mode.cjs +28 -0
- package/dist/colors/use-color-mode.cjs.map +1 -0
- package/dist/colors/use-color-mode.d.ts +22 -0
- package/dist/colors/use-color-mode.d.ts.map +1 -0
- package/dist/colors/use-color-mode.js +28 -0
- package/dist/colors/use-color-mode.js.map +1 -0
- package/dist/colors/use-colors.cjs +45 -0
- package/dist/colors/use-colors.cjs.map +1 -0
- package/dist/colors/use-colors.d.ts +36 -0
- package/dist/colors/use-colors.d.ts.map +1 -0
- package/dist/colors/use-colors.js +45 -0
- package/dist/colors/use-colors.js.map +1 -0
- package/dist/components/DebugPanel.cjs +88 -0
- package/dist/components/DebugPanel.cjs.map +1 -0
- package/dist/components/DebugPanel.d.ts +45 -0
- package/dist/components/DebugPanel.d.ts.map +1 -0
- package/dist/components/DebugPanel.js +71 -0
- package/dist/components/DebugPanel.js.map +1 -0
- package/dist/components/appliers/applyBackground.cjs +89 -0
- package/dist/components/appliers/applyBackground.cjs.map +1 -0
- package/dist/components/appliers/applyBackground.d.ts +18 -0
- package/dist/components/appliers/applyBackground.d.ts.map +1 -0
- package/dist/components/appliers/applyBackground.js +89 -0
- package/dist/components/appliers/applyBackground.js.map +1 -0
- package/dist/components/appliers/applyGestures.cjs +85 -0
- package/dist/components/appliers/applyGestures.cjs.map +1 -0
- package/dist/components/appliers/applyGestures.d.ts +12 -0
- package/dist/components/appliers/applyGestures.d.ts.map +1 -0
- package/dist/components/appliers/applyGestures.js +68 -0
- package/dist/components/appliers/applyGestures.js.map +1 -0
- package/dist/components/appliers/applyGraphics.cjs +21 -0
- package/dist/components/appliers/applyGraphics.cjs.map +1 -0
- package/dist/components/appliers/applyGraphics.d.ts +13 -0
- package/dist/components/appliers/applyGraphics.d.ts.map +1 -0
- package/dist/components/appliers/applyGraphics.js +21 -0
- package/dist/components/appliers/applyGraphics.js.map +1 -0
- package/dist/components/appliers/applyGraphicsLayout.cjs +18 -0
- package/dist/components/appliers/applyGraphicsLayout.cjs.map +1 -0
- package/dist/components/appliers/applyGraphicsLayout.d.ts +13 -0
- package/dist/components/appliers/applyGraphicsLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyGraphicsLayout.js +18 -0
- package/dist/components/appliers/applyGraphicsLayout.js.map +1 -0
- package/dist/components/appliers/applyImage.cjs +92 -0
- package/dist/components/appliers/applyImage.cjs.map +1 -0
- package/dist/components/appliers/applyImage.d.ts +47 -0
- package/dist/components/appliers/applyImage.d.ts.map +1 -0
- package/dist/components/appliers/applyImage.js +92 -0
- package/dist/components/appliers/applyImage.js.map +1 -0
- package/dist/components/appliers/applyImageLayout.cjs +18 -0
- package/dist/components/appliers/applyImageLayout.cjs.map +1 -0
- package/dist/components/appliers/applyImageLayout.d.ts +18 -0
- package/dist/components/appliers/applyImageLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyImageLayout.js +18 -0
- package/dist/components/appliers/applyImageLayout.js.map +1 -0
- package/dist/components/appliers/applyLayout.cjs +108 -0
- package/dist/components/appliers/applyLayout.cjs.map +1 -0
- package/dist/components/appliers/applyLayout.d.ts +19 -0
- package/dist/components/appliers/applyLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyLayout.js +91 -0
- package/dist/components/appliers/applyLayout.js.map +1 -0
- package/dist/components/appliers/applyNineSlice.cjs +37 -0
- package/dist/components/appliers/applyNineSlice.cjs.map +1 -0
- package/dist/components/appliers/applyNineSlice.d.ts +14 -0
- package/dist/components/appliers/applyNineSlice.d.ts.map +1 -0
- package/dist/components/appliers/applyNineSlice.js +37 -0
- package/dist/components/appliers/applyNineSlice.js.map +1 -0
- package/dist/components/appliers/applyNineSliceLayout.cjs +18 -0
- package/dist/components/appliers/applyNineSliceLayout.cjs.map +1 -0
- package/dist/components/appliers/applyNineSliceLayout.d.ts +18 -0
- package/dist/components/appliers/applyNineSliceLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyNineSliceLayout.js +18 -0
- package/dist/components/appliers/applyNineSliceLayout.js.map +1 -0
- package/dist/components/appliers/applyParticles.cjs +46 -0
- package/dist/components/appliers/applyParticles.cjs.map +1 -0
- package/dist/components/appliers/applyParticles.d.ts +7 -0
- package/dist/components/appliers/applyParticles.d.ts.map +1 -0
- package/dist/components/appliers/applyParticles.js +46 -0
- package/dist/components/appliers/applyParticles.js.map +1 -0
- package/dist/components/appliers/applyParticlesLayout.cjs +7 -0
- package/dist/components/appliers/applyParticlesLayout.cjs.map +1 -0
- package/dist/components/appliers/applyParticlesLayout.d.ts +11 -0
- package/dist/components/appliers/applyParticlesLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyParticlesLayout.js +7 -0
- package/dist/components/appliers/applyParticlesLayout.js.map +1 -0
- package/dist/components/appliers/applyPhaser.cjs +40 -0
- package/dist/components/appliers/applyPhaser.cjs.map +1 -0
- package/dist/components/appliers/applyPhaser.d.ts +24 -0
- package/dist/components/appliers/applyPhaser.d.ts.map +1 -0
- package/dist/components/appliers/applyPhaser.js +40 -0
- package/dist/components/appliers/applyPhaser.js.map +1 -0
- package/dist/components/appliers/applySprite.cjs +124 -0
- package/dist/components/appliers/applySprite.cjs.map +1 -0
- package/dist/components/appliers/applySprite.d.ts +13 -0
- package/dist/components/appliers/applySprite.d.ts.map +1 -0
- package/dist/components/appliers/applySprite.js +124 -0
- package/dist/components/appliers/applySprite.js.map +1 -0
- package/dist/components/appliers/applySpriteLayout.cjs +7 -0
- package/dist/components/appliers/applySpriteLayout.cjs.map +1 -0
- package/dist/components/appliers/applySpriteLayout.d.ts +17 -0
- package/dist/components/appliers/applySpriteLayout.d.ts.map +1 -0
- package/dist/components/appliers/applySpriteLayout.js +7 -0
- package/dist/components/appliers/applySpriteLayout.js.map +1 -0
- package/dist/components/appliers/applyText.cjs +142 -0
- package/dist/components/appliers/applyText.cjs.map +1 -0
- package/dist/components/appliers/applyText.d.ts +32 -0
- package/dist/components/appliers/applyText.d.ts.map +1 -0
- package/dist/components/appliers/applyText.js +142 -0
- package/dist/components/appliers/applyText.js.map +1 -0
- package/dist/components/appliers/applyTextLayout.cjs +16 -0
- package/dist/components/appliers/applyTextLayout.cjs.map +1 -0
- package/dist/components/appliers/applyTextLayout.d.ts +18 -0
- package/dist/components/appliers/applyTextLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyTextLayout.js +16 -0
- package/dist/components/appliers/applyTextLayout.js.map +1 -0
- package/dist/components/appliers/applyTooltip.cjs +247 -0
- package/dist/components/appliers/applyTooltip.cjs.map +1 -0
- package/dist/components/appliers/applyTooltip.d.ts +16 -0
- package/dist/components/appliers/applyTooltip.d.ts.map +1 -0
- package/dist/components/appliers/applyTooltip.js +247 -0
- package/dist/components/appliers/applyTooltip.js.map +1 -0
- package/dist/components/appliers/applyTransform.cjs +61 -0
- package/dist/components/appliers/applyTransform.cjs.map +1 -0
- package/dist/components/appliers/applyTransform.d.ts +24 -0
- package/dist/components/appliers/applyTransform.d.ts.map +1 -0
- package/dist/components/appliers/applyTransform.js +61 -0
- package/dist/components/appliers/applyTransform.js.map +1 -0
- package/dist/components/backgroundImage.cjs +411 -0
- package/dist/components/backgroundImage.cjs.map +1 -0
- package/dist/components/backgroundImage.d.ts +14 -0
- package/dist/components/backgroundImage.d.ts.map +1 -0
- package/dist/components/backgroundImage.js +411 -0
- package/dist/components/backgroundImage.js.map +1 -0
- package/dist/components/creators/createBackground.cjs +18 -0
- package/dist/components/creators/createBackground.cjs.map +1 -0
- package/dist/components/creators/createBackground.d.ts +20 -0
- package/dist/components/creators/createBackground.d.ts.map +1 -0
- package/dist/components/creators/createBackground.js +18 -0
- package/dist/components/creators/createBackground.js.map +1 -0
- package/dist/components/creators/createGestures.cjs +51 -0
- package/dist/components/creators/createGestures.cjs.map +1 -0
- package/dist/components/creators/createGestures.d.ts +11 -0
- package/dist/components/creators/createGestures.d.ts.map +1 -0
- package/dist/components/creators/createGestures.js +34 -0
- package/dist/components/creators/createGestures.js.map +1 -0
- package/dist/components/creators/createGraphicsLayout.cjs +24 -0
- package/dist/components/creators/createGraphicsLayout.cjs.map +1 -0
- package/dist/components/creators/createGraphicsLayout.d.ts +12 -0
- package/dist/components/creators/createGraphicsLayout.d.ts.map +1 -0
- package/dist/components/creators/createGraphicsLayout.js +24 -0
- package/dist/components/creators/createGraphicsLayout.js.map +1 -0
- package/dist/components/creators/createImageLayout.cjs +16 -0
- package/dist/components/creators/createImageLayout.cjs.map +1 -0
- package/dist/components/creators/createImageLayout.d.ts +17 -0
- package/dist/components/creators/createImageLayout.d.ts.map +1 -0
- package/dist/components/creators/createImageLayout.js +16 -0
- package/dist/components/creators/createImageLayout.js.map +1 -0
- package/dist/components/creators/createLayout.cjs +61 -0
- package/dist/components/creators/createLayout.cjs.map +1 -0
- package/dist/components/creators/createLayout.d.ts +15 -0
- package/dist/components/creators/createLayout.d.ts.map +1 -0
- package/dist/components/creators/createLayout.js +61 -0
- package/dist/components/creators/createLayout.js.map +1 -0
- package/dist/components/creators/createNineSliceLayout.cjs +16 -0
- package/dist/components/creators/createNineSliceLayout.cjs.map +1 -0
- package/dist/components/creators/createNineSliceLayout.d.ts +17 -0
- package/dist/components/creators/createNineSliceLayout.d.ts.map +1 -0
- package/dist/components/creators/createNineSliceLayout.js +16 -0
- package/dist/components/creators/createNineSliceLayout.js.map +1 -0
- package/dist/components/creators/createParticlesLayout.cjs +8 -0
- package/dist/components/creators/createParticlesLayout.cjs.map +1 -0
- package/dist/components/creators/createParticlesLayout.d.ts +14 -0
- package/dist/components/creators/createParticlesLayout.d.ts.map +1 -0
- package/dist/components/creators/createParticlesLayout.js +8 -0
- package/dist/components/creators/createParticlesLayout.js.map +1 -0
- package/dist/components/creators/createPhaser.cjs +36 -0
- package/dist/components/creators/createPhaser.cjs.map +1 -0
- package/dist/components/creators/createPhaser.d.ts +14 -0
- package/dist/components/creators/createPhaser.d.ts.map +1 -0
- package/dist/components/creators/createPhaser.js +36 -0
- package/dist/components/creators/createPhaser.js.map +1 -0
- package/dist/components/creators/createSpriteLayout.cjs +10 -0
- package/dist/components/creators/createSpriteLayout.cjs.map +1 -0
- package/dist/components/creators/createSpriteLayout.d.ts +18 -0
- package/dist/components/creators/createSpriteLayout.d.ts.map +1 -0
- package/dist/components/creators/createSpriteLayout.js +10 -0
- package/dist/components/creators/createSpriteLayout.js.map +1 -0
- package/dist/components/creators/createTextLayout.cjs +16 -0
- package/dist/components/creators/createTextLayout.cjs.map +1 -0
- package/dist/components/creators/createTextLayout.d.ts +17 -0
- package/dist/components/creators/createTextLayout.d.ts.map +1 -0
- package/dist/components/creators/createTextLayout.js +16 -0
- package/dist/components/creators/createTextLayout.js.map +1 -0
- package/dist/components/creators/createTransform.cjs +83 -0
- package/dist/components/creators/createTransform.cjs.map +1 -0
- package/dist/components/creators/createTransform.d.ts +26 -0
- package/dist/components/creators/createTransform.d.ts.map +1 -0
- package/dist/components/creators/createTransform.js +83 -0
- package/dist/components/creators/createTransform.js.map +1 -0
- package/dist/components/custom/Graphics.cjs +13 -0
- package/dist/components/custom/Graphics.cjs.map +1 -0
- package/dist/components/custom/Graphics.d.ts +50 -0
- package/dist/components/custom/Graphics.d.ts.map +1 -0
- package/dist/components/custom/Graphics.js +13 -0
- package/dist/components/custom/Graphics.js.map +1 -0
- package/dist/components/custom/NineSlice.cjs +13 -0
- package/dist/components/custom/NineSlice.cjs.map +1 -0
- package/dist/components/custom/NineSlice.d.ts +87 -0
- package/dist/components/custom/NineSlice.d.ts.map +1 -0
- package/dist/components/custom/NineSlice.js +13 -0
- package/dist/components/custom/NineSlice.js.map +1 -0
- package/dist/components/custom/Particles.cjs +8 -0
- package/dist/components/custom/Particles.cjs.map +1 -0
- package/dist/components/custom/Particles.d.ts +28 -0
- package/dist/components/custom/Particles.d.ts.map +1 -0
- package/dist/components/custom/Particles.js +8 -0
- package/dist/components/custom/Particles.js.map +1 -0
- package/dist/components/custom/RefOriginView.cjs +67 -0
- package/dist/components/custom/RefOriginView.cjs.map +1 -0
- package/dist/components/custom/RefOriginView.d.ts +49 -0
- package/dist/components/custom/RefOriginView.d.ts.map +1 -0
- package/dist/components/custom/RefOriginView.js +67 -0
- package/dist/components/custom/RefOriginView.js.map +1 -0
- package/dist/components/custom/Sprite.cjs +13 -0
- package/dist/components/custom/Sprite.cjs.map +1 -0
- package/dist/components/custom/Sprite.d.ts +79 -0
- package/dist/components/custom/Sprite.d.ts.map +1 -0
- package/dist/components/custom/Sprite.js +13 -0
- package/dist/components/custom/Sprite.js.map +1 -0
- package/dist/components/custom/TileSprite.cjs +13 -0
- package/dist/components/custom/TileSprite.cjs.map +1 -0
- package/dist/components/custom/TileSprite.d.ts +65 -0
- package/dist/components/custom/TileSprite.d.ts.map +1 -0
- package/dist/components/custom/TileSprite.js +13 -0
- package/dist/components/custom/TileSprite.js.map +1 -0
- package/dist/components/custom/index.d.ts +15 -0
- package/dist/components/custom/index.d.ts.map +1 -0
- package/dist/components/index.cjs +33 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/internal/SceneWrapper.cjs +10 -0
- package/dist/components/internal/SceneWrapper.cjs.map +1 -0
- package/dist/components/internal/SceneWrapper.d.ts +20 -0
- package/dist/components/internal/SceneWrapper.d.ts.map +1 -0
- package/dist/components/internal/SceneWrapper.js +10 -0
- package/dist/components/internal/SceneWrapper.js.map +1 -0
- package/dist/components/primitives/graphics.cjs +29 -0
- package/dist/components/primitives/graphics.cjs.map +1 -0
- package/dist/components/primitives/graphics.d.ts +146 -0
- package/dist/components/primitives/graphics.d.ts.map +1 -0
- package/dist/components/primitives/graphics.js +29 -0
- package/dist/components/primitives/graphics.js.map +1 -0
- package/dist/components/primitives/image.cjs +110 -0
- package/dist/components/primitives/image.cjs.map +1 -0
- package/dist/components/primitives/image.d.ts +170 -0
- package/dist/components/primitives/image.d.ts.map +1 -0
- package/dist/components/primitives/image.js +110 -0
- package/dist/components/primitives/image.js.map +1 -0
- package/dist/components/primitives/nineslice.cjs +42 -0
- package/dist/components/primitives/nineslice.cjs.map +1 -0
- package/dist/components/primitives/nineslice.d.ts +271 -0
- package/dist/components/primitives/nineslice.d.ts.map +1 -0
- package/dist/components/primitives/nineslice.js +42 -0
- package/dist/components/primitives/nineslice.js.map +1 -0
- package/dist/components/primitives/particles.cjs +77 -0
- package/dist/components/primitives/particles.cjs.map +1 -0
- package/dist/components/primitives/particles.d.ts +47 -0
- package/dist/components/primitives/particles.d.ts.map +1 -0
- package/dist/components/primitives/particles.js +77 -0
- package/dist/components/primitives/particles.js.map +1 -0
- package/dist/components/primitives/sprite.cjs +100 -0
- package/dist/components/primitives/sprite.cjs.map +1 -0
- package/dist/components/primitives/sprite.d.ts +147 -0
- package/dist/components/primitives/sprite.d.ts.map +1 -0
- package/dist/components/primitives/sprite.js +100 -0
- package/dist/components/primitives/sprite.js.map +1 -0
- package/dist/components/primitives/text.cjs +73 -0
- package/dist/components/primitives/text.cjs.map +1 -0
- package/dist/components/primitives/text.d.ts +155 -0
- package/dist/components/primitives/text.d.ts.map +1 -0
- package/dist/components/primitives/text.js +73 -0
- package/dist/components/primitives/text.js.map +1 -0
- package/dist/components/primitives/tilesprite.cjs +77 -0
- package/dist/components/primitives/tilesprite.cjs.map +1 -0
- package/dist/components/primitives/tilesprite.d.ts +157 -0
- package/dist/components/primitives/tilesprite.d.ts.map +1 -0
- package/dist/components/primitives/tilesprite.js +77 -0
- package/dist/components/primitives/tilesprite.js.map +1 -0
- package/dist/components/primitives/vectorDraw.cjs +73 -0
- package/dist/components/primitives/vectorDraw.cjs.map +1 -0
- package/dist/components/primitives/vectorDraw.d.ts +4 -0
- package/dist/components/primitives/vectorDraw.d.ts.map +1 -0
- package/dist/components/primitives/vectorDraw.js +73 -0
- package/dist/components/primitives/vectorDraw.js.map +1 -0
- package/dist/components/primitives/view.cjs +105 -0
- package/dist/components/primitives/view.cjs.map +1 -0
- package/dist/components/primitives/view.d.ts +23 -0
- package/dist/components/primitives/view.d.ts.map +1 -0
- package/dist/components/primitives/view.js +105 -0
- package/dist/components/primitives/view.js.map +1 -0
- package/dist/core-props.d.ts +105 -0
- package/dist/core-props.d.ts.map +1 -0
- package/dist/core-types.d.ts +71 -0
- package/dist/core-types.d.ts.map +1 -0
- package/dist/design-tokens/resolve-theme-tokens.cjs +27 -0
- package/dist/design-tokens/resolve-theme-tokens.cjs.map +1 -0
- package/dist/design-tokens/resolve-theme-tokens.d.ts +9 -0
- package/dist/design-tokens/resolve-theme-tokens.d.ts.map +1 -0
- package/dist/design-tokens/resolve-theme-tokens.js +27 -0
- package/dist/design-tokens/resolve-theme-tokens.js.map +1 -0
- package/dist/design-tokens/use-theme-tokens.cjs +26 -0
- package/dist/design-tokens/use-theme-tokens.cjs.map +1 -0
- package/dist/design-tokens/use-theme-tokens.d.ts +28 -0
- package/dist/design-tokens/use-theme-tokens.d.ts.map +1 -0
- package/dist/design-tokens/use-theme-tokens.js +26 -0
- package/dist/design-tokens/use-theme-tokens.js.map +1 -0
- package/dist/effects/index.d.ts +2 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/phaser-effects-bridge.cjs +48 -0
- package/dist/effects/phaser-effects-bridge.cjs.map +1 -0
- package/dist/effects/phaser-effects-bridge.d.ts +2 -0
- package/dist/effects/phaser-effects-bridge.d.ts.map +1 -0
- package/dist/effects/phaser-effects-bridge.js +30 -0
- package/dist/effects/phaser-effects-bridge.js.map +1 -0
- package/dist/effects/use-effect.cjs +155 -0
- package/dist/effects/use-effect.cjs.map +1 -0
- package/dist/effects/use-effect.d.ts +30 -0
- package/dist/effects/use-effect.d.ts.map +1 -0
- package/dist/effects/use-effect.js +155 -0
- package/dist/effects/use-effect.js.map +1 -0
- package/dist/fx/convenience-hooks/index.d.ts +7 -0
- package/dist/fx/convenience-hooks/index.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-blur.cjs +18 -0
- package/dist/fx/convenience-hooks/use-blur.cjs.map +1 -0
- package/dist/fx/convenience-hooks/use-blur.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-blur.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-blur.js +18 -0
- package/dist/fx/convenience-hooks/use-blur.js.map +1 -0
- package/dist/fx/convenience-hooks/use-glow.cjs +18 -0
- package/dist/fx/convenience-hooks/use-glow.cjs.map +1 -0
- package/dist/fx/convenience-hooks/use-glow.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-glow.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-glow.js +18 -0
- package/dist/fx/convenience-hooks/use-glow.js.map +1 -0
- package/dist/fx/convenience-hooks/use-shadow.cjs +18 -0
- package/dist/fx/convenience-hooks/use-shadow.cjs.map +1 -0
- package/dist/fx/convenience-hooks/use-shadow.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-shadow.d.ts.map +1 -0
- package/dist/fx/convenience-hooks/use-shadow.js +18 -0
- package/dist/fx/convenience-hooks/use-shadow.js.map +1 -0
- package/dist/fx/fx-creators/blur.cjs +20 -0
- package/dist/fx/fx-creators/blur.cjs.map +1 -0
- package/dist/fx/fx-creators/blur.d.ts +37 -0
- package/dist/fx/fx-creators/blur.d.ts.map +1 -0
- package/dist/fx/fx-creators/blur.js +20 -0
- package/dist/fx/fx-creators/blur.js.map +1 -0
- package/dist/fx/fx-creators/color-matrix.cjs +47 -0
- package/dist/fx/fx-creators/color-matrix.cjs.map +1 -0
- package/dist/fx/fx-creators/color-matrix.d.ts +31 -0
- package/dist/fx/fx-creators/color-matrix.d.ts.map +1 -0
- package/dist/fx/fx-creators/color-matrix.js +47 -0
- package/dist/fx/fx-creators/color-matrix.js.map +1 -0
- package/dist/fx/fx-creators/glow.cjs +27 -0
- package/dist/fx/fx-creators/glow.cjs.map +1 -0
- package/dist/fx/fx-creators/glow.d.ts +36 -0
- package/dist/fx/fx-creators/glow.d.ts.map +1 -0
- package/dist/fx/fx-creators/glow.js +27 -0
- package/dist/fx/fx-creators/glow.js.map +1 -0
- package/dist/fx/fx-creators/index.d.ts +10 -0
- package/dist/fx/fx-creators/index.d.ts.map +1 -0
- package/dist/fx/fx-creators/pixelate.cjs +20 -0
- package/dist/fx/fx-creators/pixelate.cjs.map +1 -0
- package/dist/fx/fx-creators/pixelate.d.ts +24 -0
- package/dist/fx/fx-creators/pixelate.d.ts.map +1 -0
- package/dist/fx/fx-creators/pixelate.js +20 -0
- package/dist/fx/fx-creators/pixelate.js.map +1 -0
- package/dist/fx/fx-creators/shadow.cjs +28 -0
- package/dist/fx/fx-creators/shadow.cjs.map +1 -0
- package/dist/fx/fx-creators/shadow.d.ts +43 -0
- package/dist/fx/fx-creators/shadow.d.ts.map +1 -0
- package/dist/fx/fx-creators/shadow.js +28 -0
- package/dist/fx/fx-creators/shadow.js.map +1 -0
- package/dist/fx/fx-creators/vignette.cjs +20 -0
- package/dist/fx/fx-creators/vignette.cjs.map +1 -0
- package/dist/fx/fx-creators/vignette.d.ts +33 -0
- package/dist/fx/fx-creators/vignette.d.ts.map +1 -0
- package/dist/fx/fx-creators/vignette.js +20 -0
- package/dist/fx/fx-creators/vignette.js.map +1 -0
- package/dist/fx/fx-registry.cjs +43 -0
- package/dist/fx/fx-registry.cjs.map +1 -0
- package/dist/fx/fx-registry.d.ts +59 -0
- package/dist/fx/fx-registry.d.ts.map +1 -0
- package/dist/fx/fx-registry.js +43 -0
- package/dist/fx/fx-registry.js.map +1 -0
- package/dist/fx/index.d.ts +51 -0
- package/dist/fx/index.d.ts.map +1 -0
- package/dist/fx/use-fx.cjs +54 -0
- package/dist/fx/use-fx.cjs.map +1 -0
- package/dist/fx/use-fx.d.ts +53 -0
- package/dist/fx/use-fx.d.ts.map +1 -0
- package/dist/fx/use-fx.js +54 -0
- package/dist/fx/use-fx.js.map +1 -0
- package/dist/gestures/gesture-manager.cjs +773 -0
- package/dist/gestures/gesture-manager.cjs.map +1 -0
- package/dist/gestures/gesture-manager.d.ts +158 -0
- package/dist/gestures/gesture-manager.d.ts.map +1 -0
- package/dist/gestures/gesture-manager.js +773 -0
- package/dist/gestures/gesture-manager.js.map +1 -0
- package/dist/gestures/gesture-types.cjs +9 -0
- package/dist/gestures/gesture-types.cjs.map +1 -0
- package/dist/gestures/gesture-types.d.ts +232 -0
- package/dist/gestures/gesture-types.d.ts.map +1 -0
- package/dist/gestures/gesture-types.js +9 -0
- package/dist/gestures/gesture-types.js.map +1 -0
- package/dist/hooks.cjs +193 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.ts +151 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +146 -0
- package/dist/hooks.js.map +1 -0
- package/dist/host.cjs +85 -0
- package/dist/host.cjs.map +1 -0
- package/dist/host.d.ts +78 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +85 -0
- package/dist/host.js.map +1 -0
- package/dist/index.cjs +614 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +273 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.cjs +20 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +8 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +8 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.cjs +16 -0
- package/dist/jsx-runtime.cjs.map +1 -0
- package/dist/jsx-runtime.d.ts +9 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +7 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/jsx-types.d.ts +40 -0
- package/dist/jsx-types.d.ts.map +1 -0
- package/dist/layout/appliers/background-applier.cjs +40 -0
- package/dist/layout/appliers/background-applier.cjs.map +1 -0
- package/dist/layout/appliers/background-applier.d.ts +16 -0
- package/dist/layout/appliers/background-applier.d.ts.map +1 -0
- package/dist/layout/appliers/background-applier.js +40 -0
- package/dist/layout/appliers/background-applier.js.map +1 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/layout-engine-test-utils.d.ts +24 -0
- package/dist/layout/layout-engine-test-utils.d.ts.map +1 -0
- package/dist/layout/phaser-layout-bridge.cjs +41 -0
- package/dist/layout/phaser-layout-bridge.cjs.map +1 -0
- package/dist/layout/phaser-layout-bridge.d.ts +9 -0
- package/dist/layout/phaser-layout-bridge.d.ts.map +1 -0
- package/dist/layout/phaser-layout-bridge.js +40 -0
- package/dist/layout/phaser-layout-bridge.js.map +1 -0
- package/dist/layout/types.d.ts +14 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs +39 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +39 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/particles/emit-zone.cjs +205 -0
- package/dist/particles/emit-zone.cjs.map +1 -0
- package/dist/particles/emit-zone.d.ts +88 -0
- package/dist/particles/emit-zone.d.ts.map +1 -0
- package/dist/particles/emit-zone.js +205 -0
- package/dist/particles/emit-zone.js.map +1 -0
- package/dist/particles/index.d.ts +8 -0
- package/dist/particles/index.d.ts.map +1 -0
- package/dist/particles/particle-types.d.ts +25 -0
- package/dist/particles/particle-types.d.ts.map +1 -0
- package/dist/particles/preset-registry.cjs +57 -0
- package/dist/particles/preset-registry.cjs.map +1 -0
- package/dist/particles/preset-registry.d.ts +49 -0
- package/dist/particles/preset-registry.d.ts.map +1 -0
- package/dist/particles/preset-registry.js +57 -0
- package/dist/particles/preset-registry.js.map +1 -0
- package/dist/particles/use-particles.cjs +67 -0
- package/dist/particles/use-particles.cjs.map +1 -0
- package/dist/particles/use-particles.d.ts +19 -0
- package/dist/particles/use-particles.d.ts.map +1 -0
- package/dist/particles/use-particles.js +67 -0
- package/dist/particles/use-particles.js.map +1 -0
- package/dist/particles/utils.cjs +82 -0
- package/dist/particles/utils.cjs.map +1 -0
- package/dist/particles/utils.d.ts +10 -0
- package/dist/particles/utils.d.ts.map +1 -0
- package/dist/particles/utils.js +82 -0
- package/dist/particles/utils.js.map +1 -0
- package/dist/phaser-bridges.cjs +148 -0
- package/dist/phaser-bridges.cjs.map +1 -0
- package/dist/phaser-bridges.d.ts +78 -0
- package/dist/phaser-bridges.d.ts.map +1 -0
- package/dist/phaser-bridges.js +131 -0
- package/dist/phaser-bridges.js.map +1 -0
- package/dist/phaser-host-adapter.cjs +148 -0
- package/dist/phaser-host-adapter.cjs.map +1 -0
- package/dist/phaser-host-adapter.d.ts +30 -0
- package/dist/phaser-host-adapter.d.ts.map +1 -0
- package/dist/phaser-host-adapter.js +148 -0
- package/dist/phaser-host-adapter.js.map +1 -0
- package/dist/phaser-runtime-types.d.ts +89 -0
- package/dist/phaser-runtime-types.d.ts.map +1 -0
- package/dist/phaser-surface-adapter.cjs +488 -0
- package/dist/phaser-surface-adapter.cjs.map +1 -0
- package/dist/phaser-surface-adapter.d.ts +74 -0
- package/dist/phaser-surface-adapter.d.ts.map +1 -0
- package/dist/phaser-surface-adapter.js +471 -0
- package/dist/phaser-surface-adapter.js.map +1 -0
- package/dist/phaser-vdom-runtime.cjs +63 -0
- package/dist/phaser-vdom-runtime.cjs.map +1 -0
- package/dist/phaser-vdom-runtime.d.ts +2 -0
- package/dist/phaser-vdom-runtime.d.ts.map +1 -0
- package/dist/phaser-vdom-runtime.js +63 -0
- package/dist/phaser-vdom-runtime.js.map +1 -0
- package/dist/plugin.cjs +182 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.ts +161 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +165 -0
- package/dist/plugin.js.map +1 -0
- package/dist/render-context.cjs +106 -0
- package/dist/render-context.cjs.map +1 -0
- package/dist/render-context.d.ts +66 -0
- package/dist/render-context.d.ts.map +1 -0
- package/dist/render-context.js +106 -0
- package/dist/render-context.js.map +1 -0
- package/dist/scene-backgrounds.cjs +285 -0
- package/dist/scene-backgrounds.cjs.map +1 -0
- package/dist/scene-backgrounds.d.ts +69 -0
- package/dist/scene-backgrounds.d.ts.map +1 -0
- package/dist/scene-backgrounds.js +268 -0
- package/dist/scene-backgrounds.js.map +1 -0
- package/dist/theme-base.d.ts +133 -0
- package/dist/theme-base.d.ts.map +1 -0
- package/dist/theme-custom.d.ts +13 -0
- package/dist/theme-custom.d.ts.map +1 -0
- package/dist/theme-defaults.cjs +29 -0
- package/dist/theme-defaults.cjs.map +1 -0
- package/dist/theme-defaults.d.ts +1 -0
- package/dist/theme-defaults.d.ts.map +1 -0
- package/dist/theme-defaults.js +28 -0
- package/dist/theme-defaults.js.map +1 -0
- package/dist/theme.cjs +34 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.ts +36 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +32 -0
- package/dist/theme.js.map +1 -0
- package/dist/tooltip/tooltip-types.d.ts +6 -0
- package/dist/tooltip/tooltip-types.d.ts.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/KeyboardInputManager.cjs +112 -0
- package/dist/utils/KeyboardInputManager.cjs.map +1 -0
- package/dist/utils/KeyboardInputManager.d.ts +48 -0
- package/dist/utils/KeyboardInputManager.d.ts.map +1 -0
- package/dist/utils/KeyboardInputManager.js +112 -0
- package/dist/utils/KeyboardInputManager.js.map +1 -0
- package/dist/utils/dom-input-manager.cjs +253 -0
- package/dist/utils/dom-input-manager.cjs.map +1 -0
- package/dist/utils/dom-input-manager.d.ts +113 -0
- package/dist/utils/dom-input-manager.d.ts.map +1 -0
- package/dist/utils/dom-input-manager.js +253 -0
- package/dist/utils/dom-input-manager.js.map +1 -0
- package/dist/utils/fast-deep-equal.cjs +7 -0
- package/dist/utils/fast-deep-equal.cjs.map +1 -0
- package/dist/utils/fast-deep-equal.d.ts +4 -0
- package/dist/utils/fast-deep-equal.d.ts.map +1 -0
- package/dist/utils/fast-deep-equal.js +7 -0
- package/dist/utils/fast-deep-equal.js.map +1 -0
- package/dist/utils/image-subtexture-registry.cjs +98 -0
- package/dist/utils/image-subtexture-registry.cjs.map +1 -0
- package/dist/utils/image-subtexture-registry.d.ts +17 -0
- package/dist/utils/image-subtexture-registry.d.ts.map +1 -0
- package/dist/utils/image-subtexture-registry.js +98 -0
- package/dist/utils/image-subtexture-registry.js.map +1 -0
- package/dist/utils/phaser-guards.cjs +15 -0
- package/dist/utils/phaser-guards.cjs.map +1 -0
- package/dist/utils/phaser-guards.d.ts +7 -0
- package/dist/utils/phaser-guards.d.ts.map +1 -0
- package/dist/utils/phaser-guards.js +15 -0
- package/dist/utils/phaser-guards.js.map +1 -0
- package/dist/utils/svg-texture.cjs +48 -0
- package/dist/utils/svg-texture.cjs.map +1 -0
- package/dist/utils/svg-texture.d.ts +34 -0
- package/dist/utils/svg-texture.d.ts.map +1 -0
- package/dist/utils/svg-texture.js +48 -0
- package/dist/utils/svg-texture.js.map +1 -0
- package/dist/utils/texture-registry.cjs +117 -0
- package/dist/utils/texture-registry.cjs.map +1 -0
- package/dist/utils/texture-registry.d.ts +53 -0
- package/dist/utils/texture-registry.d.ts.map +1 -0
- package/dist/utils/texture-registry.js +117 -0
- package/dist/utils/texture-registry.js.map +1 -0
- package/dist/vdom-host-types.d.ts +12 -0
- package/dist/vdom-host-types.d.ts.map +1 -0
- package/dist/vdom-registry.d.ts +27 -0
- package/dist/vdom-registry.d.ts.map +1 -0
- package/dist/vdom-utils.d.ts +16 -0
- package/dist/vdom-utils.d.ts.map +1 -0
- package/dist/vdom.cjs +36 -0
- package/dist/vdom.cjs.map +1 -0
- package/dist/vdom.d.ts +23 -0
- package/dist/vdom.d.ts.map +1 -0
- package/dist/vdom.js +36 -0
- package/dist/vdom.js.map +1 -0
- package/dist/vector/PhaserVectorDrawContext.cjs +97 -0
- package/dist/vector/PhaserVectorDrawContext.cjs.map +1 -0
- package/dist/vector/PhaserVectorDrawContext.d.ts +27 -0
- package/dist/vector/PhaserVectorDrawContext.d.ts.map +1 -0
- package/dist/vector/PhaserVectorDrawContext.js +97 -0
- package/dist/vector/PhaserVectorDrawContext.js.map +1 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AAEH;;;GAGG;AACH,wBAAgB,gBAAgB,SAyB/B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { register } from "../host.js";
|
|
2
|
+
import { graphicsPatcher, graphicsCreator } from "./primitives/graphics.js";
|
|
3
|
+
import { imagePatcher, imageCreator } from "./primitives/image.js";
|
|
4
|
+
import { nineSlicePatcher, nineSliceCreator } from "./primitives/nineslice.js";
|
|
5
|
+
import { particlesPatcher, particlesCreator } from "./primitives/particles.js";
|
|
6
|
+
import { spritePatcher, spriteCreator } from "./primitives/sprite.js";
|
|
7
|
+
import { textPatcher, textCreator } from "./primitives/text.js";
|
|
8
|
+
import { tileSpritePatcher, tileSpriteCreator } from "./primitives/tilesprite.js";
|
|
9
|
+
import { vectorDrawPatcher, vectorDrawCreator } from "./primitives/vectorDraw.js";
|
|
10
|
+
import { viewPatcher, viewCreator } from "./primitives/view.js";
|
|
11
|
+
function registerBuiltins() {
|
|
12
|
+
register("view", { create: viewCreator, patch: viewPatcher });
|
|
13
|
+
register("text", { create: textCreator, patch: textPatcher });
|
|
14
|
+
register("nineslice", { create: nineSliceCreator, patch: nineSlicePatcher });
|
|
15
|
+
register("particles", { create: particlesCreator, patch: particlesPatcher });
|
|
16
|
+
register("sprite", { create: spriteCreator, patch: spritePatcher });
|
|
17
|
+
register("image", { create: imageCreator, patch: imagePatcher });
|
|
18
|
+
register("graphics", { create: graphicsCreator, patch: graphicsPatcher });
|
|
19
|
+
register("vectorDraw", { create: vectorDrawCreator, patch: vectorDrawPatcher });
|
|
20
|
+
register("tilesprite", { create: tileSpriteCreator, patch: tileSpritePatcher });
|
|
21
|
+
register("View", { create: viewCreator, patch: viewPatcher });
|
|
22
|
+
register("Text", { create: textCreator, patch: textPatcher });
|
|
23
|
+
register("NineSlice", { create: nineSliceCreator, patch: nineSlicePatcher });
|
|
24
|
+
register("Particles", { create: particlesCreator, patch: particlesPatcher });
|
|
25
|
+
register("Sprite", { create: spriteCreator, patch: spritePatcher });
|
|
26
|
+
register("Image", { create: imageCreator, patch: imagePatcher });
|
|
27
|
+
register("Graphics", { create: graphicsCreator, patch: graphicsPatcher });
|
|
28
|
+
register("TileSprite", { create: tileSpriteCreator, patch: tileSpritePatcher });
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
registerBuiltins
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/index.ts"],"sourcesContent":["/**\n * Built-in component implementations\n * Exports creators, patchers, props and registration function for all components\n */\nimport { register } from '../host'\nimport { graphicsCreator, graphicsPatcher } from './primitives/graphics'\nimport { imageCreator, imagePatcher } from './primitives/image'\nimport { nineSliceCreator, nineSlicePatcher } from './primitives/nineslice'\nimport { particlesCreator, particlesPatcher } from './primitives/particles'\nimport { spriteCreator, spritePatcher } from './primitives/sprite'\nimport { textCreator, textPatcher } from './primitives/text'\nimport { tileSpriteCreator, tileSpritePatcher } from './primitives/tilesprite'\nimport { vectorDrawCreator, vectorDrawPatcher } from './primitives/vectorDraw'\nimport { viewCreator, viewPatcher } from './primitives/view'\n\n/**\n * Component type constants for JSX usage (legacy primitives)\n * Note: All primitive components now have custom wrappers\n * Use lowercase primitives internally or import wrappers from custom\n */\n\n/**\n * Registers all built-in components with the host\n * This should be called during library initialization\n */\nexport function registerBuiltins() {\n // Register primitives (lowercase) - internal use\n register('view' as 'View', { create: viewCreator, patch: viewPatcher })\n register('text' as 'Text', { create: textCreator, patch: textPatcher })\n register('nineslice' as 'NineSlice', { create: nineSliceCreator, patch: nineSlicePatcher })\n register('particles' as 'Particles', { create: particlesCreator, patch: particlesPatcher })\n register('sprite' as 'Sprite', { create: spriteCreator, patch: spritePatcher })\n register('image' as 'Image', { create: imageCreator, patch: imagePatcher })\n register('graphics' as 'Graphics', { create: graphicsCreator, patch: graphicsPatcher })\n register('vectorDraw', { create: vectorDrawCreator, patch: vectorDrawPatcher })\n register('tilesprite' as 'TileSprite', { create: tileSpriteCreator, patch: tileSpritePatcher })\n\n // Register uppercase variants for backward compatibility\n register('View', { create: viewCreator, patch: viewPatcher })\n register('Text', { create: textCreator, patch: textPatcher })\n register('NineSlice', { create: nineSliceCreator, patch: nineSlicePatcher })\n register('Particles', { create: particlesCreator, patch: particlesPatcher })\n register('Sprite', { create: spriteCreator, patch: spritePatcher })\n register('Image', { create: imageCreator, patch: imagePatcher })\n register('Graphics', { create: graphicsCreator, patch: graphicsPatcher })\n register('TileSprite', { create: tileSpriteCreator, patch: tileSpritePatcher })\n\n // Register internal SceneWrapper component (for mountJSX auto-sizing)\n // SceneWrapper is a function component, not a primitive, so it doesn't need creators\n // It will be handled by the function component path in mount()\n}\n"],"names":[],"mappings":";;;;;;;;;;AAyBO,SAAS,mBAAmB;AAEjC,WAAS,QAAkB,EAAE,QAAQ,aAAa,OAAO,aAAa;AACtE,WAAS,QAAkB,EAAE,QAAQ,aAAa,OAAO,aAAa;AACtE,WAAS,aAA4B,EAAE,QAAQ,kBAAkB,OAAO,kBAAkB;AAC1F,WAAS,aAA4B,EAAE,QAAQ,kBAAkB,OAAO,kBAAkB;AAC1F,WAAS,UAAsB,EAAE,QAAQ,eAAe,OAAO,eAAe;AAC9E,WAAS,SAAoB,EAAE,QAAQ,cAAc,OAAO,cAAc;AAC1E,WAAS,YAA0B,EAAE,QAAQ,iBAAiB,OAAO,iBAAiB;AACtF,WAAS,cAAc,EAAE,QAAQ,mBAAmB,OAAO,mBAAmB;AAC9E,WAAS,cAA8B,EAAE,QAAQ,mBAAmB,OAAO,mBAAmB;AAG9F,WAAS,QAAQ,EAAE,QAAQ,aAAa,OAAO,aAAa;AAC5D,WAAS,QAAQ,EAAE,QAAQ,aAAa,OAAO,aAAa;AAC5D,WAAS,aAAa,EAAE,QAAQ,kBAAkB,OAAO,kBAAkB;AAC3E,WAAS,aAAa,EAAE,QAAQ,kBAAkB,OAAO,kBAAkB;AAC3E,WAAS,UAAU,EAAE,QAAQ,eAAe,OAAO,eAAe;AAClE,WAAS,SAAS,EAAE,QAAQ,cAAc,OAAO,cAAc;AAC/D,WAAS,YAAY,EAAE,QAAQ,iBAAiB,OAAO,iBAAiB;AACxE,WAAS,cAAc,EAAE,QAAQ,mBAAmB,OAAO,mBAAmB;AAKhF;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vdom = require("@number10/jsx-core/vdom");
|
|
4
|
+
function SceneWrapper(props) {
|
|
5
|
+
const { width, height, children } = props;
|
|
6
|
+
const child = vdom.normalizeVNodeLike(children);
|
|
7
|
+
return child ? vdom.createElement("View", { width, height }, child) : vdom.createElement("View", { width, height });
|
|
8
|
+
}
|
|
9
|
+
exports.SceneWrapper = SceneWrapper;
|
|
10
|
+
//# sourceMappingURL=SceneWrapper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneWrapper.cjs","sources":["../../../src/components/internal/SceneWrapper.tsx"],"sourcesContent":["/**\n * SceneWrapper - Internal component that provides scene dimensions\n * Enables percentage-based sizing for mounted components\n * Used automatically by mountJSX unless disableAutoSize is true\n */\nimport type { VNodeLike } from '@number10/jsx-core'\nimport { createElement, normalizeVNodeLike } from '@number10/jsx-core/vdom'\n\n/**\n * Props for SceneWrapper\n */\nexport interface SceneWrapperProps {\n /** Scene/container width in pixels */\n width: number\n /** Scene/container height in pixels */\n height: number\n /** Child component to render */\n children: VNodeLike\n}\n\n/**\n * Internal wrapper that provides scene dimensions to child components\n * This allows child components to use percentage-based widths/heights\n * @param props - SceneWrapper properties\n * @returns View with absolute dimensions\n */\nexport function SceneWrapper(props: SceneWrapperProps) {\n const { width, height, children } = props\n const child = normalizeVNodeLike(children)\n\n return child\n ? createElement('View', { width, height }, child)\n : createElement('View', { width, height })\n}\n"],"names":["normalizeVNodeLike","createElement"],"mappings":";;;AA0BO,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,OAAO,QAAQ,SAAA,IAAa;AACpC,QAAM,QAAQA,KAAAA,mBAAmB,QAAQ;AAEzC,SAAO,QACHC,KAAAA,cAAc,QAAQ,EAAE,OAAO,OAAA,GAAU,KAAK,IAC9CA,KAAAA,cAAc,QAAQ,EAAE,OAAO,QAAQ;AAC7C;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { VNodeLike } from '@number10/jsx-core';
|
|
2
|
+
/**
|
|
3
|
+
* Props for SceneWrapper
|
|
4
|
+
*/
|
|
5
|
+
export interface SceneWrapperProps {
|
|
6
|
+
/** Scene/container width in pixels */
|
|
7
|
+
width: number;
|
|
8
|
+
/** Scene/container height in pixels */
|
|
9
|
+
height: number;
|
|
10
|
+
/** Child component to render */
|
|
11
|
+
children: VNodeLike;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Internal wrapper that provides scene dimensions to child components
|
|
15
|
+
* This allows child components to use percentage-based widths/heights
|
|
16
|
+
* @param props - SceneWrapper properties
|
|
17
|
+
* @returns View with absolute dimensions
|
|
18
|
+
*/
|
|
19
|
+
export declare function SceneWrapper(props: SceneWrapperProps): import('@number10/jsx-core').VNode;
|
|
20
|
+
//# sourceMappingURL=SceneWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/internal/SceneWrapper.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAGnD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,gCAAgC;IAChC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,sCAOpD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { normalizeVNodeLike, createElement } from "@number10/jsx-core/vdom";
|
|
2
|
+
function SceneWrapper(props) {
|
|
3
|
+
const { width, height, children } = props;
|
|
4
|
+
const child = normalizeVNodeLike(children);
|
|
5
|
+
return child ? createElement("View", { width, height }, child) : createElement("View", { width, height });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
SceneWrapper
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=SceneWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneWrapper.js","sources":["../../../src/components/internal/SceneWrapper.tsx"],"sourcesContent":["/**\n * SceneWrapper - Internal component that provides scene dimensions\n * Enables percentage-based sizing for mounted components\n * Used automatically by mountJSX unless disableAutoSize is true\n */\nimport type { VNodeLike } from '@number10/jsx-core'\nimport { createElement, normalizeVNodeLike } from '@number10/jsx-core/vdom'\n\n/**\n * Props for SceneWrapper\n */\nexport interface SceneWrapperProps {\n /** Scene/container width in pixels */\n width: number\n /** Scene/container height in pixels */\n height: number\n /** Child component to render */\n children: VNodeLike\n}\n\n/**\n * Internal wrapper that provides scene dimensions to child components\n * This allows child components to use percentage-based widths/heights\n * @param props - SceneWrapper properties\n * @returns View with absolute dimensions\n */\nexport function SceneWrapper(props: SceneWrapperProps) {\n const { width, height, children } = props\n const child = normalizeVNodeLike(children)\n\n return child\n ? createElement('View', { width, height }, child)\n : createElement('View', { width, height })\n}\n"],"names":[],"mappings":";AA0BO,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,OAAO,QAAQ,SAAA,IAAa;AACpC,QAAM,QAAQ,mBAAmB,QAAQ;AAEzC,SAAO,QACH,cAAc,QAAQ,EAAE,OAAO,OAAA,GAAU,KAAK,IAC9C,cAAc,QAAQ,EAAE,OAAO,QAAQ;AAC7C;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const applyGraphics = require("../appliers/applyGraphics.cjs");
|
|
4
|
+
const applyGraphicsLayout = require("../appliers/applyGraphicsLayout.cjs");
|
|
5
|
+
const applyPhaser = require("../appliers/applyPhaser.cjs");
|
|
6
|
+
const applyTransform = require("../appliers/applyTransform.cjs");
|
|
7
|
+
const createGraphicsLayout = require("../creators/createGraphicsLayout.cjs");
|
|
8
|
+
const createPhaser = require("../creators/createPhaser.cjs");
|
|
9
|
+
const createTransform = require("../creators/createTransform.cjs");
|
|
10
|
+
const graphicsCreator = (scene, props) => {
|
|
11
|
+
const graphics = scene.add.graphics();
|
|
12
|
+
graphics.setPosition(createTransform.resolveAnimatableNumber(props.x) ?? 0, createTransform.resolveAnimatableNumber(props.y) ?? 0);
|
|
13
|
+
createTransform.createTransform(graphics, props);
|
|
14
|
+
createPhaser.createPhaser(graphics, props);
|
|
15
|
+
createGraphicsLayout.createGraphicsLayout(graphics, props);
|
|
16
|
+
if (props.onDraw) {
|
|
17
|
+
props.onDraw(graphics, props);
|
|
18
|
+
}
|
|
19
|
+
return graphics;
|
|
20
|
+
};
|
|
21
|
+
const graphicsPatcher = (node, prev, next) => {
|
|
22
|
+
applyTransform.applyTransformProps(node, prev, next);
|
|
23
|
+
applyPhaser.applyPhaserProps(node, prev, next);
|
|
24
|
+
applyGraphics.applyGraphicsProps(node, prev, next);
|
|
25
|
+
applyGraphicsLayout.applyGraphicsLayout(node, prev, next);
|
|
26
|
+
};
|
|
27
|
+
exports.graphicsCreator = graphicsCreator;
|
|
28
|
+
exports.graphicsPatcher = graphicsPatcher;
|
|
29
|
+
//# sourceMappingURL=graphics.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphics.cjs","sources":["../../../src/components/primitives/graphics.ts"],"sourcesContent":["/**\n * Graphics component - Phaser Graphics GameObject (custom shapes)\n * Status: IMPLEMENTED ✅\n *\n * Design Decisions & Answers:\n * ===========================\n *\n * 1. Headless Default: TRUE ✅\n * Rationale: Graphics are typically decorative (custom shapes, effects).\n * They should NOT affect layout unless explicitly configured.\n * Use Cases:\n * - ✅ Headless (default): Debug visualizations, particle trails, decorative effects\n * - ❌ Layout-aware: Custom UI shapes (via headless=false + explicit width/height)\n *\n * 2. View Background vs. Graphics Component: CLEAR SEPARATION ✅\n * View Background (internal):\n * - Special role: Defines container dimensions\n * - Automatically managed by View component\n * - Marked with __isBackground flag\n * - Always excluded from layout calculations\n * Graphics Component (user-facing):\n * - Custom shapes for any purpose\n * - User controls drawing via onDraw callback\n * - Can be headless OR layout-aware (explicit)\n * - Independent GameObject, not tied to View\n *\n * 3. Layout Size Provider: EXPLICIT DIMENSIONS REQUIRED ✅\n * Decision: Option A - Require explicit width/height props for layout participation\n * Reasoning:\n * - Graphics have no inherent dimensions until drawn\n * - Calculating bounds dynamically is expensive (getBounds() forces geometry calc)\n * - Bounds change with every draw call (unstable for layout)\n * - Explicit dimensions = predictable layout behavior\n * Implementation:\n * - If headless=false: Require width/height props (throw error if missing)\n * - __getLayoutSize = () => ({ width: props.width!, height: props.height! })\n *\n * 4. Drawing API: IMPERATIVE CALLBACK ✅\n * Decision: Option A - onDraw callback (imperative)\n * Reasoning:\n * - Simplest API, full Phaser Graphics power\n * - No abstraction overhead\n * - Familiar to Phaser developers\n * - Flexible for complex shapes\n * Interface:\n * onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n * Example:\n * <Graphics onDraw={(g) => {\n * g.fillStyle(0xff0000, 1)\n * g.fillCircle(50, 50, 50)\n * }} />\n * Future: Consider declarative shape components if demand is high\n *\n * 5. Redraw Strategy: DEPENDENCY-BASED ✅\n * Decision: Redraw when dependencies array changes (React useEffect style)\n * Behavior:\n * - autoClear=true (default): Clear graphics before each onDraw call\n * - dependencies=[...]: Only redraw when dependencies change (shallow compare)\n * - No dependencies: Redraw on every patch (expensive!)\n * Implementation:\n * - Store previous dependencies on graphics object\n * - Compare with current dependencies in patcher\n * - Call onDraw only if changed\n *\n * 6. Performance Optimization: GENERATE-TEXTURE PATH 🆕\n * Strategy for static graphics:\n * - Static graphics (no redraw) → Consider generateTexture() optimization\n * - Converts geometry to texture (faster rendering, loses vector quality)\n * - Trade-off: Memory (texture) vs. CPU (redraw)\n * Props:\n * - static?: boolean (if true, generate texture after first draw)\n * - textureKey?: string (cache key for generated texture)\n * Recommendation: Advanced feature, implement later if needed\n *\n * 7. Common Use Cases & Alternatives: DOCUMENTED ✅\n * Use Graphics For:\n * - ✅ Custom complex shapes (polygons, stars, bezier curves)\n * - ✅ Dynamic visualizations (graphs, charts)\n * - ✅ Progress bars with custom shapes\n * - ✅ Debug overlays (hit boxes, grids)\n * Use Alternatives For:\n * - ❌ Simple rectangles → Use View with backgroundColor\n * - ❌ Borders → Use View with borderColor/borderWidth\n * - ❌ Static shapes → Consider Image with pre-rendered texture\n * - ❌ Repeated patterns → Use TileSprite\n *\n * 8. Clear Behavior: CONFIGURABLE ✅\n * Decision: autoClear=true by default\n * Reasoning:\n * - Most use cases: Single shape per Graphics object\n * - Prevents accumulation of draw calls\n * - Override with autoClear=false for additive drawing\n * Edge Case: Multiple draw calls in onDraw → All executed, then cleared on next redraw\n *\n * Implementation Status:\n * ======================\n * [✅] Create graphics with scene.add.graphics()\n * [✅] Apply transform props via applyTransformProps\n * [✅] Setup onDraw callback invocation\n * [✅] Implement dependency-based redraw logic\n * [✅] Handle autoClear flag\n * [✅] Setup layout size provider (explicit width/height)\n * [✅] Validate width/height if headless=false\n * [✅] Example component with interactive demos\n * [❌] generateTexture optimization (future enhancement)\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyGraphicsProps } from '../appliers/applyGraphics'\nimport { applyGraphicsLayout } from '../appliers/applyGraphicsLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createGraphicsLayout } from '../creators/createGraphicsLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform, resolveAnimatableNumber } from '../creators/createTransform'\n\n/**\n * Base props for Graphics component\n */\nexport interface GraphicsBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /**\n * Drawing callback - receives Graphics instance for custom drawing\n * Called on mount and when dependencies change\n * @param graphics - Phaser Graphics instance\n * @param props - Current props (for accessing dynamic values)\n */\n onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n\n /**\n * If true, graphics is cleared before onDraw is called\n * Default: true (usually what you want)\n */\n autoClear?: boolean\n\n /**\n * Dependencies array - if any value changes, onDraw is re-executed\n * Similar to React useEffect dependencies\n */\n dependencies?: unknown[]\n}\n\n/**\n * Props for Graphics component\n */\nexport interface GraphicsProps\n extends GraphicsBaseProps, PropsDefaultExtension<Phaser.GameObjects.Graphics> {}\n\n/**\n * Graphics creator - creates a Phaser Graphics object\n */\nexport const graphicsCreator: HostCreator<'Graphics'> = (scene, props) => {\n // Create graphics (position set via setPosition below)\n const graphics = scene.add.graphics()\n\n // Set initial position explicitly (Graphics doesn't take x/y in constructor like Text does)\n graphics.setPosition(resolveAnimatableNumber(props.x) ?? 0, resolveAnimatableNumber(props.y) ?? 0)\n\n // Apply transform props (scale, rotation)\n createTransform(graphics, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(graphics, props)\n\n // Setup layout system (props and size provider)\n createGraphicsLayout(graphics, props)\n\n // Execute initial draw if onDraw callback provided\n if (props.onDraw) {\n props.onDraw(graphics, props)\n }\n return graphics\n}\n\n/**\n * Graphics patcher - updates Graphics properties\n */\nexport const graphicsPatcher: HostPatcher<'Graphics'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply Graphics-specific props (onDraw, autoClear, dependencies)\n applyGraphicsProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applyGraphicsLayout(node, prev, next)\n}\n"],"names":["resolveAnimatableNumber","createTransform","createPhaser","createGraphicsLayout","applyTransformProps","applyPhaserProps","applyGraphicsProps","applyGraphicsLayout"],"mappings":";;;;;;;;;AAwJO,MAAM,kBAA2C,CAAC,OAAO,UAAU;AAExE,QAAM,WAAW,MAAM,IAAI,SAAA;AAG3B,WAAS,YAAYA,wCAAwB,MAAM,CAAC,KAAK,GAAGA,wCAAwB,MAAM,CAAC,KAAK,CAAC;AAGjGC,kBAAAA,gBAAgB,UAAU,KAAK;AAG/BC,eAAAA,aAAa,UAAU,KAAK;AAG5BC,uBAAAA,qBAAqB,UAAU,KAAK;AAGpC,MAAI,MAAM,QAAQ;AAChB,UAAM,OAAO,UAAU,KAAK;AAAA,EAC9B;AACA,SAAO;AACT;AAKO,MAAM,kBAA2C,CAAC,MAAM,MAAM,SAAS;AAE5EC,qCAAoB,MAAM,MAAM,IAAI;AAGpCC,+BAAiB,MAAM,MAAM,IAAI;AAGjCC,mCAAmB,MAAM,MAAM,IAAI;AAGnCC,0CAAoB,MAAM,MAAM,IAAI;AACtC;;;"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { LayoutProps, PhaserProps, TransformProps } from '../../core-props';
|
|
2
|
+
import { HostCreator, HostPatcher } from '../../host';
|
|
3
|
+
import { PropsDefaultExtension } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Graphics component - Phaser Graphics GameObject (custom shapes)
|
|
6
|
+
* Status: IMPLEMENTED ✅
|
|
7
|
+
*
|
|
8
|
+
* Design Decisions & Answers:
|
|
9
|
+
* ===========================
|
|
10
|
+
*
|
|
11
|
+
* 1. Headless Default: TRUE ✅
|
|
12
|
+
* Rationale: Graphics are typically decorative (custom shapes, effects).
|
|
13
|
+
* They should NOT affect layout unless explicitly configured.
|
|
14
|
+
* Use Cases:
|
|
15
|
+
* - ✅ Headless (default): Debug visualizations, particle trails, decorative effects
|
|
16
|
+
* - ❌ Layout-aware: Custom UI shapes (via headless=false + explicit width/height)
|
|
17
|
+
*
|
|
18
|
+
* 2. View Background vs. Graphics Component: CLEAR SEPARATION ✅
|
|
19
|
+
* View Background (internal):
|
|
20
|
+
* - Special role: Defines container dimensions
|
|
21
|
+
* - Automatically managed by View component
|
|
22
|
+
* - Marked with __isBackground flag
|
|
23
|
+
* - Always excluded from layout calculations
|
|
24
|
+
* Graphics Component (user-facing):
|
|
25
|
+
* - Custom shapes for any purpose
|
|
26
|
+
* - User controls drawing via onDraw callback
|
|
27
|
+
* - Can be headless OR layout-aware (explicit)
|
|
28
|
+
* - Independent GameObject, not tied to View
|
|
29
|
+
*
|
|
30
|
+
* 3. Layout Size Provider: EXPLICIT DIMENSIONS REQUIRED ✅
|
|
31
|
+
* Decision: Option A - Require explicit width/height props for layout participation
|
|
32
|
+
* Reasoning:
|
|
33
|
+
* - Graphics have no inherent dimensions until drawn
|
|
34
|
+
* - Calculating bounds dynamically is expensive (getBounds() forces geometry calc)
|
|
35
|
+
* - Bounds change with every draw call (unstable for layout)
|
|
36
|
+
* - Explicit dimensions = predictable layout behavior
|
|
37
|
+
* Implementation:
|
|
38
|
+
* - If headless=false: Require width/height props (throw error if missing)
|
|
39
|
+
* - __getLayoutSize = () => ({ width: props.width!, height: props.height! })
|
|
40
|
+
*
|
|
41
|
+
* 4. Drawing API: IMPERATIVE CALLBACK ✅
|
|
42
|
+
* Decision: Option A - onDraw callback (imperative)
|
|
43
|
+
* Reasoning:
|
|
44
|
+
* - Simplest API, full Phaser Graphics power
|
|
45
|
+
* - No abstraction overhead
|
|
46
|
+
* - Familiar to Phaser developers
|
|
47
|
+
* - Flexible for complex shapes
|
|
48
|
+
* Interface:
|
|
49
|
+
* onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void
|
|
50
|
+
* Example:
|
|
51
|
+
* <Graphics onDraw={(g) => {
|
|
52
|
+
* g.fillStyle(0xff0000, 1)
|
|
53
|
+
* g.fillCircle(50, 50, 50)
|
|
54
|
+
* }} />
|
|
55
|
+
* Future: Consider declarative shape components if demand is high
|
|
56
|
+
*
|
|
57
|
+
* 5. Redraw Strategy: DEPENDENCY-BASED ✅
|
|
58
|
+
* Decision: Redraw when dependencies array changes (React useEffect style)
|
|
59
|
+
* Behavior:
|
|
60
|
+
* - autoClear=true (default): Clear graphics before each onDraw call
|
|
61
|
+
* - dependencies=[...]: Only redraw when dependencies change (shallow compare)
|
|
62
|
+
* - No dependencies: Redraw on every patch (expensive!)
|
|
63
|
+
* Implementation:
|
|
64
|
+
* - Store previous dependencies on graphics object
|
|
65
|
+
* - Compare with current dependencies in patcher
|
|
66
|
+
* - Call onDraw only if changed
|
|
67
|
+
*
|
|
68
|
+
* 6. Performance Optimization: GENERATE-TEXTURE PATH 🆕
|
|
69
|
+
* Strategy for static graphics:
|
|
70
|
+
* - Static graphics (no redraw) → Consider generateTexture() optimization
|
|
71
|
+
* - Converts geometry to texture (faster rendering, loses vector quality)
|
|
72
|
+
* - Trade-off: Memory (texture) vs. CPU (redraw)
|
|
73
|
+
* Props:
|
|
74
|
+
* - static?: boolean (if true, generate texture after first draw)
|
|
75
|
+
* - textureKey?: string (cache key for generated texture)
|
|
76
|
+
* Recommendation: Advanced feature, implement later if needed
|
|
77
|
+
*
|
|
78
|
+
* 7. Common Use Cases & Alternatives: DOCUMENTED ✅
|
|
79
|
+
* Use Graphics For:
|
|
80
|
+
* - ✅ Custom complex shapes (polygons, stars, bezier curves)
|
|
81
|
+
* - ✅ Dynamic visualizations (graphs, charts)
|
|
82
|
+
* - ✅ Progress bars with custom shapes
|
|
83
|
+
* - ✅ Debug overlays (hit boxes, grids)
|
|
84
|
+
* Use Alternatives For:
|
|
85
|
+
* - ❌ Simple rectangles → Use View with backgroundColor
|
|
86
|
+
* - ❌ Borders → Use View with borderColor/borderWidth
|
|
87
|
+
* - ❌ Static shapes → Consider Image with pre-rendered texture
|
|
88
|
+
* - ❌ Repeated patterns → Use TileSprite
|
|
89
|
+
*
|
|
90
|
+
* 8. Clear Behavior: CONFIGURABLE ✅
|
|
91
|
+
* Decision: autoClear=true by default
|
|
92
|
+
* Reasoning:
|
|
93
|
+
* - Most use cases: Single shape per Graphics object
|
|
94
|
+
* - Prevents accumulation of draw calls
|
|
95
|
+
* - Override with autoClear=false for additive drawing
|
|
96
|
+
* Edge Case: Multiple draw calls in onDraw → All executed, then cleared on next redraw
|
|
97
|
+
*
|
|
98
|
+
* Implementation Status:
|
|
99
|
+
* ======================
|
|
100
|
+
* [✅] Create graphics with scene.add.graphics()
|
|
101
|
+
* [✅] Apply transform props via applyTransformProps
|
|
102
|
+
* [✅] Setup onDraw callback invocation
|
|
103
|
+
* [✅] Implement dependency-based redraw logic
|
|
104
|
+
* [✅] Handle autoClear flag
|
|
105
|
+
* [✅] Setup layout size provider (explicit width/height)
|
|
106
|
+
* [✅] Validate width/height if headless=false
|
|
107
|
+
* [✅] Example component with interactive demos
|
|
108
|
+
* [❌] generateTexture optimization (future enhancement)
|
|
109
|
+
*/
|
|
110
|
+
import type * as Phaser from 'phaser';
|
|
111
|
+
/**
|
|
112
|
+
* Base props for Graphics component
|
|
113
|
+
*/
|
|
114
|
+
export interface GraphicsBaseProps extends TransformProps, PhaserProps, LayoutProps {
|
|
115
|
+
/**
|
|
116
|
+
* Drawing callback - receives Graphics instance for custom drawing
|
|
117
|
+
* Called on mount and when dependencies change
|
|
118
|
+
* @param graphics - Phaser Graphics instance
|
|
119
|
+
* @param props - Current props (for accessing dynamic values)
|
|
120
|
+
*/
|
|
121
|
+
onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void;
|
|
122
|
+
/**
|
|
123
|
+
* If true, graphics is cleared before onDraw is called
|
|
124
|
+
* Default: true (usually what you want)
|
|
125
|
+
*/
|
|
126
|
+
autoClear?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Dependencies array - if any value changes, onDraw is re-executed
|
|
129
|
+
* Similar to React useEffect dependencies
|
|
130
|
+
*/
|
|
131
|
+
dependencies?: unknown[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Props for Graphics component
|
|
135
|
+
*/
|
|
136
|
+
export interface GraphicsProps extends GraphicsBaseProps, PropsDefaultExtension<Phaser.GameObjects.Graphics> {
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Graphics creator - creates a Phaser Graphics object
|
|
140
|
+
*/
|
|
141
|
+
export declare const graphicsCreator: HostCreator<'Graphics'>;
|
|
142
|
+
/**
|
|
143
|
+
* Graphics patcher - updates Graphics properties
|
|
144
|
+
*/
|
|
145
|
+
export declare const graphicsPatcher: HostPatcher<'Graphics'>;
|
|
146
|
+
//# sourceMappingURL=graphics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphics.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/graphics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AASxD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc,EAAE,WAAW,EAAE,WAAW;IACjF;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAElF;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,EAAE,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aACf,SAAQ,iBAAiB,EAAE,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;CAAG;AAElF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,UAAU,CAqBnD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,UAAU,CAYnD,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { applyGraphicsProps } from "../appliers/applyGraphics.js";
|
|
2
|
+
import { applyGraphicsLayout } from "../appliers/applyGraphicsLayout.js";
|
|
3
|
+
import { applyPhaserProps } from "../appliers/applyPhaser.js";
|
|
4
|
+
import { applyTransformProps } from "../appliers/applyTransform.js";
|
|
5
|
+
import { createGraphicsLayout } from "../creators/createGraphicsLayout.js";
|
|
6
|
+
import { createPhaser } from "../creators/createPhaser.js";
|
|
7
|
+
import { resolveAnimatableNumber, createTransform } from "../creators/createTransform.js";
|
|
8
|
+
const graphicsCreator = (scene, props) => {
|
|
9
|
+
const graphics = scene.add.graphics();
|
|
10
|
+
graphics.setPosition(resolveAnimatableNumber(props.x) ?? 0, resolveAnimatableNumber(props.y) ?? 0);
|
|
11
|
+
createTransform(graphics, props);
|
|
12
|
+
createPhaser(graphics, props);
|
|
13
|
+
createGraphicsLayout(graphics, props);
|
|
14
|
+
if (props.onDraw) {
|
|
15
|
+
props.onDraw(graphics, props);
|
|
16
|
+
}
|
|
17
|
+
return graphics;
|
|
18
|
+
};
|
|
19
|
+
const graphicsPatcher = (node, prev, next) => {
|
|
20
|
+
applyTransformProps(node, prev, next);
|
|
21
|
+
applyPhaserProps(node, prev, next);
|
|
22
|
+
applyGraphicsProps(node, prev, next);
|
|
23
|
+
applyGraphicsLayout(node, prev, next);
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
graphicsCreator,
|
|
27
|
+
graphicsPatcher
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=graphics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphics.js","sources":["../../../src/components/primitives/graphics.ts"],"sourcesContent":["/**\n * Graphics component - Phaser Graphics GameObject (custom shapes)\n * Status: IMPLEMENTED ✅\n *\n * Design Decisions & Answers:\n * ===========================\n *\n * 1. Headless Default: TRUE ✅\n * Rationale: Graphics are typically decorative (custom shapes, effects).\n * They should NOT affect layout unless explicitly configured.\n * Use Cases:\n * - ✅ Headless (default): Debug visualizations, particle trails, decorative effects\n * - ❌ Layout-aware: Custom UI shapes (via headless=false + explicit width/height)\n *\n * 2. View Background vs. Graphics Component: CLEAR SEPARATION ✅\n * View Background (internal):\n * - Special role: Defines container dimensions\n * - Automatically managed by View component\n * - Marked with __isBackground flag\n * - Always excluded from layout calculations\n * Graphics Component (user-facing):\n * - Custom shapes for any purpose\n * - User controls drawing via onDraw callback\n * - Can be headless OR layout-aware (explicit)\n * - Independent GameObject, not tied to View\n *\n * 3. Layout Size Provider: EXPLICIT DIMENSIONS REQUIRED ✅\n * Decision: Option A - Require explicit width/height props for layout participation\n * Reasoning:\n * - Graphics have no inherent dimensions until drawn\n * - Calculating bounds dynamically is expensive (getBounds() forces geometry calc)\n * - Bounds change with every draw call (unstable for layout)\n * - Explicit dimensions = predictable layout behavior\n * Implementation:\n * - If headless=false: Require width/height props (throw error if missing)\n * - __getLayoutSize = () => ({ width: props.width!, height: props.height! })\n *\n * 4. Drawing API: IMPERATIVE CALLBACK ✅\n * Decision: Option A - onDraw callback (imperative)\n * Reasoning:\n * - Simplest API, full Phaser Graphics power\n * - No abstraction overhead\n * - Familiar to Phaser developers\n * - Flexible for complex shapes\n * Interface:\n * onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n * Example:\n * <Graphics onDraw={(g) => {\n * g.fillStyle(0xff0000, 1)\n * g.fillCircle(50, 50, 50)\n * }} />\n * Future: Consider declarative shape components if demand is high\n *\n * 5. Redraw Strategy: DEPENDENCY-BASED ✅\n * Decision: Redraw when dependencies array changes (React useEffect style)\n * Behavior:\n * - autoClear=true (default): Clear graphics before each onDraw call\n * - dependencies=[...]: Only redraw when dependencies change (shallow compare)\n * - No dependencies: Redraw on every patch (expensive!)\n * Implementation:\n * - Store previous dependencies on graphics object\n * - Compare with current dependencies in patcher\n * - Call onDraw only if changed\n *\n * 6. Performance Optimization: GENERATE-TEXTURE PATH 🆕\n * Strategy for static graphics:\n * - Static graphics (no redraw) → Consider generateTexture() optimization\n * - Converts geometry to texture (faster rendering, loses vector quality)\n * - Trade-off: Memory (texture) vs. CPU (redraw)\n * Props:\n * - static?: boolean (if true, generate texture after first draw)\n * - textureKey?: string (cache key for generated texture)\n * Recommendation: Advanced feature, implement later if needed\n *\n * 7. Common Use Cases & Alternatives: DOCUMENTED ✅\n * Use Graphics For:\n * - ✅ Custom complex shapes (polygons, stars, bezier curves)\n * - ✅ Dynamic visualizations (graphs, charts)\n * - ✅ Progress bars with custom shapes\n * - ✅ Debug overlays (hit boxes, grids)\n * Use Alternatives For:\n * - ❌ Simple rectangles → Use View with backgroundColor\n * - ❌ Borders → Use View with borderColor/borderWidth\n * - ❌ Static shapes → Consider Image with pre-rendered texture\n * - ❌ Repeated patterns → Use TileSprite\n *\n * 8. Clear Behavior: CONFIGURABLE ✅\n * Decision: autoClear=true by default\n * Reasoning:\n * - Most use cases: Single shape per Graphics object\n * - Prevents accumulation of draw calls\n * - Override with autoClear=false for additive drawing\n * Edge Case: Multiple draw calls in onDraw → All executed, then cleared on next redraw\n *\n * Implementation Status:\n * ======================\n * [✅] Create graphics with scene.add.graphics()\n * [✅] Apply transform props via applyTransformProps\n * [✅] Setup onDraw callback invocation\n * [✅] Implement dependency-based redraw logic\n * [✅] Handle autoClear flag\n * [✅] Setup layout size provider (explicit width/height)\n * [✅] Validate width/height if headless=false\n * [✅] Example component with interactive demos\n * [❌] generateTexture optimization (future enhancement)\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyGraphicsProps } from '../appliers/applyGraphics'\nimport { applyGraphicsLayout } from '../appliers/applyGraphicsLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createGraphicsLayout } from '../creators/createGraphicsLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform, resolveAnimatableNumber } from '../creators/createTransform'\n\n/**\n * Base props for Graphics component\n */\nexport interface GraphicsBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /**\n * Drawing callback - receives Graphics instance for custom drawing\n * Called on mount and when dependencies change\n * @param graphics - Phaser Graphics instance\n * @param props - Current props (for accessing dynamic values)\n */\n onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n\n /**\n * If true, graphics is cleared before onDraw is called\n * Default: true (usually what you want)\n */\n autoClear?: boolean\n\n /**\n * Dependencies array - if any value changes, onDraw is re-executed\n * Similar to React useEffect dependencies\n */\n dependencies?: unknown[]\n}\n\n/**\n * Props for Graphics component\n */\nexport interface GraphicsProps\n extends GraphicsBaseProps, PropsDefaultExtension<Phaser.GameObjects.Graphics> {}\n\n/**\n * Graphics creator - creates a Phaser Graphics object\n */\nexport const graphicsCreator: HostCreator<'Graphics'> = (scene, props) => {\n // Create graphics (position set via setPosition below)\n const graphics = scene.add.graphics()\n\n // Set initial position explicitly (Graphics doesn't take x/y in constructor like Text does)\n graphics.setPosition(resolveAnimatableNumber(props.x) ?? 0, resolveAnimatableNumber(props.y) ?? 0)\n\n // Apply transform props (scale, rotation)\n createTransform(graphics, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(graphics, props)\n\n // Setup layout system (props and size provider)\n createGraphicsLayout(graphics, props)\n\n // Execute initial draw if onDraw callback provided\n if (props.onDraw) {\n props.onDraw(graphics, props)\n }\n return graphics\n}\n\n/**\n * Graphics patcher - updates Graphics properties\n */\nexport const graphicsPatcher: HostPatcher<'Graphics'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply Graphics-specific props (onDraw, autoClear, dependencies)\n applyGraphicsProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applyGraphicsLayout(node, prev, next)\n}\n"],"names":[],"mappings":";;;;;;;AAwJO,MAAM,kBAA2C,CAAC,OAAO,UAAU;AAExE,QAAM,WAAW,MAAM,IAAI,SAAA;AAG3B,WAAS,YAAY,wBAAwB,MAAM,CAAC,KAAK,GAAG,wBAAwB,MAAM,CAAC,KAAK,CAAC;AAGjG,kBAAgB,UAAU,KAAK;AAG/B,eAAa,UAAU,KAAK;AAG5B,uBAAqB,UAAU,KAAK;AAGpC,MAAI,MAAM,QAAQ;AAChB,UAAM,OAAO,UAAU,KAAK;AAAA,EAC9B;AACA,SAAO;AACT;AAKO,MAAM,kBAA2C,CAAC,MAAM,MAAM,SAAS;AAE5E,sBAAoB,MAAM,MAAM,IAAI;AAGpC,mBAAiB,MAAM,MAAM,IAAI;AAGjC,qBAAmB,MAAM,MAAM,IAAI;AAGnC,sBAAoB,MAAM,MAAM,IAAI;AACtC;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const imageSubtextureRegistry = require("../../utils/image-subtexture-registry.cjs");
|
|
4
|
+
const applyImage = require("../appliers/applyImage.cjs");
|
|
5
|
+
const applyImageLayout = require("../appliers/applyImageLayout.cjs");
|
|
6
|
+
const applyPhaser = require("../appliers/applyPhaser.cjs");
|
|
7
|
+
const applyTransform = require("../appliers/applyTransform.cjs");
|
|
8
|
+
const createImageLayout = require("../creators/createImageLayout.cjs");
|
|
9
|
+
const createPhaser = require("../creators/createPhaser.cjs");
|
|
10
|
+
const createTransform = require("../creators/createTransform.cjs");
|
|
11
|
+
const imageCreator = (scene, props) => {
|
|
12
|
+
const resolvedSource = imageSubtextureRegistry.retainImageSubTexture(scene, props.texture, props.frame, props.sourceRect);
|
|
13
|
+
const image = scene.add.image(
|
|
14
|
+
createTransform.resolveAnimatableNumber(props.x) ?? 0,
|
|
15
|
+
createTransform.resolveAnimatableNumber(props.y) ?? 0,
|
|
16
|
+
resolvedSource.texture,
|
|
17
|
+
resolvedSource.frame
|
|
18
|
+
);
|
|
19
|
+
image.__subTextureCacheKey = resolvedSource.cacheKey;
|
|
20
|
+
if (resolvedSource.cacheKey) {
|
|
21
|
+
image.once?.("destroy", () => {
|
|
22
|
+
imageSubtextureRegistry.releaseImageSubTexture(scene, image.__subTextureCacheKey);
|
|
23
|
+
image.__subTextureCacheKey = void 0;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (props.headless) {
|
|
27
|
+
image.setOrigin(0.5, 0.5);
|
|
28
|
+
} else {
|
|
29
|
+
image.setOrigin(0, 0);
|
|
30
|
+
}
|
|
31
|
+
if (props.originX !== void 0 || props.originY !== void 0) {
|
|
32
|
+
image.setOrigin(props.originX ?? image.originX, props.originY ?? image.originY);
|
|
33
|
+
}
|
|
34
|
+
const normalizedProps = { ...props };
|
|
35
|
+
if (props.headless) {
|
|
36
|
+
delete normalizedProps.padding;
|
|
37
|
+
delete normalizedProps.margin;
|
|
38
|
+
delete normalizedProps.gap;
|
|
39
|
+
} else {
|
|
40
|
+
if (normalizedProps.rotation !== void 0) {
|
|
41
|
+
delete normalizedProps.rotation;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
createTransform.createTransform(image, normalizedProps);
|
|
45
|
+
createPhaser.createPhaser(image, normalizedProps);
|
|
46
|
+
if (props.tint !== void 0) {
|
|
47
|
+
image.setTint(props.tint);
|
|
48
|
+
}
|
|
49
|
+
if (props.displayWidth !== void 0 || props.displayHeight !== void 0) {
|
|
50
|
+
if (props.displayWidth !== void 0 && props.displayHeight !== void 0) {
|
|
51
|
+
const { scaleX, scaleY } = applyImage.calculateImageFitScale(
|
|
52
|
+
image,
|
|
53
|
+
props.displayWidth,
|
|
54
|
+
props.displayHeight,
|
|
55
|
+
props.fit,
|
|
56
|
+
props.sourceRect
|
|
57
|
+
);
|
|
58
|
+
image.setScale(scaleX, scaleY);
|
|
59
|
+
} else if (props.displayWidth !== void 0) {
|
|
60
|
+
const { width } = applyImage.getImageSourceDimensions(image, props.sourceRect);
|
|
61
|
+
const scale = width > 0 ? props.displayWidth / width : 1;
|
|
62
|
+
image.setScale(scale);
|
|
63
|
+
} else if (props.displayHeight !== void 0) {
|
|
64
|
+
const { height } = applyImage.getImageSourceDimensions(image, props.sourceRect);
|
|
65
|
+
const scale = height > 0 ? props.displayHeight / height : 1;
|
|
66
|
+
image.setScale(scale);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
createImageLayout.createImageLayout(image, normalizedProps);
|
|
70
|
+
if (props.onReady) {
|
|
71
|
+
props.onReady(image);
|
|
72
|
+
}
|
|
73
|
+
return image;
|
|
74
|
+
};
|
|
75
|
+
const imagePatcher = (node, prev, next) => {
|
|
76
|
+
if (prev.headless !== next.headless) {
|
|
77
|
+
if (next.headless) {
|
|
78
|
+
node.setOrigin(0.5, 0.5);
|
|
79
|
+
} else {
|
|
80
|
+
node.setOrigin(0, 0);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const normalizedPrev = { ...prev };
|
|
84
|
+
const normalizedNext = { ...next };
|
|
85
|
+
if (next.headless) {
|
|
86
|
+
delete normalizedNext.padding;
|
|
87
|
+
delete normalizedNext.margin;
|
|
88
|
+
delete normalizedNext.gap;
|
|
89
|
+
} else {
|
|
90
|
+
if (normalizedNext.rotation !== void 0) {
|
|
91
|
+
delete normalizedNext.rotation;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (prev.headless) {
|
|
95
|
+
delete normalizedPrev.padding;
|
|
96
|
+
delete normalizedPrev.margin;
|
|
97
|
+
delete normalizedPrev.gap;
|
|
98
|
+
} else {
|
|
99
|
+
if (normalizedPrev.rotation !== void 0) {
|
|
100
|
+
delete normalizedPrev.rotation;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
applyTransform.applyTransformProps(node, normalizedPrev, normalizedNext);
|
|
104
|
+
applyPhaser.applyPhaserProps(node, normalizedPrev, normalizedNext);
|
|
105
|
+
applyImage.applyImageProps(node, normalizedPrev, normalizedNext);
|
|
106
|
+
applyImageLayout.applyImageLayout(node, normalizedPrev, normalizedNext);
|
|
107
|
+
};
|
|
108
|
+
exports.imageCreator = imageCreator;
|
|
109
|
+
exports.imagePatcher = imagePatcher;
|
|
110
|
+
//# sourceMappingURL=image.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.cjs","sources":["../../../src/components/primitives/image.ts"],"sourcesContent":["/**\n * Image component - Phaser Image GameObject (static texture)\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: TEXTURE RENDERING\n * Purpose: Display static textures in UI layouts (icons, avatars, illustrations)\n * Phaser Type: Phaser.GameObjects.Image (texture-based rendering)\n * Characteristics:\n * - Layout-aware by default (participates in parent layout)\n * - Auto-sizing based on texture dimensions (like HTML <img>)\n * - Supports Phaser texture system (atlases, frames)\n *\n * 2. Headless Default: FALSE ✅\n * Decision: Image participates in layout by default\n * Reasoning:\n * - Images are UI elements (icons, avatars, illustrations)\n * - Should affect parent container dimensions\n * - Similar to Text component behavior\n * Use Cases:\n * - ✅ Layout-aware (default): Icons, avatars, logos, UI illustrations\n * - ❌ Headless (optional): Decorative backgrounds, overlays, parallax layers\n * Usage:\n * <Image texture=\"icon\" /> // Layout-aware\n * <Image texture=\"bg\" headless={true} /> // Decorative (no layout impact)\n *\n * 3. Layout Size Provider: DISPLAY DIMENSIONS ✅\n * Implementation: Uses image.displayWidth and image.displayHeight\n * Behavior:\n * - Returns scaled display dimensions\n * - Rotation is IGNORED for layout-aware images (headless=false)\n * - Rotation only works with headless=true (no layout impact)\n * Reasoning:\n * - Flow layout is incompatible with rotation (causes positioning issues)\n * - Rotated images would overlap siblings in flow layout\n * - Matches Text component behavior\n * Example:\n * <Image texture=\"icon\" /> // ✅ Layout size: 64x64\n * <Image texture=\"icon\" rotation={Math.PI/4} /> // ⚠️ Rotation IGNORED, size: 64x64\n * <Image texture=\"icon\" rotation={Math.PI/4} headless={true} /> // ✅ Rotated, no layout\n * Recommendation: Use rotation only with headless=true or absolute positioning\n *\n * 4. Sizing Strategy: HYBRID APPROACH ✅\n * Auto-Size (default):\n * - No displayWidth/displayHeight → Use texture dimensions\n * - Like HTML <img> natural size\n * Explicit Size:\n * - displayWidth + displayHeight → Scale to fit\n * - fit prop controls aspect ratio handling\n * Example:\n * <Image texture=\"icon\" /> // Auto-size\n * <Image texture=\"icon\" displayWidth={64} displayHeight={64} fit=\"contain\" />\n *\n * 5. Fit Modes: CSS-LIKE BEHAVIOR ✅\n * Decision: Implement CSS object-fit equivalent\n * Modes:\n * - 'fill' (default): Stretch to fill bounds (may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio (letterbox)\n * - 'cover': Scale to cover bounds, preserve aspect ratio (crop)\n * Implementation: Calculate scale in applier based on fit mode\n *\n * 6. Origin Behavior: HEADLESS-AWARE ✅\n * Current: Like Text component\n * - Layout-aware (headless=false): Origin (0, 0) - top-left, UI-friendly\n * - Headless (headless=true): Origin (0.5, 0.5) - centered, game object semantics\n * Reasoning:\n * - UI elements align naturally with top-left origin\n * - Game objects (headless) work better centered\n * - Consistent with Text component behavior\n *\n * 7. Rotation Behavior: LIKE TEXT ✅\n * Decision: Rotation only supported with headless=true\n * Reasoning:\n * - Flow layout is incompatible with rotation\n * - Matches Text component constraints\n * - Props normalized: rotation removed if headless=false\n *\n * 8. Common Patterns:\n * Icon:\n * <View direction=\"row\" gap={10}>\n * <Image texture=\"icon-user\" />\n * <Text text=\"Username\" />\n * </View>\n * Avatar:\n * <Image texture=\"avatar\" displayWidth={64} displayHeight={64} fit=\"cover\" />\n * Background (headless):\n * <Image texture=\"bg\" headless={true} alpha={0.5} />\n *\n * 9. Performance Considerations:\n * - Texture atlases recommended (reduce texture switches)\n * - Static images are efficient (single draw call)\n * - Texture changes trigger re-render\n * - Scaling via displayWidth/displayHeight is GPU-accelerated\n *\n * 10. Known Limitations:\n * - Rotation only supported with headless=true (ignored for layout-aware)\n * - Missing textures show Phaser default (white square)\n * - No built-in loading states\n * - Texture must be preloaded before use\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Image creation with texture/frame support\n * [✅] Transform props (position, scale, alpha)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Origin handling (headless-aware: 0,0 vs 0.5,0.5)\n * [✅] Display size with fit modes (contain/cover/fill)\n * [✅] Tint support\n * [✅] Texture and frame patching\n * [⚠️] Rotation - Only with headless=true (ignored for layout-aware)\n */\nimport type * as Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport {\n releaseImageSubTexture,\n retainImageSubTexture,\n} from '../../utils/image-subtexture-registry'\nimport {\n applyImageProps,\n calculateImageFitScale,\n getImageSourceDimensions,\n} from '../appliers/applyImage'\nimport { applyImageLayout } from '../appliers/applyImageLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createImageLayout } from '../creators/createImageLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform, resolveAnimatableNumber } from '../creators/createTransform'\n\n/**\n * Base props for Image component\n */\nexport interface ImageBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Tint color applied to image (0xRRGGBB) */\n tint?: number | undefined\n\n /** Display width (scales image to fit) */\n displayWidth?: number | undefined\n\n /** Display height (scales image to fit) */\n displayHeight?: number | undefined\n\n /**\n * How image should fit within bounds (if displayWidth/displayHeight set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Origin X (0-1, default 0.5) */\n originX?: number\n\n /** Origin Y (0-1, default 0.5) */\n originY?: number\n\n /**\n * Optional explicit source region within the texture/frame.\n * When set, the image renders only this sub-rectangle as a derived texture.\n * Coordinates are relative to the frame origin (if frame is specified)\n * or the texture origin otherwise.\n */\n sourceRect?: { x: number; y: number; w: number; h: number } | undefined\n}\n\n/**\n * Props for primitive image component (internal use only)\n * For public API, use ImageProps from custom/Image.tsx\n */\nexport interface ImagePrimitiveProps\n extends ImageBaseProps, PropsDefaultExtension<Phaser.GameObjects.Image> {}\n\ntype DerivedTextureImage = Phaser.GameObjects.Image & {\n __subTextureCacheKey?: string | undefined\n}\n\n/**\n * Image creator - creates a Phaser Image object\n */\nexport const imageCreator: HostCreator<'Image'> = (scene, props) => {\n const resolvedSource = retainImageSubTexture(scene, props.texture, props.frame, props.sourceRect)\n const image = scene.add.image(\n resolveAnimatableNumber(props.x) ?? 0,\n resolveAnimatableNumber(props.y) ?? 0,\n resolvedSource.texture,\n resolvedSource.frame\n ) as DerivedTextureImage\n image.__subTextureCacheKey = resolvedSource.cacheKey\n if (resolvedSource.cacheKey) {\n image.once?.('destroy', () => {\n releaseImageSubTexture(scene, image.__subTextureCacheKey)\n image.__subTextureCacheKey = undefined\n })\n }\n\n // Set origin based on headless flag\n // Headless: (0.5, 0.5) - centered, works naturally with rotation/scale\n // Layout-aware: (0, 0) - top-left, aligns with layout flow\n if (props.headless) {\n image.setOrigin(0.5, 0.5)\n } else {\n image.setOrigin(0, 0)\n }\n\n // Apply custom origin if specified\n if (props.originX !== undefined || props.originY !== undefined) {\n image.setOrigin(props.originX ?? image.originX, props.originY ?? image.originY)\n }\n\n // Normalize props for headless objects\n // Headless objects are positioned as points - no spacing or rotation constraints\n const normalizedProps = { ...props } as Record<string, unknown>\n if (props.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedProps.padding\n delete normalizedProps.margin\n delete normalizedProps.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedProps.rotation !== undefined) {\n delete normalizedProps.rotation\n }\n }\n\n // Apply transform props (scale, rotation if headless)\n createTransform(image, normalizedProps)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(image, normalizedProps)\n\n // Apply image-specific props (tint, displaySize, fit)\n if (props.tint !== undefined) {\n image.setTint(props.tint)\n }\n\n // Apply displayWidth/displayHeight if specified\n // (now computed from cropped dimensions)\n if (props.displayWidth !== undefined || props.displayHeight !== undefined) {\n if (props.displayWidth !== undefined && props.displayHeight !== undefined) {\n const { scaleX, scaleY } = calculateImageFitScale(\n image,\n props.displayWidth,\n props.displayHeight,\n props.fit,\n props.sourceRect\n )\n image.setScale(scaleX, scaleY)\n } else if (props.displayWidth !== undefined) {\n const { width } = getImageSourceDimensions(image, props.sourceRect)\n const scale = width > 0 ? props.displayWidth / width : 1\n image.setScale(scale)\n } else if (props.displayHeight !== undefined) {\n const { height } = getImageSourceDimensions(image, props.sourceRect)\n const scale = height > 0 ? props.displayHeight / height : 1\n image.setScale(scale)\n }\n }\n\n // Setup layout system (props and size provider)\n createImageLayout(image, normalizedProps)\n\n // Call onReady callback if provided\n if (props.onReady) {\n props.onReady(image)\n }\n\n return image\n}\n\n/**\n * Image patcher - updates Image properties\n */\nexport const imagePatcher: HostPatcher<'Image'> = (node, prev, next) => {\n // Update origin if headless flag changed\n if (prev.headless !== next.headless) {\n if (next.headless) {\n node.setOrigin(0.5, 0.5) // Headless: centered\n } else {\n node.setOrigin(0, 0) // Layout-aware: top-left\n }\n }\n\n // Normalize props for headless objects\n const normalizedPrev = { ...prev } as Record<string, unknown>\n const normalizedNext = { ...next } as Record<string, unknown>\n\n if (next.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedNext.padding\n delete normalizedNext.margin\n delete normalizedNext.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedNext.rotation !== undefined) {\n delete normalizedNext.rotation\n }\n }\n\n if (prev.headless) {\n delete normalizedPrev.padding\n delete normalizedPrev.margin\n delete normalizedPrev.gap\n } else {\n if (normalizedPrev.rotation !== undefined) {\n delete normalizedPrev.rotation\n }\n }\n\n // Apply transform props (position, rotation only if headless, scale)\n applyTransformProps(node, normalizedPrev, normalizedNext)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, normalizedPrev, normalizedNext)\n\n // Apply image-specific props (texture, frame, tint, displaySize, fit)\n applyImageProps(node, normalizedPrev, normalizedNext)\n\n // Apply layout props and update size provider if needed\n applyImageLayout(node, normalizedPrev, normalizedNext)\n}\n"],"names":["retainImageSubTexture","resolveAnimatableNumber","releaseImageSubTexture","createTransform","createPhaser","calculateImageFitScale","getImageSourceDimensions","createImageLayout","applyTransformProps","applyPhaserProps","applyImageProps","applyImageLayout"],"mappings":";;;;;;;;;;AA6LO,MAAM,eAAqC,CAAC,OAAO,UAAU;AAClE,QAAM,iBAAiBA,8CAAsB,OAAO,MAAM,SAAS,MAAM,OAAO,MAAM,UAAU;AAChG,QAAM,QAAQ,MAAM,IAAI;AAAA,IACtBC,wCAAwB,MAAM,CAAC,KAAK;AAAA,IACpCA,wCAAwB,MAAM,CAAC,KAAK;AAAA,IACpC,eAAe;AAAA,IACf,eAAe;AAAA,EAAA;AAEjB,QAAM,uBAAuB,eAAe;AAC5C,MAAI,eAAe,UAAU;AAC3B,UAAM,OAAO,WAAW,MAAM;AAC5BC,qDAAuB,OAAO,MAAM,oBAAoB;AACxD,YAAM,uBAAuB;AAAA,IAC/B,CAAC;AAAA,EACH;AAKA,MAAI,MAAM,UAAU;AAClB,UAAM,UAAU,KAAK,GAAG;AAAA,EAC1B,OAAO;AACL,UAAM,UAAU,GAAG,CAAC;AAAA,EACtB;AAGA,MAAI,MAAM,YAAY,UAAa,MAAM,YAAY,QAAW;AAC9D,UAAM,UAAU,MAAM,WAAW,MAAM,SAAS,MAAM,WAAW,MAAM,OAAO;AAAA,EAChF;AAIA,QAAM,kBAAkB,EAAE,GAAG,MAAA;AAC7B,MAAI,MAAM,UAAU;AAElB,WAAO,gBAAgB;AACvB,WAAO,gBAAgB;AACvB,WAAO,gBAAgB;AAAA,EACzB,OAAO;AAEL,QAAI,gBAAgB,aAAa,QAAW;AAC1C,aAAO,gBAAgB;AAAA,IACzB;AAAA,EACF;AAGAC,kBAAAA,gBAAgB,OAAO,eAAe;AAGtCC,eAAAA,aAAa,OAAO,eAAe;AAGnC,MAAI,MAAM,SAAS,QAAW;AAC5B,UAAM,QAAQ,MAAM,IAAI;AAAA,EAC1B;AAIA,MAAI,MAAM,iBAAiB,UAAa,MAAM,kBAAkB,QAAW;AACzE,QAAI,MAAM,iBAAiB,UAAa,MAAM,kBAAkB,QAAW;AACzE,YAAM,EAAE,QAAQ,OAAA,IAAWC,WAAAA;AAAAA,QACzB;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,MAAA;AAER,YAAM,SAAS,QAAQ,MAAM;AAAA,IAC/B,WAAW,MAAM,iBAAiB,QAAW;AAC3C,YAAM,EAAE,MAAA,IAAUC,WAAAA,yBAAyB,OAAO,MAAM,UAAU;AAClE,YAAM,QAAQ,QAAQ,IAAI,MAAM,eAAe,QAAQ;AACvD,YAAM,SAAS,KAAK;AAAA,IACtB,WAAW,MAAM,kBAAkB,QAAW;AAC5C,YAAM,EAAE,OAAA,IAAWA,WAAAA,yBAAyB,OAAO,MAAM,UAAU;AACnE,YAAM,QAAQ,SAAS,IAAI,MAAM,gBAAgB,SAAS;AAC1D,YAAM,SAAS,KAAK;AAAA,IACtB;AAAA,EACF;AAGAC,oBAAAA,kBAAkB,OAAO,eAAe;AAGxC,MAAI,MAAM,SAAS;AACjB,UAAM,QAAQ,KAAK;AAAA,EACrB;AAEA,SAAO;AACT;AAKO,MAAM,eAAqC,CAAC,MAAM,MAAM,SAAS;AAEtE,MAAI,KAAK,aAAa,KAAK,UAAU;AACnC,QAAI,KAAK,UAAU;AACjB,WAAK,UAAU,KAAK,GAAG;AAAA,IACzB,OAAO;AACL,WAAK,UAAU,GAAG,CAAC;AAAA,IACrB;AAAA,EACF;AAGA,QAAM,iBAAiB,EAAE,GAAG,KAAA;AAC5B,QAAM,iBAAiB,EAAE,GAAG,KAAA;AAE5B,MAAI,KAAK,UAAU;AAEjB,WAAO,eAAe;AACtB,WAAO,eAAe;AACtB,WAAO,eAAe;AAAA,EACxB,OAAO;AAEL,QAAI,eAAe,aAAa,QAAW;AACzC,aAAO,eAAe;AAAA,IACxB;AAAA,EACF;AAEA,MAAI,KAAK,UAAU;AACjB,WAAO,eAAe;AACtB,WAAO,eAAe;AACtB,WAAO,eAAe;AAAA,EACxB,OAAO;AACL,QAAI,eAAe,aAAa,QAAW;AACzC,aAAO,eAAe;AAAA,IACxB;AAAA,EACF;AAGAC,qCAAoB,MAAM,gBAAgB,cAAc;AAGxDC,+BAAiB,MAAM,gBAAgB,cAAc;AAGrDC,6BAAgB,MAAM,gBAAgB,cAAc;AAGpDC,oCAAiB,MAAM,gBAAgB,cAAc;AACvD;;;"}
|