cladogram 0.5.5-beta.7 → 0.5.5-beta.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/bin/clado.js +33 -10
- package/docs/release.md +13 -0
- package/package.json +1 -1
- package/plugins/agent/index.js +1150 -47
- package/plugins/agent/style.css +252 -10
- package/plugins/brand/index.js +13 -1
- package/plugins/directory/index.js +43 -4
- package/plugins/directory/style.css +47 -0
- package/src/agent/commands.js +204 -0
- package/src/agent/context.js +18 -3
- package/src/agent/mcp-client.js +308 -0
- package/src/agent/providers/index.js +197 -14
- package/src/agent/runtime.js +50 -2
- package/src/agent/sessions.js +2 -0
- package/src/agent/skills.js +190 -0
- package/src/html/plugin-ui.css +95 -2
- package/src/server/agent.js +418 -32
- package/src/server/assets/library.js +281 -2
- package/src/server/plugin-settings.js +28 -2
- package/src/server/plugins.js +61 -9
- package/src/server/workspace-hub.js +250 -0
- package/src/server/workspace.js +129 -11
package/plugins/agent/style.css
CHANGED
|
@@ -84,20 +84,22 @@
|
|
|
84
84
|
color: var(--clado-ui-text);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
/* ============
|
|
87
|
+
/* ============ 右下角冰晶灵感坞(桌面右下悬浮,小屏自适应防溢出) ============ */
|
|
88
88
|
.clado-agent-dock {
|
|
89
|
-
width:
|
|
90
|
-
max-width:
|
|
89
|
+
width: min(468px, calc(100vw - 24px));
|
|
90
|
+
max-width: 100%;
|
|
91
91
|
display: flex;
|
|
92
92
|
flex-direction: column;
|
|
93
93
|
gap: 7px;
|
|
94
94
|
min-width: 0;
|
|
95
95
|
pointer-events: none;
|
|
96
96
|
box-sizing: border-box;
|
|
97
|
+
transform-origin: bottom right;
|
|
97
98
|
}
|
|
98
99
|
.clado-agent-dock *,
|
|
99
100
|
.clado-agent-overlay *,
|
|
100
|
-
.clado-agent-ctx-menu
|
|
101
|
+
.clado-agent-ctx-menu *,
|
|
102
|
+
.clado-model-menu * {
|
|
101
103
|
box-sizing: border-box;
|
|
102
104
|
}
|
|
103
105
|
.clado-agent-dock > * {
|
|
@@ -112,6 +114,7 @@
|
|
|
112
114
|
.clado-agent-dock .clado-cmd-approve-bar,
|
|
113
115
|
.clado-agent-dock .clado-single-panel,
|
|
114
116
|
.clado-agent-dock .clado-peer-pill,
|
|
117
|
+
.clado-agent-dock .clado-peer-add-btn,
|
|
115
118
|
.clado-agent-dock .clado-agent-shell {
|
|
116
119
|
transition:
|
|
117
120
|
opacity 260ms var(--clado-ease-spring),
|
|
@@ -128,18 +131,26 @@
|
|
|
128
131
|
.clado-agent-dock.minimized * {
|
|
129
132
|
pointer-events: none !important;
|
|
130
133
|
}
|
|
134
|
+
.clado-agent-dock.minimized .clado-single-wrap {
|
|
135
|
+
grid-template-rows: 0fr !important;
|
|
136
|
+
pointer-events: none !important;
|
|
137
|
+
}
|
|
131
138
|
.clado-agent-dock.minimized .clado-cmd-approve-bar,
|
|
132
139
|
.clado-agent-dock.minimized .clado-single-panel,
|
|
140
|
+
.clado-agent-dock.minimized .clado-single-wrap.open .clado-single-panel,
|
|
133
141
|
.clado-agent-dock.minimized .clado-peer-pill,
|
|
142
|
+
.clado-agent-dock.minimized .clado-peer-add-btn,
|
|
134
143
|
.clado-agent-dock.minimized .clado-agent-shell {
|
|
135
|
-
opacity: 0;
|
|
136
|
-
transform: translate3d(24px, 16px, 0) scale(0.86);
|
|
144
|
+
opacity: 0 !important;
|
|
145
|
+
transform: translate3d(24px, 16px, 0) scale(0.86) !important;
|
|
137
146
|
}
|
|
138
147
|
|
|
139
|
-
/*
|
|
148
|
+
/* 右下角收起态灵感悬浮球(绝对定位于右下角同槽位,展开态零高度占位) */
|
|
140
149
|
.clado-agent-orb-wrap {
|
|
141
|
-
position:
|
|
142
|
-
|
|
150
|
+
position: absolute;
|
|
151
|
+
right: 0;
|
|
152
|
+
bottom: 0;
|
|
153
|
+
z-index: 4;
|
|
143
154
|
pointer-events: none;
|
|
144
155
|
}
|
|
145
156
|
.clado-agent-orb {
|
|
@@ -1202,6 +1213,7 @@
|
|
|
1202
1213
|
max-width: 480px;
|
|
1203
1214
|
max-height: calc(100dvh - 76px);
|
|
1204
1215
|
overflow-y: auto;
|
|
1216
|
+
scrollbar-width: none;
|
|
1205
1217
|
-webkit-overflow-scrolling: touch;
|
|
1206
1218
|
touch-action: pan-y;
|
|
1207
1219
|
margin: 0 auto;
|
|
@@ -1214,6 +1226,7 @@
|
|
|
1214
1226
|
transform: translateY(10px) scale(0.985);
|
|
1215
1227
|
transition: opacity 250ms var(--clado-ease-spring), transform 280ms var(--clado-ease-spring);
|
|
1216
1228
|
}
|
|
1229
|
+
.clado-panel-container::-webkit-scrollbar { display: none; }
|
|
1217
1230
|
.clado-agent-overlay.show .clado-panel-container {
|
|
1218
1231
|
opacity: 1;
|
|
1219
1232
|
transform: translateY(0) scale(1);
|
|
@@ -1275,6 +1288,8 @@
|
|
|
1275
1288
|
left: 14px;
|
|
1276
1289
|
right: 14px;
|
|
1277
1290
|
top: 14px;
|
|
1291
|
+
max-height: 0;
|
|
1292
|
+
overflow: hidden;
|
|
1278
1293
|
}
|
|
1279
1294
|
.clado-cfg-sub-page {
|
|
1280
1295
|
display: flex;
|
|
@@ -1287,6 +1302,8 @@
|
|
|
1287
1302
|
left: 14px;
|
|
1288
1303
|
right: 14px;
|
|
1289
1304
|
top: 14px;
|
|
1305
|
+
max-height: 0;
|
|
1306
|
+
overflow: hidden;
|
|
1290
1307
|
transition: opacity 240ms var(--clado-ease-spring), transform 280ms var(--clado-ease-spring);
|
|
1291
1308
|
}
|
|
1292
1309
|
.clado-cfg-sub-page.active {
|
|
@@ -1297,6 +1314,8 @@
|
|
|
1297
1314
|
left: auto;
|
|
1298
1315
|
right: auto;
|
|
1299
1316
|
top: auto;
|
|
1317
|
+
max-height: none;
|
|
1318
|
+
overflow: visible;
|
|
1300
1319
|
}
|
|
1301
1320
|
|
|
1302
1321
|
.clado-switch-btn {
|
|
@@ -1376,7 +1395,11 @@
|
|
|
1376
1395
|
transform: translateY(0) scale(1);
|
|
1377
1396
|
}
|
|
1378
1397
|
|
|
1379
|
-
@media (max-width:
|
|
1398
|
+
@media (max-width: 760px) {
|
|
1399
|
+
.clado-agent-dock {
|
|
1400
|
+
width: 100%;
|
|
1401
|
+
max-width: calc(100vw - 20px);
|
|
1402
|
+
}
|
|
1380
1403
|
.clado-single-panel {
|
|
1381
1404
|
border-radius: 26px;
|
|
1382
1405
|
}
|
|
@@ -1387,3 +1410,222 @@
|
|
|
1387
1410
|
font-size: 16px;
|
|
1388
1411
|
}
|
|
1389
1412
|
}
|
|
1413
|
+
|
|
1414
|
+
/* 输入栏模型快切胶囊与弹窗 + 会话条尾端新建按钮 */
|
|
1415
|
+
.clado-model-chip {
|
|
1416
|
+
appearance: none;
|
|
1417
|
+
flex: 0 0 auto;
|
|
1418
|
+
height: 28px;
|
|
1419
|
+
max-width: 126px;
|
|
1420
|
+
padding: 0 9px;
|
|
1421
|
+
border-radius: 999px;
|
|
1422
|
+
border: 1px solid var(--clado-agent-well-border);
|
|
1423
|
+
background: var(--clado-agent-well);
|
|
1424
|
+
color: var(--clado-ui-text);
|
|
1425
|
+
font: inherit;
|
|
1426
|
+
font-size: 11.5px;
|
|
1427
|
+
font-weight: 580;
|
|
1428
|
+
cursor: pointer;
|
|
1429
|
+
display: inline-flex;
|
|
1430
|
+
align-items: center;
|
|
1431
|
+
gap: 4px;
|
|
1432
|
+
white-space: nowrap;
|
|
1433
|
+
transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease;
|
|
1434
|
+
}
|
|
1435
|
+
.clado-model-chip:hover {
|
|
1436
|
+
background: var(--clado-agent-hover);
|
|
1437
|
+
border-color: var(--clado-agent-outline);
|
|
1438
|
+
}
|
|
1439
|
+
.clado-model-chip:active { transform: scale(0.97); }
|
|
1440
|
+
.clado-model-chip.unconfigured {
|
|
1441
|
+
background: rgba(37, 99, 235, 0.12);
|
|
1442
|
+
border-color: rgba(37, 99, 235, 0.34);
|
|
1443
|
+
color: var(--clado-ui-brand);
|
|
1444
|
+
font-weight: 640;
|
|
1445
|
+
}
|
|
1446
|
+
.clado-model-chip-label {
|
|
1447
|
+
overflow: hidden;
|
|
1448
|
+
text-overflow: ellipsis;
|
|
1449
|
+
white-space: nowrap;
|
|
1450
|
+
}
|
|
1451
|
+
.clado-model-chip-caret {
|
|
1452
|
+
font-size: 10px;
|
|
1453
|
+
opacity: 0.65;
|
|
1454
|
+
flex: none;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
.clado-model-menu {
|
|
1458
|
+
position: fixed;
|
|
1459
|
+
z-index: 95;
|
|
1460
|
+
min-width: 210px;
|
|
1461
|
+
max-width: min(290px, calc(100vw - 20px));
|
|
1462
|
+
max-height: 320px;
|
|
1463
|
+
overflow-y: auto;
|
|
1464
|
+
padding: 6px;
|
|
1465
|
+
border-radius: 16px;
|
|
1466
|
+
display: flex;
|
|
1467
|
+
flex-direction: column;
|
|
1468
|
+
gap: 2px;
|
|
1469
|
+
background: var(--clado-agent-popover);
|
|
1470
|
+
backdrop-filter: blur(24px) saturate(190%);
|
|
1471
|
+
-webkit-backdrop-filter: blur(24px) saturate(190%);
|
|
1472
|
+
border: 1px solid var(--clado-agent-outline);
|
|
1473
|
+
box-shadow: var(--clado-agent-shadow);
|
|
1474
|
+
font: 12.5px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
|
|
1475
|
+
color: var(--clado-ui-text);
|
|
1476
|
+
opacity: 0;
|
|
1477
|
+
pointer-events: none;
|
|
1478
|
+
transform: translateY(6px) scale(0.95);
|
|
1479
|
+
transform-origin: bottom left;
|
|
1480
|
+
transition: opacity 160ms var(--clado-ease-spring), transform 180ms var(--clado-ease-spring);
|
|
1481
|
+
}
|
|
1482
|
+
.clado-model-menu.open {
|
|
1483
|
+
opacity: 1;
|
|
1484
|
+
pointer-events: auto;
|
|
1485
|
+
transform: translateY(0) scale(1);
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
.clado-peer-add-btn {
|
|
1489
|
+
appearance: none;
|
|
1490
|
+
flex: 0 0 auto;
|
|
1491
|
+
width: 29px;
|
|
1492
|
+
height: 29px;
|
|
1493
|
+
border-radius: 999px;
|
|
1494
|
+
border: 1px solid var(--clado-agent-outline);
|
|
1495
|
+
background: var(--clado-agent-surface);
|
|
1496
|
+
backdrop-filter: var(--clado-agent-filter);
|
|
1497
|
+
-webkit-backdrop-filter: var(--clado-agent-filter);
|
|
1498
|
+
box-shadow: var(--clado-agent-pill-shadow);
|
|
1499
|
+
color: var(--clado-ui-muted);
|
|
1500
|
+
font: inherit;
|
|
1501
|
+
font-size: 14px;
|
|
1502
|
+
font-weight: 600;
|
|
1503
|
+
cursor: pointer;
|
|
1504
|
+
display: inline-flex;
|
|
1505
|
+
align-items: center;
|
|
1506
|
+
justify-content: center;
|
|
1507
|
+
padding: 0;
|
|
1508
|
+
line-height: 1;
|
|
1509
|
+
}
|
|
1510
|
+
.clado-peer-add-btn:hover {
|
|
1511
|
+
color: var(--clado-ui-text);
|
|
1512
|
+
background: var(--clado-agent-hover);
|
|
1513
|
+
}
|
|
1514
|
+
.clado-peer-add-btn:active { transform: scale(0.93); }
|
|
1515
|
+
|
|
1516
|
+
.clado-clean-input {
|
|
1517
|
+
width: 100%;
|
|
1518
|
+
height: 35px;
|
|
1519
|
+
padding: 0 11px;
|
|
1520
|
+
border-radius: 10px;
|
|
1521
|
+
border: 1px solid var(--clado-agent-well-border);
|
|
1522
|
+
background: var(--clado-agent-well);
|
|
1523
|
+
color: var(--clado-ui-text);
|
|
1524
|
+
font: inherit;
|
|
1525
|
+
font-size: 12.5px;
|
|
1526
|
+
outline: none;
|
|
1527
|
+
}
|
|
1528
|
+
.clado-clean-input:focus {
|
|
1529
|
+
border-color: var(--clado-ui-brand);
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
/* `/` 斜杠命令自动补全浮层 + MCP/Skills/Commands 生态卡片 */
|
|
1533
|
+
.clado-slash-menu {
|
|
1534
|
+
position: fixed;
|
|
1535
|
+
z-index: 96;
|
|
1536
|
+
min-width: 240px;
|
|
1537
|
+
max-width: min(360px, calc(100vw - 20px));
|
|
1538
|
+
max-height: 260px;
|
|
1539
|
+
overflow-y: auto;
|
|
1540
|
+
padding: 6px;
|
|
1541
|
+
border-radius: 16px;
|
|
1542
|
+
display: flex;
|
|
1543
|
+
flex-direction: column;
|
|
1544
|
+
gap: 2px;
|
|
1545
|
+
background: var(--clado-agent-popover);
|
|
1546
|
+
backdrop-filter: blur(24px) saturate(190%);
|
|
1547
|
+
-webkit-backdrop-filter: blur(24px) saturate(190%);
|
|
1548
|
+
border: 1px solid var(--clado-agent-outline);
|
|
1549
|
+
box-shadow: var(--clado-agent-shadow);
|
|
1550
|
+
font: 12.5px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
|
|
1551
|
+
color: var(--clado-ui-text);
|
|
1552
|
+
opacity: 0;
|
|
1553
|
+
pointer-events: none;
|
|
1554
|
+
transform: translateY(6px) scale(0.96);
|
|
1555
|
+
transform-origin: bottom left;
|
|
1556
|
+
transition: opacity 150ms var(--clado-ease-spring), transform 170ms var(--clado-ease-spring);
|
|
1557
|
+
}
|
|
1558
|
+
.clado-slash-menu.open {
|
|
1559
|
+
opacity: 1;
|
|
1560
|
+
pointer-events: auto;
|
|
1561
|
+
transform: translateY(0) scale(1);
|
|
1562
|
+
}
|
|
1563
|
+
.clado-slash-item {
|
|
1564
|
+
appearance: none;
|
|
1565
|
+
border: 1px solid transparent;
|
|
1566
|
+
background: transparent;
|
|
1567
|
+
color: var(--clado-ui-text);
|
|
1568
|
+
font: inherit;
|
|
1569
|
+
padding: 7px 9px;
|
|
1570
|
+
border-radius: 10px;
|
|
1571
|
+
text-align: left;
|
|
1572
|
+
cursor: pointer;
|
|
1573
|
+
display: flex;
|
|
1574
|
+
flex-direction: column;
|
|
1575
|
+
gap: 2px;
|
|
1576
|
+
}
|
|
1577
|
+
.clado-slash-item:hover,
|
|
1578
|
+
.clado-slash-item.active {
|
|
1579
|
+
background: var(--clado-agent-active);
|
|
1580
|
+
border-color: var(--clado-agent-outline);
|
|
1581
|
+
}
|
|
1582
|
+
.clado-slash-item-head {
|
|
1583
|
+
display: flex;
|
|
1584
|
+
align-items: center;
|
|
1585
|
+
justify-content: space-between;
|
|
1586
|
+
gap: 8px;
|
|
1587
|
+
}
|
|
1588
|
+
.clado-slash-item-name {
|
|
1589
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
1590
|
+
font-weight: 650;
|
|
1591
|
+
color: var(--clado-ui-brand);
|
|
1592
|
+
}
|
|
1593
|
+
.clado-slash-item-scope {
|
|
1594
|
+
font-size: 10.5px;
|
|
1595
|
+
color: var(--clado-ui-subtle);
|
|
1596
|
+
}
|
|
1597
|
+
.clado-slash-item-desc {
|
|
1598
|
+
font-size: 11.5px;
|
|
1599
|
+
color: var(--clado-ui-muted);
|
|
1600
|
+
overflow: hidden;
|
|
1601
|
+
text-overflow: ellipsis;
|
|
1602
|
+
white-space: nowrap;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
.clado-eco-card {
|
|
1606
|
+
padding: 10px 11px;
|
|
1607
|
+
border-radius: 13px;
|
|
1608
|
+
border: 1px solid var(--clado-agent-well-border);
|
|
1609
|
+
background: var(--clado-agent-well);
|
|
1610
|
+
display: flex;
|
|
1611
|
+
flex-direction: column;
|
|
1612
|
+
gap: 6px;
|
|
1613
|
+
}
|
|
1614
|
+
.clado-eco-row {
|
|
1615
|
+
display: flex;
|
|
1616
|
+
align-items: center;
|
|
1617
|
+
justify-content: space-between;
|
|
1618
|
+
gap: 8px;
|
|
1619
|
+
}
|
|
1620
|
+
.clado-eco-badge {
|
|
1621
|
+
display: inline-flex;
|
|
1622
|
+
align-items: center;
|
|
1623
|
+
padding: 1px 7px;
|
|
1624
|
+
border-radius: 999px;
|
|
1625
|
+
font-size: 10.5px;
|
|
1626
|
+
font-weight: 600;
|
|
1627
|
+
background: rgba(37, 99, 235, 0.1);
|
|
1628
|
+
color: var(--clado-ui-brand);
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
|
package/plugins/brand/index.js
CHANGED
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
return { open, close };
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
function mountBrand(host, { setTheme, capture, plugins, market }) {
|
|
310
|
+
function mountBrand(host, { setTheme, capture, plugins, market, openWorkspacePicker }) {
|
|
311
311
|
const brand = document.createElement('div');
|
|
312
312
|
brand.className = 'clado-brand-plugin';
|
|
313
313
|
const brandLogo = '<svg viewBox="0 0 64 64" fill="none" aria-hidden="true">' +
|
|
@@ -345,6 +345,18 @@
|
|
|
345
345
|
panel.append(choice);
|
|
346
346
|
return { theme, choice };
|
|
347
347
|
});
|
|
348
|
+
if (openWorkspacePicker) {
|
|
349
|
+
const wsBtn = document.createElement('button');
|
|
350
|
+
wsBtn.type = 'button';
|
|
351
|
+
wsBtn.className = 'clado-ui-button clado-brand-choice clado-brand-capture';
|
|
352
|
+
wsBtn.dataset.openWorkspacePicker = 'true';
|
|
353
|
+
wsBtn.innerHTML = icon('<path d="M4 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"/>') + '<span>切换工作区…</span>';
|
|
354
|
+
wsBtn.onclick = () => {
|
|
355
|
+
setOpen(false);
|
|
356
|
+
openWorkspacePicker();
|
|
357
|
+
};
|
|
358
|
+
panel.append(wsBtn);
|
|
359
|
+
}
|
|
348
360
|
if (capture) {
|
|
349
361
|
const action = document.createElement('button');
|
|
350
362
|
action.type = 'button';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(() => {
|
|
2
|
-
function renderTree(container, documents, { selected='', query='', onOpen=()=>{}, folders=new Set() } = {}) {
|
|
2
|
+
function renderTree(container, documents, { selected='', query='', onOpen=()=>{}, onRename=null, onDelete=null, folders=new Set() } = {}) {
|
|
3
3
|
const needle=query.trim().toLocaleLowerCase(), root={folders:new Map(),files:[]};
|
|
4
4
|
for(const doc of documents) {
|
|
5
5
|
if(needle && !(doc.title+' '+doc.file).toLocaleLowerCase().includes(needle))continue;
|
|
@@ -15,9 +15,26 @@
|
|
|
15
15
|
const children=document.createElement('div');children.className='tree-children';details.append(children);render(folder,children);parent.append(details);
|
|
16
16
|
}
|
|
17
17
|
for(const doc of node.files) {
|
|
18
|
+
const row=document.createElement('div');row.className='document-row';
|
|
18
19
|
const button=document.createElement('button');button.className='clado-ui-button document-button';button.dataset.file=doc.file;if(doc.file===selected)button.setAttribute('aria-current','page');
|
|
19
20
|
const strong=document.createElement('strong');strong.textContent=doc.title;
|
|
20
|
-
const small=document.createElement('small');small.textContent=doc.file.split('/').pop();button.append(strong,small);button.onclick=()=>onOpen(doc.file);
|
|
21
|
+
const small=document.createElement('small');small.textContent=doc.file.split('/').pop();button.append(strong,small);button.onclick=()=>onOpen(doc.file);
|
|
22
|
+
row.append(button);
|
|
23
|
+
if (onRename || onDelete) {
|
|
24
|
+
const ops=document.createElement('span');ops.className='document-row-ops';
|
|
25
|
+
if (onRename) {
|
|
26
|
+
const ren=document.createElement('button');ren.type='button';ren.className='doc-op-btn';ren.title='重命名画布';ren.setAttribute('aria-label','重命名画布 '+doc.file);ren.textContent='✎';
|
|
27
|
+
ren.onclick=ev=>{ev.stopPropagation();onRename(doc);};
|
|
28
|
+
ops.append(ren);
|
|
29
|
+
}
|
|
30
|
+
if (onDelete) {
|
|
31
|
+
const del=document.createElement('button');del.type='button';del.className='doc-op-btn danger';del.title='删除画布';del.setAttribute('aria-label','删除画布 '+doc.file);del.textContent='×';
|
|
32
|
+
del.onclick=ev=>{ev.stopPropagation();onDelete(doc);};
|
|
33
|
+
ops.append(del);
|
|
34
|
+
}
|
|
35
|
+
row.append(ops);
|
|
36
|
+
}
|
|
37
|
+
parent.append(row);
|
|
21
38
|
}
|
|
22
39
|
}
|
|
23
40
|
render(root,container);
|
|
@@ -35,8 +52,12 @@
|
|
|
35
52
|
</button>
|
|
36
53
|
<aside id="directory" class="clado-ui-glass clado-ui-glass-panel" aria-label="Markdown 画布目录" hidden>
|
|
37
54
|
<div class="directory-scroll">
|
|
55
|
+
<div id="directoryHubBar" class="directory-actions" style="margin-bottom:6px;" hidden>
|
|
56
|
+
<button type="button" class="clado-ui-button" id="pickWorkspaceButton" title="选择或切换电脑上的项目目录">📂 切换项目</button>
|
|
57
|
+
<button type="button" class="clado-ui-button" id="newCanvasButton" title="在当前工作区新建一张 Markdown 画布">+ 新建画布</button>
|
|
58
|
+
</div>
|
|
38
59
|
<div id="workspaceSection" class="directory-workspaces" hidden>
|
|
39
|
-
<div class="directory-workspaces-title"
|
|
60
|
+
<div class="directory-workspaces-title">子工作区</div>
|
|
40
61
|
<div id="workspaceList" class="directory-workspace-list"></div>
|
|
41
62
|
</div>
|
|
42
63
|
<div class="directory-heading"><strong>Markdown/</strong></div>
|
|
@@ -82,7 +103,12 @@
|
|
|
82
103
|
$('#fileCount').textContent = index.documents.length;
|
|
83
104
|
$('.directory-heading strong').textContent = index.root || 'Markdown';
|
|
84
105
|
renderTree($('#documentList'), index.documents, {
|
|
85
|
-
selected,
|
|
106
|
+
selected,
|
|
107
|
+
query,
|
|
108
|
+
folders,
|
|
109
|
+
onOpen: file => { setOpen(false); actions.open(file); },
|
|
110
|
+
onRename: actions.renameCanvas ? doc => actions.renameCanvas(doc) : null,
|
|
111
|
+
onDelete: actions.deleteCanvas ? doc => actions.deleteCanvas(doc) : null,
|
|
86
112
|
});
|
|
87
113
|
$('#skippedButton').hidden = !index.skipped.length;
|
|
88
114
|
$('#skippedButton').textContent = index.skipped.length + ' 份文档未收录 · 查看原因';
|
|
@@ -146,6 +172,19 @@
|
|
|
146
172
|
document.addEventListener('keydown', event => {
|
|
147
173
|
if (event.key === 'Escape' && !directory.hidden && !dialog.open) { setOpen(false); trigger.focus(); }
|
|
148
174
|
});
|
|
175
|
+
if (actions.openWorkspacePicker || actions.createCanvas) {
|
|
176
|
+
$('#directoryHubBar').hidden = false;
|
|
177
|
+
$('#pickWorkspaceButton').hidden = !actions.openWorkspacePicker;
|
|
178
|
+
$('#newCanvasButton').hidden = !actions.createCanvas;
|
|
179
|
+
$('#pickWorkspaceButton').onclick = () => {
|
|
180
|
+
setOpen(false);
|
|
181
|
+
actions.openWorkspacePicker?.();
|
|
182
|
+
};
|
|
183
|
+
$('#newCanvasButton').onclick = () => {
|
|
184
|
+
setOpen(false);
|
|
185
|
+
actions.createCanvas?.();
|
|
186
|
+
};
|
|
187
|
+
}
|
|
149
188
|
$('#refreshButton').onclick = actions.refresh;
|
|
150
189
|
$('#backButton').onclick = actions.back;
|
|
151
190
|
$('#closeDetails').onclick = () => dialog.close();
|
|
@@ -164,3 +164,50 @@
|
|
|
164
164
|
border-radius: 24px;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
+
|
|
168
|
+
.document-row {
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
gap: 2px;
|
|
172
|
+
position: relative;
|
|
173
|
+
}
|
|
174
|
+
.document-row > .document-button {
|
|
175
|
+
flex: 1 1 auto;
|
|
176
|
+
min-width: 0;
|
|
177
|
+
}
|
|
178
|
+
.document-row-ops {
|
|
179
|
+
display: inline-flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
gap: 2px;
|
|
182
|
+
flex: 0 0 auto;
|
|
183
|
+
opacity: 0.42;
|
|
184
|
+
transition: opacity 140ms ease;
|
|
185
|
+
}
|
|
186
|
+
.document-row:hover .document-row-ops,
|
|
187
|
+
.document-row:focus-within .document-row-ops {
|
|
188
|
+
opacity: 1;
|
|
189
|
+
}
|
|
190
|
+
.doc-op-btn {
|
|
191
|
+
appearance: none;
|
|
192
|
+
border: 0;
|
|
193
|
+
background: transparent;
|
|
194
|
+
color: var(--clado-ui-muted);
|
|
195
|
+
width: 24px;
|
|
196
|
+
height: 24px;
|
|
197
|
+
border-radius: 7px;
|
|
198
|
+
font: inherit;
|
|
199
|
+
font-size: 12px;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
display: inline-flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
}
|
|
205
|
+
.doc-op-btn:hover {
|
|
206
|
+
background: var(--clado-ui-hover);
|
|
207
|
+
color: var(--clado-ui-text);
|
|
208
|
+
}
|
|
209
|
+
.doc-op-btn.danger:hover {
|
|
210
|
+
color: #e11d48;
|
|
211
|
+
background: rgba(225, 29, 72, 0.1);
|
|
212
|
+
}
|
|
213
|
+
|