obsidian-typings 2.2.0 → 2.2.1-beta.1

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.
@@ -3,7 +3,7 @@
3
3
  import * as fs from 'node:fs';
4
4
  import * as fsPromises from 'node:fs/promises';
5
5
  import * as path from 'node:path';
6
- import { TAbstractFile, TFile, TFolder, Vault } from 'obsidian';
6
+ import { FileStats, TAbstractFile, TFile, TFolder, Vault } from 'obsidian';
7
7
 
8
8
  /**
9
9
  * Creates and properly initializes the instance of TFolder even the underlying folder does not exist.
@@ -305,6 +305,8 @@ export interface AppVaultConfig {
305
305
  /** @public */
306
306
  export type ConfigItem = "accentColor" | "alwaysUpdateLinks" | "attachmentFolderPath" | "autoConvertHtml" | "autoPairBrackets" | "autoPairMarkdown" | "baseFontSize" | "baseFontSizeAction" | "cssTheme" | "defaultViewMode" | "emacsyKeys" | "enabledCssSnippets" | "fileSortOrder" | "focusNewTab" | "foldHeading" | "foldIndent" | "hotkeys" | "interfaceFontFamily" | "legacyEditor" | "livePreview" | "mobilePullAction" | "mobileQuickRibbonItem" | "mobileToolbarCommands" | "monospaceFontFamily" | "nativeMenus" | "newFileFolderPath" | "newFileLocation" | "newLinkFormat" | "pdfExportSettings" | "promptDelete" | "propertiesInDocument" | "readableLineLength" | "rightToLeft" | "showIndentGuide" | "showInlineTitle" | "showLineNumber" | "showUnsupportedFiles" | "showViewHeader" | "showRibbon" | "smartIndentList" | "spellcheck" | "spellcheckLanguages" | "strictLineBreaks" | "tabSize" | "textFontFamily" | "theme" | "translucency" | "trashOption" | "types" | "useMarkdownLinks" | "useTab" | "userIgnoreFilters" | "vimMode";
307
307
  /** @public */
308
+ export type FileSystemWatchHandler = (eventType: string, path: string, oldPath?: string, stats?: FileStats) => void;
309
+ /** @public */
308
310
  export interface VaultFileMapRecord extends Record<string, TAbstractFile> {
309
311
  }
310
312
  /** @public */
@@ -18168,6 +18168,41 @@
18168
18168
  ],
18169
18169
  "extendsTokenRanges": []
18170
18170
  },
18171
+ {
18172
+ "kind": "TypeAlias",
18173
+ "canonicalReference": "obsidian-typings!FileSystemWatchHandler:type",
18174
+ "docComment": "/**\n * @public\n */\n",
18175
+ "excerptTokens": [
18176
+ {
18177
+ "kind": "Content",
18178
+ "text": "export type FileSystemWatchHandler = "
18179
+ },
18180
+ {
18181
+ "kind": "Content",
18182
+ "text": "(eventType: string, path: string, oldPath?: string, stats?: "
18183
+ },
18184
+ {
18185
+ "kind": "Reference",
18186
+ "text": "FileStats",
18187
+ "canonicalReference": "obsidian!FileStats:interface"
18188
+ },
18189
+ {
18190
+ "kind": "Content",
18191
+ "text": ") => void"
18192
+ },
18193
+ {
18194
+ "kind": "Content",
18195
+ "text": ";"
18196
+ }
18197
+ ],
18198
+ "fileUrlPath": "src/obsidian/internals/FileSystemWatchHandler.d.ts",
18199
+ "releaseTag": "Public",
18200
+ "name": "FileSystemWatchHandler",
18201
+ "typeTokenRange": {
18202
+ "startIndex": 1,
18203
+ "endIndex": 4
18204
+ }
18205
+ },
18171
18206
  {
18172
18207
  "kind": "Interface",
18173
18208
  "canonicalReference": "obsidian-typings!FileTreeItem:interface",
@@ -22832,7 +22867,7 @@
22832
22867
  {
22833
22868
  "kind": "TypeAlias",
22834
22869
  "canonicalReference": "obsidian-typings!LinkUpdateHandler:type",
22835
- "docComment": "",
22870
+ "docComment": "/**\n * @public\n */\n",
22836
22871
  "excerptTokens": [
22837
22872
  {
22838
22873
  "kind": "Content",
package/dist/types.d.ts CHANGED
@@ -6,7 +6,7 @@ import { IpcRenderer } from 'electron';
6
6
  import * as fs from 'node:fs';
7
7
  import * as fsPromises from 'node:fs/promises';
8
8
  import * as path from 'node:path';
9
- import { App, BlockCache, CachedMetadata, Command, Component, Constructor, EditableFileView, Editor, EditorPosition, EditorRange, EditorSuggest, EventRef, Events, FileView, HoverLinkSource, HoverPopover, ItemView, KeymapInfo, Loc, MarkdownFileInfo, MarkdownPreviewView, MarkdownView, PaneType, Plugin as Plugin$1, PluginManifest, Reference, ReferenceCache, Scope, SearchComponent, SearchResult, SettingTab, SplitDirection, TAbstractFile, TFile, TFolder, TextFileView, Vault, View, ViewState, Workspace, WorkspaceLeaf } from 'obsidian';
9
+ import { App, BlockCache, CachedMetadata, Command, Component, Constructor, EditableFileView, Editor, EditorPosition, EditorRange, EditorSuggest, EventRef, Events, FileStats, FileView, HoverLinkSource, HoverPopover, ItemView, KeymapInfo, Loc, MarkdownFileInfo, MarkdownPreviewView, MarkdownView, PaneType, Plugin as Plugin$1, PluginManifest, Reference, ReferenceCache, Scope, SearchComponent, SearchResult, SettingTab, SplitDirection, TAbstractFile, TFile, TFolder, TextFileView, Vault, View, ViewState, Workspace, WorkspaceLeaf } from 'obsidian';
10
10
 
11
11
  declare module "obsidian" {
12
12
  interface BlockSubpathResult extends SubpathResult {
@@ -103,6 +103,7 @@ export interface LinkUpdate {
103
103
  */
104
104
  sourceFile: TFile;
105
105
  }
106
+ /** @public */
106
107
  export type LinkUpdateHandler = (link: LinkUpdate) => void | Promise<void>;
107
108
  /** @todo Documentation incomplete */
108
109
  /** @public */
@@ -704,6 +705,8 @@ export interface AppVaultConfig {
704
705
  /** @public */
705
706
  export type ConfigItem = "accentColor" | "alwaysUpdateLinks" | "attachmentFolderPath" | "autoConvertHtml" | "autoPairBrackets" | "autoPairMarkdown" | "baseFontSize" | "baseFontSizeAction" | "cssTheme" | "defaultViewMode" | "emacsyKeys" | "enabledCssSnippets" | "fileSortOrder" | "focusNewTab" | "foldHeading" | "foldIndent" | "hotkeys" | "interfaceFontFamily" | "legacyEditor" | "livePreview" | "mobilePullAction" | "mobileQuickRibbonItem" | "mobileToolbarCommands" | "monospaceFontFamily" | "nativeMenus" | "newFileFolderPath" | "newFileLocation" | "newLinkFormat" | "pdfExportSettings" | "promptDelete" | "propertiesInDocument" | "readableLineLength" | "rightToLeft" | "showIndentGuide" | "showInlineTitle" | "showLineNumber" | "showUnsupportedFiles" | "showViewHeader" | "showRibbon" | "smartIndentList" | "spellcheck" | "spellcheckLanguages" | "strictLineBreaks" | "tabSize" | "textFontFamily" | "theme" | "translucency" | "trashOption" | "types" | "useMarkdownLinks" | "useTab" | "userIgnoreFilters" | "vimMode";
706
707
  /** @public */
708
+ export type FileSystemWatchHandler = (eventType: string, path: string, oldPath?: string, stats?: FileStats) => void;
709
+ /** @public */
707
710
  export interface VaultFileMapRecord extends Record<string, TAbstractFile> {
708
711
  }
709
712
  declare module "obsidian" {
@@ -726,6 +729,8 @@ declare module "obsidian" {
726
729
  configTs: number;
727
730
  /** @internal Mapping of path to Obsidian folder or file structure */
728
731
  fileMap: VaultFileMapRecord;
732
+ /** @internal Listener for all events on the vault */
733
+ onChange: FileSystemWatchHandler;
729
734
  /** @internal Add file as child/parent to respective folders */
730
735
  addChild(file: TAbstractFile): void;
731
736
  /** @internal Check whether new file path is available */
@@ -779,8 +784,6 @@ declare module "obsidian" {
779
784
  on(name: "config-changed", callback: () => void, ctx?: unknown): EventRef;
780
785
  /** @internal Triggered whenever a file gets loaded internally */
781
786
  on(name: "raw", callback: (path: string) => void, ctx?: unknown): EventRef;
782
- /** @internal Listener for all events on the vault */
783
- onChange(eventType: string, path: string, oldPath?: string, stats?: FileStats): void;
784
787
  /**
785
788
  * Read a config file from the vault and parse it as JSON
786
789
  *
@@ -4543,7 +4546,7 @@ declare module "obsidian" {
4543
4546
  /** @internal */
4544
4547
  update(normalizedPath: string): unknown;
4545
4548
  /** @internal Add change watcher to path */
4546
- watch(normalizedPath: string): Promise<void>;
4549
+ watch(handler: FileSystemWatchHandler): Promise<void>;
4547
4550
  /** @internal Watch recursively for changes */
4548
4551
  watchHiddenRecursive(normalizedPath: string): Promise<void>;
4549
4552
  }
@@ -5879,11 +5882,6 @@ export interface FileSuggest<T> extends EditorSuggest<T> {
5879
5882
  */
5880
5883
  suggestManager: FileSuggestManager;
5881
5884
  }
5882
- declare global {
5883
- interface DomElementInfo {
5884
- [eventName: `on${string}`]: EventListenerOrEventListenerObject;
5885
- }
5886
- }
5887
5885
  declare module "obsidian" {
5888
5886
  /** @todo Documentation incomplete */
5889
5887
  interface ItemView extends View {
@@ -6376,6 +6374,51 @@ declare module "obsidian" {
6376
6374
  syncState(e: boolean): Promise<unknown>;
6377
6375
  }
6378
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
+ }
6379
6422
  /** @public */
6380
6423
  export interface ImageView extends EditableFileView {
6381
6424
  /**
@@ -6923,49 +6966,9 @@ export interface GraphView extends ItemView {
6923
6966
  */
6924
6967
  onOptionsChange(): void;
6925
6968
  }
6926
- /** @todo Documentation incomplete */
6927
- /** @public */
6928
- export interface VimState {
6929
- vim: {
6930
- inputState: {
6931
- changeQueue: null;
6932
- keyBuffer: [
6933
- ];
6934
- motion: null;
6935
- motionArgs: null;
6936
- motionRepeat: [
6937
- ];
6938
- operator: null;
6939
- operatorArgs: null;
6940
- prefixRepeat: [
6941
- ];
6942
- registerName: null;
6943
- };
6944
- insertMode: false;
6945
- insertModeRepeat: undefined;
6946
- lastEditActionCommand: undefined;
6947
- lastEditInputState: undefined;
6948
- lastHPos: number;
6949
- lastHSPos: number;
6950
- lastMotion: {
6951
- name?: string;
6952
- };
6953
- lastPastedText: null;
6954
- lastSelection: null;
6955
- };
6956
- vimPlugin: {
6957
- lastKeydown: string;
6958
- };
6959
- }
6960
- /** @todo Documentation incomplete */
6961
- /** @public */
6962
- export interface VimEditor {
6963
- state: VimState;
6964
- }
6965
- declare module "@codemirror/view" {
6966
- /** @todo Documentation incomplete */
6967
- interface EditorView {
6968
- cm?: VimEditor;
6969
+ declare global {
6970
+ interface DomElementInfo {
6971
+ [eventName: `on${string}`]: EventListenerOrEventListenerObject;
6969
6972
  }
6970
6973
  }
6971
6974
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-typings",
3
- "version": "2.2.0",
3
+ "version": "2.2.1-beta.1",
4
4
  "description": "Extended type definitions for the Obsidian API (https://obsidian.md)",
5
5
  "main": "",
6
6
  "module": "",
@@ -71,6 +71,7 @@
71
71
  "build:style-mod": "bun run scripts/build-style-mod.ts",
72
72
  "build:extract-api": "api-extractor run --local",
73
73
  "format": "bun run scripts/sort-interfaces.ts ./src/ && bun dprint fmt",
74
+ "release-beta": "bun run scripts/bump-version.ts beta",
74
75
  "release-patch": "bun run scripts/bump-version.ts patch",
75
76
  "release-minor": "bun run scripts/bump-version.ts minor",
76
77
  "release-major": "bun run scripts/bump-version.ts major",