@asanchez-sa/abby 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chart/chart.d.ts +5 -74
- package/dist/components/chart/chart.js +5 -563
- package/dist/components/chart/parts/bar.d.ts +32 -0
- package/dist/components/chart/parts/bar.js +348 -0
- package/dist/components/chart/parts/{frame.d.ts → categories.d.ts} +5 -4
- package/dist/components/chart/parts/categories.js +212 -0
- package/dist/components/chart/parts/line.d.ts +43 -0
- package/dist/components/chart/parts/line.js +266 -0
- package/dist/components/chart/parts/scale.js +1 -44
- package/dist/components/chart/parts/scatter.d.ts +67 -0
- package/dist/components/chart/parts/scatter.js +157 -0
- package/dist/components/chart/parts/surface.d.ts +26 -0
- package/dist/components/chart/parts/surface.js +76 -0
- package/dist/components/chart/parts/types.js +5 -1
- package/dist/styles/components.css +66 -0
- package/package.json +2 -1
- package/skills/agent-ready-ui/SKILL.md +1 -1
- package/skills/blocks/SKILL.md +1 -1
- package/skills/compose-screens/SKILL.md +7 -6
- package/skills/compose-screens/references/charts-and-maps.md +119 -4
- package/skills/note-editor/SKILL.md +1 -1
- package/skills/note-status/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/theming/SKILL.md +1 -1
- package/dist/components/chart/parts/axes.js +0 -126
- package/dist/components/chart/parts/frame.js +0 -278
- package/dist/components/chart/parts/points.d.ts +0 -1
- package/dist/components/chart/parts/points.js +0 -139
|
@@ -130,6 +130,72 @@
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/*
|
|
134
|
+
* A TanStack chart in abby's look. The library paints with SVG attributes and
|
|
135
|
+
* reads its palette and tooltip from `--ts-chart-*`; these rules win over the
|
|
136
|
+
* attributes, so any chart definition takes the theme without passing one:
|
|
137
|
+
* the palette is `chart-1` … `chart-5`, the grid and the axes are hairlines,
|
|
138
|
+
* a tick's label is `subtle`, and the tooltip is abby's `Tooltip`.
|
|
139
|
+
*/
|
|
140
|
+
@utility chart-surface {
|
|
141
|
+
--ts-chart-1: var(--chart-1);
|
|
142
|
+
--ts-chart-2: var(--chart-2);
|
|
143
|
+
--ts-chart-3: var(--chart-3);
|
|
144
|
+
--ts-chart-4: var(--chart-4);
|
|
145
|
+
--ts-chart-5: var(--chart-5);
|
|
146
|
+
--ts-chart-6: var(--muted-foreground);
|
|
147
|
+
--ts-chart-focus-fill: var(--accent);
|
|
148
|
+
--ts-chart-crosshair-marker-fill: var(--background);
|
|
149
|
+
--ts-chart-crosshair-label-halo: var(--background);
|
|
150
|
+
--ts-chart-tooltip-background: var(--foreground);
|
|
151
|
+
--ts-chart-tooltip-color: var(--background);
|
|
152
|
+
--ts-chart-tooltip-border: 0;
|
|
153
|
+
--ts-chart-tooltip-border-radius: var(--radius-md);
|
|
154
|
+
--ts-chart-tooltip-padding: --spacing(1.5) --spacing(3);
|
|
155
|
+
--ts-chart-tooltip-font: var(--font-weight-normal) var(--text-xs) / var(--text-xs--line-height)
|
|
156
|
+
var(--font-sans);
|
|
157
|
+
--ts-chart-tooltip-shadow: none;
|
|
158
|
+
--ts-chart-tooltip-max-width: --spacing(80);
|
|
159
|
+
--ts-chart-tooltip-active-row-background: transparent;
|
|
160
|
+
--ts-chart-tooltip-active-row-shadow: none;
|
|
161
|
+
--ts-chart-tooltip-active-row-font-weight: var(--font-weight-medium);
|
|
162
|
+
|
|
163
|
+
& .ts-chart {
|
|
164
|
+
@apply focus-ring rounded-xs;
|
|
165
|
+
font-family: inherit;
|
|
166
|
+
font-variant-numeric: tabular-nums;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
& .ts-chart > [data-ts-key="background"] {
|
|
170
|
+
fill: transparent;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
& .ts-chart__grid,
|
|
174
|
+
& .ts-chart__axes line {
|
|
175
|
+
stroke: var(--border);
|
|
176
|
+
stroke-opacity: 1;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
& .ts-chart__axes text {
|
|
180
|
+
fill: var(--subtle);
|
|
181
|
+
fill-opacity: 1;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* A tick a chart sets in medium (the current day or week) reads in `foreground`. */
|
|
185
|
+
& .ts-chart__axes text[font-weight="500"] {
|
|
186
|
+
fill: var(--foreground);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
& .ts-chart-tooltip__title {
|
|
190
|
+
font-weight: var(--font-weight-medium) !important;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
& .ts-chart__axes text:is([data-ts-key="x-label"], [data-ts-key="y-label"]) {
|
|
194
|
+
fill: var(--muted-foreground);
|
|
195
|
+
font-weight: var(--font-weight-medium);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
133
199
|
/* The surface of a popup that floats over the page: a popover, a menu, a list of options. */
|
|
134
200
|
@utility popup-surface {
|
|
135
201
|
@apply bg-popover text-popover-foreground shadow-md ring-1 ring-border outline-none;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asanchez-sa/abby",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Sistema de diseño para React sobre ui-sdk y Tailwind CSS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -177,6 +177,7 @@
|
|
|
177
177
|
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
178
178
|
"@hugeicons/core-free-icons": "^4.4.0",
|
|
179
179
|
"@hugeicons/react": "^1.1.10",
|
|
180
|
+
"@tanstack/charts": "1.5.0",
|
|
180
181
|
"@tiptap/core": "3.32.2",
|
|
181
182
|
"@tiptap/extension-list": "3.32.2",
|
|
182
183
|
"@tiptap/extension-unique-id": "3.32.2",
|
package/skills/blocks/SKILL.md
CHANGED
|
@@ -4,17 +4,18 @@ description: "Use when building screens, forms, dialogs, menus or lists from
|
|
|
4
4
|
abby components: parts and their composition, button looks on trigger parts,
|
|
5
5
|
Icon and Link, sizes, Field for labels and errors, items for lists, controlled
|
|
6
6
|
state, popups without portals, bar charts of counts by day or week (stacked
|
|
7
|
-
into parts, with their legend and notes), line charts of a trend by week,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
into parts, with their legend and notes), line charts of a trend by week,
|
|
8
|
+
scatter charts of rows by two numbers, charts of your own from TanStack
|
|
9
|
+
Charts, maps of nodes joined by lines, rows of filter chips, a chip that opens
|
|
10
|
+
a menu to narrow a list, a unit inside a number field. Takes precedence over
|
|
11
|
+
generic ui-sdk or shadcn examples."
|
|
11
12
|
metadata:
|
|
12
13
|
purpose: Shows how abby's styled components compose into screens, where they
|
|
13
14
|
differ from shadcn and from raw ui-sdk, and which choices keep them
|
|
14
15
|
accessible and usable by agents.
|
|
15
16
|
type: core
|
|
16
17
|
library: abby
|
|
17
|
-
library_version: 0.
|
|
18
|
+
library_version: 0.5.0
|
|
18
19
|
requires:
|
|
19
20
|
- setup
|
|
20
21
|
sources:
|
|
@@ -370,7 +371,7 @@ Read [the filter chip reference](references/filter-chips.md) for an example row.
|
|
|
370
371
|
|
|
371
372
|
### Show counts or trends by day or week with `BarChart` and `LineChart`
|
|
372
373
|
|
|
373
|
-
`BarChart` from `abby/chart` draws one column of bars per category, with a tooltip for each value and a table for screen readers. `LineChart` from the same entry draws one trend line over the categories, with reference lines and small charts that share a scale. Read [the charts and maps reference](references/charts-and-maps.md) when you build one: its `data`, `series`, `highlight`, forecast and colors, and its `LineChart` section for `mark`, `domain` and `size="sm"`. For bars made of parts that add up to a total (`stacked`, with `totals`, a `note` and `ChartLegend`), read its stacked section.
|
|
374
|
+
`BarChart` from `abby/chart` draws one column of bars per category, with a tooltip for each value and a table for screen readers. `LineChart` from the same entry draws one trend line over the categories, with reference lines and small charts that share a scale. Read [the charts and maps reference](references/charts-and-maps.md) when you build one: its `data`, `series`, `highlight`, forecast and colors, and its `LineChart` section for `mark`, `domain` and `size="sm"`. For bars made of parts that add up to a total (`stacked`, with `totals`, a `note` and `ChartLegend`), read its stacked section. `ScatterChart` plots the app's own rows by two numbers, sized and colored by two more, and `Chart` draws a TanStack Charts definition of your own in abby's look: each has its section there.
|
|
374
375
|
|
|
375
376
|
### Build a window with a rail and a column
|
|
376
377
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Charts and maps
|
|
2
2
|
|
|
3
|
-
Read this when you build a bar chart with `BarChart`, a line chart with `LineChart` or a map of nodes with `Graph`. The main skill points here from its "Show counts or trends by day or week" and "Draw memories as a map" sections.
|
|
3
|
+
Read this when you build a bar chart with `BarChart`, a line chart with `LineChart`, a scatter chart with `ScatterChart`, a chart of your own with `Chart`, or a map of nodes with `Graph`. The main skill points here from its "Show counts or trends by day or week" and "Draw memories as a map" sections.
|
|
4
|
+
|
|
5
|
+
Every chart in `abby/chart` is drawn by TanStack Charts (`@tanstack/charts`) in abby's look: the palette is `chart-1` to `chart-5`, the grid and the axes are hairlines, and the tooltip and the focus ring are abby's. The plot is one image named by the chart's `aria-label` or `aria-labelledby`, which is required (without one it throws in development). It is one tab stop: the arrows, Home and End move between points, and the tooltip announces each point it reaches. The presets also put a hidden table with every value under the plot.
|
|
4
6
|
|
|
5
7
|
## Counts by day or week with `BarChart`
|
|
6
8
|
|
|
7
|
-
`BarChart` from `abby/chart` draws
|
|
9
|
+
`BarChart` from `abby/chart` draws one column per category, one bar per series in that column, a Y axis with its ticks and grid, and x labels that thin out when there are many. Each bar is a point for the pointer and the arrows, and its tooltip names the category, the series and the value.
|
|
8
10
|
|
|
9
11
|
- `data`: one row per category, `{ label, id?, values }`. `label` is the x label; `values` holds one number per series key, and `null` or a missing key draws no bar.
|
|
10
12
|
- `series`: `{ key, name, color?, variant? }` in the order the bars are drawn. `key` reads `values`, `name` reads in the tooltip and the table.
|
|
@@ -12,7 +14,7 @@ Read this when you build a bar chart with `BarChart`, a line chart with `LineCha
|
|
|
12
14
|
- Colors: without `color`, series take `chart-1` to `chart-5` in order. `color` takes a token (`chart-1`…`chart-5`, `primary`, `muted`, `warning`, `success`, `destructive`) or any CSS color, such as `var(--area)`.
|
|
13
15
|
- `variant: "forecast"` draws what hasn't happened yet as a dashed outline in the first series' column. It is not a column of its own.
|
|
14
16
|
- `format` takes `Intl.NumberFormat` options for the axis, the tooltip and the table. `empty`, `categoryHeader` and `missing` replace the texts.
|
|
15
|
-
-
|
|
17
|
+
- `height` is the whole chart's, x labels included. `description` is read after the name: the units, the period.
|
|
16
18
|
|
|
17
19
|
```tsx
|
|
18
20
|
import { BarChart } from "abby/chart";
|
|
@@ -100,7 +102,7 @@ export function MemoryStates() {
|
|
|
100
102
|
|
|
101
103
|
## Trends by week with `LineChart`
|
|
102
104
|
|
|
103
|
-
`LineChart` from `abby/chart` draws one line over one series, one point per category,
|
|
105
|
+
`LineChart` from `abby/chart` draws one line over one series, one point per category, like `BarChart`: a name, a tooltip on each point and a table for screen readers. Use it when the question is whether something rises or falls over time; use `BarChart` to compare counts with each other. Its `data` rows and `series` are `BarChart`'s, and the first series is the line.
|
|
104
106
|
|
|
105
107
|
- `mark`: which points get a dot and their value. `"ends"` (the default) marks the first and the last, `"last"` only the last. A small chart always marks only the last.
|
|
106
108
|
- `references`: `{ value, label?, color? }` horizontal lines to compare against, each labeled at the start. `color` defaults to a hairline.
|
|
@@ -133,6 +135,119 @@ export function AnswersPerWeek() {
|
|
|
133
135
|
}
|
|
134
136
|
```
|
|
135
137
|
|
|
138
|
+
## Relationships with `ScatterChart`
|
|
139
|
+
|
|
140
|
+
`ScatterChart` from `abby/chart` plots the app's own rows by two numbers, to answer whether one thing goes with another (revenue and retention, size and cost). It keeps each row as it is: `onFocusChange(row)` and `onSelect(row)` hand back the app's row, typed, and `null` when the pointer or focus leaves.
|
|
141
|
+
|
|
142
|
+
- `data`: the rows, any shape. `x` and `y` name two number fields; `size` names a third, and the dot's area grows with it (a square-root scale from 0 to the largest value, so twice the value is twice the area). `color` names a text field, like a segment.
|
|
143
|
+
- `colors`: `{ [value]: color }`, the color of each `color` value and the legend's order. A value that isn't listed takes the next of `chart-1` to `chart-5`.
|
|
144
|
+
- `label(row)` is a row's name, the tooltip's title and the table's first column; `rowKey(row)` keeps a row's identity across updates.
|
|
145
|
+
- `xLabel`, `yLabel`, `sizeLabel`, `colorLabel` name the axes and the fields in the tooltip and the table; `xFormat`, `yFormat`, `sizeFormat` take `Intl.NumberFormat` options, with `locale`.
|
|
146
|
+
- `radius`: `[smallest, largest]` in px, `[3, 18]` by default. `sqrtRadius(largest, radius)` is the same scale, for a chart of your own. `legend={false}` hides the `ChartLegend` of the colors.
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { ScatterChart } from "abby/chart";
|
|
150
|
+
|
|
151
|
+
type Account = {
|
|
152
|
+
id: string;
|
|
153
|
+
name: string;
|
|
154
|
+
segment: "Enterprise" | "Mid-market" | "SMB";
|
|
155
|
+
monthlyRevenue: number;
|
|
156
|
+
retention: number;
|
|
157
|
+
seats: number;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const accounts: Account[] = [
|
|
161
|
+
{
|
|
162
|
+
id: "a1",
|
|
163
|
+
name: "Northwind",
|
|
164
|
+
segment: "Enterprise",
|
|
165
|
+
monthlyRevenue: 48000,
|
|
166
|
+
retention: 0.94,
|
|
167
|
+
seats: 420,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "a2",
|
|
171
|
+
name: "Fabrikam",
|
|
172
|
+
segment: "Mid-market",
|
|
173
|
+
monthlyRevenue: 14000,
|
|
174
|
+
retention: 0.81,
|
|
175
|
+
seats: 90,
|
|
176
|
+
},
|
|
177
|
+
{ id: "a3", name: "Litware", segment: "SMB", monthlyRevenue: 2400, retention: 0.62, seats: 12 },
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
export function AccountHealth({ onOpen }: { onOpen: (account: Account) => void }) {
|
|
181
|
+
return (
|
|
182
|
+
<ScatterChart
|
|
183
|
+
aria-label="Monthly revenue against retention by account, sized by seats"
|
|
184
|
+
data={accounts}
|
|
185
|
+
x="monthlyRevenue"
|
|
186
|
+
y="retention"
|
|
187
|
+
size="seats"
|
|
188
|
+
color="segment"
|
|
189
|
+
label={(account) => account.name}
|
|
190
|
+
rowKey={(account) => account.id}
|
|
191
|
+
xLabel="Monthly revenue"
|
|
192
|
+
yLabel="Retention"
|
|
193
|
+
sizeLabel="Seats"
|
|
194
|
+
colorLabel="Segment"
|
|
195
|
+
xFormat={{ style: "currency", currency: "USD", notation: "compact" }}
|
|
196
|
+
yFormat={{ style: "percent" }}
|
|
197
|
+
onSelect={(account) => {
|
|
198
|
+
if (account) onOpen(account);
|
|
199
|
+
}}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## A chart of your own with `Chart`
|
|
206
|
+
|
|
207
|
+
When no preset fits (a target line over bars, an area, a histogram), build the chart with TanStack's grammar and draw it with `Chart` from `abby/chart`, which gives it abby's look, name and focus. The marks, scales and tooltip come from `@tanstack/charts` itself: add it to the app at the exact version abby depends on, and follow TanStack's own skills for the grammar.
|
|
208
|
+
|
|
209
|
+
- `definition`: what `defineChart` returns. Build it in the component that renders the chart; React Compiler keeps it while its inputs stay the same.
|
|
210
|
+
- Scales: `scaleLinear` from `@tanstack/charts/scales/linear`, `scaleBand` and `scalePoint` for categories, passed as factories so TanStack infers the domain. Never set a pixel range.
|
|
211
|
+
- Colors: leave a mark's paint out and it takes the palette (`chart-1` …), or set `fill`/`stroke` to `var(--chart-2)`, `var(--warning)` and the like. No hex colors: the tokens carry dark mode.
|
|
212
|
+
- A mark that only labels (a total, a rule's text) takes `decorative()` from `@tanstack/charts/mark/decorative`, so the arrows skip it.
|
|
213
|
+
- `height`, `description`, `onFocusChange` and `onSelect` go on `Chart`; `children` draw under the plot: a `ChartLegend`, a table of the values.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
import { barY, defineChart, ruleY } from "@tanstack/charts";
|
|
217
|
+
import { scaleBand } from "@tanstack/charts/scales/band";
|
|
218
|
+
import { scaleLinear } from "@tanstack/charts/scales/linear";
|
|
219
|
+
import { tooltip } from "@tanstack/charts/tooltip";
|
|
220
|
+
import { Chart } from "abby/chart";
|
|
221
|
+
|
|
222
|
+
const quarters = [
|
|
223
|
+
{ quarter: "Q1", revenue: 42 },
|
|
224
|
+
{ quarter: "Q2", revenue: 58 },
|
|
225
|
+
{ quarter: "Q3", revenue: 51 },
|
|
226
|
+
{ quarter: "Q4", revenue: 66 },
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
export function RevenueAgainstTarget() {
|
|
230
|
+
const definition = defineChart({
|
|
231
|
+
marks: [
|
|
232
|
+
barY(quarters, { x: "quarter", y: "revenue", radius: 6 }),
|
|
233
|
+
ruleY([60], { stroke: "var(--warning)", strokeDasharray: "3 3" }),
|
|
234
|
+
],
|
|
235
|
+
scales: {
|
|
236
|
+
x: { scale: () => scaleBand<string>().paddingInner(0.28).paddingOuter(0.14) },
|
|
237
|
+
y: { scale: scaleLinear, nice: true, grid: true },
|
|
238
|
+
},
|
|
239
|
+
tooltip,
|
|
240
|
+
});
|
|
241
|
+
return (
|
|
242
|
+
<Chart
|
|
243
|
+
aria-label="Revenue by quarter against a target of 60"
|
|
244
|
+
definition={definition}
|
|
245
|
+
height={220}
|
|
246
|
+
/>
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
136
251
|
## Draw memories as a map with `Graph`
|
|
137
252
|
|
|
138
253
|
`Graph` from `abby/graph` draws nodes as buttons and the lines between them in SVG, with no layout of its own. The app places every node: `x` and `y` are its center in map units at zoom 1. The map never lays out, drags or pans. A node's `name` is its button's name; `meta` is the line under it, `current` widens it for the memory being read, `replaced` strikes it through, and `color` takes `chart-1` to `chart-5`.
|
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
and keep both usable by an agent without loading the editor.
|
|
13
13
|
type: core
|
|
14
14
|
library: abby
|
|
15
|
-
library_version: 0.
|
|
15
|
+
library_version: 0.5.0
|
|
16
16
|
sources:
|
|
17
17
|
- src/components/note-status/note-status.tsx
|
|
18
18
|
- src/components/note-place/note-place.tsx
|
package/skills/setup/SKILL.md
CHANGED
package/skills/theming/SKILL.md
CHANGED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
// src/components/chart/parts/axes.tsx
|
|
5
|
-
/** The horizontal lines at each tick, drawn inside the plot's SVG. */
|
|
6
|
-
function ChartGrid(t0) {
|
|
7
|
-
const $ = c(4);
|
|
8
|
-
const { plot } = t0;
|
|
9
|
-
let t1;
|
|
10
|
-
if ($[0] !== plot) {
|
|
11
|
-
t1 = plot.ticks.map((tick) => {
|
|
12
|
-
const y = plot.baseline - plot.rise(tick);
|
|
13
|
-
return /* @__PURE__ */ jsx("line", {
|
|
14
|
-
x1: "0",
|
|
15
|
-
x2: "100%",
|
|
16
|
-
y1: y + .5,
|
|
17
|
-
y2: y + .5
|
|
18
|
-
}, tick);
|
|
19
|
-
});
|
|
20
|
-
$[0] = plot;
|
|
21
|
-
$[1] = t1;
|
|
22
|
-
} else t1 = $[1];
|
|
23
|
-
let t2;
|
|
24
|
-
if ($[2] !== t1) {
|
|
25
|
-
t2 = /* @__PURE__ */ jsx("g", {
|
|
26
|
-
"aria-hidden": "true",
|
|
27
|
-
className: "stroke-border",
|
|
28
|
-
shapeRendering: "crispEdges",
|
|
29
|
-
children: t1
|
|
30
|
-
});
|
|
31
|
-
$[2] = t1;
|
|
32
|
-
$[3] = t2;
|
|
33
|
-
} else t2 = $[3];
|
|
34
|
-
return t2;
|
|
35
|
-
}
|
|
36
|
-
/** The value of each tick, in a column to the left of the plot. */
|
|
37
|
-
function ChartYAxis(t0) {
|
|
38
|
-
const $ = c(12);
|
|
39
|
-
const { plot, format } = t0;
|
|
40
|
-
const t1 = plot.top + .5;
|
|
41
|
-
const t2 = plot.height - plot.baseline - .5;
|
|
42
|
-
let t3;
|
|
43
|
-
if ($[0] !== plot.height || $[1] !== t1 || $[2] !== t2) {
|
|
44
|
-
t3 = {
|
|
45
|
-
height: plot.height,
|
|
46
|
-
paddingTop: t1,
|
|
47
|
-
paddingBottom: t2
|
|
48
|
-
};
|
|
49
|
-
$[0] = plot.height;
|
|
50
|
-
$[1] = t1;
|
|
51
|
-
$[2] = t2;
|
|
52
|
-
$[3] = t3;
|
|
53
|
-
} else t3 = $[3];
|
|
54
|
-
let t4;
|
|
55
|
-
if ($[4] !== format || $[5] !== plot.ticks) {
|
|
56
|
-
let t5;
|
|
57
|
-
if ($[7] !== format) {
|
|
58
|
-
t5 = (tick) => /* @__PURE__ */ jsx("div", {
|
|
59
|
-
className: "flex h-0 items-center justify-end whitespace-nowrap",
|
|
60
|
-
children: format(tick)
|
|
61
|
-
}, tick);
|
|
62
|
-
$[7] = format;
|
|
63
|
-
$[8] = t5;
|
|
64
|
-
} else t5 = $[8];
|
|
65
|
-
t4 = plot.ticks.map(t5);
|
|
66
|
-
$[4] = format;
|
|
67
|
-
$[5] = plot.ticks;
|
|
68
|
-
$[6] = t4;
|
|
69
|
-
} else t4 = $[6];
|
|
70
|
-
let t5;
|
|
71
|
-
if ($[9] !== t3 || $[10] !== t4) {
|
|
72
|
-
t5 = /* @__PURE__ */ jsx("div", {
|
|
73
|
-
"aria-hidden": "true",
|
|
74
|
-
"data-slot": "chart-y-axis",
|
|
75
|
-
className: "flex flex-col-reverse justify-between pe-2 text-supporting text-subtle tabular-nums",
|
|
76
|
-
style: t3,
|
|
77
|
-
children: t4
|
|
78
|
-
});
|
|
79
|
-
$[9] = t3;
|
|
80
|
-
$[10] = t4;
|
|
81
|
-
$[11] = t5;
|
|
82
|
-
} else t5 = $[11];
|
|
83
|
-
return t5;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* The category labels under the plot, each centered under its column. `shown`
|
|
87
|
-
* says which categories have one, and `highlighted` which one is the current.
|
|
88
|
-
*/
|
|
89
|
-
function ChartXAxis(t0) {
|
|
90
|
-
const $ = c(11);
|
|
91
|
-
const { labels, count, shown, highlighted } = t0;
|
|
92
|
-
let t1;
|
|
93
|
-
if ($[0] !== count || $[1] !== highlighted || $[2] !== labels || $[3] !== shown) {
|
|
94
|
-
let t2;
|
|
95
|
-
if ($[5] !== count || $[6] !== highlighted || $[7] !== labels) {
|
|
96
|
-
t2 = (index) => /* @__PURE__ */ jsx("div", {
|
|
97
|
-
className: index === highlighted ? "absolute top-0 -translate-x-1/2 text-supporting font-medium whitespace-nowrap text-foreground" : "absolute top-0 -translate-x-1/2 text-supporting whitespace-nowrap text-subtle",
|
|
98
|
-
style: { left: `${(index + .5) / count * 100}%` },
|
|
99
|
-
children: labels[index]
|
|
100
|
-
}, index);
|
|
101
|
-
$[5] = count;
|
|
102
|
-
$[6] = highlighted;
|
|
103
|
-
$[7] = labels;
|
|
104
|
-
$[8] = t2;
|
|
105
|
-
} else t2 = $[8];
|
|
106
|
-
t1 = shown.map(t2);
|
|
107
|
-
$[0] = count;
|
|
108
|
-
$[1] = highlighted;
|
|
109
|
-
$[2] = labels;
|
|
110
|
-
$[3] = shown;
|
|
111
|
-
$[4] = t1;
|
|
112
|
-
} else t1 = $[4];
|
|
113
|
-
let t2;
|
|
114
|
-
if ($[9] !== t1) {
|
|
115
|
-
t2 = /* @__PURE__ */ jsx("div", {
|
|
116
|
-
"aria-hidden": "true",
|
|
117
|
-
"data-slot": "chart-x-axis",
|
|
118
|
-
className: "relative h-4",
|
|
119
|
-
children: t1
|
|
120
|
-
});
|
|
121
|
-
$[9] = t1;
|
|
122
|
-
$[10] = t2;
|
|
123
|
-
} else t2 = $[10];
|
|
124
|
-
return t2;
|
|
125
|
-
}
|
|
126
|
-
export { ChartGrid, ChartXAxis, ChartYAxis };
|