@rive-app/webgl-advanced 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-advanced",
3
- "version": "2.14.3",
3
+ "version": "2.15.0",
4
4
  "description": "Rive's webgl low-level canvas based web api.",
5
5
  "main": "webgl_advanced.mjs",
6
6
  "homepage": "https://rive.app",
package/rive.wasm CHANGED
Binary file
@@ -29,7 +29,8 @@ export interface RiveCanvas {
29
29
  RenderPaintStyle: typeof RenderPaintStyle;
30
30
  StrokeCap: typeof StrokeCap;
31
31
  StrokeJoin: typeof StrokeJoin;
32
- decodeImage: DecodeFont;
32
+ decodeAudio: DecodeAudio;
33
+ decodeImage: DecodeImage;
33
34
  decodeFont: DecodeFont;
34
35
 
35
36
  /**
@@ -92,7 +93,7 @@ export interface RiveCanvas {
92
93
  cancelAnimationFrame(requestID: number): void;
93
94
  /**
94
95
  * A Rive-specific function to "flush" queued up draw calls from using the renderer.
95
- *
96
+ *
96
97
  * This should only be invoked once at the end of a loop in a regular JS
97
98
  * requestAnimationFrame loop, and should not be used with the Rive-wrapped
98
99
  * requestAnimationFrame (aka, the requestAnimationFrame() API on this object) as that
@@ -269,6 +270,15 @@ export interface CanvasRenderFactory {
269
270
  makeRenderPath(): CanvasRenderPath;
270
271
  }
271
272
 
273
+ export class Audio {
274
+ unref(): void;
275
+ }
276
+ export interface AudioCallback {
277
+ (audio: Audio): void;
278
+ }
279
+ export interface DecodeAudio {
280
+ (bytes: Uint8Array, callback: AudioCallback): void;
281
+ }
272
282
  export class Image {
273
283
  unref(): void;
274
284
  }
@@ -896,13 +906,25 @@ export declare class Vec2D {
896
906
  export declare class FileAsset {
897
907
  name: string;
898
908
  fileExtension: string;
909
+ uniqueFilename: string;
910
+ isAudio: boolean;
899
911
  isImage: boolean;
900
912
  isFont: boolean;
901
913
  cdnUuid: string;
914
+
915
+ decode(bytes: Uint8Array): void;
916
+ }
917
+
918
+ /**
919
+ * Rive class extending the FileAsset that exposes a `setAudioSource()` API with a
920
+ * decoded Audio (via the `decodeAudio()` API) to set a new Audio on the Rive FileAsset
921
+ */
922
+ export declare class AudioAsset extends FileAsset {
923
+ setAudioSource(audio: Audio): void;
902
924
  }
903
925
 
904
926
  /**
905
- * Rive class extending the FileAsset that exposes a `setRenderImage()` API with a
927
+ * Rive class extending the FileAsset that exposes a `setRenderImage()` API with a
906
928
  * decoded Image (via the `decodeImage()` API) to set a new Image on the Rive FileAsset
907
929
  */
908
930
  export declare class ImageAsset extends FileAsset {
@@ -910,7 +932,7 @@ export declare class ImageAsset extends FileAsset {
910
932
  }
911
933
 
912
934
  /**
913
- * Rive class extending the FileAsset that exposes a `setFont()` API with a
935
+ * Rive class extending the FileAsset that exposes a `setFont()` API with a
914
936
  * decoded Font (via the `decodeFont()` API) to set a new Font on the Rive FileAsset
915
937
  */
916
938
  export declare class FontAsset extends FileAsset {
@@ -70,52 +70,57 @@ function da() {
70
70
  const ea = m.onRuntimeInitialized;
71
71
  m.onRuntimeInitialized = function() {
72
72
  ea && ea();
73
- let a = m.decodeFont;
74
- m.decodeFont = function(c, d) {
75
- c = a(c);
76
- d(c);
73
+ let a = m.decodeAudio;
74
+ m.decodeAudio = function(d, e) {
75
+ d = a(d);
76
+ e(d);
77
77
  };
78
- const b = m.FileAssetLoader;
79
- m.ptrToAsset = c => {
80
- let d = m.ptrToFileAsset(c);
81
- return d.isImage ? m.ptrToImageAsset(c) : d.isFont ? m.ptrToFontAsset(c) : d;
78
+ let b = m.decodeFont;
79
+ m.decodeFont = function(d, e) {
80
+ d = b(d);
81
+ e(d);
82
82
  };
83
- m.CustomFileAssetLoader = b.extend("CustomFileAssetLoader", {__construct:function({loadContents:c}) {
83
+ const c = m.FileAssetLoader;
84
+ m.ptrToAsset = d => {
85
+ let e = m.ptrToFileAsset(d);
86
+ return e.isImage ? m.ptrToImageAsset(d) : e.isFont ? m.ptrToFontAsset(d) : e.isAudio ? m.ptrToAudioAsset(d) : e;
87
+ };
88
+ m.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:d}) {
84
89
  this.__parent.__construct.call(this);
85
- this.Cb = c;
86
- }, loadContents:function(c, d) {
87
- c = m.ptrToAsset(c);
88
- return this.Cb(c, d);
90
+ this.Cb = d;
91
+ }, loadContents:function(d, e) {
92
+ d = m.ptrToAsset(d);
93
+ return this.Cb(d, e);
89
94
  },});
90
- m.CDNFileAssetLoader = b.extend("CDNFileAssetLoader", {__construct:function() {
95
+ m.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() {
91
96
  this.__parent.__construct.call(this);
92
- }, loadContents:function(c) {
93
- let d = m.ptrToAsset(c);
94
- c = d.cdnUuid;
95
- if ("" === c) {
97
+ }, loadContents:function(d) {
98
+ let e = m.ptrToAsset(d);
99
+ d = e.cdnUuid;
100
+ if ("" === d) {
96
101
  return !1;
97
102
  }
98
- (function(e, f) {
99
- var g = new XMLHttpRequest();
100
- g.responseType = "arraybuffer";
101
- g.onreadystatechange = function() {
102
- 4 == g.readyState && 200 == g.status && f(g);
103
+ (function(f, g) {
104
+ var k = new XMLHttpRequest();
105
+ k.responseType = "arraybuffer";
106
+ k.onreadystatechange = function() {
107
+ 4 == k.readyState && 200 == k.status && g(k);
103
108
  };
104
- g.open("GET", e, !0);
105
- g.send(null);
106
- })(d.cdnBaseUrl + "/" + c, e => {
107
- d.decode(new Uint8Array(e.response));
109
+ k.open("GET", f, !0);
110
+ k.send(null);
111
+ })(e.cdnBaseUrl + "/" + d, f => {
112
+ e.decode(new Uint8Array(f.response));
108
113
  });
109
114
  return !0;
110
115
  },});
111
- m.FallbackFileAssetLoader = b.extend("FallbackFileAssetLoader", {__construct:function() {
116
+ m.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() {
112
117
  this.__parent.__construct.call(this);
113
118
  this.gb = [];
114
- }, addLoader:function(c) {
115
- this.gb.push(c);
116
- }, loadContents:function(c, d) {
117
- for (let e of this.gb) {
118
- if (e.loadContents(c, d)) {
119
+ }, addLoader:function(d) {
120
+ this.gb.push(d);
121
+ }, loadContents:function(d, e) {
122
+ for (let f of this.gb) {
123
+ if (f.loadContents(d, e)) {
119
124
  return !0;
120
125
  }
121
126
  }
@@ -374,7 +379,7 @@ function Ra(a, b) {
374
379
  return Qa(c, a, b);
375
380
  }));
376
381
  }
377
- var E, F, Va = {688572:(a, b, c, d, e) => {
382
+ var E, F, Va = {688828:(a, b, c, d, e) => {
378
383
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
379
384
  return 0;
380
385
  }
@@ -437,9 +442,9 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
437
442
  }
438
443
  window.h.Ea += 1;
439
444
  return 1;
440
- }, 690750:() => {
445
+ }, 691006:() => {
441
446
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
442
- }, 690914:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691018:() => {
447
+ }, 691170:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691274:() => {
443
448
  try {
444
449
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
445
450
  a.close();
@@ -447,7 +452,7 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
447
452
  } catch (c) {
448
453
  return 0;
449
454
  }
450
- }, 691189:(a, b, c, d, e, f) => {
455
+ }, 691445:(a, b, c, d, e, f) => {
451
456
  if ("undefined" === typeof window.h) {
452
457
  return -1;
453
458
  }
@@ -493,7 +498,7 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
493
498
  a == window.h.H.Da && g.Y.connect(g.I.destination);
494
499
  g.mb = f;
495
500
  return window.h.vc(g);
496
- }, 694066:a => window.h.ua(a).I.sampleRate, 694139:a => {
501
+ }, 694322:a => window.h.ua(a).I.sampleRate, 694395:a => {
497
502
  a = window.h.ua(a);
498
503
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
499
504
  }, a.Y.disconnect(), a.Y = void 0);
@@ -501,13 +506,13 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
501
506
  a.I.close();
502
507
  a.I = void 0;
503
508
  a.mb = void 0;
504
- }, 694539:a => {
509
+ }, 694795:a => {
505
510
  window.h.yb(a);
506
- }, 694589:a => {
511
+ }, 694845:a => {
507
512
  a = window.h.ua(a);
508
513
  a.I.resume();
509
514
  a.state = window.h.ha.tb;
510
- }, 694728:a => {
515
+ }, 694984:a => {
511
516
  a = window.h.ua(a);
512
517
  a.I.suspend();
513
518
  a.state = window.h.ha.stopped;
@@ -3821,7 +3826,7 @@ var Fe = {__syscall_fcntl64:function(a, b, c) {
3821
3826
  }).catch(ba);
3822
3827
  return {};
3823
3828
  })();
3824
- 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);
3829
+ 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);
3825
3830
  m._ma_malloc_emscripten = (a, b) => (m._ma_malloc_emscripten = p.ma_malloc_emscripten)(a, b);
3826
3831
  m._ma_free_emscripten = (a, b) => (m._ma_free_emscripten = p.ma_free_emscripten)(a, b);
3827
3832
  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);