obsidian-typings 2.2.1-beta.6 → 2.2.1-beta.7

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 (2) hide show
  1. package/dist/types.d.ts +1921 -1920
  2. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -2663,1360 +2663,1361 @@ declare module "obsidian" {
2663
2663
  interface Plugin$1 extends Component {
2664
2664
  }
2665
2665
  }
2666
- declare module "obsidian" {
2667
- interface MarkdownFileInfo extends HoverParent {
2668
- }
2669
- }
2670
- declare module "obsidian" {
2671
- interface TFolder extends TAbstractFile {
2672
- }
2673
- }
2674
- declare module "obsidian" {
2675
- interface Events {
2676
- }
2677
- }
2678
- declare module "obsidian" {
2679
- interface HeadingCache extends CacheItem {
2680
- }
2681
- }
2682
- declare module "obsidian" {
2683
- interface LinkCache extends ReferenceCache {
2684
- }
2685
- }
2686
- declare module "obsidian" {
2687
- interface FileStats {
2688
- }
2689
- }
2690
- declare module "obsidian" {
2691
- interface ViewStateResult {
2692
- }
2693
- }
2694
- declare module "obsidian" {
2695
- interface TextAreaComponent extends AbstractTextComponent<HTMLTextAreaElement> {
2696
- }
2697
- }
2698
- declare module "obsidian" {
2699
- interface WorkspaceItem extends Events {
2700
- }
2701
- }
2702
- declare module "obsidian" {
2703
- interface KeymapInfo {
2704
- }
2705
- }
2706
- declare module "obsidian" {
2707
- interface Pos {
2708
- }
2709
- }
2710
- declare module "obsidian" {
2711
- interface TooltipOptions {
2712
- }
2666
+ /** @public */
2667
+ export interface MetadataWidget {
2713
2668
  }
2714
- /** @todo Documentation incomplete */
2715
2669
  /** @public */
2716
- export interface Account {
2717
- /**
2718
- * The company associated with the activated commercial license
2719
- */
2720
- company: string;
2670
+ export interface PropertyEntryData<T> {
2721
2671
  /**
2722
- * The email address associated with the account
2672
+ * Property key
2723
2673
  */
2724
- email: string;
2725
- expiry: number;
2726
- key: string | undefined;
2727
- keyValidation: string;
2674
+ key: string;
2728
2675
  /**
2729
- * The license available to the account
2676
+ * Property widget type
2730
2677
  */
2731
- license: "" | "insider";
2678
+ type: string;
2732
2679
  /**
2733
- * Profile name
2680
+ * Property value
2734
2681
  */
2735
- name: string;
2736
- seats: number;
2737
- token: string;
2738
- }
2739
- /** @todo Documentation incomplete */
2740
- /** @public */
2741
- export interface AppMenuBarManager {
2742
- }
2743
- /** @public */
2744
- export interface CommandsCommandsRecord extends Record<string, Command> {
2745
- }
2746
- /** @public */
2747
- export interface CommandsEditorCommandsRecord extends Record<string, Command> {
2682
+ value: T;
2748
2683
  }
2749
2684
  /** @public */
2750
- export interface Commands {
2685
+ export interface PropertyRenderContext {
2751
2686
  /**
2752
- * Reference to App
2687
+ * Reference to the app
2753
2688
  */
2754
2689
  app: App;
2755
2690
  /**
2756
- * Commands *without* editor callback, will always be available in the command palette
2757
- *
2758
- * @example
2759
- * `app:open-vault` or `app:reload`
2760
- */
2761
- commands: CommandsCommandsRecord;
2762
- /**
2763
- * Commands *with* editor callback, will only be available when editor is active and callback returns
2764
- * true
2765
- *
2766
- * @example
2767
- * `editor:fold-all` or `command-palette:open`
2768
- */
2769
- editorCommands: CommandsEditorCommandsRecord;
2770
- /**
2771
- * Add a command to the command registry
2772
- *
2773
- * @param command - Command to add
2774
- */
2775
- addCommand(command: Command): void;
2776
- /**
2777
- * Execute a command by reference
2778
- *
2779
- * @param command - Command to execute
2691
+ * Callback called on property field unfocus
2780
2692
  */
2781
- executeCommand(command: Command): boolean;
2693
+ blur: () => void;
2782
2694
  /**
2783
- * Execute a command by ID
2784
- *
2785
- * @param commandId - ID of command to execute
2695
+ * Key of the property field
2786
2696
  */
2787
- executeCommandById(commandId: string): boolean;
2697
+ key: string;
2788
2698
  /**
2789
- * Find a command by ID
2790
- *
2791
- * @param commandId - ID of command to find
2699
+ * Reference to the metadata editor
2792
2700
  */
2793
- findCommand(commandId: string): Command | undefined;
2701
+ metadataEditor: MetadataEditor;
2794
2702
  /**
2795
- * Lists **all** commands, both with and without editor callback
2703
+ * Callback called on property value change
2796
2704
  */
2797
- listCommands(): Command[];
2705
+ onChange: () => void;
2798
2706
  /**
2799
- * Remove a command from the command registry
2800
- *
2801
- * @param commandId - ID of command to remove
2707
+ * Determine the source path of current context
2802
2708
  */
2803
- removeCommand(commandId: string): void;
2709
+ sourcePath: string;
2804
2710
  }
2805
2711
  /** @public */
2806
- export interface ThemeManifest {
2712
+ export interface PropertyWidget<T> {
2807
2713
  /**
2808
- * Name of the author of the theme
2714
+ * Lucide-dev icon associated with the widget
2809
2715
  */
2810
- author: string;
2716
+ icon: string;
2811
2717
  /**
2812
- * URL to the author's website
2718
+ * Returns the I18N name of the widget
2813
2719
  */
2814
- authorUrl?: string;
2720
+ name: () => string;
2815
2721
  /**
2816
- * Storage location of the theme relative to the vault root
2722
+ * Reserved keys for the widget
2817
2723
  */
2818
- dir: string;
2724
+ reservedKeys?: string[];
2819
2725
  /**
2820
- * URL for funding the author
2726
+ * Identifier for the widget
2821
2727
  */
2822
- fundingUrl?: string;
2728
+ type: string;
2823
2729
  /**
2824
- * Minimum Obsidian version compatible with the theme
2730
+ * Get the default value for the property widget
2825
2731
  */
2826
- minAppVersion: string;
2732
+ default(): T;
2827
2733
  /**
2828
- * Name of the theme
2734
+ * Render function for the widget on field container given context and data
2829
2735
  */
2830
- name: string;
2736
+ render(containerEl: HTMLElement, data: PropertyEntryData<T>, context: PropertyRenderContext): Component | void;
2831
2737
  /**
2832
- * Version of the theme
2833
- *
2834
- * @remark Defaults to "0.0.0" if no theme manifest was provided in the repository
2738
+ * Validate whether the input value to the widget is correct
2835
2739
  */
2836
- version: "0.0.0" | string;
2837
- }
2838
- /** @public */
2839
- export interface CustomCSSThemesRecord extends Record<string, ThemeManifest> {
2840
- }
2841
- /** @public */
2842
- export interface CustomCSSUpdatesRecord extends Record<string, unknown> {
2740
+ validate(value: T): boolean;
2843
2741
  }
2844
- /** @todo Documentation incomplete */
2845
2742
  /** @public */
2846
- export interface CustomCSS extends Component {
2743
+ export interface MetadataEditorProperty extends Component {
2847
2744
  /**
2848
- * Reference to App
2745
+ * Reference to the app
2849
2746
  */
2850
2747
  app: App;
2851
- /** @internal Cache of CSS snippet filepath (relative to vault root) to CSS snippet contents */
2852
- csscache: Map<string, string>;
2853
2748
  /**
2854
- * Set of enabled snippet, given by filenames
2749
+ * Container element for the metadata editor property
2855
2750
  */
2856
- enabledSnippets: Set<string>;
2751
+ containerEl: HTMLElement;
2857
2752
  /**
2858
- * @internal
2859
- * Contains references to Style elements containing custom CSS snippets
2753
+ * Entry information for the property
2860
2754
  */
2861
- extraStyleEls: HTMLStyleElement[];
2755
+ entry: PropertyEntryData<unknown>;
2862
2756
  /**
2863
- * List of theme names not fully updated to post v1.0.0 theme guidelines
2757
+ * Icon element of the property
2864
2758
  */
2865
- oldThemes: string[];
2866
- /** @internal */
2867
- queue: WeakMap<object, unknown>;
2759
+ iconEl: HTMLSpanElement;
2868
2760
  /**
2869
- * List of snippets detected by Obsidian, given by their filenames
2761
+ * Key value of the property
2870
2762
  */
2871
- snippets: string[];
2763
+ keyEl: HTMLElement;
2872
2764
  /**
2873
- * Currently active theme, given by its name
2874
- *
2875
- * @remark is the default Obsidian theme
2765
+ * Input field for key value of the property
2876
2766
  */
2877
- theme: "" | string;
2767
+ keyInputEl: HTMLInputElement;
2878
2768
  /**
2879
- * Mapping of theme names to their manifest
2769
+ * Metadata editor the property is attached to
2880
2770
  */
2881
- themes: CustomCSSThemesRecord;
2882
- /** @internal */
2883
- updates: CustomCSSUpdatesRecord;
2884
- /** @internal */
2885
- boundRaw(): void;
2771
+ metadataEditor: MetadataEditor;
2886
2772
  /**
2887
- * Check whether a specific theme can be updated
2888
- *
2889
- * @param themeName - Name of the theme to check
2773
+ * Widget that handles user input for this property widget type
2890
2774
  */
2891
- checkForUpdate(themeName: string): void;
2775
+ rendered: MetadataWidget | null;
2892
2776
  /**
2893
- * Check all themes for updates
2777
+ * Info about the inferred and expected property widget given key-value pair
2894
2778
  */
2895
- checkForUpdates(): void;
2779
+ typeInfo: {
2780
+ expected: PropertyWidget<unknown>;
2781
+ inferred: PropertyWidget<unknown>;
2782
+ };
2896
2783
  /**
2897
- * Disable translucency of application background
2784
+ * Element that contains the value input or widget
2898
2785
  */
2899
- disableTranslucency(): void;
2786
+ valueEl: HTMLElement;
2900
2787
  /**
2901
- * Fetch legacy theme CSS using the pre-v1.0.0 theme download pipeline
2902
- *
2903
- * @returns String obsidian.css contents
2788
+ * Element containing the displayed warning on malformed property field
2904
2789
  */
2905
- downloadLegacyTheme(arg: {
2906
- repo: string;
2907
- }): Promise<string>;
2790
+ warningEl: HTMLElement;
2908
2791
  /**
2909
- * Enable translucency of application background
2792
+ * Focus on the key input element
2910
2793
  */
2911
- enableTranslucency(): void;
2794
+ focusKey(): void;
2912
2795
  /**
2913
- * Fetch a theme's manifest using repository URL
2914
- *
2915
- * @remark Do **not** include github prefix, only `username/repo`
2796
+ * Focus on the property (container element)
2916
2797
  */
2917
- getManifest(repoUrl: string): Promise<ThemeManifest>;
2798
+ focusProperty(): void;
2918
2799
  /**
2919
- * Convert snippet name to its corresponding filepath (relative to vault root)
2920
- *
2921
- * @returns String `.obsidian/snippets/${snippetName}.css`
2800
+ * Focus on the value input element
2922
2801
  */
2923
- getSnippetPath(snippetName: string): string;
2802
+ focusValue(which?: "both" | "end" | "start"): void;
2924
2803
  /**
2925
- * Returns the folder path where snippets are stored (relative to vault root)
2926
- */
2927
- getSnippetsFolder(): string;
2928
- /**
2929
- * Convert theme name to its corresponding filepath (relative to vault root)
2930
- *
2931
- * @returns String `.obsidian/themes/${themeName}/theme.css`
2932
- */
2933
- getThemePath(themeName: string): string;
2934
- /**
2935
- * Returns the folder path where themes are stored (relative to vault root)
2804
+ * Reveal the property menu on click event
2936
2805
  */
2937
- getThemesFolder(): string;
2806
+ handleItemClick(event: MouseEvent): void;
2938
2807
  /**
2939
- * Returns whether there are themes that can be updated
2808
+ * Focus on property on blur event
2940
2809
  */
2941
- hasUpdates(): boolean;
2810
+ handlePropertyBlur(): void;
2942
2811
  /**
2943
- * Install a legacy theme using the pre-v1.0.0 theme download pipeline<br> Will create a corresponding
2944
- * dummy manifest for the theme
2945
- *
2946
- * @remark Name will be used as the folder name for the theme
2812
+ * Update key of property and saves, returns false if error
2947
2813
  */
2948
- installLegacyTheme(arg: {
2949
- name: string;
2950
- repo: string;
2951
- author: string;
2952
- }): Promise<void>;
2814
+ handleUpdateKey(key: string): boolean;
2953
2815
  /**
2954
- * Install a theme using the regular theme download pipeline
2816
+ * Update value of property and saves
2955
2817
  */
2956
- installTheme(arg: {
2957
- name: string;
2958
- repo: string;
2959
- author: string;
2960
- }, version: string): Promise<void>;
2818
+ handleUpdateValue(value: unknown): void;
2961
2819
  /**
2962
- * Check whether a specific theme is installed by theme name
2820
+ * Loads as draggable property element
2963
2821
  */
2964
- isThemeInstalled(themeName: string): boolean;
2965
- /** @internal */
2966
2822
  onload(): void;
2967
- /** @internal */
2968
- onRaw(e: unknown): void;
2969
- /** @internal */
2970
- readSnippets(): void;
2971
- /** @internal */
2972
- readThemes(): void;
2973
- /**
2974
- * Remove a theme by theme name
2975
- */
2976
- removeTheme(themeName: string): Promise<void>;
2977
- /** @internal */
2978
- requestLoadSnippets(): void;
2979
- /** @internal */
2980
- requestLoadTheme(): void;
2981
- /** @internal */
2982
- requestReadThemes(): void;
2983
2823
  /**
2984
- * Set the activation status of a snippet by snippet name
2824
+ * Render property widget based on type
2985
2825
  */
2986
- setCssEnabledStatus(snippetName: string, enabled: boolean): void;
2826
+ renderProperty(entry: PropertyEntryData<unknown>, check_errors?: boolean, use_expected_type?: boolean): void;
2987
2827
  /**
2988
- * Set the active theme by theme name
2828
+ * Set the selected class of property
2989
2829
  */
2990
- setTheme(themeName: string): void;
2830
+ setSelected(selected: boolean): void;
2991
2831
  /**
2992
- * Set the translucency of application background
2832
+ * Reveal property selection menu at mouse event
2993
2833
  */
2994
- setTranslucency(translucency: boolean): void;
2995
- }
2996
- /** @public */
2997
- export interface Draggable {
2998
- source?: unknown;
2999
- type: string;
3000
- icon: string;
3001
- title: string;
3002
- file?: TAbstractFile;
3003
- files?: TAbstractFile[];
3004
- linktext?: string;
3005
- sourcePath?: string;
3006
- }
3007
- /** @public */
3008
- export interface DragStartEvent {
3009
- evt: DragEvent;
3010
- moved: boolean;
3011
- }
3012
- /** @public */
3013
- export interface DropResult {
3014
- action: string | null;
3015
- dropEffect: "none" | "copy" | "link" | "move";
3016
- hoverEl: HTMLElement | null;
3017
- hoverClass: string;
3018
- }
3019
- /** @todo Documentation incomplete */
3020
- /** @public */
3021
- export interface DragManager {
3022
- actionEl: HTMLElement | null;
3023
- app: App;
3024
- dragStart: DragStartEvent | null;
3025
- draggable: Draggable | null;
3026
- ghostEl: HTMLElement | null;
3027
- hoverClass: string;
3028
- hoverEl: HTMLElement | null;
3029
- isDragOverHandled: boolean;
3030
- overlayEl: HTMLElement;
3031
- shouldHideOverlay: boolean;
3032
- sourceClass: string;
3033
- sourceEls: HTMLElement[] | null;
3034
- dragFile(event: DragEvent, file: TFile, source?: unknown): Draggable;
3035
- dragFiles(event: DragEvent, files: TAbstractFile[], source?: unknown): Draggable | null;
3036
- dragFolder(event: DragEvent, folder: TFolder, source?: unknown): Draggable;
3037
- dragLink(event: DragEvent, linkText: string, sourcePath: string, title?: string, source?: unknown): Draggable;
3038
- handleDrag(el: HTMLElement, draggableGetter: (event: DragEvent) => Draggable | null): void;
3039
- handleDrop(el: HTMLElement, dropHandler: (event: DragEvent, draggable: Draggable, isOver: boolean) => DropResult | null, draggable?: boolean): void;
3040
- hideOverlay(): void;
3041
- onDragEnd(): void;
3042
- onDragLeave(event: DragEvent): void;
3043
- onDragOver(event: DragEvent): void;
3044
- onDragOverFirst(): void;
3045
- onDragStart(event: DragEvent, draggable: Draggable): void;
3046
- onDragStartGlobal(event: DragEvent): void;
3047
- onTouchEnd(event: TouchEvent): void;
3048
- removeOverlay(): void;
3049
- setAction(action: string | null): void;
3050
- showOverlay(doc: Document, rect: DOMRect): void;
3051
- updateHover(hoverEl: HTMLElement | null, hoverClass: string): void;
3052
- updateSource(sourceEls: HTMLElement[] | null, sourceClass: string): void;
2834
+ showPropertyMenu(event: MouseEvent): void;
3053
2835
  }
3054
2836
  /** @public */
3055
- export interface EmbedContext {
2837
+ export interface MetadataEditor extends Component {
2838
+ /**
2839
+ * Button element for adding a new property
2840
+ */
2841
+ addPropertyButtonEl: HTMLButtonElement;
3056
2842
  /**
3057
2843
  * Reference to the app
3058
2844
  */
3059
2845
  app: App;
3060
2846
  /**
3061
- * Element where the embed should be displayed
2847
+ * Whether the frontmatter editor is collapsed
2848
+ */
2849
+ collapsed: boolean;
2850
+ /**
2851
+ * Container element for the metadata editor
3062
2852
  */
3063
2853
  containerEl: HTMLElement;
3064
2854
  /**
3065
- * Depth of the embed within its container (how many levels of embeds are above it)
2855
+ * Element containing metadata table and addPropertyButton
3066
2856
  */
3067
- depth?: number;
2857
+ contentEl: HTMLElement;
3068
2858
  /**
3069
- * Whether the embed should be dynamic (CM) or static (postProcessed)
2859
+ * The currently focused property
3070
2860
  */
3071
- displayMode?: boolean;
2861
+ focusedLine: null | MetadataEditorProperty;
3072
2862
  /**
3073
- * Text that should be displayed in the embed
2863
+ * Fold button for folding away the frontmatter editor on hovering over headingEl
3074
2864
  */
3075
- linktext?: string;
2865
+ foldEl: HTMLElement;
3076
2866
  /**
3077
- * Whether the embed should be an inline embed
2867
+ * Heading element for the metadata editor
3078
2868
  */
3079
- showInline?: boolean;
2869
+ headingEl: HTMLElement;
3080
2870
  /**
3081
- * Optional path to the current open file
2871
+ * Hover element container
3082
2872
  */
3083
- sourcePath?: string;
3084
- /** @internal */
3085
- state?: unknown;
3086
- }
3087
- /** @todo Documentation incomplete */
3088
- /** @public */
3089
- export type EmbeddableConstructor = (context: EmbedContext, file: TFile, path?: string) => Component;
3090
- /** @public */
3091
- export interface EmbedRegistryEmbedByExtensionRecord extends Record<string, EmbeddableConstructor> {
3092
- }
3093
- /** @public */
3094
- export interface EmbedRegistry extends Events {
2873
+ hoverPopover: null | HoverPopover;
3095
2874
  /**
3096
- * Mapping of file extensions to constructors for embeddable widgets
2875
+ * Owner of the metadata editor
3097
2876
  */
3098
- embedByExtension: EmbedRegistryEmbedByExtensionRecord;
2877
+ owner: MarkdownView;
3099
2878
  /**
3100
- * Get the embed constructor for a specific file type
2879
+ * All properties existing in the metadata editor
3101
2880
  */
3102
- getEmbedCreator(file: TFile): EmbeddableConstructor | null;
2881
+ properties: PropertyEntryData<unknown>[];
3103
2882
  /**
3104
- * Check whether a file extension has a registered embed constructor
2883
+ * Element containing all property elements
3105
2884
  */
3106
- isExtensionRegistered(extension: string): boolean;
2885
+ propertyListEl: HTMLElement;
3107
2886
  /**
3108
- * Register an embed constructor for a specific file extension
2887
+ * List of all property field editors
3109
2888
  */
3110
- registerExtension(extension: string, embedCreator: EmbeddableConstructor): void;
2889
+ rendered: MetadataEditorProperty[];
3111
2890
  /**
3112
- * Register an embed constructor for a list of file extensions
2891
+ * Set of all selected property editors
3113
2892
  */
3114
- registerExtensions(extensions: string[], embedCreator: EmbeddableConstructor): void;
2893
+ selectedLines: Set<MetadataEditorProperty>;
3115
2894
  /**
3116
- * Unregister an embed constructor for a specific file extension
2895
+ * Convert given properties to a serialized object and store in clipboard as obsidian/properties
3117
2896
  */
3118
- unregisterExtension(extension: string): void;
2897
+ _copyToClipboard(event: ClipboardEvent, properties: MetadataEditorProperty[]): void;
3119
2898
  /**
3120
- * Unregister an embed constructor for a list of file extensions
2899
+ * Uncollapse editor if collapsed and create a new property row
3121
2900
  */
3122
- unregisterExtensions(extensions: string[]): void;
3123
- }
3124
- /** @todo Documentation incomplete */
3125
- /** @public */
3126
- export interface FoldManager {
3127
- }
3128
- /** @public */
3129
- export interface HotkeyManagerCustomKeysRecord extends Record<string, KeymapInfo[]> {
3130
- }
3131
- /** @public */
3132
- export interface HotkeyManagerDefaultKeysRecord extends Record<string, KeymapInfo[]> {
3133
- }
3134
- /** @public */
3135
- export interface HotkeyManager {
2901
+ addProperty(): void;
3136
2902
  /**
3137
- * Reference to App
2903
+ * Clear all properties
3138
2904
  */
3139
- app: App;
3140
- /** @internal Whether hotkeys have been baked (checks completed) */
3141
- baked: boolean;
2905
+ clear(): void;
3142
2906
  /**
3143
- * Assigned hotkeys
2907
+ * Unselect all lines
3144
2908
  */
3145
- bakedHotkeys: KeymapInfo[];
2909
+ clearSelection(): void;
3146
2910
  /**
3147
- * Array of hotkey index to command ID
2911
+ * Focus on property field with given key
3148
2912
  */
3149
- bakedIds: string[];
2913
+ focusKey(key: string): void;
3150
2914
  /**
3151
- * Custom (non-Obsidian default) hotkeys, one to many mapping of command ID to assigned hotkey
2915
+ * Focus on property
3152
2916
  */
3153
- customKeys: HotkeyManagerCustomKeysRecord;
2917
+ focusProperty(property: MetadataEditorProperty): void;
3154
2918
  /**
3155
- * Default hotkeys, one to many mapping of command ID to assigned hotkey
2919
+ * Focus on property at specified index
3156
2920
  */
3157
- defaultKeys: HotkeyManagerDefaultKeysRecord;
2921
+ focusPropertyAtIndex(index: number): void;
3158
2922
  /**
3159
- * Add a hotkey to the default hotkeys
3160
- *
3161
- * @param command - Command ID to add hotkey to
3162
- * @param keys - Hotkeys to add
2923
+ * Focus on property with value
3163
2924
  */
3164
- addDefaultHotkeys(command: string, keys: KeymapInfo[]): void;
3165
- /** @internal Bake hotkeys (create mapping of pressed key to command ID) */
3166
- bake(): void;
2925
+ focusValue(value: string, which: "both" | "end" | "start"): void;
3167
2926
  /**
3168
- * Get hotkey associated with command ID
3169
- *
3170
- * @param command - Command ID to get hotkey for
2927
+ * Handle copy event on selection and serialize properties
3171
2928
  */
3172
- getDefaultHotkeys(command: string): KeymapInfo[];
2929
+ handleCopy(event: ClipboardEvent): void;
3173
2930
  /**
3174
- * Get hotkey associated with command ID
3175
- *
3176
- * @param command - Command ID to get hotkey for
2931
+ * Handle cut event and serialize and remove properties
3177
2932
  */
3178
- getHotkeys(command: string): KeymapInfo[];
3179
- /** @internal Load hotkeys from storage */
3180
- load(): void;
3181
- /** @internal */
3182
- onConfigFileChanged(): void;
3183
- /** @internal */
3184
- onRaw(e: unknown): void;
2933
+ handleCut(event: ClipboardEvent): void;
3185
2934
  /**
3186
- * Trigger a command by keyboard event
3187
- *
3188
- * @param event - Keyboard event to trigger command with
3189
- * @param keypress - Pressed key information
2935
+ * Handle selection of item for drag handling
3190
2936
  */
3191
- onTrigger(event: KeyboardEvent, keypress: KeymapInfo): boolean;
2937
+ handleItemSelection(event: PointerEvent, property: MetadataEditorProperty): boolean;
3192
2938
  /**
3193
- * Pretty-print hotkey of a command
3194
- *
3195
- * @param commandId - Command ID to print hotkey for
2939
+ * Handle key press event for controlling selection or movement of property up/down
3196
2940
  */
3197
- printHotkeyForCommand(commandId: string): string;
3198
- /** @internal */
3199
- registerListeners(): void;
2941
+ handleKeypress(event: KeyboardEvent): void;
3200
2942
  /**
3201
- * Remove a hotkey from the default hotkeys
3202
- *
3203
- * @param command - Command ID to remove hotkey from
2943
+ * Handle paste event of properties into metadata editor
3204
2944
  */
3205
- removeDefaultHotkeys(command: string): void;
2945
+ handlePaste(event: ClipboardEvent): void;
3206
2946
  /**
3207
- * Remove a hotkey from the custom hotkeys
3208
- *
3209
- * @param command - Command ID to remove hotkey from
2947
+ * Whether the editor has focus
2948
+ */
2949
+ hasFocus(): boolean;
2950
+ /**
2951
+ * Whether there is a property that is focused
2952
+ */
2953
+ hasPropertyFocused(): boolean;
2954
+ /**
2955
+ * Add new properties to the metadata editor and save
2956
+ */
2957
+ insertProperties(properties: Record<string, any>): void;
2958
+ /**
2959
+ * On loading of the metadata editor, register on metadata type change event
2960
+ */
2961
+ onload(): void;
2962
+ /**
2963
+ * On vault metadata update, update property render
2964
+ */
2965
+ onMetadataTypeChange(property: MetadataEditorProperty): void;
2966
+ /**
2967
+ * Remove specified properties from the metadata editor and save, and reset focus if specified
2968
+ */
2969
+ removeProperties(properties: MetadataEditorProperty[], reset_focus?: boolean): unknown;
2970
+ /**
2971
+ * Reorder the entry to specified index position and save
2972
+ */
2973
+ reorderKey(entry: PropertyEntryData<unknown>, index: number): unknown;
2974
+ /**
2975
+ * Serialize the properties and save frontmatter
3210
2976
  */
3211
- removeHotkeys(command: string): void;
3212
- /** @internal Save custom hotkeys to storage */
3213
2977
  save(): void;
3214
2978
  /**
3215
- * Add a hotkey to the custom hotkeys (overrides default hotkeys)
3216
- *
3217
- * @param command - Command ID to add hotkey to
3218
- * @param keys - Hotkeys to add
2979
+ * Select all property fields
3219
2980
  */
3220
- setHotkeys(command: string, keys: KeymapInfo[]): void;
3221
- }
3222
- /** @public */
3223
- export interface AudioRecorderPluginInstance extends InternalPluginInstance {
3224
- }
3225
- /** @public */
3226
- export interface BacklinkPluginInstance extends InternalPluginInstance {
3227
- }
3228
- /** @public */
3229
- export interface BookmarksPluginInstance extends InternalPluginInstance {
3230
- }
3231
- /** @public */
3232
- export interface CommandPalettePluginInstance extends InternalPluginInstance {
3233
- }
3234
- /** @public */
3235
- export interface DailyNotesPluginInstance extends InternalPluginInstance {
3236
- }
3237
- /** @public */
3238
- export interface EditorStatusPluginInstance extends InternalPluginInstance {
3239
- }
3240
- /** @todo Documentation incomplete */
3241
- /** @public */
3242
- export interface FileExplorerPluginInstance extends InternalPluginInstance {
2981
+ selectAll(): void;
3243
2982
  /**
3244
- * Reveals a file or folder in the file explorer view, opens the view if it is not already
3245
- * open/visible
2983
+ * Mark specified property as selected
3246
2984
  */
3247
- revealInFolder(item: TFile | TFolder): void;
3248
- }
3249
- /** @public */
3250
- export interface FileRecoveryPluginInstance extends InternalPluginInstance {
3251
- }
3252
- /** @todo Documentation incomplete */
3253
- /** @public */
3254
- export interface GlobalSearchPluginInstance extends InternalPluginInstance {
3255
- }
3256
- /** @public */
3257
- export interface GraphPluginInstance extends InternalPluginInstance {
3258
- }
3259
- /** @public */
3260
- export declare const InternalPluginName: {
3261
- readonly AudioRecorder: "audio-recorder";
3262
- readonly Backlink: "backlink";
3263
- readonly Bookmarks: "bookmarks";
3264
- readonly Canvas: "canvas";
3265
- readonly CommandPalette: "command-palette";
3266
- readonly DailyNotes: "daily-notes";
3267
- readonly EditorStatus: "editor-status";
3268
- readonly FileExplorer: "file-explorer";
3269
- readonly FileRecovery: "file-recovery";
3270
- readonly GlobalSearch: "global-search";
3271
- readonly Graph: "graph";
3272
- readonly MarkdownImporter: "markdown-importer";
3273
- readonly NoteComposer: "note-composer";
3274
- readonly OutgoingLink: "outgoing-link";
3275
- readonly Outline: "outline";
3276
- readonly PagePreview: "page-preview";
3277
- readonly Properties: "properties";
3278
- readonly Publish: "publish";
3279
- readonly RandomNote: "random-note";
3280
- readonly SlashCommand: "slash-command";
3281
- readonly Slides: "slides";
3282
- readonly Starred: "starred";
3283
- readonly Switcher: "switcher";
3284
- readonly Sync: "sync";
3285
- readonly TagPane: "tag-pane";
3286
- readonly Templates: "templates";
3287
- readonly WordCount: "word-count";
3288
- readonly Workspaces: "workspaces";
3289
- readonly ZkPrefixer: "zk-prefixer";
3290
- };
3291
- /** @public */
3292
- export interface MarkdownImporterPluginInstance extends InternalPluginInstance {
3293
- }
3294
- /** @public */
3295
- export interface NoteComposerPluginInstance extends InternalPluginInstance {
2985
+ selectProperty(property: MetadataEditorProperty | undefined, select: boolean): void;
2986
+ /**
2987
+ * Convert properties to a serialized object
2988
+ */
2989
+ serialize(): Record<string, any>;
2990
+ /**
2991
+ * Sets frontmatter as collapsed or uncollapsed
2992
+ */
2993
+ setCollapse(collapsed: boolean, x: boolean): void;
2994
+ /**
2995
+ * On context menu event on header element, show property menu
2996
+ */
2997
+ showPropertiesMenu(event: MouseEvent): void;
2998
+ /**
2999
+ * Synchronize data with given properties and re-render them
3000
+ */
3001
+ synchronize(data: Record<string, any>): void;
3002
+ /**
3003
+ * Toggle collapsed state of the metadata editor
3004
+ */
3005
+ toggleCollapse(): void;
3296
3006
  }
3297
- /** @public */
3298
- export interface OutgoingLinkPluginInstance extends InternalPluginInstance {
3007
+ declare module "obsidian" {
3008
+ interface MarkdownFileInfo extends HoverParent {
3009
+ metadataEditor?: MetadataEditor;
3010
+ }
3299
3011
  }
3300
- /** @public */
3301
- export interface OutlinePluginInstance extends InternalPluginInstance {
3012
+ declare module "obsidian" {
3013
+ interface TFolder extends TAbstractFile {
3014
+ }
3302
3015
  }
3303
- /** @public */
3304
- export interface PagePreviewPluginInstance extends InternalPluginInstance {
3016
+ declare module "obsidian" {
3017
+ interface Events {
3018
+ }
3305
3019
  }
3306
- /** @public */
3307
- export interface PropertiesPluginInstance extends InternalPluginInstance {
3020
+ declare module "obsidian" {
3021
+ interface HeadingCache extends CacheItem {
3022
+ }
3308
3023
  }
3309
- /** @public */
3310
- export interface PublishPluginInstance extends InternalPluginInstance {
3024
+ declare module "obsidian" {
3025
+ interface LinkCache extends ReferenceCache {
3026
+ }
3311
3027
  }
3312
- /** @public */
3313
- export interface RandomNotePluginInstance extends InternalPluginInstance {
3028
+ declare module "obsidian" {
3029
+ interface FileStats {
3030
+ }
3314
3031
  }
3315
- /** @public */
3316
- export interface SlashCommandPluginInstance extends InternalPluginInstance {
3032
+ declare module "obsidian" {
3033
+ interface ViewStateResult {
3034
+ }
3317
3035
  }
3318
- /** @public */
3319
- export interface SlidesPluginInstance extends InternalPluginInstance {
3036
+ declare module "obsidian" {
3037
+ interface TextAreaComponent extends AbstractTextComponent<HTMLTextAreaElement> {
3038
+ }
3320
3039
  }
3321
- /** @public */
3322
- export interface StarredPluginInstance extends InternalPluginInstance {
3040
+ declare module "obsidian" {
3041
+ interface WorkspaceItem extends Events {
3042
+ }
3323
3043
  }
3324
- /** @public */
3325
- export interface SwitcherPluginInstance extends InternalPluginInstance {
3044
+ declare module "obsidian" {
3045
+ interface KeymapInfo {
3046
+ }
3326
3047
  }
3327
- /** @public */
3328
- export interface SyncPluginInstance extends InternalPluginInstance {
3048
+ declare module "obsidian" {
3049
+ interface Pos {
3050
+ }
3329
3051
  }
3330
- /** @public */
3331
- export interface TagPanePluginInstance extends InternalPluginInstance {
3052
+ declare module "obsidian" {
3053
+ interface TooltipOptions {
3054
+ }
3332
3055
  }
3056
+ /** @todo Documentation incomplete */
3333
3057
  /** @public */
3334
- export interface TemplatesPluginInstance extends InternalPluginInstance {
3058
+ export interface Account {
3059
+ /**
3060
+ * The company associated with the activated commercial license
3061
+ */
3062
+ company: string;
3063
+ /**
3064
+ * The email address associated with the account
3065
+ */
3066
+ email: string;
3067
+ expiry: number;
3068
+ key: string | undefined;
3069
+ keyValidation: string;
3070
+ /**
3071
+ * The license available to the account
3072
+ */
3073
+ license: "" | "insider";
3074
+ /**
3075
+ * Profile name
3076
+ */
3077
+ name: string;
3078
+ seats: number;
3079
+ token: string;
3335
3080
  }
3081
+ /** @todo Documentation incomplete */
3336
3082
  /** @public */
3337
- export interface WordCountPluginInstance extends InternalPluginInstance {
3083
+ export interface AppMenuBarManager {
3338
3084
  }
3339
3085
  /** @public */
3340
- export interface WorkspacesPluginInstance extends InternalPluginInstance {
3086
+ export interface CommandsCommandsRecord extends Record<string, Command> {
3341
3087
  }
3342
3088
  /** @public */
3343
- export interface ZkPrefixerPluginInstance extends InternalPluginInstance {
3089
+ export interface CommandsEditorCommandsRecord extends Record<string, Command> {
3344
3090
  }
3345
3091
  /** @public */
3346
- export type InternalPluginNameInstancesMapping = {
3347
- [InternalPluginName.AudioRecorder]: AudioRecorderPluginInstance;
3348
- [InternalPluginName.Backlink]: BacklinkPluginInstance;
3349
- [InternalPluginName.Bookmarks]: BookmarksPluginInstance;
3350
- [InternalPluginName.Canvas]: CanvasPluginInstance;
3351
- [InternalPluginName.CommandPalette]: CommandPalettePluginInstance;
3352
- [InternalPluginName.DailyNotes]: DailyNotesPluginInstance;
3353
- [InternalPluginName.EditorStatus]: EditorStatusPluginInstance;
3354
- [InternalPluginName.FileExplorer]: FileExplorerPluginInstance;
3355
- [InternalPluginName.FileRecovery]: FileRecoveryPluginInstance;
3356
- [InternalPluginName.GlobalSearch]: GlobalSearchPluginInstance;
3357
- [InternalPluginName.Graph]: GraphPluginInstance;
3358
- [InternalPluginName.MarkdownImporter]: MarkdownImporterPluginInstance;
3359
- [InternalPluginName.NoteComposer]: NoteComposerPluginInstance;
3360
- [InternalPluginName.OutgoingLink]: OutgoingLinkPluginInstance;
3361
- [InternalPluginName.Outline]: OutlinePluginInstance;
3362
- [InternalPluginName.PagePreview]: PagePreviewPluginInstance;
3363
- [InternalPluginName.Properties]: PropertiesPluginInstance;
3364
- [InternalPluginName.Publish]: PublishPluginInstance;
3365
- [InternalPluginName.RandomNote]: RandomNotePluginInstance;
3366
- [InternalPluginName.SlashCommand]: SlashCommandPluginInstance;
3367
- [InternalPluginName.Slides]: SlidesPluginInstance;
3368
- [InternalPluginName.Starred]: StarredPluginInstance;
3369
- [InternalPluginName.Switcher]: SwitcherPluginInstance;
3370
- [InternalPluginName.Sync]: SyncPluginInstance;
3371
- [InternalPluginName.TagPane]: TagPanePluginInstance;
3372
- [InternalPluginName.Templates]: TemplatesPluginInstance;
3373
- [InternalPluginName.WordCount]: WordCountPluginInstance;
3374
- [InternalPluginName.Workspaces]: WorkspacesPluginInstance;
3375
- [InternalPluginName.ZkPrefixer]: ZkPrefixerPluginInstance;
3376
- };
3377
- /** @public */
3378
- export type InternalPluginNameType = (typeof InternalPluginName)[keyof typeof InternalPluginName];
3379
- /** @public */
3380
- export interface InternalPluginsConfigRecord extends Record<InternalPluginNameType, boolean> {
3381
- }
3382
- /** @public */
3383
- export interface InternalPlugins extends Events {
3092
+ export interface Commands {
3384
3093
  /**
3385
3094
  * Reference to App
3386
3095
  */
3387
3096
  app: App;
3388
3097
  /**
3389
- * Mapping of whether an internal plugin is enabled
3098
+ * Commands *without* editor callback, will always be available in the command palette
3099
+ *
3100
+ * @example
3101
+ * `app:open-vault` or `app:reload`
3390
3102
  */
3391
- config: InternalPluginsConfigRecord;
3392
- /** @internal */
3393
- migration: boolean;
3103
+ commands: CommandsCommandsRecord;
3394
3104
  /**
3395
- * Plugin configs for internal plugins
3105
+ * Commands *with* editor callback, will only be available when editor is active and callback returns
3106
+ * true
3396
3107
  *
3397
- * @remark Prefer usage of getPluginById to access a plugin
3108
+ * @example
3109
+ * `editor:fold-all` or `command-palette:open`
3398
3110
  */
3399
- plugins: {
3400
- [ID in InternalPluginNameType]: InternalPlugin<InternalPluginNameInstancesMapping[ID]>;
3401
- };
3402
- /** @internal - Load plugin configs and enable plugins */
3403
- enable(): Promise<void>;
3111
+ editorCommands: CommandsEditorCommandsRecord;
3404
3112
  /**
3405
- * Get an enabled internal plugin by ID
3113
+ * Add a command to the command registry
3406
3114
  *
3407
- * @param id - ID of the plugin to get
3115
+ * @param command - Command to add
3408
3116
  */
3409
- getEnabledPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNameInstancesMapping[ID] | null;
3117
+ addCommand(command: Command): void;
3410
3118
  /**
3411
- * Get all enabled internal plugins
3119
+ * Execute a command by reference
3120
+ *
3121
+ * @param command - Command to execute
3412
3122
  */
3413
- getEnabledPlugins(): InternalPlugin[];
3123
+ executeCommand(command: Command): boolean;
3414
3124
  /**
3415
- * Get an internal plugin by ID
3125
+ * Execute a command by ID
3416
3126
  *
3417
- * @param id - ID of the plugin to get
3127
+ * @param commandId - ID of command to execute
3418
3128
  */
3419
- getPluginById<ID extends InternalPluginNameType>(id: ID): InternalPlugin<InternalPluginNameInstancesMapping[ID]> | null;
3420
- /** @internal */
3421
- loadPlugin(arg: {
3422
- id: string;
3423
- name: string;
3424
- }): string;
3425
- /** @internal */
3426
- onRaw(cb1: unknown, cb2: unknown): void;
3427
- /** @internal Request save of plugin configs */
3428
- requestSaveConfig(): void;
3429
- /** @internal - Save current plugin configs */
3430
- saveConfig(): Promise<void>;
3431
- }
3432
- /** @todo Documentation incomplete */
3433
- /** @public */
3434
- export interface LoadProgress {
3435
- }
3436
- /** @public */
3437
- export interface PropertyEntryData<T> {
3129
+ executeCommandById(commandId: string): boolean;
3438
3130
  /**
3439
- * Property key
3131
+ * Find a command by ID
3132
+ *
3133
+ * @param commandId - ID of command to find
3440
3134
  */
3441
- key: string;
3135
+ findCommand(commandId: string): Command | undefined;
3442
3136
  /**
3443
- * Property widget type
3137
+ * Lists **all** commands, both with and without editor callback
3444
3138
  */
3445
- type: string;
3139
+ listCommands(): Command[];
3446
3140
  /**
3447
- * Property value
3141
+ * Remove a command from the command registry
3142
+ *
3143
+ * @param commandId - ID of command to remove
3448
3144
  */
3449
- value: T;
3450
- }
3451
- /** @public */
3452
- export interface MetadataWidget {
3145
+ removeCommand(commandId: string): void;
3453
3146
  }
3454
3147
  /** @public */
3455
- export interface MetadataEditorProperty extends Component {
3148
+ export interface ThemeManifest {
3456
3149
  /**
3457
- * Reference to the app
3150
+ * Name of the author of the theme
3458
3151
  */
3459
- app: App;
3152
+ author: string;
3460
3153
  /**
3461
- * Container element for the metadata editor property
3154
+ * URL to the author's website
3462
3155
  */
3463
- containerEl: HTMLElement;
3156
+ authorUrl?: string;
3464
3157
  /**
3465
- * Entry information for the property
3158
+ * Storage location of the theme relative to the vault root
3466
3159
  */
3467
- entry: PropertyEntryData<unknown>;
3160
+ dir: string;
3468
3161
  /**
3469
- * Icon element of the property
3162
+ * URL for funding the author
3470
3163
  */
3471
- iconEl: HTMLSpanElement;
3164
+ fundingUrl?: string;
3472
3165
  /**
3473
- * Key value of the property
3166
+ * Minimum Obsidian version compatible with the theme
3474
3167
  */
3475
- keyEl: HTMLElement;
3168
+ minAppVersion: string;
3476
3169
  /**
3477
- * Input field for key value of the property
3170
+ * Name of the theme
3478
3171
  */
3479
- keyInputEl: HTMLInputElement;
3172
+ name: string;
3480
3173
  /**
3481
- * Metadata editor the property is attached to
3174
+ * Version of the theme
3175
+ *
3176
+ * @remark Defaults to "0.0.0" if no theme manifest was provided in the repository
3482
3177
  */
3483
- metadataEditor: MetadataEditor;
3178
+ version: "0.0.0" | string;
3179
+ }
3180
+ /** @public */
3181
+ export interface CustomCSSThemesRecord extends Record<string, ThemeManifest> {
3182
+ }
3183
+ /** @public */
3184
+ export interface CustomCSSUpdatesRecord extends Record<string, unknown> {
3185
+ }
3186
+ /** @todo Documentation incomplete */
3187
+ /** @public */
3188
+ export interface CustomCSS extends Component {
3484
3189
  /**
3485
- * Widget that handles user input for this property widget type
3190
+ * Reference to App
3486
3191
  */
3487
- rendered: MetadataWidget | null;
3192
+ app: App;
3193
+ /** @internal Cache of CSS snippet filepath (relative to vault root) to CSS snippet contents */
3194
+ csscache: Map<string, string>;
3488
3195
  /**
3489
- * Info about the inferred and expected property widget given key-value pair
3196
+ * Set of enabled snippet, given by filenames
3490
3197
  */
3491
- typeInfo: {
3492
- expected: PropertyWidget<unknown>;
3493
- inferred: PropertyWidget<unknown>;
3494
- };
3198
+ enabledSnippets: Set<string>;
3495
3199
  /**
3496
- * Element that contains the value input or widget
3200
+ * @internal
3201
+ * Contains references to Style elements containing custom CSS snippets
3497
3202
  */
3498
- valueEl: HTMLElement;
3203
+ extraStyleEls: HTMLStyleElement[];
3499
3204
  /**
3500
- * Element containing the displayed warning on malformed property field
3205
+ * List of theme names not fully updated to post v1.0.0 theme guidelines
3501
3206
  */
3502
- warningEl: HTMLElement;
3207
+ oldThemes: string[];
3208
+ /** @internal */
3209
+ queue: WeakMap<object, unknown>;
3503
3210
  /**
3504
- * Focus on the key input element
3211
+ * List of snippets detected by Obsidian, given by their filenames
3505
3212
  */
3506
- focusKey(): void;
3213
+ snippets: string[];
3507
3214
  /**
3508
- * Focus on the property (container element)
3215
+ * Currently active theme, given by its name
3216
+ *
3217
+ * @remark is the default Obsidian theme
3509
3218
  */
3510
- focusProperty(): void;
3219
+ theme: "" | string;
3511
3220
  /**
3512
- * Focus on the value input element
3221
+ * Mapping of theme names to their manifest
3513
3222
  */
3514
- focusValue(which?: "both" | "end" | "start"): void;
3223
+ themes: CustomCSSThemesRecord;
3224
+ /** @internal */
3225
+ updates: CustomCSSUpdatesRecord;
3226
+ /** @internal */
3227
+ boundRaw(): void;
3515
3228
  /**
3516
- * Reveal the property menu on click event
3229
+ * Check whether a specific theme can be updated
3230
+ *
3231
+ * @param themeName - Name of the theme to check
3517
3232
  */
3518
- handleItemClick(event: MouseEvent): void;
3233
+ checkForUpdate(themeName: string): void;
3519
3234
  /**
3520
- * Focus on property on blur event
3235
+ * Check all themes for updates
3521
3236
  */
3522
- handlePropertyBlur(): void;
3237
+ checkForUpdates(): void;
3523
3238
  /**
3524
- * Update key of property and saves, returns false if error
3239
+ * Disable translucency of application background
3525
3240
  */
3526
- handleUpdateKey(key: string): boolean;
3241
+ disableTranslucency(): void;
3527
3242
  /**
3528
- * Update value of property and saves
3243
+ * Fetch legacy theme CSS using the pre-v1.0.0 theme download pipeline
3244
+ *
3245
+ * @returns String obsidian.css contents
3529
3246
  */
3530
- handleUpdateValue(value: unknown): void;
3247
+ downloadLegacyTheme(arg: {
3248
+ repo: string;
3249
+ }): Promise<string>;
3531
3250
  /**
3532
- * Loads as draggable property element
3251
+ * Enable translucency of application background
3533
3252
  */
3534
- onload(): void;
3253
+ enableTranslucency(): void;
3535
3254
  /**
3536
- * Render property widget based on type
3255
+ * Fetch a theme's manifest using repository URL
3256
+ *
3257
+ * @remark Do **not** include github prefix, only `username/repo`
3537
3258
  */
3538
- renderProperty(entry: PropertyEntryData<unknown>, check_errors?: boolean, use_expected_type?: boolean): void;
3259
+ getManifest(repoUrl: string): Promise<ThemeManifest>;
3539
3260
  /**
3540
- * Set the selected class of property
3261
+ * Convert snippet name to its corresponding filepath (relative to vault root)
3262
+ *
3263
+ * @returns String `.obsidian/snippets/${snippetName}.css`
3541
3264
  */
3542
- setSelected(selected: boolean): void;
3265
+ getSnippetPath(snippetName: string): string;
3543
3266
  /**
3544
- * Reveal property selection menu at mouse event
3267
+ * Returns the folder path where snippets are stored (relative to vault root)
3545
3268
  */
3546
- showPropertyMenu(event: MouseEvent): void;
3547
- }
3548
- /** @public */
3549
- export interface MetadataEditor extends Component {
3269
+ getSnippetsFolder(): string;
3550
3270
  /**
3551
- * Button element for adding a new property
3271
+ * Convert theme name to its corresponding filepath (relative to vault root)
3272
+ *
3273
+ * @returns String `.obsidian/themes/${themeName}/theme.css`
3552
3274
  */
3553
- addPropertyButtonEl: HTMLButtonElement;
3275
+ getThemePath(themeName: string): string;
3554
3276
  /**
3555
- * Reference to the app
3277
+ * Returns the folder path where themes are stored (relative to vault root)
3556
3278
  */
3557
- app: App;
3279
+ getThemesFolder(): string;
3558
3280
  /**
3559
- * Whether the frontmatter editor is collapsed
3281
+ * Returns whether there are themes that can be updated
3560
3282
  */
3561
- collapsed: boolean;
3283
+ hasUpdates(): boolean;
3562
3284
  /**
3563
- * Container element for the metadata editor
3564
- */
3565
- containerEl: HTMLElement;
3566
- /**
3567
- * Element containing metadata table and addPropertyButton
3285
+ * Install a legacy theme using the pre-v1.0.0 theme download pipeline<br> Will create a corresponding
3286
+ * dummy manifest for the theme
3287
+ *
3288
+ * @remark Name will be used as the folder name for the theme
3568
3289
  */
3569
- contentEl: HTMLElement;
3290
+ installLegacyTheme(arg: {
3291
+ name: string;
3292
+ repo: string;
3293
+ author: string;
3294
+ }): Promise<void>;
3570
3295
  /**
3571
- * The currently focused property
3296
+ * Install a theme using the regular theme download pipeline
3572
3297
  */
3573
- focusedLine: null | MetadataEditorProperty;
3298
+ installTheme(arg: {
3299
+ name: string;
3300
+ repo: string;
3301
+ author: string;
3302
+ }, version: string): Promise<void>;
3574
3303
  /**
3575
- * Fold button for folding away the frontmatter editor on hovering over headingEl
3304
+ * Check whether a specific theme is installed by theme name
3576
3305
  */
3577
- foldEl: HTMLElement;
3306
+ isThemeInstalled(themeName: string): boolean;
3307
+ /** @internal */
3308
+ onload(): void;
3309
+ /** @internal */
3310
+ onRaw(e: unknown): void;
3311
+ /** @internal */
3312
+ readSnippets(): void;
3313
+ /** @internal */
3314
+ readThemes(): void;
3578
3315
  /**
3579
- * Heading element for the metadata editor
3316
+ * Remove a theme by theme name
3580
3317
  */
3581
- headingEl: HTMLElement;
3318
+ removeTheme(themeName: string): Promise<void>;
3319
+ /** @internal */
3320
+ requestLoadSnippets(): void;
3321
+ /** @internal */
3322
+ requestLoadTheme(): void;
3323
+ /** @internal */
3324
+ requestReadThemes(): void;
3582
3325
  /**
3583
- * Hover element container
3326
+ * Set the activation status of a snippet by snippet name
3584
3327
  */
3585
- hoverPopover: null | HoverPopover;
3328
+ setCssEnabledStatus(snippetName: string, enabled: boolean): void;
3586
3329
  /**
3587
- * Owner of the metadata editor
3330
+ * Set the active theme by theme name
3588
3331
  */
3589
- owner: MarkdownView;
3332
+ setTheme(themeName: string): void;
3590
3333
  /**
3591
- * All properties existing in the metadata editor
3334
+ * Set the translucency of application background
3592
3335
  */
3593
- properties: PropertyEntryData<unknown>[];
3336
+ setTranslucency(translucency: boolean): void;
3337
+ }
3338
+ /** @public */
3339
+ export interface Draggable {
3340
+ source?: unknown;
3341
+ type: string;
3342
+ icon: string;
3343
+ title: string;
3344
+ file?: TAbstractFile;
3345
+ files?: TAbstractFile[];
3346
+ linktext?: string;
3347
+ sourcePath?: string;
3348
+ }
3349
+ /** @public */
3350
+ export interface DragStartEvent {
3351
+ evt: DragEvent;
3352
+ moved: boolean;
3353
+ }
3354
+ /** @public */
3355
+ export interface DropResult {
3356
+ action: string | null;
3357
+ dropEffect: "none" | "copy" | "link" | "move";
3358
+ hoverEl: HTMLElement | null;
3359
+ hoverClass: string;
3360
+ }
3361
+ /** @todo Documentation incomplete */
3362
+ /** @public */
3363
+ export interface DragManager {
3364
+ actionEl: HTMLElement | null;
3365
+ app: App;
3366
+ dragStart: DragStartEvent | null;
3367
+ draggable: Draggable | null;
3368
+ ghostEl: HTMLElement | null;
3369
+ hoverClass: string;
3370
+ hoverEl: HTMLElement | null;
3371
+ isDragOverHandled: boolean;
3372
+ overlayEl: HTMLElement;
3373
+ shouldHideOverlay: boolean;
3374
+ sourceClass: string;
3375
+ sourceEls: HTMLElement[] | null;
3376
+ dragFile(event: DragEvent, file: TFile, source?: unknown): Draggable;
3377
+ dragFiles(event: DragEvent, files: TAbstractFile[], source?: unknown): Draggable | null;
3378
+ dragFolder(event: DragEvent, folder: TFolder, source?: unknown): Draggable;
3379
+ dragLink(event: DragEvent, linkText: string, sourcePath: string, title?: string, source?: unknown): Draggable;
3380
+ handleDrag(el: HTMLElement, draggableGetter: (event: DragEvent) => Draggable | null): void;
3381
+ handleDrop(el: HTMLElement, dropHandler: (event: DragEvent, draggable: Draggable, isOver: boolean) => DropResult | null, draggable?: boolean): void;
3382
+ hideOverlay(): void;
3383
+ onDragEnd(): void;
3384
+ onDragLeave(event: DragEvent): void;
3385
+ onDragOver(event: DragEvent): void;
3386
+ onDragOverFirst(): void;
3387
+ onDragStart(event: DragEvent, draggable: Draggable): void;
3388
+ onDragStartGlobal(event: DragEvent): void;
3389
+ onTouchEnd(event: TouchEvent): void;
3390
+ removeOverlay(): void;
3391
+ setAction(action: string | null): void;
3392
+ showOverlay(doc: Document, rect: DOMRect): void;
3393
+ updateHover(hoverEl: HTMLElement | null, hoverClass: string): void;
3394
+ updateSource(sourceEls: HTMLElement[] | null, sourceClass: string): void;
3395
+ }
3396
+ /** @public */
3397
+ export interface EmbedContext {
3594
3398
  /**
3595
- * Element containing all property elements
3399
+ * Reference to the app
3596
3400
  */
3597
- propertyListEl: HTMLElement;
3401
+ app: App;
3598
3402
  /**
3599
- * List of all property field editors
3403
+ * Element where the embed should be displayed
3600
3404
  */
3601
- rendered: MetadataEditorProperty[];
3405
+ containerEl: HTMLElement;
3602
3406
  /**
3603
- * Set of all selected property editors
3407
+ * Depth of the embed within its container (how many levels of embeds are above it)
3604
3408
  */
3605
- selectedLines: Set<MetadataEditorProperty>;
3409
+ depth?: number;
3606
3410
  /**
3607
- * Convert given properties to a serialized object and store in clipboard as obsidian/properties
3411
+ * Whether the embed should be dynamic (CM) or static (postProcessed)
3608
3412
  */
3609
- _copyToClipboard(event: ClipboardEvent, properties: MetadataEditorProperty[]): void;
3413
+ displayMode?: boolean;
3610
3414
  /**
3611
- * Uncollapse editor if collapsed and create a new property row
3415
+ * Text that should be displayed in the embed
3612
3416
  */
3613
- addProperty(): void;
3417
+ linktext?: string;
3614
3418
  /**
3615
- * Clear all properties
3419
+ * Whether the embed should be an inline embed
3616
3420
  */
3617
- clear(): void;
3421
+ showInline?: boolean;
3618
3422
  /**
3619
- * Unselect all lines
3423
+ * Optional path to the current open file
3620
3424
  */
3621
- clearSelection(): void;
3425
+ sourcePath?: string;
3426
+ /** @internal */
3427
+ state?: unknown;
3428
+ }
3429
+ /** @todo Documentation incomplete */
3430
+ /** @public */
3431
+ export type EmbeddableConstructor = (context: EmbedContext, file: TFile, path?: string) => Component;
3432
+ /** @public */
3433
+ export interface EmbedRegistryEmbedByExtensionRecord extends Record<string, EmbeddableConstructor> {
3434
+ }
3435
+ /** @public */
3436
+ export interface EmbedRegistry extends Events {
3622
3437
  /**
3623
- * Focus on property field with given key
3438
+ * Mapping of file extensions to constructors for embeddable widgets
3624
3439
  */
3625
- focusKey(key: string): void;
3440
+ embedByExtension: EmbedRegistryEmbedByExtensionRecord;
3626
3441
  /**
3627
- * Focus on property
3442
+ * Get the embed constructor for a specific file type
3628
3443
  */
3629
- focusProperty(property: MetadataEditorProperty): void;
3444
+ getEmbedCreator(file: TFile): EmbeddableConstructor | null;
3630
3445
  /**
3631
- * Focus on property at specified index
3446
+ * Check whether a file extension has a registered embed constructor
3632
3447
  */
3633
- focusPropertyAtIndex(index: number): void;
3448
+ isExtensionRegistered(extension: string): boolean;
3634
3449
  /**
3635
- * Focus on property with value
3450
+ * Register an embed constructor for a specific file extension
3636
3451
  */
3637
- focusValue(value: string, which: "both" | "end" | "start"): void;
3452
+ registerExtension(extension: string, embedCreator: EmbeddableConstructor): void;
3638
3453
  /**
3639
- * Handle copy event on selection and serialize properties
3454
+ * Register an embed constructor for a list of file extensions
3640
3455
  */
3641
- handleCopy(event: ClipboardEvent): void;
3456
+ registerExtensions(extensions: string[], embedCreator: EmbeddableConstructor): void;
3642
3457
  /**
3643
- * Handle cut event and serialize and remove properties
3458
+ * Unregister an embed constructor for a specific file extension
3644
3459
  */
3645
- handleCut(event: ClipboardEvent): void;
3460
+ unregisterExtension(extension: string): void;
3646
3461
  /**
3647
- * Handle selection of item for drag handling
3462
+ * Unregister an embed constructor for a list of file extensions
3648
3463
  */
3649
- handleItemSelection(event: PointerEvent, property: MetadataEditorProperty): boolean;
3464
+ unregisterExtensions(extensions: string[]): void;
3465
+ }
3466
+ /** @todo Documentation incomplete */
3467
+ /** @public */
3468
+ export interface FoldManager {
3469
+ }
3470
+ /** @public */
3471
+ export interface HotkeyManagerCustomKeysRecord extends Record<string, KeymapInfo[]> {
3472
+ }
3473
+ /** @public */
3474
+ export interface HotkeyManagerDefaultKeysRecord extends Record<string, KeymapInfo[]> {
3475
+ }
3476
+ /** @public */
3477
+ export interface HotkeyManager {
3650
3478
  /**
3651
- * Handle key press event for controlling selection or movement of property up/down
3479
+ * Reference to App
3652
3480
  */
3653
- handleKeypress(event: KeyboardEvent): void;
3481
+ app: App;
3482
+ /** @internal Whether hotkeys have been baked (checks completed) */
3483
+ baked: boolean;
3654
3484
  /**
3655
- * Handle paste event of properties into metadata editor
3485
+ * Assigned hotkeys
3656
3486
  */
3657
- handlePaste(event: ClipboardEvent): void;
3487
+ bakedHotkeys: KeymapInfo[];
3658
3488
  /**
3659
- * Whether the editor has focus
3489
+ * Array of hotkey index to command ID
3660
3490
  */
3661
- hasFocus(): boolean;
3491
+ bakedIds: string[];
3662
3492
  /**
3663
- * Whether there is a property that is focused
3493
+ * Custom (non-Obsidian default) hotkeys, one to many mapping of command ID to assigned hotkey
3664
3494
  */
3665
- hasPropertyFocused(): boolean;
3495
+ customKeys: HotkeyManagerCustomKeysRecord;
3666
3496
  /**
3667
- * Add new properties to the metadata editor and save
3497
+ * Default hotkeys, one to many mapping of command ID to assigned hotkey
3668
3498
  */
3669
- insertProperties(properties: Record<string, any>): void;
3499
+ defaultKeys: HotkeyManagerDefaultKeysRecord;
3670
3500
  /**
3671
- * On loading of the metadata editor, register on metadata type change event
3501
+ * Add a hotkey to the default hotkeys
3502
+ *
3503
+ * @param command - Command ID to add hotkey to
3504
+ * @param keys - Hotkeys to add
3672
3505
  */
3673
- onload(): void;
3506
+ addDefaultHotkeys(command: string, keys: KeymapInfo[]): void;
3507
+ /** @internal Bake hotkeys (create mapping of pressed key to command ID) */
3508
+ bake(): void;
3674
3509
  /**
3675
- * On vault metadata update, update property render
3510
+ * Get hotkey associated with command ID
3511
+ *
3512
+ * @param command - Command ID to get hotkey for
3676
3513
  */
3677
- onMetadataTypeChange(property: MetadataEditorProperty): void;
3514
+ getDefaultHotkeys(command: string): KeymapInfo[];
3678
3515
  /**
3679
- * Remove specified properties from the metadata editor and save, and reset focus if specified
3516
+ * Get hotkey associated with command ID
3517
+ *
3518
+ * @param command - Command ID to get hotkey for
3680
3519
  */
3681
- removeProperties(properties: MetadataEditorProperty[], reset_focus?: boolean): unknown;
3520
+ getHotkeys(command: string): KeymapInfo[];
3521
+ /** @internal Load hotkeys from storage */
3522
+ load(): void;
3523
+ /** @internal */
3524
+ onConfigFileChanged(): void;
3525
+ /** @internal */
3526
+ onRaw(e: unknown): void;
3682
3527
  /**
3683
- * Reorder the entry to specified index position and save
3528
+ * Trigger a command by keyboard event
3529
+ *
3530
+ * @param event - Keyboard event to trigger command with
3531
+ * @param keypress - Pressed key information
3684
3532
  */
3685
- reorderKey(entry: PropertyEntryData<unknown>, index: number): unknown;
3533
+ onTrigger(event: KeyboardEvent, keypress: KeymapInfo): boolean;
3686
3534
  /**
3687
- * Serialize the properties and save frontmatter
3535
+ * Pretty-print hotkey of a command
3536
+ *
3537
+ * @param commandId - Command ID to print hotkey for
3688
3538
  */
3689
- save(): void;
3690
- /**
3691
- * Select all property fields
3692
- */
3693
- selectAll(): void;
3694
- /**
3695
- * Mark specified property as selected
3696
- */
3697
- selectProperty(property: MetadataEditorProperty | undefined, select: boolean): void;
3698
- /**
3699
- * Convert properties to a serialized object
3700
- */
3701
- serialize(): Record<string, any>;
3702
- /**
3703
- * Sets frontmatter as collapsed or uncollapsed
3704
- */
3705
- setCollapse(collapsed: boolean, x: boolean): void;
3539
+ printHotkeyForCommand(commandId: string): string;
3540
+ /** @internal */
3541
+ registerListeners(): void;
3706
3542
  /**
3707
- * On context menu event on header element, show property menu
3543
+ * Remove a hotkey from the default hotkeys
3544
+ *
3545
+ * @param command - Command ID to remove hotkey from
3708
3546
  */
3709
- showPropertiesMenu(event: MouseEvent): void;
3547
+ removeDefaultHotkeys(command: string): void;
3710
3548
  /**
3711
- * Synchronize data with given properties and re-render them
3549
+ * Remove a hotkey from the custom hotkeys
3550
+ *
3551
+ * @param command - Command ID to remove hotkey from
3712
3552
  */
3713
- synchronize(data: Record<string, any>): void;
3553
+ removeHotkeys(command: string): void;
3554
+ /** @internal Save custom hotkeys to storage */
3555
+ save(): void;
3714
3556
  /**
3715
- * Toggle collapsed state of the metadata editor
3557
+ * Add a hotkey to the custom hotkeys (overrides default hotkeys)
3558
+ *
3559
+ * @param command - Command ID to add hotkey to
3560
+ * @param keys - Hotkeys to add
3716
3561
  */
3717
- toggleCollapse(): void;
3562
+ setHotkeys(command: string, keys: KeymapInfo[]): void;
3718
3563
  }
3719
3564
  /** @public */
3720
- export interface PropertyRenderContext {
3721
- /**
3722
- * Reference to the app
3723
- */
3724
- app: App;
3725
- /**
3726
- * Callback called on property field unfocus
3727
- */
3728
- blur: () => void;
3729
- /**
3730
- * Key of the property field
3731
- */
3732
- key: string;
3733
- /**
3734
- * Reference to the metadata editor
3735
- */
3736
- metadataEditor: MetadataEditor;
3737
- /**
3738
- * Callback called on property value change
3739
- */
3740
- onChange: () => void;
3741
- /**
3742
- * Determine the source path of current context
3743
- */
3744
- sourcePath: string;
3565
+ export interface AudioRecorderPluginInstance extends InternalPluginInstance {
3745
3566
  }
3746
3567
  /** @public */
3747
- export interface PropertyWidget<T> {
3748
- /**
3749
- * Lucide-dev icon associated with the widget
3750
- */
3751
- icon: string;
3752
- /**
3753
- * Returns the I18N name of the widget
3754
- */
3755
- name: () => string;
3756
- /**
3757
- * Reserved keys for the widget
3758
- */
3759
- reservedKeys?: string[];
3760
- /**
3761
- * Identifier for the widget
3762
- */
3763
- type: string;
3764
- /**
3765
- * Get the default value for the property widget
3766
- */
3767
- default(): T;
3768
- /**
3769
- * Render function for the widget on field container given context and data
3770
- */
3771
- render(containerEl: HTMLElement, data: PropertyEntryData<T>, context: PropertyRenderContext): Component | void;
3772
- /**
3773
- * Validate whether the input value to the widget is correct
3774
- */
3775
- validate(value: T): boolean;
3568
+ export interface BacklinkPluginInstance extends InternalPluginInstance {
3776
3569
  }
3777
- /**
3778
- * @todo Documentation incomplete
3779
- */
3780
3570
  /** @public */
3781
- export type PropertyWidgetType = "aliases" | "checkbox" | "date" | "datetime" | "multitext" | "number" | "tags" | "text" | (string & any);
3571
+ export interface BookmarksPluginInstance extends InternalPluginInstance {
3572
+ }
3782
3573
  /** @public */
3783
- export interface MetadataTypeManagerPropertiesRecord extends Record<string, PropertyInfo> {
3574
+ export interface CommandPalettePluginInstance extends InternalPluginInstance {
3784
3575
  }
3785
3576
  /** @public */
3786
- export interface MetadataTypeManagerRegisteredTypeWidgetsRecord extends Record<PropertyWidgetType, PropertyWidget<unknown>> {
3577
+ export interface DailyNotesPluginInstance extends InternalPluginInstance {
3787
3578
  }
3788
3579
  /** @public */
3789
- export interface MetadataTypeManagerTypesRecord extends Record<string, PropertyWidgetType> {
3580
+ export interface EditorStatusPluginInstance extends InternalPluginInstance {
3790
3581
  }
3582
+ /** @todo Documentation incomplete */
3791
3583
  /** @public */
3792
- export interface MetadataTypeManager extends Events {
3793
- /**
3794
- * Reference to App
3795
- */
3796
- app: App;
3797
- /**
3798
- * Registered properties of the vault
3799
- */
3800
- properties: MetadataTypeManagerPropertiesRecord;
3801
- /** @internal Registered type widgets */
3802
- registeredTypeWidgets: MetadataTypeManagerRegisteredTypeWidgetsRecord;
3803
- /**
3804
- * Associated widget types for each property
3805
- */
3806
- types: MetadataTypeManagerTypesRecord;
3807
- /**
3808
- * Get all registered properties of the vault
3809
- */
3810
- getAllProperties(): Record<string, PropertyInfo>;
3811
- /**
3812
- * Get assigned widget type for property
3813
- */
3814
- getAssignedType(property: string): PropertyWidgetType | null;
3815
- /**
3816
- * Get info for property
3817
- */
3818
- getPropertyInfo(property: string): PropertyInfo;
3819
- /** @internal Get expected widget type for property and the one inferred from the property value */
3820
- getTypeInfo(arg: {
3821
- key: string;
3822
- type: string;
3823
- value: unknown;
3824
- }): {
3825
- inferred: PropertyWidget<unknown>;
3826
- expected: PropertyWidget<unknown>;
3827
- };
3584
+ export interface FileExplorerPluginInstance extends InternalPluginInstance {
3828
3585
  /**
3829
- * Get all properties with an assigned widget type
3586
+ * Reveals a file or folder in the file explorer view, opens the view if it is not already
3587
+ * open/visible
3830
3588
  */
3831
- getTypes(): string[];
3832
- /** @internal Load property types from config */
3833
- loadData(): Promise<void>;
3834
- /** @internal */
3835
- onRaw(e: unknown): void;
3836
- /** @internal */
3837
- registerListeners(): void;
3838
- /** @internal Save property types to config */
3839
- save(): Promise<void>;
3840
- /** @internal Get all properties from metadata cache */
3841
- savePropertyInfo(): void;
3842
- /** @internal Set widget type for property */
3843
- setType(property: string, type: PropertyWidgetType): Promise<void>;
3844
- /** @internal Unset widget type for property */
3845
- unsetType(property: string): Promise<void>;
3589
+ revealInFolder(item: TFile | TFolder): void;
3846
3590
  }
3847
- /** @todo Documentation incomplete */
3848
3591
  /** @public */
3849
- export interface MobileNavbar {
3592
+ export interface FileRecoveryPluginInstance extends InternalPluginInstance {
3850
3593
  }
3851
3594
  /** @todo Documentation incomplete */
3852
3595
  /** @public */
3853
- export interface MobileToolbar {
3596
+ export interface GlobalSearchPluginInstance extends InternalPluginInstance {
3854
3597
  }
3855
3598
  /** @public */
3856
- export interface ObsidianDOM {
3857
- /**
3858
- * Root element of the application
3859
- */
3860
- appContainerEl: HTMLElement;
3861
- /**
3862
- * Child of `appContainerEl` containing the main content of the application
3863
- */
3864
- horizontalMainContainerEl: HTMLElement;
3865
- /**
3866
- * Status bar element containing word count among other things
3867
- */
3868
- statusBarEl: HTMLElement;
3869
- /**
3870
- * Child of `horizontalMainContainerEl` containing the workspace DOM
3871
- */
3872
- workspaceEl: HTMLElement;
3599
+ export interface GraphPluginInstance extends InternalPluginInstance {
3873
3600
  }
3874
3601
  /** @public */
3875
- export interface PluginUpdateManifest {
3876
- /**
3877
- * Manifest of the plugin
3878
- */
3879
- manifest: PluginManifest;
3880
- /**
3881
- * Repository of the plugin
3882
- */
3883
- repo: string;
3884
- /**
3885
- * New version of the plugin
3886
- */
3887
- version: string;
3602
+ export declare const InternalPluginName: {
3603
+ readonly AudioRecorder: "audio-recorder";
3604
+ readonly Backlink: "backlink";
3605
+ readonly Bookmarks: "bookmarks";
3606
+ readonly Canvas: "canvas";
3607
+ readonly CommandPalette: "command-palette";
3608
+ readonly DailyNotes: "daily-notes";
3609
+ readonly EditorStatus: "editor-status";
3610
+ readonly FileExplorer: "file-explorer";
3611
+ readonly FileRecovery: "file-recovery";
3612
+ readonly GlobalSearch: "global-search";
3613
+ readonly Graph: "graph";
3614
+ readonly MarkdownImporter: "markdown-importer";
3615
+ readonly NoteComposer: "note-composer";
3616
+ readonly OutgoingLink: "outgoing-link";
3617
+ readonly Outline: "outline";
3618
+ readonly PagePreview: "page-preview";
3619
+ readonly Properties: "properties";
3620
+ readonly Publish: "publish";
3621
+ readonly RandomNote: "random-note";
3622
+ readonly SlashCommand: "slash-command";
3623
+ readonly Slides: "slides";
3624
+ readonly Starred: "starred";
3625
+ readonly Switcher: "switcher";
3626
+ readonly Sync: "sync";
3627
+ readonly TagPane: "tag-pane";
3628
+ readonly Templates: "templates";
3629
+ readonly WordCount: "word-count";
3630
+ readonly Workspaces: "workspaces";
3631
+ readonly ZkPrefixer: "zk-prefixer";
3632
+ };
3633
+ /** @public */
3634
+ export interface MarkdownImporterPluginInstance extends InternalPluginInstance {
3888
3635
  }
3889
3636
  /** @public */
3890
- export interface PluginsManifestsRecord extends Record<string, PluginManifest> {
3637
+ export interface NoteComposerPluginInstance extends InternalPluginInstance {
3891
3638
  }
3892
3639
  /** @public */
3893
- export interface PluginsPluginsRecord extends Record<string, Plugin$1> {
3640
+ export interface OutgoingLinkPluginInstance extends InternalPluginInstance {
3894
3641
  }
3895
3642
  /** @public */
3896
- export interface Plugins {
3897
- /**
3898
- * Reference to App
3899
- */
3900
- app: App;
3901
- /**
3902
- * Set of enabled plugin IDs
3903
- *
3904
- * @remark The plugin ids aren't guaranteed to be either active (in `app.plugins.plugins`) or installed (in `app.plugins.manifests`)
3905
- */
3906
- enabledPlugins: Set<string>;
3907
- /** @internal Plugin ID that is currently being enabled */
3908
- loadingPluginId: string | null;
3909
- /**
3910
- * Manifests of all the plugins that are installed
3911
- */
3912
- manifests: PluginsManifestsRecord;
3913
- /**
3914
- * Mapping of plugin ID to active plugin instance
3915
- *
3916
- * @remark Prefer usage of getPlugin to access a plugin
3917
- */
3918
- plugins: PluginsPluginsRecord;
3643
+ export interface OutlinePluginInstance extends InternalPluginInstance {
3644
+ }
3645
+ /** @public */
3646
+ export interface PagePreviewPluginInstance extends InternalPluginInstance {
3647
+ }
3648
+ /** @public */
3649
+ export interface PropertiesPluginInstance extends InternalPluginInstance {
3650
+ }
3651
+ /** @public */
3652
+ export interface PublishPluginInstance extends InternalPluginInstance {
3653
+ }
3654
+ /** @public */
3655
+ export interface RandomNotePluginInstance extends InternalPluginInstance {
3656
+ }
3657
+ /** @public */
3658
+ export interface SlashCommandPluginInstance extends InternalPluginInstance {
3659
+ }
3660
+ /** @public */
3661
+ export interface SlidesPluginInstance extends InternalPluginInstance {
3662
+ }
3663
+ /** @public */
3664
+ export interface StarredPluginInstance extends InternalPluginInstance {
3665
+ }
3666
+ /** @public */
3667
+ export interface SwitcherPluginInstance extends InternalPluginInstance {
3668
+ }
3669
+ /** @public */
3670
+ export interface SyncPluginInstance extends InternalPluginInstance {
3671
+ }
3672
+ /** @public */
3673
+ export interface TagPanePluginInstance extends InternalPluginInstance {
3674
+ }
3675
+ /** @public */
3676
+ export interface TemplatesPluginInstance extends InternalPluginInstance {
3677
+ }
3678
+ /** @public */
3679
+ export interface WordCountPluginInstance extends InternalPluginInstance {
3680
+ }
3681
+ /** @public */
3682
+ export interface WorkspacesPluginInstance extends InternalPluginInstance {
3683
+ }
3684
+ /** @public */
3685
+ export interface ZkPrefixerPluginInstance extends InternalPluginInstance {
3686
+ }
3687
+ /** @public */
3688
+ export type InternalPluginNameInstancesMapping = {
3689
+ [InternalPluginName.AudioRecorder]: AudioRecorderPluginInstance;
3690
+ [InternalPluginName.Backlink]: BacklinkPluginInstance;
3691
+ [InternalPluginName.Bookmarks]: BookmarksPluginInstance;
3692
+ [InternalPluginName.Canvas]: CanvasPluginInstance;
3693
+ [InternalPluginName.CommandPalette]: CommandPalettePluginInstance;
3694
+ [InternalPluginName.DailyNotes]: DailyNotesPluginInstance;
3695
+ [InternalPluginName.EditorStatus]: EditorStatusPluginInstance;
3696
+ [InternalPluginName.FileExplorer]: FileExplorerPluginInstance;
3697
+ [InternalPluginName.FileRecovery]: FileRecoveryPluginInstance;
3698
+ [InternalPluginName.GlobalSearch]: GlobalSearchPluginInstance;
3699
+ [InternalPluginName.Graph]: GraphPluginInstance;
3700
+ [InternalPluginName.MarkdownImporter]: MarkdownImporterPluginInstance;
3701
+ [InternalPluginName.NoteComposer]: NoteComposerPluginInstance;
3702
+ [InternalPluginName.OutgoingLink]: OutgoingLinkPluginInstance;
3703
+ [InternalPluginName.Outline]: OutlinePluginInstance;
3704
+ [InternalPluginName.PagePreview]: PagePreviewPluginInstance;
3705
+ [InternalPluginName.Properties]: PropertiesPluginInstance;
3706
+ [InternalPluginName.Publish]: PublishPluginInstance;
3707
+ [InternalPluginName.RandomNote]: RandomNotePluginInstance;
3708
+ [InternalPluginName.SlashCommand]: SlashCommandPluginInstance;
3709
+ [InternalPluginName.Slides]: SlidesPluginInstance;
3710
+ [InternalPluginName.Starred]: StarredPluginInstance;
3711
+ [InternalPluginName.Switcher]: SwitcherPluginInstance;
3712
+ [InternalPluginName.Sync]: SyncPluginInstance;
3713
+ [InternalPluginName.TagPane]: TagPanePluginInstance;
3714
+ [InternalPluginName.Templates]: TemplatesPluginInstance;
3715
+ [InternalPluginName.WordCount]: WordCountPluginInstance;
3716
+ [InternalPluginName.Workspaces]: WorkspacesPluginInstance;
3717
+ [InternalPluginName.ZkPrefixer]: ZkPrefixerPluginInstance;
3718
+ };
3719
+ /** @public */
3720
+ export type InternalPluginNameType = (typeof InternalPluginName)[keyof typeof InternalPluginName];
3721
+ /** @public */
3722
+ export interface InternalPluginsConfigRecord extends Record<InternalPluginNameType, boolean> {
3723
+ }
3724
+ /** @public */
3725
+ export interface InternalPlugins extends Events {
3919
3726
  /**
3920
- * Mapping of plugin ID to available updates
3727
+ * Reference to App
3921
3728
  */
3922
- updates: Map<string, PluginUpdateManifest>;
3923
- /** @internal Check online list for deprecated plugins to automatically disable */
3924
- checkForDeprecations(): Promise<void>;
3729
+ app: App;
3925
3730
  /**
3926
- * Check for plugin updates
3731
+ * Mapping of whether an internal plugin is enabled
3927
3732
  */
3928
- checkForUpdates(): Promise<void>;
3733
+ config: InternalPluginsConfigRecord;
3734
+ /** @internal */
3735
+ migration: boolean;
3929
3736
  /**
3930
- * Unload a plugin by ID
3737
+ * Plugin configs for internal plugins
3738
+ *
3739
+ * @remark Prefer usage of getPluginById to access a plugin
3931
3740
  */
3932
- disablePlugin(id: string): Promise<void>;
3741
+ plugins: {
3742
+ [ID in InternalPluginNameType]: InternalPlugin<InternalPluginNameInstancesMapping[ID]>;
3743
+ };
3744
+ /** @internal - Load plugin configs and enable plugins */
3745
+ enable(): Promise<void>;
3933
3746
  /**
3934
- * Unload a plugin by ID and save config for persistence
3747
+ * Get an enabled internal plugin by ID
3748
+ *
3749
+ * @param id - ID of the plugin to get
3935
3750
  */
3936
- disablePluginAndSave(id: string): Promise<void>;
3751
+ getEnabledPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNameInstancesMapping[ID] | null;
3937
3752
  /**
3938
- * Enable a plugin by ID
3753
+ * Get all enabled internal plugins
3939
3754
  */
3940
- enablePlugin(id: string): Promise<void>;
3755
+ getEnabledPlugins(): InternalPlugin[];
3941
3756
  /**
3942
- * Enable a plugin by ID and save config for persistence
3757
+ * Get an internal plugin by ID
3758
+ *
3759
+ * @param id - ID of the plugin to get
3943
3760
  */
3944
- enablePluginAndSave(id: string): Promise<void>;
3761
+ getPluginById<ID extends InternalPluginNameType>(id: ID): InternalPlugin<InternalPluginNameInstancesMapping[ID]> | null;
3762
+ /** @internal */
3763
+ loadPlugin(arg: {
3764
+ id: string;
3765
+ name: string;
3766
+ }): string;
3767
+ /** @internal */
3768
+ onRaw(cb1: unknown, cb2: unknown): void;
3769
+ /** @internal Request save of plugin configs */
3770
+ requestSaveConfig(): void;
3771
+ /** @internal - Save current plugin configs */
3772
+ saveConfig(): Promise<void>;
3773
+ }
3774
+ /** @todo Documentation incomplete */
3775
+ /** @public */
3776
+ export interface LoadProgress {
3777
+ }
3778
+ /**
3779
+ * @todo Documentation incomplete
3780
+ */
3781
+ /** @public */
3782
+ export type PropertyWidgetType = "aliases" | "checkbox" | "date" | "datetime" | "multitext" | "number" | "tags" | "text" | (string & any);
3783
+ /** @public */
3784
+ export interface MetadataTypeManagerPropertiesRecord extends Record<string, PropertyInfo> {
3785
+ }
3786
+ /** @public */
3787
+ export interface MetadataTypeManagerRegisteredTypeWidgetsRecord extends Record<PropertyWidgetType, PropertyWidget<unknown>> {
3788
+ }
3789
+ /** @public */
3790
+ export interface MetadataTypeManagerTypesRecord extends Record<string, PropertyWidgetType> {
3791
+ }
3792
+ /** @public */
3793
+ export interface MetadataTypeManager extends Events {
3945
3794
  /**
3946
- * Get a plugin by ID
3795
+ * Reference to App
3947
3796
  */
3948
- getPlugin(id: string): Plugin$1 | null;
3797
+ app: App;
3949
3798
  /**
3950
- * Get the folder where plugins are stored
3799
+ * Registered properties of the vault
3951
3800
  */
3952
- getPluginFolder(): string;
3953
- /** @internal Load plugin manifests and enable plugins from config */
3954
- initialize(): Promise<void>;
3801
+ properties: MetadataTypeManagerPropertiesRecord;
3802
+ /** @internal Registered type widgets */
3803
+ registeredTypeWidgets: MetadataTypeManagerRegisteredTypeWidgetsRecord;
3955
3804
  /**
3956
- * Install a plugin from a given URL
3805
+ * Associated widget types for each property
3957
3806
  */
3958
- installPlugin(repo: string, version: string, manifest: PluginManifest): Promise<void>;
3807
+ types: MetadataTypeManagerTypesRecord;
3959
3808
  /**
3960
- * Check whether a plugin is deprecated
3809
+ * Get all registered properties of the vault
3961
3810
  */
3962
- isDeprecated(id: string): boolean;
3811
+ getAllProperties(): Record<string, PropertyInfo>;
3963
3812
  /**
3964
- * Check whether community plugins are enabled
3813
+ * Get assigned widget type for property
3965
3814
  */
3966
- isEnabled(): boolean;
3815
+ getAssignedType(property: string): PropertyWidgetType | null;
3967
3816
  /**
3968
- * Load a specific plugin's manifest by its folder path
3817
+ * Get info for property
3969
3818
  */
3970
- loadManifest(path: string): Promise<void>;
3971
- /** @internal Load all plugin manifests from plugin folder */
3972
- loadManifests(): Promise<void>;
3819
+ getPropertyInfo(property: string): PropertyInfo;
3820
+ /** @internal Get expected widget type for property and the one inferred from the property value */
3821
+ getTypeInfo(arg: {
3822
+ key: string;
3823
+ type: string;
3824
+ value: unknown;
3825
+ }): {
3826
+ inferred: PropertyWidget<unknown>;
3827
+ expected: PropertyWidget<unknown>;
3828
+ };
3973
3829
  /**
3974
- * Load a plugin by its ID
3830
+ * Get all properties with an assigned widget type
3975
3831
  */
3976
- loadPlugin(id: string): Promise<Plugin$1>;
3832
+ getTypes(): string[];
3833
+ /** @internal Load property types from config */
3834
+ loadData(): Promise<void>;
3977
3835
  /** @internal */
3978
3836
  onRaw(e: unknown): void;
3979
- /** @internal - Save current plugin configs */
3980
- saveConfig(): Promise<void>;
3981
- /** @internal Toggle whether community plugins are enabled */
3982
- setEnable(enabled: boolean): Promise<void>;
3983
- /**
3984
- * Uninstall a plugin by ID
3985
- */
3986
- uninstallPlugin(id: string): Promise<void>;
3987
- /**
3988
- * Unload a plugin by ID
3989
- */
3990
- unloadPlugin(id: string): Promise<void>;
3837
+ /** @internal */
3838
+ registerListeners(): void;
3839
+ /** @internal Save property types to config */
3840
+ save(): Promise<void>;
3841
+ /** @internal Get all properties from metadata cache */
3842
+ savePropertyInfo(): void;
3843
+ /** @internal Set widget type for property */
3844
+ setType(property: string, type: PropertyWidgetType): Promise<void>;
3845
+ /** @internal Unset widget type for property */
3846
+ unsetType(property: string): Promise<void>;
3991
3847
  }
3848
+ /** @todo Documentation incomplete */
3992
3849
  /** @public */
3993
- export interface ViewRegistryTypeByExtensionRecord extends Record<string, string> {
3850
+ export interface MobileNavbar {
3994
3851
  }
3852
+ /** @todo Documentation incomplete */
3995
3853
  /** @public */
3996
- export interface ViewRegistryViewByTypeRecord extends Record<string, (leaf: WorkspaceLeaf) => View> {
3854
+ export interface MobileToolbar {
3997
3855
  }
3998
3856
  /** @public */
3999
- export interface ViewRegistry extends Events {
3857
+ export interface ObsidianDOM {
4000
3858
  /**
4001
- * Mapping of file extensions to view type
3859
+ * Root element of the application
4002
3860
  */
4003
- typeByExtension: ViewRegistryTypeByExtensionRecord;
3861
+ appContainerEl: HTMLElement;
4004
3862
  /**
4005
- * Mapping of view type to view constructor
3863
+ * Child of `appContainerEl` containing the main content of the application
4006
3864
  */
4007
- viewByType: ViewRegistryViewByTypeRecord;
3865
+ horizontalMainContainerEl: HTMLElement;
4008
3866
  /**
4009
- * Get the view type associated with a file extension
4010
- *
4011
- * @param extension - File extension
3867
+ * Status bar element containing word count among other things
4012
3868
  */
4013
- getTypeByExtension(extension: string): string;
3869
+ statusBarEl: HTMLElement;
4014
3870
  /**
4015
- * Get the view constructor associated with a view type
3871
+ * Child of `horizontalMainContainerEl` containing the workspace DOM
4016
3872
  */
4017
- getViewCreatorByType(type: string): (leaf: WorkspaceLeaf) => View;
3873
+ workspaceEl: HTMLElement;
3874
+ }
3875
+ /** @public */
3876
+ export interface PluginUpdateManifest {
4018
3877
  /**
4019
- * Check whether a view type is registered
3878
+ * Manifest of the plugin
3879
+ */
3880
+ manifest: PluginManifest;
3881
+ /**
3882
+ * Repository of the plugin
3883
+ */
3884
+ repo: string;
3885
+ /**
3886
+ * New version of the plugin
3887
+ */
3888
+ version: string;
3889
+ }
3890
+ /** @public */
3891
+ export interface PluginsManifestsRecord extends Record<string, PluginManifest> {
3892
+ }
3893
+ /** @public */
3894
+ export interface PluginsPluginsRecord extends Record<string, Plugin$1> {
3895
+ }
3896
+ /** @public */
3897
+ export interface Plugins {
3898
+ /**
3899
+ * Reference to App
3900
+ */
3901
+ app: App;
3902
+ /**
3903
+ * Set of enabled plugin IDs
3904
+ *
3905
+ * @remark The plugin ids aren't guaranteed to be either active (in `app.plugins.plugins`) or installed (in `app.plugins.manifests`)
3906
+ */
3907
+ enabledPlugins: Set<string>;
3908
+ /** @internal Plugin ID that is currently being enabled */
3909
+ loadingPluginId: string | null;
3910
+ /**
3911
+ * Manifests of all the plugins that are installed
3912
+ */
3913
+ manifests: PluginsManifestsRecord;
3914
+ /**
3915
+ * Mapping of plugin ID to active plugin instance
3916
+ *
3917
+ * @remark Prefer usage of getPlugin to access a plugin
3918
+ */
3919
+ plugins: PluginsPluginsRecord;
3920
+ /**
3921
+ * Mapping of plugin ID to available updates
3922
+ */
3923
+ updates: Map<string, PluginUpdateManifest>;
3924
+ /** @internal Check online list for deprecated plugins to automatically disable */
3925
+ checkForDeprecations(): Promise<void>;
3926
+ /**
3927
+ * Check for plugin updates
3928
+ */
3929
+ checkForUpdates(): Promise<void>;
3930
+ /**
3931
+ * Unload a plugin by ID
3932
+ */
3933
+ disablePlugin(id: string): Promise<void>;
3934
+ /**
3935
+ * Unload a plugin by ID and save config for persistence
3936
+ */
3937
+ disablePluginAndSave(id: string): Promise<void>;
3938
+ /**
3939
+ * Enable a plugin by ID
3940
+ */
3941
+ enablePlugin(id: string): Promise<void>;
3942
+ /**
3943
+ * Enable a plugin by ID and save config for persistence
3944
+ */
3945
+ enablePluginAndSave(id: string): Promise<void>;
3946
+ /**
3947
+ * Get a plugin by ID
3948
+ */
3949
+ getPlugin(id: string): Plugin$1 | null;
3950
+ /**
3951
+ * Get the folder where plugins are stored
3952
+ */
3953
+ getPluginFolder(): string;
3954
+ /** @internal Load plugin manifests and enable plugins from config */
3955
+ initialize(): Promise<void>;
3956
+ /**
3957
+ * Install a plugin from a given URL
3958
+ */
3959
+ installPlugin(repo: string, version: string, manifest: PluginManifest): Promise<void>;
3960
+ /**
3961
+ * Check whether a plugin is deprecated
3962
+ */
3963
+ isDeprecated(id: string): boolean;
3964
+ /**
3965
+ * Check whether community plugins are enabled
3966
+ */
3967
+ isEnabled(): boolean;
3968
+ /**
3969
+ * Load a specific plugin's manifest by its folder path
3970
+ */
3971
+ loadManifest(path: string): Promise<void>;
3972
+ /** @internal Load all plugin manifests from plugin folder */
3973
+ loadManifests(): Promise<void>;
3974
+ /**
3975
+ * Load a plugin by its ID
3976
+ */
3977
+ loadPlugin(id: string): Promise<Plugin$1>;
3978
+ /** @internal */
3979
+ onRaw(e: unknown): void;
3980
+ /** @internal - Save current plugin configs */
3981
+ saveConfig(): Promise<void>;
3982
+ /** @internal Toggle whether community plugins are enabled */
3983
+ setEnable(enabled: boolean): Promise<void>;
3984
+ /**
3985
+ * Uninstall a plugin by ID
3986
+ */
3987
+ uninstallPlugin(id: string): Promise<void>;
3988
+ /**
3989
+ * Unload a plugin by ID
3990
+ */
3991
+ unloadPlugin(id: string): Promise<void>;
3992
+ }
3993
+ /** @public */
3994
+ export interface ViewRegistryTypeByExtensionRecord extends Record<string, string> {
3995
+ }
3996
+ /** @public */
3997
+ export interface ViewRegistryViewByTypeRecord extends Record<string, (leaf: WorkspaceLeaf) => View> {
3998
+ }
3999
+ /** @public */
4000
+ export interface ViewRegistry extends Events {
4001
+ /**
4002
+ * Mapping of file extensions to view type
4003
+ */
4004
+ typeByExtension: ViewRegistryTypeByExtensionRecord;
4005
+ /**
4006
+ * Mapping of view type to view constructor
4007
+ */
4008
+ viewByType: ViewRegistryViewByTypeRecord;
4009
+ /**
4010
+ * Get the view type associated with a file extension
4011
+ *
4012
+ * @param extension - File extension
4013
+ */
4014
+ getTypeByExtension(extension: string): string;
4015
+ /**
4016
+ * Get the view constructor associated with a view type
4017
+ */
4018
+ getViewCreatorByType(type: string): (leaf: WorkspaceLeaf) => View;
4019
+ /**
4020
+ * Check whether a view type is registered
4020
4021
  */
4021
4022
  isExtensionRegistered(extension: string): boolean;
4022
4023
  /**
@@ -5881,204 +5882,736 @@ export interface FileSuggest<T> extends EditorSuggest<T> {
5881
5882
  */
5882
5883
  suggestManager: FileSuggestManager;
5883
5884
  }
5884
- declare global {
5885
- interface DomElementInfo {
5886
- [eventName: `on${string}`]: EventListenerOrEventListenerObject;
5885
+ declare module "obsidian" {
5886
+ /** @todo Documentation incomplete */
5887
+ interface ItemView extends View {
5888
+ /**
5889
+ * Container of actions for the view
5890
+ */
5891
+ actionsEl: HTMLElement;
5892
+ /**
5893
+ * Back button element for changing view history
5894
+ */
5895
+ backButtonEl: HTMLButtonElement;
5896
+ /**
5897
+ * Whether the view may be dropped anywhere in workspace
5898
+ */
5899
+ canDropAnywhere: boolean;
5900
+ /**
5901
+ * Forward button element for changing view history
5902
+ */
5903
+ forwardButtonEl: HTMLButtonElement;
5904
+ /**
5905
+ * Header bar container of view
5906
+ */
5907
+ headerEl: HTMLElement;
5908
+ /**
5909
+ * Icon element for the view (for dragging)
5910
+ */
5911
+ iconEl: HTMLElement;
5912
+ /**
5913
+ * Anchor button for revealing more view actions
5914
+ */
5915
+ moreOptionsButtonEl: HTMLAnchorElement;
5916
+ /**
5917
+ * Container for the title of the view
5918
+ */
5919
+ titleContainerEl: HTMLElement;
5920
+ /**
5921
+ * Title element for the view
5922
+ */
5923
+ titleEl: HTMLElement;
5924
+ /**
5925
+ * Title of the parent
5926
+ *
5927
+ * @remark Used for breadcrumbs rendering
5928
+ */
5929
+ titleParentEl: HTMLElement;
5930
+ /**
5931
+ * Adds an action button to the header of the view
5932
+ * @param icon - The icon for the action
5933
+ * @param title - The title for the action
5934
+ * @param callback - Callback to execute on click
5935
+ */
5936
+ addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
5937
+ /** @todo Documentation incomplete */
5938
+ handleDrop(event: DragEvent, t: unknown, n: unknown): unknown;
5939
+ /** @todo Documentation incomplete */
5940
+ onGroupChange(): void;
5941
+ /** @todo Documentation incomplete */
5942
+ onMoreOptions(event: Event): void;
5943
+ /** @deprecated use onPaneMenu instead */
5944
+ onMoreOptionsMenu(e: unknown): void;
5945
+ /**
5946
+ * Updates the navigation buttons depending on the history
5947
+ */
5948
+ updateNavButtons(): void;
5887
5949
  }
5888
5950
  }
5889
- /** @public */
5890
- export interface ImageView extends EditableFileView {
5891
- /**
5892
- * Get the current view type
5893
- */
5894
- getViewType(): "image";
5895
- }
5896
- /**
5897
- * @todo This is probably not the right term
5898
- */
5899
- /** @public */
5900
- export interface InfoFileView extends FileView {
5901
- /**
5902
- * Called when a file is opened. Loads the file and requests a content update
5903
- * @param file - The opened file
5904
- */
5905
- onFileOpen(file: TFile): void;
5906
- }
5907
- /** @todo Documentation incomplete */
5908
- /** @public */
5909
- export interface OutgoingLinkView extends InfoFileView {
5910
- /**
5911
- * Get the current view type
5912
- */
5913
- getViewType(): "outgoing-link";
5951
+ declare module "obsidian" {
5914
5952
  /** @todo Documentation incomplete */
5915
- update(): void;
5916
- }
5917
- /** @todo Documentation incomplete */
5918
- /** @public */
5919
- export interface BrowserView extends ItemView {
5920
- /**
5921
- * Get the current view type
5922
- */
5923
- getViewType(): "browser";
5924
- /**
5925
- * Toggles the reader mode
5926
- */
5927
- toggleReaderMode(): void;
5928
- /**
5929
- * Zoom in the webview
5930
- */
5931
- zoomIn(): void;
5932
- /**
5933
- * Zoom out the webview
5934
- */
5935
- zoomOut(): void;
5936
- /**
5937
- * Resets the zoom factor of the webview
5938
- */
5939
- zoomReset(): void;
5940
- /** @todo Documentation incomplete */
5941
- reportPageLoad(url: string, title: string, navigate: unknown): void;
5942
- /** @todo Documentation incomplete */
5943
- commitPageLoad(): unknown;
5944
- /**
5945
- * Setup the webview
5946
- */
5947
- instantiateWebView(): void;
5948
- /**
5949
- * Stores the title of the current webview
5950
- */
5951
- storeCurrentPageTitle(): Promise<unknown>;
5952
- /**
5953
- * Shows the error view
5954
- */
5955
- displayErrorView(): void;
5956
- /**
5957
- * Shows the webview
5958
- */
5959
- displayWebView(): void;
5960
- /** @todo Documentation incomplete */
5961
- configureWebContents(): void;
5962
- /** @todo Documentation incomplete */
5963
- getReaderModeContent(): Promise<unknown>;
5964
- /** @todo Documentation incomplete */
5965
- displayReaderView(): Promise<unknown>;
5966
- /** @todo Documentation incomplete */
5967
- displayBlank(): void;
5968
- /** @todo Documentation incomplete */
5969
- hideAll(): void;
5970
- /** @todo Documentation incomplete */
5971
- saveAsMarkdown(): Promise<unknown>;
5972
- /** @todo Documentation incomplete */
5973
- navigate(e: unknown, t: unknown): unknown;
5974
- /** @todo Documentation incomplete */
5975
- pushViewStackHistory(e: unknown): void;
5976
- /** @todo Documentation incomplete */
5977
- selectFavicon(e: unknown): unknown;
5978
- /** @todo Documentation incomplete */
5979
- setFavicon(e: unknown): unknown;
5980
- /** @todo Documentation incomplete */
5981
- contextMenuItemsForLink(e: unknown, t: unknown): unknown;
5982
- /** @todo Documentation incomplete */
5983
- contextMenuItemsForSelection(e: unknown, t: unknown): unknown;
5984
- /** @todo Documentation incomplete */
5985
- contextMenuItemsForImg(e: unknown): unknown;
5986
- /** @todo Documentation incomplete */
5987
- displayContextMenu(e: unknown): void;
5988
- /** @todo Documentation incomplete */
5989
- showSearch(): void;
5990
- /** @todo Documentation incomplete */
5991
- closeSearch(): void;
5992
- /** @todo Documentation incomplete */
5993
- onExternalLinkClick(e: unknown, t: unknown, n: unknown): void;
5994
- /** @todo Documentation incomplete */
5995
- onReaderModeContextMenu(e: unknown): void;
5996
- /** @todo Documentation incomplete */
5997
- onCheckboxClick(e: unknown, t: unknown, n: unknown): void;
5998
- /** @todo Documentation incomplete */
5999
- onFoldChange(): void;
6000
- /** @todo Documentation incomplete */
6001
- onScroll(): void;
6002
- /** @todo Documentation incomplete */
6003
- postProcess(e: unknown, t: unknown, n: unknown): void;
6004
- /** @todo Documentation incomplete */
6005
- onRenderComplete(): void;
6006
- /** @todo Documentation incomplete */
6007
- onInternalLinkClick(e: unknown, t: unknown, n: unknown): void;
6008
- /** @todo Documentation incomplete */
6009
- onInternalLinkRightClick(e: unknown, t: unknown, n: unknown): void;
6010
- /** @todo Documentation incomplete */
6011
- onInternalLinkDrag(e: unknown, t: unknown, n: unknown): void;
6012
- /** @todo Documentation incomplete */
6013
- onInternalLinkMouseover(e: unknown, t: unknown, n: unknown): void;
6014
- /** @todo Documentation incomplete */
6015
- onTagClick(e: unknown, t: unknown, n: unknown): void;
6016
- /** @todo Documentation incomplete */
6017
- onExternalLinkRightClick(e: unknown, t: unknown, n: unknown): void;
6018
- }
6019
- /** @public */
6020
- export interface EmptyView extends ItemView {
6021
- /**
6022
- * Get the current view type
6023
- */
6024
- getViewType(): "empty";
5953
+ interface View extends Component {
5954
+ app: App;
5955
+ /**
5956
+ * Whether the leaf may close the view
5957
+ */
5958
+ closeable: boolean;
5959
+ containerEl: HTMLElement;
5960
+ /**
5961
+ * The icon string
5962
+ */
5963
+ icon: IconName;
5964
+ leaf: WorkspaceLeaf;
5965
+ /**
5966
+ * Closes the view
5967
+ */
5968
+ close(): Promise<void>;
5969
+ /**
5970
+ * Gets the ephemeral (non-persistent) state of the editor
5971
+ */
5972
+ getEphemeralState(): {};
5973
+ /**
5974
+ * Returns the icon name
5975
+ */
5976
+ getIcon(): IconName;
5977
+ /**
5978
+ * Returns the placement of the tooltip
5979
+ */
5980
+ getSideTooltipPlacement(): "left" | "right" | undefined;
5981
+ /**
5982
+ * Returns the current state of the view
5983
+ */
5984
+ getState(): {};
5985
+ /**
5986
+ * Handle copy event on metadata editor and serialize properties
5987
+ */
5988
+ handleCopy(event: ClipboardEvent): void;
5989
+ /**
5990
+ * Handle cut event on metadata editor and serialize and remove properties
5991
+ */
5992
+ handleCut(event: ClipboardEvent): void;
5993
+ /**
5994
+ * Handle paste event of properties on metadata editor
5995
+ */
5996
+ handlePaste(event: ClipboardEvent): void;
5997
+ /** @deprecated use `onPaneMenu` instead */
5998
+ onHeaderMenu(e: unknown): void;
5999
+ /**
6000
+ * Adds the menu items to the menu
6001
+ * @param menu the menu to fill
6002
+ */
6003
+ onTabMenu(menu: Menu): void;
6004
+ /**
6005
+ * Opens the view
6006
+ * @param parentEl The node the view get attached to
6007
+ */
6008
+ open(parentEl: Node): Promise<void>;
6009
+ /**
6010
+ * Set the ephemeral (non-persistent) state of the editor
6011
+ */
6012
+ setEphemeralState(state: any & {
6013
+ focus: boolean;
6014
+ focusOnMobile: boolean;
6015
+ cursor: EditorRangeOrCaret;
6016
+ }): void;
6017
+ /** @todo Documentation incomplete */
6018
+ setState(state: any, result: ViewStateResult): Promise<void>;
6019
+ }
6025
6020
  }
6026
- /** @todo Documentation incomplete */
6027
- /** @public */
6028
- export interface FilePropertiesView extends InfoFileView {
6029
- /**
6030
- * Returns the file
6031
- */
6032
- getFile(): TFile;
6033
- /** @todo Documentation incomplete */
6034
- shiftFocusAfter(): void;
6035
- /** @todo Documentation incomplete */
6036
- shiftFocusBefore(): void;
6037
- /** @todo Documentation incomplete */
6038
- saveFrontmatter(e: unknown): void;
6039
- /**
6040
- * Checks the file is an markdown file
6041
- * @param file - The file to check
6042
- */
6043
- isSupportedFile(file: TFile): boolean;
6044
- /**
6045
- * Reads the file if it is supported
6046
- * @param file - The file to read
6047
- */
6048
- readSupportedFile(file: TFile): Promise<unknown>;
6049
- /** @todo Documentation incomplete */
6050
- onQuickPreview(file: TFile, t: unknown): void;
6051
- /** @todo Documentation incomplete */
6052
- onFileChange(file: TFile): Promise<unknown>;
6053
- /**
6054
- * Get the current view type
6055
- */
6056
- getViewType(): "file-properties";
6057
- /** @todo Documentation incomplete */
6058
- updateFrontmatter(file: TFile, t: unknown): unknown;
6059
- /** @todo Documentation incomplete */
6060
- updateEmptyState(): void;
6061
- /** @todo Documentation incomplete */
6062
- update(): void;
6021
+ declare module "obsidian" {
6022
+ interface TextFileView extends EditableFileView {
6023
+ /**
6024
+ * Whether current file is dirty (different from saved contents)
6025
+ */
6026
+ dirty: boolean;
6027
+ /**
6028
+ * Whether editor should be rendered as plaintext
6029
+ */
6030
+ isPlaintext: boolean;
6031
+ /**
6032
+ * The data that was last saved
6033
+ */
6034
+ lastSavedData: null | string;
6035
+ /**
6036
+ * Whether on saving, the file should be saved again (for dirtiness checks)
6037
+ */
6038
+ saveAgain: boolean;
6039
+ /**
6040
+ * Whether the file is currently saving
6041
+ */
6042
+ saving: boolean;
6043
+ /** @todo Documentation incomplete */
6044
+ loadFileInternal(file: TFile, clear: boolean): Promise<unknown>;
6045
+ /**
6046
+ * Is called when the vault has a "modify" event. Reloads the file if the view is currently not saving the file and the modified file is the file in this view.
6047
+ * @param file The modified file
6048
+ */
6049
+ onModify(file: TFile): void;
6050
+ /**
6051
+ * Saves the opened file
6052
+ * @param clear If set clears the editor under certain conditions
6053
+ */
6054
+ save(clear?: boolean): Promise<void>;
6055
+ /**
6056
+ * If any changes(dirty = true) in the file forces the file to save
6057
+ */
6058
+ saveImmediately(): void;
6059
+ /**
6060
+ * Set the data to the editor. This is used to load the file contents.
6061
+ * @param data The new data
6062
+ * @param clear If clear is set, then it means we're opening a completely different file. In that case, you should call clear(), or implement a slightly more efficient clearing mechanism given the new data to be set.
6063
+ */
6064
+ setData(data: string, clear: boolean): void;
6065
+ }
6063
6066
  }
6064
- /** @todo Documentation incomplete */
6065
- /** @public */
6066
- export interface BookmarksView extends ItemView {
6067
- /**
6068
- * Called when a file is created.
6069
- * @param file - The created file
6070
- */
6071
- onFileCreate(file: TFile): void;
6072
- /**
6073
- * Called when a file is deleted.
6074
- * @param file - The deleted file
6075
- */
6076
- onFileDelete(file: TFile): void;
6077
- /** @todo Documentation incomplete */
6078
- handleCollapseAll(e: unknown): void;
6079
- /**
6080
- * Get the current view type
6081
- */
6067
+ declare module "obsidian" {
6068
+ interface EditableFileView extends FileView {
6069
+ /**
6070
+ * The file that is currently being renamed
6071
+ */
6072
+ fileBeingRenamed: null | TFile;
6073
+ /**
6074
+ * Is called when the titleEl looses focus
6075
+ * Event type: "blur"
6076
+ */
6077
+ onTitleBlur(): Promise<void>;
6078
+ /**
6079
+ * Is called when the titleEl is changed
6080
+ * Event type: "input"
6081
+ * @param titleEl The titleEl of the view
6082
+ */
6083
+ onTitleChange(titleEl: HTMLElement): void;
6084
+ /**
6085
+ * Is called when the titleEl gains focus
6086
+ * Event type: "focus"
6087
+ */
6088
+ onTitleFocus(): void;
6089
+ /**
6090
+ * Is called when the titleEl is focused and a keydown is triggered
6091
+ * Event type: "keydown"
6092
+ * @param event The KeyboardEvent which triggered this function
6093
+ */
6094
+ onTitleKeydown(event: KeyboardEvent): void;
6095
+ /**
6096
+ * Is called when the titleEl is focused and a paste event is triggered
6097
+ * Event type: "paste"
6098
+ * @param titleEl The titleEl of the view
6099
+ * @param event The ClipboardEvent which triggered this function
6100
+ */
6101
+ onTitlePaste(titleEl: HTMLElement, event: ClipboardEvent): void;
6102
+ /**
6103
+ * Updates the file to match the updated title
6104
+ * @param titleEl The current titleEl
6105
+ */
6106
+ saveTitle(titleEl: HTMLElement): Promise<void>;
6107
+ }
6108
+ }
6109
+ declare module "obsidian" {
6110
+ interface MarkdownView extends TextFileView {
6111
+ /**
6112
+ * Backlinks component
6113
+ * @todo Documentation incomplete
6114
+ */
6115
+ backlinks: null | unknown;
6116
+ /**
6117
+ * The embedded backlinks element for the current file
6118
+ */
6119
+ backlinksEl: HTMLElement;
6120
+ /**
6121
+ * The currently active markdown view (preview or edit view)
6122
+ */
6123
+ currentMode: MarkdownSubView;
6124
+ /**
6125
+ * Editor component of the view
6126
+ */
6127
+ editMode: MarkdownEditView;
6128
+ /**
6129
+ * Editable title element of the view
6130
+ */
6131
+ inlineTitleEl: HTMLElement;
6132
+ /**
6133
+ * Frontmatter editor of the editor
6134
+ */
6135
+ metadataEditor: MetadataEditor;
6136
+ /**
6137
+ * Button for switching between different modes of the view
6138
+ */
6139
+ modeButtonEl: HTMLAnchorElement;
6140
+ /**
6141
+ * The registered modes of the view
6142
+ */
6143
+ modes: {
6144
+ source: MarkdownEditView;
6145
+ preview: MarkdownPreviewView;
6146
+ };
6147
+ /**
6148
+ * Preview component of the view
6149
+ */
6150
+ previewMode: MarkdownPreviewView;
6151
+ /**
6152
+ * File frontmatter as a raw string
6153
+ */
6154
+ rawFrontmatter: string;
6155
+ /**
6156
+ * Current scroll position of the editor
6157
+ */
6158
+ scroll: null | number;
6159
+ /**
6160
+ * Whether to show backlinks in the editor
6161
+ */
6162
+ showBacklinks: boolean;
6163
+ /** @deprecated CM5 Editor */
6164
+ sourceMode: {
6165
+ cmEditor: any;
6166
+ };
6167
+ /**
6168
+ * Add property to inline metadata editor or properties plugin
6169
+ *
6170
+ * @deprecated Removed in 1.6.0
6171
+ * @remark Parameter is not used
6172
+ */
6173
+ addProperty(unused: undefined): void;
6174
+ /**
6175
+ * Whether the editor can render properties according to the current mode and config
6176
+ */
6177
+ canShowProperties(): boolean;
6178
+ /**
6179
+ * Whether the editor can toggle backlinks according to current mode
6180
+ */
6181
+ canToggleBacklinks(): boolean;
6182
+ /**
6183
+ * Collapse the properties editor
6184
+ */
6185
+ collapseProperties(collapse: boolean): void;
6186
+ /**
6187
+ * Edit the focused property in the metadata editor
6188
+ *
6189
+ * @remark Parameter is not used
6190
+ */
6191
+ editProperty(unused: undefined): void;
6192
+ /**
6193
+ * Focus on the metadata editor given property information
6194
+ */
6195
+ focusMetadata(focus?: {
6196
+ focusHeading: boolean;
6197
+ propertyIdx?: number;
6198
+ propertyKey?: string;
6199
+ }): void;
6200
+ /**
6201
+ * Gets the ephemeral (non-persistent) state of the editor
6202
+ */
6203
+ getEphemeralState(): any & {
6204
+ scroll: number;
6205
+ };
6206
+ /**
6207
+ * Get the file attached to the view
6208
+ */
6209
+ getFile(): TFile | null;
6210
+ /** @internal Get the current mode of the editor */
6211
+ getHoverSource(): string;
6212
+ /**
6213
+ * Get the current mode of the editor
6214
+ */
6215
+ getMode(): MarkdownViewModeType;
6216
+ /**
6217
+ * Get selection of current mode
6218
+ */
6219
+ getSelection(): string;
6220
+ /**
6221
+ * Get the current view type
6222
+ */
6223
+ getViewType(): "markdown";
6224
+ /**
6225
+ * Validate correctness of frontmatter and update metadata editor
6226
+ */
6227
+ loadFrontmatter(data: string): void;
6228
+ /**
6229
+ * Whether the metadata editor has focus
6230
+ */
6231
+ metadataHasFocus(): boolean;
6232
+ /**
6233
+ * On app css change, update source mode editor
6234
+ */
6235
+ onCssChange(): void;
6236
+ /**
6237
+ * Update editor on external data change (from sync plugin)
6238
+ */
6239
+ onExternalDataChange(file: TFile, data: string): void;
6240
+ /**
6241
+ * On blur of inline title, save new filename
6242
+ */
6243
+ onInlineTitleBlur(): Promise<void>;
6244
+ /**
6245
+ * On data change of editor, update internal data and metadata editor
6246
+ */
6247
+ onInternalDataChange(): void;
6248
+ /**
6249
+ * On loading markdown view, register resize, css-change and quick-preview events
6250
+ */
6251
+ onload(): void;
6252
+ /**
6253
+ * On fold of markdown in source editor, save fold info to fold manager
6254
+ */
6255
+ onMarkdownFold(): void;
6256
+ /**
6257
+ * On markdown scroll in editors, update scroll, sync state and trigger markdown scroll event
6258
+ */
6259
+ onMarkdownScroll(): void;
6260
+ /**
6261
+ * On mod click, opens editor of opposite mode in split view to right
6262
+ */
6263
+ onSwitchView(event: KeyboardEvent | MouseEvent): Promise<void>;
6264
+ /**
6265
+ * Opens PDF modal for exporting PDF of the current file
6266
+ */
6267
+ printToPdf(): void;
6268
+ /**
6269
+ * Redo action of source mode editor
6270
+ */
6271
+ redo(): void;
6272
+ /**
6273
+ * Register editor mode component to view
6274
+ */
6275
+ registerMode(component: MarkdownSubView): void;
6276
+ /**
6277
+ * Save the frontmatter of the file
6278
+ */
6279
+ saveFrontmatter(properties: Record<string, any>): void;
6280
+ /**
6281
+ * Set the mode of the editor
6282
+ */
6283
+ setMode(component: MarkdownSubView): Promise<void>;
6284
+ /**
6285
+ * Shift focus to first line of editor
6286
+ */
6287
+ shiftFocusAfter(): void;
6288
+ /**
6289
+ * Shift focus to inline title
6290
+ */
6291
+ shiftFocusBefore(): void;
6292
+ /**
6293
+ * Toggle backlinks on editor
6294
+ */
6295
+ toggleBacklinks(): Promise<void>;
6296
+ /**
6297
+ * Toggle collapse status of properties editor if allowed
6298
+ */
6299
+ toggleCollapseProperties(): void;
6300
+ /**
6301
+ * Toggle between source and preview mode
6302
+ */
6303
+ toggleMode(): void;
6304
+ /**
6305
+ * Execute functionality of token (open external link, open internal link in leaf, ...)
6306
+ */
6307
+ triggerClickableToken(token: Token, new_leaf: boolean): void;
6308
+ /**
6309
+ * Undo action of source mode editor
6310
+ */
6311
+ undo(): void;
6312
+ /**
6313
+ * Update the backlinks component for new file
6314
+ */
6315
+ updateBacklinks(): void;
6316
+ /**
6317
+ * Update reading/source view action buttons of modeButtonEl with current mode
6318
+ */
6319
+ updateButtons(): void;
6320
+ /**
6321
+ * Update options of the editors from settings
6322
+ */
6323
+ updateOptions(): void;
6324
+ /**
6325
+ * Hide/render backlinks component
6326
+ */
6327
+ updateShowBacklinks(): void;
6328
+ }
6329
+ }
6330
+ declare module "obsidian" {
6331
+ /** @todo Documentation incomplete */
6332
+ interface FileView extends ItemView {
6333
+ /**
6334
+ * Whether the view may be run without an attached file
6335
+ */
6336
+ allowNoFile: boolean;
6337
+ /**
6338
+ * Determines whether the specified file extension can be opened in this view.
6339
+ * @param extension The file extension to be evaluated
6340
+ */
6341
+ canAcceptExtension(extension: string): boolean;
6342
+ /**
6343
+ * Get view state for sync plugin
6344
+ */
6345
+ getSyncViewState(): any;
6346
+ /**
6347
+ * Loads the file with the onLoadFile function
6348
+ * @param file The File to load
6349
+ */
6350
+ loadFile(file: TFile): Promise<unknown>;
6351
+ /**
6352
+ * Updates the view if it contains the deleted file
6353
+ * @param file The file that is deleted
6354
+ */
6355
+ onDelete(file: TFile): Promise<void>;
6356
+ /**
6357
+ * Is called when a file get loaded
6358
+ * @param file The file that is loaded
6359
+ */
6360
+ onLoadFile(file: TFile): Promise<void>;
6361
+ /**
6362
+ * Updates the view information based on the new file name
6363
+ * @param file The file that is renamed
6364
+ */
6365
+ onRename(file: TFile): Promise<void>;
6366
+ /**
6367
+ * Is called when a file get unloaded
6368
+ * @param file The file that is unloaded
6369
+ */
6370
+ onUnloadFile(file: TFile): Promise<void>;
6371
+ /** @todo Documentation incomplete */
6372
+ renderBreadcrumbs(): void;
6373
+ /** @todo Documentation incomplete */
6374
+ syncState(e: boolean): Promise<unknown>;
6375
+ }
6376
+ }
6377
+ /** @todo Documentation incomplete */
6378
+ /** @public */
6379
+ export interface VimState {
6380
+ vim: {
6381
+ inputState: {
6382
+ changeQueue: null;
6383
+ keyBuffer: [
6384
+ ];
6385
+ motion: null;
6386
+ motionArgs: null;
6387
+ motionRepeat: [
6388
+ ];
6389
+ operator: null;
6390
+ operatorArgs: null;
6391
+ prefixRepeat: [
6392
+ ];
6393
+ registerName: null;
6394
+ };
6395
+ insertMode: false;
6396
+ insertModeRepeat: undefined;
6397
+ lastEditActionCommand: undefined;
6398
+ lastEditInputState: undefined;
6399
+ lastHPos: number;
6400
+ lastHSPos: number;
6401
+ lastMotion: {
6402
+ name?: string;
6403
+ };
6404
+ lastPastedText: null;
6405
+ lastSelection: null;
6406
+ };
6407
+ vimPlugin: {
6408
+ lastKeydown: string;
6409
+ };
6410
+ }
6411
+ /** @todo Documentation incomplete */
6412
+ /** @public */
6413
+ export interface VimEditor {
6414
+ state: VimState;
6415
+ }
6416
+ declare module "@codemirror/view" {
6417
+ /** @todo Documentation incomplete */
6418
+ interface EditorView {
6419
+ cm?: VimEditor;
6420
+ }
6421
+ }
6422
+ /** @public */
6423
+ export interface ImageView extends EditableFileView {
6424
+ /**
6425
+ * Get the current view type
6426
+ */
6427
+ getViewType(): "image";
6428
+ }
6429
+ /**
6430
+ * @todo This is probably not the right term
6431
+ */
6432
+ /** @public */
6433
+ export interface InfoFileView extends FileView {
6434
+ /**
6435
+ * Called when a file is opened. Loads the file and requests a content update
6436
+ * @param file - The opened file
6437
+ */
6438
+ onFileOpen(file: TFile): void;
6439
+ }
6440
+ /** @todo Documentation incomplete */
6441
+ /** @public */
6442
+ export interface OutgoingLinkView extends InfoFileView {
6443
+ /**
6444
+ * Get the current view type
6445
+ */
6446
+ getViewType(): "outgoing-link";
6447
+ /** @todo Documentation incomplete */
6448
+ update(): void;
6449
+ }
6450
+ /** @todo Documentation incomplete */
6451
+ /** @public */
6452
+ export interface BrowserView extends ItemView {
6453
+ /**
6454
+ * Get the current view type
6455
+ */
6456
+ getViewType(): "browser";
6457
+ /**
6458
+ * Toggles the reader mode
6459
+ */
6460
+ toggleReaderMode(): void;
6461
+ /**
6462
+ * Zoom in the webview
6463
+ */
6464
+ zoomIn(): void;
6465
+ /**
6466
+ * Zoom out the webview
6467
+ */
6468
+ zoomOut(): void;
6469
+ /**
6470
+ * Resets the zoom factor of the webview
6471
+ */
6472
+ zoomReset(): void;
6473
+ /** @todo Documentation incomplete */
6474
+ reportPageLoad(url: string, title: string, navigate: unknown): void;
6475
+ /** @todo Documentation incomplete */
6476
+ commitPageLoad(): unknown;
6477
+ /**
6478
+ * Setup the webview
6479
+ */
6480
+ instantiateWebView(): void;
6481
+ /**
6482
+ * Stores the title of the current webview
6483
+ */
6484
+ storeCurrentPageTitle(): Promise<unknown>;
6485
+ /**
6486
+ * Shows the error view
6487
+ */
6488
+ displayErrorView(): void;
6489
+ /**
6490
+ * Shows the webview
6491
+ */
6492
+ displayWebView(): void;
6493
+ /** @todo Documentation incomplete */
6494
+ configureWebContents(): void;
6495
+ /** @todo Documentation incomplete */
6496
+ getReaderModeContent(): Promise<unknown>;
6497
+ /** @todo Documentation incomplete */
6498
+ displayReaderView(): Promise<unknown>;
6499
+ /** @todo Documentation incomplete */
6500
+ displayBlank(): void;
6501
+ /** @todo Documentation incomplete */
6502
+ hideAll(): void;
6503
+ /** @todo Documentation incomplete */
6504
+ saveAsMarkdown(): Promise<unknown>;
6505
+ /** @todo Documentation incomplete */
6506
+ navigate(e: unknown, t: unknown): unknown;
6507
+ /** @todo Documentation incomplete */
6508
+ pushViewStackHistory(e: unknown): void;
6509
+ /** @todo Documentation incomplete */
6510
+ selectFavicon(e: unknown): unknown;
6511
+ /** @todo Documentation incomplete */
6512
+ setFavicon(e: unknown): unknown;
6513
+ /** @todo Documentation incomplete */
6514
+ contextMenuItemsForLink(e: unknown, t: unknown): unknown;
6515
+ /** @todo Documentation incomplete */
6516
+ contextMenuItemsForSelection(e: unknown, t: unknown): unknown;
6517
+ /** @todo Documentation incomplete */
6518
+ contextMenuItemsForImg(e: unknown): unknown;
6519
+ /** @todo Documentation incomplete */
6520
+ displayContextMenu(e: unknown): void;
6521
+ /** @todo Documentation incomplete */
6522
+ showSearch(): void;
6523
+ /** @todo Documentation incomplete */
6524
+ closeSearch(): void;
6525
+ /** @todo Documentation incomplete */
6526
+ onExternalLinkClick(e: unknown, t: unknown, n: unknown): void;
6527
+ /** @todo Documentation incomplete */
6528
+ onReaderModeContextMenu(e: unknown): void;
6529
+ /** @todo Documentation incomplete */
6530
+ onCheckboxClick(e: unknown, t: unknown, n: unknown): void;
6531
+ /** @todo Documentation incomplete */
6532
+ onFoldChange(): void;
6533
+ /** @todo Documentation incomplete */
6534
+ onScroll(): void;
6535
+ /** @todo Documentation incomplete */
6536
+ postProcess(e: unknown, t: unknown, n: unknown): void;
6537
+ /** @todo Documentation incomplete */
6538
+ onRenderComplete(): void;
6539
+ /** @todo Documentation incomplete */
6540
+ onInternalLinkClick(e: unknown, t: unknown, n: unknown): void;
6541
+ /** @todo Documentation incomplete */
6542
+ onInternalLinkRightClick(e: unknown, t: unknown, n: unknown): void;
6543
+ /** @todo Documentation incomplete */
6544
+ onInternalLinkDrag(e: unknown, t: unknown, n: unknown): void;
6545
+ /** @todo Documentation incomplete */
6546
+ onInternalLinkMouseover(e: unknown, t: unknown, n: unknown): void;
6547
+ /** @todo Documentation incomplete */
6548
+ onTagClick(e: unknown, t: unknown, n: unknown): void;
6549
+ /** @todo Documentation incomplete */
6550
+ onExternalLinkRightClick(e: unknown, t: unknown, n: unknown): void;
6551
+ }
6552
+ /** @public */
6553
+ export interface EmptyView extends ItemView {
6554
+ /**
6555
+ * Get the current view type
6556
+ */
6557
+ getViewType(): "empty";
6558
+ }
6559
+ /** @todo Documentation incomplete */
6560
+ /** @public */
6561
+ export interface FilePropertiesView extends InfoFileView {
6562
+ /**
6563
+ * Returns the file
6564
+ */
6565
+ getFile(): TFile;
6566
+ /** @todo Documentation incomplete */
6567
+ shiftFocusAfter(): void;
6568
+ /** @todo Documentation incomplete */
6569
+ shiftFocusBefore(): void;
6570
+ /** @todo Documentation incomplete */
6571
+ saveFrontmatter(e: unknown): void;
6572
+ /**
6573
+ * Checks the file is an markdown file
6574
+ * @param file - The file to check
6575
+ */
6576
+ isSupportedFile(file: TFile): boolean;
6577
+ /**
6578
+ * Reads the file if it is supported
6579
+ * @param file - The file to read
6580
+ */
6581
+ readSupportedFile(file: TFile): Promise<unknown>;
6582
+ /** @todo Documentation incomplete */
6583
+ onQuickPreview(file: TFile, t: unknown): void;
6584
+ /** @todo Documentation incomplete */
6585
+ onFileChange(file: TFile): Promise<unknown>;
6586
+ /**
6587
+ * Get the current view type
6588
+ */
6589
+ getViewType(): "file-properties";
6590
+ /** @todo Documentation incomplete */
6591
+ updateFrontmatter(file: TFile, t: unknown): unknown;
6592
+ /** @todo Documentation incomplete */
6593
+ updateEmptyState(): void;
6594
+ /** @todo Documentation incomplete */
6595
+ update(): void;
6596
+ }
6597
+ /** @todo Documentation incomplete */
6598
+ /** @public */
6599
+ export interface BookmarksView extends ItemView {
6600
+ /**
6601
+ * Called when a file is created.
6602
+ * @param file - The created file
6603
+ */
6604
+ onFileCreate(file: TFile): void;
6605
+ /**
6606
+ * Called when a file is deleted.
6607
+ * @param file - The deleted file
6608
+ */
6609
+ onFileDelete(file: TFile): void;
6610
+ /** @todo Documentation incomplete */
6611
+ handleCollapseAll(e: unknown): void;
6612
+ /**
6613
+ * Get the current view type
6614
+ */
6082
6615
  getViewType(): "bookmarks";
6083
6616
  /** @todo Documentation incomplete */
6084
6617
  isItem(item: unknown): boolean;
@@ -6186,788 +6719,256 @@ export interface SearchView extends View {
6186
6719
  */
6187
6720
  setQuery(value: string): void;
6188
6721
  /**
6189
- * Returns the value of the search element
6190
- */
6191
- getQuery(): string;
6192
- /**
6193
- * Called when the tap header is clicked. Brings this tab to the front
6194
- */
6195
- onTabHeaderClick(): void;
6196
- }
6197
- /** @todo Documentation incomplete */
6198
- /** @public */
6199
- export interface TagView extends View {
6200
- /** @todo Documentation incomplete */
6201
- getNodeId(e: unknown): unknown;
6202
- /** @todo Documentation incomplete */
6203
- isItem(item: unknown): boolean;
6204
- /** @todo Documentation incomplete */
6205
- onKeyEnterInFocus(event: KeyboardEvent): void;
6206
- /**
6207
- * Get the current view type
6208
- */
6209
- getViewType(): "tag";
6210
- /** @todo Documentation incomplete */
6211
- setIsAllCollapsed(e: unknown): void;
6212
- /** @todo Documentation incomplete */
6213
- setUseHierarchy(e: unknown): void;
6214
- /**
6215
- * Reloads all tags from vault, update all items and sort those
6216
- */
6217
- updateTags(): void;
6218
- }
6219
- /** @todo Documentation incomplete */
6220
- /** @public */
6221
- export interface ReleaseNotesView extends ItemView {
6222
- /**
6223
- * Get the current view type
6224
- */
6225
- getViewType(): "release-notes";
6226
- /**
6227
- * Get the release notes from GitHub
6228
- * @param version - The version of the release notes
6229
- */
6230
- fetchReleaseNotes(version: string): Promise<unknown>;
6231
- /** @todo Documentation incomplete */
6232
- showPatchNotes(e: unknown, version: string): Promise<unknown>;
6233
- /**
6234
- * Renders the release notes
6235
- */
6236
- render(): Promise<unknown>;
6237
- }
6238
- /** @public */
6239
- export interface VideoView extends EditableFileView {
6240
- /**
6241
- * Get the current view type
6242
- */
6243
- getViewType(): "video";
6244
- }
6245
- /** @public */
6246
- export interface AudioView extends EditableFileView {
6247
- /**
6248
- * Get the current view type
6249
- */
6250
- getViewType(): "audio";
6251
- }
6252
- /** @todo Documentation incomplete */
6253
- /** @public */
6254
- export interface LocalGraphView extends InfoFileView {
6255
- /**
6256
- * Get the current view type
6257
- */
6258
- getViewType(): "localgraph";
6259
- /**
6260
- * Requests a update if the changed file is the opened file
6261
- * @param file - The changed file
6262
- */
6263
- onFileChanged(file: TFile): void;
6264
- /**
6265
- * Renders the graph
6266
- */
6267
- update(): void;
6268
- /**
6269
- * Updates the options from the plugin when changed in view
6270
- */
6271
- onOptionsChange(): void;
6272
- }
6273
- /** @todo Documentation incomplete */
6274
- /** @public */
6275
- export interface PdfView extends EditableFileView {
6276
- viewer: unknown;
6277
- /**
6278
- * Get the current view type
6279
- */
6280
- getViewType(): "pdf";
6281
- /**
6282
- * Is called when the vault has a "modify" event. Reloads the file if the modified file is the file in this view.
6283
- * @param file - The modified file
6284
- */
6285
- onModify(file: TFile): void;
6286
- /**
6287
- * Shows the search
6288
- */
6289
- showSearch(): void;
6290
- }
6291
- /**
6292
- * Views of plugins that have been deactivated become an UnknownView
6293
- * @todo This is probably not the right term
6294
- */
6295
- /** @public */
6296
- export interface UnknownView extends EmptyView {
6297
- }
6298
- /** @todo Documentation incomplete */
6299
- /** @public */
6300
- export interface BacklinkView extends InfoFileView {
6301
- /**
6302
- * Get the current view type
6303
- */
6304
- getViewType(): "backlink";
6305
- /**
6306
- * Shows the search
6307
- */
6308
- showSearch(): void;
6309
- /** @todo Documentation incomplete */
6310
- update(): void;
6311
- }
6312
- /** @todo Documentation incomplete */
6313
- /** @public */
6314
- export interface AllPropertiesView extends ItemView {
6315
- /** @todo Documentation incomplete */
6316
- startRename(e: unknown): Promise<unknown>;
6317
- /**
6318
- * Called when 'Enter' is pressed while rename. Accepts the rename
6319
- * @param event - The event triggered this function
6320
- */
6321
- onKeyEnterInRename(event: KeyboardEvent): void;
6322
- /**
6323
- * Quits the rename
6324
- */
6325
- exitRename(): void;
6326
- /**
6327
- * Cancels the rename
6328
- */
6329
- cancelRename(): void;
6330
- /**
6331
- * Try to rename the file
6332
- */
6333
- acceptRename(): Promise<void>;
6334
- /**
6335
- * Toggles the visibility of the search
6336
- */
6337
- onToggleShowSearch(): void;
6338
- /**
6339
- * Shows the search and focus is
6340
- */
6341
- showSearch(): void;
6342
- /** @todo Documentation incomplete */
6343
- setShowSearch(e: boolean): void;
6344
- /**
6345
- * Updates the search
6346
- */
6347
- updateSearch(): void;
6348
- /** @todo Documentation incomplete */
6349
- isItem(e: unknown): boolean;
6350
- /**
6351
- * Select the item in focus if pressed 'Enter'
6352
- * @param event - The event triggered this function
6353
- */
6354
- onKeyEnterInFocus(event: KeyboardEvent): void;
6355
- /**
6356
- * Get the current view type
6357
- */
6358
- getViewType(): "all-properties";
6359
- /**
6360
- * Updates the sort order and sort by it
6361
- * @param order - The sort order
6362
- */
6363
- setSortOrder(order: unknown): void;
6364
- /** @todo Documentation incomplete */
6365
- update(): void;
6366
- }
6367
- /** @todo Documentation incomplete */
6368
- /** @public */
6369
- export interface OutlineView extends InfoFileView {
6370
- /**
6371
- * Finds the active leaf
6372
- */
6373
- findCorrespondingLeaf(): WorkspaceLeaf | null;
6374
- /** @todo Documentation incomplete */
6375
- handleCollapseAll(e: unknown): void;
6376
- /**
6377
- * Get the current view type
6378
- */
6379
- getViewType(): "outline";
6380
- /** @todo Documentation incomplete */
6381
- findActiveHeading(e: unknown): unknown | undefined;
6382
- /** @todo Documentation incomplete */
6383
- setHighlightedItem(e: unknown): void;
6384
- /**
6385
- * Finds the view to the active leaf
6386
- */
6387
- getOwner(): View | null;
6388
- /** @todo Documentation incomplete */
6389
- onMarkdownScroll(e: unknown): void;
6390
- /** @todo Documentation incomplete */
6391
- onFileChanged(file: TFile): void;
6392
- /** @todo Documentation incomplete */
6393
- handleSelectionChange(): void;
6394
- /** @todo Documentation incomplete */
6395
- createItemDom(e: unknown): unknown;
6396
- /** @todo Documentation incomplete */
6397
- update(): void;
6398
- /** @todo Documentation incomplete */
6399
- filterSearchResults(): void;
6400
- /**
6401
- * Returns the headings of the active file
6402
- */
6403
- getHeadings(): string[];
6404
- /**
6405
- * Toggles the visibility of the search
6406
- */
6407
- onToggleShowSearch(): void;
6408
- /**
6409
- * Shows the search
6722
+ * Returns the value of the search element
6410
6723
  */
6411
- showSearch(): void;
6412
- /** @todo Documentation incomplete */
6413
- setShowSearch(e: unknown): void;
6724
+ getQuery(): string;
6414
6725
  /**
6415
- * Updates the search
6726
+ * Called when the tap header is clicked. Brings this tab to the front
6416
6727
  */
6417
- updateSearch(): void;
6728
+ onTabHeaderClick(): void;
6418
6729
  }
6419
6730
  /** @todo Documentation incomplete */
6420
6731
  /** @public */
6421
- export interface GraphView extends ItemView {
6422
- dataEngine: unknown;
6732
+ export interface TagView extends View {
6733
+ /** @todo Documentation incomplete */
6734
+ getNodeId(e: unknown): unknown;
6735
+ /** @todo Documentation incomplete */
6736
+ isItem(item: unknown): boolean;
6737
+ /** @todo Documentation incomplete */
6738
+ onKeyEnterInFocus(event: KeyboardEvent): void;
6423
6739
  /**
6424
6740
  * Get the current view type
6425
6741
  */
6426
- getViewType(): "graph";
6427
- /**
6428
- * Renders the graph
6429
- */
6430
- update(): void;
6431
- /**
6432
- * Updates the options from the plugin when changed in view
6433
- */
6434
- onOptionsChange(): void;
6435
- }
6436
- declare module "obsidian" {
6742
+ getViewType(): "tag";
6437
6743
  /** @todo Documentation incomplete */
6438
- interface ItemView extends View {
6439
- /**
6440
- * Container of actions for the view
6441
- */
6442
- actionsEl: HTMLElement;
6443
- /**
6444
- * Back button element for changing view history
6445
- */
6446
- backButtonEl: HTMLButtonElement;
6447
- /**
6448
- * Whether the view may be dropped anywhere in workspace
6449
- */
6450
- canDropAnywhere: boolean;
6451
- /**
6452
- * Forward button element for changing view history
6453
- */
6454
- forwardButtonEl: HTMLButtonElement;
6455
- /**
6456
- * Header bar container of view
6457
- */
6458
- headerEl: HTMLElement;
6459
- /**
6460
- * Icon element for the view (for dragging)
6461
- */
6462
- iconEl: HTMLElement;
6463
- /**
6464
- * Anchor button for revealing more view actions
6465
- */
6466
- moreOptionsButtonEl: HTMLAnchorElement;
6467
- /**
6468
- * Container for the title of the view
6469
- */
6470
- titleContainerEl: HTMLElement;
6471
- /**
6472
- * Title element for the view
6473
- */
6474
- titleEl: HTMLElement;
6475
- /**
6476
- * Title of the parent
6477
- *
6478
- * @remark Used for breadcrumbs rendering
6479
- */
6480
- titleParentEl: HTMLElement;
6481
- /**
6482
- * Adds an action button to the header of the view
6483
- * @param icon - The icon for the action
6484
- * @param title - The title for the action
6485
- * @param callback - Callback to execute on click
6486
- */
6487
- addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
6488
- /** @todo Documentation incomplete */
6489
- handleDrop(event: DragEvent, t: unknown, n: unknown): unknown;
6490
- /** @todo Documentation incomplete */
6491
- onGroupChange(): void;
6492
- /** @todo Documentation incomplete */
6493
- onMoreOptions(event: Event): void;
6494
- /** @deprecated use onPaneMenu instead */
6495
- onMoreOptionsMenu(e: unknown): void;
6496
- /**
6497
- * Updates the navigation buttons depending on the history
6498
- */
6499
- updateNavButtons(): void;
6500
- }
6501
- }
6502
- declare module "obsidian" {
6744
+ setIsAllCollapsed(e: unknown): void;
6503
6745
  /** @todo Documentation incomplete */
6504
- interface View extends Component {
6505
- app: App;
6506
- /**
6507
- * Whether the leaf may close the view
6508
- */
6509
- closeable: boolean;
6510
- containerEl: HTMLElement;
6511
- /**
6512
- * The icon string
6513
- */
6514
- icon: IconName;
6515
- leaf: WorkspaceLeaf;
6516
- /**
6517
- * Closes the view
6518
- */
6519
- close(): Promise<void>;
6520
- /**
6521
- * Gets the ephemeral (non-persistent) state of the editor
6522
- */
6523
- getEphemeralState(): {};
6524
- /**
6525
- * Returns the icon name
6526
- */
6527
- getIcon(): IconName;
6528
- /**
6529
- * Returns the placement of the tooltip
6530
- */
6531
- getSideTooltipPlacement(): "left" | "right" | undefined;
6532
- /**
6533
- * Returns the current state of the view
6534
- */
6535
- getState(): {};
6536
- /**
6537
- * Handle copy event on metadata editor and serialize properties
6538
- */
6539
- handleCopy(event: ClipboardEvent): void;
6540
- /**
6541
- * Handle cut event on metadata editor and serialize and remove properties
6542
- */
6543
- handleCut(event: ClipboardEvent): void;
6544
- /**
6545
- * Handle paste event of properties on metadata editor
6546
- */
6547
- handlePaste(event: ClipboardEvent): void;
6548
- /** @deprecated use `onPaneMenu` instead */
6549
- onHeaderMenu(e: unknown): void;
6550
- /**
6551
- * Adds the menu items to the menu
6552
- * @param menu the menu to fill
6553
- */
6554
- onTabMenu(menu: Menu): void;
6555
- /**
6556
- * Opens the view
6557
- * @param parentEl The node the view get attached to
6558
- */
6559
- open(parentEl: Node): Promise<void>;
6560
- /**
6561
- * Set the ephemeral (non-persistent) state of the editor
6562
- */
6563
- setEphemeralState(state: any & {
6564
- focus: boolean;
6565
- focusOnMobile: boolean;
6566
- cursor: EditorRangeOrCaret;
6567
- }): void;
6568
- /** @todo Documentation incomplete */
6569
- setState(state: any, result: ViewStateResult): Promise<void>;
6570
- }
6571
- }
6572
- declare module "obsidian" {
6573
- interface TextFileView extends EditableFileView {
6574
- /**
6575
- * Whether current file is dirty (different from saved contents)
6576
- */
6577
- dirty: boolean;
6578
- /**
6579
- * Whether editor should be rendered as plaintext
6580
- */
6581
- isPlaintext: boolean;
6582
- /**
6583
- * The data that was last saved
6584
- */
6585
- lastSavedData: null | string;
6586
- /**
6587
- * Whether on saving, the file should be saved again (for dirtiness checks)
6588
- */
6589
- saveAgain: boolean;
6590
- /**
6591
- * Whether the file is currently saving
6592
- */
6593
- saving: boolean;
6594
- /** @todo Documentation incomplete */
6595
- loadFileInternal(file: TFile, clear: boolean): Promise<unknown>;
6596
- /**
6597
- * Is called when the vault has a "modify" event. Reloads the file if the view is currently not saving the file and the modified file is the file in this view.
6598
- * @param file The modified file
6599
- */
6600
- onModify(file: TFile): void;
6601
- /**
6602
- * Saves the opened file
6603
- * @param clear If set clears the editor under certain conditions
6604
- */
6605
- save(clear?: boolean): Promise<void>;
6606
- /**
6607
- * If any changes(dirty = true) in the file forces the file to save
6608
- */
6609
- saveImmediately(): void;
6610
- /**
6611
- * Set the data to the editor. This is used to load the file contents.
6612
- * @param data The new data
6613
- * @param clear If clear is set, then it means we're opening a completely different file. In that case, you should call clear(), or implement a slightly more efficient clearing mechanism given the new data to be set.
6614
- */
6615
- setData(data: string, clear: boolean): void;
6616
- }
6746
+ setUseHierarchy(e: unknown): void;
6747
+ /**
6748
+ * Reloads all tags from vault, update all items and sort those
6749
+ */
6750
+ updateTags(): void;
6617
6751
  }
6618
- declare module "obsidian" {
6619
- interface EditableFileView extends FileView {
6620
- /**
6621
- * The file that is currently being renamed
6622
- */
6623
- fileBeingRenamed: null | TFile;
6624
- /**
6625
- * Is called when the titleEl looses focus
6626
- * Event type: "blur"
6627
- */
6628
- onTitleBlur(): Promise<void>;
6629
- /**
6630
- * Is called when the titleEl is changed
6631
- * Event type: "input"
6632
- * @param titleEl The titleEl of the view
6633
- */
6634
- onTitleChange(titleEl: HTMLElement): void;
6635
- /**
6636
- * Is called when the titleEl gains focus
6637
- * Event type: "focus"
6638
- */
6639
- onTitleFocus(): void;
6640
- /**
6641
- * Is called when the titleEl is focused and a keydown is triggered
6642
- * Event type: "keydown"
6643
- * @param event The KeyboardEvent which triggered this function
6644
- */
6645
- onTitleKeydown(event: KeyboardEvent): void;
6646
- /**
6647
- * Is called when the titleEl is focused and a paste event is triggered
6648
- * Event type: "paste"
6649
- * @param titleEl The titleEl of the view
6650
- * @param event The ClipboardEvent which triggered this function
6651
- */
6652
- onTitlePaste(titleEl: HTMLElement, event: ClipboardEvent): void;
6653
- /**
6654
- * Updates the file to match the updated title
6655
- * @param titleEl The current titleEl
6656
- */
6657
- saveTitle(titleEl: HTMLElement): Promise<void>;
6658
- }
6752
+ /** @todo Documentation incomplete */
6753
+ /** @public */
6754
+ export interface ReleaseNotesView extends ItemView {
6755
+ /**
6756
+ * Get the current view type
6757
+ */
6758
+ getViewType(): "release-notes";
6759
+ /**
6760
+ * Get the release notes from GitHub
6761
+ * @param version - The version of the release notes
6762
+ */
6763
+ fetchReleaseNotes(version: string): Promise<unknown>;
6764
+ /** @todo Documentation incomplete */
6765
+ showPatchNotes(e: unknown, version: string): Promise<unknown>;
6766
+ /**
6767
+ * Renders the release notes
6768
+ */
6769
+ render(): Promise<unknown>;
6659
6770
  }
6660
- declare module "obsidian" {
6661
- interface MarkdownView extends TextFileView {
6662
- /**
6663
- * Backlinks component
6664
- * @todo Documentation incomplete
6665
- */
6666
- backlinks: null | unknown;
6667
- /**
6668
- * The embedded backlinks element for the current file
6669
- */
6670
- backlinksEl: HTMLElement;
6671
- /**
6672
- * The currently active markdown view (preview or edit view)
6673
- */
6674
- currentMode: MarkdownSubView;
6675
- /**
6676
- * Editor component of the view
6677
- */
6678
- editMode: MarkdownEditView;
6679
- /**
6680
- * Editable title element of the view
6681
- */
6682
- inlineTitleEl: HTMLElement;
6683
- /**
6684
- * Frontmatter editor of the editor
6685
- */
6686
- metadataEditor: MetadataEditor;
6687
- /**
6688
- * Button for switching between different modes of the view
6689
- */
6690
- modeButtonEl: HTMLAnchorElement;
6691
- /**
6692
- * The registered modes of the view
6693
- */
6694
- modes: {
6695
- source: MarkdownEditView;
6696
- preview: MarkdownPreviewView;
6697
- };
6698
- /**
6699
- * Preview component of the view
6700
- */
6701
- previewMode: MarkdownPreviewView;
6702
- /**
6703
- * File frontmatter as a raw string
6704
- */
6705
- rawFrontmatter: string;
6706
- /**
6707
- * Current scroll position of the editor
6708
- */
6709
- scroll: null | number;
6710
- /**
6711
- * Whether to show backlinks in the editor
6712
- */
6713
- showBacklinks: boolean;
6714
- /** @deprecated CM5 Editor */
6715
- sourceMode: {
6716
- cmEditor: any;
6717
- };
6718
- /**
6719
- * Add property to inline metadata editor or properties plugin
6720
- *
6721
- * @deprecated Removed in 1.6.0
6722
- * @remark Parameter is not used
6723
- */
6724
- addProperty(unused: undefined): void;
6725
- /**
6726
- * Whether the editor can render properties according to the current mode and config
6727
- */
6728
- canShowProperties(): boolean;
6729
- /**
6730
- * Whether the editor can toggle backlinks according to current mode
6731
- */
6732
- canToggleBacklinks(): boolean;
6733
- /**
6734
- * Collapse the properties editor
6735
- */
6736
- collapseProperties(collapse: boolean): void;
6737
- /**
6738
- * Edit the focused property in the metadata editor
6739
- *
6740
- * @remark Parameter is not used
6741
- */
6742
- editProperty(unused: undefined): void;
6743
- /**
6744
- * Focus on the metadata editor given property information
6745
- */
6746
- focusMetadata(focus?: {
6747
- focusHeading: boolean;
6748
- propertyIdx?: number;
6749
- propertyKey?: string;
6750
- }): void;
6751
- /**
6752
- * Gets the ephemeral (non-persistent) state of the editor
6753
- */
6754
- getEphemeralState(): any & {
6755
- scroll: number;
6756
- };
6757
- /**
6758
- * Get the file attached to the view
6759
- */
6760
- getFile(): TFile | null;
6761
- /** @internal Get the current mode of the editor */
6762
- getHoverSource(): string;
6763
- /**
6764
- * Get the current mode of the editor
6765
- */
6766
- getMode(): MarkdownViewModeType;
6767
- /**
6768
- * Get selection of current mode
6769
- */
6770
- getSelection(): string;
6771
- /**
6772
- * Get the current view type
6773
- */
6774
- getViewType(): "markdown";
6775
- /**
6776
- * Validate correctness of frontmatter and update metadata editor
6777
- */
6778
- loadFrontmatter(data: string): void;
6779
- /**
6780
- * Whether the metadata editor has focus
6781
- */
6782
- metadataHasFocus(): boolean;
6783
- /**
6784
- * On app css change, update source mode editor
6785
- */
6786
- onCssChange(): void;
6787
- /**
6788
- * Update editor on external data change (from sync plugin)
6789
- */
6790
- onExternalDataChange(file: TFile, data: string): void;
6791
- /**
6792
- * On blur of inline title, save new filename
6793
- */
6794
- onInlineTitleBlur(): Promise<void>;
6795
- /**
6796
- * On data change of editor, update internal data and metadata editor
6797
- */
6798
- onInternalDataChange(): void;
6799
- /**
6800
- * On loading markdown view, register resize, css-change and quick-preview events
6801
- */
6802
- onload(): void;
6803
- /**
6804
- * On fold of markdown in source editor, save fold info to fold manager
6805
- */
6806
- onMarkdownFold(): void;
6807
- /**
6808
- * On markdown scroll in editors, update scroll, sync state and trigger markdown scroll event
6809
- */
6810
- onMarkdownScroll(): void;
6811
- /**
6812
- * On mod click, opens editor of opposite mode in split view to right
6813
- */
6814
- onSwitchView(event: KeyboardEvent | MouseEvent): Promise<void>;
6815
- /**
6816
- * Opens PDF modal for exporting PDF of the current file
6817
- */
6818
- printToPdf(): void;
6819
- /**
6820
- * Redo action of source mode editor
6821
- */
6822
- redo(): void;
6823
- /**
6824
- * Register editor mode component to view
6825
- */
6826
- registerMode(component: MarkdownSubView): void;
6827
- /**
6828
- * Save the frontmatter of the file
6829
- */
6830
- saveFrontmatter(properties: Record<string, any>): void;
6831
- /**
6832
- * Set the mode of the editor
6833
- */
6834
- setMode(component: MarkdownSubView): Promise<void>;
6835
- /**
6836
- * Shift focus to first line of editor
6837
- */
6838
- shiftFocusAfter(): void;
6839
- /**
6840
- * Shift focus to inline title
6841
- */
6842
- shiftFocusBefore(): void;
6843
- /**
6844
- * Toggle backlinks on editor
6845
- */
6846
- toggleBacklinks(): Promise<void>;
6847
- /**
6848
- * Toggle collapse status of properties editor if allowed
6849
- */
6850
- toggleCollapseProperties(): void;
6851
- /**
6852
- * Toggle between source and preview mode
6853
- */
6854
- toggleMode(): void;
6855
- /**
6856
- * Execute functionality of token (open external link, open internal link in leaf, ...)
6857
- */
6858
- triggerClickableToken(token: Token, new_leaf: boolean): void;
6859
- /**
6860
- * Undo action of source mode editor
6861
- */
6862
- undo(): void;
6863
- /**
6864
- * Update the backlinks component for new file
6865
- */
6866
- updateBacklinks(): void;
6867
- /**
6868
- * Update reading/source view action buttons of modeButtonEl with current mode
6869
- */
6870
- updateButtons(): void;
6871
- /**
6872
- * Update options of the editors from settings
6873
- */
6874
- updateOptions(): void;
6875
- /**
6876
- * Hide/render backlinks component
6877
- */
6878
- updateShowBacklinks(): void;
6879
- }
6771
+ /** @public */
6772
+ export interface VideoView extends EditableFileView {
6773
+ /**
6774
+ * Get the current view type
6775
+ */
6776
+ getViewType(): "video";
6777
+ }
6778
+ /** @public */
6779
+ export interface AudioView extends EditableFileView {
6780
+ /**
6781
+ * Get the current view type
6782
+ */
6783
+ getViewType(): "audio";
6784
+ }
6785
+ /** @todo Documentation incomplete */
6786
+ /** @public */
6787
+ export interface LocalGraphView extends InfoFileView {
6788
+ /**
6789
+ * Get the current view type
6790
+ */
6791
+ getViewType(): "localgraph";
6792
+ /**
6793
+ * Requests a update if the changed file is the opened file
6794
+ * @param file - The changed file
6795
+ */
6796
+ onFileChanged(file: TFile): void;
6797
+ /**
6798
+ * Renders the graph
6799
+ */
6800
+ update(): void;
6801
+ /**
6802
+ * Updates the options from the plugin when changed in view
6803
+ */
6804
+ onOptionsChange(): void;
6880
6805
  }
6881
- declare module "obsidian" {
6882
- /** @todo Documentation incomplete */
6883
- interface FileView extends ItemView {
6884
- /**
6885
- * Whether the view may be run without an attached file
6886
- */
6887
- allowNoFile: boolean;
6888
- /**
6889
- * Determines whether the specified file extension can be opened in this view.
6890
- * @param extension The file extension to be evaluated
6891
- */
6892
- canAcceptExtension(extension: string): boolean;
6893
- /**
6894
- * Get view state for sync plugin
6895
- */
6896
- getSyncViewState(): any;
6897
- /**
6898
- * Loads the file with the onLoadFile function
6899
- * @param file The File to load
6900
- */
6901
- loadFile(file: TFile): Promise<unknown>;
6902
- /**
6903
- * Updates the view if it contains the deleted file
6904
- * @param file The file that is deleted
6905
- */
6906
- onDelete(file: TFile): Promise<void>;
6907
- /**
6908
- * Is called when a file get loaded
6909
- * @param file The file that is loaded
6910
- */
6911
- onLoadFile(file: TFile): Promise<void>;
6912
- /**
6913
- * Updates the view information based on the new file name
6914
- * @param file The file that is renamed
6915
- */
6916
- onRename(file: TFile): Promise<void>;
6917
- /**
6918
- * Is called when a file get unloaded
6919
- * @param file The file that is unloaded
6920
- */
6921
- onUnloadFile(file: TFile): Promise<void>;
6922
- /** @todo Documentation incomplete */
6923
- renderBreadcrumbs(): void;
6924
- /** @todo Documentation incomplete */
6925
- syncState(e: boolean): Promise<unknown>;
6926
- }
6806
+ /** @todo Documentation incomplete */
6807
+ /** @public */
6808
+ export interface PdfView extends EditableFileView {
6809
+ viewer: unknown;
6810
+ /**
6811
+ * Get the current view type
6812
+ */
6813
+ getViewType(): "pdf";
6814
+ /**
6815
+ * Is called when the vault has a "modify" event. Reloads the file if the modified file is the file in this view.
6816
+ * @param file - The modified file
6817
+ */
6818
+ onModify(file: TFile): void;
6819
+ /**
6820
+ * Shows the search
6821
+ */
6822
+ showSearch(): void;
6823
+ }
6824
+ /**
6825
+ * Views of plugins that have been deactivated become an UnknownView
6826
+ * @todo This is probably not the right term
6827
+ */
6828
+ /** @public */
6829
+ export interface UnknownView extends EmptyView {
6927
6830
  }
6928
6831
  /** @todo Documentation incomplete */
6929
6832
  /** @public */
6930
- export interface VimState {
6931
- vim: {
6932
- inputState: {
6933
- changeQueue: null;
6934
- keyBuffer: [
6935
- ];
6936
- motion: null;
6937
- motionArgs: null;
6938
- motionRepeat: [
6939
- ];
6940
- operator: null;
6941
- operatorArgs: null;
6942
- prefixRepeat: [
6943
- ];
6944
- registerName: null;
6945
- };
6946
- insertMode: false;
6947
- insertModeRepeat: undefined;
6948
- lastEditActionCommand: undefined;
6949
- lastEditInputState: undefined;
6950
- lastHPos: number;
6951
- lastHSPos: number;
6952
- lastMotion: {
6953
- name?: string;
6954
- };
6955
- lastPastedText: null;
6956
- lastSelection: null;
6957
- };
6958
- vimPlugin: {
6959
- lastKeydown: string;
6960
- };
6833
+ export interface BacklinkView extends InfoFileView {
6834
+ /**
6835
+ * Get the current view type
6836
+ */
6837
+ getViewType(): "backlink";
6838
+ /**
6839
+ * Shows the search
6840
+ */
6841
+ showSearch(): void;
6842
+ /** @todo Documentation incomplete */
6843
+ update(): void;
6961
6844
  }
6962
6845
  /** @todo Documentation incomplete */
6963
6846
  /** @public */
6964
- export interface VimEditor {
6965
- state: VimState;
6847
+ export interface AllPropertiesView extends ItemView {
6848
+ /** @todo Documentation incomplete */
6849
+ startRename(e: unknown): Promise<unknown>;
6850
+ /**
6851
+ * Called when 'Enter' is pressed while rename. Accepts the rename
6852
+ * @param event - The event triggered this function
6853
+ */
6854
+ onKeyEnterInRename(event: KeyboardEvent): void;
6855
+ /**
6856
+ * Quits the rename
6857
+ */
6858
+ exitRename(): void;
6859
+ /**
6860
+ * Cancels the rename
6861
+ */
6862
+ cancelRename(): void;
6863
+ /**
6864
+ * Try to rename the file
6865
+ */
6866
+ acceptRename(): Promise<void>;
6867
+ /**
6868
+ * Toggles the visibility of the search
6869
+ */
6870
+ onToggleShowSearch(): void;
6871
+ /**
6872
+ * Shows the search and focus is
6873
+ */
6874
+ showSearch(): void;
6875
+ /** @todo Documentation incomplete */
6876
+ setShowSearch(e: boolean): void;
6877
+ /**
6878
+ * Updates the search
6879
+ */
6880
+ updateSearch(): void;
6881
+ /** @todo Documentation incomplete */
6882
+ isItem(e: unknown): boolean;
6883
+ /**
6884
+ * Select the item in focus if pressed 'Enter'
6885
+ * @param event - The event triggered this function
6886
+ */
6887
+ onKeyEnterInFocus(event: KeyboardEvent): void;
6888
+ /**
6889
+ * Get the current view type
6890
+ */
6891
+ getViewType(): "all-properties";
6892
+ /**
6893
+ * Updates the sort order and sort by it
6894
+ * @param order - The sort order
6895
+ */
6896
+ setSortOrder(order: unknown): void;
6897
+ /** @todo Documentation incomplete */
6898
+ update(): void;
6966
6899
  }
6967
- declare module "@codemirror/view" {
6900
+ /** @todo Documentation incomplete */
6901
+ /** @public */
6902
+ export interface OutlineView extends InfoFileView {
6903
+ /**
6904
+ * Finds the active leaf
6905
+ */
6906
+ findCorrespondingLeaf(): WorkspaceLeaf | null;
6968
6907
  /** @todo Documentation incomplete */
6969
- interface EditorView {
6970
- cm?: VimEditor;
6908
+ handleCollapseAll(e: unknown): void;
6909
+ /**
6910
+ * Get the current view type
6911
+ */
6912
+ getViewType(): "outline";
6913
+ /** @todo Documentation incomplete */
6914
+ findActiveHeading(e: unknown): unknown | undefined;
6915
+ /** @todo Documentation incomplete */
6916
+ setHighlightedItem(e: unknown): void;
6917
+ /**
6918
+ * Finds the view to the active leaf
6919
+ */
6920
+ getOwner(): View | null;
6921
+ /** @todo Documentation incomplete */
6922
+ onMarkdownScroll(e: unknown): void;
6923
+ /** @todo Documentation incomplete */
6924
+ onFileChanged(file: TFile): void;
6925
+ /** @todo Documentation incomplete */
6926
+ handleSelectionChange(): void;
6927
+ /** @todo Documentation incomplete */
6928
+ createItemDom(e: unknown): unknown;
6929
+ /** @todo Documentation incomplete */
6930
+ update(): void;
6931
+ /** @todo Documentation incomplete */
6932
+ filterSearchResults(): void;
6933
+ /**
6934
+ * Returns the headings of the active file
6935
+ */
6936
+ getHeadings(): string[];
6937
+ /**
6938
+ * Toggles the visibility of the search
6939
+ */
6940
+ onToggleShowSearch(): void;
6941
+ /**
6942
+ * Shows the search
6943
+ */
6944
+ showSearch(): void;
6945
+ /** @todo Documentation incomplete */
6946
+ setShowSearch(e: unknown): void;
6947
+ /**
6948
+ * Updates the search
6949
+ */
6950
+ updateSearch(): void;
6951
+ }
6952
+ /** @todo Documentation incomplete */
6953
+ /** @public */
6954
+ export interface GraphView extends ItemView {
6955
+ dataEngine: unknown;
6956
+ /**
6957
+ * Get the current view type
6958
+ */
6959
+ getViewType(): "graph";
6960
+ /**
6961
+ * Renders the graph
6962
+ */
6963
+ update(): void;
6964
+ /**
6965
+ * Updates the options from the plugin when changed in view
6966
+ */
6967
+ onOptionsChange(): void;
6968
+ }
6969
+ declare global {
6970
+ interface DomElementInfo {
6971
+ [eventName: `on${string}`]: EventListenerOrEventListenerObject;
6971
6972
  }
6972
6973
  }
6973
6974