obsidian-dev-utils 19.0.0 → 19.0.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.
- package/CHANGELOG.md +5 -0
- package/README.md +0 -3
- package/dist/lib/@types/debug.d.mts +1 -16
- package/dist/lib/Async.d.mts +1 -153
- package/dist/lib/Blob.d.mts +1 -40
- package/dist/lib/CssClass.d.mts +1 -97
- package/dist/lib/Debug.d.mts +1 -41
- package/dist/lib/DebugController.d.mts +1 -85
- package/dist/lib/Enum.d.mts +1 -20
- package/dist/lib/Error.d.mts +1 -45
- package/dist/lib/Function.d.mts +1 -28
- package/dist/lib/HTMLElement.d.mts +1 -49
- package/dist/lib/Library.cjs +1 -1
- package/dist/lib/Library.d.mts +1 -16
- package/dist/lib/Library.mjs +1 -1
- package/dist/lib/Object.d.mts +1 -211
- package/dist/lib/Path.d.mts +1 -133
- package/dist/lib/RegExp.d.mts +1 -18
- package/dist/lib/ScriptUtils/CliUtils.d.mts +1 -70
- package/dist/lib/ScriptUtils/CodeGenerator.d.mts +1 -12
- package/dist/lib/ScriptUtils/ESLint/@types/@guardian__eslint-plugin-tsdoc-required.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-modules-newlines.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-verify-tsdoc.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/ESLint.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/eslint.config.d.mts +1 -16
- package/dist/lib/ScriptUtils/ESLint/index.d.mts +1 -2
- package/dist/lib/ScriptUtils/Exec.d.mts +1 -83
- package/dist/lib/ScriptUtils/Fs.d.mts +1 -72
- package/dist/lib/ScriptUtils/JSON.d.mts +1 -64
- package/dist/lib/ScriptUtils/NodeModules.d.mts +1 -14
- package/dist/lib/ScriptUtils/Npm.d.mts +1 -151
- package/dist/lib/ScriptUtils/NpmPublish.d.mts +1 -9
- package/dist/lib/ScriptUtils/ObsidianDevUtilsRepoPaths.d.mts +1 -88
- package/dist/lib/ScriptUtils/Root.d.mts +1 -67
- package/dist/lib/ScriptUtils/build.d.mts +1 -41
- package/dist/lib/ScriptUtils/cli.d.mts +1 -14
- package/dist/lib/ScriptUtils/esbuild/Dependency.d.mts +1 -18
- package/dist/lib/ScriptUtils/esbuild/ObsidianPluginBuilder.d.mts +1 -53
- package/dist/lib/ScriptUtils/esbuild/changeExtensionPlugin.d.mts +1 -12
- package/dist/lib/ScriptUtils/esbuild/copyToObsidianPluginsFolderPlugin.d.mts +1 -18
- package/dist/lib/ScriptUtils/esbuild/fixEsmPlugin.d.mts +1 -11
- package/dist/lib/ScriptUtils/esbuild/fixSourceMapsPlugin.d.mts +1 -17
- package/dist/lib/ScriptUtils/esbuild/index.d.mts +1 -9
- package/dist/lib/ScriptUtils/esbuild/preprocessPlugin.d.mts +1 -23
- package/dist/lib/ScriptUtils/esbuild/renameCssPlugin.d.mts +1 -8
- package/dist/lib/ScriptUtils/esbuild/svelteWrapperPlugin.d.mts +1 -8
- package/dist/lib/ScriptUtils/format.d.mts +1 -10
- package/dist/lib/ScriptUtils/index.d.mts +1 -17
- package/dist/lib/ScriptUtils/spellcheck.d.mts +1 -14
- package/dist/lib/ScriptUtils/version.d.mts +1 -171
- package/dist/lib/String.d.mts +1 -138
- package/dist/lib/Transformers/DateTransformer.d.mts +1 -35
- package/dist/lib/Transformers/DurationTransformer.d.mts +1 -34
- package/dist/lib/Transformers/GroupTransformer.d.mts +1 -65
- package/dist/lib/Transformers/SkipPrivatePropertyTransformer.d.mts +1 -32
- package/dist/lib/Transformers/Transformer.d.mts +1 -67
- package/dist/lib/Transformers/TypedTransformer.d.mts +1 -37
- package/dist/lib/Transformers/index.d.mts +1 -6
- package/dist/lib/ValueProvider.d.mts +1 -22
- package/dist/lib/codemirror/StateFieldSpec.d.mts +1 -68
- package/dist/lib/codemirror/index.d.mts +1 -1
- package/dist/lib/index.d.mts +1 -20
- package/dist/lib/obsidian/@types/Dataview/api/data-array.d.mts +1 -136
- package/dist/lib/obsidian/@types/Dataview/api/extensions.d.mts +1 -15
- package/dist/lib/obsidian/@types/Dataview/api/inline-api.d.mts +1 -186
- package/dist/lib/obsidian/@types/Dataview/api/plugin-api.d.mts +1 -209
- package/dist/lib/obsidian/@types/Dataview/api/result.d.mts +1 -38
- package/dist/lib/obsidian/@types/Dataview/data-import/common.d.mts +1 -3
- package/dist/lib/obsidian/@types/Dataview/data-import/csv.d.mts +1 -3
- package/dist/lib/obsidian/@types/Dataview/data-import/inline-field.d.mts +1 -42
- package/dist/lib/obsidian/@types/Dataview/data-import/markdown-file.d.mts +1 -52
- package/dist/lib/obsidian/@types/Dataview/data-import/persister.d.mts +1 -32
- package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-entry.d.mts +1 -1
- package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-impl.d.mts +1 -6
- package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-manager.d.mts +1 -37
- package/dist/lib/obsidian/@types/Dataview/data-index/index.d.mts +1 -186
- package/dist/lib/obsidian/@types/Dataview/data-index/resolver.d.mts +1 -23
- package/dist/lib/obsidian/@types/Dataview/data-index/source.d.mts +1 -71
- package/dist/lib/obsidian/@types/Dataview/data-model/markdown.d.mts +1 -115
- package/dist/lib/obsidian/@types/Dataview/data-model/serialized/markdown.d.mts +1 -106
- package/dist/lib/obsidian/@types/Dataview/data-model/transferable.d.mts +1 -7
- package/dist/lib/obsidian/@types/Dataview/data-model/value.d.mts +1 -175
- package/dist/lib/obsidian/@types/Dataview/expression/binaryop.d.mts +1 -43
- package/dist/lib/obsidian/@types/Dataview/expression/context.d.mts +1 -49
- package/dist/lib/obsidian/@types/Dataview/expression/field.d.mts +1 -82
- package/dist/lib/obsidian/@types/Dataview/expression/functions.d.mts +1 -149
- package/dist/lib/obsidian/@types/Dataview/expression/parse.d.mts +1 -163
- package/dist/lib/obsidian/@types/Dataview/index.d.mts +1 -55
- package/dist/lib/obsidian/@types/Dataview/main.d.mts +1 -52
- package/dist/lib/obsidian/@types/Dataview/query/engine.d.mts +1 -103
- package/dist/lib/obsidian/@types/Dataview/query/parse.d.mts +1 -44
- package/dist/lib/obsidian/@types/Dataview/query/query.d.mts +1 -95
- package/dist/lib/obsidian/@types/Dataview/settings.d.mts +1 -60
- package/dist/lib/obsidian/@types/Dataview/typings/obsidian-ex.d.mts +1 -28
- package/dist/lib/obsidian/@types/Dataview/typings/workers.d.mts +1 -4
- package/dist/lib/obsidian/@types/Dataview/ui/export/markdown.d.mts +1 -15
- package/dist/lib/obsidian/@types/Dataview/ui/lp-render.d.mts +1 -37
- package/dist/lib/obsidian/@types/Dataview/ui/markdown.d.mts +1 -86
- package/dist/lib/obsidian/@types/Dataview/ui/refreshable-view.d.mts +1 -18
- package/dist/lib/obsidian/@types/Dataview/ui/render.d.mts +1 -33
- package/dist/lib/obsidian/@types/Dataview/ui/views/calendar-view.d.mts +1 -17
- package/dist/lib/obsidian/@types/Dataview/ui/views/inline-field-live-preview.d.mts +1 -42
- package/dist/lib/obsidian/@types/Dataview/ui/views/inline-view.d.mts +1 -28
- package/dist/lib/obsidian/@types/Dataview/ui/views/js-view.d.mts +1 -23
- package/dist/lib/obsidian/@types/Dataview/ui/views/list-view.d.mts +1 -25
- package/dist/lib/obsidian/@types/Dataview/ui/views/table-view.d.mts +1 -28
- package/dist/lib/obsidian/@types/Dataview/ui/views/task-view.d.mts +1 -51
- package/dist/lib/obsidian/@types/Dataview/util/hash.d.mts +1 -1
- package/dist/lib/obsidian/@types/Dataview/util/locale.d.mts +1 -2
- package/dist/lib/obsidian/@types/Dataview/util/media.d.mts +1 -6
- package/dist/lib/obsidian/@types/Dataview/util/normalize.d.mts +1 -44
- package/dist/lib/obsidian/App.d.mts +1 -30
- package/dist/lib/obsidian/AttachmentPath.d.mts +1 -54
- package/dist/lib/obsidian/Backlink.d.mts +1 -60
- package/dist/lib/obsidian/Callout.d.mts +1 -55
- package/dist/lib/obsidian/Components/DateComponent.d.mts +1 -36
- package/dist/lib/obsidian/Components/DateTimeComponent.d.mts +1 -36
- package/dist/lib/obsidian/Components/EmailComponent.d.mts +1 -29
- package/dist/lib/obsidian/Components/FileComponent.d.mts +1 -41
- package/dist/lib/obsidian/Components/MonthComponent.d.mts +1 -49
- package/dist/lib/obsidian/Components/MultipleDropdownComponent.d.mts +1 -73
- package/dist/lib/obsidian/Components/MultipleEmailComponent.d.mts +1 -36
- package/dist/lib/obsidian/Components/MultipleFileComponent.d.mts +1 -41
- package/dist/lib/obsidian/Components/MultipleTextComponent.d.mts +1 -67
- package/dist/lib/obsidian/Components/NumberComponent.d.mts +1 -29
- package/dist/lib/obsidian/Components/TimeComponent.d.mts +1 -37
- package/dist/lib/obsidian/Components/TypedRangeTextComponent.d.mts +1 -31
- package/dist/lib/obsidian/Components/TypedTextComponent.d.mts +1 -84
- package/dist/lib/obsidian/Components/UrlComponent.d.mts +1 -29
- package/dist/lib/obsidian/Components/ValidatorComponent.d.mts +1 -22
- package/dist/lib/obsidian/Components/ValueComponentWithChangeTracking.d.mts +1 -17
- package/dist/lib/obsidian/Components/WeekComponent.d.mts +1 -49
- package/dist/lib/obsidian/Components/index.d.mts +1 -17
- package/dist/lib/obsidian/Dataview.d.mts +1 -215
- package/dist/lib/obsidian/DataviewLink.d.mts +1 -23
- package/dist/lib/obsidian/FileChange.d.mts +1 -68
- package/dist/lib/obsidian/FileManager.d.mts +1 -38
- package/dist/lib/obsidian/FileSystem.d.mts +1 -185
- package/dist/lib/obsidian/Frontmatter.d.mts +1 -69
- package/dist/lib/obsidian/Link.d.mts +1 -366
- package/dist/lib/obsidian/Logger.d.mts +1 -13
- package/dist/lib/obsidian/Loop.d.mts +1 -36
- package/dist/lib/obsidian/Markdown.d.mts +1 -24
- package/dist/lib/obsidian/MarkdownCodeBlockProcessor.d.mts +1 -23
- package/dist/lib/obsidian/MarkdownView.d.mts +1 -12
- package/dist/lib/obsidian/MetadataCache.d.mts +1 -87
- package/dist/lib/obsidian/Modals/Alert.d.mts +1 -39
- package/dist/lib/obsidian/Modals/Confirm.d.mts +1 -43
- package/dist/lib/obsidian/Modals/ModalBase.d.mts +1 -35
- package/dist/lib/obsidian/Modals/Prompt.d.mts +1 -50
- package/dist/lib/obsidian/Modals/SelectItem.d.mts +1 -41
- package/dist/lib/obsidian/Modals/index.d.mts +1 -5
- package/dist/lib/obsidian/ObsidianSettings.d.mts +1 -17
- package/dist/lib/obsidian/Pdf.d.mts +1 -24
- package/dist/lib/obsidian/Plugin/EmptySettings.d.mts +1 -14
- package/dist/lib/obsidian/Plugin/ObsidianPluginRepoPaths.d.mts +1 -55
- package/dist/lib/obsidian/Plugin/Plugin.d.mts +1 -21
- package/dist/lib/obsidian/Plugin/PluginBase.d.mts +1 -108
- package/dist/lib/obsidian/Plugin/PluginContext.d.mts +1 -12
- package/dist/lib/obsidian/Plugin/PluginId.d.mts +1 -20
- package/dist/lib/obsidian/Plugin/PluginSettingsBase.d.mts +1 -31
- package/dist/lib/obsidian/Plugin/PluginSettingsTabBase.d.mts +1 -99
- package/dist/lib/obsidian/Plugin/index.d.mts +1 -8
- package/dist/lib/obsidian/Queue.d.mts +1 -30
- package/dist/lib/obsidian/Reference.d.mts +1 -21
- package/dist/lib/obsidian/RenameDeleteHandler.d.mts +1 -49
- package/dist/lib/obsidian/ResourceUrl.d.mts +1 -14
- package/dist/lib/obsidian/SettingEx.d.mts +1 -124
- package/dist/lib/obsidian/Vault.d.mts +1 -130
- package/dist/lib/obsidian/VaultEx.d.mts +1 -27
- package/dist/lib/obsidian/index.d.mts +1 -29
- package/dist/lib/url.d.mts +1 -11
- package/package.json +7 -7
@@ -1,99 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation PluginSettingsTabBase
|
3
|
-
* This module defines a base class for creating plugin setting tabs in Obsidian.
|
4
|
-
* It provides a utility method to bind value components to plugin settings and handle changes.
|
5
|
-
*/
|
6
|
-
import type { BaseComponent } from 'obsidian';
|
7
|
-
import { PluginSettingTab } from 'obsidian';
|
8
|
-
import type { MaybePromise } from '../../Async.mjs';
|
9
|
-
import type { KeysMatching } from '../../Object.mjs';
|
10
|
-
import type { ValueComponentWithChangeTracking } from '../Components/ValueComponentWithChangeTracking.mjs';
|
11
|
-
import type { PluginSettingsBase } from './PluginSettingsBase.mjs';
|
12
|
-
import { PluginBase } from './PluginBase.mjs';
|
13
|
-
/**
|
14
|
-
* Options for binding a value component to a plugin setting.
|
15
|
-
*/
|
16
|
-
export interface BindOptions<PluginSettings, UIValue> {
|
17
|
-
/**
|
18
|
-
* A callback function that is called when the value of the component changes.
|
19
|
-
*/
|
20
|
-
onChanged?: () => MaybePromise<void>;
|
21
|
-
/**
|
22
|
-
* The plugin settings object to bind the component to. Default is the plugin's current settings.
|
23
|
-
*/
|
24
|
-
pluginSettings?: PluginSettings;
|
25
|
-
/**
|
26
|
-
* If true, saves the plugin settings automatically after the component value changes. Default is `true`.
|
27
|
-
*/
|
28
|
-
shouldAutoSave?: boolean;
|
29
|
-
/**
|
30
|
-
* If true, shows the validation message when the component value is invalid. Default is `true`.
|
31
|
-
*/
|
32
|
-
shouldShowValidationMessage?: boolean;
|
33
|
-
/**
|
34
|
-
* Validates the UI value before setting it on the plugin settings.
|
35
|
-
* @param uiValue - The value of the UI component.
|
36
|
-
* @returns An error message if the value is invalid, or `(empty string)` or `void` if it is valid.
|
37
|
-
*/
|
38
|
-
valueValidator?: (uiValue: UIValue) => MaybePromise<string | void>;
|
39
|
-
}
|
40
|
-
/**
|
41
|
-
* Extended options for binding a value component to a plugin setting.
|
42
|
-
*/
|
43
|
-
export interface BindOptionsExtended<PluginSettings, UIValue, Property extends keyof PluginSettings> extends BindOptions<PluginSettings, UIValue> {
|
44
|
-
/**
|
45
|
-
* Converts the UI component's value back to the plugin settings value.
|
46
|
-
* @param uiValue - The value of the UI component.
|
47
|
-
* @returns The value to set on the plugin settings.
|
48
|
-
*/
|
49
|
-
componentToPluginSettingsValueConverter: (uiValue: UIValue) => PluginSettings[Property];
|
50
|
-
/**
|
51
|
-
* Converts the plugin settings value to the value used by the UI component.
|
52
|
-
* @param pluginSettingsValue - The value of the property in the plugin settings.
|
53
|
-
* @returns The value to set on the UI component.
|
54
|
-
*/
|
55
|
-
pluginSettingsToComponentValueConverter: (pluginSettingsValue: PluginSettings[Property]) => UIValue;
|
56
|
-
}
|
57
|
-
type ExtractPluginSettings<T extends PluginBase<any>> = PluginSettingsBase & T['settingsClone'];
|
58
|
-
/**
|
59
|
-
* Base class for creating plugin settings tabs in Obsidian.
|
60
|
-
* Provides a method for binding value components to plugin settings and handling changes.
|
61
|
-
*
|
62
|
-
* @typeParam TPlugin - The type of the plugin that extends PluginBase.
|
63
|
-
*/
|
64
|
-
export declare abstract class PluginSettingsTabBase<TPlugin extends PluginBase<any>> extends PluginSettingTab {
|
65
|
-
plugin: TPlugin;
|
66
|
-
private validatorsMap;
|
67
|
-
constructor(plugin: TPlugin);
|
68
|
-
/**
|
69
|
-
* Binds a value component to a plugin setting.
|
70
|
-
*
|
71
|
-
* @typeParam UIValue - The type of the value of the UI component.
|
72
|
-
* @typeParam TValueComponent - The type of the value component.
|
73
|
-
* @param valueComponent - The value component to bind.
|
74
|
-
* @param property - The property of the plugin settings to bind to.
|
75
|
-
* @param options - The options for binding the value component.
|
76
|
-
* @returns The value component.
|
77
|
-
*/
|
78
|
-
protected bind<UIValue, TValueComponent>(valueComponent: TValueComponent & ValueComponentWithChangeTracking<UIValue>, property: KeysMatching<ExtractPluginSettings<TPlugin>, UIValue>, options?: BindOptions<ExtractPluginSettings<TPlugin>, UIValue>): TValueComponent;
|
79
|
-
/**
|
80
|
-
* Binds a value component to a plugin setting.
|
81
|
-
*
|
82
|
-
* @typeParam UIValue - The type of the value of the UI component.
|
83
|
-
* @typeParam TValueComponent - The type of the value component.
|
84
|
-
* @typeParam Property - The property of the plugin settings to bind to.
|
85
|
-
* @param valueComponent - The value component to bind.
|
86
|
-
* @param property - The property of the plugin settings to bind to.
|
87
|
-
* @param options - The options for binding the value component.
|
88
|
-
* @returns The value component.
|
89
|
-
*/
|
90
|
-
protected bind<UIValue, TValueComponent, Property extends keyof ExtractPluginSettings<TPlugin>>(valueComponent: TValueComponent & ValueComponentWithChangeTracking<UIValue>, property: Property, options: BindOptionsExtended<ExtractPluginSettings<TPlugin>, UIValue, Property>): TValueComponent;
|
91
|
-
/**
|
92
|
-
* Revalidates the value component.
|
93
|
-
*
|
94
|
-
* @param baseComponent - The base component to revalidate.
|
95
|
-
* @returns A promise that resolves to a boolean indicating whether the value component is valid.
|
96
|
-
*/
|
97
|
-
protected revalidate(baseComponent: BaseComponent): Promise<boolean>;
|
98
|
-
}
|
99
|
-
export {};
|
1
|
+
export * from './PluginSettingsTabBase.cjs';
|
@@ -1,8 +1 @@
|
|
1
|
-
export *
|
2
|
-
export * as ObsidianPluginRepoPaths from './ObsidianPluginRepoPaths.mjs';
|
3
|
-
export * as Plugin from './Plugin.mjs';
|
4
|
-
export * as PluginBase from './PluginBase.mjs';
|
5
|
-
export * as PluginContext from './PluginContext.mjs';
|
6
|
-
export * as PluginId from './PluginId.mjs';
|
7
|
-
export * as PluginSettingsBase from './PluginSettingsBase.mjs';
|
8
|
-
export * as PluginSettingsTabBase from './PluginSettingsTabBase.mjs';
|
1
|
+
export * from './index.cjs';
|
@@ -1,30 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation Queue
|
3
|
-
* Contains utility functions for enqueuing and processing functions in Obsidian.
|
4
|
-
*/
|
5
|
-
import type { App } from 'obsidian';
|
6
|
-
import type { MaybePromise } from '../Async.mjs';
|
7
|
-
/**
|
8
|
-
* Adds an asynchronous function to be executed after the previous function completes.
|
9
|
-
*
|
10
|
-
* @param app - The Obsidian application instance.
|
11
|
-
* @param fn - The function to add.
|
12
|
-
* @param timeoutInMilliseconds - The timeout in milliseconds.
|
13
|
-
* @param stackTrace - Optional stack trace.
|
14
|
-
*/
|
15
|
-
export declare function addToQueue(app: App, fn: () => MaybePromise<void>, timeoutInMilliseconds?: number, stackTrace?: string): void;
|
16
|
-
/**
|
17
|
-
* Adds an asynchronous function to be executed after the previous function completes and returns a promise that resolves when the function completes.
|
18
|
-
*
|
19
|
-
* @param app - The Obsidian application instance.
|
20
|
-
* @param fn - The function to add.
|
21
|
-
* @param timeoutInMilliseconds - The timeout in milliseconds.
|
22
|
-
* @param stackTrace - Optional stack trace.
|
23
|
-
*/
|
24
|
-
export declare function addToQueueAndWait(app: App, fn: () => MaybePromise<void>, timeoutInMilliseconds?: number, stackTrace?: string): Promise<void>;
|
25
|
-
/**
|
26
|
-
* Flushes the queue;
|
27
|
-
*
|
28
|
-
* @param app - The Obsidian application instance.
|
29
|
-
*/
|
30
|
-
export declare function flushQueue(app: App): Promise<void>;
|
1
|
+
export * from './Queue.cjs';
|
@@ -1,21 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation Reference
|
3
|
-
* Contains utility functions for handling references in Obsidian.
|
4
|
-
*/
|
5
|
-
import type { Reference } from 'obsidian';
|
6
|
-
import type { FileChange } from './FileChange.mjs';
|
7
|
-
/**
|
8
|
-
* Converts a reference to a file change.
|
9
|
-
*
|
10
|
-
* @param reference - The reference to convert.
|
11
|
-
* @param newContent - The new content for the reference.
|
12
|
-
* @returns The file change.
|
13
|
-
*/
|
14
|
-
export declare function referenceToFileChange(reference: Reference, newContent: string): FileChange;
|
15
|
-
/**
|
16
|
-
* Sorts references by their type and position.
|
17
|
-
*
|
18
|
-
* @param references - The references to sort.
|
19
|
-
* @returns The sorted references.
|
20
|
-
*/
|
21
|
-
export declare function sortReferences(references: Reference[]): Reference[];
|
1
|
+
export * from './Reference.cjs';
|
@@ -1,49 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation RenameDeleteHandler
|
3
|
-
* Contains utility functions for handling rename and delete events in Obsidian.
|
4
|
-
*/
|
5
|
-
import type { Plugin } from 'obsidian';
|
6
|
-
/**
|
7
|
-
* Settings for the rename/delete handler.
|
8
|
-
*/
|
9
|
-
export interface RenameDeleteHandlerSettings {
|
10
|
-
/**
|
11
|
-
* Whether to ignore the path.
|
12
|
-
*/
|
13
|
-
isPathIgnored(path: string): boolean;
|
14
|
-
/**
|
15
|
-
* Whether to delete conflicting attachments.
|
16
|
-
*/
|
17
|
-
shouldDeleteConflictingAttachments: boolean;
|
18
|
-
/**
|
19
|
-
* Whether to delete empty folders.
|
20
|
-
*/
|
21
|
-
shouldDeleteEmptyFolders: boolean;
|
22
|
-
/**
|
23
|
-
* Whether to handle deletions.
|
24
|
-
*/
|
25
|
-
shouldHandleDeletions: boolean;
|
26
|
-
/**
|
27
|
-
* Whether to handle renames.
|
28
|
-
*/
|
29
|
-
shouldHandleRenames: boolean;
|
30
|
-
/**
|
31
|
-
* Whether to rename attachment files when a note is renamed.
|
32
|
-
*/
|
33
|
-
shouldRenameAttachmentFiles: boolean;
|
34
|
-
/**
|
35
|
-
* Whether to rename attachment folder when a note is renamed.
|
36
|
-
*/
|
37
|
-
shouldRenameAttachmentFolder: boolean;
|
38
|
-
/**
|
39
|
-
* Whether to update filename aliases when a note is renamed.
|
40
|
-
*/
|
41
|
-
shouldUpdateFilenameAliases: boolean;
|
42
|
-
}
|
43
|
-
/**
|
44
|
-
* Registers the rename/delete handlers.
|
45
|
-
* @param plugin - The plugin instance.
|
46
|
-
* @param settingsBuilder - A function that returns the settings for the rename delete handler.
|
47
|
-
* @returns void
|
48
|
-
*/
|
49
|
-
export declare function registerRenameDeleteHandlers(plugin: Plugin, settingsBuilder: () => Partial<RenameDeleteHandlerSettings>): void;
|
1
|
+
export * from './RenameDeleteHandler.cjs';
|
@@ -1,14 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation ResourceUrl
|
3
|
-
* This module provides utility functions for working with resource URLs in Obsidian.
|
4
|
-
*/
|
5
|
-
import type { App } from 'obsidian';
|
6
|
-
/**
|
7
|
-
* Converts a relative path to a resource URL.
|
8
|
-
*
|
9
|
-
* @param app - The Obsidian application instance.
|
10
|
-
* @param relativePath - The relative path to the resource.
|
11
|
-
* @param notePath - The path of the note.
|
12
|
-
* @returns The resource URL.
|
13
|
-
*/
|
14
|
-
export declare function relativePathToResourceUrl(app: App, relativePath: string, notePath: string): string;
|
1
|
+
export * from './ResourceUrl.cjs';
|
@@ -1,124 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation SettingEx
|
3
|
-
* Extends the Setting class with additional methods for adding components.
|
4
|
-
*/
|
5
|
-
import type { BaseComponent } from 'obsidian';
|
6
|
-
import { Setting } from 'obsidian';
|
7
|
-
import { DateComponent } from './Components/DateComponent.mjs';
|
8
|
-
import { DateTimeComponent } from './Components/DateTimeComponent.mjs';
|
9
|
-
import { EmailComponent } from './Components/EmailComponent.mjs';
|
10
|
-
import { FileComponent } from './Components/FileComponent.mjs';
|
11
|
-
import { MonthComponent } from './Components/MonthComponent.mjs';
|
12
|
-
import { MultipleDropdownComponent } from './Components/MultipleDropdownComponent.mjs';
|
13
|
-
import { MultipleEmailComponent } from './Components/MultipleEmailComponent.mjs';
|
14
|
-
import { MultipleFileComponent } from './Components/MultipleFileComponent.mjs';
|
15
|
-
import { MultipleTextComponent } from './Components/MultipleTextComponent.mjs';
|
16
|
-
import { NumberComponent } from './Components/NumberComponent.mjs';
|
17
|
-
import { TimeComponent } from './Components/TimeComponent.mjs';
|
18
|
-
import { UrlComponent } from './Components/UrlComponent.mjs';
|
19
|
-
import { WeekComponent } from './Components/WeekComponent.mjs';
|
20
|
-
/**
|
21
|
-
* Extends the Setting class with additional methods for adding components.
|
22
|
-
*/
|
23
|
-
export declare class SettingEx extends Setting {
|
24
|
-
/**
|
25
|
-
* Adds a component to the setting.
|
26
|
-
*
|
27
|
-
* @typeParam T - The type of the component to add.
|
28
|
-
* @param componentClass - The class of the component to add.
|
29
|
-
* @param cb - The callback to call with the component.
|
30
|
-
* @returns The setting instance.
|
31
|
-
*/
|
32
|
-
addComponent<T extends BaseComponent>(componentClass: new (controlEl: HTMLElement) => T, cb: (component: T) => void): this;
|
33
|
-
/**
|
34
|
-
* Adds a {@link DateComponent} to the setting.
|
35
|
-
*
|
36
|
-
* @param cb - The callback to call with the component.
|
37
|
-
* @returns The setting instance.
|
38
|
-
*/
|
39
|
-
addDate(cb: (component: DateComponent) => void): this;
|
40
|
-
/**
|
41
|
-
* Adds a {@link DateTimeComponent} to the setting.
|
42
|
-
*
|
43
|
-
* @param cb - The callback to call with the component.
|
44
|
-
* @returns The setting instance.
|
45
|
-
*/
|
46
|
-
addDateTime(cb: (component: DateTimeComponent) => void): this;
|
47
|
-
/**
|
48
|
-
* Adds an {@link EmailComponent} to the setting.
|
49
|
-
*
|
50
|
-
* @param cb - The callback to call with the component.
|
51
|
-
* @returns The setting instance.
|
52
|
-
*/
|
53
|
-
addEmail(cb: (component: EmailComponent) => void): this;
|
54
|
-
/**
|
55
|
-
* Adds a {@link FileComponent} to the setting.
|
56
|
-
*
|
57
|
-
* @param cb - The callback to call with the component.
|
58
|
-
* @returns The setting instance.
|
59
|
-
*/
|
60
|
-
addFile(cb: (component: FileComponent) => void): this;
|
61
|
-
/**
|
62
|
-
* Adds a {@link MonthComponent} to the setting.
|
63
|
-
*
|
64
|
-
* @param cb - The callback to call with the component.
|
65
|
-
* @returns The setting instance.
|
66
|
-
*/
|
67
|
-
addMonth(cb: (component: MonthComponent) => void): this;
|
68
|
-
/**
|
69
|
-
* Adds a {@link MultipleDropdownComponent} to the setting.
|
70
|
-
*
|
71
|
-
* @param cb - The callback to call with the component.
|
72
|
-
* @returns The setting instance.
|
73
|
-
*/
|
74
|
-
addMultipleDropdown(cb: (component: MultipleDropdownComponent) => void): this;
|
75
|
-
/**
|
76
|
-
* Adds a {@link MultipleEmailComponent} to the setting.
|
77
|
-
*
|
78
|
-
* @param cb - The callback to call with the component.
|
79
|
-
* @returns The setting instance.
|
80
|
-
*/
|
81
|
-
addMultipleEmail(cb: (component: MultipleEmailComponent) => void): this;
|
82
|
-
/**
|
83
|
-
* Adds a {@link MultipleFileComponent} to the setting.
|
84
|
-
*
|
85
|
-
* @param cb - The callback to call with the component.
|
86
|
-
* @returns The setting instance.
|
87
|
-
*/
|
88
|
-
addMultipleFile(cb: (component: MultipleFileComponent) => void): this;
|
89
|
-
/**
|
90
|
-
* Adds a {@link MultipleTextComponent} to the setting.
|
91
|
-
*
|
92
|
-
* @param cb - The callback to call with the component.
|
93
|
-
* @returns The setting instance.
|
94
|
-
*/
|
95
|
-
addMultipleText(cb: (component: MultipleTextComponent) => void): this;
|
96
|
-
/**
|
97
|
-
* Adds a {@link NumberComponent} to the setting.
|
98
|
-
*
|
99
|
-
* @param cb - The callback to call with the component.
|
100
|
-
* @returns The setting instance.
|
101
|
-
*/
|
102
|
-
addNumber(cb: (component: NumberComponent) => void): this;
|
103
|
-
/**
|
104
|
-
* Adds a {@link TimeComponent} to the setting.
|
105
|
-
*
|
106
|
-
* @param cb - The callback to call with the component.
|
107
|
-
* @returns The setting instance.
|
108
|
-
*/
|
109
|
-
addTime(cb: (component: TimeComponent) => void): this;
|
110
|
-
/**
|
111
|
-
* Adds an {@link UrlComponent} to the setting.
|
112
|
-
*
|
113
|
-
* @param cb - The callback to call with the component.
|
114
|
-
* @returns The setting instance.
|
115
|
-
*/
|
116
|
-
addUrl(cb: (component: UrlComponent) => void): this;
|
117
|
-
/**
|
118
|
-
* Adds a {@link WeekComponent} to the setting.
|
119
|
-
*
|
120
|
-
* @param cb - The callback to call with the component.
|
121
|
-
* @returns The setting instance.
|
122
|
-
*/
|
123
|
-
addWeek(cb: (component: WeekComponent) => void): this;
|
124
|
-
}
|
1
|
+
export * from './SettingEx.cjs';
|
@@ -1,130 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation Vault
|
3
|
-
* This module provides utility functions for working with the Obsidian Vault.
|
4
|
-
*/
|
5
|
-
import type { ListedFiles } from 'obsidian';
|
6
|
-
import { App, TFile } from 'obsidian';
|
7
|
-
import type { RetryOptions } from '../Async.mjs';
|
8
|
-
import type { ValueProvider } from '../ValueProvider.mjs';
|
9
|
-
import type { PathOrFile, PathOrFolder } from './FileSystem.mjs';
|
10
|
-
/**
|
11
|
-
* Options for the `process` function.
|
12
|
-
*/
|
13
|
-
export interface ProcessOptions extends RetryOptions {
|
14
|
-
/**
|
15
|
-
* If `true`, the function will throw an error if the file is missing or deleted.
|
16
|
-
*/
|
17
|
-
shouldFailOnMissingFile?: boolean;
|
18
|
-
}
|
19
|
-
/**
|
20
|
-
* Copies a file safely in the vault.
|
21
|
-
*
|
22
|
-
* @param app - The application instance.
|
23
|
-
* @param oldPathOrFile - The old path or file to copy.
|
24
|
-
* @param newPath - The new path to copy the file to.
|
25
|
-
* @returns A promise that resolves to the new path of the copied file.
|
26
|
-
*/
|
27
|
-
export declare function copySafe(app: App, oldPathOrFile: PathOrFile, newPath: string): Promise<string>;
|
28
|
-
/**
|
29
|
-
* Creates a folder safely in the specified path.
|
30
|
-
*
|
31
|
-
* @param app - The application instance.
|
32
|
-
* @param path - The path of the folder to create.
|
33
|
-
* @returns A promise that resolves to a boolean indicating whether the folder was created.
|
34
|
-
* @throws If an error occurs while creating the folder and it still doesn't exist.
|
35
|
-
*/
|
36
|
-
export declare function createFolderSafe(app: App, path: string): Promise<boolean>;
|
37
|
-
/**
|
38
|
-
* Creates a temporary file in the vault with parent folders if needed.
|
39
|
-
* @param app - The application instance.
|
40
|
-
* @param path - The path of the file to create.
|
41
|
-
* @returns A promise that resolves to a function that can be called to delete the temporary file and all its created parents.
|
42
|
-
*/
|
43
|
-
export declare function createTempFile(app: App, path: string): Promise<() => Promise<void>>;
|
44
|
-
/**
|
45
|
-
* Creates a temporary folder in the vault with parent folders if needed.
|
46
|
-
* @param app - The application instance.
|
47
|
-
* @param path - The path of the folder to create.
|
48
|
-
* @returns A promise that resolves to a function that can be called to delete the temporary folder and all its created parents.
|
49
|
-
*/
|
50
|
-
export declare function createTempFolder(app: App, path: string): Promise<() => Promise<void>>;
|
51
|
-
/**
|
52
|
-
* Gets an available path for a file in the vault.
|
53
|
-
*
|
54
|
-
* @param app - The application instance.
|
55
|
-
* @param path - The path of the file to get an available path for.
|
56
|
-
* @returns The available path for the file.
|
57
|
-
*/
|
58
|
-
export declare function getAvailablePath(app: App, path: string): string;
|
59
|
-
/**
|
60
|
-
* Retrieves an array of Markdown files from the app's vault and sorts them alphabetically by their file path.
|
61
|
-
*
|
62
|
-
* @param app - The Obsidian app instance.
|
63
|
-
* @returns An array of Markdown files sorted by file path.
|
64
|
-
*/
|
65
|
-
export declare function getMarkdownFilesSorted(app: App): TFile[];
|
66
|
-
/**
|
67
|
-
* Retrieves an array of all note files from the app's vault and sorts them alphabetically by their file path.
|
68
|
-
* @param app - The Obsidian app instance.
|
69
|
-
* @returns An array of all note files in the vault sorted by file path.
|
70
|
-
*/
|
71
|
-
export declare function getNoteFilesSorted(app: App): TFile[];
|
72
|
-
/**
|
73
|
-
* Gets a safe rename path for a file.
|
74
|
-
*
|
75
|
-
* @param app - The application instance.
|
76
|
-
* @param oldPathOrFile - The old path or file to rename.
|
77
|
-
* @param newPath - The new path to rename the file to.
|
78
|
-
* @returns The safe rename path for the file.
|
79
|
-
*/
|
80
|
-
export declare function getSafeRenamePath(app: App, oldPathOrFile: PathOrFile, newPath: string): string;
|
81
|
-
/**
|
82
|
-
* Checks if a folder is empty.
|
83
|
-
* @param app - The application instance.
|
84
|
-
* @param pathOrFolder - The path or folder to check.
|
85
|
-
* @returns A promise that resolves to a boolean indicating whether the folder is empty.
|
86
|
-
*/
|
87
|
-
export declare function isEmptyFolder(app: App, pathOrFolder: PathOrFolder): Promise<boolean>;
|
88
|
-
/**
|
89
|
-
* Safely lists the files and folders at the specified path in the vault.
|
90
|
-
*
|
91
|
-
* @param app - The Obsidian application instance.
|
92
|
-
* @param pathOrFolder - The path or folder to list.
|
93
|
-
* @returns A promise that resolves to a `ListedFiles` object containing the listed files and folders.
|
94
|
-
*/
|
95
|
-
export declare function listSafe(app: App, pathOrFolder: PathOrFolder): Promise<ListedFiles>;
|
96
|
-
/**
|
97
|
-
* Processes a file with retry logic, updating its content based on a provided value or function.
|
98
|
-
*
|
99
|
-
* @param app - The application instance, typically used for accessing the vault.
|
100
|
-
* @param pathOrFile - The path or file to be processed. It can be a string representing the path or a file object.
|
101
|
-
* @param newContentProvider - A value provider that returns the new content based on the old content of the file.
|
102
|
-
* It can be a string or a function that takes the old content as an argument and returns the new content.
|
103
|
-
* If function is provided, it should return `null` if the process should be retried.
|
104
|
-
* @param options - Optional options for processing/retrying the operation.
|
105
|
-
*
|
106
|
-
* @returns A promise that resolves once the process is complete.
|
107
|
-
*
|
108
|
-
* @throws Will throw an error if the process fails after the specified number of retries or timeout.
|
109
|
-
*/
|
110
|
-
export declare function process(app: App, pathOrFile: PathOrFile, newContentProvider: ValueProvider<null | string, [string]>, options?: ProcessOptions): Promise<void>;
|
111
|
-
/**
|
112
|
-
* Reads the content of a file safely from the vault.
|
113
|
-
*
|
114
|
-
* It covers the case when the file was removed during the reading.
|
115
|
-
*
|
116
|
-
* @param app - The application instance.
|
117
|
-
* @param pathOrFile - The path or file to read.
|
118
|
-
* @returns A promise that resolves to the content of the file or `null` if the file is missing or deleted.
|
119
|
-
*/
|
120
|
-
export declare function readSafe(app: App, pathOrFile: PathOrFile): Promise<null | string>;
|
121
|
-
/**
|
122
|
-
* Renames a file safely in the vault.
|
123
|
-
* If the new path already exists, the file will be renamed to an available path.
|
124
|
-
*
|
125
|
-
* @param app - The application instance.
|
126
|
-
* @param oldPathOrFile - The old path or file to rename.
|
127
|
-
* @param newPath - The new path to rename the file to.
|
128
|
-
* @returns A promise that resolves to the new path of the file.
|
129
|
-
*/
|
130
|
-
export declare function renameSafe(app: App, oldPathOrFile: PathOrFile, newPath: string): Promise<string>;
|
1
|
+
export * from './Vault.cjs';
|
@@ -1,27 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation VaultEx
|
3
|
-
* This module provides additional utilities for working with the Obsidian Vault.
|
4
|
-
*
|
5
|
-
* It has to be extracted from `Vault` because of circular dependencies.
|
6
|
-
*/
|
7
|
-
import type { App } from 'obsidian';
|
8
|
-
import type { PathOrAbstractFile, PathOrFolder } from './FileSystem.mjs';
|
9
|
-
/**
|
10
|
-
* Removes empty folder hierarchy starting from the given folder.
|
11
|
-
*
|
12
|
-
* @param app - The application instance.
|
13
|
-
* @param pathOrFolder - The folder to start removing empty hierarchy from.
|
14
|
-
* @returns A promise that resolves when the empty hierarchy is deleted.
|
15
|
-
*/
|
16
|
-
export declare function deleteEmptyFolderHierarchy(app: App, pathOrFolder: null | PathOrFolder): Promise<void>;
|
17
|
-
/**
|
18
|
-
* Deletes abstract file safely from the vault.
|
19
|
-
*
|
20
|
-
* @param app - The Obsidian application instance.
|
21
|
-
* @param pathOrFile - The path or abstract file to delete.
|
22
|
-
* @param deletedNotePath - Optional. The path of the note that triggered the removal.
|
23
|
-
* @param shouldReportUsedAttachments - Optional. If `true`, a notice will be shown for each attachment that is still used by other notes.
|
24
|
-
* @param shouldDeleteEmptyFolders - Optional. If `true`, empty folders will be deleted.
|
25
|
-
* @returns A promise that resolves to a boolean indicating whether the removal was successful.
|
26
|
-
*/
|
27
|
-
export declare function deleteSafe(app: App, pathOrFile: PathOrAbstractFile, deletedNotePath?: string, shouldReportUsedAttachments?: boolean, shouldDeleteEmptyFolders?: boolean): Promise<boolean>;
|
1
|
+
export * from './VaultEx.cjs';
|
@@ -1,29 +1 @@
|
|
1
|
-
export *
|
2
|
-
export * as AttachmentPath from './AttachmentPath.mjs';
|
3
|
-
export * as Backlink from './Backlink.mjs';
|
4
|
-
export * as Callout from './Callout.mjs';
|
5
|
-
export * as Components from './Components/index.mjs';
|
6
|
-
export * as Dataview from './Dataview.mjs';
|
7
|
-
export * as DataviewLink from './DataviewLink.mjs';
|
8
|
-
export * as FileChange from './FileChange.mjs';
|
9
|
-
export * as FileManager from './FileManager.mjs';
|
10
|
-
export * as FileSystem from './FileSystem.mjs';
|
11
|
-
export * as Frontmatter from './Frontmatter.mjs';
|
12
|
-
export * as Link from './Link.mjs';
|
13
|
-
export * as Logger from './Logger.mjs';
|
14
|
-
export * as Loop from './Loop.mjs';
|
15
|
-
export * as Markdown from './Markdown.mjs';
|
16
|
-
export * as MarkdownCodeBlockProcessor from './MarkdownCodeBlockProcessor.mjs';
|
17
|
-
export * as MarkdownView from './MarkdownView.mjs';
|
18
|
-
export * as MetadataCache from './MetadataCache.mjs';
|
19
|
-
export * as Modals from './Modals/index.mjs';
|
20
|
-
export * as ObsidianSettings from './ObsidianSettings.mjs';
|
21
|
-
export * as Pdf from './Pdf.mjs';
|
22
|
-
export * as Plugin from './Plugin/index.mjs';
|
23
|
-
export * as Queue from './Queue.mjs';
|
24
|
-
export * as Reference from './Reference.mjs';
|
25
|
-
export * as RenameDeleteHandler from './RenameDeleteHandler.mjs';
|
26
|
-
export * as ResourceUrl from './ResourceUrl.mjs';
|
27
|
-
export * as SettingEx from './SettingEx.mjs';
|
28
|
-
export * as Vault from './Vault.mjs';
|
29
|
-
export * as VaultEx from './VaultEx.mjs';
|
1
|
+
export * from './index.cjs';
|
package/dist/lib/url.d.mts
CHANGED
@@ -1,11 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation url
|
3
|
-
* Contains a utility function for validating URLs.
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* Determines whether a given string is a valid URL
|
7
|
-
*
|
8
|
-
* @param str - The string to validate as a URL.
|
9
|
-
* @returns `true` if the string is a valid URL, otherwise `false`.
|
10
|
-
*/
|
11
|
-
export declare function isUrl(str: string): boolean;
|
1
|
+
export * from './url.cjs';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "obsidian-dev-utils",
|
3
|
-
"version": "19.0.
|
3
|
+
"version": "19.0.1",
|
4
4
|
"description": "This is the collection of useful functions that you can use for your Obsidian plugin development",
|
5
5
|
"keywords": [
|
6
6
|
"obsidian"
|
@@ -341,8 +341,8 @@
|
|
341
341
|
"@types/path-browserify": "^1.0.3",
|
342
342
|
"@types/pug": "^2.0.10",
|
343
343
|
"@types/shell-quote": "^1.7.5",
|
344
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
345
|
-
"@typescript-eslint/parser": "^8.
|
344
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
345
|
+
"@typescript-eslint/parser": "^8.24.0",
|
346
346
|
"better-typescript-lib": "^2.10.1",
|
347
347
|
"commander": "^13.1.0",
|
348
348
|
"compare-versions": "^6.1.1",
|
@@ -354,7 +354,7 @@
|
|
354
354
|
"esbuild": "^0.25.0",
|
355
355
|
"esbuild-sass-plugin": "^3.3.1",
|
356
356
|
"esbuild-svelte": "^0.9.0",
|
357
|
-
"eslint": "^9.20.
|
357
|
+
"eslint": "^9.20.1",
|
358
358
|
"eslint-import-resolver-typescript": "^3.7.0",
|
359
359
|
"eslint-plugin-import-x": "^4.6.1",
|
360
360
|
"eslint-plugin-modules-newlines": "^0.0.7",
|
@@ -369,9 +369,9 @@
|
|
369
369
|
"monkey-around": "^3.0.0",
|
370
370
|
"npm-run-all": "^4.1.5",
|
371
371
|
"obsidian": "^1.7.2",
|
372
|
-
"obsidian-typings": "^2.
|
372
|
+
"obsidian-typings": "^2.21.3",
|
373
373
|
"path-browserify": "^1.0.1",
|
374
|
-
"postcss": "^8.5.
|
374
|
+
"postcss": "^8.5.2",
|
375
375
|
"postcss-modules": "^6.0.1",
|
376
376
|
"preact": "^10.25.4",
|
377
377
|
"remark": "^15.0.1",
|
@@ -384,6 +384,6 @@
|
|
384
384
|
"tsx": "^4.19.2",
|
385
385
|
"type-fest": "^4.34.1",
|
386
386
|
"typescript": "^5.7.3",
|
387
|
-
"typescript-eslint": "^8.
|
387
|
+
"typescript-eslint": "^8.24.0"
|
388
388
|
}
|
389
389
|
}
|