dsh-workbench-host 0.6.5 → 0.8.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.
- package/README.md +1 -1
- package/client/client.js +1039 -21
- package/lib/actions/action-render.js +102 -0
- package/lib/actions/actions.js +226 -117
- package/lib/actions/agent-access.js +84 -0
- package/lib/actions/builtin-actions.js +64 -0
- package/lib/actions/capabilities.js +10 -5
- package/lib/index.js +77 -4
- package/lib/infra/audit.js +2 -2
- package/lib/infra/backup.js +29 -10
- package/lib/infra/network.js +76 -3
- package/lib/infra/search.js +83 -0
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -74,7 +74,13 @@ var require_locale = __commonJS({
|
|
|
74
74
|
open: "\u6253\u5F00",
|
|
75
75
|
manage: "\u5DE5\u4F5C\u53F0\u7BA1\u7406",
|
|
76
76
|
home_hint: "\u70B9\u5F00\u5361\u7247\u8FDB\u5165\u4E1A\u52A1\u63D2\u4EF6\uFF1B\u5B89\u88C5\u4E0E\u5378\u8F7D\u5728 DSH \u63D2\u4EF6\u7BA1\u7406\u91CC",
|
|
77
|
+
search_placeholder: "\u641C\u7D22\u4EFB\u52A1\u3001\u6807\u7B7E\u3001\u7AD9\u70B9\u3001\u8FDE\u63A5\u5668\u5185\u5BB9\u2026\uFF08\u2318K\uFF09",
|
|
78
|
+
searching: "\u641C\u7D22\u4E2D\u2026",
|
|
79
|
+
search_none: "\u6CA1\u6709\u547D\u4E2D",
|
|
80
|
+
search_partial: "\u90E8\u5206\u57DF\u641C\u7D22\u5931\u8D25",
|
|
77
81
|
account_desc: "\u767B\u5F55\u4E91\u7AEF\u8D26\u53F7\uFF0C\u5907\u4EFD\u4E0E\u540C\u6B65\u6570\u636E",
|
|
82
|
+
tab_agent: "Agent \u6743\u9650",
|
|
83
|
+
agent_desc: "\u9010\u4E2A action \u63A7\u5236 agent \u80FD\u5426\u8C03\u7528\uFF1B\u5F00\u5173\u53EA\u5B58\u672C\u673A\u3001\u7ACB\u5373\u751F\u6548\uFF0C\u754C\u9762\u64CD\u4F5C\u4E0E\u6570\u636E\u540C\u6B65\u90FD\u4E0D\u53D7\u5F71\u54CD",
|
|
78
84
|
tab_audit: "\u5BA1\u8BA1\u65E5\u5FD7",
|
|
79
85
|
audit_desc: "\u672C\u673A\u884C\u4E3A\u8D26\u672C\uFF1A\u8C01\u5728\u4F55\u65F6\u8C03\u7528\u4E86\u54EA\u4E2A action\u3001\u6210\u529F\u4E0E\u5426\uFF1B\u5BC6\u7801\u4E0E token \u7B49\u53C2\u6570\u5DF2\u8131\u654F",
|
|
80
86
|
audit_filters: "\u7B5B\u9009",
|
|
@@ -242,7 +248,13 @@ var require_locale = __commonJS({
|
|
|
242
248
|
open: "Open",
|
|
243
249
|
manage: "Manage",
|
|
244
250
|
home_hint: "Open a card to enter a domain; install or remove plugins in DSH",
|
|
251
|
+
search_placeholder: "Search tasks, tags, sites, connector items\u2026 (\u2318K)",
|
|
252
|
+
searching: "Searching\u2026",
|
|
253
|
+
search_none: "No matches",
|
|
254
|
+
search_partial: "Some domains failed",
|
|
245
255
|
account_desc: "Sign in to back up and sync your data",
|
|
256
|
+
tab_agent: "Agent access",
|
|
257
|
+
agent_desc: "Choose which actions the agent may call; switches stay on this machine, apply immediately, and never affect UI usage or sync",
|
|
246
258
|
tab_audit: "Audit log",
|
|
247
259
|
audit_desc: "A local ledger of who called which action and how it went; passwords and tokens are redacted",
|
|
248
260
|
audit_filters: "Filters",
|
|
@@ -433,13 +445,23 @@ var require_styles = __commonJS({
|
|
|
433
445
|
".wb-page-tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid var(--wb-line)}",
|
|
434
446
|
".wb-page-loading{display:flex;flex-direction:column;gap:8px;align-items:flex-start}",
|
|
435
447
|
".wb-grow{flex:1;min-width:0}",
|
|
436
|
-
|
|
437
|
-
|
|
448
|
+
// 全屏页铺满整个窗口(inset:0),但根节点必须声明 -webkit-app-region:no-drag:
|
|
449
|
+
// macOS 的宿主 chrome 把顶部条带标成 drag 区,Electron 按图层几何计算拖拽区,
|
|
450
|
+
// 覆盖在 drag 区上的元素若不声明 no-drag,点击会被当成拖窗口,
|
|
451
|
+
// 「返回首页」按钮就永远收不到 click。工具栏空白段再恢复 drag(按钮另有 no-drag 规则)。
|
|
452
|
+
".wb-immersive{position:fixed;inset:0;z-index:700;height:100vh;box-sizing:border-box;padding:0;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1,#faf7ea));backdrop-filter:saturate(1.05) blur(10px);overflow:hidden;-webkit-app-region:no-drag}",
|
|
453
|
+
".wb-immersive-bar{position:relative;display:flex;align-items:center;gap:10px;padding:calc(9px + var(--dsh-frame-top-clearance,0px)) 22px 9px;border-bottom:1px solid var(--wb-line);flex:none;background:transparent;-webkit-app-region:no-drag}",
|
|
454
|
+
".wb-immersive-bar .wb-immersive-title{cursor:default;user-select:none}",
|
|
455
|
+
".wb-immersive-bar button,.wb-immersive-bar a,.wb-immersive-bar input,.wb-immersive-bar select,.wb-immersive-bar textarea,.wb-immersive-bar [role=button]{-webkit-app-region:no-drag}",
|
|
438
456
|
".wb-immersive-title{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:600;opacity:.85}",
|
|
439
457
|
".wb-immersive-title .wb-home-icon{width:24px;height:24px;border-radius:7px;font-size:12px}",
|
|
440
458
|
".wb-immersive-main{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:18px 24px 24px}",
|
|
441
459
|
".wb-immersive-main>.wb-inner{max-width:none}",
|
|
442
|
-
|
|
460
|
+
// .wb-fill:页面根节点声明“我自己管滚动,请把整块可用高度给我”(三栏/双栏工作区这类应用式布局用)
|
|
461
|
+
".wb-immersive-main:has(.wb-fill)>.wb-inner{height:100%}",
|
|
462
|
+
".wb-inner>div:has(>.wb-fill){display:flex;flex-direction:column;height:100%;min-height:0}",
|
|
463
|
+
".wb-fill{flex:1 1 auto;min-height:0}",
|
|
464
|
+
"@media (max-width:760px){.wb-root{padding:16px}.wb-home-grid{grid-template-columns:1fr}.wb-page-title h2{font-size:17px}.wb-immersive-bar{padding:calc(8px + var(--dsh-frame-top-clearance,0px)) 14px 8px}.wb-immersive-main{padding:14px 16px 20px}.wb-immersive-title span:not(.wb-home-icon):not(.wb-badge){display:none}}",
|
|
443
465
|
".wb-backup{display:flex;flex-direction:column;gap:14px}",
|
|
444
466
|
".wb-backup-item{display:flex;flex-direction:column}",
|
|
445
467
|
".wb-backup-row{display:flex;align-items:flex-start;gap:10px;padding:11px 13px;border:1px solid var(--wb-line);border-radius:10px;background:var(--wb-surface)}",
|
|
@@ -502,12 +524,869 @@ var require_styles = __commonJS({
|
|
|
502
524
|
".wb-record-pill.err{opacity:1;border-color:var(--dsw-alias-state-error-primary,#e5484d);color:var(--dsw-alias-state-error-primary,#e5484d)}",
|
|
503
525
|
".wb-record-pill.err .wb-record-dot{background:currentColor;opacity:1}",
|
|
504
526
|
".wb-record-dot{width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.5;flex:none}",
|
|
505
|
-
".wb-record-pill.on .wb-record-dot{background:var(--dsw-alias-brand-primary,#11a89b);opacity:1;box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 18%,transparent)}"
|
|
527
|
+
".wb-record-pill.on .wb-record-dot{background:var(--dsw-alias-brand-primary,#11a89b);opacity:1;box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 18%,transparent)}",
|
|
528
|
+
".wb-search-wrap{position:relative;display:flex;flex-direction:column;gap:6px}",
|
|
529
|
+
".wb-search-bar{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--wb-line);border-radius:10px;background:var(--wb-surface)}",
|
|
530
|
+
".wb-search-bar:focus-within{border-color:var(--dsw-alias-brand-primary,#11a89b)}",
|
|
531
|
+
".wb-search-icon{opacity:.55;font-size:15px;line-height:1}",
|
|
532
|
+
".wb-search-input{flex:1;min-width:0;border:0;background:transparent;color:inherit;font:inherit;font-size:13px;outline:none}",
|
|
533
|
+
".wb-search-kbd{font-size:11px;opacity:.5;border:1px solid var(--wb-line);border-radius:5px;padding:1px 5px}",
|
|
534
|
+
".wb-search-panel{position:absolute;top:100%;left:0;right:0;z-index:40;margin-top:6px;max-height:340px;overflow:auto;border:1px solid var(--wb-line);border-radius:10px;background:var(--dsw-alias-bg-layer-1,var(--wb-surface));box-shadow:0 12px 32px rgba(0,0,0,.18);padding:6px}",
|
|
535
|
+
".wb-search-hit{display:flex;gap:10px;align-items:flex-start;width:100%;text-align:left;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;font-size:12px;padding:7px 8px;cursor:pointer}",
|
|
536
|
+
".wb-search-hit:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
|
|
537
|
+
".wb-search-domain{flex:none;min-width:52px;font-size:11px;opacity:.6;padding-top:2px}",
|
|
538
|
+
".wb-search-hit-main{display:flex;flex-direction:column;gap:2px;min-width:0}",
|
|
539
|
+
".wb-search-hit-title{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
540
|
+
".wb-search-hit-snippet{opacity:.65;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}",
|
|
541
|
+
".wb-search-empty{padding:12px;font-size:12px;opacity:.65;text-align:center}",
|
|
542
|
+
// ── 统一 UI 设计系统:所有业务插件共享的 token 与基础件 ──
|
|
543
|
+
// 插件各自写过 --wb-border/--wb-accent 等变量但没有宿主兜底,导致大量 #2563eb、#fff 硬编码在深色模式下失效。
|
|
544
|
+
".wb-root{--wb-border:var(--wb-line);--wb-card:var(--dsw-alias-bg-layer-1,var(--dsw-alias-bg-layer-2,#fff));--wb-surface:var(--dsw-alias-bg-layer-1,var(--dsw-alias-bg-layer-2,#fff));--wb-accent:var(--dsw-alias-brand-primary,#11a89b);--wb-muted:var(--dsw-alias-label-secondary,color-mix(in oklab,currentColor 58%,transparent));--wb-ok:var(--dsw-alias-state-success-primary,#18a058);--wb-warn:var(--dsw-alias-state-warn-primary,var(--dsw-alias-state-warning-primary,#d48806));--wb-danger:var(--dsw-alias-state-error-primary,#e5484d);--wb-radius-card:14px;--wb-space-md:14px}",
|
|
545
|
+
".wb-root *{scrollbar-width:thin;scrollbar-color:color-mix(in oklab,currentColor 22%,transparent) transparent}",
|
|
546
|
+
".wb-root ::-webkit-scrollbar{width:10px;height:10px}.wb-root ::-webkit-scrollbar-thumb{background:color-mix(in oklab,currentColor 18%,transparent);border-radius:999px;border:2px solid transparent;background-clip:padding-box}",
|
|
547
|
+
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbml-wrap,.wbm-page,.wbml-page){width:100%;max-width:none;margin:0;padding:0;gap:16px;box-sizing:border-box}",
|
|
548
|
+
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbml-wrap,.wbm-page,.wbml-page) h2{font-size:20px;line-height:1.3;font-weight:680;letter-spacing:-.02em;margin:0}",
|
|
549
|
+
".wb-root :is(.wbc-sub,.wba-sub,.wbct-sub,.wbca-sub,.wbm-sub,.wbml-sub,.wbv-muted,.wbct-muted,.wbc-muted,.wba-muted,.wbca-muted,.wbm-muted,.wbml-muted){font-size:12.5px;line-height:1.55;color:var(--wb-muted)}",
|
|
550
|
+
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbml-wrap,.wbm-page,.wbml-page) > :is(.wbc-head,.wba-head,.wbct-head,.wbca-head,.wbm-head,.wbml-head){padding-bottom:12px;border-bottom:1px solid var(--wb-border);align-items:flex-start}",
|
|
551
|
+
".wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-card,.wbml-card,.wbct-panel){background:var(--wb-card);border:1px solid var(--wb-border);border-radius:var(--wb-radius-card);padding:16px;box-shadow:0 1px 2px color-mix(in oklab,#000 4%,transparent);transition:border-color .15s ease,box-shadow .15s ease}",
|
|
552
|
+
".wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-card,.wbml-card):hover{border-color:color-mix(in oklab,var(--wb-accent) 32%,var(--wb-border));box-shadow:0 2px 14px color-mix(in oklab,#000 6%,transparent)}",
|
|
553
|
+
".wb-root :is(.wbc-grid,.wbv-grid,.wba-grid,.wbct-grid,.wbca-grid,.wbm-grid,.wbml-grid){gap:12px}",
|
|
554
|
+
".wb-root :is(.wbc-kpi,.wbv-kpi,.wba-kpi,.wbct-kpi,.wbca-kpi,.wbm-kpi,.wbml-kpi){font-size:26px;line-height:1.15;font-weight:680;letter-spacing:-.03em;font-variant-numeric:tabular-nums}",
|
|
555
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn){min-height:32px;padding:0 12px;border-radius:8px;border:1px solid var(--wb-border);background:var(--wb-card);color:inherit;font:inherit;font-size:12.5px;font-weight:500;line-height:1;display:inline-flex;align-items:center;justify-content:center;gap:5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease,transform .12s ease}",
|
|
556
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn):hover:not(:disabled){background:color-mix(in oklab,var(--wb-accent) 8%,var(--wb-card));border-color:color-mix(in oklab,var(--wb-accent) 45%,var(--wb-border))}",
|
|
557
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn):active:not(:disabled){transform:translateY(1px)}",
|
|
558
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn):disabled{opacity:.45;cursor:not-allowed}",
|
|
559
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn):is(.primary,.on){background:var(--wb-accent);border-color:var(--wb-accent);color:var(--dsw-alias-label-primary-inverted,#fff);font-weight:600}",
|
|
560
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn).primary:hover:not(:disabled){filter:brightness(1.06)}",
|
|
561
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn):is(.danger){color:var(--wb-danger);border-color:color-mix(in oklab,var(--wb-danger) 40%,transparent);background:transparent}",
|
|
562
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn).danger:hover:not(:disabled){background:color-mix(in oklab,var(--wb-danger) 8%,var(--wb-card));border-color:var(--wb-danger)}",
|
|
563
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn,.wbml-btn):focus-visible,.wb-root :is(.wbc-input,.wbv input,.wbc-field input,.wbc-field select,.wbc-field textarea,.wba-field input,.wba-field select,.wba-field textarea,.wbct-input,.wbct-field input,.wbca-input,.wbca-field input,.wbm-input,.wbml-input,.wbm-field input,.wbm-field select,.wbm-field textarea):focus-visible{outline:2px solid color-mix(in oklab,var(--wb-accent) 55%,transparent);outline-offset:2px}",
|
|
564
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field,.wbml-field){gap:6px;font-size:12px}",
|
|
565
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field,.wbml-field) > :is(.wbc-label,.wbv-label,.wba-label,.wbct-label,.wbca-label,.wbm-label,.wbml-label){font-size:11.5px;font-weight:600;letter-spacing:.02em;color:var(--wb-muted);opacity:1}",
|
|
566
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field,.wbml-field) :is(input,select,textarea),.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input,.wbml-input){min-height:34px;padding:7px 10px;border:1px solid var(--wb-border);border-radius:8px;background:color-mix(in oklab,var(--wb-card) 92%,transparent);color:inherit;font:inherit;font-size:12.5px;box-sizing:border-box;transition:border-color .12s ease,box-shadow .12s ease}",
|
|
567
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field,.wbml-field) :is(input,select,textarea):hover,.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input,.wbml-input):hover{border-color:color-mix(in oklab,currentColor 26%,var(--wb-border))}",
|
|
568
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field,.wbml-field) :is(input,select,textarea):focus,.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input,.wbml-input):focus{border-color:var(--wb-accent);box-shadow:0 0 0 3px color-mix(in oklab,var(--wb-accent) 14%,transparent);outline:none}",
|
|
569
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table,.wbml-table){width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px}",
|
|
570
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table,.wbml-table) th{text-align:left;font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--wb-muted);padding:9px 10px;border-bottom:1px solid var(--wb-border);white-space:nowrap;background:color-mix(in oklab,currentColor 3%,transparent)}",
|
|
571
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table,.wbml-table) td{padding:10px;border-bottom:1px solid color-mix(in oklab,var(--wb-border) 70%,transparent);vertical-align:top}",
|
|
572
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table,.wbml-table) tbody tr{transition:background .12s ease}",
|
|
573
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table,.wbml-table) tbody tr:hover{background:color-mix(in oklab,var(--wb-accent) 4%,transparent)}",
|
|
574
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill,.wbml-pill){display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;border:1px solid var(--wb-border);background:color-mix(in oklab,currentColor 5%,transparent);color:inherit;font-size:11px;font-weight:500;line-height:1.5;white-space:nowrap}",
|
|
575
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill,.wbml-pill).ok{color:var(--wb-ok);border-color:color-mix(in oklab,var(--wb-ok) 35%,transparent);background:color-mix(in oklab,var(--wb-ok) 10%,transparent)}",
|
|
576
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill,.wbml-pill).warn{color:var(--wb-warn);border-color:color-mix(in oklab,var(--wb-warn) 35%,transparent);background:color-mix(in oklab,var(--wb-warn) 10%,transparent)}",
|
|
577
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill,.wbml-pill):is(.error,.bad){color:var(--wb-danger);border-color:color-mix(in oklab,var(--wb-danger) 35%,transparent);background:color-mix(in oklab,var(--wb-danger) 10%,transparent)}",
|
|
578
|
+
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-notice,.wbml-notice){padding:10px 12px;border:1px solid color-mix(in oklab,var(--wb-accent) 24%,var(--wb-border));border-left:3px solid var(--wb-accent);border-radius:8px;background:color-mix(in oklab,var(--wb-accent) 6%,var(--wb-card));color:inherit;font-size:12.5px;line-height:1.55}",
|
|
579
|
+
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-notice,.wbml-notice).error{border-color:color-mix(in oklab,var(--wb-danger) 30%,var(--wb-border));border-left-color:var(--wb-danger);background:color-mix(in oklab,var(--wb-danger) 7%,var(--wb-card))}",
|
|
580
|
+
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-notice,.wbml-notice).ok{border-color:color-mix(in oklab,var(--wb-ok) 30%,var(--wb-border));border-left-color:var(--wb-ok);background:color-mix(in oklab,var(--wb-ok) 7%,var(--wb-card))}",
|
|
581
|
+
".wb-root :is(.wbc-empty,.wbv-empty,.wba-empty,.wbct-empty,.wbca-empty,.wbm-empty,.wbml-empty){padding:42px 20px;border:1px dashed var(--wb-border);border-radius:var(--wb-radius-card);background:color-mix(in oklab,currentColor 2%,transparent);color:var(--wb-muted);font-size:12.5px;line-height:1.6}",
|
|
582
|
+
".wb-root :is(.wbc-json,.wbv-code,.wba-json,.wbct-json,.wbca-json,.wbm-json,.wbml-json){margin:0;padding:12px;border:1px solid var(--wb-border);border-radius:10px;background:color-mix(in oklab,currentColor 4%,transparent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:1.6;max-height:260px;overflow:auto}",
|
|
583
|
+
".wb-root :is(.wbc-table-wrap,.wba-table-wrap,.wbct-table-wrap,.wbca-table-wrap,.wbm-table-wrap,.wbml-table-wrap){overflow:auto;border:1px solid var(--wb-border);border-radius:var(--wb-radius-card);background:var(--wb-card)}",
|
|
584
|
+
".wb-root :is(.wbc-table-wrap,.wba-table-wrap,.wbct-table-wrap,.wbca-table-wrap,.wbm-table-wrap,.wbml-table-wrap) :is(.wbc-table,.wba-table,.wbct-table,.wbca-table,.wbm-table,.wbml-table){border:0}",
|
|
585
|
+
".wb-root .wba-pills{display:flex;flex-wrap:wrap;gap:6px}",
|
|
586
|
+
".wb-root .wba-list{display:flex;flex-direction:column;gap:8px}",
|
|
587
|
+
".wb-root .wba-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
588
|
+
".wb-root .wba-kv{display:grid;grid-template-columns:minmax(96px,auto) minmax(0,1fr);gap:6px 12px;font-size:12px}",
|
|
589
|
+
".wb-root .wba-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px}",
|
|
590
|
+
".wb-root .wba-card-num{font-size:22px;font-weight:700;font-variant-numeric:tabular-nums}",
|
|
591
|
+
".wb-root .wbct-list{display:flex;flex-direction:column;gap:8px}",
|
|
592
|
+
".wb-root .wb-home-icon svg{display:block}",
|
|
593
|
+
".wb-root :is(.wba-panel,.wbca-panel,.wbm-panel,.wbml-panel,.wbc-panel){margin-top:4px;padding:18px;border:1px solid color-mix(in oklab,var(--wb-accent) 28%,var(--wb-border));border-radius:var(--wb-radius-card);background:var(--wb-card);box-shadow:0 10px 36px color-mix(in oklab,#000 8%,transparent)}",
|
|
594
|
+
".wb-root :is(.wba-panel,.wbca-panel,.wbm-panel,.wbml-panel,.wbc-panel) > h3{font-size:15px;font-weight:650;margin:0 0 12px}",
|
|
595
|
+
".wb-root :is(.wba-code,.wbca-code,.wbm-code,.wbml-code,.wbc-code){font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.65;resize:vertical;min-height:90px}",
|
|
596
|
+
".wb-root :is(.wba-input,.wbca-input,.wbm-input,.wbml-input,.wbc-input){min-height:34px}",
|
|
597
|
+
".wb-root .wbct-panel{margin-top:2px;border-color:color-mix(in oklab,var(--wb-accent) 30%,var(--wb-border))}",
|
|
598
|
+
".wb-root .wbct-pills{display:flex;flex-wrap:wrap;gap:8px 16px;padding:4px 0}",
|
|
599
|
+
".wb-root .wbct-check{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;cursor:pointer}",
|
|
600
|
+
".wb-root .wbct-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.6;resize:vertical}",
|
|
601
|
+
".wb-root .wbm-list-row{transition:background .12s ease}.wb-root .wbm-list-row:hover{background:color-mix(in oklab,var(--wb-accent) 5%,transparent)}",
|
|
602
|
+
".wb-root .wbm-body{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:13px;line-height:1.75;margin:10px 0 0;max-height:60vh;overflow:auto}",
|
|
603
|
+
".wb-root .wbv-notice{color:inherit}.wb-root .wbv-pill{background:color-mix(in oklab,currentColor 5%,transparent);color:inherit}",
|
|
604
|
+
".wb-root .wbv-pill.ok{background:color-mix(in oklab,var(--wb-ok) 10%,transparent);color:var(--wb-ok)}",
|
|
605
|
+
".wb-root .wbv-pill.warn{background:color-mix(in oklab,var(--wb-warn) 10%,transparent);color:var(--wb-warn)}",
|
|
606
|
+
".wb-root .wbv-pill.bad{background:color-mix(in oklab,var(--wb-danger) 10%,transparent);color:var(--wb-danger)}",
|
|
607
|
+
".wb-root .wbc-wrap>.wbc-head,.wb-root .wba-wrap>.wba-head,.wb-root .wbct-wrap>.wbct-head,.wb-root .wbca-wrap>.wbca-head,.wb-root .wbm-page>.wbm-head{margin-bottom:0}",
|
|
608
|
+
".wb-root :is(.wbc-row,.wba-row,.wbct-row,.wbca-row,.wbm-row,.wbml-row){gap:8px}",
|
|
609
|
+
// 首页与导航视觉
|
|
610
|
+
".wb-root .wb-inner{gap:18px;max-width:1120px}",
|
|
611
|
+
".wb-root .wb-hero{padding:6px 2px 2px;align-items:center}",
|
|
612
|
+
".wb-root .wb-hero h2{font-size:24px;font-weight:700;letter-spacing:-.02em}",
|
|
613
|
+
".wb-root .wb-tag{font-size:12.5px;opacity:.58;margin-top:6px}",
|
|
614
|
+
".wb-root .wb-home-grid{grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:14px}",
|
|
615
|
+
".wb-root .wb-home-card{position:relative;min-height:142px;padding:18px;border-radius:16px;background:var(--wb-card);box-shadow:0 1px 2px color-mix(in oklab,#000 3%,transparent);transition:transform .14s ease,border-color .14s ease,box-shadow .14s ease}",
|
|
616
|
+
".wb-root .wb-home-card:hover{transform:translateY(-2px);border-color:color-mix(in oklab,var(--wb-accent) 50%,var(--wb-border));box-shadow:0 10px 28px color-mix(in oklab,#000 10%,transparent)}",
|
|
617
|
+
".wb-root .wb-home-card .wb-home-icon{background:color-mix(in oklab,var(--wb-accent) 7%,var(--wb-card));border-color:color-mix(in oklab,var(--wb-accent) 12%,var(--wb-border))}",
|
|
618
|
+
".wb-root .wb-home-icon{width:38px;height:38px;border-radius:11px;background:color-mix(in oklab,var(--wb-accent) 13%,transparent);color:var(--wb-accent);font-size:16px;font-weight:700;box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--wb-accent) 16%,transparent)}",
|
|
619
|
+
".wb-root .wb-home-title{font-size:15px;font-weight:660;margin-top:8px}",
|
|
620
|
+
".wb-root .wb-home-desc{font-size:12px;line-height:1.55;opacity:.62;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;min-height:56px}",
|
|
621
|
+
".wb-root .wb-home-card .wb-badge{background:color-mix(in oklab,currentColor 5%,transparent);border:1px solid color-mix(in oklab,currentColor 8%,transparent);opacity:.72;font-variant-numeric:tabular-nums}",
|
|
622
|
+
".wb-root .wb-home-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto;padding-top:8px;font-size:11.5px;color:var(--wb-muted);border-top:1px solid color-mix(in oklab,var(--wb-border) 65%,transparent)}",
|
|
623
|
+
".wb-root .wb-home-foot b{font-weight:600;color:var(--wb-accent)}",
|
|
624
|
+
".wb-root .wb-immersive-bar{background:color-mix(in oklab,var(--wb-card) 86%,transparent);backdrop-filter:saturate(1.15) blur(14px);box-shadow:0 1px 0 var(--wb-line)}",
|
|
625
|
+
".wb-root .wb-page-tabs{gap:2px;padding:2px 0}",
|
|
626
|
+
".wb-root .wb-tab{border-radius:8px 8px 0 0;padding:9px 13px;font-weight:500}",
|
|
627
|
+
".wb-root .wb-tab.on{background:color-mix(in oklab,var(--wb-accent) 7%,transparent)}",
|
|
628
|
+
// 邮件三栏:账户栏 / 列表 / 阅读
|
|
629
|
+
".wb-root .wbm-layout{display:grid;grid-template-columns:220px minmax(0,1fr);gap:14px;align-items:start;min-height:420px}",
|
|
630
|
+
".wb-root .wbm-layout.has-detail{grid-template-columns:210px minmax(260px,.9fr) minmax(0,1.1fr)}",
|
|
631
|
+
".wb-root .wbm-rail{display:flex;flex-direction:column;gap:10px;min-width:0}",
|
|
632
|
+
".wb-root .wbm-rail-card{display:flex;flex-direction:column;gap:10px;padding:14px}",
|
|
633
|
+
".wb-root .wbm-rail-title{font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--wb-muted)}",
|
|
634
|
+
".wb-root .wbm-rail-stats{display:flex;gap:10px;flex-wrap:wrap;font-size:11.5px;color:var(--wb-muted)}",
|
|
635
|
+
".wb-root .wbm-rail-stats b{font-size:15px;color:inherit;font-variant-numeric:tabular-nums;margin-right:2px}",
|
|
636
|
+
".wb-root .wbm-rail-tip{font-size:11.5px;line-height:1.55;color:var(--wb-muted);opacity:.8;padding:0 4px}",
|
|
637
|
+
".wb-root .wbm-pane{border:1px solid var(--wb-border);border-radius:var(--wb-radius-card);background:var(--wb-card);min-width:0;overflow:hidden;display:flex;flex-direction:column;max-height:calc(100vh - 250px)}",
|
|
638
|
+
".wb-root .wbm-pane-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:11px 14px;border-bottom:1px solid var(--wb-border);font-size:12px;background:color-mix(in oklab,currentColor 2%,transparent)}",
|
|
639
|
+
".wb-root .wbm-list{display:flex;flex-direction:column;overflow:auto;min-height:0}",
|
|
640
|
+
".wb-root .wbm-list-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:start;text-align:left;border:0;border-bottom:1px solid color-mix(in oklab,var(--wb-border) 65%,transparent);background:transparent;color:inherit;font:inherit;padding:11px 14px;cursor:pointer;transition:background .12s ease}",
|
|
641
|
+
".wb-root .wbm-list-row:last-child{border-bottom:0}",
|
|
642
|
+
".wb-root .wbm-list-row:hover{background:color-mix(in oklab,var(--wb-accent) 5%,transparent)}",
|
|
643
|
+
".wb-root .wbm-list-row.on{background:color-mix(in oklab,var(--wb-accent) 9%,transparent);box-shadow:inset 3px 0 0 var(--wb-accent)}",
|
|
644
|
+
".wb-root .wbm-list-row .wbm-dot{width:7px;height:7px;border-radius:50%;margin-top:6px;background:color-mix(in oklab,currentColor 22%,transparent)}",
|
|
645
|
+
".wb-root .wbm-list-row.unread .wbm-dot{background:var(--wb-accent);box-shadow:0 0 0 3px color-mix(in oklab,var(--wb-accent) 15%,transparent)}",
|
|
646
|
+
".wb-root .wbm-list-row.unread .wbm-subject{font-weight:700}",
|
|
647
|
+
".wb-root .wbm-subject{display:block;font-size:12.5px;font-weight:560;line-height:1.45;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
648
|
+
".wb-root .wbm-snippet{display:block;font-size:11.5px;line-height:1.5;color:var(--wb-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:2px}",
|
|
649
|
+
".wb-root .wbm-list-row .wbm-time{font-size:11px;white-space:nowrap;color:var(--wb-muted);padding-top:2px}",
|
|
650
|
+
".wb-root .wbm-detailpane{overflow:auto}",
|
|
651
|
+
".wb-root .wbm-detail-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid var(--wb-border);background:color-mix(in oklab,currentColor 2%,transparent)}",
|
|
652
|
+
".wb-root .wbm-detail-title{display:flex;flex-direction:column;gap:4px;min-width:0}",
|
|
653
|
+
".wb-root .wbm-detail-title strong{font-size:15px;line-height:1.4;overflow-wrap:anywhere}",
|
|
654
|
+
".wb-root .wbm-detail-meta{display:flex;gap:16px;flex-wrap:wrap;padding:10px 16px;font-size:11.5px;color:var(--wb-muted);border-bottom:1px solid color-mix(in oklab,var(--wb-border) 65%,transparent)}",
|
|
655
|
+
".wb-root .wbm-detailpane .wbm-body{padding:0 16px 18px;margin:0}",
|
|
656
|
+
"@media (max-width:980px){.wb-root .wbm-layout,.wbml-layout,.wb-root .wbm-layout.has-detail{grid-template-columns:180px minmax(0,1fr)}.wb-root .wbm-layout.has-detail .wbm-detailpane{grid-column:1/-1;max-height:none}}",
|
|
657
|
+
"@media (max-width:760px){.wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbml-wrap,.wbm-page,.wbml-page){padding:16px 14px 28px;gap:14px}.wb-root .wb-hero h2{font-size:20px}.wb-root .wb-home-card{min-height:0;padding:16px}.wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-card,.wbml-card,.wbct-panel){padding:14px;border-radius:12px}.wb-root .wbm-layout,.wbml-layout,.wb-root .wbm-layout.has-detail{grid-template-columns:1fr}.wb-root .wbm-pane{max-height:none}.wb-root .wbm-rail{order:2}}",
|
|
658
|
+
// 全宽模块页:去掉两侧留白,并把视图标签并入唯一的一层顶栏。
|
|
659
|
+
".wb-root .wb-inner{max-width:none}",
|
|
660
|
+
".wb-root .wb-immersive-main{padding:16px 22px 24px}",
|
|
661
|
+
".wb-root .wb-immersive-main>.wb-inner{max-width:none;width:100%;padding:0}",
|
|
662
|
+
".wb-root .wb-immersive-bar{padding:calc(8px + var(--dsh-frame-top-clearance,0px)) 18px 8px;background:var(--wb-card);box-shadow:none;border-bottom:1px solid var(--wb-line);-webkit-app-region:no-drag}",
|
|
663
|
+
".wb-root .wb-immersive-bar .wb-page-tabs{border-bottom:0;margin:0 0 0 auto;padding:0;flex-wrap:nowrap;overflow-x:auto;max-width:min(72vw,980px);scrollbar-width:none}",
|
|
664
|
+
".wb-root .wb-immersive-bar .wb-page-tabs::-webkit-scrollbar{display:none}",
|
|
665
|
+
".wb-root .wb-immersive-bar .wb-tab{padding:6px 10px;white-space:nowrap}",
|
|
666
|
+
"@media (max-width:760px){.wb-root .wb-immersive-bar{flex-wrap:nowrap;padding:calc(6px + var(--dsh-frame-top-clearance,0px)) 12px 6px}.wb-root .wb-immersive-bar .wb-page-tabs{max-width:none}.wb-root .wb-immersive-title{display:none}}",
|
|
667
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-bar{padding-top:8px;padding-left:max(88px,calc(12px + var(--dsh-frame-leading-clearance,0px)))}",
|
|
668
|
+
// 顶栏分左右两区:左区标题+版本,右区标签,两区贴边。
|
|
669
|
+
".wb-root .wb-immersive-bar{justify-content:space-between;gap:16px}",
|
|
670
|
+
".wb-root .wb-immersive-left{display:flex;align-items:center;gap:10px;min-width:0;flex:0 1 auto}",
|
|
671
|
+
".wb-root .wb-immersive-bar .wb-grow{display:none}",
|
|
672
|
+
".wb-root .wb-immersive-bar .wb-immersive-left .wb-back{margin-right:0}",
|
|
673
|
+
".wb-root .wb-immersive-icon{display:none}",
|
|
674
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-bar{position:relative}",
|
|
675
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:9px;background:var(--wb-card);border:1px solid var(--wb-border);color:var(--wb-accent);z-index:1}",
|
|
676
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-icon svg{width:17px;height:17px}",
|
|
677
|
+
".wb-root .wb-immersive-bar .wb-immersive-title{flex:0 0 auto;min-width:0}",
|
|
678
|
+
".wb-root .wb-immersive-bar .wb-immersive-title>span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
679
|
+
".wb-root .wb-immersive-bar .wb-page-tabs{margin:0;flex:0 1 auto;min-width:0;max-width:none;justify-content:flex-start;gap:4px}",
|
|
680
|
+
".wb-root .wb-immersive-bar .wb-tab{flex:0 0 auto;min-width:0;justify-content:center;text-align:center;padding:6px 10px}"
|
|
506
681
|
].join("\n");
|
|
507
682
|
module2.exports = CSS2;
|
|
508
683
|
}
|
|
509
684
|
});
|
|
510
685
|
|
|
686
|
+
// packages/addons/lib/highlight.cjs
|
|
687
|
+
var require_highlight = __commonJS({
|
|
688
|
+
"packages/addons/lib/highlight.cjs"(exports2, module2) {
|
|
689
|
+
"use strict";
|
|
690
|
+
module2.exports = function(React) {
|
|
691
|
+
var h2 = React.createElement;
|
|
692
|
+
function sourceOf(keyword) {
|
|
693
|
+
var pattern = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
694
|
+
return pattern.replace(/[a-zA-Z]/g, function(letter) {
|
|
695
|
+
return "[" + letter.toLowerCase() + letter.toUpperCase() + "]";
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
return function createHighlight(prefix) {
|
|
699
|
+
var className = String(prefix || "wb") + "-hit";
|
|
700
|
+
function hit(rawText, rawKeyword) {
|
|
701
|
+
var text = rawText == null ? "" : String(rawText);
|
|
702
|
+
var keyword = rawKeyword == null ? "" : String(rawKeyword);
|
|
703
|
+
if (!keyword) return text;
|
|
704
|
+
var matcher, match, end = 0, parts = [];
|
|
705
|
+
try {
|
|
706
|
+
matcher = new RegExp(sourceOf(keyword), "g");
|
|
707
|
+
} catch (error) {
|
|
708
|
+
return text;
|
|
709
|
+
}
|
|
710
|
+
while (match = matcher.exec(text)) {
|
|
711
|
+
if (match.index > end) parts.push(text.slice(end, match.index));
|
|
712
|
+
parts.push(h2("mark", { className, key: match.index }, match[0]));
|
|
713
|
+
end = match.index + match[0].length;
|
|
714
|
+
if (!match[0]) matcher.lastIndex += 1;
|
|
715
|
+
}
|
|
716
|
+
if (!parts.length) return text;
|
|
717
|
+
if (end < text.length) parts.push(text.slice(end));
|
|
718
|
+
return parts;
|
|
719
|
+
}
|
|
720
|
+
function Highlight(props) {
|
|
721
|
+
return hit(props.text, props.keyword);
|
|
722
|
+
}
|
|
723
|
+
Highlight.hit = hit;
|
|
724
|
+
return Highlight;
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
// packages/addons/lib/action-schema-style.cjs
|
|
731
|
+
var require_action_schema_style = __commonJS({
|
|
732
|
+
"packages/addons/lib/action-schema-style.cjs"(exports2, module2) {
|
|
733
|
+
"use strict";
|
|
734
|
+
module2.exports = function(PREFIX, DOMAIN) {
|
|
735
|
+
var P = PREFIX + "-as";
|
|
736
|
+
var CSS2 = [
|
|
737
|
+
"." + P + "{display:flex;flex-direction:column;gap:12px;width:100%;min-width:0;font-size:13px;color:inherit}",
|
|
738
|
+
"." + P + "-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
739
|
+
"." + P + "-title{font-size:15px;font-weight:660;margin:0}",
|
|
740
|
+
"." + P + "-badge{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--wb-border,#e3e5e9);border-radius:999px;padding:1px 8px;font-size:11px;color:var(--dsw-alias-label-secondary,currentColor);font-variant-numeric:tabular-nums}",
|
|
741
|
+
"." + P + "-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
|
|
742
|
+
"." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
743
|
+
"." + P + "-search{position:relative;flex:1 1 220px;min-width:0;display:flex;align-items:center}",
|
|
744
|
+
"." + P + "-search input{width:100%;border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 10px 6px 30px}",
|
|
745
|
+
"." + P + "-search input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
746
|
+
"." + P + "-search .wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
747
|
+
"." + P + " select{border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 8px}",
|
|
748
|
+
"." + P + " select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
749
|
+
"." + P + "-list{display:flex;flex-direction:column;gap:8px}",
|
|
750
|
+
"." + P + "-card{border:1px solid var(--wb-border,#e3e5e9);border-radius:10px;padding:10px 12px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));display:flex;flex-direction:column;gap:8px;min-width:0}",
|
|
751
|
+
"." + P + "-cardhead{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px}",
|
|
752
|
+
"." + P + "-cardmeta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;min-height:24px}",
|
|
753
|
+
"." + P + "-cardhead code{font-weight:640;overflow-wrap:anywhere;min-width:0}",
|
|
754
|
+
"." + P + "-hintline{margin:0;color:var(--dsw-alias-label-tertiary,inherit);font-size:11.5px;line-height:1.5}",
|
|
755
|
+
"." + P + "-toggle{display:inline-flex;align-items:center;gap:6px;min-height:24px;padding:0 2px;border:0;background:transparent;font:inherit;font-size:11.5px;color:var(--wb-muted);cursor:pointer}",
|
|
756
|
+
"." + P + "-track{display:inline-flex;align-items:center;box-sizing:border-box;width:30px;height:18px;padding:2px;border:1px solid var(--wb-muted);border-radius:999px;background:var(--wb-surface);color:var(--wb-muted)}",
|
|
757
|
+
"." + P + "-track::before{content:'';width:12px;height:12px;border-radius:50%;background:currentColor;transition:transform .15s ease}",
|
|
758
|
+
"." + P + "-toggle[aria-checked=true] ." + P + "-track{background:var(--wb-accent);border-color:var(--wb-accent);color:var(--wb-card)}",
|
|
759
|
+
"." + P + "-toggle[aria-checked=true] ." + P + "-track::before{transform:translateX(12px)}",
|
|
760
|
+
"." + P + "-toggle:hover:not(:disabled) ." + P + "-track{outline:1px solid var(--wb-accent)}",
|
|
761
|
+
"." + P + "-toggle:focus-visible{outline:2px solid var(--wb-accent);outline-offset:2px}",
|
|
762
|
+
"." + P + "-toggle:disabled{opacity:.6;cursor:progress}",
|
|
763
|
+
"@media(prefers-reduced-motion:reduce){." + P + "-track::before{transition:none}}",
|
|
764
|
+
// 安全约束(不可放开):用警示色描边,和可切换的开关区分开。
|
|
765
|
+
"." + P + "-locked{border-color:var(--wb-warn,#b7791f);color:var(--wb-warn,#b7791f)}",
|
|
766
|
+
"." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
|
|
767
|
+
// 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
|
|
768
|
+
"." + P + " mark." + P + "-hit{background:color-mix(in oklab,var(--dsw-alias-brand-primary,#4f6ef7) 22%,transparent);color:inherit;border-radius:2px;padding:0;font:inherit;box-decoration-break:clone;-webkit-box-decoration-break:clone}",
|
|
769
|
+
"." + P + "-table{width:100%;border-collapse:collapse;font-size:12px;table-layout:auto}",
|
|
770
|
+
"." + P + "-table th{text-align:left;font-weight:620;font-size:11px;letter-spacing:.4px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary,inherit);padding:4px 8px 4px 0;white-space:nowrap}",
|
|
771
|
+
"." + P + "-table td{padding:4px 8px 4px 0;vertical-align:top;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);line-height:1.5}",
|
|
772
|
+
"." + P + "-req{color:var(--dsw-alias-state-error-primary,#d9534f);font-weight:620}",
|
|
773
|
+
"." + P + "-opt{color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
774
|
+
"." + P + "-none{color:var(--dsw-alias-label-tertiary,inherit);font-size:12px}",
|
|
775
|
+
"." + P + "-example{position:relative;display:flex;flex-direction:column;gap:4px}",
|
|
776
|
+
"." + P + "-examplehead{display:flex;align-items:center;justify-content:space-between;gap:8px}",
|
|
777
|
+
"." + P + "-pre{margin:0;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);color:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:1.5;overflow:auto;max-height:280px;white-space:pre-wrap;word-break:break-word}",
|
|
778
|
+
"." + P + "-copy{border:1px solid var(--wb-border,#e3e5e9);border-radius:7px;background:transparent;color:inherit;font:inherit;font-size:11.5px;padding:2px 8px;cursor:pointer}",
|
|
779
|
+
"." + P + "-copy:hover{background:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent))}",
|
|
780
|
+
"." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
781
|
+
"." + P + " details>summary{cursor:pointer;font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);width:max-content}",
|
|
782
|
+
"." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
783
|
+
"." + P + "-empty{padding:24px;text-align:center;border:1px dashed var(--wb-border,#e3e5e9);border-radius:10px;color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
784
|
+
"." + P + "-error{padding:12px;border:1px solid var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;color:var(--dsw-alias-state-error-primary,#d9534f);display:flex;gap:10px;align-items:center}",
|
|
785
|
+
"." + P + "-toast{position:sticky;bottom:8px;align-self:flex-start;border-radius:999px;padding:3px 10px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);font-size:11.5px}",
|
|
786
|
+
"@media(max-width:600px){." + P + "-table thead{display:none}." + P + "-table td{display:block;border-top:0;padding:2px 0}." + P + "-table tr{display:block;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);padding:4px 0}}"
|
|
787
|
+
].join("\n");
|
|
788
|
+
return function injectCss() {
|
|
789
|
+
if (typeof document === "undefined") return;
|
|
790
|
+
var id = "wb-addon-" + DOMAIN + "-actions-css";
|
|
791
|
+
var old = document.getElementById(id);
|
|
792
|
+
if (old) {
|
|
793
|
+
old.textContent = CSS2;
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
var style = document.createElement("style");
|
|
797
|
+
style.id = id;
|
|
798
|
+
style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
|
|
799
|
+
style.textContent = CSS2;
|
|
800
|
+
document.head.appendChild(style);
|
|
801
|
+
};
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
// packages/addons/lib/action-schema-view.cjs
|
|
807
|
+
var require_action_schema_view = __commonJS({
|
|
808
|
+
"packages/addons/lib/action-schema-view.cjs"(exports2, module2) {
|
|
809
|
+
"use strict";
|
|
810
|
+
var React = require("react");
|
|
811
|
+
var createHighlight = require_highlight()(React);
|
|
812
|
+
var h2 = React.createElement;
|
|
813
|
+
var COPY = {
|
|
814
|
+
zh: {
|
|
815
|
+
title: "Action",
|
|
816
|
+
hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
|
|
817
|
+
switchHint: "agent \u5F00\u5173\u843D\u672C\u673A\u3001\u5373\u6539\u5373\u751F\u6548\uFF1B\u754C\u9762\u64CD\u4F5C\u4E0D\u53D7\u5F71\u54CD\u3002",
|
|
818
|
+
hostHint: "\u5BBF\u4E3B action \u7684 agent \u5F00\u5173\uFF1B\u6807\u300C\u4EC5\u754C\u9762 \xB7 \u5B89\u5168\u7EA6\u675F\u300D\u7684\u4E0D\u53EF\u653E\u5F00\u3002",
|
|
819
|
+
agentSwitch: "agent \u53EF\u7528",
|
|
820
|
+
agentLocked: "\u4EC5\u754C\u9762 \xB7 \u5B89\u5168\u7EA6\u675F",
|
|
821
|
+
agentLockedHint: "\u8BE5 action \u53EA\u80FD\u5728\u754C\u9762\u6267\u884C\uFF08\u5B89\u5168\u7EA6\u675F\uFF09\uFF0Cagent \u5F00\u5173\u4E0D\u53EF\u653E\u5F00",
|
|
822
|
+
agentSaving: "\u4FDD\u5B58\u4E2D\u2026",
|
|
823
|
+
agentOnToast: "\u5DF2\u5141\u8BB8 agent \u8C03\u7528",
|
|
824
|
+
agentOffToast: "\u5DF2\u7981\u6B62 agent \u8C03\u7528",
|
|
825
|
+
agentFail: "\u5207\u6362 agent \u5F00\u5173\u5931\u8D25",
|
|
826
|
+
domain: "\u57DF",
|
|
827
|
+
versionLabel: "\u7248\u672C",
|
|
828
|
+
shell: "\u5BBF\u4E3B",
|
|
829
|
+
count: function(shown, total) {
|
|
830
|
+
return shown + " / " + total + " \u4E2A action";
|
|
831
|
+
},
|
|
832
|
+
search: "\u641C\u7D22\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u53C2\u6570\uFF08\u547D\u4E2D\u5904\u9AD8\u4EAE\uFF09",
|
|
833
|
+
filterReq: "\u5FC5\u586B\u7B5B\u9009",
|
|
834
|
+
all: "\u5168\u90E8",
|
|
835
|
+
onlyRequired: "\u542B\u5FC5\u586B\u9879",
|
|
836
|
+
onlyOptional: "\u65E0\u5FC5\u586B\u9879",
|
|
837
|
+
filterType: "\u53C2\u6570\u7C7B\u578B",
|
|
838
|
+
allTypes: "\u5168\u90E8\u7C7B\u578B",
|
|
839
|
+
colName: "\u53C2\u6570",
|
|
840
|
+
colType: "\u7C7B\u578B",
|
|
841
|
+
colReq: "\u5FC5\u586B",
|
|
842
|
+
colExtra: "\u9ED8\u8BA4 / \u679A\u4E3E / \u7EA6\u675F",
|
|
843
|
+
colDesc: "\u8BF4\u660E",
|
|
844
|
+
required: "\u5FC5\u586B",
|
|
845
|
+
optional: "\u53EF\u9009",
|
|
846
|
+
noParams: "\u65E0\u53C2\u6570",
|
|
847
|
+
paramCount: function(n) {
|
|
848
|
+
return n + " \u4E2A\u53C2\u6570";
|
|
849
|
+
},
|
|
850
|
+
examples: "\u793A\u4F8B",
|
|
851
|
+
noExamples: "\u65E0\u793A\u4F8B",
|
|
852
|
+
copy: "\u590D\u5236",
|
|
853
|
+
copied: "\u5DF2\u590D\u5236",
|
|
854
|
+
raw: "\u539F\u59CB JSON Schema",
|
|
855
|
+
loading: "\u8F7D\u5165\u4E2D\u2026",
|
|
856
|
+
loadFail: "\u8BFB\u53D6 action schema \u5931\u8D25",
|
|
857
|
+
retry: "\u91CD\u8BD5",
|
|
858
|
+
empty: "\u6CA1\u6709\u5339\u914D\u7684 action",
|
|
859
|
+
emptyRegistry: "\u8BE5\u57DF\u6CA1\u6709\u6CE8\u518C action",
|
|
860
|
+
envelope: "\u9ED8\u8BA4",
|
|
861
|
+
enumLabel: "\u679A\u4E3E",
|
|
862
|
+
range: "\u8303\u56F4",
|
|
863
|
+
length: "\u957F\u5EA6",
|
|
864
|
+
pattern: "\u6B63\u5219",
|
|
865
|
+
format: "\u683C\u5F0F",
|
|
866
|
+
items: "\u5143\u7D20\u6570"
|
|
867
|
+
},
|
|
868
|
+
en: {
|
|
869
|
+
title: "Actions",
|
|
870
|
+
hint: "runtime registry \xB7 read-only",
|
|
871
|
+
switchHint: "The agent switch is stored locally and applies immediately; UI actions are unaffected.",
|
|
872
|
+
hostHint: "Agent switch for host actions; items marked UI-only (security) cannot be opened up.",
|
|
873
|
+
agentSwitch: "Agent callable",
|
|
874
|
+
agentLocked: "UI only \xB7 security",
|
|
875
|
+
agentLockedHint: "This action can only run from the UI (security constraint); the agent switch cannot be opened",
|
|
876
|
+
agentSaving: "Saving\u2026",
|
|
877
|
+
agentOnToast: "Agent calls allowed",
|
|
878
|
+
agentOffToast: "Agent calls blocked",
|
|
879
|
+
agentFail: "Failed to change the agent switch",
|
|
880
|
+
domain: "Domain",
|
|
881
|
+
versionLabel: "Version",
|
|
882
|
+
shell: "Host",
|
|
883
|
+
count: function(shown, total) {
|
|
884
|
+
return shown + " / " + total + " actions";
|
|
885
|
+
},
|
|
886
|
+
search: "Search name, description, params (matches highlighted)",
|
|
887
|
+
filterReq: "Required",
|
|
888
|
+
all: "All",
|
|
889
|
+
onlyRequired: "Has required",
|
|
890
|
+
onlyOptional: "No required",
|
|
891
|
+
filterType: "Param type",
|
|
892
|
+
allTypes: "All types",
|
|
893
|
+
colName: "Param",
|
|
894
|
+
colType: "Type",
|
|
895
|
+
colReq: "Required",
|
|
896
|
+
colExtra: "Default / enum / constraints",
|
|
897
|
+
colDesc: "Description",
|
|
898
|
+
required: "required",
|
|
899
|
+
optional: "optional",
|
|
900
|
+
noParams: "No parameters",
|
|
901
|
+
paramCount: function(n) {
|
|
902
|
+
return n + " params";
|
|
903
|
+
},
|
|
904
|
+
examples: "Examples",
|
|
905
|
+
noExamples: "No examples",
|
|
906
|
+
copy: "Copy",
|
|
907
|
+
copied: "Copied",
|
|
908
|
+
raw: "Raw JSON Schema",
|
|
909
|
+
loading: "Loading\u2026",
|
|
910
|
+
loadFail: "Failed to read action schema",
|
|
911
|
+
retry: "Retry",
|
|
912
|
+
empty: "No matching action",
|
|
913
|
+
emptyRegistry: "This domain has no registered action",
|
|
914
|
+
envelope: "Default",
|
|
915
|
+
enumLabel: "Enum",
|
|
916
|
+
range: "Range",
|
|
917
|
+
length: "Length",
|
|
918
|
+
pattern: "Pattern",
|
|
919
|
+
format: "Format",
|
|
920
|
+
items: "Items"
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
function typeLabel(schema) {
|
|
924
|
+
if (!schema || typeof schema !== "object") return "";
|
|
925
|
+
if (Array.isArray(schema.type)) return schema.type.join(" | ");
|
|
926
|
+
if (typeof schema.type === "string") {
|
|
927
|
+
if (schema.type === "array" && schema.items) {
|
|
928
|
+
var inner = typeLabel(schema.items);
|
|
929
|
+
return inner ? inner + "[]" : "array";
|
|
930
|
+
}
|
|
931
|
+
return schema.type;
|
|
932
|
+
}
|
|
933
|
+
if (Array.isArray(schema.oneOf)) return schema.oneOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
934
|
+
if (Array.isArray(schema.anyOf)) return schema.anyOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
935
|
+
return "";
|
|
936
|
+
}
|
|
937
|
+
function typeNames(schema) {
|
|
938
|
+
var label = typeLabel(schema);
|
|
939
|
+
if (!label) return [];
|
|
940
|
+
return label.split("|").map(function(x) {
|
|
941
|
+
return x.trim().replace(/\[\]$/, "");
|
|
942
|
+
}).filter(Boolean);
|
|
943
|
+
}
|
|
944
|
+
function scalar(value) {
|
|
945
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
946
|
+
return String(value);
|
|
947
|
+
}
|
|
948
|
+
function extraText(schema, t) {
|
|
949
|
+
if (!schema || typeof schema !== "object") return "";
|
|
950
|
+
var parts = [];
|
|
951
|
+
if (Object.prototype.hasOwnProperty.call(schema, "default")) {
|
|
952
|
+
parts.push(t.envelope + " " + scalar(schema.default));
|
|
953
|
+
}
|
|
954
|
+
if (Array.isArray(schema.enum)) {
|
|
955
|
+
parts.push(t.enumLabel + " " + schema.enum.map(scalar).join(" / "));
|
|
956
|
+
}
|
|
957
|
+
if (typeof schema.minimum === "number" || typeof schema.maximum === "number") {
|
|
958
|
+
var lo = typeof schema.minimum === "number" ? schema.minimum : null;
|
|
959
|
+
var hi = typeof schema.maximum === "number" ? schema.maximum : null;
|
|
960
|
+
if (lo !== null && hi !== null) parts.push(t.range + " \u2265" + lo + " \u4E14 \u2264" + hi);
|
|
961
|
+
else if (lo !== null) parts.push(t.range + " \u2265" + lo);
|
|
962
|
+
else parts.push(t.range + " \u2264" + hi);
|
|
963
|
+
}
|
|
964
|
+
if (typeof schema.minLength === "number" || typeof schema.maxLength === "number") {
|
|
965
|
+
parts.push(t.length + " " + (schema.minLength ?? 0) + "\u2013" + (schema.maxLength ?? "\u221E"));
|
|
966
|
+
}
|
|
967
|
+
if (typeof schema.minItems === "number" || typeof schema.maxItems === "number") {
|
|
968
|
+
parts.push(t.items + " " + (schema.minItems ?? 0) + "\u2013" + (schema.maxItems ?? "\u221E"));
|
|
969
|
+
}
|
|
970
|
+
if (typeof schema.pattern === "string") parts.push(t.pattern + " " + schema.pattern);
|
|
971
|
+
if (typeof schema.format === "string") parts.push(t.format + " " + schema.format);
|
|
972
|
+
return parts.join(" \xB7 ");
|
|
973
|
+
}
|
|
974
|
+
function paramRows(action) {
|
|
975
|
+
var input = action && action.input && typeof action.input === "object" ? action.input : {};
|
|
976
|
+
var props = input.properties && typeof input.properties === "object" ? input.properties : {};
|
|
977
|
+
var required = Array.isArray(input.required) ? input.required : [];
|
|
978
|
+
return Object.keys(props).map(function(key) {
|
|
979
|
+
var schema = props[key] && typeof props[key] === "object" ? props[key] : {};
|
|
980
|
+
return {
|
|
981
|
+
name: key,
|
|
982
|
+
schema,
|
|
983
|
+
type: typeLabel(schema),
|
|
984
|
+
types: typeNames(schema),
|
|
985
|
+
required: required.indexOf(key) >= 0,
|
|
986
|
+
description: typeof schema.description === "string" ? schema.description : ""
|
|
987
|
+
};
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
module2.exports = function createActionSchemaView(options) {
|
|
991
|
+
var raw = String(options.domain || "");
|
|
992
|
+
var SOURCE = options.source === "actions.list" ? "actions.list" : "actionSchema";
|
|
993
|
+
var DOMAIN = SOURCE === "actions.list" ? raw : raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
|
|
994
|
+
var LIST_DOMAIN = options.listDomain ? String(options.listDomain) : DOMAIN;
|
|
995
|
+
var prefix = options.prefix;
|
|
996
|
+
var P = prefix + "-as";
|
|
997
|
+
var Icon = options.Icon || null;
|
|
998
|
+
var injectCss = require_action_schema_style()(prefix, DOMAIN);
|
|
999
|
+
var Highlight = createHighlight(P);
|
|
1000
|
+
function icon(name, size) {
|
|
1001
|
+
return Icon ? h2(Icon, { name, size: size || 14 }) : null;
|
|
1002
|
+
}
|
|
1003
|
+
function plainCopy(text) {
|
|
1004
|
+
if (typeof document === "undefined") return;
|
|
1005
|
+
var area = document.createElement("textarea");
|
|
1006
|
+
area.value = text;
|
|
1007
|
+
area.setAttribute("readonly", "readonly");
|
|
1008
|
+
area.style.position = "fixed";
|
|
1009
|
+
area.style.opacity = "0";
|
|
1010
|
+
document.body.appendChild(area);
|
|
1011
|
+
area.select();
|
|
1012
|
+
try {
|
|
1013
|
+
document.execCommand("copy");
|
|
1014
|
+
} catch (e) {
|
|
1015
|
+
}
|
|
1016
|
+
document.body.removeChild(area);
|
|
1017
|
+
}
|
|
1018
|
+
function ActionSchemaView(props) {
|
|
1019
|
+
var lang = props.lang === "en" ? "en" : "zh";
|
|
1020
|
+
var t = COPY[lang];
|
|
1021
|
+
var api = props.api;
|
|
1022
|
+
var snapState = React.useState(null);
|
|
1023
|
+
var snap = snapState[0], setSnap = snapState[1];
|
|
1024
|
+
var errState = React.useState("");
|
|
1025
|
+
var err = errState[0], setErr = errState[1];
|
|
1026
|
+
var loadingState = React.useState(true);
|
|
1027
|
+
var loading = loadingState[0], setLoading = loadingState[1];
|
|
1028
|
+
var reloadState = React.useState(0);
|
|
1029
|
+
var reload = reloadState[0], setReload = reloadState[1];
|
|
1030
|
+
var queryState = React.useState("");
|
|
1031
|
+
var query = queryState[0], setQuery = queryState[1];
|
|
1032
|
+
var reqState = React.useState("all");
|
|
1033
|
+
var reqMode = reqState[0], setReqMode = reqState[1];
|
|
1034
|
+
var typeState = React.useState("");
|
|
1035
|
+
var typePick = typeState[0], setTypePick = typeState[1];
|
|
1036
|
+
var toastState = React.useState("");
|
|
1037
|
+
var toast = toastState[0], setToast = toastState[1];
|
|
1038
|
+
var savingState = React.useState("");
|
|
1039
|
+
var saving = savingState[0], setSaving = savingState[1];
|
|
1040
|
+
React.useEffect(function() {
|
|
1041
|
+
injectCss();
|
|
1042
|
+
}, []);
|
|
1043
|
+
React.useEffect(function() {
|
|
1044
|
+
var alive = true;
|
|
1045
|
+
setLoading(true);
|
|
1046
|
+
setErr("");
|
|
1047
|
+
var pending;
|
|
1048
|
+
var actionName = SOURCE === "actions.list" ? "actions.list" : DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
|
|
1049
|
+
var callArgs = SOURCE === "actions.list" ? { detail: true, domain: LIST_DOMAIN } : void 0;
|
|
1050
|
+
if (api && typeof api.call === "function") {
|
|
1051
|
+
pending = Promise.resolve(api.call(actionName, callArgs)).then(function(r) {
|
|
1052
|
+
if (r && r.ok === false) return r;
|
|
1053
|
+
return r && r.result || r;
|
|
1054
|
+
});
|
|
1055
|
+
} else {
|
|
1056
|
+
pending = Promise.reject(new Error("no call api"));
|
|
1057
|
+
}
|
|
1058
|
+
Promise.resolve(pending).then(function(r) {
|
|
1059
|
+
if (!alive) return;
|
|
1060
|
+
if (!r || r.ok === false) {
|
|
1061
|
+
setSnap(null);
|
|
1062
|
+
setErr(String(r && (r.error || r.text) || t.loadFail));
|
|
1063
|
+
} else {
|
|
1064
|
+
setSnap(r);
|
|
1065
|
+
}
|
|
1066
|
+
setLoading(false);
|
|
1067
|
+
}, function(e) {
|
|
1068
|
+
if (!alive) return;
|
|
1069
|
+
setSnap(null);
|
|
1070
|
+
setErr(String(e && e.message || e || t.loadFail));
|
|
1071
|
+
setLoading(false);
|
|
1072
|
+
});
|
|
1073
|
+
return function() {
|
|
1074
|
+
alive = false;
|
|
1075
|
+
};
|
|
1076
|
+
}, [reload]);
|
|
1077
|
+
function copy(text) {
|
|
1078
|
+
var done = function() {
|
|
1079
|
+
setToast(t.copied);
|
|
1080
|
+
};
|
|
1081
|
+
if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
|
|
1082
|
+
navigator.clipboard.writeText(text).then(done, function() {
|
|
1083
|
+
plainCopy(text);
|
|
1084
|
+
done();
|
|
1085
|
+
});
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
plainCopy(text);
|
|
1089
|
+
done();
|
|
1090
|
+
}
|
|
1091
|
+
function setAgent(action, next) {
|
|
1092
|
+
var name = action.name;
|
|
1093
|
+
setSaving(name);
|
|
1094
|
+
setToast("");
|
|
1095
|
+
var fail = function(e) {
|
|
1096
|
+
setSaving("");
|
|
1097
|
+
setToast(t.agentFail + "\uFF1A" + String(e && e.message || e || ""));
|
|
1098
|
+
};
|
|
1099
|
+
var done = function(r) {
|
|
1100
|
+
setSaving("");
|
|
1101
|
+
var payload = r && typeof r === "object" && Object.prototype.hasOwnProperty.call(r, "result") ? r.result : r;
|
|
1102
|
+
if (r && r.ok === false) {
|
|
1103
|
+
setToast(t.agentFail + "\uFF1A" + String(r.error || r.text || ""));
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
var value = payload && typeof payload.agentEnabled === "boolean" ? payload.agentEnabled : next;
|
|
1107
|
+
setSnap(function(prev) {
|
|
1108
|
+
if (!prev || !Array.isArray(prev.actions)) return prev;
|
|
1109
|
+
return Object.assign({}, prev, {
|
|
1110
|
+
actions: prev.actions.map(function(a) {
|
|
1111
|
+
if (!a || a.name !== name) return a;
|
|
1112
|
+
return Object.assign({}, a, { agentEnabled: value });
|
|
1113
|
+
})
|
|
1114
|
+
});
|
|
1115
|
+
});
|
|
1116
|
+
setToast(value ? t.agentOnToast : t.agentOffToast);
|
|
1117
|
+
};
|
|
1118
|
+
if (!api || typeof api.call !== "function") {
|
|
1119
|
+
fail(new Error("no call api"));
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
Promise.resolve(api.call("actions.setAgentAccess", { action: name, agentEnabled: next })).then(done, fail);
|
|
1123
|
+
}
|
|
1124
|
+
var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
|
|
1125
|
+
return a && a.domain === DOMAIN;
|
|
1126
|
+
}) : [];
|
|
1127
|
+
var info = snap && Array.isArray(snap.domains) ? snap.domains.filter(function(d) {
|
|
1128
|
+
return d && d.id === DOMAIN;
|
|
1129
|
+
})[0] || null : null;
|
|
1130
|
+
var typeOptions = [];
|
|
1131
|
+
all.forEach(function(a) {
|
|
1132
|
+
paramRows(a).forEach(function(row) {
|
|
1133
|
+
row.types.forEach(function(name) {
|
|
1134
|
+
if (typeOptions.indexOf(name) < 0) typeOptions.push(name);
|
|
1135
|
+
});
|
|
1136
|
+
});
|
|
1137
|
+
});
|
|
1138
|
+
typeOptions.sort();
|
|
1139
|
+
var kw = String(query || "").trim();
|
|
1140
|
+
var q = kw.toLowerCase();
|
|
1141
|
+
var visible = all.filter(function(a) {
|
|
1142
|
+
var rows = paramRows(a);
|
|
1143
|
+
if (q) {
|
|
1144
|
+
var hay = [a.name || "", a.description || ""].concat(rows.map(function(row) {
|
|
1145
|
+
return row.name + " " + row.type + " " + row.description;
|
|
1146
|
+
})).join(" ").toLowerCase();
|
|
1147
|
+
if (hay.indexOf(q) < 0) return false;
|
|
1148
|
+
}
|
|
1149
|
+
var hasRequired = rows.some(function(row) {
|
|
1150
|
+
return row.required;
|
|
1151
|
+
});
|
|
1152
|
+
if (reqMode === "required" && !hasRequired) return false;
|
|
1153
|
+
if (reqMode === "optional" && hasRequired) return false;
|
|
1154
|
+
if (typePick && !rows.some(function(row) {
|
|
1155
|
+
return row.types.indexOf(typePick) >= 0;
|
|
1156
|
+
})) return false;
|
|
1157
|
+
return true;
|
|
1158
|
+
});
|
|
1159
|
+
function paramRow(row) {
|
|
1160
|
+
var extra = extraText(row.schema, t);
|
|
1161
|
+
return h2(
|
|
1162
|
+
"tr",
|
|
1163
|
+
{ key: row.name },
|
|
1164
|
+
h2("td", { className: P + "-mono" }, Highlight.hit(row.name, kw)),
|
|
1165
|
+
h2("td", { className: P + "-mono" }, Highlight.hit(row.type, kw)),
|
|
1166
|
+
h2("td", { className: row.required ? P + "-req" : P + "-opt" }, row.required ? t.required : t.optional),
|
|
1167
|
+
// extra(默认 / 枚举 / 约束)不在过滤 haystack 里,因此也不高亮,保持「显示即命中」口径。
|
|
1168
|
+
h2("td", { className: P + "-mono" }, extra),
|
|
1169
|
+
h2("td", null, Highlight.hit(row.description, kw))
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
function agentSwitch(action) {
|
|
1173
|
+
if (action.agentLocked === true) {
|
|
1174
|
+
return h2("span", {
|
|
1175
|
+
className: P + "-badge " + P + "-locked",
|
|
1176
|
+
title: t.agentLockedHint,
|
|
1177
|
+
"data-agent-locked": action.name
|
|
1178
|
+
}, t.agentLocked);
|
|
1179
|
+
}
|
|
1180
|
+
if (typeof action.agentEnabled !== "boolean") return null;
|
|
1181
|
+
var busy = saving === action.name;
|
|
1182
|
+
return h2(
|
|
1183
|
+
"button",
|
|
1184
|
+
{
|
|
1185
|
+
className: P + "-toggle",
|
|
1186
|
+
"data-agent-row": action.name,
|
|
1187
|
+
type: "button",
|
|
1188
|
+
role: "switch",
|
|
1189
|
+
"aria-checked": action.agentEnabled,
|
|
1190
|
+
disabled: busy,
|
|
1191
|
+
"data-agent-toggle": action.name,
|
|
1192
|
+
"aria-label": t.agentSwitch + " \xB7 " + action.name,
|
|
1193
|
+
onClick: function() {
|
|
1194
|
+
setAgent(action, !action.agentEnabled);
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
h2("span", { className: P + "-track", "aria-hidden": true }),
|
|
1198
|
+
h2("span", null, busy ? t.agentSaving : t.agentSwitch)
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
function card(action) {
|
|
1202
|
+
var rows = paramRows(action);
|
|
1203
|
+
var examples = Array.isArray(action.examples) ? action.examples : [];
|
|
1204
|
+
return h2(
|
|
1205
|
+
"div",
|
|
1206
|
+
{ className: P + "-card", key: action.name },
|
|
1207
|
+
h2(
|
|
1208
|
+
"div",
|
|
1209
|
+
{ className: P + "-cardhead" },
|
|
1210
|
+
h2(
|
|
1211
|
+
"div",
|
|
1212
|
+
{ className: P + "-cardmeta" },
|
|
1213
|
+
h2("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
|
|
1214
|
+
h2("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
|
|
1215
|
+
rows.some(function(row) {
|
|
1216
|
+
return row.required;
|
|
1217
|
+
}) ? h2("span", { className: P + "-badge " + P + "-req" }, t.required) : null
|
|
1218
|
+
),
|
|
1219
|
+
agentSwitch(action)
|
|
1220
|
+
),
|
|
1221
|
+
action.description ? h2("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
|
|
1222
|
+
rows.length ? h2(
|
|
1223
|
+
"table",
|
|
1224
|
+
{ className: P + "-table" },
|
|
1225
|
+
h2("thead", null, h2(
|
|
1226
|
+
"tr",
|
|
1227
|
+
null,
|
|
1228
|
+
h2("th", null, t.colName),
|
|
1229
|
+
h2("th", null, t.colType),
|
|
1230
|
+
h2("th", null, t.colReq),
|
|
1231
|
+
h2("th", null, t.colExtra),
|
|
1232
|
+
h2("th", null, t.colDesc)
|
|
1233
|
+
)),
|
|
1234
|
+
h2("tbody", null, rows.map(paramRow))
|
|
1235
|
+
) : h2("div", { className: P + "-none" }, t.noParams),
|
|
1236
|
+
h2(
|
|
1237
|
+
"div",
|
|
1238
|
+
{ className: P + "-example" },
|
|
1239
|
+
h2(
|
|
1240
|
+
"div",
|
|
1241
|
+
{ className: P + "-examplehead" },
|
|
1242
|
+
h2("span", { className: P + "-none" }, t.examples),
|
|
1243
|
+
examples.length ? h2("button", {
|
|
1244
|
+
type: "button",
|
|
1245
|
+
className: P + "-copy",
|
|
1246
|
+
"data-copy-example": action.name,
|
|
1247
|
+
onClick: function() {
|
|
1248
|
+
copy(JSON.stringify(examples.length === 1 ? examples[0] : examples, null, 2));
|
|
1249
|
+
}
|
|
1250
|
+
}, t.copy) : null
|
|
1251
|
+
),
|
|
1252
|
+
examples.length ? examples.map(function(example, index) {
|
|
1253
|
+
return h2("pre", { className: P + "-pre", key: index }, JSON.stringify(example, null, 2));
|
|
1254
|
+
}) : h2("div", { className: P + "-none" }, t.noExamples)
|
|
1255
|
+
),
|
|
1256
|
+
h2(
|
|
1257
|
+
"details",
|
|
1258
|
+
null,
|
|
1259
|
+
h2("summary", null, t.raw),
|
|
1260
|
+
h2("pre", { className: P + "-pre" }, JSON.stringify(action.input || {}, null, 2))
|
|
1261
|
+
)
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
var body;
|
|
1265
|
+
if (loading) {
|
|
1266
|
+
body = h2("div", { className: P + "-empty", role: "status" }, t.loading);
|
|
1267
|
+
} else if (err) {
|
|
1268
|
+
body = h2(
|
|
1269
|
+
"div",
|
|
1270
|
+
{ className: P + "-error", role: "alert" },
|
|
1271
|
+
h2("span", null, t.loadFail + "\uFF1A" + err),
|
|
1272
|
+
h2("button", { type: "button", className: P + "-copy", onClick: function() {
|
|
1273
|
+
setReload(reload + 1);
|
|
1274
|
+
} }, t.retry)
|
|
1275
|
+
);
|
|
1276
|
+
} else if (!all.length) {
|
|
1277
|
+
body = h2("div", { className: P + "-empty" }, t.emptyRegistry);
|
|
1278
|
+
} else if (!visible.length) {
|
|
1279
|
+
body = h2("div", { className: P + "-empty" }, t.empty);
|
|
1280
|
+
} else {
|
|
1281
|
+
body = h2("div", { className: P + "-list" }, visible.map(card));
|
|
1282
|
+
}
|
|
1283
|
+
return h2(
|
|
1284
|
+
"div",
|
|
1285
|
+
{ className: P },
|
|
1286
|
+
h2(
|
|
1287
|
+
"div",
|
|
1288
|
+
{ className: P + "-head" },
|
|
1289
|
+
h2("h3", { className: P + "-title" }, t.title),
|
|
1290
|
+
h2("span", { className: P + "-badge" }, t.domain + " " + DOMAIN),
|
|
1291
|
+
info && info.version ? h2("span", { className: P + "-badge" }, t.versionLabel + " v" + info.version) : null,
|
|
1292
|
+
snap && snap.shellVersion ? h2("span", { className: P + "-badge" }, t.shell + " v" + snap.shellVersion) : null,
|
|
1293
|
+
h2("span", { className: P + "-badge" }, t.count(visible.length, all.length)),
|
|
1294
|
+
h2("span", { className: P + "-none" }, t.hint)
|
|
1295
|
+
),
|
|
1296
|
+
h2("p", { className: P + "-hintline" }, SOURCE === "actions.list" ? t.hostHint : t.switchHint),
|
|
1297
|
+
snap ? h2(
|
|
1298
|
+
"div",
|
|
1299
|
+
{ className: P + "-toolbar" },
|
|
1300
|
+
h2(
|
|
1301
|
+
"label",
|
|
1302
|
+
{ className: P + "-search" },
|
|
1303
|
+
icon("search", 14),
|
|
1304
|
+
h2("input", {
|
|
1305
|
+
type: "search",
|
|
1306
|
+
value: query,
|
|
1307
|
+
placeholder: t.search,
|
|
1308
|
+
"aria-label": t.search,
|
|
1309
|
+
onChange: function(e) {
|
|
1310
|
+
setQuery(e.target.value);
|
|
1311
|
+
}
|
|
1312
|
+
})
|
|
1313
|
+
),
|
|
1314
|
+
h2(
|
|
1315
|
+
"label",
|
|
1316
|
+
{ className: P + "-none" },
|
|
1317
|
+
t.filterReq + " ",
|
|
1318
|
+
h2(
|
|
1319
|
+
"select",
|
|
1320
|
+
{ value: reqMode, "aria-label": t.filterReq, onChange: function(e) {
|
|
1321
|
+
setReqMode(e.target.value);
|
|
1322
|
+
} },
|
|
1323
|
+
h2("option", { value: "all" }, t.all),
|
|
1324
|
+
h2("option", { value: "required" }, t.onlyRequired),
|
|
1325
|
+
h2("option", { value: "optional" }, t.onlyOptional)
|
|
1326
|
+
)
|
|
1327
|
+
),
|
|
1328
|
+
h2(
|
|
1329
|
+
"label",
|
|
1330
|
+
{ className: P + "-none" },
|
|
1331
|
+
t.filterType + " ",
|
|
1332
|
+
h2(
|
|
1333
|
+
"select",
|
|
1334
|
+
{ value: typePick, "aria-label": t.filterType, onChange: function(e) {
|
|
1335
|
+
setTypePick(e.target.value);
|
|
1336
|
+
} },
|
|
1337
|
+
h2("option", { value: "" }, t.allTypes),
|
|
1338
|
+
typeOptions.map(function(name) {
|
|
1339
|
+
return h2("option", { value: name, key: name }, name);
|
|
1340
|
+
})
|
|
1341
|
+
)
|
|
1342
|
+
)
|
|
1343
|
+
) : null,
|
|
1344
|
+
body,
|
|
1345
|
+
toast ? h2("div", { className: P + "-toast", role: "status" }, toast) : null
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
return { ActionSchemaView, DOMAIN, typeLabel, paramRows };
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
// packages/shell/client/system-pages.cjs
|
|
1354
|
+
var require_system_pages = __commonJS({
|
|
1355
|
+
"packages/shell/client/system-pages.cjs"(exports2, module2) {
|
|
1356
|
+
"use strict";
|
|
1357
|
+
var createActionSchemaView = require_action_schema_view();
|
|
1358
|
+
function agentAccessPage(deps) {
|
|
1359
|
+
var jsx2 = deps.jsx;
|
|
1360
|
+
var t = deps.t;
|
|
1361
|
+
var lang = deps.lang;
|
|
1362
|
+
var api = deps.api;
|
|
1363
|
+
var View = createActionSchemaView({ domain: "wb-shell", source: "actions.list", prefix: "wb" }).ActionSchemaView;
|
|
1364
|
+
var hostApi = {
|
|
1365
|
+
call: function(action, args) {
|
|
1366
|
+
return api.post("/domains/wb-shell/actions/" + encodeURIComponent(action), args || {});
|
|
1367
|
+
}
|
|
1368
|
+
};
|
|
1369
|
+
return jsx2.jsxs("div", { className: "wb-root", children: [
|
|
1370
|
+
jsx2.jsxs("div", { className: "wb-inner wb-wide", children: [
|
|
1371
|
+
deps.head(t("tab_agent"), t("agent_desc")),
|
|
1372
|
+
jsx2.jsx(View, { api: hostApi, lang })
|
|
1373
|
+
] })
|
|
1374
|
+
] });
|
|
1375
|
+
}
|
|
1376
|
+
function manageCards(deps) {
|
|
1377
|
+
var t = deps.t;
|
|
1378
|
+
var card = deps.systemCard;
|
|
1379
|
+
return [
|
|
1380
|
+
card("agent", "agent", t("tab_agent"), t("agent_desc")),
|
|
1381
|
+
card("backup", "backup", t("tab_backup"), t("backup_desc")),
|
|
1382
|
+
card("audit", "audit", t("tab_audit"), t("audit_desc")),
|
|
1383
|
+
card("account", "account", t("tab_account"), t("account_desc"))
|
|
1384
|
+
];
|
|
1385
|
+
}
|
|
1386
|
+
module2.exports = { agentAccessPage, manageCards };
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
|
|
511
1390
|
// packages/shell/client/system-tabs.cjs
|
|
512
1391
|
var require_system_tabs = __commonJS({
|
|
513
1392
|
"packages/shell/client/system-tabs.cjs"(exports2, module2) {
|
|
@@ -1285,6 +2164,7 @@ var h = react.createElement;
|
|
|
1285
2164
|
var NS = "workbench";
|
|
1286
2165
|
var LOCALE = require_locale();
|
|
1287
2166
|
var CSS = require_styles();
|
|
2167
|
+
var SystemPages = require_system_pages();
|
|
1288
2168
|
var registry = /* @__PURE__ */ new Map();
|
|
1289
2169
|
var listeners = /* @__PURE__ */ new Set();
|
|
1290
2170
|
var apiCache = /* @__PURE__ */ new Map();
|
|
@@ -1455,6 +2335,7 @@ function useAddonStore() {
|
|
|
1455
2335
|
}, []);
|
|
1456
2336
|
return addonState;
|
|
1457
2337
|
}
|
|
2338
|
+
var navigateAddonHook = null;
|
|
1458
2339
|
window.__WB_HOST__ = {
|
|
1459
2340
|
react,
|
|
1460
2341
|
jsx,
|
|
@@ -1465,6 +2346,9 @@ window.__WB_HOST__ = {
|
|
|
1465
2346
|
},
|
|
1466
2347
|
error: function() {
|
|
1467
2348
|
return lastAddonError;
|
|
2349
|
+
},
|
|
2350
|
+
navigateAddon: function(addonId) {
|
|
2351
|
+
return typeof navigateAddonHook === "function" && !!addonId && navigateAddonHook(String(addonId)) !== false;
|
|
1468
2352
|
}
|
|
1469
2353
|
};
|
|
1470
2354
|
function useApi() {
|
|
@@ -1582,6 +2466,118 @@ function ensureCss() {
|
|
|
1582
2466
|
s.textContent = CSS;
|
|
1583
2467
|
document.head.appendChild(s);
|
|
1584
2468
|
}
|
|
2469
|
+
function SearchPanel(props) {
|
|
2470
|
+
var api = props.api;
|
|
2471
|
+
var st = react.useState("");
|
|
2472
|
+
var rs = react.useState([]);
|
|
2473
|
+
var bs = react.useState(false);
|
|
2474
|
+
var es = react.useState("");
|
|
2475
|
+
var os = react.useState(false);
|
|
2476
|
+
var inputRef = react.useRef(null);
|
|
2477
|
+
var q = st[0];
|
|
2478
|
+
var results = rs[0];
|
|
2479
|
+
var loading = bs[0];
|
|
2480
|
+
var error = es[0];
|
|
2481
|
+
var open = os[0];
|
|
2482
|
+
var t = props.t;
|
|
2483
|
+
react.useEffect(function() {
|
|
2484
|
+
function onKey(e) {
|
|
2485
|
+
if ((e.metaKey || e.ctrlKey) && String(e.key).toLowerCase() === "k") {
|
|
2486
|
+
e.preventDefault();
|
|
2487
|
+
os[1](true);
|
|
2488
|
+
setTimeout(function() {
|
|
2489
|
+
if (inputRef.current) inputRef.current.focus();
|
|
2490
|
+
}, 0);
|
|
2491
|
+
}
|
|
2492
|
+
if (e.key === "Escape") os[1](false);
|
|
2493
|
+
}
|
|
2494
|
+
document.addEventListener("keydown", onKey);
|
|
2495
|
+
return function() {
|
|
2496
|
+
document.removeEventListener("keydown", onKey);
|
|
2497
|
+
};
|
|
2498
|
+
}, []);
|
|
2499
|
+
react.useEffect(function() {
|
|
2500
|
+
var text = String(q || "").trim();
|
|
2501
|
+
if (!text) {
|
|
2502
|
+
rs[1]([]);
|
|
2503
|
+
es[1]("");
|
|
2504
|
+
return;
|
|
2505
|
+
}
|
|
2506
|
+
var alive = true;
|
|
2507
|
+
bs[1](true);
|
|
2508
|
+
es[1]("");
|
|
2509
|
+
var timer = setTimeout(function() {
|
|
2510
|
+
api.post("/domains/wb-shell/actions/search.query", { q: text, limit: 20 }).then(function(j) {
|
|
2511
|
+
if (!alive) return;
|
|
2512
|
+
var data = j && j.result || j || {};
|
|
2513
|
+
rs[1](data.items || []);
|
|
2514
|
+
if (data.partial) es[1](t("search_partial") + ": " + (data.failed || []).join("\u3001"));
|
|
2515
|
+
}).catch(function(e) {
|
|
2516
|
+
if (alive) es[1](String(e && e.message || e));
|
|
2517
|
+
}).then(function() {
|
|
2518
|
+
if (alive) bs[1](false);
|
|
2519
|
+
});
|
|
2520
|
+
}, 220);
|
|
2521
|
+
return function() {
|
|
2522
|
+
alive = false;
|
|
2523
|
+
clearTimeout(timer);
|
|
2524
|
+
};
|
|
2525
|
+
}, [q]);
|
|
2526
|
+
function pick(hit) {
|
|
2527
|
+
os[1](false);
|
|
2528
|
+
st[1]("");
|
|
2529
|
+
if (hit.url) {
|
|
2530
|
+
window.open(hit.url, "_blank", "noopener,noreferrer");
|
|
2531
|
+
return;
|
|
2532
|
+
}
|
|
2533
|
+
var addon = (props.addons || []).filter(function(a) {
|
|
2534
|
+
return a.id === hit.domainId;
|
|
2535
|
+
})[0];
|
|
2536
|
+
if (addon) props.go("addon:" + addon.id + ":" + (hit.view || ""));
|
|
2537
|
+
}
|
|
2538
|
+
return jsx.jsxs("div", { className: "wb-search-wrap", children: [
|
|
2539
|
+
jsx.jsxs("div", { className: "wb-search-bar", children: [
|
|
2540
|
+
jsx.jsx("span", { className: "wb-search-icon", children: "\u2315" }),
|
|
2541
|
+
jsx.jsx("input", {
|
|
2542
|
+
ref: inputRef,
|
|
2543
|
+
className: "wb-search-input",
|
|
2544
|
+
value: q,
|
|
2545
|
+
placeholder: t("search_placeholder"),
|
|
2546
|
+
onFocus: function() {
|
|
2547
|
+
os[1](true);
|
|
2548
|
+
},
|
|
2549
|
+
onChange: function(e) {
|
|
2550
|
+
st[1](e.target.value);
|
|
2551
|
+
os[1](true);
|
|
2552
|
+
},
|
|
2553
|
+
onKeyDown: function(e) {
|
|
2554
|
+
if (e.key === "Enter" && results.length) pick(results[0]);
|
|
2555
|
+
}
|
|
2556
|
+
}),
|
|
2557
|
+
jsx.jsx("kbd", { className: "wb-search-kbd", children: "\u2318K" })
|
|
2558
|
+
] }),
|
|
2559
|
+
open && String(q || "").trim() ? jsx.jsxs("div", { className: "wb-search-panel", children: [
|
|
2560
|
+
loading ? jsx.jsx("div", { className: "wb-search-empty", children: t("searching") }) : null,
|
|
2561
|
+
error ? jsx.jsx("div", { className: "wb-search-empty", children: error }) : null,
|
|
2562
|
+
!loading && !error && results.length === 0 ? jsx.jsx("div", { className: "wb-search-empty", children: t("search_none") }) : null,
|
|
2563
|
+
results.map(function(hit) {
|
|
2564
|
+
var addon = (props.addons || []).filter(function(a) {
|
|
2565
|
+
return a.id === hit.domainId;
|
|
2566
|
+
})[0];
|
|
2567
|
+
var title = addon ? addon.title || addon.id : hit.domainId;
|
|
2568
|
+
return jsx.jsxs("button", { type: "button", className: "wb-search-hit", onClick: function() {
|
|
2569
|
+
pick(hit);
|
|
2570
|
+
}, children: [
|
|
2571
|
+
jsx.jsx("span", { className: "wb-search-domain", children: title }),
|
|
2572
|
+
jsx.jsxs("span", { className: "wb-search-hit-main", children: [
|
|
2573
|
+
jsx.jsx("span", { className: "wb-search-hit-title", children: hit.title }),
|
|
2574
|
+
hit.snippet ? jsx.jsx("span", { className: "wb-search-hit-snippet", children: hit.snippet }) : null
|
|
2575
|
+
] })
|
|
2576
|
+
] }, hit.domainId + ":" + hit.id);
|
|
2577
|
+
})
|
|
2578
|
+
] }) : null
|
|
2579
|
+
] });
|
|
2580
|
+
}
|
|
1585
2581
|
function WorkbenchPage(props) {
|
|
1586
2582
|
var t = props.t;
|
|
1587
2583
|
var store = useAddonStore();
|
|
@@ -1591,6 +2587,7 @@ function WorkbenchPage(props) {
|
|
|
1591
2587
|
var navigation = react.useState({});
|
|
1592
2588
|
var viewParams = navigation[0];
|
|
1593
2589
|
var lang = currentLang();
|
|
2590
|
+
var api = useApi();
|
|
1594
2591
|
react.useEffect(function() {
|
|
1595
2592
|
ensureCss();
|
|
1596
2593
|
}, []);
|
|
@@ -1626,7 +2623,9 @@ function WorkbenchPage(props) {
|
|
|
1626
2623
|
go("addon:" + currentAddon.id + ":" + viewId, params);
|
|
1627
2624
|
}
|
|
1628
2625
|
}
|
|
1629
|
-
function cardIcon(title) {
|
|
2626
|
+
function cardIcon(id, title) {
|
|
2627
|
+
var m = registry.get(id) || registry.get("wb-addon-" + id);
|
|
2628
|
+
if (m && m.icon) return h(m.icon, { size: 18, strokeWidth: 1.9, "aria-hidden": "true" });
|
|
1630
2629
|
return String(title || "?").slice(0, 1);
|
|
1631
2630
|
}
|
|
1632
2631
|
function openAddon(a) {
|
|
@@ -1634,6 +2633,18 @@ function WorkbenchPage(props) {
|
|
|
1634
2633
|
var v = m && m.views && m.views[0] || a.views && a.views[0] || null;
|
|
1635
2634
|
go("addon:" + a.id + ":" + (v && v.id ? v.id : ""));
|
|
1636
2635
|
}
|
|
2636
|
+
react.useEffect(function() {
|
|
2637
|
+
navigateAddonHook = function(addonId) {
|
|
2638
|
+
var t2 = addons.filter(function(a) {
|
|
2639
|
+
return a && a.id === addonId;
|
|
2640
|
+
})[0];
|
|
2641
|
+
if (t2) openAddon(t2);
|
|
2642
|
+
return !!t2;
|
|
2643
|
+
};
|
|
2644
|
+
return function() {
|
|
2645
|
+
navigateAddonHook = null;
|
|
2646
|
+
};
|
|
2647
|
+
}, [addons]);
|
|
1637
2648
|
function pageHead(title, desc) {
|
|
1638
2649
|
return jsx.jsxs("div", { className: "wb-page-head", children: [
|
|
1639
2650
|
jsx.jsx("div", { className: "wb-page-top", children: [
|
|
@@ -1642,7 +2653,7 @@ function WorkbenchPage(props) {
|
|
|
1642
2653
|
}, children: "\u2190 " + t("back_home") })
|
|
1643
2654
|
] }),
|
|
1644
2655
|
jsx.jsxs("div", { className: "wb-page-title", children: [
|
|
1645
|
-
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(title) }),
|
|
2656
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(route, title) }),
|
|
1646
2657
|
jsx.jsx("h2", { children: title })
|
|
1647
2658
|
] }),
|
|
1648
2659
|
desc ? jsx.jsx("div", { className: "wb-page-desc", children: desc }) : null
|
|
@@ -1657,12 +2668,16 @@ function WorkbenchPage(props) {
|
|
|
1657
2668
|
openAddon(a);
|
|
1658
2669
|
}, children: [
|
|
1659
2670
|
jsx.jsxs("div", { className: "wb-home-top", children: [
|
|
1660
|
-
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(a.title || title) }),
|
|
2671
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(a.id, a.title || title) }),
|
|
1661
2672
|
jsx.jsx("span", { className: "wb-badge", children: "v" + (a.version || "?") })
|
|
1662
2673
|
] }),
|
|
1663
2674
|
jsx.jsx("div", { className: "wb-home-title", children: title }),
|
|
1664
2675
|
jsx.jsx("div", { className: "wb-home-desc", children: a.description || (count > 1 ? count + " " + t("views") : "") }),
|
|
1665
|
-
a.error ? jsx.jsx("div", { className: "wb-err", children: t("addon_error") + ": " + a.error }) : null
|
|
2676
|
+
a.error ? jsx.jsx("div", { className: "wb-err", children: t("addon_error") + ": " + a.error }) : null,
|
|
2677
|
+
jsx.jsxs("div", { className: "wb-home-foot", children: [
|
|
2678
|
+
jsx.jsx("span", { children: count ? count + " " + t("views") : "" }),
|
|
2679
|
+
jsx.jsx("b", { children: t("open") + " \u2192" })
|
|
2680
|
+
] })
|
|
1666
2681
|
] }, a.id);
|
|
1667
2682
|
}
|
|
1668
2683
|
function systemCard(key, icon, title, desc) {
|
|
@@ -1670,12 +2685,17 @@ function WorkbenchPage(props) {
|
|
|
1670
2685
|
go(key);
|
|
1671
2686
|
}, children: [
|
|
1672
2687
|
jsx.jsxs("div", { className: "wb-home-top", children: [
|
|
1673
|
-
jsx.jsx("span", { className: "wb-home-icon", children: icon })
|
|
2688
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(key, icon) })
|
|
1674
2689
|
] }),
|
|
1675
2690
|
jsx.jsx("div", { className: "wb-home-title", children: title }),
|
|
1676
|
-
jsx.jsx("div", { className: "wb-home-desc", children: desc })
|
|
2691
|
+
jsx.jsx("div", { className: "wb-home-desc", children: desc }),
|
|
2692
|
+
jsx.jsxs("div", { className: "wb-home-foot", children: [
|
|
2693
|
+
jsx.jsx("span", { children: "" }),
|
|
2694
|
+
jsx.jsx("b", { children: t("open") + " \u2192" })
|
|
2695
|
+
] })
|
|
1677
2696
|
] }, key);
|
|
1678
2697
|
}
|
|
2698
|
+
if (route === "agent") return SystemPages.agentAccessPage({ jsx, t, lang, api, head: pageHead });
|
|
1679
2699
|
if (route === "backup") {
|
|
1680
2700
|
return jsx.jsxs("div", { className: "wb-root", children: [
|
|
1681
2701
|
jsx.jsxs("div", { className: "wb-inner wb-wide", children: [pageHead(t("tab_backup"), t("backup_desc")), jsx.jsx(BackupTab, { t, lang, addons })] })
|
|
@@ -1696,19 +2716,20 @@ function WorkbenchPage(props) {
|
|
|
1696
2716
|
var addonTitle = currentAddon.title || pickTitle(activeView && activeView.title, lang) || currentAddon.id;
|
|
1697
2717
|
return jsx.jsxs("div", { className: "wb-root wb-immersive", children: [
|
|
1698
2718
|
jsx.jsxs("div", { className: "wb-immersive-bar", children: [
|
|
1699
|
-
jsx.
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
2719
|
+
jsx.jsxs("div", { className: "wb-immersive-left", children: [
|
|
2720
|
+
jsx.jsx("span", { className: "wb-immersive-icon", children: cardIcon(currentAddon.id, addonTitle) }),
|
|
2721
|
+
jsx.jsx("button", { className: "wb-back", onClick: function() {
|
|
2722
|
+
go("home");
|
|
2723
|
+
}, children: "\u2190 " + t("back_home") }),
|
|
2724
|
+
jsx.jsx(ViewTabs, { views: viewList, activeView, addonId: currentAddon.id, lang, go })
|
|
2725
|
+
] }),
|
|
1703
2726
|
jsx.jsxs("div", { className: "wb-immersive-title", children: [
|
|
1704
|
-
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(addonTitle) }),
|
|
1705
2727
|
jsx.jsx("span", { children: addonTitle }),
|
|
1706
2728
|
jsx.jsx("span", { className: "wb-badge", children: "v" + (currentAddon.version || "?") })
|
|
1707
2729
|
] })
|
|
1708
2730
|
] }),
|
|
1709
2731
|
jsx.jsxs("div", { className: "wb-immersive-main", children: [
|
|
1710
2732
|
jsx.jsxs("div", { className: "wb-inner wb-wide", children: [
|
|
1711
|
-
jsx.jsx(ViewTabs, { views: viewList, activeView, addonId: currentAddon.id, lang, go }),
|
|
1712
2733
|
currentAddon.error ? jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-err", children: t("addon_error") + ": " + currentAddon.error }) }) : canRender ? jsx.jsx(ViewOutlet, { view: activeView, viewProps: { api: apiFor(currentAddon.id), lang, addonId: currentAddon.id, t, viewParams, onNavigate: navigateView } }, currentAddon.id) : !viewList.length ? jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-msg", children: t("no_views") }) }) : jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-page-loading", children: jsx.jsx("div", { className: "wb-msg", style: { padding: "4px 0" }, children: lastAddonError ? t("addon_unavailable") + " \xB7 " + lastAddonError : t("addon_loading") }) }) })
|
|
1713
2734
|
] })
|
|
1714
2735
|
] })
|
|
@@ -1722,16 +2743,13 @@ function WorkbenchPage(props) {
|
|
|
1722
2743
|
go("account");
|
|
1723
2744
|
} })
|
|
1724
2745
|
] }),
|
|
2746
|
+
jsx.jsx(SearchPanel, { api, addons, go, t }),
|
|
1725
2747
|
addons.length ? jsx.jsx("div", { className: "wb-home-grid", children: addons.map(addonCard) }) : jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-msg wb-empty-cta", children: t("no_installed") }) }),
|
|
1726
2748
|
jsx.jsxs("div", { className: "wb-sec", children: [
|
|
1727
2749
|
jsx.jsx("h3", { children: t("manage") }),
|
|
1728
2750
|
jsx.jsx("span", { className: "wb-hint", children: t("home_hint") })
|
|
1729
2751
|
] }),
|
|
1730
|
-
jsx.
|
|
1731
|
-
systemCard("backup", "\u2913", t("tab_backup"), t("backup_desc")),
|
|
1732
|
-
systemCard("audit", "\u25A4", t("tab_audit"), t("audit_desc")),
|
|
1733
|
-
systemCard("account", "\u2601", t("tab_account"), t("account_desc"))
|
|
1734
|
-
] })
|
|
2752
|
+
jsx.jsx("div", { className: "wb-home-grid manage", children: SystemPages.manageCards({ t, systemCard }) })
|
|
1735
2753
|
] })
|
|
1736
2754
|
] });
|
|
1737
2755
|
}
|