panelui-native 0.61.1 → 0.63.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.
Files changed (81) hide show
  1. package/lib/module/components/area-chart/index.js +14 -4
  2. package/lib/module/components/area-chart/index.js.map +1 -1
  3. package/lib/module/components/bar-chart/index.js +14 -4
  4. package/lib/module/components/bar-chart/index.js.map +1 -1
  5. package/lib/module/components/candlestick-chart/index.js +14 -4
  6. package/lib/module/components/candlestick-chart/index.js.map +1 -1
  7. package/lib/module/components/card/index.js +26 -1
  8. package/lib/module/components/card/index.js.map +1 -1
  9. package/lib/module/components/dialog/index.js +49 -3
  10. package/lib/module/components/dialog/index.js.map +1 -1
  11. package/lib/module/components/hex-chart/index.js +2 -2
  12. package/lib/module/components/hex-chart/index.js.map +1 -1
  13. package/lib/module/components/line-chart/index.js +14 -4
  14. package/lib/module/components/line-chart/index.js.map +1 -1
  15. package/lib/module/components/live-line-chart/index.js +1063 -0
  16. package/lib/module/components/live-line-chart/index.js.map +1 -0
  17. package/lib/module/components/pie-chart/index.js +2 -2
  18. package/lib/module/components/pie-chart/index.js.map +1 -1
  19. package/lib/module/components/plot/index.js +1329 -0
  20. package/lib/module/components/plot/index.js.map +1 -0
  21. package/lib/module/components/polar-area-chart/index.js +719 -0
  22. package/lib/module/components/polar-area-chart/index.js.map +1 -0
  23. package/lib/module/components/radar-chart/index.js +14 -4
  24. package/lib/module/components/radar-chart/index.js.map +1 -1
  25. package/lib/module/components/ring-chart/index.js +2 -2
  26. package/lib/module/components/ring-chart/index.js.map +1 -1
  27. package/lib/module/components/section-rail/index.js +120 -15
  28. package/lib/module/components/section-rail/index.js.map +1 -1
  29. package/lib/module/components/selection-mode/index.js +129 -18
  30. package/lib/module/components/selection-mode/index.js.map +1 -1
  31. package/lib/module/components/sortable/index.js +15 -5
  32. package/lib/module/components/sortable/index.js.map +1 -1
  33. package/lib/module/index.js +9 -0
  34. package/lib/module/index.js.map +1 -1
  35. package/lib/module/utils/chart.js +40 -0
  36. package/lib/module/utils/chart.js.map +1 -1
  37. package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -1
  38. package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -1
  39. package/lib/typescript/src/components/candlestick-chart/index.d.ts +6 -3
  40. package/lib/typescript/src/components/candlestick-chart/index.d.ts.map +1 -1
  41. package/lib/typescript/src/components/card/index.d.ts +48 -1
  42. package/lib/typescript/src/components/card/index.d.ts.map +1 -1
  43. package/lib/typescript/src/components/dialog/index.d.ts +47 -2
  44. package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
  45. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
  46. package/lib/typescript/src/components/live-line-chart/index.d.ts +293 -0
  47. package/lib/typescript/src/components/live-line-chart/index.d.ts.map +1 -0
  48. package/lib/typescript/src/components/plot/index.d.ts +471 -0
  49. package/lib/typescript/src/components/plot/index.d.ts.map +1 -0
  50. package/lib/typescript/src/components/polar-area-chart/index.d.ts +259 -0
  51. package/lib/typescript/src/components/polar-area-chart/index.d.ts.map +1 -0
  52. package/lib/typescript/src/components/radar-chart/index.d.ts.map +1 -1
  53. package/lib/typescript/src/components/section-rail/index.d.ts +8 -1
  54. package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -1
  55. package/lib/typescript/src/components/selection-mode/index.d.ts +82 -6
  56. package/lib/typescript/src/components/selection-mode/index.d.ts.map +1 -1
  57. package/lib/typescript/src/components/sortable/index.d.ts.map +1 -1
  58. package/lib/typescript/src/index.d.ts +4 -0
  59. package/lib/typescript/src/index.d.ts.map +1 -1
  60. package/lib/typescript/src/utils/chart.d.ts +15 -14
  61. package/lib/typescript/src/utils/chart.d.ts.map +1 -1
  62. package/package.json +1 -1
  63. package/src/components/area-chart/index.tsx +14 -4
  64. package/src/components/bar-chart/index.tsx +14 -4
  65. package/src/components/candlestick-chart/index.tsx +20 -7
  66. package/src/components/card/index.tsx +32 -7
  67. package/src/components/dialog/index.tsx +55 -2
  68. package/src/components/hex-chart/index.tsx +2 -2
  69. package/src/components/line-chart/index.tsx +14 -4
  70. package/src/components/live-line-chart/index.tsx +1294 -0
  71. package/src/components/pie-chart/index.tsx +2 -2
  72. package/src/components/plot/index.tsx +1564 -0
  73. package/src/components/polar-area-chart/index.tsx +928 -0
  74. package/src/components/radar-chart/index.tsx +14 -4
  75. package/src/components/ring-chart/index.tsx +2 -2
  76. package/src/components/section-rail/index.tsx +133 -14
  77. package/src/components/selection-mode/index.tsx +163 -26
  78. package/src/components/sortable/index.tsx +15 -5
  79. package/src/index.ts +81 -0
  80. package/src/utils/chart.ts +44 -0
  81. package/theme.css +24 -0
package/src/index.ts CHANGED
@@ -556,6 +556,87 @@ export {
556
556
  type PieChartStatus,
557
557
  type PieDatum,
558
558
  } from './components/pie-chart';
559
+ export {
560
+ LiveLineChart,
561
+ useLiveLineChart,
562
+ type LiveLineChartProps,
563
+ type LiveLineChartHandle,
564
+ type LiveLineChartHeaderProps,
565
+ type LiveLineChartGridProps,
566
+ type LiveLineChartAreaProps,
567
+ type LiveLineChartLineProps,
568
+ type LiveLineChartTipProps,
569
+ type LiveLineChartXAxisProps,
570
+ type LiveLineChartYAxisProps,
571
+ type LiveLineChartTooltipProps,
572
+ type LiveLineChartSkeletonProps,
573
+ type LiveLineChartStatus,
574
+ type LiveLineMomentum,
575
+ type LiveLineMomentumColors,
576
+ type LiveLinePoint,
577
+ } from './components/live-line-chart';
578
+ export {
579
+ PolarAreaChart,
580
+ usePolarAreaChart,
581
+ type PolarAreaChartProps,
582
+ type PolarAreaChartHandle,
583
+ type PolarAreaChartHeaderProps,
584
+ type PolarAreaChartGridProps,
585
+ type PolarAreaChartWedgesProps,
586
+ type PolarAreaChartLabelsProps,
587
+ type PolarAreaChartTooltipProps,
588
+ type PolarAreaChartLegendProps,
589
+ type PolarAreaChartSkeletonProps,
590
+ type PolarAreaChartStatus,
591
+ type PolarAreaScale,
592
+ type PolarAreaDatum,
593
+ } from './components/polar-area-chart';
594
+ export {
595
+ Plot,
596
+ usePlot,
597
+ usePlotCursor,
598
+ type PlotProps,
599
+ type PlotHandle,
600
+ type PlotGeometry,
601
+ type PlotHeaderProps,
602
+ type PlotLegendProps,
603
+ type PlotGridProps,
604
+ type PlotSeriesProps,
605
+ type PlotLineProps,
606
+ type PlotAreaProps,
607
+ type PlotBarsProps,
608
+ type PlotDotsProps,
609
+ type PlotRuleProps,
610
+ type PlotLayerProps,
611
+ type PlotOverlayProps,
612
+ type PlotXAxisProps,
613
+ type PlotYAxisProps,
614
+ type PlotCursorProps,
615
+ type PlotTooltipProps,
616
+ type PlotDatum,
617
+ type PlotStatus,
618
+ type PlotCurve,
619
+ type PlotScale,
620
+ type PlotBound,
621
+ type PlotBox,
622
+ } from './components/plot';
623
+ /*
624
+ * The scale functions, alongside the component they exist for. Every one is a
625
+ * worklet, which is what lets a mark somebody writes themselves be rebuilt on
626
+ * the UI thread on the same frames `Plot`'s own are.
627
+ */
628
+ export {
629
+ areaPath,
630
+ bandOf,
631
+ barPath,
632
+ compactNumber,
633
+ linePath,
634
+ segment,
635
+ xAt,
636
+ xOf,
637
+ yOf,
638
+ type ChartPoint,
639
+ } from './components/plot';
559
640
  export { Textarea, type TextareaProps } from './components/textarea';
560
641
  export {
561
642
  TagInput,
@@ -130,6 +130,50 @@ const INK_FLOOR = 3;
130
130
  * the colour it was given. Compositing happens in gamma space, the way the
131
131
  * renderer does it, before the luminance is taken.
132
132
  */
133
+ /** A colour moved `amount` of the way towards white, or towards black when negative. */
134
+ function tone(color: string, amount: number): string {
135
+ const rgb = channelsOf(color);
136
+ if (!rgb) return color;
137
+
138
+ const target = amount >= 0 ? 255 : 0;
139
+ const t = Math.min(Math.abs(amount), 0.85);
140
+ const [r, g, b] = rgb.map((c) => Math.round(c + (target - c) * t));
141
+ return `rgb(${r}, ${g}, ${b})`;
142
+ }
143
+
144
+ /**
145
+ * The colour for the `index`th thing in a chart that draws an unbounded number
146
+ * of them.
147
+ *
148
+ * There are five series tokens, and a chart is routinely asked to draw six
149
+ * things. Taking the palette modulo its length hands two of them the identical
150
+ * colour, which in a chart whose whole job is telling parts apart is a bug the
151
+ * theme decides the severity of — on a theme whose first token is green, the
152
+ * sixth wedge is a second green one.
153
+ *
154
+ * So each further lap through the palette is drawn a step further along a tone
155
+ * run, keeping the theme's own hues rather than inventing new ones.
156
+ *
157
+ * The run goes *away* from whichever end the colour already sits near, and
158
+ * always in that one direction. Alternating lighter and darker would be the
159
+ * obvious thing and it reintroduces the bug on the themes that matter: a token
160
+ * of `#fafafa` lightened is `#fafafa` back again, so the second lap of a
161
+ * near-white palette entry is the same colour it was trying not to be.
162
+ */
163
+ export function seriesColorAt(palette: string[], index: number): string {
164
+ if (!palette.length) return FALLBACK_SERIES[0]!;
165
+
166
+ const base = palette[index % palette.length]!;
167
+ const lap = Math.floor(index / palette.length);
168
+ if (lap <= 0) return base;
169
+
170
+ const rgb = channelsOf(base);
171
+ const away = rgb && luminanceOf(rgb) > 0.4 ? -1 : 1;
172
+ // Each lap covers two thirds of what is left, so every one lands somewhere
173
+ // the last did not.
174
+ return tone(base, away * (1 - 0.66 ** lap));
175
+ }
176
+
133
177
  export function inkOn(fill: string, behind?: string, opacity = 1): ChartInk {
134
178
  const front = channelsOf(fill);
135
179
  if (!front) return LIGHT_INK;
package/theme.css CHANGED
@@ -56,6 +56,18 @@
56
56
  */
57
57
  --color-overlay: unset;
58
58
  --color-overlay-foreground: unset;
59
+ /*
60
+ * A band set *into* a surface rather than raised off it — the footer of
61
+ * actions under a card or a dialog.
62
+ *
63
+ * A translucent black in every theme, rather than a colour of its own,
64
+ * because it has to come out darker than whatever it is drawn on and that
65
+ * changes: a card, a popover, or a surface the caller passed in. `--color-
66
+ * muted` cannot do this job — it is white in a dark theme, so the band it
67
+ * draws floats forward instead of sinking, which is the opposite of what a
68
+ * footer is saying.
69
+ */
70
+ --color-inset: unset;
59
71
  --color-primary: unset;
60
72
  --color-primary-foreground: unset;
61
73
  --color-secondary: unset;
@@ -194,6 +206,8 @@
194
206
 
195
207
  --color-overlay: #ffffff;
196
208
  --color-overlay-foreground: #262626;
209
+ /* the sunken band under a card or dialog: black at 3.5% */
210
+ --color-inset: rgba(0, 0, 0, 0.035);
197
211
 
198
212
  --color-primary: #262626;
199
213
  --color-primary-foreground: #fafafa;
@@ -289,6 +303,8 @@
289
303
  /* color-mix(background 92%, white) — one step past the popover */
290
304
  --color-overlay: #232323;
291
305
  --color-overlay-foreground: #f5f5f5;
306
+ /* the sunken band under a card or dialog: black at 22% */
307
+ --color-inset: rgba(0, 0, 0, 0.22);
292
308
 
293
309
  --color-primary: #f5f5f5;
294
310
  --color-primary-foreground: #262626;
@@ -413,6 +429,8 @@
413
429
 
414
430
  --color-overlay: #ffffff;
415
431
  --color-overlay-foreground: #08090a;
432
+ /* the sunken band under a card or dialog: black at 3.5% */
433
+ --color-inset: rgba(0, 0, 0, 0.035);
416
434
 
417
435
  --color-primary: #5e6ad2;
418
436
  --color-primary-foreground: #ffffff;
@@ -496,6 +514,8 @@
496
514
 
497
515
  --color-overlay: #18191a;
498
516
  --color-overlay-foreground: #f7f8f8;
517
+ /* the sunken band under a card or dialog: black at 22% */
518
+ --color-inset: rgba(0, 0, 0, 0.22);
499
519
 
500
520
  --color-primary: #5e6ad2;
501
521
  --color-primary-foreground: #ffffff;
@@ -583,6 +603,8 @@
583
603
 
584
604
  --color-overlay: #ffffff;
585
605
  --color-overlay-foreground: #171717;
606
+ /* the sunken band under a card or dialog: black at 3.5% */
607
+ --color-inset: rgba(0, 0, 0, 0.035);
586
608
 
587
609
  /* Brand green is too light for white text; light mode uses the
588
610
  darker ramp step so the contrast ratio holds. */
@@ -668,6 +690,8 @@
668
690
 
669
691
  --color-overlay: #2a2a2a;
670
692
  --color-overlay-foreground: #ededed;
693
+ /* the sunken band under a card or dialog: black at 22% */
694
+ --color-inset: rgba(0, 0, 0, 0.22);
671
695
 
672
696
  --color-primary: #3ecf8e;
673
697
  --color-primary-foreground: #052e1b;