@number10/phaserjsx 4.0.0 → 4.2.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 (64) hide show
  1. package/README.md +30 -0
  2. package/dist/chunk-C2EiDwsr.cjs +35 -0
  3. package/dist/clip/index.cjs +8 -0
  4. package/dist/clip/index.d.ts +3 -0
  5. package/dist/clip/index.d.ts.map +1 -0
  6. package/dist/clip/index.js +2 -0
  7. package/dist/clip/stencil-clip-depth.d.ts +10 -0
  8. package/dist/clip/stencil-clip-depth.d.ts.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-fbo-bridge.d.ts +7 -0
  12. package/dist/clip/stencil-clip-fbo-bridge.d.ts.map +1 -0
  13. package/dist/clip/stencil-clip-renderer.d.ts +7 -0
  14. package/dist/clip/stencil-clip-renderer.d.ts.map +1 -0
  15. package/dist/clip/stencil-clip-state.d.ts +28 -0
  16. package/dist/clip/stencil-clip-state.d.ts.map +1 -0
  17. package/dist/clip/stencil-clip-types.d.ts +67 -0
  18. package/dist/clip/stencil-clip-types.d.ts.map +1 -0
  19. package/dist/clip/stencil-clip.d.ts +9 -42
  20. package/dist/clip/stencil-clip.d.ts.map +1 -1
  21. package/dist/clip-CHmjztBQ.cjs +705 -0
  22. package/dist/clip-CHmjztBQ.cjs.map +1 -0
  23. package/dist/clip-CPufWCSD.js +668 -0
  24. package/dist/clip-CPufWCSD.js.map +1 -0
  25. package/dist/components/appliers/applyBackground.d.ts +2 -1
  26. package/dist/components/appliers/applyBackground.d.ts.map +1 -1
  27. package/dist/components/appliers/applyTooltip.d.ts.map +1 -1
  28. package/dist/components/backgroundImage.d.ts +12 -0
  29. package/dist/components/backgroundImage.d.ts.map +1 -0
  30. package/dist/components/creators/createBackground.d.ts +2 -1
  31. package/dist/components/creators/createBackground.d.ts.map +1 -1
  32. package/dist/components/custom/Accordion.d.ts.map +1 -1
  33. package/dist/components/custom/DebugPanel.d.ts +30 -0
  34. package/dist/components/custom/DebugPanel.d.ts.map +1 -0
  35. package/dist/components/custom/Dropdown.d.ts.map +1 -1
  36. package/dist/components/custom/Toggle.d.ts.map +1 -1
  37. package/dist/components/custom/index.cjs +2 -1
  38. package/dist/components/custom/index.d.ts +1 -0
  39. package/dist/components/custom/index.d.ts.map +1 -1
  40. package/dist/components/custom/index.js +2 -2
  41. package/dist/components/primitives/graphics.d.ts +2 -2
  42. package/dist/components/primitives/view.d.ts.map +1 -1
  43. package/dist/{custom-oy3mBnrW.js → custom-BXDJDGOl.js} +439 -485
  44. package/dist/custom-BXDJDGOl.js.map +1 -0
  45. package/dist/{custom-BN31OAJq.cjs → custom-DTd4LxDn.cjs} +459 -518
  46. package/dist/custom-DTd4LxDn.cjs.map +1 -0
  47. package/dist/gestures/gesture-manager.d.ts +1 -1
  48. package/dist/hooks.d.ts +9 -8
  49. package/dist/hooks.d.ts.map +1 -1
  50. package/dist/index.cjs +105 -106
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +96 -105
  55. package/dist/index.js.map +1 -1
  56. package/dist/layout/appliers/background-applier.d.ts.map +1 -1
  57. package/dist/layout/layout-engine.d.ts.map +1 -1
  58. package/dist/layout/types.d.ts +2 -1
  59. package/dist/layout/types.d.ts.map +1 -1
  60. package/dist/scene-backgrounds.d.ts +51 -1
  61. package/dist/scene-backgrounds.d.ts.map +1 -1
  62. package/package.json +8 -2
  63. package/dist/custom-BN31OAJq.cjs.map +0 -1
  64. package/dist/custom-oy3mBnrW.js.map +0 -1
package/README.md CHANGED
@@ -27,6 +27,7 @@ The 4.x line uses Phaser 4 render steps, filters, and WebGL behavior and is not
27
27
  - 📱 **Responsive Design** - Flexible layout with multiple size value formats (px, %, vw/vh, fill, auto, calc)
28
28
  - 🔧 **Custom Components** - Easy to create and integrate custom components
29
29
  - 🎮 **Phaser Integration** - Seamless integration with Phaser 4 game objects and scenes
30
+ - ✂️ **Stencil Clipping** - Native Phaser Container stencil clips with fast rounded rectangles and bitmap masks
30
31
  - 📊 **SVG Support** - Convert SVG to Phaser textures with caching
31
32
  - 🚀 **Performance** - Optimized VDOM reconciliation with smart dirty checking
32
33
 
@@ -97,6 +98,35 @@ const config: Phaser.Types.Core.GameConfig = {
97
98
  new Phaser.Game(config)
98
99
  ```
99
100
 
101
+ ## ✂️ Standalone Stencil Clip
102
+
103
+ The stencil clip extension can be used directly with native Phaser Containers, with or without PhaserJSX components:
104
+
105
+ ```ts
106
+ import '@number10/phaserjsx/clip'
107
+
108
+ const panel = this.add.container(40, 40)
109
+
110
+ panel.setStencilClip({
111
+ kind: 'roundRect',
112
+ width: 220,
113
+ height: 120,
114
+ cornerRadius: 16,
115
+ })
116
+ ```
117
+
118
+ Bitmap masks are also supported. They are evaluated as hard stencil masks using an alpha threshold:
119
+
120
+ ```ts
121
+ panel.setStencilClip({
122
+ kind: 'bitmap',
123
+ texture: 'panel-mask',
124
+ width: 220,
125
+ height: 120,
126
+ alphaThreshold: 0.5,
127
+ })
128
+ ```
129
+
100
130
  ## 📖 Documentation
101
131
 
102
132
  [📖 Full Documentation](https://michael--.github.io/phaserjsx/)
@@ -0,0 +1,35 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ Object.defineProperty(exports, "__commonJSMin", {
25
+ enumerable: true,
26
+ get: function() {
27
+ return __commonJSMin;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "__toESM", {
31
+ enumerable: true,
32
+ get: function() {
33
+ return __toESM;
34
+ }
35
+ });
@@ -0,0 +1,8 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_clip = require("../clip-CHmjztBQ.cjs");
3
+ exports.applyStencilClip = require_clip.applyStencilClip;
4
+ exports.clearStencilClip = require_clip.clearStencilClip;
5
+ exports.getStencilClipHandle = require_clip.getStencilClipHandle;
6
+ exports.installStencilClipExtension = require_clip.installStencilClipExtension;
7
+ exports.isBitmapStencilClipSource = require_clip.isBitmapStencilClipSource;
8
+ exports.uninstallStencilClipExtension = require_clip.uninstallStencilClipExtension;
@@ -0,0 +1,3 @@
1
+ export * from './stencil-clip';
2
+ export * from './stencil-clip-extension';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clip/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { a as getStencilClipHandle, i as clearStencilClip, n as uninstallStencilClipExtension, o as isBitmapStencilClipSource, r as applyStencilClip, t as installStencilClipExtension } from "../clip-CPufWCSD.js";
2
+ export { applyStencilClip, clearStencilClip, getStencilClipHandle, installStencilClipExtension, isBitmapStencilClipSource, uninstallStencilClipExtension };
@@ -0,0 +1,10 @@
1
+ import type * as Phaser from 'phaser';
2
+ export declare function getDepth(gl: WebGLRenderingContext): {
3
+ value: number;
4
+ };
5
+ /**
6
+ * Registers a per-frame prerender listener that resets stencil clip state.
7
+ * Registered at most once per Phaser.Game instance.
8
+ */
9
+ export declare function ensurePrerenderReset(gl: WebGLRenderingContext, game: Phaser.Game, resetFboState: (gl: WebGLRenderingContext) => void): void;
10
+ //# sourceMappingURL=stencil-clip-depth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stencil-clip-depth.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-depth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AAUrC,wBAAgB,QAAQ,CAAC,EAAE,EAAE,qBAAqB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAOrE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,qBAAqB,EACzB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,aAAa,EAAE,CAAC,EAAE,EAAE,qBAAqB,KAAK,IAAI,GACjD,IAAI,CAQN"}
@@ -0,0 +1,18 @@
1
+ import { StencilClipHandle, StencilClipSource, StencilClipUpdate } from './stencil-clip';
2
+ /** Installs stencil clip helpers on Phaser.GameObjects.Container.prototype. */
3
+ export declare function installStencilClipExtension(): void;
4
+ /** Restores Phaser prototypes to their previous state. Intended for tests/HMR. */
5
+ export declare function uninstallStencilClipExtension(): void;
6
+ declare global {
7
+ namespace Phaser {
8
+ namespace GameObjects {
9
+ interface Container {
10
+ setStencilClip(source: StencilClipSource): this;
11
+ updateStencilClip(source: StencilClipUpdate): this;
12
+ clearStencilClip(): this;
13
+ getStencilClipHandle(): StencilClipHandle | undefined;
14
+ }
15
+ }
16
+ }
17
+ }
18
+ //# sourceMappingURL=stencil-clip-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stencil-clip-extension.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-extension.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAA;AAkEvB,+EAA+E;AAC/E,wBAAgB,2BAA2B,IAAI,IAAI,CAkDlD;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM,CAAC;QACf,UAAU,WAAW,CAAC;YACpB,UAAU,SAAS;gBACjB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;gBAC/C,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;gBAClD,gBAAgB,IAAI,IAAI,CAAA;gBACxB,oBAAoB,IAAI,iBAAiB,GAAG,SAAS,CAAA;aACtD;SACF;KACF;CACF"}
@@ -0,0 +1,7 @@
1
+ export declare function resetFboPatchState(gl: WebGLRenderingContext): void;
2
+ /**
3
+ * Patches gl.bindFramebuffer once per GL context so that the stencil test is
4
+ * disabled while Phaser renders PostFX / RenderTextures into off-screen FBOs.
5
+ */
6
+ export declare function ensureFboPatch(gl: WebGLRenderingContext): void;
7
+ //# sourceMappingURL=stencil-clip-fbo-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stencil-clip-fbo-bridge.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-fbo-bridge.ts"],"names":[],"mappings":"AAuBA,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,qBAAqB,GAAG,IAAI,CAMlE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,qBAAqB,GAAG,IAAI,CAsC9D"}
@@ -0,0 +1,7 @@
1
+ import { MaskState } from './stencil-clip-state';
2
+ import type * as Phaser from 'phaser';
3
+ export type GLPolyfilled = WebGLRenderingContext & {
4
+ bindVertexArray(vao: WebGLVertexArrayObject | null): void;
5
+ };
6
+ export declare function drawMaskShape(gl: GLPolyfilled, scene: Phaser.Scene, matrix: Phaser.GameObjects.Components.TransformMatrix, cameraMatrix: Phaser.GameObjects.Components.TransformMatrix | undefined, source: MaskState, logW: number, logH: number, vertBuf: WebGLBuffer, verts: Float32Array): void;
7
+ //# sourceMappingURL=stencil-clip-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stencil-clip-renderer.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAGtE,MAAM,MAAM,YAAY,GAAG,qBAAqB,GAAG;IACjD,eAAe,CAAC,GAAG,EAAE,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1D,CAAA;AA4YD,wBAAgB,aAAa,CAC3B,EAAE,EAAE,YAAY,EAChB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,eAAe,EACrD,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,eAAe,GAAG,SAAS,EACvE,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,YAAY,GAClB,IAAI,CAkCN"}
@@ -0,0 +1,28 @@
1
+ import { StencilBitmapClipSource, StencilBitmapTexture, StencilClipSource, StencilClipUpdate } from './stencil-clip-types';
2
+ export type RoundRectMaskState = {
3
+ kind: 'roundRect';
4
+ width: number;
5
+ height: number;
6
+ offsetX: number;
7
+ offsetY: number;
8
+ radii: [number, number, number, number];
9
+ };
10
+ export type BitmapMaskState = {
11
+ kind: 'bitmap';
12
+ texture: StencilBitmapTexture;
13
+ frame: string | number | undefined;
14
+ width: number | undefined;
15
+ height: number | undefined;
16
+ offsetX: number;
17
+ offsetY: number;
18
+ alphaThreshold: number;
19
+ invertAlpha: boolean;
20
+ };
21
+ export type MaskState = RoundRectMaskState | BitmapMaskState;
22
+ /** Returns true when a source/update selects the bitmap mask renderer. */
23
+ export declare function isBitmapStencilClipSource(source: StencilClipUpdate): source is Partial<StencilBitmapClipSource> & {
24
+ kind: 'bitmap';
25
+ };
26
+ export declare function toMaskState(source: StencilClipSource): MaskState;
27
+ export declare function mergeMaskState(current: MaskState, update: StencilClipUpdate): MaskState;
28
+ //# sourceMappingURL=stencil-clip-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stencil-clip-state.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EAGlB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,oBAAoB,CAAA;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IAClC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,kBAAkB,GAAG,eAAe,CAAA;AAU5D,0EAA0E;AAC1E,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,GACxB,MAAM,IAAI,OAAO,CAAC,uBAAuB,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAEjE;AA2BD,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAEhE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAyDvF"}
@@ -0,0 +1,67 @@
1
+ import type * as Phaser from 'phaser';
2
+ /** Per-corner radius specification (values in local/CSS units). */
3
+ export type StencilCornerRadius = {
4
+ tl?: number;
5
+ tr?: number;
6
+ bl?: number;
7
+ br?: number;
8
+ };
9
+ /** Describes a rounded-rectangle clip in the container's local coordinate space. */
10
+ export interface StencilRoundRectClipSource {
11
+ /**
12
+ * Clip source kind.
13
+ * Omit for backwards-compatible `applyStencilClip(container, { width, height })` calls.
14
+ */
15
+ kind?: 'rect' | 'roundRect';
16
+ /** Width of the clip rect in local units. */
17
+ width: number;
18
+ /** Height of the clip rect in local units. */
19
+ height: number;
20
+ /** X coordinate of the top-left corner in local space. Defaults to 0. */
21
+ offsetX?: number;
22
+ /** Y coordinate of the top-left corner in local space. Defaults to 0. */
23
+ offsetY?: number;
24
+ /**
25
+ * Corner radii in local units.
26
+ * A single number applies to all four corners uniformly.
27
+ * An object sets each corner individually; missing corners default to 0.
28
+ */
29
+ cornerRadius?: number | StencilCornerRadius;
30
+ }
31
+ /** Backwards-compatible alias for the original rounded-rectangle shape API. */
32
+ export type StencilClipShape = StencilRoundRectClipSource;
33
+ /** Texture reference accepted by bitmap stencil clips. */
34
+ export type StencilBitmapTexture = string | Phaser.Textures.Texture | Phaser.Textures.Frame;
35
+ /** Describes a bitmap alpha clip in the container's local coordinate space. */
36
+ export interface StencilBitmapClipSource {
37
+ /** Selects the texture-alpha mask renderer. */
38
+ kind: 'bitmap';
39
+ /** Texture key, Phaser texture, or Phaser frame to sample for mask alpha. */
40
+ texture: StencilBitmapTexture;
41
+ /** Optional frame name/index when `texture` is a key or Texture. */
42
+ frame?: string | number;
43
+ /** Width of the bitmap mask in local units. Defaults to the selected frame's pixel width. */
44
+ width?: number;
45
+ /** Height of the bitmap mask in local units. Defaults to the selected frame's pixel height. */
46
+ height?: number;
47
+ /** X coordinate of the top-left corner in local space. Defaults to 0. */
48
+ offsetX?: number;
49
+ /** Y coordinate of the top-left corner in local space. Defaults to 0. */
50
+ offsetY?: number;
51
+ /** Minimum sampled alpha required to write the stencil. Defaults to 0.5. */
52
+ alphaThreshold?: number;
53
+ /** Inverts the alpha test, clipping inside transparent pixels. Defaults to false. */
54
+ invertAlpha?: boolean;
55
+ }
56
+ /** Any mask source supported by the stencil clip renderer. */
57
+ export type StencilClipSource = StencilRoundRectClipSource | StencilBitmapClipSource;
58
+ /** Partial source updates accepted by an existing clip handle. */
59
+ export type StencilClipUpdate = Partial<StencilRoundRectClipSource> | Partial<StencilBitmapClipSource> | StencilClipSource;
60
+ /** Handle returned by applyStencilClip to update or remove the clip. */
61
+ export interface StencilClipHandle {
62
+ /** Updates the clip source. Changes take effect on the next rendered frame. */
63
+ update(source: StencilClipUpdate): void;
64
+ /** Removes the clip and restores the container's original render step. */
65
+ destroy(): void;
66
+ }
67
+ //# sourceMappingURL=stencil-clip-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stencil-clip-types.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAA;AAErC,mEAAmE;AACnE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC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AClE,MAAM,MAAM,iBAAiB,GACzB,OAAO,CAAC,0BAA0B,CAAC,GACnC,OAAO,CAAC,uBAAuB,CAAC,GAChC,iBAAiB,CAAA;AAErB,wEAAwE;AACxE,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACvC,0EAA0E;IAC1E,OAAO,IAAI,IAAI,CAAA;CAChB"}
@@ -1,3 +1,4 @@
1
+ import { StencilClipHandle, StencilClipSource } from './stencil-clip-types';
1
2
  /**
2
3
  * WebGL stencil-buffer clip for Phaser 4 Containers.
3
4
  *
@@ -18,46 +19,12 @@
18
19
  * render time, so no per-layout world-position tracking is needed.
19
20
  */
20
21
  import * as Phaser from 'phaser';
21
- /** Per-corner radius specification (values in local/CSS units). */
22
- export type StencilCornerRadius = {
23
- tl?: number;
24
- tr?: number;
25
- bl?: number;
26
- br?: number;
27
- };
28
- /** Describes the clip rectangle in the container's local coordinate space. */
29
- export interface StencilClipShape {
30
- /** Width of the clip rect in local units. */
31
- width: number;
32
- /** Height of the clip rect in local units. */
33
- height: number;
34
- /**
35
- * X coordinate of the top-left corner in local space.
36
- * Defaults to 0 (the container's local origin).
37
- */
38
- offsetX?: number;
39
- /**
40
- * Y coordinate of the top-left corner in local space.
41
- * Defaults to 0 (the container's local origin).
42
- */
43
- offsetY?: number;
44
- /**
45
- * Corner radii in local units.
46
- * A single number applies to all four corners uniformly.
47
- * An object sets each corner individually; missing corners default to 0.
48
- */
49
- cornerRadius?: number | StencilCornerRadius;
50
- }
51
- /** Handle returned by {@link applyStencilClip} to update or remove the clip. */
52
- export interface StencilClipHandle {
53
- /**
54
- * Updates the clip shape. Changes take effect on the next rendered frame.
55
- * @param shape - Partial overrides merged with the current shape.
56
- */
57
- update(shape: Partial<StencilClipShape>): void;
58
- /** Removes the clip and restores the container's original render step. */
59
- destroy(): void;
60
- }
22
+ export { isBitmapStencilClipSource } from './stencil-clip-state';
23
+ export type { StencilBitmapClipSource, StencilBitmapTexture, StencilClipHandle, StencilClipShape, StencilClipSource, StencilClipUpdate, StencilCornerRadius, StencilRoundRectClipSource, } from './stencil-clip-types';
24
+ /** Returns the active stencil clip handle attached to a container, if any. */
25
+ export declare function getStencilClipHandle(container: Phaser.GameObjects.Container): StencilClipHandle | undefined;
26
+ /** Removes any active stencil clip from a container. */
27
+ export declare function clearStencilClip(container: Phaser.GameObjects.Container): void;
61
28
  /**
62
29
  * Applies a WebGL stencil-buffer clip to a Phaser 4 Container.
63
30
  *
@@ -79,8 +46,8 @@ export interface StencilClipHandle {
79
46
  * returns it.
80
47
  *
81
48
  * @param container - The container to clip.
82
- * @param shape - Clip rect geometry in local units.
49
+ * @param source - Clip source in the container's local coordinate space.
83
50
  * @returns A handle to modify dimensions / corner radii or remove the clip.
84
51
  */
85
- export declare function applyStencilClip(container: Phaser.GameObjects.Container, shape: StencilClipShape): StencilClipHandle;
52
+ export declare function applyStencilClip(container: Phaser.GameObjects.Container, source: StencilClipSource): StencilClipHandle;
86
53
  //# sourceMappingURL=stencil-clip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stencil-clip.d.ts","sourceRoot":"","sources":["../../src/clip/stencil-clip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAehC,mEAAmE;AACnE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IA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