@antadesign/anta 0.3.32 → 0.3.34
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/avatar-core.d.ts +7 -2
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +48 -58
- package/dist/components/Breadcrumbs.d.ts +0 -1
- package/dist/components/Breadcrumbs.js +0 -1
- package/dist/components/Button.d.ts +2 -3
- package/dist/components/Input.d.ts +9 -3
- package/dist/components/Input.js +2 -0
- package/dist/components/InputDate.d.ts +0 -1
- package/dist/components/InputDate.js +0 -1
- package/dist/components/Select.d.ts +0 -1
- package/dist/components/Select.js +0 -1
- package/dist/components/SelectFaceted.d.ts +0 -1
- package/dist/components/SelectFaceted.js +0 -1
- package/dist/components/Slider.d.ts +22 -10
- package/dist/components/Slider.js +9 -5
- package/dist/components/Steps.d.ts +0 -1
- package/dist/components/Steps.js +0 -1
- package/dist/components/Tabs.js +2 -1
- package/dist/components/Title.d.ts +3 -1
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-avatar.js +2 -28
- package/dist/elements/a-breadcrumbs.d.ts +1 -0
- package/dist/elements/a-breadcrumbs.js +1 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +8 -6
- package/dist/elements/a-button.js +2 -4
- package/dist/elements/a-dialog.js +3 -1
- package/dist/elements/a-input-date.d.ts +1 -0
- package/dist/elements/a-input-date.js +1 -0
- package/dist/elements/a-input-time.js +1 -2
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +13 -10
- package/dist/elements/a-menu.d.ts +1 -1
- package/dist/elements/a-menu.js +17 -4
- package/dist/elements/a-select-faceted.d.ts +1 -0
- package/dist/elements/a-select-faceted.js +1 -0
- package/dist/elements/a-select.d.ts +1 -0
- package/dist/elements/a-select.js +1 -0
- package/dist/elements/a-slider.d.ts +7 -5
- package/dist/elements/a-slider.js +256 -59
- package/dist/elements/a-steps.d.ts +1 -0
- package/dist/elements/a-steps.js +1 -0
- package/dist/elements/a-tabpanel.d.ts +2 -2
- package/dist/elements/a-tabpanel.js +13 -3
- package/dist/elements/a-tag.d.ts +1 -0
- package/dist/elements/a-tag.js +1 -0
- package/dist/elements/a-title.d.ts +1 -0
- package/dist/elements/a-title.js +1 -0
- package/dist/elements/index.d.ts +7 -1
- package/dist/elements/index.js +4 -0
- package/dist/general_types.d.ts +9 -4
- package/dist/index.d.ts +1 -1
- package/dist/theme-antithesis.css +1 -1
- package/dist/theme-antune.css +1 -1
- package/docs/changelog.md +61 -0
- package/docs/components/breadcrumbs.md +9 -6
- package/docs/components/button.md +9 -6
- package/docs/components/input.md +29 -9
- package/docs/components/panel.md +3 -2
- package/docs/components/select-faceted.md +19 -19
- package/docs/components/slider.md +139 -4
- package/docs/components/steps.md +4 -2
- package/docs/install-config.md +295 -87
- package/docs/packages/plot.md +222 -20
- package/docs/theming.md +22 -13
- package/package.json +7 -4
package/docs/packages/plot.md
CHANGED
|
@@ -396,7 +396,7 @@ function presentation(): PlotArgs<Node> {
|
|
|
396
396
|
return {
|
|
397
397
|
series: [scatter<Node>({ data: examplePoints, size: 3,
|
|
398
398
|
color: { light: '#9ca3af', dark: '#6b7280' }, hoverable: false })],
|
|
399
|
-
title: { text: 'Plot title', size: 16, color: { light: '#374151', dark: '#e5e7eb' } },
|
|
399
|
+
title: { text: 'Plot title', font: { size: 16, color: { light: '#374151', dark: '#e5e7eb' } } },
|
|
400
400
|
height: 260,
|
|
401
401
|
margin: { top: 38, right: 16, bottom: 42, left: 52 },
|
|
402
402
|
background: { light: '#f3f4f6', dark: '#202124' },
|
|
@@ -451,7 +451,8 @@ document.body.append(plot)
|
|
|
451
451
|
|---|---|---|---|
|
|
452
452
|
| [`series`](#series) | `Series[]` | Required | What to draw, in paint order. Build each one with a factory. |
|
|
453
453
|
| [`axis?`](#axes) | `{ x?: AxisArgs, y?: AxisArgs }` | Inferred from data | Per-axis scale, label, ticks, and domain. |
|
|
454
|
-
| [`title?`](#title) | `string \| { text,
|
|
454
|
+
| [`title?`](#title) | `string \| { text, font? }` | None | Plot title. |
|
|
455
|
+
| [`font?`](#font) | `FontArg` | Role defaults | Shared font configuration. |
|
|
455
456
|
| `width?` | `number` | Container width | Canvas width in pixels. Overrides the wrapper's CSS width. |
|
|
456
457
|
| `height?` | `number` | Parent height for `Plot`; `300` for `<a-plot>` | Canvas height in pixels. Overrides the host's CSS height. |
|
|
457
458
|
| [`margin?`](#margins) | `number \| { top?, right?, bottom?, left? }` | `60` per side; `2` without axes or title | Space reserved around the plot area for axes and title. |
|
|
@@ -679,7 +680,7 @@ Scatter arguments
|
|
|
679
680
|
| `x?` | [`FieldArg`](#data-fields) | `'x'` | Horizontal field name or accessor. |
|
|
680
681
|
| `y?` | [`FieldArg`](#data-fields) | `'y'` | Vertical field name or accessor. |
|
|
681
682
|
| `color?` | [`ColorArg`](#series-colors) | Black | Series color; theme pairs provide separate light and dark colors. |
|
|
682
|
-
| `size?` | `number \| ((row, index) => number)` | `5` | Mark diameter in pixels, or a per-row accessor. A row’s `size` takes precedence. |
|
|
683
|
+
| `size?` | `number \| ((row, index, viewport) => number)` | `5` | [Mark diameter](#size) in pixels, or a per-row accessor. A row’s `size` takes precedence. |
|
|
683
684
|
| [`mark?`](#mark-shapes) | `MarkShape` | `'circle'` | Mark shape: circle, square, diamond, or triangle. |
|
|
684
685
|
| [`stroke?`](#strokes) | `StrokeArg` | None | Outline color and optional width. |
|
|
685
686
|
| [`tooltip?`](#tooltips) | `TooltipArg` | None | Use `true` for the default tooltip, or a callback for custom content. |
|
|
@@ -3085,6 +3086,7 @@ to continuous axes.
|
|
|
3085
3086
|
|---|---|---|
|
|
3086
3087
|
| `x` | `AxisViewport \| null` | Current horizontal viewport, or `null` for a categorical axis. |
|
|
3087
3088
|
| `y` | `AxisViewport \| null` | Current vertical viewport, or `null` for a categorical axis. |
|
|
3089
|
+
| `zoom_factor` | `{ x: number; y: number }` | Per-axis gesture magnification, initially 1; preserved during pan, resize, and data-domain changes. |
|
|
3088
3090
|
|
|
3089
3091
|
Each `AxisViewport` contains:
|
|
3090
3092
|
|
|
@@ -3095,6 +3097,209 @@ Each `AxisViewport` contains:
|
|
|
3095
3097
|
|
|
3096
3098
|
## Configuration details
|
|
3097
3099
|
|
|
3100
|
+
### Size
|
|
3101
|
+
|
|
3102
|
+
Scatter `size` accepts a fixed pixel diameter or a pure accessor returning a number.
|
|
3103
|
+
The accessor receives `(row, index, viewport)`, so you can combine data and viewport
|
|
3104
|
+
without storing zoom in application state.
|
|
3105
|
+
|
|
3106
|
+
Hold **Ctrl** and scroll near **50**. The first series stays at 4px. The other series
|
|
3107
|
+
alternate between 2px and 4px based on their data, then grow with horizontal zoom,
|
|
3108
|
+
at different rates, up to 16px. Hold **Ctrl** and drag to pan; **Reset zoom** restores
|
|
3109
|
+
the starting sizes.
|
|
3110
|
+
|
|
3111
|
+
```ts
|
|
3112
|
+
import { scatter, type PlotArgs } from '@antadesign/plot'
|
|
3113
|
+
import '@antadesign/plot/elements/a-plot'
|
|
3114
|
+
import type { APlotElement } from '@antadesign/plot/browser'
|
|
3115
|
+
|
|
3116
|
+
export function viewportSizes(): PlotArgs<Node> {
|
|
3117
|
+
const labels = ['Fixed 4px', 'Data + gradual zoom', 'Data + faster zoom']
|
|
3118
|
+
const positions = [0, 10, 25, 40, 45, 48, 49, 49.5, 49.75, 50, 50.25, 50.5, 51, 52, 55, 60, 75, 90, 100]
|
|
3119
|
+
const rows = (label: string) => positions.map((x, i) => ({ x, y: label, weight: i % 2 ? 4 : 2 }))
|
|
3120
|
+
return {
|
|
3121
|
+
height: 260,
|
|
3122
|
+
margin: { top: 24, right: 20, bottom: 48, left: 160 },
|
|
3123
|
+
axis: { x: { min: 0, max: 100, label: 'Zoom near 50' }, y: { categories: labels, label: '' } },
|
|
3124
|
+
background: { light: '#ffffff', dark: '#202124' },
|
|
3125
|
+
chrome_color: { light: '#64748b', dark: '#cbd5e1' },
|
|
3126
|
+
grid: false,
|
|
3127
|
+
zoom_pan: { x: true, y: false, modifier: true },
|
|
3128
|
+
series: [
|
|
3129
|
+
scatter<Node>({ data: rows(labels[0]), size: 4,
|
|
3130
|
+
color: { light: '#64748b', dark: '#cbd5e1' }, tooltip: true }),
|
|
3131
|
+
scatter<Node>({ data: rows(labels[1]),
|
|
3132
|
+
size: (row, index, viewport) => Math.min(16, Number(row.weight) * viewport.zoom_factor.x ** 0.25),
|
|
3133
|
+
color: { light: '#7c3aed', dark: '#c4b5fd' }, tooltip: true }),
|
|
3134
|
+
scatter<Node>({ data: rows(labels[2]),
|
|
3135
|
+
size: (row, index, viewport) => Math.min(16, Number(row.weight) * viewport.zoom_factor.x ** 0.5),
|
|
3136
|
+
color: { light: '#c2410c', dark: '#fdba74' }, tooltip: true }),
|
|
3137
|
+
],
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
const plot = document.createElement('a-plot') as APlotElement
|
|
3142
|
+
plot.plotArgs = viewportSizes()
|
|
3143
|
+
document.body.append(plot)
|
|
3144
|
+
```
|
|
3145
|
+
|
|
3146
|
+
`viewport` has the same shape as [Viewport changes](#viewport-changes): `x` and `y`
|
|
3147
|
+
contain visible and full domains (`null` for a categorical axis), and `zoom_factor.x` and
|
|
3148
|
+
`zoom_factor.y` contain gesture magnification. Each starts at 1. Panning, resizing, and
|
|
3149
|
+
data-domain changes preserve magnification. Reset and new keyed viewport requests
|
|
3150
|
+
establish factor 1 on their affected axes. Zooming out beyond a requested initial
|
|
3151
|
+
window can yield factors below 1. Use `Math.max(viewport.zoom_factor.x, viewport.zoom_factor.y)`
|
|
3152
|
+
to follow the more magnified axis.
|
|
3153
|
+
|
|
3154
|
+
Size accessors run during composition, including zoom and pan, rather than when
|
|
3155
|
+
the series is constructed. Keep them pure and inexpensive. Existing accessors
|
|
3156
|
+
that only read the row or index remain valid. Returned sizes must be finite and
|
|
3157
|
+
non-negative; invalid results report a composition error and retain the previous
|
|
3158
|
+
plot. Numeric row `size` fields take precedence, and the index stays tied to the
|
|
3159
|
+
original input row after category filtering. Drawing, hit testing, and highlights
|
|
3160
|
+
reuse the composed sizes. Other series' size options and font sizes remain numeric.
|
|
3161
|
+
|
|
3162
|
+
### Font
|
|
3163
|
+
|
|
3164
|
+
`font` on the plot supplies shared text settings. `title.font`,
|
|
3165
|
+
`axis.x.label.font`, `axis.y.label.font`, and each axis's `tick_label.font`
|
|
3166
|
+
accept local overrides. A string is shorthand for `{ family: string }`.
|
|
3167
|
+
Fields resolve individually from local settings, plot settings, and role defaults.
|
|
3168
|
+
Font assets are supplied by the application.
|
|
3169
|
+
|
|
3170
|
+
| Field | Type | Constraint |
|
|
3171
|
+
| --- | --- | --- |
|
|
3172
|
+
| `family?` | `string` | CSS font family or family list. |
|
|
3173
|
+
| `size?` | `number` | Positive finite CSS pixels. |
|
|
3174
|
+
| `weight?` | `number` | Finite CSS weight from 1 to 1000. |
|
|
3175
|
+
| `color?` | [`ThemeColor`](#theme-colors) | Color string or light/dark pair. |
|
|
3176
|
+
| `italic?` | `boolean` | Select italic text. |
|
|
3177
|
+
| `condensed?` | `boolean` | Select condensed text. |
|
|
3178
|
+
| `letter_spacing?` | `number` | Finite CSS pixels; negative values are allowed. |
|
|
3179
|
+
| `word_spacing?` | `number` | Finite CSS pixels; negative values are allowed. |
|
|
3180
|
+
| `caps?` | `boolean \| FontCaps` | `true` means `all-small-caps`; `false` means `normal`. |
|
|
3181
|
+
|
|
3182
|
+
`FontCaps` accepts `normal`, `small-caps`, `all-small-caps`, `petite-caps`,
|
|
3183
|
+
`all-petite-caps`, `unicase`, and `titling-caps`.
|
|
3184
|
+
|
|
3185
|
+
Canvas drawing and text measurement use the same resolved font settings.
|
|
3186
|
+
Titles default to 14px and axis names to 12px, using the initially inherited
|
|
3187
|
+
CSS font family with a sans-serif fallback. Tick labels default to 10px monospace. The default weight is 400. Root settings override
|
|
3188
|
+
these role defaults; local settings override the root field by field.
|
|
3189
|
+
|
|
3190
|
+
Plots capture the inherited CSS font family once when they mount. Explicit
|
|
3191
|
+
plot-level and local families take precedence. Later CSS font changes and
|
|
3192
|
+
font-loading completion do not trigger a redraw. Make fonts available before
|
|
3193
|
+
drawing; replacing `plotArgs` applies explicit font configuration changes.
|
|
3194
|
+
|
|
3195
|
+
Different fonts by role
|
|
3196
|
+
|
|
3197
|
+
The title combines bold weight, condensed width, and tighter letters. The axes switch to italic serif and spaced monospace, with colors that adapt to the theme.
|
|
3198
|
+
|
|
3199
|
+
```ts
|
|
3200
|
+
import { scatter, type PlotArgs } from '@antadesign/plot'
|
|
3201
|
+
import '@antadesign/plot/elements/a-plot'
|
|
3202
|
+
import type { APlotElement } from '@antadesign/plot/browser'
|
|
3203
|
+
|
|
3204
|
+
function base(): PlotArgs<Node> {
|
|
3205
|
+
return {
|
|
3206
|
+
series: [scatter<Node>({ data: [
|
|
3207
|
+
{ x: 12, y: 18 }, { x: 30, y: 42 }, { x: 48, y: 35 },
|
|
3208
|
+
{ x: 58, y: 64 }, { x: 76, y: 58 }, { x: 88, y: 82 },
|
|
3209
|
+
], size: 3, color: { light: '#9ca3af', dark: '#6b7280' }, hoverable: false })],
|
|
3210
|
+
height: 260,
|
|
3211
|
+
margin: { top: 20, right: 24, bottom: 48, left: 76 },
|
|
3212
|
+
axis: { x: { min: 0, max: 100, label: 'Time' }, y: { min: 0, max: 100, label: 'Value' } },
|
|
3213
|
+
background: { light: '#ffffff', dark: '#202124' },
|
|
3214
|
+
chrome_color: { light: '#9ca3af', dark: '#d1d5db' },
|
|
3215
|
+
border: true,
|
|
3216
|
+
grid: false,
|
|
3217
|
+
zoom_pan: false,
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
function fontRoles(): PlotArgs<Node> {
|
|
3222
|
+
return {
|
|
3223
|
+
...base(),
|
|
3224
|
+
margin: { top: 48, right: 20, bottom: 58, left: 72 },
|
|
3225
|
+
font: { family: '"TT Interphases Pro Variable", sans-serif', size: 13, weight: 450,
|
|
3226
|
+
color: { light: '#713fff', dark: '#c4b5fd' } },
|
|
3227
|
+
title: { text: '22px · bold · condensed',
|
|
3228
|
+
font: { size: 22, weight: 750, condensed: true, letter_spacing: -0.35 } },
|
|
3229
|
+
axis: {
|
|
3230
|
+
x: { min: 0, max: 100,
|
|
3231
|
+
label: { text: 'Serif · italic · 16px', font: { family: 'Georgia, serif', size: 16, italic: true,
|
|
3232
|
+
color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3233
|
+
y: { min: 0, max: 100,
|
|
3234
|
+
label: { text: 'Mono · +1px letters', font: { family: 'monospace', size: 12, letter_spacing: 1 } } },
|
|
3235
|
+
},
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
await Promise.all([
|
|
3240
|
+
document.fonts.load('750 22px "TT Interphases Pro Variable"'),
|
|
3241
|
+
document.fonts.load('italic 600 20px "TT Interphases Pro Variable"'),
|
|
3242
|
+
])
|
|
3243
|
+
const plot = document.querySelector<APlotElement>('a-plot')!
|
|
3244
|
+
plot.plotArgs = fontRoles()
|
|
3245
|
+
```
|
|
3246
|
+
|
|
3247
|
+
Shared settings and local overrides
|
|
3248
|
+
|
|
3249
|
+
The title inherits italic small caps and expanded spacing. The horizontal label resets caps, italic, and both spacing values; the vertical label selects `small-caps` explicitly. Tick labels use compact monospace overrides.
|
|
3250
|
+
|
|
3251
|
+
```ts
|
|
3252
|
+
import { scatter, type PlotArgs } from '@antadesign/plot'
|
|
3253
|
+
import '@antadesign/plot/elements/a-plot'
|
|
3254
|
+
import type { APlotElement } from '@antadesign/plot/browser'
|
|
3255
|
+
|
|
3256
|
+
function base(): PlotArgs<Node> {
|
|
3257
|
+
return {
|
|
3258
|
+
series: [scatter<Node>({ data: [
|
|
3259
|
+
{ x: 12, y: 18 }, { x: 30, y: 42 }, { x: 48, y: 35 },
|
|
3260
|
+
{ x: 58, y: 64 }, { x: 76, y: 58 }, { x: 88, y: 82 },
|
|
3261
|
+
], size: 3, color: { light: '#9ca3af', dark: '#6b7280' }, hoverable: false })],
|
|
3262
|
+
height: 260,
|
|
3263
|
+
margin: { top: 20, right: 24, bottom: 48, left: 76 },
|
|
3264
|
+
axis: { x: { min: 0, max: 100, label: 'Time' }, y: { min: 0, max: 100, label: 'Value' } },
|
|
3265
|
+
background: { light: '#ffffff', dark: '#202124' },
|
|
3266
|
+
chrome_color: { light: '#9ca3af', dark: '#d1d5db' },
|
|
3267
|
+
border: true,
|
|
3268
|
+
grid: false,
|
|
3269
|
+
zoom_pan: false,
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3273
|
+
function fontOverrides(): PlotArgs<Node> {
|
|
3274
|
+
return {
|
|
3275
|
+
...base(),
|
|
3276
|
+
margin: { top: 48, right: 20, bottom: 58, left: 72 },
|
|
3277
|
+
font: { family: '"TT Interphases Pro Variable", sans-serif', size: 14, weight: 600,
|
|
3278
|
+
italic: true, caps: true, letter_spacing: 1, word_spacing: 4,
|
|
3279
|
+
color: { light: '#0f766e', dark: '#5eead4' } },
|
|
3280
|
+
title: { text: 'Small caps · +4px words', font: { size: 20 } },
|
|
3281
|
+
axis: {
|
|
3282
|
+
x: { min: 0, max: 100,
|
|
3283
|
+
label: { text: 'Normal caps · zero spacing', font: { caps: false, italic: false,
|
|
3284
|
+
letter_spacing: 0, word_spacing: 0, color: { light: '#c2410c', dark: '#fdba74' } } },
|
|
3285
|
+
tick_label: { font: { family: 'monospace', size: 10, weight: 400, italic: false,
|
|
3286
|
+
caps: false, letter_spacing: 0, word_spacing: 0 } } },
|
|
3287
|
+
y: { min: 0, max: 100,
|
|
3288
|
+
label: { text: 'Italic · small caps', font: { caps: 'small-caps', letter_spacing: 0.5, word_spacing: 0 } },
|
|
3289
|
+
tick_label: { font: { family: 'monospace', size: 10, weight: 400, italic: false,
|
|
3290
|
+
caps: false, letter_spacing: 0, word_spacing: 0 } } },
|
|
3291
|
+
},
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
await Promise.all([
|
|
3296
|
+
document.fonts.load('750 22px "TT Interphases Pro Variable"'),
|
|
3297
|
+
document.fonts.load('italic 600 20px "TT Interphases Pro Variable"'),
|
|
3298
|
+
])
|
|
3299
|
+
const plot = document.querySelector<APlotElement>('a-plot')!
|
|
3300
|
+
plot.plotArgs = fontOverrides()
|
|
3301
|
+
```
|
|
3302
|
+
|
|
3098
3303
|
### Title
|
|
3099
3304
|
|
|
3100
3305
|
Set the title text, size, and purple theme colors.
|
|
@@ -3123,7 +3328,7 @@ function base(): PlotArgs<Node> {
|
|
|
3123
3328
|
|
|
3124
3329
|
function title(): PlotArgs<Node> {
|
|
3125
3330
|
return { ...base(), margin: { top: 44, right: 24, bottom: 48, left: 76 },
|
|
3126
|
-
title: { text: 'Plot title', size: 20, color: { light: '#713fff', dark: '#c4b5fd' } } }
|
|
3331
|
+
title: { text: 'Plot title', font: { size: 20, color: { light: '#713fff', dark: '#c4b5fd' } } } }
|
|
3127
3332
|
}
|
|
3128
3333
|
|
|
3129
3334
|
const plot = document.createElement('a-plot') as APlotElement
|
|
@@ -3136,8 +3341,7 @@ document.body.append(plot)
|
|
|
3136
3341
|
| Field | Type | Default | Description |
|
|
3137
3342
|
|---|---|---|---|
|
|
3138
3343
|
| `text` | `string` | Required | Plot title text. |
|
|
3139
|
-
| `
|
|
3140
|
-
| `color?` | [`ThemeColor`](#theme-colors) | Theme default | Title color. |
|
|
3344
|
+
| `font?` | `FontArg` | Role default | Text styling; replaces the former `size` and `color` fields. |
|
|
3141
3345
|
|
|
3142
3346
|
### Margins
|
|
3143
3347
|
|
|
@@ -3550,8 +3754,8 @@ function base(): PlotArgs<Node> {
|
|
|
3550
3754
|
|
|
3551
3755
|
function axisLabels(): PlotArgs<Node> {
|
|
3552
3756
|
return { ...base(), margin: { top: 44, right: 28, bottom: 62, left: 94 }, axis: {
|
|
3553
|
-
x: { min: 0, max: 100, label: { text: 'Time', position: 'right', size: 18, color: { light: '#713fff', dark: '#c4b5fd' } } },
|
|
3554
|
-
y: { min: 0, max: 100, label: { text: 'Value', position: 'top', size: 12, color: { light: '#c2410c', dark: '#fdba74' } } },
|
|
3757
|
+
x: { min: 0, max: 100, label: { text: 'Time', position: 'right', font: { size: 18, color: { light: '#713fff', dark: '#c4b5fd' } } } },
|
|
3758
|
+
y: { min: 0, max: 100, label: { text: 'Value', position: 'top', font: { size: 12, color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3555
3759
|
} }
|
|
3556
3760
|
}
|
|
3557
3761
|
|
|
@@ -3586,10 +3790,10 @@ function base(): PlotArgs<Node> {
|
|
|
3586
3790
|
|
|
3587
3791
|
function axisLabelsOpposite(): PlotArgs<Node> {
|
|
3588
3792
|
return { ...base(), margin: { top: 44, right: 28, bottom: 62, left: 94 }, axis: {
|
|
3589
|
-
x: { min: 0, max: 100, label: { text: 'Time', position: 'left', size: 12,
|
|
3590
|
-
color: { light: '#c2410c', dark: '#fdba74' } } },
|
|
3591
|
-
y: { min: 0, max: 100, label: { text: 'Value', position: 'bottom', size: 20,
|
|
3592
|
-
color: { light: '#713fff', dark: '#c4b5fd' } } },
|
|
3793
|
+
x: { min: 0, max: 100, label: { text: 'Time', position: 'left', font: { size: 12,
|
|
3794
|
+
color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3795
|
+
y: { min: 0, max: 100, label: { text: 'Value', position: 'bottom', font: { size: 20,
|
|
3796
|
+
color: { light: '#713fff', dark: '#c4b5fd' } } } },
|
|
3593
3797
|
} }
|
|
3594
3798
|
}
|
|
3595
3799
|
|
|
@@ -3603,8 +3807,7 @@ document.body.append(plot)
|
|
|
3603
3807
|
| Field | Type | Default | Description |
|
|
3604
3808
|
|---|---|---|---|
|
|
3605
3809
|
| `text` | `string` | Required | Axis label text. |
|
|
3606
|
-
| `
|
|
3607
|
-
| `color?` | [`ThemeColor`](#theme-colors) | Theme default | Label color. |
|
|
3810
|
+
| `font?` | `FontArg` | Role default | Text styling; replaces the former `size` and `color` fields. |
|
|
3608
3811
|
| `position?` | `'center' \| 'left' \| 'right' \| 'top' \| 'bottom'` | `'center'` | Use `left` or `right` on x; `top` or `bottom` on y. |
|
|
3609
3812
|
|
|
3610
3813
|
### Tick labels
|
|
@@ -3635,8 +3838,8 @@ function base(): PlotArgs<Node> {
|
|
|
3635
3838
|
|
|
3636
3839
|
function tickLabels(): PlotArgs<Node> {
|
|
3637
3840
|
return { ...base(), margin: { top: 44, right: 28, bottom: 62, left: 94 }, axis: {
|
|
3638
|
-
x: { min: 0, max: 100, label: 'Elapsed time', tick_label: { format: value => value + ' s', size: 10, color: { light: '#713fff', dark: '#c4b5fd' } } },
|
|
3639
|
-
y: { min: 0, max: 100, label: 'Utilization', tick_label: { format: value => value + '%', size: 15, color: { light: '#c2410c', dark: '#fdba74' } } },
|
|
3841
|
+
x: { min: 0, max: 100, label: 'Elapsed time', tick_label: { format: value => value + ' s', font: { size: 10, color: { light: '#713fff', dark: '#c4b5fd' } } } },
|
|
3842
|
+
y: { min: 0, max: 100, label: 'Utilization', tick_label: { format: value => value + '%', font: { size: 15, color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3640
3843
|
} }
|
|
3641
3844
|
}
|
|
3642
3845
|
|
|
@@ -3650,8 +3853,7 @@ Use `TickLabelArg` at `axis.x.tick_label` or `axis.y.tick_label`:
|
|
|
3650
3853
|
| Field | Type | Default | Description |
|
|
3651
3854
|
|---|---|---|---|
|
|
3652
3855
|
| `format?` | `(value: number \| string, index: number) => string` | Scale-dependent | Format each tick value. Return `''` for an empty label. |
|
|
3653
|
-
| `
|
|
3654
|
-
| `color?` | [`ThemeColor`](#theme-colors) | Theme default | Tick label color. |
|
|
3856
|
+
| `font?` | `FontArg` | Role default | Text styling; replaces the former `size` and `color` fields. |
|
|
3655
3857
|
|
|
3656
3858
|
### Series colors
|
|
3657
3859
|
|
|
@@ -3977,8 +4179,8 @@ grid lines, and the plot border. Use `background` for the plot fill and each
|
|
|
3977
4179
|
series’ `color` for its marks. These colors accept `{ light, dark }` pairs.
|
|
3978
4180
|
Plain color strings remain subject to the plot’s `theme_invert` setting.
|
|
3979
4181
|
|
|
3980
|
-
Set text colors separately with `title.color`, `axis.x.label.color`,
|
|
3981
|
-
`axis.y.label.color`, `axis.x.tick_label.color`, and `axis.y.tick_label.color`.
|
|
4182
|
+
Set text colors separately with `title.font.color`, `axis.x.label.font.color`,
|
|
4183
|
+
`axis.y.label.font.color`, `axis.x.tick_label.font.color`, and `axis.y.tick_label.font.color`.
|
|
3982
4184
|
|
|
3983
4185
|
With the JSX `Plot` component, return content supported by your renderer from a
|
|
3984
4186
|
series’ [`tooltip`](#tooltips) callback and style it like other markup. Anta’s
|
package/docs/theming.md
CHANGED
|
@@ -14,7 +14,8 @@ import '@antadesign/anta/theme-antune.css' // Choose one theme included in the p
|
|
|
14
14
|
|
|
15
15
|
## Fonts in a theme
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Anta's themes do not load fonts. `tokens.css` defines three system font stacks,
|
|
18
|
+
which the optional themes preserve:
|
|
18
19
|
|
|
19
20
|
```css
|
|
20
21
|
:root, .light {
|
|
@@ -27,14 +28,14 @@ Without a reference theme, `tokens.css` defines three system font stacks:
|
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
Components and theme rules choose which variable to use. For example, body text
|
|
30
|
-
can use `--sans-serif` while a particular title style uses `--serif`.
|
|
31
|
-
|
|
31
|
+
can use `--sans-serif` while a particular title style uses `--serif`. Package
|
|
32
|
+
styles do not force font-specific stylistic sets or variable-font axes.
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
such as `
|
|
34
|
+
Host your font files in your application and register them in a separate
|
|
35
|
+
stylesheet such as `fonts.css`. Load it after Anta's styles and optional theme:
|
|
35
36
|
|
|
36
37
|
```css
|
|
37
|
-
/*
|
|
38
|
+
/* fonts.css */
|
|
38
39
|
@font-face {
|
|
39
40
|
font-family: "App Sans";
|
|
40
41
|
src: url("/fonts/app-sans.woff2") format("woff2");
|
|
@@ -50,13 +51,12 @@ such as `theme.css`:
|
|
|
50
51
|
}
|
|
51
52
|
```
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
redefine all three font variables as shown above.
|
|
54
|
+
Alternatively, use the [Google Fonts CSS API](https://developers.google.com/fonts/docs/css2)
|
|
55
|
+
to load your chosen families. This example includes regular and italic styles:
|
|
56
56
|
|
|
57
57
|
```css
|
|
58
|
-
/*
|
|
59
|
-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=JetBrains+Mono:wght@400;600&family=Source+Serif+4:wght@400;600&display=swap");
|
|
58
|
+
/* fonts.css: place @import before other rules. */
|
|
59
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,600;1,400;1,600&family=JetBrains+Mono:ital,wght@0,400;0,600;1,400;1,600&family=Source+Serif+4:ital,wght@0,400;0,600;1,400;1,600&display=swap");
|
|
60
60
|
|
|
61
61
|
:root {
|
|
62
62
|
--sans-serif: "Inter", sans-serif;
|
|
@@ -65,8 +65,17 @@ redefine all three font variables as shown above.
|
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
Choose the styles and weights your app uses. Loading Google Fonts makes requests
|
|
69
|
+
to Google's servers; self-host font files when you need all assets on your own
|
|
70
|
+
origin.
|
|
71
|
+
|
|
72
|
+
The anta.design website loads its reference fonts through separate
|
|
73
|
+
[Antune font CSS](https://anta.design/themes/fonts-antune.css) and
|
|
74
|
+
[Antithesis font CSS](https://anta.design/themes/fonts-antithesis.css). These
|
|
75
|
+
site stylesheets show the website's font-face declarations, font stacks, and
|
|
76
|
+
font-specific axis settings. They are examples of application font setup and
|
|
77
|
+
are not imported by the published themes. Use your own font stylesheet and
|
|
78
|
+
font sources in your application.
|
|
70
79
|
|
|
71
80
|
<a id="color-seeds"></a>
|
|
72
81
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"types": "./dist/elements/index.d.ts",
|
|
24
24
|
"default": "./dist/elements/index.js"
|
|
25
25
|
},
|
|
26
|
+
"./elements/*.css": "./dist/elements/*.css",
|
|
26
27
|
"./elements/*": {
|
|
27
28
|
"types": "./dist/elements/*.d.ts",
|
|
28
29
|
"default": "./dist/elements/*.js"
|
|
@@ -61,7 +62,9 @@
|
|
|
61
62
|
"build:docs": "pnpm --filter anta-site run docs:api && pnpm --filter anta-site run docs:pages && node scripts/generate-package-docs.mjs",
|
|
62
63
|
"audit:contrast": "node scripts/audit-contrast.mjs",
|
|
63
64
|
"dev": "node scripts/dev.mjs",
|
|
64
|
-
"
|
|
65
|
+
"docs-fix": "node scripts/docs-fix.mjs",
|
|
66
|
+
"docs-review": "node scripts/docs-review.mjs",
|
|
67
|
+
"dev:run": "echo $$ > \"$ANTA_DEV_PID_FILE\"; trap 'rm -f \"$ANTA_DEV_PID_FILE\"' EXIT; pnpm run build:dev && pnpm --filter @antadesign/stickers run build:dev && pnpm --filter @antadesign/plot run build:dev && pnpm --filter @antadesign/typedoc-theme run build:dev && (node scripts/dev-watch.mjs & pnpm --filter anta-site run dev:server & (if [ \"$ANTA_DEV_WRANGLER\" = \"1\" ]; then pnpm --filter anta-site run dev:search; fi) & wait)",
|
|
65
68
|
"stop": "node scripts/dev-stop.mjs",
|
|
66
69
|
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
|
67
70
|
"test": "node --test tests/*.test.mjs",
|
|
@@ -73,10 +76,10 @@
|
|
|
73
76
|
"prepare": "pnpm run build",
|
|
74
77
|
"prepublishOnly": "pnpm run build",
|
|
75
78
|
"prepack": "pnpm run build:docs",
|
|
76
|
-
"test:
|
|
79
|
+
"test:fuzz_component": "node tests/pbt/run.ts",
|
|
80
|
+
"test:consumers": "node tests/consumers/run.mjs"
|
|
77
81
|
},
|
|
78
82
|
"devDependencies": {
|
|
79
|
-
"@antithesishq/bombadil": "0.7.5",
|
|
80
83
|
"@types/react": "19.3.0",
|
|
81
84
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
82
85
|
"axe-core": "4.13.0",
|