@limitlesspc/std 0.22.0 → 0.23.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.
@@ -801,39 +801,23 @@ var radians = (degrees2) => degrees2 * DEG2RAD;
801
801
  var degrees = (radians2) => radians2 / DEG2RAD;
802
802
 
803
803
  // src/math/vector/vec2.ts
804
- var Vec2 = class _Vec2 extends Float32Array {
805
- static BYTE_LENGTH = 2 * Float32Array.BYTES_PER_ELEMENT;
804
+ var Vec2 = class _Vec2 {
805
+ x;
806
+ y;
806
807
  constructor(x = 0, y) {
807
- super([0, 0]);
808
808
  if (typeof x === "number") {
809
809
  this.x = x;
810
810
  this.y = y ?? x;
811
811
  } else {
812
- [this[0] = 0, this[1] = 0] = x;
812
+ this.x = x.x;
813
+ this.y = x.y;
813
814
  }
814
815
  }
815
- /* prettier-ignore */
816
- get x() {
817
- return this[0] || 0;
818
- }
819
- /* prettier-ignore */
820
- set x(value) {
821
- this[0] = value;
822
- }
823
- /* prettier-ignore */
824
- get y() {
825
- return this[1] || 0;
826
- }
827
- /* prettier-ignore */
828
- set y(value) {
829
- this[1] = value;
830
- }
831
816
  toString() {
832
- const [x, y] = this;
833
- return `vec2 <${x}, ${y}>`;
817
+ return `vec2 <${this.x}, ${this.y}>`;
834
818
  }
835
819
  copy() {
836
- return vec2(...this);
820
+ return vec2(this);
837
821
  }
838
822
  static random(mag = 1) {
839
823
  return vec2(1, 0).rotate(random(Math.PI * 2)).setMag(mag);
@@ -842,15 +826,25 @@ var Vec2 = class _Vec2 extends Float32Array {
842
826
  if (typeof x === "number") {
843
827
  return this.x === x && this.y === (y ?? x);
844
828
  }
845
- return this.x === x[0] && this.y === x[1];
829
+ return this.x === x.x && this.y === x.y;
830
+ }
831
+ set(x, y) {
832
+ if (typeof x === "number") {
833
+ this.x = x;
834
+ this.y = y ?? x;
835
+ } else {
836
+ this.x = x.x;
837
+ this.y = x.y;
838
+ }
839
+ return this;
846
840
  }
847
841
  add(x, y) {
848
842
  if (typeof x === "number") {
849
843
  this.x += x;
850
844
  this.y += y ?? x;
851
845
  } else {
852
- this.x += x[0];
853
- this.y += x[1];
846
+ this.x += x.x;
847
+ this.y += x.y;
854
848
  }
855
849
  return this;
856
850
  }
@@ -862,8 +856,8 @@ var Vec2 = class _Vec2 extends Float32Array {
862
856
  this.x -= x;
863
857
  this.y -= y ?? x;
864
858
  } else {
865
- this.x -= x[0];
866
- this.y -= x[1];
859
+ this.x -= x.x;
860
+ this.y -= x.y;
867
861
  }
868
862
  return this;
869
863
  }
@@ -875,8 +869,8 @@ var Vec2 = class _Vec2 extends Float32Array {
875
869
  this.x *= x;
876
870
  this.y *= y ?? x;
877
871
  } else {
878
- this.x *= x[0];
879
- this.y *= x[1];
872
+ this.x *= x.x;
873
+ this.y *= x.y;
880
874
  }
881
875
  return this;
882
876
  }
@@ -888,8 +882,8 @@ var Vec2 = class _Vec2 extends Float32Array {
888
882
  this.x /= x;
889
883
  this.y /= y ?? x;
890
884
  } else {
891
- this.x /= x[0];
892
- this.y /= x[1];
885
+ this.x /= x.x;
886
+ this.y /= x.y;
893
887
  }
894
888
  return this;
895
889
  }
@@ -897,19 +891,19 @@ var Vec2 = class _Vec2 extends Float32Array {
897
891
  return v1.copy().div(x, y);
898
892
  }
899
893
  static fma(a, b, c) {
900
- return vec2(a[0] * b[0] + c[0], a[1] * b[1] + c[1]);
894
+ return vec2(a.x * b.x + c.x, a.y * b.y + c.y);
901
895
  }
902
896
  lt(v) {
903
- return vec2(this.x < v[0] ? 1 : 0, this.y < v[1] ? 1 : 0);
897
+ return vec2(this.x < v.x ? 1 : 0, this.y < v.y ? 1 : 0);
904
898
  }
905
899
  lte(v) {
906
- return vec2(this.x <= v[0] ? 1 : 0, this.y <= v[1] ? 1 : 0);
900
+ return vec2(this.x <= v.x ? 1 : 0, this.y <= v.y ? 1 : 0);
907
901
  }
908
902
  gt(v) {
909
- return vec2(this.x > v[0] ? 1 : 0, this.y > v[1] ? 1 : 0);
903
+ return vec2(this.x > v.x ? 1 : 0, this.y > v.y ? 1 : 0);
910
904
  }
911
905
  gte(v) {
912
- return vec2(this.x >= v[0] ? 1 : 0, this.y >= v[1] ? 1 : 0);
906
+ return vec2(this.x >= v.x ? 1 : 0, this.y >= v.y ? 1 : 0);
913
907
  }
914
908
  mag() {
915
909
  return Math.sqrt(this.magSq());
@@ -946,15 +940,15 @@ var Vec2 = class _Vec2 extends Float32Array {
946
940
  return _Vec2.sub(v, this).magSq();
947
941
  }
948
942
  dot(v) {
949
- return this.x * v[0] + this.y * v[1];
943
+ return this.x * v.x + this.y * v.y;
950
944
  }
951
945
  cross(v) {
952
- return this.x * v[1] - this.y * v[0];
946
+ return this.x * v.y - this.y * v.x;
953
947
  }
954
948
  lerp(v, norm2) {
955
949
  const { x, y } = this;
956
- this.x = lerp(x, v[0], norm2);
957
- this.y = lerp(y, v[1], norm2);
950
+ this.x = lerp(x, v.x, norm2);
951
+ this.y = lerp(y, v.y, norm2);
958
952
  return this;
959
953
  }
960
954
  static lerp(v1, v2, norm2) {
@@ -962,8 +956,8 @@ var Vec2 = class _Vec2 extends Float32Array {
962
956
  }
963
957
  clamp(min2, max2) {
964
958
  const { x, y } = this;
965
- this.x = clamp(x, min2[0], max2[0]);
966
- this.y = clamp(y, min2[1], max2[1]);
959
+ this.x = clamp(x, min2.x, max2.x);
960
+ this.y = clamp(y, min2.y, max2.y);
967
961
  return this;
968
962
  }
969
963
  static clamp(v, min2, max2) {
@@ -1016,72 +1010,50 @@ function vec2(x, y) {
1016
1010
  }
1017
1011
 
1018
1012
  // src/math/vector/vec3.ts
1019
- var Vec3 = class _Vec3 extends Float32Array {
1020
- static BYTE_LENGTH = 3 * Float32Array.BYTES_PER_ELEMENT;
1013
+ var Vec3 = class _Vec3 {
1014
+ x;
1015
+ y;
1016
+ z;
1021
1017
  constructor(x = 0, y, z) {
1022
- super([0, 0, 0]);
1023
1018
  if (typeof x === "number") {
1024
1019
  this.x = x;
1025
1020
  this.y = y ?? x;
1026
1021
  this.z = z ?? (y === void 0 ? x : 0);
1027
1022
  } else {
1028
- [this[0] = 0, this[1] = 0, this[2] = 0] = x;
1023
+ this.x = x.x;
1024
+ this.y = x.y;
1025
+ this.z = x.z;
1029
1026
  }
1030
1027
  }
1031
1028
  /* prettier-ignore */
1032
- get x() {
1033
- return this[0] || 0;
1034
- }
1035
- /* prettier-ignore */
1036
- set x(value) {
1037
- this[0] = value;
1038
- }
1039
- /* prettier-ignore */
1040
- get y() {
1041
- return this[1] || 0;
1042
- }
1043
- /* prettier-ignore */
1044
- set y(value) {
1045
- this[1] = value;
1046
- }
1047
- /* prettier-ignore */
1048
- get z() {
1049
- return this[2] || 0;
1050
- }
1051
- /* prettier-ignore */
1052
- set z(value) {
1053
- this[2] = value;
1054
- }
1055
- /* prettier-ignore */
1056
1029
  get r() {
1057
- return this[0] || 0;
1030
+ return this.x || 0;
1058
1031
  }
1059
1032
  /* prettier-ignore */
1060
1033
  set r(value) {
1061
- this[0] = value;
1034
+ this.x = value;
1062
1035
  }
1063
1036
  /* prettier-ignore */
1064
1037
  get g() {
1065
- return this[1] || 0;
1038
+ return this.y || 0;
1066
1039
  }
1067
1040
  /* prettier-ignore */
1068
1041
  set g(value) {
1069
- this[1] = value;
1042
+ this.y = value;
1070
1043
  }
1071
1044
  /* prettier-ignore */
1072
1045
  get b() {
1073
- return this[2] || 0;
1046
+ return this.z || 0;
1074
1047
  }
1075
1048
  /* prettier-ignore */
1076
1049
  set b(value) {
1077
- this[2] = value;
1050
+ this.z = value;
1078
1051
  }
1079
1052
  toString() {
1080
- const [x, y, z] = this;
1081
- return `vec3 <${x}, ${y}, ${z}>`;
1053
+ return `vec3 <${this.x}, ${this.y}, ${this.z}>`;
1082
1054
  }
1083
1055
  copy() {
1084
- return vec3(...this);
1056
+ return vec3(this);
1085
1057
  }
1086
1058
  static random(mag = 1) {
1087
1059
  return vec3(0, 0, 1).rotateX(random(Math.PI * 2)).rotateY(random(Math.PI * 2)).setMag(mag);
@@ -1090,7 +1062,19 @@ var Vec3 = class _Vec3 extends Float32Array {
1090
1062
  if (typeof x === "number") {
1091
1063
  return this.x === x && this.y === (y ?? x) && this.z === (z ?? (y === void 0 ? x : 0));
1092
1064
  }
1093
- return this.x === x[0] && this.y === x[1] && this.z === x[2];
1065
+ return this.x === x.x && this.y === x.y && this.z === x.z;
1066
+ }
1067
+ set(x, y, z) {
1068
+ if (typeof x === "number") {
1069
+ this.x = x;
1070
+ this.y = y ?? x;
1071
+ this.z = z ?? (y === void 0 ? x : 0);
1072
+ } else {
1073
+ this.x = x.x;
1074
+ this.y = x.y;
1075
+ this.z = x.z;
1076
+ }
1077
+ return this;
1094
1078
  }
1095
1079
  neg() {
1096
1080
  return vec3(-this.x, -this.y, -this.z);
@@ -1101,9 +1085,9 @@ var Vec3 = class _Vec3 extends Float32Array {
1101
1085
  this.y += y ?? x;
1102
1086
  this.z += z ?? (y === void 0 ? x : 0);
1103
1087
  } else {
1104
- this.x += x[0];
1105
- this.y += x[1];
1106
- this.z += x[2];
1088
+ this.x += x.x;
1089
+ this.y += x.y;
1090
+ this.z += x.z;
1107
1091
  }
1108
1092
  return this;
1109
1093
  }
@@ -1116,9 +1100,9 @@ var Vec3 = class _Vec3 extends Float32Array {
1116
1100
  this.y -= y ?? x;
1117
1101
  this.z -= z ?? (y === void 0 ? x : 0);
1118
1102
  } else {
1119
- this.x -= x[0];
1120
- this.y -= x[1];
1121
- this.z -= x[2];
1103
+ this.x -= x.x;
1104
+ this.y -= x.y;
1105
+ this.z -= x.z;
1122
1106
  }
1123
1107
  return this;
1124
1108
  }
@@ -1131,9 +1115,9 @@ var Vec3 = class _Vec3 extends Float32Array {
1131
1115
  this.y *= y ?? x;
1132
1116
  this.z *= z ?? (y === void 0 ? x : 1);
1133
1117
  } else {
1134
- this.x *= x[0];
1135
- this.y *= x[1];
1136
- this.z *= x[2];
1118
+ this.x *= x.x;
1119
+ this.y *= x.y;
1120
+ this.z *= x.z;
1137
1121
  }
1138
1122
  return this;
1139
1123
  }
@@ -1146,9 +1130,9 @@ var Vec3 = class _Vec3 extends Float32Array {
1146
1130
  this.y /= y ?? x;
1147
1131
  this.z /= z ?? (y === void 0 ? x : 1);
1148
1132
  } else {
1149
- this.x /= x[0];
1150
- this.y /= x[1];
1151
- this.z /= x[2];
1133
+ this.x /= x.x;
1134
+ this.y /= x.y;
1135
+ this.z /= x.z;
1152
1136
  }
1153
1137
  return this;
1154
1138
  }
@@ -1156,34 +1140,34 @@ var Vec3 = class _Vec3 extends Float32Array {
1156
1140
  return v1.copy().div(x, y, z);
1157
1141
  }
1158
1142
  static fma(a, b, c) {
1159
- return vec3(a[0] * b[0] + c[0], a[1] * b[1] + c[1], a[2] * b[2] + c[2]);
1143
+ return vec3(a.x * b.x + c.x, a.y * b.y + c.y, a.z * b.z + c.z);
1160
1144
  }
1161
1145
  lt(v) {
1162
1146
  return vec3(
1163
- this.x < v[0] ? 1 : 0,
1164
- this.y < v[1] ? 1 : 0,
1165
- this.z < v[2] ? 1 : 0
1147
+ this.x < v.x ? 1 : 0,
1148
+ this.y < v.y ? 1 : 0,
1149
+ this.z < v.z ? 1 : 0
1166
1150
  );
1167
1151
  }
1168
1152
  lte(v) {
1169
1153
  return vec3(
1170
- this.x <= v[0] ? 1 : 0,
1171
- this.y <= v[1] ? 1 : 0,
1172
- this.z <= v[2] ? 1 : 0
1154
+ this.x <= v.x ? 1 : 0,
1155
+ this.y <= v.y ? 1 : 0,
1156
+ this.z <= v.z ? 1 : 0
1173
1157
  );
1174
1158
  }
1175
1159
  gt(v) {
1176
1160
  return vec3(
1177
- this.x > v[0] ? 1 : 0,
1178
- this.y > v[1] ? 1 : 0,
1179
- this.z > v[2] ? 1 : 0
1161
+ this.x > v.x ? 1 : 0,
1162
+ this.y > v.y ? 1 : 0,
1163
+ this.z > v.z ? 1 : 0
1180
1164
  );
1181
1165
  }
1182
1166
  gte(v) {
1183
1167
  return vec3(
1184
- this.x >= v[0] ? 1 : 0,
1185
- this.y >= v[1] ? 1 : 0,
1186
- this.z >= v[2] ? 1 : 0
1168
+ this.x >= v.x ? 1 : 0,
1169
+ this.y >= v.y ? 1 : 0,
1170
+ this.z >= v.z ? 1 : 0
1187
1171
  );
1188
1172
  }
1189
1173
  limit(max2) {
@@ -1222,17 +1206,17 @@ var Vec3 = class _Vec3 extends Float32Array {
1222
1206
  }
1223
1207
  dot(v) {
1224
1208
  const { x, y, z } = this;
1225
- return x * v[0] + y * v[1] + z * v[2];
1209
+ return x * v.x + y * v.y + z * v.z;
1226
1210
  }
1227
1211
  cross(v) {
1228
1212
  const { x, y, z } = this;
1229
- return vec3(y * v[2] - z * v[1], z * v[0] - x * v[2], x * v[1] - y * v[0]);
1213
+ return vec3(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x);
1230
1214
  }
1231
1215
  lerp(v, norm2) {
1232
1216
  const { x, y, z } = this;
1233
- this.x = lerp(x, v[0], norm2);
1234
- this.y = lerp(y, v[1], norm2);
1235
- this.z = lerp(z, v[2], norm2);
1217
+ this.x = lerp(x, v.x, norm2);
1218
+ this.y = lerp(y, v.y, norm2);
1219
+ this.z = lerp(z, v.z, norm2);
1236
1220
  return this;
1237
1221
  }
1238
1222
  static lerp(v1, v2, norm2) {
@@ -1240,9 +1224,9 @@ var Vec3 = class _Vec3 extends Float32Array {
1240
1224
  }
1241
1225
  clamp(min2, max2) {
1242
1226
  const { x, y, z } = this;
1243
- this.x = clamp(x, min2[0], max2[0]);
1244
- this.y = clamp(y, min2[1], max2[1]);
1245
- this.z = clamp(z, min2[2], max2[2]);
1227
+ this.x = clamp(x, min2.x, max2.x);
1228
+ this.y = clamp(y, min2.y, max2.y);
1229
+ this.z = clamp(z, min2.z, max2.z);
1246
1230
  return this;
1247
1231
  }
1248
1232
  static clamp(v, min2, max2) {
@@ -1293,95 +1277,81 @@ function vec3(x, y, z) {
1293
1277
  }
1294
1278
 
1295
1279
  // src/math/vector/vec4.ts
1296
- var Vec4 = class _Vec4 extends Float32Array {
1297
- static BYTE_LENGTH = 4 * Float32Array.BYTES_PER_ELEMENT;
1280
+ var Vec4 = class _Vec4 {
1281
+ x;
1282
+ y;
1283
+ z;
1284
+ w;
1298
1285
  constructor(x = 0, y, z, w) {
1299
- super([0, 0, 0, 0]);
1300
1286
  if (typeof x === "number") {
1301
1287
  this.x = x;
1302
1288
  this.y = y ?? x;
1303
1289
  this.z = z ?? (y === void 0 ? x : 0);
1304
1290
  this.w = w ?? (z === void 0 ? x : 0);
1305
1291
  } else {
1306
- [this[0] = 0, this[1] = 0, this[2] = 0, this[3] = 0] = x;
1292
+ this.x = x.x;
1293
+ this.y = x.y;
1294
+ this.z = x.z;
1295
+ this.w = x.w;
1307
1296
  }
1308
1297
  }
1309
1298
  /* prettier-ignore */
1310
- get x() {
1311
- return this[0] || 0;
1312
- }
1313
- /* prettier-ignore */
1314
- set x(value) {
1315
- this[0] = value;
1316
- }
1317
- /* prettier-ignore */
1318
- get y() {
1319
- return this[1] || 0;
1320
- }
1321
- /* prettier-ignore */
1322
- set y(value) {
1323
- this[1] = value;
1324
- }
1325
- /* prettier-ignore */
1326
- get z() {
1327
- return this[2] || 0;
1328
- }
1329
- /* prettier-ignore */
1330
- set z(value) {
1331
- this[2] = value;
1332
- }
1333
- /* prettier-ignore */
1334
- get w() {
1335
- return this[2] || 0;
1336
- }
1337
- /* prettier-ignore */
1338
- set w(value) {
1339
- this[2] = value;
1340
- }
1341
- /* prettier-ignore */
1342
1299
  get r() {
1343
- return this[0] || 0;
1300
+ return this.x || 0;
1344
1301
  }
1345
1302
  /* prettier-ignore */
1346
1303
  set r(value) {
1347
- this[0] = value;
1304
+ this.x = value;
1348
1305
  }
1349
1306
  /* prettier-ignore */
1350
1307
  get g() {
1351
- return this[1] || 0;
1308
+ return this.y || 0;
1352
1309
  }
1353
1310
  /* prettier-ignore */
1354
1311
  set g(value) {
1355
- this[1] = value;
1312
+ this.y = value;
1356
1313
  }
1357
1314
  /* prettier-ignore */
1358
1315
  get b() {
1359
- return this[2] || 0;
1316
+ return this.z || 0;
1360
1317
  }
1361
1318
  /* prettier-ignore */
1362
1319
  set b(value) {
1363
- this[2] = value;
1320
+ this.z = value;
1364
1321
  }
1365
1322
  /* prettier-ignore */
1366
1323
  get a() {
1367
- return this[2] || 0;
1324
+ return this.z || 0;
1368
1325
  }
1369
1326
  /* prettier-ignore */
1370
1327
  set a(value) {
1371
- this[2] = value;
1328
+ this.z = value;
1372
1329
  }
1373
1330
  toString() {
1374
- const [x, y, z, w] = this;
1375
- return `vec4 <${x}, ${y}, ${z}, ${w}>`;
1331
+ return `vec4 <${this.x}, ${this.y}, ${this.z}, ${this.w}>`;
1376
1332
  }
1377
1333
  copy() {
1378
- return vec4(...this);
1334
+ return vec4(this);
1379
1335
  }
1380
1336
  eq(x, y, z, w) {
1381
1337
  if (typeof x === "number") {
1382
1338
  return this.x === x && this.y === (y ?? x) && this.z === (z ?? (y === void 0 ? x : 0)) && this.w === (w ?? (z === void 0 ? x : 0));
1383
1339
  }
1384
- return this.x === x[0] && this.y === x[1] && this.z === x[2] && this.w === x[3];
1340
+ return this.x === x.x && this.y === x.y && this.z === x.z && this.w === x.w;
1341
+ }
1342
+ set(x, y, z, w) {
1343
+ if (typeof x === "number") {
1344
+ this.x = x;
1345
+ this.y = y ?? x;
1346
+ this.z = z ?? (y === void 0 ? x : 0);
1347
+ this.w = w ?? (z === void 0 ? x : 0);
1348
+ } else {
1349
+ this.x = x.x;
1350
+ this.y = x.y;
1351
+ this.z = x.z;
1352
+ this.w = x.w;
1353
+ }
1354
+ return this;
1385
1355
  }
1386
1356
  add(x, y, z, w) {
1387
1357
  if (typeof x === "number") {
@@ -1390,10 +1360,10 @@ var Vec4 = class _Vec4 extends Float32Array {
1390
1360
  this.z += z ?? (y === void 0 ? x : 0);
1391
1361
  this.w += w ?? (z === void 0 ? x : 0);
1392
1362
  } else {
1393
- this.x += x[0];
1394
- this.y += x[1];
1395
- this.z += x[2];
1396
- this.w += x[3];
1363
+ this.x += x.x;
1364
+ this.y += x.y;
1365
+ this.z += x.z;
1366
+ this.w += x.w;
1397
1367
  }
1398
1368
  return this;
1399
1369
  }
@@ -1407,10 +1377,10 @@ var Vec4 = class _Vec4 extends Float32Array {
1407
1377
  this.z -= z ?? (y === void 0 ? x : 0);
1408
1378
  this.w -= w ?? (z === void 0 ? x : 0);
1409
1379
  } else {
1410
- this.x -= x[0];
1411
- this.y -= x[1];
1412
- this.z -= x[2];
1413
- this.w -= x[3];
1380
+ this.x -= x.x;
1381
+ this.y -= x.y;
1382
+ this.z -= x.z;
1383
+ this.w -= x.w;
1414
1384
  }
1415
1385
  return this;
1416
1386
  }
@@ -1424,10 +1394,10 @@ var Vec4 = class _Vec4 extends Float32Array {
1424
1394
  this.z *= z ?? (y === void 0 ? x : 1);
1425
1395
  this.w *= w ?? (z === void 0 ? x : 1);
1426
1396
  } else {
1427
- this.x *= x[0];
1428
- this.y *= x[1];
1429
- this.z *= x[2];
1430
- this.w *= x[3];
1397
+ this.x *= x.x;
1398
+ this.y *= x.y;
1399
+ this.z *= x.z;
1400
+ this.w *= x.w;
1431
1401
  }
1432
1402
  return this;
1433
1403
  }
@@ -1441,10 +1411,10 @@ var Vec4 = class _Vec4 extends Float32Array {
1441
1411
  this.z /= z ?? (y === void 0 ? x : 1);
1442
1412
  this.w /= w ?? (z === void 0 ? x : 1);
1443
1413
  } else {
1444
- this.x /= x[0];
1445
- this.y /= x[1];
1446
- this.z /= x[2];
1447
- this.w /= x[3];
1414
+ this.x /= x.x;
1415
+ this.y /= x.y;
1416
+ this.z /= x.z;
1417
+ this.w /= x.w;
1448
1418
  }
1449
1419
  return this;
1450
1420
  }
@@ -1453,42 +1423,42 @@ var Vec4 = class _Vec4 extends Float32Array {
1453
1423
  }
1454
1424
  static fma(a, b, c) {
1455
1425
  return vec4(
1456
- a[0] * b[0] + c[0],
1457
- a[1] * b[1] + c[1],
1458
- a[2] * b[2] + c[2],
1459
- a[3] * b[3] + c[3]
1426
+ a.x * b.x + c.x,
1427
+ a.y * b.y + c.y,
1428
+ a.z * b.z + c.z,
1429
+ a.w * b.w + c.w
1460
1430
  );
1461
1431
  }
1462
1432
  lt(v) {
1463
1433
  return vec4(
1464
- this.x < v[0] ? 1 : 0,
1465
- this.y < v[1] ? 1 : 0,
1466
- this.z < v[2] ? 1 : 0,
1467
- this.w < v[3] ? 1 : 0
1434
+ this.x < v.x ? 1 : 0,
1435
+ this.y < v.y ? 1 : 0,
1436
+ this.z < v.z ? 1 : 0,
1437
+ this.w < v.w ? 1 : 0
1468
1438
  );
1469
1439
  }
1470
1440
  lte(v) {
1471
1441
  return vec4(
1472
- this.x <= v[0] ? 1 : 0,
1473
- this.y <= v[1] ? 1 : 0,
1474
- this.z <= v[2] ? 1 : 0,
1475
- this.w <= v[3] ? 1 : 0
1442
+ this.x <= v.x ? 1 : 0,
1443
+ this.y <= v.y ? 1 : 0,
1444
+ this.z <= v.z ? 1 : 0,
1445
+ this.w <= v.w ? 1 : 0
1476
1446
  );
1477
1447
  }
1478
1448
  gt(v) {
1479
1449
  return vec4(
1480
- this.x > v[0] ? 1 : 0,
1481
- this.y > v[1] ? 1 : 0,
1482
- this.z > v[2] ? 1 : 0,
1483
- this.w > v[3] ? 1 : 0
1450
+ this.x > v.x ? 1 : 0,
1451
+ this.y > v.y ? 1 : 0,
1452
+ this.z > v.z ? 1 : 0,
1453
+ this.w > v.w ? 1 : 0
1484
1454
  );
1485
1455
  }
1486
1456
  gte(v) {
1487
1457
  return vec4(
1488
- this.x >= v[0] ? 1 : 0,
1489
- this.y >= v[1] ? 1 : 0,
1490
- this.z >= v[2] ? 1 : 0,
1491
- this.w >= v[3] ? 1 : 0
1458
+ this.x >= v.x ? 1 : 0,
1459
+ this.y >= v.y ? 1 : 0,
1460
+ this.z >= v.z ? 1 : 0,
1461
+ this.w >= v.w ? 1 : 0
1492
1462
  );
1493
1463
  }
1494
1464
  limit(max2) {
@@ -1527,14 +1497,14 @@ var Vec4 = class _Vec4 extends Float32Array {
1527
1497
  }
1528
1498
  dot(v) {
1529
1499
  const { x, y, z, w } = this;
1530
- return x * v[0] + y * v[1] + z * v[2] + w * v[3];
1500
+ return x * v.x + y * v.y + z * v.z + w * v.w;
1531
1501
  }
1532
1502
  lerp(v, norm2) {
1533
1503
  const { x, y, z, w } = this;
1534
- this.x = lerp(x, v[0], norm2);
1535
- this.y = lerp(y, v[1], norm2);
1536
- this.z = lerp(z, v[2], norm2);
1537
- this.w = lerp(w, v[3], norm2);
1504
+ this.x = lerp(x, v.x, norm2);
1505
+ this.y = lerp(y, v.y, norm2);
1506
+ this.z = lerp(z, v.z, norm2);
1507
+ this.w = lerp(w, v.w, norm2);
1538
1508
  return this;
1539
1509
  }
1540
1510
  static lerp(v1, v2, norm2) {
@@ -1542,10 +1512,10 @@ var Vec4 = class _Vec4 extends Float32Array {
1542
1512
  }
1543
1513
  clamp(min2, max2) {
1544
1514
  const { x, y, z, w } = this;
1545
- this.x = clamp(x, min2[0], max2[0]);
1546
- this.y = clamp(y, min2[1], max2[1]);
1547
- this.z = clamp(z, min2[2], max2[2]);
1548
- this.w = clamp(w, min2[3], max2[3]);
1515
+ this.x = clamp(x, min2.x, max2.x);
1516
+ this.y = clamp(y, min2.y, max2.y);
1517
+ this.z = clamp(z, min2.z, max2.z);
1518
+ this.w = clamp(w, min2.w, max2.w);
1549
1519
  return this;
1550
1520
  }
1551
1521
  static clamp(v, min2, max2) {
package/dist/events.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sum
3
- } from "./chunk-BSIDYYJX.js";
3
+ } from "./chunk-ONMV3ICF.js";
4
4
  import "./chunk-SSSOLDLG.js";
5
5
  import "./chunk-4POIKW4G.js";
6
6
  import {
@@ -1,4 +1,4 @@
1
- import { V as Vec3 } from '../vec3-a5RuSVIr.js';
1
+ import { V as Vec3 } from '../vec3-BQ6mZ-wg.js';
2
2
 
3
3
  declare function hsv2rgb(h: number, s: number, v: number): Vec3;
4
4
  /**
package/dist/gfx/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  vec3
3
- } from "../chunk-BSIDYYJX.js";
3
+ } from "../chunk-ONMV3ICF.js";
4
4
  import "../chunk-SSSOLDLG.js";
5
5
  import "../chunk-4POIKW4G.js";
6
6
  import "../chunk-CCBSTDYA.js";
@@ -1,6 +1,5 @@
1
1
  import { int, uint } from '../types.js';
2
- import { a as Vec } from '../vec3-a5RuSVIr.js';
3
- export { R as ReadonlyVec3Like, V as Vec3, b as Vec3Like, v as vec3 } from '../vec3-a5RuSVIr.js';
2
+ export { R as ReadonlyVec3Like, V as Vec3, v as vec3 } from '../vec3-BQ6mZ-wg.js';
4
3
 
5
4
  /**
6
5
  * Determines if a value is a number other than `NaN`
@@ -351,20 +350,20 @@ declare const radians: (degrees: number) => number;
351
350
  /** Converts radians to degrees */
352
351
  declare const degrees: (radians: number) => number;
353
352
 
354
- type Vec2Like = [x: number, y: number] | Float32Array;
355
- type ReadonlyVec2Like = Readonly<Vec2Like>;
353
+ interface ReadonlyVec2Like {
354
+ readonly x: number;
355
+ readonly y: number;
356
+ }
356
357
  type First$1 = ReadonlyVec2Like | number;
357
- declare class Vec2 extends Float32Array implements Vec {
358
- static readonly BYTE_LENGTH: number;
358
+ declare class Vec2 {
359
+ x: number;
360
+ y: number;
359
361
  constructor(x?: First$1, y?: number);
360
- get x(): number;
361
- set x(value: number);
362
- get y(): number;
363
- set y(value: number);
364
362
  toString(): string;
365
363
  copy(): Vec2;
366
364
  static random(mag?: number): Vec2;
367
365
  eq(x: First$1, y?: number): boolean;
366
+ set(x: First$1, y?: number): this;
368
367
  add(x: First$1, y?: number): this;
369
368
  static add(v1: Vec2, x: First$1, y?: number): Vec2;
370
369
  sub(x: First$1, y?: number): this;
@@ -404,20 +403,19 @@ declare class Vec2 extends Float32Array implements Vec {
404
403
  }
405
404
  declare function vec2(x?: First$1, y?: number): Vec2;
406
405
 
407
- type Vec4Like = [x: number, y: number, z: number, w: number] | Float32Array;
408
- type ReadonlyVec4Like = Readonly<Vec4Like>;
406
+ interface ReadonlyVec4Like {
407
+ readonly x: number;
408
+ readonly y: number;
409
+ readonly z: number;
410
+ readonly w: number;
411
+ }
409
412
  type First = ReadonlyVec4Like | number;
410
- declare class Vec4 extends Float32Array implements Vec {
411
- static readonly BYTE_LENGTH: number;
413
+ declare class Vec4 {
414
+ x: number;
415
+ y: number;
416
+ z: number;
417
+ w: number;
412
418
  constructor(x?: First, y?: number, z?: number, w?: number);
413
- get x(): number;
414
- set x(value: number);
415
- get y(): number;
416
- set y(value: number);
417
- get z(): number;
418
- set z(value: number);
419
- get w(): number;
420
- set w(value: number);
421
419
  get r(): number;
422
420
  set r(value: number);
423
421
  get g(): number;
@@ -429,6 +427,7 @@ declare class Vec4 extends Float32Array implements Vec {
429
427
  toString(): string;
430
428
  copy(): Vec4;
431
429
  eq(x: First, y?: number, z?: number, w?: number): boolean;
430
+ set(x: First, y?: number, z?: number, w?: number): this;
432
431
  add(x: First, y?: number, z?: number, w?: number): this;
433
432
  static add(v1: Vec4, x: First, y?: number, z?: number, w?: number): Vec4;
434
433
  sub(x: First, y?: number, z?: number, w?: number): this;
@@ -461,4 +460,4 @@ declare class Vec4 extends Float32Array implements Vec {
461
460
  }
462
461
  declare function vec4(x?: First, y?: number, z?: number, w?: number): Vec4;
463
462
 
464
- export { DEG2RAD, Mat, Mat2, type Mat2Like, Mat3, type Mat3Like, Mat4, type Mat4Like, type ReadonlyMat2Like, type ReadonlyMat3Like, type ReadonlyMat4Like, type ReadonlyVec2Like, type ReadonlyVec4Like, Vec, Vec2, type Vec2Like, Vec4, type Vec4Like, avg, ceil, celsius, clamp, closeTo, closer, combinations, degrees, factorial, fahrenheit, fibonacci, floor, fract, gcd, isNumber, lerp, ln, log, map, mat, mat2, mat3, mat4, max, meanAbsDev, median, min, minmax, mode, norm, overlap, permutations, product, radians, round, roundToEven, roundToMultiple, smootherstep, smoothstep, sq, stddev, step, sum, trunc, variance, vec2, vec4 };
463
+ export { DEG2RAD, Mat, Mat2, type Mat2Like, Mat3, type Mat3Like, Mat4, type Mat4Like, type ReadonlyMat2Like, type ReadonlyMat3Like, type ReadonlyMat4Like, type ReadonlyVec2Like, type ReadonlyVec4Like, Vec2, Vec4, avg, ceil, celsius, clamp, closeTo, closer, combinations, degrees, factorial, fahrenheit, fibonacci, floor, fract, gcd, isNumber, lerp, ln, log, map, mat, mat2, mat3, mat4, max, meanAbsDev, median, min, minmax, mode, norm, overlap, permutations, product, radians, round, roundToEven, roundToMultiple, smootherstep, smoothstep, sq, stddev, step, sum, trunc, variance, vec2, vec4 };
@@ -55,7 +55,7 @@ import {
55
55
  vec2,
56
56
  vec3,
57
57
  vec4
58
- } from "../chunk-BSIDYYJX.js";
58
+ } from "../chunk-ONMV3ICF.js";
59
59
  import "../chunk-SSSOLDLG.js";
60
60
  import "../chunk-4POIKW4G.js";
61
61
  import "../chunk-CCBSTDYA.js";
@@ -1,25 +1,14 @@
1
- interface Vec extends Float32Array {
2
- toString: () => string;
3
- copy: () => Vec;
4
- mag: () => number;
5
- setMag: (n: number) => this;
6
- magSq: () => number;
7
- limit: (max: number) => this;
8
- normalize: () => this;
1
+ interface ReadonlyVec3Like {
2
+ readonly x: number;
3
+ readonly y: number;
4
+ readonly z: number;
9
5
  }
10
-
11
- type Vec3Like = [x: number, y: number, z: number] | Float32Array;
12
- type ReadonlyVec3Like = Readonly<Vec3Like>;
13
6
  type First = ReadonlyVec3Like | number;
14
- declare class Vec3 extends Float32Array implements Vec {
15
- static readonly BYTE_LENGTH: number;
7
+ declare class Vec3 {
8
+ x: number;
9
+ y: number;
10
+ z: number;
16
11
  constructor(x?: First, y?: number, z?: number);
17
- get x(): number;
18
- set x(value: number);
19
- get y(): number;
20
- set y(value: number);
21
- get z(): number;
22
- set z(value: number);
23
12
  get r(): number;
24
13
  set r(value: number);
25
14
  get g(): number;
@@ -30,6 +19,7 @@ declare class Vec3 extends Float32Array implements Vec {
30
19
  copy(): Vec3;
31
20
  static random(mag?: number): Vec3;
32
21
  eq(x: First, y?: number, z?: number): boolean;
22
+ set(x: First, y?: number, z?: number): this;
33
23
  neg(): Vec3;
34
24
  add(x: First, y?: number, z?: number): this;
35
25
  static add(v1: Vec3, x: First, y?: number, z?: number): Vec3;
@@ -67,4 +57,4 @@ declare class Vec3 extends Float32Array implements Vec {
67
57
  }
68
58
  declare function vec3(x?: First, y?: number, z?: number): Vec3;
69
59
 
70
- export { type ReadonlyVec3Like as R, Vec3 as V, type Vec as a, type Vec3Like as b, vec3 as v };
60
+ export { type ReadonlyVec3Like as R, Vec3 as V, vec3 as v };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@limitlesspc/std",
3
3
  "type": "module",
4
- "version": "0.22.0",
5
- "packageManager": "pnpm@10.25.0",
4
+ "version": "0.23.0",
6
5
  "description": "A standard library for JavaScript",
7
6
  "license": "MIT",
8
7
  "exports": {
@@ -80,6 +79,17 @@
80
79
  "dist"
81
80
  ],
82
81
  "prettier": "@limitlesspc/prettier-config",
82
+ "devDependencies": {
83
+ "@limitlesspc/eslint-config": "^0.18.4",
84
+ "@limitlesspc/prettier-config": "^1.2.1",
85
+ "@vitest/coverage-v8": "^4.0.16",
86
+ "bumpp": "^10.3.2",
87
+ "eslint": "^9.39.2",
88
+ "prettier": "^3.7.4",
89
+ "tsup": "^8.5.1",
90
+ "typescript": "^5.9.3",
91
+ "vitest": "^4.0.15"
92
+ },
83
93
  "scripts": {
84
94
  "build": "tsup",
85
95
  "fmt": "prettier . --write --cache --ignore-unknown",
@@ -89,19 +99,7 @@
89
99
  "lint:fix-dry": "eslint --fix-dry-run",
90
100
  "test": "vitest",
91
101
  "coverage": "vitest run --coverage",
92
- "prepack": "nr build",
93
102
  "release": "bumpp && pnpm publish",
94
103
  "typecheck": "tsc --noEmit"
95
- },
96
- "devDependencies": {
97
- "@limitlesspc/eslint-config": "^0.18.4",
98
- "@limitlesspc/prettier-config": "^1.2.1",
99
- "@vitest/coverage-v8": "^4.0.16",
100
- "bumpp": "^10.3.2",
101
- "eslint": "^9.39.2",
102
- "prettier": "^3.7.4",
103
- "tsup": "^8.5.1",
104
- "typescript": "^5.9.3",
105
- "vitest": "^4.0.15"
106
104
  }
107
- }
105
+ }