anvilui 0.4.0 → 0.4.1
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/AGENTS.md +3 -0
- package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +1 -1
- package/dist/index.cjs +76 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -9
- package/dist/index.js.map +1 -1
- package/docs/llms-index.md +1 -0
- package/docs/styling.md +40 -0
- package/docs/theming.md +1 -1
- package/package.json +1 -1
package/docs/llms-index.md
CHANGED
|
@@ -6,6 +6,7 @@ One line per page. Start with [../AGENTS.md](../AGENTS.md). Paths are relative t
|
|
|
6
6
|
|
|
7
7
|
- [setup.md](setup.md): install, `anvilui/styles.css`, `AnvilRoot`, fonts, Next.js, theme CSS variables
|
|
8
8
|
- [theming.md](theming.md): AnvilRoot props, color mode, `useAnvil`, `createTheme`, theme roles, design tokens
|
|
9
|
+
- [styling.md](styling.md): custom CSS, which classes and CSS variables are public and stable, which are internal
|
|
9
10
|
- [composition.md](composition.md): `render` instead of `asChild`, refs, className, controlled/uncontrolled props
|
|
10
11
|
- [forms.md](forms.md): building forms, `Field` validation, `FormData`, submit buttons
|
|
11
12
|
- [icons.md](icons.md): Material Symbols names, `Icon`, which props take icon names
|
package/docs/styling.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Customizing styles
|
|
2
|
+
|
|
3
|
+
What you can rely on when you style AnvilUI with your own CSS, and what can change in any release.
|
|
4
|
+
|
|
5
|
+
Reach for these in order: props (`color`, `fillType`, `size`), then the theme and tokens ([theming.md](theming.md)), then `className` / `style` on the component, and only then CSS against the public hooks below.
|
|
6
|
+
|
|
7
|
+
## Public: stable until a major version
|
|
8
|
+
|
|
9
|
+
| Hook | Examples | Notes |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Theme color variables | `--avl-color-primary`, `--avl-color-on-primary`, `--avl-color-surface`, `--avl-color-divider` | One per theme role (see [theming.md](theming.md)). Defined inside `AnvilRoot`. |
|
|
12
|
+
| Token variables | `--avl-spacing-x1` … `x20`, `--avl-radius-*`, `--avl-font-*`, `--avl-font-size-*`, `--avl-shadow-*`, `--avl-ease-*`, `--avl-outline-size`, `--avl-disabled-opacity` | One per key in `DesignTokens`. |
|
|
13
|
+
| Each component's root class | `.avl-button`, `.avl-card`, `.avl-menu-item`, `.avl-search-item` | `avl-` plus the component's name in kebab-case, on the element that gets `className`. `AnvilRoot` uses `.avl-root`. Components that render no element of their own (`Dialog`, `Menu`, `Popover`, `BottomSheet`, ...) have none: style their parts (`.avl-dialog-popup` is `DialogPopup`'s root class). |
|
|
14
|
+
| State attributes | `[data-checked]`, `[data-pressed]`, `[data-disabled]`, `[data-popup-open]` | Set by Base UI. Each part's attributes are in its Base UI docs (`node_modules/@base-ui/react/docs/react/components/`). |
|
|
15
|
+
|
|
16
|
+
A public variable or class that gets renamed keeps working under its old name for at least one minor version before it's removed.
|
|
17
|
+
|
|
18
|
+
## Internal: can change in any release
|
|
19
|
+
|
|
20
|
+
- Classes for parts and variants: `.avl-switch-thumb`, `.avl-button-size-big`, `.avl-color-tonal`, `.avl-fill-outlined`. Use the props instead (`size`, `color`, `fillType`).
|
|
21
|
+
- Component variables: `--avl-button-height`, `--avl-nested-color-main`, `--avl-sticker-tilt`, ...
|
|
22
|
+
- The elements inside a component: wrappers, their order, which tag they are.
|
|
23
|
+
- Visual details. Spacing, motion and shades are tuned in normal releases.
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```css
|
|
28
|
+
/* Your own class next to the root class, so it wins without !important */
|
|
29
|
+
.promo.avl-card {
|
|
30
|
+
background: var(--avl-color-primary-container);
|
|
31
|
+
border-radius: var(--avl-radius-large);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* State from Base UI */
|
|
35
|
+
.avl-switch[data-disabled] {
|
|
36
|
+
opacity: 0.3;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
AnvilUI's rules are one or two classes. If yours loses, add the root class to it as above, or load your CSS after `anvilui/styles.css`.
|
package/docs/theming.md
CHANGED
|
@@ -100,7 +100,7 @@ export function App() {
|
|
|
100
100
|
|
|
101
101
|
- `createTheme(primaryHex, { tonal?: hex })` returns `{ light: Theme, dark: Theme }`. Hex only (`'#0B6E4F'` or `'#0B6'`); other formats throw.
|
|
102
102
|
- `createThemeFromImage(img | File | Blob | url)` returns `Promise<ThemePair>`, browser only. URLs must allow CORS.
|
|
103
|
-
- Each role keeps the lightness of the base theme, so text stays readable; only hue and colorfulness change. Error, warning and success colors stay the same.
|
|
103
|
+
- Each role keeps the lightness of the base theme, so text stays readable; only hue and colorfulness change. Error, warning and success colors stay the same, except that a green primary makes `success` blue and a red or orange primary makes `error` pink, and a yellow or gold primary makes `warning` orange, so status colors stay distinct from the brand.
|
|
104
104
|
- Tweak one role by spreading: `{ ...brand.light, primary: '#…' }`.
|
|
105
105
|
- To switch themes at runtime, keep them in state and pass them as `lightTheme` / `darkTheme`.
|
|
106
106
|
- Ready-made: `baseLightTheme` / `baseDarkTheme` (purple, the default), `monochromeLightTheme` / `monochromeDarkTheme`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anvilui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Material 3 Expressive for React, pushed further: playful, accessible components built on Base UI. Ships agent docs in AGENTS.md and docs/.",
|
|
5
5
|
"author": "itayvak",
|
|
6
6
|
"license": "MIT",
|