@astralui/core 0.1.0
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 +21 -0
- package/README.md +121 -0
- package/dist/index.cjs +621 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +150 -0
- package/dist/index.d.ts +150 -0
- package/dist/index.js +599 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +584 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Unbounded Technologies
|
|
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
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# AstralUI
|
|
2
|
+
|
|
3
|
+
A self-contained React design system - theme engine, design tokens, and a set of
|
|
4
|
+
dependency-free UI components. No CSS-in-JS runtime: just CSS variables +
|
|
5
|
+
`light-dark()` and small, focused components.
|
|
6
|
+
|
|
7
|
+
- 🎨 **Theme tokens** - a full color palette + semantic tokens as `--astral-*` CSS variables, light & dark.
|
|
8
|
+
- 🌗 **Color scheme** - `ColorSchemeProvider` / `useColorScheme` (persisted, `data-astral-scheme` on `<html>`).
|
|
9
|
+
- 🖌️ **Per-brand theming** - `AstralThemeProvider` generates a brand palette from a single hex and injects per-scheme overrides at runtime (with live preview).
|
|
10
|
+
- 🧩 **Components** - `AstralModal`, `AstralDrawer`, `AstralSelect`, `AstralMenu`, `AstralPinInput`, `AstralToaster` + `notifications`, `DateInput`, `Spinner`.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @astralui/core
|
|
16
|
+
# peer deps (you almost certainly already have these):
|
|
17
|
+
pnpm add react react-dom @tabler/icons-react
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
Import the stylesheet once (e.g. in your entry file), then wrap your app:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import '@astralui/core/styles.css';
|
|
26
|
+
import { ColorSchemeProvider, AstralThemeProvider, AstralToaster } from '@astralui/core';
|
|
27
|
+
|
|
28
|
+
function Root() {
|
|
29
|
+
return (
|
|
30
|
+
<ColorSchemeProvider defaultScheme="dark">
|
|
31
|
+
<AstralThemeProvider colors={orgBrandColors /* optional */}>
|
|
32
|
+
<AstralToaster />
|
|
33
|
+
<App />
|
|
34
|
+
</AstralThemeProvider>
|
|
35
|
+
</ColorSchemeProvider>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Color scheme
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { useColorScheme } from '@astralui/core';
|
|
44
|
+
|
|
45
|
+
function ThemeToggle() {
|
|
46
|
+
const { colorScheme, toggle } = useColorScheme();
|
|
47
|
+
return <button onClick={toggle}>{colorScheme === 'dark' ? '🌙' : '☀️'}</button>;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Per-brand theming
|
|
52
|
+
|
|
53
|
+
Pass any subset of brand colors; AstralUI builds a 10-shade palette (via `generateColors`)
|
|
54
|
+
and overrides the tokens per scheme. Omit `colors` for the default look.
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<AstralThemeProvider colors={{
|
|
58
|
+
primary_color: '#7950f2',
|
|
59
|
+
background_color: '#141417', card_color: '#1c1c20', navbar_color: '#0e0e11', font_color: '#f4f4f5',
|
|
60
|
+
light_primary_color: '#0f766e', light_background_color: '#f5f7fa', /* ...light_* */
|
|
61
|
+
}}>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For a live editor, `useThemePreview().setPreview(partialColors)` applies instantly without persisting.
|
|
65
|
+
|
|
66
|
+
## Notifications
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { notifications } from '@astralui/core';
|
|
70
|
+
|
|
71
|
+
const id = notifications.show({ message: 'Saved', color: 'green' });
|
|
72
|
+
notifications.show({ id: 'x', message: 'Working…', loading: true, autoClose: false });
|
|
73
|
+
notifications.update({ id: 'x', message: 'Done', color: 'green', loading: false, autoClose: 2000 });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Components (quick reference)
|
|
77
|
+
|
|
78
|
+
| Export | What |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `AstralModal` / `AstralDrawer` | Portalled, centered modal / right drawer (escape + click-outside). |
|
|
81
|
+
| `AstralSelect` | Single-select combobox (searchable / clearable / creatable). |
|
|
82
|
+
| `AstralMenu` | Anchored dropdown menu (items array). |
|
|
83
|
+
| `AstralPinInput` | Code/OTP input. |
|
|
84
|
+
| `DateInput` | Freeze-proof native date / datetime-local input. |
|
|
85
|
+
| `Spinner` | Theme-aware loading spinner. |
|
|
86
|
+
| `notifications` + `AstralToaster` | Toast system. |
|
|
87
|
+
| `generateColors(hex)` | 10-shade palette from one color. |
|
|
88
|
+
|
|
89
|
+
## Token reference
|
|
90
|
+
|
|
91
|
+
All colors resolve through `--astral-color-*`, `--astral-primary-color-*`, `--astral-font-family`,
|
|
92
|
+
and the app surface vars `--astral-app-bg/-nav/-card`. Use them directly in your own CSS, e.g.:
|
|
93
|
+
|
|
94
|
+
```css
|
|
95
|
+
.thing { background: var(--astral-color-body); color: var(--astral-color-text);
|
|
96
|
+
border: 1px solid var(--astral-color-default-border); }
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Local development
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pnpm install
|
|
103
|
+
pnpm build # → dist/ (ESM + CJS + types + styles.css)
|
|
104
|
+
pnpm typecheck
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
To use a local build in another project without publishing: `pnpm link --global` here, then
|
|
108
|
+
`pnpm link --global @astralui/core` in the consumer (or a `file:` dependency).
|
|
109
|
+
|
|
110
|
+
## Releasing
|
|
111
|
+
|
|
112
|
+
Versioned on npm as `@astralui/core`. CI builds + type-checks every push; publishing a
|
|
113
|
+
GitHub Release (`v*`) publishes to npm via the `publish` workflow using **npm Trusted
|
|
114
|
+
Publishing (OIDC)** - no token or secret. One-time setup on npmjs.com: the package's
|
|
115
|
+
Settings -> Trusted Publisher -> GitHub Actions, repo `UnboundedTechnologies/AstralUI`,
|
|
116
|
+
workflow `publish.yml`. The very first publish is done manually (`npm publish --access public`)
|
|
117
|
+
since the trusted publisher is configured on an existing package.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
MIT © Unbounded Technologies
|