@unson/brainbase-mcp 0.48.3 → 0.49.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.
@@ -13,7 +13,7 @@
13
13
 
14
14
  .bb-ws-breadcrumb {
15
15
  margin-bottom: 24px;
16
- color: var(--bb-color-quiet);
16
+ color: var(--bb-color-muted);
17
17
  font-size: 11px;
18
18
  letter-spacing: .02em;
19
19
  }
@@ -165,7 +165,7 @@
165
165
  color: var(--bb-color-action-text);
166
166
  }
167
167
 
168
- .bb-ws-button.is-primary:hover {
168
+ .bb-ws-button.is-primary:hover:not(:disabled) {
169
169
  border-color: var(--bb-color-action-hover);
170
170
  background: var(--bb-color-action-hover);
171
171
  }
@@ -573,10 +573,10 @@
573
573
  margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--bb-color-border);
574
574
  border-radius: 0; background: var(--bb-color-panel); color: var(--bb-color-ink); box-shadow: var(--bb-shadow-drawer); overflow: auto;
575
575
  }
576
- .bb-ws-drawer[open] { animation: bb-ws-drawer-in 180ms ease-out; }
576
+ .bb-ws-drawer[open] { animation: bb-ws-drawer-in var(--bb-duration-drawer-in, 180ms) var(--bb-ease-drawer-in, ease-out); }
577
577
  .bb-ws-drawer::backdrop { background: var(--bb-color-drawer-overlay); }
578
- .bb-ws-drawer.is-closing { animation: bb-ws-drawer-out 280ms ease-in both; pointer-events: none; }
579
- .bb-ws-drawer.is-closing::backdrop { animation: bb-ws-drawer-backdrop-out 280ms ease-in both; }
578
+ .bb-ws-drawer.is-closing { animation: bb-ws-drawer-out var(--bb-duration-drawer-out, 150ms) var(--bb-ease-drawer, cubic-bezier(0.32, 0.72, 0, 1)) both; pointer-events: none; }
579
+ .bb-ws-drawer.is-closing::backdrop { animation: bb-ws-drawer-backdrop-out var(--bb-duration-drawer-out, 150ms) var(--bb-ease-drawer, cubic-bezier(0.32, 0.72, 0, 1)) both; }
580
580
  .bb-ws-drawer .bb-ws-dialog-head { align-items: center; padding: 14px 16px 14px 28px; }
581
581
  .bb-ws-drawer .bb-ws-dialog-head h2 { font-weight: var(--bb-font-weight-medium); line-height: 1.35; }
582
582
  .bb-ws-drawer .bb-ws-dialog-body { padding: 18px 28px 32px; }
@@ -620,7 +620,7 @@
620
620
  }
621
621
  .bb-ws-loading-stage-title { margin: 0; font-weight: var(--bb-font-weight-medium); }
622
622
  .bb-ws-loading-stage-detail { margin: 0; color: var(--bb-color-muted, inherit); font-size: .875rem; }
623
- .bb-ws-error-card.is-dismissing { animation: bb-ws-notification-out 450ms ease both; pointer-events: none; }
623
+ .bb-ws-error-card.is-dismissing { animation: bb-ws-notification-out var(--bb-duration-toast-out, 200ms) var(--bb-ease-out, cubic-bezier(0.23, 1, 0.32, 1)) both; pointer-events: none; }
624
624
  @keyframes bb-ws-notification-out { to { opacity: 0; transform: translateX(28px); } }
625
625
  @media (max-width:760px) { .bb-ws-drawer { width: 100vw; border-left: 0; } }
626
626
  @media (prefers-reduced-motion:reduce) {
@@ -840,6 +840,26 @@
840
840
  line-height: var(--bb-tab-count-size);
841
841
  font-weight: var(--bb-tab-font-weight);
842
842
  }
843
+ /* workspaceTabStrip: one bar slides between tabs once the selected tab was measured. */
844
+ .bb-ws-tabs.is-indicator-ready { position: relative; }
845
+ .bb-ws-tabs.is-indicator-ready > :is([role="tab"], a, button):is([aria-selected="true"], [aria-current="page"], [aria-pressed="true"]),
846
+ .bb-ws-tabs.is-indicator-ready > :is([role="tab"], a, button):is([aria-selected="true"], [aria-current="page"], [aria-pressed="true"]):hover {
847
+ box-shadow: none;
848
+ }
849
+ .bb-ws-tabs.is-indicator-ready::after {
850
+ content: "";
851
+ position: absolute;
852
+ left: 0;
853
+ bottom: 0;
854
+ width: var(--bb-tab-indicator-width, 0px);
855
+ height: var(--bb-tab-indicator-size);
856
+ background: var(--bb-color-ink);
857
+ transform: translateX(var(--bb-tab-indicator-x, 0px));
858
+ transition: transform var(--bb-tab-indicator-duration) var(--bb-tab-indicator-ease), width var(--bb-tab-indicator-duration) var(--bb-tab-indicator-ease);
859
+ pointer-events: none;
860
+ }
861
+ .bb-ws-tabs.is-indicator-instant::after { transition: none; }
862
+ @media (prefers-reduced-motion: reduce) { .bb-ws-tabs.is-indicator-ready::after { transition: none; } }
843
863
  .bb-ws-tabs::-webkit-scrollbar { display: none; }
844
864
  .bb-ws-tabs[hidden],
845
865
  .bb-ws-tabs > [hidden] { display: none; }
@@ -328,6 +328,14 @@ export function workspaceHelp(doc, { text, label } = {}) {
328
328
  const drawerClosings = new WeakMap();
329
329
  const notificationClosings = new WeakMap();
330
330
  const reducedMotion = node => node.ownerDocument?.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true;
331
+ const animationFallback = (node, margin, fallback) => {
332
+ const durations = node.ownerDocument?.defaultView?.getComputedStyle?.(node).animationDuration;
333
+ const duration = Math.max(...(durations ?? '').split(',').map(value => {
334
+ const match = value.trim().match(/^(\d*\.?\d+)(ms|s)$/);
335
+ return match ? Number(match[1]) * (match[2] === 's' ? 1000 : 1) : NaN;
336
+ }));
337
+ return Number.isFinite(duration) && duration > 0 ? duration + margin : fallback;
338
+ };
331
339
 
332
340
  /** Apply the same native-dialog presentation to host-owned and kit drawers. */
333
341
  export function workspaceApplyDrawer(dialog) {
@@ -358,7 +366,7 @@ export function workspaceCloseDrawer(dialog, finish) {
358
366
  dialog.addEventListener('animationend', ended);
359
367
  dialog.addEventListener('close', cancel);
360
368
  dialog.classList.add('is-closing');
361
- timer = setTimeout(complete, 360); // Animation cancellation / background-tab fallback.
369
+ timer = setTimeout(complete, animationFallback(dialog, 70, 220)); // Animation cancellation / background-tab fallback.
362
370
  return cancel;
363
371
  }
364
372
 
@@ -496,14 +504,14 @@ export function workspaceDismissNotification(card, onDismiss) {
496
504
  const complete = () => { if (!active) return; cancel(); remove(); onDismiss?.(); };
497
505
  const ended = event => { if (event.target === card && event.animationName === 'bb-ws-notification-out') complete(); };
498
506
  notificationClosings.set(card, cancel); card.addEventListener('animationend', ended);
499
- card.classList.add('is-dismissing'); timer = setTimeout(complete, 500);
507
+ card.classList.add('is-dismissing'); timer = setTimeout(complete, animationFallback(card, 50, 250));
500
508
  return cancel;
501
509
  }
502
510
 
503
- /** Persistent, initially closed notification. The caller owns its lifecycle. */
504
- export function workspaceErrorCard(doc, { title, message, tone = 'danger', onRetry } = {}) {
511
+ /** Persistent notification, closed unless `open`. The caller owns its lifecycle. */
512
+ export function workspaceErrorCard(doc, { title, message, tone = 'danger', onRetry, open = false } = {}) {
505
513
  const card = workspaceNotificationCard(doc, { tone, className: 'bb-ws-error-card', role: 'listitem' });
506
- const details = el(doc, 'details');
514
+ const details = el(doc, 'details'); details.open = open;
507
515
  const summary = el(doc, 'summary', { attrs: { 'aria-label': `${title}の通知` } });
508
516
  summary.append(el(doc, 'span', { className: 'bb-ws-error-symbol', text: '!', attrs: { 'aria-hidden': 'true' } }), el(doc, 'span', { text: title }));
509
517
  details.append(summary, el(doc, 'p', { text: message })); card.append(details);
@@ -783,6 +791,112 @@ export function workspaceTabList(root) {
783
791
  return root;
784
792
  }
785
793
 
794
+ const TAB_STRIP_KEYS = new Set(['ArrowLeft', 'ArrowRight', 'Home', 'End']);
795
+ // How long a key move may wait for the host to redraw before focus is no longer brought back.
796
+ const TAB_STRIP_FOCUS_WINDOW_MS = 5000;
797
+ const tabStrips = new WeakMap();
798
+ const tabStripMemory = new Map();
799
+ const isEnabledTab = node => node?.getAttribute?.('role') === 'tab' && !node.hidden && !node.disabled && node.getAttribute('aria-disabled') !== 'true';
800
+ const isSelectedTab = node => node?.getAttribute?.('aria-selected') === 'true' || node?.getAttribute?.('aria-current') === 'page' || node?.getAttribute?.('aria-pressed') === 'true';
801
+
802
+ /** Opt-in keyboard switching and a sliding indicator on top of `workspaceTabList`.
803
+ * Selection stays with the host: a key move calls the tab's own click(). Hosts
804
+ * that redraw the strip as new nodes pass the same `memoryKey`; hosts that keep
805
+ * the root and replace its children call `update()` after drawing.
806
+ */
807
+ export function workspaceTabStrip(root, { memoryKey } = {}) {
808
+ workspaceTabList(root);
809
+ if (tabStrips.has(root)) return tabStrips.get(root);
810
+ const doc = root.ownerDocument;
811
+ const view = doc?.defaultView;
812
+ const schedule = typeof view?.requestAnimationFrame === 'function' ? fn => view.requestAnimationFrame(fn) : fn => { Promise.resolve().then(fn); };
813
+ const key = typeof memoryKey === 'string' && memoryKey ? memoryKey : null;
814
+ if (key && !tabStripMemory.has(key)) tabStripMemory.set(key, { x: null, width: null, focusUntil: 0 });
815
+ const local = { x: null, width: null, focusUntil: 0 };
816
+ const memory = () => (key ? tabStripMemory.get(key) : local);
817
+ const children = () => Array.from(root.children ?? []);
818
+ const tabs = () => children().filter(isEnabledTab);
819
+ const selectedTab = () => children().find(isSelectedTab) ?? null;
820
+ let placed = false;
821
+ let destroyed = false;
822
+
823
+ const setIndicator = ({ x, width }) => {
824
+ root.style.setProperty('--bb-tab-indicator-x', `${x}px`);
825
+ root.style.setProperty('--bb-tab-indicator-width', `${width}px`);
826
+ };
827
+ const placeIndicator = tab => {
828
+ const width = tab?.offsetWidth;
829
+ if (!(width > 0) || typeof root.style?.setProperty !== 'function') {
830
+ toggleWorkspaceClass(root, 'is-indicator-ready', false); placed = false; return;
831
+ }
832
+ // Measure from the strip itself: before the strip is positioned, offsetLeft counts from an outer box.
833
+ const box = tab.getBoundingClientRect?.();
834
+ const origin = root.getBoundingClientRect?.();
835
+ const target = box && origin ? { x: box.left - origin.left + (root.scrollLeft || 0), width: box.width } : { x: tab.offsetLeft, width };
836
+ const mem = memory();
837
+ if (!placed) {
838
+ // A new strip starts where the last strip with the same key left the bar, then slides.
839
+ const from = mem.width > 0 && !reducedMotion(root) ? mem : target;
840
+ toggleWorkspaceClass(root, 'is-indicator-instant', true);
841
+ setIndicator(from); toggleWorkspaceClass(root, 'is-indicator-ready', true);
842
+ void root.offsetWidth;
843
+ toggleWorkspaceClass(root, 'is-indicator-instant', false);
844
+ }
845
+ setIndicator(target); placed = true;
846
+ mem.x = target.x; mem.width = target.width;
847
+ };
848
+ const restoreFocus = () => {
849
+ const mem = memory();
850
+ if (!(mem.focusUntil > Date.now())) return;
851
+ const target = selectedTab();
852
+ if (!target || root.isConnected === false) return;
853
+ const active = doc?.activeElement ?? null;
854
+ if (active === target) { mem.focusUntil = 0; return; }
855
+ const lost = !active || active === doc.body || active.isConnected === false;
856
+ // Focus moved somewhere else: the viewer chose it, so leave it there.
857
+ if (!lost && !root.contains?.(active)) { mem.focusUntil = 0; return; }
858
+ // Still on a tab of this strip: the host has not finished selecting yet.
859
+ if (!lost) return;
860
+ target.focus?.({ preventScroll: true });
861
+ target.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });
862
+ mem.focusUntil = 0;
863
+ };
864
+ const update = () => {
865
+ // A strip the host already replaced must not move the shared memory back.
866
+ if (destroyed || root.isConnected === false) return;
867
+ const all = tabs();
868
+ const selected = selectedTab();
869
+ const focusable = all.includes(selected) ? selected : all[0];
870
+ for (const tab of all) tab.setAttribute('tabindex', tab === focusable ? '0' : '-1');
871
+ placeIndicator(selected);
872
+ restoreFocus();
873
+ };
874
+ const keydown = event => {
875
+ if (!TAB_STRIP_KEYS.has(event.key) || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
876
+ const all = tabs();
877
+ const current = all.indexOf(event.target);
878
+ if (current < 0 || all.length < 2) return;
879
+ event.preventDefault?.();
880
+ const last = all.length - 1;
881
+ const index = event.key === 'Home' ? 0 : event.key === 'End' ? last : (current + (event.key === 'ArrowRight' ? 1 : last)) % all.length;
882
+ const next = all[index];
883
+ if (next === event.target) return;
884
+ memory().focusUntil = Date.now() + TAB_STRIP_FOCUS_WINDOW_MS;
885
+ next.focus?.({ preventScroll: true });
886
+ if (!isSelectedTab(next)) next.click?.();
887
+ schedule(update);
888
+ };
889
+ root.addEventListener?.('keydown', keydown);
890
+ const controller = { root, update, destroy() {
891
+ destroyed = true; root.removeEventListener?.('keydown', keydown); tabStrips.delete(root);
892
+ toggleWorkspaceClass(root, 'is-indicator-ready', false);
893
+ root.style?.removeProperty?.('--bb-tab-indicator-x'); root.style?.removeProperty?.('--bb-tab-indicator-width');
894
+ } };
895
+ tabStrips.set(root, controller);
896
+ schedule(update);
897
+ return controller;
898
+ }
899
+
786
900
  /** The shared shallow dropdown chevron, sized and colored through shared CSS. */
787
901
  export function workspaceDropdownChevron(doc) {
788
902
  const wrap = el(doc, 'span', { className: 'bb-ws-combobox-chevron', attrs: { 'aria-hidden': 'true' } });
@@ -223,7 +223,7 @@
223
223
  width: calc(var(--bb-world-panel-width) - var(--bb-world-right-inset));
224
224
  overflow: hidden;
225
225
  transform: translateX(calc(100% + 20px));
226
- transition: transform .24s ease, visibility .24s;
226
+ transition: transform .24s var(--bb-ease-drawer, cubic-bezier(0.32, 0.72, 0, 1)), visibility .24s;
227
227
  }
228
228
  .bb-world-canvas-ui .bb-world-canvas-drawer.is-open { transform: translateX(0); }
229
229
  .bb-world-canvas-ui .bb-world-canvas-panel-top {
@@ -320,7 +320,7 @@
320
320
  overflow: hidden;
321
321
  opacity: 0;
322
322
  transform: translateY(24px);
323
- transition: transform .24s ease, opacity .24s ease, visibility .24s;
323
+ transition: transform .24s var(--bb-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), opacity .24s var(--bb-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), visibility .24s;
324
324
  }
325
325
  .bb-world-canvas-ui .bb-world-canvas-help.is-open { opacity: 1; transform: translateY(0); }
326
326
  .bb-world-canvas-ui .bb-world-canvas-help-body,