@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/Heatmap.js +161 -144
- package/dist/Root.js +71 -60
- package/dist/annotations.js +87 -145
- package/dist/cursor.d.ts +1 -0
- package/dist/cursor.js +5 -1
- package/dist/heat.js +2 -2
- package/dist/overlays.js +242 -233
- package/dist/points.js +0 -1
- package/dist/register.js +2 -3
- package/dist/series.js +147 -155
- package/dist/spark.js +1 -4
- package/dist/store.js +40 -70
- package/dist/timeline-layout.js +6 -1
- package/dist/values-table.d.ts +13 -0
- package/dist/values-table.js +13 -0
- package/package.json +9 -9
- package/src/Heatmap.tsx +20 -14
- package/src/Root.tsx +112 -11
- package/src/SeriesLegend.tsx +9 -0
- package/src/Sparkline.tsx +2 -0
- package/src/access.ts +3 -0
- package/src/annotations.tsx +14 -2
- package/src/axes.tsx +37 -2
- package/src/band.ts +25 -0
- package/src/color.ts +1 -0
- package/src/context.ts +2 -0
- package/src/cursor.ts +24 -1
- package/src/group-axes.ts +8 -0
- package/src/heat.ts +8 -2
- package/src/layer.tsx +3 -0
- package/src/legend.ts +2 -0
- package/src/overlays.tsx +43 -16
- package/src/points.ts +19 -2
- package/src/register.ts +3 -3
- package/src/scale.ts +60 -0
- package/src/scatter.tsx +9 -0
- package/src/series.tsx +51 -8
- package/src/spark.ts +4 -4
- package/src/store.ts +46 -70
- package/src/time-format.ts +1 -0
- package/src/timeline-layout.ts +27 -1
- package/src/timeline.tsx +28 -0
- package/src/use-chart.ts +1 -0
- package/src/values-table.ts +12 -0
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
|
|
19
|
-
*
|
|
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 =
|
|
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(
|
|
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] !==
|
|
725
|
-
t8 =
|
|
726
|
-
$[0] =
|
|
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
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
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:
|
|
756
|
-
bars:
|
|
747
|
+
stack: t9,
|
|
748
|
+
bars: t10,
|
|
757
749
|
curve: "linear",
|
|
758
|
-
icon:
|
|
759
|
-
valueLabels:
|
|
750
|
+
icon: t11,
|
|
751
|
+
valueLabels: labeled,
|
|
760
752
|
dimOpacity
|
|
761
753
|
};
|
|
762
|
-
$[
|
|
763
|
-
$[
|
|
764
|
-
$[
|
|
765
|
-
$[
|
|
766
|
-
$[
|
|
767
|
-
$[
|
|
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
|
-
|
|
765
|
+
t12 = $[12];
|
|
774
766
|
}
|
|
775
|
-
useRegistration(chart.store, "series", id,
|
|
776
|
-
let
|
|
777
|
-
if ($[
|
|
778
|
-
|
|
779
|
-
$[
|
|
780
|
-
$[
|
|
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
|
-
|
|
774
|
+
t13 = $[14];
|
|
783
775
|
}
|
|
784
|
-
const noSlot =
|
|
785
|
-
let
|
|
786
|
-
let
|
|
787
|
-
if ($[
|
|
788
|
-
|
|
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
|
-
|
|
794
|
-
$[
|
|
795
|
-
$[
|
|
796
|
-
$[
|
|
785
|
+
t15 = [noSlot];
|
|
786
|
+
$[15] = noSlot;
|
|
787
|
+
$[16] = t14;
|
|
788
|
+
$[17] = t15;
|
|
797
789
|
} else {
|
|
798
|
-
|
|
799
|
-
|
|
790
|
+
t14 = $[16];
|
|
791
|
+
t15 = $[17];
|
|
800
792
|
}
|
|
801
|
-
useEffect(
|
|
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
|
|
811
|
-
if ($[
|
|
812
|
-
|
|
813
|
-
$[
|
|
814
|
-
$[
|
|
815
|
-
$[
|
|
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
|
-
|
|
809
|
+
t16 = $[20];
|
|
818
810
|
}
|
|
819
|
-
const fallback =
|
|
811
|
+
const fallback = t16;
|
|
820
812
|
const anySelected = chart.selected.some(Boolean);
|
|
821
|
-
let
|
|
822
|
-
if ($[
|
|
823
|
-
|
|
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
|
-
$[
|
|
828
|
-
$[
|
|
829
|
-
$[
|
|
819
|
+
$[21] = chart.band?.groups;
|
|
820
|
+
$[22] = values.length;
|
|
821
|
+
$[23] = t17;
|
|
830
822
|
} else {
|
|
831
|
-
|
|
823
|
+
t17 = $[23];
|
|
832
824
|
}
|
|
833
|
-
const groupOf =
|
|
834
|
-
let
|
|
835
|
-
if ($[
|
|
836
|
-
|
|
837
|
-
$[
|
|
838
|
-
$[
|
|
839
|
-
$[
|
|
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
|
-
|
|
833
|
+
t18 = $[26];
|
|
842
834
|
}
|
|
843
|
-
const writeValue =
|
|
844
|
-
const drawn = values.flatMap((amount_0,
|
|
845
|
-
const top = stacked?.top[
|
|
846
|
-
const base = stacked?.base[
|
|
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(
|
|
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 =
|
|
859
|
-
const outOfFocus = chart.dimmed[
|
|
860
|
-
const run_0 = groupOf(
|
|
861
|
-
let alpha = focused ? 1 : opacity?.(rows[
|
|
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 =
|
|
861
|
+
const text = labeled ? writeValue(amount_0, rows[index_0], index_0) : "";
|
|
870
862
|
return [{
|
|
871
|
-
index:
|
|
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
|
|
881
|
-
if ($[
|
|
882
|
-
|
|
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
|
-
} =
|
|
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
|
-
$[
|
|
895
|
-
$[
|
|
896
|
-
$[
|
|
886
|
+
$[27] = valueLabelSize;
|
|
887
|
+
$[28] = widths;
|
|
888
|
+
$[29] = t19;
|
|
897
889
|
} else {
|
|
898
|
-
|
|
890
|
+
t19 = $[29];
|
|
899
891
|
}
|
|
900
|
-
const labelTops = placeValueLabels(drawn.map(
|
|
901
|
-
let
|
|
902
|
-
if ($[
|
|
903
|
-
|
|
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(
|
|
910
|
-
const [text_1, width] =
|
|
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
|
-
$[
|
|
917
|
-
$[
|
|
908
|
+
$[30] = widths;
|
|
909
|
+
$[31] = t20;
|
|
918
910
|
} else {
|
|
919
|
-
|
|
911
|
+
t20 = $[31];
|
|
920
912
|
}
|
|
921
|
-
useBeforePaint(
|
|
922
|
-
let
|
|
923
|
-
if ($[
|
|
924
|
-
|
|
925
|
-
$[
|
|
926
|
-
$[
|
|
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
|
-
|
|
920
|
+
t21 = $[33];
|
|
929
921
|
}
|
|
930
|
-
let
|
|
931
|
-
if ($[
|
|
932
|
-
|
|
933
|
-
transformOrigin: `0px ${
|
|
922
|
+
let t22;
|
|
923
|
+
if ($[34] !== animate || $[35] !== chart) {
|
|
924
|
+
t22 = animate ? {
|
|
925
|
+
transformOrigin: `0px ${groundOf(chart)}px`
|
|
934
926
|
} : undefined;
|
|
935
|
-
$[
|
|
936
|
-
$[
|
|
937
|
-
$[
|
|
927
|
+
$[34] = animate;
|
|
928
|
+
$[35] = chart;
|
|
929
|
+
$[36] = t22;
|
|
938
930
|
} else {
|
|
939
|
-
|
|
931
|
+
t22 = $[36];
|
|
940
932
|
}
|
|
941
|
-
let
|
|
942
|
-
if ($[
|
|
943
|
-
|
|
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:
|
|
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
|
-
} =
|
|
942
|
+
} = t24;
|
|
951
943
|
const corner = bars?.stack === true ? 0 : Math.min(radius, Math.floor(column_1.width / 4));
|
|
952
|
-
const fill = rowColors?.[
|
|
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[
|
|
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
|
-
},
|
|
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
|
-
},
|
|
961
|
+
}, index_1);
|
|
970
962
|
};
|
|
971
|
-
$[
|
|
972
|
-
$[
|
|
973
|
-
$[
|
|
974
|
-
$[
|
|
975
|
-
$[
|
|
976
|
-
$[
|
|
977
|
-
$[
|
|
978
|
-
$[
|
|
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
|
-
|
|
972
|
+
t23 = $[44];
|
|
981
973
|
}
|
|
982
|
-
const
|
|
974
|
+
const t24 = labeled && drawn.map((t25, i) => {
|
|
983
975
|
const {
|
|
984
|
-
index:
|
|
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
|
-
} =
|
|
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-${
|
|
1005
|
+
}, `label-${index_2}`);
|
|
1014
1006
|
});
|
|
1015
|
-
let
|
|
1016
|
-
if ($[
|
|
1017
|
-
|
|
1007
|
+
let t26;
|
|
1008
|
+
if ($[45] !== t24) {
|
|
1009
|
+
t26 = /*#__PURE__*/_jsx("g", {
|
|
1018
1010
|
ref: labels,
|
|
1019
|
-
children:
|
|
1011
|
+
children: t24
|
|
1020
1012
|
});
|
|
1021
|
-
$[
|
|
1022
|
-
$[
|
|
1013
|
+
$[45] = t24;
|
|
1014
|
+
$[46] = t26;
|
|
1023
1015
|
} else {
|
|
1024
|
-
|
|
1016
|
+
t26 = $[46];
|
|
1025
1017
|
}
|
|
1026
1018
|
return /*#__PURE__*/_jsxs("g", {
|
|
1027
1019
|
ref: ref,
|
|
1028
|
-
className:
|
|
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:
|
|
1032
|
-
children: drawn.map(
|
|
1033
|
-
}),
|
|
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
|
|
10
|
-
*
|
|
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
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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:
|
|
56
|
+
series: series.get,
|
|
51
57
|
axes: () => axes,
|
|
52
|
-
xAxes:
|
|
53
|
-
yAxes:
|
|
54
|
-
markers:
|
|
55
|
-
rules:
|
|
56
|
-
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
|
|
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
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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 = {
|
package/dist/timeline-layout.js
CHANGED
|
@@ -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
|
-
|
|
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 {};
|