@each1024/pi-mini-mode 0.9.1 → 0.9.2
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 +7 -6
- package/README.zh-CN.md +15 -6
- package/extensions/footer-status.ts +31 -11
- package/lib/settings.html +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,6 +75,7 @@ This earlier screenshot and recording show footer configuration, not the newer i
|
|
|
75
75
|
| Command / shortcut | Purpose |
|
|
76
76
|
| --- | --- |
|
|
77
77
|
| `/pi-mini-mode-settings` | Configure fields, input enhancements and minimal output |
|
|
78
|
+
| `/pi-mini-mode-setup` | Show the first-run setup prompt again |
|
|
78
79
|
| `/pi-mini-mode-minimal on` / `off` | Enable minimal output / restore native history |
|
|
79
80
|
| `Ctrl+O` | Expand or collapse the complete process tree |
|
|
80
81
|
| `Ctrl+S` | Expand or collapse completed subagent rows; yields to Pi `/model`, `/thinking`, and other selectors |
|
|
@@ -98,10 +99,10 @@ This earlier screenshot and recording show footer configuration, not the newer i
|
|
|
98
99
|
<details>
|
|
99
100
|
<summary><strong>First run & configuration</strong> — defaults, controls, and settings file</summary>
|
|
100
101
|
|
|
101
|
-
On the first interactive TUI session, Pi Mini Mode shows a preview.
|
|
102
|
+
On the first interactive TUI session, Pi Mini Mode shows a preview. Almost every feature is on by default; only **branch-only** is off (it is mutually exclusive with **project & branch**). Change anything later with `/pi-mini-mode-settings`.
|
|
102
103
|
|
|
103
104
|
```text
|
|
104
|
-
deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M
|
|
105
|
+
deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 ◇ MCP 3 500/1.0M ⣿⣀⣀⣀⣀⣀⣀⣀⣀⣀ 1% 120 tok/s
|
|
105
106
|
```
|
|
106
107
|
|
|
107
108
|
The first-run picker offers **Keep defaults**, **Configure now**, and **Apply recommended setup**. Keeping defaults saves the default field selection, leaves minimal output on, and prevents the prompt from appearing again; configuring opens the same settings list immediately. Applying the recommendation asks you to choose the bundled `cc-dark` or `cc-light` theme, saves that theme and global `tuiMode=fullscreen` through Pi's settings API, applies the theme immediately, and asks you to restart Pi because the fullscreen renderer is chosen at startup. Project settings and CLI flags may override these global values. Escape/cancel leaves onboarding incomplete; retry with `/pi-mini-mode-setup`. Print, JSON, and other non-interactive modes never prompt.
|
|
@@ -126,9 +127,9 @@ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/pi-m
|
|
|
126
127
|
"pi-mini-mode-session-tokens-show": true,
|
|
127
128
|
"pi-mini-mode-cache-tokens-show": true,
|
|
128
129
|
"pi-mini-mode-cost-show": true,
|
|
129
|
-
"pi-mini-mode-mcp-show":
|
|
130
|
+
"pi-mini-mode-mcp-show": true,
|
|
130
131
|
"pi-mini-mode-context-show": true,
|
|
131
|
-
"pi-mini-mode-context-dots-show":
|
|
132
|
+
"pi-mini-mode-context-dots-show": true,
|
|
132
133
|
"pi-mini-mode-context-percent-show": true,
|
|
133
134
|
"pi-mini-mode-speed-show": true,
|
|
134
135
|
"pi-mini-mode-speed-unit-show": true,
|
|
@@ -146,9 +147,9 @@ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/pi-m
|
|
|
146
147
|
| `pi-mini-mode-session-tokens-show` | `true` | Accumulated session tokens (`Total`) |
|
|
147
148
|
| `pi-mini-mode-cache-tokens-show` | `true` | Accumulated cache read + cache write tokens |
|
|
148
149
|
| `pi-mini-mode-cost-show` | `true` | Estimated session list price |
|
|
149
|
-
| `pi-mini-mode-mcp-show` | `
|
|
150
|
+
| `pi-mini-mode-mcp-show` | `true` | Enabled MCP server count |
|
|
150
151
|
| `pi-mini-mode-context-show` | `true` | Used/total context tokens and progress bar |
|
|
151
|
-
| `pi-mini-mode-context-dots-show` | `
|
|
152
|
+
| `pi-mini-mode-context-dots-show` | `true` | Use a single-line dot-matrix bar instead of the solid bar |
|
|
152
153
|
| `pi-mini-mode-context-percent-show` | `true` | Context-use percentage |
|
|
153
154
|
| `pi-mini-mode-speed-show` | `true` | Generation speed at the far right |
|
|
154
155
|
| `pi-mini-mode-speed-unit-show` | `true` | Generation-speed sub-setting: append `tok/s` to the numeric value |
|
package/README.zh-CN.md
CHANGED
|
@@ -6,10 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
# Pi Mini Mode
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
**少一点干扰。多一点专注。**
|
|
10
11
|
|
|
11
12
|
为 [Pi](https://pi.dev) 的日常工作做一点精细的改进,不止于页脚。光标处预览图片,折叠长消息和过程详情,展开子代理工作,让重要的会话状态始终清晰。
|
|
12
13
|
|
|
14
|
+
<img width="1259" height="1020" alt="file-5ec414a82040ac062f4cda734fc10769" src="https://github.com/user-attachments/assets/0a894706-9ae6-46e5-bf85-3c7f85cf0273" />
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
13
18
|
## 安装
|
|
14
19
|
|
|
15
20
|
```bash
|
|
@@ -41,6 +46,9 @@ pi install git:github.com/eachann1024/pi-mini-mode
|
|
|
41
46
|
|
|
42
47
|
使用 `Ctrl+V` 粘贴图片,Windows/WSL 使用 `Alt+V`。关闭输入增强不会关闭 Pi 原生剪贴板功能。
|
|
43
48
|
|
|
49
|
+
<img width="1225" height="918" alt="image" src="https://github.com/user-attachments/assets/4cde0f64-35c9-4b15-9650-d8ba48863e6a" />
|
|
50
|
+
|
|
51
|
+
|
|
44
52
|
### 02 / 过程,更安静
|
|
45
53
|
|
|
46
54
|
在设置中开启 **极简输出**,或运行 `/pi-mini-mode-minimal on`。
|
|
@@ -75,6 +83,7 @@ pi install git:github.com/eachann1024/pi-mini-mode
|
|
|
75
83
|
| 命令/快捷键 | 用途 |
|
|
76
84
|
| --- | --- |
|
|
77
85
|
| `/pi-mini-mode-settings` | 配置字段、输入增强和极简输出 |
|
|
86
|
+
| `/pi-mini-mode-setup` | 再次显示首次设置提示 |
|
|
78
87
|
| `/pi-mini-mode-minimal on` / `off` | 开启极简输出/恢复原生历史 |
|
|
79
88
|
| `Ctrl+O` | 展开/收起完整过程树 |
|
|
80
89
|
| `Ctrl+S` | 展开/收起已完成的子代理行;打开 `/model`、`/thinking` 等选择器时交给 Pi |
|
|
@@ -98,10 +107,10 @@ pi install git:github.com/eachann1024/pi-mini-mode
|
|
|
98
107
|
<details>
|
|
99
108
|
<summary><strong>首次使用与配置</strong></summary>
|
|
100
109
|
|
|
101
|
-
首次进入交互式 TUI 会话时,Pi Mini Mode
|
|
110
|
+
首次进入交互式 TUI 会话时,Pi Mini Mode 显示设置预览。几乎全部功能默认开启;仅「仅显示分支」默认关,与「项目与分支」互斥。之后可用 `/pi-mini-mode-settings` 再改。
|
|
102
111
|
|
|
103
112
|
```text
|
|
104
|
-
deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M
|
|
113
|
+
deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 ◇ MCP 3 500/1.0M ⣿⣀⣀⣀⣀⣀⣀⣀⣀⣀ 1% 120 tok/s
|
|
105
114
|
```
|
|
106
115
|
|
|
107
116
|
首次设置会提供 **Keep defaults(保留默认值)**、**Configure now(立即配置)** 和 **Apply recommended setup(应用推荐配置)**。保留默认值会保存默认字段选择、保持极简输出开启,并且不再显示首次设置提示;立即配置会直接打开同一设置列表。应用推荐配置会让你选择内置的 `cc-dark` 或 `cc-light` 主题,通过 Pi 官方设置 API 保存该主题和全局 `tuiMode=fullscreen`,立即应用主题,并提示重启 Pi(全屏渲染器在启动时决定)。项目设置和命令行参数可能覆盖全局设置。按 Esc/取消不会完成首次设置,可稍后用 `/pi-mini-mode-setup` 重试。Print、JSON 等非交互模式不会显示提示。
|
|
@@ -116,9 +125,9 @@ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █
|
|
|
116
125
|
"pi-mini-mode-session-tokens-show": true,
|
|
117
126
|
"pi-mini-mode-cache-tokens-show": true,
|
|
118
127
|
"pi-mini-mode-cost-show": true,
|
|
119
|
-
"pi-mini-mode-mcp-show":
|
|
128
|
+
"pi-mini-mode-mcp-show": true,
|
|
120
129
|
"pi-mini-mode-context-show": true,
|
|
121
|
-
"pi-mini-mode-context-dots-show":
|
|
130
|
+
"pi-mini-mode-context-dots-show": true,
|
|
122
131
|
"pi-mini-mode-context-percent-show": true,
|
|
123
132
|
"pi-mini-mode-speed-show": true,
|
|
124
133
|
"pi-mini-mode-speed-unit-show": true,
|
|
@@ -136,9 +145,9 @@ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █
|
|
|
136
145
|
| `pi-mini-mode-session-tokens-show` | `true` | 显示会话累计令牌(`Total`) |
|
|
137
146
|
| `pi-mini-mode-cache-tokens-show` | `true` | 显示缓存读取与写入令牌(已包含在 Total 中) |
|
|
138
147
|
| `pi-mini-mode-cost-show` | `true` | 显示会话费用估算 |
|
|
139
|
-
| `pi-mini-mode-mcp-show` | `
|
|
148
|
+
| `pi-mini-mode-mcp-show` | `true` | 显示已启用的 MCP 服务器数量 |
|
|
140
149
|
| `pi-mini-mode-context-show` | `true` | 显示已用/总上下文令牌和进度条 |
|
|
141
|
-
| `pi-mini-mode-context-dots-show` | `
|
|
150
|
+
| `pi-mini-mode-context-dots-show` | `true` | 使用单行点阵进度条替代实心进度条 |
|
|
142
151
|
| `pi-mini-mode-context-percent-show` | `true` | 显示上下文使用百分比 |
|
|
143
152
|
| `pi-mini-mode-speed-show` | `true` | 显示最新生成速度 |
|
|
144
153
|
| `pi-mini-mode-speed-unit-show` | `true` | 速度子设置:在数字后追加 `tok/s` |
|
|
@@ -51,9 +51,9 @@ export const DEFAULT_SETTINGS: Readonly<MiniLensSettings> = {
|
|
|
51
51
|
"pi-mini-mode-session-tokens-show": true,
|
|
52
52
|
"pi-mini-mode-cache-tokens-show": true,
|
|
53
53
|
"pi-mini-mode-cost-show": true,
|
|
54
|
-
"pi-mini-mode-mcp-show":
|
|
54
|
+
"pi-mini-mode-mcp-show": true,
|
|
55
55
|
"pi-mini-mode-context-show": true,
|
|
56
|
-
"pi-mini-mode-context-dots-show":
|
|
56
|
+
"pi-mini-mode-context-dots-show": true,
|
|
57
57
|
"pi-mini-mode-context-percent-show": true,
|
|
58
58
|
"pi-mini-mode-speed-show": true,
|
|
59
59
|
"pi-mini-mode-speed-unit-show": true,
|
|
@@ -70,6 +70,7 @@ export const DEFAULT_SETTINGS: Readonly<MiniLensSettings> = {
|
|
|
70
70
|
|
|
71
71
|
const SETTING_IDS = Object.keys(DEFAULT_SETTINGS) as Array<Exclude<keyof MiniLensSettings, "footerOrder">>;
|
|
72
72
|
export const FOOTER_FIELDS = ["project-branch", "model", "thinking", "branch", "session-tokens", "cache-tokens", "ch", "cost", "mcp", "context", "context-percent", "speed"] as const;
|
|
73
|
+
export const FOOTER_STYLE_OPTIONS = ["context-dots", "speed-unit"] as const;
|
|
73
74
|
|
|
74
75
|
const COPY = {
|
|
75
76
|
title: "Pi Mini Mode 设置", preview: "预览(示例数据)", lens: "设置", minimal: "极简输出",
|
|
@@ -77,7 +78,7 @@ const COPY = {
|
|
|
77
78
|
totalDescription: "Total:当前会话分支上的全部 token,含工具上报的 LLM 用量。", cachedDescription: "Cached:累计 cache-read + cache-write token(包含在 Total 中)。", cacheHitDescription: "CH(cache hit):cache-read / (input + cache-read)。Cache write 不计入此比率。",
|
|
78
79
|
enableMinimalDescription: "开启统一折叠思考、工具和技能过程;关闭恢复 Pi 默认会话历史。",
|
|
79
80
|
inputEnhancementsDescription: "原生 Ctrl+V 粘贴图片(Windows/WSL:Alt+V);图片显示为 [image1] 标签,光标移入或全屏悬停可预览。空白后 / 选择技能并在光标处插入。Cmd+点击带下划线的图片标签或消息文件路径,用系统默认应用打开;预览及点击需终端支持。关闭仅恢复原生行为。",
|
|
80
|
-
tuiRequired: "/pi-mini-mode-settings 需要 TUI 模式", saveFailed: "无法保存 Pi Mini Mode 设置", minimalRequired: "/pi-mini-mode-minimal 需要 TUI 模式", minimalUsage: "用法:/pi-mini-mode-minimal [on|off]", minimalState: "Pi Mini Mode 极简输出:", onboarding: "
|
|
81
|
+
tuiRequired: "/pi-mini-mode-settings 需要 TUI 模式", saveFailed: "无法保存 Pi Mini Mode 设置", minimalRequired: "/pi-mini-mode-minimal 需要 TUI 模式", minimalUsage: "用法:/pi-mini-mode-minimal [on|off]", minimalState: "Pi Mini Mode 极简输出:", onboarding: "几乎全部功能默认开启;仅「仅显示分支」默认关,与「项目与分支」互斥。可用 /pi-mini-mode-settings 再改。", keepDefaults: "保留默认", configureNow: "立即配置", applyRecommended: "应用推荐配置", chooseTheme: "选择 Pi Mini Mode 主题(将保存全局主题和全屏模式;重启后生效)", themeSaved: "已保存推荐主题和全屏模式。请重启 Pi;项目设置或命令行参数可能覆盖全局设置。", themeSaveFailed: "无法保存推荐的 Pi 主题和全屏模式;未完成首次配置。", themeApplyFailed: "推荐设置已保存,但当前主题未能立即应用;请重启 Pi。",
|
|
81
82
|
} as const;
|
|
82
83
|
|
|
83
84
|
const RECOMMENDED_THEMES = ["cc-dark", "cc-light"] as const;
|
|
@@ -108,17 +109,31 @@ export function parseSettings(value: unknown): MiniLensSettings {
|
|
|
108
109
|
return settings;
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
/** True when saved JSON is missing a boolean key or a footer field, so defaults can be written back. */
|
|
113
|
+
export function settingsNeedBackfill(raw: unknown, parsed: MiniLensSettings): boolean {
|
|
114
|
+
if (!raw || typeof raw !== "object") return true;
|
|
115
|
+
const candidate = raw as Record<string, unknown>;
|
|
116
|
+
for (const id of SETTING_IDS) {
|
|
117
|
+
if (!Object.hasOwn(candidate, id)) return true;
|
|
118
|
+
}
|
|
119
|
+
if (!Array.isArray(candidate.footerOrder)) return false;
|
|
120
|
+
const order = parsed.footerOrder ?? [];
|
|
121
|
+
return FOOTER_FIELDS.some(id => !order.includes(id));
|
|
122
|
+
}
|
|
123
|
+
|
|
111
124
|
/** Pi /model and other selectors own Ctrl+S; the editor exposes getText. */
|
|
112
125
|
export function focusedSelectorOwnsKeys(tui?: { getFocusedComponent?(): unknown } | null): boolean {
|
|
113
126
|
const focused = tui?.getFocusedComponent?.();
|
|
114
127
|
return !!focused && typeof focused === "object" && typeof (focused as { getText?: unknown }).getText !== "function";
|
|
115
128
|
}
|
|
116
129
|
|
|
117
|
-
export async function loadSettings(path = settingsPath()): Promise<{ settings: MiniLensSettings; exists: boolean }> {
|
|
130
|
+
export async function loadSettings(path = settingsPath()): Promise<{ settings: MiniLensSettings; exists: boolean; backfilled: boolean }> {
|
|
118
131
|
try {
|
|
119
|
-
|
|
132
|
+
const raw: unknown = JSON.parse(await readFile(path, "utf8"));
|
|
133
|
+
const settings = parseSettings(raw);
|
|
134
|
+
return { settings, exists: true, backfilled: settingsNeedBackfill(raw, settings) };
|
|
120
135
|
} catch {
|
|
121
|
-
return { settings: { ...DEFAULT_SETTINGS }, exists: false };
|
|
136
|
+
return { settings: { ...DEFAULT_SETTINGS }, exists: false, backfilled: false };
|
|
122
137
|
}
|
|
123
138
|
}
|
|
124
139
|
|
|
@@ -1233,7 +1248,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1233
1248
|
else settingsWebOpening ??= (async () => {
|
|
1234
1249
|
const { startSettingsWeb } = await import("../lib/settings-web.ts");
|
|
1235
1250
|
const server = await startSettingsWeb(() => ({
|
|
1236
|
-
settings, defaults: DEFAULT_SETTINGS, order: FOOTER_FIELDS,
|
|
1251
|
+
settings, defaults: DEFAULT_SETTINGS, order: FOOTER_FIELDS, options: FOOTER_STYLE_OPTIONS,
|
|
1237
1252
|
items: settingsItems(settings).filter(item => !isCollapsedReplyChildSetting(item.id)),
|
|
1238
1253
|
// "regular" means minimal output is saved but cannot mount; the page offers a Pi prompt.
|
|
1239
1254
|
tuiMode: lastAttachMode ?? null,
|
|
@@ -1242,8 +1257,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
1242
1257
|
const input = value as Record<string, unknown>;
|
|
1243
1258
|
for (const [key, entry] of Object.entries(input)) {
|
|
1244
1259
|
if (key === "footerOrder") {
|
|
1245
|
-
if (!Array.isArray(entry) ||
|
|
1246
|
-
|| entry.some(id => !(FOOTER_FIELDS as readonly
|
|
1260
|
+
if (!Array.isArray(entry) || new Set(entry).size !== entry.length
|
|
1261
|
+
|| entry.some(id => typeof id !== "string" || !(FOOTER_FIELDS as readonly string[]).includes(id))) throw new TypeError("Invalid order");
|
|
1247
1262
|
} else if (!SETTING_IDS.includes(key as typeof SETTING_IDS[number]) || typeof entry !== "boolean") throw new TypeError("Invalid setting");
|
|
1248
1263
|
}
|
|
1249
1264
|
const next = parseSettings({ ...settings, ...input, onboardingCompleted: true });
|
|
@@ -1275,7 +1290,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1275
1290
|
let choice: string | undefined;
|
|
1276
1291
|
try {
|
|
1277
1292
|
choice = await ctx.ui.select(
|
|
1278
|
-
`Pi Mini Mode ${COPY.preview}\n\n deepseek-v4-flash high ${COPY.totalLabel} 45K ${COPY.cachedLabel} 25K ${COPY.cacheHitLabel} 40.0% $0.012 500/1.0M
|
|
1293
|
+
`Pi Mini Mode ${COPY.preview}\n\n deepseek-v4-flash high ${COPY.totalLabel} 45K ${COPY.cachedLabel} 25K ${COPY.cacheHitLabel} 40.0% $0.012 ◇ MCP 3 500/1.0M ⣿⣀⣀⣀⣀⣀⣀⣀⣀⣀ 1% 120 tok/s\n\n${COPY.onboarding}`,
|
|
1279
1294
|
[COPY.keepDefaults, COPY.configureNow, COPY.applyRecommended],
|
|
1280
1295
|
);
|
|
1281
1296
|
} catch (error) {
|
|
@@ -1363,10 +1378,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
1363
1378
|
description: "Open HTML settings in the browser",
|
|
1364
1379
|
handler: async (_args, ctx) => openSettings(ctx),
|
|
1365
1380
|
});
|
|
1381
|
+
pi.registerCommand("pi-mini-mode-setup", {
|
|
1382
|
+
description: "Show the first-run setup prompt again",
|
|
1383
|
+
handler: async (_args, ctx) => runOnboarding(ctx),
|
|
1384
|
+
});
|
|
1366
1385
|
|
|
1367
1386
|
pi.on("session_start", async (_event, ctx) => {
|
|
1368
1387
|
const loaded = await loadSettings(configPath);
|
|
1369
1388
|
settings = loaded.settings;
|
|
1389
|
+
if (loaded.exists && loaded.backfilled) await persistSettings(ctx);
|
|
1370
1390
|
messageCwd = ctx.cwd;
|
|
1371
1391
|
// 输入增强只在会话中生效,会话开始时再加载;传 getter 让开关变更即时生效,重复调用是幂等的。
|
|
1372
1392
|
const { installInputEnhancements } = await import("../lib/input-enhancements.ts");
|
|
@@ -1396,7 +1416,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1396
1416
|
};
|
|
1397
1417
|
});
|
|
1398
1418
|
refresh();
|
|
1399
|
-
if (!
|
|
1419
|
+
if (!settings.onboardingCompleted && ctx.mode === "tui" && ctx.hasUI) await runOnboarding(ctx);
|
|
1400
1420
|
});
|
|
1401
1421
|
const syncMinimalBranch = (_event: unknown, ctx: ExtensionContext) => {
|
|
1402
1422
|
minimalTurns = minimalTurnsFromBranch(ctx.sessionManager.getBranch());
|
package/lib/settings.html
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
<div><code id="noticePrompt"></code><button type="button" id="copyPrompt"></button></div>
|
|
21
21
|
</div>
|
|
22
22
|
<div role="status" aria-live="polite"><span id="status"></span><button id="retry" hidden></button></div>
|
|
23
|
-
<section><h2 id="featuresHeading"></h2><div class="features" id="features"></div></section>
|
|
24
23
|
<section><h2 id="fieldsHeading"></h2><p class="hint" id="dragHint"></p><div id="preview" role="group" tabindex="0"></div><div class="grid" id="fields"></div></section>
|
|
25
24
|
<section><h2 id="optionsHeading"></h2><div class="grid" id="options"></div></section>
|
|
25
|
+
<section><h2 id="featuresHeading"></h2><div class="features" id="features"></div></section>
|
|
26
26
|
</main>
|
|
27
27
|
<script>
|
|
28
28
|
const $=id=>document.getElementById(id),token=location.hash.slice(1);
|
|
@@ -173,7 +173,7 @@ function render(){
|
|
|
173
173
|
renderNotice();
|
|
174
174
|
$('fields').replaceChildren(...order.map(id=>checkbox(id,key(id))));
|
|
175
175
|
$('features').replaceChildren(...t('featureList').map(feature));
|
|
176
|
-
$('options').replaceChildren(...[
|
|
176
|
+
$('options').replaceChildren(...(data.options||[]).map(id=>checkbox(id,FIELD_KEY[id]||key(id))));
|
|
177
177
|
preview();
|
|
178
178
|
}
|
|
179
179
|
function renderNotice(){
|
|
@@ -201,9 +201,10 @@ function setLang(next){lang=next;localStorage.piMiniModeLang=lang;render()}
|
|
|
201
201
|
$('lang-zh').onclick=()=>setLang('zh');
|
|
202
202
|
$('lang-en').onclick=()=>setLang('en');
|
|
203
203
|
$('retry').onclick=save;
|
|
204
|
-
|
|
204
|
+
function mergeOrder(base,all){const next=[...new Set((base||[]).filter(id=>(all||[]).includes(id)))];for(const id of all||[])if(!next.includes(id))next.push(id);return next}
|
|
205
|
+
$('reset').onclick=()=>{if(!confirm(t('confirmReset')))return;state={...data.defaults};order=mergeOrder(data.order,data.order);render();change()};
|
|
205
206
|
window.addEventListener('beforeunload',event=>{if(dirty||saving){event.preventDefault();event.returnValue=''}});
|
|
206
207
|
applyLang();status(t('connecting'));
|
|
207
|
-
request('GET').then(value=>{data=value;state={...data.settings};order=
|
|
208
|
+
request('GET').then(value=>{data=value;state={...data.settings};order=mergeOrder(state.footerOrder||data.order,data.order);render();$('reset').disabled=false;status(t('connected'))}).catch(()=>status(t('reconnect'),true));
|
|
208
209
|
</script>
|
|
209
210
|
</html>
|
package/package.json
CHANGED