anentrypoint-design 0.0.338 → 0.0.340

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.338",
3
+ "version": "0.0.340",
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
  }
@@ -418,7 +418,7 @@ export function BarChart({ items = [], emptyText = 'no data yet' }) {
418
418
  h('div', { class: 'ds-barchart-value' }, it.display != null ? it.display : String(it.value)))));
419
419
  }
420
420
 
421
- export function Table({ headers = [], rows = [], onRowClick, emptyText = 'nothing here yet', rowLabels, striped = false, compact = false }) {
421
+ export function Table({ headers = [], rows = [], onRowClick, emptyText = 'nothing here yet', rowLabels, striped = false, compact = false, sortable = false, sortKey, sortDir = 'asc', onSort }) {
422
422
  if (!rows || rows.length === 0) return h('div', { class: 'empty' }, emptyText);
423
423
  // rowLabels lets callers supply a plain-text label per row when the first
424
424
  // cell is a vnode (so the aria-label is meaningful, not the literal 'row').
@@ -435,8 +435,23 @@ export function Table({ headers = [], rows = [], onRowClick, emptyText = 'nothin
435
435
  // striped/compact are opt-in density modifiers (webgeist g-table parity) —
436
436
  // default false so the existing contract/visual is byte-unchanged.
437
437
  const wrapClass = 'ds-table-wrap' + (striped ? ' is-striped' : '') + (compact ? ' is-compact' : '');
438
+ // sortable is opt-in (default false, byte-unchanged for existing callers):
439
+ // a header becomes a real <button> announcing aria-sort, dispatching
440
+ // onSort(headerIndex) so the HOST owns the actual row-ordering logic (this
441
+ // component has no opinion on comparator/locale/type - it only renders the
442
+ // control and current state). A docstudio-style dense admin table needs
443
+ // sortable columns; Table previously had no way to express that at all.
444
+ const thFor = (hd, i) => {
445
+ if (!sortable || !onSort) return h('th', { key: i, scope: 'col' }, hd);
446
+ const isActive = sortKey === i;
447
+ const ariaSort = isActive ? (sortDir === 'desc' ? 'descending' : 'ascending') : 'none';
448
+ return h('th', { key: i, scope: 'col', 'aria-sort': ariaSort },
449
+ h('button', { type: 'button', class: 'ds-table-sort-btn' + (isActive ? ' is-active' : ''), onclick: () => onSort(i) },
450
+ h('span', { class: 'ds-table-sort-label' }, hd),
451
+ isActive ? Icon(sortDir === 'desc' ? 'chevron-down' : 'chevron-up', { size: 12 }) : null));
452
+ };
438
453
  return h('div', { class: wrapClass }, h('table', {},
439
- h('thead', {}, h('tr', {}, ...headers.map((hd, i) => h('th', { key: i, scope: 'col' }, hd)))),
454
+ h('thead', {}, h('tr', {}, ...headers.map((hd, i) => thFor(hd, i)))),
440
455
  h('tbody', {}, ...rows.map((row, i) => h('tr', {
441
456
  key: i,
442
457
  class: onRowClick ? 'clickable' : '',
@@ -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"/>',
@@ -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 == */
package/src/page-html.js CHANGED
@@ -37,12 +37,26 @@ export function slugify(s) {
37
37
  .replace(/\s+/g, '-');
38
38
  }
39
39
 
40
+ // Raw-HTML passthrough block, opt-in via ```html fences. Distinct from a
41
+ // plain ``` code fence (which still escapes+<pre>-wraps its contents) — this
42
+ // is for SSR call sites that are trusted, repo-authored content (a theme.mjs
43
+ // page body sourced from the project's own YAML, never end-user input) and
44
+ // need to emit real markup (e.g. an <iframe> demo embed) that must NOT be
45
+ // escaped. There is no sanitization here by design: the caller owns trust.
46
+ // A consumer rendering untrusted content must not route it through this
47
+ // path — use markdown.js's DOMPurify-backed renderMarkdown for that instead.
40
48
  export function renderMarkdown(md) {
41
49
  const lines = String(md || '').split('\n');
42
50
  const out = [];
43
- let inCode = false, inList = false;
51
+ let inCode = false, inList = false, inRawHtml = false;
44
52
  for (const line of lines) {
45
- if (line.startsWith('```')) { if (inCode) { out.push('</pre>'); inCode = false; } else { out.push('<pre>'); inCode = true; } continue; }
53
+ if (line.trim() === '```html') { if (!inCode) { inRawHtml = true; continue; } }
54
+ if (line.startsWith('```')) {
55
+ if (inRawHtml) { inRawHtml = false; continue; }
56
+ if (inCode) { out.push('</pre>'); inCode = false; } else { out.push('<pre>'); inCode = true; }
57
+ continue;
58
+ }
59
+ if (inRawHtml) { out.push(line); continue; }
46
60
  if (inCode) { out.push(escape(line)); continue; }
47
61
  if (line.startsWith('# ')) { const t = line.slice(2); out.push(`<h1 id="${slugify(t)}">${escape(t)}</h1>`); }
48
62
  else if (line.startsWith('## ')) { const t = line.slice(3); out.push(`<h2 id="${slugify(t)}">${escape(t)}</h2>`); }