@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,213 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Check from "@lucide/svelte/icons/check";
|
|
3
|
+
import ChevronsUpDown from "@lucide/svelte/icons/chevrons-up-down";
|
|
4
|
+
import { onMount, tick } from "svelte";
|
|
5
|
+
import * as Command from "@lapismd/design-core/shadcn/command";
|
|
6
|
+
import * as Popover from "@lapismd/design-core/shadcn/popover";
|
|
7
|
+
import { Button, type ButtonProps } from "@lapismd/design-core/shadcn/button";
|
|
8
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
9
|
+
import { fuzzySearch } from "@lapis-notes/ui";
|
|
10
|
+
import Icon from "./icon.svelte";
|
|
11
|
+
import { cn } from "../../utils.js";
|
|
12
|
+
import { getIconPacks } from "../../icons";
|
|
13
|
+
import type { IconifyJSON } from "@iconify/types";
|
|
14
|
+
import { createVirtualizer } from "../../hooks/createVirtualizer.svelte";
|
|
15
|
+
import "./icon-list.css";
|
|
16
|
+
|
|
17
|
+
// design-core command index does not re-export GroupHeading.
|
|
18
|
+
const GroupHeading = CommandPrimitive.GroupHeading;
|
|
19
|
+
|
|
20
|
+
type IconSearchEntry = {
|
|
21
|
+
icon: string;
|
|
22
|
+
name: string;
|
|
23
|
+
prefix: string;
|
|
24
|
+
aliasesText: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
let open = $state(false);
|
|
29
|
+
let {
|
|
30
|
+
onValueChange,
|
|
31
|
+
value = $bindable(""),
|
|
32
|
+
ref = $bindable(null),
|
|
33
|
+
disabled = false,
|
|
34
|
+
label = "Select an icon",
|
|
35
|
+
...btnProps
|
|
36
|
+
}: ButtonProps & {
|
|
37
|
+
onValueChange?: (value: string) => void;
|
|
38
|
+
value?: string;
|
|
39
|
+
ref?: HTMLButtonElement | null,
|
|
40
|
+
label?: string;
|
|
41
|
+
} = $props()
|
|
42
|
+
let iconPacks: IconifyJSON[] = $state([]);
|
|
43
|
+
let query = $state("");
|
|
44
|
+
|
|
45
|
+
let iconEntries = $derived.by(() => {
|
|
46
|
+
const entries: IconSearchEntry[] = [];
|
|
47
|
+
for (const pack of iconPacks) {
|
|
48
|
+
const aliases = Object.keys(pack.aliases ?? {}).reduce((acc: Record<string, string[]>, alias) => {
|
|
49
|
+
const icon = pack.aliases![alias];
|
|
50
|
+
acc[icon.parent] ||= [];
|
|
51
|
+
acc[icon.parent].push(alias);
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
|
|
55
|
+
for (const name of Object.keys(pack.icons)) {
|
|
56
|
+
entries.push({
|
|
57
|
+
icon: `${pack.prefix}:${name}`,
|
|
58
|
+
name,
|
|
59
|
+
prefix: pack.prefix,
|
|
60
|
+
aliasesText: (aliases[name] ?? []).join(" "),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return entries;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
let mergedIcons = $derived.by(() => {
|
|
68
|
+
const normalizedQuery = query.trim();
|
|
69
|
+
const rankedEntries = normalizedQuery
|
|
70
|
+
? fuzzySearch(iconEntries, normalizedQuery, {
|
|
71
|
+
keys: ["name", "icon", "prefix", "aliasesText"],
|
|
72
|
+
}).map((result) => result.item)
|
|
73
|
+
: iconEntries;
|
|
74
|
+
|
|
75
|
+
const visibleIcons: Array<string | IconSearchEntry> = [];
|
|
76
|
+
let currentPrefix = "";
|
|
77
|
+
|
|
78
|
+
for (const entry of rankedEntries) {
|
|
79
|
+
if (entry.prefix !== currentPrefix) {
|
|
80
|
+
currentPrefix = entry.prefix;
|
|
81
|
+
visibleIcons.push(entry.prefix);
|
|
82
|
+
}
|
|
83
|
+
visibleIcons.push(entry);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return visibleIcons;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
let virtualListEl: HTMLDivElement | null = $state(null)
|
|
90
|
+
let virtualizer = createVirtualizer({
|
|
91
|
+
get count() {
|
|
92
|
+
return mergedIcons.length;
|
|
93
|
+
},
|
|
94
|
+
getScrollElement: () => virtualListEl,
|
|
95
|
+
estimateSize: () => 32,
|
|
96
|
+
overscan: 5,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
// We want to refocus the trigger button when the user selects
|
|
101
|
+
// an item from the list so users can continue navigating the
|
|
102
|
+
// rest of the form with the keyboard.
|
|
103
|
+
function closeAndFocusTrigger() {
|
|
104
|
+
open = false;
|
|
105
|
+
tick().then(() => {
|
|
106
|
+
ref?.focus();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
$effect(() => {
|
|
111
|
+
virtualizer.setOptions({ count: mergedIcons.length });
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
onMount(() => {
|
|
115
|
+
Promise.all(getIconPacks().map(it => {
|
|
116
|
+
if ("loader" in it) {
|
|
117
|
+
return it.loader();
|
|
118
|
+
}
|
|
119
|
+
return Promise.resolve(it.icons);
|
|
120
|
+
})).then(packs => {
|
|
121
|
+
iconPacks = packs;
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
</script>
|
|
125
|
+
<Popover.Root bind:open>
|
|
126
|
+
<Popover.Trigger bind:ref={ref}>
|
|
127
|
+
{#snippet child({ props })}
|
|
128
|
+
<Button
|
|
129
|
+
variant="outline"
|
|
130
|
+
class="icon-list-trigger"
|
|
131
|
+
data-ui-component="icon-list"
|
|
132
|
+
data-ui-part="trigger"
|
|
133
|
+
{...props}
|
|
134
|
+
{...btnProps}
|
|
135
|
+
{disabled}
|
|
136
|
+
role="combobox"
|
|
137
|
+
aria-expanded={open}
|
|
138
|
+
>
|
|
139
|
+
{#if value}
|
|
140
|
+
<Icon name={value} />
|
|
141
|
+
{:else}
|
|
142
|
+
<span>{label}</span>
|
|
143
|
+
{/if}
|
|
144
|
+
<ChevronsUpDown class="icon-list-trigger-chevron" />
|
|
145
|
+
</Button>
|
|
146
|
+
{/snippet}
|
|
147
|
+
</Popover.Trigger>
|
|
148
|
+
<Popover.Content
|
|
149
|
+
class="icon-list-content"
|
|
150
|
+
data-ui-component="icon-list"
|
|
151
|
+
data-ui-part="content"
|
|
152
|
+
style="width: 250px"
|
|
153
|
+
>
|
|
154
|
+
<Command.Root shouldFilter={false}>
|
|
155
|
+
<Command.Input placeholder="Search icon..." bind:value={query} />
|
|
156
|
+
<Command.List>
|
|
157
|
+
<div bind:this={virtualListEl} style="max-height: 300px; overflow: auto">
|
|
158
|
+
<div
|
|
159
|
+
data-ui-component="icon-list"
|
|
160
|
+
data-ui-part="virtual-root"
|
|
161
|
+
style="height: {virtualizer.getTotalSize()}px;"
|
|
162
|
+
>
|
|
163
|
+
<Command.Group
|
|
164
|
+
class="icon-list-group"
|
|
165
|
+
data-ui-component="icon-list"
|
|
166
|
+
data-ui-part="group"
|
|
167
|
+
>
|
|
168
|
+
{#each virtualizer.getVirtualItems() as row (row.index)}
|
|
169
|
+
{@const item = mergedIcons[row.index]}
|
|
170
|
+
{#if typeof item === "string"}
|
|
171
|
+
<GroupHeading
|
|
172
|
+
class="icon-list-heading"
|
|
173
|
+
data-ui-component="icon-list"
|
|
174
|
+
data-ui-part="heading"
|
|
175
|
+
style="position: absolute; z-index: 10000; top: 0; left: 0; width: 100%; height: {row.size}px; transform: translateY({row.start}px);"
|
|
176
|
+
>
|
|
177
|
+
{item}
|
|
178
|
+
</GroupHeading>
|
|
179
|
+
{:else if item}
|
|
180
|
+
<Command.Item
|
|
181
|
+
style="position: absolute; top: 0; left: 0; width: 100%; height: {row.size}px; transform: translateY({row.start}px);"
|
|
182
|
+
class="icon-list-item"
|
|
183
|
+
data-ui-component="icon-list"
|
|
184
|
+
data-ui-part="item"
|
|
185
|
+
value={item.icon}
|
|
186
|
+
onSelect={() => {
|
|
187
|
+
value = item.icon;
|
|
188
|
+
onValueChange?.(item.icon)
|
|
189
|
+
|
|
190
|
+
closeAndFocusTrigger();
|
|
191
|
+
}}
|
|
192
|
+
>
|
|
193
|
+
<Check
|
|
194
|
+
class={cn(
|
|
195
|
+
"icon-list-check",
|
|
196
|
+
value !== item.icon && "is-unchecked"
|
|
197
|
+
)}
|
|
198
|
+
data-ui-component="icon-list"
|
|
199
|
+
data-ui-part="check"
|
|
200
|
+
data-ui-unchecked={value !== item.icon ? "" : undefined}
|
|
201
|
+
/>
|
|
202
|
+
<Icon name={item.icon} class="icon-list-item-icon" />
|
|
203
|
+
{item.name}
|
|
204
|
+
</Command.Item>
|
|
205
|
+
{/if}
|
|
206
|
+
{/each}
|
|
207
|
+
</Command.Group>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</Command.List>
|
|
211
|
+
</Command.Root>
|
|
212
|
+
</Popover.Content>
|
|
213
|
+
</Popover.Root>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ButtonProps } from "@lapismd/design-core/shadcn/button";
|
|
2
|
+
import "./icon-list.css";
|
|
3
|
+
type $$ComponentProps = ButtonProps & {
|
|
4
|
+
onValueChange?: (value: string) => void;
|
|
5
|
+
value?: string;
|
|
6
|
+
ref?: HTMLButtonElement | null;
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const IconList: import("svelte").Component<$$ComponentProps, {}, "ref" | "value">;
|
|
10
|
+
type IconList = ReturnType<typeof IconList>;
|
|
11
|
+
export default IconList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getSvg } from "../../icons";
|
|
3
|
+
let {
|
|
4
|
+
name,
|
|
5
|
+
class: className,
|
|
6
|
+
}: {
|
|
7
|
+
name: string | string[];
|
|
8
|
+
class?: string;
|
|
9
|
+
} = $props();
|
|
10
|
+
let svgContent = $derived(getSvg(name, {class: className}));
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
{#await svgContent then svg}
|
|
14
|
+
{@html svg}
|
|
15
|
+
{/await}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as ContextMenu from "@lapismd/design-core/shadcn/context-menu";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
import Icon from "../icon/icon.svelte";
|
|
5
|
+
import DrawerMenu from "./drawer-menu.svelte";
|
|
6
|
+
import { createMobileMenuQuery } from "./mobile-menu-query.svelte";
|
|
7
|
+
import {
|
|
8
|
+
isMenuItem,
|
|
9
|
+
type Menu as AppMenu,
|
|
10
|
+
type MenuItem,
|
|
11
|
+
} from "../../menu.svelte";
|
|
12
|
+
import "./menu.css";
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
menu,
|
|
16
|
+
anchor = null,
|
|
17
|
+
class: className,
|
|
18
|
+
}: {
|
|
19
|
+
menu: AppMenu;
|
|
20
|
+
class?: string;
|
|
21
|
+
anchor?: HTMLElement | null;
|
|
22
|
+
} = $props();
|
|
23
|
+
|
|
24
|
+
const mobileMenu = createMobileMenuQuery();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if mobileMenu.matches}
|
|
28
|
+
<DrawerMenu {menu} />
|
|
29
|
+
{:else}
|
|
30
|
+
<ContextMenu.Content class={cn(className)} customAnchor={anchor}>
|
|
31
|
+
{@render ContextMenuContent({ menu })}
|
|
32
|
+
</ContextMenu.Content>
|
|
33
|
+
{/if}
|
|
34
|
+
|
|
35
|
+
{#snippet ContextMenuContent({ menu }: { menu: AppMenu })}
|
|
36
|
+
{#each Object.entries(menu?.renderedItems ?? {}) as [id, items]}
|
|
37
|
+
{#each items as item}
|
|
38
|
+
<ContextMenu.Group>
|
|
39
|
+
{#if item === "separator"}
|
|
40
|
+
<ContextMenu.Separator />
|
|
41
|
+
{:else if isMenuItem(item)}
|
|
42
|
+
{@render ContextMenuItem({ item })}
|
|
43
|
+
{:else}
|
|
44
|
+
<ContextMenu.Sub>
|
|
45
|
+
<ContextMenu.SubTrigger>
|
|
46
|
+
<div data-ui-component="menu" data-ui-part="item-row">
|
|
47
|
+
<Icon class="menu-item-icon" name="custom:blank" />
|
|
48
|
+
{item.title}
|
|
49
|
+
</div>
|
|
50
|
+
</ContextMenu.SubTrigger>
|
|
51
|
+
<ContextMenu.SubContent
|
|
52
|
+
data-ui-component="menu"
|
|
53
|
+
data-ui-part="sub-content"
|
|
54
|
+
>
|
|
55
|
+
{@render ContextMenuContent({ menu: item })}
|
|
56
|
+
</ContextMenu.SubContent>
|
|
57
|
+
</ContextMenu.Sub>
|
|
58
|
+
{/if}
|
|
59
|
+
</ContextMenu.Group>
|
|
60
|
+
{/each}
|
|
61
|
+
{/each}
|
|
62
|
+
{/snippet}
|
|
63
|
+
|
|
64
|
+
{#snippet ContextMenuItem({ item }: { item: MenuItem })}
|
|
65
|
+
{#if item.checked !== null}
|
|
66
|
+
<ContextMenu.CheckboxItem
|
|
67
|
+
checked={item.checked}
|
|
68
|
+
disabled={item.disabled}
|
|
69
|
+
onclick={(evt: MouseEvent) => item.click(evt)}
|
|
70
|
+
>
|
|
71
|
+
<div data-ui-component="menu" data-ui-part="item-row">
|
|
72
|
+
{#if item.icon}
|
|
73
|
+
<Icon class="menu-item-icon" name={item.icon} />
|
|
74
|
+
{/if}
|
|
75
|
+
{item.title}
|
|
76
|
+
</div>
|
|
77
|
+
</ContextMenu.CheckboxItem>
|
|
78
|
+
{:else}
|
|
79
|
+
<ContextMenu.Item
|
|
80
|
+
disabled={item.disabled}
|
|
81
|
+
onclick={(evt: MouseEvent) => item.click(evt)}
|
|
82
|
+
>
|
|
83
|
+
<div data-ui-component="menu" data-ui-part="item-row">
|
|
84
|
+
<Icon class="menu-item-icon" name={item.icon || "custom:blank"} />
|
|
85
|
+
{item.title}
|
|
86
|
+
</div>
|
|
87
|
+
</ContextMenu.Item>
|
|
88
|
+
{/if}
|
|
89
|
+
{/snippet}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as ContextMenu from "@lapismd/design-core/shadcn/context-menu";
|
|
2
|
+
import { type Menu as AppMenu } from "../../menu.svelte";
|
|
3
|
+
import "./menu.css";
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
menu: AppMenu;
|
|
6
|
+
class?: string;
|
|
7
|
+
anchor?: HTMLElement | null;
|
|
8
|
+
};
|
|
9
|
+
declare const ContextMenu: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type ContextMenu = ReturnType<typeof ContextMenu>;
|
|
11
|
+
export default ContextMenu;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Drawer from "@lapismd/design-core/shadcn/drawer";
|
|
3
|
+
import Icon from "../icon/icon.svelte";
|
|
4
|
+
import {
|
|
5
|
+
isMenuItem,
|
|
6
|
+
type Menu as AppMenu,
|
|
7
|
+
type MenuItem,
|
|
8
|
+
} from "../../menu.svelte";
|
|
9
|
+
import "./menu.css";
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
menu,
|
|
13
|
+
}: {
|
|
14
|
+
menu: AppMenu;
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const title = $derived(menu.title || "Menu");
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Drawer.Root bind:open={() => menu.open, (value) => menu.setOpen(value)}>
|
|
21
|
+
<Drawer.Content
|
|
22
|
+
data-ui-component="menu"
|
|
23
|
+
data-ui-part="drawer-content"
|
|
24
|
+
data-mobile-menu-drawer
|
|
25
|
+
aria-label={title}
|
|
26
|
+
>
|
|
27
|
+
<Drawer.Header class="sr-only">
|
|
28
|
+
<Drawer.Title>{title}</Drawer.Title>
|
|
29
|
+
<Drawer.Description>Choose a menu action.</Drawer.Description>
|
|
30
|
+
</Drawer.Header>
|
|
31
|
+
<div data-ui-component="menu" data-ui-part="drawer-body">
|
|
32
|
+
{@render DrawerMenuContent({ menu })}
|
|
33
|
+
</div>
|
|
34
|
+
</Drawer.Content>
|
|
35
|
+
</Drawer.Root>
|
|
36
|
+
|
|
37
|
+
{#snippet DrawerMenuContent({ menu }: { menu: AppMenu })}
|
|
38
|
+
{@const itemsBySection = menu.filter ? menu.filteredItems : menu.renderedItems}
|
|
39
|
+
{#each Object.entries(itemsBySection ?? {}) as [section, items]}
|
|
40
|
+
<div
|
|
41
|
+
data-ui-component="menu"
|
|
42
|
+
data-ui-part="drawer-section"
|
|
43
|
+
data-mobile-menu-section={section}
|
|
44
|
+
>
|
|
45
|
+
{#each items as item}
|
|
46
|
+
{#if item === "separator"}
|
|
47
|
+
<div
|
|
48
|
+
data-ui-component="menu"
|
|
49
|
+
data-ui-part="drawer-separator"
|
|
50
|
+
aria-hidden="true"
|
|
51
|
+
></div>
|
|
52
|
+
{:else if isMenuItem(item)}
|
|
53
|
+
{@render DrawerMenuItem({ item })}
|
|
54
|
+
{:else}
|
|
55
|
+
<div data-ui-component="menu" data-ui-part="drawer-heading">
|
|
56
|
+
{item.title}
|
|
57
|
+
</div>
|
|
58
|
+
<div>
|
|
59
|
+
{@render DrawerMenuContent({ menu: item })}
|
|
60
|
+
</div>
|
|
61
|
+
{/if}
|
|
62
|
+
{/each}
|
|
63
|
+
</div>
|
|
64
|
+
{/each}
|
|
65
|
+
{/snippet}
|
|
66
|
+
|
|
67
|
+
{#snippet DrawerMenuItem({ item }: { item: MenuItem })}
|
|
68
|
+
<button
|
|
69
|
+
type="button"
|
|
70
|
+
data-ui-component="menu"
|
|
71
|
+
data-ui-part="drawer-item"
|
|
72
|
+
disabled={item.disabled || item.isLabel}
|
|
73
|
+
onclick={(evt) => item.click(evt)}
|
|
74
|
+
>
|
|
75
|
+
<Icon
|
|
76
|
+
class="menu-drawer-icon"
|
|
77
|
+
name={item.icon || (item.checked ? "check" : "custom:blank")}
|
|
78
|
+
/>
|
|
79
|
+
<span data-ui-component="menu" data-ui-part="drawer-item-label"
|
|
80
|
+
>{item.title}</span
|
|
81
|
+
>
|
|
82
|
+
</button>
|
|
83
|
+
{/snippet}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Menu as AppMenu } from "../../menu.svelte";
|
|
2
|
+
import "./menu.css";
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
menu: AppMenu;
|
|
5
|
+
};
|
|
6
|
+
declare const DrawerMenu: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type DrawerMenu = ReturnType<typeof DrawerMenu>;
|
|
8
|
+
export default DrawerMenu;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as DropdownMenu from "@lapismd/design-core/shadcn/dropdown-menu";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
import Icon from "../icon/icon.svelte";
|
|
5
|
+
import DrawerMenu from "./drawer-menu.svelte";
|
|
6
|
+
import { createMobileMenuQuery } from "./mobile-menu-query.svelte";
|
|
7
|
+
import {
|
|
8
|
+
isMenuItem,
|
|
9
|
+
type Menu as AppMenu,
|
|
10
|
+
type MenuItem,
|
|
11
|
+
} from "../../menu.svelte";
|
|
12
|
+
import "./menu.css";
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
menu,
|
|
16
|
+
anchor = null,
|
|
17
|
+
class: className,
|
|
18
|
+
}: {
|
|
19
|
+
menu: AppMenu;
|
|
20
|
+
class?: string;
|
|
21
|
+
anchor?: HTMLElement | null;
|
|
22
|
+
} = $props();
|
|
23
|
+
|
|
24
|
+
const mobileMenu = createMobileMenuQuery();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if mobileMenu.matches}
|
|
28
|
+
<DrawerMenu {menu} />
|
|
29
|
+
{:else}
|
|
30
|
+
<DropdownMenu.Content class={cn(className)} customAnchor={anchor}>
|
|
31
|
+
{@render DropdownMenuContent({ menu })}
|
|
32
|
+
</DropdownMenu.Content>
|
|
33
|
+
{/if}
|
|
34
|
+
|
|
35
|
+
{#snippet DropdownMenuContent({ menu }: { menu: AppMenu })}
|
|
36
|
+
{#each Object.entries(menu?.filteredItems ?? {}) as [id, items]}
|
|
37
|
+
<DropdownMenu.Group>
|
|
38
|
+
{#each items as item}
|
|
39
|
+
{#if item === "separator"}
|
|
40
|
+
<DropdownMenu.Separator />
|
|
41
|
+
{:else if isMenuItem(item)}
|
|
42
|
+
{@render DropdownItem({ item })}
|
|
43
|
+
{:else}
|
|
44
|
+
<DropdownMenu.Sub>
|
|
45
|
+
<DropdownMenu.SubTrigger>
|
|
46
|
+
<div data-ui-component="menu" data-ui-part="item-row">
|
|
47
|
+
<Icon class="menu-item-icon-sm" name="custom:blank" />
|
|
48
|
+
{item.title}
|
|
49
|
+
</div>
|
|
50
|
+
</DropdownMenu.SubTrigger>
|
|
51
|
+
<DropdownMenu.SubContent
|
|
52
|
+
data-ui-component="menu"
|
|
53
|
+
data-ui-part="sub-content"
|
|
54
|
+
>
|
|
55
|
+
{@render DropdownMenuContent({ menu: item })}
|
|
56
|
+
</DropdownMenu.SubContent>
|
|
57
|
+
</DropdownMenu.Sub>
|
|
58
|
+
{/if}
|
|
59
|
+
{/each}
|
|
60
|
+
</DropdownMenu.Group>
|
|
61
|
+
{/each}
|
|
62
|
+
{/snippet}
|
|
63
|
+
|
|
64
|
+
{#snippet DropdownItem({ item }: { item: MenuItem })}
|
|
65
|
+
{#if item.checked !== null}
|
|
66
|
+
<DropdownMenu.CheckboxItem
|
|
67
|
+
checked={item.checked}
|
|
68
|
+
disabled={item.disabled}
|
|
69
|
+
onclick={(evt) => item.click(evt)}
|
|
70
|
+
>
|
|
71
|
+
<div data-ui-component="menu" data-ui-part="item-row">
|
|
72
|
+
{#if item.icon}
|
|
73
|
+
<Icon class="menu-item-icon-sm" name={item.icon} />
|
|
74
|
+
{/if}
|
|
75
|
+
{item.title}
|
|
76
|
+
</div>
|
|
77
|
+
</DropdownMenu.CheckboxItem>
|
|
78
|
+
{:else}
|
|
79
|
+
<DropdownMenu.Item
|
|
80
|
+
disabled={item.disabled}
|
|
81
|
+
onclick={(evt) => item.click(evt)}
|
|
82
|
+
>
|
|
83
|
+
<div data-ui-component="menu" data-ui-part="item-row">
|
|
84
|
+
<Icon class="menu-item-icon-sm" name={item.icon || "custom:blank"} />
|
|
85
|
+
{item.title}
|
|
86
|
+
</div>
|
|
87
|
+
</DropdownMenu.Item>
|
|
88
|
+
{/if}
|
|
89
|
+
{/snippet}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as DropdownMenu from "@lapismd/design-core/shadcn/dropdown-menu";
|
|
2
|
+
import { type Menu as AppMenu } from "../../menu.svelte";
|
|
3
|
+
import "./menu.css";
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
menu: AppMenu;
|
|
6
|
+
class?: string;
|
|
7
|
+
anchor?: HTMLElement | null;
|
|
8
|
+
};
|
|
9
|
+
declare const DropdownMenu: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type DropdownMenu = ReturnType<typeof DropdownMenu>;
|
|
11
|
+
export default DropdownMenu;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import MenuComponent from "./menu.svelte";
|
|
2
|
+
import ContextMenu from "./context-menu.svelte";
|
|
3
|
+
import DropdownMenu from "./dropdown-menu.svelte";
|
|
4
|
+
import PopoverMenu from "./popover-menu.svelte";
|
|
5
|
+
export { MenuComponent, MenuComponent as Root, MenuComponent as Menu, ContextMenu, ContextMenu as Context, DropdownMenu, DropdownMenu as Dropdown, PopoverMenu, PopoverMenu as Popover, };
|
|
6
|
+
export default MenuComponent;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import MenuComponent from "./menu.svelte";
|
|
2
|
+
import ContextMenu from "./context-menu.svelte";
|
|
3
|
+
import DropdownMenu from "./dropdown-menu.svelte";
|
|
4
|
+
import PopoverMenu from "./popover-menu.svelte";
|
|
5
|
+
export { MenuComponent, MenuComponent as Root, MenuComponent as Menu, ContextMenu, ContextMenu as Context, DropdownMenu, DropdownMenu as Dropdown, PopoverMenu, PopoverMenu as Popover, };
|
|
6
|
+
export default MenuComponent;
|