@unson/brainbase-mcp 0.47.6 → 0.48.1

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.
@@ -8,7 +8,10 @@
8
8
  * review host.
9
9
  */
10
10
 
11
- import {
11
+ // A new lazy screen must not reuse the pre-loading-stage kit cached by an open tab.
12
+ // The capability query gives this compatible kit its own browser module identity.
13
+ import * as workspaceKit from './workspace-kit.js?capability=loading-stage-v1';
14
+ const {
12
15
  makeWorkspaceElement,
13
16
  workspaceButton,
14
17
  workspaceDialog,
@@ -21,7 +24,8 @@ import {
21
24
  workspacePageHeader,
22
25
  workspaceRailBlock,
23
26
  workspaceRailHead,
24
- } from './workspace-kit.js';
27
+ workspaceLoadingStage,
28
+ } = workspaceKit;
25
29
 
26
30
  export const JUDGMENT_HISTORY_UI_CONTRACT_VERSION = 'brainbase.judgment-history-ui.v1';
27
31
 
@@ -1860,6 +1864,14 @@ function skeletonRows(doc, count = 5) {
1860
1864
  }));
1861
1865
  }
1862
1866
 
1867
+ // Have any rows arrived in the raw payload, regardless of the active
1868
+ // period/query filter? Used only while loading to decide the full-screen stage.
1869
+ function hasArrivedRows(arrived) {
1870
+ if (!arrived) return false;
1871
+ const list = arrived.mode === 'normal' ? arrived.records : arrived.items;
1872
+ return Array.isArray(list) && list.length > 0;
1873
+ }
1874
+
1863
1875
  function loadingLine(doc) {
1864
1876
  return makeWorkspaceElement(doc, 'p', {
1865
1877
  className: 'bb-jh-summary bb-jh-loading',
@@ -2391,11 +2403,14 @@ export function createJudgmentHistoryUI({
2391
2403
  function render() {
2392
2404
  if (state.disposed) return;
2393
2405
  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.
2406
+ if (state.phase === 'loading' && !hasArrivedRows(state.arrived)) {
2407
+ // Before any rows arrive, say in the page what is happening. Decide this
2408
+ // from the raw arrived payload, not a filtered aggregate: once rows have
2409
+ // arrived, a period/query filter that hides them must not bring back the
2410
+ // full-screen stage, and we skip a second aggregation per render.
2396
2411
  const pending = makeWorkspaceElement(doc, 'div', { className: 'bb-jh', attrs: { 'aria-busy': 'true' } });
2397
2412
  if (!notificationRoot) pending.append(notifications);
2398
- pending.append(loadingLine(doc));
2413
+ pending.append(workspaceLoadingStage(doc, { title: '判断の履歴を準備しています', slow: state.slow }));
2399
2414
  root.replaceChildren(pending);
2400
2415
  return;
2401
2416
  }
@@ -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 = () => {