craft-library 0.8.0 → 0.10.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 +66 -3
- package/dist/card-load.js +1 -1
- package/dist/card-mount.js +1 -1
- package/dist/card.cdn.js +1 -1
- package/dist/card.js +1 -1
- package/dist/cdn.js +4 -4
- package/dist/craft.js +1473 -5
- package/dist/elements.js +55 -4
- package/dist/glassnav.js +1 -1
- package/dist/index.js +36 -2
- package/dist/joinha.js +1 -1
- package/dist/leporello-assets.js +3 -0
- package/dist/leporello.js +466 -0
- package/dist/like.js +1 -1
- package/dist/magnet.js +1 -1
- package/dist/olea/amb-ecobag.jpg +0 -0
- package/dist/olea/amb-linha.jpg +0 -0
- package/dist/olea/amb-mesa.jpg +0 -0
- package/dist/olea/amb-papelaria.jpg +0 -0
- package/dist/olea/amb-rotulo.jpg +0 -0
- package/dist/olea/ecobag.jpg +0 -0
- package/dist/olea/linha.jpg +0 -0
- package/dist/olea/mesa.jpg +0 -0
- package/dist/olea/papelaria.jpg +0 -0
- package/dist/olea/rotulo.jpg +0 -0
- package/dist/orb.js +381 -0
- package/dist/panorama-assets.js +2 -2
- package/dist/panorama-mount.js +1 -1
- package/dist/panorama.js +1 -1
- package/dist/piggy-load.js +1 -1
- package/dist/piggy-mount.js +1 -1
- package/dist/piggy.cdn.js +1 -1
- package/dist/piggy.js +1 -1
- package/dist/pin-load.js +1 -1
- package/dist/pin-mount.js +1 -1
- package/dist/pin.cdn.js +1 -1
- package/dist/pin.js +1 -1
- package/dist/sign.js +1 -1
- package/dist/style.js +1 -1
- package/dist/thinking.js +1 -1
- package/dist/tokens-load.js +1 -1
- package/dist/tokens-mount.js +1 -1
- package/dist/tokens.cdn.js +1 -1
- package/dist/tokens.js +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Sara Lobo Library
|
|
2
2
|
|
|
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, a magnetic icon, an iridescent 3D card, a glass piggy bank, two "thinking" indicators, the Magic sphere and the Sweep, the Panorama, a hero for moving pictures, the Map pin, an address picker, the Token wheel, an onboarding screen,
|
|
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, a magnetic icon, an iridescent 3D card, a glass piggy bank, two "thinking" indicators, the Magic sphere and the Sweep, the Panorama, a hero for moving pictures, the Map pin, an address picker, the Token wheel, an onboarding screen, the Thumbs reaction, a like and a dislike with simulated physics, and the Fold orb, an AI assistant orb that watches what you type. Each one is the exact piece from the library, with its own CSS and motion, for React 18+ or plain HTML. The only dependency is three.js, for five of the 3D pieces, and it loads only when one of them is on the page.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install craft-library
|
|
@@ -205,6 +205,67 @@ import { ThumbsReaction } from 'craft-library';
|
|
|
205
205
|
|
|
206
206
|
It takes the text colour: set `color` on it or its parent. The jump and the ring leave the icons' box, so keep room around it, with no `overflow: hidden` right next to it.
|
|
207
207
|
|
|
208
|
+
## Fold orb
|
|
209
|
+
|
|
210
|
+
<a href="https://saralobolibrary.com/orb?ref=npm"><img src="https://saralobolibrary.com/og/orb.jpg" width="600" alt="Fold orb, Sara Lobo Library"></a>
|
|
211
|
+
|
|
212
|
+
[See it live and copy its prompt →](https://saralobolibrary.com/orb?ref=npm)
|
|
213
|
+
|
|
214
|
+
An AI assistant orb that pays attention without a face, drawn by one WebGL shader (no dependencies): a glass sphere with two twisted folds of light inside, in three sibling tones that each paint their own ground. Typing, it sharpens and turns its fold and its rim toward the caret, and every key gives it a small push; listening and speaking, the voice ripples its folds; thinking, its folds turn faster and it defocuses into soft stripes of colour. Every motion runs on its own spring, so a change of state or tone never jumps.
|
|
215
|
+
|
|
216
|
+
```jsx
|
|
217
|
+
import { useRef, useState } from 'react';
|
|
218
|
+
import { FoldOrb } from 'craft-library';
|
|
219
|
+
|
|
220
|
+
const field = useRef(null);
|
|
221
|
+
const [state, setState] = useState('idle'); // yours: "idle", "typing", "listening", "thinking" or "speaking"
|
|
222
|
+
|
|
223
|
+
<FoldOrb tone="steel" state={state} height={420} follow={field} />
|
|
224
|
+
<input ref={field} />
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
| Prop | | |
|
|
228
|
+
|---|---|---|
|
|
229
|
+
| `tone` | `"steel"`, `"mist"` or `"blue"` | Mid grey with a white glow, a light ground with clear glass, or night blue. Default `"steel"`. |
|
|
230
|
+
| `state` | `"idle"`, `"typing"`, `"listening"`, `"thinking"`, `"speaking"` | Default `"idle"`. |
|
|
231
|
+
| `height` | `number` or CSS length | It is 100% wide. Default `420`. |
|
|
232
|
+
| `follow` | a ref, an element or a selector | A text field: while it has focus, the orb watches its caret and reacts to every key. |
|
|
233
|
+
| `level` | `0`–`1` | Your own audio, for `"listening"` and `"speaking"`. Leave it out and a built-in voice drives them. |
|
|
234
|
+
| `mic` | `boolean` | `"listening"` uses the microphone (it asks for permission). |
|
|
235
|
+
| `label` | `string` | Its accessible name. Default `"AI assistant"`. |
|
|
236
|
+
|
|
237
|
+
It paints its own ground in each tone, so give it a box: a hero area or the top of a chat screen. Each orb uses one WebGL context.
|
|
238
|
+
|
|
239
|
+
## Leporello
|
|
240
|
+
|
|
241
|
+
<a href="https://saralobolibrary.com/leporello?ref=npm"><img src="https://saralobolibrary.com/og/leporello.jpg" width="600" alt="Leporello, Sara Lobo Library"></a>
|
|
242
|
+
|
|
243
|
+
[See it live and copy its prompt →](https://saralobolibrary.com/leporello?ref=npm)
|
|
244
|
+
|
|
245
|
+
A brand book folded like a leporello, in CSS 3D with no dependencies: the pages fold against each other on alternate creases, flat in the middle and tighter towards the edges, each lit by the angle of its fold. The strip drifts on its own at a speed that breathes (slow with a page in the middle, quick between pages), stops under the pointer, and can be dragged or leafed with the arrow keys; the background takes the blurred light of the middle page. A click on the middle page grows it on four springs into a page of its own, with its title, text and arrows; the × or Esc puts it back where it came from.
|
|
246
|
+
|
|
247
|
+
```jsx
|
|
248
|
+
import { Leporello } from 'craft-library';
|
|
249
|
+
|
|
250
|
+
<Leporello height={560} /> // the library's own book (Olea)
|
|
251
|
+
|
|
252
|
+
<Leporello height={560} pages={[
|
|
253
|
+
{ title: 'Cover', text: 'One line about it.', image: '/img/cover.jpg' },
|
|
254
|
+
// … four or more
|
|
255
|
+
]} onOpen={(i) => console.log('opened', i)} />
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
| Prop | | |
|
|
259
|
+
|---|---|---|
|
|
260
|
+
| `height` | `number` or CSS length | It is 100% wide and paints its own dark ground. Default `560`. |
|
|
261
|
+
| `pages` | `[{ title, text, image }]` | Four or more. Leave it out to show the library's own brand book (loaded from the CDN). Portrait pictures (3:4) fit best. |
|
|
262
|
+
| `kicker`, `title` | `string` | The small word and the heading above the strip. Defaults `"OLEA"` and `"Brand <em>book</em>"`. |
|
|
263
|
+
| `autoplay` | `boolean` | `false` keeps it still until someone drags it. Default `true`. |
|
|
264
|
+
| `onChange`, `onOpen`, `onClose` | `(index) => void` | The page in the middle, a page opened, a page closed. |
|
|
265
|
+
| `labels` | `{ open, close, prev, next, region }` | The "Open" disc's word and the buttons' names. |
|
|
266
|
+
|
|
267
|
+
Made for desktop: give it a wide box, about 880×560 or more. The headings use Cormorant Garamond from Google Fonts (`fonts: false` in `mountLeporello` leaves it to you).
|
|
268
|
+
|
|
208
269
|
## Magic sphere and Sweep
|
|
209
270
|
|
|
210
271
|
<a href="https://saralobolibrary.com/sphere?ref=npm"><img src="https://saralobolibrary.com/og/sphere.jpg" width="296" alt="Magic sphere, Sara Lobo Library"></a> <a href="https://saralobolibrary.com/sweep?ref=npm"><img src="https://saralobolibrary.com/og/sweep.jpg" width="296" alt="Sweep, Sara Lobo Library"></a>
|
|
@@ -257,7 +318,7 @@ It is WebGL with no dependencies, so one per screen is best. Your clip and pictu
|
|
|
257
318
|
|
|
258
319
|
## Plain HTML
|
|
259
320
|
|
|
260
|
-
One script registers
|
|
321
|
+
One script registers thirteen tags. Same pieces, same props as attributes.
|
|
261
322
|
|
|
262
323
|
```html
|
|
263
324
|
<script src="https://cdn.jsdelivr.net/npm/craft-library@0/dist/craft.js"></script>
|
|
@@ -273,13 +334,15 @@ One script registers eleven tags. Same pieces, same props as attributes.
|
|
|
273
334
|
<map-pin></map-pin> <!-- "pinchange" and "pinconfirm" events: e.detail { address, neighbourhood, place }; label-title, label-confirm, label-confirmed; el.replay(); 100% wide, 560px tall unless you size it -->
|
|
274
335
|
<token-wheel></token-wheel> <!-- "tokenscontinue" event; label-eyebrow, label-title, label-cta, initials; frame="false", controls="false", turned; el.turn(true|false), el.replay(); 100% wide, 900px tall unless you size it -->
|
|
275
336
|
<thumbs-reaction></thumbs-reaction> <!-- "change" event: e.detail.value ("up", "down" or null); value, size="24", label-up, label-down; el.set(v), el.play("up") -->
|
|
337
|
+
<fold-orb tone="steel" follow="#ask"></fold-orb> <!-- tone steel|mist|blue, state idle|typing|listening|thinking|speaking (change the attribute or el.state), height="420", level="0.6", mic; el.pulse(), el.lookAt(x, y) -->
|
|
338
|
+
<leporello-book style="height:560px"></leporello-book> <!-- "leporellochange", "leporelloopen", "leporelloclose" events: e.detail.index; pages as JSON, kicker, heading, autoplay="false"; el.open(), el.close(), el.next(), el.prev() -->
|
|
276
339
|
```
|
|
277
340
|
|
|
278
341
|
With a bundler and no React: `import 'craft-library/elements'`.
|
|
279
342
|
|
|
280
343
|
## Motion and access
|
|
281
344
|
|
|
282
|
-
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. The card is a `role="button"` that Enter, Space and the arrow keys turn over; the piggy bank and the map pin's map are labelled images; the pin's address is announced as it changes and Confirm is a real button. With `prefers-reduced-motion`, the heart only changes colour, the nav only slides, the magnet stays still, the card swaps faces with a fade, with no entrance and no breathing, the piggy bank stays in place while the coins appear inside it and its eyes close, the thinking balls hold still and only breathe, the panorama skips its opening and starts settled, the map pin appears in place without its flight, the token wheel starts formed and still,
|
|
345
|
+
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. The card is a `role="button"` that Enter, Space and the arrow keys turn over; the piggy bank and the map pin's map are labelled images; the pin's address is announced as it changes and Confirm is a real button. With `prefers-reduced-motion`, the heart only changes colour, the nav only slides, the magnet stays still, the card swaps faces with a fade, with no entrance and no breathing, the piggy bank stays in place while the coins appear inside it and its eyes close, the thinking balls hold still and only breathe, the panorama skips its opening and starts settled, the map pin appears in place without its flight, the token wheel starts formed and still, the thumbs only fill,, the orb stops swaying and turns its folds slowly, and the leporello stops drifting on its own and its page opens and closes in place. The token wheel's wheel is a `role="button"` that Enter and Space replay, its title is a heading and its round buttons are real buttons with names. The panorama's title is a heading; its screens and cursor are decorative. The thumbs are a group of two `<button aria-pressed>`, each with a name, and holding Enter or Space charges the jump like a press. The orb is a labelled image (`role="img"`). The leporello is a labelled region (`aria-roledescription="carousel"`): the arrow keys leaf through it, Enter opens the middle page, Esc closes it, and focus moves to its close button.
|
|
283
346
|
|
|
284
347
|
MIT · [Sara Lobo Library](https://saralobolibrary.com)
|
|
285
348
|
|
package/dist/card-load.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Sara Lobo Library · craft-library 0.
|
|
1
|
+
/*! Sara Lobo Library · craft-library 0.10.0 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
|
|
2
2
|
// where the card comes from: for bundlers, the package's card.js (it imports the `three` dependency)
|
|
3
3
|
export const loadCard = () => import('./card.js');
|
package/dist/card-mount.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Sara Lobo Library · craft-library 0.
|
|
1
|
+
/*! Sara Lobo Library · craft-library 0.10.0 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
|
|
2
2
|
// Iridescent card: the mount around the library's card.js. card.js, and three.js with it, loads only when a card is
|
|
3
3
|
// mounted, so the other pieces stay light.
|
|
4
4
|
import { loadCard } from './card-load.js';
|
package/dist/card.cdn.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Sara Lobo Library · craft-library 0.
|
|
1
|
+
/*! Sara Lobo Library · craft-library 0.10.0 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
|
|
2
2
|
// Iridescent card · Sara Lobo Library
|
|
3
3
|
// A metal credit card in 3D: brushed iridescent plate, a fine struck frame along the edge, a chip and the Visa mark.
|
|
4
4
|
// It arrives with a slow half turn, from its back to its face, and a tap turns it over to show the numbers.
|
package/dist/card.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Sara Lobo Library · craft-library 0.
|
|
1
|
+
/*! Sara Lobo Library · craft-library 0.10.0 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
|
|
2
2
|
// Iridescent card · Sara Lobo Library
|
|
3
3
|
// A metal credit card in 3D: brushed iridescent plate, a fine struck frame along the edge, a chip and the Visa mark.
|
|
4
4
|
// It arrives with a slow half turn, from its back to its face, and a tap turns it over to show the numbers.
|
package/dist/cdn.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! Sara Lobo Library · craft-library 0.
|
|
2
|
-
// the one-file build for a <script> tag: registers the
|
|
1
|
+
/*! Sara Lobo Library · craft-library 0.10.0 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
|
|
2
|
+
// the one-file build for a <script> tag: registers the tags and exposes the mount functions (the 3D pieces' scenes
|
|
3
3
|
// are fetched from next to this file the first time one is mounted, and so are the Panorama's clip and pictures)
|
|
4
|
-
import { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel, mountThumbsReaction } from './elements.js';
|
|
5
|
-
window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel, mountThumbsReaction };
|
|
4
|
+
import { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel, mountThumbsReaction, mountFoldOrb, mountLeporello } from './elements.js';
|
|
5
|
+
window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel, mountThumbsReaction, mountFoldOrb, mountLeporello };
|