@number10/phaserjsx 4.0.0 → 4.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.
Files changed (45) hide show
  1. package/README.md +30 -0
  2. package/dist/chunk-C2EiDwsr.cjs +35 -0
  3. package/dist/clip/index.cjs +696 -0
  4. package/dist/clip/index.cjs.map +1 -0
  5. package/dist/clip/index.d.ts +3 -0
  6. package/dist/clip/index.d.ts.map +1 -0
  7. package/dist/clip/index.js +688 -0
  8. package/dist/clip/index.js.map +1 -0
  9. package/dist/clip/stencil-clip-extension.d.ts +18 -0
  10. package/dist/clip/stencil-clip-extension.d.ts.map +1 -0
  11. package/dist/clip/stencil-clip.d.ts +55 -7
  12. package/dist/clip/stencil-clip.d.ts.map +1 -1
  13. package/dist/components/appliers/applyBackground.d.ts +2 -1
  14. package/dist/components/appliers/applyBackground.d.ts.map +1 -1
  15. package/dist/components/appliers/applyTooltip.d.ts.map +1 -1
  16. package/dist/components/backgroundImage.d.ts +12 -0
  17. package/dist/components/backgroundImage.d.ts.map +1 -0
  18. package/dist/components/creators/createBackground.d.ts +2 -1
  19. package/dist/components/creators/createBackground.d.ts.map +1 -1
  20. package/dist/components/custom/Accordion.d.ts.map +1 -1
  21. package/dist/components/custom/Dropdown.d.ts.map +1 -1
  22. package/dist/components/custom/index.cjs +1 -1
  23. package/dist/components/custom/index.js +1 -1
  24. package/dist/components/primitives/view.d.ts.map +1 -1
  25. package/dist/{custom-oy3mBnrW.js → custom-C_w8D39m.js} +178 -481
  26. package/dist/custom-C_w8D39m.js.map +1 -0
  27. package/dist/{custom-BN31OAJq.cjs → custom-Dp3yAJdU.cjs} +187 -515
  28. package/dist/custom-Dp3yAJdU.cjs.map +1 -0
  29. package/dist/hooks.d.ts +9 -8
  30. package/dist/hooks.d.ts.map +1 -1
  31. package/dist/index.cjs +103 -22
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +96 -22
  36. package/dist/index.js.map +1 -1
  37. package/dist/layout/appliers/background-applier.d.ts.map +1 -1
  38. package/dist/layout/layout-engine.d.ts.map +1 -1
  39. package/dist/layout/types.d.ts +2 -1
  40. package/dist/layout/types.d.ts.map +1 -1
  41. package/dist/scene-backgrounds.d.ts +51 -1
  42. package/dist/scene-backgrounds.d.ts.map +1 -1
  43. package/package.json +6 -1
  44. package/dist/custom-BN31OAJq.cjs.map +0 -1
  45. package/dist/custom-oy3mBnrW.js.map +0 -1
package/dist/hooks.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BackgroundImage } from './components/backgroundImage';
1
2
  import { Signal } from '@preact/signals-core';
2
3
  import { BackgroundProps, LayoutProps, TransformProps } from './core-props';
3
4
  import { LayoutSize } from './layout/types';
@@ -144,23 +145,23 @@ export declare function useLayoutSize(ref: {
144
145
  */
145
146
  export declare function getLayoutProps(container: Phaser.GameObjects.Container | null | undefined): (LayoutProps & BackgroundProps & TransformProps) | undefined;
146
147
  /**
147
- * Utility function to get background graphics from a container
148
- * Returns the Graphics object used for backgroundColor, border, cornerRadius
148
+ * Utility function to get background object from a container
149
+ * Returns the Image object used for backgroundColor, border, cornerRadius
149
150
  * Useful for custom animations or modifications
150
151
  * @param container - Phaser container with background
151
- * @returns Graphics object or undefined if container has no background
152
+ * @returns Background image or undefined if container has no background
152
153
  */
153
- export declare function getBackgroundGraphics(container: Phaser.GameObjects.Container | null | undefined): Phaser.GameObjects.Graphics | undefined;
154
+ export declare function getBackgroundGraphics(container: Phaser.GameObjects.Container | null | undefined): BackgroundImage | undefined;
154
155
  /**
155
- * Hook to get background graphics from a ref
156
- * Returns the Graphics object used for rendering the background
156
+ * Hook to get background image from a ref
157
+ * Returns the Image object used for rendering the background
157
158
  * Useful for animating background properties (tint, alpha, etc.)
158
159
  * @param ref - Ref to a Phaser container
159
- * @returns Graphics object or undefined
160
+ * @returns Background image or undefined
160
161
  */
161
162
  export declare function useBackgroundGraphics(ref: {
162
163
  current: Phaser.GameObjects.Container | null;
163
- }): Phaser.GameObjects.Graphics | undefined;
164
+ }): BackgroundImage | undefined;
164
165
  /**
165
166
  * Utility function to get layout rectangle (position + size) from a container
166
167
  * Returns local position (x, y) combined with layout size
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIpD,KAAK,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAA;AAElC;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,GAAG,GAAG,IAAI,CAMvC;AAKD,MAAM,MAAM,GAAG,GAAG;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAA;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,cAAc,EAAE,KAAK,CAAA;IACrB,MAAM,EAAE,UAAU,CAAA;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,CAAA;IACvC,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,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KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,QAiBjF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,QAuBvF;AAiBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CA0B5D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAoB1E;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,IAAI,CAKtC;AA6CD,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,QA2BhC"}
package/dist/index.cjs CHANGED
@@ -1,8 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_custom = require("./custom-BN31OAJq.cjs");
2
+ const require_chunk = require("./chunk-C2EiDwsr.cjs");
3
+ const require_custom = require("./custom-Dp3yAJdU.cjs");
3
4
  const require_jsx_runtime = require("./jsx-runtime.cjs");
5
+ const require_clip_index = require("./clip/index.cjs");
4
6
  let phaser = require("phaser");
5
- phaser = require_custom.__toESM(phaser, 1);
7
+ phaser = require_chunk.__toESM(phaser, 1);
6
8
  let _preact_signals_core = require("@preact/signals-core");
7
9
  //#region src/camera/use-camera-fx.ts
8
10
  /**
@@ -734,37 +736,95 @@ function useParticles(ref) {
734
736
  //#endregion
735
737
  //#region src/scene-backgrounds.ts
736
738
  var DEFAULT_LOGO_KEY = "phaser-jsx-logo";
739
+ /**
740
+ * Default scene background used when no explicit config is provided.
741
+ */
737
742
  var DEFAULT_BACKGROUND = {
738
743
  type: "grid",
739
744
  animation: "lemniscate",
740
745
  opacity: .15,
741
746
  color: 4890367
742
747
  };
748
+ var sceneBackgroundTextureId = 0;
749
+ function colorToCss(color) {
750
+ return `#${color.toString(16).padStart(6, "0")}`;
751
+ }
752
+ function createCanvasTexture(scene, width, height, draw) {
753
+ const textureKey = `__phaserjsx_scene_bg_${sceneBackgroundTextureId++}`;
754
+ const textureWidth = Math.max(1, Math.ceil(width));
755
+ const textureHeight = Math.max(1, Math.ceil(height));
756
+ const texture = scene.textures.createCanvas(textureKey, textureWidth, textureHeight);
757
+ if (!texture) throw new Error("Unable to create scene background texture");
758
+ const ctx = texture.getSourceImage().getContext("2d");
759
+ if (!ctx) throw new Error("Unable to create scene background canvas texture");
760
+ ctx.clearRect(0, 0, textureWidth, textureHeight);
761
+ draw(ctx, textureWidth, textureHeight);
762
+ texture.refresh();
763
+ return textureKey;
764
+ }
765
+ function removeTexture(scene, textureKey) {
766
+ if (textureKey && scene.textures.exists(textureKey)) scene.textures.remove(textureKey);
767
+ }
768
+ /**
769
+ * Adds a decorative background object to a Phaser scene.
770
+ *
771
+ * The helper owns all game objects, tweens, resize listeners, and generated textures it creates.
772
+ * It automatically cleans up on scene shutdown or destroy. Call `handle.destroy()` when removing
773
+ * the background earlier.
774
+ *
775
+ * @param scene - Phaser scene that receives the background.
776
+ * @param config - Background type, colors, opacity, animation, and optional logo texture key.
777
+ * @returns A handle for manual resize and cleanup, or `null` when `config.type` is `'none'`.
778
+ *
779
+ * @example
780
+ * ```ts
781
+ * const handle = addSceneBackground(scene, {
782
+ * type: 'grid',
783
+ * animation: 'wave',
784
+ * color: 0x4a9eff,
785
+ * opacity: 0.12,
786
+ * })
787
+ *
788
+ * // Later, if the background should be removed before scene shutdown:
789
+ * handle?.destroy()
790
+ * ```
791
+ */
743
792
  function addSceneBackground(scene, config = DEFAULT_BACKGROUND) {
744
793
  const bgConfig = config ?? DEFAULT_BACKGROUND;
745
794
  if (bgConfig.type === "none") return null;
746
795
  let background;
747
796
  let backgroundTween;
748
797
  const particleTweens = [];
798
+ const textureKeys = /* @__PURE__ */ new Set();
749
799
  let resizeFn;
750
800
  let destroyed = false;
751
801
  const createGridBackground = () => {
752
- const graphics = scene.add.graphics();
753
802
  const gridSize = 40;
754
803
  const color = bgConfig.color ?? 4890367;
755
804
  const opacity = bgConfig.opacity ?? .15;
756
- const drawGrid = (offsetX, offsetY) => {
757
- graphics.clear();
758
- graphics.lineStyle(1, color, opacity);
759
- const width = scene.scale.width;
760
- const height = scene.scale.height;
761
- for (let x = offsetX % gridSize; x < width; x += gridSize) graphics.lineBetween(x, 0, x, height);
762
- for (let y = offsetY % gridSize; y < height; y += gridSize) graphics.lineBetween(0, y, width, y);
805
+ const textureKey = createCanvasTexture(scene, gridSize, gridSize, (ctx, width, height) => {
806
+ ctx.globalAlpha = opacity;
807
+ ctx.strokeStyle = colorToCss(color);
808
+ ctx.lineWidth = 1;
809
+ ctx.beginPath();
810
+ ctx.moveTo(.5, 0);
811
+ ctx.lineTo(.5, height);
812
+ ctx.moveTo(0, .5);
813
+ ctx.lineTo(width, .5);
814
+ ctx.stroke();
815
+ });
816
+ textureKeys.add(textureKey);
817
+ const tile = scene.add.tileSprite(0, 0, scene.scale.width, scene.scale.height, textureKey);
818
+ tile.setOrigin(0, 0);
819
+ const moveGrid = (offsetX, offsetY) => {
820
+ tile.tilePositionX = -offsetX;
821
+ tile.tilePositionY = -offsetY;
822
+ };
823
+ tile.__redrawFn = moveGrid;
824
+ background = tile;
825
+ resizeFn = (width, height) => {
826
+ tile.setSize(width, height);
763
827
  };
764
- drawGrid(0, 0);
765
- graphics.__redrawFn = drawGrid;
766
- background = graphics;
767
- resizeFn = () => drawGrid(0, 0);
768
828
  };
769
829
  const createLogoBackground = () => {
770
830
  const container = scene.add.container(scene.scale.width / 2, scene.scale.height / 2);
@@ -780,18 +840,31 @@ function addSceneBackground(scene, config = DEFAULT_BACKGROUND) {
780
840
  };
781
841
  };
782
842
  const createGradientBackground = () => {
783
- const graphics = scene.add.graphics();
784
843
  const color1 = bgConfig.color ?? 4890367;
785
844
  const color2 = bgConfig.colorSecondary ?? 7031551;
786
845
  const opacity = bgConfig.opacity ?? .2;
787
- const drawGradient = () => {
788
- graphics.clear();
789
- graphics.fillGradientStyle(color1, color1, color2, color2, opacity, opacity, opacity, opacity);
790
- graphics.fillRect(0, 0, scene.scale.width, scene.scale.height);
846
+ const createGradientTexture = (width, height) => createCanvasTexture(scene, width, height, (ctx, textureWidth, textureHeight) => {
847
+ const gradient = ctx.createLinearGradient(0, 0, 0, textureHeight);
848
+ gradient.addColorStop(0, colorToCss(color1));
849
+ gradient.addColorStop(1, colorToCss(color2));
850
+ ctx.globalAlpha = opacity;
851
+ ctx.fillStyle = gradient;
852
+ ctx.fillRect(0, 0, textureWidth, textureHeight);
853
+ });
854
+ let textureKey = createGradientTexture(scene.scale.width, scene.scale.height);
855
+ textureKeys.add(textureKey);
856
+ const image = scene.add.image(0, 0, textureKey);
857
+ image.setOrigin(0, 0);
858
+ resizeFn = (width, height) => {
859
+ const previousTextureKey = textureKey;
860
+ textureKey = createGradientTexture(width, height);
861
+ textureKeys.add(textureKey);
862
+ image.setTexture(textureKey);
863
+ image.setDisplaySize(width, height);
864
+ textureKeys.delete(previousTextureKey);
865
+ removeTexture(scene, previousTextureKey);
791
866
  };
792
- drawGradient();
793
- background = graphics;
794
- resizeFn = drawGradient;
867
+ background = image;
795
868
  };
796
869
  const createParticlesBackground = () => {
797
870
  const container = scene.add.container(0, 0);
@@ -848,6 +921,8 @@ function addSceneBackground(scene, config = DEFAULT_BACKGROUND) {
848
921
  for (const tween of particleTweens) tween.stop();
849
922
  background?.destroy();
850
923
  background = void 0;
924
+ for (const textureKey of textureKeys) removeTexture(scene, textureKey);
925
+ textureKeys.clear();
851
926
  scene.scale.off(phaser.Scale.Events.RESIZE, onResize);
852
927
  scene.events.off(phaser.Scenes.Events.SHUTDOWN, cleanup);
853
928
  scene.events.off(phaser.Scenes.Events.DESTROY, cleanup);
@@ -1481,10 +1556,12 @@ exports.applyDarkMode = require_custom.applyDarkMode;
1481
1556
  exports.applyEffectByName = require_custom.applyEffectByName;
1482
1557
  exports.applyFXByName = applyFXByName;
1483
1558
  exports.applyLightMode = require_custom.applyLightMode;
1559
+ exports.applyStencilClip = require_clip_index.applyStencilClip;
1484
1560
  exports.buildDeathZonesFromLayout = require_custom.buildDeathZonesFromLayout;
1485
1561
  exports.buildEmitZone = require_custom.buildEmitZone;
1486
1562
  exports.buildEmitZoneFromLayout = require_custom.buildEmitZoneFromLayout;
1487
1563
  exports.calculateSliderSize = require_custom.calculateSliderSize;
1564
+ exports.clearStencilClip = require_clip_index.clearStencilClip;
1488
1565
  exports.colorsToTheme = colorsToTheme;
1489
1566
  exports.computed = _preact_signals_core.computed;
1490
1567
  exports.createBlurFX = createBlurFX;
@@ -1551,6 +1628,7 @@ exports.getMountStats = require_custom.getMountStats;
1551
1628
  exports.getPreset = require_custom.getPreset;
1552
1629
  exports.getPresetWithMode = require_custom.getPresetWithMode;
1553
1630
  exports.getRenderContext = require_custom.getRenderContext;
1631
+ exports.getStencilClipHandle = require_clip_index.getStencilClipHandle;
1554
1632
  exports.getSurfaceColor = getSurfaceColor;
1555
1633
  exports.getTextColor = getTextColor;
1556
1634
  exports.getThemedProps = require_custom.getThemedProps;
@@ -1562,7 +1640,9 @@ exports.hexToNumber = require_custom.hexToNumber;
1562
1640
  exports.host = require_custom.host;
1563
1641
  exports.imageCreator = require_custom.imageCreator;
1564
1642
  exports.imagePatcher = require_custom.imagePatcher;
1643
+ exports.installStencilClipExtension = require_clip_index.installStencilClipExtension;
1565
1644
  exports.isAnimatedSignal = require_custom.isAnimatedSignal;
1645
+ exports.isBitmapStencilClipSource = require_clip_index.isBitmapStencilClipSource;
1566
1646
  exports.jsx = require_jsx_runtime.jsx;
1567
1647
  exports.jsxs = require_jsx_runtime.jsxs;
1568
1648
  exports.lighten = require_custom.lighten;
@@ -1613,6 +1693,7 @@ exports.textPatcher = require_custom.textPatcher;
1613
1693
  exports.themeRegistry = require_custom.themeRegistry;
1614
1694
  exports.tileSpriteCreator = require_custom.tileSpriteCreator;
1615
1695
  exports.tileSpritePatcher = require_custom.tileSpritePatcher;
1696
+ exports.uninstallStencilClipExtension = require_clip_index.uninstallStencilClipExtension;
1616
1697
  exports.unmount = require_custom.unmount;
1617
1698
  exports.unmountJSX = require_custom.unmountJSX;
1618
1699
  exports.unwrapSignal = require_custom.unwrapSignal;