@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,199 @@
|
|
|
1
|
+
/* Configuration settings chrome — lists, object array/map/grid, combobox */
|
|
2
|
+
|
|
3
|
+
[data-ui-component="configuration"] {
|
|
4
|
+
--ui-configuration-control-height: var(--input-height, var(--ui-control-height, 2rem));
|
|
5
|
+
--ui-configuration-gap: 0.5rem;
|
|
6
|
+
--ui-configuration-icon-size: 1rem;
|
|
7
|
+
--ui-configuration-grip-width: 2.5rem;
|
|
8
|
+
--ui-configuration-actions-width: 4rem;
|
|
9
|
+
--ui-configuration-pattern-width: 45%;
|
|
10
|
+
--ui-configuration-property-width: 40%;
|
|
11
|
+
--ui-configuration-combobox-max-height: 12rem;
|
|
12
|
+
--ui-configuration-combobox-z: 50;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[data-ui-component="configuration"][data-ui-part="list"] {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: var(--ui-configuration-gap);
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[data-ui-component="configuration"][data-ui-part="list-row"] {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: var(--ui-configuration-gap);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[data-ui-component="configuration"][data-ui-part="control"],
|
|
29
|
+
[data-ui-component="configuration"] .configuration-control {
|
|
30
|
+
height: var(--ui-configuration-control-height);
|
|
31
|
+
border: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[data-ui-component="configuration"][data-ui-part="control-grow"],
|
|
35
|
+
[data-ui-component="configuration"] .configuration-control-grow {
|
|
36
|
+
flex: 1 1 0%;
|
|
37
|
+
height: var(--ui-configuration-control-height);
|
|
38
|
+
border: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[data-ui-component="configuration"][data-ui-part="icon-button"],
|
|
42
|
+
[data-ui-component="configuration"] .configuration-icon-button {
|
|
43
|
+
width: var(--ui-configuration-control-height);
|
|
44
|
+
height: var(--ui-configuration-control-height);
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[data-ui-component="configuration"][data-ui-part="add-button"],
|
|
49
|
+
[data-ui-component="configuration"] .configuration-add-button {
|
|
50
|
+
width: fit-content;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[data-ui-component="configuration"][data-ui-part="stack"],
|
|
54
|
+
[data-ui-component="configuration"] .configuration-stack,
|
|
55
|
+
.config-array-table {
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: var(--ui-configuration-gap);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-ui-component="configuration"][data-ui-part="table"],
|
|
63
|
+
[data-ui-component="configuration"] .configuration-table {
|
|
64
|
+
width: 100%;
|
|
65
|
+
font-size: 0.875rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[data-ui-component="configuration"][data-ui-part="grip-head"],
|
|
69
|
+
[data-ui-component="configuration"] .configuration-grip-head {
|
|
70
|
+
width: var(--ui-configuration-grip-width);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[data-ui-component="configuration"][data-ui-part="actions-head"],
|
|
74
|
+
[data-ui-component="configuration"] .configuration-actions-head {
|
|
75
|
+
width: var(--ui-configuration-actions-width);
|
|
76
|
+
text-align: right;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[data-ui-component="configuration"][data-ui-part="pattern-head"],
|
|
80
|
+
[data-ui-component="configuration"] .configuration-pattern-head {
|
|
81
|
+
width: var(--ui-configuration-pattern-width);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[data-ui-component="configuration"][data-ui-part="property-head"],
|
|
85
|
+
[data-ui-component="configuration"] .configuration-property-head {
|
|
86
|
+
width: var(--ui-configuration-property-width);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[data-ui-component="configuration"][data-ui-part="cell"],
|
|
90
|
+
[data-ui-component="configuration"] .configuration-cell {
|
|
91
|
+
vertical-align: middle;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[data-ui-component="configuration"][data-ui-part="cell-label"],
|
|
95
|
+
[data-ui-component="configuration"] .configuration-cell-label {
|
|
96
|
+
vertical-align: middle;
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[data-ui-component="configuration"][data-ui-part="cell-actions"],
|
|
101
|
+
[data-ui-component="configuration"] .configuration-cell-actions {
|
|
102
|
+
vertical-align: middle;
|
|
103
|
+
text-align: right;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[data-ui-component="configuration"][data-ui-part="grip"],
|
|
107
|
+
.config-array-table__grip {
|
|
108
|
+
width: var(--ui-configuration-grip-width);
|
|
109
|
+
vertical-align: middle;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[data-ui-component="configuration"][data-ui-part="grip-button"],
|
|
113
|
+
[data-ui-component="configuration"] .configuration-grip-button {
|
|
114
|
+
width: var(--ui-configuration-control-height);
|
|
115
|
+
height: var(--ui-configuration-control-height);
|
|
116
|
+
flex-shrink: 0;
|
|
117
|
+
cursor: grab;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[data-ui-component="configuration"][data-ui-part="icon"],
|
|
121
|
+
[data-ui-component="configuration"] .configuration-icon {
|
|
122
|
+
width: var(--ui-configuration-icon-size);
|
|
123
|
+
height: var(--ui-configuration-icon-size);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-ui-component="configuration"][data-ui-part="grip-icon"],
|
|
127
|
+
[data-ui-component="configuration"] .configuration-grip-icon {
|
|
128
|
+
width: var(--ui-configuration-icon-size);
|
|
129
|
+
height: var(--ui-configuration-icon-size);
|
|
130
|
+
opacity: 0.6;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[data-ui-component="configuration"][data-ui-part="combobox"],
|
|
134
|
+
[data-ui-component="configuration"] .configuration-combobox {
|
|
135
|
+
position: relative;
|
|
136
|
+
width: 100%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[data-ui-component="configuration"][data-ui-part="combobox-input"],
|
|
140
|
+
[data-ui-component="configuration"] .configuration-combobox-input {
|
|
141
|
+
width: 100%;
|
|
142
|
+
height: var(--ui-configuration-control-height);
|
|
143
|
+
border: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
[data-ui-component="configuration"][data-ui-part="combobox-list"] {
|
|
147
|
+
position: absolute;
|
|
148
|
+
z-index: var(--ui-configuration-combobox-z);
|
|
149
|
+
margin-block-start: 0.25rem;
|
|
150
|
+
max-height: var(--ui-configuration-combobox-max-height);
|
|
151
|
+
width: 100%;
|
|
152
|
+
overflow: auto;
|
|
153
|
+
border: 1px solid var(--border);
|
|
154
|
+
border-radius: var(--radius, 0.375rem);
|
|
155
|
+
background: var(--popover);
|
|
156
|
+
color: var(--popover-foreground);
|
|
157
|
+
padding: 0.25rem;
|
|
158
|
+
box-shadow:
|
|
159
|
+
0 4px 6px -1px rgb(0 0 0 / 0.1),
|
|
160
|
+
0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[data-ui-component="configuration"][data-ui-part="combobox-option"] {
|
|
164
|
+
display: flex;
|
|
165
|
+
width: 100%;
|
|
166
|
+
border-radius: calc(var(--radius, 0.375rem) - 2px);
|
|
167
|
+
padding: 0.375rem 0.5rem;
|
|
168
|
+
text-align: left;
|
|
169
|
+
font-size: 0.875rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[data-ui-component="configuration"][data-ui-part="combobox-option"]:hover {
|
|
173
|
+
background: var(--accent);
|
|
174
|
+
color: var(--accent-foreground);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
[data-ui-component="configuration"][data-ui-part="combobox-option"]:disabled {
|
|
178
|
+
opacity: 0.5;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.config-array-table.is-table-chrome-dragging {
|
|
182
|
+
user-select: none;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.config-array-table__row.is-row-drag-source {
|
|
186
|
+
opacity: 0.55;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.config-array-table__grip.is-dragging-top {
|
|
190
|
+
box-shadow: inset 0 2px 0 0 var(--primary, var(--ring));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.config-array-table__grip.is-dragging-bottom {
|
|
194
|
+
box-shadow: inset 0 -2px 0 0 var(--primary, var(--ring));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.config-array-table__grip.is-drag-source {
|
|
198
|
+
opacity: 0.7;
|
|
199
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DatePicker, TimePicker } from "@lapismd/design-core/forms";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
value = $bindable(""),
|
|
6
|
+
format = "date",
|
|
7
|
+
onValueChange,
|
|
8
|
+
}: {
|
|
9
|
+
value?: string;
|
|
10
|
+
format?: "date" | "time";
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
} = $props();
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Normalize stored settings strings for the pickers.
|
|
16
|
+
* Legacy `datetime-local` values look like `YYYY-MM-DDTHH:mm` (optional seconds).
|
|
17
|
+
*/
|
|
18
|
+
function normalizeInbound(
|
|
19
|
+
raw: string | undefined,
|
|
20
|
+
fmt: "date" | "time",
|
|
21
|
+
): string | undefined {
|
|
22
|
+
const trimmed = (raw ?? "").trim();
|
|
23
|
+
if (!trimmed) return undefined;
|
|
24
|
+
|
|
25
|
+
if (trimmed.includes("T")) {
|
|
26
|
+
const [datePart, timePart = ""] = trimmed.split("T");
|
|
27
|
+
if (fmt === "date") {
|
|
28
|
+
return datePart || undefined;
|
|
29
|
+
}
|
|
30
|
+
const match = /^(\d{2}):(\d{2})/.exec(timePart);
|
|
31
|
+
return match ? `${match[1]}:${match[2]}` : timePart || undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (fmt === "date") {
|
|
35
|
+
// Accept bare `YYYY-MM-DD` (or longer ISO prefixes).
|
|
36
|
+
const match = /^(\d{4}-\d{2}-\d{2})/.exec(trimmed);
|
|
37
|
+
return match?.[1] ?? trimmed;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const match = /^(\d{2}):(\d{2})/.exec(trimmed);
|
|
41
|
+
return match ? `${match[1]}:${match[2]}` : trimmed;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function emit(next: string | undefined): void {
|
|
45
|
+
const out = next ?? "";
|
|
46
|
+
value = out;
|
|
47
|
+
onValueChange?.(out);
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#if format === "time"}
|
|
52
|
+
<TimePicker
|
|
53
|
+
bind:value={
|
|
54
|
+
() => normalizeInbound(value, "time"),
|
|
55
|
+
(next) => emit(next)
|
|
56
|
+
}
|
|
57
|
+
clearable
|
|
58
|
+
ariaLabel="Choose time"
|
|
59
|
+
placeholder="Pick time"
|
|
60
|
+
/>
|
|
61
|
+
{:else}
|
|
62
|
+
<DatePicker
|
|
63
|
+
bind:value={
|
|
64
|
+
() => normalizeInbound(value, "date"),
|
|
65
|
+
(next) => emit(next)
|
|
66
|
+
}
|
|
67
|
+
clearable
|
|
68
|
+
ariaLabel="Choose date"
|
|
69
|
+
placeholder="Pick date"
|
|
70
|
+
/>
|
|
71
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
value?: string;
|
|
3
|
+
format?: "date" | "time";
|
|
4
|
+
onValueChange?: (value: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const DateSetting: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
7
|
+
type DateSetting = ReturnType<typeof DateSetting>;
|
|
8
|
+
export default DateSetting;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button } from "@lapismd/design-core/shadcn/button";
|
|
3
|
+
import { Input } from "@lapismd/design-core/shadcn/input";
|
|
4
|
+
import { Switch } from "@lapismd/design-core/shadcn/switch";
|
|
5
|
+
import { Select } from "../select";
|
|
6
|
+
import type { ObjectMapOption } from "./object-map-setting.svelte";
|
|
7
|
+
import { buildSelectOptionsForValue } from "./object-array-utils";
|
|
8
|
+
import "./configuration.css";
|
|
9
|
+
|
|
10
|
+
type ItemType = "string" | "number" | "integer" | "boolean";
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
itemType,
|
|
14
|
+
value = $bindable<unknown[]>([]),
|
|
15
|
+
valueOptions = [],
|
|
16
|
+
allowUnknownOptions = false,
|
|
17
|
+
onValueChange,
|
|
18
|
+
}: {
|
|
19
|
+
itemType: ItemType;
|
|
20
|
+
value?: unknown[];
|
|
21
|
+
valueOptions?: ObjectMapOption[];
|
|
22
|
+
allowUnknownOptions?: boolean;
|
|
23
|
+
onValueChange?: (value: unknown[]) => void;
|
|
24
|
+
} = $props();
|
|
25
|
+
|
|
26
|
+
function emit(next: unknown[]): void {
|
|
27
|
+
value = next;
|
|
28
|
+
onValueChange?.(next);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function addItem(): void {
|
|
32
|
+
const next = [...value];
|
|
33
|
+
if (itemType === "boolean") {
|
|
34
|
+
next.push(false);
|
|
35
|
+
} else if (itemType === "number" || itemType === "integer") {
|
|
36
|
+
next.push(0);
|
|
37
|
+
} else if (valueOptions.length > 0) {
|
|
38
|
+
next.push(valueOptions[0]?.value ?? "");
|
|
39
|
+
} else {
|
|
40
|
+
next.push("");
|
|
41
|
+
}
|
|
42
|
+
emit(next);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function removeItem(index: number): void {
|
|
46
|
+
emit(value.filter((_, i) => i !== index));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function updateItem(index: number, nextValue: unknown): void {
|
|
50
|
+
const next = [...value];
|
|
51
|
+
next[index] = nextValue;
|
|
52
|
+
emit(next);
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<div data-ui-component="configuration" data-ui-part="list">
|
|
57
|
+
{#each value as item, index (index)}
|
|
58
|
+
<div data-ui-component="configuration" data-ui-part="list-row">
|
|
59
|
+
{#if itemType === "boolean"}
|
|
60
|
+
<Switch
|
|
61
|
+
checked={Boolean(item)}
|
|
62
|
+
onCheckedChange={(checked) => updateItem(index, checked)}
|
|
63
|
+
/>
|
|
64
|
+
{:else if itemType === "number" || itemType === "integer"}
|
|
65
|
+
<Input
|
|
66
|
+
type="number"
|
|
67
|
+
class="configuration-control-grow"
|
|
68
|
+
value={String(item ?? 0)}
|
|
69
|
+
oninput={(event) => {
|
|
70
|
+
const target = event.currentTarget as HTMLInputElement;
|
|
71
|
+
const parsed = Number(target.value);
|
|
72
|
+
updateItem(index, Number.isFinite(parsed) ? parsed : 0);
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
{:else if valueOptions.length > 0 && !allowUnknownOptions}
|
|
76
|
+
<Select
|
|
77
|
+
type="single"
|
|
78
|
+
value={String(item ?? "")}
|
|
79
|
+
items={buildSelectOptionsForValue(valueOptions, item, allowUnknownOptions)}
|
|
80
|
+
placeholder="Select"
|
|
81
|
+
onValueChange={(nextValue) => updateItem(index, nextValue)}
|
|
82
|
+
/>
|
|
83
|
+
{:else if valueOptions.length > 0}
|
|
84
|
+
<Select
|
|
85
|
+
type="single"
|
|
86
|
+
value={String(item ?? "")}
|
|
87
|
+
items={buildSelectOptionsForValue(valueOptions, item, allowUnknownOptions)}
|
|
88
|
+
placeholder="Select"
|
|
89
|
+
onValueChange={(nextValue) => updateItem(index, nextValue)}
|
|
90
|
+
/>
|
|
91
|
+
<Input
|
|
92
|
+
type="text"
|
|
93
|
+
class="configuration-control-grow"
|
|
94
|
+
value={String(item ?? "")}
|
|
95
|
+
oninput={(event) => {
|
|
96
|
+
const target = event.currentTarget as HTMLInputElement;
|
|
97
|
+
updateItem(index, target.value);
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
{:else}
|
|
101
|
+
<Input
|
|
102
|
+
type="text"
|
|
103
|
+
class="configuration-control-grow"
|
|
104
|
+
value={String(item ?? "")}
|
|
105
|
+
oninput={(event) => {
|
|
106
|
+
const target = event.currentTarget as HTMLInputElement;
|
|
107
|
+
updateItem(index, target.value);
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
{/if}
|
|
111
|
+
<Button
|
|
112
|
+
variant="ghost"
|
|
113
|
+
size="icon"
|
|
114
|
+
class="configuration-icon-button"
|
|
115
|
+
onclick={() => removeItem(index)}
|
|
116
|
+
aria-label="Remove item"
|
|
117
|
+
>
|
|
118
|
+
×
|
|
119
|
+
</Button>
|
|
120
|
+
</div>
|
|
121
|
+
{/each}
|
|
122
|
+
<Button
|
|
123
|
+
variant="ghost"
|
|
124
|
+
size="sm"
|
|
125
|
+
class="configuration-add-button"
|
|
126
|
+
onclick={addItem}>Add item</Button
|
|
127
|
+
>
|
|
128
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ObjectMapOption } from "./object-map-setting.svelte";
|
|
2
|
+
import "./configuration.css";
|
|
3
|
+
type ItemType = "string" | "number" | "integer" | "boolean";
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
itemType: ItemType;
|
|
6
|
+
value?: unknown[];
|
|
7
|
+
valueOptions?: ObjectMapOption[];
|
|
8
|
+
allowUnknownOptions?: boolean;
|
|
9
|
+
onValueChange?: (value: unknown[]) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const ListSetting: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
12
|
+
type ListSetting = ReturnType<typeof ListSetting>;
|
|
13
|
+
export default ListSetting;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createDraggable, createDroppable } from "@dnd-kit/svelte";
|
|
3
|
+
import GripVertical from "@lucide/svelte/icons/grip-vertical";
|
|
4
|
+
import { cn } from "@lapis-notes/ui";
|
|
5
|
+
import * as Table from "@lapismd/design-core/shadcn/table";
|
|
6
|
+
import { Button } from "@lapismd/design-core/shadcn/button";
|
|
7
|
+
import {
|
|
8
|
+
dropIndicatorClasses,
|
|
9
|
+
isRowDragSource,
|
|
10
|
+
SETTINGS_TABLE_ROW_TYPE,
|
|
11
|
+
type SettingsTableDragSource,
|
|
12
|
+
} from "./object-array-table-dnd";
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
rowIndex,
|
|
16
|
+
dragSource,
|
|
17
|
+
dragOverIndex,
|
|
18
|
+
}: {
|
|
19
|
+
rowIndex: number;
|
|
20
|
+
dragSource: SettingsTableDragSource | null;
|
|
21
|
+
dragOverIndex: number | null;
|
|
22
|
+
} = $props();
|
|
23
|
+
|
|
24
|
+
let cellRef = $state<HTMLElement | null>(null);
|
|
25
|
+
|
|
26
|
+
const rowDraggable = createDraggable({
|
|
27
|
+
get id() {
|
|
28
|
+
return `settings-table-row:${rowIndex}`;
|
|
29
|
+
},
|
|
30
|
+
type: SETTINGS_TABLE_ROW_TYPE,
|
|
31
|
+
get data() {
|
|
32
|
+
return { type: SETTINGS_TABLE_ROW_TYPE, index: rowIndex };
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const rowDroppable = createDroppable({
|
|
37
|
+
get id() {
|
|
38
|
+
return `settings-table-row-drop:${rowIndex}:grip`;
|
|
39
|
+
},
|
|
40
|
+
accept: SETTINGS_TABLE_ROW_TYPE,
|
|
41
|
+
get data() {
|
|
42
|
+
return { type: SETTINGS_TABLE_ROW_TYPE, index: rowIndex };
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
$effect(() => {
|
|
47
|
+
if (!cellRef) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const cleanupDraggable = rowDraggable.attach(cellRef);
|
|
51
|
+
const cleanupDroppable = rowDroppable.attach(cellRef);
|
|
52
|
+
return () => {
|
|
53
|
+
cleanupDraggable();
|
|
54
|
+
cleanupDroppable();
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<Table.Cell
|
|
60
|
+
bind:ref={cellRef}
|
|
61
|
+
class={cn(
|
|
62
|
+
"config-array-table__grip",
|
|
63
|
+
dropIndicatorClasses(dragSource, dragOverIndex, rowIndex),
|
|
64
|
+
isRowDragSource(dragSource, rowIndex) && "is-drag-source is-row-drag-source",
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
<Button
|
|
68
|
+
variant="ghost"
|
|
69
|
+
size="icon"
|
|
70
|
+
class="configuration-grip-button"
|
|
71
|
+
data-grab-handle=""
|
|
72
|
+
data-testid="object-array-row-grip"
|
|
73
|
+
aria-label="Drag row"
|
|
74
|
+
{@attach rowDraggable.attachHandle}
|
|
75
|
+
>
|
|
76
|
+
<GripVertical class="configuration-grip-icon" />
|
|
77
|
+
</Button>
|
|
78
|
+
</Table.Cell>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SettingsTableDragSource } from "./object-array-table-dnd";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
rowIndex: number;
|
|
4
|
+
dragSource: SettingsTableDragSource | null;
|
|
5
|
+
dragOverIndex: number | null;
|
|
6
|
+
};
|
|
7
|
+
declare const ObjectArrayRowGrip: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type ObjectArrayRowGrip = ReturnType<typeof ObjectArrayRowGrip>;
|
|
9
|
+
export default ObjectArrayRowGrip;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Trash2 from "@lucide/svelte/icons/trash-2";
|
|
3
|
+
import { cn } from "@lapis-notes/ui";
|
|
4
|
+
import { Button } from "@lapismd/design-core/shadcn/button";
|
|
5
|
+
import { Input } from "@lapismd/design-core/shadcn/input";
|
|
6
|
+
import { Switch } from "@lapismd/design-core/shadcn/switch";
|
|
7
|
+
import * as Table from "@lapismd/design-core/shadcn/table";
|
|
8
|
+
import { Select } from "../select";
|
|
9
|
+
import type { SchemaType } from "../../configuration.svelte";
|
|
10
|
+
import type { ObjectMapOption } from "./object-map-setting.svelte";
|
|
11
|
+
import OptionsComboboxSetting from "./options-combobox-setting.svelte";
|
|
12
|
+
import {
|
|
13
|
+
buildSelectOptionsForValue,
|
|
14
|
+
isOptionsSourceComboboxField,
|
|
15
|
+
} from "./object-array-utils";
|
|
16
|
+
import ObjectArrayRowGrip from "./object-array-row-grip.svelte";
|
|
17
|
+
import {
|
|
18
|
+
isRowDragSource,
|
|
19
|
+
type SettingsTableDragSource,
|
|
20
|
+
} from "./object-array-table-dnd";
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
row,
|
|
24
|
+
index,
|
|
25
|
+
columns,
|
|
26
|
+
columnOptions = {},
|
|
27
|
+
columnOnQueryChange = {},
|
|
28
|
+
dragSource = null,
|
|
29
|
+
dragOverIndex = null,
|
|
30
|
+
showGrip = false,
|
|
31
|
+
removeDisabled = false,
|
|
32
|
+
onFieldChange,
|
|
33
|
+
onRemove,
|
|
34
|
+
}: {
|
|
35
|
+
row: Record<string, unknown>;
|
|
36
|
+
index: number;
|
|
37
|
+
columns: Array<[string, SchemaType]>;
|
|
38
|
+
columnOptions?: Record<string, ObjectMapOption[]>;
|
|
39
|
+
columnOnQueryChange?: Record<string, (query: string) => void>;
|
|
40
|
+
dragSource?: SettingsTableDragSource | null;
|
|
41
|
+
dragOverIndex?: number | null;
|
|
42
|
+
showGrip?: boolean;
|
|
43
|
+
removeDisabled?: boolean;
|
|
44
|
+
onFieldChange: (key: string, value: unknown) => void;
|
|
45
|
+
onRemove: () => void;
|
|
46
|
+
} = $props();
|
|
47
|
+
|
|
48
|
+
let draftValues = $state<Record<string, string>>({});
|
|
49
|
+
|
|
50
|
+
$effect(() => {
|
|
51
|
+
const next: Record<string, string> = {};
|
|
52
|
+
for (const [key] of columns) {
|
|
53
|
+
next[key] = String(row[key] ?? "");
|
|
54
|
+
}
|
|
55
|
+
draftValues = next;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function commitStringField(key: string): void {
|
|
59
|
+
const trimmed = draftValues[key]?.trim() ?? "";
|
|
60
|
+
if (trimmed !== String(row[key] ?? "")) {
|
|
61
|
+
onFieldChange(key, trimmed);
|
|
62
|
+
}
|
|
63
|
+
draftValues = { ...draftValues, [key]: trimmed };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function handleStringKeydown(event: KeyboardEvent, key: string): void {
|
|
67
|
+
if (event.key === "Enter") {
|
|
68
|
+
event.currentTarget instanceof HTMLInputElement &&
|
|
69
|
+
event.currentTarget.blur();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function inputTypeForString(field: SchemaType): HTMLInputElement["type"] {
|
|
74
|
+
if (field.type !== "string" || !("format" in field) || !field.format) {
|
|
75
|
+
return "text";
|
|
76
|
+
}
|
|
77
|
+
if (field.format === "email") {
|
|
78
|
+
return "email";
|
|
79
|
+
}
|
|
80
|
+
if (field.format === "uri") {
|
|
81
|
+
return "url";
|
|
82
|
+
}
|
|
83
|
+
return "text";
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<Table.Row
|
|
88
|
+
class={cn(
|
|
89
|
+
"config-array-table__row",
|
|
90
|
+
isRowDragSource(dragSource, index) && "is-row-drag-source",
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
{#if showGrip}
|
|
94
|
+
<ObjectArrayRowGrip
|
|
95
|
+
rowIndex={index}
|
|
96
|
+
{dragSource}
|
|
97
|
+
dragOverIndex={dragOverIndex ?? null}
|
|
98
|
+
/>
|
|
99
|
+
{/if}
|
|
100
|
+
{#each columns as [key, field] (key)}
|
|
101
|
+
<Table.Cell class="configuration-cell">
|
|
102
|
+
{#if field.type === "boolean"}
|
|
103
|
+
<Switch
|
|
104
|
+
checked={Boolean(row[key])}
|
|
105
|
+
onCheckedChange={(checked) => onFieldChange(key, checked)}
|
|
106
|
+
/>
|
|
107
|
+
{:else if field.type === "number" || field.type === "integer"}
|
|
108
|
+
<Input
|
|
109
|
+
type="number"
|
|
110
|
+
class="configuration-control"
|
|
111
|
+
value={String(row[key] ?? 0)}
|
|
112
|
+
oninput={(event) => {
|
|
113
|
+
const target = event.currentTarget as HTMLInputElement;
|
|
114
|
+
const parsed = Number(target.value);
|
|
115
|
+
onFieldChange(key, Number.isFinite(parsed) ? parsed : 0);
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
{:else if isOptionsSourceComboboxField(field)}
|
|
119
|
+
<OptionsComboboxSetting
|
|
120
|
+
value={String(row[key] ?? "")}
|
|
121
|
+
options={columnOptions[key] ?? []}
|
|
122
|
+
placeholder="Enter or select"
|
|
123
|
+
onValueChange={(nextValue) => onFieldChange(key, nextValue)}
|
|
124
|
+
onQueryChange={columnOnQueryChange[key]}
|
|
125
|
+
/>
|
|
126
|
+
{:else if field.type === "string" && (columnOptions[key]?.length ?? 0) > 0}
|
|
127
|
+
<Select
|
|
128
|
+
type="single"
|
|
129
|
+
value={String(row[key] ?? "")}
|
|
130
|
+
items={buildSelectOptionsForValue(
|
|
131
|
+
columnOptions[key] ?? [],
|
|
132
|
+
row[key],
|
|
133
|
+
"allowUnknownOptions" in field && field.allowUnknownOptions === true,
|
|
134
|
+
)}
|
|
135
|
+
placeholder="Select"
|
|
136
|
+
onValueChange={(nextValue) => onFieldChange(key, nextValue)}
|
|
137
|
+
/>
|
|
138
|
+
{:else if field.type === "string"}
|
|
139
|
+
<Input
|
|
140
|
+
type={inputTypeForString(field)}
|
|
141
|
+
class="configuration-control"
|
|
142
|
+
data-testid={`object-array-cell-${key}`}
|
|
143
|
+
bind:value={draftValues[key]}
|
|
144
|
+
onblur={() => commitStringField(key)}
|
|
145
|
+
onkeydown={(event) => handleStringKeydown(event, key)}
|
|
146
|
+
/>
|
|
147
|
+
{/if}
|
|
148
|
+
</Table.Cell>
|
|
149
|
+
{/each}
|
|
150
|
+
<Table.Cell class="configuration-cell-actions">
|
|
151
|
+
<Button
|
|
152
|
+
variant="ghost"
|
|
153
|
+
size="icon"
|
|
154
|
+
class="configuration-icon-button"
|
|
155
|
+
data-testid="object-array-remove-button"
|
|
156
|
+
aria-label="Remove row"
|
|
157
|
+
disabled={removeDisabled}
|
|
158
|
+
onclick={onRemove}
|
|
159
|
+
>
|
|
160
|
+
<Trash2 class="configuration-icon" />
|
|
161
|
+
</Button>
|
|
162
|
+
</Table.Cell>
|
|
163
|
+
</Table.Row>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SchemaType } from "../../configuration.svelte";
|
|
2
|
+
import type { ObjectMapOption } from "./object-map-setting.svelte";
|
|
3
|
+
import { type SettingsTableDragSource } from "./object-array-table-dnd";
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
row: Record<string, unknown>;
|
|
6
|
+
index: number;
|
|
7
|
+
columns: Array<[string, SchemaType]>;
|
|
8
|
+
columnOptions?: Record<string, ObjectMapOption[]>;
|
|
9
|
+
columnOnQueryChange?: Record<string, (query: string) => void>;
|
|
10
|
+
dragSource?: SettingsTableDragSource | null;
|
|
11
|
+
dragOverIndex?: number | null;
|
|
12
|
+
showGrip?: boolean;
|
|
13
|
+
removeDisabled?: boolean;
|
|
14
|
+
onFieldChange: (key: string, value: unknown) => void;
|
|
15
|
+
onRemove: () => void;
|
|
16
|
+
};
|
|
17
|
+
declare const ObjectArrayRow: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
18
|
+
type ObjectArrayRow = ReturnType<typeof ObjectArrayRow>;
|
|
19
|
+
export default ObjectArrayRow;
|