@mnaoumov/obsidian-lib 10.11.0 → 11.0.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 (460) hide show
  1. package/README.md +26 -0
  2. package/components/all-windows-status-bar-item-component/package.json +6 -0
  3. package/components/shared-component-pool-component/package.json +6 -0
  4. package/components/worker-component/package.json +6 -0
  5. package/components/worker-pool-component/package.json +6 -0
  6. package/components/workspace-layout-state-component/package.json +6 -0
  7. package/dist/lib/cjs/__merged.cjs +477 -285
  8. package/dist/lib/cjs/__merged.d.cts +26 -10
  9. package/dist/lib/cjs/anchored-suggest.cjs +1 -1
  10. package/dist/lib/cjs/app.cjs +2 -2
  11. package/dist/lib/cjs/async-with-notice.cjs +4 -4
  12. package/dist/lib/cjs/attachment-path.cjs +9 -9
  13. package/dist/lib/cjs/attachment-path.d.cts +3 -3
  14. package/dist/lib/cjs/attachment-unit-folder.cjs +2 -2
  15. package/dist/lib/cjs/backlink-index.cjs +5 -5
  16. package/dist/lib/cjs/backlink.cjs +7 -7
  17. package/dist/lib/cjs/bases-view-registrar.cjs +1 -1
  18. package/dist/lib/cjs/broken-link-candidates.cjs +1 -1
  19. package/dist/lib/cjs/bug-report-diagnostics.cjs +222 -0
  20. package/dist/lib/cjs/bug-report-diagnostics.d.cts +186 -0
  21. package/dist/lib/cjs/bug-report.cjs +38 -12
  22. package/dist/lib/cjs/bug-report.d.cts +65 -0
  23. package/dist/lib/cjs/bulk-operation-progress.cjs +1 -1
  24. package/dist/lib/cjs/bulk-operation.cjs +2 -2
  25. package/dist/lib/cjs/callout.cjs +6 -6
  26. package/dist/lib/cjs/canvas.cjs +11 -9
  27. package/dist/lib/cjs/canvas.d.cts +13 -0
  28. package/dist/lib/cjs/case-insensitive-file-index.cjs +3 -3
  29. package/dist/lib/cjs/code-block-render-handoff.cjs +5 -5
  30. package/dist/lib/cjs/codemirror/editor-mode-extension.cjs +4 -4
  31. package/dist/lib/cjs/codemirror/incremental-parse-state-field.cjs +2 -2
  32. package/dist/lib/cjs/codemirror/index.cjs +7 -7
  33. package/dist/lib/cjs/codemirror/inline-token-widgets.cjs +5 -5
  34. package/dist/lib/cjs/codemirror/markdown-editor-views.cjs +2 -2
  35. package/dist/lib/cjs/codemirror/settings-facet.cjs +1 -1
  36. package/dist/lib/cjs/command-handlers/abstract-file-command-handler.cjs +17 -17
  37. package/dist/lib/cjs/command-handlers/abstract-file-command-handler.d.cts +13 -13
  38. package/dist/lib/cjs/command-handlers/command-handler-component.cjs +2 -2
  39. package/dist/lib/cjs/command-handlers/command-handler.cjs +2 -2
  40. package/dist/lib/cjs/command-handlers/editor-command-handler.cjs +10 -10
  41. package/dist/lib/cjs/command-handlers/editor-command-handler.d.cts +7 -7
  42. package/dist/lib/cjs/command-handlers/file-command-handler.cjs +3 -3
  43. package/dist/lib/cjs/command-handlers/folder-command-handler.cjs +3 -3
  44. package/dist/lib/cjs/command-handlers/global-command-handler.cjs +2 -2
  45. package/dist/lib/cjs/command-handlers/index.cjs +15 -15
  46. package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.cjs +95 -4
  47. package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.d.cts +34 -2
  48. package/dist/lib/cjs/command-handlers/open-demo-vault-command-handler.cjs +2 -2
  49. package/dist/lib/cjs/command-handlers/open-discussion-command-handler.cjs +2 -2
  50. package/dist/lib/cjs/command-handlers/open-feature-request-command-handler.cjs +2 -2
  51. package/dist/lib/cjs/command-handlers/open-git-hub-command-handler.cjs +1 -1
  52. package/dist/lib/cjs/command-handlers/open-settings-command-handler.cjs +2 -2
  53. package/dist/lib/cjs/command-handlers/undo-bulk-operation-command-handler.cjs +2 -2
  54. package/dist/lib/cjs/command-handlers/unlock-active-note-command-handler.cjs +1 -1
  55. package/dist/lib/cjs/community-plugins.cjs +3 -3
  56. package/dist/lib/cjs/components/abort-signal-component.cjs +2 -2
  57. package/dist/lib/cjs/components/all-windows-event-component.cjs +5 -5
  58. package/dist/lib/cjs/components/all-windows-status-bar-item-component.cjs +245 -0
  59. package/dist/lib/cjs/components/all-windows-status-bar-item-component.d.cts +146 -0
  60. package/dist/lib/cjs/components/async-error-handler-component.cjs +5 -5
  61. package/dist/lib/cjs/components/async-events-component.cjs +1 -1
  62. package/dist/lib/cjs/components/bulk-operation-commit-component.cjs +12 -12
  63. package/dist/lib/cjs/components/case-insensitive-file-index-component.cjs +2 -2
  64. package/dist/lib/cjs/components/component-ex.cjs +21 -11
  65. package/dist/lib/cjs/components/component-ex.d.cts +11 -0
  66. package/dist/lib/cjs/components/console-debug-component.cjs +2 -2
  67. package/dist/lib/cjs/components/core-plugin-toggle-component.cjs +2 -2
  68. package/dist/lib/cjs/components/disposable-component.cjs +2 -2
  69. package/dist/lib/cjs/components/embed-extensions-component.cjs +21 -4
  70. package/dist/lib/cjs/components/embed-extensions-component.d.cts +8 -0
  71. package/dist/lib/cjs/components/embeddable-markdown-editor-component.cjs +24 -10
  72. package/dist/lib/cjs/components/embeddable-markdown-editor-component.d.cts +9 -0
  73. package/dist/lib/cjs/components/file-explorer-root-menu-component.cjs +7 -7
  74. package/dist/lib/cjs/components/generate-markdown-link-default-params-component.cjs +2 -2
  75. package/dist/lib/cjs/components/incremental-file-index-component.cjs +4 -4
  76. package/dist/lib/cjs/components/index.cjs +54 -39
  77. package/dist/lib/cjs/components/index.d.cts +5 -0
  78. package/dist/lib/cjs/components/layout-ready-component.cjs +3 -3
  79. package/dist/lib/cjs/components/menu-event-registrar-component.cjs +2 -2
  80. package/dist/lib/cjs/components/monkey-around-component.cjs +3 -3
  81. package/dist/lib/cjs/components/notebook-navigator-menu-event-registrar-component.cjs +5 -5
  82. package/dist/lib/cjs/components/plugin-context-component.cjs +5 -5
  83. package/dist/lib/cjs/components/plugin-gate-component.cjs +69 -36
  84. package/dist/lib/cjs/components/plugin-gate-component.d.cts +36 -13
  85. package/dist/lib/cjs/components/plugin-notice-component.cjs +39 -33
  86. package/dist/lib/cjs/components/plugin-notice-component.d.cts +4 -3
  87. package/dist/lib/cjs/components/plugin-settings-component.cjs +119 -18
  88. package/dist/lib/cjs/components/plugin-settings-component.d.cts +35 -5
  89. package/dist/lib/cjs/components/plugin-settings-tab-component.cjs +2 -2
  90. package/dist/lib/cjs/components/plugin-suggestion-component.cjs +8 -8
  91. package/dist/lib/cjs/components/pointer-position-component.cjs +2 -2
  92. package/dist/lib/cjs/components/reconfigurable-editor-extension-component.cjs +3 -3
  93. package/dist/lib/cjs/components/registry-component.cjs +2 -2
  94. package/dist/lib/cjs/components/release-notes-component.cjs +6 -6
  95. package/dist/lib/cjs/components/rename-delete-handler-component.cjs +25 -25
  96. package/dist/lib/cjs/components/rmdir-guard-component.cjs +2 -2
  97. package/dist/lib/cjs/components/settings-facet-component.cjs +1 -1
  98. package/dist/lib/cjs/components/settings-migration-component.cjs +5 -5
  99. package/dist/lib/cjs/components/shared-component-pool-component.cjs +368 -0
  100. package/dist/lib/cjs/components/shared-component-pool-component.d.cts +129 -0
  101. package/dist/lib/cjs/components/style-sheet-component.cjs +3 -3
  102. package/dist/lib/cjs/components/syntax-highlighting-component.cjs +3 -3
  103. package/dist/lib/cjs/components/templates-language-component.cjs +1 -1
  104. package/dist/lib/cjs/components/worker-component.cjs +363 -0
  105. package/dist/lib/cjs/components/worker-component.d.cts +156 -0
  106. package/dist/lib/cjs/components/worker-pool-component.cjs +185 -0
  107. package/dist/lib/cjs/components/worker-pool-component.d.cts +102 -0
  108. package/dist/lib/cjs/components/workspace-layout-state-component.cjs +495 -0
  109. package/dist/lib/cjs/components/workspace-layout-state-component.d.cts +239 -0
  110. package/dist/lib/cjs/constructors/get-dom-events-handlers-constructor.cjs +5 -5
  111. package/dist/lib/cjs/constructors/index.cjs +1 -1
  112. package/dist/lib/cjs/css-class.cjs +5 -1
  113. package/dist/lib/cjs/css-class.d.cts +16 -0
  114. package/dist/lib/cjs/data-handler.cjs +264 -6
  115. package/dist/lib/cjs/data-handler.d.cts +219 -2
  116. package/dist/lib/cjs/data-stores/data-store-locations.cjs +82 -24
  117. package/dist/lib/cjs/data-stores/data-store-locations.d.cts +15 -0
  118. package/dist/lib/cjs/data-stores/data-store-replica.cjs +33 -5
  119. package/dist/lib/cjs/data-stores/data-store-seeds.cjs +6 -6
  120. package/dist/lib/cjs/data-stores/data-store-seeds.d.cts +2 -2
  121. package/dist/lib/cjs/data-stores/data-store-transport.cjs +81 -8
  122. package/dist/lib/cjs/data-stores/data-store-transport.d.cts +30 -1
  123. package/dist/lib/cjs/data-stores/index.cjs +6 -6
  124. package/dist/lib/cjs/data-stores/local-data-store.cjs +74 -10
  125. package/dist/lib/cjs/data-stores/local-data-store.d.cts +58 -1
  126. package/dist/lib/cjs/data-stores/shared-data-store.cjs +76 -19
  127. package/dist/lib/cjs/data-stores/shared-data-store.d.cts +18 -1
  128. package/dist/lib/cjs/dataview-link.cjs +2 -2
  129. package/dist/lib/cjs/dataview.cjs +27 -7
  130. package/dist/lib/cjs/dataview.d.cts +14 -0
  131. package/dist/lib/cjs/debug.cjs +3 -3
  132. package/dist/lib/cjs/demo-vault-helper.cjs +34 -6
  133. package/dist/lib/cjs/demo-vault-helper.d.cts +6 -2
  134. package/dist/lib/cjs/desktop-bulk-operation-git.cjs +10 -10
  135. package/dist/lib/cjs/desktop-demo-vault-opener.cjs +13 -13
  136. package/dist/lib/cjs/desktop-git-runner.cjs +4 -14
  137. package/dist/lib/cjs/desktop-git-runner.d.cts +8 -2
  138. package/dist/lib/cjs/desktop-operating-system.cjs +1 -1
  139. package/dist/lib/cjs/desktop-request-url-stream.cjs +8 -14
  140. package/dist/lib/cjs/desktop-trusted-input.cjs +2 -2
  141. package/dist/lib/cjs/disposable.cjs +150 -0
  142. package/dist/lib/cjs/disposable.d.cts +39 -0
  143. package/dist/lib/cjs/editor-extension-registrar.cjs +1 -1
  144. package/dist/lib/cjs/editor-suggest-registrar.cjs +2 -2
  145. package/dist/lib/cjs/editor-suggest.cjs +1 -1
  146. package/dist/lib/cjs/editor.cjs +6 -6
  147. package/dist/lib/cjs/events.cjs +2 -2
  148. package/dist/lib/cjs/extensions-registrar.cjs +1 -1
  149. package/dist/lib/cjs/feature-request.cjs +1 -1
  150. package/dist/lib/cjs/file-change.cjs +10 -10
  151. package/dist/lib/cjs/file-explorer.cjs +2 -2
  152. package/dist/lib/cjs/file-manager.cjs +5 -5
  153. package/dist/lib/cjs/file-system.cjs +10 -10
  154. package/dist/lib/cjs/folder-note.cjs +4 -4
  155. package/dist/lib/cjs/frontmatter-formatting.cjs +7 -6
  156. package/dist/lib/cjs/frontmatter-link-cache-with-offsets.cjs +1 -1
  157. package/dist/lib/cjs/frontmatter.cjs +5 -5
  158. package/dist/lib/cjs/generated-during-build.cjs +2 -2
  159. package/dist/lib/cjs/git-rename-history.cjs +1 -1
  160. package/dist/lib/cjs/git-rename-history.d.cts +2 -2
  161. package/dist/lib/cjs/hotkey.cjs +1 -1
  162. package/dist/lib/cjs/hover-link-source-registrar.cjs +1 -1
  163. package/dist/lib/cjs/html-element.cjs +2 -2
  164. package/dist/lib/cjs/i18n/custom-type-options.cjs +1 -1
  165. package/dist/lib/cjs/i18n/default-translations.cjs +1 -1
  166. package/dist/lib/cjs/i18n/i18n.cjs +7 -7
  167. package/dist/lib/cjs/i18n/index.cjs +4 -4
  168. package/dist/lib/cjs/i18n/locales/en.cjs +27 -1
  169. package/dist/lib/cjs/i18n/locales/en.d.cts +26 -0
  170. package/dist/lib/cjs/i18n/locales/index.cjs +2 -2
  171. package/dist/lib/cjs/i18n/locales/translations-map.cjs +1 -1
  172. package/dist/lib/cjs/i18n/locales/translations-map.d.cts +26 -0
  173. package/dist/lib/cjs/index.cjs +147 -126
  174. package/dist/lib/cjs/index.d.cts +7 -0
  175. package/dist/lib/cjs/inline-token-renderer.cjs +2 -2
  176. package/dist/lib/cjs/is-in-obsidian.cjs +1 -1
  177. package/dist/lib/cjs/library-styles.cjs +3 -3
  178. package/dist/lib/cjs/link-and-tag-input-suggest.cjs +2 -2
  179. package/dist/lib/cjs/link.cjs +76 -56
  180. package/dist/lib/cjs/link.d.cts +20 -14
  181. package/dist/lib/cjs/logger.cjs +4 -4
  182. package/dist/lib/cjs/loop.cjs +10 -16
  183. package/dist/lib/cjs/markdown-code-block-processor-registrar.cjs +17 -2
  184. package/dist/lib/cjs/markdown-code-block-processor-registrar.d.cts +7 -0
  185. package/dist/lib/cjs/markdown-code-block-processor.cjs +13 -13
  186. package/dist/lib/cjs/markdown-post-processor-registrar.cjs +2 -2
  187. package/dist/lib/cjs/markdown-view.cjs +191 -3
  188. package/dist/lib/cjs/markdown-view.d.cts +48 -1
  189. package/dist/lib/cjs/markdown.cjs +12 -12
  190. package/dist/lib/cjs/metadata-cache.cjs +23 -23
  191. package/dist/lib/cjs/metadata-cache.d.cts +5 -4
  192. package/dist/lib/cjs/misplaced-attachment.cjs +297 -0
  193. package/dist/lib/cjs/misplaced-attachment.d.cts +228 -0
  194. package/dist/lib/cjs/mobile-app-info.cjs +1 -1
  195. package/dist/lib/cjs/modals/alert.cjs +4 -4
  196. package/dist/lib/cjs/modals/code-block-builder.cjs +7 -7
  197. package/dist/lib/cjs/modals/confirm.cjs +4 -4
  198. package/dist/lib/cjs/modals/copy-text-manually.cjs +181 -0
  199. package/dist/lib/cjs/modals/copy-text-manually.d.cts +38 -0
  200. package/dist/lib/cjs/modals/index.cjs +17 -11
  201. package/dist/lib/cjs/modals/index.d.cts +2 -0
  202. package/dist/lib/cjs/modals/minimizable-modal.cjs +6 -6
  203. package/dist/lib/cjs/modals/modal-command-builder.cjs +3 -3
  204. package/dist/lib/cjs/modals/modal.cjs +3 -3
  205. package/dist/lib/cjs/modals/prompt.cjs +10 -10
  206. package/dist/lib/cjs/modals/prompt.d.cts +1 -1
  207. package/dist/lib/cjs/modals/review-bug-report-diagnostics.cjs +202 -0
  208. package/dist/lib/cjs/modals/review-bug-report-diagnostics.d.cts +30 -0
  209. package/dist/lib/cjs/modals/select-item.cjs +6 -6
  210. package/dist/lib/cjs/modals/select-option.cjs +3 -3
  211. package/dist/lib/cjs/modals/suggest-modal-command-builder.cjs +1 -1
  212. package/dist/lib/cjs/note-priority.cjs +2 -2
  213. package/dist/lib/cjs/notebook-navigator.cjs +12 -2
  214. package/dist/lib/cjs/notebook-navigator.d.cts +6 -0
  215. package/dist/lib/cjs/obsidian-lib-state.cjs +1 -1
  216. package/dist/lib/cjs/obsidian-protocol-handler-registrar.cjs +1 -1
  217. package/dist/lib/cjs/obsidian-settings.cjs +1 -1
  218. package/dist/lib/cjs/obsidian-word-characters.cjs +1 -1
  219. package/dist/lib/cjs/parse-link.cjs +14 -14
  220. package/dist/lib/cjs/path-compatibility.cjs +368 -0
  221. package/dist/lib/cjs/path-compatibility.d.cts +263 -0
  222. package/dist/lib/cjs/path-settings.cjs +3 -3
  223. package/dist/lib/cjs/pdf.cjs +2 -2
  224. package/dist/lib/cjs/plugin/index.cjs +18 -12
  225. package/dist/lib/cjs/plugin/index.d.cts +2 -0
  226. package/dist/lib/cjs/plugin/plugin-api.cjs +21 -12
  227. package/dist/lib/cjs/plugin/plugin-api.d.cts +5 -1
  228. package/dist/lib/cjs/plugin/plugin-async-cleanup.cjs +6 -3
  229. package/dist/lib/cjs/plugin/plugin-async-cleanup.d.cts +5 -0
  230. package/dist/lib/cjs/plugin/plugin-context.cjs +10 -9
  231. package/dist/lib/cjs/plugin/plugin-event-source.cjs +1 -1
  232. package/dist/lib/cjs/plugin/plugin-event-source.d.cts +4 -4
  233. package/dist/lib/cjs/plugin/plugin-install-state.cjs +49 -4
  234. package/dist/lib/cjs/plugin/plugin-install-state.d.cts +30 -0
  235. package/dist/lib/cjs/plugin/plugin-instance.cjs +450 -0
  236. package/dist/lib/cjs/plugin/plugin-instance.d.cts +258 -0
  237. package/dist/lib/cjs/plugin/plugin-lifecycle-events.cjs +1 -1
  238. package/dist/lib/cjs/plugin/plugin-lifecycle-events.d.cts +6 -4
  239. package/dist/lib/cjs/plugin/plugin-settings-tab.cjs +15 -15
  240. package/dist/lib/cjs/plugin/plugin.cjs +133 -34
  241. package/dist/lib/cjs/plugin/plugin.d.cts +35 -5
  242. package/dist/lib/cjs/plugin/settings-migration-api.cjs +1 -1
  243. package/dist/lib/cjs/plugin/third-party-plugin.cjs +231 -0
  244. package/dist/lib/cjs/plugin/third-party-plugin.d.cts +244 -0
  245. package/dist/lib/cjs/plugin-cli-handler-registrar.cjs +2 -2
  246. package/dist/lib/cjs/popovers/field-popover.cjs +4 -4
  247. package/dist/lib/cjs/popovers/index.cjs +3 -3
  248. package/dist/lib/cjs/popovers/popover-anchor.cjs +1 -1
  249. package/dist/lib/cjs/popovers/popover.cjs +5 -5
  250. package/dist/lib/cjs/queue.cjs +8 -8
  251. package/dist/lib/cjs/react/app-context.cjs +3 -3
  252. package/dist/lib/cjs/react/index.cjs +1 -1
  253. package/dist/lib/cjs/reference-definition.cjs +1 -1
  254. package/dist/lib/cjs/reference.cjs +3 -3
  255. package/dist/lib/cjs/release-asset.cjs +5 -5
  256. package/dist/lib/cjs/rendered-markdown.cjs +4 -4
  257. package/dist/lib/cjs/request-url.cjs +4 -4
  258. package/dist/lib/cjs/resource-lock.cjs +46 -42
  259. package/dist/lib/cjs/resource-lock.d.cts +8 -7
  260. package/dist/lib/cjs/resource-url.cjs +3 -3
  261. package/dist/lib/cjs/ribbon-icon-registrar.cjs +1 -1
  262. package/dist/lib/cjs/setting-components/checkbox-component.cjs +3 -3
  263. package/dist/lib/cjs/setting-components/code-highlighter-component.cjs +7 -7
  264. package/dist/lib/cjs/setting-components/date-component.cjs +4 -4
  265. package/dist/lib/cjs/setting-components/date-time-component.cjs +4 -4
  266. package/dist/lib/cjs/setting-components/email-component.cjs +2 -2
  267. package/dist/lib/cjs/setting-components/file-component.cjs +2 -2
  268. package/dist/lib/cjs/setting-components/folder-list-component.cjs +3 -3
  269. package/dist/lib/cjs/setting-components/hotkey-component.cjs +5 -5
  270. package/dist/lib/cjs/setting-components/index.cjs +30 -30
  271. package/dist/lib/cjs/setting-components/list-component.cjs +5 -5
  272. package/dist/lib/cjs/setting-components/month-component.cjs +4 -4
  273. package/dist/lib/cjs/setting-components/multiple-dropdown-component.cjs +3 -3
  274. package/dist/lib/cjs/setting-components/multiple-email-component.cjs +2 -2
  275. package/dist/lib/cjs/setting-components/multiple-file-component.cjs +3 -3
  276. package/dist/lib/cjs/setting-components/multiple-text-component.cjs +9 -6
  277. package/dist/lib/cjs/setting-components/multiple-text-component.d.cts +4 -1
  278. package/dist/lib/cjs/setting-components/number-component.cjs +2 -2
  279. package/dist/lib/cjs/setting-components/password-component.cjs +2 -2
  280. package/dist/lib/cjs/setting-components/setting-component-wrapper.cjs +3 -3
  281. package/dist/lib/cjs/setting-components/tag-list-component.cjs +4 -4
  282. package/dist/lib/cjs/setting-components/telephone-component.cjs +2 -2
  283. package/dist/lib/cjs/setting-components/text-based-component.cjs +1 -1
  284. package/dist/lib/cjs/setting-components/time-component.cjs +3 -3
  285. package/dist/lib/cjs/setting-components/tri-state-checkbox-component.cjs +3 -3
  286. package/dist/lib/cjs/setting-components/typed-dropdown-component.cjs +3 -3
  287. package/dist/lib/cjs/setting-components/typed-multiple-dropdown-component.cjs +4 -4
  288. package/dist/lib/cjs/setting-components/typed-range-text-component.cjs +1 -1
  289. package/dist/lib/cjs/setting-components/typed-text-component.cjs +3 -3
  290. package/dist/lib/cjs/setting-components/url-component.cjs +2 -2
  291. package/dist/lib/cjs/setting-components/validator-component.cjs +4 -4
  292. package/dist/lib/cjs/setting-components/week-component.cjs +4 -4
  293. package/dist/lib/cjs/setting-ex.cjs +26 -26
  294. package/dist/lib/cjs/setting-group-ex.cjs +2 -2
  295. package/dist/lib/cjs/settings-recovery.cjs +217 -0
  296. package/dist/lib/cjs/settings-recovery.d.cts +178 -0
  297. package/dist/lib/cjs/settings-tabs.cjs +5 -5
  298. package/dist/lib/cjs/status-bar-item-registrar.cjs +1 -1
  299. package/dist/lib/cjs/templater.cjs +14 -4
  300. package/dist/lib/cjs/templater.d.cts +6 -0
  301. package/dist/lib/cjs/transformers/duration-transformer.cjs +2 -2
  302. package/dist/lib/cjs/transformers/index.cjs +1 -1
  303. package/dist/lib/cjs/trusted-input.cjs +1 -1
  304. package/dist/lib/cjs/validation.cjs +4 -4
  305. package/dist/lib/cjs/vault-delete.cjs +6 -6
  306. package/dist/lib/cjs/vault-transaction.cjs +5 -5
  307. package/dist/lib/cjs/vault.cjs +12 -12
  308. package/dist/lib/cjs/view-registrar.cjs +1 -1
  309. package/dist/lib/cjs/virtual-file.cjs +16 -14
  310. package/dist/lib/cjs/virtual-file.d.cts +2 -1
  311. package/dist/lib/cjs/wasm.cjs +119 -0
  312. package/dist/lib/cjs/wasm.d.cts +54 -0
  313. package/dist/lib/cjs/worker-protocol.cjs +209 -0
  314. package/dist/lib/cjs/worker-protocol.d.cts +282 -0
  315. package/dist/lib/cjs/workspace.cjs +1 -1
  316. package/dist/lib/esm/__merged.d.mts +26 -10
  317. package/dist/lib/esm/__merged.mjs +215 -5
  318. package/dist/lib/esm/app.mjs +2 -2
  319. package/dist/lib/esm/attachment-path.d.mts +3 -3
  320. package/dist/lib/esm/attachment-path.mjs +2 -2
  321. package/dist/lib/esm/backlink-index.mjs +2 -2
  322. package/dist/lib/esm/bug-report-diagnostics.d.mts +186 -0
  323. package/dist/lib/esm/bug-report-diagnostics.mjs +127 -0
  324. package/dist/lib/esm/bug-report.d.mts +65 -0
  325. package/dist/lib/esm/bug-report.mjs +33 -10
  326. package/dist/lib/esm/canvas.d.mts +13 -0
  327. package/dist/lib/esm/canvas.mjs +6 -5
  328. package/dist/lib/esm/command-handlers/abstract-file-command-handler.d.mts +13 -13
  329. package/dist/lib/esm/command-handlers/abstract-file-command-handler.mjs +14 -14
  330. package/dist/lib/esm/command-handlers/editor-command-handler.d.mts +7 -7
  331. package/dist/lib/esm/command-handlers/editor-command-handler.mjs +8 -8
  332. package/dist/lib/esm/command-handlers/open-bug-report-command-handler.d.mts +34 -2
  333. package/dist/lib/esm/command-handlers/open-bug-report-command-handler.mjs +99 -3
  334. package/dist/lib/esm/components/all-windows-status-bar-item-component.d.mts +146 -0
  335. package/dist/lib/esm/components/all-windows-status-bar-item-component.mjs +154 -0
  336. package/dist/lib/esm/components/component-ex.d.mts +11 -0
  337. package/dist/lib/esm/components/component-ex.mjs +19 -6
  338. package/dist/lib/esm/components/disposable-component.mjs +1 -1
  339. package/dist/lib/esm/components/embed-extensions-component.d.mts +8 -0
  340. package/dist/lib/esm/components/embed-extensions-component.mjs +20 -3
  341. package/dist/lib/esm/components/embeddable-markdown-editor-component.d.mts +9 -0
  342. package/dist/lib/esm/components/embeddable-markdown-editor-component.mjs +16 -2
  343. package/dist/lib/esm/components/index.d.mts +5 -0
  344. package/dist/lib/esm/components/index.mjs +12 -2
  345. package/dist/lib/esm/components/plugin-gate-component.d.mts +36 -13
  346. package/dist/lib/esm/components/plugin-gate-component.mjs +61 -26
  347. package/dist/lib/esm/components/plugin-notice-component.d.mts +4 -3
  348. package/dist/lib/esm/components/plugin-notice-component.mjs +30 -21
  349. package/dist/lib/esm/components/plugin-settings-component.d.mts +35 -5
  350. package/dist/lib/esm/components/plugin-settings-component.mjs +105 -4
  351. package/dist/lib/esm/components/rename-delete-handler-component.mjs +2 -2
  352. package/dist/lib/esm/components/shared-component-pool-component.d.mts +129 -0
  353. package/dist/lib/esm/components/shared-component-pool-component.mjs +280 -0
  354. package/dist/lib/esm/components/worker-component.d.mts +156 -0
  355. package/dist/lib/esm/components/worker-component.mjs +279 -0
  356. package/dist/lib/esm/components/worker-pool-component.d.mts +102 -0
  357. package/dist/lib/esm/components/worker-pool-component.mjs +95 -0
  358. package/dist/lib/esm/components/workspace-layout-state-component.d.mts +239 -0
  359. package/dist/lib/esm/components/workspace-layout-state-component.mjs +404 -0
  360. package/dist/lib/esm/css-class.d.mts +16 -0
  361. package/dist/lib/esm/css-class.mjs +5 -1
  362. package/dist/lib/esm/data-handler.d.mts +219 -2
  363. package/dist/lib/esm/data-handler.mjs +262 -5
  364. package/dist/lib/esm/data-stores/data-store-locations.d.mts +15 -0
  365. package/dist/lib/esm/data-stores/data-store-locations.mjs +80 -22
  366. package/dist/lib/esm/data-stores/data-store-replica.mjs +33 -5
  367. package/dist/lib/esm/data-stores/data-store-seeds.d.mts +2 -2
  368. package/dist/lib/esm/data-stores/data-store-seeds.mjs +4 -4
  369. package/dist/lib/esm/data-stores/data-store-transport.d.mts +30 -1
  370. package/dist/lib/esm/data-stores/data-store-transport.mjs +78 -5
  371. package/dist/lib/esm/data-stores/local-data-store.d.mts +58 -1
  372. package/dist/lib/esm/data-stores/local-data-store.mjs +71 -9
  373. package/dist/lib/esm/data-stores/shared-data-store.d.mts +18 -1
  374. package/dist/lib/esm/data-stores/shared-data-store.mjs +72 -15
  375. package/dist/lib/esm/dataview.d.mts +14 -0
  376. package/dist/lib/esm/dataview.mjs +19 -1
  377. package/dist/lib/esm/demo-vault-helper.d.mts +6 -2
  378. package/dist/lib/esm/demo-vault-helper.mjs +29 -1
  379. package/dist/lib/esm/desktop-demo-vault-opener.mjs +1 -1
  380. package/dist/lib/esm/desktop-git-runner.d.mts +8 -2
  381. package/dist/lib/esm/desktop-git-runner.mjs +3 -3
  382. package/dist/lib/esm/desktop-request-url-stream.mjs +4 -10
  383. package/dist/lib/esm/disposable.d.mts +39 -0
  384. package/dist/lib/esm/disposable.mjs +64 -0
  385. package/dist/lib/esm/file-system.mjs +2 -2
  386. package/dist/lib/esm/frontmatter-formatting.mjs +2 -1
  387. package/dist/lib/esm/generated-during-build.mjs +2 -2
  388. package/dist/lib/esm/git-rename-history.d.mts +2 -2
  389. package/dist/lib/esm/git-rename-history.mjs +1 -1
  390. package/dist/lib/esm/i18n/locales/en.d.mts +26 -0
  391. package/dist/lib/esm/i18n/locales/en.mjs +27 -1
  392. package/dist/lib/esm/i18n/locales/translations-map.d.mts +26 -0
  393. package/dist/lib/esm/index.d.mts +7 -0
  394. package/dist/lib/esm/index.mjs +15 -1
  395. package/dist/lib/esm/link.d.mts +20 -14
  396. package/dist/lib/esm/link.mjs +57 -38
  397. package/dist/lib/esm/loop.mjs +2 -8
  398. package/dist/lib/esm/markdown-code-block-processor-registrar.d.mts +7 -0
  399. package/dist/lib/esm/markdown-code-block-processor-registrar.mjs +16 -1
  400. package/dist/lib/esm/markdown-view.d.mts +48 -1
  401. package/dist/lib/esm/markdown-view.mjs +192 -2
  402. package/dist/lib/esm/metadata-cache.d.mts +5 -4
  403. package/dist/lib/esm/metadata-cache.mjs +6 -6
  404. package/dist/lib/esm/misplaced-attachment.d.mts +228 -0
  405. package/dist/lib/esm/misplaced-attachment.mjs +212 -0
  406. package/dist/lib/esm/modals/copy-text-manually.d.mts +38 -0
  407. package/dist/lib/esm/modals/copy-text-manually.mjs +99 -0
  408. package/dist/lib/esm/modals/index.d.mts +2 -0
  409. package/dist/lib/esm/modals/index.mjs +5 -1
  410. package/dist/lib/esm/modals/prompt.d.mts +1 -1
  411. package/dist/lib/esm/modals/prompt.mjs +1 -1
  412. package/dist/lib/esm/modals/review-bug-report-diagnostics.d.mts +30 -0
  413. package/dist/lib/esm/modals/review-bug-report-diagnostics.mjs +120 -0
  414. package/dist/lib/esm/notebook-navigator.d.mts +6 -0
  415. package/dist/lib/esm/notebook-navigator.mjs +11 -2
  416. package/dist/lib/esm/parse-link.mjs +4 -4
  417. package/dist/lib/esm/path-compatibility.d.mts +263 -0
  418. package/dist/lib/esm/path-compatibility.mjs +277 -0
  419. package/dist/lib/esm/plugin/index.d.mts +2 -0
  420. package/dist/lib/esm/plugin/index.mjs +6 -2
  421. package/dist/lib/esm/plugin/plugin-api.d.mts +5 -1
  422. package/dist/lib/esm/plugin/plugin-api.mjs +13 -4
  423. package/dist/lib/esm/plugin/plugin-async-cleanup.d.mts +5 -0
  424. package/dist/lib/esm/plugin/plugin-async-cleanup.mjs +3 -1
  425. package/dist/lib/esm/plugin/plugin-context.mjs +2 -1
  426. package/dist/lib/esm/plugin/plugin-event-source.d.mts +4 -4
  427. package/dist/lib/esm/plugin/plugin-event-source.mjs +1 -1
  428. package/dist/lib/esm/plugin/plugin-install-state.d.mts +30 -0
  429. package/dist/lib/esm/plugin/plugin-install-state.mjs +44 -1
  430. package/dist/lib/esm/plugin/plugin-instance.d.mts +258 -0
  431. package/dist/lib/esm/plugin/plugin-instance.mjs +367 -0
  432. package/dist/lib/esm/plugin/plugin-lifecycle-events.d.mts +6 -4
  433. package/dist/lib/esm/plugin/plugin-lifecycle-events.mjs +1 -1
  434. package/dist/lib/esm/plugin/plugin.d.mts +35 -5
  435. package/dist/lib/esm/plugin/plugin.mjs +118 -9
  436. package/dist/lib/esm/plugin/third-party-plugin.d.mts +244 -0
  437. package/dist/lib/esm/plugin/third-party-plugin.mjs +147 -0
  438. package/dist/lib/esm/release-asset.mjs +1 -1
  439. package/dist/lib/esm/resource-lock.d.mts +8 -7
  440. package/dist/lib/esm/resource-lock.mjs +31 -26
  441. package/dist/lib/esm/setting-components/multiple-text-component.d.mts +4 -1
  442. package/dist/lib/esm/setting-components/multiple-text-component.mjs +6 -3
  443. package/dist/lib/esm/settings-recovery.d.mts +178 -0
  444. package/dist/lib/esm/settings-recovery.mjs +125 -0
  445. package/dist/lib/esm/settings-tabs.mjs +2 -2
  446. package/dist/lib/esm/templater.d.mts +6 -0
  447. package/dist/lib/esm/templater.mjs +11 -2
  448. package/dist/lib/esm/vault.mjs +1 -1
  449. package/dist/lib/esm/virtual-file.d.mts +2 -1
  450. package/dist/lib/esm/virtual-file.mjs +7 -5
  451. package/dist/lib/esm/wasm.d.mts +54 -0
  452. package/dist/lib/esm/wasm.mjs +30 -0
  453. package/dist/lib/esm/worker-protocol.d.mts +282 -0
  454. package/dist/lib/esm/worker-protocol.mjs +113 -0
  455. package/dist/styles.css +16 -1
  456. package/modals/copy-text-manually/package.json +6 -0
  457. package/modals/review-bug-report-diagnostics/package.json +6 -0
  458. package/package.json +10 -8
  459. package/plugin/plugin-instance/package.json +6 -0
  460. package/plugin/third-party-plugin/package.json +6 -0
@@ -0,0 +1,185 @@
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 patchObsidianRequire() {
6
+ const originalRequire = require;
7
+ if (!originalRequire || originalRequire.__isPatched) {
8
+ return;
9
+ }
10
+ require = Object.assign(
11
+ (id) => requirePatched(id),
12
+ originalRequire,
13
+ {
14
+ __isPatched: true
15
+ }
16
+ );
17
+ function extractDefault($module) {
18
+ return $module && $module.__esModule && "default" in $module ? $module.default : $module;
19
+ }
20
+ const OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
21
+ "@codemirror/autocomplete",
22
+ "@codemirror/collab",
23
+ "@codemirror/commands",
24
+ "@codemirror/language",
25
+ "@codemirror/lint",
26
+ "@codemirror/search",
27
+ "@codemirror/state",
28
+ "@codemirror/text",
29
+ "@codemirror/view",
30
+ "@lezer/common",
31
+ "@lezer/highlight",
32
+ "@lezer/lr",
33
+ "obsidian"
34
+ ]);
35
+ const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
36
+ "@codemirror/closebrackets",
37
+ "@codemirror/comment",
38
+ "@codemirror/fold",
39
+ "@codemirror/gutter",
40
+ "@codemirror/highlight",
41
+ "@codemirror/history",
42
+ "@codemirror/matchbrackets",
43
+ "@codemirror/panel",
44
+ "@codemirror/rangeset",
45
+ "@codemirror/rectangular-selection",
46
+ "@codemirror/stream-parser",
47
+ "@codemirror/tooltip"
48
+ ]);
49
+ function requirePatched(id) {
50
+ if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
51
+ return originalRequire?.(id);
52
+ }
53
+ const app = globalThis.app;
54
+ if (app?.isMobile) {
55
+ if (id === "process" || id === "node:process") {
56
+ console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
57
+ return process;
58
+ }
59
+ } else {
60
+ const $module = originalRequire?.(id);
61
+ if ($module) {
62
+ return extractDefault($module);
63
+ }
64
+ }
65
+ console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
66
+ return {};
67
+ }
68
+ })();
69
+
70
+ "use strict";
71
+ var __defProp = Object.defineProperty;
72
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
73
+ var __getOwnPropNames = Object.getOwnPropertyNames;
74
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
75
+ var __export = (target, all) => {
76
+ for (var name in all)
77
+ __defProp(target, name, { get: all[name], enumerable: true });
78
+ };
79
+ var __copyProps = (to, from, except, desc) => {
80
+ if (from && typeof from === "object" || typeof from === "function") {
81
+ for (let key of __getOwnPropNames(from))
82
+ if (!__hasOwnProp.call(to, key) && key !== except)
83
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
84
+ }
85
+ return to;
86
+ };
87
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
88
+ var worker_pool_component_exports = {};
89
+ __export(worker_pool_component_exports, {
90
+ MAX_DEFAULT_WORKER_POOL_SIZE: () => MAX_DEFAULT_WORKER_POOL_SIZE,
91
+ WorkerPoolComponent: () => WorkerPoolComponent,
92
+ getDefaultWorkerPoolSize: () => getDefaultWorkerPoolSize
93
+ });
94
+ module.exports = __toCommonJS(worker_pool_component_exports);
95
+ var import_component_ex = require("./component-ex.cjs");
96
+ var import_worker_component = require("./worker-component.cjs");
97
+ const MAX_DEFAULT_WORKER_POOL_SIZE = 4;
98
+ class WorkerPoolComponent extends import_component_ex.ComponentEx {
99
+ /**
100
+ * Creates the pool.
101
+ *
102
+ * @param params - The parameters.
103
+ */
104
+ constructor(params) {
105
+ super();
106
+ this.params = params;
107
+ const size = params.size ?? getDefaultWorkerPoolSize();
108
+ if (!Number.isSafeInteger(size) || size < 1) {
109
+ throw new Error(`A worker pool needs a positive integer size, not ${String(size)}`);
110
+ }
111
+ for (let index = 0; index < size; index++) {
112
+ const workerParams = {
113
+ source: params.source,
114
+ ...params.fallbackHandlers !== void 0 && { fallbackHandlers: params.fallbackHandlers },
115
+ ...params.name !== void 0 && { name: `${params.name} ${String(index)}` }
116
+ };
117
+ this.workers.push(this.addChild(new import_worker_component.WorkerComponent(workerParams)));
118
+ }
119
+ }
120
+ params;
121
+ /**
122
+ * The number of workers.
123
+ *
124
+ * @returns The size.
125
+ */
126
+ get size() {
127
+ return this.workers.length;
128
+ }
129
+ workers = [];
130
+ /**
131
+ * Calls a method on the least busy worker.
132
+ *
133
+ * @typeParam TMethod - The method.
134
+ * @param method - The method name.
135
+ * @param callArguments - The method's arguments.
136
+ * @param options - The call options.
137
+ * @returns The method's result.
138
+ */
139
+ async call(method, callArguments, options) {
140
+ let leastBusy = this.getWorker(0);
141
+ for (const worker of this.workers) {
142
+ if (worker.pendingCallCount < leastBusy.pendingCallCount) {
143
+ leastBusy = worker;
144
+ }
145
+ }
146
+ return await leastBusy.call(method, callArguments, options);
147
+ }
148
+ /**
149
+ * Calls a method on every worker with the same arguments, for instance to configure them all.
150
+ *
151
+ * @typeParam TMethod - The method.
152
+ * @param method - The method name.
153
+ * @param callArguments - The method's arguments, cloned for each worker; nothing can be transferred to all of them.
154
+ * @param abortSignal - Cancels every call.
155
+ * @returns The results, in worker order.
156
+ */
157
+ async callAll(method, callArguments, abortSignal) {
158
+ const options = abortSignal === void 0 ? {} : { abortSignal };
159
+ return await Promise.all(this.workers.map(async (worker) => await worker.call(method, callArguments, options)));
160
+ }
161
+ /**
162
+ * Gets one worker, for jobs that keep state in a particular worker.
163
+ *
164
+ * @param index - The worker index, from `0` to {@link WorkerPoolComponent.size} minus one.
165
+ * @returns The worker.
166
+ */
167
+ getWorker(index) {
168
+ const worker = this.workers[index];
169
+ if (!worker) {
170
+ throw new Error(`The worker pool has no worker at index ${String(index)}`);
171
+ }
172
+ return worker;
173
+ }
174
+ }
175
+ function getDefaultWorkerPoolSize(hardwareConcurrency) {
176
+ const processorCount = hardwareConcurrency ?? window.navigator.hardwareConcurrency;
177
+ return Math.max(1, Math.min(MAX_DEFAULT_WORKER_POOL_SIZE, processorCount - 1));
178
+ }
179
+ // Annotate the CommonJS export names for ESM import in node:
180
+ 0 && (module.exports = {
181
+ MAX_DEFAULT_WORKER_POOL_SIZE,
182
+ WorkerPoolComponent,
183
+ getDefaultWorkerPoolSize
184
+ });
185
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL3dvcmtlci1wb29sLWNvbXBvbmVudC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBmaWxlXG4gKlxuICogQSBjb21wb25lbnQgdGhhdCBvd25zIHNldmVyYWwgd29ya2VycyBidWlsdCBmcm9tIHRoZSBzYW1lIGJ1bmRsZWQgc291cmNlIGFuZCBzcHJlYWRzIGNhbGxzIG92ZXIgdGhlbS5cbiAqL1xuXG5pbXBvcnQgdHlwZSB7XG4gIFdvcmtlckFwaSxcbiAgV29ya2VyQXBpSGFuZGxlcnNcbn0gZnJvbSAnLi4vd29ya2VyLXByb3RvY29sLnRzJztcbmltcG9ydCB0eXBlIHtcbiAgV29ya2VyQ29tcG9uZW50Q2FsbE9wdGlvbnMsXG4gIFdvcmtlck1ldGhvZCxcbiAgV29ya2VyTWV0aG9kUmVzdWx0XG59IGZyb20gJy4vd29ya2VyLWNvbXBvbmVudC50cyc7XG5cbmltcG9ydCB7IENvbXBvbmVudEV4IH0gZnJvbSAnLi9jb21wb25lbnQtZXgudHMnO1xuaW1wb3J0IHsgV29ya2VyQ29tcG9uZW50IH0gZnJvbSAnLi93b3JrZXItY29tcG9uZW50LnRzJztcblxuLyoqXG4gKiBUaGUgbW9zdCB3b3JrZXJzIHtAbGluayBnZXREZWZhdWx0V29ya2VyUG9vbFNpemV9IHN1Z2dlc3RzLCBzbyBhIHBvb2wgb24gYSBtYW55LWNvcmUgZGVza3RvcCBkb2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LE1BQU0sT0FBTyxLQUFLLFFBQVEsZUFBZSxPQUFPLENBQUMsQ0FBQztBQUFBLEVBQ2hIO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsRUFRTyxVQUFVLE9BQXNDO0FBQ3JELFVBQU0sU0FBUyxLQUFLLFFBQVEsS0FBSztBQUNqQyxRQUFJLENBQUMsUUFBUTtBQUNYLFlBQU0sSUFBSSxNQUFNLDBDQUEwQyxPQUFPLEtBQUssQ0FBQyxFQUFFO0FBQUEsSUFDM0U7QUFDQSxXQUFPO0FBQUEsRUFDVDtBQUNGO0FBU08sU0FBUyx5QkFBeUIscUJBQXNDO0FBQzdFLFFBQU0saUJBQWlCLHVCQUF1QixPQUFPLFVBQVU7QUFDL0QsU0FBTyxLQUFLLElBQUksR0FBRyxLQUFLLElBQUksOEJBQThCLGlCQUFpQixDQUFDLENBQUM7QUFDL0U7IiwibmFtZXMiOltdfQ==
@@ -0,0 +1,102 @@
1
+ /// <reference path="../library-references.d.cts" />
2
+ /// <reference lib="dom" />
3
+ /**
4
+ * @file
5
+ *
6
+ * A component that owns several workers built from the same bundled source and spreads calls over them.
7
+ */
8
+ import type { WorkerApi, WorkerApiHandlers } from '../worker-protocol.cjs';
9
+ import type { WorkerComponentCallOptions, WorkerMethod, WorkerMethodResult } from './worker-component.cjs';
10
+ import { ComponentEx } from './component-ex.cjs';
11
+ import { WorkerComponent } from './worker-component.cjs';
12
+ /**
13
+ * The most workers {@link getDefaultWorkerPoolSize} suggests, so a pool on a many-core desktop does not starve
14
+ * Obsidian's own renderer of memory.
15
+ */
16
+ export declare const MAX_DEFAULT_WORKER_POOL_SIZE = 4;
17
+ /**
18
+ * Options of {@link WorkerPoolComponent.call}: the same as {@link WorkerComponent.call}'s.
19
+ */
20
+ export type WorkerPoolComponentCallOptions = WorkerComponentCallOptions;
21
+ /**
22
+ * Parameters of {@link WorkerPoolComponent}.
23
+ *
24
+ * @typeParam TApi - The API every worker exposes.
25
+ */
26
+ export interface WorkerPoolComponentConstructorParams<TApi extends WorkerApi<TApi>> {
27
+ /**
28
+ * The handlers to run on the main thread when no `Worker` can be created. See {@link WorkerComponent}.
29
+ */
30
+ readonly fallbackHandlers?: WorkerApiHandlers<TApi>;
31
+ /**
32
+ * The workers' name prefix, shown by the developer tools; each worker gets `<name> <index>`.
33
+ */
34
+ readonly name?: string;
35
+ /**
36
+ * The number of workers. Defaults to {@link getDefaultWorkerPoolSize}.
37
+ */
38
+ readonly size?: number;
39
+ /**
40
+ * The bundled worker source.
41
+ */
42
+ readonly source: string;
43
+ }
44
+ /**
45
+ * Owns a fixed number of {@link WorkerComponent} children and sends each call to the one with the fewest pending calls.
46
+ *
47
+ * Use it for CPU-bound jobs that split into independent calls. A job that keeps state in a worker (a loaded corpus, an
48
+ * instantiated module) addresses each worker by index through {@link WorkerPoolComponent.getWorker} instead.
49
+ *
50
+ * @typeParam TApi - The API every worker exposes.
51
+ */
52
+ export declare class WorkerPoolComponent<TApi extends WorkerApi<TApi>> extends ComponentEx {
53
+ protected readonly params: WorkerPoolComponentConstructorParams<TApi>;
54
+ /**
55
+ * The number of workers.
56
+ *
57
+ * @returns The size.
58
+ */
59
+ get size(): number;
60
+ private readonly workers;
61
+ /**
62
+ * Creates the pool.
63
+ *
64
+ * @param params - The parameters.
65
+ */
66
+ constructor(params: WorkerPoolComponentConstructorParams<TApi>);
67
+ /**
68
+ * Calls a method on the least busy worker.
69
+ *
70
+ * @typeParam TMethod - The method.
71
+ * @param method - The method name.
72
+ * @param callArguments - The method's arguments.
73
+ * @param options - The call options.
74
+ * @returns The method's result.
75
+ */
76
+ call<TMethod extends WorkerMethod<TApi>>(method: TMethod, callArguments: Parameters<TApi[TMethod]>, options?: WorkerPoolComponentCallOptions): Promise<WorkerMethodResult<TApi, TMethod>>;
77
+ /**
78
+ * Calls a method on every worker with the same arguments, for instance to configure them all.
79
+ *
80
+ * @typeParam TMethod - The method.
81
+ * @param method - The method name.
82
+ * @param callArguments - The method's arguments, cloned for each worker; nothing can be transferred to all of them.
83
+ * @param abortSignal - Cancels every call.
84
+ * @returns The results, in worker order.
85
+ */
86
+ callAll<TMethod extends WorkerMethod<TApi>>(method: TMethod, callArguments: Parameters<TApi[TMethod]>, abortSignal?: AbortSignal): Promise<WorkerMethodResult<TApi, TMethod>[]>;
87
+ /**
88
+ * Gets one worker, for jobs that keep state in a particular worker.
89
+ *
90
+ * @param index - The worker index, from `0` to {@link WorkerPoolComponent.size} minus one.
91
+ * @returns The worker.
92
+ */
93
+ getWorker(index: number): WorkerComponent<TApi>;
94
+ }
95
+ /**
96
+ * Suggests a pool size: one fewer than the logical processors, so the main thread keeps one, between `1` and
97
+ * {@link MAX_DEFAULT_WORKER_POOL_SIZE}.
98
+ *
99
+ * @param hardwareConcurrency - The number of logical processors. Defaults to `navigator.hardwareConcurrency`.
100
+ * @returns The suggested size.
101
+ */
102
+ export declare function getDefaultWorkerPoolSize(hardwareConcurrency?: number): number;