port tab manager to ts

This commit is contained in:
Jin
2025-03-03 01:04:42 +01:00
parent 8e0b9d17a4
commit 45a50f3aa1
9 changed files with 233 additions and 156 deletions

View File

@@ -22,7 +22,6 @@ import type LoadResults from "../services/load_results.js";
import type { Attribute } from "../services/attribute_parser.js";
import type NoteTreeWidget from "../widgets/note_tree.js";
import type { default as NoteContext, GetTextEditorCallback } from "./note_context.js";
import type { ContextMenuEvent } from "../menus/context_menu.js";
import type TypeWidget from "../widgets/type_widgets/type_widget.js";
interface Layout {
@@ -56,8 +55,8 @@ export interface ContextMenuCommandData extends CommandData {
}
export interface NoteCommandData extends CommandData {
notePath?: string;
hoistedNoteId?: string;
notePath?: string | null;
hoistedNoteId?: string | null;
viewScope?: ViewScope;
}
@@ -170,9 +169,9 @@ export type CommandMappings = {
callback: (value: NoteDetailWidget | PromiseLike<NoteDetailWidget>) => void;
};
executeWithTextEditor: CommandData &
ExecuteCommandData<TextEditor> & {
callback?: GetTextEditorCallback;
};
ExecuteCommandData<TextEditor> & {
callback?: GetTextEditorCallback;
};
executeWithCodeEditor: CommandData & ExecuteCommandData<null>;
/**
* Called upon when attempting to retrieve the content element of a {@link NoteContext}.
@@ -324,7 +323,7 @@ type EventMappings = {
ntxId: string | null;
};
contextsReopenedEvent: {
mainNtxId: string;
mainNtxId: string | null;
tabPosition: number;
};
noteDetailRefreshed: {
@@ -338,7 +337,7 @@ type EventMappings = {
newNoteContextCreated: {
noteContext: NoteContext;
};
noteContextRemovedEvent: {
noteContextRemoved: {
ntxIds: string[];
};
exportSvg: {
@@ -359,6 +358,7 @@ type EventMappings = {
relationMapResetPanZoom: { ntxId: string | null | undefined };
relationMapResetZoomIn: { ntxId: string | null | undefined };
relationMapResetZoomOut: { ntxId: string | null | undefined };
activeNoteChangedEvent: {};
};
export type EventListener<T extends EventNames> = {