glacia-native 0.3.3 → 0.3.4

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 (67) hide show
  1. package/lib/module/Dialog.js +128 -0
  2. package/lib/module/Form.js +125 -0
  3. package/lib/module/Input.js +64 -0
  4. package/lib/module/Table.js +81 -0
  5. package/lib/module/ai.js +246 -0
  6. package/lib/module/charts/AreaChart.js +32 -0
  7. package/lib/module/charts/BarChart.js +65 -0
  8. package/lib/module/charts/FunnelChart.js +48 -0
  9. package/lib/module/charts/HeatmapChart.js +69 -0
  10. package/lib/module/charts/LineChart.js +79 -0
  11. package/lib/module/charts/PlotChart.js +44 -0
  12. package/lib/module/charts/RadarChart.js +76 -0
  13. package/lib/module/charts/RingChart.js +50 -0
  14. package/lib/module/charts/ScatterChart.js +78 -0
  15. package/lib/module/charts/WaterfallChart.js +76 -0
  16. package/lib/module/charts/advanced.js +307 -0
  17. package/lib/module/charts/extra.js +105 -0
  18. package/lib/module/charts/index.js +50 -0
  19. package/lib/module/charts/primitives.js +212 -0
  20. package/lib/module/charts/scales.js +140 -0
  21. package/lib/module/index.js +48 -1
  22. package/lib/module/internal/tokens.js +3 -0
  23. package/lib/typescript/Dialog.d.ts +71 -0
  24. package/lib/typescript/Form.d.ts +81 -0
  25. package/lib/typescript/Input.d.ts +47 -0
  26. package/lib/typescript/Table.d.ts +55 -0
  27. package/lib/typescript/ai.d.ts +163 -0
  28. package/lib/typescript/charts/AreaChart.d.ts +44 -0
  29. package/lib/typescript/charts/BarChart.d.ts +19 -0
  30. package/lib/typescript/charts/FunnelChart.d.ts +25 -0
  31. package/lib/typescript/charts/HeatmapChart.d.ts +23 -0
  32. package/lib/typescript/charts/LineChart.d.ts +30 -0
  33. package/lib/typescript/charts/PlotChart.d.ts +31 -0
  34. package/lib/typescript/charts/RadarChart.d.ts +27 -0
  35. package/lib/typescript/charts/RingChart.d.ts +28 -0
  36. package/lib/typescript/charts/ScatterChart.d.ts +34 -0
  37. package/lib/typescript/charts/WaterfallChart.d.ts +22 -0
  38. package/lib/typescript/charts/advanced.d.ts +107 -0
  39. package/lib/typescript/charts/extra.d.ts +63 -0
  40. package/lib/typescript/charts/index.d.ts +13 -0
  41. package/lib/typescript/charts/primitives.d.ts +23 -0
  42. package/lib/typescript/charts/scales.d.ts +35 -0
  43. package/lib/typescript/index.d.ts +6 -0
  44. package/lib/typescript/internal/tokens.d.ts +2 -0
  45. package/package.json +10 -3
  46. package/src/Dialog.tsx +345 -0
  47. package/src/Form.tsx +360 -0
  48. package/src/Input.tsx +172 -0
  49. package/src/Table.tsx +207 -0
  50. package/src/ai.tsx +655 -0
  51. package/src/charts/AreaChart.tsx +73 -0
  52. package/src/charts/BarChart.tsx +181 -0
  53. package/src/charts/FunnelChart.tsx +123 -0
  54. package/src/charts/HeatmapChart.tsx +153 -0
  55. package/src/charts/LineChart.tsx +245 -0
  56. package/src/charts/PlotChart.tsx +148 -0
  57. package/src/charts/RadarChart.tsx +206 -0
  58. package/src/charts/RingChart.tsx +131 -0
  59. package/src/charts/ScatterChart.tsx +202 -0
  60. package/src/charts/WaterfallChart.tsx +183 -0
  61. package/src/charts/advanced.tsx +670 -0
  62. package/src/charts/extra.tsx +239 -0
  63. package/src/charts/index.ts +86 -0
  64. package/src/charts/primitives.ts +262 -0
  65. package/src/charts/scales.ts +163 -0
  66. package/src/index.ts +68 -0
  67. package/src/internal/tokens.ts +3 -0
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativePlan = NativePlan;
4
+ exports.NativeSources = NativeSources;
5
+ exports.NativeResponse = NativeResponse;
6
+ exports.NativeTask = NativeTask;
7
+ exports.NativeSoundwave = NativeSoundwave;
8
+ exports.NativeThinkingOrb = NativeThinkingOrb;
9
+ exports.NativePanelside = NativePanelside;
10
+ exports.NativeAIInput = NativeAIInput;
11
+ exports.NativeImageGeneration = NativeImageGeneration;
12
+ const jsx_runtime_1 = require("react/jsx-runtime");
13
+ const react_1 = require("react");
14
+ const tokens_1 = require("./internal/tokens");
15
+ const primitives_1 = require("./charts/primitives");
16
+ /**
17
+ * The ordered steps a model intends to take.
18
+ *
19
+ * Each step carries its own status, so a half-finished plan is legible instead
20
+ * of appearing blank until the whole thing completes.
21
+ */
22
+ function NativePlan({ title = "Plan", steps, isDark = false, style }) {
23
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
24
+ const { View, Text } = (0, primitives_1.primitives)();
25
+ const done = steps.filter((step) => step.status === "done").length;
26
+ const markerColor = (status) => status === "done"
27
+ ? "#34c759"
28
+ : status === "failed"
29
+ ? theme.destructive
30
+ : status === "running"
31
+ ? theme.fill
32
+ : theme.muted;
33
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(View, { style: {
34
+ flexDirection: "row",
35
+ justifyContent: "space-between",
36
+ alignItems: "center",
37
+ marginBottom: 8,
38
+ }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 13, fontWeight: "600", color: theme.foreground }, children: title }), (0, jsx_runtime_1.jsxs)(Text, { style: { fontSize: 11, color: theme.muted }, children: [done, "/", steps.length] })] }), steps.map((step) => ((0, jsx_runtime_1.jsxs)(View, { accessibilityRole: "text", accessibilityLabel: `${step.title}: ${step.status}`, style: { flexDirection: "row", alignItems: "flex-start", gap: 9, marginBottom: 8 }, children: [(0, jsx_runtime_1.jsx)(View, { style: {
39
+ width: 16,
40
+ height: 16,
41
+ borderRadius: 8,
42
+ borderWidth: step.status === "pending" ? 1.5 : 0,
43
+ borderColor: theme.edge,
44
+ backgroundColor: step.status === "pending" ? "transparent" : markerColor(step.status),
45
+ alignItems: "center",
46
+ justifyContent: "center",
47
+ marginTop: 1,
48
+ }, children: step.status !== "pending" && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 9, color: "#fff", fontWeight: "700" }, children: step.status === "done" ? "✓" : step.status === "failed" ? "!" : "•" })) }), (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: {
49
+ fontSize: 13,
50
+ color: step.status === "pending" ? theme.muted : theme.foreground,
51
+ }, children: step.title }), step.detail && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted, marginTop: 2 }, children: step.detail }))] })] }, step.id)))] }));
52
+ }
53
+ /**
54
+ * Citations behind an answer, so a claim can be traced to its origin.
55
+ *
56
+ * Native has no anchor element, so a row hands the source to the caller's
57
+ * `onSourcePress` instead of opening a browser the component cannot control.
58
+ */
59
+ function NativeSources({ sources, title = "Sources", isDark = false, style, onSourcePress, }) {
60
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
61
+ const { View, Text, Pressable } = (0, primitives_1.primitives)();
62
+ if (sources.length === 0)
63
+ return null;
64
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }, children: title }), sources.map((source, index) => ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "link", accessibilityLabel: source.title, onPress: () => onSourcePress?.(source), style: {
65
+ flexDirection: "row",
66
+ gap: 9,
67
+ paddingVertical: 7,
68
+ paddingHorizontal: 10,
69
+ borderRadius: tokens_1.radii.md,
70
+ borderWidth: 1,
71
+ borderColor: theme.edge,
72
+ marginBottom: 6,
73
+ }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: theme.muted, marginTop: 1 }, children: index + 1 }), (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: theme.foreground, fontWeight: "500" }, children: source.title }), source.snippet && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted, marginTop: 2 }, children: source.snippet })), source.domain && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: theme.muted, marginTop: 3 }, children: source.domain }))] })] }, source.id)))] }));
74
+ }
75
+ /**
76
+ * Text revealed progressively as a streamed answer arrives.
77
+ *
78
+ * The caller owns the streaming clock (usually a network stream); this only
79
+ * renders the first `revealed` characters and shows a caret while incomplete.
80
+ */
81
+ function NativeResponse({ text, revealed, streaming, isDark = false, style, }) {
82
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
83
+ const { View, Text } = (0, primitives_1.primitives)();
84
+ const shown = revealed == null ? text : text.slice(0, Math.max(0, revealed));
85
+ const isStreaming = streaming ?? (revealed != null && revealed < text.length);
86
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(Text, { accessibilityRole: "text", accessibilityLabel: shown, style: { fontSize: 14, lineHeight: 21, color: theme.foreground }, children: [shown, isStreaming ? "▍" : ""] }), (0, jsx_runtime_1.jsx)(Text, { accessibilityRole: "alert", style: { height: 0, opacity: 0, fontSize: 0 }, children: isStreaming ? "Response streaming" : "Response complete" })] }));
87
+ }
88
+ /** Progress of a long-running background task. */
89
+ function NativeTask({ task, isDark = false, style }) {
90
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
91
+ const { View, Text } = (0, primitives_1.primitives)();
92
+ const percent = task.progress == null ? null : Math.round(Math.min(1, Math.max(0, task.progress)) * 100);
93
+ const status = task.status ?? "running";
94
+ const fillColor = status === "failed" ? theme.destructive : status === "done" ? "#34c759" : theme.fill;
95
+ return ((0, jsx_runtime_1.jsxs)(View, { accessibilityRole: "progressbar", accessibilityLabel: task.label ?? "Task progress", accessibilityState: {
96
+ disabled: false,
97
+ }, style: style, children: [(0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", justifyContent: "space-between", marginBottom: 6 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, fontWeight: "500", color: theme.foreground }, children: task.label ?? "Task" }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted }, children: percent == null ? "…" : `${percent}%` })] }), (0, jsx_runtime_1.jsx)(View, { style: {
98
+ height: 6,
99
+ borderRadius: 3,
100
+ backgroundColor: isDark ? "rgba(235,235,245,0.15)" : "rgba(0,0,0,0.08)",
101
+ overflow: "hidden",
102
+ }, children: (0, jsx_runtime_1.jsx)(View, { style: {
103
+ // An indeterminate task fills partially rather than pretending 0%.
104
+ width: percent == null ? "35%" : `${percent}%`,
105
+ height: "100%",
106
+ borderRadius: 3,
107
+ backgroundColor: fillColor,
108
+ opacity: percent == null ? 0.6 : 1,
109
+ } }) }), task.detail && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted, marginTop: 6 }, children: task.detail }))] }));
110
+ }
111
+ /**
112
+ * A waveform driven by real amplitude.
113
+ *
114
+ * Bars follow `levels` when supplied, so it can show live microphone input.
115
+ * Without levels it rests at a low, static profile instead of animating:
116
+ * continuous motion with no audio behind it would be decorative noise.
117
+ */
118
+ function NativeSoundwave({ levels, bars = 28, active = true, height = 40, color, isDark = false, style, label = "Audio level", }) {
119
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
120
+ const { View } = (0, primitives_1.primitives)();
121
+ const count = levels?.length || bars;
122
+ const tint = color ?? theme.foreground;
123
+ return ((0, jsx_runtime_1.jsx)(View, { accessibilityRole: "image", accessibilityLabel: label, style: { flexDirection: "row", alignItems: "center", gap: 2, height, ...style }, children: Array.from({ length: count }, (_, i) => {
124
+ const level = levels ? levels[i] ?? 0 : 0;
125
+ // Idle bars taper at the edges so the shape still reads as a wave.
126
+ const idle = 0.12 + Math.sin((i / count) * Math.PI) * 0.1;
127
+ const scale = Math.max(0.06, Math.min(1, active && levels ? level : idle));
128
+ return ((0, jsx_runtime_1.jsx)(View, { style: {
129
+ width: 3,
130
+ height: height * scale,
131
+ borderRadius: 2,
132
+ backgroundColor: tint,
133
+ opacity: active ? 0.85 : 0.35,
134
+ } }, i));
135
+ }) }));
136
+ }
137
+ /**
138
+ * A pulsing indicator shown while a model is working.
139
+ *
140
+ * Purely decorative, so it is hidden from screen readers and the label is
141
+ * exposed as text instead of relying on the motion being perceived.
142
+ */
143
+ function NativeThinkingOrb({ label = "Thinking", size = 22, paused = false, isDark = false, style, }) {
144
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
145
+ const { View, Text } = (0, primitives_1.primitives)();
146
+ const [tick, setTick] = (0, react_1.useState)(0);
147
+ (0, react_1.useEffect)(() => {
148
+ if (paused)
149
+ return;
150
+ const timer = setInterval(() => setTick((value) => value + 1), 700);
151
+ return () => clearInterval(timer);
152
+ }, [paused]);
153
+ const scale = paused ? 1 : [1, 1.12, 1][tick % 3];
154
+ return ((0, jsx_runtime_1.jsxs)(View, { accessibilityRole: "text", accessibilityLabel: label, style: { flexDirection: "row", alignItems: "center", gap: 8, ...style }, children: [(0, jsx_runtime_1.jsx)(View, { style: {
155
+ width: size,
156
+ height: size,
157
+ borderRadius: size / 2,
158
+ backgroundColor: theme.fill,
159
+ opacity: paused ? 0.5 : 0.85,
160
+ transform: [{ scale }],
161
+ } }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: theme.muted }, children: label })] }));
162
+ }
163
+ /**
164
+ * A rail for an AI workspace: conversations, saved prompts or tasks.
165
+ *
166
+ * Selection is a press rather than navigation because the panel's content is
167
+ * client state; the caller decides what a selection means.
168
+ */
169
+ function NativePanelside({ items, value, onValueChange, isDark = false, style, title, }) {
170
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
171
+ const { View, Text, Pressable } = (0, primitives_1.primitives)();
172
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [title && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }, children: title })), items.map((item) => {
173
+ const isActive = item.id === value;
174
+ return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "button", accessibilityState: { selected: isActive }, accessibilityLabel: item.label, onPress: () => onValueChange?.(item.id), style: {
175
+ flexDirection: "row",
176
+ alignItems: "center",
177
+ justifyContent: "space-between",
178
+ paddingVertical: 9,
179
+ paddingHorizontal: 11,
180
+ borderRadius: tokens_1.radii.md,
181
+ backgroundColor: isActive ? theme.glassActive : "transparent",
182
+ marginBottom: 2,
183
+ }, children: [(0, jsx_runtime_1.jsx)(Text, { style: {
184
+ fontSize: 13,
185
+ color: isActive ? theme.foreground : theme.muted,
186
+ fontWeight: isActive ? "600" : "400",
187
+ }, children: item.label }), item.count != null && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: theme.muted }, children: item.count }))] }, item.id));
188
+ })] }));
189
+ }
190
+ /**
191
+ * The composer for an AI conversation.
192
+ *
193
+ * Send stays disabled until there is non-whitespace to send, which is the rule
194
+ * that prevents empty submissions rather than a validation message afterwards.
195
+ */
196
+ function NativeAIInput({ value = "", onChangeText, onSubmit, placeholder = "Ask anything", disabled = false, busy = false, sendLabel = "Send", isDark = false, style, footer, }) {
197
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
198
+ const { View, Text, TextInput, Pressable } = (0, primitives_1.primitives)();
199
+ const canSend = !disabled && !busy && value.trim().length > 0;
200
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(View, { style: {
201
+ flexDirection: "row",
202
+ alignItems: "flex-end",
203
+ gap: 8,
204
+ padding: 8,
205
+ borderRadius: tokens_1.radii.lg,
206
+ borderWidth: 1,
207
+ borderColor: theme.edge,
208
+ backgroundColor: theme.glass,
209
+ opacity: disabled ? 0.5 : 1,
210
+ }, children: [(0, jsx_runtime_1.jsx)(TextInput, { value: value, onChangeText: onChangeText, placeholder: placeholder, editable: !disabled, multiline: true, numberOfLines: 3, accessibilityLabel: placeholder, style: {
211
+ flex: 1,
212
+ minHeight: 34,
213
+ maxHeight: 120,
214
+ paddingHorizontal: 6,
215
+ paddingVertical: 7,
216
+ fontSize: 14,
217
+ color: theme.foreground,
218
+ } }), (0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: sendLabel, accessibilityState: { disabled: !canSend }, disabled: !canSend, onPress: () => canSend && onSubmit?.(), style: {
219
+ paddingVertical: 8,
220
+ paddingHorizontal: 14,
221
+ borderRadius: tokens_1.radii.pill,
222
+ backgroundColor: canSend ? theme.fill : theme.edge,
223
+ }, children: (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 13, fontWeight: "600", color: canSend ? "#fff" : theme.muted }, children: busy ? "…" : sendLabel }) })] }), footer] }));
224
+ }
225
+ /**
226
+ * A generated image with its prompt and state.
227
+ *
228
+ * While generating, a placeholder with the same aspect ratio holds the space so
229
+ * the layout does not jump when the image arrives.
230
+ */
231
+ function NativeImageGeneration({ image, prompt, status = "queued", isDark = false, style, }) {
232
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
233
+ const { View, Text, Image } = (0, primitives_1.primitives)();
234
+ const width = image?.width ?? 320;
235
+ const height = image?.height ?? 200;
236
+ const showImage = image && status === "done";
237
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsx)(View, { style: {
238
+ width: "100%",
239
+ aspectRatio: width / height,
240
+ borderRadius: tokens_1.radii.md,
241
+ overflow: "hidden",
242
+ backgroundColor: isDark ? "rgba(235,235,245,0.08)" : "rgba(0,0,0,0.05)",
243
+ alignItems: "center",
244
+ justifyContent: "center",
245
+ }, children: showImage ? ((0, jsx_runtime_1.jsx)(Image, { source: { uri: image.url }, accessibilityLabel: image.alt, style: { width: "100%", height: "100%" } })) : ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: theme.muted }, children: status === "failed" ? "Generation failed" : "Generating…" })) }), prompt && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted, marginTop: 6 }, children: prompt }))] }));
246
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeAreaChart = NativeAreaChart;
4
+ exports.NativeMirrorAreaChart = NativeMirrorAreaChart;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const LineChart_1 = require("./LineChart");
7
+ /**
8
+ * A continuous series with its area filled.
9
+ *
10
+ * This is NativeLineChart drawing filled: the same scales, axis ticks and
11
+ * touch targets, so the two stay consistent when used side by side.
12
+ */
13
+ function NativeAreaChart(props) {
14
+ return (0, jsx_runtime_1.jsx)(LineChart_1.NativeLineChart, { ...props, area: true });
15
+ }
16
+ /**
17
+ * Two series mirrored across a shared centre line.
18
+ *
19
+ * The below series is negated and drawn on the same axis as the above series,
20
+ * so both directions are measured against one honest scale rather than two
21
+ * charts that could be scaled differently.
22
+ */
23
+ function NativeMirrorAreaChart({ labels, series, aboveColor = "#0088ff", belowColor = "#ff375f", ...rest }) {
24
+ return ((0, jsx_runtime_1.jsx)(LineChart_1.NativeLineChart, { ...rest, labels: labels, area: true, series: [
25
+ { name: `${series.name} (above)`, values: series.above, color: aboveColor },
26
+ {
27
+ name: `${series.name} (below)`,
28
+ values: series.below.map((v) => -Math.abs(v)),
29
+ color: belowColor,
30
+ },
31
+ ] }));
32
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeBarChart = NativeBarChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const tokens_1 = require("../internal/tokens");
7
+ const primitives_1 = require("./primitives");
8
+ const scales_1 = require("./scales");
9
+ const PADDING = { top: 12, right: 10, bottom: 24, left: 38 };
10
+ /** Grouped or stacked bars, drawn with react-native-svg. */
11
+ function NativeBarChart({ labels, series, width = 320, height = 200, stacked = false, radius = 4, isDark = false, palette, style, onBarPress, }) {
12
+ const [active, setActive] = (0, react_1.useState)(null);
13
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
14
+ const { View, Text, Pressable, Svg, G, Line, Rect, SvgText } = (0, primitives_1.primitives)();
15
+ const plot = {
16
+ x: PADDING.left,
17
+ y: PADDING.top,
18
+ width: Math.max(0, width - PADDING.left - PADDING.right),
19
+ height: Math.max(0, height - PADDING.top - PADDING.bottom),
20
+ };
21
+ const bottom = plot.y + plot.height;
22
+ const right = plot.x + plot.width;
23
+ const totals = stacked
24
+ ? labels.map((_, i) => series.reduce((sum, s) => sum + (s.values[i] ?? 0), 0))
25
+ : series.flatMap((s) => s.values);
26
+ const domain = (0, react_1.useMemo)(() => {
27
+ const max = totals.length ? Math.max(...totals) : 1;
28
+ return (0, scales_1.niceDomain)(0, max, 4);
29
+ }, [totals.join(",")]);
30
+ const y = (0, scales_1.linearScale)(domain, [bottom, plot.y], { nice: false });
31
+ const bands = (0, scales_1.bandScale)(labels.length, [plot.x, right], 0.32);
32
+ const barWidth = stacked ? bands.width : bands.width / Math.max(1, series.length);
33
+ const yTicks = (0, scales_1.ticks)(domain, 4);
34
+ if (labels.length === 0 || series.length === 0) {
35
+ return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, height, alignItems: "center", justifyContent: "center" }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No bars to display" }) }));
36
+ }
37
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(Svg, { width: width, height: height, children: [yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(Line, { x1: plot.x, x2: right, y1: y(tick), y2: y(tick), stroke: theme.axis, strokeOpacity: 0.24, strokeWidth: 1 }, `grid-${i}`))), labels.map((label, i) => {
38
+ let stackTop = bottom;
39
+ return ((0, jsx_runtime_1.jsx)(G, { children: series.map((s, si) => {
40
+ const value = s.values[i] ?? 0;
41
+ const color = s.color ?? (0, scales_1.seriesColor)(si, palette);
42
+ const barHeight = Math.max(0, bottom - y(value));
43
+ const barX = stacked
44
+ ? bands.start(i)
45
+ : bands.start(i) + si * barWidth + (si > 0 ? 1 : 0);
46
+ const barY = stacked ? stackTop - barHeight : y(value);
47
+ const w = stacked ? bands.width : Math.max(1, barWidth - (si > 0 ? 1 : 0));
48
+ if (stacked)
49
+ stackTop -= barHeight;
50
+ return ((0, jsx_runtime_1.jsx)(Rect, { x: barX, y: barY, width: w, height: barHeight, rx: Math.min(radius, w / 2), fill: color, opacity: active === null || active === i ? 1 : 0.45 }, s.name));
51
+ }) }, label + i));
52
+ }), yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(SvgText, { x: plot.x - 6, y: y(tick) + 3, fill: theme.muted, fontSize: 9, textAnchor: "end", children: (0, scales_1.formatValue)(tick, { compact: true }) }, `y-${i}`))), labels.map((label, i) => ((0, jsx_runtime_1.jsx)(SvgText, { x: bands.center(i), y: height - 8, fill: theme.muted, fontSize: 9, textAnchor: "middle", children: label }, `x-${i}`)))] }), (0, jsx_runtime_1.jsx)(View, { style: {
53
+ position: "absolute",
54
+ left: plot.x,
55
+ top: plot.y,
56
+ width: plot.width,
57
+ height: plot.height,
58
+ flexDirection: "row",
59
+ }, children: labels.map((label, i) => ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${label}: ${series
60
+ .map((s) => `${s.name} ${(0, scales_1.formatValue)(s.values[i] ?? 0)}`)
61
+ .join(", ")}`, style: { flex: 1 }, onPress: () => {
62
+ setActive((current) => (current === i ? null : i));
63
+ onBarPress?.(i);
64
+ } }, label + i))) })] }));
65
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeFunnelChart = NativeFunnelChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const tokens_1 = require("../internal/tokens");
7
+ const primitives_1 = require("./primitives");
8
+ const scales_1 = require("./scales");
9
+ /**
10
+ * A sequence of stages where each narrows the one before it.
11
+ *
12
+ * Built from plain Views rather than SVG: a funnel is a set of proportional
13
+ * rectangles, so vector drawing would add a dependency for nothing. Each row
14
+ * shows its own value, its share of entry, and the step conversion — the three
15
+ * numbers a funnel is actually read for.
16
+ */
17
+ function NativeFunnelChart({ stages, width = 320, stageHeight = 38, baseline, isDark = false, palette, style, onStagePress, }) {
18
+ const [active, setActive] = (0, react_1.useState)(null);
19
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
20
+ const { View, Text, Pressable } = (0, primitives_1.primitives)();
21
+ if (stages.length === 0) {
22
+ return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No stages to display" }) }));
23
+ }
24
+ const entry = baseline ?? stages[0]?.value ?? 1;
25
+ const widest = Math.max(entry, ...stages.map((s) => s.value)) || 1;
26
+ return ((0, jsx_runtime_1.jsx)(View, { style: [{ width }, style], children: stages.map((stage, i) => {
27
+ const previous = i === 0 ? null : stages[i - 1].value;
28
+ const stepRate = previous && previous > 0 ? stage.value / previous : null;
29
+ const share = entry > 0 ? stage.value / entry : 0;
30
+ const color = stage.color ?? (0, scales_1.seriesColor)(i, palette);
31
+ const widthPercent = Math.max(0.02, stage.value / widest);
32
+ return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${stage.label}: ${(0, scales_1.formatValue)(stage.value)}, ${Math.round(share * 100)} percent of entry`, onPress: () => {
33
+ setActive((current) => (current === i ? null : i));
34
+ onStagePress?.(i);
35
+ }, style: { marginBottom: i < stages.length - 1 ? 10 : 0 }, children: [(0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", justifyContent: "space-between", marginBottom: 4 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { color: theme.foreground, fontSize: 12, fontWeight: "500" }, children: stage.label }), (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: (0, scales_1.formatValue)(stage.value, { compact: true }) })] }), (0, jsx_runtime_1.jsx)(View, { style: {
36
+ height: stageHeight,
37
+ borderRadius: 10,
38
+ backgroundColor: isDark ? "rgba(235,235,245,0.08)" : "rgba(0,0,0,0.05)",
39
+ overflow: "hidden",
40
+ }, children: (0, jsx_runtime_1.jsx)(View, { style: {
41
+ width: `${widthPercent * 100}%`,
42
+ height: "100%",
43
+ borderRadius: 10,
44
+ backgroundColor: color,
45
+ opacity: active === null || active === i ? 1 : 0.5,
46
+ } }) }), (0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", gap: 10, marginTop: 3 }, children: [(0, jsx_runtime_1.jsxs)(Text, { style: { color: theme.muted, fontSize: 10 }, children: [Math.round(share * 100), "% of entry"] }), stepRate !== null && ((0, jsx_runtime_1.jsxs)(Text, { style: { color: theme.muted, fontSize: 10 }, children: [Math.round(stepRate * 100), "% from previous"] }))] })] }, stage.label));
47
+ }) }));
48
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeHeatmapChart = NativeHeatmapChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const tokens_1 = require("../internal/tokens");
7
+ const primitives_1 = require("./primitives");
8
+ const scales_1 = require("./scales");
9
+ /** Parses "#rrggbb" into channels; anything else falls back to grey. */
10
+ function parseHex(hex) {
11
+ const match = /^#?([0-9a-f]{6})$/i.exec(hex);
12
+ if (!match)
13
+ return [128, 128, 128];
14
+ const int = parseInt(match[1], 16);
15
+ return [(int >> 16) & 255, (int >> 8) & 255, int & 255];
16
+ }
17
+ /** Linear blend between two hex colours, so a ramp needs no colour library. */
18
+ function mix(from, to, t) {
19
+ const a = parseHex(from);
20
+ const b = parseHex(to);
21
+ const clamped = Math.max(0, Math.min(1, t));
22
+ const channels = a.map((channel, i) => Math.round(channel + (b[i] - channel) * clamped));
23
+ return `rgb(${channels[0]}, ${channels[1]}, ${channels[2]})`;
24
+ }
25
+ /**
26
+ * A grid where colour encodes magnitude.
27
+ *
28
+ * Cells are Views rather than SVG rects: the grid is uniform, so native layout
29
+ * positions it exactly and text stays crisp without vector text.
30
+ */
31
+ function NativeHeatmapChart({ rows, columns, cellSize = 28, cellGap = 3, isDark = false, minColor = "#e8eef7", maxColor = "#0088ff", style, onCellPress, }) {
32
+ const [active, setActive] = (0, react_1.useState)(null);
33
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
34
+ const { View, Text, Pressable } = (0, primitives_1.primitives)();
35
+ if (rows.length === 0 || columns.length === 0) {
36
+ return ((0, jsx_runtime_1.jsx)(View, { style: [{ alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No cells to display" }) }));
37
+ }
38
+ const all = rows.flatMap((row) => row.values).filter(Number.isFinite);
39
+ const min = all.length ? Math.min(...all) : 0;
40
+ const max = all.length ? Math.max(...all) : 1;
41
+ const span = max - min;
42
+ // A flat grid would otherwise tint every cell the same; centre it instead.
43
+ const position = (value) => (span === 0 ? 0.5 : (value - min) / span);
44
+ const labelWidth = 54;
45
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsx)(View, { style: { flexDirection: "row", marginLeft: labelWidth }, children: columns.map((column) => ((0, jsx_runtime_1.jsx)(View, { style: { width: cellSize + cellGap, alignItems: "center" }, children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 9 }, numberOfLines: 1, children: column }) }, column))) }), rows.map((row, r) => ((0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", alignItems: "center", marginTop: cellGap }, children: [(0, jsx_runtime_1.jsx)(View, { style: { width: labelWidth }, children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.foreground, fontSize: 10 }, numberOfLines: 1, children: row.label }) }), columns.map((column, c) => {
46
+ const value = row.values[c];
47
+ const isActive = active?.r === r && active?.c === c;
48
+ const tint = value == null ? "transparent" : mix(minColor, maxColor, position(value));
49
+ return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${row.label} ${column}: ${value == null ? "no data" : (0, scales_1.formatValue)(value)}`, onPress: () => {
50
+ if (value == null)
51
+ return;
52
+ setActive((current) => (current?.r === r && current?.c === c ? null : { r, c }));
53
+ onCellPress?.(r, c);
54
+ }, style: {
55
+ width: cellSize,
56
+ height: cellSize,
57
+ marginRight: cellGap,
58
+ borderRadius: 6,
59
+ backgroundColor: tint,
60
+ borderWidth: isActive ? 2 : 0,
61
+ borderColor: theme.foreground,
62
+ } }, column));
63
+ })] }, row.label))), (0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", alignItems: "center", marginTop: 10, marginLeft: labelWidth }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 9, marginRight: 5 }, children: (0, scales_1.formatValue)(min, { compact: true }) }), (0, jsx_runtime_1.jsx)(View, { style: {
64
+ width: 70,
65
+ height: 6,
66
+ borderRadius: 3,
67
+ backgroundColor: mix(minColor, maxColor, 0.5),
68
+ } }), (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 9, marginLeft: 5 }, children: (0, scales_1.formatValue)(max, { compact: true }) })] }), active !== null && rows[active.r]?.values[active.c] != null && ((0, jsx_runtime_1.jsxs)(Text, { style: { color: theme.foreground, fontSize: 11, marginTop: 8, marginLeft: labelWidth }, children: [rows[active.r].label, " \u00B7 ", columns[active.c], ":", " ", (0, scales_1.formatValue)(rows[active.r].values[active.c])] }))] }));
69
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeLineChart = NativeLineChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const tokens_1 = require("../internal/tokens");
7
+ const primitives_1 = require("./primitives");
8
+ const scales_1 = require("./scales");
9
+ const PADDING = { top: 12, right: 10, bottom: 24, left: 38 };
10
+ /**
11
+ * A line chart drawn with react-native-svg.
12
+ *
13
+ * Uses the same scale maths as the web LineChart, so the same series produces
14
+ * the same axis values on both platforms. Touching a column selects that
15
+ * point, which is the touch equivalent of hovering on the web.
16
+ */
17
+ function NativeLineChart({ labels, series, width = 320, height = 200, area = false, smooth = true, showDots = false, isDark = false, palette, style, onPointPress, }) {
18
+ const [active, setActive] = (0, react_1.useState)(null);
19
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
20
+ const { View, Text, Pressable, Svg, G, Line, Path, Circle, SvgText } = (0, primitives_1.primitives)();
21
+ const plot = {
22
+ x: PADDING.left,
23
+ y: PADDING.top,
24
+ width: Math.max(0, width - PADDING.left - PADDING.right),
25
+ height: Math.max(0, height - PADDING.top - PADDING.bottom),
26
+ };
27
+ const bottom = plot.y + plot.height;
28
+ const right = plot.x + plot.width;
29
+ const all = series.flatMap((s) => s.values).filter(Number.isFinite);
30
+ const domain = (0, react_1.useMemo)(() => {
31
+ if (all.length === 0)
32
+ return [0, 1];
33
+ const min = Math.min(...all);
34
+ const max = Math.max(...all);
35
+ return (0, scales_1.niceDomain)(area ? Math.min(0, min) : min, max, 4);
36
+ }, [all.join(","), area]);
37
+ const y = (0, scales_1.linearScale)(domain, [bottom, plot.y], { nice: false });
38
+ const x = (0, scales_1.bandScale)(labels.length, [plot.x, right], 0);
39
+ const yTicks = (0, scales_1.ticks)(domain, 4);
40
+ if (labels.length === 0 || series.length === 0) {
41
+ return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, height, alignItems: "center", justifyContent: "center" }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No series to display" }) }));
42
+ }
43
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(Svg, { width: width, height: height, children: [yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(Line, { x1: plot.x, x2: right, y1: y(tick), y2: y(tick), stroke: theme.axis, strokeOpacity: 0.24, strokeWidth: 1 }, `grid-${i}`))), series.map((s, si) => {
44
+ const color = s.color ?? (0, scales_1.seriesColor)(si, palette);
45
+ const points = s.values.map((value, i) => ({
46
+ x: x.center(i),
47
+ y: Number.isFinite(value) ? y(value) : bottom,
48
+ }));
49
+ const line = smooth
50
+ ? (0, scales_1.smoothPath)(points)
51
+ : `M ${points.map((p) => `${p.x} ${p.y}`).join(" L ")}`;
52
+ return ((0, jsx_runtime_1.jsxs)(G, { children: [area && ((0, jsx_runtime_1.jsx)(Path, { d: `${line} L ${points[points.length - 1].x} ${bottom} L ${points[0].x} ${bottom} Z`, fill: color, fillOpacity: 0.16 })), (0, jsx_runtime_1.jsx)(Path, { d: line, fill: "none", stroke: color, strokeWidth: 2, strokeLinecap: "round" }), (showDots || active !== null) &&
53
+ points.map((p, i) => ((0, jsx_runtime_1.jsx)(Circle, { cx: p.x, cy: p.y, r: active === i ? 4 : 2.5, fill: color, opacity: active === null || active === i ? 1 : 0.4 }, i)))] }, s.name));
54
+ }), active !== null && ((0, jsx_runtime_1.jsx)(Line, { x1: x.center(active), x2: x.center(active), y1: plot.y, y2: bottom, stroke: theme.foreground, strokeOpacity: 0.24, strokeWidth: 1, strokeDasharray: "3 3" })), yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(SvgText, { x: plot.x - 6, y: y(tick) + 3, fill: theme.muted, fontSize: 9, textAnchor: "end", children: (0, scales_1.formatValue)(tick, { compact: true }) }, `y-${i}`))), labels.map((label, i) => ((0, jsx_runtime_1.jsx)(SvgText, { x: x.center(i), y: height - 8, fill: theme.muted, fontSize: 9, textAnchor: "middle", children: label }, `x-${i}`)))] }), (0, jsx_runtime_1.jsx)(View, { style: {
55
+ position: "absolute",
56
+ left: plot.x,
57
+ top: plot.y,
58
+ width: plot.width,
59
+ height: plot.height,
60
+ flexDirection: "row",
61
+ }, children: labels.map((label, i) => ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${label}: ${series
62
+ .map((s) => `${s.name} ${(0, scales_1.formatValue)(s.values[i] ?? 0)}`)
63
+ .join(", ")}`, style: { flex: 1 }, onPress: () => {
64
+ setActive((current) => (current === i ? null : i));
65
+ onPointPress?.(i);
66
+ } }, label + i))) }), active !== null && ((0, jsx_runtime_1.jsxs)(View, { style: {
67
+ position: "absolute",
68
+ top: 0,
69
+ left: PADDING.left,
70
+ right: PADDING.right,
71
+ paddingVertical: 4,
72
+ paddingHorizontal: 8,
73
+ borderRadius: tokens_1.radii.sm,
74
+ backgroundColor: theme.glass,
75
+ flexDirection: "row",
76
+ flexWrap: "wrap",
77
+ gap: 8,
78
+ }, pointerEvents: "none", children: [(0, jsx_runtime_1.jsx)(Text, { style: { color: theme.foreground, fontSize: 10, fontWeight: "600" }, children: labels[active] }), series.map((s, si) => ((0, jsx_runtime_1.jsxs)(Text, { style: { color: s.color ?? (0, scales_1.seriesColor)(si, palette), fontSize: 10 }, children: [s.name, " ", (0, scales_1.formatValue)(s.values[active] ?? 0)] }, s.name)))] }))] }));
79
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativePlotChart = NativePlotChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const tokens_1 = require("../internal/tokens");
7
+ const primitives_1 = require("./primitives");
8
+ const scales_1 = require("./scales");
9
+ const PADDING = { top: 12, right: 12, bottom: 26, left: 44 };
10
+ /**
11
+ * A numeric plot you supply the marks for.
12
+ *
13
+ * The axes, ticks and padding are handled here and the caller receives real
14
+ * pixel scales. That keeps stroke widths and text sizes honest regardless of
15
+ * the chart's width, instead of a scaled viewBox that would distort them.
16
+ */
17
+ function NativePlotChart({ points, renderMark, width = 320, height = 200, xLabel, yLabel, isDark = false, style, }) {
18
+ const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
19
+ const { View, Text, Svg, G, Line, Circle, SvgText } = (0, primitives_1.primitives)();
20
+ const plot = {
21
+ x: PADDING.left,
22
+ y: PADDING.top,
23
+ width: Math.max(0, width - PADDING.left - PADDING.right),
24
+ height: Math.max(0, height - PADDING.top - PADDING.bottom),
25
+ };
26
+ const right = plot.x + plot.width;
27
+ const bottom = plot.y + plot.height;
28
+ const xDomain = (0, react_1.useMemo)(() => {
29
+ const values = points.map((point) => point.x).filter(Number.isFinite);
30
+ return (0, scales_1.niceDomain)(values.length ? Math.min(...values) : 0, values.length ? Math.max(...values) : 1, 4);
31
+ }, [points.map((point) => point.x).join(",")]);
32
+ const yDomain = (0, react_1.useMemo)(() => {
33
+ const values = points.map((point) => point.y).filter(Number.isFinite);
34
+ return (0, scales_1.niceDomain)(values.length ? Math.min(...values) : 0, values.length ? Math.max(...values) : 1, 4);
35
+ }, [points.map((point) => point.y).join(",")]);
36
+ const x = (0, scales_1.linearScale)(xDomain, [plot.x, right], { nice: false });
37
+ const y = (0, scales_1.linearScale)(yDomain, [bottom, plot.y], { nice: false });
38
+ if (points.length === 0) {
39
+ return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, height, alignItems: "center", justifyContent: "center" }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No points to display" }) }));
40
+ }
41
+ const yTicks = (0, scales_1.ticks)(yDomain, 4);
42
+ const xTicks = (0, scales_1.ticks)(xDomain, 4);
43
+ return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(Svg, { width: width, height: height, children: [yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(Line, { x1: plot.x, x2: right, y1: y(tick), y2: y(tick), stroke: theme.axis, strokeOpacity: 0.22, strokeWidth: 1 }, `grid-${i}`))), renderMark ? (renderMark({ x, y, points, width: plot.width, height: plot.height })) : ((0, jsx_runtime_1.jsx)(G, { children: points.map((point, index) => ((0, jsx_runtime_1.jsx)(Circle, { cx: x(point.x), cy: y(point.y), r: 3.5, fill: theme.fill }, index))) })), yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(SvgText, { x: plot.x - 6, y: y(tick) + 3, fill: theme.muted, fontSize: 9, textAnchor: "end", children: (0, scales_1.formatValue)(tick, { compact: true }) }, `y-${i}`))), xTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(SvgText, { x: x(tick), y: height - 8, fill: theme.muted, fontSize: 9, textAnchor: "middle", children: (0, scales_1.formatValue)(tick, { compact: true }) }, `x-${i}`)))] }), (xLabel || yLabel) && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 9, color: theme.muted, marginTop: 2 }, children: [xLabel, yLabel].filter(Boolean).join(" · ") }))] }));
44
+ }