@mzzsfy/dsh-usage-panel 0.7.0 → 0.7.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mzzsfy/dsh-usage-panel",
3
3
  "description": "多平台 LLM 账号余额与额度面板:支持 DeepSeek/OpenRouter/Kimi/智谱/MiniMax/NewApi 及自定义端点,自动定期查询,趋势图与历史快照,用量/余额阈值与窗口重置多通道通知",
4
- "version": "0.7.0",
4
+ "version": "0.7.1",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "exports": {
package/src/client.js CHANGED
@@ -1369,7 +1369,7 @@ function UsagePanelApp() {
1369
1369
 
1370
1370
  if (accounts === null) {
1371
1371
  return h('div', { className: 'up-panel' },
1372
- h('style', { dangerouslySetInnerHTML: { __html: CSS } }),
1372
+ h('style', { 'data-plugin': '@mzzsfy/dsh-usage-panel', dangerouslySetInnerHTML: { __html: CSS } }),
1373
1373
  h('span', { className: 'up-meta' }, notice !== null ? '读取失败' : '加载中…'),
1374
1374
  notice !== null ? h('div', { className: 'up-notice up-notice--error' }, notice) : null)
1375
1375
  }
@@ -1395,7 +1395,7 @@ function UsagePanelApp() {
1395
1395
  const anyBusy = Object.keys(busy).some((id) => busy[id] === true)
1396
1396
 
1397
1397
  return h('div', { className: 'up-panel' },
1398
- h('style', { dangerouslySetInnerHTML: { __html: CSS } }),
1398
+ h('style', { 'data-plugin': '@mzzsfy/dsh-usage-panel', dangerouslySetInnerHTML: { __html: CSS } }),
1399
1399
  h('div', { className: 'up-head' },
1400
1400
  h('span', { className: 'up-head__title' }, '账号详情'),
1401
1401
  h('span', { className: 'up-spacer' }),
@@ -13,4 +13,13 @@ test('client.js 注册 id 为完整包名', () => {
13
13
  const match = source.match(/__ModuleLoader__\.load\(\{\s*id:\s*'([^']+)'/)
14
14
  assert.ok(match, 'client.js 缺少 __ModuleLoader__.load 注册')
15
15
  assert.equal(match[1], name)
16
+ })
17
+
18
+ test('client.js 样式渲染自带 data-plugin', () => {
19
+ const source = readFileSync(join(PKG_ROOT, 'src', 'client.js'), 'utf8')
20
+ // 渲染点计数用 ('style', { 精确命中 React 形态,排除 DOM 形态的 createElement('style')
21
+ const renders = source.split("('style', {").length - 1
22
+ assert.ok(renders > 0, 'client.js 无样式渲染点')
23
+ const marked = source.split("('style', { 'data-plugin'").length - 1
24
+ assert.equal(marked, renders, '每个样式渲染点都必须携带 data-plugin(值=注册包名),防宿主 claimStyles 误归属后随他插件 HMR 整批误删')
16
25
  })