@huaqiu/dsh-tool-schematic-gen 0.3.2 → 0.3.6
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 +53 -0
- package/lib/client.js.map +1 -1
- package/package.json +6 -5
- package/src/client/index.ts +3 -1
- package/src/client/theme.ts +22 -0
package/lib/client.js
CHANGED
|
@@ -180,6 +180,39 @@ window.__ModuleLoader__.load({
|
|
|
180
180
|
return dark ? "var(--dsw-alias-bg-layer-1, #20242c)" : "var(--dsw-alias-bg-layer-1, #ffffff)";
|
|
181
181
|
}
|
|
182
182
|
//#endregion
|
|
183
|
+
//#region ../dsh-tool-uncollapse/lib/index.mjs
|
|
184
|
+
function keepToolCardVisible(cardRootSelector, options) {
|
|
185
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return () => {};
|
|
186
|
+
const skipSelector = options?.skipWhenContains;
|
|
187
|
+
const root = document.documentElement;
|
|
188
|
+
const revealSeat = (seat) => {
|
|
189
|
+
if (!seat.querySelector(cardRootSelector)) return;
|
|
190
|
+
if (skipSelector && seat.querySelector(skipSelector)) return;
|
|
191
|
+
seat.removeAttribute("hidden");
|
|
192
|
+
};
|
|
193
|
+
let scheduled = false;
|
|
194
|
+
const sweep = () => {
|
|
195
|
+
scheduled = false;
|
|
196
|
+
for (const seat of root.querySelectorAll("[data-turn-process-hidden]")) revealSeat(seat);
|
|
197
|
+
};
|
|
198
|
+
const observer = new MutationObserver(() => {
|
|
199
|
+
if (scheduled) return;
|
|
200
|
+
scheduled = true;
|
|
201
|
+
requestAnimationFrame(sweep);
|
|
202
|
+
});
|
|
203
|
+
observer.observe(root, {
|
|
204
|
+
subtree: true,
|
|
205
|
+
childList: true,
|
|
206
|
+
attributes: true,
|
|
207
|
+
attributeFilter: ["hidden", "data-turn-process-hidden"]
|
|
208
|
+
});
|
|
209
|
+
sweep();
|
|
210
|
+
return () => {
|
|
211
|
+
observer.disconnect();
|
|
212
|
+
scheduled = false;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
183
216
|
//#region src/client/theme.ts
|
|
184
217
|
/**
|
|
185
218
|
* Host UI environment (theme + locale) store and the scoped stylesheet for
|
|
@@ -201,6 +234,13 @@ window.__ModuleLoader__.load({
|
|
|
201
234
|
*
|
|
202
235
|
* Stylesheet: uniquely-prefixed classes only, token colors, no !important, no
|
|
203
236
|
* DSH-internal selectors. The style tag is removed on dispose.
|
|
237
|
+
*
|
|
238
|
+
* Compact-transcript un-collapse: DSH's `ui-chat` hides a `tool-call` node's
|
|
239
|
+
* wrapper with `hidden="until-found"` once the turn closes. We cannot opt out
|
|
240
|
+
* from inside the card and must not patch DSH, so `installSchematicUncollapser()`
|
|
241
|
+
* delegates to `@huaqiu/dsh-tool-uncollapse`, which undoes it from this
|
|
242
|
+
* plugin's client half (scoped to our `.hq-sch` cards; no DSH source touched).
|
|
243
|
+
* See that package for the full mechanism.
|
|
204
244
|
*/
|
|
205
245
|
const PLUGIN_ID = "@huaqiu/dsh-tool-schematic-gen";
|
|
206
246
|
const STYLE_ID = "hq-schematic-genhit-styles";
|
|
@@ -382,6 +422,17 @@ window.__ModuleLoader__.load({
|
|
|
382
422
|
const style = document.getElementById(STYLE_ID);
|
|
383
423
|
if (style && style.parentNode) style.parentNode.removeChild(style);
|
|
384
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Keep our schematic/system preview visible in DSH's compact transcript.
|
|
427
|
+
*
|
|
428
|
+
* Delegates to `@huaqiu/dsh-tool-uncollapse` (shared across the
|
|
429
|
+
* `@huaqiu/dsh-tool-*` plugins) — see that package for the mechanism and
|
|
430
|
+
* trade-offs. Scoped to our `.hq-sch` cards; other tools keep collapsing.
|
|
431
|
+
* Returns a disposer.
|
|
432
|
+
*/
|
|
433
|
+
function installSchematicUncollapser() {
|
|
434
|
+
return keepToolCardVisible(".hq-sch", { skipWhenContains: ".hq-sch__login" });
|
|
435
|
+
}
|
|
385
436
|
//#endregion
|
|
386
437
|
//#region src/client/i18n.ts
|
|
387
438
|
/**
|
|
@@ -105983,11 +106034,13 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
105983
106034
|
}, GenHitView)));
|
|
105984
106035
|
}
|
|
105985
106036
|
injectStyles();
|
|
106037
|
+
const uncollapseDispose = installSchematicUncollapser();
|
|
105986
106038
|
const cleanup = () => {
|
|
105987
106039
|
for (const dispose of disposers) try {
|
|
105988
106040
|
dispose();
|
|
105989
106041
|
} catch {}
|
|
105990
106042
|
disposers.length = 0;
|
|
106043
|
+
uncollapseDispose();
|
|
105991
106044
|
removeStyles();
|
|
105992
106045
|
disposeThemeObserver();
|
|
105993
106046
|
};
|