craft-library 0.6.0 → 0.7.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 CHANGED
@@ -1,13 +1,21 @@
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, and the Map pin, an address picker. 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 three of the 3D pieces, and it loads only when one of them is on the page.
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, and the Token wheel, an onboarding screen. 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
7
7
  ```
8
8
 
9
+ <a href="https://saralobolibrary.com/?ref=npm"><img src="https://saralobolibrary.com/og/home.jpg" width="600" alt="Sara Lobo Library: micro-interactions with craft, to use and remix"></a>
10
+
11
+ **See every piece live, and copy a short prompt for Claude Code, Cursor, Lovable, Codex, Figma Make or Gemini: [saralobolibrary.com](https://saralobolibrary.com/?ref=npm)**
12
+
9
13
  ## Liquid glass nav bar
10
14
 
15
+ <a href="https://saralobolibrary.com/glassnav?ref=npm"><img src="https://saralobolibrary.com/og/glassnav.jpg" width="600" alt="Liquid glass nav bar, Sara Lobo Library"></a>
16
+
17
+ [See it live and copy its prompt →](https://saralobolibrary.com/glassnav?ref=npm)
18
+
11
19
  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
20
 
13
21
  ```jsx
@@ -28,6 +36,10 @@ The glass blends with what is behind it, so put the bar on a solid background an
28
36
 
29
37
  ## Bursting heart
30
38
 
39
+ <a href="https://saralobolibrary.com/like?ref=npm"><img src="https://saralobolibrary.com/og/like.jpg" width="600" alt="Bursting heart, Sara Lobo Library"></a>
40
+
41
+ [See it live and copy its prompt →](https://saralobolibrary.com/like?ref=npm)
42
+
31
43
  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
44
 
33
45
  ```jsx
@@ -44,6 +56,10 @@ import { LikeButton } from 'craft-library';
44
56
 
45
57
  ## Magnetic icon
46
58
 
59
+ <a href="https://saralobolibrary.com/magnet?ref=npm"><img src="https://saralobolibrary.com/og/magnet.jpg" width="600" alt="Magnetic icon, Sara Lobo Library"></a>
60
+
61
+ [See it live and copy its prompt →](https://saralobolibrary.com/magnet?ref=npm)
62
+
47
63
  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 and, where it is pulled, comes apart in small voxels of metal; its tip cracks into shards and the voxels fly off to the pointer.
48
64
 
49
65
  ```jsx
@@ -60,6 +76,10 @@ import { MagneticIcon } from 'craft-library';
60
76
 
61
77
  ## Iridescent card
62
78
 
79
+ <a href="https://saralobolibrary.com/card?ref=npm"><img src="https://saralobolibrary.com/og/card.jpg" width="600" alt="Iridescent card, Sara Lobo Library"></a>
80
+
81
+ [See it live and copy its prompt →](https://saralobolibrary.com/card?ref=npm)
82
+
63
83
  A 3D metal credit card: a brushed iridescent plate, a fine struck frame along the edge, a chip and the Visa mark. It arrives showing its back and makes a slow half turn to its face; a tap or a drag turns it over to show the numbers, heavy and without bounce. At rest it breathes slowly, and the light slides across the metal with its angle.
64
84
 
65
85
  ```jsx
@@ -82,6 +102,10 @@ It is WebGL (three.js 0.169, which comes with the package and loads the first ti
82
102
 
83
103
  ## Glass piggy bank
84
104
 
105
+ <a href="https://saralobolibrary.com/piggy?ref=npm"><img src="https://saralobolibrary.com/og/piggy.jpg" width="600" alt="Glass piggy bank, Sara Lobo Library"></a>
106
+
107
+ [See it live and copy its prompt →](https://saralobolibrary.com/piggy?ref=npm)
108
+
85
109
  A congratulations moment in 3D, made for a phone screen: a frosted glass piggy bank hops in from the right with a full turn, lands on its hind feet, nearly tips over and clacks back down, rocking like the rigid glass it is. Coins pop into the air above it and drop in through the slot; each one knocks the glass, and its eyes close a little more until they curve, happy. It plays the first time it comes into view; a tap plays it again.
86
110
 
87
111
  ```jsx
@@ -103,6 +127,10 @@ It is WebGL (three.js 0.169, which comes with the package and loads the first ti
103
127
 
104
128
  ## Map pin
105
129
 
130
+ <a href="https://saralobolibrary.com/pin?ref=npm"><img src="https://saralobolibrary.com/og/pin.jpg" width="600" alt="Map pin, Sara Lobo Library"></a>
131
+
132
+ [See it live and copy its prompt →](https://saralobolibrary.com/pin?ref=npm)
133
+
106
134
  A 3D address picker: a hollow frosted-glass map pin over a dark city map in perspective. A click or a tap on a street sends the pin flying on springs to the nearest curb: it lifts, its head leans with the acceleration, it rises a touch to aim, falls under gravity and sticks its tip in, the glass vibrating about it. The map is sharp where it lands and soft further away, the streets carry their names, and a card along the bottom shows the address, with the number on the right side of the street, to confirm. With a mouse, hovering shows the address a click would give. The city and its names are invented, to show the gesture.
107
135
 
108
136
  ```jsx
@@ -124,8 +152,41 @@ import { MapPin } from 'craft-library';
124
152
 
125
153
  It is WebGL (three.js 0.169, which comes with the package and loads the first time it mounts), so one per screen is best. It paints its own dark ground.
126
154
 
155
+ ## Token wheel
156
+
157
+ <a href="https://saralobolibrary.com/tokens?ref=npm"><img src="https://saralobolibrary.com/og/tokens.jpg" width="600" alt="Token wheel, Sara Lobo Library"></a>
158
+
159
+ [See it live and copy its prompt →](https://saralobolibrary.com/tokens?ref=npm)
160
+
161
+ An account onboarding screen in 3D: eight silver tokens (Pix, card, Bitcoin, insurance, investments, exchange, cashback, boleto) turn slowly on a wheel, and the one at the top comes forward and makes a full turn to show what it is. Turn the phone on its side and the tokens let go: they fall, roll and pile up against the edge of the screen with rigid-body physics, a metal bounce and a wobble at every knock; stand it up and, once they rest, they float back into the wheel. The screen sits in a phone that scales to fit the box at every angle, with two round buttons beside it: turn the phone, replay.
162
+
163
+ ```jsx
164
+ import { TokenWheel } from 'craft-library';
165
+
166
+ <TokenWheel height={900} onContinue={() => goToNextStep()} /> // goToNextStep: your own handler
167
+ ```
168
+
169
+ | Prop | | |
170
+ |---|---|---|
171
+ | `height` | `number \| string` | The box it fills: 100% wide and this tall. Default `900`. |
172
+ | `labels` | `{ eyebrow, title, cta, initials }` | The screen's words. Defaults `"Account · BRL"`, `"One account for everything"`, `"Continue"`, `"SL"`. |
173
+ | `onContinue` | `() => void` | When the white pill is pressed. |
174
+ | `turned` | `boolean` | `true` lays the phone on its side, `false` stands it up. |
175
+ | `frame` | `boolean` | `false` fills the box with the screen itself, for a real phone (give it `100svh`): the phone's own tilt then moves the tokens (on iOS, after a tap on the wheel). Default `true`. |
176
+ | `controls` | `boolean` | `false` hides the two round buttons. Default `true`. |
177
+ | `replay` | `any` | Change it (a counter, say) to play the opening again. |
178
+ | `autoplay` | `boolean` | `false` keeps the tokens out until `replay` changes. Default `true`. |
179
+ | `gyroscope` | `boolean` | `false` never reads the phone's tilt. Default `true`. |
180
+ | `fonts` | `boolean` | `false` doesn't load DM Sans from Google Fonts. Default `true`. |
181
+
182
+ It is WebGL (three.js 0.169, which comes with the package and loads the first time it mounts), so one per screen is best. The screen is true black; put it on a dark page.
183
+
127
184
  ## Magic sphere and Sweep
128
185
 
186
+ <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>
187
+
188
+ [See the Magic sphere live and copy its prompt →](https://saralobolibrary.com/sphere?ref=npm) · [See the Sweep live and copy its prompt →](https://saralobolibrary.com/sweep?ref=npm)
189
+
129
190
  Two "thinking" indicators for the wait while an answer is being written: a ball of dots, drawn on a canvas, with the word beside it. The **Magic sphere** is a Rubik's cube on a ball, one grey tone per face: its slices turn and scramble the pieces, retrace their steps until every piece is home, and the ball lights up for a moment while a light passes through the word. In the **Sweep**, a wave crosses a dotted globe from left to right, lifting the dots it passes, runs on through the word at the same speed, and rests.
130
191
 
131
192
  ```jsx
@@ -144,6 +205,10 @@ Both are made for a dark background: the dots and the word are light. On a light
144
205
 
145
206
  ## Panorama
146
207
 
208
+ <a href="https://saralobolibrary.com/panorama?ref=npm"><img src="https://saralobolibrary.com/og/panorama.jpg" width="600" alt="Panorama, Sara Lobo Library"></a>
209
+
210
+ [See it live and copy its prompt →](https://saralobolibrary.com/panorama?ref=npm)
211
+
147
212
  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.
148
213
 
149
214
  ```jsx
@@ -168,7 +233,7 @@ It is WebGL with no dependencies, so one per screen is best. Your clip and pictu
168
233
 
169
234
  ## Plain HTML
170
235
 
171
- One script registers nine tags. Same pieces, same props as attributes.
236
+ One script registers ten tags. Same pieces, same props as attributes.
172
237
 
173
238
  ```html
174
239
  <script src="https://cdn.jsdelivr.net/npm/craft-library@0/dist/craft.js"></script>
@@ -182,12 +247,27 @@ One script registers nine tags. Same pieces, same props as attributes.
182
247
  <sweep-sphere></sweep-sphere>
183
248
  <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 -->
184
249
  <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 -->
250
+ <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 -->
185
251
  ```
186
252
 
187
253
  With a bundler and no React: `import 'craft-library/elements'`.
188
254
 
189
255
  ## Motion and access
190
256
 
191
- 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, and the map pin appears in place without its flight. The panorama's title is a heading; its screens and cursor are decorative.
257
+ 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, and the token wheel starts formed and still. 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.
192
258
 
193
259
  MIT · [Sara Lobo Library](https://saralobolibrary.com)
260
+
261
+ ## Credit
262
+
263
+ The pieces are free and MIT-licensed. If you use one, a credit is welcome, never required:
264
+
265
+ - every file keeps a one-line `/*!` comment saying where it comes from (minifiers keep that kind);
266
+ - in the browser console, the package says once, quietly, where the pieces come from. To skip it, set `window.CRAFT_LIBRARY_QUIET = true` right after importing the package;
267
+ - to show it in your README or on your site, paste this badge:
268
+
269
+ ```md
270
+ [![Made with Sara Lobo Library](https://img.shields.io/badge/made_with-Sara_Lobo_Library-111214?style=flat-square)](https://saralobolibrary.com/?ref=badge)
271
+ ```
272
+
273
+ [![Made with Sara Lobo Library](https://img.shields.io/badge/made_with-Sara_Lobo_Library-111214?style=flat-square)](https://saralobolibrary.com/?ref=npm)
package/dist/card-load.js CHANGED
@@ -1,2 +1,3 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // where the card comes from: for bundlers, the package's card.js (it imports the `three` dependency)
2
3
  export const loadCard = () => import('./card.js');
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Iridescent card: the mount around the library's card.js. card.js, and three.js with it, loads only when a card is
2
3
  // mounted, so the other pieces stay light.
3
4
  import { loadCard } from './card-load.js';
package/dist/card.cdn.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Iridescent card · Sara Lobo Library
2
3
  // A metal credit card in 3D: brushed iridescent plate, a fine struck frame along the edge, a chip and the Visa mark.
3
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,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Iridescent card · Sara Lobo Library
2
3
  // A metal credit card in 3D: brushed iridescent plate, a fine struck frame along the edge, a chip and the Visa mark.
3
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,4 +1,5 @@
1
- // the one-file build for a <script> tag: registers the nine tags and exposes the mount functions (the 3D pieces' scenes
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
2
+ // the one-file build for a <script> tag: registers the ten tags and exposes the mount functions (the 3D pieces' scenes
2
3
  // 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, mountMapPin } from './elements.js';
4
- window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin };
4
+ import { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel } from './elements.js';
5
+ window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel };
package/dist/craft.js CHANGED
@@ -1,4 +1,4 @@
1
- /* Sara Lobo Library · liquid glass nav bar, bursting heart, magnetic icon, iridescent card, glass piggy bank, magic sphere, sweep, panorama, map pin · <glass-nav>, <like-button>, <magnetic-icon>, <iridescent-card>, <piggy-bank>, <magic-sphere>, <sweep-sphere>, <panorama-reel>, <map-pin> */
1
+ /*! Sara Lobo Library · liquid glass nav bar, bursting heart, magnetic icon, iridescent card, glass piggy bank, magic sphere, sweep, panorama, map pin, token wheel · <glass-nav>, <like-button>, <magnetic-icon>, <iridescent-card>, <piggy-bank>, <magic-sphere>, <sweep-sphere>, <panorama-reel>, <map-pin>, <token-wheel> · https://saralobolibrary.com · MIT */
2
2
  (() => {
3
3
  // dist/style.js
4
4
  var done = /* @__PURE__ */ new Set();
@@ -2010,10 +2010,10 @@ void main() {
2010
2010
  for (let i = 0; i < MAX; i++) idx.set([i * 4, i * 4 + 1, i * 4 + 2, i * 4, i * 4 + 2, i * 4 + 3], i * 6);
2011
2011
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, gl.createBuffer());
2012
2012
  gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, idx, gl.STATIC_DRAW);
2013
- [["aPos", 3, 0], ["aUv", 2, 3], ["aRect", 4, 5], ["aMisc", 4, 9], ["aPan", 2, 13], ["aLab", 2, 15], ["aGlow", 1, 17]].forEach(([name, size, off]) => {
2013
+ [["aPos", 3, 0], ["aUv", 2, 3], ["aRect", 4, 5], ["aMisc", 4, 9], ["aPan", 2, 13], ["aLab", 2, 15], ["aGlow", 1, 17]].forEach(([name, size, off2]) => {
2014
2014
  const loc = gl.getAttribLocation(prog, name);
2015
2015
  gl.enableVertexAttribArray(loc);
2016
- gl.vertexAttribPointer(loc, size, gl.FLOAT, false, F * 4, off * 4);
2016
+ gl.vertexAttribPointer(loc, size, gl.FLOAT, false, F * 4, off2 * 4);
2017
2017
  });
2018
2018
  const U = (n2) => gl.getUniformLocation(prog, n2);
2019
2019
  const uHalf = U("uHalf"), uP = U("uP"), uLab = U("uLab"), uView = U("uView"), uDpr = U("uDpr"), uColor = U("uColor");
@@ -2519,7 +2519,65 @@ void main() {
2519
2519
  };
2520
2520
  }
2521
2521
 
2522
+ // src/tokens-load-cdn.js
2523
+ var me5 = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : "";
2524
+ var base4 = me5 ? me5.slice(0, me5.lastIndexOf("/") + 1) : "https://cdn.jsdelivr.net/npm/craft-library@0/dist/";
2525
+ var loadTokens = () => import(base4 + "tokens.cdn.js");
2526
+
2527
+ // dist/tokens-mount.js
2528
+ function mountTokenWheel(host, o = {}) {
2529
+ let w = null, gone = false, wantReplay = false, wantTurn = o.turned ? true : null;
2530
+ const opts = { labels: o.labels, frame: o.frame, controls: o.controls, autoplay: o.autoplay, fonts: o.fonts, gyroscope: o.gyroscope };
2531
+ const cont = () => {
2532
+ if (o.onContinue) o.onContinue();
2533
+ };
2534
+ host.addEventListener("tokenscontinue", cont);
2535
+ const ready = loadTokens().then((m) => {
2536
+ if (gone) return null;
2537
+ w = m.mountTokens(host, opts);
2538
+ if (wantTurn != null) w.turn(wantTurn);
2539
+ if (wantReplay) w.replay();
2540
+ return w.ready.then(() => w);
2541
+ });
2542
+ return {
2543
+ ready,
2544
+ replay: () => {
2545
+ if (w) w.replay();
2546
+ else wantReplay = true;
2547
+ },
2548
+ turn: (side) => {
2549
+ if (w) return w.turn(side);
2550
+ wantTurn = side == null ? !wantTurn : !!side;
2551
+ return wantTurn;
2552
+ },
2553
+ gyroscope: () => w ? w.gyroscope() : Promise.resolve(false),
2554
+ // call it from a tap: iOS asks the person first
2555
+ get turned() {
2556
+ return w ? w.turned : !!wantTurn;
2557
+ },
2558
+ destroy() {
2559
+ gone = true;
2560
+ host.removeEventListener("tokenscontinue", cont);
2561
+ if (w) w.destroy();
2562
+ w = null;
2563
+ }
2564
+ };
2565
+ }
2566
+
2567
+ // dist/sign.js
2568
+ function sign() {
2569
+ if (typeof window === "undefined" || typeof document === "undefined" || window.__craftLibrarySigned) return;
2570
+ window.__craftLibrarySigned = true;
2571
+ const say = () => {
2572
+ if (window.CRAFT_LIBRARY_QUIET || typeof console === "undefined") return;
2573
+ console.info("%cSara Lobo Library%c interface pieces by Sara Lobo \xB7 https://saralobolibrary.com/?ref=console", "font-weight:600", "color:#8a8e96");
2574
+ };
2575
+ if (document.readyState === "complete") setTimeout(say, 0);
2576
+ else addEventListener("load", () => setTimeout(say, 0), { once: true });
2577
+ }
2578
+
2522
2579
  // dist/elements.js
2580
+ sign();
2523
2581
  function define(name, mount, options) {
2524
2582
  if (typeof customElements === "undefined" || customElements.get(name)) return;
2525
2583
  customElements.define(name, class extends HTMLElement {
@@ -2621,7 +2679,24 @@ void main() {
2621
2679
  autoplay: el.getAttribute("autoplay") === "false" ? false : void 0,
2622
2680
  fonts: el.getAttribute("fonts") === "false" ? false : void 0
2623
2681
  }));
2682
+ var off = (el, name) => el.getAttribute(name) === "false" ? false : void 0;
2683
+ define("token-wheel", (el, o) => {
2684
+ css("craft-tokens-host", ":where(token-wheel){display:block;position:relative;width:100%;height:900px}");
2685
+ const m = mountTokenWheel(el, o);
2686
+ el.replay = m.replay;
2687
+ el.turn = m.turn;
2688
+ el.gyroscope = m.gyroscope;
2689
+ return m;
2690
+ }, (el) => ({
2691
+ labels: { eyebrow: el.getAttribute("label-eyebrow") ?? void 0, title: el.getAttribute("label-title") ?? void 0, cta: el.getAttribute("label-cta") ?? void 0, initials: el.getAttribute("initials") ?? void 0 },
2692
+ frame: off(el, "frame"),
2693
+ controls: off(el, "controls"),
2694
+ autoplay: off(el, "autoplay"),
2695
+ fonts: off(el, "fonts"),
2696
+ gyroscope: off(el, "gyroscope"),
2697
+ turned: el.hasAttribute("turned") && el.getAttribute("turned") !== "false"
2698
+ }));
2624
2699
 
2625
2700
  // dist/cdn.js
2626
- window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin };
2701
+ window.CraftLibrary = { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel };
2627
2702
  })();
package/dist/elements.js CHANGED
@@ -1,4 +1,5 @@
1
- // <glass-nav>, <like-button>, <magnetic-icon>, <iridescent-card>, <piggy-bank>, <magic-sphere>, <sweep-sphere>, <panorama-reel> and <map-pin>: the
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
2
+ // <glass-nav>, <like-button>, <magnetic-icon>, <iridescent-card>, <piggy-bank>, <magic-sphere>, <sweep-sphere>, <panorama-reel>, <map-pin> and <token-wheel>: the
2
3
  // pieces as HTML tags, for pages without React. They render into the page itself (no shadow root), so the glass can
3
4
  // blend with what is behind it.
4
5
  import { mountLike } from './like.js';
@@ -9,7 +10,11 @@ import { mountPiggyBank } from './piggy-mount.js';
9
10
  import { mountThinking } from './thinking.js';
10
11
  import { mountPanoramaReel } from './panorama-mount.js';
11
12
  import { mountMapPin } from './pin-mount.js';
13
+ import { mountTokenWheel } from './tokens-mount.js';
12
14
  import { css } from './style.js';
15
+ import { sign } from './sign.js';
16
+
17
+ sign();
13
18
 
14
19
  function define(name, mount, options) {
15
20
  if (typeof customElements === 'undefined' || customElements.get(name)) return;
@@ -117,4 +122,20 @@ define('map-pin', (el, o) => {
117
122
  fonts: el.getAttribute('fonts') === 'false' ? false : undefined
118
123
  }));
119
124
 
120
- export { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin };
125
+ // the token wheel fills the tag: a block, 100% wide and 900px tall unless the page sizes it. Its white pill fires
126
+ // "tokenscontinue". The words: label-eyebrow, label-title, label-cta, initials. frame="false" fills the tag with the
127
+ // screen (a real phone), controls="false" hides the round buttons, turned lays it on its side; from code, el.turn(true)
128
+ // lays it down, el.turn(false) stands it up and el.replay() plays the opening again.
129
+ const off = (el, name) => (el.getAttribute(name) === 'false' ? false : undefined);
130
+ define('token-wheel', (el, o) => {
131
+ css('craft-tokens-host', ':where(token-wheel){display:block;position:relative;width:100%;height:900px}');
132
+ const m = mountTokenWheel(el, o);
133
+ el.replay = m.replay; el.turn = m.turn; el.gyroscope = m.gyroscope;
134
+ return m;
135
+ }, (el) => ({
136
+ labels: { eyebrow: el.getAttribute('label-eyebrow') ?? undefined, title: el.getAttribute('label-title') ?? undefined, cta: el.getAttribute('label-cta') ?? undefined, initials: el.getAttribute('initials') ?? undefined },
137
+ frame: off(el, 'frame'), controls: off(el, 'controls'), autoplay: off(el, 'autoplay'), fonts: off(el, 'fonts'), gyroscope: off(el, 'gyroscope'),
138
+ turned: el.hasAttribute('turned') && el.getAttribute('turned') !== 'false'
139
+ }));
140
+
141
+ export { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel };
package/dist/glassnav.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Liquid glass nav bar · Craft Library, by Sara Lobo. The bar's CSS, markup and engine from the library, unchanged,
2
3
  // around a mount.
3
4
  import { css } from './style.js';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // The pieces as React components. Each renders an empty host and mounts the library's own piece into it, so what
2
3
  // shows is the same markup, CSS and motion as on the site.
3
4
  import { createElement, useEffect, useRef } from 'react';
@@ -9,6 +10,10 @@ import { mountPiggyBank } from './piggy-mount.js';
9
10
  import { mountThinking } from './thinking.js';
10
11
  import { mountPanoramaReel } from './panorama-mount.js';
11
12
  import { mountMapPin } from './pin-mount.js';
13
+ import { mountTokenWheel } from './tokens-mount.js';
14
+ import { sign } from './sign.js';
15
+
16
+ sign();
12
17
 
13
18
  const HOST = { display: 'inline-block', lineHeight: 0, verticalAlign: 'middle' };
14
19
 
@@ -118,4 +123,21 @@ export function MapPin({ height = 560, labels, label, autoplay, fonts, replay, o
118
123
  return createElement('div', { ref: host, className, style: { position: 'relative', width: '100%', height, ...style } });
119
124
  }
120
125
 
121
- export { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin };
126
+ // The token wheel fills the box it renders (100% wide and `height` tall, 900px by default): an account onboarding screen
127
+ // whose silver tokens turn on a wheel. With the frame (the default) the screen sits in a phone that scales to fit the box,
128
+ // with two round buttons beside it, turn it on its side and replay; turned lays it down from code, and the tokens fall
129
+ // and pile up against the edge. frame={false} fills the box with the screen itself, for a real phone, where the phone's
130
+ // own tilt moves the tokens. onContinue: the white pill. It loads its 3D scene (three.js) the first time it mounts.
131
+ export function TokenWheel({ height = 900, labels, frame, controls, autoplay, fonts, gyroscope, turned, replay, onContinue, className, style }) {
132
+ const host = useRef(null), wheel = useRef(null), last = useRef(replay), cont = useLatest(onContinue);
133
+ const key = JSON.stringify([labels, frame, controls, autoplay, fonts, gyroscope]);
134
+ useEffect(() => {
135
+ const m = wheel.current = mountTokenWheel(host.current, { labels, frame, controls, autoplay, fonts, gyroscope, turned, onContinue: () => cont.current && cont.current() });
136
+ return () => { m.destroy(); wheel.current = null; };
137
+ }, [key]);
138
+ useEffect(() => { const m = wheel.current; if (m && turned != null && m.turned !== !!turned) m.turn(!!turned); }, [turned]);
139
+ useEffect(() => { if (last.current === replay) return; last.current = replay; if (wheel.current) wheel.current.replay(); }, [replay]);
140
+ return createElement('div', { ref: host, className, style: { position: 'relative', width: '100%', height, ...style } });
141
+ }
142
+
143
+ export { mountLike, mountMagnet, mountGlassNav, mountIridescentCard, mountPiggyBank, mountThinking, mountPanoramaReel, mountMapPin, mountTokenWheel };
package/dist/like.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Bursting heart · Craft Library, by Sara Lobo. like.css and like.js from the library, unchanged, around a mount.
2
3
  import { css } from './style.js';
3
4
  const CSS = "/* Bursting heart · Sara Lobo Library\n The heart eases out of sight, a disc grows and hollows into a ring, 14 dots and 2 or 3 small hearts fly out,\n and the heart springs back full. Every motion runs on its own property with its own curve; where two curves\n meet, both are at rest there, so nothing hitches. Unliking only takes the colour away. Pairs with like.js. */\n\n:root {\n --like-heart: #FF6767; /* the liked heart, filled (Figma: General / Heart) */\n --like-color: #F91880; /* the disc */\n --like-ring: #CC8EF5; /* the ring as it opens */\n --like-spring: cubic-bezier(.34, 1.4, .64, 1); /* fallback for browsers without linear() */\n}\n\n/* a damped spring (damping .55, 700 ms): about 12% over, a short settle, at rest at the end */\n@supports (animation-timing-function: linear(0, 1)) {\n :root {\n --like-spring: linear(0, 0.034, 0.12, 0.24, 0.378, 0.52, 0.655, 0.778, 0.883, 0.968, 1.033, 1.079, 1.108, 1.123, 1.126, 1.12, 1.108, 1.092, 1.075, 1.057, 1.04, 1.025, 1.012, 1.002, 0.994, 0.989, 0.986, 0.984, 0.984, 0.985, 0.987, 0.989, 0.991, 0.993, 0.995, 0.997, 0.999, 1, 1.001, 1.001, 1);\n }\n}\n\n/* lets the ring's hole open smoothly (without it, the ring leaves at once) */\n@property --like-hole {\n syntax: '<percentage>';\n inherits: false;\n initial-value: 0%;\n}\n\n/* the button: a 40px circle in black at 60%, made to sit over images */\n.like {\n all: unset;\n box-sizing: border-box;\n position: relative;\n display: inline-block;\n flex: none;\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: rgba(0, 0, 0, .6);\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n transition: background .2s ease, transform .22s cubic-bezier(.2, .8, .2, 1);\n}\n.like:hover {\n background: rgba(0, 0, 0, .72);\n}\n.like:active {\n transform: scale(.94);\n}\n.like:focus-visible {\n outline: 2px solid #fff;\n outline-offset: 2px;\n}\n.like-icon {\n position: absolute;\n left: 8px;\n top: 9px;\n width: 24px;\n height: 24px;\n}\n.like-icon svg {\n display: block;\n overflow: visible;\n}\n.like-line {\n fill: none;\n stroke: #fff;\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round;\n transition: stroke .24s cubic-bezier(.4, 0, .2, 1);\n}\n.like-fill {\n fill: var(--like-heart);\n opacity: 0;\n transition: opacity .24s cubic-bezier(.4, 0, .2, 1);\n}\n.like[aria-pressed=\"true\"] .like-line {\n stroke: var(--like-heart);\n}\n.like[aria-pressed=\"true\"] .like-fill {\n opacity: 1;\n}\n/* the colour swaps while the heart is out of sight */\n.like.is-liking .like-line,\n.like.is-liking .like-fill {\n transition-duration: 0s;\n transition-delay: .3s;\n}\n/* everything that flies out starts from the heart's centre */\n.like-fx {\n position: absolute;\n left: 20px;\n top: 21px;\n width: 0;\n height: 0;\n pointer-events: none;\n}\n\n/* the heart: out of sight in 120 ms, waits inside the disc, then the spring brings it back full */\n.like.is-liking .like-icon {\n animation: like-vanish .12s cubic-bezier(.5, 0, .75, 0) both, like-return .7s var(--like-spring) .32s forwards;\n}\n@keyframes like-vanish {\n from {\n scale: 1;\n opacity: 1;\n }\n to {\n scale: .15;\n opacity: 0;\n }\n}\n@keyframes like-return {\n from {\n scale: .15;\n opacity: 0;\n }\n to {\n scale: 1;\n opacity: 1;\n }\n}\n\n/* unliking: a soft dip and back while the colour leaves, at rest at both ends */\n.like.is-unliking .like-icon {\n animation: like-dip .34s cubic-bezier(.37, 0, .63, 1);\n}\n@keyframes like-dip {\n 0% {\n scale: 1;\n }\n 40% {\n scale: .86;\n }\n 100% {\n scale: 1;\n }\n}\n\n/* the ring: one long ease-out growth (to 110%), the tint, and a hole that opens before the growth ends */\n.like-ring {\n position: absolute;\n left: -23px;\n top: -23px;\n width: 46px;\n height: 46px;\n border-radius: 50%;\n background: var(--like-color);\n scale: 0;\n -webkit-mask: radial-gradient(circle closest-side, transparent var(--like-hole), #000 calc(var(--like-hole) + 2%));\n mask: radial-gradient(circle closest-side, transparent var(--like-hole), #000 calc(var(--like-hole) + 2%));\n}\n.like.is-liking .like-ring {\n animation: like-ring-grow .56s cubic-bezier(.22, 1, .36, 1) .06s both, like-ring-tint .3s ease-out .06s both, like-ring-open .36s cubic-bezier(.33, 1, .68, 1) .28s both;\n}\n@keyframes like-ring-grow {\n from {\n scale: 0;\n }\n to {\n scale: 1.1;\n }\n}\n@keyframes like-ring-tint {\n from {\n background-color: var(--like-color);\n }\n to {\n background-color: var(--like-ring);\n }\n}\n@keyframes like-ring-open {\n from {\n --like-hole: 0%;\n }\n to {\n --like-hole: 100%;\n }\n}\n\n/* the dots: 7 pairs around the ring. They fly out on a long ease-out, swell and shrink on their own clock,\n and the whole spray turns 12° as it goes */\n.like-dots i {\n position: absolute;\n left: 0;\n top: 0;\n width: 0;\n height: 0;\n transform: rotate(var(--a));\n}\n.like-dots b {\n position: absolute;\n left: -2.5px;\n top: -2.5px;\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background: var(--d1);\n scale: 0;\n}\n.like-dots b + b {\n left: -1.75px;\n top: -1.75px;\n width: 3.5px;\n height: 3.5px;\n background: var(--d2);\n}\n.like-dots i:nth-child(1) { --a: 0deg; --d1: #F91880; --d2: #FF7AB6; }\n.like-dots i:nth-child(2) { --a: 51.43deg; --d1: #FFAD1F; --d2: #FFD166; }\n.like-dots i:nth-child(3) { --a: 102.86deg; --d1: #1D9BF0; --d2: #7CC6FE; }\n.like-dots i:nth-child(4) { --a: 154.29deg; --d1: #A78BFA; --d2: #C4B5FD; }\n.like-dots i:nth-child(5) { --a: 205.71deg; --d1: #00BA7C; --d2: #6EE7B7; }\n.like-dots i:nth-child(6) { --a: 257.14deg; --d1: #F97316; --d2: #FDBA74; }\n.like-dots i:nth-child(7) { --a: 308.57deg; --d1: #F91880; --d2: #CC8EF5; }\n.like.is-liking .like-dots i {\n animation: like-swirl .9s cubic-bezier(.22, 1, .36, 1) .34s both;\n}\n.like.is-liking .like-dots b {\n animation: like-fly .62s cubic-bezier(.16, 1, .3, 1) .34s both, like-dot .62s .34s both;\n}\n.like.is-liking .like-dots b + b {\n animation-name: like-fly-2, like-dot;\n animation-delay: .38s;\n}\n@keyframes like-swirl {\n from {\n rotate: 0deg;\n }\n to {\n rotate: 12deg;\n }\n}\n@keyframes like-fly {\n from {\n translate: 0 -20px;\n }\n to {\n translate: 0 -33px;\n }\n}\n@keyframes like-fly-2 {\n from {\n translate: 4.5px -18px;\n }\n to {\n translate: 8px -29px;\n }\n}\n@keyframes like-dot {\n 0% {\n scale: 0;\n animation-timing-function: cubic-bezier(.33, 1, .68, 1);\n }\n 24% {\n scale: 1;\n animation-timing-function: cubic-bezier(.32, 0, .67, 0);\n }\n 100% {\n scale: 0;\n }\n}\n\n/* the small hearts (like.js adds them): the rise is one unbroken ease-out, the sway a sine that rests at its turns,\n and size and fade keep their own clocks */\n.like-float {\n position: absolute;\n left: 0;\n top: -6px;\n opacity: 0;\n animation: like-rise var(--dur) cubic-bezier(.33, 1, .68, 1) var(--dl) both, like-fade var(--dur) var(--dl) both;\n}\n.like-float span {\n display: block;\n animation: like-sway var(--dur) cubic-bezier(.37, 0, .63, 1) var(--dl) both, like-grow var(--dur) var(--dl) both;\n}\n.like-float svg {\n display: block;\n width: var(--s);\n height: var(--s);\n margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);\n fill: var(--fc);\n}\n@keyframes like-rise {\n from {\n translate: 0 0;\n }\n to {\n translate: 0 var(--dy);\n }\n}\n@keyframes like-fade {\n 0% {\n opacity: 0;\n animation-timing-function: cubic-bezier(.33, 1, .68, 1);\n }\n 14% {\n opacity: 1;\n animation-timing-function: linear;\n }\n 50% {\n opacity: 1;\n animation-timing-function: cubic-bezier(.37, 0, .63, 1);\n }\n 100% {\n opacity: 0;\n }\n}\n@keyframes like-sway {\n 0% {\n translate: 0 0;\n rotate: 0deg;\n }\n 33% {\n translate: var(--dx) 0;\n rotate: var(--r);\n }\n 70% {\n translate: calc(var(--dx) * -.6) 0;\n rotate: calc(var(--r) * -.6);\n }\n 100% {\n translate: calc(var(--dx) * .25) 0;\n rotate: 0deg;\n }\n}\n@keyframes like-grow {\n 0% {\n scale: .3;\n animation-timing-function: cubic-bezier(.34, 1.56, .64, 1);\n }\n 24% {\n scale: 1;\n animation-timing-function: cubic-bezier(.32, 0, .67, 0);\n }\n 100% {\n scale: .8;\n }\n}\n\n/* less motion: only the colour changes */\n@media (prefers-reduced-motion: reduce) {\n .like,\n .like * {\n animation: none !important;\n }\n}\n";
package/dist/magnet.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Magnetic icon · Craft Library, by Sara Lobo. magnet.css and magnet.js from the library, unchanged, around a mount.
2
3
  import { css } from './style.js';
3
4
  const CSS = "/* Magnetic icon · Sara Lobo Library\n A dark disc with a brushed-metal rim and a search glyph (Figma: 40×40). Near the cursor the rim acts like metal\n near a strong magnet: the disc is drawn toward the pointer, the strained rim creases and trembles, its tip cracks\n into shards, and small voxels break off and fly to the pointer. Pairs with magnet.js.\n Everything is drawn in a 40-unit box, so --mag-size scales the whole piece, the pull included. */\n\n.mag {\n all: unset;\n position: relative;\n display: inline-grid;\n place-items: center;\n width: var(--mag-size, 40px);\n height: var(--mag-size, 40px);\n border-radius: 50%;\n color: #fff;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n transition: transform .2s cubic-bezier(.2, .8, .2, 1);\n}\n.mag:active {\n transform: scale(.94);\n}\n.mag:focus-visible {\n outline: 2px solid #9DB8FF;\n outline-offset: 4px;\n}\n/* the disc and its rim, redrawn by magnet.js; the stretch reaches past the button */\n.mag-ring {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n overflow: visible;\n pointer-events: none;\n}\n/* the shards and voxels: 46 units of room on every side of the 40-unit button (46 / 40 = 115%) */\n.mag-dust {\n position: absolute;\n left: -115%;\n top: -115%;\n width: 330%;\n height: 330%;\n pointer-events: none;\n}\n.mag-icon {\n position: relative;\n display: block;\n width: 50%;\n height: 50%;\n}\n";
@@ -1,2 +1,3 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // where the Panorama's own clip and pictures are: jsDelivr, at this version of the package
2
- export const ASSETS = 'https://cdn.jsdelivr.net/npm/craft-library@0.6.0/dist/panorama/';
3
+ export const ASSETS = 'https://cdn.jsdelivr.net/npm/craft-library@0.7.1/dist/panorama/';
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Panorama: the mount around the library's panorama.js. With no video and no stills it shows the library's own clip
2
3
  // and pictures, which ship with the package in dist/panorama/ (see panorama-assets.js for where they are read from).
3
4
  import { mountPanorama } from './panorama.js';
package/dist/panorama.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Panorama · Sara Lobo Library
2
3
  // A hero for moving pictures. A clip opens full-bleed under letterbox bars while the title tracks in; then the clip shrinks
3
4
  // into one screen of a dome of monitors that surrounds you, and the other screens arrive in a wave around it. The pointer
@@ -1,2 +1,3 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // where the piggy bank comes from: for bundlers, the package's piggy.js (it imports the `three` dependency)
2
3
  export const loadPiggy = () => import('./piggy.js');
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Glass piggy bank: the mount around the library's piggy.js. piggy.js, and three.js with it, loads only when a piggy
2
3
  // bank is mounted, so the other pieces stay light.
3
4
  import { loadPiggy } from './piggy-load.js';
package/dist/piggy.cdn.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Piggy bank · Sara Lobo Library
2
3
  // A congratulations moment in 3D: a frosted glass piggy bank hops in from the right with a full turn, lands on its hind
3
4
  // feet, nearly tips over and clacks back down, rocking like the rigid glass it is. Coins pop into the air above it and
package/dist/piggy.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Piggy bank · Sara Lobo Library
2
3
  // A congratulations moment in 3D: a frosted glass piggy bank hops in from the right with a full turn, lands on its hind
3
4
  // feet, nearly tips over and clacks back down, rocking like the rigid glass it is. Coins pop into the air above it and
package/dist/pin-load.js CHANGED
@@ -1,2 +1,3 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // where the map pin comes from: for bundlers, the package's pin.js (it imports the `three` dependency)
2
3
  export const loadPin = () => import('./pin.js');
package/dist/pin-mount.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Map pin: the mount around the library's pin.js. pin.js, and three.js with it, loads only when a map pin is mounted,
2
3
  // so the other pieces stay light.
3
4
  import { loadPin } from './pin-load.js';
package/dist/pin.cdn.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  /* Pin de mapa · Sara Lobo Library (saralobolibrary.com). A city map in perspective with a glass map pin: a click or a tap
2
3
  on a street sends the pin flying to the nearest curb, where it sticks its tip in; the map is in focus there and soft
3
4
  further away, the streets carry their names, and a card under the map names the address and confirms it.
package/dist/pin.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  /* Pin de mapa · Sara Lobo Library (saralobolibrary.com). A city map in perspective with a glass map pin: a click or a tap
2
3
  on a street sends the pin flying to the nearest curb, where it sticks its tip in; the map is in focus there and soft
3
4
  further away, the streets carry their names, and a card under the map names the address and confirms it.
package/dist/sign.js ADDED
@@ -0,0 +1,14 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
2
+ // Where the pieces come from: one quiet line in the browser console, once per page, for the people who build with them
3
+ // (nothing shows on the page itself). It waits for the page to finish loading, so a page can set
4
+ // window.CRAFT_LIBRARY_QUIET = true (in any script, or right after importing the package) to skip it.
5
+ export function sign() {
6
+ if (typeof window === 'undefined' || typeof document === 'undefined' || window.__craftLibrarySigned) return;
7
+ window.__craftLibrarySigned = true;
8
+ const say = () => {
9
+ if (window.CRAFT_LIBRARY_QUIET || typeof console === 'undefined') return;
10
+ console.info('%cSara Lobo Library%c interface pieces by Sara Lobo · https://saralobolibrary.com/?ref=console', 'font-weight:600', 'color:#8a8e96');
11
+ };
12
+ if (document.readyState === 'complete') setTimeout(say, 0);
13
+ else addEventListener('load', () => setTimeout(say, 0), { once: true });
14
+ }
package/dist/style.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // each piece's CSS goes into the page once, the first time one is mounted
2
3
  const done = new Set();
3
4
  export function css(id, text) {
package/dist/thinking.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
1
2
  // Magic sphere and Sweep · Craft Library, by Sara Lobo. thinking.css and thinking.js from the library, unchanged,
2
3
  // around a mount.
3
4
  import { css } from './style.js';
@@ -0,0 +1,3 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
2
+ // where the token wheel comes from: for bundlers, the package's tokens.js (it imports the `three` dependency)
3
+ export const loadTokens = () => import('./tokens.js');
@@ -0,0 +1,31 @@
1
+ /*! Sara Lobo Library · craft-library 0.7.1 · interface pieces by Sara Lobo · https://saralobolibrary.com · MIT */
2
+ // Token wheel: the mount around the library's tokens.js. tokens.js, and three.js with it, loads only when a token wheel
3
+ // is mounted, so the other pieces stay light.
4
+ import { loadTokens } from './tokens-load.js';
5
+
6
+ // host: the element the screen fills (give it a size; with the frame the phone, 390 × 844, scales to fit, and it is made
7
+ // for a box about 900px tall). o: { labels: { eyebrow, title, cta, initials }, frame (false: the screen fills the host,
8
+ // for a real phone), controls (false: no turn and replay buttons beside the phone), autoplay (false: the tokens wait for
9
+ // replay()), fonts (false: don't load DM Sans), gyroscope (false: never read the phone's tilt), turned (true: lay it on
10
+ // its side), onContinue() when the white pill is pressed }
11
+ export function mountTokenWheel(host, o = {}) {
12
+ let w = null, gone = false, wantReplay = false, wantTurn = o.turned ? true : null;
13
+ const opts = { labels: o.labels, frame: o.frame, controls: o.controls, autoplay: o.autoplay, fonts: o.fonts, gyroscope: o.gyroscope };
14
+ const cont = () => { if (o.onContinue) o.onContinue(); };
15
+ host.addEventListener('tokenscontinue', cont);
16
+ const ready = loadTokens().then((m) => {
17
+ if (gone) return null;
18
+ w = m.mountTokens(host, opts);
19
+ if (wantTurn != null) w.turn(wantTurn);
20
+ if (wantReplay) w.replay();
21
+ return w.ready.then(() => w);
22
+ });
23
+ return {
24
+ ready,
25
+ replay: () => { if (w) w.replay(); else wantReplay = true; },
26
+ turn: (side) => { if (w) return w.turn(side); wantTurn = side == null ? !wantTurn : !!side; return wantTurn; },
27
+ gyroscope: () => (w ? w.gyroscope() : Promise.resolve(false)), // call it from a tap: iOS asks the person first
28
+ get turned() { return w ? w.turned : !!wantTurn; },
29
+ destroy() { gone = true; host.removeEventListener('tokenscontinue', cont); if (w) w.destroy(); w = null; }
30
+ };
31
+ }