@mnaoumov/obsidian-lib 10.5.1 → 10.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/codemirror/inline-token-widgets/package.json +6 -0
  2. package/codemirror/settings-facet/package.json +6 -0
  3. package/command-handlers/open-discussion-command-handler/package.json +6 -0
  4. package/command-handlers/open-feature-request-command-handler/package.json +6 -0
  5. package/command-handlers/open-git-hub-command-handler/package.json +6 -0
  6. package/components/settings-facet-component/package.json +6 -0
  7. package/components/style-sheet-component/package.json +6 -0
  8. package/dist/lib/cjs/__merged.cjs +137 -1
  9. package/dist/lib/cjs/__merged.d.cts +26 -0
  10. package/dist/lib/cjs/anchored-suggest.cjs +232 -0
  11. package/dist/lib/cjs/anchored-suggest.d.cts +116 -0
  12. package/dist/lib/cjs/broken-link-candidates.cjs +366 -0
  13. package/dist/lib/cjs/broken-link-candidates.d.cts +181 -0
  14. package/dist/lib/cjs/bug-report.cjs +4 -2
  15. package/dist/lib/cjs/bug-report.d.cts +1 -1
  16. package/dist/lib/cjs/code-block-render-handoff.cjs +272 -0
  17. package/dist/lib/cjs/code-block-render-handoff.d.cts +131 -0
  18. package/dist/lib/cjs/codemirror/index.cjs +7 -1
  19. package/dist/lib/cjs/codemirror/index.d.cts +2 -0
  20. package/dist/lib/cjs/codemirror/inline-token-widgets.cjs +250 -0
  21. package/dist/lib/cjs/codemirror/inline-token-widgets.d.cts +109 -0
  22. package/dist/lib/cjs/codemirror/settings-facet.cjs +132 -0
  23. package/dist/lib/cjs/codemirror/settings-facet.d.cts +19 -0
  24. package/dist/lib/cjs/command-handlers/index.cjs +10 -1
  25. package/dist/lib/cjs/command-handlers/index.d.cts +3 -0
  26. package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.cjs +9 -12
  27. package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.d.cts +6 -8
  28. package/dist/lib/cjs/command-handlers/open-discussion-command-handler.cjs +127 -0
  29. package/dist/lib/cjs/command-handlers/open-discussion-command-handler.d.cts +45 -0
  30. package/dist/lib/cjs/command-handlers/open-feature-request-command-handler.cjs +119 -0
  31. package/dist/lib/cjs/command-handlers/open-feature-request-command-handler.d.cts +33 -0
  32. package/dist/lib/cjs/command-handlers/open-git-hub-command-handler.cjs +121 -0
  33. package/dist/lib/cjs/command-handlers/open-git-hub-command-handler.d.cts +43 -0
  34. package/dist/lib/cjs/components/index.cjs +7 -1
  35. package/dist/lib/cjs/components/index.d.cts +2 -0
  36. package/dist/lib/cjs/components/settings-facet-component.cjs +136 -0
  37. package/dist/lib/cjs/components/settings-facet-component.d.cts +68 -0
  38. package/dist/lib/cjs/components/style-sheet-component.cjs +198 -0
  39. package/dist/lib/cjs/components/style-sheet-component.d.cts +79 -0
  40. package/dist/lib/cjs/css-class.cjs +8 -1
  41. package/dist/lib/cjs/css-class.d.cts +28 -0
  42. package/dist/lib/cjs/data-stores/data-store-transport.cjs +7 -4
  43. package/dist/lib/cjs/data-stores/data-store-transport.d.cts +1 -1
  44. package/dist/lib/cjs/data-stores/shared-data-store.cjs +1 -1
  45. package/dist/lib/cjs/data-stores/shared-data-store.d.cts +1 -1
  46. package/dist/lib/cjs/desktop-git-runner.cjs +117 -0
  47. package/dist/lib/cjs/desktop-git-runner.d.cts +17 -0
  48. package/dist/lib/cjs/desktop-request-url-stream.cjs +258 -0
  49. package/dist/lib/cjs/desktop-request-url-stream.d.cts +22 -0
  50. package/dist/lib/cjs/editor-suggest-registrar.cjs +8 -2
  51. package/dist/lib/cjs/editor-suggest-registrar.d.cts +14 -2
  52. package/dist/lib/cjs/editor-suggest.cjs +197 -0
  53. package/dist/lib/cjs/editor-suggest.d.cts +103 -0
  54. package/dist/lib/cjs/feature-request.cjs +115 -0
  55. package/dist/lib/cjs/feature-request.d.cts +54 -0
  56. package/dist/lib/cjs/generated-during-build.cjs +2 -2
  57. package/dist/lib/cjs/git-hub-discussion.cjs +101 -0
  58. package/dist/lib/cjs/git-hub-discussion.d.cts +28 -0
  59. package/dist/lib/cjs/git-rename-history.cjs +148 -0
  60. package/dist/lib/cjs/git-rename-history.d.cts +43 -0
  61. package/dist/lib/cjs/hotkey.cjs +185 -0
  62. package/dist/lib/cjs/hotkey.d.cts +59 -0
  63. package/dist/lib/cjs/i18n/locales/en.cjs +13 -1
  64. package/dist/lib/cjs/i18n/locales/en.d.cts +12 -0
  65. package/dist/lib/cjs/i18n/locales/translations-map.d.cts +12 -0
  66. package/dist/lib/cjs/index.cjs +46 -1
  67. package/dist/lib/cjs/index.d.cts +15 -0
  68. package/dist/lib/cjs/inline-token-renderer.cjs +145 -0
  69. package/dist/lib/cjs/inline-token-renderer.d.cts +88 -0
  70. package/dist/lib/cjs/link-and-tag-input-suggest.cjs +325 -0
  71. package/dist/lib/cjs/link-and-tag-input-suggest.d.cts +229 -0
  72. package/dist/lib/cjs/markdown-code-block-processor.cjs +13 -1
  73. package/dist/lib/cjs/markdown-code-block-processor.d.cts +18 -0
  74. package/dist/lib/cjs/markdown.cjs +6 -1
  75. package/dist/lib/cjs/markdown.d.cts +10 -1
  76. package/dist/lib/cjs/rendered-markdown.cjs +306 -0
  77. package/dist/lib/cjs/rendered-markdown.d.cts +77 -0
  78. package/dist/lib/cjs/request-url.cjs +523 -0
  79. package/dist/lib/cjs/request-url.d.cts +233 -0
  80. package/dist/lib/cjs/setting-components/folder-list-component.cjs +216 -0
  81. package/dist/lib/cjs/setting-components/folder-list-component.d.cts +73 -0
  82. package/dist/lib/cjs/setting-components/hotkey-component.cjs +260 -0
  83. package/dist/lib/cjs/setting-components/hotkey-component.d.cts +85 -0
  84. package/dist/lib/cjs/setting-components/index.cjs +13 -1
  85. package/dist/lib/cjs/setting-components/index.d.cts +4 -0
  86. package/dist/lib/cjs/setting-components/list-component.cjs +291 -0
  87. package/dist/lib/cjs/setting-components/list-component.d.cts +106 -0
  88. package/dist/lib/cjs/setting-components/tag-list-component.cjs +220 -0
  89. package/dist/lib/cjs/setting-components/tag-list-component.d.cts +82 -0
  90. package/dist/lib/cjs/setting-ex.cjs +51 -1
  91. package/dist/lib/cjs/setting-ex.d.cts +35 -1
  92. package/dist/lib/cjs/settings-tabs.cjs +258 -0
  93. package/dist/lib/cjs/settings-tabs.d.cts +101 -0
  94. package/dist/lib/cjs/vault.cjs +2 -2
  95. package/dist/lib/cjs/vault.d.cts +3 -1
  96. package/dist/lib/esm/__merged.d.mts +26 -0
  97. package/dist/lib/esm/__merged.mjs +139 -1
  98. package/dist/lib/esm/anchored-suggest.d.mts +116 -0
  99. package/dist/lib/esm/anchored-suggest.mjs +144 -0
  100. package/dist/lib/esm/broken-link-candidates.d.mts +181 -0
  101. package/dist/lib/esm/broken-link-candidates.mjs +275 -0
  102. package/dist/lib/esm/bug-report.d.mts +1 -1
  103. package/dist/lib/esm/bug-report.mjs +4 -2
  104. package/dist/lib/esm/code-block-render-handoff.d.mts +131 -0
  105. package/dist/lib/esm/code-block-render-handoff.mjs +183 -0
  106. package/dist/lib/esm/codemirror/index.d.mts +2 -0
  107. package/dist/lib/esm/codemirror/index.mjs +5 -1
  108. package/dist/lib/esm/codemirror/inline-token-widgets.d.mts +109 -0
  109. package/dist/lib/esm/codemirror/inline-token-widgets.mjs +167 -0
  110. package/dist/lib/esm/codemirror/settings-facet.d.mts +19 -0
  111. package/dist/lib/esm/codemirror/settings-facet.mjs +44 -0
  112. package/dist/lib/esm/command-handlers/index.d.mts +3 -0
  113. package/dist/lib/esm/command-handlers/index.mjs +7 -1
  114. package/dist/lib/esm/command-handlers/open-bug-report-command-handler.d.mts +6 -8
  115. package/dist/lib/esm/command-handlers/open-bug-report-command-handler.mjs +9 -12
  116. package/dist/lib/esm/command-handlers/open-discussion-command-handler.d.mts +45 -0
  117. package/dist/lib/esm/command-handlers/open-discussion-command-handler.mjs +39 -0
  118. package/dist/lib/esm/command-handlers/open-feature-request-command-handler.d.mts +33 -0
  119. package/dist/lib/esm/command-handlers/open-feature-request-command-handler.mjs +31 -0
  120. package/dist/lib/esm/command-handlers/open-git-hub-command-handler.d.mts +43 -0
  121. package/dist/lib/esm/command-handlers/open-git-hub-command-handler.mjs +33 -0
  122. package/dist/lib/esm/components/index.d.mts +2 -0
  123. package/dist/lib/esm/components/index.mjs +5 -1
  124. package/dist/lib/esm/components/settings-facet-component.d.mts +68 -0
  125. package/dist/lib/esm/components/settings-facet-component.mjs +48 -0
  126. package/dist/lib/esm/components/style-sheet-component.d.mts +79 -0
  127. package/dist/lib/esm/components/style-sheet-component.mjs +109 -0
  128. package/dist/lib/esm/css-class.d.mts +28 -0
  129. package/dist/lib/esm/css-class.mjs +8 -1
  130. package/dist/lib/esm/data-stores/data-store-transport.d.mts +1 -1
  131. package/dist/lib/esm/data-stores/data-store-transport.mjs +7 -4
  132. package/dist/lib/esm/data-stores/shared-data-store.d.mts +1 -1
  133. package/dist/lib/esm/data-stores/shared-data-store.mjs +1 -1
  134. package/dist/lib/esm/desktop-git-runner.d.mts +17 -0
  135. package/dist/lib/esm/desktop-git-runner.mjs +19 -0
  136. package/dist/lib/esm/desktop-request-url-stream.d.mts +22 -0
  137. package/dist/lib/esm/desktop-request-url-stream.mjs +170 -0
  138. package/dist/lib/esm/editor-suggest-registrar.d.mts +14 -2
  139. package/dist/lib/esm/editor-suggest-registrar.mjs +8 -2
  140. package/dist/lib/esm/editor-suggest.d.mts +103 -0
  141. package/dist/lib/esm/editor-suggest.mjs +108 -0
  142. package/dist/lib/esm/feature-request.d.mts +54 -0
  143. package/dist/lib/esm/feature-request.mjs +25 -0
  144. package/dist/lib/esm/generated-during-build.mjs +2 -2
  145. package/dist/lib/esm/git-hub-discussion.d.mts +28 -0
  146. package/dist/lib/esm/git-hub-discussion.mjs +13 -0
  147. package/dist/lib/esm/git-rename-history.d.mts +43 -0
  148. package/dist/lib/esm/git-rename-history.mjs +59 -0
  149. package/dist/lib/esm/hotkey.d.mts +59 -0
  150. package/dist/lib/esm/hotkey.mjs +95 -0
  151. package/dist/lib/esm/i18n/locales/en.d.mts +12 -0
  152. package/dist/lib/esm/i18n/locales/en.mjs +13 -1
  153. package/dist/lib/esm/i18n/locales/translations-map.d.mts +12 -0
  154. package/dist/lib/esm/index.d.mts +15 -0
  155. package/dist/lib/esm/index.mjs +31 -1
  156. package/dist/lib/esm/inline-token-renderer.d.mts +88 -0
  157. package/dist/lib/esm/inline-token-renderer.mjs +59 -0
  158. package/dist/lib/esm/link-and-tag-input-suggest.d.mts +229 -0
  159. package/dist/lib/esm/link-and-tag-input-suggest.mjs +239 -0
  160. package/dist/lib/esm/markdown-code-block-processor.d.mts +18 -0
  161. package/dist/lib/esm/markdown-code-block-processor.mjs +16 -1
  162. package/dist/lib/esm/markdown.d.mts +10 -1
  163. package/dist/lib/esm/markdown.mjs +9 -1
  164. package/dist/lib/esm/rendered-markdown.d.mts +77 -0
  165. package/dist/lib/esm/rendered-markdown.mjs +219 -0
  166. package/dist/lib/esm/request-url.d.mts +233 -0
  167. package/dist/lib/esm/request-url.mjs +428 -0
  168. package/dist/lib/esm/setting-components/folder-list-component.d.mts +73 -0
  169. package/dist/lib/esm/setting-components/folder-list-component.mjs +131 -0
  170. package/dist/lib/esm/setting-components/hotkey-component.d.mts +85 -0
  171. package/dist/lib/esm/setting-components/hotkey-component.mjs +178 -0
  172. package/dist/lib/esm/setting-components/index.d.mts +4 -0
  173. package/dist/lib/esm/setting-components/index.mjs +9 -1
  174. package/dist/lib/esm/setting-components/list-component.d.mts +106 -0
  175. package/dist/lib/esm/setting-components/list-component.mjs +206 -0
  176. package/dist/lib/esm/setting-components/tag-list-component.d.mts +82 -0
  177. package/dist/lib/esm/setting-components/tag-list-component.mjs +131 -0
  178. package/dist/lib/esm/setting-ex.d.mts +35 -1
  179. package/dist/lib/esm/setting-ex.mjs +51 -1
  180. package/dist/lib/esm/settings-tabs.d.mts +101 -0
  181. package/dist/lib/esm/settings-tabs.mjs +170 -0
  182. package/dist/lib/esm/vault.d.mts +3 -1
  183. package/dist/lib/esm/vault.mjs +2 -2
  184. package/dist/styles.css +83 -1
  185. package/package.json +2 -2
  186. package/setting-components/folder-list-component/package.json +6 -0
  187. package/setting-components/hotkey-component/package.json +6 -0
  188. package/setting-components/list-component/package.json +6 -0
  189. package/setting-components/tag-list-component/package.json +6 -0
@@ -0,0 +1,233 @@
1
+ /// <reference path="./library-references.d.cts" />
2
+ /// <reference lib="dom" />
3
+ /// <reference lib="dom.iterable" />
4
+ /**
5
+ * @file
6
+ *
7
+ * A wrapper over Obsidian's {@link requestUrl} that fills the gaps plugins keep hand-rolling: an abort signal and a
8
+ * timeout, request bodies beyond `string | ArrayBuffer` (`FormData`, `URLSearchParams`, `Blob`, typed arrays and
9
+ * streams), an error that carries the status and the body, an up-front protocol check, a streamed response body, and
10
+ * a `fetch`-compatible adapter that third-party SDKs can take.
11
+ *
12
+ * `requestUrl` itself cannot be cancelled: an abort or a timeout settles the returned promise at once, while the
13
+ * underlying request runs to completion and its result is dropped. The streamed variant really cancels on desktop,
14
+ * where it goes through `node:http` / `node:https`; that module is imported dynamically, so this one stays
15
+ * cross-platform-loadable. On mobile the streamed variant falls back to `requestUrl` and delivers the whole body as a
16
+ * single chunk.
17
+ */
18
+ import type { RequestUrlResponse } from 'obsidian' with { 'resolution-mode': 'import' };
19
+ /**
20
+ * Options for {@link createRequestUrlFetch}.
21
+ */
22
+ export interface CreateRequestUrlFetchOptions {
23
+ /**
24
+ * Whether to stream the response body through {@link requestUrlStream} rather than buffer it. Streaming is real on
25
+ * desktop only; on mobile the body still arrives as one chunk. Defaults to `false`.
26
+ */
27
+ readonly shouldStream?: boolean;
28
+ /**
29
+ * The timeout in milliseconds applied to every request, on top of the request's own `signal`.
30
+ */
31
+ readonly timeoutInMilliseconds?: number;
32
+ }
33
+ /**
34
+ * The request in the form the transports take: validated, with the body encoded.
35
+ */
36
+ export interface EncodedRequestUrlRequest {
37
+ /**
38
+ * Aborts the request.
39
+ */
40
+ readonly abortSignal: AbortSignal;
41
+ /**
42
+ * The encoded body.
43
+ */
44
+ readonly body?: ArrayBuffer | string;
45
+ /**
46
+ * The request headers, including the content type.
47
+ */
48
+ readonly headers: Readonly<Record<string, string>>;
49
+ /**
50
+ * The HTTP method, uppercase.
51
+ */
52
+ readonly method: string;
53
+ /**
54
+ * The URL.
55
+ */
56
+ readonly url: string;
57
+ }
58
+ /**
59
+ * Parameters for {@link encodeRequestUrlRequest}.
60
+ */
61
+ export type EncodeRequestUrlRequestParams = RequestUrlExParams;
62
+ /**
63
+ * Parameters for the {@link RequestUrlError} constructor.
64
+ */
65
+ export interface RequestUrlErrorConstructorParams {
66
+ /**
67
+ * The response headers.
68
+ */
69
+ readonly headers: Readonly<Record<string, string>>;
70
+ /**
71
+ * The HTTP method.
72
+ */
73
+ readonly method: string;
74
+ /**
75
+ * The status code.
76
+ */
77
+ readonly status: number;
78
+ /**
79
+ * The response body as text.
80
+ */
81
+ readonly text: string;
82
+ /**
83
+ * The URL.
84
+ */
85
+ readonly url: string;
86
+ }
87
+ /**
88
+ * A request body {@link requestUrlEx} accepts: everything `fetch` accepts.
89
+ */
90
+ export type RequestUrlExBody = ArrayBuffer | ArrayBufferView | Blob | FormData | ReadableStream<Uint8Array> | string | URLSearchParams;
91
+ /**
92
+ * Parameters for {@link requestUrlEx}.
93
+ */
94
+ export interface RequestUrlExParams {
95
+ /**
96
+ * Aborts the request. The promise rejects with the signal's reason.
97
+ */
98
+ readonly abortSignal?: AbortSignal | undefined;
99
+ /**
100
+ * The request body.
101
+ */
102
+ readonly body?: RequestUrlExBody | undefined;
103
+ /**
104
+ * The content type. When omitted, it is derived from the body: a `FormData` body gets `multipart/form-data` with its
105
+ * boundary, a `URLSearchParams` body `application/x-www-form-urlencoded` and a `Blob` body its own type — unless
106
+ * {@link RequestUrlExParams.headers} already carries a `Content-Type`.
107
+ */
108
+ readonly contentType?: string | undefined;
109
+ /**
110
+ * The request headers.
111
+ */
112
+ readonly headers?: Readonly<Record<string, string>> | undefined;
113
+ /**
114
+ * The HTTP method. Defaults to `GET`.
115
+ */
116
+ readonly method?: string | undefined;
117
+ /**
118
+ * Whether to throw a {@link RequestUrlError} when the status code is 400 or higher. Defaults to `true`.
119
+ */
120
+ readonly shouldThrowOnHttpError?: boolean | undefined;
121
+ /**
122
+ * The timeout in milliseconds. The promise rejects with a `TimeoutError` {@link DOMException} once it elapses.
123
+ */
124
+ readonly timeoutInMilliseconds?: number | undefined;
125
+ /**
126
+ * The URL. Only `http:` and `https:` URLs are accepted.
127
+ */
128
+ readonly url: string;
129
+ }
130
+ /**
131
+ * A `fetch`-compatible function built on {@link requestUrl}.
132
+ */
133
+ export type RequestUrlFetch = (input: Request | string | URL, init?: RequestInit) => Promise<Response>;
134
+ /**
135
+ * Parameters for {@link requestUrlStream}.
136
+ */
137
+ export type RequestUrlStreamParams = RequestUrlExParams;
138
+ /**
139
+ * The response of {@link requestUrlStream}.
140
+ */
141
+ export interface RequestUrlStreamResponse {
142
+ /**
143
+ * The response body.
144
+ */
145
+ readonly body: ReadableStream<Uint8Array>;
146
+ /**
147
+ * The response headers, with lowercase names.
148
+ */
149
+ readonly headers: Readonly<Record<string, string>>;
150
+ /**
151
+ * The status code.
152
+ */
153
+ readonly status: number;
154
+ /**
155
+ * The final URL, after any redirects.
156
+ */
157
+ readonly url: string;
158
+ }
159
+ /**
160
+ * The error {@link requestUrlEx} and {@link requestUrlStream} throw for a status code of 400 or higher.
161
+ */
162
+ export declare class RequestUrlError extends Error {
163
+ /**
164
+ * The response headers.
165
+ */
166
+ readonly headers: Readonly<Record<string, string>>;
167
+ /**
168
+ * The HTTP method.
169
+ */
170
+ readonly method: string;
171
+ /**
172
+ * The status code.
173
+ */
174
+ readonly status: number;
175
+ /**
176
+ * The response body as text.
177
+ */
178
+ readonly text: string;
179
+ /**
180
+ * The URL.
181
+ */
182
+ readonly url: string;
183
+ /**
184
+ * Creates a {@link RequestUrlError}.
185
+ *
186
+ * @param params - The failed request and its response.
187
+ */
188
+ constructor(params: RequestUrlErrorConstructorParams);
189
+ /**
190
+ * Parses the response body as JSON.
191
+ *
192
+ * @returns The parsed body.
193
+ */
194
+ json(): unknown;
195
+ }
196
+ /**
197
+ * Creates a `fetch`-compatible function built on {@link requestUrl}, for SDKs that take a custom `fetch` (OpenAI,
198
+ * LangChain, OAuth clients) and would otherwise hit CORS.
199
+ *
200
+ * Unlike `fetch`, it never rejects on an HTTP error status: it resolves with a {@link Response} carrying that status,
201
+ * exactly as `fetch` does. It rejects with a `TypeError` for a URL that is not `http:` or `https:`.
202
+ *
203
+ * @param options - The options.
204
+ * @returns The `fetch`-compatible function.
205
+ */
206
+ export declare function createRequestUrlFetch(options?: CreateRequestUrlFetchOptions): RequestUrlFetch;
207
+ /**
208
+ * Encodes a request for a transport: validates the URL, combines the abort signal with the timeout, encodes the body
209
+ * and settles the content type.
210
+ *
211
+ * @param params - The request.
212
+ * @returns The encoded request.
213
+ */
214
+ export declare function encodeRequestUrlRequest(params: EncodeRequestUrlRequestParams): Promise<EncodedRequestUrlRequest>;
215
+ /**
216
+ * Requests a URL through {@link requestUrl}, with an abort signal, a timeout, richer bodies, a protocol check and a
217
+ * {@link RequestUrlError} for an HTTP error status.
218
+ *
219
+ * @param params - The request.
220
+ * @returns The response.
221
+ */
222
+ export declare function requestUrlEx(params: RequestUrlExParams): Promise<RequestUrlResponse>;
223
+ /**
224
+ * Requests a URL and returns its body as a stream.
225
+ *
226
+ * On desktop the request goes through `node:http` / `node:https`, so the body streams as it arrives, an abort really
227
+ * cancels the request, and redirects are followed. On mobile it falls back to {@link requestUrl}, and the whole body
228
+ * arrives as a single chunk.
229
+ *
230
+ * @param params - The request.
231
+ * @returns The response, with a streamed body.
232
+ */
233
+ export declare function requestUrlStream(params: RequestUrlStreamParams): Promise<RequestUrlStreamResponse>;
@@ -0,0 +1,216 @@
1
+ /*
2
+ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
3
+ if you want to view the source, please visit the github repository of this plugin
4
+ */
5
+ (function () {
6
+ function ensureBrowserProcess() {
7
+ const browserProcess = {
8
+ browser: true,
9
+ cwd() {
10
+ return "/";
11
+ },
12
+ env: {},
13
+ platform: "android"
14
+ };
15
+ const existingProcess = globalThis.process;
16
+ if (!existingProcess) {
17
+ globalThis.process = browserProcess;
18
+ return;
19
+ }
20
+ if (existingProcess.versions?.node) {
21
+ return;
22
+ }
23
+ const existingProcessRecord = existingProcess;
24
+ for (const [key, value] of Object.entries(browserProcess)) {
25
+ existingProcessRecord[key] ??= value;
26
+ }
27
+ existingProcessRecord["browser"] = true;
28
+ }
29
+
30
+ ensureBrowserProcess();
31
+ })();
32
+ (function patchObsidianRequire() {
33
+ const originalRequire = require;
34
+ if (!originalRequire || originalRequire.__isPatched) {
35
+ return;
36
+ }
37
+ require = Object.assign(
38
+ (id) => requirePatched(id),
39
+ originalRequire,
40
+ {
41
+ __isPatched: true
42
+ }
43
+ );
44
+ function extractDefault($module) {
45
+ return $module && $module.__esModule && "default" in $module ? $module.default : $module;
46
+ }
47
+ const OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
48
+ "@codemirror/autocomplete",
49
+ "@codemirror/collab",
50
+ "@codemirror/commands",
51
+ "@codemirror/language",
52
+ "@codemirror/lint",
53
+ "@codemirror/search",
54
+ "@codemirror/state",
55
+ "@codemirror/text",
56
+ "@codemirror/view",
57
+ "@lezer/common",
58
+ "@lezer/highlight",
59
+ "@lezer/lr",
60
+ "obsidian"
61
+ ]);
62
+ const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
63
+ "@codemirror/closebrackets",
64
+ "@codemirror/comment",
65
+ "@codemirror/fold",
66
+ "@codemirror/gutter",
67
+ "@codemirror/highlight",
68
+ "@codemirror/history",
69
+ "@codemirror/matchbrackets",
70
+ "@codemirror/panel",
71
+ "@codemirror/rangeset",
72
+ "@codemirror/rectangular-selection",
73
+ "@codemirror/stream-parser",
74
+ "@codemirror/tooltip"
75
+ ]);
76
+ function requirePatched(id) {
77
+ if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
78
+ return originalRequire?.(id);
79
+ }
80
+ const app = globalThis.app;
81
+ if (app?.isMobile) {
82
+ if (id === "process" || id === "node:process") {
83
+ console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
84
+ return process;
85
+ }
86
+ } else {
87
+ const $module = originalRequire?.(id);
88
+ if ($module) {
89
+ return extractDefault($module);
90
+ }
91
+ }
92
+ console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
93
+ return {};
94
+ }
95
+ })();
96
+
97
+ "use strict";
98
+ var __defProp = Object.defineProperty;
99
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
100
+ var __getOwnPropNames = Object.getOwnPropertyNames;
101
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
102
+ var __export = (target, all) => {
103
+ for (var name in all)
104
+ __defProp(target, name, { get: all[name], enumerable: true });
105
+ };
106
+ var __copyProps = (to, from, except, desc) => {
107
+ if (from && typeof from === "object" || typeof from === "function") {
108
+ for (let key of __getOwnPropNames(from))
109
+ if (!__hasOwnProp.call(to, key) && key !== except)
110
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
111
+ }
112
+ return to;
113
+ };
114
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
115
+ var folder_list_component_exports = {};
116
+ __export(folder_list_component_exports, {
117
+ FolderInputSuggest: () => FolderInputSuggest,
118
+ FolderListComponent: () => FolderListComponent
119
+ });
120
+ module.exports = __toCommonJS(folder_list_component_exports);
121
+ var import_obsidian = require('obsidian');
122
+ var import_css_class = require('../css-class.cjs');
123
+ var import_list_component = require('./list-component.cjs');
124
+ class FolderInputSuggest extends import_obsidian.AbstractInputSuggest {
125
+ /**
126
+ * The input the suggest completes.
127
+ */
128
+ inputEl;
129
+ /**
130
+ * Creates a new folder suggest.
131
+ *
132
+ * @param app - The Obsidian app.
133
+ * @param inputEl - The input.
134
+ */
135
+ constructor(app, inputEl) {
136
+ super(app, inputEl);
137
+ this.inputEl = inputEl;
138
+ }
139
+ /**
140
+ * Renders a folder.
141
+ *
142
+ * @param folder - The folder.
143
+ * @param el - The element to render into.
144
+ */
145
+ renderSuggestion(folder, el) {
146
+ el.setText(getFolderDisplayPath(folder));
147
+ }
148
+ /**
149
+ * Puts the folder path into the input, dispatches an `input` event, then calls the `onSelect` callback.
150
+ *
151
+ * @param folder - The folder.
152
+ * @param $event - The event that picked it.
153
+ */
154
+ selectSuggestion(folder, $event) {
155
+ this.setValue(getFolderDisplayPath(folder));
156
+ this.inputEl.dispatchEvent(new Event("input", { bubbles: true }));
157
+ super.selectSuggestion(folder, $event);
158
+ this.close();
159
+ }
160
+ /**
161
+ * Gets the folders matching the typed text.
162
+ *
163
+ * @param query - The typed text.
164
+ * @returns The folders, best match first.
165
+ */
166
+ getSuggestions(query) {
167
+ const fuzzySearch = (0, import_obsidian.prepareFuzzySearch)(query.trim());
168
+ const results = [];
169
+ for (const folder of this.app.vault.getAllFolders(true)) {
170
+ const match = fuzzySearch(getFolderDisplayPath(folder));
171
+ if (match) {
172
+ results.push({ folder, score: match.score });
173
+ }
174
+ }
175
+ results.sort((result1, result2) => result2.score - result1.score);
176
+ return results.map((result) => result.folder);
177
+ }
178
+ }
179
+ class FolderListComponent extends import_list_component.ListComponent {
180
+ /**
181
+ * The folder suggest attached to {@link ListComponent.newItemInputEl}.
182
+ */
183
+ suggest;
184
+ /**
185
+ * Creates a new folder list component.
186
+ *
187
+ * @param containerEl - The container element.
188
+ * @param app - The Obsidian app.
189
+ */
190
+ constructor(containerEl, app) {
191
+ super(containerEl, import_css_class.CssClass.FolderListComponent);
192
+ this.suggest = new FolderInputSuggest(app, this.newItemInputEl);
193
+ this.suggest.onSelect(() => {
194
+ this.addTypedItem();
195
+ });
196
+ }
197
+ /**
198
+ * Normalizes a typed folder path.
199
+ *
200
+ * @param text - The typed text.
201
+ * @returns The normalized path, or `null` for empty text.
202
+ */
203
+ normalizeItem(text) {
204
+ const path = text.trim();
205
+ return path ? (0, import_obsidian.normalizePath)(path) : null;
206
+ }
207
+ }
208
+ function getFolderDisplayPath(folder) {
209
+ return folder.isRoot() ? "/" : folder.path;
210
+ }
211
+ // Annotate the CommonJS export names for ESM import in node:
212
+ 0 && (module.exports = {
213
+ FolderInputSuggest,
214
+ FolderListComponent
215
+ });
216
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9zZXR0aW5nLWNvbXBvbmVudHMvZm9sZGVyLWxpc3QtY29tcG9uZW50LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGZpbGVcbiAqXG4gKiBDb250YWlucyBhIGNvbXBvbmVudCB0aGF0IGVkaXRzIGEgcmVvcmRlcmFibGUgbGlzdCBvZiBmb2xkZXJzLCB3aXRoIGEgZm9sZGVyIHN1Z2dlc3QuXG4gKi9cblxuaW1wb3J0IHR5cGUge1xuICBBcHAsXG4gIFRGb2xkZXJcbn0gZnJvbSAnb2JzaWRpYW4nO1xuXG5pbXBvcnQge1xuICBBYnN0cmFjdElucHV0U3VnZ2VzdCxcbiAgbm9ybWFsaXplUGF0aCxcbiAgcHJlcGFyZUZ1enp5U2VhcmNoXG59IGZyb20gJ29ic2lkaWFuJztcblxuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFycyAtLSBXZSBuZWVkIHRvIGltcG9ydCBgU2V0dGluZ0V4YCB0byB1c2UgaXQgaW4gdGhlIHRzZG9jcy5cbmltcG9ydCB0eXBlIHsgU2V0dGluZ0V4IH0gZnJvbSAnLi4vc2V0dGluZy1leC50cyc7XG5cbmltcG9ydCB7IENzc0NsYXNzIH0gZnJvbSAnLi4vY3NzLWNsYXNzLnRzJztcbmltcG9ydCB7I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RCxVQUFNLE9BQU8sS0FBSyxLQUFLO0FBQ3ZCLFdBQU8sV0FBTywrQkFBYyxJQUFJLElBQUk7QUFBQSxFQUN0QztBQUNGO0FBRUEsU0FBUyxxQkFBcUIsUUFBeUI7QUFDckQsU0FBTyxPQUFPLE9BQU8sSUFBSSxNQUFNLE9BQU87QUFDeEM7IiwibmFtZXMiOltdfQ==
@@ -0,0 +1,73 @@
1
+ /// <reference path="../library-references.d.cts" />
2
+ /// <reference lib="dom" />
3
+ /**
4
+ * @file
5
+ *
6
+ * Contains a component that edits a reorderable list of folders, with a folder suggest.
7
+ */
8
+ import type { App, TFolder } from 'obsidian' with { 'resolution-mode': 'import' };
9
+ import { AbstractInputSuggest } from 'obsidian';
10
+ import { ListComponent } from './list-component.cjs';
11
+ /**
12
+ * Suggests the vault's folders, the root included, in an `<input>`, matching the typed text against the folder path.
13
+ */
14
+ export declare class FolderInputSuggest extends AbstractInputSuggest<TFolder> {
15
+ /**
16
+ * The input the suggest completes.
17
+ */
18
+ protected readonly inputEl: HTMLInputElement;
19
+ /**
20
+ * Creates a new folder suggest.
21
+ *
22
+ * @param app - The Obsidian app.
23
+ * @param inputEl - The input.
24
+ */
25
+ constructor(app: App, inputEl: HTMLInputElement);
26
+ /**
27
+ * Renders a folder.
28
+ *
29
+ * @param folder - The folder.
30
+ * @param el - The element to render into.
31
+ */
32
+ renderSuggestion(folder: TFolder, el: HTMLElement): void;
33
+ /**
34
+ * Puts the folder path into the input, dispatches an `input` event, then calls the `onSelect` callback.
35
+ *
36
+ * @param folder - The folder.
37
+ * @param $event - The event that picked it.
38
+ */
39
+ selectSuggestion(folder: TFolder, $event: KeyboardEvent | MouseEvent): void;
40
+ /**
41
+ * Gets the folders matching the typed text.
42
+ *
43
+ * @param query - The typed text.
44
+ * @returns The folders, best match first.
45
+ */
46
+ protected getSuggestions(query: string): TFolder[];
47
+ }
48
+ /**
49
+ * A {@link ListComponent} of vault folder paths: the add row suggests the vault's folders, and a typed path is
50
+ * normalized with Obsidian's `normalizePath`, so the root reads as `/`. A path need not exist yet.
51
+ *
52
+ * You can add this component using {@link SettingEx.addFolderList}.
53
+ */
54
+ export declare class FolderListComponent extends ListComponent {
55
+ /**
56
+ * The folder suggest attached to {@link ListComponent.newItemInputEl}.
57
+ */
58
+ readonly suggest: FolderInputSuggest;
59
+ /**
60
+ * Creates a new folder list component.
61
+ *
62
+ * @param containerEl - The container element.
63
+ * @param app - The Obsidian app.
64
+ */
65
+ constructor(containerEl: HTMLElement, app: App);
66
+ /**
67
+ * Normalizes a typed folder path.
68
+ *
69
+ * @param text - The typed text.
70
+ * @returns The normalized path, or `null` for empty text.
71
+ */
72
+ protected normalizeItem(text: string): null | string;
73
+ }