modern-canvas 0.22.0 → 0.23.1

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.
@@ -29,6 +29,20 @@ export type CanvasFactory = (width?: number, height?: number) => HTMLCanvasEleme
29
29
  */
30
30
  export declare function setCanvasFactory(factory: CanvasFactory | undefined): void;
31
31
  export declare function getCanvasFactory(): CanvasFactory | undefined;
32
+ export type GlContextProvider = (canvas: HTMLCanvasElement | undefined, options?: WebGLContextAttributes) => WebGL2RenderingContext | WebGLRenderingContext | undefined;
33
+ /**
34
+ * Inject a WebGL2 context provider for non-browser environments
35
+ * (e.g. `headless-gl`, `gl`, or other off-DOM bindings). Lets the engine source
36
+ * its main rendering context when `canvas.getContext('webgl2')` isn't viable —
37
+ * the provider is consulted before falling back to the canvas's own getContext.
38
+ * Pass `undefined` to clear.
39
+ *
40
+ * Note: callers can also keep passing a fully-constructed `gl` instance via
41
+ * `new Engine({ view: gl })`; this provider is for the implicit case where the
42
+ * engine creates its own canvas.
43
+ */
44
+ export declare function setGlContextProvider(provider: GlContextProvider | undefined): void;
45
+ export declare function getGlContextProvider(): GlContextProvider | undefined;
32
46
  /**
33
47
  * Create an (offscreen) canvas via the injected factory, falling back to
34
48
  * `document.createElement('canvas')` in the browser. Returns `undefined` when