astrogators-shared-ui 0.7.0-rc.1 → 0.8.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/README.md +29 -30
- package/dist/index.css +1 -1
- package/dist/index.js +139 -123
- package/dist/src/index.d.ts +2 -0
- package/dist/src/services/api.d.ts +7 -5
- package/dist/src/services/tokenRefresh.d.ts +25 -0
- package/dist/src/types/user.d.ts +2 -0
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# astrogators-shared-ui
|
|
2
2
|
|
|
3
3
|
Shared React components, auth, and API client for the Astrogator's Table
|
|
4
|
-
frontends (`astrogators-hub`, `mod-ledger-ui`). Published
|
|
4
|
+
frontends (`astrogators-hub`, `mod-ledger-ui`, `nightwatcher-ui`). Published
|
|
5
|
+
to the public npm registry as `astrogators-shared-ui` (unscoped).
|
|
6
|
+
|
|
7
|
+
> The git repo lives under `psytor/astrogators-shared-ui` on GitHub, but the
|
|
8
|
+
> package itself is published to **npmjs.org**, not GitHub Packages. No
|
|
9
|
+
> `.npmrc` scope config is needed to install.
|
|
5
10
|
|
|
6
11
|
This is a library — there is no app shell here. See `PUBLISHING.md` for the
|
|
7
|
-
release flow
|
|
12
|
+
release flow, `CHANGELOG.md` for what shipped in each version, and
|
|
13
|
+
`CLAUDE.md` for architecture notes.
|
|
8
14
|
|
|
9
15
|
## Installation
|
|
10
16
|
|
|
11
|
-
The package is hosted on GitHub Packages, so consumers need an `.npmrc`
|
|
12
|
-
pointing the `@psytor` scope at the right registry:
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
@psytor:registry=https://npm.pkg.github.com
|
|
16
|
-
//npm.pkg.github.com/:_authToken=${GITHUB_PAT}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The PAT needs `read:packages` scope. Then:
|
|
20
|
-
|
|
21
17
|
```bash
|
|
22
|
-
npm install
|
|
18
|
+
npm install astrogators-shared-ui
|
|
23
19
|
```
|
|
24
20
|
|
|
25
21
|
Peer dependencies: `react` and `react-dom` (18 or 19).
|
|
@@ -34,8 +30,8 @@ manages auth, feature flags, and ally codes for the whole app. Pass the
|
|
|
34
30
|
`/<service-name>` (see the workspace `CLAUDE.md`).
|
|
35
31
|
|
|
36
32
|
```tsx
|
|
37
|
-
import { AuthProvider } from '
|
|
38
|
-
import '
|
|
33
|
+
import { AuthProvider } from 'astrogators-shared-ui';
|
|
34
|
+
import 'astrogators-shared-ui/styles';
|
|
39
35
|
|
|
40
36
|
function App() {
|
|
41
37
|
return (
|
|
@@ -55,7 +51,7 @@ dev.
|
|
|
55
51
|
you need a custom `onUnauthorized` handler (e.g. router-driven redirects):
|
|
56
52
|
|
|
57
53
|
```tsx
|
|
58
|
-
import { initializeApiClient } from '
|
|
54
|
+
import { initializeApiClient } from 'astrogators-shared-ui';
|
|
59
55
|
|
|
60
56
|
initializeApiClient({
|
|
61
57
|
baseURL: import.meta.env.VITE_API_BASE_URL,
|
|
@@ -72,7 +68,7 @@ All components are styled via CSS Modules and the global design tokens in
|
|
|
72
68
|
### Layout
|
|
73
69
|
|
|
74
70
|
```tsx
|
|
75
|
-
import { TopBar, Container, Footer } from '
|
|
71
|
+
import { TopBar, Container, Footer } from 'astrogators-shared-ui';
|
|
76
72
|
|
|
77
73
|
<TopBar logo={<Logo />} rightContent={<UserMenu />} />
|
|
78
74
|
<Container maxWidth="lg" padding>{children}</Container>
|
|
@@ -82,7 +78,7 @@ import { TopBar, Container, Footer } from '@psytor/astrogators-shared-ui';
|
|
|
82
78
|
### Forms
|
|
83
79
|
|
|
84
80
|
```tsx
|
|
85
|
-
import { Button, Input, Select, AllyCodeDropdown } from '
|
|
81
|
+
import { Button, Input, Select, AllyCodeDropdown } from 'astrogators-shared-ui';
|
|
86
82
|
|
|
87
83
|
<Button variant="primary" size="md" loading={submitting}>Save</Button>
|
|
88
84
|
<Input label="Email" type="email" required error={errors.email} />
|
|
@@ -98,7 +94,7 @@ import { Button, Input, Select, AllyCodeDropdown } from '@psytor/astrogators-sha
|
|
|
98
94
|
### Display
|
|
99
95
|
|
|
100
96
|
```tsx
|
|
101
|
-
import { Card, Badge, Modal } from '
|
|
97
|
+
import { Card, Badge, Modal } from 'astrogators-shared-ui';
|
|
102
98
|
|
|
103
99
|
<Card variant="elevated" chamfered chamferSize="md" padding="lg" hoverable>
|
|
104
100
|
…
|
|
@@ -113,7 +109,7 @@ import { Card, Badge, Modal } from '@psytor/astrogators-shared-ui';
|
|
|
113
109
|
### Feedback
|
|
114
110
|
|
|
115
111
|
```tsx
|
|
116
|
-
import { Loader } from '
|
|
112
|
+
import { Loader } from 'astrogators-shared-ui';
|
|
117
113
|
|
|
118
114
|
<Loader size="md" variant="spinner" />
|
|
119
115
|
<Loader size="lg" variant="dots" />
|
|
@@ -125,7 +121,7 @@ import { Loader } from '@psytor/astrogators-shared-ui';
|
|
|
125
121
|
inside `AuthProvider`.
|
|
126
122
|
|
|
127
123
|
```tsx
|
|
128
|
-
import { useAuth } from '
|
|
124
|
+
import { useAuth } from 'astrogators-shared-ui';
|
|
129
125
|
|
|
130
126
|
const {
|
|
131
127
|
// session
|
|
@@ -153,7 +149,7 @@ it requires email verification.
|
|
|
153
149
|
## API client
|
|
154
150
|
|
|
155
151
|
```tsx
|
|
156
|
-
import { apiClient } from '
|
|
152
|
+
import { apiClient } from 'astrogators-shared-ui';
|
|
157
153
|
|
|
158
154
|
const characters = await apiClient.get('/api/v1/game-data/characters');
|
|
159
155
|
const result = await apiClient.post('/api/v1/mod-ledger/evaluate/123456789', {
|
|
@@ -185,7 +181,7 @@ import {
|
|
|
185
181
|
getSelectedAllyCode,
|
|
186
182
|
setSelectedAllyCode,
|
|
187
183
|
clearAllyCodes,
|
|
188
|
-
} from '
|
|
184
|
+
} from 'astrogators-shared-ui';
|
|
189
185
|
```
|
|
190
186
|
|
|
191
187
|
Prefer `useAuth` when you can — it keeps DB and localStorage in sync.
|
|
@@ -201,7 +197,7 @@ import type {
|
|
|
201
197
|
AllyCode, AllyCodeCreate, AllyCodeListResponse, StoredAllyCode,
|
|
202
198
|
ApiResponse, ApiError, PaginatedResponse,
|
|
203
199
|
ParsedMod, ModStat, ModEvaluation, EvaluationRequest, EvaluationResponse,
|
|
204
|
-
} from '
|
|
200
|
+
} from 'astrogators-shared-ui';
|
|
205
201
|
```
|
|
206
202
|
|
|
207
203
|
Consumers should set `"moduleResolution": "bundler"` (or `"node16"`) in
|
|
@@ -243,11 +239,14 @@ npm run type-check # tsc --noEmit
|
|
|
243
239
|
```
|
|
244
240
|
|
|
245
241
|
There is no `dev` server worth running (this is a library, not an app).
|
|
246
|
-
Iterate by rebuilding and reinstalling in a consumer
|
|
247
|
-
|
|
248
|
-
See `PUBLISHING.md` for the release procedure.
|
|
249
|
-
**
|
|
250
|
-
is the only thing shipped, so skipping the build re-publishes stale
|
|
242
|
+
Iterate by rebuilding and reinstalling in a consumer.
|
|
243
|
+
|
|
244
|
+
See `PUBLISHING.md` for the release procedure. Two non-negotiable rules:
|
|
245
|
+
- **Always `npm run build` before `npm publish`** — `dist/` is gitignored
|
|
246
|
+
but is the only thing shipped, so skipping the build re-publishes stale
|
|
247
|
+
code.
|
|
248
|
+
- **`npm login` and `npm publish` must be run by the user**, not by Claude
|
|
249
|
+
— publishing needs interactive npm auth.
|
|
251
250
|
|
|
252
251
|
## License
|
|
253
252
|
|