@unson/brainbase-mcp 0.47.5 → 0.48.0

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.
@@ -21,6 +21,7 @@ import {
21
21
  workspacePageHeader,
22
22
  workspaceRailBlock,
23
23
  workspaceRailHead,
24
+ workspaceLoadingStage,
24
25
  } from './workspace-kit.js';
25
26
 
26
27
  export const JUDGMENT_HISTORY_UI_CONTRACT_VERSION = 'brainbase.judgment-history-ui.v1';
@@ -1860,6 +1861,14 @@ function skeletonRows(doc, count = 5) {
1860
1861
  }));
1861
1862
  }
1862
1863
 
1864
+ // Have any rows arrived in the raw payload, regardless of the active
1865
+ // period/query filter? Used only while loading to decide the full-screen stage.
1866
+ function hasArrivedRows(arrived) {
1867
+ if (!arrived) return false;
1868
+ const list = arrived.mode === 'normal' ? arrived.records : arrived.items;
1869
+ return Array.isArray(list) && list.length > 0;
1870
+ }
1871
+
1863
1872
  function loadingLine(doc) {
1864
1873
  return makeWorkspaceElement(doc, 'p', {
1865
1874
  className: 'bb-jh-summary bb-jh-loading',
@@ -2391,11 +2400,14 @@ export function createJudgmentHistoryUI({
2391
2400
  function render() {
2392
2401
  if (state.disposed) return;
2393
2402
  updateNotifications(state.phase === 'loading');
2394
- if (state.phase === 'loading' && !state.showSkeleton && !state.arrived) {
2395
- // Before the placeholder rows appear, say in the page what is happening.
2403
+ if (state.phase === 'loading' && !hasArrivedRows(state.arrived)) {
2404
+ // Before any rows arrive, say in the page what is happening. Decide this
2405
+ // from the raw arrived payload, not a filtered aggregate: once rows have
2406
+ // arrived, a period/query filter that hides them must not bring back the
2407
+ // full-screen stage, and we skip a second aggregation per render.
2396
2408
  const pending = makeWorkspaceElement(doc, 'div', { className: 'bb-jh', attrs: { 'aria-busy': 'true' } });
2397
2409
  if (!notificationRoot) pending.append(notifications);
2398
- pending.append(loadingLine(doc));
2410
+ pending.append(workspaceLoadingStage(doc, { title: '判断の履歴を準備しています', slow: state.slow }));
2399
2411
  root.replaceChildren(pending);
2400
2412
  return;
2401
2413
  }
@@ -598,12 +598,31 @@
598
598
  transform-origin: center; animation: bb-ws-spinner 1s linear infinite;
599
599
  }
600
600
  @keyframes bb-ws-spinner { to { transform: rotate(360deg); } }
601
+ .bb-ws-loading-stage {
602
+ display: grid; place-items: center; align-content: center; gap: var(--bb-space-3);
603
+ min-height: min(320px, 50vh); padding: var(--bb-space-6) var(--bb-space-4);
604
+ text-align: center; color: var(--bb-color-ink);
605
+ }
606
+ .bb-ws-loading-stage-mark { display: inline-flex; gap: 8px; }
607
+ .bb-ws-loading-stage-dot {
608
+ width: 10px; height: 10px; border-radius: 50%; background: var(--bb-color-notice-text, currentColor);
609
+ animation: bb-ws-loading-dot 1.2s ease-in-out infinite;
610
+ }
611
+ .bb-ws-loading-stage-dot:nth-child(2) { animation-delay: .15s; }
612
+ .bb-ws-loading-stage-dot:nth-child(3) { animation-delay: .3s; }
613
+ @keyframes bb-ws-loading-dot {
614
+ 0%, 80%, 100% { transform: scale(.6); opacity: .35; }
615
+ 40% { transform: scale(1); opacity: 1; }
616
+ }
617
+ .bb-ws-loading-stage-title { margin: 0; font-weight: 600; }
618
+ .bb-ws-loading-stage-detail { margin: 0; color: var(--bb-color-muted, inherit); font-size: .875rem; }
601
619
  .bb-ws-error-card.is-dismissing { animation: bb-ws-notification-out 450ms ease both; pointer-events: none; }
602
620
  @keyframes bb-ws-notification-out { to { opacity: 0; transform: translateX(28px); } }
603
621
  @media (max-width:760px) { .bb-ws-drawer { width: 100vw; border-left: 0; } }
604
622
  @media (prefers-reduced-motion:reduce) {
605
623
  .bb-ws-drawer[open], .bb-ws-drawer.is-closing, .bb-ws-drawer.is-closing::backdrop,
606
- .bb-ws-filter-popover, .bb-ws-loading-spinner::before, .bb-ws-error-card.is-dismissing { animation: none; }
624
+ .bb-ws-filter-popover, .bb-ws-loading-spinner::before, .bb-ws-loading-stage-dot, .bb-ws-error-card.is-dismissing { animation: none; }
625
+ .bb-ws-loading-stage-dot { opacity: .7; transform: none; }
607
626
  }
608
627
 
609
628
  /* Searchable dropdown (workspaceCombobox) */
@@ -458,6 +458,24 @@ export function workspaceLoadingCard(doc, { title = 'ロード中' } = {}) {
458
458
  return card;
459
459
  }
460
460
 
461
+ /** Friendly, centered loading stage for a whole screen. */
462
+ export function workspaceLoadingStage(doc, { title = '準備しています', detail, slow = false } = {}) {
463
+ const stage = el(doc, 'div', {
464
+ className: `bb-ws-loading-stage${slow ? ' is-slow' : ''}`,
465
+ // No aria-busy here: on a live region it would hold back the announcement (Codex r2).
466
+ attrs: { role: 'status', 'aria-live': 'polite' },
467
+ });
468
+ const mark = el(doc, 'span', { className: 'bb-ws-loading-stage-mark', attrs: { 'aria-hidden': 'true' } });
469
+ // The dots sit inside the aria-hidden mark, so they need no aria-hidden of their own.
470
+ for (let index = 0; index < 3; index += 1) {
471
+ mark.append(el(doc, 'span', { className: 'bb-ws-loading-stage-dot' }));
472
+ }
473
+ stage.append(mark, el(doc, 'p', { className: 'bb-ws-loading-stage-title', text: title }));
474
+ const detailText = typeof detail === 'string' && detail.trim() ? detail : (slow ? '時間がかかっています。このままお待ちください。' : null);
475
+ if (detailText) stage.append(el(doc, 'p', { className: 'bb-ws-loading-stage-detail', text: detailText }));
476
+ return stage;
477
+ }
478
+
461
479
  /** Fade right then remove. Calling the returned cancel function restores a reusable card. */
462
480
  export function workspaceDismissNotification(card, onDismiss) {
463
481
  const remove = () => {