@hearthscale/app-ui 0.0.0-stage → 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 +25 -0
- package/README.md +148 -2
- package/dist/CLASSES.md +507 -0
- package/dist/TOKENS.md +296 -0
- package/dist/fonts/InterVariable.woff2 +0 -0
- package/dist/fonts/JetBrainsMono-Bold.woff2 +0 -0
- package/dist/fonts/JetBrainsMono-Medium.woff2 +0 -0
- package/dist/fonts/JetBrainsMono-Regular.woff2 +0 -0
- package/dist/fonts/JetBrainsMono-SemiBold.woff2 +0 -0
- package/dist/fonts/OFL.txt +92 -0
- package/dist/index.d.ts +439 -0
- package/dist/index.js +789 -0
- package/dist/remixicon/License +201 -0
- package/dist/remixicon/remixicon.css +3229 -0
- package/dist/remixicon/remixicon.woff2 +0 -0
- package/dist/ui.css +10153 -0
- package/package.json +57 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Simon Wagenfuehrer
|
|
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.
|
|
22
|
+
|
|
23
|
+
The fonts in `dist/fonts` are licensed under the SIL Open Font License 1.1
|
|
24
|
+
(`dist/fonts/OFL.txt`). The Remix Icon font in `dist/remixicon` is licensed
|
|
25
|
+
under the Apache License 2.0 (`dist/remixicon/License`).
|
package/README.md
CHANGED
|
@@ -1,3 +1,149 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hearthscale/app-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The UI kit of a Hearthscale app's view: the tokens and `hs-*` classes of the
|
|
4
|
+
Hearthscale design system, React parts built from it, and the whole Remix Icon
|
|
5
|
+
set. A view drawn with it looks like the rest of Hearthscale and follows the
|
|
6
|
+
person's theme, colourway and colour scheme.
|
|
7
|
+
|
|
8
|
+
## In a view
|
|
9
|
+
|
|
10
|
+
Hearthscale loads the kit into every view an app packages: `ui.css`, with the
|
|
11
|
+
tokens and the `hs-*` classes, and `remixicon.css`, with the Remix Icon font
|
|
12
|
+
and its `ri-*` classes. The view's document is the theme root
|
|
13
|
+
(`<html class="hs-shell hs-view" data-theme="dark">`, `light` in the light
|
|
14
|
+
scheme), so you bundle no stylesheet of the kit. Write the classes:
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<button class="hs-button" data-variant="secondary" data-size="sm">
|
|
18
|
+
<i class="hs-icon ri-add-line"></i>New note
|
|
19
|
+
</button>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
or, in a React view, import the parts:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Button, Card, Icon } from '@hearthscale/app-ui';
|
|
26
|
+
|
|
27
|
+
export function Notes() {
|
|
28
|
+
return (
|
|
29
|
+
<Card>
|
|
30
|
+
<Button icon={<Icon name="add-line" size={14} />}>New note</Button>
|
|
31
|
+
</Card>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The parts are one ES module that leaves React 19 and `@floating-ui/dom` to
|
|
37
|
+
your bundle. Bundle them into your view: the host gives a packaged view the
|
|
38
|
+
stylesheets and maps `@modelcontextprotocol/ext-apps` to its own copy
|
|
39
|
+
(`/ui/mcp-apps.js`), so leave that one import out of the bundle.
|
|
40
|
+
|
|
41
|
+
A label names its action. Where a reason is needed, give it in a tooltip
|
|
42
|
+
(`useFloatingTips`), not in a line under the action.
|
|
43
|
+
|
|
44
|
+
## The parts
|
|
45
|
+
|
|
46
|
+
| Kind | Parts |
|
|
47
|
+
| -------------- | ------------------------------------------------------------------------------------------ |
|
|
48
|
+
| Actions | `Button`, `IconButton` |
|
|
49
|
+
| Surfaces | `Card`, `SettingsCard`, `SettingsSection`, `EmptyState`, `Notice` |
|
|
50
|
+
| Rows | `ListRow`, `InfoRow`, `LinkRow`, `FactRow`, `ToggleRow` |
|
|
51
|
+
| Fields | `TextField`, `TextInput`, `Toggle`, `SegmentedControl`, `SettingsSearch`, `SettingsSelect` |
|
|
52
|
+
| Tabs | `SettingsTabs` |
|
|
53
|
+
| Status | `Chip`, `StatusWord` |
|
|
54
|
+
| Text | `PageTitle`, `Label`, `Mono` |
|
|
55
|
+
| Menus and tips | `MenuSurface`, `MItem`, `MSub`, `MDivider`, `MSection`, `anchorFrom`, `useFloatingTips` |
|
|
56
|
+
| Dialogs | `ShellConfirm` |
|
|
57
|
+
| Icons | `Icon` |
|
|
58
|
+
|
|
59
|
+
Each part draws the same `hs-*` classes as the same part in Hearthscale, so a
|
|
60
|
+
theme reaches it as it reaches the shell.
|
|
61
|
+
|
|
62
|
+
## Icons
|
|
63
|
+
|
|
64
|
+
Every Remix Icon, by its name on [remixicon.com](https://remixicon.com/):
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<i class="hs-icon ri-mail-line"></i>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Icon name="mail-line" size={16} />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The mark takes the colour of the text around it, and the font size around it
|
|
75
|
+
or `size`. `hs-icon` gives it the box of its size and the states of the
|
|
76
|
+
design system's drawn marks: the dim ink in a picker or a search field, and
|
|
77
|
+
the press of the control it sits in. `IconName` names every icon, so your
|
|
78
|
+
editor completes the names. Draw no icon by hand.
|
|
79
|
+
|
|
80
|
+
## Tokens and classes
|
|
81
|
+
|
|
82
|
+
`dist/TOKENS.md` lists every token with its dark and light value, and
|
|
83
|
+
`dist/CLASSES.md` every public `hs-*` class, as do the
|
|
84
|
+
[tokens](https://hearthscale.com/docs/developers/themes/tokens) and
|
|
85
|
+
[classes](https://hearthscale.com/docs/developers/themes/classes) pages of
|
|
86
|
+
the documentation. A view may use every class there. Give your own rules tokens for every colour,
|
|
87
|
+
corner, size and duration, such as `color: var(--mut)` or
|
|
88
|
+
`border-radius: var(--r-card)`, so a theme and a colourway reach your view as
|
|
89
|
+
they reach the shell.
|
|
90
|
+
|
|
91
|
+
## Previews and docs
|
|
92
|
+
|
|
93
|
+
Outside Hearthscale, import the two sheets and give the page the root the host
|
|
94
|
+
gives a view, on the plate a view sits on:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
import '@hearthscale/app-ui/ui.css';
|
|
98
|
+
import '@hearthscale/app-ui/remixicon.css';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<html class="hs-shell hs-view" data-theme="dark" style="background: var(--win)"></html>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## The rail icon
|
|
106
|
+
|
|
107
|
+
The rail shows the `icon` of your `app.json` 18 pixels square, beside
|
|
108
|
+
Hearthscale's own marks. Draw it to sit among them:
|
|
109
|
+
|
|
110
|
+
- **A 20 px grid.** A square `viewBox="0 0 24 24"` with the shape inside the
|
|
111
|
+
central 20 × 20, 2 units clear on every side.
|
|
112
|
+
- **Monochrome.** One colour, in the weight of Remix Icon's line marks: no
|
|
113
|
+
gradient, no shadow, no text.
|
|
114
|
+
- **`currentColor`.** Draw every shape in `currentColor` and set the ink once,
|
|
115
|
+
on the root. The rail shows the icon as a picture, which takes no colour from
|
|
116
|
+
the page, so give one file per scheme, the two differing in that one colour:
|
|
117
|
+
`#111111` in the light file, `#ffffff` in the dark file.
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
"icon": { "light": "assets/icon-light.svg", "dark": "assets/icon-dark.svg" }
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```svg
|
|
124
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" color="#111111">
|
|
125
|
+
<path fill="currentColor" d="M5 4h14v2H5zM5 9h14v2H5zM5 14h9v2H5z" />
|
|
126
|
+
</svg>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Licences
|
|
130
|
+
|
|
131
|
+
The code is MIT. Inter and JetBrains Mono are under the SIL Open Font License
|
|
132
|
+
1.1 (`dist/fonts/OFL.txt`). The Remix Icon font, from `remixicon` 4.8.0, is
|
|
133
|
+
under the Apache License 2.0 (`dist/remixicon/License`).
|
|
134
|
+
|
|
135
|
+
## Building, in the Hearthscale repository
|
|
136
|
+
|
|
137
|
+
`pnpm --filter @hearthscale/app-ui build` writes `dist/` from the design
|
|
138
|
+
system's build and the `remixicon` package, and writes `src/icon-names.ts`
|
|
139
|
+
from the font's sheet. It does not build `@hearthscale/ui`:
|
|
140
|
+
`pnpm --filter @hearthscale/app-ui... build` builds both, the design system
|
|
141
|
+
first. The parts come from the design system's `kit` entry
|
|
142
|
+
(`packages/ui/src/kit.ts`): a part is added there, never copied here. The
|
|
143
|
+
platform's build stages the sheets and fonts of this `dist/` beside the
|
|
144
|
+
daemon, with the MCP Apps SDK's browser build as `mcp-apps.js`, and the
|
|
145
|
+
daemon serves them to every view as `/ui/*`, so the kit a view gets and the
|
|
146
|
+
files this package publishes are one build.
|
|
147
|
+
`npm pack --dry-run` lists what a publish ships. `remixicon` stays at 4.8.0
|
|
148
|
+
here and in `@hearthscale/ui`: its later releases carry the Remix Icon License
|
|
149
|
+
v1.0 in place of the Apache License 2.0.
|