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