@number10/phaserjsx 0.1.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 +238 -0
- package/dist/TransformOriginView-BYPbRH8N.cjs +17045 -0
- package/dist/TransformOriginView-BYPbRH8N.cjs.map +1 -0
- package/dist/TransformOriginView-CO-tJCmV.js +17046 -0
- package/dist/TransformOriginView-CO-tJCmV.js.map +1 -0
- package/dist/animation/animated-signal.d.ts +35 -0
- package/dist/animation/animated-signal.d.ts.map +1 -0
- package/dist/animation/index.d.ts +7 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/spring-physics.d.ts +120 -0
- package/dist/animation/spring-physics.d.ts.map +1 -0
- package/dist/animation/useSpring.d.ts +54 -0
- package/dist/animation/useSpring.d.ts.map +1 -0
- package/dist/colors/color-presets.d.ts +89 -0
- package/dist/colors/color-presets.d.ts.map +1 -0
- package/dist/colors/color-theme-helpers.d.ts +65 -0
- package/dist/colors/color-theme-helpers.d.ts.map +1 -0
- package/dist/colors/color-types.d.ts +100 -0
- package/dist/colors/color-types.d.ts.map +1 -0
- package/dist/colors/color-utils.d.ts +171 -0
- package/dist/colors/color-utils.d.ts.map +1 -0
- package/dist/colors/index.d.ts +17 -0
- package/dist/colors/index.d.ts.map +1 -0
- package/dist/colors/preset-manager.d.ts +35 -0
- package/dist/colors/preset-manager.d.ts.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-colors.d.ts +40 -0
- package/dist/colors/use-colors.d.ts.map +1 -0
- package/dist/components/appliers/applyBackground.d.ts +13 -0
- package/dist/components/appliers/applyBackground.d.ts.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/applyGraphics.d.ts +10 -0
- package/dist/components/appliers/applyGraphics.d.ts.map +1 -0
- package/dist/components/appliers/applyGraphicsLayout.d.ts +10 -0
- package/dist/components/appliers/applyGraphicsLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyImage.d.ts +10 -0
- package/dist/components/appliers/applyImage.d.ts.map +1 -0
- package/dist/components/appliers/applyImageLayout.d.ts +15 -0
- package/dist/components/appliers/applyImageLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyLayout.d.ts +15 -0
- package/dist/components/appliers/applyLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyNineSlice.d.ts +11 -0
- package/dist/components/appliers/applyNineSlice.d.ts.map +1 -0
- package/dist/components/appliers/applyNineSliceLayout.d.ts +15 -0
- package/dist/components/appliers/applyNineSliceLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyPhaser.d.ts +22 -0
- package/dist/components/appliers/applyPhaser.d.ts.map +1 -0
- package/dist/components/appliers/applySprite.d.ts +10 -0
- package/dist/components/appliers/applySprite.d.ts.map +1 -0
- package/dist/components/appliers/applySpriteLayout.d.ts +14 -0
- package/dist/components/appliers/applySpriteLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyText.d.ts +25 -0
- package/dist/components/appliers/applyText.d.ts.map +1 -0
- package/dist/components/appliers/applyTextLayout.d.ts +15 -0
- package/dist/components/appliers/applyTextLayout.d.ts.map +1 -0
- package/dist/components/appliers/applyTooltip.d.ts +12 -0
- package/dist/components/appliers/applyTooltip.d.ts.map +1 -0
- package/dist/components/appliers/applyTransform.d.ts +21 -0
- package/dist/components/appliers/applyTransform.d.ts.map +1 -0
- package/dist/components/creators/createBackground.d.ts +15 -0
- package/dist/components/creators/createBackground.d.ts.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/createGraphicsLayout.d.ts +9 -0
- package/dist/components/creators/createGraphicsLayout.d.ts.map +1 -0
- package/dist/components/creators/createImageLayout.d.ts +14 -0
- package/dist/components/creators/createImageLayout.d.ts.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/createNineSliceLayout.d.ts +14 -0
- package/dist/components/creators/createNineSliceLayout.d.ts.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/createSpriteLayout.d.ts +15 -0
- package/dist/components/creators/createSpriteLayout.d.ts.map +1 -0
- package/dist/components/creators/createTextLayout.d.ts +14 -0
- package/dist/components/creators/createTextLayout.d.ts.map +1 -0
- package/dist/components/creators/createTransform.d.ts +11 -0
- package/dist/components/creators/createTransform.d.ts.map +1 -0
- package/dist/components/custom/Accordion.d.ts +34 -0
- package/dist/components/custom/Accordion.d.ts.map +1 -0
- package/dist/components/custom/AlertDialog.d.ts +63 -0
- package/dist/components/custom/AlertDialog.d.ts.map +1 -0
- package/dist/components/custom/Button.d.ts +44 -0
- package/dist/components/custom/Button.d.ts.map +1 -0
- package/dist/components/custom/CharText/CharText.d.ts +8 -0
- package/dist/components/custom/CharText/CharText.d.ts.map +1 -0
- package/dist/components/custom/CharText/index.d.ts +3 -0
- package/dist/components/custom/CharText/index.d.ts.map +1 -0
- package/dist/components/custom/CharText/types.d.ts +117 -0
- package/dist/components/custom/CharText/types.d.ts.map +1 -0
- package/dist/components/custom/CharText/utils.d.ts +34 -0
- package/dist/components/custom/CharText/utils.d.ts.map +1 -0
- package/dist/components/custom/CharTextInput.d.ts +62 -0
- package/dist/components/custom/CharTextInput.d.ts.map +1 -0
- package/dist/components/custom/Dialog.d.ts +60 -0
- package/dist/components/custom/Dialog.d.ts.map +1 -0
- package/dist/components/custom/Divider.d.ts +21 -0
- package/dist/components/custom/Divider.d.ts.map +1 -0
- package/dist/components/custom/Dropdown.d.ts +91 -0
- package/dist/components/custom/Dropdown.d.ts.map +1 -0
- package/dist/components/custom/Icon.d.ts +75 -0
- package/dist/components/custom/Icon.d.ts.map +1 -0
- package/dist/components/custom/Image.d.ts +50 -0
- package/dist/components/custom/Image.d.ts.map +1 -0
- package/dist/components/custom/Modal.d.ts +37 -0
- package/dist/components/custom/Modal.d.ts.map +1 -0
- package/dist/components/custom/NineSlice.d.ts +81 -0
- package/dist/components/custom/NineSlice.d.ts.map +1 -0
- package/dist/components/custom/NineSliceButton.d.ts +128 -0
- package/dist/components/custom/NineSliceButton.d.ts.map +1 -0
- package/dist/components/custom/Portal.d.ts +43 -0
- package/dist/components/custom/Portal.d.ts.map +1 -0
- package/dist/components/custom/Portal.test.d.ts +2 -0
- package/dist/components/custom/Portal.test.d.ts.map +1 -0
- package/dist/components/custom/RadioButton.d.ts +20 -0
- package/dist/components/custom/RadioButton.d.ts.map +1 -0
- package/dist/components/custom/RadioGroup.d.ts +33 -0
- package/dist/components/custom/RadioGroup.d.ts.map +1 -0
- package/dist/components/custom/RefOriginView.d.ts +45 -0
- package/dist/components/custom/RefOriginView.d.ts.map +1 -0
- package/dist/components/custom/ScrollSlider.d.ts +36 -0
- package/dist/components/custom/ScrollSlider.d.ts.map +1 -0
- package/dist/components/custom/ScrollView.d.ts +48 -0
- package/dist/components/custom/ScrollView.d.ts.map +1 -0
- package/dist/components/custom/Sidebar.d.ts +50 -0
- package/dist/components/custom/Sidebar.d.ts.map +1 -0
- package/dist/components/custom/Slider.d.ts +131 -0
- package/dist/components/custom/Slider.d.ts.map +1 -0
- package/dist/components/custom/Text.d.ts +26 -0
- package/dist/components/custom/Text.d.ts.map +1 -0
- package/dist/components/custom/Toggle.d.ts +51 -0
- package/dist/components/custom/Toggle.d.ts.map +1 -0
- package/dist/components/custom/TransformOriginView.d.ts +34 -0
- package/dist/components/custom/TransformOriginView.d.ts.map +1 -0
- package/dist/components/custom/View.d.ts +33 -0
- package/dist/components/custom/View.d.ts.map +1 -0
- package/dist/components/custom/WrapText.d.ts +60 -0
- package/dist/components/custom/WrapText.d.ts.map +1 -0
- package/dist/components/custom/index.cjs +32 -0
- package/dist/components/custom/index.cjs.map +1 -0
- package/dist/components/custom/index.d.ts +29 -0
- package/dist/components/custom/index.d.ts.map +1 -0
- package/dist/components/custom/index.js +32 -0
- package/dist/components/custom/index.js.map +1 -0
- package/dist/components/index.d.ts +28 -0
- package/dist/components/index.d.ts.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/primitives/graphics.d.ts +40 -0
- package/dist/components/primitives/graphics.d.ts.map +1 -0
- package/dist/components/primitives/image.d.ts +45 -0
- package/dist/components/primitives/image.d.ts.map +1 -0
- package/dist/components/primitives/nineslice.d.ts +111 -0
- package/dist/components/primitives/nineslice.d.ts.map +1 -0
- package/dist/components/primitives/sprite.d.ts +58 -0
- package/dist/components/primitives/sprite.d.ts.map +1 -0
- package/dist/components/primitives/text.d.ts +26 -0
- package/dist/components/primitives/text.d.ts.map +1 -0
- package/dist/components/primitives/tilesprite.d.ts +47 -0
- package/dist/components/primitives/tilesprite.d.ts.map +1 -0
- package/dist/components/primitives/view.d.ts +23 -0
- package/dist/components/primitives/view.d.ts.map +1 -0
- package/dist/core-props.d.ts +605 -0
- package/dist/core-props.d.ts.map +1 -0
- package/dist/core-types.d.ts +59 -0
- package/dist/core-types.d.ts.map +1 -0
- package/dist/design-tokens/design-token-presets.d.ts +26 -0
- package/dist/design-tokens/design-token-presets.d.ts.map +1 -0
- package/dist/design-tokens/design-token-types.d.ts +109 -0
- package/dist/design-tokens/design-token-types.d.ts.map +1 -0
- package/dist/design-tokens/index.d.ts +8 -0
- package/dist/design-tokens/index.d.ts.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/dev-config.d.ts +238 -0
- package/dist/dev-config.d.ts.map +1 -0
- package/dist/effects/effect-registry.d.ts +54 -0
- package/dist/effects/effect-registry.d.ts.map +1 -0
- package/dist/effects/index.d.ts +56 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/use-effect.d.ts +172 -0
- package/dist/effects/use-effect.d.ts.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.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-blur.d.ts.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-shadow.d.ts +21 -0
- package/dist/fx/convenience-hooks/use-shadow.d.ts.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/color-matrix.d.ts +31 -0
- package/dist/fx/fx-creators/color-matrix.d.ts.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/index.d.ts +10 -0
- package/dist/fx/fx-creators/index.d.ts.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/shadow.d.ts +43 -0
- package/dist/fx/fx-creators/shadow.d.ts.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-registry.d.ts +59 -0
- package/dist/fx/fx-registry.d.ts.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.d.ts +53 -0
- package/dist/fx/use-fx.d.ts.map +1 -0
- package/dist/gestures/gesture-manager.d.ts +149 -0
- package/dist/gestures/gesture-manager.d.ts.map +1 -0
- package/dist/gestures/gesture-types.d.ts +229 -0
- package/dist/gestures/gesture-types.d.ts.map +1 -0
- package/dist/hooks-svg.d.ts +104 -0
- package/dist/hooks-svg.d.ts.map +1 -0
- package/dist/hooks.d.ts +135 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/host.d.ts +74 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/index.cjs +584 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +582 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.cjs +10 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +5 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +11 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.cjs +43 -0
- package/dist/jsx-runtime.cjs.map +1 -0
- package/dist/jsx-runtime.d.ts +25 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +43 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/jsx-types.d.ts +33 -0
- package/dist/jsx-types.d.ts.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/container-applier.d.ts +9 -0
- package/dist/layout/appliers/container-applier.d.ts.map +1 -0
- package/dist/layout/appliers/position-applier.d.ts +8 -0
- package/dist/layout/appliers/position-applier.d.ts.map +1 -0
- package/dist/layout/index.d.ts +22 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/layout-engine-test-utils.d.ts +19 -0
- package/dist/layout/layout-engine-test-utils.d.ts.map +1 -0
- package/dist/layout/layout-engine.d.ts +98 -0
- package/dist/layout/layout-engine.d.ts.map +1 -0
- package/dist/layout/strategies/base-strategy.d.ts +59 -0
- package/dist/layout/strategies/base-strategy.d.ts.map +1 -0
- package/dist/layout/strategies/column-layout.d.ts +38 -0
- package/dist/layout/strategies/column-layout.d.ts.map +1 -0
- package/dist/layout/strategies/row-layout.d.ts +38 -0
- package/dist/layout/strategies/row-layout.d.ts.map +1 -0
- package/dist/layout/strategies/stack-layout.d.ts +30 -0
- package/dist/layout/strategies/stack-layout.d.ts.map +1 -0
- package/dist/layout/types.d.ts +137 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout/utils/child-utils.d.ts +74 -0
- package/dist/layout/utils/child-utils.d.ts.map +1 -0
- package/dist/layout/utils/dimension-calculator.d.ts +59 -0
- package/dist/layout/utils/dimension-calculator.d.ts.map +1 -0
- package/dist/layout/utils/flex-distributor.d.ts +18 -0
- package/dist/layout/utils/flex-distributor.d.ts.map +1 -0
- package/dist/layout/utils/size-resolver.d.ts +84 -0
- package/dist/layout/utils/size-resolver.d.ts.map +1 -0
- package/dist/layout/utils/spacing-calculator.d.ts +27 -0
- package/dist/layout/utils/spacing-calculator.d.ts.map +1 -0
- package/dist/memo.d.ts +29 -0
- package/dist/memo.d.ts.map +1 -0
- package/dist/portal/index.d.ts +6 -0
- package/dist/portal/index.d.ts.map +1 -0
- package/dist/portal/portal-registry.d.ts +97 -0
- package/dist/portal/portal-registry.d.ts.map +1 -0
- package/dist/portal/portal-types.d.ts +20 -0
- package/dist/portal/portal-types.d.ts.map +1 -0
- package/dist/render-context.d.ts +118 -0
- package/dist/render-context.d.ts.map +1 -0
- package/dist/scripts/generate-icon-loaders.d.ts +2 -0
- package/dist/scripts/generate-icon-loaders.d.ts.map +1 -0
- package/dist/scripts/generate-icon-loaders.js +195 -0
- package/dist/scripts/generate-icon-types.d.ts +2 -0
- package/dist/scripts/generate-icon-types.d.ts.map +1 -0
- package/dist/scripts/generate-icon-types.js +124 -0
- package/dist/scripts/generate-icons.d.ts +37 -0
- package/dist/scripts/generate-icons.d.ts.map +1 -0
- package/dist/scripts/generate-icons.js +494 -0
- package/dist/scripts/icon-generator-config.d.ts +87 -0
- package/dist/scripts/icon-generator-config.d.ts.map +1 -0
- package/dist/scripts/icon-generator-config.js +6 -0
- package/dist/theme-base.d.ts +116 -0
- package/dist/theme-base.d.ts.map +1 -0
- package/dist/theme-custom.d.ts +262 -0
- package/dist/theme-custom.d.ts.map +1 -0
- package/dist/theme-defaults.d.ts +6 -0
- package/dist/theme-defaults.d.ts.map +1 -0
- package/dist/theme.d.ts +132 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/tooltip/tooltip-types.d.ts +57 -0
- package/dist/tooltip/tooltip-types.d.ts.map +1 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/KeyboardInputManager.d.ts +48 -0
- package/dist/utils/KeyboardInputManager.d.ts.map +1 -0
- package/dist/utils/dom-input-manager.d.ts +109 -0
- package/dist/utils/dom-input-manager.d.ts.map +1 -0
- package/dist/utils/svg-texture.d.ts +30 -0
- package/dist/utils/svg-texture.d.ts.map +1 -0
- package/dist/utils/texture-registry.d.ts +49 -0
- package/dist/utils/texture-registry.d.ts.map +1 -0
- package/dist/vdom.d.ts +60 -0
- package/dist/vdom.d.ts.map +1 -0
- package/dist/viewport-context.d.ts +39 -0
- package/dist/viewport-context.d.ts.map +1 -0
- package/dist/vite-plugin-icons.d.ts +29 -0
- package/dist/vite-plugin-icons.d.ts.map +1 -0
- package/dist/vite-plugin-icons.js +95 -0
- package/package.json +117 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/fx/use-fx.ts","../src/fx/fx-creators/blur.ts","../src/fx/fx-creators/color-matrix.ts","../src/fx/fx-creators/glow.ts","../src/fx/fx-creators/pixelate.ts","../src/fx/fx-creators/shadow.ts","../src/fx/fx-creators/vignette.ts","../src/fx/fx-registry.ts","../src/fx/convenience-hooks/use-blur.ts","../src/fx/convenience-hooks/use-glow.ts","../src/fx/convenience-hooks/use-shadow.ts","../src/memo.ts","../src/colors/use-color-mode.ts","../src/colors/use-colors.ts","../src/colors/color-theme-helpers.ts","../src/colors/preset-manager.ts","../src/design-tokens/use-theme-tokens.ts","../src/index.ts"],"sourcesContent":["/**\n * Hook for applying Phaser PostFX/PreFX pipeline effects\n * Manages FX lifecycle with proper cleanup\n */\nimport { useEffect, useRef } from '../hooks'\n\n/**\n * Ref object type\n */\ntype RefObject<T> = { current: T | null }\n\n/**\n * FX configuration base type\n */\nexport interface FXConfig {\n intensity?: number\n quality?: number\n onComplete?: () => void\n}\n\n/**\n * FX type discriminator (postFX vs preFX)\n */\nexport type FXType = 'post' | 'pre'\n\n/**\n * GameObject with FX pipeline support\n */\nexport type FXCapableGameObject =\n | Phaser.GameObjects.Image\n | Phaser.GameObjects.Sprite\n | Phaser.GameObjects.Container\n | Phaser.GameObjects.Text\n | Phaser.GameObjects.TileSprite\n | Phaser.GameObjects.NineSlice\n | Phaser.GameObjects.RenderTexture\n | Phaser.GameObjects.Video\n\n/**\n * FX creator function signature\n * @param obj - GameObject with FX pipeline\n * @param config - Effect-specific configuration\n * @param type - 'post' or 'pre' FX pipeline\n * @returns Cleanup function or FX controller (or any Phaser.FX effect)\n */\nexport type FXCreatorFn<TConfig extends FXConfig = FXConfig> = (\n obj: FXCapableGameObject,\n config: TConfig,\n type?: FXType\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => (() => void) | Phaser.FX.Controller | any | null\n\n/**\n * Hook for applying FX to GameObject\n * @param ref - Ref to GameObject\n * @returns Object with applyFX and clearFX methods\n *\n * @example\n * ```tsx\n * const ref = useRef(null)\n * const { applyFX, clearFX } = useFX(ref)\n *\n * const handleClick = () => {\n * applyFX(createShadowFX, { offsetX: 4, offsetY: 4, blur: 8 })\n * }\n *\n * return <View ref={ref} onClick={handleClick}>Click me</View>\n * ```\n */\nexport function useFX<T extends FXCapableGameObject>(ref: RefObject<T>) {\n const activeEffectsRef = useRef<Set<(() => void) | Phaser.FX.Controller>>(new Set())\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n activeEffectsRef.current.forEach((cleanup) => {\n if (typeof cleanup === 'function') {\n cleanup()\n } else if (cleanup?.destroy) {\n cleanup.destroy()\n }\n })\n activeEffectsRef.current.clear()\n }\n }, [])\n\n const applyFX = <TConfig extends FXConfig>(\n fxCreator: FXCreatorFn<TConfig>,\n config: TConfig,\n type: FXType = 'post'\n ) => {\n const obj = ref.current\n if (!obj) {\n console.warn('[useFX] No object found in ref')\n return\n }\n\n const cleanupOrController = fxCreator(obj, config, type)\n if (cleanupOrController) {\n activeEffectsRef.current.add(cleanupOrController)\n }\n }\n\n const clearFX = () => {\n activeEffectsRef.current.forEach((cleanup) => {\n if (typeof cleanup === 'function') {\n cleanup()\n } else if (cleanup?.destroy) {\n cleanup.destroy()\n }\n })\n activeEffectsRef.current.clear()\n\n // Clear FX pipeline\n const obj = ref.current\n if (obj && 'postFX' in obj && obj.postFX) {\n obj.postFX.clear()\n }\n if (obj && 'preFX' in obj && obj.preFX) {\n obj.preFX.clear()\n }\n }\n\n return { applyFX, clearFX }\n}\n","/**\n * Blur FX creator (Box & Gaussian Blur)\n */\nimport type { FXConfig, FXCreatorFn } from '../use-fx'\n\n/**\n * Blur FX configuration\n */\nexport interface BlurFXConfig extends FXConfig {\n /** The quality of the blur effect. Can be either 0 for Low Quality, 1 for Medium Quality or 2 for High Quality */\n quality?: number\n /** The horizontal offset of the blur effect */\n x?: number\n /** The vertical offset of the blur effect */\n y?: number\n /** The strength of the blur effect */\n strength?: number\n /** The color of the blur, as a hex value */\n color?: number\n /** The number of steps to run the blur effect for. This value should always be an integer */\n steps?: number\n}\n\n/**\n * Create blur FX\n * @param obj - GameObject\n * @param config - Blur configuration\n * @param type - 'post' or 'pre' FX\n * @returns Blur controller\n *\n * @example\n * ```tsx\n * applyFX(createBlurFX, {\n * quality: 1,\n * x: 4,\n * y: 4,\n * strength: 2\n * })\n * ```\n */\nexport const createBlurFX: FXCreatorFn<BlurFXConfig> = (obj, config, type = 'post') => {\n const { quality = 0, x = 2, y = 2, strength = 1, color = 0xffffff, steps = 4 } = config\n\n const pipeline = type === 'post' ? obj.postFX : obj.preFX\n if (!pipeline) {\n console.warn('[createBlurFX] FX pipeline not available on this GameObject')\n return null\n }\n\n // Phaser API: addBlur(quality, x, y, strength, color, steps)\n const blur = pipeline.addBlur(quality, x, y, strength, color, steps)\n\n return blur\n}\n","/**\n * Color Matrix FX creator (Grayscale, Sepia, Negative, etc.)\n */\nimport type { FXConfig, FXCreatorFn } from '../use-fx'\n\n/**\n * Color Matrix effect types\n */\nexport type ColorMatrixEffect =\n | 'grayscale'\n | 'sepia'\n | 'negative'\n | 'blackWhite'\n | 'brown'\n | 'kodachrome'\n | 'technicolor'\n | 'polaroid'\n\n/**\n * Color Matrix FX configuration\n */\nexport interface ColorMatrixFXConfig extends FXConfig {\n /** Effect type */\n effect?: ColorMatrixEffect\n /** Effect amount (0-1, for effects that support it like grayscale) */\n amount?: number\n}\n\n/**\n * Create color matrix FX\n * @param obj - GameObject\n * @param config - Color matrix configuration\n * @param type - 'post' or 'pre' FX\n * @returns Color matrix controller\n *\n * @example\n * ```tsx\n * applyFX(createColorMatrixFX, {\n * effect: 'grayscale',\n * amount: 1\n * })\n * ```\n */\nexport const createColorMatrixFX: FXCreatorFn<ColorMatrixFXConfig> = (\n obj,\n config,\n type = 'post'\n) => {\n const { effect = 'grayscale', amount = 1 } = config\n\n const pipeline = type === 'post' ? obj.postFX : obj.preFX\n if (!pipeline) {\n console.warn('[createColorMatrixFX] FX pipeline not available on this GameObject')\n return null\n }\n\n const colorMatrix = pipeline.addColorMatrix()\n\n // Apply the selected effect\n switch (effect) {\n case 'grayscale':\n colorMatrix.grayscale(amount)\n break\n case 'sepia':\n colorMatrix.sepia()\n break\n case 'negative':\n colorMatrix.negative()\n break\n case 'blackWhite':\n colorMatrix.blackWhite()\n break\n case 'brown':\n colorMatrix.brown()\n break\n case 'kodachrome':\n colorMatrix.kodachrome()\n break\n case 'technicolor':\n colorMatrix.technicolor()\n break\n case 'polaroid':\n colorMatrix.polaroid()\n break\n }\n\n return colorMatrix\n}\n","/**\n * Glow FX creator (Outer Glow)\n */\nimport type { FXConfig, FXCreatorFn } from '../use-fx'\n\n/**\n * Glow FX configuration\n */\nexport interface GlowFXConfig extends FXConfig {\n /** Glow color (hex number) */\n color?: number\n /** The strength of the glow outward from the edge */\n outerStrength?: number\n /** The strength of the glow inward from the edge */\n innerStrength?: number\n /** If true, only the glow is drawn, not the texture itself */\n knockout?: boolean\n /** Sets the quality of this Glow effect (PostFX only, cannot be changed post-creation) */\n quality?: number\n /** Sets the distance of this Glow effect (PostFX only, cannot be changed post-creation) */\n distance?: number\n}\n\n/**\n * Create glow FX\n * @param obj - GameObject\n * @param config - Glow configuration\n * @param type - 'post' or 'pre' FX\n * @returns Glow controller\n *\n * @example\n * ```tsx\n * applyFX(createGlowFX, {\n * color: 0xff6600,\n * outerStrength: 6,\n * innerStrength: 2\n * })\n * ```\n */\nexport const createGlowFX: FXCreatorFn<GlowFXConfig> = (obj, config, type = 'post') => {\n const {\n color = 0xffffff,\n outerStrength = 4,\n innerStrength = 0,\n knockout = false,\n quality = 0.1,\n distance = 10,\n } = config\n\n const pipeline = type === 'post' ? obj.postFX : obj.preFX\n if (!pipeline) {\n console.warn('[createGlowFX] FX pipeline not available on this GameObject')\n return null\n }\n\n // Phaser API: addGlow(color, outerStrength, innerStrength, knockout, quality, distance)\n const glow = pipeline.addGlow(color, outerStrength, innerStrength, knockout, quality, distance)\n\n return glow\n}\n","/**\n * Pixelate FX creator\n */\nimport type { FXConfig, FXCreatorFn } from '../use-fx'\n\n/**\n * Pixelate FX configuration\n */\nexport interface PixelateFXConfig extends FXConfig {\n /** The amount of pixelation to apply */\n amount?: number\n}\n\n/**\n * Create pixelate FX\n * @param obj - GameObject\n * @param config - Pixelate configuration\n * @param type - 'post' or 'pre' FX\n * @returns Pixelate controller\n *\n * @example\n * ```tsx\n * applyFX(createPixelateFX, {\n * amount: 8\n * })\n * ```\n */\nexport const createPixelateFX: FXCreatorFn<PixelateFXConfig> = (obj, config, type = 'post') => {\n const { amount = 1 } = config\n\n const pipeline = type === 'post' ? obj.postFX : obj.preFX\n if (!pipeline) {\n console.warn('[createPixelateFX] FX pipeline not available on this GameObject')\n return null\n }\n\n // Phaser API: addPixelate(amount)\n const pixelate = pipeline.addPixelate(amount)\n\n return pixelate\n}\n","/**\n * Shadow FX creator\n *\n * The shadow effect creates the illusion of depth by adding darker, offset silhouettes\n * beneath game objects, enhancing visual appeal and immersion.\n */\nimport type { FXConfig, FXCreatorFn } from '../use-fx'\n\n/**\n * Shadow FX configuration\n * Maps to Phaser's addShadow(x, y, decay, power, color, samples, intensity)\n */\nexport interface ShadowFXConfig extends FXConfig {\n /** Horizontal offset of the shadow effect (default: 0) */\n x?: number\n /** Vertical offset of the shadow effect (default: 0) */\n y?: number\n /** Amount of decay for shadow effect (default: 0.1) */\n decay?: number\n /** Power of the shadow effect (default: 1) */\n power?: number\n /** Color of the shadow (default: 0x000000) */\n color?: number\n /** Number of samples (1-12, higher = better quality, default: 6) */\n samples?: number\n /** Intensity of the shadow effect (default: 1) */\n intensity?: number\n}\n\n/**\n * Create shadow FX\n * @param obj - GameObject\n * @param config - Shadow configuration\n * @param type - 'post' or 'pre' FX\n * @returns Shadow controller\n *\n * @example\n * ```tsx\n * applyFX(createShadowFX, {\n * x: 0,\n * y: 0,\n * decay: 0.1,\n * power: 1,\n * color: 0x000000,\n * samples: 6,\n * intensity: 1\n * })\n * ```\n */\nexport const createShadowFX: FXCreatorFn<ShadowFXConfig> = (obj, config, type = 'post') => {\n const {\n x = 0,\n y = 1,\n decay = 0.05,\n power = 1,\n color = 0x000000,\n samples = 6,\n intensity = 1,\n } = config\n\n const pipeline = type === 'post' ? obj.postFX : obj.preFX\n if (!pipeline) {\n console.warn('[createShadowFX] FX pipeline not available on this GameObject')\n return null\n }\n\n // Phaser API: addShadow(x, y, decay, power, color, samples, intensity)\n const shadow = pipeline.addShadow(x, y, decay, power, color, samples, intensity)\n\n return shadow\n}\n","/**\n * Vignette FX creator\n */\nimport type { FXConfig, FXCreatorFn } from '../use-fx'\n\n/**\n * Vignette FX configuration\n */\nexport interface VignetteFXConfig extends FXConfig {\n /** The horizontal offset of the vignette effect. This value is normalized to the range 0 to 1 */\n x?: number\n /** The vertical offset of the vignette effect. This value is normalized to the range 0 to 1 */\n y?: number\n /** The radius of the vignette effect. This value is normalized to the range 0 to 1 */\n radius?: number\n /** The strength of the vignette effect */\n strength?: number\n}\n\n/**\n * Create vignette FX\n * @param obj - GameObject\n * @param config - Vignette configuration\n * @param type - 'post' or 'pre' FX\n * @returns Vignette controller\n *\n * @example\n * ```tsx\n * applyFX(createVignetteFX, {\n * x: 0.5,\n * y: 0.5,\n * radius: 0.5,\n * strength: 0.7\n * })\n * ```\n */\nexport const createVignetteFX: FXCreatorFn<VignetteFXConfig> = (obj, config, type = 'post') => {\n const { strength = 0.5, radius = 0.5, x = 0.5, y = 0.5 } = config\n\n const pipeline = type === 'post' ? obj.postFX : obj.preFX\n if (!pipeline) {\n console.warn('[createVignetteFX] FX pipeline not available on this GameObject')\n return null\n }\n\n // Phaser Vignette: addVignette(x, y, radius, strength)\n const vignette = pipeline.addVignette(x, y, radius, strength)\n\n return vignette\n}\n","/**\n * FX Registry - string-based FX lookup\n * Similar to effect-registry.ts for animation effects\n */\nimport {\n createBlurFX,\n createColorMatrixFX,\n createGlowFX,\n createPixelateFX,\n createShadowFX,\n createVignetteFX,\n type BlurFXConfig,\n type ColorMatrixFXConfig,\n type GlowFXConfig,\n type PixelateFXConfig,\n type ShadowFXConfig,\n type VignetteFXConfig,\n} from './fx-creators'\nimport type { FXConfig, FXCreatorFn } from './use-fx'\n\n/**\n * Built-in FX names\n */\nexport type BuiltInFXName =\n | 'shadow'\n | 'glow'\n | 'blur'\n | 'pixelate'\n | 'vignette'\n | 'grayscale'\n | 'sepia'\n | 'negative'\n | 'blackWhite'\n | 'brown'\n | 'kodachrome'\n | 'technicolor'\n | 'polaroid'\n\n/**\n * Extension point for custom FX (declaration merging)\n * @example\n * ```typescript\n * declare module '@number10/phaserjsx/fx' {\n * interface FXNameExtensions {\n * myCustomFX: 'myCustomFX'\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface FXNameExtensions {}\n\n/**\n * All available FX names (built-in + extensions)\n */\nexport type FXName =\n | BuiltInFXName\n | (keyof FXNameExtensions extends never ? never : keyof FXNameExtensions)\n\n/**\n * FX definition with name and config\n */\nexport interface FXDefinition {\n name: FXName\n config?: FXConfig\n}\n\n/**\n * FX Registry mapping names to creator functions\n */\nexport const FX_REGISTRY: Record<BuiltInFXName, FXCreatorFn> = {\n shadow: createShadowFX,\n glow: createGlowFX,\n blur: createBlurFX,\n pixelate: createPixelateFX,\n vignette: createVignetteFX,\n grayscale: (obj, config, type) =>\n createColorMatrixFX(obj, { ...config, effect: 'grayscale' }, type),\n sepia: (obj, config, type) => createColorMatrixFX(obj, { ...config, effect: 'sepia' }, type),\n negative: (obj, config, type) =>\n createColorMatrixFX(obj, { ...config, effect: 'negative' }, type),\n blackWhite: (obj, config, type) =>\n createColorMatrixFX(obj, { ...config, effect: 'blackWhite' }, type),\n brown: (obj, config, type) => createColorMatrixFX(obj, { ...config, effect: 'brown' }, type),\n kodachrome: (obj, config, type) =>\n createColorMatrixFX(obj, { ...config, effect: 'kodachrome' }, type),\n technicolor: (obj, config, type) =>\n createColorMatrixFX(obj, { ...config, effect: 'technicolor' }, type),\n polaroid: (obj, config, type) =>\n createColorMatrixFX(obj, { ...config, effect: 'polaroid' }, type),\n}\n\n/**\n * Default FX (none)\n */\nexport const DEFAULT_FX: FXName = 'grayscale'\n\n/**\n * Resolve FX by name or function\n * @param fxOrName - FX name string or creator function\n * @returns FX creator function or null\n */\nexport function resolveFX(fxOrName: FXName | FXCreatorFn): FXCreatorFn | null {\n if (typeof fxOrName === 'function') {\n return fxOrName\n }\n return FX_REGISTRY[fxOrName as BuiltInFXName] ?? null\n}\n\n/**\n * Apply FX by name (helper function)\n * @param applyFXFn - applyFX function from useFX hook\n * @param fxName - FX name\n * @param config - FX config\n *\n * @example\n * ```tsx\n * const { applyFX } = useFX(ref)\n * applyFXByName(applyFX, 'shadow', { offsetX: 4, offsetY: 4, blur: 8 })\n * ```\n */\nexport function applyFXByName(\n applyFXFn: ReturnType<typeof import('./use-fx').useFX>['applyFX'],\n fxName: FXName,\n config: FXConfig = {}\n) {\n const creator = resolveFX(fxName)\n if (creator) {\n applyFXFn(creator, config)\n } else {\n console.warn(`[applyFXByName] FX \"${fxName}\" not found in registry`)\n }\n}\n\n// Re-export config types for convenience\nexport type {\n BlurFXConfig,\n ColorMatrixFXConfig,\n GlowFXConfig,\n PixelateFXConfig,\n ShadowFXConfig,\n VignetteFXConfig,\n}\n","/**\n * Convenience hook for automatic blur FX\n * Applies blur on mount and updates on config changes\n */\nimport { useEffect } from '../../hooks'\nimport { createBlurFX, type BlurFXConfig } from '../fx-creators/blur'\nimport { useFX } from '../use-fx'\n\n/**\n * Hook for automatic blur FX\n * @param ref - GameObject ref\n * @param config - Blur config (updates reactively)\n * @returns FX controls\n *\n * @example\n * ```tsx\n * const ref = useRef(null)\n * useBlur(ref, { strength: 8, steps: 4 })\n *\n * return <View ref={ref}>Content</View>\n * ```\n */\nexport function useBlur(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: { current: any },\n config: BlurFXConfig = {}\n): { clearFX: () => void } {\n const { applyFX, clearFX } = useFX(ref)\n\n useEffect(() => {\n if (!ref.current) return\n\n // Clear previous FX\n clearFX()\n\n // Apply new blur\n applyFX(createBlurFX, config)\n\n return () => clearFX()\n }, [ref, config, applyFX, clearFX])\n\n return { clearFX }\n}\n","/**\n * Convenience hook for automatic glow FX\n * Applies glow on mount and updates on config changes\n */\nimport { useEffect } from '../../hooks'\nimport { createGlowFX, type GlowFXConfig } from '../fx-creators/glow'\nimport { useFX } from '../use-fx'\n\n/**\n * Hook for automatic glow FX\n * @param ref - GameObject ref\n * @param config - Glow config (updates reactively)\n * @returns FX controls\n *\n * @example\n * ```tsx\n * const ref = useRef(null)\n * useGlow(ref, { color: 0xff6600, outerStrength: 6, innerStrength: 2 })\n *\n * return <View ref={ref}>Content</View>\n * ```\n */\nexport function useGlow(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: { current: any },\n config: GlowFXConfig = {}\n): { clearFX: () => void } {\n const { applyFX, clearFX } = useFX(ref)\n\n useEffect(() => {\n if (!ref.current) return\n\n // Clear previous FX\n clearFX()\n\n // Apply new glow\n applyFX(createGlowFX, config)\n\n return () => clearFX()\n }, [ref, config, applyFX, clearFX])\n\n return { clearFX }\n}\n","/**\n * Convenience hook for automatic shadow FX\n * Applies shadow on mount and updates on config changes\n */\nimport { useEffect } from '../../hooks'\nimport { createShadowFX, type ShadowFXConfig } from '../fx-creators/shadow'\nimport { useFX } from '../use-fx'\n\n/**\n * Hook for automatic shadow FX\n * @param ref - GameObject ref\n * @param config - Shadow config (updates reactively)\n * @returns FX controls\n *\n * @example\n * ```tsx\n * const ref = useRef(null)\n * useShadow(ref, { x: 4, y: 4, decay: 0.1 })\n *\n * return <View ref={ref}>Content</View>\n * ```\n */\nexport function useShadow(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: { current: any },\n config: ShadowFXConfig = {}\n): { clearFX: () => void } {\n const { applyFX, clearFX } = useFX(ref)\n\n useEffect(() => {\n if (!ref.current) return\n\n // Clear previous FX\n clearFX()\n\n // Apply new shadow\n applyFX(createShadowFX, config)\n\n return () => clearFX()\n }, [ref, config, applyFX, clearFX])\n\n return { clearFX }\n}\n","/**\n * Component memoization utilities\n * Similar to React.memo() - prevents re-renders when props haven't changed\n */\nimport type { VNode } from './hooks'\n\n/**\n * Safely sets __memo on a VNode, handling frozen/sealed objects from bundlers\n * @param vnode - VNode to set __memo on\n * @param value - Memoization value\n * @returns Original VNode if extensible, or shallow copy with __memo\n */\nfunction setMemoSafe<T extends VNode>(vnode: T, value: boolean): T {\n if (Object.isExtensible(vnode)) {\n vnode.__memo = value\n return vnode\n }\n // VNode is frozen - create shallow copy\n return { ...vnode, __memo: value } as T\n}\n\n/**\n * Marks a component to skip memoization (always re-render on prop changes)\n * Use when component has side effects or needs to re-render every time\n *\n * @example\n * ```tsx\n * function AlwaysUpdate({ value }) {\n * console.log('Rendering with:', value)\n * return <Text text={value} />\n * }\n *\n * // Disable memoization\n * <AlwaysUpdate value={counter} __memo={false} />\n * ```\n *\n * @param vnode - VNode to mark\n * @returns Same VNode with memoization disabled (may be a copy if frozen)\n */\nexport function noMemo<T extends VNode>(vnode: T): T {\n return setMemoSafe(vnode, false)\n}\n\n/**\n * Explicitly enable memoization for a component (default behavior)\n * This is the default - you don't need to call this unless you want to be explicit\n *\n * @param vnode - VNode to mark\n * @returns Same VNode with memoization enabled (may be a copy if frozen)\n */\nexport function memo<T extends VNode>(vnode: T): T {\n return setMemoSafe(vnode, true)\n}\n","/**\n * Color mode management for dynamic theme switching\n */\nimport { useEffect, useState } from '../hooks'\nimport { themeRegistry } from '../theme'\n\n/**\n * Hook to manage color mode (light/dark) dynamically\n * @returns Object with current mode, toggle function, and setter\n * @example\n * ```typescript\n * function ThemeToggle() {\n * const { colorMode, toggleColorMode } = useColorMode()\n *\n * return (\n * <Button onClick={toggleColorMode}>\n * {colorMode === 'light' ? 'Dark' : 'Light'} Mode\n * </Button>\n * )\n * }\n * ```\n */\nexport function useColorMode(): {\n colorMode: 'light' | 'dark'\n setColorMode: (mode: 'light' | 'dark') => void\n toggleColorMode: () => void\n} {\n const [colorMode, setColorModeState] = useState<'light' | 'dark'>(themeRegistry.getColorMode())\n\n useEffect(() => {\n // Subscribe to theme registry changes\n const unsubscribe = themeRegistry.subscribe(() => {\n setColorModeState(themeRegistry.getColorMode())\n })\n\n return unsubscribe\n }, [])\n\n const setColorMode = (mode: 'light' | 'dark') => {\n themeRegistry.setColorMode(mode)\n }\n\n const toggleColorMode = () => {\n const newMode = colorMode === 'light' ? 'dark' : 'light'\n setColorMode(newMode)\n }\n\n return {\n colorMode,\n setColorMode,\n toggleColorMode,\n }\n}\n","/**\n * Color system hooks for component usage\n */\nimport { useEffect, useState, useTheme } from '../hooks'\nimport { themeRegistry } from '../theme'\nimport { getPresetWithMode } from './color-presets'\nimport type { ColorTokens } from './color-types'\n\n/**\n * Hook to access color tokens from theme context\n * Automatically updates when color mode or preset changes\n * @returns Current ColorTokens or undefined\n * @deprecated Use `useThemeTokens()` instead for access to colors, text styles, spacing, and more\n * @example\n * ```typescript\n * // Old way (deprecated):\n * const colors = useColors()\n *\n * // New way:\n * const tokens = useThemeTokens()\n * const colors = tokens?.colors\n *\n * // Access text styles, spacing, etc.:\n * <Text style={tokens.textStyles.DEFAULT} />\n * <View padding={tokens.spacing.lg} />\n * ```\n */\nexport function useColors(): ColorTokens | undefined {\n const localTheme = useTheme()\n\n // Initialize colors state\n const getInitialColors = (): ColorTokens | undefined => {\n // Check if local theme has color preset info\n if (localTheme?.__colorPreset) {\n const preset = getPresetWithMode(\n localTheme.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n localTheme.__colorPreset.mode ?? 'light'\n )\n return preset.colors\n }\n\n // Fall back to global color tokens\n return themeRegistry.getColorTokens()\n }\n\n const [colors, setColors] = useState<ColorTokens | undefined>(getInitialColors())\n const [, forceUpdate] = useState(0)\n\n useEffect(() => {\n // Subscribe to theme changes (mode/preset switches)\n const unsubscribe = themeRegistry.subscribe(() => {\n // Check if local theme has preset\n if (localTheme?.__colorPreset) {\n const currentMode = themeRegistry.getColorMode()\n const preset = getPresetWithMode(\n localTheme.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n currentMode\n )\n setColors(preset.colors)\n } else {\n // Use global tokens\n setColors(themeRegistry.getColorTokens())\n }\n // Force re-render when theme changes\n forceUpdate((n) => n + 1)\n })\n\n return unsubscribe\n }, [localTheme])\n\n return colors\n}\n\n/**\n * Hook to subscribe to theme changes without accessing colors\n * Use this in parent components that don't need colors themselves\n * but want to ensure children re-render when theme changes\n *\n * Note: Since useColors() now triggers re-renders automatically,\n * this hook is mainly useful if you don't need the colors themselves\n * but still want to react to theme changes.\n *\n * @example\n * ```typescript\n * function ParentComponent() {\n * useThemeSubscription() // Children will re-render on theme changes\n * return <ChildThatUsesColors />\n * }\n * ```\n */\nexport function useThemeSubscription(): void {\n const [, forceUpdate] = useState(0)\n\n useEffect(() => {\n const unsubscribe = themeRegistry.subscribe(() => {\n forceUpdate((n) => n + 1)\n })\n return unsubscribe\n }, [])\n}\n","/**\n * Helper functions for color system integration with theme\n */\nimport type { ColorTokens } from './color-types'\nimport { alpha } from './color-utils'\n\n/**\n * Convert ColorTokens to a theme-compatible object\n * Maps semantic color names to Phaser number format for View/Button components\n * @param colors - ColorTokens to convert\n * @returns Object with backgroundColor, borderColor, etc.\n * @example\n * ```typescript\n * const colors = getPreset('oceanBlue').colors\n * const buttonTheme = {\n * ...colorsToTheme(colors, 'primary'),\n * padding: 8,\n * }\n * // Returns: { backgroundColor: 0x2196f3, borderColor: 0x... }\n * ```\n */\nexport function colorsToTheme(\n colors: ColorTokens,\n colorKey: keyof Pick<\n ColorTokens,\n 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'error' | 'info'\n >,\n options: {\n /** Which shade to use for background (default: 'DEFAULT') */\n backgroundShade?: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT'\n /** Which shade to use for border (default: 'dark') */\n borderShade?: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT'\n /** Include border color (default: true) */\n includeBorder?: boolean\n } = {}\n): {\n backgroundColor: number\n borderColor?: number\n} {\n const { backgroundShade = 'DEFAULT', borderShade = 'dark', includeBorder = true } = options\n\n const result: { backgroundColor: number; borderColor?: number } = {\n backgroundColor: colors[colorKey][backgroundShade].toNumber(),\n }\n\n if (includeBorder) {\n result.borderColor = colors[colorKey][borderShade].toNumber()\n }\n\n return result\n}\n\n/**\n * Get text color from ColorTokens as hex string for Phaser Text style\n * @param colors - ColorTokens to use\n * @param shade - Which text shade to use (default: 'DEFAULT')\n * @param alphaValue - Optional alpha value (0-1)\n * @returns Hex string or rgba string for Text style\n * @example\n * ```typescript\n * const colors = getPreset('oceanBlue').colors\n * const textStyle = {\n * color: getTextColor(colors),\n * fontSize: '18px'\n * }\n * ```\n */\nexport function getTextColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT',\n alphaValue?: number\n): string {\n const color = colors.text[shade]\n return alphaValue !== undefined ? alpha(color.toNumber(), alphaValue) : color.toString()\n}\n\n/**\n * Get background color from ColorTokens\n * @param colors - ColorTokens to use\n * @param shade - Which shade to use (default: 'DEFAULT')\n * @returns Phaser color number\n */\nexport function getBackgroundColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT'\n): number {\n return colors.background[shade].toNumber()\n}\n\n/**\n * Get surface color from ColorTokens\n * @param colors - ColorTokens to use\n * @param shade - Which shade to use (default: 'DEFAULT')\n * @returns Phaser color number\n */\nexport function getSurfaceColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT'\n): number {\n return colors.surface[shade].toNumber()\n}\n\n/**\n * Get border color from ColorTokens\n * @param colors - ColorTokens to use\n * @param shade - Which shade to use (default: 'DEFAULT')\n * @returns Phaser color number\n */\nexport function getBorderColor(\n colors: ColorTokens,\n shade: 'lightest' | 'light' | 'medium' | 'dark' | 'darkest' | 'DEFAULT' = 'DEFAULT'\n): number {\n return colors.border[shade].toNumber()\n}\n","/**\n * Dynamic color preset management\n */\nimport { themeRegistry } from '../theme'\nimport type { PresetName } from './color-presets'\nimport { getPresetWithMode } from './color-presets'\n\n// Subscribe to mode changes to update color tokens\nthemeRegistry.subscribe(() => {\n updateColorTokensForMode()\n})\n\n/**\n * Set the active color preset globally\n * Applies the preset with the current color mode and updates all components\n * @param presetName - Name of the preset to apply\n * @example\n * ```typescript\n * // Switch to forest green theme\n * setColorPreset('forestGreen')\n *\n * // Current mode (light/dark) is preserved\n * ```\n */\nexport function setColorPreset(presetName: PresetName): void {\n const currentMode = themeRegistry.getColorMode()\n const preset = getPresetWithMode(presetName, currentMode)\n\n // Update color tokens\n themeRegistry.setColorTokens(preset.colors)\n themeRegistry.setCurrentPresetName(presetName)\n}\n\n/**\n * Update color tokens based on current preset and mode\n * Called internally when color mode changes\n * @internal\n */\nexport function updateColorTokensForMode(): void {\n const presetName = themeRegistry.getCurrentPresetName()\n if (presetName) {\n const currentMode = themeRegistry.getColorMode()\n const preset = getPresetWithMode(presetName as PresetName, currentMode)\n themeRegistry.setColorTokens(preset.colors)\n }\n}\n\n/**\n * Get the currently active preset name\n * @returns Current preset name or undefined\n */\nexport function getCurrentPreset(): string | undefined {\n return themeRegistry.getCurrentPresetName()\n}\n\n/**\n * Get all available preset names\n * @returns Array of preset names\n * @example\n * ```typescript\n * const presets = getAvailablePresets() // ['oceanBlue', 'forestGreen', 'midnight']\n * ```\n */\nexport function getAvailablePresets(): PresetName[] {\n return ['oceanBlue', 'forestGreen', 'midnight']\n}\n","/**\n * Hook to access complete design token system\n * Combines colors with text styles, spacing, sizes, and radius tokens\n */\nimport { getPresetWithMode } from '../colors/color-presets'\nimport { useEffect, useState, useTheme } from '../hooks'\nimport { themeRegistry } from '../theme'\nimport {\n createTextStyleTokens,\n defaultRadiusTokens,\n defaultSizeTokens,\n defaultSpacingTokens,\n} from './design-token-presets'\nimport type { DesignTokens } from './design-token-types'\n\n/**\n * Hook to access complete design token system from theme context\n * Provides colors, text styles, spacing, sizes, and radius tokens\n * Automatically updates when color mode or preset changes\n * @returns Current DesignTokens or undefined\n * @example\n * ```typescript\n * function MyComponent() {\n * const tokens = useThemeTokens()\n *\n * if (!tokens) return null\n *\n * return (\n * <View\n * backgroundColor={tokens.colors.surface.DEFAULT}\n * padding={tokens.spacing.lg}\n * cornerRadius={tokens.radius.md}\n * >\n * <Text text=\"Title\" style={tokens.textStyles.title} />\n * <Text text=\"Body text\" style={tokens.textStyles.DEFAULT} />\n * </View>\n * )\n * }\n * ```\n */\nexport function useThemeTokens(): DesignTokens | undefined {\n const localTheme = useTheme()\n\n // Initialize design tokens state\n const getInitialTokens = (): DesignTokens | undefined => {\n // Check if local theme has color preset info\n if (localTheme?.__colorPreset) {\n const preset = getPresetWithMode(\n localTheme.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n localTheme.__colorPreset.mode ?? 'light'\n )\n return {\n colors: preset.colors,\n textStyles: createTextStyleTokens(preset.colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n }\n }\n\n // Fall back to global tokens\n const colors = themeRegistry.getColorTokens()\n if (!colors) return undefined\n\n return {\n colors,\n textStyles: createTextStyleTokens(colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n }\n }\n\n const [tokens, setTokens] = useState<DesignTokens | undefined>(getInitialTokens())\n const [, forceUpdate] = useState(0)\n\n useEffect(() => {\n // Subscribe to theme changes (mode/preset switches)\n const unsubscribe = themeRegistry.subscribe(() => {\n // Check if local theme has preset\n if (localTheme?.__colorPreset) {\n const currentMode = themeRegistry.getColorMode()\n const preset = getPresetWithMode(\n localTheme.__colorPreset.name as Parameters<typeof getPresetWithMode>[0],\n currentMode\n )\n setTokens({\n colors: preset.colors,\n textStyles: createTextStyleTokens(preset.colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n })\n } else {\n // Use global tokens\n const colors = themeRegistry.getColorTokens()\n if (colors) {\n setTokens({\n colors,\n textStyles: createTextStyleTokens(colors.text.DEFAULT.toString()),\n spacing: defaultSpacingTokens,\n sizes: defaultSizeTokens,\n radius: defaultRadiusTokens,\n })\n }\n }\n // Force re-render when theme changes\n forceUpdate((n) => n + 1)\n })\n\n return unsubscribe\n }, [localTheme])\n\n return tokens\n}\n","/**\n * PhaserJSX UI Library\n * Provides JSX + hooks + VDOM for Phaser 3 game development\n */\nimport { registerBuiltins } from './components'\nimport './jsx-types' // Import JSX type declarations\n\n// Register built-in components (View, Text) on module load\nregisterBuiltins()\n\nexport * from './core-types'\nexport * from './effects'\nexport * from './fx'\nexport * from './hooks'\nexport * from './hooks-svg'\nexport * from './host'\nexport * from './memo'\nexport * from './theme'\nexport * from './types'\nexport * from './vdom'\n\n// Export core prop utilities\nexport {\n normalizeCornerRadius,\n normalizeEdgeInsets,\n normalizeGap,\n type CornerRadiusInsets,\n type EdgeInsets,\n type GapInsets,\n} from './core-props'\n\n// Export gesture types explicitly for better IDE support\nexport type {\n Display,\n FlexBasisValue,\n FocusEventData,\n GestureEventData,\n GestureProps,\n InputEventData,\n KeyboardEventData,\n SizeValue,\n TouchMoveState,\n} from './core-props'\n\n// Export DOM input manager utility\nexport { DOMInputElement, type DOMInputConfig } from './utils/dom-input-manager'\nexport { KeyboardInputManager, type KeyboardInputManagerConfig } from './utils/KeyboardInputManager'\n\n// Explicit export for convenience functions\nexport { mountJSX as mountComponent, type MountComponentProps, type MountProps } from './vdom'\n\n// Re-export component creators/patchers for advanced usage\nexport * from './components'\n\n// Re-export custom components for convenience\nexport * from './components/custom'\n\n// Re-export portal system\nexport * from './portal'\n\n// Animation utilities for spring-based transitions\nexport * from './animation'\n\n// Explicitly export AnimationConfig for component themes\nexport type { AnimationConfig } from './animation/spring-physics'\n\n// Color system utilities and presets\nexport * from './colors'\n\n// Design token system - semantic tokens for colors, text styles, spacing, etc.\nexport * from './design-tokens'\n\n// Tooltip system - onTooltip property types\nexport type {\n TooltipCallback,\n TooltipConfig,\n TooltipNativeAnimation,\n TooltipPosition,\n} from './tooltip/tooltip-types'\n\n// Viewport context - provides screen dimensions for vw/vh units\nexport { viewportRegistry, type ViewportSize } from './viewport-context'\n\n// Render context - isolates global state per mount point (advanced usage)\nexport { getRenderContext, type RenderContext } from './render-context'\n\n/**\n * Consumers can import JSX runtime from here:\n * import { jsx, jsxs, Fragment } from \"@number10/phaserjsx/jsx-runtime\";\n */\nexport { Fragment, jsx, jsxs } from './jsx-runtime'\n\n// Development configuration and debugging utilities\nexport { DebugLogger, DevConfig, DevPresets } from './dev-config'\n\n// SVG to texture utilities\nexport type { SVGTextureConfig } from './hooks-svg'\nexport { svgToTexture } from './utils/svg-texture'\n"],"names":["n"],"mappings":";;;;AAqEO,SAAS,MAAqC,KAAmB;AACtE,QAAM,mBAAmB,OAAiD,oBAAI,KAAK;AAGnF,YAAU,MAAM;AACd,WAAO,MAAM;AACX,uBAAiB,QAAQ,QAAQ,CAAC,YAAY;AAC5C,YAAI,OAAO,YAAY,YAAY;AACjC,kBAAA;AAAA,QACF,WAAW,SAAS,SAAS;AAC3B,kBAAQ,QAAA;AAAA,QACV;AAAA,MACF,CAAC;AACD,uBAAiB,QAAQ,MAAA;AAAA,IAC3B;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAM,UAAU,CACd,WACA,QACA,OAAe,WACZ;AACH,UAAM,MAAM,IAAI;AAChB,QAAI,CAAC,KAAK;AACR,cAAQ,KAAK,gCAAgC;AAC7C;AAAA,IACF;AAEA,UAAM,sBAAsB,UAAU,KAAK,QAAQ,IAAI;AACvD,QAAI,qBAAqB;AACvB,uBAAiB,QAAQ,IAAI,mBAAmB;AAAA,IAClD;AAAA,EACF;AAEA,QAAM,UAAU,MAAM;AACpB,qBAAiB,QAAQ,QAAQ,CAAC,YAAY;AAC5C,UAAI,OAAO,YAAY,YAAY;AACjC,gBAAA;AAAA,MACF,WAAW,SAAS,SAAS;AAC3B,gBAAQ,QAAA;AAAA,MACV;AAAA,IACF,CAAC;AACD,qBAAiB,QAAQ,MAAA;AAGzB,UAAM,MAAM,IAAI;AAChB,QAAI,OAAO,YAAY,OAAO,IAAI,QAAQ;AACxC,UAAI,OAAO,MAAA;AAAA,IACb;AACA,QAAI,OAAO,WAAW,OAAO,IAAI,OAAO;AACtC,UAAI,MAAM,MAAA;AAAA,IACZ;AAAA,EACF;AAEA,SAAO,EAAE,SAAS,QAAA;AACpB;ACpFO,MAAM,eAA0C,CAAC,KAAK,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AA,IAC1B,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AACT;AC1GA,iBAAA;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("./jsx-runtime.cjs");
|
|
4
|
+
const jsx = jsxRuntime.jsx;
|
|
5
|
+
const jsxDEV = jsxRuntime.jsx;
|
|
6
|
+
exports.Fragment = jsxRuntime.Fragment;
|
|
7
|
+
exports.jsxs = jsxRuntime.jsxs;
|
|
8
|
+
exports.jsx = jsx;
|
|
9
|
+
exports.jsxDEV = jsxDEV;
|
|
10
|
+
//# sourceMappingURL=jsx-dev-runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.cjs","sources":["../src/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime (re-exports jsx-runtime for development mode)\n */\nimport { jsx as jsxProd } from './jsx-runtime'\n\nexport { Fragment, jsxs } from './jsx-runtime'\nexport const jsx = jsxProd\nexport const jsxDEV = jsxProd\n"],"names":["jsxProd"],"mappings":";;;AAMO,MAAM,MAAMA,WAAAA;AACZ,MAAM,SAASA,WAAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC9C,eAAO,MAAM,GAAG,gBAAU,CAAA;AAC1B,eAAO,MAAM,MAAM,gBAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime (re-exports jsx-runtime for development mode)\n */\nimport { jsx as jsxProd } from './jsx-runtime'\n\nexport { Fragment, jsxs } from './jsx-runtime'\nexport const jsx = jsxProd\nexport const jsxDEV = jsxProd\n"],"names":["jsxProd"],"mappings":";;AAMO,MAAM,MAAMA;AACZ,MAAM,SAASA;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Fragment = (props) => props?.children ?? null;
|
|
4
|
+
function setVNodeProp(vnode, key, value) {
|
|
5
|
+
if (Object.isExtensible(vnode)) {
|
|
6
|
+
vnode[key] = value;
|
|
7
|
+
return vnode;
|
|
8
|
+
}
|
|
9
|
+
return { ...vnode, [key]: value };
|
|
10
|
+
}
|
|
11
|
+
function jsx(type, props, key) {
|
|
12
|
+
const { children, expand, proportion, theme, ...rest } = props ?? {};
|
|
13
|
+
const kids = children == null ? [] : Array.isArray(children) ? children.flat(Infinity) : [children];
|
|
14
|
+
let vnode = { type, props: rest, children: kids };
|
|
15
|
+
if (key !== void 0 && key !== null) {
|
|
16
|
+
vnode = setVNodeProp(
|
|
17
|
+
vnode,
|
|
18
|
+
"__key",
|
|
19
|
+
typeof key === "string" || typeof key === "number" ? key : String(key)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
if (theme !== void 0) {
|
|
23
|
+
vnode = setVNodeProp(vnode, "__theme", theme);
|
|
24
|
+
}
|
|
25
|
+
if (expand !== void 0 || proportion !== void 0) {
|
|
26
|
+
const addConfig = {};
|
|
27
|
+
if (expand !== void 0) addConfig.expand = expand;
|
|
28
|
+
if (proportion !== void 0) addConfig.proportion = proportion;
|
|
29
|
+
vnode = setVNodeProp(vnode, "__addConfig", addConfig);
|
|
30
|
+
}
|
|
31
|
+
return vnode;
|
|
32
|
+
}
|
|
33
|
+
function jsxs(type, props, key) {
|
|
34
|
+
let vnode = jsx(type, props, key);
|
|
35
|
+
if (vnode && typeof vnode === "object" && "type" in vnode) {
|
|
36
|
+
vnode = setVNodeProp(vnode, "__staticChildren", true);
|
|
37
|
+
}
|
|
38
|
+
return vnode;
|
|
39
|
+
}
|
|
40
|
+
exports.Fragment = Fragment;
|
|
41
|
+
exports.jsx = jsx;
|
|
42
|
+
exports.jsxs = jsxs;
|
|
43
|
+
//# sourceMappingURL=jsx-runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.cjs","sources":["../src/jsx-runtime.ts"],"sourcesContent":["/**\n * Minimal JSX runtime for the TS \"react-jsx\" automatic runtime.\n * This builds plain VNode objects consumed by our custom mount/patch.\n */\nimport type { VNode } from './hooks'\nimport type { VNodeLike } from './vdom'\n\nexport const Fragment = (props: { children?: VNode | VNode[] | null }): VNodeLike =>\n props?.children ?? null\n\n/**\n * Safely sets a property on a VNode, handling frozen/sealed objects from bundlers\n * @param vnode - VNode to set property on\n * @param key - Property key\n * @param value - Value to set\n * @returns Original VNode if extensible, or shallow copy with property\n */\nfunction setVNodeProp<T extends VNode, K extends keyof VNode>(\n vnode: T,\n key: K,\n value: VNode[K]\n): T {\n if (Object.isExtensible(vnode)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(vnode as any)[key] = value\n return vnode\n }\n // VNode is frozen - create shallow copy\n return { ...vnode, [key]: value } as T\n}\n\n/**\n * JSX factory for automatic runtime (dynamic children)\n * Used by TypeScript for expressions like {items.map(...)}\n * @param type - Element type (string or component function)\n * @param props - Props including children\n * @param key - Optional key for identity tracking\n * @returns VNode object\n */\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: unknown\n): VNodeLike {\n const { children, expand, proportion, theme, ...rest } = props ?? {}\n // Flatten children arrays deeply to support {arrayVariable} in JSX\n const kids =\n children == null ? [] : Array.isArray(children) ? children.flat(Infinity) : [children]\n let vnode: VNode = { type, props: rest, children: kids }\n\n // Extract key\n if (key !== undefined && key !== null) {\n vnode = setVNodeProp(\n vnode,\n '__key',\n typeof key === 'string' || typeof key === 'number' ? key : String(key)\n )\n }\n\n // Extract theme and store separately (removed from props)\n if (theme !== undefined) {\n vnode = setVNodeProp(vnode, '__theme', theme as NonNullable<VNode['__theme']>)\n }\n\n // Extract UI add() config and store separately (removed from props)\n if (expand !== undefined || proportion !== undefined) {\n const addConfig: NonNullable<VNode['__addConfig']> = {}\n if (expand !== undefined) addConfig.expand = expand as boolean\n if (proportion !== undefined) addConfig.proportion = proportion as number\n vnode = setVNodeProp(vnode, '__addConfig', addConfig)\n }\n\n return vnode\n}\n\n/**\n * JSX factory for static children arrays\n * Used by TypeScript when children are directly listed in JSX (not via .map())\n * Marks children as static so VDOM doesn't warn about missing keys\n * @param type - Element type (string or component function)\n * @param props - Props including children\n * @param key - Optional key for identity tracking\n * @returns VNode object\n */\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: unknown\n): VNodeLike {\n let vnode = jsx(type, props, key) as VNode\n // Mark as static children - no key warnings needed\n if (vnode && typeof vnode === 'object' && 'type' in vnode) {\n vnode = setVNodeProp(vnode, '__staticChildren', true)\n }\n return vnode\n}\n"],"names":[],"mappings":";;AAOO,MAAM,WAAW,CAAC,UACvB,OAAO,YAAY;AASrB,SAAS,aACP,OACA,KACA,OACG;AACH,MAAI,OAAO,aAAa,KAAK,GAAG;AAE5B,UAAc,GAAG,IAAI;AACvB,WAAO;AAAA,EACT;AAEA,SAAO,EAAE,GAAG,OAAO,CAAC,GAAG,GAAG,MAAA;AAC5B;AAUO,SAAS,IACd,MACA,OACA,KACW;AACX,QAAM,EAAE,UAAU,QAAQ,YAAY,OAAO,GAAG,KAAA,IAAS,SAAS,CAAA;AAElE,QAAM,OACJ,YAAY,OAAO,CAAA,IAAK,MAAM,QAAQ,QAAQ,IAAI,SAAS,KAAK,QAAQ,IAAI,CAAC,QAAQ;AACvF,MAAI,QAAe,EAAE,MAAM,OAAO,MAAM,UAAU,KAAA;AAGlD,MAAI,QAAQ,UAAa,QAAQ,MAAM;AACrC,YAAQ;AAAA,MACN;AAAA,MACA;AAAA,MACA,OAAO,QAAQ,YAAY,OAAO,QAAQ,WAAW,MAAM,OAAO,GAAG;AAAA,IAAA;AAAA,EAEzE;AAGA,MAAI,UAAU,QAAW;AACvB,YAAQ,aAAa,OAAO,WAAW,KAAsC;AAAA,EAC/E;AAGA,MAAI,WAAW,UAAa,eAAe,QAAW;AACpD,UAAM,YAA+C,CAAA;AACrD,QAAI,WAAW,OAAW,WAAU,SAAS;AAC7C,QAAI,eAAe,OAAW,WAAU,aAAa;AACrD,YAAQ,aAAa,OAAO,eAAe,SAAS;AAAA,EACtD;AAEA,SAAO;AACT;AAWO,SAAS,KACd,MACA,OACA,KACW;AACX,MAAI,QAAQ,IAAI,MAAM,OAAO,GAAG;AAEhC,MAAI,SAAS,OAAO,UAAU,YAAY,UAAU,OAAO;AACzD,YAAQ,aAAa,OAAO,oBAAoB,IAAI;AAAA,EACtD;AACA,SAAO;AACT;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VNode } from './hooks';
|
|
2
|
+
import { VNodeLike } from './vdom';
|
|
3
|
+
export declare const Fragment: (props: {
|
|
4
|
+
children?: VNode | VNode[] | null;
|
|
5
|
+
}) => VNodeLike;
|
|
6
|
+
/**
|
|
7
|
+
* JSX factory for automatic runtime (dynamic children)
|
|
8
|
+
* Used by TypeScript for expressions like {items.map(...)}
|
|
9
|
+
* @param type - Element type (string or component function)
|
|
10
|
+
* @param props - Props including children
|
|
11
|
+
* @param key - Optional key for identity tracking
|
|
12
|
+
* @returns VNode object
|
|
13
|
+
*/
|
|
14
|
+
export declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: unknown): VNodeLike;
|
|
15
|
+
/**
|
|
16
|
+
* JSX factory for static children arrays
|
|
17
|
+
* Used by TypeScript when children are directly listed in JSX (not via .map())
|
|
18
|
+
* Marks children as static so VDOM doesn't warn about missing keys
|
|
19
|
+
* @param type - Element type (string or component function)
|
|
20
|
+
* @param props - Props including children
|
|
21
|
+
* @param key - Optional key for identity tracking
|
|
22
|
+
* @returns VNode object
|
|
23
|
+
*/
|
|
24
|
+
export declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: unknown): VNodeLike;
|
|
25
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,eAAO,MAAM,QAAQ,GAAI,OAAO;IAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,IAAI,CAAA;CAAE,KAAG,SAC/C,CAAA;AAuBzB;;;;;;;GAOG;AACH,wBAAgB,GAAG,CACjB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACrC,GAAG,CAAC,EAAE,OAAO,GACZ,SAAS,CA8BX;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACrC,GAAG,CAAC,EAAE,OAAO,GACZ,SAAS,CAOX"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const Fragment = (props) => props?.children ?? null;
|
|
2
|
+
function setVNodeProp(vnode, key, value) {
|
|
3
|
+
if (Object.isExtensible(vnode)) {
|
|
4
|
+
vnode[key] = value;
|
|
5
|
+
return vnode;
|
|
6
|
+
}
|
|
7
|
+
return { ...vnode, [key]: value };
|
|
8
|
+
}
|
|
9
|
+
function jsx(type, props, key) {
|
|
10
|
+
const { children, expand, proportion, theme, ...rest } = props ?? {};
|
|
11
|
+
const kids = children == null ? [] : Array.isArray(children) ? children.flat(Infinity) : [children];
|
|
12
|
+
let vnode = { type, props: rest, children: kids };
|
|
13
|
+
if (key !== void 0 && key !== null) {
|
|
14
|
+
vnode = setVNodeProp(
|
|
15
|
+
vnode,
|
|
16
|
+
"__key",
|
|
17
|
+
typeof key === "string" || typeof key === "number" ? key : String(key)
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
if (theme !== void 0) {
|
|
21
|
+
vnode = setVNodeProp(vnode, "__theme", theme);
|
|
22
|
+
}
|
|
23
|
+
if (expand !== void 0 || proportion !== void 0) {
|
|
24
|
+
const addConfig = {};
|
|
25
|
+
if (expand !== void 0) addConfig.expand = expand;
|
|
26
|
+
if (proportion !== void 0) addConfig.proportion = proportion;
|
|
27
|
+
vnode = setVNodeProp(vnode, "__addConfig", addConfig);
|
|
28
|
+
}
|
|
29
|
+
return vnode;
|
|
30
|
+
}
|
|
31
|
+
function jsxs(type, props, key) {
|
|
32
|
+
let vnode = jsx(type, props, key);
|
|
33
|
+
if (vnode && typeof vnode === "object" && "type" in vnode) {
|
|
34
|
+
vnode = setVNodeProp(vnode, "__staticChildren", true);
|
|
35
|
+
}
|
|
36
|
+
return vnode;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
Fragment,
|
|
40
|
+
jsx,
|
|
41
|
+
jsxs
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.ts"],"sourcesContent":["/**\n * Minimal JSX runtime for the TS \"react-jsx\" automatic runtime.\n * This builds plain VNode objects consumed by our custom mount/patch.\n */\nimport type { VNode } from './hooks'\nimport type { VNodeLike } from './vdom'\n\nexport const Fragment = (props: { children?: VNode | VNode[] | null }): VNodeLike =>\n props?.children ?? null\n\n/**\n * Safely sets a property on a VNode, handling frozen/sealed objects from bundlers\n * @param vnode - VNode to set property on\n * @param key - Property key\n * @param value - Value to set\n * @returns Original VNode if extensible, or shallow copy with property\n */\nfunction setVNodeProp<T extends VNode, K extends keyof VNode>(\n vnode: T,\n key: K,\n value: VNode[K]\n): T {\n if (Object.isExtensible(vnode)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(vnode as any)[key] = value\n return vnode\n }\n // VNode is frozen - create shallow copy\n return { ...vnode, [key]: value } as T\n}\n\n/**\n * JSX factory for automatic runtime (dynamic children)\n * Used by TypeScript for expressions like {items.map(...)}\n * @param type - Element type (string or component function)\n * @param props - Props including children\n * @param key - Optional key for identity tracking\n * @returns VNode object\n */\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: unknown\n): VNodeLike {\n const { children, expand, proportion, theme, ...rest } = props ?? {}\n // Flatten children arrays deeply to support {arrayVariable} in JSX\n const kids =\n children == null ? [] : Array.isArray(children) ? children.flat(Infinity) : [children]\n let vnode: VNode = { type, props: rest, children: kids }\n\n // Extract key\n if (key !== undefined && key !== null) {\n vnode = setVNodeProp(\n vnode,\n '__key',\n typeof key === 'string' || typeof key === 'number' ? key : String(key)\n )\n }\n\n // Extract theme and store separately (removed from props)\n if (theme !== undefined) {\n vnode = setVNodeProp(vnode, '__theme', theme as NonNullable<VNode['__theme']>)\n }\n\n // Extract UI add() config and store separately (removed from props)\n if (expand !== undefined || proportion !== undefined) {\n const addConfig: NonNullable<VNode['__addConfig']> = {}\n if (expand !== undefined) addConfig.expand = expand as boolean\n if (proportion !== undefined) addConfig.proportion = proportion as number\n vnode = setVNodeProp(vnode, '__addConfig', addConfig)\n }\n\n return vnode\n}\n\n/**\n * JSX factory for static children arrays\n * Used by TypeScript when children are directly listed in JSX (not via .map())\n * Marks children as static so VDOM doesn't warn about missing keys\n * @param type - Element type (string or component function)\n * @param props - Props including children\n * @param key - Optional key for identity tracking\n * @returns VNode object\n */\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: unknown\n): VNodeLike {\n let vnode = jsx(type, props, key) as VNode\n // Mark as static children - no key warnings needed\n if (vnode && typeof vnode === 'object' && 'type' in vnode) {\n vnode = setVNodeProp(vnode, '__staticChildren', true)\n }\n return vnode\n}\n"],"names":[],"mappings":"AAOO,MAAM,WAAW,CAAC,UACvB,OAAO,YAAY;AASrB,SAAS,aACP,OACA,KACA,OACG;AACH,MAAI,OAAO,aAAa,KAAK,GAAG;AAE5B,UAAc,GAAG,IAAI;AACvB,WAAO;AAAA,EACT;AAEA,SAAO,EAAE,GAAG,OAAO,CAAC,GAAG,GAAG,MAAA;AAC5B;AAUO,SAAS,IACd,MACA,OACA,KACW;AACX,QAAM,EAAE,UAAU,QAAQ,YAAY,OAAO,GAAG,KAAA,IAAS,SAAS,CAAA;AAElE,QAAM,OACJ,YAAY,OAAO,CAAA,IAAK,MAAM,QAAQ,QAAQ,IAAI,SAAS,KAAK,QAAQ,IAAI,CAAC,QAAQ;AACvF,MAAI,QAAe,EAAE,MAAM,OAAO,MAAM,UAAU,KAAA;AAGlD,MAAI,QAAQ,UAAa,QAAQ,MAAM;AACrC,YAAQ;AAAA,MACN;AAAA,MACA;AAAA,MACA,OAAO,QAAQ,YAAY,OAAO,QAAQ,WAAW,MAAM,OAAO,GAAG;AAAA,IAAA;AAAA,EAEzE;AAGA,MAAI,UAAU,QAAW;AACvB,YAAQ,aAAa,OAAO,WAAW,KAAsC;AAAA,EAC/E;AAGA,MAAI,WAAW,UAAa,eAAe,QAAW;AACpD,UAAM,YAA+C,CAAA;AACrD,QAAI,WAAW,OAAW,WAAU,SAAS;AAC7C,QAAI,eAAe,OAAW,WAAU,aAAa;AACrD,YAAQ,aAAa,OAAO,eAAe,SAAS;AAAA,EACtD;AAEA,SAAO;AACT;AAWO,SAAS,KACd,MACA,OACA,KACW;AACX,MAAI,QAAQ,IAAI,MAAM,OAAO,GAAG;AAEhC,MAAI,SAAS,OAAO,UAAU,YAAY,UAAU,OAAO;AACzD,YAAQ,aAAa,OAAO,oBAAoB,IAAI;AAAA,EACtD;AACA,SAAO;AACT;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ButtonProps } from './components/custom/Button';
|
|
2
|
+
import { TextProps as CustomTextProps } from './components/custom/Text';
|
|
3
|
+
import { ViewProps as CustomViewProps } from './components/custom/View';
|
|
4
|
+
import { GraphicsProps } from './components/primitives/graphics';
|
|
5
|
+
import { ImagePrimitiveProps } from './components/primitives/image';
|
|
6
|
+
import { NineSlicePrimitiveProps } from './components/primitives/nineslice';
|
|
7
|
+
import { SpriteProps } from './components/primitives/sprite';
|
|
8
|
+
import { TextProps as PrimitiveTextProps } from './components/primitives/text';
|
|
9
|
+
import { TileSpriteProps } from './components/primitives/tilesprite';
|
|
10
|
+
import { ViewProps as PrimitiveViewProps } from './components/primitives/view';
|
|
11
|
+
declare global {
|
|
12
|
+
namespace JSX {
|
|
13
|
+
interface IntrinsicElements {
|
|
14
|
+
view: PrimitiveViewProps;
|
|
15
|
+
text: PrimitiveTextProps;
|
|
16
|
+
nineslice: NineSlicePrimitiveProps;
|
|
17
|
+
sprite: SpriteProps;
|
|
18
|
+
image: ImagePrimitiveProps;
|
|
19
|
+
graphics: GraphicsProps;
|
|
20
|
+
tilesprite: TileSpriteProps;
|
|
21
|
+
View: CustomViewProps;
|
|
22
|
+
Text: CustomTextProps;
|
|
23
|
+
Button: ButtonProps;
|
|
24
|
+
NineSlice: NineSlicePrimitiveProps;
|
|
25
|
+
Sprite: SpriteProps;
|
|
26
|
+
Image: ImagePrimitiveProps;
|
|
27
|
+
Graphics: GraphicsProps;
|
|
28
|
+
TileSprite: TileSpriteProps;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=jsx-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-types.d.ts","sourceRoot":"","sources":["../src/jsx-types.ts"],"names":[],"mappings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
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
/**
|
|
3
|
+
* Update background graphics size if present
|
|
4
|
+
* @param container - Phaser container
|
|
5
|
+
* @param width - Background width
|
|
6
|
+
* @param height - Background height
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateBackground(container: Phaser.GameObjects.Container, width: number, height: number): void;
|
|
9
|
+
/**
|
|
10
|
+
* Update interactive hit area if present
|
|
11
|
+
* @param container - Phaser container
|
|
12
|
+
* @param width - Hit area width
|
|
13
|
+
* @param height - Hit area height
|
|
14
|
+
*/
|
|
15
|
+
export declare function updateHitArea(container: Phaser.GameObjects.Container, width: number, height: number): void;
|
|
16
|
+
//# sourceMappingURL=background-applier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background-applier.d.ts","sourceRoot":"","sources":["../../../src/layout/appliers/background-applier.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,CA4CN;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,CAmBN"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
/**
|
|
3
|
+
* Apply dimensions to container and cache them for child percentage resolution
|
|
4
|
+
* @param container - Phaser container
|
|
5
|
+
* @param width - Container width
|
|
6
|
+
* @param height - Container height
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyContainerDimensions(container: Phaser.GameObjects.Container, width: number, height: number): void;
|
|
9
|
+
//# sourceMappingURL=container-applier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-applier.d.ts","sourceRoot":"","sources":["../../../src/layout/appliers/container-applier.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,CAsBN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LayoutChild, Position } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Apply positions to children
|
|
4
|
+
* @param children - Array of layout children
|
|
5
|
+
* @param positions - Calculated positions for each child
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyChildPositions(children: LayoutChild[], positions: Position[]): void;
|
|
8
|
+
//# sourceMappingURL=position-applier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position-applier.d.ts","sourceRoot":"","sources":["../../../src/layout/appliers/position-applier.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAErD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,CA8BxF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout system - public API
|
|
3
|
+
* For positioning children within containers with flexbox-style layout
|
|
4
|
+
*/
|
|
5
|
+
export { calculateLayout, DeferredLayoutQueue, LayoutBatchQueue } from './layout-engine';
|
|
6
|
+
export type { ContentArea, GameObjectWithLayout, LayoutChild, LayoutContext, LayoutSize, LayoutSizeProvider, PaddingValues, Position, } from './types';
|
|
7
|
+
export { getChildSize, getMargin } from './utils/child-utils';
|
|
8
|
+
export { clearSizeCaches, isExplicit, parseSize, requiresParent, resolveSize, } from './utils/size-resolver';
|
|
9
|
+
export type { ParsedSize } from './utils/size-resolver';
|
|
10
|
+
export { calculateContainerSize, calculateContentDimensions, normalizePadding, } from './utils/dimension-calculator';
|
|
11
|
+
export type { ContentMetrics } from './utils/dimension-calculator';
|
|
12
|
+
export { calculateAlignItems, calculateJustifyContent } from './utils/spacing-calculator';
|
|
13
|
+
export type { JustifyResult } from './utils/spacing-calculator';
|
|
14
|
+
export { BaseLayoutStrategy } from './strategies/base-strategy';
|
|
15
|
+
export type { LayoutStrategy } from './strategies/base-strategy';
|
|
16
|
+
export { ColumnLayoutStrategy } from './strategies/column-layout';
|
|
17
|
+
export { RowLayoutStrategy } from './strategies/row-layout';
|
|
18
|
+
export { StackLayoutStrategy } from './strategies/stack-layout';
|
|
19
|
+
export { updateBackground, updateHitArea } from './appliers/background-applier';
|
|
20
|
+
export { applyContainerDimensions } from './appliers/container-applier';
|
|
21
|
+
export { applyChildPositions } from './appliers/position-applier';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGxF,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,QAAQ,GACT,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EACL,eAAe,EACf,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,GACZ,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,8BAA8B,CAAA;AACrC,YAAY,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAElE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACzF,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAG/D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
export interface MockContainer extends Phaser.GameObjects.Container {
|
|
3
|
+
__getLayoutSize: () => {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Mock container helper
|
|
10
|
+
* @param width - Initial width
|
|
11
|
+
* @param height - Initial height
|
|
12
|
+
* @param isContainer - Whether this should act as a container (with children list)
|
|
13
|
+
*/
|
|
14
|
+
export declare function mockContainer(width?: number, height?: number, isContainer?: boolean): MockContainer;
|
|
15
|
+
/**
|
|
16
|
+
* Setup function for layout tests - enables synchronous mode
|
|
17
|
+
*/
|
|
18
|
+
export declare function setupLayoutTests(): void;
|
|
19
|
+
//# sourceMappingURL=layout-engine-test-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-engine-test-utils.d.ts","sourceRoot":"","sources":["../../src/layout/layout-engine-test-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,WAAW,CAAC,SAAS;IACjE,eAAe,EAAE,MAAM;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,SAAI,EAAE,MAAM,SAAI,EAAE,WAAW,UAAO,GAAG,aAAa,CAsCtF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,SAI/B"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
import { LayoutProps } from '../core-props';
|
|
3
|
+
/**
|
|
4
|
+
* Callback function for deferred layout updates
|
|
5
|
+
* Executed after all layouts are complete in next frame
|
|
6
|
+
*/
|
|
7
|
+
type DeferredUpdateCallback = () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Central processor for deferred layout updates
|
|
10
|
+
* Collects all updates that require final world coordinates or completed parent layouts
|
|
11
|
+
* Executes them in batch via single requestAnimationFrame for optimal performance
|
|
12
|
+
*
|
|
13
|
+
* Use cases:
|
|
14
|
+
* - Overflow mask positioning (needs world coordinates)
|
|
15
|
+
* - Scroll position updates (needs final content size)
|
|
16
|
+
* - Animation initialization (needs final positions)
|
|
17
|
+
* - Custom effects requiring complete layout
|
|
18
|
+
* - Gesture hit area updates (needs final layout size)
|
|
19
|
+
*/
|
|
20
|
+
export declare class DeferredLayoutQueue {
|
|
21
|
+
private static callbacks;
|
|
22
|
+
private static scheduled;
|
|
23
|
+
/**
|
|
24
|
+
* Schedule a callback to execute after current layout pass completes
|
|
25
|
+
* All callbacks are batched and executed in single requestAnimationFrame
|
|
26
|
+
* @param callback - Function to execute in next frame
|
|
27
|
+
*/
|
|
28
|
+
static defer(callback: DeferredUpdateCallback): void;
|
|
29
|
+
/**
|
|
30
|
+
* Execute all pending callbacks in batch
|
|
31
|
+
* Called once per frame via requestAnimationFrame
|
|
32
|
+
*/
|
|
33
|
+
private static flush;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Batches layout calculations to reduce redundant recalculations
|
|
37
|
+
* Prevents multiple calculations of same container within single synchronous call stack
|
|
38
|
+
* Does NOT defer to next frame - executes immediately after current stack completes
|
|
39
|
+
*
|
|
40
|
+
* Benefits:
|
|
41
|
+
* - Prevents multiple calculations of same container in one update
|
|
42
|
+
* - Bottom-up execution order prevents redundant parent recalculations
|
|
43
|
+
* - No visual flickering (executes in same frame)
|
|
44
|
+
*
|
|
45
|
+
* Usage:
|
|
46
|
+
* - VDOM patches: LayoutBatchQueue.schedule() instead of direct calculateLayout()
|
|
47
|
+
* - Appliers: LayoutBatchQueue.schedule() instead of direct calculateLayout()
|
|
48
|
+
* - Tests: Set LayoutBatchQueue.synchronous = true for immediate execution
|
|
49
|
+
*/
|
|
50
|
+
export declare class LayoutBatchQueue {
|
|
51
|
+
private static pending;
|
|
52
|
+
private static scheduled;
|
|
53
|
+
/**
|
|
54
|
+
* Enable synchronous mode for testing
|
|
55
|
+
* When true, layouts execute immediately instead of batching
|
|
56
|
+
*/
|
|
57
|
+
static synchronous: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Schedule a layout calculation to execute after current call stack
|
|
60
|
+
* Uses microtask (Promise) instead of requestAnimationFrame to avoid flickering
|
|
61
|
+
* If container is already scheduled, updates entry with latest props
|
|
62
|
+
* @param container - Container to calculate layout for
|
|
63
|
+
* @param containerProps - Layout props
|
|
64
|
+
* @param parentSize - Optional parent size for percentage resolution
|
|
65
|
+
* @param parentPadding - Optional parent padding for fill resolution
|
|
66
|
+
*/
|
|
67
|
+
static schedule(container: Phaser.GameObjects.Container, containerProps: LayoutProps, parentSize?: {
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
}, parentPadding?: {
|
|
71
|
+
horizontal: number;
|
|
72
|
+
vertical: number;
|
|
73
|
+
}): void;
|
|
74
|
+
/**
|
|
75
|
+
* Execute all pending layout calculations immediately
|
|
76
|
+
* Processes in bottom-up order (deepest children first)
|
|
77
|
+
* This prevents redundant parent recalculations
|
|
78
|
+
*/
|
|
79
|
+
static flush(): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Calculate layout for a container and its children
|
|
83
|
+
* Batches layout calculations for optimal performance
|
|
84
|
+
* Multiple calls within same frame are deduplicated and executed bottom-up
|
|
85
|
+
* @param container - Phaser container with children
|
|
86
|
+
* @param containerProps - Layout props of the container
|
|
87
|
+
* @param parentSize - Optional parent dimensions for percentage resolution
|
|
88
|
+
* @param parentPadding - Optional parent padding for 'fill' resolution
|
|
89
|
+
*/
|
|
90
|
+
export declare function calculateLayout(container: Phaser.GameObjects.Container, containerProps: LayoutProps, parentSize?: {
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
}, parentPadding?: {
|
|
94
|
+
horizontal: number;
|
|
95
|
+
vertical: number;
|
|
96
|
+
}): void;
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=layout-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-engine.d.ts","sourceRoot":"","sources":["../../src/layout/layout-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAuBhD;;;GAGG;AACH,KAAK,sBAAsB,GAAG,MAAM,IAAI,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,SAAS,CAA+B;IACvD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAQ;IAEhC;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAUpD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,KAAK;CAgBrB;AAYD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,OAAO,CAA4D;IAClF,OAAO,CAAC,MAAM,CAAC,SAAS,CAAQ;IAEhC;;;OAGG;IACH,MAAM,CAAC,WAAW,UAAQ;IAE1B;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CACb,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACvC,cAAc,EAAE,WAAW,EAC3B,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAC9C,aAAa,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GACvD,IAAI;IAmBP;;;;OAIG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;CAsCrB;AAm5BD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EACvC,cAAc,EAAE,WAAW,EAC3B,UAAU,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC9C,aAAa,CAAC,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvD,IAAI,CAEN"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LayoutChild, LayoutContext, Position } from '../types';
|
|
2
|
+
import { ContentMetrics } from '../utils/dimension-calculator';
|
|
3
|
+
/**
|
|
4
|
+
* Layout strategy interface
|
|
5
|
+
* Each direction (row, column, stack) implements this interface
|
|
6
|
+
*/
|
|
7
|
+
export interface LayoutStrategy {
|
|
8
|
+
/**
|
|
9
|
+
* Calculate content dimensions for this layout strategy
|
|
10
|
+
* @param children - Array of layout children
|
|
11
|
+
* @param context - Layout context
|
|
12
|
+
* @returns Content metrics (maxWidth, maxHeight, totalMainSize)
|
|
13
|
+
*/
|
|
14
|
+
calculateMetrics(children: LayoutChild[], context: LayoutContext): ContentMetrics;
|
|
15
|
+
/**
|
|
16
|
+
* Calculate position for a child at given index
|
|
17
|
+
* @param child - Layout child
|
|
18
|
+
* @param index - Child index
|
|
19
|
+
* @param context - Layout context
|
|
20
|
+
* @param currentMain - Current position on main axis
|
|
21
|
+
* @returns Position (x, y) and updated currentMain value
|
|
22
|
+
*/
|
|
23
|
+
positionChild(child: LayoutChild, index: number, context: LayoutContext, currentMain: number): {
|
|
24
|
+
position: Position;
|
|
25
|
+
nextMain: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Abstract base class for layout strategies
|
|
30
|
+
* Provides common functionality for all strategies
|
|
31
|
+
*/
|
|
32
|
+
export declare abstract class BaseLayoutStrategy implements LayoutStrategy {
|
|
33
|
+
abstract calculateMetrics(children: LayoutChild[], context: LayoutContext): ContentMetrics;
|
|
34
|
+
abstract positionChild(child: LayoutChild, index: number, context: LayoutContext, currentMain: number): {
|
|
35
|
+
position: Position;
|
|
36
|
+
nextMain: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Helper: Normalize margin values
|
|
40
|
+
* @param child - Layout child
|
|
41
|
+
* @returns Normalized margin values
|
|
42
|
+
*/
|
|
43
|
+
protected getMarginValues(child: LayoutChild): {
|
|
44
|
+
top: number;
|
|
45
|
+
right: number;
|
|
46
|
+
bottom: number;
|
|
47
|
+
left: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Helper: Calculate total child size including margins
|
|
51
|
+
* @param child - Layout child
|
|
52
|
+
* @returns Total width and height including margins
|
|
53
|
+
*/
|
|
54
|
+
protected getTotalChildSize(child: LayoutChild): {
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=base-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-strategy.d.ts","sourceRoot":"","sources":["../../../src/layout/strategies/base-strategy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAEnE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc,CAAA;IAEjF;;;;;;;OAOG;IACH,aAAa,CACX,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,MAAM,GAClB;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5C;AAED;;;GAGG;AACH,8BAAsB,kBAAmB,YAAW,cAAc;IAChE,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc;IAE1F,QAAQ,CAAC,aAAa,CACpB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,MAAM,GAClB;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAE3C;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW;;;;;;IAS5C;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW;;;;CAO/C"}
|