dsh-think-translate 1.0.8 → 1.0.9
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 +85 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -85,7 +85,17 @@ window.__ModuleLoader__.load({
|
|
|
85
85
|
".xl-table{border-collapse:collapse;min-width:100%;font-size:13px;line-height:1.5}",
|
|
86
86
|
".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
87
|
".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}"
|
|
88
|
+
".xl-table code{font-family:var(--dsw-font-mono,monospace);font-size:12px}",
|
|
89
|
+
".xl-dock{box-sizing:border-box;flex:none;overflow:hidden;margin:0 auto 4px;width:100%;border:1px solid var(--dsw-alias-border-l1,rgba(127,127,127,.35));border-radius:12px;background:var(--dsw-specific-tip,var(--dsw-alias-bg-layer-2,rgba(127,127,127,.08)))}",
|
|
90
|
+
".xl-dock-body{display:flex;flex-direction:column;gap:8px;padding:6px 12px}",
|
|
91
|
+
".xl-dock-header{display:flex;align-items:center;gap:10px;width:100%;padding:0;border:none;background:transparent;text-align:left;cursor:pointer;font:inherit;color:inherit}",
|
|
92
|
+
".xl-dock-title{flex:none;font-size:13px;line-height:24px;font-weight:500;color:var(--dsw-alias-label-primary,inherit)}",
|
|
93
|
+
".xl-dock-progress{flex:1 1 auto;min-width:0;overflow:hidden;font-size:13px;line-height:20px;color:var(--dsw-alias-label-tertiary,rgba(127,127,127,.75));text-overflow:ellipsis;white-space:nowrap}",
|
|
94
|
+
".xl-dock-chev{display:grid;flex:none;place-items:center;font-size:11px;color:var(--dsw-alias-label-tertiary,rgba(127,127,127,.75))}",
|
|
95
|
+
".xl-dock-list{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;max-height:180px;overflow-y:auto}",
|
|
96
|
+
".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,inherit)}",
|
|
97
|
+
".xl-dock-glyph{display:grid;flex:none;place-items:center;width:16px;height:16px;font-size:12px;opacity:.7}",
|
|
98
|
+
".xl-dock-content{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.85}"
|
|
89
99
|
].join("\n");
|
|
90
100
|
if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="dsh-think-translate/styles.css"]') === null) {
|
|
91
101
|
var tag = document.createElement("style");
|
|
@@ -871,6 +881,67 @@ window.__ModuleLoader__.load({
|
|
|
871
881
|
: null);
|
|
872
882
|
}
|
|
873
883
|
|
|
884
|
+
// The plan strip above the composer (official ui-conversation TodoDock,
|
|
885
|
+
// 'conversation.input.dock' id 'todo'). Shadowing that id at a lower
|
|
886
|
+
// priority replaces the shipped panel with a translated one: title and
|
|
887
|
+
// per-status counts stay in the app locale (via the t seat), item
|
|
888
|
+
// contents go through the same useXlate path as the in-flow todo row.
|
|
889
|
+
function XDockTodoItem(props) {
|
|
890
|
+
var s = useStore();
|
|
891
|
+
var content = typeof props.item.content === "string" ? props.item.content : "";
|
|
892
|
+
var tr = useXlate(content, s.todo);
|
|
893
|
+
var hasTr = !!(tr && tr.ok && !tr.skipped && tr.text !== content);
|
|
894
|
+
var glyph = props.item.status === "completed" ? "✓" : props.item.status === "in_progress" ? "◐" : "○";
|
|
895
|
+
return createElement("li", { className: "xl-dock-item", "data-status": props.item.status },
|
|
896
|
+
createElement("span", { className: "xl-dock-glyph", "aria-hidden": true }, glyph),
|
|
897
|
+
createElement("span", {
|
|
898
|
+
className: "xl-dock-content",
|
|
899
|
+
title: hasTr ? content : undefined
|
|
900
|
+
}, hasTr ? tr.text : content));
|
|
901
|
+
}
|
|
902
|
+
function XDockTodo(props) {
|
|
903
|
+
var s = useStore();
|
|
904
|
+
var t = props.t;
|
|
905
|
+
var todos = props.useProjection("todos");
|
|
906
|
+
var list = Array.isArray(todos) ? todos : [];
|
|
907
|
+
var pairOpen = useState(false);
|
|
908
|
+
var open = pairOpen[0], setOpen = pairOpen[1];
|
|
909
|
+
if (list.length === 0) return null;
|
|
910
|
+
var done = 0, active = 0;
|
|
911
|
+
for (var i = 0; i < list.length; i++) {
|
|
912
|
+
var st = list[i] && list[i].status;
|
|
913
|
+
if (st === "completed") done++;
|
|
914
|
+
else if (st === "in_progress") active++;
|
|
915
|
+
}
|
|
916
|
+
var pending = list.length - done - active;
|
|
917
|
+
var segs = [];
|
|
918
|
+
function seg(key, params, count) {
|
|
919
|
+
if (count <= 0) return;
|
|
920
|
+
var label = null;
|
|
921
|
+
try { label = t ? t(key, params) : null; } catch (e) { label = null; }
|
|
922
|
+
if (typeof label === "string" && label) segs.push(label);
|
|
923
|
+
}
|
|
924
|
+
seg("todo.progress.done", { done: done }, done);
|
|
925
|
+
seg("todo.progress.active", { active: active }, active);
|
|
926
|
+
seg("todo.progress.pending", { pending: pending }, pending);
|
|
927
|
+
var title = null;
|
|
928
|
+
try { title = t ? t("todo.title") : null; } catch (e) { title = null; }
|
|
929
|
+
if (typeof title !== "string" || !title) title = "Tasks";
|
|
930
|
+
var progress = segs.join("\u2002·\u2002");
|
|
931
|
+
return createElement("section", { className: "xl-dock", "data-testid": "todo-panel", "aria-label": title },
|
|
932
|
+
createElement("div", { className: "xl-dock-body" },
|
|
933
|
+
createElement("button", {
|
|
934
|
+
type: "button", className: "xl-dock-header", "aria-expanded": open,
|
|
935
|
+
onClick: function () { setOpen(function (v) { return !v; }); }
|
|
936
|
+
},
|
|
937
|
+
createElement("span", { className: "xl-dock-title" }, title),
|
|
938
|
+
createElement("span", { className: "xl-dock-progress" }, progress),
|
|
939
|
+
createElement("span", { className: "xl-dock-chev", "aria-hidden": true }, open ? "▾" : "▸")),
|
|
940
|
+
open ? createElement("ul", { className: "xl-dock-list" }, list.map(function (it, n) {
|
|
941
|
+
return createElement(XDockTodoItem, { key: n, item: it });
|
|
942
|
+
})) : null));
|
|
943
|
+
}
|
|
944
|
+
|
|
874
945
|
function StatusBlock() {
|
|
875
946
|
var s = useStore();
|
|
876
947
|
var t = UI_TEXT[s.lang] || UI_TEXT.en;
|
|
@@ -1194,6 +1265,19 @@ window.__ModuleLoader__.load({
|
|
|
1194
1265
|
});
|
|
1195
1266
|
});
|
|
1196
1267
|
});
|
|
1268
|
+
// Shadow the official plan strip (TodoDock) so the todo list above
|
|
1269
|
+
// the composer is translated too. Same id 'todo' at a lower priority
|
|
1270
|
+
// replaces the shipped entry; empty list renders nothing, matching
|
|
1271
|
+
// the official panel's self-hiding behaviour.
|
|
1272
|
+
recordSlot("todoDock", function () {
|
|
1273
|
+
return ctx.slots.inject("conversation.input.dock", function () {
|
|
1274
|
+
return ctx.slots.register(
|
|
1275
|
+
{ name: "conversation.input.dock", id: "todo", order: 0, locale: "conversation", priority: -1 },
|
|
1276
|
+
function (props) {
|
|
1277
|
+
return createElement(XBoundary, null, createElement(XDockTodo, props));
|
|
1278
|
+
});
|
|
1279
|
+
});
|
|
1280
|
+
});
|
|
1197
1281
|
// Settings section: the label is registrant-localized — the shell
|
|
1198
1282
|
// renders whatever label string the registration carried. Must go
|
|
1199
1283
|
// 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.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|