anentrypoint-design 0.0.161 → 0.0.163
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.
|
|
3
|
+
"version": "0.0.163",
|
|
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",
|
package/src/components/chat.js
CHANGED
|
@@ -215,13 +215,16 @@ export function Chat({ title = 'chat', sub, messages = [], composer, header } =
|
|
|
215
215
|
el.dataset.msgCount = String(messages.length);
|
|
216
216
|
return () => obs.disconnect();
|
|
217
217
|
};
|
|
218
|
+
const msgCount = messages.length;
|
|
218
219
|
return h('div', { class: 'chat' },
|
|
219
220
|
header || h('div', { class: 'chat-head', role: 'banner' },
|
|
220
221
|
h('span', { class: 'dot', 'aria-hidden': 'true' }),
|
|
221
222
|
h('h2', { class: 'ds-chat-title' }, title),
|
|
222
223
|
sub ? h('span', { class: 'sub', 'aria-label': `subtitle: ${sub}` }, ' · ' + sub) : null,
|
|
223
224
|
h('span', { class: 'spread' }),
|
|
224
|
-
|
|
225
|
+
msgCount > 0
|
|
226
|
+
? h('span', { class: 'sub', 'aria-live': 'polite' }, msgCount + (msgCount === 1 ? ' message' : ' messages'))
|
|
227
|
+
: null
|
|
225
228
|
),
|
|
226
229
|
h('div', { class: 'chat-thread', ref: threadRef, role: 'log', 'aria-label': 'chat messages' },
|
|
227
230
|
messages.length === 0
|
|
@@ -289,7 +292,9 @@ export function AICat({ name = 'aicat', messages = [], thinking, composer, statu
|
|
|
289
292
|
h('h2', { class: 'ds-chat-title' }, name),
|
|
290
293
|
h('span', { class: 'sub', 'aria-label': `status: ${status}` }, ' · ' + status),
|
|
291
294
|
h('span', { class: 'spread' }),
|
|
292
|
-
|
|
295
|
+
messages.length > 0
|
|
296
|
+
? h('span', { class: 'sub', 'aria-live': 'polite' }, messages.length + (messages.length === 1 ? ' turn' : ' turns'))
|
|
297
|
+
: null
|
|
293
298
|
),
|
|
294
299
|
h('div', { class: 'chat-thread', ref: threadRef, role: 'log', 'aria-label': 'conversation turns' },
|
|
295
300
|
...all.map((m, i) => ChatMessage({ ...m, key: m.key != null ? m.key : i }))
|
|
@@ -325,15 +325,22 @@ export function ContextMenu({ items = [], anchor = { x: 0, y: 0 }, onClose } = {
|
|
|
325
325
|
ref: (el) => {
|
|
326
326
|
if (!el) return;
|
|
327
327
|
rootEl = el;
|
|
328
|
-
//
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
328
|
+
// Position at the anchor immediately, then clamp once layout has
|
|
329
|
+
// settled — measuring synchronously in ref reads a zero-size box
|
|
330
|
+
// (children not yet painted), so the clamp must run post-layout.
|
|
331
|
+
const ax = anchor.x || 0, ay = anchor.y || 0;
|
|
332
|
+
el.style.left = ax + 'px';
|
|
333
|
+
el.style.top = ay + 'px';
|
|
334
|
+
const clamp = () => {
|
|
335
|
+
const vw = window.innerWidth, vh = window.innerHeight;
|
|
336
|
+
const r = el.getBoundingClientRect();
|
|
337
|
+
let x = ax, y = ay;
|
|
338
|
+
if (x + r.width > vw) x = Math.max(4, vw - r.width - 4);
|
|
339
|
+
if (y + r.height > vh) y = Math.max(4, vh - r.height - 4);
|
|
340
|
+
el.style.left = x + 'px';
|
|
341
|
+
el.style.top = y + 'px';
|
|
342
|
+
};
|
|
343
|
+
requestAnimationFrame(clamp);
|
|
337
344
|
queueMicrotask(() => { el.querySelector('button[data-ix]')?.focus(); });
|
|
338
345
|
}
|
|
339
346
|
},
|