obsidian-typings 2.9.0 → 2.10.0

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 +219 -212
  2. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -5702,6 +5702,13 @@ declare module "obsidian" {
5702
5702
  * Triggers when context menu action is executed on the leaf
5703
5703
  */
5704
5704
  on(name: "leaf-menu", callback: (menu: Menu, leaf: WorkspaceLeaf) => void, ctx?: unknown): EventRef;
5705
+ /**
5706
+ * Open a link in the current leaf
5707
+ * @param linktext - The link text to open
5708
+ * @param sourcePath - The path of the source file
5709
+ * @param openViewState - The view state to open the link in
5710
+ */
5711
+ openLinkText(linktext: string, sourcePath: string, openViewState?: OpenViewState): Promise<void>;
5705
5712
  /**
5706
5713
  * Set the vertical height a leaf may occupy if it is in a split. The height is not set directly, but
5707
5714
  * by setting the flex-grow (css) of the element. This means to predictably affect the height, you
@@ -7854,152 +7861,6 @@ export interface Account {
7854
7861
  seats: number;
7855
7862
  token: string;
7856
7863
  }
7857
- declare module "obsidian" {
7858
- interface CloseableComponent {
7859
- }
7860
- }
7861
- declare module "obsidian" {
7862
- interface ProgressBarComponent extends ValueComponent<number> {
7863
- /**
7864
- * Access the "line" element which is a child of the progressBar element
7865
- */
7866
- lineEl: HTMLDivElement;
7867
- /**
7868
- * Access the "bar" element
7869
- */
7870
- progressBar: HTMLDivElement;
7871
- /**
7872
- * Shows/hides the component
7873
- *
7874
- * @param visible Whether the setting should be visible
7875
- * @returns The component
7876
- */
7877
- setVisibility(visible: boolean): this;
7878
- }
7879
- }
7880
- declare module "obsidian" {
7881
- interface DropdownComponent extends ValueComponent<string> {
7882
- /**
7883
- * The function that's called after changing the value of the component.
7884
- * @remark Using `DropdownComponent.onChange(callback)` assigns the callback to this method
7885
- */
7886
- changeCallback?: (value: string) => void;
7887
- }
7888
- }
7889
- declare module "obsidian" {
7890
- interface SliderComponent extends ValueComponent<number> {
7891
- /**
7892
- * The function that's called after changing the value of the component.
7893
- * @remark Using `SliderComponent.onChange(callback)` assigns the callback to this method
7894
- */
7895
- changeCallback?: (value: number) => void;
7896
- }
7897
- }
7898
- declare module "obsidian" {
7899
- interface AbstractTextComponent<T extends HTMLInputElement | HTMLTextAreaElement> extends ValueComponent<string> {
7900
- /**
7901
- * The function that's called after changing the value of the component.
7902
- * @remark Using `AbstractTextComponent.onChange(callback)` assigns the callback to this method
7903
- */
7904
- changeCallback?: (value: string) => void;
7905
- }
7906
- }
7907
- declare module "obsidian" {
7908
- interface TextAreaComponent extends AbstractTextComponent<HTMLTextAreaElement> {
7909
- }
7910
- }
7911
- declare module "obsidian" {
7912
- interface ExtraButtonComponent extends BaseComponent {
7913
- /**
7914
- * The function that's called after clicking the button.
7915
- * @remark Using `ExtraButtonComponent.onClick(callback)` assigns the callback to this method
7916
- */
7917
- changeCallback?: () => void;
7918
- }
7919
- }
7920
- declare module "obsidian" {
7921
- interface ToggleComponent extends ValueComponent<boolean> {
7922
- /**
7923
- * The function that's called after changing the value of the component.
7924
- * @remark Using `ToggleComponent.onChange(callback)` assigns the callback to this method
7925
- */
7926
- changeCallback?: (value: boolean) => void;
7927
- }
7928
- }
7929
- declare module "obsidian" {
7930
- /** @todo Documentation incomplete */
7931
- interface Component {
7932
- /**
7933
- * Child Components attached to current component, will be unloaded on unloading parent component
7934
- */
7935
- _children: Component[];
7936
- /**
7937
- * Events that are attached to the current component, will be detached on unloading parent component
7938
- */
7939
- _events: EventRef[];
7940
- /**
7941
- * Whether the component and its children are loaded
7942
- */
7943
- _loaded: boolean;
7944
- registerScopeEvent(keymapEventHandler: KeymapEventHandler): void;
7945
- }
7946
- }
7947
- declare module "obsidian" {
7948
- interface ValueComponent<T> extends BaseComponent {
7949
- }
7950
- }
7951
- declare module "obsidian" {
7952
- interface TextComponent extends AbstractTextComponent<HTMLInputElement> {
7953
- }
7954
- }
7955
- declare module "obsidian" {
7956
- interface ColorComponent extends ValueComponent<string> {
7957
- /**
7958
- * The function that's called after changing the value of the component.
7959
- * @remark Using `ColorComponent.onChange(callback)` assigns the callback to this method
7960
- */
7961
- changeCallback?: (value: HexString) => void;
7962
- /**
7963
- * Access the underlying input element of type "color"
7964
- */
7965
- colorPickerEl: HTMLInputElement;
7966
- getValueInt(): number;
7967
- setValueInt(value: number): this;
7968
- }
7969
- }
7970
- declare module "obsidian" {
7971
- interface MomentFormatComponent extends TextComponent {
7972
- }
7973
- }
7974
- declare module "obsidian" {
7975
- interface BaseComponent {
7976
- }
7977
- }
7978
- declare module "obsidian" {
7979
- interface ButtonComponent extends BaseComponent {
7980
- /**
7981
- * The function that's called after clicking the button.
7982
- * @remark Using `ButtonComponent.onClick(callback)` assigns the callback to this method
7983
- */
7984
- clickCallback?: () => void;
7985
- }
7986
- }
7987
- declare module "obsidian" {
7988
- interface SearchComponent extends AbstractTextComponent<HTMLInputElement> {
7989
- /**
7990
- * The containing element for the component's `clearButtonEl` and `inputEl`
7991
- */
7992
- containerEl: HTMLElement;
7993
- /**
7994
- * Adds a decorator to the right side of the search component
7995
- */
7996
- addRightDecorator(decoratorFn: (containerEl: HTMLElement) => void): this;
7997
- /**
7998
- * Adds a class to the search component
7999
- */
8000
- setClass(cls: string): this;
8001
- }
8002
- }
8003
7864
  /**
8004
7865
  * The TFile constructor.
8005
7866
  *
@@ -8150,12 +8011,78 @@ export declare class CustomArrayDictImpl<T> implements CustomArrayDict<T> {
8150
8011
  contains(key: string, value: T): boolean;
8151
8012
  count(): number;
8152
8013
  }
8014
+ /** @public */
8015
+ export type PlatformType = typeof Platform;
8016
+ /**
8017
+ * @public
8018
+ *
8019
+ * Due to limitations of TypeScript, we cannot extend the Platform constant directly.
8020
+ * @example
8021
+ * ```ts
8022
+ * import { Platform } from 'obsidian';
8023
+ * import type { PlatformEx } from 'obsidian-typings';
8024
+ * const platformEx = Platform as PlatformEx;
8025
+ * console.log(platformEx.canDisplayRibbon);
8026
+ * ```
8027
+ */
8028
+ export interface PlatformEx extends PlatformType {
8029
+ canDisplayRibbon: boolean;
8030
+ canExportPdf: boolean;
8031
+ canPopoutWindow: boolean;
8032
+ canSplit: boolean;
8033
+ canStackTabs: boolean;
8034
+ mobileDeviceHeight: number;
8035
+ mobileKeyboardHeight: number;
8036
+ mobileSoftKeyboardVisible: boolean;
8037
+ }
8038
+ /**
8039
+ * A constructor for a browser history view.
8040
+ *
8041
+ * @public
8042
+ */
8043
+ export type BrowserHistoryViewConstructor = new (leaf: WorkspaceLeaf, browserPluginInstance: BrowserPluginInstance) => BrowserHistoryView;
8044
+ /**
8045
+ * A constructor for a canvas view.
8046
+ *
8047
+ * @public
8048
+ */
8049
+ export type CanvasViewConstructor = new (leaf: WorkspaceLeaf, canvasPluginInstance: CanvasPluginInstance) => CanvasView;
8050
+ /**
8051
+ * A constructor for an outline view.
8052
+ *
8053
+ * @public
8054
+ */
8055
+ export type OutlineViewConstructor = new (leaf: WorkspaceLeaf, outlinePluginInstance: OutlinePluginInstance) => OutlineView;
8153
8056
  /**
8154
8057
  * A constructor for a view that is typed to a specific view type.
8155
8058
  *
8156
8059
  * @public
8157
8060
  */
8158
8061
  export type TypedViewConstructor<TView extends View> = new (leaf: WorkspaceLeaf) => TView;
8062
+ /**
8063
+ * A constructor for a sync view.
8064
+ *
8065
+ * @public
8066
+ */
8067
+ export type SyncViewConstructor = new (leaf: WorkspaceLeaf, syncPluginInstance: SyncPluginInstance) => SyncView;
8068
+ /**
8069
+ * A constructor for a browser view.
8070
+ *
8071
+ * @public
8072
+ */
8073
+ export type BrowserViewConstructor = new (leaf: WorkspaceLeaf, browserPluginInstance: BrowserPluginInstance) => BrowserView;
8074
+ /**
8075
+ * A constructor for a bookmarks view.
8076
+ *
8077
+ * @public
8078
+ */
8079
+ export type BookmarksViewConstructor = new (leaf: WorkspaceLeaf, bookmarksPluginInstance: BookmarksPluginInstance) => BookmarksView;
8080
+ /**
8081
+ * A constructor for a file properties view.
8082
+ *
8083
+ * @public
8084
+ */
8085
+ export type FilePropertiesViewConstructor = new (leaf: WorkspaceLeaf, propertiesPluginInstance: PropertiesPluginInstance) => FilePropertiesView;
8159
8086
  /**
8160
8087
  * Get the AllPropertiesView constructor.
8161
8088
  *
@@ -8170,12 +8097,6 @@ export declare function getAllPropertiesViewConstructor(app: App): TypedViewCons
8170
8097
  * @public
8171
8098
  */
8172
8099
  export declare function getMarkdownViewConstructor(app: App): TypedViewConstructor<MarkdownView>;
8173
- /**
8174
- * A constructor for a canvas view.
8175
- *
8176
- * @public
8177
- */
8178
- export type CanvasViewConstructor = new (leaf: WorkspaceLeaf, canvasPluginInstance: CanvasPluginInstance) => CanvasView;
8179
8100
  /**
8180
8101
  * Get the CanvasView constructor.
8181
8102
  *
@@ -8197,12 +8118,6 @@ export declare function getFileExplorerViewConstructor(app: App): TypedViewConst
8197
8118
  * @public
8198
8119
  */
8199
8120
  export declare function getOutgoingLinkViewConstructor(app: App): TypedViewConstructor<OutgoingLinkView>;
8200
- /**
8201
- * A constructor for a browser view.
8202
- *
8203
- * @public
8204
- */
8205
- export type BrowserViewConstructor = new (leaf: WorkspaceLeaf, browserPluginInstance: BrowserPluginInstance) => BrowserView;
8206
8121
  /**
8207
8122
  * Get the BrowserView constructor.
8208
8123
  *
@@ -8233,12 +8148,6 @@ export declare function getViewConstructorByViewType<TView extends View = View>(
8233
8148
  * @public
8234
8149
  */
8235
8150
  export declare function getSearchViewConstructor(app: App): TypedViewConstructor<SearchView>;
8236
- /**
8237
- * A constructor for a file properties view.
8238
- *
8239
- * @public
8240
- */
8241
- export type FilePropertiesViewConstructor = new (leaf: WorkspaceLeaf, propertiesPluginInstance: PropertiesPluginInstance) => FilePropertiesView;
8242
8151
  /**
8243
8152
  * Get the FilePropertiesView constructor.
8244
8153
  *
@@ -8246,12 +8155,6 @@ export type FilePropertiesViewConstructor = new (leaf: WorkspaceLeaf, properties
8246
8155
  * @public
8247
8156
  */
8248
8157
  export declare function getFilePropertiesViewConstructor(app: App): FilePropertiesViewConstructor;
8249
- /**
8250
- * A constructor for a bookmarks view.
8251
- *
8252
- * @public
8253
- */
8254
- export type BookmarksViewConstructor = new (leaf: WorkspaceLeaf, bookmarksPluginInstance: BookmarksPluginInstance) => BookmarksView;
8255
8158
  /**
8256
8159
  * Get the BookmarksView constructor.
8257
8160
  *
@@ -8273,12 +8176,6 @@ export declare function getEmptyViewConstructor(app: App): TypedViewConstructor<
8273
8176
  * @public
8274
8177
  */
8275
8178
  export declare function getAudioViewConstructor(app: App): TypedViewConstructor<AudioView>;
8276
- /**
8277
- * A constructor for an outline view.
8278
- *
8279
- * @public
8280
- */
8281
- export type OutlineViewConstructor = new (leaf: WorkspaceLeaf, outlinePluginInstance: OutlinePluginInstance) => OutlineView;
8282
8179
  /**
8283
8180
  * Get the OutlineView constructor.
8284
8181
  *
@@ -8321,12 +8218,6 @@ export declare function getLocalGraphViewConstructor(app: App): TypedViewConstru
8321
8218
  * @public
8322
8219
  */
8323
8220
  export declare function getImageViewConstructor(app: App): TypedViewConstructor<ImageView>;
8324
- /**
8325
- * A constructor for a browser history view.
8326
- *
8327
- * @public
8328
- */
8329
- export type BrowserHistoryViewConstructor = new (leaf: WorkspaceLeaf, browserPluginInstance: BrowserPluginInstance) => BrowserHistoryView;
8330
8221
  /**
8331
8222
  * Get the BrowserHistoryView constructor.
8332
8223
  *
@@ -8334,12 +8225,6 @@ export type BrowserHistoryViewConstructor = new (leaf: WorkspaceLeaf, browserPlu
8334
8225
  * @public
8335
8226
  */
8336
8227
  export declare function getBrowserHistoryViewConstructor(app: App): BrowserHistoryViewConstructor;
8337
- /**
8338
- * A constructor for a sync view.
8339
- *
8340
- * @public
8341
- */
8342
- export type SyncViewConstructor = new (leaf: WorkspaceLeaf, syncPluginInstance: SyncPluginInstance) => SyncView;
8343
8228
  /**
8344
8229
  * Get the SyncView constructor.
8345
8230
  *
@@ -8361,6 +8246,152 @@ export declare function getReleaseNotesViewConstructor(app: App): TypedViewConst
8361
8246
  * @public
8362
8247
  */
8363
8248
  export declare function getBacklinkViewConstructor(app: App): TypedViewConstructor<BacklinkView>;
8249
+ declare module "obsidian" {
8250
+ interface CloseableComponent {
8251
+ }
8252
+ }
8253
+ declare module "obsidian" {
8254
+ interface ProgressBarComponent extends ValueComponent<number> {
8255
+ /**
8256
+ * Access the "line" element which is a child of the progressBar element
8257
+ */
8258
+ lineEl: HTMLDivElement;
8259
+ /**
8260
+ * Access the "bar" element
8261
+ */
8262
+ progressBar: HTMLDivElement;
8263
+ /**
8264
+ * Shows/hides the component
8265
+ *
8266
+ * @param visible Whether the setting should be visible
8267
+ * @returns The component
8268
+ */
8269
+ setVisibility(visible: boolean): this;
8270
+ }
8271
+ }
8272
+ declare module "obsidian" {
8273
+ interface DropdownComponent extends ValueComponent<string> {
8274
+ /**
8275
+ * The function that's called after changing the value of the component.
8276
+ * @remark Using `DropdownComponent.onChange(callback)` assigns the callback to this method
8277
+ */
8278
+ changeCallback?: (value: string) => void;
8279
+ }
8280
+ }
8281
+ declare module "obsidian" {
8282
+ interface SliderComponent extends ValueComponent<number> {
8283
+ /**
8284
+ * The function that's called after changing the value of the component.
8285
+ * @remark Using `SliderComponent.onChange(callback)` assigns the callback to this method
8286
+ */
8287
+ changeCallback?: (value: number) => void;
8288
+ }
8289
+ }
8290
+ declare module "obsidian" {
8291
+ interface AbstractTextComponent<T extends HTMLInputElement | HTMLTextAreaElement> extends ValueComponent<string> {
8292
+ /**
8293
+ * The function that's called after changing the value of the component.
8294
+ * @remark Using `AbstractTextComponent.onChange(callback)` assigns the callback to this method
8295
+ */
8296
+ changeCallback?: (value: string) => void;
8297
+ }
8298
+ }
8299
+ declare module "obsidian" {
8300
+ interface TextAreaComponent extends AbstractTextComponent<HTMLTextAreaElement> {
8301
+ }
8302
+ }
8303
+ declare module "obsidian" {
8304
+ interface ExtraButtonComponent extends BaseComponent {
8305
+ /**
8306
+ * The function that's called after clicking the button.
8307
+ * @remark Using `ExtraButtonComponent.onClick(callback)` assigns the callback to this method
8308
+ */
8309
+ changeCallback?: () => void;
8310
+ }
8311
+ }
8312
+ declare module "obsidian" {
8313
+ interface ToggleComponent extends ValueComponent<boolean> {
8314
+ /**
8315
+ * The function that's called after changing the value of the component.
8316
+ * @remark Using `ToggleComponent.onChange(callback)` assigns the callback to this method
8317
+ */
8318
+ changeCallback?: (value: boolean) => void;
8319
+ }
8320
+ }
8321
+ declare module "obsidian" {
8322
+ /** @todo Documentation incomplete */
8323
+ interface Component {
8324
+ /**
8325
+ * Child Components attached to current component, will be unloaded on unloading parent component
8326
+ */
8327
+ _children: Component[];
8328
+ /**
8329
+ * Events that are attached to the current component, will be detached on unloading parent component
8330
+ */
8331
+ _events: EventRef[];
8332
+ /**
8333
+ * Whether the component and its children are loaded
8334
+ */
8335
+ _loaded: boolean;
8336
+ registerScopeEvent(keymapEventHandler: KeymapEventHandler): void;
8337
+ }
8338
+ }
8339
+ declare module "obsidian" {
8340
+ interface ValueComponent<T> extends BaseComponent {
8341
+ }
8342
+ }
8343
+ declare module "obsidian" {
8344
+ interface TextComponent extends AbstractTextComponent<HTMLInputElement> {
8345
+ }
8346
+ }
8347
+ declare module "obsidian" {
8348
+ interface ColorComponent extends ValueComponent<string> {
8349
+ /**
8350
+ * The function that's called after changing the value of the component.
8351
+ * @remark Using `ColorComponent.onChange(callback)` assigns the callback to this method
8352
+ */
8353
+ changeCallback?: (value: HexString) => void;
8354
+ /**
8355
+ * Access the underlying input element of type "color"
8356
+ */
8357
+ colorPickerEl: HTMLInputElement;
8358
+ getValueInt(): number;
8359
+ setValueInt(value: number): this;
8360
+ }
8361
+ }
8362
+ declare module "obsidian" {
8363
+ interface MomentFormatComponent extends TextComponent {
8364
+ }
8365
+ }
8366
+ declare module "obsidian" {
8367
+ interface BaseComponent {
8368
+ }
8369
+ }
8370
+ declare module "obsidian" {
8371
+ interface ButtonComponent extends BaseComponent {
8372
+ /**
8373
+ * The function that's called after clicking the button.
8374
+ * @remark Using `ButtonComponent.onClick(callback)` assigns the callback to this method
8375
+ */
8376
+ clickCallback?: () => void;
8377
+ }
8378
+ }
8379
+ declare module "obsidian" {
8380
+ interface SearchComponent extends AbstractTextComponent<HTMLInputElement> {
8381
+ /**
8382
+ * The containing element for the component's `clearButtonEl` and `inputEl`
8383
+ */
8384
+ containerEl: HTMLElement;
8385
+ /**
8386
+ * Adds a decorator to the right side of the search component
8387
+ */
8388
+ addRightDecorator(decoratorFn: (containerEl: HTMLElement) => void): this;
8389
+ /**
8390
+ * Adds a class to the search component
8391
+ */
8392
+ setClass(cls: string): this;
8393
+ }
8394
+ }
8364
8395
  declare module "obsidian" {
8365
8396
  /** @todo Documentation incomplete */
8366
8397
  interface ItemView extends View {
@@ -8853,30 +8884,6 @@ declare module "obsidian" {
8853
8884
  updateShowBacklinks(): void;
8854
8885
  }
8855
8886
  }
8856
- /** @public */
8857
- export type PlatformType = typeof Platform;
8858
- /**
8859
- * @public
8860
- *
8861
- * Due to limitations of TypeScript, we cannot extend the Platform constant directly.
8862
- * @example
8863
- * ```ts
8864
- * import { Platform } from 'obsidian';
8865
- * import type { PlatformEx } from 'obsidian-typings';
8866
- * const platformEx = Platform as PlatformEx;
8867
- * console.log(platformEx.canDisplayRibbon);
8868
- * ```
8869
- */
8870
- export interface PlatformEx extends PlatformType {
8871
- canDisplayRibbon: boolean;
8872
- canExportPdf: boolean;
8873
- canPopoutWindow: boolean;
8874
- canSplit: boolean;
8875
- canStackTabs: boolean;
8876
- mobileDeviceHeight: number;
8877
- mobileKeyboardHeight: number;
8878
- mobileSoftKeyboardVisible: boolean;
8879
- }
8880
8887
 
8881
8888
  export {};
8882
8889
  import './style-mod.d.cts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-typings",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "Extended type definitions for the Obsidian API (https://obsidian.md)",
5
5
  "main": "",
6
6
  "module": "",