@xiongtao.xt/tau-plugins 0.55.0 → 0.57.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 (76) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/docs/README.md +86 -21
  3. package/docs/ai.md +17 -14
  4. package/docs/app-surfaces.md +267 -0
  5. package/docs/backend.md +5 -6
  6. package/docs/blog-templates.md +199 -0
  7. package/docs/document-body.md +126 -0
  8. package/docs/editor-collaboration.md +135 -49
  9. package/docs/editor-export.md +154 -0
  10. package/docs/editor-interactions.md +254 -0
  11. package/docs/editor-source-media.md +397 -0
  12. package/docs/editor.md +68 -523
  13. package/docs/excerpts.md +22 -6
  14. package/docs/flashcards.md +18 -5
  15. package/docs/getting-started.md +80 -30
  16. package/docs/mcp.md +26 -11
  17. package/docs/notifications-and-voice.md +219 -0
  18. package/docs/pages.md +374 -0
  19. package/docs/permissions.md +126 -0
  20. package/docs/plugin-basics.md +67 -53
  21. package/docs/plugin-content.md +263 -0
  22. package/docs/portability.md +62 -40
  23. package/docs/providers/README.md +153 -41
  24. package/docs/providers/asr.md +104 -11
  25. package/docs/providers/embeddings.md +3 -7
  26. package/docs/providers/images.md +3 -3
  27. package/docs/providers/publish.md +48 -10
  28. package/docs/providers/sync.md +5 -64
  29. package/docs/providers/tts.md +2 -2
  30. package/docs/providers/upload.md +4 -59
  31. package/docs/providers/video.md +37 -6
  32. package/docs/references.md +183 -0
  33. package/docs/release.md +21 -16
  34. package/docs/services.md +15 -9
  35. package/docs/settings-and-commands.md +168 -0
  36. package/docs/site-data.md +30 -9
  37. package/docs/skills.md +14 -7
  38. package/docs/storage-and-network.md +4 -5
  39. package/docs/ui-components.md +92 -0
  40. package/docs/ui.md +25 -813
  41. package/docs/user-data.md +64 -623
  42. package/docs/whiteboard.md +110 -32
  43. package/docs/windows.md +83 -0
  44. package/package.json +1 -1
  45. package/publish-artifacts.js +57 -13
  46. package/tailwind.css +20 -0
  47. package/types/packages/asr/src/types.d.ts +2 -0
  48. package/types/packages/collaboration/src/document-membership.d.ts +4 -0
  49. package/types/packages/collaboration/src/document-operations.d.ts +8 -2
  50. package/types/packages/collaboration/src/document-protocol.d.ts +13 -0
  51. package/types/packages/collaboration/src/encoding.d.ts +1 -1
  52. package/types/packages/collaboration/src/index.d.ts +3 -0
  53. package/types/packages/collaboration/src/member-activities.d.ts +8 -0
  54. package/types/packages/collaboration/src/node-tree.d.ts +4 -1
  55. package/types/packages/collaboration/src/protocol.d.ts +7 -3
  56. package/types/packages/collaboration/src/scoped-content-edit.d.ts +91 -0
  57. package/types/packages/editor/src/core/CoreEditor.d.ts +3 -0
  58. package/types/packages/editor/src/core/api/clipboardFragment.d.ts +14 -0
  59. package/types/packages/editor/src/core/api/drag.d.ts +1 -1
  60. package/types/packages/editor/src/core/api/index.d.ts +3 -0
  61. package/types/packages/editor/src/core/api/marks.d.ts +2 -0
  62. package/types/packages/editor/src/core/index.d.ts +1 -0
  63. package/types/packages/editor/src/core/inlineSuggestion/controller.d.ts +29 -0
  64. package/types/packages/editor/src/core/inlineSuggestion/providerContext.d.ts +3 -0
  65. package/types/packages/editor/src/core/utils/nodeOperations.d.ts +1 -1
  66. package/types/packages/editor/src/extensions/table/src/types.d.ts +4 -0
  67. package/types/packages/editor/text-field-contract.d.ts +3 -0
  68. package/types/packages/plugins/src/contract.d.ts +3 -0
  69. package/types/packages/plugins/src/environment.d.ts +3 -0
  70. package/types/packages/plugins/src/excerpts.d.ts +3 -0
  71. package/types/packages/plugins/src/foreground-host.d.ts +8 -0
  72. package/types/packages/plugins/src/index.d.ts +1 -0
  73. package/types/packages/plugins/src/publish-data.d.ts +4 -0
  74. package/types/packages/plugins/src/windows.d.ts +76 -0
  75. package/types/packages/themes/src/tokenContract.d.ts +1 -0
  76. package/types/packages/ui/src/hooks/scrollbarAutoHide.d.ts +1 -1
@@ -0,0 +1,8 @@
1
+ import type { Member } from "./protocol";
2
+ /** 同一设备多个视图按编辑、查看、后台的优先级汇总。 */
3
+ export declare function memberActivities(deviceIds: Iterable<string>, states: Iterable<{
4
+ user?: {
5
+ id?: unknown;
6
+ };
7
+ activity?: unknown;
8
+ }>): Map<string, Member["activity"]>;
@@ -75,6 +75,7 @@ export declare class NodeTree {
75
75
  private readSpans;
76
76
  snapshot(): readonly ContentNode[];
77
77
  nodeSnapshot(id: string): ContentNode;
78
+ rootBlockId(id: string): string | undefined;
78
79
  read(): ContentNode[];
79
80
  physicalOffset(parent: string | null, index: number): number;
80
81
  textLocation(parent: string | null, index: number): {
@@ -83,7 +84,7 @@ export declare class NodeTree {
83
84
  segment?: string;
84
85
  };
85
86
  visibleOffset(parent: string | null, index: number): number;
86
- capturePosition(parent: string, index: number): Y.RelativePosition;
87
+ capturePosition(parent: string, index: number, assoc?: number): Y.RelativePosition;
87
88
  resolvePosition(position: Y.RelativePosition): {
88
89
  parent: string;
89
90
  offset: number;
@@ -102,6 +103,8 @@ export declare class NodeTree {
102
103
  convertNode(id: string, targetId: string, changes: Record<string, unknown>, origin: unknown): void;
103
104
  insertText(id: string, index: number, text: string, origin: unknown, marks?: Record<string, unknown>): void;
104
105
  deleteText(id: string, index: number, length: number, origin: unknown): void;
106
+ /** 目标偏移以移除源文字后的内容为准。 */
107
+ moveText(source: string, start: number, target: string, index: number, length: number, origin: unknown): void;
105
108
  formatText(id: string, index: number, length: number, marks: Record<string, unknown>, origin: unknown): void;
106
109
  private textRanges;
107
110
  }
@@ -43,6 +43,10 @@ export interface SharedDocumentInfo {
43
43
  members: Member[];
44
44
  updatedAt: number;
45
45
  }
46
+ export interface SharedDocumentListing extends SharedDocumentInfo {
47
+ kind: "content" | "whiteboard" | "unknown";
48
+ protocolVersion: number | null;
49
+ }
46
50
  export interface JoinRequest {
47
51
  id: string;
48
52
  documentId: string;
@@ -68,8 +72,7 @@ export interface SourceBinding {
68
72
  contentDocumentId?: string;
69
73
  /** 本机缓存最后确认的主库投影修订,不随文档共享。 */
70
74
  projectionRevision?: string;
71
- /** 本机会话的标题归属不随同步辅助状态的健康情况切换。 */
72
- titleAuthority?: "database";
75
+ /** 本机数据库替换后隔离旧缓存与延迟写入。 */
73
76
  generation?: string;
74
77
  sourceType?: SourceType;
75
78
  sourceId?: number;
@@ -85,7 +88,7 @@ export interface CollaborationSession extends SharedDocumentInfo {
85
88
  mode?: "local" | "shared";
86
89
  frozen?: boolean;
87
90
  serverUrl: string;
88
- connection: "connecting" | "connected" | "offline" | "error";
91
+ connection: "idle" | "connecting" | "connected" | "offline" | "error";
89
92
  pending: boolean;
90
93
  leaving: boolean;
91
94
  source?: SourceBinding;
@@ -123,6 +126,7 @@ export interface ContentInputDraft {
123
126
  value: string;
124
127
  revision: string;
125
128
  sequence: number;
129
+ baseValue?: string;
126
130
  }
127
131
  export type CollaborationEvent = {
128
132
  type: "refresh";
@@ -0,0 +1,91 @@
1
+ import * as Y from "yjs";
2
+ import type { ContentContractDictionary } from "../../db-schema/content-contracts";
3
+ import { NodeTree } from "./node-tree";
4
+ import { CollaborationError, type ContentNode } from "./protocol";
5
+ type TextRun = {
6
+ text: string;
7
+ marks: Record<string, unknown>;
8
+ };
9
+ type TextEdit = {
10
+ kind: "text";
11
+ id: string;
12
+ blockId: string;
13
+ start: string;
14
+ end: string;
15
+ expected: TextRun[];
16
+ text: string;
17
+ runs?: TextRun[];
18
+ /** 逆操作额外记录提交后插入点的两侧,供逐段编辑安全接续。 */
19
+ continuation?: {
20
+ start: string;
21
+ end: string;
22
+ };
23
+ };
24
+ type BlockEdit = {
25
+ kind: "blocks";
26
+ id: string;
27
+ left: string | null;
28
+ right: string | null;
29
+ expected: (ContentNode & {
30
+ collabId: string;
31
+ })[];
32
+ nodes: ContentNode[];
33
+ };
34
+ export type ScopedContentEdit = TextEdit | BlockEdit;
35
+ export interface ScopedContentEdits {
36
+ edits: ScopedContentEdit[];
37
+ contracts?: ContentContractDictionary;
38
+ source?: {
39
+ proposalId: string;
40
+ agentId?: string;
41
+ runId?: string;
42
+ };
43
+ }
44
+ export interface ScopedContentBaseline {
45
+ documentId: string;
46
+ baselineId: string;
47
+ epoch: number;
48
+ }
49
+ export interface ScopedContentSubmission extends ScopedContentBaseline {
50
+ operationId: string;
51
+ scope: ScopedContentEdits;
52
+ }
53
+ export type ScopedContentResult = {
54
+ status: "committed";
55
+ inverse?: ScopedContentEdits;
56
+ } | {
57
+ status: "conflict";
58
+ conflicts: ScopedContentConflict[];
59
+ } | {
60
+ status: "pending";
61
+ } | {
62
+ status: "rejected";
63
+ reason: string;
64
+ };
65
+ export interface ScopedContentConflict {
66
+ opId: string;
67
+ blockId?: string;
68
+ }
69
+ export declare class ScopedContentConflictError extends CollaborationError {
70
+ readonly conflicts: ScopedContentConflict[];
71
+ constructor(conflicts: ScopedContentConflict[]);
72
+ }
73
+ export declare function captureScopedTextEdit(tree: NodeTree, id: string, blockId: string, start: number, end: number, text: string): TextEdit;
74
+ export declare const scopedUndoOperationId: (operationId: string) => string;
75
+ export declare const scopedUndoSourceId: (operationId: string) => string | undefined;
76
+ export declare class ScopedUndoLimitError extends CollaborationError {
77
+ static readonly code = "UNDO_LIMIT";
78
+ static readonly description = "\u6539\u52A8\u8D85\u51FA\u53EF\u64A4\u9500\u5BB9\u91CF\uFF0C\u8BF7\u62C6\u6210\u8F83\u5C0F\u7684\u4FEE\u6539";
79
+ constructor();
80
+ }
81
+ /** 逐条判断编辑在当前正文上是否仍成立(锚点能解析且原文前提一致),不修改文档。 */
82
+ export declare function scopedEditsApplicable(current: Y.Doc, edits: ScopedContentEdit[]): boolean[];
83
+ export declare function validateScopedContentEdits(value: ScopedContentEdits): void;
84
+ /** 在写入队列内从同一份正文校验所有前提,候选失败时不触碰原文档。 */
85
+ export declare function buildScopedContentUpdate(current: Y.Doc, request: ScopedContentEdits, { undo }?: {
86
+ undo?: boolean;
87
+ }): Promise<{
88
+ update: Uint8Array;
89
+ inverse?: ScopedContentEdits;
90
+ }>;
91
+ export {};
@@ -2,6 +2,7 @@ import type { Node, Path } from "slate";
2
2
  import { Descendant, Editor, Range } from "slate";
3
3
  import type { EditorKit } from "./kit/EditorKit";
4
4
  import type { EditorDocument } from "./document/EditorDocument";
5
+ import type { InlineSuggestionProvider } from "./inlineSuggestion/controller";
5
6
  import type { EditorExtension } from "./api/extension";
6
7
  import type { EditorRef } from "./types/editor";
7
8
  import type { MarkRenderProps } from "./api/marks";
@@ -34,6 +35,8 @@ export interface IEditorProps {
34
35
  decorate?: (entry: [Node, Path]) => Range[];
35
36
  /** 包装已经应用标记的内容,不接管 Slate attributes。 */
36
37
  leafWrapper?: ComponentType<MarkRenderProps>;
38
+ /** 当前视图的行内纯文本建议来源。 */
39
+ inlineSuggestions?: InlineSuggestionProvider;
37
40
  /**
38
41
  * 聚焦模式:沿光标所在的文档路径,同级兄弟元素退后(其余顶层块、列表的其他项、表格的其他单元格…)。
39
42
  * 退后程度由宿主在容器上设置 `--ed-focus-dim`(缺省 0.26)。
@@ -0,0 +1,14 @@
1
+ import type { Descendant, Editor, Node } from "slate";
2
+ export declare const CONTENT_FRAGMENT_MIME = "application/x-tau-content";
3
+ interface ContentFragmentTransfer {
4
+ documentKey(): string;
5
+ flushInputs(): void;
6
+ serialize(nodes: readonly Node[]): string;
7
+ prepare(fragment: string, signal?: AbortSignal): Promise<Descendant[] | undefined>;
8
+ flushWrites?(): Promise<void> | undefined;
9
+ }
10
+ export declare function setContentFragmentTransfer(editor: Editor, transfer: ContentFragmentTransfer): void;
11
+ export declare const contentFragmentTransferOf: (editor: Editor) => ContentFragmentTransfer | undefined;
12
+ export declare function attachContentFragment(element: HTMLElement, fragment: string): void;
13
+ export declare function readContentFragment(data: DataTransfer): string | undefined;
14
+ export {};
@@ -6,7 +6,7 @@ import type { Element } from "slate";
6
6
  export interface ElementDragSpec {
7
7
  /** 自身可拖(显示手柄);false 时本块仅作为放置目标参与 */
8
8
  self: boolean;
9
- /** 内部子内容是否参与块级拖拽;false 时更深的子块不显示手柄(如勾选项里的段落) */
9
+ /** 内部子块是否参与块级拖拽;false 时子块没有手柄,也不作为放置目标。 */
10
10
  children: boolean;
11
11
  /**
12
12
  * 放置谓词:拖动元素能否落到本块(含本块内部)。缺省接受任何块。
@@ -37,6 +37,7 @@ 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
39
  export { copyNodeToClipboard, deleteVoidBlock } from "../utils/nodeOperations";
40
+ export { CONTENT_FRAGMENT_MIME, readContentFragment, setContentFragmentTransfer, } from "./clipboardFragment";
40
41
  export { getSelectionSnapshot, isSelectionSnapshotUnchanged } from "../utils/selectionSnapshot";
41
42
  export { createParagraph, isParagraphElement, type ParagraphElement } from "../model/paragraph";
42
43
  export { insertParagraphAndFocus } from "../utils/editor";
@@ -69,3 +70,5 @@ export { useTextFieldBinding } from "./useTextFieldBinding";
69
70
  export { bindTextFieldTextarea, rebaseTextFieldInput } from "./textFieldInput";
70
71
  export { IEditorTextFields } from "../../../source-contracts";
71
72
  export { slateTextFields } from "./slateTextFields";
73
+ export { useInlineSuggestionProvider } from "../inlineSuggestion/providerContext";
74
+ export { createInlineSuggestionController, type InlineSuggestionProvider, type InlineSuggestionPreview, } from "../inlineSuggestion/controller";
@@ -2,6 +2,8 @@ import type { ComponentType, ReactNode } from "react";
2
2
  import type { Editor, NodeEntry, Range, Text } from "slate";
3
3
  export interface MarkRenderProps {
4
4
  readonly leaf: Readonly<Text>;
5
+ /** 该叶子在 Slate 文本节点内的起点,未切分时为 0。 */
6
+ readonly leafStart?: number;
5
7
  children: ReactNode;
6
8
  }
7
9
  export interface MarkSpec {
@@ -34,3 +34,4 @@ export { default as AddParagraph } from "./components/AddParagraph/index";
34
34
  export type { IngestContext, IngestFilesRule, IngestTextRule, ElementIngestSpec, } from "./api/ingest";
35
35
  export { default as InlineChromiumBugfix } from "./components/InlineChromiumBugFix/index";
36
36
  export { BLOCK_DRAG_GROUP } from "./components/BlockDrag/index";
37
+ export type { InlineSuggestionProvider, InlineSuggestionContext, } from "./inlineSuggestion/controller";
@@ -0,0 +1,29 @@
1
+ export interface InlineSuggestionContext {
2
+ readonly before: string;
3
+ readonly after: string;
4
+ readonly language?: string;
5
+ }
6
+ export interface InlineSuggestionProvider {
7
+ suggest(context: InlineSuggestionContext, signal: AbortSignal): Promise<string | null>;
8
+ }
9
+ export interface InlineSuggestionPreview<Stamp> {
10
+ readonly stamp: Stamp;
11
+ readonly text: string;
12
+ }
13
+ export interface InlineSuggestionEditorPort<Stamp> {
14
+ capture(): {
15
+ context: InlineSuggestionContext;
16
+ stamp: Stamp;
17
+ } | null;
18
+ isCurrent(stamp: Stamp): boolean;
19
+ tryInsert(stamp: Stamp, text: string): boolean;
20
+ }
21
+ export declare function createInlineSuggestionController<Stamp>(editor: InlineSuggestionEditorPort<Stamp>, provider: InlineSuggestionProvider): {
22
+ getSnapshot: () => InlineSuggestionPreview<Stamp> | null;
23
+ subscribe(listener: () => void): () => void;
24
+ clear: () => void;
25
+ revalidate(): void;
26
+ userInput(): void;
27
+ accept(): boolean;
28
+ dismiss(current: InlineSuggestionPreview<Stamp>): boolean;
29
+ };
@@ -0,0 +1,3 @@
1
+ import type { InlineSuggestionProvider } from "./controller";
2
+ export declare const InlineSuggestionContext: import("react").Context<InlineSuggestionProvider | undefined>;
3
+ export declare const useInlineSuggestionProvider: () => InlineSuggestionProvider | undefined;
@@ -4,7 +4,7 @@ import type { EditorFeedback } from "../services/notifier";
4
4
  * 复制节点到剪贴板
5
5
  * 支持两种格式:JSON 和纯文本;传入数组时按数组顺序作为一个 fragment,纯文本以换行连接
6
6
  */
7
- export declare function copyNodeToClipboard(_editor: Editor, element: Node | Node[], message?: EditorFeedback, options?: {
7
+ export declare function copyNodeToClipboard(editor: Editor, element: Node | Node[], message?: EditorFeedback, options?: {
8
8
  allowPlainTextFallback?: boolean;
9
9
  signal?: AbortSignal;
10
10
  }): Promise<boolean>;
@@ -4,6 +4,10 @@ import type { TableAlign } from "./align";
4
4
  export type { TableAlign };
5
5
  export interface TableCellElement {
6
6
  type: "table-cell";
7
+ /** 向下合并的行数(含自身),等于 1 时省略;只在合并区域左上格上存在 */
8
+ rowSpan?: number;
9
+ /** 向右合并的列数(含自身),等于 1 时省略;只在合并区域左上格上存在 */
10
+ colSpan?: number;
7
11
  children: Array<InlineElement | FormattedText>;
8
12
  }
9
13
  export interface TableRowElement {
@@ -1,6 +1,7 @@
1
1
  export interface TextFieldSnapshot {
2
2
  readonly value: string;
3
3
  readonly revision: string;
4
+ readonly baseValue?: string;
4
5
  }
5
6
  export interface TextFieldDelta {
6
7
  retain?: number;
@@ -18,6 +19,8 @@ export interface EditorTextField {
18
19
  remove: number;
19
20
  text: string;
20
21
  revision: string;
22
+ }, options?: {
23
+ isolateUndo?: boolean;
21
24
  }): void;
22
25
  editBatch(changes: readonly {
23
26
  offset: number;
@@ -1,3 +1,4 @@
1
+ import type { PluginWindowDefinition, PluginWindows } from "./windows";
1
2
  import type { PluginPages } from "./pages";
2
3
  import type { PluginEnvironment } from "./environment";
3
4
  import type { PluginNavigation } from "./navigation";
@@ -65,6 +66,7 @@ export interface PluginContext {
65
66
  };
66
67
  readonly storage: PluginStorage;
67
68
  readonly pages: PluginPages;
69
+ readonly windows?: PluginWindows;
68
70
  readonly settings: PluginSettings;
69
71
  readonly sync: PluginSync;
70
72
  readonly upload: PluginUpload;
@@ -126,6 +128,7 @@ export interface PluginDefinition {
126
128
  readonly name: string;
127
129
  readonly version: string;
128
130
  readonly apiVersion: 1;
131
+ readonly windows?: readonly PluginWindowDefinition[];
129
132
  /** 静态声明,桌面与博客均装配同一份扩展;模块加载不得依赖桌面激活。 */
130
133
  readonly editorExtensions?: readonly PluginEditorExtension[];
131
134
  readonly whiteboardExtensions?: readonly WhiteboardExtension[];
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
+ export { APP_FOREGROUND_EVENT, APP_BACKGROUND_EVENT } from "./foreground-host";
2
3
  export interface PluginEnvironment {
3
4
  readonly platform: "desktop" | "android" | "ios" | "web";
4
5
  /** WebView 报告的可用指针精度,不代表当前输入设备或悬停能力。 */
@@ -18,6 +19,8 @@ export declare function createPluginEnvironmentStore(initial: PluginEnvironment)
18
19
  }>;
19
20
  /** 平台由宿主提供,输入信息来自媒体查询。 */
20
21
  export declare function createBrowserPluginEnvironment(platform: PluginEnvironment["platform"], viewport: Window): {
22
+ notifyForeground: (force?: boolean) => void | undefined;
23
+ notifyBackground: () => void | undefined;
21
24
  connect(): () => void;
22
25
  getSnapshot: () => PluginEnvironment;
23
26
  subscribe: (listener: () => void) => () => void;
@@ -3,6 +3,8 @@ import type { Disposable, JsonValue } from "./contract";
3
3
  export interface PluginMaterialRef {
4
4
  readonly kind: string;
5
5
  readonly id: number;
6
+ /** 宿主签发的稳定身份,必须与整个引用一起原样传回。 */
7
+ readonly identity: string;
6
8
  }
7
9
  /** 摘录来源:一本书、一个网页、一篇文献 */
8
10
  export interface PluginExcerptSource {
@@ -83,6 +85,7 @@ export interface PluginExcerpts {
83
85
  export interface PluginMaterialAction {
84
86
  id: string;
85
87
  label: string;
88
+ /** 动作结果由宿主统一提示,插件不重复提示。 */
86
89
  run(): Promise<void>;
87
90
  }
88
91
  export interface PluginMaterials {
@@ -0,0 +1,8 @@
1
+ export declare const APP_FOREGROUND_EVENT = "tau:app-foreground";
2
+ export declare const APP_BACKGROUND_EVENT = "tau:app-background";
3
+ /** 应用生命周期与页面保活分开;原生恢复不依赖 WebView 是否补发可见性事件。 */
4
+ export declare function createAppForegroundBridge(viewport: Window, debounceMs?: number): {
5
+ resume: (force?: boolean) => void;
6
+ background: () => void;
7
+ dispose(): void;
8
+ };
@@ -63,3 +63,4 @@ export type { PluginAI, PluginAIFeature, PluginAIRequest, PluginAIResult, Plugin
63
63
  export { PLUGIN_AI_CAPABILITIES, isPluginAICapability } from "./ai";
64
64
  export * from "./asr";
65
65
  export type * from "./websocket";
66
+ export type { PluginWindowAppearance, PluginWindowCommunication, PluginWindowDefinition, PluginWindowHandle, PluginWindowMessageSender, PluginWindowMessageTarget, PluginWindowOptions, PluginWindowParams, PluginWindowProps, PluginWindows, } from "./windows";
@@ -34,6 +34,10 @@ export interface PublishSettings {
34
34
  borderRadius?: string;
35
35
  shadow?: string | boolean;
36
36
  };
37
+ /** 背景高亮笔触(flat / chisel / swipe / grain),缺省为平涂 */
38
+ highlight?: {
39
+ style?: string;
40
+ };
37
41
  };
38
42
  }
39
43
  /** 站点级数据只在清单中出现一次,各内容文件不重复携带。 */
@@ -0,0 +1,76 @@
1
+ import type { ComponentType } from "react";
2
+ import type { Disposable } from "./contract";
3
+ import type { JsonValue } from "./json";
4
+ import type { PluginPageParams } from "./pages";
5
+ export type PluginWindowParams = PluginPageParams;
6
+ export type PluginWindowOptions = ({
7
+ kind: "normal";
8
+ width: number;
9
+ height: number;
10
+ } | {
11
+ kind: "compact";
12
+ width: number;
13
+ height: number;
14
+ alwaysOnTop?: boolean;
15
+ } | {
16
+ kind: "fullscreen";
17
+ }) & {
18
+ theme?: "system" | "dark";
19
+ };
20
+ export interface PluginWindowDefinition {
21
+ readonly id: string;
22
+ readonly title: string;
23
+ readonly component: ComponentType<PluginWindowProps>;
24
+ readonly options: PluginWindowOptions;
25
+ }
26
+ export interface PluginWindowProps {
27
+ readonly params: Readonly<PluginWindowParams>;
28
+ readonly signal: AbortSignal;
29
+ readonly close: () => Promise<void>;
30
+ readonly communication: PluginWindowCommunication;
31
+ }
32
+ export interface PluginWindowHandle {
33
+ close(): Promise<void>;
34
+ }
35
+ export interface PluginWindows {
36
+ readonly communication: PluginWindowCommunication;
37
+ open(id: string, params?: PluginWindowParams): Promise<PluginWindowHandle>;
38
+ }
39
+ export interface PluginWindowAppearance {
40
+ readonly themeId: string;
41
+ readonly appearance: "system" | "light" | "dark";
42
+ readonly mode: "light" | "dark";
43
+ readonly font: {
44
+ readonly chineseFont: string;
45
+ readonly englishFont: string;
46
+ readonly codeFont: string;
47
+ readonly fontSize: number;
48
+ };
49
+ }
50
+ export type PluginWindowMessageSender = {
51
+ readonly kind: "main";
52
+ } | {
53
+ readonly kind: "window";
54
+ readonly windowId: string;
55
+ };
56
+ export type PluginWindowMessageTarget = "all" | "main" | {
57
+ readonly windowId: string;
58
+ };
59
+ export interface PluginWindowCommunication {
60
+ /** 窗口已继承宿主外观,自绘内容可读取或订阅。 */
61
+ readonly system: {
62
+ get(key: "system.appearance"): PluginWindowAppearance;
63
+ subscribe(key: "system.appearance", listener: (value: PluginWindowAppearance) => void): Disposable;
64
+ };
65
+ readonly state: {
66
+ get(key: string): Promise<JsonValue | undefined>;
67
+ set(key: string, value: JsonValue): Promise<void>;
68
+ /** 首次回调交付当前状态,后续回调交付更新。 */
69
+ subscribe(key: string, listener: (value: JsonValue | undefined) => void): Promise<Disposable>;
70
+ };
71
+ readonly messages: {
72
+ /** 返回提交投递的在线端点数量。 */
73
+ send(name: string, payload: JsonValue, target: PluginWindowMessageTarget): Promise<number>;
74
+ on(name: string, listener: (payload: JsonValue, sender: PluginWindowMessageSender) => void): Disposable;
75
+ };
76
+ }
@@ -20,6 +20,7 @@ export declare const tokenContract: {
20
20
  readonly status: readonly ["ok", "ok-soft", "warn", "warn-soft", "danger", "danger-soft", "info", "info-soft"];
21
21
  readonly tag: readonly ["tag-1", "tag-1-soft", "tag-2", "tag-2-soft", "tag-3", "tag-3-soft", "tag-4", "tag-4-soft", "tag-5", "tag-5-soft"];
22
22
  readonly float: readonly ["overlay", "shadow-card", "shadow-lift", "shadow-float", "shadow-paper"];
23
+ readonly backdrop: readonly ["glow-1", "glow-2", "glow-3"];
23
24
  };
24
25
  /** 全部词汇的平铺联合类型 */
25
26
  export type TokenWord = (typeof tokenContract)[keyof typeof tokenContract][number];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 滚动条自动隐藏 —— 事件委托驱动,AppShell 初始化一次、全局滚动区生效。
2
+ * 滚动条自动隐藏 —— 事件委托驱动,宿主入口初始化一次、全局滚动区(含窗口根滚动)生效。
3
3
  *
4
4
  * 为什么不用纯 CSS(.app *:hover::-webkit-scrollbar-thumb):Chromium 的滚动条
5
5
  * 伪元素不随 :hover 常规重算,显形后可能冻结不消失。改为 mouseover/scroll/mouseout