Skip to content

feat(presence): <PresenceStack> avatar-cluster primitive (0.3.0)#124

Merged
th3-br41n merged 1 commit into
mainfrom
feat/presence-stack
Jul 8, 2026
Merged

feat(presence): <PresenceStack> avatar-cluster primitive (0.3.0)#124
th3-br41n merged 1 commit into
mainfrom
feat/presence-stack

Conversation

@th3-br41n

Copy link
Copy Markdown
Contributor

The visible half of the 0.3.0 "Trustworthy collaboration" train — a who's-here avatar cluster for a shared entity.

Built over a defined PresencePeer[] contract (id / name / color / avatarRef?), deliberately not raw Yjs awareness states: what each client publishes into awareness, and how that feed resolves to peers (names from the roster, colour from peerColor, self-identification), is the live-wiring rung's decision — pinning it here would guess a payload shape that doesn't exist yet (the awareness broadcaster is still dormant). So this rung is the pure logic + presentation only: testable without the relay, reusable by any app header the wiring feeds.

  • capPresence(peers, max) — dedup by id (a peer's multiple tabs/devices collapse to one avatar), cap, +N overflow. Pure.
  • presenceInitials(name) — avatar fallback (mirrors chat's local initials; a later pass consolidates chat onto it).
  • <PresenceStack> — overlapping avatars (peer colour inline per the peer-presence rationale; chrome on theme tokens), image-or-initials, role="group" + "N people here". New @brainstorm/sdk/presence-stack subpath + .css + vitest alias.

+11 tests (dedup/cap/overflow/empty; initials; render smoke: empty→null, avatars++N chip, image-vs-initials fallback, singular/plural label). Lint incl. the strict css-token gate + typecheck clean.

Next presence rung (live wiring): map the dormant 10.6 awareness feed → PresencePeer[] and mount the stack in app headers.

🤖 Generated with Claude Code

The visible half of live collaboration — a who's-here avatar cluster for a
shared entity. Built over a DEFINED `PresencePeer[]` contract (id / name /
color / avatarRef?), NOT raw Yjs awareness states: what each client
publishes + how the awareness feed maps to peers is the live-wiring rung's
call, and guessing that payload shape now would repeat the "design against
a guess" trap. So this rung is the pure list math + presentation only —
testable without the relay, reusable by any app header.

- `capPresence(peers, max)` — dedup by id (a peer's multiple tabs/devices
  collapse to one avatar), cap, `+N` overflow. Pure.
- `presenceInitials(name)` — avatar fallback initials (mirrors chat's local
  `initials`; consolidate chat onto this later).
- `<PresenceStack>` — overlapping avatars (peer colour inline per the
  peer-presence rationale; chrome on theme tokens), image-or-initials,
  `role="group"` + "N people here" label. New `@brainstorm/sdk/presence-stack`
  subpath + `.css` + vitest alias.

+11 tests (dedup/cap/overflow/empty; initials; render: empty→null,
avatars+chip, image-vs-initials, singular/plural label). Lint (incl. the
css-token gate) + typecheck clean.

Next (live-wiring rung): map the dormant 10.6 awareness feed → PresencePeer[]
(names from the roster, colour from peerColor) + mount in app headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@th3-br41n th3-br41n merged commit 8a0d731 into main Jul 8, 2026
3 checks passed
@th3-br41n th3-br41n deleted the feat/presence-stack branch July 8, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant