@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
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
(function () {
|
|
6
|
+
function ensureBrowserProcess() {
|
|
7
|
+
const browserProcess = {
|
|
8
|
+
browser: true,
|
|
9
|
+
cwd() {
|
|
10
|
+
return "/";
|
|
11
|
+
},
|
|
12
|
+
env: {},
|
|
13
|
+
platform: "android"
|
|
14
|
+
};
|
|
15
|
+
const existingProcess = globalThis.process;
|
|
16
|
+
if (!existingProcess) {
|
|
17
|
+
globalThis.process = browserProcess;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (existingProcess.versions?.node) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const existingProcessRecord = existingProcess;
|
|
24
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
25
|
+
existingProcessRecord[key] ??= value;
|
|
26
|
+
}
|
|
27
|
+
existingProcessRecord["browser"] = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ensureBrowserProcess();
|
|
31
|
+
})();
|
|
32
|
+
(function patchObsidianRequire() {
|
|
33
|
+
const originalRequire = require;
|
|
34
|
+
if (!originalRequire || originalRequire.__isPatched) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
require = Object.assign(
|
|
38
|
+
(id) => requirePatched(id),
|
|
39
|
+
originalRequire,
|
|
40
|
+
{
|
|
41
|
+
__isPatched: true
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
function extractDefault($module) {
|
|
45
|
+
return $module && $module.__esModule && "default" in $module ? $module.default : $module;
|
|
46
|
+
}
|
|
47
|
+
const OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
48
|
+
"@codemirror/autocomplete",
|
|
49
|
+
"@codemirror/collab",
|
|
50
|
+
"@codemirror/commands",
|
|
51
|
+
"@codemirror/language",
|
|
52
|
+
"@codemirror/lint",
|
|
53
|
+
"@codemirror/search",
|
|
54
|
+
"@codemirror/state",
|
|
55
|
+
"@codemirror/text",
|
|
56
|
+
"@codemirror/view",
|
|
57
|
+
"@lezer/common",
|
|
58
|
+
"@lezer/highlight",
|
|
59
|
+
"@lezer/lr",
|
|
60
|
+
"obsidian"
|
|
61
|
+
]);
|
|
62
|
+
const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
63
|
+
"@codemirror/closebrackets",
|
|
64
|
+
"@codemirror/comment",
|
|
65
|
+
"@codemirror/fold",
|
|
66
|
+
"@codemirror/gutter",
|
|
67
|
+
"@codemirror/highlight",
|
|
68
|
+
"@codemirror/history",
|
|
69
|
+
"@codemirror/matchbrackets",
|
|
70
|
+
"@codemirror/panel",
|
|
71
|
+
"@codemirror/rangeset",
|
|
72
|
+
"@codemirror/rectangular-selection",
|
|
73
|
+
"@codemirror/stream-parser",
|
|
74
|
+
"@codemirror/tooltip"
|
|
75
|
+
]);
|
|
76
|
+
function requirePatched(id) {
|
|
77
|
+
if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
|
|
78
|
+
return originalRequire?.(id);
|
|
79
|
+
}
|
|
80
|
+
const app = globalThis.app;
|
|
81
|
+
if (app?.isMobile) {
|
|
82
|
+
if (id === "process" || id === "node:process") {
|
|
83
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
|
|
84
|
+
return process;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
const $module = originalRequire?.(id);
|
|
88
|
+
if ($module) {
|
|
89
|
+
return extractDefault($module);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
})();
|
|
96
|
+
|
|
97
|
+
"use strict";
|
|
98
|
+
var __defProp = Object.defineProperty;
|
|
99
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
100
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
101
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
102
|
+
var __export = (target, all) => {
|
|
103
|
+
for (var name in all)
|
|
104
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
105
|
+
};
|
|
106
|
+
var __copyProps = (to, from, except, desc) => {
|
|
107
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
108
|
+
for (let key of __getOwnPropNames(from))
|
|
109
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
110
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
111
|
+
}
|
|
112
|
+
return to;
|
|
113
|
+
};
|
|
114
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
115
|
+
var misplaced_attachment_exports = {};
|
|
116
|
+
__export(misplaced_attachment_exports, {
|
|
117
|
+
ExternalAttachmentLinkMode: () => ExternalAttachmentLinkMode,
|
|
118
|
+
MisplacedAttachmentIndex: () => MisplacedAttachmentIndex,
|
|
119
|
+
getAttachmentPlacement: () => getAttachmentPlacement,
|
|
120
|
+
recordAttachmentPlacement: () => recordAttachmentPlacement
|
|
121
|
+
});
|
|
122
|
+
module.exports = __toCommonJS(misplaced_attachment_exports);
|
|
123
|
+
var import_implementations = require("@obsidian-typings/obsidian-public-latest/implementations");
|
|
124
|
+
var import_attachment_path = require("./attachment-path.cjs");
|
|
125
|
+
var import_file_system = require("./file-system.cjs");
|
|
126
|
+
var ExternalAttachmentLinkMode = /* @__PURE__ */ ((ExternalAttachmentLinkMode2) => {
|
|
127
|
+
ExternalAttachmentLinkMode2["Ignore"] = "Ignore";
|
|
128
|
+
ExternalAttachmentLinkMode2["Report"] = "Report";
|
|
129
|
+
ExternalAttachmentLinkMode2["ReportUnowned"] = "ReportUnowned";
|
|
130
|
+
return ExternalAttachmentLinkMode2;
|
|
131
|
+
})(ExternalAttachmentLinkMode || {});
|
|
132
|
+
class MisplacedAttachmentIndex extends Map {
|
|
133
|
+
/**
|
|
134
|
+
* Creates an empty index.
|
|
135
|
+
*
|
|
136
|
+
* @param mode - Which external references {@link MisplacedAttachmentIndex.getReported} returns.
|
|
137
|
+
*/
|
|
138
|
+
constructor(mode = "Report" /* Report */) {
|
|
139
|
+
super();
|
|
140
|
+
this.mode = mode;
|
|
141
|
+
}
|
|
142
|
+
mode;
|
|
143
|
+
properNotePathsByAttachment = /* @__PURE__ */ new Map();
|
|
144
|
+
userNotePathsByAttachment = /* @__PURE__ */ new Map();
|
|
145
|
+
/**
|
|
146
|
+
* Records a reference to an attachment outside the referencing note's folder.
|
|
147
|
+
*
|
|
148
|
+
* @param notePath - The referencing note's vault-relative path.
|
|
149
|
+
* @param entry - The reference and the folder the note wants the attachment in.
|
|
150
|
+
*/
|
|
151
|
+
add(notePath, entry) {
|
|
152
|
+
let entries = this.get(notePath);
|
|
153
|
+
if (!entries) {
|
|
154
|
+
entries = [];
|
|
155
|
+
this.set(notePath, entries);
|
|
156
|
+
}
|
|
157
|
+
entries.push(entry);
|
|
158
|
+
this.addUser(entry.attachmentPath, notePath);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Records that a note references an attachment, wherever the attachment sits.
|
|
162
|
+
*
|
|
163
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
164
|
+
* @param notePath - The referencing note's vault-relative path.
|
|
165
|
+
*/
|
|
166
|
+
addUser(attachmentPath, notePath) {
|
|
167
|
+
addToSetMap(this.userNotePathsByAttachment, attachmentPath, notePath);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The notes that use an attachment besides the given one, its proper notes first, each group in walk order.
|
|
171
|
+
*
|
|
172
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
173
|
+
* @param notePath - The note to leave out: the one whose reference is being reported.
|
|
174
|
+
* @returns The other notes' paths.
|
|
175
|
+
*/
|
|
176
|
+
getOtherUserNotePaths(attachmentPath, notePath) {
|
|
177
|
+
const properNotePaths = this.getProperNotePaths(attachmentPath);
|
|
178
|
+
const userNotePaths = [...this.userNotePathsByAttachment.get(attachmentPath) ?? []];
|
|
179
|
+
return [...properNotePaths, ...userNotePaths.filter((path) => !properNotePaths.includes(path))].filter((path) => path !== notePath);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The proper notes of an attachment: the notes that reference it and whose own folder holds it, in walk order.
|
|
183
|
+
*
|
|
184
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
185
|
+
* @returns The proper notes' paths, empty when the attachment has none.
|
|
186
|
+
*/
|
|
187
|
+
getProperNotePaths(attachmentPath) {
|
|
188
|
+
return [...this.properNotePathsByAttachment.get(attachmentPath) ?? []];
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The entries to report, after the mode is applied, grouped by note, with a note left out once none of its
|
|
192
|
+
* entries survive.
|
|
193
|
+
*
|
|
194
|
+
* @returns The entries to report.
|
|
195
|
+
*/
|
|
196
|
+
getReported() {
|
|
197
|
+
const reported = /* @__PURE__ */ new Map();
|
|
198
|
+
if (this.mode === "Ignore" /* Ignore */) {
|
|
199
|
+
return reported;
|
|
200
|
+
}
|
|
201
|
+
for (const [notePath, entries] of this) {
|
|
202
|
+
const surviving = this.mode === "ReportUnowned" /* ReportUnowned */ ? entries.filter((entry) => !this.properNotePathsByAttachment.has(entry.attachmentPath)) : entries;
|
|
203
|
+
if (surviving.length > 0) {
|
|
204
|
+
reported.set(notePath, surviving);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return reported;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Whether a note is a proper note of an attachment: it references it, and its own folder holds it.
|
|
211
|
+
*
|
|
212
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
213
|
+
* @param notePath - The note's vault-relative path.
|
|
214
|
+
* @returns `true` when the note's own attachment folder holds the attachment.
|
|
215
|
+
*/
|
|
216
|
+
isProperNote(attachmentPath, notePath) {
|
|
217
|
+
return this.properNotePathsByAttachment.get(attachmentPath)?.has(notePath) ?? false;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Records that an attachment sits in the folder configured for a note that references it, which makes that
|
|
221
|
+
* note its proper note.
|
|
222
|
+
*
|
|
223
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
224
|
+
* @param notePath - The referencing note whose folder holds it.
|
|
225
|
+
*/
|
|
226
|
+
markHomed(attachmentPath, notePath) {
|
|
227
|
+
addToSetMap(this.properNotePathsByAttachment, attachmentPath, notePath);
|
|
228
|
+
this.addUser(attachmentPath, notePath);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
async function getAttachmentPlacement(params) {
|
|
232
|
+
const { app, attachmentFile, notePath } = params;
|
|
233
|
+
const properAttachmentFolderPath = await (0, import_attachment_path.getAttachmentFolderPathForAttachment)({
|
|
234
|
+
app,
|
|
235
|
+
attachmentPathOrFile: attachmentFile,
|
|
236
|
+
context: import_attachment_path.AttachmentPathContext.Unknown,
|
|
237
|
+
notePathOrFile: notePath
|
|
238
|
+
});
|
|
239
|
+
const isInsensitive = (0, import_implementations.getDataAdapterEx)(app).insensitive;
|
|
240
|
+
return {
|
|
241
|
+
isInProperFolder: fold((0, import_implementations.parentFolderPath)(attachmentFile.path)) === fold(properAttachmentFolderPath),
|
|
242
|
+
properAttachmentFolderPath
|
|
243
|
+
};
|
|
244
|
+
function fold(value) {
|
|
245
|
+
return isInsensitive ? value.toLowerCase() : value;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async function recordAttachmentPlacement(params) {
|
|
249
|
+
const {
|
|
250
|
+
app,
|
|
251
|
+
attachmentFile,
|
|
252
|
+
index,
|
|
253
|
+
isPathIgnored = isNone,
|
|
254
|
+
isSharedAttachmentPath = isNone,
|
|
255
|
+
isTreatedAsAttachment = isNone,
|
|
256
|
+
notePath,
|
|
257
|
+
reference
|
|
258
|
+
} = params;
|
|
259
|
+
if (index.mode === "Ignore" /* Ignore */) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if ((0, import_file_system.isNote)(attachmentFile) && !isTreatedAsAttachment(attachmentFile.path)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (isPathIgnored(attachmentFile.path) || isSharedAttachmentPath(attachmentFile.path)) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const placement = await getAttachmentPlacement({ app, attachmentFile, notePath });
|
|
269
|
+
if (placement.isInProperFolder) {
|
|
270
|
+
index.markHomed(attachmentFile.path, notePath);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
index.add(notePath, {
|
|
274
|
+
attachmentPath: attachmentFile.path,
|
|
275
|
+
properAttachmentFolderPath: placement.properAttachmentFolderPath,
|
|
276
|
+
reference
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function addToSetMap(map, key, value) {
|
|
280
|
+
let set = map.get(key);
|
|
281
|
+
if (!set) {
|
|
282
|
+
set = /* @__PURE__ */ new Set();
|
|
283
|
+
map.set(key, set);
|
|
284
|
+
}
|
|
285
|
+
set.add(value);
|
|
286
|
+
}
|
|
287
|
+
function isNone() {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
291
|
+
0 && (module.exports = {
|
|
292
|
+
ExternalAttachmentLinkMode,
|
|
293
|
+
MisplacedAttachmentIndex,
|
|
294
|
+
getAttachmentPlacement,
|
|
295
|
+
recordAttachmentPlacement
|
|
296
|
+
});
|
|
297
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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QUssdUJBQXVCLGVBQWUsSUFBSSxHQUFHO0FBQ3JGO0FBQUEsRUFDRjtBQUVBLFFBQU0sWUFBWSxNQUFNLHVCQUF1QixFQUFFLEtBQUssZ0JBQWdCLFNBQVMsQ0FBQztBQUVoRixNQUFJLFVBQVUsa0JBQWtCO0FBQzlCLFVBQU0sVUFBVSxlQUFlLE1BQU0sUUFBUTtBQUM3QztBQUFBLEVBQ0Y7QUFFQSxRQUFNLElBQUksVUFBVTtBQUFBLElBQ2xCLGdCQUFnQixlQUFlO0FBQUEsSUFDL0IsNEJBQTRCLFVBQVU7QUFBQSxJQUN0QztBQUFBLEVBQ0YsQ0FBQztBQUNIO0FBRUEsU0FBUyxZQUFZLEtBQStCLEtBQWEsT0FBcUI7QUFDcEYsTUFBSSxNQUFNLElBQUksSUFBSSxHQUFHO0FBQ3JCLE1BQUksQ0FBQyxLQUFLO0FBQ1IsVUFBTSxvQkFBSSxJQUFZO0FBQ3RCLFFBQUksSUFBSSxLQUFLLEdBQUc7QUFBQSxFQUNsQjtBQUNBLE1BQUksSUFBSSxLQUFLO0FBQ2Y7QUFFQSxTQUFTLFNBQWtCO0FBQ3pCLFNBQU87QUFDVDsiLCJuYW1lcyI6WyJFeHRlcm5hbEF0dGFjaG1lbnRMaW5rTW9kZSJdfQ==
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/// <reference path="./library-references.d.cts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Whether an attachment sits outside the attachment folder of the notes that use it, and which notes are its
|
|
6
|
+
* proper home.
|
|
7
|
+
*
|
|
8
|
+
* Two things here are easy to get wrong:
|
|
9
|
+
*
|
|
10
|
+
* - **The judgement is about the FOLDER, not the path.** `getAttachmentFilePath` answers about the proper
|
|
11
|
+
* path, folder and templated base name both, so judging on it raw flags every attachment whose NAME does not
|
|
12
|
+
* match a rename template. That is a different defect. So the comparison is folder against folder, through
|
|
13
|
+
* `getAttachmentFolderPathForAttachment`, which also skips the name generation that dominates the cost of
|
|
14
|
+
* the question when `Custom Attachment Location` answers it.
|
|
15
|
+
* - **The proper folder is asked for the REAL attachment, never a dummy.** A folder template may read the
|
|
16
|
+
* attachment's own name, extension or stats, so `getAttachmentFolderPath`'s dummy-file route can answer
|
|
17
|
+
* about a file that does not exist.
|
|
18
|
+
*
|
|
19
|
+
* A reference is judged from the note that makes it: `A.md` linking `B/image.png`, which sits in `B.md`'s folder,
|
|
20
|
+
* is A linking an EXTERNAL attachment, even when B uses it too. Whether such a reference is worth reporting depends
|
|
21
|
+
* on whether the attachment has a proper note anywhere, which is known only after every note has been judged, so
|
|
22
|
+
* {@link MisplacedAttachmentIndex} collects the verdicts and {@link MisplacedAttachmentIndex.getReported} applies
|
|
23
|
+
* the {@link ExternalAttachmentLinkMode} at the end.
|
|
24
|
+
*
|
|
25
|
+
* Rendering is the caller's: this module only judges and collects.
|
|
26
|
+
*/
|
|
27
|
+
import type { App, Reference, TFile } from 'obsidian' with { 'resolution-mode': 'import' };
|
|
28
|
+
/**
|
|
29
|
+
* Which references to an attachment outside the referencing note's attachment folder are reported.
|
|
30
|
+
*/
|
|
31
|
+
export declare enum ExternalAttachmentLinkMode {
|
|
32
|
+
/**
|
|
33
|
+
* Never report one: nothing is judged at all.
|
|
34
|
+
*/
|
|
35
|
+
Ignore = "Ignore",
|
|
36
|
+
/**
|
|
37
|
+
* Report every such reference, including one to an attachment filed in the folder of another note that
|
|
38
|
+
* references it too.
|
|
39
|
+
*/
|
|
40
|
+
Report = "Report",
|
|
41
|
+
/**
|
|
42
|
+
* Report such a reference only when no note that references the attachment has it in its own folder.
|
|
43
|
+
*/
|
|
44
|
+
ReportUnowned = "ReportUnowned"
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The folder an attachment sits in, judged against the folder one note's configuration puts its attachments in.
|
|
48
|
+
*/
|
|
49
|
+
export interface AttachmentPlacement {
|
|
50
|
+
/**
|
|
51
|
+
* Whether the attachment sits in {@link AttachmentPlacement.properAttachmentFolderPath}, compared the way the
|
|
52
|
+
* vault's adapter compares names (case-folded on a case-insensitive adapter).
|
|
53
|
+
*/
|
|
54
|
+
readonly isInProperFolder: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The vault-relative folder the note's configuration puts this attachment in, `/` for the vault root.
|
|
57
|
+
*/
|
|
58
|
+
readonly properAttachmentFolderPath: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parameters for {@link getAttachmentPlacement}.
|
|
62
|
+
*/
|
|
63
|
+
export interface GetAttachmentPlacementParams {
|
|
64
|
+
/**
|
|
65
|
+
* The Obsidian app instance.
|
|
66
|
+
*/
|
|
67
|
+
readonly app: App;
|
|
68
|
+
/**
|
|
69
|
+
* The attachment to judge.
|
|
70
|
+
*/
|
|
71
|
+
readonly attachmentFile: TFile;
|
|
72
|
+
/**
|
|
73
|
+
* The vault-relative path of the note whose configuration the attachment is judged against.
|
|
74
|
+
*/
|
|
75
|
+
readonly notePath: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One reference to an attachment outside the attachment folder of the note that makes it.
|
|
79
|
+
*
|
|
80
|
+
* The same attachment referenced from two notes is two entries, because the two notes can configure different
|
|
81
|
+
* attachment folders.
|
|
82
|
+
*/
|
|
83
|
+
export interface MisplacedAttachmentEntry {
|
|
84
|
+
/**
|
|
85
|
+
* The attachment's current vault-relative path.
|
|
86
|
+
*/
|
|
87
|
+
readonly attachmentPath: string;
|
|
88
|
+
/**
|
|
89
|
+
* The vault-relative folder the referencing note's configuration puts the attachment in.
|
|
90
|
+
*/
|
|
91
|
+
readonly properAttachmentFolderPath: string;
|
|
92
|
+
/**
|
|
93
|
+
* The reference that reaches the attachment.
|
|
94
|
+
*/
|
|
95
|
+
readonly reference: Reference;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Parameters for {@link recordAttachmentPlacement}.
|
|
99
|
+
*/
|
|
100
|
+
export interface RecordAttachmentPlacementParams {
|
|
101
|
+
/**
|
|
102
|
+
* The Obsidian app instance.
|
|
103
|
+
*/
|
|
104
|
+
readonly app: App;
|
|
105
|
+
/**
|
|
106
|
+
* The file the reference resolved to. Pass only references that resolved: an unresolved one is a broken link,
|
|
107
|
+
* not a misplaced attachment.
|
|
108
|
+
*/
|
|
109
|
+
readonly attachmentFile: TFile;
|
|
110
|
+
/**
|
|
111
|
+
* The index the verdict is recorded in.
|
|
112
|
+
*/
|
|
113
|
+
readonly index: MisplacedAttachmentIndex;
|
|
114
|
+
/**
|
|
115
|
+
* Whether a path is never judged, for example because the user excluded it. Defaults to judging every path.
|
|
116
|
+
*/
|
|
117
|
+
readonly isPathIgnored?: (path: string) => boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Whether a path lies in a shared attachment location, which is anybody's folder, so no reference into it is
|
|
120
|
+
* external. Defaults to no shared location.
|
|
121
|
+
*/
|
|
122
|
+
readonly isSharedAttachmentPath?: (path: string) => boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Whether a note is treated as an attachment (an `.excalidraw.md` file, say), and so judged here. Defaults to
|
|
125
|
+
* no note being one.
|
|
126
|
+
*/
|
|
127
|
+
readonly isTreatedAsAttachment?: (path: string) => boolean;
|
|
128
|
+
/**
|
|
129
|
+
* The vault-relative path of the note that makes the reference.
|
|
130
|
+
*/
|
|
131
|
+
readonly notePath: string;
|
|
132
|
+
/**
|
|
133
|
+
* The reference, kept in the entry so a report can name its line or frontmatter key.
|
|
134
|
+
*/
|
|
135
|
+
readonly reference: Reference;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The verdicts of a walk over every reference to an attachment, grouped by the note that makes the reference.
|
|
139
|
+
*
|
|
140
|
+
* It keeps every external reference, every note that uses each attachment, and each attachment's proper notes:
|
|
141
|
+
* the notes that reference it and whose own folder holds it. Which entries count as reported depends on the
|
|
142
|
+
* {@link ExternalAttachmentLinkMode} and on the proper notes, which are known only once the whole vault has been
|
|
143
|
+
* walked, so ask {@link MisplacedAttachmentIndex.getReported} after the walk.
|
|
144
|
+
*/
|
|
145
|
+
export declare class MisplacedAttachmentIndex extends Map<string, MisplacedAttachmentEntry[]> {
|
|
146
|
+
readonly mode: ExternalAttachmentLinkMode;
|
|
147
|
+
private readonly properNotePathsByAttachment;
|
|
148
|
+
private readonly userNotePathsByAttachment;
|
|
149
|
+
/**
|
|
150
|
+
* Creates an empty index.
|
|
151
|
+
*
|
|
152
|
+
* @param mode - Which external references {@link MisplacedAttachmentIndex.getReported} returns.
|
|
153
|
+
*/
|
|
154
|
+
constructor(mode?: ExternalAttachmentLinkMode);
|
|
155
|
+
/**
|
|
156
|
+
* Records a reference to an attachment outside the referencing note's folder.
|
|
157
|
+
*
|
|
158
|
+
* @param notePath - The referencing note's vault-relative path.
|
|
159
|
+
* @param entry - The reference and the folder the note wants the attachment in.
|
|
160
|
+
*/
|
|
161
|
+
add(notePath: string, entry: MisplacedAttachmentEntry): void;
|
|
162
|
+
/**
|
|
163
|
+
* Records that a note references an attachment, wherever the attachment sits.
|
|
164
|
+
*
|
|
165
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
166
|
+
* @param notePath - The referencing note's vault-relative path.
|
|
167
|
+
*/
|
|
168
|
+
addUser(attachmentPath: string, notePath: string): void;
|
|
169
|
+
/**
|
|
170
|
+
* The notes that use an attachment besides the given one, its proper notes first, each group in walk order.
|
|
171
|
+
*
|
|
172
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
173
|
+
* @param notePath - The note to leave out: the one whose reference is being reported.
|
|
174
|
+
* @returns The other notes' paths.
|
|
175
|
+
*/
|
|
176
|
+
getOtherUserNotePaths(attachmentPath: string, notePath: string): string[];
|
|
177
|
+
/**
|
|
178
|
+
* The proper notes of an attachment: the notes that reference it and whose own folder holds it, in walk order.
|
|
179
|
+
*
|
|
180
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
181
|
+
* @returns The proper notes' paths, empty when the attachment has none.
|
|
182
|
+
*/
|
|
183
|
+
getProperNotePaths(attachmentPath: string): string[];
|
|
184
|
+
/**
|
|
185
|
+
* The entries to report, after the mode is applied, grouped by note, with a note left out once none of its
|
|
186
|
+
* entries survive.
|
|
187
|
+
*
|
|
188
|
+
* @returns The entries to report.
|
|
189
|
+
*/
|
|
190
|
+
getReported(): Map<string, MisplacedAttachmentEntry[]>;
|
|
191
|
+
/**
|
|
192
|
+
* Whether a note is a proper note of an attachment: it references it, and its own folder holds it.
|
|
193
|
+
*
|
|
194
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
195
|
+
* @param notePath - The note's vault-relative path.
|
|
196
|
+
* @returns `true` when the note's own attachment folder holds the attachment.
|
|
197
|
+
*/
|
|
198
|
+
isProperNote(attachmentPath: string, notePath: string): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Records that an attachment sits in the folder configured for a note that references it, which makes that
|
|
201
|
+
* note its proper note.
|
|
202
|
+
*
|
|
203
|
+
* @param attachmentPath - The attachment's vault-relative path.
|
|
204
|
+
* @param notePath - The referencing note whose folder holds it.
|
|
205
|
+
*/
|
|
206
|
+
markHomed(attachmentPath: string, notePath: string): void;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Judges where an attachment sits against the attachment folder of one note.
|
|
210
|
+
*
|
|
211
|
+
* Asks the attachment-path seam once, folder-only, for the REAL attachment, so a `Custom Attachment Location`
|
|
212
|
+
* folder template that reads the attachment's own name is honoured and no name is generated.
|
|
213
|
+
*
|
|
214
|
+
* @param params - The attachment and the note.
|
|
215
|
+
* @returns The note's proper folder for the attachment, and whether the attachment is in it.
|
|
216
|
+
*/
|
|
217
|
+
export declare function getAttachmentPlacement(params: GetAttachmentPlacementParams): Promise<AttachmentPlacement>;
|
|
218
|
+
/**
|
|
219
|
+
* Judges one resolved reference and records the verdict in the index.
|
|
220
|
+
*
|
|
221
|
+
* Records nothing under {@link ExternalAttachmentLinkMode.Ignore}, for a note that is not treated as an
|
|
222
|
+
* attachment, and for an ignored or shared path. Otherwise the referencing note becomes a proper note of the
|
|
223
|
+
* attachment when its folder holds it, and the reference becomes an entry when it does not.
|
|
224
|
+
*
|
|
225
|
+
* @param params - The reference, its note, its target and the index.
|
|
226
|
+
* @returns A {@link Promise} that resolves once the verdict is recorded.
|
|
227
|
+
*/
|
|
228
|
+
export declare function recordAttachmentPlacement(params: RecordAttachmentPlacementParams): Promise<void>;
|
|
@@ -117,7 +117,7 @@ __export(mobile_app_info_exports, {
|
|
|
117
117
|
getMobileAppInfo: () => getMobileAppInfo
|
|
118
118
|
});
|
|
119
119
|
module.exports = __toCommonJS(mobile_app_info_exports);
|
|
120
|
-
var import_type_guards = require(
|
|
120
|
+
var import_type_guards = require("@mnaoumov/typescript-lib/type-guards");
|
|
121
121
|
const isAppInfo = (0, import_type_guards.objectTypeGuard)({
|
|
122
122
|
build: (0, import_type_guards.optionalTypeGuard)(import_type_guards.isString),
|
|
123
123
|
version: import_type_guards.isString
|
|
@@ -117,10 +117,10 @@ __export(alert_exports, {
|
|
|
117
117
|
alert: () => alert
|
|
118
118
|
});
|
|
119
119
|
module.exports = __toCommonJS(alert_exports);
|
|
120
|
-
var import_i18next = require(
|
|
121
|
-
var import_obsidian = require(
|
|
122
|
-
var import_css_class = require(
|
|
123
|
-
var import_modal = require(
|
|
120
|
+
var import_i18next = require("i18next");
|
|
121
|
+
var import_obsidian = require("obsidian");
|
|
122
|
+
var import_css_class = require("../css-class.cjs");
|
|
123
|
+
var import_modal = require("./modal.cjs");
|
|
124
124
|
class AlertModal extends import_modal.ModalBase {
|
|
125
125
|
message;
|
|
126
126
|
okButtonText;
|
|
@@ -118,13 +118,13 @@ __export(code_block_builder_exports, {
|
|
|
118
118
|
showCodeBlockBuilder: () => showCodeBlockBuilder
|
|
119
119
|
});
|
|
120
120
|
module.exports = __toCommonJS(code_block_builder_exports);
|
|
121
|
-
var import_async = require(
|
|
122
|
-
var import_type_guards = require(
|
|
123
|
-
var import_obsidian = require(
|
|
124
|
-
var import_css_class = require(
|
|
125
|
-
var import_i18n = require(
|
|
126
|
-
var import_multiple_dropdown_component = require(
|
|
127
|
-
var import_modal = require(
|
|
121
|
+
var import_async = require("@mnaoumov/typescript-lib/async");
|
|
122
|
+
var import_type_guards = require("@mnaoumov/typescript-lib/type-guards");
|
|
123
|
+
var import_obsidian = require("obsidian");
|
|
124
|
+
var import_css_class = require("../css-class.cjs");
|
|
125
|
+
var import_i18n = require("../i18n/i18n.cjs");
|
|
126
|
+
var import_multiple_dropdown_component = require("../setting-components/multiple-dropdown-component.cjs");
|
|
127
|
+
var import_modal = require("./modal.cjs");
|
|
128
128
|
const DEFAULT_SEPARATOR = ",";
|
|
129
129
|
const MIN_FENCE_LENGTH = 3;
|
|
130
130
|
const ROOT_FOLDER_PATH = "/";
|
|
@@ -117,10 +117,10 @@ __export(confirm_exports, {
|
|
|
117
117
|
confirm: () => confirm
|
|
118
118
|
});
|
|
119
119
|
module.exports = __toCommonJS(confirm_exports);
|
|
120
|
-
var import_obsidian = require(
|
|
121
|
-
var import_css_class = require(
|
|
122
|
-
var import_i18n = require(
|
|
123
|
-
var import_modal = require(
|
|
120
|
+
var import_obsidian = require("obsidian");
|
|
121
|
+
var import_css_class = require("../css-class.cjs");
|
|
122
|
+
var import_i18n = require("../i18n/i18n.cjs");
|
|
123
|
+
var import_modal = require("./modal.cjs");
|
|
124
124
|
class ConfirmModal extends import_modal.ModalBase {
|
|
125
125
|
cancelButtonText;
|
|
126
126
|
isConfirmed = false;
|