feat(presence): <PresenceStack> avatar-cluster primitive (0.3.0)#124
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 frompeerColor, 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 byid(a peer's multiple tabs/devices collapse to one avatar), cap,+Noverflow. Pure.presenceInitials(name)— avatar fallback (mirrors chat's localinitials; 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-stacksubpath +.css+ vitest alias.+11 tests (dedup/cap/overflow/empty; initials; render smoke: empty→null, avatars+
+Nchip, 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.6awareness feed →PresencePeer[]and mount the stack in app headers.🤖 Generated with Claude Code