craft-library 0.9.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 +33 -2
- 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 +863 -22
- package/dist/elements.js +25 -4
- package/dist/glassnav.js +1 -1
- package/dist/index.js +17 -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 +1 -1
- 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 +1 -1
package/README.md
CHANGED
|
@@ -236,6 +236,36 @@ const [state, setState] = useState('idle'); // yours: "idle", "typing", "liste
|
|
|
236
236
|
|
|
237
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
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
|
+
|
|
239
269
|
## Magic sphere and Sweep
|
|
240
270
|
|
|
241
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>
|
|
@@ -288,7 +318,7 @@ It is WebGL with no dependencies, so one per screen is best. Your clip and pictu
|
|
|
288
318
|
|
|
289
319
|
## Plain HTML
|
|
290
320
|
|
|
291
|
-
One script registers
|
|
321
|
+
One script registers thirteen tags. Same pieces, same props as attributes.
|
|
292
322
|
|
|
293
323
|
```html
|
|
294
324
|
<script src="https://cdn.jsdelivr.net/npm/craft-library@0/dist/craft.js"></script>
|
|
@@ -305,13 +335,14 @@ One script registers twelve tags. Same pieces, same props as attributes.
|
|
|
305
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 -->
|
|
306
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") -->
|
|
307
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() -->
|
|
308
339
|
```
|
|
309
340
|
|
|
310
341
|
With a bundler and no React: `import 'craft-library/elements'`.
|
|
311
342
|
|
|
312
343
|
## Motion and access
|
|
313
344
|
|
|
314
|
-
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
|
|
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.
|
|
315
346
|
|
|
316
347
|
MIT · [Sara Lobo Library](https://saralobolibrary.com)
|
|
317
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, mountFoldOrb } from './elements.js';
|
|
5
|
-
window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel, mountThumbsReaction, mountFoldOrb };
|
|
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 };
|