@fezchat/ui 0.1.0 → 0.1.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/README.md +69 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @fezchat/ui
|
|
2
|
+
|
|
3
|
+
The [fez](https://fez.chat) app's own UI primitives, as React components — so a GUI extension looks like a built-in view instead of a stranger's iframe.
|
|
4
|
+
|
|
5
|
+
Each component renders the **exact** class names and theme tokens the host app uses, so an extension built from them is visually indistinguishable from the app and follows every theme change for free.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @fezchat/ui
|
|
11
|
+
# pairs with the theme-wired utility classes:
|
|
12
|
+
npm install -D @fezchat/tailwind-preset
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`react` is a peer dependency — your extension bundles its own React under the fez mount model.
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
| Component | Use it for |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `<Page wide?>` | The top-level page shell (fills rail → side pane). |
|
|
22
|
+
| `<PageHeader title subtitle? fact? action?>` | A page header with the app's rule and one live fact. |
|
|
23
|
+
| `<EmptyState line how?>` | A full-voice empty state, not a grey italic line. |
|
|
24
|
+
| `<Field label hint?>` | A labelled form control with a hint. |
|
|
25
|
+
| `<Row active? onClick?>` | A selectable row; `active` draws the ember-notch idiom. |
|
|
26
|
+
| `<Chip tone?>` | A skill/label chip. |
|
|
27
|
+
| `<Avatar pk name? size?>` | The pubkey-generated identity sprite. |
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Under the fez mount model, your extension mounts its own React root into a host-provided node:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { createRoot } from "react-dom/client";
|
|
35
|
+
import { Page, PageHeader, EmptyState } from "@fezchat/ui";
|
|
36
|
+
|
|
37
|
+
function App() {
|
|
38
|
+
return (
|
|
39
|
+
<Page wide>
|
|
40
|
+
<PageHeader title="My tool" subtitle="Built from @fezchat/ui." fact="ready" />
|
|
41
|
+
<div className="bg-fez-surface text-fez-fg rounded-md p-4">
|
|
42
|
+
<EmptyState line="Nothing here yet." how="Wire up your view." />
|
|
43
|
+
</div>
|
|
44
|
+
</Page>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function activate(api) {
|
|
49
|
+
api.registerNavView("my-tool", { glyph: "◆", label: "My tool" }, (host) => {
|
|
50
|
+
const root = createRoot(host);
|
|
51
|
+
root.render(<App />);
|
|
52
|
+
return () => root.unmount();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Custom bits use the `fez-*` Tailwind utilities from [`@fezchat/tailwind-preset`](https://www.npmjs.com/package/@fezchat/tailwind-preset), which resolve to the live theme tokens — never a bare hex.
|
|
58
|
+
|
|
59
|
+
## Scaffold one in a command
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
fez create my-tool --gui
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
emits a working extension already built from `@fezchat/ui`.
|
|
66
|
+
|
|
67
|
+
## Boundary
|
|
68
|
+
|
|
69
|
+
This library extracts the **reusable** shell / form / identity primitives and the app's idioms (the ember notch, identity-gets-a-face, the empty-room voice). Per-view styling stays in your extension — via `fez-*` utilities or a CSS module. The shell primitives are shaped for a top-level page; for content embedded inside a nav view with a custom layout, hand-authored markup on the app's classes may fit better.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fezchat/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The fez app's own shell/form/identity primitives as React components — an extension built from them renders the identical DOM and follows every theme for free.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|