@aiwayds/dsh-opentui 0.11.0 → 0.12.0
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/CHANGELOG.md +7 -0
- package/dist/client/index.js +407 -444
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
- **Default subagent registry plugin moves to 0.20.0.** The pinned default (`@aiwayds/dsh-subagent-registry`) is bumped from 0.19.1; provisioning stays idempotent, `--plugins=none` still disables it, and a failed install still degrades without blocking boot.
|
|
13
13
|
|
|
14
|
+
## [0.12.0] - 2026-11-13
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **`/settings` saves instantly.** Picking a value writes it through the existing local/host channels the moment it is picked — the 确定/Ctrl+S commit step, the draft buffer and the 未提交 counter are gone. The status line flashes `已保存 · <row>`; a failed save keeps the editor open with the error. The top-level Esc opens an exit confirm (取消/退出) before closing, and command-jump rows close the panel and then dispatch, so `打开 /model` really opens the model picker.
|
|
19
|
+
- **Panel colours follow the theme.** Content rows, badges, N/A notes, section titles and editor options paint through new semantic theme roles (code/user/system/heading/danger) with a 4.5:1 contrast floor; `text.danger` previously resolved to the background colour in every shipped theme. Switching themes recolours the panels with them.
|
|
20
|
+
|
|
14
21
|
## [0.11.0] - 2026-11-13
|
|
15
22
|
|
|
16
23
|
### Changed
|
package/dist/client/index.js
CHANGED
|
@@ -51032,9 +51032,10 @@ var init_contracts = __esm(() => {
|
|
|
51032
51032
|
|
|
51033
51033
|
// ../panel-kit/src/fallback.ts
|
|
51034
51034
|
import { RGBA as RGBA13, TextAttributes as TextAttributes10 } from "@opentui/core";
|
|
51035
|
-
var surface, raised, base2, muted, faint, accent, disabled, danger, warning, success, FALLBACK_THEME;
|
|
51035
|
+
var surface, content, raised, base2, muted, faint, accent, disabled, danger, warning, success, code, user, system, heading, FALLBACK_THEME;
|
|
51036
51036
|
var init_fallback = __esm(() => {
|
|
51037
51037
|
surface = RGBA13.fromHex("#1a1b26");
|
|
51038
|
+
content = RGBA13.fromHex("#1f2335");
|
|
51038
51039
|
raised = RGBA13.fromHex("#24283b");
|
|
51039
51040
|
base2 = RGBA13.fromHex("#c0caf5");
|
|
51040
51041
|
muted = RGBA13.fromHex("#a9b1d6");
|
|
@@ -51044,10 +51045,15 @@ var init_fallback = __esm(() => {
|
|
|
51044
51045
|
danger = RGBA13.fromHex("#f7768e");
|
|
51045
51046
|
warning = RGBA13.fromHex("#e0af68");
|
|
51046
51047
|
success = RGBA13.fromHex("#9ece6a");
|
|
51048
|
+
code = RGBA13.fromHex("#c3e88d");
|
|
51049
|
+
user = RGBA13.fromHex("#c0caf5");
|
|
51050
|
+
system = RGBA13.fromHex("#82aaff");
|
|
51051
|
+
heading = RGBA13.fromHex("#c099ff");
|
|
51047
51052
|
FALLBACK_THEME = Object.freeze({
|
|
51048
51053
|
background: {
|
|
51049
51054
|
surface,
|
|
51050
51055
|
raised,
|
|
51056
|
+
content,
|
|
51051
51057
|
scrim: RGBA13.fromInts(0, 0, 0, 150)
|
|
51052
51058
|
},
|
|
51053
51059
|
text: {
|
|
@@ -51058,7 +51064,11 @@ var init_fallback = __esm(() => {
|
|
|
51058
51064
|
disabled,
|
|
51059
51065
|
danger,
|
|
51060
51066
|
warning,
|
|
51061
|
-
success
|
|
51067
|
+
success,
|
|
51068
|
+
code,
|
|
51069
|
+
user,
|
|
51070
|
+
system,
|
|
51071
|
+
heading
|
|
51062
51072
|
},
|
|
51063
51073
|
row: {
|
|
51064
51074
|
activeBg: accent,
|
|
@@ -51244,10 +51254,11 @@ function clampAlpha(value) {
|
|
|
51244
51254
|
return Math.max(0, Math.min(255, Math.round(value)));
|
|
51245
51255
|
}
|
|
51246
51256
|
function resolvePanelChrome(theme) {
|
|
51257
|
+
const content = theme.background.content ?? theme.background.surface;
|
|
51247
51258
|
return {
|
|
51248
|
-
titleBand: fadeColor(
|
|
51259
|
+
titleBand: fadeColor(content, theme.background.raised, 0.5),
|
|
51249
51260
|
navBand: theme.background.raised,
|
|
51250
|
-
content
|
|
51261
|
+
content,
|
|
51251
51262
|
divider: theme.border.base.color
|
|
51252
51263
|
};
|
|
51253
51264
|
}
|
|
@@ -51260,6 +51271,20 @@ function fadeColor(from, to, t) {
|
|
|
51260
51271
|
const mix = (a, b) => a + (b - a) * progress;
|
|
51261
51272
|
return RGBA14.fromValues(mix(from.r, to.r), mix(from.g, to.g), mix(from.b, to.b), to.a);
|
|
51262
51273
|
}
|
|
51274
|
+
function srgbToLinear2(channel) {
|
|
51275
|
+
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
51276
|
+
}
|
|
51277
|
+
function relativeLuminance2(color) {
|
|
51278
|
+
return 0.2126 * srgbToLinear2(color.r) + 0.7152 * srgbToLinear2(color.g) + 0.0722 * srgbToLinear2(color.b);
|
|
51279
|
+
}
|
|
51280
|
+
function contrastRatio2(a, b) {
|
|
51281
|
+
const la = relativeLuminance2(a);
|
|
51282
|
+
const lb = relativeLuminance2(b);
|
|
51283
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
51284
|
+
}
|
|
51285
|
+
function withContrastFloor(fg, bg, fallback) {
|
|
51286
|
+
return contrastRatio2(fg, bg) < MIN_CONTRAST ? fallback : fg;
|
|
51287
|
+
}
|
|
51263
51288
|
function fadeTheme(theme, t) {
|
|
51264
51289
|
const progress = clamp012(t);
|
|
51265
51290
|
if (progress >= 1)
|
|
@@ -51274,6 +51299,7 @@ function fadeTheme(theme, t) {
|
|
|
51274
51299
|
background: {
|
|
51275
51300
|
surface,
|
|
51276
51301
|
raised: mix(theme.background.raised),
|
|
51302
|
+
content: mix(theme.background.content),
|
|
51277
51303
|
scrim: mix(theme.background.scrim)
|
|
51278
51304
|
},
|
|
51279
51305
|
text: {
|
|
@@ -51284,7 +51310,11 @@ function fadeTheme(theme, t) {
|
|
|
51284
51310
|
disabled: mix(theme.text.disabled),
|
|
51285
51311
|
danger: mix(theme.text.danger),
|
|
51286
51312
|
warning: mix(theme.text.warning),
|
|
51287
|
-
success: mix(theme.text.success)
|
|
51313
|
+
success: mix(theme.text.success),
|
|
51314
|
+
code: mix(theme.text.code),
|
|
51315
|
+
user: mix(theme.text.user),
|
|
51316
|
+
system: mix(theme.text.system),
|
|
51317
|
+
heading: mix(theme.text.heading)
|
|
51288
51318
|
},
|
|
51289
51319
|
row: {
|
|
51290
51320
|
activeBg: mix(theme.row.activeBg),
|
|
@@ -51299,7 +51329,7 @@ function fadeTheme(theme, t) {
|
|
|
51299
51329
|
identity: [mix(theme.identity[0]), mix(theme.identity[1])]
|
|
51300
51330
|
};
|
|
51301
51331
|
}
|
|
51302
|
-
var PanelKitContext, PanelKeyRoutingContext, STATIC_MOTION;
|
|
51332
|
+
var PanelKitContext, PanelKeyRoutingContext, STATIC_MOTION, MIN_CONTRAST = 4.5;
|
|
51303
51333
|
var init_theme4 = __esm(() => {
|
|
51304
51334
|
init_server();
|
|
51305
51335
|
init_contracts();
|
|
@@ -52169,6 +52199,8 @@ function toneColor(theme, tone, active) {
|
|
|
52169
52199
|
switch (tone) {
|
|
52170
52200
|
case "muted":
|
|
52171
52201
|
return theme.text.muted;
|
|
52202
|
+
case "system":
|
|
52203
|
+
return theme.text.system;
|
|
52172
52204
|
case "warning":
|
|
52173
52205
|
return theme.text.warning;
|
|
52174
52206
|
case "danger":
|
|
@@ -52177,6 +52209,19 @@ function toneColor(theme, tone, active) {
|
|
|
52177
52209
|
return theme.text.base;
|
|
52178
52210
|
}
|
|
52179
52211
|
}
|
|
52212
|
+
function descriptionColor(theme, tone) {
|
|
52213
|
+
switch (tone) {
|
|
52214
|
+
case "code":
|
|
52215
|
+
return theme.text.code;
|
|
52216
|
+
case "system":
|
|
52217
|
+
return theme.text.system;
|
|
52218
|
+
default:
|
|
52219
|
+
return theme.text.muted;
|
|
52220
|
+
}
|
|
52221
|
+
}
|
|
52222
|
+
function badgeColor(theme, tone) {
|
|
52223
|
+
return tone === "user" ? theme.text.user : theme.text.accent;
|
|
52224
|
+
}
|
|
52180
52225
|
function List(props) {
|
|
52181
52226
|
const theme = useControlTheme();
|
|
52182
52227
|
const [state, setState] = createSignal({
|
|
@@ -52375,7 +52420,7 @@ function List(props) {
|
|
|
52375
52420
|
setProp(_el$7, "wrapMode", "none");
|
|
52376
52421
|
insert(_el$7, headers);
|
|
52377
52422
|
effect((_p$) => {
|
|
52378
|
-
var _v$ = theme().attributes.group, _v$2 = theme().text.
|
|
52423
|
+
var _v$ = theme().attributes.group, _v$2 = theme().text.heading;
|
|
52379
52424
|
_v$ !== _p$.e && (_p$.e = setProp(_el$7, "attributes", _v$, _p$.e));
|
|
52380
52425
|
_v$2 !== _p$.t && (_p$.t = setProp(_el$7, "fg", _v$2, _p$.t));
|
|
52381
52426
|
return _p$;
|
|
@@ -52393,7 +52438,7 @@ function List(props) {
|
|
|
52393
52438
|
var _el$1 = createElement("text");
|
|
52394
52439
|
insert(_el$1, () => row.group.label ?? row.group.id);
|
|
52395
52440
|
effect((_p$) => {
|
|
52396
|
-
var _v$3 = theme().attributes.group, _v$4 = theme().text.
|
|
52441
|
+
var _v$3 = theme().attributes.group, _v$4 = theme().text.heading;
|
|
52397
52442
|
_v$3 !== _p$.e && (_p$.e = setProp(_el$1, "attributes", _v$3, _p$.e));
|
|
52398
52443
|
_v$4 !== _p$.t && (_p$.t = setProp(_el$1, "fg", _v$4, _p$.t));
|
|
52399
52444
|
return _p$;
|
|
@@ -52488,7 +52533,7 @@ function ListRowView(props) {
|
|
|
52488
52533
|
var _el$12 = createElement("text"), _el$13 = createTextNode(` `);
|
|
52489
52534
|
insertNode(_el$12, _el$13);
|
|
52490
52535
|
insert(_el$12, () => item.badge, _el$13);
|
|
52491
|
-
effect((_$p) => setProp(_el$12, "fg", active() ? theme().row.activeFg : theme().
|
|
52536
|
+
effect((_$p) => setProp(_el$12, "fg", active() ? theme().row.activeFg : badgeColor(theme(), item.badgeTone), _$p));
|
|
52492
52537
|
return _el$12;
|
|
52493
52538
|
}
|
|
52494
52539
|
}), _el$16);
|
|
@@ -52516,7 +52561,7 @@ function ListRowView(props) {
|
|
|
52516
52561
|
get children() {
|
|
52517
52562
|
var _el$15 = createElement("text");
|
|
52518
52563
|
insert(_el$15, () => " " + item.description);
|
|
52519
|
-
effect((_$p) => setProp(_el$15, "fg", disabled ? theme().text.disabled : active() ? theme().row.activeFg : theme().
|
|
52564
|
+
effect((_$p) => setProp(_el$15, "fg", disabled ? theme().text.disabled : active() ? theme().row.activeFg : descriptionColor(theme(), item.descriptionTone), _$p));
|
|
52520
52565
|
return _el$15;
|
|
52521
52566
|
}
|
|
52522
52567
|
}), _el$16);
|
|
@@ -52758,7 +52803,7 @@ function PanelActions(props) {
|
|
|
52758
52803
|
setProp(_el$12, "wrapMode", "none");
|
|
52759
52804
|
insert(_el$12, () => props.hint);
|
|
52760
52805
|
effect((_p$) => {
|
|
52761
|
-
var _v$12 = theme().text.
|
|
52806
|
+
var _v$12 = theme().text.system, _v$13 = theme().attributes.keyHint;
|
|
52762
52807
|
_v$12 !== _p$.e && (_p$.e = setProp(_el$12, "fg", _v$12, _p$.e));
|
|
52763
52808
|
_v$13 !== _p$.t && (_p$.t = setProp(_el$12, "attributes", _v$13, _p$.t));
|
|
52764
52809
|
return _p$;
|
|
@@ -55401,7 +55446,7 @@ var init_agents_panel = __esm(() => {
|
|
|
55401
55446
|
import { TextAttributes as TextAttributes11 } from "@opentui/core";
|
|
55402
55447
|
function resolveVersion() {
|
|
55403
55448
|
try {
|
|
55404
|
-
return "0.
|
|
55449
|
+
return "0.12.0";
|
|
55405
55450
|
} catch {
|
|
55406
55451
|
return "dev";
|
|
55407
55452
|
}
|
|
@@ -55596,209 +55641,100 @@ function buildSectionRows(id, ctx) {
|
|
|
55596
55641
|
return buildCommandRows(id);
|
|
55597
55642
|
}
|
|
55598
55643
|
}
|
|
55599
|
-
function draftKey(row) {
|
|
55600
|
-
const write = row.write;
|
|
55601
|
-
if (write === undefined)
|
|
55602
|
-
return row.id;
|
|
55603
|
-
if (write.via === "settings")
|
|
55604
|
-
return `settings:${write.ns}.${write.path.join(".")}`;
|
|
55605
|
-
if (write.key === "footerHints") {
|
|
55606
|
-
const segment = row.id.startsWith("footerHints.") ? row.id.slice("footerHints.".length) : row.id;
|
|
55607
|
-
return `footerHints.${segment}`;
|
|
55608
|
-
}
|
|
55609
|
-
return `config:${write.key}`;
|
|
55610
|
-
}
|
|
55611
55644
|
function settingsBackView(view) {
|
|
55612
55645
|
return view === "editor" ? "browse" : "close";
|
|
55613
55646
|
}
|
|
55614
|
-
function
|
|
55615
|
-
|
|
55616
|
-
|
|
55617
|
-
|
|
55618
|
-
|
|
55619
|
-
|
|
55620
|
-
if (sameAsSnapshot) {
|
|
55621
|
-
delete next[key];
|
|
55622
|
-
return next;
|
|
55647
|
+
async function writeSetting(row, value, deps) {
|
|
55648
|
+
if (row.detail !== undefined) {
|
|
55649
|
+
return {
|
|
55650
|
+
ok: false,
|
|
55651
|
+
error: `\u2718 ${row.label} \u4E0D\u53EF\u7F16\u8F91`
|
|
55652
|
+
};
|
|
55623
55653
|
}
|
|
55624
|
-
|
|
55625
|
-
|
|
55626
|
-
|
|
55627
|
-
|
|
55628
|
-
|
|
55629
|
-
|
|
55630
|
-
|
|
55631
|
-
|
|
55632
|
-
return draft ? "on" : "off";
|
|
55633
|
-
return String(draft);
|
|
55634
|
-
}
|
|
55635
|
-
function isDirty(drafts) {
|
|
55636
|
-
return Object.keys(drafts).length > 0;
|
|
55637
|
-
}
|
|
55638
|
-
async function commitSettingsDrafts(deps) {
|
|
55639
|
-
const saved = [];
|
|
55640
|
-
const attempted = [];
|
|
55641
|
-
const written = new Set;
|
|
55642
|
-
let document = deps.document;
|
|
55643
|
-
let refreshFailed = false;
|
|
55644
|
-
let liveMerged = deps.merged;
|
|
55645
|
-
for (const row of deps.rows) {
|
|
55646
|
-
const key = draftKey(row);
|
|
55647
|
-
if (written.has(key))
|
|
55648
|
-
continue;
|
|
55649
|
-
const value = deps.drafts[key];
|
|
55650
|
-
if (value === undefined)
|
|
55651
|
-
continue;
|
|
55652
|
-
written.add(key);
|
|
55653
|
-
attempted.push(key);
|
|
55654
|
-
if (row.detail !== undefined) {
|
|
55655
|
-
for (const child of row.detail) {
|
|
55656
|
-
if (deps.drafts[draftKey(child)] !== undefined) {
|
|
55657
|
-
return {
|
|
55658
|
-
ok: false,
|
|
55659
|
-
saved,
|
|
55660
|
-
attempted,
|
|
55661
|
-
error: `\u2718 ${child.label} \u4E0D\u53EF\u7F16\u8F91`,
|
|
55662
|
-
...document !== undefined ? {
|
|
55663
|
-
document
|
|
55664
|
-
} : {}
|
|
55665
|
-
};
|
|
55666
|
-
}
|
|
55667
|
-
}
|
|
55668
|
-
}
|
|
55669
|
-
if (!row.editable || row.write === undefined) {
|
|
55670
|
-
return {
|
|
55671
|
-
ok: false,
|
|
55672
|
-
saved,
|
|
55673
|
-
attempted,
|
|
55674
|
-
error: `\u2718 ${row.label} \u4E0D\u53EF\u7F16\u8F91`,
|
|
55675
|
-
...document !== undefined ? {
|
|
55676
|
-
document
|
|
55677
|
-
} : {}
|
|
55678
|
-
};
|
|
55679
|
-
}
|
|
55680
|
-
if (row.write.via === "config") {
|
|
55681
|
-
if (!deps.local) {
|
|
55682
|
-
return {
|
|
55683
|
-
ok: false,
|
|
55684
|
-
saved,
|
|
55685
|
-
attempted,
|
|
55686
|
-
error: "\u2718 \u672C\u5730\u504F\u597D\u5F53\u524D\u4E0D\u53EF\u5199",
|
|
55687
|
-
...document !== undefined ? {
|
|
55688
|
-
document
|
|
55689
|
-
} : {}
|
|
55690
|
-
};
|
|
55691
|
-
}
|
|
55692
|
-
const hints = footerHintsFromConfig(liveMerged.footerHints) ?? DEFAULT_FOOTER_HINTS;
|
|
55693
|
-
const plan = planLocalWrite(row, value, hints);
|
|
55694
|
-
if (!plan.ok) {
|
|
55695
|
-
return {
|
|
55696
|
-
ok: false,
|
|
55697
|
-
saved,
|
|
55698
|
-
attempted,
|
|
55699
|
-
error: `\u2718 ${plan.error}`,
|
|
55700
|
-
...document !== undefined ? {
|
|
55701
|
-
document
|
|
55702
|
-
} : {}
|
|
55703
|
-
};
|
|
55704
|
-
}
|
|
55705
|
-
try {
|
|
55706
|
-
deps.seam.configSave?.(plan.patch);
|
|
55707
|
-
} catch (error) {
|
|
55708
|
-
return {
|
|
55709
|
-
ok: false,
|
|
55710
|
-
saved,
|
|
55711
|
-
attempted,
|
|
55712
|
-
error: `\u2718 \u5199\u5165\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`,
|
|
55713
|
-
...document !== undefined ? {
|
|
55714
|
-
document
|
|
55715
|
-
} : {}
|
|
55716
|
-
};
|
|
55717
|
-
}
|
|
55718
|
-
liveMerged = {
|
|
55719
|
-
...liveMerged,
|
|
55720
|
-
...plan.patch
|
|
55721
|
-
};
|
|
55722
|
-
applySettingsLive(row, plan.applied, hints, deps.themes);
|
|
55723
|
-
saved.push(row.label);
|
|
55724
|
-
continue;
|
|
55725
|
-
}
|
|
55726
|
-
if (!deps.host) {
|
|
55654
|
+
if (!row.editable || row.write === undefined) {
|
|
55655
|
+
return {
|
|
55656
|
+
ok: false,
|
|
55657
|
+
error: `\u2718 ${row.label} \u4E0D\u53EF\u7F16\u8F91`
|
|
55658
|
+
};
|
|
55659
|
+
}
|
|
55660
|
+
if (row.write.via === "config") {
|
|
55661
|
+
if (!deps.local)
|
|
55727
55662
|
return {
|
|
55728
55663
|
ok: false,
|
|
55729
|
-
|
|
55730
|
-
attempted,
|
|
55731
|
-
error: "\u2718 \u5BBF\u4E3B\u8BBE\u7F6E\u5F53\u524D\u4E0D\u53EF\u5199",
|
|
55732
|
-
...document !== undefined ? {
|
|
55733
|
-
document
|
|
55734
|
-
} : {}
|
|
55664
|
+
error: "\u2718 \u672C\u5730\u504F\u597D\u5F53\u524D\u4E0D\u53EF\u5199"
|
|
55735
55665
|
};
|
|
55736
|
-
|
|
55737
|
-
const plan =
|
|
55738
|
-
if (!plan.ok)
|
|
55666
|
+
const hints = footerHintsFromConfig(deps.merged.footerHints) ?? DEFAULT_FOOTER_HINTS;
|
|
55667
|
+
const plan = planLocalWrite(row, value, hints);
|
|
55668
|
+
if (!plan.ok)
|
|
55739
55669
|
return {
|
|
55740
55670
|
ok: false,
|
|
55741
|
-
|
|
55742
|
-
attempted,
|
|
55743
|
-
error: `\u2718 ${plan.error}`,
|
|
55744
|
-
...document !== undefined ? {
|
|
55745
|
-
document
|
|
55746
|
-
} : {}
|
|
55671
|
+
error: `\u2718 ${plan.error}`
|
|
55747
55672
|
};
|
|
55748
|
-
|
|
55749
|
-
|
|
55750
|
-
|
|
55673
|
+
try {
|
|
55674
|
+
deps.seam.configSave?.(plan.patch);
|
|
55675
|
+
} catch (error) {
|
|
55751
55676
|
return {
|
|
55752
55677
|
ok: false,
|
|
55753
|
-
|
|
55754
|
-
attempted,
|
|
55755
|
-
error: "\u2718 \u5BBF\u4E3B settings \u63A5\u53E3\u4E0D\u53EF\u7528",
|
|
55756
|
-
...document !== undefined ? {
|
|
55757
|
-
document
|
|
55758
|
-
} : {}
|
|
55678
|
+
error: `\u2718 \u5199\u5165\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
55759
55679
|
};
|
|
55760
55680
|
}
|
|
55761
|
-
|
|
55762
|
-
|
|
55763
|
-
|
|
55764
|
-
|
|
55765
|
-
|
|
55766
|
-
|
|
55767
|
-
|
|
55768
|
-
|
|
55769
|
-
|
|
55770
|
-
|
|
55771
|
-
|
|
55772
|
-
|
|
55773
|
-
|
|
55774
|
-
|
|
55775
|
-
|
|
55776
|
-
|
|
55777
|
-
|
|
55778
|
-
|
|
55779
|
-
|
|
55780
|
-
|
|
55781
|
-
|
|
55782
|
-
|
|
55783
|
-
|
|
55784
|
-
|
|
55785
|
-
|
|
55786
|
-
|
|
55681
|
+
applySettingsLive(row, plan.applied, hints, deps.themes);
|
|
55682
|
+
return {
|
|
55683
|
+
ok: true,
|
|
55684
|
+
label: row.label,
|
|
55685
|
+
patch: plan.patch
|
|
55686
|
+
};
|
|
55687
|
+
}
|
|
55688
|
+
if (!deps.host)
|
|
55689
|
+
return {
|
|
55690
|
+
ok: false,
|
|
55691
|
+
error: "\u2718 \u5BBF\u4E3B\u8BBE\u7F6E\u5F53\u524D\u4E0D\u53EF\u5199"
|
|
55692
|
+
};
|
|
55693
|
+
const plan = planHostWrite(row, value);
|
|
55694
|
+
if (!plan.ok)
|
|
55695
|
+
return {
|
|
55696
|
+
ok: false,
|
|
55697
|
+
error: `\u2718 ${plan.error}`
|
|
55698
|
+
};
|
|
55699
|
+
const face = deps.seam.settings;
|
|
55700
|
+
if (face === undefined)
|
|
55701
|
+
return {
|
|
55702
|
+
ok: false,
|
|
55703
|
+
error: "\u2718 \u5BBF\u4E3B settings \u63A5\u53E3\u4E0D\u53EF\u7528"
|
|
55704
|
+
};
|
|
55705
|
+
let document = deps.document;
|
|
55706
|
+
let refreshFailed = false;
|
|
55707
|
+
try {
|
|
55708
|
+
const outcome = await commitHostWrite({
|
|
55709
|
+
mutate: (ns, ops, revision) => face.mutate(ns, ops, revision),
|
|
55710
|
+
describe: () => face.describe(),
|
|
55711
|
+
ns: plan.ns,
|
|
55712
|
+
ops: plan.ops,
|
|
55713
|
+
revision: currentHostRevision(document, plan.ns)
|
|
55714
|
+
});
|
|
55715
|
+
if (outcome.document !== undefined)
|
|
55716
|
+
document = outcome.document;
|
|
55717
|
+
if (!outcome.result.ok) {
|
|
55718
|
+
const message = outcome.result.conflict ? outcome.attempts === 1 ? "\u2718 \u51B2\u7A81\uFF1A\u8BBE\u7F6E\u5DF2\u88AB\u5176\u5B83\u5BA2\u6237\u7AEF\u4FEE\u6539\uFF0C\u4E14 settings/describe \u5931\u8D25 \u2014 \u6CA1\u6709\u6700\u65B0 revision\uFF0C\u672A\u91CD\u8BD5\u5199\u5165" : "\u2718 \u51B2\u7A81\uFF1A\u8BBE\u7F6E\u5DF2\u88AB\u5176\u5B83\u5BA2\u6237\u7AEF\u4FEE\u6539\uFF0C\u91CD\u8BD5\u4E00\u6B21\u4ECD\u51B2\u7A81\uFF08\u672A\u5199\u5165\uFF09" : `\u2718 ${outcome.result.error}`;
|
|
55787
55719
|
return {
|
|
55788
55720
|
ok: false,
|
|
55789
|
-
|
|
55790
|
-
attempted,
|
|
55791
|
-
error: `\u2718 \u5199\u5165\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`,
|
|
55721
|
+
error: message,
|
|
55792
55722
|
...document !== undefined ? {
|
|
55793
55723
|
document
|
|
55794
55724
|
} : {}
|
|
55795
55725
|
};
|
|
55796
55726
|
}
|
|
55727
|
+
if (outcome.refreshFailed === true)
|
|
55728
|
+
refreshFailed = true;
|
|
55729
|
+
} catch (error) {
|
|
55730
|
+
return {
|
|
55731
|
+
ok: false,
|
|
55732
|
+
error: `\u2718 \u5199\u5165\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
55733
|
+
};
|
|
55797
55734
|
}
|
|
55798
55735
|
return {
|
|
55799
55736
|
ok: true,
|
|
55800
|
-
|
|
55801
|
-
attempted,
|
|
55737
|
+
label: row.label,
|
|
55802
55738
|
...document !== undefined ? {
|
|
55803
55739
|
document
|
|
55804
55740
|
} : {},
|
|
@@ -55823,15 +55759,17 @@ function bodyPageSize(panelRows) {
|
|
|
55823
55759
|
const rows = Number.isFinite(panelRows) ? Math.floor(panelRows) : 24;
|
|
55824
55760
|
return Math.max(MIN_BODY_PAGE, Math.min(MAX_BODY_PAGE, rows - SETTINGS_FIXED_CHROME_ROWS));
|
|
55825
55761
|
}
|
|
55826
|
-
function rowListItems(rows
|
|
55762
|
+
function rowListItems(rows) {
|
|
55827
55763
|
return rows.map((row) => ({
|
|
55828
55764
|
id: row.id,
|
|
55829
55765
|
label: row.label,
|
|
55830
|
-
description:
|
|
55766
|
+
description: row.value,
|
|
55767
|
+
descriptionTone: "code",
|
|
55831
55768
|
...row.editable ? {
|
|
55832
|
-
badge: "\u270E"
|
|
55769
|
+
badge: "\u270E",
|
|
55770
|
+
badgeTone: "user"
|
|
55833
55771
|
} : {
|
|
55834
|
-
tone: "
|
|
55772
|
+
tone: "system"
|
|
55835
55773
|
},
|
|
55836
55774
|
...row.kind === "jump" ? {
|
|
55837
55775
|
badge: "\u203A"
|
|
@@ -55842,6 +55780,8 @@ function SettingsModalBody(props) {
|
|
|
55842
55780
|
const themeFace = () => props.themes;
|
|
55843
55781
|
const theme = usePanelTheme();
|
|
55844
55782
|
const chrome = () => resolvePanelChrome(theme());
|
|
55783
|
+
const contentBg = () => theme().background.content;
|
|
55784
|
+
const role = (fg) => withContrastFloor(fg, contentBg(), theme().text.base);
|
|
55845
55785
|
const [view, setView] = createSignal("browse");
|
|
55846
55786
|
const [pane, setPane] = createSignal("nav");
|
|
55847
55787
|
const [sectionIndex, setSectionIndex] = createSignal(0);
|
|
@@ -55849,7 +55789,6 @@ function SettingsModalBody(props) {
|
|
|
55849
55789
|
const [editorRow, setEditorRow] = createSignal(undefined);
|
|
55850
55790
|
const [editorValue, setEditorValue] = createSignal("");
|
|
55851
55791
|
const [optionCursor, setOptionCursor] = createSignal(0);
|
|
55852
|
-
const [drafts, setDrafts] = createSignal({});
|
|
55853
55792
|
const [merged, setMerged] = createSignal({});
|
|
55854
55793
|
const [profile, setProfile] = createSignal({});
|
|
55855
55794
|
const [workspace, setWorkspace] = createSignal({});
|
|
@@ -55888,7 +55827,22 @@ function SettingsModalBody(props) {
|
|
|
55888
55827
|
const currentSection = createMemo(() => sections()[sectionIndex()] ?? sections()[0]);
|
|
55889
55828
|
const currentRows = createMemo(() => currentSection().rows);
|
|
55890
55829
|
const currentRow = createMemo(() => currentRows()[rowIndex()]);
|
|
55891
|
-
const
|
|
55830
|
+
const savedLabels = [];
|
|
55831
|
+
let statusTimer;
|
|
55832
|
+
function flashSaved(label) {
|
|
55833
|
+
setStatus(`\u5DF2\u4FDD\u5B58 \xB7 ${label}`);
|
|
55834
|
+
if (statusTimer !== undefined)
|
|
55835
|
+
clearTimeout(statusTimer);
|
|
55836
|
+
statusTimer = setTimeout(() => {
|
|
55837
|
+
statusTimer = undefined;
|
|
55838
|
+
setStatus(undefined);
|
|
55839
|
+
}, 1500);
|
|
55840
|
+
}
|
|
55841
|
+
onCleanup(() => {
|
|
55842
|
+
if (statusTimer !== undefined)
|
|
55843
|
+
clearTimeout(statusTimer);
|
|
55844
|
+
statusTimer = undefined;
|
|
55845
|
+
});
|
|
55892
55846
|
const dimensions = useTerminalDimensions();
|
|
55893
55847
|
const panelRows = createMemo(() => settingsPanelRows(dimensions().height));
|
|
55894
55848
|
const pageSize = createMemo(() => bodyPageSize(panelRows()));
|
|
@@ -55934,14 +55888,16 @@ function SettingsModalBody(props) {
|
|
|
55934
55888
|
setView("browse");
|
|
55935
55889
|
setPane("rows");
|
|
55936
55890
|
setEditorRow(undefined);
|
|
55937
|
-
|
|
55891
|
+
setError(undefined);
|
|
55938
55892
|
}
|
|
55939
55893
|
function openRow(row) {
|
|
55940
55894
|
setError(undefined);
|
|
55941
55895
|
setStatus(undefined);
|
|
55942
55896
|
if (row.kind === "jump") {
|
|
55943
|
-
|
|
55897
|
+
const command = row.command ?? "";
|
|
55944
55898
|
props.onRequestClose();
|
|
55899
|
+
if (command !== "")
|
|
55900
|
+
props.onCommand?.(command);
|
|
55945
55901
|
return;
|
|
55946
55902
|
}
|
|
55947
55903
|
if (row.kind === "toggle") {
|
|
@@ -55949,8 +55905,7 @@ function SettingsModalBody(props) {
|
|
|
55949
55905
|
setStatus(row.note ?? "\u8BE5\u884C\u53EA\u8BFB");
|
|
55950
55906
|
return;
|
|
55951
55907
|
}
|
|
55952
|
-
|
|
55953
|
-
setDrafts((current) => stageDraft(current, row, next));
|
|
55908
|
+
applyRowValue(row, row.value !== "on");
|
|
55954
55909
|
return;
|
|
55955
55910
|
}
|
|
55956
55911
|
if (row.kind === "submenu") {
|
|
@@ -55964,21 +55919,65 @@ function SettingsModalBody(props) {
|
|
|
55964
55919
|
return;
|
|
55965
55920
|
}
|
|
55966
55921
|
setEditorRow(row);
|
|
55967
|
-
setEditorValue(row.kind === "number" && (row.value === "n/a" || row.value === "(unset)") ? "" :
|
|
55922
|
+
setEditorValue(row.kind === "number" && (row.value === "n/a" || row.value === "(unset)") ? "" : row.value);
|
|
55968
55923
|
if (row.kind === "enum") {
|
|
55969
55924
|
const options = row.options ?? [];
|
|
55970
|
-
const at = options.indexOf(
|
|
55925
|
+
const at = options.indexOf(row.value);
|
|
55971
55926
|
setOptionCursor(at >= 0 ? at : 0);
|
|
55972
55927
|
}
|
|
55973
55928
|
setView("editor");
|
|
55974
55929
|
}
|
|
55930
|
+
async function applyRowValue(row, value) {
|
|
55931
|
+
if (busy())
|
|
55932
|
+
return false;
|
|
55933
|
+
setBusy(true);
|
|
55934
|
+
setError(undefined);
|
|
55935
|
+
setStatus(undefined);
|
|
55936
|
+
try {
|
|
55937
|
+
const result = await writeSetting(row, value, {
|
|
55938
|
+
seam: props.seam,
|
|
55939
|
+
...props.themes !== undefined ? {
|
|
55940
|
+
themes: props.themes
|
|
55941
|
+
} : {},
|
|
55942
|
+
merged: merged(),
|
|
55943
|
+
...document() !== undefined ? {
|
|
55944
|
+
document: document()
|
|
55945
|
+
} : {},
|
|
55946
|
+
local: writable().local,
|
|
55947
|
+
host: writable().host
|
|
55948
|
+
});
|
|
55949
|
+
if (result.document !== undefined)
|
|
55950
|
+
setDocument(result.document);
|
|
55951
|
+
if (!result.ok) {
|
|
55952
|
+
setError(result.error ?? "\u2718 \u5199\u5165\u5931\u8D25");
|
|
55953
|
+
return false;
|
|
55954
|
+
}
|
|
55955
|
+
reloadLocal();
|
|
55956
|
+
if (result.patch !== undefined)
|
|
55957
|
+
setMerged((current) => ({
|
|
55958
|
+
...current,
|
|
55959
|
+
...result.patch
|
|
55960
|
+
}));
|
|
55961
|
+
reloadHost();
|
|
55962
|
+
if (result.refreshFailed === true) {
|
|
55963
|
+
setError("\u26A0 \u5DF2\u5199\u5165\uFF0C\u4F46\u8BBE\u7F6E\u5237\u65B0\u5931\u8D25\uFF08\u663E\u793A\u7684\u4ECD\u662F\u65E7\u6587\u6863\uFF09");
|
|
55964
|
+
return true;
|
|
55965
|
+
}
|
|
55966
|
+
savedLabels.push(row.label);
|
|
55967
|
+
flashSaved(row.label);
|
|
55968
|
+
props.onApplied?.([...savedLabels]);
|
|
55969
|
+
return true;
|
|
55970
|
+
} finally {
|
|
55971
|
+
setBusy(false);
|
|
55972
|
+
}
|
|
55973
|
+
}
|
|
55975
55974
|
function moveOptionCursor(delta) {
|
|
55976
55975
|
const options = editorRow()?.options ?? [];
|
|
55977
55976
|
if (options.length === 0)
|
|
55978
55977
|
return;
|
|
55979
55978
|
setOptionCursor((current) => ((current + delta) % options.length + options.length) % options.length);
|
|
55980
55979
|
}
|
|
55981
|
-
function chooseOption() {
|
|
55980
|
+
async function chooseOption() {
|
|
55982
55981
|
const row = editorRow();
|
|
55983
55982
|
if (row === undefined)
|
|
55984
55983
|
return;
|
|
@@ -55986,14 +55985,8 @@ function SettingsModalBody(props) {
|
|
|
55986
55985
|
if (option === undefined)
|
|
55987
55986
|
return;
|
|
55988
55987
|
setEditorValue(option);
|
|
55989
|
-
|
|
55990
|
-
|
|
55991
|
-
}
|
|
55992
|
-
function stageEditorValue(value) {
|
|
55993
|
-
const row = editorRow();
|
|
55994
|
-
if (row === undefined)
|
|
55995
|
-
return;
|
|
55996
|
-
setDrafts((current) => stageDraft(current, row, value));
|
|
55988
|
+
if (await applyRowValue(row, option))
|
|
55989
|
+
backToSection();
|
|
55997
55990
|
}
|
|
55998
55991
|
function stepValue(direction) {
|
|
55999
55992
|
const row = editorRow();
|
|
@@ -56007,9 +56000,8 @@ function SettingsModalBody(props) {
|
|
|
56007
56000
|
if (row.max !== undefined)
|
|
56008
56001
|
next = Math.min(row.max, next);
|
|
56009
56002
|
setEditorValue(String(next));
|
|
56010
|
-
stageEditorValue(next);
|
|
56011
56003
|
}
|
|
56012
|
-
function commitEditor() {
|
|
56004
|
+
async function commitEditor() {
|
|
56013
56005
|
const row = editorRow();
|
|
56014
56006
|
if (row === undefined)
|
|
56015
56007
|
return;
|
|
@@ -56019,110 +56011,34 @@ function SettingsModalBody(props) {
|
|
|
56019
56011
|
setError(`\u2718 ${parsed.error}`);
|
|
56020
56012
|
return;
|
|
56021
56013
|
}
|
|
56022
|
-
|
|
56023
|
-
|
|
56024
|
-
|
|
56014
|
+
if (await applyRowValue(row, parsed.value))
|
|
56015
|
+
backToSection();
|
|
56016
|
+
return;
|
|
56025
56017
|
}
|
|
56026
|
-
|
|
56018
|
+
if (await applyRowValue(row, editorValue()))
|
|
56019
|
+
backToSection();
|
|
56027
56020
|
}
|
|
56028
56021
|
function cancelEditor() {
|
|
56029
|
-
const row = editorRow();
|
|
56030
|
-
if (row !== undefined) {
|
|
56031
|
-
setDrafts((current) => {
|
|
56032
|
-
const next = {
|
|
56033
|
-
...current
|
|
56034
|
-
};
|
|
56035
|
-
delete next[draftKey(row)];
|
|
56036
|
-
return next;
|
|
56037
|
-
});
|
|
56038
|
-
}
|
|
56039
56022
|
backToSection();
|
|
56040
56023
|
}
|
|
56041
|
-
function discardAndClose() {
|
|
56042
|
-
setDrafts({});
|
|
56043
|
-
props.onRequestClose();
|
|
56044
|
-
}
|
|
56045
56024
|
const panels = usePanels();
|
|
56046
|
-
let
|
|
56047
|
-
async function
|
|
56048
|
-
if (
|
|
56049
|
-
discardAndClose();
|
|
56025
|
+
let confirmingExit = false;
|
|
56026
|
+
async function requestExitConfirm() {
|
|
56027
|
+
if (confirmingExit)
|
|
56050
56028
|
return;
|
|
56051
|
-
|
|
56052
|
-
if (confirmingDiscard)
|
|
56053
|
-
return;
|
|
56054
|
-
confirmingDiscard = true;
|
|
56029
|
+
confirmingExit = true;
|
|
56055
56030
|
try {
|
|
56056
|
-
const
|
|
56057
|
-
|
|
56058
|
-
|
|
56059
|
-
|
|
56060
|
-
confirmLabel: "\u4E22\u5F03",
|
|
56031
|
+
const exit = await panels.confirm({
|
|
56032
|
+
title: "\u9000\u51FA\u8BBE\u7F6E\uFF1F",
|
|
56033
|
+
message: "\u6240\u6709\u6539\u52A8\u5DF2\u5373\u65F6\u4FDD\u5B58\u3002",
|
|
56034
|
+
confirmLabel: "\u9000\u51FA",
|
|
56061
56035
|
cancelLabel: "\u53D6\u6D88",
|
|
56062
|
-
destructive: true
|
|
56063
|
-
tone: "danger"
|
|
56036
|
+
destructive: true
|
|
56064
56037
|
});
|
|
56065
|
-
if (
|
|
56066
|
-
|
|
56038
|
+
if (exit)
|
|
56039
|
+
props.onRequestClose();
|
|
56067
56040
|
} catch {} finally {
|
|
56068
|
-
|
|
56069
|
-
}
|
|
56070
|
-
}
|
|
56071
|
-
async function confirm() {
|
|
56072
|
-
if (busy())
|
|
56073
|
-
return;
|
|
56074
|
-
if (!dirty()) {
|
|
56075
|
-
props.onRequestClose();
|
|
56076
|
-
return;
|
|
56077
|
-
}
|
|
56078
|
-
setBusy(true);
|
|
56079
|
-
setError(undefined);
|
|
56080
|
-
try {
|
|
56081
|
-
const result = await commitSettingsDrafts({
|
|
56082
|
-
seam: props.seam,
|
|
56083
|
-
...props.themes !== undefined ? {
|
|
56084
|
-
themes: props.themes
|
|
56085
|
-
} : {},
|
|
56086
|
-
rows: sections().flatMap((section) => section.rows),
|
|
56087
|
-
drafts: drafts(),
|
|
56088
|
-
merged: merged(),
|
|
56089
|
-
...document() !== undefined ? {
|
|
56090
|
-
document: document()
|
|
56091
|
-
} : {},
|
|
56092
|
-
local: writable().local,
|
|
56093
|
-
host: writable().host
|
|
56094
|
-
});
|
|
56095
|
-
if (result.document !== undefined)
|
|
56096
|
-
setDocument(result.document);
|
|
56097
|
-
if (!result.ok) {
|
|
56098
|
-
const attempted = new Set(result.attempted);
|
|
56099
|
-
reloadLocal();
|
|
56100
|
-
await reloadHost();
|
|
56101
|
-
setDrafts((current) => {
|
|
56102
|
-
const next = {};
|
|
56103
|
-
for (const [key, value] of Object.entries(current)) {
|
|
56104
|
-
if (!attempted.has(key))
|
|
56105
|
-
next[key] = value;
|
|
56106
|
-
}
|
|
56107
|
-
return next;
|
|
56108
|
-
});
|
|
56109
|
-
setError(result.error ?? "\u2718 \u5199\u5165\u5931\u8D25");
|
|
56110
|
-
return;
|
|
56111
|
-
}
|
|
56112
|
-
setDrafts({});
|
|
56113
|
-
reloadLocal();
|
|
56114
|
-
await reloadHost();
|
|
56115
|
-
if (result.refreshFailed === true) {
|
|
56116
|
-
setError("\u26A0 \u5DF2\u5199\u5165\uFF0C\u4F46\u8BBE\u7F6E\u5237\u65B0\u5931\u8D25\uFF08\u663E\u793A\u7684\u4ECD\u662F\u65E7\u6587\u6863\uFF09");
|
|
56117
|
-
return;
|
|
56118
|
-
}
|
|
56119
|
-
if (result.saved.length > 0) {
|
|
56120
|
-
setStatus(settingsSummary(result.saved));
|
|
56121
|
-
props.onApplied?.(result.saved);
|
|
56122
|
-
}
|
|
56123
|
-
props.onRequestClose();
|
|
56124
|
-
} finally {
|
|
56125
|
-
setBusy(false);
|
|
56041
|
+
confirmingExit = false;
|
|
56126
56042
|
}
|
|
56127
56043
|
}
|
|
56128
56044
|
const registerKeys = useControlKeys();
|
|
@@ -56227,7 +56143,7 @@ function SettingsModalBody(props) {
|
|
|
56227
56143
|
escape: () => {
|
|
56228
56144
|
const next = settingsBackView(view());
|
|
56229
56145
|
if (next === "close") {
|
|
56230
|
-
|
|
56146
|
+
requestExitConfirm();
|
|
56231
56147
|
return true;
|
|
56232
56148
|
}
|
|
56233
56149
|
backToSection();
|
|
@@ -56281,14 +56197,6 @@ function SettingsModalBody(props) {
|
|
|
56281
56197
|
title: "Settings: last row",
|
|
56282
56198
|
group: "Settings",
|
|
56283
56199
|
run: () => pageRows("end")
|
|
56284
|
-
}, {
|
|
56285
|
-
bind: "ctrl+s",
|
|
56286
|
-
title: "Settings: commit",
|
|
56287
|
-
group: "Settings",
|
|
56288
|
-
run: () => {
|
|
56289
|
-
confirm();
|
|
56290
|
-
return true;
|
|
56291
|
-
}
|
|
56292
56200
|
}]
|
|
56293
56201
|
}));
|
|
56294
56202
|
onMount(() => {
|
|
@@ -56315,10 +56223,11 @@ function SettingsModalBody(props) {
|
|
|
56315
56223
|
const navItems = createMemo(() => sections().map((section) => ({
|
|
56316
56224
|
id: section.id,
|
|
56317
56225
|
label: section.label,
|
|
56318
|
-
description: `${section.rows.length}
|
|
56226
|
+
description: `${section.rows.length}`,
|
|
56227
|
+
descriptionTone: "system"
|
|
56319
56228
|
})));
|
|
56320
56229
|
const rowWidth = () => settingsRowWidth(dimensions().width, dimensions().height);
|
|
56321
|
-
const rowItems = createMemo(() => rowListItems(visibleRows()
|
|
56230
|
+
const rowItems = createMemo(() => rowListItems(visibleRows()));
|
|
56322
56231
|
const activeRowId = () => currentRow()?.id;
|
|
56323
56232
|
const pageIndicator = () => {
|
|
56324
56233
|
const total = currentRows().length;
|
|
@@ -56329,7 +56238,7 @@ function SettingsModalBody(props) {
|
|
|
56329
56238
|
return ` ${start + 1}-${Math.min(start + size, total)}/${total}`;
|
|
56330
56239
|
};
|
|
56331
56240
|
return (() => {
|
|
56332
|
-
var _el$ = createElement("box"), _el$0 = createElement("box"), _el$1 = createElement("box"), _el$10 = createElement("
|
|
56241
|
+
var _el$ = createElement("box"), _el$0 = createElement("box"), _el$1 = createElement("box"), _el$10 = createElement("text"), _el$12 = createElement("text");
|
|
56333
56242
|
insertNode(_el$, _el$0);
|
|
56334
56243
|
setProp(_el$, "flexDirection", "column");
|
|
56335
56244
|
setProp(_el$, "flexGrow", 1);
|
|
@@ -56401,13 +56310,13 @@ function SettingsModalBody(props) {
|
|
|
56401
56310
|
get children() {
|
|
56402
56311
|
var _el$8 = createElement("text");
|
|
56403
56312
|
insert(_el$8, () => ` ${currentRow().note}`);
|
|
56404
|
-
effect((_$p) => setProp(_el$8, "fg", theme().text.muted, _$p));
|
|
56313
|
+
effect((_$p) => setProp(_el$8, "fg", role(theme().text.muted), _$p));
|
|
56405
56314
|
return _el$8;
|
|
56406
56315
|
}
|
|
56407
56316
|
}), (() => {
|
|
56408
56317
|
var _el$9 = createElement("text");
|
|
56409
56318
|
insert(_el$9, () => `${pane() === "nav" ? "\u2191\u2193 \u9009\u62E9\u5206\u8282 \xB7 \u2192/Enter \u8FDB\u5165\u5185\u5BB9" : "\u2191\u2193 \u9009\u62E9\u884C \xB7 Enter \u7F16\u8F91 \xB7 \u2190/Esc \u8FD4\u56DE"}${pageIndicator()}`);
|
|
56410
|
-
effect((_$p) => setProp(_el$9, "fg", theme().text.muted, _$p));
|
|
56319
|
+
effect((_$p) => setProp(_el$9, "fg", role(theme().text.muted), _$p));
|
|
56411
56320
|
return _el$9;
|
|
56412
56321
|
})()];
|
|
56413
56322
|
}
|
|
@@ -56431,84 +56340,68 @@ function SettingsModalBody(props) {
|
|
|
56431
56340
|
return Math.max(1, pageSize() - 2);
|
|
56432
56341
|
},
|
|
56433
56342
|
onValue: setEditorValue,
|
|
56434
|
-
onStage: stageEditorValue,
|
|
56435
56343
|
onStep: stepValue,
|
|
56436
|
-
onCommit: commitEditor,
|
|
56344
|
+
onCommit: () => void commitEditor(),
|
|
56437
56345
|
onCancel: cancelEditor
|
|
56438
56346
|
});
|
|
56439
56347
|
}
|
|
56440
56348
|
}), null);
|
|
56441
56349
|
effect((_p$) => {
|
|
56442
|
-
var _v$ = chrome().navBand, _v$2 = chrome().divider, _v$3 = chrome().titleBand, _v$
|
|
56350
|
+
var _v$ = chrome().navBand, _v$2 = chrome().divider, _v$3 = contentBg(), _v$4 = chrome().titleBand, _v$5 = TextAttributes11.BOLD, _v$6 = role(theme().text.heading);
|
|
56443
56351
|
_v$ !== _p$.e && (_p$.e = setProp(_el$3, "backgroundColor", _v$, _p$.e));
|
|
56444
56352
|
_v$2 !== _p$.t && (_p$.t = setProp(_el$4, "backgroundColor", _v$2, _p$.t));
|
|
56445
|
-
_v$3 !== _p$.a && (_p$.a = setProp(_el$
|
|
56446
|
-
_v$4 !== _p$.o && (_p$.o = setProp(_el$
|
|
56447
|
-
_v$5 !== _p$.i && (_p$.i = setProp(_el$7, "
|
|
56353
|
+
_v$3 !== _p$.a && (_p$.a = setProp(_el$5, "backgroundColor", _v$3, _p$.a));
|
|
56354
|
+
_v$4 !== _p$.o && (_p$.o = setProp(_el$6, "backgroundColor", _v$4, _p$.o));
|
|
56355
|
+
_v$5 !== _p$.i && (_p$.i = setProp(_el$7, "attributes", _v$5, _p$.i));
|
|
56356
|
+
_v$6 !== _p$.n && (_p$.n = setProp(_el$7, "fg", _v$6, _p$.n));
|
|
56448
56357
|
return _p$;
|
|
56449
56358
|
}, {
|
|
56450
56359
|
e: undefined,
|
|
56451
56360
|
t: undefined,
|
|
56452
56361
|
a: undefined,
|
|
56453
56362
|
o: undefined,
|
|
56454
|
-
i: undefined
|
|
56363
|
+
i: undefined,
|
|
56364
|
+
n: undefined
|
|
56455
56365
|
});
|
|
56456
56366
|
return _el$2;
|
|
56457
56367
|
}
|
|
56458
56368
|
}), _el$0);
|
|
56459
56369
|
insertNode(_el$0, _el$1);
|
|
56460
56370
|
insertNode(_el$0, _el$12);
|
|
56461
|
-
setProp(_el$0, "flexDirection", "
|
|
56371
|
+
setProp(_el$0, "flexDirection", "row");
|
|
56372
|
+
setProp(_el$0, "justifyContent", "space-between");
|
|
56462
56373
|
setProp(_el$0, "flexShrink", 0);
|
|
56374
|
+
setProp(_el$0, "gap", 2);
|
|
56463
56375
|
insertNode(_el$1, _el$10);
|
|
56464
|
-
insertNode(_el$1, _el$11);
|
|
56465
|
-
setProp(_el$1, "flexDirection", "row");
|
|
56466
|
-
setProp(_el$1, "justifyContent", "space-between");
|
|
56467
56376
|
setProp(_el$1, "flexShrink", 0);
|
|
56468
|
-
setProp(_el$1, "
|
|
56469
|
-
setProp(_el$
|
|
56470
|
-
|
|
56471
|
-
setProp(_el$10, "
|
|
56472
|
-
|
|
56473
|
-
|
|
56474
|
-
keyHint: "esc",
|
|
56475
|
-
variant: "ghost",
|
|
56476
|
-
onPress: () => void requestDiscardOrClose()
|
|
56477
|
-
}));
|
|
56478
|
-
setProp(_el$11, "flexShrink", 0);
|
|
56479
|
-
setProp(_el$11, "border", ["left", "right"]);
|
|
56480
|
-
setProp(_el$11, "borderStyle", "single");
|
|
56481
|
-
insert(_el$11, createComponent2(Button, {
|
|
56482
|
-
label: "\u786E\u5B9A",
|
|
56483
|
-
keyHint: "ctrl+s",
|
|
56484
|
-
variant: "primary",
|
|
56485
|
-
get disabled() {
|
|
56486
|
-
return busy();
|
|
56487
|
-
},
|
|
56488
|
-
onPress: () => void confirm()
|
|
56489
|
-
}));
|
|
56490
|
-
insertNode(_el$12, _el$13);
|
|
56491
|
-
setProp(_el$12, "flexDirection", "row");
|
|
56492
|
-
setProp(_el$12, "justifyContent", "flex-end");
|
|
56493
|
-
setProp(_el$13, "wrapMode", "none");
|
|
56494
|
-
insert(_el$13, () => error() ?? status() ?? (dirty() ? `\u672A\u63D0\u4EA4\uFF1A${Object.keys(drafts()).length} \u9879 \xB7 \u786E\u5B9A\u63D0\u4EA4 / \u53D6\u6D88\u4E22\u5F03` : "\u65E0\u672A\u63D0\u4EA4\u6539\u52A8"));
|
|
56377
|
+
setProp(_el$1, "border", ["left", "right"]);
|
|
56378
|
+
setProp(_el$1, "borderStyle", "single");
|
|
56379
|
+
insertNode(_el$10, createTextNode(`esc \u8FD4\u56DE`));
|
|
56380
|
+
setProp(_el$10, "wrapMode", "none");
|
|
56381
|
+
setProp(_el$12, "wrapMode", "none");
|
|
56382
|
+
insert(_el$12, () => error() ?? status() ?? "\u6539\u52A8\u5DF2\u5373\u65F6\u4FDD\u5B58");
|
|
56495
56383
|
effect((_p$) => {
|
|
56496
|
-
var _v$
|
|
56497
|
-
_v$
|
|
56498
|
-
_v$
|
|
56499
|
-
_v$
|
|
56500
|
-
_v$
|
|
56384
|
+
var _v$7 = chrome().divider, _v$8 = theme().text.muted, _v$9 = theme().attributes.keyHint, _v$0 = role(error() !== undefined ? theme().text.danger : theme().text.system), _v$1 = theme().attributes.keyHint;
|
|
56385
|
+
_v$7 !== _p$.e && (_p$.e = setProp(_el$1, "borderColor", _v$7, _p$.e));
|
|
56386
|
+
_v$8 !== _p$.t && (_p$.t = setProp(_el$10, "fg", _v$8, _p$.t));
|
|
56387
|
+
_v$9 !== _p$.a && (_p$.a = setProp(_el$10, "attributes", _v$9, _p$.a));
|
|
56388
|
+
_v$0 !== _p$.o && (_p$.o = setProp(_el$12, "fg", _v$0, _p$.o));
|
|
56389
|
+
_v$1 !== _p$.i && (_p$.i = setProp(_el$12, "attributes", _v$1, _p$.i));
|
|
56501
56390
|
return _p$;
|
|
56502
56391
|
}, {
|
|
56503
56392
|
e: undefined,
|
|
56504
56393
|
t: undefined,
|
|
56505
56394
|
a: undefined,
|
|
56506
|
-
o: undefined
|
|
56395
|
+
o: undefined,
|
|
56396
|
+
i: undefined
|
|
56507
56397
|
});
|
|
56508
56398
|
return _el$;
|
|
56509
56399
|
})();
|
|
56510
56400
|
}
|
|
56511
56401
|
function EditorView(props) {
|
|
56402
|
+
const theme = usePanelTheme();
|
|
56403
|
+
const contentBg = () => theme().background.content;
|
|
56404
|
+
const role = (fg) => withContrastFloor(fg, contentBg(), theme().text.base);
|
|
56512
56405
|
let catcher;
|
|
56513
56406
|
const options = () => props.row.options ?? [];
|
|
56514
56407
|
const optionLimit = () => Math.max(1, props.optionRows);
|
|
@@ -56529,23 +56422,24 @@ function EditorView(props) {
|
|
|
56529
56422
|
return ` ${start + 1}-${Math.min(start + limit, total)}/${total}`;
|
|
56530
56423
|
};
|
|
56531
56424
|
return (() => {
|
|
56532
|
-
var _el$
|
|
56533
|
-
insertNode(_el$
|
|
56534
|
-
insertNode(_el$
|
|
56535
|
-
setProp(_el$
|
|
56536
|
-
setProp(_el$
|
|
56537
|
-
insert(_el$
|
|
56538
|
-
insert(_el$
|
|
56425
|
+
var _el$13 = createElement("box"), _el$14 = createElement("text"), _el$22 = createElement("text");
|
|
56426
|
+
insertNode(_el$13, _el$14);
|
|
56427
|
+
insertNode(_el$13, _el$22);
|
|
56428
|
+
setProp(_el$13, "flexDirection", "column");
|
|
56429
|
+
setProp(_el$13, "flexGrow", 1);
|
|
56430
|
+
insert(_el$14, () => `${props.row.label} \u2014 ${props.row.kind === "number" ? "\u8F93\u5165\u6574\u6570" : props.row.kind === "enum" ? "\u9009\u62E9\u503C" : "\u67E5\u770B"}`);
|
|
56431
|
+
insert(_el$13, createComponent2(Show, {
|
|
56539
56432
|
get when() {
|
|
56540
56433
|
return props.row.note !== undefined;
|
|
56541
56434
|
},
|
|
56542
56435
|
get children() {
|
|
56543
|
-
var _el$
|
|
56544
|
-
insert(_el$
|
|
56545
|
-
|
|
56436
|
+
var _el$15 = createElement("text");
|
|
56437
|
+
insert(_el$15, () => ` ${props.row.note}`);
|
|
56438
|
+
effect((_$p) => setProp(_el$15, "fg", role(theme().text.system), _$p));
|
|
56439
|
+
return _el$15;
|
|
56546
56440
|
}
|
|
56547
|
-
}), _el$
|
|
56548
|
-
insert(_el$
|
|
56441
|
+
}), _el$22);
|
|
56442
|
+
insert(_el$13, createComponent2(Show, {
|
|
56549
56443
|
get when() {
|
|
56550
56444
|
return props.row.kind === "submenu";
|
|
56551
56445
|
},
|
|
@@ -56555,92 +56449,133 @@ function EditorView(props) {
|
|
|
56555
56449
|
return props.row.detail ?? [];
|
|
56556
56450
|
},
|
|
56557
56451
|
children: (child) => (() => {
|
|
56558
|
-
var _el$
|
|
56559
|
-
insertNode(_el$
|
|
56560
|
-
setProp(_el$
|
|
56561
|
-
insert(_el$
|
|
56562
|
-
insert(_el$
|
|
56452
|
+
var _el$23 = createElement("box"), _el$24 = createElement("text");
|
|
56453
|
+
insertNode(_el$23, _el$24);
|
|
56454
|
+
setProp(_el$23, "flexDirection", "column");
|
|
56455
|
+
insert(_el$24, () => ` ${child.label} ${child.value}`);
|
|
56456
|
+
insert(_el$23, createComponent2(Show, {
|
|
56563
56457
|
get when() {
|
|
56564
56458
|
return child.note !== undefined;
|
|
56565
56459
|
},
|
|
56566
56460
|
get children() {
|
|
56567
|
-
var _el$
|
|
56568
|
-
insert(_el$
|
|
56569
|
-
|
|
56461
|
+
var _el$25 = createElement("text");
|
|
56462
|
+
insert(_el$25, () => ` ${child.note}`);
|
|
56463
|
+
effect((_$p) => setProp(_el$25, "fg", role(theme().text.system), _$p));
|
|
56464
|
+
return _el$25;
|
|
56570
56465
|
}
|
|
56571
56466
|
}), null);
|
|
56572
|
-
|
|
56467
|
+
effect((_$p) => setProp(_el$24, "fg", role(theme().text.base), _$p));
|
|
56468
|
+
return _el$23;
|
|
56573
56469
|
})()
|
|
56574
56470
|
});
|
|
56575
56471
|
}
|
|
56576
|
-
}), _el$
|
|
56577
|
-
insert(_el$
|
|
56472
|
+
}), _el$22);
|
|
56473
|
+
insert(_el$13, createComponent2(Show, {
|
|
56578
56474
|
get when() {
|
|
56579
56475
|
return props.row.kind === "enum";
|
|
56580
56476
|
},
|
|
56581
56477
|
get children() {
|
|
56582
|
-
var _el$
|
|
56583
|
-
setProp(_el$
|
|
56584
|
-
insert(_el$
|
|
56478
|
+
var _el$16 = createElement("box");
|
|
56479
|
+
setProp(_el$16, "flexDirection", "column");
|
|
56480
|
+
insert(_el$16, createComponent2(For, {
|
|
56585
56481
|
get each() {
|
|
56586
56482
|
return visibleOptions();
|
|
56587
56483
|
},
|
|
56588
56484
|
children: (option, index) => (() => {
|
|
56589
|
-
var _el$
|
|
56590
|
-
insertNode(_el$
|
|
56591
|
-
|
|
56592
|
-
setProp(_el$
|
|
56485
|
+
var _el$26 = createElement("box"), _el$27 = createElement("text"), _el$28 = createElement("text");
|
|
56486
|
+
insertNode(_el$26, _el$27);
|
|
56487
|
+
insertNode(_el$26, _el$28);
|
|
56488
|
+
setProp(_el$26, "flexDirection", "row");
|
|
56489
|
+
setProp(_el$26, "onMouseUp", () => {
|
|
56593
56490
|
props.onValue(option);
|
|
56594
56491
|
props.onCommit();
|
|
56595
56492
|
});
|
|
56596
|
-
insert(_el$
|
|
56597
|
-
|
|
56493
|
+
insert(_el$27, () => optionStart() + index() === props.cursor ? "\u25B8 " : " ");
|
|
56494
|
+
insert(_el$28, option);
|
|
56495
|
+
insert(_el$26, createComponent2(Show, {
|
|
56496
|
+
get when() {
|
|
56497
|
+
return option === props.row.value;
|
|
56498
|
+
},
|
|
56499
|
+
get children() {
|
|
56500
|
+
var _el$29 = createElement("text");
|
|
56501
|
+
insertNode(_el$29, createTextNode(` (current)`));
|
|
56502
|
+
effect((_$p) => setProp(_el$29, "fg", role(theme().text.system), _$p));
|
|
56503
|
+
return _el$29;
|
|
56504
|
+
}
|
|
56505
|
+
}), null);
|
|
56506
|
+
effect((_p$) => {
|
|
56507
|
+
var _v$15 = role(theme().text.accent), _v$16 = role(theme().text.code);
|
|
56508
|
+
_v$15 !== _p$.e && (_p$.e = setProp(_el$27, "fg", _v$15, _p$.e));
|
|
56509
|
+
_v$16 !== _p$.t && (_p$.t = setProp(_el$28, "fg", _v$16, _p$.t));
|
|
56510
|
+
return _p$;
|
|
56511
|
+
}, {
|
|
56512
|
+
e: undefined,
|
|
56513
|
+
t: undefined
|
|
56514
|
+
});
|
|
56515
|
+
return _el$26;
|
|
56598
56516
|
})()
|
|
56599
56517
|
}), null);
|
|
56600
|
-
insert(_el$
|
|
56518
|
+
insert(_el$16, createComponent2(Show, {
|
|
56601
56519
|
get when() {
|
|
56602
56520
|
return optionIndicator() !== "";
|
|
56603
56521
|
},
|
|
56604
56522
|
get children() {
|
|
56605
|
-
var _el$
|
|
56606
|
-
insert(_el$
|
|
56607
|
-
|
|
56523
|
+
var _el$17 = createElement("text");
|
|
56524
|
+
insert(_el$17, optionIndicator);
|
|
56525
|
+
effect((_$p) => setProp(_el$17, "fg", role(theme().text.system), _$p));
|
|
56526
|
+
return _el$17;
|
|
56608
56527
|
}
|
|
56609
56528
|
}), null);
|
|
56610
|
-
return _el$
|
|
56529
|
+
return _el$16;
|
|
56611
56530
|
}
|
|
56612
|
-
}), _el$
|
|
56613
|
-
insert(_el$
|
|
56531
|
+
}), _el$22);
|
|
56532
|
+
insert(_el$13, createComponent2(Show, {
|
|
56614
56533
|
get when() {
|
|
56615
56534
|
return props.row.kind === "number" || props.row.kind === "text";
|
|
56616
56535
|
},
|
|
56617
56536
|
get children() {
|
|
56618
|
-
var _el$
|
|
56619
|
-
insertNode(_el$
|
|
56620
|
-
insertNode(_el$
|
|
56621
|
-
insertNode(_el$
|
|
56622
|
-
setProp(_el$
|
|
56623
|
-
insert(_el$
|
|
56624
|
-
insert(_el$
|
|
56537
|
+
var _el$18 = createElement("box"), _el$19 = createElement("text"), _el$20 = createElement("text"), _el$21 = createElement("input");
|
|
56538
|
+
insertNode(_el$18, _el$19);
|
|
56539
|
+
insertNode(_el$18, _el$20);
|
|
56540
|
+
insertNode(_el$18, _el$21);
|
|
56541
|
+
setProp(_el$18, "flexDirection", "row");
|
|
56542
|
+
insert(_el$19, () => `${props.row.kind === "number" ? "\u6570\u503C" : "\u503C"}: `);
|
|
56543
|
+
insert(_el$20, () => props.value);
|
|
56625
56544
|
use((renderable) => {
|
|
56626
56545
|
catcher = renderable;
|
|
56627
56546
|
setTimeout(() => {
|
|
56628
56547
|
if (catcher !== undefined && catcher.isDestroyed !== true)
|
|
56629
56548
|
catcher.focus();
|
|
56630
56549
|
}, 1);
|
|
56631
|
-
}, _el$
|
|
56632
|
-
setProp(_el$
|
|
56633
|
-
setProp(_el$
|
|
56634
|
-
|
|
56635
|
-
|
|
56550
|
+
}, _el$21);
|
|
56551
|
+
setProp(_el$21, "flexGrow", 1);
|
|
56552
|
+
setProp(_el$21, "onInput", (next) => props.onValue(next));
|
|
56553
|
+
setProp(_el$21, "onSubmit", () => props.onCommit());
|
|
56554
|
+
effect((_p$) => {
|
|
56555
|
+
var _v$10 = role(theme().text.muted), _v$11 = role(theme().text.code), _v$12 = props.value;
|
|
56556
|
+
_v$10 !== _p$.e && (_p$.e = setProp(_el$19, "fg", _v$10, _p$.e));
|
|
56557
|
+
_v$11 !== _p$.t && (_p$.t = setProp(_el$20, "fg", _v$11, _p$.t));
|
|
56558
|
+
_v$12 !== _p$.a && (_p$.a = setProp(_el$21, "value", _v$12, _p$.a));
|
|
56559
|
+
return _p$;
|
|
56560
|
+
}, {
|
|
56561
|
+
e: undefined,
|
|
56562
|
+
t: undefined,
|
|
56563
|
+
a: undefined
|
|
56636
56564
|
});
|
|
56637
|
-
|
|
56638
|
-
effect((_$p) => setProp(_el$22, "value", props.value, _$p));
|
|
56639
|
-
return _el$19;
|
|
56565
|
+
return _el$18;
|
|
56640
56566
|
}
|
|
56641
|
-
}), _el$
|
|
56642
|
-
insert(_el$
|
|
56643
|
-
|
|
56567
|
+
}), _el$22);
|
|
56568
|
+
insert(_el$22, () => props.row.kind === "enum" ? "\u2191\u2193 \u9009\u62E9 \xB7 Enter/Space \u4FDD\u5B58\u5E76\u8FD4\u56DE \xB7 Esc \u8FD4\u56DE" : "Enter \u4FDD\u5B58\u5E76\u8FD4\u56DE \xB7 Esc \u8FD4\u56DE \xB7 \u5DE6/\u53F3 \u8C03\u6574\u6570\u503C");
|
|
56569
|
+
effect((_p$) => {
|
|
56570
|
+
var _v$13 = role(theme().text.heading), _v$14 = role(theme().text.faint);
|
|
56571
|
+
_v$13 !== _p$.e && (_p$.e = setProp(_el$14, "fg", _v$13, _p$.e));
|
|
56572
|
+
_v$14 !== _p$.t && (_p$.t = setProp(_el$22, "fg", _v$14, _p$.t));
|
|
56573
|
+
return _p$;
|
|
56574
|
+
}, {
|
|
56575
|
+
e: undefined,
|
|
56576
|
+
t: undefined
|
|
56577
|
+
});
|
|
56578
|
+
return _el$13;
|
|
56644
56579
|
})();
|
|
56645
56580
|
}
|
|
56646
56581
|
function SettingsModalHost(props) {
|
|
@@ -56679,7 +56614,7 @@ function SettingsModalHost(props) {
|
|
|
56679
56614
|
})), {
|
|
56680
56615
|
id: "settings-modal",
|
|
56681
56616
|
title: "Settings",
|
|
56682
|
-
subtitle: "\u5206\u8282\u5BFC\u822A \xB7
|
|
56617
|
+
subtitle: "\u5206\u8282\u5BFC\u822A \xB7 \u5373\u65F6\u4FDD\u5B58 \xB7 Esc \u9010\u5C42\u8FD4\u56DE",
|
|
56683
56618
|
size: "xlarge",
|
|
56684
56619
|
rows: settingsPanelRows(dimensions().height),
|
|
56685
56620
|
layered: true,
|
|
@@ -56694,10 +56629,10 @@ function SettingsModalHost(props) {
|
|
|
56694
56629
|
setOpen(true);
|
|
56695
56630
|
});
|
|
56696
56631
|
return (() => {
|
|
56697
|
-
var _el$
|
|
56698
|
-
setProp(_el$
|
|
56699
|
-
setProp(_el$
|
|
56700
|
-
return _el$
|
|
56632
|
+
var _el$31 = createElement("box");
|
|
56633
|
+
setProp(_el$31, "height", 0);
|
|
56634
|
+
setProp(_el$31, "flexShrink", 0);
|
|
56635
|
+
return _el$31;
|
|
56701
56636
|
})();
|
|
56702
56637
|
}
|
|
56703
56638
|
var SETTINGS_SECTIONS, COMMAND_SECTIONS, NAV_WIDTH = 20, SETTINGS_PANEL_RATIO = 0.75, SETTINGS_PANEL_MIN_ROWS = 18, MIN_BODY_PAGE = 4, MAX_BODY_PAGE = 24, SETTINGS_FIXED_CHROME_ROWS = 12;
|
|
@@ -56711,6 +56646,7 @@ var init_settings_modal = __esm(() => {
|
|
|
56711
56646
|
init_index_bun();
|
|
56712
56647
|
init_index_bun();
|
|
56713
56648
|
init_index_bun();
|
|
56649
|
+
init_index_bun();
|
|
56714
56650
|
init_server();
|
|
56715
56651
|
init_index_bun();
|
|
56716
56652
|
init_src2();
|
|
@@ -57056,29 +56992,60 @@ function createClipboardAdapter(clipboard) {
|
|
|
57056
56992
|
}
|
|
57057
56993
|
var init_clipboard2 = () => {};
|
|
57058
56994
|
|
|
56995
|
+
// ../tui-base/src/theme/contrast.ts
|
|
56996
|
+
function relativeLuminance3(color) {
|
|
56997
|
+
const [r, g, b] = color.toInts();
|
|
56998
|
+
const channel = (value) => {
|
|
56999
|
+
const c = value / 255;
|
|
57000
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
57001
|
+
};
|
|
57002
|
+
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
|
|
57003
|
+
}
|
|
57004
|
+
function contrastRatio3(a, b) {
|
|
57005
|
+
const la = relativeLuminance3(a);
|
|
57006
|
+
const lb = relativeLuminance3(b);
|
|
57007
|
+
const hi = Math.max(la, lb);
|
|
57008
|
+
const lo = Math.min(la, lb);
|
|
57009
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
57010
|
+
}
|
|
57011
|
+
function ensureContrast(foreground, background, min = 4.5, fallback = foreground) {
|
|
57012
|
+
return contrastRatio3(foreground, background) >= min ? foreground : fallback;
|
|
57013
|
+
}
|
|
57014
|
+
|
|
57059
57015
|
// ../tui-base/src/context/panel-kit-host.tsx
|
|
57060
57016
|
import { RGBA as RGBA15, TextAttributes as TextAttributes12 } from "@opentui/core";
|
|
57061
57017
|
function projectPanelTheme(theme) {
|
|
57062
57018
|
const primary = theme.text.action.primary;
|
|
57019
|
+
const raised = theme.background.raised;
|
|
57020
|
+
const markdown = theme.markdown;
|
|
57021
|
+
const feedback = theme.text.feedback;
|
|
57022
|
+
const interactive = theme.hue.interactive;
|
|
57023
|
+
const content = raised?.base ?? theme.background.base;
|
|
57024
|
+
const readable = (color) => ensureContrast(color, content, 4.5, theme.text.base);
|
|
57063
57025
|
return {
|
|
57064
57026
|
background: {
|
|
57065
57027
|
surface: theme.background.base,
|
|
57066
|
-
raised: theme.background.
|
|
57028
|
+
raised: raised?.high ?? theme.background.base,
|
|
57029
|
+
content,
|
|
57067
57030
|
scrim: RGBA15.fromInts(0, 0, 0, 150)
|
|
57068
57031
|
},
|
|
57069
57032
|
text: {
|
|
57070
57033
|
base: theme.text.base,
|
|
57071
|
-
muted: theme.text.muted,
|
|
57072
|
-
faint: theme.text.faint,
|
|
57073
|
-
accent:
|
|
57074
|
-
disabled: primary.
|
|
57075
|
-
danger: theme.text.
|
|
57076
|
-
warning: theme.text.
|
|
57077
|
-
success: theme.text.
|
|
57034
|
+
muted: readable(theme.text.muted),
|
|
57035
|
+
faint: readable(theme.text.faint),
|
|
57036
|
+
accent: readable(interactive?.[500] ?? theme.text.base),
|
|
57037
|
+
disabled: primary?.disabled ?? theme.text.muted,
|
|
57038
|
+
danger: readable(feedback?.error?.base ?? theme.text.base),
|
|
57039
|
+
warning: readable(feedback?.warning?.base ?? theme.text.base),
|
|
57040
|
+
success: readable(feedback?.success?.base ?? theme.text.base),
|
|
57041
|
+
code: readable(markdown?.code ?? theme.text.base),
|
|
57042
|
+
user: readable(primary?.base ?? theme.text.base),
|
|
57043
|
+
system: readable(feedback?.info?.base ?? theme.text.muted),
|
|
57044
|
+
heading: readable(markdown?.heading ?? theme.text.base)
|
|
57078
57045
|
},
|
|
57079
57046
|
row: {
|
|
57080
57047
|
activeBg: theme.background.action.primary.focused,
|
|
57081
|
-
activeFg: primary.
|
|
57048
|
+
activeFg: primary?.focused ?? theme.text.base
|
|
57082
57049
|
},
|
|
57083
57050
|
border: {
|
|
57084
57051
|
base: {
|
|
@@ -57087,11 +57054,11 @@ function projectPanelTheme(theme) {
|
|
|
57087
57054
|
},
|
|
57088
57055
|
focused: {
|
|
57089
57056
|
style: "heavy",
|
|
57090
|
-
color: theme.border.base
|
|
57057
|
+
color: interactive?.[500] ?? theme.border.base
|
|
57091
57058
|
},
|
|
57092
57059
|
warning: {
|
|
57093
57060
|
style: "single",
|
|
57094
|
-
color: theme.text.
|
|
57061
|
+
color: feedback?.warning?.base ?? theme.text.base
|
|
57095
57062
|
}
|
|
57096
57063
|
},
|
|
57097
57064
|
attributes: {
|
|
@@ -58199,16 +58166,12 @@ function V2SessionPage(props) {
|
|
|
58199
58166
|
},
|
|
58200
58167
|
themes: themeFace,
|
|
58201
58168
|
onCommand: (command) => {
|
|
58202
|
-
|
|
58203
|
-
if (node !== undefined) {
|
|
58204
|
-
node.setText(command + " ");
|
|
58205
|
-
node.gotoLineEnd();
|
|
58206
|
-
}
|
|
58169
|
+
slash.interceptSubmit(command);
|
|
58207
58170
|
},
|
|
58208
58171
|
onClosed: (summary) => {
|
|
58209
58172
|
if (summary !== undefined)
|
|
58210
58173
|
sayLine(summary);
|
|
58211
|
-
if (composerRef && !composerRef.focused())
|
|
58174
|
+
if (dialog.stack.length === 0 && composerRef && !composerRef.focused())
|
|
58212
58175
|
composerRef.focus();
|
|
58213
58176
|
}
|
|
58214
58177
|
}),
|