anentrypoint-design 0.0.435 → 0.0.437

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anentrypoint-design",
3
- "version": "0.0.435",
3
+ "version": "0.0.437",
4
4
  "description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
5
5
  "type": "module",
6
6
  "main": "./dist/247420.js",
@@ -8,7 +8,8 @@
8
8
  // Adapter contract (all fields optional; the app degrades when one is absent):
9
9
  // adapter.get() -> snapshot {
10
10
  // channels, categories, servers, currentChannel, currentServerId, homeMode,
11
- // messages, chatInputValue, currentUser, userId,
11
+ // messages, // each message may carry reactions: [{emoji, count, users?, you?}]
12
+ // chatInputValue, currentUser, userId,
12
13
  // isConnected, voiceConnected, voiceChannelName, voiceConnectionState,
13
14
  // voiceParticipants, micMuted, voiceDeafened,
14
15
  // audioQueueItems, audioQueueCurrentId, audioQueuePaused,
@@ -24,6 +25,7 @@
24
25
  // goHome(), openServers(), memberMenu(id, name, x, y),
25
26
  // replaySegment(id), skipSegment(), pauseQueue(), resumeQueue(),
26
27
  // setInput(v), startReply(msg), cancelReply(), deleteMessage(id),
28
+ // reactToMessage(id, authorUserId, emoji) // optional; emoji defaults ('+') when omitted from the trigger
27
29
  // createChannel() // optional; when present + canManage, rail shows a "+" next to "rooms"
28
30
  // }
29
31
  // adapter.helpers = { avatarColor(id), initial(name), formatTime(ts) }
@@ -152,10 +154,11 @@ export function mountCommunityApp(root, adapter = {}) {
152
154
  const isYou = selfId && String(m.userId) === String(selfId);
153
155
  const reactions = Array.isArray(m.reactions) ? m.reactions.map(r => ({ emoji: r.emoji, count: r.count != null ? r.count : (r.users ? r.users.length : 1), you: !!(r.you || (r.users && selfId && r.users.includes(selfId))) })) : null;
154
156
  const msgActions = [
157
+ { label: 'react', title: 'react to ' + username + '\'s message', icon: 'smile', onClick: () => A.reactToMessage && A.reactToMessage(m.id, m.userId) },
155
158
  { label: 'reply', title: 'reply to ' + username, icon: 'corner-up-left', onClick: () => A.startReply && A.startReply({ id: m.id, userId: m.userId, username, content: m.content }) },
156
159
  isYou ? { label: 'delete', title: 'delete message', icon: 'trash', onClick: () => A.deleteMessage && A.deleteMessage(m.id) } : null,
157
160
  ].filter(Boolean);
158
- return { key: m.id || ('m' + i), who: isYou ? 'you' : 'them', name: isYou ? null : username, avatar: initial(username), time: formatTime(m.timestamp), parts: partsFromMessage(m), reactions, actions: msgActions, receipt: isYou && m.read ? 'read' : (isYou && m.delivered ? 'delivered' : null) };
161
+ return { key: m.id || ('m' + i), who: isYou ? 'you' : 'them', name: isYou ? null : username, avatar: initial(username), time: formatTime(m.timestamp), parts: partsFromMessage(m), reactions, onToggleReaction: A.reactToMessage ? (emoji) => A.reactToMessage(m.id, m.userId, emoji) : null, actions: msgActions, receipt: isYou && m.read ? 'read' : (isYou && m.delivered ? 'delivered' : null) };
159
162
  });
160
163
  };
161
164
 
@@ -13,7 +13,7 @@ import { countMessage, renderPart } from './stats.js';
13
13
 
14
14
  const h = webjsx.createElement;
15
15
 
16
- export function ChatMessage({ role, who = 'them', avatar, text, parts, time, typing, key, aicat, reactions, receipt, name, streaming, actions, incomplete, stopped, flat, error, onRetry }) {
16
+ export function ChatMessage({ role, who = 'them', avatar, text, parts, time, typing, key, aicat, reactions, receipt, name, streaming, actions, incomplete, stopped, flat, error, onRetry, onToggleReaction }) {
17
17
  countMessage();
18
18
  // Support legacy 'who' prop, prefer 'role' with mapping:
19
19
  // 'user' -> 'you' (right-aligned, accent bubble)
@@ -77,7 +77,12 @@ export function ChatMessage({ role, who = 'them', avatar, text, parts, time, typ
77
77
  // text. So the visible label/count stay in the accessibility tree
78
78
  // as content, and an .sr-only span supplies just the wording the
79
79
  // visuals imply but do not spell out.
80
- ...reactions.map((r, i) => h('span', { class: 'rxn' + (r.you ? ' you' : ''), key: 'r' + i },
80
+ ...reactions.map((r, i) => h('button', {
81
+ type: 'button', class: 'rxn' + (r.you ? ' you' : ''), key: 'r' + i,
82
+ 'aria-pressed': String(!!r.you),
83
+ title: (r.you ? 'remove your ' : 'add ') + r.emoji + ' reaction',
84
+ onclick: onToggleReaction ? (e) => { e.preventDefault(); onToggleReaction(r.emoji); } : undefined,
85
+ },
81
86
  h('span', { class: 'e' }, r.emoji),
82
87
  h('span', { class: 'n' }, String(r.count)),
83
88
  h('span', { class: 'sr-only' }, ` ${String(r.count) === '1' ? 'reaction' : 'reactions'}${r.you ? ', you reacted' : ''}`))))
@@ -357,12 +357,13 @@
357
357
  display: inline-flex; align-items: center; gap: var(--space-1);
358
358
  padding: var(--space-hair) var(--space-2); background: var(--bg-2);
359
359
  border: 1px solid color-mix(in oklab, var(--fg) 10%, transparent);
360
- border-radius: var(--r-pill); font-size: var(--fs-xs);
361
- cursor: pointer; user-select: none;
360
+ border-radius: var(--r-pill); font-size: var(--fs-xs); font-family: inherit;
361
+ cursor: pointer; user-select: none; appearance: none;
362
362
  transition: background var(--dur-snap, .12s) var(--ease, ease), border-color var(--dur-snap, .12s) var(--ease, ease), transform 0.12s ease;
363
363
  position: relative;
364
364
  }
365
365
  .chat-reactions .rxn:hover { background: var(--bg-3); transform: scale(1.06); }
366
+ .chat-reactions .rxn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
366
367
  .chat-reactions .rxn.you {
367
368
  background: color-mix(in oklab, var(--accent) 18%, var(--bg-2));
368
369
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
@@ -838,6 +838,7 @@ export interface ChatMessageProps {
838
838
  flat?: any;
839
839
  error?: any;
840
840
  onRetry?: (...args: any[]) => any;
841
+ onToggleReaction?: (...args: any[]) => any;
841
842
  }
842
843
  export declare function ChatMessage(props?: ChatMessageProps): VNode;
843
844