@d86e/hive-panel 0.3.8 → 0.3.9
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.
- package/package.json +1 -1
- package/public/panel.js +164 -36
package/package.json
CHANGED
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:
|
|
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
|
-
|
|
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",
|
|
@@ -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": "角色名",
|
|
@@ -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"));
|
|
@@ -3599,7 +3657,6 @@ export function mount(root, options = {}) {
|
|
|
3599
3657
|
}
|
|
3600
3658
|
|
|
3601
3659
|
const roleSection = element(doc, "section", "hive-settings-section");
|
|
3602
|
-
roleSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("settings.addRole")));
|
|
3603
3660
|
const roleForm = element(doc, "div", "hive-field-row hive-settings-role-form");
|
|
3604
3661
|
const roleNameField = element(doc, "label", "hive-field");
|
|
3605
3662
|
roleNameField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleName")));
|
|
@@ -3656,7 +3713,12 @@ export function mount(root, options = {}) {
|
|
|
3656
3713
|
|
|
3657
3714
|
const roleErrorNode = element(doc, "div", "hive-limits-error is-hidden", "");
|
|
3658
3715
|
roleSection.appendChild(roleErrorNode);
|
|
3659
|
-
const addRoleButton = element(
|
|
3716
|
+
const addRoleButton = element(
|
|
3717
|
+
doc,
|
|
3718
|
+
"button",
|
|
3719
|
+
"hive-btn hive-settings-add-role hive-settings-secondary",
|
|
3720
|
+
translate("settings.addRoleButton"),
|
|
3721
|
+
);
|
|
3660
3722
|
setAttr(addRoleButton, "type", "button");
|
|
3661
3723
|
setAttr(addRoleButton, "title", translate("settings.addRoleAria"));
|
|
3662
3724
|
setAttr(addRoleButton, "aria-label", translate("settings.addRoleAria"));
|
|
@@ -3664,16 +3726,16 @@ export function mount(root, options = {}) {
|
|
|
3664
3726
|
addRoleButton.addEventListener("click", () => {
|
|
3665
3727
|
void saveRole();
|
|
3666
3728
|
});
|
|
3729
|
+
const roleActions = element(doc, "div", "hive-settings-form-actions hive-settings-role-actions");
|
|
3730
|
+
roleActions.appendChild(addRoleButton);
|
|
3731
|
+
roleSection.appendChild(roleActions);
|
|
3667
3732
|
if (!writable) {
|
|
3668
3733
|
roleNameInput.disabled = true;
|
|
3669
3734
|
adapterInput.disabled = true;
|
|
3670
3735
|
modelInput.disabled = true;
|
|
3671
3736
|
roleDescriptionInput.disabled = true;
|
|
3672
3737
|
}
|
|
3673
|
-
body.appendChild(roleSection);
|
|
3674
|
-
|
|
3675
3738
|
const limitsSection = element(doc, "section", "hive-settings-section");
|
|
3676
|
-
limitsSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("limits.title")));
|
|
3677
3739
|
limitsSection.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
|
|
3678
3740
|
const rowNodes = [];
|
|
3679
3741
|
if (!supervisorAvailable) {
|
|
@@ -3714,18 +3776,12 @@ export function mount(root, options = {}) {
|
|
|
3714
3776
|
|
|
3715
3777
|
const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
|
|
3716
3778
|
limitsSection.appendChild(errorNode);
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
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"));
|
|
3779
|
+
const saveButton = element(
|
|
3780
|
+
doc,
|
|
3781
|
+
"button",
|
|
3782
|
+
"hive-btn hive-settings-save hive-settings-primary",
|
|
3783
|
+
translate("settings.saveLimits"),
|
|
3784
|
+
);
|
|
3729
3785
|
setAttr(saveButton, "type", "button");
|
|
3730
3786
|
setAttr(saveButton, "title", translate("limits.saveAria").replace("{repo}", repo));
|
|
3731
3787
|
setAttr(saveButton, "aria-label", translate("limits.saveAria").replace("{repo}", repo));
|
|
@@ -3733,10 +3789,82 @@ export function mount(root, options = {}) {
|
|
|
3733
3789
|
saveButton.addEventListener("click", () => {
|
|
3734
3790
|
void saveBeeCounts();
|
|
3735
3791
|
});
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3792
|
+
const limitsActions = element(doc, "div", "hive-settings-form-actions hive-settings-limits-actions");
|
|
3793
|
+
limitsActions.appendChild(saveButton);
|
|
3794
|
+
limitsSection.appendChild(limitsActions);
|
|
3795
|
+
|
|
3796
|
+
const queenSection = element(doc, "section", "hive-settings-section");
|
|
3797
|
+
queenSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("help.queen")));
|
|
3798
|
+
queenSection.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
|
|
3799
|
+
const tabs = element(doc, "div", "hive-settings-tabs");
|
|
3800
|
+
setAttr(tabs, "role", "tablist");
|
|
3801
|
+
setAttr(tabs, "aria-label", translate("settings.tabsAria"));
|
|
3802
|
+
const panelWrap = element(doc, "div", "hive-settings-panels");
|
|
3803
|
+
const tabEntries = [
|
|
3804
|
+
{ id: "limits", labelKey: "settings.tabLimits", section: limitsSection },
|
|
3805
|
+
{ id: "role", labelKey: "settings.tabRole", section: roleSection },
|
|
3806
|
+
];
|
|
3807
|
+
const tabNodes = new Map();
|
|
3808
|
+
const panelNodes = new Map();
|
|
3809
|
+
|
|
3810
|
+
function selectSettingsTab(name, focusTab) {
|
|
3811
|
+
const active = name === "role" ? "role" : "limits";
|
|
3812
|
+
settingsActiveTab = active;
|
|
3813
|
+
for (const entry of tabEntries) {
|
|
3814
|
+
const selected = entry.id === active;
|
|
3815
|
+
const tab = tabNodes.get(entry.id);
|
|
3816
|
+
const panel = panelNodes.get(entry.id);
|
|
3817
|
+
setAttr(tab, "aria-selected", selected ? "true" : "false");
|
|
3818
|
+
setAttr(tab, "tabindex", selected ? "0" : "-1");
|
|
3819
|
+
setHidden(panel, !selected);
|
|
3820
|
+
}
|
|
3821
|
+
if (focusTab) focusNode(tabNodes.get(active));
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
function onSettingsTabKeydown(event, current) {
|
|
3825
|
+
if (!event) return;
|
|
3826
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight" && event.key !== "Home" && event.key !== "End") {
|
|
3827
|
+
return;
|
|
3828
|
+
}
|
|
3829
|
+
if (typeof event.preventDefault === "function") event.preventDefault();
|
|
3830
|
+
const index = tabEntries.findIndex((entry) => entry.id === current);
|
|
3831
|
+
let next = index;
|
|
3832
|
+
if (event.key === "ArrowLeft") next = index === 0 ? tabEntries.length - 1 : index - 1;
|
|
3833
|
+
else if (event.key === "ArrowRight") next = index === tabEntries.length - 1 ? 0 : index + 1;
|
|
3834
|
+
else if (event.key === "Home") next = 0;
|
|
3835
|
+
else if (event.key === "End") next = tabEntries.length - 1;
|
|
3836
|
+
selectSettingsTab(tabEntries[next].id, true);
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
for (const entry of tabEntries) {
|
|
3840
|
+
const tabId = "hive-settings-tab-" + entry.id;
|
|
3841
|
+
const panelId = "hive-settings-panel-" + entry.id;
|
|
3842
|
+
const tab = element(doc, "button", "hive-settings-tab", translate(entry.labelKey));
|
|
3843
|
+
setAttr(tab, "type", "button");
|
|
3844
|
+
setAttr(tab, "role", "tab");
|
|
3845
|
+
setAttr(tab, "id", tabId);
|
|
3846
|
+
setAttr(tab, "aria-controls", panelId);
|
|
3847
|
+
setAttr(tab, "aria-selected", "false");
|
|
3848
|
+
setAttr(tab, "tabindex", "-1");
|
|
3849
|
+
tab.addEventListener("click", () => selectSettingsTab(entry.id, true));
|
|
3850
|
+
tab.addEventListener("keydown", (event) => onSettingsTabKeydown(event, entry.id));
|
|
3851
|
+
tabs.appendChild(tab);
|
|
3852
|
+
tabNodes.set(entry.id, tab);
|
|
3853
|
+
|
|
3854
|
+
const panel = element(doc, "div", "hive-settings-tabpanel");
|
|
3855
|
+
setAttr(panel, "role", "tabpanel");
|
|
3856
|
+
setAttr(panel, "id", panelId);
|
|
3857
|
+
setAttr(panel, "aria-labelledby", tabId);
|
|
3858
|
+
setHidden(panel, true);
|
|
3859
|
+
panel.appendChild(entry.section);
|
|
3860
|
+
panelWrap.appendChild(panel);
|
|
3861
|
+
panelNodes.set(entry.id, panel);
|
|
3862
|
+
}
|
|
3863
|
+
body.appendChild(tabs);
|
|
3864
|
+
body.appendChild(panelWrap);
|
|
3865
|
+
selectSettingsTab(settingsActiveTab, false);
|
|
3866
|
+
body.appendChild(queenSection);
|
|
3867
|
+
dialog.appendChild(body);
|
|
3740
3868
|
|
|
3741
3869
|
overlay.appendChild(dialog);
|
|
3742
3870
|
frame.appendChild(overlay);
|