dsh-arknights-theme 1.0.2 → 1.0.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 +2 -2
- package/cordis.patch.yml +1 -1
- package/lib/client.js +17 -1
- package/lib/index.js +34 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ a coat of theme paint.
|
|
|
16
16
|
**预构建包(推荐) / Prebuilt tarball (recommended)**
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
dsh plugin add https://github.com/Theflowyears/dsh-arknights-theme/releases/download/v1.0.
|
|
19
|
+
dsh plugin add https://github.com/Theflowyears/dsh-arknights-theme/releases/download/v1.0.3/dsh-arknights-theme-1.0.3.tgz
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
**从仓库安装 / From the repository**
|
|
@@ -95,7 +95,7 @@ This is the manual: what the package is made of, what is measured per wallpaper,
|
|
|
95
95
|
glyph is used, how to rebuild it, and where its limits are. Installation and the highlight reel
|
|
96
96
|
live on the repository front page.
|
|
97
97
|
|
|
98
|
-
- 版本 / Version: **1.0.
|
|
98
|
+
- 版本 / Version: **1.0.3**
|
|
99
99
|
- 适用 / Requires: DSH Web,`@deepseek-ai/cordis` 4.x
|
|
100
100
|
- 许可 / Licence: 代码 MIT,美术素材不在 MIT 范围内(见 [版权与署名](#版权与署名--rights-and-credit))
|
|
101
101
|
|
package/cordis.patch.yml
CHANGED
package/lib/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
GENERATED by build-client.mjs.
|
|
3
3
|
Sources: assets/wallpapers.json, prts-assets.json + prts/, icons.mjs, skin.css, client-src.js */
|
|
4
4
|
window.__ModuleLoader__.load({
|
|
5
|
-
id: "dsh-
|
|
5
|
+
id: "dsh-arknights-theme",
|
|
6
6
|
factory: (require) => {
|
|
7
7
|
var module = { exports: {} };
|
|
8
8
|
var exports = module.exports;
|
|
@@ -6014,6 +6014,22 @@ function apply(ctx) {
|
|
|
6014
6014
|
/* Mount both tags before painting, so the first frame already carries the
|
|
6015
6015
|
solved glass for this wallpaper and immersion. */
|
|
6016
6016
|
ctx.effect(mountStyles, "amiya-wallpaper: stylesheet");
|
|
6017
|
+
/* Every rule in the stylesheet is scoped to `html[data-amiya-skin="1"]`, so the attribute decides
|
|
6018
|
+
whether the skin exists at all. The host half contributes it as an index-injection row, which is
|
|
6019
|
+
the documented mechanism — but a deployment that renders its own index can miss that path, and
|
|
6020
|
+
when it does the page still looks plausible (the stylesheet-less fallback colour), which is how
|
|
6021
|
+
issue #1 was reported as "the wallpaper does not show". Setting it here too costs one attribute
|
|
6022
|
+
and removes the single point of failure; the disposer takes it away with the plugin. */
|
|
6023
|
+
ctx.effect(function () {
|
|
6024
|
+
if (typeof document === "undefined") return function () {};
|
|
6025
|
+
var root = document.documentElement;
|
|
6026
|
+
var had = root.getAttribute("data-amiya-skin");
|
|
6027
|
+
root.setAttribute("data-amiya-skin", "1");
|
|
6028
|
+
return function () {
|
|
6029
|
+
if (had === null) root.removeAttribute("data-amiya-skin");
|
|
6030
|
+
else root.setAttribute("data-amiya-skin", had);
|
|
6031
|
+
};
|
|
6032
|
+
}, "amiya-wallpaper: skin attribute");
|
|
6017
6033
|
ctx.effect(function () {
|
|
6018
6034
|
return unpaintWallpaper;
|
|
6019
6035
|
}, "amiya-wallpaper: unpaint");
|
package/lib/index.js
CHANGED
|
@@ -41,6 +41,11 @@ const MIME = new Map([
|
|
|
41
41
|
['.webp', 'image/webp'],
|
|
42
42
|
['.svg', 'image/svg+xml'],
|
|
43
43
|
['.json', 'application/json; charset=utf-8'],
|
|
44
|
+
/* Without this entry the stylesheet went out as `application/octet-stream`, and a browser silently
|
|
45
|
+
* discards a `<link rel="stylesheet">` whose MIME is not `text/css` — so the whole skin was inert
|
|
46
|
+
* while the file itself was fine and returned 200. Locally the client half masked it by injecting
|
|
47
|
+
* the same CSS from the bundle; a from-scratch install has no such fallback. Reported in issue #1. */
|
|
48
|
+
['.css', 'text/css; charset=utf-8'],
|
|
44
49
|
['.jpg', 'image/jpeg'],
|
|
45
50
|
['.jpeg', 'image/jpeg'],
|
|
46
51
|
['.png', 'image/png'],
|
|
@@ -80,20 +85,37 @@ export function apply(ctx) {
|
|
|
80
85
|
* * the attribute is set by a blocking inline script, so every rule in the
|
|
81
86
|
* stylesheet — all of which are scoped to it — is live from the first frame,
|
|
82
87
|
* and the stylesheet stays inert in a DSH that is not running this skin.
|
|
88
|
+
*
|
|
89
|
+
* **The mechanism changed in 1.0.3 because `tapIndex` is not enough any more.** DSH now has a
|
|
90
|
+
* structured injection table (`webserver/index-inject`): rows are JSON data, and they feed two
|
|
91
|
+
* renderers — the served index, and the boot payload a static/desktop deployment ships to a
|
|
92
|
+
* page-side interpreter. `tapIndex` only exists in the first: it is a string transform applied to
|
|
93
|
+
* a served index body, so on a build that serves a static index it never runs. That is exactly the
|
|
94
|
+
* report in issue #1 — the asset route registered, the skin attribute read back `null`, and the
|
|
95
|
+
* page fell through to the stylesheet-less fallback colour. Emitting rows instead makes the same
|
|
96
|
+
* injection land in both deployments; the client half also sets the attribute as a last resort, so
|
|
97
|
+
* a third mechanism appearing later cannot silently take the skin down again.
|
|
83
98
|
*/
|
|
84
99
|
ctx.effect(() => {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
const listener = (table) => {
|
|
101
|
+
table.push(
|
|
102
|
+
{
|
|
103
|
+
kind: 'html',
|
|
104
|
+
placement: 'head',
|
|
105
|
+
html:
|
|
106
|
+
'<link rel="stylesheet" href="' +
|
|
107
|
+
ROUTE +
|
|
108
|
+
'/assets/skin.css" data-amiya-skin="1">',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
kind: 'script',
|
|
112
|
+
placement: 'head',
|
|
113
|
+
text: 'document.documentElement.setAttribute("data-amiya-skin","1")',
|
|
114
|
+
},
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
ctx.on('webserver/index-inject', listener)
|
|
118
|
+
return () => ctx.off('webserver/index-inject', listener)
|
|
97
119
|
}, 'amiya-wallpaper: index injection')
|
|
98
120
|
|
|
99
121
|
ctx.effect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-arknights-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "为《明日方舟》玩家在 DSH Web 上构建沉浸感:12 张整屏壁纸(按画面自适应的边缘虚化)、按每张图解算的玻璃与文字色、罗德岛图标体系,以及签字式的授权与选择交互。 / Building immersion for Arknights players on the DSH Web GUI: twelve full-screen wallpapers with per-image edge blur, glass and ink solved from each picture, Rhodes Island iconography, and sign-off style approval and choice interactions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|