tvcharts 0.7.78 → 0.7.79

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/dist/echarts.js CHANGED
@@ -291,109 +291,6 @@ function setPlatformAPI(newPlatformApis) {
291
291
  }
292
292
  }
293
293
 
294
- // node_modules/tvrender/src/core/LRU.ts
295
- var Entry = class {
296
- constructor(val) {
297
- this.value = val;
298
- }
299
- };
300
- var LinkedList = class {
301
- constructor() {
302
- this._len = 0;
303
- }
304
- insert(val) {
305
- const entry = new Entry(val);
306
- this.insertEntry(entry);
307
- return entry;
308
- }
309
- insertEntry(entry) {
310
- if (!this.head) {
311
- this.head = this.tail = entry;
312
- } else {
313
- this.tail.next = entry;
314
- entry.prev = this.tail;
315
- entry.next = null;
316
- this.tail = entry;
317
- }
318
- this._len++;
319
- }
320
- remove(entry) {
321
- const prev = entry.prev;
322
- const next = entry.next;
323
- if (prev) {
324
- prev.next = next;
325
- } else {
326
- this.head = next;
327
- }
328
- if (next) {
329
- next.prev = prev;
330
- } else {
331
- this.tail = prev;
332
- }
333
- entry.next = entry.prev = null;
334
- this._len--;
335
- }
336
- len() {
337
- return this._len;
338
- }
339
- clear() {
340
- this.head = this.tail = null;
341
- this._len = 0;
342
- }
343
- };
344
- var LRU = class {
345
- constructor(maxSize) {
346
- this._list = new LinkedList();
347
- this._maxSize = 10;
348
- this._map = {};
349
- this._maxSize = maxSize;
350
- }
351
- put(key, value) {
352
- const list = this._list;
353
- const map7 = this._map;
354
- let removed = null;
355
- if (map7[key] == null) {
356
- const len2 = list.len();
357
- let entry = this._lastRemovedEntry;
358
- if (len2 >= this._maxSize && len2 > 0) {
359
- const leastUsedEntry = list.head;
360
- list.remove(leastUsedEntry);
361
- delete map7[leastUsedEntry.key];
362
- removed = leastUsedEntry.value;
363
- this._lastRemovedEntry = leastUsedEntry;
364
- }
365
- if (entry) {
366
- entry.value = value;
367
- } else {
368
- entry = new Entry(value);
369
- }
370
- entry.key = key;
371
- list.insertEntry(entry);
372
- map7[key] = entry;
373
- }
374
- return removed;
375
- }
376
- get(key) {
377
- const entry = this._map[key];
378
- const list = this._list;
379
- if (entry != null) {
380
- if (entry !== list.tail) {
381
- list.remove(entry);
382
- list.insertEntry(entry);
383
- }
384
- return entry.value;
385
- }
386
- }
387
- clear() {
388
- this._list.clear();
389
- this._map = {};
390
- }
391
- len() {
392
- return this._list.len();
393
- }
394
- };
395
- var LRU_default = LRU;
396
-
397
294
  // node_modules/tvrender/src/core/util.ts
398
295
  var BUILTIN_OBJECT = reduce([
399
296
  "Function",
@@ -879,76 +776,60 @@ function hasOwn(own, prop) {
879
776
  function noop() {
880
777
  }
881
778
  var RADIAN_TO_DEGREE = 180 / Math.PI;
882
- var colorCache = new LRU_default(1e4);
779
+ var TypedArray = typeof Float32Array !== "undefined" ? Float32Array : Array;
883
780
  function hexToRgba(hex) {
884
781
  hex = hex.replace(/^#/, "");
885
782
  if (hex.length === 3) {
886
783
  hex = hex.split("").map((x) => x.repeat(2)).join("");
887
784
  }
888
785
  const a = hex.length === 8 ? parseInt(hex.slice(6, 8), 16) : 255;
889
- return {
890
- r: parseInt(hex.slice(0, 2), 16),
891
- g: parseInt(hex.slice(2, 4), 16),
892
- b: parseInt(hex.slice(4, 6), 16),
893
- a: a / 255
894
- };
786
+ return [
787
+ parseInt(hex.slice(0, 2), 16),
788
+ parseInt(hex.slice(2, 4), 16),
789
+ parseInt(hex.slice(4, 6), 16),
790
+ a / 255
791
+ ];
895
792
  }
896
- var defaultRGB = {r: 0, g: 0, b: 0, a: 0};
793
+ var defaultRGB = [0, 0, 0, 0];
897
794
  function parseRgbaStringFast(str) {
898
- if (str.charCodeAt(0) !== 114 || str.charCodeAt(1) !== 103 || str.charCodeAt(2) !== 98)
899
- return defaultRGB;
900
795
  const isRGBA = str.charCodeAt(3) === 97;
901
796
  const openParenIdx = isRGBA ? 4 : 3;
902
- if (str.charCodeAt(openParenIdx) !== 40 || str.charCodeAt(str.length - 1) !== 41)
903
- return defaultRGB;
904
- const nums = [];
905
- let num = 0, fracDiv = 0;
797
+ const nums = new TypedArray(4);
798
+ let num = 0, fracDiv = 0, index = 0;
906
799
  for (let i = openParenIdx + 1; i < str.length - 1; i++) {
907
800
  const c = str.charCodeAt(i);
908
801
  if (c >= 48 && c <= 57) {
909
- if (fracDiv > 0) {
802
+ if (fracDiv) {
910
803
  num = num * 10 + (c - 48);
911
804
  fracDiv *= 10;
912
805
  } else {
913
806
  num = num * 10 + (c - 48);
914
807
  }
915
808
  } else if (c === 46) {
916
- if (fracDiv === 0)
809
+ if (!fracDiv)
917
810
  fracDiv = 1;
918
811
  } else if (c === 44) {
919
- nums.push(fracDiv > 0 ? num / fracDiv : num);
812
+ if (index < 4) {
813
+ nums[index++] = fracDiv ? num / fracDiv : num;
814
+ }
920
815
  num = 0;
921
816
  fracDiv = 0;
922
- if (nums.length === 4)
923
- break;
924
- } else {
925
817
  }
926
818
  }
927
- if (nums.length < 4) {
928
- nums.push(fracDiv > 0 ? num / fracDiv : num);
819
+ if (index < 4 && (num > 0 || fracDiv > 0)) {
820
+ nums[index++] = fracDiv ? num / fracDiv : num;
929
821
  }
930
- if (nums.length < 3)
931
- return defaultRGB;
932
- return {
933
- r: nums[0],
934
- g: nums[1],
935
- b: nums[2],
936
- a: nums[3] !== void 0 ? nums[3] : 1
937
- };
822
+ if (index === 3) {
823
+ nums[3] = 1;
824
+ }
825
+ return nums;
938
826
  }
939
827
  function colorToRgba(color2 = "") {
940
- let rgbaColor;
828
+ let rgbaColor = defaultRGB;
941
829
  if (color2.startsWith("rgb")) {
942
830
  rgbaColor = parseRgbaStringFast(color2);
943
831
  } else if (color2.startsWith("#")) {
944
832
  rgbaColor = hexToRgba(color2);
945
- } else {
946
- rgbaColor = {
947
- r: 0,
948
- g: 0,
949
- b: 0,
950
- a: 0
951
- };
952
833
  }
953
834
  return rgbaColor;
954
835
  }
@@ -3651,6 +3532,111 @@ __export(color_exports, {
3651
3532
  stringify: () => stringify,
3652
3533
  toHex: () => toHex
3653
3534
  });
3535
+
3536
+ // node_modules/tvrender/src/core/LRU.ts
3537
+ var Entry = class {
3538
+ constructor(val) {
3539
+ this.value = val;
3540
+ }
3541
+ };
3542
+ var LinkedList = class {
3543
+ constructor() {
3544
+ this._len = 0;
3545
+ }
3546
+ insert(val) {
3547
+ const entry = new Entry(val);
3548
+ this.insertEntry(entry);
3549
+ return entry;
3550
+ }
3551
+ insertEntry(entry) {
3552
+ if (!this.head) {
3553
+ this.head = this.tail = entry;
3554
+ } else {
3555
+ this.tail.next = entry;
3556
+ entry.prev = this.tail;
3557
+ entry.next = null;
3558
+ this.tail = entry;
3559
+ }
3560
+ this._len++;
3561
+ }
3562
+ remove(entry) {
3563
+ const prev = entry.prev;
3564
+ const next = entry.next;
3565
+ if (prev) {
3566
+ prev.next = next;
3567
+ } else {
3568
+ this.head = next;
3569
+ }
3570
+ if (next) {
3571
+ next.prev = prev;
3572
+ } else {
3573
+ this.tail = prev;
3574
+ }
3575
+ entry.next = entry.prev = null;
3576
+ this._len--;
3577
+ }
3578
+ len() {
3579
+ return this._len;
3580
+ }
3581
+ clear() {
3582
+ this.head = this.tail = null;
3583
+ this._len = 0;
3584
+ }
3585
+ };
3586
+ var LRU = class {
3587
+ constructor(maxSize) {
3588
+ this._list = new LinkedList();
3589
+ this._maxSize = 10;
3590
+ this._map = {};
3591
+ this._maxSize = maxSize;
3592
+ }
3593
+ put(key, value) {
3594
+ const list = this._list;
3595
+ const map7 = this._map;
3596
+ let removed = null;
3597
+ if (map7[key] == null) {
3598
+ const len2 = list.len();
3599
+ let entry = this._lastRemovedEntry;
3600
+ if (len2 >= this._maxSize && len2 > 0) {
3601
+ const leastUsedEntry = list.head;
3602
+ list.remove(leastUsedEntry);
3603
+ delete map7[leastUsedEntry.key];
3604
+ removed = leastUsedEntry.value;
3605
+ this._lastRemovedEntry = leastUsedEntry;
3606
+ }
3607
+ if (entry) {
3608
+ entry.value = value;
3609
+ } else {
3610
+ entry = new Entry(value);
3611
+ }
3612
+ entry.key = key;
3613
+ list.insertEntry(entry);
3614
+ map7[key] = entry;
3615
+ }
3616
+ return removed;
3617
+ }
3618
+ get(key) {
3619
+ const entry = this._map[key];
3620
+ const list = this._list;
3621
+ if (entry != null) {
3622
+ if (entry !== list.tail) {
3623
+ list.remove(entry);
3624
+ list.insertEntry(entry);
3625
+ }
3626
+ return entry.value;
3627
+ }
3628
+ }
3629
+ clear() {
3630
+ this._list.clear();
3631
+ this._map = {};
3632
+ }
3633
+ len() {
3634
+ return this._list.len();
3635
+ }
3636
+ };
3637
+ var LRU_default = LRU;
3638
+
3639
+ // node_modules/tvrender/src/tool/color.ts
3654
3640
  var kCSSColorTable = {
3655
3641
  transparent: [0, 0, 0, 0],
3656
3642
  aliceblue: [240, 248, 255, 1],
@@ -3860,20 +3846,20 @@ function copyRgba(out2, a) {
3860
3846
  out2[3] = a[3];
3861
3847
  return out2;
3862
3848
  }
3863
- var colorCache2 = new LRU_default(20);
3849
+ var colorCache = new LRU_default(20);
3864
3850
  var lastRemovedArr = null;
3865
3851
  function putToCache(colorStr, rgbaArr) {
3866
3852
  if (lastRemovedArr) {
3867
3853
  copyRgba(lastRemovedArr, rgbaArr);
3868
3854
  }
3869
- lastRemovedArr = colorCache2.put(colorStr, lastRemovedArr || rgbaArr.slice());
3855
+ lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || rgbaArr.slice());
3870
3856
  }
3871
3857
  function parse(colorStr, rgbaArr) {
3872
3858
  if (!colorStr) {
3873
3859
  return;
3874
3860
  }
3875
3861
  rgbaArr = rgbaArr || [];
3876
- let cached = colorCache2.get(colorStr);
3862
+ let cached = colorCache.get(colorStr);
3877
3863
  if (cached) {
3878
3864
  return copyRgba(rgbaArr, cached);
3879
3865
  }
@@ -7259,7 +7245,7 @@ function getElementSSRData(el) {
7259
7245
  function registerSSRDataGetter(getter) {
7260
7246
  ssrDataGetter = getter;
7261
7247
  }
7262
- var version = "5.6.84";
7248
+ var version = "5.6.87";
7263
7249
 
7264
7250
  // src/util/number.ts
7265
7251
  var RADIAN_EPSILON = 1e-4;
@@ -9301,8 +9287,8 @@ var PathProxy2 = class {
9301
9287
  return this;
9302
9288
  }
9303
9289
  fillStyle(color2) {
9304
- const {r, g, b, a} = colorToRgba(color2);
9305
- this.addData(CMD.F, r, g, b, a);
9290
+ const rgbas = colorToRgba(color2);
9291
+ this.addData(CMD.F, rgbas[0], rgbas[1], rgbas[2], rgbas[3]);
9306
9292
  if (this._ctx) {
9307
9293
  this._ctx.fillStyle = color2;
9308
9294
  this._ctx.fill();
@@ -9310,8 +9296,8 @@ var PathProxy2 = class {
9310
9296
  return this;
9311
9297
  }
9312
9298
  strokeStyle(color2) {
9313
- const {r, g, b, a} = colorToRgba(color2);
9314
- this.addData(CMD.S, r, g, b, a);
9299
+ const rgbas = colorToRgba(color2);
9300
+ this.addData(CMD.S, rgbas[0], rgbas[1], rgbas[2], rgbas[3]);
9315
9301
  if (this._ctx) {
9316
9302
  this._ctx.strokeStyle = color2;
9317
9303
  this._ctx.stroke();
@@ -39345,7 +39331,7 @@ var Cartesian2D = class extends Cartesian_default {
39345
39331
  }
39346
39332
  const xAxis = this.getAxis("x");
39347
39333
  const yAxis = this.getAxis("y");
39348
- const baseValue = this.getBaseValue();
39334
+ const baseValue = yAxis.scale.type === "percent" ? this.getBaseValue() : void 0;
39349
39335
  out2[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(xVal, clamp2));
39350
39336
  out2[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(yVal, clamp2, baseValue));
39351
39337
  return out2;
@@ -55915,11 +55901,10 @@ var GradientBarPath = class extends Path_default {
55915
55901
  const offset = width / 2;
55916
55902
  const gap = offset >= 1 ? 1 : 0;
55917
55903
  for (let index = 0; index < points4.length; index++) {
55918
- const {point, color: color2} = points4[index];
55919
- if (isPointNull7(point)) {
55904
+ if (isPointNull7(points4[index].point)) {
55920
55905
  continue;
55921
55906
  }
55922
- const [x, y] = point;
55907
+ const [x, y] = points4[index].point;
55923
55908
  const left = Math.floor(x - offset);
55924
55909
  const leftX = left + gap;
55925
55910
  const rightX = Math.floor(left + width);
@@ -55930,7 +55915,7 @@ var GradientBarPath = class extends Path_default {
55930
55915
  ctx2.lineTo(rightX, baseY);
55931
55916
  ctx2.lineTo(leftX, baseY);
55932
55917
  ctx2.lineTo(leftX, dataY);
55933
- ctx2.fillStyle(color2);
55918
+ ctx2.fillStyle(points4[index].color);
55934
55919
  }
55935
55920
  }
55936
55921
  };
@@ -55966,15 +55951,13 @@ var GradientHistogramPlotPath = class extends Path_default {
55966
55951
  buildPath(ctx2, shape) {
55967
55952
  const {points: points4, baseY} = shape;
55968
55953
  for (let index = 0; index < points4.length; index++) {
55969
- const {point, color: color2} = points4[index];
55970
- if (isPointNull8(point)) {
55954
+ if (isPointNull8(points4[index].point)) {
55971
55955
  continue;
55972
55956
  }
55973
55957
  ctx2.beginPathFill();
55974
- const [x, y] = point;
55975
- ctx2.moveTo(x, y);
55976
- ctx2.lineTo(x, baseY);
55977
- ctx2.strokeStyle(color2);
55958
+ ctx2.moveTo(points4[index].point[0], points4[index].point[1]);
55959
+ ctx2.lineTo(points4[index].point[0], baseY);
55960
+ ctx2.strokeStyle(points4[index].color);
55978
55961
  }
55979
55962
  }
55980
55963
  };
@@ -55995,6 +55978,7 @@ var SymbolPath = class extends Path_default {
55995
55978
  const isShadow = shape.isShadow;
55996
55979
  const symbolProxy = this.symbolProxy;
55997
55980
  const symbolProxyShape = symbolProxy.shape;
55981
+ let lastColor = "";
55998
55982
  for (let i = 0; i < points4.length; i++) {
55999
55983
  const {point, color: color2} = points4[i];
56000
55984
  const size = isShadow ? points4[i].size * 3 : points4[i].size;
@@ -56002,14 +55986,22 @@ var SymbolPath = class extends Path_default {
56002
55986
  if (isNaN(x) || isNaN(y)) {
56003
55987
  continue;
56004
55988
  }
56005
- path.beginPathFill();
55989
+ const colorChanged = lastColor && lastColor !== color2;
55990
+ if (colorChanged) {
55991
+ path.fillStyle(lastColor);
55992
+ path.beginPathFill();
55993
+ }
56006
55994
  symbolProxyShape.x = x - size / 2;
56007
55995
  symbolProxyShape.y = y - size / 2;
56008
55996
  symbolProxyShape.width = size;
56009
55997
  symbolProxyShape.height = size;
56010
55998
  symbolProxy.buildPath(path, symbolProxyShape, true);
56011
- path.closePath();
56012
- path.fillStyle(color2);
55999
+ if (lastColor !== color2) {
56000
+ lastColor = color2;
56001
+ }
56002
+ }
56003
+ if (lastColor) {
56004
+ path.fillStyle(lastColor);
56013
56005
  }
56014
56006
  }
56015
56007
  };
@@ -56596,8 +56588,8 @@ var linesPlotLayout = {
56596
56588
  if (showLast && lastIndex - data.getRawIndex(i) >= showLast) {
56597
56589
  continue;
56598
56590
  }
56599
- const isRawLast = i + 1 === params.end ? data.getRawIndex(i) === lastIndex : false;
56600
- const isRawFirst = i === 0 ? data.getRawIndex(i) === 0 : false;
56591
+ const isRawLast = i + 1 === params.end ? data.getRawIndex(i) === lastIndex : void 0;
56592
+ const isRawFirst = i === 0 ? data.getRawIndex(i) === 0 : void 0;
56601
56593
  const x = store.get(dimIdx0, i);
56602
56594
  const y = store.get(dimIdx1, i);
56603
56595
  if (connectNulls && isNaN(y)) {
@@ -56609,7 +56601,7 @@ var linesPlotLayout = {
56609
56601
  color: color2,
56610
56602
  type = "solid",
56611
56603
  width = "1"
56612
- } = itemModal.lineStyle;
56604
+ } = itemModal.lineStyle || {};
56613
56605
  pointInfos.push({
56614
56606
  point,
56615
56607
  width,
@@ -56646,12 +56638,12 @@ var linesPlotLayout = {
56646
56638
  const nextPointInfo = pointInfos[i + 1];
56647
56639
  let stylePointInfo = isSingle ? pointInfo : nextPointInfo;
56648
56640
  if (!stylePointInfo) {
56649
- const itemModal = lineData.getRawDataItem(params.end);
56641
+ const itemModel = lineData.getItemModel(params.end);
56650
56642
  const {
56651
56643
  color: color3,
56652
56644
  type: type2 = "solid",
56653
56645
  width: width2 = "1"
56654
- } = itemModal.lineStyle;
56646
+ } = itemModel.get("lineStyle");
56655
56647
  stylePointInfo = {
56656
56648
  color: color3,
56657
56649
  type: type2,
@@ -59559,6 +59551,7 @@ var SymbolPath3 = class extends Path_default {
59559
59551
  const symbolProxyShape = symbolProxy.shape;
59560
59552
  const needCenter = shape.needCenter ?? true;
59561
59553
  const isLine = shape.isLine;
59554
+ let lastColor = "";
59562
59555
  for (let i = 0; i < points4.length; i++) {
59563
59556
  const {point, color: color2, size, offset = [0, 0]} = points4[i];
59564
59557
  const [width, height] = size;
@@ -59566,14 +59559,23 @@ var SymbolPath3 = class extends Path_default {
59566
59559
  if (isNaN(x) || isNaN(y)) {
59567
59560
  continue;
59568
59561
  }
59562
+ const colorChanged = lastColor && lastColor !== color2;
59569
59563
  const [xOffset, yOffset] = offset;
59570
- path.beginPathFill();
59564
+ if (colorChanged) {
59565
+ isLine ? path.strokeStyle(lastColor) : path.fillStyle(lastColor);
59566
+ path.beginPathFill();
59567
+ }
59571
59568
  symbolProxyShape.x = x - (needCenter ? width / 2 : 0) + xOffset;
59572
59569
  symbolProxyShape.y = y - (needCenter ? height / 2 : 0) + yOffset;
59573
59570
  symbolProxyShape.width = width;
59574
59571
  symbolProxyShape.height = height;
59575
59572
  symbolProxy.buildPath(path, {...symbolProxyShape, ...points4[i].shape}, true);
59576
- isLine ? path.strokeStyle(color2) : path.fillStyle(color2);
59573
+ if (lastColor !== color2) {
59574
+ lastColor = color2;
59575
+ }
59576
+ }
59577
+ if (lastColor) {
59578
+ isLine ? path.strokeStyle(lastColor) : path.fillStyle(lastColor);
59577
59579
  }
59578
59580
  }
59579
59581
  };