@vibes.diy/prompts 14.3.249 → 14.3.251
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/generation-variety.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/llms/backend.js +1 -0
- package/llms/backend.js.map +1 -1
- package/llms/blockly.js +1 -0
- package/llms/blockly.js.map +1 -1
- package/llms/blockly.md +2 -3
- package/llms/bluesky.js +2 -0
- package/llms/bluesky.js.map +1 -1
- package/llms/board-games.js +9 -4
- package/llms/board-games.js.map +1 -1
- package/llms/board-games.md +3 -153
- package/llms/callai.js +1 -0
- package/llms/callai.js.map +1 -1
- package/llms/callai.md +1 -1
- package/llms/canvas-theme-colors.d.ts +2 -0
- package/llms/canvas-theme-colors.js +7 -0
- package/llms/canvas-theme-colors.js.map +1 -0
- package/llms/canvas-theme-colors.md +70 -0
- package/llms/image-gen.js +1 -0
- package/llms/image-gen.js.map +1 -1
- package/llms/image-gen.md +1 -1
- package/llms/index.d.ts +24 -2
- package/llms/index.js +64 -0
- package/llms/index.js.map +1 -1
- package/llms/keepsake.d.ts +2 -0
- package/llms/keepsake.js +9 -0
- package/llms/keepsake.js.map +1 -0
- package/llms/keepsake.md +74 -0
- package/llms/live-rooms.d.ts +2 -0
- package/llms/live-rooms.js +28 -0
- package/llms/live-rooms.js.map +1 -0
- package/llms/live-rooms.md +288 -0
- package/llms/media-capture.d.ts +2 -0
- package/llms/media-capture.js +27 -0
- package/llms/media-capture.js.map +1 -0
- package/llms/media-capture.md +190 -0
- package/llms/mic-capture.d.ts +2 -0
- package/llms/mic-capture.js +7 -0
- package/llms/mic-capture.js.map +1 -0
- package/llms/mic-capture.md +76 -0
- package/llms/needs.d.ts +12 -0
- package/llms/needs.js +71 -0
- package/llms/needs.js.map +1 -0
- package/llms/owner-secret.d.ts +2 -0
- package/llms/owner-secret.js +8 -0
- package/llms/owner-secret.js.map +1 -0
- package/llms/owner-secret.md +82 -0
- package/llms/p5.js +1 -0
- package/llms/p5.js.map +1 -1
- package/llms/p5.md +15 -69
- package/llms/photo-input.d.ts +2 -0
- package/llms/photo-input.js +7 -0
- package/llms/photo-input.js.map +1 -0
- package/llms/photo-input.md +141 -0
- package/llms/physics.js +1 -0
- package/llms/physics.js.map +1 -1
- package/llms/physics.md +7 -16
- package/llms/reskin.js +3 -8
- package/llms/reskin.js.map +1 -1
- package/llms/reskin.md +12 -78
- package/llms/richtext.md +2 -0
- package/llms/social-post.js +1 -0
- package/llms/social-post.js.map +1 -1
- package/llms/social-post.md +22 -4
- package/llms/sound-core.d.ts +2 -0
- package/llms/sound-core.js +7 -0
- package/llms/sound-core.js.map +1 -0
- package/llms/sound-core.md +131 -0
- package/llms/spotify.js +11 -1
- package/llms/spotify.js.map +1 -1
- package/llms/spotify.md +54 -50
- package/llms/strudel.js +2 -0
- package/llms/strudel.js.map +1 -1
- package/llms/strudel.md +24 -25
- package/llms/surface-board.d.ts +2 -0
- package/llms/surface-board.js +8 -0
- package/llms/surface-board.js.map +1 -0
- package/llms/surface-board.md +140 -0
- package/llms/surface-play-area.d.ts +2 -0
- package/llms/surface-play-area.js +8 -0
- package/llms/surface-play-area.js.map +1 -0
- package/llms/surface-play-area.md +51 -0
- package/llms/surface-presence.d.ts +2 -0
- package/llms/surface-presence.js +9 -0
- package/llms/surface-presence.js.map +1 -0
- package/llms/surface-presence.md +118 -0
- package/llms/third-party-embed.d.ts +2 -0
- package/llms/third-party-embed.js +8 -0
- package/llms/third-party-embed.js.map +1 -0
- package/llms/third-party-embed.md +110 -0
- package/llms/three-js.js +1 -1
- package/llms/three-js.js.map +1 -1
- package/llms/three-js.md +52 -18
- package/llms/touch-games.js +11 -11
- package/llms/touch-games.js.map +1 -1
- package/llms/touch-games.md +59 -354
- package/llms/types.d.ts +14 -0
- package/llms/ui-chat.js +2 -1
- package/llms/ui-chat.js.map +1 -1
- package/llms/ui-chat.md +25 -14
- package/llms/ui-weather.js +1 -1
- package/llms/ui-weather.js.map +1 -1
- package/llms/ui-weather.md +1 -2
- package/llms/use-vibe.js +1 -0
- package/llms/use-vibe.js.map +1 -1
- package/llms/use-viewer.js +1 -0
- package/llms/use-viewer.js.map +1 -1
- package/llms/voxel.js +1 -0
- package/llms/voxel.js.map +1 -1
- package/llms/voxel.md +33 -109
- package/llms/weather.d.ts +2 -0
- package/llms/weather.js +12 -0
- package/llms/weather.js.map +1 -0
- package/llms/weather.md +248 -0
- package/llms/web-audio.js +4 -21
- package/llms/web-audio.js.map +1 -1
- package/llms/web-audio.md +19 -951
- package/llms/web-music.d.ts +2 -0
- package/llms/web-music.js +8 -0
- package/llms/web-music.js.map +1 -0
- package/llms/web-music.md +895 -0
- package/llms/world-controls.d.ts +2 -0
- package/llms/world-controls.js +14 -0
- package/llms/world-controls.js.map +1 -0
- package/llms/world-controls.md +262 -0
- package/llms/worlds.js +2 -1
- package/llms/worlds.js.map +1 -1
- package/llms/worlds.md +5 -14
- package/llms/youtube.js +10 -1
- package/llms/youtube.js.map +1 -1
- package/llms/youtube.md +67 -53
- package/package.json +5 -5
- package/prompts.js +5 -19
- package/prompts.js.map +1 -1
package/llms/spotify.md
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
|
-
# Spotify
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
an
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
# Spotify — play tracks with no credentials, search the catalog with the owner's app
|
|
2
|
+
|
|
3
|
+
Two different asks share the name. **Playing** a track, an album, a playlist or
|
|
4
|
+
an artist's top tracks inside the page needs no credentials, no backend and no
|
|
5
|
+
setup: it is Spotify's own player in a frame, and section 0 is all of it.
|
|
6
|
+
**Searching** the catalog (look up an artist, list an album's tracks, chart a
|
|
7
|
+
playlist's tempo) is the **Spotify Web API** on app credentials the owner
|
|
8
|
+
supplies, a `backend.js` feature, and sections 1–6 are the recipe that keeps the
|
|
9
|
+
credentials safe and the token short-lived and unstored. Build the first for
|
|
10
|
+
"our band's songs", "a playlist on my page"; build the second only when the
|
|
11
|
+
page has to search or read catalog data.
|
|
12
|
+
|
|
13
|
+
## 0. Play a track: no credentials at all
|
|
14
|
+
|
|
15
|
+
A pasted Spotify link becomes a player on `open.spotify.com/embed/…`. Parse the
|
|
16
|
+
link into a type and an id and build the `src`; the frame itself is the shared
|
|
17
|
+
`EmbedFrame`, with the fixed height Spotify's player is drawn for.
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
// A share link or spotify: URI → { src, height }, or null when it is not a playable Spotify item.
|
|
21
|
+
function spotifyEmbedSrc(link) {
|
|
22
|
+
const m = link.trim().match(/^(?:https:\/\/open\.spotify\.com\/(?:intl-[a-z-]+\/)?|spotify:)(track|album|playlist|artist|episode|show)[/:]([A-Za-z0-9]{22})/);
|
|
23
|
+
if (!m) return null;
|
|
24
|
+
const [, type, id] = m;
|
|
25
|
+
const compact = type === "track" || type === "episode";
|
|
26
|
+
return { src: `https://open.spotify.com/embed/${type}/${id}`, height: compact ? 152 : 352 };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The player, once the link has parsed:
|
|
30
|
+
// const player = spotifyEmbedSrc(song.link);
|
|
31
|
+
// <EmbedFrame src={player.src} height={player.height} title={song.title} />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- The title and cover come from Spotify's keyless oEmbed endpoint,
|
|
35
|
+
`https://open.spotify.com/oembed`, read once when the link is added.
|
|
36
|
+
- A listener who is not signed in to Spotify in that browser may hear only a
|
|
37
|
+
preview of each track, so say "Previews play here; the full song is on
|
|
38
|
+
Spotify" beside the player, with "Listen on Spotify" linking the original.
|
|
39
|
+
- None of this touches the Web API, so none of the credential sections below
|
|
40
|
+
apply to a page that only plays music.
|
|
41
|
+
|
|
42
|
+
**The catalog half runs on the owner's app:** the credentials and rate limit are
|
|
43
|
+
the owner's, and every visitor sees the same public catalog. A visitor's own
|
|
44
|
+
top tracks and playlists are a connection, never a pasted token (the owner-key
|
|
45
|
+
rules below).
|
|
21
46
|
|
|
22
47
|
## 1. The setup item: the owner's Spotify app credentials
|
|
23
48
|
|
|
@@ -35,36 +60,21 @@ one is a link to the exact page and uses the words that page uses:
|
|
|
35
60
|
flow never uses one — and save.
|
|
36
61
|
2. Open the app you made and press **Settings**. Copy the **Client ID**, then
|
|
37
62
|
press **View client secret** and copy that too.
|
|
38
|
-
3.
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`npx vibes-diy secrets set SPOTIFY_CLIENT_ID --vibe <ownerHandle>/<appSlug>`
|
|
44
|
-
and the same for `SPOTIFY_CLIENT_SECRET`.
|
|
45
|
-
4. Come back to the app. Search works the moment both are saved; no redeploy.
|
|
46
|
-
|
|
47
|
-
Those steps are the item's copy on the Setup surface, with the vibe's real
|
|
48
|
-
handle and slug filled in from the `ownerHandle` and `appSlug` the `/setup`
|
|
49
|
-
route hands over. Two secrets means two ways to be half-configured: one item,
|
|
63
|
+
3. Save both under **Secrets** on this vibe's Settings tab as
|
|
64
|
+
`SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`, then come back: the
|
|
65
|
+
owner-key steps every item ends with.
|
|
66
|
+
|
|
67
|
+
Two secrets means two ways to be half-configured: one item,
|
|
50
68
|
done only when both are present, so one set and one unset reads as *To do*
|
|
51
69
|
rather than as a broken API. In the consumer flow, a search whose pair is not
|
|
52
|
-
set reads *Search is not open yet
|
|
53
|
-
steps are, and later it is where a rotated secret goes.
|
|
54
|
-
|
|
55
|
-
Only the owner can set or rotate a secret, and handlers see the current value on
|
|
56
|
-
every invocation — so the page starts working the moment the pair lands, with no
|
|
57
|
-
redeploy.
|
|
70
|
+
set reads *Search is not open yet*.
|
|
58
71
|
|
|
59
72
|
## 2. The credentials never reach the browser
|
|
60
73
|
|
|
61
74
|
Every Spotify request is made in backend.js with ctx.fetch and the two ctx.secrets values; App.jsx never calls api.spotify.com or accounts.spotify.com.
|
|
62
75
|
|
|
63
|
-
|
|
64
|
-
the
|
|
65
|
-
secret pasted into a React component ships to every visitor who views source, and
|
|
66
|
-
anyone who reads it can mint tokens against the owner's app until it is rotated.
|
|
67
|
-
The client id alone is no better: it is half of the pair and it names the owner's
|
|
76
|
+
Anyone who reads a client secret can mint tokens against the owner's app until it
|
|
77
|
+
is rotated, and the client id alone is no better: it is half of the pair and it names the owner's
|
|
68
78
|
app to anyone collecting them.
|
|
69
79
|
|
|
70
80
|
## 3. Mint a token, hold it in memory, never write it down
|
|
@@ -157,13 +167,7 @@ pass the reason through:
|
|
|
157
167
|
- `404` — no such artist, album or track. Keep the id on screen.
|
|
158
168
|
- anything else — show the API's own `error.message`.
|
|
159
169
|
|
|
160
|
-
|
|
161
|
-
nothing they can act on, and the five cases above each have a different fix.
|
|
162
|
-
|
|
163
|
-
Every `_api` route wraps its handler in `try`/`catch` and answers with a stated
|
|
164
|
-
reason, because an uncaught throw reaches the app as a bare `500 backend.js threw`
|
|
165
|
-
naming only the error class, and the app can show the person what to fix only
|
|
166
|
-
when the route names it.
|
|
170
|
+
The five cases above each have a different fix, so each keeps its own words.
|
|
167
171
|
|
|
168
172
|
## Complete backend.js
|
|
169
173
|
|
package/llms/strudel.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const strudelConfig = {
|
|
2
2
|
name: "strudel",
|
|
3
|
+
needs: ["web-audio"],
|
|
3
4
|
label: "Strudel live coding",
|
|
4
5
|
description: "Live-coding music with Strudel, where the music is a pattern written as text: a pattern pad " +
|
|
5
6
|
"with an editor, examples, play and stop and saved patterns; a groovebox whose pads write " +
|
|
@@ -13,6 +14,7 @@ export const strudelConfig = {
|
|
|
13
14
|
"onEvalError for patterns that did not compile, hush on stop, and onTrigger for visuals. " +
|
|
14
15
|
"strudel, tidal, tidalcycles, live coding, livecoding, algorave, mini-notation, pattern music, " +
|
|
15
16
|
"algorithmic music, generative music, text patterns, code music",
|
|
17
|
+
teaches: ["initStrudel", "setAudioContext"],
|
|
16
18
|
cues: [
|
|
17
19
|
"strudel",
|
|
18
20
|
"tidal",
|
package/llms/strudel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strudel.js","sourceRoot":"","sources":["../../jsr/llms/strudel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"strudel.js","sourceRoot":"","sources":["../../jsr/llms/strudel.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,CAAC,WAAW,CAAC;IACpB,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,8FAA8F;QAC9F,2FAA2F;QAC3F,+FAA+F;QAC/F,6FAA6F;QAC7F,+FAA+F;QAC/F,gGAAgG;QAChG,iGAAiG;QACjG,2FAA2F;QAC3F,yBAAyB;QACzB,0FAA0F;QAC1F,gGAAgG;QAChG,gEAAgE;IAElE,OAAO,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAC3C,IAAI,EAAE;QACJ,SAAS;QACT,OAAO;QACP,aAAa;QACb,cAAc;QACd,aAAa;QACb,aAAa;QACb,YAAY;QACZ,iBAAiB;QACjB,UAAU;QACV,eAAe;QACf,cAAc;QACd,eAAe;QACf,mBAAmB;QACnB,kBAAkB;QAClB,YAAY;QACZ,iBAAiB;QACjB,eAAe;KAChB;CACF,CAAC"}
|
package/llms/strudel.md
CHANGED
|
@@ -10,10 +10,12 @@ typed by a person, written by an interface, saved as a document, remixed, or
|
|
|
10
10
|
produced by `callAI` from a sentence. The engine arrives from the CDN the
|
|
11
11
|
first time someone presses play, so the app ships only its own code.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
Strudel builds on the Web Audio doc above: the press unlocks sound with its
|
|
14
|
+
`unlockAudio()`, and the engine arrives by its runtime-import rule. A synth
|
|
15
|
+
built from oscillators, a drum machine with its own clock, mic monitoring or a
|
|
16
|
+
metronome is the `web-music` skill. Strudel is the right call when the music is
|
|
17
|
+
a pattern expressed as text (or compiled into text from a grid, sliders or a
|
|
18
|
+
prompt).
|
|
17
19
|
|
|
18
20
|
The worked examples are `jchris/strudel` (an editor, saved patterns and a
|
|
19
21
|
prompt box that rewrites the groove), `jchris/strudel-groovebook` (a step
|
|
@@ -25,20 +27,15 @@ posts on good.vibes.diy.
|
|
|
25
27
|
## The engine arrives at play time
|
|
26
28
|
|
|
27
29
|
**Import the engine with its full pinned esm.sh URL inside a memoized
|
|
28
|
-
module-level loader, and call that loader from the play gesture
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
unlock is registered only once the download finishes, by which time the
|
|
38
|
-
press that started it has passed; a context made and resumed inside that
|
|
39
|
-
press is what iOS asks of sound (measured 2026-10-07: the handed-in context
|
|
40
|
-
is the one the engine plays through, `running`, events firing after a
|
|
41
|
-
1.7 s load).
|
|
30
|
+
module-level loader, and call that loader from the play gesture**:
|
|
31
|
+
`await import("https://esm.sh/@strudel/web@1.3.0")`, so first paint owes
|
|
32
|
+
nothing to a 165 KB engine plus a drum kit. **The loader takes the context
|
|
33
|
+
from `unlockAudio()` before its first `await`** and hands it to the engine
|
|
34
|
+
with `setAudioContext` ahead of `initStrudel`. The engine's own first-click
|
|
35
|
+
unlock is registered only once the download finishes, after the press that
|
|
36
|
+
started it has passed, so the handed-in context is the one that plays
|
|
37
|
+
(measured 2026-10-07: the engine plays through it, `running`, events firing
|
|
38
|
+
after a 1.7 s load).
|
|
42
39
|
|
|
43
40
|
Strudel is AGPL-licensed. The app links to the engine at its own address the
|
|
44
41
|
way a browser links to any page, so the two programs stay separate:
|
|
@@ -63,6 +60,7 @@ beside the editor, while the last good pattern plays on.
|
|
|
63
60
|
```
|
|
64
61
|
App.jsx the interface: editor or grid, play and stop, saved patterns, the credit line
|
|
65
62
|
lib/strudel.js the loader, play(), stop(), the error hook, helpers that write mini-notation, EXAMPLES
|
|
63
|
+
lib/sfx.js the sound core's module, as it writes it: the loader takes its unlockAudio()
|
|
66
64
|
access.js who may publish a pattern to the shared gallery
|
|
67
65
|
seed.json three or four finished patterns so the first visit has something to press
|
|
68
66
|
```
|
|
@@ -79,6 +77,8 @@ delivers the message a bad pattern produces.
|
|
|
79
77
|
|
|
80
78
|
### `lib/strudel.js`
|
|
81
79
|
```js
|
|
80
|
+
import { unlockAudio } from "./sfx.js";
|
|
81
|
+
|
|
82
82
|
const ENGINE_URL = "https://esm.sh/@strudel/web@1.3.0";
|
|
83
83
|
const DRUM_KIT_URL = "https://cdn.jsdelivr.net/gh/tidalcycles/Dirt-Samples@master/strudel.json";
|
|
84
84
|
const DRUM_MACHINES_URL = "https://cdn.jsdelivr.net/gh/felixroos/dough-samples@main/tidal-drum-machines.json";
|
|
@@ -90,9 +90,8 @@ const listeners = new Set();
|
|
|
90
90
|
/** One fetch of the engine and the drum kit, however many times play is pressed. */
|
|
91
91
|
export function loadStrudel() {
|
|
92
92
|
enginePromise ??= (async () => {
|
|
93
|
-
// Runs inside the press that called play(): the
|
|
94
|
-
audioContext =
|
|
95
|
-
audioContext.resume();
|
|
93
|
+
// Runs inside the press that called play(): the sound core's gate, before the first await.
|
|
94
|
+
audioContext = unlockAudio();
|
|
96
95
|
const web = await import(ENGINE_URL);
|
|
97
96
|
web.setAudioContext(audioContext);
|
|
98
97
|
const repl = await web.initStrudel({
|
|
@@ -118,8 +117,8 @@ export function onPatternError(fn) {
|
|
|
118
117
|
* the `false` keeps the engine's own sound output in place beside the callback.
|
|
119
118
|
*/
|
|
120
119
|
export async function play(code, onEvent) {
|
|
121
|
-
// Still inside the press: a context the browser suspended while the tab was away
|
|
122
|
-
|
|
120
|
+
// Still inside the press: the gate re-checks a context the browser suspended while the tab was away.
|
|
121
|
+
unlockAudio();
|
|
123
122
|
const { web, repl } = await loadStrudel();
|
|
124
123
|
const pattern = await web.evaluate(code, false);
|
|
125
124
|
if (!pattern) return null;
|
|
@@ -651,8 +650,8 @@ the kits: `samples({ kick: "https://…/kick.wav", snare: "…" })` inside
|
|
|
651
650
|
|
|
652
651
|
Play is a large button near the top; nothing sounds until it is pressed. A
|
|
653
652
|
grid's steps are `IconButton`s whose label names the row, the step and its
|
|
654
|
-
state, and a tempo slider sits beside play rather than in a settings drawer. The
|
|
655
|
-
|
|
653
|
+
state, and a tempo slider sits beside play rather than in a settings drawer. The tap calls
|
|
654
|
+
`unlockAudio()` before anything awaits.
|
|
656
655
|
|
|
657
656
|
## Shapes a Strudel vibe takes
|
|
658
657
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const surfaceBoardConfig = {
|
|
2
|
+
name: "surface-board",
|
|
3
|
+
label: "Board surface",
|
|
4
|
+
description: "How a board, tile or card game looks: the board dressed in a material from the request's world, drawn by the skin",
|
|
5
|
+
menu: false,
|
|
6
|
+
rail: "reskin",
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=surface-board.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-board.js","sourceRoot":"","sources":["../../jsr/llms/surface-board.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,kBAAkB,GAAc;IAC3C,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,mHAAmH;IAChI,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,QAAQ;CACf,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Board surface — how a board, tile or card game looks
|
|
2
|
+
|
|
3
|
+
Loaded with the board-games skill, which holds the rules, the seeds, the turns and the access
|
|
4
|
+
shapes. This doc is the board's look: the material it is dressed in, and the skin it is drawn with.
|
|
5
|
+
|
|
6
|
+
## Dress the board in the game's world
|
|
7
|
+
|
|
8
|
+
A board in plain rounded rectangles plays fine and looks like a spreadsheet. Before drawing, pick **one physical thing from the request's world** that a player would recognise on a real table, and let it decide four parts of the board: the frame, the column header, what a mark looks like, and how a win shows. Everything but the material's own colour stays in the theme's token classes, so the dressing restyles with the palette.
|
|
9
|
+
|
|
10
|
+
**Choose the material from the request, in this order:**
|
|
11
|
+
|
|
12
|
+
1. **The request's own subject.** A rollerblade club's bingo marks squares with skate wheels; a baby-shower bingo uses pacifiers or footprints; a road trip uses licence plates; a bird walk uses binocular rings; a wine night uses glass rings.
|
|
13
|
+
2. **The game's classic table.** Bingo is a paper card with a dauber; checkers are poker chips on felt; chess is an inlaid wood board; word tiles are wooden letter tiles; sudoku is pencil on graph paper; mancala is seeds in carved pits; memory is a deck of card backs; a trivia board is a TV game-show wall.
|
|
14
|
+
3. **The look the app already has.** When neither gives a strong picture, the board takes the shapes of the room's own components (its radius, its ledge shadow, its type).
|
|
15
|
+
|
|
16
|
+
**Then dress the four parts:**
|
|
17
|
+
|
|
18
|
+
- **Frame.** The material's edge: a ruled paper card with an ink border (`stroke-foreground`), a felt table (`fill-muted`), an inlaid border, a game-show wall with gaps between panels.
|
|
19
|
+
- **Header.** A bingo card's five column letters can spell a word from the theme instead of B-I-N-G-O: SKATE for a skate club, BIRDS for a bird walk, ROADS for a road trip. A header with exactly as many letters as columns reads as part of the card.
|
|
20
|
+
- **Mark.** The thing a real player puts down: a dauber blot, a wheel, a sticker, a chip, a pencil cross. The words underneath stay readable, so a mark is translucent (`opacity-60`) or the text flips to `fill-primary-foreground` on a solid mark. A mark animates once when it lands (a scale or a quarter turn, 150–500 ms) and stays put under `motion-reduce:transition-none`.
|
|
21
|
+
- **Win.** The table's own celebration: a stroke drawn through the line, the winning marks changing colour together, a game-show panel flip. The win line is `stroke-accent` drawn over the marks.
|
|
22
|
+
|
|
23
|
+
**Two dressed bingo cards** (the board-games skill's `BingoBoard`, with a different cell and frame):
|
|
24
|
+
|
|
25
|
+
- **Dauber on paper.** Cells are square `<rect>`s with no gaps and `stroke-foreground` rules; a dark header band carries the theme word. A mark is a slightly lumpy blot — a `<path>` circle with uneven radii, rotated a little per cell from the seed — in `fill-primary opacity-60`, drawn above the cell and below the text.
|
|
26
|
+
- **Skate wheels** (or any round token: chips, caps, coins). Each cell is a `<circle>` in `fill-muted`; a marked cell fills `fill-foreground` with `fill-background` text and gains a dashed tread ring (`stroke-primary`, `strokeDasharray="6 5"`) that turns half a turn as it lands. The free centre is the hub, in `fill-accent`.
|
|
27
|
+
|
|
28
|
+
```jsx
|
|
29
|
+
// A dauber blot and a wheel, each one cell of a 100-unit grid centred on (cx, cy).
|
|
30
|
+
function Blot({ cx, cy, turn }) {
|
|
31
|
+
return <path d={`M ${cx - 36} ${cy} q 2 -38 38 -37 q 37 3 35 39 q -3 34 -38 35 q -37 -2 -35 -37 z`} transform={`rotate(${turn} ${cx} ${cy})`} className="fill-primary opacity-60 transition-transform duration-200 motion-reduce:transition-none" />;
|
|
32
|
+
}
|
|
33
|
+
function Wheel({ cx, cy, on }) {
|
|
34
|
+
// Drawn round (0, 0) inside a translated group, so a CSS rotate turns the ring about its own centre.
|
|
35
|
+
return (
|
|
36
|
+
<g transform={`translate(${cx} ${cy})`}>
|
|
37
|
+
<circle r="44" className={on ? "fill-foreground" : "fill-muted"} />
|
|
38
|
+
{/* Always mounted, so marking changes the rotation and the transition has a "from". */}
|
|
39
|
+
<circle r="44" fill="none" strokeWidth="5" strokeDasharray="6 5" className={`stroke-primary transition duration-500 motion-reduce:transition-none ${on ? "rotate-180 opacity-100" : "rotate-0 opacity-0"}`} />
|
|
40
|
+
</g>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**The same move on other boards:** checkers as poker chips (two concentric `<circle>`s with a dashed edge stripe); a word-guess as wooden tiles (a `<rect>` with a lighter top edge, letters in the display face); sudoku as graph paper (thin `stroke-border` rules, thick box rules, entries in a handwritten-looking face and givens in the body face); memory as a deck (a card back with a pattern drawn from the deck's seed, flipped with a `scaleX` transition); mancala as carved pits (an ellipse with an inner shadow ring and seeds as small circles scattered from the seed).
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Board surface — the board is the app
|
|
49
|
+
|
|
50
|
+
On a board game the board is the thing people came for, so the look's components only frame it: the title, a `Stat` or `Badge` for the score and the turn, `Button`s for New game / Undo / Share, a `Dialog` for the win. Taste goes into the board itself — its material, tiles, pieces, texture and motion — and a board drawn from `Card`s, `RowCard`s or one `IconButton` per square reads as an admin screen, whatever the palette.
|
|
51
|
+
|
|
52
|
+
On an app built from the UI's components (the default look or any look on its surface) the board takes the `reskin` technique, even when the person never asked for a look:
|
|
53
|
+
|
|
54
|
+
- **One wrapper.** The app renders inside a root `<div data-reskin>` with `<style>{SKIN}</style>` as its first child, `SKIN` one module-level CSS string. A later "make it look like a 1970s wooden set" then lands in the same place.
|
|
55
|
+
- **Colour from the look's tokens.** The board's CSS reads `var(--surface)`, `var(--ink)`, `var(--purple)`, `var(--up)`, `var(--down)` and `var(--r-card)`, so the Look tab and a reskin restyle the board with the chrome. The material is the exception: a material the person named, or the game's classic table (walnut and maple inlay, green felt, slate), is that material's own colour, set once as a token on the wrapper (`--felt: #2f6b4f;`, `--wood-light: #e2c296; --wood-dark: #8b5a34;`) and read from there. A look token never stands in for a named material, so an inlaid wood board is wood on every look.
|
|
56
|
+
- **Plain elements for tiles and pieces.** The board is SVG or a CSS grid of `div`s with the app's own class names (`.board`, `.sq`, `.sq--dark`, `.piece`), each cell a `<g role="button">` or `div role="button" tabIndex={0}` as the board-games skill draws them. They take classes freely; the look's components never do.
|
|
57
|
+
- **Texture and motion on the board, capture-safe.** Grain or felt is a gradient on `.board`; a piece slides with a `transform` transition and lands once; the first frame is already a full board.
|
|
58
|
+
|
|
59
|
+
```jsx
|
|
60
|
+
import React, { useState } from "react";
|
|
61
|
+
import { Badge, Button, Heading, Row, Stack } from "@vibes.diy/ui";
|
|
62
|
+
|
|
63
|
+
const SKIN = `
|
|
64
|
+
[data-reskin], body:has([data-reskin]) { --felt: #2f6b4f; }
|
|
65
|
+
[data-reskin] .board { display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); width: min(100%, 28rem); aspect-ratio: 1;
|
|
66
|
+
padding: 10px; border-radius: var(--r-card); background: var(--ink); touch-action: manipulation; user-select: none; }
|
|
67
|
+
[data-reskin] .sq { display: grid; place-items: center; background: var(--surface); }
|
|
68
|
+
[data-reskin] .sq--dark { background: repeating-linear-gradient(135deg, var(--felt) 0 3px, color-mix(in srgb, var(--felt) 88%, var(--ink)) 3px 6px); }
|
|
69
|
+
[data-reskin] .piece { width: 76%; aspect-ratio: 1; border-radius: 50%; border: 3px dashed color-mix(in srgb, var(--surface) 60%, transparent);
|
|
70
|
+
box-shadow: 0 3px 0 color-mix(in srgb, var(--ink) 45%, transparent); transition: transform 180ms ease; }
|
|
71
|
+
[data-reskin] .piece--red { background: var(--down); }
|
|
72
|
+
[data-reskin] .piece--black { background: var(--ink); border-color: var(--text-secondary); }
|
|
73
|
+
[data-reskin] .sq[aria-pressed="true"] .piece { transform: translateY(-4px) scale(1.06); }
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
const START = Array.from({ length: 64 }, (_, i) => {
|
|
77
|
+
const dark = (Math.floor(i / 8) + i) % 2 === 1;
|
|
78
|
+
return !dark ? null : i < 24 ? "black" : i >= 40 ? "red" : null;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export default function App() {
|
|
82
|
+
const [cells, setCells] = useState(START);
|
|
83
|
+
const [held, setHeld] = useState(-1);
|
|
84
|
+
const [turn, setTurn] = useState("red");
|
|
85
|
+
|
|
86
|
+
// Any empty square takes the held piece here; a real game asks legalMoves(state) first (below).
|
|
87
|
+
function tap(i) {
|
|
88
|
+
if (cells[i] === turn) return setHeld(i);
|
|
89
|
+
if (held < 0 || cells[i] !== null) return;
|
|
90
|
+
setCells(cells.map((c, j) => (j === i ? turn : j === held ? null : c)));
|
|
91
|
+
setHeld(-1);
|
|
92
|
+
setTurn(turn === "red" ? "black" : "red");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function newGame() {
|
|
96
|
+
setCells(START);
|
|
97
|
+
setHeld(-1);
|
|
98
|
+
setTurn("red");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<div data-reskin>
|
|
103
|
+
<style>{SKIN}</style>
|
|
104
|
+
<Stack gap={4}>
|
|
105
|
+
<Row gap={2} align="center">
|
|
106
|
+
<Heading level={1}>Checkers</Heading>
|
|
107
|
+
<Badge tone={turn === "red" ? "down" : "idle"}>{turn} to move</Badge>
|
|
108
|
+
</Row>
|
|
109
|
+
<div className="board" role="group" aria-label="Checkers board">
|
|
110
|
+
{cells.map((c, i) => (
|
|
111
|
+
<div
|
|
112
|
+
key={i}
|
|
113
|
+
role="button"
|
|
114
|
+
tabIndex={0}
|
|
115
|
+
aria-label={`Square ${i + 1}${c ? `, ${c}` : ""}`}
|
|
116
|
+
aria-pressed={held === i}
|
|
117
|
+
className={(Math.floor(i / 8) + i) % 2 === 1 ? "sq sq--dark" : "sq"}
|
|
118
|
+
onClick={() => tap(i)}
|
|
119
|
+
onKeyDown={(e) => {
|
|
120
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
tap(i);
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
{c && <span className={`piece piece--${c}`} />}
|
|
126
|
+
</div>
|
|
127
|
+
))}
|
|
128
|
+
</div>
|
|
129
|
+
<Row gap={2}>
|
|
130
|
+
<Button variant="quiet" onClick={newGame}>
|
|
131
|
+
New game
|
|
132
|
+
</Button>
|
|
133
|
+
</Row>
|
|
134
|
+
</Stack>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The rule functions, seeds and access shapes are the board-games skill's; this is only where the board's look lives. The same move covers a puzzle grid, a card table (a `.table` in felt, `.card` faces as plain elements) and the HUD around a canvas or voxel world, where the canvas is the board and the components are the frame.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const surfacePlayAreaConfig = {
|
|
2
|
+
name: "surface-play-area",
|
|
3
|
+
needs: ["canvas-theme-colors"],
|
|
4
|
+
label: "Play area surface",
|
|
5
|
+
description: "A full-screen game wears the app's look: sky, fog, light, player and lane lines painted from the theme tokens, a day/night cycle between look colours, and the HUD as kit components on the look's surfaces.",
|
|
6
|
+
menu: false,
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=surface-play-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-play-area.js","sourceRoot":"","sources":["../../jsr/llms/surface-play-area.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,qBAAqB,GAAc;IAC9C,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,CAAC,qBAAqB,CAAC;IAC9B,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,8MAA8M;IAChN,IAAI,EAAE,KAAK;CACZ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Surface: the play area — the look reaches a full-screen game
|
|
2
|
+
|
|
3
|
+
The look reaches the play area: the canvas paints with the app's own tokens, and the HUD over it is the kit's components on the look's surfaces.
|
|
4
|
+
|
|
5
|
+
A full-screen game is judged by its first screenshot, and that screenshot is mostly canvas. The
|
|
6
|
+
world, the overlays, the hotbar and the buttons all speak the look, so the game reads as the
|
|
7
|
+
same crafted app as everything else the person made.
|
|
8
|
+
|
|
9
|
+
**The world takes the look's colours.** Resolve the theme tokens to concrete colours once per
|
|
10
|
+
mount and paint every large area from them: the sky or backdrop from `--background` leaned toward
|
|
11
|
+
`--primary`, fog from the same colour so the horizon melts into it, the light from `--primary`
|
|
12
|
+
over `--surface`, the player and the thing to chase in `--primary` and `--accent`, guides and lane
|
|
13
|
+
lines in `--border`, and text drawn on the canvas in `--text-primary`. A game's own materials (a
|
|
14
|
+
voxel world's block table, a racer's track paint) keep their names and colours; the look owns
|
|
15
|
+
everything around them.
|
|
16
|
+
|
|
17
|
+
The colours come from `lib/look.js` (the canvas theme colours above): `readLook(host)` gives
|
|
18
|
+
`backdrop`, `surface`, `lead`, `accent`, `ink` and `line` as opaque hex, and `watchLook` repaints
|
|
19
|
+
on a restyle.
|
|
20
|
+
|
|
21
|
+
Read the look inside the effect that builds the scene, and call `watchLook` in the same effect
|
|
22
|
+
with its cleanup, so a restyle recolours the world in place (keep the sky, light and materials
|
|
23
|
+
in one `paint(look)` it runs at mount and on every change):
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const look = readLook(containerRef.current);
|
|
27
|
+
const sky = new THREE.Color(look.backdrop).lerp(new THREE.Color(look.lead), 0.2);
|
|
28
|
+
scene.background = sky;
|
|
29
|
+
scene.fog = new THREE.Fog(sky, 40, 120);
|
|
30
|
+
scene.add(new THREE.HemisphereLight(look.lead, look.surface, 0.9));
|
|
31
|
+
const sun = new THREE.DirectionalLight(look.surface, 1.4);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
A day/night cycle blends between two look colours (`backdrop` toward `lead` by day, toward `ink`
|
|
35
|
+
by night), so every hour of the day still belongs to the app.
|
|
36
|
+
|
|
37
|
+
**The HUD is the kit, on the look's surfaces.** Everything drawn over the world is a component
|
|
38
|
+
from `@vibes.diy/ui`, so it brings the look's type, radius, border and weight with it:
|
|
39
|
+
|
|
40
|
+
- The title sits in a `Heading` on a `Card` (or a `Row` on `bg-surface`) at full ink, so it reads
|
|
41
|
+
over a bright sky or a dark cave alike.
|
|
42
|
+
- Score and best are `Metric`s on a `Card`; a timer or lap count is one more `Metric`.
|
|
43
|
+
- The hotbar is a `Row` of `IconButton`s on a `Card`: the selected slot carries `tint` with the
|
|
44
|
+
active colour and `aria-pressed`, the rest stay `variant="quiet"`.
|
|
45
|
+
- Start, pause and game-over screens are a `Card` or `Dialog` with a `Heading`, one lead `Button`
|
|
46
|
+
and a quiet second action.
|
|
47
|
+
- Overlay text keeps the look's own foreground and muted tones at full opacity; a scrim behind it
|
|
48
|
+
comes from `bg-background` or `bg-surface`.
|
|
49
|
+
|
|
50
|
+
Read the first screenshot before you finish: the sky, the ground, the HUD and the title should
|
|
51
|
+
look like they came from the app's palette and type, the way its list pages do.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const surfacePresenceConfig = {
|
|
2
|
+
name: "surface-presence",
|
|
3
|
+
label: "Presence surface",
|
|
4
|
+
description: "How a live room shows its people: overlapping avatar faces at the top right, a live 'N here' count, " +
|
|
5
|
+
"an Invite button that copies the room's link, and other people's cursors and selected cells in their own theme colour.",
|
|
6
|
+
menu: false,
|
|
7
|
+
rail: "reskin",
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=surface-presence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-presence.js","sourceRoot":"","sources":["../../jsr/llms/surface-presence.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,qBAAqB,GAAc;IAC9C,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,sGAAsG;QACtG,wHAAwH;IAC1H,IAAI,EAAE,KAAK;IAEX,IAAI,EAAE,QAAQ;CACf,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Presence surface — who is here, where they are, and the way in
|
|
2
|
+
|
|
3
|
+
People who share a live space expect the same four signs they know from Figma,
|
|
4
|
+
Google Docs and Discord, in the same places:
|
|
5
|
+
|
|
6
|
+
1. **Faces in the top corner.** A row of overlapping round avatars at the
|
|
7
|
+
right end of the room's header, newest last, at most four, then a `+N`.
|
|
8
|
+
Tapping a face opens that person's profile.
|
|
9
|
+
2. **A live count.** "3 here" beside the faces with a small live dot, and "Just
|
|
10
|
+
you" when nobody else has arrived, so an empty room reads as waiting rather
|
|
11
|
+
than broken.
|
|
12
|
+
3. **The invite next to them.** One quiet "Invite" button at the end of the
|
|
13
|
+
row copies the room's link; its label turns to "Link copied" for two seconds.
|
|
14
|
+
4. **Where each person is.** On a shared board or canvas, each other person's
|
|
15
|
+
pointer or selected cell is drawn in their own colour with their handle, the
|
|
16
|
+
way a Docs cursor carries a name flag. Your own pointer is never drawn.
|
|
17
|
+
|
|
18
|
+
## The bar
|
|
19
|
+
|
|
20
|
+
The faces are the platform's `ViewerTag`, which resolves each avatar from the
|
|
21
|
+
handle and paints from the look's palette variables on every look. The count
|
|
22
|
+
and the invite are the kit's `Badge`, `Dot` and `Button`, so the bar follows
|
|
23
|
+
the app's room, its reskin and its type with nothing of its own to restyle.
|
|
24
|
+
|
|
25
|
+
### `lib/here.jsx`
|
|
26
|
+
```jsx
|
|
27
|
+
import React from "react";
|
|
28
|
+
import { ViewerTag } from "use-vibes";
|
|
29
|
+
import { Badge, Button, Dot, Row, Text } from "@vibes.diy/ui";
|
|
30
|
+
|
|
31
|
+
/** Everyone in `people` ({ handle, isMe }); `onInvite` copies the room's link. */
|
|
32
|
+
export function HereBar({ people, onInvite, onOpenProfile }) {
|
|
33
|
+
const [copied, setCopied] = React.useState(false);
|
|
34
|
+
const others = people.filter((p) => !p.isMe);
|
|
35
|
+
const shown = people.slice(0, 4);
|
|
36
|
+
const more = people.length - shown.length;
|
|
37
|
+
async function invite() {
|
|
38
|
+
await onInvite();
|
|
39
|
+
setCopied(true);
|
|
40
|
+
setTimeout(() => setCopied(false), 2000);
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
<Row justify="end" align="center" gap="2">
|
|
44
|
+
<Row align="center">
|
|
45
|
+
{shown.map((p, i) => (
|
|
46
|
+
<ViewerTag
|
|
47
|
+
key={p.handle}
|
|
48
|
+
userHandle={p.handle}
|
|
49
|
+
size={28}
|
|
50
|
+
avatarOnly
|
|
51
|
+
className={i > 0 ? "-ml-2" : undefined}
|
|
52
|
+
onClick={onOpenProfile ? () => onOpenProfile(p.handle) : undefined}
|
|
53
|
+
/>
|
|
54
|
+
))}
|
|
55
|
+
</Row>
|
|
56
|
+
{more > 0 && <Badge tone="idle">+{more}</Badge>}
|
|
57
|
+
<Row align="center" gap="1">
|
|
58
|
+
<Dot tone={others.length > 0 ? "up" : "idle"} />
|
|
59
|
+
<Text size="sm" muted>{others.length > 0 ? `${people.length} here` : "Just you"}</Text>
|
|
60
|
+
</Row>
|
|
61
|
+
{onInvite && (
|
|
62
|
+
<Button size="sm" variant="quiet" onClick={invite}>{copied ? "Link copied" : "Invite"}</Button>
|
|
63
|
+
)}
|
|
64
|
+
</Row>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **Place it once, at the top right of the room** (the header row of a board,
|
|
70
|
+
the thread header of a chat, a corner of the HUD over a 3D world). On a phone
|
|
71
|
+
the row stays one line: faces first, the count shortens to the number.
|
|
72
|
+
- **A person's colour is chosen once from their handle** and used for their
|
|
73
|
+
cursor, their selection ring and any name flag, so the same person reads the
|
|
74
|
+
same everywhere in the room. Pick from the theme's own fills, never a hex:
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const PERSON_FILLS = ["fill-primary", "fill-accent", "fill-success", "fill-warning"];
|
|
78
|
+
const PERSON_STROKES = ["stroke-primary", "stroke-accent", "stroke-success", "stroke-warning"];
|
|
79
|
+
const hue = (handle) => [...handle].reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 0) % PERSON_FILLS.length;
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Cursors and selections
|
|
83
|
+
|
|
84
|
+
A cursor rides the person's presence state as board coordinates
|
|
85
|
+
(`{ x, y }` in the board's own `viewBox` units, or `{ cell: "r2c3" }`), never
|
|
86
|
+
screen pixels, so it lands on the same spot on every screen size. Draw the
|
|
87
|
+
other people over the board in the same SVG, after the board so it sits on
|
|
88
|
+
top, with `pointer-events-none` so it never steals a tap:
|
|
89
|
+
|
|
90
|
+
```jsx
|
|
91
|
+
<g className="pointer-events-none">
|
|
92
|
+
{people.filter((p) => !p.isMe && p.state).map((p) =>
|
|
93
|
+
p.state.cell ? (
|
|
94
|
+
<rect key={p.handle} {...cellBox(p.state.cell)} rx="2" className={`fill-none ${PERSON_STROKES[hue(p.handle)]}`} strokeWidth="1.5" />
|
|
95
|
+
) : (
|
|
96
|
+
<g key={p.handle} transform={`translate(${p.state.x} ${p.state.y})`}>
|
|
97
|
+
<path d="M0 0 L0 9 L2.5 6.5 L5 11 L6.5 10 L4 5.5 L7.5 5.5 Z" className={`${PERSON_FILLS[hue(p.handle)]} stroke-background`} strokeWidth="0.6" />
|
|
98
|
+
<text x="8" y="12" fontSize="4" className={PERSON_FILLS[hue(p.handle)]}>{p.handle}</text>
|
|
99
|
+
</g>
|
|
100
|
+
)
|
|
101
|
+
)}
|
|
102
|
+
</g>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Update the pointer from `onPointerMove` into the presence state ref (the
|
|
106
|
+
board's `getScreenCTM().inverse()` turns a pointer into `viewBox` units); the
|
|
107
|
+
heartbeat sends it. Clear it to `null` on `onPointerLeave`.
|
|
108
|
+
- A person whose state goes quiet fades after a few seconds rather than staying
|
|
109
|
+
pinned where they last pointed; the bar keeps their face until they leave.
|
|
110
|
+
- A 3D world draws other people as figures in the scene from the same state;
|
|
111
|
+
the bar still sits over the HUD.
|
|
112
|
+
|
|
113
|
+
## On a look without the kit
|
|
114
|
+
|
|
115
|
+
An app in the person's own style draws the same three parts with its own
|
|
116
|
+
elements: the `ViewerTag` row unchanged, the count as a small label with a dot
|
|
117
|
+
in the theme's success colour, and the invite as the app's quiet button. The
|
|
118
|
+
places and the words stay the same.
|