craft-library 0.4.0 → 0.5.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 +30 -5
- package/dist/card.cdn.js +1 -1
- package/dist/card.js +1 -1
- package/dist/cdn.js +4 -4
- package/dist/craft.js +749 -30
- package/dist/elements.js +23 -2
- package/dist/glassnav.js +1 -1
- package/dist/index.js +16 -1
- package/dist/like.js +2 -2
- package/dist/magnet.js +2 -2
- package/dist/panorama/poster.webp +0 -0
- package/dist/panorama/reel.mp4 +0 -0
- package/dist/panorama/t/s01.webp +0 -0
- package/dist/panorama/t/s02.webp +0 -0
- package/dist/panorama/t/s03.webp +0 -0
- package/dist/panorama/t/s05.webp +0 -0
- package/dist/panorama/t/s06.webp +0 -0
- package/dist/panorama/t/s07.webp +0 -0
- package/dist/panorama/t/s08.webp +0 -0
- package/dist/panorama/t/s09.webp +0 -0
- package/dist/panorama/t/s10.webp +0 -0
- package/dist/panorama/t/s11.webp +0 -0
- package/dist/panorama/t/s12.webp +0 -0
- package/dist/panorama/t/s13.webp +0 -0
- package/dist/panorama/t/s14.webp +0 -0
- package/dist/panorama/t/s15.webp +0 -0
- package/dist/panorama/t/s16.webp +0 -0
- package/dist/panorama-assets.js +2 -0
- package/dist/panorama-mount.js +22 -0
- package/dist/panorama.js +496 -0
- package/dist/piggy.cdn.js +1 -1
- package/dist/piggy.js +1 -1
- package/dist/thinking.js +2 -2
- package/package.json +9 -4
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,
|
|
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, and the Panorama, a hero for moving pictures. 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 two 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
|
|
@@ -119,9 +119,33 @@ import { MagicSphere, SweepSphere } from 'craft-library';
|
|
|
119
119
|
|
|
120
120
|
Both are made for a dark background: the dots and the word are light. On a light one, set `--thinking-ink` (the dots and the light in the word) and `--thinking-dim` (the word at rest) on it or a parent. The element is a `role="status"`.
|
|
121
121
|
|
|
122
|
+
## Panorama
|
|
123
|
+
|
|
124
|
+
A hero for people who work with moving pictures. A clip opens full-bleed under letterbox bars while the title tracks in, its letters closing up from a wide spacing and out of a blur, centre first; then the clip shrinks into one screen of a panorama of monitors around you, and the other screens arrive in a wave from it. The pointer turns your head. The screens are black and white: colour lives only in a soft circle around the pointer, and the screen under it lights the dark with its own colours while focus brackets lock on and name it.
|
|
125
|
+
|
|
126
|
+
```jsx
|
|
127
|
+
import { PanoramaReel } from 'craft-library';
|
|
128
|
+
|
|
129
|
+
<PanoramaReel height="100vh" title="Northlight" text="Films for the" textItalic="long evening." />
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
| Prop | | |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `height` | `number \| string` | The box it fills: 100% wide and this tall. Default `640`. |
|
|
135
|
+
| `title`, `text`, `textItalic` | `string` | The title, and the line under it (`textItalic` follows `text` in the display face). Defaults: "Lorem ipsum", "Dolor sit amet," "consectetur adipiscing." |
|
|
136
|
+
| `video` | `{ src, poster, title, year }` | The opening clip, which then becomes the screen in the middle. |
|
|
137
|
+
| `stills` | `{ src, title, year }[]` | Up to 16 pictures for the other screens, cropped to 16:10. With neither `video` nor `stills`, it shows the library's own clip and 15 stills (served from jsDelivr). |
|
|
138
|
+
| `labels` | `boolean` | "CAM 07" on each screen. Default `true`. |
|
|
139
|
+
| `intro` | `boolean` | `false` starts it settled, without the opening. Default `true`. |
|
|
140
|
+
| `cursor` | `boolean` | The dot-and-ring pointer, for a mouse or trackpad. Default `true`. |
|
|
141
|
+
| `fonts` | `boolean` | `false` doesn't load Cormorant Garamond, Geist and Geist Mono from Google Fonts. Default `true`. |
|
|
142
|
+
| `replay` | `any` | Change it (a counter, say) to play the opening again. |
|
|
143
|
+
|
|
144
|
+
It is WebGL with no dependencies, so one per screen is best. Your clip and pictures must come from your own site or one that allows CORS. The opening plays the first time it comes into view; without WebGL it shows the poster and the title, still.
|
|
145
|
+
|
|
122
146
|
## Plain HTML
|
|
123
147
|
|
|
124
|
-
One script registers
|
|
148
|
+
One script registers eight tags. Same pieces, same props as attributes.
|
|
125
149
|
|
|
126
150
|
```html
|
|
127
151
|
<script src="https://cdn.jsdelivr.net/npm/craft-library@0/dist/craft.js"></script>
|
|
@@ -133,12 +157,13 @@ One script registers seven tags. Same pieces, same props as attributes.
|
|
|
133
157
|
<piggy-bank></piggy-bank> <!-- "piggydone" event after each play; el.play() replays; 100% wide, 560px tall unless you size it -->
|
|
134
158
|
<magic-sphere></magic-sphere> <!-- label="Thinking" (default; label="" for the ball alone), size="32" -->
|
|
135
159
|
<sweep-sphere></sweep-sphere>
|
|
160
|
+
<panorama-reel heading="Lorem ipsum"></panorama-reel> <!-- text, text-italic; video and stills as JSON; el.replay(); 100% wide, 640px tall unless you size it -->
|
|
136
161
|
```
|
|
137
162
|
|
|
138
163
|
With a bundler and no React: `import 'craft-library/elements'`.
|
|
139
164
|
|
|
140
165
|
## Motion and access
|
|
141
166
|
|
|
142
|
-
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 is a labelled image. 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,
|
|
167
|
+
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 is a labelled image. 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, and the panorama skips its opening and starts settled. The panorama's title is a heading; its screens and cursor are decorative.
|
|
143
168
|
|
|
144
|
-
MIT · [
|
|
169
|
+
MIT · [Sara Lobo Library](https://saralobolibrary.com)
|
package/dist/card.cdn.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Iridescent card ·
|
|
1
|
+
// Iridescent card · Sara Lobo Library
|
|
2
2
|
// A metal credit card in 3D: brushed iridescent plate, a fine struck frame along the edge, a chip and the Visa mark.
|
|
3
3
|
// It arrives with a slow half turn, from its back to its face, and a tap turns it over to show the numbers.
|
|
4
4
|
//
|
package/dist/card.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Iridescent card ·
|
|
1
|
+
// Iridescent card · Sara Lobo Library
|
|
2
2
|
// A metal credit card in 3D: brushed iridescent plate, a fine struck frame along the edge, a chip and the Visa mark.
|
|
3
3
|
// It arrives with a slow half turn, from its back to its face, and a tap turns it over to show the numbers.
|
|
4
4
|
//
|
package/dist/cdn.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// the one-file build for a <script> tag: registers the
|
|
2
|
-
// are fetched from next to this file the first time one is mounted)
|
|
3
|
-
import { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking } from './elements.js';
|
|
4
|
-
window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking };
|
|
1
|
+
// the one-file build for a <script> tag: registers the eight tags and exposes the mount functions (the 3D pieces' scenes
|
|
2
|
+
// are fetched from next to this file the first time one is mounted, and so are the Panorama's clip and pictures)
|
|
3
|
+
import { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel } from './elements.js';
|
|
4
|
+
window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel };
|