dsh-background-by-model 0.4.2 → 0.4.3
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 +6 -0
- package/README.zh.md +6 -0
- package/lib/client.js +2307 -2232
- package/lib/client.js.map +1 -1
- package/lib/{host-scan-BDh0upIQ.js → host-scan-WjK2VGBe.js} +22 -0
- package/lib/host-scan.js +1 -1
- package/lib/index.js +1 -1
- package/lib/testing.js +326 -275
- package/package.json +1 -1
- package/test/host-check.test.mjs +109 -20
package/README.md
CHANGED
|
@@ -225,6 +225,12 @@ No. Both were removed in 0.3.0; each rule uses a static image.
|
|
|
225
225
|
|
|
226
226
|
## Recent Optimizations
|
|
227
227
|
|
|
228
|
+
### v0.4.3
|
|
229
|
+
|
|
230
|
+
- **The Host check tab stops crying wolf** — Its first real run on a healthy 0.1.7 install reported **9 failures out of 28 contracts** (7 tokens "no longer declared", 2 attributes gone). Every one was the *probe reading the wrong place*, not the host: the tokens are published as `body{--dsw-…}` while the probe asked `getComputedStyle(document.documentElement)`, and `data-plugin` — which the host's own CSS modules set on every `<style>` they inject — was being used to mean "this plugin's sheet", so the check skipped the entire host theme and then called the tokens renamed. Both are fixed, and both now have tests that fail if they come back: the token root is a named part of `ProbeEnv`, and reading the plugin's own sheets goes through a marker the plugin writes itself (`data-dab-side`), via `getAttribute` rather than `dataset` — `dataset` only exposes the camel-cased key, so a probe indexing it by the dashed name works in a fixture and silently returns nothing in a browser.
|
|
231
|
+
- **`rule` checks now say which side they are about** — A token contract asserts two different things: that the host still *declares* the name, and that it *resolves to a value*. The first can only be answered from the host's rules, the second only from the live cascade, and the one entry whose other half is this plugin's own stylesheet (`.dab-card`) is now marked `side: 'own'` explicitly instead of being indistinguishable from a host rule. Every re-emitted token carries both checks, so a rename is reported as a renamed token rather than as an empty value.
|
|
232
|
+
- **A readable-but-empty host stylesheet is a failure, not a blind spot** — The old code only asked whether *some* sheet was readable, so a host sheet that was readable yet mentioned nothing made every token check pass. Readability is now tracked per side.
|
|
233
|
+
|
|
228
234
|
### v0.4.2
|
|
229
235
|
|
|
230
236
|
- **New "Host check" tab — the plugin now reports what broke, instead of just breaking** — A plugin that styles someone else's interface depends on values it does not own: the host's session and model services, the elements it hangs backdrop filters on, and the design tokens it re-emits. Every one of those can be renamed between dsh releases, and all three 0.1.7 breakages were *silent* — nothing threw, the interface simply stopped following the settings. Settings → **Host check** now evaluates each of those touch points against the running build — the live DOM, the host's own stylesheets and the Cordis services — and shows, per point, whether it holds, what its loss looks like on screen, the literal it depends on, the host file that should define it and the plugin file that reads it. **Copy diagnostics** turns both halves into one markdown block for an issue. A surface that is merely off screen (the conversation view while the settings dialog is open, the file-preview panel before a file has been opened) is reported as *n/a*, never as a failure.
|
package/README.zh.md
CHANGED
|
@@ -225,6 +225,12 @@ pnpm test # 约定表、实时探测逻辑、界面样式表、版本下
|
|
|
225
225
|
|
|
226
226
|
## 近期优化
|
|
227
227
|
|
|
228
|
+
### v0.4.3
|
|
229
|
+
|
|
230
|
+
- **「宿主自检」不再虚报故障** — 它第一次在健康的 0.1.7 上实跑,28 条约定报了 **9 条失效**(7 个令牌「不再声明」、2 个属性「消失」)。**全部是探测读错了地方,宿主一条都没坏**:设计令牌发布在 `body{--dsw-…}` 上,探测却去问 `getComputedStyle(document.documentElement)`;而 `data-plugin` —— 宿主自己的 CSS 模块在**每一个** `<style>` 上都写它 —— 被我当成了「这是插件自己的样式表」,于是检查跳过了整个宿主主题,再把令牌报成改名。两处都已修正,并且各配了会让它复发的测试:令牌读取的宿主元素成了 `ProbeEnv` 的显式成员;识别自己的样式表改用一个只由本插件写入的标记(`data-dab-side`),且用 `getAttribute` 而不是 `dataset` —— `dataset` 只暴露驼峰键,按带连字符的名字去索引它,在夹具里能通过、在浏览器里静默返回空。
|
|
231
|
+
- **`rule` 检查现在会说明自己查的是哪一侧** — 一条令牌约定其实断言了两件不同的事:宿主是否仍**声明**这个名字,以及它是否仍**解析出值**。前者只能从宿主的规则回答,后者只能从实时级联回答;而唯一一条「另一半是本插件自己样式表」的(`.dab-card`)现在显式标为 `side: 'own'`,不再和宿主规则混为一谈。所有被重新发出的令牌都同时带上这两项检查,于是「改名」会被报成改名,而不是「值为空」。
|
|
232
|
+
- **可读但没提到目标的宿主样式表算失效,不算盲区** — 旧逻辑只问「有没有任意一张表可读」,于是一张能读、却什么也没提到的宿主表会让所有令牌检查都通过。现在可读性按侧分别跟踪。
|
|
233
|
+
|
|
228
234
|
### v0.4.2
|
|
229
235
|
|
|
230
236
|
- **新增「宿主自检」页 —— 插件现在能说清哪里坏了,而不只是坏掉** — 一个给别人界面做样式的插件,依赖的全是自己不拥有的东西:宿主的会话与模型服务、挂毛玻璃的那些元素、以及被重新发出的设计令牌。这些在 dsh 版本之间随时可能改名,而 0.1.7 那三次故障**全都是静默的** —— 什么都没抛错,界面只是不再跟随设置。现在 设置 → **宿主自检** 会逐条对当前构建做检查(实时 DOM、宿主自己的样式表、Cordis 服务),并给出:是否成立、失效时界面上是什么样子、依赖的字面量、本该由哪个宿主文件定义、以及本插件哪个文件在读取它。**复制诊断报告** 会把两侧结果合并成一份 markdown,直接贴进 issue。仅仅是「当前不在屏幕上」的情况(设置弹窗打开时的对话页、还没开过文件时的右侧栏)会报成 *未观察*,绝不算故障。
|