obsidian-dev-utils 55.4.0 → 56.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/CHANGELOG.md +11 -0
- package/dist/lib/cjs/abort-controller.cjs +8 -4
- package/dist/lib/cjs/array.cjs +7 -3
- package/dist/lib/cjs/async-events.cjs +9 -5
- package/dist/lib/cjs/async.cjs +8 -4
- package/dist/lib/cjs/blob.cjs +8 -4
- package/dist/lib/cjs/codemirror/index.cjs +7 -3
- package/dist/lib/cjs/codemirror/state-field-spec.cjs +7 -3
- package/dist/lib/cjs/css-class.cjs +7 -3
- package/dist/lib/cjs/debug-controller.cjs +7 -3
- package/dist/lib/cjs/debug.cjs +7 -3
- package/dist/lib/cjs/enum.cjs +7 -3
- package/dist/lib/cjs/error.cjs +7 -3
- package/dist/lib/cjs/function.cjs +7 -3
- package/dist/lib/cjs/html-element.cjs +20 -16
- package/dist/lib/cjs/index.cjs +7 -3
- package/dist/lib/cjs/library.cjs +8 -4
- package/dist/lib/cjs/object-utils.cjs +7 -3
- package/dist/lib/cjs/obsidian/@types/i18next.d.cts +3 -3
- package/dist/lib/cjs/obsidian/app.cjs +7 -3
- package/dist/lib/cjs/obsidian/async-with-notice.cjs +10 -6
- package/dist/lib/cjs/obsidian/attachment-path.cjs +7 -3
- package/dist/lib/cjs/obsidian/backlink.cjs +7 -3
- package/dist/lib/cjs/obsidian/callout.cjs +7 -3
- package/dist/lib/cjs/obsidian/code-block-markdown-information.cjs +7 -3
- package/dist/lib/cjs/obsidian/command-handlers/abstract-file-command-handler.cjs +355 -0
- package/dist/lib/cjs/obsidian/command-handlers/abstract-file-command-handler.d.cts +178 -0
- package/dist/lib/cjs/obsidian/{commands/index.cjs → command-handlers/app-active-file-provider.cjs} +31 -34
- package/dist/lib/cjs/obsidian/command-handlers/app-active-file-provider.d.cts +25 -0
- package/dist/lib/cjs/obsidian/command-handlers/app-menu-event-registrar.cjs +173 -0
- package/dist/lib/cjs/obsidian/command-handlers/app-menu-event-registrar.d.cts +41 -0
- package/dist/lib/cjs/obsidian/command-handlers/command-handler-component.cjs +164 -0
- package/dist/lib/cjs/obsidian/command-handlers/command-handler-component.d.cts +26 -0
- package/dist/lib/cjs/obsidian/command-handlers/command-handler.cjs +174 -0
- package/dist/lib/cjs/obsidian/command-handlers/command-handler.d.cts +143 -0
- package/dist/lib/cjs/obsidian/command-handlers/editor-command-handler.cjs +269 -0
- package/dist/lib/cjs/obsidian/command-handlers/editor-command-handler.d.cts +114 -0
- package/dist/lib/cjs/obsidian/command-handlers/file-command-handler.cjs +261 -0
- package/dist/lib/cjs/obsidian/command-handlers/file-command-handler.d.cts +112 -0
- package/dist/lib/cjs/obsidian/command-handlers/folder-command-handler.cjs +261 -0
- package/dist/lib/cjs/obsidian/command-handlers/folder-command-handler.d.cts +112 -0
- package/dist/lib/cjs/obsidian/command-handlers/global-command-handler.cjs +177 -0
- package/dist/lib/cjs/obsidian/command-handlers/global-command-handler.d.cts +38 -0
- package/dist/lib/cjs/obsidian/command-handlers/index.cjs +170 -0
- package/dist/lib/cjs/obsidian/command-handlers/index.d.cts +9 -0
- package/dist/lib/cjs/obsidian/components/all-windows-event-handler.cjs +8 -4
- package/dist/lib/cjs/obsidian/components/async-component.cjs +164 -0
- package/dist/lib/cjs/obsidian/components/async-component.d.cts +28 -0
- package/dist/lib/cjs/obsidian/components/async-events-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/index.cjs +10 -3
- package/dist/lib/cjs/obsidian/components/index.d.cts +1 -0
- package/dist/lib/cjs/obsidian/components/setting-components/checkbox-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/code-highlighter-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/date-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/date-time-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/email-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/file-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/index.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/month-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/multiple-dropdown-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/multiple-email-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/multiple-file-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/multiple-text-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/number-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/password-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/setting-component-wrapper.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/telephone-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/text-based-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/time-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/tri-state-checkbox-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/typed-dropdown-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/typed-multiple-dropdown-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/typed-range-text-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/typed-text-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/url-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/validator-component.cjs +9 -5
- package/dist/lib/cjs/obsidian/components/setting-components/value-component-with-change-tracking.cjs +7 -3
- package/dist/lib/cjs/obsidian/components/setting-components/week-component.cjs +7 -3
- package/dist/lib/cjs/obsidian/constructors/getDomEventsHandlersConstructor.cjs +7 -3
- package/dist/lib/cjs/obsidian/constructors/index.cjs +7 -3
- package/dist/lib/cjs/obsidian/dataview-link.cjs +7 -3
- package/dist/lib/cjs/obsidian/dataview.cjs +8 -4
- package/dist/lib/cjs/obsidian/editor.cjs +7 -3
- package/dist/lib/cjs/obsidian/file-change.cjs +7 -3
- package/dist/lib/cjs/obsidian/file-manager.cjs +7 -3
- package/dist/lib/cjs/obsidian/file-system.cjs +7 -3
- package/dist/lib/cjs/obsidian/frontmatter-link-cache-with-offsets.cjs +7 -3
- package/dist/lib/cjs/obsidian/frontmatter.cjs +7 -3
- package/dist/lib/cjs/obsidian/i18n/{custom-type-options-base.cjs → custom-type-options.cjs} +9 -5
- package/dist/lib/cjs/obsidian/i18n/custom-type-options.d.cts +37 -0
- package/dist/lib/cjs/obsidian/{plugin/plugin-settings-wrapper.cjs → i18n/default-translations.cjs} +10 -5
- package/dist/lib/cjs/obsidian/i18n/default-translations.d.cts +14 -0
- package/dist/lib/cjs/obsidian/i18n/i18n.cjs +7 -3
- package/dist/lib/cjs/obsidian/i18n/i18n.d.cts +2 -13
- package/dist/lib/cjs/obsidian/i18n/index.cjs +13 -9
- package/dist/lib/cjs/obsidian/i18n/index.d.cts +2 -2
- package/dist/lib/cjs/obsidian/i18n/locales/en.cjs +7 -3
- package/dist/lib/cjs/obsidian/i18n/locales/index.cjs +7 -3
- package/dist/lib/cjs/obsidian/i18n/locales/translations-map.cjs +7 -3
- package/dist/lib/cjs/obsidian/i18n/locales/translations-map.d.cts +1 -2
- package/dist/lib/cjs/obsidian/index.cjs +10 -6
- package/dist/lib/cjs/obsidian/index.d.cts +1 -1
- package/dist/lib/cjs/obsidian/is-in-obsidian.cjs +7 -3
- package/dist/lib/cjs/obsidian/link.cjs +7 -3
- package/dist/lib/cjs/obsidian/logger.cjs +7 -3
- package/dist/lib/cjs/obsidian/loop.cjs +7 -3
- package/dist/lib/cjs/obsidian/markdown-code-block-processor.cjs +7 -3
- package/dist/lib/cjs/obsidian/markdown-view.cjs +7 -3
- package/dist/lib/cjs/obsidian/markdown.cjs +7 -3
- package/dist/lib/cjs/obsidian/metadata-cache.cjs +7 -3
- package/dist/lib/cjs/obsidian/modals/alert.cjs +10 -6
- package/dist/lib/cjs/obsidian/modals/confirm.cjs +10 -6
- package/dist/lib/cjs/obsidian/modals/index.cjs +10 -6
- package/dist/lib/cjs/obsidian/modals/index.d.cts +1 -1
- package/dist/lib/cjs/obsidian/modals/{modal-base.cjs → modal.cjs} +10 -6
- package/dist/lib/cjs/obsidian/modals/prompt.cjs +10 -6
- package/dist/lib/cjs/obsidian/modals/select-item.cjs +9 -5
- package/dist/lib/cjs/obsidian/monkey-around.cjs +7 -3
- package/dist/lib/cjs/obsidian/obsidian-settings.cjs +7 -3
- package/dist/lib/cjs/obsidian/pdf.cjs +10 -6
- package/dist/lib/cjs/obsidian/{commands/non-editor-command-base.cjs → plugin/components/abort-signal-component.cjs} +31 -21
- package/dist/lib/cjs/obsidian/plugin/components/abort-signal-component.d.cts +27 -0
- package/dist/lib/cjs/obsidian/plugin/components/async-error-handler-component.cjs +165 -0
- package/dist/lib/cjs/obsidian/plugin/components/async-error-handler-component.d.cts +29 -0
- package/dist/lib/cjs/obsidian/plugin/components/console-debug-component.cjs +160 -0
- package/dist/lib/cjs/obsidian/plugin/components/console-debug-component.d.cts +29 -0
- package/dist/lib/cjs/obsidian/{i18n/default-translations-base.cjs → plugin/components/i18n-component.cjs} +41 -6
- package/dist/lib/cjs/obsidian/plugin/components/i18n-component.d.cts +23 -0
- package/dist/lib/cjs/obsidian/plugin/components/index.cjs +170 -0
- package/dist/lib/cjs/obsidian/plugin/components/index.d.cts +9 -0
- package/dist/lib/cjs/obsidian/plugin/components/lifecycle-events-component.cjs +207 -0
- package/dist/lib/cjs/obsidian/plugin/components/lifecycle-events-component.d.cts +59 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-context-component.cjs +162 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-context-component.d.cts +25 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-notice-component.cjs +161 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-notice-component.d.cts +25 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-settings-component.cjs +566 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-settings-component.d.cts +296 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-settings-tab-component.cjs +166 -0
- package/dist/lib/cjs/obsidian/plugin/components/plugin-settings-tab-component.d.cts +28 -0
- package/dist/lib/cjs/obsidian/plugin/index.cjs +13 -18
- package/dist/lib/cjs/obsidian/plugin/index.d.cts +2 -5
- package/dist/lib/cjs/obsidian/plugin/obsidian-plugin-repo-paths.cjs +7 -3
- package/dist/lib/cjs/obsidian/plugin/path-settings.cjs +7 -3
- package/dist/lib/cjs/obsidian/plugin/plugin-context.cjs +18 -7
- package/dist/lib/cjs/obsidian/plugin/plugin-context.d.cts +3 -2
- package/dist/lib/cjs/obsidian/plugin/plugin-id.cjs +7 -3
- package/dist/lib/cjs/obsidian/plugin/plugin-settings-tab.cjs +408 -0
- package/dist/lib/cjs/obsidian/plugin/{plugin-settings-tab-base.d.cts → plugin-settings-tab.d.cts} +28 -11
- package/dist/lib/cjs/obsidian/plugin/plugin.cjs +137 -3
- package/dist/lib/cjs/obsidian/plugin/plugin.d.cts +106 -5
- package/dist/lib/cjs/obsidian/queue.cjs +7 -3
- package/dist/lib/cjs/obsidian/react/app-context.cjs +7 -3
- package/dist/lib/cjs/obsidian/react/index.cjs +7 -3
- package/dist/lib/cjs/obsidian/reference.cjs +7 -3
- package/dist/lib/cjs/obsidian/rename-delete-handler.cjs +7 -3
- package/dist/lib/cjs/obsidian/resource-url.cjs +7 -3
- package/dist/lib/cjs/obsidian/setting-ex.cjs +7 -3
- package/dist/lib/cjs/obsidian/setting-group-ex.cjs +7 -3
- package/dist/lib/cjs/obsidian/validation.cjs +7 -3
- package/dist/lib/cjs/obsidian/vault-delete.cjs +7 -3
- package/dist/lib/cjs/obsidian/vault.cjs +7 -3
- package/dist/lib/cjs/obsidian/workspace.cjs +7 -3
- package/dist/lib/cjs/path.cjs +7 -3
- package/dist/lib/cjs/reg-exp.cjs +7 -3
- package/dist/lib/cjs/script-utils/build.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/change-extension-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/custom-esbuild-options-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/dependency.cjs +8 -4
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/fix-esm-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/fix-source-maps-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/index.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/obsidian-plugin-builder.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/preprocess-plugin.cjs +10 -6
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/rename-css-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/svelte-wrapper-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/esbuild.cjs +7 -3
- package/dist/lib/cjs/script-utils/bundlers/index.cjs +7 -3
- package/dist/lib/cjs/script-utils/cli-utils.cjs +7 -3
- package/dist/lib/cjs/script-utils/code-generator.cjs +7 -3
- package/dist/lib/cjs/script-utils/commitlint-config.cjs +7 -3
- package/dist/lib/cjs/script-utils/exec.cjs +7 -3
- package/dist/lib/cjs/script-utils/formatters/dprint.cjs +8 -4
- package/dist/lib/cjs/script-utils/formatters/index.cjs +7 -3
- package/dist/lib/cjs/script-utils/fs.cjs +7 -3
- package/dist/lib/cjs/script-utils/index.cjs +7 -3
- package/dist/lib/cjs/script-utils/json.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/cspell.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/eslint-config.cjs +9 -13
- package/dist/lib/cjs/script-utils/linters/eslint-rules/index.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/eslint-rules/no-async-callback-to-unsafe-return.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/eslint-rules/no-used-underscore-variables.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/eslint-rules/obsidian-dev-utils-plugin.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/eslint-rules/rule-tester-helper.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/eslint.cjs +8 -4
- package/dist/lib/cjs/script-utils/linters/index.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/markdownlint-cli2-config.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/markdownlint.cjs +11 -5
- package/dist/lib/cjs/script-utils/nano-staged-config.cjs +7 -3
- package/dist/lib/cjs/script-utils/npm-publish.cjs +7 -3
- package/dist/lib/cjs/script-utils/npm-run.cjs +7 -3
- package/dist/lib/cjs/script-utils/npm.cjs +7 -3
- package/dist/lib/cjs/script-utils/obsidian-dev-utils-repo-paths.cjs +7 -3
- package/dist/lib/cjs/script-utils/root.cjs +7 -3
- package/dist/lib/cjs/script-utils/test-runners/index.cjs +7 -3
- package/dist/lib/cjs/script-utils/test-runners/vitest.cjs +7 -3
- package/dist/lib/cjs/script-utils/version.cjs +7 -3
- package/dist/lib/cjs/strict-proxy.cjs +7 -3
- package/dist/lib/cjs/string.cjs +7 -3
- package/dist/lib/cjs/transformers/date-transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/duration-transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/group-transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/index.cjs +7 -3
- package/dist/lib/cjs/transformers/map-transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/set-transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/skip-private-property-transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/two-way-map-transformer.cjs +7 -3
- package/dist/lib/cjs/transformers/typed-transformer.cjs +7 -3
- package/dist/lib/cjs/two-way-map.cjs +7 -3
- package/dist/lib/cjs/type-guards.cjs +7 -3
- package/dist/lib/cjs/type.cjs +7 -3
- package/dist/lib/cjs/url.cjs +7 -3
- package/dist/lib/cjs/value-provider.cjs +7 -3
- package/dist/lib/esm/abort-controller.mjs +4 -2
- package/dist/lib/esm/array.mjs +3 -1
- package/dist/lib/esm/async-events.mjs +5 -3
- package/dist/lib/esm/async.mjs +4 -2
- package/dist/lib/esm/blob.mjs +4 -2
- package/dist/lib/esm/codemirror/index.mjs +3 -1
- package/dist/lib/esm/codemirror/state-field-spec.mjs +2 -0
- package/dist/lib/esm/css-class.mjs +3 -1
- package/dist/lib/esm/debug-controller.mjs +2 -0
- package/dist/lib/esm/debug.mjs +3 -1
- package/dist/lib/esm/enum.mjs +3 -1
- package/dist/lib/esm/error.mjs +3 -1
- package/dist/lib/esm/function.mjs +3 -1
- package/dist/lib/esm/html-element.mjs +16 -14
- package/dist/lib/esm/index.mjs +3 -1
- package/dist/lib/esm/library.mjs +4 -2
- package/dist/lib/esm/object-utils.mjs +3 -1
- package/dist/lib/esm/obsidian/@types/i18next.d.mts +3 -3
- package/dist/lib/esm/obsidian/app.mjs +3 -1
- package/dist/lib/esm/obsidian/async-with-notice.mjs +6 -4
- package/dist/lib/esm/obsidian/attachment-path.mjs +3 -1
- package/dist/lib/esm/obsidian/backlink.mjs +3 -1
- package/dist/lib/esm/obsidian/callout.mjs +3 -1
- package/dist/lib/esm/obsidian/code-block-markdown-information.mjs +2 -0
- package/dist/lib/esm/obsidian/command-handlers/abstract-file-command-handler.d.mts +178 -0
- package/dist/lib/esm/obsidian/command-handlers/abstract-file-command-handler.mjs +247 -0
- package/dist/lib/esm/obsidian/command-handlers/app-active-file-provider.d.mts +25 -0
- package/dist/lib/esm/obsidian/command-handlers/app-active-file-provider.mjs +46 -0
- package/dist/lib/esm/obsidian/command-handlers/app-menu-event-registrar.d.mts +41 -0
- package/dist/lib/esm/obsidian/command-handlers/app-menu-event-registrar.mjs +65 -0
- package/dist/lib/esm/obsidian/command-handlers/command-handler-component.d.mts +26 -0
- package/dist/lib/esm/obsidian/command-handlers/command-handler-component.mjs +56 -0
- package/dist/lib/esm/obsidian/command-handlers/command-handler.d.mts +143 -0
- package/dist/lib/esm/obsidian/command-handlers/command-handler.mjs +66 -0
- package/dist/lib/esm/obsidian/command-handlers/editor-command-handler.d.mts +114 -0
- package/dist/lib/esm/obsidian/command-handlers/editor-command-handler.mjs +161 -0
- package/dist/lib/esm/obsidian/command-handlers/file-command-handler.d.mts +112 -0
- package/dist/lib/esm/obsidian/command-handlers/file-command-handler.mjs +157 -0
- package/dist/lib/esm/obsidian/command-handlers/folder-command-handler.d.mts +112 -0
- package/dist/lib/esm/obsidian/command-handlers/folder-command-handler.mjs +157 -0
- package/dist/lib/esm/obsidian/command-handlers/global-command-handler.d.mts +38 -0
- package/dist/lib/esm/obsidian/command-handlers/global-command-handler.mjs +69 -0
- package/dist/lib/esm/obsidian/command-handlers/index.d.mts +9 -0
- package/dist/lib/esm/obsidian/command-handlers/index.mjs +44 -0
- package/dist/lib/esm/obsidian/components/all-windows-event-handler.mjs +4 -2
- package/dist/lib/esm/obsidian/components/async-component.d.mts +28 -0
- package/dist/lib/esm/obsidian/components/async-component.mjs +56 -0
- package/dist/lib/esm/obsidian/components/async-events-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/index.d.mts +1 -0
- package/dist/lib/esm/obsidian/components/index.mjs +5 -1
- package/dist/lib/esm/obsidian/components/setting-components/checkbox-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/code-highlighter-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/date-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/date-time-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/email-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/file-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/index.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/month-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/multiple-dropdown-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/multiple-email-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/multiple-file-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/multiple-text-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/number-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/password-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/setting-component-wrapper.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/telephone-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/text-based-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/time-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/tri-state-checkbox-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/typed-dropdown-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/typed-multiple-dropdown-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/typed-range-text-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/typed-text-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/url-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/setting-components/validator-component.mjs +5 -3
- package/dist/lib/esm/obsidian/components/setting-components/value-component-with-change-tracking.mjs +2 -0
- package/dist/lib/esm/obsidian/components/setting-components/week-component.mjs +3 -1
- package/dist/lib/esm/obsidian/constructors/getDomEventsHandlersConstructor.mjs +3 -1
- package/dist/lib/esm/obsidian/constructors/index.mjs +3 -1
- package/dist/lib/esm/obsidian/dataview-link.mjs +3 -1
- package/dist/lib/esm/obsidian/dataview.mjs +4 -2
- package/dist/lib/esm/obsidian/editor.mjs +3 -1
- package/dist/lib/esm/obsidian/file-change.mjs +3 -1
- package/dist/lib/esm/obsidian/file-manager.mjs +3 -1
- package/dist/lib/esm/obsidian/file-system.mjs +3 -1
- package/dist/lib/esm/obsidian/frontmatter-link-cache-with-offsets.mjs +3 -1
- package/dist/lib/esm/obsidian/frontmatter.mjs +3 -1
- package/dist/lib/esm/obsidian/i18n/custom-type-options.d.mts +37 -0
- package/dist/lib/esm/obsidian/i18n/custom-type-options.mjs +25 -0
- package/dist/lib/esm/obsidian/i18n/default-translations.d.mts +14 -0
- package/dist/lib/esm/obsidian/i18n/default-translations.mjs +25 -0
- package/dist/lib/esm/obsidian/i18n/i18n.d.mts +2 -13
- package/dist/lib/esm/obsidian/i18n/i18n.mjs +3 -1
- package/dist/lib/esm/obsidian/i18n/index.d.mts +2 -2
- package/dist/lib/esm/obsidian/i18n/index.mjs +7 -5
- package/dist/lib/esm/obsidian/i18n/locales/en.mjs +3 -1
- package/dist/lib/esm/obsidian/i18n/locales/index.mjs +3 -1
- package/dist/lib/esm/obsidian/i18n/locales/translations-map.d.mts +1 -2
- package/dist/lib/esm/obsidian/i18n/locales/translations-map.mjs +3 -1
- package/dist/lib/esm/obsidian/index.d.mts +1 -1
- package/dist/lib/esm/obsidian/index.mjs +5 -3
- package/dist/lib/esm/obsidian/is-in-obsidian.mjs +3 -1
- package/dist/lib/esm/obsidian/link.mjs +3 -1
- package/dist/lib/esm/obsidian/logger.mjs +3 -1
- package/dist/lib/esm/obsidian/loop.mjs +3 -1
- package/dist/lib/esm/obsidian/markdown-code-block-processor.mjs +3 -1
- package/dist/lib/esm/obsidian/markdown-view.mjs +3 -1
- package/dist/lib/esm/obsidian/markdown.mjs +3 -1
- package/dist/lib/esm/obsidian/metadata-cache.mjs +3 -1
- package/dist/lib/esm/obsidian/modals/alert.mjs +4 -2
- package/dist/lib/esm/obsidian/modals/confirm.mjs +4 -2
- package/dist/lib/esm/obsidian/modals/index.d.mts +1 -1
- package/dist/lib/esm/obsidian/modals/index.mjs +5 -3
- package/dist/lib/esm/obsidian/modals/modal.mjs +54 -0
- package/dist/lib/esm/obsidian/modals/prompt.mjs +4 -2
- package/dist/lib/esm/obsidian/modals/select-item.mjs +4 -2
- package/dist/lib/esm/obsidian/monkey-around.mjs +3 -1
- package/dist/lib/esm/obsidian/obsidian-settings.mjs +3 -1
- package/dist/lib/esm/obsidian/pdf.mjs +6 -4
- package/dist/lib/esm/obsidian/plugin/components/abort-signal-component.d.mts +27 -0
- package/dist/lib/esm/obsidian/plugin/components/abort-signal-component.mjs +54 -0
- package/dist/lib/esm/obsidian/plugin/components/async-error-handler-component.d.mts +29 -0
- package/dist/lib/esm/obsidian/plugin/components/async-error-handler-component.mjs +57 -0
- package/dist/lib/esm/obsidian/plugin/components/console-debug-component.d.mts +29 -0
- package/dist/lib/esm/obsidian/plugin/components/console-debug-component.mjs +52 -0
- package/dist/lib/esm/obsidian/plugin/components/i18n-component.d.mts +23 -0
- package/dist/lib/esm/obsidian/plugin/components/i18n-component.mjs +48 -0
- package/dist/lib/esm/obsidian/plugin/components/index.d.mts +9 -0
- package/dist/lib/esm/obsidian/plugin/components/index.mjs +44 -0
- package/dist/lib/esm/obsidian/plugin/components/lifecycle-events-component.d.mts +59 -0
- package/dist/lib/esm/obsidian/plugin/components/lifecycle-events-component.mjs +102 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-context-component.d.mts +25 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-context-component.mjs +57 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-notice-component.d.mts +25 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-notice-component.mjs +56 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-settings-component.d.mts +296 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-settings-component.mjs +463 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-settings-tab-component.d.mts +28 -0
- package/dist/lib/esm/obsidian/plugin/components/plugin-settings-tab-component.mjs +58 -0
- package/dist/lib/esm/obsidian/plugin/index.d.mts +2 -5
- package/dist/lib/esm/obsidian/plugin/index.mjs +7 -11
- package/dist/lib/esm/obsidian/plugin/obsidian-plugin-repo-paths.mjs +3 -1
- package/dist/lib/esm/obsidian/plugin/path-settings.mjs +3 -1
- package/dist/lib/esm/obsidian/plugin/plugin-context.d.mts +3 -2
- package/dist/lib/esm/obsidian/plugin/plugin-context.mjs +14 -5
- package/dist/lib/esm/obsidian/plugin/plugin-id.mjs +3 -1
- package/dist/lib/esm/obsidian/plugin/{plugin-settings-tab-base.d.mts → plugin-settings-tab.d.mts} +28 -11
- package/dist/lib/esm/obsidian/plugin/plugin-settings-tab.mjs +309 -0
- package/dist/lib/esm/obsidian/plugin/plugin.d.mts +106 -5
- package/dist/lib/esm/obsidian/plugin/plugin.mjs +140 -2
- package/dist/lib/esm/obsidian/queue.mjs +3 -1
- package/dist/lib/esm/obsidian/react/app-context.mjs +3 -1
- package/dist/lib/esm/obsidian/react/index.mjs +3 -1
- package/dist/lib/esm/obsidian/reference.mjs +3 -1
- package/dist/lib/esm/obsidian/rename-delete-handler.mjs +3 -1
- package/dist/lib/esm/obsidian/resource-url.mjs +3 -1
- package/dist/lib/esm/obsidian/setting-ex.mjs +3 -1
- package/dist/lib/esm/obsidian/setting-group-ex.mjs +3 -1
- package/dist/lib/esm/obsidian/validation.mjs +3 -1
- package/dist/lib/esm/obsidian/vault-delete.mjs +3 -1
- package/dist/lib/esm/obsidian/vault.mjs +3 -1
- package/dist/lib/esm/obsidian/workspace.mjs +3 -1
- package/dist/lib/esm/path.mjs +3 -1
- package/dist/lib/esm/reg-exp.mjs +3 -1
- package/dist/lib/esm/script-utils/build.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/change-extension-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/custom-esbuild-options-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/dependency.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/fix-esm-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/fix-source-maps-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/index.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/obsidian-plugin-builder.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/preprocess-plugin.mjs +5 -3
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/rename-css-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/svelte-wrapper-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/esbuild.mjs +3 -1
- package/dist/lib/esm/script-utils/bundlers/index.mjs +3 -1
- package/dist/lib/esm/script-utils/cli-utils.mjs +3 -1
- package/dist/lib/esm/script-utils/code-generator.mjs +3 -1
- package/dist/lib/esm/script-utils/commitlint-config.mjs +3 -1
- package/dist/lib/esm/script-utils/exec.mjs +3 -1
- package/dist/lib/esm/script-utils/formatters/dprint.mjs +3 -1
- package/dist/lib/esm/script-utils/formatters/index.mjs +3 -1
- package/dist/lib/esm/script-utils/fs.mjs +3 -1
- package/dist/lib/esm/script-utils/index.mjs +3 -1
- package/dist/lib/esm/script-utils/json.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/cspell.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/eslint-config.mjs +5 -11
- package/dist/lib/esm/script-utils/linters/eslint-rules/index.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/eslint-rules/no-async-callback-to-unsafe-return.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/eslint-rules/no-used-underscore-variables.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/eslint-rules/obsidian-dev-utils-plugin.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/eslint-rules/rule-tester-helper.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/eslint.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/index.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/markdownlint-cli2-config.mjs +3 -1
- package/dist/lib/esm/script-utils/linters/markdownlint.mjs +6 -2
- package/dist/lib/esm/script-utils/nano-staged-config.mjs +3 -1
- package/dist/lib/esm/script-utils/npm-publish.mjs +3 -1
- package/dist/lib/esm/script-utils/npm-run.mjs +3 -1
- package/dist/lib/esm/script-utils/npm.mjs +3 -1
- package/dist/lib/esm/script-utils/obsidian-dev-utils-repo-paths.mjs +3 -1
- package/dist/lib/esm/script-utils/root.mjs +3 -1
- package/dist/lib/esm/script-utils/test-runners/index.mjs +3 -1
- package/dist/lib/esm/script-utils/test-runners/vitest.mjs +3 -1
- package/dist/lib/esm/script-utils/version.mjs +3 -1
- package/dist/lib/esm/strict-proxy.mjs +3 -1
- package/dist/lib/esm/string.mjs +3 -1
- package/dist/lib/esm/transformers/date-transformer.mjs +3 -1
- package/dist/lib/esm/transformers/duration-transformer.mjs +3 -1
- package/dist/lib/esm/transformers/group-transformer.mjs +3 -1
- package/dist/lib/esm/transformers/index.mjs +3 -1
- package/dist/lib/esm/transformers/map-transformer.mjs +3 -1
- package/dist/lib/esm/transformers/set-transformer.mjs +3 -1
- package/dist/lib/esm/transformers/skip-private-property-transformer.mjs +3 -1
- package/dist/lib/esm/transformers/transformer.mjs +3 -1
- package/dist/lib/esm/transformers/two-way-map-transformer.mjs +3 -1
- package/dist/lib/esm/transformers/typed-transformer.mjs +3 -1
- package/dist/lib/esm/two-way-map.mjs +3 -1
- package/dist/lib/esm/type-guards.mjs +3 -1
- package/dist/lib/esm/type.mjs +3 -1
- package/dist/lib/esm/url.mjs +3 -1
- package/dist/lib/esm/value-provider.mjs +3 -1
- package/obsidian/Components/async-component/package.json +6 -0
- package/obsidian/Modals/modal/package.json +6 -0
- package/obsidian/Plugin/components/abort-signal-component/package.json +6 -0
- package/obsidian/Plugin/components/async-error-handler-component/package.json +6 -0
- package/obsidian/Plugin/components/console-debug-component/package.json +6 -0
- package/obsidian/Plugin/components/i18n-component/package.json +6 -0
- package/obsidian/Plugin/components/index/package.json +6 -0
- package/obsidian/Plugin/components/lifecycle-events-component/package.json +6 -0
- package/obsidian/Plugin/components/package.json +6 -0
- package/obsidian/Plugin/components/plugin-context-component/package.json +6 -0
- package/obsidian/Plugin/components/plugin-notice-component/package.json +6 -0
- package/obsidian/Plugin/components/plugin-settings-component/package.json +6 -0
- package/obsidian/Plugin/components/plugin-settings-tab-component/package.json +6 -0
- package/obsidian/Plugin/{plugin-settings-wrapper → plugin-settings-tab}/package.json +3 -3
- package/obsidian/command-handlers/abstract-file-command-handler/package.json +6 -0
- package/obsidian/command-handlers/app-active-file-provider/package.json +6 -0
- package/obsidian/command-handlers/app-menu-event-registrar/package.json +6 -0
- package/obsidian/command-handlers/command-handler/package.json +6 -0
- package/obsidian/command-handlers/command-handler-component/package.json +6 -0
- package/obsidian/command-handlers/editor-command-handler/package.json +6 -0
- package/obsidian/command-handlers/file-command-handler/package.json +6 -0
- package/obsidian/command-handlers/folder-command-handler/package.json +6 -0
- package/obsidian/command-handlers/global-command-handler/package.json +6 -0
- package/obsidian/command-handlers/index/package.json +6 -0
- package/obsidian/command-handlers/package.json +6 -0
- package/obsidian/i18n/{custom-type-options-base → custom-type-options}/package.json +3 -3
- package/obsidian/i18n/{default-translations-base → default-translations}/package.json +3 -3
- package/package.json +33 -12
- package/dist/lib/cjs/obsidian/commands/abstract-file-command-base.cjs +0 -439
- package/dist/lib/cjs/obsidian/commands/abstract-file-command-base.d.cts +0 -264
- package/dist/lib/cjs/obsidian/commands/command-base.cjs +0 -253
- package/dist/lib/cjs/obsidian/commands/command-base.d.cts +0 -125
- package/dist/lib/cjs/obsidian/commands/editor-command-base.cjs +0 -280
- package/dist/lib/cjs/obsidian/commands/editor-command-base.d.cts +0 -139
- package/dist/lib/cjs/obsidian/commands/file-command-base.cjs +0 -341
- package/dist/lib/cjs/obsidian/commands/file-command-base.d.cts +0 -191
- package/dist/lib/cjs/obsidian/commands/folder-command-base.cjs +0 -333
- package/dist/lib/cjs/obsidian/commands/folder-command-base.d.cts +0 -184
- package/dist/lib/cjs/obsidian/commands/index.d.cts +0 -6
- package/dist/lib/cjs/obsidian/commands/non-editor-command-base.d.cts +0 -34
- package/dist/lib/cjs/obsidian/i18n/custom-type-options-base.d.cts +0 -37
- package/dist/lib/cjs/obsidian/i18n/default-translations-base.d.cts +0 -25
- package/dist/lib/cjs/obsidian/plugin/plugin-base.cjs +0 -407
- package/dist/lib/cjs/obsidian/plugin/plugin-base.d.cts +0 -176
- package/dist/lib/cjs/obsidian/plugin/plugin-settings-manager-base.cjs +0 -484
- package/dist/lib/cjs/obsidian/plugin/plugin-settings-manager-base.d.cts +0 -186
- package/dist/lib/cjs/obsidian/plugin/plugin-settings-tab-base.cjs +0 -399
- package/dist/lib/cjs/obsidian/plugin/plugin-settings-wrapper.d.cts +0 -25
- package/dist/lib/cjs/obsidian/plugin/plugin-types-base.cjs +0 -120
- package/dist/lib/cjs/obsidian/plugin/plugin-types-base.d.cts +0 -87
- package/dist/lib/esm/obsidian/commands/abstract-file-command-base.d.mts +0 -264
- package/dist/lib/esm/obsidian/commands/abstract-file-command-base.mjs +0 -329
- package/dist/lib/esm/obsidian/commands/command-base.d.mts +0 -125
- package/dist/lib/esm/obsidian/commands/command-base.mjs +0 -146
- package/dist/lib/esm/obsidian/commands/editor-command-base.d.mts +0 -139
- package/dist/lib/esm/obsidian/commands/editor-command-base.mjs +0 -176
- package/dist/lib/esm/obsidian/commands/file-command-base.d.mts +0 -191
- package/dist/lib/esm/obsidian/commands/file-command-base.mjs +0 -240
- package/dist/lib/esm/obsidian/commands/folder-command-base.d.mts +0 -184
- package/dist/lib/esm/obsidian/commands/folder-command-base.mjs +0 -232
- package/dist/lib/esm/obsidian/commands/index.d.mts +0 -6
- package/dist/lib/esm/obsidian/commands/index.mjs +0 -36
- package/dist/lib/esm/obsidian/commands/non-editor-command-base.d.mts +0 -34
- package/dist/lib/esm/obsidian/commands/non-editor-command-base.mjs +0 -46
- package/dist/lib/esm/obsidian/i18n/custom-type-options-base.d.mts +0 -37
- package/dist/lib/esm/obsidian/i18n/custom-type-options-base.mjs +0 -23
- package/dist/lib/esm/obsidian/i18n/default-translations-base.d.mts +0 -25
- package/dist/lib/esm/obsidian/i18n/default-translations-base.mjs +0 -23
- package/dist/lib/esm/obsidian/modals/modal-base.mjs +0 -52
- package/dist/lib/esm/obsidian/plugin/plugin-base.d.mts +0 -176
- package/dist/lib/esm/obsidian/plugin/plugin-base.mjs +0 -317
- package/dist/lib/esm/obsidian/plugin/plugin-settings-manager-base.d.mts +0 -186
- package/dist/lib/esm/obsidian/plugin/plugin-settings-manager-base.mjs +0 -385
- package/dist/lib/esm/obsidian/plugin/plugin-settings-tab-base.mjs +0 -302
- package/dist/lib/esm/obsidian/plugin/plugin-settings-wrapper.d.mts +0 -25
- package/dist/lib/esm/obsidian/plugin/plugin-settings-wrapper.mjs +0 -22
- package/dist/lib/esm/obsidian/plugin/plugin-types-base.d.mts +0 -87
- package/dist/lib/esm/obsidian/plugin/plugin-types-base.mjs +0 -22
- package/obsidian/Commands/abstract-file-command-base/package.json +0 -6
- package/obsidian/Commands/command-base/package.json +0 -6
- package/obsidian/Commands/editor-command-base/package.json +0 -6
- package/obsidian/Commands/file-command-base/package.json +0 -6
- package/obsidian/Commands/folder-command-base/package.json +0 -6
- package/obsidian/Commands/index/package.json +0 -6
- package/obsidian/Commands/non-editor-command-base/package.json +0 -6
- package/obsidian/Commands/package.json +0 -6
- package/obsidian/Modals/modal-base/package.json +0 -6
- package/obsidian/Plugin/plugin-base/package.json +0 -6
- package/obsidian/Plugin/plugin-settings-manager-base/package.json +0 -6
- package/obsidian/Plugin/plugin-settings-tab-base/package.json +0 -6
- package/obsidian/Plugin/plugin-types-base/package.json +0 -6
- /package/dist/lib/cjs/obsidian/modals/{modal-base.d.cts → modal.d.cts} +0 -0
- /package/dist/lib/esm/obsidian/modals/{modal-base.d.mts → modal.d.mts} +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
|
|
6
|
+
(function initEsm() {
|
|
7
|
+
// eslint-disable-next-line obsidianmd/prefer-active-doc -- Actively use globalThis.
|
|
8
|
+
if (globalThis.process) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const browserProcess = {
|
|
13
|
+
browser: true,
|
|
14
|
+
cwd() {
|
|
15
|
+
return '/';
|
|
16
|
+
},
|
|
17
|
+
env: {},
|
|
18
|
+
platform: 'android'
|
|
19
|
+
};
|
|
20
|
+
// eslint-disable-next-line obsidianmd/prefer-active-doc -- Actively use globalThis.
|
|
21
|
+
globalThis.process = browserProcess;
|
|
22
|
+
})();
|
|
23
|
+
|
|
24
|
+
import { invokeAsyncSafely } from "../../async.mjs";
|
|
25
|
+
import { CommandHandler } from "./command-handler.mjs";
|
|
26
|
+
class EditorCommandHandler extends CommandHandler {
|
|
27
|
+
/**
|
|
28
|
+
* Gets the item name to use in the editor menu.
|
|
29
|
+
*
|
|
30
|
+
* @returns The item name, or `undefined` to use the command name.
|
|
31
|
+
*/
|
|
32
|
+
get editorMenuItemName() {
|
|
33
|
+
return this._editorMenuItemName;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the section to use in the editor menu.
|
|
37
|
+
*
|
|
38
|
+
* @returns The section name, or `undefined` to use the plugin name.
|
|
39
|
+
*/
|
|
40
|
+
get editorMenuSection() {
|
|
41
|
+
return this._editorMenuSection;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the icon to use in the editor menu submenu.
|
|
45
|
+
*
|
|
46
|
+
* @returns The icon, or `undefined` for no icon.
|
|
47
|
+
*/
|
|
48
|
+
get editorMenuSubmenuIcon() {
|
|
49
|
+
return this._editorMenuSubmenuIcon;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets whether to add the command to a submenu.
|
|
53
|
+
*
|
|
54
|
+
* @returns Whether to add to a submenu.
|
|
55
|
+
*/
|
|
56
|
+
get shouldAddCommandToSubmenu() {
|
|
57
|
+
return this._shouldAddCommandToSubmenu;
|
|
58
|
+
}
|
|
59
|
+
_editorMenuItemName;
|
|
60
|
+
_editorMenuSection;
|
|
61
|
+
_editorMenuSubmenuIcon;
|
|
62
|
+
_shouldAddCommandToSubmenu;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new editor command handler.
|
|
65
|
+
*
|
|
66
|
+
* @param params - The parameters for the editor command handler.
|
|
67
|
+
*/
|
|
68
|
+
constructor(params) {
|
|
69
|
+
super(params);
|
|
70
|
+
this._editorMenuItemName = params.editorMenuItemName;
|
|
71
|
+
this._editorMenuSection = params.editorMenuSection;
|
|
72
|
+
this._editorMenuSubmenuIcon = params.editorMenuSubmenuIcon;
|
|
73
|
+
this._shouldAddCommandToSubmenu = params.shouldAddCommandToSubmenu;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Builds a plain Obsidian {@link Command} object with an `editorCheckCallback`.
|
|
77
|
+
*
|
|
78
|
+
* @returns A new {@link Command} object.
|
|
79
|
+
*/
|
|
80
|
+
buildCommand() {
|
|
81
|
+
return {
|
|
82
|
+
editorCheckCallback: (checking, editor, ctx) => this.editorCheckCallback(checking, editor, ctx),
|
|
83
|
+
icon: this.icon,
|
|
84
|
+
id: this.id,
|
|
85
|
+
name: this.name
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Registers the editor-menu event handler.
|
|
90
|
+
*
|
|
91
|
+
* @param context - The registration context.
|
|
92
|
+
*/
|
|
93
|
+
async onRegistered(context) {
|
|
94
|
+
await super.onRegistered(context);
|
|
95
|
+
context.menuEventRegistrar.registerEditorMenuEventHandler(this.handleEditorMenu.bind(this));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Checks whether the command can execute for the given editor and context.
|
|
99
|
+
*
|
|
100
|
+
* @param _editor - The editor instance.
|
|
101
|
+
* @param _ctx - The markdown file context.
|
|
102
|
+
* @returns Whether the command can execute.
|
|
103
|
+
*/
|
|
104
|
+
canExecuteEditor(_editor, _ctx) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Checks whether the command should appear in the command palette.
|
|
109
|
+
*
|
|
110
|
+
* @returns Whether to add to the command palette.
|
|
111
|
+
*/
|
|
112
|
+
shouldAddToCommandPalette() {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Checks whether the command should appear in the editor context menu.
|
|
117
|
+
*
|
|
118
|
+
* @param _editor - The editor instance.
|
|
119
|
+
* @param _ctx - The markdown file context.
|
|
120
|
+
* @returns Whether to add to the editor menu.
|
|
121
|
+
*/
|
|
122
|
+
shouldAddToEditorMenu(_editor, _ctx) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
editorCheckCallback(checking, editor, ctx) {
|
|
126
|
+
if (!this.shouldAddToCommandPalette()) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
if (!this.canExecuteEditor(editor, ctx)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (!checking) {
|
|
133
|
+
invokeAsyncSafely(() => this.executeEditor(editor, ctx));
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
handleEditorMenu(menu, editor, ctx) {
|
|
138
|
+
if (!this.shouldAddToEditorMenu(editor, ctx)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!this.canExecuteEditor(editor, ctx)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const section = this.editorMenuSection ?? this.pluginName;
|
|
145
|
+
if (this.shouldAddCommandToSubmenu) {
|
|
146
|
+
menu.setSectionSubmenu(section, {
|
|
147
|
+
icon: this.editorMenuSubmenuIcon ?? "",
|
|
148
|
+
title: section
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
menu.addItem((item) => {
|
|
152
|
+
item.setTitle(this.editorMenuItemName ?? this.name).setIcon(this.icon).setSection(section).onClick(() => {
|
|
153
|
+
invokeAsyncSafely(() => this.executeEditor(editor, ctx));
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
EditorCommandHandler
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL2NvbW1hbmQtaGFuZGxlcnMvZWRpdG9yLWNvbW1hbmQtaGFuZGxlci50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIENvbW1hbmQgaGFuZGxlciBmb3IgZWRpdG9yIGNvbW1hbmRzIHdpdGggb3B0aW9uYWwgZWRpdG9yIG1lbnUgaW50ZWdyYXRpb24uXG4gKi9cblxuaW1wb3J0IHR5cGUge1xuICBDb21tYW5kLFxuICBFZGl0b3IsXG4gIEljb25OYW1lLFxuICBNYXJrZG93bkZpbGVJbmZvLFxuICBNZW51XG59IGZyb20gJ29ic2lkaWFuJztcblxuaW1wb3J0IHR5cGUge1xuICBDb21tYW5kSGFuZGxlclBhcmFtcyxcbiAgQ29tbWFuZEhhbmRsZXJSZWdpc3RyYXRpb25Db250ZXh0XG59IGZyb20gJy4vY29tbWFuZC1oYW5kbGVyLnRzJztcblxuaW1wb3J0IHsgaW52b2tlQXN5bmNTYWZlbHkgfSBmcm9tICcuLi8uLi9hc3luYy50cyc7XG5pbXBvcnQgeyBDb21tYW5kSGFuZGxlciB9IGZyb20gJy4vY29tbWFuZC1oYW5kbGVyLnRzJztcblxuLyoqXG4gKi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Y7QUFFQSxVQUFNLFVBQVUsS0FBSyxxQkFBcUIsS0FBSztBQUMvQyxRQUFJLEtBQUssMkJBQTJCO0FBQ2xDLFdBQUssa0JBQWtCLFNBQVM7QUFBQSxRQUM5QixNQUFNLEtBQUsseUJBQXlCO0FBQUEsUUFDcEMsT0FBTztBQUFBLE1BQ1QsQ0FBQztBQUFBLElBQ0g7QUFFQSxTQUFLLFFBQVEsQ0FBQyxTQUFTO0FBQ3JCLFdBQ0csU0FBUyxLQUFLLHNCQUFzQixLQUFLLElBQUksRUFDN0MsUUFBUSxLQUFLLElBQUksRUFDakIsV0FBVyxPQUFPLEVBQ2xCLFFBQVEsTUFBTTtBQUNiLDBCQUFrQixNQUFNLEtBQUssY0FBYyxRQUFRLEdBQUcsQ0FBQztBQUFBLE1BQ3pELENBQUM7QUFBQSxJQUNMLENBQUM7QUFBQSxFQUNIO0FBQ0Y7IiwKICAibmFtZXMiOiBbXQp9Cg==
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* Command handler for file-specific commands (TFile only, not TFolder).
|
|
5
|
+
*/
|
|
6
|
+
import type { TAbstractFile, TFile, WorkspaceLeaf } from 'obsidian';
|
|
7
|
+
import type { AbstractFileCommandHandlerParams } from './abstract-file-command-handler.mjs';
|
|
8
|
+
import { AbstractFileCommandHandler } from './abstract-file-command-handler.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* Command handler for file-specific commands.
|
|
11
|
+
*
|
|
12
|
+
* Filters abstract files to only accept {@link TFile} instances.
|
|
13
|
+
* Subclasses override {@link canExecuteFile} and {@link executeFile}.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class FileCommandHandler extends AbstractFileCommandHandler {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new file command handler.
|
|
18
|
+
*
|
|
19
|
+
* @param params - The parameters for the file command handler.
|
|
20
|
+
*/
|
|
21
|
+
constructor(params: AbstractFileCommandHandlerParams);
|
|
22
|
+
/**
|
|
23
|
+
* Filters to only accept TFile instances, then delegates to {@link canExecuteFile}.
|
|
24
|
+
*
|
|
25
|
+
* @param abstractFile - The file or folder.
|
|
26
|
+
* @returns Whether the command can execute.
|
|
27
|
+
*/
|
|
28
|
+
protected canExecuteAbstractFile(abstractFile: TAbstractFile): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Filters to only accept TFile arrays, then delegates to {@link canExecuteFiles}.
|
|
31
|
+
*
|
|
32
|
+
* @param abstractFiles - The files or folders.
|
|
33
|
+
* @returns Whether the command can execute.
|
|
34
|
+
*/
|
|
35
|
+
protected canExecuteAbstractFiles(abstractFiles: TAbstractFile[]): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Checks whether the command can execute for a single file.
|
|
38
|
+
*
|
|
39
|
+
* @param _file - The file.
|
|
40
|
+
* @returns Whether the command can execute.
|
|
41
|
+
*/
|
|
42
|
+
protected canExecuteFile(_file: TFile): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Checks whether the command can execute for multiple files.
|
|
45
|
+
* Default implementation checks each file individually.
|
|
46
|
+
*
|
|
47
|
+
* @param files - The files.
|
|
48
|
+
* @returns Whether the command can execute.
|
|
49
|
+
*/
|
|
50
|
+
protected canExecuteFiles(files: TFile[]): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Delegates to {@link executeFile}.
|
|
53
|
+
*
|
|
54
|
+
* @param abstractFile - The file or folder.
|
|
55
|
+
*/
|
|
56
|
+
protected executeAbstractFile(abstractFile: TAbstractFile): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Delegates to {@link executeFiles}.
|
|
59
|
+
*
|
|
60
|
+
* @param abstractFiles - The files or folders.
|
|
61
|
+
*/
|
|
62
|
+
protected executeAbstractFiles(abstractFiles: TAbstractFile[]): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Executes the command for a single file.
|
|
65
|
+
*
|
|
66
|
+
* @param file - The file.
|
|
67
|
+
*/
|
|
68
|
+
protected abstract executeFile(file: TFile): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Executes the command for multiple files.
|
|
71
|
+
* Default implementation executes sequentially.
|
|
72
|
+
*
|
|
73
|
+
* @param files - The files.
|
|
74
|
+
*/
|
|
75
|
+
protected executeFiles(files: TFile[]): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Filters to only show menu for TFile instances.
|
|
78
|
+
*
|
|
79
|
+
* @param abstractFile - The file or folder.
|
|
80
|
+
* @param source - The source of the event.
|
|
81
|
+
* @param leaf - The workspace leaf, if available.
|
|
82
|
+
* @returns Whether to add to the file menu.
|
|
83
|
+
*/
|
|
84
|
+
protected shouldAddToAbstractFileMenu(abstractFile: TAbstractFile, source: string, leaf?: WorkspaceLeaf): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Filters to only show menu for TFile arrays.
|
|
87
|
+
*
|
|
88
|
+
* @param abstractFiles - The files or folders.
|
|
89
|
+
* @param source - The source of the event.
|
|
90
|
+
* @param leaf - The workspace leaf, if available.
|
|
91
|
+
* @returns Whether to add to the files menu.
|
|
92
|
+
*/
|
|
93
|
+
protected shouldAddToAbstractFilesMenu(abstractFiles: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Checks whether the command should appear in the single-file context menu.
|
|
96
|
+
*
|
|
97
|
+
* @param _file - The file.
|
|
98
|
+
* @param _source - The source of the event.
|
|
99
|
+
* @param _leaf - The workspace leaf, if available.
|
|
100
|
+
* @returns Whether to add to the file menu.
|
|
101
|
+
*/
|
|
102
|
+
protected shouldAddToFileMenu(_file: TFile, _source: string, _leaf?: WorkspaceLeaf): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Checks whether the command should appear in the multi-file context menu.
|
|
105
|
+
*
|
|
106
|
+
* @param _files - The files.
|
|
107
|
+
* @param _source - The source of the event.
|
|
108
|
+
* @param _leaf - The workspace leaf, if available.
|
|
109
|
+
* @returns Whether to add to the files menu.
|
|
110
|
+
*/
|
|
111
|
+
protected shouldAddToFilesMenu(_files: TFile[], _source: string, _leaf?: WorkspaceLeaf): boolean;
|
|
112
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
|
|
6
|
+
(function initEsm() {
|
|
7
|
+
// eslint-disable-next-line obsidianmd/prefer-active-doc -- Actively use globalThis.
|
|
8
|
+
if (globalThis.process) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const browserProcess = {
|
|
13
|
+
browser: true,
|
|
14
|
+
cwd() {
|
|
15
|
+
return '/';
|
|
16
|
+
},
|
|
17
|
+
env: {},
|
|
18
|
+
platform: 'android'
|
|
19
|
+
};
|
|
20
|
+
// eslint-disable-next-line obsidianmd/prefer-active-doc -- Actively use globalThis.
|
|
21
|
+
globalThis.process = browserProcess;
|
|
22
|
+
})();
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
asArrayOfFiles,
|
|
26
|
+
asFile,
|
|
27
|
+
isFile
|
|
28
|
+
} from "../file-system.mjs";
|
|
29
|
+
import { AbstractFileCommandHandler } from "./abstract-file-command-handler.mjs";
|
|
30
|
+
class FileCommandHandler extends AbstractFileCommandHandler {
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new file command handler.
|
|
33
|
+
*
|
|
34
|
+
* @param params - The parameters for the file command handler.
|
|
35
|
+
*/
|
|
36
|
+
constructor(params) {
|
|
37
|
+
super(params);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Filters to only accept TFile instances, then delegates to {@link canExecuteFile}.
|
|
41
|
+
*
|
|
42
|
+
* @param abstractFile - The file or folder.
|
|
43
|
+
* @returns Whether the command can execute.
|
|
44
|
+
*/
|
|
45
|
+
canExecuteAbstractFile(abstractFile) {
|
|
46
|
+
return isFile(abstractFile) && this.canExecuteFile(abstractFile);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Filters to only accept TFile arrays, then delegates to {@link canExecuteFiles}.
|
|
50
|
+
*
|
|
51
|
+
* @param abstractFiles - The files or folders.
|
|
52
|
+
* @returns Whether the command can execute.
|
|
53
|
+
*/
|
|
54
|
+
canExecuteAbstractFiles(abstractFiles) {
|
|
55
|
+
return abstractFiles.every((f) => isFile(f)) && this.canExecuteFiles(asArrayOfFiles(abstractFiles));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Checks whether the command can execute for a single file.
|
|
59
|
+
*
|
|
60
|
+
* @param _file - The file.
|
|
61
|
+
* @returns Whether the command can execute.
|
|
62
|
+
*/
|
|
63
|
+
canExecuteFile(_file) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether the command can execute for multiple files.
|
|
68
|
+
* Default implementation checks each file individually.
|
|
69
|
+
*
|
|
70
|
+
* @param files - The files.
|
|
71
|
+
* @returns Whether the command can execute.
|
|
72
|
+
*/
|
|
73
|
+
canExecuteFiles(files) {
|
|
74
|
+
return files.length > 0 && files.every((f) => this.canExecuteFile(f));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Delegates to {@link executeFile}.
|
|
78
|
+
*
|
|
79
|
+
* @param abstractFile - The file or folder.
|
|
80
|
+
*/
|
|
81
|
+
async executeAbstractFile(abstractFile) {
|
|
82
|
+
await this.executeFile(asFile(abstractFile));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Delegates to {@link executeFiles}.
|
|
86
|
+
*
|
|
87
|
+
* @param abstractFiles - The files or folders.
|
|
88
|
+
*/
|
|
89
|
+
async executeAbstractFiles(abstractFiles) {
|
|
90
|
+
await this.executeFiles(asArrayOfFiles(abstractFiles));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Executes the command for multiple files.
|
|
94
|
+
* Default implementation executes sequentially.
|
|
95
|
+
*
|
|
96
|
+
* @param files - The files.
|
|
97
|
+
*/
|
|
98
|
+
async executeFiles(files) {
|
|
99
|
+
for (const file of files) {
|
|
100
|
+
await this.executeFile(file);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Filters to only show menu for TFile instances.
|
|
105
|
+
*
|
|
106
|
+
* @param abstractFile - The file or folder.
|
|
107
|
+
* @param source - The source of the event.
|
|
108
|
+
* @param leaf - The workspace leaf, if available.
|
|
109
|
+
* @returns Whether to add to the file menu.
|
|
110
|
+
*/
|
|
111
|
+
shouldAddToAbstractFileMenu(abstractFile, source, leaf) {
|
|
112
|
+
if (!isFile(abstractFile)) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return this.shouldAddToFileMenu(abstractFile, source, leaf);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Filters to only show menu for TFile arrays.
|
|
119
|
+
*
|
|
120
|
+
* @param abstractFiles - The files or folders.
|
|
121
|
+
* @param source - The source of the event.
|
|
122
|
+
* @param leaf - The workspace leaf, if available.
|
|
123
|
+
* @returns Whether to add to the files menu.
|
|
124
|
+
*/
|
|
125
|
+
shouldAddToAbstractFilesMenu(abstractFiles, source, leaf) {
|
|
126
|
+
if (!abstractFiles.every((f) => isFile(f))) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return this.shouldAddToFilesMenu(asArrayOfFiles(abstractFiles), source, leaf);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Checks whether the command should appear in the single-file context menu.
|
|
133
|
+
*
|
|
134
|
+
* @param _file - The file.
|
|
135
|
+
* @param _source - The source of the event.
|
|
136
|
+
* @param _leaf - The workspace leaf, if available.
|
|
137
|
+
* @returns Whether to add to the file menu.
|
|
138
|
+
*/
|
|
139
|
+
shouldAddToFileMenu(_file, _source, _leaf) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Checks whether the command should appear in the multi-file context menu.
|
|
144
|
+
*
|
|
145
|
+
* @param _files - The files.
|
|
146
|
+
* @param _source - The source of the event.
|
|
147
|
+
* @param _leaf - The workspace leaf, if available.
|
|
148
|
+
* @returns Whether to add to the files menu.
|
|
149
|
+
*/
|
|
150
|
+
shouldAddToFilesMenu(_files, _source, _leaf) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
FileCommandHandler
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL2NvbW1hbmQtaGFuZGxlcnMvZmlsZS1jb21tYW5kLWhhbmRsZXIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGZpbGVcbiAqXG4gKiBDb21tYW5kIGhhbmRsZXIgZm9yIGZpbGUtc3BlY2lmaWMgY29tbWFuZHMgKFRGaWxlIG9ubHksIG5vdCBURm9sZGVyKS5cbiAqL1xuXG5pbXBvcnQgdHlwZSB7XG4gIFRBYnN0cmFjdEZpbGUsXG4gIFRGaWxlLFxuICBXb3Jrc3BhY2VMZWFmXG59IGZyb20gJ29ic2lkaWFuJztcblxuaW1wb3J0IHR5cGUgeyBBYnN0cmFjdEZpbGVDb21tYW5kSGFuZGxlclBhcmFtcyB9IGZyb20gJy4vYWJzdHJhY3QtZmlsZS1jb21tYW5kLWhhbmRsZXIudHMnO1xuXG5pbXBvcnQge1xuICBhc0FycmF5T2ZGaWxlcyxcbiAgYXNGaWxlLFxuICBpc0ZpbGVcbn0gZnJvbSAnLi4vZmlsZS1zeXN0ZW0udHMnO1xuaW1wb3J0IHsgQWJzdHJhY3RGaWxlQ29tbWFuZEhhbmRsZXIgfSBmcm9tICcuL2Fic3RyYWN0LWZpbGUtY29tbWFuZC1oYW5kbGVyLnRzJztcblxuLyo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OyIsCiAgIm5hbWVzIjogW10KfQo=
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* Command handler for folder-specific commands (TFolder only, not TFile).
|
|
5
|
+
*/
|
|
6
|
+
import type { TAbstractFile, TFolder, WorkspaceLeaf } from 'obsidian';
|
|
7
|
+
import type { AbstractFileCommandHandlerParams } from './abstract-file-command-handler.mjs';
|
|
8
|
+
import { AbstractFileCommandHandler } from './abstract-file-command-handler.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* Command handler for folder-specific commands.
|
|
11
|
+
*
|
|
12
|
+
* Filters abstract files to only accept {@link TFolder} instances.
|
|
13
|
+
* Subclasses override {@link canExecuteFolder} and {@link executeFolder}.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class FolderCommandHandler extends AbstractFileCommandHandler {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new folder command handler.
|
|
18
|
+
*
|
|
19
|
+
* @param params - The parameters for the folder command handler.
|
|
20
|
+
*/
|
|
21
|
+
constructor(params: AbstractFileCommandHandlerParams);
|
|
22
|
+
/**
|
|
23
|
+
* Filters to only accept TFolder instances, then delegates to {@link canExecuteFolder}.
|
|
24
|
+
*
|
|
25
|
+
* @param abstractFile - The file or folder.
|
|
26
|
+
* @returns Whether the command can execute.
|
|
27
|
+
*/
|
|
28
|
+
protected canExecuteAbstractFile(abstractFile: TAbstractFile): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Filters to only accept TFolder arrays, then delegates to {@link canExecuteFolders}.
|
|
31
|
+
*
|
|
32
|
+
* @param abstractFiles - The files or folders.
|
|
33
|
+
* @returns Whether the command can execute.
|
|
34
|
+
*/
|
|
35
|
+
protected canExecuteAbstractFiles(abstractFiles: TAbstractFile[]): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Checks whether the command can execute for a single folder.
|
|
38
|
+
*
|
|
39
|
+
* @param _folder - The folder.
|
|
40
|
+
* @returns Whether the command can execute.
|
|
41
|
+
*/
|
|
42
|
+
protected canExecuteFolder(_folder: TFolder): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Checks whether the command can execute for multiple folders.
|
|
45
|
+
* Default implementation checks each folder individually.
|
|
46
|
+
*
|
|
47
|
+
* @param folders - The folders.
|
|
48
|
+
* @returns Whether the command can execute.
|
|
49
|
+
*/
|
|
50
|
+
protected canExecuteFolders(folders: TFolder[]): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Delegates to {@link executeFolder}.
|
|
53
|
+
*
|
|
54
|
+
* @param abstractFile - The file or folder.
|
|
55
|
+
*/
|
|
56
|
+
protected executeAbstractFile(abstractFile: TAbstractFile): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Delegates to {@link executeFolders}.
|
|
59
|
+
*
|
|
60
|
+
* @param abstractFiles - The files or folders.
|
|
61
|
+
*/
|
|
62
|
+
protected executeAbstractFiles(abstractFiles: TAbstractFile[]): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Executes the command for a single folder.
|
|
65
|
+
*
|
|
66
|
+
* @param folder - The folder.
|
|
67
|
+
*/
|
|
68
|
+
protected abstract executeFolder(folder: TFolder): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Executes the command for multiple folders.
|
|
71
|
+
* Default implementation executes sequentially.
|
|
72
|
+
*
|
|
73
|
+
* @param folders - The folders.
|
|
74
|
+
*/
|
|
75
|
+
protected executeFolders(folders: TFolder[]): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Filters to only show menu for TFolder instances.
|
|
78
|
+
*
|
|
79
|
+
* @param abstractFile - The file or folder.
|
|
80
|
+
* @param source - The source of the event.
|
|
81
|
+
* @param leaf - The workspace leaf, if available.
|
|
82
|
+
* @returns Whether to add to the file menu.
|
|
83
|
+
*/
|
|
84
|
+
protected shouldAddToAbstractFileMenu(abstractFile: TAbstractFile, source: string, leaf?: WorkspaceLeaf): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Filters to only show menu for TFolder arrays.
|
|
87
|
+
*
|
|
88
|
+
* @param abstractFiles - The files or folders.
|
|
89
|
+
* @param source - The source of the event.
|
|
90
|
+
* @param leaf - The workspace leaf, if available.
|
|
91
|
+
* @returns Whether to add to the files menu.
|
|
92
|
+
*/
|
|
93
|
+
protected shouldAddToAbstractFilesMenu(abstractFiles: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Checks whether the command should appear in the single-folder context menu.
|
|
96
|
+
*
|
|
97
|
+
* @param _folder - The folder.
|
|
98
|
+
* @param _source - The source of the event.
|
|
99
|
+
* @param _leaf - The workspace leaf, if available.
|
|
100
|
+
* @returns Whether to add to the folder menu.
|
|
101
|
+
*/
|
|
102
|
+
protected shouldAddToFolderMenu(_folder: TFolder, _source: string, _leaf?: WorkspaceLeaf): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Checks whether the command should appear in the multi-folder context menu.
|
|
105
|
+
*
|
|
106
|
+
* @param _folders - The folders.
|
|
107
|
+
* @param _source - The source of the event.
|
|
108
|
+
* @param _leaf - The workspace leaf, if available.
|
|
109
|
+
* @returns Whether to add to the folders menu.
|
|
110
|
+
*/
|
|
111
|
+
protected shouldAddToFoldersMenu(_folders: TFolder[], _source: string, _leaf?: WorkspaceLeaf): boolean;
|
|
112
|
+
}
|