@iasiv5/dsh-skins 1.5.26 → 1.5.27
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/lib/client.js +41 -15
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2969,7 +2969,7 @@ ${references.join("\n")}`,
|
|
|
2969
2969
|
if (typeof extension !== "string" || !/^[a-z0-9]+$/.test(extension)) {
|
|
2970
2970
|
throw new RangeError(`builtinAssetUrl: invalid extension ${JSON.stringify(extension)}`);
|
|
2971
2971
|
}
|
|
2972
|
-
const rev = "1.5.
|
|
2972
|
+
const rev = "1.5.27";
|
|
2973
2973
|
return `/dsh-skins/assets/b_${skinId}_${assetKey}.${extension}?v=${rev}`;
|
|
2974
2974
|
}
|
|
2975
2975
|
|
|
@@ -3176,6 +3176,10 @@ ${references.join("\n")}`,
|
|
|
3176
3176
|
}
|
|
3177
3177
|
|
|
3178
3178
|
// src/client/skins/define-skin.js
|
|
3179
|
+
var FONT_TOKENS = {
|
|
3180
|
+
text: "--dsh-font-family-text-default",
|
|
3181
|
+
code: "--dsh-font-family-code-default"
|
|
3182
|
+
};
|
|
3179
3183
|
var REQUIRED = [
|
|
3180
3184
|
"id",
|
|
3181
3185
|
"label",
|
|
@@ -3185,6 +3189,7 @@ ${references.join("\n")}`,
|
|
|
3185
3189
|
"anchor",
|
|
3186
3190
|
"bodyAttribute",
|
|
3187
3191
|
"riding",
|
|
3192
|
+
"fonts",
|
|
3188
3193
|
"scrim",
|
|
3189
3194
|
"blur",
|
|
3190
3195
|
"glassVar",
|
|
@@ -3241,6 +3246,28 @@ ${references.join("\n")}`,
|
|
|
3241
3246
|
}
|
|
3242
3247
|
return wallpaper;
|
|
3243
3248
|
}
|
|
3249
|
+
function deriveFonts(fonts) {
|
|
3250
|
+
if (fonts === null || typeof fonts !== "object" || Array.isArray(fonts)) {
|
|
3251
|
+
throw new Error("fonts must be an object keyed by font slot");
|
|
3252
|
+
}
|
|
3253
|
+
const derived = {};
|
|
3254
|
+
for (const [slot, value] of Object.entries(fonts)) {
|
|
3255
|
+
if (!Object.hasOwn(FONT_TOKENS, slot)) throw new Error(`Unknown font slot: ${slot}`);
|
|
3256
|
+
const bad = `font slot "${slot}": value must be null, a non-empty string, or { light, dark }`;
|
|
3257
|
+
if (value === null) continue;
|
|
3258
|
+
if (typeof value === "string") {
|
|
3259
|
+
if (value === "") throw new Error(bad);
|
|
3260
|
+
derived[FONT_TOKENS[slot]] = { light: value, dark: value };
|
|
3261
|
+
continue;
|
|
3262
|
+
}
|
|
3263
|
+
const keys = typeof value === "object" && !Array.isArray(value) ? Object.keys(value) : [];
|
|
3264
|
+
if (keys.length !== 2 || !keys.includes("light") || !keys.includes("dark") || typeof value.light !== "string" || value.light === "" || typeof value.dark !== "string" || value.dark === "") {
|
|
3265
|
+
throw new Error(bad);
|
|
3266
|
+
}
|
|
3267
|
+
derived[FONT_TOKENS[slot]] = { light: value.light, dark: value.dark };
|
|
3268
|
+
}
|
|
3269
|
+
return derived;
|
|
3270
|
+
}
|
|
3244
3271
|
function defineSkin(spec) {
|
|
3245
3272
|
for (const key of Object.keys(spec)) {
|
|
3246
3273
|
if (!KNOWN_KEYS.has(key)) throw new Error(`Unknown spec key: ${key}`);
|
|
@@ -3259,13 +3286,16 @@ ${references.join("\n")}`,
|
|
|
3259
3286
|
spec.backgroundArt ? { art: { mime: spec.backgroundArt.mime, url: spec.backgroundArt.url } } : {},
|
|
3260
3287
|
spec.builtinAssets ?? {}
|
|
3261
3288
|
);
|
|
3289
|
+
const fontTokens = deriveFonts(spec.fonts);
|
|
3290
|
+
const constantBase = spec.constantTokens ?? {};
|
|
3291
|
+
const constantTokens = Object.keys(fontTokens).length > 0 || Object.keys(constantBase).length > 0 ? { ...constantBase, ...fontTokens } : null;
|
|
3262
3292
|
const table = {
|
|
3263
3293
|
bodyAttribute: spec.bodyAttribute,
|
|
3264
3294
|
titleBrand: spec.titleBrand,
|
|
3265
3295
|
favicon: spec.favicon,
|
|
3266
3296
|
anchor: spec.anchor,
|
|
3267
3297
|
riding: spec.riding,
|
|
3268
|
-
constantTokens
|
|
3298
|
+
constantTokens,
|
|
3269
3299
|
scrim: buildScrim(spec),
|
|
3270
3300
|
blur: spec.blur,
|
|
3271
3301
|
glassVar: spec.glassVar,
|
|
@@ -3321,6 +3351,8 @@ ${references.join("\n")}`,
|
|
|
3321
3351
|
"--dsw-specific-bubble": { light: "rgba(184, 67, 63, 0.10)", dark: "rgba(24, 24, 34, 0.90)" },
|
|
3322
3352
|
"--dsw-specific-bubble-highlight": { light: "rgba(184, 67, 63, 0.18)", dark: "rgba(40, 40, 56, 0.92)" }
|
|
3323
3353
|
},
|
|
3354
|
+
// 字体槽位(ADR-0025):宿主跟随。
|
|
3355
|
+
fonts: { text: null, code: null },
|
|
3324
3356
|
scrim: { kind: "overlay", coefficient: 30, light: "252, 250, 246", dark: "16, 16, 26" },
|
|
3325
3357
|
blur: { max: 12 },
|
|
3326
3358
|
glassVar: "--dsh-mrz-glass-blur",
|
|
@@ -3496,17 +3528,13 @@ ${references.join("\n")}`,
|
|
|
3496
3528
|
"--dsw-alias-interactive-bg-hover-accent": { light: "rgba(140, 206, 63, 0.14)", dark: "rgba(165, 212, 64, 0.16)" },
|
|
3497
3529
|
"--dsw-specific-bubble": { light: "rgba(0, 138, 191, 0.10)", dark: "rgba(20, 41, 60, 0.90)" },
|
|
3498
3530
|
"--dsw-specific-bubble-highlight": { light: "rgba(0, 138, 191, 0.18)", dark: "rgba(29, 61, 85, 0.90)" },
|
|
3499
|
-
"--dsw-font-family": {
|
|
3500
|
-
light: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif',
|
|
3501
|
-
dark: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif'
|
|
3502
|
-
},
|
|
3503
|
-
"--ds-font-family-code": {
|
|
3504
|
-
light: '"JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace',
|
|
3505
|
-
dark: '"JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace'
|
|
3506
|
-
},
|
|
3507
3531
|
"--dsh-scrollbar-thumb": { light: "var(--dsw-alias-scrollbar-bg-l2)", dark: "var(--dsw-alias-scrollbar-bg-l2)" },
|
|
3508
3532
|
"--dsh-scrollbar-thumb-hover": { light: "var(--dsw-alias-scrollbar-hover-l2)", dark: "var(--dsw-alias-scrollbar-hover-l2)" }
|
|
3509
3533
|
},
|
|
3534
|
+
// 字体槽位(ADR-0025):宿主跟随。JetBrains Mono 历史代码栈封存于
|
|
3535
|
+
// docs/adr/0025-font-slots-and-host-tracking.md「JBM 封存」,一行
|
|
3536
|
+
// code: '<封存栈>' 即复活。
|
|
3537
|
+
fonts: { text: null, code: null },
|
|
3510
3538
|
scrim: {
|
|
3511
3539
|
kind: "baked-gradient",
|
|
3512
3540
|
stops: {
|
|
@@ -3667,12 +3695,10 @@ ${references.join("\n")}`,
|
|
|
3667
3695
|
"--dsw-alias-interactive-bg-hover": { light: "rgba(101, 83, 216, 0.09)", dark: "rgba(169, 156, 255, 0.11)" },
|
|
3668
3696
|
"--dsw-alias-interactive-bg-active": { light: "rgba(101, 83, 216, 0.15)", dark: "rgba(169, 156, 255, 0.18)" },
|
|
3669
3697
|
"--dsw-specific-bubble": { light: "rgba(101, 83, 216, 0.11)", dark: "rgba(60, 48, 108, 0.90)" },
|
|
3670
|
-
"--dsw-specific-bubble-highlight": { light: "rgba(101, 83, 216, 0.18)", dark: "rgba(78, 63, 138, 0.92)" }
|
|
3671
|
-
"--dsw-font-family": {
|
|
3672
|
-
light: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif',
|
|
3673
|
-
dark: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif'
|
|
3674
|
-
}
|
|
3698
|
+
"--dsw-specific-bubble-highlight": { light: "rgba(101, 83, 216, 0.18)", dark: "rgba(78, 63, 138, 0.92)" }
|
|
3675
3699
|
},
|
|
3700
|
+
// 字体槽位(ADR-0025):宿主跟随。
|
|
3701
|
+
fonts: { text: null, code: null },
|
|
3676
3702
|
scrim: {
|
|
3677
3703
|
kind: "baked-gradient",
|
|
3678
3704
|
stops: {
|
package/package.json
CHANGED