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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 19.0.1
4
+
5
+ - Avoid duplication
6
+ - Use fixed typings
7
+
3
8
  ## 19.0.0
4
9
 
5
10
  - Make compatible with https://arethetypeswrong.github.io/
package/README.md CHANGED
@@ -194,9 +194,6 @@ await obsidianDevUtils.obsidian.Modal.Prompt.prompt({
194
194
  app,
195
195
  title: 'Enter your name'
196
196
  });
197
-
198
- // if you have `moduleResolution` set to `node` or `node10` in your `tsconfig.json`, you should use the import in the following way:
199
- import { prompt } from 'obsidian-dev-utils/dist/lib/obsidian/Modal/Prompt';
200
197
  ```
201
198
 
202
199
  ## Styling
@@ -1,16 +1 @@
1
- /**
2
- * @packageDocumentation debug
3
- * Fixed typings for the `debug` package.
4
- */
5
-
6
- export {};
7
-
8
- declare module 'debug' {
9
- interface Debug {
10
- /**
11
- * Loads the debug configuration from the environment.
12
- * @returns The loaded debug configuration.
13
- */
14
- load(): null | string;
15
- }
16
- }
1
+ export * from './debug.cjs';
@@ -1,153 +1 @@
1
- /**
2
- * @packageDocumentation Async
3
- * Contains utility functions for asynchronous operations.
4
- */
5
- /**
6
- * A type representing a value that can either be a direct value or a Promise resolving to that value.
7
- * @typeParam T - The type of the value.
8
- */
9
- export type MaybePromise<T> = Promise<T> | T;
10
- /**
11
- * A type representing a function that resolves a Promise.
12
- *
13
- * @typeParam T - The type of the value.
14
- */
15
- export type PromiseResolve<T> = undefined extends T ? (value?: PromiseLike<T> | T) => void : (value: PromiseLike<T> | T) => void;
16
- /**
17
- * Options for configuring the retry behavior.
18
- */
19
- export interface RetryOptions {
20
- /**
21
- * The abort signal to cancel the retry operation.
22
- */
23
- abortSignal?: AbortSignal;
24
- /**
25
- * The delay in milliseconds between retry attempts.
26
- */
27
- retryDelayInMilliseconds?: number;
28
- /**
29
- * Whether to retry the function on error.
30
- */
31
- shouldRetryOnError?: boolean;
32
- /**
33
- * The maximum time in milliseconds to wait before giving up on retrying.
34
- */
35
- timeoutInMilliseconds?: number;
36
- }
37
- /**
38
- * A marker interface to indicate that an error should terminate retry logic.
39
- */
40
- export interface TerminateRetry {
41
- /**
42
- * A marker property to indicate that an error should terminate retry logic.
43
- */
44
- __terminateRetry: true;
45
- }
46
- /**
47
- * Adds an error handler to a Promise that catches any errors and emits an async error event.
48
- *
49
- * @param asyncFn - The asynchronous function to add an error handler to.
50
- * @returns A Promise that resolves when the asynchronous function completes or emits async error event.
51
- */
52
- export declare function addErrorHandler(asyncFn: () => Promise<unknown>): Promise<void>;
53
- /**
54
- * Filters an array asynchronously, keeping only the elements that satisfy the provided predicate function.
55
- *
56
- * @typeParam T - The type of elements in the input array.
57
- * @param arr - The array to filter.
58
- * @param predicate - The predicate function to test each element.
59
- * @returns A Promise that resolves with an array of elements that satisfy the predicate function.
60
- */
61
- export declare function asyncFilter<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => MaybePromise<boolean>): Promise<T[]>;
62
- /**
63
- * Maps over an array asynchronously, applying the provided callback function to each element, and then flattens the results into a single array.
64
- *
65
- * @typeParam T - The type of elements in the input array.
66
- * @typeParam U - The type of elements in the output array.
67
- * @param arr - The array to map over and flatten.
68
- * @param callback - The callback function to apply to each element.
69
- * @returns A Promise that resolves with a flattened array of the results of the callback function.
70
- */
71
- export declare function asyncFlatMap<T, U>(arr: T[], callback: (value: T, index: number, array: T[]) => MaybePromise<U[]>): Promise<U[]>;
72
- /**
73
- * Maps over an array asynchronously, applying the provided callback function to each element.
74
- *
75
- * @typeParam T - The type of elements in the input array.
76
- * @typeParam U - The type of elements in the output array.
77
- * @param arr - The array to map over.
78
- * @param callback - The callback function to apply to each element.
79
- * @returns A Promise that resolves with an array of the results of the callback function.
80
- */
81
- export declare function asyncMap<T, U>(arr: T[], callback: (value: T, index: number, array: T[]) => MaybePromise<U>): Promise<U[]>;
82
- /**
83
- * Converts an asynchronous function to a synchronous one by automatically handling the Promise rejection.
84
- *
85
- * @typeParam Args - The types of the arguments the function accepts.
86
- * @param asyncFunc - The asynchronous function to convert.
87
- * @returns A function that wraps the asynchronous function in a synchronous interface.
88
- */
89
- export declare function convertAsyncToSync<Args extends unknown[]>(asyncFunc: (...args: Args) => Promise<unknown>): (...args: Args) => void;
90
- /**
91
- * Converts a synchronous function to an asynchronous one by wrapping it in a Promise.
92
- *
93
- * @typeParam Args - The types of the arguments the function accepts.
94
- * @typeParam Result - The type of the function's return value.
95
- * @param syncFn - The synchronous function to convert.
96
- * @returns A function that wraps the synchronous function in an asynchronous interface.
97
- */
98
- export declare function convertSyncToAsync<Args extends unknown[], Result>(syncFn: (...args: Args) => Result): (...args: Args) => Promise<Result>;
99
- /**
100
- * Invokes a Promise and safely handles any errors by catching them and emitting an async error event.
101
- *
102
- * @param asyncFn - The asynchronous function to invoke safely.
103
- */
104
- export declare function invokeAsyncSafely(asyncFn: () => Promise<unknown>): void;
105
- /**
106
- * Marks an error to terminate retry logic.
107
- *
108
- * @param error - The error to mark to terminate retry logic.
109
- * @returns An error that should terminate retry logic.
110
- */
111
- export declare function marksAsTerminateRetry<TError extends Error>(error: TError): TerminateRetry & TError;
112
- /**
113
- * Retries the provided function until it returns true or the timeout is reached.
114
- *
115
- * @param fn - The function to retry.
116
- * @param retryOptions - Optional parameters to configure the retry behavior.
117
- * @param stackTrace - Optional stack trace.
118
- * @returns A Promise that resolves when the function returns true or rejects when the timeout is reached.
119
- */
120
- export declare function retryWithTimeout(fn: () => MaybePromise<boolean>, retryOptions?: RetryOptions, stackTrace?: string): Promise<void>;
121
- /**
122
- * Executes a function with a timeout. If the function does not complete within the specified time, it is considered to have timed out.
123
- *
124
- * If `DEBUG=obsidian-dev-utils:Async:runWithTimeout` is set, the execution is not terminated after the timeout and the function is allowed to run indefinitely.
125
- *
126
- * @typeParam R - The type of the result from the asynchronous function.
127
- * @param timeoutInMilliseconds - The maximum time to wait in milliseconds.
128
- * @param fn - The function to execute.
129
- * @returns A Promise that resolves with the result of the asynchronous function or rejects if it times out.
130
- */
131
- export declare function runWithTimeout<R>(timeoutInMilliseconds: number, fn: () => MaybePromise<R>): Promise<R>;
132
- /**
133
- * Delays execution for a specified number of milliseconds.
134
- *
135
- * @param milliseconds - The time to wait in milliseconds.
136
- * @returns A Promise that resolves after the specified delay.
137
- */
138
- export declare function sleep(milliseconds: number): Promise<void>;
139
- /**
140
- * Returns a Promise that rejects after the specified timeout period.
141
- *
142
- * @param timeoutInMilliseconds - The timeout period in milliseconds.
143
- * @returns A Promise that always rejects with a timeout error.
144
- */
145
- export declare function timeout(timeoutInMilliseconds: number): Promise<never>;
146
- /**
147
- * Converts an AsyncIterableIterator to an array by consuming all its elements.
148
- *
149
- * @typeParam T - The type of elements produced by the AsyncIterableIterator.
150
- * @param iter - The AsyncIterableIterator to convert.
151
- * @returns A Promise that resolves with an array of all the elements in the AsyncIterableIterator.
152
- */
153
- export declare function toArray<T>(iter: AsyncIterableIterator<T>): Promise<T[]>;
1
+ export * from './Async.cjs';
@@ -1,40 +1 @@
1
- /**
2
- * @packageDocumentation Async
3
- * Contains utility functions for Blob objects.
4
- */
5
- /**
6
- * Converts a Blob object to an ArrayBuffer.
7
- *
8
- * @param blob - The Blob object to convert.
9
- * @returns A promise that resolves to an ArrayBuffer.
10
- */
11
- export declare function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
12
- /**
13
- * Converts a Blob object to a data URL.
14
- *
15
- * @param blob - The Blob object to convert.
16
- * @returns A promise that resolves to a data URL.
17
- */
18
- export declare function blobToDataUrl(blob: Blob): Promise<string>;
19
- /**
20
- * Converts a Blob object to a JPEG ArrayBuffer with the specified quality.
21
- *
22
- * @param blob - The Blob object to convert.
23
- * @param jpegQuality - The quality of the JPEG image (0 to 1).
24
- * @returns A promise that resolves to an ArrayBuffer.
25
- */
26
- export declare function blobToJpegArrayBuffer(blob: Blob, jpegQuality: number): Promise<ArrayBuffer>;
27
- /**
28
- * Converts a base64 encoded string to an ArrayBuffer.
29
- *
30
- * @param dataUrl - The data URL to convert.
31
- * @returns The decoded ArrayBuffer.
32
- */
33
- export declare function dataUrlToArrayBuffer(dataUrl: string): ArrayBuffer;
34
- /**
35
- * Checks if a given file is an image.
36
- *
37
- * @param file - The file to check.
38
- * @returns True if the file is an image, false otherwise.
39
- */
40
- export declare function isImageFile(file: File): boolean;
1
+ export * from './Blob.cjs';
@@ -1,97 +1 @@
1
- /**
2
- * @packageDocumentation CssClass
3
- * CSS classes used by the `obsidian-dev-utils` library.
4
- */
5
- /**
6
- * CSS classes used by the `obsidian-dev-utils` library.
7
- */
8
- export declare enum CssClass {
9
- /**
10
- * The CSS class for the alert modal.
11
- */
12
- AlertModal = "alert-modal",
13
- /**
14
- * The CSS class for the cancel button.
15
- */
16
- CancelButton = "cancel-button",
17
- /**
18
- * The CSS class for the confirm modal.
19
- */
20
- ConfirmModal = "confirm-modal",
21
- /**
22
- * The CSS class for the date component.
23
- */
24
- DateComponent = "date-component",
25
- /**
26
- * The CSS class for the date and time component.
27
- */
28
- DateTimeComponent = "datetime-component",
29
- /**
30
- * The CSS class for the email component.
31
- */
32
- EmailComponent = "email-component",
33
- /**
34
- * The CSS class for the file component.
35
- */
36
- FileComponent = "file-component",
37
- /**
38
- * The CSS class for the library name.
39
- */
40
- LibraryName = "obsidian-dev-utils",
41
- /**
42
- * The CSS class for the month component.
43
- */
44
- MonthComponent = "month-component",
45
- /**
46
- * The CSS class for the multiple dropdown component.
47
- */
48
- MultipleDropdownComponent = "multiple-dropdown-component",
49
- /**
50
- * The CSS class for the multiple email component.
51
- */
52
- MultipleEmailComponent = "multiple-email-component",
53
- /**
54
- * The CSS class for the multiple file component.
55
- */
56
- MultipleFileComponent = "multiple-file-component",
57
- /**
58
- * The CSS class for the multiple text component.
59
- */
60
- MultipleTextComponent = "multiple-text-component",
61
- /**
62
- * The CSS class for the number component.
63
- */
64
- NumberComponent = "number-component",
65
- /**
66
- * The CSS class for the ok button.
67
- */
68
- OkButton = "ok-button",
69
- /**
70
- * The CSS class for the plugin settings tab.
71
- */
72
- PluginSettingsTab = "plugin-settings-tab",
73
- /**
74
- * The CSS class for the prompt modal.
75
- */
76
- PromptModal = "prompt-modal",
77
- /**
78
- * The CSS class for the select item modal.
79
- */
80
- SelectItemModal = "select-item-modal",
81
- /**
82
- * The CSS class for the text box.
83
- */
84
- TextBox = "text-box",
85
- /**
86
- * The CSS class for the time component.
87
- */
88
- TimeComponent = "time-component",
89
- /**
90
- * The CSS class for the url component.
91
- */
92
- UrlComponent = "url-component",
93
- /**
94
- * The CSS class for the week component.
95
- */
96
- WeekComponent = "week-component"
97
- }
1
+ export * from './CssClass.cjs';
@@ -1,41 +1 @@
1
- /**
2
- * @packageDocumentation Debug
3
- * Contains utility functions for debugging.
4
- */
5
- import type { Debugger } from 'debug';
6
- import type { DebugController } from './DebugController.mjs';
7
- interface DebuggerEx extends Debugger {
8
- printStackTrace(stackTrace: string, title?: string): void;
9
- }
10
- /**
11
- * Enables the debuggers for the `obsidian-dev-utils` library.
12
- */
13
- export declare function enableLibraryDebuggers(): void;
14
- /**
15
- * Returns a debug controller.
16
- *
17
- * @returns A debug controller.
18
- */
19
- export declare function getDebugController(): DebugController;
20
- /**
21
- * Returns a debugger instance with a log function that includes the caller's file name and line number.
22
- *
23
- * @param namespace - The namespace for the debugger instance.
24
- * @param framesToSkip - The number of frames to skip in the stack trace.
25
- * @returns A debugger instance with a log function that includes the caller's file name and line number.
26
- */
27
- export declare function getDebugger(namespace: string, framesToSkip?: number): DebuggerEx;
28
- /**
29
- * Returns a debugger instance for the `obsidian-dev-utils` library.
30
- *
31
- * @param namespace - The namespace for the debugger instance.
32
- * @returns A debugger instance for the `obsidian-dev-utils` library.
33
- */
34
- export declare function getLibDebugger(namespace: string): DebuggerEx;
35
- /**
36
- * Shows an initial debug message.
37
- *
38
- * @param pluginId - The plugin ID.
39
- */
40
- export declare function showInitialDebugMessage(pluginId: string): void;
41
- export {};
1
+ export * from './Debug.cjs';
@@ -1,85 +1 @@
1
- /**
2
- * @packageDocumentation
3
- * Provides the interface for controlling debug output through namespace management.
4
- *
5
- * Debug namespaces follow the pattern 'lorem', `lorem:ipsum`, `lorem:ipsum:dolor`, etc, and can use wildcards (`*`).
6
- *
7
- * @example
8
- * - `lorem:*` matches all submodules of 'lorem'
9
- * - `*:ipsum` matches all plugins' `ipsum` submodules
10
- * - `*` matches everything
11
- *
12
- * Special syntax:
13
- * - Namespaces prefixed with '-' are explicitly disabled
14
- * - Multiple namespaces can be combined with commas: `lorem,-lorem:ipsum,dolor:*`
15
- *
16
- * @see {@link https://github.com/mnaoumov/obsidian-dev-utils/?tab=readme-ov-file#debugging}
17
- */
18
- /**
19
- * Controls debug output by managing debug namespaces.
20
- * Exposed globally as `window.DEBUG`.
21
- *
22
- * @remarks
23
- * Debug settings persist across plugin reloads in localStorage.
24
- */
25
- export interface DebugController {
26
- /**
27
- * Disable specific debug namespaces. Disabled namespaces take precedence
28
- * over enabled ones when there's a conflict.
29
- *
30
- * @example
31
- * ```typescript
32
- * window.DEBUG.disable('foo-bar'); // hide all debug messages from the `foo-bar` plugin
33
- * window.DEBUG.disable('foo-bar:*'); // hide all debug messages from the `foo-bar` plugin submodules
34
- * window.DEBUG.disable(['foo-bar', 'baz-qux']); // disable multiple namespaces
35
- * window.DEBUG.disable('foo-bar,baz-qux'); // disable multiple namespaces using comma-separated string
36
- * window.DEBUG.disable('*'); // disable all debug messages
37
- * ```
38
- *
39
- * @param namespaces - Single namespace string or array of namespace strings to disable
40
- */
41
- disable(namespaces: string | string[]): void;
42
- /**
43
- * Enable specific debug namespaces. Note that explicitly disabled
44
- * namespaces (prefixed with '-') will remain disabled.
45
- *
46
- * @example
47
- * ```typescript
48
- * window.DEBUG.enable('foo-bar'); // show all debug messages from the `foo-bar` plugin
49
- * window.DEBUG.enable('foo-bar:obsidian-dev-utils:*'); // show all debug messages from the `obsidian-dev-utils` library within the `foo-bar` plugin
50
- * window.DEBUG.enable('foo-bar:*'); // show all debug messages from the `foo-bar` plugin and its submodules
51
- * window.DEBUG.enable('*:obsidian-dev-utils:*'); // show all debug messages for the `obsidian-dev-utils` library within any plugin
52
- * window.DEBUG.enable(['foo-bar', 'baz-qux']); // enable multiple namespaces
53
- * window.DEBUG.enable('foo-bar,baz-qux'); // enable multiple namespaces using comma-separated string
54
- * window.DEBUG.enable('*'); // show all debug messages
55
- * ```
56
- *
57
- * @param namespaces - Single namespace string or array of namespace strings to enable
58
- */
59
- enable(namespaces: string | string[]): void;
60
- /**
61
- * Get currently configured debug namespaces.
62
- *
63
- * @example
64
- * ```typescript
65
- * window.DEBUG.get(); // returns ['foo-bar', 'baz-qux:*', '-lorem-ipsum']
66
- * ```
67
- *
68
- * @returns Array of enabled and disabled (prefixed with `-`) debug namespaces
69
- */
70
- get(): string[];
71
- /**
72
- * Set debug namespaces, replacing all previous configurations.
73
- *
74
- * @example
75
- * ```typescript
76
- * window.DEBUG.set(['foo-bar', 'baz-qux:*', '-lorem-ipsum']); // Enable 'foo-bar' and 'baz-qux:*', explicitly disable 'lorem-ipsum'
77
- * window.DEBUG.set('foo-bar,baz-qux:*,-lorem-ipsum'); // Same thing using comma-separated string
78
- * window.DEBUG.set('*'); // Enable all debug messages
79
- * window.DEBUG.set(''); // Disable all debug messages
80
- * ```
81
- *
82
- * @param namespaces - String or array of namespace patterns
83
- */
84
- set(namespaces: string | string[]): void;
85
- }
1
+ export * from './DebugController.cjs';
@@ -1,20 +1 @@
1
- /**
2
- * @packageDocumentation Enum
3
- * Contains utility functions for enums.
4
- */
5
- /**
6
- * Get the key of an enum value.
7
- *
8
- * @param enumType - The enum type.
9
- * @param value - The value to get the key of.
10
- * @returns The key of the enum value.
11
- */
12
- export declare function getEnumKey<T extends Record<string, string>>(enumType: T, value: T[keyof T]): keyof T;
13
- /**
14
- * Get the value of an enum key.
15
- *
16
- * @param enumType - The enum type.
17
- * @param key - The key to get the value of.
18
- * @returns The value of the enum key.
19
- */
20
- export declare function getEnumValue<T extends Record<string, string>>(enumType: T, key: string): T[keyof T];
1
+ export * from './Enum.cjs';
@@ -1,45 +1 @@
1
- /**
2
- * @packageDocumentation Error
3
- * Contains utility functions for error handling.
4
- */
5
- /**
6
- * Emits an asynchronous error event.
7
- *
8
- * @param asyncError - The error to emit as an asynchronous error event.
9
- */
10
- export declare function emitAsyncErrorEvent(asyncError: unknown): void;
11
- /**
12
- * Converts an error to a string representation, including nested causes with indentation.
13
- *
14
- * @param error - The error to convert to a string.
15
- * @returns The string representation of the error.
16
- */
17
- export declare function errorToString(error: unknown): string;
18
- /**
19
- * Gets the current stack trace as a string, excluding the current function call.
20
- *
21
- * @param framesToSkip - The number of frames to skip in the stack trace.
22
- * @returns A string representation of the current stack trace, excluding the current function call.
23
- */
24
- export declare function getStackTrace(framesToSkip?: number): string;
25
- /**
26
- * Prints an error to the console, including nested causes and optional ANSI sequence clearing.
27
- *
28
- * @param error - The error to print.
29
- * @param console - The console to print to (default: `globalThis.console`).
30
- */
31
- export declare function printError(error: unknown, console?: Console): void;
32
- /**
33
- * Registers an event handler for asynchronous errors.
34
- *
35
- * @param handler - The handler function to be called when an asynchronous error event occurs.
36
- * @returns A function to unregister the handler.
37
- */
38
- export declare function registerAsyncErrorEventHandler(handler: (asyncError: unknown) => void): () => void;
39
- /**
40
- * Throws an error with the specified message.
41
- *
42
- * @param error - The error to throw.
43
- * @returns A never-returning function.
44
- */
45
- export declare function throwExpression(error: unknown): never;
1
+ export * from './Error.cjs';
@@ -1,28 +1 @@
1
- /**
2
- * @packageDocumentation Function
3
- * Contains utility functions for working with functions.
4
- */
5
- /**
6
- * A function that does nothing.
7
- */
8
- export declare function noop(): void;
9
- /**
10
- * A function that does nothing.
11
- */
12
- export declare function noopAsync(): Promise<void>;
13
- /**
14
- * Makes an async function that calls the original async function with the provided arguments and omits the return value.
15
- *
16
- * @typeParam Args - Arguments to be passed to the function.
17
- * @param fn - Function to be called.
18
- * @returns An async function that calls the original function with the provided arguments and omits the return value.
19
- */
20
- export declare function omitAsyncReturnType<Args extends unknown[]>(fn: (...args: Args) => Promise<unknown>): (...args: Args) => Promise<void>;
21
- /**
22
- * Makes a function that calls the original function with the provided arguments and omits the return value.
23
- *
24
- * @typeParam Args - Arguments to be passed to the function.
25
- * @param fn - Function to be called.
26
- * @returns A function that calls the original function with the provided arguments and omits the return value.
27
- */
28
- export declare function omitReturnType<Args extends unknown[]>(fn: (...args: Args) => unknown): (...args: Args) => void;
1
+ export * from './Function.cjs';
@@ -1,49 +1 @@
1
- /**
2
- * @packageDocumentation HTMLElement
3
- * Helpers for working with HTML elements.
4
- */
5
- /**
6
- * A HTML element that can be validated.
7
- */
8
- export interface ValidatorElement extends HTMLElement {
9
- /**
10
- * Checks the validity of the element.
11
- *
12
- * @returns True if the element is valid, false otherwise.
13
- */
14
- checkValidity(): boolean;
15
- /**
16
- * Reports the validity of the element.
17
- */
18
- reportValidity(): boolean;
19
- /**
20
- * Sets a custom error message on the element.
21
- * @param error - The error message to set on the element.
22
- */
23
- setCustomValidity(error: string): void;
24
- /**
25
- * The error message of the element.
26
- */
27
- readonly validationMessage: string;
28
- }
29
- /**
30
- * Appends a code block to the given DocumentFragment or HTMLElement.
31
- *
32
- * @param el - The DocumentFragment or HTMLElement to append the code block to.
33
- * @param code - The code to be displayed in the code block.
34
- */
35
- export declare function appendCodeBlock(el: DocumentFragment | HTMLElement, code: string): void;
36
- /**
37
- * Ensures that the given element is loaded.
38
- *
39
- * @param el - The element to ensure is loaded.
40
- * @returns A promise that resolves when the element is loaded.
41
- */
42
- export declare function ensureLoaded(el: Element): Promise<void>;
43
- /**
44
- * Checks if the element is loaded.
45
- *
46
- * @param el - The element to check.
47
- * @returns True if the element is loaded, false otherwise.
48
- */
49
- export declare function isLoaded(el: Element): boolean;
1
+ export * from './HTMLElement.cjs';
@@ -30,7 +30,7 @@ __export(Library_exports, {
30
30
  LIBRARY_VERSION: () => LIBRARY_VERSION
31
31
  });
32
32
  module.exports = __toCommonJS(Library_exports);
33
- const LIBRARY_VERSION = "19.0.0";
33
+ const LIBRARY_VERSION = "19.0.1";
34
34
  const LIBRARY_NAME = "obsidian-dev-utils";
35
35
  const LIBRARY_STYLES = ".obsidian-dev-utils :invalid {\n box-shadow: 0 0 0 2px var(--text-error);\n}\n.obsidian-dev-utils.modal-container .ok-button {\n margin-right: 10px;\n margin-top: 20px;\n}\n.obsidian-dev-utils .multiple-dropdown-component select,\n.obsidian-dev-utils .multiple-dropdown-component select:focus,\n.obsidian-dev-utils .multiple-dropdown-component .dropdown {\n height: auto;\n}\n.obsidian-dev-utils .multiple-dropdown-component select option:checked,\n.obsidian-dev-utils .multiple-dropdown-component select:focus option:checked,\n.obsidian-dev-utils .multiple-dropdown-component .dropdown option:checked {\n background-color: #1967d2;\n color: #fff;\n}\n.obsidian-dev-utils.prompt-modal .text-box {\n width: 100%;\n}\n\n/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../src/styles/main.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AACE;EACE;;AAIA;EACE;EACA;;AAKF;AAAA;AAAA;EAGE;;AAEA;AAAA;AAAA;EACE;EACA;;AAMJ;EACE%22,%22file%22:%22styles.css%22,%22sourcesContent%22:%5B%22.obsidian-dev-utils%20%7B%5Cn%20%20:invalid%20%7B%5Cn%20%20%20%20box-shadow:%200%200%200%202px%20var(--text-error);%5Cn%20%20%7D%5Cn%5Cn%20%20&.modal-container%20%7B%5Cn%20%20%20%20.ok-button%20%7B%5Cn%20%20%20%20%20%20margin-right:%2010px;%5Cn%20%20%20%20%20%20margin-top:%2020px;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20.multiple-dropdown-component%20%7B%5Cn%20%20%20%20select,%5Cn%20%20%20%20select:focus,%5Cn%20%20%20%20.dropdown%20%7B%5Cn%20%20%20%20%20%20height:%20auto;%5Cn%5Cn%20%20%20%20%20%20option:checked%20%7B%5Cn%20%20%20%20%20%20%20%20background-color:%20%231967d2;%5Cn%20%20%20%20%20%20%20%20color:%20%23fff;%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20&.prompt-modal%20%7B%5Cn%20%20%20%20.text-box%20%7B%5Cn%20%20%20%20%20%20width:%20100%25;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22%5D%7D */\n";
36
36
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,16 +1 @@
1
- /**
2
- * @packageDocumentation Library
3
- * Helpers for working with the `obsidian-dev-utils` library.
4
- */
5
- /**
6
- * The version of the `obsidian-dev-utils` library.
7
- */
8
- export declare const LIBRARY_VERSION = "$(LIBRARY_VERSION)";
9
- /**
10
- * The name of the `obsidian-dev-utils` library.
11
- */
12
- export declare const LIBRARY_NAME = "obsidian-dev-utils";
13
- /**
14
- * The styles of the `obsidian-dev-utils` library.
15
- */
16
- export declare const LIBRARY_STYLES = "$(LIBRARY_STYLES)";
1
+ export * from './Library.cjs';
@@ -5,7 +5,7 @@ if you want to view the source, please visit the github repository of this plugi
5
5
 
6
6
  (function initEsm(){if(globalThis.process){return}const browserProcess={browser:true,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=browserProcess})();
7
7
 
8
- const LIBRARY_VERSION = "19.0.0";
8
+ const LIBRARY_VERSION = "19.0.1";
9
9
  const LIBRARY_NAME = "obsidian-dev-utils";
10
10
  const LIBRARY_STYLES = ".obsidian-dev-utils :invalid {\n box-shadow: 0 0 0 2px var(--text-error);\n}\n.obsidian-dev-utils.modal-container .ok-button {\n margin-right: 10px;\n margin-top: 20px;\n}\n.obsidian-dev-utils .multiple-dropdown-component select,\n.obsidian-dev-utils .multiple-dropdown-component select:focus,\n.obsidian-dev-utils .multiple-dropdown-component .dropdown {\n height: auto;\n}\n.obsidian-dev-utils .multiple-dropdown-component select option:checked,\n.obsidian-dev-utils .multiple-dropdown-component select:focus option:checked,\n.obsidian-dev-utils .multiple-dropdown-component .dropdown option:checked {\n background-color: #1967d2;\n color: #fff;\n}\n.obsidian-dev-utils.prompt-modal .text-box {\n width: 100%;\n}\n\n/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../src/styles/main.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AACE;EACE;;AAIA;EACE;EACA;;AAKF;AAAA;AAAA;EAGE;;AAEA;AAAA;AAAA;EACE;EACA;;AAMJ;EACE%22,%22file%22:%22styles.css%22,%22sourcesContent%22:%5B%22.obsidian-dev-utils%20%7B%5Cn%20%20:invalid%20%7B%5Cn%20%20%20%20box-shadow:%200%200%200%202px%20var(--text-error);%5Cn%20%20%7D%5Cn%5Cn%20%20&.modal-container%20%7B%5Cn%20%20%20%20.ok-button%20%7B%5Cn%20%20%20%20%20%20margin-right:%2010px;%5Cn%20%20%20%20%20%20margin-top:%2020px;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20.multiple-dropdown-component%20%7B%5Cn%20%20%20%20select,%5Cn%20%20%20%20select:focus,%5Cn%20%20%20%20.dropdown%20%7B%5Cn%20%20%20%20%20%20height:%20auto;%5Cn%5Cn%20%20%20%20%20%20option:checked%20%7B%5Cn%20%20%20%20%20%20%20%20background-color:%20%231967d2;%5Cn%20%20%20%20%20%20%20%20color:%20%23fff;%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20&.prompt-modal%20%7B%5Cn%20%20%20%20.text-box%20%7B%5Cn%20%20%20%20%20%20width:%20100%25;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22%5D%7D */\n";
11
11
  export {