@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,48 @@
|
|
|
1
|
+
export type KeyboardInputManagerConfig = {
|
|
2
|
+
onInput?: (value: string, event: Event) => void;
|
|
3
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
4
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
5
|
+
onFocus?: () => void;
|
|
6
|
+
onBlur?: () => void;
|
|
7
|
+
maxLength?: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
debug?: boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Manages hidden DOM input for keyboard events
|
|
13
|
+
*/
|
|
14
|
+
export declare class KeyboardInputManager {
|
|
15
|
+
private domInput;
|
|
16
|
+
private container;
|
|
17
|
+
private config;
|
|
18
|
+
constructor(container: Phaser.GameObjects.Container, config: KeyboardInputManagerConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Create hidden DOM input element
|
|
21
|
+
*/
|
|
22
|
+
private create;
|
|
23
|
+
/**
|
|
24
|
+
* Update DOM input value programmatically
|
|
25
|
+
*/
|
|
26
|
+
setValue(value: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Focus the DOM input
|
|
29
|
+
*/
|
|
30
|
+
focus(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Blur the DOM input
|
|
33
|
+
*/
|
|
34
|
+
blur(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Check if DOM input is focused
|
|
37
|
+
*/
|
|
38
|
+
isFocused(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Set pointer events (auto when not focused, none when focused)
|
|
41
|
+
*/
|
|
42
|
+
setPointerEvents(enabled: boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* Destroy the DOM input
|
|
45
|
+
*/
|
|
46
|
+
destroy(): void;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=KeyboardInputManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardInputManager.d.ts","sourceRoot":"","sources":["../../src/utils/KeyboardInputManager.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACxC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC5B,CAAA;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,MAAM,CAA4B;gBAE9B,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,0BAA0B;IAMvF;;OAEG;IACH,OAAO,CAAC,MAAM;IAiDd;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAO7B;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;OAEG;IACH,IAAI,IAAI,IAAI;IAOZ;;OAEG;IACH,SAAS,IAAI,OAAO;IAKpB;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAOxC;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for DOM input element
|
|
4
|
+
*/
|
|
5
|
+
export interface DOMInputConfig {
|
|
6
|
+
/** Input type (text, password, email, etc.) */
|
|
7
|
+
type?: string;
|
|
8
|
+
/** Placeholder text */
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** Initial value */
|
|
11
|
+
value?: string;
|
|
12
|
+
/** Whether input is disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Maximum length of input */
|
|
15
|
+
maxLength?: number;
|
|
16
|
+
/** Autocomplete behavior */
|
|
17
|
+
autocomplete?: string;
|
|
18
|
+
/** Autocorrect behavior (Safari) */
|
|
19
|
+
autocorrect?: string;
|
|
20
|
+
/** Autocapitalize behavior (mobile) */
|
|
21
|
+
autocapitalize?: string;
|
|
22
|
+
/** Spellcheck behavior */
|
|
23
|
+
spellcheck?: boolean;
|
|
24
|
+
/** CSS styles to apply */
|
|
25
|
+
styles?: Partial<CSSStyleDeclaration>;
|
|
26
|
+
/** Input event callback */
|
|
27
|
+
onInput?: (value: string, event: Event) => void;
|
|
28
|
+
/** Keyboard event callbacks */
|
|
29
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
30
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
31
|
+
/** Focus event callbacks */
|
|
32
|
+
onFocus?: (event: FocusEvent) => void;
|
|
33
|
+
onBlur?: (event: FocusEvent) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* DOM input element wrapper with automatic positioning
|
|
37
|
+
*/
|
|
38
|
+
export declare class DOMInputElement {
|
|
39
|
+
private input;
|
|
40
|
+
private container;
|
|
41
|
+
private scene;
|
|
42
|
+
private scrollHandler;
|
|
43
|
+
private resizeHandler;
|
|
44
|
+
private throttledScrollHandler;
|
|
45
|
+
private throttledResizeHandler;
|
|
46
|
+
private intersectionObserver;
|
|
47
|
+
private isDestroyed;
|
|
48
|
+
private lastValues;
|
|
49
|
+
private counter;
|
|
50
|
+
private scrollThrottleTimeout;
|
|
51
|
+
private resizeThrottleTimeout;
|
|
52
|
+
constructor(container: Phaser.GameObjects.Container, config?: DOMInputConfig);
|
|
53
|
+
/**
|
|
54
|
+
* Setup IntersectionObserver to detect canvas position changes
|
|
55
|
+
*/
|
|
56
|
+
private setupIntersectionObserver;
|
|
57
|
+
/**
|
|
58
|
+
* Throttle function to limit call frequency
|
|
59
|
+
* @param func - Function to throttle
|
|
60
|
+
* @param delay - Minimum delay between calls in ms
|
|
61
|
+
* @returns Throttled function
|
|
62
|
+
*/
|
|
63
|
+
private throttle;
|
|
64
|
+
/**
|
|
65
|
+
* Apply default styles to input element
|
|
66
|
+
*/
|
|
67
|
+
private applyDefaultStyles;
|
|
68
|
+
/**
|
|
69
|
+
* Update input element position to match Phaser container
|
|
70
|
+
*/
|
|
71
|
+
private updatePosition;
|
|
72
|
+
/**
|
|
73
|
+
* Get the DOM input element
|
|
74
|
+
*/
|
|
75
|
+
getElement(): HTMLInputElement;
|
|
76
|
+
/**
|
|
77
|
+
* Set input value
|
|
78
|
+
*/
|
|
79
|
+
setValue(value: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* Get input value
|
|
82
|
+
*/
|
|
83
|
+
getValue(): string;
|
|
84
|
+
/**
|
|
85
|
+
* Focus the input
|
|
86
|
+
*/
|
|
87
|
+
focus(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Blur the input
|
|
90
|
+
*/
|
|
91
|
+
blur(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Set disabled state
|
|
94
|
+
*/
|
|
95
|
+
setDisabled(disabled: boolean): void;
|
|
96
|
+
/**
|
|
97
|
+
* Set placeholder
|
|
98
|
+
*/
|
|
99
|
+
setPlaceholder(placeholder: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Update styles
|
|
102
|
+
*/
|
|
103
|
+
setStyles(styles: Partial<CSSStyleDeclaration>): void;
|
|
104
|
+
/**
|
|
105
|
+
* Destroy the input element and cleanup
|
|
106
|
+
*/
|
|
107
|
+
destroy(): void;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=dom-input-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-input-manager.d.ts","sourceRoot":"","sources":["../../src/utils/dom-input-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4BAA4B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACrC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/C,+BAA+B;IAC/B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACxC,4BAA4B;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;CACrC;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,sBAAsB,CAAY;IAC1C,OAAO,CAAC,sBAAsB,CAAY;IAC1C,OAAO,CAAC,oBAAoB,CAAoC;IAChE,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAA2C;IAC7D,OAAO,CAAC,OAAO,CAAI;IACnB,OAAO,CAAC,qBAAqB,CAAsB;IACnD,OAAO,CAAC,qBAAqB,CAAsB;gBAEvC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAE,cAAmB;IAwFhF;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAgBjC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAWhB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAkC1B;;OAEG;IACH,OAAO,CAAC,cAAc;IAuDtB;;OAEG;IACH,UAAU,IAAI,gBAAgB;IAI9B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM7B;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb;;OAEG;IACH,IAAI,IAAI,IAAI;IAMZ;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAMpC;;OAEG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAMzC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI;IAMrD;;OAEG;IACH,OAAO,IAAI,IAAI;CA2BhB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
/**
|
|
3
|
+
* Converts an SVG (string or URL) into a Phaser texture
|
|
4
|
+
*
|
|
5
|
+
* Supports multiple input formats:
|
|
6
|
+
* - Raw SVG string (must start with '<svg')
|
|
7
|
+
* - data:image/svg+xml URL
|
|
8
|
+
* - External URL (http/https)
|
|
9
|
+
*
|
|
10
|
+
* The function creates a canvas element, renders the SVG at the specified dimensions,
|
|
11
|
+
* and registers it as a Phaser texture. If a texture with the same key already exists,
|
|
12
|
+
* it will be replaced.
|
|
13
|
+
*
|
|
14
|
+
* @param scene - Phaser scene instance
|
|
15
|
+
* @param key - Unique texture key for registration
|
|
16
|
+
* @param svgOrUrl - SVG string or URL
|
|
17
|
+
* @param width - Desired texture width in pixels (default: 32)
|
|
18
|
+
* @param height - Desired texture height in pixels (default: 32)
|
|
19
|
+
* @throws {Error} If SVG loading or canvas rendering fails
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Raw SVG string
|
|
23
|
+
* await svgToTexture(scene, 'my-icon', '<svg>...</svg>', 64, 64)
|
|
24
|
+
*
|
|
25
|
+
* // URL
|
|
26
|
+
* await svgToTexture(scene, 'external-icon', 'https://example.com/icon.svg')
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function svgToTexture(scene: Phaser.Scene, key: string, svgOrUrl: string, width?: number, height?: number): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=svg-texture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-texture.d.ts","sourceRoot":"","sources":["../../src/utils/svg-texture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AA0BhC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAyDf"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
interface TextureRequest {
|
|
3
|
+
key: string;
|
|
4
|
+
svg: string;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Global texture registry to manage texture loading and cleanup
|
|
10
|
+
* Uses reference counting per scene to ensure textures are only removed when no longer needed
|
|
11
|
+
*/
|
|
12
|
+
declare class TextureRegistry {
|
|
13
|
+
private sceneTextures;
|
|
14
|
+
/**
|
|
15
|
+
* Get or create texture map for a scene
|
|
16
|
+
*/
|
|
17
|
+
private getTextureMap;
|
|
18
|
+
/**
|
|
19
|
+
* Request a texture in a specific scene, incrementing reference count
|
|
20
|
+
* Loads the texture if it's the first request in this scene
|
|
21
|
+
*/
|
|
22
|
+
requestTexture(scene: Phaser.Scene, request: TextureRequest): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Release a texture in a specific scene, decrementing reference count
|
|
25
|
+
* Removes the texture if reference count reaches zero
|
|
26
|
+
*/
|
|
27
|
+
releaseTexture(scene: Phaser.Scene, key: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a texture is loaded in a specific scene
|
|
30
|
+
*/
|
|
31
|
+
isTextureLoaded(scene: Phaser.Scene, key: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Get all loaded textures in a specific scene
|
|
34
|
+
*/
|
|
35
|
+
getLoadedTextures(scene: Phaser.Scene): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Release all textures in a specific scene
|
|
38
|
+
* Called automatically when scene shuts down
|
|
39
|
+
*/
|
|
40
|
+
releaseScene(scene: Phaser.Scene): void;
|
|
41
|
+
/**
|
|
42
|
+
* Release all textures from all scenes
|
|
43
|
+
* Use with caution - removes all textures from all Phaser scenes
|
|
44
|
+
*/
|
|
45
|
+
releaseAll(): void;
|
|
46
|
+
}
|
|
47
|
+
export declare const textureRegistry: TextureRegistry;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=texture-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture-registry.d.ts","sourceRoot":"","sources":["../../src/utils/texture-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAGhC,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAQD;;;GAGG;AACH,cAAM,eAAe;IAEnB,OAAO,CAAC,aAAa,CAAqD;IAE1E;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;;OAGG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCjF;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM;IAiB/C;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAO1D;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,MAAM,EAAE;IAQhD;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK;IAYhC;;;OAGG;IACH,UAAU;CAUX;AAGD,eAAO,MAAM,eAAe,iBAAwB,CAAA"}
|
package/dist/vdom.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as Phaser } from 'phaser';
|
|
2
|
+
import { NodeProps, NodeType } from './core-types';
|
|
3
|
+
import { VNode } from './hooks';
|
|
4
|
+
import { ParentType } from './types';
|
|
5
|
+
export type VNodeLike = VNode | VNode[] | null;
|
|
6
|
+
/**
|
|
7
|
+
* Base props that mountJSX requires for scene dimensions
|
|
8
|
+
* Provides viewport size for percentage-based sizing
|
|
9
|
+
*/
|
|
10
|
+
export interface MountProps {
|
|
11
|
+
/** Scene/container width in pixels */
|
|
12
|
+
width: number;
|
|
13
|
+
/** Scene/container height in pixels */
|
|
14
|
+
height: number;
|
|
15
|
+
/** Disable automatic SceneWrapper (default: false) */
|
|
16
|
+
disableAutoSize?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Combined props type: MountProps + Component-specific props
|
|
20
|
+
* Use this for type-safe mountJSX calls
|
|
21
|
+
*/
|
|
22
|
+
export type MountComponentProps<P = Record<string, never>> = MountProps & P;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a VNode element (alternative to JSX)
|
|
25
|
+
* @param type - Element type (string or component)
|
|
26
|
+
* @param props - Element props
|
|
27
|
+
* @param children - Child elements
|
|
28
|
+
* @returns VNode object
|
|
29
|
+
*/
|
|
30
|
+
export declare function createElement(type: string | ((props: Record<string, unknown>) => VNode), props: Record<string, unknown> | null, ...children: VNode[]): VNode;
|
|
31
|
+
/**
|
|
32
|
+
* Mounts a VNode to the scene or parent container
|
|
33
|
+
* @param parentOrScene - Scene or parent container
|
|
34
|
+
* @param vnode - Virtual node to mount
|
|
35
|
+
* @returns Created Phaser GameObject
|
|
36
|
+
*/
|
|
37
|
+
export declare function mount(parentOrScene: ParentType, vnode: VNode): Phaser.GameObjects.GameObject;
|
|
38
|
+
/**
|
|
39
|
+
* Unmounts a VNode and cleans up resources
|
|
40
|
+
* @param vnode - VNode to unmount
|
|
41
|
+
*/
|
|
42
|
+
export declare function unmount(vnode: VNode | null | undefined | false): void;
|
|
43
|
+
/**
|
|
44
|
+
* Patches VNode tree with updates
|
|
45
|
+
* @param parent - Parent container or scene
|
|
46
|
+
* @param oldV - Previous VNode (can be null if previous render returned null)
|
|
47
|
+
* @param newV - New VNode (can be null if new render returns null)
|
|
48
|
+
*/
|
|
49
|
+
export declare function patchVNode(parent: ParentType, oldV: VNode | null, newV: VNode | null): void;
|
|
50
|
+
/**
|
|
51
|
+
* Mounts a component by type and props
|
|
52
|
+
* Automatically wraps component in SceneWrapper unless disableAutoSize is true
|
|
53
|
+
* @param parentOrScene - Phaser scene or parent container
|
|
54
|
+
* @param type - Component type (function or string)
|
|
55
|
+
* @param props - Component props including width and height
|
|
56
|
+
* @returns Created Phaser GameObject
|
|
57
|
+
*/
|
|
58
|
+
export declare function mountJSX<T extends NodeType>(parentOrScene: ParentType, type: T, props: MountComponentProps<NodeProps<T>>): Phaser.GameObjects.GameObject;
|
|
59
|
+
export declare function mountJSX<P = Record<string, never>>(parentOrScene: ParentType, type: (props: P & MountProps) => VNode, props: MountComponentProps<P>): Phaser.GameObjects.GameObject;
|
|
60
|
+
//# sourceMappingURL=vdom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vdom.d.ts","sourceRoot":"","sources":["../src/vdom.ts"],"names":[],"mappings":"AAKA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGvD,OAAO,EAA0D,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AAO5F,OAAO,KAAK,EAAE,UAAU,EAAO,MAAM,SAAS,CAAA;AAE9C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,EAAE,GAAG,IAAI,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,UAAU,GAAG,CAAC,CAAA;AA8U3E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,EAC1D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACrC,GAAG,QAAQ,EAAE,KAAK,EAAE,GACnB,KAAK,CAGP;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAwR5F;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAoCrE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,QAwVpF;AAED;;;;;;;GAOG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,QAAQ,EACzC,aAAa,EAAE,UAAU,EACzB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GACvC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAA;AAEhC,wBAAgB,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAChD,aAAa,EAAE,UAAU,EACzB,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,UAAU,KAAK,KAAK,EACtC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC5B,MAAM,CAAC,WAAW,CAAC,UAAU,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ParentType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Viewport dimensions
|
|
4
|
+
*/
|
|
5
|
+
export interface ViewportSize {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Viewport registry - stores current viewport dimensions
|
|
11
|
+
* Similar to themeRegistry pattern
|
|
12
|
+
*/
|
|
13
|
+
declare class ViewportRegistry {
|
|
14
|
+
private viewport;
|
|
15
|
+
private parent;
|
|
16
|
+
/**
|
|
17
|
+
* Update viewport dimensions
|
|
18
|
+
* @param width - Viewport width in pixels
|
|
19
|
+
* @param height - Viewport height in pixels
|
|
20
|
+
* @param parent - Optional Phaser scene reference
|
|
21
|
+
*/
|
|
22
|
+
setViewport(width: number, height: number, parent?: ParentType): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get current viewport dimensions
|
|
25
|
+
* @returns Current viewport size
|
|
26
|
+
*/
|
|
27
|
+
getViewport(): ViewportSize;
|
|
28
|
+
/**
|
|
29
|
+
* Get Phaser scene reference
|
|
30
|
+
* @returns Scene or undefined
|
|
31
|
+
*/
|
|
32
|
+
getParent(): ParentType | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Global viewport registry instance
|
|
36
|
+
*/
|
|
37
|
+
export declare const viewportRegistry: ViewportRegistry;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=viewport-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport-context.d.ts","sourceRoot":"","sources":["../src/viewport-context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,cAAM,gBAAgB;IACpB,OAAO,CAAC,QAAQ,CAA4C;IAC5D,OAAO,CAAC,MAAM,CAAwB;IAEtC;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI;IAKrE;;;OAGG;IACH,WAAW,IAAI,YAAY;IAI3B;;;OAGG;IACH,SAAS,IAAI,UAAU,GAAG,SAAS;CAGpC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,kBAAyB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
export interface IconGeneratorPluginOptions {
|
|
3
|
+
/** Path to icon generator config file */
|
|
4
|
+
configPath: string;
|
|
5
|
+
/**
|
|
6
|
+
* When to scan icon directories and generate types
|
|
7
|
+
* - 'never': Don't generate in plugin (use CLI manually)
|
|
8
|
+
* - 'start': Only at server start (default)
|
|
9
|
+
* - 'watch': At start + when SVG files change
|
|
10
|
+
*/
|
|
11
|
+
scanIconDirectory?: 'never' | 'start' | 'watch';
|
|
12
|
+
/**
|
|
13
|
+
* When to scan code and generate loaders
|
|
14
|
+
* - 'start': Only at server start
|
|
15
|
+
* - 'watch': At start + when code changes (default)
|
|
16
|
+
*/
|
|
17
|
+
generateLoaders?: 'start' | 'watch';
|
|
18
|
+
/** @deprecated Use scanIconDirectory instead */
|
|
19
|
+
watch?: boolean;
|
|
20
|
+
/** @deprecated Use scanIconDirectory='never' + generateLoaders='start' instead */
|
|
21
|
+
typesOnly?: boolean;
|
|
22
|
+
/** @deprecated Use scanIconDirectory='start' instead */
|
|
23
|
+
loadersOnly?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Vite plugin for icon generation
|
|
27
|
+
*/
|
|
28
|
+
export declare function iconGeneratorPlugin(options: IconGeneratorPluginOptions): Plugin;
|
|
29
|
+
//# sourceMappingURL=vite-plugin-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-icons.d.ts","sourceRoot":"","sources":["../src/vite-plugin-icons.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAGlC,MAAM,WAAW,0BAA0B;IACzC,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAA;IAElB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;IAE/C;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IAEnC,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,wDAAwD;IACxD,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAiBD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,MAAM,CAqJ/E"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
async function loadGeneratorFunctions() {
|
|
3
|
+
const module = await import("./scripts/generate-icons.js");
|
|
4
|
+
return {
|
|
5
|
+
loadConfig: module.loadConfig,
|
|
6
|
+
generateTypes: module.generateTypes,
|
|
7
|
+
generateLoaders: module.generateLoaders,
|
|
8
|
+
scanIconSources: module.scanIconSources
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function iconGeneratorPlugin(options) {
|
|
12
|
+
let config;
|
|
13
|
+
let root;
|
|
14
|
+
let isDevMode = false;
|
|
15
|
+
return {
|
|
16
|
+
name: "vite-plugin-icon-generator",
|
|
17
|
+
async configResolved(resolvedConfig) {
|
|
18
|
+
root = resolvedConfig.root;
|
|
19
|
+
isDevMode = resolvedConfig.command === "serve";
|
|
20
|
+
try {
|
|
21
|
+
const { loadConfig } = await loadGeneratorFunctions();
|
|
22
|
+
config = await loadConfig(options.configPath, root);
|
|
23
|
+
if (options.typesOnly && config.loaders) {
|
|
24
|
+
config = { ...config, loaders: { ...config.loaders, enabled: false } };
|
|
25
|
+
}
|
|
26
|
+
if (options.loadersOnly && config.types) {
|
|
27
|
+
config = { ...config, types: { ...config.types, enabled: false } };
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
this.error(`Icon Generator Plugin: ${error}`);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
async buildStart() {
|
|
34
|
+
if (!config) return;
|
|
35
|
+
const scanIconDirectory = config.types?.scanIconDirectory ?? options.scanIconDirectory ?? "watch";
|
|
36
|
+
const generateLoadersMode = config.loaders?.generateLoaders ?? options.generateLoaders ?? "watch";
|
|
37
|
+
const shouldGenerateTypes = scanIconDirectory !== "never" && config.types?.enabled;
|
|
38
|
+
const shouldGenerateLoaders = config.loaders?.enabled && (isDevMode ? generateLoadersMode === "start" : true);
|
|
39
|
+
if (!shouldGenerateTypes && !shouldGenerateLoaders) return;
|
|
40
|
+
console.log("🎨 [Icon Generator] Generating icons...");
|
|
41
|
+
try {
|
|
42
|
+
const { generateTypes, generateLoaders, scanIconSources } = await loadGeneratorFunctions();
|
|
43
|
+
let typesResult = shouldGenerateTypes ? await generateTypes(config, root) : null;
|
|
44
|
+
if (shouldGenerateLoaders) {
|
|
45
|
+
if (!typesResult && config.types?.enabled) {
|
|
46
|
+
typesResult = await scanIconSources(config, root);
|
|
47
|
+
}
|
|
48
|
+
await generateLoaders(config, root, typesResult || void 0);
|
|
49
|
+
}
|
|
50
|
+
console.log("✨ [Icon Generator] Done!");
|
|
51
|
+
} catch (error) {
|
|
52
|
+
this.error(`Icon Generator Plugin: ${error}`);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
async handleHotUpdate({ file, server }) {
|
|
56
|
+
if (!isDevMode || !config || options.watch === false) return;
|
|
57
|
+
const scanIconDirectory = config.types?.scanIconDirectory ?? options.scanIconDirectory ?? "watch";
|
|
58
|
+
const generateLoadersMode = config.loaders?.generateLoaders ?? options.generateLoaders ?? "watch";
|
|
59
|
+
const scanDirAbs = config.loaders?.enabled ? resolve(root, config.loaders.scanDir) : null;
|
|
60
|
+
const shouldRegenerateLoaders = generateLoadersMode === "watch" && config.loaders?.enabled && scanDirAbs && file.startsWith(scanDirAbs) && /\.(tsx?|jsx?)$/.test(file) && !file.endsWith(".generated.ts");
|
|
61
|
+
const sources = Array.isArray(config.source) ? config.source : [config.source];
|
|
62
|
+
const sourceAbsPaths = sources.filter((s) => s.directory).map((s) => resolve(root, s.directory));
|
|
63
|
+
const shouldRegenerateTypes = scanIconDirectory === "watch" && config.types?.enabled && file.endsWith(".svg") && sourceAbsPaths.some((path) => file.startsWith(path));
|
|
64
|
+
if (shouldRegenerateLoaders || shouldRegenerateTypes) {
|
|
65
|
+
console.log("🔄 [Icon Generator] File changed, regenerating...");
|
|
66
|
+
try {
|
|
67
|
+
const { generateTypes, generateLoaders, scanIconSources } = await loadGeneratorFunctions();
|
|
68
|
+
let typesResult = null;
|
|
69
|
+
if (shouldRegenerateTypes) {
|
|
70
|
+
typesResult = await generateTypes(config, root);
|
|
71
|
+
} else if (shouldRegenerateLoaders && config.types?.enabled) {
|
|
72
|
+
if (scanIconDirectory === "watch") {
|
|
73
|
+
typesResult = await generateTypes(config, root);
|
|
74
|
+
} else {
|
|
75
|
+
typesResult = await scanIconSources(config, root);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (shouldRegenerateLoaders) {
|
|
79
|
+
await generateLoaders(config, root, typesResult || void 0);
|
|
80
|
+
}
|
|
81
|
+
console.log("✅ [Icon Generator] Regenerated");
|
|
82
|
+
server.ws.send({
|
|
83
|
+
type: "full-reload",
|
|
84
|
+
path: "*"
|
|
85
|
+
});
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error("❌ [Icon Generator] Error:", error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
iconGeneratorPlugin
|
|
95
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@number10/phaserjsx",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Declarative Phaser3 + UI renderer core library",
|
|
6
|
+
"author": "Michael Rieck (Michael--) <mr@number10.de>",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"generate-icons": "./dist/scripts/generate-icons.js",
|
|
12
|
+
"generate-icon-types": "./dist/scripts/generate-icon-types.js",
|
|
13
|
+
"generate-icon-loaders": "./dist/scripts/generate-icon-loaders.js"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./jsx-runtime": {
|
|
22
|
+
"types": "./dist/jsx-runtime.d.ts",
|
|
23
|
+
"import": "./dist/jsx-runtime.js",
|
|
24
|
+
"require": "./dist/jsx-runtime.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./jsx-dev-runtime": {
|
|
27
|
+
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
28
|
+
"import": "./dist/jsx-dev-runtime.js",
|
|
29
|
+
"require": "./dist/jsx-dev-runtime.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./components/custom": {
|
|
32
|
+
"types": "./dist/components/custom/index.d.ts",
|
|
33
|
+
"import": "./dist/components/custom/index.js",
|
|
34
|
+
"require": "./dist/components/custom/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./scripts/icon-generator-config": {
|
|
37
|
+
"types": "./dist/scripts/icon-generator-config.d.ts",
|
|
38
|
+
"import": "./dist/scripts/icon-generator-config.js"
|
|
39
|
+
},
|
|
40
|
+
"./vite-plugin-icons": {
|
|
41
|
+
"types": "./dist/vite-plugin-icons.d.ts",
|
|
42
|
+
"import": "./dist/vite-plugin-icons.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
48
|
+
"keywords": [
|
|
49
|
+
"phaser",
|
|
50
|
+
"phaser3",
|
|
51
|
+
"declarative",
|
|
52
|
+
"typescript",
|
|
53
|
+
"game-engine",
|
|
54
|
+
"jsx",
|
|
55
|
+
"react-like",
|
|
56
|
+
"ui",
|
|
57
|
+
"components",
|
|
58
|
+
"hooks"
|
|
59
|
+
],
|
|
60
|
+
"license": "GPL-3.0-only",
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "https://github.com/number10/phaserjsx.git",
|
|
67
|
+
"directory": "packages/ui"
|
|
68
|
+
},
|
|
69
|
+
"homepage": "https://github.com/number10/phaserjsx",
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/number10/phaserjsx/issues"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@types/lodash": "^4.17.20",
|
|
75
|
+
"@types/node": "^24.10.1",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
77
|
+
"@typescript-eslint/parser": "^8.46.4",
|
|
78
|
+
"@vitest/coverage-v8": "4.0.8",
|
|
79
|
+
"eslint": "^9.39.1",
|
|
80
|
+
"eslint-config-prettier": "^10.1.8",
|
|
81
|
+
"eslint-plugin-import": "^2.32.0",
|
|
82
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
83
|
+
"happy-dom": "^20.0.10",
|
|
84
|
+
"jsdom": "^27.2.0",
|
|
85
|
+
"prettier": "^3.6.2",
|
|
86
|
+
"typescript": "^5.9.3",
|
|
87
|
+
"vite": "^7.2.2",
|
|
88
|
+
"vite-plugin-dts": "^4.5.4",
|
|
89
|
+
"vitest": "^4.0.8"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"phaser": "^3.90.0"
|
|
93
|
+
},
|
|
94
|
+
"peerDependenciesMeta": {
|
|
95
|
+
"phaser": {
|
|
96
|
+
"optional": false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"dependencies": {
|
|
100
|
+
"@preact/signals-core": "^1.12.1",
|
|
101
|
+
"fast-deep-equal": "^3.1.3",
|
|
102
|
+
"lodash": "^4.17.21",
|
|
103
|
+
"phaser3-rex-plugins": "^1.80.17",
|
|
104
|
+
"tsx": "^4.20.6"
|
|
105
|
+
},
|
|
106
|
+
"scripts": {
|
|
107
|
+
"dev": "vite build --watch",
|
|
108
|
+
"build": "tsc --noEmit && vite build && pnpm build:scripts",
|
|
109
|
+
"build:scripts": "vite build --config scripts.vite.config.ts && chmod +x dist/scripts/*.js",
|
|
110
|
+
"test": "vitest run",
|
|
111
|
+
"test:watch": "vitest",
|
|
112
|
+
"test:coverage": "vitest run --coverage",
|
|
113
|
+
"lint": "eslint .",
|
|
114
|
+
"format": "prettier --write .",
|
|
115
|
+
"typecheck": "tsc --noEmit"
|
|
116
|
+
}
|
|
117
|
+
}
|