@d86e/hive-panel 0.3.8 → 0.3.11

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/panel.js +168 -46
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d86e/hive-panel",
3
- "version": "0.3.8",
3
+ "version": "0.3.11",
4
4
  "description": "A read-only board for a Hive swarm: agents, task lanes and the event tail, served from the refs and files you already have.",
5
5
  "type": "module",
6
6
  "bin": {
package/public/panel.js CHANGED
@@ -130,7 +130,9 @@ const PANEL_STYLES = `.hive { position: relative; }
130
130
  align-items: center;
131
131
  justify-content: center;
132
132
  padding: 12px;
133
- background: rgb(0 0 0 / 45%);
133
+ background: transparent;
134
+ backdrop-filter: none;
135
+ -webkit-backdrop-filter: none;
134
136
  }
135
137
 
136
138
  .hive-help {
@@ -1255,15 +1257,59 @@ const PANEL_STYLES = `.hive { position: relative; }
1255
1257
  .hive-toast { right: 8px; bottom: 8px; width: calc(100% - 16px); }
1256
1258
  }
1257
1259
 
1258
- .hive-settings-actions {
1260
+
1261
+ .hive-settings-dialog { max-height: 80vh; }
1262
+
1263
+ .hive-settings-dialog .hive-dialog-body { overflow: auto; }
1264
+
1265
+ .hive-settings-tabs {
1266
+ display: flex;
1267
+ align-items: center;
1268
+ gap: 4px;
1269
+ border-bottom: 1px solid var(--hive-line, #232b38);
1270
+ }
1271
+
1272
+ .hive-settings-tab {
1273
+ flex: 0 0 auto;
1274
+ padding: 7px 10px 8px;
1275
+ border: 0;
1276
+ border-bottom: 2px solid transparent;
1277
+ background: transparent;
1278
+ color: var(--hive-fg-soft);
1279
+ font-size: 11.5px;
1280
+ line-height: 1.3;
1281
+ cursor: pointer;
1282
+ }
1283
+
1284
+ .hive-settings-tab:hover { color: var(--hive-fg, #e6edf3); }
1285
+
1286
+ .hive-settings-tab[aria-selected="true"] {
1287
+ border-bottom-color: var(--hive-accent, #58c4dc);
1288
+ color: var(--hive-fg, #e6edf3);
1289
+ }
1290
+
1291
+ .hive-settings-tab:focus-visible {
1292
+ outline: 2px solid var(--hive-accent, #58c4dc);
1293
+ outline-offset: -2px;
1294
+ }
1295
+
1296
+ .hive-settings-tabpanel[hidden] { display: none; }
1297
+
1298
+ .hive-settings-tabpanel .hive-settings-section {
1299
+ padding-top: 0;
1300
+ border-top: 0;
1301
+ }
1302
+
1303
+ .hive-settings-form-actions {
1259
1304
  display: flex;
1260
1305
  align-items: center;
1261
1306
  justify-content: flex-end;
1262
1307
  gap: 8px;
1263
1308
  width: 100%;
1309
+ margin-top: 2px;
1264
1310
  }
1265
1311
 
1266
- .hive-settings-actions .hive-btn {
1312
+ .hive-settings-form-actions .hive-btn {
1267
1313
  display: inline-flex;
1268
1314
  flex: 0 0 auto;
1269
1315
  align-items: center;
@@ -1276,6 +1322,11 @@ const PANEL_STYLES = `.hive { position: relative; }
1276
1322
  line-height: 1;
1277
1323
  }
1278
1324
 
1325
+ .hive-settings-form-actions .hive-btn:disabled {
1326
+ opacity: 0.55;
1327
+ cursor: not-allowed;
1328
+ }
1329
+
1279
1330
  .hive-settings-primary {
1280
1331
  border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1281
1332
  background: var(--hive-accent, #58c4dc);
@@ -1300,21 +1351,11 @@ const PANEL_STYLES = `.hive { position: relative; }
1300
1351
  color: var(--hive-fg, #e6edf3);
1301
1352
  }
1302
1353
 
1303
- .hive-settings-actions .hive-btn:disabled {
1354
+ .hive-settings-form-actions .hive-btn:disabled {
1304
1355
  opacity: 0.55;
1305
1356
  cursor: not-allowed;
1306
1357
  }
1307
1358
 
1308
- @media (max-width: 420px) {
1309
- .hive-settings-actions { justify-content: stretch; }
1310
- .hive-settings-actions .hive-btn { flex: 1 1 0; }
1311
- }
1312
-
1313
- @container hiveboard (max-width: 419px) {
1314
- .hive-settings-actions { justify-content: stretch; }
1315
- .hive-settings-actions .hive-btn { flex: 1 1 0; }
1316
- }
1317
-
1318
1359
  .hive-card-scrim { padding: 12px; }
1319
1360
 
1320
1361
  .hive-card-dialog {
@@ -1543,6 +1584,9 @@ export const messages = Object.freeze({
1543
1584
  "limits.closeAria": "Close agent concurrency settings",
1544
1585
  "settings.openAria": "Open settings for this repository",
1545
1586
  "settings.title": "Settings",
1587
+ "settings.tabLimits": "Concurrency limit",
1588
+ "settings.tabRole": "Add role",
1589
+ "settings.tabsAria": "Settings sections",
1546
1590
  "settings.aria": "Settings for this repository",
1547
1591
  "settings.addRole": "Add role",
1548
1592
  "settings.roleName": "Role name",
@@ -1617,9 +1661,9 @@ export const messages = Object.freeze({
1617
1661
  "init.queen": "This session's input now routes to the Queen (it splits tasks, it does not do the work).",
1618
1662
  "init.queenOutput": "Initialisation output",
1619
1663
  "queen.dismiss": "Dismiss",
1620
- "queen.dismissAria": "Dismiss the Queen notice for this repository",
1664
+ "queen.dismissAria": "Close this notice; it does not change Queen mode",
1621
1665
  "help.queen": "Queen mode",
1622
- "help.queenDesc": "Type /queen off to exit. After exiting, this session returns to normal coding mode. Hiding the notice does not change Queen mode.",
1666
+ "help.queenDesc": "Type /queen off to exit Queen mode; this session then returns to normal coding mode.",
1623
1667
  "queen.status.active": "Queen active",
1624
1668
  "queen.status.inactive": "Queen not active",
1625
1669
  "queen.source.auto": "auto",
@@ -1774,6 +1818,9 @@ export const messages = Object.freeze({
1774
1818
  "limits.closeAria": "关闭智能体的并发上限设置",
1775
1819
  "settings.openAria": "打开这个仓库的设置",
1776
1820
  "settings.title": "设置",
1821
+ "settings.tabLimits": "并发上限",
1822
+ "settings.tabRole": "添加角色",
1823
+ "settings.tabsAria": "设置分区",
1777
1824
  "settings.aria": "这个仓库的设置",
1778
1825
  "settings.addRole": "新增角色",
1779
1826
  "settings.roleName": "角色名",
@@ -1848,9 +1895,9 @@ export const messages = Object.freeze({
1848
1895
  "init.queen": "本会话输入框已接入女王模式(女王只拆解任务,不亲自干活)。",
1849
1896
  "init.queenOutput": "初始化输出",
1850
1897
  "queen.dismiss": "关闭提示",
1851
- "queen.dismissAria": "关闭这个仓库的女王提示",
1898
+ "queen.dismissAria": "关闭提示,不影响女王状态",
1852
1899
  "help.queen": "女王模式",
1853
- "help.queenDesc": "输入 /queen off 退出,退出后本会话恢复普通编码模式;关闭提示不影响女王状态。",
1900
+ "help.queenDesc": "输入 /queen off 退出女王模式,退出后本会话恢复普通编码模式。",
1854
1901
  "queen.status.active": "女王已接管",
1855
1902
  "queen.status.inactive": "女王未接管",
1856
1903
  "queen.source.auto": "自动",
@@ -2401,6 +2448,16 @@ function makeHiveIcon(doc, kind) {
2401
2448
  return svg;
2402
2449
  }
2403
2450
 
2451
+ function setHidden(node, hidden) {
2452
+ if (!node) return;
2453
+ if (hidden) {
2454
+ setAttr(node, "hidden", "");
2455
+ return;
2456
+ }
2457
+ if (typeof node.removeAttribute === "function") node.removeAttribute("hidden");
2458
+ else if (node.attributes) delete node.attributes.hidden;
2459
+ }
2460
+
2404
2461
  function setAttr(node, name, value) {
2405
2462
  if (node && typeof node.setAttribute === "function") {
2406
2463
  node.setAttribute(name, value === null || value === undefined ? "" : String(value));
@@ -2731,6 +2788,7 @@ export function mount(root, options = {}) {
2731
2788
  let limitsState = null;
2732
2789
  let limitsTriggerButton = null;
2733
2790
  let limitsFocusables = [];
2791
+ let settingsActiveTab = "limits";
2734
2792
 
2735
2793
  // --- shell ---------------------------------------------------------------
2736
2794
 
@@ -3568,7 +3626,7 @@ export function mount(root, options = {}) {
3568
3626
  if (!event || !event.target || event.target === overlay) closeLimitsDialog();
3569
3627
  });
3570
3628
 
3571
- const dialog = element(doc, "div", "hive-dialog");
3629
+ const dialog = element(doc, "div", "hive-dialog hive-settings-dialog");
3572
3630
  setAttr(dialog, "role", "dialog");
3573
3631
  setAttr(dialog, "aria-modal", "true");
3574
3632
  setAttr(dialog, "aria-label", translate("settings.aria"));
@@ -3588,18 +3646,11 @@ export function mount(root, options = {}) {
3588
3646
  dialog.appendChild(head);
3589
3647
 
3590
3648
  const body = element(doc, "div", "hive-dialog-body");
3591
- const repoLine = element(doc, "div", "hive-limits-repo");
3592
- repoLine.appendChild(element(doc, "span", "hive-limits-repo-label", translate("init.repo")));
3593
- const repoPath = element(doc, "code", "hive-limits-repo-path", repo);
3594
- setAttr(repoPath, "title", repo);
3595
- repoLine.appendChild(repoPath);
3596
- body.appendChild(repoLine);
3597
3649
  if (!writable) {
3598
3650
  body.appendChild(element(doc, "div", "hive-settings-note", translate("settings.readOnly")));
3599
3651
  }
3600
3652
 
3601
3653
  const roleSection = element(doc, "section", "hive-settings-section");
3602
- roleSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("settings.addRole")));
3603
3654
  const roleForm = element(doc, "div", "hive-field-row hive-settings-role-form");
3604
3655
  const roleNameField = element(doc, "label", "hive-field");
3605
3656
  roleNameField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleName")));
@@ -3656,7 +3707,12 @@ export function mount(root, options = {}) {
3656
3707
 
3657
3708
  const roleErrorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3658
3709
  roleSection.appendChild(roleErrorNode);
3659
- const addRoleButton = element(doc, "button", "hive-btn hive-settings-add-role", translate("settings.addRoleButton"));
3710
+ const addRoleButton = element(
3711
+ doc,
3712
+ "button",
3713
+ "hive-btn hive-settings-add-role hive-settings-secondary",
3714
+ translate("settings.addRoleButton"),
3715
+ );
3660
3716
  setAttr(addRoleButton, "type", "button");
3661
3717
  setAttr(addRoleButton, "title", translate("settings.addRoleAria"));
3662
3718
  setAttr(addRoleButton, "aria-label", translate("settings.addRoleAria"));
@@ -3664,16 +3720,16 @@ export function mount(root, options = {}) {
3664
3720
  addRoleButton.addEventListener("click", () => {
3665
3721
  void saveRole();
3666
3722
  });
3723
+ const roleActions = element(doc, "div", "hive-settings-form-actions hive-settings-role-actions");
3724
+ roleActions.appendChild(addRoleButton);
3725
+ roleSection.appendChild(roleActions);
3667
3726
  if (!writable) {
3668
3727
  roleNameInput.disabled = true;
3669
3728
  adapterInput.disabled = true;
3670
3729
  modelInput.disabled = true;
3671
3730
  roleDescriptionInput.disabled = true;
3672
3731
  }
3673
- body.appendChild(roleSection);
3674
-
3675
3732
  const limitsSection = element(doc, "section", "hive-settings-section");
3676
- limitsSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("limits.title")));
3677
3733
  limitsSection.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3678
3734
  const rowNodes = [];
3679
3735
  if (!supervisorAvailable) {
@@ -3714,18 +3770,12 @@ export function mount(root, options = {}) {
3714
3770
 
3715
3771
  const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3716
3772
  limitsSection.appendChild(errorNode);
3717
- body.appendChild(limitsSection);
3718
-
3719
- const queenSection = element(doc, "section", "hive-settings-section");
3720
- queenSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("help.queen")));
3721
- queenSection.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
3722
- body.appendChild(queenSection);
3723
- dialog.appendChild(body);
3724
-
3725
- const foot = element(doc, "div", "hive-dialog-foot");
3726
- const settingsActions = element(doc, "div", "hive-settings-actions");
3727
- addRoleButton.className = "hive-btn hive-settings-add-role hive-settings-secondary";
3728
- const saveButton = element(doc, "button", "hive-btn hive-settings-save hive-settings-primary", translate("settings.saveLimits"));
3773
+ const saveButton = element(
3774
+ doc,
3775
+ "button",
3776
+ "hive-btn hive-settings-save hive-settings-primary",
3777
+ translate("settings.saveLimits"),
3778
+ );
3729
3779
  setAttr(saveButton, "type", "button");
3730
3780
  setAttr(saveButton, "title", translate("limits.saveAria").replace("{repo}", repo));
3731
3781
  setAttr(saveButton, "aria-label", translate("limits.saveAria").replace("{repo}", repo));
@@ -3733,10 +3783,82 @@ export function mount(root, options = {}) {
3733
3783
  saveButton.addEventListener("click", () => {
3734
3784
  void saveBeeCounts();
3735
3785
  });
3736
- settingsActions.appendChild(addRoleButton);
3737
- settingsActions.appendChild(saveButton);
3738
- foot.appendChild(settingsActions);
3739
- dialog.appendChild(foot);
3786
+ const limitsActions = element(doc, "div", "hive-settings-form-actions hive-settings-limits-actions");
3787
+ limitsActions.appendChild(saveButton);
3788
+ limitsSection.appendChild(limitsActions);
3789
+
3790
+ const queenSection = element(doc, "section", "hive-settings-section");
3791
+ queenSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("help.queen")));
3792
+ queenSection.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
3793
+ const tabs = element(doc, "div", "hive-settings-tabs");
3794
+ setAttr(tabs, "role", "tablist");
3795
+ setAttr(tabs, "aria-label", translate("settings.tabsAria"));
3796
+ const panelWrap = element(doc, "div", "hive-settings-panels");
3797
+ const tabEntries = [
3798
+ { id: "limits", labelKey: "settings.tabLimits", section: limitsSection },
3799
+ { id: "role", labelKey: "settings.tabRole", section: roleSection },
3800
+ ];
3801
+ const tabNodes = new Map();
3802
+ const panelNodes = new Map();
3803
+
3804
+ function selectSettingsTab(name, focusTab) {
3805
+ const active = name === "role" ? "role" : "limits";
3806
+ settingsActiveTab = active;
3807
+ for (const entry of tabEntries) {
3808
+ const selected = entry.id === active;
3809
+ const tab = tabNodes.get(entry.id);
3810
+ const panel = panelNodes.get(entry.id);
3811
+ setAttr(tab, "aria-selected", selected ? "true" : "false");
3812
+ setAttr(tab, "tabindex", selected ? "0" : "-1");
3813
+ setHidden(panel, !selected);
3814
+ }
3815
+ if (focusTab) focusNode(tabNodes.get(active));
3816
+ }
3817
+
3818
+ function onSettingsTabKeydown(event, current) {
3819
+ if (!event) return;
3820
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight" && event.key !== "Home" && event.key !== "End") {
3821
+ return;
3822
+ }
3823
+ if (typeof event.preventDefault === "function") event.preventDefault();
3824
+ const index = tabEntries.findIndex((entry) => entry.id === current);
3825
+ let next = index;
3826
+ if (event.key === "ArrowLeft") next = index === 0 ? tabEntries.length - 1 : index - 1;
3827
+ else if (event.key === "ArrowRight") next = index === tabEntries.length - 1 ? 0 : index + 1;
3828
+ else if (event.key === "Home") next = 0;
3829
+ else if (event.key === "End") next = tabEntries.length - 1;
3830
+ selectSettingsTab(tabEntries[next].id, true);
3831
+ }
3832
+
3833
+ for (const entry of tabEntries) {
3834
+ const tabId = "hive-settings-tab-" + entry.id;
3835
+ const panelId = "hive-settings-panel-" + entry.id;
3836
+ const tab = element(doc, "button", "hive-settings-tab", translate(entry.labelKey));
3837
+ setAttr(tab, "type", "button");
3838
+ setAttr(tab, "role", "tab");
3839
+ setAttr(tab, "id", tabId);
3840
+ setAttr(tab, "aria-controls", panelId);
3841
+ setAttr(tab, "aria-selected", "false");
3842
+ setAttr(tab, "tabindex", "-1");
3843
+ tab.addEventListener("click", () => selectSettingsTab(entry.id, true));
3844
+ tab.addEventListener("keydown", (event) => onSettingsTabKeydown(event, entry.id));
3845
+ tabs.appendChild(tab);
3846
+ tabNodes.set(entry.id, tab);
3847
+
3848
+ const panel = element(doc, "div", "hive-settings-tabpanel");
3849
+ setAttr(panel, "role", "tabpanel");
3850
+ setAttr(panel, "id", panelId);
3851
+ setAttr(panel, "aria-labelledby", tabId);
3852
+ setHidden(panel, true);
3853
+ panel.appendChild(entry.section);
3854
+ panelWrap.appendChild(panel);
3855
+ panelNodes.set(entry.id, panel);
3856
+ }
3857
+ body.appendChild(tabs);
3858
+ body.appendChild(panelWrap);
3859
+ selectSettingsTab(settingsActiveTab, false);
3860
+ body.appendChild(queenSection);
3861
+ dialog.appendChild(body);
3740
3862
 
3741
3863
  overlay.appendChild(dialog);
3742
3864
  frame.appendChild(overlay);