cladogram 0.6.0-beta.4 → 0.6.0-beta.5

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.
@@ -181,7 +181,6 @@
181
181
  },
182
182
  clearFocus: () => frame.contentWindow.CladoRuntime?.clearFocus(),
183
183
  showDiagnostics: () => frame.contentWindow.CladoCanvasControls?.showDiagnostics(),
184
- openHandoff: !offline && config.agent ? () => window.CladoVNext?.openHandoff?.() : null,
185
184
  });
186
185
  const directory = window.CladoDirectoryPlugin(host, {
187
186
  showFilename: settings['clado.directory']?.showFilename !== false,
@@ -574,6 +573,9 @@
574
573
  renderLobbyView(cachedHubData || {});
575
574
  }
576
575
 
576
+ let discoveredWorkspaces = [];
577
+ let emptyWorkspaceSignature = '';
578
+
577
579
  function renderEmptyOnboarding(profile = {}) {
578
580
  const emptyEl = $('#emptyState');
579
581
  if (!emptyEl) return;
@@ -627,6 +629,10 @@
627
629
  showToast('主架构师正在分析源码并绘制画布…');
628
630
  window.CladoVNext?.startCodeAnalysis?.(selectedTpl);
629
631
  };
632
+ if (discoveredWorkspaces.length) {
633
+ emptyWorkspaceSignature = '';
634
+ renderEmptyWorkspaces(discoveredWorkspaces);
635
+ }
630
636
  }
631
637
 
632
638
  if (config.canSwitchWorkspace && !offline) {
@@ -992,14 +998,10 @@
992
998
  selectionBarEl.innerHTML = `
993
999
  <span class="clado-selection-dot"></span>
994
1000
  <span class="clado-selection-text" data-sel-summary>已选 0 项</span>
995
- <button type="button" class="clado-selection-send" data-sel-dev>交给开发落地</button>
996
- <button type="button" class="clado-selection-secondary" data-sel-qa>生成并跑测试</button>
1001
+ <button type="button" class="clado-selection-send" data-sel-send>发给当前会话</button>
997
1002
  <button type="button" class="clado-selection-clear" data-sel-clear>完成</button>`;
998
- selectionBarEl.querySelector('[data-sel-dev]').onclick = () => {
999
- window.CladoVNext?.triggerHandoff?.('developer');
1000
- };
1001
- selectionBarEl.querySelector('[data-sel-qa]').onclick = () => {
1002
- window.CladoVNext?.triggerHandoff?.('tester');
1003
+ selectionBarEl.querySelector('[data-sel-send]').onclick = () => {
1004
+ window.CladoVNext?.focusComposer?.();
1003
1005
  };
1004
1006
  selectionBarEl.querySelector('[data-sel-clear]').onclick = () => {
1005
1007
  objectSelection.clear();
@@ -1492,35 +1494,64 @@
1492
1494
  if(!chainModal) { const force=deferredRefresh;deferredRefresh=false;scan(force); }
1493
1495
  }
1494
1496
  function renderDirectory() { directory.update(index, selected, history.length > 0); }
1495
- let emptyWorkspaceSignature = '';
1496
1497
  function renderEmptyWorkspaces(list) {
1497
- const others = list.filter(item => item.id !== workspaceId);
1498
+ discoveredWorkspaces = Array.isArray(list) ? list : [];
1499
+ const others = discoveredWorkspaces.filter(item => item.id !== workspaceId);
1498
1500
  const next = JSON.stringify(others.map(item => [item.id, item.name, item.documents]));
1499
- if (next === emptyWorkspaceSignature) return;
1501
+ if (next === emptyWorkspaceSignature && $('#emptyState .empty-workspaces')) return;
1500
1502
  emptyWorkspaceSignature = next;
1501
1503
  let container = $('#emptyState .empty-workspaces');
1502
1504
  if (!others.length) { container?.remove(); return; }
1505
+ const hostEl = $('#emptyState .clado-empty-card') || $('#emptyState .clado-launchpad-card') || $('#emptyState');
1503
1506
  if (!container) {
1504
1507
  container = document.createElement('div');
1505
1508
  container.className = 'empty-workspaces';
1506
- ($('#emptyState .clado-launchpad-card') || $('#emptyState')).append(container);
1509
+ hostEl.append(container);
1510
+ } else if (container.parentElement !== hostEl) {
1511
+ hostEl.append(container);
1507
1512
  }
1508
1513
  container.replaceChildren();
1514
+ const head = document.createElement('div');
1515
+ head.className = 'empty-workspaces-head';
1509
1516
  const title = document.createElement('div');
1510
1517
  title.className = 'empty-workspaces-title';
1511
- title.textContent = '已发现的子工作区(点击打开)';
1512
- container.append(title);
1518
+ title.textContent = '已发现的子工作区';
1519
+ const badge = document.createElement('span');
1520
+ badge.className = 'empty-workspaces-count';
1521
+ badge.textContent = `${others.length} 个工作区`;
1522
+ head.append(title, badge);
1523
+ container.append(head);
1524
+
1525
+ const grid = document.createElement('div');
1526
+ grid.className = 'empty-workspaces-grid';
1513
1527
  for (const item of others) {
1514
1528
  const link = document.createElement('a');
1515
1529
  link.className = 'empty-workspace-card';
1516
1530
  link.href = workspaceUrl(item.id);
1531
+ const label = item.id || (item.name + '(根目录)');
1532
+ link.title = label;
1533
+
1534
+ const ico = document.createElement('span');
1535
+ ico.className = 'empty-workspace-ico';
1536
+ ico.innerHTML = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>';
1537
+
1538
+ const meta = document.createElement('span');
1539
+ meta.className = 'empty-workspace-meta';
1517
1540
  const name = document.createElement('span');
1518
- name.textContent = item.id || (item.name + '(根目录)');
1541
+ name.className = 'empty-workspace-name';
1542
+ name.textContent = label;
1519
1543
  const count = document.createElement('small');
1520
1544
  count.textContent = (item.documents ?? 0) + ' 份画布';
1521
- link.append(name, count);
1522
- container.append(link);
1545
+ meta.append(name, count);
1546
+
1547
+ const arrow = document.createElement('span');
1548
+ arrow.className = 'empty-workspace-arrow';
1549
+ arrow.innerHTML = '<svg viewBox="0 0 24 24" aria-hidden="true" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>';
1550
+
1551
+ link.append(ico, meta, arrow);
1552
+ grid.append(link);
1523
1553
  }
1554
+ container.append(grid);
1524
1555
  }
1525
1556
  let renderRequest = 0;
1526
1557
  async function openFromCapability(file) {