@antadesign/anta 0.1.1-dev.2 → 0.1.1-dev.4
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/LICENSE.md +21 -0
- package/README.md +30 -8
- package/dist/elements/a-icon.css +17 -15
- package/dist/elements/a-icon.shapes.css +278 -258
- package/dist/elements/a-icon.shapes.d.ts +5 -1
- package/dist/elements/a-icon.shapes.js +5 -0
- package/dist/elements/a-progress.css +69 -64
- package/dist/elements/a-text.css +76 -74
- package/dist/generate-icons.mjs +16 -4
- package/dist/reset.css +115 -0
- package/dist/{anta_global_tokens.css → tokens.css} +22 -70
- package/package.json +7 -4
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Antithesis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -15,12 +15,40 @@ Since Anta is in active development we suggest using the latest dev version: `"@
|
|
|
15
15
|
### Usage
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
+
import '@antadesign/anta/tokens.css' // CSS custom properties (colors, sizes, fonts)
|
|
19
|
+
import '@antadesign/anta/reset.css' // small reset + Anta's typography opinions
|
|
20
|
+
import '@antadesign/anta/elements' // registers <a-progress> et al.
|
|
18
21
|
import { Progress } from '@antadesign/anta'
|
|
19
|
-
import '@antadesign/anta/elements' // registers <a-progress> custom element
|
|
20
22
|
|
|
21
23
|
<Progress value={42} label="uploaded.." hint="3 of 7" />
|
|
22
24
|
```
|
|
23
25
|
|
|
26
|
+
### What you import (and why)
|
|
27
|
+
|
|
28
|
+
Anta exposes four independent imports. Tokens + elements + the JSX layer are the minimum to render a styled component; the reset is recommended but skippable.
|
|
29
|
+
|
|
30
|
+
| Import | Provides | Skip if… |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `@antadesign/anta/tokens.css` | The CSS custom properties — `--bg-base`, `--text-1…5`, `--border-1…5`, the `.dark`-ancestor toggling, the base `font-size: 15px`. Also declares the `@layer base, anta, components, utilities;` cascade order. | You're applying your own design tokens at the same variable names. |
|
|
33
|
+
| `@antadesign/anta/reset.css` | Modern small reset (box-sizing, margin reset, replaced-element block, form-control font inheritance, text-wrap defaults) plus Anta's typography opinions for `h1-h6`, `strong`, `ul / ol / menu`, `a` / link states. Lives in `@layer anta`. | You already have a reset and don't want Anta's typography defaults. |
|
|
34
|
+
| `@antadesign/anta/elements` | Side-effect import that registers `<a-progress>`, `<a-text>`, `<a-icon>` as custom elements *and* attaches their per-element CSS (also in `@layer anta`). | You're rendering Anta only on the server (no DOM) and never hydrating. |
|
|
35
|
+
| `@antadesign/anta` | The JSX wrappers (`Progress`, `Text`, `Icon`) — typed React/Preact components that emit `<a-*>` tags. | You're writing the `<a-*>` elements by hand and don't need a JSX layer. |
|
|
36
|
+
|
|
37
|
+
The chain matters: the per-element CSS that ships with `/elements` references variables like `var(--text-1)` and `var(--bg-base)`. Those variables are *only defined* by `tokens.css`. Skip the tokens import and the components render with whatever the surrounding cascade provides — usually nothing styled at all.
|
|
38
|
+
|
|
39
|
+
### Cascade layers
|
|
40
|
+
|
|
41
|
+
Anta's reset and element CSS live in `@layer anta`. `tokens.css` pre-declares an order of `@layer base, anta, components, utilities;`, which keeps Anta's defaults above any preflight resets (Tailwind's `@layer base`, Normalize, etc.) while letting your own `@layer components` rules and utility-class frameworks like Tailwind (`@layer utilities`) override Anta when you ask them to.
|
|
42
|
+
|
|
43
|
+
If you need a different order, declare it in your *own* CSS file that loads **before** `tokens.css`. The first mention of each layer name fixes its position:
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
/* your global.css, loaded before anta */
|
|
47
|
+
@layer reset, anta, my-components, utilities;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
CSS custom properties (the `:root { --… }` declarations in `tokens.css`) stay unlayered so they take effect everywhere unconditionally.
|
|
51
|
+
|
|
24
52
|
## Registering elements
|
|
25
53
|
|
|
26
54
|
The JSX wrappers (React components) as `Progress` render custom DOM elements as `<a-progress>`. The custom elements themselves must be registered with the browser **before** they appear in the DOM, and registration only works where `HTMLElement` exists — i.e. the UI thread of a real browser. **Node.js (SSR) and Worker threads don't have `HTMLElement`**, so the import is harmless in those environments: it does nothing — registration is skipped silently and the class uses a stand-in base instead of crashing — though it might extend your worker's bundle size a bit.
|
|
@@ -96,13 +124,7 @@ Add the `dark` class to any ancestor element:
|
|
|
96
124
|
|
|
97
125
|
## Fonts
|
|
98
126
|
|
|
99
|
-
Anta is designed with a customized version of <a href="https://typetype.org/fonts/tt-interphases-pro" target="_blank" rel="noopener noreferrer">TT Interphases Pro</a> in mind, but it doesn't ship any font binaries. Components reference families through the `--sans-serif` and `--monospace` CSS variables and fall back to native system stacks when no font is registered.
|
|
100
|
-
|
|
101
|
-
Anta sets `font-size: 15px` on `:root` (so `1rem = 15px`), intentionally diverging from the browser default of 16px to match Antithesis's information-dense layouts. This is applied via `@antadesign/anta/anta_global_tokens.css`:
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
import '@antadesign/anta/anta_global_tokens.css'
|
|
105
|
-
```
|
|
127
|
+
Anta is designed with a customized version of <a href="https://typetype.org/fonts/tt-interphases-pro" target="_blank" rel="noopener noreferrer">TT Interphases Pro</a> in mind, but it doesn't ship any font binaries. Components reference families through the `--sans-serif` and `--monospace` CSS variables and fall back to native system stacks when no font is registered. The base size is `font-size: 15px` on `:root` (so `1rem = 15px`), intentionally diverging from the browser default of 16px to match Antithesis's information-dense layouts — both the variables and the base size live in `tokens.css`.
|
|
106
128
|
|
|
107
129
|
To use the Antithesis fonts, register your own `@font-face` declarations and override the variables:
|
|
108
130
|
|
package/dist/elements/a-icon.css
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
@layer anta {
|
|
2
|
+
a-icon {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
width: var(--icon-size, 16px);
|
|
6
|
+
height: var(--icon-size, 16px);
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
background-color: currentColor;
|
|
9
|
+
-webkit-mask-image: var(--icon);
|
|
10
|
+
mask-image: var(--icon);
|
|
11
|
+
-webkit-mask-position: center;
|
|
12
|
+
mask-position: center;
|
|
13
|
+
-webkit-mask-repeat: no-repeat;
|
|
14
|
+
mask-repeat: no-repeat;
|
|
15
|
+
-webkit-mask-size: contain;
|
|
16
|
+
mask-size: contain;
|
|
17
|
+
}
|
|
16
18
|
}
|