dsh-workbench-tasks 5.5.0 → 5.5.4

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/lib/client.js CHANGED
@@ -4895,1048 +4895,6 @@ var require_stats = __commonJS({
4895
4895
  }
4896
4896
  });
4897
4897
 
4898
- // packages/addons/lib/data-copy.cjs
4899
- var require_data_copy = __commonJS({
4900
- "packages/addons/lib/data-copy.cjs"(exports2, module2) {
4901
- "use strict";
4902
- var COPY = {
4903
- zh: {
4904
- title: "\u6570\u636E",
4905
- subtitle: "\u53EA\u8BFB\u6D4F\u89C8\u672C\u63D2\u4EF6\u8D1F\u8D23\u7684\u8868\uFF1B\u7CFB\u7EDF\u5217\u4E0E\u5DF2\u5220\u9664\u884C\u9ED8\u8BA4\u9690\u85CF",
4906
- tables: "\u8868",
4907
- rows: "\u884C",
4908
- deleted: "\u5DF2\u5220\u9664",
4909
- rowCount: "\u5171 {n} \u884C",
4910
- deletedCount: "\u5176\u4E2D {n} \u884C\u5DF2\u5220\u9664",
4911
- search: "\u641C\u7D22\u6240\u6709\u6587\u672C\u5217\u2026",
4912
- pageSize: "\u6BCF\u9875",
4913
- includeDeleted: "\u542B\u5DF2\u5220\u9664",
4914
- showSystem: "\u7CFB\u7EDF\u5217",
4915
- refresh: "\u5237\u65B0",
4916
- loading: "\u8F7D\u5165\u4E2D\u2026",
4917
- empty: "\u8FD9\u5F20\u8868\u8FD8\u6CA1\u6709\u6570\u636E",
4918
- emptyTable: "\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u8868",
4919
- loadFail: "\u6570\u636E\u670D\u52A1\u4E0D\u53EF\u7528\uFF08\u63D2\u4EF6\u7248\u672C\u8FC7\u65E7\uFF1F\uFF09",
4920
- retry: "\u91CD\u8BD5",
4921
- queryFail: "\u67E5\u8BE2\u5931\u8D25\uFF1A",
4922
- noRows: "\u6CA1\u6709\u5339\u914D\u7684\u884C",
4923
- prev: "\u4E0A\u4E00\u9875",
4924
- next: "\u4E0B\u4E00\u9875",
4925
- pageInfo: "\u7B2C {page} / {pages} \u9875",
4926
- jump: "\u8DF3\u8F6C",
4927
- total: "\u5171 {n} \u884C",
4928
- copied: "\u5DF2\u590D\u5236",
4929
- copy: "\u590D\u5236",
4930
- close: "\u5173\u95ED",
4931
- drawerTitle: "{column} \xB7 \u7B2C {row} \u884C",
4932
- nullText: "NULL",
4933
- emptyText: "\u7A7A",
4934
- yes: "\u662F",
4935
- no: "\u5426",
4936
- json: "JSON",
4937
- queryTime: "{n} ms",
4938
- sortAsc: "\u5347\u5E8F",
4939
- sortDesc: "\u964D\u5E8F",
4940
- filterCol: "\u7B5B\u9009\u2026",
4941
- filterClear: "\u6E05\u9664\u7B5B\u9009",
4942
- index: "\u8868\u7D22\u5F15",
4943
- indexSub: "\u5F53\u524D\u9009\u4E2D\u8868\u7684\u7D22\u5F15\uFF08\u53EA\u8BFB\uFF09\uFF1B\u884C\u6570\u4E3A\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
4944
- idxName: "\u7D22\u5F15\u540D",
4945
- idxColumns: "\u5217",
4946
- idxType: "\u7C7B\u578B",
4947
- idxSource: "\u6765\u6E90",
4948
- idxUnique: "\u552F\u4E00",
4949
- idxNormal: "\u666E\u901A",
4950
- idxAuto: "\u81EA\u52A8",
4951
- idxCreated: "\u663E\u5F0F\u521B\u5EFA",
4952
- idxCount: "\u5171 {n} \u4E2A\u7D22\u5F15",
4953
- idxNoExtra: "\u8BE5\u8868\u9664\u4E3B\u952E\u5916\u6CA1\u6709\u989D\u5916\u7D22\u5F15",
4954
- idxRowsHelp: "\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF08\u542B\u5DF2\u5220\u9664\u884C\uFF09\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
4955
- idxTable: "\u8868",
4956
- idxRows: "\u884C\u6570",
4957
- idxCols: "\u5217\u6570",
4958
- idxKey: "\u4E3B\u952E",
4959
- idxIndexes: "\u7D22\u5F15",
4960
- idxLastWrite: "\u6700\u8FD1\u5199\u5165",
4961
- idxNone: "\u65E0",
4962
- idxEmpty: "\u5F53\u524D\u8868\u6CA1\u6709\u53EF\u7528\u7684\u7D22\u5F15\u7EDF\u8BA1",
4963
- idxTables: "\u8868",
4964
- idxAt: "\u7EDF\u8BA1\u65F6\u95F4"
4965
- },
4966
- en: {
4967
- title: "Data",
4968
- subtitle: "Read-only view of this plugin's tables; system and deleted rows are hidden by default",
4969
- tables: "Tables",
4970
- rows: "rows",
4971
- deleted: "deleted",
4972
- rowCount: "{n} rows",
4973
- deletedCount: "{n} deleted",
4974
- search: "Search all text columns\u2026",
4975
- pageSize: "Rows",
4976
- includeDeleted: "Deleted",
4977
- showSystem: "System",
4978
- refresh: "Refresh",
4979
- loading: "Loading\u2026",
4980
- empty: "This table has no rows yet",
4981
- emptyTable: "No tables to show",
4982
- loadFail: "Data service unavailable (plugin too old?)",
4983
- retry: "Retry",
4984
- queryFail: "Query failed: ",
4985
- noRows: "No matching rows",
4986
- prev: "Previous",
4987
- next: "Next",
4988
- pageInfo: "Page {page} / {pages}",
4989
- jump: "Jump",
4990
- total: "{n} rows",
4991
- copied: "Copied",
4992
- copy: "Copy",
4993
- close: "Close",
4994
- drawerTitle: "{column} \xB7 row {row}",
4995
- nullText: "NULL",
4996
- emptyText: "empty",
4997
- yes: "Yes",
4998
- no: "No",
4999
- json: "JSON",
5000
- queryTime: "{n} ms",
5001
- sortAsc: "ascending",
5002
- sortDesc: "descending",
5003
- filterCol: "Filter\u2026",
5004
- filterClear: "Clear filter",
5005
- index: "Table index",
5006
- indexSub: "Indexes of the selected table (read-only); rows are the table total, not index entries",
5007
- idxName: "Index name",
5008
- idxColumns: "Columns",
5009
- idxType: "Type",
5010
- idxSource: "Source",
5011
- idxUnique: "Unique",
5012
- idxNormal: "Normal",
5013
- idxAuto: "Automatic",
5014
- idxCreated: "Explicit",
5015
- idxCount: "{n} indexes",
5016
- idxNoExtra: "This table has no indexes other than its primary key",
5017
- idxRowsHelp: "Total table rows (including deleted rows), not index entries",
5018
- idxTable: "Table",
5019
- idxRows: "Rows",
5020
- idxCols: "Cols",
5021
- idxKey: "Primary key",
5022
- idxIndexes: "Indexes",
5023
- idxLastWrite: "Last write",
5024
- idxNone: "\u2014",
5025
- idxEmpty: "No index statistics available for this table",
5026
- idxTables: "Tables",
5027
- idxAt: "Generated"
5028
- }
5029
- };
5030
- module2.exports = COPY;
5031
- }
5032
- });
5033
-
5034
- // packages/addons/lib/visual-tokens.cjs
5035
- var require_visual_tokens = __commonJS({
5036
- "packages/addons/lib/visual-tokens.cjs"(exports2, module2) {
5037
- module2.exports = `
5038
- :where(.wbt-root,.wbi-root,.wbi-cfg,.wbt-data,.wbs-data,.wbg-data,.wbi-data,.wb-desc){--wb-radius-sm:8px;--wb-radius-card:12px;--wb-space-sm:8px;--wb-space-md:14px;--wb-border:var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent));--wb-description-bg:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 7%,transparent);--wb-description-line:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 34%,transparent);--wb-motion:140ms;--wb-btn-bg:transparent;--wb-btn-hover-bg:color-mix(in oklab,currentColor 6%,transparent);--wb-btn-active-bg:color-mix(in oklab,currentColor 11%,transparent);--wb-btn-primary-bg:var(--dsw-alias-brand-primary,#2563eb);--wb-btn-primary-fg:var(--dsw-alias-label-primary-inverted,#fff);--wb-btn-danger-fg:var(--dsw-alias-state-error-primary,#b91c1c);--wb-btn-size-sm:32px;--wb-btn-focus:2px solid var(--dsw-alias-brand-primary,#2563eb);--wb-btn-focus-offset:2px}
5039
- .wb-desc{background:var(--wb-description-bg);border-left-color:var(--wb-description-line);border-radius:0 var(--wb-radius-sm) var(--wb-radius-sm) 0}
5040
- `;
5041
- }
5042
- });
5043
-
5044
- // packages/addons/lib/data-style.cjs
5045
- var require_data_style = __commonJS({
5046
- "packages/addons/lib/data-style.cjs"(exports2, module2) {
5047
- "use strict";
5048
- module2.exports = function(DOMAIN, PREFIX) {
5049
- var P = PREFIX + "-data";
5050
- var CSS = [
5051
- require_visual_tokens(),
5052
- "." + P + "-search:has(.wbi-svg) input{padding-left:30px}." + P + "-search>.wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%)}",
5053
- "." + P + "-btn{transition:background var(--wb-motion),border-color var(--wb-motion)}",
5054
- "@media(max-width:480px){." + P + "-head>." + P + "-btn:has(.wbi-svg){width:32px;height:32px;padding:0;justify-content:center}." + P + "-head>." + P + "-btn:has(.wbi-svg) ." + P + "-btnlabel{display:none}}",
5055
- "." + P + "{--cfg-line:var(--wb-border);--cfg-surface:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));--cfg-muted:var(--dsw-alias-label-secondary,color-mix(in oklab,currentColor 62%,transparent));--cfg-faint:var(--dsw-alias-label-tertiary,color-mix(in oklab,currentColor 42%,transparent));--cfg-hover:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent));display:grid;grid-template-columns:216px minmax(0,1fr);gap:16px;width:100%;min-width:0;color:inherit;font-size:13px;align-items:start}",
5056
- "." + P + "-side{position:sticky;top:12px;display:flex;flex-direction:column;gap:3px;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:8px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
5057
- "." + P + "-sidetitle{display:flex;align-items:center;justify-content:space-between;padding:6px 10px 8px;font-size:11px;font-weight:660;letter-spacing:.6px;text-transform:uppercase;color:var(--cfg-faint)}",
5058
- "." + P + "-stab{display:flex;flex-direction:column;gap:3px;align-items:stretch;border:1px solid transparent;background:transparent;border-radius:9px;padding:8px 10px;font:inherit;color:inherit;text-align:left;cursor:pointer;position:relative;transition:background .12s ease,border-color .12s ease}",
5059
- "." + P + "-stab:hover{background:var(--cfg-hover)}",
5060
- "." + P + "-stab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
5061
- "." + P + "-stab.on{background:color-mix(in oklab,currentColor 6%,transparent);border-color:var(--cfg-line)}",
5062
- "." + P + "-stab.on::before{content:'';position:absolute;left:-1px;top:9px;bottom:9px;width:2px;border-radius:2px;background:var(--dsw-alias-brand-primary,currentColor)}",
5063
- "." + P + "-stabname{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;line-height:1.4;min-width:0}",
5064
- "." + P + "-stabname span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
5065
- "." + P + "-sidetable{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;color:var(--cfg-muted);margin-top:3px;letter-spacing:.2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
5066
- "." + P + "-sidecount{margin-left:auto;font-size:10.5px;font-variant-numeric:tabular-nums;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 8%,transparent);border-radius:999px;padding:1px 7px;flex:none}",
5067
- "." + P + "-main{display:flex;flex-direction:column;gap:10px;min-width:0;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:14px 16px 12px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
5068
- "." + P + "-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}",
5069
- "." + P + "-headmain{min-width:0;flex:1}",
5070
- "." + P + "-head h2{margin:0;font-size:16px;font-weight:660;letter-spacing:.1px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
5071
- "." + P + "-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;font-weight:500;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 6%,transparent);border-radius:6px;padding:2px 6px}",
5072
- "." + P + "-sub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55;margin-top:4px}",
5073
- "." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:2px 0 4px}",
5074
- "." + P + "-search{position:relative;flex:1;min-width:180px;max-width:340px}",
5075
- "." + P + "-search input{width:100%;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:8px 11px;font:inherit;font-size:12.5px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}",
5076
- "." + P + "-search input:hover{border-color:color-mix(in oklab,currentColor 28%,var(--cfg-line))}",
5077
- "." + P + "-search input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
5078
- "." + P + "-select{border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:7px 10px;font:inherit;font-size:12px;outline:none}",
5079
- "." + P + "-select:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
5080
- "." + P + "-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--cfg-line);background:transparent;color:var(--cfg-muted);border-radius:8px;padding:6px 10px;font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease}",
5081
- "." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
5082
- "." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
5083
- "." + P + "-btn:disabled{opacity:.45;cursor:not-allowed}",
5084
- "." + P + "-btn[aria-busy='true']{opacity:.6}",
5085
- "." + P + "-tablewrap{overflow:auto;max-height:calc(100vh - 300px);border:1px solid var(--cfg-line);border-radius:11px;background:var(--dsw-alias-bg-base,transparent)}",
5086
- "." + P + "-table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:12.5px}",
5087
- "." + P + "-table th{position:sticky;top:0;z-index:2;background:var(--cfg-surface);border-bottom:1px solid var(--cfg-line);padding:0;text-align:left;font-weight:600;white-space:nowrap}",
5088
- "." + P + "-thbtn{display:flex;align-items:baseline;gap:6px;width:100%;border:0;background:transparent;color:inherit;font:inherit;font-size:11.5px;font-weight:660;letter-spacing:.2px;padding:9px 12px;cursor:pointer;text-align:left;white-space:nowrap}",
5089
- "." + P + "-thbtn:hover{background:var(--cfg-hover)}",
5090
- "." + P + "-thbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:-2px}",
5091
- "." + P + "-coltype{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:500;color:var(--cfg-faint);letter-spacing:.3px}",
5092
- "." + P + "-sortmark{color:var(--dsw-alias-brand-primary,currentColor);font-size:10px}",
5093
- "." + P + "-rownum{position:sticky;left:0;z-index:1;background:var(--cfg-surface);color:var(--cfg-faint);text-align:right;font-variant-numeric:tabular-nums;font-size:10.5px;padding:0 8px;width:1%;white-space:nowrap;border-right:1px solid color-mix(in oklab,currentColor 7%,transparent)}",
5094
- "." + P + "-table thead ." + P + "-rownum{z-index:3}",
5095
- "." + P + "-cell{padding:7px 12px;border-bottom:1px solid color-mix(in oklab,currentColor 6%,transparent);max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:default;vertical-align:top}",
5096
- "." + P + "-table tbody tr:hover ." + P + "-cell{background:var(--cfg-hover)}",
5097
- "." + P + "-table tbody tr:nth-child(even) ." + P + "-cell,." + P + "-table tbody tr:nth-child(even) ." + P + "-rownum{background:color-mix(in oklab,currentColor 2.5%,transparent)}",
5098
- "." + P + "-cell.num{text-align:right;font-variant-numeric:tabular-nums}",
5099
- "." + P + "-cell.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
5100
- "." + P + "-cell.null{color:var(--cfg-faint);font-style:italic}",
5101
- "." + P + "-cell.json .v{color:var(--dsw-alias-brand-primary,inherit)}",
5102
- "." + P + "-tr.deleted ." + P + "-cell,." + P + "-tr.deleted ." + P + "-rownum{opacity:.55}",
5103
- "." + P + "-tr.deleted ." + P + "-cell .v{text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 35%,transparent)}",
5104
- "." + P + "-delbadge{display:inline-block;margin-left:6px;font-size:9.5px;line-height:1.5;padding:0 5px;border-radius:999px;background:color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 14%,transparent);color:var(--dsw-alias-state-error-primary,inherit);vertical-align:middle}",
5105
- "." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
5106
- "." + P + "-grow{flex:1}",
5107
- "." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
5108
- "." + P + "-jump .wbctl-num-input{width:56px;padding:4px 7px;font-size:11.5px;text-align:right}",
5109
- "." + P + "-jump .wbctl-num-hint{display:none}",
5110
- "." + P + "-empty{border:1px dashed var(--cfg-line);border-radius:11px;padding:44px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
5111
- "." + P + "-err{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:9px 12px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12px;line-height:1.5}",
5112
- "." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
5113
- "." + P + "-sk{height:26px;border-radius:4px;background:var(--dsw-alias-bg-skeleton,color-mix(in oklab,currentColor 6%,transparent));animation:" + PREFIX + "-data-pulse 1.4s ease-in-out infinite}",
5114
- "@keyframes " + PREFIX + "-data-pulse{0%,100%{opacity:.6}50%{opacity:1}}",
5115
- "." + P + "-toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);z-index:40;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border:1px solid var(--cfg-line);border-radius:999px;padding:7px 14px;font-size:12px;color:var(--dsw-alias-label-primary,inherit);box-shadow:0 6px 24px color-mix(in oklab,currentColor 18%,transparent)}",
5116
- "." + P + "-mask{position:fixed;inset:0;z-index:30;background:color-mix(in oklab,currentColor 26%,transparent)}",
5117
- "." + P + "-drawer{position:fixed;top:0;right:0;bottom:0;z-index:31;width:min(520px,92vw);display:flex;flex-direction:column;gap:12px;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border-left:1px solid var(--cfg-line);box-shadow:-8px 0 28px color-mix(in oklab,currentColor 16%,transparent);padding:18px 20px}",
5118
- "." + P + "-drawer h3{margin:0;font-size:14px;font-weight:660;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
5119
- "." + P + "-drawer pre{margin:0;flex:1;overflow:auto;border:1px solid var(--cfg-line);border-radius:10px;background:var(--dsw-alias-bg-base,transparent);padding:12px 14px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.65;white-space:pre-wrap;word-break:break-word}",
5120
- "." + P + "-drawerfoot{display:flex;gap:8px;justify-content:flex-end}",
5121
- "." + P + "-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",
5122
- "@media (max-width:900px){." + P + "{grid-template-columns:minmax(0,1fr)}." + P + "-side{position:static;flex-direction:row;flex-wrap:wrap;gap:6px;padding:6px}." + P + "-sidetitle{display:none}." + P + "-stab{padding:6px 10px;flex:none}." + P + "-sidecount{display:none}." + P + "-tablewrap{max-height:calc(100vh - 260px)}}",
5123
- "@media (prefers-reduced-motion:reduce){." + P + " *,." + P + "-track,." + P + "-track::after,." + P + "-sk,." + P + "-drawer{transition:none;animation:none}}",
5124
- "." + P + "-idxsub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55}",
5125
- "." + P + "-idxsum{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--cfg-muted)}",
5126
- "." + P + "-idxsum b{font-weight:660;color:var(--dsw-alias-label-primary,inherit);font-variant-numeric:tabular-nums}",
5127
- "." + P + "-idxtable{width:100%;table-layout:fixed}." + P + "-idxtable ." + P + "-cell{white-space:normal;overflow-wrap:anywhere;max-width:none}." + P + "-idxtable th:first-child{width:30%}." + P + "-idxtable th:nth-child(2){width:28%}",
5128
- "." + P + "-idxtags{display:flex;flex-wrap:wrap;gap:4px;max-width:280px}",
5129
- "." + P + "-idxchip{display:inline-block;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;line-height:1.6;border-radius:999px;padding:0 7px;background:color-mix(in oklab,currentColor 7%,transparent);color:var(--cfg-muted);white-space:nowrap}",
5130
- "." + P + "-idxchip.u{background:color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 15%,transparent);color:var(--dsw-alias-brand-primary,inherit)}",
5131
- "." + P + "-idxnone{color:var(--cfg-faint)}",
5132
- "." + P + "-frow th{padding:0 8px 6px;border-bottom:1px solid var(--cfg-line)}",
5133
- "." + P + "-fcell{position:relative;display:block;min-width:96px}",
5134
- "." + P + "-finput{width:100%;box-sizing:border-box;border:1px solid transparent;border-radius:6px;background:color-mix(in oklab,currentColor 4%,transparent);color:inherit;font:inherit;font-size:11.5px;padding:3px 18px 3px 6px;min-width:0}",
5135
- "." + P + "-finput:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
5136
- "." + P + "-finput:focus{outline:none;border-color:var(--dsw-alias-brand-primary,currentColor);background:var(--cfg-surface)}",
5137
- "." + P + "-fclear{position:absolute;right:2px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--cfg-muted);cursor:pointer;font-size:13px;line-height:1;padding:2px 4px;border-radius:4px}",
5138
- "." + P + "-fclear:hover{color:inherit;background:var(--cfg-hover)}",
5139
- "." + P + "-emptycell{padding:22px 12px;text-align:center;color:var(--cfg-muted)}",
5140
- "." + P + " *{box-sizing:border-box}",
5141
- "." + P + "-tabs{display:flex;gap:6px;border-bottom:1px solid var(--cfg-line);padding-bottom:9px}",
5142
- "." + P + "-tabs [aria-selected=true]{background:var(--cfg-hover);color:inherit;font-weight:660}",
5143
- "." + P + "-images{display:flex;gap:5px;align-items:center}",
5144
- "." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
5145
- "." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
5146
- "." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
5147
- ].concat(require_switch().styles).concat(require_number_field().styles).join("\n");
5148
- if (DOMAIN === "storage") {
5149
- var buttons = "." + P + " :is(button)";
5150
- CSS += buttons + "{border:none;background:var(--wb-btn-bg);min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm)}" + buttons + ":enabled:hover{background:var(--wb-btn-hover-bg)}" + buttons + ":enabled:active{background:var(--wb-btn-active-bg)}" + buttons + ":disabled{background:var(--wb-btn-bg);color:var(--cfg-muted)}" + buttons + ":focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}." + P + "-fcell:has(button) input{padding-right:34px}";
5151
- }
5152
- function injectCss() {
5153
- if (typeof document === "undefined") return;
5154
- var old = document.getElementById("wb-addon-" + DOMAIN + "-data-css");
5155
- if (old) {
5156
- old.textContent = CSS;
5157
- return;
5158
- }
5159
- var style = document.createElement("style");
5160
- style.id = "wb-addon-" + DOMAIN + "-data-css";
5161
- style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
5162
- style.textContent = CSS;
5163
- document.head.appendChild(style);
5164
- }
5165
- return injectCss;
5166
- };
5167
- }
5168
- });
5169
-
5170
- // packages/addons/lib/data-view.cjs
5171
- var require_data_view = __commonJS({
5172
- "packages/addons/lib/data-view.cjs"(exports2, module2) {
5173
- "use strict";
5174
- var React = require("react");
5175
- var NF = require_number_field();
5176
- var h = React.createElement;
5177
- var COPY = require_data_copy();
5178
- var SW = require_switch();
5179
- module2.exports = function createDataView(options) {
5180
- var DOMAIN = options.domain;
5181
- function icon(name) {
5182
- return options.Icon ? h(options.Icon, { name }) : null;
5183
- }
5184
- var P = options.prefix + "-data";
5185
- var configView = { useConfig: options.useConfig };
5186
- var columnHooks = options.columns || {};
5187
- var injectCss = require_data_style()(DOMAIN, options.prefix);
5188
- var CFG_FALLBACK = {
5189
- "data.pageSize": 50,
5190
- "data.showSystemColumns": false,
5191
- "data.includeDeleted": false
5192
- };
5193
- var PAGE_SIZES = [10, 25, 50, 100, 200];
5194
- function unwrap(r) {
5195
- return r && r.result !== void 0 ? r.result : r;
5196
- }
5197
- function fmt(template, vars) {
5198
- return String(template).replace(/\{(\w+)\}/g, function(m, key) {
5199
- return vars[key] === void 0 ? m : String(vars[key]);
5200
- });
5201
- }
5202
- function pad2(n) {
5203
- return n < 10 ? "0" + n : String(n);
5204
- }
5205
- function timeText(ms) {
5206
- var d = new Date(Number(ms));
5207
- if (!Number.isFinite(d.getTime())) return String(ms);
5208
- return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) + " " + pad2(d.getHours()) + ":" + pad2(d.getMinutes());
5209
- }
5210
- function looksJson(value) {
5211
- var text = String(value).trim();
5212
- if (!text || text[0] !== "{" && text[0] !== "[") return false;
5213
- try {
5214
- JSON.parse(text);
5215
- return true;
5216
- } catch (e) {
5217
- return false;
5218
- }
5219
- }
5220
- function rawText(value, col) {
5221
- if (value === null || value === void 0) return "";
5222
- return String(value);
5223
- }
5224
- function DataView(props) {
5225
- var api = props.api;
5226
- var lang = props.lang === "en" ? "en" : "zh";
5227
- var t = Object.assign({}, COPY[lang], { indexSub: fmt(COPY[lang].indexSub, { tables: options.tables.join(" / "), domain: DOMAIN }) });
5228
- var cfgWrap = configView.useConfig(api, CFG_FALLBACK);
5229
- var cfg = cfgWrap.values;
5230
- var tablesS = React.useState(null);
5231
- var tables = tablesS[0], setTables = tablesS[1];
5232
- var activeS = React.useState("");
5233
- var active = activeS[0], setActive = activeS[1];
5234
- var dataS = React.useState(null);
5235
- var data = dataS[0], setData = dataS[1];
5236
- var loadingS = React.useState(false);
5237
- var loadingRows = loadingS[0], setLoadingRows = loadingS[1];
5238
- var loadingTablesS = React.useState(true);
5239
- var loadingTables = loadingTablesS[0], setLoadingTables = loadingTablesS[1];
5240
- var errorS = React.useState("");
5241
- var error = errorS[0], setError = errorS[1];
5242
- var pageS = React.useState(1);
5243
- var page = pageS[0], setPage = pageS[1];
5244
- var sizeS = React.useState(0);
5245
- var pageSize = sizeS[0], setPageSize = sizeS[1];
5246
- var sortS = React.useState("");
5247
- var sort = sortS[0], setSort = sortS[1];
5248
- var orderS = React.useState("desc");
5249
- var order = orderS[0], setOrder = orderS[1];
5250
- var searchDraftS = React.useState("");
5251
- var searchDraft = searchDraftS[0], setSearchDraft = searchDraftS[1];
5252
- var searchS = React.useState("");
5253
- var search = searchS[0], setSearch = searchS[1];
5254
- var filterDraftS = React.useState({});
5255
- var filterDraft = filterDraftS[0], setFilterDraft = filterDraftS[1];
5256
- var filtersS = React.useState({});
5257
- var filters = filtersS[0], setFilters = filtersS[1];
5258
- var includeDeletedS = React.useState(null);
5259
- var includeDeletedRaw = includeDeletedS[0], setIncludeDeleted = includeDeletedS[1];
5260
- var showSystemS = React.useState(null);
5261
- var showSystemRaw = showSystemS[0], setShowSystem = showSystemS[1];
5262
- var drawerS = React.useState(null);
5263
- var drawer = drawerS[0], setDrawer = drawerS[1];
5264
- var toastS = React.useState("");
5265
- var toast = toastS[0], setToast = toastS[1];
5266
- var filtersKey = JSON.stringify(filters);
5267
- var reqRef = React.useRef(0);
5268
- var toastTimer = React.useRef(null);
5269
- var refreshS = React.useState(0);
5270
- function refresh() {
5271
- loadTables();
5272
- refreshS[1](function(n) {
5273
- return n + 1;
5274
- });
5275
- }
5276
- var indexReqRef = React.useRef(0);
5277
- var indexS = React.useState(null);
5278
- var index = indexS[0], setIndex = indexS[1];
5279
- var indexBusyS = React.useState(false);
5280
- var indexBusy = indexBusyS[0], setIndexBusy = indexBusyS[1];
5281
- var cfgSize = Number(cfg["data.pageSize"]) || 50;
5282
- var size = pageSize || (PAGE_SIZES.indexOf(cfgSize) >= 0 ? cfgSize : 50);
5283
- var includeDeleted = includeDeletedRaw === null ? cfg["data.includeDeleted"] === true : includeDeletedRaw;
5284
- var showSystem = showSystemRaw === null ? cfg["data.showSystemColumns"] === true : showSystemRaw;
5285
- function say(text) {
5286
- setToast(text);
5287
- if (toastTimer.current) clearTimeout(toastTimer.current);
5288
- toastTimer.current = setTimeout(function() {
5289
- setToast("");
5290
- }, 1600);
5291
- }
5292
- function loadTables() {
5293
- setLoadingTables(true);
5294
- Promise.resolve((options.tablesLoader || function(a) {
5295
- return a.call(DOMAIN + ".dataTables");
5296
- })(api)).then(function(r) {
5297
- if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
5298
- var body = unwrap(r);
5299
- if (!body || !Array.isArray(body.tables)) throw new Error(t.loadFail);
5300
- setTables(body.tables);
5301
- setError("");
5302
- if (!active && body.tables.length) setActive(body.tables[0].name);
5303
- }).catch(function(e) {
5304
- setError(String(e && e.message || e) || t.loadFail);
5305
- }).then(function() {
5306
- setLoadingTables(false);
5307
- });
5308
- }
5309
- React.useEffect(function() {
5310
- injectCss();
5311
- loadTables();
5312
- return function() {
5313
- indexReqRef.current++;
5314
- if (toastTimer.current) clearTimeout(toastTimer.current);
5315
- };
5316
- }, []);
5317
- function selectTable(name) {
5318
- if (name === active) return;
5319
- reqRef.current++;
5320
- setActive(name);
5321
- setData(null);
5322
- setDrawer(null);
5323
- setError("");
5324
- setLoadingRows(true);
5325
- setPage(1);
5326
- setSort("");
5327
- setOrder("desc");
5328
- setSearch("");
5329
- setSearchDraft("");
5330
- setFilterDraft({});
5331
- setFilters({});
5332
- }
5333
- React.useEffect(function() {
5334
- if (searchDraft === search) return void 0;
5335
- var timer = setTimeout(function() {
5336
- setSearch(searchDraft);
5337
- setPage(1);
5338
- }, 280);
5339
- return function() {
5340
- clearTimeout(timer);
5341
- };
5342
- }, [searchDraft]);
5343
- React.useEffect(function() {
5344
- if (JSON.stringify(filterDraft) === JSON.stringify(filters)) return void 0;
5345
- var timer = setTimeout(function() {
5346
- setFilters(filterDraft);
5347
- setPage(1);
5348
- }, 280);
5349
- return function() {
5350
- clearTimeout(timer);
5351
- };
5352
- }, [filterDraft]);
5353
- React.useEffect(function() {
5354
- if (!active || !cfgWrap.ready || index) return void 0;
5355
- var req = ++reqRef.current;
5356
- setLoadingRows(true);
5357
- var args = { table: active, page, pageSize: size, order, includeDeleted };
5358
- if (sort) args.sort = sort;
5359
- if (search) args.search = search;
5360
- if (Object.keys(filters).length) args.filters = filters;
5361
- Promise.resolve((options.query || function(a, q) {
5362
- return a.call(DOMAIN + ".dataQuery", q);
5363
- })(api, args)).then(function(r) {
5364
- if (req !== reqRef.current) return;
5365
- if (r && r.ok === false) throw new Error(r && r.error || t.queryFail);
5366
- var body = unwrap(r);
5367
- if (!body) throw new Error(t.queryFail);
5368
- setData(body);
5369
- setError("");
5370
- if (body.page !== page) setPage(body.page);
5371
- }).catch(function(e) {
5372
- if (req !== reqRef.current) return;
5373
- setError(String(e && e.message || e) || t.queryFail);
5374
- }).then(function() {
5375
- if (req === reqRef.current) setLoadingRows(false);
5376
- });
5377
- return function() {
5378
- reqRef.current++;
5379
- };
5380
- }, [active, page, size, sort, order, search, includeDeleted, cfgWrap.ready, filtersKey, refreshS[0], !!index]);
5381
- React.useEffect(function() {
5382
- if (!drawer) return void 0;
5383
- function onKey(e) {
5384
- if (e.key === "Escape") setDrawer(null);
5385
- }
5386
- document.addEventListener("keydown", onKey);
5387
- return function() {
5388
- document.removeEventListener("keydown", onKey);
5389
- };
5390
- }, [drawer]);
5391
- var current = null;
5392
- if (tables) {
5393
- for (var i = 0; i < tables.length; i++) if (tables[i].name === active) current = tables[i];
5394
- }
5395
- function leaveIndex() {
5396
- indexReqRef.current++;
5397
- setIndex(null);
5398
- setIndexBusy(false);
5399
- setError("");
5400
- }
5401
- function loadIndex() {
5402
- reqRef.current++;
5403
- setError("");
5404
- var req = ++indexReqRef.current;
5405
- setIndex([]);
5406
- setIndexBusy(true);
5407
- Promise.resolve(api.call(DOMAIN + ".dataTables", { stats: true })).then(function(r) {
5408
- if (req !== indexReqRef.current) return;
5409
- if (r && r.ok === false) throw new Error(r.error || t.loadFail);
5410
- var payload = unwrap(r) || {};
5411
- var rows = (payload.tables || []).map(function(tb) {
5412
- return { table: tb, stats: tb.stats || null };
5413
- });
5414
- setIndex(rows);
5415
- setError("");
5416
- setIndexBusy(false);
5417
- }).catch(function(e) {
5418
- if (req !== indexReqRef.current) return;
5419
- setError(String(e.message || e));
5420
- setIndex([]);
5421
- setIndexBusy(false);
5422
- });
5423
- }
5424
- function renderIndex() {
5425
- var row = (index || []).filter(function(r) {
5426
- return r.table.name === active;
5427
- })[0];
5428
- var tb = row ? row.table : current;
5429
- var st = row && row.stats;
5430
- var indexes = st ? st.indexes || [] : [];
5431
- var hasExtra = indexes.some(function(ix) {
5432
- return ix.origin !== "pk";
5433
- });
5434
- var count = st && st.rows !== void 0 ? st.rows : tb && tb.count;
5435
- return h(
5436
- "div",
5437
- { className: P + "-idx" },
5438
- h(
5439
- "div",
5440
- { className: P + "-head" },
5441
- h(
5442
- "div",
5443
- { className: P + "-headmain" },
5444
- h("h2", null, icon("database"), tableLabel(tb), h("span", { className: P + "-code" }, active)),
5445
- h("div", { className: P + "-idxsub" }, t.indexSub)
5446
- ),
5447
- h("button", {
5448
- type: "button",
5449
- className: P + "-btn",
5450
- "aria-label": t.refresh,
5451
- title: t.refresh,
5452
- "aria-busy": indexBusy ? "true" : "false",
5453
- onClick: function() {
5454
- loadIndex();
5455
- }
5456
- }, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
5457
- ),
5458
- st ? h(
5459
- "div",
5460
- { className: P + "-idxsum" },
5461
- h("span", null, t.idxRows, " ", h("b", null, String(count))),
5462
- h("span", null, t.idxCols, " ", h("b", null, String(st.columnCount === void 0 ? (tb.columns || []).length : st.columnCount))),
5463
- h("span", null, fmt(t.idxCount, { n: indexes.length }))
5464
- ) : null,
5465
- indexBusy ? options.Skeleton ? h(options.Skeleton, { lang, label: t.loading }) : h("div", { className: P + "-empty", role: "status", "aria-busy": "true" }, t.loading) : !st ? h("div", { className: P + "-empty" }, t.idxEmpty) : !hasExtra ? h("div", { className: P + "-empty" }, t.idxNoExtra) : h(
5466
- "div",
5467
- { className: P + "-tablewrap" },
5468
- h(
5469
- "table",
5470
- { className: P + "-table " + P + "-idxtable" },
5471
- h("thead", null, h(
5472
- "tr",
5473
- null,
5474
- [t.idxName, t.idxColumns, t.idxType, t.idxSource, t.idxRows].map(function(label) {
5475
- return h("th", { scope: "col", key: label }, h("span", { className: P + "-thbtn" }, label));
5476
- })
5477
- )),
5478
- h("tbody", null, indexes.map(function(ix) {
5479
- return h(
5480
- "tr",
5481
- { className: P + "-tr", key: ix.name },
5482
- h("td", { className: P + "-cell mono" }, ix.name),
5483
- h("td", { className: P + "-cell mono" }, (ix.columns || []).join(", ") || t.idxNone),
5484
- h("td", { className: P + "-cell" }, ix.origin === "pk" ? t.idxKey : ix.unique ? t.idxUnique : t.idxNormal),
5485
- h("td", { className: P + "-cell" }, /^sqlite_autoindex_/.test(ix.name) ? t.idxAuto : t.idxCreated),
5486
- h("td", { className: P + "-cell num", title: t.idxRowsHelp }, String(count))
5487
- );
5488
- }))
5489
- )
5490
- )
5491
- );
5492
- }
5493
- function tableLabel(tb) {
5494
- if (!tb || !tb.label) return "";
5495
- return lang === "en" ? tb.label.en || tb.label.zh : tb.label.zh || tb.label.en;
5496
- }
5497
- function colLabel(col) {
5498
- if (!col.label) return col.name;
5499
- return lang === "en" ? col.label.en || col.label.zh : col.label.zh || col.label.en;
5500
- }
5501
- function visibleColumns() {
5502
- var cols = data && data.columns ? data.columns.map(function(col) {
5503
- var hook = columnHooks[col.name];
5504
- return hook && hook.kind ? Object.assign({}, col, { kind: hook.kind, type: hook.type || col.type }) : col;
5505
- }) : [];
5506
- return cols.filter(function(c) {
5507
- return showSystem || !c.system;
5508
- });
5509
- }
5510
- function toggleSort(name) {
5511
- if (sort !== name) {
5512
- setSort(name);
5513
- setOrder("desc");
5514
- return;
5515
- }
5516
- if (order === "desc") {
5517
- setOrder("asc");
5518
- return;
5519
- }
5520
- setSort("");
5521
- setOrder("desc");
5522
- }
5523
- function ariaSort(name) {
5524
- if (sort !== name) return "none";
5525
- return order === "asc" ? "ascending" : "descending";
5526
- }
5527
- function copyCell(value) {
5528
- var text = value === null || value === void 0 ? "" : String(value);
5529
- try {
5530
- if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text);
5531
- else {
5532
- var ta = document.createElement("textarea");
5533
- ta.value = text;
5534
- ta.style.position = "fixed";
5535
- ta.style.opacity = "0";
5536
- document.body.appendChild(ta);
5537
- ta.select();
5538
- document.execCommand("copy");
5539
- document.body.removeChild(ta);
5540
- }
5541
- say(t.copied);
5542
- } catch (e) {
5543
- }
5544
- }
5545
- function cellText(col, value) {
5546
- if (value === null || value === void 0) return null;
5547
- if (col.kind === "bool") return value ? t.yes : t.no;
5548
- if (col.kind === "timestamp") return timeText(value);
5549
- return String(value);
5550
- }
5551
- function cellClass(col, value) {
5552
- var cls = P + "-cell";
5553
- if (value === null || value === void 0) return cls + " null";
5554
- if (col.kind === "number") return cls + " num";
5555
- if (col.kind === "id" || col.kind === "path") return cls + " mono";
5556
- if (col.kind === "text" && looksJson(value)) return cls + " json";
5557
- return cls;
5558
- }
5559
- function cellTitle(col, value) {
5560
- if (value === null || value === void 0) return t.nullText;
5561
- if (col.kind === "timestamp") return String(value);
5562
- if (col.kind === "bool") return value ? "1" : "0";
5563
- return String(value);
5564
- }
5565
- function renderCell(row, col) {
5566
- var value = row[col.name];
5567
- var hook = columnHooks[col.name];
5568
- function openDetail() {
5569
- setDrawer({ column: colLabel(col), name: col.name, row: (data.page - 1) * data.pageSize + row.__i + 1, value });
5570
- }
5571
- var text = cellText(col, value);
5572
- var content;
5573
- if (text === null) content = h("span", { className: "v" }, t.nullText);
5574
- else if (text === "") content = h("span", { className: "v" }, '""');
5575
- else content = h("span", { className: "v" }, text);
5576
- if (hook && hook.render) content = hook.render({ value, row, col, lang, prefix: P, openDetail });
5577
- return h("td", {
5578
- key: col.name,
5579
- className: cellClass(col, value),
5580
- title: cellTitle(col, value),
5581
- onClick: function() {
5582
- copyCell(value);
5583
- },
5584
- onDoubleClick: openDetail
5585
- }, content);
5586
- }
5587
- function activeFilterCount() {
5588
- var n = 0;
5589
- for (var k in filters) if (Object.prototype.hasOwnProperty.call(filters, k)) n++;
5590
- return n;
5591
- }
5592
- function filterCell(col) {
5593
- var val = filterDraft[col.name] === void 0 ? "" : filterDraft[col.name];
5594
- return h(
5595
- "th",
5596
- { key: col.name, scope: "col", className: P + "-fth" },
5597
- h(
5598
- "span",
5599
- { className: P + "-fcell" },
5600
- h("input", {
5601
- className: P + "-finput",
5602
- type: "search",
5603
- value: val,
5604
- placeholder: t.filterCol,
5605
- "aria-label": t.filterCol + " " + colLabel(col),
5606
- title: colLabel(col) + " \xB7 " + t.filterCol,
5607
- onChange: function(e) {
5608
- var v = e.target.value;
5609
- setFilterDraft(function(prev) {
5610
- var next = Object.assign({}, prev);
5611
- if (v) next[col.name] = v;
5612
- else delete next[col.name];
5613
- return next;
5614
- });
5615
- }
5616
- }),
5617
- val ? h("button", {
5618
- type: "button",
5619
- className: P + "-fclear",
5620
- title: t.filterClear,
5621
- "aria-label": t.filterClear + " " + colLabel(col),
5622
- onClick: function() {
5623
- setFilterDraft(function(prev) {
5624
- var next = Object.assign({}, prev);
5625
- delete next[col.name];
5626
- return next;
5627
- });
5628
- }
5629
- }, "\xD7") : null
5630
- )
5631
- );
5632
- }
5633
- function renderRows() {
5634
- if (loadingRows && !data && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
5635
- if (loadingRows && !data) {
5636
- return h(
5637
- "div",
5638
- { className: P + "-skwrap", "aria-busy": "true" },
5639
- h("span", { className: P + "-sr" }, t.loading),
5640
- [0, 1, 2, 3, 4, 5, 6, 7].map(function(i2) {
5641
- return h("div", { key: i2, className: P + "-sk" });
5642
- })
5643
- );
5644
- }
5645
- if (error) {
5646
- return h(
5647
- "div",
5648
- { className: P + "-err", role: "alert" },
5649
- h("span", null, t.queryFail + error),
5650
- h("button", { type: "button", className: P + "-btn", onClick: refresh }, t.retry)
5651
- );
5652
- }
5653
- if (!data) return h("div", { className: P + "-empty" }, t.empty);
5654
- var cols = visibleColumns();
5655
- var rows = data.rows || [];
5656
- var narrowing = !!search || activeFilterCount() > 0;
5657
- return h(
5658
- "div",
5659
- { className: P + "-tablewrap" },
5660
- h(
5661
- "table",
5662
- { className: P + "-table" },
5663
- h(
5664
- "thead",
5665
- null,
5666
- h(
5667
- "tr",
5668
- null,
5669
- h("th", { className: P + "-rownum", scope: "col" }, "#"),
5670
- cols.map(function(col) {
5671
- return h(
5672
- "th",
5673
- { key: col.name, scope: "col", "aria-sort": ariaSort(col.name) },
5674
- h(
5675
- "button",
5676
- {
5677
- type: "button",
5678
- className: P + "-thbtn",
5679
- title: colLabel(col) + " \xB7 " + col.type,
5680
- onClick: function() {
5681
- toggleSort(col.name);
5682
- }
5683
- },
5684
- h("span", null, colLabel(col)),
5685
- h("span", { className: P + "-coltype" }, String(col.type || "").toLowerCase()),
5686
- sort === col.name ? h("span", { className: P + "-sortmark", "aria-hidden": "true" }, order === "asc" ? "\u25B2" : "\u25BC") : null
5687
- )
5688
- );
5689
- })
5690
- ),
5691
- h(
5692
- "tr",
5693
- { className: P + "-frow" },
5694
- h("th", { className: P + "-rownum", scope: "col" }, ""),
5695
- cols.map(filterCell)
5696
- )
5697
- ),
5698
- h("tbody", null, rows.length ? rows.map(function(row, idx) {
5699
- row.__i = idx;
5700
- var deleted = row.deleted_at !== null && row.deleted_at !== void 0;
5701
- return h(
5702
- "tr",
5703
- { key: row.id || idx, className: P + "-tr" + (deleted ? " deleted" : "") },
5704
- h("td", { className: P + "-rownum" }, (data.page - 1) * data.pageSize + idx + 1),
5705
- cols.map(function(col) {
5706
- var cell = renderCell(row, col);
5707
- if (deleted && col.name === "id") {
5708
- return React.cloneElement(cell, { key: col.name }, cell.props.children, h("span", { className: P + "-delbadge" }, t.deleted));
5709
- }
5710
- return cell;
5711
- })
5712
- );
5713
- }) : h("tr", null, h("td", { className: P + "-emptycell", colSpan: cols.length + 1 }, narrowing ? t.noRows : t.empty)))
5714
- )
5715
- );
5716
- }
5717
- function renderFoot() {
5718
- var pages = data ? data.pages : 1;
5719
- var total = data ? data.total : 0;
5720
- return h(
5721
- "div",
5722
- { className: P + "-foot" },
5723
- h("span", null, fmt(t.total, { n: total })),
5724
- h("span", { className: P + "-grow" }),
5725
- h("button", { type: "button", className: P + "-btn", disabled: !data || page <= 1, onClick: function() {
5726
- setPage(Math.max(1, page - 1));
5727
- } }, "\u2039 " + t.prev),
5728
- h("span", { className: P + "-pageinfo" }, fmt(t.pageInfo, { page: data ? data.page : 1, pages })),
5729
- h("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
5730
- setPage(Math.min(pages, page + 1));
5731
- } }, t.next + " \u203A"),
5732
- h(NF.NumberField, {
5733
- h,
5734
- lang,
5735
- className: P + "-jump",
5736
- value: page,
5737
- min: 1,
5738
- max: pages,
5739
- integer: true,
5740
- ariaLabel: t.jump,
5741
- hint: false,
5742
- onCommit: function(next) {
5743
- if (next !== null) setPage(next);
5744
- }
5745
- }),
5746
- data && data.queryMs !== void 0 ? h("span", null, fmt(t.queryTime, { n: data.queryMs })) : null
5747
- );
5748
- }
5749
- if (!tables && loadingTables && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
5750
- if (!tables && loadingTables) {
5751
- return h("div", { className: P + "-skwrap", "aria-busy": "true" }, h("span", { className: P + "-sr" }, t.loading), [0, 1, 2, 3].map(function(i2) {
5752
- return h("div", { key: i2, className: P + "-sk" });
5753
- }));
5754
- }
5755
- if (!tables) {
5756
- return h("div", { className: P + "-err", role: "alert" }, h("span", null, t.loadFail), h("button", { type: "button", className: P + "-btn", onClick: loadTables }, t.retry));
5757
- }
5758
- if (!tables.length) return h("div", { className: P + "-empty" }, t.emptyTable);
5759
- return h(
5760
- "div",
5761
- { className: P },
5762
- h(
5763
- "div",
5764
- { className: P + "-side" },
5765
- h("div", { className: P + "-sidetitle" }, h("span", null, icon("table"), t.tables), h("span", null, String(tables.length))),
5766
- tables.map(function(tb) {
5767
- return h(
5768
- "button",
5769
- {
5770
- key: tb.name,
5771
- type: "button",
5772
- className: P + "-stab" + (tb.name === active ? " on" : ""),
5773
- "aria-pressed": tb.name === active,
5774
- onClick: function() {
5775
- selectTable(tb.name);
5776
- }
5777
- },
5778
- h(
5779
- "span",
5780
- { className: P + "-stabname" },
5781
- h("span", null, tableLabel(tb)),
5782
- h("span", { className: P + "-sidecount" }, tb.count === void 0 || tb.count === null ? "" : String(tb.count))
5783
- ),
5784
- h("span", { className: P + "-sidetable" }, tb.name)
5785
- );
5786
- })
5787
- ),
5788
- h(
5789
- "div",
5790
- { className: P + "-main" },
5791
- h(
5792
- "div",
5793
- { className: P + "-tabs", role: "tablist", "aria-label": t.title },
5794
- h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !index, onClick: leaveIndex }, icon("list"), lang === "en" ? "Row data" : "\u884C\u6570\u636E"),
5795
- h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !!index, onClick: loadIndex }, icon("database"), t.index)
5796
- ),
5797
- index && error ? h("div", { className: P + "-err", role: "alert" }, error) : null,
5798
- index ? renderIndex() : [
5799
- h(
5800
- "div",
5801
- { className: P + "-head" },
5802
- h(
5803
- "div",
5804
- { className: P + "-headmain" },
5805
- h("h2", null, icon("database"), tableLabel(current), h("span", { className: P + "-code" }, active)),
5806
- h(
5807
- "div",
5808
- { className: P + "-sub" },
5809
- current && data && data.total !== void 0 ? fmt(t.rowCount, { n: data.total }) : "",
5810
- current && current.deletedCount ? " \xB7 " + fmt(t.deletedCount, { n: current.deletedCount }) : "",
5811
- " \xB7 " + t.subtitle
5812
- )
5813
- ),
5814
- h("button", {
5815
- type: "button",
5816
- className: P + "-btn",
5817
- "aria-label": t.refresh,
5818
- title: t.refresh,
5819
- "aria-busy": loadingRows ? "true" : "false",
5820
- onClick: refresh
5821
- }, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
5822
- ),
5823
- h(
5824
- "div",
5825
- { className: P + "-toolbar" },
5826
- h(
5827
- "div",
5828
- { className: P + "-search" },
5829
- icon("search"),
5830
- h("input", {
5831
- type: "search",
5832
- value: searchDraft,
5833
- placeholder: t.search,
5834
- "aria-label": t.search,
5835
- onChange: function(e) {
5836
- setSearchDraft(e.target.value);
5837
- }
5838
- })
5839
- ),
5840
- h(SW.Switch, {
5841
- h,
5842
- checked: includeDeleted,
5843
- label: t.includeDeleted,
5844
- onChange: function(next) {
5845
- setIncludeDeleted(next);
5846
- setPage(1);
5847
- }
5848
- }),
5849
- h(SW.Switch, {
5850
- h,
5851
- checked: showSystem,
5852
- label: t.showSystem,
5853
- onChange: function(next) {
5854
- setShowSystem(next);
5855
- }
5856
- }),
5857
- h("span", { className: P + "-grow" }),
5858
- h(
5859
- "label",
5860
- { style: { display: "inline-flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--cfg-muted)" } },
5861
- h("span", null, t.pageSize),
5862
- h("select", {
5863
- className: P + "-select",
5864
- value: size,
5865
- onChange: function(e) {
5866
- setPageSize(Number(e.target.value));
5867
- setPage(1);
5868
- }
5869
- }, PAGE_SIZES.map(function(n) {
5870
- return h("option", { key: n, value: n }, String(n));
5871
- }))
5872
- )
5873
- ),
5874
- renderRows(),
5875
- renderFoot()
5876
- ]
5877
- ),
5878
- drawer ? h(
5879
- "div",
5880
- null,
5881
- h("div", { className: P + "-mask", onClick: function() {
5882
- setDrawer(null);
5883
- } }),
5884
- h(
5885
- "aside",
5886
- { className: P + "-drawer", role: "dialog", "aria-modal": "true", "aria-label": drawer.column },
5887
- h("h3", null, fmt(t.drawerTitle, { column: drawer.column, row: drawer.row }), h("span", { className: P + "-code" }, drawer.name)),
5888
- columnHooks[drawer.name] && columnHooks[drawer.name].detail ? columnHooks[drawer.name].detail({ value: drawer.value, lang, prefix: P }) : h("pre", null, drawerText(drawer.value)),
5889
- h(
5890
- "div",
5891
- { className: P + "-drawerfoot" },
5892
- h("button", { type: "button", className: P + "-btn", onClick: function() {
5893
- copyCell(drawer.value);
5894
- } }, t.copy),
5895
- h("button", { type: "button", className: P + "-btn", onClick: function() {
5896
- setDrawer(null);
5897
- } }, t.close)
5898
- )
5899
- )
5900
- ) : null,
5901
- toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
5902
- );
5903
- }
5904
- function drawerText(value) {
5905
- if (value === null || value === void 0) return "NULL";
5906
- if (typeof value === "string" && looksJson(value)) {
5907
- try {
5908
- return JSON.stringify(JSON.parse(value), null, 2);
5909
- } catch (e) {
5910
- return value;
5911
- }
5912
- }
5913
- if (typeof value === "object") {
5914
- try {
5915
- return JSON.stringify(value, null, 2);
5916
- } catch (e) {
5917
- return String(value);
5918
- }
5919
- }
5920
- return String(value);
5921
- }
5922
- return { DataView, DOMAIN };
5923
- };
5924
- }
5925
- });
5926
-
5927
- // packages/addons/tasks/client/views/data.cjs
5928
- var require_data = __commonJS({
5929
- "packages/addons/tasks/client/views/data.cjs"(exports2, module2) {
5930
- "use strict";
5931
- module2.exports = require_data_view()({
5932
- domain: "tasks",
5933
- prefix: "wbt",
5934
- tables: ["task", "task_node"],
5935
- useConfig: require_config().useConfig
5936
- });
5937
- }
5938
- });
5939
-
5940
4898
  // packages/addons/lib/highlight.cjs
5941
4899
  var require_highlight = __commonJS({
5942
4900
  "packages/addons/lib/highlight.cjs"(exports2, module2) {
@@ -9005,262 +7963,6 @@ var require_workspace_view = __commonJS({
9005
7963
  }
9006
7964
  });
9007
7965
 
9008
- // packages/addons/tasks/client/views/commands.cjs
9009
- var require_commands = __commonJS({
9010
- "packages/addons/tasks/client/views/commands.cjs"(exports2, module2) {
9011
- "use strict";
9012
- module2.exports = function(deps) {
9013
- var React = deps.React, h = React.createElement;
9014
- var Disclosure = deps.Disclosure;
9015
- var Icon2 = deps.Icon, Body = deps.Body, BodyMode = deps.BodyMode;
9016
- var bodyCopy = deps.bodyCopy || { zh: {}, en: {} };
9017
- var BODY_DEFAULT = { "ui.bodyMode": "markdown" };
9018
- var useConfig = deps.useConfig || function() {
9019
- return { ready: true, values: BODY_DEFAULT };
9020
- };
9021
- var COPY = {
9022
- zh: {
9023
- title: "\u547D\u4EE4",
9024
- hint: "\u53EA\u8BFB \xB7 \u6570\u636E\u6765\u81EA tasks.commands",
9025
- loading: "\u6B63\u5728\u8BFB\u53D6\u547D\u4EE4\u76EE\u5F55\u2026",
9026
- empty: "\u672C\u63D2\u4EF6\u8FD8\u6CA1\u6709\u6CE8\u518C\u659C\u6760\u547D\u4EE4\u3002",
9027
- retry: "\u91CD\u8BD5",
9028
- error: "\u547D\u4EE4\u76EE\u5F55\u52A0\u8F7D\u5931\u8D25",
9029
- count: function(n) {
9030
- return n + " \u6761\u547D\u4EE4";
9031
- },
9032
- usage: "\u7528\u6CD5",
9033
- input: "\u8F93\u5165",
9034
- examples: "\u793A\u4F8B",
9035
- limit: "\u4E0A\u9650",
9036
- attachments: "\u652F\u6301\u9644\u4EF6",
9037
- noAttachments: "\u4E0D\u652F\u6301\u9644\u4EF6",
9038
- notes: "\u8BF4\u660E",
9039
- copy: "\u590D\u5236",
9040
- copied: "\u5DF2\u590D\u5236",
9041
- chars: function(n) {
9042
- return "\u6700\u591A " + n + " \u5B57\u7B26";
9043
- },
9044
- template: "\u63D0\u793A\u8BCD\u6A21\u677F",
9045
- templateHint: "\u53EA\u8BFB \xB7 \u9ED8\u8BA4\u6298\u53E0\uFF0C\u5C55\u5F00\u53EF\u770B\u5168\u6587\uFF1B{\u9700\u6C42\u63CF\u8FF0} \u6362\u6210\u4F60\u7684\u539F\u8BDD\uFF0C<sessionId> \u4E3A\u5F53\u524D\u4F1A\u8BDD id",
9046
- copyTemplate: "\u590D\u5236\u6A21\u677F",
9047
- bodyModeToggle: bodyCopy.zh.bodyModeToggle || "{field} \xB7 \u5F53\u524D\uFF1A{current}\uFF1B\u5207\u6362\u4E3A{target}",
9048
- markdown: bodyCopy.zh.markdown || "Markdown \u6E32\u67D3",
9049
- plainText: bodyCopy.zh.plainText || "\u7EAF\u6587\u672C"
9050
- },
9051
- en: {
9052
- title: "Commands",
9053
- hint: "Read-only \xB7 from tasks.commands",
9054
- loading: "Loading command catalog\u2026",
9055
- empty: "No slash commands registered yet.",
9056
- retry: "Retry",
9057
- error: "Failed to load command catalog",
9058
- count: function(n) {
9059
- return n + (n === 1 ? " command" : " commands");
9060
- },
9061
- usage: "Usage",
9062
- input: "Input",
9063
- examples: "Examples",
9064
- limit: "Limit",
9065
- attachments: "Attachments allowed",
9066
- noAttachments: "No attachments",
9067
- notes: "Notes",
9068
- copy: "Copy",
9069
- copied: "Copied",
9070
- chars: function(n) {
9071
- return "up to " + n + " characters";
9072
- },
9073
- template: "Prompt template",
9074
- templateHint: "Read-only \xB7 collapsed by default; {requirement} is replaced by your words and <sessionId> by the current session id",
9075
- copyTemplate: "Copy template",
9076
- bodyModeToggle: bodyCopy.en.bodyModeToggle || "{field} \xB7 Current: {current}; switch to {target}",
9077
- markdown: bodyCopy.en.markdown || "Rendered Markdown",
9078
- plainText: bodyCopy.en.plainText || "Plain text"
9079
- }
9080
- };
9081
- var CSS = String(deps.bodyStyles || "") + [
9082
- ".wbt-cmd{display:flex;flex-direction:column;gap:10px;min-height:0}",
9083
- ".wbt-cmd-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}",
9084
- ".wbt-cmd-hint,.wbt-cmd-count{color:var(--dsw-alias-label-secondary,inherit);font-size:12px}",
9085
- ".wbt-cmd-list{display:flex;flex-direction:column;gap:10px;overflow:auto;min-height:0}",
9086
- ".wbt-cmd-card{border:1px solid var(--wb-border);border-radius:var(--wb-radius-sm);padding:10px 12px;display:flex;flex-direction:column;gap:6px}",
9087
- ".wbt-cmd-name{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
9088
- ".wbt-cmd-name code{font-size:13px}",
9089
- ".wbt-cmd-title{font-weight:600}",
9090
- ".wbt-cmd-badge{border:1px solid var(--wb-border);border-radius:999px;padding:0 8px;font-size:11px;color:var(--dsw-alias-label-secondary,inherit)}",
9091
- ".wbt-cmd-summary,.wbt-cmd-notes{margin:0;line-height:1.55;font-size:12.5px;color:var(--dsw-alias-label-secondary,inherit)}",
9092
- ".wbt-cmd-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}",
9093
- ".wbt-cmd-label{font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);flex:none}",
9094
- ".wbt-cmd-row code{min-width:0;overflow-wrap:anywhere;background:var(--dsw-alias-bg-layer-1,color-mix(in oklab,currentColor 4%,transparent));padding:2px 6px;border-radius:4px}",
9095
- ".wbt-cmd-examples{margin:0;padding-left:18px;font-size:12.5px;display:flex;flex-direction:column;gap:4px}",
9096
- ".wbt-cmd-examples li{overflow-wrap:anywhere}",
9097
- ".wbt-cmd-empty,.wbt-cmd-error{padding:12px;border:1px dashed var(--wb-border);border-radius:var(--wb-radius-sm);font-size:12.5px}",
9098
- ".wbt-cmd-error{border-style:solid;color:var(--dsw-alias-status-danger,inherit)}",
9099
- // 折叠头由共享控件 disclosure-styles.cjs 提供,这里只保留面板外框与展开后的纵向排布。
9100
- ".wbt-cmd-template{border-top:1px dashed var(--wb-border);padding-top:8px}",
9101
- ".wbt-cmd-template>.wb-disc-body{display:flex;flex-direction:column;gap:8px}",
9102
- ".wbt-cmd-template-head{padding-left:0;margin:0}",
9103
- ".wbt-cmd-bar{display:inline-flex;align-items:center;gap:6px}",
9104
- ".wbt-cmd-body{max-height:340px;overflow:auto;background:var(--dsw-alias-bg-layer-1,color-mix(in oklab,currentColor 4%,transparent));border-radius:var(--wb-radius-sm);padding:10px}",
9105
- ".wbt-cmd-body .wb-markdown,.wbt-cmd-body .wb-body-text{font-size:11.5px;line-height:1.55}"
9106
- ].join("");
9107
- function result(r) {
9108
- if (!r || !r.ok) throw new Error(r && r.error || "Request failed");
9109
- return r.result || {};
9110
- }
9111
- function CopyButton(p) {
9112
- var s = React.useState(false), done = s[0], setDone = s[1];
9113
- return h("button", {
9114
- className: "wbt-btn",
9115
- type: "button",
9116
- title: p.t.copy,
9117
- onClick: function() {
9118
- var clip = typeof navigator !== "undefined" && navigator.clipboard;
9119
- var write = clip && typeof clip.writeText === "function" ? clip.writeText(p.text) : Promise.reject(new Error("no clipboard"));
9120
- write.then(function() {
9121
- setDone(true);
9122
- if (typeof p.onCopied === "function") p.onCopied(p.text);
9123
- if (typeof setTimeout === "function") setTimeout(function() {
9124
- setDone(false);
9125
- }, 1200);
9126
- }).catch(function() {
9127
- setDone(false);
9128
- });
9129
- }
9130
- }, done ? p.t.copied : p.t.copy);
9131
- }
9132
- function TemplateBlock(props) {
9133
- var c = props.command, t = props.t;
9134
- var text = typeof c.template === "string" ? c.template : "";
9135
- var s = React.useState(props.mode === "text" ? "text" : "markdown"), mode = s[0], setMode = s[1];
9136
- if (!text.trim()) return null;
9137
- return h(
9138
- Disclosure,
9139
- { className: "wbt-cmd-template", title: t.template },
9140
- h("span", { className: "wbt-cmd-hint" }, t.templateHint),
9141
- h(
9142
- "div",
9143
- { className: "wb-body-heading wbt-cmd-template-head" },
9144
- h("span", { className: "wb-body-label" }, t.template),
9145
- h(
9146
- "span",
9147
- { className: "wbt-cmd-bar" },
9148
- h(BodyMode, { label: t.template, mode, onChange: setMode, t, Icon: Icon2 }),
9149
- h(CopyButton, { t, text, onCopied: props.onCopied })
9150
- )
9151
- ),
9152
- h("div", { className: "wbt-cmd-body" }, h(Body, { text, mode }))
9153
- );
9154
- }
9155
- function CommandCard(props) {
9156
- var c = props.command, t = props.t;
9157
- var limit = c.limit && c.limit.max ? t.chars(c.limit.max) : "";
9158
- return h(
9159
- "article",
9160
- { className: "wbt-cmd-card" },
9161
- h(
9162
- "div",
9163
- { className: "wbt-cmd-name" },
9164
- h("code", null, "/" + c.name),
9165
- h("span", { className: "wbt-cmd-title" }, c.title.zh && t === COPY.zh ? c.title.zh : c.title.en || c.title.zh),
9166
- h("span", { className: "wbt-cmd-badge" }, c.attachments ? t.attachments : t.noAttachments)
9167
- ),
9168
- h("p", { className: "wbt-cmd-summary" }, t === COPY.zh ? c.summary.zh : c.summary.en),
9169
- h(
9170
- "div",
9171
- { className: "wbt-cmd-row" },
9172
- h("span", { className: "wbt-cmd-label" }, t.usage),
9173
- h("code", null, t === COPY.zh ? c.usage.zh : c.usage.en),
9174
- h(CopyButton, { t, text: t === COPY.zh ? c.usage.zh : c.usage.en, onCopied: props.onCopied })
9175
- ),
9176
- h(
9177
- "div",
9178
- { className: "wbt-cmd-row" },
9179
- h("span", { className: "wbt-cmd-label" }, t.input),
9180
- h("code", null, t === COPY.zh ? c.inputHint.zh : c.inputHint.en)
9181
- ),
9182
- c.examples && c.examples.length ? h(
9183
- "div",
9184
- { className: "wbt-cmd-row", style: { alignItems: "flex-start" } },
9185
- h("span", { className: "wbt-cmd-label" }, t.examples),
9186
- h("ul", { className: "wbt-cmd-examples" }, c.examples.map(function(text, i) {
9187
- return h(
9188
- "li",
9189
- { key: i },
9190
- h("code", null, text),
9191
- " ",
9192
- h(CopyButton, { t, text, onCopied: props.onCopied })
9193
- );
9194
- }))
9195
- ) : null,
9196
- limit ? h("div", { className: "wbt-cmd-row" }, h("span", { className: "wbt-cmd-label" }, t.limit), h("span", null, limit)) : null,
9197
- c.notes && (t === COPY.zh ? c.notes.zh : c.notes.en) ? h("p", { className: "wbt-cmd-notes" }, t === COPY.zh ? c.notes.zh : c.notes.en) : null,
9198
- h(TemplateBlock, { command: c, t, mode: props.bodyMode, onCopied: props.onCopied })
9199
- );
9200
- }
9201
- function CommandsView(props) {
9202
- var lang = props.lang === "en" ? "en" : "zh", t = COPY[lang];
9203
- var api = props.api;
9204
- var cfg = useConfig(api, BODY_DEFAULT);
9205
- var bodyMode = cfg.values && cfg.values["ui.bodyMode"] === "text" ? "text" : "markdown";
9206
- var dataS = React.useState(null), data = dataS[0], setData = dataS[1];
9207
- var busyS = React.useState(true), busy = busyS[0], setBusy = busyS[1];
9208
- var errorS = React.useState(""), error = errorS[0], setError = errorS[1];
9209
- var refreshS = React.useState(0), refresh = refreshS[0], setRefresh = refreshS[1];
9210
- var toastS = React.useState(""), toast = toastS[0], setToast = toastS[1];
9211
- React.useEffect(function() {
9212
- var cancelled = false;
9213
- setBusy(true);
9214
- setError("");
9215
- api.call("tasks.commands", {}).then(result).then(function(r) {
9216
- if (cancelled) return;
9217
- setData(Array.isArray(r.commands) ? r.commands : []);
9218
- setBusy(false);
9219
- }).catch(function(e) {
9220
- if (cancelled) return;
9221
- setBusy(false);
9222
- setError(String(e && e.message || e));
9223
- });
9224
- return function() {
9225
- cancelled = true;
9226
- };
9227
- }, [api, refresh]);
9228
- var commands = data || [];
9229
- var ready = !busy && cfg.ready;
9230
- return h(
9231
- "div",
9232
- { className: "wbt-root wbt-cmd" },
9233
- h("style", null, CSS),
9234
- h(
9235
- "div",
9236
- { className: "wbt-cmd-head" },
9237
- h("strong", null, t.title),
9238
- h("span", { className: "wbt-cmd-hint" }, t.hint),
9239
- ready && !error ? h("span", { className: "wbt-cmd-count" }, t.count(commands.length)) : null
9240
- ),
9241
- !ready && !error ? h("div", { className: "wbt-cmd-empty" }, t.loading) : null,
9242
- error ? h(
9243
- "div",
9244
- { className: "wbt-cmd-error" },
9245
- t.error + "\uFF1A" + error,
9246
- h("button", { className: "wbt-btn", type: "button", onClick: function() {
9247
- setRefresh(refresh + 1);
9248
- } }, t.retry)
9249
- ) : null,
9250
- ready && !error && !commands.length ? h("div", { className: "wbt-cmd-empty" }, t.empty) : null,
9251
- ready && !error && commands.length ? h("div", { className: "wbt-cmd-list" }, commands.map(function(c) {
9252
- return h(CommandCard, { key: c.name, command: c, t, bodyMode, onCopied: function(text) {
9253
- setToast(text);
9254
- } });
9255
- })) : null,
9256
- toast ? h("span", { className: "wbt-cmd-hint", "aria-live": "polite" }, t.copied) : null
9257
- );
9258
- }
9259
- return { CommandsView, CSS };
9260
- };
9261
- }
9262
- });
9263
-
9264
7966
  // packages/addons/lib/markdown.cjs
9265
7967
  var require_markdown = __commonJS({
9266
7968
  "packages/addons/lib/markdown.cjs"(exports2, module2) {
@@ -9416,10 +8118,14 @@ var require_body_toggle = __commonJS({
9416
8118
  }
9417
8119
  });
9418
8120
 
9419
- // packages/addons/tasks/client/ui/body-mode.cjs
9420
- var require_body_mode = __commonJS({
9421
- "packages/addons/tasks/client/ui/body-mode.cjs"(exports2, module2) {
9422
- module2.exports = require_body_toggle();
8121
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-2.mjs
8122
+ var code_2_exports = {};
8123
+ __export(code_2_exports, {
8124
+ default: () => CodeXml
8125
+ });
8126
+ var init_code_2 = __esm({
8127
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-2.mjs"() {
8128
+ init_code_xml();
9423
8129
  }
9424
8130
  });
9425
8131
 
@@ -9453,17 +8159,6 @@ var require_body_styles = __commonJS({
9453
8159
  }
9454
8160
  });
9455
8161
 
9456
- // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-2.mjs
9457
- var code_2_exports = {};
9458
- __export(code_2_exports, {
9459
- default: () => CodeXml
9460
- });
9461
- var init_code_2 = __esm({
9462
- "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-2.mjs"() {
9463
- init_code_xml();
9464
- }
9465
- });
9466
-
9467
8162
  // packages/addons/lib/body-id.cjs
9468
8163
  var require_body_id = __commonJS({
9469
8164
  "packages/addons/lib/body-id.cjs"(exports2, module2) {
@@ -9556,6 +8251,16 @@ var require_description = __commonJS({
9556
8251
  }
9557
8252
  });
9558
8253
 
8254
+ // packages/addons/lib/visual-tokens.cjs
8255
+ var require_visual_tokens = __commonJS({
8256
+ "packages/addons/lib/visual-tokens.cjs"(exports2, module2) {
8257
+ module2.exports = `
8258
+ :where(.wbt-root,.wbi-root,.wbi-cfg,.wbt-data,.wbs-data,.wbg-data,.wbi-data,.wb-desc){--wb-radius-sm:8px;--wb-radius-card:12px;--wb-space-sm:8px;--wb-space-md:14px;--wb-border:var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent));--wb-description-bg:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 7%,transparent);--wb-description-line:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 34%,transparent);--wb-motion:140ms;--wb-btn-bg:transparent;--wb-btn-hover-bg:color-mix(in oklab,currentColor 6%,transparent);--wb-btn-active-bg:color-mix(in oklab,currentColor 11%,transparent);--wb-btn-primary-bg:var(--dsw-alias-brand-primary,#2563eb);--wb-btn-primary-fg:var(--dsw-alias-label-primary-inverted,#fff);--wb-btn-danger-fg:var(--dsw-alias-state-error-primary,#b91c1c);--wb-btn-size-sm:32px;--wb-btn-focus:2px solid var(--dsw-alias-brand-primary,#2563eb);--wb-btn-focus-offset:2px}
8259
+ .wb-desc{background:var(--wb-description-bg);border-left-color:var(--wb-description-line);border-radius:0 var(--wb-radius-sm) var(--wb-radius-sm) 0}
8260
+ `;
8261
+ }
8262
+ });
8263
+
9559
8264
  // packages/addons/lib/filter-checklist-styles.cjs
9560
8265
  var require_filter_checklist_styles = __commonJS({
9561
8266
  "packages/addons/lib/filter-checklist-styles.cjs"(exports2, module2) {
@@ -10255,6 +8960,13 @@ var require_highlight2 = __commonJS({
10255
8960
  }
10256
8961
  });
10257
8962
 
8963
+ // packages/addons/tasks/client/ui/body-mode.cjs
8964
+ var require_body_mode = __commonJS({
8965
+ "packages/addons/tasks/client/ui/body-mode.cjs"(exports2, module2) {
8966
+ module2.exports = require_body_toggle();
8967
+ }
8968
+ });
8969
+
10258
8970
  // packages/addons/tasks/client/item/task-item.cjs
10259
8971
  var require_task_item = __commonJS({
10260
8972
  "packages/addons/tasks/client/item/task-item.cjs"(exports2, module2) {
@@ -14771,7 +13483,6 @@ var require_timeline_view = __commonJS({
14771
13483
  var WorkspaceFilter = require_workspacefilter();
14772
13484
  var statsView = require_stats();
14773
13485
  var configView = require_config();
14774
- var dataView = require_data();
14775
13486
  var actionSchemaView = require_actions();
14776
13487
  var COPY = require_copy();
14777
13488
  function hostHasAddon(id) {
@@ -14791,17 +13502,6 @@ var require_timeline_view = __commonJS({
14791
13502
  var icons = require_icons2(), ICONS = icons.ICONS, Icon2 = icons.Icon;
14792
13503
  var createOverlay = require_overlay();
14793
13504
  var workspaceView = require_workspace_view()({ React, Icon: Icon2, createOverlay });
14794
- var commandsView = require_commands()({
14795
- React,
14796
- Icon: Icon2,
14797
- Body: require_markdown().createBody(React),
14798
- BodyMode: require_body_mode()(React),
14799
- bodyStyles: require_body_styles(),
14800
- bodyCopy: require_body_copy(),
14801
- useConfig: configView.useConfig,
14802
- // 折叠面板共享控件:命令页的提示词模板与宿主其它面板保持同一观感。
14803
- Disclosure: require_disclosure().createDisclosure(React).Disclosure
14804
- });
14805
13505
  function tabIcon(name) {
14806
13506
  return function TasksTabIcon() {
14807
13507
  return React.createElement(Icon2, { name, size: 14 });
@@ -15219,7 +13919,7 @@ var require_timeline_view = __commonJS({
15219
13919
  var TimelineView = require_timeline_view()({ React, COPY, injectCss, statusInfo, configView, CFG_FALLBACK, TaskItem, EditModal, DoneModal, TimelineModal, CreateModal });
15220
13920
  host.registerAddon({
15221
13921
  id: "wb-addon-tasks",
15222
- version: "5.5.0",
13922
+ version: "5.5.4",
15223
13923
  icon: ICONS["list-checks"],
15224
13924
  // 贡献声明写在 registerAddon 里:卸载任务插件时宿主按 addonId 一起撤销,
15225
13925
  // 不会在邮件里留一个渲染即报错的孤儿按钮。
@@ -15230,8 +13930,6 @@ var require_timeline_view = __commonJS({
15230
13930
  { id: "timeline", icon: tabIcon("timeline"), title: { zh: "\u65F6\u95F4\u7EBF", en: "Timeline" }, component: TimelineView },
15231
13931
  { id: "workspace", icon: tabIcon("folder"), title: { zh: "\u5DE5\u4F5C\u533A", en: "Workspaces" }, component: workspaceView.WorkspaceView },
15232
13932
  { id: "config", icon: tabIcon("settings"), title: { zh: "\u914D\u7F6E", en: "Config" }, component: configView.ConfigView },
15233
- { id: "data", icon: tabIcon("database"), title: { zh: "\u6570\u636E", en: "Data" }, component: dataView.DataView },
15234
- { id: "commands", icon: tabIcon("terminal"), title: { zh: "\u547D\u4EE4", en: "Commands" }, component: commandsView.CommandsView },
15235
13933
  { id: "actions", icon: tabIcon("code-2"), title: { zh: "Action", en: "Actions" }, component: actionSchemaView.ActionSchemaView }
15236
13934
  ]
15237
13935
  });