@dsh-teamwork/dsh-teamwork 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/cordis.patch.yml +2 -1
- package/lib/client.js +69 -5
- package/lib/client.js.map +1 -1
- package/lib/index.js +45 -24
- package/lib/index.js.map +1 -1
- package/lib/panel.js +1 -0
- package/lib/panel.js.map +1 -1
- package/lib/relay.js +160 -0
- package/lib/relay.js.map +1 -0
- package/lib/types/client.d.ts +25 -1
- package/lib/types/client.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/panel.d.ts +14 -0
- package/lib/types/panel.d.ts.map +1 -1
- package/lib/types/relay.d.ts +53 -0
- package/lib/types/relay.d.ts.map +1 -0
- package/lib/web/client.js +603 -265
- package/package.json +1 -1
package/lib/web/client.js
CHANGED
|
@@ -48,160 +48,234 @@ var STYLE_ELEMENT_ID = "dsh-teamwork-ui-styles";
|
|
|
48
48
|
var css = String.raw`
|
|
49
49
|
.twui {
|
|
50
50
|
--twui-font: var(--dsw-font-family, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif);
|
|
51
|
-
--twui-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
51
|
+
--twui-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
|
|
52
52
|
--twui-fg: var(--dsw-alias-label-primary, #1b2033);
|
|
53
|
-
--twui-fg-muted: var(--dsw-alias-label-secondary, #
|
|
54
|
-
--twui-fg-subtle: var(--dsw-alias-label-tertiary, #
|
|
53
|
+
--twui-fg-muted: var(--dsw-alias-label-secondary, #565c73);
|
|
54
|
+
--twui-fg-subtle: var(--dsw-alias-label-tertiary, #868ba0);
|
|
55
55
|
--twui-bg: var(--dsw-alias-bg-base, #fbfaf8);
|
|
56
56
|
--twui-surface: var(--dsw-alias-bg-layer-1, #ffffff);
|
|
57
57
|
--twui-surface-muted: var(--dsw-alias-bg-layer-2, #f4f3f0);
|
|
58
58
|
--twui-hover: var(--dsw-alias-interactive-bg-hover, rgba(27, 32, 51, 0.06));
|
|
59
|
-
--twui-border: var(--dsw-alias-border-l2, #
|
|
60
|
-
--twui-border-strong: var(--dsw-alias-border-l3, #
|
|
59
|
+
--twui-border: var(--dsw-alias-border-l2, #e7e5e0);
|
|
60
|
+
--twui-border-strong: var(--dsw-alias-border-l3, #d5d3cd);
|
|
61
61
|
--twui-accent: var(--dsw-alias-state-business-primary, #1e2f6d);
|
|
62
62
|
--twui-primary: var(--dsw-alias-button-primary-fill, #1b2033);
|
|
63
63
|
--twui-primary-fg: var(--dsw-alias-label-primary-inverted, #ffffff);
|
|
64
64
|
--twui-success: var(--dsw-alias-state-success-primary, #1f8a4c);
|
|
65
|
-
--twui-warning: var(--dsw-alias-state-warn-primary, #
|
|
65
|
+
--twui-warning: var(--dsw-alias-state-warn-primary, #a8650a);
|
|
66
66
|
--twui-danger: var(--dsw-alias-state-error-primary, #c9372c);
|
|
67
67
|
--twui-focus: var(--dsw-focus-ring-color, #6a7bd1);
|
|
68
68
|
--twui-radius-sm: var(--dsw-radius-sm, 6px);
|
|
69
69
|
--twui-radius-md: var(--dsw-radius-md, 8px);
|
|
70
70
|
--twui-radius-lg: var(--dsw-radius-lg, 12px);
|
|
71
|
+
--twui-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
|
|
72
|
+
/* A quiet fill drawn from the text colour, so it shows on any surface in either theme. */
|
|
73
|
+
--twui-fill: color-mix(in srgb, var(--twui-fg) 6%, transparent);
|
|
74
|
+
--twui-fill-strong: color-mix(in srgb, var(--twui-fg) 10%, transparent);
|
|
71
75
|
font-family: var(--twui-font);
|
|
72
76
|
font-size: 13px;
|
|
73
77
|
line-height: 1.55;
|
|
74
78
|
color: var(--twui-fg);
|
|
79
|
+
-webkit-font-smoothing: antialiased;
|
|
75
80
|
}
|
|
76
81
|
@media (prefers-color-scheme: dark) {
|
|
77
82
|
.twui {
|
|
78
|
-
--twui-fg: var(--dsw-alias-label-primary, #
|
|
79
|
-
--twui-fg-muted: var(--dsw-alias-label-secondary, #
|
|
80
|
-
--twui-fg-subtle: var(--dsw-alias-label-tertiary, #
|
|
81
|
-
--twui-bg: var(--dsw-alias-bg-base, #
|
|
82
|
-
--twui-surface: var(--dsw-alias-bg-layer-1, #
|
|
83
|
-
--twui-surface-muted: var(--dsw-alias-bg-layer-2, #
|
|
83
|
+
--twui-fg: var(--dsw-alias-label-primary, #eceef5);
|
|
84
|
+
--twui-fg-muted: var(--dsw-alias-label-secondary, #b0b5c8);
|
|
85
|
+
--twui-fg-subtle: var(--dsw-alias-label-tertiary, #82889f);
|
|
86
|
+
--twui-bg: var(--dsw-alias-bg-base, #131726);
|
|
87
|
+
--twui-surface: var(--dsw-alias-bg-layer-1, #1a1f33);
|
|
88
|
+
--twui-surface-muted: var(--dsw-alias-bg-layer-2, #222842);
|
|
84
89
|
--twui-hover: var(--dsw-alias-interactive-bg-hover, rgba(255, 255, 255, 0.07));
|
|
85
|
-
--twui-border: var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.
|
|
86
|
-
--twui-border-strong: var(--dsw-alias-border-l3, rgba(255, 255, 255, 0.
|
|
87
|
-
--twui-accent: var(--dsw-alias-state-business-primary, #
|
|
88
|
-
--twui-primary: var(--dsw-alias-button-primary-fill, #
|
|
89
|
-
--twui-primary-fg: var(--dsw-alias-label-primary-inverted, #
|
|
90
|
+
--twui-border: var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.09));
|
|
91
|
+
--twui-border-strong: var(--dsw-alias-border-l3, rgba(255, 255, 255, 0.15));
|
|
92
|
+
--twui-accent: var(--dsw-alias-state-business-primary, #a9b6ef);
|
|
93
|
+
--twui-primary: var(--dsw-alias-button-primary-fill, #eceef5);
|
|
94
|
+
--twui-primary-fg: var(--dsw-alias-label-primary-inverted, #131726);
|
|
90
95
|
--twui-success: var(--dsw-alias-state-success-primary, #4cc27f);
|
|
91
|
-
--twui-warning: var(--dsw-alias-state-warn-primary, #
|
|
96
|
+
--twui-warning: var(--dsw-alias-state-warn-primary, #e6a640);
|
|
92
97
|
--twui-danger: var(--dsw-alias-state-error-primary, #ff7b6e);
|
|
98
|
+
--twui-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
|
93
99
|
}
|
|
94
100
|
}
|
|
95
101
|
.twui *, .twui *::before, .twui *::after { box-sizing: border-box; }
|
|
96
|
-
.twui :focus-visible { outline: 2px solid var(--twui-focus); outline-offset: 2px; }
|
|
102
|
+
.twui :focus-visible { outline: 2px solid var(--twui-focus); outline-offset: 2px; border-radius: var(--twui-radius-sm); }
|
|
103
|
+
.twui h1, .twui h2, .twui h3, .twui p { margin: 0; }
|
|
97
104
|
.twui-mono { font-family: var(--twui-mono); font-size: 0.92em; }
|
|
98
105
|
.twui-muted { color: var(--twui-fg-muted); }
|
|
99
106
|
.twui-subtle { color: var(--twui-fg-subtle); font-size: 12px; }
|
|
107
|
+
.twui-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
108
|
+
.twui-stack { display: grid; gap: 12px; }
|
|
100
109
|
|
|
110
|
+
/* Buttons */
|
|
101
111
|
.twui-btn {
|
|
102
112
|
display: inline-flex; align-items: center; justify-content: center; gap: 6px;
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
height: 32px; padding: 0 12px; border-radius: var(--twui-radius-sm);
|
|
114
|
+
font: inherit; font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer;
|
|
105
115
|
border: 1px solid var(--twui-border-strong); background: var(--twui-surface); color: var(--twui-fg);
|
|
116
|
+
transition: background-color .12s ease, border-color .12s ease, opacity .12s ease;
|
|
106
117
|
}
|
|
107
118
|
.twui-btn:hover:not(:disabled) { background: var(--twui-hover); }
|
|
108
119
|
.twui-btn:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
109
|
-
.twui-btn[data-variant="primary"] { background: var(--twui-primary); color: var(--twui-primary-fg); border-color:
|
|
120
|
+
.twui-btn[data-variant="primary"] { background: var(--twui-primary); color: var(--twui-primary-fg); border-color: transparent; }
|
|
110
121
|
.twui-btn[data-variant="primary"]:hover:not(:disabled) { background: var(--twui-primary); opacity: 0.88; }
|
|
111
122
|
.twui-btn[data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--twui-fg-muted); }
|
|
112
|
-
.twui-btn[data-variant="ghost"]:hover:not(:disabled) { color: var(--twui-fg); }
|
|
123
|
+
.twui-btn[data-variant="ghost"]:hover:not(:disabled) { color: var(--twui-fg); background: var(--twui-hover); }
|
|
113
124
|
.twui-btn[data-variant="danger"] { color: var(--twui-danger); }
|
|
114
|
-
.twui-btn[data-size="sm"] { padding:
|
|
125
|
+
.twui-btn[data-size="sm"] { height: 28px; padding: 0 10px; font-size: 12px; }
|
|
126
|
+
.twui-btn[data-size="lg"] { height: 40px; padding: 0 16px; font-size: 14px; }
|
|
127
|
+
.twui-btn[data-block] { width: 100%; }
|
|
128
|
+
.twui-btn[data-icon-only] { width: 32px; padding: 0; }
|
|
129
|
+
.twui-btn[data-icon-only][data-size="sm"] { width: 28px; }
|
|
130
|
+
.twui-link { font: inherit; padding: 0; border: 0; background: none; color: var(--twui-accent); cursor: pointer; text-decoration: none; }
|
|
131
|
+
.twui-link:hover { text-decoration: underline; text-underline-offset: 2px; }
|
|
115
132
|
|
|
133
|
+
/* Badges */
|
|
116
134
|
.twui-badge {
|
|
117
|
-
display: inline-flex; align-items: center; gap:
|
|
118
|
-
font-size: 12px;
|
|
119
|
-
background: var(--twui-
|
|
135
|
+
display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 22px;
|
|
136
|
+
font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: 999px;
|
|
137
|
+
background: var(--twui-fill); color: var(--twui-fg-muted);
|
|
120
138
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
121
139
|
}
|
|
122
|
-
.twui-badge[data-tone="success"] { color: var(--twui-success); }
|
|
123
|
-
.twui-badge[data-tone="warning"] { color: var(--twui-warning); }
|
|
124
|
-
.twui-badge[data-tone="danger"] { color: var(--twui-danger); }
|
|
125
|
-
.twui-badge[data-tone="accent"] { color: var(--twui-accent); }
|
|
140
|
+
.twui-badge[data-tone="success"] { color: var(--twui-success); background: color-mix(in srgb, var(--twui-success) 10%, transparent); }
|
|
141
|
+
.twui-badge[data-tone="warning"] { color: var(--twui-warning); background: color-mix(in srgb, var(--twui-warning) 12%, transparent); }
|
|
142
|
+
.twui-badge[data-tone="danger"] { color: var(--twui-danger); background: color-mix(in srgb, var(--twui-danger) 10%, transparent); }
|
|
143
|
+
.twui-badge[data-tone="accent"] { color: var(--twui-accent); background: color-mix(in srgb, var(--twui-accent) 10%, transparent); }
|
|
126
144
|
.twui-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
|
|
127
|
-
.twui-badge[data-outline] { background: transparent; border: 1px solid var(--twui-border); }
|
|
145
|
+
.twui-badge[data-outline] { background: transparent; border: 1px solid var(--twui-border-strong); }
|
|
128
146
|
|
|
129
|
-
|
|
147
|
+
/* Tabs */
|
|
148
|
+
.twui-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--twui-border); overflow-x: auto; }
|
|
130
149
|
.twui-tab {
|
|
131
|
-
|
|
132
|
-
|
|
150
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
151
|
+
font: inherit; font-size: 13px; font-weight: 500; background: none; border: 0; cursor: pointer; white-space: nowrap;
|
|
152
|
+
padding: 10px 4px; margin: 0 8px -1px 0; color: var(--twui-fg-muted); border-bottom: 2px solid transparent;
|
|
133
153
|
}
|
|
134
154
|
.twui-tab:hover { color: var(--twui-fg); }
|
|
135
|
-
.twui-tab[aria-selected="true"] { color: var(--twui-fg);
|
|
136
|
-
.twui-tab-count {
|
|
155
|
+
.twui-tab[aria-selected="true"] { color: var(--twui-fg); border-bottom-color: var(--twui-fg); }
|
|
156
|
+
.twui-tab-count {
|
|
157
|
+
min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
|
|
158
|
+
font-size: 11px; font-variant-numeric: tabular-nums; background: var(--twui-fill); color: var(--twui-fg-muted);
|
|
159
|
+
}
|
|
137
160
|
|
|
138
|
-
|
|
139
|
-
.twui-item
|
|
140
|
-
.twui-item-
|
|
141
|
-
.twui-item-
|
|
142
|
-
.twui-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
.twui-item-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
161
|
+
/* List items */
|
|
162
|
+
.twui-item { border: 1px solid var(--twui-border); border-radius: var(--twui-radius-lg); background: var(--twui-surface); box-shadow: var(--twui-shadow); }
|
|
163
|
+
.twui-item-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; padding: 16px; align-items: start; }
|
|
164
|
+
.twui-item-main[data-no-icon] { grid-template-columns: minmax(0, 1fr) auto; }
|
|
165
|
+
.twui-tile {
|
|
166
|
+
width: 36px; height: 36px; border-radius: var(--twui-radius-md); display: grid; place-items: center; flex: none;
|
|
167
|
+
background: var(--twui-fill); color: var(--twui-fg-muted);
|
|
168
|
+
}
|
|
169
|
+
.twui-item-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; font-weight: 600; line-height: 22px; }
|
|
170
|
+
.twui-item-subtitle { font-family: var(--twui-mono); font-size: 11.5px; font-weight: 400; color: var(--twui-fg-subtle); }
|
|
171
|
+
.twui-item-desc { margin-top: 2px; color: var(--twui-fg-muted); }
|
|
172
|
+
.twui-item-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
|
|
173
|
+
.twui-item-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
|
|
174
|
+
.twui-item-notice { grid-column: 2 / -1; margin-top: 8px; }
|
|
175
|
+
.twui-item-main[data-no-icon] .twui-item-notice { grid-column: 1 / -1; }
|
|
176
|
+
.twui-item-body { border-top: 1px solid var(--twui-border); padding: 14px 16px 16px; display: grid; gap: 10px; }
|
|
177
|
+
@container (max-width: 560px) {
|
|
178
|
+
.twui-item-main { grid-template-columns: auto minmax(0, 1fr); }
|
|
179
|
+
.twui-item-actions { grid-column: 1 / -1; justify-content: flex-start; margin-top: 8px; }
|
|
150
180
|
}
|
|
151
181
|
|
|
152
|
-
|
|
182
|
+
/* Inline notices and banners */
|
|
183
|
+
.twui-notice { color: var(--twui-fg-muted); display: flex; align-items: flex-start; gap: 6px; }
|
|
153
184
|
.twui-notice[data-tone="success"] { color: var(--twui-success); }
|
|
154
185
|
.twui-notice[data-tone="warning"] { color: var(--twui-warning); }
|
|
155
186
|
.twui-notice[data-tone="danger"] { color: var(--twui-danger); }
|
|
187
|
+
.twui-notice > svg { margin-top: 2px; }
|
|
188
|
+
.twui-banner {
|
|
189
|
+
display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--twui-radius-md);
|
|
190
|
+
border: 1px solid var(--twui-border); background: var(--twui-fill);
|
|
191
|
+
}
|
|
192
|
+
.twui-banner[data-tone="warning"] { border-color: color-mix(in srgb, var(--twui-warning) 35%, transparent); background: color-mix(in srgb, var(--twui-warning) 7%, var(--twui-surface)); }
|
|
193
|
+
.twui-banner[data-tone="danger"] { border-color: color-mix(in srgb, var(--twui-danger) 35%, transparent); background: color-mix(in srgb, var(--twui-danger) 7%, var(--twui-surface)); }
|
|
194
|
+
.twui-banner-icon { margin-top: 1px; color: var(--twui-fg-muted); }
|
|
195
|
+
.twui-banner[data-tone="warning"] .twui-banner-icon { color: var(--twui-warning); }
|
|
196
|
+
.twui-banner[data-tone="danger"] .twui-banner-icon { color: var(--twui-danger); }
|
|
197
|
+
.twui-banner-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
|
|
198
|
+
.twui-banner-title { font-weight: 600; }
|
|
199
|
+
.twui-banner-text { color: var(--twui-fg-muted); }
|
|
156
200
|
|
|
157
|
-
|
|
158
|
-
.twui-dl
|
|
159
|
-
.twui-dl
|
|
201
|
+
/* Details */
|
|
202
|
+
.twui-dl { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
|
|
203
|
+
.twui-dl dt { color: var(--twui-fg-subtle); font-size: 12px; line-height: 22px; }
|
|
204
|
+
.twui-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; line-height: 22px; }
|
|
160
205
|
|
|
206
|
+
/* Inline confirmation */
|
|
161
207
|
.twui-confirm {
|
|
162
|
-
display: grid; gap:
|
|
163
|
-
border-top: 1px solid var(--twui-border); background: var(--twui-
|
|
164
|
-
border-radius: 0 0 var(--twui-radius-
|
|
208
|
+
display: grid; gap: 10px; padding: 14px 16px;
|
|
209
|
+
border-top: 1px solid var(--twui-border); background: var(--twui-fill);
|
|
210
|
+
border-radius: 0 0 var(--twui-radius-lg) var(--twui-radius-lg);
|
|
165
211
|
}
|
|
166
|
-
.twui-confirm-title {
|
|
167
|
-
.twui-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
212
|
+
.twui-confirm-title { font-weight: 600; }
|
|
168
213
|
|
|
214
|
+
/* Form fields */
|
|
215
|
+
.twui-field { display: grid; gap: 6px; }
|
|
216
|
+
.twui-label { font-size: 12px; font-weight: 500; color: var(--twui-fg-muted); }
|
|
169
217
|
.twui-input {
|
|
170
|
-
font: inherit; min-width: 0; flex: 1; padding:
|
|
218
|
+
font: inherit; min-width: 0; flex: 1; height: 36px; padding: 0 12px;
|
|
171
219
|
border: 1px solid var(--twui-border-strong); border-radius: var(--twui-radius-sm);
|
|
172
220
|
background: var(--twui-surface); color: var(--twui-fg);
|
|
221
|
+
transition: border-color .12s ease, box-shadow .12s ease;
|
|
173
222
|
}
|
|
223
|
+
.twui-input:focus { outline: none; border-color: var(--twui-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--twui-focus) 22%, transparent); }
|
|
174
224
|
.twui-input::placeholder { color: var(--twui-fg-subtle); }
|
|
225
|
+
.twui-input[aria-invalid="true"] { border-color: var(--twui-danger); }
|
|
226
|
+
.twui-input[data-size="lg"] { height: 44px; font-size: 16px; }
|
|
227
|
+
.twui-hint { font-size: 12px; color: var(--twui-fg-subtle); }
|
|
228
|
+
.twui-hint[data-tone="danger"] { color: var(--twui-danger); }
|
|
175
229
|
|
|
230
|
+
/* Monogram, spinner, skeleton */
|
|
176
231
|
.twui-monogram {
|
|
177
232
|
display: grid; place-items: center; flex: none; font-weight: 700;
|
|
178
|
-
background: var(--twui-
|
|
233
|
+
background: var(--twui-fill-strong); color: var(--twui-fg-muted); border-radius: 22%;
|
|
179
234
|
}
|
|
180
|
-
|
|
181
235
|
.twui-spinner {
|
|
182
236
|
width: 12px; height: 12px; border-radius: 50%; flex: none;
|
|
183
237
|
border: 2px solid currentColor; border-right-color: transparent;
|
|
184
238
|
animation: twui-spin 0.8s linear infinite;
|
|
185
239
|
}
|
|
186
240
|
@keyframes twui-spin { to { transform: rotate(360deg); } }
|
|
187
|
-
|
|
241
|
+
.twui-skeleton { border-radius: var(--twui-radius-sm); background: var(--twui-fill-strong); animation: twui-pulse 1.4s ease-in-out infinite; }
|
|
242
|
+
@keyframes twui-pulse { 50% { opacity: 0.55; } }
|
|
243
|
+
@media (prefers-reduced-motion: reduce) {
|
|
244
|
+
.twui-spinner { animation-duration: 2.4s; }
|
|
245
|
+
.twui-skeleton { animation: none; }
|
|
246
|
+
.twui-btn, .twui-input { transition: none; }
|
|
247
|
+
}
|
|
188
248
|
|
|
249
|
+
/* Toast */
|
|
189
250
|
.twui-toast {
|
|
190
|
-
position: sticky; bottom:
|
|
191
|
-
|
|
251
|
+
position: sticky; bottom: 16px; justify-self: center; z-index: 1;
|
|
252
|
+
display: inline-flex; align-items: center; gap: 8px;
|
|
253
|
+
max-width: min(520px, 100%); padding: 10px 16px; border-radius: var(--twui-radius-md);
|
|
192
254
|
background: var(--twui-primary); color: var(--twui-primary-fg); font-size: 13px;
|
|
193
|
-
box-shadow: 0
|
|
255
|
+
box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.35);
|
|
194
256
|
}
|
|
195
257
|
.twui-toast[data-tone="danger"] { background: var(--twui-danger); color: #fff; }
|
|
196
258
|
|
|
197
|
-
|
|
198
|
-
.twui-empty
|
|
199
|
-
.twui-empty
|
|
259
|
+
/* Empty / first screens */
|
|
260
|
+
.twui-empty { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 40px 24px; color: var(--twui-fg-muted); }
|
|
261
|
+
.twui-empty-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--twui-fill); color: var(--twui-fg-subtle); margin-bottom: 4px; }
|
|
262
|
+
.twui-empty-title { font-size: 14px; font-weight: 600; color: var(--twui-fg); }
|
|
200
263
|
|
|
264
|
+
/* Card */
|
|
265
|
+
.twui-card { border: 1px solid var(--twui-border); border-radius: var(--twui-radius-lg); background: var(--twui-surface); box-shadow: var(--twui-shadow); }
|
|
266
|
+
|
|
267
|
+
/* Panel: header, nav and content share one centred column */
|
|
201
268
|
.twui-panel { height: 100%; min-height: 0; display: flex; flex-direction: column; background: var(--twui-bg); container-type: inline-size; }
|
|
202
|
-
.twui-panel-header
|
|
203
|
-
.twui-panel-
|
|
204
|
-
.twui-panel-
|
|
269
|
+
.twui-panel-header, .twui-panel-nav { background: var(--twui-surface); }
|
|
270
|
+
.twui-panel-header { border-bottom: 1px solid var(--twui-border); }
|
|
271
|
+
.twui-panel-column { max-width: 1008px; margin: 0 auto; padding: 0 24px; }
|
|
272
|
+
.twui-panel-header > .twui-panel-column { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding-top: 16px; padding-bottom: 16px; }
|
|
273
|
+
.twui-panel-nav .twui-tabs { border-bottom: 0; }
|
|
274
|
+
.twui-panel-nav { border-bottom: 1px solid var(--twui-border); }
|
|
275
|
+
.twui-panel-body { flex: 1; min-height: 0; overflow-y: auto; }
|
|
276
|
+
.twui-panel-content { display: grid; gap: 12px; align-content: start; padding-top: 20px; padding-bottom: 32px; }
|
|
277
|
+
.twui-panel[data-centered] .twui-panel-body { display: grid; place-items: center; }
|
|
278
|
+
.twui-panel[data-centered] .twui-panel-content { width: 100%; }
|
|
205
279
|
`;
|
|
206
280
|
|
|
207
281
|
// ui/src/root.tsx
|
|
@@ -221,11 +295,80 @@ function join(...names) {
|
|
|
221
295
|
return names.filter(Boolean).join(" ");
|
|
222
296
|
}
|
|
223
297
|
|
|
224
|
-
// ui/src/
|
|
225
|
-
var import_react2 = require("react");
|
|
298
|
+
// ui/src/brand.tsx
|
|
226
299
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
227
|
-
var
|
|
300
|
+
var MARK = "M206.84 178.37L203.20 176.51L197.50 174.07L191.54 172.04L185.35 170.41L178.93 169.17L172.31 168.32L165.50 167.86L158.53 167.77L151.41 168.06L144.16 168.72L136.80 169.75L129.35 171.13L121.82 172.87L114.23 174.96L109.15 176.54L98.77 180.09L95.30 181.17L90.18 182.60L86.83 183.42L81.88 184.48L77.03 185.31L72.29 185.93L67.65 186.34L61.63 186.57L57.23 186.50L51.52 186.10L47.35 185.57L41.96 184.58L36.75 183.26L31.71 181.62L34.49 185.76L37.47 189.81L40.64 193.76L44.00 197.60L47.54 201.33L51.26 204.95L55.15 208.44L59.21 211.81L63.44 215.04L67.84 218.14L72.39 221.10L77.09 223.91L81.95 226.57L86.95 229.08L94.72 232.53L102.79 235.59L111.15 238.26L119.80 240.51L125.70 241.78L134.78 243.30L140.96 244.06L144.09 244.36L173.55 246.46L180.99 247.20L187.94 248.12L194.39 249.29L200.32 250.79L203.07 251.68L205.68 252.68L209.32 254.39L212.63 256.39L215.59 258.72L218.18 261.38L219.71 263.37L223.20 305.34L228.75 306.83L233.12 307.74L237.50 308.33L241.25 308.55L245.00 308.50L249.38 308.10L253.75 307.35L258.75 306.16L268.56 303.21L246.40 256.22L246.73 253.74L247.28 251.31L248.06 248.95L249.61 245.50L250.90 243.25L252.39 241.04L254.06 238.85L255.91 236.70L257.94 234.56L260.13 232.43L264.98 228.19L270.41 223.93L277.92 218.50L302.38 201.94L304.94 200.12L309.92 196.37L317.01 190.52L321.49 186.47L327.85 180.20L333.75 173.71L339.20 167.02L344.20 160.15L347.28 155.48L350.15 150.75L352.81 145.96L355.27 141.12L357.52 136.24L359.57 131.33L361.40 126.38L363.02 121.41L364.43 116.42L365.63 111.42L366.61 106.41L367.38 101.41L367.94 96.41L368.27 91.43L364.74 95.37L360.88 99.12L356.71 102.68L353.38 105.22L348.64 108.41L344.87 110.67L339.54 113.49L335.33 115.45L330.91 117.29L326.31 118.98L321.50 120.54L318.18 121.50L313.04 122.82L309.49 123.63L298.73 125.74L293.54 126.91L285.93 128.90L278.54 131.16L271.39 133.69L264.50 136.48L257.89 139.53L253.65 141.71L249.55 144.00L245.59 146.40L239.93 150.20L236.35 152.87L232.93 155.65L228.12 160.01L225.13 163.04L222.32 166.18L218.46 171.06L215.04 176.17L212.07 181.49ZM0.00 299.31L6.29 300.81L19.95 304.97L27.09 306.81L30.85 307.55L34.71 308.11L38.64 308.45L42.44 308.56L45.78 308.48L49.55 308.17L52.80 307.74L56.57 307.06L60.13 306.25L63.75 305.29L76.43 301.42L80.87 300.19L85.96 299.11L90.20 298.63L92.48 298.57L95.22 298.67L97.56 298.92L100.48 299.40L106.29 300.81L119.95 304.97L126.98 306.78L130.85 307.55L134.55 308.09L137.85 308.40L141.64 308.56L145.61 308.49L149.55 308.17L153.42 307.64L157.20 306.93L160.85 306.07L164.44 305.10L179.80 300.47L183.48 299.58L186.92 298.96L190.65 298.61L194.30 298.61L198.04 298.98L202.57 299.84L194.87 271.11L192.61 271.07L189.26 271.14L185.49 271.44L182.24 271.86L178.58 272.51L174.89 273.34L171.27 274.29L157.98 278.34L153.04 279.67L149.99 280.33L147.56 280.72L144.76 280.99L142.48 281.06L140.20 281.00L137.40 280.73L134.98 280.35L131.93 279.70L127.00 278.38L113.68 274.32L109.51 273.23L105.83 272.42L102.03 271.77L98.93 271.39L95.61 271.14L92.44 271.07L88.64 271.18L84.71 271.52L80.85 272.08L77.09 272.82L69.95 274.66L55.73 278.98L49.99 280.33L47.09 280.78L44.76 280.99L42.48 281.06L39.73 280.97L35.96 280.52L31.93 279.70L27.57 278.54L16.42 275.11L10.94 273.58L5.08 272.28L0.00 271.51ZM284.83 299.31L289.73 298.66L292.48 298.57L295.69 298.71L299.01 299.13L302.00 299.72L305.73 300.65L319.95 304.97L327.09 306.81L330.85 307.55L334.71 308.11L338.64 308.45L342.44 308.56L345.78 308.48L349.71 308.16L353.42 307.64L357.31 306.90L364.44 305.10L379.25 300.61L382.97 299.69L385.96 299.11L389.73 298.66L392.93 298.57L396.15 298.75L400.00 299.31L400.00 271.51L395.61 271.14L390.85 271.08L386.27 271.36L381.47 271.98L377.09 272.82L372.66 273.91L367.92 275.26L357.41 278.50L352.52 279.80L347.56 280.72L345.22 280.96L342.93 281.06L340.65 281.02L338.34 280.84L335.96 280.52L332.97 279.94L327.57 278.54L316.46 275.13L311.57 273.75L306.45 272.55L301.11 271.64L297.98 271.30L294.99 271.12L289.43 271.13L283.78 271.64L277.70 272.69Z";
|
|
301
|
+
var BRAND_INDIGO = "#1E2F6D";
|
|
302
|
+
var BRAND_PAPER = "#F8F5EF";
|
|
303
|
+
function BrandMark({ size = 32, title }) {
|
|
228
304
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
305
|
+
"svg",
|
|
306
|
+
{
|
|
307
|
+
width: size,
|
|
308
|
+
height: size,
|
|
309
|
+
viewBox: "0 0 400 400",
|
|
310
|
+
role: title ? "img" : void 0,
|
|
311
|
+
"aria-label": title,
|
|
312
|
+
"aria-hidden": title ? void 0 : true,
|
|
313
|
+
style: { flex: "none", borderRadius: "22%", display: "block" },
|
|
314
|
+
children: [
|
|
315
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("title", { children: title }),
|
|
316
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: "400", height: "400", fill: BRAND_INDIGO }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { fill: BRAND_PAPER, d: MARK })
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// ui/src/icons.tsx
|
|
324
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
325
|
+
var PATHS = {
|
|
326
|
+
check: "M20 6 9 17l-5-5",
|
|
327
|
+
alert: "M12 9v4M12 17h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z",
|
|
328
|
+
info: "M12 16v-4M12 8h.01M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0z",
|
|
329
|
+
refresh: "M21 12a9 9 0 0 1-15.5 6.2L3 16M3 12a9 9 0 0 1 15.5-6.2L21 8M21 3v5h-5M3 21v-5h5",
|
|
330
|
+
external: "M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
331
|
+
logout: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9",
|
|
332
|
+
layers: "m12 2 10 5-10 5L2 7l10-5zM2 17l10 5 10-5M2 12l10 5 10-5",
|
|
333
|
+
cpu: "M9 2v2M15 2v2M9 20v2M15 20v2M2 9h2M2 15h2M20 9h2M20 15h2M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM9 9h6v6H9z",
|
|
334
|
+
puzzle: "M19.44 12.06a2.5 2.5 0 1 0-3.5-3.5L15 9.5V5a1 1 0 0 0-1-1h-4.5l.94-.94a2.5 2.5 0 1 0-3.5 3.5L7.5 7.5H3a1 1 0 0 0-1 1V13l.94-.94a2.5 2.5 0 1 1 3.5 3.5L5.5 16.5H10a1 1 0 0 0 1-1V20l.94-.94a2.5 2.5 0 1 1 3.5 3.5l-.94.94H19a1 1 0 0 0 1-1v-4.5l.94.94a2.5 2.5 0 1 0 3.5-3.5z",
|
|
335
|
+
key: "m21 2-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.78 7.78 5.5 5.5 0 0 1 7.78-7.78zm0 0L15.5 7.5m0 0 3 3L22 7l-3-3m-3.5 3.5L19 4",
|
|
336
|
+
server: "M4 2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zM4 14h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2zM6 6h.01M6 18h.01",
|
|
337
|
+
chevronDown: "m6 9 6 6 6-6",
|
|
338
|
+
chevronRight: "m9 18 6-6-6-6",
|
|
339
|
+
plus: "M12 5v14M5 12h14",
|
|
340
|
+
session: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",
|
|
341
|
+
settings: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z",
|
|
342
|
+
shield: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",
|
|
343
|
+
sync: "M17 1l4 4-4 4M3 11V9a4 4 0 0 1 4-4h14M7 23l-4-4 4-4M21 13v2a4 4 0 0 1-4 4H3"
|
|
344
|
+
};
|
|
345
|
+
function Icon({ name, size = 16, label }) {
|
|
346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
347
|
+
"svg",
|
|
348
|
+
{
|
|
349
|
+
width: size,
|
|
350
|
+
height: size,
|
|
351
|
+
viewBox: "0 0 24 24",
|
|
352
|
+
fill: "none",
|
|
353
|
+
stroke: "currentColor",
|
|
354
|
+
strokeWidth: 1.75,
|
|
355
|
+
strokeLinecap: "round",
|
|
356
|
+
strokeLinejoin: "round",
|
|
357
|
+
role: label ? "img" : void 0,
|
|
358
|
+
"aria-label": label,
|
|
359
|
+
"aria-hidden": label ? void 0 : true,
|
|
360
|
+
style: { flex: "none", display: "block" },
|
|
361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: PATHS[name] })
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// ui/src/controls.tsx
|
|
367
|
+
var import_react2 = require("react");
|
|
368
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
369
|
+
var Button = (0, import_react2.forwardRef)(function Button2({ variant = "secondary", size = "md", icon, trailingIcon, block = false, busy = false, disabled, className, children, type = "button", ...props }, ref) {
|
|
370
|
+
const iconSize = size === "sm" ? 14 : 16;
|
|
371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
229
372
|
"button",
|
|
230
373
|
{
|
|
231
374
|
...props,
|
|
@@ -234,29 +377,44 @@ var Button = (0, import_react2.forwardRef)(function Button2({ variant = "seconda
|
|
|
234
377
|
className: join("twui-btn", className),
|
|
235
378
|
"data-variant": variant,
|
|
236
379
|
"data-size": size,
|
|
380
|
+
"data-block": block || void 0,
|
|
381
|
+
"data-icon-only": !children || void 0,
|
|
237
382
|
disabled: disabled || busy,
|
|
238
383
|
"aria-busy": busy || void 0,
|
|
239
384
|
children: [
|
|
240
|
-
busy
|
|
241
|
-
children
|
|
385
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, {}) : icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: icon, size: iconSize }),
|
|
386
|
+
children,
|
|
387
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: trailingIcon, size: iconSize - 2 })
|
|
242
388
|
]
|
|
243
389
|
}
|
|
244
390
|
);
|
|
245
391
|
});
|
|
246
|
-
var Input = (0, import_react2.forwardRef)(
|
|
247
|
-
|
|
248
|
-
});
|
|
392
|
+
var Input = (0, import_react2.forwardRef)(
|
|
393
|
+
function Input2({ className, size = "md", ...props }, ref) {
|
|
394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { ...props, ref, "data-size": size, className: join("twui-input", className) });
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
function Field({ label, hint, error, htmlFor, children }) {
|
|
398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "twui-field", children: [
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "twui-label", htmlFor, children: label }),
|
|
400
|
+
children,
|
|
401
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "twui-hint", "data-tone": "danger", role: "alert", children: error }) : hint && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "twui-hint", children: hint })
|
|
402
|
+
] });
|
|
403
|
+
}
|
|
249
404
|
function Badge({ tone = "neutral", dot = false, outline = false, title, children }) {
|
|
250
|
-
return /* @__PURE__ */ (0,
|
|
251
|
-
dot && /* @__PURE__ */ (0,
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "twui-badge", "data-tone": tone, "data-outline": outline || void 0, title, children: [
|
|
406
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "twui-badge-dot", "aria-hidden": "true" }),
|
|
252
407
|
children
|
|
253
408
|
] });
|
|
254
409
|
}
|
|
255
410
|
function Spinner({ label }) {
|
|
256
|
-
return /* @__PURE__ */ (0,
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "twui-spinner", role: label ? "status" : void 0, "aria-label": label, "aria-hidden": label ? void 0 : true });
|
|
412
|
+
}
|
|
413
|
+
function Skeleton({ width = "100%", height = 14 }) {
|
|
414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "twui-skeleton", "aria-hidden": "true", style: { display: "block", width, height } });
|
|
257
415
|
}
|
|
258
416
|
function Tabs({ items, value, onChange, label }) {
|
|
259
|
-
return /* @__PURE__ */ (0,
|
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "twui-tabs", role: "tablist", "aria-label": label, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
260
418
|
"button",
|
|
261
419
|
{
|
|
262
420
|
type: "button",
|
|
@@ -266,75 +424,93 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
266
424
|
onClick: () => onChange(item.id),
|
|
267
425
|
children: [
|
|
268
426
|
item.label,
|
|
269
|
-
item.count !== void 0 && /* @__PURE__ */ (0,
|
|
427
|
+
item.count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "twui-tab-count", children: item.count })
|
|
270
428
|
]
|
|
271
429
|
},
|
|
272
430
|
item.id
|
|
273
431
|
)) });
|
|
274
432
|
}
|
|
275
|
-
function Monogram({ text, size = 32 }) {
|
|
276
|
-
const letters = Array.from(text.trim()).slice(0, 2).join("").toUpperCase() || "?";
|
|
277
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "twui-monogram", "aria-hidden": "true", style: { width: size, height: size, fontSize: Math.round(size * 0.4) }, children: letters });
|
|
278
|
-
}
|
|
279
433
|
|
|
280
434
|
// ui/src/layout.tsx
|
|
281
|
-
var
|
|
282
|
-
function Panel({ header, nav, children, label }) {
|
|
283
|
-
return /* @__PURE__ */ (0,
|
|
284
|
-
header && /* @__PURE__ */ (0,
|
|
285
|
-
nav && /* @__PURE__ */ (0,
|
|
286
|
-
/* @__PURE__ */ (0,
|
|
435
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
436
|
+
function Panel({ header, nav, children, label, centered = false }) {
|
|
437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(UIRoot, { className: "twui-panel", role: "region", "aria-label": label, "data-centered": centered || void 0, children: [
|
|
438
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("header", { className: "twui-panel-header", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-panel-column", children: header }) }),
|
|
439
|
+
nav && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-panel-nav", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-panel-column", children: nav }) }),
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-panel-body", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-panel-column twui-panel-content", children }) })
|
|
287
441
|
] });
|
|
288
442
|
}
|
|
289
|
-
function
|
|
290
|
-
return /* @__PURE__ */ (0,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
443
|
+
function Card({ children, padding = 20 }) {
|
|
444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-card", style: { padding }, children });
|
|
445
|
+
}
|
|
446
|
+
function Item({ icon, title, subtitle, description, tags, actions, notice, children }) {
|
|
447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { className: "twui-item", children: [
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "twui-item-main", "data-no-icon": icon ? void 0 : true, children: [
|
|
449
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "twui-tile", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: icon, size: 18 }) }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { className: "twui-item-title", children: [
|
|
294
452
|
title,
|
|
295
|
-
subtitle && /* @__PURE__ */ (0,
|
|
453
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "twui-item-subtitle", children: subtitle })
|
|
296
454
|
] }),
|
|
297
|
-
description && /* @__PURE__ */ (0,
|
|
298
|
-
tags && /* @__PURE__ */ (0,
|
|
455
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "twui-item-desc", children: description }),
|
|
456
|
+
tags && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-item-tags", children: tags })
|
|
299
457
|
] }),
|
|
300
|
-
actions && /* @__PURE__ */ (0,
|
|
301
|
-
notice && /* @__PURE__ */ (0,
|
|
458
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-item-actions", children: actions }),
|
|
459
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-item-notice", children: notice })
|
|
302
460
|
] }),
|
|
303
461
|
children
|
|
304
462
|
] });
|
|
305
463
|
}
|
|
306
464
|
function ItemBody({ children }) {
|
|
307
|
-
return /* @__PURE__ */ (0,
|
|
465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "twui-item-body", children });
|
|
308
466
|
}
|
|
467
|
+
var toneIcon = { warning: "alert", danger: "alert", success: "check" };
|
|
309
468
|
function Notice({ tone = "neutral", children }) {
|
|
310
|
-
|
|
469
|
+
const icon = toneIcon[tone];
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "twui-notice", "data-tone": tone, children: [
|
|
471
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: icon, size: 14 }),
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children })
|
|
473
|
+
] });
|
|
474
|
+
}
|
|
475
|
+
function Banner({ tone = "neutral", title, children, action }) {
|
|
476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "twui-banner", "data-tone": tone, role: tone === "danger" ? "alert" : "status", children: [
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "twui-banner-icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: tone === "neutral" ? "info" : "alert", size: 16 }) }),
|
|
478
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "twui-banner-body", children: [
|
|
479
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "twui-banner-title", children: title }),
|
|
480
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "twui-banner-text", children })
|
|
481
|
+
] }),
|
|
482
|
+
action
|
|
483
|
+
] });
|
|
311
484
|
}
|
|
312
485
|
function DefinitionList({ items }) {
|
|
313
|
-
return /* @__PURE__ */ (0,
|
|
314
|
-
/* @__PURE__ */ (0,
|
|
315
|
-
/* @__PURE__ */ (0,
|
|
486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dl", { className: "twui-dl", children: items.map(([term, value], i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "contents" }, children: [
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: term }),
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: value })
|
|
316
489
|
] }, i)) });
|
|
317
490
|
}
|
|
318
491
|
function Confirm({ title, description, confirmLabel, cancelLabel, onConfirm, onCancel, busy = false }) {
|
|
319
|
-
return /* @__PURE__ */ (0,
|
|
320
|
-
/* @__PURE__ */ (0,
|
|
321
|
-
description && /* @__PURE__ */ (0,
|
|
322
|
-
/* @__PURE__ */ (0,
|
|
323
|
-
/* @__PURE__ */ (0,
|
|
324
|
-
/* @__PURE__ */ (0,
|
|
492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "twui-confirm", role: "group", children: [
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "twui-confirm-title", children: title }),
|
|
494
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "twui-muted", children: description }),
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "twui-row", children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { variant: "primary", busy, onClick: onConfirm, children: confirmLabel }),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { variant: "ghost", disabled: busy, onClick: onCancel, children: cancelLabel })
|
|
325
498
|
] })
|
|
326
499
|
] });
|
|
327
500
|
}
|
|
328
|
-
function EmptyState({
|
|
329
|
-
return /* @__PURE__ */ (0,
|
|
330
|
-
|
|
331
|
-
/* @__PURE__ */ (0,
|
|
332
|
-
children,
|
|
333
|
-
|
|
501
|
+
function EmptyState({ icon = "info", title, children, action }) {
|
|
502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "twui-empty", children: [
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "twui-empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: icon, size: 20 }) }),
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "twui-empty-title", children: title }),
|
|
505
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children }),
|
|
506
|
+
action
|
|
334
507
|
] });
|
|
335
508
|
}
|
|
336
509
|
function Toast({ tone = "neutral", children }) {
|
|
337
|
-
return /* @__PURE__ */ (0,
|
|
510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "twui-toast", "data-tone": tone, role: tone === "danger" ? "alert" : "status", children: [
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: tone === "danger" ? "alert" : "check", size: 16 }),
|
|
512
|
+
children
|
|
513
|
+
] });
|
|
338
514
|
}
|
|
339
515
|
|
|
340
516
|
// src/panel.ts
|
|
@@ -367,15 +543,16 @@ var api = {
|
|
|
367
543
|
authorize: (code) => call("authorize", { code }),
|
|
368
544
|
sync: () => call("sync"),
|
|
369
545
|
logout: () => call("logout"),
|
|
546
|
+
setServer: (server) => call("server", { server }),
|
|
370
547
|
use: (sessionId, id) => call("use", { sessionId, id }),
|
|
371
548
|
install: (id, version) => call("install", { id, version })
|
|
372
549
|
};
|
|
373
550
|
|
|
374
551
|
// src/web/TeamworkPanel.tsx
|
|
375
|
-
var
|
|
552
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
376
553
|
var REFRESH_MS = 5e3;
|
|
377
554
|
var pluginText = {
|
|
378
|
-
ready: ["
|
|
555
|
+
ready: ["已启用", "success"],
|
|
379
556
|
missing: ["未安装", "warning"],
|
|
380
557
|
disabled: ["已安装未启用", "warning"],
|
|
381
558
|
"version-mismatch": ["本地版本不符", "warning"],
|
|
@@ -388,20 +565,21 @@ var toolText = {
|
|
|
388
565
|
available: ["可用", "success"],
|
|
389
566
|
conditional: ["执行时检查", "neutral"],
|
|
390
567
|
missing: ["缺失", "warning"],
|
|
391
|
-
unknown: ["
|
|
568
|
+
unknown: ["待检查", "neutral"]
|
|
392
569
|
};
|
|
570
|
+
var host = (server) => server.replace(/^https?:\/\//, "");
|
|
393
571
|
var missingTools = (preset) => preset.tools.filter((t) => t.required && (t.state === "missing" || t.state === "unknown"));
|
|
394
572
|
var pluginsNotReady = (preset) => preset.plugins.filter((p) => p.state !== "ready");
|
|
395
|
-
function
|
|
396
|
-
if (!iso) return "
|
|
573
|
+
function synced(iso) {
|
|
574
|
+
if (!iso) return "尚未同步";
|
|
397
575
|
const seconds = Math.max(0, Math.round((Date.now() - Date.parse(iso)) / 1e3));
|
|
398
576
|
if (seconds < 60) return "刚刚同步";
|
|
399
577
|
if (seconds < 3600) return `${Math.round(seconds / 60)} 分钟前同步`;
|
|
400
|
-
return `${new Date(iso).
|
|
578
|
+
return `${new Date(iso).toLocaleTimeString()} 同步`;
|
|
401
579
|
}
|
|
402
|
-
function TeamworkPanel({ host }) {
|
|
403
|
-
const currentSession = (0, import_react3.useRef)(currentSessionTracker(
|
|
404
|
-
const sessionId = (0, import_react3.useSyncExternalStore)(
|
|
580
|
+
function TeamworkPanel({ host: dsh }) {
|
|
581
|
+
const currentSession = (0, import_react3.useRef)(currentSessionTracker(dsh.sessions.list)).current;
|
|
582
|
+
const sessionId = (0, import_react3.useSyncExternalStore)(dsh.sessions.list.subscribe, currentSession);
|
|
405
583
|
const [state, setState] = (0, import_react3.useState)();
|
|
406
584
|
const [loadError, setLoadError] = (0, import_react3.useState)();
|
|
407
585
|
const [tab, setTab] = (0, import_react3.useState)("presets");
|
|
@@ -426,30 +604,26 @@ function TeamworkPanel({ host }) {
|
|
|
426
604
|
toastTimer.current = setTimeout(() => setToast(void 0), tone === "danger" ? 6e3 : 3e3);
|
|
427
605
|
}, []);
|
|
428
606
|
(0, import_react3.useEffect)(() => () => clearTimeout(toastTimer.current), []);
|
|
429
|
-
const run = (0, import_react3.useCallback)(
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
);
|
|
443
|
-
const toastNode = toast && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Toast, { tone: toast.tone, children: toast.message });
|
|
607
|
+
const run = (0, import_react3.useCallback)(async (action, done) => {
|
|
608
|
+
try {
|
|
609
|
+
const result = await action();
|
|
610
|
+
const message = typeof done === "function" ? done(result) : done;
|
|
611
|
+
if (message) notify(message);
|
|
612
|
+
return true;
|
|
613
|
+
} catch (error) {
|
|
614
|
+
notify(error.message, "danger");
|
|
615
|
+
return false;
|
|
616
|
+
} finally {
|
|
617
|
+
await refresh();
|
|
618
|
+
}
|
|
619
|
+
}, [notify, refresh]);
|
|
620
|
+
const toastNode = toast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Toast, { tone: toast.tone, children: toast.message });
|
|
444
621
|
if (!state) {
|
|
445
|
-
return /* @__PURE__ */ (0,
|
|
446
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, {}),
|
|
447
|
-
" 正在读取团队状态…"
|
|
448
|
-
] }) });
|
|
622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Panel, { label: "Teamwork", header: loadError ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderSkeleton, {}), children: loadError ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Banner, { tone: "danger", title: "无法读取团队状态", action: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", icon: "refresh", onClick: () => void refresh(), children: "重试" }), children: loadError }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ListSkeleton, {}) });
|
|
449
623
|
}
|
|
450
624
|
if (!state.authenticated) {
|
|
451
|
-
return /* @__PURE__ */ (0,
|
|
452
|
-
/* @__PURE__ */ (0,
|
|
625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Panel, { label: "Teamwork", centered: true, children: [
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SignIn, { state, run }),
|
|
453
627
|
toastNode
|
|
454
628
|
] });
|
|
455
629
|
}
|
|
@@ -458,12 +632,13 @@ function TeamworkPanel({ host }) {
|
|
|
458
632
|
{ id: "models", label: "团队模型", count: state.models.length },
|
|
459
633
|
{ id: "plugins", label: "团队插件", count: state.plugins.length }
|
|
460
634
|
];
|
|
461
|
-
return /* @__PURE__ */ (0,
|
|
462
|
-
/* @__PURE__ */ (0,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
tab === "
|
|
466
|
-
tab === "
|
|
635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Panel, { label: "Teamwork", header: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Header, { state, run }), nav: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Tabs, { label: "团队配置", items: tabs, value: tab, onChange: setTab }), children: [
|
|
636
|
+
loadError && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Banner, { tone: "danger", title: "状态没有刷新", action: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", icon: "refresh", onClick: () => void refresh(), children: "重试" }), children: loadError }),
|
|
637
|
+
state.sync.lastError && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Banner, { tone: "warning", title: "同步失败,正在使用上次同步的配置", action: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", icon: "refresh", onClick: () => run(() => api.sync(), "团队配置已同步"), children: "重试" }), children: state.sync.lastError }),
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SessionStrip, { state }),
|
|
639
|
+
tab === "presets" && (state.presets.length ? state.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PresetItem, { preset: p, state, dsh, run, onInstall: () => setTab("plugins") }, p.id)) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EmptyState, { icon: "layers", title: "团队还没有发布预设", children: "管理员在网页控制台发布预设后,下次同步就会出现在这里。" }) })),
|
|
640
|
+
tab === "models" && (state.models.length ? state.models.map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModelItem, { model: m, state, run }, m.id)) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EmptyState, { icon: "cpu", title: "团队还没有发布模型", children: "团队模型由服务器代为调用,provider 密钥不会下发到这台电脑。" }) })),
|
|
641
|
+
tab === "plugins" && (state.plugins.length ? state.plugins.map((p) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PluginItem, { plugin: p, run }, p.id)) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EmptyState, { icon: "puzzle", title: "团队没有固定插件版本", children: "固定的插件版本会出现在这里,由你确认后安装。" }) })),
|
|
467
642
|
toastNode
|
|
468
643
|
] });
|
|
469
644
|
}
|
|
@@ -478,137 +653,278 @@ function SignIn({ state, run }) {
|
|
|
478
653
|
});
|
|
479
654
|
const authorize = async () => {
|
|
480
655
|
setBusy(true);
|
|
481
|
-
await run(() => api.authorize(code), "已授权,团队配置已同步");
|
|
656
|
+
await run(() => api.authorize(code.trim()), "已授权,团队配置已同步");
|
|
482
657
|
setBusy(false);
|
|
483
658
|
};
|
|
484
|
-
|
|
485
|
-
|
|
659
|
+
const step = opened ? 2 : 1;
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { width: "100%", maxWidth: 440, margin: "0 auto", display: "grid", gap: 24, padding: "24px 0" }, children: [
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", justifyItems: "center", gap: 12, textAlign: "center" }, children: [
|
|
662
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BrandMark, { size: 56, title: "DSH Teamwork" }),
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gap: 6 }, children: [
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { style: { fontSize: 20, fontWeight: 650, letterSpacing: "-0.01em" }, children: state.team ? `重新登录 ${state.team.name}` : "登录 DSH Teamwork" }),
|
|
665
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "twui-muted", children: "团队的模型、预设和插件版本,一处发布,每位成员的 DSH 自动保持一致。" })
|
|
666
|
+
] })
|
|
667
|
+
] }),
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Card, { padding: 20, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gap: 16 }, children: [
|
|
669
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ol", { style: { listStyle: "none", margin: 0, padding: 0, display: "grid", gap: 10 }, children: [
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Step, { n: 1, state: step > 1 ? "done" : "active", children: "在浏览器中登录并确认授权" }),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Step, { n: 2, state: step === 2 ? "active" : "todo", children: "复制网页上显示的授权码(两分钟内有效)" }),
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Step, { n: 3, state: step === 2 && code.trim() ? "active" : "todo", children: "粘贴到下方,完成授权" })
|
|
673
|
+
] }),
|
|
674
|
+
!opened ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { variant: "primary", size: "lg", block: true, trailingIcon: "external", onClick: open, children: "在浏览器中登录" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { style: { display: "grid", gap: 12 }, onSubmit: (e) => {
|
|
675
|
+
e.preventDefault();
|
|
676
|
+
if (code.trim()) void authorize();
|
|
677
|
+
}, children: [
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { label: "授权码", htmlFor: "teamwork-code", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
679
|
+
Input,
|
|
680
|
+
{
|
|
681
|
+
id: "teamwork-code",
|
|
682
|
+
size: "lg",
|
|
683
|
+
className: "twui-mono",
|
|
684
|
+
value: code,
|
|
685
|
+
onChange: (e) => setCode(e.target.value),
|
|
686
|
+
placeholder: "例如 7Q4K-M2XP",
|
|
687
|
+
autoComplete: "off",
|
|
688
|
+
spellCheck: false,
|
|
689
|
+
autoFocus: true,
|
|
690
|
+
style: { letterSpacing: "0.08em" }
|
|
691
|
+
}
|
|
692
|
+
) }),
|
|
693
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { type: "submit", variant: "primary", size: "lg", block: true, busy, disabled: !code.trim(), children: "完成授权" }),
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "twui-subtle", style: { textAlign: "center" }, children: [
|
|
695
|
+
"没看到登录页?",
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "twui-link", onClick: open, children: "重新打开" })
|
|
697
|
+
] })
|
|
698
|
+
] })
|
|
699
|
+
] }) }),
|
|
700
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "grid", gap: 12 }, children: [
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Point, { icon: "shield", title: "密钥留在服务器", children: "团队模型由服务器代为调用,provider 密钥不会下发到这台电脑。" }),
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Point, { icon: "layers", title: "与本地配置并存", children: "团队配置作为独立条目加入,不覆盖你自己的模型和预设。" }),
|
|
703
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Point, { icon: "sync", title: "自动保持最新", children: "每分钟同步一次;被移出团队后,下一次请求即失效。" })
|
|
704
|
+
] }),
|
|
705
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ServerSetting, { state, run })
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
function Step({ n, state, children }) {
|
|
709
|
+
const done = state === "done";
|
|
710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { style: { display: "flex", alignItems: "center", gap: 10, color: state === "todo" ? "var(--twui-fg-subtle)" : "var(--twui-fg)" }, children: [
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", style: {
|
|
712
|
+
width: 22,
|
|
713
|
+
height: 22,
|
|
714
|
+
borderRadius: "50%",
|
|
715
|
+
display: "grid",
|
|
716
|
+
placeItems: "center",
|
|
717
|
+
flex: "none",
|
|
718
|
+
fontSize: 12,
|
|
719
|
+
fontWeight: 600,
|
|
720
|
+
border: `1px solid ${state === "todo" ? "var(--twui-border-strong)" : "transparent"}`,
|
|
721
|
+
background: done ? "var(--twui-success)" : state === "active" ? "var(--twui-primary)" : "transparent",
|
|
722
|
+
color: done || state === "active" ? "var(--twui-primary-fg)" : "inherit"
|
|
723
|
+
}, children: done ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "check", size: 13 }) : n }),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children })
|
|
725
|
+
] });
|
|
726
|
+
}
|
|
727
|
+
function Point({ icon, title, children }) {
|
|
728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { style: { display: "flex", gap: 12, alignItems: "flex-start" }, children: [
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-tile", style: { width: 32, height: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: icon, size: 16 }) }),
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gap: 2 }, children: [
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { style: { fontWeight: 600 }, children: title }),
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-muted", children })
|
|
733
|
+
] })
|
|
734
|
+
] });
|
|
735
|
+
}
|
|
736
|
+
function ServerSetting({ state, run }) {
|
|
737
|
+
const [editing, setEditing] = (0, import_react3.useState)(false);
|
|
738
|
+
const [value, setValue] = (0, import_react3.useState)(state.server);
|
|
739
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
740
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
741
|
+
const isDefault = state.server === state.defaultServer;
|
|
742
|
+
const save = async (server) => {
|
|
743
|
+
setBusy(true);
|
|
744
|
+
setError(void 0);
|
|
745
|
+
try {
|
|
746
|
+
await api.setServer(server);
|
|
747
|
+
setEditing(false);
|
|
748
|
+
await run(async () => void 0, server === null ? "已恢复为默认服务器" : "服务器已更改");
|
|
749
|
+
} catch (e) {
|
|
750
|
+
setError(e.message);
|
|
751
|
+
} finally {
|
|
752
|
+
setBusy(false);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
if (!editing) {
|
|
756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-card", style: { display: "flex", alignItems: "center", gap: 12, padding: "12px 16px", boxShadow: "none" }, children: [
|
|
757
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { color: "var(--twui-fg-subtle)" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "server", size: 16 }) }),
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "grid" }, children: [
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-subtle", children: "服务器" }),
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "twui-row", style: { gap: 6 }, children: [
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-mono", style: { overflowWrap: "anywhere" }, children: host(state.server) }),
|
|
762
|
+
isDefault && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "accent", children: "官方服务" })
|
|
763
|
+
] })
|
|
764
|
+
] }),
|
|
765
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", onClick: () => {
|
|
766
|
+
setValue(state.server);
|
|
767
|
+
setEditing(true);
|
|
768
|
+
}, children: "更改" })
|
|
769
|
+
] });
|
|
770
|
+
}
|
|
771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
772
|
+
"form",
|
|
486
773
|
{
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
774
|
+
className: "twui-card",
|
|
775
|
+
style: { display: "grid", gap: 12, padding: 16, boxShadow: "none" },
|
|
776
|
+
onSubmit: (e) => {
|
|
777
|
+
e.preventDefault();
|
|
778
|
+
void save(value);
|
|
779
|
+
},
|
|
780
|
+
children: [
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
782
|
+
Field,
|
|
492
783
|
{
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
784
|
+
label: "服务器地址",
|
|
785
|
+
htmlFor: "teamwork-server",
|
|
786
|
+
error,
|
|
787
|
+
hint: "自建团队或本地开发时填写你的 DSH Teamwork 地址,例如 http://localhost:3800。更改后需要重新登录。",
|
|
788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
789
|
+
Input,
|
|
790
|
+
{
|
|
791
|
+
id: "teamwork-server",
|
|
792
|
+
className: "twui-mono",
|
|
793
|
+
value,
|
|
794
|
+
onChange: (e) => setValue(e.target.value),
|
|
795
|
+
"aria-invalid": error ? true : void 0,
|
|
796
|
+
autoComplete: "off",
|
|
797
|
+
spellCheck: false,
|
|
798
|
+
autoFocus: true
|
|
799
|
+
}
|
|
800
|
+
)
|
|
506
801
|
}
|
|
507
802
|
),
|
|
508
|
-
/* @__PURE__ */ (0,
|
|
509
|
-
"
|
|
510
|
-
/* @__PURE__ */ (0,
|
|
803
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-row", children: [
|
|
804
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { type: "submit", variant: "primary", size: "sm", busy, disabled: !value.trim(), children: "保存" }),
|
|
805
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => {
|
|
806
|
+
setEditing(false);
|
|
807
|
+
setError(void 0);
|
|
808
|
+
}, children: "取消" }),
|
|
809
|
+
!isDefault && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "twui-link", style: { marginLeft: "auto", fontSize: 12 }, disabled: busy, onClick: () => void save(null), children: [
|
|
810
|
+
"恢复为 ",
|
|
811
|
+
host(state.defaultServer)
|
|
812
|
+
] })
|
|
511
813
|
] })
|
|
512
|
-
]
|
|
513
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: "登录后,团队发布的预设、模型和插件版本会同步到这台 DSH,与你本地的配置并存,不会覆盖。团队模型经服务器调用,provider 密钥不会下发到本机。" })
|
|
814
|
+
]
|
|
514
815
|
}
|
|
515
816
|
);
|
|
516
817
|
}
|
|
517
818
|
function Header({ state, run }) {
|
|
518
|
-
const team = state
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
/* @__PURE__ */ (0,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
819
|
+
const { team, sync } = state;
|
|
820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 12, minWidth: 0, flex: "1 1 260px" }, children: [
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BrandMark, { size: 36, title: "DSH Teamwork" }),
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { minWidth: 0, display: "grid", gap: 2 }, children: [
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-row", style: { gap: 8 }, children: [
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { style: { fontSize: 15, fontWeight: 650, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: team?.name ?? "尚未同步团队" }),
|
|
826
|
+
team && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { outline: true, children: team.role === "admin" ? "管理员" : "成员" })
|
|
827
|
+
] }),
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "twui-subtle twui-row", style: { gap: 4 }, title: "退出后可以更改服务器", children: [
|
|
829
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "server", size: 12 }),
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-mono", children: host(state.server) })
|
|
831
|
+
] })
|
|
527
832
|
] })
|
|
528
833
|
] }),
|
|
529
|
-
/* @__PURE__ */ (0,
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-row", style: { marginLeft: "auto" }, children: [
|
|
835
|
+
state.relay === "connected" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "success", dot: true, title: "手机可以通过 DSH Teamwork App 连到这台电脑", children: "手机可连接" }),
|
|
836
|
+
state.relay === "refused" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "warning", dot: true, title: "中转服务拒绝了这台电脑的连接:重新登录后会再试", children: "手机连接被拒绝" }),
|
|
837
|
+
sync.running ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { children: "正在同步…" }) : sync.lastError ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "warning", dot: true, children: "同步失败" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "success", dot: true, children: synced(sync.lastSuccess) }),
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
839
|
+
Button,
|
|
840
|
+
{
|
|
841
|
+
size: "sm",
|
|
842
|
+
icon: "refresh",
|
|
843
|
+
"aria-label": "立即同步",
|
|
844
|
+
title: "立即同步",
|
|
845
|
+
busy: sync.running,
|
|
846
|
+
onClick: () => run(() => api.sync(), "团队配置已同步,本地配置保持不变")
|
|
847
|
+
}
|
|
848
|
+
),
|
|
849
|
+
team?.role === "admin" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", trailingIcon: "external", onClick: () => window.open(state.consoleUrl, "_blank", "noopener"), children: "管理团队" }),
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", variant: "ghost", icon: "logout", onClick: () => run(() => api.logout(), "已退出,团队配置已从这台 DSH 移除"), children: "退出" })
|
|
537
851
|
] })
|
|
538
852
|
] });
|
|
539
853
|
}
|
|
540
|
-
function
|
|
854
|
+
function SessionStrip({ state }) {
|
|
541
855
|
const s = state.session;
|
|
542
|
-
if (!s) return /* @__PURE__ */ (0,
|
|
856
|
+
if (!s) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Banner, { title: "还没有打开会话", children: "打开一个会话后,可以把团队的预设或模型用到这个会话里。" });
|
|
543
857
|
const teamModel = (id) => state.models.find((m) => m.id === id)?.name ?? state.presets.find((p) => p.id === id)?.model ?? id;
|
|
544
858
|
const model = s.model ? s.model.team ? teamModel(s.model.model) : `${s.model.provider}/${s.model.model}` : "未选择";
|
|
545
|
-
return /* @__PURE__ */ (0,
|
|
546
|
-
"
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
" · 预设 ",
|
|
550
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("strong", { children: [
|
|
551
|
-
s.preset.name,
|
|
552
|
-
" v",
|
|
553
|
-
s.preset.version
|
|
554
|
-
] })
|
|
859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-card", style: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "8px 20px", padding: "12px 16px", boxShadow: "none", background: "var(--twui-fill)" }, children: [
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "twui-row", style: { gap: 6, fontWeight: 600 }, children: [
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "session", size: 15 }),
|
|
862
|
+
"当前会话"
|
|
555
863
|
] }),
|
|
556
|
-
|
|
557
|
-
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Meta, { label: "模型", value: model }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Meta, { label: "预设", value: s.preset ? `${s.preset.name} · v${s.preset.version}` : "无团队预设" }),
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: s.started ? "neutral" : "accent", dot: true, children: s.started ? "已开始对话" : "尚未开始对话" }) })
|
|
867
|
+
] });
|
|
868
|
+
}
|
|
869
|
+
function Meta({ label, value }) {
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "twui-row", style: { gap: 6, minWidth: 0 }, children: [
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-subtle", children: label }),
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, overflowWrap: "anywhere" }, children: value })
|
|
558
873
|
] });
|
|
559
874
|
}
|
|
560
|
-
function PresetItem({ preset, state,
|
|
875
|
+
function PresetItem({ preset, state, dsh, run, onInstall }) {
|
|
561
876
|
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
562
877
|
const missing = missingTools(preset);
|
|
563
878
|
const plugins = pluginsNotReady(preset);
|
|
564
879
|
const active = state.session?.preset?.id === preset.id;
|
|
565
|
-
const blocked = !preset.modelAvailable ? "预设引用的团队模型已不可用,请联系管理员。" : plugins.length ? `依赖插件 ${plugins.map((p) => p.name).join("、")}
|
|
880
|
+
const blocked = !preset.modelAvailable ? "预设引用的团队模型已不可用,请联系管理员。" : plugins.length ? `依赖插件 ${plugins.map((p) => p.name).join("、")} 尚未就绪。` : missing.length && state.session ? `缺少必需工具 ${missing.map((t) => t.name).join("、")},请在 DSH 插件管理器中安装或启用。` : void 0;
|
|
566
881
|
const useBlocked = blocked ?? (!state.session ? "" : state.session.started && !active ? "当前会话已开始对话,预设只能用在新会话里。" : void 0);
|
|
567
882
|
const ready = !blocked;
|
|
568
|
-
return /* @__PURE__ */ (0,
|
|
883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
569
884
|
Item,
|
|
570
885
|
{
|
|
886
|
+
icon: "layers",
|
|
571
887
|
title: preset.name,
|
|
572
888
|
subtitle: `${preset.id} · v${preset.version}`,
|
|
573
889
|
description: preset.description || void 0,
|
|
574
|
-
tags: /* @__PURE__ */ (0,
|
|
575
|
-
/* @__PURE__ */ (0,
|
|
576
|
-
|
|
890
|
+
tags: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Badge, { children: [
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "cpu", size: 12 }),
|
|
893
|
+
preset.model
|
|
894
|
+
] }),
|
|
895
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "accent", dot: true, children: "本会话正在使用" }) : ready ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "success", dot: true, children: "可以使用" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "warning", dot: true, children: "未就绪" })
|
|
577
896
|
] }),
|
|
578
|
-
actions: /* @__PURE__ */ (0,
|
|
579
|
-
/* @__PURE__ */ (0,
|
|
580
|
-
/* @__PURE__ */ (0,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}, children: "
|
|
584
|
-
!active && /* @__PURE__ */ (0,
|
|
897
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { variant: "ghost", size: "sm", trailingIcon: open ? "chevronDown" : "chevronRight", "aria-expanded": open, onClick: () => setOpen(!open), children: "详情" }),
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { size: "sm", icon: "plus", disabled: !ready || !state.team, onClick: () => {
|
|
900
|
+
dsh.uiWorkspace.startSession(void 0, { agentPreset: `team:${state.team.id}:${preset.id}` });
|
|
901
|
+
dsh.layout.selectPanel(null);
|
|
902
|
+
}, children: "新建会话" }),
|
|
903
|
+
!active && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { variant: "primary", size: "sm", disabled: useBlocked !== void 0, onClick: () => run(() => api.use(state.session.id, preset.id), (r) => r.message), children: "用于当前会话" })
|
|
585
904
|
] }),
|
|
586
|
-
notice: useBlocked && !active ? /* @__PURE__ */ (0,
|
|
587
|
-
useBlocked,
|
|
588
|
-
plugins.length > 0 && /* @__PURE__ */ (0,
|
|
589
|
-
" ",
|
|
590
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { size: "sm", variant: "ghost", onClick: onInstall, children: "去安装" })
|
|
591
|
-
] })
|
|
905
|
+
notice: useBlocked && !active ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-row", style: { gap: 6 }, children: [
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Notice, { tone: blocked ? "warning" : "neutral", children: useBlocked }),
|
|
907
|
+
plugins.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "twui-link", style: { fontSize: 12 }, onClick: onInstall, children: "前往安装" })
|
|
592
908
|
] }) : void 0,
|
|
593
|
-
children: open && /* @__PURE__ */ (0,
|
|
594
|
-
/* @__PURE__ */ (0,
|
|
595
|
-
["模型",
|
|
596
|
-
["工具", preset.tools.length ? /* @__PURE__ */ (0,
|
|
597
|
-
/* @__PURE__ */ (0,
|
|
598
|
-
" ",
|
|
599
|
-
|
|
909
|
+
children: open && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ItemBody, { children: [
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DefinitionList, { items: [
|
|
911
|
+
["模型", preset.model],
|
|
912
|
+
["工具", preset.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-row", style: { gap: 6 }, children: preset.tools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Badge, { tone: toolText[t.state][1], title: t.required ? "必需" : "可选", children: [
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-mono", children: t.name }),
|
|
914
|
+
t.required ? "" : " · 可选",
|
|
915
|
+
" · ",
|
|
600
916
|
toolText[t.state][0]
|
|
601
917
|
] }, t.name)) }) : "无要求"],
|
|
602
|
-
["依赖插件", preset.plugins.length ? /* @__PURE__ */ (0,
|
|
918
|
+
["依赖插件", preset.plugins.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-row", style: { gap: 6 }, children: preset.plugins.map((p) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Badge, { tone: pluginText[p.state][1], children: [
|
|
603
919
|
p.name,
|
|
604
920
|
" @",
|
|
605
921
|
p.version,
|
|
606
922
|
" · ",
|
|
607
923
|
pluginText[p.state][0]
|
|
608
924
|
] }, p.id)) }) : "无"],
|
|
609
|
-
["版本", `v${preset.version}
|
|
925
|
+
["版本", `v${preset.version},管理员发布新版本后下次同步生效`]
|
|
610
926
|
] }),
|
|
611
|
-
/* @__PURE__ */ (0,
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "twui-subtle", children: "工具按当前会话检查;切换会话后和每次请求前都会重新检查。" })
|
|
612
928
|
] })
|
|
613
929
|
}
|
|
614
930
|
);
|
|
@@ -616,13 +932,15 @@ function PresetItem({ preset, state, host, run, onInstall }) {
|
|
|
616
932
|
function ModelItem({ model, state, run }) {
|
|
617
933
|
const s = state.session;
|
|
618
934
|
const active = !!s?.model?.team && s.model.model === model.id;
|
|
619
|
-
return /* @__PURE__ */ (0,
|
|
935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
620
936
|
Item,
|
|
621
937
|
{
|
|
938
|
+
icon: "cpu",
|
|
622
939
|
title: model.name,
|
|
623
|
-
subtitle: model.id
|
|
624
|
-
description:
|
|
625
|
-
|
|
940
|
+
subtitle: `${model.id} · v${model.version}`,
|
|
941
|
+
description: "由团队服务器代为调用,provider 密钥留在服务器上。只改当前会话,不改本地默认模型。",
|
|
942
|
+
tags: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-mono", children: model.upstream }) }),
|
|
943
|
+
actions: active ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "accent", dot: true, children: "本会话正在使用" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { variant: "primary", size: "sm", disabled: !s, onClick: () => run(() => api.use(s.id, model.id), (r) => r.message), children: "用于当前会话" })
|
|
626
944
|
}
|
|
627
945
|
);
|
|
628
946
|
}
|
|
@@ -631,25 +949,26 @@ function PluginItem({ plugin, run }) {
|
|
|
631
949
|
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
632
950
|
const [label, tone] = pluginText[plugin.state];
|
|
633
951
|
const spec = `${plugin.package ?? plugin.name}@${plugin.version}`;
|
|
634
|
-
return /* @__PURE__ */ (0,
|
|
952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
635
953
|
Item,
|
|
636
954
|
{
|
|
637
|
-
|
|
638
|
-
|
|
955
|
+
icon: "puzzle",
|
|
956
|
+
title: plugin.name,
|
|
957
|
+
subtitle: spec,
|
|
639
958
|
description: plugin.description || void 0,
|
|
640
|
-
tags: /* @__PURE__ */ (0,
|
|
641
|
-
/* @__PURE__ */ (0,
|
|
642
|
-
plugin.localVersion && plugin.localVersion !== plugin.version && /* @__PURE__ */ (0,
|
|
959
|
+
tags: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone, dot: true, children: label }),
|
|
961
|
+
plugin.localVersion && plugin.localVersion !== plugin.version && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Badge, { children: [
|
|
643
962
|
"本地 ",
|
|
644
963
|
plugin.localVersion
|
|
645
964
|
] })
|
|
646
965
|
] }),
|
|
647
|
-
actions: plugin.state === "missing"
|
|
648
|
-
children: confirming && /* @__PURE__ */ (0,
|
|
966
|
+
actions: plugin.state === "missing" ? !confirming && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { variant: "primary", size: "sm", onClick: () => setConfirming(true), children: "安装" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "twui-subtle", children: "在 DSH 插件管理器中管理" }),
|
|
967
|
+
children: confirming && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
649
968
|
Confirm,
|
|
650
969
|
{
|
|
651
970
|
title: `安装并启用 ${spec}?`,
|
|
652
|
-
description: "
|
|
971
|
+
description: "这会在你的电脑上运行该插件的代码。版本由团队固定;已经装过的同名插件不会被覆盖。",
|
|
653
972
|
confirmLabel: "安装并启用",
|
|
654
973
|
cancelLabel: "取消",
|
|
655
974
|
busy,
|
|
@@ -665,12 +984,31 @@ function PluginItem({ plugin, run }) {
|
|
|
665
984
|
}
|
|
666
985
|
);
|
|
667
986
|
}
|
|
987
|
+
function HeaderSkeleton() {
|
|
988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-row", style: { gap: 12 }, children: [
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { width: 36, height: 36 }),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gap: 6 }, children: [
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { width: 140, height: 14 }),
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { width: 100, height: 10 })
|
|
993
|
+
] })
|
|
994
|
+
] });
|
|
995
|
+
}
|
|
996
|
+
function ListSkeleton() {
|
|
997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "twui-item", style: { padding: 16, display: "flex", gap: 14 }, children: [
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { width: 36, height: 36 }),
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { flex: 1, display: "grid", gap: 8 }, children: [
|
|
1000
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { width: "40%" }),
|
|
1001
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { width: "75%", height: 12 }),
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { width: 120, height: 20 })
|
|
1003
|
+
] })
|
|
1004
|
+
] }, i)) });
|
|
1005
|
+
}
|
|
668
1006
|
|
|
669
1007
|
// src/web/index.tsx
|
|
670
|
-
var
|
|
1008
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
671
1009
|
var inject = ["slots", "sessions", "layout", "uiWorkspace"];
|
|
672
1010
|
function apply(ctx) {
|
|
673
|
-
const
|
|
1011
|
+
const host2 = {
|
|
674
1012
|
get sessions() {
|
|
675
1013
|
return ctx.sessions;
|
|
676
1014
|
},
|
|
@@ -683,12 +1021,12 @@ function apply(ctx) {
|
|
|
683
1021
|
};
|
|
684
1022
|
ctx.slots.inject(
|
|
685
1023
|
"sidebar.panellist",
|
|
686
|
-
() => ctx.slots.register({ name: "sidebar.panellist", id: PANEL_ID, order: 60, label: "Teamwork" }, (owner) => /* @__PURE__ */ (0,
|
|
1024
|
+
() => ctx.slots.register({ name: "sidebar.panellist", id: PANEL_ID, order: 60, label: "Teamwork" }, (owner) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TeamIcon, { size: owner?.size || 16, active: !!owner?.active }))
|
|
687
1025
|
);
|
|
688
|
-
ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: PANEL_ID }, () => /* @__PURE__ */ (0,
|
|
1026
|
+
ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: PANEL_ID }, () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TeamworkPanel, { host: host2 })));
|
|
689
1027
|
}
|
|
690
1028
|
function TeamIcon({ size, active }) {
|
|
691
|
-
return /* @__PURE__ */ (0,
|
|
1029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
692
1030
|
"svg",
|
|
693
1031
|
{
|
|
694
1032
|
width: size,
|
|
@@ -702,9 +1040,9 @@ function TeamIcon({ size, active }) {
|
|
|
702
1040
|
"aria-hidden": "true",
|
|
703
1041
|
style: { color: active ? "var(--dsw-alias-state-business-primary)" : "inherit" },
|
|
704
1042
|
children: [
|
|
705
|
-
/* @__PURE__ */ (0,
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
707
|
-
/* @__PURE__ */ (0,
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "9", cy: "7", r: "4" }),
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75" })
|
|
708
1046
|
]
|
|
709
1047
|
}
|
|
710
1048
|
);
|