dsh-workbench-host 0.7.0 → 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/client/client.js +851 -125
- package/lib/actions/action-render.js +102 -0
- package/lib/actions/actions.js +201 -116
- 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 +1 -1
- package/lib/infra/audit.js +2 -2
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -79,6 +79,8 @@ var require_locale = __commonJS({
|
|
|
79
79
|
search_none: "\u6CA1\u6709\u547D\u4E2D",
|
|
80
80
|
search_partial: "\u90E8\u5206\u57DF\u641C\u7D22\u5931\u8D25",
|
|
81
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",
|
|
82
84
|
tab_audit: "\u5BA1\u8BA1\u65E5\u5FD7",
|
|
83
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",
|
|
84
86
|
audit_filters: "\u7B5B\u9009",
|
|
@@ -251,6 +253,8 @@ var require_locale = __commonJS({
|
|
|
251
253
|
search_none: "No matches",
|
|
252
254
|
search_partial: "Some domains failed",
|
|
253
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",
|
|
254
258
|
tab_audit: "Audit log",
|
|
255
259
|
audit_desc: "A local ledger of who called which action and how it went; passwords and tokens are redacted",
|
|
256
260
|
audit_filters: "Filters",
|
|
@@ -453,6 +457,10 @@ var require_styles = __commonJS({
|
|
|
453
457
|
".wb-immersive-title .wb-home-icon{width:24px;height:24px;border-radius:7px;font-size:12px}",
|
|
454
458
|
".wb-immersive-main{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:18px 24px 24px}",
|
|
455
459
|
".wb-immersive-main>.wb-inner{max-width:none}",
|
|
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}",
|
|
456
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}}",
|
|
457
465
|
".wb-backup{display:flex;flex-direction:column;gap:14px}",
|
|
458
466
|
".wb-backup-item{display:flex;flex-direction:column}",
|
|
@@ -536,44 +544,44 @@ var require_styles = __commonJS({
|
|
|
536
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}",
|
|
537
545
|
".wb-root *{scrollbar-width:thin;scrollbar-color:color-mix(in oklab,currentColor 22%,transparent) transparent}",
|
|
538
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}",
|
|
539
|
-
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-page){width:100%;max-width:none;margin:0;padding:0;gap:16px;box-sizing:border-box}",
|
|
540
|
-
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-page) h2{font-size:20px;line-height:1.3;font-weight:680;letter-spacing:-.02em;margin:0}",
|
|
541
|
-
".wb-root :is(.wbc-sub,.wba-sub,.wbct-sub,.wbca-sub,.wbm-sub,.wbv-muted,.wbct-muted,.wbc-muted,.wba-muted,.wbca-muted,.wbm-muted){font-size:12.5px;line-height:1.55;color:var(--wb-muted)}",
|
|
542
|
-
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-page) > :is(.wbc-head,.wba-head,.wbct-head,.wbca-head,.wbm-head){padding-bottom:12px;border-bottom:1px solid var(--wb-border);align-items:flex-start}",
|
|
543
|
-
".wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-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}",
|
|
544
|
-
".wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-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)}",
|
|
545
|
-
".wb-root :is(.wbc-grid,.wbv-grid,.wba-grid,.wbct-grid,.wbca-grid,.wbm-grid){gap:12px}",
|
|
546
|
-
".wb-root :is(.wbc-kpi,.wbv-kpi,.wba-kpi,.wbct-kpi,.wbca-kpi,.wbm-kpi){font-size:26px;line-height:1.15;font-weight:680;letter-spacing:-.03em;font-variant-numeric:tabular-nums}",
|
|
547
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-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}",
|
|
548
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-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))}",
|
|
549
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):active:not(:disabled){transform:translateY(1px)}",
|
|
550
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):disabled{opacity:.45;cursor:not-allowed}",
|
|
551
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):is(.primary,.on){background:var(--wb-accent);border-color:var(--wb-accent);color:var(--dsw-alias-label-primary-inverted,#fff);font-weight:600}",
|
|
552
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn).primary:hover:not(:disabled){filter:brightness(1.06)}",
|
|
553
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):is(.danger){color:var(--wb-danger);border-color:color-mix(in oklab,var(--wb-danger) 40%,transparent);background:transparent}",
|
|
554
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn).danger:hover:not(:disabled){background:color-mix(in oklab,var(--wb-danger) 8%,var(--wb-card));border-color:var(--wb-danger)}",
|
|
555
|
-
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-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,.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}",
|
|
556
|
-
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field){gap:6px;font-size:12px}",
|
|
557
|
-
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) > :is(.wbc-label,.wbv-label,.wba-label,.wbct-label,.wbca-label,.wbm-label){font-size:11.5px;font-weight:600;letter-spacing:.02em;color:var(--wb-muted);opacity:1}",
|
|
558
|
-
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) :is(input,select,textarea),.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-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}",
|
|
559
|
-
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) :is(input,select,textarea):hover,.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input):hover{border-color:color-mix(in oklab,currentColor 26%,var(--wb-border))}",
|
|
560
|
-
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) :is(input,select,textarea):focus,.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input):focus{border-color:var(--wb-accent);box-shadow:0 0 0 3px color-mix(in oklab,var(--wb-accent) 14%,transparent);outline:none}",
|
|
561
|
-
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table){width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px}",
|
|
562
|
-
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-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)}",
|
|
563
|
-
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table) td{padding:10px;border-bottom:1px solid color-mix(in oklab,var(--wb-border) 70%,transparent);vertical-align:top}",
|
|
564
|
-
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table) tbody tr{transition:background .12s ease}",
|
|
565
|
-
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table) tbody tr:hover{background:color-mix(in oklab,var(--wb-accent) 4%,transparent)}",
|
|
566
|
-
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-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}",
|
|
567
|
-
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-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)}",
|
|
568
|
-
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-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)}",
|
|
569
|
-
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-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)}",
|
|
570
|
-
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-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}",
|
|
571
|
-
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-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))}",
|
|
572
|
-
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-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))}",
|
|
573
|
-
".wb-root :is(.wbc-empty,.wbv-empty,.wba-empty,.wbct-empty,.wbca-empty,.wbm-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}",
|
|
574
|
-
".wb-root :is(.wbc-json,.wbv-code,.wba-json,.wbct-json,.wbca-json,.wbm-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}",
|
|
575
|
-
".wb-root :is(.wbc-table-wrap,.wba-table-wrap,.wbct-table-wrap,.wbca-table-wrap,.wbm-table-wrap){overflow:auto;border:1px solid var(--wb-border);border-radius:var(--wb-radius-card);background:var(--wb-card)}",
|
|
576
|
-
".wb-root :is(.wbc-table-wrap,.wba-table-wrap,.wbct-table-wrap,.wbca-table-wrap,.wbm-table-wrap) :is(.wbc-table,.wba-table,.wbct-table,.wbca-table,.wbm-table){border:0}",
|
|
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}",
|
|
577
585
|
".wb-root .wba-pills{display:flex;flex-wrap:wrap;gap:6px}",
|
|
578
586
|
".wb-root .wba-list{display:flex;flex-direction:column;gap:8px}",
|
|
579
587
|
".wb-root .wba-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
@@ -582,10 +590,10 @@ var require_styles = __commonJS({
|
|
|
582
590
|
".wb-root .wba-card-num{font-size:22px;font-weight:700;font-variant-numeric:tabular-nums}",
|
|
583
591
|
".wb-root .wbct-list{display:flex;flex-direction:column;gap:8px}",
|
|
584
592
|
".wb-root .wb-home-icon svg{display:block}",
|
|
585
|
-
".wb-root :is(.wba-panel,.wbca-panel,.wbm-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)}",
|
|
586
|
-
".wb-root :is(.wba-panel,.wbca-panel,.wbm-panel,.wbc-panel) > h3{font-size:15px;font-weight:650;margin:0 0 12px}",
|
|
587
|
-
".wb-root :is(.wba-code,.wbca-code,.wbm-code,.wbc-code){font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.65;resize:vertical;min-height:90px}",
|
|
588
|
-
".wb-root :is(.wba-input,.wbca-input,.wbm-input,.wbc-input){min-height:34px}",
|
|
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}",
|
|
589
597
|
".wb-root .wbct-panel{margin-top:2px;border-color:color-mix(in oklab,var(--wb-accent) 30%,var(--wb-border))}",
|
|
590
598
|
".wb-root .wbct-pills{display:flex;flex-wrap:wrap;gap:8px 16px;padding:4px 0}",
|
|
591
599
|
".wb-root .wbct-check{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;cursor:pointer}",
|
|
@@ -597,7 +605,7 @@ var require_styles = __commonJS({
|
|
|
597
605
|
".wb-root .wbv-pill.warn{background:color-mix(in oklab,var(--wb-warn) 10%,transparent);color:var(--wb-warn)}",
|
|
598
606
|
".wb-root .wbv-pill.bad{background:color-mix(in oklab,var(--wb-danger) 10%,transparent);color:var(--wb-danger)}",
|
|
599
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}",
|
|
600
|
-
".wb-root :is(.wbc-row,.wba-row,.wbct-row,.wbca-row,.wbm-row){gap:8px}",
|
|
608
|
+
".wb-root :is(.wbc-row,.wba-row,.wbct-row,.wbca-row,.wbm-row,.wbml-row){gap:8px}",
|
|
601
609
|
// 首页与导航视觉
|
|
602
610
|
".wb-root .wb-inner{gap:18px;max-width:1120px}",
|
|
603
611
|
".wb-root .wb-hero{padding:6px 2px 2px;align-items:center}",
|
|
@@ -645,8 +653,8 @@ var require_styles = __commonJS({
|
|
|
645
653
|
".wb-root .wbm-detail-title strong{font-size:15px;line-height:1.4;overflow-wrap:anywhere}",
|
|
646
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)}",
|
|
647
655
|
".wb-root .wbm-detailpane .wbm-body{padding:0 16px 18px;margin:0}",
|
|
648
|
-
"@media (max-width:980px){.wb-root .wbm-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}}",
|
|
649
|
-
"@media (max-width:760px){.wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-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,.wbct-panel){padding:14px;border-radius:12px}.wb-root .wbm-layout,.wb-root .wbm-layout.has-detail{grid-template-columns:1fr}.wb-root .wbm-pane{max-height:none}.wb-root .wbm-rail{order:2}}",
|
|
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}}",
|
|
650
658
|
// 全宽模块页:去掉两侧留白,并把视图标签并入唯一的一层顶栏。
|
|
651
659
|
".wb-root .wb-inner{max-width:none}",
|
|
652
660
|
".wb-root .wb-immersive-main{padding:16px 22px 24px}",
|
|
@@ -675,6 +683,710 @@ var require_styles = __commonJS({
|
|
|
675
683
|
}
|
|
676
684
|
});
|
|
677
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
|
+
|
|
678
1390
|
// packages/shell/client/system-tabs.cjs
|
|
679
1391
|
var require_system_tabs = __commonJS({
|
|
680
1392
|
"packages/shell/client/system-tabs.cjs"(exports2, module2) {
|
|
@@ -827,11 +1539,11 @@ var require_system_tabs = __commonJS({
|
|
|
827
1539
|
var t = props.t;
|
|
828
1540
|
var lang = props.lang;
|
|
829
1541
|
var addons = props.addons || [];
|
|
830
|
-
var exportable = addons.filter(function(
|
|
831
|
-
return
|
|
1542
|
+
var exportable = addons.filter(function(a) {
|
|
1543
|
+
return a && a.backup && a.backup.export;
|
|
832
1544
|
});
|
|
833
|
-
var idsKey = exportable.map(function(
|
|
834
|
-
return
|
|
1545
|
+
var idsKey = exportable.map(function(a) {
|
|
1546
|
+
return a.id;
|
|
835
1547
|
}).join(",");
|
|
836
1548
|
var st = react2.useState({});
|
|
837
1549
|
var selected = st[0];
|
|
@@ -859,21 +1571,21 @@ var require_system_tabs = __commonJS({
|
|
|
859
1571
|
setSelected(function(prev) {
|
|
860
1572
|
var next = {};
|
|
861
1573
|
var changed = false;
|
|
862
|
-
exportable.forEach(function(
|
|
863
|
-
if (prev[
|
|
864
|
-
else next[
|
|
865
|
-
if (!prev[
|
|
1574
|
+
exportable.forEach(function(a) {
|
|
1575
|
+
if (prev[a.id]) next[a.id] = true;
|
|
1576
|
+
else next[a.id] = true;
|
|
1577
|
+
if (!prev[a.id]) changed = true;
|
|
866
1578
|
});
|
|
867
1579
|
Object.keys(prev).forEach(function(id) {
|
|
868
|
-
if (!exportable.some(function(
|
|
869
|
-
return
|
|
1580
|
+
if (!exportable.some(function(a) {
|
|
1581
|
+
return a.id === id;
|
|
870
1582
|
})) changed = true;
|
|
871
1583
|
});
|
|
872
1584
|
return changed ? next : prev;
|
|
873
1585
|
});
|
|
874
1586
|
}, [idsKey]);
|
|
875
|
-
var allSelected = exportable.length > 0 && exportable.every(function(
|
|
876
|
-
return selected[
|
|
1587
|
+
var allSelected = exportable.length > 0 && exportable.every(function(a) {
|
|
1588
|
+
return selected[a.id];
|
|
877
1589
|
});
|
|
878
1590
|
function toggle(id) {
|
|
879
1591
|
var next = Object.assign({}, selected);
|
|
@@ -882,8 +1594,8 @@ var require_system_tabs = __commonJS({
|
|
|
882
1594
|
}
|
|
883
1595
|
function selectAll(flag) {
|
|
884
1596
|
var next = {};
|
|
885
|
-
exportable.forEach(function(
|
|
886
|
-
next[
|
|
1597
|
+
exportable.forEach(function(a) {
|
|
1598
|
+
next[a.id] = flag;
|
|
887
1599
|
});
|
|
888
1600
|
setSelected(next);
|
|
889
1601
|
}
|
|
@@ -917,11 +1629,11 @@ var require_system_tabs = __commonJS({
|
|
|
917
1629
|
}
|
|
918
1630
|
function doExport() {
|
|
919
1631
|
if (busy) return;
|
|
920
|
-
var chosen = exportable.filter(function(
|
|
921
|
-
return selected[
|
|
1632
|
+
var chosen = exportable.filter(function(a) {
|
|
1633
|
+
return selected[a.id];
|
|
922
1634
|
});
|
|
923
|
-
var ids = chosen.map(function(
|
|
924
|
-
return
|
|
1635
|
+
var ids = chosen.map(function(a) {
|
|
1636
|
+
return a.id;
|
|
925
1637
|
});
|
|
926
1638
|
if (!ids.length) {
|
|
927
1639
|
setMsg(t("backup_select_required"));
|
|
@@ -945,22 +1657,22 @@ var require_system_tabs = __commonJS({
|
|
|
945
1657
|
var name = m ? m[1] : "dsh-workbench-backup.zip";
|
|
946
1658
|
return r.blob().then(function(blob) {
|
|
947
1659
|
var href = URL.createObjectURL(blob);
|
|
948
|
-
var
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
document.body.appendChild(
|
|
952
|
-
|
|
953
|
-
|
|
1660
|
+
var a = document.createElement("a");
|
|
1661
|
+
a.href = href;
|
|
1662
|
+
a.download = name;
|
|
1663
|
+
document.body.appendChild(a);
|
|
1664
|
+
a.click();
|
|
1665
|
+
a.remove();
|
|
954
1666
|
setTimeout(function() {
|
|
955
1667
|
URL.revokeObjectURL(href);
|
|
956
1668
|
}, 1500);
|
|
957
1669
|
setMsg(t("backup_download_started"));
|
|
958
1670
|
var rows = [];
|
|
959
|
-
chosen.forEach(function(
|
|
960
|
-
var tables =
|
|
961
|
-
if (!tables.length) rows.push({ id:
|
|
1671
|
+
chosen.forEach(function(a2) {
|
|
1672
|
+
var tables = a2.tables || [];
|
|
1673
|
+
if (!tables.length) rows.push({ id: a2.id + ":*", table: "\u2014", module: a2.title || a2.id, version: a2.version });
|
|
962
1674
|
tables.forEach(function(table) {
|
|
963
|
-
rows.push({ id:
|
|
1675
|
+
rows.push({ id: a2.id + ":" + table, table, module: a2.title || a2.id, version: a2.version });
|
|
964
1676
|
});
|
|
965
1677
|
});
|
|
966
1678
|
setExported(rows);
|
|
@@ -979,8 +1691,8 @@ var require_system_tabs = __commonJS({
|
|
|
979
1691
|
setMsg("");
|
|
980
1692
|
setReport(null);
|
|
981
1693
|
var policyMap = {};
|
|
982
|
-
exportable.forEach(function(
|
|
983
|
-
policyMap[
|
|
1694
|
+
exportable.forEach(function(a) {
|
|
1695
|
+
policyMap[a.id] = policyOf(a.id);
|
|
984
1696
|
});
|
|
985
1697
|
fetch("/workbench/api/backup/import", { method: "POST", headers: { "content-type": "application/zip", "x-wb-backup-policy": JSON.stringify(policyMap) }, body: file }).then(function(r) {
|
|
986
1698
|
if (r.status === 422) {
|
|
@@ -1006,10 +1718,10 @@ var require_system_tabs = __commonJS({
|
|
|
1006
1718
|
setBusy("");
|
|
1007
1719
|
});
|
|
1008
1720
|
}
|
|
1009
|
-
function moduleCaps(
|
|
1721
|
+
function moduleCaps(a) {
|
|
1010
1722
|
var caps = [];
|
|
1011
|
-
if (
|
|
1012
|
-
if (
|
|
1723
|
+
if (a.backup && a.backup.export) caps.push(t("backup_cap_export"));
|
|
1724
|
+
if (a.backup && a.backup.import) caps.push(t("backup_cap_import"));
|
|
1013
1725
|
return caps.join(" \xB7 ");
|
|
1014
1726
|
}
|
|
1015
1727
|
return jsx2.jsxs("div", { className: "wb-backup", children: [
|
|
@@ -1025,18 +1737,18 @@ var require_system_tabs = __commonJS({
|
|
|
1025
1737
|
}, children: t("backup_clear") })
|
|
1026
1738
|
] })
|
|
1027
1739
|
] }),
|
|
1028
|
-
exportable.length ? jsx2.jsx("div", { className: "wb-stack", style: { marginTop: 10 }, children: exportable.map(function(
|
|
1029
|
-
var open = !!openConfig[
|
|
1740
|
+
exportable.length ? jsx2.jsx("div", { className: "wb-stack", style: { marginTop: 10 }, children: exportable.map(function(a) {
|
|
1741
|
+
var open = !!openConfig[a.id];
|
|
1030
1742
|
return jsx2.jsxs(react2.Fragment, { children: [
|
|
1031
1743
|
jsx2.jsxs("div", { className: "wb-backup-row" + (open ? " open" : ""), children: [
|
|
1032
1744
|
jsx2.jsxs("label", { className: "wb-backup-row-main", children: [
|
|
1033
|
-
jsx2.jsx("input", { type: "checkbox", checked: !!selected[
|
|
1034
|
-
toggle(
|
|
1745
|
+
jsx2.jsx("input", { type: "checkbox", checked: !!selected[a.id], onChange: function() {
|
|
1746
|
+
toggle(a.id);
|
|
1035
1747
|
} }),
|
|
1036
1748
|
jsx2.jsxs("span", { className: "wb-backup-main", children: [
|
|
1037
|
-
jsx2.jsxs("span", { className: "wb-backup-name", children: [
|
|
1038
|
-
jsx2.jsx("span", { className: "wb-backup-meta", children: moduleCaps(
|
|
1039
|
-
|
|
1749
|
+
jsx2.jsxs("span", { className: "wb-backup-name", children: [a.title || a.id, jsx2.jsx("span", { className: "wb-badge", children: "v" + (a.version || "?") })] }),
|
|
1750
|
+
jsx2.jsx("span", { className: "wb-backup-meta", children: moduleCaps(a) }),
|
|
1751
|
+
a.description ? jsx2.jsx("span", { className: "wb-backup-meta", children: a.description }) : null
|
|
1040
1752
|
] })
|
|
1041
1753
|
] }),
|
|
1042
1754
|
jsx2.jsx("button", {
|
|
@@ -1046,7 +1758,7 @@ var require_system_tabs = __commonJS({
|
|
|
1046
1758
|
"aria-label": t("backup_dup_policy"),
|
|
1047
1759
|
"aria-expanded": open,
|
|
1048
1760
|
onClick: function() {
|
|
1049
|
-
toggleConfig(
|
|
1761
|
+
toggleConfig(a.id);
|
|
1050
1762
|
},
|
|
1051
1763
|
children: "\u2699"
|
|
1052
1764
|
})
|
|
@@ -1055,9 +1767,9 @@ var require_system_tabs = __commonJS({
|
|
|
1055
1767
|
jsx2.jsx("span", { className: "wb-backup-config-label", children: t("backup_dup_policy") }),
|
|
1056
1768
|
jsx2.jsx("select", {
|
|
1057
1769
|
className: "wb-select",
|
|
1058
|
-
value: policyOf(
|
|
1770
|
+
value: policyOf(a.id),
|
|
1059
1771
|
onChange: function(e) {
|
|
1060
|
-
setPolicy(
|
|
1772
|
+
setPolicy(a.id, e.target.value);
|
|
1061
1773
|
},
|
|
1062
1774
|
children: [
|
|
1063
1775
|
jsx2.jsx("option", { value: "newest", children: t("backup_dup_newest") }),
|
|
@@ -1067,7 +1779,7 @@ var require_system_tabs = __commonJS({
|
|
|
1067
1779
|
}),
|
|
1068
1780
|
jsx2.jsx("span", { className: "wb-backup-note", children: t("backup_dup_hint") })
|
|
1069
1781
|
] }) : null
|
|
1070
|
-
] },
|
|
1782
|
+
] }, a.id);
|
|
1071
1783
|
}) }) : jsx2.jsx("div", { className: "wb-msg", children: t("backup_no_modules") }),
|
|
1072
1784
|
jsx2.jsxs("div", { className: "wb-backup-actions", style: { marginTop: 12 }, children: [
|
|
1073
1785
|
jsx2.jsx("button", { className: "wb-btn", disabled: !!busy || !exportable.length, onClick: doExport, children: busy === "export" ? t("backup_exporting") : t("backup_export") }),
|
|
@@ -1084,11 +1796,11 @@ var require_system_tabs = __commonJS({
|
|
|
1084
1796
|
jsx2.jsx("h3", { children: t("backup_export_result") }),
|
|
1085
1797
|
jsx2.jsx("span", { className: "wb-hint", children: t("backup_download_started") })
|
|
1086
1798
|
] }),
|
|
1087
|
-
jsx2.jsx("div", { className: "wb-stack", children: exported.map(function(
|
|
1799
|
+
jsx2.jsx("div", { className: "wb-stack", children: exported.map(function(a) {
|
|
1088
1800
|
return jsx2.jsxs("div", { className: "wb-backup-result-row", children: [
|
|
1089
|
-
jsx2.jsx("span", { className: "wb-backup-table", children:
|
|
1090
|
-
jsx2.jsxs("span", { className: "wb-backup-meta", children: [
|
|
1091
|
-
] },
|
|
1801
|
+
jsx2.jsx("span", { className: "wb-backup-table", children: a.table }),
|
|
1802
|
+
jsx2.jsxs("span", { className: "wb-backup-meta", children: [a.module, jsx2.jsx("span", { className: "wb-badge", children: "v" + (a.version || "?") })] })
|
|
1803
|
+
] }, a.id);
|
|
1092
1804
|
}) })
|
|
1093
1805
|
] }) : null,
|
|
1094
1806
|
report ? jsx2.jsxs("div", { className: "wb-card wb-backup-report", children: [
|
|
@@ -1452,6 +2164,7 @@ var h = react.createElement;
|
|
|
1452
2164
|
var NS = "workbench";
|
|
1453
2165
|
var LOCALE = require_locale();
|
|
1454
2166
|
var CSS = require_styles();
|
|
2167
|
+
var SystemPages = require_system_pages();
|
|
1455
2168
|
var registry = /* @__PURE__ */ new Map();
|
|
1456
2169
|
var listeners = /* @__PURE__ */ new Set();
|
|
1457
2170
|
var apiCache = /* @__PURE__ */ new Map();
|
|
@@ -1554,8 +2267,8 @@ function setAddons(list) {
|
|
|
1554
2267
|
addonState.addons = Array.isArray(list) ? list : [];
|
|
1555
2268
|
addonState.loaded = true;
|
|
1556
2269
|
var alive = {};
|
|
1557
|
-
addonState.addons.forEach(function(
|
|
1558
|
-
alive[
|
|
2270
|
+
addonState.addons.forEach(function(a) {
|
|
2271
|
+
alive[a.id] = a;
|
|
1559
2272
|
});
|
|
1560
2273
|
registry.forEach(function(_m, id) {
|
|
1561
2274
|
if (!alive[id]) registry.delete(id);
|
|
@@ -1622,6 +2335,7 @@ function useAddonStore() {
|
|
|
1622
2335
|
}, []);
|
|
1623
2336
|
return addonState;
|
|
1624
2337
|
}
|
|
2338
|
+
var navigateAddonHook = null;
|
|
1625
2339
|
window.__WB_HOST__ = {
|
|
1626
2340
|
react,
|
|
1627
2341
|
jsx,
|
|
@@ -1632,6 +2346,9 @@ window.__WB_HOST__ = {
|
|
|
1632
2346
|
},
|
|
1633
2347
|
error: function() {
|
|
1634
2348
|
return lastAddonError;
|
|
2349
|
+
},
|
|
2350
|
+
navigateAddon: function(addonId) {
|
|
2351
|
+
return typeof navigateAddonHook === "function" && !!addonId && navigateAddonHook(String(addonId)) !== false;
|
|
1635
2352
|
}
|
|
1636
2353
|
};
|
|
1637
2354
|
function useApi() {
|
|
@@ -1813,8 +2530,8 @@ function SearchPanel(props) {
|
|
|
1813
2530
|
window.open(hit.url, "_blank", "noopener,noreferrer");
|
|
1814
2531
|
return;
|
|
1815
2532
|
}
|
|
1816
|
-
var addon = (props.addons || []).filter(function(
|
|
1817
|
-
return
|
|
2533
|
+
var addon = (props.addons || []).filter(function(a) {
|
|
2534
|
+
return a.id === hit.domainId;
|
|
1818
2535
|
})[0];
|
|
1819
2536
|
if (addon) props.go("addon:" + addon.id + ":" + (hit.view || ""));
|
|
1820
2537
|
}
|
|
@@ -1844,8 +2561,8 @@ function SearchPanel(props) {
|
|
|
1844
2561
|
error ? jsx.jsx("div", { className: "wb-search-empty", children: error }) : null,
|
|
1845
2562
|
!loading && !error && results.length === 0 ? jsx.jsx("div", { className: "wb-search-empty", children: t("search_none") }) : null,
|
|
1846
2563
|
results.map(function(hit) {
|
|
1847
|
-
var addon = (props.addons || []).filter(function(
|
|
1848
|
-
return
|
|
2564
|
+
var addon = (props.addons || []).filter(function(a) {
|
|
2565
|
+
return a.id === hit.domainId;
|
|
1849
2566
|
})[0];
|
|
1850
2567
|
var title = addon ? addon.title || addon.id : hit.domainId;
|
|
1851
2568
|
return jsx.jsxs("button", { type: "button", className: "wb-search-hit", onClick: function() {
|
|
@@ -1874,15 +2591,15 @@ function WorkbenchPage(props) {
|
|
|
1874
2591
|
react.useEffect(function() {
|
|
1875
2592
|
ensureCss();
|
|
1876
2593
|
}, []);
|
|
1877
|
-
var addons = (store.addons || []).filter(function(
|
|
1878
|
-
return
|
|
2594
|
+
var addons = (store.addons || []).filter(function(a) {
|
|
2595
|
+
return a && a.enabled;
|
|
1879
2596
|
});
|
|
1880
2597
|
var currentAddon = null;
|
|
1881
2598
|
if (route.indexOf("addon:") === 0) {
|
|
1882
2599
|
var parts = route.split(":");
|
|
1883
2600
|
var wanted = parts[1] || "";
|
|
1884
|
-
addons.forEach(function(
|
|
1885
|
-
if (
|
|
2601
|
+
addons.forEach(function(a) {
|
|
2602
|
+
if (a.id === wanted) currentAddon = a;
|
|
1886
2603
|
});
|
|
1887
2604
|
}
|
|
1888
2605
|
var mod = currentAddon ? registry.get(currentAddon.id) : null;
|
|
@@ -1911,11 +2628,23 @@ function WorkbenchPage(props) {
|
|
|
1911
2628
|
if (m && m.icon) return h(m.icon, { size: 18, strokeWidth: 1.9, "aria-hidden": "true" });
|
|
1912
2629
|
return String(title || "?").slice(0, 1);
|
|
1913
2630
|
}
|
|
1914
|
-
function openAddon(
|
|
1915
|
-
var m = registry.get(
|
|
1916
|
-
var v = m && m.views && m.views[0] ||
|
|
1917
|
-
go("addon:" +
|
|
2631
|
+
function openAddon(a) {
|
|
2632
|
+
var m = registry.get(a.id);
|
|
2633
|
+
var v = m && m.views && m.views[0] || a.views && a.views[0] || null;
|
|
2634
|
+
go("addon:" + a.id + ":" + (v && v.id ? v.id : ""));
|
|
1918
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]);
|
|
1919
2648
|
function pageHead(title, desc) {
|
|
1920
2649
|
return jsx.jsxs("div", { className: "wb-page-head", children: [
|
|
1921
2650
|
jsx.jsx("div", { className: "wb-page-top", children: [
|
|
@@ -1924,32 +2653,32 @@ function WorkbenchPage(props) {
|
|
|
1924
2653
|
}, children: "\u2190 " + t("back_home") })
|
|
1925
2654
|
] }),
|
|
1926
2655
|
jsx.jsxs("div", { className: "wb-page-title", children: [
|
|
1927
|
-
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(
|
|
2656
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(route, title) }),
|
|
1928
2657
|
jsx.jsx("h2", { children: title })
|
|
1929
2658
|
] }),
|
|
1930
2659
|
desc ? jsx.jsx("div", { className: "wb-page-desc", children: desc }) : null
|
|
1931
2660
|
] });
|
|
1932
2661
|
}
|
|
1933
|
-
function addonCard(
|
|
1934
|
-
var m = registry.get(
|
|
1935
|
-
var v = m && m.views && m.views[0] ||
|
|
1936
|
-
var title =
|
|
1937
|
-
var count = m && m.views ? m.views.length :
|
|
1938
|
-
return jsx.jsxs("button", { type: "button", className: "wb-home-card" + (
|
|
1939
|
-
openAddon(
|
|
2662
|
+
function addonCard(a) {
|
|
2663
|
+
var m = registry.get(a.id);
|
|
2664
|
+
var v = m && m.views && m.views[0] || a.views && a.views[0] || null;
|
|
2665
|
+
var title = a.title || pickTitle(v && v.title, lang) || a.id;
|
|
2666
|
+
var count = m && m.views ? m.views.length : a.views ? a.views.length : 0;
|
|
2667
|
+
return jsx.jsxs("button", { type: "button", className: "wb-home-card" + (a.error ? " dim" : ""), onClick: function() {
|
|
2668
|
+
openAddon(a);
|
|
1940
2669
|
}, children: [
|
|
1941
2670
|
jsx.jsxs("div", { className: "wb-home-top", children: [
|
|
1942
|
-
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(
|
|
1943
|
-
jsx.jsx("span", { className: "wb-badge", children: "v" + (
|
|
2671
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(a.id, a.title || title) }),
|
|
2672
|
+
jsx.jsx("span", { className: "wb-badge", children: "v" + (a.version || "?") })
|
|
1944
2673
|
] }),
|
|
1945
2674
|
jsx.jsx("div", { className: "wb-home-title", children: title }),
|
|
1946
|
-
jsx.jsx("div", { className: "wb-home-desc", children:
|
|
1947
|
-
|
|
2675
|
+
jsx.jsx("div", { className: "wb-home-desc", children: a.description || (count > 1 ? count + " " + t("views") : "") }),
|
|
2676
|
+
a.error ? jsx.jsx("div", { className: "wb-err", children: t("addon_error") + ": " + a.error }) : null,
|
|
1948
2677
|
jsx.jsxs("div", { className: "wb-home-foot", children: [
|
|
1949
2678
|
jsx.jsx("span", { children: count ? count + " " + t("views") : "" }),
|
|
1950
2679
|
jsx.jsx("b", { children: t("open") + " \u2192" })
|
|
1951
2680
|
] })
|
|
1952
|
-
] },
|
|
2681
|
+
] }, a.id);
|
|
1953
2682
|
}
|
|
1954
2683
|
function systemCard(key, icon, title, desc) {
|
|
1955
2684
|
return jsx.jsxs("button", { type: "button", className: "wb-home-card", onClick: function() {
|
|
@@ -1966,6 +2695,7 @@ function WorkbenchPage(props) {
|
|
|
1966
2695
|
] })
|
|
1967
2696
|
] }, key);
|
|
1968
2697
|
}
|
|
2698
|
+
if (route === "agent") return SystemPages.agentAccessPage({ jsx, t, lang, api, head: pageHead });
|
|
1969
2699
|
if (route === "backup") {
|
|
1970
2700
|
return jsx.jsxs("div", { className: "wb-root", children: [
|
|
1971
2701
|
jsx.jsxs("div", { className: "wb-inner wb-wide", children: [pageHead(t("tab_backup"), t("backup_desc")), jsx.jsx(BackupTab, { t, lang, addons })] })
|
|
@@ -2019,11 +2749,7 @@ function WorkbenchPage(props) {
|
|
|
2019
2749
|
jsx.jsx("h3", { children: t("manage") }),
|
|
2020
2750
|
jsx.jsx("span", { className: "wb-hint", children: t("home_hint") })
|
|
2021
2751
|
] }),
|
|
2022
|
-
jsx.
|
|
2023
|
-
systemCard("backup", "backup", t("tab_backup"), t("backup_desc")),
|
|
2024
|
-
systemCard("audit", "audit", t("tab_audit"), t("audit_desc")),
|
|
2025
|
-
systemCard("account", "account", t("tab_account"), t("account_desc"))
|
|
2026
|
-
] })
|
|
2752
|
+
jsx.jsx("div", { className: "wb-home-grid manage", children: SystemPages.manageCards({ t, systemCard }) })
|
|
2027
2753
|
] })
|
|
2028
2754
|
] });
|
|
2029
2755
|
}
|