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.
Files changed (173) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +0 -3
  3. package/dist/lib/@types/debug.d.mts +1 -16
  4. package/dist/lib/Async.d.mts +1 -153
  5. package/dist/lib/Blob.d.mts +1 -40
  6. package/dist/lib/CssClass.d.mts +1 -97
  7. package/dist/lib/Debug.d.mts +1 -41
  8. package/dist/lib/DebugController.d.mts +1 -85
  9. package/dist/lib/Enum.d.mts +1 -20
  10. package/dist/lib/Error.d.mts +1 -45
  11. package/dist/lib/Function.d.mts +1 -28
  12. package/dist/lib/HTMLElement.d.mts +1 -49
  13. package/dist/lib/Library.cjs +1 -1
  14. package/dist/lib/Library.d.mts +1 -16
  15. package/dist/lib/Library.mjs +1 -1
  16. package/dist/lib/Object.d.mts +1 -211
  17. package/dist/lib/Path.d.mts +1 -133
  18. package/dist/lib/RegExp.d.mts +1 -18
  19. package/dist/lib/ScriptUtils/CliUtils.d.mts +1 -70
  20. package/dist/lib/ScriptUtils/CodeGenerator.d.mts +1 -12
  21. package/dist/lib/ScriptUtils/ESLint/@types/@guardian__eslint-plugin-tsdoc-required.d.mts +1 -13
  22. package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-modules-newlines.d.mts +1 -13
  23. package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-verify-tsdoc.d.mts +1 -13
  24. package/dist/lib/ScriptUtils/ESLint/ESLint.d.mts +1 -13
  25. package/dist/lib/ScriptUtils/ESLint/eslint.config.d.mts +1 -16
  26. package/dist/lib/ScriptUtils/ESLint/index.d.mts +1 -2
  27. package/dist/lib/ScriptUtils/Exec.d.mts +1 -83
  28. package/dist/lib/ScriptUtils/Fs.d.mts +1 -72
  29. package/dist/lib/ScriptUtils/JSON.d.mts +1 -64
  30. package/dist/lib/ScriptUtils/NodeModules.d.mts +1 -14
  31. package/dist/lib/ScriptUtils/Npm.d.mts +1 -151
  32. package/dist/lib/ScriptUtils/NpmPublish.d.mts +1 -9
  33. package/dist/lib/ScriptUtils/ObsidianDevUtilsRepoPaths.d.mts +1 -88
  34. package/dist/lib/ScriptUtils/Root.d.mts +1 -67
  35. package/dist/lib/ScriptUtils/build.d.mts +1 -41
  36. package/dist/lib/ScriptUtils/cli.d.mts +1 -14
  37. package/dist/lib/ScriptUtils/esbuild/Dependency.d.mts +1 -18
  38. package/dist/lib/ScriptUtils/esbuild/ObsidianPluginBuilder.d.mts +1 -53
  39. package/dist/lib/ScriptUtils/esbuild/changeExtensionPlugin.d.mts +1 -12
  40. package/dist/lib/ScriptUtils/esbuild/copyToObsidianPluginsFolderPlugin.d.mts +1 -18
  41. package/dist/lib/ScriptUtils/esbuild/fixEsmPlugin.d.mts +1 -11
  42. package/dist/lib/ScriptUtils/esbuild/fixSourceMapsPlugin.d.mts +1 -17
  43. package/dist/lib/ScriptUtils/esbuild/index.d.mts +1 -9
  44. package/dist/lib/ScriptUtils/esbuild/preprocessPlugin.d.mts +1 -23
  45. package/dist/lib/ScriptUtils/esbuild/renameCssPlugin.d.mts +1 -8
  46. package/dist/lib/ScriptUtils/esbuild/svelteWrapperPlugin.d.mts +1 -8
  47. package/dist/lib/ScriptUtils/format.d.mts +1 -10
  48. package/dist/lib/ScriptUtils/index.d.mts +1 -17
  49. package/dist/lib/ScriptUtils/spellcheck.d.mts +1 -14
  50. package/dist/lib/ScriptUtils/version.d.mts +1 -171
  51. package/dist/lib/String.d.mts +1 -138
  52. package/dist/lib/Transformers/DateTransformer.d.mts +1 -35
  53. package/dist/lib/Transformers/DurationTransformer.d.mts +1 -34
  54. package/dist/lib/Transformers/GroupTransformer.d.mts +1 -65
  55. package/dist/lib/Transformers/SkipPrivatePropertyTransformer.d.mts +1 -32
  56. package/dist/lib/Transformers/Transformer.d.mts +1 -67
  57. package/dist/lib/Transformers/TypedTransformer.d.mts +1 -37
  58. package/dist/lib/Transformers/index.d.mts +1 -6
  59. package/dist/lib/ValueProvider.d.mts +1 -22
  60. package/dist/lib/codemirror/StateFieldSpec.d.mts +1 -68
  61. package/dist/lib/codemirror/index.d.mts +1 -1
  62. package/dist/lib/index.d.mts +1 -20
  63. package/dist/lib/obsidian/@types/Dataview/api/data-array.d.mts +1 -136
  64. package/dist/lib/obsidian/@types/Dataview/api/extensions.d.mts +1 -15
  65. package/dist/lib/obsidian/@types/Dataview/api/inline-api.d.mts +1 -186
  66. package/dist/lib/obsidian/@types/Dataview/api/plugin-api.d.mts +1 -209
  67. package/dist/lib/obsidian/@types/Dataview/api/result.d.mts +1 -38
  68. package/dist/lib/obsidian/@types/Dataview/data-import/common.d.mts +1 -3
  69. package/dist/lib/obsidian/@types/Dataview/data-import/csv.d.mts +1 -3
  70. package/dist/lib/obsidian/@types/Dataview/data-import/inline-field.d.mts +1 -42
  71. package/dist/lib/obsidian/@types/Dataview/data-import/markdown-file.d.mts +1 -52
  72. package/dist/lib/obsidian/@types/Dataview/data-import/persister.d.mts +1 -32
  73. package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-entry.d.mts +1 -1
  74. package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-impl.d.mts +1 -6
  75. package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-manager.d.mts +1 -37
  76. package/dist/lib/obsidian/@types/Dataview/data-index/index.d.mts +1 -186
  77. package/dist/lib/obsidian/@types/Dataview/data-index/resolver.d.mts +1 -23
  78. package/dist/lib/obsidian/@types/Dataview/data-index/source.d.mts +1 -71
  79. package/dist/lib/obsidian/@types/Dataview/data-model/markdown.d.mts +1 -115
  80. package/dist/lib/obsidian/@types/Dataview/data-model/serialized/markdown.d.mts +1 -106
  81. package/dist/lib/obsidian/@types/Dataview/data-model/transferable.d.mts +1 -7
  82. package/dist/lib/obsidian/@types/Dataview/data-model/value.d.mts +1 -175
  83. package/dist/lib/obsidian/@types/Dataview/expression/binaryop.d.mts +1 -43
  84. package/dist/lib/obsidian/@types/Dataview/expression/context.d.mts +1 -49
  85. package/dist/lib/obsidian/@types/Dataview/expression/field.d.mts +1 -82
  86. package/dist/lib/obsidian/@types/Dataview/expression/functions.d.mts +1 -149
  87. package/dist/lib/obsidian/@types/Dataview/expression/parse.d.mts +1 -163
  88. package/dist/lib/obsidian/@types/Dataview/index.d.mts +1 -55
  89. package/dist/lib/obsidian/@types/Dataview/main.d.mts +1 -52
  90. package/dist/lib/obsidian/@types/Dataview/query/engine.d.mts +1 -103
  91. package/dist/lib/obsidian/@types/Dataview/query/parse.d.mts +1 -44
  92. package/dist/lib/obsidian/@types/Dataview/query/query.d.mts +1 -95
  93. package/dist/lib/obsidian/@types/Dataview/settings.d.mts +1 -60
  94. package/dist/lib/obsidian/@types/Dataview/typings/obsidian-ex.d.mts +1 -28
  95. package/dist/lib/obsidian/@types/Dataview/typings/workers.d.mts +1 -4
  96. package/dist/lib/obsidian/@types/Dataview/ui/export/markdown.d.mts +1 -15
  97. package/dist/lib/obsidian/@types/Dataview/ui/lp-render.d.mts +1 -37
  98. package/dist/lib/obsidian/@types/Dataview/ui/markdown.d.mts +1 -86
  99. package/dist/lib/obsidian/@types/Dataview/ui/refreshable-view.d.mts +1 -18
  100. package/dist/lib/obsidian/@types/Dataview/ui/render.d.mts +1 -33
  101. package/dist/lib/obsidian/@types/Dataview/ui/views/calendar-view.d.mts +1 -17
  102. package/dist/lib/obsidian/@types/Dataview/ui/views/inline-field-live-preview.d.mts +1 -42
  103. package/dist/lib/obsidian/@types/Dataview/ui/views/inline-view.d.mts +1 -28
  104. package/dist/lib/obsidian/@types/Dataview/ui/views/js-view.d.mts +1 -23
  105. package/dist/lib/obsidian/@types/Dataview/ui/views/list-view.d.mts +1 -25
  106. package/dist/lib/obsidian/@types/Dataview/ui/views/table-view.d.mts +1 -28
  107. package/dist/lib/obsidian/@types/Dataview/ui/views/task-view.d.mts +1 -51
  108. package/dist/lib/obsidian/@types/Dataview/util/hash.d.mts +1 -1
  109. package/dist/lib/obsidian/@types/Dataview/util/locale.d.mts +1 -2
  110. package/dist/lib/obsidian/@types/Dataview/util/media.d.mts +1 -6
  111. package/dist/lib/obsidian/@types/Dataview/util/normalize.d.mts +1 -44
  112. package/dist/lib/obsidian/App.d.mts +1 -30
  113. package/dist/lib/obsidian/AttachmentPath.d.mts +1 -54
  114. package/dist/lib/obsidian/Backlink.d.mts +1 -60
  115. package/dist/lib/obsidian/Callout.d.mts +1 -55
  116. package/dist/lib/obsidian/Components/DateComponent.d.mts +1 -36
  117. package/dist/lib/obsidian/Components/DateTimeComponent.d.mts +1 -36
  118. package/dist/lib/obsidian/Components/EmailComponent.d.mts +1 -29
  119. package/dist/lib/obsidian/Components/FileComponent.d.mts +1 -41
  120. package/dist/lib/obsidian/Components/MonthComponent.d.mts +1 -49
  121. package/dist/lib/obsidian/Components/MultipleDropdownComponent.d.mts +1 -73
  122. package/dist/lib/obsidian/Components/MultipleEmailComponent.d.mts +1 -36
  123. package/dist/lib/obsidian/Components/MultipleFileComponent.d.mts +1 -41
  124. package/dist/lib/obsidian/Components/MultipleTextComponent.d.mts +1 -67
  125. package/dist/lib/obsidian/Components/NumberComponent.d.mts +1 -29
  126. package/dist/lib/obsidian/Components/TimeComponent.d.mts +1 -37
  127. package/dist/lib/obsidian/Components/TypedRangeTextComponent.d.mts +1 -31
  128. package/dist/lib/obsidian/Components/TypedTextComponent.d.mts +1 -84
  129. package/dist/lib/obsidian/Components/UrlComponent.d.mts +1 -29
  130. package/dist/lib/obsidian/Components/ValidatorComponent.d.mts +1 -22
  131. package/dist/lib/obsidian/Components/ValueComponentWithChangeTracking.d.mts +1 -17
  132. package/dist/lib/obsidian/Components/WeekComponent.d.mts +1 -49
  133. package/dist/lib/obsidian/Components/index.d.mts +1 -17
  134. package/dist/lib/obsidian/Dataview.d.mts +1 -215
  135. package/dist/lib/obsidian/DataviewLink.d.mts +1 -23
  136. package/dist/lib/obsidian/FileChange.d.mts +1 -68
  137. package/dist/lib/obsidian/FileManager.d.mts +1 -38
  138. package/dist/lib/obsidian/FileSystem.d.mts +1 -185
  139. package/dist/lib/obsidian/Frontmatter.d.mts +1 -69
  140. package/dist/lib/obsidian/Link.d.mts +1 -366
  141. package/dist/lib/obsidian/Logger.d.mts +1 -13
  142. package/dist/lib/obsidian/Loop.d.mts +1 -36
  143. package/dist/lib/obsidian/Markdown.d.mts +1 -24
  144. package/dist/lib/obsidian/MarkdownCodeBlockProcessor.d.mts +1 -23
  145. package/dist/lib/obsidian/MarkdownView.d.mts +1 -12
  146. package/dist/lib/obsidian/MetadataCache.d.mts +1 -87
  147. package/dist/lib/obsidian/Modals/Alert.d.mts +1 -39
  148. package/dist/lib/obsidian/Modals/Confirm.d.mts +1 -43
  149. package/dist/lib/obsidian/Modals/ModalBase.d.mts +1 -35
  150. package/dist/lib/obsidian/Modals/Prompt.d.mts +1 -50
  151. package/dist/lib/obsidian/Modals/SelectItem.d.mts +1 -41
  152. package/dist/lib/obsidian/Modals/index.d.mts +1 -5
  153. package/dist/lib/obsidian/ObsidianSettings.d.mts +1 -17
  154. package/dist/lib/obsidian/Pdf.d.mts +1 -24
  155. package/dist/lib/obsidian/Plugin/EmptySettings.d.mts +1 -14
  156. package/dist/lib/obsidian/Plugin/ObsidianPluginRepoPaths.d.mts +1 -55
  157. package/dist/lib/obsidian/Plugin/Plugin.d.mts +1 -21
  158. package/dist/lib/obsidian/Plugin/PluginBase.d.mts +1 -108
  159. package/dist/lib/obsidian/Plugin/PluginContext.d.mts +1 -12
  160. package/dist/lib/obsidian/Plugin/PluginId.d.mts +1 -20
  161. package/dist/lib/obsidian/Plugin/PluginSettingsBase.d.mts +1 -31
  162. package/dist/lib/obsidian/Plugin/PluginSettingsTabBase.d.mts +1 -99
  163. package/dist/lib/obsidian/Plugin/index.d.mts +1 -8
  164. package/dist/lib/obsidian/Queue.d.mts +1 -30
  165. package/dist/lib/obsidian/Reference.d.mts +1 -21
  166. package/dist/lib/obsidian/RenameDeleteHandler.d.mts +1 -49
  167. package/dist/lib/obsidian/ResourceUrl.d.mts +1 -14
  168. package/dist/lib/obsidian/SettingEx.d.mts +1 -124
  169. package/dist/lib/obsidian/Vault.d.mts +1 -130
  170. package/dist/lib/obsidian/VaultEx.d.mts +1 -27
  171. package/dist/lib/obsidian/index.d.mts +1 -29
  172. package/dist/lib/url.d.mts +1 -11
  173. package/package.json +7 -7
@@ -1,23 +1 @@
1
- /**
2
- * @packageDocumentation MarkdownCodeBlockProcessor
3
- * This module provides utility functions for processing code blocks in Obsidian.
4
- */
5
- import type { App, MarkdownPostProcessorContext } from 'obsidian';
6
- import type { ValueProvider } from '../ValueProvider.mjs';
7
- /**
8
- * Retrieves the argument of a code block from the given MarkdownPostProcessorContext and HTMLElement.
9
- *
10
- * @param ctx - The MarkdownPostProcessorContext object.
11
- * @param el - The HTMLElement representing the code block.
12
- * @returns The argument of the code block as a string, or null if no argument is found.
13
- */
14
- export declare function getCodeBlockArguments(ctx: MarkdownPostProcessorContext, el: HTMLElement): string[];
15
- /**
16
- * Replaces the code block.
17
- *
18
- * @param app - The Obsidian App object.
19
- * @param ctx - The MarkdownPostProcessorContext object.
20
- * @param el - The HTMLElement representing the code block.
21
- * @param codeBlockProvider - The ValueProvider that provides the new code block.
22
- */
23
- export declare function replaceCodeBlock(app: App, ctx: MarkdownPostProcessorContext, el: HTMLElement, codeBlockProvider: ValueProvider<string, [string]>): Promise<void>;
1
+ export * from './MarkdownCodeBlockProcessor.cjs';
@@ -1,12 +1 @@
1
- /**
2
- * @packageDocumentation MarkdownView
3
- * Utilities for working with MarkdownView
4
- */
5
- import { MarkdownView } from 'obsidian';
6
- /**
7
- * Get the full HTML content of the current MarkdownView
8
- *
9
- * @param view - The MarkdownView to get the HTML from
10
- * @returns The full HTML of the MarkdownView
11
- */
12
- export declare function getFullContentHtml(view: MarkdownView): string;
1
+ export * from './MarkdownView.cjs';
@@ -1,87 +1 @@
1
- /**
2
- * @packageDocumentation MetadataCache
3
- * This module provides utility functions for working with the metadata cache in Obsidian.
4
- */
5
- import type { App, CachedMetadata, Reference, TAbstractFile } from 'obsidian';
6
- import type { CustomArrayDict } from 'obsidian-typings';
7
- import type { RetryOptions } from '../Async.mjs';
8
- import type { PathOrFile } from './FileSystem.mjs';
9
- import type { CombinedFrontmatter } from './Frontmatter.mjs';
10
- /**
11
- * Wrapper for the getBacklinksForFile method that provides a safe overload.
12
- */
13
- export interface GetBacklinksForFileSafeWrapper {
14
- /**
15
- * Retrieves the backlinks for a file safely.
16
- *
17
- * @param pathOrFile - The path or file object.
18
- * @returns A promise that resolves to an array dictionary of backlinks.
19
- */
20
- safe(pathOrFile: PathOrFile): Promise<CustomArrayDict<Reference>>;
21
- }
22
- /**
23
- * Ensures that the metadata cache is ready for all files.
24
- * @param app - The Obsidian app instance.
25
- * @returns A promise that resolves when the metadata cache is ready.
26
- */
27
- export declare function ensureMetadataCacheReady(app: App): Promise<void>;
28
- /**
29
- * Retrieves all links from the provided cache.
30
- *
31
- * @param cache - The cached metadata.
32
- * @returns An array of reference caches representing the links.
33
- */
34
- export declare function getAllLinks(cache: CachedMetadata): Reference[];
35
- /**
36
- * Retrieves the backlinks for a file or path.
37
- * NOTE: The file may be non-existent.
38
- *
39
- * @param app - The Obsidian application instance.
40
- * @param pathOrFile - The path or file object.
41
- * @returns The backlinks for the file.
42
- */
43
- export declare function getBacklinksForFileOrPath(app: App, pathOrFile: PathOrFile): CustomArrayDict<Reference>;
44
- /**
45
- * Retrieves the backlinks for a file safely.
46
- *
47
- * @param app - The Obsidian application instance.
48
- * @param pathOrFile - The path or file object.
49
- * @param retryOptions - Optional retry options.
50
- * @returns A promise that resolves to an array dictionary of backlinks.
51
- */
52
- export declare function getBacklinksForFileSafe(app: App, pathOrFile: PathOrFile, retryOptions?: RetryOptions): Promise<CustomArrayDict<Reference>>;
53
- /**
54
- * Retrieves the cached metadata for a given file or path.
55
- *
56
- * @param app - The Obsidian app instance.
57
- * @param fileOrPath - The file or path to retrieve the metadata for.
58
- * @param retryOptions - Optional retry options for the retrieval process.
59
- * @returns The cached metadata for the file, or null if it doesn't exist.
60
- */
61
- export declare function getCacheSafe(app: App, fileOrPath: PathOrFile, retryOptions?: RetryOptions): Promise<CachedMetadata | null>;
62
- /**
63
- * Retrieves the front matter from the metadata cache safely.
64
- *
65
- * @typeParam CustomFrontmatter - The type of custom front matter.
66
- * @param app - The Obsidian app instance.
67
- * @param pathOrFile - The path or file to retrieve the front matter from.
68
- * @returns The combined front matter.
69
- */
70
- export declare function getFrontmatterSafe<CustomFrontmatter = unknown>(app: App, pathOrFile: PathOrFile): Promise<CombinedFrontmatter<CustomFrontmatter>>;
71
- /***
72
- * Registers a file in the Obsidian app.
73
- *
74
- * @param app - The Obsidian app instance.
75
- * @param file - The file to register.
76
- * @returns A function that unregisters the file.
77
- */
78
- export declare function registerFile(app: App, file: TAbstractFile): () => void;
79
- /**
80
- * Temporarily registers a file and runs a function.
81
- *
82
- * @param app - The Obsidian app instance.
83
- * @param file - The file to temporarily register.
84
- * @param fn - The function to run.
85
- * @returns The result of the function.
86
- */
87
- export declare function tempRegisterFileAndRun<T>(app: App, file: TAbstractFile, fn: () => T): T;
1
+ export * from './MetadataCache.cjs';
@@ -1,39 +1 @@
1
- /**
2
- * @packageDocumentation Alert
3
- * Utility for displaying alert modals in Obsidian.
4
- *
5
- * This module exports a function to display a modal with a message in Obsidian. The modal includes an "OK" button to close it.
6
- */
7
- import type { App } from 'obsidian';
8
- /**
9
- * The options for the alert modal.
10
- */
11
- export interface AlertOptions {
12
- /**
13
- * The Obsidian app instance.
14
- */
15
- app: App;
16
- /**
17
- * The CSS class to apply to the modal.
18
- */
19
- cssClass?: string;
20
- /**
21
- * The message to display in the modal.
22
- */
23
- message: DocumentFragment | string;
24
- /**
25
- * The text for the "OK" button.
26
- */
27
- okButtonText?: string;
28
- /**
29
- * The title of the modal.
30
- */
31
- title?: DocumentFragment | string;
32
- }
33
- /**
34
- * Displays an alert modal in Obsidian with a specified message.
35
- *
36
- * @param options - The options for the alert modal.
37
- * @returns A promise that resolves when the modal is closed.
38
- */
39
- export declare function alert(options: AlertOptions): Promise<void>;
1
+ export * from './Alert.cjs';
@@ -1,43 +1 @@
1
- /**
2
- * @packageDocumentation Confirm
3
- * Utility for displaying confirm modals in Obsidian.
4
- *
5
- * This module exports a function to display a modal with a message in Obsidian. The modal includes "OK" and "Cancel" buttons to confirm or cancel the action.
6
- */
7
- import type { App } from 'obsidian';
8
- /**
9
- * The options for the confirm modal.
10
- */
11
- export interface ConfirmOptions {
12
- /**
13
- * The Obsidian app instance.
14
- */
15
- app: App;
16
- /**
17
- * The text for the "Cancel" button.
18
- */
19
- cancelButtonText?: string;
20
- /**
21
- * The CSS class to apply to the modal.
22
- */
23
- cssClass?: string;
24
- /**
25
- * The message to display in the modal.
26
- */
27
- message: DocumentFragment | string;
28
- /**
29
- * The text for the "OK" button.
30
- */
31
- okButtonText?: string;
32
- /**
33
- * The title of the modal.
34
- */
35
- title?: DocumentFragment | string;
36
- }
37
- /**
38
- * Displays an confirm modal in Obsidian with a specified message.
39
- *
40
- * @param options - The options for the confirm modal.
41
- * @returns A promise that resolves with a boolean indicating whether the "OK" button was clicked.
42
- */
43
- export declare function confirm(options: ConfirmOptions): Promise<boolean>;
1
+ export * from './Confirm.cjs';
@@ -1,35 +1 @@
1
- /**
2
- * @packageDocumentation ModalBase
3
- *
4
- * This module exports a base class for displaying modals in Obsidian.
5
- */
6
- import type { App } from 'obsidian';
7
- import { Modal } from 'obsidian';
8
- import type { PromiseResolve } from '../../Async.mjs';
9
- /**
10
- * The base options for a modal.
11
- */
12
- export interface ModalOptionsBase {
13
- /**
14
- * The application instance.
15
- */
16
- app: App;
17
- /**
18
- * The CSS class to apply to the modal.
19
- */
20
- cssClass?: string;
21
- }
22
- /**
23
- * A base class for displaying modals in Obsidian.
24
- */
25
- export declare abstract class ModalBase<Value, Options extends ModalOptionsBase> extends Modal {
26
- protected resolve: PromiseResolve<Value>;
27
- constructor(options: Options, resolve: PromiseResolve<Value>, modalCssClass: string);
28
- }
29
- /**
30
- * Displays a modal in Obsidian.
31
- *
32
- * @param modalCreator - A function that creates a modal.
33
- * @returns A promise that resolves when the modal is closed.
34
- */
35
- export declare function showModal<T>(modalCreator: (resolve: PromiseResolve<T>) => Modal): Promise<T>;
1
+ export * from './ModalBase.cjs';
@@ -1,50 +1 @@
1
- /**
2
- * @packageDocumentation Prompt
3
- * Utility for displaying a prompt modal in Obsidian.
4
- *
5
- * This module exports a function to display a modal that prompts the user for input. The modal includes "OK" and "Cancel" buttons.
6
- */
7
- import { App } from 'obsidian';
8
- import type { MaybePromise } from '../../Async.mjs';
9
- /**
10
- * The options for the prompt modal.
11
- */
12
- export interface PromptOptions {
13
- /**
14
- * The Obsidian app instance.
15
- */
16
- app: App;
17
- /**
18
- * The text for the "Cancel" button.
19
- */
20
- cancelButtonText?: string;
21
- /**
22
- * The default value to pre-fill the input field.
23
- */
24
- defaultValue?: string;
25
- /**
26
- * The text for the "OK" button.
27
- */
28
- okButtonText?: string;
29
- /**
30
- * The placeholder text for the input field.
31
- */
32
- placeholder?: string;
33
- /**
34
- * The title of the modal.
35
- */
36
- title?: DocumentFragment | string;
37
- /**
38
- * A function to validate the input value.
39
- * @param value - The input value to validate.
40
- * @returns an error message if the value is invalid, or null if the value is valid.
41
- */
42
- valueValidator?: (value: string) => MaybePromise<string | void>;
43
- }
44
- /**
45
- * Displays a prompt modal in Obsidian to get user input.
46
- *
47
- * @param options - The options for the prompt modal.
48
- * @returns A promise that resolves with the user input or null if the prompt was cancelled.
49
- */
50
- export declare function prompt(options: PromptOptions): Promise<null | string>;
1
+ export * from './Prompt.cjs';
@@ -1,41 +1 @@
1
- /**
2
- * @packageDocumentation selectItem
3
- * Utility for displaying a selection modal in Obsidian.
4
- *
5
- * This module exports a function to display a modal that allows the user to select an item from a list. The modal uses fuzzy search to help the user find the item.
6
- */
7
- import { App } from 'obsidian';
8
- /**
9
- * The parameters for the selection modal.
10
- */
11
- export interface SelectItemOptions<T> {
12
- /**
13
- * The Obsidian app instance.
14
- */
15
- app: App;
16
- /**
17
- * The CSS class to apply to the modal.
18
- */
19
- cssClass?: string;
20
- /**
21
- * The list of items to choose from.
22
- */
23
- items: T[];
24
- /**
25
- * A function to get the display text for each item
26
- * @param item - The item to get the display text for.
27
- * @returns The display text for the item.
28
- */
29
- itemTextFunc: (item: T) => string;
30
- /**
31
- * The placeholder text for the input field.
32
- */
33
- placeholder?: string;
34
- }
35
- /**
36
- * Displays a selection modal in Obsidian for choosing an item from a list.
37
- *
38
- * @param options - The options for the selection modal.
39
- * @returns A promise that resolves with the selected item or null if no item was selected.
40
- */
41
- export declare function selectItem<T>(options: SelectItemOptions<T>): Promise<null | T>;
1
+ export * from './SelectItem.cjs';
@@ -1,5 +1 @@
1
- export * as Alert from './Alert.mjs';
2
- export * as Confirm from './Confirm.mjs';
3
- export * as ModalBase from './ModalBase.mjs';
4
- export * as Prompt from './Prompt.mjs';
5
- export * as SelectItem from './SelectItem.mjs';
1
+ export * from './index.cjs';
@@ -1,17 +1 @@
1
- /**
2
- * @packageDocumentation
3
- * This module provides utility functions for working with Obsidian settings.
4
- */
5
- import type { App } from 'obsidian';
6
- /**
7
- * Retrieves whether to use relative links based on the Obsidian settings.
8
- * @param app - The Obsidian app instance.
9
- * @returns Whether to use relative links.
10
- */
11
- export declare function shouldUseRelativeLinks(app: App): boolean;
12
- /**
13
- * Retrieves whether to use wikilinks based on the Obsidian settings.
14
- * @param app - The Obsidian app instance.
15
- * @returns Whether to use wikilinks.
16
- */
17
- export declare function shouldUseWikilinks(app: App): boolean;
1
+ export * from './ObsidianSettings.cjs';
@@ -1,24 +1 @@
1
- /**
2
- * @packageDocumentation Pdf
3
- * Contains utility functions for printing to PDF.
4
- */
5
- interface PrintToPdfOptions {
6
- filepath: string;
7
- includeName: boolean;
8
- landscape: boolean;
9
- marginsType: number;
10
- open: boolean;
11
- pageSize: string;
12
- scale: number;
13
- scaleFactor: number;
14
- }
15
- /**
16
- * Print the given element to a PDF file.
17
- *
18
- * Works only on desktop.
19
- *
20
- * @param el - The element to print.
21
- * @param options - The options to use for the print.
22
- */
23
- export declare function printToPdf(el: HTMLElement, options: Partial<PrintToPdfOptions>): Promise<void>;
24
- export {};
1
+ export * from './Pdf.cjs';
@@ -1,14 +1 @@
1
- /**
2
- * @packageDocumentation EmptySettings
3
- * Empty settings class.
4
- */
5
- import { PluginSettingsBase } from './PluginSettingsBase.mjs';
6
- /**
7
- * @packageDocumentation EmptySettings
8
- * Empty settings class.
9
- */
10
- /**
11
- * Empty settings class.
12
- */
13
- export declare class EmptySettings extends PluginSettingsBase {
14
- }
1
+ export * from './EmptySettings.cjs';
@@ -1,55 +1 @@
1
- /**
2
- * @packageDocumentation ObsidianPluginRepoPaths
3
- * This file defines an enumeration for common file and directory paths used in Obsidian plugin development.
4
- */
5
- /**
6
- * Enumeration of commonly used file and directory paths in Obsidian plugin development.
7
- */
8
- export declare enum ObsidianPluginRepoPaths {
9
- /** Represents any path recursively. */
10
- AnyPath = "**",
11
- /** Represents any TypeScript file. */
12
- AnyTs = "*.ts",
13
- /** Represents the changelog file. */
14
- ChangelogMd = "CHANGELOG.md",
15
- /** Represents the distribution directory. */
16
- Dist = "dist",
17
- /** Represents the build directory within the distribution directory. */
18
- DistBuild = "dist/build",
19
- /** Represents the development directory within the distribution directory. */
20
- DistDev = "dist/dev",
21
- /** Represents the ESLint configuration file. */
22
- EslintConfigMjs = "eslint.config.mjs",
23
- /** Represents the hot reload file. */
24
- HotReload = ".hotreload",
25
- /** Represents the lib directory. */
26
- Lib = "lib",
27
- /** Represents the Library.cjs file. */
28
- LibraryCjs = "Library.cjs",
29
- /** Represents the Library.mjs file. */
30
- LibraryMjs = "Library.mjs",
31
- /** Represents the main CSS file. */
32
- MainCss = "main.css",
33
- /** Represents the main JavaScript file. */
34
- MainJs = "main.js",
35
- /** Represents the main TypeScript file. */
36
- MainTs = "main.ts",
37
- /** Represents the manifest file for beta releases. */
38
- ManifestBetaJson = "manifest-beta.json",
39
- /** Represents the manifest file. */
40
- ManifestJson = "manifest.json",
41
- /** Represents the npm-shrinkwrap.json file. */
42
- NpmShrinkwrapJson = "npm-shrinkwrap.json",
43
- /** Represents the package.json file. */
44
- PackageJson = "package.json",
45
- /** Represents the package-lock.json file. */
46
- PackageLockJson = "package-lock.json",
47
- /** Represents the source directory. */
48
- Src = "src",
49
- /** Represents the styles.css file. */
50
- StylesCss = "styles.css",
51
- /** Represents the TypeScript configuration file. */
52
- TsConfigJson = "tsconfig.json",
53
- /** Represents the versions.json file. */
54
- VersionsJson = "versions.json"
55
- }
1
+ export * from './ObsidianPluginRepoPaths.cjs';
@@ -1,21 +1 @@
1
- /**
2
- * @packageDocumentation Plugin
3
- * This module provides utility functions for managing Obsidian plugins,
4
- * including displaying error messages, disabling plugins, and reloading them.
5
- */
6
- import { Plugin } from 'obsidian';
7
- /**
8
- * Reloads the specified plugin by disabling and then re-enabling it.
9
- *
10
- * @param plugin - The plugin to reload.
11
- * @returns A promise that resolves when the plugin is reloaded.
12
- */
13
- export declare function reloadPlugin(plugin: Plugin): Promise<void>;
14
- /**
15
- * Displays an error message as a notice, logs it to the console, and disables the specified plugin.
16
- *
17
- * @param plugin - The plugin to disable.
18
- * @param message - The error message to display and log.
19
- * @returns A promise that resolves when the plugin is disabled.
20
- */
21
- export declare function showErrorAndDisablePlugin(plugin: Plugin, message: string): Promise<void>;
1
+ export * from './Plugin.cjs';
@@ -1,108 +1 @@
1
- /**
2
- * @packageDocumentation PluginBase
3
- * Base class for Obsidian plugins providing utility methods for settings management, error handling, and notifications.
4
- *
5
- * This class simplifies the process of managing plugin settings, displaying notifications, and handling errors.
6
- * Subclasses should implement methods to create default settings and settings tabs, and complete plugin-specific
7
- * loading tasks.
8
- */
9
- import type { ReadonlyDeep } from 'type-fest';
10
- import { Plugin, PluginSettingTab } from 'obsidian';
11
- import type { MaybePromise } from '../../Async.mjs';
12
- import type { EmptySettings } from './EmptySettings.mjs';
13
- import type { PluginSettingsBase } from './PluginSettingsBase.mjs';
14
- /**
15
- * Base class for creating Obsidian plugins with built-in support for settings management, error handling, and notifications.
16
- *
17
- * @typeParam PluginSettings - The type representing the plugin settings object.
18
- */
19
- export declare abstract class PluginBase<PluginSettings extends PluginSettingsBase = EmptySettings> extends Plugin {
20
- /**
21
- * Gets the AbortSignal used for aborting long-running operations.
22
- *
23
- * @returns The abort signal.
24
- */
25
- get abortSignal(): AbortSignal;
26
- /**
27
- * Gets the readonly plugin settings.
28
- *
29
- * @returns The readonly plugin settings.
30
- */
31
- get settings(): ReadonlyDeep<PluginSettings>;
32
- /**
33
- * Gets a writable copy of the plugin settings.
34
- *
35
- * @returns A writable copy of the plugin settings.
36
- */
37
- get settingsClone(): PluginSettings;
38
- private _abortSignal;
39
- private _settings;
40
- private notice?;
41
- /**
42
- * Logs a message to the console.
43
- *
44
- * Use instead of `console.debug()`.
45
- *
46
- * Those messages are not shown by default, but they can be shown by enabling `your-plugin-id` debugger namespace.
47
- *
48
- * @see {@link https://github.com/mnaoumov/obsidian-dev-utils/?tab=readme-ov-file#debugging} for more information.
49
- *
50
- * @param message - The message to log.
51
- * @param args - The arguments to log.
52
- */
53
- consoleDebug(message: string, ...args: unknown[]): void;
54
- /**
55
- * Called when the external settings change.
56
- */
57
- onExternalSettingsChange(): Promise<void>;
58
- /**
59
- * Called when the plugin is loaded
60
- */
61
- onload(): Promise<void>;
62
- /**
63
- * Saves the new plugin settings.
64
- *
65
- * @param newSettings - The new settings to save.
66
- * @returns A promise that resolves when the settings are saved.
67
- */
68
- saveSettings(newSettings: PluginSettings): Promise<void>;
69
- /**
70
- * Creates the plugin settings. This method must be implemented by subclasses.
71
- *
72
- * @param data - The data to create the plugin settings from.
73
- * @returns The plugin settings.
74
- */
75
- protected abstract createPluginSettings(data: unknown): PluginSettings;
76
- /**
77
- * Creates a plugin settings tab. This method must be implemented by subclasses.
78
- *
79
- * @returns The settings tab or null if not applicable.
80
- */
81
- protected abstract createPluginSettingsTab(): null | PluginSettingTab;
82
- /**
83
- * Called when the layout is ready. This method can be overridden by subclasses to perform actions once
84
- * the layout is ready.
85
- *
86
- * @returns A promise or void indicating the completion of the layout setup.
87
- */
88
- protected onLayoutReady(): MaybePromise<void>;
89
- /**
90
- * Called when the plugin loading is complete. This method must be implemented by subclasses to perform
91
- * any additional setup required after loading is complete.
92
- *
93
- * @returns A promise or void indicating the completion of the load process.
94
- */
95
- protected onloadComplete(): MaybePromise<void>;
96
- /**
97
- * Displays a notice message to the user.
98
- *
99
- * @param message - The message to display.
100
- */
101
- protected showNotice(message: string): void;
102
- /**
103
- * Loads the plugin settings from the saved data.
104
- *
105
- * @returns A promise that resolves when the settings are loaded.
106
- */
107
- private loadSettings;
108
- }
1
+ export * from './PluginBase.cjs';
@@ -1,12 +1 @@
1
- /**
2
- * @packageDocumentation PluginContext
3
- * Initializes the plugin context and sets up the plugin ID.
4
- */
5
- import type { App } from 'obsidian';
6
- /**
7
- * Initializes the plugin context.
8
- *
9
- * @param app - The Obsidian app instance.
10
- * @param pluginId - The plugin ID.
11
- */
12
- export declare function initPluginContext(app: App, pluginId: string): void;
1
+ export * from './PluginContext.cjs';
@@ -1,20 +1 @@
1
- /**
2
- * @packageDocumentation PluginId
3
- * Holder for the plugin ID.
4
- */
5
- /**
6
- * The plugin ID for no plugin.
7
- */
8
- export declare const NO_PLUGIN_ID_INITIALIZED = "__no-plugin-id-initialized__";
9
- /**
10
- * Returns the plugin ID.
11
- *
12
- * @returns The plugin ID.
13
- */
14
- export declare function getPluginId(): string;
15
- /**
16
- * Sets the plugin ID.
17
- *
18
- * @param newPluginId - The new plugin ID.
19
- */
20
- export declare function setPluginId(newPluginId: string): void;
1
+ export * from './PluginId.cjs';
@@ -1,31 +1 @@
1
- /**
2
- * @packageDocumentation PluginSettingsBase
3
- * Base class for plugin settings.
4
- */
5
- import { Transformer } from '../../Transformers/Transformer.mjs';
6
- /**
7
- * Base class for plugin settings.
8
- */
9
- export declare abstract class PluginSettingsBase {
10
- /**
11
- * Determines if the settings should be saved after loading.
12
- *
13
- * @returns A boolean indicating whether the settings should be saved after loading.
14
- */
15
- get shouldSaveAfterLoad(): boolean;
16
- protected _shouldSaveAfterLoad: boolean;
17
- /**
18
- * Initializes the settings from JSON data.
19
- *
20
- * @param data - The data to initialize the settings from.
21
- */
22
- init(data: unknown): void;
23
- /**
24
- * Converts the settings to a JSON object.
25
- *
26
- * @returns The settings as a JSON object.
27
- */
28
- toJSON(): Record<string, unknown>;
29
- protected getTransformer(): Transformer;
30
- protected initFromRecord(record: Record<string, unknown>): void;
31
- }
1
+ export * from './PluginSettingsBase.cjs';