dsh-tui-theme 0.2.2 → 0.3.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 +2 -1
- package/cordis.patch.yml +1 -0
- package/docs/screenshots/settings.png +0 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +3 -0
- package/lib/types/settingsSection.d.ts.map +1 -1
- package/lib/types/settingsSection.js +16 -0
- package/lib/types/statusLine.d.ts +9 -0
- package/lib/types/statusLine.d.ts.map +1 -1
- package/lib/types/statusLine.js +32 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| --- | --- | --- |
|
|
7
7
|
| **三套粉色主题** | 主题(静态资产) | `pink-night` 夜樱 / `pink-day` 昼樱 / `pink-ansi` 樱·ANSI,启动时自动装进 `~/.dsh-tui/themes/` |
|
|
8
8
|
| **自动跟随背景** | 启动时序 | 检测终端/系统背景色(OSC 11,与宿主同阈值),在昼樱/夜樱间自动切换——pink 版的 auto |
|
|
9
|
-
| **花符状态行** | `tuiStatus` | 输入框上方一行小装饰:✿ · 时钟 ·
|
|
9
|
+
| **花符状态行** | `tuiStatus` | 输入框上方一行小装饰:✿ · 时钟 · 实时轮数(默认仅粉主题下显示) |
|
|
10
10
|
| **设置面板** | `tuiSettingsSections` | `/settings` 里一个可编辑区块,改完即时生效 |
|
|
11
11
|
|
|
12
12
|
**明确不做的事**:不注册快捷键、不注册/修改任何命令、不拦截输入、不追加会话事件、不注入 system prompt。卸载即无痕(可选删除主题文件)。
|
|
@@ -79,6 +79,7 @@ dsh plugin --profile dsh-tui add -w /path/to/dsh-tui-theme
|
|
|
79
79
|
| `showGlyph` | `true` | 花符:开 = ✿ 开头,关 = 不显示 |
|
|
80
80
|
| `showClock` | `true` | 显示 HH:MM 时钟 |
|
|
81
81
|
| `showTurns` | `true` | 显示当前会话轮数(`N✦`,自本次启动起计) |
|
|
82
|
+
| `statusScope` | `pink-only` | 状态行展示:`pink-only` 仅樱花粉主题 / `all-themes` 所有主题 |
|
|
82
83
|
|
|
83
84
|
三项装饰全关时状态行整体消失。另有仅 profile 层的开关(`cordis.patch.yml`,不出现在 /settings):`autoInstallThemes`、`statusEnabled`。
|
|
84
85
|
|
package/cordis.patch.yml
CHANGED
|
Binary file
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEjF,eAAO,MAAM,IAAI,kBAAkB,CAAA;AAEnC,wDAAwD;AACxD,MAAM,MAAM,MAAM,GAAG,eAAe,CAAA;AAUpC,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEjF,eAAO,MAAM,IAAI,kBAAkB,CAAA;AAEnC,wDAAwD;AACxD,MAAM,MAAM,MAAM,GAAG,eAAe,CAAA;AAUpC,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,MAAM,CAQrC,CAAA;AAyBF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAiE7D"}
|
package/lib/types/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export const Config = z.object({
|
|
|
35
35
|
showGlyph: z.boolean().default(true),
|
|
36
36
|
showClock: z.boolean().default(true),
|
|
37
37
|
showTurns: z.boolean().default(true),
|
|
38
|
+
statusScope: z.union(['pink-only', 'all-themes']).default('pink-only'),
|
|
38
39
|
});
|
|
39
40
|
const DEFAULTS = {
|
|
40
41
|
autoInstallThemes: true,
|
|
@@ -43,6 +44,7 @@ const DEFAULTS = {
|
|
|
43
44
|
showGlyph: true,
|
|
44
45
|
showClock: true,
|
|
45
46
|
showTurns: true,
|
|
47
|
+
statusScope: 'pink-only',
|
|
46
48
|
};
|
|
47
49
|
/**
|
|
48
50
|
* Backstop delay for the cordis-layer follow decision on hosts without a
|
|
@@ -65,6 +67,7 @@ export function apply(ctx, config = {}) {
|
|
|
65
67
|
showGlyph: config.showGlyph ?? DEFAULTS.showGlyph,
|
|
66
68
|
showClock: config.showClock ?? DEFAULTS.showClock,
|
|
67
69
|
showTurns: config.showTurns ?? DEFAULTS.showTurns,
|
|
70
|
+
statusScope: config.statusScope ?? DEFAULTS.statusScope,
|
|
68
71
|
};
|
|
69
72
|
if (cordis.autoInstallThemes) {
|
|
70
73
|
const result = installBundledThemes();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settingsSection.d.ts","sourceRoot":"","sources":["../../src/settingsSection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GACpC,IAAI,
|
|
1
|
+
{"version":3,"file":"settingsSection.d.ts","sourceRoot":"","sources":["../../src/settingsSection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GACpC,IAAI,CA4CN"}
|
|
@@ -35,6 +35,7 @@ export function registerPinkSettings(ctx, cordis, onDoc) {
|
|
|
35
35
|
showGlyph: z.boolean(),
|
|
36
36
|
showClock: z.boolean(),
|
|
37
37
|
showTurns: z.boolean(),
|
|
38
|
+
statusScope: z.union(['pink-only', 'all-themes']),
|
|
38
39
|
}));
|
|
39
40
|
const emit = (doc) => {
|
|
40
41
|
if (doc === null || typeof doc !== 'object')
|
|
@@ -110,6 +111,21 @@ function sectionDefinition(cordis) {
|
|
|
110
111
|
kind: 'boolean',
|
|
111
112
|
format: (value) => String(value ?? cordis.showTurns),
|
|
112
113
|
},
|
|
114
|
+
{
|
|
115
|
+
path: ['statusScope'],
|
|
116
|
+
label: 'Status line display',
|
|
117
|
+
descriptions: { zh: '状态行展示' },
|
|
118
|
+
hint: 'The blossom line is exclusive to the pink palettes by default; all-themes keeps it visible under other themes.',
|
|
119
|
+
hintDescriptions: {
|
|
120
|
+
zh: '状态行默认为樱花粉主题专属;所有主题时在其他主题下同样显示。',
|
|
121
|
+
},
|
|
122
|
+
kind: 'select',
|
|
123
|
+
options: [
|
|
124
|
+
{ value: 'pink-only', label: 'Pink themes only', descriptions: { zh: '樱花粉主题' } },
|
|
125
|
+
{ value: 'all-themes', label: 'All themes', descriptions: { zh: '所有主题' } },
|
|
126
|
+
],
|
|
127
|
+
format: (value) => typeof value === 'string' ? value : (cordis.statusScope ?? 'pink-only'),
|
|
128
|
+
},
|
|
113
129
|
],
|
|
114
130
|
};
|
|
115
131
|
}
|
|
@@ -5,9 +5,16 @@
|
|
|
5
5
|
* live turn count of the current session (seam one, read-only — nothing is
|
|
6
6
|
* ever appended to the session log). The host owns rendering and
|
|
7
7
|
* sanitization; text is scalars only.
|
|
8
|
+
*
|
|
9
|
+
* The line belongs to the pink palettes: by default it only renders while a
|
|
10
|
+
* pink theme is active (checked per render with the host's own theme
|
|
11
|
+
* precedence, so a mid-session /theme switch takes effect on the next tick);
|
|
12
|
+
* `statusScope: 'all-themes'` opts it into every other theme too.
|
|
8
13
|
* @module dsh-tui-pink-theme/statusLine
|
|
9
14
|
*/
|
|
10
15
|
import type { Context } from '@deepseek-ai/cordis';
|
|
16
|
+
/** Which themes the blossom line renders under. */
|
|
17
|
+
export type StatusScope = 'pink-only' | 'all-themes';
|
|
11
18
|
export interface StatusOptions {
|
|
12
19
|
/** Master switch (cordis-config layer only; not surfaced in /settings). */
|
|
13
20
|
statusEnabled?: boolean;
|
|
@@ -17,6 +24,8 @@ export interface StatusOptions {
|
|
|
17
24
|
showClock?: boolean;
|
|
18
25
|
/** Include the live turn count of the current session. */
|
|
19
26
|
showTurns?: boolean;
|
|
27
|
+
/** Theme scope of the line (default: the pink palettes only). */
|
|
28
|
+
statusScope?: StatusScope;
|
|
20
29
|
}
|
|
21
30
|
/** Fully-resolved status knobs. */
|
|
22
31
|
export type EffectiveStatus = Required<StatusOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusLine.d.ts","sourceRoot":"","sources":["../../src/statusLine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"statusLine.d.ts","sourceRoot":"","sources":["../../src/statusLine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAOlD,mDAAmD;AACnD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,YAAY,CAAA;AAEpD,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;AAwCrD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,GAAG,IAAI,CA2DvF"}
|
package/lib/types/statusLine.js
CHANGED
|
@@ -5,11 +5,37 @@
|
|
|
5
5
|
* live turn count of the current session (seam one, read-only — nothing is
|
|
6
6
|
* ever appended to the session log). The host owns rendering and
|
|
7
7
|
* sanitization; text is scalars only.
|
|
8
|
+
*
|
|
9
|
+
* The line belongs to the pink palettes: by default it only renders while a
|
|
10
|
+
* pink theme is active (checked per render with the host's own theme
|
|
11
|
+
* precedence, so a mid-session /theme switch takes effect on the next tick);
|
|
12
|
+
* `statusScope: 'all-themes'` opts it into every other theme too.
|
|
8
13
|
* @module dsh-tui-pink-theme/statusLine
|
|
9
14
|
*/
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
import { homeDir } from './themeAssets.js';
|
|
17
|
+
import { readThemePref } from './autoTheme.js';
|
|
10
18
|
const GLYPH = '✿';
|
|
11
19
|
const STATUS_KEY = 'dsh-tui-theme';
|
|
12
20
|
const CLOCK_TICK_MS = 15_000;
|
|
21
|
+
/** The bundled themes this garnish belongs to. */
|
|
22
|
+
const PINK_THEMES = new Set(['pink-night', 'pink-day', 'pink-ansi']);
|
|
23
|
+
/**
|
|
24
|
+
* The active theme name by the host's own precedence: DSH_TUI_THEME first,
|
|
25
|
+
* then the persisted ~/.dsh-tui/theme.json pref. The unforced path (OSC 11
|
|
26
|
+
* auto-detection) only ever resolves to a builtin palette, never a pink one,
|
|
27
|
+
* so "no pref" means non-pink.
|
|
28
|
+
*/
|
|
29
|
+
function activeThemeName(dataDir) {
|
|
30
|
+
const env = process.env.DSH_TUI_THEME;
|
|
31
|
+
if (env !== undefined && env !== '')
|
|
32
|
+
return env;
|
|
33
|
+
return readThemePref(dataDir);
|
|
34
|
+
}
|
|
35
|
+
function isPinkThemeActive(dataDir) {
|
|
36
|
+
const name = activeThemeName(dataDir);
|
|
37
|
+
return name !== undefined && PINK_THEMES.has(name);
|
|
38
|
+
}
|
|
13
39
|
function clockText() {
|
|
14
40
|
// "HH:MM" from toTimeString()'s "HH:MM:SS GMT…" prefix — locale independent.
|
|
15
41
|
return new Date().toTimeString().slice(0, 5);
|
|
@@ -29,6 +55,7 @@ function clockText() {
|
|
|
29
55
|
* edits land live without restarting anything).
|
|
30
56
|
*/
|
|
31
57
|
export function startStatusLine(ctx, getEffective) {
|
|
58
|
+
const dataDir = join(homeDir(), '.dsh-tui');
|
|
32
59
|
ctx.inject(['tuiStatus'], statusCtx => {
|
|
33
60
|
const status = statusCtx.tuiStatus;
|
|
34
61
|
const turns = new Map();
|
|
@@ -38,7 +65,11 @@ export function startStatusLine(ctx, getEffective) {
|
|
|
38
65
|
try {
|
|
39
66
|
const eff = getEffective();
|
|
40
67
|
const parts = [];
|
|
41
|
-
|
|
68
|
+
// The line is pink garnish: off on other themes unless opted in.
|
|
69
|
+
// The theme check runs here (not once at startup) so a mid-session
|
|
70
|
+
// /theme switch lands on the next tick or session event.
|
|
71
|
+
const themeAllows = eff.statusScope === 'all-themes' || isPinkThemeActive(dataDir);
|
|
72
|
+
if (eff.statusEnabled && themeAllows) {
|
|
42
73
|
if (eff.showGlyph)
|
|
43
74
|
parts.push(GLYPH);
|
|
44
75
|
if (eff.showClock)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tui-theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Sakura-pink themes for dsh-TUI with terminal-background auto-follow (pink-day/pink-night), a blossom status line, and a /settings section. No shortcuts, no commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/types/index.js",
|