@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,176 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button } from "@lapismd/design-core/shadcn/button";
|
|
3
|
+
import { WorkspaceIcon } from "@lapismd/design-core/workspace/icon";
|
|
4
|
+
import { WorkspaceMenuItems } from "@lapismd/design-core/workspace/menu";
|
|
5
|
+
import { DropdownMenu } from "bits-ui";
|
|
6
|
+
import {
|
|
7
|
+
createLintQuickFixMenu,
|
|
8
|
+
splitLintTooltipActions,
|
|
9
|
+
type LintTooltipAction,
|
|
10
|
+
} from "./lint-tooltip-actions";
|
|
11
|
+
import "../../editor.css";
|
|
12
|
+
|
|
13
|
+
export type { LintTooltipAction };
|
|
14
|
+
|
|
15
|
+
type Props = {
|
|
16
|
+
message: string;
|
|
17
|
+
ruleId?: string;
|
|
18
|
+
ruleUrl?: string;
|
|
19
|
+
sourceLabel?: string;
|
|
20
|
+
includeCopy?: boolean;
|
|
21
|
+
actions?: LintTooltipAction[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
let {
|
|
25
|
+
message,
|
|
26
|
+
ruleId,
|
|
27
|
+
ruleUrl,
|
|
28
|
+
sourceLabel,
|
|
29
|
+
includeCopy = true,
|
|
30
|
+
actions = [],
|
|
31
|
+
}: Props = $props();
|
|
32
|
+
|
|
33
|
+
const showRuleLink = $derived(ruleId != null && ruleUrl != null);
|
|
34
|
+
const showAttribution = $derived(sourceLabel != null || ruleId != null);
|
|
35
|
+
const { viewProblem, quickFixActions } = $derived(
|
|
36
|
+
splitLintTooltipActions(actions),
|
|
37
|
+
);
|
|
38
|
+
const quickFixMenu = $derived(createLintQuickFixMenu(quickFixActions));
|
|
39
|
+
const showFooter = $derived(
|
|
40
|
+
Boolean(viewProblem) || quickFixActions.length > 0,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
function copyMessage(event: MouseEvent) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
void navigator.clipboard?.writeText(message);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function containPointerDown(event: PointerEvent | MouseEvent) {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function stopRowActivation(event: Event) {
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
data-ui-component="editor"
|
|
61
|
+
data-ui-part="lint-tooltip"
|
|
62
|
+
data-testid="lapis-lint-tooltip"
|
|
63
|
+
>
|
|
64
|
+
<div
|
|
65
|
+
data-ui-component="editor"
|
|
66
|
+
data-ui-part="lint-message-band"
|
|
67
|
+
data-ui-copy={includeCopy ? "" : undefined}
|
|
68
|
+
data-testid="lapis-lint-message-band"
|
|
69
|
+
>
|
|
70
|
+
<div data-ui-component="editor" data-ui-part="lint-message-row">
|
|
71
|
+
<span
|
|
72
|
+
data-ui-component="editor"
|
|
73
|
+
data-ui-part="lint-message-text"
|
|
74
|
+
data-testid="lapis-lint-message-text">{message}</span
|
|
75
|
+
>
|
|
76
|
+
{#if showAttribution}
|
|
77
|
+
<span
|
|
78
|
+
data-ui-component="editor"
|
|
79
|
+
data-ui-part="lint-source"
|
|
80
|
+
data-testid="lapis-lint-source"
|
|
81
|
+
>
|
|
82
|
+
{sourceLabel ??
|
|
83
|
+
""}{#if ruleId != null}{#if sourceLabel}({/if}{#if showRuleLink}<a
|
|
84
|
+
data-ui-component="editor"
|
|
85
|
+
data-ui-part="lint-rule"
|
|
86
|
+
data-testid="lapis-lint-rule"
|
|
87
|
+
href={ruleUrl}
|
|
88
|
+
target="_blank"
|
|
89
|
+
rel="noopener noreferrer"
|
|
90
|
+
onpointerdown={containPointerDown}
|
|
91
|
+
onmousedown={containPointerDown}
|
|
92
|
+
onclick={(event) => event.stopPropagation()}>{ruleId}</a
|
|
93
|
+
>{:else}<span
|
|
94
|
+
data-ui-component="editor"
|
|
95
|
+
data-ui-part="lint-rule-code"
|
|
96
|
+
data-testid="lapis-lint-rule">{ruleId}</span
|
|
97
|
+
>{/if}{#if sourceLabel}){/if}{/if}
|
|
98
|
+
</span>
|
|
99
|
+
{/if}
|
|
100
|
+
|
|
101
|
+
{#if includeCopy}
|
|
102
|
+
<Button
|
|
103
|
+
type="button"
|
|
104
|
+
variant="ghost"
|
|
105
|
+
size="icon-xs"
|
|
106
|
+
data-ui-component="editor"
|
|
107
|
+
data-ui-part="lint-copy"
|
|
108
|
+
data-testid="lapis-lint-copy"
|
|
109
|
+
aria-label="Copy diagnostic message"
|
|
110
|
+
onpointerdown={containPointerDown}
|
|
111
|
+
onmousedown={containPointerDown}
|
|
112
|
+
onclick={copyMessage}
|
|
113
|
+
>
|
|
114
|
+
<WorkspaceIcon name="copy" />
|
|
115
|
+
</Button>
|
|
116
|
+
{/if}
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{#if showFooter}
|
|
121
|
+
<div
|
|
122
|
+
data-ui-component="editor"
|
|
123
|
+
data-ui-part="lint-footer"
|
|
124
|
+
data-testid="lapis-lint-footer"
|
|
125
|
+
>
|
|
126
|
+
{#if quickFixActions.length > 0}
|
|
127
|
+
<DropdownMenu.Root>
|
|
128
|
+
<DropdownMenu.Trigger
|
|
129
|
+
class="ui-editor-lint-quick-fix"
|
|
130
|
+
data-ui-component="editor"
|
|
131
|
+
data-ui-part="lint-quick-fix"
|
|
132
|
+
data-testid="lapis-lint-quick-fix"
|
|
133
|
+
aria-label="Quick Fix"
|
|
134
|
+
title="Quick Fix"
|
|
135
|
+
onpointerdown={stopRowActivation}
|
|
136
|
+
onmousedown={stopRowActivation}
|
|
137
|
+
>
|
|
138
|
+
Quick Fix
|
|
139
|
+
</DropdownMenu.Trigger>
|
|
140
|
+
<DropdownMenu.Portal>
|
|
141
|
+
<DropdownMenu.Content
|
|
142
|
+
class="ui-workspace-menu__content"
|
|
143
|
+
data-ui-component="workspace-menu"
|
|
144
|
+
data-ui-part="content"
|
|
145
|
+
data-lint-quick-fix-menu=""
|
|
146
|
+
align="start"
|
|
147
|
+
side="bottom"
|
|
148
|
+
sideOffset={4}
|
|
149
|
+
strategy="fixed"
|
|
150
|
+
collisionBoundary={[]}
|
|
151
|
+
onpointerdown={stopRowActivation}
|
|
152
|
+
>
|
|
153
|
+
<WorkspaceMenuItems menu={quickFixMenu} />
|
|
154
|
+
</DropdownMenu.Content>
|
|
155
|
+
</DropdownMenu.Portal>
|
|
156
|
+
</DropdownMenu.Root>
|
|
157
|
+
{/if}
|
|
158
|
+
{#if viewProblem}
|
|
159
|
+
<Button
|
|
160
|
+
type="button"
|
|
161
|
+
variant="link"
|
|
162
|
+
size="xs"
|
|
163
|
+
data-ui-component="editor"
|
|
164
|
+
data-ui-part="lint-action"
|
|
165
|
+
data-testid="lapis-lint-action"
|
|
166
|
+
aria-label={viewProblem.name}
|
|
167
|
+
onpointerdown={containPointerDown}
|
|
168
|
+
onmousedown={containPointerDown}
|
|
169
|
+
onclick={viewProblem.onClick}
|
|
170
|
+
>
|
|
171
|
+
{viewProblem.name}
|
|
172
|
+
</Button>
|
|
173
|
+
{/if}
|
|
174
|
+
</div>
|
|
175
|
+
{/if}
|
|
176
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type LintTooltipAction } from "./lint-tooltip-actions";
|
|
2
|
+
import "../../editor.css";
|
|
3
|
+
type Props = {
|
|
4
|
+
message: string;
|
|
5
|
+
ruleId?: string;
|
|
6
|
+
ruleUrl?: string;
|
|
7
|
+
sourceLabel?: string;
|
|
8
|
+
includeCopy?: boolean;
|
|
9
|
+
actions?: LintTooltipAction[];
|
|
10
|
+
};
|
|
11
|
+
declare const LapisLintTooltip: import("svelte").Component<Props, {
|
|
12
|
+
LintTooltipAction: typeof LintTooltipAction;
|
|
13
|
+
}, "">;
|
|
14
|
+
type LapisLintTooltip = ReturnType<typeof LapisLintTooltip>;
|
|
15
|
+
export default LapisLintTooltip;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WorkspaceMenu } from "@lapismd/design-core/workspace/core";
|
|
2
|
+
export declare const VIEW_PROBLEM_ACTION = "View Problem";
|
|
3
|
+
export type LintTooltipAction = {
|
|
4
|
+
name: string;
|
|
5
|
+
onClick: (event: MouseEvent) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function splitLintTooltipActions(actions: readonly LintTooltipAction[]): {
|
|
8
|
+
viewProblem: LintTooltipAction | undefined;
|
|
9
|
+
quickFixActions: LintTooltipAction[];
|
|
10
|
+
};
|
|
11
|
+
export declare function createLintQuickFixMenu(actions: readonly LintTooltipAction[]): WorkspaceMenu;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WorkspaceMenu } from "@lapismd/design-core/workspace/core";
|
|
2
|
+
export const VIEW_PROBLEM_ACTION = "View Problem";
|
|
3
|
+
export function splitLintTooltipActions(actions) {
|
|
4
|
+
return {
|
|
5
|
+
viewProblem: actions.find((action) => action.name === VIEW_PROBLEM_ACTION),
|
|
6
|
+
quickFixActions: actions.filter((action) => action.name !== VIEW_PROBLEM_ACTION),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function createLintQuickFixMenu(actions) {
|
|
10
|
+
const menu = new WorkspaceMenu();
|
|
11
|
+
for (const action of actions) {
|
|
12
|
+
menu.addItem((item) => item
|
|
13
|
+
.setTitle(action.name)
|
|
14
|
+
.setIcon("lightbulb")
|
|
15
|
+
.setSection("fix")
|
|
16
|
+
.onClick((event) => {
|
|
17
|
+
action.onClick(event instanceof MouseEvent ? event : new MouseEvent("click"));
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
return menu;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Action } from "@codemirror/lint";
|
|
2
|
+
import type { EditorView } from "@codemirror/view";
|
|
3
|
+
import type { LapisLintDiagnosticMeta } from "./lapis-lint-diagnostic-helpers";
|
|
4
|
+
export interface MountLintMessageDomOptions {
|
|
5
|
+
view?: EditorView;
|
|
6
|
+
from?: number;
|
|
7
|
+
to?: number;
|
|
8
|
+
actions?: Action[];
|
|
9
|
+
onAction?: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Mount the Lapis lint tooltip Svelte component into a container for CodeMirror
|
|
13
|
+
* `renderMessage`. Unmounts when the tooltip node is removed from the
|
|
14
|
+
* document.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mountLintMessageDom(message: string, meta?: LapisLintDiagnosticMeta, includeCopy?: boolean, options?: MountLintMessageDomOptions): HTMLElement;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { mount, unmount } from "svelte";
|
|
2
|
+
import LapisLintTooltip from "./lapis-lint-tooltip.svelte";
|
|
3
|
+
function observeUnmountWhenDetached(host, destroy, targetDocument) {
|
|
4
|
+
if (typeof MutationObserver === "undefined" || !targetDocument.body) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const observer = new MutationObserver(() => {
|
|
8
|
+
if (host.isConnected) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
observer.disconnect();
|
|
12
|
+
destroy();
|
|
13
|
+
});
|
|
14
|
+
observer.observe(targetDocument.body, { childList: true, subtree: true });
|
|
15
|
+
}
|
|
16
|
+
function ruleLabel(meta) {
|
|
17
|
+
const label = meta.ruleId ?? meta.code;
|
|
18
|
+
return label == null ? undefined : String(label);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Mount the Lapis lint tooltip Svelte component into a container for CodeMirror
|
|
22
|
+
* `renderMessage`. Unmounts when the tooltip node is removed from the
|
|
23
|
+
* document.
|
|
24
|
+
*/
|
|
25
|
+
export function mountLintMessageDom(message, meta = {}, includeCopy = true, options = {}) {
|
|
26
|
+
const { view, from, to, actions = [], onAction } = options;
|
|
27
|
+
const targetDocument = view?.dom?.ownerDocument ?? document;
|
|
28
|
+
const root = targetDocument.createElement("div");
|
|
29
|
+
const label = ruleLabel(meta);
|
|
30
|
+
const href = meta.ruleUrl;
|
|
31
|
+
const showRule = label != null && href != null;
|
|
32
|
+
const tooltipActions = actions.length > 0 && view != null && from != null && to != null
|
|
33
|
+
? actions.map((action) => ({
|
|
34
|
+
name: action.name,
|
|
35
|
+
onClick: (event) => {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
try {
|
|
39
|
+
action.apply(view, from, to);
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
onAction?.();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
}))
|
|
46
|
+
: [];
|
|
47
|
+
const component = mount(LapisLintTooltip, {
|
|
48
|
+
target: root,
|
|
49
|
+
props: {
|
|
50
|
+
message,
|
|
51
|
+
ruleId: showRule ? label : undefined,
|
|
52
|
+
ruleUrl: showRule ? href : undefined,
|
|
53
|
+
sourceLabel: meta.sourceLabel,
|
|
54
|
+
includeCopy,
|
|
55
|
+
actions: tooltipActions,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
observeUnmountWhenDetached(root, () => unmount(component), targetDocument);
|
|
59
|
+
return root;
|
|
60
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EditorView } from "@codemirror/view";
|
|
2
|
+
import type { Extension, SelectionRange, StateEffect } from "@codemirror/state";
|
|
3
|
+
interface SearchConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Whether to position the search panel at the top of the editor (the default
|
|
6
|
+
* is at the bottom).
|
|
7
|
+
*/
|
|
8
|
+
top?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to enable case sensitivity by default when the search panel is
|
|
11
|
+
* activated (defaults to false).
|
|
12
|
+
*/
|
|
13
|
+
caseSensitive?: boolean;
|
|
14
|
+
/** Whether to treat string searches literally by default (defaults to false). */
|
|
15
|
+
literal?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Controls whether the default query has by-word matching enabled. Defaults
|
|
18
|
+
* to false.
|
|
19
|
+
*/
|
|
20
|
+
wholeWord?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Used to turn on regular expression search in the default query. Defaults to
|
|
23
|
+
* false.
|
|
24
|
+
*/
|
|
25
|
+
regexp?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* By default, matches are scrolled into view using the default behavior of
|
|
28
|
+
* [`EditorView.scrollIntoView`](https://codemirror.net/6/docs/ref/#view.EditorView^scrollIntoView).
|
|
29
|
+
* This option allows you to pass a custom function to produce the scroll
|
|
30
|
+
* effect.
|
|
31
|
+
*/
|
|
32
|
+
scrollToMatch?: (range: SelectionRange, view: EditorView) => StateEffect<unknown>;
|
|
33
|
+
}
|
|
34
|
+
export declare function search(config?: Partial<SearchConfig>): Extension;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EditorView } from "@codemirror/view";
|
|
2
|
+
import FindReplace from "./search.svelte";
|
|
3
|
+
import { search as editorSearch } from "@codemirror/search";
|
|
4
|
+
import { mount, unmount } from "svelte";
|
|
5
|
+
import { createSearchPanelHost, focusSearchPanelInput } from "./dom";
|
|
6
|
+
class SearchPanel {
|
|
7
|
+
view;
|
|
8
|
+
component;
|
|
9
|
+
dom;
|
|
10
|
+
constructor(view) {
|
|
11
|
+
this.view = view;
|
|
12
|
+
this.dom = createSearchPanelHost(view.dom.ownerDocument);
|
|
13
|
+
this.component = mount(FindReplace, {
|
|
14
|
+
target: this.dom,
|
|
15
|
+
props: { view },
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
mount() {
|
|
19
|
+
focusSearchPanelInput(this.dom);
|
|
20
|
+
}
|
|
21
|
+
destroy() {
|
|
22
|
+
unmount(this.component);
|
|
23
|
+
}
|
|
24
|
+
get top() {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function search(config = {}) {
|
|
29
|
+
const cfg = {
|
|
30
|
+
top: true,
|
|
31
|
+
caseSensitive: false,
|
|
32
|
+
literal: false,
|
|
33
|
+
wholeWord: false,
|
|
34
|
+
regexp: false,
|
|
35
|
+
scrollToMatch: (range) => EditorView.scrollIntoView(range),
|
|
36
|
+
...config,
|
|
37
|
+
};
|
|
38
|
+
return editorSearch({
|
|
39
|
+
...cfg,
|
|
40
|
+
createPanel: (view) => {
|
|
41
|
+
return new SearchPanel(view);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|