@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,173 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
const DATE_PATTERN = /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/;
|
|
3
|
+
const DATETIME_PATTERN = /^([0-9]{4})-?(1[0-2]|0[1-9])-?(3[01]|0[1-9]|[12][0-9])[T ](2[0-3]|[01][0-9]):?([0-5][0-9])(:?([0-5][0-9]))?$/;
|
|
4
|
+
function coerceCheckbox(value) {
|
|
5
|
+
if (typeof value === "boolean") {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
const normalized = value.toLowerCase().trim();
|
|
10
|
+
if (normalized === "true") {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
if (normalized === "false") {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function coerceNumber(value) {
|
|
20
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
if (typeof value === "string") {
|
|
24
|
+
const trimmed = value.trim();
|
|
25
|
+
if (trimmed === "") {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
const parsed = Number(trimmed);
|
|
29
|
+
if (Number.isFinite(parsed)) {
|
|
30
|
+
return parsed;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
function matchesDate(value) {
|
|
36
|
+
return typeof value === "string" && DATE_PATTERN.test(value.trim());
|
|
37
|
+
}
|
|
38
|
+
function matchesDateTime(value) {
|
|
39
|
+
return typeof value === "string" && DATETIME_PATTERN.test(value.trim());
|
|
40
|
+
}
|
|
41
|
+
function coerceDate(value) {
|
|
42
|
+
if (matchesDate(value)) {
|
|
43
|
+
return typeof value === "string" ? value.trim() : value;
|
|
44
|
+
}
|
|
45
|
+
if (value instanceof Date) {
|
|
46
|
+
return value.toISOString().slice(0, 10);
|
|
47
|
+
}
|
|
48
|
+
if (value instanceof DateTime) {
|
|
49
|
+
return value.toISODate() ?? value;
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
function coerceDateTime(value) {
|
|
54
|
+
if (matchesDateTime(value)) {
|
|
55
|
+
return typeof value === "string" ? value.trim() : value;
|
|
56
|
+
}
|
|
57
|
+
if (value instanceof Date) {
|
|
58
|
+
return value.toISOString().slice(0, 19);
|
|
59
|
+
}
|
|
60
|
+
if (value instanceof DateTime) {
|
|
61
|
+
return value.toISO()?.slice(0, 19) ?? value;
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
function coerceStringList(value) {
|
|
66
|
+
if (Array.isArray(value)) {
|
|
67
|
+
if (value.every((item) => typeof item === "string")) {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
if (typeof value === "string") {
|
|
73
|
+
const trimmed = value.trim();
|
|
74
|
+
if (trimmed === "") {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
if (/[,;]/.test(trimmed)) {
|
|
78
|
+
return trimmed
|
|
79
|
+
.split(/[,;]+/)
|
|
80
|
+
.map((entry) => entry.trim())
|
|
81
|
+
.filter(Boolean);
|
|
82
|
+
}
|
|
83
|
+
return [trimmed];
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
87
|
+
const TAGS_PATTERN = /^(#[/a-zA-Z0-9_-]+\s*,\s*)*(#[/a-zA-Z0-9_-]+\s*)?$/;
|
|
88
|
+
function isPrimitiveMetadataArray(value) {
|
|
89
|
+
return value.every((item) => typeof item === "string" || typeof item === "number");
|
|
90
|
+
}
|
|
91
|
+
/** Infer a metadata type from a raw frontmatter value. */
|
|
92
|
+
export function inferMetadataType(value) {
|
|
93
|
+
if (typeof value === "number") {
|
|
94
|
+
return "number";
|
|
95
|
+
}
|
|
96
|
+
else if (value instanceof Date) {
|
|
97
|
+
return "date";
|
|
98
|
+
}
|
|
99
|
+
else if (value instanceof DateTime) {
|
|
100
|
+
return "datetime";
|
|
101
|
+
}
|
|
102
|
+
else if (typeof value === "boolean") {
|
|
103
|
+
return "checkbox";
|
|
104
|
+
}
|
|
105
|
+
else if (typeof value === "string") {
|
|
106
|
+
if (["true", "false"].includes(value.toLowerCase().trim())) {
|
|
107
|
+
return "checkbox";
|
|
108
|
+
}
|
|
109
|
+
else if (value.match(TAGS_PATTERN)) {
|
|
110
|
+
return "tags";
|
|
111
|
+
}
|
|
112
|
+
else if (value.trim().match(DATE_PATTERN)) {
|
|
113
|
+
return "date";
|
|
114
|
+
}
|
|
115
|
+
else if (value.trim().match(DATETIME_PATTERN)) {
|
|
116
|
+
return "datetime";
|
|
117
|
+
}
|
|
118
|
+
else if (value.trim().match(/^[0-9]+$/)) {
|
|
119
|
+
return "number";
|
|
120
|
+
}
|
|
121
|
+
return "text";
|
|
122
|
+
}
|
|
123
|
+
else if (Array.isArray(value)) {
|
|
124
|
+
return isPrimitiveMetadataArray(value) ? "multitext" : "array";
|
|
125
|
+
}
|
|
126
|
+
else if (value === undefined || value === null) {
|
|
127
|
+
return "text";
|
|
128
|
+
}
|
|
129
|
+
else if (typeof value === "object") {
|
|
130
|
+
return "object";
|
|
131
|
+
}
|
|
132
|
+
return "unknown";
|
|
133
|
+
}
|
|
134
|
+
/** Infer a metadata type from a top-level frontmatter property name and value. */
|
|
135
|
+
export function inferMetadataPropertyType(name, value) {
|
|
136
|
+
const id = name.toLowerCase().trim();
|
|
137
|
+
if (id === "tags" || id === "tag") {
|
|
138
|
+
return "tags";
|
|
139
|
+
}
|
|
140
|
+
if (id === "aliases" || id === "alias") {
|
|
141
|
+
return "aliases";
|
|
142
|
+
}
|
|
143
|
+
return inferMetadataType(value);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Best-effort normalization of a frontmatter value against a declared metadata
|
|
147
|
+
* type. Coerces when unambiguous; otherwise returns the original value.
|
|
148
|
+
*/
|
|
149
|
+
export function normalizeMetadataValue(type, value) {
|
|
150
|
+
if (value === null || value === undefined) {
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
153
|
+
switch (type) {
|
|
154
|
+
case "checkbox":
|
|
155
|
+
return coerceCheckbox(value);
|
|
156
|
+
case "number":
|
|
157
|
+
return coerceNumber(value);
|
|
158
|
+
case "date":
|
|
159
|
+
return coerceDate(value);
|
|
160
|
+
case "datetime":
|
|
161
|
+
return coerceDateTime(value);
|
|
162
|
+
case "aliases":
|
|
163
|
+
case "multitext":
|
|
164
|
+
case "tags":
|
|
165
|
+
return coerceStringList(value);
|
|
166
|
+
case "array":
|
|
167
|
+
case "object":
|
|
168
|
+
case "text":
|
|
169
|
+
case "unknown":
|
|
170
|
+
default:
|
|
171
|
+
return value;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { CachedMetadata } from "./cache.svelte";
|
|
2
|
+
import type { App } from "./context.svelte";
|
|
3
|
+
import { type TFile } from "./storage";
|
|
4
|
+
export interface IMetadataType {
|
|
5
|
+
text: "text";
|
|
6
|
+
checkbox: "checkbox";
|
|
7
|
+
number: "number";
|
|
8
|
+
multitext: "multitext";
|
|
9
|
+
date: "date";
|
|
10
|
+
datetime: "datetime";
|
|
11
|
+
aliases: "aliases";
|
|
12
|
+
tags: "tags";
|
|
13
|
+
array: "array";
|
|
14
|
+
object: "object";
|
|
15
|
+
unknown: "unknown";
|
|
16
|
+
}
|
|
17
|
+
export type MetadataType = keyof IMetadataType;
|
|
18
|
+
export interface MetadataTypeDef {
|
|
19
|
+
name: string;
|
|
20
|
+
type: MetadataType;
|
|
21
|
+
}
|
|
22
|
+
export interface MetadataTypeProperty extends MetadataTypeDef {
|
|
23
|
+
count: number;
|
|
24
|
+
files: Set<string>;
|
|
25
|
+
}
|
|
26
|
+
export interface MetadataRenameFailure {
|
|
27
|
+
path: string;
|
|
28
|
+
message: string;
|
|
29
|
+
}
|
|
30
|
+
export interface MetadataRenameResult {
|
|
31
|
+
updatedFiles: string[];
|
|
32
|
+
failedFiles: MetadataRenameFailure[];
|
|
33
|
+
}
|
|
34
|
+
export type MetadataBulkOperationFailure = MetadataRenameFailure;
|
|
35
|
+
export interface MetadataBulkOperationResult {
|
|
36
|
+
updatedFiles: string[];
|
|
37
|
+
failedFiles: MetadataBulkOperationFailure[];
|
|
38
|
+
}
|
|
39
|
+
export interface MetadataBulkOperationProgress {
|
|
40
|
+
current: number;
|
|
41
|
+
total: number;
|
|
42
|
+
path: string;
|
|
43
|
+
}
|
|
44
|
+
export interface MetadataBulkOperationOptions {
|
|
45
|
+
onProgress?: (progress: MetadataBulkOperationProgress) => void;
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
}
|
|
48
|
+
export type TypeWidget = {
|
|
49
|
+
default: (value?: unknown) => any;
|
|
50
|
+
icon: string;
|
|
51
|
+
name: string;
|
|
52
|
+
type: MetadataType;
|
|
53
|
+
validate: (value: unknown) => boolean;
|
|
54
|
+
render: (el: HTMLElement, props: {
|
|
55
|
+
type: MetadataTypeDef;
|
|
56
|
+
value: any;
|
|
57
|
+
onChange: (type: MetadataTypeDef, value: any, event: Event) => void;
|
|
58
|
+
}) => void;
|
|
59
|
+
};
|
|
60
|
+
export declare class MetadataTypeManager {
|
|
61
|
+
readonly app: App;
|
|
62
|
+
readonly types: Record<string, MetadataTypeDef>;
|
|
63
|
+
readonly registeredTypeWidgets: Record<string, TypeWidget>;
|
|
64
|
+
readonly properties: Record<string, MetadataTypeProperty>;
|
|
65
|
+
readonly topLevelPropertyNames: Set<string>;
|
|
66
|
+
readonly propertyValues: Record<string, unknown[]>;
|
|
67
|
+
propertiesLoading: boolean;
|
|
68
|
+
queryError: string | null;
|
|
69
|
+
constructor(app: App);
|
|
70
|
+
getAllProperties(): {
|
|
71
|
+
[x: string]: MetadataTypeProperty;
|
|
72
|
+
};
|
|
73
|
+
updateProperties(): Promise<void>;
|
|
74
|
+
load(): Promise<void>;
|
|
75
|
+
readonly save: import("lodash-es").DebouncedFunc<() => Promise<void> | undefined>;
|
|
76
|
+
toJSON(): {
|
|
77
|
+
types: Record<string, string>;
|
|
78
|
+
};
|
|
79
|
+
setType(field: string, type: MetadataType): void;
|
|
80
|
+
registerTypeWidget(widget: TypeWidget): void;
|
|
81
|
+
unregisterTypeWidget(widget: TypeWidget): void;
|
|
82
|
+
private collectPropertyEntries;
|
|
83
|
+
private getEntriesForFrontmatter;
|
|
84
|
+
private getFrontmatterPropertyValue;
|
|
85
|
+
private refreshProperty;
|
|
86
|
+
private syncFileProperties;
|
|
87
|
+
private getFilesForProperty;
|
|
88
|
+
private getFilesForTopLevelProperty;
|
|
89
|
+
private reportBulkProgress;
|
|
90
|
+
private throwIfBulkCancelled;
|
|
91
|
+
rename(prevId: string, newId: string): Promise<MetadataRenameResult>;
|
|
92
|
+
renameProperty(files: Set<string>, prevId: string, newId: string): Promise<MetadataRenameResult>;
|
|
93
|
+
renameTopLevelProperty(prevId: string, newId: string, options?: MetadataBulkOperationOptions): Promise<MetadataBulkOperationResult>;
|
|
94
|
+
deleteTopLevelProperty(path: string, options?: MetadataBulkOperationOptions): Promise<MetadataBulkOperationResult>;
|
|
95
|
+
deleteProperty(path: string, options?: MetadataBulkOperationOptions): Promise<MetadataBulkOperationResult>;
|
|
96
|
+
setTopLevelPropertyType(path: string, type: MetadataType, options?: MetadataBulkOperationOptions): Promise<MetadataBulkOperationResult>;
|
|
97
|
+
setPropertyType(path: string, type: MetadataType, options?: MetadataBulkOperationOptions): Promise<MetadataBulkOperationResult>;
|
|
98
|
+
processChange(file: TFile, cache: CachedMetadata): void;
|
|
99
|
+
getValues(key: string): unknown[];
|
|
100
|
+
getValuesAsync(key: string, limit?: number): Promise<unknown[]>;
|
|
101
|
+
processDelete(file: TFile): void;
|
|
102
|
+
trackChanges(): () => void;
|
|
103
|
+
reload(): void;
|
|
104
|
+
determineType(value: unknown): MetadataType;
|
|
105
|
+
determinePropertyType(name: string, value: unknown): MetadataType;
|
|
106
|
+
}
|