@lapis-notes/api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/LICENSE.md +4 -0
- package/README.md +43 -0
- package/dist/__tests__/data-adapter-conformance.js +205 -0
- package/dist/__tests__/lapis-runtime-manifest.js +32 -0
- package/dist/__tests__/svelte-internal-client.d.ts +3 -0
- package/dist/agent-result-views.d.ts +52 -0
- package/dist/agent-result-views.js +89 -0
- package/dist/agent-skills.d.ts +99 -0
- package/dist/agent-skills.js +182 -0
- package/dist/agent-tools.d.ts +92 -0
- package/dist/agent-tools.js +139 -0
- package/dist/app-database-host.d.ts +4 -0
- package/dist/app-database-host.js +4 -0
- package/dist/app-shell-plugin-persistence.d.ts +15 -0
- package/dist/app-shell-plugin-persistence.js +34 -0
- package/dist/app-url.d.ts +54 -0
- package/dist/app-url.js +269 -0
- package/dist/application-compatibility.d.ts +31 -0
- package/dist/application-compatibility.js +64 -0
- package/dist/application-state.svelte.d.ts +14 -0
- package/dist/application-state.svelte.js +30 -0
- package/dist/assets/lapis-logo.svg +471 -0
- package/dist/bases.d.ts +281 -0
- package/dist/bases.js +475 -0
- package/dist/cache.svelte.d.ts +569 -0
- package/dist/cache.svelte.js +1433 -0
- package/dist/command.svelte.d.ts +337 -0
- package/dist/command.svelte.js +571 -0
- package/dist/compat.d.ts +29 -0
- package/dist/compat.js +30 -0
- package/dist/components/configuration/configuration.css +199 -0
- package/dist/components/configuration/date-setting.svelte +71 -0
- package/dist/components/configuration/date-setting.svelte.d.ts +8 -0
- package/dist/components/configuration/list-setting.svelte +128 -0
- package/dist/components/configuration/list-setting.svelte.d.ts +13 -0
- package/dist/components/configuration/object-array-row-grip.svelte +78 -0
- package/dist/components/configuration/object-array-row-grip.svelte.d.ts +9 -0
- package/dist/components/configuration/object-array-row.svelte +163 -0
- package/dist/components/configuration/object-array-row.svelte.d.ts +19 -0
- package/dist/components/configuration/object-array-setting.svelte +196 -0
- package/dist/components/configuration/object-array-setting.svelte.d.ts +15 -0
- package/dist/components/configuration/object-array-table-dnd.d.ts +8 -0
- package/dist/components/configuration/object-array-table-dnd.js +10 -0
- package/dist/components/configuration/object-array-utils.d.ts +11 -0
- package/dist/components/configuration/object-array-utils.js +103 -0
- package/dist/components/configuration/object-grid-setting.svelte +79 -0
- package/dist/components/configuration/object-grid-setting.svelte.d.ts +10 -0
- package/dist/components/configuration/object-map-row.svelte +147 -0
- package/dist/components/configuration/object-map-row.svelte.d.ts +15 -0
- package/dist/components/configuration/object-map-setting.svelte +137 -0
- package/dist/components/configuration/object-map-setting.svelte.d.ts +14 -0
- package/dist/components/configuration/object-map-types.d.ts +5 -0
- package/dist/components/configuration/object-map-types.js +1 -0
- package/dist/components/configuration/options-combobox-setting.svelte +129 -0
- package/dist/components/configuration/options-combobox-setting.svelte.d.ts +12 -0
- package/dist/components/copy-button/button.svelte +93 -0
- package/dist/components/copy-button/button.svelte.d.ts +13 -0
- package/dist/components/copy-button/index.d.ts +2 -0
- package/dist/components/copy-button/index.js +2 -0
- package/dist/components/editor/editor.css +565 -0
- package/dist/components/editor/editor.d.ts +33 -0
- package/dist/components/editor/editor.js +132 -0
- package/dist/components/editor/editor.svelte +176 -0
- package/dist/components/editor/editor.svelte.d.ts +15 -0
- package/dist/components/editor/embedded-editor-surface.d.ts +12 -0
- package/dist/components/editor/embedded-editor-surface.js +22 -0
- package/dist/components/editor/embedded-editor-surface.svelte +115 -0
- package/dist/components/editor/embedded-editor-surface.svelte.d.ts +17 -0
- package/dist/components/editor/extensions/autocomplete/index.d.ts +2 -0
- package/dist/components/editor/extensions/autocomplete/index.js +2 -0
- package/dist/components/editor/extensions/autocomplete/lapis-code-mirror-autocomplete.d.ts +16 -0
- package/dist/components/editor/extensions/autocomplete/lapis-code-mirror-autocomplete.js +34 -0
- package/dist/components/editor/extensions/autocomplete/vault-completion-sources.d.ts +27 -0
- package/dist/components/editor/extensions/autocomplete/vault-completion-sources.js +55 -0
- package/dist/components/editor/extensions/class-highlighter/index.d.ts +1 -0
- package/dist/components/editor/extensions/class-highlighter/index.js +47 -0
- package/dist/components/editor/extensions/fold-gutter/index.d.ts +8 -0
- package/dist/components/editor/extensions/fold-gutter/index.js +40 -0
- package/dist/components/editor/extensions/gutter-line-style-sync/index.d.ts +2 -0
- package/dist/components/editor/extensions/gutter-line-style-sync/index.js +118 -0
- package/dist/components/editor/extensions/lint/index.d.ts +4 -0
- package/dist/components/editor/extensions/lint/index.js +4 -0
- package/dist/components/editor/extensions/lint/lapis-code-mirror-lint.d.ts +26 -0
- package/dist/components/editor/extensions/lint/lapis-code-mirror-lint.js +101 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic-helpers.d.ts +8 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic-helpers.js +7 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic.d.ts +20 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic.js +47 -0
- package/dist/components/editor/extensions/lint/lapis-lint-hover-tooltip.d.ts +9 -0
- package/dist/components/editor/extensions/lint/lapis-lint-hover-tooltip.js +373 -0
- package/dist/components/editor/extensions/lint/lapis-lint-inline-widget.d.ts +31 -0
- package/dist/components/editor/extensions/lint/lapis-lint-inline-widget.js +191 -0
- package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte +176 -0
- package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte.d.ts +15 -0
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.d.ts +11 -0
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.js +21 -0
- package/dist/components/editor/extensions/lint/mount-lint-tooltip.d.ts +16 -0
- package/dist/components/editor/extensions/lint/mount-lint-tooltip.js +60 -0
- package/dist/components/editor/extensions/search/dom.d.ts +2 -0
- package/dist/components/editor/extensions/search/dom.js +6 -0
- package/dist/components/editor/extensions/search/index.d.ts +35 -0
- package/dist/components/editor/extensions/search/index.js +44 -0
- package/dist/components/editor/extensions/search/search.svelte +335 -0
- package/dist/components/editor/extensions/search/search.svelte.d.ts +8 -0
- package/dist/components/editor/index.d.ts +9 -0
- package/dist/components/editor/index.js +9 -0
- package/dist/components/editor/language-service/dom.d.ts +1 -0
- package/dist/components/editor/language-service/dom.js +6 -0
- package/dist/components/editor/language-service/index.d.ts +28 -0
- package/dist/components/editor/language-service/index.js +342 -0
- package/dist/components/empty-view/empty-view.css +39 -0
- package/dist/components/empty-view/empty-view.svelte +26 -0
- package/dist/components/empty-view/empty-view.svelte.d.ts +9 -0
- package/dist/components/empty-view/index.d.ts +2 -0
- package/dist/components/empty-view/index.js +2 -0
- package/dist/components/icon/icon-list.css +74 -0
- package/dist/components/icon/icon-list.svelte +213 -0
- package/dist/components/icon/icon-list.svelte.d.ts +11 -0
- package/dist/components/icon/icon.svelte +15 -0
- package/dist/components/icon/icon.svelte.d.ts +7 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/icon/index.js +3 -0
- package/dist/components/menu/context-menu.svelte +89 -0
- package/dist/components/menu/context-menu.svelte.d.ts +11 -0
- package/dist/components/menu/drawer-menu.svelte +83 -0
- package/dist/components/menu/drawer-menu.svelte.d.ts +8 -0
- package/dist/components/menu/dropdown-menu.svelte +89 -0
- package/dist/components/menu/dropdown-menu.svelte.d.ts +11 -0
- package/dist/components/menu/index.d.ts +6 -0
- package/dist/components/menu/index.js +6 -0
- package/dist/components/menu/menu.css +139 -0
- package/dist/components/menu/menu.svelte +37 -0
- package/dist/components/menu/menu.svelte.d.ts +11 -0
- package/dist/components/menu/mobile-menu-query.svelte.d.ts +3 -0
- package/dist/components/menu/mobile-menu-query.svelte.js +21 -0
- package/dist/components/menu/popover-menu.svelte +90 -0
- package/dist/components/menu/popover-menu.svelte.d.ts +10 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/select/select.svelte +72 -0
- package/dist/components/select/select.svelte.d.ts +25 -0
- package/dist/configuration-option-source-providers.d.ts +17 -0
- package/dist/configuration-option-source-providers.js +59 -0
- package/dist/configuration-option-source-registry.d.ts +59 -0
- package/dist/configuration-option-source-registry.js +123 -0
- package/dist/configuration.svelte.d.ts +258 -0
- package/dist/configuration.svelte.js +887 -0
- package/dist/context-keys.svelte.d.ts +42 -0
- package/dist/context-keys.svelte.js +278 -0
- package/dist/context.svelte.d.ts +247 -0
- package/dist/context.svelte.js +540 -0
- package/dist/daily-document-provider.d.ts +38 -0
- package/dist/daily-document-provider.js +176 -0
- package/dist/design-core-button-types.d.ts +7 -0
- package/dist/design-core-button-types.js +1 -0
- package/dist/diagnostics.d.ts +93 -0
- package/dist/diagnostics.js +84 -0
- package/dist/dialog-portal.d.ts +3 -0
- package/dist/dialog-portal.js +3 -0
- package/dist/docs-api.d.ts +44 -0
- package/dist/docs-api.js +29 -0
- package/dist/editor-view-registry.d.ts +35 -0
- package/dist/editor-view-registry.js +112 -0
- package/dist/editor.svelte.d.ts +126 -0
- package/dist/editor.svelte.js +454 -0
- package/dist/embed-registry.d.ts +15 -0
- package/dist/embed-registry.js +16 -0
- package/dist/enhance.d.ts +111 -0
- package/dist/enhance.js +309 -0
- package/dist/events.d.ts +28 -0
- package/dist/events.js +49 -0
- package/dist/file-manager.d.ts +90 -0
- package/dist/file-manager.js +289 -0
- package/dist/file-tools/app-tools.d.ts +3 -0
- package/dist/file-tools/app-tools.js +242 -0
- package/dist/file-tools/index.d.ts +3 -0
- package/dist/file-tools/index.js +3 -0
- package/dist/file-tools/paths.d.ts +14 -0
- package/dist/file-tools/paths.js +33 -0
- package/dist/file-tools/vault-operations.d.ts +3 -0
- package/dist/file-tools/vault-operations.js +60 -0
- package/dist/generated/plugin-host-modules.schema.generated.d.ts +371 -0
- package/dist/generated/plugin-host-modules.schema.generated.js +374 -0
- package/dist/glob.d.ts +15 -0
- package/dist/glob.js +68 -0
- package/dist/history.svelte.d.ts +24 -0
- package/dist/history.svelte.js +74 -0
- package/dist/hooks/createVirtualizer.svelte.d.ts +7 -0
- package/dist/hooks/createVirtualizer.svelte.js +70 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/is-mobile.svelte.d.ts +5 -0
- package/dist/hooks/is-mobile.svelte.js +23 -0
- package/dist/hooks/mountComponent.svelte.d.ts +7 -0
- package/dist/hooks/mountComponent.svelte.js +16 -0
- package/dist/hooks/use-text-highlight.d.ts +17 -0
- package/dist/hooks/use-text-highlight.js +82 -0
- package/dist/hooks/useBoundingRect.svelte.d.ts +11 -0
- package/dist/hooks/useBoundingRect.svelte.js +46 -0
- package/dist/icons/index.d.ts +57 -0
- package/dist/icons/index.js +288 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +87 -0
- package/dist/language-service/index.d.ts +9 -0
- package/dist/language-service/index.js +7 -0
- package/dist/language-service/manager.d.ts +47 -0
- package/dist/language-service/manager.js +404 -0
- package/dist/language-service/types.d.ts +92 -0
- package/dist/language-service/types.js +1 -0
- package/dist/language-service/virtual-document.d.ts +11 -0
- package/dist/language-service/virtual-document.js +45 -0
- package/dist/language-service/worker-protocol.d.ts +63 -0
- package/dist/language-service/worker-protocol.js +1 -0
- package/dist/language-service/worker-provider.d.ts +9 -0
- package/dist/language-service/worker-provider.js +38 -0
- package/dist/lapis-extension.d.ts +244 -0
- package/dist/lapis-extension.js +591 -0
- package/dist/links.d.ts +34 -0
- package/dist/links.js +191 -0
- package/dist/loaders.d.ts +9 -0
- package/dist/loaders.js +59 -0
- package/dist/localization-manager.svelte.d.ts +56 -0
- package/dist/localization-manager.svelte.js +157 -0
- package/dist/logging.d.ts +172 -0
- package/dist/logging.js +352 -0
- package/dist/markdown-extension-registry.d.ts +31 -0
- package/dist/markdown-extension-registry.js +31 -0
- package/dist/markdown-file-surface-registry.d.ts +25 -0
- package/dist/markdown-file-surface-registry.js +23 -0
- package/dist/markdown.d.ts +205 -0
- package/dist/markdown.js +147 -0
- package/dist/menu-utils.d.ts +1 -0
- package/dist/menu-utils.js +47 -0
- package/dist/menu.svelte.d.ts +121 -0
- package/dist/menu.svelte.js +295 -0
- package/dist/metadata-value.d.ts +10 -0
- package/dist/metadata-value.js +173 -0
- package/dist/metadata.svelte.d.ts +106 -0
- package/dist/metadata.svelte.js +608 -0
- package/dist/notifications.d.ts +209 -0
- package/dist/notifications.js +338 -0
- package/dist/open-file.d.ts +23 -0
- package/dist/open-file.js +102 -0
- package/dist/platform.d.ts +86 -0
- package/dist/platform.js +86 -0
- package/dist/plugin-asset-server.d.ts +60 -0
- package/dist/plugin-asset-server.js +222 -0
- package/dist/plugin-assets.d.ts +4 -0
- package/dist/plugin-assets.js +3 -0
- package/dist/plugin-capability-facade.d.ts +104 -0
- package/dist/plugin-capability-facade.js +61 -0
- package/dist/plugin-dependency-resolver.d.ts +36 -0
- package/dist/plugin-dependency-resolver.js +54 -0
- package/dist/plugin-dependency-scanner.d.ts +9 -0
- package/dist/plugin-dependency-scanner.js +274 -0
- package/dist/plugin-distribution/canonical-json.d.ts +1 -0
- package/dist/plugin-distribution/canonical-json.js +40 -0
- package/dist/plugin-distribution/compatibility.d.ts +5 -0
- package/dist/plugin-distribution/compatibility.js +38 -0
- package/dist/plugin-distribution/errors.d.ts +11 -0
- package/dist/plugin-distribution/errors.js +13 -0
- package/dist/plugin-distribution/hashes.d.ts +2 -0
- package/dist/plugin-distribution/hashes.js +17 -0
- package/dist/plugin-distribution/index.d.ts +18 -0
- package/dist/plugin-distribution/index.js +18 -0
- package/dist/plugin-distribution/installed-plugin-state.d.ts +20 -0
- package/dist/plugin-distribution/installed-plugin-state.js +73 -0
- package/dist/plugin-distribution/installer.d.ts +89 -0
- package/dist/plugin-distribution/installer.js +395 -0
- package/dist/plugin-distribution/manager.d.ts +128 -0
- package/dist/plugin-distribution/manager.js +358 -0
- package/dist/plugin-distribution/path-safety.d.ts +2 -0
- package/dist/plugin-distribution/path-safety.js +20 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.d.ts +28 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.js +96 -0
- package/dist/plugin-distribution/plugin-bundle-worker.d.ts +34 -0
- package/dist/plugin-distribution/plugin-bundle-worker.js +99 -0
- package/dist/plugin-distribution/plugin-bundle.d.ts +16 -0
- package/dist/plugin-distribution/plugin-bundle.js +244 -0
- package/dist/plugin-distribution/plugin-bundle.worker.d.ts +1 -0
- package/dist/plugin-distribution/plugin-bundle.worker.js +38 -0
- package/dist/plugin-distribution/registry-cache.d.ts +26 -0
- package/dist/plugin-distribution/registry-cache.js +85 -0
- package/dist/plugin-distribution/registry-client.d.ts +36 -0
- package/dist/plugin-distribution/registry-client.js +115 -0
- package/dist/plugin-distribution/reserved-ids.d.ts +4 -0
- package/dist/plugin-distribution/reserved-ids.js +10 -0
- package/dist/plugin-distribution/runtime-validation.d.ts +14 -0
- package/dist/plugin-distribution/runtime-validation.js +388 -0
- package/dist/plugin-distribution/schemas.d.ts +4895 -0
- package/dist/plugin-distribution/schemas.js +299 -0
- package/dist/plugin-distribution/signing.d.ts +5 -0
- package/dist/plugin-distribution/signing.js +38 -0
- package/dist/plugin-distribution/types.d.ts +217 -0
- package/dist/plugin-distribution/types.js +1 -0
- package/dist/plugin-install-progress.d.ts +15 -0
- package/dist/plugin-install-progress.js +86 -0
- package/dist/plugin-manager.d.ts +306 -0
- package/dist/plugin-manager.js +2848 -0
- package/dist/plugin-runtime-entry.d.ts +19 -0
- package/dist/plugin-runtime-entry.js +135 -0
- package/dist/plugin.d.ts +350 -0
- package/dist/plugin.js +754 -0
- package/dist/popover.d.ts +20 -0
- package/dist/popover.js +32 -0
- package/dist/promise-worker.d.ts +22 -0
- package/dist/promise-worker.js +65 -0
- package/dist/prompt-confirm.d.ts +9 -0
- package/dist/prompt-confirm.js +33 -0
- package/dist/search-document-provider.d.ts +45 -0
- package/dist/search-document-provider.js +54 -0
- package/dist/search-query/index.d.ts +78 -0
- package/dist/search-query/index.js +426 -0
- package/dist/search-query/parser.d.ts +3 -0
- package/dist/search-query/parser.js +16 -0
- package/dist/search-query/parser.terms.js +26 -0
- package/dist/search-query/search-query.grammar +128 -0
- package/dist/search.d.ts +19 -0
- package/dist/search.js +104 -0
- package/dist/setting-section-layout.d.ts +19 -0
- package/dist/setting-section-layout.js +194 -0
- package/dist/settings.svelte.d.ts +474 -0
- package/dist/settings.svelte.js +1421 -0
- package/dist/source-text-file-view.d.ts +25 -0
- package/dist/source-text-file-view.js +78 -0
- package/dist/status-bar.svelte.d.ts +29 -0
- package/dist/status-bar.svelte.js +72 -0
- package/dist/storage/app-database.d.ts +860 -0
- package/dist/storage/app-database.js +2372 -0
- package/dist/storage/blob-store.d.ts +12 -0
- package/dist/storage/blob-store.js +1 -0
- package/dist/storage/browser-app-database-coordination.d.ts +35 -0
- package/dist/storage/browser-app-database-coordination.js +207 -0
- package/dist/storage/browser-coordinated-app-database.d.ts +109 -0
- package/dist/storage/browser-coordinated-app-database.js +704 -0
- package/dist/storage/browser.d.ts +153 -0
- package/dist/storage/browser.js +794 -0
- package/dist/storage/desktop-native.d.ts +184 -0
- package/dist/storage/desktop-native.js +415 -0
- package/dist/storage/fs.d.ts +188 -0
- package/dist/storage/fs.js +307 -0
- package/dist/storage/index-projection.d.ts +236 -0
- package/dist/storage/index-projection.js +402 -0
- package/dist/storage/index.d.ts +17 -0
- package/dist/storage/index.js +17 -0
- package/dist/storage/keyval.d.ts +94 -0
- package/dist/storage/keyval.js +199 -0
- package/dist/storage/memory-vault-adapter.d.ts +44 -0
- package/dist/storage/memory-vault-adapter.js +351 -0
- package/dist/storage/native-vault-bootstrap-kv.d.ts +22 -0
- package/dist/storage/native-vault-bootstrap-kv.js +96 -0
- package/dist/storage/path.d.ts +22 -0
- package/dist/storage/path.js +110 -0
- package/dist/storage/search-embedding-provider.d.ts +75 -0
- package/dist/storage/search-embedding-provider.js +446 -0
- package/dist/storage/search-embedding-worker.d.ts +1 -0
- package/dist/storage/search-embedding-worker.js +63 -0
- package/dist/storage/search-query-evaluator.d.ts +14 -0
- package/dist/storage/search-query-evaluator.js +678 -0
- package/dist/storage/task-projection.d.ts +152 -0
- package/dist/storage/task-projection.js +154 -0
- package/dist/storage/turso-app-database.d.ts +150 -0
- package/dist/storage/turso-app-database.js +2671 -0
- package/dist/storage/vault-session.d.ts +37 -0
- package/dist/storage/vault-session.js +196 -0
- package/dist/storage/vault-state.d.ts +74 -0
- package/dist/storage/vault-state.js +181 -0
- package/dist/storage/vault.svelte.d.ts +257 -0
- package/dist/storage/vault.svelte.js +661 -0
- package/dist/suggest.d.ts +193 -0
- package/dist/suggest.js +391 -0
- package/dist/tasks.d.ts +7 -0
- package/dist/tasks.js +18 -0
- package/dist/telemetry.d.ts +116 -0
- package/dist/telemetry.js +103 -0
- package/dist/utils.d.ts +55 -0
- package/dist/utils.js +314 -0
- package/dist/vault-api.d.ts +5 -0
- package/dist/vault-api.js +3 -0
- package/dist/vault-maintenance-commands.d.ts +5 -0
- package/dist/vault-maintenance-commands.js +32 -0
- package/dist/view.svelte.d.ts +215 -0
- package/dist/view.svelte.js +381 -0
- package/dist/vite-env.d.ts +2 -0
- package/dist/workspace-host-internal.d.ts +7 -0
- package/dist/workspace-host-internal.js +7 -0
- package/dist/workspace-host.d.ts +10 -0
- package/dist/workspace-host.js +14 -0
- package/dist/workspace-layout-commands.d.ts +3 -0
- package/dist/workspace-layout-commands.js +72 -0
- package/dist/workspace-layout-normalizer.d.ts +92 -0
- package/dist/workspace-layout-normalizer.js +301 -0
- package/dist/workspace-layouts.d.ts +7 -0
- package/dist/workspace-layouts.js +23 -0
- package/dist/workspace-trust.d.ts +32 -0
- package/dist/workspace-trust.js +72 -0
- package/dist/workspace.svelte.d.ts +796 -0
- package/dist/workspace.svelte.js +4380 -0
- package/package.json +240 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { tagHighlighter, tags } from "@lezer/highlight";
|
|
2
|
+
export const classHighlighter = tagHighlighter([
|
|
3
|
+
{ tag: tags.link, class: "cm-link" },
|
|
4
|
+
{ tag: tags.heading, class: "cm-heading" },
|
|
5
|
+
{ tag: tags.emphasis, class: "cm-emphasis" },
|
|
6
|
+
{ tag: tags.strong, class: "cm-strong" },
|
|
7
|
+
{ tag: tags.keyword, class: "cm-keyword" },
|
|
8
|
+
{ tag: tags.atom, class: "cm-meta" },
|
|
9
|
+
{ tag: tags.bool, class: "cm-bool" },
|
|
10
|
+
{ tag: tags.url, class: "cm-url" },
|
|
11
|
+
{ tag: tags.labelName, class: "cm-label" },
|
|
12
|
+
{ tag: tags.inserted, class: "cm-inserted" },
|
|
13
|
+
{ tag: tags.deleted, class: "cm-deleted" },
|
|
14
|
+
{ tag: tags.literal, class: "cm-literal" },
|
|
15
|
+
{ tag: tags.string, class: "cm-string" },
|
|
16
|
+
{ tag: tags.attributeValue, class: "cm-string" },
|
|
17
|
+
{ tag: tags.number, class: "cm-number" },
|
|
18
|
+
{
|
|
19
|
+
tag: [tags.regexp, tags.escape, tags.special(tags.string)],
|
|
20
|
+
class: "cm-string-2",
|
|
21
|
+
},
|
|
22
|
+
{ tag: tags.variableName, class: "cm-variable" },
|
|
23
|
+
{ tag: tags.local(tags.variableName), class: "cm-local" },
|
|
24
|
+
{
|
|
25
|
+
tag: tags.definition(tags.variableName),
|
|
26
|
+
class: "cm-definition",
|
|
27
|
+
},
|
|
28
|
+
{ tag: tags.special(tags.variableName), class: "cm-variable-2" },
|
|
29
|
+
{
|
|
30
|
+
tag: tags.definition(tags.propertyName),
|
|
31
|
+
class: "cm-definition",
|
|
32
|
+
},
|
|
33
|
+
{ tag: tags.typeName, class: "cm-type" },
|
|
34
|
+
{ tag: tags.namespace, class: "cm-namespace" },
|
|
35
|
+
{ tag: tags.className, class: "cm-class" },
|
|
36
|
+
{ tag: tags.macroName, class: "cm-macro" },
|
|
37
|
+
{ tag: tags.propertyName, class: "cm-property" },
|
|
38
|
+
{ tag: tags.attributeName, class: "cm-attribute" },
|
|
39
|
+
{ tag: tags.operator, class: "cm-operator" },
|
|
40
|
+
{ tag: [tags.comment, tags.contentSeparator], class: "cm-comment" },
|
|
41
|
+
{ tag: tags.meta, class: "cm-meta" },
|
|
42
|
+
{ tag: tags.processingInstruction, class: "cm-meta" },
|
|
43
|
+
{ tag: tags.invalid, class: "cm-invalid" },
|
|
44
|
+
{ tag: tags.punctuation, class: "cm-punctuation" },
|
|
45
|
+
{ tag: tags.bracket, class: "cm-bracket" },
|
|
46
|
+
{ tag: tags.strikethrough, class: "cm-line-through" },
|
|
47
|
+
]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Extension } from "@codemirror/state";
|
|
2
|
+
/**
|
|
3
|
+
* Mira / Obsidian-style fold chevron. `open` means the range is expanded and
|
|
4
|
+
* can be folded (chevron points down); closed means folded (chevron points
|
|
5
|
+
* endward).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useFoldIcon(open: boolean): HTMLDivElement;
|
|
8
|
+
export declare function foldGutter(): Extension;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { foldGutter as editorFoldGutter } from "@codemirror/language";
|
|
2
|
+
/**
|
|
3
|
+
* Mira / Obsidian-style fold chevron. `open` means the range is expanded and
|
|
4
|
+
* can be folded (chevron points down); closed means folded (chevron points
|
|
5
|
+
* endward).
|
|
6
|
+
*/
|
|
7
|
+
export function useFoldIcon(open) {
|
|
8
|
+
const foldIcon = document.createElement("div");
|
|
9
|
+
foldIcon.className = "collapse-icon";
|
|
10
|
+
const foldIcon_svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
11
|
+
const foldIcon_svg_path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
12
|
+
foldIcon_svg.setAttributeNS(null, "viewBox", "0 0 24 24");
|
|
13
|
+
foldIcon_svg.setAttributeNS(null, "fill", "none");
|
|
14
|
+
foldIcon_svg.setAttributeNS(null, "stroke", "currentColor");
|
|
15
|
+
foldIcon_svg.setAttributeNS(null, "stroke-width", "2");
|
|
16
|
+
foldIcon_svg.setAttributeNS(null, "stroke-linecap", "round");
|
|
17
|
+
foldIcon_svg.setAttributeNS(null, "stroke-linejoin", "round");
|
|
18
|
+
foldIcon_svg.setAttributeNS(null, "class", "svg-icon");
|
|
19
|
+
foldIcon_svg_path.setAttribute("d", "M3 8L12 17L21 8");
|
|
20
|
+
foldIcon_svg.appendChild(foldIcon_svg_path);
|
|
21
|
+
if (open) {
|
|
22
|
+
foldIcon.classList.add("open-fold-icon");
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
foldIcon.classList.add("closed-fold-icon");
|
|
26
|
+
foldIcon_svg.setAttribute("style", "height: 100%; transform: rotate(-90deg);");
|
|
27
|
+
}
|
|
28
|
+
foldIcon.appendChild(foldIcon_svg);
|
|
29
|
+
// Keep leaf-content tab activation from seeing pointerdown; click still
|
|
30
|
+
// bubbles to the CodeMirror fold gutter handler.
|
|
31
|
+
for (const type of ["pointerdown", "mousedown"]) {
|
|
32
|
+
foldIcon.addEventListener(type, (event) => {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return foldIcon;
|
|
37
|
+
}
|
|
38
|
+
export function foldGutter() {
|
|
39
|
+
return editorFoldGutter({ markerDOM: useFoldIcon });
|
|
40
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { EditorView, ViewPlugin, } from "@codemirror/view";
|
|
2
|
+
function collectVisibleLineStyles(view) {
|
|
3
|
+
return Array.from(view.dom.querySelectorAll(".cm-content .cm-line"), (line) => {
|
|
4
|
+
const style = getComputedStyle(line);
|
|
5
|
+
const rect = line.getBoundingClientRect();
|
|
6
|
+
return {
|
|
7
|
+
top: rect.top,
|
|
8
|
+
bottom: rect.bottom,
|
|
9
|
+
lineHeight: style.lineHeight,
|
|
10
|
+
paddingTop: style.paddingTop,
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function collectGutterColumns(view) {
|
|
15
|
+
return Array.from(view.dom.querySelectorAll(".cm-gutters .cm-gutter"), (gutter) => Array.from(gutter.querySelectorAll(".cm-gutterElement"), (element) => {
|
|
16
|
+
const rect = element.getBoundingClientRect();
|
|
17
|
+
return {
|
|
18
|
+
element,
|
|
19
|
+
top: rect.top,
|
|
20
|
+
bottom: rect.bottom,
|
|
21
|
+
};
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
function mutationMayAffectGutters(mutation) {
|
|
25
|
+
if (mutation.type === "attributes") {
|
|
26
|
+
return mutation.attributeName === "class";
|
|
27
|
+
}
|
|
28
|
+
return mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0;
|
|
29
|
+
}
|
|
30
|
+
function findMatchingLineStyle(gutterElement, lineStyles) {
|
|
31
|
+
let bestMatch = null;
|
|
32
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
33
|
+
for (const lineStyle of lineStyles) {
|
|
34
|
+
const overlaps = gutterElement.top < lineStyle.bottom &&
|
|
35
|
+
gutterElement.bottom > lineStyle.top;
|
|
36
|
+
if (overlaps) {
|
|
37
|
+
return lineStyle;
|
|
38
|
+
}
|
|
39
|
+
const distance = Math.abs(gutterElement.top - lineStyle.top);
|
|
40
|
+
if (distance < bestDistance) {
|
|
41
|
+
bestDistance = distance;
|
|
42
|
+
bestMatch = lineStyle;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return bestMatch;
|
|
46
|
+
}
|
|
47
|
+
class GutterLineStyleSyncPlugin {
|
|
48
|
+
view;
|
|
49
|
+
mutationObserver;
|
|
50
|
+
resizeObserver;
|
|
51
|
+
syncScheduled = false;
|
|
52
|
+
constructor(view) {
|
|
53
|
+
this.view = view;
|
|
54
|
+
this.mutationObserver = new MutationObserver((mutations) => {
|
|
55
|
+
if (mutations.some(mutationMayAffectGutters)) {
|
|
56
|
+
this.scheduleSync();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
this.mutationObserver.observe(this.view.dom, {
|
|
60
|
+
subtree: true,
|
|
61
|
+
childList: true,
|
|
62
|
+
attributes: true,
|
|
63
|
+
attributeFilter: ["class"],
|
|
64
|
+
});
|
|
65
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
66
|
+
this.scheduleSync();
|
|
67
|
+
});
|
|
68
|
+
this.resizeObserver.observe(this.view.dom);
|
|
69
|
+
this.resizeObserver.observe(this.view.contentDOM);
|
|
70
|
+
this.scheduleSync();
|
|
71
|
+
}
|
|
72
|
+
update(update) {
|
|
73
|
+
if (update.docChanged || update.viewportChanged || update.geometryChanged) {
|
|
74
|
+
this.scheduleSync();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
destroy() {
|
|
78
|
+
this.mutationObserver.disconnect();
|
|
79
|
+
this.resizeObserver.disconnect();
|
|
80
|
+
}
|
|
81
|
+
scheduleSync() {
|
|
82
|
+
if (this.syncScheduled) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.syncScheduled = true;
|
|
86
|
+
this.view.requestMeasure({
|
|
87
|
+
read: (view) => ({
|
|
88
|
+
lineStyles: collectVisibleLineStyles(view),
|
|
89
|
+
gutterColumns: collectGutterColumns(view),
|
|
90
|
+
}),
|
|
91
|
+
write: ({ lineStyles, gutterColumns }) => {
|
|
92
|
+
this.syncScheduled = false;
|
|
93
|
+
this.applyLineStyles(lineStyles, gutterColumns);
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
applyLineStyles(lineStyles, gutterColumns) {
|
|
98
|
+
for (const gutterElements of gutterColumns) {
|
|
99
|
+
for (const gutterElement of gutterElements) {
|
|
100
|
+
const lineStyle = findMatchingLineStyle(gutterElement, lineStyles);
|
|
101
|
+
if (!lineStyle) {
|
|
102
|
+
gutterElement.element.style.removeProperty("line-height");
|
|
103
|
+
gutterElement.element.style.removeProperty("padding-top");
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (gutterElement.element.style.lineHeight !== lineStyle.lineHeight) {
|
|
107
|
+
gutterElement.element.style.lineHeight = lineStyle.lineHeight;
|
|
108
|
+
}
|
|
109
|
+
if (gutterElement.element.style.paddingTop !== lineStyle.paddingTop) {
|
|
110
|
+
gutterElement.element.style.paddingTop = lineStyle.paddingTop;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export function gutterLineStyleSyncExtension() {
|
|
117
|
+
return ViewPlugin.fromClass(GutterLineStyleSyncPlugin);
|
|
118
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { lapisCodeMirrorLint, type LapisCodeMirrorLintOptions, type LapisCodeMirrorLintConfig, closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, previousDiagnostic, setDiagnostics, setDiagnosticsEffect, type Action, type Diagnostic, type LintSource, } from "./lapis-code-mirror-lint";
|
|
2
|
+
export { mapToLapisLintDiagnostic, markdownlintRuleUrl, type LapisLintDiagnosticMeta, type MapToLapisLintDiagnosticOptions, } from "./lapis-lint-diagnostic";
|
|
3
|
+
export { inlineProblemExtension, toggleInlineProblem, showInlineProblem, type InlineProblemSpec, } from "./lapis-lint-inline-widget";
|
|
4
|
+
export { lapisLintHoverTooltip } from "./lapis-lint-hover-tooltip";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { lapisCodeMirrorLint, closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, previousDiagnostic, setDiagnostics, setDiagnosticsEffect, } from "./lapis-code-mirror-lint";
|
|
2
|
+
export { mapToLapisLintDiagnostic, markdownlintRuleUrl, } from "./lapis-lint-diagnostic";
|
|
3
|
+
export { inlineProblemExtension, toggleInlineProblem, showInlineProblem, } from "./lapis-lint-inline-widget";
|
|
4
|
+
export { lapisLintHoverTooltip } from "./lapis-lint-hover-tooltip";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { lintGutter, linter, type LintSource } from "@codemirror/lint";
|
|
2
|
+
import type { Extension } from "@codemirror/state";
|
|
3
|
+
declare const lintSeverityIcons: {
|
|
4
|
+
readonly error: "circle-x";
|
|
5
|
+
readonly warning: "triangle-alert";
|
|
6
|
+
readonly info: "info";
|
|
7
|
+
readonly hint: "lightbulb";
|
|
8
|
+
};
|
|
9
|
+
export declare function workspaceLintMarkerMask(severity: keyof typeof lintSeverityIcons): string;
|
|
10
|
+
type LintConfig = NonNullable<Parameters<typeof linter>[1]>;
|
|
11
|
+
type LintGutterConfig = NonNullable<Parameters<typeof lintGutter>[0]>;
|
|
12
|
+
export interface LapisCodeMirrorLintOptions {
|
|
13
|
+
source: LintSource | null;
|
|
14
|
+
lint?: LintConfig;
|
|
15
|
+
gutter?: LintGutterConfig | false;
|
|
16
|
+
}
|
|
17
|
+
export type LapisCodeMirrorLintConfig = LintConfig & {
|
|
18
|
+
gutter?: LintGutterConfig | false;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Shared CodeMirror lint defaults for Lapis editors. Workspace CSS owns the
|
|
22
|
+
* visible chrome; this sets shared behavior and a light `EditorView.theme`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function lapisCodeMirrorLint(source: LintSource | null, config?: LapisCodeMirrorLintConfig): Extension[];
|
|
25
|
+
export declare function lapisCodeMirrorLint(options: LapisCodeMirrorLintOptions): Extension[];
|
|
26
|
+
export { closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, previousDiagnostic, setDiagnostics, setDiagnosticsEffect, type Action, type Diagnostic, type LintSource, } from "@codemirror/lint";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { lintGutter, linter } from "@codemirror/lint";
|
|
2
|
+
import { EditorView } from "@codemirror/view";
|
|
3
|
+
import { getWorkspaceIconSvg } from "@lapismd/design-core/workspace/icon";
|
|
4
|
+
import { lapisLintHoverTooltip } from "./lapis-lint-hover-tooltip";
|
|
5
|
+
import { inlineProblemExtension } from "./lapis-lint-inline-widget";
|
|
6
|
+
const lintSeverityIcons = {
|
|
7
|
+
error: "circle-x",
|
|
8
|
+
warning: "triangle-alert",
|
|
9
|
+
info: "info",
|
|
10
|
+
hint: "lightbulb",
|
|
11
|
+
};
|
|
12
|
+
export function workspaceLintMarkerMask(severity) {
|
|
13
|
+
const svg = getWorkspaceIconSvg(lintSeverityIcons[severity]);
|
|
14
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Align tooltip typography and gutter markers with the app shell. Marker masks
|
|
18
|
+
* are generated from the same public workspace icon source as Problems.
|
|
19
|
+
*/
|
|
20
|
+
const lapisLintTheme = EditorView.theme({
|
|
21
|
+
".cm-tooltip.cm-tooltip-lint": {
|
|
22
|
+
fontFamily: "inherit",
|
|
23
|
+
padding: 0,
|
|
24
|
+
},
|
|
25
|
+
".cm-gutters .cm-gutter-lint .cm-gutterElement": {
|
|
26
|
+
display: "inline-flex",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
boxSizing: "border-box",
|
|
30
|
+
minWidth: "1.4em",
|
|
31
|
+
paddingInline: "0.2em",
|
|
32
|
+
},
|
|
33
|
+
".cm-lint-marker": {
|
|
34
|
+
content: '"" !important',
|
|
35
|
+
width: "0.875rem",
|
|
36
|
+
height: "0.875rem",
|
|
37
|
+
backgroundColor: "currentColor",
|
|
38
|
+
backgroundImage: "none",
|
|
39
|
+
maskPosition: "center",
|
|
40
|
+
maskRepeat: "no-repeat",
|
|
41
|
+
maskSize: "contain",
|
|
42
|
+
WebkitMaskPosition: "center",
|
|
43
|
+
WebkitMaskRepeat: "no-repeat",
|
|
44
|
+
WebkitMaskSize: "contain",
|
|
45
|
+
},
|
|
46
|
+
".cm-lint-marker-error": {
|
|
47
|
+
color: "var(--ui-workspace-diagnostic-error, var(--destructive, #dc2626))",
|
|
48
|
+
maskImage: workspaceLintMarkerMask("error"),
|
|
49
|
+
WebkitMaskImage: workspaceLintMarkerMask("error"),
|
|
50
|
+
},
|
|
51
|
+
".cm-lint-marker-warning": {
|
|
52
|
+
color: "var(--ui-workspace-diagnostic-warning, var(--warning, #d97706))",
|
|
53
|
+
maskImage: workspaceLintMarkerMask("warning"),
|
|
54
|
+
WebkitMaskImage: workspaceLintMarkerMask("warning"),
|
|
55
|
+
},
|
|
56
|
+
".cm-lint-marker-info": {
|
|
57
|
+
color: "var(--ui-workspace-diagnostic-information, var(--muted-foreground, #64748b))",
|
|
58
|
+
maskImage: workspaceLintMarkerMask("info"),
|
|
59
|
+
WebkitMaskImage: workspaceLintMarkerMask("info"),
|
|
60
|
+
},
|
|
61
|
+
".cm-lint-marker-hint": {
|
|
62
|
+
color: "var(--ui-workspace-diagnostic-hint, var(--muted-foreground, #64748b))",
|
|
63
|
+
maskImage: workspaceLintMarkerMask("hint"),
|
|
64
|
+
WebkitMaskImage: workspaceLintMarkerMask("hint"),
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
function buildLapisCodeMirrorLintExtensions(source, lint, gutter) {
|
|
68
|
+
const extensions = [
|
|
69
|
+
inlineProblemExtension,
|
|
70
|
+
lapisLintHoverTooltip(),
|
|
71
|
+
linter(source, withoutCodeMirrorTooltip(lint)),
|
|
72
|
+
];
|
|
73
|
+
if (gutter !== false) {
|
|
74
|
+
extensions.push(lintGutter(withoutCodeMirrorGutterTooltip(gutter)));
|
|
75
|
+
}
|
|
76
|
+
extensions.push(lapisLintTheme);
|
|
77
|
+
return extensions;
|
|
78
|
+
}
|
|
79
|
+
function withoutCodeMirrorTooltip(lint) {
|
|
80
|
+
return {
|
|
81
|
+
...lint,
|
|
82
|
+
tooltipFilter: () => [],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function withoutCodeMirrorGutterTooltip(gutter) {
|
|
86
|
+
return {
|
|
87
|
+
...gutter,
|
|
88
|
+
tooltipFilter: () => [],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function lapisCodeMirrorLint(sourceOrOptions, config = {}) {
|
|
92
|
+
if (sourceOrOptions &&
|
|
93
|
+
typeof sourceOrOptions === "object" &&
|
|
94
|
+
"source" in sourceOrOptions) {
|
|
95
|
+
const { source, lint, gutter } = sourceOrOptions;
|
|
96
|
+
return buildLapisCodeMirrorLintExtensions(source, lint, gutter);
|
|
97
|
+
}
|
|
98
|
+
const { gutter, ...lintConfig } = config;
|
|
99
|
+
return buildLapisCodeMirrorLintExtensions(sourceOrOptions, lintConfig, gutter);
|
|
100
|
+
}
|
|
101
|
+
export { closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, previousDiagnostic, setDiagnostics, setDiagnosticsEffect, } from "@codemirror/lint";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface LapisLintDiagnosticMeta {
|
|
2
|
+
code?: string | number;
|
|
3
|
+
ruleId?: string;
|
|
4
|
+
ruleUrl?: string;
|
|
5
|
+
sourceLabel?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Build a markdownlint documentation URL for a rule code such as `MD041`. */
|
|
8
|
+
export declare function markdownlintRuleUrl(code: string | number, template?: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const DEFAULT_MARKDOWNLINT_RULE_URL_TEMPLATE = "https://github.com/DavidAnson/markdownlint/blob/main/doc/{rule}.md";
|
|
2
|
+
/** Build a markdownlint documentation URL for a rule code such as `MD041`. */
|
|
3
|
+
export function markdownlintRuleUrl(code, template = DEFAULT_MARKDOWNLINT_RULE_URL_TEMPLATE) {
|
|
4
|
+
const raw = String(code);
|
|
5
|
+
const rule = /^MD(\d+)$/i.test(raw) ? `md${raw.slice(2)}` : raw.toLowerCase();
|
|
6
|
+
return template.replace("{rule}", rule);
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Action, Diagnostic } from "@codemirror/lint";
|
|
2
|
+
import type { LapisLintDiagnosticMeta } from "./lapis-lint-diagnostic-helpers";
|
|
3
|
+
export type { LapisLintDiagnosticMeta } from "./lapis-lint-diagnostic-helpers";
|
|
4
|
+
export { markdownlintRuleUrl } from "./lapis-lint-diagnostic-helpers";
|
|
5
|
+
export interface MapToLapisLintDiagnosticOptions {
|
|
6
|
+
actions?: Action[];
|
|
7
|
+
includeViewProblem?: boolean;
|
|
8
|
+
includeCopy?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface LapisLintTooltipPayload {
|
|
11
|
+
meta: LapisLintDiagnosticMeta;
|
|
12
|
+
includeCopy: boolean;
|
|
13
|
+
actions: Action[];
|
|
14
|
+
}
|
|
15
|
+
export declare function getLapisLintTooltipPayload(diagnostic: Diagnostic): LapisLintTooltipPayload | null;
|
|
16
|
+
/**
|
|
17
|
+
* Enrich a CodeMirror diagnostic with Lapis lint tooltip chrome: rule links,
|
|
18
|
+
* copy control, and optional built-in actions such as View Problem.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mapToLapisLintDiagnostic(base: Omit<Diagnostic, "renderMessage" | "actions">, meta?: LapisLintDiagnosticMeta, options?: MapToLapisLintDiagnosticOptions): Diagnostic;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { toggleInlineProblem } from "./lapis-lint-inline-widget";
|
|
2
|
+
export { markdownlintRuleUrl } from "./lapis-lint-diagnostic-helpers";
|
|
3
|
+
const tooltipPayloads = new WeakMap();
|
|
4
|
+
const tooltipPayloadKey = Symbol.for("@lapis-notes/api/lapis-lint-tooltip-payload");
|
|
5
|
+
export function getLapisLintTooltipPayload(diagnostic) {
|
|
6
|
+
return (tooltipPayloads.get(diagnostic) ??
|
|
7
|
+
diagnostic[tooltipPayloadKey] ??
|
|
8
|
+
null);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Enrich a CodeMirror diagnostic with Lapis lint tooltip chrome: rule links,
|
|
12
|
+
* copy control, and optional built-in actions such as View Problem.
|
|
13
|
+
*/
|
|
14
|
+
export function mapToLapisLintDiagnostic(base, meta = {}, options = {}) {
|
|
15
|
+
const { actions = [], includeViewProblem = true, includeCopy = true, } = options;
|
|
16
|
+
const builtInActions = [];
|
|
17
|
+
if (includeViewProblem) {
|
|
18
|
+
builtInActions.push({
|
|
19
|
+
name: "View Problem",
|
|
20
|
+
apply: (view, from) => {
|
|
21
|
+
toggleInlineProblem(view, from, {
|
|
22
|
+
message: base.message,
|
|
23
|
+
sourceLabel: meta.sourceLabel,
|
|
24
|
+
ruleId: meta.ruleId ?? (meta.code != null ? String(meta.code) : undefined),
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const tooltipActions = [...builtInActions, ...actions];
|
|
30
|
+
const diagnostic = {
|
|
31
|
+
...base,
|
|
32
|
+
// The Lapis hover tooltip owns action rendering. Keeping CodeMirror actions
|
|
33
|
+
// empty prevents the default lint tooltip/panel from duplicating them.
|
|
34
|
+
actions: [],
|
|
35
|
+
};
|
|
36
|
+
const payload = {
|
|
37
|
+
meta,
|
|
38
|
+
includeCopy,
|
|
39
|
+
actions: tooltipActions,
|
|
40
|
+
};
|
|
41
|
+
tooltipPayloads.set(diagnostic, payload);
|
|
42
|
+
Object.defineProperty(diagnostic, tooltipPayloadKey, {
|
|
43
|
+
value: payload,
|
|
44
|
+
enumerable: false,
|
|
45
|
+
});
|
|
46
|
+
return diagnostic;
|
|
47
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Extension } from "@codemirror/state";
|
|
2
|
+
type RectLike = Pick<DOMRect, "left" | "right" | "top" | "bottom">;
|
|
3
|
+
type PointLike = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function pointerWithinLintTooltipHandoff(point: PointLike, trigger: RectLike, tooltip: RectLike, margin?: number): boolean;
|
|
8
|
+
export declare function lapisLintHoverTooltip(): Extension[];
|
|
9
|
+
export {};
|