anentrypoint-design 0.0.339 → 0.0.341

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.339",
3
+ "version": "0.0.341",
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",
@@ -15,6 +15,7 @@ import { ChatComposer, ChatMessage, makeThreadAutoScroll } from './chat.js';
15
15
  import { Select } from './content.js';
16
16
  import { Btn, Icon } from './shell.js';
17
17
  import { BreadcrumbPath } from './files.js';
18
+ import { SplitPanel } from './editor-primitives.js';
18
19
  import { initializeCachesEagerly } from '../markdown-cache.js';
19
20
 
20
21
  const h = webjsx.createElement;
@@ -222,6 +223,14 @@ export function AgentChat(props = {}) {
222
223
  installHint, exportActions = [],
223
224
  onPasteFiles, onDropFiles, onEmoji,
224
225
  shownMessages, onShowEarlier,
226
+ // Optional inline content viewer beside the thread (a docstudio-cue
227
+ // addition: its chat view keeps a live document/PDF preview open next to
228
+ // the conversation instead of forcing a separate tab/window). The host
229
+ // supplies the actual preview vnode (FilePreviewPane/FileViewer or
230
+ // anything else) - this component only owns the split layout + a close
231
+ // affordance. Omitting sidePanel keeps every existing caller's output
232
+ // byte-identical (no SplitPanel wrapper at all when absent).
233
+ sidePanel, sidePanelTitle = 'preview', onCloseSidePanel,
225
234
  } = props;
226
235
 
227
236
  // Warm the markdown/Prism stack the moment the surface mounts so the CDN
@@ -453,14 +462,25 @@ export function AgentChat(props = {}) {
453
462
  : null)
454
463
  : null;
455
464
 
456
- return h('div', { class: 'agentchat' },
457
- AgentControls({ agents, selectedAgent, models, selectedModel, busy, status, modelsLoading, agentsLoading,
458
- onSelectAgent, onSelectModel, onNewChat, onStop, exportActions }),
459
- CwdBar({ cwd, editing: cwdEditing, draft: cwdDraft, error: cwdError, checking: cwdChecking,
460
- roots: cwdRoots, recent: cwdRecent, browse: cwdBrowse,
461
- onEdit: onCwdEdit, onSave: onCwdSave, onCancel: onCwdCancel, onClear: onCwdClear, onDraft: onCwdDraft,
462
- onBrowseToggle: onCwdBrowseToggle, onBrowseCrumb: onCwdBrowseCrumb, onBrowseEnter: onCwdBrowseEnter, onBrowsePick: onCwdBrowsePick }),
463
- ...(banners || []).filter(Boolean),
465
+ const threadBody = h('div', { class: 'agentchat-thread-wrap' },
466
+ h('div', { class: 'agentchat-thread', ref: threadRef(messages.length), role: 'log', 'aria-label': 'conversation' },
467
+ emptyState,
468
+ earlierRow,
469
+ ...rows.filter(Boolean),
470
+ showWorkingTail
471
+ ? h('div', { key: '_working', class: 'agentchat-working', role: 'status', 'aria-live': 'polite' },
472
+ h('span', { class: 'chat-thinking-dots', 'aria-hidden': 'true' }, h('span'), h('span'), h('span')),
473
+ h('span', { class: 'agentchat-working-text' }, 'working…'))
474
+ : null,
475
+ followupRow),
476
+ // Jump-to-latest: hidden until the scroll listener adds .show (user scrolled
477
+ // up). Clicking returns to the live edge. Pure-DOM, like the kit's other
478
+ // stateless chrome, so the host needn't thread scroll state through state.
479
+ h('button', { class: 'agentchat-jump', type: 'button', 'aria-label': 'jump to latest', title: 'jump to latest',
480
+ onclick: (e) => scrollThreadToBottom(e.currentTarget) },
481
+ Icon('arrow-down', { size: 16 }), h('span', { class: 'agentchat-jump-label' }, 'latest')));
482
+
483
+ const mainColumn = h('div', { class: 'agentchat-main-col' },
464
484
  h('div', { class: 'agentchat-head' },
465
485
  h('h1', { class: 'agentchat-title' }, name + (selectedModel ? ' · ' + selectedModel : '')),
466
486
  h('span', { class: 'agentchat-sub', 'aria-hidden': busy ? 'true' : null },
@@ -468,23 +488,35 @@ export function AgentChat(props = {}) {
468
488
  // reconnecting-while-streaming state reads one word everywhere instead of
469
489
  // the head saying "streaming…" while the controls say "reconnecting…".
470
490
  busy ? (status || 'streaming…') : (messages.length ? messages.length + (messages.length === 1 ? ' message' : ' messages') : ''))),
471
- h('div', { class: 'agentchat-thread-wrap' },
472
- h('div', { class: 'agentchat-thread', ref: threadRef(messages.length), role: 'log', 'aria-label': 'conversation' },
473
- emptyState,
474
- earlierRow,
475
- ...rows.filter(Boolean),
476
- showWorkingTail
477
- ? h('div', { key: '_working', class: 'agentchat-working', role: 'status', 'aria-live': 'polite' },
478
- h('span', { class: 'chat-thinking-dots', 'aria-hidden': 'true' }, h('span'), h('span'), h('span')),
479
- h('span', { class: 'agentchat-working-text' }, 'working…'))
480
- : null,
481
- followupRow),
482
- // Jump-to-latest: hidden until the scroll listener adds .show (user scrolled
483
- // up). Clicking returns to the live edge. Pure-DOM, like the kit's other
484
- // stateless chrome, so the host needn't thread scroll state through state.
485
- h('button', { class: 'agentchat-jump', type: 'button', 'aria-label': 'jump to latest', title: 'jump to latest',
486
- onclick: (e) => scrollThreadToBottom(e.currentTarget) },
487
- Icon('arrow-down', { size: 16 }), h('span', { class: 'agentchat-jump-label' }, 'latest'))),
488
- composer,
491
+ threadBody,
492
+ composer);
493
+
494
+ // sidePanel renders the caller's content vnode (a FilePreviewPane, a plain
495
+ // iframe/embed, anything) inside a resizable SplitPanel beside the thread -
496
+ // omitted entirely when sidePanel is falsy so every existing caller's DOM
497
+ // output is byte-unchanged.
498
+ const body = sidePanel
499
+ ? SplitPanel({ orientation: 'horizontal', initial: '55%', min: 320,
500
+ children: [
501
+ mainColumn,
502
+ h('div', { class: 'agentchat-side-panel' },
503
+ h('div', { class: 'agentchat-side-panel-head' },
504
+ h('span', { class: 'agentchat-side-panel-title' }, sidePanelTitle),
505
+ onCloseSidePanel
506
+ ? h('button', { type: 'button', class: 'agentchat-side-panel-close', 'aria-label': 'close preview', title: 'close preview', onclick: onCloseSidePanel }, Icon('x', { size: 14 }))
507
+ : null),
508
+ h('div', { class: 'agentchat-side-panel-body' }, sidePanel)),
509
+ ] })
510
+ : mainColumn;
511
+
512
+ return h('div', { class: 'agentchat' + (sidePanel ? ' has-side-panel' : '') },
513
+ AgentControls({ agents, selectedAgent, models, selectedModel, busy, status, modelsLoading, agentsLoading,
514
+ onSelectAgent, onSelectModel, onNewChat, onStop, exportActions }),
515
+ CwdBar({ cwd, editing: cwdEditing, draft: cwdDraft, error: cwdError, checking: cwdChecking,
516
+ roots: cwdRoots, recent: cwdRecent, browse: cwdBrowse,
517
+ onEdit: onCwdEdit, onSave: onCwdSave, onCancel: onCwdCancel, onClear: onCwdClear, onDraft: onCwdDraft,
518
+ onBrowseToggle: onCwdBrowseToggle, onBrowseCrumb: onCwdBrowseCrumb, onBrowseEnter: onCwdBrowseEnter, onBrowsePick: onCwdBrowsePick }),
519
+ ...(banners || []).filter(Boolean),
520
+ body,
489
521
  );
490
522
  }
@@ -97,7 +97,7 @@ function renderPart(p, key) {
97
97
  });
98
98
  }
99
99
 
100
- export function ChatMessage({ role, who = 'them', avatar, text, parts, time, typing, key, aicat, reactions, receipt, name, streaming, actions, incomplete, stopped, flat }) {
100
+ export function ChatMessage({ role, who = 'them', avatar, text, parts, time, typing, key, aicat, reactions, receipt, name, streaming, actions, incomplete, stopped, flat, error, onRetry }) {
101
101
  _stats.messages += 1;
102
102
  // Support legacy 'who' prop, prefer 'role' with mapping:
103
103
  // 'user' -> 'you' (right-aligned, accent bubble)
@@ -144,6 +144,15 @@ export function ChatMessage({ role, who = 'them', avatar, text, parts, time, typ
144
144
  typeof stopped === 'string' ? stopped : 'stopped — this turn was cancelled before it finished')];
145
145
  if (incomplete) bodyNodes = [...bodyNodes, h('div', { key: '_incomplete', class: 'chat-msg-notice is-incomplete', role: 'status' },
146
146
  typeof incomplete === 'string' ? incomplete : 'connection dropped mid-turn — the response may be incomplete')];
147
+ // Inline per-turn error: unlike a global toast, this pins the failure to
148
+ // the specific turn that failed (docstudio pattern) with a retry action
149
+ // right there instead of forcing the user to hunt for what broke.
150
+ if (error) bodyNodes = [...bodyNodes, h('div', { key: '_error', class: 'chat-msg-notice is-error', role: 'alert' },
151
+ h('span', {}, typeof error === 'string' ? error : 'this turn failed'),
152
+ onRetry ? h('button', {
153
+ type: 'button', class: 'chat-msg-retry-btn',
154
+ onclick: (e) => { e.preventDefault(); onRetry(e); },
155
+ }, 'retry') : null)];
147
156
  const reactionRow = reactions && reactions.length
148
157
  ? h('div', { class: 'chat-reactions' },
149
158
  ...reactions.map((r, i) => h('span', { class: 'rxn' + (r.you ? ' you' : ''), key: 'r' + i, 'aria-label': `${r.emoji} reaction (${String(r.count)} ${String(r.count) === '1' ? 'reaction' : 'reactions'})${r.you ? ' - you reacted' : ''}` },
@@ -6,6 +6,18 @@ import * as webjsx from '../../vendor/webjsx/index.js';
6
6
  import { Btn, Heading, Lede, Dot, Icon } from './shell.js';
7
7
  const h = webjsx.createElement;
8
8
 
9
+ // Avatar — generic identity disc: an image when `src` resolves, else a
10
+ // letter fallback derived from `name`/`fallback`. Kit previously only had
11
+ // scoped one-offs (chat.js `.chat-avatar`, community.js `.cm-user-avatar`)
12
+ // duplicating this same letter-fallback logic; this is the reusable version.
13
+ export function Avatar({ name, src, fallback, size = 'md', key } = {}) {
14
+ const letter = fallback != null ? fallback
15
+ : (name ? String(name).trim().charAt(0).toUpperCase() || '?' : '?');
16
+ const cls = 'ds-avatar ds-avatar-' + size;
17
+ if (src) return h('img', { key, class: cls, src, alt: name || '', loading: 'lazy' });
18
+ return h('span', { key, class: cls, 'aria-hidden': !!name, role: name ? 'img' : undefined, 'aria-label': name || undefined }, letter);
19
+ }
20
+
9
21
  export function Panel({ title, count, right, style = '', class: className = '', children, kind, id }) {
10
22
  const cls = 'panel' + (kind ? ' panel-' + kind : '') + (className ? ' ' + className : '');
11
23
  return h('div', { class: cls, style, id: id || null },
@@ -418,7 +430,7 @@ export function BarChart({ items = [], emptyText = 'no data yet' }) {
418
430
  h('div', { class: 'ds-barchart-value' }, it.display != null ? it.display : String(it.value)))));
419
431
  }
420
432
 
421
- export function Table({ headers = [], rows = [], onRowClick, emptyText = 'nothing here yet', rowLabels, striped = false, compact = false }) {
433
+ export function Table({ headers = [], rows = [], onRowClick, emptyText = 'nothing here yet', rowLabels, striped = false, compact = false, sortable = false, sortKey, sortDir = 'asc', onSort }) {
422
434
  if (!rows || rows.length === 0) return h('div', { class: 'empty' }, emptyText);
423
435
  // rowLabels lets callers supply a plain-text label per row when the first
424
436
  // cell is a vnode (so the aria-label is meaningful, not the literal 'row').
@@ -435,8 +447,23 @@ export function Table({ headers = [], rows = [], onRowClick, emptyText = 'nothin
435
447
  // striped/compact are opt-in density modifiers (webgeist g-table parity) —
436
448
  // default false so the existing contract/visual is byte-unchanged.
437
449
  const wrapClass = 'ds-table-wrap' + (striped ? ' is-striped' : '') + (compact ? ' is-compact' : '');
450
+ // sortable is opt-in (default false, byte-unchanged for existing callers):
451
+ // a header becomes a real <button> announcing aria-sort, dispatching
452
+ // onSort(headerIndex) so the HOST owns the actual row-ordering logic (this
453
+ // component has no opinion on comparator/locale/type - it only renders the
454
+ // control and current state). A docstudio-style dense admin table needs
455
+ // sortable columns; Table previously had no way to express that at all.
456
+ const thFor = (hd, i) => {
457
+ if (!sortable || !onSort) return h('th', { key: i, scope: 'col' }, hd);
458
+ const isActive = sortKey === i;
459
+ const ariaSort = isActive ? (sortDir === 'desc' ? 'descending' : 'ascending') : 'none';
460
+ return h('th', { key: i, scope: 'col', 'aria-sort': ariaSort },
461
+ h('button', { type: 'button', class: 'ds-table-sort-btn' + (isActive ? ' is-active' : ''), onclick: () => onSort(i) },
462
+ h('span', { class: 'ds-table-sort-label' }, hd),
463
+ isActive ? Icon(sortDir === 'desc' ? 'chevron-down' : 'chevron-up', { size: 12 }) : null));
464
+ };
438
465
  return h('div', { class: wrapClass }, h('table', {},
439
- h('thead', {}, h('tr', {}, ...headers.map((hd, i) => h('th', { key: i, scope: 'col' }, hd)))),
466
+ h('thead', {}, h('tr', {}, ...headers.map((hd, i) => thFor(hd, i)))),
440
467
  h('tbody', {}, ...rows.map((row, i) => h('tr', {
441
468
  key: i,
442
469
  class: onRowClick ? 'clickable' : '',
@@ -147,8 +147,8 @@ export function FileRow({ name, type = 'other', size, modified, code, onOpen, on
147
147
  // grid does not flash from a bare spinner to a full list (predictable perceived
148
148
  // perf, the file-manager feel). `rows` controls how many ghost rows render.
149
149
  export function FileSkeleton({ rows = 12 } = {}) {
150
- return h('div', { class: 'ds-file-grid ds-file-skeleton', 'aria-hidden': 'true' },
151
- ...Array.from({ length: Math.max(1, rows) }, (_, i) => h('div', { key: 'sk' + i, class: 'ds-file-row ds-file-row-skeleton' },
150
+ return h('div', { class: 'ds-file-grid ds-file-skeleton', role: 'status', 'aria-busy': 'true', 'aria-label': 'loading files' },
151
+ ...Array.from({ length: Math.max(1, rows) }, (_, i) => h('div', { key: 'sk' + i, class: 'ds-file-row ds-file-row-skeleton', 'aria-hidden': 'true' },
152
152
  h('span', { class: 'ds-skel ds-skel-icon' }),
153
153
  h('span', { class: 'ds-skel ds-skel-title' }),
154
154
  h('span', { class: 'ds-skel ds-skel-meta' })))
@@ -133,6 +133,7 @@ export const ICON_PATHS = {
133
133
  'check-check': '<path d="M18 6 7 17l-3-3"/><path d="m22 10-7.5 7.5L13 16"/>',
134
134
  'chevron-right': '<path d="m9 6 6 6-6 6"/>',
135
135
  'chevron-down': '<path d="m6 9 6 6 6-6"/>',
136
+ 'chevron-up': '<path d="m6 15 6-6 6 6"/>',
136
137
  'arrow-down': '<path d="M12 5v14M5 12l7 7 7-7"/>',
137
138
  'arrow-right': '<path d="M5 12h14M12 5l7 7-7 7"/>',
138
139
  x: '<path d="M18 6 6 18M6 6l12 12"/>',
package/src/components.js CHANGED
@@ -16,7 +16,7 @@ export {
16
16
  WorksList, WritingList, Manifesto, Section, PageHeader,
17
17
  Kpi, Sparkline, BarChart, Table, SearchInput, TextField, Select, EventList,
18
18
  HomeView, ProjectView, Form,
19
- Spinner, Skeleton, Alert, FilterPills
19
+ Spinner, Skeleton, Alert, FilterPills, Avatar
20
20
  } from './components/content.js';
21
21
 
22
22
  export {
@@ -241,6 +241,19 @@
241
241
  max-width: 100%;
242
242
  }
243
243
  .ds-table-wrap > table { min-width: 100%; }
244
+ /* Sortable column headers (Table's opt-in sortable prop) — a docstudio-cue
245
+ addition: color stays neutral at rest (this is a structural control, not a
246
+ brand moment) and only the active sort direction gets the accent tint,
247
+ matching the "color reserved for meaning, not decoration" pattern seen in
248
+ docstudio's admin table. */
249
+ .ds-table-sort-btn {
250
+ display: inline-flex; align-items: center; gap: 4px;
251
+ background: none; border: none; padding: 0; margin: 0;
252
+ font: inherit; font-weight: inherit; color: inherit; cursor: pointer;
253
+ }
254
+ .ds-table-sort-btn:hover { color: var(--fg); }
255
+ .ds-table-sort-btn:focus-visible { outline: var(--focus-w) solid var(--focus-color); outline-offset: 2px; }
256
+ .ds-table-sort-btn.is-active { color: var(--accent-ink, var(--accent)); }
244
257
 
245
258
 
246
259
  /* == appended: settings kit cleanup == */
@@ -359,3 +372,16 @@
359
372
  .ds-chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: var(--space-4); }
360
373
  .ds-chat-detail { display: block; position: sticky; top: 0; }
361
374
  }
375
+
376
+ /* Avatar — generic identity disc primitive (content.js Avatar). Sized
377
+ variants mirror the existing chat-avatar/community-avatar footprints so
378
+ any consumer gets a consistent disc without duplicating the CSS. */
379
+ .ds-avatar {
380
+ display: inline-flex; align-items: center; justify-content: center;
381
+ border-radius: 50%; background: var(--bg-3); color: var(--fg);
382
+ font-family: var(--ff-mono); font-weight: 600; text-transform: lowercase;
383
+ letter-spacing: 0.02em; user-select: none; flex-shrink: 0; object-fit: cover;
384
+ }
385
+ .ds-avatar-sm { width: 24px; height: 24px; font-size: 10px; }
386
+ .ds-avatar-md { width: 36px; height: 36px; font-size: 12px; }
387
+ .ds-avatar-lg { width: 48px; height: 48px; font-size: 15px; }