@rive-app/webgl 2.14.3 → 2.15.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/webgl",
3
- "version": "2.14.3",
3
+ "version": "2.15.0",
4
4
  "description": "Rive's webgl based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as rc from "./rive_advanced.mjs";
2
- export type { FileAsset, FontAsset, ImageAsset } from "./rive_advanced.mjs";
2
+ export type { FileAsset, AudioAsset, FontAsset, ImageAsset, } from "./rive_advanced.mjs";
3
3
  /**
4
4
  * Generic type for a parameterless void callback
5
5
  */
@@ -567,17 +567,24 @@ export declare const Testing: {
567
567
  EventManager: typeof EventManager;
568
568
  TaskQueueManager: typeof TaskQueueManager;
569
569
  };
570
+ /**
571
+ * Decodes bytes into an audio asset.
572
+ *
573
+ * Be sure to call `.unref()` on the audio once it is no longer needed. This
574
+ * allows the engine to clean it up when it is not used by any more animations.
575
+ */
576
+ export declare const decodeAudio: (bytes: Uint8Array) => Promise<rc.Audio>;
570
577
  /**
571
578
  * Decodes bytes into an image.
572
579
  *
573
- * Be sure to call `.dispose()` on the image once it is no longer needed. This
580
+ * Be sure to call `.unref()` on the image once it is no longer needed. This
574
581
  * allows the engine to clean it up when it is not used by any more animations.
575
582
  */
576
583
  export declare const decodeImage: (bytes: Uint8Array) => Promise<rc.Image>;
577
584
  /**
578
585
  * Decodes bytes into a font.
579
586
  *
580
- * Be sure to call `.dispose()` on the font once it is no longer needed. This
587
+ * Be sure to call `.unref()` on the font once it is no longer needed. This
581
588
  * allows the engine to clean it up when it is not used by any more animations.
582
589
  */
583
590
  export declare const decodeFont: (bytes: Uint8Array) => Promise<rc.Font>;
package/rive.js CHANGED
@@ -91,52 +91,57 @@ function da() {
91
91
  const ea = m.onRuntimeInitialized;
92
92
  m.onRuntimeInitialized = function() {
93
93
  ea && ea();
94
- let a = m.decodeFont;
95
- m.decodeFont = function(c, d) {
96
- c = a(c);
97
- d(c);
94
+ let a = m.decodeAudio;
95
+ m.decodeAudio = function(d, e) {
96
+ d = a(d);
97
+ e(d);
98
98
  };
99
- const b = m.FileAssetLoader;
100
- m.ptrToAsset = c => {
101
- let d = m.ptrToFileAsset(c);
102
- return d.isImage ? m.ptrToImageAsset(c) : d.isFont ? m.ptrToFontAsset(c) : d;
99
+ let b = m.decodeFont;
100
+ m.decodeFont = function(d, e) {
101
+ d = b(d);
102
+ e(d);
103
103
  };
104
- m.CustomFileAssetLoader = b.extend("CustomFileAssetLoader", {__construct:function({loadContents:c}) {
104
+ const c = m.FileAssetLoader;
105
+ m.ptrToAsset = d => {
106
+ let e = m.ptrToFileAsset(d);
107
+ return e.isImage ? m.ptrToImageAsset(d) : e.isFont ? m.ptrToFontAsset(d) : e.isAudio ? m.ptrToAudioAsset(d) : e;
108
+ };
109
+ m.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:d}) {
105
110
  this.__parent.__construct.call(this);
106
- this.Cb = c;
107
- }, loadContents:function(c, d) {
108
- c = m.ptrToAsset(c);
109
- return this.Cb(c, d);
111
+ this.Cb = d;
112
+ }, loadContents:function(d, e) {
113
+ d = m.ptrToAsset(d);
114
+ return this.Cb(d, e);
110
115
  },});
111
- m.CDNFileAssetLoader = b.extend("CDNFileAssetLoader", {__construct:function() {
116
+ m.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() {
112
117
  this.__parent.__construct.call(this);
113
- }, loadContents:function(c) {
114
- let d = m.ptrToAsset(c);
115
- c = d.cdnUuid;
116
- if ("" === c) {
118
+ }, loadContents:function(d) {
119
+ let e = m.ptrToAsset(d);
120
+ d = e.cdnUuid;
121
+ if ("" === d) {
117
122
  return !1;
118
123
  }
119
- (function(e, f) {
120
- var g = new XMLHttpRequest();
121
- g.responseType = "arraybuffer";
122
- g.onreadystatechange = function() {
123
- 4 == g.readyState && 200 == g.status && f(g);
124
+ (function(f, g) {
125
+ var k = new XMLHttpRequest();
126
+ k.responseType = "arraybuffer";
127
+ k.onreadystatechange = function() {
128
+ 4 == k.readyState && 200 == k.status && g(k);
124
129
  };
125
- g.open("GET", e, !0);
126
- g.send(null);
127
- })(d.cdnBaseUrl + "/" + c, e => {
128
- d.decode(new Uint8Array(e.response));
130
+ k.open("GET", f, !0);
131
+ k.send(null);
132
+ })(e.cdnBaseUrl + "/" + d, f => {
133
+ e.decode(new Uint8Array(f.response));
129
134
  });
130
135
  return !0;
131
136
  },});
132
- m.FallbackFileAssetLoader = b.extend("FallbackFileAssetLoader", {__construct:function() {
137
+ m.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() {
133
138
  this.__parent.__construct.call(this);
134
139
  this.gb = [];
135
- }, addLoader:function(c) {
136
- this.gb.push(c);
137
- }, loadContents:function(c, d) {
138
- for (let e of this.gb) {
139
- if (e.loadContents(c, d)) {
140
+ }, addLoader:function(d) {
141
+ this.gb.push(d);
142
+ }, loadContents:function(d, e) {
143
+ for (let f of this.gb) {
144
+ if (f.loadContents(d, e)) {
140
145
  return !0;
141
146
  }
142
147
  }
@@ -395,7 +400,7 @@ function Ra(a, b) {
395
400
  return Qa(c, a, b);
396
401
  }));
397
402
  }
398
- var E, F, Va = {688572:(a, b, c, d, e) => {
403
+ var E, F, Va = {688828:(a, b, c, d, e) => {
399
404
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
400
405
  return 0;
401
406
  }
@@ -458,9 +463,9 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
458
463
  }
459
464
  window.h.Ea += 1;
460
465
  return 1;
461
- }, 690750:() => {
466
+ }, 691006:() => {
462
467
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
463
- }, 690914:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691018:() => {
468
+ }, 691170:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691274:() => {
464
469
  try {
465
470
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
466
471
  a.close();
@@ -468,7 +473,7 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
468
473
  } catch (c) {
469
474
  return 0;
470
475
  }
471
- }, 691189:(a, b, c, d, e, f) => {
476
+ }, 691445:(a, b, c, d, e, f) => {
472
477
  if ("undefined" === typeof window.h) {
473
478
  return -1;
474
479
  }
@@ -514,7 +519,7 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
514
519
  a == window.h.H.Da && g.Y.connect(g.I.destination);
515
520
  g.mb = f;
516
521
  return window.h.vc(g);
517
- }, 694066:a => window.h.ua(a).I.sampleRate, 694139:a => {
522
+ }, 694322:a => window.h.ua(a).I.sampleRate, 694395:a => {
518
523
  a = window.h.ua(a);
519
524
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
520
525
  }, a.Y.disconnect(), a.Y = void 0);
@@ -522,13 +527,13 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
522
527
  a.I.close();
523
528
  a.I = void 0;
524
529
  a.mb = void 0;
525
- }, 694539:a => {
530
+ }, 694795:a => {
526
531
  window.h.yb(a);
527
- }, 694589:a => {
532
+ }, 694845:a => {
528
533
  a = window.h.ua(a);
529
534
  a.I.resume();
530
535
  a.state = window.h.ha.tb;
531
- }, 694728:a => {
536
+ }, 694984:a => {
532
537
  a = window.h.ua(a);
533
538
  a.I.suspend();
534
539
  a.state = window.h.ha.stopped;
@@ -3842,7 +3847,7 @@ var Fe = {__syscall_fcntl64:function(a, b, c) {
3842
3847
  }).catch(ba);
3843
3848
  return {};
3844
3849
  })();
3845
- var Yd = a => (Yd = p.malloc)(a), tc = a => (tc = p.free)(a), Sa = m._ma_device__on_notification_unlocked = a => (Sa = m._ma_device__on_notification_unlocked = p.ma_device__on_notification_unlocked)(a);
3850
+ var tc = a => (tc = p.free)(a), Yd = a => (Yd = p.malloc)(a), Sa = m._ma_device__on_notification_unlocked = a => (Sa = m._ma_device__on_notification_unlocked = p.ma_device__on_notification_unlocked)(a);
3846
3851
  m._ma_malloc_emscripten = (a, b) => (m._ma_malloc_emscripten = p.ma_malloc_emscripten)(a, b);
3847
3852
  m._ma_free_emscripten = (a, b) => (m._ma_free_emscripten = p.ma_free_emscripten)(a, b);
3848
3853
  var Ta = m._ma_device_process_pcm_frames_capture__webaudio = (a, b, c) => (Ta = m._ma_device_process_pcm_frames_capture__webaudio = p.ma_device_process_pcm_frames_capture__webaudio)(a, b, c), Ua = m._ma_device_process_pcm_frames_playback__webaudio = (a, b, c) => (Ua = m._ma_device_process_pcm_frames_playback__webaudio = p.ma_device_process_pcm_frames_playback__webaudio)(a, b, c), pe = () => (pe = p.__errno_location)(), sc = a => (sc = p.__getTypeName)(a);
@@ -4104,7 +4109,7 @@ Ie();
4104
4109
  /* 2 */
4105
4110
  /***/ ((module) => {
4106
4111
 
4107
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.14.3","description":"Rive\'s webgl based web api.","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.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4112
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.15.0","description":"Rive\'s webgl based web api.","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.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4108
4113
 
4109
4114
  /***/ }),
4110
4115
  /* 3 */
@@ -4402,6 +4407,7 @@ __webpack_require__.r(__webpack_exports__);
4402
4407
  /* harmony export */ StateMachineInput: () => (/* binding */ StateMachineInput),
4403
4408
  /* harmony export */ StateMachineInputType: () => (/* binding */ StateMachineInputType),
4404
4409
  /* harmony export */ Testing: () => (/* binding */ Testing),
4410
+ /* harmony export */ decodeAudio: () => (/* binding */ decodeAudio),
4405
4411
  /* harmony export */ decodeFont: () => (/* binding */ decodeFont),
4406
4412
  /* harmony export */ decodeImage: () => (/* binding */ decodeImage)
4407
4413
  /* harmony export */ });
@@ -6576,10 +6582,23 @@ var Testing = {
6576
6582
  };
6577
6583
  // #endregion
6578
6584
  // #region asset loaders
6585
+ /**
6586
+ * Decodes bytes into an audio asset.
6587
+ *
6588
+ * Be sure to call `.unref()` on the audio once it is no longer needed. This
6589
+ * allows the engine to clean it up when it is not used by any more animations.
6590
+ */
6591
+ var decodeAudio = function (bytes) {
6592
+ return new Promise(function (resolve) {
6593
+ return RuntimeLoader.getInstance(function (rive) {
6594
+ rive.decodeAudio(bytes, resolve);
6595
+ });
6596
+ });
6597
+ };
6579
6598
  /**
6580
6599
  * Decodes bytes into an image.
6581
6600
  *
6582
- * Be sure to call `.dispose()` on the image once it is no longer needed. This
6601
+ * Be sure to call `.unref()` on the image once it is no longer needed. This
6583
6602
  * allows the engine to clean it up when it is not used by any more animations.
6584
6603
  */
6585
6604
  var decodeImage = function (bytes) {
@@ -6592,7 +6611,7 @@ var decodeImage = function (bytes) {
6592
6611
  /**
6593
6612
  * Decodes bytes into a font.
6594
6613
  *
6595
- * Be sure to call `.dispose()` on the font once it is no longer needed. This
6614
+ * Be sure to call `.unref()` on the font once it is no longer needed. This
6596
6615
  * allows the engine to clean it up when it is not used by any more animations.
6597
6616
  */
6598
6617
  var decodeFont = function (bytes) {