@rive-app/canvas-single 1.0.91 → 1.0.92

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-single",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "description": "Rive's high-level canvas based web api all in one js file.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -4,10 +4,9 @@ import * as rc from "./rive_advanced.mjs";
4
4
  */
5
5
  export declare type VoidCallback = () => void;
6
6
  /**
7
- * Interface for artboard bounds
7
+ * Type for artboard bounds
8
8
  */
9
- export interface Bounds extends rc.AABB {
10
- }
9
+ export declare type Bounds = rc.AABB;
11
10
  export declare enum Fit {
12
11
  Cover = "cover",
13
12
  Contain = "contain",
@@ -163,7 +162,7 @@ declare class EventManager {
163
162
  fire(event: Event): void;
164
163
  }
165
164
  export interface Task {
166
- action: VoidCallback;
165
+ action?: VoidCallback;
167
166
  event?: Event;
168
167
  }
169
168
  declare class TaskQueueManager {
@@ -274,7 +273,8 @@ export declare class Rive {
274
273
  private lastRenderTime;
275
274
  private frameRequestId;
276
275
  /**
277
- * Used be draw to track when a second of active rendering time has passed. Used for debugging purposes
276
+ * Used be draw to track when a second of active rendering time has passed.
277
+ * Used for debugging purposes
278
278
  */
279
279
  private renderSecondTimer;
280
280
  /**
@@ -334,8 +334,8 @@ export declare class Rive {
334
334
  /**
335
335
  * Accounts for devicePixelRatio as a multiplier to render the size of the canvas drawing surface.
336
336
  * Uses the size of the backing canvas to set new width/height attributes. Need to re-render
337
- * and resize the layout to match the new drawing surface afterwards. Useful function for consumers
338
- * to include in a window resize listener
337
+ * and resize the layout to match the new drawing surface afterwards.
338
+ * Useful function for consumers to include in a window resize listener
339
339
  */
340
340
  resizeDrawingSurfaceToCanvas(): void;
341
341
  get source(): string;
@@ -415,7 +415,8 @@ export declare class Rive {
415
415
  startRendering(): void;
416
416
  /**
417
417
  * Enables frames-per-second (FPS) reporting for the runtime
418
- * If no callback is provided, Rive will append a fixed-position div at the top-right corner of the page with the FPS reading
418
+ * If no callback is provided, Rive will append a fixed-position div at the top-right corner of
419
+ * the page with the FPS reading
419
420
  * @param fpsCallback - Callback from the runtime during the RAF loop that supplies the FPS value
420
421
  */
421
422
  enableFPSCounter(fpsCallback?: FPSCallback): void;
package/rive.js CHANGED
@@ -134,7 +134,7 @@ if(m.preInit)for("function"==typeof m.preInit&&(m.preInit=[m.preInit]);0<m.preIn
134
134
  /* 2 */
135
135
  /***/ ((module) => {
136
136
 
137
- module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"1.0.91","description":"Rive\'s high-level canvas based web api all in one js file.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
137
+ module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"1.0.92","description":"Rive\'s high-level canvas based web api all in one js file.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
138
138
 
139
139
  /***/ }),
140
140
  /* 3 */
@@ -362,14 +362,6 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
362
362
 
363
363
 
364
364
 
365
- // Tracks playback states; numbers map to the runtime's numerical values
366
- // i.e. play: 0, pause: 1, stop: 2
367
- var PlaybackState;
368
- (function (PlaybackState) {
369
- PlaybackState[PlaybackState["Play"] = 0] = "Play";
370
- PlaybackState[PlaybackState["Pause"] = 1] = "Pause";
371
- PlaybackState[PlaybackState["Stop"] = 2] = "Stop";
372
- })(PlaybackState || (PlaybackState = {}));
373
365
  // #region layout
374
366
  // Fit options for the canvas
375
367
  var Fit;
@@ -487,7 +479,7 @@ var RuntimeLoader = /** @class */ (function () {
487
479
  RuntimeLoader.loadRuntime = function () {
488
480
  _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__.default({
489
481
  // Loads Wasm bundle
490
- locateFile: function (_) { return RuntimeLoader.wasmURL; },
482
+ locateFile: function () { return RuntimeLoader.wasmURL; },
491
483
  }).then(function (rive) {
492
484
  var _a;
493
485
  RuntimeLoader.runtime = rive;
@@ -513,7 +505,7 @@ var RuntimeLoader = /** @class */ (function () {
513
505
  };
514
506
  // Provides a runtime instance via a promise
515
507
  RuntimeLoader.awaitInstance = function () {
516
- return new Promise(function (resolve, reject) {
508
+ return new Promise(function (resolve) {
517
509
  return RuntimeLoader.getInstance(function (rive) { return resolve(rive); });
518
510
  });
519
511
  };
@@ -1151,7 +1143,9 @@ var TaskQueueManager = /** @class */ (function () {
1151
1143
  TaskQueueManager.prototype.process = function () {
1152
1144
  while (this.queue.length > 0) {
1153
1145
  var task = this.queue.shift();
1154
- task === null || task === void 0 ? void 0 : task.action();
1146
+ if (task === null || task === void 0 ? void 0 : task.action) {
1147
+ task.action();
1148
+ }
1155
1149
  if (task === null || task === void 0 ? void 0 : task.event) {
1156
1150
  this.eventManager.fire(task.event);
1157
1151
  }
@@ -1188,7 +1182,8 @@ var Rive = /** @class */ (function () {
1188
1182
  this.frameTimes = [];
1189
1183
  this.frameCount = 0;
1190
1184
  /**
1191
- * Used be draw to track when a second of active rendering time has passed. Used for debugging purposes
1185
+ * Used be draw to track when a second of active rendering time has passed.
1186
+ * Used for debugging purposes
1192
1187
  */
1193
1188
  this.renderSecondTimer = 0;
1194
1189
  this.canvas = params.canvas;
@@ -1268,7 +1263,8 @@ var Rive = /** @class */ (function () {
1268
1263
  _this.runtime = runtime;
1269
1264
  // Get the canvas where you want to render the animation and create a renderer
1270
1265
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
1271
- // Initial size adjustment based on devicePixelRatio if no width/height are specified explicitly
1266
+ // Initial size adjustment based on devicePixelRatio if no width/height are
1267
+ // specified explicitly
1272
1268
  if (!(_this.canvas.width || _this.canvas.height)) {
1273
1269
  _this.resizeDrawingSurfaceToCanvas();
1274
1270
  }
@@ -1380,7 +1376,6 @@ var Rive = /** @class */ (function () {
1380
1376
  }
1381
1377
  // Queue up firing the playback events
1382
1378
  this.taskQueue.add({
1383
- action: function () { },
1384
1379
  event: {
1385
1380
  type: autoplay ? EventType.Play : EventType.Pause,
1386
1381
  data: instanceNames,
@@ -1419,7 +1414,7 @@ var Rive = /** @class */ (function () {
1419
1414
  .filter(function (a) { return a.playing || a.needsScrub; })
1420
1415
  // The scrubbed animations must be applied first to prevent weird artifacts
1421
1416
  // if the playing animations conflict with the scrubbed animating attribuates.
1422
- .sort(function (first, second) { return (first.needsScrub ? -1 : 1); });
1417
+ .sort(function (first) { return (first.needsScrub ? -1 : 1); });
1423
1418
  for (var _i = 0, activeAnimations_1 = activeAnimations; _i < activeAnimations_1.length; _i++) {
1424
1419
  var animation = activeAnimations_1[_i];
1425
1420
  animation.advance(elapsedTime);
@@ -1666,8 +1661,8 @@ var Rive = /** @class */ (function () {
1666
1661
  /**
1667
1662
  * Accounts for devicePixelRatio as a multiplier to render the size of the canvas drawing surface.
1668
1663
  * Uses the size of the backing canvas to set new width/height attributes. Need to re-render
1669
- * and resize the layout to match the new drawing surface afterwards. Useful function for consumers
1670
- * to include in a window resize listener
1664
+ * and resize the layout to match the new drawing surface afterwards.
1665
+ * Useful function for consumers to include in a window resize listener
1671
1666
  */
1672
1667
  Rive.prototype.resizeDrawingSurfaceToCanvas = function () {
1673
1668
  if (this.canvas instanceof HTMLCanvasElement && !!window) {
@@ -1909,7 +1904,8 @@ var Rive = /** @class */ (function () {
1909
1904
  };
1910
1905
  /**
1911
1906
  * Enables frames-per-second (FPS) reporting for the runtime
1912
- * If no callback is provided, Rive will append a fixed-position div at the top-right corner of the page with the FPS reading
1907
+ * If no callback is provided, Rive will append a fixed-position div at the top-right corner of
1908
+ * the page with the FPS reading
1913
1909
  * @param fpsCallback - Callback from the runtime during the RAF loop that supplies the FPS value
1914
1910
  */
1915
1911
  Rive.prototype.enableFPSCounter = function (fpsCallback) {