@xrn1997/dsh-session-delete 0.12.0 → 0.14.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 (133) hide show
  1. package/README.md +4 -3
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/lib/client.js +7856 -5511
  4. package/lib/index.js +1147 -174
  5. package/lib/types/api/project-ranks.d.ts +3 -0
  6. package/lib/types/api/search.d.ts +7 -0
  7. package/lib/types/api/trash-rows.d.ts +1 -1
  8. package/lib/types/client/{batch-bar.d.ts → batch/batch-bar.d.ts} +2 -2
  9. package/lib/types/client/{batch-menu-item.d.ts → batch/batch-menu-item.d.ts} +1 -1
  10. package/lib/types/client/{batch-pick.d.ts → batch/batch-pick.d.ts} +1 -1
  11. package/lib/types/client/{batch-select.d.ts → batch/batch-select.d.ts} +2 -2
  12. package/lib/types/client/{delete-menu-item.d.ts → batch/delete-menu-item.d.ts} +1 -1
  13. package/lib/types/client/batch/index.d.ts +10 -0
  14. package/lib/types/client/{copy.d.ts → core/copy.d.ts} +41 -2
  15. package/lib/types/client/{receipt.d.ts → core/receipt.d.ts} +1 -1
  16. package/lib/types/client/{remote.d.ts → core/remote.d.ts} +23 -2
  17. package/lib/types/client/detail/block-render.d.ts +22 -0
  18. package/lib/types/client/{detail-blocks.d.ts → detail/detail-blocks.d.ts} +1 -1
  19. package/lib/types/client/detail/detail-style.d.ts +62 -0
  20. package/lib/types/client/detail/detail-text.d.ts +18 -0
  21. package/lib/types/client/detail/index.d.ts +17 -0
  22. package/lib/types/client/{markdown.d.ts → detail/markdown.d.ts} +2 -2
  23. package/lib/types/client/{prompt-rail.d.ts → detail/prompt-rail.d.ts} +2 -2
  24. package/lib/types/client/{session-detail.d.ts → detail/session-detail.d.ts} +20 -13
  25. package/lib/types/client/{subagent-section.d.ts → detail/subagent-section.d.ts} +2 -2
  26. package/lib/types/client/{use-archive-detail-reader.d.ts → detail/use-archive-detail-reader.d.ts} +2 -2
  27. package/lib/types/client/{use-detail-pager.d.ts → detail/use-detail-pager.d.ts} +1 -1
  28. package/lib/types/client/{use-detail-rail.d.ts → detail/use-detail-rail.d.ts} +3 -1
  29. package/lib/types/client/{use-detail-reader.d.ts → detail/use-detail-reader.d.ts} +3 -3
  30. package/lib/types/client/{use-prompt-rail.d.ts → detail/use-prompt-rail.d.ts} +1 -1
  31. package/lib/types/client/{use-trash-detail-reader.d.ts → detail/use-trash-detail-reader.d.ts} +2 -2
  32. package/lib/types/client/{context-menu-actions.d.ts → host/context-menu-actions.d.ts} +2 -2
  33. package/lib/types/client/host/guard.d.ts +16 -0
  34. package/lib/types/client/{host-archive-watch.d.ts → host/host-archive-watch.d.ts} +1 -1
  35. package/lib/types/client/host/index.d.ts +11 -0
  36. package/lib/types/client/panel/archive-detail.d.ts +22 -0
  37. package/lib/types/client/{archive-pane.d.ts → panel/archive-pane.d.ts} +28 -9
  38. package/lib/types/client/{detail-pane.d.ts → panel/detail-pane.d.ts} +3 -3
  39. package/lib/types/client/panel/index.d.ts +9 -0
  40. package/lib/types/client/panel/panel-tab.d.ts +61 -0
  41. package/lib/types/client/{session-list.d.ts → panel/session-list.d.ts} +4 -4
  42. package/lib/types/client/{trash-confirm.d.ts → panel/trash-confirm.d.ts} +2 -12
  43. package/lib/types/client/{trash-detail.d.ts → panel/trash-detail.d.ts} +10 -7
  44. package/lib/types/client/{trash-drop.d.ts → panel/trash-drop.d.ts} +1 -1
  45. package/lib/types/client/{trash-entry.d.ts → panel/trash-entry.d.ts} +2 -2
  46. package/lib/types/client/{trash-panel.d.ts → panel/trash-panel.d.ts} +1 -1
  47. package/lib/types/client/panel/trash-tab.d.ts +42 -0
  48. package/lib/types/client/{use-archive-panel-controller.d.ts → panel/use-archive-panel-controller.d.ts} +7 -5
  49. package/lib/types/client/{use-archive-query.d.ts → panel/use-archive-query.d.ts} +2 -2
  50. package/lib/types/client/{use-list-selection.d.ts → panel/use-list-selection.d.ts} +1 -1
  51. package/lib/types/client/{use-panel-child-view.d.ts → panel/use-panel-child-view.d.ts} +1 -1
  52. package/lib/types/client/{use-panel-tab.d.ts → panel/use-panel-tab.d.ts} +9 -12
  53. package/lib/types/client/{use-trash-panel-controller.d.ts → panel/use-trash-panel-controller.d.ts} +10 -4
  54. package/lib/types/client/{use-trash-query.d.ts → panel/use-trash-query.d.ts} +4 -4
  55. package/lib/types/client/panel/view-switches.d.ts +29 -0
  56. package/lib/types/client/scene.d.ts +8 -8
  57. package/lib/types/client/search/index.d.ts +12 -0
  58. package/lib/types/client/search/search-box.d.ts +24 -0
  59. package/lib/types/client/search/search-preview.d.ts +46 -0
  60. package/lib/types/client/search/search-results.d.ts +62 -0
  61. package/lib/types/client/search/search-text.d.ts +13 -0
  62. package/lib/types/client/search/use-search-view.d.ts +59 -0
  63. package/lib/types/client/search/use-search.d.ts +62 -0
  64. package/lib/types/client/{config-settings.d.ts → settings/config-settings.d.ts} +2 -2
  65. package/lib/types/client/settings/index.d.ts +8 -0
  66. package/lib/types/client/{maintenance-parts.d.ts → settings/maintenance-parts.d.ts} +1 -1
  67. package/lib/types/client/{maintenance-settings.d.ts → settings/maintenance-settings.d.ts} +1 -1
  68. package/lib/types/client/settings/orphan-confirm.d.ts +12 -0
  69. package/lib/types/client/{orphan-maintenance.d.ts → settings/orphan-maintenance.d.ts} +3 -3
  70. package/lib/types/client/{settings-cards.d.ts → settings/settings-cards.d.ts} +2 -2
  71. package/lib/types/client/{use-maintenance-section.d.ts → settings/use-maintenance-section.d.ts} +1 -1
  72. package/lib/types/client/{use-maintenance.d.ts → settings/use-maintenance.d.ts} +4 -4
  73. package/lib/types/client/{batch-selection-store.d.ts → state/batch-selection-store.d.ts} +11 -4
  74. package/lib/types/client/state/delete-action.d.ts +16 -0
  75. package/lib/types/client/{main-view.d.ts → state/main-view.d.ts} +1 -1
  76. package/lib/types/client/{trash-snapshot.d.ts → state/trash-snapshot.d.ts} +1 -1
  77. package/lib/types/client/{undo-notices.d.ts → state/undo-notices.d.ts} +9 -22
  78. package/lib/types/client/ui/Button.d.ts +2 -1
  79. package/lib/types/client/ui/ErrorBoundary.d.ts +4 -8
  80. package/lib/types/client/ui/Modal.d.ts +4 -3
  81. package/lib/types/client/ui/Toast.d.ts +13 -3
  82. package/lib/types/client/ui/Tooltip.d.ts +3 -2
  83. package/lib/types/client/ui/anchor-fit.d.ts +42 -0
  84. package/lib/types/client/ui/icons.d.ts +13 -2
  85. package/lib/types/client/ui/inert.d.ts +15 -0
  86. package/lib/types/client/{attachment-view.d.ts → widgets/attachment-view.d.ts} +3 -3
  87. package/lib/types/client/{confirm-dialog.d.ts → widgets/confirm-dialog.d.ts} +4 -0
  88. package/lib/types/client/{trash-view.d.ts → widgets/trash-view.d.ts} +8 -5
  89. package/lib/types/client/write/delete-action-host.d.ts +4 -0
  90. package/lib/types/client/write/index.d.ts +13 -0
  91. package/lib/types/client/{undo-toast.d.ts → write/undo-toast.d.ts} +2 -2
  92. package/lib/types/client/{use-write-progress.d.ts → write/use-write-progress.d.ts} +2 -2
  93. package/lib/types/client/{write-progress.d.ts → write/write-progress.d.ts} +1 -1
  94. package/lib/types/client/{write-seats.d.ts → write/write-seats.d.ts} +7 -15
  95. package/lib/types/ports/agent-handles.d.ts +2 -1
  96. package/lib/types/ports/host-port.d.ts +6 -1
  97. package/lib/types/shared/wire.d.ts +135 -3
  98. package/lib/types/trash/content-text.d.ts +10 -0
  99. package/lib/types/trash/groups.d.ts +18 -6
  100. package/lib/types/trash/search-corpus.d.ts +40 -0
  101. package/lib/types/trash/search-text.d.ts +43 -0
  102. package/lib/types/trash/shrinking-view.d.ts +6 -4
  103. package/lib/types/verbs/permanent-removal.d.ts +22 -6
  104. package/lib/types/verbs/search.d.ts +53 -0
  105. package/lib/types/verbs/trash-scope.d.ts +5 -1
  106. package/package.json +7 -7
  107. package/lib/types/client/archive-detail.d.ts +0 -19
  108. package/lib/types/client/delete-action.d.ts +0 -23
  109. package/lib/types/client/panel-tab.d.ts +0 -39
  110. package/lib/types/client/trash-tab.d.ts +0 -22
  111. package/lib/types/client/ui/Tag.d.ts +0 -16
  112. /package/lib/types/client/{api-base.d.ts → core/api-base.d.ts} +0 -0
  113. /package/lib/types/client/{context.d.ts → core/context.d.ts} +0 -0
  114. /package/lib/types/client/{detail-ledger.d.ts → core/detail-ledger.d.ts} +0 -0
  115. /package/lib/types/client/{plugin.d.ts → core/plugin.d.ts} +0 -0
  116. /package/lib/types/client/{use-gated-refresh.d.ts → core/use-gated-refresh.d.ts} +0 -0
  117. /package/lib/types/client/{use-prefetch.d.ts → core/use-prefetch.d.ts} +0 -0
  118. /package/lib/types/client/{store.d.ts → core/value-store.d.ts} +0 -0
  119. /package/lib/types/client/{use-detail-frame.d.ts → detail/use-detail-frame.d.ts} +0 -0
  120. /package/lib/types/client/{session-live.d.ts → host/session-live.d.ts} +0 -0
  121. /package/lib/types/client/{drop-machine.d.ts → panel/drop-machine.d.ts} +0 -0
  122. /package/lib/types/client/{trash-nav.d.ts → panel/trash-nav.d.ts} +0 -0
  123. /package/lib/types/client/{use-column-resize.d.ts → panel/use-column-resize.d.ts} +0 -0
  124. /package/lib/types/client/{use-panel-list-read.d.ts → panel/use-panel-list-read.d.ts} +0 -0
  125. /package/lib/types/client/{use-panel-selection.d.ts → panel/use-panel-selection.d.ts} +0 -0
  126. /package/lib/types/client/{use-panel-width.d.ts → panel/use-panel-width.d.ts} +0 -0
  127. /package/lib/types/client/{settings-view.d.ts → settings/settings-view.d.ts} +0 -0
  128. /package/lib/types/client/{archive-store.d.ts → state/archive-store.d.ts} +0 -0
  129. /package/lib/types/client/{host-rows.d.ts → state/host-rows.d.ts} +0 -0
  130. /package/lib/types/client/{pending-open.d.ts → state/pending-open.d.ts} +0 -0
  131. /package/lib/types/client/{trash-store.d.ts → state/trash-store.d.ts} +0 -0
  132. /package/lib/types/client/{notice.d.ts → widgets/notice.d.ts} +0 -0
  133. /package/lib/types/client/{busy-gate.d.ts → write/busy-gate.d.ts} +0 -0
@@ -0,0 +1,62 @@
1
+ /**
2
+ * 检索结果视图:标题命中区(零延迟、首页给全)+ 正文命中区(按游标追加)+ 状态行。
3
+ *
4
+ * 三条口径:
5
+ * ① **两区不混**:标题命中按清册标题来、一次给全;正文命中来自日志扫描、随页追加。混成一列会让"精准命中"
6
+ * 被后面几十条正文命中压住——用户最先要的往往就是标题对得上的那条。
7
+ * ② **一区一行是按会话算的**:正文命中在线上是一条消息一处,界面按 `groupId` 收成一行(行上最多两条摘录、
8
+ * 右侧「已加载 N 处」)。行身份是判别式联合:标题行只有标题命中、正文行只有正文命中——消费者不拿到
9
+ * 另一种分支,就不会在调用点再写一遍哨兵判断。
10
+ * ③ **"没搜到"与"没搜成"分开**:空态只说"没有找到这个查询",跳过的会话另起一行说"N 个会话未参与检索"——
11
+ * 读不出的会话不是"没有",界面不能替它下结论(ADR-0074 决定第 3 条)。
12
+ */
13
+ import { type ReactElement } from 'react';
14
+ import type { SearchBodyHitWire, SearchPageWire, SearchTitleHitWire } from '../../shared/wire.js';
15
+ import type { Translate } from '../core/copy.js';
16
+ import type { SearchController } from './use-search.js';
17
+ interface ResultRowBase {
18
+ /** 行的稳定身份:标题区与正文区同名会话会同时出现,所以前缀分家(`title:x` / `body:x`)。 */
19
+ readonly key: string;
20
+ readonly groupId: string;
21
+ }
22
+ /** 标题命中行:一条标题命中,一行一条。 */
23
+ export interface TitleResultRow extends ResultRowBase {
24
+ readonly kind: 'title';
25
+ readonly hit: SearchTitleHitWire;
26
+ }
27
+ /** 正文命中行:同一会话的命中消息收成一行(行上只画前两条摘录)。 */
28
+ export interface BodyResultRow extends ResultRowBase {
29
+ readonly kind: 'body';
30
+ /** 会话显示名(面板清单给的):正文行的标题用它;标题行画命中摘录本身。 */
31
+ readonly title: string;
32
+ readonly hits: readonly SearchBodyHitWire[];
33
+ readonly isChild: boolean;
34
+ }
35
+ /** 结果行:判别式联合,`kind` 决定带的是哪种命中。 */
36
+ export type ResultRow = TitleResultRow | BodyResultRow;
37
+ /** 一行上最多画几条摘录:再多就把结果区撑成正文了。 */
38
+ export declare const ROW_SNIPPET_LIMIT = 2;
39
+ /** 把一页命中收成结果行:标题区按线上序、正文区按 `groupId` 首次出现序聚合。 */
40
+ export declare function resultRowsOf(page: Pick<SearchPageWire, 'titleHits' | 'bodyHits'>, titleOf: (groupId: string) => string | null): ResultRow[];
41
+ export interface SearchResultsProps {
42
+ readonly controller: SearchController;
43
+ /** 组根显示名;`null` = 这条命中在手上的清单里没有对应行(raw 快照与已对账清单的差异),整行丢弃。 */
44
+ readonly titleOf: (groupId: string) => string | null;
45
+ /** 选中行的 key(`title:x` / `body:x`)。 */
46
+ readonly selectedKey: string | null;
47
+ /** 单击 / 勾选一条结果行(窄档会下钻到它的预览或详情)。 */
48
+ readonly onSelect: (row: ResultRow) => void;
49
+ /** 方向键移动选中:**只移高亮**,窄档不下钻。缺省回退到 `onSelect`(原语直渲面)。 */
50
+ readonly onMove?: ((row: ResultRow) => void) | undefined;
51
+ /** 点行内某条摘录:把预览目标换到那一处(组行可能混着父 / 子会话的命中)。 */
52
+ readonly onSelectHit?: ((row: BodyResultRow, hit: SearchBodyHitWire) => void) | undefined;
53
+ /** Enter / 双击:打开这一行的完整详情(正文行打开命中的那条消息所在会话)。 */
54
+ readonly onOpenDetail: (row: ResultRow) => void;
55
+ /** `Esc`:清空检索(确认框开着时由顶层浮层先收,事件到不了这里)。 */
56
+ readonly onClearQuery: () => void;
57
+ /** 清册是否可用:可用才能把命中对齐到行、给出动作;不可用时不许把「读不出」折成「没有找到」。 */
58
+ readonly listReady?: boolean;
59
+ readonly t: Translate;
60
+ }
61
+ export declare function SearchResults({ controller, titleOf, selectedKey, onSelect, onMove, onSelectHit, onOpenDetail, onClearQuery, listReady, t }: SearchResultsProps): ReactElement;
62
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 高亮切片:把一段文字与它的命中区间切成 React 片段,命中段包 `<mark>`。
3
+ *
4
+ * 坐标口径:`ranges` 是**这段文字自己的 UTF-16 码元下标**(Node 半在切好的摘录上重算后过线,见
5
+ * `src/trash/search-text.ts` 的开窗口径),所以这里直接按 `.slice` 切,不做任何偏移换算。
6
+ *
7
+ * 尽调上只做一件事:把区间按序、去重叠、夹进边界。上游已经保证有序不重叠,这一层仍然兜住——
8
+ * 一份坏数据不该让渲染切出互相吞并的片段(那会静默丢字)。
9
+ */
10
+ import type { ReactNode } from 'react';
11
+ /** 一处命中区间:`[start, end)`。 */
12
+ export type HighlightRange = readonly [number, number];
13
+ export declare function highlight(text: string, ranges: readonly HighlightRange[]): ReactNode[];
@@ -0,0 +1,59 @@
1
+ import { type SearchPreviewState } from './use-search.js';
2
+ import type { SessionDeleteRemote } from '../core/remote.js';
3
+ import type { SearchBodyHitWire, SearchPreviewWire, SearchScopeWire } from '../../shared/wire.js';
4
+ import type { BodyResultRow, ResultRow, TitleResultRow } from './search-results.js';
5
+ /** 「在完整详情中打开」要用的落点:命中会话 + 消息下标 + 命中消息时间(拿不到时间时为 `null`)。 */
6
+ export interface OpenTarget {
7
+ readonly rowId: string;
8
+ readonly messageIndex: number;
9
+ readonly time: number | null;
10
+ }
11
+ /** 预览导航的三格:位置 / 相邻是否存在 / 两个动作(由服务端相邻命中下标驱动)。 */
12
+ export interface PreviewActions {
13
+ readonly hitIndex: number;
14
+ readonly hitCount: number;
15
+ readonly canPrev: boolean;
16
+ readonly canNext: boolean;
17
+ readonly onPrev: () => void;
18
+ readonly onNext: () => void;
19
+ }
20
+ export interface SearchViewStateInput<TSelection> {
21
+ /** 检索态是否活动(查询词非空)。 */
22
+ readonly active: boolean;
23
+ readonly rows: readonly ResultRow[];
24
+ readonly searchPreview: SessionDeleteRemote['searchPreview'];
25
+ readonly scope: SearchScopeWire;
26
+ /** 产出当前结果页的那次查询串(`resultQuery ?? ''`)。 */
27
+ readonly query: string;
28
+ /** 页版本:首页每次重跑 +1;绑在旧版本上的预览目标不再发请求。 */
29
+ readonly pageVersion: number;
30
+ /** 清单换版的稳定身份(视图传 `listRows` 数组):变了就重跑检索;每帧新建对象会让 effect 每帧重跑。 */
31
+ readonly listVersion: unknown;
32
+ /** 预览栏是否在眼前(宽档,或窄档已下钻/选中):不在时自动选中与方向键移动不付整本日志的预览读。 */
33
+ readonly previewMounted?: boolean;
34
+ /** 写动作成功后重跑检索(调用方给;状态机只在清单换版时调它)。 */
35
+ readonly refresh: () => void;
36
+ /** 面板壳保存的还原点(切档卸载后仍活着):挂载时非空视为「已进入检索」,不再重新 capture。 */
37
+ readonly savedSelection?: TSelection | null;
38
+ /** 进入检索前控制器里的选中(清空时还原)。 */
39
+ readonly captureSelection: () => TSelection | null;
40
+ readonly restoreSelection: (saved: TSelection) => void;
41
+ /** 自动选中标题命中行时,把右栏喂成那条的正常详情。 */
42
+ readonly selectTitleRow: (row: TitleResultRow) => void;
43
+ }
44
+ export interface SearchViewState {
45
+ readonly selectedKey: string | null;
46
+ readonly selectedRow: ResultRow | null;
47
+ readonly preview: SearchPreviewState;
48
+ /** 选中一条结果行;给了 `hit` 就预览那一处,否则预览这一行第一条已加载命中。 */
49
+ readonly selectRow: (row: ResultRow, hit?: SearchBodyHitWire) => void;
50
+ /** 方向键只移动结果区选中(不激活):窄档清单不因此下钻,也不为看不见的右栏读日志。 */
51
+ readonly moveRow: (row: ResultRow) => void;
52
+ /** 预览导航三格:位置用会话级计数,相邻是否存在由 wire 下标给。 */
53
+ readonly previewActions: (row: BodyResultRow, value: SearchPreviewWire) => PreviewActions;
54
+ /** 当前行正在预览的那一处(优先预览目标,否则本行第一条已加载命中)。 */
55
+ readonly openTargetOf: (row: BodyResultRow) => OpenTarget | null;
56
+ /** 「在完整详情中打开」显式跳目标:取消「清空检索还原选中」。 */
57
+ readonly cancelRestore: () => void;
58
+ }
59
+ export declare function useSearchViewState<TSelection>(input: SearchViewStateInput<TSelection>): SearchViewState;
@@ -0,0 +1,62 @@
1
+ import type { SearchPageLike, SearchPreviewLike, SessionDeleteRemote } from '../core/remote.js';
2
+ import type { SearchScopeWire } from '../../shared/wire.js';
3
+ /** 输入到发请求的静默间隔:短到不打断输入节奏,长到不在每个按键上都解一次日志。 */
4
+ export declare const SEARCH_DEBOUNCE_MS = 250;
5
+ export type SearchState = {
6
+ readonly status: 'idle';
7
+ } | {
8
+ readonly status: 'loading';
9
+ }
10
+ /** `query` 是**产出这一页那次请求**的查询串(不是输入框当前值):预览按它取数,改词还没落地时不拿新词配旧命中。
11
+ * `version` 每从首页重跑一次就 +1:页面级身份,供视图作废「绑在上一页命中上的预览目标」。 */
12
+ | {
13
+ readonly status: 'ready';
14
+ readonly page: SearchPageLike;
15
+ readonly paging: boolean;
16
+ /** 续页失败原文(首页失败才整面 failed):已加载结果保留,重试用同一游标。 */
17
+ readonly pagingFailure: string | null;
18
+ readonly query: string;
19
+ readonly version: number;
20
+ } | {
21
+ readonly status: 'failed';
22
+ readonly message: string;
23
+ };
24
+ export interface SearchController {
25
+ readonly state: SearchState;
26
+ /** 输入框当前值(面板交下来的那一份;改词立刻变)。 */
27
+ readonly query: string;
28
+ /** 产出当前结果页的查询串;没有结果(idle / loading / failed)时是 `null`。 */
29
+ readonly resultQuery: string | null;
30
+ /** 下面两个是**属性声明而不是方法简写**:实现体都不读 `this`,属性形式才允许被摘下来转交
31
+ * (方法简写会被 `unbound-method` 报成可疑)。 */
32
+ /** 结果列表触底时调用;同一游标不会被并发请求两次。 */
33
+ readonly loadMore: () => void;
34
+ /** 写动作成功后调用:丢掉在飞结果、从首页重跑。 */
35
+ readonly refresh: () => void;
36
+ }
37
+ export interface UseSearchOptions {
38
+ readonly search: SessionDeleteRemote['search'];
39
+ readonly scope: SearchScopeWire;
40
+ /** 检索态是否活动(这一档在眼前、且不在多选态):不活动时不发请求,也不保留旧结果。 */
41
+ readonly active: boolean;
42
+ /** 受控查询串:面板壳持有(两档共用一个检索框)。 */
43
+ readonly query: string;
44
+ }
45
+ export declare function useSearch({ search, scope, active, query }: UseSearchOptions): SearchController;
46
+ export interface SearchPreviewState {
47
+ readonly status: 'idle' | 'loading' | 'ready' | 'failed';
48
+ readonly preview: SearchPreviewLike | null;
49
+ readonly message: string | null;
50
+ }
51
+ export interface UseSearchPreviewOptions {
52
+ readonly searchPreview: SessionDeleteRemote['searchPreview'];
53
+ readonly scope: SearchScopeWire;
54
+ readonly query: string;
55
+ /** 命中位置:只用它的两个原语当依赖,**不要把对象整个放进 deps**。 */
56
+ readonly target: {
57
+ readonly rowId: string;
58
+ readonly messageIndex: number;
59
+ } | null;
60
+ }
61
+ /** 预览取数:选中一条正文命中时按 `(rowId, messageIndex)` 取窗口;换选即作废旧请求(latest-wins)。 */
62
+ export declare function useSearchPreview({ searchPreview, scope, query, target }: UseSearchPreviewOptions): SearchPreviewState;
@@ -1,6 +1,6 @@
1
1
  import type { ReactElement } from 'react';
2
- import { type Translate } from './copy.js';
3
- import type { ConfigDeps } from './remote.js';
2
+ import { type Translate } from '../core/copy.js';
3
+ import type { ConfigDeps } from '../core/remote.js';
4
4
  export interface ConfigSettingsProps {
5
5
  /** 整套 remote 的切片;测试可以只给维护那七件(缺这两件时本卡不渲染)。 */
6
6
  readonly deps: Partial<ConfigDeps>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 插件设置页模块的入口:`plugins.bundle.config` 那一格的两张卡(上「可调项」、下「维护」,ADR-0043 决定 4)。
3
+ *
4
+ * 外部只 import 本文件——目录内部怎么分(卡片壳 / 两张卡的呈现 / 维护状态机与远程 glue)是这一层的
5
+ * 实现细节;边界由 `tests/dependency-direction.test.ts` 钉住。槽位视图守卫(`summary` 不画)也跟着
6
+ * 主体走,不留给注册处再判一次。
7
+ */
8
+ export { SettingsCards } from './settings-cards.js';
@@ -3,7 +3,7 @@
3
3
  * 它同时被回收站面板用到,住中立模块 `notice.tsx`。
4
4
  */
5
5
  import type { ReactElement, ReactNode } from 'react';
6
- import type { Translate } from './copy.js';
6
+ import type { Translate } from '../core/copy.js';
7
7
  interface MaintenanceChromeProps {
8
8
  /** 给测试与界面规格一个稳定的块名;缺省不写 `data-*`。 */
9
9
  slot?: string;
@@ -3,7 +3,7 @@
3
3
  * 卡片只呈现,读数与动作归 `use-maintenance.ts`;孤儿会话段复用 `OrphanMaintenance`,另两段在本文件。
4
4
  */
5
5
  import type { ReactElement } from 'react';
6
- import { type Translate } from './copy.js';
6
+ import { type Translate } from '../core/copy.js';
7
7
  import { type MaintenanceDeps } from './use-maintenance.js';
8
8
  export interface MaintenanceSettingsProps {
9
9
  /** 维护七件(三段读数与动作 + 进度认领那一读);可调项两件由占用者另发给「可调项」卡。 */
@@ -0,0 +1,12 @@
1
+ import type { OrphanReportWire } from '../../shared/wire.js';
2
+ import type { OneShotDeps } from '../core/remote.js';
3
+ import type { Translate } from '../core/copy.js';
4
+ /** 无主子会话的清理确认框。载荷是刚扫出来的那份报告,界面不重算。 */
5
+ export declare function OrphanConfirm({ deps, report, busy, t, onCancel, onConfirm, }: {
6
+ deps: OneShotDeps;
7
+ report: OrphanReportWire;
8
+ busy: boolean;
9
+ t: Translate;
10
+ onCancel: () => void;
11
+ onConfirm: () => void;
12
+ }): import("react").JSX.Element;
@@ -4,9 +4,9 @@
4
4
  * (原位原文 + 重试,不折成空报告);「已经不在」不是失败(中性提示,下次检查自然消失)。
5
5
  */
6
6
  import type { ReactElement } from 'react';
7
- import type { Translate } from './copy.js';
8
- import type { OrphanReportWire } from '../shared/wire.js';
9
- import type { OneShotDeps } from './remote.js';
7
+ import type { Translate } from '../core/copy.js';
8
+ import type { OrphanReportWire } from '../../shared/wire.js';
9
+ import type { OneShotDeps } from '../core/remote.js';
10
10
  import type { MaintenanceSectionView } from './use-maintenance-section.js';
11
11
  export interface OrphanMaintenanceProps {
12
12
  /** 段视图:读数、提示、确认框、忙碌与四个动作都在它上面,本块不多要也不少读。 */
@@ -3,8 +3,8 @@
3
3
  * 呈现与状态机归 `config-settings.tsx` / `maintenance-settings.tsx`。
4
4
  */
5
5
  import type { ReactElement } from 'react';
6
- import { type Translate } from './copy.js';
7
- import type { ConfigDeps } from './remote.js';
6
+ import { type Translate } from '../core/copy.js';
7
+ import type { ConfigDeps } from '../core/remote.js';
8
8
  import type { MaintenanceDeps } from './use-maintenance.js';
9
9
  export interface SettingsCardsProps {
10
10
  /** 维护七件 + 可调项两件;只造维护七件的测试替身会让「可调项」卡整体缺席。 */
@@ -1,4 +1,4 @@
1
- import type { RemoteOutcome } from './remote.js';
1
+ import type { RemoteOutcome } from '../core/remote.js';
2
2
  /** 一段在飞的动作:检查只读,清理会写。状态行靠它分开说「检查中…」与「清理中…」;`null` = 空闲。 */
3
3
  export type MaintenancePhase = 'scanning' | 'cleaning';
4
4
  /** 检查的落地面:失败句由各段自己拼(`text`),机器只负责在赢票之后把它摆上屏。 */
@@ -4,10 +4,10 @@
4
4
  * 远程调用、"没活可干"的判据与回执拼句,同样不挂 effect。写动作走 `/apply` 的 `orphan-clean` 与
5
5
  * 两个聚合清理段;面板的 `useTrashQuery` 与本 hook 互不引用。
6
6
  */
7
- import type { Translate } from './copy.js';
8
- import type { AttachmentOrphanReportWire, OrphanReportWire } from '../shared/wire.js';
9
- import { type SessionDeleteRemote } from './remote.js';
10
- import type { ProjectionCacheOrphanReportWire } from '../shared/wire.js';
7
+ import type { Translate } from '../core/copy.js';
8
+ import type { AttachmentOrphanReportWire, OrphanReportWire } from '../../shared/wire.js';
9
+ import { type SessionDeleteRemote } from '../core/remote.js';
10
+ import type { ProjectionCacheOrphanReportWire } from '../../shared/wire.js';
11
11
  import { type MaintenanceSectionView } from './use-maintenance-section.js';
12
12
  /** 维护卡只需要这七段:三份报告 + 孤儿会话的批量写 + 孤儿附件/投影缓存的聚合写,加进度认领那一读
13
13
  * (确认框里的进度行轮询 `/progress`,不在 /progress 覆盖面的两段只拿它当兜底文案不管)。 */
@@ -1,7 +1,14 @@
1
- import type { TrashMoveTarget } from './write-seats.js';
2
- /** 选中集一条 = 一条待移入回收站的会话:与 `write-seats.ts` 的 `TrashMoveTarget` 同一形状、同一义,
3
- * `title` 是移入回收站那一刻的显示名(投影的 `displayTitle`),只用于已选清单与撤销/失败原文,不参与请求。 */
4
- export type PickItem = TrashMoveTarget;
1
+ /** 一条**待移入回收站的会话**:宿主投影的会话 id + 移入回收站那一刻的显示名(投影的 `displayTitle`)。
2
+ *
3
+ * 这组字段是四个消费者共用的同一个形状:选中集、会话行的单条与批量座位、撤销横幅与已选清单原文。
4
+ * 它由**选中集**拥有(`title` 只用于清单与失败原文,不参与请求),写链向下 import 它——不是写链的实现细节。
5
+ */
6
+ export interface PickItem {
7
+ /** 宿主槽位投影的会话 id,原样透给 `/apply`(浏览器半不自己拼 id)。 */
8
+ readonly sessionId: string;
9
+ /** 移入回收站那一刻的显示名。 */
10
+ readonly title: string;
11
+ }
5
12
  export interface SelectionState {
6
13
  readonly selecting: boolean;
7
14
  readonly picks: readonly PickItem[];
@@ -0,0 +1,16 @@
1
+ import type { PickItem } from './batch-selection-store.js';
2
+ /** 现场里的一张请求:形状就是一条待移入回收站的会话,外加认领用的序号。 */
3
+ export interface DeleteActionRequest extends PickItem {
4
+ readonly seq: number;
5
+ }
6
+ export interface DeleteActionScene {
7
+ request(input: PickItem): void;
8
+ clear(expected: DeleteActionRequest): void;
9
+ use(): DeleteActionRequest | null;
10
+ reset(): void;
11
+ }
12
+ export declare function createDeleteActionScene(): DeleteActionScene;
13
+ /** 菜单行落下一次请求(委托进程场景的实例)。 */
14
+ export declare function requestDelete(input: PickItem): void;
15
+ /** 动作宿主读当前请求(委托进程场景的实例)。 */
16
+ export declare function useDeleteActionRequest(): DeleteActionRequest | null;
@@ -7,7 +7,7 @@
7
7
  * 归档时 `clearMain()` 的判据在 `dsh-client-ui-workspace/lib/client.js`。
8
8
  * 不 import 宿主客户端包(AGENTS.md 红线):只通过 `ctx.get('uiWorkspace')` 可选读服务,形状不符/缺席安静退回。
9
9
  */
10
- import type { ClientContextLike } from './context.js';
10
+ import type { ClientContextLike } from '../core/context.js';
11
11
  /** 一台主视图收尾现场:绑定宿主 / 关主视图 / 重开 / 遗忘 / 收场。 */
12
12
  export interface MainViewScene {
13
13
  /** 入口激活时绑一次;之后每次调用再读服务(客户端插件激活顺序早于 `uiWorkspace` 也没关系)。 */
@@ -1,4 +1,4 @@
1
- import type { TrashDetailLike, TrashEntryLike } from './remote.js';
1
+ import type { TrashDetailLike, TrashEntryLike } from '../core/remote.js';
2
2
  /** 快照的形状:只搬清册/详情线上已有的只读事实,不带时间戳或"读了几次"这类读数。 */
3
3
  export interface TrashSnapshot {
4
4
  readonly rows: readonly TrashEntryLike[];
@@ -27,6 +27,10 @@ export type UndoNotice = {
27
27
  /** 同一批移入回收站部分失败时的摘要:随撤销横幅同屏展示,不等横幅 6 秒过期后再顶上。 */
28
28
  partialFailure?: UndoPartialFailure;
29
29
  });
30
+ /** 发布输入 = 对应 `UndoNotice` 去掉由通知台自己写的三格;字号字段只写在 `UndoNotice` 一处,不再手抄第二份。 */
31
+ type UndoInput<K extends UndoNotice['kind']> = Omit<Extract<UndoNotice, {
32
+ kind: K;
33
+ }>, 'kind' | 'seq' | 'failure'>;
30
34
  /** 一条待显示的撤销失败:撤销在飞时横幅被新的移入回收站覆盖或被面板恢复熄灭,失败就失去了落点;
31
35
  * `failNotice` 把原文留在这里,等当前没有横幅时由 `undo-toast.tsx` 顶上——失败不被吞掉。 */
32
36
  export interface UndoFailureNotice {
@@ -37,18 +41,9 @@ export interface UndoFailureNotice {
37
41
  /** 一台撤销通知台:发布 / 改写 / 熄灭 / 两份读数。 */
38
42
  export interface UndoNoticeScene {
39
43
  /** 移入回收站成功后发布一条撤销提示(单条)。 */
40
- publishOne(input: {
41
- entryId: string;
42
- title: string;
43
- archived?: boolean;
44
- }): void;
44
+ publishOne(input: UndoInput<'one'>): void;
45
45
  /** 批量移入回收站成功后发布一条撤销提示:覆盖上一条,只报这一次移走的条数(部分失败同屏随行)。 */
46
- publishBatch(input: {
47
- entryIds: readonly string[];
48
- n: number;
49
- archived?: boolean;
50
- partialFailure?: UndoPartialFailure;
51
- }): void;
46
+ publishBatch(input: UndoInput<'batch'>): void;
52
47
  /** 整条横幅不再留。 */
53
48
  clear(): void;
54
49
  /** 指向这些条目的横幅熄掉(任一命中就清整条;清空回收站按发起时名单调它)。 */
@@ -70,17 +65,8 @@ export interface UndoNoticeScene {
70
65
  reset(): void;
71
66
  }
72
67
  export declare function createUndoNoticeScene(): UndoNoticeScene;
73
- export declare function publishUndoNotice(input: {
74
- entryId: string;
75
- title: string;
76
- archived?: boolean;
77
- }): void;
78
- export declare function publishUndoBatchNotice(input: {
79
- entryIds: readonly string[];
80
- n: number;
81
- archived?: boolean;
82
- partialFailure?: UndoPartialFailure;
83
- }): void;
68
+ export declare function publishUndoNotice(input: UndoInput<'one'>): void;
69
+ export declare function publishUndoBatchNotice(input: UndoInput<'batch'>): void;
84
70
  /** 整条横幅不再留(默认场景)。清空回收站不走这里:它按发起时名单调 `dismissUndoNotice`。 */
85
71
  export declare function clearUndoNotice(): void;
86
72
  export declare function dismissUndoNotice(entryIds: readonly string[]): void;
@@ -96,3 +82,4 @@ export declare function failNotice(current: UndoNotice, message: string): void;
96
82
  export declare function publishFailureNotice(message: string): void;
97
83
  /** 批量失败原文的唯一拼法(按出现序去重,用 ` · ` 拼接;无失败回 `undefined`)。 */
98
84
  export declare function formatBatchFailureReasons(failures: ReadonlyMap<string, string>): string | undefined;
85
+ export {};
@@ -6,7 +6,8 @@
6
6
  * 官方还有 `toolbar` 变体与 `className` 之外的转发面,这里不铺开。
7
7
  *
8
8
  * **转发 `ref`**:官方把 `ref` 交给原生按钮("for focus management and overlay anchors"),
9
- * `Modal` 的初始焦点与外壳的对齐测量都吃这个。React 18 的 `forwardRef` 与官方实现同形。
9
+ * `Modal` 的初始焦点与外壳的对齐测量都吃这个。`forwardRef` 在宿主两代(18 / 19)里都能用
10
+ * ——19 把 `ref` 也算普通 prop,但 `forwardRef` 没有移除,官方实现同形。
10
11
  */
11
12
  import { type ButtonHTMLAttributes, type ReactNode } from 'react';
12
13
  import './styles.js';
@@ -2,15 +2,16 @@
2
2
  * 槽位条目的**错误边界**:单个贡献在渲染期抛错时只画一块本地化占位,不把宿主那一格打空,
3
3
  * 更不让整棵槽位树跟着白屏。原错与组件栈留给 `console.error`(诊断不吞)。
4
4
  *
5
- * 为什么是 class:React 18 里只有 class 的 `getDerivedStateFromError` / `componentDidCatch`
5
+ * 为什么是 class:宿主两代(18 / 19)里只有 class 的 `getDerivedStateFromError` / `componentDidCatch`
6
6
  * 能接住渲染期异常,函数组件 + hook 没有等价物。
7
7
  *
8
8
  * 边界只包**渲染期**:事件处理器 / 异步回调里的抛错不经过它,那些地方各自有失败面(`RemoteOutcome`、
9
9
  * 行失败原文等)。也**不提供重试按钮**:一条贡献崩了通常是这一代宿主契约变了,原样重渲染只会再崩
10
10
  * 一次;刷新页面 / HMR 换代才是恢复路径。文案由注册处按 `t` 给(见 `copy.ts`)。
11
+ *
12
+ * 场景实例**不**在这里进子树:包装件住 `src/client/host/guard.tsx`,边界保持通用(`ui/` 是库,不 import 上层)。
11
13
  */
12
- import { Component, type ComponentType, type ErrorInfo, type ReactNode } from 'react';
13
- import { type ClientScene } from '../scene.js';
14
+ import { Component, type ErrorInfo, type ReactNode } from 'react';
14
15
  export interface ErrorBoundaryProps {
15
16
  /** 崩溃时上屏的本地化文案(注册处按 `t` 给)。 */
16
17
  fallback: string;
@@ -25,9 +26,4 @@ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBo
25
26
  componentDidCatch(error: unknown, info: ErrorInfo): void;
26
27
  render(): ReactNode;
27
28
  }
28
- /**
29
- * 把一条槽位贡献包进边界:注册表里登记的组件就是这一层。`displayName` 带上来源,测试与
30
- * 宿主调试面板都能一眼看出这是被隔离过的那颗。
31
- */
32
- export declare function withErrorBoundary<P extends object>(Wrapped: ComponentType<P>, fallback: string, scene?: ClientScene): ComponentType<P>;
33
29
  export {};
@@ -4,9 +4,10 @@
4
4
  *
5
5
  * **保留下来的行为**(官方"用户真的依赖"的那几条,`references/practices.md` 点名了 Modal 的焦点与
6
6
  * Escape):`role="dialog"` + `aria-modal` + `aria-label`(标题即是可及名)、蒙层点击关闭、
7
- * Escape 关闭、Tab 在框内循环、打开时把焦点送进框(首个 `[data-modal-autofocus]`,没有就首个可聚焦
8
- * 元素,再没有就框本体)、关闭后把焦点还给打开它的那个元素、自动焦点不留焦点环
9
- * (`data-dsh-automatic-focus`,宿主主题读它来抑制 outline——键盘导航或 blur 即恢复)。
7
+ * Escape 关闭、Tab 在框内循环、打开时把焦点送进框(首个 `[data-modal-autofocus]`;标记了却不可聚焦、
8
+ * 或没有标记,就首个可聚焦元素,再没有就框本体)、关闭后把焦点还给打开它的那个元素、自动焦点不留焦点环
9
+ * (`data-dsh-automatic-focus`,宿主主题读它来抑制 outline——键盘导航或 blur 即恢复);标题用 `h1`
10
+ * (模态是 top layer 里作用域的第一枚标题,指南 `dialog`)。
10
11
  *
11
12
  * **砍掉的**(本插件用不到,砍掉是为了不摊开官方整个 Modal API):
12
13
  * - `description` / `headless` / `className` / `contentClassName` / `onKeyDownCapture` /
@@ -14,7 +14,12 @@
14
14
  * `actions[].prefix`(动作文案前的连接词,本插件只用「撤销」两个字)。**没砍 `text`/`icon`/`tone`/
15
15
  * `holdMs`/`actions`/`onDone`**:唯一的调用点这几样都在用。
16
16
  * **本插件加的**:`paused`(撤销在飞时冻结停留与淡出,失败原文要落回同一条横幅;官方没有这个开关);
17
- * `detail`(排在动作按钮之后的副行槽位,撤销横幅放写入进度行,避免块级节点把按钮挤到下一行)。
17
+ * `detail`(排在动作按钮之后的副行槽位,撤销横幅放写入进度行,避免块级节点把按钮挤到下一行);
18
+ * `regionLabel` / `closeLabel` 与随之而来的三条行为(**焦点不加权重的三条,见
19
+ * `references` 里 `persistent-toast-notifications` 指南**):① 焦点在横幅里的控件上时**暂停自动熄灭**
20
+ * (否则键盘用户 Tab 到「撤销」后 6s 横幅消失、焦点掉回 `body`);② 显式关闭钮(`closeLabel`),
21
+ * 可聚焦但不自动抢焦点;③ 横幅统一挂进 `role="region"` 的容器(同一处,读屏能按区域名找回来),
22
+ * 手动关掉时把焦点还给挂载那一刻的落点。
18
23
  */
19
24
  import { type ReactElement, type ReactNode } from 'react';
20
25
  import './styles.js';
@@ -36,9 +41,14 @@ export interface ToastProps {
36
41
  holdMs?: number;
37
42
  /** 句尾的行内动作(照着句子的顺序排)。 */
38
43
  actions?: readonly ToastAction[] | undefined;
39
- /** 暂停自动熄灭:这一趟还有下文(撤销在飞),先把横幅留着——失败原文要靠它上屏。 */
44
+ /** 暂停自动熄灭:这一趟还有下文(撤销在飞),先把横幅留着——失败原文要靠它上屏。
45
+ * 焦点停在横幅里的控件上时组件自己也走这一档(见 `focusInside`),两条合并生效。 */
40
46
  paused?: boolean | undefined;
47
+ /** 横幅容器的可及名(`role="region"`):缺省不建容器,直接挂 `body`(直接渲染原语的测试面如此)。 */
48
+ regionLabel?: string | undefined;
49
+ /** 显式关闭钮的可及名;缺省时不出关闭钮(同上的原语直渲面)。 */
50
+ closeLabel?: string | undefined;
41
51
  /** 淡出完成时调用一次:在这里卸载。 */
42
52
  onDone: () => void;
43
53
  }
44
- export declare function Toast({ text, detail, icon, tone, holdMs, actions, paused, onDone }: ToastProps): ReactElement;
54
+ export declare function Toast({ text, detail, icon, tone, holdMs, actions, paused, regionLabel, closeLabel, onDone }: ToastProps): ReactElement;
@@ -14,8 +14,9 @@
14
14
  * (本插件唯一一处用的是零延迟默认值)。**没有砍掉 `side`/`gap`**:定位数学是三行分支,
15
15
  * 留着才与官方同形。
16
16
  *
17
- * **与官方的一处差异**:官方把锚点自己的 `ref` 与它的 `ref` 合并后一起挂;这里要求锚点**不带
18
- * 自己的 ref**(本插件唯一的调用点是一个裸 `<span>`),所以直接挂。要合并再补。
17
+ * **与官方的一处差异**:官方把锚点自己的 `ref` 与它的 `ref` 合并后一起挂;这里 `cloneElement`
18
+ * 会直接覆写 `children` 的 `ref`,因此要求锚点**不带自己的 ref**(现有调用点为 `<span>` 与 `<button>`,
19
+ * 均未自带 `ref`)。以后若需传 `ref` 给锚点,再补 ref 合并。
19
20
  */
20
21
  import { type ReactElement } from 'react';
21
22
  import './styles.js';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * 浮层挂锚点的两份纯数学:**竖直翻转**与**横向夹边**。Tooltip 与拖放胶囊(`trash-entry.tsx`)
3
+ * 各抄过一份同样的分支,这里收成唯一实现——两处再各自演进,视口边界行为就会开始分叉。
4
+ *
5
+ * 为什么是 JS 而不是 CSS:`position-area` + `position-try-fallbacks: flip-block, flip-inline`
6
+ * 正是这件事的现代写法,但锚点定位目前是 **Limited availability**(Chrome 157 / Safari 27,
7
+ * Firefox 不支持),现在换过去等于让 Firefox 拿到一个没有锚定的框。这份实现就是指南
8
+ * `viewport-aware-dropdowns` 认可的那份 fallback;等锚点定位进 Baseline,把这两个函数删掉、
9
+ * 换成一屏 CSS 即可(调用点只有两处)。
10
+ *
11
+ * 只做两件事,不认识 DOM、不读全局:入参给视口与锚点盒,出参给落点。
12
+ */
13
+ /** 竖直方向的落点:`top` = 气泡底缘贴锚点顶(调用方按 -100% 位移或自己减高度),`bottom` = 气泡顶缘贴锚点底。 */
14
+ export type BlockPlacement = 'top' | 'bottom';
15
+ export interface BlockFitOptions {
16
+ /** 锚点盒在视口坐标里的上下缘。 */
17
+ readonly anchorTop: number;
18
+ readonly anchorBottom: number;
19
+ /** 气泡自己的高度(量过之后才调;未量到不要调)。 */
20
+ readonly blockSize: number;
21
+ /** 首选方位。 */
22
+ readonly preferred: BlockPlacement;
23
+ /** 锚点到气泡的距离。 */
24
+ readonly gap: number;
25
+ /** 视口四边的安全边距。 */
26
+ readonly edgeMargin: number;
27
+ /** 视口高度。 */
28
+ readonly viewportBlockSize: number;
29
+ }
30
+ export interface BlockFit {
31
+ /** 实际方位:首选侧装不下、另一侧装得下时翻面,两边都装不下就维持首选。 */
32
+ readonly placement: BlockPlacement;
33
+ /** 竖直落点:`top` 方位是气泡**底缘**,`bottom` 方位是气泡**顶缘**(视口坐标)。 */
34
+ readonly boundary: number;
35
+ }
36
+ /** 竖直翻转:装不下就翻到另一侧,翻不过去就维持首选(宁可贴边,也不跳到没有锚定的位置)。 */
37
+ export declare function fitBlock(options: BlockFitOptions): BlockFit;
38
+ /**
39
+ * 横向夹边:给定元素**中心**与宽度,把它夹进「左右各留 `edgeMargin`」的视口里,返回左缘坐标。
40
+ * 元素比视口还宽时按左缘贴边收口(先 `min` 后 `max`),不会算出负的左缘——与两份旧实现同序。
41
+ */
42
+ export declare function clampInline(center: number, size: number, edgeMargin: number, viewportSize: number): number;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 本插件 UI 层要用的图标。除**两枚自绘字形**(恢复箭头与开盖垃圾桶)外逐条抄自
2
+ * 本插件 UI 层要用的图标。除**五枚自绘字形**(恢复箭头、开盖垃圾桶、检索放大镜、多选两态)外逐条抄自
3
3
  * `@deepseek-ai/dsh-client-ui-primitives` 的明文产物(出处与改写规则见 `ui.css` 头注)。
4
4
  *
5
5
  * 只留本插件用到的:垃圾桶(常规与开盖)、警示、文件夹(开盖填充 / 闭盒描边)、**实心三角**(分组头悬停时的
@@ -9,12 +9,17 @@
9
9
  * 官方每个字形自带自己的格子:多数 16×16,`unarchive-outline` 是 20×20(官方默认 `size` 也跟着格子走),
10
10
  * 所以共用外框 `IconFrame` 的 `viewBox` 可覆盖,默认仍是 16×16。
11
11
  *
12
- * **两枚自绘字形**:
12
+ * **五枚自绘字形**:
13
13
  * - `IconRestoreOutlineRegular`(回收站行的「恢复」):官方 `unarchive-outline` 说的是
14
14
  * "从归档里放出来",对"把删掉的会话放回去"不表意、轮廓又与归档动作的"箱子"太近,`refresh-outline`
15
15
  * (顺时针圆箭头)读起来是"刷新"。归档档的「解除归档」则正用官方 `unarchive-outline`——宿主工作区行的
16
16
  * 同名动作就是那一枚(同为 `size={14}`)。自绘的 ↩ 沿用宿主 16×16 / 1px 描边的一族几何,不伪装成官方图标。
17
17
  * - `IconTrashOpen`(拖放投放悬停/提交时的开盖垃圾桶):宿主原语库没有开盖字形,按同一 16×16 / 1px 描边自绘。
18
+ * - `IconSearchOutlineRegular`(检索框与结果视图):官方集里没有放大镜字形,按同一 16×16 / 1px 描边自绘。
19
+ * - `IconMultiSelectStack`(「多选」入口):官方集里没有「多选 / 多份选择」字形,取自用户 2026-12-02 样张、
20
+ * 按同一 16×16 / 1px 描边重画(叠层勾选框:前框 + 勾 + 右下一条叠层线,比单框更达意)。
21
+ * - `IconMultiSelectExit`(「退出多选」):同一份用户样张的「框 + 叉」,多选态检索框已退场,这枚叉不与
22
+ * 清除 ✕ 同排出现。
18
23
  *
19
24
  * 两条与官方实现的差异(都是减法,不是改写):
20
25
  * - 只暴露 `size`:调用处只传 `size`,不摊开官方整个图标 API。
@@ -48,6 +53,8 @@ export declare function IconTriangleRightFillRegular({ size }: IconProps): React
48
53
  export declare function IconChevronDownOutlineRegular({ size }: IconProps): ReactElement;
49
54
  /** 折叠头与子会话导航行「已折叠 / 前进」那一枚(官方 `IconChevronRightOutlineRegular`)。 */
50
55
  export declare function IconChevronRightOutlineRegular({ size }: IconProps): ReactElement;
56
+ /** 检索:**本插件自绘**的放大镜(16×16 / 1px,与宿主图标同一族几何)——官方原语集里没有放大镜字形。 */
57
+ export declare function IconSearchOutlineRegular({ size }: IconProps): ReactElement;
51
58
  /** 行内「恢复」:**本插件自绘**的回退箭头(↩,16×16 / 1px,与宿主图标同一族几何)。
52
59
  * 官方集里的 `unarchive` 与归档动作的"箱子"轮廓太近、`refresh` 读作"刷新",都不合适。 */
53
60
  export declare function IconRestoreOutlineRegular({ size }: IconProps): ReactElement;
@@ -56,3 +63,7 @@ export declare function IconRestoreOutlineRegular({ size }: IconProps): ReactEle
56
63
  export declare function IconUnarchiveOutlineRegular({ size }: IconProps): ReactElement;
57
64
  /** 子会话行的前导:官方 `IconBranchOutlineRegular`(16×16)。 */
58
65
  export declare function IconBranchOutlineRegular({ size }: IconProps): ReactElement;
66
+ /** 进入多选:**本插件自绘**的叠层勾选框(16×16 / 1px;源自用户 2026-12-02 样张,按本族重画)。 */
67
+ export declare function IconMultiSelectStack({ size }: IconProps): ReactElement;
68
+ /** 退出多选:**本插件自绘**的框 + 叉(16×16 / 1px;同一份用户样张)。 */
69
+ export declare function IconMultiSelectExit({ size }: IconProps): ReactElement;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `inert` 的跨代写法。宿主两代的语义不同(0.2.3-alpha.2 起 Web / 桌面外壳换成 React 19):
3
+ *
4
+ * - **React 18**:`inert` 不在它的 DOM 类型面里,属性值按字符串原样写进元素;传 boolean 会报未知布尔属性告警;
5
+ * - **React 19**:类型面把它声明成 boolean,且**空串按 false 处理**(属性被摘掉并报 `console.error`);
6
+ * 同时 dev `validateProperty` 对内置布尔属性 `inert` 传入字面量字符串 `'true'` / `'false'` 也会报 `console.error`。
7
+ *
8
+ * 两代都要「属性在场上且控制台零告警」只有传入 HTML 布尔属性规范名 `'inert'`:
9
+ * 在 18 里原样落成 `inert="inert"`,在 19 里绕过 `'true'`/`'false'` 拦截并按 truthy 落成 `inert=""`;
10
+ * 两者都没有告警。返回值声明成 `object` 是为了绕开 React 19 的 boolean 类型声明——这是给 DOM 的值,
11
+ * 不是给类型面的值。
12
+ *
13
+ * 反面的代价写在调用点:不要把 `inert` 写成 `''`(19 下静默失效,正文在保持期仍可交互)或 `'true'`(19 dev 报错)。
14
+ */
15
+ export declare function inertProps(on: boolean): object;