@real1ty-obsidian-plugins/utils 2.28.0 → 2.30.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 (236) hide show
  1. package/package.json +1 -1
  2. package/src/core/history.ts +45 -0
  3. package/src/core/index.ts +1 -0
  4. package/src/settings/settings-ui-builder.ts +0 -1
  5. package/dist/async/async.d.ts +0 -69
  6. package/dist/async/async.d.ts.map +0 -1
  7. package/dist/async/async.js +0 -108
  8. package/dist/async/async.js.map +0 -1
  9. package/dist/async/batch-operations.d.ts +0 -21
  10. package/dist/async/batch-operations.d.ts.map +0 -1
  11. package/dist/async/batch-operations.js +0 -60
  12. package/dist/async/batch-operations.js.map +0 -1
  13. package/dist/async/change-notifier.d.ts +0 -13
  14. package/dist/async/change-notifier.d.ts.map +0 -1
  15. package/dist/async/change-notifier.js +0 -26
  16. package/dist/async/change-notifier.js.map +0 -1
  17. package/dist/async/debounced-notifier.d.ts +0 -26
  18. package/dist/async/debounced-notifier.d.ts.map +0 -1
  19. package/dist/async/debounced-notifier.js +0 -50
  20. package/dist/async/debounced-notifier.js.map +0 -1
  21. package/dist/async/index.d.ts +0 -5
  22. package/dist/async/index.d.ts.map +0 -1
  23. package/dist/async/index.js +0 -5
  24. package/dist/async/index.js.map +0 -1
  25. package/dist/components/frontmatter-propagation-modal.d.ts +0 -17
  26. package/dist/components/frontmatter-propagation-modal.d.ts.map +0 -1
  27. package/dist/components/frontmatter-propagation-modal.js +0 -85
  28. package/dist/components/frontmatter-propagation-modal.js.map +0 -1
  29. package/dist/components/index.d.ts +0 -5
  30. package/dist/components/index.d.ts.map +0 -1
  31. package/dist/components/index.js +0 -5
  32. package/dist/components/index.js.map +0 -1
  33. package/dist/components/input-managers/base.d.ts +0 -30
  34. package/dist/components/input-managers/base.d.ts.map +0 -1
  35. package/dist/components/input-managers/base.js +0 -115
  36. package/dist/components/input-managers/base.js.map +0 -1
  37. package/dist/components/input-managers/expression.d.ts +0 -12
  38. package/dist/components/input-managers/expression.d.ts.map +0 -1
  39. package/dist/components/input-managers/expression.js +0 -56
  40. package/dist/components/input-managers/expression.js.map +0 -1
  41. package/dist/components/input-managers/index.d.ts +0 -4
  42. package/dist/components/input-managers/index.d.ts.map +0 -1
  43. package/dist/components/input-managers/index.js +0 -4
  44. package/dist/components/input-managers/index.js.map +0 -1
  45. package/dist/components/input-managers/search.d.ts +0 -6
  46. package/dist/components/input-managers/search.d.ts.map +0 -1
  47. package/dist/components/input-managers/search.js +0 -16
  48. package/dist/components/input-managers/search.js.map +0 -1
  49. package/dist/components/registered-events-component.d.ts +0 -30
  50. package/dist/components/registered-events-component.d.ts.map +0 -1
  51. package/dist/components/registered-events-component.js +0 -43
  52. package/dist/components/registered-events-component.js.map +0 -1
  53. package/dist/components/whats-new-modal.d.ts +0 -64
  54. package/dist/components/whats-new-modal.d.ts.map +0 -1
  55. package/dist/components/whats-new-modal.js +0 -139
  56. package/dist/components/whats-new-modal.js.map +0 -1
  57. package/dist/core/color-utils.d.ts +0 -17
  58. package/dist/core/color-utils.d.ts.map +0 -1
  59. package/dist/core/color-utils.js +0 -29
  60. package/dist/core/color-utils.js.map +0 -1
  61. package/dist/core/css-utils.d.ts +0 -39
  62. package/dist/core/css-utils.d.ts.map +0 -1
  63. package/dist/core/css-utils.js +0 -60
  64. package/dist/core/css-utils.js.map +0 -1
  65. package/dist/core/evaluator/base.d.ts +0 -22
  66. package/dist/core/evaluator/base.d.ts.map +0 -1
  67. package/dist/core/evaluator/base.js +0 -67
  68. package/dist/core/evaluator/base.js.map +0 -1
  69. package/dist/core/evaluator/color.d.ts +0 -19
  70. package/dist/core/evaluator/color.d.ts.map +0 -1
  71. package/dist/core/evaluator/color.js +0 -25
  72. package/dist/core/evaluator/color.js.map +0 -1
  73. package/dist/core/evaluator/excluded.d.ts +0 -32
  74. package/dist/core/evaluator/excluded.d.ts.map +0 -1
  75. package/dist/core/evaluator/excluded.js +0 -41
  76. package/dist/core/evaluator/excluded.js.map +0 -1
  77. package/dist/core/evaluator/filter.d.ts +0 -15
  78. package/dist/core/evaluator/filter.d.ts.map +0 -1
  79. package/dist/core/evaluator/filter.js +0 -27
  80. package/dist/core/evaluator/filter.js.map +0 -1
  81. package/dist/core/evaluator/included.d.ts +0 -36
  82. package/dist/core/evaluator/included.d.ts.map +0 -1
  83. package/dist/core/evaluator/included.js +0 -51
  84. package/dist/core/evaluator/included.js.map +0 -1
  85. package/dist/core/evaluator/index.d.ts +0 -6
  86. package/dist/core/evaluator/index.d.ts.map +0 -1
  87. package/dist/core/evaluator/index.js +0 -6
  88. package/dist/core/evaluator/index.js.map +0 -1
  89. package/dist/core/expression-utils.d.ts +0 -17
  90. package/dist/core/expression-utils.d.ts.map +0 -1
  91. package/dist/core/expression-utils.js +0 -40
  92. package/dist/core/expression-utils.js.map +0 -1
  93. package/dist/core/frontmatter-value.d.ts +0 -157
  94. package/dist/core/frontmatter-value.d.ts.map +0 -1
  95. package/dist/core/frontmatter-value.js +0 -417
  96. package/dist/core/frontmatter-value.js.map +0 -1
  97. package/dist/core/generate.d.ts +0 -7
  98. package/dist/core/generate.d.ts.map +0 -1
  99. package/dist/core/generate.js +0 -13
  100. package/dist/core/generate.js.map +0 -1
  101. package/dist/core/index.d.ts +0 -10
  102. package/dist/core/index.d.ts.map +0 -1
  103. package/dist/core/index.js +0 -10
  104. package/dist/core/index.js.map +0 -1
  105. package/dist/core/indexer.d.ts +0 -109
  106. package/dist/core/indexer.d.ts.map +0 -1
  107. package/dist/core/indexer.js +0 -185
  108. package/dist/core/indexer.js.map +0 -1
  109. package/dist/core/property-renderer.d.ts +0 -9
  110. package/dist/core/property-renderer.d.ts.map +0 -1
  111. package/dist/core/property-renderer.js +0 -42
  112. package/dist/core/property-renderer.js.map +0 -1
  113. package/dist/core/validation.d.ts +0 -13
  114. package/dist/core/validation.d.ts.map +0 -1
  115. package/dist/core/validation.js +0 -27
  116. package/dist/core/validation.js.map +0 -1
  117. package/dist/date/date-recurrence.d.ts +0 -30
  118. package/dist/date/date-recurrence.d.ts.map +0 -1
  119. package/dist/date/date-recurrence.js +0 -188
  120. package/dist/date/date-recurrence.js.map +0 -1
  121. package/dist/date/date.d.ts +0 -21
  122. package/dist/date/date.d.ts.map +0 -1
  123. package/dist/date/date.js +0 -105
  124. package/dist/date/date.js.map +0 -1
  125. package/dist/date/index.d.ts +0 -3
  126. package/dist/date/index.d.ts.map +0 -1
  127. package/dist/date/index.js +0 -3
  128. package/dist/date/index.js.map +0 -1
  129. package/dist/file/child-reference.d.ts +0 -9
  130. package/dist/file/child-reference.d.ts.map +0 -1
  131. package/dist/file/child-reference.js +0 -57
  132. package/dist/file/child-reference.js.map +0 -1
  133. package/dist/file/file-operations.d.ts +0 -31
  134. package/dist/file/file-operations.d.ts.map +0 -1
  135. package/dist/file/file-operations.js +0 -160
  136. package/dist/file/file-operations.js.map +0 -1
  137. package/dist/file/file-utils.d.ts +0 -33
  138. package/dist/file/file-utils.d.ts.map +0 -1
  139. package/dist/file/file-utils.js +0 -76
  140. package/dist/file/file-utils.js.map +0 -1
  141. package/dist/file/file.d.ts +0 -332
  142. package/dist/file/file.d.ts.map +0 -1
  143. package/dist/file/file.js +0 -559
  144. package/dist/file/file.js.map +0 -1
  145. package/dist/file/frontmatter-diff.d.ts +0 -38
  146. package/dist/file/frontmatter-diff.d.ts.map +0 -1
  147. package/dist/file/frontmatter-diff.js +0 -162
  148. package/dist/file/frontmatter-diff.js.map +0 -1
  149. package/dist/file/frontmatter-propagation.d.ts +0 -4
  150. package/dist/file/frontmatter-propagation.d.ts.map +0 -1
  151. package/dist/file/frontmatter-propagation.js +0 -28
  152. package/dist/file/frontmatter-propagation.js.map +0 -1
  153. package/dist/file/frontmatter-serialization.d.ts +0 -21
  154. package/dist/file/frontmatter-serialization.d.ts.map +0 -1
  155. package/dist/file/frontmatter-serialization.js +0 -57
  156. package/dist/file/frontmatter-serialization.js.map +0 -1
  157. package/dist/file/frontmatter.d.ts +0 -15
  158. package/dist/file/frontmatter.d.ts.map +0 -1
  159. package/dist/file/frontmatter.js +0 -68
  160. package/dist/file/frontmatter.js.map +0 -1
  161. package/dist/file/index.d.ts +0 -13
  162. package/dist/file/index.d.ts.map +0 -1
  163. package/dist/file/index.js +0 -13
  164. package/dist/file/index.js.map +0 -1
  165. package/dist/file/link-parser.d.ts +0 -63
  166. package/dist/file/link-parser.d.ts.map +0 -1
  167. package/dist/file/link-parser.js +0 -137
  168. package/dist/file/link-parser.js.map +0 -1
  169. package/dist/file/property-utils.d.ts +0 -55
  170. package/dist/file/property-utils.d.ts.map +0 -1
  171. package/dist/file/property-utils.js +0 -90
  172. package/dist/file/property-utils.js.map +0 -1
  173. package/dist/file/templater-service.d.ts +0 -16
  174. package/dist/file/templater-service.d.ts.map +0 -1
  175. package/dist/file/templater-service.js +0 -37
  176. package/dist/file/templater-service.js.map +0 -1
  177. package/dist/file/templater.d.ts +0 -28
  178. package/dist/file/templater.d.ts.map +0 -1
  179. package/dist/file/templater.js +0 -126
  180. package/dist/file/templater.js.map +0 -1
  181. package/dist/index.d.ts +0 -9
  182. package/dist/index.d.ts.map +0 -1
  183. package/dist/index.js +0 -17
  184. package/dist/index.js.map +0 -1
  185. package/dist/inputs/index.d.ts +0 -2
  186. package/dist/inputs/index.d.ts.map +0 -1
  187. package/dist/inputs/index.js +0 -2
  188. package/dist/inputs/index.js.map +0 -1
  189. package/dist/inputs/input-filter-manager.d.ts +0 -72
  190. package/dist/inputs/input-filter-manager.d.ts.map +0 -1
  191. package/dist/inputs/input-filter-manager.js +0 -140
  192. package/dist/inputs/input-filter-manager.js.map +0 -1
  193. package/dist/settings/index.d.ts +0 -3
  194. package/dist/settings/index.d.ts.map +0 -1
  195. package/dist/settings/index.js +0 -3
  196. package/dist/settings/index.js.map +0 -1
  197. package/dist/settings/settings-store.d.ts +0 -20
  198. package/dist/settings/settings-store.d.ts.map +0 -1
  199. package/dist/settings/settings-store.js +0 -82
  200. package/dist/settings/settings-store.js.map +0 -1
  201. package/dist/settings/settings-ui-builder.d.ts +0 -74
  202. package/dist/settings/settings-ui-builder.d.ts.map +0 -1
  203. package/dist/settings/settings-ui-builder.js +0 -437
  204. package/dist/settings/settings-ui-builder.js.map +0 -1
  205. package/dist/string/changelog-parser.d.ts +0 -17
  206. package/dist/string/changelog-parser.d.ts.map +0 -1
  207. package/dist/string/changelog-parser.js +0 -77
  208. package/dist/string/changelog-parser.js.map +0 -1
  209. package/dist/string/filename-utils.d.ts +0 -46
  210. package/dist/string/filename-utils.d.ts.map +0 -1
  211. package/dist/string/filename-utils.js +0 -65
  212. package/dist/string/filename-utils.js.map +0 -1
  213. package/dist/string/index.d.ts +0 -4
  214. package/dist/string/index.d.ts.map +0 -1
  215. package/dist/string/index.js +0 -4
  216. package/dist/string/index.js.map +0 -1
  217. package/dist/string/string.d.ts +0 -5
  218. package/dist/string/string.d.ts.map +0 -1
  219. package/dist/string/string.js +0 -25
  220. package/dist/string/string.js.map +0 -1
  221. package/dist/testing/index.d.ts +0 -5
  222. package/dist/testing/index.d.ts.map +0 -1
  223. package/dist/testing/index.js +0 -6
  224. package/dist/testing/index.js.map +0 -1
  225. package/dist/testing/mocks/obsidian.d.ts +0 -150
  226. package/dist/testing/mocks/obsidian.d.ts.map +0 -1
  227. package/dist/testing/mocks/obsidian.js +0 -226
  228. package/dist/testing/mocks/obsidian.js.map +0 -1
  229. package/dist/testing/mocks/utils.d.ts +0 -14
  230. package/dist/testing/mocks/utils.d.ts.map +0 -1
  231. package/dist/testing/mocks/utils.js +0 -85
  232. package/dist/testing/mocks/utils.js.map +0 -1
  233. package/dist/testing/setup.d.ts +0 -2
  234. package/dist/testing/setup.d.ts.map +0 -1
  235. package/dist/testing/setup.js +0 -18
  236. package/dist/testing/setup.js.map +0 -1
@@ -1,332 +0,0 @@
1
- import type { App, CachedMetadata } from "obsidian";
2
- import { TFile } from "obsidian";
3
- /**
4
- * Retrieves a TFile object from the vault by its path.
5
- * Handles path normalization using Obsidian's normalizePath utility.
6
- *
7
- * **Important**: Obsidian file paths ALWAYS include the `.md` extension.
8
- * The TFile.path property returns paths like "folder/file.md", not "folder/file".
9
- *
10
- * @param app - The Obsidian App instance
11
- * @param filePath - Path to the file (will be normalized, should include .md extension)
12
- * @returns TFile if found, null otherwise
13
- *
14
- * @example
15
- * ```ts
16
- * // Correct: Include .md extension
17
- * const file = getFileByPath(app, "folder/note.md");
18
- *
19
- * // For wikilinks without extension, add .md
20
- * const linkPath = "MyNote";
21
- * const file = getFileByPath(app, `${linkPath}.md`);
22
- * ```
23
- */
24
- export declare function getFileByPath(app: App, filePath: string): TFile | null;
25
- /**
26
- * Ensures a file path includes the .md extension.
27
- * Use this when working with wikilinks or user input that may omit extensions.
28
- *
29
- * @param path - File path that may or may not include .md extension
30
- * @returns Path guaranteed to end with .md
31
- *
32
- * @example
33
- * ```ts
34
- * ensureMarkdownExtension("MyNote") // "MyNote.md"
35
- * ensureMarkdownExtension("MyNote.md") // "MyNote.md"
36
- * ensureMarkdownExtension("folder/note") // "folder/note.md"
37
- * ```
38
- */
39
- export declare function ensureMarkdownExtension(path: string): string;
40
- /**
41
- * Removes the .md extension from a file path if present.
42
- * Useful for displaying file names or creating wikilinks.
43
- *
44
- * @param path - File path that may include .md extension
45
- * @returns Path without .md extension
46
- *
47
- * @example
48
- * ```ts
49
- * removeMarkdownExtension("folder/note.md") // "folder/note"
50
- * removeMarkdownExtension("folder/note") // "folder/note"
51
- * ```
52
- */
53
- export declare function removeMarkdownExtension(path: string): string;
54
- /**
55
- * Extracts the display name from a file path or wiki link.
56
- *
57
- * Handles various formats:
58
- * - `[[path/to/file|Alias]]` -> returns "Alias"
59
- * - `[[path/to/file]]` -> returns "file"
60
- * - `path/to/file.md` -> returns "file"
61
- * - `file.md` -> returns "file"
62
- *
63
- * @param input - File path or wiki link string
64
- * @returns The display name to show in the UI
65
- */
66
- export declare function extractDisplayName(input: string): string;
67
- /**
68
- * Extracts the actual file path from a wiki link or returns the path as-is.
69
- *
70
- * Handles:
71
- * - `[[path/to/file|Alias]]` -> returns "path/to/file.md"
72
- * - `[[path/to/file]]` -> returns "path/to/file.md"
73
- * - `path/to/file.md` -> returns "path/to/file.md"
74
- *
75
- * @param input - File path or wiki link string
76
- * @returns The actual file path (with .md extension)
77
- */
78
- export declare function extractFilePath(input: string): string;
79
- export interface FileContext {
80
- path: string;
81
- pathWithExt: string;
82
- baseName: string;
83
- file: TFile | null;
84
- frontmatter: Record<string, any> | undefined;
85
- cache: CachedMetadata | null;
86
- }
87
- /**
88
- * Creates a comprehensive file context object containing all relevant file information.
89
- * Handles path normalization, file lookup, and metadata caching.
90
- */
91
- export declare function getFileContext(app: App, path: string): FileContext;
92
- /**
93
- * Helper function to work with file context that automatically handles file not found cases.
94
- * Returns null if the file doesn't exist, otherwise executes the callback with the context.
95
- */
96
- export declare function withFileContext<T>(app: App, path: string, callback: (context: FileContext) => Promise<T> | T): Promise<T | null>;
97
- /**
98
- * Generates a unique file path by appending a counter if the file already exists.
99
- * Automatically adds .md extension if not present.
100
- *
101
- * @param app - The Obsidian App instance
102
- * @param folder - Folder path (empty string for root, no trailing slash needed)
103
- * @param baseName - Base file name without extension
104
- * @returns Unique file path that doesn't exist in the vault
105
- *
106
- * @example
107
- * ```ts
108
- * // If "MyNote.md" exists, returns "MyNote 1.md"
109
- * const path = getUniqueFilePath(app, "", "MyNote");
110
- *
111
- * // With folder: "Projects/Task.md" -> "Projects/Task 1.md"
112
- * const path = getUniqueFilePath(app, "Projects", "Task");
113
- *
114
- * // Root folder handling
115
- * const path = getUniqueFilePath(app, "/", "Note"); // -> "Note.md"
116
- * ```
117
- */
118
- export declare function getUniqueFilePath(app: App, folder: string, baseName: string): string;
119
- /**
120
- * Generates a unique file path by appending a counter if the file already exists.
121
- * Accepts a complete file path and iterates with a counter suffix.
122
- *
123
- * @param app - The Obsidian App instance
124
- * @param filePath - Complete file path including folder, name, and extension
125
- * @returns Unique file path that doesn't exist in the vault
126
- *
127
- * @example
128
- * ```ts
129
- * // If "folder/note.md" exists, returns "folder/note 1.md"
130
- * const path = getUniqueFilePathFromFull(app, "folder/note.md");
131
- *
132
- * // Works with any extension
133
- * const path = getUniqueFilePathFromFull(app, "assets/image.png");
134
- * // -> "assets/image 1.png" if image.png exists
135
- * ```
136
- */
137
- export declare const getUniqueFilePathFromFull: (app: App, filePath: string) => string;
138
- /**
139
- * Generates a unique file path by appending a counter if the file already exists.
140
- * Supports custom file extensions.
141
- *
142
- * @param app - The Obsidian App instance
143
- * @param folder - Folder path (empty string for root)
144
- * @param baseName - Base file name without extension
145
- * @param extension - File extension (defaults to "md")
146
- * @returns Unique file path that doesn't exist in the vault
147
- */
148
- export declare const generateUniqueFilePath: (app: App, folder: string, baseName: string, extension?: string) => string;
149
- /**
150
- * Checks if a file is a folder note.
151
- * A folder note is a file whose name matches its parent folder name.
152
- *
153
- * @param filePath - Path to the file (e.g., "tasks/tasks.md")
154
- * @returns true if the file is a folder note, false otherwise
155
- *
156
- * @example
157
- * ```ts
158
- * isFolderNote("tasks/tasks.md") // true
159
- * isFolderNote("tasks/subtask.md") // false
160
- * isFolderNote("note.md") // false (no parent folder)
161
- * isFolderNote("projects/docs/docs.md") // true
162
- * ```
163
- */
164
- export declare function isFolderNote(filePath: string): boolean;
165
- /**
166
- * Gets the folder path for a file.
167
- *
168
- * @param filePath - Path to the file (e.g., "tasks/subtask.md")
169
- * @returns Folder path without trailing slash, or empty string if file is in root
170
- *
171
- * @example
172
- * ```ts
173
- * getFolderPath("tasks/subtask.md") // "tasks"
174
- * getFolderPath("projects/docs/notes.md") // "projects/docs"
175
- * getFolderPath("note.md") // ""
176
- * ```
177
- */
178
- export declare function getFolderPath(filePath: string): string;
179
- /**
180
- * Gets all markdown files in a specific folder (non-recursive).
181
- *
182
- * @param app - The Obsidian App instance
183
- * @param folderPath - Path to the folder (e.g., "tasks")
184
- * @returns Array of TFile objects in the folder
185
- *
186
- * @example
187
- * ```ts
188
- * const files = getFilesInFolder(app, "tasks");
189
- * // Returns [task1.md, task2.md, tasks.md] but not tasks/subtasks/file.md
190
- * ```
191
- */
192
- export declare function getFilesInFolder(app: App, folderPath: string): TFile[];
193
- /**
194
- * Gets all markdown files in a folder and its subfolders recursively.
195
- *
196
- * @param app - The Obsidian App instance
197
- * @param folderPath - Path to the folder (e.g., "tasks")
198
- * @returns Array of TFile objects in the folder tree
199
- *
200
- * @example
201
- * ```ts
202
- * const files = getAllFilesInFolderTree(app, "tasks");
203
- * // Returns all .md files in tasks/ and all its subdirectories
204
- * ```
205
- */
206
- export declare function getAllFilesInFolderTree(app: App, folderPath: string): TFile[];
207
- /**
208
- * Gets the parent file path based on folder structure.
209
- * For a file in a folder, the parent is the folder note if it exists.
210
- *
211
- * @param app - The Obsidian App instance
212
- * @param filePath - Path to the file
213
- * @returns Path to parent file, or null if no parent exists
214
- *
215
- * @example
216
- * ```ts
217
- * // If tasks/tasks.md exists
218
- * getParentByFolder(app, "tasks/subtask.md") // "tasks/tasks.md"
219
- *
220
- * // If parent folder note doesn't exist
221
- * getParentByFolder(app, "tasks/subtask.md") // null
222
- *
223
- * // Root level file
224
- * getParentByFolder(app, "note.md") // null
225
- * ```
226
- */
227
- export declare function getParentByFolder(app: App, filePath: string): string | null;
228
- /**
229
- * Gets all child file paths based on folder structure.
230
- * Works for both folder notes and regular files.
231
- *
232
- * For folder notes (e.g., "tasks/tasks.md"):
233
- * - Returns all files directly in the folder (excluding the folder note)
234
- * - Includes subfolder notes one level down
235
- *
236
- * For regular files (e.g., "tasks/task1.md"):
237
- * - Returns the folder note from matching subfolder if it exists (e.g., "tasks/task1/task1.md")
238
- *
239
- * @param app - The Obsidian App instance
240
- * @param filePath - Path to the file
241
- * @returns Array of child file paths
242
- *
243
- * @example
244
- * ```ts
245
- * // For tasks/tasks.md (folder note)
246
- * getChildrenByFolder(app, "tasks/tasks.md")
247
- * // Returns ["tasks/task1.md", "tasks/task2.md", "tasks/subtasks/subtasks.md"]
248
- *
249
- * // For tasks/task1.md (regular file with matching subfolder)
250
- * getChildrenByFolder(app, "tasks/task1.md")
251
- * // Returns ["tasks/task1/task1.md"] if it exists
252
- * ```
253
- */
254
- export declare function getChildrenByFolder(app: App, filePath: string): string[];
255
- /**
256
- * Finds all root nodes in a folder tree.
257
- * Root nodes are files at the top level of the folder (directly in the folder, not in subfolders).
258
- *
259
- * @param app - The Obsidian App instance
260
- * @param folderPath - Path to the folder
261
- * @returns Array of root file paths
262
- *
263
- * @example
264
- * ```ts
265
- * // For folder structure:
266
- * // tasks/
267
- * // tasks.md (folder note)
268
- * // task1.md
269
- * // subtasks/
270
- * // subtasks.md
271
- * // subtask1.md
272
- *
273
- * findRootNodesInFolder(app, "tasks")
274
- * // Returns ["tasks/tasks.md", "tasks/task1.md"]
275
- * // Excludes subtasks/subtasks.md and subtasks/subtask1.md (they're in subfolder)
276
- * ```
277
- */
278
- export declare function findRootNodesInFolder(app: App, folderPath: string): string[];
279
- export interface SanitizeFilenameOptions {
280
- /**
281
- * Style of sanitization to apply.
282
- * - "kebab": Convert to lowercase, replace spaces with hyphens (default, backwards compatible)
283
- * - "preserve": Preserve spaces and case, only remove invalid characters
284
- */
285
- style?: "kebab" | "preserve";
286
- }
287
- /**
288
- * Sanitizes a string for use as a filename.
289
- * Defaults to kebab-case style for backwards compatibility.
290
- *
291
- * @param input - String to sanitize
292
- * @param options - Sanitization options
293
- * @returns Sanitized filename string
294
- *
295
- * @example
296
- * // Default kebab-case style (backwards compatible)
297
- * sanitizeForFilename("My File Name") // "my-file-name"
298
- *
299
- * // Preserve spaces and case
300
- * sanitizeForFilename("My File Name", { style: "preserve" }) // "My File Name"
301
- */
302
- export declare const sanitizeForFilename: (input: string, options?: SanitizeFilenameOptions) => string;
303
- /**
304
- * Sanitizes filename using kebab-case style.
305
- * - Removes invalid characters
306
- * - Converts to lowercase
307
- * - Replaces spaces with hyphens
308
- *
309
- * Best for: CLI tools, URLs, slugs, technical files
310
- *
311
- * @example
312
- * sanitizeFilenameKebabCase("My File Name") // "my-file-name"
313
- * sanitizeFilenameKebabCase("Travel Around The World") // "travel-around-the-world"
314
- */
315
- export declare const sanitizeFilenameKebabCase: (input: string) => string;
316
- /**
317
- * Sanitizes filename while preserving spaces and case.
318
- * - Removes invalid characters only
319
- * - Preserves spaces and original casing
320
- * - Removes trailing dots (Windows compatibility)
321
- *
322
- * Best for: Note titles, human-readable filenames, Obsidian notes
323
- *
324
- * @example
325
- * sanitizeFilenamePreserveSpaces("My File Name") // "My File Name"
326
- * sanitizeFilenamePreserveSpaces("Travel Around The World") // "Travel Around The World"
327
- * sanitizeFilenamePreserveSpaces("File<Invalid>Chars") // "FileInvalidChars"
328
- */
329
- export declare const sanitizeFilenamePreserveSpaces: (input: string) => string;
330
- export declare const getFilenameFromPath: (filePath: string) => string;
331
- export declare const isFileInConfiguredDirectory: (filePath: string, directory: string) => boolean;
332
- //# sourceMappingURL=file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/file/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAMhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CActE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoCxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAuBrD;AAMD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