@unson/brainbase-mcp 0.49.1 → 0.50.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.
@@ -357,6 +357,64 @@
357
357
  display: none;
358
358
  }
359
359
 
360
+ /* RQ-003: the "?" disclosure and its panel sit above the canvas. The stage's
361
+ first child canvas fills its height and the stage clips overflow, so these
362
+ must be absolutely positioned to stay visible and clickable (not in flow). */
363
+ .bb-world-legend-toggle {
364
+ position: absolute;
365
+ top: var(--bb-space-3);
366
+ right: var(--bb-space-3);
367
+ z-index: 3;
368
+ }
369
+
370
+ .bb-world-legend-panel {
371
+ position: absolute;
372
+ top: calc(var(--bb-space-3) + 42px);
373
+ right: var(--bb-space-3);
374
+ z-index: 3;
375
+ max-width: min(360px, calc(100% - 24px));
376
+ max-height: calc(100% - 80px);
377
+ overflow: auto;
378
+ display: flex;
379
+ flex-direction: column;
380
+ gap: var(--bb-space-2);
381
+ padding: var(--bb-space-3);
382
+ background: rgb(255 255 255 / 95%);
383
+ border: 1px solid var(--bb-color-border);
384
+ border-radius: var(--bb-radius-md);
385
+ box-shadow: var(--bb-shadow);
386
+ backdrop-filter: blur(4px);
387
+ }
388
+
389
+ .bb-world-legend-panel[hidden] {
390
+ display: none;
391
+ }
392
+
393
+ /* Inside the panel the legend is static, not an overlay pinned to the stage. */
394
+ .bb-world-legend-panel .bb-world-legend {
395
+ position: static;
396
+ inset: auto;
397
+ }
398
+
399
+ /* RQ-006: the header sky switch is an icon button. The icon reuses the canvas
400
+ artwork, so its SVG needs the same explicit size or it would balloon and
401
+ break the header (the canvas rule only targets .bb-world-canvas-sky-icon). */
402
+ .bb-world-sky {
403
+ display: inline-grid;
404
+ place-items: center;
405
+ }
406
+
407
+ .bb-world-sky-icon {
408
+ display: inline-flex;
409
+ line-height: 1;
410
+ }
411
+
412
+ .bb-world-sky-icon svg {
413
+ display: block;
414
+ width: 23px;
415
+ height: 23px;
416
+ }
417
+
360
418
  .bb-world-chip.is-work-waiting::before { background: #7a6a9e; }
361
419
  .bb-world-chip.is-work-in_progress::before { background: #2f7d86; }
362
420
  .bb-world-chip.is-work-pending::before { background: #8d979e; }
@@ -29,7 +29,7 @@
29
29
  import { THREE, MapControls } from './world-vendor.js';
30
30
  import { changesSince, cityMeasures, districtChanges, districtLots, districtSnapshot, districtStage, groupJudgmentPlaces, skyAt, UNPLACED_REASON_TEXT } from './world-placement.js';
31
31
  import { createDistrictView, DISTRICT_LEGEND } from './world-district.js';
32
- import { createWorldCanvasUI } from './world-canvas-ui.js';
32
+ import { createWorldCanvasUI, SKY_MODES, skyModeLabel, skyModeIconSvg } from './world-canvas-ui.js';
33
33
  import { workCanvasNotes } from './world-canvas-notes.js';
34
34
  import { canvasTexture, drawFacade, FACADE_SIZES, FACADE_UNITS, gableRoof, hashUnit, muted, paintVertices, roundedPlate, valueNoise } from './world-scenery.js';
35
35
  import { WORK_STATES, readReasonShort, workCityBlocks, workGrowthBlock, workPickBlock, workSign, workSignBlocks, workSigns, workSiteBlocks } from './world-work-rail.js';
@@ -44,6 +44,8 @@ import {
44
44
  workspaceButton,
45
45
  } from '../../workspace-kit.js';
46
46
 
47
+ let worldLegendSequence = 0;
48
+
47
49
  export const WORLD_VIEW_CONTRACT_VERSION = 'brainbase.world-view.v0';
48
50
  /** Optional full-canvas presentation; the standard host contract remains unchanged. */
49
51
  export const WORLD_CANVAS_PRESENTATION_VERSION = 'brainbase.world-canvas.v1';
@@ -1650,17 +1652,28 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
1650
1652
  let scene = null;
1651
1653
 
1652
1654
  // The sky follows the hour by default; the viewer can fix it to see the lit windows at night.
1653
- const SKY_MODES = [['auto', '空:時刻'], ['day', '空:昼'], ['dusk', '空:夕方'], ['night', '空:夜']];
1655
+ // An icon button reusing the canvas sky artwork and labels, so both presentations behave alike (RQ-152).
1654
1656
  let skyIndex = 0;
1655
1657
  const skyButton = workspaceButton(doc, {
1656
- text: SKY_MODES[0][1],
1658
+ variant: 'quiet',
1657
1659
  onClick: () => {
1658
1660
  skyIndex = (skyIndex + 1) % SKY_MODES.length;
1659
- skyButton.textContent = SKY_MODES[skyIndex][1];
1660
- scene?.setSky(SKY_MODES[skyIndex][0]);
1661
- district?.setSky(SKY_MODES[skyIndex][0]);
1661
+ renderSkyButton();
1662
+ scene?.setSky(SKY_MODES[skyIndex].value);
1663
+ district?.setSky(SKY_MODES[skyIndex].value);
1662
1664
  },
1663
1665
  });
1666
+ skyButton.classList.add('bb-world-sky');
1667
+ const skyButtonIcon = el(doc, 'span', { className: 'bb-world-sky-icon', attrs: { 'aria-hidden': 'true' } });
1668
+ skyButton.append(skyButtonIcon);
1669
+ function renderSkyButton() {
1670
+ const mode = SKY_MODES[skyIndex].value;
1671
+ skyButtonIcon.innerHTML = skyModeIconSvg(mode);
1672
+ const label = skyModeLabel(mode);
1673
+ skyButton.setAttribute('aria-label', label);
1674
+ skyButton.setAttribute('title', label);
1675
+ }
1676
+ renderSkyButton();
1664
1677
  const header = workspacePageHeader(doc, {
1665
1678
  crumbs: page?.crumbs ?? ['あなたのBrainbase', '世界'],
1666
1679
  title: '世界',
@@ -1711,9 +1724,10 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
1711
1724
  if (business) openCity(business, scene?.selectKey({ code })?.center ?? null);
1712
1725
  },
1713
1726
  onSky: (mode) => {
1714
- skyIndex = Math.max(0, SKY_MODES.findIndex(([key]) => key === mode));
1715
- scene?.setSky(SKY_MODES[skyIndex][0]);
1716
- district?.setSky(SKY_MODES[skyIndex][0]);
1727
+ skyIndex = Math.max(0, SKY_MODES.findIndex((entry) => entry.value === mode));
1728
+ renderSkyButton();
1729
+ scene?.setSky(SKY_MODES[skyIndex].value);
1730
+ district?.setSky(SKY_MODES[skyIndex].value);
1717
1731
  },
1718
1732
  onDismissTask: () => dismissTask(),
1719
1733
  });
@@ -1728,7 +1742,24 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
1728
1742
  if (page?.source) help.append(el(doc, 'p', { text: page.source }));
1729
1743
  canvasUI.setHelp([help]);
1730
1744
  } else {
1731
- stage.append(notices, legend, workLegend);
1745
+ // The legend is no longer a permanent overlay (RQ-003); it folds into a small
1746
+ // "?" disclosure, closed by default, with the same keyboard and aria-expanded
1747
+ // behaviour as the canvas help button. The information is kept, just tucked away.
1748
+ const legendPanel = el(doc, 'div', { className: 'bb-world-legend-panel', attrs: { id: `bb-world-legend-${++worldLegendSequence}` } });
1749
+ legendPanel.hidden = true;
1750
+ legendPanel.append(legend, workLegend);
1751
+ const legendToggle = workspaceButton(doc, {
1752
+ text: '?',
1753
+ variant: 'quiet',
1754
+ attrs: { 'aria-label': '世界の見方と凡例', title: '世界の見方と凡例', 'aria-controls': legendPanel.id, 'aria-expanded': 'false' },
1755
+ onClick: () => {
1756
+ const open = legendPanel.hidden;
1757
+ legendPanel.hidden = !open;
1758
+ legendToggle.setAttribute('aria-expanded', String(open));
1759
+ },
1760
+ });
1761
+ legendToggle.classList.add('bb-world-legend-toggle');
1762
+ stage.append(notices, legendToggle, legendPanel);
1732
1763
  wrap.append(header, stage);
1733
1764
  }
1734
1765
 
@@ -2207,9 +2238,8 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
2207
2238
  },
2208
2239
  } : {}),
2209
2240
  });
2210
- district.setSky(SKY_MODES[skyIndex][0]);
2241
+ district.setSky(SKY_MODES[skyIndex].value);
2211
2242
  scene.setPaused(true);
2212
- if (!canvasMode) { legend.hidden = true; workLegend.hidden = true; }
2213
2243
  if (districtCode !== business.code || !district.isOpen()) {
2214
2244
  district.show(business, work, { neighbours: new Map(knownBusinesses.map((entry) => [entry.code, entry.name])), exits: stationsFor(business.code) });
2215
2245
  districtCode = business.code;
@@ -2225,7 +2255,6 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
2225
2255
  district.hide();
2226
2256
  districtCode = null;
2227
2257
  scene?.setPaused(false);
2228
- if (!canvasMode) legend.hidden = false;
2229
2258
  }
2230
2259
 
2231
2260
  async function loadWork(business) {
@@ -2670,7 +2699,7 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
2670
2699
  return;
2671
2700
  }
2672
2701
  scene = createScene({ doc, stage, labelsLayer, reducedMotion, onPick, onClear: clearAll, onEscape: goUp, onSign: (business, code) => showSignMeaning(business ?? knownBusinesses.find((entry) => entry.code === code) ?? null) });
2673
- scene.setSky(SKY_MODES[skyIndex][0]);
2702
+ scene.setSky(SKY_MODES[skyIndex].value);
2674
2703
  scene.buildPlaza(rows, rowItems, (row) => (rowItems.get(row.key) ?? []).filter((ref) => isWaiting(proofs.get(ref.decision_attempt_id))).length, Date.now(), { state: judgmentsUnavailable ? judgmentsUnavailable.title.replace('判断の記録:', '') : null });
2675
2704
  scene.buildCities(layoutWorld(businesses), placement.byBusiness);
2676
2705
  showChangesSinceLastVisit(note, businesses, rows);