basalt-ui 2.27.2 → 2.29.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/CHANGELOG.md +466 -307
- package/MIGRATING.md +358 -12
- package/agent/rules/basalt-batteries.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- package/agent/skills/basalt-app/SKILL.md +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +12 -6
- package/agent/skills/basalt-design/references/catalogue.md +42 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +112 -3
- package/configs/oxlint-plugin.test.ts +99 -4
- package/configs/oxlint.json +1 -0
- package/dist/agent/chat/thread-message.d.ts +1 -160
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +7 -162
- package/dist/agent/chat/virtualize.d.ts +5 -5
- package/dist/charts/ChartCard.d.ts +14 -7
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +112 -23
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +14 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +155 -44
- package/dist/charts/chart-box.module.css +59 -2
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +28 -17
- package/dist/charts/chart-card.module.css.d.ts +3 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +38 -27
- package/dist/charts/labels.d.ts +13 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +131 -20
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +1 -1
- package/dist/charts/ref-label.d.ts +37 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +55 -10
- package/dist/charts/sparkline.module.css +50 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +4 -4
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +23 -5
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +54 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -3
- package/dist/cli/index.d.ts +13 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -2
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +118 -27
- package/dist/cli/router-wiring.d.ts +3 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +2 -0
- package/dist/cli/shot/capture.d.ts +34 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +95 -12
- package/dist/cli/shot/detect.d.ts +4 -1
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +38 -16
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +9 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +11 -2
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +10 -2
- package/dist/common/could-not-load.d.ts +13 -0
- package/dist/common/could-not-load.d.ts.map +1 -0
- package/dist/common/could-not-load.js +14 -0
- package/dist/common/empty-copy.d.ts +16 -0
- package/dist/common/empty-copy.d.ts.map +1 -0
- package/dist/common/empty-copy.js +9 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +3 -0
- package/dist/common/props.d.ts +20 -0
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/props.js +13 -1
- package/dist/common/retry-button.module.css +7 -3
- package/dist/common/virtual-rows.d.ts +196 -0
- package/dist/common/virtual-rows.d.ts.map +1 -0
- package/dist/common/virtual-rows.js +290 -0
- package/dist/controls/controls.module.css +33 -1
- package/dist/controls/controls.module.css.d.ts +2 -0
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -2
- package/dist/controls/filter-pill.d.ts +27 -3
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +15 -4
- package/dist/controls/form-layout.d.ts +9 -3
- package/dist/controls/form-layout.d.ts.map +1 -1
- package/dist/controls/form-layout.js +74 -12
- package/dist/controls/form-layout.module.css +112 -7
- package/dist/controls/form-layout.module.css.d.ts +1 -0
- package/dist/controls/multi-select-filter.d.ts +2 -2
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +12 -6
- package/dist/controls/range-filter.d.ts +1 -1
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +8 -2
- package/dist/dashboard/bar-list.d.ts +5 -5
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +15 -8
- package/dist/dashboard/bar-list.module.css +21 -5
- package/dist/dashboard/board-nav.d.ts +22 -0
- package/dist/dashboard/board-nav.d.ts.map +1 -0
- package/dist/dashboard/board-nav.js +49 -0
- package/dist/dashboard/board.d.ts +52 -0
- package/dist/dashboard/board.d.ts.map +1 -0
- package/dist/dashboard/board.js +247 -0
- package/dist/dashboard/board.module.css +179 -0
- package/dist/dashboard/board.module.css.d.ts +28 -0
- package/dist/dashboard/empty-state.d.ts +6 -6
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +17 -8
- package/dist/dashboard/event-list-model.d.ts +54 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +76 -0
- package/dist/dashboard/event-list-rows.d.ts +23 -0
- package/dist/dashboard/event-list-rows.d.ts.map +1 -0
- package/dist/dashboard/event-list-rows.js +89 -0
- package/dist/dashboard/event-list-scroll.d.ts +55 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +216 -0
- package/dist/dashboard/event-list-skeleton.d.ts +10 -0
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
- package/dist/dashboard/event-list-skeleton.js +34 -0
- package/dist/dashboard/event-list.d.ts +65 -0
- package/dist/dashboard/event-list.d.ts.map +1 -0
- package/dist/dashboard/event-list.js +208 -0
- package/dist/dashboard/event-list.module.css +336 -0
- package/dist/dashboard/event-list.module.css.d.ts +34 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -0
- package/dist/dashboard/meter-model.d.ts +6 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +9 -4
- package/dist/dashboard/meter-parts.d.ts +3 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +36 -6
- package/dist/dashboard/meter.d.ts +3 -3
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -2
- package/dist/dashboard/meter.module.css +20 -12
- package/dist/dashboard/meter.module.css.d.ts +0 -1
- package/dist/dashboard/page-summary.d.ts +3 -3
- package/dist/dashboard/page-summary.d.ts.map +1 -1
- package/dist/dashboard/page-summary.js +7 -2
- package/dist/dashboard/page-summary.module.css +5 -2
- package/dist/dashboard/query-state.d.ts +9 -8
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +29 -11
- package/dist/dashboard/section.d.ts +11 -3
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +34 -7
- package/dist/dashboard/settings-section.d.ts +8 -5
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +12 -8
- package/dist/dashboard/settings-section.module.css +25 -4
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts +5 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +8 -3
- package/dist/dashboard/stat-card.d.ts +3 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +47 -12
- package/dist/dashboard/stat-card.module.css +42 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -0
- package/dist/dashboard/stat-group.d.ts +2 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +10 -3
- package/dist/dashboard/stat-strip.d.ts +5 -4
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +41 -31
- package/dist/dashboard/stat-strip.module.css +8 -6
- package/dist/dashboard/visual-slot.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +2 -0
- package/dist/dashboard/widget-header.d.ts +6 -6
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +4 -2
- package/dist/dashboard/widget-header.module.css +12 -15
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +24 -1
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/shell/app-main.module.css +18 -0
- package/dist/styles.css +69 -0
- package/dist/surfaces.d.ts +2 -2
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +8 -2
- package/dist/table/cell-kinds.d.ts +47 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +180 -0
- package/dist/table/cell-kinds.module.css +55 -0
- package/dist/table/cell-kinds.module.css.d.ts +15 -0
- package/dist/table/data-table-fold.d.ts +155 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +320 -0
- package/dist/table/data-table-state.d.ts +10 -3
- package/dist/table/data-table-state.d.ts.map +1 -1
- package/dist/table/data-table-state.js +11 -6
- package/dist/table/data-table.d.ts +13 -28
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +362 -255
- package/dist/table/data-table.module.css +282 -3
- package/dist/table/data-table.module.css.d.ts +16 -0
- package/dist/table/table-features.d.ts +34 -4
- package/dist/table/table-features.d.ts.map +1 -1
- package/dist/table/table-features.js +10 -0
- package/dist/theme/card-inset.module.css +35 -0
- package/dist/theme/controls.module.css +55 -2
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +5 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -10
- package/dist/tokens/core.d.ts +1 -0
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +1 -0
- package/dist/tokens/derive.js +1 -1
- package/dist/tokens/palette.d.ts +2 -1
- package/dist/tokens/palette.d.ts.map +1 -1
- package/llms.txt +295 -5
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +10 -403
- package/src/agent/chat/virtualize.ts +5 -5
- package/src/charts/ChartCard.tsx +175 -31
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +213 -48
- package/src/charts/chart-box.module.css +59 -2
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +28 -17
- package/src/charts/chart-card.module.css.d.ts +3 -0
- package/src/charts/compile.ts +59 -33
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +114 -18
- package/src/charts/sparkline.module.css +50 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +40 -10
- package/src/cli/doctor-upgrade.ts +75 -0
- package/src/cli/doctor.ts +36 -0
- package/src/cli/help.ts +16 -6
- package/src/cli/index.ts +73 -67
- package/src/cli/init.ts +157 -36
- package/src/cli/router-wiring.ts +2 -2
- package/src/cli/shot/capture.ts +138 -16
- package/src/cli/shot/detect.ts +46 -22
- package/src/cli/shot/index.ts +8 -2
- package/src/cli/shot/measure.ts +11 -2
- package/src/cli/shot/types.ts +4 -1
- package/src/cli/sync.ts +12 -2
- package/src/common/could-not-load.ts +22 -0
- package/src/common/empty-copy.ts +17 -0
- package/src/common/index.ts +1 -0
- package/src/common/props.ts +30 -0
- package/src/common/retry-button.module.css +7 -3
- package/src/common/virtual-rows.tsx +682 -0
- package/src/controls/controls.module.css +33 -1
- package/src/controls/controls.module.css.d.ts +2 -0
- package/src/controls/enum-filter.tsx +8 -2
- package/src/controls/filter-pill.tsx +80 -27
- package/src/controls/form-layout.module.css +112 -7
- package/src/controls/form-layout.module.css.d.ts +1 -0
- package/src/controls/form-layout.tsx +115 -22
- package/src/controls/multi-select-filter.tsx +22 -11
- package/src/controls/range-filter.tsx +9 -3
- package/src/dashboard/bar-list.module.css +21 -5
- package/src/dashboard/bar-list.tsx +53 -45
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +179 -0
- package/src/dashboard/board.module.css.d.ts +28 -0
- package/src/dashboard/board.tsx +415 -0
- package/src/dashboard/empty-state.tsx +21 -11
- package/src/dashboard/event-list-model.ts +125 -0
- package/src/dashboard/event-list-rows.tsx +117 -0
- package/src/dashboard/event-list-scroll.ts +291 -0
- package/src/dashboard/event-list-skeleton.tsx +62 -0
- package/src/dashboard/event-list.module.css +336 -0
- package/src/dashboard/event-list.module.css.d.ts +34 -0
- package/src/dashboard/event-list.tsx +336 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +53 -14
- package/src/dashboard/meter.module.css +20 -12
- package/src/dashboard/meter.module.css.d.ts +0 -1
- package/src/dashboard/meter.tsx +36 -18
- package/src/dashboard/page-summary.module.css +5 -2
- package/src/dashboard/page-summary.tsx +13 -6
- package/src/dashboard/query-state.tsx +55 -30
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +25 -4
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +18 -8
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +42 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +55 -13
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +8 -6
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +12 -15
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +7 -1
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +69 -0
- package/src/surfaces.ts +7 -1
- package/src/table/cell-kinds.module.css +55 -0
- package/src/table/cell-kinds.module.css.d.ts +15 -0
- package/src/table/cell-kinds.tsx +263 -0
- package/src/table/data-table-fold.tsx +567 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +282 -3
- package/src/table/data-table.module.css.d.ts +16 -0
- package/src/table/data-table.tsx +430 -362
- package/src/table/table-features.ts +44 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
- package/src/theme/card-inset.module.css +35 -0
- package/src/theme/controls.module.css +55 -2
- package/src/theme/ctl-theme.tsx +8 -0
- package/src/theme/index.ts +12 -8
- package/src/tokens/core.ts +1 -0
- package/src/tokens/derive.ts +1 -1
- package/src/tokens/palette.ts +4 -1
|
@@ -125,6 +125,16 @@
|
|
|
125
125
|
stroke-linejoin: round;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
.ghostBand {
|
|
129
|
+
flex: 1 1 0;
|
|
130
|
+
min-width: 0;
|
|
131
|
+
align-self: stretch;
|
|
132
|
+
/* The loaded strip is one row above its axis labels: the row keeps their room. */
|
|
133
|
+
margin-bottom: var(--basalt-ghost-band-axis, 1.5rem);
|
|
134
|
+
border-radius: 3px;
|
|
135
|
+
background: color-mix(in srgb, var(--vx-ink) 18%, var(--vx-surface-panel));
|
|
136
|
+
}
|
|
137
|
+
|
|
128
138
|
.ghostBar {
|
|
129
139
|
flex: 1 1 0;
|
|
130
140
|
min-width: 0;
|
|
@@ -132,6 +142,46 @@
|
|
|
132
142
|
background: color-mix(in srgb, var(--vx-ink) 18%, var(--vx-surface-panel));
|
|
133
143
|
}
|
|
134
144
|
|
|
145
|
+
/*
|
|
146
|
+
* The empty body (SPEC § 6.11): a ring-edged tile (one inset ring, set inline in `state.tsx` so the divider ledger does not read it as a rule; card radius) filling the chart's
|
|
147
|
+
* own box, so the D37 height holds, with its copy centred: the title at `sm` 500, the size of the
|
|
148
|
+
* host's own title in every chart host, and one muted line. `EmptyState`'s section anatomy, in plain CSS
|
|
149
|
+
* because `src/charts/**` is Mantine-free.
|
|
150
|
+
*/
|
|
151
|
+
.emptyTile {
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
gap: var(--vx-space-stack-xs, 0.25rem);
|
|
158
|
+
width: 100%;
|
|
159
|
+
height: 100%;
|
|
160
|
+
padding: var(--vx-space-stack-md) var(--vx-space-stack-lg);
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
text-align: center;
|
|
163
|
+
border-radius: var(--vx-radius-card);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.emptyCopy {
|
|
167
|
+
display: flex;
|
|
168
|
+
flex-direction: column;
|
|
169
|
+
align-items: center;
|
|
170
|
+
gap: var(--vx-space-stack-xs, 0.25rem);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.emptyTitle {
|
|
174
|
+
font-size: var(--vx-text-sm);
|
|
175
|
+
font-weight: 500;
|
|
176
|
+
color: var(--vx-ink);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.emptyText {
|
|
180
|
+
max-width: 22.5rem;
|
|
181
|
+
font-size: var(--vx-text-sm);
|
|
182
|
+
color: var(--vx-muted);
|
|
183
|
+
}
|
|
184
|
+
|
|
135
185
|
/*
|
|
136
186
|
* The engine paints its tooltip rows as a grid of `.55rem | minmax(0, 1fr) | auto` with inline
|
|
137
187
|
* styles and `overflow-wrap: anywhere` on the card, so a narrow tooltip (a 390 viewport, a pointer
|
|
@@ -169,9 +219,16 @@
|
|
|
169
219
|
|
|
170
220
|
/* The engine focuses the plot's `svg.ts-chart` (tabindex 0), not the `.basalt-chart` wrapper
|
|
171
221
|
* `styles.css` rings, so the UA's `auto` ring paints (a 5px white double ring in dark): the same
|
|
172
|
-
* 2px accent ring
|
|
222
|
+
* 2px accent ring. The ring is INSET: an outer one is clipped by the card body's overflow at the
|
|
223
|
+
* plot's right and bottom edges (partial edges), an inset one is whole wherever the chart sits. */
|
|
173
224
|
:global(.basalt-chart .ts-chart:focus-visible) {
|
|
174
225
|
outline: 2px solid var(--vx-accent);
|
|
226
|
+
outline-offset: calc(-0.125rem * var(--mantine-scale));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* A Sparkline keeps the outer ring: its cell reserves the clearance (the readout chip and the end
|
|
230
|
+
* marker are placed against it) and an inset ring would cross the end marker. */
|
|
231
|
+
:global([data-basalt-sparkline] .basalt-chart .ts-chart:focus-visible) {
|
|
175
232
|
outline-offset: calc(0.125rem * var(--mantine-scale));
|
|
176
233
|
}
|
|
177
234
|
|
|
@@ -188,7 +245,7 @@
|
|
|
188
245
|
box-sizing: border-box;
|
|
189
246
|
width: max-content;
|
|
190
247
|
/* The line the cell reserves (1.125rem) less the focus ring's clearance (2px outline + 0.125rem offset) and 1px of air, so
|
|
191
|
-
* the chip sits clear of the ring and still inside the reserve. */
|
|
248
|
+
* the chip sits clear of the ring and still inside the reserve. The Sparkline's ring is the outer one. */
|
|
192
249
|
block-size: calc(1.125rem - 0.3125rem);
|
|
193
250
|
padding: 0 4px !important;
|
|
194
251
|
overflow: hidden;
|
|
@@ -11,6 +11,11 @@ declare const classes: {
|
|
|
11
11
|
readonly grow: string
|
|
12
12
|
readonly ghost: string
|
|
13
13
|
readonly ghostLine: string
|
|
14
|
+
readonly ghostBand: string
|
|
14
15
|
readonly ghostBar: string
|
|
16
|
+
readonly emptyTile: string
|
|
17
|
+
readonly emptyCopy: string
|
|
18
|
+
readonly emptyTitle: string
|
|
19
|
+
readonly emptyText: string
|
|
15
20
|
}
|
|
16
21
|
export default classes
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ChartCard's header inset, by the card's own inline size (W10 SSR contract). A card under 480px
|
|
3
|
-
* trims the header's top inset: the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* is CONTAINER_CLASSES.regular (`breakpoint-literals.test.ts`).
|
|
3
|
+
* trims the header's top inset: the chart below is sized by the 160–420px law, so a narrow card is
|
|
4
|
+
* a short one. Decided in CSS, not from a post-hydration height measurement, so the server HTML is
|
|
5
|
+
* the hydrated header. The literal is CONTAINER_CLASSES.regular (`breakpoint-literals.test.ts`).
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
.header {
|
|
@@ -16,13 +15,8 @@
|
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
/* A short card
|
|
20
|
-
*
|
|
21
|
-
/* (`data-basalt-chart-short` is written by `ChartBox`, `box.tsx`; the same `:is` is in
|
|
22
|
-
* `dashboard/widget-header.module.css`.) */
|
|
23
|
-
:is([data-basalt-card-short], [data-basalt-chart-card]:has([data-basalt-chart-short])) .header {
|
|
24
|
-
padding-top: 4px;
|
|
25
|
-
}
|
|
18
|
+
/* A short card keeps this inset too, so its title shares a baseline with a tall neighbour in the
|
|
19
|
+
* row; its other short-state rules (the folded subtitle) live in `dashboard/widget-header.module.css`. */
|
|
26
20
|
|
|
27
21
|
/*
|
|
28
22
|
* The facts line (`facts` prop): the headline figure under the title, in place of a subtitle. It wraps
|
|
@@ -72,26 +66,34 @@
|
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
/*
|
|
75
|
-
* A fact's tone is INK only (
|
|
76
|
-
*
|
|
69
|
+
* A fact's tone is INK only (never a fill) and rides the DELTA alone: the comparison, with its direction
|
|
70
|
+
* glyph. The value, unit and period stay ink and muted. A fact with no comparison has no delta, so its
|
|
71
|
+
* tone inks the value (`.factTone` is on whichever element carries it). The status solids are the
|
|
72
|
+
* text-safe ones (`status-text.ts`). `stale` is the strip cell's dimmed value, verbatim
|
|
77
73
|
* (`stat-strip.module.css` `.cell[data-stale]`).
|
|
78
74
|
*/
|
|
79
|
-
.fact[data-tone='good']
|
|
75
|
+
.fact[data-tone='good'] .factTone {
|
|
80
76
|
color: var(--vx-status-good);
|
|
81
77
|
}
|
|
82
78
|
|
|
83
|
-
.fact[data-tone='warn']
|
|
79
|
+
.fact[data-tone='warn'] .factTone {
|
|
84
80
|
color: var(--vx-status-warn);
|
|
85
81
|
}
|
|
86
82
|
|
|
87
|
-
.fact[data-tone='bad']
|
|
83
|
+
.fact[data-tone='bad'] .factTone {
|
|
88
84
|
color: var(--vx-status-bad);
|
|
89
85
|
}
|
|
90
86
|
|
|
91
|
-
.fact[data-tone='muted']
|
|
87
|
+
.fact[data-tone='muted'] .factTone {
|
|
92
88
|
color: var(--vx-muted);
|
|
93
89
|
}
|
|
94
90
|
|
|
91
|
+
/* The direction glyph of a plain-text comparison: DeltaBadge's (`widget-header.module.css` `.deltaGlyph`). */
|
|
92
|
+
.factGlyph {
|
|
93
|
+
margin-inline-end: 3px;
|
|
94
|
+
font-size: var(--vx-text-micro);
|
|
95
|
+
}
|
|
96
|
+
|
|
95
97
|
.factsRow[data-stale] {
|
|
96
98
|
opacity: 0.55;
|
|
97
99
|
}
|
|
@@ -129,3 +131,12 @@
|
|
|
129
131
|
border-radius: 3px;
|
|
130
132
|
background: color-mix(in srgb, var(--vx-ink) 18%, var(--vx-surface-panel));
|
|
131
133
|
}
|
|
134
|
+
|
|
135
|
+
/* A pending `BandStrip` card keeps the room of the legend row the loaded strip carries under its box:
|
|
136
|
+
* the chart root's 6px gap plus one legend line (`micro` x 1.35 and the 2px entry border, `legend.tsx`).
|
|
137
|
+
* The legend shows from 240px, the same container class the chart picks it by. */
|
|
138
|
+
@container basalt-card (min-width: 240px) {
|
|
139
|
+
.legendReserve {
|
|
140
|
+
padding-bottom: calc(6px + var(--vx-text-micro) * 1.35 + 2px);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -11,7 +11,10 @@ declare const classes: {
|
|
|
11
11
|
readonly factValue: string
|
|
12
12
|
readonly factUnit: string
|
|
13
13
|
readonly factPeriod: string
|
|
14
|
+
readonly factTone: string
|
|
15
|
+
readonly factGlyph: string
|
|
14
16
|
readonly skeletonFigure: string
|
|
15
17
|
readonly skeletonBasis: string
|
|
18
|
+
readonly legendReserve: string
|
|
16
19
|
}
|
|
17
20
|
export default classes
|
package/dist/charts/compile.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export declare function dayGranular(values: readonly ChartX[]): boolean;
|
|
|
129
129
|
* `top`, so each write is followed by a settle inside the card (`settleInCard`).
|
|
130
130
|
*/
|
|
131
131
|
/** What a card clamp does: `card` a chart tooltip (both axes, the card's width), `slot` a slotted
|
|
132
|
-
* `Bars` chip (flush above its plot), `strip` a `BandStrip`'s (sideways
|
|
132
|
+
* `Bars` chip (flush above its plot), `strip` a `BandStrip`'s (sideways, and below the x tick labels when it opens under the strip). */
|
|
133
133
|
type TipMode = 'card' | 'slot' | 'strip';
|
|
134
134
|
/**
|
|
135
135
|
* Keeps a tooltip inside its card on both axes. A card with room lets the tooltip grow up to its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/charts/compile.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAEV,iCAAiC,EAClC,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAGV,aAAa,EAEb,yBAAyB,EACzB,eAAe,IAAI,gBAAgB,EACnC,UAAU,EACV,yBAAyB,EAE1B,MAAM,6BAA6B,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/charts/compile.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAEV,iCAAiC,EAClC,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAGV,aAAa,EAEb,yBAAyB,EACzB,eAAe,IAAI,gBAAgB,EACnC,UAAU,EACV,yBAAyB,EAE1B,MAAM,6BAA6B,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAQ5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EAEnB,WAAW,EACX,eAAe,EACf,MAAM,EAEN,OAAO,EAEP,QAAQ,EACT,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAE/F,gGAAgG;AAChG,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,IAAI,CACpD,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvB,MAAM,GACN,GAAG,GACH,QAAQ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AAC,EAAE,GACjC,aAAa,GAAG,IAAI,CAuBtB;AA2aD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAO9D;AAsID;;;;;GAKG;AACH;wIACwI;AACxI,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AA2BxC;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,iCAAiC,EACtC,IAAI,GAAE,OAAgB,GACrB,IAAI,CA0FN;AA0ED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAClD,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,mBAAmB,CA2HrB"}
|
package/dist/charts/compile.js
CHANGED
|
@@ -15,7 +15,8 @@ import { cursorBinding, followerOptions, quietWhileFollowing } from "./cursor.js
|
|
|
15
15
|
import { cursorDots } from "./marks.js";
|
|
16
16
|
import { bucketTicks, strideEvery } from "./ticks.js";
|
|
17
17
|
import { MAIN_PANE, plotAccess, plotContext } from "./plot-context.js";
|
|
18
|
-
import {
|
|
18
|
+
import { claimedLabelBoxes } from "./labels.js";
|
|
19
|
+
import { refLabelDy, refLabelPosition } from "./ref-label.js";
|
|
19
20
|
import { resolveContainerClass } from "../tokens/size-classes.js";
|
|
20
21
|
import { resolveYDomain, xScaleFor, xZoneFractions, yScaleFor } from "./scales.js";
|
|
21
22
|
import { AXIS_LINE, CHART_THEME, CROSSHAIR, DASH, GRID_LINE } from "./theme.js";
|
|
@@ -133,15 +134,15 @@ function wholeStepFormat(axis, cfg, ticks) {
|
|
|
133
134
|
return (v) => axis.format(v).replace(padded, "$1");
|
|
134
135
|
}
|
|
135
136
|
const END_TICK_MIN_GAP = 0.4;
|
|
137
|
+
const labelShape = (label) => label.replace(/[\p{Nd}.,\s]/gu, "");
|
|
136
138
|
function withEndTick(cfg, axis, count) {
|
|
137
139
|
if (!Array.isArray(cfg?.domain) || cfg.scale === "log" || cfg.nice === true) return null;
|
|
138
140
|
const [lo, hi] = [Math.min(...axis.domain), Math.max(...axis.domain)];
|
|
139
141
|
const round = scaleLinear().domain([lo, hi]).ticks(count);
|
|
140
|
-
const last = round.at(-1);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return hi - last >= (next - first) * END_TICK_MIN_GAP ? { values: [...round, hi] } : null;
|
|
142
|
+
const [first, next, last] = [round.at(0), round.at(1), round.at(-1)];
|
|
143
|
+
if (first === void 0 || next === void 0 || last === void 0 || last >= hi) return null;
|
|
144
|
+
if (hi - last < (next - first) * END_TICK_MIN_GAP) return null;
|
|
145
|
+
return labelShape(axis.format(hi)) === labelShape(axis.format(last)) ? null : { values: [...round, hi] };
|
|
145
146
|
}
|
|
146
147
|
function yGuide(opts) {
|
|
147
148
|
const { cfg, axis, cls, side, grid } = opts;
|
|
@@ -440,8 +441,6 @@ function underlayMarks(input, model, axes) {
|
|
|
440
441
|
}
|
|
441
442
|
const BAR_BODY = 0.8;
|
|
442
443
|
const REF_LABEL_DX = 6;
|
|
443
|
-
const REF_LABEL_DY_ABOVE = -5;
|
|
444
|
-
const REF_LABEL_DY_BELOW = 11;
|
|
445
444
|
const refLabelMark = (r, i, ctx) => {
|
|
446
445
|
const { axes } = ctx;
|
|
447
446
|
const startFirst = r.axis === "right" && axes.scaleId(r.axis) === "y2";
|
|
@@ -454,7 +453,8 @@ const refLabelMark = (r, i, ctx) => {
|
|
|
454
453
|
plotHeight: ctx.plotHeight,
|
|
455
454
|
label: r.label ?? "",
|
|
456
455
|
fontSize: VX.text.micro,
|
|
457
|
-
series: ctx.lines(r.axis)
|
|
456
|
+
series: ctx.lines(r.axis),
|
|
457
|
+
claimed: startFirst ? [] : ctx.claimed
|
|
458
458
|
});
|
|
459
459
|
const atStart = position.startsWith("start");
|
|
460
460
|
return decorative(
|
|
@@ -469,7 +469,7 @@ const refLabelMark = (r, i, ctx) => {
|
|
|
469
469
|
fontSize: VX.text.micro,
|
|
470
470
|
anchor: atStart ? "start" : "end",
|
|
471
471
|
dx: atStart ? REF_LABEL_DX : -REF_LABEL_DX,
|
|
472
|
-
dy: position.
|
|
472
|
+
dy: refLabelDy(position, VX.text.micro)
|
|
473
473
|
})
|
|
474
474
|
);
|
|
475
475
|
};
|
|
@@ -602,6 +602,7 @@ const stripAnchor = (points, { plot }) => {
|
|
|
602
602
|
};
|
|
603
603
|
const STRIP_TOOLTIP_PLACEMENT = ["bottom", "top"];
|
|
604
604
|
const STRIP_TOOLTIP_OFFSET = 8;
|
|
605
|
+
const STRIP_TICK_AIR = 2;
|
|
605
606
|
const slotAnchor = (points, { plot }) => {
|
|
606
607
|
const xs = points.map((p) => p.x);
|
|
607
608
|
return { x: (Math.min(...xs) + Math.max(...xs)) / 2, y: plot.y };
|
|
@@ -626,6 +627,7 @@ const barAnchor = (rows) => (points, { plot }) => {
|
|
|
626
627
|
};
|
|
627
628
|
const TIP_CARD = "[data-basalt-chart-card], [data-strip-cell], .mantine-Card-root";
|
|
628
629
|
const TIP_CARD_AIR = 4;
|
|
630
|
+
const TIP_DOT_AIR = 10;
|
|
629
631
|
const TIP_CARD_ROOMY = 192;
|
|
630
632
|
const cardPortal = (mode) => ({
|
|
631
633
|
id: portal.id,
|
|
@@ -670,6 +672,8 @@ function settleInCard(tip, within, ctx, mode = "card") {
|
|
|
670
672
|
if (w0 + 2 * TIP_CARD_AIR <= card.width)
|
|
671
673
|
left = Math.min(Math.max(left, card.left + TIP_CARD_AIR), card.right - w0 - TIP_CARD_AIR);
|
|
672
674
|
if (Math.abs(left - Number.parseFloat(tip.style.left)) > 0.5) tip.style.left = `${left}px`;
|
|
675
|
+
const clear = surface.bottom + STRIP_TICK_AIR;
|
|
676
|
+
if (tip.dataset["placement"] === "bottom" && top < clear) tip.style.top = `${clear}px`;
|
|
673
677
|
return;
|
|
674
678
|
}
|
|
675
679
|
const roomy = card.width >= TIP_CARD_ROOMY;
|
|
@@ -689,6 +693,11 @@ function settleInCard(tip, within, ctx, mode = "card") {
|
|
|
689
693
|
const [w, h] = [tip.offsetWidth, tip.offsetHeight];
|
|
690
694
|
const anchor = toClient(ctx.anchor);
|
|
691
695
|
const gap = Math.max(0, Number.isFinite(ctx.offset) ? ctx.offset ?? 10 : 10);
|
|
696
|
+
const margin = ctx.scene.margin ?? { top: 0, right: 0, bottom: 0, left: 0 };
|
|
697
|
+
const plotTL = toClient({ x: margin.left, y: margin.top });
|
|
698
|
+
const plotBR = toClient({ x: sceneW - margin.right, y: sceneH - margin.bottom });
|
|
699
|
+
const fenceX = !slot && plotBR.x - plotTL.x >= w + TIP_DOT_AIR;
|
|
700
|
+
const fenceY = !slot && plotBR.y - plotTL.y >= h;
|
|
692
701
|
const maxTop = card.bottom - TIP_CARD_AIR - h;
|
|
693
702
|
const headerBottom = slot ? void 0 : within.closest(TIP_CARD)?.querySelector("[data-basalt-facts]")?.parentElement?.getBoundingClientRect().bottom;
|
|
694
703
|
const belowHeader = headerBottom === void 0 ? void 0 : headerBottom + TIP_CARD_AIR;
|
|
@@ -707,6 +716,8 @@ function settleInCard(tip, within, ctx, mode = "card") {
|
|
|
707
716
|
if (roomy) left = anchor.x - w / 2;
|
|
708
717
|
}
|
|
709
718
|
if (!slot) top = maxTop < minTop ? minTop : Math.min(Math.max(top, minTop), maxTop);
|
|
719
|
+
if (fenceY) top = Math.min(Math.max(top, plotTL.y), plotBR.y - h);
|
|
720
|
+
if (fenceX) left = Math.min(Math.max(left, plotTL.x + TIP_DOT_AIR), plotBR.x - w);
|
|
710
721
|
if (grown || w + 2 * TIP_CARD_AIR <= card.width)
|
|
711
722
|
left = Math.min(
|
|
712
723
|
Math.max(left, card.left + TIP_CARD_AIR),
|
|
@@ -800,24 +811,23 @@ function compileCartesian(input) {
|
|
|
800
811
|
const cls = resolveContainerClass(width);
|
|
801
812
|
const axes = axesAt(cls);
|
|
802
813
|
const access = plotAccess(definition, input.plot, MAIN_PANE);
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
access
|
|
819
|
-
)
|
|
814
|
+
const plot = plotContext(
|
|
815
|
+
{
|
|
816
|
+
rows,
|
|
817
|
+
visible,
|
|
818
|
+
highlighted: input.highlighted ?? null,
|
|
819
|
+
containerClass: cls,
|
|
820
|
+
width,
|
|
821
|
+
height,
|
|
822
|
+
data: input.data,
|
|
823
|
+
xFraction: model.fraction,
|
|
824
|
+
y2: axes.right ? "y2" : void 0,
|
|
825
|
+
yDomain: axes.left.domain,
|
|
826
|
+
y2Domain: axes.right?.domain
|
|
827
|
+
},
|
|
828
|
+
access
|
|
820
829
|
);
|
|
830
|
+
const kindMarks = input.marks(plot);
|
|
821
831
|
const under = underlayMarks(input, model, axes);
|
|
822
832
|
const over = refLineMarks(input, axes, () => {
|
|
823
833
|
access.read();
|
|
@@ -826,6 +836,7 @@ function compileCartesian(input) {
|
|
|
826
836
|
plotWidth: size?.width ?? width,
|
|
827
837
|
plotHeight: size?.height ?? height,
|
|
828
838
|
lines: linesOn,
|
|
839
|
+
claimed: claimedLabelBoxes(plot),
|
|
829
840
|
axes,
|
|
830
841
|
model
|
|
831
842
|
};
|
package/dist/charts/labels.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LabelBox } from './ref-label.js';
|
|
1
2
|
import type { ChartMarks, ChartSeries, ChartX, PlotContext, PlotRow } from './types.js';
|
|
2
3
|
export type EndLabelAnchor = 'start' | 'end';
|
|
3
4
|
/** Which side of its line a flipped label sits: away from the line's last segment. */
|
|
@@ -23,13 +24,20 @@ export type EndLabel<T, X extends ChartX> = {
|
|
|
23
24
|
anchor: EndLabelAnchor;
|
|
24
25
|
/** Only a flipped label (left of its point) can meet its own line; it takes the clear side. */
|
|
25
26
|
side: EndLabelSide;
|
|
26
|
-
/** A vertical shift in px (negative is up) that keeps this label clear of its neighbours. */
|
|
27
|
+
/** A vertical shift in px (negative is up) that keeps this label clear of its neighbours and the lines. */
|
|
27
28
|
nudge: number;
|
|
29
|
+
/** The room the drawn label takes, for a reference caption to keep clear of. */
|
|
30
|
+
box: LabelBox;
|
|
28
31
|
};
|
|
32
|
+
/** Records the boxes the end labels of `plot` take (once per plot, by `Lines`). */
|
|
33
|
+
export declare function claimLabelBoxes(plot: object, boxes: readonly LabelBox[]): void;
|
|
34
|
+
/** The boxes {@link claimLabelBoxes} recorded for `plot`: what a reference caption avoids. */
|
|
35
|
+
export declare function claimedLabelBoxes(plot: object): readonly LabelBox[];
|
|
29
36
|
/**
|
|
30
37
|
* Pushes labels apart: `ys` are the labels' heights in px from the plot's bottom, returned as the
|
|
31
38
|
* shift each needs (positive is up) so no two sit closer than {@link END_LABEL_MIN_GAP} and the
|
|
32
|
-
* lowest and the topmost stay {@link END_LABEL_EDGE} inside the plot
|
|
39
|
+
* lowest and the topmost stay {@link END_LABEL_EDGE} inside the plot; a stack too tall for the plot
|
|
40
|
+
* shrinks its gap to fit. Order is kept.
|
|
33
41
|
*/
|
|
34
42
|
export declare function spreadLabels(ys: readonly number[], plotHeight: number): number[];
|
|
35
43
|
/**
|
|
@@ -39,7 +47,9 @@ export declare function spreadLabels(ys: readonly number[], plotHeight: number):
|
|
|
39
47
|
* dropped. A series whose last point the plot's own x scale cannot place, or places outside the plot
|
|
40
48
|
* (`plot.xFraction` outside [0, 1]: clipped by a narrower `xDomain`), has no label.
|
|
41
49
|
*/
|
|
42
|
-
export declare function endLabelPlan<T, X extends ChartX>(plot: PlotContext<T, X>, lines: readonly ChartSeries<T>[], naming?: LinesNaming
|
|
50
|
+
export declare function endLabelPlan<T, X extends ChartX>(plot: PlotContext<T, X>, lines: readonly ChartSeries<T>[], naming?: LinesNaming,
|
|
51
|
+
/** The values of the reference lines on the left axis: rules a label must not sit on. */
|
|
52
|
+
rules?: readonly number[]): EndLabel<T, X>[];
|
|
43
53
|
/** The offset of a label from its point: right of it, level; or left of it, above or below. */
|
|
44
54
|
export declare function endLabelOffset(anchor: EndLabelAnchor, side?: EndLabelSide): {
|
|
45
55
|
dx: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/charts/labels.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/charts/labels.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAA;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AA6BpF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,CAAA;AAC5C,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,CAAA;AAE5C;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,GAAG,cAAc,CAIjB;AAED,wDAAwD;AACxD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEzD,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI;IAC1C,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;IACtB,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,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ative";
|
|
2
2
|
import { text } from "@tanstack/charts/text";
|
|
3
3
|
import { VX } from "../tokens/index.js";
|
|
4
|
+
import { yRangeWithin } from "./ref-label.js";
|
|
4
5
|
import { rowX } from "./types.js";
|
|
5
6
|
const MAX_END_LABELS = 3;
|
|
6
|
-
const END_LABEL_MIN_GAP =
|
|
7
|
+
const END_LABEL_MIN_GAP = 17;
|
|
7
8
|
const END_LABEL_DX = 6;
|
|
8
9
|
const END_LABEL_GLYPH_EM = 0.85;
|
|
9
10
|
const END_LABEL_FLIP_DY = -9;
|
|
10
11
|
const END_LABEL_FLIP_DY_BELOW = 13;
|
|
11
12
|
const END_LABEL_EDGE = 7;
|
|
13
|
+
const BOX_GLYPH_EM = 0.68;
|
|
14
|
+
const BOX_INK = 0.75;
|
|
15
|
+
const LINE_AIR = 4.5;
|
|
16
|
+
const CROSSED_PENALTY = 100;
|
|
17
|
+
const MAX_SIDE_SEARCH = 5;
|
|
12
18
|
function endLabelAnchor(opts) {
|
|
13
19
|
const { fraction, plotWidth, label, fontSize } = opts;
|
|
14
20
|
const room = (1 - fraction) * plotWidth;
|
|
15
21
|
return room >= label.length * fontSize * END_LABEL_GLYPH_EM + END_LABEL_DX ? "start" : "end";
|
|
16
22
|
}
|
|
23
|
+
const claimedBoxes = /* @__PURE__ */ new WeakMap();
|
|
24
|
+
function claimLabelBoxes(plot, boxes) {
|
|
25
|
+
claimedBoxes.set(plot, boxes);
|
|
26
|
+
}
|
|
27
|
+
function claimedLabelBoxes(plot) {
|
|
28
|
+
return claimedBoxes.get(plot) ?? [];
|
|
29
|
+
}
|
|
17
30
|
function spreadLabels(ys, plotHeight) {
|
|
18
31
|
const order = ys.map((y, i) => i).toSorted((a, b) => ys[a] - ys[b]);
|
|
19
32
|
const placed = /* @__PURE__ */ new Map();
|
|
33
|
+
const room = Math.max(plotHeight - 2 * END_LABEL_EDGE, 0);
|
|
34
|
+
const gap = ys.length > 1 ? Math.min(END_LABEL_MIN_GAP, room / (ys.length - 1)) : END_LABEL_MIN_GAP;
|
|
20
35
|
let floor = END_LABEL_EDGE;
|
|
21
36
|
for (const i of order) {
|
|
22
37
|
const at = Math.max(ys[i], floor);
|
|
23
38
|
placed.set(i, at);
|
|
24
|
-
floor = at +
|
|
39
|
+
floor = at + gap;
|
|
25
40
|
}
|
|
26
41
|
const top = plotHeight - END_LABEL_EDGE;
|
|
27
42
|
let ceiling = Infinity;
|
|
28
43
|
for (const i of order.toReversed()) {
|
|
29
44
|
const at = Math.min(placed.get(i), ceiling, top);
|
|
30
45
|
placed.set(i, at);
|
|
31
|
-
ceiling = at -
|
|
46
|
+
ceiling = at - gap;
|
|
32
47
|
}
|
|
33
48
|
return ys.map((y, i) => placed.get(i) - y);
|
|
34
49
|
}
|
|
35
|
-
function endLabelPlan(plot, lines, naming = "auto") {
|
|
50
|
+
function endLabelPlan(plot, lines, naming = "auto", rules = []) {
|
|
36
51
|
if (naming === "legend" || plot.y2 !== void 0 || lines.length === 0) return [];
|
|
37
52
|
if (naming === "auto" && (plot.containerClass !== "wide" || lines.length > MAX_END_LABELS))
|
|
38
53
|
return [];
|
|
@@ -45,28 +60,122 @@ function endLabelPlan(plot, lines, naming = "auto") {
|
|
|
45
60
|
return [{ series, row, y: row.y, fraction, prev: finite.at(-2)?.y ?? null }];
|
|
46
61
|
});
|
|
47
62
|
const [lo, hi] = plot.yDomain;
|
|
48
|
-
const
|
|
49
|
-
|
|
63
|
+
const anchors = last.map(
|
|
64
|
+
({ series, fraction }) => endLabelAnchor({
|
|
50
65
|
fraction,
|
|
51
66
|
plotWidth: plot.plotWidth,
|
|
52
67
|
label: series.label,
|
|
53
68
|
fontSize: VX.text.micro
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
const falls = last.map(({ y, prev }) => prev !== null && prev > y);
|
|
72
|
+
const flipped = last.flatMap((_, i) => anchors[i] === "end" ? [i] : []);
|
|
73
|
+
const lineY = (i) => last[i].y;
|
|
74
|
+
const sameWay = flipped.length > 1 && flipped.every((i) => falls[i] === falls[flipped[0]]);
|
|
75
|
+
const wrapped = sameWay ? flipped.toSorted((a, b) => lineY(a) - lineY(b)) : [];
|
|
76
|
+
const outlier = falls[flipped[0]] ? wrapped[0] : wrapped.at(-1);
|
|
77
|
+
const preferred = last.map((_, i) => {
|
|
78
|
+
const fall = falls[i];
|
|
79
|
+
return sameWay && anchors[i] === "end" ? i === outlier === fall ? "below" : "above" : fall ? "below" : "above";
|
|
80
|
+
});
|
|
81
|
+
const toPx = (y) => (y - lo) / (hi - lo || 1) * plot.plotHeight;
|
|
82
|
+
const nominal = (i, side) => toPx(lineY(i)) - endLabelOffset(anchors[i], side).dy;
|
|
83
|
+
const half = VX.text.micro * BOX_INK / 2;
|
|
84
|
+
const plotW = Math.max(plot.plotWidth, 1);
|
|
85
|
+
const spans = last.map(({ series, fraction }, i) => {
|
|
86
|
+
const room = (END_LABEL_DX + series.label.length * VX.text.micro * BOX_GLYPH_EM) / plotW;
|
|
87
|
+
const edge = END_LABEL_DX / plotW;
|
|
88
|
+
return anchors[i] === "end" ? [fraction - room, fraction - edge] : [fraction + edge, fraction + room];
|
|
58
89
|
});
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
plot.
|
|
90
|
+
const from = Math.min(...spans.map(([x0]) => x0));
|
|
91
|
+
const obstacles = [
|
|
92
|
+
...plot.visible.map((s) => {
|
|
93
|
+
const pts = [];
|
|
94
|
+
let before;
|
|
95
|
+
for (const r of plot.rows(s.key)) {
|
|
96
|
+
const fx = r.y === null ? null : plot.xFraction(r.x);
|
|
97
|
+
if (fx === null || r.y === null) continue;
|
|
98
|
+
const pt = { fx, y: toPx(r.y) };
|
|
99
|
+
if (fx < from) before = pt;
|
|
100
|
+
else {
|
|
101
|
+
if (before !== void 0) pts.push(before);
|
|
102
|
+
before = void 0;
|
|
103
|
+
pts.push(pt);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (before !== void 0) pts.push(before);
|
|
107
|
+
return pts;
|
|
108
|
+
}),
|
|
109
|
+
...rules.map((v) => [
|
|
110
|
+
{ fx: 0, y: toPx(v) },
|
|
111
|
+
{ fx: 1, y: toPx(v) }
|
|
112
|
+
])
|
|
113
|
+
];
|
|
114
|
+
const windowRanges = spans.map(
|
|
115
|
+
([x0, x1]) => obstacles.flatMap((pts) => {
|
|
116
|
+
const range = yRangeWithin(pts, x0, x1);
|
|
117
|
+
return range === null ? [] : [range];
|
|
118
|
+
})
|
|
62
119
|
);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
120
|
+
const ranges = (i) => windowRanges[i];
|
|
121
|
+
const cleared = (i, side, start) => {
|
|
122
|
+
const blockers = ranges(i);
|
|
123
|
+
let c = start;
|
|
124
|
+
for (let n = 0; n <= blockers.length; n++) {
|
|
125
|
+
const hit = blockers.find(([a, b]) => b + LINE_AIR > c - half && a - LINE_AIR < c + half);
|
|
126
|
+
if (hit === void 0) break;
|
|
127
|
+
c = side === "above" ? hit[1] + LINE_AIR + half : hit[0] - LINE_AIR - half;
|
|
128
|
+
}
|
|
129
|
+
return c;
|
|
130
|
+
};
|
|
131
|
+
const airOf = (i, c) => Math.min(
|
|
132
|
+
Number.POSITIVE_INFINITY,
|
|
133
|
+
...ranges(i).map(([a, b]) => Math.max(a - (c + half), c - half - b))
|
|
134
|
+
);
|
|
135
|
+
const place = (sides) => {
|
|
136
|
+
const start = last.map(
|
|
137
|
+
(_, i) => cleared(i, sides[i], nominal(i, sides[i]))
|
|
138
|
+
);
|
|
139
|
+
const shifts = spreadLabels(start, plot.plotHeight);
|
|
140
|
+
const centres = start.map((c, i) => c + shifts[i]);
|
|
141
|
+
const crossed = centres.filter((c, i) => {
|
|
142
|
+
const end = toPx(lineY(i));
|
|
143
|
+
return rules.some(
|
|
144
|
+
(v) => (toPx(v) - c) * (toPx(v) - end) < 0 && (c - end) * (toPx(v) - end) > 0
|
|
145
|
+
);
|
|
146
|
+
}).length;
|
|
147
|
+
const score = centres.reduce((sum, c, i) => sum + Math.min(airOf(i, c), LINE_AIR), 0) - CROSSED_PENALTY * crossed;
|
|
148
|
+
return { sides, centres, score };
|
|
149
|
+
};
|
|
150
|
+
const options = flipped.length <= MAX_SIDE_SEARCH ? flipped.length : 0;
|
|
151
|
+
let best = place(preferred);
|
|
152
|
+
for (let mask = 1; mask < 1 << options; mask++) {
|
|
153
|
+
const sides = preferred.map((side, i) => {
|
|
154
|
+
const at = flipped.indexOf(i);
|
|
155
|
+
return at >= 0 && mask >> at & 1 ? side === "above" ? "below" : "above" : side;
|
|
156
|
+
});
|
|
157
|
+
const trial = place(sides);
|
|
158
|
+
if (trial.score > best.score + 0.01) best = trial;
|
|
159
|
+
}
|
|
160
|
+
return last.map(({ series, row }, i) => {
|
|
161
|
+
const side = best.sides[i];
|
|
162
|
+
const centre = best.centres[i];
|
|
163
|
+
const [x0, x1] = spans[i];
|
|
164
|
+
const perPx = (hi - lo) / (plot.plotHeight || 1);
|
|
165
|
+
return {
|
|
166
|
+
series,
|
|
167
|
+
row,
|
|
168
|
+
anchor: anchors[i],
|
|
169
|
+
side,
|
|
170
|
+
nudge: nominal(i, side) - centre,
|
|
171
|
+
box: {
|
|
172
|
+
fx0: x0 - 2 / plotW,
|
|
173
|
+
fx1: x1 + 2 / plotW,
|
|
174
|
+
y0: lo + (centre - half - 2) * perPx,
|
|
175
|
+
y1: lo + (centre + half + 2) * perPx
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
});
|
|
70
179
|
}
|
|
71
180
|
function endLabelOffset(anchor, side = "above") {
|
|
72
181
|
if (anchor === "start") return { dx: END_LABEL_DX, dy: 0 };
|
|
@@ -90,6 +199,8 @@ function endLabelMarks(plan) {
|
|
|
90
199
|
);
|
|
91
200
|
}
|
|
92
201
|
export {
|
|
202
|
+
claimLabelBoxes,
|
|
203
|
+
claimedLabelBoxes,
|
|
93
204
|
endLabelAnchor,
|
|
94
205
|
endLabelMarks,
|
|
95
206
|
endLabelOffset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/charts/legend.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAelD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAC7B,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EACjC,MAAM,EAAE,OAAO,GACd,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAOpB;AA+DD;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAWrF;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;;CAGd,CAAA;
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/charts/legend.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAelD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAC7B,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EACjC,MAAM,EAAE,OAAO,GACd,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAOpB;AA+DD;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAWrF;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;;CAGd,CAAA;AAwDV,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,MAAM,EAAE,SAAS,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACzC,kGAAkG;IAClG,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAcD,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CAsF9E"}
|
package/dist/charts/legend.js
CHANGED
|
@@ -88,7 +88,7 @@ function LineSwatch({ s, compact }) {
|
|
|
88
88
|
y1: 4,
|
|
89
89
|
y2: 4,
|
|
90
90
|
stroke: s.color,
|
|
91
|
-
strokeWidth: 2,
|
|
91
|
+
strokeWidth: s.role === "reference" ? 1 : 2,
|
|
92
92
|
strokeLinecap: s.dash === "dashed" ? "butt" : "round",
|
|
93
93
|
strokeOpacity: s.strokeOpacity ?? 1,
|
|
94
94
|
...s.dash === "dashed" && { strokeDasharray: dash }
|