2022-11-01 22:01:28 +08:00
|
|
|
import type { ParseTree } from "$sb/lib/tree.ts";
|
2023-08-16 21:15:19 +08:00
|
|
|
import { TextChange } from "$sb/lib/change.ts";
|
2023-10-03 20:16:33 +08:00
|
|
|
import { Query } from "$sb/types.ts";
|
2022-04-20 16:56:43 +08:00
|
|
|
|
2022-07-11 15:08:22 +08:00
|
|
|
export type AppEvent =
|
|
|
|
| "page:click"
|
2022-12-21 21:55:24 +08:00
|
|
|
| "editor:complete"
|
|
|
|
| "minieditor:complete"
|
2023-11-06 16:14:16 +08:00
|
|
|
| "slash:complete"
|
2023-11-21 23:24:20 +08:00
|
|
|
| "editor:lint"
|
2022-07-11 15:08:22 +08:00
|
|
|
| "page:load"
|
|
|
|
| "editor:init"
|
2023-07-29 00:06:49 +08:00
|
|
|
| "editor:pageLoaded" // args: pageName, previousPage, isSynced
|
2023-01-26 22:54:28 +08:00
|
|
|
| "editor:pageReloaded"
|
2023-06-14 02:47:05 +08:00
|
|
|
| "editor:pageSaved"
|
2023-01-24 01:52:17 +08:00
|
|
|
| "editor:modeswitch"
|
2023-08-16 21:15:19 +08:00
|
|
|
| "plugs:loaded"
|
|
|
|
| "editor:pageModified";
|
2022-03-20 16:56:28 +08:00
|
|
|
|
2022-10-14 21:11:33 +08:00
|
|
|
export type QueryProviderEvent = {
|
2023-10-03 20:16:33 +08:00
|
|
|
query: Query;
|
2022-10-14 21:11:33 +08:00
|
|
|
pageName: string;
|
|
|
|
};
|
|
|
|
|
2022-03-20 16:56:28 +08:00
|
|
|
export type ClickEvent = {
|
2022-03-28 21:25:05 +08:00
|
|
|
page: string;
|
2022-03-20 16:56:28 +08:00
|
|
|
pos: number;
|
|
|
|
metaKey: boolean;
|
|
|
|
ctrlKey: boolean;
|
|
|
|
altKey: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type IndexEvent = {
|
|
|
|
name: string;
|
|
|
|
text: string;
|
|
|
|
};
|
2022-04-20 16:56:43 +08:00
|
|
|
|
|
|
|
export type IndexTreeEvent = {
|
|
|
|
name: string;
|
|
|
|
tree: ParseTree;
|
|
|
|
};
|
2022-11-24 23:08:51 +08:00
|
|
|
|
|
|
|
export type PublishEvent = {
|
2023-11-29 23:51:28 +08:00
|
|
|
uri?: string;
|
2022-11-24 23:08:51 +08:00
|
|
|
// Page name
|
|
|
|
name: string;
|
|
|
|
};
|
2022-12-21 21:55:24 +08:00
|
|
|
|
2023-11-21 23:56:21 +08:00
|
|
|
export type LintEvent = {
|
|
|
|
name: string;
|
|
|
|
tree: ParseTree;
|
|
|
|
};
|
|
|
|
|
2022-12-21 21:55:24 +08:00
|
|
|
export type CompleteEvent = {
|
2023-07-02 17:25:32 +08:00
|
|
|
pageName: string;
|
2022-12-21 21:55:24 +08:00
|
|
|
linePrefix: string;
|
|
|
|
pos: number;
|
2023-08-02 03:35:19 +08:00
|
|
|
parentNodes: string[];
|
2022-12-21 21:55:24 +08:00
|
|
|
};
|
2023-01-21 20:37:55 +08:00
|
|
|
|
2023-11-06 16:14:16 +08:00
|
|
|
export type SlashCompletion = {
|
|
|
|
label: string;
|
|
|
|
detail?: string;
|
|
|
|
invoke: string;
|
|
|
|
} & Record<string, any>;
|
|
|
|
|
2023-01-21 20:37:55 +08:00
|
|
|
export type WidgetContent = {
|
|
|
|
html?: string;
|
|
|
|
script?: string;
|
2023-10-29 17:02:50 +08:00
|
|
|
markdown?: string;
|
2023-01-21 20:37:55 +08:00
|
|
|
url?: string;
|
|
|
|
height?: number;
|
|
|
|
width?: number;
|
|
|
|
};
|
2023-08-16 21:15:19 +08:00
|
|
|
|
|
|
|
/** PageModifiedEvent payload for "editor:pageModified". Fired when the document text changes
|
|
|
|
*/
|
|
|
|
export type PageModifiedEvent = {
|
|
|
|
changes: TextChange[];
|
|
|
|
};
|