@rive-app/canvas-advanced-single 2.50.0 → 2.52.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/canvas-advanced-single",
3
- "version": "2.50.0",
3
+ "version": "2.52.0",
4
4
  "description": "Rive web runtime, low-level API, canvas renderer, bundled as a single JS file. Rive is an agent-native 2D and 3D engine for games, apps, and interactive UI.",
5
5
  "main": "canvas_advanced_single.mjs",
6
6
  "homepage": "https://rive.app",
@@ -26,8 +26,6 @@ export default Rive;
26
26
  export interface ScriptFetchConfig {
27
27
  proxyUrl: string | null;
28
28
  allowedHosts: string[] | null;
29
- /** 0 is no limit. */
30
- maxRequestsPerMinute: number;
31
29
  /** 0 keeps the runtime's default. */
32
30
  maxResponseBytes: number;
33
31
  }
@@ -62,8 +60,12 @@ export interface RiveCanvas {
62
60
  decodeAudio: DecodeAudio;
63
61
  decodeImage: DecodeImage;
64
62
  decodeFont: DecodeFont;
65
- // Returns a pointer value to the FontWrapper
66
- setFallbackFontCallback: (callback: (missingGlyph: number, fallbackFontIndex: number, weight: number) => number | null) => void;
63
+ // Returns a pointer value to the FontWrapper. [languages] are BCP 47 tags,
64
+ // the text's own language first, then the system languages.
65
+ setFallbackFontCallback: (callback: (missingGlyph: number, fallbackFontIndex: number, weight: number, languages: string[]) => number | null) => void;
66
+ // The preferred languages text without a language of its own shapes and
67
+ // falls back with, most preferred first.
68
+ setSystemLanguages: (languages: string[]) => void;
67
69
 
68
70
  /**
69
71
  * @experimental Creates a deferred recording session. Only present in builds
@@ -118,6 +120,9 @@ export interface RiveCanvas {
118
120
  * @param enableRiveAssetCDN - boolean flag to allow loading assets from the Rive CDN, enabled by default.
119
121
  * @param session - @experimental Deferred session to import through. The file's mode is fixed
120
122
  * at import: pass null (the default) for an immediate file.
123
+ * @param deferDecoding - Decode animations, artboards (other than the default
124
+ * one) and file level view model instances the first time they're used instead of at import.
125
+ * False by default.
121
126
  * @returns A Promise for a Rive File class
122
127
  */
123
128
  load(
@@ -125,6 +130,7 @@ export interface RiveCanvas {
125
130
  assetLoader?: FileAssetLoader,
126
131
  enableRiveAssetCDN?: boolean,
127
132
  session?: DeferredSession | null,
133
+ deferDecoding?: boolean,
128
134
  ): Promise<File>;
129
135
 
130
136
  /**
@@ -167,15 +173,25 @@ export interface RiveCanvas {
167
173
  * A Rive-specific requestAnimationFrame function; this must be used instead of the global
168
174
  * requestAnimationFrame function.
169
175
  * @param cb - Callback function to call with an elapsed timestamp
176
+ * @param onWorker - True when the caller's renderer draws on the replay
177
+ * worker (`replaysOnWorker()`), so a worker's frames pace it
170
178
  * @returns number - An ID of the requestAnimationFrame request
171
179
  */
172
- requestAnimationFrame(cb: (timestamp: DOMHighResTimeStamp) => void): number;
180
+ requestAnimationFrame(
181
+ cb: (timestamp: DOMHighResTimeStamp) => void,
182
+ onWorker?: boolean,
183
+ ): number;
173
184
  /**
174
185
  * A Rive-specific cancelAnimationFrame function; this must be used instead of the global
175
186
  * cancelAnimationFrame function.
176
187
  * @param requestID - ID of the requestAnimationFrame request to cancel
177
188
  */
178
189
  cancelAnimationFrame(requestID: number): void;
190
+ /**
191
+ * Called by the runtime whenever an asset's contents change after load (an
192
+ * image finished decoding, or an image, font or audio source was swapped).
193
+ */
194
+ onAssetChange?: () => void;
179
195
  /**
180
196
  * A Rive-specific function to "flush" queued up draw calls from using the renderer.
181
197
  * It also ends the frame for scripts, which collect their memory then.
@@ -338,7 +354,7 @@ export declare class RendererWrapper {
338
354
  acceptsFrame?(): boolean;
339
355
  /**
340
356
  * @experimental How long the replay worker's recent frames took to finish,
341
- * in milliseconds, or 0 before its first.
357
+ * in milliseconds, or 0 before its third.
342
358
  */
343
359
  replayMs?(): number;
344
360
  /**
@@ -1125,8 +1141,11 @@ export declare class StateMachineInstance {
1125
1141
  *
1126
1142
  * @param x - X coordinate
1127
1143
  * @param y - Y coordinate
1144
+ * @param id - Pointer id
1145
+ * @param button - Pointer button, as numbered by PointerButton: 0 primary
1146
+ * (default), 1 secondary, 2 middle
1128
1147
  */
1129
- pointerDown(x: number, y: number, id: number): void;
1148
+ pointerDown(x: number, y: number, id: number, button?: number): void;
1130
1149
  /**
1131
1150
  * Notifies the state machine that the pointer has moved to the given coordinate in
1132
1151
  * Artboard space. Internally, Rive may advance a state machine if the listener coordinate is of
@@ -1142,8 +1161,11 @@ export declare class StateMachineInstance {
1142
1161
  * interest at a given moment.
1143
1162
  * @param x - X coordinate
1144
1163
  * @param y - Y coordinate
1164
+ * @param id - Pointer id
1165
+ * @param button - Pointer button, as numbered by PointerButton: 0 primary
1166
+ * (default), 1 secondary, 2 middle
1145
1167
  */
1146
- pointerUp(x: number, y: number, id: number): void;
1168
+ pointerUp(x: number, y: number, id: number, button?: number): void;
1147
1169
  /**
1148
1170
  * Notifies the state machine that the pointer has exited the detectable area of the canvas surface
1149
1171
  *
@@ -1167,7 +1189,7 @@ export declare class StateMachineInstance {
1167
1189
  * @param dy - Vertical distance the content moves, in Artboard pixels. Revealing content below
1168
1190
  * is negative.
1169
1191
  * @param phase - Where the event sits within its gesture: 0 begin, 1 update, 2 end,
1170
- * 3 momentum, 4 inertiaCancel. A phaseless wheel only ever sends 1 (update).
1192
+ * 3 momentum, 4 inertiaCancel. A phaseless wheel sends 1 (update), or 3 for momentum.
1171
1193
  * @param precise - True for a pixel-precise source such as a trackpad, false for a detented
1172
1194
  * wheel.
1173
1195
  * @param timeStamp - Event time in seconds.
@@ -1206,6 +1228,16 @@ export declare class StateMachineInstance {
1206
1228
  * @param y - Y coordinate
1207
1229
  */
1208
1230
  hasScrollTargetAt(x: number, y: number): boolean;
1231
+ /**
1232
+ * Returns true if a listener under the given Artboard coordinate responds to presses of
1233
+ * button, looking through nested artboards.
1234
+ *
1235
+ * @param x - X coordinate
1236
+ * @param y - Y coordinate
1237
+ * @param button - Pointer button, as numbered by PointerButton: 0 primary, 1 secondary,
1238
+ * 2 middle
1239
+ */
1240
+ listensToButtonAt(x: number, y: number, button: number): boolean;
1209
1241
  /**
1210
1242
  * Returns true while a scroll gesture is latched to a scroll view in this state machine or a
1211
1243
  * nested one.