obsidian-typings 1.1.3 → 1.1.5

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/obsidian-ex.d.ts +83 -14
  2. package/package.json +6 -3
package/obsidian-ex.d.ts CHANGED
@@ -5,6 +5,7 @@ import * as fs from "fs";
5
5
  import * as fsPromises from "fs/promises";
6
6
  import {
7
7
  CachedMetadata,
8
+ CacheItem,
8
9
  Command,
9
10
  Component,
10
11
  EditorPosition,
@@ -28,6 +29,12 @@ import {
28
29
  import * as path from "path";
29
30
  export * from "obsidian";
30
31
 
32
+ declare global {
33
+ interface DomElementInfo {
34
+ [eventName: `on${string}`]: EventListenerOrEventListenerObject;
35
+ }
36
+ }
37
+
31
38
  declare module "@codemirror/view" {
32
39
  /** @todo Documentation incomplete */
33
40
  interface EditorView {
@@ -116,6 +123,7 @@ declare module "obsidian" {
116
123
  | "showLineNumber"
117
124
  | "showUnsupportedFiles"
118
125
  | "showViewHeader"
126
+ | "showRibbon"
119
127
  | "smartIndentList"
120
128
  | "spellcheck"
121
129
  | "spellcheckLanguages"
@@ -183,7 +191,13 @@ declare module "obsidian" {
183
191
  /** @todo Documentation incomplete */
184
192
  type TreeItem<T> = TreeNode<T> & {
185
193
  collapseEl: HTMLElement;
194
+ /**
195
+ * @deprecated Potentially removed in 1.6.0 for some tree-likes
196
+ */
186
197
  collapsed: boolean;
198
+ /**
199
+ * @deprecated Potentially removed in 1.6.0 for some tree-likes
200
+ */
187
201
  collapsible: boolean;
188
202
  coverEl: HTMLElement;
189
203
  innerEl: HTMLElement;
@@ -323,8 +337,10 @@ declare module "obsidian" {
323
337
  interface App {
324
338
  /**
325
339
  * The account signed in to Obsidian
340
+ *
341
+ * @deprecated Property is now undefined, removed pre-1.6.0
326
342
  */
327
- account: Account;
343
+ account: Account | undefined;
328
344
  /**
329
345
  * ID that uniquely identifies the vault
330
346
  *
@@ -379,11 +395,12 @@ declare module "obsidian" {
379
395
  /**
380
396
  * Whether the application is currently running on mobile
381
397
  *
398
+ * @deprecated Will be inaccessible in a future version, prefer using `Platform.isMobile`
382
399
  * @remark Prefer usage of `Platform.isMobile`
383
400
  * @remark Will be true if `app.emulateMobile()` was enabled
384
401
  */
385
402
  isMobile: boolean;
386
- /** @internal */
403
+ /** @deprecated Made inaccessible in 1.6.0, this object can be recreated using Notices */
387
404
  loadProgress: LoadProgress;
388
405
  /**
389
406
  * Manages the gathering and updating of metadata for all files in the vault
@@ -782,6 +799,10 @@ declare module "obsidian" {
782
799
  * Editor > Show line numbers
783
800
  */
784
801
  showLineNumber?: false | boolean;
802
+ /**
803
+ * Appearance > Show ribbon
804
+ */
805
+ showRibbon?: true | boolean;
785
806
  /**
786
807
  * Files & Links > Detect all file extensions
787
808
  */
@@ -851,14 +872,14 @@ declare module "obsidian" {
851
872
  vimMode?: false | boolean;
852
873
  }
853
874
 
854
- /**
855
- * @remark `BaseEditor` is never used in the Obsidian codebase, but is exposed in the Obsidian module as `Editor`.
856
- * However, most editor components actually make use of the extended `Editor`, so this interface is purposely
857
- * named to `BaseEditor` to not require any casting for most purposes (or overriding the `editor` property type
858
- * for all components).
859
- * @todo Potential risk of confusion when `Editor` is constructed from the Obsidian module, as it only has the
860
- * methods from `BaseEditor`, *not* `Editor`
861
- */
875
+ /**
876
+ * @remark `BaseEditor` is never used in the Obsidian codebase, but is exposed in the Obsidian module as `Editor`.
877
+ * However, most editor components actually make use of the extended `Editor`, so this interface is purposely
878
+ * named to `BaseEditor` to not require any casting for most purposes (or overriding the `editor` property type
879
+ * for all components).
880
+ * @todo Potential risk of confusion when `Editor` is constructed from the Obsidian module, as it only has the
881
+ * methods from `BaseEditor`, *not* `Editor`
882
+ */
862
883
  interface BaseEditor {
863
884
  /**
864
885
  * CodeMirror editor instance
@@ -955,6 +976,10 @@ declare module "obsidian" {
955
976
  cache: unknown;
956
977
  }
957
978
 
979
+ interface CachedMetadata {
980
+ footnotes?: FootnoteCache[];
981
+ }
982
+
958
983
  interface CanvasConnection {}
959
984
 
960
985
  interface CanvasLeaf extends WorkspaceLeaf {}
@@ -1865,6 +1890,10 @@ declare module "obsidian" {
1865
1890
 
1866
1891
  /** @todo Documentation incomplete */
1867
1892
  interface FileExplorerPlugin extends InternalPlugin {
1893
+ /** @internal */
1894
+ attachDropHandler(x: unknown, y: unknown, z: unknown): unknown;
1895
+ /** @internal Get a sorted list of the tree items for a specific folder) */
1896
+ getSortedFolderItems(folder: TFolder): FileTreeItem[];
1868
1897
  /**
1869
1898
  * Reveals a file or folder in the file explorer view, opens the view if it is not already
1870
1899
  * open/visible
@@ -2092,6 +2121,8 @@ declare module "obsidian" {
2092
2121
  * Get suggestions for file heading query
2093
2122
  */
2094
2123
  getHeadingSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>;
2124
+ /** @internal Generate instructions for specific actions in suggestion manager (e.g. accept, select, ...) */
2125
+ getInstructions(): [{ command: "string"; purpose: "string" }];
2095
2126
  /**
2096
2127
  * Get suggestions for current input text
2097
2128
  *
@@ -2136,6 +2167,13 @@ declare module "obsidian" {
2136
2167
  interface FoldManager {
2137
2168
  }
2138
2169
 
2170
+ /**
2171
+ * Cache item containing a notes footnotes metadata
2172
+ */
2173
+ interface FootnoteCache extends CacheItem {
2174
+ identifier: string;
2175
+ }
2176
+
2139
2177
  /** @todo Documentation incomplete */
2140
2178
  interface GlobalSearchLeaf extends WorkspaceLeaf {}
2141
2179
 
@@ -2189,6 +2227,10 @@ declare module "obsidian" {
2189
2227
  getHotkeys(command: string): KeymapInfo[];
2190
2228
  /** @internal Load hotkeys from storage */
2191
2229
  load(): void;
2230
+ /** @internal */
2231
+ onConfigFileChanged(): void;
2232
+ /** @internal */
2233
+ onRaw(e: unknown): void;
2192
2234
  /**
2193
2235
  * Trigger a command by keyboard event
2194
2236
  *
@@ -2202,6 +2244,8 @@ declare module "obsidian" {
2202
2244
  * @param command
2203
2245
  */
2204
2246
  printHotkeyForCommand(command: string): string;
2247
+ /** @internal */
2248
+ registerListeners(): void;
2205
2249
  /**
2206
2250
  * Remove a hotkey from the default hotkeys
2207
2251
  *
@@ -2244,6 +2288,12 @@ declare module "obsidian" {
2244
2288
  display: string;
2245
2289
  }
2246
2290
 
2291
+ /** @todo Documentation incomplete */
2292
+ interface HoverPopover {
2293
+ /** @internal */
2294
+ watchResize(): void;
2295
+ }
2296
+
2247
2297
  class IFramedMarkdownEditor extends MarkdownScrollableEditView {
2248
2298
  constructor(context: WidgetEditorView);
2249
2299
  /**
@@ -2317,10 +2367,16 @@ declare module "obsidian" {
2317
2367
 
2318
2368
  /** @todo Documentation incomplete */
2319
2369
  interface InternalPlugin extends Plugin {
2370
+ instance: InternalPluginInstance<this>;
2371
+
2320
2372
  disable(): void;
2321
2373
  enable(): void;
2322
2374
  }
2323
2375
 
2376
+ interface InternalPluginInstance<TPlugin> {
2377
+ plugin: TPlugin;
2378
+ }
2379
+
2324
2380
  interface InternalPlugins extends Events {
2325
2381
  /**
2326
2382
  * Reference to App
@@ -2350,9 +2406,9 @@ declare module "obsidian" {
2350
2406
  *
2351
2407
  * @param id - ID of the plugin to get
2352
2408
  */
2353
- getEnabledPluginById(id: InternalPluginName): InternalPlugin | null;
2354
- getEnabledPluginById(id: "file-explorer"): FileExplorerPlugin | null;
2355
- getEnabledPluginById(id: "global-search"): GlobalSearchPlugin | null;
2409
+ getEnabledPluginById(id: InternalPluginName): InternalPluginInstance<InternalPlugin> | null;
2410
+ getEnabledPluginById(id: "file-explorer"): InternalPluginInstance<FileExplorerPlugin> | null;
2411
+ getEnabledPluginById(id: "global-search"): InternalPluginInstance<GlobalSearchPlugin> | null;
2356
2412
  /**
2357
2413
  * Get all enabled internal plugins
2358
2414
  */
@@ -2979,6 +3035,7 @@ declare module "obsidian" {
2979
3035
  /**
2980
3036
  * Add property to inline metadata editor or properties plugin
2981
3037
  *
3038
+ * @deprecated Removed in 1.6.0
2982
3039
  * @remark Parameter is not used
2983
3040
  */
2984
3041
  addProperty(unused: undefined): void;
@@ -3012,6 +3069,8 @@ declare module "obsidian" {
3012
3069
  * Get the file attached to the view
3013
3070
  */
3014
3071
  getFile(): TFile | null;
3072
+ /** @internal Get the current mode of the editor */
3073
+ getHoverSource(): string;
3015
3074
  /**
3016
3075
  * Get the current mode of the editor
3017
3076
  */
@@ -3398,7 +3457,7 @@ declare module "obsidian" {
3398
3457
  /**
3399
3458
  * Get an entry from the file cache
3400
3459
  */
3401
- getFileInfo(path: string): FileCacheEntry;
3460
+ getFileInfo(path: string): FileCacheEntry | undefined;
3402
3461
  /**
3403
3462
  * Get property values for frontmatter property key
3404
3463
  */
@@ -3776,6 +3835,10 @@ declare module "obsidian" {
3776
3835
  getTypes(): string[];
3777
3836
  /** @internal Load property types from config */
3778
3837
  loadData(): Promise<void>;
3838
+ /** @internal */
3839
+ onRaw(e: unknown): void;
3840
+ /** @internal */
3841
+ registerListeners(): void;
3779
3842
  /** @internal Save property types to config */
3780
3843
  save(): Promise<void>;
3781
3844
  /** @internal Get all properties from metadata cache */
@@ -4530,6 +4593,12 @@ declare module "obsidian" {
4530
4593
  useSelectedItem(event: Event): boolean;
4531
4594
  }
4532
4595
 
4596
+ /** @todo Documentation incomplete */
4597
+ interface SuggestModal<T> {
4598
+ /** @internal */
4599
+ clearButtonEl: HTMLButtonElement;
4600
+ }
4601
+
4533
4602
  /** @todo Documentation incomplete */
4534
4603
  interface TableCell {
4535
4604
  col: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-typings",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Extended type definitions for the Obsidian API (https://obsidian.md)",
5
5
  "main": "",
6
6
  "types": "obsidian-ex.d.ts",
@@ -31,6 +31,9 @@
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsc --build --force",
34
- "format": "bun run sort-interfaces.ts obsidian-ex.d.ts && bun dprint fmt obsidian-ex.d.ts"
34
+ "format": "bun run scripts/sort-interfaces.ts obsidian-ex.d.ts && bun dprint fmt obsidian-ex.d.ts",
35
+ "release-patch": "bun run scripts/bump-version.ts patch",
36
+ "release-minor": "bun run scripts/bump-version.ts minor",
37
+ "release-major": "bun run scripts/bump-version.ts major"
35
38
  }
36
- }
39
+ }