@xiongtao.xt/tau-plugins 0.58.0 → 0.60.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 (123) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/docs/editor-interactions.md +55 -0
  3. package/docs/pages.md +71 -2
  4. package/docs/portability.md +2 -0
  5. package/docs/references.md +2 -0
  6. package/docs/settings-and-commands.md +3 -0
  7. package/docs/whiteboard.md +1 -1
  8. package/package.json +1 -1
  9. package/publish-artifacts.js +35 -26
  10. package/tailwind.css +3 -3
  11. package/types/packages/collaboration/src/document-history-edit.d.ts +11 -0
  12. package/types/packages/collaboration/src/document-history.d.ts +91 -0
  13. package/types/packages/collaboration/src/index.d.ts +2 -0
  14. package/types/packages/collaboration/src/node-document.d.ts +1 -1
  15. package/types/packages/collaboration/src/node-tree.d.ts +7 -0
  16. package/types/packages/collaboration/src/whiteboard-model.d.ts +33 -2
  17. package/types/packages/db-schema/content-identities.d.ts +1 -1
  18. package/types/packages/editor/src/core/CoreEditor.d.ts +10 -1
  19. package/types/packages/editor/src/core/api/extension.d.ts +0 -1
  20. package/types/packages/editor/src/core/api/index.d.ts +3 -1
  21. package/types/packages/editor/src/core/utils/nodeOperations.d.ts +1 -0
  22. package/types/packages/editor/src/core/utils/undoStep.d.ts +6 -0
  23. package/types/packages/editor/src/core/utils/wrapInlineText.d.ts +4 -0
  24. package/types/packages/editor/src/extensions/kbd/src/types.d.ts +2 -2
  25. package/types/packages/editor/src/extensions/link/src/types.d.ts +2 -2
  26. package/types/packages/editor/src/extensions/styled-text/src/types.d.ts +2 -2
  27. package/types/packages/editor/src/extensions/underline/src/types.d.ts +2 -2
  28. package/types/packages/markdown/src/codec.d.ts +6 -2
  29. package/types/packages/markdown/src/markdown.d.ts +2 -1
  30. package/types/packages/markdown/src/positionMapper.d.ts +7 -1
  31. package/types/packages/plugins/src/app.d.ts +2 -0
  32. package/types/packages/plugins/src/contract.d.ts +2 -0
  33. package/types/packages/plugins/src/index.d.ts +2 -1
  34. package/types/packages/plugins/src/pages.d.ts +8 -2
  35. package/types/packages/plugins/src/text-decorations.d.ts +68 -0
  36. package/types/packages/shared/src/chat-core/aiRunProtocol.d.ts +1 -1
  37. package/types/packages/shared/src/chat-core/messages.d.ts +13 -4
  38. package/types/packages/themes/src/themes/ink.theme.d.ts +1 -2
  39. package/types/packages/themes/src/themes/mint.theme.d.ts +1 -2
  40. package/types/packages/themes/src/themes/ocean.theme.d.ts +1 -2
  41. package/types/packages/themes/src/themes/paper.theme.d.ts +1 -2
  42. package/types/packages/themes/src/themes/sakura.theme.d.ts +1 -2
  43. package/types/packages/themes/src/themes/wisteria.theme.d.ts +1 -2
  44. package/types/packages/ui/src/cn.d.ts +1 -1
  45. package/types/packages/ui/src/primitives/AnchoredPanel.d.ts +3 -3
  46. package/types/packages/ui/src/primitives/Button.d.ts +4 -4
  47. package/types/packages/ui/src/primitives/Checkbox.d.ts +2 -2
  48. package/types/packages/ui/src/primitives/ConfirmDialog.d.ts +3 -3
  49. package/types/packages/ui/src/primitives/Dialog.d.ts +4 -4
  50. package/types/packages/ui/src/primitives/Loading.d.ts +1 -1
  51. package/types/packages/ui/src/primitives/Menu.d.ts +1 -1
  52. package/types/packages/ui/src/primitives/Notification.d.ts +2 -2
  53. package/types/packages/ui/src/primitives/Popover.d.ts +3 -3
  54. package/types/packages/ui/src/primitives/Radio.d.ts +2 -3
  55. package/types/packages/ui/src/primitives/RadioGroup.d.ts +1 -1
  56. package/types/packages/ui/src/primitives/Segmented.d.ts +3 -3
  57. package/types/packages/ui/src/primitives/Select.d.ts +6 -6
  58. package/types/packages/ui/src/primitives/Switch.d.ts +2 -2
  59. package/types/packages/ui/src/primitives/Tag.d.ts +2 -3
  60. package/types/packages/ui/src/primitives/Toast.d.ts +1 -1
  61. package/types/packages/ui/src/primitives/Tooltip.d.ts +5 -5
  62. package/types/packages/ui/src/primitives/ValueDisplay.d.ts +2 -3
  63. package/types/packages/ui/src/primitives/anchoredPosition.d.ts +1 -2
  64. package/types/packages/ui/src/primitives/datepicker/DatePicker.d.ts +2 -2
  65. package/types/packages/ui/src/primitives/datepicker/DateRangePicker.d.ts +1 -1
  66. package/types/packages/ui/src/primitives/input/Input.d.ts +4 -4
  67. package/types/packages/ui/src/primitives/input/NumberInput.d.ts +2 -2
  68. package/types/packages/ui/src/primitives/input/Textarea.d.ts +1 -1
  69. package/types/packages/whiteboard/src/Board.d.ts +28 -12
  70. package/types/packages/whiteboard/src/{WhiteBoard.d.ts → Whiteboard.d.ts} +6 -6
  71. package/types/packages/whiteboard/src/chrome/index.d.ts +4 -2
  72. package/types/packages/whiteboard/src/components/ArrowConnectPoint/index.d.ts +26 -0
  73. package/types/packages/whiteboard/src/components/ArrowConnectPointGroup/index.d.ts +3 -0
  74. package/types/packages/whiteboard/src/components/DocumentElement/index.d.ts +2 -0
  75. package/types/packages/whiteboard/src/components/ExcerptElement/index.d.ts +13 -0
  76. package/types/packages/whiteboard/src/components/SketchPopover.d.ts +1 -1
  77. package/types/packages/whiteboard/src/constants/arrow.d.ts +0 -2
  78. package/types/packages/whiteboard/src/constants/mind.d.ts +0 -13
  79. package/types/packages/whiteboard/src/constants/text-style.d.ts +1 -1
  80. package/types/packages/whiteboard/src/constants/tools.d.ts +3 -0
  81. package/types/packages/whiteboard/src/context.d.ts +1 -2
  82. package/types/packages/whiteboard/src/extensions/api.d.ts +6 -1
  83. package/types/packages/whiteboard/src/extensions/authorApi.d.ts +0 -1
  84. package/types/packages/whiteboard/src/extensions/events.d.ts +0 -1
  85. package/types/packages/whiteboard/src/hooks/useDropArrow.d.ts +1 -1
  86. package/types/packages/whiteboard/src/hooks/useReadonly.d.ts +1 -0
  87. package/types/packages/whiteboard/src/hooks/useSelectState.d.ts +0 -1
  88. package/types/packages/whiteboard/src/hooks/useZoom.d.ts +6 -0
  89. package/types/packages/whiteboard/src/index.d.ts +11 -6
  90. package/types/packages/whiteboard/src/interactions/InteractionManager.d.ts +1 -0
  91. package/types/packages/whiteboard/src/plugins/ArrowPlugin.d.ts +1 -1
  92. package/types/packages/whiteboard/src/plugins/ColumnPlugin.d.ts +1 -1
  93. package/types/packages/whiteboard/src/plugins/CommonPlugin.d.ts +10 -10
  94. package/types/packages/whiteboard/src/plugins/DocumentPlugin.d.ts +36 -3
  95. package/types/packages/whiteboard/src/plugins/ExcerptPlugin.d.ts +48 -0
  96. package/types/packages/whiteboard/src/plugins/FramePlugin.d.ts +1 -1
  97. package/types/packages/whiteboard/src/plugins/GeometryPlugin.d.ts +5 -2
  98. package/types/packages/whiteboard/src/plugins/MindPlugin.d.ts +2 -2
  99. package/types/packages/whiteboard/src/plugins/WebviewPlugin.d.ts +1 -1
  100. package/types/packages/whiteboard/src/plugins/{WhiteBoardPlugin.d.ts → WhiteboardPlugin.d.ts} +8 -5
  101. package/types/packages/whiteboard/src/plugins/index.d.ts +2 -1
  102. package/types/packages/whiteboard/src/public.d.ts +23 -1
  103. package/types/packages/whiteboard/src/types/board.d.ts +12 -10
  104. package/types/packages/whiteboard/src/types/element.d.ts +6 -1
  105. package/types/packages/whiteboard/src/types/operation.d.ts +1 -1
  106. package/types/packages/whiteboard/src/types/selection.d.ts +1 -1
  107. package/types/packages/whiteboard/src/types/sketch.d.ts +2 -2
  108. package/types/packages/whiteboard/src/types/viewport.d.ts +1 -1
  109. package/types/packages/whiteboard/src/utils/ArrowStyleUtil.d.ts +0 -1
  110. package/types/packages/whiteboard/src/utils/CanvasUtil.d.ts +0 -1
  111. package/types/packages/whiteboard/src/utils/ClipboardUtil.d.ts +0 -5
  112. package/types/packages/whiteboard/src/utils/GeometryUtil.d.ts +1 -1
  113. package/types/packages/whiteboard/src/utils/HandwriteUtil.d.ts +0 -1
  114. package/types/packages/whiteboard/src/utils/MindUtil.d.ts +0 -3
  115. package/types/packages/whiteboard/src/utils/PathUtil.d.ts +1 -1
  116. package/types/packages/whiteboard/src/utils/PointUtil.d.ts +0 -1
  117. package/types/packages/whiteboard/src/utils/PresentationManager.d.ts +1 -1
  118. package/types/packages/whiteboard/src/utils/TextStyleStore.d.ts +2 -1
  119. package/types/packages/whiteboard/src/utils/index.d.ts +0 -1
  120. package/types/packages/whiteboard/src/utils/sketch/handText.d.ts +1 -1
  121. package/types/packages/whiteboard/src/utils/sketch/index.d.ts +4 -5
  122. package/types/packages/whiteboard/src/utils/sketch/shape.d.ts +1 -2
  123. package/types/packages/whiteboard/src/utils/ViewportUtil.d.ts +0 -10
@@ -1,9 +1,9 @@
1
1
  import { WhiteboardPresentations } from "./whiteboard-presentation";
2
2
  import * as Y from "yjs";
3
3
  import { type PreparedWhiteboardContract, type PreparedContentContract, type ContentContractDictionary, type DataContract } from "../../db-schema/content-contracts";
4
- import { NodeTree } from "./node-tree";
4
+ import { NodeTree, type NodeTextEdit } from "./node-tree";
5
5
  import { NodeTreeHistory, type NodeTreeHistoryOptions } from "./node-tree-history";
6
- import type { WhiteboardModelCommand, WhiteboardReference, WhiteboardSnapshot } from "./whiteboard-types";
6
+ import type { WhiteboardElementSnapshot, WhiteboardGeometry, WhiteboardModelCommand, WhiteboardReference, WhiteboardSnapshot } from "./whiteboard-types";
7
7
  /** 纯协作模型;宿主负责权限、耐久会话和插件版本保护,模型不连接画布。 */
8
8
  export declare class WhiteboardModel {
9
9
  readonly doc: Y.Doc;
@@ -21,7 +21,10 @@ export declare class WhiteboardModel {
21
21
  private readonly histories;
22
22
  private disposed;
23
23
  private revision;
24
+ private translationBudget?;
24
25
  private pending?;
26
+ /** 缺依赖期间复用已提交状态的编码,每份输入仍在独立候选上校验。 */
27
+ private pendingBase?;
25
28
  private queuedBytes;
26
29
  private incoming;
27
30
  private readonly changed;
@@ -48,15 +51,28 @@ export declare class WhiteboardModel {
48
51
  preflightHistory(history: NodeTreeHistory, direction: "undo" | "redo"): void;
49
52
  private preparedAdditions;
50
53
  withPreparedContracts(prepared: readonly (PreparedWhiteboardContract | PreparedContentContract)[], write: (model: WhiteboardModel) => void, origin: unknown): void;
54
+ /** 普通文本只修改已有段落的字符;结构变更、复杂标记与容量临界由完整候选处理。 */
55
+ tryLocalBodyEdit(target: string, edit: NodeTextEdit, origin: object): {
56
+ isolated: boolean;
57
+ } | undefined;
51
58
  /** 大批导入分段预检,最终以一个增量进入当前视图历史。 */
52
59
  submitChunks(commands: readonly WhiteboardModelCommand[], origin: unknown, prepared?: readonly (PreparedWhiteboardContract | PreparedContentContract)[], initialBodies?: readonly {
53
60
  id: string;
54
61
  preserveIds?: boolean;
55
62
  body: readonly import("./protocol").ContentNode[];
56
63
  }[]): void;
64
+ /** 为已打开的画布准备位置提交。无法证明基线有效时,调用方仍使用完整的隔离候选。 */
65
+ prepareLocalTranslations(): void;
66
+ /** 仅平移一个现有标量几何。返回 undefined 时没有写入,由调用方执行原有预检。 */
67
+ tryLocalTranslation(target: string, value: WhiteboardGeometry, origin: unknown): {
68
+ isolated: boolean;
69
+ } | undefined;
70
+ /** 笔迹只在页根创建父笔与分段。用同契约、同父级的小候选预演原命令。 */
71
+ private strokeTrial;
57
72
  /** 在隔离副本中验证整批及编码大小,失败不改变真实文档或撤销栈。 */
58
73
  submit(commands: readonly WhiteboardModelCommand[], origin: unknown, prepared?: readonly (PreparedWhiteboardContract | PreparedContentContract)[]): {
59
74
  readonly createdIds: readonly string[];
75
+ readonly isolatedStroke?: true;
60
76
  };
61
77
  private execute;
62
78
  private initialize;
@@ -69,8 +85,21 @@ export declare class WhiteboardModel {
69
85
  private erase;
70
86
  private edit;
71
87
  private executeOne;
88
+ private elementUsage;
72
89
  private assertBudget;
73
90
  private validateState;
91
+ private visiblePageReferences;
92
+ readElementIdentity(target: string): {
93
+ type: string;
94
+ contractId: string;
95
+ } | undefined;
96
+ readSummary(): {
97
+ title: string;
98
+ pageCount: number;
99
+ };
100
+ private snapshotElement;
101
+ /** 绑定在已隔离的追加事务后复用同一笔的前缀。 */
102
+ readAppendedStroke(id: string, segmentId: string, prefix: readonly WhiteboardElementSnapshot[]): WhiteboardElementSnapshot;
74
103
  read(): WhiteboardSnapshot;
75
104
  /** 服务端校验完整候选,已有记录的物理身份不能被普通更新替换。 */
76
105
  validate(previous?: WhiteboardModel): Promise<void>;
@@ -80,6 +109,8 @@ export declare class WhiteboardModel {
80
109
  }>;
81
110
  /** 将未接纳的缺依赖材料交还宿主保全;不能在接收仍进行时清空。 */
82
111
  takePendingUpdate(): Uint8Array | undefined;
112
+ /** 已有结构和删除均被覆盖时,增量不会改变文档。需要打开富文本根的校验仍使用隔离候选。 */
113
+ private isReadOnlyReplay;
83
114
  private receiveNow;
84
115
  private assertStableRecords;
85
116
  }
@@ -1,4 +1,4 @@
1
- export declare const CONTENT_ENTITY_KINDS: readonly ["whiteboard-content", "data-table", "project-item", "card", "article", "diary-moment", "whiteboard", "content", "video-note"];
1
+ export declare const CONTENT_ENTITY_KINDS: readonly ["whiteboard-content", "data-table", "project-item", "card", "article", "diary-moment", "whiteboard", "content", "video-note", "pdf"];
2
2
  export type ContentEntityKind = (typeof CONTENT_ENTITY_KINDS)[number];
3
3
  export interface ContentEntityReference {
4
4
  sourceId: string;
@@ -1,5 +1,6 @@
1
+ import { type ReactNode, type ReactElement } from "react";
1
2
  import type { Node, Path } from "slate";
2
- import { Descendant, Editor, Range } from "slate";
3
+ import { Descendant, Editor, Range, Element } from "slate";
3
4
  import type { EditorKit } from "./kit/EditorKit";
4
5
  import type { EditorDocument } from "./document/EditorDocument";
5
6
  import type { InlineSuggestionProvider } from "./inlineSuggestion/controller";
@@ -14,6 +15,7 @@ export interface IEditorProps {
14
15
  onChange?: (value: Descendant[], editor: Editor) => void;
15
16
  onSelectionChange?: () => void;
16
17
  readonly?: boolean;
18
+ ariaLabel?: string;
17
19
  /** 本编辑器的组成(扩展 + 服务 + 主题)。不传则继承外层编辑器的 kit */
18
20
  kit?: EditorKit;
19
21
  /**
@@ -35,6 +37,13 @@ export interface IEditorProps {
35
37
  decorate?: (entry: [Node, Path]) => Range[];
36
38
  /** 包装已经应用标记的内容,不接管 Slate attributes。 */
37
39
  leafWrapper?: ComponentType<MarkRenderProps>;
40
+ /** 宿主可延迟挂载顶层块的界面,节点仍属于完整编辑器。 */
41
+ renderTopLevelBlock?: (args: {
42
+ editor: Editor;
43
+ index: number;
44
+ element: Element;
45
+ children: ReactNode;
46
+ }) => ReactElement;
38
47
  /** 当前视图的行内纯文本建议来源。 */
39
48
  inlineSuggestions?: InlineSuggestionProvider;
40
49
  /**
@@ -133,6 +133,5 @@ export interface ElementContractDefinition {
133
133
  resources?: readonly ContentResourceSpec[];
134
134
  }
135
135
  export declare function assertElementVersions(spec: ElementContractDefinition): void;
136
- export declare const isEditorExtension: (value: unknown) => value is EditorExtension;
137
136
  /** 扩展贡献的元素类型 */
138
137
  export declare const elementTypesOf: (extension: EditorExtension) => string[];
@@ -36,9 +36,11 @@ export { default as InlineChromiumBugfix } from "../components/InlineChromiumBug
36
36
  export { default as useIsLastElement } from "../hooks/useIsLastElement";
37
37
  export { registerBlockNavigation, hasBlockNavigation, unregisterBlockNavigation, focusPreviousBlock, focusNextBlock, type BlockNavigationHandler, } from "../utils/blockNavigation";
38
38
  export { isCollapsed, getCurrentTextNode } from "../utils/editor";
39
- export { copyNodeToClipboard, deleteVoidBlock } from "../utils/nodeOperations";
39
+ export { copyNodeToClipboard, deleteVoidBlock, setSlateFragmentData, } from "../utils/nodeOperations";
40
40
  export { CONTENT_FRAGMENT_MIME, readContentFragment, setContentFragmentTransfer, } from "./clipboardFragment";
41
41
  export { getSelectionSnapshot, isSelectionSnapshotUnchanged } from "../utils/selectionSnapshot";
42
+ export { wrapInlineText } from "../utils/wrapInlineText";
43
+ export { withNewUndoStep } from "../utils/undoStep";
42
44
  export { createParagraph, isParagraphElement, type ParagraphElement } from "../model/paragraph";
43
45
  export { insertParagraphAndFocus } from "../utils/editor";
44
46
  export { isAtParagraphStart, isParagraphAndEmpty } from "../utils/editor";
@@ -1,5 +1,6 @@
1
1
  import { Editor, Node, Path } from "slate";
2
2
  import type { EditorFeedback } from "../services/notifier";
3
+ export declare function setSlateFragmentData(editor: Editor, data: DataTransfer, fragment: Node[], plainText: string, richContent?: DocumentFragment): void;
3
4
  /**
4
5
  * 复制节点到剪贴板
5
6
  * 支持两种格式:JSON 和纯文本;传入数组时按数组顺序作为一个 fragment,纯文本以换行连接
@@ -0,0 +1,6 @@
1
+ import type { Editor } from "slate";
2
+ export declare function registerUndoStepSplitter(editor: Editor, split: () => void): void;
3
+ /** `fn` 内的修改单独成一个撤销步,不与之前的输入合并 */
4
+ export declare function withNewUndoStep(editor: Editor, fn: () => void, { isolate }?: {
5
+ isolate?: boolean | undefined;
6
+ }): void;
@@ -0,0 +1,4 @@
1
+ import { Editor, Range } from "slate";
2
+ import type { InlineElement } from "../types/custom-element";
3
+ /** 只包裹同一父节点下连续的选中文字,避免 Slate 把部分选中的行内祖先整体移入。 */
4
+ export declare function wrapInlineText(editor: Editor, create: (range: Range) => InlineElement, at?: import("slate").BaseSelection): boolean;
@@ -1,5 +1,5 @@
1
- import { type FormattedText } from "../../../../../markdown/src/model";
1
+ import type { ParagraphElement } from "../../../../api";
2
2
  export interface KbdElement {
3
3
  type: "kbd";
4
- children: FormattedText[];
4
+ children: ParagraphElement["children"];
5
5
  }
@@ -1,6 +1,6 @@
1
- import { type FormattedText } from "../../../../../markdown/src/model";
1
+ import type { ParagraphElement } from "../../../../api";
2
2
  export interface LinkElement {
3
3
  type: "link";
4
4
  url: string;
5
- children: FormattedText[];
5
+ children: ParagraphElement["children"];
6
6
  }
@@ -1,7 +1,7 @@
1
- import { type FormattedText } from "../../../../../markdown/src/model";
1
+ import type { ParagraphElement } from "../../../../api";
2
2
  import type { EStyledColor } from "./colors";
3
3
  export interface StyledTextElement {
4
4
  type: "styled-text";
5
5
  color: EStyledColor;
6
- children: FormattedText[];
6
+ children: ParagraphElement["children"];
7
7
  }
@@ -1,8 +1,8 @@
1
- import { type FormattedText } from "../../../../../markdown/src/model";
1
+ import type { ParagraphElement } from "../../../../api";
2
2
  export interface UnderlineElement {
3
3
  type: "underline";
4
4
  color: string;
5
5
  lineType: string;
6
6
  colorSelectOpen: boolean;
7
- children: FormattedText[];
7
+ children: ParagraphElement["children"];
8
8
  }
@@ -73,6 +73,7 @@ export interface MarkdownCodec {
73
73
  nextSibling: Descendant | null;
74
74
  /** 按领域声明把块级子元素降级为行内形态,无声明则原样返回。 */
75
75
  demote: (child: Descendant) => Descendant;
76
+ isBlock: (child: Descendant) => boolean;
76
77
  }) => Descendant[] | null;
77
78
  /** 按目标类型贡献规范化,先于该类型自身 normalize;按 codec 顺序首个非 null 替换生效。 */
78
79
  normalizeFor?: Readonly<Record<string, NonNullable<MarkdownCodec["normalize"]>>>;
@@ -80,9 +81,12 @@ export interface MarkdownCodec {
80
81
  inlineForm?: (element: any) => Descendant;
81
82
  /**
82
83
  * 导入:从 code 节点(围栏或缩进代码块)认领的 void 元素,把源码区间记为
83
- * 该属性的属性级位置映射(如 code-block 的 "code");缺省只有元素级映射
84
+ * 该属性的位置映射;正文位于子节点时声明相对路径。缺省只有元素级映射。
84
85
  */
85
- fenceSourceProperty?: string;
86
+ fenceSourceProperty?: string | {
87
+ property: string;
88
+ path: readonly number[];
89
+ };
86
90
  /** 导出:子块级元素之间的接续符,默认 "\n\n";列表与表格声明 "\n" */
87
91
  childSeparator?: "\n" | "\n\n";
88
92
  }
@@ -15,6 +15,7 @@ export interface ImportConfig {
15
15
  textRegistry: MarkdownTextRegistry;
16
16
  directives: Record<string, CustomDirectiveHandler>;
17
17
  voidTypes: ReadonlySet<string>;
18
+ blockTypes: ReadonlySet<string>;
18
19
  inlineWrapperDirectives: ReadonlySet<string>;
19
20
  inlineHtmlWrappers?: ReadonlyMap<string, NonNullable<MarkdownCodec["inlineHtmlWrapper"]>>;
20
21
  fenceByLanguage: ReadonlyMap<string, {
@@ -22,7 +23,7 @@ export interface ImportConfig {
22
23
  property: string;
23
24
  }>;
24
25
  importNodes?: readonly NonNullable<MarkdownCodec["importNode"]>[];
25
- fenceSourceProperties?: ReadonlyMap<string, string>;
26
+ fenceSourceProperties?: ReadonlyMap<string, NonNullable<MarkdownCodec["fenceSourceProperty"]>>;
26
27
  normalizeHooks?: ReadonlyMap<string, NonNullable<MarkdownCodec["normalize"]>>;
27
28
  inlineForms?: ReadonlyMap<string, NonNullable<MarkdownCodec["inlineForm"]>>;
28
29
  }
@@ -27,6 +27,11 @@ export interface TextMapping {
27
27
  prefixLength: number;
28
28
  suffixLength: number;
29
29
  sourceOffsets?: readonly number[];
30
+ /** 多行导入时,正文各行在源码中的起点与文本偏移。 */
31
+ sourceLines?: readonly (MarkdownPosition & {
32
+ offset: number;
33
+ length: number;
34
+ })[];
30
35
  /** 手工改写的载体无法证明字符对应时,只提供首尾边界。 */
31
36
  opaque?: boolean;
32
37
  mdEnd?: MarkdownPosition;
@@ -39,7 +44,7 @@ export interface ElementMapping {
39
44
  type: "element";
40
45
  slateElementPath: number[];
41
46
  elementType: string;
42
- isVoid: true;
47
+ isVoid: boolean;
43
48
  mdStartLine: number;
44
49
  mdStartCh: number;
45
50
  mdEndLine: number;
@@ -50,6 +55,7 @@ export interface ElementMapping {
50
55
  mdStartCh: number;
51
56
  mdEndLine: number;
52
57
  mdEndCh: number;
58
+ mdLineColumns?: readonly number[];
53
59
  };
54
60
  };
55
61
  }
@@ -130,6 +130,8 @@ export interface PluginAppActionResults {
130
130
  export type PluginAppAction = keyof PluginAppActions;
131
131
  export declare const PLUGIN_APP_ACTIONS: readonly PluginAppAction[];
132
132
  export interface PluginApp {
133
+ /** 用户操作后在桌面主窗口的右栏查看 HTTP(S) 网页。 */
134
+ openWeb(url: string): Promise<void>;
133
135
  /**
134
136
  * 打开 Tau 的搜索选择弹窗,返回用户选中的内容;用户取消时返回空数组。
135
137
  * 用户亲手挑选即视为同意插件引用这些内容,不需要读取权限。只能在用户操作(点击、按键)后调用。
@@ -1,3 +1,4 @@
1
+ import type { PluginTextDecorations } from "./text-decorations";
1
2
  import type { PluginWindowDefinition, PluginWindows } from "./windows";
2
3
  import type { PluginPages } from "./pages";
3
4
  import type { PluginEnvironment } from "./environment";
@@ -83,6 +84,7 @@ export interface PluginContext {
83
84
  readonly home: PluginHome;
84
85
  /** 对象动作:卡片、文章、项目文档「⋯」菜单里的条目 */
85
86
  readonly actions: PluginActions;
87
+ readonly textDecorations?: PluginTextDecorations;
86
88
  /** 卡片、文章、项目文档详情里的区块 */
87
89
  readonly views: PluginViews;
88
90
  /** Notebook 的生成菜单里加产物;只在桌面主窗口 */
@@ -28,6 +28,7 @@ export type * from "./sidebar";
28
28
  export { SIDEBAR_GROUPS } from "./sidebar";
29
29
  export type * from "./icons";
30
30
  export type * from "./home";
31
+ export type * from "./text-decorations";
31
32
  export type * from "./actions";
32
33
  export { PLUGIN_ACTION_TARGET_KINDS } from "./actions";
33
34
  export type * from "./views";
@@ -57,7 +58,7 @@ export { usePluginServices } from "./service-access";
57
58
  export type { PluginMCP, PluginMCPDefinition, PluginMCPTool, PluginMCPTransport } from "./mcp";
58
59
  export type { PluginMCPToolResult } from "./mcp";
59
60
  export type { PluginChat, PluginToolRendererDefinition, PluginToolRendererProps, ToolCallExecutionState, } from "./chat";
60
- export type { PluginPageContext, PluginPageDefinition, PluginPageHandle, PluginPageParams, PluginPageProps, PluginPages, } from "./pages";
61
+ export type { PluginPageContext, PluginPageDefinition, PluginPageHandle, PluginPageParams, PluginPageProps, PluginPagePlacement, PluginPages, } from "./pages";
61
62
  export declare function definePlugin(definition: Omit<PluginDefinition, "apiVersion" | "create"> & Partial<Pick<PluginDefinition, "create">>): PluginDefinition;
62
63
  export type { PluginAI, PluginAIFeature, PluginAIRequest, PluginAIResult, PluginAIEvent, PluginAIFeatures, PluginAICapability, PluginAICapabilityClient, PluginAICapabilityRequest, PluginAIImage, PluginAIMessage, } from "./ai";
63
64
  export { PLUGIN_AI_CAPABILITIES, isPluginAICapability } from "./ai";
@@ -6,7 +6,7 @@ export interface PluginPageContext {
6
6
  /** 在组件 effect 中登记当前状态提供器;返回值的形状由插件决定。 */
7
7
  register(provider: () => JsonValue): Disposable;
8
8
  /**
9
- * 本页是否为当前显示的页面(在页面栈顶);页面隐藏、卸载或插件停用后为 false。
9
+ * 此展示位置的页面是否可见(完整页在栈顶,右栏在前台);页面隐藏、卸载或插件停用后为 false。
10
10
  * 页面隐藏时组件的 effect 会被清理、显示时重新执行,订阅与键盘监听放在 effect 里即可随之暂停;
11
11
  * 这里供命令等 effect 之外的回调判断。
12
12
  */
@@ -20,7 +20,9 @@ export interface PluginPageContext {
20
20
  */
21
21
  registerDismiss(dismiss: () => void): Disposable;
22
22
  }
23
+ export type PluginPagePlacement = "page" | "dock";
23
24
  export interface PluginPageProps {
25
+ readonly placement: PluginPagePlacement;
24
26
  readonly context: PluginContext;
25
27
  readonly params: Readonly<PluginPageParams>;
26
28
  readonly pageContext: PluginPageContext;
@@ -29,13 +31,17 @@ export interface PluginPageDefinition {
29
31
  id: string;
30
32
  title: string;
31
33
  component: ComponentType<PluginPageProps>;
34
+ /** 允许在桌面主窗口以 dock 打开。 */
35
+ dockable?: boolean;
32
36
  match?: "single" | "params";
33
37
  /** params 页缺省按完整参数区分实例;提供时只按该身份去重。 */
34
38
  getId?(params: Readonly<PluginPageParams>): string;
35
39
  }
36
40
  export interface PluginPageHandle extends Disposable {
37
41
  readonly id: string;
38
- open(params?: PluginPageParams): Promise<void>;
42
+ open(params?: PluginPageParams, options?: {
43
+ placement?: PluginPagePlacement;
44
+ }): Promise<void>;
39
45
  }
40
46
  export interface PluginPages {
41
47
  register(definition: PluginPageDefinition): PluginPageHandle;
@@ -0,0 +1,68 @@
1
+ import type { PluginContentLocation } from "./app";
2
+ import type { Disposable } from "./contract";
3
+ export interface PluginDecorationSource {
4
+ readonly kind: "card" | "article" | "document";
5
+ readonly id: string;
6
+ }
7
+ export interface PluginDecorationBlock {
8
+ readonly source: PluginDecorationSource;
9
+ readonly blockType: string;
10
+ readonly text: string;
11
+ }
12
+ /**
13
+ * 外观按打扰程度从低到高:
14
+ * - `dot`:文字不变,末尾一个小圆点
15
+ * - `ghost`:静止时点线极淡,悬停或按住 ⌘/Ctrl 才显出
16
+ * - `reference`:正文色文字 + 点线,悬停变实线
17
+ * - `tint`:只改字色
18
+ * - `marker`:下沿荧光笔底色
19
+ * - `wavy`:波浪下划线,适合提醒或待确认
20
+ *
21
+ * `dot`、`ghost`、`reference` 表示可以点击,必须提供 `key` 和 `onActivate`。
22
+ */
23
+ export type PluginTextDecorationAppearance = "reference" | "ghost" | "marker" | "tint" | "wavy" | "dot";
24
+ /** 主题里的语义色,深浅主题由宿主适配。 */
25
+ export type PluginTextDecorationTone = "accent" | "info" | "warn" | "muted";
26
+ export interface PluginTextDecoration {
27
+ /** 当前连续文本内的 UTF-16 偏移,左闭右开。 */
28
+ start: number;
29
+ end: number;
30
+ appearance: PluginTextDecorationAppearance;
31
+ /** 默认 `accent`。 */
32
+ tone?: PluginTextDecorationTone;
33
+ /** 有 key 的结果可以触发 onActivate。 */
34
+ key?: string;
35
+ /** 悬停提示,例如「打开文章《遗忘曲线》」。 */
36
+ label?: string;
37
+ }
38
+ /** onActivate 返回候选时,宿主在文字旁弹出菜单让用户选择。 */
39
+ export interface PluginTextDecorationCandidate {
40
+ key: string;
41
+ title: string;
42
+ description?: string;
43
+ }
44
+ export interface PluginTextDecorationActivation {
45
+ key: string;
46
+ source: PluginDecorationSource;
47
+ /** 用户在候选菜单里选中的 `candidate.key`;首次点击时为空。 */
48
+ choice?: string;
49
+ }
50
+ export interface PluginDecorationPreviewTarget {
51
+ ref: PluginDecorationSource;
52
+ at?: PluginContentLocation;
53
+ }
54
+ export interface PluginTextDecorationProvider {
55
+ sources: readonly PluginDecorationSource["kind"][];
56
+ getDecorations(block: PluginDecorationBlock, signal: AbortSignal): readonly PluginTextDecoration[] | Promise<readonly PluginTextDecoration[]>;
57
+ /** 停留在命中或候选上时解析目标;宿主负责授权检查和只读预览。 */
58
+ getPreview?(hit: PluginTextDecorationActivation, signal: AbortSignal): PluginDecorationPreviewTarget | undefined | Promise<PluginDecorationPreviewTarget | undefined>;
59
+ onActivate?(action: PluginTextDecorationActivation): void | readonly PluginTextDecorationCandidate[] | Promise<void | readonly PluginTextDecorationCandidate[]>;
60
+ }
61
+ export interface PluginTextDecorationHandle extends Disposable {
62
+ invalidate(scope?: {
63
+ source: PluginDecorationSource;
64
+ }): void;
65
+ }
66
+ export interface PluginTextDecorations {
67
+ register(provider: PluginTextDecorationProvider): Promise<PluginTextDecorationHandle>;
68
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 浏览器扩展 ↔ 桌面的 AI 运行协议 v2(M5)。取代 v1 的 `ai.chat` 请求 + `ai.stream.*` 快照通知。
2
+ * 浏览器扩展 ↔ 桌面的 AI 运行协议 v2。取代 v1 的 `ai.chat` 请求 + `ai.stream.*` 快照通知。
3
3
  *
4
4
  * 一次运行 = 一个 runId:
5
5
  * - `ai.run.start`(请求)立即返回 `{ runId }`,不等回答结束;
@@ -25,7 +25,7 @@ export interface TextContent {
25
25
  type: "text";
26
26
  text: string;
27
27
  mentions?: MentionRef[];
28
- /** 本条消息用 `$` 点名的 Skill(folderName),发送时注入全文(D-060) */
28
+ /** 本条消息用 `$` 点名的 Skill(folderName),发送时注入全文 */
29
29
  skills?: string[];
30
30
  }
31
31
  export interface ImageContent {
@@ -112,6 +112,14 @@ export type ResponseContentBlock = {
112
112
  };
113
113
  /** ContentBlock 为 ResponseContentBlock 的兼容别名(历史导出名) */
114
114
  export type ContentBlock = ResponseContentBlock;
115
+ export interface ChatCompactionUsage {
116
+ tokensBefore: number;
117
+ estimatedTokensAfter: number;
118
+ /** 直到模型回报新的实际用量,圆环使用压缩后的估算。 */
119
+ isCurrent: boolean;
120
+ providerId?: string;
121
+ modelId?: string;
122
+ }
115
123
  export interface ModelUsage {
116
124
  inputTokens: number;
117
125
  outputTokens: number;
@@ -128,12 +136,12 @@ export interface MessageVersions {
128
136
  export interface RequestMessage {
129
137
  clientId?: string;
130
138
  /**
131
- * 对应的 pi 会话 entry id(M4:从 JSONL 投影出来的消息才有)。改历史操作(删除/编辑重发/
139
+ * 对应的 pi 会话 entry id(从 JSONL 投影出来的消息才有)。改历史操作(删除/编辑重发/
132
140
  * 重新生成)按它定位,不能靠 clientId——迁移数据的 clientId 是旧值。
133
141
  */
134
142
  piEntryIds?: string[];
135
143
  /**
136
- * 会话树上同一位置的全部版本(M4-d:编辑重发/重新生成/从这里建分支产生的兄弟)。
144
+ * 会话树上同一位置的全部版本(编辑重发/重新生成/从这里建分支产生的兄弟)。
137
145
  * ids 为各版本用户消息的 entry id(写入顺序),index 是本条是第几个;只有一个版本时不带。
138
146
  */
139
147
  piVersions?: MessageVersions;
@@ -159,7 +167,7 @@ export interface ResponseMessage {
159
167
  }
160
168
  export type ChatSessionMessage = RequestMessage | ResponseMessage;
161
169
  /**
162
- * 一个已打开的对话(M4:会话目录行 + pi JSONL 投影出的消息)。注意与 ChatComponents 的
170
+ * 一个已打开的对话(会话目录行 + pi JSONL 投影出的消息)。注意与 ChatComponents 的
163
171
  * ChatMessage(单条消息)区分,桌面历史代码以 `ChatMessage` 名字消费本类型。
164
172
  *
165
173
  * id 即 pi 会话 id(字符串):新对话在渲染端生成 id,目录表里查不到就是草稿,
@@ -172,6 +180,7 @@ export interface ChatSessionRecord {
172
180
  createTime: number;
173
181
  updateTime: number;
174
182
  messages: ChatSessionMessage[];
183
+ compaction?: ChatCompactionUsage;
175
184
  title: string;
176
185
  titleDirty?: boolean;
177
186
  groupId?: number | null;
@@ -7,5 +7,4 @@
7
7
  *
8
8
  * 对比度按 02 规范 §2.5,深浅两套均由 theme-parity.test.ts 校验。
9
9
  */
10
- declare const _default: import("../defineTheme").ThemeDefinition;
11
- export default _default;
10
+ export {};
@@ -7,5 +7,4 @@
7
7
  *
8
8
  * 对比度按 02 规范 §2.5,深浅两套均由 theme-parity.test.ts 校验。
9
9
  */
10
- declare const _default: import("../defineTheme").ThemeDefinition;
11
- export default _default;
10
+ export {};
@@ -8,5 +8,4 @@
8
8
  * 层级与浅色对称翻转(同暖纸 · 夜的口径):surface 最亮、sunken 最暗;交互态改盐白墨低透明
9
9
  * 叠层;阴影加深至黑系。
10
10
  */
11
- declare const _default: import("../defineTheme").ThemeDefinition;
12
- export default _default;
11
+ export {};
@@ -12,5 +12,4 @@
12
12
  * 对比度按 02 规范 §2.5:ink-1 对 page/surface ≥ 7:1、ink-2 与 accent 文字 ≥ 4.5:1
13
13
  * (由 theme-parity.test.ts 的对比度断言守护,深浅两套都校验)。
14
14
  */
15
- declare const _default: import("../defineTheme").ThemeDefinition;
16
- export default _default;
15
+ export {};
@@ -7,5 +7,4 @@
7
7
  *
8
8
  * 对比度按 02 规范 §2.5,深浅两套均由 theme-parity.test.ts 校验。
9
9
  */
10
- declare const _default: import("../defineTheme").ThemeDefinition;
11
- export default _default;
10
+ export {};
@@ -6,5 +6,4 @@
6
6
  *
7
7
  * 对比度按 02 规范 §2.5,深浅两套均由 theme-parity.test.ts 校验。
8
8
  */
9
- declare const _default: import("../defineTheme").ThemeDefinition;
10
- export default _default;
9
+ export {};
@@ -18,6 +18,6 @@ export declare const SCALE_WORDS: {
18
18
  readonly radius: readonly ["tau-sm", "tau-md", "tau-lg"];
19
19
  readonly shadow: readonly ["card", "lift", "float", "paper"];
20
20
  readonly ease: readonly ["tau-out"];
21
- readonly animate: readonly ["hm-pulse"];
21
+ readonly animate: readonly ["hm-pulse", "aurora-1", "aurora-2", "aurora-3"];
22
22
  };
23
23
  export declare const cn: (...inputs: ClassValue[]) => string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AnchoredPanel 基础件 —— 锚定面板:浮层家族的定位基座(Radix Popper 同构层)。
3
3
  *
4
- * 与 Popover 的分工:AnchoredPanel 只管锚定定位(D-004 引擎)、卡片视觉、portal
4
+ * 与 Popover 的分工:AnchoredPanel 只管锚定定位、卡片视觉、portal
5
5
  * 与显隐过渡——无开合状态(默认锚点在即显示,open 可由宿主驱动)、不监听外点、
6
6
  * 不消费 Esc/Tab、不抢焦点,键盘与焦点事件原样冒泡给宿主仲裁。Popover 组合它并
7
7
  * 叠加交互层(trigger 注入、外点/Esc/Tab 仲裁、焦点契约、dialog 语义);卡片与
@@ -39,8 +39,8 @@ export interface AnchoredPanelBodyProps {
39
39
  children: ReactNode;
40
40
  className?: string;
41
41
  }
42
- /** 正文:独立滚动(上限 min(60vh, 420px))+ 边缘渐隐 + 透明右边框挤位(D-012 手法,
43
- * 浮层滚动区通用口径);顶部间距按有无头行分流:无头行自足 14px,有头行收敛 10px。
42
+ /** 正文:独立滚动(上限 min(60vh, 420px))+ 边缘渐隐 + 透明右边框挤位
43
+ * (浮层滚动区通用手法);顶部间距按有无头行分流:无头行自足 14px,有头行收敛 10px。
44
44
  * 滚动轨道上下让位(track margin;track 透明边框不缩短 thumb 活动区):贴浮层边缘的一端
45
45
  * 让出圆角半径,免得 thumb 画进 rounded-tau-lg 的圆角外;头行下方只留 4px */
46
46
  declare function AnchoredPanelBody({ children, className }: AnchoredPanelBodyProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Button —— 文字按钮基础件(方案 B「现代产品」形制,mockups/button/,D-013)。
2
+ * Button —— 文字按钮基础件(「现代产品」形制)。
3
3
  *
4
- * 变体六档是一个动作的全部音量,层级纪律靠评审不进 API:
4
+ * 变体六档是一个动作的全部音量,层级纪律不进 API:
5
5
  * - primary:accent 实心 + 微投影,每屏至多一枚;Dialog 应答区主按钮位
6
- * - secondary:surface 亮底 + line-1 描边(D-007/D-009「浮起物」口径),应答与取消的默认档
6
+ * - secondary:surface 亮底 + line-1 描边(「浮起物」口径),应答与取消的默认档
7
7
  * - soft:accent-soft 平底,工具栏高频次级强调(比 secondary 轻、比 ghost 重)
8
8
  * - ghost:无底 hover 淡墨,与 IconButton 同反馈语言
9
- * - danger / danger-soft:对齐 D-011 危险分级——实心红只给确认位,列表/工具栏一律 soft
9
+ * - danger / danger-soft:危险分级——实心红只给确认位,列表/工具栏一律 soft
10
10
  *
11
11
  * 行为契约:loading = aria-busy + spinner + 文案切换 + 一并 disabled(指针封锁与
12
12
  * Tab 队列退出由原生 disabled 承担);disabled 同理走原生属性;focus-visible 才显
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Checkbox —— 勾选基础件(Input 方案 A「经典描边」语言,mockups/checkbox/,2026-09-19 定稿)。
2
+ * Checkbox —— 勾选基础件(Input 的「经典描边」语言)。
3
3
  *
4
4
  * 原生 input[type=checkbox] 承载语义(appearance-none 自绘皮):label 点击切换、
5
5
  * Space 原生支持、读屏语义白送。「浮起物」:16×16 视觉格 surface + line-1,
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * 结构铁律:input / 格子 / 勾图标必须在同一层互为兄弟——Tailwind 的 peer-* 变体
9
9
  * 只匹配 peer 的后续兄弟(`~ *`),挂在深层后代上会静默失效(勾选后无任何视觉)。
10
- * 状态语义(与 Input 裁决同源):
10
+ * 状态语义(与 Input 同源):
11
11
  * - 命中 24×24(input 绝对定位撑满锚格,宪法下限);focus-visible 才显 ring
12
12
  * (锚格经 has- 变体响应,因锚是 input 的父级而非兄弟)
13
13
  * - hover 描边加深半档(未选中 ink-3/50 / 选中 accent-hover),聚焦时让位
@@ -1,15 +1,15 @@
1
1
  /**
2
- * ConfirmDialog —— Dialog 的最薄语义预设:确认类对话一句话接线(D-011)。
2
+ * ConfirmDialog —— Dialog 的最薄语义预设:确认类对话一句话接线。
3
3
  *
4
4
  * 信息一处一责:标题讲动作、context 徽标记对象、description 讲事实、impact 念
5
- * 后果、按钮文案不带数量。danger 两档(D-011 用户裁决):
5
+ * 后果、按钮文案不带数量。danger 两档:
6
6
  * - 轻 danger:实心红主按钮 + 初始焦点落取消(回车不误触),一步确认
7
7
  * - 真·不可逆:typeToConfirm 传对象名,输入匹配才解锁确认按钮(每次打开重置)
8
8
  *
9
9
  * 异步确认两种接法:
10
10
  * - 推荐:onConfirm 返回 Promise(async 函数天然满足)——自动进入 loading,
11
11
  * resolve 后自动关闭、reject 保持打开(错误留在原地处理);loading 态封锁
12
- * 一切关闭路径,回执交 Toast(D-003 家族分工)
12
+ * 一切关闭路径,回执交 Toast
13
13
  * - 受控:loading prop 由调用方管理(多步进度等),完成后自行把 open 置 false。
14
14
  * 注意不能在 onConfirm 里才 set loading——props 是渲染快照,同步路径会先按
15
15
  * false 立即关闭(样板间首版即踩此竞态,故内建 Promise 感知)