@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.
- package/README.md +26 -0
- package/components/all-windows-status-bar-item-component/package.json +6 -0
- package/components/shared-component-pool-component/package.json +6 -0
- package/components/worker-component/package.json +6 -0
- package/components/worker-pool-component/package.json +6 -0
- package/components/workspace-layout-state-component/package.json +6 -0
- package/dist/lib/cjs/__merged.cjs +477 -285
- package/dist/lib/cjs/__merged.d.cts +26 -10
- package/dist/lib/cjs/anchored-suggest.cjs +1 -1
- package/dist/lib/cjs/app.cjs +2 -2
- package/dist/lib/cjs/async-with-notice.cjs +4 -4
- package/dist/lib/cjs/attachment-path.cjs +9 -9
- package/dist/lib/cjs/attachment-path.d.cts +3 -3
- package/dist/lib/cjs/attachment-unit-folder.cjs +2 -2
- package/dist/lib/cjs/backlink-index.cjs +5 -5
- package/dist/lib/cjs/backlink.cjs +7 -7
- package/dist/lib/cjs/bases-view-registrar.cjs +1 -1
- package/dist/lib/cjs/broken-link-candidates.cjs +1 -1
- package/dist/lib/cjs/bug-report-diagnostics.cjs +222 -0
- package/dist/lib/cjs/bug-report-diagnostics.d.cts +186 -0
- package/dist/lib/cjs/bug-report.cjs +38 -12
- package/dist/lib/cjs/bug-report.d.cts +65 -0
- package/dist/lib/cjs/bulk-operation-progress.cjs +1 -1
- package/dist/lib/cjs/bulk-operation.cjs +2 -2
- package/dist/lib/cjs/callout.cjs +6 -6
- package/dist/lib/cjs/canvas.cjs +11 -9
- package/dist/lib/cjs/canvas.d.cts +13 -0
- package/dist/lib/cjs/case-insensitive-file-index.cjs +3 -3
- package/dist/lib/cjs/code-block-render-handoff.cjs +5 -5
- package/dist/lib/cjs/codemirror/editor-mode-extension.cjs +4 -4
- package/dist/lib/cjs/codemirror/incremental-parse-state-field.cjs +2 -2
- package/dist/lib/cjs/codemirror/index.cjs +7 -7
- package/dist/lib/cjs/codemirror/inline-token-widgets.cjs +5 -5
- package/dist/lib/cjs/codemirror/markdown-editor-views.cjs +2 -2
- package/dist/lib/cjs/codemirror/settings-facet.cjs +1 -1
- package/dist/lib/cjs/command-handlers/abstract-file-command-handler.cjs +17 -17
- package/dist/lib/cjs/command-handlers/abstract-file-command-handler.d.cts +13 -13
- package/dist/lib/cjs/command-handlers/command-handler-component.cjs +2 -2
- package/dist/lib/cjs/command-handlers/command-handler.cjs +2 -2
- package/dist/lib/cjs/command-handlers/editor-command-handler.cjs +10 -10
- package/dist/lib/cjs/command-handlers/editor-command-handler.d.cts +7 -7
- package/dist/lib/cjs/command-handlers/file-command-handler.cjs +3 -3
- package/dist/lib/cjs/command-handlers/folder-command-handler.cjs +3 -3
- package/dist/lib/cjs/command-handlers/global-command-handler.cjs +2 -2
- package/dist/lib/cjs/command-handlers/index.cjs +15 -15
- package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.cjs +95 -4
- package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.d.cts +34 -2
- package/dist/lib/cjs/command-handlers/open-demo-vault-command-handler.cjs +2 -2
- package/dist/lib/cjs/command-handlers/open-discussion-command-handler.cjs +2 -2
- package/dist/lib/cjs/command-handlers/open-feature-request-command-handler.cjs +2 -2
- package/dist/lib/cjs/command-handlers/open-git-hub-command-handler.cjs +1 -1
- package/dist/lib/cjs/command-handlers/open-settings-command-handler.cjs +2 -2
- package/dist/lib/cjs/command-handlers/undo-bulk-operation-command-handler.cjs +2 -2
- package/dist/lib/cjs/command-handlers/unlock-active-note-command-handler.cjs +1 -1
- package/dist/lib/cjs/community-plugins.cjs +3 -3
- package/dist/lib/cjs/components/abort-signal-component.cjs +2 -2
- package/dist/lib/cjs/components/all-windows-event-component.cjs +5 -5
- package/dist/lib/cjs/components/all-windows-status-bar-item-component.cjs +245 -0
- package/dist/lib/cjs/components/all-windows-status-bar-item-component.d.cts +146 -0
- package/dist/lib/cjs/components/async-error-handler-component.cjs +5 -5
- package/dist/lib/cjs/components/async-events-component.cjs +1 -1
- package/dist/lib/cjs/components/bulk-operation-commit-component.cjs +12 -12
- package/dist/lib/cjs/components/case-insensitive-file-index-component.cjs +2 -2
- package/dist/lib/cjs/components/component-ex.cjs +21 -11
- package/dist/lib/cjs/components/component-ex.d.cts +11 -0
- package/dist/lib/cjs/components/console-debug-component.cjs +2 -2
- package/dist/lib/cjs/components/core-plugin-toggle-component.cjs +2 -2
- package/dist/lib/cjs/components/disposable-component.cjs +2 -2
- package/dist/lib/cjs/components/embed-extensions-component.cjs +21 -4
- package/dist/lib/cjs/components/embed-extensions-component.d.cts +8 -0
- package/dist/lib/cjs/components/embeddable-markdown-editor-component.cjs +24 -10
- package/dist/lib/cjs/components/embeddable-markdown-editor-component.d.cts +9 -0
- package/dist/lib/cjs/components/file-explorer-root-menu-component.cjs +7 -7
- package/dist/lib/cjs/components/generate-markdown-link-default-params-component.cjs +2 -2
- package/dist/lib/cjs/components/incremental-file-index-component.cjs +4 -4
- package/dist/lib/cjs/components/index.cjs +54 -39
- package/dist/lib/cjs/components/index.d.cts +5 -0
- package/dist/lib/cjs/components/layout-ready-component.cjs +3 -3
- package/dist/lib/cjs/components/menu-event-registrar-component.cjs +2 -2
- package/dist/lib/cjs/components/monkey-around-component.cjs +3 -3
- package/dist/lib/cjs/components/notebook-navigator-menu-event-registrar-component.cjs +5 -5
- package/dist/lib/cjs/components/plugin-context-component.cjs +5 -5
- package/dist/lib/cjs/components/plugin-gate-component.cjs +69 -36
- package/dist/lib/cjs/components/plugin-gate-component.d.cts +36 -13
- package/dist/lib/cjs/components/plugin-notice-component.cjs +39 -33
- package/dist/lib/cjs/components/plugin-notice-component.d.cts +4 -3
- package/dist/lib/cjs/components/plugin-settings-component.cjs +119 -18
- package/dist/lib/cjs/components/plugin-settings-component.d.cts +35 -5
- package/dist/lib/cjs/components/plugin-settings-tab-component.cjs +2 -2
- package/dist/lib/cjs/components/plugin-suggestion-component.cjs +8 -8
- package/dist/lib/cjs/components/pointer-position-component.cjs +2 -2
- package/dist/lib/cjs/components/reconfigurable-editor-extension-component.cjs +3 -3
- package/dist/lib/cjs/components/registry-component.cjs +2 -2
- package/dist/lib/cjs/components/release-notes-component.cjs +6 -6
- package/dist/lib/cjs/components/rename-delete-handler-component.cjs +25 -25
- package/dist/lib/cjs/components/rmdir-guard-component.cjs +2 -2
- package/dist/lib/cjs/components/settings-facet-component.cjs +1 -1
- package/dist/lib/cjs/components/settings-migration-component.cjs +5 -5
- package/dist/lib/cjs/components/shared-component-pool-component.cjs +368 -0
- package/dist/lib/cjs/components/shared-component-pool-component.d.cts +129 -0
- package/dist/lib/cjs/components/style-sheet-component.cjs +3 -3
- package/dist/lib/cjs/components/syntax-highlighting-component.cjs +3 -3
- package/dist/lib/cjs/components/templates-language-component.cjs +1 -1
- package/dist/lib/cjs/components/worker-component.cjs +363 -0
- package/dist/lib/cjs/components/worker-component.d.cts +156 -0
- package/dist/lib/cjs/components/worker-pool-component.cjs +185 -0
- package/dist/lib/cjs/components/worker-pool-component.d.cts +102 -0
- package/dist/lib/cjs/components/workspace-layout-state-component.cjs +495 -0
- package/dist/lib/cjs/components/workspace-layout-state-component.d.cts +239 -0
- package/dist/lib/cjs/constructors/get-dom-events-handlers-constructor.cjs +5 -5
- package/dist/lib/cjs/constructors/index.cjs +1 -1
- package/dist/lib/cjs/css-class.cjs +5 -1
- package/dist/lib/cjs/css-class.d.cts +16 -0
- package/dist/lib/cjs/data-handler.cjs +264 -6
- package/dist/lib/cjs/data-handler.d.cts +219 -2
- package/dist/lib/cjs/data-stores/data-store-locations.cjs +82 -24
- package/dist/lib/cjs/data-stores/data-store-locations.d.cts +15 -0
- package/dist/lib/cjs/data-stores/data-store-replica.cjs +33 -5
- package/dist/lib/cjs/data-stores/data-store-seeds.cjs +6 -6
- package/dist/lib/cjs/data-stores/data-store-seeds.d.cts +2 -2
- package/dist/lib/cjs/data-stores/data-store-transport.cjs +81 -8
- package/dist/lib/cjs/data-stores/data-store-transport.d.cts +30 -1
- package/dist/lib/cjs/data-stores/index.cjs +6 -6
- package/dist/lib/cjs/data-stores/local-data-store.cjs +74 -10
- package/dist/lib/cjs/data-stores/local-data-store.d.cts +58 -1
- package/dist/lib/cjs/data-stores/shared-data-store.cjs +76 -19
- package/dist/lib/cjs/data-stores/shared-data-store.d.cts +18 -1
- package/dist/lib/cjs/dataview-link.cjs +2 -2
- package/dist/lib/cjs/dataview.cjs +27 -7
- package/dist/lib/cjs/dataview.d.cts +14 -0
- package/dist/lib/cjs/debug.cjs +3 -3
- package/dist/lib/cjs/demo-vault-helper.cjs +34 -6
- package/dist/lib/cjs/demo-vault-helper.d.cts +6 -2
- package/dist/lib/cjs/desktop-bulk-operation-git.cjs +10 -10
- package/dist/lib/cjs/desktop-demo-vault-opener.cjs +13 -13
- package/dist/lib/cjs/desktop-git-runner.cjs +4 -14
- package/dist/lib/cjs/desktop-git-runner.d.cts +8 -2
- package/dist/lib/cjs/desktop-operating-system.cjs +1 -1
- package/dist/lib/cjs/desktop-request-url-stream.cjs +8 -14
- package/dist/lib/cjs/desktop-trusted-input.cjs +2 -2
- package/dist/lib/cjs/disposable.cjs +150 -0
- package/dist/lib/cjs/disposable.d.cts +39 -0
- package/dist/lib/cjs/editor-extension-registrar.cjs +1 -1
- package/dist/lib/cjs/editor-suggest-registrar.cjs +2 -2
- package/dist/lib/cjs/editor-suggest.cjs +1 -1
- package/dist/lib/cjs/editor.cjs +6 -6
- package/dist/lib/cjs/events.cjs +2 -2
- package/dist/lib/cjs/extensions-registrar.cjs +1 -1
- package/dist/lib/cjs/feature-request.cjs +1 -1
- package/dist/lib/cjs/file-change.cjs +10 -10
- package/dist/lib/cjs/file-explorer.cjs +2 -2
- package/dist/lib/cjs/file-manager.cjs +5 -5
- package/dist/lib/cjs/file-system.cjs +10 -10
- package/dist/lib/cjs/folder-note.cjs +4 -4
- package/dist/lib/cjs/frontmatter-formatting.cjs +7 -6
- package/dist/lib/cjs/frontmatter-link-cache-with-offsets.cjs +1 -1
- package/dist/lib/cjs/frontmatter.cjs +5 -5
- package/dist/lib/cjs/generated-during-build.cjs +2 -2
- package/dist/lib/cjs/git-rename-history.cjs +1 -1
- package/dist/lib/cjs/git-rename-history.d.cts +2 -2
- package/dist/lib/cjs/hotkey.cjs +1 -1
- package/dist/lib/cjs/hover-link-source-registrar.cjs +1 -1
- package/dist/lib/cjs/html-element.cjs +2 -2
- package/dist/lib/cjs/i18n/custom-type-options.cjs +1 -1
- package/dist/lib/cjs/i18n/default-translations.cjs +1 -1
- package/dist/lib/cjs/i18n/i18n.cjs +7 -7
- package/dist/lib/cjs/i18n/index.cjs +4 -4
- package/dist/lib/cjs/i18n/locales/en.cjs +27 -1
- package/dist/lib/cjs/i18n/locales/en.d.cts +26 -0
- package/dist/lib/cjs/i18n/locales/index.cjs +2 -2
- package/dist/lib/cjs/i18n/locales/translations-map.cjs +1 -1
- package/dist/lib/cjs/i18n/locales/translations-map.d.cts +26 -0
- package/dist/lib/cjs/index.cjs +147 -126
- package/dist/lib/cjs/index.d.cts +7 -0
- package/dist/lib/cjs/inline-token-renderer.cjs +2 -2
- package/dist/lib/cjs/is-in-obsidian.cjs +1 -1
- package/dist/lib/cjs/library-styles.cjs +3 -3
- package/dist/lib/cjs/link-and-tag-input-suggest.cjs +2 -2
- package/dist/lib/cjs/link.cjs +76 -56
- package/dist/lib/cjs/link.d.cts +20 -14
- package/dist/lib/cjs/logger.cjs +4 -4
- package/dist/lib/cjs/loop.cjs +10 -16
- package/dist/lib/cjs/markdown-code-block-processor-registrar.cjs +17 -2
- package/dist/lib/cjs/markdown-code-block-processor-registrar.d.cts +7 -0
- package/dist/lib/cjs/markdown-code-block-processor.cjs +13 -13
- package/dist/lib/cjs/markdown-post-processor-registrar.cjs +2 -2
- package/dist/lib/cjs/markdown-view.cjs +191 -3
- package/dist/lib/cjs/markdown-view.d.cts +48 -1
- package/dist/lib/cjs/markdown.cjs +12 -12
- package/dist/lib/cjs/metadata-cache.cjs +23 -23
- package/dist/lib/cjs/metadata-cache.d.cts +5 -4
- package/dist/lib/cjs/misplaced-attachment.cjs +297 -0
- package/dist/lib/cjs/misplaced-attachment.d.cts +228 -0
- package/dist/lib/cjs/mobile-app-info.cjs +1 -1
- package/dist/lib/cjs/modals/alert.cjs +4 -4
- package/dist/lib/cjs/modals/code-block-builder.cjs +7 -7
- package/dist/lib/cjs/modals/confirm.cjs +4 -4
- package/dist/lib/cjs/modals/copy-text-manually.cjs +181 -0
- package/dist/lib/cjs/modals/copy-text-manually.d.cts +38 -0
- package/dist/lib/cjs/modals/index.cjs +17 -11
- package/dist/lib/cjs/modals/index.d.cts +2 -0
- package/dist/lib/cjs/modals/minimizable-modal.cjs +6 -6
- package/dist/lib/cjs/modals/modal-command-builder.cjs +3 -3
- package/dist/lib/cjs/modals/modal.cjs +3 -3
- package/dist/lib/cjs/modals/prompt.cjs +10 -10
- package/dist/lib/cjs/modals/prompt.d.cts +1 -1
- package/dist/lib/cjs/modals/review-bug-report-diagnostics.cjs +202 -0
- package/dist/lib/cjs/modals/review-bug-report-diagnostics.d.cts +30 -0
- package/dist/lib/cjs/modals/select-item.cjs +6 -6
- package/dist/lib/cjs/modals/select-option.cjs +3 -3
- package/dist/lib/cjs/modals/suggest-modal-command-builder.cjs +1 -1
- package/dist/lib/cjs/note-priority.cjs +2 -2
- package/dist/lib/cjs/notebook-navigator.cjs +12 -2
- package/dist/lib/cjs/notebook-navigator.d.cts +6 -0
- package/dist/lib/cjs/obsidian-lib-state.cjs +1 -1
- package/dist/lib/cjs/obsidian-protocol-handler-registrar.cjs +1 -1
- package/dist/lib/cjs/obsidian-settings.cjs +1 -1
- package/dist/lib/cjs/obsidian-word-characters.cjs +1 -1
- package/dist/lib/cjs/parse-link.cjs +14 -14
- package/dist/lib/cjs/path-compatibility.cjs +368 -0
- package/dist/lib/cjs/path-compatibility.d.cts +263 -0
- package/dist/lib/cjs/path-settings.cjs +3 -3
- package/dist/lib/cjs/pdf.cjs +2 -2
- package/dist/lib/cjs/plugin/index.cjs +18 -12
- package/dist/lib/cjs/plugin/index.d.cts +2 -0
- package/dist/lib/cjs/plugin/plugin-api.cjs +21 -12
- package/dist/lib/cjs/plugin/plugin-api.d.cts +5 -1
- package/dist/lib/cjs/plugin/plugin-async-cleanup.cjs +6 -3
- package/dist/lib/cjs/plugin/plugin-async-cleanup.d.cts +5 -0
- package/dist/lib/cjs/plugin/plugin-context.cjs +10 -9
- package/dist/lib/cjs/plugin/plugin-event-source.cjs +1 -1
- package/dist/lib/cjs/plugin/plugin-event-source.d.cts +4 -4
- package/dist/lib/cjs/plugin/plugin-install-state.cjs +49 -4
- package/dist/lib/cjs/plugin/plugin-install-state.d.cts +30 -0
- package/dist/lib/cjs/plugin/plugin-instance.cjs +450 -0
- package/dist/lib/cjs/plugin/plugin-instance.d.cts +258 -0
- package/dist/lib/cjs/plugin/plugin-lifecycle-events.cjs +1 -1
- package/dist/lib/cjs/plugin/plugin-lifecycle-events.d.cts +6 -4
- package/dist/lib/cjs/plugin/plugin-settings-tab.cjs +15 -15
- package/dist/lib/cjs/plugin/plugin.cjs +133 -34
- package/dist/lib/cjs/plugin/plugin.d.cts +35 -5
- package/dist/lib/cjs/plugin/settings-migration-api.cjs +1 -1
- package/dist/lib/cjs/plugin/third-party-plugin.cjs +231 -0
- package/dist/lib/cjs/plugin/third-party-plugin.d.cts +244 -0
- package/dist/lib/cjs/plugin-cli-handler-registrar.cjs +2 -2
- package/dist/lib/cjs/popovers/field-popover.cjs +4 -4
- package/dist/lib/cjs/popovers/index.cjs +3 -3
- package/dist/lib/cjs/popovers/popover-anchor.cjs +1 -1
- package/dist/lib/cjs/popovers/popover.cjs +5 -5
- package/dist/lib/cjs/queue.cjs +8 -8
- package/dist/lib/cjs/react/app-context.cjs +3 -3
- package/dist/lib/cjs/react/index.cjs +1 -1
- package/dist/lib/cjs/reference-definition.cjs +1 -1
- package/dist/lib/cjs/reference.cjs +3 -3
- package/dist/lib/cjs/release-asset.cjs +5 -5
- package/dist/lib/cjs/rendered-markdown.cjs +4 -4
- package/dist/lib/cjs/request-url.cjs +4 -4
- package/dist/lib/cjs/resource-lock.cjs +46 -42
- package/dist/lib/cjs/resource-lock.d.cts +8 -7
- package/dist/lib/cjs/resource-url.cjs +3 -3
- package/dist/lib/cjs/ribbon-icon-registrar.cjs +1 -1
- package/dist/lib/cjs/setting-components/checkbox-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/code-highlighter-component.cjs +7 -7
- package/dist/lib/cjs/setting-components/date-component.cjs +4 -4
- package/dist/lib/cjs/setting-components/date-time-component.cjs +4 -4
- package/dist/lib/cjs/setting-components/email-component.cjs +2 -2
- package/dist/lib/cjs/setting-components/file-component.cjs +2 -2
- package/dist/lib/cjs/setting-components/folder-list-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/hotkey-component.cjs +5 -5
- package/dist/lib/cjs/setting-components/index.cjs +30 -30
- package/dist/lib/cjs/setting-components/list-component.cjs +5 -5
- package/dist/lib/cjs/setting-components/month-component.cjs +4 -4
- package/dist/lib/cjs/setting-components/multiple-dropdown-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/multiple-email-component.cjs +2 -2
- package/dist/lib/cjs/setting-components/multiple-file-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/multiple-text-component.cjs +9 -6
- package/dist/lib/cjs/setting-components/multiple-text-component.d.cts +4 -1
- package/dist/lib/cjs/setting-components/number-component.cjs +2 -2
- package/dist/lib/cjs/setting-components/password-component.cjs +2 -2
- package/dist/lib/cjs/setting-components/setting-component-wrapper.cjs +3 -3
- package/dist/lib/cjs/setting-components/tag-list-component.cjs +4 -4
- package/dist/lib/cjs/setting-components/telephone-component.cjs +2 -2
- package/dist/lib/cjs/setting-components/text-based-component.cjs +1 -1
- package/dist/lib/cjs/setting-components/time-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/tri-state-checkbox-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/typed-dropdown-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/typed-multiple-dropdown-component.cjs +4 -4
- package/dist/lib/cjs/setting-components/typed-range-text-component.cjs +1 -1
- package/dist/lib/cjs/setting-components/typed-text-component.cjs +3 -3
- package/dist/lib/cjs/setting-components/url-component.cjs +2 -2
- package/dist/lib/cjs/setting-components/validator-component.cjs +4 -4
- package/dist/lib/cjs/setting-components/week-component.cjs +4 -4
- package/dist/lib/cjs/setting-ex.cjs +26 -26
- package/dist/lib/cjs/setting-group-ex.cjs +2 -2
- package/dist/lib/cjs/settings-recovery.cjs +217 -0
- package/dist/lib/cjs/settings-recovery.d.cts +178 -0
- package/dist/lib/cjs/settings-tabs.cjs +5 -5
- package/dist/lib/cjs/status-bar-item-registrar.cjs +1 -1
- package/dist/lib/cjs/templater.cjs +14 -4
- package/dist/lib/cjs/templater.d.cts +6 -0
- package/dist/lib/cjs/transformers/duration-transformer.cjs +2 -2
- package/dist/lib/cjs/transformers/index.cjs +1 -1
- package/dist/lib/cjs/trusted-input.cjs +1 -1
- package/dist/lib/cjs/validation.cjs +4 -4
- package/dist/lib/cjs/vault-delete.cjs +6 -6
- package/dist/lib/cjs/vault-transaction.cjs +5 -5
- package/dist/lib/cjs/vault.cjs +12 -12
- package/dist/lib/cjs/view-registrar.cjs +1 -1
- package/dist/lib/cjs/virtual-file.cjs +16 -14
- package/dist/lib/cjs/virtual-file.d.cts +2 -1
- package/dist/lib/cjs/wasm.cjs +119 -0
- package/dist/lib/cjs/wasm.d.cts +54 -0
- package/dist/lib/cjs/worker-protocol.cjs +209 -0
- package/dist/lib/cjs/worker-protocol.d.cts +282 -0
- package/dist/lib/cjs/workspace.cjs +1 -1
- package/dist/lib/esm/__merged.d.mts +26 -10
- package/dist/lib/esm/__merged.mjs +215 -5
- package/dist/lib/esm/app.mjs +2 -2
- package/dist/lib/esm/attachment-path.d.mts +3 -3
- package/dist/lib/esm/attachment-path.mjs +2 -2
- package/dist/lib/esm/backlink-index.mjs +2 -2
- package/dist/lib/esm/bug-report-diagnostics.d.mts +186 -0
- package/dist/lib/esm/bug-report-diagnostics.mjs +127 -0
- package/dist/lib/esm/bug-report.d.mts +65 -0
- package/dist/lib/esm/bug-report.mjs +33 -10
- package/dist/lib/esm/canvas.d.mts +13 -0
- package/dist/lib/esm/canvas.mjs +6 -5
- package/dist/lib/esm/command-handlers/abstract-file-command-handler.d.mts +13 -13
- package/dist/lib/esm/command-handlers/abstract-file-command-handler.mjs +14 -14
- package/dist/lib/esm/command-handlers/editor-command-handler.d.mts +7 -7
- package/dist/lib/esm/command-handlers/editor-command-handler.mjs +8 -8
- package/dist/lib/esm/command-handlers/open-bug-report-command-handler.d.mts +34 -2
- package/dist/lib/esm/command-handlers/open-bug-report-command-handler.mjs +99 -3
- package/dist/lib/esm/components/all-windows-status-bar-item-component.d.mts +146 -0
- package/dist/lib/esm/components/all-windows-status-bar-item-component.mjs +154 -0
- package/dist/lib/esm/components/component-ex.d.mts +11 -0
- package/dist/lib/esm/components/component-ex.mjs +19 -6
- package/dist/lib/esm/components/disposable-component.mjs +1 -1
- package/dist/lib/esm/components/embed-extensions-component.d.mts +8 -0
- package/dist/lib/esm/components/embed-extensions-component.mjs +20 -3
- package/dist/lib/esm/components/embeddable-markdown-editor-component.d.mts +9 -0
- package/dist/lib/esm/components/embeddable-markdown-editor-component.mjs +16 -2
- package/dist/lib/esm/components/index.d.mts +5 -0
- package/dist/lib/esm/components/index.mjs +12 -2
- package/dist/lib/esm/components/plugin-gate-component.d.mts +36 -13
- package/dist/lib/esm/components/plugin-gate-component.mjs +61 -26
- package/dist/lib/esm/components/plugin-notice-component.d.mts +4 -3
- package/dist/lib/esm/components/plugin-notice-component.mjs +30 -21
- package/dist/lib/esm/components/plugin-settings-component.d.mts +35 -5
- package/dist/lib/esm/components/plugin-settings-component.mjs +105 -4
- package/dist/lib/esm/components/rename-delete-handler-component.mjs +2 -2
- package/dist/lib/esm/components/shared-component-pool-component.d.mts +129 -0
- package/dist/lib/esm/components/shared-component-pool-component.mjs +280 -0
- package/dist/lib/esm/components/worker-component.d.mts +156 -0
- package/dist/lib/esm/components/worker-component.mjs +279 -0
- package/dist/lib/esm/components/worker-pool-component.d.mts +102 -0
- package/dist/lib/esm/components/worker-pool-component.mjs +95 -0
- package/dist/lib/esm/components/workspace-layout-state-component.d.mts +239 -0
- package/dist/lib/esm/components/workspace-layout-state-component.mjs +404 -0
- package/dist/lib/esm/css-class.d.mts +16 -0
- package/dist/lib/esm/css-class.mjs +5 -1
- package/dist/lib/esm/data-handler.d.mts +219 -2
- package/dist/lib/esm/data-handler.mjs +262 -5
- package/dist/lib/esm/data-stores/data-store-locations.d.mts +15 -0
- package/dist/lib/esm/data-stores/data-store-locations.mjs +80 -22
- package/dist/lib/esm/data-stores/data-store-replica.mjs +33 -5
- package/dist/lib/esm/data-stores/data-store-seeds.d.mts +2 -2
- package/dist/lib/esm/data-stores/data-store-seeds.mjs +4 -4
- package/dist/lib/esm/data-stores/data-store-transport.d.mts +30 -1
- package/dist/lib/esm/data-stores/data-store-transport.mjs +78 -5
- package/dist/lib/esm/data-stores/local-data-store.d.mts +58 -1
- package/dist/lib/esm/data-stores/local-data-store.mjs +71 -9
- package/dist/lib/esm/data-stores/shared-data-store.d.mts +18 -1
- package/dist/lib/esm/data-stores/shared-data-store.mjs +72 -15
- package/dist/lib/esm/dataview.d.mts +14 -0
- package/dist/lib/esm/dataview.mjs +19 -1
- package/dist/lib/esm/demo-vault-helper.d.mts +6 -2
- package/dist/lib/esm/demo-vault-helper.mjs +29 -1
- package/dist/lib/esm/desktop-demo-vault-opener.mjs +1 -1
- package/dist/lib/esm/desktop-git-runner.d.mts +8 -2
- package/dist/lib/esm/desktop-git-runner.mjs +3 -3
- package/dist/lib/esm/desktop-request-url-stream.mjs +4 -10
- package/dist/lib/esm/disposable.d.mts +39 -0
- package/dist/lib/esm/disposable.mjs +64 -0
- package/dist/lib/esm/file-system.mjs +2 -2
- package/dist/lib/esm/frontmatter-formatting.mjs +2 -1
- package/dist/lib/esm/generated-during-build.mjs +2 -2
- package/dist/lib/esm/git-rename-history.d.mts +2 -2
- package/dist/lib/esm/git-rename-history.mjs +1 -1
- package/dist/lib/esm/i18n/locales/en.d.mts +26 -0
- package/dist/lib/esm/i18n/locales/en.mjs +27 -1
- package/dist/lib/esm/i18n/locales/translations-map.d.mts +26 -0
- package/dist/lib/esm/index.d.mts +7 -0
- package/dist/lib/esm/index.mjs +15 -1
- package/dist/lib/esm/link.d.mts +20 -14
- package/dist/lib/esm/link.mjs +57 -38
- package/dist/lib/esm/loop.mjs +2 -8
- package/dist/lib/esm/markdown-code-block-processor-registrar.d.mts +7 -0
- package/dist/lib/esm/markdown-code-block-processor-registrar.mjs +16 -1
- package/dist/lib/esm/markdown-view.d.mts +48 -1
- package/dist/lib/esm/markdown-view.mjs +192 -2
- package/dist/lib/esm/metadata-cache.d.mts +5 -4
- package/dist/lib/esm/metadata-cache.mjs +6 -6
- package/dist/lib/esm/misplaced-attachment.d.mts +228 -0
- package/dist/lib/esm/misplaced-attachment.mjs +212 -0
- package/dist/lib/esm/modals/copy-text-manually.d.mts +38 -0
- package/dist/lib/esm/modals/copy-text-manually.mjs +99 -0
- package/dist/lib/esm/modals/index.d.mts +2 -0
- package/dist/lib/esm/modals/index.mjs +5 -1
- package/dist/lib/esm/modals/prompt.d.mts +1 -1
- package/dist/lib/esm/modals/prompt.mjs +1 -1
- package/dist/lib/esm/modals/review-bug-report-diagnostics.d.mts +30 -0
- package/dist/lib/esm/modals/review-bug-report-diagnostics.mjs +120 -0
- package/dist/lib/esm/notebook-navigator.d.mts +6 -0
- package/dist/lib/esm/notebook-navigator.mjs +11 -2
- package/dist/lib/esm/parse-link.mjs +4 -4
- package/dist/lib/esm/path-compatibility.d.mts +263 -0
- package/dist/lib/esm/path-compatibility.mjs +277 -0
- package/dist/lib/esm/plugin/index.d.mts +2 -0
- package/dist/lib/esm/plugin/index.mjs +6 -2
- package/dist/lib/esm/plugin/plugin-api.d.mts +5 -1
- package/dist/lib/esm/plugin/plugin-api.mjs +13 -4
- package/dist/lib/esm/plugin/plugin-async-cleanup.d.mts +5 -0
- package/dist/lib/esm/plugin/plugin-async-cleanup.mjs +3 -1
- package/dist/lib/esm/plugin/plugin-context.mjs +2 -1
- package/dist/lib/esm/plugin/plugin-event-source.d.mts +4 -4
- package/dist/lib/esm/plugin/plugin-event-source.mjs +1 -1
- package/dist/lib/esm/plugin/plugin-install-state.d.mts +30 -0
- package/dist/lib/esm/plugin/plugin-install-state.mjs +44 -1
- package/dist/lib/esm/plugin/plugin-instance.d.mts +258 -0
- package/dist/lib/esm/plugin/plugin-instance.mjs +367 -0
- package/dist/lib/esm/plugin/plugin-lifecycle-events.d.mts +6 -4
- package/dist/lib/esm/plugin/plugin-lifecycle-events.mjs +1 -1
- package/dist/lib/esm/plugin/plugin.d.mts +35 -5
- package/dist/lib/esm/plugin/plugin.mjs +118 -9
- package/dist/lib/esm/plugin/third-party-plugin.d.mts +244 -0
- package/dist/lib/esm/plugin/third-party-plugin.mjs +147 -0
- package/dist/lib/esm/release-asset.mjs +1 -1
- package/dist/lib/esm/resource-lock.d.mts +8 -7
- package/dist/lib/esm/resource-lock.mjs +31 -26
- package/dist/lib/esm/setting-components/multiple-text-component.d.mts +4 -1
- package/dist/lib/esm/setting-components/multiple-text-component.mjs +6 -3
- package/dist/lib/esm/settings-recovery.d.mts +178 -0
- package/dist/lib/esm/settings-recovery.mjs +125 -0
- package/dist/lib/esm/settings-tabs.mjs +2 -2
- package/dist/lib/esm/templater.d.mts +6 -0
- package/dist/lib/esm/templater.mjs +11 -2
- package/dist/lib/esm/vault.mjs +1 -1
- package/dist/lib/esm/virtual-file.d.mts +2 -1
- package/dist/lib/esm/virtual-file.mjs +7 -5
- package/dist/lib/esm/wasm.d.mts +54 -0
- package/dist/lib/esm/wasm.mjs +30 -0
- package/dist/lib/esm/worker-protocol.d.mts +282 -0
- package/dist/lib/esm/worker-protocol.mjs +113 -0
- package/dist/styles.css +16 -1
- package/modals/copy-text-manually/package.json +6 -0
- package/modals/review-bug-report-diagnostics/package.json +6 -0
- package/package.json +10 -8
- package/plugin/plugin-instance/package.json +6 -0
- package/plugin/third-party-plugin/package.json +6 -0
|
@@ -91,8 +91,8 @@ __export(rmdir_guard_component_exports, {
|
|
|
91
91
|
RmdirGuardComponent: () => RmdirGuardComponent
|
|
92
92
|
});
|
|
93
93
|
module.exports = __toCommonJS(rmdir_guard_component_exports);
|
|
94
|
-
var import_vault = require(
|
|
95
|
-
var import_monkey_around_component = require(
|
|
94
|
+
var import_vault = require("../vault.cjs");
|
|
95
|
+
var import_monkey_around_component = require("./monkey-around-component.cjs");
|
|
96
96
|
const NOT_EMPTY_DIRECTORY_ERROR_CODE = "ENOTEMPTY";
|
|
97
97
|
class RmdirGuardComponent extends import_monkey_around_component.MonkeyAroundComponent {
|
|
98
98
|
/**
|
|
@@ -90,7 +90,7 @@ __export(settings_facet_component_exports, {
|
|
|
90
90
|
SettingsFacetComponent: () => SettingsFacetComponent
|
|
91
91
|
});
|
|
92
92
|
module.exports = __toCommonJS(settings_facet_component_exports);
|
|
93
|
-
var import_reconfigurable_editor_extension_component = require(
|
|
93
|
+
var import_reconfigurable_editor_extension_component = require("./reconfigurable-editor-extension-component.cjs");
|
|
94
94
|
class SettingsFacetComponent extends import_reconfigurable_editor_extension_component.ReconfigurableEditorExtensionComponent {
|
|
95
95
|
/**
|
|
96
96
|
* The settings the editors currently read.
|
|
@@ -117,11 +117,11 @@ __export(settings_migration_component_exports, {
|
|
|
117
117
|
SettingsMigrationComponent: () => SettingsMigrationComponent
|
|
118
118
|
});
|
|
119
119
|
module.exports = __toCommonJS(settings_migration_component_exports);
|
|
120
|
-
var import_async = require(
|
|
121
|
-
var import_plugin_api = require(
|
|
122
|
-
var import_settings_migration_api = require(
|
|
123
|
-
var import_async_events_component = require(
|
|
124
|
-
var import_component_ex = require(
|
|
120
|
+
var import_async = require("@mnaoumov/typescript-lib/async");
|
|
121
|
+
var import_plugin_api = require("../plugin/plugin-api.cjs");
|
|
122
|
+
var import_settings_migration_api = require("../plugin/settings-migration-api.cjs");
|
|
123
|
+
var import_async_events_component = require("./async-events-component.cjs");
|
|
124
|
+
var import_component_ex = require("./component-ex.cjs");
|
|
125
125
|
class SettingsMigrationComponent extends import_component_ex.ComponentEx {
|
|
126
126
|
apiVersionRange;
|
|
127
127
|
app;
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
(function () {
|
|
6
|
+
function ensureDisposeSymbols(symbolConstructor = Symbol) {
|
|
7
|
+
symbolConstructor.asyncDispose ??= symbolConstructor.for("Symbol.asyncDispose");
|
|
8
|
+
symbolConstructor.dispose ??= symbolConstructor.for("Symbol.dispose");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function ensureBrowserProcess() {
|
|
12
|
+
const browserProcess = {
|
|
13
|
+
browser: true,
|
|
14
|
+
cwd() {
|
|
15
|
+
return "/";
|
|
16
|
+
},
|
|
17
|
+
env: {},
|
|
18
|
+
platform: "android"
|
|
19
|
+
};
|
|
20
|
+
const existingProcess = globalThis.process;
|
|
21
|
+
if (!existingProcess) {
|
|
22
|
+
globalThis.process = browserProcess;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (existingProcess.versions?.node) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const existingProcessRecord = existingProcess;
|
|
29
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
30
|
+
existingProcessRecord[key] ??= value;
|
|
31
|
+
}
|
|
32
|
+
existingProcessRecord["browser"] = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ensureDisposeSymbols();
|
|
36
|
+
ensureBrowserProcess();
|
|
37
|
+
})();
|
|
38
|
+
(function patchObsidianRequire() {
|
|
39
|
+
const originalRequire = require;
|
|
40
|
+
if (!originalRequire || originalRequire.__isPatched) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
require = Object.assign(
|
|
44
|
+
(id) => requirePatched(id),
|
|
45
|
+
originalRequire,
|
|
46
|
+
{
|
|
47
|
+
__isPatched: true
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
function extractDefault($module) {
|
|
51
|
+
return $module && $module.__esModule && "default" in $module ? $module.default : $module;
|
|
52
|
+
}
|
|
53
|
+
const OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
54
|
+
"@codemirror/autocomplete",
|
|
55
|
+
"@codemirror/collab",
|
|
56
|
+
"@codemirror/commands",
|
|
57
|
+
"@codemirror/language",
|
|
58
|
+
"@codemirror/lint",
|
|
59
|
+
"@codemirror/search",
|
|
60
|
+
"@codemirror/state",
|
|
61
|
+
"@codemirror/text",
|
|
62
|
+
"@codemirror/view",
|
|
63
|
+
"@lezer/common",
|
|
64
|
+
"@lezer/highlight",
|
|
65
|
+
"@lezer/lr",
|
|
66
|
+
"obsidian"
|
|
67
|
+
]);
|
|
68
|
+
const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
69
|
+
"@codemirror/closebrackets",
|
|
70
|
+
"@codemirror/comment",
|
|
71
|
+
"@codemirror/fold",
|
|
72
|
+
"@codemirror/gutter",
|
|
73
|
+
"@codemirror/highlight",
|
|
74
|
+
"@codemirror/history",
|
|
75
|
+
"@codemirror/matchbrackets",
|
|
76
|
+
"@codemirror/panel",
|
|
77
|
+
"@codemirror/rangeset",
|
|
78
|
+
"@codemirror/rectangular-selection",
|
|
79
|
+
"@codemirror/stream-parser",
|
|
80
|
+
"@codemirror/tooltip"
|
|
81
|
+
]);
|
|
82
|
+
function requirePatched(id) {
|
|
83
|
+
if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
|
|
84
|
+
return originalRequire?.(id);
|
|
85
|
+
}
|
|
86
|
+
const app = globalThis.app;
|
|
87
|
+
if (app?.isMobile) {
|
|
88
|
+
if (id === "process" || id === "node:process") {
|
|
89
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
|
|
90
|
+
return process;
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
const $module = originalRequire?.(id);
|
|
94
|
+
if ($module) {
|
|
95
|
+
return extractDefault($module);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
|
|
99
|
+
return {};
|
|
100
|
+
}
|
|
101
|
+
})();
|
|
102
|
+
|
|
103
|
+
"use strict";
|
|
104
|
+
var __defProp = Object.defineProperty;
|
|
105
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
106
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
107
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
108
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
109
|
+
var __typeError = (msg) => {
|
|
110
|
+
throw TypeError(msg);
|
|
111
|
+
};
|
|
112
|
+
var __export = (target, all) => {
|
|
113
|
+
for (var name in all)
|
|
114
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
115
|
+
};
|
|
116
|
+
var __copyProps = (to, from, except, desc) => {
|
|
117
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
118
|
+
for (let key of __getOwnPropNames(from))
|
|
119
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
120
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
121
|
+
}
|
|
122
|
+
return to;
|
|
123
|
+
};
|
|
124
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
125
|
+
var __using = (stack, value, async) => {
|
|
126
|
+
if (value != null) {
|
|
127
|
+
if (typeof value !== "object" && typeof value !== "function") __typeError("Object expected");
|
|
128
|
+
var dispose, inner;
|
|
129
|
+
if (async) dispose = value[__knownSymbol("asyncDispose")];
|
|
130
|
+
if (dispose === void 0) {
|
|
131
|
+
dispose = value[__knownSymbol("dispose")];
|
|
132
|
+
if (async) inner = dispose;
|
|
133
|
+
}
|
|
134
|
+
if (typeof dispose !== "function") __typeError("Object not disposable");
|
|
135
|
+
if (inner) dispose = function() {
|
|
136
|
+
try {
|
|
137
|
+
inner.call(this);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
return Promise.reject(e);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
stack.push([async, dispose, value]);
|
|
143
|
+
} else if (async) {
|
|
144
|
+
stack.push([async]);
|
|
145
|
+
}
|
|
146
|
+
return value;
|
|
147
|
+
};
|
|
148
|
+
var __callDispose = (stack, error, hasError) => {
|
|
149
|
+
var E = typeof SuppressedError === "function" ? SuppressedError : function(e, s, m, _) {
|
|
150
|
+
return _ = Error(m), _.name = "SuppressedError", _.error = e, _.suppressed = s, _;
|
|
151
|
+
};
|
|
152
|
+
var fail = (e) => error = hasError ? new E(e, error, "An error was suppressed during disposal") : (hasError = true, e);
|
|
153
|
+
var next = (it) => {
|
|
154
|
+
while (it = stack.pop()) {
|
|
155
|
+
try {
|
|
156
|
+
var result = it[1] && it[1].call(it[2]);
|
|
157
|
+
if (it[0]) return Promise.resolve(result).then(next, (e) => (fail(e), next()));
|
|
158
|
+
} catch (e) {
|
|
159
|
+
fail(e);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (hasError) throw error;
|
|
163
|
+
};
|
|
164
|
+
return next();
|
|
165
|
+
};
|
|
166
|
+
var shared_component_pool_component_exports = {};
|
|
167
|
+
__export(shared_component_pool_component_exports, {
|
|
168
|
+
SharedComponentPoolComponent: () => SharedComponentPoolComponent
|
|
169
|
+
});
|
|
170
|
+
module.exports = __toCommonJS(shared_component_pool_component_exports);
|
|
171
|
+
var import_abort_controller = require("@mnaoumov/typescript-lib/abort-controller");
|
|
172
|
+
var import_array = require("@mnaoumov/typescript-lib/array");
|
|
173
|
+
var import_error = require("@mnaoumov/typescript-lib/error");
|
|
174
|
+
var import_function = require("@mnaoumov/typescript-lib/function");
|
|
175
|
+
var import_obsidian = require("obsidian");
|
|
176
|
+
var import_component_ex = require("./component-ex.cjs");
|
|
177
|
+
class SharedComponentAcquisitionImpl {
|
|
178
|
+
constructor(component, onRelease) {
|
|
179
|
+
this.component = component;
|
|
180
|
+
this.onRelease = onRelease;
|
|
181
|
+
}
|
|
182
|
+
component;
|
|
183
|
+
onRelease;
|
|
184
|
+
get isReleased() {
|
|
185
|
+
return this._isReleased;
|
|
186
|
+
}
|
|
187
|
+
_isReleased = false;
|
|
188
|
+
unlinkConsumer = null;
|
|
189
|
+
dispose() {
|
|
190
|
+
this.release();
|
|
191
|
+
}
|
|
192
|
+
linkConsumer(consumer) {
|
|
193
|
+
const consumerLink = new import_obsidian.Component();
|
|
194
|
+
consumerLink.register(() => {
|
|
195
|
+
this.unlinkConsumer = null;
|
|
196
|
+
this.release();
|
|
197
|
+
});
|
|
198
|
+
consumer.addChild(consumerLink);
|
|
199
|
+
this.unlinkConsumer = () => {
|
|
200
|
+
consumer.removeChild(consumerLink);
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
release() {
|
|
204
|
+
if (this._isReleased) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
this._isReleased = true;
|
|
208
|
+
const unlinkConsumer = this.unlinkConsumer;
|
|
209
|
+
this.unlinkConsumer = null;
|
|
210
|
+
unlinkConsumer?.();
|
|
211
|
+
this.onRelease();
|
|
212
|
+
}
|
|
213
|
+
[Symbol.dispose]() {
|
|
214
|
+
this.release();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
class SharedComponentPoolComponent extends import_component_ex.ComponentEx {
|
|
218
|
+
/**
|
|
219
|
+
* Creates the component shared under a key; see {@link SharedComponentPoolComponentConstructorParams.createComponent}.
|
|
220
|
+
*/
|
|
221
|
+
createComponent;
|
|
222
|
+
creatingKeys = /* @__PURE__ */ new Set();
|
|
223
|
+
entries = /* @__PURE__ */ new Map();
|
|
224
|
+
/**
|
|
225
|
+
* Creates a new pool.
|
|
226
|
+
*
|
|
227
|
+
* @param params - The pool parameters.
|
|
228
|
+
*/
|
|
229
|
+
constructor(params) {
|
|
230
|
+
super();
|
|
231
|
+
this.createComponent = params.createComponent;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Acquires the component shared under a key, creating and loading it when the key has no consumer yet.
|
|
235
|
+
*
|
|
236
|
+
* @param key - The resource key.
|
|
237
|
+
* @param options - The acquisition options.
|
|
238
|
+
* @returns The acquisition, once the shared component has loaded.
|
|
239
|
+
* @throws An {@link Error} when the pool was never loaded, when the factory or the load fails, or when called for a
|
|
240
|
+
* key from inside that key's own factory or synchronous load; a {@link SilentError} when the pool is unloaded, or
|
|
241
|
+
* when the consumer unloads or the acquisition is released before the load completes; the abort reason when
|
|
242
|
+
* `abortSignal` aborts first.
|
|
243
|
+
*/
|
|
244
|
+
async acquire(key, options = {}) {
|
|
245
|
+
var _stack = [];
|
|
246
|
+
try {
|
|
247
|
+
this.ensureLoaded();
|
|
248
|
+
options.abortSignal?.throwIfAborted();
|
|
249
|
+
if (this.creatingKeys.has(key)) {
|
|
250
|
+
throw new Error("A shared component cannot be acquired from inside its own creation");
|
|
251
|
+
}
|
|
252
|
+
const entry = this.entries.get(key) ?? this.createEntry(key);
|
|
253
|
+
entry.consumerCount++;
|
|
254
|
+
const cancellation = createDeferred();
|
|
255
|
+
const acquisition = new SharedComponentAcquisitionImpl(entry.component, () => {
|
|
256
|
+
cancellation.reject(new import_error.SilentError("The shared component acquisition was released"));
|
|
257
|
+
this.releaseReference(entry);
|
|
258
|
+
});
|
|
259
|
+
const _abortListener = __using(_stack, options.abortSignal ? (0, import_abort_controller.onAbort)(options.abortSignal, (abortSignal) => {
|
|
260
|
+
cancellation.reject(abortSignal.reason);
|
|
261
|
+
acquisition.release();
|
|
262
|
+
}) : null);
|
|
263
|
+
try {
|
|
264
|
+
if (options.consumer) {
|
|
265
|
+
acquisition.linkConsumer(options.consumer);
|
|
266
|
+
}
|
|
267
|
+
await Promise.race([entry.ready.promise, cancellation.promise]);
|
|
268
|
+
} catch (error) {
|
|
269
|
+
acquisition.release();
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
if (acquisition.isReleased) {
|
|
273
|
+
throw new import_error.SilentError("The shared component acquisition was released");
|
|
274
|
+
}
|
|
275
|
+
return acquisition;
|
|
276
|
+
} catch (_) {
|
|
277
|
+
var _error = _, _hasError = true;
|
|
278
|
+
} finally {
|
|
279
|
+
__callDispose(_stack, _error, _hasError);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Returns how many acquisitions currently hold the component shared under a key, pending ones included.
|
|
284
|
+
*
|
|
285
|
+
* @param key - The resource key.
|
|
286
|
+
* @returns The number of consumers, `0` when the key has no shared component.
|
|
287
|
+
*/
|
|
288
|
+
getConsumerCount(key) {
|
|
289
|
+
return this.entries.get(key)?.consumerCount ?? 0;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Registers the teardown that unloads every shared component when the pool unloads.
|
|
293
|
+
*/
|
|
294
|
+
onload() {
|
|
295
|
+
this.register(() => {
|
|
296
|
+
for (const entry of (0, import_array.snapshot)([...this.entries.values()])) {
|
|
297
|
+
this.unloadEntry(entry, new import_error.SilentError("The shared component pool is unloaded"));
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
createEntry(key) {
|
|
302
|
+
this.creatingKeys.add(key);
|
|
303
|
+
try {
|
|
304
|
+
const component = this.createComponent(key);
|
|
305
|
+
const entry = {
|
|
306
|
+
component,
|
|
307
|
+
consumerCount: 0,
|
|
308
|
+
isUnloaded: false,
|
|
309
|
+
key,
|
|
310
|
+
ready: createDeferred()
|
|
311
|
+
};
|
|
312
|
+
this.entries.set(key, entry);
|
|
313
|
+
let loadPromise = null;
|
|
314
|
+
try {
|
|
315
|
+
if (component instanceof import_component_ex.ComponentEx) {
|
|
316
|
+
loadPromise = component.loadWithPromises();
|
|
317
|
+
} else {
|
|
318
|
+
component.load();
|
|
319
|
+
}
|
|
320
|
+
} catch (error) {
|
|
321
|
+
this.unloadEntry(entry, error);
|
|
322
|
+
throw error;
|
|
323
|
+
}
|
|
324
|
+
if (loadPromise) {
|
|
325
|
+
loadPromise.then(() => {
|
|
326
|
+
entry.ready.resolve();
|
|
327
|
+
}).catch((error) => {
|
|
328
|
+
this.unloadEntry(entry, error);
|
|
329
|
+
});
|
|
330
|
+
} else {
|
|
331
|
+
entry.ready.resolve();
|
|
332
|
+
}
|
|
333
|
+
return entry;
|
|
334
|
+
} finally {
|
|
335
|
+
this.creatingKeys.delete(key);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
releaseReference(entry) {
|
|
339
|
+
entry.consumerCount--;
|
|
340
|
+
if (entry.consumerCount <= 0) {
|
|
341
|
+
this.unloadEntry(entry, new import_error.SilentError("The last consumer released the shared component before it loaded"));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
unloadEntry(entry, reason) {
|
|
345
|
+
if (entry.isUnloaded) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
entry.isUnloaded = true;
|
|
349
|
+
this.entries.delete(entry.key);
|
|
350
|
+
entry.ready.reject(reason);
|
|
351
|
+
entry.component.unload();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function createDeferred() {
|
|
355
|
+
let resolve = import_function.noop;
|
|
356
|
+
let reject = import_function.noop;
|
|
357
|
+
const promise = new Promise((resolvePromise, rejectPromise) => {
|
|
358
|
+
resolve = resolvePromise;
|
|
359
|
+
reject = rejectPromise;
|
|
360
|
+
});
|
|
361
|
+
promise.catch(import_function.noop);
|
|
362
|
+
return { promise, reject, resolve };
|
|
363
|
+
}
|
|
364
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
365
|
+
0 && (module.exports = {
|
|
366
|
+
SharedComponentPoolComponent
|
|
367
|
+
});
|
|
368
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL3NoYXJlZC1jb21wb25lbnQtcG9vbC1jb21wb25lbnQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIEEgcG9vbCB0aGF0IHNoYXJlcyBvbmUgbG9hZGVkIGNvbXBvbmVudCBwZXIgY2FsbGVyLWRlZmluZWQga2V5IGFtb25nIHNldmVyYWwgY29uc3VtZXJzLCBhbmQgdW5sb2FkcyBpdCB3aGVuIHRoZVxuICogbGFzdCBjb25zdW1lciByZWxlYXNlcyBpdC5cbiAqL1xuXG5pbXBvcnQgdHlwZSB7IERpc3Bvc2FibGVFeCB9IGZyb20gJ0BtbmFvdW1vdi90eXBlc2NyaXB0LWxpYi9kaXNwb3NhYmxlJztcblxuaW1wb3J0IHsgb25BYm9ydCB9IGZyb20gJ0BtbmFvdW1vdi90eXBlc2NyaXB0LWxpYi9hYm9ydC1jb250cm9sbGVyJztcbmltcG9ydCB7IHNuYXBzaG90IH0gZnJvbSAnQG1uYW91bW92L3R5cGVzY3JpcHQtbGliL2FycmF5JztcbmltcG9ydCB7IFNpbGVudEVycm9yIH0gZnJvbSAnQG1uYW91bW92L3R5cGVzY3JpcHQtbGliL2Vycm9yJztcbmltcG9ydCB7IG5vb3AgfSBmcm9tICdAbW5hb3Vtb3YvdHlwZXNjcmlwdC1saWIvZnVuY3Rpb24nO1xuaW1wb3J0IHsgQ29tcG9uZW50IH0gZnJvbSAnb2JzaWRpYW4nO1xuXG5pbXBvcnQgeyBDb21wb25lbnRFeCB9IGZyb20gJy4vY29tcG9uZW50LWV4LnRzJztcblxuLyoqX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xjQUFVO0FBQ1YsYUFBUztBQUFBLEVBQ1gsQ0FBQztBQUVELFVBQVEsTUFBTSxvQkFBSTtBQUNsQixTQUFPLEVBQUUsU0FBUyxRQUFRLFFBQVE7QUFDcEM7IiwibmFtZXMiOltdfQ==
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/// <reference path="../library-references.d.cts" />
|
|
2
|
+
/// <reference lib="dom" />
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
*
|
|
6
|
+
* A pool that shares one loaded component per caller-defined key among several consumers, and unloads it when the
|
|
7
|
+
* last consumer releases it.
|
|
8
|
+
*/
|
|
9
|
+
import type { DisposableEx } from '@mnaoumov/typescript-lib/disposable' with { 'resolution-mode': 'import' };
|
|
10
|
+
import { Component } from 'obsidian';
|
|
11
|
+
import { ComponentEx } from './component-ex.cjs';
|
|
12
|
+
/**
|
|
13
|
+
* One consumer's hold on a shared component.
|
|
14
|
+
*
|
|
15
|
+
* Releasing it is idempotent: the first call drops the hold, and every later call — including the one the consumer
|
|
16
|
+
* link makes when the consumer unloads — does nothing.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam TComponent - The type of the shared component.
|
|
19
|
+
*/
|
|
20
|
+
export interface SharedComponentAcquisition<TComponent extends Component> extends DisposableEx {
|
|
21
|
+
/**
|
|
22
|
+
* The shared component, loaded. Every consumer of the same key receives the same instance.
|
|
23
|
+
*/
|
|
24
|
+
readonly component: TComponent;
|
|
25
|
+
/**
|
|
26
|
+
* Whether this acquisition has been released.
|
|
27
|
+
*/
|
|
28
|
+
readonly isReleased: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Releases this acquisition. The shared component is unloaded when its last acquisition is released.
|
|
31
|
+
*/
|
|
32
|
+
readonly release: () => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options of {@link SharedComponentPoolComponent.acquire}.
|
|
36
|
+
*/
|
|
37
|
+
export interface SharedComponentPoolComponentAcquireOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Cancels the acquisition while the shared component is still loading. An abort after the acquisition resolved does
|
|
40
|
+
* nothing; release the acquisition instead.
|
|
41
|
+
*/
|
|
42
|
+
readonly abortSignal?: AbortSignal;
|
|
43
|
+
/**
|
|
44
|
+
* A component whose unload releases the acquisition automatically.
|
|
45
|
+
*
|
|
46
|
+
* The link is a child component added to the consumer, so it follows Obsidian's own rules: a consumer that is not
|
|
47
|
+
* loaded yet starts holding the link when it loads, and a {@link ComponentEx} consumer that is already unloaded
|
|
48
|
+
* refuses it with a {@link SilentError}. Releasing the acquisition by hand removes the link again, so a long-lived
|
|
49
|
+
* consumer that acquires and releases many times accumulates nothing.
|
|
50
|
+
*/
|
|
51
|
+
readonly consumer?: Component;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Parameters of {@link SharedComponentPoolComponent}.
|
|
55
|
+
*
|
|
56
|
+
* @typeParam TKey - The type of the resource key.
|
|
57
|
+
* @typeParam TComponent - The type of the shared component.
|
|
58
|
+
*/
|
|
59
|
+
export interface SharedComponentPoolComponentConstructorParams<TKey, TComponent extends Component> {
|
|
60
|
+
/**
|
|
61
|
+
* Creates the component shared under a key. Called once per key each time the key goes from no consumer to one; the
|
|
62
|
+
* pool loads the component itself, so the factory must return it unloaded.
|
|
63
|
+
*
|
|
64
|
+
* @param key - The resource key.
|
|
65
|
+
* @returns The new, not yet loaded component.
|
|
66
|
+
*/
|
|
67
|
+
readonly createComponent: (key: TKey) => TComponent;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Shares one loaded component per caller-defined key among several consumers.
|
|
71
|
+
*
|
|
72
|
+
* The first {@link acquire} of a key creates the component through the factory and loads it; every further acquire of
|
|
73
|
+
* the same key, concurrent or later, receives the same instance; the release of the last acquisition unloads it, and
|
|
74
|
+
* the next acquire creates a fresh one. A {@link ComponentEx} is loaded through {@link ComponentEx.loadWithPromises}, so
|
|
75
|
+
* an acquire resolves only once its `onloadAsync` and children have settled, and a failed load rejects every waiting
|
|
76
|
+
* acquire, unloads the component and leaves the key free for a fresh attempt.
|
|
77
|
+
*
|
|
78
|
+
* The pool is itself a component, and its parent is the owner of every shared instance: add it with `addChild` to the
|
|
79
|
+
* plugin (or any longer-lived component). Unloading the owner unloads every shared component still held, rejects
|
|
80
|
+
* every acquire still waiting with a {@link SilentError}, and refuses later acquires. Keys are compared the way a
|
|
81
|
+
* {@link Map} compares them, so two equal-looking object keys are two resources. The instances live on the pool
|
|
82
|
+
* object only, never in the shared-state bag, so two plugins — or two pools of one plugin — never share anything.
|
|
83
|
+
*
|
|
84
|
+
* Reach for it only when SEVERAL independent consumers want the same expensive component and none of them owns it.
|
|
85
|
+
* A component with a single owner is that owner's child: `addChild` is simpler and already unloads it with its owner.
|
|
86
|
+
*
|
|
87
|
+
* @typeParam TKey - The type of the resource key.
|
|
88
|
+
* @typeParam TComponent - The type of the shared component.
|
|
89
|
+
*/
|
|
90
|
+
export declare class SharedComponentPoolComponent<TKey, TComponent extends Component> extends ComponentEx {
|
|
91
|
+
/**
|
|
92
|
+
* Creates the component shared under a key; see {@link SharedComponentPoolComponentConstructorParams.createComponent}.
|
|
93
|
+
*/
|
|
94
|
+
protected readonly createComponent: (key: TKey) => TComponent;
|
|
95
|
+
private readonly creatingKeys;
|
|
96
|
+
private readonly entries;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new pool.
|
|
99
|
+
*
|
|
100
|
+
* @param params - The pool parameters.
|
|
101
|
+
*/
|
|
102
|
+
constructor(params: SharedComponentPoolComponentConstructorParams<TKey, TComponent>);
|
|
103
|
+
/**
|
|
104
|
+
* Acquires the component shared under a key, creating and loading it when the key has no consumer yet.
|
|
105
|
+
*
|
|
106
|
+
* @param key - The resource key.
|
|
107
|
+
* @param options - The acquisition options.
|
|
108
|
+
* @returns The acquisition, once the shared component has loaded.
|
|
109
|
+
* @throws An {@link Error} when the pool was never loaded, when the factory or the load fails, or when called for a
|
|
110
|
+
* key from inside that key's own factory or synchronous load; a {@link SilentError} when the pool is unloaded, or
|
|
111
|
+
* when the consumer unloads or the acquisition is released before the load completes; the abort reason when
|
|
112
|
+
* `abortSignal` aborts first.
|
|
113
|
+
*/
|
|
114
|
+
acquire(key: TKey, options?: SharedComponentPoolComponentAcquireOptions): Promise<SharedComponentAcquisition<TComponent>>;
|
|
115
|
+
/**
|
|
116
|
+
* Returns how many acquisitions currently hold the component shared under a key, pending ones included.
|
|
117
|
+
*
|
|
118
|
+
* @param key - The resource key.
|
|
119
|
+
* @returns The number of consumers, `0` when the key has no shared component.
|
|
120
|
+
*/
|
|
121
|
+
getConsumerCount(key: TKey): number;
|
|
122
|
+
/**
|
|
123
|
+
* Registers the teardown that unloads every shared component when the pool unloads.
|
|
124
|
+
*/
|
|
125
|
+
onload(): void;
|
|
126
|
+
private createEntry;
|
|
127
|
+
private releaseReference;
|
|
128
|
+
private unloadEntry;
|
|
129
|
+
}
|
|
@@ -118,9 +118,9 @@ __export(style_sheet_component_exports, {
|
|
|
118
118
|
registerStyle: () => registerStyle
|
|
119
119
|
});
|
|
120
120
|
module.exports = __toCommonJS(style_sheet_component_exports);
|
|
121
|
-
var import_object_utils = require(
|
|
122
|
-
var import_all_windows_event_component = require(
|
|
123
|
-
var import_component_ex = require(
|
|
121
|
+
var import_object_utils = require("@mnaoumov/typescript-lib/object-utils");
|
|
122
|
+
var import_all_windows_event_component = require("./all-windows-event-component.cjs");
|
|
123
|
+
var import_component_ex = require("./component-ex.cjs");
|
|
124
124
|
class StyleSheetComponent extends import_component_ex.ComponentEx {
|
|
125
125
|
/**
|
|
126
126
|
* The CSS currently attached.
|
|
@@ -117,9 +117,9 @@ __export(syntax_highlighting_component_exports, {
|
|
|
117
117
|
SyntaxHighlightingComponent: () => SyntaxHighlightingComponent
|
|
118
118
|
});
|
|
119
119
|
module.exports = __toCommonJS(syntax_highlighting_component_exports);
|
|
120
|
-
var import_error = require(
|
|
121
|
-
var import_implementations = require(
|
|
122
|
-
var import_component_ex = require(
|
|
120
|
+
var import_error = require("@mnaoumov/typescript-lib/error");
|
|
121
|
+
var import_implementations = require("@obsidian-typings/obsidian-public-latest/implementations");
|
|
122
|
+
var import_component_ex = require("./component-ex.cjs");
|
|
123
123
|
class SyntaxHighlightingComponent extends import_component_ex.ComponentEx {
|
|
124
124
|
/**
|
|
125
125
|
* Registers a fenced code block language, highlighting it in the editor and, optionally, in reading view.
|
|
@@ -90,7 +90,7 @@ __export(templates_language_component_exports, {
|
|
|
90
90
|
TemplatesLanguageComponent: () => TemplatesLanguageComponent
|
|
91
91
|
});
|
|
92
92
|
module.exports = __toCommonJS(templates_language_component_exports);
|
|
93
|
-
var import_syntax_highlighting_component = require(
|
|
93
|
+
var import_syntax_highlighting_component = require("./syntax-highlighting-component.cjs");
|
|
94
94
|
const DEFAULT_FORMAT_PATTERN = /[a-zA-Z0-9_-]+/;
|
|
95
95
|
const DEFAULT_TOKEN_PATTERN = /^[a-zA-Z0-9_]+/;
|
|
96
96
|
const FORMAT_DELIMITER_PATTERN = /^:/;
|