@rive-app/webgl-advanced 2.26.3 → 2.26.5

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.26.3",
3
+ "version": "2.26.5",
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
@@ -335,6 +335,33 @@ export declare class File {
335
335
  * @returns Number of artboards in the Rive file
336
336
  */
337
337
  artboardCount(): number;
338
+ /**
339
+ * Returns the number of View Models in the Rive File
340
+ * @returns Number of view models in the Rive file
341
+ */
342
+ viewModelCount(): number;
343
+ /**
344
+ * Returns a view model by the index in which it is located in the file
345
+ * @returns ViewModel
346
+ */
347
+ viewModelByIndex(index: number): ViewModel;
348
+ /**
349
+ * Returns a view model by name
350
+ * @returns ViewModel
351
+ */
352
+ viewModelByName(name: string): ViewModel;
353
+
354
+ /**
355
+ * Returns the default view model for the provided artboard
356
+ * @returns ViewModel
357
+ */
358
+ defaultArtboardViewModel(artboard: Artboard): ViewModel;
359
+
360
+ /**
361
+ * Returns a list of all data enums
362
+ * @returns DataEnum array in the Rive file
363
+ */
364
+ enums(): DataEnum[];
338
365
 
339
366
  delete(): void;
340
367
  }
@@ -509,6 +536,11 @@ export declare class Artboard {
509
536
  * Reset the artboard size to the original value
510
537
  */
511
538
  resetArtboardSize(): void;
539
+ /**
540
+ * binds the view model instance to the artboard
541
+ * @param instance - Renderer context to draw with
542
+ */
543
+ bindViewModelInstance(instance: ViewModelInstance): void;
512
544
  }
513
545
 
514
546
  export declare class Bone extends TransformComponent {
@@ -796,6 +828,12 @@ export declare class StateMachineInstance {
796
828
  * when no longer in use
797
829
  */
798
830
  delete(): void;
831
+
832
+ /**
833
+ * binds the view model instance to the state machine
834
+ * @param instance - Renderer context to draw with
835
+ */
836
+ bindViewModelInstance(instance: ViewModelInstance): void;
799
837
  }
800
838
 
801
839
  export declare class SMIInput {
@@ -826,6 +864,85 @@ export declare class SMIInput {
826
864
  asTrigger(): SMIInput;
827
865
  }
828
866
 
867
+ export declare type ViewModelProperty = {
868
+ name: string;
869
+ type: DataType;
870
+ };
871
+
872
+ export declare class ViewModelInstanceValue {
873
+ get hasChanged(): boolean;
874
+ clearChanges(): void;
875
+ get name(): string;
876
+ }
877
+
878
+ export declare class ViewModelInstanceNumber extends ViewModelInstanceValue {
879
+ get value(): number;
880
+ set value(val: number);
881
+ }
882
+
883
+ export declare class ViewModelInstanceTrigger extends ViewModelInstanceValue {
884
+ trigger(): void;
885
+ }
886
+
887
+ export declare class ViewModelInstanceString extends ViewModelInstanceValue {
888
+ get value(): string;
889
+ set value(val: string);
890
+ }
891
+
892
+ export declare class ViewModelInstanceBoolean extends ViewModelInstanceValue {
893
+ get value(): boolean;
894
+ set value(val: boolean);
895
+ }
896
+
897
+ export declare class ViewModelInstanceColor extends ViewModelInstanceValue {
898
+ get value(): number;
899
+ set value(val: number);
900
+ rgb(r: number, g: number, b: number): void;
901
+ argb(a: number, r: number, g: number, b: number): void;
902
+ alpha(a: number): void;
903
+ }
904
+
905
+ export declare class ViewModelInstanceEnum extends ViewModelInstanceValue {
906
+ get value(): string;
907
+ set value(val: string);
908
+ get valueIndex(): number;
909
+ set valueIndex(val: number);
910
+ get values(): string[];
911
+ }
912
+
913
+ export declare class ViewModelInstance {
914
+ get propertyCount(): number;
915
+ number(path: string): ViewModelInstanceNumber;
916
+ string(path: string): ViewModelInstanceString;
917
+ boolean(path: string): ViewModelInstanceBoolean;
918
+ color(path: string): ViewModelInstanceColor;
919
+ enum(path: string): ViewModelInstanceEnum;
920
+ trigger(path: string): ViewModelInstanceTrigger;
921
+ viewModel(path: string): ViewModelInstance;
922
+ replaceViewModel(path: string, value: ViewModelInstance): boolean;
923
+ incrementReferenceCount(): void;
924
+ decrementReferenceCount(): void;
925
+ delete(): void;
926
+ getProperties(): ViewModelProperty[];
927
+ }
928
+
929
+ export declare class ViewModel {
930
+ get instanceCount(): number;
931
+ instanceByIndex(index: number): ViewModelInstance;
932
+ instanceByName(name: string): ViewModelInstance;
933
+ defaultInstance(): ViewModelInstance;
934
+ instance(): ViewModelInstance;
935
+ getProperties(): ViewModelProperty[];
936
+ getInstanceNames(): string[];
937
+ get propertyCount(): number;
938
+ get name(): string;
939
+ }
940
+
941
+ export declare class DataEnum {
942
+ get name(): string;
943
+ get values(): string[];
944
+ }
945
+
829
946
  export declare class SMIBool {}
830
947
 
831
948
  export declare class SMINumber {}
@@ -836,6 +953,18 @@ export declare class SMITrigger {}
836
953
  // ENUMS //
837
954
  ///////////
838
955
 
956
+ export enum DataType {
957
+ none,
958
+ string,
959
+ number,
960
+ boolean,
961
+ color,
962
+ list,
963
+ enumType,
964
+ trigger,
965
+ viewModel,
966
+ }
967
+
839
968
  export enum Fit {
840
969
  fill,
841
970
  contain,
Binary file
@@ -166,9 +166,9 @@ l.onRuntimeInitialized = function() {
166
166
  function b(r) {
167
167
  var u = {alpha:1, depth:0, stencil:8, antialias:0, premultipliedAlpha:1, preserveDrawingBuffer:0, powerPreference:"high-performance", failIfMajorPerformanceCaveat:0, enableExtensionsByDefault:1, explicitSwapControl:0, renderViaOffscreenBackBuffer:0,}, z = r.getContext("webgl2", u);
168
168
  z || (z = r.getContext("webgl", u));
169
- var B = z, C = ha(ja), O = {handle:C, attributes:u, version:u.Dc, Ta:B};
169
+ var B = z, C = ha(ia), O = {handle:C, attributes:u, version:u.Dc, Ta:B};
170
170
  B.canvas && (B.canvas.pc = O);
171
- ja[C] = O;
171
+ ia[C] = O;
172
172
  ("undefined" == typeof u.Jb || u.Jb) && ka(O);
173
173
  la(C);
174
174
  u = g(r.width, r.height);
@@ -193,7 +193,7 @@ l.onRuntimeInitialized = function() {
193
193
  }
194
194
  u = Math.min(u, r);
195
195
  u = Math.min(z, r);
196
- C.sort((ia, Gb) => Gb.Ja - ia.Ja);
196
+ C.sort((ja, Gb) => Gb.Ja - ja.Ja);
197
197
  B = new l.DynamicRectanizer(r);
198
198
  for (M = 0; M < C.length;) {
199
199
  B.reset(u, z);
@@ -218,13 +218,13 @@ l.onRuntimeInitialized = function() {
218
218
  for (P = M; P < O; ++P) {
219
219
  J = C[P];
220
220
  e.saveClipRect(J.pa, J.qa, J.pa + J.da, J.qa + J.ca);
221
- let ia = new l.Mat2D();
222
- ia.xx = J.da / J.F.width;
223
- ia.yy = J.ca / J.F.height;
224
- ia.xy = ia.yx = 0;
225
- ia.tx = J.pa;
226
- ia.ty = J.qa;
227
- e.transform(ia);
221
+ let ja = new l.Mat2D();
222
+ ja.xx = J.da / J.F.width;
223
+ ja.yy = J.ca / J.F.height;
224
+ ja.xy = ja.yx = 0;
225
+ ja.tx = J.pa;
226
+ ja.ty = J.qa;
227
+ e.transform(ja);
228
228
  for (const Gb of J.R) {
229
229
  Gb();
230
230
  }
@@ -387,7 +387,7 @@ function Qa(a, b) {
387
387
  return Pa(c, a, b);
388
388
  }));
389
389
  }
390
- var Ra, Sa, Wa = {702476:(a, b, c, d, e) => {
390
+ var Ra, Sa, Wa = {704636:(a, b, c, d, e) => {
391
391
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
392
392
  return 0;
393
393
  }
@@ -450,9 +450,9 @@ var Ra, Sa, Wa = {702476:(a, b, c, d, e) => {
450
450
  }
451
451
  window.h.Ea += 1;
452
452
  return 1;
453
- }, 704654:() => {
453
+ }, 706814:() => {
454
454
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
455
- }, 704818:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 704922:() => {
455
+ }, 706978:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 707082:() => {
456
456
  try {
457
457
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
458
458
  a.close();
@@ -460,7 +460,7 @@ var Ra, Sa, Wa = {702476:(a, b, c, d, e) => {
460
460
  } catch (c) {
461
461
  return 0;
462
462
  }
463
- }, 705093:(a, b, c, d, e, f) => {
463
+ }, 707253:(a, b, c, d, e, f) => {
464
464
  if ("undefined" === typeof window.h) {
465
465
  return -1;
466
466
  }
@@ -506,7 +506,7 @@ var Ra, Sa, Wa = {702476:(a, b, c, d, e) => {
506
506
  a == window.h.H.Ca && g.X.connect(g.I.destination);
507
507
  g.lb = f;
508
508
  return window.h.nc(g);
509
- }, 707970:a => window.h.ta(a).I.sampleRate, 708043:a => {
509
+ }, 710130:a => window.h.ta(a).I.sampleRate, 710203:a => {
510
510
  a = window.h.ta(a);
511
511
  void 0 !== a.X && (a.X.onaudioprocess = function() {
512
512
  }, a.X.disconnect(), a.X = void 0);
@@ -514,13 +514,13 @@ var Ra, Sa, Wa = {702476:(a, b, c, d, e) => {
514
514
  a.I.close();
515
515
  a.I = void 0;
516
516
  a.lb = void 0;
517
- }, 708443:a => {
517
+ }, 710603:a => {
518
518
  window.h.xb(a);
519
- }, 708493:a => {
519
+ }, 710653:a => {
520
520
  a = window.h.ta(a);
521
521
  a.I.resume();
522
522
  a.state = window.h.ha.sb;
523
- }, 708632:a => {
523
+ }, 710792:a => {
524
524
  a = window.h.ta(a);
525
525
  a.I.suspend();
526
526
  a.state = window.h.ha.stopped;
@@ -1799,7 +1799,7 @@ function Bd(a) {
1799
1799
  b.drawBuffersWEBGL(c, d);
1800
1800
  });
1801
1801
  }
1802
- var Cd = 1, Dd = [], Ed = [], Fd = [], Gd = [], Hd = [], Id = [], Jd = [], ja = [], Kd = [], Ld = [], Md = {}, Nd = {}, Od = 4;
1802
+ var Cd = 1, Dd = [], Ed = [], Fd = [], Gd = [], Hd = [], Id = [], Jd = [], ia = [], Kd = [], Ld = [], Md = {}, Nd = {}, Od = 4;
1803
1803
  function S(a) {
1804
1804
  Pd || (Pd = a);
1805
1805
  }
@@ -1810,7 +1810,7 @@ function ha(a) {
1810
1810
  return b;
1811
1811
  }
1812
1812
  function la(a) {
1813
- T = ja[a];
1813
+ T = ia[a];
1814
1814
  l.yc = U = T && T.Ta;
1815
1815
  return !(a && !U);
1816
1816
  }
@@ -2909,6 +2909,8 @@ var Ge = {__syscall_fcntl64:function(a, b, c) {
2909
2909
  return ic(a[b]);
2910
2910
  }, _emval_incref:function(a) {
2911
2911
  4 < a && (I.get(a).pb += 1);
2912
+ }, _emval_new_array:function() {
2913
+ return ic([]);
2912
2914
  }, _emval_new_cstring:function(a) {
2913
2915
  return ic(td(a));
2914
2916
  }, _emval_new_object:function() {