@adecore/charts 0.38.0 → 0.40.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.
package/dist/register.js CHANGED
@@ -15,9 +15,8 @@ const write = (store, kind, id, entry) => {
15
15
  }
16
16
  };
17
17
  /*
18
- * Tells the root about a part on every render, before paint, and takes it out on unmount. The store
19
- * ignores an entry equal to the one it holds, so a render that changes nothing costs nothing; the
20
- * removal stays apart from the update, or every update would move the part to the end.
18
+ * Tells the root about a part on every render, before paint, and takes it out on unmount. The removal
19
+ * stays apart from the update, or every update would move the part to the end.
21
20
  */
22
21
  export function useRegistration(store, kind, id, entry) {
23
22
  const $ = _c(10);
package/dist/series.js CHANGED
@@ -25,6 +25,8 @@ const pointsOf = (chart, values) => values.map((value, index) => {
25
25
  const pixel = value === null ? null : chart.pixelOfY(value);
26
26
  return pixel === null ? null : [chart.centerOf(index), pixel];
27
27
  });
28
+ /* The pixel of zero, or of the lowest value when the axis starts above it. */
29
+ const groundOf = chart => chart.pixelOfY(Math.max(chart.y.domain[0], 0)) ?? chart.plot.bottom;
28
30
  /* A value between two gaps is no line at all, so it gets a dot of its own. */
29
31
  const lonePoints = points => points.flatMap((point, index) => point !== null && points[index - 1] == null && points[index + 1] == null ? [index] : []);
30
32
  function useSeriesValues(part, value) {
@@ -514,7 +516,7 @@ export function ChartArea(t0) {
514
516
  if ($[12] !== chart || $[13] !== curve || $[14] !== id || $[15] !== values) {
515
517
  const stacked = chart.stacked.get(id);
516
518
  tops = pointsOf(chart, stacked?.top ?? values);
517
- const ground = chart.pixelOfY(Math.max(chart.y.domain[0], 0)) ?? chart.plot.bottom;
519
+ const ground = groundOf(chart);
518
520
  t13 = area().defined(index => tops[index] !== null).x(index_0 => tops[index_0][0]).y1(index_1 => tops[index_1][1]).y0(index_2 => stacked === undefined ? ground : chart.pixelOfY(stacked.base[index_2]) ?? ground).curve(CURVES[curve])(tops.map(_temp5));
519
521
  $[12] = chart;
520
522
  $[13] = curve;
@@ -689,7 +691,7 @@ export function ChartBars(t0) {
689
691
  }
690
692
  /* Columns, one per bucket: on a `band` scale, or on a `time` scale whose buckets last one step. */
691
693
  export function ChartBar(t0) {
692
- const $ = _c(50);
694
+ const $ = _c(47);
693
695
  const {
694
696
  value,
695
697
  label,
@@ -721,84 +723,74 @@ export function ChartBar(t0) {
721
723
  const [widths, setWidths] = useState(_temp6);
722
724
  const rows = chart.data;
723
725
  let t8;
724
- if ($[0] !== rows || $[1] !== tone) {
725
- t8 = typeof tone === "function" ? rows.map((row, index) => colorOf(tone(row, index))) : null;
726
- $[0] = rows;
726
+ if ($[0] !== chart || $[1] !== tone) {
727
+ t8 = tonesOf(chart, tone);
728
+ $[0] = chart;
727
729
  $[1] = tone;
728
730
  $[2] = t8;
729
731
  } else {
730
732
  t8 = $[2];
731
733
  }
732
- const rowColors = t8;
733
- let t9;
734
- if ($[3] !== rowColors?.[0] || $[4] !== tone) {
735
- t9 = typeof tone === "function" ? rowColors?.[0] ?? null : colorOf(tone);
736
- $[3] = rowColors?.[0];
737
- $[4] = tone;
738
- $[5] = t9;
739
- } else {
740
- t9 = $[5];
741
- }
742
- const color = t9;
743
- const t10 = bars?.stack === true ? bars.id : null;
744
- const t11 = bars?.id ?? null;
745
- const t12 = icon ?? null;
746
- const t13 = valueLabels !== undefined && valueLabels !== false;
747
- let t14;
748
- if ($[6] !== color || $[7] !== dimOpacity || $[8] !== label || $[9] !== rowColors || $[10] !== t10 || $[11] !== t11 || $[12] !== t12 || $[13] !== t13 || $[14] !== values) {
749
- t14 = {
734
+ const [color, rowColors] = t8;
735
+ const labeled = valueLabels !== undefined && valueLabels !== false;
736
+ const t9 = bars?.stack === true ? bars.id : null;
737
+ const t10 = bars?.id ?? null;
738
+ const t11 = icon ?? null;
739
+ let t12;
740
+ if ($[3] !== color || $[4] !== dimOpacity || $[5] !== label || $[6] !== labeled || $[7] !== rowColors || $[8] !== t10 || $[9] !== t11 || $[10] !== t9 || $[11] !== values) {
741
+ t12 = {
750
742
  kind: "bar",
751
743
  label,
752
744
  color,
753
745
  rowColors,
754
746
  values,
755
- stack: t10,
756
- bars: t11,
747
+ stack: t9,
748
+ bars: t10,
757
749
  curve: "linear",
758
- icon: t12,
759
- valueLabels: t13,
750
+ icon: t11,
751
+ valueLabels: labeled,
760
752
  dimOpacity
761
753
  };
762
- $[6] = color;
763
- $[7] = dimOpacity;
764
- $[8] = label;
765
- $[9] = rowColors;
766
- $[10] = t10;
767
- $[11] = t11;
754
+ $[3] = color;
755
+ $[4] = dimOpacity;
756
+ $[5] = label;
757
+ $[6] = labeled;
758
+ $[7] = rowColors;
759
+ $[8] = t10;
760
+ $[9] = t11;
761
+ $[10] = t9;
762
+ $[11] = values;
768
763
  $[12] = t12;
769
- $[13] = t13;
770
- $[14] = values;
771
- $[15] = t14;
772
764
  } else {
773
- t14 = $[15];
765
+ t12 = $[12];
774
766
  }
775
- useRegistration(chart.store, "series", id, t14);
776
- let t15;
777
- if ($[16] !== chart) {
778
- t15 = chart.xScale === "time" && chart.data.length > 0 && chart.bucketAt(0) === null;
779
- $[16] = chart;
780
- $[17] = t15;
767
+ useRegistration(chart.store, "series", id, t12);
768
+ let t13;
769
+ if ($[13] !== chart) {
770
+ t13 = chart.xScale === "time" && chart.data.length > 0 && chart.bucketAt(0) === null;
771
+ $[13] = chart;
772
+ $[14] = t13;
781
773
  } else {
782
- t15 = $[17];
774
+ t13 = $[14];
783
775
  }
784
- const noSlot = t15;
785
- let t16;
786
- let t17;
787
- if ($[18] !== noSlot) {
788
- t16 = () => {
776
+ const noSlot = t13;
777
+ let t14;
778
+ let t15;
779
+ if ($[15] !== noSlot) {
780
+ t14 = () => {
789
781
  if (noSlot) {
790
782
  warnOnce("Chart.Bar: a time scale with one row draws no columns without a `step` on the root.");
791
783
  }
792
784
  };
793
- t17 = [noSlot];
794
- $[18] = noSlot;
795
- $[19] = t16;
796
- $[20] = t17;
785
+ t15 = [noSlot];
786
+ $[15] = noSlot;
787
+ $[16] = t14;
788
+ $[17] = t15;
797
789
  } else {
798
- t16 = $[19];
799
- t17 = $[20];
790
+ t14 = $[16];
791
+ t15 = $[17];
800
792
  }
801
- useEffect(t16, t17);
793
+ useEffect(t14, t15);
802
794
  const {
803
795
  slot,
804
796
  count
@@ -807,46 +799,46 @@ export function ChartBar(t0) {
807
799
  count: 1
808
800
  };
809
801
  const stacked = chart.stacked.get(id);
810
- let t18;
811
- if ($[21] !== chart.colors || $[22] !== id) {
812
- t18 = chart.colors.get(id) ?? seriesColor(0);
813
- $[21] = chart.colors;
814
- $[22] = id;
815
- $[23] = t18;
802
+ let t16;
803
+ if ($[18] !== chart.colors || $[19] !== id) {
804
+ t16 = chart.colors.get(id) ?? seriesColor(0);
805
+ $[18] = chart.colors;
806
+ $[19] = id;
807
+ $[20] = t16;
816
808
  } else {
817
- t18 = $[23];
809
+ t16 = $[20];
818
810
  }
819
- const fallback = t18;
811
+ const fallback = t16;
820
812
  const anySelected = chart.selected.some(Boolean);
821
- let t19;
822
- if ($[24] !== chart.band?.groups || $[25] !== values.length) {
823
- t19 = index_0 => chart.band?.groups.find(run => index_0 >= run.first && index_0 <= run.last) ?? {
813
+ let t17;
814
+ if ($[21] !== chart.band?.groups || $[22] !== values.length) {
815
+ t17 = index => chart.band?.groups.find(run => index >= run.first && index <= run.last) ?? {
824
816
  first: 0,
825
817
  last: values.length - 1
826
818
  };
827
- $[24] = chart.band?.groups;
828
- $[25] = values.length;
829
- $[26] = t19;
819
+ $[21] = chart.band?.groups;
820
+ $[22] = values.length;
821
+ $[23] = t17;
830
822
  } else {
831
- t19 = $[26];
823
+ t17 = $[23];
832
824
  }
833
- const groupOf = t19;
834
- let t20;
835
- if ($[27] !== chart || $[28] !== valueLabels) {
836
- t20 = typeof valueLabels === "function" ? valueLabels : amount => chart.formatY(amount);
837
- $[27] = chart;
838
- $[28] = valueLabels;
839
- $[29] = t20;
825
+ const groupOf = t17;
826
+ let t18;
827
+ if ($[24] !== chart || $[25] !== valueLabels) {
828
+ t18 = typeof valueLabels === "function" ? valueLabels : amount => chart.formatY(amount);
829
+ $[24] = chart;
830
+ $[25] = valueLabels;
831
+ $[26] = t18;
840
832
  } else {
841
- t20 = $[29];
833
+ t18 = $[26];
842
834
  }
843
- const writeValue = t20;
844
- const drawn = values.flatMap((amount_0, index_1) => {
845
- const top = stacked?.top[index_1];
846
- const base = stacked?.base[index_1] ?? 0;
835
+ const writeValue = t18;
836
+ const drawn = values.flatMap((amount_0, index_0) => {
837
+ const top = stacked?.top[index_0];
838
+ const base = stacked?.base[index_0] ?? 0;
847
839
  const topPixel = top === null || top === undefined ? null : chart.pixelOfY(top);
848
840
  const basePixel = chart.pixelOfY(base) ?? chart.plot.bottom;
849
- const bucket = chart.bucketAt(index_1);
841
+ const bucket = chart.bucketAt(index_0);
850
842
  if (amount_0 === null || topPixel === null || bucket === null) {
851
843
  return [];
852
844
  }
@@ -855,10 +847,10 @@ export function ChartBar(t0) {
855
847
  y,
856
848
  height
857
849
  } = segmentOf(topPixel, basePixel, base === 0, amount_0, bars?.stack === true ? 0 : minHeight);
858
- const focused = index_1 === chart.activeIndex || chart.selected[index_1] === true;
859
- const outOfFocus = chart.dimmed[index_1] === true || anySelected && !focused;
860
- const run_0 = groupOf(index_1);
861
- let alpha = focused ? 1 : opacity?.(rows[index_1], index_1 - run_0.first, run_0.last - run_0.first + 1) ?? 1;
850
+ const focused = index_0 === chart.activeIndex || chart.selected[index_0] === true;
851
+ const outOfFocus = chart.dimmed[index_0] === true || anySelected && !focused;
852
+ const run_0 = groupOf(index_0);
853
+ let alpha = focused ? 1 : opacity?.(rows[index_0], index_0 - run_0.first, run_0.last - run_0.first + 1) ?? 1;
862
854
  if (outOfFocus) {
863
855
  alpha = alpha * dimOpacity;
864
856
  } else {
@@ -866,9 +858,9 @@ export function ChartBar(t0) {
866
858
  alpha = alpha * hoverOpacity;
867
859
  }
868
860
  }
869
- const text = valueLabels === undefined || valueLabels === false ? "" : writeValue(amount_0, rows[index_1], index_1);
861
+ const text = labeled ? writeValue(amount_0, rows[index_0], index_0) : "";
870
862
  return [{
871
- index: index_1,
863
+ index: index_0,
872
864
  column,
873
865
  y,
874
866
  height,
@@ -877,86 +869,86 @@ export function ChartBar(t0) {
877
869
  text
878
870
  }];
879
871
  });
880
- let t21;
881
- if ($[30] !== valueLabelSize || $[31] !== widths) {
882
- t21 = t22 => {
872
+ let t19;
873
+ if ($[27] !== valueLabelSize || $[28] !== widths) {
874
+ t19 = t20 => {
883
875
  const {
884
876
  column: column_0,
885
877
  y: y_0,
886
878
  text: text_0
887
- } = t22;
879
+ } = t20;
888
880
  return {
889
881
  center: column_0.x + column_0.width / 2,
890
882
  top: y_0,
891
883
  width: widths.get(text_0) ?? guessLabelWidth(text_0, valueLabelSize)
892
884
  };
893
885
  };
894
- $[30] = valueLabelSize;
895
- $[31] = widths;
896
- $[32] = t21;
886
+ $[27] = valueLabelSize;
887
+ $[28] = widths;
888
+ $[29] = t19;
897
889
  } else {
898
- t21 = $[32];
890
+ t19 = $[29];
899
891
  }
900
- const labelTops = placeValueLabels(drawn.map(t21), valueLabelSize);
901
- let t22;
902
- if ($[33] !== widths) {
903
- t22 = () => {
892
+ const labelTops = placeValueLabels(drawn.map(t19), valueLabelSize);
893
+ let t20;
894
+ if ($[30] !== widths) {
895
+ t20 = () => {
904
896
  const texts = [...(labels.current?.querySelectorAll("text") ?? [])];
905
897
  if (texts.length === 0 || typeof texts[0].getComputedTextLength !== "function") {
906
898
  return;
907
899
  }
908
900
  const next = new Map(texts.map(_temp7));
909
- if (next.size !== widths.size || [...next].some(t23 => {
910
- const [text_1, width] = t23;
901
+ if (next.size !== widths.size || [...next].some(t21 => {
902
+ const [text_1, width] = t21;
911
903
  return widths.get(text_1) !== width;
912
904
  })) {
913
905
  setWidths(next);
914
906
  }
915
907
  };
916
- $[33] = widths;
917
- $[34] = t22;
908
+ $[30] = widths;
909
+ $[31] = t20;
918
910
  } else {
919
- t22 = $[34];
911
+ t20 = $[31];
920
912
  }
921
- useBeforePaint(t22);
922
- let t23;
923
- if ($[35] !== className) {
924
- t23 = clsx("pointer-events-none", className);
925
- $[35] = className;
926
- $[36] = t23;
913
+ useBeforePaint(t20);
914
+ let t21;
915
+ if ($[32] !== className) {
916
+ t21 = clsx("pointer-events-none", className);
917
+ $[32] = className;
918
+ $[33] = t21;
927
919
  } else {
928
- t23 = $[36];
920
+ t21 = $[33];
929
921
  }
930
- let t24;
931
- if ($[37] !== animate || $[38] !== chart) {
932
- t24 = animate ? {
933
- transformOrigin: `0px ${chart.pixelOfY(Math.max(chart.y.domain[0], 0)) ?? chart.plot.bottom}px`
922
+ let t22;
923
+ if ($[34] !== animate || $[35] !== chart) {
924
+ t22 = animate ? {
925
+ transformOrigin: `0px ${groundOf(chart)}px`
934
926
  } : undefined;
935
- $[37] = animate;
936
- $[38] = chart;
937
- $[39] = t24;
927
+ $[34] = animate;
928
+ $[35] = chart;
929
+ $[36] = t22;
938
930
  } else {
939
- t24 = $[39];
931
+ t22 = $[36];
940
932
  }
941
- let t25;
942
- if ($[40] !== bars?.stack || $[41] !== color || $[42] !== fallback || $[43] !== radius || $[44] !== rounded || $[45] !== rowColors || $[46] !== values) {
943
- t25 = t26 => {
933
+ let t23;
934
+ if ($[37] !== bars?.stack || $[38] !== color || $[39] !== fallback || $[40] !== radius || $[41] !== rounded || $[42] !== rowColors || $[43] !== values) {
935
+ t23 = t24 => {
944
936
  const {
945
- index: index_2,
937
+ index: index_1,
946
938
  column: column_1,
947
939
  y: y_1,
948
940
  height: height_0,
949
941
  alpha: alpha_0
950
- } = t26;
942
+ } = t24;
951
943
  const corner = bars?.stack === true ? 0 : Math.min(radius, Math.floor(column_1.width / 4));
952
- const fill = rowColors?.[index_2] ?? color ?? fallback;
944
+ const fill = rowColors?.[index_1] ?? color ?? fallback;
953
945
  return rounded === "end" && corner > 0 ? /*#__PURE__*/_jsx("path", {
954
- d: endRoundedColumn(column_1.x, y_1, column_1.width, height_0, corner, (values[index_2] ?? 0) >= 0),
946
+ d: endRoundedColumn(column_1.x, y_1, column_1.width, height_0, corner, (values[index_1] ?? 0) >= 0),
955
947
  opacity: alpha_0,
956
948
  style: {
957
949
  fill
958
950
  }
959
- }, index_2) : /*#__PURE__*/_jsx("rect", {
951
+ }, index_1) : /*#__PURE__*/_jsx("rect", {
960
952
  x: column_1.x,
961
953
  y: y_1,
962
954
  width: column_1.width,
@@ -966,27 +958,27 @@ export function ChartBar(t0) {
966
958
  style: {
967
959
  fill
968
960
  }
969
- }, index_2);
961
+ }, index_1);
970
962
  };
971
- $[40] = bars?.stack;
972
- $[41] = color;
973
- $[42] = fallback;
974
- $[43] = radius;
975
- $[44] = rounded;
976
- $[45] = rowColors;
977
- $[46] = values;
978
- $[47] = t25;
963
+ $[37] = bars?.stack;
964
+ $[38] = color;
965
+ $[39] = fallback;
966
+ $[40] = radius;
967
+ $[41] = rounded;
968
+ $[42] = rowColors;
969
+ $[43] = values;
970
+ $[44] = t23;
979
971
  } else {
980
- t25 = $[47];
972
+ t23 = $[44];
981
973
  }
982
- const t26 = valueLabels !== undefined && valueLabels !== false && drawn.map((t27, i) => {
974
+ const t24 = labeled && drawn.map((t25, i) => {
983
975
  const {
984
- index: index_3,
976
+ index: index_2,
985
977
  column: column_2,
986
978
  y: y_2,
987
979
  outOfFocus: outOfFocus_0,
988
980
  text: text_2
989
- } = t27;
981
+ } = t25;
990
982
  const center = Math.round(column_2.x + column_2.width / 2);
991
983
  const baseline = labelTops[i];
992
984
  return /*#__PURE__*/_jsxs("g", {
@@ -1010,27 +1002,27 @@ export function ChartBar(t0) {
1010
1002
  className: clsx("fill-text tabular-nums", valueLabelSize === "xs" ? "text-xs" : "text-2xs"),
1011
1003
  children: text_2
1012
1004
  })]
1013
- }, `label-${index_3}`);
1005
+ }, `label-${index_2}`);
1014
1006
  });
1015
- let t28;
1016
- if ($[48] !== t26) {
1017
- t28 = /*#__PURE__*/_jsx("g", {
1007
+ let t26;
1008
+ if ($[45] !== t24) {
1009
+ t26 = /*#__PURE__*/_jsx("g", {
1018
1010
  ref: labels,
1019
- children: t26
1011
+ children: t24
1020
1012
  });
1021
- $[48] = t26;
1022
- $[49] = t28;
1013
+ $[45] = t24;
1014
+ $[46] = t26;
1023
1015
  } else {
1024
- t28 = $[49];
1016
+ t26 = $[46];
1025
1017
  }
1026
1018
  return /*#__PURE__*/_jsxs("g", {
1027
1019
  ref: ref,
1028
- className: t23,
1020
+ className: t21,
1029
1021
  children: [/*#__PURE__*/_jsx("g", {
1030
1022
  className: animate ? "transition-[scale] duration-400 ease-out starting:scale-y-0 motion-reduce:transition-none" : undefined,
1031
- style: t24,
1032
- children: drawn.map(t25)
1033
- }), t28]
1023
+ style: t22,
1024
+ children: drawn.map(t23)
1025
+ }), t26]
1034
1026
  });
1035
1027
  }
1036
1028
  function _temp7(node) {
package/dist/spark.js CHANGED
@@ -1,10 +1,7 @@
1
1
  const GAP = 2;
2
2
  /* The shortest column that still reads as a bar rather than a dot. */
3
3
  const MIN_HEIGHT = 4;
4
- /*
5
- * The columns of a sparkline on whole pixels, 2px apart, rounded by half their width. A column is 4px tall at least,
6
- * so the smallest count still reads as a bar; a zero keeps a one-pixel baseline, so a quiet day still shows.
7
- */
4
+ /* The columns of a sparkline on whole pixels, 2px apart, rounded by half their width; a zero keeps a one-pixel baseline. */
8
5
  export function sparkColumns(values, width, height) {
9
6
  const high = Math.max(0, ...values.map(value => value ?? 0));
10
7
  const step = values.length === 0 ? 0 : (width + GAP) / values.length;
package/dist/store.js CHANGED
@@ -6,62 +6,62 @@ const same = (one, other) => {
6
6
  };
7
7
  const sameEntry = (one, other) => one !== undefined && Object.entries(other).every(([key, value]) => same(one[key], value));
8
8
  /*
9
- * What the parts tell the root: the series with their values, the axes with the room they need, the
10
- * markers and bands, and the formats of the axes. Each is a snapshot of its own that only changes
11
- * when what is in it does, so a part that registers the same values again changes nothing.
9
+ * What the parts tell the root. Each is a snapshot of its own that only changes when what is in it
10
+ * does, so a part that registers the same values again changes nothing.
12
11
  */
13
12
  export function createChartStore() {
14
13
  const listeners = new Set();
15
- let series = new Map();
16
14
  let axes = {
17
15
  end: null
18
16
  };
19
- let xAxes = new Map();
20
- let yAxes = new Map();
21
- let markers = new Map();
22
- let rules = new Map();
23
- let bands = new Map();
24
17
  let formats = {};
25
18
  const emit = () => {
26
19
  for (const listener of listeners) {
27
20
  listener();
28
21
  }
29
22
  };
30
- const updated = (map, id, entry) => {
31
- if (entry === null) {
32
- if (!map.has(id)) {
33
- return null;
23
+ const keyed = () => {
24
+ let map = new Map();
25
+ return {
26
+ get: () => map,
27
+ set: (id, entry) => {
28
+ if (entry === null) {
29
+ if (!map.has(id)) {
30
+ return;
31
+ }
32
+ const next = new Map(map);
33
+ next.delete(id);
34
+ map = next;
35
+ } else if (sameEntry(map.get(id), entry)) {
36
+ return;
37
+ } else {
38
+ // A changed entry keeps its place, so a series keeps its color while its values change.
39
+ map = new Map(map).set(id, entry);
40
+ }
41
+ emit();
34
42
  }
35
- const next = new Map(map);
36
- next.delete(id);
37
- return next;
38
- }
39
- if (sameEntry(map.get(id), entry)) {
40
- return null;
41
- }
42
- // A changed entry keeps its place, so a series keeps its color while its values change.
43
- return new Map(map).set(id, entry);
43
+ };
44
44
  };
45
+ const series = keyed();
46
+ const xAxes = keyed();
47
+ const yAxes = keyed();
48
+ const markers = keyed();
49
+ const rules = keyed();
50
+ const bands = keyed();
45
51
  return {
46
52
  subscribe(listener) {
47
53
  listeners.add(listener);
48
54
  return () => listeners.delete(listener);
49
55
  },
50
- series: () => series,
56
+ series: series.get,
51
57
  axes: () => axes,
52
- xAxes: () => xAxes,
53
- yAxes: () => yAxes,
54
- markers: () => markers,
55
- rules: () => rules,
56
- bands: () => bands,
58
+ xAxes: xAxes.get,
59
+ yAxes: yAxes.get,
60
+ markers: markers.get,
61
+ rules: rules.get,
62
+ bands: bands.get,
57
63
  formats: () => formats,
58
- setSeries(id, entry) {
59
- const next = updated(series, id, entry);
60
- if (next !== null) {
61
- series = next;
62
- emit();
63
- }
64
- },
64
+ setSeries: series.set,
65
65
  setAxis(axis, size) {
66
66
  if (axes[axis] !== size) {
67
67
  axes = {
@@ -71,41 +71,11 @@ export function createChartStore() {
71
71
  emit();
72
72
  }
73
73
  },
74
- setXAxis(id, entry) {
75
- const next = updated(xAxes, id, entry);
76
- if (next !== null) {
77
- xAxes = next;
78
- emit();
79
- }
80
- },
81
- setYAxis(side, entry) {
82
- const next = updated(yAxes, side, entry);
83
- if (next !== null) {
84
- yAxes = next;
85
- emit();
86
- }
87
- },
88
- setRule(id, entry) {
89
- const next = updated(rules, id, entry);
90
- if (next !== null) {
91
- rules = next;
92
- emit();
93
- }
94
- },
95
- setMarker(id, entry) {
96
- const next = updated(markers, id, entry);
97
- if (next !== null) {
98
- markers = next;
99
- emit();
100
- }
101
- },
102
- setBand(id, entry) {
103
- const next = updated(bands, id, entry);
104
- if (next !== null) {
105
- bands = next;
106
- emit();
107
- }
108
- },
74
+ setXAxis: xAxes.set,
75
+ setYAxis: yAxes.set,
76
+ setRule: rules.set,
77
+ setMarker: markers.set,
78
+ setBand: bands.set,
109
79
  setFormat(axis, format) {
110
80
  if (formats[axis] !== format) {
111
81
  formats = {
@@ -5,7 +5,12 @@ export function timelineTree(spans) {
5
5
  const children = new Map();
6
6
  for (const span of spans) {
7
7
  const parent = span.parent !== undefined && span.parent !== null && span.parent !== span.id && known.has(span.parent) ? span.parent : null;
8
- children.set(parent, [...(children.get(parent) ?? []), span]);
8
+ const siblings = children.get(parent);
9
+ if (siblings === undefined) {
10
+ children.set(parent, [span]);
11
+ } else {
12
+ siblings.push(span);
13
+ }
9
14
  }
10
15
  const rows = [];
11
16
  const placed = new Set();
@@ -0,0 +1,13 @@
1
+ declare const TABLE_CLASSES: {
2
+ box: string;
3
+ table: string;
4
+ head: string;
5
+ column: string;
6
+ row: string;
7
+ rowHeading: string;
8
+ cell: string;
9
+ };
10
+ export declare const tableClasses: (shown: boolean) => Partial<typeof TABLE_CLASSES> & {
11
+ box: string;
12
+ };
13
+ export {};