panelui-native 0.99.0 → 0.100.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/lib/module/components/animated-badge/index.js +24 -2
- package/lib/module/components/animated-badge/index.js.map +1 -1
- package/lib/module/components/bump-chart/index.js +1236 -0
- package/lib/module/components/bump-chart/index.js.map +1 -0
- package/lib/module/components/mirror-area-chart/index.js +1113 -0
- package/lib/module/components/mirror-area-chart/index.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/chart.js +70 -0
- package/lib/module/utils/chart.js.map +1 -1
- package/lib/typescript/src/components/animated-badge/index.d.ts +5 -0
- package/lib/typescript/src/components/animated-badge/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bump-chart/index.d.ts +267 -0
- package/lib/typescript/src/components/bump-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/mirror-area-chart/index.d.ts +263 -0
- package/lib/typescript/src/components/mirror-area-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/chart.d.ts +23 -0
- package/lib/typescript/src/utils/chart.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/animated-badge/index.tsx +35 -2
- package/src/components/bump-chart/index.tsx +1455 -0
- package/src/components/mirror-area-chart/index.tsx +1333 -0
- package/src/index.ts +37 -0
- package/src/utils/chart.ts +70 -0
package/src/index.ts
CHANGED
|
@@ -711,6 +711,25 @@ export {
|
|
|
711
711
|
type BubbleChartPoint,
|
|
712
712
|
type BubbleChartStatus,
|
|
713
713
|
} from './components/bubble-chart';
|
|
714
|
+
export {
|
|
715
|
+
BumpChart,
|
|
716
|
+
useBumpChart,
|
|
717
|
+
bumpRanks,
|
|
718
|
+
type BumpChartProps,
|
|
719
|
+
type BumpChartHandle,
|
|
720
|
+
type BumpChartHeaderProps,
|
|
721
|
+
type BumpChartGridProps,
|
|
722
|
+
type BumpChartLineProps,
|
|
723
|
+
type BumpChartSkeletonProps,
|
|
724
|
+
type BumpChartXAxisProps,
|
|
725
|
+
type BumpChartYAxisProps,
|
|
726
|
+
type BumpChartLabelsProps,
|
|
727
|
+
type BumpChartTooltipProps,
|
|
728
|
+
type BumpChartLegendProps,
|
|
729
|
+
type BumpChartStatus,
|
|
730
|
+
type BumpChartDatum,
|
|
731
|
+
type BumpRanks,
|
|
732
|
+
} from './components/bump-chart';
|
|
714
733
|
export {
|
|
715
734
|
PyramidChart,
|
|
716
735
|
usePyramidChart,
|
|
@@ -927,6 +946,24 @@ export {
|
|
|
927
946
|
type MessageScrollerButtonProps,
|
|
928
947
|
type MessageScrollerPosition,
|
|
929
948
|
} from './components/message-scroller';
|
|
949
|
+
export {
|
|
950
|
+
MirrorAreaChart,
|
|
951
|
+
useMirrorAreaChart,
|
|
952
|
+
type MirrorAreaChartProps,
|
|
953
|
+
type MirrorAreaChartHandle,
|
|
954
|
+
type MirrorAreaChartHeaderProps,
|
|
955
|
+
type MirrorAreaChartGridProps,
|
|
956
|
+
type MirrorAreaChartBaselineProps,
|
|
957
|
+
type MirrorAreaChartAreaProps,
|
|
958
|
+
type MirrorAreaChartSkeletonProps,
|
|
959
|
+
type MirrorAreaChartXAxisProps,
|
|
960
|
+
type MirrorAreaChartYAxisProps,
|
|
961
|
+
type MirrorAreaChartTooltipProps,
|
|
962
|
+
type MirrorAreaChartLegendProps,
|
|
963
|
+
type MirrorAreaChartStatus,
|
|
964
|
+
type MirrorAreaChartSide,
|
|
965
|
+
type MirrorAreaChartDatum,
|
|
966
|
+
} from './components/mirror-area-chart';
|
|
930
967
|
export {
|
|
931
968
|
Message,
|
|
932
969
|
type MessageProps,
|
package/src/utils/chart.ts
CHANGED
|
@@ -560,6 +560,76 @@ export function areaPath(
|
|
|
560
560
|
.join(' ');
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
+
/**
|
|
564
|
+
* A colour as a gradient stop: the colour without its alpha, and the alpha as
|
|
565
|
+
* the stop's opacity. A `<Stop>` given `rgba(255,255,255,0.13)` as its colour
|
|
566
|
+
* draws it opaque on native, so a translucent token such as `--color-skeleton`
|
|
567
|
+
* comes out solid white in a dark theme.
|
|
568
|
+
*/
|
|
569
|
+
export function colorStop(color: string): { stopColor: string; stopOpacity: number } {
|
|
570
|
+
const value = color.trim();
|
|
571
|
+
const clamp = (alpha: number) => (Number.isFinite(alpha) ? Math.min(Math.max(alpha, 0), 1) : 1);
|
|
572
|
+
|
|
573
|
+
// #rgba and #rrggbbaa
|
|
574
|
+
if (/^#([0-9a-f]{4}|[0-9a-f]{8})$/i.test(value)) {
|
|
575
|
+
const body =
|
|
576
|
+
value.length === 5
|
|
577
|
+
? value
|
|
578
|
+
.slice(1)
|
|
579
|
+
.split('')
|
|
580
|
+
.map((digit) => digit + digit)
|
|
581
|
+
.join('')
|
|
582
|
+
: value.slice(1);
|
|
583
|
+
return {
|
|
584
|
+
stopColor: `#${body.slice(0, 6)}`,
|
|
585
|
+
stopOpacity: clamp(parseInt(body.slice(6, 8), 16) / 255),
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// rgba(r, g, b, a) and rgb(r g b / a)
|
|
590
|
+
const match = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)\s*[,/]\s*([\d.]+%?)\s*\)$/i.exec(value);
|
|
591
|
+
if (match) {
|
|
592
|
+
const raw = match[4]!;
|
|
593
|
+
const alpha = raw.endsWith('%') ? Number(raw.slice(0, -1)) / 100 : Number(raw);
|
|
594
|
+
return { stopColor: `rgb(${match[1]}, ${match[2]}, ${match[3]})`, stopOpacity: clamp(alpha) };
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
return { stopColor: value, stopOpacity: 1 };
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* One unbroken run of points joined by S-curves, for a chart of positions.
|
|
602
|
+
*
|
|
603
|
+
* Each join leaves one point level and arrives at the next one level, with
|
|
604
|
+
* both control points at the midpoint between them. A line that holds its
|
|
605
|
+
* position stays flat, and a line that changes position crosses over in the
|
|
606
|
+
* middle of the gap. The monotone curve suits values, not places: it bends
|
|
607
|
+
* through every point, so a series holding its rank would still look like it
|
|
608
|
+
* was moving.
|
|
609
|
+
*/
|
|
610
|
+
export function bumpSegment(points: ChartPoint[]): string {
|
|
611
|
+
'worklet';
|
|
612
|
+
if (!points.length) return '';
|
|
613
|
+
let d = `M${points[0]!.x},${points[0]!.y}`;
|
|
614
|
+
for (let i = 1; i < points.length; i += 1) {
|
|
615
|
+
const from = points[i - 1]!;
|
|
616
|
+
const to = points[i]!;
|
|
617
|
+
const mid = (from.x + to.x) / 2;
|
|
618
|
+
d += ` C${mid},${from.y} ${mid},${to.y} ${to.x},${to.y}`;
|
|
619
|
+
}
|
|
620
|
+
return d;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/** A dot at every point, as one path, so a series' markers cost one node. */
|
|
624
|
+
export function dotsPath(points: ChartPoint[], radius: number): string {
|
|
625
|
+
'worklet';
|
|
626
|
+
let d = '';
|
|
627
|
+
for (const point of points) {
|
|
628
|
+
d += `M${point.x - radius},${point.y} a${radius},${radius} 0 1,0 ${radius * 2},0 a${radius},${radius} 0 1,0 ${-radius * 2},0 `;
|
|
629
|
+
}
|
|
630
|
+
return d;
|
|
631
|
+
}
|
|
632
|
+
|
|
563
633
|
/**
|
|
564
634
|
* A rounded rectangle, built as a path rather than drawn as a `Rect`.
|
|
565
635
|
*
|