@rive-app/webgl2 2.14.4 → 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/webgl2",
3
- "version": "2.14.4",
3
+ "version": "2.15.0",
4
4
  "description": "Rive's webgl2 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 ea() {
91
91
  const fa = n.onRuntimeInitialized;
92
92
  n.onRuntimeInitialized = function() {
93
93
  fa && fa();
94
- let a = n.decodeFont;
95
- n.decodeFont = function(c, d) {
96
- c = a(c);
97
- d(c);
94
+ let a = n.decodeAudio;
95
+ n.decodeAudio = function(d, e) {
96
+ d = a(d);
97
+ e(d);
98
98
  };
99
- const b = n.FileAssetLoader;
100
- n.ptrToAsset = c => {
101
- let d = n.ptrToFileAsset(c);
102
- return d.isImage ? n.ptrToImageAsset(c) : d.isFont ? n.ptrToFontAsset(c) : d;
99
+ let b = n.decodeFont;
100
+ n.decodeFont = function(d, e) {
101
+ d = b(d);
102
+ e(d);
103
103
  };
104
- n.CustomFileAssetLoader = b.extend("CustomFileAssetLoader", {__construct:function({loadContents:c}) {
104
+ const c = n.FileAssetLoader;
105
+ n.ptrToAsset = d => {
106
+ let e = n.ptrToFileAsset(d);
107
+ return e.isImage ? n.ptrToImageAsset(d) : e.isFont ? n.ptrToFontAsset(d) : e.isAudio ? n.ptrToAudioAsset(d) : e;
108
+ };
109
+ n.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:d}) {
105
110
  this.__parent.__construct.call(this);
106
- this.Ab = c;
107
- }, loadContents:function(c, d) {
108
- c = n.ptrToAsset(c);
109
- return this.Ab(c, d);
111
+ this.Ab = d;
112
+ }, loadContents:function(d, e) {
113
+ d = n.ptrToAsset(d);
114
+ return this.Ab(d, e);
110
115
  },});
111
- n.CDNFileAssetLoader = b.extend("CDNFileAssetLoader", {__construct:function() {
116
+ n.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() {
112
117
  this.__parent.__construct.call(this);
113
- }, loadContents:function(c) {
114
- let d = n.ptrToAsset(c);
115
- c = d.cdnUuid;
116
- if ("" === c) {
118
+ }, loadContents:function(d) {
119
+ let e = n.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 m = new XMLHttpRequest();
126
+ m.responseType = "arraybuffer";
127
+ m.onreadystatechange = function() {
128
+ 4 == m.readyState && 200 == m.status && g(m);
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
+ m.open("GET", f, !0);
131
+ m.send(null);
132
+ })(e.cdnBaseUrl + "/" + d, f => {
133
+ e.decode(new Uint8Array(f.response));
129
134
  });
130
135
  return !0;
131
136
  },});
132
- n.FallbackFileAssetLoader = b.extend("FallbackFileAssetLoader", {__construct:function() {
137
+ n.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() {
133
138
  this.__parent.__construct.call(this);
134
139
  this.fb = [];
135
- }, addLoader:function(c) {
136
- this.fb.push(c);
137
- }, loadContents:function(c, d) {
138
- for (let e of this.fb) {
139
- if (e.loadContents(c, d)) {
140
+ }, addLoader:function(d) {
141
+ this.fb.push(d);
142
+ }, loadContents:function(d, e) {
143
+ for (let f of this.fb) {
144
+ if (f.loadContents(d, e)) {
140
145
  return !0;
141
146
  }
142
147
  }
@@ -410,7 +415,7 @@ function Pa(a, b) {
410
415
  return Oa(c, a, b);
411
416
  }));
412
417
  }
413
- var J, K, Ta = {473872:(a, b, c, d, e) => {
418
+ var J, K, Ta = {474240:(a, b, c, d, e) => {
414
419
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
415
420
  return 0;
416
421
  }
@@ -473,9 +478,9 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
473
478
  }
474
479
  window.h.Da += 1;
475
480
  return 1;
476
- }, 476050:() => {
481
+ }, 476418:() => {
477
482
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
478
- }, 476214:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 476318:() => {
483
+ }, 476582:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 476686:() => {
479
484
  try {
480
485
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
481
486
  a.close();
@@ -483,7 +488,7 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
483
488
  } catch (c) {
484
489
  return 0;
485
490
  }
486
- }, 476489:(a, b, c, d, e, f) => {
491
+ }, 476857:(a, b, c, d, e, f) => {
487
492
  if ("undefined" === typeof window.h) {
488
493
  return -1;
489
494
  }
@@ -529,7 +534,7 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
529
534
  a == window.h.I.Ca && g.Z.connect(g.J.destination);
530
535
  g.kb = f;
531
536
  return window.h.tc(g);
532
- }, 479366:a => window.h.wa(a).J.sampleRate, 479439:a => {
537
+ }, 479734:a => window.h.wa(a).J.sampleRate, 479807:a => {
533
538
  a = window.h.wa(a);
534
539
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
535
540
  }, a.Z.disconnect(), a.Z = void 0);
@@ -537,13 +542,13 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
537
542
  a.J.close();
538
543
  a.J = void 0;
539
544
  a.kb = void 0;
540
- }, 479839:a => {
545
+ }, 480207:a => {
541
546
  window.h.xb(a);
542
- }, 479889:a => {
547
+ }, 480257:a => {
543
548
  a = window.h.wa(a);
544
549
  a.J.resume();
545
550
  a.state = window.h.ha.sb;
546
- }, 480028:a => {
551
+ }, 480396:a => {
547
552
  a = window.h.wa(a);
548
553
  a.J.suspend();
549
554
  a.state = window.h.ha.stopped;
@@ -3548,8 +3553,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = y.dynCall_viijii
3548
3553
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = y.dynCall_iiiiij)(a, b, c, d, e, f, g);
3549
3554
  n.dynCall_iiiiijj = (a, b, c, d, e, f, g, m, p) => (n.dynCall_iiiiijj = y.dynCall_iiiiijj)(a, b, c, d, e, f, g, m, p);
3550
3555
  n.dynCall_iiiiiijj = (a, b, c, d, e, f, g, m, p, l) => (n.dynCall_iiiiiijj = y.dynCall_iiiiiijj)(a, b, c, d, e, f, g, m, p, l);
3551
- n.___start_em_js = 471248;
3552
- n.___stop_em_js = 473872;
3556
+ n.___start_em_js = 471616;
3557
+ n.___stop_em_js = 474240;
3553
3558
  var $d;
3554
3559
  Ia = function ae() {
3555
3560
  $d || be();
@@ -3609,7 +3614,7 @@ be();
3609
3614
  /* 2 */
3610
3615
  /***/ ((module) => {
3611
3616
 
3612
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.14.4","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"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}}');
3617
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.15.0","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"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}}');
3613
3618
 
3614
3619
  /***/ }),
3615
3620
  /* 3 */
@@ -3907,6 +3912,7 @@ __webpack_require__.r(__webpack_exports__);
3907
3912
  /* harmony export */ StateMachineInput: () => (/* binding */ StateMachineInput),
3908
3913
  /* harmony export */ StateMachineInputType: () => (/* binding */ StateMachineInputType),
3909
3914
  /* harmony export */ Testing: () => (/* binding */ Testing),
3915
+ /* harmony export */ decodeAudio: () => (/* binding */ decodeAudio),
3910
3916
  /* harmony export */ decodeFont: () => (/* binding */ decodeFont),
3911
3917
  /* harmony export */ decodeImage: () => (/* binding */ decodeImage)
3912
3918
  /* harmony export */ });
@@ -6081,10 +6087,23 @@ var Testing = {
6081
6087
  };
6082
6088
  // #endregion
6083
6089
  // #region asset loaders
6090
+ /**
6091
+ * Decodes bytes into an audio asset.
6092
+ *
6093
+ * Be sure to call `.unref()` on the audio once it is no longer needed. This
6094
+ * allows the engine to clean it up when it is not used by any more animations.
6095
+ */
6096
+ var decodeAudio = function (bytes) {
6097
+ return new Promise(function (resolve) {
6098
+ return RuntimeLoader.getInstance(function (rive) {
6099
+ rive.decodeAudio(bytes, resolve);
6100
+ });
6101
+ });
6102
+ };
6084
6103
  /**
6085
6104
  * Decodes bytes into an image.
6086
6105
  *
6087
- * Be sure to call `.dispose()` on the image once it is no longer needed. This
6106
+ * Be sure to call `.unref()` on the image once it is no longer needed. This
6088
6107
  * allows the engine to clean it up when it is not used by any more animations.
6089
6108
  */
6090
6109
  var decodeImage = function (bytes) {
@@ -6097,7 +6116,7 @@ var decodeImage = function (bytes) {
6097
6116
  /**
6098
6117
  * Decodes bytes into a font.
6099
6118
  *
6100
- * Be sure to call `.dispose()` on the font once it is no longer needed. This
6119
+ * Be sure to call `.unref()` on the font once it is no longer needed. This
6101
6120
  * allows the engine to clean it up when it is not used by any more animations.
6102
6121
  */
6103
6122
  var decodeFont = function (bytes) {