@xiongtao.xt/tau-plugins 0.56.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 (37) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/docs/README.md +15 -16
  3. package/docs/backend.md +5 -6
  4. package/docs/blog-templates.md +199 -0
  5. package/docs/portability.md +30 -29
  6. package/docs/services.md +15 -9
  7. package/docs/site-data.md +30 -9
  8. package/docs/ui.md +16 -15
  9. package/docs/windows.md +83 -0
  10. package/package.json +1 -1
  11. package/publish-artifacts.js +57 -13
  12. package/tailwind.css +20 -0
  13. package/types/packages/collaboration/src/document-membership.d.ts +4 -0
  14. package/types/packages/collaboration/src/document-operations.d.ts +8 -2
  15. package/types/packages/collaboration/src/document-protocol.d.ts +13 -0
  16. package/types/packages/collaboration/src/encoding.d.ts +1 -1
  17. package/types/packages/collaboration/src/index.d.ts +3 -0
  18. package/types/packages/collaboration/src/member-activities.d.ts +8 -0
  19. package/types/packages/collaboration/src/node-tree.d.ts +4 -1
  20. package/types/packages/collaboration/src/protocol.d.ts +7 -3
  21. package/types/packages/collaboration/src/scoped-content-edit.d.ts +91 -0
  22. package/types/packages/editor/src/core/CoreEditor.d.ts +3 -0
  23. package/types/packages/editor/src/core/api/clipboardFragment.d.ts +14 -0
  24. package/types/packages/editor/src/core/api/drag.d.ts +1 -1
  25. package/types/packages/editor/src/core/api/index.d.ts +3 -0
  26. package/types/packages/editor/src/core/api/marks.d.ts +2 -0
  27. package/types/packages/editor/src/core/index.d.ts +1 -0
  28. package/types/packages/editor/src/core/inlineSuggestion/controller.d.ts +29 -0
  29. package/types/packages/editor/src/core/inlineSuggestion/providerContext.d.ts +3 -0
  30. package/types/packages/editor/src/core/utils/nodeOperations.d.ts +1 -1
  31. package/types/packages/editor/src/extensions/table/src/types.d.ts +4 -0
  32. package/types/packages/editor/text-field-contract.d.ts +3 -0
  33. package/types/packages/plugins/src/contract.d.ts +3 -0
  34. package/types/packages/plugins/src/index.d.ts +1 -0
  35. package/types/packages/plugins/src/windows.d.ts +76 -0
  36. package/types/packages/themes/src/tokenContract.d.ts +1 -0
  37. package/types/packages/ui/src/hooks/scrollbarAutoHide.d.ts +1 -1
@@ -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[];
@@ -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";
@@ -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