@antadesign/anta 0.3.23 → 0.3.25
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/bundle.css +1 -1
- package/dist/bundle.js +32 -25
- package/dist/components/Banner.d.ts +10 -10
- package/dist/components/Banner.js +3 -1
- package/dist/components/Breadcrumbs.css +1 -0
- package/dist/components/Breadcrumbs.d.ts +127 -0
- package/dist/components/Breadcrumbs.js +145 -0
- package/dist/components/Button.d.ts +14 -7
- package/dist/components/Button.js +2 -0
- package/dist/components/ButtonCopy.d.ts +2 -2
- package/dist/components/Input.d.ts +3 -1
- package/dist/components/Input.js +2 -0
- package/dist/components/InputDate.css +1 -1
- package/dist/components/InputTime.d.ts +3 -1
- package/dist/components/InputTime.js +2 -0
- package/dist/components/MenuItem.d.ts +5 -1
- package/dist/components/MenuItem.js +72 -2
- package/dist/components/MenuItemCopy.d.ts +16 -5
- package/dist/components/MenuItemCopy.js +9 -3
- package/dist/components/Steps.css +1 -1
- package/dist/components/copy-props.d.ts +3 -4
- package/dist/components/select-parts.css +1 -1
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-banner.js +12 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-calendar.css +1 -1
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-copy.css +1 -1
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-dialog.js +3 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-icon.css +1 -1
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-icon.shapes.d.ts +2 -2
- package/dist/elements/a-icon.shapes.js +2 -2
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.d.ts +2 -0
- package/dist/elements/a-input-time.js +7 -0
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.d.ts +4 -0
- package/dist/elements/a-input.js +17 -0
- package/dist/elements/a-loader.css +1 -1
- package/dist/elements/a-menu-group.css +1 -1
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-separator.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.d.ts +4 -4
- package/dist/elements/a-menu.js +6 -4
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio-group.css +1 -1
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabpanel.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-toast.css +1 -1
- package/dist/elements/a-toaster.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/copy-behavior.d.ts +13 -15
- package/dist/general_types.d.ts +12 -4
- package/dist/generate-icons.mjs +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -0
- package/dist/reset.css +1 -1
- package/dist/search-index.json +0 -0
- package/dist/theme-anta.css +1 -1
- package/dist/tokens.css +1 -1
- package/docs/changelog.md +43 -2
- package/docs/comparison.md +8 -3
- package/docs/components/banner.md +26 -15
- package/docs/components/breadcrumbs.md +177 -0
- package/docs/components/button.md +30 -16
- package/docs/components/dialog.md +4 -4
- package/docs/components/input-time.md +1 -0
- package/docs/components/input.md +6 -0
- package/docs/components/menu.md +18 -10
- package/docs/components/tag.md +47 -0
- package/docs/index.md +1 -0
- package/docs/install-config.md +58 -13
- package/docs/normalization.md +37 -28
- package/docs/theming.md +4 -1
- package/package.json +2 -2
package/docs/normalization.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# Normalization
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
components — no per-page restyling to make prose match a `<Title>` or a `<Table>`.
|
|
3
|
+
`reset.css` gives plain HTML (`<h2>`, `<ul>`, `<a>`, `<table>`) the same baseline as
|
|
4
|
+
Anta components.
|
|
6
5
|
|
|
7
|
-
It
|
|
8
|
-
|
|
9
|
-
reset. Omit this import when another reset provides the baseline.
|
|
6
|
+
It is a separate import in `@layer anta.reset`. Override individual rules, or omit
|
|
7
|
+
it when another reset provides the baseline.
|
|
10
8
|
|
|
11
9
|
```js
|
|
12
10
|
import '@antadesign/anta/tokens.css' // design tokens
|
|
@@ -18,6 +16,9 @@ import '@antadesign/anta/elements' // web components (client-side only)
|
|
|
18
16
|
|
|
19
17
|
### Structural reset
|
|
20
18
|
|
|
19
|
+
- `html` uses `--sans-serif`, `--text-2`, 22px leading, and `color-scheme`.
|
|
20
|
+
`.dark` selects dark mode; `.light` restores it in a dark subtree. `body` paints
|
|
21
|
+
`--bg-2`, including the browser canvas.
|
|
21
22
|
- `box-sizing: border-box` on every element (and `::before` / `::after`).
|
|
22
23
|
- `margin: 0` on everything — apps build spacing from explicit values.
|
|
23
24
|
- Replaced elements (`img`, `picture`, `video`, `canvas`, `svg`) → `display: block` + `max-width: 100%`, so a stray large asset can't blow out the layout.
|
|
@@ -28,21 +29,31 @@ import '@antadesign/anta/elements' // web components (client-side only)
|
|
|
28
29
|
|
|
29
30
|
### Typography (Anta's opinion)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
These defaults make raw markup match Anta components.
|
|
32
33
|
|
|
33
|
-
- **Headings**
|
|
34
|
+
- **Headings** match `<Title level={n}>` and have document margins. `<Title>` remains margin-free.
|
|
35
|
+
- **Block rhythm:** `p`, `ul`, `ol`, `blockquote`, `dl`, `pre`, and `figure` have a
|
|
36
|
+
`1rem` bottom margin, removed on a last child. `table` and `hr` have no reset margin.
|
|
34
37
|
- `strong` → `font-weight: 600`.
|
|
35
38
|
- `dfn` (defined term) → non-italic, with a dotted underline at half the surrounding text's strength (`3px` offset) in place of the UA italic. No `cursor: help` — that's for where the term is actually hoverable.
|
|
36
|
-
- Inline `code` → `line-height: 1em`
|
|
39
|
+
- Inline `code` → a tone-aware `--monospace` pill. `line-height: 1em` preserves the
|
|
40
|
+
surrounding line box; `pre code` has no pill.
|
|
37
41
|
- **Lists** (`ul` / `ol`): `3ch` left padding so markers hug the text; a small bottom margin between items; markers toned to `--text-5`.
|
|
42
|
+
- **Blockquotes** → a 3px `--text-5` rule on the left with `2ch` total left inset.
|
|
43
|
+
- `mark` → a theme-specific yellow with near-black text.
|
|
44
|
+
- `del` → `--text-2-critical` with a strike; `ins` → `--text-2-success` without an underline.
|
|
45
|
+
- `var` and `dt` → italic at `font-weight: 600`.
|
|
46
|
+
- `small` and `figcaption` → `calc(13em / 15)`; `figcaption` also uses `--text-3`.
|
|
47
|
+
- `sub` / `sup` → 75% with relative offsets that preserve line height.
|
|
48
|
+
- `hr` → a 1px `--border-4` line.
|
|
49
|
+
- `pre` → a bordered `--bg-3` code surface with horizontal scrolling.
|
|
38
50
|
- `menu` is stripped to a clean semantic container (no disc markers / default padding).
|
|
39
51
|
- **Links** get `--link-color` with a hairline underline (75% alpha, `0.5px`); hover only thickens it to `1px` (no color repaint). Anchor-buttons (`<a role="button">`) are excluded so they keep button styling.
|
|
40
52
|
- `::selection` → the focus-ring color, tuned per theme (20% alpha in light, 30% in dark).
|
|
41
53
|
- **Tables**: `border-collapse`, `tabular-nums`, and a polite cell baseline; opt into a framed look with `<table data-bordered>` (outer frame + column dividers + rounded corners).
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
in `src/elements/a-title.css`; the two are kept in sync.
|
|
55
|
+
See `src/reset.css` for the full set. Heading values are duplicated in
|
|
56
|
+
`src/elements/a-title.css` and kept in sync.
|
|
46
57
|
|
|
47
58
|
## Cascade layers — how to override
|
|
48
59
|
|
|
@@ -50,30 +61,26 @@ Anta declares this layer order once (in `tokens.css`):
|
|
|
50
61
|
|
|
51
62
|
```css
|
|
52
63
|
@layer base, anta, components, utilities;
|
|
64
|
+
@layer anta.reset, anta.components, anta.theme;
|
|
53
65
|
```
|
|
54
66
|
|
|
55
|
-
|
|
67
|
+
Anta uses child layers inside `@layer anta`: `anta.reset`, `anta.components`, and
|
|
68
|
+
the optional `anta.theme`.
|
|
56
69
|
|
|
57
70
|
- **Above `base`** — a framework preflight you drop into `@layer base` (e.g. Tailwind) won't wipe Anta's typography.
|
|
58
71
|
- **Below `components` and `utilities`** — your own component or utility CSS overrides Anta with no specificity battles.
|
|
59
72
|
- **Unlayered CSS beats every layer** — so any plain rule you write already wins over Anta's reset, no `!important` needed.
|
|
60
73
|
|
|
61
|
-
> **
|
|
62
|
-
>
|
|
63
|
-
>
|
|
64
|
-
> **unlayered** also outranks Anta's *per-element* defaults — its `p`, `caption`,
|
|
65
|
-
> and `ul / ol` margins — because unlayered wins over `@layer anta` regardless of
|
|
66
|
-
> specificity. Anta already runs that universal `*` reset itself, inside
|
|
67
|
-
> `@layer anta`, so the copy-pasted duplicate is redundant *and* harmful: delete it,
|
|
68
|
-
> or if you keep your own reset wrap it in `@layer base { … }` (below `anta`) so
|
|
69
|
-
> Anta's element defaults still apply.
|
|
74
|
+
> **Don't add an unlayered universal reset.** It overrides Anta's element defaults.
|
|
75
|
+
> Anta already applies `box-sizing` and `margin: 0`; delete duplicates, or put your
|
|
76
|
+
> reset in `@layer base`.
|
|
70
77
|
|
|
71
78
|
### Override one thing
|
|
72
79
|
|
|
73
80
|
Write the rule unlayered (or in a layer after `anta`) — targeting a **specific** element, not `*`:
|
|
74
81
|
|
|
75
82
|
```css
|
|
76
|
-
/* wins over Anta's @layer anta
|
|
83
|
+
/* wins over Anta's @layer anta.reset — no !important */
|
|
77
84
|
h2 { letter-spacing: -0.01em; }
|
|
78
85
|
```
|
|
79
86
|
|
|
@@ -95,8 +102,10 @@ Or import both and override only the pieces you want (unlayered, or in a later l
|
|
|
95
102
|
|
|
96
103
|
## Why it's opinionated
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
The reset gives headings, lists, links, and tables the same baseline as Anta
|
|
106
|
+
components. Omit it when your own reset should control them.
|
|
107
|
+
|
|
108
|
+
Tags styled by the reset, rendered live.
|
|
109
|
+
|
|
110
|
+
`abbr`, `q`, and `cite` keep browser typographic styles. `dd` has no browser indent
|
|
111
|
+
because the reset clears margins. The reset adds no `kbd` typography.
|
package/docs/theming.md
CHANGED
|
@@ -23,6 +23,9 @@ Anta's palette is generative. Every color in the system derives from six tone se
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Anta's styles use ordered child layers inside `@layer anta`. Your unlayered CSS
|
|
27
|
+
overrides them without `!important`, and shadow-DOM components expose
|
|
28
|
+
`::part(...)`. A component's `tone` accepts a named tone or CSS color and derives
|
|
29
|
+
its rest, hover, and active values. Each component page lists its styling hooks.
|
|
27
30
|
|
|
28
31
|
The lab below shows the derivation live. For each toned component, the shipped Default sits next to a Custom preview driven by the seed picker, with the formula constants editable and the resolved CSS shown.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"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 anta-site run docs && (node scripts/dev-watch.mjs & pnpm --filter anta-site run dev:server & wait)",
|
|
63
63
|
"stop": "node scripts/dev-stop.mjs",
|
|
64
64
|
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
|
65
|
-
"lint": "node scripts/lint-getters.mjs",
|
|
65
|
+
"lint": "node scripts/lint-getters.mjs && node scripts/lint-css-layers.mjs",
|
|
66
66
|
"verify": "pnpm run lint && pnpm run typecheck && pnpm --filter anta-site run docs:api",
|
|
67
67
|
"icons": "node scripts/generate-icons.mjs --input src/elements/icons --output src/elements --name a-icon.shapes --internal",
|
|
68
68
|
"clean": "rm -rf dist",
|