dsh-think-translate 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +115 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -14,6 +14,9 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
var primitives = null;
|
|
15
15
|
try { primitives = require("@deepseek-ai/dsh-client-ui-primitives"); } catch (e) { primitives = null; }
|
|
16
16
|
var MarkdownText = primitives && primitives.MarkdownText ? primitives.MarkdownText : null;
|
|
17
|
+
var IconChecklist = primitives && primitives.IconChecklistOutline14 ? primitives.IconChecklistOutline14 : null;
|
|
18
|
+
var IconChevronUp = primitives && primitives.IconChevronUpOutline14 ? primitives.IconChevronUpOutline14 : null;
|
|
19
|
+
var IconChevronDown = primitives && primitives.IconChevronDownOutline14 ? primitives.IconChevronDownOutline14 : null;
|
|
17
20
|
var createElement = function (type, props) {
|
|
18
21
|
var children = [];
|
|
19
22
|
for (var i = 2; i < arguments.length; i++) children.push(arguments[i]);
|
|
@@ -22,6 +25,7 @@ window.__ModuleLoader__.load({
|
|
|
22
25
|
var Fragment = React.Fragment;
|
|
23
26
|
var useState = React.useState;
|
|
24
27
|
var useEffect = React.useEffect;
|
|
28
|
+
var useId = React.useId;
|
|
25
29
|
var Component = React.Component;
|
|
26
30
|
|
|
27
31
|
// ------------------------------------------------------------------
|
|
@@ -85,7 +89,22 @@ window.__ModuleLoader__.load({
|
|
|
85
89
|
".xl-table{border-collapse:collapse;min-width:100%;font-size:13px;line-height:1.5}",
|
|
86
90
|
".xl-table th,.xl-table td{border:1px solid var(--dsw-alias-border-l1,rgba(127,127,127,.35));padding:6px 10px;text-align:left;vertical-align:top}",
|
|
87
91
|
".xl-table th{background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.1));font-weight:600}",
|
|
88
|
-
".xl-table code{font-family:var(--dsw-font-mono,monospace);font-size:12px}"
|
|
92
|
+
".xl-table code{font-family:var(--dsw-font-mono,monospace);font-size:12px}",
|
|
93
|
+
".xl-dock{box-sizing:border-box;flex:none;overflow:hidden;margin:0 auto;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-specific-tip);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}",
|
|
94
|
+
".xl-dock-body{display:flex;flex-direction:column;gap:8px;padding:6px 12px}",
|
|
95
|
+
".xl-dock-header{display:flex;align-items:center;gap:10px;width:100%;padding:0;border:none;background:transparent;text-align:left;cursor:pointer}",
|
|
96
|
+
".xl-dock-lead{display:grid;flex:none;place-items:center;color:var(--dsw-alias-label-tertiary)}",
|
|
97
|
+
".xl-dock-title{flex:none;font-size:13px;line-height:24px;font-weight:500;color:var(--dsw-alias-label-primary)}",
|
|
98
|
+
".xl-dock-progress{flex:1 1 auto;min-width:0;overflow:hidden;font-size:13px;line-height:20px;font-weight:400;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap}",
|
|
99
|
+
".xl-dock-chev{display:grid;flex:none;place-items:center;color:var(--dsw-alias-label-tertiary)}",
|
|
100
|
+
".xl-dock-list{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;max-height:180px;overflow-y:auto}",
|
|
101
|
+
".xl-dock-item{display:flex;align-items:center;gap:10px;min-width:0;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary)}",
|
|
102
|
+
".xl-dock-glyph{display:grid;flex:none;place-items:center;width:16px;height:16px}",
|
|
103
|
+
".xl-dock-glyph-ok{color:var(--dsw-alias-state-success-primary)}",
|
|
104
|
+
".xl-dock-glyph-wait{color:var(--dsw-alias-label-caption)}",
|
|
105
|
+
".xl-dock-glyph-run{color:var(--dsw-alias-state-business-primary);animation:xl-dock-spin 1s linear infinite}",
|
|
106
|
+
".xl-dock-content{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
107
|
+
"@keyframes xl-dock-spin{to{transform:rotate(360deg)}}"
|
|
89
108
|
].join("\n");
|
|
90
109
|
if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="dsh-think-translate/styles.css"]') === null) {
|
|
91
110
|
var tag = document.createElement("style");
|
|
@@ -871,6 +890,88 @@ window.__ModuleLoader__.load({
|
|
|
871
890
|
: null);
|
|
872
891
|
}
|
|
873
892
|
|
|
893
|
+
// The plan strip above the composer (official ui-conversation TodoDock,
|
|
894
|
+
// 'conversation.input.dock' id 'todo'). Shadowing that id at a lower
|
|
895
|
+
// priority replaces the shipped panel with a translated one: title and
|
|
896
|
+
// per-status counts stay in the app locale (via the t seat), item
|
|
897
|
+
// contents go through the same useXlate path as the in-flow todo row.
|
|
898
|
+
function XDockTodoItem(props) {
|
|
899
|
+
var s = useStore();
|
|
900
|
+
var gid = useId();
|
|
901
|
+
var content = typeof props.item.content === "string" ? props.item.content : "";
|
|
902
|
+
var tr = useXlate(content, s.todo);
|
|
903
|
+
var hasTr = !!(tr && tr.ok && !tr.skipped && tr.text !== content);
|
|
904
|
+
var status = props.item.status;
|
|
905
|
+
var glyph = null;
|
|
906
|
+
if (status === "completed") {
|
|
907
|
+
glyph = createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, className: "xl-dock-glyph-ok" },
|
|
908
|
+
createElement("circle", { cx: 7, cy: 7, r: 6.4, stroke: "currentColor", strokeWidth: 1.2 }),
|
|
909
|
+
createElement("path", { d: "M10.9631 5.71411L7.70154 8.97571C7.48011 9.19714 7.27736 9.40099 7.09229 9.54993C6.89742 9.70669 6.66314 9.85279 6.3634 9.90027C6.2049 9.92534 6.04339 9.92534 5.88489 9.90027C5.58515 9.85279 5.35087 9.70669 5.15601 9.54993C4.97093 9.40099 4.76818 9.19714 4.54675 8.97571L3.03516 7.46411L3.96313 6.53613L5.47473 8.04773C5.7169 8.28989 5.86196 8.43389 5.97888 8.52795C6.08597 8.61409 6.10875 8.60701 6.08997 8.604C6.11259 8.60758 6.13571 8.60758 6.15833 8.604C6.13954 8.60701 6.16232 8.61409 6.26941 8.52795C6.38633 8.43389 6.53139 8.28989 6.77356 8.04773L10.0352 4.78613L10.9631 5.71411Z", fill: "currentColor" }));
|
|
910
|
+
} else if (status === "in_progress") {
|
|
911
|
+
glyph = createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, className: "xl-dock-glyph-run" },
|
|
912
|
+
createElement("defs", null,
|
|
913
|
+
createElement("linearGradient", { id: gid, x1: 2.5, y1: 12, x2: 10.5, y2: 3.5, gradientUnits: "userSpaceOnUse" },
|
|
914
|
+
createElement("stop", { stopColor: "currentColor" }),
|
|
915
|
+
createElement("stop", { offset: 1, stopColor: "currentColor", stopOpacity: 0 }))),
|
|
916
|
+
createElement("circle", { cx: 7, cy: 7, r: 6.4, stroke: "url(#" + gid + ")", strokeWidth: 1.2 }));
|
|
917
|
+
} else {
|
|
918
|
+
glyph = createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, className: "xl-dock-glyph-wait" },
|
|
919
|
+
createElement("circle", { cx: 7, cy: 7, r: 6.4, stroke: "currentColor", strokeWidth: 1.2, strokeDasharray: "2.4 2.4" }));
|
|
920
|
+
}
|
|
921
|
+
return createElement("li", { className: "xl-dock-item", "data-status": status },
|
|
922
|
+
createElement("span", { className: "xl-dock-glyph", "aria-hidden": true }, glyph),
|
|
923
|
+
createElement("span", {
|
|
924
|
+
className: "xl-dock-content",
|
|
925
|
+
title: hasTr ? content : undefined
|
|
926
|
+
}, hasTr ? tr.text : content));
|
|
927
|
+
}
|
|
928
|
+
function XDockTodo(props) {
|
|
929
|
+
var s = useStore();
|
|
930
|
+
var t = props.t;
|
|
931
|
+
var todos = props.useProjection("todos");
|
|
932
|
+
var list = Array.isArray(todos) ? todos : [];
|
|
933
|
+
var pairOpen = useState(false);
|
|
934
|
+
var open = pairOpen[0], setOpen = pairOpen[1];
|
|
935
|
+
if (list.length === 0) return null;
|
|
936
|
+
var done = 0, active = 0;
|
|
937
|
+
for (var i = 0; i < list.length; i++) {
|
|
938
|
+
var st = list[i] && list[i].status;
|
|
939
|
+
if (st === "completed") done++;
|
|
940
|
+
else if (st === "in_progress") active++;
|
|
941
|
+
}
|
|
942
|
+
var pending = list.length - done - active;
|
|
943
|
+
var segs = [];
|
|
944
|
+
function seg(key, params, count) {
|
|
945
|
+
if (count <= 0) return;
|
|
946
|
+
var label = null;
|
|
947
|
+
try { label = t ? t(key, params) : null; } catch (e) { label = null; }
|
|
948
|
+
if (typeof label === "string" && label) segs.push(label);
|
|
949
|
+
}
|
|
950
|
+
seg("todo.progress.done", { done: done }, done);
|
|
951
|
+
seg("todo.progress.active", { active: active }, active);
|
|
952
|
+
seg("todo.progress.pending", { pending: pending }, pending);
|
|
953
|
+
var title = null;
|
|
954
|
+
try { title = t ? t("todo.title") : null; } catch (e) { title = null; }
|
|
955
|
+
if (typeof title !== "string" || !title) title = "Tasks";
|
|
956
|
+
var progress = segs.join("\u2002·\u2002");
|
|
957
|
+
return createElement("section", { className: "xl-dock", "data-testid": "todo-panel", "aria-label": title },
|
|
958
|
+
createElement("div", { className: "xl-dock-body" },
|
|
959
|
+
createElement("button", {
|
|
960
|
+
type: "button", className: "xl-dock-header", "aria-expanded": open,
|
|
961
|
+
onClick: function () { setOpen(function (v) { return !v; }); }
|
|
962
|
+
},
|
|
963
|
+
IconChecklist ? createElement("span", { className: "xl-dock-lead", "aria-hidden": true }, createElement(IconChecklist, null)) : null,
|
|
964
|
+
createElement("span", { className: "xl-dock-title" }, title),
|
|
965
|
+
createElement("span", { className: "xl-dock-progress" }, progress),
|
|
966
|
+
createElement("span", { className: "xl-dock-chev", "aria-hidden": true },
|
|
967
|
+
open
|
|
968
|
+
? (IconChevronDown ? createElement(IconChevronDown, null) : null)
|
|
969
|
+
: (IconChevronUp ? createElement(IconChevronUp, null) : null))),
|
|
970
|
+
open ? createElement("ul", { className: "xl-dock-list" }, list.map(function (it) {
|
|
971
|
+
return createElement(XDockTodoItem, { key: it.content, item: it });
|
|
972
|
+
})) : null));
|
|
973
|
+
}
|
|
974
|
+
|
|
874
975
|
function StatusBlock() {
|
|
875
976
|
var s = useStore();
|
|
876
977
|
var t = UI_TEXT[s.lang] || UI_TEXT.en;
|
|
@@ -1194,6 +1295,19 @@ window.__ModuleLoader__.load({
|
|
|
1194
1295
|
});
|
|
1195
1296
|
});
|
|
1196
1297
|
});
|
|
1298
|
+
// Shadow the official plan strip (TodoDock) so the todo list above
|
|
1299
|
+
// the composer is translated too. Same id 'todo' at a lower priority
|
|
1300
|
+
// replaces the shipped entry; empty list renders nothing, matching
|
|
1301
|
+
// the official panel's self-hiding behaviour.
|
|
1302
|
+
recordSlot("todoDock", function () {
|
|
1303
|
+
return ctx.slots.inject("conversation.input.dock", function () {
|
|
1304
|
+
return ctx.slots.register(
|
|
1305
|
+
{ name: "conversation.input.dock", id: "todo", order: 0, locale: "conversation", priority: -1 },
|
|
1306
|
+
function (props) {
|
|
1307
|
+
return createElement(XBoundary, null, createElement(XDockTodo, props));
|
|
1308
|
+
});
|
|
1309
|
+
});
|
|
1310
|
+
});
|
|
1197
1311
|
// Settings section: the label is registrant-localized — the shell
|
|
1198
1312
|
// renders whatever label string the registration carried. Must go
|
|
1199
1313
|
// through slots.inject (declaration-aware: register() directly
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-think-translate",
|
|
3
3
|
"description": "Display-layer translation for the DSH web app: thinking chain, task cards, and optional answer text, in 8 target languages (local Ollama / Google / Bing, fail-open)",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|