@rive-app/webgl2-advanced 2.14.4 → 2.15.1

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-advanced",
3
- "version": "2.14.4",
3
+ "version": "2.15.1",
4
4
  "description": "Rive's webgl2 low-level canvas based web api.",
5
5
  "main": "webgl2_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
  }
@@ -338,6 +348,7 @@ export declare class Artboard {
338
348
  * Get the bounds of this Artboard instance
339
349
  */
340
350
  get bounds(): AABB;
351
+ get hasAudio(): boolean;
341
352
  get frameOrigin(): boolean;
342
353
  set frameOrigin(val: boolean);
343
354
  /**
@@ -896,13 +907,25 @@ export declare class Vec2D {
896
907
  export declare class FileAsset {
897
908
  name: string;
898
909
  fileExtension: string;
910
+ uniqueFilename: string;
911
+ isAudio: boolean;
899
912
  isImage: boolean;
900
913
  isFont: boolean;
901
914
  cdnUuid: string;
915
+
916
+ decode(bytes: Uint8Array): void;
917
+ }
918
+
919
+ /**
920
+ * Rive class extending the FileAsset that exposes a `setAudioSource()` API with a
921
+ * decoded Audio (via the `decodeAudio()` API) to set a new Audio on the Rive FileAsset
922
+ */
923
+ export declare class AudioAsset extends FileAsset {
924
+ setAudioSource(audio: Audio): void;
902
925
  }
903
926
 
904
927
  /**
905
- * Rive class extending the FileAsset that exposes a `setRenderImage()` API with a
928
+ * Rive class extending the FileAsset that exposes a `setRenderImage()` API with a
906
929
  * decoded Image (via the `decodeImage()` API) to set a new Image on the Rive FileAsset
907
930
  */
908
931
  export declare class ImageAsset extends FileAsset {
@@ -910,7 +933,7 @@ export declare class ImageAsset extends FileAsset {
910
933
  }
911
934
 
912
935
  /**
913
- * Rive class extending the FileAsset that exposes a `setFont()` API with a
936
+ * Rive class extending the FileAsset that exposes a `setFont()` API with a
914
937
  * decoded Font (via the `decodeFont()` API) to set a new Font on the Rive FileAsset
915
938
  */
916
939
  export declare class FontAsset extends FileAsset {
@@ -70,52 +70,57 @@ function ea() {
70
70
  const fa = n.onRuntimeInitialized;
71
71
  n.onRuntimeInitialized = function() {
72
72
  fa && fa();
73
- let a = n.decodeFont;
74
- n.decodeFont = function(c, d) {
75
- c = a(c);
76
- d(c);
73
+ let a = n.decodeAudio;
74
+ n.decodeAudio = function(d, e) {
75
+ d = a(d);
76
+ e(d);
77
77
  };
78
- const b = n.FileAssetLoader;
79
- n.ptrToAsset = c => {
80
- let d = n.ptrToFileAsset(c);
81
- return d.isImage ? n.ptrToImageAsset(c) : d.isFont ? n.ptrToFontAsset(c) : d;
78
+ let b = n.decodeFont;
79
+ n.decodeFont = function(d, e) {
80
+ d = b(d);
81
+ e(d);
82
82
  };
83
- n.CustomFileAssetLoader = b.extend("CustomFileAssetLoader", {__construct:function({loadContents:c}) {
83
+ const c = n.FileAssetLoader;
84
+ n.ptrToAsset = d => {
85
+ let e = n.ptrToFileAsset(d);
86
+ return e.isImage ? n.ptrToImageAsset(d) : e.isFont ? n.ptrToFontAsset(d) : e.isAudio ? n.ptrToAudioAsset(d) : e;
87
+ };
88
+ n.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:d}) {
84
89
  this.__parent.__construct.call(this);
85
- this.Ab = c;
86
- }, loadContents:function(c, d) {
87
- c = n.ptrToAsset(c);
88
- return this.Ab(c, d);
90
+ this.Ab = d;
91
+ }, loadContents:function(d, e) {
92
+ d = n.ptrToAsset(d);
93
+ return this.Ab(d, e);
89
94
  },});
90
- n.CDNFileAssetLoader = b.extend("CDNFileAssetLoader", {__construct:function() {
95
+ n.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() {
91
96
  this.__parent.__construct.call(this);
92
- }, loadContents:function(c) {
93
- let d = n.ptrToAsset(c);
94
- c = d.cdnUuid;
95
- if ("" === c) {
97
+ }, loadContents:function(d) {
98
+ let e = n.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 m = new XMLHttpRequest();
105
+ m.responseType = "arraybuffer";
106
+ m.onreadystatechange = function() {
107
+ 4 == m.readyState && 200 == m.status && g(m);
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
+ m.open("GET", f, !0);
110
+ m.send(null);
111
+ })(e.cdnBaseUrl + "/" + d, f => {
112
+ e.decode(new Uint8Array(f.response));
108
113
  });
109
114
  return !0;
110
115
  },});
111
- n.FallbackFileAssetLoader = b.extend("FallbackFileAssetLoader", {__construct:function() {
116
+ n.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() {
112
117
  this.__parent.__construct.call(this);
113
118
  this.fb = [];
114
- }, addLoader:function(c) {
115
- this.fb.push(c);
116
- }, loadContents:function(c, d) {
117
- for (let e of this.fb) {
118
- if (e.loadContents(c, d)) {
119
+ }, addLoader:function(d) {
120
+ this.fb.push(d);
121
+ }, loadContents:function(d, e) {
122
+ for (let f of this.fb) {
123
+ if (f.loadContents(d, e)) {
119
124
  return !0;
120
125
  }
121
126
  }
@@ -389,7 +394,7 @@ function Pa(a, b) {
389
394
  return Oa(c, a, b);
390
395
  }));
391
396
  }
392
- var J, K, Ta = {473872:(a, b, c, d, e) => {
397
+ var J, K, Ta = {474256:(a, b, c, d, e) => {
393
398
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
394
399
  return 0;
395
400
  }
@@ -452,9 +457,9 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
452
457
  }
453
458
  window.h.Da += 1;
454
459
  return 1;
455
- }, 476050:() => {
460
+ }, 476434:() => {
456
461
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
457
- }, 476214:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 476318:() => {
462
+ }, 476598:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 476702:() => {
458
463
  try {
459
464
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
460
465
  a.close();
@@ -462,7 +467,7 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
462
467
  } catch (c) {
463
468
  return 0;
464
469
  }
465
- }, 476489:(a, b, c, d, e, f) => {
470
+ }, 476873:(a, b, c, d, e, f) => {
466
471
  if ("undefined" === typeof window.h) {
467
472
  return -1;
468
473
  }
@@ -508,7 +513,7 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
508
513
  a == window.h.I.Ca && g.Z.connect(g.J.destination);
509
514
  g.kb = f;
510
515
  return window.h.tc(g);
511
- }, 479366:a => window.h.wa(a).J.sampleRate, 479439:a => {
516
+ }, 479750:a => window.h.wa(a).J.sampleRate, 479823:a => {
512
517
  a = window.h.wa(a);
513
518
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
514
519
  }, a.Z.disconnect(), a.Z = void 0);
@@ -516,13 +521,13 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
516
521
  a.J.close();
517
522
  a.J = void 0;
518
523
  a.kb = void 0;
519
- }, 479839:a => {
524
+ }, 480223:a => {
520
525
  window.h.xb(a);
521
- }, 479889:a => {
526
+ }, 480273:a => {
522
527
  a = window.h.wa(a);
523
528
  a.J.resume();
524
529
  a.state = window.h.ha.sb;
525
- }, 480028:a => {
530
+ }, 480412:a => {
526
531
  a = window.h.wa(a);
527
532
  a.J.suspend();
528
533
  a.state = window.h.ha.stopped;
@@ -3527,8 +3532,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = y.dynCall_viijii
3527
3532
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = y.dynCall_iiiiij)(a, b, c, d, e, f, g);
3528
3533
  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);
3529
3534
  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);
3530
- n.___start_em_js = 471248;
3531
- n.___stop_em_js = 473872;
3535
+ n.___start_em_js = 471632;
3536
+ n.___stop_em_js = 474256;
3532
3537
  var $d;
3533
3538
  Ia = function ae() {
3534
3539
  $d || be();