@flare-engine/react 0.4.7 → 0.4.10

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/index.d.mts CHANGED
@@ -42,8 +42,8 @@ interface SkOffscreenCanvasLike {
42
42
  drawRect(rect: unknown, paint: unknown): void;
43
43
  clear(color: unknown): void;
44
44
  }
45
- /** Structural canvas surface — minimal subset needed for offscreen capture. */
46
- interface SkSurfaceLike {
45
+ /** Structural offscreen surface — what `SkiaModuleLike.Surface.Make` / `MakeOffscreen` return. */
46
+ interface SkOffscreenSurfaceLike {
47
47
  getCanvas(): SkOffscreenCanvasLike;
48
48
  makeImageSnapshot(): SkImageLike;
49
49
  /** Force queued draws to execute. Required for GPU-backed surfaces before
@@ -53,7 +53,8 @@ interface SkSurfaceLike {
53
53
  }
54
54
  /**
55
55
  * A single post-processing pass descriptor built by `buildPostFxPasses`.
56
- * GameView maps each descriptor to a `<RuntimeShader>` child of `<Image>`.
56
+ * GameView maps each descriptor to a `<RuntimeShader>` image filter, or to a
57
+ * nested `<Shader>` when a pass carries `children` (see that field).
57
58
  */
58
59
  interface PostFxPassDescriptor {
59
60
  /** Stable id, used as React key. */
@@ -67,9 +68,13 @@ interface PostFxPassDescriptor {
67
68
  */
68
69
  readonly uniforms: Record<string, number | readonly number[]>;
69
70
  /**
70
- * Extra child shader slots beyond the implicit scene sampler. Empty for every
71
- * built-in effect; only color-grading-lut would populate it. Each entry
72
- * is an SkImage that GameView wraps in `<ImageShader>`.
71
+ * Extra sampler children beyond the implicit scene sampler, in SkSL
72
+ * declaration order with `src` excluded. Empty for every built-in effect
73
+ * except color-grading-lut (its LUT image). RN-Skia's `<RuntimeShader>`
74
+ * image filter cannot bind them — it calls `MakeRuntimeShader(rtb, null,
75
+ * null)`, source only — so GameView renders a pass with children, and every
76
+ * pass before it, as a nested `<Shader>` chain whose children are bound
77
+ * positionally: `src` first, then one `<ImageShader>` per entry here.
73
78
  */
74
79
  readonly children: readonly SkImage[];
75
80
  }
@@ -103,8 +108,8 @@ type SkiaModuleLike = FrameRendererModule & {
103
108
  Make(sksl: string): SkRuntimeEffect | null;
104
109
  };
105
110
  Surface?: {
106
- Make(width: number, height: number): SkSurfaceLike | null;
107
- MakeOffscreen?(width: number, height: number): SkSurfaceLike | null;
111
+ Make(width: number, height: number): SkOffscreenSurfaceLike | null;
112
+ MakeOffscreen?(width: number, height: number): SkOffscreenSurfaceLike | null;
108
113
  };
109
114
  /** Optional — present on device builds; absent in CPU/test mocks (drop-shadow falls back to the default paint). */
110
115
  ImageFilter?: {
@@ -163,9 +168,10 @@ type RenderHook = (ctx: GameContextValue, canvas: unknown) => void;
163
168
  /** Render hook for post-processing passes. Receives the game context, the
164
169
  * active Skia canvas, and the `SkiaFrameRenderer` bridge so the hook can
165
170
  * call `bridge.setPostFxBinding(runtime, chain)` to register the runtime
166
- * and chain for the current frame.
167
- * `bridge` is `null` only on platforms where no Skia renderer was created
168
- * (future web fallback). */
171
+ * and chain for the current frame. The bound chain renders on native through
172
+ * RN-Skia shader nodes and on web through the imperative composite inside the
173
+ * scene capture (see `createWebPostFxCompositor`).
174
+ * `bridge` is `null` only on platforms where no Skia renderer was created. */
169
175
  type PostFxRenderHook = (ctx: GameContextValue, canvas: unknown, bridge: SkiaFrameRenderer | null) => void;
170
176
  /** Configuration passed to <GameView>. */
171
177
  interface GameConfig {
@@ -183,7 +189,7 @@ interface GameConfig {
183
189
  /** Called after the sprite batch has been flushed, before `renderer.end()`.
184
190
  * Receives the bridge as 3rd arg so the hook can call
185
191
  * `bridge.setPostFxBinding(runtime, chain)` to register the postfx runtime
186
- * and chain for the current frame. */
192
+ * and chain for the current frame, on native and on web alike. */
187
193
  onRenderPostFx?: PostFxRenderHook;
188
194
  /**
189
195
  * Promote the underlying Skia surface from a TextureView (default) to a
@@ -323,5 +329,5 @@ interface VirtualJoystickProps {
323
329
  * also claims the responder (e.g. <GameView>) still receive move/end events.
324
330
  */
325
331
  export declare function VirtualJoystick({ config, onStateChange, style, base, thumb }: VirtualJoystickProps): React.ReactElement;
326
- export type { CompiledPassLike, GameConfig, GameContextValue, GameViewProps, LoadingScreenProps, PostFxChainLike, PostFxPassDescriptor, PostFxRenderHook, PostFxRuntimeLike, RenderHook, RenderShapesOpts, SafeArea, ShapeRect, SkOffscreenCanvasLike, SkiaFrameRenderer, SkiaModuleLike, VirtualButtonProps, VirtualJoystickProps };
332
+ export type { CompiledPassLike, GameConfig, GameContextValue, GameViewProps, LoadingScreenProps, PostFxChainLike, PostFxPassDescriptor, PostFxRenderHook, PostFxRuntimeLike, RenderHook, RenderShapesOpts, SafeArea, ShapeRect, SkOffscreenCanvasLike, SkOffscreenSurfaceLike, SkiaFrameRenderer, SkiaModuleLike, VirtualButtonProps, VirtualJoystickProps };
327
333
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":["_$__skia_bridge_js0.SkiaFrameRenderer"],"sources":["../src/game-context.ts","../src/skia-bridge.ts","../src/safe-area.ts","../src/game-view.tsx","../src/hooks.ts","../src/loading-screen.tsx","../src/overlay-hooks.ts","../src/skia-atlas.ts","../src/virtual-button.tsx","../src/virtual-joystick.tsx"],"mappings":";;;;;;;;;;;;UAUiB;;EAEf,OAAO;;EAEP,QAAQ;;EAER,OAAO;;EAEP,OAAO;;EAEP,QAAQ;;EAER,QAAQ;;EAER,MAAM;;EAEN,UAAU;;EAEV,OAAO;;;;;;qBAOI,6BAAW,QAAA;;UCrBP;EACf,YAAY;EACZ,cAAc,gBAAgB,cAAc,cAAc;EAC1D,SAAS,eAAe;EACxB,MAAM;;;UAIS;EACf,aAAa;EACb,qBAAqB;;;;EAIrB;;;;;;UAOe;;WAEN;;WAEA,QAAQ;;;;;;WAMR,UAAU;;;;;;WAMV,mBAAmB;;;UAuBb;WACN;WACA;WACA;WACA;;WAEA;;;UAIM;WACN;WACA;;WAEA;WACA,iBAAiB;;;;;;;;;;KAWhB,iBAAiB;EAC3B;IA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Q,MAAM;;;;;;;;;wBAmBA,kBACd,QACA,eACA,OACA,MACA,SACC,uBAAuB,MAAM"}
1
+ {"version":3,"file":"index.d.mts","names":["_$__skia_bridge_js0.SkiaFrameRenderer"],"sources":["../src/game-context.ts","../src/skia-bridge.ts","../src/safe-area.ts","../src/game-view.tsx","../src/hooks.ts","../src/loading-screen.tsx","../src/overlay-hooks.ts","../src/skia-atlas.ts","../src/virtual-button.tsx","../src/virtual-joystick.tsx"],"mappings":";;;;;;;;;;;;UAUiB;;EAEf,OAAO;;EAEP,QAAQ;;EAER,OAAO;;EAEP,OAAO;;EAEP,QAAQ;;EAER,QAAQ;;EAER,MAAM;;EAEN,UAAU;;EAEV,OAAO;;;;;;qBAOI,6BAAW,QAAA;;UCrBP;EACf,YAAY;EACZ,cAAc,gBAAgB,cAAc,cAAc;EAC1D,SAAS,eAAe;EACxB,MAAM;;;UAIS;EACf,aAAa;EACb,qBAAqB;;;;EAIrB;;;;;;;UAQe;;WAEN;;WAEA,QAAQ;;;;;;WAMR,UAAU;;;;;;;;;;WAUV,mBAAmB;;;UAuBb;WACN;WACA;WACA;WACA;;WAEA;;;UAIM;WACN;WACA;;WAEA;WACA,iBAAiB;;;;;;;;;;KAWhB,iBAAiB;EAC3B;IAAkB,KAAK,eAAe;;EACtC;IACE,KAAK,eAAe,iBAAiB;IACrC,eAAe,eAAe,iBAAiB;;;EAGjD;IACE,eACE,YACA,YACA,gBACA,gBACA,OAAO,SACP,OAAO,uBACN;;;;;;;KAQK,mBAAmB;;;;;KAMnB,oBAAoB;;KAGpB,kBAAkB;;;;;;KAOlB,oBAAoB;;;;;;;;;;;wBAYhB,wBAAwB,MAAM,iBAAiB;;;;;;;wBAc/C,oBACd,MAAM,gBACN,MAAM,mBACL;UC3Kc;EACf;EACA;EACA;EACA;;qBAGW,iCAAe,QAAA;wBAEZ,eAAe;;;;;KC0EnB,cAAc,KAAK,kBAAkB;;;;;;;;KASrC,oBACV,KAAK,kBACL,iBACA,QAFKA;;UAMU;;EAEf;;EAEA;;EAEA;;EAEA,cAAc;;;EAGd,qBAAqB;;;;;EAKrB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BjB;;;UAIe;;EAEf,SAAS;;EAET,WAAW,KAAK;;EAEhB,QAAQ;;EAER,WAAW,MAAM;;;;EAIjB,WAAW;;;;;;;;;wBAUG,WACd,QACA,SACA,OACA,UACA,YACC,gBAAgB,MAAM;;;;;wBCvKT,WAAW;;;;;;;wBAcX,UAAU,OAAO;;;;;;;;wBA4BjB,YAAY,WAAW;;UC7CtB;;EAEf;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;;;;;;;;;wBAWc,gBACd,UACA,OACA,UACA,YACA,mBACC,qBAAqB,MAAM;wBC5Bd,eAAe,kBAAkB;wBAoCjC,WAAW,gBAAgB;wBAmC3B,eAAe,GAAG,QAAQ,OAAO,IAAI,SAAS,IAAI;;;;;qBCpErD,iBAAiB;;UCMb;;EAEf,iBAAiB,OAAO;;EAExB,QAAQ;;EAER,WAAW,MAAM;;;;;;;;;wBAUH,gBACd,eACA,OACA,YACC,qBAAqB,MAAM;;UCpBb;;EAEf,SAAS;;EAET,iBAAiB,OAAO;;EAExB,QAAQ;;EAER,OAAO,MAAM;;EAEb,QAAQ,MAAM;;;;;;;;;wBAmBA,kBACd,QACA,eACA,OACA,MACA,SACC,uBAAuB,MAAM"}
package/dist/index.d.ts CHANGED
@@ -42,8 +42,8 @@ interface SkOffscreenCanvasLike {
42
42
  drawRect(rect: unknown, paint: unknown): void;
43
43
  clear(color: unknown): void;
44
44
  }
45
- /** Structural canvas surface — minimal subset needed for offscreen capture. */
46
- interface SkSurfaceLike {
45
+ /** Structural offscreen surface — what `SkiaModuleLike.Surface.Make` / `MakeOffscreen` return. */
46
+ interface SkOffscreenSurfaceLike {
47
47
  getCanvas(): SkOffscreenCanvasLike;
48
48
  makeImageSnapshot(): SkImageLike;
49
49
  /** Force queued draws to execute. Required for GPU-backed surfaces before
@@ -53,7 +53,8 @@ interface SkSurfaceLike {
53
53
  }
54
54
  /**
55
55
  * A single post-processing pass descriptor built by `buildPostFxPasses`.
56
- * GameView maps each descriptor to a `<RuntimeShader>` child of `<Image>`.
56
+ * GameView maps each descriptor to a `<RuntimeShader>` image filter, or to a
57
+ * nested `<Shader>` when a pass carries `children` (see that field).
57
58
  */
58
59
  interface PostFxPassDescriptor {
59
60
  /** Stable id, used as React key. */
@@ -67,9 +68,13 @@ interface PostFxPassDescriptor {
67
68
  */
68
69
  readonly uniforms: Record<string, number | readonly number[]>;
69
70
  /**
70
- * Extra child shader slots beyond the implicit scene sampler. Empty for every
71
- * built-in effect; only color-grading-lut would populate it. Each entry
72
- * is an SkImage that GameView wraps in `<ImageShader>`.
71
+ * Extra sampler children beyond the implicit scene sampler, in SkSL
72
+ * declaration order with `src` excluded. Empty for every built-in effect
73
+ * except color-grading-lut (its LUT image). RN-Skia's `<RuntimeShader>`
74
+ * image filter cannot bind them — it calls `MakeRuntimeShader(rtb, null,
75
+ * null)`, source only — so GameView renders a pass with children, and every
76
+ * pass before it, as a nested `<Shader>` chain whose children are bound
77
+ * positionally: `src` first, then one `<ImageShader>` per entry here.
73
78
  */
74
79
  readonly children: readonly SkImage[];
75
80
  }
@@ -103,8 +108,8 @@ type SkiaModuleLike = FrameRendererModule & {
103
108
  Make(sksl: string): SkRuntimeEffect | null;
104
109
  };
105
110
  Surface?: {
106
- Make(width: number, height: number): SkSurfaceLike | null;
107
- MakeOffscreen?(width: number, height: number): SkSurfaceLike | null;
111
+ Make(width: number, height: number): SkOffscreenSurfaceLike | null;
112
+ MakeOffscreen?(width: number, height: number): SkOffscreenSurfaceLike | null;
108
113
  };
109
114
  /** Optional — present on device builds; absent in CPU/test mocks (drop-shadow falls back to the default paint). */
110
115
  ImageFilter?: {
@@ -163,9 +168,10 @@ type RenderHook = (ctx: GameContextValue, canvas: unknown) => void;
163
168
  /** Render hook for post-processing passes. Receives the game context, the
164
169
  * active Skia canvas, and the `SkiaFrameRenderer` bridge so the hook can
165
170
  * call `bridge.setPostFxBinding(runtime, chain)` to register the runtime
166
- * and chain for the current frame.
167
- * `bridge` is `null` only on platforms where no Skia renderer was created
168
- * (future web fallback). */
171
+ * and chain for the current frame. The bound chain renders on native through
172
+ * RN-Skia shader nodes and on web through the imperative composite inside the
173
+ * scene capture (see `createWebPostFxCompositor`).
174
+ * `bridge` is `null` only on platforms where no Skia renderer was created. */
169
175
  type PostFxRenderHook = (ctx: GameContextValue, canvas: unknown, bridge: SkiaFrameRenderer | null) => void;
170
176
  /** Configuration passed to <GameView>. */
171
177
  interface GameConfig {
@@ -183,7 +189,7 @@ interface GameConfig {
183
189
  /** Called after the sprite batch has been flushed, before `renderer.end()`.
184
190
  * Receives the bridge as 3rd arg so the hook can call
185
191
  * `bridge.setPostFxBinding(runtime, chain)` to register the postfx runtime
186
- * and chain for the current frame. */
192
+ * and chain for the current frame, on native and on web alike. */
187
193
  onRenderPostFx?: PostFxRenderHook;
188
194
  /**
189
195
  * Promote the underlying Skia surface from a TextureView (default) to a
@@ -323,5 +329,5 @@ interface VirtualJoystickProps {
323
329
  * also claims the responder (e.g. <GameView>) still receive move/end events.
324
330
  */
325
331
  export declare function VirtualJoystick({ config, onStateChange, style, base, thumb }: VirtualJoystickProps): React.ReactElement;
326
- export type { CompiledPassLike, GameConfig, GameContextValue, GameViewProps, LoadingScreenProps, PostFxChainLike, PostFxPassDescriptor, PostFxRenderHook, PostFxRuntimeLike, RenderHook, RenderShapesOpts, SafeArea, ShapeRect, SkOffscreenCanvasLike, SkiaFrameRenderer, SkiaModuleLike, VirtualButtonProps, VirtualJoystickProps };
332
+ export type { CompiledPassLike, GameConfig, GameContextValue, GameViewProps, LoadingScreenProps, PostFxChainLike, PostFxPassDescriptor, PostFxRenderHook, PostFxRuntimeLike, RenderHook, RenderShapesOpts, SafeArea, ShapeRect, SkOffscreenCanvasLike, SkOffscreenSurfaceLike, SkiaFrameRenderer, SkiaModuleLike, VirtualButtonProps, VirtualJoystickProps };
327
333
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["_$__skia_bridge_js0.SkiaFrameRenderer"],"sources":["../src/game-context.ts","../src/skia-bridge.ts","../src/safe-area.ts","../src/game-view.tsx","../src/hooks.ts","../src/loading-screen.tsx","../src/overlay-hooks.ts","../src/skia-atlas.ts","../src/virtual-button.tsx","../src/virtual-joystick.tsx"],"mappings":";;;;;;;;;;;;UAUiB;;EAEf,OAAO;;EAEP,QAAQ;;EAER,OAAO;;EAEP,OAAO;;EAEP,QAAQ;;EAER,QAAQ;;EAER,MAAM;;EAEN,UAAU;;EAEV,OAAO;;;;;;qBAOI,6BAAW,QAAA;;UCrBP;EACf,YAAY;EACZ,cAAc,gBAAgB,cAAc,cAAc;EAC1D,SAAS,eAAe;EACxB,MAAM;;;UAIS;EACf,aAAa;EACb,qBAAqB;;;;EAIrB;;;;;;UAOe;;WAEN;;WAEA,QAAQ;;;;;;WAMR,UAAU;;;;;;WAMV,mBAAmB;;;UAuBb;WACN;WACA;WACA;WACA;;WAEA;;;UAIM;WACN;WACA;;WAEA;WACA,iBAAiB;;;;;;;;;;KAWhB,iBAAiB;EAC3B;IAAkB,KAAK,eAAe;;EACtC;IACE,KAAK,eAAe,iBAAiB;IACrC,eAAe,eAAe,iBAAiB;;;EAGjD;IACE,eACE,YACA,YACA,gBACA,gBACA,OAAO,SACP,OAAO,uBACN;;;;;;;KAQK,mBAAmB;;;;;KAMnB,oBAAoB;;KAGpB,kBAAkB;;;;;;KAOlB,oBAAoB;;;;;;;;;;;wBAYhB,wBAAwB,MAAM,iBAAiB;;;;;;;wBAc/C,oBACd,MAAM,gBACN,MAAM,mBACL;UCtKc;EACf;EACA;EACA;EACA;;qBAGW,iCAAe,QAAA;wBAEZ,eAAe;;;;;KCuDnB,cAAc,KAAK,kBAAkB;;;;;;;KAQrC,oBACV,KAAK,kBACL,iBACA,QAFKA;;UAMU;;EAEf;;EAEA;;EAEA;;EAEA,cAAc;;;EAGd,qBAAqB;;;;;EAKrB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BjB;;;UAIe;;EAEf,SAAS;;EAET,WAAW,KAAK;;EAEhB,QAAQ;;EAER,WAAW,MAAM;;;;EAIjB,WAAW;;;;;;;;;wBAUG,WACd,QACA,SACA,OACA,UACA,YACC,gBAAgB,MAAM;;;;;wBCnJT,WAAW;;;;;;;wBAcX,UAAU,OAAO;;;;;;;;wBA4BjB,YAAY,WAAW;;UC7CtB;;EAEf;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;;;;;;;;;wBAWc,gBACd,UACA,OACA,UACA,YACA,mBACC,qBAAqB,MAAM;wBC5Bd,eAAe,kBAAkB;wBAoCjC,WAAW,gBAAgB;wBAmC3B,eAAe,GAAG,QAAQ,OAAO,IAAI,SAAS,IAAI;;;;;qBCpErD,iBAAiB;;UCMb;;EAEf,iBAAiB,OAAO;;EAExB,QAAQ;;EAER,WAAW,MAAM;;;;;;;;;wBAUH,gBACd,eACA,OACA,YACC,qBAAqB,MAAM;;UCpBb;;EAEf,SAAS;;EAET,iBAAiB,OAAO;;EAExB,QAAQ;;EAER,OAAO,MAAM;;EAEb,QAAQ,MAAM;;;;;;;;;wBAmBA,kBACd,QACA,eACA,OACA,MACA,SACC,uBAAuB,MAAM"}
1
+ {"version":3,"file":"index.d.ts","names":["_$__skia_bridge_js0.SkiaFrameRenderer"],"sources":["../src/game-context.ts","../src/skia-bridge.ts","../src/safe-area.ts","../src/game-view.tsx","../src/hooks.ts","../src/loading-screen.tsx","../src/overlay-hooks.ts","../src/skia-atlas.ts","../src/virtual-button.tsx","../src/virtual-joystick.tsx"],"mappings":";;;;;;;;;;;;UAUiB;;EAEf,OAAO;;EAEP,QAAQ;;EAER,OAAO;;EAEP,OAAO;;EAEP,QAAQ;;EAER,QAAQ;;EAER,MAAM;;EAEN,UAAU;;EAEV,OAAO;;;;;;qBAOI,6BAAW,QAAA;;UCrBP;EACf,YAAY;EACZ,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jC,WAAW,gBAAgB;wBAmC3B,eAAe,GAAG,QAAQ,OAAO,IAAI,SAAS,IAAI;;;;;qBCpErD,iBAAiB;;UCMb;;EAEf,iBAAiB,OAAO;;EAExB,QAAQ;;EAER,WAAW,MAAM;;;;;;;;;wBAUH,gBACd,eACA,OACA,YACC,qBAAqB,MAAM;;UCpBb;;EAEf,SAAS;;EAET,iBAAiB,OAAO;;EAExB,QAAQ;;EAER,OAAO,MAAM;;EAEb,QAAQ,MAAM;;;;;;;;;wBAmBA,kBACd,QACA,eACA,OACA,MACA,SACC,uBAAuB,MAAM"}
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ function useSafeArea() {
33
33
  * symbol is looked up at runtime instead of written as a computed key.
34
34
  */
35
35
  const DISPOSE = Symbol.dispose;
36
+ /** Release an RN-Skia wrapper through its `Symbol.dispose`; a no-op for null or non-disposable values. */
36
37
  function releaseSkiaObject(target) {
37
38
  if (DISPOSE === void 0 || target === null || target === void 0) return;
38
39
  const disposer = target[DISPOSE];
@@ -102,18 +103,27 @@ function createSceneSurfaceCache(Skia) {
102
103
  * The snapshot is released as soon as it has been copied. Frame images are
103
104
  * released once the ring exceeds depth 3, ensuring the canvas's rAF always has
104
105
  * a live image to paint from.
106
+ *
107
+ * The postfx chain runs **here, in place**, for the same reasons: the `postfx`
108
+ * compositor draws each pass back over this one surface between the picture
109
+ * and the snapshot (Skia's copy-on-write keeps each pass's snapshot valid), so
110
+ * the chain costs no second surface or WebGL context, and the image RN-Skia's
111
+ * `<Image>` draws is already filtered — no shader node (the per-paint leak of
112
+ * §14) is ever mounted on web.
105
113
  */
106
114
  function createSceneCapture(Skia, opts) {
107
115
  const useNonTexture = opts?.nonTextureImage ?? true;
108
116
  const retentionDepth = opts?.retentionDepth ?? 3;
117
+ const postfx = opts?.postfx ?? null;
109
118
  const surfaces = createSceneSurfaceCache(Skia);
110
119
  const ring = [];
111
120
  return {
112
- capture(picture, width, height) {
121
+ capture(picture, width, height, passes) {
113
122
  const surface = surfaces.acquire(width, height);
114
123
  if (surface === null) return null;
115
124
  surface.getCanvas().drawPicture(picture);
116
125
  surface.flush();
126
+ if (postfx !== null && passes !== void 0 && passes.length > 0) postfx.composite(surface, passes, width, height);
117
127
  const snapshot = surface.makeImageSnapshot();
118
128
  const detachable = snapshot;
119
129
  const detached = useNonTexture && detachable.makeNonTextureImage ? detachable.makeNonTextureImage() : snapshot;
@@ -126,6 +136,7 @@ function createSceneCapture(Skia, opts) {
126
136
  for (const img of ring) releaseSkiaObject(img);
127
137
  ring.length = 0;
128
138
  surfaces.dispose();
139
+ postfx?.dispose();
129
140
  }
130
141
  };
131
142
  }
@@ -189,6 +200,71 @@ function unpackArgb(out, argb) {
189
200
  out[2] = (argb & 255) / 255;
190
201
  out[3] = (argb >>> 24 & 255) / 255;
191
202
  }
203
+ // src/web-postfx.ts
204
+ /**
205
+ * Imperative postfx compositor for the web scene capture: the blit
206
+ * `@flare-engine/render-web`'s `createPostFxSurface` runs, retargeted at
207
+ * RN-Skia's web wrappers (whose `makeShaderWithChildren` does work there).
208
+ * Why the chain runs in place over the capture surface instead of as RN-Skia
209
+ * shader nodes: scene-texture.ts and docs/plans/web-target-2026-08.md §14.
210
+ */
211
+ const TILE_CLAMP = 0;
212
+ const FILTER_LINEAR = 1;
213
+ const MIPMAP_NONE = 0;
214
+ const BLEND_SRC = 1;
215
+ /**
216
+ * Create a compositor over `Skia.Paint()`. The paint, the full-surface rect and
217
+ * the shader-children array are allocated once and reused, so a frame allocates
218
+ * nothing here beyond the Skia objects each pass creates and releases.
219
+ */
220
+ function createWebPostFxCompositor(Skia) {
221
+ const paint = Skia.Paint();
222
+ paint.setBlendMode(BLEND_SRC);
223
+ const rect = {
224
+ x: 0,
225
+ y: 0,
226
+ width: 0,
227
+ height: 0
228
+ };
229
+ const childrenBuf = [null];
230
+ const wrap = (img) => img.makeShaderOptions(TILE_CLAMP, TILE_CLAMP, FILTER_LINEAR, MIPMAP_NONE);
231
+ return {
232
+ composite(surface, passes, width, height) {
233
+ if (passes.length === 0) return;
234
+ rect.width = width;
235
+ rect.height = height;
236
+ const canvas = surface.getCanvas();
237
+ for (let i = 0; i < passes.length; i++) {
238
+ const pass = passes[i];
239
+ if (pass === void 0) continue;
240
+ const snapshot = surface.makeImageSnapshot();
241
+ const childCount = 1 + pass.children.length;
242
+ childrenBuf.length = childCount;
243
+ childrenBuf[0] = wrap(snapshot);
244
+ for (let c = 0; c < pass.children.length; c++) {
245
+ const child = pass.children[c];
246
+ if (child !== null && child !== void 0) childrenBuf[c + 1] = wrap(child);
247
+ }
248
+ const shader = pass.shader.makeShaderWithChildren(pass.uniforms, childrenBuf);
249
+ if (shader !== null && shader !== void 0) {
250
+ paint.setShader(shader);
251
+ canvas.drawRect(rect, paint);
252
+ paint.setShader(null);
253
+ }
254
+ surface.flush();
255
+ releaseSkiaObject(shader);
256
+ for (let c = 0; c < childCount; c++) {
257
+ releaseSkiaObject(childrenBuf[c]);
258
+ childrenBuf[c] = null;
259
+ }
260
+ releaseSkiaObject(snapshot);
261
+ }
262
+ },
263
+ dispose() {
264
+ releaseSkiaObject(paint);
265
+ }
266
+ };
267
+ }
192
268
  // src/game-view.tsx
193
269
  /**
194
270
  * Capture the frame's picture into an offscreen surface **on the UI thread**.
@@ -266,7 +342,6 @@ function GameView({ config, onReady, style, children, safeArea }) {
266
342
  batch: new _flare_engine_render.SpriteBatch()
267
343
  };
268
344
  }, []);
269
- const webPostFxWarnedRef = (0, react.useRef)(false);
270
345
  (0, react.useEffect)(() => {
271
346
  const bridge = createSkiaFrameRenderer(_shopify_react_native_skia.Skia);
272
347
  ctx.renderer.setCanvas(bridge.canvas);
@@ -296,9 +371,11 @@ function GameView({ config, onReady, style, children, safeArea }) {
296
371
  if (isWeb) {
297
372
  if (captureRef.current === null) captureRef.current = createSceneCapture(_shopify_react_native_skia.Skia, {
298
373
  nonTextureImage: true,
299
- retentionDepth: 3
374
+ retentionDepth: 3,
375
+ postfx: createWebPostFxCompositor(_shopify_react_native_skia.Skia)
300
376
  });
301
- const img = captureRef.current.capture(pic, w * pd, h * pd);
377
+ const fx = bridge.hasPostFxBinding() ? bridge.compilePostFxPasses(null, null, w * pd, h * pd) : EMPTY_COMPILED;
378
+ const img = captureRef.current.capture(pic, w * pd, h * pd, fx);
302
379
  if (img !== null) sceneImage.value = img;
303
380
  } else (0, react_native_worklets.scheduleOnUI)(captureSceneOnUI, sceneImage, uiSurface, uiSurfaceKey, pic, w * pd, h * pd);
304
381
  }
@@ -308,9 +385,6 @@ function GameView({ config, onReady, style, children, safeArea }) {
308
385
  prevBuilt = built.length === 0 ? EMPTY_PASSES : built;
309
386
  setPasses(prevBuilt);
310
387
  }
311
- } else if (bridge.hasPostFxBinding() && !webPostFxWarnedRef.current) {
312
- console.warn("postfx chain skipped: Skia.RuntimeShaderBuilder and ImageFilter.MakeRuntimeShaderWithChildren both throw \"Not implemented on React Native Web\".");
313
- webPostFxWarnedRef.current = true;
314
388
  }
315
389
  canvasRef.current?.redraw();
316
390
  });
@@ -369,10 +443,73 @@ function GameView({ config, onReady, style, children, safeArea }) {
369
443
  }
370
444
  }, [ctx]);
371
445
  const containerStyle = (0, react.useMemo)(() => [styles$3.container, style], [style]);
372
- const passElements = (0, react.useMemo)(() => passes.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_shopify_react_native_skia.RuntimeShader, {
373
- source: p.source,
374
- uniforms: p.uniforms
375
- }, p.id)), [passes]);
446
+ const canvasContent = (0, react.useMemo)(() => {
447
+ if (viewportSize.w === 0) return null;
448
+ const w = viewportSize.w;
449
+ const h = viewportSize.h;
450
+ const last = lastPassWithChildren(passes);
451
+ if (last < 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_shopify_react_native_skia.Image, {
452
+ image: sceneImage,
453
+ x: 0,
454
+ y: 0,
455
+ width: w,
456
+ height: h,
457
+ fit: "cover",
458
+ children: passes.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_shopify_react_native_skia.RuntimeShader, {
459
+ source: p.source,
460
+ uniforms: p.uniforms
461
+ }, p.id))
462
+ });
463
+ let shader = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_shopify_react_native_skia.ImageShader, {
464
+ image: sceneImage,
465
+ fit: "cover",
466
+ rect: {
467
+ x: 0,
468
+ y: 0,
469
+ width: w,
470
+ height: h
471
+ },
472
+ tx: "clamp",
473
+ ty: "clamp",
474
+ sampling: LINEAR_SAMPLING
475
+ });
476
+ for (let i = 0; i <= last; i++) {
477
+ const p = passes[i];
478
+ if (p === void 0) continue;
479
+ const samplers = [];
480
+ for (let c = 0; c < p.children.length; c++) samplers.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_shopify_react_native_skia.ImageShader, {
481
+ image: p.children[c] ?? null,
482
+ tx: "clamp",
483
+ ty: "clamp",
484
+ sampling: LINEAR_SAMPLING
485
+ }, c));
486
+ shader = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_shopify_react_native_skia.Shader, {
487
+ source: p.source,
488
+ uniforms: p.uniforms,
489
+ children: [shader, samplers]
490
+ });
491
+ }
492
+ const filters = [];
493
+ for (let i = last + 1; i < passes.length; i++) {
494
+ const p = passes[i];
495
+ if (p === void 0) continue;
496
+ filters.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_shopify_react_native_skia.RuntimeShader, {
497
+ source: p.source,
498
+ uniforms: p.uniforms
499
+ }, p.id));
500
+ }
501
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_shopify_react_native_skia.Rect, {
502
+ x: 0,
503
+ y: 0,
504
+ width: w,
505
+ height: h,
506
+ children: [shader, filters]
507
+ });
508
+ }, [
509
+ passes,
510
+ viewportSize,
511
+ sceneImage
512
+ ]);
376
513
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SafeAreaContext.Provider, {
377
514
  value: resolvedSafeArea,
378
515
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GameContext.Provider, {
@@ -390,15 +527,7 @@ function GameView({ config, onReady, style, children, safeArea }) {
390
527
  style: react_native.StyleSheet.absoluteFill,
391
528
  pointerEvents: "none",
392
529
  opaque: config?.opaque ?? false,
393
- children: viewportSize.w === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_shopify_react_native_skia.Image, {
394
- image: sceneImage,
395
- x: 0,
396
- y: 0,
397
- width: viewportSize.w,
398
- height: viewportSize.h,
399
- fit: "cover",
400
- children: passElements
401
- })
530
+ children: canvasContent
402
531
  }), children]
403
532
  })
404
533
  })
@@ -410,6 +539,22 @@ function returnTrue$1() {
410
539
  /** Stable empty-chain reference — an empty `buildPostFxPasses` result collapses
411
540
  * to this so the `passes` state never changes for a postfx-free GameView. */
412
541
  const EMPTY_PASSES = [];
542
+ /** Stable empty compiled-pass list handed to the web capture when no chain is bound. */
543
+ const EMPTY_COMPILED = Object.freeze([]);
544
+ /** Linear, mipmap-free sampling for every ImageShader in the pass chain — the
545
+ * options render-web hands makeShaderOptions, so both backends sample alike. */
546
+ const LINEAR_SAMPLING = {
547
+ filter: _shopify_react_native_skia.FilterMode.Linear,
548
+ mipmap: _shopify_react_native_skia.MipmapMode.None
549
+ };
550
+ /** Index of the last pass carrying extra sampler children, or -1 when none does. */
551
+ function lastPassWithChildren(passes) {
552
+ for (let i = passes.length - 1; i >= 0; i--) {
553
+ const p = passes[i];
554
+ if (p !== void 0 && p.children.length > 0) return i;
555
+ }
556
+ return -1;
557
+ }
413
558
  /** Fallback insets when no `<SafeAreaProvider>` ancestor supplies a context value. */
414
559
  const ZERO_INSETS = {
415
560
  top: 0,