dsh-theme-gallery 0.4.0 → 0.4.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/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  | 自己做皮肤(或让 AI 做) | 在 `lib/themes/` 加 JSON 后重跑 `npm run embed-themes`,或装 `dsh-theme-skin-author` 技能让 AI 生成 |
12
12
  | 贡献一个皮肤给所有人 | 在 `lib/themes/` 放一个 JSON,提 PR |
13
13
 
14
- 已随 **0.4.0** 发布 **7 套**皮肤:四套复刻自**蜂链商城**电商新零售系统管理后台
14
+ 已随 **0.4.1** 发布 **7 套**皮肤:四套复刻自**蜂链商城**电商新零售系统管理后台
15
15
  ([`renjie2026/fenglianshop-open`](https://github.com/renjie2026/fenglianshop-open) 的
16
16
  `admin-modular/src/utils/themes.js`),两套是本插件**原创**的宠物主题(同一套造色方法,色相取自中国传统色库),
17
17
  另有一套是**「纯色/拼色」配色选择器**卡片(15 个可点色值,见下)。
package/lib/client.js CHANGED
@@ -599,7 +599,7 @@ window.__ModuleLoader__.load({
599
599
  * package.json, and the release workflow fails when re-running the embed step
600
600
  * changes a tracked file.
601
601
  */
602
- const BUNDLED_VERSION = '0.4.0'
602
+ const BUNDLED_VERSION = '0.4.1'
603
603
 
604
604
  /**
605
605
  * Themes this package contributes, inlined from lib/themes/*.json.
@@ -7350,6 +7350,26 @@ window.__ModuleLoader__.load({
7350
7350
  * only used once the document has demonstrably failed to follow the service.
7351
7351
  */
7352
7352
  const paintAttempts = new Map()
7353
+
7354
+ /**
7355
+ * 观察到"服务已报告、文档未落色"的**时刻**(配合 {@link PAINT_GRACE_MS} 使用)。
7356
+ * @type {{id: string, at: number}|undefined}
7357
+ */
7358
+ let paintSeen
7359
+
7360
+ /**
7361
+ * 判"这次切换丢了"之前要等多久(毫秒)。
7362
+ *
7363
+ * 表现层是异步写 token 的,所以 `setTheme` 之后**一段时间内**文档一定还是旧色 ——
7364
+ * 那不是"错过",只是"还没轮到表现层"。原先没有这个等待,于是**每点一次配色卡都先跳转
7365
+ * 一次浅色**(用户报的"第一次点击不生效、反而变成浅色主题,再点一次才行")。
7366
+ *
7367
+ * 为什么不能只按"经过了一次 publish"来判:外壳的 `theme/change` 常常是**延迟送达**的,
7368
+ * 同一次点击里会再来一次 publish(实测读数:一次点击的 `setTheme` 序列是
7369
+ * `…, 'shi-liu-jin', 'light', 'shi-liu-jin'`,中间那对就是跳转)。所以要**按时间**等。
7370
+ * 400ms 足以覆盖表现层的一到两帧,又远小于人再点一次的反应时间。
7371
+ */
7372
+ const PAINT_GRACE_MS = 400
7353
7373
  /**
7354
7374
  * Apply the remembered skin, and confirm it landed.
7355
7375
  *
@@ -7376,6 +7396,7 @@ window.__ModuleLoader__.load({
7376
7396
  }
7377
7397
  if (skinIsPainted(wanted)) {
7378
7398
  paintAttempts.clear()
7399
+ paintSeen = undefined
7379
7400
  noteAmbientEvent('已上色', wanted)
7380
7401
  return
7381
7402
  }
@@ -7394,11 +7415,29 @@ window.__ModuleLoader__.load({
7394
7415
  // Budgeted and cooled down. This branch used to call `setTheme` unconditionally on every
7395
7416
  // publish, with no throttle at all, so the shell putting the active id back to a
7396
7417
  // built-in value made it a perpetual request ↔ publish ping-pong.
7418
+ paintSeen = undefined
7397
7419
  if (requestTheme(wanted)) noteAmbientEvent('置为皮肤', wanted)
7398
7420
  // Give the presenter a chance to land before judging it.
7399
7421
  return
7400
7422
  }
7401
7423
 
7424
+ // ── 先给它一段**时间**的耐心(代码上方那句"要跨过一次 PAUSE 才跳转"原本并没实现)──
7425
+ //
7426
+ // 直接 `setTheme` 之后的那几帧里,文档一定还没落色 —— 那不是"错过",只是"还没轮到
7427
+ // 表现层"。在这里就跳转的代价是:**每点一次配色卡都先闪一次浅色**,而且跳转里那两次
7428
+ // 写入会和外壳的偏好处理打架(用户报的"第一次点击不生效、反而变成浅色")。
7429
+ // 第一次只记时刻,过了 {@link PAINT_GRACE_MS} 仍未落色,才说明真的错过了。
7430
+ const now = Date.now()
7431
+ if (paintSeen === undefined || paintSeen.id !== wanted) {
7432
+ paintSeen = { id: wanted, at: now }
7433
+ noteAmbientEvent('等待上色', wanted)
7434
+ return
7435
+ }
7436
+ if (now - paintSeen.at < PAINT_GRACE_MS) {
7437
+ noteAmbientEvent('等待上色', wanted)
7438
+ return
7439
+ }
7440
+
7402
7441
  // The service ALREADY reports this skin, yet the document does not show it: the change
7403
7442
  // was missed by a presenter that had not subscribed yet. Only now is a bounce justified.
7404
7443
  const bounced = paintAttempts.get(wanted) ?? 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-theme-gallery",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "A theme gallery for DeepSeek Harness (DSH): six JSON-defined skins with full-screen coverage and sidebar scenery, plus built-in light/dark cards, switched from the panel under the sidebar's Plugins icon — adding skins needs no code change",
5
5
  "author": "renjie2026 (https://github.com/renjie2026)",
6
6
  "license": "MIT",