dsh-codinput 0.1.0 → 0.2.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/CHANGELOG.md +53 -0
- package/README.en.md +33 -28
- package/README.md +35 -32
- package/TESTING.md +10 -2
- package/assets/icon-white.svg +11 -0
- package/assets/icon.png +0 -0
- package/assets/icon.svg +11 -1
- package/assets/preview-ball-detail.png +0 -0
- package/assets/preview-float.png +0 -0
- package/assets/preview-normal.png +0 -0
- package/assets/preview-side.png +0 -0
- package/assets/preview-split.png +0 -0
- package/lib/client.js +109 -78
- package/package.json +1 -1
- package/src/client/attachments.ts +34 -0
- package/src/client/command.ts +52 -12
- package/src/client/components/AttachmentRail.tsx +20 -1
- package/src/client/components/CodinputBar.tsx +13 -35
- package/src/client/components/CodinputSurface.tsx +42 -8
- package/src/client/components/ImageLightbox.tsx +61 -0
- package/src/client/components/SlashMenu.tsx +1 -1
- package/src/client/components/StatsRow.tsx +216 -49
- package/src/client/components/Toolbar.tsx +13 -156
- package/src/client/host-types.ts +6 -1
- package/src/client/i18n.ts +16 -2
- package/src/client/icons.tsx +33 -27
- package/src/client/sidebar.tsx +66 -7
- package/src/client/sideinput.ts +33 -7
- package/src/client/stats.ts +161 -57
- package/src/client/styles.ts +79 -48
package/src/client/styles.ts
CHANGED
|
@@ -21,8 +21,13 @@ const CSS = `
|
|
|
21
21
|
会话态(无包裹约束)不再被拉满,左右居中;拖边调节后由内联 max-width 接管。 */
|
|
22
22
|
.dci-card { box-sizing: border-box; width: 100%; max-width: var(--dsh-composer-card-max-width, 760px); margin-inline: auto;
|
|
23
23
|
background: var(--dsw-specific-input-major, color-mix(in srgb, currentColor 4%, transparent));
|
|
24
|
-
box-shadow: var(--dsw-elevation-soft, none); font-size:
|
|
25
|
-
|
|
24
|
+
box-shadow: var(--dsw-elevation-soft, none); font-size: var(--dsh-content-font-size, 14px);
|
|
25
|
+
line-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
26
|
+
border: 0; border-radius: var(--dsw-radius-panel, 22px); flex-direction: column; gap: 0; padding-top: 4px; display: flex; position: relative; min-width: 0; }
|
|
27
|
+
/* 主模式 surface 复刻官方 composer root:侧向 clearance 内缩 + 底部 4px,
|
|
28
|
+
卡片与数据行由数据行自身 padding-top 定距(官方 root 无 gap,dock 上边距 4px)。
|
|
29
|
+
side/float 形态自带铺满布局,不参与。 */
|
|
30
|
+
.dci-surface:not([data-side]):not([data-float]) { padding: 0 var(--dsh-composer-side-clearance, 0px) 4px; align-items: center; gap: 0; }
|
|
26
31
|
/* 卡片边缘调节把手:左右调宽、上下调高(对称灵敏度),悬停显形。 */
|
|
27
32
|
.dci-rip { position: absolute; z-index: 60; touch-action: none; }
|
|
28
33
|
.dci-rip[data-axis="y"] { left: 12px; right: 12px; height: 9px; cursor: ns-resize; }
|
|
@@ -105,9 +110,10 @@ const CSS = `
|
|
|
105
110
|
/* ===== 菜单(官方 primitives Menu:r20 卡片 / item r10 / side-top 弹出)===== */
|
|
106
111
|
.dci-menu { position: fixed; z-index: 1100; box-sizing: border-box; padding: 4px; display: flex; flex-direction: column;
|
|
107
112
|
min-width: 218px; max-width: min(360px, 100vw - 24px); max-height: calc(100vh - 24px); overflow-y: auto;
|
|
108
|
-
background: var(--dsw-specific-menu, rgba(28, 28, 32, 0.98))
|
|
113
|
+
background: var(--dsw-menu-surface-fill, var(--dsw-specific-menu, rgba(28, 28, 32, 0.98)));
|
|
114
|
+
backdrop-filter: var(--dsw-menu-backdrop-filter, none); color: var(--dsw-alias-label-primary, #ececf1);
|
|
109
115
|
--dsw-elevation-stroke-color: var(--dsw-alias-border-l1, transparent);
|
|
110
|
-
box-shadow: var(--dsw-elevation-prominent, 0 10px 34px rgba(0, 0, 0, 0.35)); border: 0; border-radius: 20px; font-size: 13px; }
|
|
116
|
+
box-shadow: var(--dsw-elevation-prominent, 0 10px 34px rgba(0, 0, 0, 0.35)); border: 0; border-radius: var(--dsw-radius-lg, 20px); font-size: 13px; }
|
|
111
117
|
.dci-viewport { display: flex; flex-direction: column; min-height: 0; }
|
|
112
118
|
.dci-menuLabel { padding: 8px 10px; font-size: 12px; line-height: 16px; color: var(--dsw-alias-label-tertiary, currentColor);
|
|
113
119
|
user-select: none; text-align: left; }
|
|
@@ -122,54 +128,59 @@ const CSS = `
|
|
|
122
128
|
.dci-itemLabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
123
129
|
.dci-check { flex: none; color: var(--dsw-alias-label-primary, currentColor); display: grid; place-items: center; }
|
|
124
130
|
|
|
125
|
-
/* ===== 候选菜单(官方 MenuView.module.css
|
|
126
|
-
.
|
|
131
|
+
/* ===== 候选菜单(官方 MenuView.module.css 逐值复刻:卡片顶锚定全宽浮层)
|
|
132
|
+
0.1.7-rc.2 起菜单本体不再带背景,亚克力在 primitives MenuSurface 的 material 层
|
|
133
|
+
(--dsw-menu-surface-fill + --dsw-menu-backdrop-filter);单元素复刻把两层合并到这里,
|
|
134
|
+
token 链兼容旧宿主(无新 token 时回退 rc.3 形态:不透明 --dsw-specific-menu、r20、无 blur)===== */
|
|
135
|
+
.dci-slash-menu { z-index: 100; box-sizing: border-box; --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2, transparent);
|
|
127
136
|
--dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2, transparent);
|
|
128
|
-
background: var(--dsw-specific-menu, rgba(30, 30, 34, 0.98))
|
|
137
|
+
background: var(--dsw-menu-surface-fill, var(--dsw-specific-menu, rgba(30, 30, 34, 0.98)));
|
|
138
|
+
backdrop-filter: var(--dsw-menu-backdrop-filter, none); color: var(--dsw-alias-label-primary, inherit);
|
|
129
139
|
--dsw-elevation-stroke-color: var(--dsw-alias-border-l1, transparent);
|
|
130
|
-
max-height:
|
|
131
|
-
border: 0; border-radius: 20px; flex-direction: column; padding: 4px; display: flex; position: absolute;
|
|
140
|
+
max-height: 400px; box-shadow: var(--dsw-elevation-prominent, 0 10px 34px rgba(0, 0, 0, 0.35));
|
|
141
|
+
border: 0; border-radius: var(--dsw-radius-lg, 20px); flex-direction: column; padding: 4px; display: flex; position: absolute;
|
|
132
142
|
bottom: calc(100% + 4px); left: 0; right: 0; overflow: hidden; }
|
|
133
143
|
.dci-slash-viewport { flex-direction: column; min-height: 0; display: flex; overflow-y: auto; }
|
|
134
|
-
.dci-slash-item { cursor: pointer; width: 100%; min-height:
|
|
135
|
-
text-align: left; background: transparent; border: none; border-radius: 10px; align-items: center; gap:
|
|
136
|
-
padding: 8px
|
|
144
|
+
.dci-slash-item { cursor: pointer; width: 100%; min-height: 34px; color: var(--dsw-alias-label-primary, inherit);
|
|
145
|
+
text-align: left; background: transparent; border: none; border-radius: var(--dsw-radius-md, 10px); align-items: center; gap: 6px;
|
|
146
|
+
padding: 6px 8px; font-size: 13px; line-height: 20px; display: flex; }
|
|
137
147
|
.dci-slash-item[data-active="true"], .dci-slash-item:hover { background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent)); }
|
|
138
|
-
.dci-slash-sectionTitle { min-height:
|
|
139
|
-
padding:
|
|
140
|
-
.dci-slash-sectionTitle:not(:first-child) { margin-top:
|
|
141
|
-
.dci-slash-itemIcon { width:
|
|
148
|
+
.dci-slash-sectionTitle { min-height: 23px; color: var(--dsw-alias-label-tertiary, currentColor); flex: none;
|
|
149
|
+
padding: 5px 8px 2px; font-size: 11px; font-weight: 500; line-height: 16px; }
|
|
150
|
+
.dci-slash-sectionTitle:not(:first-child) { margin-top: 3px; }
|
|
151
|
+
.dci-slash-itemIcon { width: 14px; height: 14px; color: var(--dsw-alias-menu-icon, var(--dsw-alias-label-tertiary, currentColor)); flex: none;
|
|
142
152
|
justify-content: center; align-items: center; display: inline-flex; }
|
|
143
|
-
.dci-slash-itemIcon svg { width:
|
|
153
|
+
.dci-slash-itemIcon svg { width: 14px; height: 14px; }
|
|
144
154
|
.dci-slash-itemName { text-overflow: ellipsis; white-space: nowrap; flex: none; max-width: 40%; overflow: hidden; }
|
|
145
|
-
.dci-slash-itemAlias { text-overflow: ellipsis; white-space: nowrap; max-width: 20%; color: var(--dsw-alias-label-tertiary, currentColor); flex: none;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
.dci-slash-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
.dci-slash-itemAlias { text-overflow: ellipsis; white-space: nowrap; max-width: 20%; color: var(--dsw-alias-label-tertiary, currentColor); flex: none;
|
|
156
|
+
font-size: 12px; line-height: 18px; overflow: hidden; }
|
|
157
|
+
.dci-slash-itemDescription { text-overflow: ellipsis; white-space: nowrap; text-align: right; min-width: 0;
|
|
158
|
+
color: var(--dsw-alias-label-tertiary, currentColor); flex: 1; font-size: 12px; line-height: 18px; overflow: hidden; }
|
|
159
|
+
.dci-slash-trailing { flex: none; align-items: center; gap: 3px; margin-left: auto; display: inline-flex; }
|
|
160
|
+
.dci-slash-drillHintText { color: var(--dsw-alias-label-caption, currentColor); white-space: nowrap; font-size: 10px;
|
|
161
|
+
line-height: 16px; display: none; }
|
|
162
|
+
.dci-slash-drillHint { border-radius: var(--dsw-radius-xs, 4px); background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));
|
|
163
|
+
color: var(--dsw-alias-label-caption, currentColor); padding: 0 4px; font-family: inherit;
|
|
164
|
+
font-size: 10px; line-height: 16px; display: none; }
|
|
154
165
|
.dci-slash-item[data-active="true"] .dci-slash-drillHintText, .dci-slash-item[data-active="true"] .dci-slash-drillHint { display: inline-flex; }
|
|
155
|
-
.dci-slash-drill { width:
|
|
166
|
+
.dci-slash-drill { width: 18px; height: 18px; border-radius: var(--dsw-radius-xs, 4px); color: var(--dsw-alias-menu-icon, var(--dsw-alias-label-caption, currentColor));
|
|
156
167
|
flex: none; place-items: center; display: inline-grid; cursor: pointer; }
|
|
157
168
|
.dci-slash-drill:hover { background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));
|
|
158
169
|
color: var(--dsw-alias-label-primary, inherit); }
|
|
159
|
-
.dci-slash-groupTitle { color: var(--dsw-alias-label-tertiary, currentColor); padding: 8px
|
|
160
|
-
.dci-slash-skeletonRow { box-sizing: border-box; align-items: center; min-height:
|
|
170
|
+
.dci-slash-groupTitle { color: var(--dsw-alias-label-tertiary, currentColor); padding: 6px 8px; font-size: 11px; line-height: 15px; }
|
|
171
|
+
.dci-slash-skeletonRow { box-sizing: border-box; align-items: center; min-height: 34px; padding: 6px 8px; display: flex; }
|
|
161
172
|
.dci-slash-skeletonBar { background: var(--dsw-alias-bg-skeleton, color-mix(in srgb, currentColor 10%, transparent));
|
|
162
|
-
border-radius: 4px; height:
|
|
173
|
+
border-radius: var(--dsw-radius-xs, 4px); height: 18px; animation: dci-slash-skeleton 2s cubic-bezier(0.36, 0, 0.64, 1) infinite; }
|
|
163
174
|
@keyframes dci-slash-skeleton { 0% { opacity: 1; } 40% { opacity: 0.6; } 80%, 100% { opacity: 1; } }
|
|
164
175
|
.dci-slash-crumbs { border-bottom: 0.5px solid var(--dsw-alias-border-l1, transparent); flex-wrap: wrap; flex: none;
|
|
165
|
-
align-items: center; gap: 2px; margin-bottom: 2px; padding:
|
|
176
|
+
align-items: center; gap: 2px; margin-bottom: 2px; padding: 3px 3px 5px; display: flex; }
|
|
166
177
|
.dci-slash-crumb { max-width: 40%; color: var(--dsw-alias-label-tertiary, currentColor); cursor: pointer;
|
|
167
|
-
text-overflow: ellipsis; white-space: nowrap; background: transparent; border: none; border-radius: 6px;
|
|
168
|
-
flex: 0
|
|
178
|
+
text-overflow: ellipsis; white-space: nowrap; background: transparent; border: none; border-radius: var(--dsw-radius-sm, 6px);
|
|
179
|
+
flex: 0 auto; padding: 2px 5px; font-family: inherit; font-size: 11px; line-height: 16px; overflow: hidden; }
|
|
169
180
|
.dci-slash-crumb:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));
|
|
170
181
|
color: var(--dsw-alias-label-primary, inherit); }
|
|
171
182
|
.dci-slash-crumb:disabled { color: var(--dsw-alias-label-primary, inherit); cursor: default; background: transparent; }
|
|
172
|
-
.dci-slash-crumbSeparator { color: var(--dsw-alias-label-caption, currentColor); flex: none; display: inline-flex; }
|
|
183
|
+
.dci-slash-crumbSeparator { color: var(--dsw-alias-menu-icon, var(--dsw-alias-label-caption, currentColor)); flex: none; display: inline-flex; }
|
|
173
184
|
|
|
174
185
|
.dci-crumb-row { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 6px; }
|
|
175
186
|
.dci-crumb { border: none; background: transparent; color: var(--dsw-alias-label-secondary, inherit); cursor: pointer;
|
|
@@ -382,14 +393,30 @@ button.dci-attach-body { color: inherit; font: inherit; text-align: left; backgr
|
|
|
382
393
|
background: var(--dsw-alias-label-primary-foreground, #fff); transition: transform 120ms ease; }
|
|
383
394
|
.dci-switch[aria-checked="true"]::after { transform: translateX(16px); }
|
|
384
395
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
396
|
+
|
|
397
|
+
/* ===== 原图预览(官方 primitives ImageLightbox 逐值复刻)===== */
|
|
398
|
+
.dci-lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 40px; }
|
|
399
|
+
.dci-lightbox-mask { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-1, rgba(0, 0, 0, 0.55));
|
|
400
|
+
backdrop-filter: var(--dsw-mask-blur, blur(4px)); }
|
|
401
|
+
.dci-lightbox-image { position: relative; max-width: min(100%, 1600px); max-height: calc(100vh - 80px);
|
|
402
|
+
object-fit: contain; border-radius: var(--dsw-radius-lg, 16px); background: var(--dsw-specific-input-major);
|
|
403
|
+
border: 0; box-shadow: var(--dsw-elevation-prominent, 0 10px 34px rgba(0, 0, 0, 0.35)); }
|
|
404
|
+
.dci-lightbox-close { position: fixed; top: 20px; right: 20px; z-index: 1; display: grid; place-items: center;
|
|
405
|
+
width: 36px; height: 36px; border: 0.5px solid var(--dsw-alias-border-l2-darkmode-thin, var(--dsw-alias-border-l2, transparent));
|
|
406
|
+
border-radius: 999px; corner-shape: round; background: var(--dsw-specific-input-major);
|
|
407
|
+
color: var(--dsw-alias-label-primary, currentColor); cursor: pointer; }
|
|
408
|
+
.dci-lightbox-close:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, currentColor)); outline-offset: 3px; }
|
|
409
|
+
|
|
410
|
+
/* ===== 数据行(官方 uV2eYG_dock 复刻:root 内居中、无横向 padding)===== */
|
|
411
|
+
.dci-stat-root { max-width: 100%; box-sizing: border-box; width: 100%;
|
|
412
|
+
padding: 4px 0 0; font-size: calc(var(--dsh-content-font-size-secondary, 13px) - 1px);
|
|
413
|
+
line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
|
|
414
|
+
justify-content: center; gap: 12px; display: flex; }
|
|
389
415
|
.dci-stat-anchor { min-width: 0; display: inline-flex; position: relative; }
|
|
390
416
|
|
|
391
417
|
/* 数据行详情面板(官方 bRhRbq 复刻:锚点上方弹出) */
|
|
392
|
-
.dci-stat-panel { z-index: 1100; box-sizing: border-box; background: var(--dsw-specific-menu, rgba(30, 30, 34, 0.98));
|
|
418
|
+
.dci-stat-panel { z-index: 1100; box-sizing: border-box; background: var(--dsw-menu-surface-fill, var(--dsw-specific-menu, rgba(30, 30, 34, 0.98)));
|
|
419
|
+
backdrop-filter: var(--dsw-menu-backdrop-filter, none);
|
|
393
420
|
color: var(--dsw-alias-label-secondary, inherit); --dsw-elevation-stroke-color: var(--dsw-alias-border-l1, transparent);
|
|
394
421
|
width: max-content; min-width: min(300px, 100vw - 24px); max-width: min(440px, 100vw - 24px); text-align: left;
|
|
395
422
|
box-shadow: var(--dsw-elevation-prominent, 0 10px 34px rgba(0, 0, 0, 0.35)); cursor: default; border: 0;
|
|
@@ -404,7 +431,7 @@ button.dci-attach-body { color: inherit; font: inherit; text-align: left; backgr
|
|
|
404
431
|
gap: 6px 16px; margin: 0; display: grid; }
|
|
405
432
|
.dci-stat-details dt, .dci-stat-details dd { min-width: 0; margin: 0; }
|
|
406
433
|
.dci-stat-details dd { color: var(--dsw-alias-label-secondary, inherit); font-variant-numeric: tabular-nums; text-align: right; }
|
|
407
|
-
.dci-stat-pill { box-sizing: border-box; max-width: 100%; color: var(--dsw-alias-label-tertiary, currentColor);
|
|
434
|
+
.dci-stat-pill { font: inherit; box-sizing: border-box; max-width: 100%; color: var(--dsw-alias-label-tertiary, currentColor);
|
|
408
435
|
white-space: nowrap; background: transparent; border: none; border-radius: 24px; align-items: center; gap: 6px;
|
|
409
436
|
padding: 1px 8px; display: inline-flex; cursor: pointer; font-variant-numeric: tabular-nums; }
|
|
410
437
|
.dci-stat-pill svg { flex: none; width: 14px; height: 14px; }
|
|
@@ -413,17 +440,21 @@ button.dci-attach-body { color: inherit; font: inherit; text-align: left; backgr
|
|
|
413
440
|
.dci-stat-label { text-overflow: ellipsis; min-width: 0; overflow: hidden; }
|
|
414
441
|
.dci-stat-sep { color: var(--dsw-alias-separator-primary, currentColor); margin: 0 6px; }
|
|
415
442
|
|
|
416
|
-
/* ===== 上下文小圈(官方 JObwrW 复刻:双环仪表 +
|
|
417
|
-
.
|
|
418
|
-
.dci-gauge-
|
|
419
|
-
|
|
420
|
-
|
|
443
|
+
/* ===== 上下文小圈(官方 JObwrW 复刻:双环仪表 + 分段面板)
|
|
444
|
+
0.1.7-rc.2 起官方把它挪进卡片下方 dock 行(stats 胶囊之后),trigger 变为「圈+百分比」药丸 ===== */
|
|
445
|
+
.dci-gauge-root { flex: none; display: inline-flex; position: relative; }
|
|
446
|
+
.dci-gauge-trigger { border-radius: var(--dsw-radius-sm, 8px); color: var(--dsw-alias-label-tertiary, currentColor);
|
|
447
|
+
font-family: inherit; font-size: 13px; font-variant-numeric: tabular-nums; line-height: 20px; white-space: nowrap;
|
|
448
|
+
cursor: pointer; background: transparent; border: none; flex: none; align-items: center; gap: 6px; padding: 1px 8px; display: inline-flex; }
|
|
449
|
+
.dci-gauge-trigger:hover, .dci-gauge-trigger[aria-expanded="true"] { background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));
|
|
450
|
+
color: var(--dsw-alias-label-secondary, inherit); }
|
|
421
451
|
.dci-gauge-track { fill: none; stroke: var(--dsw-alias-border-l3, currentColor); stroke-width: 2px; }
|
|
422
452
|
.dci-gauge-fill { fill: none; stroke: var(--dsw-alias-label-tertiary, currentColor); stroke-width: 2px; stroke-linecap: round; }
|
|
423
|
-
.dci-gauge-panel { z-index: 1100; box-sizing: border-box; background: var(--dsw-specific-menu, rgba(30, 30, 34, 0.98));
|
|
424
|
-
|
|
453
|
+
.dci-gauge-panel { z-index: 1100; box-sizing: border-box; background: var(--dsw-menu-surface-fill, var(--dsw-specific-menu, rgba(30, 30, 34, 0.98)));
|
|
454
|
+
backdrop-filter: var(--dsw-menu-backdrop-filter, none);
|
|
455
|
+
--dsw-elevation-stroke-color: var(--dsw-alias-border-l1, transparent); width: min(264px, 100vw - 24px);
|
|
425
456
|
box-shadow: var(--dsw-elevation-prominent, 0 10px 34px rgba(0, 0, 0, 0.35));
|
|
426
|
-
color: var(--dsw-alias-label-secondary, inherit); cursor: default; border: 0; border-radius: 12px; padding: 12px;
|
|
457
|
+
color: var(--dsw-alias-label-secondary, inherit); cursor: default; border: 0; border-radius: var(--dsw-radius-lg, 12px); padding: 12px;
|
|
427
458
|
font-size: 12px; line-height: 20px; position: absolute; bottom: calc(100% + 8px); right: 0; }
|
|
428
459
|
.dci-gauge-header { align-items: center; gap: 6px; display: flex; }
|
|
429
460
|
.dci-gauge-figures { font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-primary, inherit); margin-left: auto; font-weight: 500; }
|