anentrypoint-design 0.0.233 → 0.0.234

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.233",
3
+ "version": "0.0.234",
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",
@@ -21,7 +21,7 @@
21
21
  // channelContext(id, x, y), serverContext(id, x, y), switchServer(id),
22
22
  // goHome(), openServers(), memberMenu(id, name, x, y),
23
23
  // replaySegment(id), skipSegment(), pauseQueue(), resumeQueue(),
24
- // setInput(v), cancelReply()
24
+ // setInput(v), startReply(msg), cancelReply(), deleteMessage(id)
25
25
  // }
26
26
  // adapter.helpers = { avatarColor(id), initial(name), formatTime(ts) }
27
27
  //
@@ -112,8 +112,8 @@ export function mountCommunityApp(root, adapter = {}) {
112
112
  const partsFromMessage = (m) => {
113
113
  const parts = [];
114
114
  if (m.replyTo) {
115
- const who = m.replyTo.username || 'User';
116
- const quoted = (m.replyTo.content || '').replace(/\n/g, ' ').slice(0, 120);
115
+ const who = m.replyTo.username || (m.replyTo.userId && A.resolveProfile && A.resolveProfile(m.replyTo.userId)) || 'User';
116
+ const quoted = m.replyTo.content ? (m.replyTo.content || '').replace(/\n/g, ' ').slice(0, 120) : '(message unavailable)';
117
117
  parts.push({ kind: 'md', text: '> **@' + who + ':** ' + quoted });
118
118
  }
119
119
  const content = m.content || '';
@@ -138,21 +138,30 @@ export function mountCommunityApp(root, adapter = {}) {
138
138
  const username = (A.resolveProfile && A.resolveProfile(m.userId)) || m.username || 'User';
139
139
  const isYou = selfId && String(m.userId) === String(selfId);
140
140
  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;
141
- 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, receipt: isYou && m.read ? 'read' : (isYou && m.delivered ? 'delivered' : null) };
141
+ const msgActions = [
142
+ { 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 }) },
143
+ isYou ? { label: 'delete', title: 'delete message', icon: 'trash', onClick: () => A.deleteMessage && A.deleteMessage(m.id) } : null,
144
+ ].filter(Boolean);
145
+ 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) };
142
146
  });
143
147
  };
144
148
 
145
149
  const chatView = (s) => {
146
150
  const ch = s.currentChannel || {};
147
151
  const sub = ch.type === 'voice' ? 'voice' : ch.type === 'forum' ? 'forum' : ch.type === 'page' ? 'page' : ch.type === 'announcement' ? 'announcement' : 'public';
152
+ const rt = s.replyTarget;
153
+ const replyPreview = rt ? h('div', { class: 'cm-reply-preview', role: 'status' },
154
+ h('span', { class: 'cm-reply-preview-label' }, 'Replying to ' + (rt.username || 'User')),
155
+ h('button', { type: 'button', class: 'cm-reply-preview-close', 'aria-label': 'cancel reply', title: 'cancel reply', onclick: (e) => { e.preventDefault(); A.cancelReply && A.cancelReply(); } }, Icon('x', { size: 14 }))
156
+ ) : null;
148
157
  return Chat({
149
158
  title: ch.name || 'general', sub, messages: mapMessages(s), header: null,
150
- composer: ChatComposer({
159
+ composer: h('div', { class: 'cm-composer-wrap' }, replyPreview, ChatComposer({
151
160
  value: s.chatInputValue || '',
152
- placeholder: 'message #' + (ch.name || 'general') + '…',
161
+ placeholder: rt ? 'reply to ' + (rt.username || 'User') + '…' : 'message #' + (ch.name || 'general') + '…',
153
162
  onInput: (v) => A.setInput && A.setInput(v),
154
- onSend: (v) => { const t = (v || '').trim(); if (t) A.send && A.send(t); },
155
- }),
163
+ onSend: (v) => { const t = (v || '').trim(); if (t) A.send && A.send(t, rt ? { replyTo: rt } : undefined); },
164
+ })),
156
165
  });
157
166
  };
158
167