nanoplot 0.0.21 → 0.0.23
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/bun.lockb +0 -0
- package/dist/index.css +1 -1
- package/dist/src/components/Bars/Bars.d.ts +1 -1
- package/dist/src/components/Bars/Bars.js +1 -1
- package/dist/src/components/Bars/components/BarsVerticalLoading.js +2 -2
- package/dist/src/components/Bars/components/HorizontalBars.js +6 -6
- package/dist/src/{app/bar-graph → components/Bars}/components/Rect.js +3 -3
- package/dist/src/components/Bars/components/VerticalBars.d.ts +1 -1
- package/dist/src/components/Bars/components/VerticalBars.js +29 -45
- package/dist/src/components/Graph/Graph.d.ts +1 -1
- package/dist/src/components/Graph/Graph.js +6 -6
- package/dist/src/components/GridLines/GridLines.js +2 -2
- package/dist/src/components/Legend/Legend.d.ts +2 -2
- package/dist/src/components/Legend/Legend.js +3 -3
- package/dist/src/components/Lines/Lines.d.ts +3 -3
- package/dist/src/components/Lines/Lines.js +13 -25
- package/dist/src/components/Lines/components/LinesLoading.js +1 -1
- package/dist/src/components/Lines/components/LinesTooltip.d.ts +1 -1
- package/dist/src/components/Lines/components/LinesTooltip.js +7 -7
- package/dist/src/components/Overlay/Overlay.d.ts +4 -0
- package/dist/src/components/Overlay/Overlay.js +9 -5
- package/dist/src/components/Overlay/OverlayRect.js +4 -4
- package/dist/src/components/Pie/Pie.js +8 -8
- package/dist/src/components/Pie/components/PieEmpty.js +2 -2
- package/dist/src/components/Pie/components/PieLoading.js +3 -3
- package/dist/src/components/Radar/Radar.js +6 -6
- package/dist/src/components/Radar/components/RadarSkeleton.js +3 -3
- package/dist/src/components/Scatter/Scatter.js +6 -6
- package/dist/src/components/Scatter/components/ScatterLoading.js +1 -1
- package/dist/src/components/Sunburst/Sunburst.js +3 -3
- package/dist/src/components/Sunburst/SunburstLoading.js +1 -1
- package/dist/src/components/Tooltip/Popup.d.ts +1 -1
- package/dist/src/components/Tooltip/Popup.js +2 -2
- package/dist/src/components/Worldmap/Worldmap.d.ts +3 -3
- package/dist/src/components/Worldmap/Worldmap.js +187 -7
- package/dist/src/components/XAxis/XAxis.d.ts +2 -2
- package/dist/src/components/XAxis/XAxis.js +4 -4
- package/dist/src/components/YAxis/YAxis.d.ts +2 -2
- package/dist/src/components/YAxis/YAxis.js +4 -4
- package/dist/src/export/index.d.ts +2 -2
- package/dist/src/export/index.js +2 -2
- package/dist/src/hooks/use-graph/use-client-graph.d.ts +1 -1
- package/dist/src/hooks/use-graph/use-graph.js +2 -2
- package/dist/src/hooks/use-graph/use-server-graph.d.ts +1 -1
- package/dist/src/hooks/use-mouse-coordinates.js +1 -1
- package/dist/src/utils/children/children.d.ts +1 -1
- package/dist/src/utils/color/color.d.ts +1 -0
- package/dist/src/utils/color/color.js +43 -0
- package/dist/src/utils/coordinates/coordinates.d.ts +1 -1
- package/dist/src/utils/coordinates/coordinates.js +1 -1
- package/dist/src/utils/domain/date-domain.d.ts +1 -1
- package/dist/src/utils/domain/domain.d.ts +3 -3
- package/dist/src/utils/domain/domain.js +4 -4
- package/dist/src/utils/graph/graph.d.ts +1 -1
- package/dist/tsconfig.typings.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/tailwind-container-queries.ts +5 -1
- package/tsconfig.json +1 -4
- package/tsconfig.typings.json +1 -1
- package/dist/src/utils/countries.d.ts +0 -181
- package/dist/src/utils/countries.js +0 -181
- /package/dist/src/{app/bar-graph → components/Bars}/components/Rect.d.ts +0 -0
|
@@ -89,4 +89,47 @@ export const ColorUtils = {
|
|
|
89
89
|
];
|
|
90
90
|
return `rgb(${r}, ${g}, ${b})`;
|
|
91
91
|
},
|
|
92
|
+
textFor: (color) => {
|
|
93
|
+
var _a;
|
|
94
|
+
const isKnownColor = (_a = COLORS.find(({ fill }) => fill === color)) === null || _a === void 0 ? void 0 : _a.color;
|
|
95
|
+
if (isKnownColor)
|
|
96
|
+
return isKnownColor;
|
|
97
|
+
const hexToRgb = (hex) => {
|
|
98
|
+
hex = hex.replace(/^#/, "");
|
|
99
|
+
if (hex.length === 3)
|
|
100
|
+
hex = hex
|
|
101
|
+
.split("")
|
|
102
|
+
.map((x) => x + x)
|
|
103
|
+
.join("");
|
|
104
|
+
const num = parseInt(hex, 16);
|
|
105
|
+
return [num >> 16, (num >> 8) & 255, num & 255];
|
|
106
|
+
};
|
|
107
|
+
const hslToRgb = (h, s, l) => {
|
|
108
|
+
s /= 100;
|
|
109
|
+
l /= 100;
|
|
110
|
+
const k = (n) => (n + h / 30) % 12;
|
|
111
|
+
const a = s * Math.min(l, 1 - l);
|
|
112
|
+
const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1));
|
|
113
|
+
return [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
|
|
114
|
+
};
|
|
115
|
+
let rgb = null;
|
|
116
|
+
// Extract first hex color
|
|
117
|
+
const hexMatch = color.match(/#([0-9a-fA-F]{3,6})/);
|
|
118
|
+
if (hexMatch)
|
|
119
|
+
rgb = hexToRgb(hexMatch[0]);
|
|
120
|
+
// Extract first RGB color
|
|
121
|
+
const rgbMatch = color.match(/rgb\(\s*(\d+),\s*(\d+),\s*(\d+)\s*\)/);
|
|
122
|
+
if (rgbMatch)
|
|
123
|
+
rgb = rgbMatch.slice(1, 4).map(Number);
|
|
124
|
+
// Extract first HSL color and convert to RGB (supporting "deg" in hue)
|
|
125
|
+
const hslMatch = color.match(/hsl\(\s*(\d+)(?:deg)?,\s*(\d+)%?,\s*(\d+)%?\s*\)/);
|
|
126
|
+
if (hslMatch)
|
|
127
|
+
rgb = hslToRgb(Number(hslMatch[1]), Number(hslMatch[2]), Number(hslMatch[3]));
|
|
128
|
+
// Default to white if parsing fails
|
|
129
|
+
if (!rgb)
|
|
130
|
+
rgb = [255, 255, 255];
|
|
131
|
+
// Calculate brightness
|
|
132
|
+
const brightness = Math.round((rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000);
|
|
133
|
+
return brightness > 125 ? "black" : "white";
|
|
134
|
+
},
|
|
92
135
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
import { XAxis } from "
|
|
2
|
+
import { XAxis } from "../../components/XAxis/XAxis";
|
|
3
3
|
type Jumps = NonNullable<ComponentProps<typeof XAxis>["ticks"]>["jumps"];
|
|
4
4
|
type TimeseriesFormats = NonNullable<Exclude<Jumps, number | "auto">>;
|
|
5
5
|
export declare const times: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { XAxis } from "@/components/XAxis/XAxis";
|
|
2
1
|
import { ComponentProps } from "react";
|
|
3
|
-
import { GraphContext } from "
|
|
4
|
-
import {
|
|
2
|
+
import { GraphContext } from "../../hooks/use-graph/use-graph";
|
|
3
|
+
import { XAxis } from "../../components/XAxis/XAxis";
|
|
4
|
+
import { YAxis } from "../../components/YAxis/YAxis";
|
|
5
5
|
export declare const DomainUtils: {
|
|
6
6
|
autoMinFor: (value: number) => number;
|
|
7
7
|
autoMaxFor: (value: number) => number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GraphUtils } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { GraphUtils } from "../graph/graph";
|
|
2
|
+
import { DateDomain } from "./date-domain";
|
|
3
|
+
import { MathUtils } from "../math/math";
|
|
4
|
+
import { ObjectUtils } from "../object/object";
|
|
5
5
|
const roundUp = (num, nearest) => Math.ceil(num / nearest) * nearest;
|
|
6
6
|
const roundDown = (num, nearest) => Math.floor(num / nearest) * nearest;
|
|
7
7
|
export const DomainUtils = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SegmentDataset, XYDataset } from "
|
|
1
|
+
import { SegmentDataset, XYDataset } from "../../hooks/use-graph/use-graph";
|
|
2
2
|
export declare const GraphUtils: {
|
|
3
3
|
isSegmentData: (data: SegmentDataset | XYDataset) => data is SegmentDataset;
|
|
4
4
|
isXYData: (data: SegmentDataset | XYDataset) => data is XYDataset;
|