dsh-dock 0.23.1 → 0.25.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/README.md +50 -40
- package/client.js +2552 -472
- package/features/animation/host.js +3 -2
- package/features/balance/host.js +3 -3
- package/features/dshtools/host.js +319 -0
- package/features/dshtools/view.jsx +403 -0
- package/features/git/host.js +884 -0
- package/features/git/rpc.js +156 -0
- package/features/git/view.jsx +1946 -0
- package/features/mcpconfig/host.js +3 -3
- package/features/mcpconfig/view.js +8 -8
- package/features/mobile-relay/host.js +42 -9
- package/features/modelconfig/host.js +3 -3
- package/features/notify/host.js +3 -2
- package/features/notify/view.jsx +38 -46
- package/features/providerconfig/host.js +3 -3
- package/features/runstate/host.js +3 -2
- package/features/tokenlog/host.js +3 -2
- package/features/tts/host.js +3 -2
- package/index.js +8 -2
- package/package.json +5 -6
- package/src/client.jsx +21 -2
- package/src/host-core.js +52 -13
- package/screenshots/dock-animation.png +0 -0
- package/screenshots/dock-balance.png +0 -0
- package/screenshots/dock-games.png +0 -0
- package/screenshots/dock-home.png +0 -0
- package/screenshots/dock-modelconfig-provider-create.png +0 -0
- package/screenshots/dock-modelconfig-provider-edit.png +0 -0
- package/screenshots/dock-modelconfig-providers.png +0 -0
- package/screenshots/dock-modelconfig.png +0 -0
- package/screenshots/dock-notify.png +0 -0
- package/screenshots/dock-runstate.png +0 -0
- package/screenshots/dock-settings.png +0 -0
- package/screenshots/dock-tokenlog-charts-2.png +0 -0
- package/screenshots/dock-tokenlog-charts-3.png +0 -0
- package/screenshots/dock-tokenlog-charts.png +0 -0
- package/screenshots/dock-tokenlog.png +0 -0
package/client.js
CHANGED
|
@@ -40,18 +40,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
40
|
));
|
|
41
41
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
42
|
|
|
43
|
-
// node_modules/qrcode/lib/can-promise.js
|
|
43
|
+
// .devdeps/node_modules/qrcode/lib/can-promise.js
|
|
44
44
|
var require_can_promise = __commonJS({
|
|
45
|
-
"node_modules/qrcode/lib/can-promise.js"(exports, module2) {
|
|
45
|
+
".devdeps/node_modules/qrcode/lib/can-promise.js"(exports, module2) {
|
|
46
46
|
module2.exports = function() {
|
|
47
47
|
return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
// node_modules/qrcode/lib/core/utils.js
|
|
52
|
+
// .devdeps/node_modules/qrcode/lib/core/utils.js
|
|
53
53
|
var require_utils = __commonJS({
|
|
54
|
-
"node_modules/qrcode/lib/core/utils.js"(exports) {
|
|
54
|
+
".devdeps/node_modules/qrcode/lib/core/utils.js"(exports) {
|
|
55
55
|
var toSJISFunction;
|
|
56
56
|
var CODEWORDS_COUNT = [
|
|
57
57
|
0,
|
|
@@ -128,9 +128,9 @@ var require_utils = __commonJS({
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
// node_modules/qrcode/lib/core/error-correction-level.js
|
|
131
|
+
// .devdeps/node_modules/qrcode/lib/core/error-correction-level.js
|
|
132
132
|
var require_error_correction_level = __commonJS({
|
|
133
|
-
"node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
|
|
133
|
+
".devdeps/node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
|
|
134
134
|
exports.L = { bit: 1 };
|
|
135
135
|
exports.M = { bit: 0 };
|
|
136
136
|
exports.Q = { bit: 3 };
|
|
@@ -173,9 +173,9 @@ var require_error_correction_level = __commonJS({
|
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
|
|
176
|
-
// node_modules/qrcode/lib/core/bit-buffer.js
|
|
176
|
+
// .devdeps/node_modules/qrcode/lib/core/bit-buffer.js
|
|
177
177
|
var require_bit_buffer = __commonJS({
|
|
178
|
-
"node_modules/qrcode/lib/core/bit-buffer.js"(exports, module2) {
|
|
178
|
+
".devdeps/node_modules/qrcode/lib/core/bit-buffer.js"(exports, module2) {
|
|
179
179
|
function BitBuffer() {
|
|
180
180
|
this.buffer = [];
|
|
181
181
|
this.length = 0;
|
|
@@ -208,9 +208,9 @@ var require_bit_buffer = __commonJS({
|
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
// node_modules/qrcode/lib/core/bit-matrix.js
|
|
211
|
+
// .devdeps/node_modules/qrcode/lib/core/bit-matrix.js
|
|
212
212
|
var require_bit_matrix = __commonJS({
|
|
213
|
-
"node_modules/qrcode/lib/core/bit-matrix.js"(exports, module2) {
|
|
213
|
+
".devdeps/node_modules/qrcode/lib/core/bit-matrix.js"(exports, module2) {
|
|
214
214
|
function BitMatrix(size) {
|
|
215
215
|
if (!size || size < 1) {
|
|
216
216
|
throw new Error("BitMatrix size must be defined and greater than 0");
|
|
@@ -237,9 +237,9 @@ var require_bit_matrix = __commonJS({
|
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
|
|
240
|
-
// node_modules/qrcode/lib/core/alignment-pattern.js
|
|
240
|
+
// .devdeps/node_modules/qrcode/lib/core/alignment-pattern.js
|
|
241
241
|
var require_alignment_pattern = __commonJS({
|
|
242
|
-
"node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
|
|
242
|
+
".devdeps/node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
|
|
243
243
|
var getSymbolSize = require_utils().getSymbolSize;
|
|
244
244
|
exports.getRowColCoords = function getRowColCoords(version) {
|
|
245
245
|
if (version === 1) return [];
|
|
@@ -272,9 +272,9 @@ var require_alignment_pattern = __commonJS({
|
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
274
|
|
|
275
|
-
// node_modules/qrcode/lib/core/finder-pattern.js
|
|
275
|
+
// .devdeps/node_modules/qrcode/lib/core/finder-pattern.js
|
|
276
276
|
var require_finder_pattern = __commonJS({
|
|
277
|
-
"node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
|
|
277
|
+
".devdeps/node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
|
|
278
278
|
var getSymbolSize = require_utils().getSymbolSize;
|
|
279
279
|
var FINDER_PATTERN_SIZE = 7;
|
|
280
280
|
exports.getPositions = function getPositions(version) {
|
|
@@ -291,9 +291,9 @@ var require_finder_pattern = __commonJS({
|
|
|
291
291
|
}
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
-
// node_modules/qrcode/lib/core/mask-pattern.js
|
|
294
|
+
// .devdeps/node_modules/qrcode/lib/core/mask-pattern.js
|
|
295
295
|
var require_mask_pattern = __commonJS({
|
|
296
|
-
"node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
|
|
296
|
+
".devdeps/node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
|
|
297
297
|
exports.Patterns = {
|
|
298
298
|
PATTERN000: 0,
|
|
299
299
|
PATTERN001: 1,
|
|
@@ -433,9 +433,9 @@ var require_mask_pattern = __commonJS({
|
|
|
433
433
|
}
|
|
434
434
|
});
|
|
435
435
|
|
|
436
|
-
// node_modules/qrcode/lib/core/error-correction-code.js
|
|
436
|
+
// .devdeps/node_modules/qrcode/lib/core/error-correction-code.js
|
|
437
437
|
var require_error_correction_code = __commonJS({
|
|
438
|
-
"node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
|
|
438
|
+
".devdeps/node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
|
|
439
439
|
var ECLevel = require_error_correction_level();
|
|
440
440
|
var EC_BLOCKS_TABLE = [
|
|
441
441
|
// L M Q H
|
|
@@ -794,9 +794,9 @@ var require_error_correction_code = __commonJS({
|
|
|
794
794
|
}
|
|
795
795
|
});
|
|
796
796
|
|
|
797
|
-
// node_modules/qrcode/lib/core/galois-field.js
|
|
797
|
+
// .devdeps/node_modules/qrcode/lib/core/galois-field.js
|
|
798
798
|
var require_galois_field = __commonJS({
|
|
799
|
-
"node_modules/qrcode/lib/core/galois-field.js"(exports) {
|
|
799
|
+
".devdeps/node_modules/qrcode/lib/core/galois-field.js"(exports) {
|
|
800
800
|
var EXP_TABLE = new Uint8Array(512);
|
|
801
801
|
var LOG_TABLE = new Uint8Array(256);
|
|
802
802
|
(function initTables() {
|
|
@@ -827,9 +827,9 @@ var require_galois_field = __commonJS({
|
|
|
827
827
|
}
|
|
828
828
|
});
|
|
829
829
|
|
|
830
|
-
// node_modules/qrcode/lib/core/polynomial.js
|
|
830
|
+
// .devdeps/node_modules/qrcode/lib/core/polynomial.js
|
|
831
831
|
var require_polynomial = __commonJS({
|
|
832
|
-
"node_modules/qrcode/lib/core/polynomial.js"(exports) {
|
|
832
|
+
".devdeps/node_modules/qrcode/lib/core/polynomial.js"(exports) {
|
|
833
833
|
var GF = require_galois_field();
|
|
834
834
|
exports.mul = function mul(p1, p2) {
|
|
835
835
|
const coeff = new Uint8Array(p1.length + p2.length - 1);
|
|
@@ -863,9 +863,9 @@ var require_polynomial = __commonJS({
|
|
|
863
863
|
}
|
|
864
864
|
});
|
|
865
865
|
|
|
866
|
-
// node_modules/qrcode/lib/core/reed-solomon-encoder.js
|
|
866
|
+
// .devdeps/node_modules/qrcode/lib/core/reed-solomon-encoder.js
|
|
867
867
|
var require_reed_solomon_encoder = __commonJS({
|
|
868
|
-
"node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module2) {
|
|
868
|
+
".devdeps/node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module2) {
|
|
869
869
|
var Polynomial = require_polynomial();
|
|
870
870
|
function ReedSolomonEncoder(degree) {
|
|
871
871
|
this.genPoly = void 0;
|
|
@@ -895,18 +895,18 @@ var require_reed_solomon_encoder = __commonJS({
|
|
|
895
895
|
}
|
|
896
896
|
});
|
|
897
897
|
|
|
898
|
-
// node_modules/qrcode/lib/core/version-check.js
|
|
898
|
+
// .devdeps/node_modules/qrcode/lib/core/version-check.js
|
|
899
899
|
var require_version_check = __commonJS({
|
|
900
|
-
"node_modules/qrcode/lib/core/version-check.js"(exports) {
|
|
900
|
+
".devdeps/node_modules/qrcode/lib/core/version-check.js"(exports) {
|
|
901
901
|
exports.isValid = function isValid(version) {
|
|
902
902
|
return !isNaN(version) && version >= 1 && version <= 40;
|
|
903
903
|
};
|
|
904
904
|
}
|
|
905
905
|
});
|
|
906
906
|
|
|
907
|
-
// node_modules/qrcode/lib/core/regex.js
|
|
907
|
+
// .devdeps/node_modules/qrcode/lib/core/regex.js
|
|
908
908
|
var require_regex = __commonJS({
|
|
909
|
-
"node_modules/qrcode/lib/core/regex.js"(exports) {
|
|
909
|
+
".devdeps/node_modules/qrcode/lib/core/regex.js"(exports) {
|
|
910
910
|
var numeric = "[0-9]+";
|
|
911
911
|
var alphanumeric = "[A-Z $%*+\\-./:]+";
|
|
912
912
|
var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
@@ -932,9 +932,9 @@ var require_regex = __commonJS({
|
|
|
932
932
|
}
|
|
933
933
|
});
|
|
934
934
|
|
|
935
|
-
// node_modules/qrcode/lib/core/mode.js
|
|
935
|
+
// .devdeps/node_modules/qrcode/lib/core/mode.js
|
|
936
936
|
var require_mode = __commonJS({
|
|
937
|
-
"node_modules/qrcode/lib/core/mode.js"(exports) {
|
|
937
|
+
".devdeps/node_modules/qrcode/lib/core/mode.js"(exports) {
|
|
938
938
|
var VersionCheck = require_version_check();
|
|
939
939
|
var Regex = require_regex();
|
|
940
940
|
exports.NUMERIC = {
|
|
@@ -1013,9 +1013,9 @@ var require_mode = __commonJS({
|
|
|
1013
1013
|
}
|
|
1014
1014
|
});
|
|
1015
1015
|
|
|
1016
|
-
// node_modules/qrcode/lib/core/version.js
|
|
1016
|
+
// .devdeps/node_modules/qrcode/lib/core/version.js
|
|
1017
1017
|
var require_version = __commonJS({
|
|
1018
|
-
"node_modules/qrcode/lib/core/version.js"(exports) {
|
|
1018
|
+
".devdeps/node_modules/qrcode/lib/core/version.js"(exports) {
|
|
1019
1019
|
var Utils = require_utils();
|
|
1020
1020
|
var ECCode = require_error_correction_code();
|
|
1021
1021
|
var ECLevel = require_error_correction_level();
|
|
@@ -1108,9 +1108,9 @@ var require_version = __commonJS({
|
|
|
1108
1108
|
}
|
|
1109
1109
|
});
|
|
1110
1110
|
|
|
1111
|
-
// node_modules/qrcode/lib/core/format-info.js
|
|
1111
|
+
// .devdeps/node_modules/qrcode/lib/core/format-info.js
|
|
1112
1112
|
var require_format_info = __commonJS({
|
|
1113
|
-
"node_modules/qrcode/lib/core/format-info.js"(exports) {
|
|
1113
|
+
".devdeps/node_modules/qrcode/lib/core/format-info.js"(exports) {
|
|
1114
1114
|
var Utils = require_utils();
|
|
1115
1115
|
var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
1116
1116
|
var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
|
@@ -1126,9 +1126,9 @@ var require_format_info = __commonJS({
|
|
|
1126
1126
|
}
|
|
1127
1127
|
});
|
|
1128
1128
|
|
|
1129
|
-
// node_modules/qrcode/lib/core/numeric-data.js
|
|
1129
|
+
// .devdeps/node_modules/qrcode/lib/core/numeric-data.js
|
|
1130
1130
|
var require_numeric_data = __commonJS({
|
|
1131
|
-
"node_modules/qrcode/lib/core/numeric-data.js"(exports, module2) {
|
|
1131
|
+
".devdeps/node_modules/qrcode/lib/core/numeric-data.js"(exports, module2) {
|
|
1132
1132
|
var Mode = require_mode();
|
|
1133
1133
|
function NumericData(data) {
|
|
1134
1134
|
this.mode = Mode.NUMERIC;
|
|
@@ -1161,9 +1161,9 @@ var require_numeric_data = __commonJS({
|
|
|
1161
1161
|
}
|
|
1162
1162
|
});
|
|
1163
1163
|
|
|
1164
|
-
// node_modules/qrcode/lib/core/alphanumeric-data.js
|
|
1164
|
+
// .devdeps/node_modules/qrcode/lib/core/alphanumeric-data.js
|
|
1165
1165
|
var require_alphanumeric_data = __commonJS({
|
|
1166
|
-
"node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module2) {
|
|
1166
|
+
".devdeps/node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module2) {
|
|
1167
1167
|
var Mode = require_mode();
|
|
1168
1168
|
var ALPHA_NUM_CHARS = [
|
|
1169
1169
|
"0",
|
|
@@ -1240,9 +1240,9 @@ var require_alphanumeric_data = __commonJS({
|
|
|
1240
1240
|
}
|
|
1241
1241
|
});
|
|
1242
1242
|
|
|
1243
|
-
// node_modules/qrcode/lib/core/byte-data.js
|
|
1243
|
+
// .devdeps/node_modules/qrcode/lib/core/byte-data.js
|
|
1244
1244
|
var require_byte_data = __commonJS({
|
|
1245
|
-
"node_modules/qrcode/lib/core/byte-data.js"(exports, module2) {
|
|
1245
|
+
".devdeps/node_modules/qrcode/lib/core/byte-data.js"(exports, module2) {
|
|
1246
1246
|
var Mode = require_mode();
|
|
1247
1247
|
function ByteData(data) {
|
|
1248
1248
|
this.mode = Mode.BYTE;
|
|
@@ -1270,9 +1270,9 @@ var require_byte_data = __commonJS({
|
|
|
1270
1270
|
}
|
|
1271
1271
|
});
|
|
1272
1272
|
|
|
1273
|
-
// node_modules/qrcode/lib/core/kanji-data.js
|
|
1273
|
+
// .devdeps/node_modules/qrcode/lib/core/kanji-data.js
|
|
1274
1274
|
var require_kanji_data = __commonJS({
|
|
1275
|
-
"node_modules/qrcode/lib/core/kanji-data.js"(exports, module2) {
|
|
1275
|
+
".devdeps/node_modules/qrcode/lib/core/kanji-data.js"(exports, module2) {
|
|
1276
1276
|
var Mode = require_mode();
|
|
1277
1277
|
var Utils = require_utils();
|
|
1278
1278
|
function KanjiData(data) {
|
|
@@ -1309,9 +1309,9 @@ var require_kanji_data = __commonJS({
|
|
|
1309
1309
|
}
|
|
1310
1310
|
});
|
|
1311
1311
|
|
|
1312
|
-
// node_modules/dijkstrajs/dijkstra.js
|
|
1312
|
+
// .devdeps/node_modules/dijkstrajs/dijkstra.js
|
|
1313
1313
|
var require_dijkstra = __commonJS({
|
|
1314
|
-
"node_modules/dijkstrajs/dijkstra.js"(exports, module2) {
|
|
1314
|
+
".devdeps/node_modules/dijkstrajs/dijkstra.js"(exports, module2) {
|
|
1315
1315
|
"use strict";
|
|
1316
1316
|
var dijkstra = {
|
|
1317
1317
|
single_source_shortest_paths: function(graph, s, d) {
|
|
@@ -1410,9 +1410,9 @@ var require_dijkstra = __commonJS({
|
|
|
1410
1410
|
}
|
|
1411
1411
|
});
|
|
1412
1412
|
|
|
1413
|
-
// node_modules/qrcode/lib/core/segments.js
|
|
1413
|
+
// .devdeps/node_modules/qrcode/lib/core/segments.js
|
|
1414
1414
|
var require_segments = __commonJS({
|
|
1415
|
-
"node_modules/qrcode/lib/core/segments.js"(exports) {
|
|
1415
|
+
".devdeps/node_modules/qrcode/lib/core/segments.js"(exports) {
|
|
1416
1416
|
var Mode = require_mode();
|
|
1417
1417
|
var NumericData = require_numeric_data();
|
|
1418
1418
|
var AlphanumericData = require_alphanumeric_data();
|
|
@@ -1596,9 +1596,9 @@ var require_segments = __commonJS({
|
|
|
1596
1596
|
}
|
|
1597
1597
|
});
|
|
1598
1598
|
|
|
1599
|
-
// node_modules/qrcode/lib/core/qrcode.js
|
|
1599
|
+
// .devdeps/node_modules/qrcode/lib/core/qrcode.js
|
|
1600
1600
|
var require_qrcode = __commonJS({
|
|
1601
|
-
"node_modules/qrcode/lib/core/qrcode.js"(exports) {
|
|
1601
|
+
".devdeps/node_modules/qrcode/lib/core/qrcode.js"(exports) {
|
|
1602
1602
|
var Utils = require_utils();
|
|
1603
1603
|
var ECLevel = require_error_correction_level();
|
|
1604
1604
|
var BitBuffer = require_bit_buffer();
|
|
@@ -1857,9 +1857,9 @@ var require_qrcode = __commonJS({
|
|
|
1857
1857
|
}
|
|
1858
1858
|
});
|
|
1859
1859
|
|
|
1860
|
-
// node_modules/qrcode/lib/renderer/utils.js
|
|
1860
|
+
// .devdeps/node_modules/qrcode/lib/renderer/utils.js
|
|
1861
1861
|
var require_utils2 = __commonJS({
|
|
1862
|
-
"node_modules/qrcode/lib/renderer/utils.js"(exports) {
|
|
1862
|
+
".devdeps/node_modules/qrcode/lib/renderer/utils.js"(exports) {
|
|
1863
1863
|
function hex2rgba(hex) {
|
|
1864
1864
|
if (typeof hex === "number") {
|
|
1865
1865
|
hex = hex.toString();
|
|
@@ -1937,9 +1937,9 @@ var require_utils2 = __commonJS({
|
|
|
1937
1937
|
}
|
|
1938
1938
|
});
|
|
1939
1939
|
|
|
1940
|
-
// node_modules/qrcode/lib/renderer/canvas.js
|
|
1940
|
+
// .devdeps/node_modules/qrcode/lib/renderer/canvas.js
|
|
1941
1941
|
var require_canvas = __commonJS({
|
|
1942
|
-
"node_modules/qrcode/lib/renderer/canvas.js"(exports) {
|
|
1942
|
+
".devdeps/node_modules/qrcode/lib/renderer/canvas.js"(exports) {
|
|
1943
1943
|
var Utils = require_utils2();
|
|
1944
1944
|
function clearCanvas(ctx, canvas, size) {
|
|
1945
1945
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
@@ -1990,9 +1990,9 @@ var require_canvas = __commonJS({
|
|
|
1990
1990
|
}
|
|
1991
1991
|
});
|
|
1992
1992
|
|
|
1993
|
-
// node_modules/qrcode/lib/renderer/svg-tag.js
|
|
1993
|
+
// .devdeps/node_modules/qrcode/lib/renderer/svg-tag.js
|
|
1994
1994
|
var require_svg_tag = __commonJS({
|
|
1995
|
-
"node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
|
|
1995
|
+
".devdeps/node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
|
|
1996
1996
|
var Utils = require_utils2();
|
|
1997
1997
|
function getColorAttrib(color, attrib) {
|
|
1998
1998
|
const alpha = color.a / 255;
|
|
@@ -2048,9 +2048,9 @@ var require_svg_tag = __commonJS({
|
|
|
2048
2048
|
}
|
|
2049
2049
|
});
|
|
2050
2050
|
|
|
2051
|
-
// node_modules/qrcode/lib/browser.js
|
|
2051
|
+
// .devdeps/node_modules/qrcode/lib/browser.js
|
|
2052
2052
|
var require_browser = __commonJS({
|
|
2053
|
-
"node_modules/qrcode/lib/browser.js"(exports) {
|
|
2053
|
+
".devdeps/node_modules/qrcode/lib/browser.js"(exports) {
|
|
2054
2054
|
var canPromise = require_can_promise();
|
|
2055
2055
|
var QRCode2 = require_qrcode();
|
|
2056
2056
|
var CanvasRenderer = require_canvas();
|
|
@@ -2121,12 +2121,24 @@ var require_browser = __commonJS({
|
|
|
2121
2121
|
// src/client.jsx
|
|
2122
2122
|
var client_exports = {};
|
|
2123
2123
|
__export(client_exports, {
|
|
2124
|
+
COMMIT_COLUMNS: () => COMMIT_COLUMNS,
|
|
2125
|
+
DEFAULT_VISIBLE_COLUMNS: () => DEFAULT_VISIBLE_COLUMNS,
|
|
2126
|
+
DirBrowser: () => DirBrowser,
|
|
2127
|
+
GitDragSplitter: () => DragSplitter,
|
|
2128
|
+
GitView: () => GitView,
|
|
2124
2129
|
apply: () => apply,
|
|
2130
|
+
clampPercent: () => clampPercent,
|
|
2131
|
+
columnsTemplate: () => columnsTemplate,
|
|
2125
2132
|
dockBridge: () => dockBridge,
|
|
2126
|
-
|
|
2133
|
+
dragToPercent: () => dragToPercent,
|
|
2134
|
+
fmtDateTime: () => fmtDateTime,
|
|
2135
|
+
inject: () => inject,
|
|
2136
|
+
readSessionDir: () => currentSessionDir,
|
|
2137
|
+
splitterStep: () => splitterStep,
|
|
2138
|
+
toggleRepoSelection: () => toggleRepoSelection
|
|
2127
2139
|
});
|
|
2128
2140
|
module.exports = __toCommonJS(client_exports);
|
|
2129
|
-
var
|
|
2141
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
2130
2142
|
|
|
2131
2143
|
// src/shared.js
|
|
2132
2144
|
var import_react = __toESM(require("react"), 1);
|
|
@@ -7759,24 +7771,22 @@ function endBroadcastText(success, record, task, cfg) {
|
|
|
7759
7771
|
const reason = record && record.endReason || "";
|
|
7760
7772
|
const title = record && record.title || task && task.title || "";
|
|
7761
7773
|
const sub = !!(record && record.isSubtask || task && task.isSubtask);
|
|
7774
|
+
const role = sub ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4EFB\u52A1";
|
|
7762
7775
|
const parentTitle = record && record.parentTitle || task && task.parentTitle || "";
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
return success ? "\u4EFB\u52A1\u5B8C\u6210" : "\u4EFB\u52A1\u505C\u6B62\u4E86";
|
|
7766
|
-
}
|
|
7776
|
+
const head = role + (success ? "\u5B8C\u6210\u4E86" : "\u505C\u6B62\u4E86") + (title ? "\u300C" + truncate2(title, 30) + "\u300D" : "");
|
|
7777
|
+
if (mode === "brief") return head;
|
|
7767
7778
|
if (mode === "medium") {
|
|
7768
|
-
const
|
|
7769
|
-
const parts2 = [success ? who + "\u5B8C\u6210\u4E86" : who + "\u505C\u6B62\u4E86"];
|
|
7779
|
+
const parts2 = [head];
|
|
7770
7780
|
if (!success) parts2.push("\uFF0C\u539F\u56E0\uFF1A" + endReasonSpeech(reason));
|
|
7781
|
+
if (sub && parentTitle) parts2.push("\uFF08\u4E3B\u4EFB\u52A1\u300C" + truncate2(parentTitle, 20) + "\u300D\uFF09");
|
|
7771
7782
|
const dur2 = record && record.duration || 0;
|
|
7772
7783
|
if (dur2 > 0) parts2.push("\uFF0C\u8017\u65F6" + fmtDur(dur2));
|
|
7773
7784
|
parts2.push("\u3002");
|
|
7774
7785
|
return parts2.join("");
|
|
7775
7786
|
}
|
|
7776
|
-
const parts = [];
|
|
7787
|
+
const parts = [head + "\u3002"];
|
|
7777
7788
|
if (sub && parentTitle) parts.push("\u4E3B\u4EFB\u52A1\uFF1A" + truncate2(parentTitle, 30) + "\u3002");
|
|
7778
|
-
if (
|
|
7779
|
-
parts.push(success ? "\u5DF2\u5B8C\u6210\u3002" : "\u7ED3\u675F\uFF0C\u539F\u56E0\uFF1A" + endReasonSpeech(reason) + "\u3002");
|
|
7789
|
+
if (!success) parts.push("\u539F\u56E0\uFF1A" + endReasonSpeech(reason) + "\u3002");
|
|
7780
7790
|
const dur = record && record.duration || 0;
|
|
7781
7791
|
if (dur > 0) parts.push("\u8017\u65F6" + fmtDur(dur) + "\u3002");
|
|
7782
7792
|
const turns = record && record.turns || task && task.turns || 0;
|
|
@@ -7792,32 +7802,32 @@ function endBroadcastText(success, record, task, cfg) {
|
|
|
7792
7802
|
}
|
|
7793
7803
|
function confirmBroadcastText(task, approval, cfg) {
|
|
7794
7804
|
const mode = voiceTone(cfg);
|
|
7795
|
-
|
|
7805
|
+
const role = task && task.isSubtask ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4EFB\u52A1";
|
|
7806
|
+
const title = task && task.title || "";
|
|
7807
|
+
const head = role + "\u9700\u8981\u6388\u6743" + (title ? "\u300C" + truncate2(title, 30) + "\u300D" : "");
|
|
7796
7808
|
const tool = approval && approval.toolName || "\u5DE5\u5177";
|
|
7797
7809
|
const scene = toolLabel(tool);
|
|
7798
|
-
if (mode === "
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
}
|
|
7802
|
-
const parts = [];
|
|
7803
|
-
if (task && task.title) parts.push("\u4EFB\u52A1\uFF1A" + truncate2(task.title, 30) + "\u3002");
|
|
7810
|
+
if (mode === "brief") return head;
|
|
7811
|
+
if (mode === "medium") return head + "\uFF0C\u6B63\u5728\u7B49\u4F60\u6279\u51C6" + (scene || "\u5DE5\u5177 " + tool) + "\u3002";
|
|
7812
|
+
const parts = [head + "\u3002"];
|
|
7804
7813
|
parts.push("\u6B63\u5728\u7B49\u5F85\u4F60\u6279\u51C6" + (scene ? "\u6267\u884C" + scene : "") + "\uFF0C\u5DE5\u5177\u662F" + tool + "\uFF0C\u8BF7\u56DE\u5230\u4F1A\u8BDD\u5904\u7406\u3002");
|
|
7805
7814
|
return parts.join("");
|
|
7806
7815
|
}
|
|
7807
7816
|
function questionBroadcastText(task, question, cfg) {
|
|
7808
7817
|
const mode = voiceTone(cfg);
|
|
7809
|
-
|
|
7810
|
-
const
|
|
7811
|
-
const head =
|
|
7818
|
+
const role = task && task.isSubtask ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4EFB\u52A1";
|
|
7819
|
+
const title = task && task.title || "";
|
|
7820
|
+
const head = role + "\u9700\u8981\u4F60\u56DE\u7B54" + (title ? "\u300C" + truncate2(title, 30) + "\u300D" : "");
|
|
7821
|
+
const qhead = question && question.header || "";
|
|
7812
7822
|
const body = question && question.question || "";
|
|
7813
7823
|
const what = body ? truncate2(body.replace(/[#*_`>\[\]()!]/g, ""), 40) : "";
|
|
7824
|
+
if (mode === "brief") return head;
|
|
7814
7825
|
if (mode === "medium") {
|
|
7815
|
-
const tail = what ? "\uFF1A" + what :
|
|
7816
|
-
return
|
|
7826
|
+
const tail = what ? "\uFF1A" + what : qhead ? "\uFF1A" + qhead : "";
|
|
7827
|
+
return head + tail + "\u3002";
|
|
7817
7828
|
}
|
|
7818
|
-
const parts = [];
|
|
7819
|
-
|
|
7820
|
-
parts.push(what ? "\u6B63\u5728\u7B49\u4F60\u56DE\u7B54\u95EE\u9898\uFF1A" + what + "\u3002" : "\u6B63\u5728\u7B49\u4F60\u56DE\u7B54\u95EE\u9898\u3002");
|
|
7829
|
+
const parts = [head + "\u3002"];
|
|
7830
|
+
parts.push(what ? "\u95EE\u9898\uFF1A" + what + "\u3002" : qhead ? "\u95EE\u9898\uFF1A" + qhead + "\u3002" : "\u6B63\u5728\u7B49\u4F60\u56DE\u7B54\u95EE\u9898\u3002");
|
|
7821
7831
|
const count = question && question.count || 0;
|
|
7822
7832
|
if (count > 1) parts.push("\u5171 " + count + " \u4E2A\u95EE\u9898\u3002");
|
|
7823
7833
|
parts.push("\u8BF7\u56DE\u5230\u4F1A\u8BDD\u9009\u62E9\u7B54\u6848\u3002");
|
|
@@ -7825,12 +7835,14 @@ function questionBroadcastText(task, question, cfg) {
|
|
|
7825
7835
|
}
|
|
7826
7836
|
function stuckBroadcastText(task, cfg) {
|
|
7827
7837
|
const mode = voiceTone(cfg);
|
|
7828
|
-
const
|
|
7829
|
-
|
|
7838
|
+
const role = task && task.isSubtask ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4EFB\u52A1";
|
|
7839
|
+
const title = task && task.title || "";
|
|
7840
|
+
const head = role + "\u5361\u4F4F\u4E86" + (title ? "\u300C" + truncate2(title, 30) + "\u300D" : "");
|
|
7841
|
+
if (mode === "brief") return head;
|
|
7830
7842
|
if (mode === "medium") {
|
|
7831
|
-
return
|
|
7843
|
+
return head + "\uFF0C\u5DF2\u7ECF" + fmtDur(Math.max(0, cfg && cfg.stuckMs || STUCK_MS)) + "\u6CA1\u6709\u4EFB\u4F55\u52A8\u9759\u3002";
|
|
7832
7844
|
}
|
|
7833
|
-
const parts = [
|
|
7845
|
+
const parts = [head + "\u3002"];
|
|
7834
7846
|
parts.push("\u7F16\u7A0B\u9636\u6BB5\u5DF2\u7ECF" + fmtDur(Math.max(0, cfg && cfg.stuckMs || STUCK_MS)) + "\u6CA1\u6709\u4EFB\u4F55\u52A8\u9759\uFF0C");
|
|
7835
7847
|
const tool = task && task.lastToolName || "";
|
|
7836
7848
|
const scene = tool ? toolLabel(tool) : "";
|
|
@@ -9996,11 +10008,11 @@ function drainQueue() {
|
|
|
9996
10008
|
}
|
|
9997
10009
|
function closingMarkdown(owner) {
|
|
9998
10010
|
const turn = owner && owner.turn;
|
|
9999
|
-
const
|
|
10000
|
-
if (!
|
|
10011
|
+
const store2 = turn && turn.data;
|
|
10012
|
+
if (!store2 || typeof store2.get !== "function") return "";
|
|
10001
10013
|
let tail = null;
|
|
10002
10014
|
try {
|
|
10003
|
-
tail =
|
|
10015
|
+
tail = store2.get("turn-tail");
|
|
10004
10016
|
} catch {
|
|
10005
10017
|
return "";
|
|
10006
10018
|
}
|
|
@@ -14413,7 +14425,7 @@ function RemoteCard() {
|
|
|
14413
14425
|
const [messageKind, setMessageKind] = (0, import_react20.useState)("error");
|
|
14414
14426
|
const [changing, setChanging] = (0, import_react20.useState)(false);
|
|
14415
14427
|
const [remote, setRemote] = (0, import_react20.useState)(false);
|
|
14416
|
-
const
|
|
14428
|
+
const notify2 = (0, import_react20.useCallback)((text, kind) => {
|
|
14417
14429
|
setMessage(text);
|
|
14418
14430
|
setMessageKind(kind || "error");
|
|
14419
14431
|
}, []);
|
|
@@ -14424,9 +14436,9 @@ function RemoteCard() {
|
|
|
14424
14436
|
setAddress((prev) => prev || (data.addresses && data.addresses[0] ? data.addresses[0].address : ""));
|
|
14425
14437
|
setUsername((prev) => prev || (data.username || ""));
|
|
14426
14438
|
} catch (e) {
|
|
14427
|
-
|
|
14439
|
+
notify2(e && e.message ? e.message : String(e));
|
|
14428
14440
|
}
|
|
14429
|
-
}, [
|
|
14441
|
+
}, [notify2]);
|
|
14430
14442
|
(0, import_react20.useEffect)(() => {
|
|
14431
14443
|
refresh();
|
|
14432
14444
|
const timer = setInterval(refresh, 3e3);
|
|
@@ -14456,9 +14468,9 @@ function RemoteCard() {
|
|
|
14456
14468
|
};
|
|
14457
14469
|
}, [lanLink]);
|
|
14458
14470
|
async function enable() {
|
|
14459
|
-
|
|
14471
|
+
notify2("");
|
|
14460
14472
|
if (!lan.accountSet && (!username.trim() || password.length < 6)) {
|
|
14461
|
-
|
|
14473
|
+
notify2("\u9996\u6B21\u5F00\u542F\u8BF7\u8BBE\u7F6E\u8D26\u53F7\u548C\u81F3\u5C11 6 \u4F4D\u7684\u5BC6\u7801\u3002");
|
|
14462
14474
|
return;
|
|
14463
14475
|
}
|
|
14464
14476
|
setBusy("start");
|
|
@@ -14478,30 +14490,30 @@ function RemoteCard() {
|
|
|
14478
14490
|
setPassword("");
|
|
14479
14491
|
setNewPassword("");
|
|
14480
14492
|
setChanging(false);
|
|
14481
|
-
|
|
14493
|
+
notify2("\u8FDC\u7A0B\u8BBF\u95EE\u5DF2\u5F00\u542F\uFF1A\u8BBE\u5907\u8BBF\u95EE\u4E0B\u65B9\u5730\u5740\u5E76\u7528\u8D26\u53F7\u5BC6\u7801\u767B\u5F55\u3002" + (data.needsRestart ? "\uFF08\u5DE5\u4F5C\u533A\u76EE\u5F55\u7684\u6D4F\u89C8\u9009\u62E9\u9700\u91CD\u542F dsh web \u540E\u53EF\u7528\uFF09" : ""), "success");
|
|
14482
14494
|
} catch (e) {
|
|
14483
|
-
|
|
14495
|
+
notify2(e && e.message ? e.message : String(e));
|
|
14484
14496
|
} finally {
|
|
14485
14497
|
setBusy("");
|
|
14486
14498
|
}
|
|
14487
14499
|
}
|
|
14488
14500
|
async function disable() {
|
|
14489
|
-
|
|
14501
|
+
notify2("");
|
|
14490
14502
|
setBusy("stop");
|
|
14491
14503
|
try {
|
|
14492
14504
|
const data = await rpc("lan/stop", {});
|
|
14493
14505
|
setLan(data);
|
|
14494
|
-
|
|
14506
|
+
notify2("\u8FDC\u7A0B\u8BBF\u95EE\u5DF2\u5173\u95ED\uFF0C\u5DF2\u767B\u5F55\u8BBE\u5907\u5168\u90E8\u9000\u51FA\u3002" + (data.needsRestart ? "\u91CD\u542F dsh web \u540E\u6062\u590D\u5DE5\u4F5C\u533A\u539F\u751F\u9009\u62E9\u5668\u3002" : ""), "success");
|
|
14495
14507
|
} catch (e) {
|
|
14496
|
-
|
|
14508
|
+
notify2(e && e.message ? e.message : String(e));
|
|
14497
14509
|
} finally {
|
|
14498
14510
|
setBusy("");
|
|
14499
14511
|
}
|
|
14500
14512
|
}
|
|
14501
14513
|
async function saveAuth() {
|
|
14502
|
-
|
|
14514
|
+
notify2("");
|
|
14503
14515
|
if (!username.trim() || newPassword.length < 6) {
|
|
14504
|
-
|
|
14516
|
+
notify2("\u8BF7\u586B\u5199\u8D26\u53F7\u548C\u81F3\u5C11 6 \u4F4D\u7684\u65B0\u5BC6\u7801\u3002");
|
|
14505
14517
|
return;
|
|
14506
14518
|
}
|
|
14507
14519
|
setBusy("auth");
|
|
@@ -14511,15 +14523,15 @@ function RemoteCard() {
|
|
|
14511
14523
|
setPassword("");
|
|
14512
14524
|
setNewPassword("");
|
|
14513
14525
|
setChanging(false);
|
|
14514
|
-
|
|
14526
|
+
notify2("\u8D26\u53F7\u5BC6\u7801\u5DF2\u66F4\u65B0\uFF0C\u6240\u6709\u8BBE\u5907\u9700\u91CD\u65B0\u767B\u5F55\u3002", "success");
|
|
14515
14527
|
} catch (e) {
|
|
14516
|
-
|
|
14528
|
+
notify2(e && e.message ? e.message : String(e));
|
|
14517
14529
|
} finally {
|
|
14518
14530
|
setBusy("");
|
|
14519
14531
|
}
|
|
14520
14532
|
}
|
|
14521
14533
|
function copyLink() {
|
|
14522
|
-
copy(lanLink).then(() =>
|
|
14534
|
+
copy(lanLink).then(() => notify2("\u5730\u5740\u5DF2\u590D\u5236\u3002", "success")).catch((e) => notify2(e.message));
|
|
14523
14535
|
}
|
|
14524
14536
|
function logout() {
|
|
14525
14537
|
const info = typeof window !== "undefined" ? window.__DSH_REMOTE__ : null;
|
|
@@ -14918,7 +14930,7 @@ function ServerForm(props) {
|
|
|
14918
14930
|
hint: "\u5DE5\u5177\u540D\u524D\u7F00\uFF1A\u6A21\u578B\u770B\u5230\u7684\u662F mcp__<serverName>__<tool>\uFF1B\u987B\u5339\u914D " + SERVER_NAME_RE
|
|
14919
14931
|
}, input({
|
|
14920
14932
|
value: form.serverName,
|
|
14921
|
-
placeholder: "
|
|
14933
|
+
placeholder: "demo_ocr",
|
|
14922
14934
|
disabled: isEdit,
|
|
14923
14935
|
onChange: (e) => patch({ serverName: e.target.value })
|
|
14924
14936
|
})),
|
|
@@ -14958,7 +14970,7 @@ function ServerForm(props) {
|
|
|
14958
14970
|
rows: 4,
|
|
14959
14971
|
spellCheck: false,
|
|
14960
14972
|
value: form.argsText,
|
|
14961
|
-
placeholder: "/
|
|
14973
|
+
placeholder: "/home/me/work/demo-service/mcp_ocr.py",
|
|
14962
14974
|
onChange: (e) => patch({ argsText: e.target.value })
|
|
14963
14975
|
})
|
|
14964
14976
|
),
|
|
@@ -14975,7 +14987,7 @@ function ServerForm(props) {
|
|
|
14975
14987
|
),
|
|
14976
14988
|
Field(
|
|
14977
14989
|
{ label: "cwd\uFF08\u53EF\u9009\uFF09" },
|
|
14978
|
-
input({ value: form.cwd, placeholder: "/
|
|
14990
|
+
input({ value: form.cwd, placeholder: "/home/me/work/demo-service", onChange: (e) => patch({ cwd: e.target.value }) })
|
|
14979
14991
|
)
|
|
14980
14992
|
),
|
|
14981
14993
|
import_react21.default.createElement(
|
|
@@ -15128,16 +15140,16 @@ function McpConfigView() {
|
|
|
15128
15140
|
commit(next, "\u5DF2\u5220\u9664\u300C" + draft.serverName + "\u300D");
|
|
15129
15141
|
};
|
|
15130
15142
|
const fillXiaomiExample = () => {
|
|
15131
|
-
if (drafts.some((d) => d.serverName === "
|
|
15132
|
-
setMsg({ tone: "warn", text: "\u5217\u8868\u91CC\u5DF2\u7ECF\u6709
|
|
15143
|
+
if (drafts.some((d) => d.serverName === "demo_ocr")) {
|
|
15144
|
+
setMsg({ tone: "warn", text: "\u5217\u8868\u91CC\u5DF2\u7ECF\u6709 demo_ocr\uFF08\u53EF\u76F4\u63A5\u70B9\u8BE5\u5361\u7247\u7684\u300C\u7F16\u8F91\u300D\u67E5\u770B/\u4FEE\u6539\uFF09" });
|
|
15133
15145
|
return;
|
|
15134
15146
|
}
|
|
15135
15147
|
setForm(Object.assign(emptyForm(), {
|
|
15136
|
-
serverName: "
|
|
15148
|
+
serverName: "demo_ocr",
|
|
15137
15149
|
transport: "stdio",
|
|
15138
15150
|
command: "/usr/bin/python3",
|
|
15139
|
-
argsText: "/
|
|
15140
|
-
cwd: "/
|
|
15151
|
+
argsText: "/home/me/work/demo-service/mcp_ocr.py",
|
|
15152
|
+
cwd: "/home/me/work/demo-service",
|
|
15141
15153
|
envText: "",
|
|
15142
15154
|
toolCallTimeoutMs: "300000",
|
|
15143
15155
|
failOnStartupError: false
|
|
@@ -15402,253 +15414,2319 @@ var feature11 = {
|
|
|
15402
15414
|
].join("\n")
|
|
15403
15415
|
};
|
|
15404
15416
|
|
|
15405
|
-
//
|
|
15406
|
-
var
|
|
15407
|
-
var
|
|
15408
|
-
var
|
|
15409
|
-
var
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15417
|
+
// features/dshtools/view.jsx
|
|
15418
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
15419
|
+
var ENDPOINT2 = "dsh-dock/dshtools";
|
|
15420
|
+
var LARGE_FILE_BYTES = 32 * 1024 * 1024;
|
|
15421
|
+
var store = {
|
|
15422
|
+
/** 宿主 /dsh-dock/dshtools 是否已成功读过一次:没读过就绝不接管菜单。 */
|
|
15423
|
+
ready: false,
|
|
15424
|
+
error: "",
|
|
15425
|
+
groups: [],
|
|
15426
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
15427
|
+
loading: null
|
|
15428
|
+
};
|
|
15429
|
+
function notify() {
|
|
15430
|
+
for (const fn of store.listeners) {
|
|
15431
|
+
try {
|
|
15432
|
+
fn();
|
|
15433
|
+
} catch (e) {
|
|
15434
|
+
console.error("[dsh-dock] DSH\u529F\u80FD\u8BA2\u9605\u8005\u51FA\u9519\uFF1A", e);
|
|
15422
15435
|
}
|
|
15423
|
-
const entry = {
|
|
15424
|
-
id: def.id,
|
|
15425
|
-
name: String(def.name || def.id),
|
|
15426
|
-
order: typeof def.order === "number" ? def.order : 500,
|
|
15427
|
-
accent: typeof def.accent === "string" ? def.accent : "#94a3b8",
|
|
15428
|
-
description: String(def.description || ""),
|
|
15429
|
-
css: typeof def.css === "string" ? def.css : "",
|
|
15430
|
-
View: def.View,
|
|
15431
|
-
HomeStat: typeof def.HomeStat === "function" ? def.HomeStat : null,
|
|
15432
|
-
Overlay: typeof def.Overlay === "function" ? def.Overlay : null,
|
|
15433
|
-
external: true,
|
|
15434
|
-
package: typeof def.package === "string" ? def.package : ""
|
|
15435
|
-
};
|
|
15436
|
-
const i = externalDefs.findIndex((x) => x.id === entry.id);
|
|
15437
|
-
if (i >= 0) externalDefs[i] = entry;
|
|
15438
|
-
else externalDefs.push(entry);
|
|
15439
|
-
if (entry.css) ensureCss();
|
|
15440
|
-
notifyExternal();
|
|
15441
|
-
return () => {
|
|
15442
|
-
const j = externalDefs.indexOf(entry);
|
|
15443
|
-
if (j >= 0) {
|
|
15444
|
-
externalDefs.splice(j, 1);
|
|
15445
|
-
notifyExternal();
|
|
15446
|
-
}
|
|
15447
|
-
};
|
|
15448
|
-
},
|
|
15449
|
-
features() {
|
|
15450
|
-
return externalDefs.map((x) => Object.assign({}, x));
|
|
15451
15436
|
}
|
|
15452
|
-
};
|
|
15453
|
-
function allModules() {
|
|
15454
|
-
return BUILTIN_FEATURES.concat(PLANNED_FEATURES, externalDefs).slice().sort((a, b) => (a.order || 500) - (b.order || 500));
|
|
15455
15437
|
}
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
// --dk-accent 主强调色(亮色用深蓝保证对比度,暗色用亮蓝)
|
|
15462
|
-
// --dk-warn 警告色(亮色用深琥珀,暗色用亮琥珀)
|
|
15463
|
-
// --dk-ok/--dk-err 成功/错误(亮色取宿主深色值,暗色保持宿主亮色值)
|
|
15464
|
-
// --dk-tdim 表格分隔线/弱边框(亮色用中性灰蓝、暗色用白透明)
|
|
15465
|
-
"body{--dk-accent:#2f6fed;--dk-accent-soft:color-mix(in srgb,#2f6fed 12%,transparent);--dk-warn:#b45309;--dk-ok:var(--dsw-alias-state-success-primary,#16a34a);--dk-err:var(--dsw-alias-state-error-primary,#dc2626);--dk-tdim:rgba(100,116,139,.22);--dk-hover-tint:rgba(47,111,237,.08);--dk-games-accent:#7c3aed;}",
|
|
15466
|
-
"body[data-ds-dark-theme]{--dk-accent:#4d9fff;--dk-accent-soft:color-mix(in srgb,#4d9fff 12%,transparent);--dk-warn:#fbbf24;--dk-ok:var(--dsw-alias-state-success-primary,#34d399);--dk-err:var(--dsw-alias-state-error-primary,#f87171);--dk-tdim:rgba(122,132,152,.14);--dk-hover-tint:rgba(80,110,180,.12);--dk-games-accent:#a78bfa;}",
|
|
15467
|
-
// 宿主语义变量兜底别名(部分模块引用了宿主不存在的名字,统一在此补齐,取值随主题自动切换)
|
|
15468
|
-
"body{--dsw-alias-accent:var(--dk-accent);--dsw-alias-accent-soft:var(--dk-accent-soft);--dsw-alias-state-warning-primary:var(--dk-warn);}",
|
|
15469
|
-
".dock-root{display:flex;flex-direction:column;gap:12px;padding:4px 0;color:var(--dsw-alias-label-primary);font-size:13px;}",
|
|
15470
|
-
".dock-intro{color:var(--dsw-alias-label-secondary);line-height:1.6;}",
|
|
15471
|
-
".dock-card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:12px 14px;display:flex;flex-direction:column;gap:8px;}",
|
|
15472
|
-
".dock-card-head{display:flex;align-items:center;gap:8px;}",
|
|
15473
|
-
".dock-dot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-secondary);flex:none;}",
|
|
15474
|
-
".dock-dot.on{background:var(--dsw-alias-state-success-primary);}",
|
|
15475
|
-
".dock-dot.err{background:var(--dsw-alias-state-error-primary);}",
|
|
15476
|
-
".dock-name{font-weight:600;flex:none;}",
|
|
15477
|
-
".dock-desc{color:var(--dsw-alias-label-secondary);flex:1;}",
|
|
15478
|
-
".dock-switch{flex:none;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:3px 10px;cursor:pointer;font-size:12px;}",
|
|
15479
|
-
".dock-switch.on{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary);}",
|
|
15480
|
-
".dock-badge{flex:none;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:3px 10px;font-size:12px;}",
|
|
15481
|
-
".dock-body{border-top:1px solid var(--dsw-alias-border-l1);padding-top:8px;color:var(--dsw-alias-label-secondary);display:flex;flex-direction:column;gap:4px;}",
|
|
15482
|
-
// 侧栏入口按钮(docke2- 前缀)+ 功能坞弹出面板(dockm- 前缀,仿 dsh 设置的居中模态:遮罩 + 对话框,左导航 + 右内容)
|
|
15483
|
-
// 侧栏入口按钮(docke2- 前缀):与 dsh 设置按钮(.VOzbGW_trigger)几何逐条对齐——
|
|
15484
|
-
// 宽栏同为整宽左对齐行按钮(高 42、margin 4/-2、padding 0 10px 0 8px、圆角 12),窄栏同为 36 圆钮居中,
|
|
15485
|
-
// 使两按钮上下成列、左右边缘完全对齐(此前右对齐/叠放都会错位)。
|
|
15486
|
-
".docke2-btn{box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;border:none;background:transparent;color:var(--dsw-alias-label-primary);border-radius:12px;width:calc(100% + 4px);height:42px;margin:4px -2px;padding:0 10px 0 8px;font-family:inherit;font-size:14px;line-height:22px;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
|
|
15487
|
-
".docke2-btn:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
15488
|
-
".docke2-btn.docke2-on{color:var(--dk-accent);background:var(--dk-accent-soft);}",
|
|
15489
|
-
".docke2-btn.docke2-rail{width:36px;height:36px;margin:8px 0 10px;padding:0;border-radius:50%;justify-content:center;gap:0;}",
|
|
15490
|
-
".docke2-label{white-space:nowrap;overflow:hidden;}",
|
|
15491
|
-
// 遮罩固定用深色半透明:亮色主题下宿主 bg-layer-1 是纯白,白底遮罩会让弹窗与页面完全无层次
|
|
15492
|
-
".dockm-backdrop{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;background:rgba(15,17,21,.45);backdrop-filter:blur(4px);pointer-events:auto;animation:dockm-fade .15s var(--ds-ease-in-out);}",
|
|
15493
|
-
"@keyframes dockm-fade{from{opacity:0}to{opacity:1}}",
|
|
15494
|
-
".dockm-dialog{box-sizing:border-box;position:relative;width:min(1080px,calc(100vw - 32px));height:min(700px,calc(100vh - 32px));display:flex;flex-direction:column;border-radius:16px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);box-shadow:0 20px 64px rgb(0 0 0 / .32);overflow:hidden;animation:dockm-pop .18s var(--ds-ease-in-out);}",
|
|
15495
|
-
"@keyframes dockm-pop{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}",
|
|
15496
|
-
".dockm-head{flex:none;display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--dsw-alias-border-l1);cursor:move;user-select:none;touch-action:none;}",
|
|
15497
|
-
".dockm-title{font-weight:600;font-size:14px;}",
|
|
15498
|
-
".dockm-sub{color:var(--dsw-alias-label-tertiary);font-size:12px;}",
|
|
15499
|
-
".dockm-ctrls{margin-left:auto;flex:none;display:flex;align-items:center;gap:2px;}",
|
|
15500
|
-
".dockm-close{cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;font-size:14px;}",
|
|
15501
|
-
".dockm-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
15502
|
-
".dockm-win{cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;}",
|
|
15503
|
-
".dockm-win:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
15504
|
-
".dockm-dialog.dockm-max{border-radius:12px;}",
|
|
15505
|
-
".dockm-dialog.dockm-min{height:auto;min-height:0;}",
|
|
15506
|
-
".dockm-dialog.dockm-min .dockm-body{display:none;}",
|
|
15507
|
-
".dockm-resize{position:absolute;right:0;bottom:0;width:16px;height:16px;cursor:nwse-resize;z-index:3;touch-action:none;}",
|
|
15508
|
-
".dockm-body{flex:1;min-height:0;display:flex;}",
|
|
15509
|
-
".dockm-nav{flex:none;width:176px;display:flex;flex-direction:column;gap:2px;padding:10px 8px;overflow-y:auto;border-right:1px solid var(--dsw-alias-border-l1);}",
|
|
15510
|
-
".dockm-nav-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border:none;background:transparent;border-radius:10px;cursor:pointer;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:13px;text-align:left;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
|
|
15511
|
-
".dockm-nav-item:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
15512
|
-
".dockm-nav-item.on{background:var(--dk-accent-soft);color:var(--dsw-alias-label-primary);font-weight:600;}",
|
|
15513
|
-
".dockm-nav-item .dockm-badge{margin-left:auto;}",
|
|
15514
|
-
".dockm-dot{width:8px;height:8px;border-radius:50%;flex:none;}",
|
|
15515
|
-
".dockm-badge{flex:none;font-size:11px;border-radius:999px;padding:0 8px;color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);}",
|
|
15516
|
-
".dockm-content{flex:1;min-width:0;display:flex;flex-direction:column;gap:12px;padding:16px 18px;overflow-y:auto;}",
|
|
15517
|
-
".dockm-content-head{display:flex;flex-direction:column;gap:4px;}",
|
|
15518
|
-
".dockm-name{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px;}",
|
|
15519
|
-
".dockm-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.6;}",
|
|
15520
|
-
".dockm-view{display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px;}",
|
|
15521
|
-
".dockm-page{box-sizing:border-box;height:100%;display:flex;flex-direction:column;overflow:hidden;padding:16px 20px 0;}",
|
|
15522
|
-
".dockm-page-head{flex:none;display:flex;align-items:flex-start;gap:10px;padding-bottom:12px;border-bottom:1px solid var(--dsw-alias-border-l1);}",
|
|
15523
|
-
".dockm-page-body{flex:1;min-height:0;display:flex;}",
|
|
15524
|
-
".dockm-page-wide-btn{flex:none;margin-left:auto;display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:12px;cursor:pointer;}",
|
|
15525
|
-
".dockm-page-wide-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
15526
|
-
/* 面板页的左侧菜单收窄:给右侧列表/表格让出宽度,别留大片空白 */
|
|
15527
|
-
// 左侧菜单列:内容只有 8px 圆点 + 4 字标签,140px 会留一大条空白(用户反馈「这个宽度可以缩小点」)。
|
|
15528
|
-
// 用 border-box 收到 110px(含内距):既够放最长标签「MCP管理 / 远程访问」,又把右侧死区收掉,正文区更宽。
|
|
15529
|
-
".dockm-page .dockm-nav{box-sizing:border-box;width:110px;padding:8px 7px;}",
|
|
15530
|
-
".dockm-page .dockm-nav-item{padding:7px 8px;font-size:12.5px;gap:6px;overflow:hidden;}",
|
|
15531
|
-
".dockm-page-body>.dockm-body{flex:1;min-height:0;}",
|
|
15532
|
-
".dockm-page-icon{flex:none;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);}",
|
|
15533
|
-
".dockm-page-titles{min-width:0;}",
|
|
15534
|
-
".dockm-page-title{font-size:17px;font-weight:600;color:var(--dsw-alias-label-primary);line-height:1.3;}",
|
|
15535
|
-
".dockm-page-sub{font-size:12px;color:var(--dsw-alias-label-tertiary);margin-top:2px;}",
|
|
15536
|
-
".dockm-note{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.6;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px;}",
|
|
15537
|
-
".dockm-err{color:var(--dsw-alias-state-error-primary);}",
|
|
15538
|
-
".dockm-foot{margin-top:auto;display:flex;align-items:center;gap:8px;color:var(--dsw-alias-label-tertiary);font-size:11px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px;flex-wrap:wrap;}",
|
|
15539
|
-
".dockm-switch{cursor:pointer;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:4px 12px;font-family:inherit;font-size:12px;margin-left:auto;}",
|
|
15540
|
-
".dockm-switch:hover{color:var(--dsw-alias-label-primary);}",
|
|
15541
|
-
".dockm-switch.on{color:var(--dsw-alias-state-success-primary);border-color:currentColor;}",
|
|
15542
|
-
// 首页总揽(dockh- 前缀):导航首项图标 + 模块卡片网格
|
|
15543
|
-
".dockm-navhome{display:inline-flex;align-items:center;color:var(--dk-accent);flex:none;}",
|
|
15544
|
-
".dockh-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;}",
|
|
15545
|
-
".dockh-card{display:flex;flex-direction:column;gap:6px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:10px 12px;cursor:pointer;transition:border-color .15s var(--ds-ease-in-out);}",
|
|
15546
|
-
".dockh-card:hover,.dockh-card:focus-visible{border-color:var(--dk-accent);outline:none;}",
|
|
15547
|
-
".dockh-head{display:flex;align-items:center;gap:8px;}",
|
|
15548
|
-
".dockh-name{font-weight:600;flex:none;}",
|
|
15549
|
-
".dockh-badge{flex:none;font-size:11px;border-radius:999px;padding:0 8px;color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);}",
|
|
15550
|
-
// 状态标识(非交互:圆点+文字,与可点的开关一眼区分)
|
|
15551
|
-
".dockh-status{margin-left:auto;flex:none;display:inline-flex;align-items:center;gap:5px;font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;}",
|
|
15552
|
-
".dockh-sdot{width:7px;height:7px;border-radius:50%;flex:none;background:var(--dsw-alias-state-success-primary,#34d399);box-shadow:0 0 4px color-mix(in srgb,var(--dsw-alias-state-success-primary,#34d399) 55%,transparent);}",
|
|
15553
|
-
".dockh-status.off .dockh-sdot{background:transparent;border:1.5px solid var(--dsw-alias-label-tertiary);box-shadow:none;opacity:.75;}",
|
|
15554
|
-
".dockh-status.plan .dockh-sdot{background:transparent;border:1.5px dashed var(--dsw-alias-label-tertiary);box-shadow:none;}",
|
|
15555
|
-
// iOS 风滑动开关(首页卡片 / 弹层页脚 / 设置页共用的启停控件)
|
|
15556
|
-
".dock-sw{flex:none;position:relative;width:34px;height:19px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);cursor:pointer;padding:0;transition:background .18s var(--ds-ease-in-out),border-color .18s var(--ds-ease-in-out);}",
|
|
15557
|
-
'.dock-sw::after{content:"";position:absolute;top:2px;left:2px;width:13px;height:13px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgb(0 0 0 / .35);transition:transform .18s var(--ds-ease-in-out);}',
|
|
15558
|
-
".dock-sw:hover{border-color:var(--dk-accent);}",
|
|
15559
|
-
".dock-sw.on{background:var(--dsw-alias-state-success-primary,#34d399);border-color:transparent;}",
|
|
15560
|
-
".dock-sw.on::after{transform:translateX(15px);}",
|
|
15561
|
-
// 弹层页脚:文字标签 + 开关 成组
|
|
15562
|
-
".dockm-foot-sw{margin-left:auto;flex:none;display:inline-flex;align-items:center;gap:8px;}",
|
|
15563
|
-
".dockm-foot-swlabel{font-size:11px;color:var(--dsw-alias-label-tertiary);}",
|
|
15564
|
-
".dockm-foot-swlabel.on{color:var(--dsw-alias-state-success-primary);}",
|
|
15565
|
-
// 窄屏:功能坞是一级工作台而不是被压扁的桌面弹窗。全屏承接安全区,导航改横向,
|
|
15566
|
-
// 禁用桌面拖拽/缩放,所有导航和关闭动作保持至少 44px 的可点击面积。
|
|
15567
|
-
"@media (max-width:680px){.dockm-backdrop{align-items:stretch;justify-content:stretch;background:var(--dsw-alias-bg-layer-2);backdrop-filter:none}.dockm-dialog,.dockm-dialog.dockm-max{position:fixed!important;left:0!important;top:0!important;right:auto!important;bottom:auto!important;width:100dvw!important;height:100dvh!important;min-height:100dvh;border:0;border-radius:0;box-shadow:none}.dockm-dialog.dockm-min .dockm-body{display:flex}.dockm-head{min-height:60px;box-sizing:border-box;padding:calc(env(safe-area-inset-top) + 8px) 12px 8px;cursor:default;touch-action:manipulation}.dockm-sub,.dockm-win,.dockm-resize{display:none}.dockm-title{font-size:16px}.dockm-close{width:44px;height:44px;font-size:17px}.dockm-body{flex-direction:column;min-height:0}.dockm-nav{box-sizing:border-box;width:auto;max-width:100%;min-height:56px;flex-direction:row;gap:6px;padding:6px 10px;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none;overscroll-behavior-x:contain}.dockm-nav::-webkit-scrollbar{display:none}.dockm-nav-item{flex:none;min-height:44px;padding:0 12px;font-size:13px;touch-action:manipulation}.dockm-nav-item .dockm-badge{display:none}.dockm-content{padding:16px max(16px,env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));gap:14px;overscroll-behavior:contain}.dockm-content-head{gap:5px}.dockm-name{font-size:16px}.dockm-desc{font-size:13px;line-height:1.55}.dockm-foot{padding-top:12px;font-size:11px}.dockm-foot-sw{width:100%;margin-left:0;justify-content:space-between}.dock-sw{width:44px;height:26px}.dock-sw::after{top:3px;left:3px;width:18px;height:18px}.dock-sw.on::after{transform:translateX(18px)}.dockh-grid{grid-template-columns:minmax(0,1fr);gap:10px;min-width:0}.dockh-card{padding:12px;box-sizing:border-box;min-width:0}.dockh-desc{font-size:13px}.dockh-go{font-size:12px}}",
|
|
15568
|
-
/* 手机端:功能坞弹层挂在 .overlayLayer(z20) 内,会被 z71 的侧栏抽屉盖住(只剩右侧一条)。\n 把 overlayLayer 在窄屏抬到抽屉之上,面板才能全屏覆盖——且不依赖【手机适配】模块是否启用。 */
|
|
15569
|
-
/* 只在「功能坞弹层真的打开」时抬 z 序(:has 精确到 .dockm-dialog),其余时候不碰 DSH 原生浮层 */
|
|
15570
|
-
'@media (max-width:767px){body:has(.dockm-dialog) [class*="overlayLayer"]{z-index:100 !important}}',
|
|
15571
|
-
/* 手机:功能坞面板页的左侧菜单改成横向可滚动条,占满整行;页头与内边距收紧,「全屏」按钮在手机上无意义(侧栏本就是抽屉)故隐藏 */
|
|
15572
|
-
"@media (max-width:767px){.dockm-page{padding:12px 12px 0}.dockm-page-head{gap:8px;padding-bottom:10px}.dockm-page-sub{display:none}.dockm-page-wide-btn{display:none}.dockm-page .dockm-nav{width:auto;max-width:100%;flex-direction:row;gap:6px;padding:8px 0;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none}.dockm-page .dockm-nav::-webkit-scrollbar{display:none}.dockm-page .dockm-nav-item{flex:none;min-height:40px;padding:0 10px;font-size:12.5px}.dockm-page .dockm-page-body{flex-direction:column}.dockm-page .dockm-body{flex-direction:column;min-height:0}.dockm-page .dockm-content{padding:12px 0 16px;gap:12px}}",
|
|
15573
|
-
/* 手机自适应(≤767px,始终生效,不依赖任何功能开关):
|
|
15574
|
-
· 输入卡贴底(空会话时不再垂直居中留大片空白);
|
|
15575
|
-
· 输入卡里的「轮/步/token/缓存」状态条移到输入框上方,压成一行不溢出。 */
|
|
15576
|
-
'@media (max-width:767px){[class*="scrollBody"]>[class*="composerSeat"]{margin-top:auto!important;padding-bottom:0!important}[class*="composerSeat"] [class*="_dock"]{order:-1!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important;padding:0 2px 6px!important;gap:6px!important;font-size:10px!important;overflow:hidden!important;flex-wrap:nowrap!important;white-space:nowrap!important}[class*="composerSeat"] [class*="_dock"]>*{min-width:0;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[class*="composerSeat"] [class*="_dock"]>*:first-child{flex:0 0 auto}[class*="composerSeat"] [class*="_row"]{gap:4px!important}}',
|
|
15577
|
-
/* 手机自适应:设置弹层内容给安全区内边距、会话滚动体留底部安全区、代码块横向滚动、
|
|
15578
|
-
行内代码可断行(窄屏不撑破版面)。 */
|
|
15579
|
-
'@media (max-width:767px){[role="dialog"][class*="panel"] [class*="options"]{padding-left:max(16px,env(safe-area-inset-left,0px))!important;padding-right:max(16px,env(safe-area-inset-right,0px))!important}[class*="scrollBody"]{padding-bottom:env(safe-area-inset-bottom,0px)!important}pre{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}code{overflow-wrap:anywhere}pre code{overflow-wrap:normal}}',
|
|
15580
|
-
"@media (prefers-reduced-motion:reduce){.dockm-backdrop,.dockm-dialog{animation:none}.dockm-nav-item,.dockm-close,.dockm-win,.dock-sw{transition:none}}",
|
|
15581
|
-
".dockh-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5;}",
|
|
15582
|
-
".dockh-stat{color:var(--dsw-alias-label-tertiary);font-size:12px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
15583
|
-
".dockh-foot{display:flex;align-items:center;gap:8px;}",
|
|
15584
|
-
".dockh-go{color:var(--dsw-alias-label-tertiary);font-size:11px;}",
|
|
15585
|
-
// 会话输入区工具行 chips(dockchip- 前缀):余额/用量随身小控件,挂在模型选择器左侧
|
|
15586
|
-
// 溢出兼容(两层防护,缺一不可):
|
|
15587
|
-
// 1) 宽度上限:宿主 .row 是 flex-wrap:wrap 且换行优先于收缩,chips 一长 tools 整行变宽,
|
|
15588
|
-
// 右侧模型选择器/发送键被挤到第二行(左右错位)。宿主 .row 带 container-type:inline-size,
|
|
15589
|
-
// 用容器单位 cqw 让上限随输入卡宽度自适应(窄卡少占、宽卡多占);不支持 cqw 的老内核退回固定值。
|
|
15590
|
-
// 注意:旧上限 min(280px,36cqw) 仍偏宽——标准 780px 输入卡下(.row 内容约 762px),
|
|
15591
|
-
// add 钮(28)+工作区选择器(~214)+chips(280) 已与右侧模型选择器+发送键(~345px)合计超宽,
|
|
15592
|
-
// 即便 chips 未截断 .row 也会换行把模型选择器/发送键挤到第二行。实测把上限收到 189px
|
|
15593
|
-
// (≈25cqw)并使 chips 内距收紧(padding 2px 6px、gap 2px)后,「4~6M 用量 + 余额」
|
|
15594
|
-
// 两 chip 可完整显示且不再换行。v0.11.2:配置单价后费用段「· ¥0.03」让两 chip 合计
|
|
15595
|
-
// 约需 204px,189px 恰好截掉约 2 个数字(费用/余额小数位看不到)——按用户反馈放宽到
|
|
15596
|
-
// 216px(≈28cqw),标准卡下实测完整显示;若再出现把模型选择器挤换行,优先压缩用量
|
|
15597
|
-
// chip 的 ⛁ 前缀换空间,别再收这个上限。超限仍省略号截断,完整值在 title 悬浮提示里。
|
|
15598
|
-
// 2) 截断:超限部分用省略号截断(完整数值在 title 悬浮提示里),防 chips 凸出输入卡圆角(悬空)。
|
|
15599
|
-
".dockchip-row{display:inline-flex;align-items:center;gap:2px;min-width:0;flex:0 1 auto;overflow:hidden;max-width:216px;}",
|
|
15600
|
-
"@supports (width:1cqw){.dockchip-row{max-width:min(216px,28cqw);}}",
|
|
15601
|
-
".dockchip{display:inline-flex;align-items:center;gap:5px;cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;padding:2px 6px;font-family:inherit;font-size:11px;line-height:18px;white-space:nowrap;min-width:0;overflow:hidden;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
|
|
15602
|
-
".dockchip > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}",
|
|
15603
|
-
".dockchip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
15604
|
-
".dockchip .dockchip-dot{width:6px;height:6px;border-radius:50%;flex:none;}",
|
|
15605
|
-
".dockchip.err{color:var(--dsw-alias-state-error-primary);}",
|
|
15606
|
-
/* 手机自适应:输入区工具行很窄——chip 字号/内距收紧、隐藏费用后缀与「余额」前缀,
|
|
15607
|
-
数值完整显示且工具行保持单行不换行(完整信息仍在 title 悬浮提示里)。 */
|
|
15608
|
-
".dockchip-pre-s{display:none;}",
|
|
15609
|
-
".dockchip-svg{display:none;align-items:center;justify-content:center;}",
|
|
15610
|
-
/* 手机端:输入区工具行太窄,余额/用量只留两枚小图标(点进功能坞看具体数据),
|
|
15611
|
-
文本与圆点全部隐藏,图标做成 24×24 的稳定触控块 → 工具行必定单行。 */
|
|
15612
|
-
"@media (max-width:767px){.dockchip-row{max-width:min(92px,20cqw);gap:2px}.dockchip-svg{display:inline-flex}.dockchip-val,.dockchip-pre,.dockchip-pre-s,.dockchip-ic,.dockchip-x,.dockchip .dockchip-dot{display:none}.dockchip{width:24px;height:24px;box-sizing:border-box;justify-content:center;padding:0!important;gap:0!important;border-radius:6px}}",
|
|
15613
|
-
/* 手机触控基础:去点按蓝块、消双击缩放判定延迟;原生侧栏开关热区扩到 44×44(视觉不变)。 */
|
|
15614
|
-
`@media (max-width:767px){:is(button,[role="button"]){-webkit-tap-highlight-color:transparent;touch-action:manipulation}[data-sidebar-opener]{position:relative}[data-sidebar-opener]::after{content:'';position:absolute;left:50%;top:50%;width:44px;height:44px;transform:translate(-50%,-50%)}}`
|
|
15615
|
-
].join("\n");
|
|
15616
|
-
var dockCssTag = null;
|
|
15617
|
-
var initialCssSchedule = null;
|
|
15618
|
-
function cancelInitialCssSchedule() {
|
|
15619
|
-
if (!initialCssSchedule || typeof window === "undefined") return;
|
|
15620
|
-
if (initialCssSchedule.type === "idle" && typeof window.cancelIdleCallback === "function") window.cancelIdleCallback(initialCssSchedule.id);
|
|
15621
|
-
if (initialCssSchedule.type === "timer") window.clearTimeout(initialCssSchedule.id);
|
|
15622
|
-
initialCssSchedule = null;
|
|
15438
|
+
function subscribe(fn) {
|
|
15439
|
+
store.listeners.add(fn);
|
|
15440
|
+
return () => {
|
|
15441
|
+
store.listeners.delete(fn);
|
|
15442
|
+
};
|
|
15623
15443
|
}
|
|
15624
|
-
function
|
|
15625
|
-
const
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15444
|
+
function applyPayload(data) {
|
|
15445
|
+
const groups = data && data.ok === true && Array.isArray(data.groups) ? data.groups : null;
|
|
15446
|
+
if (!groups) {
|
|
15447
|
+
store.error = data && data.error || "\u5BBF\u4E3B\u8FD4\u56DE\u7684\u914D\u7F6E\u683C\u5F0F\u4E0D\u6B63\u786E";
|
|
15448
|
+
notify();
|
|
15449
|
+
return false;
|
|
15450
|
+
}
|
|
15451
|
+
store.groups = groups;
|
|
15452
|
+
store.error = "";
|
|
15453
|
+
store.ready = true;
|
|
15454
|
+
notify();
|
|
15455
|
+
return true;
|
|
15629
15456
|
}
|
|
15630
|
-
function
|
|
15631
|
-
if (
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
} else {
|
|
15638
|
-
dockCssTag = document.createElement("style");
|
|
15639
|
-
document.head.appendChild(dockCssTag);
|
|
15640
|
-
}
|
|
15641
|
-
}
|
|
15642
|
-
dockCssTag.dataset.plugin = "dsh-dock";
|
|
15643
|
-
dockCssTag.dataset.pluginCss = "dsh-dock";
|
|
15644
|
-
dockCssTag.textContent = fullDockCss();
|
|
15645
|
-
} catch (e) {
|
|
15646
|
-
console.error("[dsh-dock] ensureCss failed:", e && e.message ? e.message : String(e));
|
|
15457
|
+
function ensureLoaded() {
|
|
15458
|
+
if (store.ready) return Promise.resolve(true);
|
|
15459
|
+
if (store.loading) return store.loading;
|
|
15460
|
+
if (typeof fetch !== "function") {
|
|
15461
|
+
store.error = "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 fetch";
|
|
15462
|
+
notify();
|
|
15463
|
+
return Promise.resolve(false);
|
|
15647
15464
|
}
|
|
15465
|
+
store.loading = fetch(ENDPOINT2, { headers: { accept: "application/json" } }).then(async (res) => {
|
|
15466
|
+
if (!res.ok) throw new Error("HTTP " + res.status);
|
|
15467
|
+
return res.json();
|
|
15468
|
+
}).then((data) => applyPayload(data)).catch(() => {
|
|
15469
|
+
store.error = "\u5BBF\u4E3B\u6CA1\u6709\u300CDSH\u529F\u80FD\u300D\u63A5\u53E3\uFF1A\u5BBF\u4E3B\u8FDB\u7A0B\u53EF\u80FD\u662F\u65E7\u7248\u672C\uFF0C\u6216\u8BE5\u529F\u80FD\u5728\u5BBF\u4E3B\u4FA7\u672A\u542F\u7528\uFF08\u91CD\u542F dsh web\uFF0C\u6216\u5728\u529F\u80FD\u575E\u91CC\u5173\u6389\u518D\u6253\u5F00\u672C\u529F\u80FD\uFF09";
|
|
15470
|
+
notify();
|
|
15471
|
+
return false;
|
|
15472
|
+
}).finally(() => {
|
|
15473
|
+
store.loading = null;
|
|
15474
|
+
});
|
|
15475
|
+
return store.loading;
|
|
15648
15476
|
}
|
|
15649
|
-
function
|
|
15650
|
-
const
|
|
15477
|
+
function valueOf(groupId, key) {
|
|
15478
|
+
const group = store.groups.find((g) => g.id === groupId);
|
|
15479
|
+
const item = group && Array.isArray(group.items) ? group.items.find((i) => i.key === key) : void 0;
|
|
15480
|
+
return item ? item.value === true : void 0;
|
|
15481
|
+
}
|
|
15482
|
+
async function setValue(groupId, key, value) {
|
|
15483
|
+
const res = await fetch(ENDPOINT2, {
|
|
15484
|
+
method: "POST",
|
|
15485
|
+
headers: { "content-type": "application/json" },
|
|
15486
|
+
body: JSON.stringify({ group: groupId, key, value: value === true })
|
|
15487
|
+
});
|
|
15488
|
+
const data = await res.json().catch(() => null);
|
|
15489
|
+
if (!res.ok || !data || data.ok !== true) {
|
|
15490
|
+
throw new Error(data && data.error || "HTTP " + res.status);
|
|
15491
|
+
}
|
|
15492
|
+
applyPayload(data);
|
|
15493
|
+
}
|
|
15494
|
+
function filePathOf(url) {
|
|
15495
|
+
if (typeof url !== "string" || url.length === 0) return void 0;
|
|
15496
|
+
let parsed;
|
|
15497
|
+
try {
|
|
15498
|
+
parsed = new URL(url, document.baseURI);
|
|
15499
|
+
} catch (e) {
|
|
15500
|
+
return void 0;
|
|
15501
|
+
}
|
|
15502
|
+
if (typeof location !== "undefined" && parsed.origin !== location.origin) return void 0;
|
|
15503
|
+
if (!/\/api\/file$/.test(parsed.pathname)) return void 0;
|
|
15504
|
+
const path = parsed.searchParams.get("path");
|
|
15505
|
+
return path && path.length > 0 ? path : void 0;
|
|
15506
|
+
}
|
|
15507
|
+
var routeReady = false;
|
|
15508
|
+
var routeProbe = null;
|
|
15509
|
+
function ensureRoute() {
|
|
15510
|
+
if (routeReady) return Promise.resolve(true);
|
|
15511
|
+
if (routeProbe) return routeProbe;
|
|
15512
|
+
if (typeof fetch !== "function") return Promise.resolve(false);
|
|
15513
|
+
routeProbe = fetch("dsh-dock/download?probe=1", { method: "HEAD", cache: "no-store" }).then((res) => {
|
|
15514
|
+
routeReady = res.status === 204 || res.ok === true;
|
|
15515
|
+
return routeReady;
|
|
15516
|
+
}).catch(() => false).finally(() => {
|
|
15517
|
+
routeProbe = null;
|
|
15518
|
+
});
|
|
15519
|
+
return routeProbe;
|
|
15520
|
+
}
|
|
15521
|
+
function shouldTakeover() {
|
|
15522
|
+
const state = stateOf("dshtools");
|
|
15523
|
+
if (!state || state.enabled !== true) return false;
|
|
15524
|
+
if (valueOf("fileContextMenu", "streamingDownload") === false) return false;
|
|
15525
|
+
if (!routeReady) {
|
|
15526
|
+
void ensureRoute();
|
|
15527
|
+
return false;
|
|
15528
|
+
}
|
|
15529
|
+
return true;
|
|
15530
|
+
}
|
|
15531
|
+
function installDownloadTakeover(actions) {
|
|
15532
|
+
if (!actions || typeof actions.save !== "function" || actions.__dshDockStreamingDownload === true) return;
|
|
15533
|
+
const original = actions.save;
|
|
15534
|
+
const wrapped = async function(source, mode) {
|
|
15535
|
+
if (mode === "download" && actions.canSaveAs !== true && shouldTakeover()) {
|
|
15536
|
+
const path = filePathOf(source && source.url);
|
|
15537
|
+
if (path !== void 0) {
|
|
15538
|
+
try {
|
|
15539
|
+
startDownload(path);
|
|
15540
|
+
return { status: "requested" };
|
|
15541
|
+
} catch (e) {
|
|
15542
|
+
}
|
|
15543
|
+
}
|
|
15544
|
+
}
|
|
15545
|
+
return original.call(actions, source, mode);
|
|
15546
|
+
};
|
|
15547
|
+
wrapped.__original = original;
|
|
15548
|
+
try {
|
|
15549
|
+
actions.save = wrapped;
|
|
15550
|
+
actions.__dshDockStreamingDownload = true;
|
|
15551
|
+
} catch (e) {
|
|
15552
|
+
}
|
|
15553
|
+
}
|
|
15554
|
+
function startDownload(absolutePath) {
|
|
15555
|
+
if (typeof document === "undefined" || !document.body) return;
|
|
15556
|
+
const base = document.baseURI || (typeof location !== "undefined" ? location.href : "http://localhost/");
|
|
15557
|
+
const url = new URL("dsh-dock/download?path=" + encodeURIComponent(absolutePath), base);
|
|
15558
|
+
const anchor = document.createElement("a");
|
|
15559
|
+
anchor.href = url.href;
|
|
15560
|
+
anchor.download = "";
|
|
15561
|
+
anchor.rel = "noopener";
|
|
15562
|
+
document.body.append(anchor);
|
|
15563
|
+
anchor.click();
|
|
15564
|
+
anchor.remove();
|
|
15565
|
+
}
|
|
15566
|
+
async function resolveFileMenu(remote, target, signal) {
|
|
15567
|
+
const state = stateOf("dshtools");
|
|
15568
|
+
if (!state || state.enabled !== true) return [];
|
|
15569
|
+
if (!store.ready) {
|
|
15570
|
+
void ensureLoaded();
|
|
15571
|
+
return [];
|
|
15572
|
+
}
|
|
15573
|
+
if (valueOf("fileContextMenu", "streamingDownload") !== true) return [];
|
|
15574
|
+
let result;
|
|
15575
|
+
try {
|
|
15576
|
+
result = await remote.workspaceFiles.stat(target.sessionId, target.path, signal);
|
|
15577
|
+
} catch (e) {
|
|
15578
|
+
return [];
|
|
15579
|
+
}
|
|
15580
|
+
if (!result || result.ok !== true || !result.value) return [];
|
|
15581
|
+
const bytes = typeof result.value.bytes === "number" ? result.value.bytes : void 0;
|
|
15582
|
+
if (bytes === void 0 || bytes <= LARGE_FILE_BYTES) return [];
|
|
15583
|
+
const absolutePath = result.value.absolutePath;
|
|
15584
|
+
if (typeof absolutePath !== "string" || absolutePath.length === 0) return [];
|
|
15585
|
+
return [{
|
|
15586
|
+
id: "download-large",
|
|
15587
|
+
label: "\u4E0B\u8F7D\uFF08\u5927\u6587\u4EF6\uFF09",
|
|
15588
|
+
icon: { key: "dsh-dock.download" },
|
|
15589
|
+
run: () => startDownload(absolutePath)
|
|
15590
|
+
}];
|
|
15591
|
+
}
|
|
15592
|
+
function DownloadIcon() {
|
|
15593
|
+
return import_react22.default.createElement(
|
|
15594
|
+
"svg",
|
|
15595
|
+
{
|
|
15596
|
+
width: 14,
|
|
15597
|
+
height: 14,
|
|
15598
|
+
viewBox: "0 0 16 16",
|
|
15599
|
+
fill: "none",
|
|
15600
|
+
"aria-hidden": "true"
|
|
15601
|
+
},
|
|
15602
|
+
import_react22.default.createElement("path", {
|
|
15603
|
+
d: "M8 2.5v7.2m0 0 2.8-2.8M8 9.7 5.2 6.9M3 13h10",
|
|
15604
|
+
stroke: "currentColor",
|
|
15605
|
+
strokeWidth: 1.4,
|
|
15606
|
+
strokeLinecap: "round",
|
|
15607
|
+
strokeLinejoin: "round"
|
|
15608
|
+
})
|
|
15609
|
+
);
|
|
15610
|
+
}
|
|
15611
|
+
function serviceOf(scope, name) {
|
|
15612
|
+
if (!scope) return void 0;
|
|
15613
|
+
const direct = scope[name];
|
|
15614
|
+
if (direct !== void 0) return direct;
|
|
15615
|
+
return typeof scope.get === "function" ? scope.get(name) : void 0;
|
|
15616
|
+
}
|
|
15617
|
+
function onServices(ctx, names, run) {
|
|
15618
|
+
if (typeof ctx.inject === "function") {
|
|
15619
|
+
try {
|
|
15620
|
+
ctx.inject(names, (scope) => run(scope));
|
|
15621
|
+
return;
|
|
15622
|
+
} catch (e) {
|
|
15623
|
+
}
|
|
15624
|
+
}
|
|
15625
|
+
run(ctx);
|
|
15626
|
+
}
|
|
15627
|
+
function installClient(ctx) {
|
|
15628
|
+
if (!ctx || typeof ctx !== "object") return;
|
|
15629
|
+
ensureLoaded();
|
|
15630
|
+
onServices(ctx, ["slots"], (scope) => {
|
|
15631
|
+
const slots = serviceOf(scope, "slots");
|
|
15632
|
+
if (!slots || typeof slots.inject !== "function" || typeof slots.register !== "function") return;
|
|
15633
|
+
slots.inject("contextMenu.icon", function* () {
|
|
15634
|
+
yield slots.register({ name: "contextMenu.icon", key: "dsh-dock.download" }, DownloadIcon);
|
|
15635
|
+
});
|
|
15636
|
+
});
|
|
15637
|
+
onServices(ctx, ["contextMenus", "remote.workspaceFiles"], (scope) => {
|
|
15638
|
+
const menus = serviceOf(scope, "contextMenus");
|
|
15639
|
+
const remote = serviceOf(scope, "remote");
|
|
15640
|
+
if (!menus || typeof menus.register !== "function") return;
|
|
15641
|
+
if (!remote || !remote.workspaceFiles || typeof remote.workspaceFiles.stat !== "function") return;
|
|
15642
|
+
const register = () => menus.register({
|
|
15643
|
+
id: "dsh-dock.dshtools.file",
|
|
15644
|
+
target: "file",
|
|
15645
|
+
// 排在 DSH 自带 file-actions(order 200)之后:同菜单里我们的是补充项。
|
|
15646
|
+
order: 210,
|
|
15647
|
+
resolve: (target, signal) => resolveFileMenu(remote, target, signal)
|
|
15648
|
+
});
|
|
15649
|
+
if (typeof scope.effect === "function") scope.effect(register, "dsh-dock: DSH\u529F\u80FD \xB7 \u6587\u4EF6\u53F3\u952E");
|
|
15650
|
+
else register();
|
|
15651
|
+
});
|
|
15652
|
+
ensureRoute();
|
|
15653
|
+
onServices(ctx, ["fileActions"], (scope) => {
|
|
15654
|
+
const actions = serviceOf(scope, "fileActions");
|
|
15655
|
+
if (!actions) return;
|
|
15656
|
+
installDownloadTakeover(actions);
|
|
15657
|
+
if (typeof scope.effect === "function") {
|
|
15658
|
+
scope.effect(() => () => {
|
|
15659
|
+
if (actions.__dshDockStreamingDownload !== true) return;
|
|
15660
|
+
const restore = actions.save && actions.save.__original;
|
|
15661
|
+
if (typeof restore === "function") {
|
|
15662
|
+
try {
|
|
15663
|
+
actions.save = restore;
|
|
15664
|
+
} catch (e) {
|
|
15665
|
+
}
|
|
15666
|
+
}
|
|
15667
|
+
delete actions.__dshDockStreamingDownload;
|
|
15668
|
+
}, "dsh-dock: DSH\u529F\u80FD \xB7 \u4E0B\u8F7D\u63A5\u7BA1");
|
|
15669
|
+
}
|
|
15670
|
+
});
|
|
15671
|
+
}
|
|
15672
|
+
var CSS2 = [
|
|
15673
|
+
".dkht{display:flex;flex-direction:column;gap:12px;}",
|
|
15674
|
+
".dkht-intro{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.7;border:1px dashed var(--dsw-alias-border-l1);border-radius:8px;padding:8px 10px;}",
|
|
15675
|
+
".dkht-group{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;padding:10px 12px;display:flex;flex-direction:column;gap:6px;background:var(--dsw-alias-bg-layer-1);}",
|
|
15676
|
+
".dkht-group-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;}",
|
|
15677
|
+
".dkht-group-name{font-weight:600;font-size:13px;}",
|
|
15678
|
+
".dkht-group-desc{font-size:11px;color:var(--dsw-alias-label-tertiary);}",
|
|
15679
|
+
".dkht-item{display:flex;gap:10px;align-items:flex-start;padding:8px 10px;border-radius:8px;cursor:pointer;border:1px solid transparent;transition:background .12s,border-color .12s;}",
|
|
15680
|
+
".dkht-item:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
15681
|
+
".dkht-item.on{border-color:color-mix(in srgb,var(--dk-accent) 35%,transparent);background:var(--dk-hover-tint);}",
|
|
15682
|
+
".dkht-item.busy{opacity:.6;cursor:progress;}",
|
|
15683
|
+
".dkht-check{width:15px;height:15px;margin:2px 0 0;accent-color:var(--dk-accent);flex:none;cursor:pointer;}",
|
|
15684
|
+
".dkht-text{display:flex;flex-direction:column;gap:2px;min-width:0;}",
|
|
15685
|
+
".dkht-name{font-size:12px;font-weight:600;}",
|
|
15686
|
+
".dkht-desc{font-size:11px;line-height:1.6;color:var(--dsw-alias-label-secondary);}",
|
|
15687
|
+
".dkht-error{color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:1.6;}",
|
|
15688
|
+
".dkht-empty{color:var(--dsw-alias-label-tertiary);font-size:12px;}",
|
|
15689
|
+
".dkht-note{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.6;}"
|
|
15690
|
+
].join("\n");
|
|
15691
|
+
function DshToolsView(props) {
|
|
15692
|
+
const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
15693
|
+
const [busy, setBusy] = import_react22.default.useState("");
|
|
15694
|
+
const [error, setError] = import_react22.default.useState("");
|
|
15651
15695
|
import_react22.default.useEffect(() => {
|
|
15696
|
+
const off = subscribe(() => force());
|
|
15697
|
+
ensureLoaded().then(() => force());
|
|
15698
|
+
return off;
|
|
15699
|
+
}, []);
|
|
15700
|
+
const toggle = async (group, item) => {
|
|
15701
|
+
const id = group.id + "/" + item.key;
|
|
15702
|
+
if (busy) return;
|
|
15703
|
+
setBusy(id);
|
|
15704
|
+
setError("");
|
|
15705
|
+
try {
|
|
15706
|
+
await setValue(group.id, item.key, item.value !== true);
|
|
15707
|
+
} catch (e) {
|
|
15708
|
+
setError(e && e.message ? e.message : String(e));
|
|
15709
|
+
} finally {
|
|
15710
|
+
setBusy("");
|
|
15711
|
+
}
|
|
15712
|
+
};
|
|
15713
|
+
const groups = store.groups;
|
|
15714
|
+
return import_react22.default.createElement(
|
|
15715
|
+
"div",
|
|
15716
|
+
{ className: "dkht" },
|
|
15717
|
+
import_react22.default.createElement(
|
|
15718
|
+
"div",
|
|
15719
|
+
{ className: "dkht-intro" },
|
|
15720
|
+
"\u8FD9\u91CC\u7ED9 DSH \u81EA\u5E26\u754C\u9762\u8865\u5145\u80FD\u529B\uFF0C\u6309\u5206\u7EC4\u9010\u9879\u52FE\u9009\uFF1B\u52FE\u9009\u72B6\u6001\u4FDD\u5B58\u5728\u529F\u80FD\u575E\u8BBE\u7F6E\u91CC\uFF0C\u6362\u6D4F\u89C8\u5668\u4E5F\u4E00\u81F4\u3002",
|
|
15721
|
+
"\u53D6\u6D88\u52FE\u9009\u5373\u5B8C\u5168\u64A4\u6389\u5BF9\u5E94\u5165\u53E3\uFF0C\u4E0D\u5F71\u54CD DSH \u539F\u6709\u529F\u80FD\u3002"
|
|
15722
|
+
),
|
|
15723
|
+
error ? import_react22.default.createElement("div", { className: "dkht-error" }, error) : null,
|
|
15724
|
+
store.error ? import_react22.default.createElement("div", { className: "dkht-error" }, store.error) : null,
|
|
15725
|
+
!store.ready && !store.error ? import_react22.default.createElement("div", { className: "dkht-empty" }, "\u6B63\u5728\u8BFB\u53D6\u914D\u7F6E\u2026") : null,
|
|
15726
|
+
groups.map((group) => import_react22.default.createElement(
|
|
15727
|
+
"div",
|
|
15728
|
+
{ className: "dkht-group", key: group.id },
|
|
15729
|
+
import_react22.default.createElement(
|
|
15730
|
+
"div",
|
|
15731
|
+
{ className: "dkht-group-head" },
|
|
15732
|
+
import_react22.default.createElement("span", { className: "dkht-group-name" }, group.name),
|
|
15733
|
+
group.description ? import_react22.default.createElement("span", { className: "dkht-group-desc" }, group.description) : null
|
|
15734
|
+
),
|
|
15735
|
+
group.items.map((item) => {
|
|
15736
|
+
const id = group.id + "/" + item.key;
|
|
15737
|
+
return import_react22.default.createElement(
|
|
15738
|
+
"label",
|
|
15739
|
+
{
|
|
15740
|
+
key: item.key,
|
|
15741
|
+
className: "dkht-item" + (item.value === true ? " on" : "") + (busy === id ? " busy" : "")
|
|
15742
|
+
},
|
|
15743
|
+
import_react22.default.createElement("input", {
|
|
15744
|
+
type: "checkbox",
|
|
15745
|
+
className: "dkht-check",
|
|
15746
|
+
checked: item.value === true,
|
|
15747
|
+
disabled: busy !== "",
|
|
15748
|
+
onChange: () => {
|
|
15749
|
+
void toggle(group, item);
|
|
15750
|
+
}
|
|
15751
|
+
}),
|
|
15752
|
+
import_react22.default.createElement(
|
|
15753
|
+
"span",
|
|
15754
|
+
{ className: "dkht-text" },
|
|
15755
|
+
import_react22.default.createElement("span", { className: "dkht-name" }, item.name),
|
|
15756
|
+
item.description ? import_react22.default.createElement("span", { className: "dkht-desc" }, item.description) : null
|
|
15757
|
+
)
|
|
15758
|
+
);
|
|
15759
|
+
})
|
|
15760
|
+
)),
|
|
15761
|
+
import_react22.default.createElement(
|
|
15762
|
+
"div",
|
|
15763
|
+
{ className: "dkht-note" },
|
|
15764
|
+
"\u540E\u7EED\u65B0\u589E\u7684 DSH \u589E\u5F3A\u80FD\u529B\u4F1A\u4EE5\u65B0\u5206\u7EC4/\u65B0\u52FE\u9009\u9879\u51FA\u73B0\u5728\u8FD9\u91CC\uFF0C\u65E0\u9700\u53E6\u5916\u914D\u7F6E\u3002"
|
|
15765
|
+
)
|
|
15766
|
+
);
|
|
15767
|
+
}
|
|
15768
|
+
var feature12 = {
|
|
15769
|
+
id: "dshtools",
|
|
15770
|
+
name: "DSH\u529F\u80FD",
|
|
15771
|
+
order: 170,
|
|
15772
|
+
accent: "#8b5cf6",
|
|
15773
|
+
description: "\u7ED9 DSH \u81EA\u5E26\u754C\u9762\u8865\u5145\u80FD\u529B\uFF08\u6587\u4EF6\u53F3\u952E\u7B49\uFF09\uFF0C\u6309\u5206\u7EC4\u52FE\u9009\u542F\u7528",
|
|
15774
|
+
defaultEnabled: true,
|
|
15775
|
+
css: CSS2,
|
|
15776
|
+
View: DshToolsView
|
|
15777
|
+
};
|
|
15778
|
+
|
|
15779
|
+
// features/git/view.jsx
|
|
15780
|
+
var import_react23 = require("react");
|
|
15781
|
+
|
|
15782
|
+
// features/git/rpc.js
|
|
15783
|
+
async function rpc2(method, body) {
|
|
15784
|
+
const res = await fetch("dsh-dock/git/" + method, {
|
|
15785
|
+
method: body === void 0 ? "GET" : "POST",
|
|
15786
|
+
headers: body === void 0 ? void 0 : { "content-type": "application/json" },
|
|
15787
|
+
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
15788
|
+
});
|
|
15789
|
+
const data = await res.json().catch(() => ({}));
|
|
15790
|
+
if (res.ok && data && data.ok === true) return data.data;
|
|
15791
|
+
if (res.status === 404 || res.status === 405) {
|
|
15792
|
+
throw new Error("\u5BBF\u4E3B\u4FA7\u6CA1\u6709\u300CGit \u7BA1\u7406\u300D\u63A5\u53E3\uFF1A\u5BBF\u4E3B\u8FDB\u7A0B\u53EF\u80FD\u662F\u65E7\u7248\u672C\uFF0C\u6216\u8BE5\u529F\u80FD\u5728\u5BBF\u4E3B\u4FA7\u672A\u542F\u7528\uFF08\u91CD\u542F dsh web\uFF0C\u6216\u628A\u529F\u80FD\u575E\u91CC\u7684\u5F00\u5173\u5173\u6389\u518D\u6253\u5F00\uFF09");
|
|
15793
|
+
}
|
|
15794
|
+
const message = data && data.error && data.error.message;
|
|
15795
|
+
throw new Error(message || "HTTP " + res.status);
|
|
15796
|
+
}
|
|
15797
|
+
function fmtAgo(iso) {
|
|
15798
|
+
if (!iso) return "";
|
|
15799
|
+
const t = new Date(iso).getTime();
|
|
15800
|
+
if (Number.isNaN(t)) return "";
|
|
15801
|
+
const diff = Math.max(0, Date.now() - t);
|
|
15802
|
+
const min = Math.floor(diff / 6e4);
|
|
15803
|
+
if (min < 1) return "\u521A\u521A";
|
|
15804
|
+
if (min < 60) return min + " \u5206\u949F\u524D";
|
|
15805
|
+
const hour = Math.floor(min / 60);
|
|
15806
|
+
if (hour < 24) return hour + " \u5C0F\u65F6\u524D";
|
|
15807
|
+
const day = Math.floor(hour / 24);
|
|
15808
|
+
if (day < 30) return day + " \u5929\u524D";
|
|
15809
|
+
const month = Math.floor(day / 30);
|
|
15810
|
+
if (month < 12) return month + " \u4E2A\u6708\u524D";
|
|
15811
|
+
return Math.floor(month / 12) + " \u5E74\u524D";
|
|
15812
|
+
}
|
|
15813
|
+
function fmtTime4(iso) {
|
|
15814
|
+
if (!iso) return "";
|
|
15815
|
+
const d = new Date(iso);
|
|
15816
|
+
if (Number.isNaN(d.getTime())) return String(iso);
|
|
15817
|
+
const p = (x) => String(x).padStart(2, "0");
|
|
15818
|
+
return d.getFullYear() + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate()) + " " + p(d.getHours()) + ":" + p(d.getMinutes());
|
|
15819
|
+
}
|
|
15820
|
+
function fmtDateTime(iso) {
|
|
15821
|
+
if (!iso) return "";
|
|
15822
|
+
const d = new Date(iso);
|
|
15823
|
+
if (Number.isNaN(d.getTime())) return String(iso);
|
|
15824
|
+
const p = (x) => String(x).padStart(2, "0");
|
|
15825
|
+
return d.getFullYear() + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate()) + " " + p(d.getHours()) + ":" + p(d.getMinutes()) + ":" + p(d.getSeconds());
|
|
15826
|
+
}
|
|
15827
|
+
function truncate4(str, max) {
|
|
15828
|
+
if (!str) return "";
|
|
15829
|
+
const s = String(str);
|
|
15830
|
+
return s.length > max ? s.slice(0, max) + "\u2026" : s;
|
|
15831
|
+
}
|
|
15832
|
+
function shortRefs(refs) {
|
|
15833
|
+
if (!Array.isArray(refs) || refs.length === 0) return [];
|
|
15834
|
+
const out = [];
|
|
15835
|
+
for (const raw of refs) {
|
|
15836
|
+
const ref = String(raw).trim();
|
|
15837
|
+
if (!ref) continue;
|
|
15838
|
+
if (ref.indexOf("HEAD -> ") === 0) {
|
|
15839
|
+
out.push("HEAD");
|
|
15840
|
+
continue;
|
|
15841
|
+
}
|
|
15842
|
+
out.push(ref.replace(/^tag:\s*/, ""));
|
|
15843
|
+
}
|
|
15844
|
+
return out.slice(0, 3);
|
|
15845
|
+
}
|
|
15846
|
+
function dirOfSessionState(state, sessionId) {
|
|
15847
|
+
if (!state || !sessionId) return "";
|
|
15848
|
+
const projected = state.projectionsBySession && state.projectionsBySession[sessionId] ? state.projectionsBySession[sessionId].values : void 0;
|
|
15849
|
+
if (projected && typeof projected.workingDirectory === "string" && projected.workingDirectory) {
|
|
15850
|
+
return projected.workingDirectory;
|
|
15851
|
+
}
|
|
15852
|
+
const row = state.byId ? state.byId[sessionId] : void 0;
|
|
15853
|
+
if (row) {
|
|
15854
|
+
const rowProjected = row.projectionValues;
|
|
15855
|
+
if (rowProjected && typeof rowProjected.workingDirectory === "string" && rowProjected.workingDirectory) {
|
|
15856
|
+
return rowProjected.workingDirectory;
|
|
15857
|
+
}
|
|
15858
|
+
if (typeof row.cwd === "string" && row.cwd) return row.cwd;
|
|
15859
|
+
}
|
|
15860
|
+
return "";
|
|
15861
|
+
}
|
|
15862
|
+
function currentSessionDir(ctx, sessionId) {
|
|
15863
|
+
if (!ctx || typeof ctx.get !== "function") return "";
|
|
15864
|
+
try {
|
|
15865
|
+
const sessions = ctx.get("sessions");
|
|
15866
|
+
if (!sessions || typeof sessions.list.getSnapshot !== "function") return "";
|
|
15867
|
+
const state = sessions.list.getSnapshot();
|
|
15868
|
+
if (sessionId) {
|
|
15869
|
+
const direct = dirOfSessionState(state, sessionId);
|
|
15870
|
+
if (direct) return direct;
|
|
15871
|
+
}
|
|
15872
|
+
let fallbackId = "";
|
|
15873
|
+
try {
|
|
15874
|
+
const uiSession = ctx.get("uiSession");
|
|
15875
|
+
const snap = uiSession && uiSession.adapter && uiSession.adapter.current ? uiSession.adapter.current.getSnapshot() : null;
|
|
15876
|
+
fallbackId = snap && snap.props ? snap.props.sessionId : "";
|
|
15877
|
+
} catch {
|
|
15878
|
+
fallbackId = "";
|
|
15879
|
+
}
|
|
15880
|
+
return dirOfSessionState(state, fallbackId);
|
|
15881
|
+
} catch {
|
|
15882
|
+
return "";
|
|
15883
|
+
}
|
|
15884
|
+
}
|
|
15885
|
+
async function pickDirectory(ctx) {
|
|
15886
|
+
if (!ctx || typeof ctx.get !== "function") return null;
|
|
15887
|
+
let uiw = null;
|
|
15888
|
+
try {
|
|
15889
|
+
uiw = ctx.get("uiWorkspace");
|
|
15890
|
+
} catch {
|
|
15891
|
+
return null;
|
|
15892
|
+
}
|
|
15893
|
+
if (!uiw || typeof uiw.pickDirectory !== "function") return null;
|
|
15894
|
+
try {
|
|
15895
|
+
return await uiw.pickDirectory();
|
|
15896
|
+
} catch {
|
|
15897
|
+
return null;
|
|
15898
|
+
}
|
|
15899
|
+
}
|
|
15900
|
+
|
|
15901
|
+
// features/git/view.jsx
|
|
15902
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
15903
|
+
function DiffHunk(props) {
|
|
15904
|
+
const h = props.hunk;
|
|
15905
|
+
let oldNo = h.oldStart;
|
|
15906
|
+
let newNo = h.newStart;
|
|
15907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-hunk", children: [
|
|
15908
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-hunk-head", children: h.header }),
|
|
15909
|
+
h.lines.map((line, i) => {
|
|
15910
|
+
const isAdd = line.kind === "+";
|
|
15911
|
+
const isDel = line.kind === "-";
|
|
15912
|
+
const oldLabel = isAdd ? "" : String(oldNo++);
|
|
15913
|
+
const newLabel = isDel ? "" : String(newNo++);
|
|
15914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-line" + (isAdd ? " add" : isDel ? " del" : ""), children: [
|
|
15915
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ln", children: oldLabel }),
|
|
15916
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ln", children: newLabel }),
|
|
15917
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-sign", children: isAdd ? "+" : isDel ? "\u2212" : " " }),
|
|
15918
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-code", children: line.text || " " })
|
|
15919
|
+
] }, i);
|
|
15920
|
+
})
|
|
15921
|
+
] });
|
|
15922
|
+
}
|
|
15923
|
+
function DiffFile(props) {
|
|
15924
|
+
const f = props.file;
|
|
15925
|
+
const [open, setOpen] = (0, import_react23.useState)(props.defaultOpen !== false);
|
|
15926
|
+
const statusLabel = f.status === "added" ? "\u65B0\u589E" : f.status === "deleted" ? "\u5220\u9664" : f.status === "renamed" ? "\u91CD\u547D\u540D" : "\u4FEE\u6539";
|
|
15927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-file" + (open ? " open" : ""), children: [
|
|
15928
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-file-head", onClick: () => setOpen((v) => !v), children: [
|
|
15929
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-caret", children: open ? "\u25BE" : "\u25B8" }),
|
|
15930
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-file-path", title: f.path, children: f.path }),
|
|
15931
|
+
f.oldPath && f.oldPath !== f.path ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-file-old", title: f.oldPath, children: [
|
|
15932
|
+
"\u2190 ",
|
|
15933
|
+
f.oldPath
|
|
15934
|
+
] }) : null,
|
|
15935
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-tag " + f.status, children: statusLabel }),
|
|
15936
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-add", children: [
|
|
15937
|
+
"+",
|
|
15938
|
+
f.additions
|
|
15939
|
+
] }),
|
|
15940
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-del", children: [
|
|
15941
|
+
"\u2212",
|
|
15942
|
+
f.deletions
|
|
15943
|
+
] })
|
|
15944
|
+
] }),
|
|
15945
|
+
open ? f.binary ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u4E0D\u663E\u793A\u9010\u884C\u5DEE\u5F02\u3002" }) : f.hunks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5DEE\u5F02\uFF08\u53EF\u80FD\u53EA\u662F\u6587\u4EF6\u6A21\u5F0F\u53D8\u5316\uFF09\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-diff", children: f.hunks.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DiffHunk, { hunk: h }, i)) }) : null
|
|
15946
|
+
] });
|
|
15947
|
+
}
|
|
15948
|
+
function buildTree(files) {
|
|
15949
|
+
const root = { name: "", path: "", dirs: /* @__PURE__ */ new Map(), files: [] };
|
|
15950
|
+
for (const f of files) {
|
|
15951
|
+
const parts = f.path.split("/");
|
|
15952
|
+
let node = root;
|
|
15953
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
15954
|
+
const name = parts[i];
|
|
15955
|
+
if (!node.dirs.has(name)) {
|
|
15956
|
+
node.dirs.set(name, { name, path: parts.slice(0, i + 1).join("/"), dirs: /* @__PURE__ */ new Map(), files: [] });
|
|
15957
|
+
}
|
|
15958
|
+
node = node.dirs.get(name);
|
|
15959
|
+
}
|
|
15960
|
+
node.files.push(f);
|
|
15961
|
+
}
|
|
15962
|
+
return root;
|
|
15963
|
+
}
|
|
15964
|
+
function FileTree(props) {
|
|
15965
|
+
const tree = (0, import_react23.useMemo)(() => buildTree(props.files || []), [props.files]);
|
|
15966
|
+
const [collapsed, setCollapsed] = (0, import_react23.useState)({});
|
|
15967
|
+
const toggle = (path) => setCollapsed((prev) => Object.assign({}, prev, { [path]: !prev[path] }));
|
|
15968
|
+
const render = (node, depth) => {
|
|
15969
|
+
const out = [];
|
|
15970
|
+
for (const dir of node.dirs.values()) {
|
|
15971
|
+
const key = "d:" + dir.path;
|
|
15972
|
+
const isCollapsed = !!collapsed[dir.path];
|
|
15973
|
+
out.push(
|
|
15974
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-tree-row dir", style: { paddingLeft: depth * 12 + 6 + "px" }, onClick: () => toggle(dir.path), children: [
|
|
15975
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-caret", children: isCollapsed ? "\u25B8" : "\u25BE" }),
|
|
15976
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-tree-name", children: dir.name })
|
|
15977
|
+
] }, key)
|
|
15978
|
+
);
|
|
15979
|
+
if (!isCollapsed) out.push(...render(dir, depth + 1));
|
|
15980
|
+
}
|
|
15981
|
+
for (const f of node.files) {
|
|
15982
|
+
const selected = props.selected === f.path;
|
|
15983
|
+
out.push(
|
|
15984
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-tree-row file" + (selected ? " on" : ""), style: { paddingLeft: depth * 12 + 18 + "px" }, onClick: () => props.onSelect(f.path), title: f.path, children: [
|
|
15985
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-tree-name", children: f.path.split("/").pop() }),
|
|
15986
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-add", children: [
|
|
15987
|
+
"+",
|
|
15988
|
+
f.additions
|
|
15989
|
+
] }),
|
|
15990
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-del", children: [
|
|
15991
|
+
"\u2212",
|
|
15992
|
+
f.deletions
|
|
15993
|
+
] })
|
|
15994
|
+
] }, "f:" + f.path)
|
|
15995
|
+
);
|
|
15996
|
+
}
|
|
15997
|
+
return out;
|
|
15998
|
+
};
|
|
15999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-tree", children: render(tree, 0) });
|
|
16000
|
+
}
|
|
16001
|
+
var COMMIT_COLUMNS = [
|
|
16002
|
+
{ id: "graph", title: "", width: "12px", fixed: true },
|
|
16003
|
+
{ id: "subject", title: "\u8BF4\u660E", width: "minmax(0,1fr)", fixed: true },
|
|
16004
|
+
{ id: "refs", title: "\u5F15\u7528", width: "64px" },
|
|
16005
|
+
{ id: "author", title: "\u4F5C\u8005", width: "78px" },
|
|
16006
|
+
{ id: "date", title: "\u65E5\u671F", width: "56px" },
|
|
16007
|
+
{ id: "datetime", title: "\u65E5\u671F\u65F6\u95F4", width: "132px" }
|
|
16008
|
+
];
|
|
16009
|
+
var DEFAULT_VISIBLE_COLUMNS = ["graph", "subject", "refs", "author", "date"];
|
|
16010
|
+
function columnsTemplate(visible) {
|
|
16011
|
+
const set = new Set(Array.isArray(visible) ? visible : []);
|
|
16012
|
+
const parts = COMMIT_COLUMNS.filter((c) => c.fixed || set.has(c.id)).map((c) => c.width);
|
|
16013
|
+
return parts.join(" ");
|
|
16014
|
+
}
|
|
16015
|
+
function toggleRepoSelection(prev, path, current) {
|
|
16016
|
+
const list = Array.isArray(prev) && prev.length > 0 ? prev : [current].filter(Boolean);
|
|
16017
|
+
if (list.includes(path)) {
|
|
16018
|
+
const next = list.filter((p) => p !== path);
|
|
16019
|
+
return next.length > 0 ? next : list;
|
|
16020
|
+
}
|
|
16021
|
+
return list.concat(path);
|
|
16022
|
+
}
|
|
16023
|
+
function CommitRow(props) {
|
|
16024
|
+
const c = props.commit;
|
|
16025
|
+
const refs = shortRefs(c.refs);
|
|
16026
|
+
const visible = Array.isArray(props.visibleCols) ? props.visibleCols : null;
|
|
16027
|
+
const show = (id) => visible ? visible.includes(id) : true;
|
|
16028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
16029
|
+
"div",
|
|
16030
|
+
{
|
|
16031
|
+
className: "dkg-tr" + (props.active ? " on" : ""),
|
|
16032
|
+
role: "row",
|
|
16033
|
+
tabIndex: -1,
|
|
16034
|
+
onClick: () => props.onSelect(c),
|
|
16035
|
+
onKeyDown: (ev) => {
|
|
16036
|
+
if (ev.key === "Enter" || ev.key === " ") {
|
|
16037
|
+
ev.preventDefault();
|
|
16038
|
+
props.onSelect(c);
|
|
16039
|
+
}
|
|
16040
|
+
},
|
|
16041
|
+
title: c.subject,
|
|
16042
|
+
children: [
|
|
16043
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-td graph", "aria-hidden": "true", children: [
|
|
16044
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-graph-line" }),
|
|
16045
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-graph-dot" })
|
|
16046
|
+
] }),
|
|
16047
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-td subject", children: [
|
|
16048
|
+
c.__repo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-repo-tag", title: c.__repo, children: c.__repo.split("/").filter(Boolean).pop() }) : null,
|
|
16049
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-commit-subject", children: c.subject }),
|
|
16050
|
+
refs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-commit-refs", children: refs.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ref" + (/^(origin|upstream)\//.test(r) ? " remote" : ""), children: r }, r)) }) : null
|
|
16051
|
+
] }),
|
|
16052
|
+
show("refs") ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-td refs", children: refs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-muted", children: "\u2014" }) : null }) : null,
|
|
16053
|
+
show("author") ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-td author", title: c.authorEmail, children: c.author }) : null,
|
|
16054
|
+
show("date") ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-td date", title: fmtTime4(c.authorDate), children: fmtAgo(c.authorDate) }) : null,
|
|
16055
|
+
show("datetime") ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-td datetime", title: fmtTime4(c.authorDate), children: fmtDateTime(c.authorDate) }) : null
|
|
16056
|
+
]
|
|
16057
|
+
}
|
|
16058
|
+
);
|
|
16059
|
+
}
|
|
16060
|
+
function HistoryPane(props) {
|
|
16061
|
+
const { repo, refs } = props;
|
|
16062
|
+
const repoOptions = Array.isArray(props.repos) ? props.repos : [];
|
|
16063
|
+
const pickedRepos = Array.isArray(props.selectedRepos) && props.selectedRepos.length > 0 ? props.selectedRepos : [repo];
|
|
16064
|
+
const repoKey = pickedRepos.join("\0");
|
|
16065
|
+
const [commits, setCommits] = (0, import_react23.useState)([]);
|
|
16066
|
+
const [loading, setLoading] = (0, import_react23.useState)(false);
|
|
16067
|
+
const [error, setError] = (0, import_react23.useState)("");
|
|
16068
|
+
const [search, setSearch] = (0, import_react23.useState)("");
|
|
16069
|
+
const [author, setAuthor] = (0, import_react23.useState)("");
|
|
16070
|
+
const [path, setPath] = (0, import_react23.useState)(props.initialPath || "");
|
|
16071
|
+
const [branch, setBranch] = (0, import_react23.useState)("");
|
|
16072
|
+
const [limit, setLimit] = (0, import_react23.useState)(100);
|
|
16073
|
+
const [since, setSince] = (0, import_react23.useState)("");
|
|
16074
|
+
const [until, setUntil] = (0, import_react23.useState)("");
|
|
16075
|
+
const [authors, setAuthors] = (0, import_react23.useState)([]);
|
|
16076
|
+
const [authorPick, setAuthorPick] = (0, import_react23.useState)("");
|
|
16077
|
+
const [groups, setGroups] = (0, import_react23.useState)([]);
|
|
16078
|
+
const [visibleCols, setVisibleCols] = (0, import_react23.useState)(DEFAULT_VISIBLE_COLUMNS);
|
|
16079
|
+
const [colMenu, setColMenu] = (0, import_react23.useState)(false);
|
|
16080
|
+
const showCol = (id) => visibleCols.includes(id);
|
|
16081
|
+
const toggleCol = (id) => {
|
|
16082
|
+
const col = COMMIT_COLUMNS.find((c) => c.id === id);
|
|
16083
|
+
if (!col || col.fixed) return;
|
|
16084
|
+
setVisibleCols((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : prev.concat(id));
|
|
16085
|
+
};
|
|
16086
|
+
const [selected, setSelected] = (0, import_react23.useState)(null);
|
|
16087
|
+
const [detail, setDetail] = (0, import_react23.useState)(null);
|
|
16088
|
+
const [detailLoading, setDetailLoading] = (0, import_react23.useState)(false);
|
|
16089
|
+
const [activeFile, setActiveFile] = (0, import_react23.useState)("");
|
|
16090
|
+
const load = (0, import_react23.useCallback)(async () => {
|
|
16091
|
+
if (!repo) return;
|
|
16092
|
+
setLoading(true);
|
|
16093
|
+
setError("");
|
|
16094
|
+
const repoList = repoKey.split("\0").filter(Boolean);
|
|
16095
|
+
if (repoList.length === 0) {
|
|
16096
|
+
setLoading(false);
|
|
16097
|
+
return;
|
|
16098
|
+
}
|
|
16099
|
+
const common = {
|
|
16100
|
+
limit,
|
|
16101
|
+
search: search.trim(),
|
|
16102
|
+
author: authorPick || author.trim(),
|
|
16103
|
+
path: path.trim(),
|
|
16104
|
+
branch: branch || void 0,
|
|
16105
|
+
since: since || void 0,
|
|
16106
|
+
until: until || void 0
|
|
16107
|
+
};
|
|
16108
|
+
try {
|
|
16109
|
+
const data = repoList.length === 1 ? await rpc2("commits", Object.assign({ repo: repoList[0] }, common)) : await rpc2("commits", Object.assign({ repos: repoList }, common));
|
|
16110
|
+
const results = data && data.results || [];
|
|
16111
|
+
const ok = results.filter((r) => r && r.ok !== false);
|
|
16112
|
+
const failed = results.filter((r) => r && r.ok === false);
|
|
16113
|
+
setGroups(ok.map((r) => ({ repo: r.repo, commits: r.commits || [] })));
|
|
16114
|
+
const flat = [];
|
|
16115
|
+
for (const r of ok) {
|
|
16116
|
+
for (const c of r.commits || []) flat.push(Object.assign({ __repo: r.repo }, c));
|
|
16117
|
+
}
|
|
16118
|
+
if (repoList.length > 1) {
|
|
16119
|
+
flat.sort((a, b) => String(b.authorDate).localeCompare(String(a.authorDate)));
|
|
16120
|
+
}
|
|
16121
|
+
setCommits(flat);
|
|
16122
|
+
if (failed.length > 0) setError(failed.map((r) => r.repo + "\uFF1A" + (r.error || "\u8BFB\u53D6\u5931\u8D25")).join("\uFF1B"));
|
|
16123
|
+
if (flat.length > 0) selectCommit(flat[0]);
|
|
16124
|
+
else {
|
|
16125
|
+
setSelected(null);
|
|
16126
|
+
setDetail(null);
|
|
16127
|
+
}
|
|
16128
|
+
} catch (e) {
|
|
16129
|
+
setCommits([]);
|
|
16130
|
+
setGroups([]);
|
|
16131
|
+
setError(e && e.message || String(e));
|
|
16132
|
+
} finally {
|
|
16133
|
+
setLoading(false);
|
|
16134
|
+
}
|
|
16135
|
+
}, [repo, repoKey, limit, search, author, authorPick, path, branch, since, until]);
|
|
16136
|
+
const selectCommit = async (c) => {
|
|
16137
|
+
setSelected(c);
|
|
16138
|
+
setDetailLoading(true);
|
|
16139
|
+
setActiveFile("");
|
|
16140
|
+
try {
|
|
16141
|
+
const owner = c.__repo || repo;
|
|
16142
|
+
const data = await rpc2("commit", { repo: owner, sha: c.sha });
|
|
16143
|
+
setDetail(data && data.commit);
|
|
16144
|
+
} catch (e) {
|
|
16145
|
+
setDetail({ error: e && e.message || String(e) });
|
|
16146
|
+
} finally {
|
|
16147
|
+
setDetailLoading(false);
|
|
16148
|
+
}
|
|
16149
|
+
};
|
|
16150
|
+
(0, import_react23.useEffect)(() => {
|
|
16151
|
+
if (!repo) return;
|
|
16152
|
+
const timer = setTimeout(() => {
|
|
16153
|
+
load();
|
|
16154
|
+
}, 200);
|
|
16155
|
+
return () => clearTimeout(timer);
|
|
16156
|
+
}, [load]);
|
|
16157
|
+
(0, import_react23.useEffect)(() => {
|
|
16158
|
+
if (!repo) return;
|
|
16159
|
+
let stopped = false;
|
|
16160
|
+
rpc2("authors", { repo }).then((data) => {
|
|
16161
|
+
if (!stopped) setAuthors(data && data.authors || []);
|
|
16162
|
+
}).catch(() => {
|
|
16163
|
+
if (!stopped) setAuthors([]);
|
|
16164
|
+
});
|
|
16165
|
+
return () => {
|
|
16166
|
+
stopped = true;
|
|
16167
|
+
};
|
|
16168
|
+
}, [repo]);
|
|
16169
|
+
const onListKeyDown = (ev) => {
|
|
16170
|
+
if (commits.length === 0) return;
|
|
16171
|
+
const index = selected ? commits.findIndex((c) => c.sha === selected.sha) : -1;
|
|
16172
|
+
if (ev.key === "ArrowDown") {
|
|
16173
|
+
ev.preventDefault();
|
|
16174
|
+
const next = commits[Math.min(commits.length - 1, index + 1)];
|
|
16175
|
+
if (next) selectCommit(next);
|
|
16176
|
+
} else if (ev.key === "ArrowUp") {
|
|
16177
|
+
ev.preventDefault();
|
|
16178
|
+
const prev = commits[Math.max(0, index - 1)];
|
|
16179
|
+
if (prev) selectCommit(prev);
|
|
16180
|
+
} else if (ev.key === "Home") {
|
|
16181
|
+
ev.preventDefault();
|
|
16182
|
+
selectCommit(commits[0]);
|
|
16183
|
+
} else if (ev.key === "End") {
|
|
16184
|
+
ev.preventDefault();
|
|
16185
|
+
selectCommit(commits[commits.length - 1]);
|
|
16186
|
+
}
|
|
16187
|
+
};
|
|
16188
|
+
const localBranches = refs && refs.local || [];
|
|
16189
|
+
const remoteBranches = refs && refs.remote || [];
|
|
16190
|
+
const tags = refs && refs.tags || [];
|
|
16191
|
+
const diffFiles = detail && detail.diff && detail.diff.files || [];
|
|
16192
|
+
const shownFiles = activeFile ? diffFiles.filter((f) => f.path === activeFile) : diffFiles;
|
|
16193
|
+
const [mainPct, setMainPct] = (0, import_react23.useState)(50);
|
|
16194
|
+
const [detailPct, setDetailPct] = (0, import_react23.useState)(50);
|
|
16195
|
+
const bodyRef = (0, import_react23.useRef)(null);
|
|
16196
|
+
const detailRef = (0, import_react23.useRef)(null);
|
|
16197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-body", ref: bodyRef, style: { "--dkg-main-pct": mainPct + "%", "--dkg-detail-pct": detailPct + "%", "--dkg-cols": columnsTemplate(visibleCols) }, children: [
|
|
16198
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-side", children: [
|
|
16199
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-side-item" + (branch === "" ? " on" : ""), onClick: () => setBranch(""), children: [
|
|
16200
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-side-icon", children: "\u25C8" }),
|
|
16201
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", children: "HEAD\uFF08\u5F53\u524D\u5206\u652F\uFF09" })
|
|
16202
|
+
] }),
|
|
16203
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-side-group", children: [
|
|
16204
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-side-title", children: "\u672C\u5730" }),
|
|
16205
|
+
localBranches.map((b) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-side-item" + (branch === b.name ? " on" : ""), onClick: () => setBranch(b.name), title: b.subject, children: [
|
|
16206
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-side-icon", children: "\u2387" }),
|
|
16207
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", children: b.name })
|
|
16208
|
+
] }, b.full))
|
|
16209
|
+
] }),
|
|
16210
|
+
remoteBranches.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-side-group", children: [
|
|
16211
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-side-title", children: "\u8FDC\u7AEF" }),
|
|
16212
|
+
remoteBranches.map((b) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-side-item" + (branch === b.name ? " on" : ""), onClick: () => setBranch(b.name), title: b.subject, children: [
|
|
16213
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-side-icon remote", children: "\u2601" }),
|
|
16214
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", children: b.name })
|
|
16215
|
+
] }, b.full))
|
|
16216
|
+
] }) : null,
|
|
16217
|
+
tags.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-side-group", children: [
|
|
16218
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-side-title", children: "\u6807\u7B7E" }),
|
|
16219
|
+
tags.slice().reverse().map((t) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-side-item" + (branch === t.name ? " on" : ""), onClick: () => setBranch(t.name), title: t.subject, children: [
|
|
16220
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-side-icon tag", children: "\u25C6" }),
|
|
16221
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", children: t.name })
|
|
16222
|
+
] }, t.full))
|
|
16223
|
+
] }) : null
|
|
16224
|
+
] }),
|
|
16225
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-mid", children: [
|
|
16226
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-toolbar", children: [
|
|
16227
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "dkg-input", value: search, placeholder: "\u641C\u7D22\u5173\u952E\u8BCD\uFF08\u8BF4\u660E / \u54C8\u5E0C\uFF09", onChange: (e) => setSearch(e.target.value) }),
|
|
16228
|
+
authors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { className: "dkg-select", value: authorPick, onChange: (e) => setAuthorPick(e.target.value), title: "\u6309\u63D0\u4EA4\u4EBA\u7B5B\u9009", children: [
|
|
16229
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "\u5168\u90E8\u63D0\u4EA4\u4EBA" }),
|
|
16230
|
+
authors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.name, children: [
|
|
16231
|
+
a.name,
|
|
16232
|
+
"\uFF08",
|
|
16233
|
+
a.count,
|
|
16234
|
+
"\uFF09"
|
|
16235
|
+
] }, a.name))
|
|
16236
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "dkg-input sm", value: author, placeholder: "\u63D0\u4EA4\u4EBA", onChange: (e) => setAuthor(e.target.value) }),
|
|
16237
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "dkg-input sm", value: path, placeholder: "\u8DEF\u5F84", onChange: (e) => setPath(e.target.value) }),
|
|
16238
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "dkg-input sm", type: "date", value: since, onChange: (e) => setSince(e.target.value), title: "\u8D77\u59CB\u65E5\u671F\uFF08\u542B\uFF09" }),
|
|
16239
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-hint", children: "\u2192" }),
|
|
16240
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "dkg-input sm", type: "date", value: until, onChange: (e) => setUntil(e.target.value), title: "\u7ED3\u675F\u65E5\u671F\uFF08\u542B\uFF09" }),
|
|
16241
|
+
repoOptions.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16242
|
+
RepoPicker,
|
|
16243
|
+
{
|
|
16244
|
+
repos: repoOptions,
|
|
16245
|
+
selected: pickedRepos,
|
|
16246
|
+
current: repo,
|
|
16247
|
+
onToggle: props.onToggleRepo,
|
|
16248
|
+
onOnlyCurrent: props.onOnlyCurrent,
|
|
16249
|
+
onSelectAll: props.onSelectAll
|
|
16250
|
+
}
|
|
16251
|
+
) : null,
|
|
16252
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { className: "dkg-select", value: limit, onChange: (e) => setLimit(Number(e.target.value)), children: [
|
|
16253
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: 50, children: "50" }),
|
|
16254
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: 100, children: "100" }),
|
|
16255
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: 200, children: "200" }),
|
|
16256
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: 500, children: "500" })
|
|
16257
|
+
] }),
|
|
16258
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-colpick", children: [
|
|
16259
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16260
|
+
"button",
|
|
16261
|
+
{
|
|
16262
|
+
type: "button",
|
|
16263
|
+
className: "dkg-icon-btn",
|
|
16264
|
+
onClick: () => setColMenu(!colMenu),
|
|
16265
|
+
title: "\u9009\u62E9\u8981\u663E\u793A\u7684\u5217",
|
|
16266
|
+
children: "\u25A4"
|
|
16267
|
+
}
|
|
16268
|
+
),
|
|
16269
|
+
colMenu ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-colpick-menu", role: "listbox", "aria-multiselectable": "true", children: COMMIT_COLUMNS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
16270
|
+
"button",
|
|
16271
|
+
{
|
|
16272
|
+
type: "button",
|
|
16273
|
+
role: "option",
|
|
16274
|
+
"aria-selected": c.fixed || showCol(c.id),
|
|
16275
|
+
disabled: !!c.fixed,
|
|
16276
|
+
className: "dkg-colpick-row" + (c.fixed || showCol(c.id) ? " on" : "") + (c.fixed ? " locked" : ""),
|
|
16277
|
+
title: c.fixed ? "\u8BE5\u5217\u4E0D\u53EF\u9690\u85CF" : "\u70B9\u51FB\u5207\u6362\u663E\u793A",
|
|
16278
|
+
onClick: () => toggleCol(c.id),
|
|
16279
|
+
children: [
|
|
16280
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-chip-check", "aria-hidden": "true", children: c.fixed || showCol(c.id) ? "\u2611" : "\u2610" }),
|
|
16281
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: c.title || "\uFF08\u5206\u652F\u56FE\uFF09" })
|
|
16282
|
+
]
|
|
16283
|
+
},
|
|
16284
|
+
c.id
|
|
16285
|
+
)) }) : null
|
|
16286
|
+
] }),
|
|
16287
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-icon-btn", onClick: load, disabled: loading, title: "\u5237\u65B0", children: loading ? "\u2026" : "\u27F3" })
|
|
16288
|
+
] }),
|
|
16289
|
+
branch ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-filter-tag", children: [
|
|
16290
|
+
"\u5206\u652F\uFF1A",
|
|
16291
|
+
branch,
|
|
16292
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", onClick: () => setBranch(""), children: "\u6E05\u9664" })
|
|
16293
|
+
] }) : null,
|
|
16294
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: error }) : null,
|
|
16295
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-thead", children: COMMIT_COLUMNS.filter((c) => c.fixed || showCol(c.id)).map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-th " + c.id, children: c.title }, c.id)) }),
|
|
16296
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-commits", tabIndex: 0, onKeyDown: onListKeyDown, role: "grid", "aria-label": "\u63D0\u4EA4\u5217\u8868", children: [
|
|
16297
|
+
commits.length === 0 && !loading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4\u3002" }) : null,
|
|
16298
|
+
commits.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommitRow, { commit: c, index: i, visibleCols, active: selected && selected.sha === c.sha, onSelect: selectCommit }, c.sha))
|
|
16299
|
+
] })
|
|
16300
|
+
] }),
|
|
16301
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-splitter-slot dkg-splitter-main", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragSplitter, { value: mainPct, onChange: setMainPct, min: 20, max: 85, containerRef: bodyRef }) }),
|
|
16302
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail", ref: detailRef, children: [
|
|
16303
|
+
!selected ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u9009\u62E9\u5DE6\u4FA7\u4E00\u6761\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5\u3002" }) : null,
|
|
16304
|
+
selected && detailLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8BFB\u53D6\u4E2D\u2026" }) : null,
|
|
16305
|
+
detail && detail.error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: detail.error }) : null,
|
|
16306
|
+
detail && !detail.error && !detailLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
16307
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-detail-diff", children: diffFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-split", children: [
|
|
16308
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileTree, { files: diffFiles, selected: activeFile, onSelect: (p) => setActiveFile(activeFile === p ? "" : p) }),
|
|
16309
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diffs", children: [
|
|
16310
|
+
activeFile ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", onClick: () => setActiveFile(""), children: "\u663E\u793A\u5168\u90E8\u6587\u4EF6" }) : null,
|
|
16311
|
+
shownFiles.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DiffFile, { file: f, defaultOpen: !!activeFile || diffFiles.length <= 3 }, f.path)),
|
|
16312
|
+
detail.diff && detail.diff.truncated ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u5DEE\u5F02\u8FC7\u5927\uFF0C\u5DF2\u622A\u65AD\u663E\u793A\u3002" }) : null
|
|
16313
|
+
] })
|
|
16314
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8FD9\u6761\u63D0\u4EA4\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5DEE\u5F02\u3002" }) }),
|
|
16315
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-splitter-slot", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragSplitter, { value: detailPct, onChange: setDetailPct, min: 15, max: 85, containerRef: detailRef }) }),
|
|
16316
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-msgbox", children: [
|
|
16317
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-detail-subject", children: detail.subject }),
|
|
16318
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-meta", children: [
|
|
16319
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-sha", children: detail.sha }),
|
|
16320
|
+
detail.parents && detail.parents.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-tag", children: "\u5408\u5E76\u63D0\u4EA4" }) : null,
|
|
16321
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
|
|
16322
|
+
detail.author,
|
|
16323
|
+
" <",
|
|
16324
|
+
detail.authorEmail,
|
|
16325
|
+
">"
|
|
16326
|
+
] }),
|
|
16327
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: fmtTime4(detail.authorDate) }),
|
|
16328
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-add", children: [
|
|
16329
|
+
"+",
|
|
16330
|
+
detail.additions
|
|
16331
|
+
] }),
|
|
16332
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-del", children: [
|
|
16333
|
+
"\u2212",
|
|
16334
|
+
detail.deletions
|
|
16335
|
+
] })
|
|
16336
|
+
] }),
|
|
16337
|
+
detail.body ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { className: "dkg-detail-msg", children: detail.body }) : null
|
|
16338
|
+
] })
|
|
16339
|
+
] }) : null
|
|
16340
|
+
] })
|
|
16341
|
+
] });
|
|
16342
|
+
}
|
|
16343
|
+
function WorktreePane(props) {
|
|
16344
|
+
const { repo, status, onRefresh } = props;
|
|
16345
|
+
const [checked, setChecked] = (0, import_react23.useState)({});
|
|
16346
|
+
const [message, setMessage] = (0, import_react23.useState)("");
|
|
16347
|
+
const [busy, setBusy] = (0, import_react23.useState)("");
|
|
16348
|
+
const [error, setError] = (0, import_react23.useState)("");
|
|
16349
|
+
const [preview, setPreview] = (0, import_react23.useState)(null);
|
|
16350
|
+
const [previewLoading, setPreviewLoading] = (0, import_react23.useState)(false);
|
|
16351
|
+
const [result, setResult] = (0, import_react23.useState)(null);
|
|
16352
|
+
const [activeFile, setActiveFile] = (0, import_react23.useState)("");
|
|
16353
|
+
const entries = status && status.entries || [];
|
|
16354
|
+
const staged = entries.filter((e) => e.staged);
|
|
16355
|
+
const unstaged = entries.filter((e) => !e.staged && !e.untracked);
|
|
16356
|
+
const untracked = entries.filter((e) => e.untracked);
|
|
16357
|
+
const toggle = (path) => setChecked((prev) => Object.assign({}, prev, { [path]: !prev[path] }));
|
|
16358
|
+
const toggleAll = (list) => {
|
|
16359
|
+
const allOn = list.length > 0 && list.every((e) => checked[e.path]);
|
|
16360
|
+
const next = Object.assign({}, checked);
|
|
16361
|
+
for (const e of list) next[e.path] = !allOn;
|
|
16362
|
+
setChecked(next);
|
|
16363
|
+
};
|
|
16364
|
+
const doStage = async (paths, unstage) => {
|
|
16365
|
+
if (paths.length === 0) return;
|
|
16366
|
+
setBusy(unstage ? "\u53D6\u6D88\u6682\u5B58\u2026" : "\u6682\u5B58\u4E2D\u2026");
|
|
16367
|
+
setError("");
|
|
16368
|
+
try {
|
|
16369
|
+
await rpc2("stage", { repo, paths, unstage: unstage === true, confirm: true });
|
|
16370
|
+
setChecked({});
|
|
16371
|
+
await onRefresh();
|
|
16372
|
+
} catch (e) {
|
|
16373
|
+
setError(e && e.message || String(e));
|
|
16374
|
+
} finally {
|
|
16375
|
+
setBusy("");
|
|
16376
|
+
}
|
|
16377
|
+
};
|
|
16378
|
+
const loadPreview = async () => {
|
|
16379
|
+
setPreviewLoading(true);
|
|
16380
|
+
setError("");
|
|
16381
|
+
setActiveFile("");
|
|
16382
|
+
try {
|
|
16383
|
+
const data = await rpc2("diff", { repo, staged: true });
|
|
16384
|
+
setPreview(data);
|
|
16385
|
+
} catch (e) {
|
|
16386
|
+
setError(e && e.message || String(e));
|
|
16387
|
+
setPreview(null);
|
|
16388
|
+
} finally {
|
|
16389
|
+
setPreviewLoading(false);
|
|
16390
|
+
}
|
|
16391
|
+
};
|
|
16392
|
+
const doCommit = async () => {
|
|
16393
|
+
if (!message.trim()) {
|
|
16394
|
+
setError("\u8BF7\u5148\u586B\u5199\u63D0\u4EA4\u8BF4\u660E");
|
|
16395
|
+
return;
|
|
16396
|
+
}
|
|
16397
|
+
if (staged.length === 0) {
|
|
16398
|
+
setError("\u6682\u5B58\u533A\u4E3A\u7A7A\uFF0C\u5148\u52FE\u9009\u8981\u63D0\u4EA4\u7684\u6587\u4EF6");
|
|
16399
|
+
return;
|
|
16400
|
+
}
|
|
16401
|
+
setBusy("\u63D0\u4EA4\u4E2D\u2026");
|
|
16402
|
+
setError("");
|
|
16403
|
+
try {
|
|
16404
|
+
const data = await rpc2("create-commit", { repo, message: message.trim(), confirm: true });
|
|
16405
|
+
setResult(data && data.commit);
|
|
16406
|
+
setMessage("");
|
|
16407
|
+
setPreview(null);
|
|
16408
|
+
setChecked({});
|
|
16409
|
+
await onRefresh();
|
|
16410
|
+
} catch (e) {
|
|
16411
|
+
setError(e && e.message || String(e));
|
|
16412
|
+
} finally {
|
|
16413
|
+
setBusy("");
|
|
16414
|
+
}
|
|
16415
|
+
};
|
|
16416
|
+
const doPush = async () => {
|
|
16417
|
+
setBusy("\u63A8\u9001\u4E2D\u2026");
|
|
16418
|
+
setError("");
|
|
16419
|
+
try {
|
|
16420
|
+
const data = await rpc2("push", { repo, confirm: true });
|
|
16421
|
+
setResult({ pushed: true, output: data && data.output });
|
|
16422
|
+
await onRefresh();
|
|
16423
|
+
} catch (e) {
|
|
16424
|
+
setError(e && e.message || String(e));
|
|
16425
|
+
} finally {
|
|
16426
|
+
setBusy("");
|
|
16427
|
+
}
|
|
16428
|
+
};
|
|
16429
|
+
const previewFiles = preview && preview.files || [];
|
|
16430
|
+
const shownPreview = activeFile ? previewFiles.filter((f) => f.path === activeFile) : previewFiles;
|
|
16431
|
+
const group = (title, list, stagedGroup) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-group", children: [
|
|
16432
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-head", children: [
|
|
16433
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-check", children: [
|
|
16434
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: list.length > 0 && list.every((e) => checked[e.path]), onChange: () => toggleAll(list) }),
|
|
16435
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: title }),
|
|
16436
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-hint", children: list.length })
|
|
16437
|
+
] }),
|
|
16438
|
+
list.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: () => {
|
|
16439
|
+
const paths = list.filter((e) => checked[e.path]).map((e) => e.path);
|
|
16440
|
+
doStage(paths.length > 0 ? paths : list.map((e) => e.path), stagedGroup);
|
|
16441
|
+
}, children: stagedGroup ? "\u5168\u90E8\u53D6\u6D88\u6682\u5B58" : "\u5168\u90E8\u6682\u5B58" }) : null
|
|
16442
|
+
] }),
|
|
16443
|
+
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note dkg-wt-empty", children: "\u65E0" }) : list.map((e) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-wt-item" + (checked[e.path] ? " on" : ""), children: [
|
|
16444
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: !!checked[e.path], onChange: () => toggle(e.path) }),
|
|
16445
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-wt-code", children: [
|
|
16446
|
+
e.index,
|
|
16447
|
+
e.worktree
|
|
16448
|
+
] }),
|
|
16449
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", title: e.origPath ? e.origPath + " \u2192 " + e.path : e.path, children: e.path }),
|
|
16450
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-wt-actions", children: stagedGroup ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: (ev) => {
|
|
16451
|
+
ev.preventDefault();
|
|
16452
|
+
doStage([e.path], true);
|
|
16453
|
+
}, children: "\u53D6\u6D88\u6682\u5B58" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: (ev) => {
|
|
16454
|
+
ev.preventDefault();
|
|
16455
|
+
doStage([e.path], false);
|
|
16456
|
+
}, children: "\u6682\u5B58" }) })
|
|
16457
|
+
] }, e.path))
|
|
16458
|
+
] });
|
|
16459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt", children: [
|
|
16460
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-files", children: [
|
|
16461
|
+
group("\u5DF2\u6682\u5B58", staged, true),
|
|
16462
|
+
group("\u672A\u6682\u5B58", unstaged, false),
|
|
16463
|
+
group("\u672A\u8DDF\u8E2A", untracked, false),
|
|
16464
|
+
entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u5DE5\u4F5C\u533A\u5E72\u51C0\uFF0C\u6CA1\u6709\u53EF\u63D0\u4EA4\u7684\u6539\u52A8\u3002" }) : null
|
|
16465
|
+
] }),
|
|
16466
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-commit", children: [
|
|
16467
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16468
|
+
"textarea",
|
|
16469
|
+
{
|
|
16470
|
+
className: "dkg-textarea",
|
|
16471
|
+
rows: 4,
|
|
16472
|
+
value: message,
|
|
16473
|
+
placeholder: "\u63D0\u4EA4\u8BF4\u660E\uFF08\u7B2C\u4E00\u884C\u662F\u6807\u9898\uFF0C\u7A7A\u4E00\u884C\u540E\u53EF\u5199\u6B63\u6587\uFF09",
|
|
16474
|
+
onChange: (e) => setMessage(e.target.value)
|
|
16475
|
+
}
|
|
16476
|
+
),
|
|
16477
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-actions", children: [
|
|
16478
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: loadPreview, disabled: !!busy || staged.length === 0, children: previewLoading ? "\u8BFB\u53D6\u4E2D\u2026" : "\u9884\u89C8\u53D8\u66F4" }),
|
|
16479
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn primary", onClick: doCommit, disabled: !!busy || staged.length === 0 || !message.trim(), children: "\u63D0\u4EA4" }),
|
|
16480
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: doPush, disabled: !!busy || status && status.ahead === 0, title: status && status.ahead === 0 ? "\u6CA1\u6709\u5F85\u63A8\u9001\u7684\u63D0\u4EA4" : "\u63A8\u9001\u5230\u8FDC\u7AEF", children: status && status.ahead > 0 ? "\u63A8\u9001 " + status.ahead + " \u4E2A\u63D0\u4EA4" : "\u63A8\u9001" })
|
|
16481
|
+
] }),
|
|
16482
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-hint", children: busy }) : null,
|
|
16483
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: error }) : null,
|
|
16484
|
+
result && result.pushed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ok", children: [
|
|
16485
|
+
"\u63A8\u9001\u5B8C\u6210",
|
|
16486
|
+
result.output ? "\uFF1A" + truncate4(result.output, 200) : ""
|
|
16487
|
+
] }) : null,
|
|
16488
|
+
result && result.subject ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ok", children: [
|
|
16489
|
+
"\u5DF2\u63D0\u4EA4 ",
|
|
16490
|
+
result.shortSha,
|
|
16491
|
+
"\uFF1A",
|
|
16492
|
+
truncate4(result.subject, 80)
|
|
16493
|
+
] }) : null,
|
|
16494
|
+
preview ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-preview", children: [
|
|
16495
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-preview-head", children: [
|
|
16496
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
|
|
16497
|
+
"\u63D0\u4EA4\u9884\u89C8\uFF1A",
|
|
16498
|
+
previewFiles.length,
|
|
16499
|
+
" \u4E2A\u6587\u4EF6"
|
|
16500
|
+
] }),
|
|
16501
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", onClick: () => {
|
|
16502
|
+
setPreview(null);
|
|
16503
|
+
setActiveFile("");
|
|
16504
|
+
}, children: "\u6536\u8D77" })
|
|
16505
|
+
] }),
|
|
16506
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-split", children: [
|
|
16507
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileTree, { files: previewFiles, selected: activeFile, onSelect: (p) => setActiveFile(activeFile === p ? "" : p) }),
|
|
16508
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-diffs", children: shownPreview.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DiffFile, { file: f, defaultOpen: !!activeFile || previewFiles.length <= 3 }, f.path)) })
|
|
16509
|
+
] })
|
|
16510
|
+
] }) : null
|
|
16511
|
+
] })
|
|
16512
|
+
] });
|
|
16513
|
+
}
|
|
16514
|
+
function clampPercent(value, min, max) {
|
|
16515
|
+
const lo = typeof min === "number" ? min : 15;
|
|
16516
|
+
const hi = typeof max === "number" ? max : 85;
|
|
16517
|
+
const n = Number(value);
|
|
16518
|
+
if (!Number.isFinite(n)) return lo;
|
|
16519
|
+
return Math.min(hi, Math.max(lo, Math.round(n)));
|
|
16520
|
+
}
|
|
16521
|
+
function splitterStep(key, value, min, max) {
|
|
16522
|
+
const lo = typeof min === "number" ? min : 15;
|
|
16523
|
+
const hi = typeof max === "number" ? max : 85;
|
|
16524
|
+
if (key === "ArrowUp") return clampPercent(value + 2, lo, hi);
|
|
16525
|
+
if (key === "ArrowDown") return clampPercent(value - 2, lo, hi);
|
|
16526
|
+
if (key === "Home") return lo;
|
|
16527
|
+
if (key === "End") return hi;
|
|
16528
|
+
return null;
|
|
16529
|
+
}
|
|
16530
|
+
function dragToPercent(startValue, deltaY, containerHeight, min, max) {
|
|
16531
|
+
const lo = typeof min === "number" ? min : 15;
|
|
16532
|
+
const hi = typeof max === "number" ? max : 85;
|
|
16533
|
+
if (!(containerHeight > 0)) return clampPercent(startValue, lo, hi);
|
|
16534
|
+
const deltaPct = deltaY / containerHeight * 100;
|
|
16535
|
+
return clampPercent(startValue - deltaPct, lo, hi);
|
|
16536
|
+
}
|
|
16537
|
+
function RepoPicker(props) {
|
|
16538
|
+
const { repos, selected, current, onToggle, onOnlyCurrent, onSelectAll } = props;
|
|
16539
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
16540
|
+
const rootRef = (0, import_react23.useRef)(null);
|
|
16541
|
+
(0, import_react23.useEffect)(() => {
|
|
16542
|
+
if (!open) return;
|
|
16543
|
+
const onDown = (ev) => {
|
|
16544
|
+
const root = rootRef.current;
|
|
16545
|
+
if (root && ev.target && !root.contains(ev.target)) setOpen(false);
|
|
16546
|
+
};
|
|
16547
|
+
const onKey = (ev) => {
|
|
16548
|
+
if (ev.key === "Escape") setOpen(false);
|
|
16549
|
+
};
|
|
16550
|
+
document.addEventListener("mousedown", onDown);
|
|
16551
|
+
document.addEventListener("keydown", onKey);
|
|
16552
|
+
return () => {
|
|
16553
|
+
document.removeEventListener("mousedown", onDown);
|
|
16554
|
+
document.removeEventListener("keydown", onKey);
|
|
16555
|
+
};
|
|
16556
|
+
}, [open]);
|
|
16557
|
+
const picked = selected.length > 0 ? selected : [current];
|
|
16558
|
+
const onlyCurrent = picked.length === 1 && picked[0] === current;
|
|
16559
|
+
const label = onlyCurrent ? "\u5F53\u524D\u4ED3\u5E93" : picked.length + " \u4E2A\u4ED3\u5E93";
|
|
16560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-repopick", ref: rootRef, children: [
|
|
16561
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
16562
|
+
"button",
|
|
16563
|
+
{
|
|
16564
|
+
type: "button",
|
|
16565
|
+
className: "dkg-repopick-btn" + (picked.length > 1 ? " on" : ""),
|
|
16566
|
+
onClick: () => setOpen(!open),
|
|
16567
|
+
title: picked.join("\n"),
|
|
16568
|
+
children: [
|
|
16569
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
|
|
16570
|
+
"\u4ED3\u5E93\uFF1A",
|
|
16571
|
+
label
|
|
16572
|
+
] }),
|
|
16573
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-caret", "aria-hidden": "true", children: open ? "\u25B4" : "\u25BE" })
|
|
16574
|
+
]
|
|
16575
|
+
}
|
|
16576
|
+
),
|
|
16577
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-repopick-menu", role: "listbox", "aria-multiselectable": "true", children: [
|
|
16578
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-repopick-all", children: [
|
|
16579
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16580
|
+
"button",
|
|
16581
|
+
{
|
|
16582
|
+
type: "button",
|
|
16583
|
+
className: "dkg-repopick-allbtn",
|
|
16584
|
+
onClick: () => onSelectAll(repos.map((r) => r.path)),
|
|
16585
|
+
title: "\u52FE\u9009\u5168\u90E8\u4ED3\u5E93",
|
|
16586
|
+
children: "\u2611 \u5168\u9009"
|
|
16587
|
+
}
|
|
16588
|
+
),
|
|
16589
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16590
|
+
"button",
|
|
16591
|
+
{
|
|
16592
|
+
type: "button",
|
|
16593
|
+
className: "dkg-repopick-allbtn",
|
|
16594
|
+
onClick: () => onSelectAll([current]),
|
|
16595
|
+
title: "\u53EA\u4FDD\u7559\u5F53\u524D\u4ED3\u5E93",
|
|
16596
|
+
children: "\u2610 \u53D6\u6D88\u5168\u9009"
|
|
16597
|
+
}
|
|
16598
|
+
)
|
|
16599
|
+
] }),
|
|
16600
|
+
repos.map((r) => {
|
|
16601
|
+
const checked = picked.includes(r.path);
|
|
16602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
16603
|
+
"button",
|
|
16604
|
+
{
|
|
16605
|
+
type: "button",
|
|
16606
|
+
role: "option",
|
|
16607
|
+
"aria-selected": checked,
|
|
16608
|
+
className: "dkg-repopick-row" + (checked ? " on" : ""),
|
|
16609
|
+
title: r.path,
|
|
16610
|
+
onClick: () => onToggle(r.path),
|
|
16611
|
+
children: [
|
|
16612
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-chip-check", "aria-hidden": "true", children: checked ? "\u2611" : "\u2610" }),
|
|
16613
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", children: r.isRoot ? r.name + "\uFF08\u5F53\u524D\u76EE\u5F55\uFF09" : r.relPath }),
|
|
16614
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-hint", children: [
|
|
16615
|
+
r.branch,
|
|
16616
|
+
r.dirty > 0 ? " \xB7 " + r.dirty : ""
|
|
16617
|
+
] })
|
|
16618
|
+
]
|
|
16619
|
+
},
|
|
16620
|
+
r.path
|
|
16621
|
+
);
|
|
16622
|
+
}),
|
|
16623
|
+
picked.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-repopick-foot", onClick: onOnlyCurrent, children: "\u53EA\u770B\u5F53\u524D\u4ED3\u5E93" }) : null
|
|
16624
|
+
] }) : null
|
|
16625
|
+
] });
|
|
16626
|
+
}
|
|
16627
|
+
function DragSplitter(props) {
|
|
16628
|
+
const { value, onChange } = props;
|
|
16629
|
+
const min = typeof props.min === "number" ? props.min : 15;
|
|
16630
|
+
const max = typeof props.max === "number" ? props.max : 85;
|
|
16631
|
+
const [dragging, setDragging] = (0, import_react23.useState)(false);
|
|
16632
|
+
const boxRef = (0, import_react23.useRef)(null);
|
|
16633
|
+
const session = (0, import_react23.useRef)(null);
|
|
16634
|
+
const frame = (0, import_react23.useRef)(0);
|
|
16635
|
+
const pendingY = (0, import_react23.useRef)(0);
|
|
16636
|
+
const latestValue = (0, import_react23.useRef)(value);
|
|
16637
|
+
latestValue.current = value;
|
|
16638
|
+
const resolveContainer = () => {
|
|
16639
|
+
const given = props.containerRef && props.containerRef.current;
|
|
16640
|
+
if (given) return given;
|
|
16641
|
+
let node = boxRef.current;
|
|
16642
|
+
while (node && node.parentElement) {
|
|
16643
|
+
node = node.parentElement;
|
|
16644
|
+
if (node.getBoundingClientRect().height > 60) return node;
|
|
16645
|
+
}
|
|
16646
|
+
return null;
|
|
16647
|
+
};
|
|
16648
|
+
const begin = (clientY) => {
|
|
16649
|
+
const container = resolveContainer();
|
|
16650
|
+
if (!container) return;
|
|
16651
|
+
const rect2 = container.getBoundingClientRect();
|
|
16652
|
+
if (rect2.height <= 0) return;
|
|
16653
|
+
session.current = {
|
|
16654
|
+
top: rect2.top,
|
|
16655
|
+
height: rect2.height,
|
|
16656
|
+
startY: clientY,
|
|
16657
|
+
startValue: clampPercent(latestValue.current, min, max)
|
|
16658
|
+
};
|
|
16659
|
+
setDragging(true);
|
|
16660
|
+
};
|
|
16661
|
+
const apply2 = () => {
|
|
16662
|
+
frame.current = 0;
|
|
16663
|
+
const s = session.current;
|
|
16664
|
+
if (!s) return;
|
|
16665
|
+
onChange(dragToPercent(s.startValue, pendingY.current - s.startY, s.height, min, max));
|
|
16666
|
+
};
|
|
16667
|
+
const moveTo = (clientY) => {
|
|
16668
|
+
pendingY.current = clientY;
|
|
16669
|
+
if (frame.current) return;
|
|
16670
|
+
if (typeof requestAnimationFrame === "function") {
|
|
16671
|
+
frame.current = requestAnimationFrame(apply2);
|
|
16672
|
+
} else {
|
|
16673
|
+
apply2();
|
|
16674
|
+
}
|
|
16675
|
+
};
|
|
16676
|
+
const end = () => {
|
|
16677
|
+
session.current = null;
|
|
16678
|
+
if (frame.current && typeof cancelAnimationFrame === "function") {
|
|
16679
|
+
cancelAnimationFrame(frame.current);
|
|
16680
|
+
frame.current = 0;
|
|
16681
|
+
}
|
|
16682
|
+
setDragging(false);
|
|
16683
|
+
};
|
|
16684
|
+
(0, import_react23.useEffect)(() => {
|
|
16685
|
+
if (!dragging) return;
|
|
16686
|
+
const onMouseMove = (ev) => moveTo(ev.clientY);
|
|
16687
|
+
const onTouchMove = (ev) => {
|
|
16688
|
+
const t = ev.touches && ev.touches[0];
|
|
16689
|
+
if (!t) return;
|
|
16690
|
+
if (typeof ev.preventDefault === "function" && ev.cancelable !== false) ev.preventDefault();
|
|
16691
|
+
moveTo(t.clientY);
|
|
16692
|
+
};
|
|
16693
|
+
const onUp = () => end();
|
|
16694
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
16695
|
+
document.addEventListener("mouseup", onUp);
|
|
16696
|
+
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
16697
|
+
document.addEventListener("touchend", onUp);
|
|
16698
|
+
document.addEventListener("touchcancel", onUp);
|
|
16699
|
+
window.addEventListener("blur", onUp);
|
|
16700
|
+
document.body.classList.add("dkg-resizing");
|
|
16701
|
+
return () => {
|
|
16702
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
16703
|
+
document.removeEventListener("mouseup", onUp);
|
|
16704
|
+
document.removeEventListener("touchmove", onTouchMove);
|
|
16705
|
+
document.removeEventListener("touchend", onUp);
|
|
16706
|
+
document.removeEventListener("touchcancel", onUp);
|
|
16707
|
+
window.removeEventListener("blur", onUp);
|
|
16708
|
+
document.body.classList.remove("dkg-resizing");
|
|
16709
|
+
if (frame.current && typeof cancelAnimationFrame === "function") {
|
|
16710
|
+
cancelAnimationFrame(frame.current);
|
|
16711
|
+
frame.current = 0;
|
|
16712
|
+
}
|
|
16713
|
+
};
|
|
16714
|
+
}, [dragging, onChange, min, max]);
|
|
16715
|
+
const onKeyDown = (ev) => {
|
|
16716
|
+
const next = splitterStep(ev.key, value, min, max);
|
|
16717
|
+
if (next === null) return;
|
|
16718
|
+
ev.preventDefault();
|
|
16719
|
+
onChange(next);
|
|
16720
|
+
};
|
|
16721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16722
|
+
"div",
|
|
16723
|
+
{
|
|
16724
|
+
ref: boxRef,
|
|
16725
|
+
className: "dkg-splitter" + (dragging ? " dragging" : ""),
|
|
16726
|
+
role: "separator",
|
|
16727
|
+
"aria-orientation": "horizontal",
|
|
16728
|
+
"aria-valuenow": value,
|
|
16729
|
+
"aria-valuemin": min,
|
|
16730
|
+
"aria-valuemax": max,
|
|
16731
|
+
tabIndex: 0,
|
|
16732
|
+
title: "\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6\uFF08\u4E5F\u53EF\u7528\u65B9\u5411\u952E\uFF09",
|
|
16733
|
+
onMouseDown: (ev) => {
|
|
16734
|
+
ev.preventDefault();
|
|
16735
|
+
begin(ev.clientY);
|
|
16736
|
+
},
|
|
16737
|
+
onTouchStart: (ev) => {
|
|
16738
|
+
const t = ev.touches && ev.touches[0];
|
|
16739
|
+
if (t) begin(t.clientY);
|
|
16740
|
+
},
|
|
16741
|
+
onKeyDown,
|
|
16742
|
+
onDoubleClick: () => onChange(50),
|
|
16743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-splitter-grip", "aria-hidden": "true" })
|
|
16744
|
+
}
|
|
16745
|
+
);
|
|
16746
|
+
}
|
|
16747
|
+
function DirBrowser(props) {
|
|
16748
|
+
const ctx = props.ctx;
|
|
16749
|
+
const [listing, setListing] = (0, import_react23.useState)(null);
|
|
16750
|
+
const [loading, setLoading] = (0, import_react23.useState)(false);
|
|
16751
|
+
const [error, setError] = (0, import_react23.useState)("");
|
|
16752
|
+
const [showHidden, setShowHidden] = (0, import_react23.useState)(false);
|
|
16753
|
+
const [input, setInput] = (0, import_react23.useState)(props.startPath || "");
|
|
16754
|
+
const load = (0, import_react23.useCallback)(async (path) => {
|
|
16755
|
+
setLoading(true);
|
|
16756
|
+
setError("");
|
|
16757
|
+
try {
|
|
16758
|
+
const uiw = ctx && typeof ctx.get === "function" ? ctx.get("uiWorkspace") : null;
|
|
16759
|
+
if (!uiw || typeof uiw.listDirectory !== "function") {
|
|
16760
|
+
throw new Error("\u5F53\u524D\u73AF\u5883\u6CA1\u6709\u76EE\u5F55\u6D4F\u89C8\u80FD\u529B\uFF08uiWorkspace.listDirectory \u4E0D\u53EF\u7528\uFF09");
|
|
16761
|
+
}
|
|
16762
|
+
const data = await uiw.listDirectory(path || void 0);
|
|
16763
|
+
setListing(data);
|
|
16764
|
+
setInput(data && data.path ? data.path : "");
|
|
16765
|
+
} catch (e) {
|
|
16766
|
+
setError(e && e.message || String(e));
|
|
16767
|
+
} finally {
|
|
16768
|
+
setLoading(false);
|
|
16769
|
+
}
|
|
16770
|
+
}, [ctx]);
|
|
16771
|
+
(0, import_react23.useEffect)(() => {
|
|
16772
|
+
load(props.startPath || "");
|
|
16773
|
+
}, [load, props.startPath]);
|
|
16774
|
+
const entries = (listing && listing.entries || []).filter((e) => showHidden || !e.hidden);
|
|
16775
|
+
const crumbs = listing && listing.crumbs || [];
|
|
16776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-picker", children: [
|
|
16777
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-picker-head", children: [
|
|
16778
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-picker-title", children: "\u9009\u62E9\u76EE\u5F55" }),
|
|
16779
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", onClick: props.onClose, children: "\u5173\u95ED" })
|
|
16780
|
+
] }),
|
|
16781
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-crumbs", children: crumbs.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16782
|
+
"button",
|
|
16783
|
+
{
|
|
16784
|
+
type: "button",
|
|
16785
|
+
className: "dkg-crumb" + (i === crumbs.length - 1 ? " on" : ""),
|
|
16786
|
+
title: c.path,
|
|
16787
|
+
onClick: () => load(c.path),
|
|
16788
|
+
children: i === 0 ? c.name || "/" : c.name
|
|
16789
|
+
},
|
|
16790
|
+
c.path
|
|
16791
|
+
)) }),
|
|
16792
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-picker-bar", children: [
|
|
16793
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16794
|
+
"input",
|
|
16795
|
+
{
|
|
16796
|
+
className: "dkg-input",
|
|
16797
|
+
value: input,
|
|
16798
|
+
placeholder: "\u7EDD\u5BF9\u8DEF\u5F84",
|
|
16799
|
+
spellCheck: false,
|
|
16800
|
+
onChange: (e) => setInput(e.target.value),
|
|
16801
|
+
onKeyDown: (e) => {
|
|
16802
|
+
if (e.key === "Enter") load(input.trim());
|
|
16803
|
+
}
|
|
16804
|
+
}
|
|
16805
|
+
),
|
|
16806
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: () => load(input.trim()), disabled: loading, children: "\u524D\u5F80" }),
|
|
16807
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-check", children: [
|
|
16808
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: showHidden, onChange: (e) => setShowHidden(e.target.checked) }),
|
|
16809
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "\u9690\u85CF\u9879" })
|
|
16810
|
+
] })
|
|
16811
|
+
] }),
|
|
16812
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: error }) : null,
|
|
16813
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-picker-list", children: [
|
|
16814
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8BFB\u53D6\u4E2D\u2026" }) : null,
|
|
16815
|
+
!loading && entries.length === 0 && !error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8FD9\u4E2A\u76EE\u5F55\u4E0B\u6CA1\u6709\u5B50\u76EE\u5F55\u3002" }) : null,
|
|
16816
|
+
entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
16817
|
+
"button",
|
|
16818
|
+
{
|
|
16819
|
+
type: "button",
|
|
16820
|
+
className: "dkg-picker-row",
|
|
16821
|
+
title: entry.path,
|
|
16822
|
+
onClick: () => load(entry.path),
|
|
16823
|
+
children: [
|
|
16824
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-folder", children: "\u25B8" }),
|
|
16825
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", children: entry.name })
|
|
16826
|
+
]
|
|
16827
|
+
},
|
|
16828
|
+
entry.path
|
|
16829
|
+
)),
|
|
16830
|
+
listing && listing.truncated ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u76EE\u5F55\u8FC7\u591A\uFF0C\u53EA\u663E\u793A\u4E86\u524D\u9762\u4E00\u90E8\u5206\u3002" }) : null
|
|
16831
|
+
] }),
|
|
16832
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-picker-foot", children: [
|
|
16833
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-hint", title: listing && listing.path, children: listing && listing.path ? truncate4(listing.path, 60) : "" }),
|
|
16834
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16835
|
+
"button",
|
|
16836
|
+
{
|
|
16837
|
+
type: "button",
|
|
16838
|
+
className: "dkg-btn primary",
|
|
16839
|
+
disabled: !listing || loading,
|
|
16840
|
+
onClick: () => {
|
|
16841
|
+
if (listing && listing.path) props.onPick(listing.path);
|
|
16842
|
+
},
|
|
16843
|
+
children: "\u9009\u8FD9\u4E2A\u76EE\u5F55"
|
|
16844
|
+
}
|
|
16845
|
+
)
|
|
16846
|
+
] })
|
|
16847
|
+
] });
|
|
16848
|
+
}
|
|
16849
|
+
function GitView(props) {
|
|
16850
|
+
const ctx = props && props.ctx;
|
|
16851
|
+
const [dir, setDir] = (0, import_react23.useState)(props && props.repo ? props.repo : "");
|
|
16852
|
+
const [includeSubdirs, setIncludeSubdirs] = (0, import_react23.useState)(true);
|
|
16853
|
+
const [repos, setRepos] = (0, import_react23.useState)([]);
|
|
16854
|
+
const [selectedRepos, setSelectedRepos] = (0, import_react23.useState)([]);
|
|
16855
|
+
const setAllRepos = (paths) => {
|
|
16856
|
+
const list = Array.isArray(paths) ? paths.filter(Boolean) : [];
|
|
16857
|
+
setSelectedRepos(list.length > 0 ? list : [repo]);
|
|
16858
|
+
};
|
|
16859
|
+
const toggleRepo = (path) => setSelectedRepos((prev) => toggleRepoSelection(prev, path, repo));
|
|
16860
|
+
const [repo, setRepo] = (0, import_react23.useState)(props && props.repo ? props.repo : "");
|
|
16861
|
+
const [refs, setRefs] = (0, import_react23.useState)(null);
|
|
16862
|
+
const [status, setStatus] = (0, import_react23.useState)(null);
|
|
16863
|
+
const [tab, setTab] = (0, import_react23.useState)("history");
|
|
16864
|
+
const [loading, setLoading] = (0, import_react23.useState)(false);
|
|
16865
|
+
const [error, setError] = (0, import_react23.useState)("");
|
|
16866
|
+
const [note, setError2] = (0, import_react23.useState)("");
|
|
16867
|
+
const booted = (0, import_react23.useRef)(false);
|
|
16868
|
+
(0, import_react23.useEffect)(() => {
|
|
16869
|
+
if (booted.current) return;
|
|
16870
|
+
booted.current = true;
|
|
16871
|
+
let stopped = false;
|
|
16872
|
+
rpc2("info").then((info) => {
|
|
16873
|
+
if (stopped) return;
|
|
16874
|
+
const given = props && props.repo;
|
|
16875
|
+
const sessionDir = currentSessionDir(ctx, props && props.sessionId);
|
|
16876
|
+
const start = given || sessionDir || info && info.defaultDir || "";
|
|
16877
|
+
setDir(start);
|
|
16878
|
+
if (given) setRepo(given);
|
|
16879
|
+
if (!given && !sessionDir) {
|
|
16880
|
+
setError("\u6CA1\u80FD\u8BFB\u5230\u5F53\u524D\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u76EE\u5F55\uFF0C\u5148\u663E\u793A\u5BBF\u4E3B\u8FDB\u7A0B\u7684\u76EE\u5F55\u3002\u53EF\u4EE5\u5728\u4E0A\u65B9\u624B\u52A8\u586B\u5199\u4ED3\u5E93\u8DEF\u5F84\uFF0C\u6216\u70B9\u300C\u9009\u62E9\u76EE\u5F55\u2026\u300D\u3002");
|
|
16881
|
+
}
|
|
16882
|
+
if (info && info.available === false) {
|
|
16883
|
+
setError("\u672C\u673A\u6CA1\u6709\u53EF\u7528\u7684 git \u547D\u4EE4\uFF08PATH \u91CC\u627E\u4E0D\u5230 git\uFF09\uFF0C\u65E0\u6CD5\u8BFB\u53D6\u63D0\u4EA4\u8BB0\u5F55\u3002");
|
|
16884
|
+
}
|
|
16885
|
+
}).catch((e) => {
|
|
16886
|
+
if (!stopped) setError(e && e.message || String(e));
|
|
16887
|
+
});
|
|
16888
|
+
return () => {
|
|
16889
|
+
stopped = true;
|
|
16890
|
+
};
|
|
16891
|
+
}, []);
|
|
16892
|
+
const resolveAndSet = (0, import_react23.useCallback)(async (target) => {
|
|
16893
|
+
if (!target) return;
|
|
16894
|
+
setLoading(true);
|
|
16895
|
+
setError("");
|
|
16896
|
+
try {
|
|
16897
|
+
const resolved = await rpc2("resolve", { path: target });
|
|
16898
|
+
setRepo(resolved.repo);
|
|
16899
|
+
if (!props || !props.repo) setDir(resolved.repo);
|
|
16900
|
+
} catch (e) {
|
|
16901
|
+
try {
|
|
16902
|
+
const scanned = await rpc2("repos", { dir: target, includeSubdirs: true, depth: 3 });
|
|
16903
|
+
const list = scanned && scanned.repos || [];
|
|
16904
|
+
setRepos(list);
|
|
16905
|
+
if (list.length > 0) {
|
|
16906
|
+
const first = list[0];
|
|
16907
|
+
setRepo(first.path);
|
|
16908
|
+
if (!props || !props.repo) setDir(first.path);
|
|
16909
|
+
return;
|
|
16910
|
+
}
|
|
16911
|
+
} catch {
|
|
16912
|
+
}
|
|
16913
|
+
setRepos([]);
|
|
16914
|
+
setRepo("");
|
|
16915
|
+
setError(e && e.message || String(e));
|
|
16916
|
+
} finally {
|
|
16917
|
+
setLoading(false);
|
|
16918
|
+
}
|
|
16919
|
+
}, []);
|
|
16920
|
+
(0, import_react23.useEffect)(() => {
|
|
16921
|
+
if (!dir) return;
|
|
16922
|
+
let stopped = false;
|
|
16923
|
+
const timer = setTimeout(() => {
|
|
16924
|
+
if (!stopped) resolveAndSet(dir);
|
|
16925
|
+
}, 200);
|
|
16926
|
+
return () => {
|
|
16927
|
+
stopped = true;
|
|
16928
|
+
clearTimeout(timer);
|
|
16929
|
+
};
|
|
16930
|
+
}, [dir, resolveAndSet]);
|
|
16931
|
+
const scanRepos = (0, import_react23.useCallback)(async (target) => {
|
|
16932
|
+
if (!target || !includeSubdirs) {
|
|
16933
|
+
setRepos([]);
|
|
16934
|
+
return;
|
|
16935
|
+
}
|
|
16936
|
+
try {
|
|
16937
|
+
const data = await rpc2("repos", { dir: target, includeSubdirs: true, depth: 3 });
|
|
16938
|
+
setRepos(data && data.repos || []);
|
|
16939
|
+
} catch {
|
|
16940
|
+
setRepos([]);
|
|
16941
|
+
}
|
|
16942
|
+
}, [includeSubdirs]);
|
|
16943
|
+
(0, import_react23.useEffect)(() => {
|
|
16944
|
+
scanRepos(dir);
|
|
16945
|
+
}, [dir, scanRepos]);
|
|
16946
|
+
const refreshRepo = (0, import_react23.useCallback)(async () => {
|
|
16947
|
+
if (!repo) {
|
|
16948
|
+
setRefs(null);
|
|
16949
|
+
setStatus(null);
|
|
16950
|
+
return;
|
|
16951
|
+
}
|
|
16952
|
+
try {
|
|
16953
|
+
const [r, s] = await Promise.all([rpc2("refs", { repo }), rpc2("status", { repo })]);
|
|
16954
|
+
setRefs(r);
|
|
16955
|
+
setStatus(s);
|
|
16956
|
+
} catch (e) {
|
|
16957
|
+
setError(e && e.message || String(e));
|
|
16958
|
+
setRefs(null);
|
|
16959
|
+
setStatus(null);
|
|
16960
|
+
}
|
|
16961
|
+
}, [repo]);
|
|
16962
|
+
(0, import_react23.useEffect)(() => {
|
|
16963
|
+
refreshRepo();
|
|
16964
|
+
}, [refreshRepo]);
|
|
16965
|
+
const [picking, setPicking] = (0, import_react23.useState)(false);
|
|
16966
|
+
const canBrowse = (() => {
|
|
16967
|
+
try {
|
|
16968
|
+
const uiw = ctx && typeof ctx.get === "function" ? ctx.get("uiWorkspace") : null;
|
|
16969
|
+
return !!(uiw && typeof uiw.listDirectory === "function");
|
|
16970
|
+
} catch {
|
|
16971
|
+
return false;
|
|
16972
|
+
}
|
|
16973
|
+
})();
|
|
16974
|
+
const pick = async () => {
|
|
16975
|
+
if (canBrowse) {
|
|
16976
|
+
setPicking(true);
|
|
16977
|
+
return;
|
|
16978
|
+
}
|
|
16979
|
+
const chosen = await pickDirectory(ctx);
|
|
16980
|
+
if (chosen) setDir(chosen);
|
|
16981
|
+
};
|
|
16982
|
+
const branch = refs && refs.branch || "";
|
|
16983
|
+
const ahead = status && status.ahead || 0;
|
|
16984
|
+
const behind = status && status.behind || 0;
|
|
16985
|
+
const dirty = status ? status.stagedCount + status.unstagedCount + status.untrackedCount : 0;
|
|
16986
|
+
const compact = props && props.compact === true;
|
|
16987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg" + (compact ? " dkg-compact" : ""), children: [
|
|
16988
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-bar", children: [
|
|
16989
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "dkg-input", value: dir, placeholder: "\u4ED3\u5E93\u6216\u7236\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84", spellCheck: false, onChange: (e) => setDir(e.target.value) }),
|
|
16990
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: () => resolveAndSet(dir), disabled: !dir || loading, children: loading ? "\u2026" : "\u6253\u5F00" }),
|
|
16991
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: pick, title: canBrowse ? "\u6D4F\u89C8\u76EE\u5F55\uFF08\u670D\u52A1\u5668\u53EF\u7528\uFF09" : "\u6253\u5F00\u7CFB\u7EDF\u76EE\u5F55\u5BF9\u8BDD\u6846", children: picking ? "\u6D4F\u89C8\u4E2D\u2026" : "\u9009\u62E9\u76EE\u5F55\u2026" })
|
|
16992
|
+
] }),
|
|
16993
|
+
picking ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
16994
|
+
DirBrowser,
|
|
16995
|
+
{
|
|
16996
|
+
ctx,
|
|
16997
|
+
startPath: dir,
|
|
16998
|
+
onClose: () => setPicking(false),
|
|
16999
|
+
onPick: (chosen) => {
|
|
17000
|
+
setPicking(false);
|
|
17001
|
+
setDir(chosen);
|
|
17002
|
+
resolveAndSet(chosen);
|
|
17003
|
+
}
|
|
17004
|
+
}
|
|
17005
|
+
) : null,
|
|
17006
|
+
!compact ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-bar", children: [
|
|
17007
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-check", children: [
|
|
17008
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: includeSubdirs, onChange: (e) => setIncludeSubdirs(e.target.checked) }),
|
|
17009
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "\u5305\u542B\u5B50\u76EE\u5F55\u4ED3\u5E93" })
|
|
17010
|
+
] }),
|
|
17011
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-hint", children: loading ? "\u6B63\u5728\u89E3\u6790\u2026" : repos.length > 0 ? repos.length + " \u4E2A\u4ED3\u5E93" : "" })
|
|
17012
|
+
] }) : null,
|
|
17013
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: error }) : null,
|
|
17014
|
+
repo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
17015
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-tabbar", children: [
|
|
17016
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-repo-name", title: repo, children: repo }),
|
|
17017
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-badge", children: branch || "(\u5206\u79BB HEAD)" }),
|
|
17018
|
+
behind > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-badge warn", children: [
|
|
17019
|
+
"\u843D\u540E ",
|
|
17020
|
+
behind
|
|
17021
|
+
] }) : null,
|
|
17022
|
+
ahead > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-badge ok", children: [
|
|
17023
|
+
"\u5F85\u63A8\u9001 ",
|
|
17024
|
+
ahead
|
|
17025
|
+
] }) : null,
|
|
17026
|
+
dirty > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-badge", children: [
|
|
17027
|
+
dirty,
|
|
17028
|
+
" \u5904\u6539\u52A8"
|
|
17029
|
+
] }) : null,
|
|
17030
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-tabs", children: [
|
|
17031
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-tab" + (tab === "history" ? " on" : ""), onClick: () => setTab("history"), children: "\u5386\u53F2" }),
|
|
17032
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-tab" + (tab === "worktree" ? " on" : ""), onClick: () => setTab("worktree"), children: [
|
|
17033
|
+
"\u5DE5\u4F5C\u533A",
|
|
17034
|
+
dirty > 0 ? " (" + dirty + ")" : ""
|
|
17035
|
+
] })
|
|
17036
|
+
] }),
|
|
17037
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: refreshRepo, children: "\u5237\u65B0" })
|
|
17038
|
+
] }),
|
|
17039
|
+
tab === "history" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
17040
|
+
HistoryPane,
|
|
17041
|
+
{
|
|
17042
|
+
repo,
|
|
17043
|
+
repos,
|
|
17044
|
+
selectedRepos: selectedRepos.length > 0 ? selectedRepos : [repo],
|
|
17045
|
+
currentRepo: repo,
|
|
17046
|
+
onToggleRepo: toggleRepo,
|
|
17047
|
+
onOnlyCurrent: () => setSelectedRepos([repo]),
|
|
17048
|
+
onSelectAll: setAllRepos,
|
|
17049
|
+
refs,
|
|
17050
|
+
initialPath: props && props.initialPath
|
|
17051
|
+
}
|
|
17052
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WorktreePane, { repo, status, onRefresh: refreshRepo })
|
|
17053
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6B63\u5728\u89E3\u6790\u76EE\u5F55\u6240\u5728\u7684\u4ED3\u5E93\u2026\uFF08\u4E5F\u53EF\u4EE5\u5728\u4E0A\u9762\u586B\u4E00\u4E2A\u7EDD\u5BF9\u8DEF\u5F84\u540E\u70B9\u300C\u6253\u5F00\u300D\uFF09" })
|
|
17054
|
+
] });
|
|
17055
|
+
}
|
|
17056
|
+
var GIT_TAB_ID = "dsh-dock.git";
|
|
17057
|
+
var GIT_TAB_KIND = "dsh-dock-git";
|
|
17058
|
+
var GIT_ICON_KEY = "dsh-dock.git";
|
|
17059
|
+
var GIT_PANEL_NAME = "Git\u4ED3\u5E93\u64CD\u4F5C";
|
|
17060
|
+
var dockCtx = null;
|
|
17061
|
+
function GitTabBody(props) {
|
|
17062
|
+
const tab = props.useTabInfo();
|
|
17063
|
+
const params = tab && tab.tab && tab.tab.navigation && tab.tab.navigation.params || {};
|
|
17064
|
+
const repo = typeof params.repo === "string" ? params.repo : "";
|
|
17065
|
+
const path = typeof params.path === "string" ? params.path : "";
|
|
17066
|
+
const [target, setTarget] = (0, import_react23.useState)({ repo, path });
|
|
17067
|
+
(0, import_react23.useEffect)(() => {
|
|
17068
|
+
setTarget({ repo, path });
|
|
17069
|
+
}, [repo, path]);
|
|
17070
|
+
const ctx = props.ctx || dockCtx;
|
|
17071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GitView, { ctx, repo: target.repo, initialPath: target.path, sessionId: props.sessionId, compact: true });
|
|
17072
|
+
}
|
|
17073
|
+
function GitTabTitle(props) {
|
|
17074
|
+
const tab = props.useTabInfo();
|
|
17075
|
+
const params = tab && tab.tab && tab.tab.navigation && tab.tab.navigation.params || {};
|
|
17076
|
+
const repo = typeof params.repo === "string" ? params.repo : "";
|
|
17077
|
+
const name = repo ? repo.split("/").filter(Boolean).pop() : "";
|
|
17078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { title: repo, children: name || GIT_PANEL_NAME });
|
|
17079
|
+
}
|
|
17080
|
+
var css6 = [
|
|
17081
|
+
".dkg{display:flex;flex-direction:column;gap:8px;min-height:0;height:100%;}",
|
|
17082
|
+
".dkg.dkg-compact{gap:6px;padding:0;}",
|
|
17083
|
+
".dkg-bar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}",
|
|
17084
|
+
".dkg-input{flex:1;min-width:120px;box-sizing:border-box;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:4px 8px;}",
|
|
17085
|
+
".dkg-input.sm{min-width:70px;flex:0 1 100px;}",
|
|
17086
|
+
".dkg-input:focus{outline:none;border-color:var(--dk-accent);}",
|
|
17087
|
+
".dkg-select{flex:none;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:4px 6px;}",
|
|
17088
|
+
".dkg-btn{flex:none;cursor:pointer;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:3px 9px;}",
|
|
17089
|
+
".dkg-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17090
|
+
".dkg-btn:disabled{opacity:.45;cursor:default;}",
|
|
17091
|
+
".dkg-btn.primary{border-color:var(--dk-accent);color:var(--dk-accent);}",
|
|
17092
|
+
".dkg-btn.primary:hover:not(:disabled){background:var(--dk-accent-soft);}",
|
|
17093
|
+
".dkg-link{cursor:pointer;font-family:inherit;font-size:11px;color:var(--dk-accent);background:transparent;border:0;padding:0;}",
|
|
17094
|
+
".dkg-link:disabled{opacity:.5;cursor:default;}",
|
|
17095
|
+
".dkg-check{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--dsw-alias-label-secondary);cursor:pointer;}",
|
|
17096
|
+
".dkg-hint{font-size:11px;color:var(--dsw-alias-label-tertiary);}",
|
|
17097
|
+
".dkg-note{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.6;}",
|
|
17098
|
+
".dkg-error{border:1px solid color-mix(in srgb,var(--dsw-alias-state-error-primary) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 8%,transparent);color:var(--dsw-alias-state-error-primary);border-radius:8px;padding:6px 10px;font-size:12px;line-height:1.6;word-break:break-all;}",
|
|
17099
|
+
".dkg-ok{border:1px solid color-mix(in srgb,var(--dsw-alias-state-success-primary) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 8%,transparent);color:var(--dsw-alias-state-success-primary);border-radius:8px;padding:6px 10px;font-size:12px;line-height:1.6;word-break:break-all;}",
|
|
17100
|
+
// 子仓库多选下拉
|
|
17101
|
+
".dkg-repopick{position:relative;flex:0 1 auto;}",
|
|
17102
|
+
".dkg-repopick-btn{display:flex;align-items:center;gap:4px;cursor:pointer;font-family:inherit;font-size:11px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:4px 8px;white-space:nowrap;}",
|
|
17103
|
+
".dkg-repopick-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
17104
|
+
".dkg-repopick-btn.on{border-color:var(--dk-accent);color:var(--dk-accent);}",
|
|
17105
|
+
".dkg-caret{font-size:9px;opacity:.8;}",
|
|
17106
|
+
".dkg-repopick-menu{position:absolute;top:calc(100% + 4px);right:0;z-index:20;min-width:260px;max-width:min(420px,90vw);max-height:300px;overflow:auto;display:flex;flex-direction:column;gap:1px;padding:4px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.28);}",
|
|
17107
|
+
".dkg-repopick-row{display:flex;align-items:center;gap:6px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:11px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid transparent;border-radius:5px;padding:4px 6px;min-width:0;}",
|
|
17108
|
+
".dkg-repopick-row:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17109
|
+
".dkg-repopick-row.on{color:var(--dsw-alias-label-primary);}",
|
|
17110
|
+
".dkg-repopick-all{display:flex;gap:4px;flex:none;border-bottom:1px solid var(--dsw-alias-border-l1);padding:2px 2px 5px;margin-bottom:2px;}",
|
|
17111
|
+
".dkg-repopick-allbtn{flex:1;cursor:pointer;font-family:inherit;font-size:11px;color:var(--dk-accent);background:transparent;border:1px solid var(--dsw-alias-border-l1);border-radius:5px;padding:3px 6px;}",
|
|
17112
|
+
".dkg-repopick-allbtn:hover{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dk-accent);}",
|
|
17113
|
+
".dkg-repopick-foot{flex:none;cursor:pointer;font-family:inherit;font-size:11px;color:var(--dk-accent);background:transparent;border:0;border-top:1px solid var(--dsw-alias-border-l1);padding:5px 6px;margin-top:2px;text-align:left;}",
|
|
17114
|
+
".dkg-repopick-foot:hover{text-decoration:underline;}",
|
|
17115
|
+
".dkg-tabbar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;border-bottom:1px solid var(--dsw-alias-border-l1);padding-bottom:5px;}",
|
|
17116
|
+
".dkg-repo-name{font-size:12px;font-weight:600;color:var(--dsw-alias-label-primary);max-width:42%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:rtl;text-align:left;}",
|
|
17117
|
+
".dkg-badge{font-size:10px;border:1px solid var(--dsw-alias-border-l2);border-radius:999px;padding:0 8px;color:var(--dsw-alias-label-tertiary);}",
|
|
17118
|
+
".dkg-badge.ok{color:var(--dsw-alias-state-success-primary);border-color:currentColor;}",
|
|
17119
|
+
".dkg-badge.warn{color:var(--dk-warn);border-color:currentColor;}",
|
|
17120
|
+
".dkg-tabs{display:flex;gap:4px;margin-left:auto;}",
|
|
17121
|
+
".dkg-tab{cursor:pointer;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid transparent;border-radius:8px;padding:2px 9px;}",
|
|
17122
|
+
".dkg-tab.on{color:var(--dk-accent);border-color:currentColor;background:var(--dk-accent-soft);}",
|
|
17123
|
+
// 抽屉里三栏改为上下堆叠,宽度不够时更可用
|
|
17124
|
+
".dkg-body{display:flex;gap:6px;min-height:0;flex:1;overflow:hidden;}",
|
|
17125
|
+
".dkg-compact .dkg-body{flex-direction:column;}",
|
|
17126
|
+
".dkg-side{flex:none;width:150px;overflow:auto;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);padding:5px;display:flex;flex-direction:column;gap:1px;}",
|
|
17127
|
+
".dkg-compact .dkg-side{width:auto;max-height:110px;flex-direction:row;flex-wrap:wrap;align-items:center;}",
|
|
17128
|
+
".dkg-compact .dkg-side-group{flex-direction:row;flex-wrap:wrap;margin-top:0;}",
|
|
17129
|
+
".dkg-compact .dkg-side-title{display:none;}",
|
|
17130
|
+
".dkg-compact .dkg-side-item{width:auto;flex:none;max-width:180px;}",
|
|
17131
|
+
".dkg-side-group{display:flex;flex-direction:column;gap:1px;margin-top:4px;}",
|
|
17132
|
+
".dkg-side-title{font-size:10px;text-transform:uppercase;letter-spacing:.04em;color:var(--dsw-alias-label-tertiary);padding:4px 6px 2px;}",
|
|
17133
|
+
".dkg-side-item{display:flex;align-items:center;gap:6px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid transparent;border-radius:6px;padding:2px 6px;min-width:0;}",
|
|
17134
|
+
".dkg-side-item:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17135
|
+
".dkg-side-item.on{color:var(--dk-accent);background:var(--dk-accent-soft);border-color:color-mix(in srgb,var(--dk-accent) 35%,transparent);}",
|
|
17136
|
+
".dkg-branch-icon{flex:none;font-size:10px;color:var(--dsw-alias-label-tertiary);}",
|
|
17137
|
+
".dkg-branch-icon.remote{color:var(--dsw-alias-label-secondary);}",
|
|
17138
|
+
".dkg-branch-icon.tag{color:var(--dk-warn);}",
|
|
17139
|
+
".dkg-ellipsis{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17140
|
+
".dkg-mid{flex:1 1 40%;min-width:0;min-height:0;display:flex;flex-direction:column;gap:5px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);padding:6px;}",
|
|
17141
|
+
".dkg-compact .dkg-mid{flex:1 1 auto;min-height:80px;overflow:hidden;}",
|
|
17142
|
+
".dkg-filters{display:flex;flex-direction:column;gap:5px;}",
|
|
17143
|
+
".dkg-filter-row{display:flex;gap:5px;flex-wrap:wrap;align-items:center;}",
|
|
17144
|
+
".dkg-filter-tag{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--dk-accent);}",
|
|
17145
|
+
".dkg-commits{flex:1;min-height:60px;overflow:auto;display:flex;flex-direction:column;gap:1px;}",
|
|
17146
|
+
".dkg-commit{display:grid;grid-template-columns:12px minmax(0,1fr) auto;align-items:center;gap:6px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:transparent;border:1px solid transparent;border-radius:6px;padding:3px 5px;}",
|
|
17147
|
+
".dkg-commit:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17148
|
+
".dkg-commit.on{background:var(--dk-accent-soft);border-color:color-mix(in srgb,var(--dk-accent) 35%,transparent);}",
|
|
17149
|
+
".dkg-graph{display:flex;align-items:center;justify-content:center;position:relative;height:100%;}",
|
|
17150
|
+
".dkg-graph::before{content:'';position:absolute;top:-4px;bottom:-4px;width:1px;background:var(--dsw-alias-border-l2);}",
|
|
17151
|
+
".dkg-graph-dot{position:relative;width:6px;height:6px;border-radius:50%;background:var(--dk-accent);box-shadow:0 0 0 2px var(--dsw-alias-bg-layer-1);}",
|
|
17152
|
+
".dkg-commit-subject{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17153
|
+
".dkg-commit-refs{display:none;}",
|
|
17154
|
+
".dkg-compact .dkg-commit-refs{display:none;}",
|
|
17155
|
+
".dkg-commit-meta-line{display:flex;align-items:center;gap:6px;font-size:10px;color:var(--dsw-alias-label-tertiary);overflow:hidden;}",
|
|
17156
|
+
".dkg-ref{font-size:10px;border:1px solid var(--dsw-alias-border-l2);border-radius:999px;padding:0 6px;color:var(--dsw-alias-label-secondary);}",
|
|
17157
|
+
".dkg-ref.remote{color:var(--dsw-alias-label-tertiary);}",
|
|
17158
|
+
".dkg-commit-author{font-size:11px;color:var(--dsw-alias-label-secondary);flex:none;max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17159
|
+
".dkg-commit-time{font-size:11px;color:var(--dsw-alias-label-tertiary);flex:none;min-width:58px;text-align:right;}",
|
|
17160
|
+
".dkg-detail{flex:1 1 46%;min-width:0;min-height:0;overflow:hidden;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);padding:8px;display:flex;flex-direction:column;gap:4px;}",
|
|
17161
|
+
".dkg-compact .dkg-detail{flex:none;height:var(--dkg-main-pct,50%);max-height:none;min-height:80px;}",
|
|
17162
|
+
// 拖动分隔条:只在上下堆叠(抽屉)时占位,宽屏三栏下隐藏
|
|
17163
|
+
// 列表↔详情 的分隔条:只在抽屉(上下堆叠)时出现;宽屏三栏时详情在右侧,不需要它
|
|
17164
|
+
".dkg-splitter-main{display:none;}",
|
|
17165
|
+
".dkg-compact .dkg-splitter-main{display:block;flex:none;}",
|
|
17166
|
+
// 详情内部(差异↔说明)的分隔条:任何布局都显示
|
|
17167
|
+
// 拖动期间:全局光标改成上下调整,并禁止选中文字
|
|
17168
|
+
// (不禁止的话拖快了会连带选中面板里的文本,出现蓝色选区,视觉上就是「闪」)
|
|
17169
|
+
"body.dkg-resizing{cursor:row-resize !important;user-select:none !important;}",
|
|
17170
|
+
"body.dkg-resizing *{cursor:row-resize !important;user-select:none !important;}",
|
|
17171
|
+
// 拖动期间禁用过渡/动画:任何过渡都会让高度变化「追」不上指针,看起来像抖
|
|
17172
|
+
"body.dkg-resizing *{transition:none !important;animation:none !important;}",
|
|
17173
|
+
".dkg-splitter{will-change:transform;}",
|
|
17174
|
+
".dkg-splitter-slot{display:block;flex:none;}",
|
|
17175
|
+
".dkg-splitter{display:flex;align-items:center;justify-content:center;height:10px;cursor:row-resize;border-radius:4px;background:transparent;touch-action:none;}",
|
|
17176
|
+
".dkg-splitter:hover,.dkg-splitter.dragging{background:var(--dk-accent-soft);}",
|
|
17177
|
+
".dkg-splitter:focus-visible{outline:2px solid var(--dk-accent);outline-offset:-2px;}",
|
|
17178
|
+
".dkg-splitter-grip{display:block;width:36px;height:2px;border-radius:1px;background:var(--dsw-alias-border-l2);}",
|
|
17179
|
+
".dkg-splitter:hover .dkg-splitter-grip,.dkg-splitter.dragging .dkg-splitter-grip{background:var(--dk-accent);}",
|
|
17180
|
+
// ---- GoLand 风格提交表格 ----
|
|
17181
|
+
".dkg-toolbar{display:flex;align-items:center;gap:4px;flex-wrap:wrap;flex:none;}",
|
|
17182
|
+
".dkg-toolbar .dkg-input{flex:1 1 120px;min-width:80px;}",
|
|
17183
|
+
".dkg-toolbar .dkg-input.sm{flex:0 1 84px;min-width:60px;}",
|
|
17184
|
+
".dkg-icon-btn{flex:none;cursor:pointer;font-family:inherit;font-size:13px;line-height:1;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;padding:4px 7px;}",
|
|
17185
|
+
".dkg-icon-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
17186
|
+
".dkg-icon-btn:disabled{opacity:.5;cursor:default;}",
|
|
17187
|
+
".dkg-colpick{position:relative;flex:none;}",
|
|
17188
|
+
".dkg-colpick-menu{position:absolute;top:calc(100% + 4px);right:0;z-index:20;min-width:150px;display:flex;flex-direction:column;gap:1px;padding:4px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.28);}",
|
|
17189
|
+
".dkg-colpick-row{display:flex;align-items:center;gap:6px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:11px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid transparent;border-radius:5px;padding:4px 6px;}",
|
|
17190
|
+
".dkg-colpick-row:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17191
|
+
".dkg-colpick-row.on{color:var(--dsw-alias-label-primary);}",
|
|
17192
|
+
".dkg-colpick-row.locked{opacity:.55;cursor:default;}",
|
|
17193
|
+
// 表头与行共用同一套列宽:图 14px / 说明 1fr / 引用 88px / 作者 96px / 日期 64px
|
|
17194
|
+
".dkg-thead,.dkg-tr{display:grid;grid-template-columns:var(--dkg-cols,12px minmax(0,1fr) 64px 78px 56px);align-items:center;gap:5px;}",
|
|
17195
|
+
".dkg-thead{flex:none;padding:3px 6px;border-bottom:1px solid var(--dsw-alias-border-l1);font-size:11px;color:var(--dsw-alias-label-tertiary);user-select:none;}",
|
|
17196
|
+
".dkg-th.date,.dkg-td.date{text-align:right;}",
|
|
17197
|
+
".dkg-th.refs,.dkg-td.refs{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17198
|
+
".dkg-tr{cursor:default;padding:3px 6px;border-radius:4px;font-size:12px;color:var(--dsw-alias-label-primary);border:1px solid transparent;}",
|
|
17199
|
+
".dkg-tr:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17200
|
+
".dkg-tr.on{background:var(--dk-accent-soft);border-color:var(--dk-accent);}",
|
|
17201
|
+
".dkg-td{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17202
|
+
".dkg-td.subject{display:flex;align-items:center;gap:5px;min-width:0;}",
|
|
17203
|
+
".dkg-td.author{font-size:11px;color:var(--dsw-alias-label-secondary);}",
|
|
17204
|
+
".dkg-td.date{font-size:11px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;}",
|
|
17205
|
+
".dkg-td.datetime{font-size:11px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap;}",
|
|
17206
|
+
".dkg-th.datetime{white-space:nowrap;}",
|
|
17207
|
+
// 抽屉很窄时先牺牲「引用」列:它多数行是空的,说明与时间更要紧
|
|
17208
|
+
".dkg-muted{color:var(--dsw-alias-label-tertiary);}",
|
|
17209
|
+
".dkg-repo-tag{flex:none;font-size:10px;padding:0 4px;border-radius:3px;background:var(--dk-accent-soft);color:var(--dk-accent);white-space:nowrap;}",
|
|
17210
|
+
".dkg-chip-check{flex:none;font-size:11px;line-height:1;}",
|
|
17211
|
+
".dkg-toolbar input[type=date]{flex:0 1 120px;min-width:100px;}",
|
|
17212
|
+
// 分支图:一条竖线 + 一个点,像 IDE 的 Log 图列
|
|
17213
|
+
".dkg-td.graph{position:relative;display:flex;align-items:center;justify-content:center;height:100%;}",
|
|
17214
|
+
".dkg-graph-line{position:absolute;top:0;bottom:0;left:50%;width:1px;background:var(--dsw-alias-border-l2);transform:translateX(-50%);}",
|
|
17215
|
+
".dkg-graph-dot{position:relative;width:6px;height:6px;border-radius:50%;background:var(--dk-accent);box-shadow:0 0 0 2px var(--dsw-alias-bg-layer-1);}",
|
|
17216
|
+
// 右栏详情:上下分区(上方差异 / 下方说明),可拖动
|
|
17217
|
+
".dkg-detail-diff{flex:1 1 0;min-height:60px;overflow:auto;display:flex;flex-direction:column;gap:6px;}",
|
|
17218
|
+
".dkg-detail-msgbox{flex:0 0 auto;overflow:auto;display:flex;flex-direction:column;gap:5px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;height:var(--dkg-detail-pct,50%);}",
|
|
17219
|
+
".dkg-detail .dkg-splitter-slot{display:block;flex:none;}",
|
|
17220
|
+
".dkg-detail-head{display:flex;flex-direction:column;gap:5px;border-bottom:1px solid var(--dsw-alias-border-l1);padding-bottom:6px;}",
|
|
17221
|
+
".dkg-detail-subject{font-size:12px;font-weight:600;color:var(--dsw-alias-label-primary);word-break:break-word;}",
|
|
17222
|
+
".dkg-detail-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:11px;color:var(--dsw-alias-label-tertiary);word-break:break-all;}",
|
|
17223
|
+
".dkg-sha{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--dk-accent);}",
|
|
17224
|
+
".dkg-detail-msg{margin:0;font-size:11px;line-height:1.55;color:var(--dsw-alias-label-secondary);white-space:pre-wrap;word-break:break-word;max-height:120px;overflow:auto;background:var(--dsw-alias-bg-layer-2);border-radius:6px;padding:6px 8px;}",
|
|
17225
|
+
".dkg-detail-split{display:flex;gap:6px;min-height:0;}",
|
|
17226
|
+
".dkg-compact .dkg-detail-split{flex-direction:column;}",
|
|
17227
|
+
".dkg-diffs{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px;}",
|
|
17228
|
+
".dkg-tree{flex:none;width:150px;max-height:280px;overflow:auto;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;padding:3px;display:flex;flex-direction:column;gap:1px;}",
|
|
17229
|
+
".dkg-compact .dkg-tree{width:auto;max-height:110px;flex-direction:row;flex-wrap:wrap;}",
|
|
17230
|
+
".dkg-tree-row{display:flex;align-items:center;gap:5px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:11px;color:var(--dsw-alias-label-secondary);background:transparent;border:0;border-radius:5px;padding:1px 4px;min-width:0;}",
|
|
17231
|
+
".dkg-tree-row:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17232
|
+
".dkg-tree-row.file.on{background:var(--dk-accent-soft);color:var(--dk-accent);}",
|
|
17233
|
+
".dkg-tree-row.dir{color:var(--dsw-alias-label-tertiary);}",
|
|
17234
|
+
".dkg-tree-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17235
|
+
".dkg-file{border:1px solid var(--dsw-alias-border-l1);border-radius:6px;overflow:hidden;background:var(--dsw-alias-bg-layer-2);}",
|
|
17236
|
+
".dkg-file-head{display:flex;align-items:center;gap:6px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:11px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:0;padding:4px 6px;min-width:0;}",
|
|
17237
|
+
".dkg-file-head:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17238
|
+
".dkg-file-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;}",
|
|
17239
|
+
".dkg-file-old{font-size:10px;color:var(--dsw-alias-label-tertiary);max-width:30%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17240
|
+
".dkg-caret{flex:none;font-size:9px;color:var(--dsw-alias-label-tertiary);width:10px;}",
|
|
17241
|
+
".dkg-tag{flex:none;font-size:10px;border-radius:999px;padding:0 6px;color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);}",
|
|
17242
|
+
".dkg-tag.added{color:var(--dsw-alias-state-success-primary);border-color:currentColor;}",
|
|
17243
|
+
".dkg-tag.deleted{color:var(--dsw-alias-state-error-primary);border-color:currentColor;}",
|
|
17244
|
+
".dkg-add{color:var(--dsw-alias-state-success-primary);flex:none;font-size:11px;}",
|
|
17245
|
+
".dkg-del{color:var(--dsw-alias-state-error-primary);flex:none;font-size:11px;}",
|
|
17246
|
+
".dkg-diff{max-height:320px;overflow:auto;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.5;}",
|
|
17247
|
+
".dkg-hunk-head{color:var(--dk-accent);background:color-mix(in srgb,var(--dk-accent) 8%,transparent);padding:2px 6px;font-size:10px;white-space:pre;}",
|
|
17248
|
+
".dkg-line{display:flex;align-items:flex-start;gap:0;white-space:pre;}",
|
|
17249
|
+
".dkg-line.add{background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 12%,transparent);}",
|
|
17250
|
+
".dkg-line.del{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 12%,transparent);}",
|
|
17251
|
+
".dkg-ln{flex:none;width:34px;text-align:right;padding-right:5px;color:var(--dsw-alias-label-tertiary);user-select:none;}",
|
|
17252
|
+
".dkg-sign{flex:none;width:10px;color:var(--dsw-alias-label-tertiary);}",
|
|
17253
|
+
".dkg-code{flex:1;min-width:0;overflow-x:auto;color:var(--dsw-alias-label-primary);}",
|
|
17254
|
+
".dkg-wt{display:flex;gap:6px;min-height:0;flex:1;overflow:hidden;}",
|
|
17255
|
+
".dkg-compact .dkg-wt{flex-direction:column;}",
|
|
17256
|
+
".dkg-wt-files{flex:1 1 48%;min-width:0;overflow:auto;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);padding:6px;display:flex;flex-direction:column;gap:6px;}",
|
|
17257
|
+
".dkg-compact .dkg-wt-files{max-height:44%;}",
|
|
17258
|
+
".dkg-wt-group{display:flex;flex-direction:column;gap:1px;}",
|
|
17259
|
+
".dkg-wt-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 4px;border-bottom:1px solid var(--dsw-alias-border-l1);margin-bottom:2px;}",
|
|
17260
|
+
".dkg-wt-empty{padding-left:22px;font-size:11px;}",
|
|
17261
|
+
".dkg-wt-item{display:flex;align-items:center;gap:6px;padding:2px 5px;border-radius:5px;cursor:pointer;font-size:12px;min-width:0;color:var(--dsw-alias-label-secondary);}",
|
|
17262
|
+
".dkg-wt-item:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17263
|
+
".dkg-wt-item.on{background:var(--dk-accent-soft);}",
|
|
17264
|
+
".dkg-wt-code{flex:none;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:var(--dk-warn);width:20px;}",
|
|
17265
|
+
".dkg-wt-actions{flex:none;}",
|
|
17266
|
+
".dkg-wt-commit{flex:1 1 52%;min-width:0;display:flex;flex-direction:column;gap:6px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);padding:6px;overflow:auto;}",
|
|
17267
|
+
".dkg-textarea{width:100%;box-sizing:border-box;font-family:inherit;font-size:12px;line-height:1.55;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:6px 8px;resize:vertical;}",
|
|
17268
|
+
".dkg-textarea:focus{outline:none;border-color:var(--dk-accent);}",
|
|
17269
|
+
".dkg-wt-actions{display:flex;gap:5px;flex-wrap:wrap;}",
|
|
17270
|
+
".dkg-preview{border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;display:flex;flex-direction:column;gap:5px;}",
|
|
17271
|
+
".dkg-preview-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:var(--dsw-alias-label-primary);}",
|
|
17272
|
+
// 目录浏览器
|
|
17273
|
+
".dkg-picker{display:flex;flex-direction:column;gap:6px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);padding:8px;max-height:340px;overflow:hidden;}",
|
|
17274
|
+
".dkg-picker-head{display:flex;align-items:center;justify-content:space-between;gap:8px;}",
|
|
17275
|
+
".dkg-picker-title{font-size:12px;font-weight:600;color:var(--dsw-alias-label-primary);}",
|
|
17276
|
+
".dkg-crumbs{display:flex;align-items:center;gap:2px;flex-wrap:wrap;font-size:11px;max-height:48px;overflow:auto;}",
|
|
17277
|
+
".dkg-crumb{cursor:pointer;font-family:inherit;font-size:11px;color:var(--dk-accent);background:transparent;border:0;padding:1px 4px;border-radius:4px;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17278
|
+
".dkg-crumb:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17279
|
+
".dkg-crumb.on{color:var(--dsw-alias-label-primary);font-weight:600;}",
|
|
17280
|
+
".dkg-picker-bar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}",
|
|
17281
|
+
".dkg-picker-list{flex:1;min-height:80px;overflow:auto;display:flex;flex-direction:column;gap:1px;}",
|
|
17282
|
+
".dkg-picker-row{display:flex;align-items:center;gap:6px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:transparent;border:1px solid transparent;border-radius:6px;padding:3px 6px;min-width:0;}",
|
|
17283
|
+
".dkg-picker-row:hover{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-border-l1);}",
|
|
17284
|
+
".dkg-folder{flex:none;font-size:10px;color:var(--dk-warn);}",
|
|
17285
|
+
".dkg-picker-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;}"
|
|
17286
|
+
].join("\n");
|
|
17287
|
+
function serviceOf2(scope, name) {
|
|
17288
|
+
if (!scope) return void 0;
|
|
17289
|
+
try {
|
|
17290
|
+
if (typeof scope.get === "function") {
|
|
17291
|
+
const viaGet = scope.get(name);
|
|
17292
|
+
if (viaGet !== void 0) return viaGet;
|
|
17293
|
+
}
|
|
17294
|
+
} catch {
|
|
17295
|
+
}
|
|
17296
|
+
try {
|
|
17297
|
+
return scope[name];
|
|
17298
|
+
} catch {
|
|
17299
|
+
return void 0;
|
|
17300
|
+
}
|
|
17301
|
+
}
|
|
17302
|
+
function onServices2(ctx, names, run) {
|
|
17303
|
+
if (typeof ctx.inject === "function") {
|
|
17304
|
+
try {
|
|
17305
|
+
ctx.inject(names, (scope) => run(scope));
|
|
17306
|
+
return;
|
|
17307
|
+
} catch (e) {
|
|
17308
|
+
}
|
|
17309
|
+
}
|
|
17310
|
+
run(ctx);
|
|
17311
|
+
}
|
|
17312
|
+
function gitPanelEnabled() {
|
|
17313
|
+
try {
|
|
17314
|
+
const state = stateOf("dshtools");
|
|
17315
|
+
if (!state || state.enabled !== true) return false;
|
|
17316
|
+
return valueOf("interface", "gitPanel") === true;
|
|
17317
|
+
} catch {
|
|
17318
|
+
return false;
|
|
17319
|
+
}
|
|
17320
|
+
}
|
|
17321
|
+
async function resolveTarget(path) {
|
|
17322
|
+
try {
|
|
17323
|
+
const data = await rpc2("resolve", { path });
|
|
17324
|
+
return data && data.repo ? data : null;
|
|
17325
|
+
} catch {
|
|
17326
|
+
return null;
|
|
17327
|
+
}
|
|
17328
|
+
}
|
|
17329
|
+
function openGit(ctx, target) {
|
|
17330
|
+
try {
|
|
17331
|
+
const sidebar = serviceOf2(ctx, "sidebarRight");
|
|
17332
|
+
if (!sidebar) return false;
|
|
17333
|
+
const params = {};
|
|
17334
|
+
if (target && target.repo) params.repo = target.repo;
|
|
17335
|
+
if (target && target.path) params.path = target.path;
|
|
17336
|
+
if (target && target.sessionId && typeof sidebar.openTabIn === "function") {
|
|
17337
|
+
sidebar.openTabIn(target.sessionId, GIT_TAB_KIND, { params });
|
|
17338
|
+
} else if (typeof sidebar.openTab === "function") {
|
|
17339
|
+
sidebar.openTab(GIT_TAB_KIND, { params });
|
|
17340
|
+
} else {
|
|
17341
|
+
return false;
|
|
17342
|
+
}
|
|
17343
|
+
return true;
|
|
17344
|
+
} catch {
|
|
17345
|
+
return false;
|
|
17346
|
+
}
|
|
17347
|
+
}
|
|
17348
|
+
function installClient2(ctx) {
|
|
17349
|
+
if (!ctx || typeof ctx !== "object") return;
|
|
17350
|
+
dockCtx = ctx;
|
|
17351
|
+
try {
|
|
17352
|
+
ensureLoaded();
|
|
17353
|
+
} catch {
|
|
17354
|
+
}
|
|
17355
|
+
onServices2(ctx, ["sidebarRightTabs", "slots"], (scope) => {
|
|
17356
|
+
const tabs = serviceOf2(scope, "sidebarRightTabs");
|
|
17357
|
+
const slots = serviceOf2(scope, "slots");
|
|
17358
|
+
if (!tabs || typeof tabs.register !== "function") return;
|
|
17359
|
+
if (!slots || typeof slots.inject !== "function" || typeof slots.register !== "function") return;
|
|
17360
|
+
const register = () => {
|
|
17361
|
+
const disposers = [];
|
|
17362
|
+
disposers.push(tabs.register({
|
|
17363
|
+
id: GIT_TAB_ID,
|
|
17364
|
+
kind: GIT_TAB_KIND,
|
|
17365
|
+
priority: "extension",
|
|
17366
|
+
// 页签标题与引导卡片统一叫「Git仓库操作」:只写 Git 会被当成 Git 客户端/工具入口,
|
|
17367
|
+
// 这个名字说明它是「对仓库做操作」的面板。
|
|
17368
|
+
title: () => GIT_PANEL_NAME,
|
|
17369
|
+
guide: [{
|
|
17370
|
+
id: "git",
|
|
17371
|
+
order: 40,
|
|
17372
|
+
title: () => GIT_PANEL_NAME,
|
|
17373
|
+
description: () => "\u67E5\u770B\u5F53\u524D\u76EE\u5F55\u7684\u63D0\u4EA4\u5386\u53F2\u4E0E\u5DE5\u4F5C\u533A\uFF0C\u652F\u6301\u63D0\u4EA4\u4E0E\u63A8\u9001",
|
|
17374
|
+
icon: GitGuideArtwork
|
|
17375
|
+
}]
|
|
17376
|
+
}));
|
|
17377
|
+
disposers.push(slots.inject("sidebar.right.pane.tab", () => slots.register(
|
|
17378
|
+
{ name: "sidebar.right.pane.tab", key: GIT_TAB_ID },
|
|
17379
|
+
GitTabBody
|
|
17380
|
+
)));
|
|
17381
|
+
disposers.push(slots.inject("sidebar.right.pane.tab.title", () => slots.register(
|
|
17382
|
+
{ name: "sidebar.right.pane.tab.title", key: GIT_TAB_ID },
|
|
17383
|
+
GitTabTitle
|
|
17384
|
+
)));
|
|
17385
|
+
return () => {
|
|
17386
|
+
for (const dispose of disposers) {
|
|
17387
|
+
try {
|
|
17388
|
+
dispose();
|
|
17389
|
+
} catch {
|
|
17390
|
+
}
|
|
17391
|
+
}
|
|
17392
|
+
};
|
|
17393
|
+
};
|
|
17394
|
+
if (typeof scope.effect === "function") scope.effect(register, "dsh-dock: Git \u62BD\u5C49\u9875\u7B7E");
|
|
17395
|
+
else register();
|
|
17396
|
+
});
|
|
17397
|
+
onServices2(ctx, ["slots"], (scope) => {
|
|
17398
|
+
const slots = serviceOf2(scope, "slots");
|
|
17399
|
+
if (!slots || typeof slots.inject !== "function" || typeof slots.register !== "function") return;
|
|
17400
|
+
const register = () => {
|
|
17401
|
+
const disposers = [];
|
|
17402
|
+
disposers.push(slots.inject("contextMenu.icon", function* () {
|
|
17403
|
+
yield slots.register({ name: "contextMenu.icon", key: GIT_ICON_KEY }, GitHistoryIcon);
|
|
17404
|
+
}));
|
|
17405
|
+
return () => {
|
|
17406
|
+
for (const dispose of disposers) {
|
|
17407
|
+
try {
|
|
17408
|
+
dispose();
|
|
17409
|
+
} catch {
|
|
17410
|
+
}
|
|
17411
|
+
}
|
|
17412
|
+
};
|
|
17413
|
+
};
|
|
17414
|
+
if (typeof scope.effect === "function") scope.effect(register, "dsh-dock: Git \u83DC\u5355\u56FE\u6807");
|
|
17415
|
+
else register();
|
|
17416
|
+
});
|
|
17417
|
+
onServices2(ctx, ["contextMenus", "sidebarRight"], (scope) => {
|
|
17418
|
+
const menus = serviceOf2(scope, "contextMenus");
|
|
17419
|
+
if (!menus || typeof menus.register !== "function") return;
|
|
17420
|
+
const makeResolve = (kind) => async (target, signal) => {
|
|
17421
|
+
if (!gitPanelEnabled()) return [];
|
|
17422
|
+
const resolved = await resolveTarget(target.path);
|
|
17423
|
+
if (signal && typeof signal.throwIfAborted === "function") signal.throwIfAborted();
|
|
17424
|
+
if (!resolved) return [];
|
|
17425
|
+
return [{
|
|
17426
|
+
id: "git-history",
|
|
17427
|
+
label: kind === "directory" ? "\u67E5\u770B Git \u5386\u53F2" : "\u67E5\u770B\u8BE5\u6587\u4EF6\u7684 Git \u5386\u53F2",
|
|
17428
|
+
icon: { key: GIT_ICON_KEY },
|
|
17429
|
+
// run 绝不抛错:抛了 ui-context-menu 只会弹「操作失败,请重试」,把真实原因盖掉。
|
|
17430
|
+
// 打不开时自己用菜单的通知通道说清楚原因。
|
|
17431
|
+
run: () => {
|
|
17432
|
+
const ok = openGit(scope, {
|
|
17433
|
+
repo: resolved.repo,
|
|
17434
|
+
path: resolved.relPath === "." ? "" : resolved.relPath,
|
|
17435
|
+
sessionId: target.sessionId
|
|
17436
|
+
});
|
|
17437
|
+
if (!ok) {
|
|
17438
|
+
try {
|
|
17439
|
+
menus.notify("Git \u9762\u677F\u672A\u5C31\u7EEA\uFF1A\u8BF7\u786E\u8BA4\u300CDSH\u529F\u80FD \u2192 \u754C\u9762\u589E\u5F3A \u2192 Git \u7BA1\u7406\u9762\u677F\u300D\u5DF2\u6253\u5F00\uFF0C\u5E76\u91CD\u542F\u8FC7 dsh web", false);
|
|
17440
|
+
} catch {
|
|
17441
|
+
}
|
|
17442
|
+
}
|
|
17443
|
+
}
|
|
17444
|
+
}];
|
|
17445
|
+
};
|
|
17446
|
+
const register = () => {
|
|
17447
|
+
const disposers = [
|
|
17448
|
+
menus.register({ id: "dsh-dock.git.directory", target: "directory", order: 220, resolve: makeResolve("directory") }),
|
|
17449
|
+
menus.register({ id: "dsh-dock.git.file", target: "file", order: 220, resolve: makeResolve("file") })
|
|
17450
|
+
];
|
|
17451
|
+
return () => {
|
|
17452
|
+
for (const dispose of disposers) {
|
|
17453
|
+
try {
|
|
17454
|
+
dispose();
|
|
17455
|
+
} catch {
|
|
17456
|
+
}
|
|
17457
|
+
}
|
|
17458
|
+
};
|
|
17459
|
+
};
|
|
17460
|
+
if (typeof scope.effect === "function") scope.effect(register, "dsh-dock: Git \u53F3\u952E\u5165\u53E3");
|
|
17461
|
+
else register();
|
|
17462
|
+
});
|
|
17463
|
+
}
|
|
17464
|
+
function GitGuideArtwork({ size = 36, className } = {}) {
|
|
17465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { width: size, height: size, className, "aria-hidden": "true", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
17466
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "11", cy: "8", r: "3", stroke: "#F97316", strokeWidth: "2" }),
|
|
17467
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "11", cy: "28", r: "3", stroke: "#F97316", strokeWidth: "2" }),
|
|
17468
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "25", cy: "18", r: "3", stroke: "#F97316", strokeWidth: "2" }),
|
|
17469
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M11 11v14", stroke: "#F97316", strokeWidth: "2", strokeLinecap: "square" }),
|
|
17470
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M14 8h4a4 4 0 0 1 4 4v2M14 28h4a4 4 0 0 0 4-4v-2", stroke: "#F97316", strokeWidth: "2", strokeLinecap: "square" })
|
|
17471
|
+
] });
|
|
17472
|
+
}
|
|
17473
|
+
function GitHistoryIcon() {
|
|
17474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
17475
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "4", cy: "3.5", r: "1.6", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
17476
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "4", cy: "12.5", r: "1.6", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
17477
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "12", cy: "8", r: "1.6", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
17478
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M4 5.1v5.8M5.6 3.5h2.6a2.2 2.2 0 0 1 2.2 2.2v.7M5.6 12.5h2.6a2.2 2.2 0 0 0 2.2-2.2v-.7", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
|
|
17479
|
+
] });
|
|
17480
|
+
}
|
|
17481
|
+
|
|
17482
|
+
// src/client.jsx
|
|
17483
|
+
var DOCK_VERSION = "0.25.0";
|
|
17484
|
+
var BUILTIN_FEATURES = [feature, feature2, feature3, feature11, feature4, feature5, feature6, feature7, feature8, feature9, feature10, feature12];
|
|
17485
|
+
var PLANNED_FEATURES = [];
|
|
17486
|
+
var PLANNED_NOTES = {};
|
|
17487
|
+
var externalDefs = [];
|
|
17488
|
+
var externalListeners = /* @__PURE__ */ new Set();
|
|
17489
|
+
function notifyExternal() {
|
|
17490
|
+
for (const fn of externalListeners) fn();
|
|
17491
|
+
}
|
|
17492
|
+
var dockBridge = {
|
|
17493
|
+
version: DOCK_VERSION,
|
|
17494
|
+
register(def) {
|
|
17495
|
+
if (!def || typeof def !== "object" || typeof def.id !== "string" || !def.id || typeof def.View !== "function") {
|
|
17496
|
+
console.error("[dsh-dock] dockBridge.register \u53C2\u6570\u4E0D\u7B26\uFF08\u9700 { id, name, View }\uFF09:", def);
|
|
17497
|
+
return () => {
|
|
17498
|
+
};
|
|
17499
|
+
}
|
|
17500
|
+
const entry = {
|
|
17501
|
+
id: def.id,
|
|
17502
|
+
name: String(def.name || def.id),
|
|
17503
|
+
order: typeof def.order === "number" ? def.order : 500,
|
|
17504
|
+
accent: typeof def.accent === "string" ? def.accent : "#94a3b8",
|
|
17505
|
+
description: String(def.description || ""),
|
|
17506
|
+
css: typeof def.css === "string" ? def.css : "",
|
|
17507
|
+
View: def.View,
|
|
17508
|
+
HomeStat: typeof def.HomeStat === "function" ? def.HomeStat : null,
|
|
17509
|
+
Overlay: typeof def.Overlay === "function" ? def.Overlay : null,
|
|
17510
|
+
external: true,
|
|
17511
|
+
package: typeof def.package === "string" ? def.package : ""
|
|
17512
|
+
};
|
|
17513
|
+
const i = externalDefs.findIndex((x) => x.id === entry.id);
|
|
17514
|
+
if (i >= 0) externalDefs[i] = entry;
|
|
17515
|
+
else externalDefs.push(entry);
|
|
17516
|
+
if (entry.css) ensureCss();
|
|
17517
|
+
notifyExternal();
|
|
17518
|
+
return () => {
|
|
17519
|
+
const j = externalDefs.indexOf(entry);
|
|
17520
|
+
if (j >= 0) {
|
|
17521
|
+
externalDefs.splice(j, 1);
|
|
17522
|
+
notifyExternal();
|
|
17523
|
+
}
|
|
17524
|
+
};
|
|
17525
|
+
},
|
|
17526
|
+
features() {
|
|
17527
|
+
return externalDefs.map((x) => Object.assign({}, x));
|
|
17528
|
+
}
|
|
17529
|
+
};
|
|
17530
|
+
function allModules() {
|
|
17531
|
+
return BUILTIN_FEATURES.concat(PLANNED_FEATURES, externalDefs).slice().sort((a, b) => (a.order || 500) - (b.order || 500));
|
|
17532
|
+
}
|
|
17533
|
+
var SHELL_CSS = [
|
|
17534
|
+
// ---- 主题桥接层(亮色适配的根基)----
|
|
17535
|
+
// dsh 宿主没有 --dsw-alias-accent,也没有 --dsw-alias-state-warning-primary(正确名是 state-warn-primary),
|
|
17536
|
+
// 旧写法全部落到暗色系回退值(浅蓝/琥珀),亮色白底下看不清。这里在 body 上按宿主主题
|
|
17537
|
+
// (body / body[data-ds-dark-theme])声明两套 dock 语义变量,各模块统一引用:
|
|
17538
|
+
// --dk-accent 主强调色(亮色用深蓝保证对比度,暗色用亮蓝)
|
|
17539
|
+
// --dk-warn 警告色(亮色用深琥珀,暗色用亮琥珀)
|
|
17540
|
+
// --dk-ok/--dk-err 成功/错误(亮色取宿主深色值,暗色保持宿主亮色值)
|
|
17541
|
+
// --dk-tdim 表格分隔线/弱边框(亮色用中性灰蓝、暗色用白透明)
|
|
17542
|
+
"body{--dk-accent:#2f6fed;--dk-accent-soft:color-mix(in srgb,#2f6fed 12%,transparent);--dk-warn:#b45309;--dk-ok:var(--dsw-alias-state-success-primary,#16a34a);--dk-err:var(--dsw-alias-state-error-primary,#dc2626);--dk-tdim:rgba(100,116,139,.22);--dk-hover-tint:rgba(47,111,237,.08);--dk-games-accent:#7c3aed;}",
|
|
17543
|
+
"body[data-ds-dark-theme]{--dk-accent:#4d9fff;--dk-accent-soft:color-mix(in srgb,#4d9fff 12%,transparent);--dk-warn:#fbbf24;--dk-ok:var(--dsw-alias-state-success-primary,#34d399);--dk-err:var(--dsw-alias-state-error-primary,#f87171);--dk-tdim:rgba(122,132,152,.14);--dk-hover-tint:rgba(80,110,180,.12);--dk-games-accent:#a78bfa;}",
|
|
17544
|
+
// 宿主语义变量兜底别名(部分模块引用了宿主不存在的名字,统一在此补齐,取值随主题自动切换)
|
|
17545
|
+
"body{--dsw-alias-accent:var(--dk-accent);--dsw-alias-accent-soft:var(--dk-accent-soft);--dsw-alias-state-warning-primary:var(--dk-warn);}",
|
|
17546
|
+
".dock-root{display:flex;flex-direction:column;gap:12px;padding:4px 0;color:var(--dsw-alias-label-primary);font-size:13px;}",
|
|
17547
|
+
".dock-intro{color:var(--dsw-alias-label-secondary);line-height:1.6;}",
|
|
17548
|
+
".dock-card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:12px 14px;display:flex;flex-direction:column;gap:8px;}",
|
|
17549
|
+
".dock-card-head{display:flex;align-items:center;gap:8px;}",
|
|
17550
|
+
".dock-dot{width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-secondary);flex:none;}",
|
|
17551
|
+
".dock-dot.on{background:var(--dsw-alias-state-success-primary);}",
|
|
17552
|
+
".dock-dot.err{background:var(--dsw-alias-state-error-primary);}",
|
|
17553
|
+
".dock-name{font-weight:600;flex:none;}",
|
|
17554
|
+
".dock-desc{color:var(--dsw-alias-label-secondary);flex:1;}",
|
|
17555
|
+
".dock-switch{flex:none;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:3px 10px;cursor:pointer;font-size:12px;}",
|
|
17556
|
+
".dock-switch.on{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary);}",
|
|
17557
|
+
".dock-badge{flex:none;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:3px 10px;font-size:12px;}",
|
|
17558
|
+
".dock-body{border-top:1px solid var(--dsw-alias-border-l1);padding-top:8px;color:var(--dsw-alias-label-secondary);display:flex;flex-direction:column;gap:4px;}",
|
|
17559
|
+
// 侧栏入口按钮(docke2- 前缀)+ 功能坞弹出面板(dockm- 前缀,仿 dsh 设置的居中模态:遮罩 + 对话框,左导航 + 右内容)
|
|
17560
|
+
// 侧栏入口按钮(docke2- 前缀):与 dsh 设置按钮(.VOzbGW_trigger)几何逐条对齐——
|
|
17561
|
+
// 宽栏同为整宽左对齐行按钮(高 42、margin 4/-2、padding 0 10px 0 8px、圆角 12),窄栏同为 36 圆钮居中,
|
|
17562
|
+
// 使两按钮上下成列、左右边缘完全对齐(此前右对齐/叠放都会错位)。
|
|
17563
|
+
".docke2-btn{box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;border:none;background:transparent;color:var(--dsw-alias-label-primary);border-radius:12px;width:calc(100% + 4px);height:42px;margin:4px -2px;padding:0 10px 0 8px;font-family:inherit;font-size:14px;line-height:22px;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
|
|
17564
|
+
".docke2-btn:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
17565
|
+
".docke2-btn.docke2-on{color:var(--dk-accent);background:var(--dk-accent-soft);}",
|
|
17566
|
+
".docke2-btn.docke2-rail{width:36px;height:36px;margin:8px 0 10px;padding:0;border-radius:50%;justify-content:center;gap:0;}",
|
|
17567
|
+
".docke2-label{white-space:nowrap;overflow:hidden;}",
|
|
17568
|
+
// 遮罩固定用深色半透明:亮色主题下宿主 bg-layer-1 是纯白,白底遮罩会让弹窗与页面完全无层次
|
|
17569
|
+
".dockm-backdrop{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;background:rgba(15,17,21,.45);backdrop-filter:blur(4px);pointer-events:auto;animation:dockm-fade .15s var(--ds-ease-in-out);}",
|
|
17570
|
+
"@keyframes dockm-fade{from{opacity:0}to{opacity:1}}",
|
|
17571
|
+
".dockm-dialog{box-sizing:border-box;position:relative;width:min(1080px,calc(100vw - 32px));height:min(700px,calc(100vh - 32px));display:flex;flex-direction:column;border-radius:16px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);box-shadow:0 20px 64px rgb(0 0 0 / .32);overflow:hidden;animation:dockm-pop .18s var(--ds-ease-in-out);}",
|
|
17572
|
+
"@keyframes dockm-pop{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}",
|
|
17573
|
+
".dockm-head{flex:none;display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--dsw-alias-border-l1);cursor:move;user-select:none;touch-action:none;}",
|
|
17574
|
+
".dockm-title{font-weight:600;font-size:14px;}",
|
|
17575
|
+
".dockm-sub{color:var(--dsw-alias-label-tertiary);font-size:12px;}",
|
|
17576
|
+
".dockm-ctrls{margin-left:auto;flex:none;display:flex;align-items:center;gap:2px;}",
|
|
17577
|
+
".dockm-close{cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;font-size:14px;}",
|
|
17578
|
+
".dockm-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
17579
|
+
".dockm-win{cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;}",
|
|
17580
|
+
".dockm-win:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
17581
|
+
".dockm-dialog.dockm-max{border-radius:12px;}",
|
|
17582
|
+
".dockm-dialog.dockm-min{height:auto;min-height:0;}",
|
|
17583
|
+
".dockm-dialog.dockm-min .dockm-body{display:none;}",
|
|
17584
|
+
".dockm-resize{position:absolute;right:0;bottom:0;width:16px;height:16px;cursor:nwse-resize;z-index:3;touch-action:none;}",
|
|
17585
|
+
".dockm-body{flex:1;min-height:0;display:flex;}",
|
|
17586
|
+
".dockm-nav{flex:none;width:176px;display:flex;flex-direction:column;gap:2px;padding:10px 8px;overflow-y:auto;border-right:1px solid var(--dsw-alias-border-l1);}",
|
|
17587
|
+
".dockm-nav-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border:none;background:transparent;border-radius:10px;cursor:pointer;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:13px;text-align:left;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
|
|
17588
|
+
".dockm-nav-item:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
17589
|
+
".dockm-nav-item.on{background:var(--dk-accent-soft);color:var(--dsw-alias-label-primary);font-weight:600;}",
|
|
17590
|
+
".dockm-nav-item .dockm-badge{margin-left:auto;}",
|
|
17591
|
+
".dockm-dot{width:8px;height:8px;border-radius:50%;flex:none;}",
|
|
17592
|
+
".dockm-badge{flex:none;font-size:11px;border-radius:999px;padding:0 8px;color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);}",
|
|
17593
|
+
".dockm-content{flex:1;min-width:0;display:flex;flex-direction:column;gap:12px;padding:16px 18px;overflow-y:auto;}",
|
|
17594
|
+
".dockm-content-head{display:flex;flex-direction:column;gap:4px;}",
|
|
17595
|
+
".dockm-name{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px;}",
|
|
17596
|
+
".dockm-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.6;}",
|
|
17597
|
+
".dockm-view{display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px;}",
|
|
17598
|
+
".dockm-page{box-sizing:border-box;height:100%;display:flex;flex-direction:column;overflow:hidden;padding:16px 20px 0;}",
|
|
17599
|
+
".dockm-page-head{flex:none;display:flex;align-items:flex-start;gap:10px;padding-bottom:12px;border-bottom:1px solid var(--dsw-alias-border-l1);}",
|
|
17600
|
+
".dockm-page-body{flex:1;min-height:0;display:flex;}",
|
|
17601
|
+
".dockm-page-wide-btn{flex:none;margin-left:auto;display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:12px;cursor:pointer;}",
|
|
17602
|
+
".dockm-page-wide-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
17603
|
+
/* 面板页的左侧菜单收窄:给右侧列表/表格让出宽度,别留大片空白 */
|
|
17604
|
+
// 左侧菜单列:内容只有 8px 圆点 + 4 字标签,140px 会留一大条空白(用户反馈「这个宽度可以缩小点」)。
|
|
17605
|
+
// 用 border-box 收到 110px(含内距):既够放最长标签「MCP管理 / 远程访问」,又把右侧死区收掉,正文区更宽。
|
|
17606
|
+
".dockm-page .dockm-nav{box-sizing:border-box;width:110px;padding:8px 7px;}",
|
|
17607
|
+
".dockm-page .dockm-nav-item{padding:7px 8px;font-size:12.5px;gap:6px;overflow:hidden;}",
|
|
17608
|
+
".dockm-page-body>.dockm-body{flex:1;min-height:0;}",
|
|
17609
|
+
".dockm-page-icon{flex:none;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);}",
|
|
17610
|
+
".dockm-page-titles{min-width:0;}",
|
|
17611
|
+
".dockm-page-title{font-size:17px;font-weight:600;color:var(--dsw-alias-label-primary);line-height:1.3;}",
|
|
17612
|
+
".dockm-page-sub{font-size:12px;color:var(--dsw-alias-label-tertiary);margin-top:2px;}",
|
|
17613
|
+
".dockm-note{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.6;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px;}",
|
|
17614
|
+
".dockm-err{color:var(--dsw-alias-state-error-primary);}",
|
|
17615
|
+
".dockm-foot{margin-top:auto;display:flex;align-items:center;gap:8px;color:var(--dsw-alias-label-tertiary);font-size:11px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px;flex-wrap:wrap;}",
|
|
17616
|
+
".dockm-switch{cursor:pointer;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:4px 12px;font-family:inherit;font-size:12px;margin-left:auto;}",
|
|
17617
|
+
".dockm-switch:hover{color:var(--dsw-alias-label-primary);}",
|
|
17618
|
+
".dockm-switch.on{color:var(--dsw-alias-state-success-primary);border-color:currentColor;}",
|
|
17619
|
+
// 首页总揽(dockh- 前缀):导航首项图标 + 模块卡片网格
|
|
17620
|
+
".dockm-navhome{display:inline-flex;align-items:center;color:var(--dk-accent);flex:none;}",
|
|
17621
|
+
".dockh-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;}",
|
|
17622
|
+
".dockh-card{display:flex;flex-direction:column;gap:6px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:10px 12px;cursor:pointer;transition:border-color .15s var(--ds-ease-in-out);}",
|
|
17623
|
+
".dockh-card:hover,.dockh-card:focus-visible{border-color:var(--dk-accent);outline:none;}",
|
|
17624
|
+
".dockh-head{display:flex;align-items:center;gap:8px;}",
|
|
17625
|
+
".dockh-name{font-weight:600;flex:none;}",
|
|
17626
|
+
".dockh-badge{flex:none;font-size:11px;border-radius:999px;padding:0 8px;color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);}",
|
|
17627
|
+
// 状态标识(非交互:圆点+文字,与可点的开关一眼区分)
|
|
17628
|
+
".dockh-status{margin-left:auto;flex:none;display:inline-flex;align-items:center;gap:5px;font-size:11px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;}",
|
|
17629
|
+
".dockh-sdot{width:7px;height:7px;border-radius:50%;flex:none;background:var(--dsw-alias-state-success-primary,#34d399);box-shadow:0 0 4px color-mix(in srgb,var(--dsw-alias-state-success-primary,#34d399) 55%,transparent);}",
|
|
17630
|
+
".dockh-status.off .dockh-sdot{background:transparent;border:1.5px solid var(--dsw-alias-label-tertiary);box-shadow:none;opacity:.75;}",
|
|
17631
|
+
".dockh-status.plan .dockh-sdot{background:transparent;border:1.5px dashed var(--dsw-alias-label-tertiary);box-shadow:none;}",
|
|
17632
|
+
// iOS 风滑动开关(首页卡片 / 弹层页脚 / 设置页共用的启停控件)
|
|
17633
|
+
".dock-sw{flex:none;position:relative;width:34px;height:19px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);cursor:pointer;padding:0;transition:background .18s var(--ds-ease-in-out),border-color .18s var(--ds-ease-in-out);}",
|
|
17634
|
+
'.dock-sw::after{content:"";position:absolute;top:2px;left:2px;width:13px;height:13px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgb(0 0 0 / .35);transition:transform .18s var(--ds-ease-in-out);}',
|
|
17635
|
+
".dock-sw:hover{border-color:var(--dk-accent);}",
|
|
17636
|
+
".dock-sw.on{background:var(--dsw-alias-state-success-primary,#34d399);border-color:transparent;}",
|
|
17637
|
+
".dock-sw.on::after{transform:translateX(15px);}",
|
|
17638
|
+
// 弹层页脚:文字标签 + 开关 成组
|
|
17639
|
+
".dockm-foot-sw{margin-left:auto;flex:none;display:inline-flex;align-items:center;gap:8px;}",
|
|
17640
|
+
".dockm-foot-swlabel{font-size:11px;color:var(--dsw-alias-label-tertiary);}",
|
|
17641
|
+
".dockm-foot-swlabel.on{color:var(--dsw-alias-state-success-primary);}",
|
|
17642
|
+
// 窄屏:功能坞是一级工作台而不是被压扁的桌面弹窗。全屏承接安全区,导航改横向,
|
|
17643
|
+
// 禁用桌面拖拽/缩放,所有导航和关闭动作保持至少 44px 的可点击面积。
|
|
17644
|
+
"@media (max-width:680px){.dockm-backdrop{align-items:stretch;justify-content:stretch;background:var(--dsw-alias-bg-layer-2);backdrop-filter:none}.dockm-dialog,.dockm-dialog.dockm-max{position:fixed!important;left:0!important;top:0!important;right:auto!important;bottom:auto!important;width:100dvw!important;height:100dvh!important;min-height:100dvh;border:0;border-radius:0;box-shadow:none}.dockm-dialog.dockm-min .dockm-body{display:flex}.dockm-head{min-height:60px;box-sizing:border-box;padding:calc(env(safe-area-inset-top) + 8px) 12px 8px;cursor:default;touch-action:manipulation}.dockm-sub,.dockm-win,.dockm-resize{display:none}.dockm-title{font-size:16px}.dockm-close{width:44px;height:44px;font-size:17px}.dockm-body{flex-direction:column;min-height:0}.dockm-nav{box-sizing:border-box;width:auto;max-width:100%;min-height:56px;flex-direction:row;gap:6px;padding:6px 10px;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none;overscroll-behavior-x:contain}.dockm-nav::-webkit-scrollbar{display:none}.dockm-nav-item{flex:none;min-height:44px;padding:0 12px;font-size:13px;touch-action:manipulation}.dockm-nav-item .dockm-badge{display:none}.dockm-content{padding:16px max(16px,env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));gap:14px;overscroll-behavior:contain}.dockm-content-head{gap:5px}.dockm-name{font-size:16px}.dockm-desc{font-size:13px;line-height:1.55}.dockm-foot{padding-top:12px;font-size:11px}.dockm-foot-sw{width:100%;margin-left:0;justify-content:space-between}.dock-sw{width:44px;height:26px}.dock-sw::after{top:3px;left:3px;width:18px;height:18px}.dock-sw.on::after{transform:translateX(18px)}.dockh-grid{grid-template-columns:minmax(0,1fr);gap:10px;min-width:0}.dockh-card{padding:12px;box-sizing:border-box;min-width:0}.dockh-desc{font-size:13px}.dockh-go{font-size:12px}}",
|
|
17645
|
+
/* 手机端:功能坞弹层挂在 .overlayLayer(z20) 内,会被 z71 的侧栏抽屉盖住(只剩右侧一条)。\n 把 overlayLayer 在窄屏抬到抽屉之上,面板才能全屏覆盖——且不依赖【手机适配】模块是否启用。 */
|
|
17646
|
+
/* 只在「功能坞弹层真的打开」时抬 z 序(:has 精确到 .dockm-dialog),其余时候不碰 DSH 原生浮层 */
|
|
17647
|
+
'@media (max-width:767px){body:has(.dockm-dialog) [class*="overlayLayer"]{z-index:100 !important}}',
|
|
17648
|
+
/* 手机:功能坞面板页的左侧菜单改成横向可滚动条,占满整行;页头与内边距收紧,「全屏」按钮在手机上无意义(侧栏本就是抽屉)故隐藏 */
|
|
17649
|
+
"@media (max-width:767px){.dockm-page{padding:12px 12px 0}.dockm-page-head{gap:8px;padding-bottom:10px}.dockm-page-sub{display:none}.dockm-page-wide-btn{display:none}.dockm-page .dockm-nav{width:auto;max-width:100%;flex-direction:row;gap:6px;padding:8px 0;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none}.dockm-page .dockm-nav::-webkit-scrollbar{display:none}.dockm-page .dockm-nav-item{flex:none;min-height:40px;padding:0 10px;font-size:12.5px}.dockm-page .dockm-page-body{flex-direction:column}.dockm-page .dockm-body{flex-direction:column;min-height:0}.dockm-page .dockm-content{padding:12px 0 16px;gap:12px}}",
|
|
17650
|
+
/* 手机自适应(≤767px,始终生效,不依赖任何功能开关):
|
|
17651
|
+
· 输入卡贴底(空会话时不再垂直居中留大片空白);
|
|
17652
|
+
· 输入卡里的「轮/步/token/缓存」状态条移到输入框上方,压成一行不溢出。 */
|
|
17653
|
+
'@media (max-width:767px){[class*="scrollBody"]>[class*="composerSeat"]{margin-top:auto!important;padding-bottom:0!important}[class*="composerSeat"] [class*="_dock"]{order:-1!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important;padding:0 2px 6px!important;gap:6px!important;font-size:10px!important;overflow:hidden!important;flex-wrap:nowrap!important;white-space:nowrap!important}[class*="composerSeat"] [class*="_dock"]>*{min-width:0;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[class*="composerSeat"] [class*="_dock"]>*:first-child{flex:0 0 auto}[class*="composerSeat"] [class*="_row"]{gap:4px!important}}',
|
|
17654
|
+
/* 手机自适应:设置弹层内容给安全区内边距、会话滚动体留底部安全区、代码块横向滚动、
|
|
17655
|
+
行内代码可断行(窄屏不撑破版面)。 */
|
|
17656
|
+
'@media (max-width:767px){[role="dialog"][class*="panel"] [class*="options"]{padding-left:max(16px,env(safe-area-inset-left,0px))!important;padding-right:max(16px,env(safe-area-inset-right,0px))!important}[class*="scrollBody"]{padding-bottom:env(safe-area-inset-bottom,0px)!important}pre{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}code{overflow-wrap:anywhere}pre code{overflow-wrap:normal}}',
|
|
17657
|
+
"@media (prefers-reduced-motion:reduce){.dockm-backdrop,.dockm-dialog{animation:none}.dockm-nav-item,.dockm-close,.dockm-win,.dock-sw{transition:none}}",
|
|
17658
|
+
".dockh-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5;}",
|
|
17659
|
+
".dockh-stat{color:var(--dsw-alias-label-tertiary);font-size:12px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
17660
|
+
".dockh-foot{display:flex;align-items:center;gap:8px;}",
|
|
17661
|
+
".dockh-go{color:var(--dsw-alias-label-tertiary);font-size:11px;}",
|
|
17662
|
+
// 会话输入区工具行 chips(dockchip- 前缀):余额/用量随身小控件,挂在模型选择器左侧
|
|
17663
|
+
// 溢出兼容(两层防护,缺一不可):
|
|
17664
|
+
// 1) 宽度上限:宿主 .row 是 flex-wrap:wrap 且换行优先于收缩,chips 一长 tools 整行变宽,
|
|
17665
|
+
// 右侧模型选择器/发送键被挤到第二行(左右错位)。宿主 .row 带 container-type:inline-size,
|
|
17666
|
+
// 用容器单位 cqw 让上限随输入卡宽度自适应(窄卡少占、宽卡多占);不支持 cqw 的老内核退回固定值。
|
|
17667
|
+
// 注意:旧上限 min(280px,36cqw) 仍偏宽——标准 780px 输入卡下(.row 内容约 762px),
|
|
17668
|
+
// add 钮(28)+工作区选择器(~214)+chips(280) 已与右侧模型选择器+发送键(~345px)合计超宽,
|
|
17669
|
+
// 即便 chips 未截断 .row 也会换行把模型选择器/发送键挤到第二行。实测把上限收到 189px
|
|
17670
|
+
// (≈25cqw)并使 chips 内距收紧(padding 2px 6px、gap 2px)后,「4~6M 用量 + 余额」
|
|
17671
|
+
// 两 chip 可完整显示且不再换行。v0.11.2:配置单价后费用段「· ¥0.03」让两 chip 合计
|
|
17672
|
+
// 约需 204px,189px 恰好截掉约 2 个数字(费用/余额小数位看不到)——按用户反馈放宽到
|
|
17673
|
+
// 216px(≈28cqw),标准卡下实测完整显示;若再出现把模型选择器挤换行,优先压缩用量
|
|
17674
|
+
// chip 的 ⛁ 前缀换空间,别再收这个上限。超限仍省略号截断,完整值在 title 悬浮提示里。
|
|
17675
|
+
// 2) 截断:超限部分用省略号截断(完整数值在 title 悬浮提示里),防 chips 凸出输入卡圆角(悬空)。
|
|
17676
|
+
".dockchip-row{display:inline-flex;align-items:center;gap:2px;min-width:0;flex:0 1 auto;overflow:hidden;max-width:216px;}",
|
|
17677
|
+
"@supports (width:1cqw){.dockchip-row{max-width:min(216px,28cqw);}}",
|
|
17678
|
+
".dockchip{display:inline-flex;align-items:center;gap:5px;cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;padding:2px 6px;font-family:inherit;font-size:11px;line-height:18px;white-space:nowrap;min-width:0;overflow:hidden;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
|
|
17679
|
+
".dockchip > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}",
|
|
17680
|
+
".dockchip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
17681
|
+
".dockchip .dockchip-dot{width:6px;height:6px;border-radius:50%;flex:none;}",
|
|
17682
|
+
".dockchip.err{color:var(--dsw-alias-state-error-primary);}",
|
|
17683
|
+
/* 手机自适应:输入区工具行很窄——chip 字号/内距收紧、隐藏费用后缀与「余额」前缀,
|
|
17684
|
+
数值完整显示且工具行保持单行不换行(完整信息仍在 title 悬浮提示里)。 */
|
|
17685
|
+
".dockchip-pre-s{display:none;}",
|
|
17686
|
+
".dockchip-svg{display:none;align-items:center;justify-content:center;}",
|
|
17687
|
+
/* 手机端:输入区工具行太窄,余额/用量只留两枚小图标(点进功能坞看具体数据),
|
|
17688
|
+
文本与圆点全部隐藏,图标做成 24×24 的稳定触控块 → 工具行必定单行。 */
|
|
17689
|
+
"@media (max-width:767px){.dockchip-row{max-width:min(92px,20cqw);gap:2px}.dockchip-svg{display:inline-flex}.dockchip-val,.dockchip-pre,.dockchip-pre-s,.dockchip-ic,.dockchip-x,.dockchip .dockchip-dot{display:none}.dockchip{width:24px;height:24px;box-sizing:border-box;justify-content:center;padding:0!important;gap:0!important;border-radius:6px}}",
|
|
17690
|
+
/* 手机触控基础:去点按蓝块、消双击缩放判定延迟;原生侧栏开关热区扩到 44×44(视觉不变)。 */
|
|
17691
|
+
`@media (max-width:767px){:is(button,[role="button"]){-webkit-tap-highlight-color:transparent;touch-action:manipulation}[data-sidebar-opener]{position:relative}[data-sidebar-opener]::after{content:'';position:absolute;left:50%;top:50%;width:44px;height:44px;transform:translate(-50%,-50%)}}`
|
|
17692
|
+
].join("\n");
|
|
17693
|
+
var dockCssTag = null;
|
|
17694
|
+
var initialCssSchedule = null;
|
|
17695
|
+
function cancelInitialCssSchedule() {
|
|
17696
|
+
if (!initialCssSchedule || typeof window === "undefined") return;
|
|
17697
|
+
if (initialCssSchedule.type === "idle" && typeof window.cancelIdleCallback === "function") window.cancelIdleCallback(initialCssSchedule.id);
|
|
17698
|
+
if (initialCssSchedule.type === "timer") window.clearTimeout(initialCssSchedule.id);
|
|
17699
|
+
initialCssSchedule = null;
|
|
17700
|
+
}
|
|
17701
|
+
function fullDockCss() {
|
|
17702
|
+
const parts = [SHELL_CSS];
|
|
17703
|
+
for (const f of BUILTIN_FEATURES) if (f.css) parts.push(f.css);
|
|
17704
|
+
if (css6) parts.push(css6);
|
|
17705
|
+
for (const f of externalDefs) if (f.css) parts.push(f.css);
|
|
17706
|
+
return parts.join("\n");
|
|
17707
|
+
}
|
|
17708
|
+
function ensureCss() {
|
|
17709
|
+
if (typeof document === "undefined") return;
|
|
17710
|
+
cancelInitialCssSchedule();
|
|
17711
|
+
try {
|
|
17712
|
+
if (!dockCssTag || !dockCssTag.isConnected) {
|
|
17713
|
+
if (document.querySelector('style[data-plugin-css="dsh-dock"]')) {
|
|
17714
|
+
dockCssTag = document.querySelector('style[data-plugin-css="dsh-dock"]');
|
|
17715
|
+
} else {
|
|
17716
|
+
dockCssTag = document.createElement("style");
|
|
17717
|
+
document.head.appendChild(dockCssTag);
|
|
17718
|
+
}
|
|
17719
|
+
}
|
|
17720
|
+
dockCssTag.dataset.plugin = "dsh-dock";
|
|
17721
|
+
dockCssTag.dataset.pluginCss = "dsh-dock";
|
|
17722
|
+
dockCssTag.textContent = fullDockCss();
|
|
17723
|
+
} catch (e) {
|
|
17724
|
+
console.error("[dsh-dock] ensureCss failed:", e && e.message ? e.message : String(e));
|
|
17725
|
+
}
|
|
17726
|
+
}
|
|
17727
|
+
function useExternalVersion() {
|
|
17728
|
+
const [, bump] = import_react24.default.useReducer((n) => n + 1, 0);
|
|
17729
|
+
import_react24.default.useEffect(() => {
|
|
15652
17730
|
externalListeners.add(bump);
|
|
15653
17731
|
return () => {
|
|
15654
17732
|
externalListeners.delete(bump);
|
|
@@ -15658,25 +17736,25 @@ function useExternalVersion() {
|
|
|
15658
17736
|
var lastGeom = { x: null, y: null, w: null, h: null };
|
|
15659
17737
|
function DockIcon(props) {
|
|
15660
17738
|
const size = props && props.size || 16;
|
|
15661
|
-
return
|
|
17739
|
+
return import_react24.default.createElement(
|
|
15662
17740
|
"svg",
|
|
15663
17741
|
{ width: size, height: size, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.3, "aria-hidden": true },
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
17742
|
+
import_react24.default.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
|
|
17743
|
+
import_react24.default.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
|
|
17744
|
+
import_react24.default.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
|
|
17745
|
+
import_react24.default.createElement("rect", { x: 9, y: 9, width: 4.4, height: 4.4, rx: 1.2 })
|
|
15668
17746
|
);
|
|
15669
17747
|
}
|
|
15670
17748
|
function DockWorkspace() {
|
|
15671
|
-
const [nav, setNav] =
|
|
15672
|
-
|
|
17749
|
+
const [nav, setNav] = import_react24.default.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
|
|
17750
|
+
import_react24.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
|
|
15673
17751
|
const active = nav.active;
|
|
15674
17752
|
const navParams = nav.params;
|
|
15675
17753
|
const setActive = navigatePanel;
|
|
15676
|
-
const [, force] =
|
|
17754
|
+
const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
|
|
15677
17755
|
useExternalVersion();
|
|
15678
|
-
const contentRef =
|
|
15679
|
-
|
|
17756
|
+
const contentRef = import_react24.default.useRef(null);
|
|
17757
|
+
import_react24.default.useEffect(() => {
|
|
15680
17758
|
if (contentRef.current) contentRef.current.scrollTop = 0;
|
|
15681
17759
|
}, [active]);
|
|
15682
17760
|
const MODULES = allModules();
|
|
@@ -15684,26 +17762,26 @@ function DockWorkspace() {
|
|
|
15684
17762
|
const mod = isHome ? null : MODULES.find((m) => m.id === active) || MODULES[0];
|
|
15685
17763
|
const st = mod ? stateOf(mod.id) : null;
|
|
15686
17764
|
const View = mod ? mod.View : null;
|
|
15687
|
-
const viewNode = mod && View ?
|
|
17765
|
+
const viewNode = mod && View ? import_react24.default.createElement(
|
|
15688
17766
|
"div",
|
|
15689
17767
|
{ className: "dockm-view" },
|
|
15690
|
-
|
|
17768
|
+
import_react24.default.createElement(
|
|
15691
17769
|
FeatureBoundary,
|
|
15692
17770
|
{ key: mod.id, label: mod.name },
|
|
15693
|
-
|
|
17771
|
+
import_react24.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
|
|
15694
17772
|
)
|
|
15695
17773
|
) : null;
|
|
15696
17774
|
const enabledCount = MODULES.filter((m) => {
|
|
15697
17775
|
const s = stateOf(m.id);
|
|
15698
17776
|
return !!(s && s.enabled);
|
|
15699
17777
|
}).length;
|
|
15700
|
-
return
|
|
17778
|
+
return import_react24.default.createElement(
|
|
15701
17779
|
"div",
|
|
15702
17780
|
{ className: "dockm-body" },
|
|
15703
|
-
|
|
17781
|
+
import_react24.default.createElement(
|
|
15704
17782
|
"nav",
|
|
15705
17783
|
{ className: "dockm-nav", "aria-label": "\u529F\u80FD\u6A21\u5757" },
|
|
15706
|
-
|
|
17784
|
+
import_react24.default.createElement(
|
|
15707
17785
|
"button",
|
|
15708
17786
|
{
|
|
15709
17787
|
type: "button",
|
|
@@ -15711,10 +17789,10 @@ function DockWorkspace() {
|
|
|
15711
17789
|
className: "dockm-nav-item" + (isHome ? " on" : ""),
|
|
15712
17790
|
onClick: () => setActive("home")
|
|
15713
17791
|
},
|
|
15714
|
-
|
|
15715
|
-
|
|
17792
|
+
import_react24.default.createElement("span", { className: "dockm-navhome" }, import_react24.default.createElement(DockIcon, null)),
|
|
17793
|
+
import_react24.default.createElement("span", null, "\u9996\u9875")
|
|
15716
17794
|
),
|
|
15717
|
-
MODULES.map((m) =>
|
|
17795
|
+
MODULES.map((m) => import_react24.default.createElement(
|
|
15718
17796
|
"button",
|
|
15719
17797
|
{
|
|
15720
17798
|
type: "button",
|
|
@@ -15722,42 +17800,42 @@ function DockWorkspace() {
|
|
|
15722
17800
|
className: "dockm-nav-item" + (m.id === active ? " on" : ""),
|
|
15723
17801
|
onClick: () => setActive(m.id)
|
|
15724
17802
|
},
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
m.planned ?
|
|
15728
|
-
m.external ?
|
|
17803
|
+
import_react24.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
|
|
17804
|
+
import_react24.default.createElement("span", null, m.name),
|
|
17805
|
+
m.planned ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
|
|
17806
|
+
m.external ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8") : null
|
|
15729
17807
|
))
|
|
15730
17808
|
),
|
|
15731
|
-
|
|
17809
|
+
import_react24.default.createElement(
|
|
15732
17810
|
"div",
|
|
15733
17811
|
{ className: "dockm-content", ref: contentRef },
|
|
15734
|
-
|
|
17812
|
+
import_react24.default.createElement(
|
|
15735
17813
|
"div",
|
|
15736
17814
|
{ className: "dockm-content-head" },
|
|
15737
|
-
|
|
17815
|
+
import_react24.default.createElement(
|
|
15738
17816
|
"div",
|
|
15739
17817
|
{ className: "dockm-name" },
|
|
15740
|
-
isHome ?
|
|
17818
|
+
isHome ? import_react24.default.createElement("span", { className: "dockm-navhome" }, import_react24.default.createElement(DockIcon, null)) : import_react24.default.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
|
|
15741
17819
|
isHome ? "\u9996\u9875" : mod.name,
|
|
15742
|
-
!isHome && mod.planned ?
|
|
15743
|
-
!isHome && mod.external ?
|
|
17820
|
+
!isHome && mod.planned ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
|
|
17821
|
+
!isHome && mod.external ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8\u5305" + (mod.package ? " \xB7 " + mod.package : "")) : null
|
|
15744
17822
|
),
|
|
15745
|
-
|
|
17823
|
+
import_react24.default.createElement(
|
|
15746
17824
|
"div",
|
|
15747
17825
|
{ className: "dockm-desc" },
|
|
15748
17826
|
isHome ? "\u6240\u6709\u5B50\u529F\u80FD\u603B\u63FD\uFF1A\u8FD0\u884C\u72B6\u6001\u3001\u6982\u8981\u4E0E\u5FEB\u6377\u5F00\u5173\uFF0C\u70B9\u51FB\u5361\u7247\u8FDB\u5165\u5BF9\u5E94\u529F\u80FD\u9875\u3002" : mod.description
|
|
15749
17827
|
)
|
|
15750
17828
|
),
|
|
15751
|
-
isHome ?
|
|
15752
|
-
|
|
17829
|
+
isHome ? import_react24.default.createElement("div", { className: "dockm-view" }, import_react24.default.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force })) : mod.planned ? import_react24.default.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st && st.enabled && viewNode ? viewNode : st && st.error ? import_react24.default.createElement("div", { className: "dockm-note dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : import_react24.default.createElement("div", { className: "dockm-note" }, "\u8BE5\u529F\u80FD\u5F53\u524D\u4E3A\u505C\u7528\u72B6\u6001\uFF08\u5F00\u5173\u5DF2\u6301\u4E45\u5316\uFF0C\u91CD\u542F\u540E\u4FDD\u6301\uFF09"),
|
|
17830
|
+
import_react24.default.createElement(
|
|
15753
17831
|
"div",
|
|
15754
17832
|
{ className: "dockm-foot" },
|
|
15755
|
-
|
|
15756
|
-
!isHome && mod && !mod.planned && st ?
|
|
17833
|
+
import_react24.default.createElement("span", null, isHome ? "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u5171 " + MODULES.length + " \u4E2A\u529F\u80FD\u6A21\u5757\uFF0C" + enabledCount + " \u4E2A\u5DF2\u542F\u7528" : "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u65B0\u529F\u80FD\u6309\u8DEF\u7EBF\u56FE\u8FFD\u52A0"),
|
|
17834
|
+
!isHome && mod && !mod.planned && st ? import_react24.default.createElement(
|
|
15757
17835
|
"span",
|
|
15758
17836
|
{ className: "dockm-foot-sw" },
|
|
15759
|
-
|
|
15760
|
-
|
|
17837
|
+
import_react24.default.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
|
|
17838
|
+
import_react24.default.createElement("button", {
|
|
15761
17839
|
type: "button",
|
|
15762
17840
|
className: "dock-sw" + (st.enabled ? " on" : ""),
|
|
15763
17841
|
role: "switch",
|
|
@@ -15770,11 +17848,11 @@ function DockWorkspace() {
|
|
|
15770
17848
|
}
|
|
15771
17849
|
})
|
|
15772
17850
|
) : null,
|
|
15773
|
-
!isHome && mod && typeof mod.Chip === "function" ?
|
|
17851
|
+
!isHome && mod && typeof mod.Chip === "function" ? import_react24.default.createElement(
|
|
15774
17852
|
"span",
|
|
15775
17853
|
{ className: "dockm-foot-sw" },
|
|
15776
|
-
|
|
15777
|
-
|
|
17854
|
+
import_react24.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
|
|
17855
|
+
import_react24.default.createElement("button", {
|
|
15778
17856
|
type: "button",
|
|
15779
17857
|
className: "dock-sw" + (chipShown(mod.id) ? " on" : ""),
|
|
15780
17858
|
role: "switch",
|
|
@@ -15792,12 +17870,12 @@ function DockWorkspace() {
|
|
|
15792
17870
|
);
|
|
15793
17871
|
}
|
|
15794
17872
|
function DockModal() {
|
|
15795
|
-
const [nav, setNav] =
|
|
15796
|
-
|
|
17873
|
+
const [nav, setNav] = import_react24.default.useState({ open: panelNav.open });
|
|
17874
|
+
import_react24.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open })), []);
|
|
15797
17875
|
const open = nav.open || typeof document === "undefined";
|
|
15798
|
-
const [win, setWin] =
|
|
15799
|
-
const dlgRef =
|
|
15800
|
-
|
|
17876
|
+
const [win, setWin] = import_react24.default.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
|
|
17877
|
+
const dlgRef = import_react24.default.useRef(null);
|
|
17878
|
+
import_react24.default.useEffect(() => {
|
|
15801
17879
|
if (lastGeom.w) setWin({ mode: "normal", x: lastGeom.x, y: lastGeom.y, w: lastGeom.w, h: lastGeom.h });
|
|
15802
17880
|
}, []);
|
|
15803
17881
|
function beginDrag(e, type) {
|
|
@@ -15837,10 +17915,10 @@ function DockModal() {
|
|
|
15837
17915
|
width: win.w != null ? win.w : void 0,
|
|
15838
17916
|
height: win.mode === "min" ? "auto" : win.h != null ? win.h : void 0
|
|
15839
17917
|
} : null;
|
|
15840
|
-
return
|
|
17918
|
+
return import_react24.default.createElement(
|
|
15841
17919
|
"div",
|
|
15842
17920
|
{ className: "dockm-backdrop", onClick: () => setPanelOpen(false) },
|
|
15843
|
-
|
|
17921
|
+
import_react24.default.createElement(
|
|
15844
17922
|
"div",
|
|
15845
17923
|
{
|
|
15846
17924
|
className: "dockm-dialog" + (win.mode === "max" ? " dockm-max" : "") + (win.mode === "min" ? " dockm-min" : ""),
|
|
@@ -15848,59 +17926,59 @@ function DockModal() {
|
|
|
15848
17926
|
ref: dlgRef,
|
|
15849
17927
|
onClick: (e) => e.stopPropagation()
|
|
15850
17928
|
},
|
|
15851
|
-
|
|
17929
|
+
import_react24.default.createElement(
|
|
15852
17930
|
"div",
|
|
15853
17931
|
{
|
|
15854
17932
|
className: "dockm-head",
|
|
15855
17933
|
onPointerDown: (e) => beginDrag(e, "move"),
|
|
15856
17934
|
onDoubleClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
|
|
15857
17935
|
},
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
17936
|
+
import_react24.default.createElement(DockIcon, null),
|
|
17937
|
+
import_react24.default.createElement("span", { className: "dockm-title" }, "\u529F\u80FD\u575E"),
|
|
17938
|
+
import_react24.default.createElement("span", { className: "dockm-sub" }, "dsh-dock \xB7 \u4E5F\u53EF\u5728 \u8BBE\u7F6E \u2192 \u529F\u80FD\u575E \u6253\u5F00\u7BA1\u7406\u9875"),
|
|
17939
|
+
import_react24.default.createElement(
|
|
15862
17940
|
"span",
|
|
15863
17941
|
{ className: "dockm-ctrls" },
|
|
15864
|
-
|
|
17942
|
+
import_react24.default.createElement("button", {
|
|
15865
17943
|
type: "button",
|
|
15866
17944
|
className: "dockm-win",
|
|
15867
17945
|
title: win.mode === "min" ? "\u8FD8\u539F" : "\u6700\u5C0F\u5316",
|
|
15868
17946
|
onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "min" ? "normal" : "min" }))
|
|
15869
17947
|
}, "\u2581"),
|
|
15870
|
-
|
|
17948
|
+
import_react24.default.createElement("button", {
|
|
15871
17949
|
type: "button",
|
|
15872
17950
|
className: "dockm-win",
|
|
15873
17951
|
title: win.mode === "max" ? "\u8FD8\u539F" : "\u6700\u5927\u5316",
|
|
15874
17952
|
onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
|
|
15875
17953
|
}, win.mode === "max" ? "\u2750" : "\u25A2"),
|
|
15876
|
-
|
|
17954
|
+
import_react24.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
|
|
15877
17955
|
)
|
|
15878
17956
|
),
|
|
15879
|
-
|
|
15880
|
-
win.mode === "normal" ?
|
|
17957
|
+
import_react24.default.createElement(DockWorkspace, null),
|
|
17958
|
+
win.mode === "normal" ? import_react24.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
|
|
15881
17959
|
)
|
|
15882
17960
|
);
|
|
15883
17961
|
}
|
|
15884
17962
|
function HomeView(props) {
|
|
15885
17963
|
const ctx = props && props.ctx;
|
|
15886
|
-
const [, force] =
|
|
17964
|
+
const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
|
|
15887
17965
|
useExternalVersion();
|
|
15888
17966
|
const open = (id) => {
|
|
15889
17967
|
if (props && typeof props.onOpen === "function") props.onOpen(id);
|
|
15890
17968
|
};
|
|
15891
|
-
return
|
|
17969
|
+
return import_react24.default.createElement(
|
|
15892
17970
|
"div",
|
|
15893
17971
|
{ className: "dockh-grid" },
|
|
15894
17972
|
allModules().map((m) => {
|
|
15895
17973
|
const st = stateOf(m.id);
|
|
15896
17974
|
const enabled = !!(st && st.enabled);
|
|
15897
17975
|
const Stat = m.HomeStat;
|
|
15898
|
-
const statNode = m.planned ?
|
|
17976
|
+
const statNode = m.planned ? import_react24.default.createElement("span", null, PLANNED_NOTES[m.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : enabled && Stat ? import_react24.default.createElement(
|
|
15899
17977
|
FeatureBoundary,
|
|
15900
17978
|
{ key: m.id, label: m.name },
|
|
15901
|
-
|
|
15902
|
-
) :
|
|
15903
|
-
return
|
|
17979
|
+
import_react24.default.createElement(Stat, { ctx })
|
|
17980
|
+
) : import_react24.default.createElement("span", null, "\u5DF2\u505C\u7528\uFF0C\u542F\u7528\u540E\u5728\u6B64\u5C55\u793A\u8FD0\u884C\u6982\u8981");
|
|
17981
|
+
return import_react24.default.createElement(
|
|
15904
17982
|
"div",
|
|
15905
17983
|
{
|
|
15906
17984
|
key: m.id,
|
|
@@ -15915,21 +17993,21 @@ function HomeView(props) {
|
|
|
15915
17993
|
}
|
|
15916
17994
|
}
|
|
15917
17995
|
},
|
|
15918
|
-
|
|
17996
|
+
import_react24.default.createElement(
|
|
15919
17997
|
"div",
|
|
15920
17998
|
{ className: "dockh-head" },
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
m.external ?
|
|
17999
|
+
import_react24.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
|
|
18000
|
+
import_react24.default.createElement("span", { className: "dockh-name" }, m.name),
|
|
18001
|
+
m.external ? import_react24.default.createElement("span", { className: "dockh-badge", title: m.package || void 0 }, "\u5916\u90E8") : null,
|
|
15924
18002
|
// 状态标识:圆点 + 文字(纯展示,与开关视觉区分)
|
|
15925
|
-
|
|
18003
|
+
import_react24.default.createElement(
|
|
15926
18004
|
"span",
|
|
15927
18005
|
{ className: "dockh-status" + (m.planned ? " plan" : enabled ? "" : " off") },
|
|
15928
|
-
|
|
15929
|
-
|
|
18006
|
+
import_react24.default.createElement("span", { className: "dockh-sdot" }),
|
|
18007
|
+
import_react24.default.createElement("span", null, m.planned ? "\u89C4\u5212\u4E2D" : enabled ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u7528")
|
|
15930
18008
|
),
|
|
15931
18009
|
// 启停开关(规划中的功能不显示)
|
|
15932
|
-
m.planned ? null :
|
|
18010
|
+
m.planned ? null : import_react24.default.createElement("button", {
|
|
15933
18011
|
type: "button",
|
|
15934
18012
|
className: "dock-sw" + (enabled ? " on" : ""),
|
|
15935
18013
|
role: "switch",
|
|
@@ -15944,12 +18022,12 @@ function HomeView(props) {
|
|
|
15944
18022
|
}
|
|
15945
18023
|
})
|
|
15946
18024
|
),
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
18025
|
+
import_react24.default.createElement("div", { className: "dockh-desc" }, m.description),
|
|
18026
|
+
import_react24.default.createElement("div", { className: "dockh-stat" }, statNode),
|
|
18027
|
+
import_react24.default.createElement(
|
|
15950
18028
|
"div",
|
|
15951
18029
|
{ className: "dockh-foot" },
|
|
15952
|
-
|
|
18030
|
+
import_react24.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
|
|
15953
18031
|
)
|
|
15954
18032
|
);
|
|
15955
18033
|
})
|
|
@@ -15957,16 +18035,16 @@ function HomeView(props) {
|
|
|
15957
18035
|
}
|
|
15958
18036
|
function DockPanel(props) {
|
|
15959
18037
|
const ctx = ctxRef.current;
|
|
15960
|
-
const [, force] =
|
|
18038
|
+
const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
|
|
15961
18039
|
useExternalVersion();
|
|
15962
18040
|
const toggle = (id) => {
|
|
15963
18041
|
toggleFeature(id);
|
|
15964
18042
|
force();
|
|
15965
18043
|
};
|
|
15966
|
-
return
|
|
18044
|
+
return import_react24.default.createElement(
|
|
15967
18045
|
"div",
|
|
15968
18046
|
{ className: "dock-root" },
|
|
15969
|
-
|
|
18047
|
+
import_react24.default.createElement(
|
|
15970
18048
|
"div",
|
|
15971
18049
|
{ className: "dock-intro" },
|
|
15972
18050
|
"\u529F\u80FD\u575E\uFF08dsh-dock\uFF09\xB7 \u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u4E00\u4E2A\u9762\u677F\u91CC\u7BA1\u7406\u3002v0.4.0 \u8D77\u6BCF\u4E2A\u529F\u80FD\u662F\u72EC\u7ACB\u6A21\u5757\uFF08features/<id>/\uFF09\uFF0C",
|
|
@@ -15975,25 +18053,25 @@ function DockPanel(props) {
|
|
|
15975
18053
|
allModules().map((f) => {
|
|
15976
18054
|
const st = stateOf(f.id);
|
|
15977
18055
|
const View = f.View;
|
|
15978
|
-
const viewNode = !f.planned && st.enabled && View ?
|
|
18056
|
+
const viewNode = !f.planned && st.enabled && View ? import_react24.default.createElement(
|
|
15979
18057
|
"div",
|
|
15980
18058
|
{ className: "dock-body" },
|
|
15981
|
-
|
|
18059
|
+
import_react24.default.createElement(
|
|
15982
18060
|
FeatureBoundary,
|
|
15983
18061
|
{ key: f.id, label: f.name },
|
|
15984
|
-
|
|
18062
|
+
import_react24.default.createElement(View, { ctx, feature: f, params: props && props.params })
|
|
15985
18063
|
)
|
|
15986
18064
|
) : null;
|
|
15987
|
-
return
|
|
18065
|
+
return import_react24.default.createElement(
|
|
15988
18066
|
"div",
|
|
15989
18067
|
{ className: "dock-card", key: f.id },
|
|
15990
|
-
|
|
18068
|
+
import_react24.default.createElement(
|
|
15991
18069
|
"div",
|
|
15992
18070
|
{ className: "dock-card-head" },
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
f.planned ?
|
|
18071
|
+
import_react24.default.createElement("span", { className: "dock-dot" + (st.error ? " err" : st.enabled ? " on" : "") }),
|
|
18072
|
+
import_react24.default.createElement("span", { className: "dock-name" }, f.name),
|
|
18073
|
+
import_react24.default.createElement("span", { className: "dock-desc" }, f.description + (f.external ? "\uFF08\u6765\u81EA\u5916\u90E8\u5305" + (f.package ? " " + f.package : "") + "\uFF09" : "")),
|
|
18074
|
+
f.planned ? import_react24.default.createElement("span", { className: "dock-badge" }, "\u89C4\u5212\u4E2D") : import_react24.default.createElement("button", {
|
|
15997
18075
|
type: "button",
|
|
15998
18076
|
className: "dock-sw" + (st.enabled ? " on" : ""),
|
|
15999
18077
|
role: "switch",
|
|
@@ -16002,11 +18080,11 @@ function DockPanel(props) {
|
|
|
16002
18080
|
title: st.enabled ? "\u505C\u7528\u300C" + f.name + "\u300D" : "\u542F\u7528\u300C" + f.name + "\u300D",
|
|
16003
18081
|
onClick: () => toggle(f.id)
|
|
16004
18082
|
}),
|
|
16005
|
-
!f.planned && typeof f.Chip === "function" ?
|
|
18083
|
+
!f.planned && typeof f.Chip === "function" ? import_react24.default.createElement(
|
|
16006
18084
|
"span",
|
|
16007
18085
|
{ className: "dockm-foot-sw" },
|
|
16008
|
-
|
|
16009
|
-
|
|
18086
|
+
import_react24.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(f.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
|
|
18087
|
+
import_react24.default.createElement("button", {
|
|
16010
18088
|
type: "button",
|
|
16011
18089
|
className: "dock-sw" + (chipShown(f.id) ? " on" : ""),
|
|
16012
18090
|
role: "switch",
|
|
@@ -16020,7 +18098,7 @@ function DockPanel(props) {
|
|
|
16020
18098
|
})
|
|
16021
18099
|
) : null
|
|
16022
18100
|
),
|
|
16023
|
-
f.planned ?
|
|
18101
|
+
f.planned ? import_react24.default.createElement("div", { className: "dock-body" }, PLANNED_NOTES[f.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st.error ? import_react24.default.createElement("div", { className: "dock-body dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : null,
|
|
16024
18102
|
viewNode
|
|
16025
18103
|
);
|
|
16026
18104
|
})
|
|
@@ -16028,7 +18106,7 @@ function DockPanel(props) {
|
|
|
16028
18106
|
}
|
|
16029
18107
|
function DockPage() {
|
|
16030
18108
|
const ctx = ctxRef.current;
|
|
16031
|
-
const [wide, setWide] =
|
|
18109
|
+
const [wide, setWide] = import_react24.default.useState(false);
|
|
16032
18110
|
const toggleWide = () => {
|
|
16033
18111
|
try {
|
|
16034
18112
|
const layout = ctx && typeof ctx.get === "function" ? ctx.get("layout") : null;
|
|
@@ -16039,20 +18117,20 @@ function DockPage() {
|
|
|
16039
18117
|
} catch (e) {
|
|
16040
18118
|
}
|
|
16041
18119
|
};
|
|
16042
|
-
return
|
|
18120
|
+
return import_react24.default.createElement(
|
|
16043
18121
|
"div",
|
|
16044
18122
|
{ className: "dockm-page" + (wide ? " dockm-page-wide" : "") },
|
|
16045
|
-
|
|
18123
|
+
import_react24.default.createElement(
|
|
16046
18124
|
"div",
|
|
16047
18125
|
{ className: "dockm-page-head" },
|
|
16048
|
-
|
|
16049
|
-
|
|
18126
|
+
import_react24.default.createElement("span", { className: "dockm-page-icon" }, import_react24.default.createElement(DockIcon, { size: 20 })),
|
|
18127
|
+
import_react24.default.createElement(
|
|
16050
18128
|
"div",
|
|
16051
18129
|
{ className: "dockm-page-titles" },
|
|
16052
|
-
|
|
16053
|
-
|
|
18130
|
+
import_react24.default.createElement("div", { className: "dockm-page-title" }, "\u529F\u80FD\u575E"),
|
|
18131
|
+
import_react24.default.createElement("div", { className: "dockm-page-sub" }, "\u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u91CC\u7BA1\u7406\u3002\u4FA7\u680F\u56FE\u6807\u53EF\u5728\u300C\u66F4\u591A\u300D\u83DC\u5355\u91CC Pin \u5230\u9876\u90E8\uFF0C\u6216\u53D6\u6D88\u56FA\u5B9A\u6536\u8FDB\u66F4\u591A\u3002")
|
|
16054
18132
|
),
|
|
16055
|
-
|
|
18133
|
+
import_react24.default.createElement("button", {
|
|
16056
18134
|
type: "button",
|
|
16057
18135
|
className: "dockm-page-wide-btn",
|
|
16058
18136
|
title: wide ? "\u8FD8\u539F\u4FA7\u680F\u5BBD\u5EA6" : "\u6536\u8D77\u5DE6\u4FA7\u680F\uFF0C\u5168\u5C4F\u663E\u793A\u529F\u80FD\u575E",
|
|
@@ -16060,19 +18138,19 @@ function DockPage() {
|
|
|
16060
18138
|
onClick: toggleWide
|
|
16061
18139
|
}, wide ? "\u2750 \u8FD8\u539F" : "\u25A2 \u5168\u5C4F")
|
|
16062
18140
|
),
|
|
16063
|
-
|
|
18141
|
+
import_react24.default.createElement("div", { className: "dockm-page-body" }, import_react24.default.createElement(DockWorkspace, null))
|
|
16064
18142
|
);
|
|
16065
18143
|
}
|
|
16066
18144
|
function DockChips(props) {
|
|
16067
|
-
const [, force] =
|
|
16068
|
-
|
|
18145
|
+
const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
|
|
18146
|
+
import_react24.default.useEffect(() => subscribeFeatureState(() => force()), []);
|
|
16069
18147
|
const items = [];
|
|
16070
18148
|
for (const f of allModules()) {
|
|
16071
18149
|
if (f.planned || !stateOf(f.id).enabled || !chipShown(f.id) || typeof f.Chip !== "function") continue;
|
|
16072
|
-
items.push(
|
|
18150
|
+
items.push(import_react24.default.createElement(
|
|
16073
18151
|
FeatureBoundary,
|
|
16074
18152
|
{ key: f.id, label: f.name },
|
|
16075
|
-
|
|
18153
|
+
import_react24.default.createElement(f.Chip, {
|
|
16076
18154
|
ctx: props.ctx,
|
|
16077
18155
|
feature: f,
|
|
16078
18156
|
session: props.session,
|
|
@@ -16082,38 +18160,38 @@ function DockChips(props) {
|
|
|
16082
18160
|
));
|
|
16083
18161
|
}
|
|
16084
18162
|
if (items.length === 0) return null;
|
|
16085
|
-
return
|
|
18163
|
+
return import_react24.default.createElement("div", { className: "dockchip-row" }, items);
|
|
16086
18164
|
}
|
|
16087
18165
|
function FeatureOverlays() {
|
|
16088
|
-
const [, force] =
|
|
18166
|
+
const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
|
|
16089
18167
|
useExternalVersion();
|
|
16090
|
-
|
|
18168
|
+
import_react24.default.useEffect(() => subscribeFeatureState(() => force()), []);
|
|
16091
18169
|
const items = [];
|
|
16092
18170
|
for (const f of allModules()) {
|
|
16093
18171
|
if (f.planned || !stateOf(f.id).enabled || typeof f.Overlay !== "function") continue;
|
|
16094
|
-
items.push(
|
|
18172
|
+
items.push(import_react24.default.createElement(
|
|
16095
18173
|
FeatureBoundary,
|
|
16096
18174
|
{ key: f.id, label: f.name },
|
|
16097
|
-
|
|
18175
|
+
import_react24.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
|
|
16098
18176
|
));
|
|
16099
18177
|
}
|
|
16100
18178
|
if (items.length === 0) return null;
|
|
16101
|
-
return
|
|
18179
|
+
return import_react24.default.createElement(import_react24.default.Fragment, null, items);
|
|
16102
18180
|
}
|
|
16103
18181
|
function FeatureTurnTail(props) {
|
|
16104
|
-
const [, force] =
|
|
16105
|
-
|
|
18182
|
+
const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
|
|
18183
|
+
import_react24.default.useEffect(() => subscribeFeatureState(() => force()), []);
|
|
16106
18184
|
const items = [];
|
|
16107
18185
|
for (const f of allModules()) {
|
|
16108
18186
|
if (f.planned || !stateOf(f.id).enabled || typeof f.TurnTail !== "function") continue;
|
|
16109
|
-
items.push(
|
|
18187
|
+
items.push(import_react24.default.createElement(
|
|
16110
18188
|
FeatureBoundary,
|
|
16111
18189
|
{ key: f.id, label: f.name },
|
|
16112
|
-
|
|
18190
|
+
import_react24.default.createElement(f.TurnTail, Object.assign({}, props, { ctx: ctxRef.current, feature: f }))
|
|
16113
18191
|
));
|
|
16114
18192
|
}
|
|
16115
18193
|
if (items.length === 0) return null;
|
|
16116
|
-
return
|
|
18194
|
+
return import_react24.default.createElement(import_react24.default.Fragment, null, items);
|
|
16117
18195
|
}
|
|
16118
18196
|
var ctxRef = { current: null };
|
|
16119
18197
|
function apply(ctx) {
|
|
@@ -16124,32 +18202,34 @@ function apply(ctx) {
|
|
|
16124
18202
|
if (slots === void 0) return;
|
|
16125
18203
|
slots.inject("sidebar.panellist", () => slots.register(
|
|
16126
18204
|
{ name: "sidebar.panellist", id: "dsh-dock", order: 30, label: "\u529F\u80FD\u575E" },
|
|
16127
|
-
(props) =>
|
|
18205
|
+
(props) => import_react24.default.createElement(DockIcon, { size: props && props.size || 18 })
|
|
16128
18206
|
));
|
|
16129
18207
|
slots.inject("main", () => slots.register(
|
|
16130
18208
|
{ name: "main", key: "dsh-dock", label: "\u529F\u80FD\u575E" },
|
|
16131
|
-
() =>
|
|
18209
|
+
() => import_react24.default.createElement(DockPage, null)
|
|
16132
18210
|
));
|
|
16133
18211
|
slots.inject("shell.overlay", () => slots.register(
|
|
16134
18212
|
{ name: "shell.overlay", id: "dsh-dock-panel", order: 21, label: "\u529F\u80FD\u575E\u9762\u677F" },
|
|
16135
|
-
() =>
|
|
18213
|
+
() => import_react24.default.createElement(DockModal, null)
|
|
16136
18214
|
));
|
|
16137
18215
|
slots.inject("shell.overlay", () => slots.register(
|
|
16138
18216
|
{ name: "shell.overlay", id: "dsh-dock-feature-overlays", order: 22, label: "\u529F\u80FD\u575E\u5168\u5C40\u6D6E\u5C42" },
|
|
16139
|
-
() =>
|
|
18217
|
+
() => import_react24.default.createElement(FeatureOverlays, null)
|
|
16140
18218
|
));
|
|
16141
18219
|
slots.inject("settings.section", () => slots.register(
|
|
16142
18220
|
{ name: "settings.section", id: "dsh-dock", order: 90, label: "\u529F\u80FD\u575E" },
|
|
16143
|
-
(props) =>
|
|
18221
|
+
(props) => import_react24.default.createElement(DockPanel, props)
|
|
16144
18222
|
));
|
|
16145
18223
|
slots.inject("conversation.input.left", () => slots.register(
|
|
16146
18224
|
{ name: "conversation.input.left", id: "dsh-dock-chips", order: 10, label: "\u529F\u80FD\u575E" },
|
|
16147
|
-
(zone) =>
|
|
18225
|
+
(zone) => import_react24.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
|
|
16148
18226
|
));
|
|
16149
18227
|
slots.inject("conversation.chat.turnTail", () => slots.register(
|
|
16150
18228
|
{ name: "conversation.chat.turnTail", id: "dsh-dock-turn-tail", order: 40, label: "\u529F\u80FD\u575E" },
|
|
16151
|
-
(owner) =>
|
|
18229
|
+
(owner) => import_react24.default.createElement(FeatureTurnTail, owner)
|
|
16152
18230
|
));
|
|
18231
|
+
installClient(ctx);
|
|
18232
|
+
installClient2(ctx);
|
|
16153
18233
|
}
|
|
16154
18234
|
var inject = ["timer"];
|
|
16155
18235
|
|