@tensor_1/react 2.55.3 → 2.57.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 (66) hide show
  1. package/README.md +68 -0
  2. package/component-inventory.json +64 -0
  3. package/dist/{ChartCore-BKK2HEfi.d.cts → ChartCore-CY5a4teJ.d.cts} +18 -2
  4. package/dist/GlanceCharts-Cb39RqDC.d.cts +88 -0
  5. package/dist/chart-analytic-guide.d.ts +1 -0
  6. package/dist/chart-analytic-guide.js +6 -1
  7. package/dist/chart-analytic.cjs +11 -1
  8. package/dist/chart-analytic.d.cts +2 -2
  9. package/dist/chart-glance.d.ts +65 -0
  10. package/dist/chart-glance.js +162 -0
  11. package/dist/chart-preset.cjs +337 -5
  12. package/dist/chart-preset.d.cts +9 -3
  13. package/dist/chart-preset.d.ts +8 -1
  14. package/dist/chart-preset.js +16 -1
  15. package/dist/chart-theme.d.ts +18 -2
  16. package/dist/chart-theme.js +6 -1
  17. package/dist/chart.cjs +337 -5
  18. package/dist/chart.d.cts +9 -3
  19. package/dist/chart.d.ts +3 -1
  20. package/dist/chart.js +9 -2
  21. package/dist/components/Arrive.d.ts +49 -0
  22. package/dist/components/Arrive.js +93 -0
  23. package/dist/components/Attachment.js +2 -2
  24. package/dist/components/Chart.d.ts +8 -1
  25. package/dist/components/Chart.js +16 -1
  26. package/dist/components/ChartCard.d.ts +34 -0
  27. package/dist/components/ChartCard.js +36 -0
  28. package/dist/components/ChartPanels.js +5 -0
  29. package/dist/components/Count.d.ts +10 -4
  30. package/dist/components/Count.js +35 -3
  31. package/dist/components/FileDrop.d.ts +51 -0
  32. package/dist/components/FileDrop.js +183 -0
  33. package/dist/components/FileGlyph.d.ts +9 -0
  34. package/dist/components/{FileIcon.js → FileGlyph.js} +2 -2
  35. package/dist/components/FileKindIcon.d.ts +36 -0
  36. package/dist/components/FileKindIcon.js +48 -0
  37. package/dist/components/FileRow.d.ts +102 -0
  38. package/dist/components/FileRow.js +164 -0
  39. package/dist/components/FileUpload.js +2 -2
  40. package/dist/components/GlanceCharts.d.ts +37 -0
  41. package/dist/components/GlanceCharts.js +128 -0
  42. package/dist/components/GlanceMarks.d.ts +63 -0
  43. package/dist/components/GlanceMarks.js +59 -0
  44. package/dist/components/Heartbeat.d.ts +5 -5
  45. package/dist/components/Meter.d.ts +12 -2
  46. package/dist/components/Meter.js +23 -13
  47. package/dist/components/StatusDot.d.ts +27 -0
  48. package/dist/components/StatusDot.js +16 -0
  49. package/dist/file-model.d.ts +41 -3
  50. package/dist/file-model.js +65 -1
  51. package/dist/icons/Icon.d.ts +5 -5
  52. package/dist/icons/components.d.ts +3 -1
  53. package/dist/icons/components.js +4 -0
  54. package/dist/icons/glyphs.d.ts +5 -1
  55. package/dist/icons/glyphs.js +6 -0
  56. package/dist/icons.cjs +10 -0
  57. package/dist/icons.d.cts +7 -25
  58. package/dist/icons.d.ts +1 -1
  59. package/dist/index.cjs +2807 -2099
  60. package/dist/index.d.cts +399 -15
  61. package/dist/index.d.ts +9 -1
  62. package/dist/index.js +41 -1
  63. package/dist/labels-context.d.ts +9 -1
  64. package/dist/types-B593xJNf.d.cts +26 -0
  65. package/package.json +1 -1
  66. package/dist/components/FileIcon.d.ts +0 -9
package/dist/chart.cjs CHANGED
@@ -35,11 +35,18 @@ __export(chart_exports, {
35
35
  ChartLegendItem: () => ChartLegendItem,
36
36
  ChartMetric: () => ChartMetric,
37
37
  DEFAULT_CHART_LABELS: () => DEFAULT_CHART_LABELS,
38
+ GLANCE_AT_REST: () => GLANCE_AT_REST,
39
+ GlanceLineChart: () => GlanceLineChart,
40
+ PAIRED_BARS_MAX_BUCKETS: () => PAIRED_BARS_MAX_BUCKETS,
41
+ PairedBarChart: () => PairedBarChart,
42
+ glanceLineOption: () => glanceLineOption,
38
43
  mergeChartTheme: () => mergeChartTheme,
44
+ pairedBarsOption: () => pairedBarsOption,
39
45
  uixChartAreaGradient: () => uixChartAreaGradient,
40
46
  uixChartPalette: () => uixChartPalette,
41
47
  uixChartTheme: () => uixChartTheme,
42
- uixChartTokens: () => uixChartTokens
48
+ uixChartTokens: () => uixChartTokens,
49
+ uixGlanceBase: () => uixGlanceBase
43
50
  });
44
51
  module.exports = __toCommonJS(chart_exports);
45
52
 
@@ -67,6 +74,9 @@ function uixChartTokens(source) {
67
74
  const unquote = (font) => font.replace(/"/g, "");
68
75
  return {
69
76
  palette: [1, 2, 3, 4, 5, 6, 7, 8].map((i) => t(`chart-${i}`)),
77
+ series: t("chart-series"),
78
+ seriesSoft: t("chart-series-soft"),
79
+ categories: [1, 2, 3].map((i) => t(`chart-${i}`)),
70
80
  neutral: t("chart-neutral"),
71
81
  grid: t("chart-grid"),
72
82
  axis: t("chart-axis"),
@@ -84,7 +94,9 @@ function uixChartTokens(source) {
84
94
  textMuted: t("text-muted"),
85
95
  border: t("border-strong"),
86
96
  fontSans: unquote(t("font-sans")),
87
- fontMono: unquote(t("font-mono"))
97
+ fontMono: unquote(t("font-mono")),
98
+ radius: t("radius-md"),
99
+ shadow: t("shadow-popover")
88
100
  };
89
101
  }
90
102
  function uixChartTheme(source) {
@@ -354,10 +366,323 @@ function ChartLegendItem({ label, color, swatch = "block", className, style, ...
354
366
  ] });
355
367
  }
356
368
 
357
- // src/components/Chart.tsx
369
+ // src/components/GlanceCharts.tsx
370
+ var import_react4 = require("react");
371
+
372
+ // src/components/Arrive.tsx
373
+ var import_react3 = require("react");
374
+
375
+ // src/motion.ts
376
+ function tokenMs(name, fallback, el) {
377
+ if (typeof getComputedStyle === "undefined" || typeof document === "undefined") return fallback;
378
+ const raw = getComputedStyle(el ?? document.documentElement).getPropertyValue(name).trim();
379
+ const m = /^(-?\d*\.?\d+)(ms|s)$/.exec(raw);
380
+ if (!m) return fallback;
381
+ return m[2] === "s" ? Number(m[1]) * 1e3 : Number(m[1]);
382
+ }
383
+
384
+ // src/components/Arrive.tsx
358
385
  var import_jsx_runtime2 = require("react/jsx-runtime");
386
+ var REGISTRY = /* @__PURE__ */ Symbol.for("@tensor_1/react/arrive-contexts");
387
+ var registry = globalThis;
388
+ var contexts = registry[REGISTRY] ?? (registry[REGISTRY] = {
389
+ stage: (0, import_react3.createContext)({ playing: false }),
390
+ index: (0, import_react3.createContext)(0)
391
+ });
392
+ var ArriveContext = contexts.stage;
393
+ function useArrive() {
394
+ return (0, import_react3.useContext)(ArriveContext);
395
+ }
396
+ var ArriveIndexContext = contexts.index;
397
+ function useArriveIndex() {
398
+ return (0, import_react3.useContext)(ArriveIndexContext);
399
+ }
400
+
401
+ // src/chart-glance.ts
402
+ var GLANCE_AT_REST = { play: false, delay: 0, trace: 0, grow: 0, stagger: 0 };
403
+ var escapeHtml = (value) => String(value).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
404
+ var plain = (value) => value.toLocaleString();
405
+ function tooltipHtml(title, rows) {
406
+ return `<div class="uix-glance-tooltip"><div class="uix-glance-tooltip__title">${escapeHtml(title)}</div>${rows.map((row) => `<div class="uix-glance-tooltip__row"><span class="uix-glance-tooltip__swatch" style="--swatch:${escapeHtml(row.color)}"></span>${escapeHtml(row.name)}<span class="uix-glance-tooltip__value">${escapeHtml(row.value)}</span></div>`).join("")}</div>`;
407
+ }
408
+ var seriesColor = (k) => k.series ?? k.palette[0] ?? "";
409
+ function uixGlanceBase(k, motion = GLANCE_AT_REST) {
410
+ return {
411
+ backgroundColor: "transparent",
412
+ animation: motion.play,
413
+ animationDurationUpdate: 0,
414
+ textStyle: { color: k.textMuted, fontFamily: k.fontSans, fontSize: 11 },
415
+ grid: { top: 10, right: 12, bottom: 4, left: 4, containLabel: true },
416
+ tooltip: {
417
+ trigger: "axis",
418
+ confine: true,
419
+ backgroundColor: k.text,
420
+ borderWidth: 0,
421
+ padding: [6, 10],
422
+ textStyle: { color: k.surface, fontFamily: k.fontSans, fontSize: 12 },
423
+ extraCssText: [k.radius ? `border-radius:${k.radius}` : "", k.shadow ? `box-shadow:${k.shadow}` : ""].filter(Boolean).join(";"),
424
+ transitionDuration: 0
425
+ },
426
+ xAxis: {
427
+ type: "category",
428
+ axisLine: { lineStyle: { color: k.axis } },
429
+ axisTick: { show: false },
430
+ axisLabel: { color: k.textMuted, fontFamily: k.fontSans, fontSize: 11, hideOverlap: true },
431
+ splitLine: { show: false }
432
+ },
433
+ yAxis: {
434
+ type: "value",
435
+ splitNumber: 3,
436
+ minInterval: 1,
437
+ axisLine: { show: false },
438
+ axisTick: { show: false },
439
+ axisLabel: { color: k.textMuted, fontFamily: k.fontSans, fontSize: 11 },
440
+ splitLine: { lineStyle: { color: k.axis, type: [3, 4], width: 1 } }
441
+ }
442
+ };
443
+ }
444
+ function glanceLineOption(k, input, motion = GLANCE_AT_REST) {
445
+ const format = input.format ?? plain;
446
+ const last = input.values.length - 1;
447
+ const forecast = input.forecast;
448
+ const categories = [...input.categories, ...forecast?.categories ?? []];
449
+ const labelled = (value, text, color2, dot) => ({
450
+ value,
451
+ symbolSize: dot ? 8 : 0,
452
+ label: { show: true, position: "right", distance: 6, color: color2, fontFamily: k.fontSans, fontSize: 11, fontWeight: 600, formatter: () => text }
453
+ });
454
+ const showEnd = input.endLabel !== false && !forecast && last >= 0;
455
+ const measured = forecast ? [
456
+ ...input.values.map((v, i) => i === last ? { value: v, symbolSize: 8 } : v),
457
+ ...forecast.values.map(() => null)
458
+ ] : [
459
+ ...input.values.map((v, i) => showEnd && i === last ? labelled(v, format(v), k.text, true) : v)
460
+ ];
461
+ const projected = forecast ? [...input.values.map((v, i) => i === last ? v : null), ...forecast.values.map((v, i) => i === forecast.values.length - 1 ? labelled(v, forecast.label ?? format(v), k.textMuted, false) : v)] : [];
462
+ const color = seriesColor(k);
463
+ const base = uixGlanceBase(k, motion);
464
+ const title = input.tooltipTitle ?? ((c) => c);
465
+ const endText = forecast ? forecast.label ?? format(forecast.values[forecast.values.length - 1] ?? 0) : showEnd ? format(input.values[last]) : "";
466
+ const series = [{
467
+ name: input.name,
468
+ type: "line",
469
+ data: measured,
470
+ color,
471
+ // symbols at size 0 so the last point can carry its dot and its label
472
+ showSymbol: true,
473
+ symbol: "circle",
474
+ symbolSize: 0,
475
+ lineStyle: { width: 2.2, cap: "round", join: "round" },
476
+ itemStyle: { color, borderColor: k.surface, borderWidth: 2 },
477
+ areaStyle: input.area === false ? void 0 : k.seriesSoft ? { color: k.seriesSoft, opacity: 1 } : { color, opacity: 0.14 },
478
+ emphasis: { disabled: true },
479
+ animationDuration: motion.trace,
480
+ animationDelay: motion.delay,
481
+ animationEasing: "cubicOut"
482
+ }];
483
+ if (forecast) {
484
+ series.push({
485
+ name: forecast.name,
486
+ type: "line",
487
+ data: projected,
488
+ color,
489
+ showSymbol: true,
490
+ symbolSize: 0,
491
+ connectNulls: false,
492
+ lineStyle: { width: 2, type: [4, 5], opacity: 0.75, cap: "round" },
493
+ itemStyle: { color },
494
+ emphasis: { disabled: true },
495
+ // the projection continues the measured line, at half its pace
496
+ animationDuration: Math.round(motion.trace / 2),
497
+ animationDelay: motion.delay + motion.trace,
498
+ animationEasing: "cubicOut"
499
+ });
500
+ }
501
+ return {
502
+ ...base,
503
+ // the gutter fits the end label ("Prognose 140"): about 6.5 px a character at 11 px
504
+ grid: { ...base.grid, right: endText ? Math.max(24, Math.ceil(endText.length * 6.5) + 14) : 12 },
505
+ tooltip: {
506
+ ...base.tooltip,
507
+ axisPointer: { type: "line", lineStyle: { color: k.textMuted, type: [2, 3], width: 1 } },
508
+ formatter: (params) => {
509
+ const list = (Array.isArray(params) ? params : [params]).filter((p) => p.value != null);
510
+ if (!list.length) return "";
511
+ const point = list.find((p) => p.seriesIndex === 0) ?? list[0];
512
+ const value = typeof point.value === "object" && point.value !== null ? point.value.value : point.value;
513
+ return tooltipHtml(title(point.name), [{ color, name: point.seriesName, value: format(value) }]);
514
+ }
515
+ },
516
+ xAxis: { ...base.xAxis, data: categories, boundaryGap: false },
517
+ series
518
+ };
519
+ }
520
+ var PAIRED_BARS_MAX_BUCKETS = 12;
521
+ function pairedBarsOption(k, input, motion = GLANCE_AT_REST) {
522
+ const format = input.format ?? plain;
523
+ const base = uixGlanceBase(k, motion);
524
+ const title = input.tooltipTitle ?? ((c) => c);
525
+ const bar = (name, values, color, offset) => ({
526
+ name,
527
+ type: "bar",
528
+ data: values,
529
+ color,
530
+ barMaxWidth: 16,
531
+ barGap: "18%",
532
+ barCategoryGap: "38%",
533
+ itemStyle: { color, borderRadius: [3, 3, 0, 0] },
534
+ emphasis: { disabled: true },
535
+ animationDuration: motion.grow,
536
+ animationDelay: (index) => motion.delay + index * motion.stagger + offset,
537
+ animationEasing: "cubicOut"
538
+ });
539
+ return {
540
+ ...base,
541
+ tooltip: {
542
+ ...base.tooltip,
543
+ axisPointer: { type: "shadow", shadowStyle: { color: k.forecastBand } },
544
+ formatter: (params) => {
545
+ const list = Array.isArray(params) ? params : [params];
546
+ if (!list.length) return "";
547
+ return tooltipHtml(title(list[0].name), list.map((p) => ({ color: p.color, name: p.seriesName, value: format(p.value) })));
548
+ }
549
+ },
550
+ xAxis: { ...base.xAxis, data: input.categories },
551
+ series: [
552
+ bar(input.series.name, input.series.values, seriesColor(k), 0),
553
+ bar(input.comparison.name, input.comparison.values, k.comparison, motion.stagger)
554
+ ]
555
+ };
556
+ }
557
+
558
+ // src/components/GlanceCharts.tsx
559
+ var import_jsx_runtime3 = require("react/jsx-runtime");
560
+ function useGlanceMotion() {
561
+ const { playing } = useArrive();
562
+ const index = useArriveIndex();
563
+ const played = (0, import_react4.useRef)(null);
564
+ const [settled, setSettled] = (0, import_react4.useState)(false);
565
+ if (playing && !played.current) {
566
+ played.current = {
567
+ play: true,
568
+ delay: index * tokenMs("--uix-stagger-arrive", 45) + tokenMs("--uix-delay-arrive-trace", 150),
569
+ trace: tokenMs("--uix-dur-arrive-trace", 700),
570
+ grow: tokenMs("--uix-dur-arrive-grow", 500),
571
+ stagger: tokenMs("--uix-stagger-arrive-grow", 25)
572
+ };
573
+ }
574
+ const motion = played.current;
575
+ (0, import_react4.useEffect)(() => {
576
+ if (!motion || settled) return void 0;
577
+ const drawIn = motion.delay + Math.max(motion.trace, motion.grow + motion.stagger * (PAIRED_BARS_MAX_BUCKETS - 1));
578
+ const timer = setTimeout(() => setSettled(true), drawIn + 50);
579
+ return () => clearTimeout(timer);
580
+ }, [motion, settled]);
581
+ return motion && !settled ? motion : GLANCE_AT_REST;
582
+ }
583
+ function useDrawInWhenPlayed(motion, build) {
584
+ const chart = (0, import_react4.useRef)(null);
585
+ const atRestWhenDrawn = (0, import_react4.useRef)(false);
586
+ const motionNow = (0, import_react4.useRef)(motion);
587
+ motionNow.current = motion;
588
+ const buildNow = (0, import_react4.useRef)(build);
589
+ buildNow.current = build;
590
+ const onReady = (0, import_react4.useCallback)((instance) => {
591
+ chart.current = instance;
592
+ atRestWhenDrawn.current = !motionNow.current.play;
593
+ }, []);
594
+ (0, import_react4.useEffect)(() => {
595
+ const instance = chart.current;
596
+ if (!motion.play || !instance || instance.isDisposed() || !atRestWhenDrawn.current) return;
597
+ atRestWhenDrawn.current = false;
598
+ if (prefersReducedMotion()) return;
599
+ const element = instance.getDom();
600
+ instance.clear();
601
+ instance.setOption(mergeChartTheme(uixChartTheme(element), buildNow.current(uixChartTokens(element), motion)));
602
+ }, [motion]);
603
+ return onReady;
604
+ }
605
+ function GlanceLineChartCore({ engine, ariaLabel, categoryLabel = "Period", height = 150, className, style, loading, empty, labels, group, onEvents, ...input }) {
606
+ const motion = useGlanceMotion();
607
+ const { categories, values, name, forecast, endLabel, area, format, tooltipTitle } = input;
608
+ const build = (k, m) => glanceLineOption(k, { categories, values, name, forecast, endLabel, area, format, tooltipTitle }, m);
609
+ const onReady = useDrawInWhenPlayed(motion, build);
610
+ const option = (0, import_react4.useMemo)(
611
+ () => (k) => build(k, motion),
612
+ // a new array with the same numbers is the same chart
613
+ // eslint-disable-next-line react-hooks/exhaustive-deps
614
+ [JSON.stringify(categories), JSON.stringify(values), name, JSON.stringify(forecast), endLabel, area, format, tooltipTitle, motion]
615
+ );
616
+ const headers = [categoryLabel, name, ...forecast ? [forecast.name] : []];
617
+ const rows = [
618
+ ...categories.map((c, i) => ({ [categoryLabel]: c, [name]: values[i] ?? "" })),
619
+ ...forecast ? forecast.categories.map((c, i) => ({ [categoryLabel]: c, [name]: "", [forecast.name]: forecast.values[i] ?? "" })) : []
620
+ ];
621
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
622
+ ChartCore,
623
+ {
624
+ engine,
625
+ option,
626
+ ariaLabel,
627
+ tableHeaders: headers,
628
+ tableData: rows,
629
+ height,
630
+ className,
631
+ style,
632
+ loading,
633
+ empty,
634
+ labels,
635
+ group,
636
+ onEvents,
637
+ onReady
638
+ }
639
+ );
640
+ }
641
+ function PairedBarChartCore({ engine, ariaLabel, categoryLabel = "Period", height = 140, className, style, loading, empty, labels, group, onEvents, ...input }) {
642
+ const motion = useGlanceMotion();
643
+ const { categories, series, comparison, format, tooltipTitle } = input;
644
+ if (categories.length > PAIRED_BARS_MAX_BUCKETS && typeof console !== "undefined") {
645
+ console.warn(`[uix] PairedBarChart reads at a glance up to ${PAIRED_BARS_MAX_BUCKETS} buckets; it has ${categories.length}. Use a line, or move it to a report.`);
646
+ }
647
+ const build = (k, m) => pairedBarsOption(k, { categories, series, comparison, format, tooltipTitle }, m);
648
+ const onReady = useDrawInWhenPlayed(motion, build);
649
+ const option = (0, import_react4.useMemo)(
650
+ () => (k) => build(k, motion),
651
+ // eslint-disable-next-line react-hooks/exhaustive-deps
652
+ [JSON.stringify(categories), JSON.stringify(series), JSON.stringify(comparison), format, tooltipTitle, motion]
653
+ );
654
+ const rows = categories.map((c, i) => ({ [categoryLabel]: c, [series.name]: series.values[i] ?? "", [comparison.name]: comparison.values[i] ?? "" }));
655
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
656
+ ChartCore,
657
+ {
658
+ engine,
659
+ option,
660
+ ariaLabel,
661
+ tableHeaders: [categoryLabel, series.name, comparison.name],
662
+ tableData: rows,
663
+ height,
664
+ className,
665
+ style,
666
+ loading,
667
+ empty,
668
+ labels,
669
+ group,
670
+ onEvents,
671
+ onReady
672
+ }
673
+ );
674
+ }
675
+
676
+ // src/components/Chart.tsx
677
+ var import_jsx_runtime4 = require("react/jsx-runtime");
359
678
  function Chart(props) {
360
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartCore, { ...props, engine: echarts });
679
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartCore, { ...props, engine: echarts });
680
+ }
681
+ function GlanceLineChart(props) {
682
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GlanceLineChartCore, { ...props, engine: echarts });
683
+ }
684
+ function PairedBarChart(props) {
685
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PairedBarChartCore, { ...props, engine: echarts });
361
686
  }
362
687
  // Annotate the CommonJS export names for ESM import in node:
363
688
  0 && (module.exports = {
@@ -366,9 +691,16 @@ function Chart(props) {
366
691
  ChartLegendItem,
367
692
  ChartMetric,
368
693
  DEFAULT_CHART_LABELS,
694
+ GLANCE_AT_REST,
695
+ GlanceLineChart,
696
+ PAIRED_BARS_MAX_BUCKETS,
697
+ PairedBarChart,
698
+ glanceLineOption,
369
699
  mergeChartTheme,
700
+ pairedBarsOption,
370
701
  uixChartAreaGradient,
371
702
  uixChartPalette,
372
703
  uixChartTheme,
373
- uixChartTokens
704
+ uixChartTokens,
705
+ uixGlanceBase
374
706
  });
package/dist/chart.d.cts CHANGED
@@ -1,9 +1,15 @@
1
1
  import * as react from 'react';
2
- import { a as ChartProps } from './ChartCore-BKK2HEfi.cjs';
3
- export { c as ChartEventHandler, C as ChartLabels, d as ChartLegend, e as ChartLegendItem, f as ChartLegendItemProps, g as ChartLegendProps, h as ChartMetric, i as ChartMetricProps, j as ChartOption, k as ChartTable, l as ChartTableRow, m as ChartTokenSource, D as DEFAULT_CHART_LABELS, U as UixChartTokens, n as mergeChartTheme, u as uixChartAreaGradient, o as uixChartPalette, p as uixChartTheme, q as uixChartTokens } from './ChartCore-BKK2HEfi.cjs';
2
+ import { a as ChartProps } from './ChartCore-CY5a4teJ.cjs';
3
+ export { c as ChartEventHandler, C as ChartLabels, d as ChartLegend, e as ChartLegendItem, f as ChartLegendItemProps, g as ChartLegendProps, h as ChartMetric, i as ChartMetricProps, j as ChartOption, k as ChartTable, l as ChartTableRow, m as ChartTokenSource, D as DEFAULT_CHART_LABELS, U as UixChartTokens, n as mergeChartTheme, u as uixChartAreaGradient, o as uixChartPalette, p as uixChartTheme, q as uixChartTokens } from './ChartCore-CY5a4teJ.cjs';
4
+ import { G as GlanceLineChartProps, P as PairedBarChartProps } from './GlanceCharts-Cb39RqDC.cjs';
5
+ export { a as GLANCE_AT_REST, b as GlanceChartBaseProps, c as GlanceFormat, d as GlanceLineInput, e as GlanceMotion, f as PAIRED_BARS_MAX_BUCKETS, g as PairedBarsInput, h as glanceLineOption, p as pairedBarsOption, u as uixGlanceBase } from './GlanceCharts-Cb39RqDC.cjs';
4
6
  import 'echarts';
5
7
 
6
8
  /** Full-compatibility adapter. Use `@tensor_1/react/chart/preset` for the lean preset. */
7
9
  declare function Chart(props: ChartProps): react.JSX.Element;
10
+ /** A glance line (calm kit 2.56): one series in the series blue, labelled at its end, an optional dashed forecast. Put it in a `ChartCard`. */
11
+ declare function GlanceLineChart(props: GlanceLineChartProps): react.JSX.Element;
12
+ /** Paired bars (calm kit 2.56): per bucket the measure in blue beside its grey comparison, up to 12 buckets. Put it in a `ChartCard`. */
13
+ declare function PairedBarChart(props: PairedBarChartProps): react.JSX.Element;
8
14
 
9
- export { Chart, ChartProps };
15
+ export { Chart, ChartProps, GlanceLineChart, GlanceLineChartProps, PairedBarChart, PairedBarChartProps };
package/dist/chart.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export { Chart } from './components/Chart.js';
1
+ export { Chart, GlanceLineChart, PairedBarChart } from './components/Chart.js';
2
2
  export { ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartMetric, ChartMetricProps, ChartOption, ChartProps, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './components/ChartCore.js';
3
3
  export { ChartTokenSource, UixChartTokens, mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from './chart-theme.js';
4
+ export { GLANCE_AT_REST, GlanceFormat, GlanceLineInput, GlanceMotion, PAIRED_BARS_MAX_BUCKETS, PairedBarsInput, glanceLineOption, pairedBarsOption, uixGlanceBase } from './chart-glance.js';
5
+ export { GlanceChartBaseProps, GlanceLineChartProps, PairedBarChartProps } from './components/GlanceCharts.js';
4
6
  import 'react';
5
7
  import 'echarts';
package/dist/chart.js CHANGED
@@ -1,13 +1,20 @@
1
- import { Chart, ChartLegend, ChartLegendItem, ChartMetric, DEFAULT_CHART_LABELS, mergeChartTheme, uixChartAreaGradient, uixChartPalette, uixChartTheme, uixChartTokens } from "./components/Chart.js";
1
+ import { Chart, GlanceLineChart, PairedBarChart, GLANCE_AT_REST, PAIRED_BARS_MAX_BUCKETS, glanceLineOption, pairedBarsOption, uixGlanceBase, ChartLegend, ChartLegendItem, ChartMetric, DEFAULT_CHART_LABELS, mergeChartTheme, uixChartAreaGradient, uixChartPalette, uixChartTheme, uixChartTokens } from "./components/Chart.js";
2
2
  export {
3
3
  Chart,
4
4
  ChartLegend,
5
5
  ChartLegendItem,
6
6
  ChartMetric,
7
7
  DEFAULT_CHART_LABELS,
8
+ GLANCE_AT_REST,
9
+ GlanceLineChart,
10
+ PAIRED_BARS_MAX_BUCKETS,
11
+ PairedBarChart,
12
+ glanceLineOption,
8
13
  mergeChartTheme,
14
+ pairedBarsOption,
9
15
  uixChartAreaGradient,
10
16
  uixChartPalette,
11
17
  uixChartTheme,
12
- uixChartTokens
18
+ uixChartTokens,
19
+ uixGlanceBase
13
20
  };
@@ -0,0 +1,49 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ interface ArriveState {
5
+ /** True while the stage plays its arrival; false at rest (and outside any stage). */
6
+ playing: boolean;
7
+ }
8
+ /** Whether the nearest `Arrive` stage is playing its arrival. Charts read it to draw in once. */
9
+ declare function useArrive(): ArriveState;
10
+ /** The reading-order index of the nearest `ArriveItem` (or `ChartCard arriveIndex`); 0 outside one. */
11
+ declare function useArriveIndex(): number;
12
+ /** Provides an item's index to what it holds (a chart that starts drawing with its card). */
13
+ declare function ArriveIndexProvider({ index, children }: {
14
+ index: number;
15
+ children?: ReactNode;
16
+ }): react.JSX.Element;
17
+ interface ArriveProps extends HTMLAttributes<HTMLDivElement> {
18
+ /**
19
+ * Remember the arrival under this name for the browser session (sessionStorage, with an
20
+ * in-memory fallback): the page arrives on its first visit and is simply there after a reload,
21
+ * a tab switch or a route change back to it. Without a name it plays on every mount.
22
+ */
23
+ name?: string;
24
+ /**
25
+ * Wait for the content (default `true`): while `false` nothing moves; the first time it turns
26
+ * `true` the arrival plays (if it has not played under `name` yet). Pass `!loading` so the
27
+ * cards arrive with their data instead of under a skeleton.
28
+ */
29
+ ready?: boolean;
30
+ /** Never play: everything is at rest from the start (a print view, a test). */
31
+ disabled?: boolean;
32
+ children?: ReactNode;
33
+ }
34
+ /**
35
+ * The stage for a glance page's arrival. Mark each card with `ArriveItem` (or the
36
+ * `.uix-arrive__item` class and `--uix-arrive-i`), in reading order. `Count arrive`,
37
+ * `Sparkline`, `BarList`, `Meter` and the glance charts inside it draw in by themselves.
38
+ */
39
+ declare function Arrive({ name, ready, disabled, className, children, ...props }: ArriveProps): react.JSX.Element;
40
+ interface ArriveItemProps extends HTMLAttributes<HTMLElement> {
41
+ /** Reading-order position: item n starts n × 45 ms after the first. */
42
+ index?: number;
43
+ as?: 'div' | 'section' | 'article' | 'li' | 'header' | 'aside';
44
+ children?: ReactNode;
45
+ }
46
+ /** One card (or row of cards) of an `Arrive` stage. */
47
+ declare function ArriveItem({ index, as: Tag, className, style, children, ...props }: ArriveItemProps): react.JSX.Element;
48
+
49
+ export { Arrive, ArriveIndexProvider, ArriveItem, type ArriveItemProps, type ArriveProps, type ArriveState, useArrive, useArriveIndex };
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
4
+ import { cx } from "../cx.js";
5
+ import { tokenMs } from "../motion.js";
6
+ const useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
7
+ const seen = /* @__PURE__ */ new Set();
8
+ const STORAGE_PREFIX = "uix-arrive:";
9
+ function hasArrived(name) {
10
+ if (seen.has(name)) return true;
11
+ try {
12
+ return typeof sessionStorage !== "undefined" && sessionStorage.getItem(STORAGE_PREFIX + name) === "1";
13
+ } catch {
14
+ return false;
15
+ }
16
+ }
17
+ function markArrived(name) {
18
+ seen.add(name);
19
+ try {
20
+ if (typeof sessionStorage !== "undefined") sessionStorage.setItem(STORAGE_PREFIX + name, "1");
21
+ } catch {
22
+ }
23
+ }
24
+ const REGISTRY = /* @__PURE__ */ Symbol.for("@tensor_1/react/arrive-contexts");
25
+ const registry = globalThis;
26
+ const contexts = registry[REGISTRY] ?? (registry[REGISTRY] = {
27
+ stage: createContext({ playing: false }),
28
+ index: createContext(0)
29
+ });
30
+ const ArriveContext = contexts.stage;
31
+ function useArrive() {
32
+ return useContext(ArriveContext);
33
+ }
34
+ const ArriveIndexContext = contexts.index;
35
+ function useArriveIndex() {
36
+ return useContext(ArriveIndexContext);
37
+ }
38
+ function ArriveIndexProvider({ index, children }) {
39
+ return /* @__PURE__ */ jsx(ArriveIndexContext.Provider, { value: index, children });
40
+ }
41
+ function sequenceMs(stage) {
42
+ let lastItem = 0;
43
+ let lastBar = 0;
44
+ stage.querySelectorAll(".uix-arrive__item").forEach((item) => {
45
+ const i = Number.parseFloat(getComputedStyle(item).getPropertyValue("--uix-arrive-i"));
46
+ if (Number.isFinite(i)) lastItem = Math.max(lastItem, i);
47
+ });
48
+ stage.querySelectorAll(".uix-arrive__grow").forEach((bar) => {
49
+ const j = Number.parseFloat(getComputedStyle(bar).getPropertyValue("--uix-arrive-j"));
50
+ if (Number.isFinite(j)) lastBar = Math.max(lastBar, j);
51
+ });
52
+ const t = (name, fallback) => tokenMs(name, fallback, stage);
53
+ const start = lastItem * t("--uix-stagger-arrive", 45);
54
+ const drawn = t("--uix-delay-arrive-trace", 150) + Math.max(
55
+ t("--uix-dur-arrive-trace", 700),
56
+ t("--uix-dur-arrive-grow", 500) + lastBar * t("--uix-stagger-arrive-grow", 25)
57
+ );
58
+ return start + Math.max(t("--uix-dur-arrive", 420), drawn, t("--uix-dur-arrive-count", 600)) + 50;
59
+ }
60
+ function Arrive({ name, ready = true, disabled = false, className, children, ...props }) {
61
+ const ref = useRef(null);
62
+ const [phase, setPhase] = useState(() => {
63
+ if (disabled) return "rest";
64
+ if (typeof window !== "undefined" && name && hasArrived(name)) return "rest";
65
+ return ready ? "play" : "wait";
66
+ });
67
+ useIsoLayoutEffect(() => {
68
+ if (phase !== "wait" || !ready) return;
69
+ setPhase(disabled || name && hasArrived(name) ? "rest" : "play");
70
+ }, [phase, ready, disabled, name]);
71
+ useEffect(() => {
72
+ if (phase !== "play") return void 0;
73
+ if (name) markArrived(name);
74
+ const stage = ref.current;
75
+ if (!stage) return void 0;
76
+ const timer = window.setTimeout(() => setPhase("rest"), sequenceMs(stage));
77
+ return () => window.clearTimeout(timer);
78
+ }, [phase, name]);
79
+ useIsoLayoutEffect(() => {
80
+ ref.current?.setAttribute("data-uix-arrive", phase);
81
+ }, [phase]);
82
+ return /* @__PURE__ */ jsx(ArriveContext.Provider, { value: { playing: phase === "play" }, children: /* @__PURE__ */ jsx("div", { ref, className: cx("uix-arrive", className), "data-uix-arrive": phase, suppressHydrationWarning: true, ...props, children }) });
83
+ }
84
+ function ArriveItem({ index = 0, as: Tag = "div", className, style, children, ...props }) {
85
+ return /* @__PURE__ */ jsx(Tag, { className: cx("uix-arrive__item", className), style: { "--uix-arrive-i": index, ...style }, ...props, children: /* @__PURE__ */ jsx(ArriveIndexContext.Provider, { value: index, children }) });
86
+ }
87
+ export {
88
+ Arrive,
89
+ ArriveIndexProvider,
90
+ ArriveItem,
91
+ useArrive,
92
+ useArriveIndex
93
+ };
@@ -4,7 +4,7 @@ import { formatFileSize } from "../file-model.js";
4
4
  import { renderUixLink } from "../link.js";
5
5
  import { DEFAULT_ATTACHMENT_LABELS } from "../attachment-labels.js";
6
6
  import { AttachmentRemoveButton, AttachmentText } from "./AttachmentParts.js";
7
- import { FileIcon } from "./FileIcon.js";
7
+ import { FileGlyph } from "./FileGlyph.js";
8
8
  function Attachment({
9
9
  name,
10
10
  size,
@@ -39,7 +39,7 @@ function Attachment({
39
39
  ...download ? { download: typeof download === "string" ? download : "" } : {}
40
40
  }) : /* @__PURE__ */ jsx("span", { className: "uix-attachment__name", children: name });
41
41
  return /* @__PURE__ */ jsxs("li", { className: cx("uix-attachment", className), "data-status": status === "ready" ? void 0 : status, "aria-busy": status === "loading" || void 0, ...props, children: [
42
- /* @__PURE__ */ jsx("span", { className: "uix-attachment__icon", "aria-hidden": "true", children: thumbnail ?? /* @__PURE__ */ jsx(FileIcon, { name, type }) }),
42
+ /* @__PURE__ */ jsx("span", { className: "uix-attachment__icon", "aria-hidden": "true", children: thumbnail ?? /* @__PURE__ */ jsx(FileGlyph, { name, type }) }),
43
43
  /* @__PURE__ */ jsxs("span", { className: "uix-attachment__body", children: [
44
44
  /* @__PURE__ */ jsxs("span", { className: "uix-attachment__line", children: [
45
45
  nameNode,
@@ -1,10 +1,17 @@
1
1
  import * as react from 'react';
2
2
  import { ChartProps } from './ChartCore.js';
3
3
  export { ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartMetric, ChartMetricProps, ChartOption, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './ChartCore.js';
4
+ import { GlanceLineChartProps, PairedBarChartProps } from './GlanceCharts.js';
5
+ export { GlanceChartBaseProps } from './GlanceCharts.js';
4
6
  export { ChartTokenSource, UixChartTokens, mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from '../chart-theme.js';
7
+ export { GLANCE_AT_REST, GlanceFormat, GlanceLineInput, GlanceMotion, PAIRED_BARS_MAX_BUCKETS, PairedBarsInput, glanceLineOption, pairedBarsOption, uixGlanceBase } from '../chart-glance.js';
5
8
  import 'echarts';
6
9
 
7
10
  /** Full-compatibility adapter. Use `@tensor_1/react/chart/preset` for the lean preset. */
8
11
  declare function Chart(props: ChartProps): react.JSX.Element;
12
+ /** A glance line (calm kit 2.56): one series in the series blue, labelled at its end, an optional dashed forecast. Put it in a `ChartCard`. */
13
+ declare function GlanceLineChart(props: GlanceLineChartProps): react.JSX.Element;
14
+ /** Paired bars (calm kit 2.56): per bucket the measure in blue beside its grey comparison, up to 12 buckets. Put it in a `ChartCard`. */
15
+ declare function PairedBarChart(props: PairedBarChartProps): react.JSX.Element;
9
16
 
10
- export { Chart, ChartProps };
17
+ export { Chart, ChartProps, GlanceLineChart, GlanceLineChartProps, PairedBarChart, PairedBarChartProps };
@@ -2,20 +2,35 @@
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import * as echarts from "echarts";
4
4
  import { ChartCore } from "./ChartCore.js";
5
+ import { GlanceLineChartCore, PairedBarChartCore } from "./GlanceCharts.js";
5
6
  import { ChartLegend, ChartLegendItem, ChartMetric, DEFAULT_CHART_LABELS, uixChartPalette } from "./ChartCore.js";
6
7
  import { mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from "../chart-theme.js";
8
+ import { GLANCE_AT_REST, PAIRED_BARS_MAX_BUCKETS, glanceLineOption, pairedBarsOption, uixGlanceBase } from "../chart-glance.js";
7
9
  function Chart(props) {
8
10
  return /* @__PURE__ */ jsx(ChartCore, { ...props, engine: echarts });
9
11
  }
12
+ function GlanceLineChart(props) {
13
+ return /* @__PURE__ */ jsx(GlanceLineChartCore, { ...props, engine: echarts });
14
+ }
15
+ function PairedBarChart(props) {
16
+ return /* @__PURE__ */ jsx(PairedBarChartCore, { ...props, engine: echarts });
17
+ }
10
18
  export {
11
19
  Chart,
12
20
  ChartLegend,
13
21
  ChartLegendItem,
14
22
  ChartMetric,
15
23
  DEFAULT_CHART_LABELS,
24
+ GLANCE_AT_REST,
25
+ GlanceLineChart,
26
+ PAIRED_BARS_MAX_BUCKETS,
27
+ PairedBarChart,
28
+ glanceLineOption,
16
29
  mergeChartTheme,
30
+ pairedBarsOption,
17
31
  uixChartAreaGradient,
18
32
  uixChartPalette,
19
33
  uixChartTheme,
20
- uixChartTokens
34
+ uixChartTokens,
35
+ uixGlanceBase
21
36
  };