@splinetool/viewer 2.0.6 → 2.0.7

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.
@@ -1,6 +1,7 @@
1
1
  import { LitElement } from 'lit';
2
2
  export type LoadingType = 'auto' | 'lazy' | 'eager';
3
3
  export type EventsTargetType = 'local' | 'global';
4
+ export type RendererType = 'auto' | 'webgpu' | 'webgl' | 'webgl2';
4
5
  export type HintType = 'drag';
5
6
  export type PreloaderAnimType = 'spinner-small-dark' | 'spinner-small-light' | 'spinner-big-dark' | 'spinner-big-light';
6
7
  /**
@@ -24,6 +25,15 @@ export declare class SplineViewer extends LitElement {
24
25
  * Background color
25
26
  */
26
27
  background: string | undefined;
28
+ /**
29
+ * Rendering engine. 'auto' (default) lets the runtime pick: WebGPU
30
+ * wherever the browser provides it (honoring the Renderer setting the
31
+ * scene was exported with), WebGL everywhere else. 'webgpu' / 'webgl'
32
+ * force one engine ('webgl2' is accepted as an alias of 'webgl'). The
33
+ * engine is fixed per canvas, so changing this after a scene loaded
34
+ * rebuilds the canvas and reloads the scene.
35
+ */
36
+ renderer: RendererType;
27
37
  /**
28
38
  * Preloading strategy ('auto', 'lazy' or 'eager')
29
39
  */
@@ -49,7 +59,7 @@ export declare class SplineViewer extends LitElement {
49
59
  * Type of spinner preloader, can be 'spinner-small-dark', 'spinner-small-light' ,'spinner-big-dark', 'spinner-big-light' or undefined
50
60
  */
51
61
  loadingAnimType?: PreloaderAnimType;
52
- private _spline;
62
+ private _spline?;
53
63
  protected _intersectionObserver: IntersectionObserver | null;
54
64
  protected _isElementInViewport: boolean;
55
65
  protected _loaded: boolean;
@@ -64,6 +74,21 @@ export declare class SplineViewer extends LitElement {
64
74
  private _wasContextLost;
65
75
  constructor();
66
76
  private rerender;
77
+ /**
78
+ * The engine the `renderer` attribute asks for ('auto' → undefined),
79
+ * checked against the engine(s) compiled into this build. The
80
+ * single-engine builds (spline-viewer.webgl.js / spline-viewer.webgpu.js)
81
+ * don't contain the other engine at all, so there a mismatched request is
82
+ * ignored with a console warning and the runtime's own selection runs.
83
+ */
84
+ private _resolveRenderer;
85
+ /**
86
+ * Creates the runtime Application for the current canvas, honoring the
87
+ * `renderer` attribute. 'auto' passes no option so the runtime
88
+ * auto-selects the engine (and the `?renderer=` URL diagnostic override
89
+ * keeps working).
90
+ */
91
+ private _createApplication;
67
92
  protected unload(): void;
68
93
  protected _handleContextLost: () => void;
69
94
  protected _handleContextRestored: () => void;