dsh-workbench-danmaku 0.3.0 → 0.3.2

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
@@ -3008,7 +3008,7 @@ var require_config_scheme_bar = __commonJS({
3008
3008
  ];
3009
3009
  function SchemeBar(props) {
3010
3010
  var lang = props.lang === "en" ? "en" : "zh";
3011
- var c = COPY[lang];
3011
+ var c = props.copy ? Object.assign({}, COPY[lang], props.copy) : COPY[lang];
3012
3012
  var prefix = props.prefix || "wb";
3013
3013
  var cls = function(suffix) {
3014
3014
  return "." + prefix + "-cfg-" + suffix;
@@ -3577,1048 +3577,6 @@ var require_config = __commonJS({
3577
3577
  }
3578
3578
  });
3579
3579
 
3580
- // packages/addons/lib/data-copy.cjs
3581
- var require_data_copy = __commonJS({
3582
- "packages/addons/lib/data-copy.cjs"(exports2, module2) {
3583
- "use strict";
3584
- var COPY = {
3585
- zh: {
3586
- title: "\u6570\u636E",
3587
- 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",
3588
- tables: "\u8868",
3589
- rows: "\u884C",
3590
- deleted: "\u5DF2\u5220\u9664",
3591
- rowCount: "\u5171 {n} \u884C",
3592
- deletedCount: "\u5176\u4E2D {n} \u884C\u5DF2\u5220\u9664",
3593
- search: "\u641C\u7D22\u6240\u6709\u6587\u672C\u5217\u2026",
3594
- pageSize: "\u6BCF\u9875",
3595
- includeDeleted: "\u542B\u5DF2\u5220\u9664",
3596
- showSystem: "\u7CFB\u7EDF\u5217",
3597
- refresh: "\u5237\u65B0",
3598
- loading: "\u8F7D\u5165\u4E2D\u2026",
3599
- empty: "\u8FD9\u5F20\u8868\u8FD8\u6CA1\u6709\u6570\u636E",
3600
- emptyTable: "\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u8868",
3601
- loadFail: "\u6570\u636E\u670D\u52A1\u4E0D\u53EF\u7528\uFF08\u63D2\u4EF6\u7248\u672C\u8FC7\u65E7\uFF1F\uFF09",
3602
- retry: "\u91CD\u8BD5",
3603
- queryFail: "\u67E5\u8BE2\u5931\u8D25\uFF1A",
3604
- noRows: "\u6CA1\u6709\u5339\u914D\u7684\u884C",
3605
- prev: "\u4E0A\u4E00\u9875",
3606
- next: "\u4E0B\u4E00\u9875",
3607
- pageInfo: "\u7B2C {page} / {pages} \u9875",
3608
- jump: "\u8DF3\u8F6C",
3609
- total: "\u5171 {n} \u884C",
3610
- copied: "\u5DF2\u590D\u5236",
3611
- copy: "\u590D\u5236",
3612
- close: "\u5173\u95ED",
3613
- drawerTitle: "{column} \xB7 \u7B2C {row} \u884C",
3614
- nullText: "NULL",
3615
- emptyText: "\u7A7A",
3616
- yes: "\u662F",
3617
- no: "\u5426",
3618
- json: "JSON",
3619
- queryTime: "{n} ms",
3620
- sortAsc: "\u5347\u5E8F",
3621
- sortDesc: "\u964D\u5E8F",
3622
- filterCol: "\u7B5B\u9009\u2026",
3623
- filterClear: "\u6E05\u9664\u7B5B\u9009",
3624
- index: "\u8868\u7D22\u5F15",
3625
- 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",
3626
- idxName: "\u7D22\u5F15\u540D",
3627
- idxColumns: "\u5217",
3628
- idxType: "\u7C7B\u578B",
3629
- idxSource: "\u6765\u6E90",
3630
- idxUnique: "\u552F\u4E00",
3631
- idxNormal: "\u666E\u901A",
3632
- idxAuto: "\u81EA\u52A8",
3633
- idxCreated: "\u663E\u5F0F\u521B\u5EFA",
3634
- idxCount: "\u5171 {n} \u4E2A\u7D22\u5F15",
3635
- idxNoExtra: "\u8BE5\u8868\u9664\u4E3B\u952E\u5916\u6CA1\u6709\u989D\u5916\u7D22\u5F15",
3636
- idxRowsHelp: "\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF08\u542B\u5DF2\u5220\u9664\u884C\uFF09\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
3637
- idxTable: "\u8868",
3638
- idxRows: "\u884C\u6570",
3639
- idxCols: "\u5217\u6570",
3640
- idxKey: "\u4E3B\u952E",
3641
- idxIndexes: "\u7D22\u5F15",
3642
- idxLastWrite: "\u6700\u8FD1\u5199\u5165",
3643
- idxNone: "\u65E0",
3644
- idxEmpty: "\u5F53\u524D\u8868\u6CA1\u6709\u53EF\u7528\u7684\u7D22\u5F15\u7EDF\u8BA1",
3645
- idxTables: "\u8868",
3646
- idxAt: "\u7EDF\u8BA1\u65F6\u95F4"
3647
- },
3648
- en: {
3649
- title: "Data",
3650
- subtitle: "Read-only view of this plugin's tables; system and deleted rows are hidden by default",
3651
- tables: "Tables",
3652
- rows: "rows",
3653
- deleted: "deleted",
3654
- rowCount: "{n} rows",
3655
- deletedCount: "{n} deleted",
3656
- search: "Search all text columns\u2026",
3657
- pageSize: "Rows",
3658
- includeDeleted: "Deleted",
3659
- showSystem: "System",
3660
- refresh: "Refresh",
3661
- loading: "Loading\u2026",
3662
- empty: "This table has no rows yet",
3663
- emptyTable: "No tables to show",
3664
- loadFail: "Data service unavailable (plugin too old?)",
3665
- retry: "Retry",
3666
- queryFail: "Query failed: ",
3667
- noRows: "No matching rows",
3668
- prev: "Previous",
3669
- next: "Next",
3670
- pageInfo: "Page {page} / {pages}",
3671
- jump: "Jump",
3672
- total: "{n} rows",
3673
- copied: "Copied",
3674
- copy: "Copy",
3675
- close: "Close",
3676
- drawerTitle: "{column} \xB7 row {row}",
3677
- nullText: "NULL",
3678
- emptyText: "empty",
3679
- yes: "Yes",
3680
- no: "No",
3681
- json: "JSON",
3682
- queryTime: "{n} ms",
3683
- sortAsc: "ascending",
3684
- sortDesc: "descending",
3685
- filterCol: "Filter\u2026",
3686
- filterClear: "Clear filter",
3687
- index: "Table index",
3688
- indexSub: "Indexes of the selected table (read-only); rows are the table total, not index entries",
3689
- idxName: "Index name",
3690
- idxColumns: "Columns",
3691
- idxType: "Type",
3692
- idxSource: "Source",
3693
- idxUnique: "Unique",
3694
- idxNormal: "Normal",
3695
- idxAuto: "Automatic",
3696
- idxCreated: "Explicit",
3697
- idxCount: "{n} indexes",
3698
- idxNoExtra: "This table has no indexes other than its primary key",
3699
- idxRowsHelp: "Total table rows (including deleted rows), not index entries",
3700
- idxTable: "Table",
3701
- idxRows: "Rows",
3702
- idxCols: "Cols",
3703
- idxKey: "Primary key",
3704
- idxIndexes: "Indexes",
3705
- idxLastWrite: "Last write",
3706
- idxNone: "\u2014",
3707
- idxEmpty: "No index statistics available for this table",
3708
- idxTables: "Tables",
3709
- idxAt: "Generated"
3710
- }
3711
- };
3712
- module2.exports = COPY;
3713
- }
3714
- });
3715
-
3716
- // packages/addons/lib/visual-tokens.cjs
3717
- var require_visual_tokens = __commonJS({
3718
- "packages/addons/lib/visual-tokens.cjs"(exports2, module2) {
3719
- module2.exports = `
3720
- :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}
3721
- .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}
3722
- `;
3723
- }
3724
- });
3725
-
3726
- // packages/addons/lib/data-style.cjs
3727
- var require_data_style = __commonJS({
3728
- "packages/addons/lib/data-style.cjs"(exports2, module2) {
3729
- "use strict";
3730
- module2.exports = function(DOMAIN, PREFIX) {
3731
- var P = PREFIX + "-data";
3732
- var CSS = [
3733
- require_visual_tokens(),
3734
- "." + P + "-search:has(.wbi-svg) input{padding-left:30px}." + P + "-search>.wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%)}",
3735
- "." + P + "-btn{transition:background var(--wb-motion),border-color var(--wb-motion)}",
3736
- "@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}}",
3737
- "." + 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}",
3738
- "." + 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)}",
3739
- "." + 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)}",
3740
- "." + 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}",
3741
- "." + P + "-stab:hover{background:var(--cfg-hover)}",
3742
- "." + P + "-stab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
3743
- "." + P + "-stab.on{background:color-mix(in oklab,currentColor 6%,transparent);border-color:var(--cfg-line)}",
3744
- "." + 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)}",
3745
- "." + P + "-stabname{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;line-height:1.4;min-width:0}",
3746
- "." + P + "-stabname span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
3747
- "." + 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}",
3748
- "." + 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}",
3749
- "." + 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)}",
3750
- "." + P + "-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}",
3751
- "." + P + "-headmain{min-width:0;flex:1}",
3752
- "." + P + "-head h2{margin:0;font-size:16px;font-weight:660;letter-spacing:.1px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
3753
- "." + 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}",
3754
- "." + P + "-sub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55;margin-top:4px}",
3755
- "." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:2px 0 4px}",
3756
- "." + P + "-search{position:relative;flex:1;min-width:180px;max-width:340px}",
3757
- "." + 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}",
3758
- "." + P + "-search input:hover{border-color:color-mix(in oklab,currentColor 28%,var(--cfg-line))}",
3759
- "." + 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)}",
3760
- "." + 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}",
3761
- "." + 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)}",
3762
- "." + 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}",
3763
- "." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
3764
- "." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
3765
- "." + P + "-btn:disabled{opacity:.45;cursor:not-allowed}",
3766
- "." + P + "-btn[aria-busy='true']{opacity:.6}",
3767
- "." + 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)}",
3768
- "." + P + "-table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:12.5px}",
3769
- "." + 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}",
3770
- "." + 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}",
3771
- "." + P + "-thbtn:hover{background:var(--cfg-hover)}",
3772
- "." + P + "-thbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:-2px}",
3773
- "." + P + "-coltype{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:500;color:var(--cfg-faint);letter-spacing:.3px}",
3774
- "." + P + "-sortmark{color:var(--dsw-alias-brand-primary,currentColor);font-size:10px}",
3775
- "." + 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)}",
3776
- "." + P + "-table thead ." + P + "-rownum{z-index:3}",
3777
- "." + 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}",
3778
- "." + P + "-table tbody tr:hover ." + P + "-cell{background:var(--cfg-hover)}",
3779
- "." + 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)}",
3780
- "." + P + "-cell.num{text-align:right;font-variant-numeric:tabular-nums}",
3781
- "." + P + "-cell.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
3782
- "." + P + "-cell.null{color:var(--cfg-faint);font-style:italic}",
3783
- "." + P + "-cell.json .v{color:var(--dsw-alias-brand-primary,inherit)}",
3784
- "." + P + "-tr.deleted ." + P + "-cell,." + P + "-tr.deleted ." + P + "-rownum{opacity:.55}",
3785
- "." + P + "-tr.deleted ." + P + "-cell .v{text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 35%,transparent)}",
3786
- "." + 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}",
3787
- "." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
3788
- "." + P + "-grow{flex:1}",
3789
- "." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
3790
- "." + P + "-jump .wbctl-num-input{width:56px;padding:4px 7px;font-size:11.5px;text-align:right}",
3791
- "." + P + "-jump .wbctl-num-hint{display:none}",
3792
- "." + 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)}",
3793
- "." + 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}",
3794
- "." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
3795
- "." + 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}",
3796
- "@keyframes " + PREFIX + "-data-pulse{0%,100%{opacity:.6}50%{opacity:1}}",
3797
- "." + 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)}",
3798
- "." + P + "-mask{position:fixed;inset:0;z-index:30;background:color-mix(in oklab,currentColor 26%,transparent)}",
3799
- "." + 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}",
3800
- "." + P + "-drawer h3{margin:0;font-size:14px;font-weight:660;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
3801
- "." + 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}",
3802
- "." + P + "-drawerfoot{display:flex;gap:8px;justify-content:flex-end}",
3803
- "." + 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}",
3804
- "@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)}}",
3805
- "@media (prefers-reduced-motion:reduce){." + P + " *,." + P + "-track,." + P + "-track::after,." + P + "-sk,." + P + "-drawer{transition:none;animation:none}}",
3806
- "." + P + "-idxsub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55}",
3807
- "." + P + "-idxsum{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--cfg-muted)}",
3808
- "." + P + "-idxsum b{font-weight:660;color:var(--dsw-alias-label-primary,inherit);font-variant-numeric:tabular-nums}",
3809
- "." + 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%}",
3810
- "." + P + "-idxtags{display:flex;flex-wrap:wrap;gap:4px;max-width:280px}",
3811
- "." + 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}",
3812
- "." + P + "-idxchip.u{background:color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 15%,transparent);color:var(--dsw-alias-brand-primary,inherit)}",
3813
- "." + P + "-idxnone{color:var(--cfg-faint)}",
3814
- "." + P + "-frow th{padding:0 8px 6px;border-bottom:1px solid var(--cfg-line)}",
3815
- "." + P + "-fcell{position:relative;display:block;min-width:96px}",
3816
- "." + 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}",
3817
- "." + P + "-finput:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
3818
- "." + P + "-finput:focus{outline:none;border-color:var(--dsw-alias-brand-primary,currentColor);background:var(--cfg-surface)}",
3819
- "." + 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}",
3820
- "." + P + "-fclear:hover{color:inherit;background:var(--cfg-hover)}",
3821
- "." + P + "-emptycell{padding:22px 12px;text-align:center;color:var(--cfg-muted)}",
3822
- "." + P + " *{box-sizing:border-box}",
3823
- "." + P + "-tabs{display:flex;gap:6px;border-bottom:1px solid var(--cfg-line);padding-bottom:9px}",
3824
- "." + P + "-tabs [aria-selected=true]{background:var(--cfg-hover);color:inherit;font-weight:660}",
3825
- "." + P + "-images{display:flex;gap:5px;align-items:center}",
3826
- "." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
3827
- "." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
3828
- "." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
3829
- ].concat(require_switch().styles).concat(require_number_field().styles).join("\n");
3830
- if (DOMAIN === "storage") {
3831
- var buttons = "." + P + " :is(button)";
3832
- 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}";
3833
- }
3834
- function injectCss() {
3835
- if (typeof document === "undefined") return;
3836
- var old = document.getElementById("wb-addon-" + DOMAIN + "-data-css");
3837
- if (old) {
3838
- old.textContent = CSS;
3839
- return;
3840
- }
3841
- var style = document.createElement("style");
3842
- style.id = "wb-addon-" + DOMAIN + "-data-css";
3843
- style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
3844
- style.textContent = CSS;
3845
- document.head.appendChild(style);
3846
- }
3847
- return injectCss;
3848
- };
3849
- }
3850
- });
3851
-
3852
- // packages/addons/lib/data-view.cjs
3853
- var require_data_view = __commonJS({
3854
- "packages/addons/lib/data-view.cjs"(exports2, module2) {
3855
- "use strict";
3856
- var React = require("react");
3857
- var NF = require_number_field();
3858
- var h = React.createElement;
3859
- var COPY = require_data_copy();
3860
- var SW = require_switch();
3861
- module2.exports = function createDataView(options) {
3862
- var DOMAIN = options.domain;
3863
- function icon(name) {
3864
- return options.Icon ? h(options.Icon, { name }) : null;
3865
- }
3866
- var P = options.prefix + "-data";
3867
- var configView = { useConfig: options.useConfig };
3868
- var columnHooks = options.columns || {};
3869
- var injectCss = require_data_style()(DOMAIN, options.prefix);
3870
- var CFG_FALLBACK = {
3871
- "data.pageSize": 50,
3872
- "data.showSystemColumns": false,
3873
- "data.includeDeleted": false
3874
- };
3875
- var PAGE_SIZES = [10, 25, 50, 100, 200];
3876
- function unwrap(r) {
3877
- return r && r.result !== void 0 ? r.result : r;
3878
- }
3879
- function fmt(template, vars) {
3880
- return String(template).replace(/\{(\w+)\}/g, function(m, key) {
3881
- return vars[key] === void 0 ? m : String(vars[key]);
3882
- });
3883
- }
3884
- function pad2(n) {
3885
- return n < 10 ? "0" + n : String(n);
3886
- }
3887
- function timeText(ms) {
3888
- var d = new Date(Number(ms));
3889
- if (!Number.isFinite(d.getTime())) return String(ms);
3890
- return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) + " " + pad2(d.getHours()) + ":" + pad2(d.getMinutes());
3891
- }
3892
- function looksJson(value) {
3893
- var text = String(value).trim();
3894
- if (!text || text[0] !== "{" && text[0] !== "[") return false;
3895
- try {
3896
- JSON.parse(text);
3897
- return true;
3898
- } catch (e) {
3899
- return false;
3900
- }
3901
- }
3902
- function rawText(value, col) {
3903
- if (value === null || value === void 0) return "";
3904
- return String(value);
3905
- }
3906
- function DataView(props) {
3907
- var api = props.api;
3908
- var lang = props.lang === "en" ? "en" : "zh";
3909
- var t = Object.assign({}, COPY[lang], { indexSub: fmt(COPY[lang].indexSub, { tables: options.tables.join(" / "), domain: DOMAIN }) });
3910
- var cfgWrap = configView.useConfig(api, CFG_FALLBACK);
3911
- var cfg = cfgWrap.values;
3912
- var tablesS = React.useState(null);
3913
- var tables = tablesS[0], setTables = tablesS[1];
3914
- var activeS = React.useState("");
3915
- var active = activeS[0], setActive = activeS[1];
3916
- var dataS = React.useState(null);
3917
- var data = dataS[0], setData = dataS[1];
3918
- var loadingS = React.useState(false);
3919
- var loadingRows = loadingS[0], setLoadingRows = loadingS[1];
3920
- var loadingTablesS = React.useState(true);
3921
- var loadingTables = loadingTablesS[0], setLoadingTables = loadingTablesS[1];
3922
- var errorS = React.useState("");
3923
- var error = errorS[0], setError = errorS[1];
3924
- var pageS = React.useState(1);
3925
- var page = pageS[0], setPage = pageS[1];
3926
- var sizeS = React.useState(0);
3927
- var pageSize = sizeS[0], setPageSize = sizeS[1];
3928
- var sortS = React.useState("");
3929
- var sort = sortS[0], setSort = sortS[1];
3930
- var orderS = React.useState("desc");
3931
- var order = orderS[0], setOrder = orderS[1];
3932
- var searchDraftS = React.useState("");
3933
- var searchDraft = searchDraftS[0], setSearchDraft = searchDraftS[1];
3934
- var searchS = React.useState("");
3935
- var search = searchS[0], setSearch = searchS[1];
3936
- var filterDraftS = React.useState({});
3937
- var filterDraft = filterDraftS[0], setFilterDraft = filterDraftS[1];
3938
- var filtersS = React.useState({});
3939
- var filters = filtersS[0], setFilters = filtersS[1];
3940
- var includeDeletedS = React.useState(null);
3941
- var includeDeletedRaw = includeDeletedS[0], setIncludeDeleted = includeDeletedS[1];
3942
- var showSystemS = React.useState(null);
3943
- var showSystemRaw = showSystemS[0], setShowSystem = showSystemS[1];
3944
- var drawerS = React.useState(null);
3945
- var drawer = drawerS[0], setDrawer = drawerS[1];
3946
- var toastS = React.useState("");
3947
- var toast = toastS[0], setToast = toastS[1];
3948
- var filtersKey = JSON.stringify(filters);
3949
- var reqRef = React.useRef(0);
3950
- var toastTimer = React.useRef(null);
3951
- var refreshS = React.useState(0);
3952
- function refresh() {
3953
- loadTables();
3954
- refreshS[1](function(n) {
3955
- return n + 1;
3956
- });
3957
- }
3958
- var indexReqRef = React.useRef(0);
3959
- var indexS = React.useState(null);
3960
- var index = indexS[0], setIndex = indexS[1];
3961
- var indexBusyS = React.useState(false);
3962
- var indexBusy = indexBusyS[0], setIndexBusy = indexBusyS[1];
3963
- var cfgSize = Number(cfg["data.pageSize"]) || 50;
3964
- var size = pageSize || (PAGE_SIZES.indexOf(cfgSize) >= 0 ? cfgSize : 50);
3965
- var includeDeleted = includeDeletedRaw === null ? cfg["data.includeDeleted"] === true : includeDeletedRaw;
3966
- var showSystem = showSystemRaw === null ? cfg["data.showSystemColumns"] === true : showSystemRaw;
3967
- function say(text) {
3968
- setToast(text);
3969
- if (toastTimer.current) clearTimeout(toastTimer.current);
3970
- toastTimer.current = setTimeout(function() {
3971
- setToast("");
3972
- }, 1600);
3973
- }
3974
- function loadTables() {
3975
- setLoadingTables(true);
3976
- Promise.resolve((options.tablesLoader || function(a) {
3977
- return a.call(DOMAIN + ".dataTables");
3978
- })(api)).then(function(r) {
3979
- if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
3980
- var body = unwrap(r);
3981
- if (!body || !Array.isArray(body.tables)) throw new Error(t.loadFail);
3982
- setTables(body.tables);
3983
- setError("");
3984
- if (!active && body.tables.length) setActive(body.tables[0].name);
3985
- }).catch(function(e) {
3986
- setError(String(e && e.message || e) || t.loadFail);
3987
- }).then(function() {
3988
- setLoadingTables(false);
3989
- });
3990
- }
3991
- React.useEffect(function() {
3992
- injectCss();
3993
- loadTables();
3994
- return function() {
3995
- indexReqRef.current++;
3996
- if (toastTimer.current) clearTimeout(toastTimer.current);
3997
- };
3998
- }, []);
3999
- function selectTable(name) {
4000
- if (name === active) return;
4001
- reqRef.current++;
4002
- setActive(name);
4003
- setData(null);
4004
- setDrawer(null);
4005
- setError("");
4006
- setLoadingRows(true);
4007
- setPage(1);
4008
- setSort("");
4009
- setOrder("desc");
4010
- setSearch("");
4011
- setSearchDraft("");
4012
- setFilterDraft({});
4013
- setFilters({});
4014
- }
4015
- React.useEffect(function() {
4016
- if (searchDraft === search) return void 0;
4017
- var timer = setTimeout(function() {
4018
- setSearch(searchDraft);
4019
- setPage(1);
4020
- }, 280);
4021
- return function() {
4022
- clearTimeout(timer);
4023
- };
4024
- }, [searchDraft]);
4025
- React.useEffect(function() {
4026
- if (JSON.stringify(filterDraft) === JSON.stringify(filters)) return void 0;
4027
- var timer = setTimeout(function() {
4028
- setFilters(filterDraft);
4029
- setPage(1);
4030
- }, 280);
4031
- return function() {
4032
- clearTimeout(timer);
4033
- };
4034
- }, [filterDraft]);
4035
- React.useEffect(function() {
4036
- if (!active || !cfgWrap.ready || index) return void 0;
4037
- var req = ++reqRef.current;
4038
- setLoadingRows(true);
4039
- var args = { table: active, page, pageSize: size, order, includeDeleted };
4040
- if (sort) args.sort = sort;
4041
- if (search) args.search = search;
4042
- if (Object.keys(filters).length) args.filters = filters;
4043
- Promise.resolve((options.query || function(a, q) {
4044
- return a.call(DOMAIN + ".dataQuery", q);
4045
- })(api, args)).then(function(r) {
4046
- if (req !== reqRef.current) return;
4047
- if (r && r.ok === false) throw new Error(r && r.error || t.queryFail);
4048
- var body = unwrap(r);
4049
- if (!body) throw new Error(t.queryFail);
4050
- setData(body);
4051
- setError("");
4052
- if (body.page !== page) setPage(body.page);
4053
- }).catch(function(e) {
4054
- if (req !== reqRef.current) return;
4055
- setError(String(e && e.message || e) || t.queryFail);
4056
- }).then(function() {
4057
- if (req === reqRef.current) setLoadingRows(false);
4058
- });
4059
- return function() {
4060
- reqRef.current++;
4061
- };
4062
- }, [active, page, size, sort, order, search, includeDeleted, cfgWrap.ready, filtersKey, refreshS[0], !!index]);
4063
- React.useEffect(function() {
4064
- if (!drawer) return void 0;
4065
- function onKey(e) {
4066
- if (e.key === "Escape") setDrawer(null);
4067
- }
4068
- document.addEventListener("keydown", onKey);
4069
- return function() {
4070
- document.removeEventListener("keydown", onKey);
4071
- };
4072
- }, [drawer]);
4073
- var current = null;
4074
- if (tables) {
4075
- for (var i = 0; i < tables.length; i++) if (tables[i].name === active) current = tables[i];
4076
- }
4077
- function leaveIndex() {
4078
- indexReqRef.current++;
4079
- setIndex(null);
4080
- setIndexBusy(false);
4081
- setError("");
4082
- }
4083
- function loadIndex() {
4084
- reqRef.current++;
4085
- setError("");
4086
- var req = ++indexReqRef.current;
4087
- setIndex([]);
4088
- setIndexBusy(true);
4089
- Promise.resolve(api.call(DOMAIN + ".dataTables", { stats: true })).then(function(r) {
4090
- if (req !== indexReqRef.current) return;
4091
- if (r && r.ok === false) throw new Error(r.error || t.loadFail);
4092
- var payload = unwrap(r) || {};
4093
- var rows = (payload.tables || []).map(function(tb) {
4094
- return { table: tb, stats: tb.stats || null };
4095
- });
4096
- setIndex(rows);
4097
- setError("");
4098
- setIndexBusy(false);
4099
- }).catch(function(e) {
4100
- if (req !== indexReqRef.current) return;
4101
- setError(String(e.message || e));
4102
- setIndex([]);
4103
- setIndexBusy(false);
4104
- });
4105
- }
4106
- function renderIndex() {
4107
- var row = (index || []).filter(function(r) {
4108
- return r.table.name === active;
4109
- })[0];
4110
- var tb = row ? row.table : current;
4111
- var st = row && row.stats;
4112
- var indexes = st ? st.indexes || [] : [];
4113
- var hasExtra = indexes.some(function(ix) {
4114
- return ix.origin !== "pk";
4115
- });
4116
- var count = st && st.rows !== void 0 ? st.rows : tb && tb.count;
4117
- return h(
4118
- "div",
4119
- { className: P + "-idx" },
4120
- h(
4121
- "div",
4122
- { className: P + "-head" },
4123
- h(
4124
- "div",
4125
- { className: P + "-headmain" },
4126
- h("h2", null, icon("database"), tableLabel(tb), h("span", { className: P + "-code" }, active)),
4127
- h("div", { className: P + "-idxsub" }, t.indexSub)
4128
- ),
4129
- h("button", {
4130
- type: "button",
4131
- className: P + "-btn",
4132
- "aria-label": t.refresh,
4133
- title: t.refresh,
4134
- "aria-busy": indexBusy ? "true" : "false",
4135
- onClick: function() {
4136
- loadIndex();
4137
- }
4138
- }, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
4139
- ),
4140
- st ? h(
4141
- "div",
4142
- { className: P + "-idxsum" },
4143
- h("span", null, t.idxRows, " ", h("b", null, String(count))),
4144
- h("span", null, t.idxCols, " ", h("b", null, String(st.columnCount === void 0 ? (tb.columns || []).length : st.columnCount))),
4145
- h("span", null, fmt(t.idxCount, { n: indexes.length }))
4146
- ) : null,
4147
- 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(
4148
- "div",
4149
- { className: P + "-tablewrap" },
4150
- h(
4151
- "table",
4152
- { className: P + "-table " + P + "-idxtable" },
4153
- h("thead", null, h(
4154
- "tr",
4155
- null,
4156
- [t.idxName, t.idxColumns, t.idxType, t.idxSource, t.idxRows].map(function(label) {
4157
- return h("th", { scope: "col", key: label }, h("span", { className: P + "-thbtn" }, label));
4158
- })
4159
- )),
4160
- h("tbody", null, indexes.map(function(ix) {
4161
- return h(
4162
- "tr",
4163
- { className: P + "-tr", key: ix.name },
4164
- h("td", { className: P + "-cell mono" }, ix.name),
4165
- h("td", { className: P + "-cell mono" }, (ix.columns || []).join(", ") || t.idxNone),
4166
- h("td", { className: P + "-cell" }, ix.origin === "pk" ? t.idxKey : ix.unique ? t.idxUnique : t.idxNormal),
4167
- h("td", { className: P + "-cell" }, /^sqlite_autoindex_/.test(ix.name) ? t.idxAuto : t.idxCreated),
4168
- h("td", { className: P + "-cell num", title: t.idxRowsHelp }, String(count))
4169
- );
4170
- }))
4171
- )
4172
- )
4173
- );
4174
- }
4175
- function tableLabel(tb) {
4176
- if (!tb || !tb.label) return "";
4177
- return lang === "en" ? tb.label.en || tb.label.zh : tb.label.zh || tb.label.en;
4178
- }
4179
- function colLabel(col) {
4180
- if (!col.label) return col.name;
4181
- return lang === "en" ? col.label.en || col.label.zh : col.label.zh || col.label.en;
4182
- }
4183
- function visibleColumns() {
4184
- var cols = data && data.columns ? data.columns.map(function(col) {
4185
- var hook = columnHooks[col.name];
4186
- return hook && hook.kind ? Object.assign({}, col, { kind: hook.kind, type: hook.type || col.type }) : col;
4187
- }) : [];
4188
- return cols.filter(function(c) {
4189
- return showSystem || !c.system;
4190
- });
4191
- }
4192
- function toggleSort(name) {
4193
- if (sort !== name) {
4194
- setSort(name);
4195
- setOrder("desc");
4196
- return;
4197
- }
4198
- if (order === "desc") {
4199
- setOrder("asc");
4200
- return;
4201
- }
4202
- setSort("");
4203
- setOrder("desc");
4204
- }
4205
- function ariaSort(name) {
4206
- if (sort !== name) return "none";
4207
- return order === "asc" ? "ascending" : "descending";
4208
- }
4209
- function copyCell(value) {
4210
- var text = value === null || value === void 0 ? "" : String(value);
4211
- try {
4212
- if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text);
4213
- else {
4214
- var ta = document.createElement("textarea");
4215
- ta.value = text;
4216
- ta.style.position = "fixed";
4217
- ta.style.opacity = "0";
4218
- document.body.appendChild(ta);
4219
- ta.select();
4220
- document.execCommand("copy");
4221
- document.body.removeChild(ta);
4222
- }
4223
- say(t.copied);
4224
- } catch (e) {
4225
- }
4226
- }
4227
- function cellText(col, value) {
4228
- if (value === null || value === void 0) return null;
4229
- if (col.kind === "bool") return value ? t.yes : t.no;
4230
- if (col.kind === "timestamp") return timeText(value);
4231
- return String(value);
4232
- }
4233
- function cellClass(col, value) {
4234
- var cls = P + "-cell";
4235
- if (value === null || value === void 0) return cls + " null";
4236
- if (col.kind === "number") return cls + " num";
4237
- if (col.kind === "id" || col.kind === "path") return cls + " mono";
4238
- if (col.kind === "text" && looksJson(value)) return cls + " json";
4239
- return cls;
4240
- }
4241
- function cellTitle(col, value) {
4242
- if (value === null || value === void 0) return t.nullText;
4243
- if (col.kind === "timestamp") return String(value);
4244
- if (col.kind === "bool") return value ? "1" : "0";
4245
- return String(value);
4246
- }
4247
- function renderCell(row, col) {
4248
- var value = row[col.name];
4249
- var hook = columnHooks[col.name];
4250
- function openDetail() {
4251
- setDrawer({ column: colLabel(col), name: col.name, row: (data.page - 1) * data.pageSize + row.__i + 1, value });
4252
- }
4253
- var text = cellText(col, value);
4254
- var content;
4255
- if (text === null) content = h("span", { className: "v" }, t.nullText);
4256
- else if (text === "") content = h("span", { className: "v" }, '""');
4257
- else content = h("span", { className: "v" }, text);
4258
- if (hook && hook.render) content = hook.render({ value, row, col, lang, prefix: P, openDetail });
4259
- return h("td", {
4260
- key: col.name,
4261
- className: cellClass(col, value),
4262
- title: cellTitle(col, value),
4263
- onClick: function() {
4264
- copyCell(value);
4265
- },
4266
- onDoubleClick: openDetail
4267
- }, content);
4268
- }
4269
- function activeFilterCount() {
4270
- var n = 0;
4271
- for (var k in filters) if (Object.prototype.hasOwnProperty.call(filters, k)) n++;
4272
- return n;
4273
- }
4274
- function filterCell(col) {
4275
- var val = filterDraft[col.name] === void 0 ? "" : filterDraft[col.name];
4276
- return h(
4277
- "th",
4278
- { key: col.name, scope: "col", className: P + "-fth" },
4279
- h(
4280
- "span",
4281
- { className: P + "-fcell" },
4282
- h("input", {
4283
- className: P + "-finput",
4284
- type: "search",
4285
- value: val,
4286
- placeholder: t.filterCol,
4287
- "aria-label": t.filterCol + " " + colLabel(col),
4288
- title: colLabel(col) + " \xB7 " + t.filterCol,
4289
- onChange: function(e) {
4290
- var v = e.target.value;
4291
- setFilterDraft(function(prev) {
4292
- var next = Object.assign({}, prev);
4293
- if (v) next[col.name] = v;
4294
- else delete next[col.name];
4295
- return next;
4296
- });
4297
- }
4298
- }),
4299
- val ? h("button", {
4300
- type: "button",
4301
- className: P + "-fclear",
4302
- title: t.filterClear,
4303
- "aria-label": t.filterClear + " " + colLabel(col),
4304
- onClick: function() {
4305
- setFilterDraft(function(prev) {
4306
- var next = Object.assign({}, prev);
4307
- delete next[col.name];
4308
- return next;
4309
- });
4310
- }
4311
- }, "\xD7") : null
4312
- )
4313
- );
4314
- }
4315
- function renderRows() {
4316
- if (loadingRows && !data && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
4317
- if (loadingRows && !data) {
4318
- return h(
4319
- "div",
4320
- { className: P + "-skwrap", "aria-busy": "true" },
4321
- h("span", { className: P + "-sr" }, t.loading),
4322
- [0, 1, 2, 3, 4, 5, 6, 7].map(function(i2) {
4323
- return h("div", { key: i2, className: P + "-sk" });
4324
- })
4325
- );
4326
- }
4327
- if (error) {
4328
- return h(
4329
- "div",
4330
- { className: P + "-err", role: "alert" },
4331
- h("span", null, t.queryFail + error),
4332
- h("button", { type: "button", className: P + "-btn", onClick: refresh }, t.retry)
4333
- );
4334
- }
4335
- if (!data) return h("div", { className: P + "-empty" }, t.empty);
4336
- var cols = visibleColumns();
4337
- var rows = data.rows || [];
4338
- var narrowing = !!search || activeFilterCount() > 0;
4339
- return h(
4340
- "div",
4341
- { className: P + "-tablewrap" },
4342
- h(
4343
- "table",
4344
- { className: P + "-table" },
4345
- h(
4346
- "thead",
4347
- null,
4348
- h(
4349
- "tr",
4350
- null,
4351
- h("th", { className: P + "-rownum", scope: "col" }, "#"),
4352
- cols.map(function(col) {
4353
- return h(
4354
- "th",
4355
- { key: col.name, scope: "col", "aria-sort": ariaSort(col.name) },
4356
- h(
4357
- "button",
4358
- {
4359
- type: "button",
4360
- className: P + "-thbtn",
4361
- title: colLabel(col) + " \xB7 " + col.type,
4362
- onClick: function() {
4363
- toggleSort(col.name);
4364
- }
4365
- },
4366
- h("span", null, colLabel(col)),
4367
- h("span", { className: P + "-coltype" }, String(col.type || "").toLowerCase()),
4368
- sort === col.name ? h("span", { className: P + "-sortmark", "aria-hidden": "true" }, order === "asc" ? "\u25B2" : "\u25BC") : null
4369
- )
4370
- );
4371
- })
4372
- ),
4373
- h(
4374
- "tr",
4375
- { className: P + "-frow" },
4376
- h("th", { className: P + "-rownum", scope: "col" }, ""),
4377
- cols.map(filterCell)
4378
- )
4379
- ),
4380
- h("tbody", null, rows.length ? rows.map(function(row, idx) {
4381
- row.__i = idx;
4382
- var deleted = row.deleted_at !== null && row.deleted_at !== void 0;
4383
- return h(
4384
- "tr",
4385
- { key: row.id || idx, className: P + "-tr" + (deleted ? " deleted" : "") },
4386
- h("td", { className: P + "-rownum" }, (data.page - 1) * data.pageSize + idx + 1),
4387
- cols.map(function(col) {
4388
- var cell = renderCell(row, col);
4389
- if (deleted && col.name === "id") {
4390
- return React.cloneElement(cell, { key: col.name }, cell.props.children, h("span", { className: P + "-delbadge" }, t.deleted));
4391
- }
4392
- return cell;
4393
- })
4394
- );
4395
- }) : h("tr", null, h("td", { className: P + "-emptycell", colSpan: cols.length + 1 }, narrowing ? t.noRows : t.empty)))
4396
- )
4397
- );
4398
- }
4399
- function renderFoot() {
4400
- var pages = data ? data.pages : 1;
4401
- var total = data ? data.total : 0;
4402
- return h(
4403
- "div",
4404
- { className: P + "-foot" },
4405
- h("span", null, fmt(t.total, { n: total })),
4406
- h("span", { className: P + "-grow" }),
4407
- h("button", { type: "button", className: P + "-btn", disabled: !data || page <= 1, onClick: function() {
4408
- setPage(Math.max(1, page - 1));
4409
- } }, "\u2039 " + t.prev),
4410
- h("span", { className: P + "-pageinfo" }, fmt(t.pageInfo, { page: data ? data.page : 1, pages })),
4411
- h("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
4412
- setPage(Math.min(pages, page + 1));
4413
- } }, t.next + " \u203A"),
4414
- h(NF.NumberField, {
4415
- h,
4416
- lang,
4417
- className: P + "-jump",
4418
- value: page,
4419
- min: 1,
4420
- max: pages,
4421
- integer: true,
4422
- ariaLabel: t.jump,
4423
- hint: false,
4424
- onCommit: function(next) {
4425
- if (next !== null) setPage(next);
4426
- }
4427
- }),
4428
- data && data.queryMs !== void 0 ? h("span", null, fmt(t.queryTime, { n: data.queryMs })) : null
4429
- );
4430
- }
4431
- if (!tables && loadingTables && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
4432
- if (!tables && loadingTables) {
4433
- return h("div", { className: P + "-skwrap", "aria-busy": "true" }, h("span", { className: P + "-sr" }, t.loading), [0, 1, 2, 3].map(function(i2) {
4434
- return h("div", { key: i2, className: P + "-sk" });
4435
- }));
4436
- }
4437
- if (!tables) {
4438
- return h("div", { className: P + "-err", role: "alert" }, h("span", null, t.loadFail), h("button", { type: "button", className: P + "-btn", onClick: loadTables }, t.retry));
4439
- }
4440
- if (!tables.length) return h("div", { className: P + "-empty" }, t.emptyTable);
4441
- return h(
4442
- "div",
4443
- { className: P },
4444
- h(
4445
- "div",
4446
- { className: P + "-side" },
4447
- h("div", { className: P + "-sidetitle" }, h("span", null, icon("table"), t.tables), h("span", null, String(tables.length))),
4448
- tables.map(function(tb) {
4449
- return h(
4450
- "button",
4451
- {
4452
- key: tb.name,
4453
- type: "button",
4454
- className: P + "-stab" + (tb.name === active ? " on" : ""),
4455
- "aria-pressed": tb.name === active,
4456
- onClick: function() {
4457
- selectTable(tb.name);
4458
- }
4459
- },
4460
- h(
4461
- "span",
4462
- { className: P + "-stabname" },
4463
- h("span", null, tableLabel(tb)),
4464
- h("span", { className: P + "-sidecount" }, tb.count === void 0 || tb.count === null ? "" : String(tb.count))
4465
- ),
4466
- h("span", { className: P + "-sidetable" }, tb.name)
4467
- );
4468
- })
4469
- ),
4470
- h(
4471
- "div",
4472
- { className: P + "-main" },
4473
- h(
4474
- "div",
4475
- { className: P + "-tabs", role: "tablist", "aria-label": t.title },
4476
- h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !index, onClick: leaveIndex }, icon("list"), lang === "en" ? "Row data" : "\u884C\u6570\u636E"),
4477
- h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !!index, onClick: loadIndex }, icon("database"), t.index)
4478
- ),
4479
- index && error ? h("div", { className: P + "-err", role: "alert" }, error) : null,
4480
- index ? renderIndex() : [
4481
- h(
4482
- "div",
4483
- { className: P + "-head" },
4484
- h(
4485
- "div",
4486
- { className: P + "-headmain" },
4487
- h("h2", null, icon("database"), tableLabel(current), h("span", { className: P + "-code" }, active)),
4488
- h(
4489
- "div",
4490
- { className: P + "-sub" },
4491
- current && data && data.total !== void 0 ? fmt(t.rowCount, { n: data.total }) : "",
4492
- current && current.deletedCount ? " \xB7 " + fmt(t.deletedCount, { n: current.deletedCount }) : "",
4493
- " \xB7 " + t.subtitle
4494
- )
4495
- ),
4496
- h("button", {
4497
- type: "button",
4498
- className: P + "-btn",
4499
- "aria-label": t.refresh,
4500
- title: t.refresh,
4501
- "aria-busy": loadingRows ? "true" : "false",
4502
- onClick: refresh
4503
- }, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
4504
- ),
4505
- h(
4506
- "div",
4507
- { className: P + "-toolbar" },
4508
- h(
4509
- "div",
4510
- { className: P + "-search" },
4511
- icon("search"),
4512
- h("input", {
4513
- type: "search",
4514
- value: searchDraft,
4515
- placeholder: t.search,
4516
- "aria-label": t.search,
4517
- onChange: function(e) {
4518
- setSearchDraft(e.target.value);
4519
- }
4520
- })
4521
- ),
4522
- h(SW.Switch, {
4523
- h,
4524
- checked: includeDeleted,
4525
- label: t.includeDeleted,
4526
- onChange: function(next) {
4527
- setIncludeDeleted(next);
4528
- setPage(1);
4529
- }
4530
- }),
4531
- h(SW.Switch, {
4532
- h,
4533
- checked: showSystem,
4534
- label: t.showSystem,
4535
- onChange: function(next) {
4536
- setShowSystem(next);
4537
- }
4538
- }),
4539
- h("span", { className: P + "-grow" }),
4540
- h(
4541
- "label",
4542
- { style: { display: "inline-flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--cfg-muted)" } },
4543
- h("span", null, t.pageSize),
4544
- h("select", {
4545
- className: P + "-select",
4546
- value: size,
4547
- onChange: function(e) {
4548
- setPageSize(Number(e.target.value));
4549
- setPage(1);
4550
- }
4551
- }, PAGE_SIZES.map(function(n) {
4552
- return h("option", { key: n, value: n }, String(n));
4553
- }))
4554
- )
4555
- ),
4556
- renderRows(),
4557
- renderFoot()
4558
- ]
4559
- ),
4560
- drawer ? h(
4561
- "div",
4562
- null,
4563
- h("div", { className: P + "-mask", onClick: function() {
4564
- setDrawer(null);
4565
- } }),
4566
- h(
4567
- "aside",
4568
- { className: P + "-drawer", role: "dialog", "aria-modal": "true", "aria-label": drawer.column },
4569
- h("h3", null, fmt(t.drawerTitle, { column: drawer.column, row: drawer.row }), h("span", { className: P + "-code" }, drawer.name)),
4570
- columnHooks[drawer.name] && columnHooks[drawer.name].detail ? columnHooks[drawer.name].detail({ value: drawer.value, lang, prefix: P }) : h("pre", null, drawerText(drawer.value)),
4571
- h(
4572
- "div",
4573
- { className: P + "-drawerfoot" },
4574
- h("button", { type: "button", className: P + "-btn", onClick: function() {
4575
- copyCell(drawer.value);
4576
- } }, t.copy),
4577
- h("button", { type: "button", className: P + "-btn", onClick: function() {
4578
- setDrawer(null);
4579
- } }, t.close)
4580
- )
4581
- )
4582
- ) : null,
4583
- toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
4584
- );
4585
- }
4586
- function drawerText(value) {
4587
- if (value === null || value === void 0) return "NULL";
4588
- if (typeof value === "string" && looksJson(value)) {
4589
- try {
4590
- return JSON.stringify(JSON.parse(value), null, 2);
4591
- } catch (e) {
4592
- return value;
4593
- }
4594
- }
4595
- if (typeof value === "object") {
4596
- try {
4597
- return JSON.stringify(value, null, 2);
4598
- } catch (e) {
4599
- return String(value);
4600
- }
4601
- }
4602
- return String(value);
4603
- }
4604
- return { DataView, DOMAIN };
4605
- };
4606
- }
4607
- });
4608
-
4609
- // packages/addons/danmaku/client/views/data.cjs
4610
- var require_data = __commonJS({
4611
- "packages/addons/danmaku/client/views/data.cjs"(exports2, module2) {
4612
- "use strict";
4613
- module2.exports = require_data_view()({
4614
- domain: "danmaku",
4615
- prefix: "wbdm",
4616
- tables: ["danmaku"],
4617
- useConfig: require_config().useConfig
4618
- });
4619
- }
4620
- });
4621
-
4622
3580
  // packages/addons/lib/highlight.cjs
4623
3581
  var require_highlight = __commonJS({
4624
3582
  "packages/addons/lib/highlight.cjs"(exports2, module2) {
@@ -4663,6 +3621,80 @@ var require_highlight = __commonJS({
4663
3621
  }
4664
3622
  });
4665
3623
 
3624
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chevron-right.mjs
3625
+ var chevron_right_exports = {};
3626
+ __export(chevron_right_exports, {
3627
+ __iconData: () => __iconData17,
3628
+ default: () => ChevronRight
3629
+ });
3630
+ var __iconData17, ChevronRight;
3631
+ var init_chevron_right = __esm({
3632
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chevron-right.mjs"() {
3633
+ init_createLucideIcon();
3634
+ __iconData17 = {
3635
+ name: "chevron-right",
3636
+ size: 24,
3637
+ node: [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]]
3638
+ };
3639
+ __iconData17.node;
3640
+ ChevronRight = createLucideIcon(__iconData17);
3641
+ }
3642
+ });
3643
+
3644
+ // packages/addons/lib/disclosure-styles.cjs
3645
+ var require_disclosure_styles = __commonJS({
3646
+ "packages/addons/lib/disclosure-styles.cjs"(exports2, module2) {
3647
+ "use strict";
3648
+ module2.exports = [
3649
+ ".wb-disc{min-width:0;border:0;padding:0;margin:0}",
3650
+ // 原生 details/summary 保留键盘与无障碍语义,这里只接管观感:去掉默认三角并铺满整行。
3651
+ ".wb-disc>summary{display:flex;align-items:center;gap:6px;cursor:pointer;font-size:12.5px;font-weight:600;line-height:1.6;color:inherit;user-select:none;list-style:none;padding:2px 8px 2px 2px;margin:-2px -8px -2px -2px;border-radius:7px}",
3652
+ ".wb-disc>summary::-webkit-details-marker{display:none}",
3653
+ '.wb-disc>summary::marker{content:""}',
3654
+ ".wb-disc>summary:hover{background:color-mix(in oklab,currentColor 6%,transparent)}",
3655
+ ".wb-disc>summary:focus-visible{outline:2px solid var(--wb-accent,var(--dsw-alias-brand-primary,Highlight));outline-offset:2px}",
3656
+ ".wb-disc-chev{flex:0 0 auto;width:14px;height:14px;transition:transform 160ms ease}",
3657
+ ".wb-disc[open]>summary .wb-disc-chev{transform:rotate(90deg)}",
3658
+ ".wb-disc-title{min-width:0;overflow-wrap:anywhere}",
3659
+ ".wb-disc-meta{font-weight:400;font-size:12px;color:var(--wb-muted,var(--dsw-alias-label-tertiary,GrayText))}",
3660
+ ".wb-disc-body{margin-top:8px;min-width:0;animation:wb-disc-in 160ms ease}",
3661
+ "@keyframes wb-disc-in{from{opacity:0;transform:translateY(-2px)}to{opacity:1;transform:none}}",
3662
+ "@media(prefers-reduced-motion:reduce){.wb-disc-chev{transition:none}.wb-disc-body{animation:none}}"
3663
+ ].join("\n");
3664
+ }
3665
+ });
3666
+
3667
+ // packages/addons/lib/disclosure.cjs
3668
+ var require_disclosure = __commonJS({
3669
+ "packages/addons/lib/disclosure.cjs"(exports2, module2) {
3670
+ "use strict";
3671
+ var ChevronRight2 = (init_chevron_right(), __toCommonJS(chevron_right_exports)).default;
3672
+ function createDisclosure(React) {
3673
+ var h = React.createElement;
3674
+ function Disclosure(props) {
3675
+ var attrs = Object.assign({ className: ("wb-disc " + (props.className || "")).trim() }, props.attrs || {});
3676
+ if (props.open !== void 0) attrs.open = !!props.open;
3677
+ else if (props.defaultOpen !== void 0) attrs.open = !!props.defaultOpen;
3678
+ if (props.onToggle) attrs.onToggle = props.onToggle;
3679
+ return h(
3680
+ "details",
3681
+ attrs,
3682
+ h(
3683
+ "summary",
3684
+ null,
3685
+ h(ChevronRight2, { className: "wb-disc-chev", "aria-hidden": true, focusable: false }),
3686
+ h("span", { className: "wb-disc-title" }, props.title),
3687
+ props.meta != null && props.meta !== "" ? h("span", { className: "wb-disc-meta" }, props.meta) : null
3688
+ ),
3689
+ h("div", { className: "wb-disc-body" }, props.children)
3690
+ );
3691
+ }
3692
+ return { Disclosure, css: require_disclosure_styles() };
3693
+ }
3694
+ module2.exports = { createDisclosure, css: require_disclosure_styles() };
3695
+ }
3696
+ });
3697
+
4666
3698
  // packages/addons/lib/action-schema-style.cjs
4667
3699
  var require_action_schema_style = __commonJS({
4668
3700
  "packages/addons/lib/action-schema-style.cjs"(exports2, module2) {
@@ -4712,12 +3744,8 @@ var require_action_schema_style = __commonJS({
4712
3744
  "." + 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}",
4713
3745
  "." + P + "-copy:hover{background:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent))}",
4714
3746
  "." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
4715
- "." + P + " details>summary{cursor:pointer;font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);width:max-content}",
4716
- "." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
4717
- // 参数折叠面板:折叠时只留一行「参数 · 必填 n」,展开后与表格之间留一点气口。
3747
+ // 折叠头观感已收口到共享控件 disclosure-styles.cjs(.wb-disc),这里不再重复定义 details>summary。
4718
3748
  "." + P + "-params{min-width:0}",
4719
- "." + P + "-params>summary{user-select:none;max-width:100%}",
4720
- "." + P + "-params[open]>summary{margin-bottom:6px}",
4721
3749
  "." + P + "-empty{padding:24px;text-align:center;border:1px dashed var(--wb-border,#e3e5e9);border-radius:10px;color:var(--dsw-alias-label-tertiary,inherit)}",
4722
3750
  "." + 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;flex-wrap:wrap;overflow-wrap:anywhere}",
4723
3751
  "." + 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;max-width:100%}",
@@ -4727,7 +3755,7 @@ var require_action_schema_style = __commonJS({
4727
3755
  // 中等宽度(521–760px)三个筛选项正好排成一行,避免第三项独占一行显得参差。
4728
3756
  "@media(min-width:521px) and (max-width:760px){." + P + "-toolbar{grid-template-columns:repeat(3,minmax(0,1fr))}}",
4729
3757
  "@media(max-width:420px){." + P + "-toolbar{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}." + P + "-card{padding:10px}." + P + "-table tr{padding:8px 0}}"
4730
- ].join("\n");
3758
+ ].join("\n") + "\n" + require_disclosure_styles();
4731
3759
  return function injectCss() {
4732
3760
  if (typeof document === "undefined") return;
4733
3761
  var id = "wb-addon-" + DOMAIN + "-actions-css";
@@ -4752,6 +3780,7 @@ var require_action_schema_view = __commonJS({
4752
3780
  "use strict";
4753
3781
  var React = require("react");
4754
3782
  var createHighlight = require_highlight()(React);
3783
+ var Disclosure = require_disclosure().createDisclosure(React).Disclosure;
4755
3784
  var h = React.createElement;
4756
3785
  var COPY = {
4757
3786
  zh: {
@@ -5236,10 +4265,12 @@ var require_action_schema_view = __commonJS({
5236
4265
  ),
5237
4266
  action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
5238
4267
  rows.length ? h(
5239
- "details",
4268
+ Disclosure,
5240
4269
  {
5241
4270
  className: P + "-params",
5242
- "data-params-fold": action.name,
4271
+ title: t.params,
4272
+ meta: required ? t.requiredCount(required) : "",
4273
+ attrs: { "data-params-fold": action.name },
5243
4274
  open,
5244
4275
  // 原生 details 自带键盘与无障碍语义,这里只记下用户的开合;
5245
4276
  // 筛选变化引起的程序性开合也会触发 toggle,记下的值与当次默认一致,随后由 resetFolds 清掉。
@@ -5253,7 +4284,6 @@ var require_action_schema_view = __commonJS({
5253
4284
  });
5254
4285
  }
5255
4286
  },
5256
- h("summary", null, t.params + (required ? " \xB7 " + t.requiredCount(required) : "")),
5257
4287
  h(
5258
4288
  "table",
5259
4289
  { className: P + "-table" },
@@ -5290,9 +4320,8 @@ var require_action_schema_view = __commonJS({
5290
4320
  }) : h("div", { className: P + "-none" }, t.noExamples)
5291
4321
  ),
5292
4322
  h(
5293
- "details",
5294
- null,
5295
- h("summary", null, t.raw),
4323
+ Disclosure,
4324
+ { title: t.raw },
5296
4325
  h("pre", { className: P + "-pre" }, JSON.stringify(action.input || {}, null, 2))
5297
4326
  )
5298
4327
  );
@@ -5448,7 +4477,6 @@ var icons = {
5448
4477
  megaphone: GLYPHS["megaphone"],
5449
4478
  list: GLYPHS["list"],
5450
4479
  settings: GLYPHS["settings"],
5451
- database: GLYPHS["database"],
5452
4480
  play: GLYPHS["play"]
5453
4481
  };
5454
4482
  function makeTab(React) {
@@ -5463,7 +4491,7 @@ function definition(host) {
5463
4491
  var tab = makeTab(host.react);
5464
4492
  return {
5465
4493
  id: ADDON_ID,
5466
- version: "0.3.0",
4494
+ version: "0.3.2",
5467
4495
  icon: tab("megaphone"),
5468
4496
  views: [
5469
4497
  {
@@ -5478,12 +4506,6 @@ function definition(host) {
5478
4506
  title: { zh: "\u914D\u7F6E", en: "Settings" },
5479
4507
  component: require_config()
5480
4508
  },
5481
- {
5482
- id: "data",
5483
- icon: tab("database"),
5484
- title: { zh: "\u6570\u636E", en: "Data" },
5485
- component: require_data()
5486
- },
5487
4509
  {
5488
4510
  id: "actions",
5489
4511
  icon: tab("play"),