@lapis-notes/api 0.1.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 (400) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE.md +4 -0
  3. package/README.md +43 -0
  4. package/dist/__tests__/data-adapter-conformance.js +205 -0
  5. package/dist/__tests__/lapis-runtime-manifest.js +32 -0
  6. package/dist/__tests__/svelte-internal-client.d.ts +3 -0
  7. package/dist/agent-result-views.d.ts +52 -0
  8. package/dist/agent-result-views.js +89 -0
  9. package/dist/agent-skills.d.ts +99 -0
  10. package/dist/agent-skills.js +182 -0
  11. package/dist/agent-tools.d.ts +92 -0
  12. package/dist/agent-tools.js +139 -0
  13. package/dist/app-database-host.d.ts +4 -0
  14. package/dist/app-database-host.js +4 -0
  15. package/dist/app-shell-plugin-persistence.d.ts +15 -0
  16. package/dist/app-shell-plugin-persistence.js +34 -0
  17. package/dist/app-url.d.ts +54 -0
  18. package/dist/app-url.js +269 -0
  19. package/dist/application-compatibility.d.ts +31 -0
  20. package/dist/application-compatibility.js +64 -0
  21. package/dist/application-state.svelte.d.ts +14 -0
  22. package/dist/application-state.svelte.js +30 -0
  23. package/dist/assets/lapis-logo.svg +471 -0
  24. package/dist/bases.d.ts +281 -0
  25. package/dist/bases.js +475 -0
  26. package/dist/cache.svelte.d.ts +569 -0
  27. package/dist/cache.svelte.js +1433 -0
  28. package/dist/command.svelte.d.ts +337 -0
  29. package/dist/command.svelte.js +571 -0
  30. package/dist/compat.d.ts +29 -0
  31. package/dist/compat.js +30 -0
  32. package/dist/components/configuration/configuration.css +199 -0
  33. package/dist/components/configuration/date-setting.svelte +71 -0
  34. package/dist/components/configuration/date-setting.svelte.d.ts +8 -0
  35. package/dist/components/configuration/list-setting.svelte +128 -0
  36. package/dist/components/configuration/list-setting.svelte.d.ts +13 -0
  37. package/dist/components/configuration/object-array-row-grip.svelte +78 -0
  38. package/dist/components/configuration/object-array-row-grip.svelte.d.ts +9 -0
  39. package/dist/components/configuration/object-array-row.svelte +163 -0
  40. package/dist/components/configuration/object-array-row.svelte.d.ts +19 -0
  41. package/dist/components/configuration/object-array-setting.svelte +196 -0
  42. package/dist/components/configuration/object-array-setting.svelte.d.ts +15 -0
  43. package/dist/components/configuration/object-array-table-dnd.d.ts +8 -0
  44. package/dist/components/configuration/object-array-table-dnd.js +10 -0
  45. package/dist/components/configuration/object-array-utils.d.ts +11 -0
  46. package/dist/components/configuration/object-array-utils.js +103 -0
  47. package/dist/components/configuration/object-grid-setting.svelte +79 -0
  48. package/dist/components/configuration/object-grid-setting.svelte.d.ts +10 -0
  49. package/dist/components/configuration/object-map-row.svelte +147 -0
  50. package/dist/components/configuration/object-map-row.svelte.d.ts +15 -0
  51. package/dist/components/configuration/object-map-setting.svelte +137 -0
  52. package/dist/components/configuration/object-map-setting.svelte.d.ts +14 -0
  53. package/dist/components/configuration/object-map-types.d.ts +5 -0
  54. package/dist/components/configuration/object-map-types.js +1 -0
  55. package/dist/components/configuration/options-combobox-setting.svelte +129 -0
  56. package/dist/components/configuration/options-combobox-setting.svelte.d.ts +12 -0
  57. package/dist/components/copy-button/button.svelte +93 -0
  58. package/dist/components/copy-button/button.svelte.d.ts +13 -0
  59. package/dist/components/copy-button/index.d.ts +2 -0
  60. package/dist/components/copy-button/index.js +2 -0
  61. package/dist/components/editor/editor.css +565 -0
  62. package/dist/components/editor/editor.d.ts +33 -0
  63. package/dist/components/editor/editor.js +132 -0
  64. package/dist/components/editor/editor.svelte +176 -0
  65. package/dist/components/editor/editor.svelte.d.ts +15 -0
  66. package/dist/components/editor/embedded-editor-surface.d.ts +12 -0
  67. package/dist/components/editor/embedded-editor-surface.js +22 -0
  68. package/dist/components/editor/embedded-editor-surface.svelte +115 -0
  69. package/dist/components/editor/embedded-editor-surface.svelte.d.ts +17 -0
  70. package/dist/components/editor/extensions/autocomplete/index.d.ts +2 -0
  71. package/dist/components/editor/extensions/autocomplete/index.js +2 -0
  72. package/dist/components/editor/extensions/autocomplete/lapis-code-mirror-autocomplete.d.ts +16 -0
  73. package/dist/components/editor/extensions/autocomplete/lapis-code-mirror-autocomplete.js +34 -0
  74. package/dist/components/editor/extensions/autocomplete/vault-completion-sources.d.ts +27 -0
  75. package/dist/components/editor/extensions/autocomplete/vault-completion-sources.js +55 -0
  76. package/dist/components/editor/extensions/class-highlighter/index.d.ts +1 -0
  77. package/dist/components/editor/extensions/class-highlighter/index.js +47 -0
  78. package/dist/components/editor/extensions/fold-gutter/index.d.ts +8 -0
  79. package/dist/components/editor/extensions/fold-gutter/index.js +40 -0
  80. package/dist/components/editor/extensions/gutter-line-style-sync/index.d.ts +2 -0
  81. package/dist/components/editor/extensions/gutter-line-style-sync/index.js +118 -0
  82. package/dist/components/editor/extensions/lint/index.d.ts +4 -0
  83. package/dist/components/editor/extensions/lint/index.js +4 -0
  84. package/dist/components/editor/extensions/lint/lapis-code-mirror-lint.d.ts +26 -0
  85. package/dist/components/editor/extensions/lint/lapis-code-mirror-lint.js +101 -0
  86. package/dist/components/editor/extensions/lint/lapis-lint-diagnostic-helpers.d.ts +8 -0
  87. package/dist/components/editor/extensions/lint/lapis-lint-diagnostic-helpers.js +7 -0
  88. package/dist/components/editor/extensions/lint/lapis-lint-diagnostic.d.ts +20 -0
  89. package/dist/components/editor/extensions/lint/lapis-lint-diagnostic.js +47 -0
  90. package/dist/components/editor/extensions/lint/lapis-lint-hover-tooltip.d.ts +9 -0
  91. package/dist/components/editor/extensions/lint/lapis-lint-hover-tooltip.js +373 -0
  92. package/dist/components/editor/extensions/lint/lapis-lint-inline-widget.d.ts +31 -0
  93. package/dist/components/editor/extensions/lint/lapis-lint-inline-widget.js +191 -0
  94. package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte +176 -0
  95. package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte.d.ts +15 -0
  96. package/dist/components/editor/extensions/lint/lint-tooltip-actions.d.ts +11 -0
  97. package/dist/components/editor/extensions/lint/lint-tooltip-actions.js +21 -0
  98. package/dist/components/editor/extensions/lint/mount-lint-tooltip.d.ts +16 -0
  99. package/dist/components/editor/extensions/lint/mount-lint-tooltip.js +60 -0
  100. package/dist/components/editor/extensions/search/dom.d.ts +2 -0
  101. package/dist/components/editor/extensions/search/dom.js +6 -0
  102. package/dist/components/editor/extensions/search/index.d.ts +35 -0
  103. package/dist/components/editor/extensions/search/index.js +44 -0
  104. package/dist/components/editor/extensions/search/search.svelte +335 -0
  105. package/dist/components/editor/extensions/search/search.svelte.d.ts +8 -0
  106. package/dist/components/editor/index.d.ts +9 -0
  107. package/dist/components/editor/index.js +9 -0
  108. package/dist/components/editor/language-service/dom.d.ts +1 -0
  109. package/dist/components/editor/language-service/dom.js +6 -0
  110. package/dist/components/editor/language-service/index.d.ts +28 -0
  111. package/dist/components/editor/language-service/index.js +342 -0
  112. package/dist/components/empty-view/empty-view.css +39 -0
  113. package/dist/components/empty-view/empty-view.svelte +26 -0
  114. package/dist/components/empty-view/empty-view.svelte.d.ts +9 -0
  115. package/dist/components/empty-view/index.d.ts +2 -0
  116. package/dist/components/empty-view/index.js +2 -0
  117. package/dist/components/icon/icon-list.css +74 -0
  118. package/dist/components/icon/icon-list.svelte +213 -0
  119. package/dist/components/icon/icon-list.svelte.d.ts +11 -0
  120. package/dist/components/icon/icon.svelte +15 -0
  121. package/dist/components/icon/icon.svelte.d.ts +7 -0
  122. package/dist/components/icon/index.d.ts +3 -0
  123. package/dist/components/icon/index.js +3 -0
  124. package/dist/components/menu/context-menu.svelte +89 -0
  125. package/dist/components/menu/context-menu.svelte.d.ts +11 -0
  126. package/dist/components/menu/drawer-menu.svelte +83 -0
  127. package/dist/components/menu/drawer-menu.svelte.d.ts +8 -0
  128. package/dist/components/menu/dropdown-menu.svelte +89 -0
  129. package/dist/components/menu/dropdown-menu.svelte.d.ts +11 -0
  130. package/dist/components/menu/index.d.ts +6 -0
  131. package/dist/components/menu/index.js +6 -0
  132. package/dist/components/menu/menu.css +139 -0
  133. package/dist/components/menu/menu.svelte +37 -0
  134. package/dist/components/menu/menu.svelte.d.ts +11 -0
  135. package/dist/components/menu/mobile-menu-query.svelte.d.ts +3 -0
  136. package/dist/components/menu/mobile-menu-query.svelte.js +21 -0
  137. package/dist/components/menu/popover-menu.svelte +90 -0
  138. package/dist/components/menu/popover-menu.svelte.d.ts +10 -0
  139. package/dist/components/select/index.d.ts +2 -0
  140. package/dist/components/select/index.js +2 -0
  141. package/dist/components/select/select.svelte +72 -0
  142. package/dist/components/select/select.svelte.d.ts +25 -0
  143. package/dist/configuration-option-source-providers.d.ts +17 -0
  144. package/dist/configuration-option-source-providers.js +59 -0
  145. package/dist/configuration-option-source-registry.d.ts +59 -0
  146. package/dist/configuration-option-source-registry.js +123 -0
  147. package/dist/configuration.svelte.d.ts +258 -0
  148. package/dist/configuration.svelte.js +887 -0
  149. package/dist/context-keys.svelte.d.ts +42 -0
  150. package/dist/context-keys.svelte.js +278 -0
  151. package/dist/context.svelte.d.ts +247 -0
  152. package/dist/context.svelte.js +540 -0
  153. package/dist/daily-document-provider.d.ts +38 -0
  154. package/dist/daily-document-provider.js +176 -0
  155. package/dist/design-core-button-types.d.ts +7 -0
  156. package/dist/design-core-button-types.js +1 -0
  157. package/dist/diagnostics.d.ts +93 -0
  158. package/dist/diagnostics.js +84 -0
  159. package/dist/dialog-portal.d.ts +3 -0
  160. package/dist/dialog-portal.js +3 -0
  161. package/dist/docs-api.d.ts +44 -0
  162. package/dist/docs-api.js +29 -0
  163. package/dist/editor-view-registry.d.ts +35 -0
  164. package/dist/editor-view-registry.js +112 -0
  165. package/dist/editor.svelte.d.ts +126 -0
  166. package/dist/editor.svelte.js +454 -0
  167. package/dist/embed-registry.d.ts +15 -0
  168. package/dist/embed-registry.js +16 -0
  169. package/dist/enhance.d.ts +111 -0
  170. package/dist/enhance.js +309 -0
  171. package/dist/events.d.ts +28 -0
  172. package/dist/events.js +49 -0
  173. package/dist/file-manager.d.ts +90 -0
  174. package/dist/file-manager.js +289 -0
  175. package/dist/file-tools/app-tools.d.ts +3 -0
  176. package/dist/file-tools/app-tools.js +242 -0
  177. package/dist/file-tools/index.d.ts +3 -0
  178. package/dist/file-tools/index.js +3 -0
  179. package/dist/file-tools/paths.d.ts +14 -0
  180. package/dist/file-tools/paths.js +33 -0
  181. package/dist/file-tools/vault-operations.d.ts +3 -0
  182. package/dist/file-tools/vault-operations.js +60 -0
  183. package/dist/generated/plugin-host-modules.schema.generated.d.ts +371 -0
  184. package/dist/generated/plugin-host-modules.schema.generated.js +374 -0
  185. package/dist/glob.d.ts +15 -0
  186. package/dist/glob.js +68 -0
  187. package/dist/history.svelte.d.ts +24 -0
  188. package/dist/history.svelte.js +74 -0
  189. package/dist/hooks/createVirtualizer.svelte.d.ts +7 -0
  190. package/dist/hooks/createVirtualizer.svelte.js +70 -0
  191. package/dist/hooks/index.d.ts +5 -0
  192. package/dist/hooks/index.js +5 -0
  193. package/dist/hooks/is-mobile.svelte.d.ts +5 -0
  194. package/dist/hooks/is-mobile.svelte.js +23 -0
  195. package/dist/hooks/mountComponent.svelte.d.ts +7 -0
  196. package/dist/hooks/mountComponent.svelte.js +16 -0
  197. package/dist/hooks/use-text-highlight.d.ts +17 -0
  198. package/dist/hooks/use-text-highlight.js +82 -0
  199. package/dist/hooks/useBoundingRect.svelte.d.ts +11 -0
  200. package/dist/hooks/useBoundingRect.svelte.js +46 -0
  201. package/dist/icons/index.d.ts +57 -0
  202. package/dist/icons/index.js +288 -0
  203. package/dist/index.d.ts +87 -0
  204. package/dist/index.js +87 -0
  205. package/dist/language-service/index.d.ts +9 -0
  206. package/dist/language-service/index.js +7 -0
  207. package/dist/language-service/manager.d.ts +47 -0
  208. package/dist/language-service/manager.js +404 -0
  209. package/dist/language-service/types.d.ts +92 -0
  210. package/dist/language-service/types.js +1 -0
  211. package/dist/language-service/virtual-document.d.ts +11 -0
  212. package/dist/language-service/virtual-document.js +45 -0
  213. package/dist/language-service/worker-protocol.d.ts +63 -0
  214. package/dist/language-service/worker-protocol.js +1 -0
  215. package/dist/language-service/worker-provider.d.ts +9 -0
  216. package/dist/language-service/worker-provider.js +38 -0
  217. package/dist/lapis-extension.d.ts +244 -0
  218. package/dist/lapis-extension.js +591 -0
  219. package/dist/links.d.ts +34 -0
  220. package/dist/links.js +191 -0
  221. package/dist/loaders.d.ts +9 -0
  222. package/dist/loaders.js +59 -0
  223. package/dist/localization-manager.svelte.d.ts +56 -0
  224. package/dist/localization-manager.svelte.js +157 -0
  225. package/dist/logging.d.ts +172 -0
  226. package/dist/logging.js +352 -0
  227. package/dist/markdown-extension-registry.d.ts +31 -0
  228. package/dist/markdown-extension-registry.js +31 -0
  229. package/dist/markdown-file-surface-registry.d.ts +25 -0
  230. package/dist/markdown-file-surface-registry.js +23 -0
  231. package/dist/markdown.d.ts +205 -0
  232. package/dist/markdown.js +147 -0
  233. package/dist/menu-utils.d.ts +1 -0
  234. package/dist/menu-utils.js +47 -0
  235. package/dist/menu.svelte.d.ts +121 -0
  236. package/dist/menu.svelte.js +295 -0
  237. package/dist/metadata-value.d.ts +10 -0
  238. package/dist/metadata-value.js +173 -0
  239. package/dist/metadata.svelte.d.ts +106 -0
  240. package/dist/metadata.svelte.js +608 -0
  241. package/dist/notifications.d.ts +209 -0
  242. package/dist/notifications.js +338 -0
  243. package/dist/open-file.d.ts +23 -0
  244. package/dist/open-file.js +102 -0
  245. package/dist/platform.d.ts +86 -0
  246. package/dist/platform.js +86 -0
  247. package/dist/plugin-asset-server.d.ts +60 -0
  248. package/dist/plugin-asset-server.js +222 -0
  249. package/dist/plugin-assets.d.ts +4 -0
  250. package/dist/plugin-assets.js +3 -0
  251. package/dist/plugin-capability-facade.d.ts +104 -0
  252. package/dist/plugin-capability-facade.js +61 -0
  253. package/dist/plugin-dependency-resolver.d.ts +36 -0
  254. package/dist/plugin-dependency-resolver.js +54 -0
  255. package/dist/plugin-dependency-scanner.d.ts +9 -0
  256. package/dist/plugin-dependency-scanner.js +274 -0
  257. package/dist/plugin-distribution/canonical-json.d.ts +1 -0
  258. package/dist/plugin-distribution/canonical-json.js +40 -0
  259. package/dist/plugin-distribution/compatibility.d.ts +5 -0
  260. package/dist/plugin-distribution/compatibility.js +38 -0
  261. package/dist/plugin-distribution/errors.d.ts +11 -0
  262. package/dist/plugin-distribution/errors.js +13 -0
  263. package/dist/plugin-distribution/hashes.d.ts +2 -0
  264. package/dist/plugin-distribution/hashes.js +17 -0
  265. package/dist/plugin-distribution/index.d.ts +18 -0
  266. package/dist/plugin-distribution/index.js +18 -0
  267. package/dist/plugin-distribution/installed-plugin-state.d.ts +20 -0
  268. package/dist/plugin-distribution/installed-plugin-state.js +73 -0
  269. package/dist/plugin-distribution/installer.d.ts +89 -0
  270. package/dist/plugin-distribution/installer.js +395 -0
  271. package/dist/plugin-distribution/manager.d.ts +128 -0
  272. package/dist/plugin-distribution/manager.js +358 -0
  273. package/dist/plugin-distribution/path-safety.d.ts +2 -0
  274. package/dist/plugin-distribution/path-safety.js +20 -0
  275. package/dist/plugin-distribution/plugin-bundle-verifier.d.ts +28 -0
  276. package/dist/plugin-distribution/plugin-bundle-verifier.js +96 -0
  277. package/dist/plugin-distribution/plugin-bundle-worker.d.ts +34 -0
  278. package/dist/plugin-distribution/plugin-bundle-worker.js +99 -0
  279. package/dist/plugin-distribution/plugin-bundle.d.ts +16 -0
  280. package/dist/plugin-distribution/plugin-bundle.js +244 -0
  281. package/dist/plugin-distribution/plugin-bundle.worker.d.ts +1 -0
  282. package/dist/plugin-distribution/plugin-bundle.worker.js +38 -0
  283. package/dist/plugin-distribution/registry-cache.d.ts +26 -0
  284. package/dist/plugin-distribution/registry-cache.js +85 -0
  285. package/dist/plugin-distribution/registry-client.d.ts +36 -0
  286. package/dist/plugin-distribution/registry-client.js +115 -0
  287. package/dist/plugin-distribution/reserved-ids.d.ts +4 -0
  288. package/dist/plugin-distribution/reserved-ids.js +10 -0
  289. package/dist/plugin-distribution/runtime-validation.d.ts +14 -0
  290. package/dist/plugin-distribution/runtime-validation.js +388 -0
  291. package/dist/plugin-distribution/schemas.d.ts +4895 -0
  292. package/dist/plugin-distribution/schemas.js +299 -0
  293. package/dist/plugin-distribution/signing.d.ts +5 -0
  294. package/dist/plugin-distribution/signing.js +38 -0
  295. package/dist/plugin-distribution/types.d.ts +217 -0
  296. package/dist/plugin-distribution/types.js +1 -0
  297. package/dist/plugin-install-progress.d.ts +15 -0
  298. package/dist/plugin-install-progress.js +86 -0
  299. package/dist/plugin-manager.d.ts +306 -0
  300. package/dist/plugin-manager.js +2848 -0
  301. package/dist/plugin-runtime-entry.d.ts +19 -0
  302. package/dist/plugin-runtime-entry.js +135 -0
  303. package/dist/plugin.d.ts +350 -0
  304. package/dist/plugin.js +754 -0
  305. package/dist/popover.d.ts +20 -0
  306. package/dist/popover.js +32 -0
  307. package/dist/promise-worker.d.ts +22 -0
  308. package/dist/promise-worker.js +65 -0
  309. package/dist/prompt-confirm.d.ts +9 -0
  310. package/dist/prompt-confirm.js +33 -0
  311. package/dist/search-document-provider.d.ts +45 -0
  312. package/dist/search-document-provider.js +54 -0
  313. package/dist/search-query/index.d.ts +78 -0
  314. package/dist/search-query/index.js +426 -0
  315. package/dist/search-query/parser.d.ts +3 -0
  316. package/dist/search-query/parser.js +16 -0
  317. package/dist/search-query/parser.terms.js +26 -0
  318. package/dist/search-query/search-query.grammar +128 -0
  319. package/dist/search.d.ts +19 -0
  320. package/dist/search.js +104 -0
  321. package/dist/setting-section-layout.d.ts +19 -0
  322. package/dist/setting-section-layout.js +194 -0
  323. package/dist/settings.svelte.d.ts +474 -0
  324. package/dist/settings.svelte.js +1421 -0
  325. package/dist/source-text-file-view.d.ts +25 -0
  326. package/dist/source-text-file-view.js +78 -0
  327. package/dist/status-bar.svelte.d.ts +29 -0
  328. package/dist/status-bar.svelte.js +72 -0
  329. package/dist/storage/app-database.d.ts +860 -0
  330. package/dist/storage/app-database.js +2372 -0
  331. package/dist/storage/blob-store.d.ts +12 -0
  332. package/dist/storage/blob-store.js +1 -0
  333. package/dist/storage/browser-app-database-coordination.d.ts +35 -0
  334. package/dist/storage/browser-app-database-coordination.js +207 -0
  335. package/dist/storage/browser-coordinated-app-database.d.ts +109 -0
  336. package/dist/storage/browser-coordinated-app-database.js +704 -0
  337. package/dist/storage/browser.d.ts +153 -0
  338. package/dist/storage/browser.js +794 -0
  339. package/dist/storage/desktop-native.d.ts +184 -0
  340. package/dist/storage/desktop-native.js +415 -0
  341. package/dist/storage/fs.d.ts +188 -0
  342. package/dist/storage/fs.js +307 -0
  343. package/dist/storage/index-projection.d.ts +236 -0
  344. package/dist/storage/index-projection.js +402 -0
  345. package/dist/storage/index.d.ts +17 -0
  346. package/dist/storage/index.js +17 -0
  347. package/dist/storage/keyval.d.ts +94 -0
  348. package/dist/storage/keyval.js +199 -0
  349. package/dist/storage/memory-vault-adapter.d.ts +44 -0
  350. package/dist/storage/memory-vault-adapter.js +351 -0
  351. package/dist/storage/native-vault-bootstrap-kv.d.ts +22 -0
  352. package/dist/storage/native-vault-bootstrap-kv.js +96 -0
  353. package/dist/storage/path.d.ts +22 -0
  354. package/dist/storage/path.js +110 -0
  355. package/dist/storage/search-embedding-provider.d.ts +75 -0
  356. package/dist/storage/search-embedding-provider.js +446 -0
  357. package/dist/storage/search-embedding-worker.d.ts +1 -0
  358. package/dist/storage/search-embedding-worker.js +63 -0
  359. package/dist/storage/search-query-evaluator.d.ts +14 -0
  360. package/dist/storage/search-query-evaluator.js +678 -0
  361. package/dist/storage/task-projection.d.ts +152 -0
  362. package/dist/storage/task-projection.js +154 -0
  363. package/dist/storage/turso-app-database.d.ts +150 -0
  364. package/dist/storage/turso-app-database.js +2671 -0
  365. package/dist/storage/vault-session.d.ts +37 -0
  366. package/dist/storage/vault-session.js +196 -0
  367. package/dist/storage/vault-state.d.ts +74 -0
  368. package/dist/storage/vault-state.js +181 -0
  369. package/dist/storage/vault.svelte.d.ts +257 -0
  370. package/dist/storage/vault.svelte.js +661 -0
  371. package/dist/suggest.d.ts +193 -0
  372. package/dist/suggest.js +391 -0
  373. package/dist/tasks.d.ts +7 -0
  374. package/dist/tasks.js +18 -0
  375. package/dist/telemetry.d.ts +116 -0
  376. package/dist/telemetry.js +103 -0
  377. package/dist/utils.d.ts +55 -0
  378. package/dist/utils.js +314 -0
  379. package/dist/vault-api.d.ts +5 -0
  380. package/dist/vault-api.js +3 -0
  381. package/dist/vault-maintenance-commands.d.ts +5 -0
  382. package/dist/vault-maintenance-commands.js +32 -0
  383. package/dist/view.svelte.d.ts +215 -0
  384. package/dist/view.svelte.js +381 -0
  385. package/dist/vite-env.d.ts +2 -0
  386. package/dist/workspace-host-internal.d.ts +7 -0
  387. package/dist/workspace-host-internal.js +7 -0
  388. package/dist/workspace-host.d.ts +10 -0
  389. package/dist/workspace-host.js +14 -0
  390. package/dist/workspace-layout-commands.d.ts +3 -0
  391. package/dist/workspace-layout-commands.js +72 -0
  392. package/dist/workspace-layout-normalizer.d.ts +92 -0
  393. package/dist/workspace-layout-normalizer.js +301 -0
  394. package/dist/workspace-layouts.d.ts +7 -0
  395. package/dist/workspace-layouts.js +23 -0
  396. package/dist/workspace-trust.d.ts +32 -0
  397. package/dist/workspace-trust.js +72 -0
  398. package/dist/workspace.svelte.d.ts +796 -0
  399. package/dist/workspace.svelte.js +4380 -0
  400. package/package.json +240 -0
@@ -0,0 +1,1421 @@
1
+ import { Button } from "@lapismd/design-core/shadcn/button";
2
+ import { Input } from "@lapismd/design-core/shadcn/input";
3
+ import { Textarea } from "@lapismd/design-core/shadcn/textarea";
4
+ import { Slider } from "@lapismd/design-core/shadcn/slider";
5
+ import { Progress } from "@lapismd/design-core/shadcn/progress";
6
+ import { Select } from "./components/select";
7
+ import { Switch } from "@lapismd/design-core/shadcn/switch";
8
+ import { createRawSnippet, tick } from "svelte";
9
+ import { mountComponent, } from "./hooks/mountComponent.svelte";
10
+ import { setIcon } from "./icons";
11
+ import { dialogPortalPropsForDocument } from "./dialog-portal";
12
+ import IconList from "./components/icon/icon-list.svelte";
13
+ import ListSetting from "./components/configuration/list-setting.svelte";
14
+ import OptionsComboboxSetting from "./components/configuration/options-combobox-setting.svelte";
15
+ import ObjectGridSetting from "./components/configuration/object-grid-setting.svelte";
16
+ import ObjectMapSetting from "./components/configuration/object-map-setting.svelte";
17
+ import ObjectArraySetting from "./components/configuration/object-array-setting.svelte";
18
+ import DateSetting from "./components/configuration/date-setting.svelte";
19
+ import { md5 } from "./utils";
20
+ import ModalComponent from "@lapis-notes/ui/modal";
21
+ import Search from "@lapis-notes/ui/search";
22
+ import { debounce } from "lodash-es";
23
+ import { ensureSectionHeadingActionsEl, getSettingMountEl, openSettingSection, removeEmptyImplicitSection, setActiveSectionHeadingDescription, takeElementContent, } from "./setting-section-layout";
24
+ export { SETTING_SECTION_BODY_CLASS, SETTING_SECTION_CLASS, SETTING_SECTION_HEADING_ACTIONS_CLASS, SETTING_SECTION_HEADING_CLASS, SETTING_SECTION_HEADING_DESCRIPTION_CLASS, SETTING_SECTION_HEADING_TITLE_CLASS, } from "./setting-section-layout";
25
+ export class BaseComponent {
26
+ /**
27
+ * Facilitates chaining
28
+ *
29
+ * @public
30
+ */
31
+ then(cb) {
32
+ cb(this);
33
+ return this;
34
+ }
35
+ }
36
+ export class ValueComponent extends BaseComponent {
37
+ metadata = {};
38
+ /** @public */
39
+ registerOptionListener(listeners, key) {
40
+ return this;
41
+ }
42
+ setMetadata(key, value) {
43
+ this.metadata[key] = value;
44
+ return this;
45
+ }
46
+ }
47
+ export class ExtraButtonComponent extends BaseComponent {
48
+ containerEl;
49
+ component;
50
+ text = "";
51
+ icon = "";
52
+ constructor(containerEl) {
53
+ super();
54
+ this.containerEl = containerEl;
55
+ this.component = mountComponent(Button, {
56
+ target: containerEl,
57
+ props: {
58
+ ref: null,
59
+ variant: "ghost",
60
+ },
61
+ });
62
+ }
63
+ get extraSettingsEl() {
64
+ return (this.component.props.ref ??
65
+ this.containerEl.querySelector("button"));
66
+ }
67
+ setTooltip(value, options) {
68
+ this.component.props["data-tooltip"] = value;
69
+ this.component.props["data-tooltip-position"] =
70
+ options?.placement ?? "bottom";
71
+ return this;
72
+ }
73
+ setCta() {
74
+ this.component.props.variant = "default";
75
+ return this;
76
+ }
77
+ setVariant(variant) {
78
+ this.component.props.variant = variant;
79
+ return this;
80
+ }
81
+ setSize(size) {
82
+ this.component.props.size = size;
83
+ }
84
+ setWarning() {
85
+ this.component.props.variant = "destructive";
86
+ return this;
87
+ }
88
+ removeCta() {
89
+ this.component.props.variant = "ghost";
90
+ return this;
91
+ }
92
+ setButtonText(name) {
93
+ this.text = name;
94
+ this.icon = "";
95
+ this.component.props.children = this.createChildren();
96
+ return this;
97
+ }
98
+ setIcon(icon) {
99
+ this.icon = icon;
100
+ this.text = "";
101
+ this.component.props.children = this.createChildren();
102
+ return this;
103
+ }
104
+ setClass(cls) {
105
+ this.component.props["class"] = cls;
106
+ return this;
107
+ }
108
+ createChildren() {
109
+ return createRawSnippet(() => ({
110
+ render: () => `<span></span>`,
111
+ setup: (element) => {
112
+ const parent = element.parentElement ?? this.extraSettingsEl;
113
+ this.icon
114
+ ? setIcon(parent, this.icon)
115
+ : (parent.innerHTML = this.text);
116
+ },
117
+ }));
118
+ }
119
+ onClick(onclick) {
120
+ this.component.props.onclick = onclick;
121
+ return this;
122
+ }
123
+ get disabled() {
124
+ return !!this.component.props.disabled;
125
+ }
126
+ setDisabled(disabled) {
127
+ this.component.props.disabled = disabled;
128
+ return this;
129
+ }
130
+ }
131
+ export class ButtonComponent extends BaseComponent {
132
+ containerEl;
133
+ component;
134
+ text = "";
135
+ icon = "";
136
+ constructor(containerEl) {
137
+ super();
138
+ this.containerEl = containerEl;
139
+ this.component = mountComponent(Button, {
140
+ target: containerEl,
141
+ props: {
142
+ ref: null,
143
+ variant: "ghost",
144
+ },
145
+ });
146
+ }
147
+ get buttonEl() {
148
+ return (this.component.props.ref ??
149
+ this.containerEl.querySelector("button"));
150
+ }
151
+ setTooltip(value, options) {
152
+ this.component.props["data-tooltip"] = value;
153
+ this.component.props["data-tooltip-position"] =
154
+ options?.placement ?? "bottom";
155
+ return this;
156
+ }
157
+ setCta() {
158
+ this.component.props.variant = "default";
159
+ return this;
160
+ }
161
+ setVariant(variant) {
162
+ this.component.props.variant = variant;
163
+ return this;
164
+ }
165
+ setSize(size) {
166
+ this.component.props.size = size;
167
+ }
168
+ setWarning() {
169
+ this.component.props.variant = "destructive";
170
+ return this;
171
+ }
172
+ setButtonText(name) {
173
+ this.text = name;
174
+ this.icon = "";
175
+ this.component.props.children = this.createChildren();
176
+ return this;
177
+ }
178
+ setIcon(icon) {
179
+ this.icon = icon;
180
+ this.text = "";
181
+ this.component.props.children = this.createChildren();
182
+ return this;
183
+ }
184
+ setClass(cls) {
185
+ this.component.props["class"] = cls;
186
+ return this;
187
+ }
188
+ createChildren() {
189
+ return createRawSnippet(() => ({
190
+ render: () => `<span></span>`,
191
+ setup: (element) => {
192
+ const parent = element.parentElement ?? this.buttonEl;
193
+ this.icon
194
+ ? setIcon(parent, this.icon)
195
+ : (parent.innerHTML = this.text);
196
+ },
197
+ }));
198
+ }
199
+ onClick(onclick) {
200
+ this.component.props.onclick = onclick;
201
+ return this;
202
+ }
203
+ get disabled() {
204
+ return !!this.component.props.disabled;
205
+ }
206
+ setDisabled(disabled) {
207
+ this.component.props.disabled = disabled;
208
+ return this;
209
+ }
210
+ }
211
+ export class ToggleComponent extends ValueComponent {
212
+ containerEl;
213
+ component;
214
+ /** @public */
215
+ constructor(containerEl) {
216
+ super();
217
+ this.containerEl = containerEl;
218
+ this.component = mountComponent(Switch, {
219
+ target: containerEl,
220
+ });
221
+ }
222
+ get toggleEl() {
223
+ return this.component.props.ref;
224
+ }
225
+ get disabled() {
226
+ return !!this.component.props.disabled;
227
+ }
228
+ /** @public */
229
+ setDisabled(disabled) {
230
+ this.component.props.disabled = disabled;
231
+ return this;
232
+ }
233
+ /** @public */
234
+ getValue() {
235
+ return this.component.props.checked ?? false;
236
+ }
237
+ /** @public */
238
+ setValue(on) {
239
+ this.component.props.checked = on;
240
+ return this;
241
+ }
242
+ /** @public */
243
+ setTooltip(tooltip, options) {
244
+ return this;
245
+ }
246
+ /** @public */
247
+ onClick() {
248
+ this.component.props.checked = !this.getValue();
249
+ }
250
+ /** @public */
251
+ onChange(callback) {
252
+ this.component.props.onCheckedChange = debounce(callback, 500);
253
+ return this;
254
+ }
255
+ }
256
+ export class IconPickerComponent extends ValueComponent {
257
+ containerEl;
258
+ component;
259
+ /** @public */
260
+ constructor(containerEl) {
261
+ super();
262
+ this.containerEl = containerEl;
263
+ this.component = mountComponent(IconList, {
264
+ target: containerEl,
265
+ props: {
266
+ value: "",
267
+ ref: null,
268
+ disabled: false,
269
+ },
270
+ });
271
+ }
272
+ setCta() {
273
+ this.component.props.variant = "default";
274
+ return this;
275
+ }
276
+ setVariant(variant) {
277
+ this.component.props.variant = variant;
278
+ return this;
279
+ }
280
+ setSize(size) {
281
+ this.component.props.size = size;
282
+ }
283
+ setWarning() {
284
+ this.component.props.variant = "destructive";
285
+ return this;
286
+ }
287
+ /** @public */
288
+ setDisabled(disabled) {
289
+ this.component.props.disabled = disabled;
290
+ return this;
291
+ }
292
+ get disabled() {
293
+ return this.component.props.disabled;
294
+ }
295
+ /** @public */
296
+ getValue() {
297
+ return this.component.props.value ?? "";
298
+ }
299
+ /** @public */
300
+ setValue(value) {
301
+ this.component.props.value = value;
302
+ return this;
303
+ }
304
+ setButtonText(name) {
305
+ this.component.props.label = name;
306
+ return this;
307
+ }
308
+ setIcon(icon) {
309
+ return this.setValue(icon);
310
+ }
311
+ /** @public */
312
+ setTooltip(tooltip, options) {
313
+ return this;
314
+ }
315
+ onChange(callback) {
316
+ this.component.props.onValueChange = debounce(callback, 500);
317
+ return this;
318
+ }
319
+ }
320
+ export class ProgressBarComponent extends ValueComponent {
321
+ containerEl;
322
+ component;
323
+ /** @public */
324
+ constructor(containerEl) {
325
+ super();
326
+ this.containerEl = containerEl;
327
+ this.component = mountComponent(Progress, {
328
+ target: containerEl,
329
+ });
330
+ }
331
+ get toggleEl() {
332
+ return this.component.props.ref;
333
+ }
334
+ get disabled() {
335
+ return this.component.props.class?.includes("disabled");
336
+ }
337
+ /** @public */
338
+ setDisabled(disabled) {
339
+ this.component.props.class = disabled ? "disabled" : "";
340
+ return this;
341
+ }
342
+ /** @public */
343
+ getValue() {
344
+ return this.component.props.value ?? 0;
345
+ }
346
+ /** @public */
347
+ setValue(value) {
348
+ this.component.props.value = value;
349
+ return this;
350
+ }
351
+ /** @public */
352
+ setTooltip(tooltip, options) {
353
+ return this;
354
+ }
355
+ }
356
+ export class SliderComponent extends ValueComponent {
357
+ containerEl;
358
+ component;
359
+ /** @public */
360
+ constructor(containerEl) {
361
+ super();
362
+ this.containerEl = containerEl;
363
+ this.component = mountComponent(Slider, {
364
+ target: containerEl,
365
+ props: {
366
+ value: 0,
367
+ ref: null,
368
+ type: "single",
369
+ },
370
+ });
371
+ }
372
+ get sliderEl() {
373
+ return this.component.props.ref;
374
+ }
375
+ get disabled() {
376
+ return !!this.component.props.disabled;
377
+ }
378
+ /** @public */
379
+ setDisabled(disabled) {
380
+ this.component.props.disabled = disabled;
381
+ return this;
382
+ }
383
+ setDynamicTooltip() {
384
+ return this;
385
+ }
386
+ setLimits(min, max, step) {
387
+ this.component.props.min = min;
388
+ this.component.props.max = max;
389
+ this.component.props.step = step;
390
+ return this;
391
+ }
392
+ setType(type) {
393
+ this.component.props.type = type;
394
+ return this;
395
+ }
396
+ /** @public */
397
+ getValue() {
398
+ return (this.component.props.value ??
399
+ this.component.props.type === "single")
400
+ ? 0
401
+ : [];
402
+ }
403
+ /** @public */
404
+ setValue(value) {
405
+ this.component.props.value = value;
406
+ return this;
407
+ }
408
+ onChange(callback) {
409
+ this.component.props.onValueChange = debounce(callback, 500);
410
+ return this;
411
+ }
412
+ }
413
+ export class Modal {
414
+ app;
415
+ component;
416
+ containerEl;
417
+ constructor(app) {
418
+ this.app = app;
419
+ const hostDocument = app.workspace.getCommandHostDocument();
420
+ this.containerEl = hostDocument.createElement("div");
421
+ this.component = mountComponent(ModalComponent, {
422
+ target: this.containerEl,
423
+ props: {
424
+ open: false,
425
+ contentEl: null,
426
+ modalEl: null,
427
+ titleEl: null,
428
+ content: "",
429
+ title: "",
430
+ portalProps: dialogPortalPropsForDocument(hostDocument),
431
+ onOpenChange: this.onOpenChange.bind(this),
432
+ },
433
+ });
434
+ }
435
+ onOpenChange(open) {
436
+ open ? this.onOpen() : this.onClose();
437
+ }
438
+ onOpen() { }
439
+ onClose() { }
440
+ open() {
441
+ this.component.props.open = true;
442
+ tick().then(() => setTimeout(() => this.onOpen()));
443
+ }
444
+ close() {
445
+ this.component.props.open = false;
446
+ tick().then(() => setTimeout(() => this.onClose()));
447
+ }
448
+ setTitle(title) {
449
+ this.component.props.title = title;
450
+ return this;
451
+ }
452
+ setContent(content) {
453
+ this.component.props.content = content;
454
+ return this;
455
+ }
456
+ get titleEl() {
457
+ return this.component.props.titleEl;
458
+ }
459
+ get contentEl() {
460
+ return this.component.props.contentEl;
461
+ }
462
+ get modalEl() {
463
+ return this.component.props.modalEl;
464
+ }
465
+ }
466
+ export class DropdownComponent extends ValueComponent {
467
+ containerEl;
468
+ component;
469
+ /** @public */
470
+ constructor(containerEl) {
471
+ super();
472
+ this.containerEl = containerEl;
473
+ this.component = mountComponent(Select, {
474
+ target: containerEl,
475
+ props: {
476
+ type: "single",
477
+ items: [],
478
+ },
479
+ });
480
+ }
481
+ addOption(value, label) {
482
+ this.component.props.items.push({ label, value });
483
+ return this;
484
+ }
485
+ addOptions(options) {
486
+ const items = [];
487
+ for (const [value, label] of Object.entries(options)) {
488
+ items.push({ label, value });
489
+ }
490
+ this.component.props.items.push(...items);
491
+ return this;
492
+ }
493
+ setItems(items) {
494
+ this.component.props.items = items;
495
+ return this;
496
+ }
497
+ get selectEl() {
498
+ return this.component.props.ref;
499
+ }
500
+ get disabled() {
501
+ return !!this.component.props.disabled;
502
+ }
503
+ /** @public */
504
+ setDisabled(disabled) {
505
+ this.component.props.disabled = disabled;
506
+ return this;
507
+ }
508
+ setType(type) {
509
+ this.component.props.type = type;
510
+ return this;
511
+ }
512
+ /** @public */
513
+ getValue() {
514
+ return (this.component.props.value ??
515
+ this.component.props.type === "single")
516
+ ? ""
517
+ : [];
518
+ }
519
+ /** @public */
520
+ setValue(value) {
521
+ this.component.props.value = value;
522
+ return this;
523
+ }
524
+ onChange(callback) {
525
+ this.component.props.onValueChange = debounce(callback, 500);
526
+ return this;
527
+ }
528
+ }
529
+ export class AbstractTextComponent extends ValueComponent {
530
+ component;
531
+ /** @public */
532
+ constructor(component) {
533
+ super();
534
+ this.component = component;
535
+ }
536
+ get inputEl() {
537
+ return this.component.props.ref;
538
+ }
539
+ get disabled() {
540
+ return !!this.component.props.disabled;
541
+ }
542
+ /** @public */
543
+ setDisabled(disabled) {
544
+ this.component.props.disabled = disabled;
545
+ return this;
546
+ }
547
+ /** @public */
548
+ getValue() {
549
+ return this.component.props.value;
550
+ }
551
+ /** @public */
552
+ setValue(value) {
553
+ this.component.props.value = value;
554
+ return this;
555
+ }
556
+ /** @public */
557
+ setPlaceholder(placeholder) {
558
+ this.component.props.placeholder = placeholder;
559
+ return this;
560
+ }
561
+ /** @public */
562
+ onChanged() { }
563
+ /** @public */
564
+ onChange(callback) {
565
+ callback = debounce(callback, 500);
566
+ this.component.props.oninput = () => {
567
+ callback(this.inputEl.value);
568
+ };
569
+ return this;
570
+ }
571
+ }
572
+ export class TextComponent extends AbstractTextComponent {
573
+ /** @public */
574
+ constructor(containerEl) {
575
+ super(mountComponent(Input, {
576
+ target: containerEl,
577
+ props: {
578
+ ref: null,
579
+ type: "text",
580
+ value: "",
581
+ },
582
+ }));
583
+ }
584
+ setType(type) {
585
+ this.component.props.type = type;
586
+ return this;
587
+ }
588
+ }
589
+ export class TextAreaComponent extends AbstractTextComponent {
590
+ /** @public */
591
+ constructor(containerEl) {
592
+ super(mountComponent(Textarea, {
593
+ target: containerEl,
594
+ props: {
595
+ ref: null,
596
+ type: "text",
597
+ value: "",
598
+ },
599
+ }));
600
+ }
601
+ }
602
+ export class SearchComponent extends AbstractTextComponent {
603
+ /** @public */
604
+ constructor(containerEl) {
605
+ super(mountComponent(Search, {
606
+ target: containerEl,
607
+ props: {
608
+ ref: null,
609
+ value: "",
610
+ onChange: null,
611
+ },
612
+ }));
613
+ }
614
+ get clearButtonEl() {
615
+ return (this.component.props.clearButtonEl ??
616
+ this.component.props.ref ??
617
+ this.inputEl);
618
+ }
619
+ onChange(callback) {
620
+ callback = debounce(callback, 500);
621
+ this.component.props.onChange = callback;
622
+ return this;
623
+ }
624
+ onChanged() {
625
+ this.component.props.onChange?.(this.getValue());
626
+ }
627
+ }
628
+ export class MomentFormatComponent extends TextComponent {
629
+ }
630
+ export class ListSettingComponent extends ValueComponent {
631
+ containerEl;
632
+ component;
633
+ constructor(containerEl) {
634
+ super();
635
+ this.containerEl = containerEl;
636
+ this.component = mountComponent(ListSetting, {
637
+ target: containerEl,
638
+ props: {
639
+ itemType: "string",
640
+ value: [],
641
+ valueOptions: [],
642
+ allowUnknownOptions: false,
643
+ },
644
+ });
645
+ }
646
+ setItemType(type) {
647
+ this.component.props.itemType = type;
648
+ return this;
649
+ }
650
+ setValueOptions(options) {
651
+ this.component.props.valueOptions = options;
652
+ return this;
653
+ }
654
+ setAllowUnknownOptions(allowUnknownOptions) {
655
+ this.component.props.allowUnknownOptions = allowUnknownOptions;
656
+ return this;
657
+ }
658
+ get disabled() {
659
+ return false;
660
+ }
661
+ setDisabled(_disabled) {
662
+ return this;
663
+ }
664
+ getValue() {
665
+ return this.component.props.value ?? [];
666
+ }
667
+ setValue(value) {
668
+ this.component.props.value = value;
669
+ return this;
670
+ }
671
+ onChange(callback) {
672
+ this.component.props.onValueChange = debounce(callback, 300);
673
+ return this;
674
+ }
675
+ }
676
+ export class OptionsComboboxSettingComponent extends ValueComponent {
677
+ containerEl;
678
+ component;
679
+ constructor(containerEl) {
680
+ super();
681
+ this.containerEl = containerEl;
682
+ this.component = mountComponent(OptionsComboboxSetting, {
683
+ target: containerEl,
684
+ props: {
685
+ value: "",
686
+ options: [],
687
+ },
688
+ });
689
+ }
690
+ setValueOptions(options) {
691
+ this.component.props.options = options;
692
+ return this;
693
+ }
694
+ get disabled() {
695
+ return false;
696
+ }
697
+ setDisabled(_disabled) {
698
+ return this;
699
+ }
700
+ getValue() {
701
+ return this.component.props.value ?? "";
702
+ }
703
+ setValue(value) {
704
+ this.component.props.value = value;
705
+ return this;
706
+ }
707
+ onChange(callback) {
708
+ this.component.props.onValueChange = debounce(callback, 300);
709
+ return this;
710
+ }
711
+ onQueryChange(callback) {
712
+ this.component.props.onQueryChange = debounce(callback, 200);
713
+ return this;
714
+ }
715
+ }
716
+ export class ObjectGridSettingComponent extends ValueComponent {
717
+ containerEl;
718
+ component;
719
+ constructor(containerEl) {
720
+ super();
721
+ this.containerEl = containerEl;
722
+ this.component = mountComponent(ObjectGridSetting, {
723
+ target: containerEl,
724
+ props: {
725
+ schema: { type: "object", properties: {} },
726
+ value: {},
727
+ },
728
+ });
729
+ }
730
+ setSchema(schema) {
731
+ this.component.props.schema = schema;
732
+ return this;
733
+ }
734
+ get disabled() {
735
+ return false;
736
+ }
737
+ setDisabled(_disabled) {
738
+ return this;
739
+ }
740
+ getValue() {
741
+ return this.component.props.value ?? {};
742
+ }
743
+ setValue(value) {
744
+ this.component.props.value = value;
745
+ return this;
746
+ }
747
+ onChange(callback) {
748
+ this.component.props.onValueChange = debounce(callback, 300);
749
+ return this;
750
+ }
751
+ }
752
+ export class ObjectMapSettingComponent extends ValueComponent {
753
+ containerEl;
754
+ component;
755
+ constructor(containerEl) {
756
+ super();
757
+ this.containerEl = containerEl;
758
+ this.component = mountComponent(ObjectMapSetting, {
759
+ target: containerEl,
760
+ props: {
761
+ schema: { type: "object", properties: {}, additionalProperties: true },
762
+ value: {},
763
+ valueOptions: [],
764
+ },
765
+ });
766
+ }
767
+ setSchema(schema) {
768
+ this.component.props.schema = schema;
769
+ return this;
770
+ }
771
+ setValueOptions(options) {
772
+ this.component.props.valueOptions = options;
773
+ return this;
774
+ }
775
+ onValueQueryChange(callback) {
776
+ this.component.props.onValueQueryChange = debounce(callback, 200);
777
+ return this;
778
+ }
779
+ get disabled() {
780
+ return false;
781
+ }
782
+ setDisabled(_disabled) {
783
+ return this;
784
+ }
785
+ getValue() {
786
+ return this.component.props.value ?? {};
787
+ }
788
+ setValue(value) {
789
+ this.component.props.value = value;
790
+ return this;
791
+ }
792
+ onChange(callback) {
793
+ this.component.props.onValueChange = debounce(callback, 300);
794
+ return this;
795
+ }
796
+ }
797
+ export class ObjectArraySettingComponent extends ValueComponent {
798
+ containerEl;
799
+ component;
800
+ constructor(containerEl) {
801
+ super();
802
+ this.containerEl = containerEl;
803
+ this.component = mountComponent(ObjectArraySetting, {
804
+ target: containerEl,
805
+ props: {
806
+ schema: {
807
+ type: "array",
808
+ items: { type: "object", properties: {} },
809
+ },
810
+ value: [],
811
+ columnOptions: {},
812
+ columnOnQueryChange: {},
813
+ },
814
+ });
815
+ }
816
+ setSchema(schema) {
817
+ this.component.props.schema = schema;
818
+ return this;
819
+ }
820
+ setColumnOptions(options) {
821
+ this.component.props.columnOptions = options;
822
+ return this;
823
+ }
824
+ setColumnOnQueryChange(handlers) {
825
+ this.component.props.columnOnQueryChange = handlers;
826
+ return this;
827
+ }
828
+ get disabled() {
829
+ return false;
830
+ }
831
+ setDisabled(_disabled) {
832
+ return this;
833
+ }
834
+ getValue() {
835
+ return this.component.props.value ?? [];
836
+ }
837
+ setValue(value) {
838
+ this.component.props.value = value;
839
+ return this;
840
+ }
841
+ onChange(callback) {
842
+ this.component.props.onValueChange = debounce(callback, 300);
843
+ return this;
844
+ }
845
+ }
846
+ export class DateSettingComponent extends ValueComponent {
847
+ containerEl;
848
+ component;
849
+ constructor(containerEl) {
850
+ super();
851
+ this.containerEl = containerEl;
852
+ this.component = mountComponent(DateSetting, {
853
+ target: containerEl,
854
+ props: {
855
+ value: "",
856
+ format: "date",
857
+ },
858
+ });
859
+ }
860
+ setFormat(format) {
861
+ this.component.props.format = format;
862
+ return this;
863
+ }
864
+ get disabled() {
865
+ return false;
866
+ }
867
+ setDisabled(_disabled) {
868
+ return this;
869
+ }
870
+ getValue() {
871
+ return this.component.props.value ?? "";
872
+ }
873
+ setValue(value) {
874
+ this.component.props.value = value;
875
+ return this;
876
+ }
877
+ onChange(callback) {
878
+ this.component.props.onValueChange = debounce(callback, 300);
879
+ return this;
880
+ }
881
+ }
882
+ export class SettingTab {
883
+ app;
884
+ /**
885
+ * Outermost HTML element on the setting tab.
886
+ *
887
+ * @public
888
+ */
889
+ containerEl = $state();
890
+ constructor(app) {
891
+ this.app = app;
892
+ }
893
+ /**
894
+ * Hides the contents of the setting tab. Any registered components should be
895
+ * unloaded when the view is hidden. Override this if you need to perform
896
+ * additional cleanup.
897
+ *
898
+ * @public
899
+ */
900
+ hide() { }
901
+ }
902
+ export class PluginSettingTab extends SettingTab {
903
+ plugin;
904
+ /** @public */
905
+ constructor(app, plugin) {
906
+ super(app);
907
+ this.plugin = plugin;
908
+ }
909
+ }
910
+ export class SettingItem {
911
+ props = $state({
912
+ id: crypto.randomUUID(),
913
+ title: "",
914
+ icon: "",
915
+ disabled: false,
916
+ });
917
+ key = $state(this.props.id);
918
+ static create(props = {}) {
919
+ return new SettingItem(props);
920
+ }
921
+ constructor(props = {}) {
922
+ this.props = { ...this.props, ...props };
923
+ this.update();
924
+ }
925
+ update() {
926
+ this.key = md5(`${JSON.stringify({
927
+ id: this.props.id,
928
+ title: this.props.title,
929
+ icon: this.props.icon,
930
+ disabled: this.props.disabled,
931
+ })}`);
932
+ this.props.parent?.update();
933
+ return this;
934
+ }
935
+ get title() {
936
+ return this.props.title;
937
+ }
938
+ get icon() {
939
+ return this.props.icon;
940
+ }
941
+ get disabled() {
942
+ return this.props.disabled;
943
+ }
944
+ get id() {
945
+ return this.props.id || this.props.title;
946
+ }
947
+ get tab() {
948
+ return this.props.tab;
949
+ }
950
+ setTitle(title) {
951
+ this.props.title = title;
952
+ return this.update();
953
+ }
954
+ setId(id) {
955
+ this.props.id = id;
956
+ return this.update();
957
+ }
958
+ /**
959
+ * @param icon - ID of the icon, can use any icon loaded with {@link addIcon}
960
+ * or from the built-in lucide library.
961
+ * @public
962
+ * @see The Obsidian icon library includes the {@link https://lucide.dev/ Lucide icon library}, any icon name from their site will work here.
963
+ */
964
+ setIcon(icon) {
965
+ this.props.icon = icon;
966
+ return this.update();
967
+ }
968
+ setDisabled(disabled) {
969
+ this.props.disabled = disabled;
970
+ return this.update();
971
+ }
972
+ setTab(tab) {
973
+ this.props.tab = tab;
974
+ return this.update();
975
+ }
976
+ }
977
+ export class SettingGroup {
978
+ items = $state([]);
979
+ props = $state({
980
+ id: crypto.randomUUID(),
981
+ title: "",
982
+ items: [],
983
+ });
984
+ key = $state(md5(JSON.stringify(this.props)));
985
+ static create(props = {}) {
986
+ return new SettingGroup(props);
987
+ }
988
+ constructor(props = {}) {
989
+ this.props = { ...this.props, ...props };
990
+ this.items = this.props.items;
991
+ this.props.items = this.items;
992
+ this.update();
993
+ }
994
+ update() {
995
+ this.key = md5(`${JSON.stringify({ ...this.props, items: this.items.map((it) => it.key) })}`);
996
+ this.props.parent?.update();
997
+ return this;
998
+ }
999
+ get id() {
1000
+ return this.props.id;
1001
+ }
1002
+ get title() {
1003
+ return this.props.title;
1004
+ }
1005
+ setId(id) {
1006
+ this.props.id = id;
1007
+ return this.update();
1008
+ }
1009
+ setTitle(title) {
1010
+ this.props.title = title;
1011
+ return this.update();
1012
+ }
1013
+ addItem(cb) {
1014
+ const item = SettingItem.create({ parent: this });
1015
+ cb(item);
1016
+ this.items.push(item);
1017
+ return this.update();
1018
+ }
1019
+ removeItem(id) {
1020
+ this.items = this.items.filter((it) => it.id !== id);
1021
+ return this.update();
1022
+ }
1023
+ }
1024
+ /**
1025
+ * Mutable registry of settings groups and items shown in the settings UI.
1026
+ *
1027
+ * @public
1028
+ */
1029
+ export class AppSettings {
1030
+ groups = $state([]);
1031
+ key = $state(md5(`${JSON.stringify(this.groups.map((it) => it.key))}`));
1032
+ constructor() {
1033
+ this.update();
1034
+ }
1035
+ addGroup(cb) {
1036
+ const group = SettingGroup.create({ parent: this });
1037
+ cb(group);
1038
+ this.groups.push(group);
1039
+ return this.update();
1040
+ }
1041
+ update() {
1042
+ this.key = md5(`${JSON.stringify(this.groups.map((it) => it.key))}`);
1043
+ return this;
1044
+ }
1045
+ find(id) {
1046
+ return this.groups.find((it) => it.id === id);
1047
+ }
1048
+ findItem(id) {
1049
+ for (const group of this.groups) {
1050
+ const item = group.items.find((it) => it.id === id);
1051
+ if (item) {
1052
+ return item;
1053
+ }
1054
+ }
1055
+ return undefined;
1056
+ }
1057
+ }
1058
+ export class ColorComponent extends AbstractTextComponent {
1059
+ /** @public */
1060
+ constructor(containerEl) {
1061
+ super(mountComponent(Input, {
1062
+ target: containerEl,
1063
+ props: {
1064
+ type: "color",
1065
+ ref: null,
1066
+ value: null,
1067
+ class: "shadow-none w-auto h-auto p-0 border-none rounded-full",
1068
+ },
1069
+ }));
1070
+ }
1071
+ getValueRgb() {
1072
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(this.getValue() || "#000000");
1073
+ return result
1074
+ ? {
1075
+ r: parseInt(result[1], 16),
1076
+ g: parseInt(result[2], 16),
1077
+ b: parseInt(result[3], 16),
1078
+ }
1079
+ : { r: 0, g: 0, b: 0 };
1080
+ }
1081
+ getValueHsl() {
1082
+ return this.rgbToHsl(this.getValueRgb());
1083
+ }
1084
+ setValueRgb(rgb) {
1085
+ this.setValue(this.rgbToHex(rgb));
1086
+ return this;
1087
+ }
1088
+ /** @public */
1089
+ setValueHsl(hsl) {
1090
+ this.setValue(this.hslToHex(hsl));
1091
+ return this;
1092
+ }
1093
+ componentToHex(c) {
1094
+ var hex = c.toString(16);
1095
+ return hex.length == 1 ? "0" + hex : hex;
1096
+ }
1097
+ rgbToHex({ r, g, b }) {
1098
+ return ("#" +
1099
+ this.componentToHex(r) +
1100
+ this.componentToHex(g) +
1101
+ this.componentToHex(b));
1102
+ }
1103
+ hslToHex({ h, s, l }) {
1104
+ l /= 100;
1105
+ const a = (s * Math.min(l, 1 - l)) / 100;
1106
+ const f = (n) => {
1107
+ const k = (n + h / 30) % 12;
1108
+ const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
1109
+ return Math.round(255 * color)
1110
+ .toString(16)
1111
+ .padStart(2, "0"); // convert to Hex and prefix "0" if needed
1112
+ };
1113
+ return `#${f(0)}${f(8)}${f(4)}`;
1114
+ }
1115
+ rgbToHsl({ r, g, b }) {
1116
+ r /= 255;
1117
+ g /= 255;
1118
+ b /= 255;
1119
+ const l = Math.max(r, g, b);
1120
+ const s = l - Math.min(r, g, b);
1121
+ const h = s
1122
+ ? l === r
1123
+ ? (g - b) / s
1124
+ : l === g
1125
+ ? 2 + (b - r) / s
1126
+ : 4 + (r - g) / s
1127
+ : 0;
1128
+ return {
1129
+ h: 60 * h < 0 ? 60 * h + 360 : 60 * h,
1130
+ s: 100 * (s ? (l <= 0.5 ? s / (2 * l - s) : s / (2 - (2 * l - s))) : 0),
1131
+ l: (100 * (2 * l - s)) / 2,
1132
+ };
1133
+ }
1134
+ }
1135
+ function createSettingItemElement() {
1136
+ const settingEl = document.createElement("div");
1137
+ settingEl.className = "setting-item";
1138
+ const infoEl = document.createElement("div");
1139
+ infoEl.className = "setting-item-info";
1140
+ const nameEl = document.createElement("div");
1141
+ nameEl.className = "setting-item-name";
1142
+ const descEl = document.createElement("div");
1143
+ descEl.className = "setting-item-description";
1144
+ const controlEl = document.createElement("div");
1145
+ controlEl.className = "setting-item-control";
1146
+ infoEl.append(nameEl, descEl);
1147
+ settingEl.append(infoEl, controlEl);
1148
+ return { settingEl, infoEl, nameEl, descEl, controlEl };
1149
+ }
1150
+ export class Setting {
1151
+ containerEl;
1152
+ components = [];
1153
+ mountedToDom = false;
1154
+ mountScheduled = false;
1155
+ isHeadingRow = false;
1156
+ /** @public */
1157
+ settingEl;
1158
+ /** @public */
1159
+ infoEl;
1160
+ /** @public */
1161
+ nameEl;
1162
+ /** @public */
1163
+ descEl;
1164
+ /** @public */
1165
+ controlEl;
1166
+ constructor(containerEl) {
1167
+ this.containerEl = containerEl;
1168
+ const elements = createSettingItemElement();
1169
+ this.settingEl = elements.settingEl;
1170
+ this.infoEl = elements.infoEl;
1171
+ this.nameEl = elements.nameEl;
1172
+ this.descEl = elements.descEl;
1173
+ this.controlEl = elements.controlEl;
1174
+ }
1175
+ mountSettingRow() {
1176
+ if (this.mountedToDom || this.isHeadingRow) {
1177
+ return;
1178
+ }
1179
+ getSettingMountEl(this.containerEl).appendChild(this.settingEl);
1180
+ this.mountedToDom = true;
1181
+ }
1182
+ scheduleMount() {
1183
+ if (this.isHeadingRow || this.mountScheduled || this.mountedToDom) {
1184
+ return;
1185
+ }
1186
+ this.mountScheduled = true;
1187
+ queueMicrotask(() => {
1188
+ this.mountScheduled = false;
1189
+ if (this.isHeadingRow || this.mountedToDom) {
1190
+ return;
1191
+ }
1192
+ this.mountSettingRow();
1193
+ });
1194
+ }
1195
+ /**
1196
+ * Facilitates chaining
1197
+ *
1198
+ * @public
1199
+ */
1200
+ then(cb) {
1201
+ cb(this);
1202
+ return this;
1203
+ }
1204
+ setName(name) {
1205
+ this.nameEl.empty();
1206
+ if (typeof name === "string") {
1207
+ this.nameEl.setText(name);
1208
+ }
1209
+ else {
1210
+ this.nameEl.appendChild(name);
1211
+ }
1212
+ this.scheduleMount();
1213
+ return this;
1214
+ }
1215
+ setVisibility(visible) {
1216
+ this.mountSettingRow();
1217
+ this.settingEl.toggleVisibility(visible);
1218
+ }
1219
+ setDesc(desc) {
1220
+ this.descEl.empty();
1221
+ if (typeof desc === "string") {
1222
+ this.descEl.setText(desc);
1223
+ }
1224
+ else {
1225
+ this.descEl.appendChild(desc);
1226
+ }
1227
+ if (this.isHeadingRow) {
1228
+ setActiveSectionHeadingDescription(this.containerEl, desc);
1229
+ return this;
1230
+ }
1231
+ this.scheduleMount();
1232
+ return this;
1233
+ }
1234
+ setClass(cls) {
1235
+ this.settingEl.classList.add(...cls
1236
+ .split(" ")
1237
+ .map((it) => it.trim())
1238
+ .filter((it) => it));
1239
+ if (!this.isHeadingRow) {
1240
+ this.mountScheduled = false;
1241
+ this.mountSettingRow();
1242
+ }
1243
+ return this;
1244
+ }
1245
+ setTooltip(tooltip, options) {
1246
+ this.settingEl.dataset.tooltip = tooltip;
1247
+ this.settingEl.dataset.tooltipPosition = options?.placement ?? "top";
1248
+ return this;
1249
+ }
1250
+ setDisabled(disabled) {
1251
+ this.components.forEach((component) => component.setDisabled(disabled));
1252
+ this.settingEl.toggleClass("is-disabled", disabled);
1253
+ return this;
1254
+ }
1255
+ clear() {
1256
+ this.components = [];
1257
+ this.controlEl.empty();
1258
+ return this;
1259
+ }
1260
+ addComponent(component) {
1261
+ this.components.push(component);
1262
+ return this;
1263
+ }
1264
+ setHeading() {
1265
+ this.isHeadingRow = true;
1266
+ const title = takeElementContent(this.nameEl);
1267
+ const description = this.descEl.textContent?.trim()
1268
+ ? takeElementContent(this.descEl)
1269
+ : null;
1270
+ if (this.mountedToDom) {
1271
+ this.settingEl.remove();
1272
+ removeEmptyImplicitSection(this.containerEl);
1273
+ }
1274
+ openSettingSection(this.containerEl, title, description);
1275
+ return this;
1276
+ }
1277
+ addButton(cb) {
1278
+ if (this.isHeadingRow) {
1279
+ const actionsEl = ensureSectionHeadingActionsEl(this.containerEl);
1280
+ if (actionsEl) {
1281
+ const button = new ButtonComponent(actionsEl);
1282
+ this.components.push(button);
1283
+ setTimeout(() => cb(button));
1284
+ }
1285
+ return this;
1286
+ }
1287
+ this.mountSettingRow();
1288
+ const button = new ButtonComponent(this.controlEl);
1289
+ this.components.push(button);
1290
+ setTimeout(() => cb(button));
1291
+ return this;
1292
+ }
1293
+ addExtraButton(cb) {
1294
+ if (this.isHeadingRow) {
1295
+ const actionsEl = ensureSectionHeadingActionsEl(this.containerEl);
1296
+ if (actionsEl) {
1297
+ const button = new ExtraButtonComponent(actionsEl);
1298
+ this.components.push(button);
1299
+ setTimeout(() => cb(button));
1300
+ }
1301
+ return this;
1302
+ }
1303
+ this.mountSettingRow();
1304
+ const button = new ExtraButtonComponent(this.controlEl);
1305
+ this.components.push(button);
1306
+ setTimeout(() => cb(button));
1307
+ return this;
1308
+ }
1309
+ addToggle(cb) {
1310
+ this.mountSettingRow();
1311
+ const toggle = new ToggleComponent(this.controlEl);
1312
+ this.components.push(toggle);
1313
+ setTimeout(() => cb(toggle));
1314
+ return this;
1315
+ }
1316
+ addText(cb) {
1317
+ this.mountSettingRow();
1318
+ const text = new TextComponent(this.controlEl);
1319
+ this.components.push(text);
1320
+ setTimeout(() => cb(text));
1321
+ return this;
1322
+ }
1323
+ addSearch(cb) {
1324
+ this.mountSettingRow();
1325
+ const text = new SearchComponent(this.controlEl);
1326
+ this.components.push(text);
1327
+ setTimeout(() => cb(text));
1328
+ return this;
1329
+ }
1330
+ addTextArea(cb) {
1331
+ this.mountSettingRow();
1332
+ const text = new TextAreaComponent(this.controlEl);
1333
+ this.components.push(text);
1334
+ setTimeout(() => cb(text));
1335
+ return this;
1336
+ }
1337
+ addSlider(cb) {
1338
+ this.mountSettingRow();
1339
+ const slider = new SliderComponent(this.controlEl);
1340
+ this.components.push(slider);
1341
+ setTimeout(() => cb(slider));
1342
+ return this;
1343
+ }
1344
+ addProgressBar(cb) {
1345
+ this.mountSettingRow();
1346
+ const progress = new ProgressBarComponent(this.controlEl);
1347
+ this.components.push(progress);
1348
+ setTimeout(() => cb(progress));
1349
+ return this;
1350
+ }
1351
+ addColorPicker(cb) {
1352
+ this.mountSettingRow();
1353
+ const picker = new ColorComponent(this.controlEl);
1354
+ this.components.push(picker);
1355
+ setTimeout(() => cb(picker));
1356
+ return this;
1357
+ }
1358
+ addIconPicker(cb) {
1359
+ this.mountSettingRow();
1360
+ const picker = new IconPickerComponent(this.controlEl);
1361
+ this.components.push(picker);
1362
+ setTimeout(() => cb(picker));
1363
+ return this;
1364
+ }
1365
+ addDropdown(cb) {
1366
+ this.mountSettingRow();
1367
+ const dropdown = new DropdownComponent(this.controlEl);
1368
+ this.components.push(dropdown);
1369
+ setTimeout(() => cb(dropdown));
1370
+ return this;
1371
+ }
1372
+ addMomentFormat(cb) {
1373
+ this.mountSettingRow();
1374
+ const text = new MomentFormatComponent(this.controlEl);
1375
+ this.components.push(text);
1376
+ setTimeout(() => cb(text));
1377
+ return this;
1378
+ }
1379
+ addList(cb) {
1380
+ this.mountSettingRow();
1381
+ const list = new ListSettingComponent(this.controlEl);
1382
+ this.components.push(list);
1383
+ setTimeout(() => cb(list));
1384
+ return this;
1385
+ }
1386
+ addOptionsCombobox(cb) {
1387
+ this.mountSettingRow();
1388
+ const combobox = new OptionsComboboxSettingComponent(this.controlEl);
1389
+ this.components.push(combobox);
1390
+ setTimeout(() => cb(combobox));
1391
+ return this;
1392
+ }
1393
+ addObjectGrid(cb) {
1394
+ this.mountSettingRow();
1395
+ const grid = new ObjectGridSettingComponent(this.controlEl);
1396
+ this.components.push(grid);
1397
+ setTimeout(() => cb(grid));
1398
+ return this;
1399
+ }
1400
+ addObjectMap(cb) {
1401
+ this.mountSettingRow();
1402
+ const map = new ObjectMapSettingComponent(this.controlEl);
1403
+ this.components.push(map);
1404
+ setTimeout(() => cb(map));
1405
+ return this;
1406
+ }
1407
+ addObjectArray(cb) {
1408
+ this.mountSettingRow();
1409
+ const table = new ObjectArraySettingComponent(this.controlEl);
1410
+ this.components.push(table);
1411
+ setTimeout(() => cb(table));
1412
+ return this;
1413
+ }
1414
+ addDatePicker(cb) {
1415
+ this.mountSettingRow();
1416
+ const picker = new DateSettingComponent(this.controlEl);
1417
+ this.components.push(picker);
1418
+ setTimeout(() => cb(picker));
1419
+ return this;
1420
+ }
1421
+ }