dsh-plugin-core-demo 0.24.0 → 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.
Files changed (2) hide show
  1. package/dist/client.js +64 -10
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -376,6 +376,8 @@ var DICT = {
376
376
  diffUnchanged: "\u4E24\u4FA7\u5185\u5BB9\u76F8\u540C",
377
377
  diffCoarse: "\u9010\u884C\u5BF9\u6BD4\u8D85\u65F6\uFF0C\u6309\u6574\u4E2A\u6587\u4EF6\u66FF\u6362\u663E\u793A",
378
378
  diffTruncated: "\u53EA\u663E\u793A\u524D {count} \u884C",
379
+ diffWrap: "\u81EA\u52A8\u6362\u884C",
380
+ diffNowrap: "\u53D6\u6D88\u6362\u884C",
379
381
  continueBranch: "\u7EE7\u7EED\u5BF9\u8BDD",
380
382
  forkConfirmTitle: "\u5F00\u5206\u652F\u7EE7\u7EED\u5BF9\u8BDD",
381
383
  forkConfirmText: "\u662F\u5426\u9700\u8981\u57FA\u4E8E\u6B64\u4F1A\u8BDD\u5F00\u4E00\u4E2A\u65B0\u5206\u652F\u7EE7\u7EED\u5BF9\u8BDD\uFF1F\u539F\u4F1A\u8BDD\u4FDD\u6301\u53EA\u8BFB\u7559\u6863\uFF0C\u65B0\u5206\u652F\u590D\u5236\u672C\u4F1A\u8BDD\u5185\u5BB9\u5E76\u53EF\u7EE7\u7EED\u5BF9\u8BDD\u3002",
@@ -658,6 +660,8 @@ var DICT = {
658
660
  diffUnchanged: "Both sides hold the same lines",
659
661
  diffCoarse: "Line comparison timed out; shown as a whole-file replacement",
660
662
  diffTruncated: "Showing the first {count} lines",
663
+ diffWrap: "Wrap lines",
664
+ diffNowrap: "No wrap",
661
665
  continueBranch: "Continue conversation",
662
666
  forkConfirmTitle: "Fork to continue",
663
667
  forkConfirmText: "Start a new branch from this session to continue the conversation? The original stays read-only; the branch copies this conversation and can continue.",
@@ -57237,6 +57241,7 @@ function ChangedFileDiff(props) {
57237
57241
  const url = changesDiffUrl(sessionId, seq, index3);
57238
57242
  const [state, setState] = (0, import_react74.useState)(void 0);
57239
57243
  const [attempt, setAttempt] = (0, import_react74.useState)(0);
57244
+ const [wrap, setWrap] = (0, import_react74.useState)(false);
57240
57245
  (0, import_react74.useEffect)(() => {
57241
57246
  if (cache3.has(url)) {
57242
57247
  setState(cache3.get(url));
@@ -57303,7 +57308,7 @@ function ChangedFileDiff(props) {
57303
57308
  kept.push(hunk);
57304
57309
  budget -= hunk.lines.length;
57305
57310
  }
57306
- return (0, import_react74.createElement)("div", { className: D("body"), "data-review-view": "unified" }, note === void 0 ? null : (0, import_react74.createElement)("p", {
57311
+ return (0, import_react74.createElement)("div", { className: D("body"), "data-review-view": "unified", "data-review-wrap": wrap ? true : void 0 }, note === void 0 ? null : (0, import_react74.createElement)("p", {
57307
57312
  className: D("note"),
57308
57313
  "data-diff-note": hunks.length === 0 ? "empty" : "metadata"
57309
57314
  }, t4(note)), state.coarse === true ? (0, import_react74.createElement)("p", { className: D("note"), "data-diff-coarse": true }, t4("diffCoarse")) : null, truncated ? (0, import_react74.createElement)("p", { className: D("note"), "data-diff-truncated": true }, t4("diffTruncated", { count: String(DIFF_MAX_RENDERED_LINES) })) : null, kept.map((hunk, position) => {
@@ -57317,15 +57322,28 @@ function ChangedFileDiff(props) {
57317
57322
  newSpans: newSpans?.get(row.new ?? -1)
57318
57323
  })));
57319
57324
  }));
57320
- }, [state, highlighter, t4, retry]);
57325
+ }, [state, highlighter, t4, retry, wrap]);
57321
57326
  const preview = variant !== "review";
57322
57327
  return (0, import_react74.createElement)("div", {
57323
57328
  className: preview ? `${D("root")} ${C2("preview")}` : D("root"),
57324
- "data-changes-hover-preview": preview ? true : void 0
57329
+ "data-changes-hover-preview": preview ? true : void 0,
57330
+ // review 版式要填满父容器:官方 root 高度 auto 时 body 只撑到内容高,
57331
+ // 横向滚动条会停在内容下沿(面板下面空一大截)。hover 预览卡不撑,保持自适应。
57332
+ style: preview ? void 0 : { height: "100%" }
57325
57333
  }, (0, import_react74.createElement)(
57326
57334
  "div",
57327
57335
  { className: D("header") },
57328
57336
  (0, import_react74.createElement)("span", { className: C2("previewPath"), "data-changes-preview-path": true }, display),
57337
+ // 审阅态右上:换行开关(等价官方 ReviewTab 的 wrap 工具钮;图标语义同官方:开着显示「取消换行」)。
57338
+ preview ? null : (0, import_react74.createElement)(IconButton, {
57339
+ variant: "plain",
57340
+ size: "md",
57341
+ icon: (0, import_react74.createElement)(wrap ? official_exports.IconNowrapFillRegular : official_exports.IconWrapFillRegular, { size: 14 }),
57342
+ label: wrap ? t4("diffNowrap") : t4("diffWrap"),
57343
+ onClick: () => {
57344
+ setWrap((value) => !value);
57345
+ }
57346
+ }),
57329
57347
  // 审阅态:行尾 ✕ 关闭(复用 FileBrowser 同一个 IconButton + 官方 ✕,不自绘新样式)。
57330
57348
  preview || onClose === void 0 ? null : (0, import_react74.createElement)(IconButton, {
57331
57349
  variant: "plain",
@@ -57963,6 +57981,42 @@ function SessionViewModal(props) {
57963
57981
  (0, import_react76.useEffect)(() => () => {
57964
57982
  aliveRef.current = false;
57965
57983
  }, []);
57984
+ const flowRef = (0, import_react76.useRef)(null);
57985
+ (0, import_react76.useEffect)(() => {
57986
+ const flow = flowRef.current;
57987
+ const scroller = flow === null ? null : flow.closest(".dshpc-modal__body");
57988
+ if (scroller === null)
57989
+ return;
57990
+ let following = true;
57991
+ let lastHeight = 0;
57992
+ let lastTop = scroller.scrollTop;
57993
+ const nearBottom = () => scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight <= 24;
57994
+ const onScroll = () => {
57995
+ const top2 = scroller.scrollTop;
57996
+ if (top2 < lastTop - 1)
57997
+ following = false;
57998
+ else if (nearBottom())
57999
+ following = true;
58000
+ lastTop = top2;
58001
+ };
58002
+ scroller.addEventListener("scroll", onScroll, { passive: true });
58003
+ const observer = new ResizeObserver(() => {
58004
+ const height = flow === null ? 0 : flow.scrollHeight;
58005
+ if (height === lastHeight)
58006
+ return;
58007
+ const firstPaint = lastHeight === 0;
58008
+ lastHeight = height;
58009
+ if (!following)
58010
+ return;
58011
+ scroller.scrollTo({ top: scroller.scrollHeight, behavior: firstPaint ? "auto" : "smooth" });
58012
+ });
58013
+ if (flow !== null)
58014
+ observer.observe(flow);
58015
+ return () => {
58016
+ observer.disconnect();
58017
+ scroller.removeEventListener("scroll", onScroll);
58018
+ };
58019
+ }, []);
57966
58020
  const onForkAccept = (0, import_react76.useCallback)(() => {
57967
58021
  if (forking || forkSession === void 0 || openHostSession === void 0)
57968
58022
  return;
@@ -58226,7 +58280,7 @@ function SessionViewModal(props) {
58226
58280
  }, sending ? tt("forkWorking") : tt("confirm")), (0, import_react76.createElement)("span", { className: "dshpc-sv-composer-hint", title: tt("composerHint") }, "\u2318/Ctrl + \u21B5"), sendErr !== null ? (0, import_react76.createElement)("div", { className: "dshpc-sv-forkerr" }, sendErr) : null)
58227
58281
  }, (0, import_react76.createElement)(
58228
58282
  "div",
58229
- { className: "dshpc-sv" },
58283
+ { className: "dshpc-sv", ref: flowRef },
58230
58284
  // markdown 导航委托:挂上 openFile 后,正文里的本地文件链接才渲成官方
58231
58285
  // `fileMention fileLink` 按钮(不挂 ⇒ 官方自己退回纯文本)。
58232
58286
  fileOpen === void 0 ? (0, import_react76.createElement)(ChatViewFrame, { children: flowChildren }) : (0, import_react76.createElement)(official_exports.MarkdownDelegateProvider, { openFile: openDelegatedFile }, (0, import_react76.createElement)(ChatViewFrame, { children: flowChildren }))
@@ -66601,9 +66655,9 @@ function ReferencePage() {
66601
66655
  "tbody",
66602
66656
  null,
66603
66657
  [
66604
- [t3("buildCore"), `v${"0.24.0"}`],
66605
- [t3("buildDemo"), `v${"0.24.0"}`],
66606
- [t3("buildStamp"), "261103-142153-640"]
66658
+ [t3("buildCore"), `v${"0.25.0"}`],
66659
+ [t3("buildDemo"), `v${"0.25.0"}`],
66660
+ [t3("buildStamp"), "261104-015047-866"]
66607
66661
  ].map(
66608
66662
  ([label, value]) => (0, import_react86.createElement)(
66609
66663
  "tr",
@@ -66914,9 +66968,9 @@ function DemoPage() {
66914
66968
  lineHeight: "14px"
66915
66969
  }
66916
66970
  },
66917
- (0, import_react88.createElement)("span", null, `core v${"0.24.0"}`),
66918
- (0, import_react88.createElement)("span", null, `demo v${"0.24.0"}`),
66919
- (0, import_react88.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261103-142153-640")
66971
+ (0, import_react88.createElement)("span", null, `core v${"0.25.0"}`),
66972
+ (0, import_react88.createElement)("span", null, `demo v${"0.25.0"}`),
66973
+ (0, import_react88.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261104-015047-866")
66920
66974
  )
66921
66975
  )
66922
66976
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-core-demo",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
5
5
  "icon": "./assets/icon-components.svg",
6
6
  "keywords": [