@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.
Files changed (89) hide show
  1. package/dist/bundle.css +1 -1
  2. package/dist/bundle.js +32 -25
  3. package/dist/components/Banner.d.ts +10 -10
  4. package/dist/components/Banner.js +3 -1
  5. package/dist/components/Breadcrumbs.css +1 -0
  6. package/dist/components/Breadcrumbs.d.ts +127 -0
  7. package/dist/components/Breadcrumbs.js +145 -0
  8. package/dist/components/Button.d.ts +14 -7
  9. package/dist/components/Button.js +2 -0
  10. package/dist/components/ButtonCopy.d.ts +2 -2
  11. package/dist/components/Input.d.ts +3 -1
  12. package/dist/components/Input.js +2 -0
  13. package/dist/components/InputDate.css +1 -1
  14. package/dist/components/InputTime.d.ts +3 -1
  15. package/dist/components/InputTime.js +2 -0
  16. package/dist/components/MenuItem.d.ts +5 -1
  17. package/dist/components/MenuItem.js +72 -2
  18. package/dist/components/MenuItemCopy.d.ts +16 -5
  19. package/dist/components/MenuItemCopy.js +9 -3
  20. package/dist/components/Steps.css +1 -1
  21. package/dist/components/copy-props.d.ts +3 -4
  22. package/dist/components/select-parts.css +1 -1
  23. package/dist/elements/a-avatar.css +1 -1
  24. package/dist/elements/a-banner.css +1 -1
  25. package/dist/elements/a-banner.js +12 -0
  26. package/dist/elements/a-button.css +1 -1
  27. package/dist/elements/a-calendar.css +1 -1
  28. package/dist/elements/a-card.css +1 -1
  29. package/dist/elements/a-checkbox.css +1 -1
  30. package/dist/elements/a-copy.css +1 -1
  31. package/dist/elements/a-dialog.css +1 -1
  32. package/dist/elements/a-dialog.js +3 -1
  33. package/dist/elements/a-expander.css +1 -1
  34. package/dist/elements/a-icon.css +1 -1
  35. package/dist/elements/a-icon.shapes.css +1 -1
  36. package/dist/elements/a-icon.shapes.d.ts +2 -2
  37. package/dist/elements/a-icon.shapes.js +2 -2
  38. package/dist/elements/a-input-time.css +1 -1
  39. package/dist/elements/a-input-time.d.ts +2 -0
  40. package/dist/elements/a-input-time.js +7 -0
  41. package/dist/elements/a-input.css +1 -1
  42. package/dist/elements/a-input.d.ts +4 -0
  43. package/dist/elements/a-input.js +17 -0
  44. package/dist/elements/a-loader.css +1 -1
  45. package/dist/elements/a-menu-group.css +1 -1
  46. package/dist/elements/a-menu-item.css +1 -1
  47. package/dist/elements/a-menu-separator.css +1 -1
  48. package/dist/elements/a-menu.css +1 -1
  49. package/dist/elements/a-menu.d.ts +4 -4
  50. package/dist/elements/a-menu.js +6 -4
  51. package/dist/elements/a-progress.css +1 -1
  52. package/dist/elements/a-radio-group.css +1 -1
  53. package/dist/elements/a-radio.css +1 -1
  54. package/dist/elements/a-slider.css +1 -1
  55. package/dist/elements/a-switch.css +1 -1
  56. package/dist/elements/a-tab.css +1 -1
  57. package/dist/elements/a-tabpanel.css +1 -1
  58. package/dist/elements/a-tabs.css +1 -1
  59. package/dist/elements/a-tag.css +1 -1
  60. package/dist/elements/a-text.css +1 -1
  61. package/dist/elements/a-title.css +1 -1
  62. package/dist/elements/a-toast.css +1 -1
  63. package/dist/elements/a-toaster.css +1 -1
  64. package/dist/elements/a-tooltip.css +1 -1
  65. package/dist/elements/copy-behavior.d.ts +13 -15
  66. package/dist/general_types.d.ts +12 -4
  67. package/dist/generate-icons.mjs +3 -3
  68. package/dist/index.d.ts +3 -1
  69. package/dist/index.js +2 -0
  70. package/dist/jsx-runtime.d.ts +2 -0
  71. package/dist/reset.css +1 -1
  72. package/dist/search-index.json +0 -0
  73. package/dist/theme-anta.css +1 -1
  74. package/dist/tokens.css +1 -1
  75. package/docs/changelog.md +43 -2
  76. package/docs/comparison.md +8 -3
  77. package/docs/components/banner.md +26 -15
  78. package/docs/components/breadcrumbs.md +177 -0
  79. package/docs/components/button.md +30 -16
  80. package/docs/components/dialog.md +4 -4
  81. package/docs/components/input-time.md +1 -0
  82. package/docs/components/input.md +6 -0
  83. package/docs/components/menu.md +18 -10
  84. package/docs/components/tag.md +47 -0
  85. package/docs/index.md +1 -0
  86. package/docs/install-config.md +58 -13
  87. package/docs/normalization.md +37 -28
  88. package/docs/theming.md +4 -1
  89. package/package.json +2 -2
@@ -1,12 +1,10 @@
1
1
  # Normalization
2
2
 
3
- Anta ships an opinionated reset + typography baseline in **`reset.css`**, so plain
4
- HTML (`<h2>`, `<ul>`, `<a>`, `<table>`…) renders in the same visual language as the
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's a **separate import**, and every rule lives in a single cascade layer
8
- (`@layer anta`), so it is easy to override individual rules or use a different
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
- This is **not** a neutral normalize — these defaults make raw markup match the components.
32
+ These defaults make raw markup match Anta components.
32
33
 
33
- - **Headings** adopt the exact scale of `<Title level={n}>` — `h1`–`h6` sizes, line-heights, weight `≈585`, `letter-spacing: 0`, color `--text-1` (kept in lockstep with `a-title.css`) — plus per-level block margins for document rhythm. Those margins live only on the raw headings: `<Title>` itself is margin-free and leaves spacing to its container, so running prose gets the rhythm while the component stays neutral.
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` so it doesn't inflate the line box of surrounding prose.
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
- Everything above is defined in `src/reset.css`, inside `@layer anta` — read that file
44
- for the authoritative set (it's short and commented). The headings block is duplicated
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
- Everything Anta ships — this reset **and** the element styles — lives in **`@layer anta`**. That placement is deliberate:
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
- > **Gotcha — don't re-add a _universal_ hard reset unlayered.** Overriding a
62
- > *specific* element unlayered is the intended escape hatch (below). But a blanket
63
- > `* { margin: 0 }` / `*, *::before, *::after { box-sizing: border-box }` left
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 reset — no !important */
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
- A blank-slate reset would leave headings, lists, links, and tables looking like raw
99
- browser defaults — out of step with the components beside them. Anta's reset instead
100
- gives plain markup the same baseline as `<Title>`, `<Table>`, and the link styles, so a
101
- page mixing prose and components reads as one system. When you want a clean slate, opt
102
- out above.
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
- Past the seeds, any look and feel is reachable. Anta's styles live in `@layer anta`, so an un-layered rule you write wins without `!important`, and shadow-DOM components expose `::part(...)` hooks. Per component, the `tone` prop takes a named tone or any CSS color and derives that component's full rest/hover/active curve from it. Each component page lists its own hooks under Styling.
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.23",
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",