@flare-engine/react 0.4.8 → 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
@@ -108,8 +108,8 @@ type SkiaModuleLike = FrameRendererModule & {
108
108
  Make(sksl: string): SkRuntimeEffect | null;
109
109
  };
110
110
  Surface?: {
111
- Make(width: number, height: number): SkSurfaceLike | null;
112
- MakeOffscreen?(width: number, height: number): SkSurfaceLike | null;
111
+ Make(width: number, height: number): SkOffscreenSurfaceLike | null;
112
+ MakeOffscreen?(width: number, height: number): SkOffscreenSurfaceLike | null;
113
113
  };
114
114
  /** Optional — present on device builds; absent in CPU/test mocks (drop-shadow falls back to the default paint). */
115
115
  ImageFilter?: {
@@ -168,9 +168,10 @@ type RenderHook = (ctx: GameContextValue, canvas: unknown) => void;
168
168
  /** Render hook for post-processing passes. Receives the game context, the
169
169
  * active Skia canvas, and the `SkiaFrameRenderer` bridge so the hook can
170
170
  * call `bridge.setPostFxBinding(runtime, chain)` to register the runtime
171
- * and chain for the current frame.
172
- * `bridge` is `null` only on platforms where no Skia renderer was created
173
- * (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. */
174
175
  type PostFxRenderHook = (ctx: GameContextValue, canvas: unknown, bridge: SkiaFrameRenderer | null) => void;
175
176
  /** Configuration passed to <GameView>. */
176
177
  interface GameConfig {
@@ -188,7 +189,7 @@ interface GameConfig {
188
189
  /** Called after the sprite batch has been flushed, before `renderer.end()`.
189
190
  * Receives the bridge as 3rd arg so the hook can call
190
191
  * `bridge.setPostFxBinding(runtime, chain)` to register the postfx runtime
191
- * and chain for the current frame. */
192
+ * and chain for the current frame, on native and on web alike. */
192
193
  onRenderPostFx?: PostFxRenderHook;
193
194
  /**
194
195
  * Promote the underlying Skia surface from a TextureView (default) to a
@@ -328,5 +329,5 @@ interface VirtualJoystickProps {
328
329
  * also claims the responder (e.g. <GameView>) still receive move/end events.
329
330
  */
330
331
  export declare function VirtualJoystick({ config, onStateChange, style, base, thumb }: VirtualJoystickProps): React.ReactElement;
331
- 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 };
332
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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;;;;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.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;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;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
@@ -108,8 +108,8 @@ type SkiaModuleLike = FrameRendererModule & {
108
108
  Make(sksl: string): SkRuntimeEffect | null;
109
109
  };
110
110
  Surface?: {
111
- Make(width: number, height: number): SkSurfaceLike | null;
112
- MakeOffscreen?(width: number, height: number): SkSurfaceLike | null;
111
+ Make(width: number, height: number): SkOffscreenSurfaceLike | null;
112
+ MakeOffscreen?(width: number, height: number): SkOffscreenSurfaceLike | null;
113
113
  };
114
114
  /** Optional — present on device builds; absent in CPU/test mocks (drop-shadow falls back to the default paint). */
115
115
  ImageFilter?: {
@@ -168,9 +168,10 @@ type RenderHook = (ctx: GameContextValue, canvas: unknown) => void;
168
168
  /** Render hook for post-processing passes. Receives the game context, the
169
169
  * active Skia canvas, and the `SkiaFrameRenderer` bridge so the hook can
170
170
  * call `bridge.setPostFxBinding(runtime, chain)` to register the runtime
171
- * and chain for the current frame.
172
- * `bridge` is `null` only on platforms where no Skia renderer was created
173
- * (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. */
174
175
  type PostFxRenderHook = (ctx: GameContextValue, canvas: unknown, bridge: SkiaFrameRenderer | null) => void;
175
176
  /** Configuration passed to <GameView>. */
176
177
  interface GameConfig {
@@ -188,7 +189,7 @@ interface GameConfig {
188
189
  /** Called after the sprite batch has been flushed, before `renderer.end()`.
189
190
  * Receives the bridge as 3rd arg so the hook can call
190
191
  * `bridge.setPostFxBinding(runtime, chain)` to register the postfx runtime
191
- * and chain for the current frame. */
192
+ * and chain for the current frame, on native and on web alike. */
192
193
  onRenderPostFx?: PostFxRenderHook;
193
194
  /**
194
195
  * Promote the underlying Skia surface from a TextureView (default) to a
@@ -328,5 +329,5 @@ interface VirtualJoystickProps {
328
329
  * also claims the responder (e.g. <GameView>) still receive move/end events.
329
330
  */
330
331
  export declare function VirtualJoystick({ config, onStateChange, style, base, thumb }: VirtualJoystickProps): React.ReactElement;
331
- 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 };
332
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,QAA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;;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,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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;;;;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
  });
@@ -465,6 +539,8 @@ function returnTrue$1() {
465
539
  /** Stable empty-chain reference — an empty `buildPostFxPasses` result collapses
466
540
  * to this so the `passes` state never changes for a postfx-free GameView. */
467
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([]);
468
544
  /** Linear, mipmap-free sampling for every ImageShader in the pass chain — the
469
545
  * options render-web hands makeShaderOptions, so both backends sample alike. */
470
546
  const LINEAR_SAMPLING = {