@number10/phaserjsx 4.1.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.
- package/dist/clip/index.cjs +7 -695
- package/dist/clip/index.js +1 -687
- package/dist/clip/stencil-clip-depth.d.ts +10 -0
- package/dist/clip/stencil-clip-depth.d.ts.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts +7 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts.map +1 -0
- package/dist/clip/stencil-clip-renderer.d.ts +7 -0
- package/dist/clip/stencil-clip-renderer.d.ts.map +1 -0
- package/dist/clip/stencil-clip-state.d.ts +28 -0
- package/dist/clip/stencil-clip-state.d.ts.map +1 -0
- package/dist/clip/stencil-clip-types.d.ts +67 -0
- package/dist/clip/stencil-clip-types.d.ts.map +1 -0
- package/dist/clip/stencil-clip.d.ts +3 -84
- package/dist/clip/stencil-clip.d.ts.map +1 -1
- package/dist/clip-CHmjztBQ.cjs +705 -0
- package/dist/clip-CHmjztBQ.cjs.map +1 -0
- package/dist/clip-CPufWCSD.js +668 -0
- package/dist/clip-CPufWCSD.js.map +1 -0
- package/dist/components/custom/DebugPanel.d.ts +30 -0
- package/dist/components/custom/DebugPanel.d.ts.map +1 -0
- package/dist/components/custom/Toggle.d.ts.map +1 -1
- package/dist/components/custom/index.cjs +2 -1
- package/dist/components/custom/index.d.ts +1 -0
- package/dist/components/custom/index.d.ts.map +1 -1
- package/dist/components/custom/index.js +2 -2
- package/dist/components/primitives/graphics.d.ts +2 -2
- package/dist/{custom-C_w8D39m.js → custom-BXDJDGOl.js} +262 -5
- package/dist/custom-BXDJDGOl.js.map +1 -0
- package/dist/{custom-Dp3yAJdU.cjs → custom-DTd4LxDn.cjs} +273 -4
- package/dist/custom-DTd4LxDn.cjs.map +1 -0
- package/dist/gestures/gesture-manager.d.ts +1 -1
- package/dist/index.cjs +10 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -86
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/clip/index.cjs.map +0 -1
- package/dist/clip/index.js.map +0 -1
- package/dist/custom-C_w8D39m.js.map +0 -1
- package/dist/custom-Dp3yAJdU.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip-CPufWCSD.js","names":[],"sources":["../src/clip/stencil-clip-depth.ts","../src/clip/stencil-clip-fbo-bridge.ts","../src/clip/stencil-clip-renderer.ts","../src/clip/stencil-clip-state.ts","../src/clip/stencil-clip.ts","../src/clip/stencil-clip-extension.ts","../src/clip/index.ts"],"sourcesContent":["import type * as Phaser from 'phaser'\n\n/**\n * Shared depth counter per GL context.\n * Incremented before each clip's INCR pass, decremented after the DECR pass.\n */\nconst _depthByGl = new WeakMap<WebGLRenderingContext, { value: number }>()\n\nconst _prerenderHooked = new WeakSet<Phaser.Game>()\n\nexport function getDepth(gl: WebGLRenderingContext): { value: number } {\n let d = _depthByGl.get(gl)\n if (!d) {\n d = { value: 0 }\n _depthByGl.set(gl, d)\n }\n return d\n}\n\n/**\n * Registers a per-frame prerender listener that resets stencil clip state.\n * Registered at most once per Phaser.Game instance.\n */\nexport function ensurePrerenderReset(\n gl: WebGLRenderingContext,\n game: Phaser.Game,\n resetFboState: (gl: WebGLRenderingContext) => void\n): void {\n if (_prerenderHooked.has(game)) return\n _prerenderHooked.add(game)\n game.events.on('prerender', () => {\n const d = _depthByGl.get(gl)\n if (d) d.value = 0\n resetFboState(gl)\n })\n}\n","/**\n * Saved stencil state captured just before entering an off-screen FBO.\n * All fields are raw GL enum values / integers from gl.getParameter.\n */\ninterface SavedStencil {\n func: number\n ref: number\n valueMask: number\n fail: number\n zfail: number\n zpass: number\n writeMask: number\n}\n\ninterface FboPatchState {\n /** Last framebuffer bound through the patched bindFramebuffer call. */\n current: WebGLFramebuffer | null\n /** Stencil state saved when transitioning from main framebuffer to an FBO. */\n saved: SavedStencil | null\n}\n\nconst _fboPatchByGl = new WeakMap<WebGLRenderingContext, FboPatchState>()\n\nexport function resetFboPatchState(gl: WebGLRenderingContext): void {\n const fbo = _fboPatchByGl.get(gl)\n if (fbo) {\n fbo.current = null\n fbo.saved = null\n }\n}\n\n/**\n * Patches gl.bindFramebuffer once per GL context so that the stencil test is\n * disabled while Phaser renders PostFX / RenderTextures into off-screen FBOs.\n */\nexport function ensureFboPatch(gl: WebGLRenderingContext): void {\n if (_fboPatchByGl.has(gl)) return\n\n const state: FboPatchState = { current: null, saved: null }\n _fboPatchByGl.set(gl, state)\n\n const origBind = gl.bindFramebuffer.bind(gl)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(gl as any).bindFramebuffer = (target: number, fb: WebGLFramebuffer | null) => {\n const wasMain = state.current === null\n const willBeMain = fb === null\n const enteringOffscreen = wasMain && !willBeMain\n const leavingOffscreen = !wasMain && willBeMain\n\n if (enteringOffscreen && (gl.getParameter(gl.STENCIL_TEST) as boolean)) {\n state.saved = {\n func: gl.getParameter(gl.STENCIL_FUNC) as number,\n ref: gl.getParameter(gl.STENCIL_REF) as number,\n valueMask: gl.getParameter(gl.STENCIL_VALUE_MASK) as number,\n fail: gl.getParameter(gl.STENCIL_FAIL) as number,\n zfail: gl.getParameter(gl.STENCIL_PASS_DEPTH_FAIL) as number,\n zpass: gl.getParameter(gl.STENCIL_PASS_DEPTH_PASS) as number,\n writeMask: gl.getParameter(gl.STENCIL_WRITEMASK) as number,\n }\n gl.disable(gl.STENCIL_TEST)\n }\n\n origBind(target, fb)\n state.current = fb\n\n if (leavingOffscreen && state.saved) {\n gl.enable(gl.STENCIL_TEST)\n gl.stencilFunc(state.saved.func, state.saved.ref, state.saved.valueMask)\n gl.stencilOp(state.saved.fail, state.saved.zfail, state.saved.zpass)\n gl.stencilMask(state.saved.writeMask)\n state.saved = null\n }\n }\n}\n","import type * as Phaser from 'phaser'\nimport type { BitmapMaskState, MaskState } from './stencil-clip-state'\nimport type { StencilBitmapTexture } from './stencil-clip-types'\n\nexport type GLPolyfilled = WebGLRenderingContext & {\n bindVertexArray(vao: WebGLVertexArrayObject | null): void\n}\n\ntype GLWrapperLike = {\n state?: {\n bindings?: {\n activeTexture?: number\n arrayBuffer?: unknown\n program?: unknown\n }\n vao?: unknown\n }\n update?(state: unknown, force?: boolean, vaoLast?: boolean): void\n updateBindingsActiveTexture?(state: unknown, force?: boolean): void\n}\n\ntype SavedPhaserGLState = {\n activeTexture: number | undefined\n arrayBuffer: unknown\n program: unknown\n vao: unknown\n}\n\nfunction savePhaserGLState(renderer: Phaser.Renderer.WebGL.WebGLRenderer): SavedPhaserGLState {\n const glWrapper = renderer.glWrapper as unknown as GLWrapperLike\n\n // Phaser 4 caches GL bindings; raw gl.* restoration is not enough.\n return {\n activeTexture: glWrapper.state?.bindings?.activeTexture,\n arrayBuffer: glWrapper.state?.bindings?.arrayBuffer ?? null,\n program: glWrapper.state?.bindings?.program ?? null,\n vao: glWrapper.state?.vao ?? null,\n }\n}\n\nfunction restorePhaserGLState(\n renderer: Phaser.Renderer.WebGL.WebGLRenderer,\n saved: SavedPhaserGLState,\n fallbackActiveTexture: number\n): void {\n const glWrapper = renderer.glWrapper as unknown as GLWrapperLike\n\n if (glWrapper.update) {\n // Keep Phaser's cached state aligned after this custom stencil shader pass.\n glWrapper.update(\n {\n bindings: {\n activeTexture: saved.activeTexture ?? fallbackActiveTexture,\n arrayBuffer: saved.arrayBuffer,\n program: saved.program,\n },\n vao: saved.vao,\n },\n true\n )\n return\n }\n\n glWrapper.updateBindingsActiveTexture?.(\n {\n bindings: {\n activeTexture: saved.activeTexture ?? fallbackActiveTexture,\n },\n },\n true\n )\n}\n\nconst ROUND_RECT_VERT_SRC = `\nattribute vec2 a_ndc;\nattribute vec2 a_loc;\nvarying vec2 v_loc;\nvoid main(){gl_Position=vec4(a_ndc,0.,1.);v_loc=a_loc;}\n`\n\nconst ROUND_RECT_FRAG_SRC = `\nprecision mediump float;\nvarying vec2 v_loc;\nuniform vec2 u_halfSize;\nuniform vec4 u_radii;\nfloat sdRoundedBox(vec2 p,vec2 b,vec4 r){\n r.xy=p.x>0.?r.yz:r.xw;\n r.x =p.y>0.?r.y :r.x;\n vec2 q=abs(p)-b+r.x;\n return length(max(q,0.))+min(max(q.x,q.y),0.)-r.x;\n}\nvoid main(){\n if(sdRoundedBox(v_loc,u_halfSize,u_radii)>0.)discard;\n gl_FragColor=vec4(0.);\n}\n`\n\nconst BITMAP_VERT_SRC = `\nattribute vec2 a_ndc;\nattribute vec2 a_uv;\nvarying vec2 v_uv;\nvoid main(){gl_Position=vec4(a_ndc,0.,1.);v_uv=a_uv;}\n`\n\nconst BITMAP_FRAG_SRC = `\nprecision mediump float;\nvarying vec2 v_uv;\nuniform sampler2D u_texture;\nuniform float u_alphaThreshold;\nuniform float u_invertAlpha;\nvoid main(){\n float a=texture2D(u_texture,v_uv).a;\n bool keep=u_invertAlpha>0.5 ? a<u_alphaThreshold : a>=u_alphaThreshold;\n if(!keep)discard;\n gl_FragColor=vec4(0.);\n}\n`\n\nconst _roundRectProgByGl = new WeakMap<WebGLRenderingContext, WebGLProgram>()\nconst _bitmapProgByGl = new WeakMap<WebGLRenderingContext, WebGLProgram>()\n\nfunction createProgram(gl: WebGLRenderingContext, vertSrc: string, fragSrc: string): WebGLProgram {\n const vs = gl.createShader(gl.VERTEX_SHADER) as WebGLShader\n gl.shaderSource(vs, vertSrc)\n gl.compileShader(vs)\n\n const fs = gl.createShader(gl.FRAGMENT_SHADER) as WebGLShader\n gl.shaderSource(fs, fragSrc)\n gl.compileShader(fs)\n\n const prog = gl.createProgram() as WebGLProgram\n gl.attachShader(prog, vs)\n gl.attachShader(prog, fs)\n gl.linkProgram(prog)\n\n return prog\n}\n\nfunction getRoundRectProg(gl: WebGLRenderingContext): WebGLProgram {\n let prog = _roundRectProgByGl.get(gl)\n if (prog) return prog\n\n prog = createProgram(gl, ROUND_RECT_VERT_SRC, ROUND_RECT_FRAG_SRC)\n _roundRectProgByGl.set(gl, prog)\n return prog\n}\n\nfunction getBitmapProg(gl: WebGLRenderingContext): WebGLProgram {\n let prog = _bitmapProgByGl.get(gl)\n if (prog) return prog\n\n prog = createProgram(gl, BITMAP_VERT_SRC, BITMAP_FRAG_SRC)\n _bitmapProgByGl.set(gl, prog)\n return prog\n}\n\ninterface RoundRectShaderLocs {\n ndc: number\n loc: number\n halfSize: WebGLUniformLocation | null\n radii: WebGLUniformLocation | null\n}\n\ninterface BitmapShaderLocs {\n ndc: number\n uv: number\n texture: WebGLUniformLocation | null\n alphaThreshold: WebGLUniformLocation | null\n invertAlpha: WebGLUniformLocation | null\n}\n\nconst _roundRectLocsByProg = new WeakMap<WebGLProgram, RoundRectShaderLocs>()\nconst _bitmapLocsByProg = new WeakMap<WebGLProgram, BitmapShaderLocs>()\n\nfunction getRoundRectShaderLocs(\n gl: WebGLRenderingContext,\n prog: WebGLProgram\n): RoundRectShaderLocs {\n let l = _roundRectLocsByProg.get(prog)\n if (!l) {\n l = {\n ndc: gl.getAttribLocation(prog, 'a_ndc'),\n loc: gl.getAttribLocation(prog, 'a_loc'),\n halfSize: gl.getUniformLocation(prog, 'u_halfSize'),\n radii: gl.getUniformLocation(prog, 'u_radii'),\n }\n _roundRectLocsByProg.set(prog, l)\n }\n return l\n}\n\nfunction getBitmapShaderLocs(gl: WebGLRenderingContext, prog: WebGLProgram): BitmapShaderLocs {\n let l = _bitmapLocsByProg.get(prog)\n if (!l) {\n l = {\n ndc: gl.getAttribLocation(prog, 'a_ndc'),\n uv: gl.getAttribLocation(prog, 'a_uv'),\n texture: gl.getUniformLocation(prog, 'u_texture'),\n alphaThreshold: gl.getUniformLocation(prog, 'u_alphaThreshold'),\n invertAlpha: gl.getUniformLocation(prog, 'u_invertAlpha'),\n }\n _bitmapLocsByProg.set(prog, l)\n }\n return l\n}\n\nconst STRIDE = 16\n\nfunction drawRoundRectMaskShape(\n gl: GLPolyfilled,\n scene: Phaser.Scene,\n matrix: Phaser.GameObjects.Components.TransformMatrix,\n cameraMatrix: Phaser.GameObjects.Components.TransformMatrix | undefined,\n offsetX: number,\n offsetY: number,\n w: number,\n h: number,\n logW: number,\n logH: number,\n radii: [number, number, number, number],\n vertBuf: WebGLBuffer,\n verts: Float32Array\n): void {\n const { a, b, c, d, tx, ty } = matrix\n const hw = w / 2\n const hh = h / 2\n const cx = offsetX + hw\n const cy = offsetY + hh\n\n const corners = [\n [cx - hw, cy - hh],\n [cx + hw, cy - hh],\n [cx + hw, cy + hh],\n [cx - hw, cy + hh],\n ] as const\n\n for (let i = 0; i < 4; i++) {\n const corner = corners[i] as [number, number]\n const lx = corner[0]\n const ly = corner[1]\n const wx = a * lx + c * ly + tx\n const wy = b * lx + d * ly + ty\n const sx = cameraMatrix ? cameraMatrix.getX(wx, wy) : wx\n const sy = cameraMatrix ? cameraMatrix.getY(wx, wy) : wy\n verts[i * 4 + 0] = (sx / logW) * 2 - 1\n verts[i * 4 + 1] = 1 - (sy / logH) * 2\n verts[i * 4 + 2] = lx - cx\n verts[i * 4 + 3] = ly - cy\n }\n\n const prevProg = gl.getParameter(gl.CURRENT_PROGRAM) as WebGLProgram | null\n const prevBuf = gl.getParameter(gl.ARRAY_BUFFER_BINDING) as WebGLBuffer | null\n const prevVAO = gl.getParameter(0x85b5) as WebGLVertexArrayObject | null\n const prevActiveTextureUnit = (gl.getParameter(gl.ACTIVE_TEXTURE) as number) - gl.TEXTURE0\n const renderer = scene.renderer as Phaser.Renderer.WebGL.WebGLRenderer\n const savedPhaserState = savePhaserGLState(renderer)\n\n gl.bindVertexArray(null)\n gl.bindBuffer(gl.ARRAY_BUFFER, vertBuf)\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, verts)\n\n const prog = getRoundRectProg(gl)\n gl.useProgram(prog)\n\n const locs = getRoundRectShaderLocs(gl, prog)\n gl.enableVertexAttribArray(locs.ndc)\n gl.vertexAttribPointer(locs.ndc, 2, gl.FLOAT, false, STRIDE, 0)\n gl.enableVertexAttribArray(locs.loc)\n gl.vertexAttribPointer(locs.loc, 2, gl.FLOAT, false, STRIDE, 8)\n\n gl.uniform2f(locs.halfSize, hw, hh)\n gl.uniform4f(locs.radii, radii[0], radii[1], radii[2], radii[3])\n\n gl.drawArrays(gl.TRIANGLE_FAN, 0, 4)\n\n gl.disableVertexAttribArray(locs.ndc)\n gl.disableVertexAttribArray(locs.loc)\n\n gl.bindBuffer(gl.ARRAY_BUFFER, prevBuf)\n gl.useProgram(prevProg)\n gl.bindVertexArray(prevVAO)\n restorePhaserGLState(renderer, savedPhaserState, prevActiveTextureUnit)\n}\n\ntype BitmapFrameInfo = {\n glTexture: Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper\n width: number\n height: number\n u0: number\n v0: number\n u1: number\n v1: number\n}\n\nfunction isTextureFrame(value: StencilBitmapTexture): value is Phaser.Textures.Frame {\n return typeof value === 'object' && value !== null && 'glTexture' in value && 'u0' in value\n}\n\nfunction resolveBitmapFrame(scene: Phaser.Scene, source: BitmapMaskState): BitmapFrameInfo | null {\n const frame = isTextureFrame(source.texture)\n ? source.texture\n : typeof source.texture === 'string'\n ? scene.textures.getFrame(source.texture, source.frame)\n : source.texture.get(source.frame)\n\n if (!frame?.glTexture?.webGLTexture) return null\n\n return {\n glTexture: frame.glTexture,\n width: source.width ?? frame.cutWidth ?? frame.realWidth,\n height: source.height ?? frame.cutHeight ?? frame.realHeight,\n u0: frame.u0,\n v0: frame.v0,\n u1: frame.u1,\n v1: frame.v1,\n }\n}\n\nfunction drawBitmapMaskShape(\n gl: GLPolyfilled,\n scene: Phaser.Scene,\n matrix: Phaser.GameObjects.Components.TransformMatrix,\n cameraMatrix: Phaser.GameObjects.Components.TransformMatrix | undefined,\n source: BitmapMaskState,\n frameInfo: BitmapFrameInfo,\n logW: number,\n logH: number,\n vertBuf: WebGLBuffer,\n verts: Float32Array\n): void {\n const { a, b, c, d, tx, ty } = matrix\n const x0 = source.offsetX\n const y0 = source.offsetY\n const x1 = x0 + frameInfo.width\n const y1 = y0 + frameInfo.height\n\n const corners = [\n [x0, y0, frameInfo.u0, frameInfo.v0],\n [x1, y0, frameInfo.u1, frameInfo.v0],\n [x1, y1, frameInfo.u1, frameInfo.v1],\n [x0, y1, frameInfo.u0, frameInfo.v1],\n ] as const\n\n for (let i = 0; i < 4; i++) {\n const corner = corners[i] as (typeof corners)[number]\n const lx = corner[0]\n const ly = corner[1]\n const wx = a * lx + c * ly + tx\n const wy = b * lx + d * ly + ty\n const sx = cameraMatrix ? cameraMatrix.getX(wx, wy) : wx\n const sy = cameraMatrix ? cameraMatrix.getY(wx, wy) : wy\n verts[i * 4 + 0] = (sx / logW) * 2 - 1\n verts[i * 4 + 1] = 1 - (sy / logH) * 2\n verts[i * 4 + 2] = corner[2]\n verts[i * 4 + 3] = corner[3]\n }\n\n const prevProg = gl.getParameter(gl.CURRENT_PROGRAM) as WebGLProgram | null\n const prevBuf = gl.getParameter(gl.ARRAY_BUFFER_BINDING) as WebGLBuffer | null\n const prevVAO = gl.getParameter(0x85b5) as WebGLVertexArrayObject | null\n const prevActiveTextureUnit = (gl.getParameter(gl.ACTIVE_TEXTURE) as number) - gl.TEXTURE0\n const renderer = scene.renderer as Phaser.Renderer.WebGL.WebGLRenderer\n const savedPhaserState = savePhaserGLState(renderer)\n\n gl.bindVertexArray(null)\n gl.bindBuffer(gl.ARRAY_BUFFER, vertBuf)\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, verts)\n\n const prog = getBitmapProg(gl)\n gl.useProgram(prog)\n\n const locs = getBitmapShaderLocs(gl, prog)\n gl.enableVertexAttribArray(locs.ndc)\n gl.vertexAttribPointer(locs.ndc, 2, gl.FLOAT, false, STRIDE, 0)\n gl.enableVertexAttribArray(locs.uv)\n gl.vertexAttribPointer(locs.uv, 2, gl.FLOAT, false, STRIDE, 8)\n\n const textureUnits = renderer.glTextureUnits\n const prevTexture = textureUnits.units[0] ?? null\n\n textureUnits.bind(frameInfo.glTexture, 0)\n gl.uniform1i(locs.texture, 0)\n gl.uniform1f(locs.alphaThreshold, source.alphaThreshold)\n gl.uniform1f(locs.invertAlpha, source.invertAlpha ? 1 : 0)\n\n gl.drawArrays(gl.TRIANGLE_FAN, 0, 4)\n\n gl.disableVertexAttribArray(locs.ndc)\n gl.disableVertexAttribArray(locs.uv)\n\n textureUnits.bind(prevTexture, 0)\n renderer.glWrapper.updateBindingsActiveTexture({\n bindings: {\n activeTexture: prevActiveTextureUnit,\n },\n })\n gl.bindBuffer(gl.ARRAY_BUFFER, prevBuf)\n gl.useProgram(prevProg)\n gl.bindVertexArray(prevVAO)\n restorePhaserGLState(renderer, savedPhaserState, prevActiveTextureUnit)\n}\n\nexport function drawMaskShape(\n gl: GLPolyfilled,\n scene: Phaser.Scene,\n matrix: Phaser.GameObjects.Components.TransformMatrix,\n cameraMatrix: Phaser.GameObjects.Components.TransformMatrix | undefined,\n source: MaskState,\n logW: number,\n logH: number,\n vertBuf: WebGLBuffer,\n verts: Float32Array\n): void {\n if (source.kind === 'bitmap') {\n const frameInfo = resolveBitmapFrame(scene, source)\n if (!frameInfo) return\n drawBitmapMaskShape(\n gl,\n scene,\n matrix,\n cameraMatrix,\n source,\n frameInfo,\n logW,\n logH,\n vertBuf,\n verts\n )\n return\n }\n\n drawRoundRectMaskShape(\n gl,\n scene,\n matrix,\n cameraMatrix,\n source.offsetX,\n source.offsetY,\n source.width,\n source.height,\n logW,\n logH,\n source.radii,\n vertBuf,\n verts\n )\n}\n","import type {\n StencilBitmapClipSource,\n StencilBitmapTexture,\n StencilClipSource,\n StencilClipUpdate,\n StencilCornerRadius,\n StencilRoundRectClipSource,\n} from './stencil-clip-types'\n\nexport type RoundRectMaskState = {\n kind: 'roundRect'\n width: number\n height: number\n offsetX: number\n offsetY: number\n radii: [number, number, number, number]\n}\n\nexport type BitmapMaskState = {\n kind: 'bitmap'\n texture: StencilBitmapTexture\n frame: string | number | undefined\n width: number | undefined\n height: number | undefined\n offsetX: number\n offsetY: number\n alphaThreshold: number\n invertAlpha: boolean\n}\n\nexport type MaskState = RoundRectMaskState | BitmapMaskState\n\nfunction resolveRadii(\n r: number | StencilCornerRadius | undefined\n): [number, number, number, number] {\n if (!r) return [0, 0, 0, 0]\n if (typeof r === 'number') return [r, r, r, r]\n return [r.tl ?? 0, r.tr ?? 0, r.br ?? 0, r.bl ?? 0]\n}\n\n/** Returns true when a source/update selects the bitmap mask renderer. */\nexport function isBitmapStencilClipSource(\n source: StencilClipUpdate\n): source is Partial<StencilBitmapClipSource> & { kind: 'bitmap' } {\n return source.kind === 'bitmap'\n}\n\nfunction toRoundRectState(source: StencilRoundRectClipSource): RoundRectMaskState {\n return {\n kind: 'roundRect',\n width: source.width,\n height: source.height,\n offsetX: source.offsetX ?? 0,\n offsetY: source.offsetY ?? 0,\n radii: source.kind === 'rect' ? [0, 0, 0, 0] : resolveRadii(source.cornerRadius),\n }\n}\n\nfunction toBitmapState(source: StencilBitmapClipSource): BitmapMaskState {\n return {\n kind: 'bitmap',\n texture: source.texture,\n frame: source.frame,\n width: source.width,\n height: source.height,\n offsetX: source.offsetX ?? 0,\n offsetY: source.offsetY ?? 0,\n alphaThreshold: source.alphaThreshold ?? 0.5,\n invertAlpha: source.invertAlpha ?? false,\n }\n}\n\nexport function toMaskState(source: StencilClipSource): MaskState {\n return isBitmapStencilClipSource(source) ? toBitmapState(source) : toRoundRectState(source)\n}\n\nexport function mergeMaskState(current: MaskState, update: StencilClipUpdate): MaskState {\n if (isBitmapStencilClipSource(update)) {\n if (current.kind !== 'bitmap' || update.texture !== undefined) {\n return toBitmapState(update as StencilBitmapClipSource)\n }\n\n return {\n kind: 'bitmap',\n texture: current.texture,\n frame: update.frame !== undefined ? update.frame : current.frame,\n width: update.width !== undefined ? update.width : current.width,\n height: update.height !== undefined ? update.height : current.height,\n offsetX: update.offsetX !== undefined ? update.offsetX : current.offsetX,\n offsetY: update.offsetY !== undefined ? update.offsetY : current.offsetY,\n alphaThreshold:\n update.alphaThreshold !== undefined ? update.alphaThreshold : current.alphaThreshold,\n invertAlpha: update.invertAlpha !== undefined ? update.invertAlpha : current.invertAlpha,\n }\n }\n\n if (current.kind === 'bitmap' && update.kind === undefined) {\n const bitmapUpdate = update as Partial<StencilBitmapClipSource>\n return {\n kind: 'bitmap',\n texture: current.texture,\n frame: bitmapUpdate.frame !== undefined ? bitmapUpdate.frame : current.frame,\n width: bitmapUpdate.width !== undefined ? bitmapUpdate.width : current.width,\n height: bitmapUpdate.height !== undefined ? bitmapUpdate.height : current.height,\n offsetX: bitmapUpdate.offsetX !== undefined ? bitmapUpdate.offsetX : current.offsetX,\n offsetY: bitmapUpdate.offsetY !== undefined ? bitmapUpdate.offsetY : current.offsetY,\n alphaThreshold:\n bitmapUpdate.alphaThreshold !== undefined\n ? bitmapUpdate.alphaThreshold\n : current.alphaThreshold,\n invertAlpha:\n bitmapUpdate.invertAlpha !== undefined ? bitmapUpdate.invertAlpha : current.invertAlpha,\n }\n }\n\n if (current.kind === 'bitmap') {\n return toRoundRectState(update as StencilRoundRectClipSource)\n }\n\n const roundUpdate = update as Partial<StencilRoundRectClipSource>\n return {\n kind: 'roundRect',\n width: roundUpdate.width !== undefined ? roundUpdate.width : current.width,\n height: roundUpdate.height !== undefined ? roundUpdate.height : current.height,\n offsetX: roundUpdate.offsetX !== undefined ? roundUpdate.offsetX : current.offsetX,\n offsetY: roundUpdate.offsetY !== undefined ? roundUpdate.offsetY : current.offsetY,\n radii:\n roundUpdate.kind === 'rect'\n ? [0, 0, 0, 0]\n : 'cornerRadius' in roundUpdate\n ? resolveRadii(roundUpdate.cornerRadius)\n : current.radii,\n }\n}\n","/**\n * WebGL stencil-buffer clip for Phaser 4 Containers.\n *\n * Supports arbitrary nesting via the INCR/DECR model: each clip level\n * increments the stencil on enter and decrements on exit, so child clips are\n * automatically intersected with their parent clips at the hardware level.\n *\n * Shape variants:\n * - Plain rectangle (cornerRadius omitted or 0)\n * - Rounded rectangle (uniform radius or per-corner object)\n *\n * A single SDF-based shader handles both variants. For plain rectangles\n * u_radii is vec4(0) and the `discard` branch never fires — no overhead\n * compared to a rectangle-only shader.\n *\n * Transforms (translate, scale, rotation) are fully supported: the quad\n * corners are transformed through `container.getWorldTransformMatrix()` at\n * render time, so no per-layout world-position tracking is needed.\n */\nimport * as Phaser from 'phaser'\nimport { ensurePrerenderReset, getDepth } from './stencil-clip-depth'\nimport { ensureFboPatch, resetFboPatchState } from './stencil-clip-fbo-bridge'\nimport { drawMaskShape, type GLPolyfilled } from './stencil-clip-renderer'\nimport { mergeMaskState, toMaskState } from './stencil-clip-state'\nimport type { StencilClipHandle, StencilClipSource } from './stencil-clip-types'\n\nexport { isBitmapStencilClipSource } from './stencil-clip-state'\nexport type {\n StencilBitmapClipSource,\n StencilBitmapTexture,\n StencilClipHandle,\n StencilClipShape,\n StencilClipSource,\n StencilClipUpdate,\n StencilCornerRadius,\n StencilRoundRectClipSource,\n} from './stencil-clip-types'\n\n// ── Internal Phaser type helpers ──────────────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ContainerRenderFn = (renderer: any, go: any, ...rest: any[]) => void\n\ntype RNManager = { finishBatch(): void }\ntype CameraLike = {\n getViewMatrix(forceComposite?: boolean): Phaser.GameObjects.Components.TransformMatrix\n}\n\ntype DrawingContextLike = {\n camera?: CameraLike\n useCanvas?: boolean\n}\n\ntype GLWrapperLike = {\n state?: {\n bindings?: {\n arrayBuffer?: unknown\n }\n }\n updateBindingsArrayBuffer?(state: unknown, force?: boolean): void\n}\n\n// ── Attachment symbol ─────────────────────────────────────────────────────────\n\nconst STENCIL_HANDLE = Symbol('stencilClipHandle')\n\n/** Returns the active stencil clip handle attached to a container, if any. */\nexport function getStencilClipHandle(\n container: Phaser.GameObjects.Container\n): StencilClipHandle | undefined {\n return (container as unknown as { [STENCIL_HANDLE]?: StencilClipHandle })[STENCIL_HANDLE]\n}\n\n/** Removes any active stencil clip from a container. */\nexport function clearStencilClip(container: Phaser.GameObjects.Container): void {\n getStencilClipHandle(container)?.destroy()\n}\n\n// ── Public API ────────────────────────────────────────────────────────────────\n\n/**\n * Applies a WebGL stencil-buffer clip to a Phaser 4 Container.\n *\n * The clip rectangle is expressed in the container's **local coordinate\n * space**. `offsetX`/`offsetY` mark the top-left corner (default 0/0), so\n * a container whose visual area starts at its local origin can be clipped with\n * `applyStencilClip(container, { width, height })`.\n *\n * **Nesting** is handled transparently: each clip level occupies one stencil\n * value (0 = no clip, 1 = depth 0, 2 = depth 1, …). Child clips are always\n * the intersection of their own shape and all ancestor shapes.\n *\n * **Transforms** (translate, scale, rotation) are re-evaluated from\n * `container.getWorldTransformMatrix()` on every frame, so animated or\n * scroll-driven containers clip correctly without any manual update call.\n *\n * If a stencil clip is already attached to the container, calling this\n * function again calls `handle.update(shape)` on the existing handle and\n * returns it.\n *\n * @param container - The container to clip.\n * @param source - Clip source in the container's local coordinate space.\n * @returns A handle to modify dimensions / corner radii or remove the clip.\n */\nexport function applyStencilClip(\n container: Phaser.GameObjects.Container,\n source: StencilClipSource\n): StencilClipHandle {\n const obj = container as unknown as {\n _renderSteps: Array<ContainerRenderFn | undefined>\n addRenderStep(fn: ContainerRenderFn, index?: number): Phaser.GameObjects.Container\n [STENCIL_HANDLE]?: StencilClipHandle\n }\n\n // Re-use existing handle if already attached.\n if (obj[STENCIL_HANDLE]) {\n obj[STENCIL_HANDLE].update(source)\n return obj[STENCIL_HANDLE]\n }\n\n // No-op for non-WebGL renderers.\n if (container.scene.renderer.type !== Phaser.WEBGL) {\n return { update() {}, destroy() {} }\n }\n\n const renderer = container.scene.renderer as Phaser.Renderer.WebGL.WebGLRenderer\n const gl = renderer.gl as GLPolyfilled\n const glWrapper = renderer.glWrapper as unknown as GLWrapperLike\n\n ensurePrerenderReset(gl, container.scene.game, resetFboPatchState)\n ensureFboPatch(gl)\n\n // Persistent vertex buffer: 4 vertices × 4 floats × 4 bytes = 64 bytes.\n const previousArrayBuffer = glWrapper.state?.bindings?.arrayBuffer ?? null\n const vertBuf = gl.createBuffer() as WebGLBuffer\n gl.bindBuffer(gl.ARRAY_BUFFER, vertBuf)\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(16), gl.DYNAMIC_DRAW)\n gl.bindBuffer(gl.ARRAY_BUFFER, null)\n // Creating the buffer mutates raw GL state; restore Phaser's cached binding too.\n glWrapper.updateBindingsArrayBuffer?.(\n {\n bindings: {\n arrayBuffer: previousArrayBuffer,\n },\n },\n true\n )\n\n const verts = new Float32Array(16)\n\n let maskSource = toMaskState(source)\n let destroyed = false\n\n const wrapper: ContainerRenderFn = (\n webglRenderer,\n go,\n drawingContext,\n parentMatrix,\n renderStep = 0,\n displayList,\n displayListIndex\n ) => {\n const renderNext = () => {\n go.renderWebGLStep(\n webglRenderer,\n go,\n drawingContext,\n parentMatrix,\n renderStep + 1,\n displayList,\n displayListIndex\n )\n }\n\n if (destroyed) {\n renderNext()\n return\n }\n\n const matrix = container.getWorldTransformMatrix()\n const context = drawingContext as DrawingContextLike\n const cameraMatrix = context.camera?.getViewMatrix(!context.useCanvas)\n const rn = (webglRenderer as unknown as { renderNodes: RNManager }).renderNodes\n const depth = getDepth(gl)\n const myDepth = depth.value++\n\n const logW = webglRenderer.width as number\n const logH = webglRenderer.height as number\n\n // ── Push: write clip shape into stencil buffer ────────────────────────\n rn.finishBatch()\n\n if (myDepth === 0) gl.enable(gl.STENCIL_TEST)\n\n gl.colorMask(false, false, false, false)\n gl.stencilMask(0xff)\n // Write only where the stencil already equals myDepth (parent's level).\n gl.stencilFunc(gl.EQUAL, myDepth, 0xff)\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR)\n\n drawMaskShape(gl, container.scene, matrix, cameraMatrix, maskSource, logW, logH, vertBuf, verts)\n\n // ── Content render: test for myDepth+1, protect stencil ──────────────\n gl.colorMask(true, true, true, true)\n gl.stencilFunc(gl.EQUAL, myDepth + 1, 0xff)\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP)\n gl.stencilMask(0x00)\n\n renderNext()\n\n // ── Pop: restore parent depth via DECR ────────────────────────────────\n rn.finishBatch()\n\n gl.colorMask(false, false, false, false)\n gl.stencilMask(0xff)\n gl.stencilFunc(gl.EQUAL, myDepth + 1, 0xff)\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR)\n\n drawMaskShape(gl, container.scene, matrix, cameraMatrix, maskSource, logW, logH, vertBuf, verts)\n\n gl.colorMask(true, true, true, true)\n depth.value--\n\n if (myDepth === 0) {\n // Outermost clip: disable stencil test and lift write protection.\n gl.disable(gl.STENCIL_TEST)\n gl.stencilMask(0xff)\n } else {\n // Nested clip: restore the parent's content-render stencil state so\n // remaining siblings of this container are still clipped correctly.\n gl.stencilFunc(gl.EQUAL, myDepth, 0xff)\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP)\n gl.stencilMask(0x00)\n }\n }\n\n const handle: StencilClipHandle = {\n update(s) {\n maskSource = mergeMaskState(maskSource, s)\n },\n destroy() {\n if (destroyed) return\n destroyed = true\n gl.deleteBuffer(vertBuf)\n const index = obj._renderSteps.indexOf(wrapper)\n if (index !== -1) obj._renderSteps.splice(index, 1)\n delete obj[STENCIL_HANDLE]\n },\n }\n\n obj.addRenderStep(wrapper, 0)\n obj[STENCIL_HANDLE] = handle\n\n return handle\n}\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport * as Phaser from 'phaser'\nimport {\n applyStencilClip,\n clearStencilClip,\n getStencilClipHandle,\n type StencilClipHandle,\n type StencilClipSource,\n type StencilClipUpdate,\n} from './stencil-clip'\n\ntype AnyFn = (...args: unknown[]) => unknown\n\ninterface ExtensionHandle {\n restore(): void\n}\n\nfunction addMethod<T extends object, K extends PropertyKey>(\n proto: T,\n methodName: K,\n fn: unknown\n): ExtensionHandle {\n const hadOwn = Object.prototype.hasOwnProperty.call(proto, methodName)\n const previous = (proto as Record<PropertyKey, unknown>)[methodName]\n\n if (!hadOwn) {\n ;(proto as Record<PropertyKey, unknown>)[methodName] = fn\n }\n\n return {\n restore: () => {\n if (!hadOwn) {\n delete (proto as Record<PropertyKey, unknown>)[methodName]\n } else {\n ;(proto as Record<PropertyKey, unknown>)[methodName] = previous\n }\n },\n }\n}\n\nfunction wrapMethod<T extends object, K extends keyof T & string>(\n proto: T,\n methodName: K,\n wrapper: (original: AnyFn, self: unknown, ...args: unknown[]) => unknown\n): ExtensionHandle {\n const original = proto[methodName] as unknown as AnyFn\n\n if (typeof original !== 'function') {\n return { restore() {} }\n }\n\n const wrapped: AnyFn = function (this: unknown, ...args: unknown[]) {\n return wrapper(original, this, ...args)\n }\n\n ;(proto as Record<string, unknown>)[methodName] = wrapped\n\n return {\n restore: () => {\n ;(proto as Record<string, unknown>)[methodName] = original\n },\n }\n}\n\nlet installed = false\nlet restoreHandles: ExtensionHandle[] = []\n\nfunction canCreateStencilClipSource(source: StencilClipUpdate): source is StencilClipSource {\n if (source.kind === 'bitmap') {\n return source.texture !== undefined\n }\n\n return source.width !== undefined && source.height !== undefined\n}\n\n/** Installs stencil clip helpers on Phaser.GameObjects.Container.prototype. */\nexport function installStencilClipExtension(): void {\n if (installed) return\n installed = true\n\n const proto = Phaser.GameObjects.Container.prototype as Phaser.GameObjects.Container &\n Record<string, unknown>\n\n restoreHandles.push(\n addMethod(\n proto,\n 'setStencilClip',\n function (this: Phaser.GameObjects.Container, source: StencilClipSource) {\n applyStencilClip(this, source)\n return this\n }\n )\n )\n\n restoreHandles.push(\n addMethod(\n proto,\n 'updateStencilClip',\n function (this: Phaser.GameObjects.Container, source: StencilClipUpdate) {\n const handle = getStencilClipHandle(this)\n if (handle) handle.update(source)\n else if (canCreateStencilClipSource(source)) applyStencilClip(this, source)\n return this\n }\n )\n )\n\n restoreHandles.push(\n addMethod(proto, 'clearStencilClip', function (this: Phaser.GameObjects.Container) {\n clearStencilClip(this)\n return this\n })\n )\n\n restoreHandles.push(\n addMethod(proto, 'getStencilClipHandle', function (this: Phaser.GameObjects.Container) {\n return getStencilClipHandle(this)\n })\n )\n\n restoreHandles.push(\n wrapMethod(proto, 'destroy', (original, self, ...args) => {\n clearStencilClip(self as Phaser.GameObjects.Container)\n return original.apply(self, args)\n })\n )\n}\n\n/** Restores Phaser prototypes to their previous state. Intended for tests/HMR. */\nexport function uninstallStencilClipExtension(): void {\n for (const handle of [...restoreHandles].reverse()) handle.restore()\n restoreHandles = []\n installed = false\n}\n\ndeclare global {\n namespace Phaser {\n namespace GameObjects {\n interface Container {\n setStencilClip(source: StencilClipSource): this\n updateStencilClip(source: StencilClipUpdate): this\n clearStencilClip(): this\n getStencilClipHandle(): StencilClipHandle | undefined\n }\n }\n }\n}\n","export * from './stencil-clip'\nexport * from './stencil-clip-extension'\n\nimport { installStencilClipExtension } from './stencil-clip-extension'\n\ninstallStencilClipExtension()\n"],"mappings":";;;;;;AAMA,IAAM,6BAAa,IAAI,QAAkD;AAEzE,IAAM,mCAAmB,IAAI,QAAqB;AAElD,SAAgB,SAAS,IAA8C;CACrE,IAAI,IAAI,WAAW,IAAI,EAAE;CACzB,IAAI,CAAC,GAAG;EACN,IAAI,EAAE,OAAO,EAAE;EACf,WAAW,IAAI,IAAI,CAAC;CACtB;CACA,OAAO;AACT;;;;;AAMA,SAAgB,qBACd,IACA,MACA,eACM;CACN,IAAI,iBAAiB,IAAI,IAAI,GAAG;CAChC,iBAAiB,IAAI,IAAI;CACzB,KAAK,OAAO,GAAG,mBAAmB;EAChC,MAAM,IAAI,WAAW,IAAI,EAAE;EAC3B,IAAI,GAAG,EAAE,QAAQ;EACjB,cAAc,EAAE;CAClB,CAAC;AACH;;;ACdA,IAAM,gCAAgB,IAAI,QAA8C;AAExE,SAAgB,mBAAmB,IAAiC;CAClE,MAAM,MAAM,cAAc,IAAI,EAAE;CAChC,IAAI,KAAK;EACP,IAAI,UAAU;EACd,IAAI,QAAQ;CACd;AACF;;;;;AAMA,SAAgB,eAAe,IAAiC;CAC9D,IAAI,cAAc,IAAI,EAAE,GAAG;CAE3B,MAAM,QAAuB;EAAE,SAAS;EAAM,OAAO;CAAK;CAC1D,cAAc,IAAI,IAAI,KAAK;CAE3B,MAAM,WAAW,GAAG,gB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4BAA4B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ViewProps } from '..';
|
|
2
|
+
import { VNodeLike } from '../../vdom';
|
|
3
|
+
export type DebugPanelPreset = 'fps' | 'perf' | 'vdom' | 'textures' | 'full';
|
|
4
|
+
export type DebugMetricKey = 'fps' | 'frameMs' | 'phaserVersion' | 'renderer' | 'viewport' | 'textureCount' | 'mountsTotal' | 'mountsByType' | 'mountsByParent' | 'mountsByKey' | 'debugFlags';
|
|
5
|
+
type DebugValue = string | number;
|
|
6
|
+
export interface DebugPanelProps extends Omit<ViewProps, 'children'> {
|
|
7
|
+
/** Optional ready-made metric set. Ignored when `metrics` is set. */
|
|
8
|
+
preset?: DebugPanelPreset;
|
|
9
|
+
/** Explicit metric selection (takes precedence over `preset`). */
|
|
10
|
+
metrics?: DebugMetricKey[];
|
|
11
|
+
/** Refresh interval in milliseconds. */
|
|
12
|
+
intervalMs?: number;
|
|
13
|
+
/** Render all metrics in one line (instead of key/value rows). */
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
/** Maximum rows to render in non-compact mode. */
|
|
16
|
+
maxRows?: number;
|
|
17
|
+
/** Optional metric label overrides. */
|
|
18
|
+
labels?: Partial<Record<DebugMetricKey, string>>;
|
|
19
|
+
/** Optional formatter overrides per metric. */
|
|
20
|
+
formatters?: Partial<Record<DebugMetricKey, (value: DebugValue) => string>>;
|
|
21
|
+
/** Optional props forwarded to each inner row View (column mode only). */
|
|
22
|
+
innerProps?: Omit<ViewProps, 'children'>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* DebugPanel component
|
|
26
|
+
* Shows selected diagnostics from Phaser + PhaserJSX as overlay-ready content.
|
|
27
|
+
*/
|
|
28
|
+
export declare function DebugPanel(props: DebugPanelProps): VNodeLike;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=DebugPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DebugPanel.d.ts","s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,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/custom/Toggle.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAqB3C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;IACzC,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,sBAAsB;IACtB,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/custom/Toggle.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAqB3C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;IACzC,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,sBAAsB;IACtB,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAkMpD"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_custom = require("../../custom-
|
|
2
|
+
const require_custom = require("../../custom-DTd4LxDn.cjs");
|
|
3
3
|
exports.Accordion = require_custom.Accordion;
|
|
4
4
|
exports.AlertDialog = require_custom.AlertDialog;
|
|
5
5
|
exports.Button = require_custom.Button;
|
|
6
6
|
exports.CharText = require_custom.CharText;
|
|
7
7
|
exports.CharTextInput = require_custom.CharTextInput;
|
|
8
|
+
exports.DebugPanel = require_custom.DebugPanel;
|
|
8
9
|
exports.Dialog = require_custom.Dialog;
|
|
9
10
|
exports.Divider = require_custom.Divider;
|
|
10
11
|
exports.Dropdown = require_custom.Dropdown;
|
|
@@ -7,6 +7,7 @@ export { AlertDialog, type AlertDialogProps } from './AlertDialog';
|
|
|
7
7
|
export { Button, type ButtonProps } from './Button';
|
|
8
8
|
export { CharText, type CharTextAPI, type CharTextProps } from './CharText';
|
|
9
9
|
export { CharTextInput, type CharTextInputProps } from './CharTextInput';
|
|
10
|
+
export { DebugPanel, type DebugMetricKey, type DebugPanelPreset, type DebugPanelProps, } from './DebugPanel';
|
|
10
11
|
export { Dialog, type DialogProps } from './Dialog';
|
|
11
12
|
export { Divider, type DividerProps } from './Divider';
|
|
12
13
|
export { Dropdown, type DropdownOption, type DropdownProps } from './Dropdown';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/custom/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAC3E,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,EACL,IAAI,EACJ,mBAAmB,EACnB,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAC7E,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,KA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AAC5D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EACL,OAAO,EACP,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,WAAW,EACX,MAAM,EACN,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC/F,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAC1F,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { Accordion, AlertDialog, Button, CharText, CharTextInput, Dialog, Divider, Dropdown, Icon, Image, Joystick, Modal, NineSlice, NineSliceButton, Particles, Portal, RadioButton, RadioGroup, RangeSlider, RefOriginView, ScrollSlider, ScrollView, Sidebar, Slider, Tab, TabPanel, Tabs, Toggle, TransformOriginView, WrapText, calculateSliderSize, createIconComponent, useIconPreload };
|
|
1
|
+
import { A as Portal, D as WrapText, E as AlertDialog, O as Dialog, S as DebugPanel, T as CharText, X as Particles, _ as Dropdown, a as Tabs, b as calculateSliderSize, c as Sidebar, d as NineSlice, et as RadioGroup, f as Joystick, g as Image, h as useIconPreload, i as TabPanel, j as Accordion, k as Modal, l as RefOriginView, m as createIconComponent, n as Toggle, o as RangeSlider, p as Icon, r as Tab, rt as Button, s as Slider, t as TransformOriginView, tt as RadioButton, u as NineSliceButton, v as ScrollView, w as CharTextInput, x as Divider, y as ScrollSlider } from "../../custom-BXDJDGOl.js";
|
|
2
|
+
export { Accordion, AlertDialog, Button, CharText, CharTextInput, DebugPanel, Dialog, Divider, Dropdown, Icon, Image, Joystick, Modal, NineSlice, NineSliceButton, Particles, Portal, RadioButton, RadioGroup, RangeSlider, RefOriginView, ScrollSlider, ScrollView, Sidebar, Slider, Tab, TabPanel, Tabs, Toggle, TransformOriginView, WrapText, calculateSliderSize, createIconComponent, useIconPreload };
|
|
@@ -65,7 +65,7 @@ import { PropsDefaultExtension } from '../../types';
|
|
|
65
65
|
* - Compare with current dependencies in patcher
|
|
66
66
|
* - Call onDraw only if changed
|
|
67
67
|
*
|
|
68
|
-
* 6. Performance Optimization:
|
|
68
|
+
* 6. Performance Optimization: GENERATE-TEXTURE PATH 🆕
|
|
69
69
|
* Strategy for static graphics:
|
|
70
70
|
* - Static graphics (no redraw) → Consider generateTexture() optimization
|
|
71
71
|
* - Converts geometry to texture (faster rendering, loses vector quality)
|
|
@@ -80,7 +80,7 @@ import { PropsDefaultExtension } from '../../types';
|
|
|
80
80
|
* - ✅ Custom complex shapes (polygons, stars, bezier curves)
|
|
81
81
|
* - ✅ Dynamic visualizations (graphs, charts)
|
|
82
82
|
* - ✅ Progress bars with custom shapes
|
|
83
|
-
* - ✅ Debug overlays (
|
|
83
|
+
* - ✅ Debug overlays (hit boxes, grids)
|
|
84
84
|
* Use Alternatives For:
|
|
85
85
|
* - ❌ Simple rectangles → Use View with backgroundColor
|
|
86
86
|
* - ❌ Borders → Use View with borderColor/borderWidth
|
|
@@ -16948,7 +16948,7 @@ var GestureManager = class {
|
|
|
16948
16948
|
/**
|
|
16949
16949
|
* Handle global pointer down event
|
|
16950
16950
|
* Registers all containers that were hit for move event tracking
|
|
16951
|
-
* Only the topmost gets touch/
|
|
16951
|
+
* Only the topmost gets touch/long-press callbacks
|
|
16952
16952
|
*/
|
|
16953
16953
|
handlePointerDown(pointer) {
|
|
16954
16954
|
const hitContainers = /* @__PURE__ */ new Set();
|
|
@@ -24051,7 +24051,7 @@ function registerBuiltins() {
|
|
|
24051
24051
|
/**
|
|
24052
24052
|
* Preprocesses SVG string to ensure tinting works correctly
|
|
24053
24053
|
* Replaces fill/stroke="currentColor" and other colors with white (#FFFFFF)
|
|
24054
|
-
* This allows Phaser's tint to work
|
|
24054
|
+
* This allows Phaser's tint to work by multiplication (white × tint = tint color)
|
|
24055
24055
|
* @param svg - Raw SVG string
|
|
24056
24056
|
* @returns Preprocessed SVG string with white fills/strokes
|
|
24057
24057
|
*/
|
|
@@ -26643,6 +26643,264 @@ function CharTextInput(props) {
|
|
|
26643
26643
|
});
|
|
26644
26644
|
}
|
|
26645
26645
|
//#endregion
|
|
26646
|
+
//#region src/design-tokens/use-theme-tokens.ts
|
|
26647
|
+
/**
|
|
26648
|
+
* Hook to access complete design token system
|
|
26649
|
+
* Combines colors with text styles, spacing, sizes, and radius tokens
|
|
26650
|
+
*/
|
|
26651
|
+
/**
|
|
26652
|
+
* Hook to access complete design token system from theme context
|
|
26653
|
+
* Provides colors, text styles, spacing, sizes, and radius tokens
|
|
26654
|
+
* Automatically updates when color mode or preset changes
|
|
26655
|
+
* @returns Current DesignTokens or undefined
|
|
26656
|
+
* @example
|
|
26657
|
+
* ```typescript
|
|
26658
|
+
* function MyComponent() {
|
|
26659
|
+
* const tokens = useThemeTokens()
|
|
26660
|
+
*
|
|
26661
|
+
* if (!tokens) return null
|
|
26662
|
+
*
|
|
26663
|
+
* return (
|
|
26664
|
+
* <View
|
|
26665
|
+
* backgroundColor={tokens.colors.surface.DEFAULT}
|
|
26666
|
+
* padding={tokens.spacing.lg}
|
|
26667
|
+
* cornerRadius={tokens.radius.md}
|
|
26668
|
+
* >
|
|
26669
|
+
* <Text text="Title" style={tokens.textStyles.title} />
|
|
26670
|
+
* <Text text="Body text" style={tokens.textStyles.DEFAULT} />
|
|
26671
|
+
* </View>
|
|
26672
|
+
* )
|
|
26673
|
+
* }
|
|
26674
|
+
* ```
|
|
26675
|
+
*/
|
|
26676
|
+
function useThemeTokens() {
|
|
26677
|
+
const localTheme = useTheme();
|
|
26678
|
+
const getInitialTokens = () => {
|
|
26679
|
+
if (localTheme?.__colorPreset) {
|
|
26680
|
+
const preset = getPresetWithMode(localTheme.__colorPreset.name, localTheme.__colorPreset.mode ?? "light");
|
|
26681
|
+
return {
|
|
26682
|
+
colors: preset.colors,
|
|
26683
|
+
textStyles: createTextStyleTokens(preset.colors.text.DEFAULT.toString()),
|
|
26684
|
+
spacing: defaultSpacingTokens,
|
|
26685
|
+
sizes: defaultSizeTokens,
|
|
26686
|
+
radius: defaultRadiusTokens
|
|
26687
|
+
};
|
|
26688
|
+
}
|
|
26689
|
+
const colors = themeRegistry.getColorTokens();
|
|
26690
|
+
if (!colors) return void 0;
|
|
26691
|
+
return {
|
|
26692
|
+
colors,
|
|
26693
|
+
textStyles: createTextStyleTokens(colors.text.DEFAULT.toString()),
|
|
26694
|
+
spacing: defaultSpacingTokens,
|
|
26695
|
+
sizes: defaultSizeTokens,
|
|
26696
|
+
radius: defaultRadiusTokens
|
|
26697
|
+
};
|
|
26698
|
+
};
|
|
26699
|
+
const [tokens, setTokens] = useState(getInitialTokens());
|
|
26700
|
+
const [, forceUpdate] = useState(0);
|
|
26701
|
+
useEffect(() => {
|
|
26702
|
+
return themeRegistry.subscribe(() => {
|
|
26703
|
+
if (localTheme?.__colorPreset) {
|
|
26704
|
+
const currentMode = themeRegistry.getColorMode();
|
|
26705
|
+
const preset = getPresetWithMode(localTheme.__colorPreset.name, currentMode);
|
|
26706
|
+
setTokens({
|
|
26707
|
+
colors: preset.colors,
|
|
26708
|
+
textStyles: createTextStyleTokens(preset.colors.text.DEFAULT.toString()),
|
|
26709
|
+
spacing: defaultSpacingTokens,
|
|
26710
|
+
sizes: defaultSizeTokens,
|
|
26711
|
+
radius: defaultRadiusTokens
|
|
26712
|
+
});
|
|
26713
|
+
} else {
|
|
26714
|
+
const colors = themeRegistry.getColorTokens();
|
|
26715
|
+
if (colors) setTokens({
|
|
26716
|
+
colors,
|
|
26717
|
+
textStyles: createTextStyleTokens(colors.text.DEFAULT.toString()),
|
|
26718
|
+
spacing: defaultSpacingTokens,
|
|
26719
|
+
sizes: defaultSizeTokens,
|
|
26720
|
+
radius: defaultRadiusTokens
|
|
26721
|
+
});
|
|
26722
|
+
}
|
|
26723
|
+
forceUpdate((n) => n + 1);
|
|
26724
|
+
});
|
|
26725
|
+
}, [localTheme]);
|
|
26726
|
+
return tokens;
|
|
26727
|
+
}
|
|
26728
|
+
//#endregion
|
|
26729
|
+
//#region src/components/custom/DebugPanel.tsx
|
|
26730
|
+
/** @jsxImportSource ../.. */
|
|
26731
|
+
/**
|
|
26732
|
+
* DebugPanel component - lightweight runtime diagnostics for Phaser + PhaserJSX
|
|
26733
|
+
* Renders selected metrics as text rows or a compact single-line summary.
|
|
26734
|
+
*/
|
|
26735
|
+
var PRESET_METRICS = {
|
|
26736
|
+
fps: ["fps", "frameMs"],
|
|
26737
|
+
perf: [
|
|
26738
|
+
"fps",
|
|
26739
|
+
"frameMs",
|
|
26740
|
+
"renderer",
|
|
26741
|
+
"viewport"
|
|
26742
|
+
],
|
|
26743
|
+
vdom: [
|
|
26744
|
+
"mountsTotal",
|
|
26745
|
+
"mountsByType",
|
|
26746
|
+
"mountsByParent",
|
|
26747
|
+
"mountsByKey"
|
|
26748
|
+
],
|
|
26749
|
+
textures: ["textureCount"],
|
|
26750
|
+
full: [
|
|
26751
|
+
"fps",
|
|
26752
|
+
"frameMs",
|
|
26753
|
+
"phaserVersion",
|
|
26754
|
+
"renderer",
|
|
26755
|
+
"viewport",
|
|
26756
|
+
"textureCount",
|
|
26757
|
+
"mountsTotal",
|
|
26758
|
+
"mountsByType",
|
|
26759
|
+
"mountsByParent",
|
|
26760
|
+
"mountsByKey",
|
|
26761
|
+
"debugFlags"
|
|
26762
|
+
]
|
|
26763
|
+
};
|
|
26764
|
+
var DEFAULT_LABELS = {
|
|
26765
|
+
fps: "FPS",
|
|
26766
|
+
frameMs: "Frame ms",
|
|
26767
|
+
phaserVersion: "Phaser",
|
|
26768
|
+
renderer: "Renderer",
|
|
26769
|
+
viewport: "Viewport",
|
|
26770
|
+
textureCount: "Textures",
|
|
26771
|
+
mountsTotal: "Mounts",
|
|
26772
|
+
mountsByType: "Mounts/type",
|
|
26773
|
+
mountsByParent: "Mounts/parent",
|
|
26774
|
+
mountsByKey: "Mounts/key",
|
|
26775
|
+
debugFlags: "Debug flags"
|
|
26776
|
+
};
|
|
26777
|
+
function resolveRendererName(scene) {
|
|
26778
|
+
const renderer = scene.renderer;
|
|
26779
|
+
const canvasType = Phaser.CANVAS;
|
|
26780
|
+
if (renderer.type === Phaser.WEBGL) return "WebGL";
|
|
26781
|
+
if (canvasType !== void 0 && renderer.type === canvasType) return "Canvas";
|
|
26782
|
+
if (renderer.constructor?.name) return renderer.constructor.name;
|
|
26783
|
+
if (typeof renderer.type === "number") return `Type ${renderer.type}`;
|
|
26784
|
+
return "Unknown";
|
|
26785
|
+
}
|
|
26786
|
+
function resolveTextureCount(scene) {
|
|
26787
|
+
const manager = scene.textures;
|
|
26788
|
+
const keys = typeof manager.getTextureKeys === "function" ? manager.getTextureKeys() : Object.keys(manager.list ?? {});
|
|
26789
|
+
const internalKeys = new Set([
|
|
26790
|
+
"__DEFAULT",
|
|
26791
|
+
"__MISSING",
|
|
26792
|
+
"__NORMAL",
|
|
26793
|
+
"__WHITE"
|
|
26794
|
+
]);
|
|
26795
|
+
return keys.filter((key) => !internalKeys.has(key.toUpperCase())).length;
|
|
26796
|
+
}
|
|
26797
|
+
function resolveFrameStats(scene) {
|
|
26798
|
+
const loop = scene.game.loop;
|
|
26799
|
+
const rawFps = loop?.actualFps ?? loop?.fps ?? 0;
|
|
26800
|
+
const rawFrameMs = loop?.delta ?? loop?.frameDelta ?? 0;
|
|
26801
|
+
return {
|
|
26802
|
+
fps: Number.isFinite(rawFps) ? Number(rawFps.toFixed(1)) : 0,
|
|
26803
|
+
frameMs: Number.isFinite(rawFrameMs) ? Number(rawFrameMs.toFixed(2)) : 0
|
|
26804
|
+
};
|
|
26805
|
+
}
|
|
26806
|
+
function summarizeMap(map, maxEntries = 3) {
|
|
26807
|
+
return Array.from(map.entries()).sort((a, b) => b[1] - a[1]).slice(0, maxEntries).map(([key, value]) => `${String(key)}:${value}`).join(" | ") || "-";
|
|
26808
|
+
}
|
|
26809
|
+
function resolveDebugFlags() {
|
|
26810
|
+
const debugConfig = DevConfig.debug;
|
|
26811
|
+
if (!debugConfig.enabled) return "off";
|
|
26812
|
+
const enabledFlags = Object.entries(debugConfig).filter(([key, value]) => key !== "enabled" && value).map(([key]) => key);
|
|
26813
|
+
return enabledFlags.length ? enabledFlags.join(",") : "enabled";
|
|
26814
|
+
}
|
|
26815
|
+
function collectSnapshot(scene) {
|
|
26816
|
+
const { fps, frameMs } = resolveFrameStats(scene);
|
|
26817
|
+
const mountStats = getMountStats();
|
|
26818
|
+
return {
|
|
26819
|
+
fps,
|
|
26820
|
+
frameMs,
|
|
26821
|
+
phaserVersion: Phaser.VERSION,
|
|
26822
|
+
renderer: resolveRendererName(scene),
|
|
26823
|
+
viewport: `${scene.scale.width}x${scene.scale.height}`,
|
|
26824
|
+
textureCount: resolveTextureCount(scene),
|
|
26825
|
+
mountsTotal: mountStats.totalMounts,
|
|
26826
|
+
mountsByType: summarizeMap(mountStats.byType),
|
|
26827
|
+
mountsByParent: summarizeMap(mountStats.byParent),
|
|
26828
|
+
mountsByKey: summarizeMap(mountStats.byKey),
|
|
26829
|
+
debugFlags: resolveDebugFlags()
|
|
26830
|
+
};
|
|
26831
|
+
}
|
|
26832
|
+
function formatDefault(value) {
|
|
26833
|
+
return typeof value === "number" ? String(value) : value;
|
|
26834
|
+
}
|
|
26835
|
+
/**
|
|
26836
|
+
* DebugPanel component
|
|
26837
|
+
* Shows selected diagnostics from Phaser + PhaserJSX as overlay-ready content.
|
|
26838
|
+
*/
|
|
26839
|
+
function DebugPanel(props) {
|
|
26840
|
+
const scene = useScene();
|
|
26841
|
+
const { preset = "fps", metrics, intervalMs = 250, compact = false, maxRows, labels, formatters, innerProps, ...viewProps } = props;
|
|
26842
|
+
const selectedMetrics = useMemo(() => {
|
|
26843
|
+
const source = metrics && metrics.length > 0 ? metrics : PRESET_METRICS[preset];
|
|
26844
|
+
return Array.from(new Set(source));
|
|
26845
|
+
}, [metrics, preset]);
|
|
26846
|
+
const [snapshot, setSnapshot] = useState(collectSnapshot(scene));
|
|
26847
|
+
useEffect(() => {
|
|
26848
|
+
const delay = Math.max(50, intervalMs);
|
|
26849
|
+
setSnapshot(collectSnapshot(scene));
|
|
26850
|
+
const timer = window.setInterval(() => {
|
|
26851
|
+
setSnapshot(collectSnapshot(scene));
|
|
26852
|
+
}, delay);
|
|
26853
|
+
return () => {
|
|
26854
|
+
window.clearInterval(timer);
|
|
26855
|
+
};
|
|
26856
|
+
}, [
|
|
26857
|
+
scene,
|
|
26858
|
+
intervalMs,
|
|
26859
|
+
selectedMetrics
|
|
26860
|
+
]);
|
|
26861
|
+
const tokens = useThemeTokens();
|
|
26862
|
+
const rowStyle = tokens?.textStyles.small;
|
|
26863
|
+
const valueStyle = tokens?.textStyles.small;
|
|
26864
|
+
const rows = selectedMetrics.map((metric) => {
|
|
26865
|
+
const rawValue = snapshot[metric];
|
|
26866
|
+
const label = labels?.[metric] ?? DEFAULT_LABELS[metric];
|
|
26867
|
+
const formatter = formatters?.[metric];
|
|
26868
|
+
return {
|
|
26869
|
+
metric,
|
|
26870
|
+
label,
|
|
26871
|
+
value: formatter ? formatter(rawValue) : formatDefault(rawValue)
|
|
26872
|
+
};
|
|
26873
|
+
});
|
|
26874
|
+
const limitedRows = typeof maxRows === "number" ? rows.slice(0, Math.max(1, maxRows)) : rows;
|
|
26875
|
+
if (compact) {
|
|
26876
|
+
const compactText = limitedRows.map((row) => `${row.label} ${row.value}`).join(" | ");
|
|
26877
|
+
return /* @__PURE__ */ jsx(View, {
|
|
26878
|
+
...viewProps,
|
|
26879
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
26880
|
+
text: compactText,
|
|
26881
|
+
style: valueStyle
|
|
26882
|
+
})
|
|
26883
|
+
});
|
|
26884
|
+
}
|
|
26885
|
+
return /* @__PURE__ */ jsx(View, {
|
|
26886
|
+
direction: "column",
|
|
26887
|
+
gap: 4,
|
|
26888
|
+
...viewProps,
|
|
26889
|
+
children: limitedRows.map((row) => /* @__PURE__ */ jsxs(View, {
|
|
26890
|
+
direction: "row",
|
|
26891
|
+
gap: 8,
|
|
26892
|
+
...innerProps,
|
|
26893
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
26894
|
+
text: `${row.label}:`,
|
|
26895
|
+
style: rowStyle
|
|
26896
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
26897
|
+
text: row.value,
|
|
26898
|
+
style: valueStyle
|
|
26899
|
+
})]
|
|
26900
|
+
}, `debug-${row.metric}`))
|
|
26901
|
+
});
|
|
26902
|
+
}
|
|
26903
|
+
//#endregion
|
|
26646
26904
|
//#region src/components/custom/Divider.tsx
|
|
26647
26905
|
/**
|
|
26648
26906
|
* Divider component - renders a simple line separator
|
|
@@ -29087,7 +29345,6 @@ function Toggle(props) {
|
|
|
29087
29345
|
setIsAnimating(true);
|
|
29088
29346
|
const endX = newChecked ? thumbOffsetOn : thumbOffsetOff;
|
|
29089
29347
|
const startX = thumbX;
|
|
29090
|
-
console.log("Duration:", duration.current);
|
|
29091
29348
|
scene.tweens.addCounter({
|
|
29092
29349
|
from: 0,
|
|
29093
29350
|
to: 1,
|
|
@@ -29254,6 +29511,6 @@ function TransformOriginView({ originX = .5, originY = .5, width, height, x = 0,
|
|
|
29254
29511
|
});
|
|
29255
29512
|
}
|
|
29256
29513
|
//#endregion
|
|
29257
|
-
export {
|
|
29514
|
+
export { Sprite as $, tileSpriteCreator as $n, getWorldLayoutRect as $t, Portal as A, getPreset as An, viewCreator as At, unwrapSignal as B, getContrastRatio as Bn, normalizeVNodeLike as Bt, useThemeTokens as C, defaultSizeTokens as Cn, imageCreator as Cr, createSwingEffect as Ct, WrapText as D, applyLightMode as Dn, host as Dr, createZoomInEffect as Dt, AlertDialog as E, applyDarkMode as En, graphicsPatcher as Er, createWobbleEffect as Et, DEFAULT_SPRING_CONFIG as F, alpha as Fn, themeRegistry as Ft, releaseSVGTextures as G, numberToHex as Gn, portalRegistry as Gt, DOMInputElement as H, hexToNumber as Hn, remountAll as Ht, SPRING_PRESETS as I, createTextStyle as In, createElement as It, svgToTexture as J, rgbToNumber as Jn, getBackgroundGraphics as Jt, useSVGTexture as K, numberToRgb as Kn, View as Kt, SpringPhysics as L, darken as Ln, getMountStats as Lt, computed as M, midnightPreset as Mn, createTheme as Mt, useSpring as N, oceanBluePreset as Nn, getThemedProps as Nt, Dialog as O, forestGreenPreset as On, nodeRegistry as Or, createZoomOutEffect as Ot, useSprings as P, presets as Pn, mergeThemes as Pt, Text as Q, normalizeGap as Qn, getLayoutSize as Qt, animatedSignal as R, darkenHex as Rn, mount as Rt, DebugPanel as S, defaultRadiusTokens as Sn, nineSlicePatcher as Sr, createSpinEffect as St, CharText as T, defaultTextStyleTokens as Tn, graphicsCreator as Tr, createWiggleEffect as Tt, releaseAllSVGTextures as U, lighten as Un, unmount as Ut, KeyboardInputManager as V, hex as Vn, patchVNode as Vt, releaseSVGTexture as W, lightenHex as Wn, unmountJSX as Wt, Particles as X, normalizeCornerRadius as Xn, getLayoutProps as Xt, registerBuiltins as Y, HexColor as Yn, getCurrent as Yt, TileSprite as Z, normalizeEdgeInsets as Zn, getLayoutRect as Zt, Dropdown as _, withHooks as _n, resolveParticlePreset as _r, createPressEffect as _t, Tabs as a, useForceRedraw as an, DevConfig as ar, EFFECT_REGISTRY as at, calculateSliderSize as b, defaultTheme as bn, buildEmitZoneFromLayout as br, createSlideInEffect as bt, Sidebar as c, useLayoutSize as cn, spritePatcher as cr, createBounceEffect as ct, NineSlice as d, useRef as dn, applyDeathZone as dr, createFlashEffect as dt, shallowEqual as en, tileSpritePatcher as er, RadioGroup as et, Joystick as f, useScene as fn, applyEmitZone as fr, createFlipInEffect as ft, Image$1 as g, useWorldLayoutRect as gn, PARTICLE_PRESET_REGISTRY as gr, createNoneEffect as gt, useIconPreload as h, useViewportSize as hn, isParticleEmitter as hr, createJelloEffect as ht, TabPanel as i, useEffect as in, DebugLogger as ir, DEFAULT_EFFECT as it, Accordion as j, getPresetWithMode as jn, viewPatcher as jt, Modal as k, generateColorScale as kn, register as kr, useGameObjectEffect as kt, RefOriginView as l, useMemo as ln, particlesCreator as lr, createBreatheEffect as lt, createIconComponent as m, useTheme as mn, getFirstEmitter as mr, createFloatEffect as mt, Toggle as n, useBackgroundGraphics as nn, textPatcher as nr, Graphics as nt, RangeSlider as o, useLayoutEffect as on, DevPresets as or, applyEffectByName as ot, Icon as p, useState as pn, applyEmitterConfig as pr, createFlipOutEffect as pt, useSVGTextures as q, rgbToHsl as qn, disposeCtx as qt, Tab as r, useCallback as rn, viewportRegistry as rr, Button as rt, Slider as s, useLayoutRect as sn, spriteCreator as sr, resolveEffect as st, TransformOriginView as t, shouldComponentUpdate as tn, textCreator as tr, RadioButton as tt, NineSliceButton as u, useRedraw as un, particlesPatcher as ur, createFadeEffect as ut, ScrollView as v, getRenderContext as vn, buildDeathZonesFromLayout as vr, createPulseEffect as vt, CharTextInput as w, defaultSpacingTokens as wn, imagePatcher as wr, createTadaEffect as wt, Divider as x, createTextStyleTokens as xn, nineSliceCreator as xr, createSlideOutEffect as xt, ScrollSlider as y, createDefaultTheme as yn, buildEmitZone as yr, createShakeEffect as yt, isAnimatedSignal as z, ensureContrast as zn, mountJSX as zt };
|
|
29258
29515
|
|
|
29259
|
-
//# sourceMappingURL=custom-
|
|
29516
|
+
//# sourceMappingURL=custom-BXDJDGOl.js.map
|