@zyzgroup/core-web 0.1.13 → 0.1.15

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.
@@ -12534,7 +12534,7 @@ function em(i, t) {
12534
12534
  );
12535
12535
  }
12536
12536
  }
12537
- const Rs = new fi(), K = new zt();
12537
+ const Rs = new fi(), tt = new zt();
12538
12538
  function re(i, t) {
12539
12539
  switch (t.constructor) {
12540
12540
  case Float32Array:
@@ -12616,22 +12616,22 @@ class ae {
12616
12616
  Rs.fromBufferAttribute(this, e), Rs.applyMatrix3(t), this.setXY(e, Rs.x, Rs.y);
12617
12617
  else if (this.itemSize === 3)
12618
12618
  for (let e = 0, s = this.count; e < s; e++)
12619
- K.fromBufferAttribute(this, e), K.applyMatrix3(t), this.setXYZ(e, K.x, K.y, K.z);
12619
+ tt.fromBufferAttribute(this, e), tt.applyMatrix3(t), this.setXYZ(e, tt.x, tt.y, tt.z);
12620
12620
  return this;
12621
12621
  }
12622
12622
  applyMatrix4(t) {
12623
12623
  for (let e = 0, s = this.count; e < s; e++)
12624
- K.fromBufferAttribute(this, e), K.applyMatrix4(t), this.setXYZ(e, K.x, K.y, K.z);
12624
+ tt.fromBufferAttribute(this, e), tt.applyMatrix4(t), this.setXYZ(e, tt.x, tt.y, tt.z);
12625
12625
  return this;
12626
12626
  }
12627
12627
  applyNormalMatrix(t) {
12628
12628
  for (let e = 0, s = this.count; e < s; e++)
12629
- K.fromBufferAttribute(this, e), K.applyNormalMatrix(t), this.setXYZ(e, K.x, K.y, K.z);
12629
+ tt.fromBufferAttribute(this, e), tt.applyNormalMatrix(t), this.setXYZ(e, tt.x, tt.y, tt.z);
12630
12630
  return this;
12631
12631
  }
12632
12632
  transformDirection(t) {
12633
12633
  for (let e = 0, s = this.count; e < s; e++)
12634
- K.fromBufferAttribute(this, e), K.transformDirection(t), this.setXYZ(e, K.x, K.y, K.z);
12634
+ tt.fromBufferAttribute(this, e), tt.transformDirection(t), this.setXYZ(e, tt.x, tt.y, tt.z);
12635
12635
  return this;
12636
12636
  }
12637
12637
  set(t, e = 0) {
@@ -13102,7 +13102,7 @@ const Cu = {
13102
13102
  yellowgreen: 10145074
13103
13103
  // rgb(154,205,50)
13104
13104
  };
13105
- class tt {
13105
+ class K {
13106
13106
  static NAMES = Cu;
13107
13107
  _color = {
13108
13108
  r: 0,
@@ -13121,7 +13121,7 @@ class tt {
13121
13121
  return this._color;
13122
13122
  }
13123
13123
  set color(t) {
13124
- const e = "Color: Unknown color " + t;
13124
+ const e = `Color: Unknown color(${t}) type(${typeof t})`;
13125
13125
  if (typeof t == "number")
13126
13126
  this.setHEX(t);
13127
13127
  else if (typeof t == "string") {
@@ -13134,29 +13134,31 @@ class tt {
13134
13134
  case "rgba":
13135
13135
  (r = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(
13136
13136
  n
13137
- )) ? (this.r = parseInt(r[1], 10), this.g = parseInt(r[2], 10), this.b = parseInt(r[3], 10), r[4] && (this.a = parseFloat(r[4]))) : (r = /^\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(
13137
+ )) ? (this.r = parseInt(r[1], 10), this.g = parseInt(r[2], 10), this.b = parseInt(r[3], 10), this.a = r[4] ? parseFloat(r[4]) : 1) : (r = /^\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(
13138
13138
  n
13139
- )) ? (this.r = O(parseFloat(r[1]), 0, 100) * 255 / 100, this.g = O(parseFloat(r[2]), 0, 100) * 255 / 100, this.b = O(parseFloat(r[3]), 0, 100) * 255 / 100, r[4] && (this.a = parseFloat(r[4]))) : console.warn(e);
13139
+ )) ? (this.r = O(parseFloat(r[1]), 0, 100) * 255 / 100, this.g = O(parseFloat(r[2]), 0, 100) * 255 / 100, this.b = O(parseFloat(r[3]), 0, 100) * 255 / 100, this.a = r[4] ? parseFloat(r[4]) : 1) : console.warn(e);
13140
13140
  break;
13141
13141
  case "hsl":
13142
13142
  case "hsla":
13143
13143
  (r = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(
13144
13144
  n
13145
- )) ? (this.setHSL(
13145
+ )) ? this.setHSL(
13146
13146
  parseFloat(r[1]) / 360,
13147
13147
  parseFloat(r[2]) / 100,
13148
- parseFloat(r[3]) / 100
13149
- ), r[4] && (this.a = parseFloat(r[4]))) : console.warn(e);
13148
+ parseFloat(r[3]) / 100,
13149
+ r[4] ? parseFloat(r[4]) : 1
13150
+ ) : console.warn(e);
13150
13151
  break;
13151
13152
  default:
13152
13153
  console.warn(e);
13153
13154
  }
13154
- } else if (s = /^#([A-Fa-f\d]+)$/.exec(t)) {
13155
+ } else if (s = /#([A-Fa-f0-9]+)/.exec(t)) {
13155
13156
  const n = s[1], r = n.length;
13156
13157
  r === 3 ? this.setRGB(
13157
13158
  parseInt(n.charAt(0), 16),
13158
13159
  parseInt(n.charAt(1), 16),
13159
- parseInt(n.charAt(2), 16)
13160
+ parseInt(n.charAt(2), 16),
13161
+ 1
13160
13162
  ) : r === 6 || r === 8 ? this.setHEX(parseInt(n, 16)) : console.warn(e);
13161
13163
  } else if (t && t.length > 0)
13162
13164
  try {
@@ -13167,7 +13169,22 @@ class tt {
13167
13169
  else
13168
13170
  console.warn(e);
13169
13171
  } else
13170
- Object.prototype.hasOwnProperty.call(t, "r") && Object.prototype.hasOwnProperty.call(t, "g") && Object.prototype.hasOwnProperty.call(t, "b") ? this.setRGB(t.r, t.g, t.b, t.a) : Object.prototype.hasOwnProperty.call(t, "h") && Object.prototype.hasOwnProperty.call(t, "s") && Object.prototype.hasOwnProperty.call(t, "l") ? this.setHSL(t.h, t.s, t.l, t.a) : Object.prototype.hasOwnProperty.call(t, "h") && Object.prototype.hasOwnProperty.call(t, "s") && Object.prototype.hasOwnProperty.call(t, "v") ? this.setHSV(t.h, t.s, t.v, t.a) : console.warn(e);
13172
+ t instanceof K ? this.setRGB(t.r, t.g, t.b, t.a) : Object.prototype.hasOwnProperty.call(t, "r") && Object.prototype.hasOwnProperty.call(t, "g") && Object.prototype.hasOwnProperty.call(t, "b") ? this.setRGB(
13173
+ t.r,
13174
+ t.g,
13175
+ t.b,
13176
+ Object.prototype.hasOwnProperty.call(t, "a") ? t.a : 1
13177
+ ) : Object.prototype.hasOwnProperty.call(t, "h") && Object.prototype.hasOwnProperty.call(t, "s") && Object.prototype.hasOwnProperty.call(t, "l") ? this.setHSL(
13178
+ t.h,
13179
+ t.s,
13180
+ t.l,
13181
+ Object.prototype.hasOwnProperty.call(t, "a") ? t.a : 1
13182
+ ) : Object.prototype.hasOwnProperty.call(t, "h") && Object.prototype.hasOwnProperty.call(t, "s") && Object.prototype.hasOwnProperty.call(t, "v") ? this.setHSV(
13183
+ t.h,
13184
+ t.s,
13185
+ t.v,
13186
+ Object.prototype.hasOwnProperty.call(t, "a") ? t.a : 1
13187
+ ) : console.warn(e);
13171
13188
  }
13172
13189
  setColor(t) {
13173
13190
  return this.color = t, this;
@@ -13250,7 +13267,7 @@ class tt {
13250
13267
  yield this.r, yield this.g, yield this.b, yield this.a;
13251
13268
  }
13252
13269
  clone() {
13253
- return new tt(this.color);
13270
+ return new K(this.color);
13254
13271
  }
13255
13272
  copy(t) {
13256
13273
  return this.setColor(t.color), this;
@@ -13305,7 +13322,7 @@ class tt {
13305
13322
  lighten(t) {
13306
13323
  t = O(t, 0, 1);
13307
13324
  const { r: e, g: s, b: n } = this.color;
13308
- return this.r += (255 - e) * t, this.g += (255 - s) * t, this.b += (255 - n) * t, this;
13325
+ return this.r = e + (255 - e) * t, this.g = s + (255 - s) * t, this.b = n + (255 - n) * t, this;
13309
13326
  }
13310
13327
  /// t: 0 ~ 1
13311
13328
  darken(t) {
@@ -13316,7 +13333,9 @@ class tt {
13316
13333
  /// 渐变色
13317
13334
  /// t: 0 ~ 1
13318
13335
  lerp(t, e) {
13319
- return e = O(e, 0, 1), this.r += (t.r - this.r) * e, this.g += (t.g - this.g) * e, this.b += (t.b - this.b) * e, this;
13336
+ e = O(e, 0, 1);
13337
+ const { r: s, g: n, b: r } = this.color;
13338
+ return this.r = s + (t.r - s) * e, this.g = n + (t.g - n) * e, this.b = r + (t.b - r) * e, this;
13320
13339
  }
13321
13340
  /// 渐变色
13322
13341
  /// t: 0 ~ 1
@@ -13327,7 +13346,7 @@ class tt {
13327
13346
  /// t: 0 ~ 1
13328
13347
  static gradient(t, e, s) {
13329
13348
  try {
13330
- return Ht.lerpColors(new tt(t), new tt(e), s).toString();
13349
+ return Ht.lerpColors(new K(t), new K(e), s).toString();
13331
13350
  } catch {
13332
13351
  return e;
13333
13352
  }
@@ -13336,19 +13355,19 @@ class tt {
13336
13355
  return Ht.setHEX(Math.random() * 16777215).toString();
13337
13356
  }
13338
13357
  static nextIndex = 0;
13339
- static next(t = tt.nextIndex) {
13340
- tt.nextIndex = t;
13341
- const e = Object.keys(tt.NAMES), s = e.length;
13342
- return Ht.setHEX(tt.NAMES[e[tt.nextIndex++ % s]]).toString();
13358
+ static next(t = K.nextIndex) {
13359
+ K.nextIndex = t;
13360
+ const e = Object.keys(K.NAMES), s = e.length;
13361
+ return Ht.setHEX(K.NAMES[e[K.nextIndex++ % s]]).toString();
13343
13362
  }
13344
13363
  setColorName(t) {
13345
- const e = tt.NAMES[t.toLowerCase()];
13346
- return e !== void 0 ? this.setHEX(e) : t === "none" ? this.a = 0 : console.warn("Color.setColorName: Unknown color " + t), this;
13364
+ const e = K.NAMES[t.toLowerCase()];
13365
+ return e !== void 0 ? this.setHEX(e) : t === "none" ? this.a = 0 : (this.a = 1, console.warn("Color.setColorName: Unknown color " + t)), this;
13347
13366
  }
13348
13367
  static getColors() {
13349
- return Object.values(tt.NAMES).map((t) => Ht.setHEX(t).toString());
13368
+ return Object.values(K.NAMES).map((t) => Ht.setHEX(t).toString());
13350
13369
  }
13351
- setRGB(t, e, s, n) {
13370
+ setRGB(t, e, s, n = 1) {
13352
13371
  return this.r = t, this.g = e, this.b = s, this.a = n, this;
13353
13372
  }
13354
13373
  get rgb() {
@@ -13361,7 +13380,7 @@ class tt {
13361
13380
  }
13362
13381
  // RRGGBB(AA)
13363
13382
  setHEX(t) {
13364
- return t = Math.floor(t), t < 16777216 ? (this.r = t >> 16 & 255, this.g = t >> 8 & 255, this.b = t & 255) : (this.r = t >> 24 & 255, this.g = t >> 16 & 255, this.b = t >> 8 & 255, this.a = (t & 255) / 255), this;
13383
+ return t = Math.floor(t), t < 16777216 ? (this.r = t >> 16 & 255, this.g = t >> 8 & 255, this.b = t & 255, this.a = 1) : (this.r = t >> 24 & 255, this.g = t >> 16 & 255, this.b = t >> 8 & 255, this.a = (t & 255) / 255), this;
13365
13384
  }
13366
13385
  get hex() {
13367
13386
  let t = (this.r << 16) + (this.g << 8) + this.b;
@@ -13369,7 +13388,7 @@ class tt {
13369
13388
  }
13370
13389
  /// hsl(a) : hue 色相 + saturation 饱和度 + lightness luminosity 亮度
13371
13390
  /// h,s,l ranges are in 0.0 ~ 1.0
13372
- setHSL(t, e, s, n) {
13391
+ setHSL(t, e, s, n = 1) {
13373
13392
  const r = oh(t, 1), o = O(e, 0, 1), a = O(s, 0, 1);
13374
13393
  if (o === 0)
13375
13394
  this.r = a * 255, this.g = a * 255, this.b = a * 255;
@@ -13418,7 +13437,7 @@ class tt {
13418
13437
  }
13419
13438
  /// hsv(a) / hsb(a) : hue 色相 + saturation 饱和度 + value or brightness 明度
13420
13439
  /// h,s,v ranges are in 0.0 ~ 1.0
13421
- setHSV(t, e, s, n) {
13440
+ setHSV(t, e, s, n = 1) {
13422
13441
  const r = O(t, 0, 1) * 360, o = O(e, 0, 1), a = O(s, 0, 1), h = Math.floor(r / 60) % 6, c = r / 60 - Math.floor(r / 60), l = a * (1 - o), u = a * (1 - c * o), f = a * (1 - (1 - c) * o), d = [
13423
13442
  [a, f, l],
13424
13443
  [u, a, l],
@@ -13442,7 +13461,7 @@ class tt {
13442
13461
  };
13443
13462
  }
13444
13463
  }
13445
- const Ht = new tt();
13464
+ const Ht = new K();
13446
13465
  function Ye(i) {
13447
13466
  return i < 0.04045 ? i * 0.0773993808 : Math.pow(i * 0.9478672986 + 0.0521327014, 2.4);
13448
13467
  }
@@ -13558,11 +13577,11 @@ const Ge = {
13558
13577
  borderColor: "",
13559
13578
  inputColor: ""
13560
13579
  };
13561
- Ge.buttonColor = new tt(Ge.saveRowColor).darken(0.1).toString();
13562
- Ge.borderColor = new tt(
13580
+ Ge.buttonColor = new K(Ge.saveRowColor).darken(0.1).toString();
13581
+ Ge.borderColor = new K(
13563
13582
  Ge.backgroundColor
13564
13583
  ).lighten(0.07).toString();
13565
- Ge.inputColor = new tt(
13584
+ Ge.inputColor = new K(
13566
13585
  Ge.backgroundColor
13567
13586
  ).lighten(0.085).toString();
13568
13587
  class Ue extends $ {
@@ -15790,7 +15809,7 @@ class Em extends yt {
15790
15809
  gravity: 1,
15791
15810
  drift: 0,
15792
15811
  ticks: 200,
15793
- colors: tt.getColors(),
15812
+ colors: K.getColors(),
15794
15813
  scalar: 1,
15795
15814
  flat: !1
15796
15815
  },
@@ -15828,7 +15847,7 @@ class Em extends yt {
15828
15847
  gravity: f * 3,
15829
15848
  scalar: v,
15830
15849
  flat: w,
15831
- color: new tt(_)
15850
+ color: new K(_)
15832
15851
  });
15833
15852
  }
15834
15853
  }
@@ -15926,12 +15945,12 @@ class ca {
15926
15945
  const h = this.shapes[o].getAttr("fill", "none"), c = this.shapes[o + 1].getAttr("fill", "none");
15927
15946
  typeof h == "string" && typeof c == "string" && s.setAttr(
15928
15947
  "fill",
15929
- tt.gradient(h, c, a).toString()
15948
+ K.gradient(h, c, a).toString()
15930
15949
  );
15931
15950
  const l = this.shapes[o].getAttr("stroke", "none"), u = this.shapes[o + 1].getAttr("stroke", "none");
15932
15951
  return typeof l == "string" && typeof u == "string" && s.setAttr(
15933
15952
  "stroke",
15934
- tt.gradient(l, u, a).toString()
15953
+ K.gradient(l, u, a).toString()
15935
15954
  ), s;
15936
15955
  };
15937
15956
  }
@@ -17408,7 +17427,7 @@ class yp {
17408
17427
  0,
17409
17428
  this.ctx.canvas.width,
17410
17429
  this.ctx.canvas.height
17411
- ), a = o.data, h = new tt(r);
17430
+ ), a = o.data, h = new K(r);
17412
17431
  Ee(this.controller, {
17413
17432
  move: (c) => {
17414
17433
  for (let l = 0; l < n; l++) {
@@ -18058,7 +18077,7 @@ export {
18058
18077
  ae as BufferAttribute,
18059
18078
  Lf as CSSToJSEasing,
18060
18079
  ar as Clock,
18061
- tt as Color,
18080
+ K as Color,
18062
18081
  ha as ColorManagement,
18063
18082
  Rm as CommonKeyCode,
18064
18083
  Em as Confetti,