@dsh-plugin/dsh-ui-experience 1.0.0-dev.43488816373 → 1.0.0-dev.43490289639
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 +3 -3
- package/lib/client.js +22 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,12 +160,12 @@ M3 那侧的分离要说明白:Material 3 的 `emphasized` 整体是两段首
|
|
|
160
160
|
- `跟随系统`(默认):系统开启「减弱动态效果」时,全部时长压到 1ms、动画只跑一轮。
|
|
161
161
|
- `始终减弱动效`:无论系统设置,一律压制。
|
|
162
162
|
|
|
163
|
-
这一条是整层里唯一使用 `!important`
|
|
163
|
+
这一条是整层里唯一使用 `!important` 的地方——它要压掉本层从未写过的声明,逐条改写做不到。进入压制时会先撤掉已改写的曲线并停掉观察者:时长已被压到 1ms,改写既看不见,还会在压制表插入时被自己的观察者重新触发一次扫描。
|
|
164
164
|
|
|
165
165
|
### 生效范围
|
|
166
166
|
|
|
167
|
-
- 覆盖页面上的全部样式表,包括其他插件注入的。首次应用时全量扫描,之后用 `MutationObserver` 监视 `head` 与 `body
|
|
168
|
-
- 通过 `document.adoptedStyleSheets` 挂载的构造式样式表不是 DOM
|
|
167
|
+
- 覆盖页面上的全部样式表,包括其他插件注入的。首次应用时全量扫描,之后用 `MutationObserver` 监视 `head` 与 `body`;只有当新增节点本身是 `<style>` / `<link>`,或子树里含有时才补扫——聊天流式输出每帧都在改 DOM,无条件补扫会把一次性开销变成每帧开销。
|
|
168
|
+
- 通过 `document.adoptedStyleSheets` 挂载的构造式样式表不是 DOM 变更,观察者看不到它,只能在下一次全量扫描(切换曲线族、解除减弱动效、重新应用设置)时被读到。
|
|
169
169
|
- 跨源样式表读不到 `cssRules`,会在浏览器控制台记录一行并跳过——这类表的规则无法改写,静默跳过会让部分界面停留在原生曲线而无迹可循。(这条诊断走控制台而非 `~/.dsh/ui-experience.log`:后者由宿主半写入,浏览器半够不到文件系统。)
|
|
170
170
|
- 状态会写在 `<html data-dsh-uix-motion="m3|m3e">` 上,便于区分曲线来源。
|
|
171
171
|
|
package/lib/client.js
CHANGED
|
@@ -348,13 +348,15 @@
|
|
|
348
348
|
function realize() {
|
|
349
349
|
const active = settings;
|
|
350
350
|
if (active === void 0 || active.mode === "off") return;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
if (wantsReduced()) {
|
|
352
|
+
observer?.disconnect();
|
|
353
|
+
observer = void 0;
|
|
354
|
+
setReducedSheet(true);
|
|
354
355
|
restoreDeclarations();
|
|
355
356
|
clearDurationTokens();
|
|
356
357
|
return;
|
|
357
358
|
}
|
|
359
|
+
setReducedSheet(false);
|
|
358
360
|
applyDurationTokens();
|
|
359
361
|
scan();
|
|
360
362
|
observer ??= observeDocument();
|
|
@@ -367,9 +369,22 @@
|
|
|
367
369
|
scan();
|
|
368
370
|
});
|
|
369
371
|
}
|
|
372
|
+
function bringsStylesheet(node) {
|
|
373
|
+
if (node === void 0) return false;
|
|
374
|
+
const name = node.nodeName?.toUpperCase();
|
|
375
|
+
if (name === "STYLE" || name === "LINK") return true;
|
|
376
|
+
return (node.querySelectorAll?.("style,link")?.length ?? 0) > 0;
|
|
377
|
+
}
|
|
370
378
|
function observeDocument() {
|
|
371
|
-
const instance = new MutationObserver(() => {
|
|
372
|
-
|
|
379
|
+
const instance = new MutationObserver((records) => {
|
|
380
|
+
for (const record of records) {
|
|
381
|
+
for (let index = 0; index < record.addedNodes.length; index += 1) {
|
|
382
|
+
if (bringsStylesheet(record.addedNodes[index])) {
|
|
383
|
+
refresh();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
373
388
|
});
|
|
374
389
|
instance.observe(document.head, { childList: true, subtree: true });
|
|
375
390
|
instance.observe(document.body, { childList: true, subtree: true });
|
|
@@ -535,9 +550,9 @@
|
|
|
535
550
|
report(media.matches);
|
|
536
551
|
};
|
|
537
552
|
report(media.matches);
|
|
538
|
-
media.addEventListener
|
|
553
|
+
media.addEventListener("change", listener);
|
|
539
554
|
return () => {
|
|
540
|
-
media.removeEventListener
|
|
555
|
+
media.removeEventListener("change", listener);
|
|
541
556
|
};
|
|
542
557
|
}
|
|
543
558
|
var SOURCE = "@dsh-plugin/dsh-ui-experience";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-plugin/dsh-ui-experience",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.43490289639",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "UI experience enhancements for DeepSeek Harness: follow the system matugen Material You palette as the interface theme, and rewrite interface motion onto Material 3 / Material 3 Expressive curves.",
|
|
6
6
|
"license": "MIT",
|