@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,426 @@
|
|
|
1
|
+
import { LRLanguage, LanguageSupport } from "@codemirror/language";
|
|
2
|
+
import { styleTags, tags } from "@lezer/highlight";
|
|
3
|
+
import { parser } from "./parser";
|
|
4
|
+
const configuredParser = parser.configure({
|
|
5
|
+
props: [
|
|
6
|
+
styleTags({
|
|
7
|
+
OrKeyword: tags.keyword,
|
|
8
|
+
NullKeyword: tags.atom,
|
|
9
|
+
Negation: tags.operator,
|
|
10
|
+
Word: tags.variableName,
|
|
11
|
+
SlashWord: tags.variableName,
|
|
12
|
+
Identifier: tags.variableName,
|
|
13
|
+
FieldName: tags.attributeName,
|
|
14
|
+
"FieldName/Identifier": tags.attributeName,
|
|
15
|
+
PropertyName: tags.propertyName,
|
|
16
|
+
"PropertyName/Identifier": tags.propertyName,
|
|
17
|
+
"PropertyName/Phrase": tags.propertyName,
|
|
18
|
+
ComparisonOperator: tags.operator,
|
|
19
|
+
Phrase: tags.string,
|
|
20
|
+
Regex: tags.regexp,
|
|
21
|
+
"( )": tags.bracket,
|
|
22
|
+
"[ ]": tags.bracket,
|
|
23
|
+
":": tags.punctuation,
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
export const searchQueryParser = configuredParser;
|
|
28
|
+
export const searchQueryLanguage = LRLanguage.define({
|
|
29
|
+
parser: configuredParser,
|
|
30
|
+
languageData: {
|
|
31
|
+
closeBrackets: {
|
|
32
|
+
brackets: ["(", "[", '"', "/"],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export function searchQueryLanguageSupport() {
|
|
37
|
+
return new LanguageSupport(searchQueryLanguage);
|
|
38
|
+
}
|
|
39
|
+
const SAFE_SEARCH_QUERY_WORD = /^[A-Za-z0-9_.#*?][A-Za-z0-9_.#*?/]*$/u;
|
|
40
|
+
const SAFE_SEARCH_QUERY_IDENTIFIER = /^[A-Za-z0-9_]+(?:-[A-Za-z0-9_]+)*$/u;
|
|
41
|
+
const RESERVED_SEARCH_QUERY_WORDS = new Set(["OR", "null"]);
|
|
42
|
+
/** Formats a dynamic field value so it round-trips through the search parser. */
|
|
43
|
+
export function formatSearchQueryValue(value) {
|
|
44
|
+
if (!RESERVED_SEARCH_QUERY_WORDS.has(value) &&
|
|
45
|
+
(SAFE_SEARCH_QUERY_WORD.test(value) ||
|
|
46
|
+
SAFE_SEARCH_QUERY_IDENTIFIER.test(value))) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
return `"${value
|
|
50
|
+
.replaceAll("\\", "\\\\")
|
|
51
|
+
.replaceAll('"', '\\"')
|
|
52
|
+
.replaceAll("\n", "\\n")
|
|
53
|
+
.replaceAll("\r", "\\r")
|
|
54
|
+
.replaceAll("\t", "\\t")}"`;
|
|
55
|
+
}
|
|
56
|
+
/** Builds the shared, parser-safe field catalog for vault search surfaces. */
|
|
57
|
+
export function createVaultSearchFilterSyntax({ fileNames, paths, tags: tagValues, }) {
|
|
58
|
+
const values = (items) => [...new Set(items)]
|
|
59
|
+
.sort((left, right) => left.localeCompare(right))
|
|
60
|
+
.slice(0, 100)
|
|
61
|
+
.map((value) => ({ value, apply: formatSearchQueryValue(value) }));
|
|
62
|
+
return {
|
|
63
|
+
title: "Vault search syntax",
|
|
64
|
+
description: "Combine text with file, path, tag, content, line, section, and bracket-property filters.",
|
|
65
|
+
fields: [
|
|
66
|
+
{
|
|
67
|
+
name: "file",
|
|
68
|
+
description: "File name",
|
|
69
|
+
operators: [":"],
|
|
70
|
+
values: values(fileNames),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "path",
|
|
74
|
+
description: "Folder or path",
|
|
75
|
+
operators: [":"],
|
|
76
|
+
values: values(paths),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "tag",
|
|
80
|
+
description: "Markdown or frontmatter tag",
|
|
81
|
+
operators: [":"],
|
|
82
|
+
values: values(tagValues),
|
|
83
|
+
},
|
|
84
|
+
{ name: "content", description: "Note content", operators: [":"] },
|
|
85
|
+
{ name: "line", description: "Terms on one line", operators: [":"] },
|
|
86
|
+
{
|
|
87
|
+
name: "section",
|
|
88
|
+
description: "Terms in one section",
|
|
89
|
+
operators: [":"],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
examples: [
|
|
93
|
+
{ query: "tag:#project", description: "Notes with a project tag" },
|
|
94
|
+
{
|
|
95
|
+
query: 'path:"Notes" OR file:Welcome',
|
|
96
|
+
description: "Path or file filters",
|
|
97
|
+
},
|
|
98
|
+
{ query: '["status"]:ready', description: "Exact frontmatter property" },
|
|
99
|
+
],
|
|
100
|
+
notes: ["Use OR for alternatives and -term to exclude a term."],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export function parseSearchQuery(input) {
|
|
104
|
+
return configuredParser.parse(input);
|
|
105
|
+
}
|
|
106
|
+
export function parseSearchQueryAst(input) {
|
|
107
|
+
const tree = parseSearchQuery(input);
|
|
108
|
+
const syntax = snapshotSearchQueryNode(tree.cursor(), input);
|
|
109
|
+
return {
|
|
110
|
+
type: "query",
|
|
111
|
+
from: 0,
|
|
112
|
+
to: input.length,
|
|
113
|
+
text: input,
|
|
114
|
+
expression: lowerSearchQueryNode(findChild(syntax, "Expression")),
|
|
115
|
+
diagnostics: collectSearchQueryDiagnostics(syntax, input),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export function canCollectSearchQueryTerms(value) {
|
|
119
|
+
const expression = unwrapSearchQueryExpression(value);
|
|
120
|
+
if (!expression) {
|
|
121
|
+
return value?.type === "query" ? value.diagnostics.length === 0 : true;
|
|
122
|
+
}
|
|
123
|
+
if (value?.type === "query" && value.diagnostics.length > 0) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
switch (expression.type) {
|
|
127
|
+
case "literal":
|
|
128
|
+
return expression.kind === "word" || expression.kind === "phrase";
|
|
129
|
+
case "property":
|
|
130
|
+
return expression.value === null;
|
|
131
|
+
case "group":
|
|
132
|
+
return expression.expression === null
|
|
133
|
+
? true
|
|
134
|
+
: canCollectSearchQueryTerms(expression.expression);
|
|
135
|
+
case "and":
|
|
136
|
+
return expression.clauses.every((clause) => canCollectSearchQueryTerms(clause));
|
|
137
|
+
default:
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function collectSearchQueryTerms(value) {
|
|
142
|
+
const root = typeof value === "string" ? parseSearchQueryAst(value) : value;
|
|
143
|
+
const expression = unwrapSearchQueryExpression(root);
|
|
144
|
+
if (!canCollectSearchQueryTerms(root)) {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
return collectSearchQueryTermValues(expression);
|
|
148
|
+
}
|
|
149
|
+
export function canCollectSearchQueryPropertyNames(value) {
|
|
150
|
+
const expression = unwrapSearchQueryExpression(value);
|
|
151
|
+
if (!expression) {
|
|
152
|
+
return value?.type === "query" ? value.diagnostics.length === 0 : true;
|
|
153
|
+
}
|
|
154
|
+
if (value?.type === "query" && value.diagnostics.length > 0) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
switch (expression.type) {
|
|
158
|
+
case "property":
|
|
159
|
+
return expression.value === null;
|
|
160
|
+
case "group":
|
|
161
|
+
return expression.expression === null
|
|
162
|
+
? true
|
|
163
|
+
: canCollectSearchQueryPropertyNames(expression.expression);
|
|
164
|
+
case "and":
|
|
165
|
+
return expression.clauses.every((clause) => canCollectSearchQueryPropertyNames(clause));
|
|
166
|
+
case "literal":
|
|
167
|
+
return expression.kind === "word" || expression.kind === "phrase";
|
|
168
|
+
default:
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
export function collectSearchQueryPropertyNames(value) {
|
|
173
|
+
const root = typeof value === "string" ? parseSearchQueryAst(value) : value;
|
|
174
|
+
const expression = unwrapSearchQueryExpression(root);
|
|
175
|
+
if (!canCollectSearchQueryPropertyNames(root)) {
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
return collectSearchQueryPropertyNameValues(expression);
|
|
179
|
+
}
|
|
180
|
+
function snapshotSearchQueryNode(cursor, input) {
|
|
181
|
+
const node = {
|
|
182
|
+
name: cursor.name,
|
|
183
|
+
from: cursor.from,
|
|
184
|
+
to: cursor.to,
|
|
185
|
+
text: input.slice(cursor.from, cursor.to),
|
|
186
|
+
isError: cursor.name === "⚠" || cursor.type.isError,
|
|
187
|
+
children: [],
|
|
188
|
+
};
|
|
189
|
+
if (cursor.firstChild()) {
|
|
190
|
+
do {
|
|
191
|
+
node.children.push(snapshotSearchQueryNode(cursor, input));
|
|
192
|
+
} while (cursor.nextSibling());
|
|
193
|
+
cursor.parent();
|
|
194
|
+
}
|
|
195
|
+
return node;
|
|
196
|
+
}
|
|
197
|
+
function collectSearchQueryDiagnostics(node, input, insideError = false) {
|
|
198
|
+
const diagnostics = [];
|
|
199
|
+
if (node.isError && !insideError) {
|
|
200
|
+
diagnostics.push({
|
|
201
|
+
from: node.from,
|
|
202
|
+
to: node.to,
|
|
203
|
+
severity: "error",
|
|
204
|
+
message: formatSearchQueryDiagnosticMessage(node, input),
|
|
205
|
+
text: node.text,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
for (const child of node.children) {
|
|
209
|
+
diagnostics.push(...collectSearchQueryDiagnostics(child, input, insideError || node.isError));
|
|
210
|
+
}
|
|
211
|
+
return diagnostics;
|
|
212
|
+
}
|
|
213
|
+
function formatSearchQueryDiagnosticMessage(node, input) {
|
|
214
|
+
const token = node.text.trim();
|
|
215
|
+
if (!token.length) {
|
|
216
|
+
return node.from >= input.length
|
|
217
|
+
? "Incomplete search query"
|
|
218
|
+
: "Invalid search query syntax";
|
|
219
|
+
}
|
|
220
|
+
return `Unexpected token ${JSON.stringify(token)}`;
|
|
221
|
+
}
|
|
222
|
+
function lowerSearchQueryNode(node) {
|
|
223
|
+
if (!node)
|
|
224
|
+
return null;
|
|
225
|
+
switch (node.name) {
|
|
226
|
+
case "Expression":
|
|
227
|
+
case "PrimaryExpression":
|
|
228
|
+
case "FieldValue":
|
|
229
|
+
case "PropertyValue":
|
|
230
|
+
case "ComparisonValue":
|
|
231
|
+
return lowerFirstExpressionChild(node);
|
|
232
|
+
case "OrExpression":
|
|
233
|
+
return lowerClauseSequence(node, "AndExpression", "or", "clauses");
|
|
234
|
+
case "AndExpression":
|
|
235
|
+
return lowerClauseSequence(node, "PrefixExpression", "and", "clauses");
|
|
236
|
+
case "PrefixExpression": {
|
|
237
|
+
const operand = lowerSearchQueryNode(findChild(node, "PrimaryExpression"));
|
|
238
|
+
if (!findChild(node, "Negation")) {
|
|
239
|
+
return operand;
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
type: "not",
|
|
243
|
+
operand,
|
|
244
|
+
...nodeRange(node),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
case "Group":
|
|
248
|
+
return {
|
|
249
|
+
type: "group",
|
|
250
|
+
expression: lowerSearchQueryNode(findChild(node, "Expression")),
|
|
251
|
+
...nodeRange(node),
|
|
252
|
+
};
|
|
253
|
+
case "FieldExpression":
|
|
254
|
+
return {
|
|
255
|
+
type: "field",
|
|
256
|
+
name: readIdentifier(findChild(node, "FieldName")),
|
|
257
|
+
value: lowerSearchQueryNode(findChild(node, "FieldValue")),
|
|
258
|
+
...nodeRange(node),
|
|
259
|
+
};
|
|
260
|
+
case "PropertyExpression":
|
|
261
|
+
return {
|
|
262
|
+
type: "property",
|
|
263
|
+
name: readPropertyName(findChild(node, "PropertyName")),
|
|
264
|
+
value: lowerSearchQueryNode(findChild(node, "PropertyValue")),
|
|
265
|
+
...nodeRange(node),
|
|
266
|
+
};
|
|
267
|
+
case "Comparison":
|
|
268
|
+
return {
|
|
269
|
+
type: "comparison",
|
|
270
|
+
operator: readComparisonOperator(findChild(node, "ComparisonOperator")),
|
|
271
|
+
value: lowerSearchQueryLiteral(findChild(node, "ComparisonValue")),
|
|
272
|
+
...nodeRange(node),
|
|
273
|
+
};
|
|
274
|
+
case "SlashWord":
|
|
275
|
+
case "Word":
|
|
276
|
+
case "Identifier":
|
|
277
|
+
return {
|
|
278
|
+
type: "literal",
|
|
279
|
+
kind: "word",
|
|
280
|
+
value: node.text,
|
|
281
|
+
...nodeRange(node),
|
|
282
|
+
};
|
|
283
|
+
case "Phrase":
|
|
284
|
+
return {
|
|
285
|
+
type: "literal",
|
|
286
|
+
kind: "phrase",
|
|
287
|
+
value: decodeSearchQueryPhrase(node.text),
|
|
288
|
+
...nodeRange(node),
|
|
289
|
+
};
|
|
290
|
+
case "Regex":
|
|
291
|
+
return {
|
|
292
|
+
type: "literal",
|
|
293
|
+
kind: "regex",
|
|
294
|
+
value: stripSearchQueryDelimiter(node.text),
|
|
295
|
+
...nodeRange(node),
|
|
296
|
+
};
|
|
297
|
+
case "NullKeyword":
|
|
298
|
+
return {
|
|
299
|
+
type: "literal",
|
|
300
|
+
kind: "null",
|
|
301
|
+
value: null,
|
|
302
|
+
...nodeRange(node),
|
|
303
|
+
};
|
|
304
|
+
default:
|
|
305
|
+
return lowerFirstExpressionChild(node);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function lowerClauseSequence(node, childName, type, key) {
|
|
309
|
+
const clauses = node.children
|
|
310
|
+
.filter((child) => child.name === childName)
|
|
311
|
+
.map((child) => lowerSearchQueryNode(child))
|
|
312
|
+
.filter((child) => child !== null);
|
|
313
|
+
if (!clauses.length)
|
|
314
|
+
return null;
|
|
315
|
+
if (clauses.length === 1)
|
|
316
|
+
return clauses[0];
|
|
317
|
+
return {
|
|
318
|
+
type,
|
|
319
|
+
[key]: clauses,
|
|
320
|
+
...nodeRange(node),
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function lowerFirstExpressionChild(node) {
|
|
324
|
+
for (const child of node.children) {
|
|
325
|
+
const lowered = lowerSearchQueryNode(child);
|
|
326
|
+
if (lowered) {
|
|
327
|
+
return lowered;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
function lowerSearchQueryLiteral(node) {
|
|
333
|
+
const lowered = lowerSearchQueryNode(node);
|
|
334
|
+
if (lowered?.type === "literal") {
|
|
335
|
+
return lowered;
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
function findChild(node, name) {
|
|
340
|
+
return node.children.find((child) => child.name === name);
|
|
341
|
+
}
|
|
342
|
+
function readIdentifier(node) {
|
|
343
|
+
if (!node)
|
|
344
|
+
return "";
|
|
345
|
+
const identifier = findChild(node, "Identifier");
|
|
346
|
+
return (identifier ?? node).text;
|
|
347
|
+
}
|
|
348
|
+
function readPropertyName(node) {
|
|
349
|
+
if (!node)
|
|
350
|
+
return "";
|
|
351
|
+
const phrase = findChild(node, "Phrase");
|
|
352
|
+
if (phrase) {
|
|
353
|
+
return decodeSearchQueryPhrase(phrase.text);
|
|
354
|
+
}
|
|
355
|
+
return readIdentifier(node);
|
|
356
|
+
}
|
|
357
|
+
function readComparisonOperator(node) {
|
|
358
|
+
const value = node?.text;
|
|
359
|
+
if (value === "<" || value === "<=" || value === ">" || value === ">=") {
|
|
360
|
+
return value;
|
|
361
|
+
}
|
|
362
|
+
return "<";
|
|
363
|
+
}
|
|
364
|
+
function stripSearchQueryDelimiter(value) {
|
|
365
|
+
if (value.length < 2)
|
|
366
|
+
return value;
|
|
367
|
+
return value.slice(1, -1);
|
|
368
|
+
}
|
|
369
|
+
function decodeSearchQueryPhrase(value) {
|
|
370
|
+
return stripSearchQueryDelimiter(value).replace(/\\(["\\nrt])/gu, (_match, escaped) => {
|
|
371
|
+
switch (escaped) {
|
|
372
|
+
case "n":
|
|
373
|
+
return "\n";
|
|
374
|
+
case "r":
|
|
375
|
+
return "\r";
|
|
376
|
+
case "t":
|
|
377
|
+
return "\t";
|
|
378
|
+
default:
|
|
379
|
+
return escaped;
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
function nodeRange(node) {
|
|
384
|
+
return {
|
|
385
|
+
from: node.from,
|
|
386
|
+
to: node.to,
|
|
387
|
+
text: node.text,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function unwrapSearchQueryExpression(value) {
|
|
391
|
+
if (!value)
|
|
392
|
+
return null;
|
|
393
|
+
return value.type === "query" ? value.expression : value;
|
|
394
|
+
}
|
|
395
|
+
function collectSearchQueryTermValues(expression) {
|
|
396
|
+
if (!expression)
|
|
397
|
+
return [];
|
|
398
|
+
switch (expression.type) {
|
|
399
|
+
case "literal":
|
|
400
|
+
return expression.value ? [expression.value.toLowerCase()] : [];
|
|
401
|
+
case "property":
|
|
402
|
+
return expression.value === null ? [expression.name.toLowerCase()] : [];
|
|
403
|
+
case "group":
|
|
404
|
+
return collectSearchQueryTermValues(expression.expression);
|
|
405
|
+
case "and":
|
|
406
|
+
return expression.clauses.flatMap((clause) => collectSearchQueryTermValues(clause));
|
|
407
|
+
default:
|
|
408
|
+
return [];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function collectSearchQueryPropertyNameValues(expression) {
|
|
412
|
+
if (!expression)
|
|
413
|
+
return [];
|
|
414
|
+
switch (expression.type) {
|
|
415
|
+
case "property":
|
|
416
|
+
return expression.value === null ? [expression.name.toLowerCase()] : [];
|
|
417
|
+
case "group":
|
|
418
|
+
return collectSearchQueryPropertyNameValues(expression.expression);
|
|
419
|
+
case "and":
|
|
420
|
+
return expression.clauses.flatMap((clause) => collectSearchQueryPropertyNameValues(clause));
|
|
421
|
+
case "literal":
|
|
422
|
+
return [];
|
|
423
|
+
default:
|
|
424
|
+
return [];
|
|
425
|
+
}
|
|
426
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import {LRParser} from "@lezer/lr"
|
|
3
|
+
export const parser = LRParser.deserialize({
|
|
4
|
+
version: 14,
|
|
5
|
+
states: "%pQVQPOOOtQPO'#CdO{QPO'#CfO!vQPO'#CiO#OQPO'#CeOOQO'#Cc'#CcOOQO'#Ca'#CaOYQPO'#CaOOQO'#Cu'#CuO#TQPO'#C`O#bQPO'#C_OOQO'#C^'#C^QOQPOOOOQO,59O,59OO#mQPO,59OOOQO'#Cj'#CjO#rQPO,59TO#zQPO,59POOQO,58{,58{OOQO-E6s-E6sOVQPO'#CvO$fQPO,58yOOQO1G.j1G.jO$qQPO1G.oO%lQPO1G.oOOQO'#Ch'#ChOOQO1G.k1G.kOOQO,59b,59bOOQO-E6t-E6tO%lQPO7+$ZO&WQPO'#CmOOQO'#Cl'#ClO&iQPO7+$ZOOQO<<Gu<<GuOOQO'#Co'#CoOOQO,59X,59X",
|
|
6
|
+
stateData: "&v~OmOS~OUVOZQO_TOdTOeTOfTOgTOnPOqRO~Oo]O~PVOUVXZVX_VXdVXeVXfVXgVXhVXkVXnVXpYXqVXoVX~OZ_O__O~OpaO~OhSXkSXoSX~PVOhdOkRXoRX~OofO~OphOrgO~OZiO_iOdiOeiOfiOgiOnPOqRO~OhdOkRaoRa~OpmOU]iZ]i_]id]ie]if]ig]ih]ik]in]iq]io]i~OZoO_oObnOdoOeoOfoOgoOnPO~OZrO_rOdrOerOfrO~OrqO~OhdeZbfZ~",
|
|
7
|
+
goto: "#skPPlrv}P!T!^!l!sP!z!}#XP#[!hP#bPPPPP#e#mQ[OR^PTZOPSYOPRkdXWOPXdWUOPXdRbVYTOPVXdQiaTohmZTOPVXdZSOPVXdRjaYTOPVXdRiaR`RQphRqmRsnUXOPdRcXQeYRle",
|
|
8
|
+
nodeNames: "⚠ Query Expression OrExpression AndExpression PrefixExpression Negation PrimaryExpression Group FieldExpression FieldName Identifier FieldValue PropertyExpression PropertyName Phrase PropertyValue Comparison ComparisonOperator ComparisonValue NullKeyword SlashWord Word Regex OrKeyword",
|
|
9
|
+
maxTerm: 34,
|
|
10
|
+
skippedNodes: [0],
|
|
11
|
+
repeatNodeCount: 2,
|
|
12
|
+
tokenData: "2}~RpX^#Vpq#Vrs#zst&sxy(Xyz(^z{&s}!O(c!O!P&s!P!Q(h!Q![+a![!],{!^!_-Q!`!a-Q!a!b&s!c!q+a!q!r-_!r!}+a!}#O/T#P#Q/Y#R#S+a#T#b+a#b#c/_#c#o+a#y#z#V$f$g#V#BY#BZ#V$IS$I_#V$I|$JO#V$JT$JU#V$KV$KW#V&FU&FV#V~#[Ym~X^#Vpq#V#y#z#V$f$g#V#BY#BZ#V$IS$I_#V$I|$JO#V$JT$JU#V$KV$KW#V&FU&FV#V~#}XOY#zZ]#z^r#zrs$js#O#z#O#P$o#P;'S#z;'S;=`&m<%lO#z~$oO_~~$rmOX#zX^#z^p#zpq#zq!Q#z!QW!Q#O(h#O#P)]#P;'S(h;'S;=`+Z<%lO(h~)]Og~~)`mOX(hX^(h^p(hpq(hq!Q(h!Q![(h![!c(h!c!}(h!}#T(h#T#o(h#o#y(h#y#z(h#z$f(h$f$g(h$g#BY(h#BY#BZ(h#BZ$IS(h$IS$I_(h$I_$I|(h$I|$JO(h$JO$JT(h$JT$JU(h$JU$KV(h$KV$KW(h$KW&FU(h&FU&FV(h&FV;'S(h;'S;=`+Z<%lO(h~+^P;=`<%l(h~+hYZ~f~st&sz{&s}!O,W!O!P&s!P!Q'e!Q![+a!a!b&s!c!}+a#R#S+a#T#o+a~,ZS!Q![,g!c!},g#R#S,g#T#o,g~,lTZ~}!O,W!Q![,g!c!},g#R#S,g#T#o,g~-QOp~~-VPb~!_!`-Y~-_Ob~~-f[Z~f~st&sz{&s}!O,W!O!P&s!P!Q'e!Q![+a!a!b&s!c!t+a!t!u.[!u!}+a#R#S+a#T#o+a~.eYh~Z~f~st&sz{&s}!O,W!O!P&s!P!Q'e!Q![+a!a!b&s!c!}+a#R#S+a#T#o+a~/YOq~~/_Or~~/f[Z~f~st&sz{&s}!O,W!O!P&s!P!Q'e!Q![+a!a!b&s!c!}+a#R#S+a#T#i+a#i#j0[#j#o+a~0c[Z~f~st&sz{&s}!O,W!O!P&s!P!Q'e!Q![+a!a!b&s!c!}+a#R#S+a#T#`+a#`#a1X#a#o+a~1`[Z~f~st&sz{&s}!O,W!O!P&s!P!Q'e!Q![+a!a!b&s!c!}+a#R#S+a#T#`+a#`#a2U#a#o+a~2_Yd~Z~f~st&sz{&s}!O,W!O!P&s!P!Q'e!Q![+a!a!b&s!c!}+a#R#S+a#T#o+a",
|
|
13
|
+
tokenizers: [0],
|
|
14
|
+
topRules: {"Query":[0,1]},
|
|
15
|
+
tokenPrec: 260
|
|
16
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
export const
|
|
3
|
+
Query = 1,
|
|
4
|
+
Expression = 2,
|
|
5
|
+
OrExpression = 3,
|
|
6
|
+
AndExpression = 4,
|
|
7
|
+
PrefixExpression = 5,
|
|
8
|
+
Negation = 6,
|
|
9
|
+
PrimaryExpression = 7,
|
|
10
|
+
Group = 8,
|
|
11
|
+
FieldExpression = 9,
|
|
12
|
+
FieldName = 10,
|
|
13
|
+
Identifier = 11,
|
|
14
|
+
FieldValue = 12,
|
|
15
|
+
PropertyExpression = 13,
|
|
16
|
+
PropertyName = 14,
|
|
17
|
+
Phrase = 15,
|
|
18
|
+
PropertyValue = 16,
|
|
19
|
+
Comparison = 17,
|
|
20
|
+
ComparisonOperator = 18,
|
|
21
|
+
ComparisonValue = 19,
|
|
22
|
+
NullKeyword = 20,
|
|
23
|
+
SlashWord = 21,
|
|
24
|
+
Word = 22,
|
|
25
|
+
Regex = 23,
|
|
26
|
+
OrKeyword = 24
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
@top Query { Expression? }
|
|
2
|
+
|
|
3
|
+
@skip { space }
|
|
4
|
+
|
|
5
|
+
Expression { OrExpression }
|
|
6
|
+
|
|
7
|
+
OrExpression {
|
|
8
|
+
AndExpression (OrKeyword AndExpression)*
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
AndExpression {
|
|
12
|
+
PrefixExpression+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
PrefixExpression {
|
|
16
|
+
Negation? PrimaryExpression
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
PrimaryExpression {
|
|
20
|
+
Group |
|
|
21
|
+
FieldExpression |
|
|
22
|
+
PropertyExpression |
|
|
23
|
+
Regex |
|
|
24
|
+
Phrase |
|
|
25
|
+
NullKeyword |
|
|
26
|
+
SlashWord |
|
|
27
|
+
Identifier |
|
|
28
|
+
Word
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Group {
|
|
32
|
+
"(" Expression? ")"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
FieldExpression {
|
|
36
|
+
FieldName ":" FieldValue
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
FieldName {
|
|
40
|
+
Identifier
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
FieldValue {
|
|
44
|
+
Group |
|
|
45
|
+
PropertyExpression |
|
|
46
|
+
Regex |
|
|
47
|
+
Phrase |
|
|
48
|
+
NullKeyword |
|
|
49
|
+
SlashWord |
|
|
50
|
+
Identifier |
|
|
51
|
+
Word
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
PropertyExpression {
|
|
55
|
+
"[" PropertyName "]" |
|
|
56
|
+
"[" PropertyName "]" ":" PropertyValue |
|
|
57
|
+
"[" PropertyName ":" PropertyValue "]"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
PropertyName {
|
|
61
|
+
Identifier |
|
|
62
|
+
Phrase
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
PropertyValue {
|
|
66
|
+
Comparison |
|
|
67
|
+
Group |
|
|
68
|
+
Regex |
|
|
69
|
+
Phrase |
|
|
70
|
+
NullKeyword |
|
|
71
|
+
SlashWord |
|
|
72
|
+
Identifier |
|
|
73
|
+
Word
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Comparison {
|
|
77
|
+
ComparisonOperator ComparisonValue
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ComparisonValue {
|
|
81
|
+
Phrase |
|
|
82
|
+
NullKeyword |
|
|
83
|
+
SlashWord |
|
|
84
|
+
Identifier |
|
|
85
|
+
Word
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@tokens {
|
|
89
|
+
space { @whitespace+ }
|
|
90
|
+
|
|
91
|
+
@precedence {
|
|
92
|
+
OrKeyword,
|
|
93
|
+
NullKeyword,
|
|
94
|
+
SlashWord,
|
|
95
|
+
Identifier,
|
|
96
|
+
ComparisonOperator,
|
|
97
|
+
Word
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
OrKeyword { "OR" }
|
|
101
|
+
NullKeyword { "null" }
|
|
102
|
+
Negation { "-" }
|
|
103
|
+
|
|
104
|
+
Identifier { identifierChar+ ("-" identifierChar+)* }
|
|
105
|
+
|
|
106
|
+
ComparisonOperator { "<=" | ">=" | "<" | ">" }
|
|
107
|
+
|
|
108
|
+
SlashWord { wordStartChar wordChar* "/" wordChar* }
|
|
109
|
+
Word { wordStartChar wordChar* }
|
|
110
|
+
|
|
111
|
+
Phrase { '"' phraseChar* '"' }
|
|
112
|
+
Regex { "/" regexChar* "/" }
|
|
113
|
+
|
|
114
|
+
identifierChar { @asciiLetter | @digit | "_" }
|
|
115
|
+
wordStartChar {
|
|
116
|
+
@asciiLetter |
|
|
117
|
+
@digit |
|
|
118
|
+
"_" |
|
|
119
|
+
"." |
|
|
120
|
+
"#" |
|
|
121
|
+
"*" |
|
|
122
|
+
"?"
|
|
123
|
+
}
|
|
124
|
+
wordChar { wordStartChar | "/" }
|
|
125
|
+
phraseChar { !["\\\n\r] | "\\" anyChar }
|
|
126
|
+
regexChar { ![/\\\n\r] | "\\" anyChar }
|
|
127
|
+
anyChar { @asciiLetter | @digit | @whitespace | ![] }
|
|
128
|
+
}
|
package/dist/search.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type SearchMatchPart = [start: number, end: number];
|
|
2
|
+
export type SearchMatches = SearchMatchPart[];
|
|
3
|
+
export interface SearchResult {
|
|
4
|
+
score: number;
|
|
5
|
+
matches: SearchMatches;
|
|
6
|
+
}
|
|
7
|
+
export interface SearchResultContainer {
|
|
8
|
+
score?: number;
|
|
9
|
+
result?: SearchResult;
|
|
10
|
+
}
|
|
11
|
+
export interface FuzzyMatch<T> {
|
|
12
|
+
item: T;
|
|
13
|
+
match: SearchResult;
|
|
14
|
+
}
|
|
15
|
+
export declare function prepareSimpleSearch(query: string): (text: string) => SearchResult | null;
|
|
16
|
+
export declare function prepareFuzzySearch(query: string): (text: string) => SearchResult | null;
|
|
17
|
+
export declare function renderMatches(el: HTMLElement | DocumentFragment, text: string, matches: SearchMatches | null, offset?: number): void;
|
|
18
|
+
export declare function renderResults(el: HTMLElement, text: string, result: SearchResult, offset?: number): void;
|
|
19
|
+
export declare function sortSearchResults(results: SearchResultContainer[]): void;
|