@rive-app/webgl2-threads 2.49.4 → 2.50.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/package.json +1 -1
- package/rive.d.ts +2 -2
- package/rive.js +782 -634
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +17 -0
- package/rive_fallback.wasm +0 -0
- package/rive_threads.wasm +0 -0
- package/runtimeLoader.d.ts +66 -0
package/rive.wasm
CHANGED
|
Binary file
|
package/rive_advanced.mjs.d.ts
CHANGED
|
@@ -22,6 +22,16 @@ interface RiveOptions {
|
|
|
22
22
|
declare function Rive(options?: RiveOptions): Promise<RiveCanvas>;
|
|
23
23
|
export default Rive;
|
|
24
24
|
|
|
25
|
+
/** Resolved script fetch options; see RuntimeLoader.setScriptFetch. */
|
|
26
|
+
export interface ScriptFetchConfig {
|
|
27
|
+
proxyUrl: string | null;
|
|
28
|
+
allowedHosts: string[] | null;
|
|
29
|
+
/** 0 is no limit. */
|
|
30
|
+
maxRequestsPerMinute: number;
|
|
31
|
+
/** 0 keeps the runtime's default. */
|
|
32
|
+
maxResponseBytes: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
/**
|
|
26
36
|
* RiveCanvas is the main export object that contains references to different Rive classes to help
|
|
27
37
|
* build the Rive render loop for low-level API usage. In addition, this contains multiple methods
|
|
@@ -93,6 +103,13 @@ export interface RiveCanvas {
|
|
|
93
103
|
*/
|
|
94
104
|
awaitReplayCaps?(): Promise<void> | undefined;
|
|
95
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @experimental Enables scripts' fetch() for every file, or disables it
|
|
108
|
+
* with null. Only in builds with script networking (the threaded webgl2
|
|
109
|
+
* build), so always feature-detect it. Use RuntimeLoader.setScriptFetch.
|
|
110
|
+
*/
|
|
111
|
+
configureScriptFetch?(options: ScriptFetchConfig | null): void;
|
|
112
|
+
|
|
96
113
|
/**
|
|
97
114
|
* Loads a Rive file for the runtime and returns a Rive-specific File class
|
|
98
115
|
*
|
package/rive_fallback.wasm
CHANGED
|
Binary file
|
package/rive_threads.wasm
CHANGED
|
Binary file
|
package/runtimeLoader.d.ts
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
import * as rc from "./rive_advanced.mjs";
|
|
2
2
|
export type RuntimeCallback = (rive: rc.RiveCanvas) => void;
|
|
3
|
+
/**
|
|
4
|
+
* @experimental Options for {@link RuntimeLoader.setScriptFetch}. Requests
|
|
5
|
+
* sent from this page, or through the reference proxy page, never carry
|
|
6
|
+
* cookies or other credentials, a referrer or the HTTP cache, and redirects
|
|
7
|
+
* fail with "policy". A proxy page of your own decides these itself. Either
|
|
8
|
+
* way, the runtime allows only https: URLs on public hosts, and checks the
|
|
9
|
+
* URL a response came from against `allowedHosts`.
|
|
10
|
+
*/
|
|
11
|
+
export interface ScriptFetchOptions {
|
|
12
|
+
/**
|
|
13
|
+
* URL of a script fetch proxy page, hosted on a cookie-less domain, that
|
|
14
|
+
* accepts this page's origin. It loads in a hidden iframe added to the
|
|
15
|
+
* page's `<body>`. Requests then leave from the proxy's origin
|
|
16
|
+
* under its CSP. On a cross origin isolated page, the proxy page must be
|
|
17
|
+
* served with `Cross-Origin-Embedder-Policy: require-corp` and
|
|
18
|
+
* `Cross-Origin-Resource-Policy: cross-origin`. Without it, requests leave
|
|
19
|
+
* from this page with `fetch()`.
|
|
20
|
+
*/
|
|
21
|
+
proxyUrl?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Hosts scripts may fetch from: exact (`"api.example.com"`), any subdomain
|
|
24
|
+
* (`"*.example.com"`, which doesn't match `"example.com"`) or any host
|
|
25
|
+
* (`"*"`). Omitted is `["*"]`; empty allows none. This page's own host is
|
|
26
|
+
* only allowed when named, e.g. `["*", "www.example.com"]`.
|
|
27
|
+
*/
|
|
28
|
+
allowedHosts?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Requests scripts may start per minute, counted per scripting VM, so
|
|
31
|
+
* scripts that share one share the limit. Requests past it wait their turn
|
|
32
|
+
* rather than fail. 0 is no limit. Default 60.
|
|
33
|
+
*/
|
|
34
|
+
maxRequestsPerMinute?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Largest response body, in bytes, up to 64 MiB. 0 keeps the default of
|
|
37
|
+
* 16 MiB.
|
|
38
|
+
*/
|
|
39
|
+
maxResponseBytes?: number;
|
|
40
|
+
}
|
|
3
41
|
export declare class RuntimeLoader {
|
|
4
42
|
private static runtime;
|
|
5
43
|
private static isLoading;
|
|
@@ -14,6 +52,8 @@ export declare class RuntimeLoader {
|
|
|
14
52
|
private static replayWorker;
|
|
15
53
|
private static replayCapsArrived;
|
|
16
54
|
private static readonly replayCapsTimeoutMs;
|
|
55
|
+
private static scriptFetch;
|
|
56
|
+
private static warnedNoScriptFetch;
|
|
17
57
|
private static errorCallbackQueue;
|
|
18
58
|
private constructor();
|
|
19
59
|
/**
|
|
@@ -76,6 +116,32 @@ export declare class RuntimeLoader {
|
|
|
76
116
|
*/
|
|
77
117
|
static setReplayWorker(enabled: boolean): void;
|
|
78
118
|
static getReplayWorker(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* @experimental Lets scripts in Rive files call `fetch()`. Pass `true` or
|
|
121
|
+
* options to enable it for every file on the page, `false` to disable it.
|
|
122
|
+
* Only `@rive-app/webgl2-threads` running its threaded build has it;
|
|
123
|
+
* elsewhere this warns once and does nothing.
|
|
124
|
+
*
|
|
125
|
+
* Enabling it lets any script in any file this page loads send what it
|
|
126
|
+
* can read to the hosts it may reach. Limit them with `allowedHosts`.
|
|
127
|
+
* Scripts can't fetch this page's own host unless `allowedHosts` names it.
|
|
128
|
+
*
|
|
129
|
+
* Each call replaces the previous options, and any option left out goes
|
|
130
|
+
* back to its default (an omitted `allowedHosts` allows every host). To
|
|
131
|
+
* change one option, spread the current ones:
|
|
132
|
+
*
|
|
133
|
+
* ```ts
|
|
134
|
+
* RuntimeLoader.setScriptFetch({
|
|
135
|
+
* ...RuntimeLoader.getScriptFetch(),
|
|
136
|
+
* maxResponseBytes: 32 * 1024 * 1024,
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* Disabled by default.
|
|
141
|
+
*/
|
|
142
|
+
static setScriptFetch(options: ScriptFetchOptions | boolean): void;
|
|
143
|
+
static getScriptFetch(): ScriptFetchOptions | null;
|
|
144
|
+
private static applyScriptFetch;
|
|
79
145
|
static setWasmBinary(value: ArrayBuffer | null): void;
|
|
80
146
|
static getWasmBinary(): ArrayBuffer | null;
|
|
81
147
|
}
|