craft-library 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 +21 -0
- package/README.md +78 -2
- package/dist/cdn.js +3 -0
- package/dist/craft.js +1278 -0
- package/dist/elements.js +36 -0
- package/dist/glassnav.js +231 -0
- package/dist/index.js +43 -0
- package/dist/like.js +67 -0
- package/dist/magnet.js +308 -0
- package/dist/style.js +11 -0
- package/package.json +46 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sara Lobo
|
|
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
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Craft Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Interface pieces by [Sara Lobo](https://www.saralobodesign.com/), designed, tested and polished one detail at a time: a liquid glass nav bar, a bursting heart and a magnetic icon. Each one is the exact piece from the library, with its own CSS and motion, no dependencies, for React 18+ or plain HTML.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install craft-library
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Liquid glass nav bar
|
|
10
|
+
|
|
11
|
+
A 291×60 liquid glass bar for a dark app, the Figma glass layer by layer. The white capsule stretches as it travels to the chosen item, the neighbours step aside and each icon has its own gesture.
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
import { GlassNav } from 'craft-library';
|
|
15
|
+
|
|
16
|
+
const [tab, setTab] = useState(0);
|
|
17
|
+
<GlassNav active={tab} onSelect={setTab} />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
| Prop | | |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `active` | `0–4` | The chosen item: Home, Search, Ask AI, Messages, Settings. Changing it moves the capsule there. Default `2`. |
|
|
23
|
+
| `onSelect` | `(index) => void` | Every choice, by tap, drag or arrow keys. |
|
|
24
|
+
| `labels` | `string[5]` | The five accessible names, in order. |
|
|
25
|
+
| `label` | `string` | The bar's own name. Default `"Main navigation"`. |
|
|
26
|
+
|
|
27
|
+
The glass blends with what is behind it, so put the bar on a solid background and keep `transform`, `opacity`, `filter` and `isolation` off the bar and its wrapper.
|
|
28
|
+
|
|
29
|
+
## Bursting heart
|
|
30
|
+
|
|
31
|
+
A 40px round like button, black at 60%, made to sit over photos and mid-tone backgrounds. Liking: the heart vanishes, a pink disc grows into a lilac ring, 14 dots and 2 or 3 small hearts burst out, and the heart springs back filled. Unliking only takes the colour away.
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
import { LikeButton } from 'craft-library';
|
|
35
|
+
|
|
36
|
+
<LikeButton onChange={(liked) => saveLike(liked)} />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Prop | | |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `defaultLiked` | `boolean` | Starts liked, with no animation. |
|
|
42
|
+
| `onChange` | `(liked) => void` | After every tap. |
|
|
43
|
+
| `label` | `string` | The accessible name. Default `"Like"`. |
|
|
44
|
+
|
|
45
|
+
## Magnetic icon
|
|
46
|
+
|
|
47
|
+
A round search button with a brushed-metal rim, for dark backgrounds. Near the cursor the rim acts like metal near a strong magnet: the disc is drawn toward the pointer, the rim creases and trembles, its tip cracks into shards and small voxels fly off to the pointer.
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
import { MagneticIcon } from 'craft-library';
|
|
51
|
+
|
|
52
|
+
<MagneticIcon onClick={openSearch} />
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
| Prop | | |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `size` | `number \| string` | px or any CSS length; the whole effect scales with it. Default `40`. |
|
|
58
|
+
| `label` | `string` | The accessible name. Default `"Search"`. |
|
|
59
|
+
| `onClick` | `(event) => void` | |
|
|
60
|
+
|
|
61
|
+
## Plain HTML
|
|
62
|
+
|
|
63
|
+
One script registers three tags. Same pieces, same props as attributes.
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<script src="https://cdn.jsdelivr.net/npm/craft-library@0.1/dist/craft.js"></script>
|
|
67
|
+
|
|
68
|
+
<glass-nav active="0"></glass-nav> <!-- "select" event: e.detail.index -->
|
|
69
|
+
<like-button></like-button> <!-- "change" event: e.detail.liked -->
|
|
70
|
+
<magnetic-icon size="40"></magnetic-icon>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
With a bundler and no React: `import 'craft-library/elements'`.
|
|
74
|
+
|
|
75
|
+
## Motion and access
|
|
76
|
+
|
|
77
|
+
Every item is a real `<button>` with an accessible name; the nav marks the chosen one with `aria-current` and moves with the arrow keys. With `prefers-reduced-motion`, the heart only changes colour, the nav only slides and the magnet stays still.
|
|
78
|
+
|
|
79
|
+
MIT · [Craft Library](https://claude.ai/artifact/LBBWCfEHJGvfBSynV3wDuR)
|
package/dist/cdn.js
ADDED