dsh-music-panel 0.3.0 → 0.3.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/client.js +32 -27
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### 修复
6
+
7
+ - 修复 0.3.0 注入样式表中 `.mu-search-history` 规则缺少结尾 `}`,导致该规则之后的大量插件样式被浏览器丢弃、界面错乱的问题。
8
+ - 新增样式语法测试(`test/style.test.mjs`):CI 会拦截括号/引号不平衡的 CSS,避免同类问题再次进包。
9
+
3
10
  ## 0.3.0
4
11
 
5
12
  ### 功能
package/client.js CHANGED
@@ -5211,7 +5211,7 @@ window.__ModuleLoader__.load({
5211
5211
  '.mu-fav.is-on{color:var(--dsw-alias-brand-primary,#f4f4f5)}',
5212
5212
  '.mu-fav.is-on svg{fill:currentColor}',
5213
5213
  '.mu-chip-sm{height:24px;padding:0 8px;font-size:11px}',
5214
- '.mu-search-history{position:absolute;top:34px;right:0;z-index:20;display:flex;flex-wrap:wrap;gap:4px;max-width:320px;padding:6px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.12));border-radius:8px;background:var(--dsw-alias-bg-overlay,#202024);box-shadow:var(--dsw-elevation-prominent,0 8px 24px rgba(0,0,0,.35)}',
5214
+ '.mu-search-history{position:absolute;top:34px;right:0;z-index:20;display:flex;flex-wrap:wrap;gap:4px;max-width:320px;padding:6px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.12));border-radius:8px;background:var(--dsw-alias-bg-overlay,#202024);box-shadow:var(--dsw-elevation-prominent,0 8px 24px rgba(0,0,0,.35))}',
5215
5215
  '.mu-queue-row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}',
5216
5216
  '.mu-queue-row.is-current{color:var(--dsw-alias-brand-primary,#f4f4f5);background:var(--dsw-alias-interactive-bg-active,rgba(255,255,255,.08))}',
5217
5217
  '.mu-queue-index{font-size:12px;color:var(--dsw-alias-label-tertiary,#a1a1aa);font-variant-numeric:tabular-nums}',
@@ -5506,34 +5506,39 @@ window.__ModuleLoader__.load({
5506
5506
  // the first tab holds the lock, later tabs queue for it and take over
5507
5507
  // when the leader closes (the same pattern web-player PWAs use).
5508
5508
  ctx.effect(function () {
5509
- if (
5510
- typeof navigator === 'undefined' ||
5511
- navigator.locks === undefined ||
5512
- typeof navigator.locks.request !== 'function'
5513
- ) {
5514
- return
5515
- }
5516
- if (window.__dshMusicLeaderBound === true) return
5517
- window.__dshMusicLeaderBound = true
5518
- var LOCK = 'dsh-music-panel.player'
5519
- function hold() {
5520
- // The lock is released when the page unloads.
5521
- return new Promise(function () {})
5522
- }
5523
- function becomeLeader() {
5509
+ try {
5510
+ if (
5511
+ typeof navigator === 'undefined' ||
5512
+ navigator.locks === undefined ||
5513
+ typeof navigator.locks.request !== 'function'
5514
+ ) {
5515
+ return
5516
+ }
5517
+ if (window.__dshMusicLeaderBound === true) return
5518
+ window.__dshMusicLeaderBound = true
5519
+ var LOCK = 'dsh-music-panel.player'
5520
+ function hold() {
5521
+ // The lock is released when the page unloads.
5522
+ return new Promise(function () {})
5523
+ }
5524
+ function becomeLeader() {
5525
+ player.setLeader(true)
5526
+ return hold()
5527
+ }
5528
+ navigator.locks
5529
+ .request(LOCK, { mode: 'exclusive', ifAvailable: true }, function (lock) {
5530
+ if (lock !== null && lock !== undefined) return becomeLeader()
5531
+ // Another tab is playing: wait in the queue, then take over.
5532
+ player.setLeader(false)
5533
+ return navigator.locks.request(LOCK, becomeLeader)
5534
+ })
5535
+ .catch(function () {
5536
+ player.setLeader(true)
5537
+ })
5538
+ } catch (error) {
5539
+ // Cross-tab coordination must never break the plugin's UI.
5524
5540
  player.setLeader(true)
5525
- return hold()
5526
5541
  }
5527
- navigator.locks
5528
- .request(LOCK, { mode: 'exclusive', ifAvailable: true }, function (lock) {
5529
- if (lock !== null && lock !== undefined) return becomeLeader()
5530
- // Another tab is playing: wait in the queue, then take over.
5531
- player.setLeader(false)
5532
- return navigator.locks.request(LOCK, becomeLeader)
5533
- })
5534
- .catch(function () {
5535
- player.setLeader(true)
5536
- })
5537
5542
  })
5538
5543
 
5539
5544
  function mount(name, registration, component) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-music-panel",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Local music library for DeepSeek Harness: scan a folder, browse tracks with cover art and tags, and play through a sidebar-panel player with loop, shuffle and volume. · DSH 本地音乐插件:扫描音乐目录、读取封面与标签、侧栏入口 + 全屏播放器。",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "audio"
26
26
  ],
27
27
  "scripts": {
28
- "test": "node test/config.test.mjs && node test/meta.test.mjs && node test/library.test.mjs && node test/routes.test.mjs && node test/lyrics.test.mjs && node test/lyrics-write.test.mjs && node test/playlists.test.mjs && node test/favorites.test.mjs && node test/stats.test.mjs && node test/playback.test.mjs && node test/client.smoke.test.mjs",
28
+ "test": "node test/config.test.mjs && node test/meta.test.mjs && node test/library.test.mjs && node test/routes.test.mjs && node test/lyrics.test.mjs && node test/lyrics-write.test.mjs && node test/playlists.test.mjs && node test/favorites.test.mjs && node test/stats.test.mjs && node test/playback.test.mjs && node test/style.test.mjs && node test/client.smoke.test.mjs",
29
29
  "check": "node --check index.js && node --check client.js && node --check lib/config.js && node --check lib/settings.js && node --check lib/meta.js && node --check lib/library.js && node --check lib/http.js && node --check lib/lyrics.js && node --check lib/lyrics-write.js && node --check lib/playlists.js && node --check lib/favorites.js && node --check lib/stats.js && node --check lib/playback.js && node --check lib/routes.js",
30
30
  "pack:check": "npm pack --dry-run"
31
31
  },