claymorph-ui 0.4.0 → 0.4.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 +99 -46
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://claymorph-ui.lauroguedes.dev"><img src="https://raw.githubusercontent.com/lauroguedes/claymorph-ui/main/public/og/home.jpg" alt="Claymorph UI: clay that gives when you press it" width="100%" /></a>
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">Claymorph UI</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Soft clay web components drawn by one WebGL2 shader, accessible by default with <a href="https://ui-sdk.dev">ui-sdk</a>.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/claymorph-ui"><img src="https://img.shields.io/npm/v/claymorph-ui?color=4e9fa3&label=npm" alt="npm version" /></a>
|
|
13
|
+
<a href="https://github.com/lauroguedes/claymorph-ui/actions/workflows/ci.yml"><img src="https://github.com/lauroguedes/claymorph-ui/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
14
|
+
<img src="https://img.shields.io/npm/types/claymorph-ui?color=8d7fd6" alt="TypeScript types included" />
|
|
15
|
+
<a href="https://github.com/lauroguedes/claymorph-ui/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-f0a27c" alt="MIT license" /></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://claymorph-ui.lauroguedes.dev/docs/introduction"><strong>Documentation</strong></a> ·
|
|
20
|
+
<a href="https://claymorph-ui.lauroguedes.dev/playground">Playground</a> ·
|
|
21
|
+
<a href="https://claymorph-ui.lauroguedes.dev/showcase.html">Showcase</a> ·
|
|
22
|
+
<a href="https://claymorph-ui.lauroguedes.dev/changelog">Changelog</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
Claymorph UI gives ui-sdk's web components a clay body. You keep writing the ui-sdk parts you know, like `<ui-button>` or `<ui-select>`, and wrap them in a clay element. The wrapper adds the material and the motion: one shared WebGL2 shader draws every surface, with springs that swell, squash and melt parts into each other. The keyboard, focus, ARIA and forms stay in ui-sdk.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **One shader, every surface.** A single WebGL2 context draws all the clay on a page, and stops drawing the moment nothing moves.
|
|
32
|
+
- **Accessible by default.** Each element wraps a ui-sdk part, so keyboard support, focus management and ARIA come built in.
|
|
33
|
+
- **Parts that melt together.** Lists, menus, cards and tooltips squeeze out of their trigger and stay fused to it, and `fuse` sets how far.
|
|
34
|
+
- **Import only what you use.** One entry per element, with types. A page with a single button ships about 22 KB gzipped, ui-sdk included.
|
|
35
|
+
- **Works without WebGL2.** Before the first frame, on older devices and in forced colours, the same clay is drawn with CSS.
|
|
36
|
+
- **Any framework.** They're web components: use them in React, Vue, Svelte, Angular, Astro or plain HTML.
|
|
37
|
+
- **Ready for agents.** `llms.txt`, Markdown docs and an agent skill ship with it, and every control can be operated over WebMCP.
|
|
4
38
|
|
|
5
39
|
## Install
|
|
6
40
|
|
|
@@ -8,9 +42,9 @@ Soft clay web components. One WebGL2 shader draws every surface, with springs th
|
|
|
8
42
|
npm install claymorph-ui @ui-sdk/web @ui-sdk/core
|
|
9
43
|
```
|
|
10
44
|
|
|
11
|
-
`@ui-sdk/web` and `@ui-sdk/core` are peer dependencies, so your app and
|
|
45
|
+
`@ui-sdk/web` and `@ui-sdk/core` are peer dependencies, so your app and Claymorph UI share one copy.
|
|
12
46
|
|
|
13
|
-
##
|
|
47
|
+
## Quick start
|
|
14
48
|
|
|
15
49
|
Load the styles once, then import the elements you use. Each import registers its element and the ui-sdk parts it wraps.
|
|
16
50
|
|
|
@@ -25,54 +59,73 @@ import "claymorph-ui/select"
|
|
|
25
59
|
<clay-button color="teal">
|
|
26
60
|
<ui-button><button>Save</button></ui-button>
|
|
27
61
|
</clay-button>
|
|
62
|
+
|
|
63
|
+
<clay-select attached color="teal">
|
|
64
|
+
<ui-select default-value="week">
|
|
65
|
+
<ui-select-label>Period</ui-select-label>
|
|
66
|
+
<ui-select-trigger><button><ui-select-value></ui-select-value></button></ui-select-trigger>
|
|
67
|
+
<ui-select-content>
|
|
68
|
+
<ui-select-item value="day">Today</ui-select-item>
|
|
69
|
+
<ui-select-item value="week">This week</ui-select-item>
|
|
70
|
+
</ui-select-content>
|
|
71
|
+
</ui-select>
|
|
72
|
+
</clay-select>
|
|
28
73
|
```
|
|
29
74
|
|
|
30
|
-
To register
|
|
75
|
+
To register every element at once, `import "claymorph-ui"`.
|
|
76
|
+
|
|
77
|
+
## Components
|
|
78
|
+
|
|
79
|
+
Every element is named for the one thing it does.
|
|
80
|
+
|
|
81
|
+
| Verb | Component | Element | Entry |
|
|
82
|
+
| --- | --- | --- | --- |
|
|
83
|
+
| Press | Button | `<clay-button>` | `claymorph-ui/button` |
|
|
84
|
+
| Roll | Action button | `<clay-action-button>` | `claymorph-ui/action-button` |
|
|
85
|
+
| Latch | Toggle | `<clay-toggle>` | `claymorph-ui/toggle` |
|
|
86
|
+
| Fuse | Button group | `<clay-button-group>` | `claymorph-ui/button-group` |
|
|
87
|
+
| Drag | Slide to confirm | `<clay-slide-confirm>` | `claymorph-ui/slide-confirm` |
|
|
88
|
+
| Type | Input | `<clay-input>` | `claymorph-ui/input` |
|
|
89
|
+
| Slide | Segmented control | `<clay-segmented>` | `claymorph-ui/segmented` |
|
|
90
|
+
| Flip | Switch | `<clay-switch>` | `claymorph-ui/switch` |
|
|
91
|
+
| Tick | Checkbox | `<clay-checkbox>` | `claymorph-ui/checkbox` |
|
|
92
|
+
| Pick | Radio group | `<clay-radio>` | `claymorph-ui/radio` |
|
|
93
|
+
| Stretch | Slider | `<clay-slider>` | `claymorph-ui/slider` |
|
|
94
|
+
| Pour | Select | `<clay-select>` | `claymorph-ui/select` |
|
|
95
|
+
| Shift | Tabs | `<clay-tabs>` | `claymorph-ui/tabs` |
|
|
96
|
+
| Spill | Menu | `<clay-menu>` | `claymorph-ui/menu` |
|
|
97
|
+
| Unfold | Popover | `<clay-popover>` | `claymorph-ui/popover` |
|
|
98
|
+
| Lift | Dialog | `<clay-dialog>` | `claymorph-ui/dialog` |
|
|
99
|
+
| Pop | Tooltip | `<clay-tooltip>` | `claymorph-ui/tooltip` |
|
|
100
|
+
| Drop | Toast | `<clay-toast-region>` | `claymorph-ui/toast` |
|
|
101
|
+
| Hold | Card | `<clay-card>` | `claymorph-ui/card` |
|
|
102
|
+
| Stamp | Badge | `<clay-badge>` | `claymorph-ui/badge` |
|
|
103
|
+
| Frame | Avatar | `<clay-avatar>` | `claymorph-ui/avatar` |
|
|
104
|
+
| Fill | Progress | `<clay-progress>` | `claymorph-ui/progress` |
|
|
105
|
+
| Gauge | Meter | `<clay-meter>` | `claymorph-ui/meter` |
|
|
106
|
+
|
|
107
|
+
## Theming
|
|
108
|
+
|
|
109
|
+
Colour any element with the `color` attribute, a preset (`teal`, `lilac`, `sky`, `peach`, `mint`, `butter`, `rose`, `slate`, `ink`) or any CSS colour, or with the `--clay-*` custom properties. Light and dark follow `prefers-color-scheme`, or `data-theme` on `<html>`. The material itself, light, sheen, grain and shadows, lives in one `CLAY` object; tune it live in the [playground](https://claymorph-ui.lauroguedes.dev/playground).
|
|
31
110
|
|
|
32
111
|
```ts
|
|
33
|
-
import "claymorph-ui"
|
|
112
|
+
import { CLAY, getClayEngine } from "claymorph-ui"
|
|
113
|
+
|
|
114
|
+
Object.assign(CLAY, { pillow: 0.7, grain: 0.08 })
|
|
115
|
+
getClayEngine()?.invalidateAll()
|
|
34
116
|
```
|
|
35
117
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| `claymorph-ui/button-group` | `<clay-button-group>` |
|
|
47
|
-
| `claymorph-ui/card` | `<clay-card>` |
|
|
48
|
-
| `claymorph-ui/checkbox` | `<clay-checkbox>` |
|
|
49
|
-
| `claymorph-ui/dialog` | `<clay-dialog>` |
|
|
50
|
-
| `claymorph-ui/input` | `<clay-input>` |
|
|
51
|
-
| `claymorph-ui/menu` | `<clay-menu>` |
|
|
52
|
-
| `claymorph-ui/meter` | `<clay-meter>` |
|
|
53
|
-
| `claymorph-ui/popover` | `<clay-popover>` |
|
|
54
|
-
| `claymorph-ui/progress` | `<clay-progress>` |
|
|
55
|
-
| `claymorph-ui/radio` | `<clay-radio>` |
|
|
56
|
-
| `claymorph-ui/segmented` | `<clay-segmented>` |
|
|
57
|
-
| `claymorph-ui/select` | `<clay-select>` |
|
|
58
|
-
| `claymorph-ui/slide-confirm` | `<clay-slide-confirm>` |
|
|
59
|
-
| `claymorph-ui/slider` | `<clay-slider>` |
|
|
60
|
-
| `claymorph-ui/switch` | `<clay-switch>` |
|
|
61
|
-
| `claymorph-ui/tabs` | `<clay-tabs>` |
|
|
62
|
-
| `claymorph-ui/toast` | `<clay-toast-region>`, plus `toast` and `createToaster` |
|
|
63
|
-
| `claymorph-ui/toggle` | `<clay-toggle>` |
|
|
64
|
-
| `claymorph-ui/tooltip` | `<clay-tooltip>` |
|
|
65
|
-
|
|
66
|
-
The package root also exports `CLAY` and `SPRINGS`, the material and motion settings, and `getClayEngine`.
|
|
67
|
-
|
|
68
|
-
## TypeScript
|
|
69
|
-
|
|
70
|
-
Types ship with the package. Each entry adds its element to `HTMLElementTagNameMap`, so `document.querySelector("clay-select")` is typed as `ClaySelect`.
|
|
71
|
-
|
|
72
|
-
## Browsers
|
|
73
|
-
|
|
74
|
-
Any browser with WebGL2, the Popover API and CSS nesting draws the clay. Without WebGL2, the CSS fallback keeps every element usable and styled.
|
|
118
|
+
## Browser support
|
|
119
|
+
|
|
120
|
+
Any browser with WebGL2, the Popover API and CSS nesting draws the clay: current Chrome, Edge, Firefox and Safari. Without WebGL2, the CSS fallback keeps every element usable and styled.
|
|
121
|
+
|
|
122
|
+
## Links
|
|
123
|
+
|
|
124
|
+
- [Documentation](https://claymorph-ui.lauroguedes.dev/docs/introduction)
|
|
125
|
+
- [Source on GitHub](https://github.com/lauroguedes/claymorph-ui)
|
|
126
|
+
- [Changelog](https://claymorph-ui.lauroguedes.dev/changelog)
|
|
127
|
+
- [Issues](https://github.com/lauroguedes/claymorph-ui/issues)
|
|
75
128
|
|
|
76
129
|
## License
|
|
77
130
|
|
|
78
|
-
MIT
|
|
131
|
+
[MIT](https://github.com/lauroguedes/claymorph-ui/blob/main/LICENSE) © Lauro Guedes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claymorph-ui",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Claymorphism web components drawn by one WebGL2 shader, accessible by default with ui-sdk.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
7
7
|
"custom-elements",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"url": "git+https://github.com/lauroguedes/claymorph-ui.git",
|
|
18
18
|
"directory": "packages/claymorph-ui"
|
|
19
19
|
},
|
|
20
|
-
"homepage": "https://
|
|
20
|
+
"homepage": "https://claymorph-ui.lauroguedes.dev",
|
|
21
21
|
"bugs": {
|
|
22
22
|
"url": "https://github.com/lauroguedes/claymorph-ui/issues"
|
|
23
23
|
},
|