@cryptiklemur/lattice 1.10.3 → 1.11.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.
@@ -1,7 +1,13 @@
1
- import { useState, useEffect, useRef } from "react";
1
+ import { useState, useEffect, useRef, createContext, useContext } from "react";
2
2
  import { Maximize2, Minimize2 } from "lucide-react";
3
3
  import type { ReactNode } from "react";
4
4
 
5
+ var ChartFullscreenContext = createContext(false);
6
+
7
+ export function useChartFullscreen(): boolean {
8
+ return useContext(ChartFullscreenContext);
9
+ }
10
+
5
11
  interface ChartCardProps {
6
12
  title: string;
7
13
  children: ReactNode;
@@ -145,7 +151,9 @@ export function ChartCard(props: ChartCardProps) {
145
151
  </div>
146
152
  </div>
147
153
  <div className="flex-1 p-6 overflow-auto min-h-0 fullscreen-chart-container">
148
- {props.children}
154
+ <ChartFullscreenContext.Provider value={true}>
155
+ {props.children}
156
+ </ChartFullscreenContext.Provider>
149
157
  </div>
150
158
  </div>
151
159
  </div>
@@ -7,6 +7,7 @@ import {
7
7
  Tooltip,
8
8
  ResponsiveContainer,
9
9
  } from "recharts";
10
+ import { useChartFullscreen } from "../ChartCard";
10
11
 
11
12
  var TICK_STYLE = {
12
13
  fontSize: 10,
@@ -36,12 +37,13 @@ function CustomTooltip({ active, payload, label }: { active?: boolean; payload?:
36
37
  }
37
38
 
38
39
  export function CacheEfficiencyChart({ data }: CacheEfficiencyChartProps) {
40
+ var isFullscreen = useChartFullscreen();
39
41
  var displayData = data.map(function (d) {
40
42
  return { date: d.date, rate: d.rate * 100 };
41
43
  });
42
44
 
43
45
  return (
44
- <ResponsiveContainer width="100%" height={200}>
46
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
45
47
  <AreaChart data={displayData} margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
46
48
  <defs>
47
49
  <linearGradient id="cacheEffGrad" x1="0" y1="0" x2="0" y2="1">
@@ -7,6 +7,7 @@ import {
7
7
  Tooltip,
8
8
  ResponsiveContainer,
9
9
  } from "recharts";
10
+ import { useChartFullscreen } from "../ChartCard";
10
11
 
11
12
  var TICK_STYLE = {
12
13
  fontSize: 10,
@@ -53,6 +54,7 @@ function CustomTooltip({ active, payload }: { active?: boolean; payload?: Array<
53
54
  }
54
55
 
55
56
  export function ContextUtilizationChart({ data }: ContextUtilizationChartProps) {
57
+ var isFullscreen = useChartFullscreen();
56
58
  var sessionMap = new Map<string, { title: string; points: Array<{ messageIndex: number; contextPercent: number }> }>();
57
59
  for (var i = 0; i < data.length; i++) {
58
60
  var d = data[i];
@@ -84,7 +86,7 @@ export function ContextUtilizationChart({ data }: ContextUtilizationChartProps)
84
86
  }
85
87
 
86
88
  return (
87
- <ResponsiveContainer width="100%" height={200}>
89
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
88
90
  <LineChart data={merged} margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
89
91
  <CartesianGrid strokeDasharray="3 3" stroke={GRID_COLOR} vertical={false} />
90
92
  <XAxis dataKey="messageIndex" tick={TICK_STYLE} axisLine={false} tickLine={false} />
@@ -7,6 +7,7 @@ import {
7
7
  Tooltip,
8
8
  ResponsiveContainer,
9
9
  } from "recharts";
10
+ import { useChartFullscreen } from "../ChartCard";
10
11
 
11
12
  var TICK_STYLE = {
12
13
  fontSize: 10,
@@ -48,8 +49,9 @@ function CustomTooltip({ active, payload, label }: { active?: boolean; payload?:
48
49
  }
49
50
 
50
51
  export function CostAreaChart({ data }: CostAreaChartProps) {
52
+ var isFullscreen = useChartFullscreen();
51
53
  return (
52
- <ResponsiveContainer width="100%" height={200}>
54
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
53
55
  <AreaChart data={data} margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
54
56
  <defs>
55
57
  <linearGradient id="opusGrad" x1="0" y1="0" x2="0" y2="1">
@@ -7,6 +7,7 @@ import {
7
7
  Tooltip,
8
8
  ResponsiveContainer,
9
9
  } from "recharts";
10
+ import { useChartFullscreen } from "../ChartCard";
10
11
 
11
12
  var TICK_STYLE = {
12
13
  fontSize: 10,
@@ -36,8 +37,9 @@ function CustomTooltip({ active, payload, label }: { active?: boolean; payload?:
36
37
  }
37
38
 
38
39
  export function CostDistributionChart({ data }: CostDistributionChartProps) {
40
+ var isFullscreen = useChartFullscreen();
39
41
  return (
40
- <ResponsiveContainer width="100%" height={200}>
42
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
41
43
  <AreaChart data={data} margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
42
44
  <defs>
43
45
  <linearGradient id="distGrad" x1="0" y1="0" x2="0" y2="1">
@@ -1,4 +1,5 @@
1
1
  import { PieChart, Pie, Cell, Tooltip, ResponsiveContainer } from "recharts";
2
+ import { useChartFullscreen } from "../ChartCard";
2
3
 
3
4
  var MODEL_COLORS: Record<string, string> = {
4
5
  opus: "#a855f7",
@@ -52,9 +53,10 @@ function CenterLabel({ totalCost }: { totalCost: number }) {
52
53
  }
53
54
 
54
55
  export function CostDonutChart({ modelUsage, totalCost }: CostDonutChartProps) {
56
+ var isFullscreen = useChartFullscreen();
55
57
  return (
56
58
  <div>
57
- <ResponsiveContainer width="100%" height={200}>
59
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
58
60
  <PieChart>
59
61
  <Pie
60
62
  data={modelUsage}
@@ -7,6 +7,7 @@ import {
7
7
  Tooltip,
8
8
  ResponsiveContainer,
9
9
  } from "recharts";
10
+ import { useChartFullscreen } from "../ChartCard";
10
11
 
11
12
  var TICK_STYLE = {
12
13
  fontSize: 10,
@@ -36,8 +37,9 @@ function CustomTooltip({ active, payload, label }: { active?: boolean; payload?:
36
37
  }
37
38
 
38
39
  export function CumulativeCostChart({ data }: CumulativeCostChartProps) {
40
+ var isFullscreen = useChartFullscreen();
39
41
  return (
40
- <ResponsiveContainer width="100%" height={200}>
42
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
41
43
  <AreaChart data={data} margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
42
44
  <defs>
43
45
  <linearGradient id="cumulativeGrad" x1="0" y1="0" x2="0" y2="1">
@@ -7,6 +7,7 @@ import {
7
7
  Tooltip,
8
8
  ResponsiveContainer,
9
9
  } from "recharts";
10
+ import { useChartFullscreen } from "../ChartCard";
10
11
 
11
12
  var TICK_STYLE = {
12
13
  fontSize: 10,
@@ -49,6 +50,7 @@ function CustomTooltip({ active, payload }: { active?: boolean; payload?: Array<
49
50
  }
50
51
 
51
52
  export function ResponseTimeScatter({ data }: ResponseTimeScatterProps) {
53
+ var isFullscreen = useChartFullscreen();
52
54
  var models = Array.from(new Set(data.map(function (d) { return d.model; })));
53
55
 
54
56
  var byModel = models.map(function (model) {
@@ -62,7 +64,7 @@ export function ResponseTimeScatter({ data }: ResponseTimeScatterProps) {
62
64
  });
63
65
 
64
66
  return (
65
- <ResponsiveContainer width="100%" height={200}>
67
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
66
68
  <ScatterChart margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
67
69
  <CartesianGrid strokeDasharray="3 3" stroke={GRID_COLOR} />
68
70
  <XAxis
@@ -8,6 +8,7 @@ import {
8
8
  ResponsiveContainer,
9
9
  ZAxis,
10
10
  } from "recharts";
11
+ import { useChartFullscreen } from "../ChartCard";
11
12
 
12
13
  var TICK_STYLE = {
13
14
  fontSize: 10,
@@ -62,6 +63,7 @@ function CustomTooltip({ active, payload }: { active?: boolean; payload?: Array<
62
63
  }
63
64
 
64
65
  export function SessionBubbleChart({ data }: SessionBubbleChartProps) {
66
+ var isFullscreen = useChartFullscreen();
65
67
  var projects = Array.from(new Set(data.map(function (d) { return d.project; })));
66
68
 
67
69
  function getColor(project: string): string {
@@ -83,7 +85,7 @@ export function SessionBubbleChart({ data }: SessionBubbleChartProps) {
83
85
  var maxTs = Math.max(...data.map(function (d) { return d.timestamp; }));
84
86
 
85
87
  return (
86
- <ResponsiveContainer width="100%" height={200}>
88
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
87
89
  <ScatterChart margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
88
90
  <CartesianGrid strokeDasharray="3 3" stroke={GRID_COLOR} />
89
91
  <XAxis
@@ -7,6 +7,7 @@ import {
7
7
  Tooltip,
8
8
  ResponsiveContainer,
9
9
  } from "recharts";
10
+ import { useChartFullscreen } from "../ChartCard";
10
11
 
11
12
  var TICK_STYLE = {
12
13
  fontSize: 10,
@@ -52,8 +53,9 @@ function formatTokens(v: number): string {
52
53
  }
53
54
 
54
55
  export function TokenFlowChart({ data }: TokenFlowChartProps) {
56
+ var isFullscreen = useChartFullscreen();
55
57
  return (
56
- <ResponsiveContainer width="100%" height={200}>
58
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 200}>
57
59
  <AreaChart data={data} margin={{ top: 4, right: 4, left: -20, bottom: 0 }}>
58
60
  <defs>
59
61
  <linearGradient id="inputGrad" x1="0" y1="0" x2="0" y2="1">
@@ -1,4 +1,5 @@
1
1
  import { Sankey, Tooltip, ResponsiveContainer } from "recharts";
2
+ import { useChartFullscreen } from "../ChartCard";
2
3
 
3
4
  var NODE_COLORS: Record<string, string> = {
4
5
  "Input Tokens": "oklch(55% 0.25 280)",
@@ -64,6 +65,7 @@ function SankeyNode({ x, y, width, height, index, payload }: { x: number; y: num
64
65
  }
65
66
 
66
67
  export function TokenSankeyChart({ data }: TokenSankeyChartProps) {
68
+ var isFullscreen = useChartFullscreen();
67
69
  if (!data.links || data.links.length === 0) {
68
70
  return (
69
71
  <div className="flex items-center justify-center h-[250px] text-base-content/30 font-mono text-[12px]">
@@ -73,7 +75,7 @@ export function TokenSankeyChart({ data }: TokenSankeyChartProps) {
73
75
  }
74
76
 
75
77
  return (
76
- <ResponsiveContainer width="100%" height={250}>
78
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 250}>
77
79
  <Sankey
78
80
  data={data}
79
81
  node={<SankeyNode x={0} y={0} width={0} height={0} index={0} payload={{ name: "" }} />}
@@ -1,4 +1,5 @@
1
1
  import { Treemap, ResponsiveContainer, Tooltip } from "recharts";
2
+ import { useChartFullscreen } from "../ChartCard";
2
3
 
3
4
  interface ToolTreemapProps {
4
5
  data: Array<{ name: string; count: number; avgCost: number }>;
@@ -76,6 +77,7 @@ function CustomTooltip({ active, payload }: { active?: boolean; payload?: Array<
76
77
  }
77
78
 
78
79
  export function ToolTreemap({ data }: ToolTreemapProps) {
80
+ var isFullscreen = useChartFullscreen();
79
81
  if (!data || data.length === 0) {
80
82
  return (
81
83
  <div className="flex items-center justify-center h-[250px] text-base-content/25 font-mono text-[11px]">
@@ -94,7 +96,7 @@ export function ToolTreemap({ data }: ToolTreemapProps) {
94
96
  });
95
97
 
96
98
  return (
97
- <ResponsiveContainer width="100%" height={250}>
99
+ <ResponsiveContainer width="100%" height={isFullscreen ? "100%" : 250}>
98
100
  <Treemap
99
101
  data={treemapData}
100
102
  dataKey="size"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptiklemur/lattice",
3
- "version": "1.10.3",
3
+ "version": "1.11.0",
4
4
  "description": "Multi-machine agentic dashboard for Claude Code. Monitor sessions, manage MCP servers and skills, orchestrate across mesh-networked nodes.",
5
5
  "license": "MIT",
6
6
  "author": "Aaron Scherer <me@aaronscherer.me>",