@antadesign/anta 0.3.32 → 0.3.33
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 +47 -37
- package/dist/components/Input.d.ts +9 -3
- package/dist/components/Input.js +2 -0
- package/dist/components/Slider.d.ts +22 -10
- package/dist/components/Slider.js +9 -5
- package/dist/elements/a-button.js +2 -4
- package/dist/elements/a-input-time.js +1 -2
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +11 -8
- package/dist/elements/a-menu.d.ts +1 -1
- package/dist/elements/a-menu.js +17 -4
- package/dist/elements/a-slider.d.ts +7 -5
- package/dist/elements/a-slider.js +256 -59
- package/dist/general_types.d.ts +9 -4
- package/dist/index.d.ts +1 -1
- package/dist/theme-antune.css +1 -1
- package/docs/changelog.md +25 -0
- 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/packages/plot.md +158 -19
- package/package.json +4 -2
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. |
|
|
@@ -3095,6 +3096,147 @@ Each `AxisViewport` contains:
|
|
|
3095
3096
|
|
|
3096
3097
|
## Configuration details
|
|
3097
3098
|
|
|
3099
|
+
### Font
|
|
3100
|
+
|
|
3101
|
+
`font` on the plot supplies shared text settings. `title.font`,
|
|
3102
|
+
`axis.x.label.font`, `axis.y.label.font`, and each axis's `tick_label.font`
|
|
3103
|
+
accept local overrides. A string is shorthand for `{ family: string }`.
|
|
3104
|
+
Fields resolve individually from local settings, plot settings, and role defaults.
|
|
3105
|
+
Font assets are supplied by the application.
|
|
3106
|
+
|
|
3107
|
+
| Field | Type | Constraint |
|
|
3108
|
+
| --- | --- | --- |
|
|
3109
|
+
| `family?` | `string` | CSS font family or family list. |
|
|
3110
|
+
| `size?` | `number` | Positive finite CSS pixels. |
|
|
3111
|
+
| `weight?` | `number` | Finite CSS weight from 1 to 1000. |
|
|
3112
|
+
| `color?` | [`ThemeColor`](#theme-colors) | Color string or light/dark pair. |
|
|
3113
|
+
| `italic?` | `boolean` | Select italic text. |
|
|
3114
|
+
| `condensed?` | `boolean` | Select condensed text. |
|
|
3115
|
+
| `letter_spacing?` | `number` | Finite CSS pixels; negative values are allowed. |
|
|
3116
|
+
| `word_spacing?` | `number` | Finite CSS pixels; negative values are allowed. |
|
|
3117
|
+
| `caps?` | `boolean \| FontCaps` | `true` means `all-small-caps`; `false` means `normal`. |
|
|
3118
|
+
|
|
3119
|
+
`FontCaps` accepts `normal`, `small-caps`, `all-small-caps`, `petite-caps`,
|
|
3120
|
+
`all-petite-caps`, `unicase`, and `titling-caps`.
|
|
3121
|
+
|
|
3122
|
+
Canvas drawing and text measurement use the same resolved font settings.
|
|
3123
|
+
Titles default to 14px and axis names to 12px, using the initially inherited
|
|
3124
|
+
CSS font family with a sans-serif fallback. Tick labels default to 10px monospace. The default weight is 400. Root settings override
|
|
3125
|
+
these role defaults; local settings override the root field by field.
|
|
3126
|
+
|
|
3127
|
+
Plots capture the inherited CSS font family once when they mount. Explicit
|
|
3128
|
+
plot-level and local families take precedence. Later CSS font changes and
|
|
3129
|
+
font-loading completion do not trigger a redraw. Make fonts available before
|
|
3130
|
+
drawing; replacing `plotArgs` applies explicit font configuration changes.
|
|
3131
|
+
|
|
3132
|
+
Different fonts by role
|
|
3133
|
+
|
|
3134
|
+
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.
|
|
3135
|
+
|
|
3136
|
+
```ts
|
|
3137
|
+
import { scatter, type PlotArgs } from '@antadesign/plot'
|
|
3138
|
+
import '@antadesign/plot/elements/a-plot'
|
|
3139
|
+
import type { APlotElement } from '@antadesign/plot/browser'
|
|
3140
|
+
|
|
3141
|
+
function base(): PlotArgs<Node> {
|
|
3142
|
+
return {
|
|
3143
|
+
series: [scatter<Node>({ data: [
|
|
3144
|
+
{ x: 12, y: 18 }, { x: 30, y: 42 }, { x: 48, y: 35 },
|
|
3145
|
+
{ x: 58, y: 64 }, { x: 76, y: 58 }, { x: 88, y: 82 },
|
|
3146
|
+
], size: 3, color: { light: '#9ca3af', dark: '#6b7280' }, hoverable: false })],
|
|
3147
|
+
height: 260,
|
|
3148
|
+
margin: { top: 20, right: 24, bottom: 48, left: 76 },
|
|
3149
|
+
axis: { x: { min: 0, max: 100, label: 'Time' }, y: { min: 0, max: 100, label: 'Value' } },
|
|
3150
|
+
background: { light: '#ffffff', dark: '#202124' },
|
|
3151
|
+
chrome_color: { light: '#9ca3af', dark: '#d1d5db' },
|
|
3152
|
+
border: true,
|
|
3153
|
+
grid: false,
|
|
3154
|
+
zoom_pan: false,
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
function fontRoles(): PlotArgs<Node> {
|
|
3159
|
+
return {
|
|
3160
|
+
...base(),
|
|
3161
|
+
margin: { top: 48, right: 20, bottom: 58, left: 72 },
|
|
3162
|
+
font: { family: '"TT Interphases Pro Variable", sans-serif', size: 13, weight: 450,
|
|
3163
|
+
color: { light: '#713fff', dark: '#c4b5fd' } },
|
|
3164
|
+
title: { text: '22px · bold · condensed',
|
|
3165
|
+
font: { size: 22, weight: 750, condensed: true, letter_spacing: -0.35 } },
|
|
3166
|
+
axis: {
|
|
3167
|
+
x: { min: 0, max: 100,
|
|
3168
|
+
label: { text: 'Serif · italic · 16px', font: { family: 'Georgia, serif', size: 16, italic: true,
|
|
3169
|
+
color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3170
|
+
y: { min: 0, max: 100,
|
|
3171
|
+
label: { text: 'Mono · +1px letters', font: { family: 'monospace', size: 12, letter_spacing: 1 } } },
|
|
3172
|
+
},
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
await Promise.all([
|
|
3177
|
+
document.fonts.load('750 22px "TT Interphases Pro Variable"'),
|
|
3178
|
+
document.fonts.load('italic 600 20px "TT Interphases Pro Variable"'),
|
|
3179
|
+
])
|
|
3180
|
+
const plot = document.querySelector<APlotElement>('a-plot')!
|
|
3181
|
+
plot.plotArgs = fontRoles()
|
|
3182
|
+
```
|
|
3183
|
+
|
|
3184
|
+
Shared settings and local overrides
|
|
3185
|
+
|
|
3186
|
+
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.
|
|
3187
|
+
|
|
3188
|
+
```ts
|
|
3189
|
+
import { scatter, type PlotArgs } from '@antadesign/plot'
|
|
3190
|
+
import '@antadesign/plot/elements/a-plot'
|
|
3191
|
+
import type { APlotElement } from '@antadesign/plot/browser'
|
|
3192
|
+
|
|
3193
|
+
function base(): PlotArgs<Node> {
|
|
3194
|
+
return {
|
|
3195
|
+
series: [scatter<Node>({ data: [
|
|
3196
|
+
{ x: 12, y: 18 }, { x: 30, y: 42 }, { x: 48, y: 35 },
|
|
3197
|
+
{ x: 58, y: 64 }, { x: 76, y: 58 }, { x: 88, y: 82 },
|
|
3198
|
+
], size: 3, color: { light: '#9ca3af', dark: '#6b7280' }, hoverable: false })],
|
|
3199
|
+
height: 260,
|
|
3200
|
+
margin: { top: 20, right: 24, bottom: 48, left: 76 },
|
|
3201
|
+
axis: { x: { min: 0, max: 100, label: 'Time' }, y: { min: 0, max: 100, label: 'Value' } },
|
|
3202
|
+
background: { light: '#ffffff', dark: '#202124' },
|
|
3203
|
+
chrome_color: { light: '#9ca3af', dark: '#d1d5db' },
|
|
3204
|
+
border: true,
|
|
3205
|
+
grid: false,
|
|
3206
|
+
zoom_pan: false,
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
function fontOverrides(): PlotArgs<Node> {
|
|
3211
|
+
return {
|
|
3212
|
+
...base(),
|
|
3213
|
+
margin: { top: 48, right: 20, bottom: 58, left: 72 },
|
|
3214
|
+
font: { family: '"TT Interphases Pro Variable", sans-serif', size: 14, weight: 600,
|
|
3215
|
+
italic: true, caps: true, letter_spacing: 1, word_spacing: 4,
|
|
3216
|
+
color: { light: '#0f766e', dark: '#5eead4' } },
|
|
3217
|
+
title: { text: 'Small caps · +4px words', font: { size: 20 } },
|
|
3218
|
+
axis: {
|
|
3219
|
+
x: { min: 0, max: 100,
|
|
3220
|
+
label: { text: 'Normal caps · zero spacing', font: { caps: false, italic: false,
|
|
3221
|
+
letter_spacing: 0, word_spacing: 0, color: { light: '#c2410c', dark: '#fdba74' } } },
|
|
3222
|
+
tick_label: { font: { family: 'monospace', size: 10, weight: 400, italic: false,
|
|
3223
|
+
caps: false, letter_spacing: 0, word_spacing: 0 } } },
|
|
3224
|
+
y: { min: 0, max: 100,
|
|
3225
|
+
label: { text: 'Italic · small caps', font: { caps: 'small-caps', letter_spacing: 0.5, word_spacing: 0 } },
|
|
3226
|
+
tick_label: { font: { family: 'monospace', size: 10, weight: 400, italic: false,
|
|
3227
|
+
caps: false, letter_spacing: 0, word_spacing: 0 } } },
|
|
3228
|
+
},
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
await Promise.all([
|
|
3233
|
+
document.fonts.load('750 22px "TT Interphases Pro Variable"'),
|
|
3234
|
+
document.fonts.load('italic 600 20px "TT Interphases Pro Variable"'),
|
|
3235
|
+
])
|
|
3236
|
+
const plot = document.querySelector<APlotElement>('a-plot')!
|
|
3237
|
+
plot.plotArgs = fontOverrides()
|
|
3238
|
+
```
|
|
3239
|
+
|
|
3098
3240
|
### Title
|
|
3099
3241
|
|
|
3100
3242
|
Set the title text, size, and purple theme colors.
|
|
@@ -3123,7 +3265,7 @@ function base(): PlotArgs<Node> {
|
|
|
3123
3265
|
|
|
3124
3266
|
function title(): PlotArgs<Node> {
|
|
3125
3267
|
return { ...base(), margin: { top: 44, right: 24, bottom: 48, left: 76 },
|
|
3126
|
-
title: { text: 'Plot title', size: 20, color: { light: '#713fff', dark: '#c4b5fd' } } }
|
|
3268
|
+
title: { text: 'Plot title', font: { size: 20, color: { light: '#713fff', dark: '#c4b5fd' } } } }
|
|
3127
3269
|
}
|
|
3128
3270
|
|
|
3129
3271
|
const plot = document.createElement('a-plot') as APlotElement
|
|
@@ -3136,8 +3278,7 @@ document.body.append(plot)
|
|
|
3136
3278
|
| Field | Type | Default | Description |
|
|
3137
3279
|
|---|---|---|---|
|
|
3138
3280
|
| `text` | `string` | Required | Plot title text. |
|
|
3139
|
-
| `
|
|
3140
|
-
| `color?` | [`ThemeColor`](#theme-colors) | Theme default | Title color. |
|
|
3281
|
+
| `font?` | `FontArg` | Role default | Text styling; replaces the former `size` and `color` fields. |
|
|
3141
3282
|
|
|
3142
3283
|
### Margins
|
|
3143
3284
|
|
|
@@ -3550,8 +3691,8 @@ function base(): PlotArgs<Node> {
|
|
|
3550
3691
|
|
|
3551
3692
|
function axisLabels(): PlotArgs<Node> {
|
|
3552
3693
|
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' } } },
|
|
3694
|
+
x: { min: 0, max: 100, label: { text: 'Time', position: 'right', font: { size: 18, color: { light: '#713fff', dark: '#c4b5fd' } } } },
|
|
3695
|
+
y: { min: 0, max: 100, label: { text: 'Value', position: 'top', font: { size: 12, color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3555
3696
|
} }
|
|
3556
3697
|
}
|
|
3557
3698
|
|
|
@@ -3586,10 +3727,10 @@ function base(): PlotArgs<Node> {
|
|
|
3586
3727
|
|
|
3587
3728
|
function axisLabelsOpposite(): PlotArgs<Node> {
|
|
3588
3729
|
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' } } },
|
|
3730
|
+
x: { min: 0, max: 100, label: { text: 'Time', position: 'left', font: { size: 12,
|
|
3731
|
+
color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3732
|
+
y: { min: 0, max: 100, label: { text: 'Value', position: 'bottom', font: { size: 20,
|
|
3733
|
+
color: { light: '#713fff', dark: '#c4b5fd' } } } },
|
|
3593
3734
|
} }
|
|
3594
3735
|
}
|
|
3595
3736
|
|
|
@@ -3603,8 +3744,7 @@ document.body.append(plot)
|
|
|
3603
3744
|
| Field | Type | Default | Description |
|
|
3604
3745
|
|---|---|---|---|
|
|
3605
3746
|
| `text` | `string` | Required | Axis label text. |
|
|
3606
|
-
| `
|
|
3607
|
-
| `color?` | [`ThemeColor`](#theme-colors) | Theme default | Label color. |
|
|
3747
|
+
| `font?` | `FontArg` | Role default | Text styling; replaces the former `size` and `color` fields. |
|
|
3608
3748
|
| `position?` | `'center' \| 'left' \| 'right' \| 'top' \| 'bottom'` | `'center'` | Use `left` or `right` on x; `top` or `bottom` on y. |
|
|
3609
3749
|
|
|
3610
3750
|
### Tick labels
|
|
@@ -3635,8 +3775,8 @@ function base(): PlotArgs<Node> {
|
|
|
3635
3775
|
|
|
3636
3776
|
function tickLabels(): PlotArgs<Node> {
|
|
3637
3777
|
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' } } },
|
|
3778
|
+
x: { min: 0, max: 100, label: 'Elapsed time', tick_label: { format: value => value + ' s', font: { size: 10, color: { light: '#713fff', dark: '#c4b5fd' } } } },
|
|
3779
|
+
y: { min: 0, max: 100, label: 'Utilization', tick_label: { format: value => value + '%', font: { size: 15, color: { light: '#c2410c', dark: '#fdba74' } } } },
|
|
3640
3780
|
} }
|
|
3641
3781
|
}
|
|
3642
3782
|
|
|
@@ -3650,8 +3790,7 @@ Use `TickLabelArg` at `axis.x.tick_label` or `axis.y.tick_label`:
|
|
|
3650
3790
|
| Field | Type | Default | Description |
|
|
3651
3791
|
|---|---|---|---|
|
|
3652
3792
|
| `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. |
|
|
3793
|
+
| `font?` | `FontArg` | Role default | Text styling; replaces the former `size` and `color` fields. |
|
|
3655
3794
|
|
|
3656
3795
|
### Series colors
|
|
3657
3796
|
|
|
@@ -3977,8 +4116,8 @@ grid lines, and the plot border. Use `background` for the plot fill and each
|
|
|
3977
4116
|
series’ `color` for its marks. These colors accept `{ light, dark }` pairs.
|
|
3978
4117
|
Plain color strings remain subject to the plot’s `theme_invert` setting.
|
|
3979
4118
|
|
|
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`.
|
|
4119
|
+
Set text colors separately with `title.font.color`, `axis.x.label.font.color`,
|
|
4120
|
+
`axis.y.label.font.color`, `axis.x.tick_label.font.color`, and `axis.y.tick_label.font.color`.
|
|
3982
4121
|
|
|
3983
4122
|
With the JSX `Plot` component, return content supported by your renderer from a
|
|
3984
4123
|
series’ [`tooltip`](#tooltips) callback and style it like other markup. Anta’s
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -61,7 +61,9 @@
|
|
|
61
61
|
"build:docs": "pnpm --filter anta-site run docs:api && pnpm --filter anta-site run docs:pages && node scripts/generate-package-docs.mjs",
|
|
62
62
|
"audit:contrast": "node scripts/audit-contrast.mjs",
|
|
63
63
|
"dev": "node scripts/dev.mjs",
|
|
64
|
-
"
|
|
64
|
+
"docs-fix": "node scripts/docs-fix.mjs",
|
|
65
|
+
"docs-review": "node scripts/docs-review.mjs",
|
|
66
|
+
"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
67
|
"stop": "node scripts/dev-stop.mjs",
|
|
66
68
|
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
|
67
69
|
"test": "node --test tests/*.test.mjs",
|