balance-dsh 2.1.5 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +711 -252
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -121,13 +121,15 @@ window.__ModuleLoader__.load({
|
|
|
121
121
|
亚像素定位不是原因)。overflow:hidden 走布局层裁剪,不层化、不发虚。
|
|
122
122
|
早期担心它建立 BFC、挡住子元素外发光,实测数字没有外发光,不成立。 */
|
|
123
123
|
.balance-footer__dcell--roll{position:relative;overflow:hidden}
|
|
124
|
-
/*
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
/* 位数变化时(9.812 → 9.8123、9.99 → 10.01、11.04 → 8.04),新值是空位的那几格
|
|
125
|
+
**滚动期间保持原宽度**,滚完(--roll-done)再收成 0 宽。
|
|
126
|
+
⚠️ 2026-11-02 改:原来是「滚动期间就用 max-width 动画收窄」,邻格被横向挤着走,
|
|
127
|
+
两串数字会叠住,于是当时的解法是**位数一变干脆不滚** —— 用户立刻发现
|
|
128
|
+
「调整显示位数的时候数字滚动动画会丢失」。现在拆成两段:滚的时候宽度不动(这条),
|
|
129
|
+
滚完再收(--roll-done 那条带 160ms 过渡)。宽度变化只发生在没有任何滚动的那一帧之后,
|
|
130
|
+
既不会横向互挤,也不会丢动画。
|
|
131
|
+
影子格保持 from 字符:这一格在滚动期间要维持原来的宽度。 */
|
|
132
|
+
.balance-footer__dcell--gone{animation:none;max-width:2ch}
|
|
131
133
|
/* ─── 滚动播完后的「定格态」(2026-10-31 方案 3 补充)─────────────────────────
|
|
132
134
|
为什么需要它:滚动动画不是 JS 触发的,而是 .balance-footer__dout / __din 上
|
|
133
135
|
常驻的 animation 声明。只要这两个节点还在、类名还在、animation 声明还在,
|
|
@@ -141,8 +143,19 @@ window.__ModuleLoader__.load({
|
|
|
141
143
|
(没有 transform = top:0),正好就是关键帧 100% 的位置。 */
|
|
142
144
|
.balance-footer__dcell--roll-done .balance-footer__dout{animation:none;display:none}
|
|
143
145
|
.balance-footer__dcell--roll-done .balance-footer__din{animation:none;transform:none}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
/* 滚完之后才收宽度(滚动期间由上面的 --gone 保持原宽度)。
|
|
147
|
+
160ms 过渡:此时全串都已经静止,收窄只会让右边的格子整体平移,不存在两串数字互挤。 */
|
|
148
|
+
.balance-footer__dcell--roll-done.balance-footer__dcell--gone{animation:none;max-width:0;transition:max-width .16s linear}
|
|
149
|
+
/* ⚠️ 今日胶囊里「变空的格子」必须**立刻**收宽,不许留上面那条 160ms 尾巴
|
|
150
|
+
(2026-11-02 第十一轮第三版:用户报「有动画bug 导致今日二字会滑动 我不知道怎么触发的」)。
|
|
151
|
+
根因就在这条过渡上:它动的是**布局宽度**,而今日这一行是 justify-content:center ——
|
|
152
|
+
宽度一收,整块重新居中,「今日」二字被推着走。更要命的是它发生在数字滚完约 600ms 之后,
|
|
153
|
+
跟「值变了」不在同一拍,而且只有字符数变化(9.99→11.04、11.8042→11.80)时才出现,
|
|
154
|
+
所以从界面上看就是「不知道什么时候就自己滑一下」。
|
|
155
|
+
这里让宽度在「值变化的那一帧」就到位:JS 那边量位置时拿到的已经是终局宽度,
|
|
156
|
+
于是「今日」只滑它该滑的那一次,之后绝不再动。
|
|
157
|
+
代价:消失的那一格没有滑出动画,直接就没了 —— 反正它本来也是被收窄掉的,看不出来。 */
|
|
158
|
+
.balance-footer__timeline-meta-item--today .balance-footer__dcell--gone{max-width:0}
|
|
146
159
|
.balance-footer__dghost{display:block;visibility:hidden;white-space:pre}
|
|
147
160
|
/* ⚠️ 不要给 dout/din 加 will-change:transform,opacity。
|
|
148
161
|
它们是**常驻**节点(滚动结束后不再卸掉,见「滚动结束后保持滚动态」),
|
|
@@ -343,10 +356,17 @@ window.__ModuleLoader__.load({
|
|
|
343
356
|
}
|
|
344
357
|
/* ── 剩余时间「剩 3h57m」的逐段滚动 ──
|
|
345
358
|
数字段各自是一个 .balance-footer__roll(内含 dout/din 滚格),
|
|
346
|
-
字母段(h / m / d
|
|
359
|
+
字母段(h / m / d)保持静止。
|
|
360
|
+
⚠️ 2026-11-02:段数变化(1h01m → 1h)不再整体硬换,见 __remain-seg--gone:
|
|
361
|
+
消失的那一段在滚动期间淡出,滚完再把宽度收掉(用户要求「01m 消失也要有动画」)。 */
|
|
347
362
|
.balance-footer__remain{display:inline-flex;align-items:baseline;white-space:pre}
|
|
348
363
|
.balance-footer__remain-unit{display:inline-block}
|
|
349
|
-
|
|
364
|
+
/* 整段消失:滚动期间只淡出、**宽度不动**;滚完(--gone-done)再收宽度。
|
|
365
|
+
分成两段是为了不和邻段横向互挤 —— 老版本就是在这里叠字的(2026-10-31)。 */
|
|
366
|
+
.balance-footer__remain-seg{display:inline-block;overflow:hidden;white-space:pre;vertical-align:bottom}
|
|
367
|
+
.balance-footer__remain-seg--gone{animation:balance-remain-gone .34s linear both}
|
|
368
|
+
.balance-footer__remain-seg--gone-done{animation:none;opacity:0;max-width:0;transition:max-width .16s linear}
|
|
369
|
+
@keyframes balance-remain-gone{from{opacity:1}to{opacity:0}}
|
|
350
370
|
/* 剩余时间里的滚格子必须 inline-block,否则在 inline-flex 里会被压成零宽 */
|
|
351
371
|
.balance-footer__remain .balance-footer__roll{display:inline-flex;align-items:baseline}
|
|
352
372
|
.balance-footer__remain .balance-footer__dcell{display:inline-block}
|
|
@@ -675,6 +695,9 @@ window.__ModuleLoader__.load({
|
|
|
675
695
|
时长与曲线与刷新白条 balance-wipe-head 完全一致(.58s cubic-bezier(.34,.7,.26,1))。 */
|
|
676
696
|
.balance-footer__timeline-pointer{position:absolute;left:0;top:-1px;bottom:-1px;width:2px;margin-left:-1px;background:var(--dsw-alias-label-primary,#fff);box-shadow:0 0 3px rgba(255,255,255,.7),0 0 2px rgba(0,0,0,.55);pointer-events:none;z-index:2}
|
|
677
697
|
.balance-footer__timeline-pointer--intro{animation:balance-ptr-in 580ms cubic-bezier(.34,.7,.26,1) both;will-change:left}
|
|
698
|
+
/* 闸门没开时的样子:待在终点但**不可见**(2026-11-02 用户要求指针动画排队)。
|
|
699
|
+
不加这条的话,等闸门的这 640ms 里指针会明晃晃站在终点,闸门一开又跳回 3px 重滑 —— 看得见的闪。 */
|
|
700
|
+
.balance-footer__timeline-pointer--pending{opacity:0}
|
|
678
701
|
/* from 固定 = pct 0 的位置(0% + 3px 内缩);to 读元素上的自定义属性,即最终落点。
|
|
679
702
|
both 让动画结束后停在 to,摘掉 --intro 时 inline left 恰好同值,不会跳。 */
|
|
680
703
|
@keyframes balance-ptr-in{from{left:3px}to{left:var(--balance-ptr-to,3px)}}
|
|
@@ -713,7 +736,7 @@ window.__ModuleLoader__.load({
|
|
|
713
736
|
默认是 superellipse(1.5)——不覆盖的话 border-radius:50% 会被渲染成"圆角方形"
|
|
714
737
|
(squircle),根本不是圆(2026-09-28 用户反馈「很奇怪啊」,截图是 squircle)。
|
|
715
738
|
DSH 自己的 .pill 也是这么显式写 corner-shape:round 抵消的。 */
|
|
716
|
-
.balance-fab{box-sizing:border-box;position:fixed;left:44px;bottom:
|
|
739
|
+
.balance-fab{box-sizing:border-box;position:fixed;left:44px;bottom:44px;z-index:9998;width:60px;height:60px;padding:0;border-radius:50%;corner-shape:round;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-.01em;text-decoration:none;white-space:nowrap;overflow:hidden;cursor:pointer;pointer-events:auto;background:color-mix(in srgb,var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-base,#1b1b1c)) 58%,transparent);-webkit-backdrop-filter:blur(18px) saturate(180%);backdrop-filter:blur(18px) saturate(180%);border:1px solid color-mix(in srgb,var(--dsw-alias-label-primary) 14%,transparent);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 26%,transparent),inset 0 -1px 1px color-mix(in srgb,#fff 8%,transparent),0 6px 20px rgba(0,0,0,.28);transition:transform .18s var(--ds-ease-in-out,ease-out),color .42s var(--ds-ease-in-out,ease-out),background .42s var(--ds-ease-in-out,ease-out),box-shadow .18s var(--ds-ease-in-out,ease-out)}
|
|
717
740
|
.balance-fab:hover{transform:scale(1.06);background:color-mix(in srgb,var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-base,#1b1b1c)) 76%,transparent);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 34%,transparent),inset 0 -1px 1px color-mix(in srgb,#fff 10%,transparent),0 10px 26px rgba(0,0,0,.34)}
|
|
718
741
|
.balance-fab:active{transform:scale(.95)}
|
|
719
742
|
/* 金额偏长时(如 ¥1234.56)自动收一号字,免得 60px 圆里挤爆 */
|
|
@@ -842,6 +865,80 @@ window.__ModuleLoader__.load({
|
|
|
842
865
|
高度 16px(行高 22px,纵向放得下、不会把整行撑高),字号 11px 跟随 DSH 的次要信息档;
|
|
843
866
|
背景用很低的白(.06)—— 比胶囊的雾淡一档,读起来是"附注"而不是第二个数字。 */
|
|
844
867
|
.balance-usage-team{display:inline-flex;align-items:center;flex:none;height:16px;padding:0 5px;border-radius:999px;corner-shape:round;background:rgba(255,255,255,.06);color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;white-space:nowrap}
|
|
868
|
+
/* ═══ 右下角小浮窗(2026-11-02 第十轮起,第十一轮按用户三轮反馈定形)═════
|
|
869
|
+
用户第一轮原话:「把这段改成小浮窗显示在对话界面右下角 然后分列显示 上面显示本会话消耗文本
|
|
870
|
+
下一列为今日消耗 并保留所有动画 因为当前因为需要预留加载胶囊 导致数字离得太远了」。
|
|
871
|
+
第二轮原话:「只显示本会话的消耗 不要今日消耗 然后调小一点 太大了 我要的是第一列显示
|
|
872
|
+
本会话消耗估算的字样 第二列显示消耗数字 保留动画」。
|
|
873
|
+
第三轮(看到一行两列的截图后):「说错了 是两行 不是两列 上面显示文本 下面显示数字 是我说错了 不好意思」。
|
|
874
|
+
所以最终形态是**两行**:上行「本会话消耗估算」(说明文字,11px),下行金额(14px),
|
|
875
|
+
两行都居中;没有图标、没有今日那一行;动效一个都不删(迷雾、开窗、逐位滚动)。
|
|
876
|
+
⚠️ 上一版的一行两列要「数字紧贴标签」,所以数字改成左对齐、开窗与雾也各配了一套
|
|
877
|
+
「从左往右」的变体(balance-float-window-open / balance-float-mist-wipe)。竖排之后数字回到
|
|
878
|
+
**居中**,这两套变体已删除 —— 基础规则的居中径向挖洞 + 中缝开窗在居中的数字上才是对的。
|
|
879
|
+
⚠️ 定位由 JS 量 composer dock 的矩形写进 style(见 UsageCostLine 的 floatBox),
|
|
880
|
+
这里的 right/bottom 只是量不到时的兜底。收在 slot 里、**不 portal**:
|
|
881
|
+
切到别的视图时 DSH 会给祖先挂 display:none,fixed 后代同样不生成盒子;
|
|
882
|
+
portal 到 body 反而会浮在设置页上面。 */
|
|
883
|
+
/* 包裹层在 composer dock 里不该占位:卡片是 fixed、已经脱离文档流,但包裹层自己还是
|
|
884
|
+
一个 inline-flex 盒子,会跟 dock 的 gap 一起在输入框下方挤出一格空隙。压成 0×0 并
|
|
885
|
+
把指针事件关掉(卡片自己再开回来),视觉与排版都与「没有这个 slot」等价。 */
|
|
886
|
+
.balance-usage-wrap--float{display:block;width:0;height:0;overflow:visible;pointer-events:none}
|
|
887
|
+
/* **两行**(2026-11-02 第十一轮第四版:用户「说错了 是两行 不是两列 上面显示文本 下面显示数字」):
|
|
888
|
+
第一行文字「本会话消耗估算」(11px,次要色),第二行金额(14px)居中。
|
|
889
|
+
卡片 42px 高 / 圆角 10px / 行间距 2px —— 两行比原来那版一行两列高一倍,字号才有地方放。
|
|
890
|
+
⚠️ 竖排时**卡片宽度不再由标签定死**(原来 width:calc(7em+2px) 是为了一行两列的列起点恒定),
|
|
891
|
+
改回 width:auto:哪一行更宽由内容决定,两行都居中(align-items:center)。
|
|
892
|
+
⚠️ 数字那一行(团队圆片 + 金额)在 JSX 里已经被包成 .balance-float__value-row ——
|
|
893
|
+
flex-direction:column 会把**直接子节点**各拆一行,不包的话圆片和金额会竖成两行。 */
|
|
894
|
+
.balance-float{
|
|
895
|
+
box-sizing:border-box;position:fixed;right:16px;bottom:16px;z-index:70;pointer-events:auto;
|
|
896
|
+
display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
|
|
897
|
+
height:auto;min-height:42px;padding:4px 12px;border-radius:10px;
|
|
898
|
+
font-size:14px;line-height:calc(18px + var(--dsh-content-font-delta-secondary,0px));
|
|
899
|
+
max-width:none;
|
|
900
|
+
background:var(--dsw-specific-sidebar-fill,rgba(27,27,28,.92));
|
|
901
|
+
box-shadow:0 6px 18px rgba(0,0,0,.4),inset 0 0 0 1px rgba(255,255,255,.05);
|
|
902
|
+
color:var(--dsw-alias-label-tertiary);
|
|
903
|
+
-webkit-backdrop-filter:blur(10px) saturate(1.15);backdrop-filter:blur(10px) saturate(1.15);
|
|
904
|
+
transition:box-shadow .16s linear}
|
|
905
|
+
/* ⚠️ hover 必须**自己重写 background**:基础规则 .balance-usage-line:hover 的
|
|
906
|
+
rgba(127,127,127,.12) 是半透明底(那是给内联 pill 用的),压在卡片上会让实底变透明、
|
|
907
|
+
露出后面的聊天内容。反馈交给 box-shadow 与文字色,底始终保持不透明。 */
|
|
908
|
+
.balance-float:hover,.balance-float[aria-expanded="true"]{
|
|
909
|
+
background:var(--dsw-specific-sidebar-fill,rgba(27,27,28,.92));
|
|
910
|
+
box-shadow:0 8px 22px rgba(0,0,0,.48),inset 0 0 0 1px rgba(255,255,255,.09)}
|
|
911
|
+
/* 第一行:说明文字。两行竖排后**不许再定宽**(定宽就会在窄金额时把卡片撑成两边留白),
|
|
912
|
+
只保留不换行 + 超长省略 —— 卡片的宽度由两行里更宽的那一行决定。 */
|
|
913
|
+
.balance-float__label{flex:none;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;line-height:14px;color:var(--dsw-alias-label-tertiary)}
|
|
914
|
+
/* 第二行:团队圆片 + 金额。圆片与金额之间 6px,整行在卡片里居中。 */
|
|
915
|
+
.balance-float__value-row{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:0}
|
|
916
|
+
/* 金额那一格:预留 **9ch** 兜住等待态那颗加载胶囊(2026-11-02 用户:「是不是可以让加载胶囊长一点了」)。
|
|
917
|
+
实测 14px 字下 1ch ≈ 8.21px → 6.4ch 只有 52.5px,在 101px 宽的卡片里显得又短又胖;
|
|
918
|
+
9ch ≈ 73.9px,正好和上面那行「本会话消耗估算」(77px)等宽对齐 ——
|
|
919
|
+
再长就会超过标签、把卡片撑宽,数字到达那一刻卡片会**变窄**(跳一下),所以 9ch 是上限附近。
|
|
920
|
+
⚠️ 三处必须同值:cost / reveal / body,只改一处的话等待态与出数态宽度不一致。 */
|
|
921
|
+
.balance-float .balance-usage-cost{min-width:9ch;height:1lh}
|
|
922
|
+
/* ⚠️ 三层都要压一遍:cost / reveal / mist 基础规则各自带 min-width:10.6ch,
|
|
923
|
+
只压最外层的话里面那层照样把卡片撑到 10.6ch(约 87px),"调小"等于没做。
|
|
924
|
+
两行竖排后**保持居中**(上一版一行两列时才改成 flex-start),开窗与雾的挖洞都回到基础规则,
|
|
925
|
+
不再需要 balance-float-window-open / balance-float-mist-wipe 那两套「从左往右」的变体。 */
|
|
926
|
+
.balance-float .balance-usage-reveal{justify-content:center;min-width:9ch}
|
|
927
|
+
.balance-float .balance-usage-reveal__body{min-width:9ch;justify-content:center}
|
|
928
|
+
.balance-float .balance-usage-mist{min-width:0}
|
|
929
|
+
/* 14px 字 / 18px 行高仍然比原来的 22px 内联 pill 矮,光球要按新尺寸重标定:5 团 52×26、
|
|
930
|
+
blur 4.2px 塞进 18px 行会被裁成灰板。团队圆片放到 16px/11px,跟这一行对齐。
|
|
931
|
+
⚠️ **margin-top 必须跟着写死**(2026-11-02:「里面的光圈好像整体靠上」)。光球的垂直居中是
|
|
932
|
+
top:50% 加 margin-top:calc(var(--oh)/-2),而 --oh 由 :nth-child() 那几条各自给 26/30/22/28/24px ——
|
|
933
|
+
只改 height 不改 margin-top,每条光球就按**旧的**半高往上顶 3~5px,整体看着偏上半格。
|
|
934
|
+
收起态那颗 13px 胶囊的重标定(.balance-fab__today--waiting)当年也是这么写的(margin-top:-6.5px),
|
|
935
|
+
这里同理:20px 高 → -10px。 */
|
|
936
|
+
.balance-float .balance-usage-mist__orb{width:44px;height:20px;margin-top:-10px;filter:blur(3.6px)}
|
|
937
|
+
.balance-float .balance-usage-team{height:16px;padding:0 5px;font-size:11px;line-height:16px}
|
|
938
|
+
@media (prefers-reduced-motion:reduce){
|
|
939
|
+
.balance-float .balance-usage-reveal--enter .balance-usage-reveal__body{animation:none;clip-path:none}
|
|
940
|
+
.balance-float .balance-usage-reveal--enter .balance-usage-reveal__mist{animation:none}
|
|
941
|
+
}
|
|
845
942
|
/* 待算时**什么都不画**:既没有「计算中」,也没有循环白条。
|
|
846
943
|
用户 2026-10-30 的原话是「为什么会扫两遍,如果没扫到就让他空着就行了」——
|
|
847
944
|
循环那道和擦出那道叠在一起就是两遍。现在只留擦出这一遍。 */
|
|
@@ -941,10 +1038,20 @@ window.__ModuleLoader__.load({
|
|
|
941
1038
|
⚠️ 光团那几条 alpha 在 0.55 之上**再乘了 0.8**(2026-10-31 第十三轮):X 左移之后有更多光团面积
|
|
942
1039
|
留在胶囊里,实测平均亮度 46.3 → 54.8(+18%)、峰值 109.4 → 124.1。乘 0.8 后回到 47.1 / 110.7,
|
|
943
1040
|
和原来的 46.3 / 109.4 持平 —— 这一轮只许修位置,亮度必须保持用户已经确认过的那一档。
|
|
944
|
-
光团几何 / 周期 / 缓动 / 相位 / mix-blend-mode 全未动。
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
.
|
|
1041
|
+
光团几何 / 周期 / 缓动 / 相位 / mix-blend-mode 全未动。
|
|
1042
|
+
⚠️ 2026-11-02 第十一轮第四版(用户:「感觉本会话的消耗的雾是不是有点太雾了 透明度改成跟今日消耗差不多试试看」):
|
|
1043
|
+
上一版只对齐了**平均亮度**,可「雾」的观感取决于**最暗那一片有多亮** —— 本会话那颗的底色(.038)+底光(.072)
|
|
1044
|
+
把整个胶囊灌成一块均匀的灰,p10(最暗那一片)24.5、p98(亮芯)72.7,动态范围只有 3 倍;
|
|
1045
|
+
今日那颗是「暗胶囊 + 一团亮芯」,p10 15.5 / p98 179.7,动态范围 11 倍。同样是「平均差不多」,
|
|
1046
|
+
前者读起来就是一层雾,后者读起来是一道光。
|
|
1047
|
+
所以这一版按**分位数**重标定(.audit/probe-fog-luminance.mjs,4 相位 × 4× 像素,量胶囊盒内相对底色的亮度增量):
|
|
1048
|
+
底色 .038→.028、底光 .072/.044/.022→.026/.013/.003、光团 .328/.248/.136/.053/.01→.48/.33/.16/.048/.009
|
|
1049
|
+
(**亮芯提亮、外圈收窄**:雾感来自外圈那层半透明灰,不是来自中心那点光)、外发光 .066/.029→.04/.016。
|
|
1050
|
+
实测 p10 24.5→15.7(今日 15.5)、p50 42.5→39.5(今日 38.7)、p98 72.7→80.5。
|
|
1051
|
+
即:最暗处与中间调已经和今日那颗对齐,中心仍是一团**会流动**的光(mix-blend-mode:screen 保留)。 */
|
|
1052
|
+
.balance-usage-cost .balance-usage-mist,.balance-settings__preview-stage .balance-usage-mist{background:rgba(255,255,255,.028)}
|
|
1053
|
+
.balance-usage-cost .balance-usage-mist::before,.balance-settings__preview-stage .balance-usage-mist::before{background:radial-gradient(ellipse at 50% 50%,rgba(255,255,255,.026) 0%,rgba(255,255,255,.013) 58%,rgba(255,255,255,.003) 100%)}
|
|
1054
|
+
.balance-usage-cost .balance-usage-mist__orb,.balance-settings__preview-stage .balance-usage-mist__orb{background:radial-gradient(closest-side,rgba(255,255,255,.48) 0%,rgba(255,255,255,.33) 26%,rgba(255,255,255,.16) 48%,rgba(255,255,255,.048) 68%,rgba(255,255,255,.009) 82%,rgba(255,255,255,0) 92%);box-shadow:0 0 14px 5px rgba(255,255,255,.04),0 0 30px 10px rgba(255,255,255,.016)}
|
|
948
1055
|
@keyframes balance-siri-pulse{0%,100%{opacity:.84}50%{opacity:1}}
|
|
949
1056
|
/* 光团的走位:**左右之外必须有上下与形变**(2026-10-31 第十二轮:「这个加载框够大了吧 能不能让光圈不只是左右晃」)。
|
|
950
1057
|
原来三条 keyframes 的 X 位移是 Y 的 15~25 倍(a 的 X 到 235%、Y 只有 ±11%),而 Y 的百分比
|
|
@@ -1114,13 +1221,13 @@ window.__ModuleLoader__.load({
|
|
|
1114
1221
|
⚠️ 这里两个角色的分工必须记清楚,之前搞反过:
|
|
1115
1222
|
· **FAB 自己 position:fixed**,bottom/left 直接相对视口,位置可预测;
|
|
1116
1223
|
· **anchor 只做 Tooltip 的挂载点**,position:static、不参与定位。
|
|
1117
|
-
上一版是反过来的(anchor:fixed + bottom
|
|
1224
|
+
上一版是反过来的(anchor:fixed + 一个大 bottom,FAB 在它内部 static),于是 FAB 的
|
|
1118
1225
|
实际纵向位置 = anchor 底边 + anchor 的高度,而 anchor 高度由 Tooltip 包裹层和
|
|
1119
|
-
矩形卡的 height:auto 共同决定 —— bottom
|
|
1120
|
-
卡片会飘到贴着窗口底部、正好压在 composer 上。JS
|
|
1226
|
+
矩形卡的 height:auto 共同决定 —— 那个 bottom 根本不是「距视口底 Npx」,
|
|
1227
|
+
卡片会飘到贴着窗口底部、正好压在 composer 上。JS 里按常量算的遮挡判断
|
|
1121
1228
|
也就跟着全错(算的是一处、画的是另一处)。
|
|
1122
|
-
现在几何只有一份来源:FAB 的 bottom(见上面 .balance-fab
|
|
1123
|
-
JS 那边也直接量 FAB 的真实矩形,不再用常量推算。 */
|
|
1229
|
+
现在几何只有一份来源:FAB 的 bottom(见上面 .balance-fab 主规则,2026-11-02 起
|
|
1230
|
+
= 距左缘,也就是左下角等距),JS 那边也直接量 FAB 的真实矩形,不再用常量推算。 */
|
|
1124
1231
|
.balance-stats-anchor--compact{position:static;left:auto;bottom:auto;z-index:9998}
|
|
1125
1232
|
.balance-stats-anchor--compact .balance-fab{position:fixed}
|
|
1126
1233
|
.balance-stats-layer{box-sizing:border-box;position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--dsw-alias-bg-mask-1,rgba(0,0,0,.24));backdrop-filter:var(--dsw-mask-blur,blur(2px));-webkit-backdrop-filter:var(--dsw-mask-blur,blur(2px));animation:balance-stats-backdrop-in .16s var(--ds-ease-in-out,ease-out) both}
|
|
@@ -1563,6 +1670,43 @@ window.__ModuleLoader__.load({
|
|
|
1563
1670
|
return null;
|
|
1564
1671
|
}
|
|
1565
1672
|
|
|
1673
|
+
/**
|
|
1674
|
+
* 找「输入卡片正下方那一行」(composer dock 行)的**真元素**。
|
|
1675
|
+
*
|
|
1676
|
+
* ⚠️ slot 的出口容器 `[data-slot="conversation.composer.dock"]` 是 `display:contents`
|
|
1677
|
+
* (SlotOutlet 里的 ANCHOR_STYLE)—— 它**不生成盒子**,`getBoundingClientRect()` 全 0。
|
|
1678
|
+
* 2026-11-02 实测代价:浮窗定位 effect 里那句
|
|
1679
|
+
* `if (dockRect.width === 0 || dockRect.height === 0) return;` 直接早退,
|
|
1680
|
+
* `floatBox` 永远是 null,卡片一直停在 CSS 兜底的 `right:16px;bottom:16px` ——
|
|
1681
|
+
* 中间改了三版公式都"改了跟没改一样"(用户:「你改在哪了」)。
|
|
1682
|
+
* 真元素带 `data-composer-dock`(与 `data-composer-card` 出自同一份 InputBar)。
|
|
1683
|
+
*
|
|
1684
|
+
* @param wrap 本插件自己的浮窗包裹层(宽度 0 的那个)
|
|
1685
|
+
* @returns dock 行的元素;实在找不到返回 null(调用方退回 CSS 兜底)
|
|
1686
|
+
*/
|
|
1687
|
+
function resolveComposerDockRow(wrap) {
|
|
1688
|
+
if (typeof document === "undefined") return null;
|
|
1689
|
+
try {
|
|
1690
|
+
const row = document.querySelector("[data-composer-dock]");
|
|
1691
|
+
if (row !== null && typeof row.getBoundingClientRect === "function") {
|
|
1692
|
+
const rect = row.getBoundingClientRect();
|
|
1693
|
+
if (rect.width > 0 && rect.height > 0) return row;
|
|
1694
|
+
}
|
|
1695
|
+
} catch {
|
|
1696
|
+
/* 结构变了就往下退 */
|
|
1697
|
+
}
|
|
1698
|
+
// 退路:从包裹层往上爬,跳过所有不生成盒子的层(display:contents 的出口容器)
|
|
1699
|
+
let node = wrap !== null && wrap !== undefined ? wrap.parentElement : null;
|
|
1700
|
+
for (let i = 0; node !== null && i < 4; i += 1) {
|
|
1701
|
+
if (typeof node.getBoundingClientRect === "function" && node.ownerDocument === document) {
|
|
1702
|
+
const rect = node.getBoundingClientRect();
|
|
1703
|
+
if (rect.width > 0 && rect.height > 0) return node;
|
|
1704
|
+
}
|
|
1705
|
+
node = node.parentElement;
|
|
1706
|
+
}
|
|
1707
|
+
return null;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1566
1710
|
/** 打开外部网页:交给系统默认浏览器。DSH 的 Electron 主进程拦截 window.open
|
|
1567
1711
|
* 并转给 shell.openExternal,所以这里不会弹出应用内窗口。 */
|
|
1568
1712
|
function openInSystemBrowser(url) {
|
|
@@ -1848,18 +1992,14 @@ window.__ModuleLoader__.load({
|
|
|
1848
1992
|
};
|
|
1849
1993
|
const a = split(fromText);
|
|
1850
1994
|
const b = split(toText);
|
|
1851
|
-
// ⚠️
|
|
1852
|
-
//
|
|
1853
|
-
//
|
|
1854
|
-
//
|
|
1855
|
-
//
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
&& a.tail.length === b.tail.length;
|
|
1860
|
-
if (!sameShape) {
|
|
1861
|
-
return String(toText).split("").map((ch) => ({ from: ch, to: ch, changed: false }));
|
|
1862
|
-
}
|
|
1995
|
+
// ⚠️ 位数变化**照样滚**(2026-11-02 用户:「调整显示位数的时候数字滚动动画会丢失」)。
|
|
1996
|
+
// 历史:这里原本有一道 `sameShape` 闸门 —— 位数一变就整串静态换值、一格都不滚。
|
|
1997
|
+
// 那是为了绕开「--gone 的 max-width 在滚动**期间**收窄 → 邻格被横向挤着走 → 两串数字叠住」
|
|
1998
|
+
// (2026-10-31「20.6? CNY」)。代价就是用户现在报的这条:跨精度(9.99 → 10.01、
|
|
1999
|
+
// 0.9999 → 1.0013)时数字硬切。
|
|
2000
|
+
// 现在把宽度变化**推迟到滚完之后**(见 CSS 的 --gone / --roll-done 两段),
|
|
2001
|
+
// 滚动期间每格宽度恒定,所以既不互挤、也不丢动画。位数不同的格子靠下面的
|
|
2002
|
+
// padLeft/padRight 对齐(整数右对齐、小数左对齐),多出来的那一格 from 或 to 是空位。
|
|
1863
2003
|
const padLeft = (s, n) => s.padStart(n, ROLL_EMPTY);
|
|
1864
2004
|
const padRight = (s, n) => s.padEnd(n, ROLL_EMPTY);
|
|
1865
2005
|
const intLen = Math.max(a.int.length, b.int.length);
|
|
@@ -2020,25 +2160,41 @@ window.__ModuleLoader__.load({
|
|
|
2020
2160
|
return String(text).match(/\d+|\D+/g) || [];
|
|
2021
2161
|
}
|
|
2022
2162
|
|
|
2023
|
-
/**
|
|
2024
|
-
*
|
|
2163
|
+
/** 渲染剩余时间的滚动。
|
|
2164
|
+
* 段数变了(1h01m → 1h,分钟归零)**不再整体硬换**:消失的那一段("01" 和 "m")
|
|
2165
|
+
* 在滚动期间淡出,滚完再把它的宽度收掉(2026-11-02 用户:
|
|
2166
|
+
* 「从 1h01m 变到 1h 时 这个 01m 消失也要有动画」)。
|
|
2167
|
+
* 段结构是「数字 + 单位」交替且只在尾部增减(见 formatRemain),所以按段序号对齐、
|
|
2168
|
+
* 按并集渲染就够,不需要更复杂的对齐算法。 */
|
|
2025
2169
|
function renderRemainRoll(fromText, toText, prefix, settled) {
|
|
2026
2170
|
const a = splitRollTokens(fromText);
|
|
2027
2171
|
const b = splitRollTokens(toText);
|
|
2028
|
-
|
|
2029
|
-
|
|
2172
|
+
const total = Math.max(a.length, b.length);
|
|
2173
|
+
const segs = [];
|
|
2174
|
+
for (let i = 0; i < total; i += 1) {
|
|
2175
|
+
const from = a[i] ?? "";
|
|
2176
|
+
const to = b[i] ?? "";
|
|
2177
|
+
const key = prefix + "s" + i;
|
|
2178
|
+
if (to === "") {
|
|
2179
|
+
// 整段消失:滚动期间淡出(宽度先别动),滚完由 --gone-done 收宽度。
|
|
2180
|
+
// 不逐位滚 —— 这一段和邻段同时在动时,横向挤压会让两串字叠住(2026-10-31 的老坑)。
|
|
2181
|
+
segs.push(jsx.jsx("span", {
|
|
2182
|
+
className: "balance-footer__remain-seg balance-footer__remain-seg--gone"
|
|
2183
|
+
+ (settled === true ? " balance-footer__remain-seg--gone-done" : ""),
|
|
2184
|
+
children: from,
|
|
2185
|
+
}, key));
|
|
2186
|
+
continue;
|
|
2187
|
+
}
|
|
2188
|
+
if (/^\d+$/.test(to) || /^\d+$/.test(from)) {
|
|
2189
|
+
segs.push(jsx.jsx("span", {
|
|
2190
|
+
className: "balance-footer__roll",
|
|
2191
|
+
children: renderRollCells(buildRollCells(from, to), key, settled),
|
|
2192
|
+
}, key));
|
|
2193
|
+
continue;
|
|
2194
|
+
}
|
|
2195
|
+
segs.push(jsx.jsx("span", { className: "balance-footer__remain-unit", children: to }, key));
|
|
2030
2196
|
}
|
|
2031
|
-
return jsx.jsx("span", {
|
|
2032
|
-
className: "balance-footer__remain",
|
|
2033
|
-
children: b.map((tok, i) => (
|
|
2034
|
-
/^\d+$/.test(tok)
|
|
2035
|
-
? jsx.jsx("span", {
|
|
2036
|
-
className: "balance-footer__roll",
|
|
2037
|
-
children: renderRollCells(buildRollCells(a[i], tok), prefix + i, settled),
|
|
2038
|
-
}, prefix + "s" + i)
|
|
2039
|
-
: jsx.jsx("span", { className: "balance-footer__remain-unit", children: tok }, prefix + "s" + i)
|
|
2040
|
-
)),
|
|
2041
|
-
}, prefix + "wrap");
|
|
2197
|
+
return jsx.jsx("span", { className: "balance-footer__remain", children: segs }, prefix + "wrap");
|
|
2042
2198
|
}
|
|
2043
2199
|
|
|
2044
2200
|
/** 值变化时返回递增的 tick:用它当 key 就能让元素重挂、重播一次入场动画,
|
|
@@ -2268,6 +2424,7 @@ const CN_CALENDAR_SOURCES = [
|
|
|
2268
2424
|
["refreshWave", "2.0.0"], // 右键刷新涟漪
|
|
2269
2425
|
["usageLoadingStyle", "2.0.9"], // 消耗行加载动效:样式1(光团开窗)/ 样式2(计算中),含行内实时预览
|
|
2270
2426
|
["todaySessionLimit", "2.1.0"], // 今日消耗扫描上限:多开对话 / 多跑子代理时把今日汇总算全
|
|
2427
|
+
["showUsagePill", "2.1.6"], // 2.1.6:消耗行搬成对话界面右下角小浮窗(两行:本会话估算 / 金额)
|
|
2271
2428
|
]);
|
|
2272
2429
|
|
|
2273
2430
|
/** NEW_TAGS 的 key → 设置项中文名。横幅要写「本版新增:消耗行加载动效」,
|
|
@@ -2278,6 +2435,7 @@ const CN_CALENDAR_SOURCES = [
|
|
|
2278
2435
|
refreshWave: "右键刷新浪潮",
|
|
2279
2436
|
usageLoadingStyle: "消耗行加载动效",
|
|
2280
2437
|
todaySessionLimit: "今日消耗扫描上限",
|
|
2438
|
+
showUsagePill: "对话右下角消耗浮窗",
|
|
2281
2439
|
};
|
|
2282
2440
|
|
|
2283
2441
|
/** 模板串里取一张表的三个 NEW 相关字段,缺省一律安全兜底。 */
|
|
@@ -2899,12 +3057,9 @@ const CN_CALENDAR_SOURCES = [
|
|
|
2899
3057
|
// 加载完再加载今日消耗)。
|
|
2900
3058
|
// 为什么必须错开:服务端算「今日」要读会话持久化文件,本机实测单个 35 MB 会话
|
|
2901
3059
|
// 解压 723 ms,和余额请求撞在一起时首屏就要等它;错开之后余额先到,界面立刻有内容。
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
* (用户 2026-10-31:「启动时插件加载动画还是有概率掉帧」)。
|
|
2906
|
-
* 之前的 240ms 正好撞在动画中段,所以只是"有概率"不是必现。 */
|
|
2907
|
-
const TODAY_AFTER_BALANCE_MS = 560;
|
|
3060
|
+
// ⚠️ 「隔多久」不再是一个固定常数:用户 2026-11-02 要求**等加载动画真的走完**,
|
|
3061
|
+
// 改成排队闸门 loadAnimDoneAt()(见 useToday 上方那段)。原本这里是
|
|
3062
|
+
// `TODAY_AFTER_BALANCE_MS = 560` —— 560ms 只是估计,动画一忙就正好压在尾巴上。
|
|
2908
3063
|
/** 余额迟迟不回来时的兜底上限 —— 不能因为余额失败就让今日永远不加载。 */
|
|
2909
3064
|
const TODAY_WAIT_BALANCE_MAX_MS = 2000;
|
|
2910
3065
|
// 本会话消耗的发出延迟。**只是让首帧先画出来,不是"错峰"** ——
|
|
@@ -2932,6 +3087,51 @@ const CN_CALENDAR_SOURCES = [
|
|
|
2932
3087
|
return 0;
|
|
2933
3088
|
}
|
|
2934
3089
|
|
|
3090
|
+
// ─── 加载动画的排队闸门(2026-11-02 第六轮,用户要求)────────────────────
|
|
3091
|
+
//
|
|
3092
|
+
// 用户原话:「今日消耗等待插件加载的动画走完再加载 可以防止掉帧 还有指针的动画
|
|
3093
|
+
// 排队插件加载完再开始计算今日消耗」。
|
|
3094
|
+
// 之后又澄清了一次(2026-11-02 第九轮):
|
|
3095
|
+
// 「我之前说的排队是只需要等插件加载完再开始计算 而不是一个一个的排队计算
|
|
3096
|
+
// 插件加载完后 后面的动画一起运行 包括计算消耗」
|
|
3097
|
+
// —— 这里是**一个闸门**,不是一条串行的队。
|
|
3098
|
+
//
|
|
3099
|
+
// 之前是三件事各自起跑:余额行入场动画(约 520ms)、余额数字逐位滚动
|
|
3100
|
+
// (420 + 4×38 = 572ms)、时间轴指针入场(580ms),而「今日消耗」在余额到位
|
|
3101
|
+
// 560ms 后就发请求 —— 服务端算今日是**同步解压会话文件**(单个 35 MB 实测 723ms),
|
|
3102
|
+
// 正好压在动画尾巴上 → 掉帧(用户 2026-10-31 就报过「启动时插件加载动画还是有概率掉帧」)。
|
|
3103
|
+
//
|
|
3104
|
+
// 现在只有一个闸门:
|
|
3105
|
+
// ① 插件加载动画(余额行入场 + 数字滚动)走完 —— 起跑点 = 余额值**第一次**出现
|
|
3106
|
+
// ② 闸门一开,**同时**:指针入场动画开始播、今日消耗开始算、本会话消耗开始算。
|
|
3107
|
+
// 三者之间没有任何先后关系,谁都不等谁。
|
|
3108
|
+
// ⚠️ 起跑点只记第一次(noteBalanceAppeared),轮询刷新不能把闸门往后推,
|
|
3109
|
+
// 否则每 60 秒那个数字都会「晚出来一截」。
|
|
3110
|
+
// ⚠️ **不许再加「A 跑完才轮到 B」的错位**:那会让数字出得更晚,而且用户已经明确否掉。
|
|
3111
|
+
const LOAD_ANIM_DONE_MS = 640; // 入场 520 / 滚动 572,取上界再加余量
|
|
3112
|
+
const POINTER_INTRO_MS = 620; // 与 CSS balance-ptr-in 的 580ms 对齐 +40 余量
|
|
3113
|
+
let loadAnimBaseAt = 0;
|
|
3114
|
+
/** 余额值第一次出现 = 加载动画的起跑点。 */
|
|
3115
|
+
function noteBalanceAppeared() {
|
|
3116
|
+
if (loadAnimBaseAt === 0) loadAnimBaseAt = Date.now();
|
|
3117
|
+
}
|
|
3118
|
+
/** 插件加载动画走完的时刻;余额一直不回来就用模块加载时刻兜底(闸门不会永远关着)。 */
|
|
3119
|
+
function loadAnimDoneAt() {
|
|
3120
|
+
return (loadAnimBaseAt || PLUGIN_LOADED_AT) + LOAD_ANIM_DONE_MS;
|
|
3121
|
+
}
|
|
3122
|
+
/** 某件事最早可以起跑的时刻(毫秒等待)。
|
|
3123
|
+
* · **闸门还没开** → 就等到闸门开,**不再额外叠加自己的 delay**:
|
|
3124
|
+
* 用户 2026-11-02 第九轮原话「插件加载完后 后面的动画一起运行 包括计算消耗」——
|
|
3125
|
+
* 今日消耗、本会话消耗、指针入场三件事在闸门那一帧同时起跑。
|
|
3126
|
+
* · **闸门已经开过** → 完全恢复各自的节奏(今日 0、本会话消耗 240/600),
|
|
3127
|
+
* 后续切对话、流式刷新一点都不变。
|
|
3128
|
+
* ⚠️ 判据用 `>= 0`:正好落在闸门那一毫秒也算「闸门开了」,不许平白多等一个 delay。 */
|
|
3129
|
+
function afterLoadAnim(delayMs = 0) {
|
|
3130
|
+
const gate = loadAnimDoneAt() - Date.now();
|
|
3131
|
+
// `>= 0`:正好落在闸门那一毫秒也要立即起跑(否则会平白多等一个 delay)。
|
|
3132
|
+
return gate >= 0 ? gate : delayMs;
|
|
3133
|
+
}
|
|
3134
|
+
|
|
2935
3135
|
function useToday() {
|
|
2936
3136
|
const [, force] = react.useState(0);
|
|
2937
3137
|
react.useEffect(() => {
|
|
@@ -2942,16 +3142,18 @@ const CN_CALENDAR_SOURCES = [
|
|
|
2942
3142
|
if (Date.now() - todayCache.at >= todayCache.ttl) void fetchTodayOnce(false);
|
|
2943
3143
|
} else {
|
|
2944
3144
|
// 用户 2026-10-31:打开 DSH 时先加载插件本体,加载完再加载今日消耗。
|
|
2945
|
-
//
|
|
2946
|
-
//
|
|
2947
|
-
//
|
|
3145
|
+
// 用户 2026-11-02(第六轮):不是「加载完」,而是**加载动画走完**才准算 ——
|
|
3146
|
+
// 服务端算今日是同步解压会话文件,压在动画帧上就是掉帧。
|
|
3147
|
+
// 用户 2026-11-02(第九轮):闸门一开就和指针入场**同时**起跑,不排在指针后面。
|
|
3148
|
+
// 所以这里先等余额到位(侧栏已经有内容),再等到闸门 open(见 loadAnimDoneAt)。
|
|
2948
3149
|
let cancelled = false;
|
|
2949
3150
|
let timer = null;
|
|
2950
3151
|
let poll = null;
|
|
2951
3152
|
const startedAt = Date.now();
|
|
2952
3153
|
const fire = () => {
|
|
2953
3154
|
if (cancelled) return;
|
|
2954
|
-
|
|
3155
|
+
// 闸门还没开就按剩余时间等;余额来得早时这一等就是「动画走完」的那一下。
|
|
3156
|
+
timer = setTimeout(() => { void fetchTodayOnce(false); }, afterLoadAnim(0));
|
|
2955
3157
|
};
|
|
2956
3158
|
const waitBalance = () => {
|
|
2957
3159
|
if (cancelled) return;
|
|
@@ -3032,6 +3234,10 @@ const CN_CALENDAR_SOURCES = [
|
|
|
3032
3234
|
try {
|
|
3033
3235
|
const data = await fetchBalanceData();
|
|
3034
3236
|
balanceCache = { status: "ready", balance: data.balance, error: null, refreshing: false, manual };
|
|
3237
|
+
// 加载动画的起跑点(用户 2026-11-02:「今日消耗 / 指针动画都排在加载动画走完之后」)。
|
|
3238
|
+
// 放在这里而不是渲染层:**值第一次进缓存**才是入场动画真正开始的时刻。
|
|
3239
|
+
// 只记第一次,之后 60 秒轮询刷新不会把闸门往后推。
|
|
3240
|
+
noteBalanceAppeared();
|
|
3035
3241
|
} catch (error) {
|
|
3036
3242
|
// ⚠️ 失败时**保留上一次成功拿到的数字**(2026-10-31 全量审查)。
|
|
3037
3243
|
// 原来这里写 `balance: null`,等于「一次网络抖动就把已知余额清空」:
|
|
@@ -3709,15 +3915,25 @@ function TimelinePointer() {
|
|
|
3709
3915
|
// 首屏忙时它只会晚一点开始,但一定播完整。
|
|
3710
3916
|
const [view, setView] = react.useState(() => {
|
|
3711
3917
|
const expired = Date.now() - PLUGIN_LOADED_AT > POINTER_INTRO_MAX_AGE_MS;
|
|
3712
|
-
|
|
3918
|
+
const wantIntro = !pointerIntroDone && !expired;
|
|
3919
|
+
// 排队(2026-11-02 用户要求「指针的动画排队 插件加载完再开始」):
|
|
3920
|
+
// 闸门还没开就先挂 --pending(opacity:0)待在终点,等 loadAnimDoneAt() 到了再挂 --intro
|
|
3921
|
+
// 从 3px 滑过来。注意**不能**直接挂 --intro 挂着 CSS 动画等它 —— 那动画是从插入时刻起跑的,
|
|
3922
|
+
// 不存在"延迟起播"这回事;而先显示终点位置又会看得见闪一下,所以中间需要这个隐形态。
|
|
3923
|
+
const waiting = wantIntro && Date.now() < loadAnimDoneAt();
|
|
3924
|
+
return {
|
|
3925
|
+
pct: pointerPercent(Date.now()),
|
|
3926
|
+
intro: wantIntro && !waiting,
|
|
3927
|
+
pending: waiting,
|
|
3928
|
+
};
|
|
3713
3929
|
});
|
|
3714
3930
|
react.useEffect(() => {
|
|
3715
3931
|
const expired = Date.now() - PLUGIN_LOADED_AT > POINTER_INTRO_MAX_AGE_MS;
|
|
3716
|
-
const
|
|
3717
|
-
// 与刷新白条(CSS 里 balance-wipe-head 的 .58s
|
|
3718
|
-
// 两者在同一次渲染里插入,动画时钟同起同落。
|
|
3932
|
+
const wantIntro = !pointerIntroDone && !expired;
|
|
3933
|
+
// 与刷新白条(CSS 里 balance-wipe-head 的 .58s)同一个时长、同一条曲线。
|
|
3719
3934
|
const INTRO_MS = 580;
|
|
3720
3935
|
const IDLE_MS = 60000;
|
|
3936
|
+
let gateTimer = 0;
|
|
3721
3937
|
let introTimer = 0;
|
|
3722
3938
|
let idleTimer = 0;
|
|
3723
3939
|
const idleIn = (now) => IDLE_MS - (now % IDLE_MS) + 30;
|
|
@@ -3727,21 +3943,30 @@ function TimelinePointer() {
|
|
|
3727
3943
|
function tick() {
|
|
3728
3944
|
// 稳态:不带动画直接落位(每分钟才动 0.069%,跳过去看不出来),
|
|
3729
3945
|
// 下一拍对齐到下一个整分钟。跨零点也走这里,不会反向滑回去。
|
|
3730
|
-
setView({ pct: pointerPercent(Date.now()), intro: false });
|
|
3946
|
+
setView({ pct: pointerPercent(Date.now()), intro: false, pending: false });
|
|
3731
3947
|
scheduleIdle();
|
|
3732
3948
|
}
|
|
3733
|
-
|
|
3949
|
+
/** 闸门开:把落点按「现在」重算一次(等闸门这几百毫秒里时刻在走),再挂 --intro 起播。 */
|
|
3950
|
+
function playIntro() {
|
|
3951
|
+
setView({ pct: pointerPercent(Date.now()), intro: true, pending: false });
|
|
3734
3952
|
introTimer = setTimeout(() => {
|
|
3735
3953
|
// 到站:置位标记(之后的重挂载不再重播),并摘掉动画类。
|
|
3736
3954
|
// animation 是 both,摘类前后都在终点,不会跳。
|
|
3737
3955
|
pointerIntroDone = true;
|
|
3738
|
-
setView((v) => ({ pct: v.pct, intro: false }));
|
|
3956
|
+
setView((v) => ({ pct: v.pct, intro: false, pending: false }));
|
|
3739
3957
|
scheduleIdle();
|
|
3740
3958
|
}, INTRO_MS + 40);
|
|
3959
|
+
}
|
|
3960
|
+
if (wantIntro) {
|
|
3961
|
+
// 和今日消耗、本会话消耗用**同一个**闸门:加载动画走完就一起起跑,谁也不排队等谁。
|
|
3962
|
+
const gateWait = afterLoadAnim(0);
|
|
3963
|
+
if (gateWait > 0) gateTimer = setTimeout(playIntro, gateWait);
|
|
3964
|
+
else playIntro();
|
|
3741
3965
|
} else {
|
|
3742
3966
|
scheduleIdle();
|
|
3743
3967
|
}
|
|
3744
3968
|
return () => {
|
|
3969
|
+
clearTimeout(gateTimer);
|
|
3745
3970
|
clearTimeout(introTimer);
|
|
3746
3971
|
clearTimeout(idleTimer);
|
|
3747
3972
|
};
|
|
@@ -3757,7 +3982,11 @@ function TimelinePointer() {
|
|
|
3757
3982
|
const shift = inset - (pct / 100) * 2 * inset;
|
|
3758
3983
|
const pos = "calc(" + pct.toFixed(4) + "% + " + shift.toFixed(2) + "px)";
|
|
3759
3984
|
return jsx.jsx("span", {
|
|
3760
|
-
className: view.intro
|
|
3985
|
+
className: view.intro
|
|
3986
|
+
? "balance-footer__timeline-pointer balance-footer__timeline-pointer--intro"
|
|
3987
|
+
: view.pending
|
|
3988
|
+
? "balance-footer__timeline-pointer balance-footer__timeline-pointer--pending"
|
|
3989
|
+
: "balance-footer__timeline-pointer",
|
|
3761
3990
|
// left 给稳态用;--balance-ptr-to 是 keyframes 的终点(两者取值相同)。
|
|
3762
3991
|
style: { left: pos, "--balance-ptr-to": pos },
|
|
3763
3992
|
});
|
|
@@ -4184,20 +4413,50 @@ function makeTodayFlowStyle() {
|
|
|
4184
4413
|
// ② 直接量 left 就是真实位移量,不用再推导 ΔW/2,也不依赖居中算法。
|
|
4185
4414
|
//
|
|
4186
4415
|
// 之所以能用 DOM:DSH 的 jsx 工厂不赋 ref,但 document.querySelector 照样能拿到节点。
|
|
4416
|
+
//
|
|
4417
|
+
// ── 2026-11-02 第十一轮第三版:修「今日二字会莫名其妙滑动」────────────────
|
|
4418
|
+
// 原来写的是 `left = rect.left` + `shift = prev - left`,两个真 bug 叠加:
|
|
4419
|
+
// ① **rect.left 是视觉位置,包含我们自己挂的 translateX**。上一段 460ms 还没走完
|
|
4420
|
+
// (今日补拉 3 次 / `?session=` 抬升 / 团队 15s 一拍,都可能正好撞上)就又来了
|
|
4421
|
+
// 新值,记进 prev 的已经是偏移过的位置 → shift 算错 → 标签先被 transition:none
|
|
4422
|
+
// 硬拽到错误的位置,再往回滑,看着就是「抖一下又滑一下」,方向还可能反。
|
|
4423
|
+
// ② 内层那个 500ms 清场定时器**从来没被取消过**(cleanup 只清了 16ms 那个):
|
|
4424
|
+
// 上一段到点把 transform 清成 "",正好把新一段的过渡打断在半路 —— 滑到一半定住。
|
|
4425
|
+
// 现在改成:**先清 transform 再量**(永远拿到布局位置,与动画无关),两个定时器都
|
|
4426
|
+
// 进 ref 且新一段开始前全部取消;正在滑的时候从「当前视觉位置」接着走,不瞬移。
|
|
4187
4427
|
const todayLeftRef = react.useRef(null);
|
|
4428
|
+
const todayTimersRef = react.useRef([]);
|
|
4429
|
+
const clearTodayTimers = () => {
|
|
4430
|
+
for (const timer of todayTimersRef.current) clearTimeout(timer);
|
|
4431
|
+
todayTimersRef.current = [];
|
|
4432
|
+
};
|
|
4188
4433
|
usePrePaintEffect(() => {
|
|
4189
4434
|
if (typeof document === "undefined" || typeof document.querySelector !== "function") return;
|
|
4190
4435
|
const label = document.querySelector(".balance-footer__timeline-meta-item--today .balance-footer__today-label");
|
|
4191
4436
|
if (!label) return;
|
|
4192
|
-
const left = label.getBoundingClientRect().left;
|
|
4193
4437
|
const prev = todayLeftRef.current;
|
|
4438
|
+
// 正在滑的时候先记下当前视觉位置:新的一段要接着这里走,否则会瞬移回布局位置。
|
|
4439
|
+
const gliding = label.style.transform !== "";
|
|
4440
|
+
const visualNow = gliding ? label.getBoundingClientRect().left : 0;
|
|
4441
|
+
clearTodayTimers();
|
|
4442
|
+
// ⚠️ 必须先清 transform 再量 —— 否则量到的是「布局位置 + 上一段残留位移」。
|
|
4443
|
+
// 这一步在 paint 之前,而且紧接着就把 translateX 补回去,所以不会闪。
|
|
4444
|
+
label.style.transition = "none";
|
|
4445
|
+
label.style.transform = "";
|
|
4446
|
+
const left = label.getBoundingClientRect().left;
|
|
4194
4447
|
todayLeftRef.current = left;
|
|
4195
4448
|
// 首次挂载没有参照,只记位置不滑动。
|
|
4196
|
-
if (prev === null)
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4449
|
+
if (prev === null) {
|
|
4450
|
+
label.style.transition = "";
|
|
4451
|
+
return;
|
|
4452
|
+
}
|
|
4453
|
+
// 静止时:新位置比旧位置左了多少,就先右移多少回到旧位置,再过渡回 0。
|
|
4454
|
+
// 正在滑时:从当前视觉位置接着走(不再叠「上一段本该补的距离」,否则会越补越歪)。
|
|
4455
|
+
const shift = gliding ? visualNow - left : prev - left;
|
|
4456
|
+
if (Math.abs(shift) < 0.5) {
|
|
4457
|
+
label.style.transition = "";
|
|
4458
|
+
return;
|
|
4459
|
+
}
|
|
4201
4460
|
label.style.transform = "translateX(" + shift.toFixed(2) + "px)";
|
|
4202
4461
|
// 下一帧才放开过渡。这里用 setTimeout 而不是 rAF —— DSH 渲染进程里
|
|
4203
4462
|
// rAF 会被窗口可见性挂起,回调可能永远不来(见 AGENTS「UI 易错点」)。
|
|
@@ -4206,15 +4465,18 @@ function makeTodayFlowStyle() {
|
|
|
4206
4465
|
// 只觉得"顿了一下";拉到 460ms 才读得出是平滑挪过去的(2026-10-31 反馈)。
|
|
4207
4466
|
label.style.transition = "transform .46s cubic-bezier(.22,.72,.28,1)";
|
|
4208
4467
|
label.style.transform = "translateX(0px)";
|
|
4209
|
-
setTimeout(() => {
|
|
4468
|
+
const done = setTimeout(() => {
|
|
4210
4469
|
// 清干净:transition 留着会影响后续任何位移,
|
|
4211
4470
|
// transform 留着更糟 —— 残留的 translateX(0px) 会让这块独立成合成层,
|
|
4212
4471
|
// 小字号中文在 GPU 纹理里渲染直接发虚(用户 2026-10-31:「数字变糊了」)。
|
|
4213
4472
|
label.style.transition = "";
|
|
4214
4473
|
label.style.transform = "";
|
|
4474
|
+
todayTimersRef.current = [];
|
|
4215
4475
|
}, 500);
|
|
4476
|
+
todayTimersRef.current = [done];
|
|
4216
4477
|
}, 16);
|
|
4217
|
-
|
|
4478
|
+
todayTimersRef.current = [id];
|
|
4479
|
+
return clearTodayTimers;
|
|
4218
4480
|
}, [todayText]);
|
|
4219
4481
|
// 连「剩」前缀一起存:滚动要对齐补的是数字段,前缀是非数字段、保持不动。
|
|
4220
4482
|
const remainText = spanNow === null ? null : "剩 " + formatRemain(spanNow.remainMs);
|
|
@@ -4245,13 +4507,13 @@ function makeTodayFlowStyle() {
|
|
|
4245
4507
|
if (clickTimer.current !== null) clearTimeout(clickTimer.current);
|
|
4246
4508
|
if (closeTimer.current !== null) clearTimeout(closeTimer.current);
|
|
4247
4509
|
}, []);
|
|
4248
|
-
// ──
|
|
4510
|
+
// ── 收起态纵向定位:距左缘 == 距底边(左下角等距,见渲染处的 fabStyle/rectStyle)──
|
|
4249
4511
|
// ⚠️ 这里原来有一段用 anchorRef 量 composer 中心、再写 anchor.style.top 的
|
|
4250
4512
|
// 「垂直居中」逻辑,2026-10-31 全量审查时删掉了。原因是**方案已被取代**,
|
|
4251
4513
|
// 不是因为 ref 拿不到节点:
|
|
4252
4514
|
// · 那时 .balance-stats-anchor--compact 还是 position:fixed,靠 style.top 摆位置;
|
|
4253
4515
|
// · 现在那个 anchor 已经改成 position:static(只做 Tooltip 挂载点),fixed 定位
|
|
4254
|
-
// 挪到了 .balance-fab
|
|
4516
|
+
// 挪到了 .balance-fab 自己身上、bottom 由渲染处按左边距内联注入(左下角等距)。
|
|
4255
4517
|
// 两套并存时,旧的 top 依然会写进 style —— 对 static 元素无效但会留在 DOM 上,
|
|
4256
4518
|
// 一旦将来有人把 anchor 改回 fixed 就会和 bottom 打架(fixed 同时有 top 和
|
|
4257
4519
|
// bottom 会被拉伸成一条)。所以整段清掉,纵向位置只保留一个来源。
|
|
@@ -4369,17 +4631,15 @@ function makeTodayFlowStyle() {
|
|
|
4369
4631
|
// 算出来的位置和实际画出来的位置差了一百多像素,于是明明压在 composer 上却判定"没遮挡"。
|
|
4370
4632
|
// 几何只有一个来源:DOM。谁改 CSS 都不用同步改这里。
|
|
4371
4633
|
const [fabCovered, setFabCovered] = react.useState(false);
|
|
4372
|
-
//
|
|
4373
|
-
//
|
|
4374
|
-
//
|
|
4375
|
-
//
|
|
4376
|
-
|
|
4377
|
-
// 位置是否已经确定。首帧一律 false → 浮窗虽然渲染但 visibility:hidden
|
|
4378
|
-
//
|
|
4379
|
-
//
|
|
4380
|
-
//
|
|
4381
|
-
// 另一个 slot,可能晚于余额行),就仍然要先画一次兜底值。所以真正的修法是
|
|
4382
|
-
// **在知道位置之前根本不显示它** —— 闪动是"看见两个位置",不给看就没有。
|
|
4634
|
+
// 2026-11-02 第十一轮第八版:「还有这个 显示在左下角 左边和底边距离边框一致」。
|
|
4635
|
+
// 收起态浮窗**不再**量 composer 去对齐它的底边 —— 那套的代价是距视口底一百多像素、
|
|
4636
|
+
// 卡片悬在聊天区中间偏左。现在固定待在左下角,且**距左缘 = 距底边**:
|
|
4637
|
+
// 圆钮取 fabLeft、矩形卡取 rectLeft,左缘一改底边同步跟,两条缝永远一样宽。
|
|
4638
|
+
// 因为位置是纯常量推导(不再依赖 DOM),原来那个「量 composer 底边」的测量态整个删掉了。
|
|
4639
|
+
// 位置是否已经确定。首帧一律 false → 浮窗虽然渲染但 visibility:hidden
|
|
4640
|
+
// (2026-10-31:「为什么加载插件的时候 浮窗的位置会闪动」)。闪动的成因是首帧吃
|
|
4641
|
+
// SETTINGS_DEFAULTS、设置回来后位置又变一次;现在位置不再测量,门控主要是等设置。
|
|
4642
|
+
// 保留「测到锚点才 ready」的旧语义:测不到时由下面的 800ms 硬超时兜底显形。
|
|
4383
4643
|
const [fabReady, setFabReady] = react.useState(false);
|
|
4384
4644
|
// ⚠️ 光等测量还不够(2026-10-31「这个 bug 还在」)。
|
|
4385
4645
|
// fabSize / fabLeft / footerStyle 全部来自 /balance-api?config=1,首帧用的是
|
|
@@ -4427,34 +4687,32 @@ function makeTodayFlowStyle() {
|
|
|
4427
4687
|
// 之前几版都在猜 DSH 的 DOM:
|
|
4428
4688
|
// · conversation.composer.bar → 实测挂的是**整个输入区容器**(高 700px+),
|
|
4429
4689
|
// 用它算出来的位置要么把浮窗顶到聊天区中间,要么推出视口。
|
|
4430
|
-
// · conversation.composer.dock →
|
|
4431
|
-
//
|
|
4690
|
+
// · conversation.composer.dock → 出口容器是 display:contents(rect 全 0),
|
|
4691
|
+
// 守卫直接 return,浮窗默默退回 CSS 兜底 —— 表现就是"改了跟没改一样"。
|
|
4432
4692
|
// 所以主锚点换成**插件自己的消耗行**(.balance-usage-line):它一定挂在 dock 行里、
|
|
4433
4693
|
// 一定在输入卡片正下方,而且是我们自己的类名,不依赖 DSH 内部属性。
|
|
4434
4694
|
// 没开消耗行显示时才退到 dock slot,两者都没有就退回 CSS 兜底。
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4695
|
+
// ⚠️ 2026-11-02 第十轮:锚点**不能再取 .balance-usage-line** ——
|
|
4696
|
+
// 消耗行已经搬进右下角小浮窗(position:fixed),它不在 dock 行里了:
|
|
4697
|
+
// 拿它测出来的 top 是浮窗的顶边(比输入卡片高出一大截),浮窗会被顶到聊天区中间,
|
|
4698
|
+
// 而且遮挡判定会拿 FAB 去跟那块固定卡片比,结果不可预测。
|
|
4699
|
+
// 现在取「浮窗包裹层的父节点」= composer dock 那一行本身(包裹层自己被压成 0×0,
|
|
4700
|
+
// 但它在布局里、父节点就是那一行,几何与原来的 pill 同一行)。
|
|
4701
|
+
// 依次退:dock slot 的 data-slot → 都没有就交给 CSS 兜底。
|
|
4702
|
+
const floatWrap = document.querySelector(".balance-usage-wrap--float");
|
|
4703
|
+
// 同一个坑:包裹层的父节点是 display:contents 的出口容器(rect 全 0),
|
|
4704
|
+
// 拿它做遮挡判定等于永远不相交 —— 必须resolve 到真正的 dock 行。
|
|
4705
|
+
const anchorEl = resolveComposerDockRow(floatWrap);
|
|
4438
4706
|
if (fab === null || anchorEl === null) {
|
|
4439
4707
|
setFabCovered(false);
|
|
4440
4708
|
return;
|
|
4441
4709
|
}
|
|
4442
4710
|
const f = fab.getBoundingClientRect();
|
|
4443
4711
|
const d = anchorEl.getBoundingClientRect();
|
|
4444
|
-
|
|
4445
|
-
//
|
|
4446
|
-
|
|
4447
|
-
//
|
|
4448
|
-
// 一旦算出接近视口高度就说明拿到的不是那一行,宁可不设、退回 CSS 兜底。
|
|
4449
|
-
// ⚠️ 带 1px 死区:锚点的 sub-pixel 位置每帧可能抖动,round 之后就是 ±1px。
|
|
4450
|
-
// 每 400ms 为这 1px 重新 setState 一次,表现就是浮窗在轻微上下抖。
|
|
4451
|
-
const nextBottom = rawBottom + 140 <= vh ? Math.max(8, rawBottom) : null;
|
|
4452
|
-
setFabBottom((prev) => {
|
|
4453
|
-
if (nextBottom === null || prev === null) return nextBottom;
|
|
4454
|
-
return Math.abs(nextBottom - prev) <= 1 ? prev : nextBottom;
|
|
4455
|
-
});
|
|
4456
|
-
// 位置已定 → 允许显形。测不到锚点时**不要**置 ready,
|
|
4457
|
-
// 让浮窗维持不可见,由下面的 800ms 兜底负责"实在测不到也不能永远不显示"。
|
|
4712
|
+
// 位置不再测量(左下角等距,见渲染处的 fabStyle / rectStyle)——
|
|
4713
|
+
// 这个 effect 现在只负责「显形门控」与「遮挡判定」两件事。
|
|
4714
|
+
// 测不到锚点时**不要**置 ready,让浮窗维持不可见,
|
|
4715
|
+
// 由下面的 800ms 兜底负责"实在测不到也不能永远不显示"。
|
|
4458
4716
|
setFabReady(true);
|
|
4459
4717
|
if (f.width === 0 || f.height === 0) {
|
|
4460
4718
|
setFabCovered(false);
|
|
@@ -4463,10 +4721,23 @@ function makeTodayFlowStyle() {
|
|
|
4463
4721
|
// 遮挡判定 = 浮窗和锚点**真正相交**,不再只比 x 区间。
|
|
4464
4722
|
// 原注释写「它和输入卡片同宽」,但锚点早就换成我们自己的窄 pill(.balance-usage-line),
|
|
4465
4723
|
// 拿一句失效的假设去判几何迟早出事(2026-10-31 全量审查)。
|
|
4466
|
-
//
|
|
4467
|
-
//
|
|
4724
|
+
// ⚠️ 2026-11-02 第十轮:pill 搬去右下角浮窗之后,这里的锚点变成 dock 行本身,
|
|
4725
|
+
// 而圆钮的 bottom 就是按「dock 行顶边 + 8px」算的 —— 它必然与行顶叠 8px。
|
|
4726
|
+
// 原来那个 +4px 的 Y 判据于是恒为真,圆钮会被判成「被压住」直接不渲染。
|
|
4727
|
+
// 所以 Y 判据放到 +12px:只有真的压进去超过设计的那 8px 才算遮挡。
|
|
4728
|
+
// (浮窗卡片那块另算:它挂在右下角,圆钮挪到那一侧时照样该让位 —— 见下面的 probe。)
|
|
4729
|
+
const floatEl = document.querySelector(".balance-float");
|
|
4730
|
+
const floatRect = floatEl !== null && typeof floatEl.getBoundingClientRect === "function"
|
|
4731
|
+
? floatEl.getBoundingClientRect()
|
|
4732
|
+
: null;
|
|
4733
|
+
if (floatRect !== null && floatRect.width > 0 && floatRect.height > 0) {
|
|
4734
|
+
const overlapX = f.right > floatRect.left + 4 && f.left < floatRect.right - 4;
|
|
4735
|
+
const overlapY = f.bottom > floatRect.top + 4 && f.top < floatRect.bottom - 4;
|
|
4736
|
+
setFabCovered(overlapX && overlapY);
|
|
4737
|
+
return;
|
|
4738
|
+
}
|
|
4468
4739
|
const overlapX = f.right > d.left + 4 && f.left < d.right - 4;
|
|
4469
|
-
const overlapY = f.bottom > d.top +
|
|
4740
|
+
const overlapY = f.bottom > d.top + 12 && f.top < d.bottom - 4;
|
|
4470
4741
|
setFabCovered(overlapX && overlapY);
|
|
4471
4742
|
};
|
|
4472
4743
|
measure();
|
|
@@ -4491,7 +4762,7 @@ function makeTodayFlowStyle() {
|
|
|
4491
4762
|
clearInterval(timer);
|
|
4492
4763
|
clearTimeout(fallback);
|
|
4493
4764
|
};
|
|
4494
|
-
// ⚠️ 依赖里**不能**放 fabCovered /
|
|
4765
|
+
// ⚠️ 依赖里**不能**放 fabCovered / fabReady:它们的 setState 会重跑本
|
|
4495
4766
|
// effect、重建定时器,变成"测一次→重建→再测一次"的抖动循环。同值写入本来就会被
|
|
4496
4767
|
// React 跳过。
|
|
4497
4768
|
}, [wide, fabSize, fabLeft, settings.footerStyle]);
|
|
@@ -4508,13 +4779,14 @@ function makeTodayFlowStyle() {
|
|
|
4508
4779
|
if (state.status === "error" || !state.balance) return null;
|
|
4509
4780
|
const b = state.balance;
|
|
4510
4781
|
// 尺寸 / 水平位置由设置决定,用内联样式覆盖 CSS 默认值(CSS 保留 60px/44px 兜底)。
|
|
4511
|
-
// bottom
|
|
4782
|
+
// bottom = 左边距 → 「左边和底边距离边框一致」(CSS 兜底 bottom:44px 与 left:44px 同值)。
|
|
4512
4783
|
const fabStyle = {
|
|
4513
4784
|
width: fabSize + "px",
|
|
4514
4785
|
height: fabSize + "px",
|
|
4515
4786
|
left: fabLeft + "px",
|
|
4516
4787
|
};
|
|
4517
|
-
|
|
4788
|
+
// 左下角等距:底边距 = 距左缘(矩形卡的左缘是 rectLeft,见下)
|
|
4789
|
+
fabStyle.bottom = fabLeft + "px";
|
|
4518
4790
|
// 位置未定之前不可见(见上面 fabVisible 的说明)。visibility 而不是 display:none ——
|
|
4519
4791
|
// 后者会让元素没有盒子、getBoundingClientRect 全 0,遮挡判断就永远测不出来。
|
|
4520
4792
|
if (!fabVisible) fabStyle.visibility = "hidden";
|
|
@@ -4549,7 +4821,7 @@ function makeTodayFlowStyle() {
|
|
|
4549
4821
|
// 于是收起态两边都是空的,整个插件看起来消失了。
|
|
4550
4822
|
// slots.register 对不存在的 slot 名是**静默失败**(不抛错、不报警),所以
|
|
4551
4823
|
// 不能靠"注册没报错"判断它可用。
|
|
4552
|
-
// 现在只留浮层(
|
|
4824
|
+
// 现在只留浮层(2026-11-02 起挪到左下角、距左缘 = 距底边)。原来还并着一条
|
|
4553
4825
|
// composer.bar 文本行,那个 slot 从未渲染成功,已随 2026-10-31 死代码清理删除。
|
|
4554
4826
|
// 宽度独立于圆钮尺寸:圆钮 60px 装四行内容字会被挤到 9px(2026-10-31 用户:
|
|
4555
4827
|
// 「太小了吧」)。收起态侧栏约 56px,但 FAB 是 position:fixed 浮层,
|
|
@@ -4565,9 +4837,10 @@ function makeTodayFlowStyle() {
|
|
|
4565
4837
|
// 按中心对齐后加宽是左右对称扩张,卡片看上去定在原地。
|
|
4566
4838
|
const rectLeft = Math.max(4, Math.round(fabLeft + fabSize / 2 - rectW / 2));
|
|
4567
4839
|
const rectStyle = { width: rectW + "px", left: rectLeft + "px" };
|
|
4568
|
-
//
|
|
4569
|
-
//
|
|
4570
|
-
|
|
4840
|
+
// 左下角等距:矩形卡比圆钮宽,左缘被 rectLeft 顶到更左边,底边就用 rectLeft ——
|
|
4841
|
+
// 视觉上左、底两条缝一样宽。两条分支各自带 bottom,否则只有圆钮贴角、
|
|
4842
|
+
// 矩形卡还挂在 CSS 的 44px 上(两种布局手感不一致)。
|
|
4843
|
+
rectStyle.bottom = rectLeft + "px";
|
|
4571
4844
|
// 同样要带可见性控制,否则矩形卡会先闪一下兜底位置(用户反馈的就是这种浮窗)
|
|
4572
4845
|
if (!fabVisible) rectStyle.visibility = "hidden";
|
|
4573
4846
|
// ⚠️ 余额**只用数字**,绝不用展开态的 `rollCells`:那个基于 `totalText`
|
|
@@ -4709,7 +4982,7 @@ function makeTodayFlowStyle() {
|
|
|
4709
4982
|
}
|
|
4710
4983
|
// 两种情况都经 withPanel:收起态的定位落在它渲染的 .balance-stats-anchor--compact
|
|
4711
4984
|
// 上(那个 div 只做 Tooltip 挂载点、position:static,真正的 fixed 定位在 .balance-fab
|
|
4712
|
-
// 自己身上,bottom
|
|
4985
|
+
// 自己身上,bottom 由渲染处按左边距内联注入)。
|
|
4713
4986
|
const fab = depleted
|
|
4714
4987
|
? withPanel(jsx.jsx("a", {
|
|
4715
4988
|
className: "balance-fab balance-fab-dark",
|
|
@@ -5159,6 +5432,169 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
5159
5432
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5160
5433
|
}, [detailsOpen]);
|
|
5161
5434
|
|
|
5435
|
+
// ── 右下角小浮窗的定位(2026-11-02 第十轮起,第十一轮三次调整定形)──
|
|
5436
|
+
// 用户要的最终位置:**右下角、底边与聊天框(输入卡片)底边齐平、中间留一点空隙**。
|
|
5437
|
+
// 位置不写死:量 DOM 的矩形。水平 = 聊天列右缘 + 4px,竖直 = 输入卡片底边 - 6px,
|
|
5438
|
+
// 侧栏折叠 / 窗口缩放 / 输入框变高都跟着走。量不到就退回 CSS 的 right:16px;bottom:16px。
|
|
5439
|
+
// ⚠️ dock 行自己只是**兜底**(老版本 DSH 找不到 [data-composer-card] 时):它插在输入卡片
|
|
5440
|
+
// **正下方**,用它当唯一锚点会把卡片顶在输入框右下角。这里往上取一层(dock 的父节点 = 卡片那一列),
|
|
5441
|
+
// 但只在父节点尺寸合理时采用 —— DSH 有些版本里父节点是整个 700px 高的输入区容器,
|
|
5442
|
+
// 那会把卡片顶到聊天区中间(2026-10-31 在收起态浮窗上就踩过这个坑)。
|
|
5443
|
+
// ⚠️ 一秒一次的量法:getBoundingClientRect 会强制 layout,看不见的时候直接跳过
|
|
5444
|
+
// (与 BalanceFooter 的可见性探测同一条纪律)。
|
|
5445
|
+
const [floatBox, setFloatBox] = react.useState(null);
|
|
5446
|
+
react.useEffect(() => {
|
|
5447
|
+
if (typeof document === "undefined" || typeof document.querySelector !== "function") return undefined;
|
|
5448
|
+
let disposed = false;
|
|
5449
|
+
const measure = () => {
|
|
5450
|
+
if (disposed) return;
|
|
5451
|
+
const wrap = document.querySelector(".balance-usage-wrap--float");
|
|
5452
|
+
// ⚠️ 必须拿**真元素**:前面几版查的是 [data-slot="conversation.composer.dock"],
|
|
5453
|
+
// 那是 display:contents 的出口容器 → rect 全 0 → 被下面的守卫直接 return 掉,
|
|
5454
|
+
// 于是这套定位从来没生效过,卡片一直停在 CSS 兜底的 16/16(见 resolveComposerDockRow 的注释)。
|
|
5455
|
+
const dock = resolveComposerDockRow(wrap);
|
|
5456
|
+
if (dock === null || typeof dock.getBoundingClientRect !== "function") return;
|
|
5457
|
+
const dockRect = dock.getBoundingClientRect();
|
|
5458
|
+
if (!dockRect || dockRect.width === 0 || dockRect.height === 0) return;
|
|
5459
|
+
// 往上取一层(卡片那一列),只在高度合理且确实在 dock 上方时才用
|
|
5460
|
+
let box = dockRect;
|
|
5461
|
+
const outer = dock.parentElement;
|
|
5462
|
+
if (outer !== null && typeof outer.getBoundingClientRect === "function") {
|
|
5463
|
+
const outerRect = outer.getBoundingClientRect();
|
|
5464
|
+
if (outerRect.width > 0 && outerRect.height > 0
|
|
5465
|
+
&& outerRect.height <= 420 && outerRect.top < dockRect.top) {
|
|
5466
|
+
box = outerRect;
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
const vw = window.innerWidth || 0;
|
|
5470
|
+
const vh = window.innerHeight || 0;
|
|
5471
|
+
if (vw === 0 || vh === 0) return;
|
|
5472
|
+
// 量到的矩形必须在视口里(切视图时 slot 可能还在、但整块被挪到视口外)
|
|
5473
|
+
if (box.top <= 0 || box.top >= vh) return;
|
|
5474
|
+
const FLOAT_EDGE_GAP = 6;
|
|
5475
|
+
const FLOAT_SIDE_GAP = 16;
|
|
5476
|
+
// 聊天框(输入卡片)本身:横向贴它的右缘、纵向贴它的底边,两个方向都锚这一个元素。
|
|
5477
|
+
// ⚠️ 2026-11-02 第十二轮:「始终显示 防止高分辨率全屏导致小浮窗很靠右」——
|
|
5478
|
+
// 原来横向锚的是聊天列(box.right = 整条输入区的右缘)。列宽跟着窗口长,而输入卡片有
|
|
5479
|
+
// max-width 居中:4K / 全屏时卡片还是中间那一条、列却铺到大半屏,卡片就被甩到离输入框
|
|
5480
|
+
// 几百像素的屏幕最右边(用户截图:1920 宽下卡片在 x1808,输入框右缘才 1573)。
|
|
5481
|
+
// 现在锚**输入卡片自己的右缘 + FLOAT_SIDE_GAP**,窗口再宽也跟输入框走。
|
|
5482
|
+
let cardRect = null;
|
|
5483
|
+
if (typeof document.querySelector === "function") {
|
|
5484
|
+
const composerCard = document.querySelector("[data-composer-card]");
|
|
5485
|
+
if (composerCard !== null && typeof composerCard.getBoundingClientRect === "function") {
|
|
5486
|
+
const rect = composerCard.getBoundingClientRect();
|
|
5487
|
+
if (rect.width > 0 && rect.height > 0 && rect.right > 8 && rect.right <= vw) cardRect = rect;
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
// 浮窗自己的宽度(fixed 定位,包裹层被压成 0×0 不影响卡片自己的矩形)
|
|
5491
|
+
let floatW = 0;
|
|
5492
|
+
if (wrap !== null && typeof wrap.querySelector === "function") {
|
|
5493
|
+
const selfEl = wrap.querySelector(".balance-float");
|
|
5494
|
+
if (selfEl !== null && typeof selfEl.getBoundingClientRect === "function") {
|
|
5495
|
+
const selfRect = selfEl.getBoundingClientRect();
|
|
5496
|
+
if (selfRect.width > 0) floatW = selfRect.width;
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
if (floatW <= 0) floatW = 101; // 兜底:标签 77 + 左右 padding 24
|
|
5500
|
+
// 横向:卡片**左缘**落在「输入卡片右缘 + 16px」,所以 right 要减去自己的宽度。
|
|
5501
|
+
// 老版本没有 data-composer-card 才退回聊天列右缘 + 4px(第十二轮之前的行为)。
|
|
5502
|
+
const right = cardRect !== null
|
|
5503
|
+
? Math.max(8, Math.round(vw - (cardRect.right + FLOAT_SIDE_GAP + floatW)))
|
|
5504
|
+
: Math.max(8, Math.round(vw - box.right + 4));
|
|
5505
|
+
// 2026-11-02 第十一轮第十一版:「还是跟聊天框底部齐平吧 留点空隙」。
|
|
5506
|
+
// 竖直方向锚 **聊天框自己的底边**:DSH 输入卡片的根节点带 data-composer-card(.card),
|
|
5507
|
+
// dock 行是它的**兄弟**、在它下方,所以拿卡片底边比拿 dock 的 top 更贴用户说的"底部"。
|
|
5508
|
+
// 再往上让 FLOAT_EDGE_GAP 的空隙,看起来齐平但不会贴死。
|
|
5509
|
+
// 历史两版都不许回去:锚整列顶边 → 卡片跑到右上角;底边距 = 右边距 → 掉到窗口最底。
|
|
5510
|
+
let anchorBottom = null;
|
|
5511
|
+
if (cardRect !== null && cardRect.bottom > 8 && cardRect.bottom <= vh) anchorBottom = cardRect.bottom;
|
|
5512
|
+
// 老版本 DSH 没有 data-composer-card:退回 dock 行顶边,同样留空隙
|
|
5513
|
+
if (anchorBottom === null) anchorBottom = dockRect.top;
|
|
5514
|
+
const bottom = Math.max(8, Math.round(vh - anchorBottom + FLOAT_EDGE_GAP));
|
|
5515
|
+
setFloatBox((prev) => (prev !== null && prev.right === right && prev.bottom === bottom
|
|
5516
|
+
? prev
|
|
5517
|
+
: { right, bottom }));
|
|
5518
|
+
};
|
|
5519
|
+
measure();
|
|
5520
|
+
// ── 触发源(2026-11-02 第十三轮:「点击窗口最大化和恢复时 小浮窗位置会异常跳动一下」)──
|
|
5521
|
+
// 根因:resize 事件到的这一拍,DSH 自己的输入卡片**还没重排**(它的宽度来自响应式的 CSS 变量
|
|
5522
|
+
// + 居中 max-width,要等它下一次 render 才落定),于是量到的是中间态;原来下一拍得等 1 秒的
|
|
5523
|
+
// 定时器,屏幕上就是「先跳到中间位置、过一会儿再弹回来」。截图实测:中间态 right=313、
|
|
5524
|
+
// 正确值 237,差的 76px 恰好是输入卡片当时的宽度差。
|
|
5525
|
+
// 现在三路触发:① resize 立刻量(兜住 vw 变化);② 之后 0/60/180/400ms 各补一拍收尾;
|
|
5526
|
+
// ③ ResizeObserver 盯住输入卡片 / dock 行 / 卡片自身 —— 它的回调在 layout 之后、paint 之前,
|
|
5527
|
+
// 布局一落定就**当帧**量对,中间态不会留在屏幕上。
|
|
5528
|
+
const settleTimers = [];
|
|
5529
|
+
const clearSettle = () => {
|
|
5530
|
+
while (settleTimers.length > 0) clearTimeout(settleTimers.pop());
|
|
5531
|
+
};
|
|
5532
|
+
const scheduleSettle = () => {
|
|
5533
|
+
clearSettle();
|
|
5534
|
+
for (const delay of [0, 60, 180, 400]) {
|
|
5535
|
+
settleTimers.push(setTimeout(() => {
|
|
5536
|
+
if (!disposed) measure();
|
|
5537
|
+
}, delay));
|
|
5538
|
+
}
|
|
5539
|
+
};
|
|
5540
|
+
let resizeObserver = null;
|
|
5541
|
+
const observed = new Set();
|
|
5542
|
+
const syncObservers = () => {
|
|
5543
|
+
if (typeof ResizeObserver !== "function") return;
|
|
5544
|
+
if (resizeObserver === null) {
|
|
5545
|
+
try {
|
|
5546
|
+
resizeObserver = new ResizeObserver(() => {
|
|
5547
|
+
if (!disposed) measure();
|
|
5548
|
+
});
|
|
5549
|
+
} catch {
|
|
5550
|
+
resizeObserver = null;
|
|
5551
|
+
return;
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
const targets = [];
|
|
5555
|
+
const floatWrap = document.querySelector(".balance-usage-wrap--float");
|
|
5556
|
+
const composerCard = document.querySelector("[data-composer-card]");
|
|
5557
|
+
if (composerCard !== null) targets.push(composerCard);
|
|
5558
|
+
const dockRow = resolveComposerDockRow(floatWrap);
|
|
5559
|
+
if (dockRow !== null) targets.push(dockRow);
|
|
5560
|
+
if (floatWrap !== null && typeof floatWrap.querySelector === "function") {
|
|
5561
|
+
const selfEl = floatWrap.querySelector(".balance-float");
|
|
5562
|
+
if (selfEl !== null) targets.push(selfEl);
|
|
5563
|
+
}
|
|
5564
|
+
for (const el of targets) {
|
|
5565
|
+
if (observed.has(el)) continue;
|
|
5566
|
+
try {
|
|
5567
|
+
resizeObserver.observe(el);
|
|
5568
|
+
observed.add(el);
|
|
5569
|
+
} catch { /* 观察不了就只靠上面两路 */ }
|
|
5570
|
+
}
|
|
5571
|
+
};
|
|
5572
|
+
syncObservers();
|
|
5573
|
+
const onResize = () => {
|
|
5574
|
+
measure();
|
|
5575
|
+
scheduleSettle();
|
|
5576
|
+
};
|
|
5577
|
+
const timer = setInterval(() => {
|
|
5578
|
+
if (typeof document.visibilityState === "string" && document.visibilityState !== "visible") return;
|
|
5579
|
+
// 视图切换后输入卡片可能被重建:每秒顺手补挂一次观察
|
|
5580
|
+
syncObservers();
|
|
5581
|
+
measure();
|
|
5582
|
+
}, 1000);
|
|
5583
|
+
window.addEventListener("resize", onResize);
|
|
5584
|
+
return () => {
|
|
5585
|
+
disposed = true;
|
|
5586
|
+
clearInterval(timer);
|
|
5587
|
+
clearSettle();
|
|
5588
|
+
window.removeEventListener("resize", onResize);
|
|
5589
|
+
if (resizeObserver !== null) {
|
|
5590
|
+
try {
|
|
5591
|
+
resizeObserver.disconnect();
|
|
5592
|
+
} catch { /* 忽略 */ }
|
|
5593
|
+
resizeObserver = null;
|
|
5594
|
+
}
|
|
5595
|
+
};
|
|
5596
|
+
}, []);
|
|
5597
|
+
|
|
5162
5598
|
// 会话 token 总量(未缓存输入 + 缓存读/写 + 输出);为 0 时代表还没有消耗。
|
|
5163
5599
|
const usageKey = usage
|
|
5164
5600
|
? (usage.uncachedInputTokens ?? 0) + (usage.cacheReadTokens ?? 0) + (usage.cacheWriteTokens ?? 0) + (usage.outputTokens ?? 0)
|
|
@@ -5397,6 +5833,10 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
5397
5833
|
// 已问过 → 600ms debounce(流式期间每次 usageKey 变化都会重跑本 effect 并清掉这个
|
|
5398
5834
|
// timer,所以一个包都不会发,等输出停下来才问一次)。
|
|
5399
5835
|
// 首挂载 → SESSION_USAGE_DELAY_MS,只留够画首帧。
|
|
5836
|
+
// 2026-11-02 第九轮:首挂载这一拍还要**等插件加载动画走完**(afterLoadAnim)——
|
|
5837
|
+
// 用户在同一个闸门后面等齐三件事:「插件加载完后 后面的动画一起运行 包括计算消耗」。
|
|
5838
|
+
// 闸门没开时等待值就是闸门剩余时间;闸门开过之后这里原样返回 SESSION_USAGE_DELAY_MS(240),
|
|
5839
|
+
// 后续切对话的节奏一点不变。
|
|
5400
5840
|
timer = setTimeout(() => {
|
|
5401
5841
|
if (disposed) return;
|
|
5402
5842
|
// 起飞前再掐一次:等这 240ms/600ms 的间隙里用户可能又切走了。
|
|
@@ -5542,7 +5982,7 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
5542
5982
|
: { ...prev, [sessionId]: { usage: null, subagentUsage: null, team: null } }));
|
|
5543
5983
|
});
|
|
5544
5984
|
fetchBalanceData().catch(() => {});
|
|
5545
|
-
}, pendingRetry ? SESSION_USAGE_DELAY_MS : asked ? 600 : SESSION_USAGE_DELAY_MS);
|
|
5985
|
+
}, afterLoadAnim(pendingRetry ? SESSION_USAGE_DELAY_MS : asked ? 600 : SESSION_USAGE_DELAY_MS));
|
|
5546
5986
|
};
|
|
5547
5987
|
if (asked) {
|
|
5548
5988
|
fire();
|
|
@@ -5792,9 +6232,11 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
5792
6232
|
// skipCostRoll:切会话/待算/无 usage 时把基准清空,这样下次出现是「首次显示」而不是「从某个值滚过来」。
|
|
5793
6233
|
// 加载动效风格:决定等待时显示什么、数据到手怎么进场(两种语言不混用)
|
|
5794
6234
|
const loadingIsText = settings.usageLoadingStyle === "text";
|
|
5795
|
-
// ⚠️
|
|
5796
|
-
//
|
|
5797
|
-
//
|
|
6235
|
+
// ⚠️ 2026-11-02 定案:`costPending` **参与** skipCostRoll。代价和收益一起记下来,别反复横跳:
|
|
6236
|
+
// · 收益:待算期间不拿「增量投影」当滚动起点 —— 不会出现压在迷雾底下的半截滚动,
|
|
6237
|
+
// 也不会每来一帧投影就翻一次数;
|
|
6238
|
+
// · 代价:服务端精确值到达、把投影顶掉的那一下按「首次显示」处理(走开窗揭幕,
|
|
6239
|
+
// 而不是从投影值滚过去)。这是这套闸门接受的取舍。
|
|
5798
6240
|
// `!costResolved` 也要丢:占位 `—` 不是数字,拿它当滚动起点会拼出「空格子 + 小数点」那种
|
|
5799
6241
|
// 半截结构(用户 2026-11-02 看到过一瞬间 `_._`)。占位单独静态渲染,见下面两处 body。
|
|
5800
6242
|
const skipCostRoll = staleUsage || !usage || showCostLoading || costPending || !costResolved;
|
|
@@ -6010,136 +6452,145 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
6010
6452
|
// 图标与 DSH 那颗保持一致(都用 IconDatabaseOutlineRegular)——换别的图标会「不搭配」
|
|
6011
6453
|
// (2026-09-28 反馈「图标换了 不搭配」,仪表版被否掉)。
|
|
6012
6454
|
// 图标缺失(DSH 改 API)时不渲染,文字照常显示,不影响点击。
|
|
6455
|
+
// ⚠️ 2026-11-02 第十一轮:图标不画了。用户要的是「第一列字样、第二列数字」两列,
|
|
6456
|
+
// 图标会变成第三列、还把卡片撑宽(他这轮的诉求就是「调小一点 太大了」)。
|
|
6457
|
+
// 图标本身没删,侧栏/统计面板/圆钮还在用同一颗 IconDatabaseOutlineRegular。
|
|
6013
6458
|
const children = [
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
children: ["团队 ", String(teamCount)],
|
|
6027
|
-
})
|
|
6028
|
-
: null,
|
|
6029
|
-
jsx.jsx("span", {
|
|
6030
|
-
key: "cost",
|
|
6031
|
-
className: "balance-usage-cost" + (showCostLoading ? " balance-usage-cost--pending" : ""),
|
|
6032
|
-
// 两种加载动效二选一(usageLoadingStyle),**两套语言不混用**:
|
|
6033
|
-
// "wipe"(默认):等待时一团白色迷雾在原地呼吸 → 数据到手「炸开」显示数字
|
|
6034
|
-
// (2026-10-31 用户:「加载的时候是一团白色迷雾 然后像爆炸一样显示出来」)。
|
|
6035
|
-
// "text":等待时显示带呼吸的「计算中…」胶囊 → 数据到手**直接渐入**,不放光不放雾
|
|
6036
|
-
// (2026-10-30 用户:「用的如果是计算中就不要用光条动画了 计算完直接渐入就行了」)。
|
|
6037
|
-
// 两种都只在等待期间出现,都不亮错误值。
|
|
6038
|
-
// ⚠️ 样式1 的等待态和揭幕态现在是**同一棵树**(2026-10-31 第十八轮:
|
|
6039
|
-
// 「不重播的意思是开始展开的时候 没有被触及到的区域继续播放动画 而不是重头开始播放」)。
|
|
6040
|
-
// 原来等待态渲染 .balance-usage-mist、揭幕态另起一棵 .balance-usage-reveal__mist,
|
|
6041
|
-
// 数字一到手就是**换节点**,里面 5 团光球的 CSS 动画全部从 0 秒重跑 ——
|
|
6042
|
-
// 于是开窗那一刻,没被扫到的区域里那团光会"跳回去重新流"。
|
|
6043
|
-
// 现在容器只有一棵:__mist 常驻(等待态靠 --wait 把洞钉在 0%,也就是整块可见),
|
|
6044
|
-
// 出数时只多挂一个 __body,光球节点的身份不变、相位一路接着走。
|
|
6045
|
-
children: loadingIsText
|
|
6046
|
-
? (showCostLoading
|
|
6459
|
+
jsx.jsx("span", { key: "label", className: "balance-usage-label balance-float__label", children: "本会话消耗估算" }),
|
|
6460
|
+
// 两行布局(2026-11-02 第十一轮第四版:用户「说错了 是两行 不是两列 上面显示文本 下面显示数字」):
|
|
6461
|
+
// 数字那一行 = 团队圆片 + 金额,必须包成**一行** —— flex-direction:column 会把直接子节点
|
|
6462
|
+
// 各拆一行,不包的话圆片和金额竖成两行、卡片变三行。
|
|
6463
|
+
jsx.jsxs("span", {
|
|
6464
|
+
key: "value",
|
|
6465
|
+
className: "balance-float__value-row",
|
|
6466
|
+
children: [
|
|
6467
|
+
// 智能体团队(Agent Teams):有 teammate 时挂一个小圆片,说明这颗数字是
|
|
6468
|
+
// 「本会话 + 团队 N 人」的合计(每人明细在点开的浮层里按人头列出)。
|
|
6469
|
+
// 没有团队时整个节点不渲染,一行还是原来的样子。
|
|
6470
|
+
teamCount > 0
|
|
6047
6471
|
? jsx.jsxs("span", {
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
// 三个点拆开逐个闪:单个 "…" 是一个字,没法分段动
|
|
6053
|
-
jsx.jsx("span", {
|
|
6054
|
-
className: "balance-usage-calc__dots",
|
|
6055
|
-
"aria-hidden": "true",
|
|
6056
|
-
children: [0, 1, 2].map((i) => jsx.jsx("span", { className: "balance-usage-calc__dot", children: "." }, i)),
|
|
6057
|
-
}, "dots"),
|
|
6058
|
-
],
|
|
6472
|
+
key: "team",
|
|
6473
|
+
className: "balance-usage-team",
|
|
6474
|
+
title: "含 " + teamCount + " 个团队成员(智能体团队)的消耗",
|
|
6475
|
+
children: ["团队 ", String(teamCount)],
|
|
6059
6476
|
})
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6477
|
+
: null,
|
|
6478
|
+
jsx.jsx("span", {
|
|
6479
|
+
key: "cost",
|
|
6480
|
+
className: "balance-usage-cost" + (showCostLoading ? " balance-usage-cost--pending" : ""),
|
|
6481
|
+
// 两种加载动效二选一(usageLoadingStyle),**两套语言不混用**:
|
|
6482
|
+
// "wipe"(默认):等待时一团白色迷雾在原地呼吸 → 数据到手「炸开」显示数字
|
|
6483
|
+
// (2026-10-31 用户:「加载的时候是一团白色迷雾 然后像爆炸一样显示出来」)。
|
|
6484
|
+
// "text":等待时显示带呼吸的「计算中…」胶囊 → 数据到手**直接渐入**,不放光不放雾
|
|
6485
|
+
// (2026-10-30 用户:「用的如果是计算中就不要用光条动画了 计算完直接渐入就行了」)。
|
|
6486
|
+
// 两种都只在等待期间出现,都不亮错误值。
|
|
6487
|
+
// ⚠️ 样式1 的等待态和揭幕态现在是**同一棵树**(2026-10-31 第十八轮:
|
|
6488
|
+
// 「不重播的意思是开始展开的时候 没有被触及到的区域继续播放动画 而不是重头开始播放」)。
|
|
6489
|
+
// 原来等待态渲染 .balance-usage-mist、揭幕态另起一棵 .balance-usage-reveal__mist,
|
|
6490
|
+
// 数字一到手就是**换节点**,里面 5 团光球的 CSS 动画全部从 0 秒重跑 ——
|
|
6491
|
+
// 于是开窗那一刻,没被扫到的区域里那团光会"跳回去重新流"。
|
|
6492
|
+
// 现在容器只有一棵:__mist 常驻(等待态靠 --wait 把洞钉在 0%,也就是整块可见),
|
|
6493
|
+
// 出数时只多挂一个 __body,光球节点的身份不变、相位一路接着走。
|
|
6494
|
+
children: loadingIsText
|
|
6495
|
+
? (showCostLoading
|
|
6496
|
+
? jsx.jsxs("span", {
|
|
6497
|
+
className: "balance-usage-calc",
|
|
6498
|
+
key: "calc-" + (sessionId || ""),
|
|
6499
|
+
children: [
|
|
6500
|
+
"计算中",
|
|
6501
|
+
// 三个点拆开逐个闪:单个 "…" 是一个字,没法分段动
|
|
6502
|
+
jsx.jsx("span", {
|
|
6503
|
+
className: "balance-usage-calc__dots",
|
|
6504
|
+
"aria-hidden": "true",
|
|
6505
|
+
children: [0, 1, 2].map((i) => jsx.jsx("span", { className: "balance-usage-calc__dot", children: "." }, i)),
|
|
6506
|
+
}, "dots"),
|
|
6507
|
+
],
|
|
6508
|
+
})
|
|
6509
|
+
// 样式2(计算中):就是一层淡入,没有开窗也没有光
|
|
6510
|
+
: jsx.jsx("span", {
|
|
6511
|
+
className: "balance-usage-fade",
|
|
6512
|
+
key: "fade-" + (sessionId || ""),
|
|
6513
|
+
children: jsx.jsxs("span", {
|
|
6514
|
+
className: "balance-usage-cost-inner",
|
|
6515
|
+
children: [
|
|
6516
|
+
// ⚠️ 2026-11-02 第十一轮:用户要求「然后就不要约等于了」——≈ 从消耗行里撤掉
|
|
6517
|
+
// (它以前是 2026-11-01「约等于还是加回去吧」加进来的,现在估算语义由标签
|
|
6518
|
+
// 「本会话消耗估算」承担,符号就不再重复一遍了)。
|
|
6519
|
+
jsx.jsx("span", { children: "¥" }, "cur"),
|
|
6520
|
+
// 静态也走逐字格:裸文本与 inline-block 逐字格的宽度/字距不等,
|
|
6521
|
+
// 来回切换会让整串左右挪一下(同今日金额,2026-10-31)。
|
|
6522
|
+
// 外层 key 恒定,只有变化的那一格换 key 重挂,否则滚动结束整串重挂会闪一下。
|
|
6523
|
+
// ⚠️ 占位 `—` 不进滚格子(理由见下面 reveal 分支同一处)。
|
|
6524
|
+
costResolved
|
|
6525
|
+
? jsx.jsx("span", {
|
|
6526
|
+
children: renderRollCells(
|
|
6527
|
+
costRoll === null ? buildRollCells(costText, costText) : buildRollCells(costRoll.from, costText),
|
|
6528
|
+
"u" + (costRoll === null ? "" : costRoll.at),
|
|
6529
|
+
// 播完就定格:摘掉 animation 声明,展开侧栏不再重播
|
|
6530
|
+
costRoll !== null && costRoll.done === true,
|
|
6531
|
+
// 快档:这一串是"订正"(本地投影 → 服务端逐时段分桶),不是出场秀
|
|
6532
|
+
true,
|
|
6533
|
+
),
|
|
6534
|
+
}, "txt")
|
|
6535
|
+
: jsx.jsx("span", { className: "balance-usage-dash", children: "—" }, "dash"),
|
|
6536
|
+
],
|
|
6537
|
+
}),
|
|
6538
|
+
}))
|
|
6539
|
+
: jsx.jsxs("span", {
|
|
6540
|
+
className: "balance-usage-reveal" + (costRevealOn ? " balance-usage-reveal--enter" : ""),
|
|
6541
|
+
key: "reveal-" + (sessionId || ""),
|
|
6066
6542
|
children: [
|
|
6067
|
-
//
|
|
6068
|
-
//
|
|
6069
|
-
//
|
|
6070
|
-
jsx.jsx("span", {
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
: jsx.
|
|
6543
|
+
// 底层:加载态那团光(一整条,不切),**等待态和揭幕态是同一个节点**。
|
|
6544
|
+
// mask 在正中间挖一个随开窗扩大的椭圆洞,数字从洞里显出来,光留在两侧。
|
|
6545
|
+
// 等待态挂 --wait 把洞钉在 0%(整块可见=加载动画),出数时摘掉它、挂 --enter 播开窗。
|
|
6546
|
+
jsx.jsx("span", {
|
|
6547
|
+
className: "balance-usage-reveal__mist"
|
|
6548
|
+
+ (showCostLoading ? " balance-usage-reveal__mist--wait" : ""),
|
|
6549
|
+
"aria-hidden": "true",
|
|
6550
|
+
children: jsx.jsx("span", {
|
|
6551
|
+
className: "balance-usage-mist",
|
|
6552
|
+
children: ORB_INDICES.map((i) => jsx.jsx("span", { key: "orb-" + i, className: "balance-usage-mist__orb" })),
|
|
6553
|
+
}),
|
|
6554
|
+
}, "mist"),
|
|
6555
|
+
// 上层:金额本体(≈ + ¥ + 数字),被 clip-path 从中缝向两侧打开 —— 「开窗」只发生在这一层。
|
|
6556
|
+
// 只在出数之后才存在 —— 等待期容器里只有光,宽度靠 .balance-usage-reveal 的 min-width 撑住。
|
|
6557
|
+
// ⚠️ ≈ 就在 __body **里面**(2026-11-01 用户最终定案:「约等于还是加回去吧 并且算到动画
|
|
6558
|
+
// 里去 没有约等于中间空了一块好奇怪」)。它跟着开窗一起显形,是这一层的一部分:
|
|
6559
|
+
// 单独拎出去当常显符号(上一版)会和雾叠着、看着像"符号长在动画上",整串去掉又让
|
|
6560
|
+
// 胶囊中间空一截。放回来之后内容 = ≈ ¥121.17,居中填满,视觉最自然。
|
|
6561
|
+
showCostLoading
|
|
6562
|
+
? null
|
|
6563
|
+
: jsx.jsxs("span", {
|
|
6564
|
+
className: "balance-usage-reveal__body",
|
|
6565
|
+
children: [
|
|
6566
|
+
// ⚠️ ≈ 已撤掉(2026-11-02 第十一轮:「然后就不要约等于了」)。
|
|
6567
|
+
// 原来的注释是「≈ 单独成节点:U+2248 在中文字体里落在数学符号的中线…
|
|
6568
|
+
// 串在一起会显得整个符号往下掉」—— 节点一起删了,那条排版顾虑也随之消失。
|
|
6569
|
+
// 「是估算」这件事现在由左列标签「本会话消耗估算」直说,不再靠符号暗示。
|
|
6570
|
+
jsx.jsx("span", { children: "¥" }, "cur"),
|
|
6571
|
+
// 只有数字参与逐位滚动:¥ 是定值,跟着滚会把整个符号一起翻。
|
|
6572
|
+
// 静态也走逐字格 + 外层 key 恒定,理由同上(宽度恒定、滚动结束不重挂)。
|
|
6573
|
+
// ⚠️ 占位 `—`(拿不到分桶、4 秒兜底之后)**不进滚格子**:它不是数字,
|
|
6574
|
+
// 滚格子会按「小数点对齐」拆出一个只有 `.` 的中间格,加上空位就是一串
|
|
6575
|
+
// 看着像 `_._` 的碎片(用户 2026-11-02 抓到过一瞬间)。占位直接静态文本。
|
|
6576
|
+
costResolved
|
|
6577
|
+
? jsx.jsx("span", {
|
|
6578
|
+
children: renderRollCells(
|
|
6579
|
+
costRoll === null ? buildRollCells(costText, costText) : buildRollCells(costRoll.from, costText),
|
|
6580
|
+
"u" + (costRoll === null ? "" : costRoll.at),
|
|
6581
|
+
// 播完就定格:摘掉 animation 声明,展开侧栏不再重播
|
|
6582
|
+
costRoll !== null && costRoll.done === true,
|
|
6583
|
+
// 快档:订正滚动(同上面那处)
|
|
6584
|
+
true,
|
|
6585
|
+
),
|
|
6586
|
+
}, "txt")
|
|
6587
|
+
: jsx.jsx("span", { className: "balance-usage-dash", children: "—" }, "dash"),
|
|
6588
|
+
],
|
|
6589
|
+
}, "body"),
|
|
6088
6590
|
],
|
|
6089
6591
|
}),
|
|
6090
|
-
}))
|
|
6091
|
-
: jsx.jsxs("span", {
|
|
6092
|
-
className: "balance-usage-reveal" + (costRevealOn ? " balance-usage-reveal--enter" : ""),
|
|
6093
|
-
key: "reveal-" + (sessionId || ""),
|
|
6094
|
-
children: [
|
|
6095
|
-
// 底层:加载态那团光(一整条,不切),**等待态和揭幕态是同一个节点**。
|
|
6096
|
-
// mask 在正中间挖一个随开窗扩大的椭圆洞,数字从洞里显出来,光留在两侧。
|
|
6097
|
-
// 等待态挂 --wait 把洞钉在 0%(整块可见=加载动画),出数时摘掉它、挂 --enter 播开窗。
|
|
6098
|
-
jsx.jsx("span", {
|
|
6099
|
-
className: "balance-usage-reveal__mist"
|
|
6100
|
-
+ (showCostLoading ? " balance-usage-reveal__mist--wait" : ""),
|
|
6101
|
-
"aria-hidden": "true",
|
|
6102
|
-
children: jsx.jsx("span", {
|
|
6103
|
-
className: "balance-usage-mist",
|
|
6104
|
-
children: ORB_INDICES.map((i) => jsx.jsx("span", { key: "orb-" + i, className: "balance-usage-mist__orb" })),
|
|
6105
|
-
}),
|
|
6106
|
-
}, "mist"),
|
|
6107
|
-
// 上层:金额本体(≈ + ¥ + 数字),被 clip-path 从中缝向两侧打开 —— 「开窗」只发生在这一层。
|
|
6108
|
-
// 只在出数之后才存在 —— 等待期容器里只有光,宽度靠 .balance-usage-reveal 的 min-width 撑住。
|
|
6109
|
-
// ⚠️ ≈ 就在 __body **里面**(2026-11-01 用户最终定案:「约等于还是加回去吧 并且算到动画
|
|
6110
|
-
// 里去 没有约等于中间空了一块好奇怪」)。它跟着开窗一起显形,是这一层的一部分:
|
|
6111
|
-
// 单独拎出去当常显符号(上一版)会和雾叠着、看着像"符号长在动画上",整串去掉又让
|
|
6112
|
-
// 胶囊中间空一截。放回来之后内容 = ≈ ¥121.17,居中填满,视觉最自然。
|
|
6113
|
-
showCostLoading
|
|
6114
|
-
? null
|
|
6115
|
-
: jsx.jsxs("span", {
|
|
6116
|
-
className: "balance-usage-reveal__body",
|
|
6117
|
-
children: [
|
|
6118
|
-
// ≈ 单独成节点:U+2248 在中文字体里落在数学符号的中线,比数字基线低一截,
|
|
6119
|
-
// 直接跟「¥7.4619」串在一起会显得整个符号往下掉(2026-10-30 用户指出「有点靠下」)。
|
|
6120
|
-
jsx.jsx("span", { className: "balance-usage-approx", children: "≈" }, "approx"),
|
|
6121
|
-
jsx.jsx("span", { children: "¥" }, "cur"),
|
|
6122
|
-
// 只有数字参与逐位滚动:¥ 是定值,跟着滚会把整个符号一起翻。
|
|
6123
|
-
// 静态也走逐字格 + 外层 key 恒定,理由同上(宽度恒定、滚动结束不重挂)。
|
|
6124
|
-
// ⚠️ 占位 `—`(拿不到分桶、4 秒兜底之后)**不进滚格子**:它不是数字,
|
|
6125
|
-
// 滚格子会按「小数点对齐」拆出一个只有 `.` 的中间格,加上空位就是一串
|
|
6126
|
-
// 看着像 `_._` 的碎片(用户 2026-11-02 抓到过一瞬间)。占位直接静态文本。
|
|
6127
|
-
costResolved
|
|
6128
|
-
? jsx.jsx("span", {
|
|
6129
|
-
children: renderRollCells(
|
|
6130
|
-
costRoll === null ? buildRollCells(costText, costText) : buildRollCells(costRoll.from, costText),
|
|
6131
|
-
"u" + (costRoll === null ? "" : costRoll.at),
|
|
6132
|
-
// 播完就定格:摘掉 animation 声明,展开侧栏不再重播
|
|
6133
|
-
costRoll !== null && costRoll.done === true,
|
|
6134
|
-
// 快档:订正滚动(同上面那处)
|
|
6135
|
-
true,
|
|
6136
|
-
),
|
|
6137
|
-
}, "txt")
|
|
6138
|
-
: jsx.jsx("span", { className: "balance-usage-dash", children: "—" }, "dash"),
|
|
6139
|
-
],
|
|
6140
|
-
}, "body"),
|
|
6141
|
-
],
|
|
6142
6592
|
}),
|
|
6593
|
+
],
|
|
6143
6594
|
}),
|
|
6144
6595
|
];
|
|
6145
6596
|
|
|
@@ -6306,16 +6757,23 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
6306
6757
|
if (settings.showUsagePill === false) return null;
|
|
6307
6758
|
|
|
6308
6759
|
return jsx.jsxs("div", {
|
|
6309
|
-
className: "balance-usage-wrap",
|
|
6760
|
+
className: "balance-usage-wrap balance-usage-wrap--float",
|
|
6310
6761
|
children: [
|
|
6311
|
-
jsx.
|
|
6762
|
+
jsx.jsxs("button", {
|
|
6312
6763
|
type: "button",
|
|
6313
6764
|
ref: detailsAnchorRef,
|
|
6314
|
-
|
|
6765
|
+
// 两个类名都要留着:`.balance-usage-line` 是「这一帧本该渲染消耗行吗」的探测锚点
|
|
6766
|
+
// (订阅/离场判定都在用 document.querySelector 找它),`.balance-float` 才是浮窗外观。
|
|
6767
|
+
className: "balance-usage-line balance-float",
|
|
6315
6768
|
"aria-haspopup": "dialog",
|
|
6316
6769
|
"aria-expanded": detailsOpen,
|
|
6317
|
-
"aria-label": "
|
|
6770
|
+
"aria-label": "本会话消耗明细",
|
|
6318
6771
|
onClick: () => setDetailsOpen((value) => !value),
|
|
6772
|
+
style: floatBox === null ? void 0 : { right: floatBox.right + "px", bottom: floatBox.bottom + "px" },
|
|
6773
|
+
// 单行两列:第一列「本会话消耗估算」的字样,第二列金额胶囊(迷雾 / 开窗 / 逐位滚全在)。
|
|
6774
|
+
// 2026-11-02 第十一轮:用户「只显示本会话的消耗 不要今日消耗 然后调小一点 太大了
|
|
6775
|
+
// 我要的是第一列显示本会话消耗估算的字样 第二列显示消耗数字 保留动画」——
|
|
6776
|
+
// 所以今日那一整行(连带它的雾/擦出/滚 & 图标)都撤掉了,卡片回到 20px 高。
|
|
6319
6777
|
children,
|
|
6320
6778
|
}),
|
|
6321
6779
|
detailsOpen
|
|
@@ -7222,7 +7680,7 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
7222
7680
|
value.footerStyle === "timeline"
|
|
7223
7681
|
? toggleRow("refreshWave", "右键刷新浪潮", "右键余额时,金额会被一道白光从左往右擦出来(和输入区「本会话消耗」同一个动效)。")
|
|
7224
7682
|
: null,
|
|
7225
|
-
toggleRow("showUsagePill", "会话消耗行", "
|
|
7683
|
+
toggleRow("showUsagePill", "会话消耗行", "对话界面右下角的小浮窗:一行两列(「本会话消耗估算」+ 金额),点开是明细浮层。"),
|
|
7226
7684
|
// 两种加载动效互斥,用分段按钮选(和「余额行外观」同一个控件,视觉一致)。
|
|
7227
7685
|
// 选项文字用「样式1 / 样式2」而不是效果名,所以旁边直接播一个真预览 ——
|
|
7228
7686
|
// 用户不用读描述、看动画就知道选的是哪个(2026-10-31 要求「在介绍栏预览给用户看」)。
|
|
@@ -7245,8 +7703,9 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
7245
7703
|
children: [
|
|
7246
7704
|
jsx.jsx("span", {
|
|
7247
7705
|
className: "balance-settings__preview-text",
|
|
7248
|
-
//
|
|
7249
|
-
|
|
7706
|
+
// 与真实浮窗同一个文案(2026-11-02 第十一轮定稿:「本会话消耗估算」,
|
|
7707
|
+
// 因为这轮把 ≈ 撤了,估算语义只能由文字说明)
|
|
7708
|
+
children: "本会话消耗估算",
|
|
7250
7709
|
}),
|
|
7251
7710
|
value.usageLoadingStyle === "text"
|
|
7252
7711
|
? jsx.jsxs("span", {
|
|
@@ -7277,7 +7736,7 @@ function UsageCostLine({ useProjection, sessionId }) {
|
|
|
7277
7736
|
group("fab", "收起态圆钮", [
|
|
7278
7737
|
toggleRow("showFab", "显示圆钮", "收起侧边栏时左下角的悬浮圆形余额。"),
|
|
7279
7738
|
numberRow("fabSize", "直径", "圆钮大小;圆内字号按比例缩放。", 32, 120, "px"),
|
|
7280
|
-
numberRow("fabLeft", "距左缘", "
|
|
7739
|
+
numberRow("fabLeft", "距左缘", "数值越大越靠右;收起态卡片左下角等距,所以它同时也是距底边的距离。", 0, 600, "px"),
|
|
7281
7740
|
]),
|
|
7282
7741
|
|
|
7283
7742
|
group("stats", "用量统计", [
|