@aphexcms/cms-core 9.10.0 → 11.0.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/README.md +125 -0
- package/dist/ai/apply-workspace-patch.d.ts +5 -0
- package/dist/ai/apply-workspace-patch.d.ts.map +1 -0
- package/dist/ai/apply-workspace-patch.js +25 -0
- package/dist/ai/default-system-prompt.d.ts +1 -1
- package/dist/ai/default-system-prompt.d.ts.map +1 -1
- package/dist/ai/default-system-prompt.js +29 -11
- package/dist/ai/document-artifact-links.d.ts +3 -0
- package/dist/ai/document-artifact-links.d.ts.map +1 -0
- package/dist/ai/document-artifact-links.js +17 -0
- package/dist/ai/run-agent-turn.d.ts +2 -0
- package/dist/ai/run-agent-turn.d.ts.map +1 -1
- package/dist/ai/run-agent-turn.js +92 -2
- package/dist/ai/workspace-tool-messages.d.ts +14 -0
- package/dist/ai/workspace-tool-messages.d.ts.map +1 -0
- package/dist/ai/workspace-tool-messages.js +22 -0
- package/dist/api/assets.d.ts +63 -7
- package/dist/api/assets.d.ts.map +1 -1
- package/dist/api/assets.js +120 -9
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +39 -9
- package/dist/api/limits.d.ts +55 -0
- package/dist/api/limits.d.ts.map +1 -0
- package/dist/api/limits.js +58 -0
- package/dist/api/schemas/assets.d.ts +94 -4
- package/dist/api/schemas/assets.d.ts.map +1 -1
- package/dist/api/schemas/assets.js +82 -5
- package/dist/api/types.d.ts +27 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/upload-timeout.d.ts +17 -0
- package/dist/api/upload-timeout.d.ts.map +1 -0
- package/dist/api/upload-timeout.js +35 -0
- package/dist/api/upload.d.ts +42 -0
- package/dist/api/upload.d.ts.map +1 -0
- package/dist/api/upload.js +144 -0
- package/dist/cli/index.js +16 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/client/api.js +1 -1
- package/dist/components/AdminApp.svelte +137 -28
- package/dist/components/AdminApp.svelte.d.ts.map +1 -1
- package/dist/components/admin/AgentChat.svelte +101 -21
- package/dist/components/admin/AgentChat.svelte.d.ts.map +1 -1
- package/dist/components/admin/AssetBrowserModal.svelte +34 -5
- package/dist/components/admin/AssetBrowserModal.svelte.d.ts +10 -1
- package/dist/components/admin/AssetBrowserModal.svelte.d.ts.map +1 -1
- package/dist/components/admin/AssetImage.svelte +57 -0
- package/dist/components/admin/AssetImage.svelte.d.ts +16 -0
- package/dist/components/admin/AssetImage.svelte.d.ts.map +1 -0
- package/dist/components/admin/DocumentEditor.svelte +36 -17
- package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
- package/dist/components/admin/MediaBrowser.svelte +2081 -288
- package/dist/components/admin/MediaBrowser.svelte.d.ts +39 -1
- package/dist/components/admin/MediaBrowser.svelte.d.ts.map +1 -1
- package/dist/components/admin/ObjectModal.svelte +29 -3
- package/dist/components/admin/ObjectModal.svelte.d.ts +6 -0
- package/dist/components/admin/ObjectModal.svelte.d.ts.map +1 -1
- package/dist/components/admin/SchemaField.svelte +151 -111
- package/dist/components/admin/SchemaField.svelte.d.ts +10 -0
- package/dist/components/admin/SchemaField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/ArrayField.svelte +51 -14
- package/dist/components/admin/fields/ArrayField.svelte.d.ts +8 -0
- package/dist/components/admin/fields/ArrayField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/FieldInput.svelte +22 -2
- package/dist/components/admin/fields/FieldInput.svelte.d.ts +2 -0
- package/dist/components/admin/fields/FieldInput.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/FileField.svelte +29 -7
- package/dist/components/admin/fields/FileField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/ImageField.svelte +73 -16
- package/dist/components/admin/fields/ImageField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/ReferenceField.svelte +99 -29
- package/dist/components/admin/fields/ReferenceField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/SlugField.svelte +7 -2
- package/dist/components/admin/fields/SlugField.svelte.d.ts +3 -0
- package/dist/components/admin/fields/SlugField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/StringField.svelte +48 -4
- package/dist/components/admin/fields/StringField.svelte.d.ts +12 -0
- package/dist/components/admin/fields/StringField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/ImageBlockModal.svelte +7 -1
- package/dist/components/admin/fields/richtext/ImageBlockModal.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +11 -2
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/RichtextField.svelte +6 -1
- package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts +2 -0
- package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -1
- package/dist/components/layout/OrganizationSwitcher.svelte +13 -2
- package/dist/components/layout/OrganizationSwitcher.svelte.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -0
- package/dist/db/interfaces/asset.d.ts +118 -5
- package/dist/db/interfaces/asset.d.ts.map +1 -1
- package/dist/db/interfaces/document.d.ts +105 -3
- package/dist/db/interfaces/document.d.ts.map +1 -1
- package/dist/db/interfaces/events.d.ts +5 -1
- package/dist/db/interfaces/events.d.ts.map +1 -1
- package/dist/field-validation/utils.d.ts.map +1 -1
- package/dist/field-validation/utils.js +18 -1
- package/dist/graphql/resolvers.d.ts.map +1 -1
- package/dist/graphql/resolvers.js +94 -72
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +3 -1
- package/dist/image/Image.svelte +72 -0
- package/dist/image/Image.svelte.d.ts +40 -0
- package/dist/image/Image.svelte.d.ts.map +1 -0
- package/dist/image/index.d.ts +3 -0
- package/dist/image/index.d.ts.map +1 -0
- package/dist/image/index.js +11 -0
- package/dist/image/types.d.ts +28 -0
- package/dist/image/types.d.ts.map +1 -0
- package/dist/image/types.js +1 -0
- package/dist/images/generate.d.ts +55 -0
- package/dist/images/generate.d.ts.map +1 -0
- package/dist/images/generate.js +243 -0
- package/dist/images/index.d.ts +2 -0
- package/dist/images/index.d.ts.map +1 -0
- package/dist/images/index.js +7 -0
- package/dist/images/variants.d.ts +82 -0
- package/dist/images/variants.d.ts.map +1 -0
- package/dist/images/variants.js +143 -0
- package/dist/jobs/asset-reference-jobs.d.ts +49 -0
- package/dist/jobs/asset-reference-jobs.d.ts.map +1 -0
- package/dist/jobs/asset-reference-jobs.js +74 -0
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.d.ts.map +1 -1
- package/dist/jobs/index.js +1 -0
- package/dist/jobs/recurring.d.ts +78 -0
- package/dist/jobs/recurring.d.ts.map +1 -0
- package/dist/jobs/recurring.js +69 -0
- package/dist/jobs/run-batch.d.ts.map +1 -1
- package/dist/jobs/run-batch.js +5 -0
- package/dist/local-api/collection-api.d.ts +22 -3
- package/dist/local-api/collection-api.d.ts.map +1 -1
- package/dist/local-api/collection-api.js +90 -20
- package/dist/local-api/index.d.ts +10 -2
- package/dist/local-api/index.d.ts.map +1 -1
- package/dist/local-api/index.js +9 -1
- package/dist/logo-appearance.d.ts +3 -0
- package/dist/logo-appearance.d.ts.map +1 -0
- package/dist/logo-appearance.js +11 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +14 -8
- package/dist/plugins/types.d.ts +9 -1
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/preview/assets.d.ts +19 -0
- package/dist/preview/assets.d.ts.map +1 -1
- package/dist/preview/assets.js +6 -0
- package/dist/preview/stega.js +49 -13
- package/dist/routes/assets-cdn.d.ts +19 -0
- package/dist/routes/assets-cdn.d.ts.map +1 -1
- package/dist/routes/assets-cdn.js +348 -55
- package/dist/schema-utils/index.d.ts +1 -0
- package/dist/schema-utils/index.d.ts.map +1 -1
- package/dist/schema-utils/index.js +1 -0
- package/dist/schema-utils/utils.d.ts +2 -7
- package/dist/schema-utils/utils.d.ts.map +1 -1
- package/dist/schema-utils/utils.js +3 -1
- package/dist/schema-utils/visibility.d.ts +64 -0
- package/dist/schema-utils/visibility.d.ts.map +1 -0
- package/dist/schema-utils/visibility.js +23 -0
- package/dist/server/api/index.d.ts +2 -0
- package/dist/server/api/index.d.ts.map +1 -1
- package/dist/server/api/index.js +88 -9
- package/dist/server/api/routes/assets-bulk.d.ts.map +1 -1
- package/dist/server/api/routes/assets-bulk.js +36 -7
- package/dist/server/api/routes/assets-by-id.d.ts.map +1 -1
- package/dist/server/api/routes/assets-by-id.js +32 -15
- package/dist/server/api/routes/assets-direct-upload.d.ts +4 -0
- package/dist/server/api/routes/assets-direct-upload.d.ts.map +1 -0
- package/dist/server/api/routes/assets-direct-upload.js +195 -0
- package/dist/server/api/routes/assets-poster.d.ts +4 -0
- package/dist/server/api/routes/assets-poster.d.ts.map +1 -0
- package/dist/server/api/routes/assets-poster.js +119 -0
- package/dist/server/api/routes/assets-references.d.ts.map +1 -1
- package/dist/server/api/routes/assets-references.js +64 -5
- package/dist/server/api/routes/assets.d.ts.map +1 -1
- package/dist/server/api/routes/assets.js +173 -17
- package/dist/server/api/routes/clear-asset-references.d.ts +18 -0
- package/dist/server/api/routes/clear-asset-references.d.ts.map +1 -0
- package/dist/server/api/routes/clear-asset-references.js +31 -0
- package/dist/server/api/routes/documents.d.ts.map +1 -1
- package/dist/server/api/routes/documents.js +27 -1
- package/dist/server/health.d.ts +40 -0
- package/dist/server/health.d.ts.map +1 -0
- package/dist/server/health.js +75 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +10 -0
- package/dist/services/asset-references-service.d.ts +93 -0
- package/dist/services/asset-references-service.d.ts.map +1 -0
- package/dist/services/asset-references-service.js +197 -0
- package/dist/services/asset-service.d.ts +124 -14
- package/dist/services/asset-service.d.ts.map +1 -1
- package/dist/services/asset-service.js +401 -34
- package/dist/services/references-service.d.ts +19 -15
- package/dist/services/references-service.d.ts.map +1 -1
- package/dist/services/references-service.js +59 -31
- package/dist/services/version-service.d.ts +10 -1
- package/dist/services/version-service.d.ts.map +1 -1
- package/dist/services/version-service.js +26 -4
- package/dist/storage/adapters/local-storage-adapter.d.ts +38 -0
- package/dist/storage/adapters/local-storage-adapter.d.ts.map +1 -1
- package/dist/storage/adapters/local-storage-adapter.js +86 -19
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -0
- package/dist/storage/interfaces/storage.d.ts +135 -5
- package/dist/storage/interfaces/storage.d.ts.map +1 -1
- package/dist/storage/keys.d.ts +96 -0
- package/dist/storage/keys.d.ts.map +1 -0
- package/dist/storage/keys.js +159 -0
- package/dist/type-gen.d.ts.map +1 -1
- package/dist/type-gen.js +46 -5
- package/dist/types/asset.d.ts +103 -12
- package/dist/types/asset.d.ts.map +1 -1
- package/dist/types/capabilities.d.ts +11 -0
- package/dist/types/capabilities.d.ts.map +1 -1
- package/dist/types/capabilities.js +20 -6
- package/dist/types/config.d.ts +138 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/document-workspace.d.ts +8 -1
- package/dist/types/document-workspace.d.ts.map +1 -1
- package/dist/types/events.d.ts +20 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/organization.d.ts +2 -0
- package/dist/types/organization.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +33 -2
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/utils/asset-privacy.d.ts +36 -0
- package/dist/utils/asset-privacy.d.ts.map +1 -0
- package/dist/utils/asset-privacy.js +73 -0
- package/dist/utils/asset-reference-walk.d.ts +44 -0
- package/dist/utils/asset-reference-walk.d.ts.map +1 -0
- package/dist/utils/asset-reference-walk.js +143 -0
- package/dist/utils/asset-url-signing.d.ts +28 -0
- package/dist/utils/asset-url-signing.d.ts.map +1 -0
- package/dist/utils/asset-url-signing.js +82 -0
- package/dist/utils/file-accept.d.ts +31 -0
- package/dist/utils/file-accept.d.ts.map +1 -0
- package/dist/utils/file-accept.js +143 -0
- package/dist/utils/image-support.d.ts +8 -0
- package/dist/utils/image-support.d.ts.map +1 -0
- package/dist/utils/image-support.js +31 -0
- package/dist/utils/image-url.d.ts +61 -26
- package/dist/utils/image-url.d.ts.map +1 -1
- package/dist/utils/image-url.js +143 -26
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/mime-detect.d.ts +2 -2
- package/dist/utils/mime-detect.d.ts.map +1 -1
- package/dist/utils/mime-detect.js +45 -21
- package/dist/utils/video-metadata.d.ts +39 -0
- package/dist/utils/video-metadata.d.ts.map +1 -0
- package/dist/utils/video-metadata.js +160 -0
- package/package.json +8 -3
- package/dist/auth/MULTI_TENANCY_PLAN.md +0 -1183
- package/dist/lib/admin/block-previews.svelte.d.ts +0 -46
- package/dist/lib/admin/block-previews.svelte.d.ts.map +0 -1
- package/dist/lib/admin/block-previews.svelte.js +0 -27
- package/dist/lib/admin/block-previews.svelte.js.map +0 -1
- package/dist/lib/admin/field-components.svelte.d.ts +0 -16
- package/dist/lib/admin/field-components.svelte.d.ts.map +0 -1
- package/dist/lib/admin/field-components.svelte.js +0 -19
- package/dist/lib/admin/field-components.svelte.js.map +0 -1
- package/dist/lib/admin/nav.svelte.d.ts +0 -34
- package/dist/lib/admin/nav.svelte.d.ts.map +0 -1
- package/dist/lib/admin/nav.svelte.js +0 -79
- package/dist/lib/admin/nav.svelte.js.map +0 -1
- package/dist/lib/admin/slots.svelte.d.ts +0 -50
- package/dist/lib/admin/slots.svelte.d.ts.map +0 -1
- package/dist/lib/admin/slots.svelte.js +0 -68
- package/dist/lib/admin/slots.svelte.js.map +0 -1
- package/dist/lib/admin/types.d.ts +0 -7
- package/dist/lib/admin/types.d.ts.map +0 -1
- package/dist/lib/admin/types.js +0 -2
- package/dist/lib/admin/types.js.map +0 -1
- package/dist/lib/agent-chat-state.svelte.d.ts +0 -38
- package/dist/lib/agent-chat-state.svelte.d.ts.map +0 -1
- package/dist/lib/agent-chat-state.svelte.js +0 -87
- package/dist/lib/agent-chat-state.svelte.js.map +0 -1
- package/dist/lib/ai/content-workspace-tools.d.ts +0 -3
- package/dist/lib/ai/content-workspace-tools.d.ts.map +0 -1
- package/dist/lib/ai/content-workspace-tools.js +0 -51
- package/dist/lib/ai/content-workspace-tools.js.map +0 -1
- package/dist/lib/ai/default-system-prompt.d.ts +0 -2
- package/dist/lib/ai/default-system-prompt.d.ts.map +0 -1
- package/dist/lib/ai/default-system-prompt.js +0 -16
- package/dist/lib/ai/default-system-prompt.js.map +0 -1
- package/dist/lib/ai/index.d.ts +0 -2
- package/dist/lib/ai/index.d.ts.map +0 -1
- package/dist/lib/ai/index.js +0 -5
- package/dist/lib/ai/index.js.map +0 -1
- package/dist/lib/ai/interfaces/ai-provider.d.ts +0 -67
- package/dist/lib/ai/interfaces/ai-provider.d.ts.map +0 -1
- package/dist/lib/ai/interfaces/ai-provider.js +0 -17
- package/dist/lib/ai/interfaces/ai-provider.js.map +0 -1
- package/dist/lib/ai/run-agent-turn.d.ts +0 -29
- package/dist/lib/ai/run-agent-turn.d.ts.map +0 -1
- package/dist/lib/ai/run-agent-turn.js +0 -167
- package/dist/lib/ai/run-agent-turn.js.map +0 -1
- package/dist/lib/api/agent-chat.d.ts +0 -27
- package/dist/lib/api/agent-chat.d.ts.map +0 -1
- package/dist/lib/api/agent-chat.js +0 -65
- package/dist/lib/api/agent-chat.js.map +0 -1
- package/dist/lib/api/api-keys.d.ts +0 -43
- package/dist/lib/api/api-keys.d.ts.map +0 -1
- package/dist/lib/api/api-keys.js +0 -21
- package/dist/lib/api/api-keys.js.map +0 -1
- package/dist/lib/api/assets.d.ts +0 -60
- package/dist/lib/api/assets.d.ts.map +0 -1
- package/dist/lib/api/assets.js +0 -65
- package/dist/lib/api/assets.js.map +0 -1
- package/dist/lib/api/client.d.ts +0 -37
- package/dist/lib/api/client.d.ts.map +0 -1
- package/dist/lib/api/client.js +0 -132
- package/dist/lib/api/client.js.map +0 -1
- package/dist/lib/api/documents.d.ts +0 -128
- package/dist/lib/api/documents.d.ts.map +0 -1
- package/dist/lib/api/documents.js +0 -146
- package/dist/lib/api/documents.js.map +0 -1
- package/dist/lib/api/index.d.ts +0 -16
- package/dist/lib/api/index.d.ts.map +0 -1
- package/dist/lib/api/index.js +0 -11
- package/dist/lib/api/index.js.map +0 -1
- package/dist/lib/api/instance.d.ts +0 -17
- package/dist/lib/api/instance.d.ts.map +0 -1
- package/dist/lib/api/instance.js +0 -22
- package/dist/lib/api/instance.js.map +0 -1
- package/dist/lib/api/invitations.d.ts +0 -37
- package/dist/lib/api/invitations.d.ts.map +0 -1
- package/dist/lib/api/invitations.js +0 -28
- package/dist/lib/api/invitations.js.map +0 -1
- package/dist/lib/api/organizations.d.ts +0 -89
- package/dist/lib/api/organizations.d.ts.map +0 -1
- package/dist/lib/api/organizations.js +0 -101
- package/dist/lib/api/organizations.js.map +0 -1
- package/dist/lib/api/roles.d.ts +0 -22
- package/dist/lib/api/roles.d.ts.map +0 -1
- package/dist/lib/api/roles.js +0 -27
- package/dist/lib/api/roles.js.map +0 -1
- package/dist/lib/api/schemas/agent-chat.d.ts +0 -45
- package/dist/lib/api/schemas/agent-chat.d.ts.map +0 -1
- package/dist/lib/api/schemas/agent-chat.js +0 -36
- package/dist/lib/api/schemas/agent-chat.js.map +0 -1
- package/dist/lib/api/schemas/agent-operations.d.ts +0 -13
- package/dist/lib/api/schemas/agent-operations.d.ts.map +0 -1
- package/dist/lib/api/schemas/agent-operations.js +0 -16
- package/dist/lib/api/schemas/agent-operations.js.map +0 -1
- package/dist/lib/api/schemas/api-keys.d.ts +0 -29
- package/dist/lib/api/schemas/api-keys.d.ts.map +0 -1
- package/dist/lib/api/schemas/api-keys.js +0 -32
- package/dist/lib/api/schemas/api-keys.js.map +0 -1
- package/dist/lib/api/schemas/assets.d.ts +0 -178
- package/dist/lib/api/schemas/assets.d.ts.map +0 -1
- package/dist/lib/api/schemas/assets.js +0 -103
- package/dist/lib/api/schemas/assets.js.map +0 -1
- package/dist/lib/api/schemas/documents.d.ts +0 -368
- package/dist/lib/api/schemas/documents.d.ts.map +0 -1
- package/dist/lib/api/schemas/documents.js +0 -205
- package/dist/lib/api/schemas/documents.js.map +0 -1
- package/dist/lib/api/schemas/instance.d.ts +0 -6
- package/dist/lib/api/schemas/instance.d.ts.map +0 -1
- package/dist/lib/api/schemas/instance.js +0 -8
- package/dist/lib/api/schemas/instance.js.map +0 -1
- package/dist/lib/api/schemas/jobs.d.ts +0 -15
- package/dist/lib/api/schemas/jobs.d.ts.map +0 -1
- package/dist/lib/api/schemas/jobs.js +0 -18
- package/dist/lib/api/schemas/jobs.js.map +0 -1
- package/dist/lib/api/schemas/organizations.d.ts +0 -41
- package/dist/lib/api/schemas/organizations.d.ts.map +0 -1
- package/dist/lib/api/schemas/organizations.js +0 -57
- package/dist/lib/api/schemas/organizations.js.map +0 -1
- package/dist/lib/api/schemas/plugin-settings.d.ts +0 -6
- package/dist/lib/api/schemas/plugin-settings.d.ts.map +0 -1
- package/dist/lib/api/schemas/plugin-settings.js +0 -9
- package/dist/lib/api/schemas/plugin-settings.js.map +0 -1
- package/dist/lib/api/schemas/roles.d.ts +0 -28
- package/dist/lib/api/schemas/roles.d.ts.map +0 -1
- package/dist/lib/api/schemas/roles.js +0 -48
- package/dist/lib/api/schemas/roles.js.map +0 -1
- package/dist/lib/api/schemas/user.d.ts +0 -21
- package/dist/lib/api/schemas/user.d.ts.map +0 -1
- package/dist/lib/api/schemas/user.js +0 -31
- package/dist/lib/api/schemas/user.js.map +0 -1
- package/dist/lib/api/types.d.ts +0 -47
- package/dist/lib/api/types.d.ts.map +0 -1
- package/dist/lib/api/types.js +0 -2
- package/dist/lib/api/types.js.map +0 -1
- package/dist/lib/api/user.d.ts +0 -21
- package/dist/lib/api/user.d.ts.map +0 -1
- package/dist/lib/api/user.js +0 -21
- package/dist/lib/api/user.js.map +0 -1
- package/dist/lib/app-augment.d.ts +0 -43
- package/dist/lib/app-augment.d.ts.map +0 -1
- package/dist/lib/app-augment.js +0 -19
- package/dist/lib/app-augment.js.map +0 -1
- package/dist/lib/auth/account-deletion.d.ts +0 -35
- package/dist/lib/auth/account-deletion.d.ts.map +0 -1
- package/dist/lib/auth/account-deletion.js +0 -66
- package/dist/lib/auth/account-deletion.js.map +0 -1
- package/dist/lib/auth/auth-errors.d.ts +0 -7
- package/dist/lib/auth/auth-errors.d.ts.map +0 -1
- package/dist/lib/auth/auth-errors.js +0 -14
- package/dist/lib/auth/auth-errors.js.map +0 -1
- package/dist/lib/auth/auth-hooks.d.ts +0 -7
- package/dist/lib/auth/auth-hooks.d.ts.map +0 -1
- package/dist/lib/auth/auth-hooks.js +0 -157
- package/dist/lib/auth/auth-hooks.js.map +0 -1
- package/dist/lib/auth/bootstrap.d.ts +0 -104
- package/dist/lib/auth/bootstrap.d.ts.map +0 -1
- package/dist/lib/auth/bootstrap.js +0 -165
- package/dist/lib/auth/bootstrap.js.map +0 -1
- package/dist/lib/auth/instance-state.d.ts +0 -13
- package/dist/lib/auth/instance-state.d.ts.map +0 -1
- package/dist/lib/auth/instance-state.js +0 -31
- package/dist/lib/auth/instance-state.js.map +0 -1
- package/dist/lib/auth/invitation-status.d.ts +0 -25
- package/dist/lib/auth/invitation-status.d.ts.map +0 -1
- package/dist/lib/auth/invitation-status.js +0 -42
- package/dist/lib/auth/invitation-status.js.map +0 -1
- package/dist/lib/auth/provider.d.ts +0 -25
- package/dist/lib/auth/provider.d.ts.map +0 -1
- package/dist/lib/auth/provider.js +0 -2
- package/dist/lib/auth/provider.js.map +0 -1
- package/dist/lib/auth/sign-up-policy.d.ts +0 -62
- package/dist/lib/auth/sign-up-policy.d.ts.map +0 -1
- package/dist/lib/auth/sign-up-policy.js +0 -121
- package/dist/lib/auth/sign-up-policy.js.map +0 -1
- package/dist/lib/cache/adapters/in-memory-cache-adapter.d.ts +0 -21
- package/dist/lib/cache/adapters/in-memory-cache-adapter.d.ts.map +0 -1
- package/dist/lib/cache/adapters/in-memory-cache-adapter.js +0 -51
- package/dist/lib/cache/adapters/in-memory-cache-adapter.js.map +0 -1
- package/dist/lib/cache/document-cache.d.ts +0 -18
- package/dist/lib/cache/document-cache.d.ts.map +0 -1
- package/dist/lib/cache/document-cache.js +0 -46
- package/dist/lib/cache/document-cache.js.map +0 -1
- package/dist/lib/cache/index.d.ts +0 -4
- package/dist/lib/cache/index.d.ts.map +0 -1
- package/dist/lib/cache/index.js +0 -3
- package/dist/lib/cache/index.js.map +0 -1
- package/dist/lib/cache/interfaces/cache.d.ts +0 -18
- package/dist/lib/cache/interfaces/cache.d.ts.map +0 -1
- package/dist/lib/cache/interfaces/cache.js +0 -2
- package/dist/lib/cache/interfaces/cache.js.map +0 -1
- package/dist/lib/chunk-recovery.d.ts +0 -33
- package/dist/lib/chunk-recovery.d.ts.map +0 -1
- package/dist/lib/chunk-recovery.js +0 -132
- package/dist/lib/chunk-recovery.js.map +0 -1
- package/dist/lib/client/api.d.ts +0 -2
- package/dist/lib/client/api.d.ts.map +0 -1
- package/dist/lib/client/api.js +0 -12
- package/dist/lib/client/api.js.map +0 -1
- package/dist/lib/client/index.d.ts +0 -37
- package/dist/lib/client/index.d.ts.map +0 -1
- package/dist/lib/client/index.js +0 -55
- package/dist/lib/client/index.js.map +0 -1
- package/dist/lib/client/ui.d.ts +0 -26
- package/dist/lib/client/ui.d.ts.map +0 -1
- package/dist/lib/client/ui.js +0 -55
- package/dist/lib/client/ui.js.map +0 -1
- package/dist/lib/components/admin/confirm-dialog/confirm-dialog.svelte.d.ts +0 -16
- package/dist/lib/components/admin/confirm-dialog/confirm-dialog.svelte.d.ts.map +0 -1
- package/dist/lib/components/admin/confirm-dialog/confirm-dialog.svelte.js +0 -30
- package/dist/lib/components/admin/confirm-dialog/confirm-dialog.svelte.js.map +0 -1
- package/dist/lib/components/admin/fields/richtext/block-defaults.d.ts +0 -4
- package/dist/lib/components/admin/fields/richtext/block-defaults.d.ts.map +0 -1
- package/dist/lib/components/admin/fields/richtext/block-defaults.js +0 -9
- package/dist/lib/components/admin/fields/richtext/block-defaults.js.map +0 -1
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.d.ts +0 -7
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.d.ts.map +0 -1
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.js +0 -34
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.js.map +0 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.d.ts +0 -11
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.d.ts.map +0 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.js +0 -32
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.js.map +0 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.d.ts +0 -18
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.d.ts.map +0 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.js +0 -34
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.js.map +0 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.d.ts +0 -38
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.d.ts.map +0 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.js +0 -321
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.js.map +0 -1
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.d.ts +0 -8
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.d.ts.map +0 -1
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.js +0 -68
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.js.map +0 -1
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.d.ts +0 -23
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.d.ts.map +0 -1
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.js +0 -94
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.js.map +0 -1
- package/dist/lib/components/fields/index.d.ts +0 -10
- package/dist/lib/components/fields/index.d.ts.map +0 -1
- package/dist/lib/components/fields/index.js +0 -11
- package/dist/lib/components/fields/index.js.map +0 -1
- package/dist/lib/components/index.d.ts +0 -10
- package/dist/lib/components/index.d.ts.map +0 -1
- package/dist/lib/components/index.js +0 -16
- package/dist/lib/components/index.js.map +0 -1
- package/dist/lib/config.d.ts +0 -3
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -26
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/db/adapters/index.d.ts +0 -1
- package/dist/lib/db/adapters/index.d.ts.map +0 -1
- package/dist/lib/db/adapters/index.js +0 -5
- package/dist/lib/db/adapters/index.js.map +0 -1
- package/dist/lib/db/index.d.ts +0 -2
- package/dist/lib/db/index.d.ts.map +0 -1
- package/dist/lib/db/index.js +0 -5
- package/dist/lib/db/index.js.map +0 -1
- package/dist/lib/db/interfaces/agent-change-sets.d.ts +0 -17
- package/dist/lib/db/interfaces/agent-change-sets.d.ts.map +0 -1
- package/dist/lib/db/interfaces/agent-change-sets.js +0 -2
- package/dist/lib/db/interfaces/agent-change-sets.js.map +0 -1
- package/dist/lib/db/interfaces/asset.d.ts +0 -72
- package/dist/lib/db/interfaces/asset.d.ts.map +0 -1
- package/dist/lib/db/interfaces/asset.js +0 -2
- package/dist/lib/db/interfaces/asset.js.map +0 -1
- package/dist/lib/db/interfaces/document.d.ts +0 -132
- package/dist/lib/db/interfaces/document.d.ts.map +0 -1
- package/dist/lib/db/interfaces/document.js +0 -20
- package/dist/lib/db/interfaces/document.js.map +0 -1
- package/dist/lib/db/interfaces/events.d.ts +0 -82
- package/dist/lib/db/interfaces/events.d.ts.map +0 -1
- package/dist/lib/db/interfaces/events.js +0 -2
- package/dist/lib/db/interfaces/events.js.map +0 -1
- package/dist/lib/db/interfaces/index.d.ts +0 -100
- package/dist/lib/db/interfaces/index.d.ts.map +0 -1
- package/dist/lib/db/interfaces/index.js +0 -3
- package/dist/lib/db/interfaces/index.js.map +0 -1
- package/dist/lib/db/interfaces/instance.d.ts +0 -36
- package/dist/lib/db/interfaces/instance.d.ts.map +0 -1
- package/dist/lib/db/interfaces/instance.js +0 -9
- package/dist/lib/db/interfaces/instance.js.map +0 -1
- package/dist/lib/db/interfaces/organization.d.ts +0 -28
- package/dist/lib/db/interfaces/organization.d.ts.map +0 -1
- package/dist/lib/db/interfaces/organization.js +0 -2
- package/dist/lib/db/interfaces/organization.js.map +0 -1
- package/dist/lib/db/interfaces/plugin-settings.d.ts +0 -23
- package/dist/lib/db/interfaces/plugin-settings.d.ts.map +0 -1
- package/dist/lib/db/interfaces/plugin-settings.js +0 -14
- package/dist/lib/db/interfaces/plugin-settings.js.map +0 -1
- package/dist/lib/db/interfaces/plugin-storage.d.ts +0 -39
- package/dist/lib/db/interfaces/plugin-storage.d.ts.map +0 -1
- package/dist/lib/db/interfaces/plugin-storage.js +0 -2
- package/dist/lib/db/interfaces/plugin-storage.js.map +0 -1
- package/dist/lib/db/interfaces/reference.d.ts +0 -43
- package/dist/lib/db/interfaces/reference.d.ts.map +0 -1
- package/dist/lib/db/interfaces/reference.js +0 -5
- package/dist/lib/db/interfaces/reference.js.map +0 -1
- package/dist/lib/db/interfaces/role.d.ts +0 -34
- package/dist/lib/db/interfaces/role.d.ts.map +0 -1
- package/dist/lib/db/interfaces/role.js +0 -2
- package/dist/lib/db/interfaces/role.js.map +0 -1
- package/dist/lib/db/interfaces/schema.d.ts +0 -21
- package/dist/lib/db/interfaces/schema.d.ts.map +0 -1
- package/dist/lib/db/interfaces/schema.js +0 -2
- package/dist/lib/db/interfaces/schema.js.map +0 -1
- package/dist/lib/db/interfaces/user.d.ts +0 -17
- package/dist/lib/db/interfaces/user.d.ts.map +0 -1
- package/dist/lib/db/interfaces/user.js +0 -2
- package/dist/lib/db/interfaces/user.js.map +0 -1
- package/dist/lib/db/utils/reference-resolver.d.ts +0 -16
- package/dist/lib/db/utils/reference-resolver.d.ts.map +0 -1
- package/dist/lib/db/utils/reference-resolver.js +0 -83
- package/dist/lib/db/utils/reference-resolver.js.map +0 -1
- package/dist/lib/define.d.ts +0 -3
- package/dist/lib/define.d.ts.map +0 -1
- package/dist/lib/define.js +0 -5
- package/dist/lib/define.js.map +0 -1
- package/dist/lib/document-refresh.svelte.d.ts +0 -5
- package/dist/lib/document-refresh.svelte.d.ts.map +0 -1
- package/dist/lib/document-refresh.svelte.js +0 -37
- package/dist/lib/document-refresh.svelte.js.map +0 -1
- package/dist/lib/document-workspace-registry.svelte.d.ts +0 -15
- package/dist/lib/document-workspace-registry.svelte.d.ts.map +0 -1
- package/dist/lib/document-workspace-registry.svelte.js +0 -31
- package/dist/lib/document-workspace-registry.svelte.js.map +0 -1
- package/dist/lib/email/index.d.ts +0 -2
- package/dist/lib/email/index.d.ts.map +0 -1
- package/dist/lib/email/index.js +0 -5
- package/dist/lib/email/index.js.map +0 -1
- package/dist/lib/email/interfaces/email.d.ts +0 -42
- package/dist/lib/email/interfaces/email.d.ts.map +0 -1
- package/dist/lib/email/interfaces/email.js +0 -2
- package/dist/lib/email/interfaces/email.js.map +0 -1
- package/dist/lib/engine.d.ts +0 -54
- package/dist/lib/engine.d.ts.map +0 -1
- package/dist/lib/engine.js +0 -120
- package/dist/lib/engine.js.map +0 -1
- package/dist/lib/events/built-in-consumers.d.ts +0 -20
- package/dist/lib/events/built-in-consumers.d.ts.map +0 -1
- package/dist/lib/events/built-in-consumers.js +0 -50
- package/dist/lib/events/built-in-consumers.js.map +0 -1
- package/dist/lib/events/catalog.d.ts +0 -24
- package/dist/lib/events/catalog.d.ts.map +0 -1
- package/dist/lib/events/catalog.js +0 -29
- package/dist/lib/events/catalog.js.map +0 -1
- package/dist/lib/events/consumer.d.ts +0 -93
- package/dist/lib/events/consumer.d.ts.map +0 -1
- package/dist/lib/events/consumer.js +0 -78
- package/dist/lib/events/consumer.js.map +0 -1
- package/dist/lib/events/define-event.d.ts +0 -17
- package/dist/lib/events/define-event.d.ts.map +0 -1
- package/dist/lib/events/define-event.js +0 -8
- package/dist/lib/events/define-event.js.map +0 -1
- package/dist/lib/events/emit.d.ts +0 -34
- package/dist/lib/events/emit.d.ts.map +0 -1
- package/dist/lib/events/emit.js +0 -52
- package/dist/lib/events/emit.js.map +0 -1
- package/dist/lib/events/index.d.ts +0 -6
- package/dist/lib/events/index.d.ts.map +0 -1
- package/dist/lib/events/index.js +0 -6
- package/dist/lib/events/index.js.map +0 -1
- package/dist/lib/field-access.d.ts +0 -30
- package/dist/lib/field-access.d.ts.map +0 -1
- package/dist/lib/field-access.js +0 -84
- package/dist/lib/field-access.js.map +0 -1
- package/dist/lib/field-validation/date-utils.d.ts +0 -30
- package/dist/lib/field-validation/date-utils.d.ts.map +0 -1
- package/dist/lib/field-validation/date-utils.js +0 -149
- package/dist/lib/field-validation/date-utils.js.map +0 -1
- package/dist/lib/field-validation/rule.d.ts +0 -55
- package/dist/lib/field-validation/rule.d.ts.map +0 -1
- package/dist/lib/field-validation/rule.js +0 -404
- package/dist/lib/field-validation/rule.js.map +0 -1
- package/dist/lib/field-validation/utils.d.ts +0 -81
- package/dist/lib/field-validation/utils.d.ts.map +0 -1
- package/dist/lib/field-validation/utils.js +0 -523
- package/dist/lib/field-validation/utils.js.map +0 -1
- package/dist/lib/forms/define-form.d.ts +0 -25
- package/dist/lib/forms/define-form.d.ts.map +0 -1
- package/dist/lib/forms/define-form.js +0 -23
- package/dist/lib/forms/define-form.js.map +0 -1
- package/dist/lib/forms/index.d.ts +0 -4
- package/dist/lib/forms/index.d.ts.map +0 -1
- package/dist/lib/forms/index.js +0 -6
- package/dist/lib/forms/index.js.map +0 -1
- package/dist/lib/forms/types.d.ts +0 -49
- package/dist/lib/forms/types.d.ts.map +0 -1
- package/dist/lib/forms/types.js +0 -2
- package/dist/lib/forms/types.js.map +0 -1
- package/dist/lib/forms/validate.d.ts +0 -9
- package/dist/lib/forms/validate.d.ts.map +0 -1
- package/dist/lib/forms/validate.js +0 -19
- package/dist/lib/forms/validate.js.map +0 -1
- package/dist/lib/graphql/depth-limit.d.ts +0 -8
- package/dist/lib/graphql/depth-limit.d.ts.map +0 -1
- package/dist/lib/graphql/depth-limit.js +0 -80
- package/dist/lib/graphql/depth-limit.js.map +0 -1
- package/dist/lib/graphql/index.d.ts +0 -23
- package/dist/lib/graphql/index.d.ts.map +0 -1
- package/dist/lib/graphql/index.js +0 -97
- package/dist/lib/graphql/index.js.map +0 -1
- package/dist/lib/graphql/resolvers.d.ts +0 -4
- package/dist/lib/graphql/resolvers.d.ts.map +0 -1
- package/dist/lib/graphql/resolvers.js +0 -718
- package/dist/lib/graphql/resolvers.js.map +0 -1
- package/dist/lib/graphql/schema.d.ts +0 -3
- package/dist/lib/graphql/schema.d.ts.map +0 -1
- package/dist/lib/graphql/schema.js +0 -407
- package/dist/lib/graphql/schema.js.map +0 -1
- package/dist/lib/hooks.d.ts +0 -49
- package/dist/lib/hooks.d.ts.map +0 -1
- package/dist/lib/hooks.js +0 -246
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/index.d.ts +0 -15
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -58
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/is-mobile.svelte.d.ts +0 -5
- package/dist/lib/is-mobile.svelte.d.ts.map +0 -1
- package/dist/lib/is-mobile.svelte.js +0 -8
- package/dist/lib/is-mobile.svelte.js.map +0 -1
- package/dist/lib/jobs/document-jobs.d.ts +0 -27
- package/dist/lib/jobs/document-jobs.d.ts.map +0 -1
- package/dist/lib/jobs/document-jobs.js +0 -43
- package/dist/lib/jobs/document-jobs.js.map +0 -1
- package/dist/lib/jobs/embedded-runner.d.ts +0 -25
- package/dist/lib/jobs/embedded-runner.d.ts.map +0 -1
- package/dist/lib/jobs/embedded-runner.js +0 -47
- package/dist/lib/jobs/embedded-runner.js.map +0 -1
- package/dist/lib/jobs/index.d.ts +0 -7
- package/dist/lib/jobs/index.d.ts.map +0 -1
- package/dist/lib/jobs/index.js +0 -9
- package/dist/lib/jobs/index.js.map +0 -1
- package/dist/lib/jobs/relay.d.ts +0 -27
- package/dist/lib/jobs/relay.d.ts.map +0 -1
- package/dist/lib/jobs/relay.js +0 -61
- package/dist/lib/jobs/relay.js.map +0 -1
- package/dist/lib/jobs/run-batch.d.ts +0 -58
- package/dist/lib/jobs/run-batch.d.ts.map +0 -1
- package/dist/lib/jobs/run-batch.js +0 -64
- package/dist/lib/jobs/run-batch.js.map +0 -1
- package/dist/lib/jobs/run-due-jobs.d.ts +0 -30
- package/dist/lib/jobs/run-due-jobs.d.ts.map +0 -1
- package/dist/lib/jobs/run-due-jobs.js +0 -70
- package/dist/lib/jobs/run-due-jobs.js.map +0 -1
- package/dist/lib/jobs/types.d.ts +0 -18
- package/dist/lib/jobs/types.d.ts.map +0 -1
- package/dist/lib/jobs/types.js +0 -2
- package/dist/lib/jobs/types.js.map +0 -1
- package/dist/lib/local-api/auth-helpers.d.ts +0 -65
- package/dist/lib/local-api/auth-helpers.d.ts.map +0 -1
- package/dist/lib/local-api/auth-helpers.js +0 -103
- package/dist/lib/local-api/auth-helpers.js.map +0 -1
- package/dist/lib/local-api/collection-api.d.ts +0 -293
- package/dist/lib/local-api/collection-api.d.ts.map +0 -1
- package/dist/lib/local-api/collection-api.js +0 -860
- package/dist/lib/local-api/collection-api.js.map +0 -1
- package/dist/lib/local-api/hooks.d.ts +0 -7
- package/dist/lib/local-api/hooks.d.ts.map +0 -1
- package/dist/lib/local-api/hooks.js +0 -20
- package/dist/lib/local-api/hooks.js.map +0 -1
- package/dist/lib/local-api/index.d.ts +0 -156
- package/dist/lib/local-api/index.d.ts.map +0 -1
- package/dist/lib/local-api/index.js +0 -276
- package/dist/lib/local-api/index.js.map +0 -1
- package/dist/lib/local-api/permissions.d.ts +0 -45
- package/dist/lib/local-api/permissions.d.ts.map +0 -1
- package/dist/lib/local-api/permissions.js +0 -159
- package/dist/lib/local-api/permissions.js.map +0 -1
- package/dist/lib/local-api/types.d.ts +0 -73
- package/dist/lib/local-api/types.d.ts.map +0 -1
- package/dist/lib/local-api/types.js +0 -5
- package/dist/lib/local-api/types.js.map +0 -1
- package/dist/lib/mcp/tools.d.ts +0 -63
- package/dist/lib/mcp/tools.d.ts.map +0 -1
- package/dist/lib/mcp/tools.js +0 -757
- package/dist/lib/mcp/tools.js.map +0 -1
- package/dist/lib/permissions-context.svelte.d.ts +0 -47
- package/dist/lib/permissions-context.svelte.d.ts.map +0 -1
- package/dist/lib/permissions-context.svelte.js +0 -80
- package/dist/lib/permissions-context.svelte.js.map +0 -1
- package/dist/lib/plugins/index.d.ts +0 -3
- package/dist/lib/plugins/index.d.ts.map +0 -1
- package/dist/lib/plugins/index.js +0 -3
- package/dist/lib/plugins/index.js.map +0 -1
- package/dist/lib/plugins/resolver.d.ts +0 -67
- package/dist/lib/plugins/resolver.d.ts.map +0 -1
- package/dist/lib/plugins/resolver.js +0 -88
- package/dist/lib/plugins/resolver.js.map +0 -1
- package/dist/lib/plugins/types.d.ts +0 -299
- package/dist/lib/plugins/types.d.ts.map +0 -1
- package/dist/lib/plugins/types.js +0 -9
- package/dist/lib/plugins/types.js.map +0 -1
- package/dist/lib/preview/assets.d.ts +0 -19
- package/dist/lib/preview/assets.d.ts.map +0 -1
- package/dist/lib/preview/assets.js +0 -60
- package/dist/lib/preview/assets.js.map +0 -1
- package/dist/lib/preview/perspective.d.ts +0 -20
- package/dist/lib/preview/perspective.d.ts.map +0 -1
- package/dist/lib/preview/perspective.js +0 -21
- package/dist/lib/preview/perspective.js.map +0 -1
- package/dist/lib/preview/stega.d.ts +0 -25
- package/dist/lib/preview/stega.d.ts.map +0 -1
- package/dist/lib/preview/stega.js +0 -191
- package/dist/lib/preview/stega.js.map +0 -1
- package/dist/lib/richtext-context.svelte.d.ts +0 -18
- package/dist/lib/richtext-context.svelte.d.ts.map +0 -1
- package/dist/lib/richtext-context.svelte.js +0 -13
- package/dist/lib/richtext-context.svelte.js.map +0 -1
- package/dist/lib/routes/assets-cdn.d.ts +0 -3
- package/dist/lib/routes/assets-cdn.d.ts.map +0 -1
- package/dist/lib/routes/assets-cdn.js +0 -143
- package/dist/lib/routes/assets-cdn.js.map +0 -1
- package/dist/lib/routes/mcp.d.ts +0 -5
- package/dist/lib/routes/mcp.d.ts.map +0 -1
- package/dist/lib/routes/mcp.js +0 -72
- package/dist/lib/routes/mcp.js.map +0 -1
- package/dist/lib/save-state-context.svelte.d.ts +0 -8
- package/dist/lib/save-state-context.svelte.d.ts.map +0 -1
- package/dist/lib/save-state-context.svelte.js +0 -9
- package/dist/lib/save-state-context.svelte.js.map +0 -1
- package/dist/lib/schema/index.d.ts +0 -6
- package/dist/lib/schema/index.d.ts.map +0 -1
- package/dist/lib/schema/index.js +0 -12
- package/dist/lib/schema/index.js.map +0 -1
- package/dist/lib/schema-context.svelte.d.ts +0 -10
- package/dist/lib/schema-context.svelte.d.ts.map +0 -1
- package/dist/lib/schema-context.svelte.js +0 -19
- package/dist/lib/schema-context.svelte.js.map +0 -1
- package/dist/lib/schema-utils/cleanup.d.ts +0 -21
- package/dist/lib/schema-utils/cleanup.d.ts.map +0 -1
- package/dist/lib/schema-utils/cleanup.js +0 -81
- package/dist/lib/schema-utils/cleanup.js.map +0 -1
- package/dist/lib/schema-utils/define-type.d.ts +0 -32
- package/dist/lib/schema-utils/define-type.d.ts.map +0 -1
- package/dist/lib/schema-utils/define-type.js +0 -41
- package/dist/lib/schema-utils/define-type.js.map +0 -1
- package/dist/lib/schema-utils/desugar.d.ts +0 -27
- package/dist/lib/schema-utils/desugar.d.ts.map +0 -1
- package/dist/lib/schema-utils/desugar.js +0 -102
- package/dist/lib/schema-utils/desugar.js.map +0 -1
- package/dist/lib/schema-utils/index.d.ts +0 -8
- package/dist/lib/schema-utils/index.d.ts.map +0 -1
- package/dist/lib/schema-utils/index.js +0 -9
- package/dist/lib/schema-utils/index.js.map +0 -1
- package/dist/lib/schema-utils/settings.d.ts +0 -17
- package/dist/lib/schema-utils/settings.d.ts.map +0 -1
- package/dist/lib/schema-utils/settings.js +0 -23
- package/dist/lib/schema-utils/settings.js.map +0 -1
- package/dist/lib/schema-utils/singleton.d.ts +0 -12
- package/dist/lib/schema-utils/singleton.d.ts.map +0 -1
- package/dist/lib/schema-utils/singleton.js +0 -40
- package/dist/lib/schema-utils/singleton.js.map +0 -1
- package/dist/lib/schema-utils/utils.d.ts +0 -64
- package/dist/lib/schema-utils/utils.d.ts.map +0 -1
- package/dist/lib/schema-utils/utils.js +0 -127
- package/dist/lib/schema-utils/utils.js.map +0 -1
- package/dist/lib/schema-utils/validator.d.ts +0 -16
- package/dist/lib/schema-utils/validator.d.ts.map +0 -1
- package/dist/lib/schema-utils/validator.js +0 -219
- package/dist/lib/schema-utils/validator.js.map +0 -1
- package/dist/lib/security/secret-crypto.d.ts +0 -18
- package/dist/lib/security/secret-crypto.d.ts.map +0 -1
- package/dist/lib/security/secret-crypto.js +0 -71
- package/dist/lib/security/secret-crypto.js.map +0 -1
- package/dist/lib/server/api/index.d.ts +0 -55
- package/dist/lib/server/api/index.d.ts.map +0 -1
- package/dist/lib/server/api/index.js +0 -146
- package/dist/lib/server/api/index.js.map +0 -1
- package/dist/lib/server/api/rate-limit.d.ts +0 -38
- package/dist/lib/server/api/rate-limit.d.ts.map +0 -1
- package/dist/lib/server/api/rate-limit.js +0 -71
- package/dist/lib/server/api/rate-limit.js.map +0 -1
- package/dist/lib/server/api/routes/agent-change-sets.d.ts +0 -4
- package/dist/lib/server/api/routes/agent-change-sets.d.ts.map +0 -1
- package/dist/lib/server/api/routes/agent-change-sets.js +0 -132
- package/dist/lib/server/api/routes/agent-change-sets.js.map +0 -1
- package/dist/lib/server/api/routes/agent-chat.d.ts +0 -14
- package/dist/lib/server/api/routes/agent-chat.d.ts.map +0 -1
- package/dist/lib/server/api/routes/agent-chat.js +0 -224
- package/dist/lib/server/api/routes/agent-chat.js.map +0 -1
- package/dist/lib/server/api/routes/assets-bulk.d.ts +0 -4
- package/dist/lib/server/api/routes/assets-bulk.d.ts.map +0 -1
- package/dist/lib/server/api/routes/assets-bulk.js +0 -59
- package/dist/lib/server/api/routes/assets-bulk.js.map +0 -1
- package/dist/lib/server/api/routes/assets-by-id.d.ts +0 -4
- package/dist/lib/server/api/routes/assets-by-id.d.ts.map +0 -1
- package/dist/lib/server/api/routes/assets-by-id.js +0 -123
- package/dist/lib/server/api/routes/assets-by-id.js.map +0 -1
- package/dist/lib/server/api/routes/assets-references.d.ts +0 -15
- package/dist/lib/server/api/routes/assets-references.d.ts.map +0 -1
- package/dist/lib/server/api/routes/assets-references.js +0 -80
- package/dist/lib/server/api/routes/assets-references.js.map +0 -1
- package/dist/lib/server/api/routes/assets.d.ts +0 -4
- package/dist/lib/server/api/routes/assets.d.ts.map +0 -1
- package/dist/lib/server/api/routes/assets.js +0 -139
- package/dist/lib/server/api/routes/assets.js.map +0 -1
- package/dist/lib/server/api/routes/document-versions.d.ts +0 -4
- package/dist/lib/server/api/routes/document-versions.d.ts.map +0 -1
- package/dist/lib/server/api/routes/document-versions.js +0 -135
- package/dist/lib/server/api/routes/document-versions.js.map +0 -1
- package/dist/lib/server/api/routes/documents-by-id.d.ts +0 -4
- package/dist/lib/server/api/routes/documents-by-id.d.ts.map +0 -1
- package/dist/lib/server/api/routes/documents-by-id.js +0 -194
- package/dist/lib/server/api/routes/documents-by-id.js.map +0 -1
- package/dist/lib/server/api/routes/documents-publish.d.ts +0 -4
- package/dist/lib/server/api/routes/documents-publish.d.ts.map +0 -1
- package/dist/lib/server/api/routes/documents-publish.js +0 -274
- package/dist/lib/server/api/routes/documents-publish.js.map +0 -1
- package/dist/lib/server/api/routes/documents-query.d.ts +0 -8
- package/dist/lib/server/api/routes/documents-query.d.ts.map +0 -1
- package/dist/lib/server/api/routes/documents-query.js +0 -74
- package/dist/lib/server/api/routes/documents-query.js.map +0 -1
- package/dist/lib/server/api/routes/documents.d.ts +0 -4
- package/dist/lib/server/api/routes/documents.d.ts.map +0 -1
- package/dist/lib/server/api/routes/documents.js +0 -172
- package/dist/lib/server/api/routes/documents.js.map +0 -1
- package/dist/lib/server/api/routes/jobs.d.ts +0 -4
- package/dist/lib/server/api/routes/jobs.d.ts.map +0 -1
- package/dist/lib/server/api/routes/jobs.js +0 -249
- package/dist/lib/server/api/routes/jobs.js.map +0 -1
- package/dist/lib/server/api/routes/organizations-by-id.d.ts +0 -4
- package/dist/lib/server/api/routes/organizations-by-id.d.ts.map +0 -1
- package/dist/lib/server/api/routes/organizations-by-id.js +0 -230
- package/dist/lib/server/api/routes/organizations-by-id.js.map +0 -1
- package/dist/lib/server/api/routes/organizations-invitations.d.ts +0 -10
- package/dist/lib/server/api/routes/organizations-invitations.d.ts.map +0 -1
- package/dist/lib/server/api/routes/organizations-invitations.js +0 -174
- package/dist/lib/server/api/routes/organizations-invitations.js.map +0 -1
- package/dist/lib/server/api/routes/organizations-members.d.ts +0 -4
- package/dist/lib/server/api/routes/organizations-members.d.ts.map +0 -1
- package/dist/lib/server/api/routes/organizations-members.js +0 -192
- package/dist/lib/server/api/routes/organizations-members.js.map +0 -1
- package/dist/lib/server/api/routes/organizations-switch.d.ts +0 -4
- package/dist/lib/server/api/routes/organizations-switch.d.ts.map +0 -1
- package/dist/lib/server/api/routes/organizations-switch.js +0 -54
- package/dist/lib/server/api/routes/organizations-switch.js.map +0 -1
- package/dist/lib/server/api/routes/organizations.d.ts +0 -4
- package/dist/lib/server/api/routes/organizations.d.ts.map +0 -1
- package/dist/lib/server/api/routes/organizations.js +0 -102
- package/dist/lib/server/api/routes/organizations.js.map +0 -1
- package/dist/lib/server/api/routes/plugin-settings.d.ts +0 -4
- package/dist/lib/server/api/routes/plugin-settings.d.ts.map +0 -1
- package/dist/lib/server/api/routes/plugin-settings.js +0 -109
- package/dist/lib/server/api/routes/plugin-settings.js.map +0 -1
- package/dist/lib/server/api/routes/resolve-created-by.d.ts +0 -13
- package/dist/lib/server/api/routes/resolve-created-by.d.ts.map +0 -1
- package/dist/lib/server/api/routes/resolve-created-by.js +0 -31
- package/dist/lib/server/api/routes/resolve-created-by.js.map +0 -1
- package/dist/lib/server/api/routes/resolve-organization-names.d.ts +0 -17
- package/dist/lib/server/api/routes/resolve-organization-names.d.ts.map +0 -1
- package/dist/lib/server/api/routes/resolve-organization-names.js +0 -26
- package/dist/lib/server/api/routes/resolve-organization-names.js.map +0 -1
- package/dist/lib/server/api/routes/roles.d.ts +0 -12
- package/dist/lib/server/api/routes/roles.d.ts.map +0 -1
- package/dist/lib/server/api/routes/roles.js +0 -256
- package/dist/lib/server/api/routes/roles.js.map +0 -1
- package/dist/lib/server/api/routes/schemas.d.ts +0 -4
- package/dist/lib/server/api/routes/schemas.d.ts.map +0 -1
- package/dist/lib/server/api/routes/schemas.js +0 -27
- package/dist/lib/server/api/routes/schemas.js.map +0 -1
- package/dist/lib/server/api/routes/user-preferences.d.ts +0 -4
- package/dist/lib/server/api/routes/user-preferences.d.ts.map +0 -1
- package/dist/lib/server/api/routes/user-preferences.js +0 -63
- package/dist/lib/server/api/routes/user-preferences.js.map +0 -1
- package/dist/lib/server/api/routes/user.d.ts +0 -4
- package/dist/lib/server/api/routes/user.d.ts.map +0 -1
- package/dist/lib/server/api/routes/user.js +0 -269
- package/dist/lib/server/api/routes/user.js.map +0 -1
- package/dist/lib/server/api/routes/workers-run.d.ts +0 -4
- package/dist/lib/server/api/routes/workers-run.d.ts.map +0 -1
- package/dist/lib/server/api/routes/workers-run.js +0 -41
- package/dist/lib/server/api/routes/workers-run.js.map +0 -1
- package/dist/lib/server/index.d.ts +0 -32
- package/dist/lib/server/index.d.ts.map +0 -1
- package/dist/lib/server/index.js +0 -59
- package/dist/lib/server/index.js.map +0 -1
- package/dist/lib/services/asset-service.d.ts +0 -99
- package/dist/lib/services/asset-service.d.ts.map +0 -1
- package/dist/lib/services/asset-service.js +0 -223
- package/dist/lib/services/asset-service.js.map +0 -1
- package/dist/lib/services/hierarchy-service.d.ts +0 -26
- package/dist/lib/services/hierarchy-service.d.ts.map +0 -1
- package/dist/lib/services/hierarchy-service.js +0 -64
- package/dist/lib/services/hierarchy-service.js.map +0 -1
- package/dist/lib/services/index.d.ts +0 -8
- package/dist/lib/services/index.d.ts.map +0 -1
- package/dist/lib/services/index.js +0 -9
- package/dist/lib/services/index.js.map +0 -1
- package/dist/lib/services/plugin-settings-service.d.ts +0 -76
- package/dist/lib/services/plugin-settings-service.d.ts.map +0 -1
- package/dist/lib/services/plugin-settings-service.js +0 -236
- package/dist/lib/services/plugin-settings-service.js.map +0 -1
- package/dist/lib/services/references-service.d.ts +0 -35
- package/dist/lib/services/references-service.d.ts.map +0 -1
- package/dist/lib/services/references-service.js +0 -60
- package/dist/lib/services/references-service.js.map +0 -1
- package/dist/lib/services/roles-service.d.ts +0 -35
- package/dist/lib/services/roles-service.d.ts.map +0 -1
- package/dist/lib/services/roles-service.js +0 -91
- package/dist/lib/services/roles-service.js.map +0 -1
- package/dist/lib/services/version-service.d.ts +0 -55
- package/dist/lib/services/version-service.d.ts.map +0 -1
- package/dist/lib/services/version-service.js +0 -157
- package/dist/lib/services/version-service.js.map +0 -1
- package/dist/lib/storage/adapters/index.d.ts +0 -2
- package/dist/lib/storage/adapters/index.d.ts.map +0 -1
- package/dist/lib/storage/adapters/index.js +0 -3
- package/dist/lib/storage/adapters/index.js.map +0 -1
- package/dist/lib/storage/adapters/local-storage-adapter.d.ts +0 -58
- package/dist/lib/storage/adapters/local-storage-adapter.d.ts.map +0 -1
- package/dist/lib/storage/adapters/local-storage-adapter.js +0 -197
- package/dist/lib/storage/adapters/local-storage-adapter.js.map +0 -1
- package/dist/lib/storage/index.d.ts +0 -3
- package/dist/lib/storage/index.d.ts.map +0 -1
- package/dist/lib/storage/index.js +0 -7
- package/dist/lib/storage/index.js.map +0 -1
- package/dist/lib/storage/interfaces/index.d.ts +0 -2
- package/dist/lib/storage/interfaces/index.d.ts.map +0 -1
- package/dist/lib/storage/interfaces/index.js +0 -3
- package/dist/lib/storage/interfaces/index.js.map +0 -1
- package/dist/lib/storage/interfaces/storage.d.ts +0 -90
- package/dist/lib/storage/interfaces/storage.d.ts.map +0 -1
- package/dist/lib/storage/interfaces/storage.js +0 -2
- package/dist/lib/storage/interfaces/storage.js.map +0 -1
- package/dist/lib/storage/providers/storage.d.ts +0 -43
- package/dist/lib/storage/providers/storage.d.ts.map +0 -1
- package/dist/lib/storage/providers/storage.js +0 -65
- package/dist/lib/storage/providers/storage.js.map +0 -1
- package/dist/lib/theme/css.d.ts +0 -30
- package/dist/lib/theme/css.d.ts.map +0 -1
- package/dist/lib/theme/css.js +0 -54
- package/dist/lib/theme/css.js.map +0 -1
- package/dist/lib/theme/derive.d.ts +0 -27
- package/dist/lib/theme/derive.d.ts.map +0 -1
- package/dist/lib/theme/derive.js +0 -108
- package/dist/lib/theme/derive.js.map +0 -1
- package/dist/lib/theme/index.d.ts +0 -5
- package/dist/lib/theme/index.d.ts.map +0 -1
- package/dist/lib/theme/index.js +0 -5
- package/dist/lib/theme/index.js.map +0 -1
- package/dist/lib/theme/schemes.d.ts +0 -60
- package/dist/lib/theme/schemes.d.ts.map +0 -1
- package/dist/lib/theme/schemes.js +0 -150
- package/dist/lib/theme/schemes.js.map +0 -1
- package/dist/lib/theme/tokens.d.ts +0 -57
- package/dist/lib/theme/tokens.d.ts.map +0 -1
- package/dist/lib/theme/tokens.js +0 -11
- package/dist/lib/theme/tokens.js.map +0 -1
- package/dist/lib/type-gen.d.ts +0 -19
- package/dist/lib/type-gen.d.ts.map +0 -1
- package/dist/lib/type-gen.js +0 -683
- package/dist/lib/type-gen.js.map +0 -1
- package/dist/lib/types/agent-change-sets.d.ts +0 -70
- package/dist/lib/types/agent-change-sets.d.ts.map +0 -1
- package/dist/lib/types/agent-change-sets.js +0 -7
- package/dist/lib/types/agent-change-sets.js.map +0 -1
- package/dist/lib/types/agent-stream.d.ts +0 -60
- package/dist/lib/types/agent-stream.d.ts.map +0 -1
- package/dist/lib/types/agent-stream.js +0 -12
- package/dist/lib/types/agent-stream.js.map +0 -1
- package/dist/lib/types/agent-tools.d.ts +0 -65
- package/dist/lib/types/agent-tools.d.ts.map +0 -1
- package/dist/lib/types/agent-tools.js +0 -2
- package/dist/lib/types/agent-tools.js.map +0 -1
- package/dist/lib/types/asset.d.ts +0 -97
- package/dist/lib/types/asset.d.ts.map +0 -1
- package/dist/lib/types/asset.js +0 -3
- package/dist/lib/types/asset.js.map +0 -1
- package/dist/lib/types/auth.d.ts +0 -96
- package/dist/lib/types/auth.d.ts.map +0 -1
- package/dist/lib/types/auth.js +0 -48
- package/dist/lib/types/auth.js.map +0 -1
- package/dist/lib/types/capabilities.d.ts +0 -160
- package/dist/lib/types/capabilities.d.ts.map +0 -1
- package/dist/lib/types/capabilities.js +0 -381
- package/dist/lib/types/capabilities.js.map +0 -1
- package/dist/lib/types/config.d.ts +0 -203
- package/dist/lib/types/config.d.ts.map +0 -1
- package/dist/lib/types/config.js +0 -2
- package/dist/lib/types/config.js.map +0 -1
- package/dist/lib/types/document-workspace.d.ts +0 -53
- package/dist/lib/types/document-workspace.d.ts.map +0 -1
- package/dist/lib/types/document-workspace.js +0 -15
- package/dist/lib/types/document-workspace.js.map +0 -1
- package/dist/lib/types/document.d.ts +0 -40
- package/dist/lib/types/document.d.ts.map +0 -1
- package/dist/lib/types/document.js +0 -2
- package/dist/lib/types/document.js.map +0 -1
- package/dist/lib/types/events.d.ts +0 -157
- package/dist/lib/types/events.d.ts.map +0 -1
- package/dist/lib/types/events.js +0 -4
- package/dist/lib/types/events.js.map +0 -1
- package/dist/lib/types/filters.d.ts +0 -217
- package/dist/lib/types/filters.d.ts.map +0 -1
- package/dist/lib/types/filters.js +0 -6
- package/dist/lib/types/filters.js.map +0 -1
- package/dist/lib/types/index.d.ts +0 -16
- package/dist/lib/types/index.d.ts.map +0 -1
- package/dist/lib/types/index.js +0 -16
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/instance.d.ts +0 -5
- package/dist/lib/types/instance.d.ts.map +0 -1
- package/dist/lib/types/instance.js +0 -3
- package/dist/lib/types/instance.js.map +0 -1
- package/dist/lib/types/organization.d.ts +0 -117
- package/dist/lib/types/organization.d.ts.map +0 -1
- package/dist/lib/types/organization.js +0 -4
- package/dist/lib/types/organization.js.map +0 -1
- package/dist/lib/types/schemas.d.ts +0 -508
- package/dist/lib/types/schemas.d.ts.map +0 -1
- package/dist/lib/types/schemas.js +0 -4
- package/dist/lib/types/schemas.js.map +0 -1
- package/dist/lib/types/sidebar.d.ts +0 -36
- package/dist/lib/types/sidebar.d.ts.map +0 -1
- package/dist/lib/types/sidebar.js +0 -2
- package/dist/lib/types/sidebar.js.map +0 -1
- package/dist/lib/types/user.d.ts +0 -14
- package/dist/lib/types/user.d.ts.map +0 -1
- package/dist/lib/types/user.js +0 -2
- package/dist/lib/types/user.js.map +0 -1
- package/dist/lib/types/version.d.ts +0 -15
- package/dist/lib/types/version.d.ts.map +0 -1
- package/dist/lib/types/version.js +0 -2
- package/dist/lib/types/version.js.map +0 -1
- package/dist/lib/utils/asset-actions.d.ts +0 -9
- package/dist/lib/utils/asset-actions.d.ts.map +0 -1
- package/dist/lib/utils/asset-actions.js +0 -28
- package/dist/lib/utils/asset-actions.js.map +0 -1
- package/dist/lib/utils/content-hash.d.ts +0 -22
- package/dist/lib/utils/content-hash.d.ts.map +0 -1
- package/dist/lib/utils/content-hash.js +0 -68
- package/dist/lib/utils/content-hash.js.map +0 -1
- package/dist/lib/utils/default-orderings.d.ts +0 -10
- package/dist/lib/utils/default-orderings.d.ts.map +0 -1
- package/dist/lib/utils/default-orderings.js +0 -64
- package/dist/lib/utils/default-orderings.js.map +0 -1
- package/dist/lib/utils/element-events.d.ts +0 -15
- package/dist/lib/utils/element-events.d.ts.map +0 -1
- package/dist/lib/utils/element-events.js +0 -17
- package/dist/lib/utils/element-events.js.map +0 -1
- package/dist/lib/utils/fetch-remote-file.d.ts +0 -11
- package/dist/lib/utils/fetch-remote-file.d.ts.map +0 -1
- package/dist/lib/utils/fetch-remote-file.js +0 -198
- package/dist/lib/utils/fetch-remote-file.js.map +0 -1
- package/dist/lib/utils/field-defaults.d.ts +0 -8
- package/dist/lib/utils/field-defaults.d.ts.map +0 -1
- package/dist/lib/utils/field-defaults.js +0 -21
- package/dist/lib/utils/field-defaults.js.map +0 -1
- package/dist/lib/utils/image-url.d.ts +0 -88
- package/dist/lib/utils/image-url.d.ts.map +0 -1
- package/dist/lib/utils/image-url.js +0 -167
- package/dist/lib/utils/image-url.js.map +0 -1
- package/dist/lib/utils/index.d.ts +0 -9
- package/dist/lib/utils/index.d.ts.map +0 -1
- package/dist/lib/utils/index.js +0 -14
- package/dist/lib/utils/index.js.map +0 -1
- package/dist/lib/utils/initial-value-helpers.d.ts +0 -50
- package/dist/lib/utils/initial-value-helpers.d.ts.map +0 -1
- package/dist/lib/utils/initial-value-helpers.js +0 -71
- package/dist/lib/utils/initial-value-helpers.js.map +0 -1
- package/dist/lib/utils/logger.d.ts +0 -11
- package/dist/lib/utils/logger.d.ts.map +0 -1
- package/dist/lib/utils/logger.js +0 -39
- package/dist/lib/utils/logger.js.map +0 -1
- package/dist/lib/utils/mime-detect.d.ts +0 -22
- package/dist/lib/utils/mime-detect.d.ts.map +0 -1
- package/dist/lib/utils/mime-detect.js +0 -238
- package/dist/lib/utils/mime-detect.js.map +0 -1
- package/dist/lib/utils/pluralize.d.ts +0 -6
- package/dist/lib/utils/pluralize.d.ts.map +0 -1
- package/dist/lib/utils/pluralize.js +0 -16
- package/dist/lib/utils/pluralize.js.map +0 -1
- package/dist/lib/utils/preview.d.ts +0 -34
- package/dist/lib/utils/preview.d.ts.map +0 -1
- package/dist/lib/utils/preview.js +0 -107
- package/dist/lib/utils/preview.js.map +0 -1
- package/dist/lib/utils/reference-walk.d.ts +0 -8
- package/dist/lib/utils/reference-walk.d.ts.map +0 -1
- package/dist/lib/utils/reference-walk.js +0 -43
- package/dist/lib/utils/reference-walk.js.map +0 -1
- package/dist/lib/utils/slug.d.ts +0 -13
- package/dist/lib/utils/slug.d.ts.map +0 -1
- package/dist/lib/utils/slug.js +0 -31
- package/dist/lib/utils/slug.js.map +0 -1
- package/dist/lib/utils/string-case.d.ts +0 -21
- package/dist/lib/utils/string-case.d.ts.map +0 -1
- package/dist/lib/utils/string-case.js +0 -26
- package/dist/lib/utils/string-case.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -13
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -6
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/vite/index.d.ts +0 -104
- package/dist/lib/vite/index.d.ts.map +0 -1
- package/dist/lib/vite/index.js +0 -403
- package/dist/lib/vite/index.js.map +0 -1
- package/dist/plugins/README.md +0 -150
|
@@ -16,25 +16,52 @@
|
|
|
16
16
|
Image as ImageIcon,
|
|
17
17
|
FileText,
|
|
18
18
|
FileImage,
|
|
19
|
+
Film,
|
|
20
|
+
Music,
|
|
21
|
+
FileArchive,
|
|
22
|
+
Play,
|
|
19
23
|
ChevronLeft,
|
|
20
24
|
ChevronRight,
|
|
21
25
|
Download,
|
|
22
26
|
Link,
|
|
23
27
|
CheckCircle2,
|
|
24
28
|
AlertCircle,
|
|
25
|
-
SquareCheckBig
|
|
29
|
+
SquareCheckBig,
|
|
30
|
+
Lock
|
|
26
31
|
} from '@lucide/svelte';
|
|
27
32
|
import { page } from '$app/state';
|
|
28
33
|
import { goto } from '$app/navigation';
|
|
29
34
|
import { assets } from '../../api/assets';
|
|
30
|
-
import
|
|
35
|
+
import { ApiError } from '../../api/client';
|
|
36
|
+
import { MAX_UPLOAD_BYTES, maxUploadFileBytes } from '../../api/limits';
|
|
37
|
+
import { buildVariantUrl } from '../../storage/keys';
|
|
38
|
+
import {
|
|
39
|
+
canGenerateVariants,
|
|
40
|
+
thumbnailWidth,
|
|
41
|
+
usableWidths,
|
|
42
|
+
type ImageConfig
|
|
43
|
+
} from '../../images';
|
|
44
|
+
import type {
|
|
45
|
+
AssetDeleteConflict,
|
|
46
|
+
BulkAssetDeleteConflict,
|
|
47
|
+
AssetReference
|
|
48
|
+
} from '../../api/assets';
|
|
31
49
|
import type { Asset } from '../../types/asset';
|
|
32
50
|
import { toast } from 'svelte-sonner';
|
|
33
51
|
import { copyUrlToClipboard, downloadFile } from '../../utils/asset-actions';
|
|
34
52
|
import { cmsLogger } from '../../utils/logger';
|
|
53
|
+
import { extractVideoInfo, extractVideoInfoFromUrl } from '../../utils/video-metadata';
|
|
35
54
|
import { SvelteSet } from 'svelte/reactivity';
|
|
36
55
|
import { confirmDialog } from './confirm-dialog/confirm-dialog.svelte';
|
|
37
56
|
import { usePermissions } from '../../permissions-context.svelte';
|
|
57
|
+
import AssetImage from './AssetImage.svelte';
|
|
58
|
+
import {
|
|
59
|
+
acceptedFileTypesInputValue,
|
|
60
|
+
effectiveFileType,
|
|
61
|
+
isAcceptedFileType,
|
|
62
|
+
normalizeAcceptedFileTypes,
|
|
63
|
+
type AcceptedFileTypes
|
|
64
|
+
} from '../../utils/file-accept';
|
|
38
65
|
|
|
39
66
|
interface Props {
|
|
40
67
|
/** When true, shows a "Select" button for picking an asset */
|
|
@@ -44,15 +71,52 @@
|
|
|
44
71
|
/** Callback when an asset is selected (single select mode) */
|
|
45
72
|
onSelect?: (asset: Asset) => void;
|
|
46
73
|
/** Callback when multiple assets are selected (multi select mode) */
|
|
47
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Confirmed multi-selection, as the complete set of selected asset IDs —
|
|
76
|
+
* across every page, not just the visible one. Treat it as the desired
|
|
77
|
+
* final state: anything absent was deselected.
|
|
78
|
+
*/
|
|
79
|
+
onSelectMultiple?: (assetIds: string[]) => void;
|
|
48
80
|
/** Filter to specific asset type */
|
|
49
81
|
assetTypeFilter?: 'image' | 'file';
|
|
82
|
+
/** MIME types/extensions accepted by the field that opened this picker. */
|
|
83
|
+
accept?: AcceptedFileTypes;
|
|
50
84
|
/** Number of assets per page */
|
|
51
85
|
pageSize?: number;
|
|
52
86
|
/** Whether this tab is currently active (triggers refetch when becoming active) */
|
|
53
87
|
active?: boolean;
|
|
54
88
|
/** Asset IDs already in use (shown with a tick indicator) */
|
|
55
89
|
existingAssetIds?: Set<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Asset to open on mount, addressed by id.
|
|
92
|
+
*
|
|
93
|
+
* Looked up on its own rather than searched for in the current page: a
|
|
94
|
+
* deep-linked asset is usually *not* on page 1 — that's why someone
|
|
95
|
+
* linked to it — so filtering the loaded list would silently do nothing
|
|
96
|
+
* for exactly the assets this exists to reach.
|
|
97
|
+
*/
|
|
98
|
+
assetId?: string | null;
|
|
99
|
+
/**
|
|
100
|
+
* Fires when the open asset changes (null when the panel closes), so the
|
|
101
|
+
* host can reflect it in the URL. The component holds no opinion about
|
|
102
|
+
* routing; it only reports.
|
|
103
|
+
*/
|
|
104
|
+
onAssetOpen?: (assetId: string | null) => void;
|
|
105
|
+
/**
|
|
106
|
+
* The field this browser was opened from, when it was opened as a picker.
|
|
107
|
+
*
|
|
108
|
+
* Recorded on anything uploaded here, because it is what the media route
|
|
109
|
+
* later reads to decide whether the asset is private: privacy is declared
|
|
110
|
+
* on the field (`private: true`), and resolved from the field an asset was
|
|
111
|
+
* uploaded into. Without it, everything uploaded through the library is
|
|
112
|
+
* public regardless of where it is used — which was the case for every
|
|
113
|
+
* library upload until now.
|
|
114
|
+
*
|
|
115
|
+
* Absent when the library is opened as a destination in its own right (the
|
|
116
|
+
* Media tab), where there is no field to inherit from.
|
|
117
|
+
*/
|
|
118
|
+
schemaType?: string;
|
|
119
|
+
fieldPath?: string;
|
|
56
120
|
}
|
|
57
121
|
|
|
58
122
|
let {
|
|
@@ -61,22 +125,137 @@
|
|
|
61
125
|
onSelect,
|
|
62
126
|
onSelectMultiple,
|
|
63
127
|
assetTypeFilter,
|
|
128
|
+
accept,
|
|
64
129
|
pageSize = 30,
|
|
65
130
|
active = true,
|
|
66
|
-
existingAssetIds
|
|
131
|
+
existingAssetIds,
|
|
132
|
+
assetId = null,
|
|
133
|
+
onAssetOpen,
|
|
134
|
+
schemaType,
|
|
135
|
+
fieldPath
|
|
67
136
|
}: Props = $props();
|
|
137
|
+
let globalAllowedMimeTypes = $state<string[] | undefined>(undefined);
|
|
138
|
+
const effectiveAccept = $derived(accept ?? (assetTypeFilter === 'image' ? 'image/*' : undefined));
|
|
139
|
+
const acceptedFileTypes = $derived(normalizeAcceptedFileTypes(effectiveAccept));
|
|
140
|
+
const acceptInputValue = $derived(
|
|
141
|
+
acceptedFileTypesInputValue(
|
|
142
|
+
acceptedFileTypes.length > 0 ? acceptedFileTypes : globalAllowedMimeTypes
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
function acceptsUpload(file: File): boolean {
|
|
147
|
+
// Chrome and Firefox report an empty `type` for HEIC/HEIF, which matches no
|
|
148
|
+
// `image/*` rule — so an iPhone photo would be turned away here even though
|
|
149
|
+
// the server reads the brand off the bytes and accepts it happily.
|
|
150
|
+
const mimeType = effectiveFileType(file.name, file.type);
|
|
151
|
+
return (
|
|
152
|
+
isAcceptedFileType(file.name, mimeType, globalAllowedMimeTypes) &&
|
|
153
|
+
isAcceptedFileType(file.name, mimeType, acceptedFileTypes)
|
|
154
|
+
);
|
|
155
|
+
}
|
|
68
156
|
|
|
69
157
|
// State
|
|
70
158
|
let assetList = $state<Asset[]>([]);
|
|
71
159
|
let loading = $state(false);
|
|
72
160
|
let searchQuery = $state('');
|
|
73
|
-
|
|
74
|
-
|
|
161
|
+
/**
|
|
162
|
+
* How the library is displayed. These are per-editor habits rather than app
|
|
163
|
+
* state, so they're remembered per browser — resetting someone's view on every
|
|
164
|
+
* visit is a small daily annoyance. Storage can be unavailable or throw (a
|
|
165
|
+
* private window, blocked site data), and the defaults are correct when it is.
|
|
166
|
+
*/
|
|
167
|
+
type GridDensity = 'compact' | 'default' | 'large';
|
|
168
|
+
type ViewMode = 'grid' | 'list';
|
|
169
|
+
type SortOrder = 'newest' | 'oldest' | 'name-asc' | 'name-desc';
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Tile track minimums. The grid was laid out on a fixed `xl:grid-cols-10`,
|
|
173
|
+
* which on a wide screen produced ~90px thumbnails — a contact sheet you can
|
|
174
|
+
* count but not read. Sizing tracks by a minimum width instead lets the column
|
|
175
|
+
* count follow the space actually available (opening the inspector reflows it).
|
|
176
|
+
*/
|
|
177
|
+
const TILE_MIN_WIDTH: Record<GridDensity, number> = {
|
|
178
|
+
compact: 110,
|
|
179
|
+
default: 165,
|
|
180
|
+
large: 240
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const STORAGE_KEYS = {
|
|
184
|
+
density: 'aphex:media:density',
|
|
185
|
+
view: 'aphex:media:view',
|
|
186
|
+
sort: 'aphex:media:sort'
|
|
187
|
+
} as const;
|
|
188
|
+
|
|
189
|
+
function readStored<T extends string>(key: string, allowed: readonly T[], fallback: T): T {
|
|
190
|
+
if (typeof localStorage === 'undefined') return fallback;
|
|
191
|
+
try {
|
|
192
|
+
const stored = localStorage.getItem(key) as T | null;
|
|
193
|
+
return stored !== null && allowed.includes(stored) ? stored : fallback;
|
|
194
|
+
} catch {
|
|
195
|
+
return fallback;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function writeStored(key: string, value: string) {
|
|
200
|
+
try {
|
|
201
|
+
localStorage.setItem(key, value);
|
|
202
|
+
} catch {
|
|
203
|
+
/* not persisted */
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Media-kind filter, applied in SQL. Not persisted: unlike a view preference,
|
|
209
|
+
* a filter changes *which* assets exist as far as the editor can tell, and
|
|
210
|
+
* silently restoring one from a previous session reads as missing data.
|
|
211
|
+
*/
|
|
212
|
+
type CategoryFilter = 'all' | 'image' | 'svg' | 'video' | 'audio' | 'document';
|
|
213
|
+
let categoryFilter = $state<CategoryFilter>('all');
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Used / unused, answered by the asset-reference index. Not persisted, for the
|
|
217
|
+
* same reason as the kind filter: a restored filter reads as missing data.
|
|
218
|
+
*/
|
|
219
|
+
type UsageFilter = 'all' | 'in-use' | 'unused';
|
|
220
|
+
let usageFilter = $state<UsageFilter>('all');
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The server is still building the reference index for this org, so usage
|
|
224
|
+
* answers aren't trustworthy yet. Worth saying out loud: an unbuilt index makes
|
|
225
|
+
* every asset look unused, and "unused" is the answer that invites deletion.
|
|
226
|
+
*/
|
|
227
|
+
let usageIndexing = $state(false);
|
|
228
|
+
|
|
229
|
+
let viewMode = $state<ViewMode>(readStored(STORAGE_KEYS.view, ['grid', 'list'], 'grid'));
|
|
230
|
+
let sortOrder = $state<SortOrder>(
|
|
231
|
+
readStored(STORAGE_KEYS.sort, ['newest', 'oldest', 'name-asc', 'name-desc'], 'newest')
|
|
232
|
+
);
|
|
233
|
+
let gridDensity = $state<GridDensity>(
|
|
234
|
+
readStored(STORAGE_KEYS.density, ['compact', 'default', 'large'], 'default')
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
$effect(() => writeStored(STORAGE_KEYS.view, viewMode));
|
|
238
|
+
$effect(() => writeStored(STORAGE_KEYS.sort, sortOrder));
|
|
239
|
+
$effect(() => writeStored(STORAGE_KEYS.density, gridDensity));
|
|
75
240
|
|
|
76
241
|
const perms = usePermissions();
|
|
242
|
+
const canRead = $derived(perms.can('asset.read'));
|
|
77
243
|
const canUpload = $derived(perms.can('asset.upload'));
|
|
78
244
|
const canDeleteAssets = $derived(perms.can('asset.delete'));
|
|
79
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Set when the server answers a read with 403.
|
|
248
|
+
*
|
|
249
|
+
* Normally `canRead` already stops us before the request, and the sidebar
|
|
250
|
+
* hides the media area entirely — but the client's capability set is a copy
|
|
251
|
+
* resolved at load, so a role edited in another tab (or a stale session) can
|
|
252
|
+
* disagree with the server. Treat the server's answer as the truth and show
|
|
253
|
+
* the same empty state rather than a "Failed to fetch assets" error, which
|
|
254
|
+
* reads as a broken CMS instead of a permission boundary.
|
|
255
|
+
*/
|
|
256
|
+
let accessDenied = $state(false);
|
|
257
|
+
const showAccessDenied = $derived(!canRead || accessDenied);
|
|
258
|
+
|
|
80
259
|
let selectedAsset = $state<Asset | null>(null);
|
|
81
260
|
let lightboxOpen = $state(false);
|
|
82
261
|
let currentPage = $state(1);
|
|
@@ -85,24 +264,104 @@
|
|
|
85
264
|
|
|
86
265
|
// Upload state
|
|
87
266
|
let isUploading = $state(false);
|
|
88
|
-
let isDragging = $state(false);
|
|
89
267
|
let showUploadModal = $state(false);
|
|
90
268
|
let modalFileInputRef: HTMLInputElement;
|
|
91
|
-
|
|
269
|
+
// Same enter/leave counter as the browser region — see the note by
|
|
270
|
+
// `handleDragEnter`. This zone has no children to cross, but a drag that ends
|
|
271
|
+
// outside the window still strands the highlight without it.
|
|
272
|
+
let modalDragDepth = $state(0);
|
|
273
|
+
const modalIsDragging = $derived(modalDragDepth > 0);
|
|
92
274
|
|
|
93
275
|
interface UploadQueueItem {
|
|
94
276
|
file: File;
|
|
95
|
-
|
|
277
|
+
/**
|
|
278
|
+
* `rejected` and `failed` are deliberately distinct. A rejected file failed a
|
|
279
|
+
* local precondition — accepted type, size limit — that is known from the
|
|
280
|
+
* `File` alone before anything is sent, so retrying re-runs the same check
|
|
281
|
+
* and reaches the same answer. A failed one was actually attempted and lost
|
|
282
|
+
* to something transient, which retrying can fix. Only the latter is offered
|
|
283
|
+
* a Retry; the former is offered removal, and is re-evaluated by
|
|
284
|
+
* `revalidateRejected` if the server's limits land after it was queued.
|
|
285
|
+
*
|
|
286
|
+
* Rejected files are also excluded from the queued tallies: they are not
|
|
287
|
+
* part of the upload, so counting them made the dialog report a file as
|
|
288
|
+
* selected and failed at once.
|
|
289
|
+
*/
|
|
290
|
+
status: 'pending' | 'uploading' | 'done' | 'rejected' | 'failed';
|
|
291
|
+
/** Why it was rejected or failed, shown next to the file. Absent otherwise. */
|
|
292
|
+
error?: string;
|
|
293
|
+
/** 0–100 while uploading. */
|
|
294
|
+
progress?: number;
|
|
295
|
+
/**
|
|
296
|
+
* Object URL for an image preview, so a failed row can be identified by
|
|
297
|
+
* sight rather than by filename. Revoked when the queue is cleared —
|
|
298
|
+
* object URLs live until the document unloads otherwise.
|
|
299
|
+
*/
|
|
300
|
+
previewUrl?: string;
|
|
96
301
|
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* How many files upload at once.
|
|
305
|
+
*
|
|
306
|
+
* Sequential uploads make a 20-image drop feel broken — each waits for the
|
|
307
|
+
* whole of the previous one. Unbounded parallelism is worse: browsers cap
|
|
308
|
+
* connections per host anyway, so the extra requests queue invisibly while
|
|
309
|
+
* every progress bar crawls at once and the server handles a burst it
|
|
310
|
+
* didn't ask for. A small fixed width keeps throughput up and progress
|
|
311
|
+
* legible.
|
|
312
|
+
*/
|
|
313
|
+
const UPLOAD_CONCURRENCY = 3;
|
|
97
314
|
let uploadQueue = $state<UploadQueueItem[]>([]);
|
|
315
|
+
/**
|
|
316
|
+
* The server's request body limit. Seeded with the built-in default and
|
|
317
|
+
* replaced by the value the assets endpoint reports, so a configured limit is
|
|
318
|
+
* respected without the number being duplicated here.
|
|
319
|
+
*/
|
|
320
|
+
let maxUploadBytes = $state(MAX_UPLOAD_BYTES);
|
|
321
|
+
/**
|
|
322
|
+
* Whether the server offers direct-to-storage upload. Reported by the assets
|
|
323
|
+
* endpoint rather than inferred: it depends on the adapter, an encryption
|
|
324
|
+
* key, and an operator opt-in that implies bucket CORS nothing here can see.
|
|
325
|
+
*/
|
|
326
|
+
let directUpload = $state(false);
|
|
327
|
+
/**
|
|
328
|
+
* The image pipeline the server is running, or null when it's off.
|
|
329
|
+
*
|
|
330
|
+
* Needed so a grid tile can request a derivative instead of the original.
|
|
331
|
+
* Reported by the server, never derived here: the config hash decides which
|
|
332
|
+
* files exist, and a client that computed a different one would request URLs
|
|
333
|
+
* that silently fall back to the full-size original.
|
|
334
|
+
*/
|
|
335
|
+
let imageConfig = $state<(ImageConfig & { configHash: string }) | null>(null);
|
|
98
336
|
|
|
99
337
|
// Detail editing state
|
|
338
|
+
let editFilename = $state('');
|
|
100
339
|
let editTitle = $state('');
|
|
101
340
|
let editDescription = $state('');
|
|
102
341
|
let editAlt = $state('');
|
|
103
342
|
let editCreditLine = $state('');
|
|
104
343
|
let isSaving = $state(false);
|
|
105
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Whether the metadata form differs from the asset it was loaded from.
|
|
347
|
+
*
|
|
348
|
+
* Drives both the Save button's enabled state and the guard when switching
|
|
349
|
+
* assets. Compared against `selectedAsset` rather than a snapshot taken at
|
|
350
|
+
* open, so a successful save — which replaces `selectedAsset` with the
|
|
351
|
+
* server's row — settles back to clean without any extra bookkeeping.
|
|
352
|
+
*
|
|
353
|
+
* `?? ''` on both sides: the columns are nullable, the inputs are not, so a
|
|
354
|
+
* null title and an untouched empty input are the same thing.
|
|
355
|
+
*/
|
|
356
|
+
const metadataDirty = $derived(
|
|
357
|
+
!!selectedAsset &&
|
|
358
|
+
(editFilename.trim() !== (selectedAsset.originalFilename ?? '') ||
|
|
359
|
+
editTitle !== (selectedAsset.title ?? '') ||
|
|
360
|
+
editDescription !== (selectedAsset.description ?? '') ||
|
|
361
|
+
editAlt !== (selectedAsset.alt ?? '') ||
|
|
362
|
+
editCreditLine !== (selectedAsset.creditLine ?? ''))
|
|
363
|
+
);
|
|
364
|
+
|
|
106
365
|
// Bulk selection state
|
|
107
366
|
let selectMode = $state(false);
|
|
108
367
|
let selectedIds = $state<Set<string>>(
|
|
@@ -111,13 +370,65 @@
|
|
|
111
370
|
);
|
|
112
371
|
let isBulkDeleting = $state(false);
|
|
113
372
|
|
|
373
|
+
/**
|
|
374
|
+
* The asset a shift-click extends *from* — the last one whose selection the
|
|
375
|
+
* user set directly.
|
|
376
|
+
*
|
|
377
|
+
* Held as an id rather than an index because the list underneath it moves:
|
|
378
|
+
* sorting, searching and paging all reorder `orderedAssets`, and an index
|
|
379
|
+
* would then point at a different asset than the one that was clicked.
|
|
380
|
+
*/
|
|
381
|
+
let selectionAnchor = $state<string | null>(null);
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Which way the anchor click went — `true` if it selected, `false` if it
|
|
385
|
+
* deselected. A shift-click repeats it across the range.
|
|
386
|
+
*
|
|
387
|
+
* Recorded rather than read back off the anchor at shift-click time: by then
|
|
388
|
+
* the anchor may have been re-toggled by a checkbox or swept by select-all,
|
|
389
|
+
* and the range would silently invert.
|
|
390
|
+
*/
|
|
391
|
+
let anchorSelects = $state(true);
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Whether select mode was asked for, as opposed to entered by ticking a
|
|
395
|
+
* checkbox.
|
|
396
|
+
*
|
|
397
|
+
* Only used to decide whether emptying the selection should also leave the
|
|
398
|
+
* mode: an implicit entry should undo itself, so unticking the last checkbox
|
|
399
|
+
* puts the grid back to "click opens the asset". A deliberate entry stays put
|
|
400
|
+
* — the user pressed a button, and having it silently pop back off the first
|
|
401
|
+
* time they cleared a selection would be its own bug.
|
|
402
|
+
*/
|
|
403
|
+
let selectModeExplicit = $state(false);
|
|
404
|
+
|
|
114
405
|
// In selectable+multiSelect mode, always be in select mode
|
|
115
406
|
const isSelectMode = $derived(selectMode || (selectable && multiSelect));
|
|
116
407
|
|
|
117
408
|
function toggleSelectMode() {
|
|
118
409
|
selectMode = !selectMode;
|
|
410
|
+
selectModeExplicit = selectMode;
|
|
119
411
|
if (!selectMode) {
|
|
120
412
|
selectedIds = new Set();
|
|
413
|
+
selectionAnchor = null;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Keep the mode in step with the selection.
|
|
419
|
+
*
|
|
420
|
+
* The list view's checkboxes are always rendered, so a user can start
|
|
421
|
+
* selecting without ever finding the toolbar's select-mode button — and until
|
|
422
|
+
* this existed, doing so ticked boxes that produced no action bar and no way
|
|
423
|
+
* to delete anything. Selecting something *is* the request to be in select
|
|
424
|
+
* mode.
|
|
425
|
+
*/
|
|
426
|
+
function syncSelectMode() {
|
|
427
|
+
if (selectable) return; // picker mode is permanently in select mode
|
|
428
|
+
if (selectedIds.size > 0) {
|
|
429
|
+
selectMode = true;
|
|
430
|
+
} else if (!selectModeExplicit) {
|
|
431
|
+
selectMode = false;
|
|
121
432
|
}
|
|
122
433
|
}
|
|
123
434
|
|
|
@@ -140,18 +451,45 @@
|
|
|
140
451
|
}, 300);
|
|
141
452
|
}
|
|
142
453
|
|
|
454
|
+
/**
|
|
455
|
+
* Monotonic id for the most recently *issued* asset fetch.
|
|
456
|
+
*
|
|
457
|
+
* Responses are not guaranteed to arrive in the order they were requested: a
|
|
458
|
+
* search for "a" and the search for "ab" typed 200ms later are two in-flight
|
|
459
|
+
* requests, and if the first is slower its results land last and win. The same
|
|
460
|
+
* applies to paging quickly, and to a refetch racing the initial load. Every
|
|
461
|
+
* fetch stamps itself, and only the newest is allowed to write state — an
|
|
462
|
+
* older response is read and discarded.
|
|
463
|
+
*
|
|
464
|
+
* Not `$state`: it's request bookkeeping, and nothing renders from it.
|
|
465
|
+
*/
|
|
466
|
+
let fetchGeneration = 0;
|
|
467
|
+
|
|
143
468
|
// Fetch assets
|
|
144
469
|
async function fetchAssets(page = currentPage) {
|
|
470
|
+
// Don't ask for what we know we can't have — the request would only come
|
|
471
|
+
// back 403 and surface as an error toast.
|
|
472
|
+
if (!canRead) {
|
|
473
|
+
assetList = [];
|
|
474
|
+
loading = false;
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const generation = ++fetchGeneration;
|
|
145
478
|
loading = true;
|
|
146
479
|
try {
|
|
147
480
|
const offset = (page - 1) * pageSize;
|
|
148
481
|
const result = await assets.list({
|
|
149
482
|
assetType: assetTypeFilter,
|
|
483
|
+
category: categoryFilter === 'all' ? undefined : categoryFilter,
|
|
484
|
+
usage: usageFilter === 'all' ? undefined : usageFilter,
|
|
150
485
|
search: searchQuery || undefined,
|
|
486
|
+
sort: sortOrder,
|
|
151
487
|
limit: pageSize,
|
|
152
488
|
offset
|
|
153
489
|
});
|
|
154
490
|
|
|
491
|
+
if (generation !== fetchGeneration) return;
|
|
492
|
+
|
|
155
493
|
if (result.success && result.data) {
|
|
156
494
|
assetList = result.data;
|
|
157
495
|
currentPage = page;
|
|
@@ -159,18 +497,54 @@
|
|
|
159
497
|
totalPages = result.pagination.totalPages;
|
|
160
498
|
totalAssets = result.pagination.total;
|
|
161
499
|
}
|
|
500
|
+
// Adopt the server's actual limit rather than trusting the compiled-in
|
|
501
|
+
// default, which is only correct until someone configures a different
|
|
502
|
+
// one. Absent on an older server, in which case the default stands.
|
|
503
|
+
if (typeof result.limits?.maxUploadBytes === 'number') {
|
|
504
|
+
maxUploadBytes = result.limits.maxUploadBytes;
|
|
505
|
+
}
|
|
506
|
+
globalAllowedMimeTypes = result.limits?.allowedMimeTypes;
|
|
507
|
+
directUpload = result.limits?.directUpload === true;
|
|
508
|
+
// Files may already be sitting in the queue — the dialog can be opened
|
|
509
|
+
// and filled before this first page resolves — and they were judged
|
|
510
|
+
// against the compiled-in defaults.
|
|
511
|
+
revalidateRejected();
|
|
512
|
+
usageIndexing = (result as { indexing?: boolean }).indexing === true;
|
|
513
|
+
|
|
514
|
+
// Deliberately not awaited: posters are a nicety, and the grid should be
|
|
515
|
+
// on screen while they fill in behind it.
|
|
516
|
+
void backfillPosters(
|
|
517
|
+
assetList.filter(
|
|
518
|
+
(asset) =>
|
|
519
|
+
(isVideo(asset) && !getPosterUrl(asset)) || (isAudio(asset) && !formatDuration(asset))
|
|
520
|
+
)
|
|
521
|
+
);
|
|
522
|
+
imageConfig = result.images ?? null;
|
|
162
523
|
// Clear bulk selection on page change (but never in multi-select picker mode —
|
|
163
524
|
// selection is initialised once at mount and only changed by user interaction)
|
|
164
525
|
if (!(selectable && multiSelect)) {
|
|
165
526
|
selectedIds = new Set();
|
|
527
|
+
syncSelectMode();
|
|
166
528
|
}
|
|
529
|
+
// The anchor always dies with the page: it names an asset that may no
|
|
530
|
+
// longer be rendered, and extending a range from off-screen produces a
|
|
531
|
+
// selection the user cannot see the ends of.
|
|
532
|
+
selectionAnchor = null;
|
|
167
533
|
// Fetch reference counts for this page
|
|
168
534
|
fetchReferenceCounts(result.data.map((a) => a.id));
|
|
169
535
|
}
|
|
170
|
-
} catch {
|
|
171
|
-
|
|
536
|
+
} catch (error) {
|
|
537
|
+
if (generation !== fetchGeneration) return;
|
|
538
|
+
if (error instanceof ApiError && error.status === 403) {
|
|
539
|
+
accessDenied = true;
|
|
540
|
+
assetList = [];
|
|
541
|
+
} else {
|
|
542
|
+
toast.error('Failed to fetch assets');
|
|
543
|
+
}
|
|
172
544
|
} finally {
|
|
173
|
-
|
|
545
|
+
// Only the newest request owns the spinner. A superseded one clearing it
|
|
546
|
+
// would show "no assets" while its replacement is still in flight.
|
|
547
|
+
if (generation === fetchGeneration) loading = false;
|
|
174
548
|
}
|
|
175
549
|
}
|
|
176
550
|
|
|
@@ -181,14 +555,18 @@
|
|
|
181
555
|
|
|
182
556
|
// Fetch reference counts for current page of assets
|
|
183
557
|
async function fetchReferenceCounts(assetIds: string[]) {
|
|
184
|
-
if (assetIds.length === 0) return;
|
|
558
|
+
if (assetIds.length === 0 || !canRead) return;
|
|
185
559
|
try {
|
|
186
560
|
const result = await assets.getReferenceCounts(assetIds);
|
|
187
561
|
if (result.success && result.data) {
|
|
188
562
|
referenceCounts = { ...referenceCounts, ...result.data };
|
|
189
563
|
}
|
|
190
|
-
} catch {
|
|
191
|
-
|
|
564
|
+
} catch (error) {
|
|
565
|
+
// A 403 here is already reported by the asset fetch that triggered it;
|
|
566
|
+
// a second toast would just be noise.
|
|
567
|
+
if (!(error instanceof ApiError && error.status === 403)) {
|
|
568
|
+
toast.error('Failed to fetch reference counts');
|
|
569
|
+
}
|
|
192
570
|
}
|
|
193
571
|
}
|
|
194
572
|
|
|
@@ -210,7 +588,6 @@
|
|
|
210
588
|
}
|
|
211
589
|
}
|
|
212
590
|
|
|
213
|
-
// Sort assets client-side
|
|
214
591
|
function isSystemAsset(asset: Asset): boolean {
|
|
215
592
|
const metadata = asset.metadata as Record<string, unknown> | null | undefined;
|
|
216
593
|
return (
|
|
@@ -220,51 +597,64 @@
|
|
|
220
597
|
);
|
|
221
598
|
}
|
|
222
599
|
|
|
223
|
-
function sortAssets(list: Asset[]): Asset[] {
|
|
224
|
-
const sorted = [...list];
|
|
225
|
-
switch (sortOrder) {
|
|
226
|
-
case 'newest':
|
|
227
|
-
return sorted.sort(
|
|
228
|
-
(a, b) => new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime()
|
|
229
|
-
);
|
|
230
|
-
case 'oldest':
|
|
231
|
-
return sorted.sort(
|
|
232
|
-
(a, b) => new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime()
|
|
233
|
-
);
|
|
234
|
-
case 'name-asc':
|
|
235
|
-
return sorted.sort((a, b) => a.originalFilename.localeCompare(b.originalFilename));
|
|
236
|
-
case 'name-desc':
|
|
237
|
-
return sorted.sort((a, b) => b.originalFilename.localeCompare(a.originalFilename));
|
|
238
|
-
default:
|
|
239
|
-
return sorted;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
600
|
// Pinned assets (already in array) — separate from the main sorted list
|
|
244
601
|
const pinnedAssets = $derived.by(() => {
|
|
245
602
|
if (!(selectable && multiSelect && existingAssetIds && existingAssetIds.size > 0)) return [];
|
|
246
603
|
return assetList.filter((a) => !isSystemAsset(a) && existingAssetIds!.has(a.id));
|
|
247
604
|
});
|
|
248
605
|
|
|
606
|
+
/**
|
|
607
|
+
* The page as the server ordered it, minus the system assets and (in picker
|
|
608
|
+
* mode) the ones shown as pinned.
|
|
609
|
+
*
|
|
610
|
+
* Deliberately does not re-sort. It used to, and that sort only ever saw the
|
|
611
|
+
* loaded page: "Name: A–Z" across 300 assets alphabetised whichever 30 rows
|
|
612
|
+
* happened to be in `assetList`, so the first page showed the A's from the
|
|
613
|
+
* newest 30 uploads rather than the A's from the library. It looked sorted,
|
|
614
|
+
* which is why it survived this long. `sort` is a query parameter now.
|
|
615
|
+
*/
|
|
249
616
|
const sortedAssets = $derived.by(() => {
|
|
250
617
|
const visibleAssets = assetList.filter((a) => !isSystemAsset(a));
|
|
251
618
|
if (selectable && multiSelect && existingAssetIds && existingAssetIds.size > 0) {
|
|
252
|
-
return
|
|
619
|
+
return visibleAssets.filter((a) => !existingAssetIds!.has(a.id));
|
|
253
620
|
}
|
|
254
|
-
return
|
|
621
|
+
return visibleAssets;
|
|
255
622
|
});
|
|
256
623
|
|
|
257
|
-
|
|
624
|
+
/**
|
|
625
|
+
* Every visible asset, in the order it renders: pinned first, then the sorted
|
|
626
|
+
* page.
|
|
627
|
+
*
|
|
628
|
+
* Range selection needs one flat order that both views agree on, because
|
|
629
|
+
* "everything between these two" is meaningless against a list the user isn't
|
|
630
|
+
* looking at. It's also the honest answer for select-all: `sortedAssets`
|
|
631
|
+
* excludes the pinned ones in picker mode, so a select-all built on it could
|
|
632
|
+
* add every visible asset but never clear the pinned ones back off.
|
|
633
|
+
*/
|
|
634
|
+
const orderedAssets = $derived([...pinnedAssets, ...sortedAssets]);
|
|
635
|
+
|
|
636
|
+
// Bulk selection derived (must be after orderedAssets)
|
|
258
637
|
const allSelected = $derived(
|
|
259
|
-
|
|
638
|
+
orderedAssets.length > 0 && orderedAssets.every((a) => selectedIds.has(a.id))
|
|
260
639
|
);
|
|
261
640
|
|
|
641
|
+
/**
|
|
642
|
+
* Add or remove the *visible* assets, as a delta.
|
|
643
|
+
*
|
|
644
|
+
* Never assign the page as the whole set: in picker mode `selectedIds` spans
|
|
645
|
+
* pages, so replacing it would discard every selection not on screen —
|
|
646
|
+
* deleting those images from the field on confirm.
|
|
647
|
+
*/
|
|
262
648
|
function toggleSelectAll() {
|
|
649
|
+
const next = new SvelteSet(selectedIds);
|
|
263
650
|
if (allSelected) {
|
|
264
|
-
|
|
651
|
+
for (const asset of orderedAssets) next.delete(asset.id);
|
|
265
652
|
} else {
|
|
266
|
-
|
|
653
|
+
for (const asset of orderedAssets) next.add(asset.id);
|
|
267
654
|
}
|
|
655
|
+
selectedIds = next;
|
|
656
|
+
selectionAnchor = null;
|
|
657
|
+
syncSelectMode();
|
|
268
658
|
}
|
|
269
659
|
|
|
270
660
|
function toggleSelect(id: string) {
|
|
@@ -275,39 +665,116 @@
|
|
|
275
665
|
next.add(id);
|
|
276
666
|
}
|
|
277
667
|
selectedIds = next;
|
|
668
|
+
syncSelectMode();
|
|
278
669
|
}
|
|
279
670
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
671
|
+
/**
|
|
672
|
+
* Apply the anchor's own outcome to everything between it and `id`, inclusive.
|
|
673
|
+
*
|
|
674
|
+
* The range doesn't always *select*: it repeats whatever the anchor click did.
|
|
675
|
+
* Ticking one asset and shift-clicking ten below it selects eleven; unticking
|
|
676
|
+
* one and shift-clicking ten below it clears eleven. Deselecting a range is
|
|
677
|
+
* the only practical way to undo an overshoot on a hundred-item page, and
|
|
678
|
+
* making the gesture mean "select" in both directions would leave the
|
|
679
|
+
* correction to a hundred individual clicks.
|
|
680
|
+
*
|
|
681
|
+
* Only the assets between the two ends are touched, so a picker-mode
|
|
682
|
+
* selection that spans other pages survives either direction.
|
|
683
|
+
*
|
|
684
|
+
* The anchor deliberately stays put afterwards, so a second shift-click
|
|
685
|
+
* re-extends from the same origin instead of chaining off the previous target.
|
|
686
|
+
* That's what makes "oops, one too far" a correction rather than a restart.
|
|
687
|
+
*/
|
|
688
|
+
function selectRange(id: string) {
|
|
689
|
+
const to = orderedAssets.findIndex((a) => a.id === id);
|
|
690
|
+
if (to === -1) return;
|
|
691
|
+
|
|
692
|
+
// No anchor yet — a shift-click is the first click. Nothing to extend
|
|
693
|
+
// from, so treat it as an ordinary one rather than doing nothing.
|
|
694
|
+
const from = selectionAnchor ? orderedAssets.findIndex((a) => a.id === selectionAnchor) : -1;
|
|
695
|
+
if (from === -1) {
|
|
696
|
+
setAnchor(id);
|
|
697
|
+
return;
|
|
285
698
|
}
|
|
699
|
+
|
|
700
|
+
const [start, end] = from < to ? [from, to] : [to, from];
|
|
701
|
+
const next = new SvelteSet(selectedIds);
|
|
702
|
+
for (let i = start; i <= end; i++) {
|
|
703
|
+
const rangeId = orderedAssets[i]!.id;
|
|
704
|
+
if (anchorSelects) next.add(rangeId);
|
|
705
|
+
else next.delete(rangeId);
|
|
706
|
+
}
|
|
707
|
+
selectedIds = next;
|
|
708
|
+
syncSelectMode();
|
|
286
709
|
}
|
|
287
710
|
|
|
288
|
-
|
|
289
|
-
|
|
711
|
+
/**
|
|
712
|
+
* Toggle `id` and make it the anchor, recording which way it went so a
|
|
713
|
+
* following shift-click can repeat it.
|
|
714
|
+
*/
|
|
715
|
+
function setAnchor(id: string) {
|
|
716
|
+
anchorSelects = !selectedIds.has(id);
|
|
717
|
+
toggleSelect(id);
|
|
718
|
+
selectionAnchor = id;
|
|
719
|
+
}
|
|
290
720
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
721
|
+
/**
|
|
722
|
+
* The single entry point for "the user clicked this asset to select it".
|
|
723
|
+
*
|
|
724
|
+
* Every tile, row and checkbox routes through here so the anchor is
|
|
725
|
+
* maintained in one place — a path that toggles without moving the anchor
|
|
726
|
+
* leaves shift-click extending from an asset the user stopped thinking about
|
|
727
|
+
* several clicks ago.
|
|
728
|
+
*/
|
|
729
|
+
function handleSelectClick(id: string, event: { shiftKey: boolean }) {
|
|
730
|
+
if (event.shiftKey) {
|
|
731
|
+
selectRange(id);
|
|
732
|
+
return;
|
|
300
733
|
}
|
|
734
|
+
setAnchor(id);
|
|
735
|
+
}
|
|
301
736
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
737
|
+
function clearSelection() {
|
|
738
|
+
selectedIds = new Set();
|
|
739
|
+
selectionAnchor = null;
|
|
740
|
+
syncSelectMode();
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Hand back the complete selected ID set — never a list of `Asset` objects.
|
|
745
|
+
*
|
|
746
|
+
* `selectedIds` is seeded from `existingAssetIds` and spans every page, but
|
|
747
|
+
* `assetList` only ever holds the current one. Resolving the selection through
|
|
748
|
+
* `assetList` therefore silently dropped every selected asset that wasn't on
|
|
749
|
+
* the visible page, and the consumer — which treats the result as the complete
|
|
750
|
+
* desired set — deleted them from the field.
|
|
751
|
+
*
|
|
752
|
+
* IDs are also all the consumer needs: it rebuilds items as `{ _ref: id }` and
|
|
753
|
+
* preserves per-item data (alt text, `_key`, order) from what it already holds.
|
|
754
|
+
*/
|
|
755
|
+
function confirmMultiSelect() {
|
|
756
|
+
if (onSelectMultiple) {
|
|
757
|
+
onSelectMultiple([...selectedIds]);
|
|
758
|
+
clearSelection();
|
|
309
759
|
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
async function bulkDelete() {
|
|
763
|
+
if (selectedIds.size === 0) return;
|
|
310
764
|
|
|
765
|
+
// No client-side reference pre-check.
|
|
766
|
+
//
|
|
767
|
+
// There used to be one, and it disagreed with the server in the one case
|
|
768
|
+
// that matters. It counted references via `getReferenceCounts`, which
|
|
769
|
+
// filters to *registered* schema types; the server's delete guard scans
|
|
770
|
+
// unfiltered, because a document whose type was removed from the codebase
|
|
771
|
+
// still holds its reference. So an asset blocked only by an orphaned type
|
|
772
|
+
// passed the client check, hit the server, and came back 409 — with the
|
|
773
|
+
// client insisting nothing referenced it. Asking two different questions
|
|
774
|
+
// and treating them as one answer is the bug.
|
|
775
|
+
//
|
|
776
|
+
// The server does a fresh authoritative scan on every attempt, so it is the
|
|
777
|
+
// only sensible authority. Attempt the delete and handle its refusal.
|
|
311
778
|
const count = selectedIds.size;
|
|
312
779
|
const confirmed = await confirmDialog({
|
|
313
780
|
title: `Delete ${count} asset${count > 1 ? 's' : ''}?`,
|
|
@@ -317,91 +784,403 @@
|
|
|
317
784
|
});
|
|
318
785
|
if (!confirmed) return;
|
|
319
786
|
|
|
787
|
+
await performBulkDelete([...selectedIds], false);
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
async function performBulkDelete(ids: string[], force: boolean) {
|
|
320
791
|
isBulkDeleting = true;
|
|
321
792
|
try {
|
|
322
|
-
const result = await assets.deleteBulk(
|
|
793
|
+
const result = await assets.deleteBulk(ids, force ? { force: true } : undefined);
|
|
323
794
|
if (result.success) {
|
|
324
|
-
if (selectedAsset &&
|
|
795
|
+
if (selectedAsset && ids.includes(selectedAsset.id)) {
|
|
325
796
|
selectedAsset = null;
|
|
326
797
|
}
|
|
327
|
-
|
|
798
|
+
clearSelection();
|
|
328
799
|
await fetchAssets();
|
|
329
800
|
}
|
|
330
|
-
} catch {
|
|
801
|
+
} catch (err) {
|
|
802
|
+
if (err instanceof ApiError && err.status === 409) {
|
|
803
|
+
await handleBulkDeleteConflict(ids, err.response as BulkAssetDeleteConflict);
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
331
806
|
toast.error('Failed to delete assets');
|
|
332
807
|
} finally {
|
|
333
808
|
isBulkDeleting = false;
|
|
334
809
|
}
|
|
335
810
|
}
|
|
336
811
|
|
|
812
|
+
/**
|
|
813
|
+
* The batch was refused. Mirrors {@link handleDeleteConflict}: offer force only
|
|
814
|
+
* when an unregistered schema type is what's blocking, because that is the case
|
|
815
|
+
* where removing the reference by hand is impossible.
|
|
816
|
+
*/
|
|
817
|
+
async function handleBulkDeleteConflict(ids: string[], conflict: BulkAssetDeleteConflict) {
|
|
818
|
+
const blocked = conflict.referencedIds ?? [];
|
|
819
|
+
const unregisteredTypes = conflict.unregisteredTypes ?? [];
|
|
820
|
+
|
|
821
|
+
// The server just told us these are referenced; correct the cached counts so
|
|
822
|
+
// the grid stops showing them as unused before the next fetch.
|
|
823
|
+
const corrected = { ...referenceCounts };
|
|
824
|
+
for (const id of blocked) corrected[id] = Math.max(corrected[id] ?? 0, 1);
|
|
825
|
+
referenceCounts = corrected;
|
|
826
|
+
|
|
827
|
+
if (unregisteredTypes.length === 0) {
|
|
828
|
+
toast.error(conflict.error);
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
const forced = await confirmDialog({
|
|
833
|
+
title: 'Referenced by documents you cannot open',
|
|
834
|
+
// Two sentences: what's blocking, and what the button does. The rest —
|
|
835
|
+
// which plane gets cleaned, when a published page catches up — is true
|
|
836
|
+
// but belongs in the docs, not in front of someone mid-cleanup.
|
|
837
|
+
description:
|
|
838
|
+
`${blocked.length} asset${blocked.length > 1 ? 's are' : ' is'} used by documents of type ${unregisteredTypes.join(', ')}, which no longer ${unregisteredTypes.length > 1 ? 'exist' : 'exists'} in your schema. ` +
|
|
839
|
+
`Force delete removes the references for you.`,
|
|
840
|
+
confirmText: 'Force delete',
|
|
841
|
+
variant: 'destructive'
|
|
842
|
+
});
|
|
843
|
+
if (forced) {
|
|
844
|
+
await performBulkDelete(ids, true);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
337
848
|
// Upload files via modal queue
|
|
849
|
+
//
|
|
850
|
+
// Oversized files are failed here rather than sent, because `File.size` is
|
|
851
|
+
// known before a single byte goes over the wire. Uploading a 50MB file for
|
|
852
|
+
// the length of the transfer only to be told it was never going to be
|
|
853
|
+
// accepted is the worst version of this. Rejecting up front is purely a
|
|
854
|
+
// courtesy though — the server enforces the same limit, since nothing stops
|
|
855
|
+
// a caller posting straight to the API.
|
|
856
|
+
/**
|
|
857
|
+
* The local preconditions a file must meet to be worth sending. Returns the
|
|
858
|
+
* reason it cannot be uploaded, or `undefined` when it can. Shared by the
|
|
859
|
+
* queue, the retry path and `revalidateRejected` so the three can't drift into
|
|
860
|
+
* disagreeing about why a file was turned away.
|
|
861
|
+
*/
|
|
862
|
+
function uploadRejection(file: File): string | undefined {
|
|
863
|
+
if (!acceptsUpload(file)) {
|
|
864
|
+
return `File type ${file.type || file.name} is not accepted here`;
|
|
865
|
+
}
|
|
866
|
+
const fileLimit = maxUploadFileBytes(maxUploadBytes);
|
|
867
|
+
if (file.size > fileLimit) {
|
|
868
|
+
return `Too large — ${formatSize(file.size)}, limit is ${formatSize(fileLimit)}`;
|
|
869
|
+
}
|
|
870
|
+
return undefined;
|
|
871
|
+
}
|
|
872
|
+
|
|
338
873
|
function addFilesToQueue(files: FileList | null) {
|
|
339
874
|
if (!files || files.length === 0) return;
|
|
340
|
-
const newItems: UploadQueueItem[] = Array.from(files).map((file) =>
|
|
341
|
-
file
|
|
342
|
-
|
|
343
|
-
|
|
875
|
+
const newItems: UploadQueueItem[] = Array.from(files).map((file) => {
|
|
876
|
+
const previewUrl = file.type.startsWith('image/') ? URL.createObjectURL(file) : undefined;
|
|
877
|
+
const rejection = uploadRejection(file);
|
|
878
|
+
return rejection
|
|
879
|
+
? { file, previewUrl, status: 'rejected' as const, error: rejection }
|
|
880
|
+
: { file, previewUrl, status: 'pending' as const };
|
|
881
|
+
});
|
|
344
882
|
uploadQueue = [...uploadQueue, ...newItems];
|
|
345
883
|
processUploadQueue();
|
|
346
884
|
}
|
|
347
885
|
|
|
886
|
+
/**
|
|
887
|
+
* Re-run the preconditions over rejected files. The server's real limits
|
|
888
|
+
* (`maxUploadBytes`, `globalAllowedMimeTypes`) arrive with the first asset
|
|
889
|
+
* page, which can land after files were already dropped in. Without this, a
|
|
890
|
+
* file turned away by the compiled-in defaults would stay rejected once the
|
|
891
|
+
* true, more permissive limits showed up — and since rejected rows carry no
|
|
892
|
+
* Retry, nothing in the dialog could clear it.
|
|
893
|
+
*/
|
|
894
|
+
function revalidateRejected() {
|
|
895
|
+
let changed = false;
|
|
896
|
+
for (const item of uploadQueue) {
|
|
897
|
+
if (item.status !== 'rejected') continue;
|
|
898
|
+
const rejection = uploadRejection(item.file);
|
|
899
|
+
if (!rejection) {
|
|
900
|
+
item.status = 'pending';
|
|
901
|
+
item.error = undefined;
|
|
902
|
+
changed = true;
|
|
903
|
+
} else if (rejection !== item.error) {
|
|
904
|
+
item.error = rejection;
|
|
905
|
+
changed = true;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
if (changed) {
|
|
909
|
+
uploadQueue = [...uploadQueue];
|
|
910
|
+
processUploadQueue();
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/** Drop one file from the queue, releasing the preview object URL it holds. */
|
|
915
|
+
function removeQueueItem(index: number) {
|
|
916
|
+
const item = uploadQueue[index];
|
|
917
|
+
if (!item || item.status === 'uploading') return;
|
|
918
|
+
if (item.previewUrl) URL.revokeObjectURL(item.previewUrl);
|
|
919
|
+
uploadQueue = [...uploadQueue.slice(0, index), ...uploadQueue.slice(index + 1)];
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/** Upload one queued item, reporting progress as it goes. */
|
|
923
|
+
async function uploadItem(index: number) {
|
|
924
|
+
const item = uploadQueue[index];
|
|
925
|
+
if (!item) return;
|
|
926
|
+
|
|
927
|
+
item.status = 'uploading';
|
|
928
|
+
item.progress = 0;
|
|
929
|
+
item.error = undefined;
|
|
930
|
+
uploadQueue = [...uploadQueue];
|
|
931
|
+
|
|
932
|
+
try {
|
|
933
|
+
// Read duration, real dimensions and a frame off the local file before it
|
|
934
|
+
// goes anywhere. Only possible here: once uploaded, the same work would
|
|
935
|
+
// mean fetching the video back, and the server has no decoder without
|
|
936
|
+
// taking on ffmpeg.
|
|
937
|
+
const videoInfo = await extractVideoInfo(item.file);
|
|
938
|
+
|
|
939
|
+
const result = await assets.uploadFile(item.file, {
|
|
940
|
+
direct: directUpload,
|
|
941
|
+
// Absent for a plain Media-tab upload; see the prop docs.
|
|
942
|
+
schemaType,
|
|
943
|
+
fieldPath,
|
|
944
|
+
allowedMimeTypes: acceptedFileTypes,
|
|
945
|
+
videoDuration: videoInfo.duration,
|
|
946
|
+
videoWidth: videoInfo.width,
|
|
947
|
+
videoHeight: videoInfo.height,
|
|
948
|
+
onProgress: (percent) => {
|
|
949
|
+
item.progress = percent;
|
|
950
|
+
uploadQueue = [...uploadQueue];
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
// The poster is a second request because its storage key derives from the
|
|
955
|
+
// asset id, which doesn't exist until the row does. Deliberately not
|
|
956
|
+
// awaited into the upload's own success: a video that uploaded fine has
|
|
957
|
+
// uploaded fine, and losing its thumbnail must not report as a failure.
|
|
958
|
+
const uploadedId = result?.data?.id;
|
|
959
|
+
if (uploadedId && videoInfo.poster) {
|
|
960
|
+
try {
|
|
961
|
+
await assets.uploadPoster(uploadedId, videoInfo.poster, {
|
|
962
|
+
duration: videoInfo.duration,
|
|
963
|
+
width: videoInfo.width,
|
|
964
|
+
height: videoInfo.height
|
|
965
|
+
});
|
|
966
|
+
} catch (err) {
|
|
967
|
+
cmsLogger.warn('[Media]', 'Poster upload failed; video is fine:', err);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
item.status = 'done';
|
|
972
|
+
item.progress = 100;
|
|
973
|
+
} catch (err) {
|
|
974
|
+
// A 4xx is the server judging this file unacceptable — the wrong type, too
|
|
975
|
+
// large, content it won't take — and sending the identical bytes again gets
|
|
976
|
+
// the identical answer, so it belongs in `rejected` with a Remove rather
|
|
977
|
+
// than behind a Retry that can only fail. A timeout, a rate limit or a
|
|
978
|
+
// server fault is the transient case Retry actually exists for.
|
|
979
|
+
const retryable =
|
|
980
|
+
!(err instanceof ApiError) || err.status >= 500 || err.status === 408 || err.status === 429;
|
|
981
|
+
item.status = retryable ? 'failed' : 'rejected';
|
|
982
|
+
item.error = uploadErrorMessage(err);
|
|
983
|
+
}
|
|
984
|
+
uploadQueue = [...uploadQueue];
|
|
985
|
+
}
|
|
986
|
+
|
|
348
987
|
async function processUploadQueue() {
|
|
349
988
|
if (isUploading) return;
|
|
350
989
|
isUploading = true;
|
|
351
990
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
formData.append('file', uploadQueue[i]!.file);
|
|
360
|
-
const result = await assets.upload(formData);
|
|
361
|
-
uploadQueue[i]!.status = result.success ? 'done' : 'failed';
|
|
362
|
-
} catch {
|
|
363
|
-
uploadQueue[i]!.status = 'failed';
|
|
991
|
+
// A pool of workers pulling from the queue, rather than a fixed split:
|
|
992
|
+
// files differ wildly in size, so slicing the queue into equal shares
|
|
993
|
+
// would leave one worker on a 9MB photo while the others idle.
|
|
994
|
+
const next = (): number => uploadQueue.findIndex((item) => item.status === 'pending');
|
|
995
|
+
const worker = async () => {
|
|
996
|
+
for (let i = next(); i !== -1; i = next()) {
|
|
997
|
+
await uploadItem(i);
|
|
364
998
|
}
|
|
999
|
+
};
|
|
1000
|
+
await Promise.all(
|
|
1001
|
+
Array.from({ length: Math.min(UPLOAD_CONCURRENCY, uploadQueue.length) }, worker)
|
|
1002
|
+
);
|
|
1003
|
+
|
|
1004
|
+
isUploading = false;
|
|
1005
|
+
|
|
1006
|
+
// The dialog stays open when the queue drains, and the editor dismisses it.
|
|
1007
|
+
//
|
|
1008
|
+
// It used to close itself 800ms after a fully successful run (and, before
|
|
1009
|
+
// that, on `done || failed`, so a rejected upload dismissed the modal
|
|
1010
|
+
// exactly like a successful one and the failure was never read). Even
|
|
1011
|
+
// limited to the all-succeeded case, closing on a timer takes the result
|
|
1012
|
+
// away just as it appears — and on a slow backend a large video upload is
|
|
1013
|
+
// precisely when someone wants to see it land. Staying open also keeps the
|
|
1014
|
+
// drop zone available for the next batch.
|
|
1015
|
+
currentPage = 1;
|
|
1016
|
+
await fetchAssets(1);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Re-queue a failed upload.
|
|
1021
|
+
*
|
|
1022
|
+
* The `File` is still held by the queue item, so this costs the editor
|
|
1023
|
+
* nothing — the alternative was closing the dialog and picking the file
|
|
1024
|
+
* again, which for a drag-and-drop of twenty images meant redoing the lot to
|
|
1025
|
+
* retry one.
|
|
1026
|
+
*/
|
|
1027
|
+
function retryUpload(index: number) {
|
|
1028
|
+
const item = uploadQueue[index];
|
|
1029
|
+
if (!item || item.status !== 'failed') return;
|
|
1030
|
+
// Re-check the preconditions before spending a round trip: the limits may
|
|
1031
|
+
// have been learned since, and a file that is now ineligible belongs in
|
|
1032
|
+
// `rejected` rather than being offered a Retry that can't succeed.
|
|
1033
|
+
const rejection = uploadRejection(item.file);
|
|
1034
|
+
if (rejection) {
|
|
1035
|
+
item.status = 'rejected';
|
|
1036
|
+
item.error = rejection;
|
|
365
1037
|
uploadQueue = [...uploadQueue];
|
|
1038
|
+
return;
|
|
366
1039
|
}
|
|
1040
|
+
item.status = 'pending';
|
|
1041
|
+
item.error = undefined;
|
|
1042
|
+
uploadQueue = [...uploadQueue];
|
|
1043
|
+
processUploadQueue();
|
|
1044
|
+
}
|
|
367
1045
|
|
|
368
|
-
|
|
1046
|
+
function retryAllFailed() {
|
|
1047
|
+
for (const item of uploadQueue) {
|
|
1048
|
+
if (item.status !== 'failed') continue;
|
|
1049
|
+
const rejection = uploadRejection(item.file);
|
|
1050
|
+
if (rejection) {
|
|
1051
|
+
item.status = 'rejected';
|
|
1052
|
+
item.error = rejection;
|
|
1053
|
+
continue;
|
|
1054
|
+
}
|
|
1055
|
+
item.status = 'pending';
|
|
1056
|
+
item.error = undefined;
|
|
1057
|
+
}
|
|
1058
|
+
uploadQueue = [...uploadQueue];
|
|
1059
|
+
processUploadQueue();
|
|
1060
|
+
}
|
|
369
1061
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
1062
|
+
const failedCount = $derived(uploadQueue.filter((i) => i.status === 'failed').length);
|
|
1063
|
+
const rejectedCount = $derived(uploadQueue.filter((i) => i.status === 'rejected').length);
|
|
1064
|
+
/** Rejected files are never sent, so they count toward neither tally. */
|
|
1065
|
+
const queuedItems = $derived(uploadQueue.filter((i) => i.status !== 'rejected'));
|
|
1066
|
+
const queuedBytes = $derived(queuedItems.reduce((total, item) => total + item.file.size, 0));
|
|
1067
|
+
|
|
1068
|
+
/** Empty the queue, releasing the preview object URLs it holds. */
|
|
1069
|
+
function clearUploadQueue() {
|
|
1070
|
+
for (const item of uploadQueue) {
|
|
1071
|
+
if (item.previewUrl) URL.revokeObjectURL(item.previewUrl);
|
|
378
1072
|
}
|
|
1073
|
+
uploadQueue = [];
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Turn a thrown upload error into something an editor can act on.
|
|
1078
|
+
*
|
|
1079
|
+
* The server's own message is preferred — it's the one that names the actual
|
|
1080
|
+
* limit — with the status only used to fill in cases where the response
|
|
1081
|
+
* carries no body, such as a proxy rejecting an oversized request before it
|
|
1082
|
+
* ever reaches the app.
|
|
1083
|
+
*/
|
|
1084
|
+
function uploadErrorMessage(err: unknown): string {
|
|
1085
|
+
if (err instanceof ApiError) {
|
|
1086
|
+
const serverMessage = err.response?.error;
|
|
1087
|
+
if (typeof serverMessage === 'string' && serverMessage) return serverMessage;
|
|
1088
|
+
if (err.status === 413) return 'File is too large for this server’s upload limit';
|
|
1089
|
+
return `Upload failed (${err.status})`;
|
|
1090
|
+
}
|
|
1091
|
+
if (err instanceof Error && err.message) return err.message;
|
|
1092
|
+
return 'Upload failed';
|
|
379
1093
|
}
|
|
380
1094
|
|
|
381
1095
|
// Drag and drop
|
|
1096
|
+
//
|
|
1097
|
+
// `dragleave` fires whenever the pointer crosses onto a *child* element, not
|
|
1098
|
+
// only when it leaves the region — and the grid is nothing but children. So
|
|
1099
|
+
// toggling a boolean on enter/leave switched the overlay off every time the
|
|
1100
|
+
// cursor moved between tiles, and `dragover` immediately switched it back on:
|
|
1101
|
+
// the flashing.
|
|
1102
|
+
//
|
|
1103
|
+
// The counter is the fix for that. Enter and leave arrive in pairs as the drag
|
|
1104
|
+
// crosses each boundary, so the depth only reaches zero when the drag has
|
|
1105
|
+
// genuinely left the region.
|
|
1106
|
+
let dragDepth = $state(0);
|
|
1107
|
+
const isDragging = $derived(dragDepth > 0);
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Ignore drags that aren't files.
|
|
1111
|
+
*
|
|
1112
|
+
* Dragging a text selection, or one of the grid's own tiles, would otherwise
|
|
1113
|
+
* put a "Drop files to upload" overlay over the page for a drop that can
|
|
1114
|
+
* produce nothing.
|
|
1115
|
+
*/
|
|
1116
|
+
function isFileDrag(e: DragEvent): boolean {
|
|
1117
|
+
const types = e.dataTransfer?.types;
|
|
1118
|
+
return types ? Array.from(types).includes('Files') : false;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
function handleDragEnter(e: DragEvent) {
|
|
1122
|
+
if (!isFileDrag(e)) return;
|
|
1123
|
+
e.preventDefault();
|
|
1124
|
+
dragDepth++;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
382
1127
|
function handleDragOver(e: DragEvent) {
|
|
1128
|
+
if (!isFileDrag(e)) return;
|
|
1129
|
+
// Required on every dragover, or the browser treats the region as a
|
|
1130
|
+
// non-target and shows the "no drop" cursor.
|
|
383
1131
|
e.preventDefault();
|
|
384
|
-
isDragging = true;
|
|
385
1132
|
}
|
|
386
1133
|
|
|
387
1134
|
function handleDragLeave(e: DragEvent) {
|
|
1135
|
+
if (dragDepth === 0) return;
|
|
388
1136
|
e.preventDefault();
|
|
389
|
-
|
|
1137
|
+
dragDepth--;
|
|
390
1138
|
}
|
|
391
1139
|
|
|
392
1140
|
function handleDrop(e: DragEvent) {
|
|
393
1141
|
e.preventDefault();
|
|
394
|
-
|
|
1142
|
+
dragDepth = 0;
|
|
1143
|
+
if (!e.dataTransfer?.files?.length) return;
|
|
395
1144
|
showUploadModal = true;
|
|
396
|
-
addFilesToQueue(e.dataTransfer
|
|
1145
|
+
addFilesToQueue(e.dataTransfer.files);
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* A drag that ends outside the window — dropped on the desktop, or cancelled
|
|
1150
|
+
* with Escape — delivers no `dragleave` to us, so the counter would stay above
|
|
1151
|
+
* zero and strand the overlay on screen until the next drag.
|
|
1152
|
+
*/
|
|
1153
|
+
function handleDragEnd() {
|
|
1154
|
+
dragDepth = 0;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Ask before throwing away metadata edits.
|
|
1159
|
+
*
|
|
1160
|
+
* Everything that replaces or closes the detail panel goes through here.
|
|
1161
|
+
* Without it, typing alt text and then clicking the next thumbnail — the
|
|
1162
|
+
* natural rhythm of captioning a shoot — discarded the text silently, with
|
|
1163
|
+
* the panel that appeared next looking exactly like a successful save.
|
|
1164
|
+
*/
|
|
1165
|
+
async function confirmDiscardEdits(): Promise<boolean> {
|
|
1166
|
+
if (!metadataDirty) return true;
|
|
1167
|
+
return confirmDialog({
|
|
1168
|
+
title: 'Discard unsaved changes?',
|
|
1169
|
+
description: 'The metadata you edited on this asset has not been saved.',
|
|
1170
|
+
confirmText: 'Discard',
|
|
1171
|
+
variant: 'destructive'
|
|
1172
|
+
});
|
|
397
1173
|
}
|
|
398
1174
|
|
|
399
1175
|
// Select an asset for detail view — re-fetch to get fresh data
|
|
400
1176
|
// Select an asset for detail view
|
|
401
|
-
function openAssetDetail(asset: Asset) {
|
|
1177
|
+
async function openAssetDetail(asset: Asset) {
|
|
402
1178
|
const isSameAsset = selectedAsset?.id === asset.id;
|
|
1179
|
+
if (!isSameAsset && !(await confirmDiscardEdits())) return;
|
|
403
1180
|
|
|
404
1181
|
selectedAsset = asset;
|
|
1182
|
+
if (!isSameAsset) onAssetOpen?.(asset.id);
|
|
1183
|
+
editFilename = asset.originalFilename || '';
|
|
405
1184
|
editTitle = asset.title || '';
|
|
406
1185
|
editDescription = asset.description || '';
|
|
407
1186
|
editAlt = asset.alt || '';
|
|
@@ -415,20 +1194,65 @@
|
|
|
415
1194
|
}
|
|
416
1195
|
}
|
|
417
1196
|
|
|
418
|
-
function closeAssetDetail() {
|
|
1197
|
+
async function closeAssetDetail() {
|
|
1198
|
+
if (!(await confirmDiscardEdits())) return;
|
|
419
1199
|
selectedAsset = null;
|
|
1200
|
+
onAssetOpen?.(null);
|
|
420
1201
|
}
|
|
421
1202
|
|
|
422
|
-
|
|
1203
|
+
/**
|
|
1204
|
+
* Open the asset named by `assetId`, fetching it if it isn't already loaded.
|
|
1205
|
+
*
|
|
1206
|
+
* Runs once per distinct incoming id. It deliberately does not react to
|
|
1207
|
+
* `selectedAsset` changing, or clicking a thumbnail would re-enter through
|
|
1208
|
+
* the host's URL update and fight the user's selection.
|
|
1209
|
+
*/
|
|
1210
|
+
let resolvedDeepLink = $state<string | null>(null);
|
|
1211
|
+
|
|
1212
|
+
$effect(() => {
|
|
1213
|
+
const wanted = assetId;
|
|
1214
|
+
if (!wanted || wanted === resolvedDeepLink || !canRead) return;
|
|
1215
|
+
resolvedDeepLink = wanted;
|
|
1216
|
+
if (selectedAsset?.id === wanted) return;
|
|
1217
|
+
|
|
1218
|
+
const loaded = assetList.find((a) => a.id === wanted);
|
|
1219
|
+
if (loaded) {
|
|
1220
|
+
openAssetDetail(loaded);
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
void (async () => {
|
|
1225
|
+
try {
|
|
1226
|
+
const result = await assets.getById(wanted);
|
|
1227
|
+
if (result.success && result.data) await openAssetDetail(result.data);
|
|
1228
|
+
else toast.error('That asset could not be found');
|
|
1229
|
+
} catch {
|
|
1230
|
+
// A bad id in a URL is a dead link, not a broken media browser —
|
|
1231
|
+
// the library behind it still loaded and is perfectly usable.
|
|
1232
|
+
toast.error('That asset could not be found');
|
|
1233
|
+
}
|
|
1234
|
+
})();
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1237
|
+
// Save metadata.
|
|
1238
|
+
//
|
|
1239
|
+
// Emptied fields are sent as `null`, not `undefined`: `JSON.stringify` drops
|
|
1240
|
+
// undefined keys from the body, so an omitted field reads on the server as
|
|
1241
|
+
// "leave this alone" — metadata could be added but never cleared. `null` is
|
|
1242
|
+
// the explicit "clear it" signal the PATCH route and adapters honour.
|
|
423
1243
|
async function saveMetadata() {
|
|
424
|
-
if (!selectedAsset) return;
|
|
1244
|
+
if (!selectedAsset || !canUpload) return;
|
|
425
1245
|
isSaving = true;
|
|
426
1246
|
try {
|
|
427
1247
|
const result = await assets.update(selectedAsset.id, {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
1248
|
+
// Renaming is metadata-only: the object is stored under the asset id,
|
|
1249
|
+
// so nothing moves and existing references keep resolving. Blank means
|
|
1250
|
+
// "unchanged" rather than "clear it" — an asset always has a name.
|
|
1251
|
+
originalFilename: editFilename.trim() || undefined,
|
|
1252
|
+
title: editTitle || null,
|
|
1253
|
+
description: editDescription || null,
|
|
1254
|
+
alt: editAlt || null,
|
|
1255
|
+
creditLine: editCreditLine || null
|
|
432
1256
|
});
|
|
433
1257
|
if (result.success && result.data) {
|
|
434
1258
|
// Update in list
|
|
@@ -442,23 +1266,13 @@
|
|
|
442
1266
|
}
|
|
443
1267
|
}
|
|
444
1268
|
|
|
445
|
-
// Delete asset
|
|
1269
|
+
// Delete asset.
|
|
1270
|
+
//
|
|
1271
|
+
// No client-side reference pre-check: the server scans unfiltered and is the
|
|
1272
|
+
// only authority. A local check would duplicate that scan, and it reads from
|
|
1273
|
+
// `referenceCounts`, which goes stale the moment a document changes (#233) —
|
|
1274
|
+
// blocking deletes that should succeed and permitting ones that shouldn't.
|
|
446
1275
|
async function deleteAsset(asset: Asset) {
|
|
447
|
-
try {
|
|
448
|
-
const result = await assets.getReferenceCounts([asset.id]);
|
|
449
|
-
if (result.success && result.data) {
|
|
450
|
-
referenceCounts = { ...referenceCounts, ...result.data };
|
|
451
|
-
}
|
|
452
|
-
} catch {
|
|
453
|
-
// Fall through to cached count
|
|
454
|
-
}
|
|
455
|
-
const refCount = referenceCounts[asset.id] || 0;
|
|
456
|
-
if (refCount > 0) {
|
|
457
|
-
toast.error(
|
|
458
|
-
`Cannot delete "${asset.originalFilename}" — referenced by ${refCount} document${refCount > 1 ? 's' : ''}. Remove the references first.`
|
|
459
|
-
);
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
1276
|
const confirmed = await confirmDialog({
|
|
463
1277
|
title: 'Delete asset?',
|
|
464
1278
|
description: `"${asset.originalFilename}" will be permanently deleted. This cannot be undone.`,
|
|
@@ -466,24 +1280,90 @@
|
|
|
466
1280
|
variant: 'destructive'
|
|
467
1281
|
});
|
|
468
1282
|
if (!confirmed) return;
|
|
1283
|
+
await performDelete(asset, false);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
async function performDelete(asset: Asset, force: boolean) {
|
|
469
1287
|
try {
|
|
470
|
-
const result = await assets.delete(asset.id);
|
|
1288
|
+
const result = await assets.delete(asset.id, force ? { force: true } : undefined);
|
|
471
1289
|
if (result.success) {
|
|
472
1290
|
if (selectedAsset?.id === asset.id) {
|
|
473
1291
|
selectedAsset = null;
|
|
474
1292
|
}
|
|
1293
|
+
// Drop the cached count rather than leave it behind for an id that
|
|
1294
|
+
// no longer exists.
|
|
1295
|
+
const next = { ...referenceCounts };
|
|
1296
|
+
delete next[asset.id];
|
|
1297
|
+
referenceCounts = next;
|
|
475
1298
|
await fetchAssets();
|
|
476
1299
|
}
|
|
477
|
-
} catch {
|
|
1300
|
+
} catch (error) {
|
|
1301
|
+
if (error instanceof ApiError && error.status === 409) {
|
|
1302
|
+
await handleDeleteConflict(asset, error.response as AssetDeleteConflict);
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
478
1305
|
toast.error('Failed to delete asset');
|
|
479
1306
|
}
|
|
480
1307
|
}
|
|
481
1308
|
|
|
1309
|
+
/**
|
|
1310
|
+
* The asset is still referenced. The server has just done a fresh unfiltered
|
|
1311
|
+
* scan, so treat its answer as the truth and correct the cached count with it.
|
|
1312
|
+
*
|
|
1313
|
+
* When any referencing document uses an unregistered schema type, force is the
|
|
1314
|
+
* user's only route — that document cannot be opened in the admin, so the
|
|
1315
|
+
* reference cannot be removed by hand and the asset would be undeletable.
|
|
1316
|
+
*/
|
|
1317
|
+
async function handleDeleteConflict(asset: Asset, conflict: AssetDeleteConflict) {
|
|
1318
|
+
const references = conflict.references ?? [];
|
|
1319
|
+
const unregisteredTypes = conflict.unregisteredTypes ?? [];
|
|
1320
|
+
referenceCounts = { ...referenceCounts, [asset.id]: references.length };
|
|
1321
|
+
|
|
1322
|
+
if (unregisteredTypes.length === 0) {
|
|
1323
|
+
toast.error(conflict.error);
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
const blocking = references.filter((ref) => unregisteredTypes.includes(ref.type));
|
|
1328
|
+
const forced = await confirmDialog({
|
|
1329
|
+
title: 'Referenced by a document you cannot open',
|
|
1330
|
+
// See the bulk dialog: what's blocking, then what the button does.
|
|
1331
|
+
description:
|
|
1332
|
+
`"${asset.originalFilename}" is used by ${blocking.length} document${blocking.length > 1 ? 's' : ''} of type ${unregisteredTypes.join(', ')}, which no longer ${unregisteredTypes.length > 1 ? 'exist' : 'exists'} in your schema. ` +
|
|
1333
|
+
`Force delete removes the reference${blocking.length > 1 ? 's' : ''} for you.`,
|
|
1334
|
+
confirmText: 'Force delete',
|
|
1335
|
+
variant: 'destructive'
|
|
1336
|
+
});
|
|
1337
|
+
if (forced) {
|
|
1338
|
+
await performDelete(asset, true);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
|
|
482
1342
|
// Copy URL state
|
|
483
1343
|
let copiedUrl = $state(false);
|
|
484
1344
|
|
|
1345
|
+
let copiedId = $state(false);
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Copy the raw asset id.
|
|
1349
|
+
*
|
|
1350
|
+
* Not `copyUrlToClipboard`, which prefixes `window.location.origin` for a
|
|
1351
|
+
* shareable link — correct for a URL and wrong for an id, which is pasted
|
|
1352
|
+
* into a query, a seed, or an `{ asset: { _ref } }`, never into a browser.
|
|
1353
|
+
*/
|
|
1354
|
+
async function copyAssetId(asset: Asset) {
|
|
1355
|
+
try {
|
|
1356
|
+
await navigator.clipboard.writeText(asset.id);
|
|
1357
|
+
copiedId = true;
|
|
1358
|
+
toast.success('Asset ID copied');
|
|
1359
|
+
setTimeout(() => (copiedId = false), 2000);
|
|
1360
|
+
} catch {
|
|
1361
|
+
toast.error('Failed to copy asset ID');
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
|
|
485
1365
|
async function copyAssetUrl(asset: Asset) {
|
|
486
|
-
const url =
|
|
1366
|
+
const url = getOriginalUrl(asset);
|
|
487
1367
|
const success = await copyUrlToClipboard(url);
|
|
488
1368
|
if (success) {
|
|
489
1369
|
copiedUrl = true;
|
|
@@ -492,7 +1372,18 @@
|
|
|
492
1372
|
}
|
|
493
1373
|
|
|
494
1374
|
function downloadAsset(asset: Asset) {
|
|
495
|
-
downloadFile(
|
|
1375
|
+
downloadFile(getOriginalUrl(asset), asset.originalFilename);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* Secondary line on a grid tile: `PNG · 2.4 MB`, with dimensions when known.
|
|
1380
|
+
* The filename alone rarely distinguishes two crops of the same photo, which
|
|
1381
|
+
* is the case where a contact-sheet grid is least useful.
|
|
1382
|
+
*/
|
|
1383
|
+
function assetMetaLine(asset: Asset): string {
|
|
1384
|
+
const kind = (asset.mimeType?.split('/')[1] ?? '').toUpperCase();
|
|
1385
|
+
const dimensions = asset.width && asset.height ? `${asset.width}×${asset.height}` : null;
|
|
1386
|
+
return [kind || null, dimensions, formatSize(asset.size)].filter(Boolean).join(' · ');
|
|
496
1387
|
}
|
|
497
1388
|
|
|
498
1389
|
// Format file size
|
|
@@ -509,16 +1400,272 @@
|
|
|
509
1400
|
return d.toLocaleDateString('en-US', { month: '2-digit', day: '2-digit', year: 'numeric' });
|
|
510
1401
|
}
|
|
511
1402
|
|
|
512
|
-
|
|
1403
|
+
/**
|
|
1404
|
+
* URL to draw an asset at tile size.
|
|
1405
|
+
*
|
|
1406
|
+
* Prefers the smallest derivative on the ladder. This grid used to render
|
|
1407
|
+
* `asset.url` — the original — so a page of thirty photographs pulled thirty
|
|
1408
|
+
* full-resolution files to fill thirty ~200px tiles. Nothing looked wrong,
|
|
1409
|
+
* which is precisely why it went unnoticed.
|
|
1410
|
+
*
|
|
1411
|
+
* Falls back to the original when the pipeline is off or the asset can't be
|
|
1412
|
+
* resized (SVG, animated): the variant route would serve the original for
|
|
1413
|
+
* those anyway, and naming it directly saves a pointless redirect through a
|
|
1414
|
+
* generation attempt.
|
|
1415
|
+
*/
|
|
1416
|
+
/**
|
|
1417
|
+
* A video's poster frame, when one was extracted at upload.
|
|
1418
|
+
*
|
|
1419
|
+
* Gated on the recorded flag rather than optimistically requesting the URL: a
|
|
1420
|
+
* video without a poster answers 404, and a grid of broken <img> is worse than
|
|
1421
|
+
* a grid of honest placeholder icons.
|
|
1422
|
+
*/
|
|
1423
|
+
let generatingPoster = $state(false);
|
|
1424
|
+
|
|
1425
|
+
/**
|
|
1426
|
+
* Videos whose poster we have already tried to produce this session.
|
|
1427
|
+
*
|
|
1428
|
+
* Without it a video the browser cannot decode is retried on every render:
|
|
1429
|
+
* failure leaves no poster, an absent poster is the trigger, and the loop
|
|
1430
|
+
* costs a fetch and a decode attempt each time round.
|
|
1431
|
+
*/
|
|
1432
|
+
const posterAttempts = new SvelteSet<string>();
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Fill in posters for videos that have none.
|
|
1436
|
+
*
|
|
1437
|
+
* Automatic rather than a button, because "this video has no thumbnail" is not
|
|
1438
|
+
* a decision an editor should have to make — it is just an asset uploaded
|
|
1439
|
+
* before posters existed, or through the API where no browser saw the file.
|
|
1440
|
+
*
|
|
1441
|
+
* Only a browser can do this (see `video-metadata.ts`), so it happens here
|
|
1442
|
+
* rather than in a job. Three deliberate limits: only assets on the page in
|
|
1443
|
+
* front of the user, one at a time, and never the same asset twice — each
|
|
1444
|
+
* fetches part of a video and runs a decode, and thirty of those at once would
|
|
1445
|
+
* make opening the media library expensive.
|
|
1446
|
+
*/
|
|
1447
|
+
async function backfillPosters(candidates: Asset[]) {
|
|
1448
|
+
for (const asset of candidates) {
|
|
1449
|
+
if (posterAttempts.has(asset.id)) continue;
|
|
1450
|
+
posterAttempts.add(asset.id);
|
|
1451
|
+
try {
|
|
1452
|
+
const info = await extractVideoInfoFromUrl(getOriginalUrl(asset));
|
|
1453
|
+
// Audio yields a duration and no frame, which is still worth storing —
|
|
1454
|
+
// a WAV's length is exactly what the grid has no other way to show.
|
|
1455
|
+
if (!info.poster && info.duration == null) continue;
|
|
1456
|
+
await assets.uploadPoster(asset.id, info.poster, {
|
|
1457
|
+
duration: info.duration,
|
|
1458
|
+
width: info.width,
|
|
1459
|
+
height: info.height
|
|
1460
|
+
});
|
|
1461
|
+
// Patch in place rather than refetching the page: a background task
|
|
1462
|
+
// must not move the grid under someone mid-click.
|
|
1463
|
+
assetList = assetList.map((item) =>
|
|
1464
|
+
item.id === asset.id
|
|
1465
|
+
? {
|
|
1466
|
+
...item,
|
|
1467
|
+
width: info.width ?? item.width,
|
|
1468
|
+
height: info.height ?? item.height,
|
|
1469
|
+
metadata: {
|
|
1470
|
+
...(item.metadata ?? {}),
|
|
1471
|
+
poster: true,
|
|
1472
|
+
duration: info.duration ?? item.metadata?.duration
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
: item
|
|
1476
|
+
);
|
|
1477
|
+
} catch (err) {
|
|
1478
|
+
cmsLogger.debug('[Media]', 'Poster backfill skipped for', asset.id, err);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* Produce a poster for a video that has none — one uploaded before posters
|
|
1485
|
+
* existed, or through the API where no browser saw the file.
|
|
1486
|
+
*
|
|
1487
|
+
* Cheap only because the media route serves byte ranges: the browser fetches
|
|
1488
|
+
* the container header and the frames around the seek point rather than the
|
|
1489
|
+
* whole video.
|
|
1490
|
+
*/
|
|
1491
|
+
async function generatePoster(asset: Asset) {
|
|
1492
|
+
generatingPoster = true;
|
|
1493
|
+
try {
|
|
1494
|
+
const info = await extractVideoInfoFromUrl(getOriginalUrl(asset));
|
|
1495
|
+
if (!info.poster) {
|
|
1496
|
+
toast.error('Could not read a frame — this browser may not decode that codec');
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
await assets.uploadPoster(asset.id, info.poster, {
|
|
1500
|
+
duration: info.duration,
|
|
1501
|
+
width: info.width,
|
|
1502
|
+
height: info.height
|
|
1503
|
+
});
|
|
1504
|
+
toast.success('Poster generated');
|
|
1505
|
+
await fetchAssets(currentPage);
|
|
1506
|
+
// Re-read so the inspector's own copy carries metadata.poster.
|
|
1507
|
+
const refreshed = await assets.getById(asset.id);
|
|
1508
|
+
if (refreshed.success && refreshed.data) selectedAsset = refreshed.data;
|
|
1509
|
+
} catch (err) {
|
|
1510
|
+
cmsLogger.error('[Media]', 'Poster generation failed:', err);
|
|
1511
|
+
toast.error('Failed to save poster');
|
|
1512
|
+
} finally {
|
|
1513
|
+
generatingPoster = false;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
function getPosterUrl(asset: Asset): string | null {
|
|
1518
|
+
const hasPoster = (asset.metadata as { poster?: unknown } | null)?.poster === true;
|
|
1519
|
+
return hasPoster ? `/media/${asset.id}/poster.webp` : null;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
513
1522
|
function getThumbnailUrl(asset: Asset): string {
|
|
1523
|
+
return variantUrlAt(asset, (config) => thumbnailWidth(config, asset.width ?? null));
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* The asset's own URL — the file that was uploaded, at full size.
|
|
1528
|
+
*
|
|
1529
|
+
* Distinct from {@link getThumbnailUrl} on purpose. Copying a URL and
|
|
1530
|
+
* downloading a file both mean the *original*: handing someone a 320px webp
|
|
1531
|
+
* when they asked for the asset is a data-loss-shaped bug, even though
|
|
1532
|
+
* nothing errors.
|
|
1533
|
+
*/
|
|
1534
|
+
function getOriginalUrl(asset: Asset): string {
|
|
514
1535
|
return asset.url || `/media/${asset.id}/${asset.filename}`;
|
|
515
1536
|
}
|
|
516
1537
|
|
|
1538
|
+
/**
|
|
1539
|
+
* A derivative at the width `pick` chooses, or the original when the pipeline
|
|
1540
|
+
* is off or the asset can't be resized (SVG, animated). The variant route
|
|
1541
|
+
* serves the original for those anyway; naming it directly skips a pointless
|
|
1542
|
+
* generation attempt.
|
|
1543
|
+
*/
|
|
1544
|
+
function variantUrlAt(asset: Asset, pick: (config: ImageConfig) => number): string {
|
|
1545
|
+
if (!imageConfig || !canGenerateVariants(asset)) return getOriginalUrl(asset);
|
|
1546
|
+
return buildVariantUrl(asset.id, pick(imageConfig), imageConfig.configHash);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
/** Detail-pane preview: a panel-width rung, not a tile and not the original. */
|
|
1550
|
+
function getPreviewUrl(asset: Asset): string {
|
|
1551
|
+
return variantUrlAt(asset, (config) => {
|
|
1552
|
+
const widths = usableWidths(config, asset.width ?? null);
|
|
1553
|
+
return widths.find((w) => w >= 640) ?? widths[widths.length - 1]!;
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* Lightbox: the largest rung, not the original.
|
|
1559
|
+
*
|
|
1560
|
+
* "Enlarge" on a 14MB photograph should not mean downloading 14MB — the top
|
|
1561
|
+
* rung is already beyond any screen it will be shown on. `Download` is right
|
|
1562
|
+
* there for anyone who wants the actual file.
|
|
1563
|
+
*/
|
|
1564
|
+
function getLightboxUrl(asset: Asset): string {
|
|
1565
|
+
return variantUrlAt(asset, (config) => {
|
|
1566
|
+
const widths = usableWidths(config, asset.width ?? null);
|
|
1567
|
+
return widths[widths.length - 1]!;
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
|
|
517
1571
|
// Is image type
|
|
518
1572
|
function isImage(asset: Asset): boolean {
|
|
519
1573
|
return asset.assetType === 'image' || asset.mimeType.startsWith('image/');
|
|
520
1574
|
}
|
|
521
1575
|
|
|
1576
|
+
/**
|
|
1577
|
+
* Placeholder icon for an asset with no visual preview.
|
|
1578
|
+
*
|
|
1579
|
+
* Everything non-image used to fall through to one page icon, so an mp4, an
|
|
1580
|
+
* mp3 and a PDF were indistinguishable in the grid — most obvious once the
|
|
1581
|
+
* media-kind filter existed, where narrowing to "Video" produced a wall of
|
|
1582
|
+
* identical document icons.
|
|
1583
|
+
*/
|
|
1584
|
+
/**
|
|
1585
|
+
* Whether a tile should show the whole asset rather than fill its frame.
|
|
1586
|
+
*
|
|
1587
|
+
* `object-contain` everywhere honoured "don't crop the assets", but in a square
|
|
1588
|
+
* tile it pillarboxes every portrait photo, so the grid became mostly empty
|
|
1589
|
+
* background. The reason not to crop was logos and transparent artwork — a
|
|
1590
|
+
* wordmark cropped to a square is unrecognisable — and that reason doesn't
|
|
1591
|
+
* extend to photographs, where the tile is a recognition aid and the inspector
|
|
1592
|
+
* still shows the full uncropped image.
|
|
1593
|
+
*
|
|
1594
|
+
* SVG is the case we can detect from the mime type. Transparency in a PNG
|
|
1595
|
+
* isn't knowable without decoding the file, so PNGs are treated as artwork
|
|
1596
|
+
* too: over-containing a photo costs some whitespace, while over-cropping a
|
|
1597
|
+
* logo destroys it.
|
|
1598
|
+
*/
|
|
1599
|
+
/**
|
|
1600
|
+
* Turn a stored field path into something an editor recognises:
|
|
1601
|
+
* `coverImage` → "Cover image", `seo.ogImage` → "Seo › Og image",
|
|
1602
|
+
* `content[13].images[0]` → "Content 14 › Images 1".
|
|
1603
|
+
*
|
|
1604
|
+
* Indices are shown 1-based because they are being read by a person counting
|
|
1605
|
+
* items on a page, not by anything that will index back into the array.
|
|
1606
|
+
*/
|
|
1607
|
+
function humanizeFieldPath(path: string): string {
|
|
1608
|
+
return path
|
|
1609
|
+
.split('.')
|
|
1610
|
+
.map((segment) => {
|
|
1611
|
+
const match = /^(.*?)((\[\d+\])*)$/.exec(segment);
|
|
1612
|
+
const name = match?.[1] ?? segment;
|
|
1613
|
+
const indices = (match?.[2] ?? '')
|
|
1614
|
+
.match(/\d+/g)
|
|
1615
|
+
?.map((n) => ` ${Number(n) + 1}`)
|
|
1616
|
+
.join('');
|
|
1617
|
+
const label = name
|
|
1618
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
1619
|
+
.replace(/^./, (c) => c.toUpperCase())
|
|
1620
|
+
.toLowerCase()
|
|
1621
|
+
.replace(/^./, (c) => c.toUpperCase());
|
|
1622
|
+
return `${label}${indices ?? ''}`;
|
|
1623
|
+
})
|
|
1624
|
+
.join(' › ');
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
function isVectorOrTransparent(asset: Asset): boolean {
|
|
1628
|
+
const mime = asset.mimeType ?? '';
|
|
1629
|
+
return mime === 'image/svg+xml' || mime === 'image/png';
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
function isVideo(asset: Asset): boolean {
|
|
1633
|
+
return (asset.mimeType ?? '').startsWith('video/');
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
function isAudio(asset: Asset): boolean {
|
|
1637
|
+
return (asset.mimeType ?? '').startsWith('audio/');
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* Playable length, when we know it. Read from `metadata.duration` (seconds) —
|
|
1642
|
+
* the column set doesn't have a duration field, but `AssetMetadata` carries an
|
|
1643
|
+
* open index signature, so this needs no migration. It is only populated for
|
|
1644
|
+
* assets uploaded through the browser, which is where the duration can be read
|
|
1645
|
+
* off a `<video>` element; anything uploaded via the API has none, hence the
|
|
1646
|
+
* null return rather than a "0:00" that would look like an empty file.
|
|
1647
|
+
*/
|
|
1648
|
+
function formatDuration(asset: Asset): string | null {
|
|
1649
|
+
const seconds = Number((asset.metadata as { duration?: unknown } | null)?.duration);
|
|
1650
|
+
if (!Number.isFinite(seconds) || seconds <= 0) return null;
|
|
1651
|
+
const total = Math.round(seconds);
|
|
1652
|
+
const hours = Math.floor(total / 3600);
|
|
1653
|
+
const minutes = Math.floor((total % 3600) / 60);
|
|
1654
|
+
const secs = total % 60;
|
|
1655
|
+
return hours > 0
|
|
1656
|
+
? `${hours}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`
|
|
1657
|
+
: `${minutes}:${String(secs).padStart(2, '0')}`;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
function fileIconFor(mimeType: string | null | undefined) {
|
|
1661
|
+
const mime = mimeType ?? '';
|
|
1662
|
+
if (mime.startsWith('video/')) return Film;
|
|
1663
|
+
if (mime.startsWith('audio/')) return Music;
|
|
1664
|
+
if (mime.startsWith('image/')) return FileImage;
|
|
1665
|
+
if (/zip|tar|gzip|compressed|archive/.test(mime)) return FileArchive;
|
|
1666
|
+
return FileText;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
522
1669
|
// Compute visible page numbers (show up to 5 pages with ellipsis)
|
|
523
1670
|
const visiblePages = $derived.by(() => {
|
|
524
1671
|
const pages: (number | '...')[] = [];
|
|
@@ -547,33 +1694,84 @@
|
|
|
547
1694
|
: 'Name: Z-A'
|
|
548
1695
|
);
|
|
549
1696
|
|
|
550
|
-
|
|
1697
|
+
/**
|
|
1698
|
+
* Cycle the sort and refetch.
|
|
1699
|
+
*
|
|
1700
|
+
* The refetch is the point: the order is the server's now, so changing it
|
|
1701
|
+
* without asking for a new page would leave the previous ordering on screen
|
|
1702
|
+
* under a label claiming otherwise. Back to page 1 too — "page 3 of newest"
|
|
1703
|
+
* and "page 3 of A–Z" hold unrelated rows, so keeping the number would land
|
|
1704
|
+
* the user somewhere arbitrary.
|
|
1705
|
+
*/
|
|
551
1706
|
function cycleSort() {
|
|
552
1707
|
const orders: (typeof sortOrder)[] = ['newest', 'oldest', 'name-asc', 'name-desc'];
|
|
553
1708
|
const idx = orders.indexOf(sortOrder);
|
|
554
1709
|
sortOrder = orders[(idx + 1) % orders.length]!;
|
|
1710
|
+
currentPage = 1;
|
|
1711
|
+
fetchAssets(1);
|
|
555
1712
|
}
|
|
556
1713
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
1714
|
+
/**
|
|
1715
|
+
* The org the current `assetList` was loaded for, and whether a load has been
|
|
1716
|
+
* issued at all.
|
|
1717
|
+
*
|
|
1718
|
+
* `hasLoaded` is what makes the initial load explicit. Keying purely off
|
|
1719
|
+
* "`orgId` changed" made the first load depend on the URL gaining an `orgId`
|
|
1720
|
+
* that isn't there at mount: on a bare `/admin` the effect compared
|
|
1721
|
+
* `null !== null`, was false, and never fetched. It happens to work today only
|
|
1722
|
+
* because `OrganizationSwitcher` appends `orgId` via `replaceState` shortly
|
|
1723
|
+
* after mount, which flips the comparison — an accident of another component's
|
|
1724
|
+
* behaviour, not something this one should rely on.
|
|
1725
|
+
*
|
|
1726
|
+
* Neither is `$state`: they're written by the effect that reads them, so
|
|
1727
|
+
* making them reactive would re-trigger it for no reason.
|
|
1728
|
+
*/
|
|
1729
|
+
let hasLoaded = false;
|
|
1730
|
+
let currentOrgId: string | null = null;
|
|
1731
|
+
|
|
1732
|
+
// Previous value of `active`. `undefined` until the effect below has run once,
|
|
1733
|
+
// which lets that run seed rather than fire — the initial load belongs to the
|
|
1734
|
+
// org effect. Seeding it to `false` instead swallowed the *first* activation:
|
|
1735
|
+
// a browser mounted inactive never refetched when the user first switched to
|
|
1736
|
+
// it, so it showed whatever had been loaded at mount.
|
|
1737
|
+
let wasActive = $state<boolean | undefined>(undefined);
|
|
1738
|
+
|
|
1739
|
+
// Load once on mount, and again whenever the org actually changes.
|
|
564
1740
|
$effect(() => {
|
|
565
1741
|
const orgId = page.url.searchParams.get('orgId');
|
|
566
|
-
|
|
1742
|
+
|
|
1743
|
+
if (!hasLoaded) {
|
|
1744
|
+
hasLoaded = true;
|
|
567
1745
|
currentOrgId = orgId;
|
|
568
|
-
selectedAsset = null;
|
|
569
|
-
currentPage = 1;
|
|
570
1746
|
fetchAssets(1);
|
|
1747
|
+
return;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
// `null → id` is `OrganizationSwitcher` back-filling the URL just after
|
|
1751
|
+
// mount, not a switch. The list route scopes by the session's active
|
|
1752
|
+
// organization rather than this param, so the initial load already fetched
|
|
1753
|
+
// the right org — refetching here would be a duplicate round-trip on every
|
|
1754
|
+
// single mount. Adopt the id silently and wait for a real change.
|
|
1755
|
+
if (orgId === currentOrgId || currentOrgId === null) {
|
|
1756
|
+
currentOrgId = orgId;
|
|
1757
|
+
return;
|
|
571
1758
|
}
|
|
1759
|
+
|
|
1760
|
+
currentOrgId = orgId;
|
|
1761
|
+
selectedAsset = null;
|
|
1762
|
+
currentPage = 1;
|
|
1763
|
+
fetchAssets(1);
|
|
572
1764
|
});
|
|
573
1765
|
|
|
574
|
-
// Refetch
|
|
1766
|
+
// Refetch every time the tab becomes active.
|
|
1767
|
+
//
|
|
1768
|
+
// This is the only invalidation reference counts get (#233): they are fetched
|
|
1769
|
+
// solely as a follow-up to fetching a page of assets, and nothing signals the
|
|
1770
|
+
// media browser when a document edit adds or removes a reference. Re-entering
|
|
1771
|
+
// the tab is the moment the user expects to see the truth, so it must refetch
|
|
1772
|
+
// on *every* activation — including the first.
|
|
575
1773
|
$effect(() => {
|
|
576
|
-
if (active && wasActive) {
|
|
1774
|
+
if (wasActive !== undefined && active && !wasActive) {
|
|
577
1775
|
selectedAsset = null;
|
|
578
1776
|
fetchAssets();
|
|
579
1777
|
}
|
|
@@ -581,17 +1779,64 @@
|
|
|
581
1779
|
});
|
|
582
1780
|
</script>
|
|
583
1781
|
|
|
1782
|
+
<!--
|
|
1783
|
+
The selection checkbox, shared by every tile and row.
|
|
1784
|
+
|
|
1785
|
+
The capture-phase handler is what makes shift-click work on the checkbox
|
|
1786
|
+
itself and not just the tile around it: bits-ui's Checkbox fires
|
|
1787
|
+
`onCheckedChange` from its own click, so by the time the event bubbled out to
|
|
1788
|
+
us the single-item toggle had already happened and the range would have been
|
|
1789
|
+
computed against a selection that had moved underneath it. Intercepting in
|
|
1790
|
+
capture — only when Shift is held — stops the click before the checkbox ever
|
|
1791
|
+
sees it. Without Shift the event passes straight through, and the
|
|
1792
|
+
`stopPropagation` on the checkbox keeps it from also reaching the row.
|
|
1793
|
+
-->
|
|
1794
|
+
<!-- Stand-in for an asset with no visual preview. A snippet because `{@const}`
|
|
1795
|
+
has to be the immediate child of a block, and the icon component is chosen
|
|
1796
|
+
per mime type. -->
|
|
1797
|
+
{#snippet fileIcon(mimeType: string | null | undefined, sizeClass: string)}
|
|
1798
|
+
{@const Icon = fileIconFor(mimeType)}
|
|
1799
|
+
<Icon class="text-muted-foreground {sizeClass}" />
|
|
1800
|
+
{/snippet}
|
|
1801
|
+
|
|
1802
|
+
{#snippet selectCheckbox(asset: Asset)}
|
|
1803
|
+
<div
|
|
1804
|
+
onclickcapture={(e) => {
|
|
1805
|
+
if (!e.shiftKey) return;
|
|
1806
|
+
e.preventDefault();
|
|
1807
|
+
e.stopPropagation();
|
|
1808
|
+
selectRange(asset.id);
|
|
1809
|
+
}}
|
|
1810
|
+
>
|
|
1811
|
+
<Checkbox
|
|
1812
|
+
checked={selectedIds.has(asset.id)}
|
|
1813
|
+
onCheckedChange={() => handleSelectClick(asset.id, { shiftKey: false })}
|
|
1814
|
+
onclick={(e) => e.stopPropagation()}
|
|
1815
|
+
/>
|
|
1816
|
+
</div>
|
|
1817
|
+
{/snippet}
|
|
1818
|
+
|
|
584
1819
|
<div
|
|
585
1820
|
class="flex h-full flex-col"
|
|
586
1821
|
role="region"
|
|
1822
|
+
ondragenter={handleDragEnter}
|
|
587
1823
|
ondragover={handleDragOver}
|
|
588
1824
|
ondragleave={handleDragLeave}
|
|
1825
|
+
ondragend={handleDragEnd}
|
|
589
1826
|
ondrop={handleDrop}
|
|
590
1827
|
>
|
|
591
1828
|
<!-- Drag overlay -->
|
|
592
1829
|
{#if isDragging}
|
|
1830
|
+
<!--
|
|
1831
|
+
`pointer-events-none` is load-bearing, not cosmetic. The overlay appears
|
|
1832
|
+
directly under the cursor mid-drag, so without it the overlay becomes the
|
|
1833
|
+
drag target the moment it renders: that fires dragleave on the region,
|
|
1834
|
+
which hides the overlay, which puts the cursor back over the grid, which
|
|
1835
|
+
shows it again — a feedback loop running at pointer-move rate. The counter
|
|
1836
|
+
alone doesn't save you here, because these are real boundary crossings.
|
|
1837
|
+
-->
|
|
593
1838
|
<div
|
|
594
|
-
class="bg-primary/5 border-primary absolute inset-0 z-50 flex items-center justify-center border-2 border-dashed"
|
|
1839
|
+
class="bg-primary/5 border-primary pointer-events-none absolute inset-0 z-50 flex items-center justify-center border-2 border-dashed"
|
|
595
1840
|
>
|
|
596
1841
|
<div class="text-center">
|
|
597
1842
|
<Upload class="text-primary mx-auto mb-2 h-12 w-12" />
|
|
@@ -607,8 +1852,12 @@
|
|
|
607
1852
|
<Button
|
|
608
1853
|
size="sm"
|
|
609
1854
|
onclick={() => {
|
|
1855
|
+
// Deliberately does not clear the queue. Clicking outside the dialog
|
|
1856
|
+
// dismisses it, and wiping the list on reopen meant an accidental
|
|
1857
|
+
// click discarded a batch — including uploads still running, which
|
|
1858
|
+
// carry on regardless and were simply no longer visible. The queue is
|
|
1859
|
+
// cleared only on an explicit Clear list or Done.
|
|
610
1860
|
showUploadModal = true;
|
|
611
|
-
uploadQueue = [];
|
|
612
1861
|
}}
|
|
613
1862
|
>
|
|
614
1863
|
<Upload size={16} class="sm:mr-2" />
|
|
@@ -638,25 +1887,75 @@
|
|
|
638
1887
|
{/if}
|
|
639
1888
|
<div class="hidden flex-1 sm:block"></div>
|
|
640
1889
|
|
|
641
|
-
<!--
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
1890
|
+
<!-- Media kind. Filtering happens in SQL, so it narrows the whole library
|
|
1891
|
+
rather than the loaded page. -->
|
|
1892
|
+
<select
|
|
1893
|
+
value={categoryFilter}
|
|
1894
|
+
onchange={(e) => {
|
|
1895
|
+
categoryFilter = (e.target as HTMLSelectElement).value as CategoryFilter;
|
|
1896
|
+
currentPage = 1;
|
|
1897
|
+
fetchAssets(1);
|
|
1898
|
+
}}
|
|
1899
|
+
aria-label="Filter by media type"
|
|
1900
|
+
class="border-input bg-background text-foreground hidden h-7 rounded-md border px-1.5 text-xs sm:block"
|
|
1901
|
+
>
|
|
1902
|
+
<option value="all">All types</option>
|
|
1903
|
+
<option value="image">Images</option>
|
|
1904
|
+
<option value="svg">SVG</option>
|
|
1905
|
+
<option value="video">Video</option>
|
|
1906
|
+
<option value="audio">Audio</option>
|
|
1907
|
+
<option value="document">Documents</option>
|
|
1908
|
+
</select>
|
|
1909
|
+
|
|
1910
|
+
{#if usageIndexing}
|
|
1911
|
+
<span
|
|
1912
|
+
class="text-muted-foreground hidden items-center gap-1.5 text-xs sm:inline-flex"
|
|
1913
|
+
title="Building the reference index. Usage results are incomplete until it finishes."
|
|
652
1914
|
>
|
|
653
|
-
<
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
1915
|
+
<span
|
|
1916
|
+
class="border-muted-foreground/40 h-3 w-3 animate-spin rounded-full border-2 border-t-transparent"
|
|
1917
|
+
></span>
|
|
1918
|
+
Indexing usage…
|
|
1919
|
+
</span>
|
|
1920
|
+
{/if}
|
|
1921
|
+
|
|
1922
|
+
<!-- Used / unused. The actionable half is "Unused": it is how a library gets
|
|
1923
|
+
cleaned up, and it only became answerable once references were indexed. -->
|
|
1924
|
+
<select
|
|
1925
|
+
value={usageFilter}
|
|
1926
|
+
onchange={(e) => {
|
|
1927
|
+
usageFilter = (e.target as HTMLSelectElement).value as UsageFilter;
|
|
1928
|
+
currentPage = 1;
|
|
1929
|
+
fetchAssets(1);
|
|
1930
|
+
}}
|
|
1931
|
+
aria-label="Filter by usage"
|
|
1932
|
+
class="border-input bg-background text-foreground hidden h-7 rounded-md border px-1.5 text-xs sm:block"
|
|
1933
|
+
>
|
|
1934
|
+
<option value="all">All assets</option>
|
|
1935
|
+
<option value="in-use">In use</option>
|
|
1936
|
+
<option value="unused">Unused</option>
|
|
1937
|
+
</select>
|
|
1938
|
+
|
|
1939
|
+
<!-- Grid density. Replaces the page-size select, which cost permanent
|
|
1940
|
+
toolbar space to answer a question editors rarely have — how many
|
|
1941
|
+
assets fit on a page matters far less than whether they can tell one
|
|
1942
|
+
thumbnail from another. Grid only; the list view has a fixed row. -->
|
|
1943
|
+
{#if viewMode === 'grid'}
|
|
1944
|
+
<div class="bg-muted hidden items-center rounded-md p-0.5 sm:flex">
|
|
1945
|
+
{#each [{ id: 'compact' as const, label: 'Compact' }, { id: 'default' as const, label: 'Default' }, { id: 'large' as const, label: 'Large' }] as option (option.id)}
|
|
1946
|
+
<button
|
|
1947
|
+
onclick={() => (gridDensity = option.id)}
|
|
1948
|
+
title="{option.label} thumbnails"
|
|
1949
|
+
aria-pressed={gridDensity === option.id}
|
|
1950
|
+
class="rounded px-2 py-1 text-xs transition-colors {gridDensity === option.id
|
|
1951
|
+
? 'bg-background text-foreground shadow-sm'
|
|
1952
|
+
: 'text-muted-foreground hover:text-foreground'}"
|
|
1953
|
+
>
|
|
1954
|
+
{option.label}
|
|
1955
|
+
</button>
|
|
1956
|
+
{/each}
|
|
1957
|
+
</div>
|
|
1958
|
+
{/if}
|
|
660
1959
|
|
|
661
1960
|
<!-- View toggle -->
|
|
662
1961
|
<div class="bg-muted flex items-center rounded-md p-0.5">
|
|
@@ -711,11 +2010,27 @@
|
|
|
711
2010
|
<svelte:boundary
|
|
712
2011
|
onerror={(error) => cmsLogger.error('[MediaBrowser]', 'Render error:', error)}
|
|
713
2012
|
>
|
|
714
|
-
{#if
|
|
2013
|
+
{#if showAccessDenied}
|
|
2014
|
+
<div class="flex h-full flex-col items-center justify-center gap-4">
|
|
2015
|
+
<div class="bg-muted/50 flex h-16 w-16 items-center justify-center rounded-full">
|
|
2016
|
+
<Lock class="text-muted-foreground h-8 w-8" />
|
|
2017
|
+
</div>
|
|
2018
|
+
<div class="text-center">
|
|
2019
|
+
<h3 class="mb-1 font-medium">No access to media</h3>
|
|
2020
|
+
<p class="text-muted-foreground text-sm">
|
|
2021
|
+
Your role doesn't include permission to view assets.
|
|
2022
|
+
</p>
|
|
2023
|
+
</div>
|
|
2024
|
+
</div>
|
|
2025
|
+
{:else if loading && assetList.length === 0}
|
|
715
2026
|
<div class="flex h-full items-center justify-center">
|
|
716
2027
|
<p class="text-muted-foreground">Loading assets...</p>
|
|
717
2028
|
</div>
|
|
718
|
-
|
|
2029
|
+
<!-- `orderedAssets`, not `sortedAssets`: on a page where every asset is
|
|
2030
|
+
already selected, `sortedAssets` is empty and the pinned list holds
|
|
2031
|
+
all of them — this branch would have replaced those tiles with
|
|
2032
|
+
"No assets found". -->
|
|
2033
|
+
{:else if orderedAssets.length === 0}
|
|
719
2034
|
<div class="flex h-full flex-col items-center justify-center gap-4">
|
|
720
2035
|
<div class="bg-muted/50 flex h-16 w-16 items-center justify-center rounded-full">
|
|
721
2036
|
<ImageIcon class="text-muted-foreground h-8 w-8" />
|
|
@@ -730,118 +2045,279 @@
|
|
|
730
2045
|
</div>
|
|
731
2046
|
</div>
|
|
732
2047
|
{:else}
|
|
733
|
-
<!-- Bulk action bar (shared for grid and list)
|
|
2048
|
+
<!-- Bulk action bar (shared for grid and list).
|
|
2049
|
+
Select-all lives here rather than only in the list header, which
|
|
2050
|
+
is where it used to be — the grid is the view people actually
|
|
2051
|
+
bulk-select in, and it had no way to do it at all.
|
|
2052
|
+
|
|
2053
|
+
`sticky top-0` against the scroll container: selecting is the one
|
|
2054
|
+
task here that involves scrolling far from the controls, so a bar
|
|
2055
|
+
that scrolls away strands the selection — you have to scroll back
|
|
2056
|
+
to act on it, and the running count is invisible while you build
|
|
2057
|
+
it. The opaque `bg-muted` is what keeps it legible over the tiles
|
|
2058
|
+
passing underneath. -->
|
|
734
2059
|
{#if selectable && multiSelect}
|
|
735
|
-
<div
|
|
2060
|
+
<div
|
|
2061
|
+
class="bg-muted border-border sticky top-0 z-20 flex items-center gap-3 border-b px-4 py-2"
|
|
2062
|
+
>
|
|
736
2063
|
<span class="text-sm font-medium">
|
|
737
2064
|
{selectedIds.size} selected
|
|
738
2065
|
</span>
|
|
2066
|
+
<button
|
|
2067
|
+
onclick={toggleSelectAll}
|
|
2068
|
+
class="text-muted-foreground hover:text-foreground text-sm transition-colors"
|
|
2069
|
+
>
|
|
2070
|
+
{allSelected ? 'Deselect page' : 'Select page'}
|
|
2071
|
+
</button>
|
|
2072
|
+
<span class="text-muted-foreground hidden text-xs lg:inline">
|
|
2073
|
+
Shift-click to extend a range
|
|
2074
|
+
</span>
|
|
2075
|
+
<div class="flex-1"></div>
|
|
739
2076
|
<Button variant="default" size="sm" onclick={confirmMultiSelect}>Done</Button>
|
|
740
2077
|
</div>
|
|
741
|
-
{:else if
|
|
742
|
-
<div
|
|
2078
|
+
{:else if isSelectMode}
|
|
2079
|
+
<div
|
|
2080
|
+
class="bg-muted border-border sticky top-0 z-20 flex items-center gap-3 border-b px-4 py-2"
|
|
2081
|
+
>
|
|
743
2082
|
<span class="text-sm font-medium">
|
|
744
2083
|
{selectedIds.size} selected
|
|
745
2084
|
</span>
|
|
746
|
-
{#if canDeleteAssets}
|
|
747
|
-
<Button
|
|
748
|
-
variant="destructive"
|
|
749
|
-
size="sm"
|
|
750
|
-
onclick={bulkDelete}
|
|
751
|
-
disabled={isBulkDeleting}
|
|
752
|
-
>
|
|
753
|
-
<Trash2 size={14} class="mr-1.5" />
|
|
754
|
-
{isBulkDeleting ? 'Deleting...' : 'Delete'}
|
|
755
|
-
</Button>
|
|
756
|
-
{/if}
|
|
757
2085
|
<button
|
|
758
|
-
onclick={
|
|
2086
|
+
onclick={toggleSelectAll}
|
|
759
2087
|
class="text-muted-foreground hover:text-foreground text-sm transition-colors"
|
|
760
2088
|
>
|
|
761
|
-
|
|
2089
|
+
{allSelected ? 'Deselect page' : 'Select page'}
|
|
762
2090
|
</button>
|
|
2091
|
+
{#if selectedIds.size > 0}
|
|
2092
|
+
{#if canDeleteAssets}
|
|
2093
|
+
<Button
|
|
2094
|
+
variant="destructive"
|
|
2095
|
+
size="sm"
|
|
2096
|
+
onclick={bulkDelete}
|
|
2097
|
+
disabled={isBulkDeleting}
|
|
2098
|
+
>
|
|
2099
|
+
<Trash2 size={14} class="mr-1.5" />
|
|
2100
|
+
{isBulkDeleting ? 'Deleting...' : 'Delete'}
|
|
2101
|
+
</Button>
|
|
2102
|
+
{/if}
|
|
2103
|
+
<button
|
|
2104
|
+
onclick={clearSelection}
|
|
2105
|
+
class="text-muted-foreground hover:text-foreground text-sm transition-colors"
|
|
2106
|
+
>
|
|
2107
|
+
Clear selection
|
|
2108
|
+
</button>
|
|
2109
|
+
{/if}
|
|
2110
|
+
<div class="flex-1"></div>
|
|
2111
|
+
<span class="text-muted-foreground hidden text-xs lg:inline">
|
|
2112
|
+
Shift-click to extend a range
|
|
2113
|
+
</span>
|
|
763
2114
|
</div>
|
|
764
2115
|
{/if}
|
|
765
2116
|
{#if viewMode === 'grid'}
|
|
766
2117
|
<!-- Grid View -->
|
|
767
|
-
|
|
2118
|
+
<!-- `select-none`: shift-click is a selection gesture here, and
|
|
2119
|
+
without it the browser also drags a blue text highlight across
|
|
2120
|
+
every filename in the range. -->
|
|
2121
|
+
<div
|
|
2122
|
+
class="grid gap-3 p-3 select-none"
|
|
2123
|
+
style="grid-template-columns: repeat(auto-fill, minmax({TILE_MIN_WIDTH[
|
|
2124
|
+
gridDensity
|
|
2125
|
+
]}px, 1fr));"
|
|
2126
|
+
>
|
|
768
2127
|
{#each pinnedAssets as asset (asset.id)}
|
|
769
2128
|
<button
|
|
770
|
-
onclick={() => {
|
|
2129
|
+
onclick={(e) => {
|
|
771
2130
|
if (selectable && multiSelect) {
|
|
772
|
-
|
|
2131
|
+
handleSelectClick(asset.id, e);
|
|
773
2132
|
} else {
|
|
774
2133
|
openAssetDetail(asset);
|
|
775
2134
|
}
|
|
776
2135
|
}}
|
|
777
|
-
class="group relative flex flex-col overflow-hidden rounded-
|
|
2136
|
+
class="group border-border bg-card relative flex flex-col overflow-hidden rounded-md border text-left transition-all {selectedIds.has(
|
|
778
2137
|
asset.id
|
|
779
2138
|
)
|
|
780
|
-
? 'ring-primary ring-2'
|
|
2139
|
+
? 'border-primary ring-primary/40 ring-2'
|
|
781
2140
|
: selectedAsset?.id === asset.id
|
|
782
|
-
? 'ring-primary ring-2'
|
|
783
|
-
: 'hover:
|
|
2141
|
+
? 'border-primary ring-primary/40 ring-2'
|
|
2142
|
+
: 'hover:border-muted-foreground/40 hover:shadow-sm'}"
|
|
784
2143
|
>
|
|
785
2144
|
<div class="bg-muted/30 relative aspect-square overflow-hidden">
|
|
2145
|
+
<!-- Private assets are marked, because nothing else on the tile
|
|
2146
|
+
distinguishes one. Privacy is declared on a schema field rather
|
|
2147
|
+
than chosen here, so without a badge an editor has no way to see
|
|
2148
|
+
which assets a `private: true` actually covers — and the honest
|
|
2149
|
+
answer (only those uploaded through that field) is surprising.
|
|
2150
|
+
Read-only: it reports the schema's decision rather than offering
|
|
2151
|
+
to change it. -->
|
|
2152
|
+
{#if asset.isPrivate}
|
|
2153
|
+
<span
|
|
2154
|
+
class="pointer-events-none absolute top-1.5 left-1.5 z-10 flex h-5 w-5 items-center justify-center rounded-full bg-black/70"
|
|
2155
|
+
title="Private — needs a session or a signed URL"
|
|
2156
|
+
>
|
|
2157
|
+
<Lock class="h-3 w-3 text-white" />
|
|
2158
|
+
</span>
|
|
2159
|
+
{/if}
|
|
2160
|
+
<!-- Playable media reads as playable at a glance. Without this a
|
|
2161
|
+
video and a PDF differ only by a small glyph, which the
|
|
2162
|
+
media-kind filter made obvious: narrowing to Video produced a
|
|
2163
|
+
grid of near-identical cards. -->
|
|
2164
|
+
{#if isVideo(asset) || isAudio(asset)}
|
|
2165
|
+
{@const duration = formatDuration(asset)}
|
|
2166
|
+
<!-- The play glyph belongs over a picture, where it says "this
|
|
2167
|
+
still is a video". Over the placeholder icon used for audio, or
|
|
2168
|
+
for a video with no poster yet, it stacks a second symbol on a
|
|
2169
|
+
first — which is what made a WAV tile look cluttered. -->
|
|
2170
|
+
{#if getPosterUrl(asset)}
|
|
2171
|
+
<div
|
|
2172
|
+
class="pointer-events-none absolute inset-0 z-10 flex items-center justify-center"
|
|
2173
|
+
>
|
|
2174
|
+
<span
|
|
2175
|
+
class="flex h-9 w-9 items-center justify-center rounded-full bg-black/45 backdrop-blur-[1px]"
|
|
2176
|
+
>
|
|
2177
|
+
<Play class="h-4 w-4 translate-x-[1px] fill-white text-white" />
|
|
2178
|
+
</span>
|
|
2179
|
+
</div>
|
|
2180
|
+
{/if}
|
|
2181
|
+
{#if duration}
|
|
2182
|
+
<span
|
|
2183
|
+
class="pointer-events-none absolute right-1.5 bottom-1.5 z-10 rounded-sm bg-black/70 px-1 py-0.5 text-[10px] font-medium text-white tabular-nums"
|
|
2184
|
+
>
|
|
2185
|
+
{duration}
|
|
2186
|
+
</span>
|
|
2187
|
+
{/if}
|
|
2188
|
+
{/if}
|
|
786
2189
|
{#if isImage(asset)}
|
|
787
|
-
<
|
|
2190
|
+
<AssetImage
|
|
788
2191
|
src={getThumbnailUrl(asset)}
|
|
789
2192
|
alt={asset.alt || asset.originalFilename}
|
|
790
|
-
|
|
2193
|
+
mimeType={asset.mimeType}
|
|
2194
|
+
class="h-full w-full {isVectorOrTransparent(asset)
|
|
2195
|
+
? 'object-contain p-3'
|
|
2196
|
+
: 'object-cover'}"
|
|
2197
|
+
loading="lazy"
|
|
2198
|
+
/>
|
|
2199
|
+
{:else if getPosterUrl(asset)}
|
|
2200
|
+
<!-- A frame extracted at upload. Cropped like a photo: it is a
|
|
2201
|
+
still from a rectangular video, not artwork with edges to
|
|
2202
|
+
preserve. -->
|
|
2203
|
+
<AssetImage
|
|
2204
|
+
src={getPosterUrl(asset)}
|
|
2205
|
+
alt={asset.alt || asset.originalFilename}
|
|
2206
|
+
class="h-full w-full object-cover"
|
|
791
2207
|
loading="lazy"
|
|
792
2208
|
/>
|
|
793
2209
|
{:else}
|
|
794
2210
|
<div class="flex h-full items-center justify-center">
|
|
795
|
-
|
|
2211
|
+
{@render fileIcon(
|
|
2212
|
+
asset.mimeType,
|
|
2213
|
+
'h-1/3 w-1/3 min-h-8 min-w-8 max-h-20 max-w-20'
|
|
2214
|
+
)}
|
|
796
2215
|
</div>
|
|
797
2216
|
{/if}
|
|
798
2217
|
{#if isSelectMode && !selectable}
|
|
799
2218
|
<div class="absolute top-1.5 left-1.5">
|
|
800
|
-
|
|
801
|
-
checked={selectedIds.has(asset.id)}
|
|
802
|
-
onCheckedChange={() => toggleSelect(asset.id)}
|
|
803
|
-
onclick={(e) => e.stopPropagation()}
|
|
804
|
-
/>
|
|
2219
|
+
{@render selectCheckbox(asset)}
|
|
805
2220
|
</div>
|
|
806
2221
|
{/if}
|
|
807
2222
|
</div>
|
|
808
|
-
<div class="
|
|
809
|
-
<p class="text-
|
|
2223
|
+
<div class="border-border min-w-0 border-t px-2 py-1.5">
|
|
2224
|
+
<p class="text-foreground truncate text-xs" title={asset.originalFilename}>
|
|
810
2225
|
{asset.originalFilename}
|
|
811
2226
|
</p>
|
|
2227
|
+
<p class="text-muted-foreground truncate text-[11px]">
|
|
2228
|
+
{assetMetaLine(asset)}
|
|
2229
|
+
</p>
|
|
812
2230
|
</div>
|
|
813
2231
|
</button>
|
|
814
2232
|
{/each}
|
|
815
2233
|
{#each sortedAssets as asset (asset.id)}
|
|
816
2234
|
<button
|
|
817
|
-
onclick={() => {
|
|
818
|
-
if (
|
|
819
|
-
|
|
820
|
-
} else if (isSelectMode) {
|
|
821
|
-
toggleSelect(asset.id);
|
|
2235
|
+
onclick={(e) => {
|
|
2236
|
+
if (isSelectMode) {
|
|
2237
|
+
handleSelectClick(asset.id, e);
|
|
822
2238
|
} else {
|
|
823
2239
|
openAssetDetail(asset);
|
|
824
2240
|
}
|
|
825
2241
|
}}
|
|
826
|
-
class="group relative flex flex-col overflow-hidden rounded-
|
|
2242
|
+
class="group border-border bg-card relative flex flex-col overflow-hidden rounded-md border text-left transition-all {selectedIds.has(
|
|
827
2243
|
asset.id
|
|
828
2244
|
)
|
|
829
|
-
? 'ring-primary ring-2'
|
|
2245
|
+
? 'border-primary ring-primary/40 ring-2'
|
|
830
2246
|
: selectedAsset?.id === asset.id
|
|
831
|
-
? 'ring-primary ring-2'
|
|
832
|
-
: 'hover:
|
|
2247
|
+
? 'border-primary ring-primary/40 ring-2'
|
|
2248
|
+
: 'hover:border-muted-foreground/40 hover:shadow-sm'}"
|
|
833
2249
|
>
|
|
834
2250
|
<div class="bg-muted/30 relative aspect-square overflow-hidden">
|
|
2251
|
+
<!-- Private assets are marked, because nothing else on the tile
|
|
2252
|
+
distinguishes one. Privacy is declared on a schema field rather
|
|
2253
|
+
than chosen here, so without a badge an editor has no way to see
|
|
2254
|
+
which assets a `private: true` actually covers — and the honest
|
|
2255
|
+
answer (only those uploaded through that field) is surprising.
|
|
2256
|
+
Read-only: it reports the schema's decision rather than offering
|
|
2257
|
+
to change it. -->
|
|
2258
|
+
{#if asset.isPrivate}
|
|
2259
|
+
<span
|
|
2260
|
+
class="pointer-events-none absolute top-1.5 left-1.5 z-10 flex h-5 w-5 items-center justify-center rounded-full bg-black/70"
|
|
2261
|
+
title="Private — needs a session or a signed URL"
|
|
2262
|
+
>
|
|
2263
|
+
<Lock class="h-3 w-3 text-white" />
|
|
2264
|
+
</span>
|
|
2265
|
+
{/if}
|
|
2266
|
+
<!-- Playable media reads as playable at a glance. Without this a
|
|
2267
|
+
video and a PDF differ only by a small glyph, which the
|
|
2268
|
+
media-kind filter made obvious: narrowing to Video produced a
|
|
2269
|
+
grid of near-identical cards. -->
|
|
2270
|
+
{#if isVideo(asset) || isAudio(asset)}
|
|
2271
|
+
{@const duration = formatDuration(asset)}
|
|
2272
|
+
<!-- The play glyph belongs over a picture, where it says "this
|
|
2273
|
+
still is a video". Over the placeholder icon used for audio, or
|
|
2274
|
+
for a video with no poster yet, it stacks a second symbol on a
|
|
2275
|
+
first — which is what made a WAV tile look cluttered. -->
|
|
2276
|
+
{#if getPosterUrl(asset)}
|
|
2277
|
+
<div
|
|
2278
|
+
class="pointer-events-none absolute inset-0 z-10 flex items-center justify-center"
|
|
2279
|
+
>
|
|
2280
|
+
<span
|
|
2281
|
+
class="flex h-9 w-9 items-center justify-center rounded-full bg-black/45 backdrop-blur-[1px]"
|
|
2282
|
+
>
|
|
2283
|
+
<Play class="h-4 w-4 translate-x-[1px] fill-white text-white" />
|
|
2284
|
+
</span>
|
|
2285
|
+
</div>
|
|
2286
|
+
{/if}
|
|
2287
|
+
{#if duration}
|
|
2288
|
+
<span
|
|
2289
|
+
class="pointer-events-none absolute right-1.5 bottom-1.5 z-10 rounded-sm bg-black/70 px-1 py-0.5 text-[10px] font-medium text-white tabular-nums"
|
|
2290
|
+
>
|
|
2291
|
+
{duration}
|
|
2292
|
+
</span>
|
|
2293
|
+
{/if}
|
|
2294
|
+
{/if}
|
|
835
2295
|
{#if isImage(asset)}
|
|
836
|
-
<
|
|
2296
|
+
<AssetImage
|
|
837
2297
|
src={getThumbnailUrl(asset)}
|
|
838
2298
|
alt={asset.alt || asset.originalFilename}
|
|
839
|
-
|
|
2299
|
+
mimeType={asset.mimeType}
|
|
2300
|
+
class="h-full w-full {isVectorOrTransparent(asset)
|
|
2301
|
+
? 'object-contain p-3'
|
|
2302
|
+
: 'object-cover'}"
|
|
2303
|
+
loading="lazy"
|
|
2304
|
+
/>
|
|
2305
|
+
{:else if getPosterUrl(asset)}
|
|
2306
|
+
<!-- A frame extracted at upload. Cropped like a photo: it is a
|
|
2307
|
+
still from a rectangular video, not artwork with edges to
|
|
2308
|
+
preserve. -->
|
|
2309
|
+
<AssetImage
|
|
2310
|
+
src={getPosterUrl(asset)}
|
|
2311
|
+
alt={asset.alt || asset.originalFilename}
|
|
2312
|
+
class="h-full w-full object-cover"
|
|
840
2313
|
loading="lazy"
|
|
841
2314
|
/>
|
|
842
2315
|
{:else}
|
|
843
2316
|
<div class="flex h-full items-center justify-center">
|
|
844
|
-
|
|
2317
|
+
{@render fileIcon(
|
|
2318
|
+
asset.mimeType,
|
|
2319
|
+
'h-1/3 w-1/3 min-h-8 min-w-8 max-h-20 max-w-20'
|
|
2320
|
+
)}
|
|
845
2321
|
</div>
|
|
846
2322
|
{/if}
|
|
847
2323
|
{#if selectable}
|
|
@@ -876,21 +2352,36 @@
|
|
|
876
2352
|
/>
|
|
877
2353
|
</svg>
|
|
878
2354
|
</div>
|
|
879
|
-
{:else if isSelectMode}
|
|
880
|
-
<!--
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
2355
|
+
{:else if isSelectMode || canDeleteAssets}
|
|
2356
|
+
<!--
|
|
2357
|
+
Checkbox overlay. Revealed on hover when not yet in select
|
|
2358
|
+
mode, which gives the grid the same way in as the list —
|
|
2359
|
+
whose checkboxes are always visible. Before this, starting a
|
|
2360
|
+
selection from the grid meant knowing that the toolbar's
|
|
2361
|
+
icon button existed, and the grid is where a page of
|
|
2362
|
+
thumbnails is actually triaged.
|
|
2363
|
+
|
|
2364
|
+
Gated on `canDeleteAssets` for the same reason that button
|
|
2365
|
+
is: with no bulk action available, a selection has nowhere
|
|
2366
|
+
to go.
|
|
2367
|
+
-->
|
|
2368
|
+
<div
|
|
2369
|
+
class="absolute top-1.5 left-1.5 transition-opacity {isSelectMode ||
|
|
2370
|
+
selectedIds.has(asset.id)
|
|
2371
|
+
? 'opacity-100'
|
|
2372
|
+
: 'opacity-0 group-hover:opacity-100 focus-within:opacity-100'}"
|
|
2373
|
+
>
|
|
2374
|
+
{@render selectCheckbox(asset)}
|
|
887
2375
|
</div>
|
|
888
2376
|
{/if}
|
|
889
2377
|
</div>
|
|
890
|
-
<div class="
|
|
891
|
-
<p class="text-
|
|
2378
|
+
<div class="border-border min-w-0 border-t px-2 py-1.5">
|
|
2379
|
+
<p class="text-foreground truncate text-xs" title={asset.originalFilename}>
|
|
892
2380
|
{asset.originalFilename}
|
|
893
2381
|
</p>
|
|
2382
|
+
<p class="text-muted-foreground truncate text-[11px]">
|
|
2383
|
+
{assetMetaLine(asset)}
|
|
2384
|
+
</p>
|
|
894
2385
|
</div>
|
|
895
2386
|
</button>
|
|
896
2387
|
{/each}
|
|
@@ -933,7 +2424,7 @@
|
|
|
933
2424
|
{/if}
|
|
934
2425
|
{:else}
|
|
935
2426
|
<!-- List View -->
|
|
936
|
-
<div class="w-full">
|
|
2427
|
+
<div class="w-full select-none">
|
|
937
2428
|
<!-- Table header -->
|
|
938
2429
|
<div
|
|
939
2430
|
class="bg-muted/30 border-border text-muted-foreground hidden items-center gap-4 border-b px-4 py-2 text-xs font-medium tracking-wider uppercase md:grid md:grid-cols-[auto_40px_1fr_100px_100px_80px_50px_100px]"
|
|
@@ -958,14 +2449,20 @@
|
|
|
958
2449
|
</div>
|
|
959
2450
|
<div>Assets</div>
|
|
960
2451
|
</div>
|
|
961
|
-
|
|
2452
|
+
<!-- `orderedAssets`, not `sortedAssets`: in multi-select picker mode
|
|
2453
|
+
the already-selected assets are filtered out of `sortedAssets`
|
|
2454
|
+
and rendered separately as pinned tiles — which the list view
|
|
2455
|
+
never rendered. The images already in the field were therefore
|
|
2456
|
+
invisible here, and so impossible to deselect without switching
|
|
2457
|
+
to grid. -->
|
|
2458
|
+
{#each orderedAssets as asset (asset.id)}
|
|
962
2459
|
<!-- Desktop row -->
|
|
963
2460
|
<button
|
|
964
|
-
onclick={() => {
|
|
2461
|
+
onclick={(e) => {
|
|
965
2462
|
if (selectable && multiSelect) {
|
|
966
2463
|
openAssetDetail(asset);
|
|
967
2464
|
} else if (isSelectMode) {
|
|
968
|
-
|
|
2465
|
+
handleSelectClick(asset.id, e);
|
|
969
2466
|
} else if (selectable && onSelect) {
|
|
970
2467
|
onSelect(asset);
|
|
971
2468
|
} else {
|
|
@@ -980,23 +2477,30 @@
|
|
|
980
2477
|
: 'hover:bg-muted/50'}"
|
|
981
2478
|
>
|
|
982
2479
|
<div class="w-4">
|
|
983
|
-
|
|
984
|
-
checked={selectedIds.has(asset.id)}
|
|
985
|
-
onCheckedChange={() => toggleSelect(asset.id)}
|
|
986
|
-
onclick={(e) => e.stopPropagation()}
|
|
987
|
-
/>
|
|
2480
|
+
{@render selectCheckbox(asset)}
|
|
988
2481
|
</div>
|
|
989
2482
|
<div class="bg-muted/30 h-10 w-10 overflow-hidden rounded">
|
|
990
2483
|
{#if isImage(asset)}
|
|
991
|
-
<
|
|
2484
|
+
<AssetImage
|
|
992
2485
|
src={getThumbnailUrl(asset)}
|
|
993
2486
|
alt={asset.alt || asset.originalFilename}
|
|
2487
|
+
mimeType={asset.mimeType}
|
|
2488
|
+
class="h-full w-full object-cover"
|
|
2489
|
+
loading="lazy"
|
|
2490
|
+
/>
|
|
2491
|
+
{:else if getPosterUrl(asset)}
|
|
2492
|
+
<!-- Same poster the grid uses. The list had only the placeholder
|
|
2493
|
+
icon branch, so a video with a perfectly good frame still
|
|
2494
|
+
rendered as a generic film glyph here. -->
|
|
2495
|
+
<AssetImage
|
|
2496
|
+
src={getPosterUrl(asset)}
|
|
2497
|
+
alt={asset.alt || asset.originalFilename}
|
|
994
2498
|
class="h-full w-full object-cover"
|
|
995
2499
|
loading="lazy"
|
|
996
2500
|
/>
|
|
997
2501
|
{:else}
|
|
998
2502
|
<div class="flex h-full items-center justify-center">
|
|
999
|
-
|
|
2503
|
+
{@render fileIcon(asset.mimeType, 'h-4 w-4')}
|
|
1000
2504
|
</div>
|
|
1001
2505
|
{/if}
|
|
1002
2506
|
</div>
|
|
@@ -1015,11 +2519,11 @@
|
|
|
1015
2519
|
</button>
|
|
1016
2520
|
<!-- Mobile row -->
|
|
1017
2521
|
<button
|
|
1018
|
-
onclick={() => {
|
|
2522
|
+
onclick={(e) => {
|
|
1019
2523
|
if (selectable && multiSelect) {
|
|
1020
2524
|
openAssetDetail(asset);
|
|
1021
2525
|
} else if (isSelectMode) {
|
|
1022
|
-
|
|
2526
|
+
handleSelectClick(asset.id, e);
|
|
1023
2527
|
} else if (selectable && onSelect) {
|
|
1024
2528
|
onSelect(asset);
|
|
1025
2529
|
} else {
|
|
@@ -1034,23 +2538,30 @@
|
|
|
1034
2538
|
: 'hover:bg-muted/50'}"
|
|
1035
2539
|
>
|
|
1036
2540
|
<div class="w-4">
|
|
1037
|
-
|
|
1038
|
-
checked={selectedIds.has(asset.id)}
|
|
1039
|
-
onCheckedChange={() => toggleSelect(asset.id)}
|
|
1040
|
-
onclick={(e) => e.stopPropagation()}
|
|
1041
|
-
/>
|
|
2541
|
+
{@render selectCheckbox(asset)}
|
|
1042
2542
|
</div>
|
|
1043
2543
|
<div class="bg-muted/30 h-10 w-10 shrink-0 overflow-hidden rounded">
|
|
1044
2544
|
{#if isImage(asset)}
|
|
1045
|
-
<
|
|
2545
|
+
<AssetImage
|
|
1046
2546
|
src={getThumbnailUrl(asset)}
|
|
1047
2547
|
alt={asset.alt || asset.originalFilename}
|
|
2548
|
+
mimeType={asset.mimeType}
|
|
2549
|
+
class="h-full w-full object-cover"
|
|
2550
|
+
loading="lazy"
|
|
2551
|
+
/>
|
|
2552
|
+
{:else if getPosterUrl(asset)}
|
|
2553
|
+
<!-- Same poster the grid uses. The list had only the placeholder
|
|
2554
|
+
icon branch, so a video with a perfectly good frame still
|
|
2555
|
+
rendered as a generic film glyph here. -->
|
|
2556
|
+
<AssetImage
|
|
2557
|
+
src={getPosterUrl(asset)}
|
|
2558
|
+
alt={asset.alt || asset.originalFilename}
|
|
1048
2559
|
class="h-full w-full object-cover"
|
|
1049
2560
|
loading="lazy"
|
|
1050
2561
|
/>
|
|
1051
2562
|
{:else}
|
|
1052
2563
|
<div class="flex h-full items-center justify-center">
|
|
1053
|
-
|
|
2564
|
+
{@render fileIcon(asset.mimeType, 'h-4 w-4')}
|
|
1054
2565
|
</div>
|
|
1055
2566
|
{/if}
|
|
1056
2567
|
</div>
|
|
@@ -1121,8 +2632,19 @@
|
|
|
1121
2632
|
|
|
1122
2633
|
<!-- Asset Detail Sidebar (extends page on mobile, side panel on desktop) -->
|
|
1123
2634
|
{#if selectedAsset}
|
|
2635
|
+
<!--
|
|
2636
|
+
The panel is a fixed-height flex column with exactly one scrolling
|
|
2637
|
+
child (the tab content), rather than one big scroll container.
|
|
2638
|
+
|
|
2639
|
+
It used to be the latter: `md:overflow-y-auto` on the panel meant the
|
|
2640
|
+
preview, the tabs and the Save button all scrolled together, so saving
|
|
2641
|
+
alt text on any asset required scrolling past a 200px preview and five
|
|
2642
|
+
fields to reach the button — every time, for every asset. Constraining
|
|
2643
|
+
the scroll to the fields keeps the header, the preview, the tabs and
|
|
2644
|
+
the action footer on screen permanently.
|
|
2645
|
+
-->
|
|
1124
2646
|
<div
|
|
1125
|
-
class="bg-background border-border flex flex-col border-t md:w-[350px] md:shrink-0 md:
|
|
2647
|
+
class="bg-background border-border flex min-h-0 flex-col border-t md:w-[350px] md:shrink-0 md:border-t-0 md:border-l"
|
|
1126
2648
|
>
|
|
1127
2649
|
<!-- Header -->
|
|
1128
2650
|
<div class="border-border flex items-center justify-between border-b px-4 py-3">
|
|
@@ -1187,18 +2709,58 @@
|
|
|
1187
2709
|
class="bg-muted/30 mb-3 w-full cursor-zoom-in overflow-hidden rounded-lg"
|
|
1188
2710
|
title="Click to enlarge"
|
|
1189
2711
|
>
|
|
1190
|
-
<
|
|
1191
|
-
src={
|
|
2712
|
+
<AssetImage
|
|
2713
|
+
src={getPreviewUrl(selectedAsset)}
|
|
1192
2714
|
alt={selectedAsset.alt || selectedAsset.originalFilename}
|
|
2715
|
+
mimeType={selectedAsset.mimeType}
|
|
1193
2716
|
class="w-full object-contain"
|
|
1194
2717
|
style="max-height: 200px;"
|
|
1195
2718
|
/>
|
|
1196
2719
|
</button>
|
|
2720
|
+
{:else if isVideo(selectedAsset)}
|
|
2721
|
+
<!-- A real <video>, not an iframe: an iframe hands off to the browser's
|
|
2722
|
+
standalone media viewer, which can't be styled or controlled.
|
|
2723
|
+
|
|
2724
|
+
`preload="metadata"` is affordable because /media/:id/:filename now
|
|
2725
|
+
answers Range with 206, so the browser fetches the moov atom rather
|
|
2726
|
+
than the file — which is also where the duration in the controls
|
|
2727
|
+
comes from. Without ranges this had to be "none", since a partial
|
|
2728
|
+
fetch was impossible and metadata preload degraded into downloading
|
|
2729
|
+
the whole video just to draw the player. -->
|
|
2730
|
+
<video
|
|
2731
|
+
src={getOriginalUrl(selectedAsset)}
|
|
2732
|
+
controls
|
|
2733
|
+
preload="metadata"
|
|
2734
|
+
class="bg-muted/30 mb-3 max-h-52 w-full rounded-lg object-contain"
|
|
2735
|
+
>
|
|
2736
|
+
<track kind="captions" />
|
|
2737
|
+
</video>
|
|
2738
|
+
<!-- Only reachable when the automatic pass on load already failed —
|
|
2739
|
+
usually a codec this browser can't decode. Kept as an explicit
|
|
2740
|
+
retry rather than leaving the asset with no way forward. -->
|
|
2741
|
+
{#if !getPosterUrl(selectedAsset) && canUpload && posterAttempts.has(selectedAsset.id)}
|
|
2742
|
+
<Button
|
|
2743
|
+
variant="outline"
|
|
2744
|
+
size="sm"
|
|
2745
|
+
class="mb-3 w-full"
|
|
2746
|
+
disabled={generatingPoster}
|
|
2747
|
+
onclick={() => generatePoster(selectedAsset!)}
|
|
2748
|
+
>
|
|
2749
|
+
{generatingPoster ? 'Reading a frame…' : 'Generate poster'}
|
|
2750
|
+
</Button>
|
|
2751
|
+
{/if}
|
|
2752
|
+
{:else if isAudio(selectedAsset)}
|
|
2753
|
+
<audio
|
|
2754
|
+
src={getOriginalUrl(selectedAsset)}
|
|
2755
|
+
controls
|
|
2756
|
+
preload="metadata"
|
|
2757
|
+
class="mb-3 w-full"
|
|
2758
|
+
></audio>
|
|
1197
2759
|
{:else}
|
|
1198
2760
|
<div
|
|
1199
2761
|
class="bg-muted/30 mb-3 flex h-28 items-center justify-center overflow-hidden rounded-lg"
|
|
1200
2762
|
>
|
|
1201
|
-
|
|
2763
|
+
{@render fileIcon(selectedAsset.mimeType, 'h-12 w-12')}
|
|
1202
2764
|
</div>
|
|
1203
2765
|
{/if}
|
|
1204
2766
|
</div>
|
|
@@ -1230,37 +2792,37 @@
|
|
|
1230
2792
|
</div>
|
|
1231
2793
|
|
|
1232
2794
|
<!-- Tab content -->
|
|
1233
|
-
<div class="flex-1 overflow-y-auto p-4">
|
|
2795
|
+
<div class="min-h-0 flex-1 overflow-y-auto p-4">
|
|
1234
2796
|
{#if detailTab === 'details'}
|
|
1235
|
-
<!--
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
</
|
|
1246
|
-
<
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
<
|
|
1258
|
-
|
|
2797
|
+
<!-- Summary, then the technical detail folded away.
|
|
2798
|
+
Filename, MIME type, size, dimensions, upload date and asset id
|
|
2799
|
+
all had equal billing above the fields an editor actually edits,
|
|
2800
|
+
so the panel led with facts nobody came for and pushed alt text
|
|
2801
|
+
below the fold. The one-line summary carries what identifies an
|
|
2802
|
+
asset at a glance; everything addressed to a developer moves into
|
|
2803
|
+
a disclosure that stays shut. -->
|
|
2804
|
+
<div class="mb-3">
|
|
2805
|
+
<p class="truncate text-sm font-medium" title={selectedAsset.originalFilename}>
|
|
2806
|
+
{selectedAsset.originalFilename}
|
|
2807
|
+
</p>
|
|
2808
|
+
<p class="text-muted-foreground mt-0.5 text-xs">
|
|
2809
|
+
{assetMetaLine(selectedAsset)}{formatDuration(selectedAsset)
|
|
2810
|
+
? ` · ${formatDuration(selectedAsset)}`
|
|
2811
|
+
: ''}
|
|
2812
|
+
</p>
|
|
2813
|
+
<!-- Spelled out here rather than left to the tile's lock icon: this
|
|
2814
|
+
is where someone comes to ask "why can't the site show this?",
|
|
2815
|
+
and a badge alone doesn't say what private *means* or how the
|
|
2816
|
+
asset became private. -->
|
|
2817
|
+
{#if selectedAsset.isPrivate}
|
|
2818
|
+
<p class="text-muted-foreground mt-1.5 flex items-start gap-1.5 text-xs">
|
|
2819
|
+
<Lock class="mt-[1px] h-3 w-3 shrink-0" />
|
|
2820
|
+
<span>
|
|
2821
|
+
Private — needs a signed URL or a session in this organization. Set by the
|
|
2822
|
+
schema field this asset was uploaded into.
|
|
2823
|
+
</span>
|
|
2824
|
+
</p>
|
|
1259
2825
|
{/if}
|
|
1260
|
-
<div class="flex justify-between">
|
|
1261
|
-
<span class="text-muted-foreground">Uploaded</span>
|
|
1262
|
-
<span>{formatDate(selectedAsset.createdAt)}</span>
|
|
1263
|
-
</div>
|
|
1264
2826
|
</div>
|
|
1265
2827
|
|
|
1266
2828
|
<!-- Actions -->
|
|
@@ -1287,13 +2849,30 @@
|
|
|
1287
2849
|
|
|
1288
2850
|
<Separator class="my-4" />
|
|
1289
2851
|
|
|
1290
|
-
<!-- Metadata editing
|
|
2852
|
+
<!-- Metadata editing.
|
|
2853
|
+
Gated on `asset.upload`, the capability the PATCH route
|
|
2854
|
+
enforces. Presenting an editable form to a user who can't
|
|
2855
|
+
save turned every keystroke into work discarded by a
|
|
2856
|
+
generic 403 at the end. -->
|
|
1291
2857
|
<div class="space-y-3">
|
|
2858
|
+
<div>
|
|
2859
|
+
<Label for="asset-filename" class="text-xs">Filename</Label>
|
|
2860
|
+
<Input
|
|
2861
|
+
id="asset-filename"
|
|
2862
|
+
bind:value={editFilename}
|
|
2863
|
+
readonly={!canUpload}
|
|
2864
|
+
disabled={!canUpload}
|
|
2865
|
+
class="mt-1 h-8 text-sm"
|
|
2866
|
+
placeholder="filename.jpg"
|
|
2867
|
+
/>
|
|
2868
|
+
</div>
|
|
1292
2869
|
<div>
|
|
1293
2870
|
<Label for="asset-title" class="text-xs">Title</Label>
|
|
1294
2871
|
<Input
|
|
1295
2872
|
id="asset-title"
|
|
1296
2873
|
bind:value={editTitle}
|
|
2874
|
+
readonly={!canUpload}
|
|
2875
|
+
disabled={!canUpload}
|
|
1297
2876
|
class="mt-1 h-8 text-sm"
|
|
1298
2877
|
placeholder="Asset title"
|
|
1299
2878
|
/>
|
|
@@ -1303,7 +2882,9 @@
|
|
|
1303
2882
|
<textarea
|
|
1304
2883
|
id="asset-description"
|
|
1305
2884
|
bind:value={editDescription}
|
|
1306
|
-
|
|
2885
|
+
readonly={!canUpload}
|
|
2886
|
+
disabled={!canUpload}
|
|
2887
|
+
class="border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring mt-1 flex w-full rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
1307
2888
|
rows="2"
|
|
1308
2889
|
placeholder="Description"
|
|
1309
2890
|
></textarea>
|
|
@@ -1313,6 +2894,8 @@
|
|
|
1313
2894
|
<Input
|
|
1314
2895
|
id="asset-alt"
|
|
1315
2896
|
bind:value={editAlt}
|
|
2897
|
+
readonly={!canUpload}
|
|
2898
|
+
disabled={!canUpload}
|
|
1316
2899
|
class="mt-1 h-8 text-sm"
|
|
1317
2900
|
placeholder="Alternative text"
|
|
1318
2901
|
/>
|
|
@@ -1322,14 +2905,76 @@
|
|
|
1322
2905
|
<Input
|
|
1323
2906
|
id="asset-credit"
|
|
1324
2907
|
bind:value={editCreditLine}
|
|
2908
|
+
readonly={!canUpload}
|
|
2909
|
+
disabled={!canUpload}
|
|
1325
2910
|
class="mt-1 h-8 text-sm"
|
|
1326
2911
|
placeholder="Credit / attribution"
|
|
1327
2912
|
/>
|
|
1328
2913
|
</div>
|
|
1329
2914
|
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
2915
|
+
{#if !canUpload}
|
|
2916
|
+
<p class="text-muted-foreground text-xs">
|
|
2917
|
+
You don't have permission to edit asset metadata.
|
|
2918
|
+
</p>
|
|
2919
|
+
{/if}
|
|
2920
|
+
|
|
2921
|
+
<!-- Everything addressed to a developer rather than an editor.
|
|
2922
|
+
A native <details> rather than a toggle in component state:
|
|
2923
|
+
it needs no state to get wrong, it is keyboard accessible and
|
|
2924
|
+
findable by in-page search for free, and it reopens closed on
|
|
2925
|
+
the next asset, which is the right default for a panel whose
|
|
2926
|
+
job is the fields above. -->
|
|
2927
|
+
<details class="group border-border mt-2 border-t pt-3">
|
|
2928
|
+
<summary
|
|
2929
|
+
class="text-muted-foreground hover:text-foreground flex cursor-pointer list-none items-center gap-1 text-xs select-none [&::-webkit-details-marker]:hidden"
|
|
2930
|
+
>
|
|
2931
|
+
<!-- `list-none` alone leaves Safari's marker in place, and the
|
|
2932
|
+
webkit rule alone leaves nothing to indicate the row opens.
|
|
2933
|
+
Both, plus a chevron that turns with the group's open state. -->
|
|
2934
|
+
<ChevronRight size={12} class="transition-transform group-open:rotate-90" />
|
|
2935
|
+
File information
|
|
2936
|
+
</summary>
|
|
2937
|
+
<div class="mt-2 space-y-2 text-xs">
|
|
2938
|
+
<div class="flex justify-between gap-2">
|
|
2939
|
+
<span class="text-muted-foreground">Type</span>
|
|
2940
|
+
<span class="font-mono">{selectedAsset.mimeType}</span>
|
|
2941
|
+
</div>
|
|
2942
|
+
<div class="flex justify-between gap-2">
|
|
2943
|
+
<span class="text-muted-foreground">Size</span>
|
|
2944
|
+
<span>{formatSize(selectedAsset.size)}</span>
|
|
2945
|
+
</div>
|
|
2946
|
+
{#if selectedAsset.width && selectedAsset.height}
|
|
2947
|
+
<div class="flex justify-between gap-2">
|
|
2948
|
+
<span class="text-muted-foreground">Dimensions</span>
|
|
2949
|
+
<span>{selectedAsset.width} × {selectedAsset.height}</span>
|
|
2950
|
+
</div>
|
|
2951
|
+
{/if}
|
|
2952
|
+
{#if formatDuration(selectedAsset)}
|
|
2953
|
+
<div class="flex justify-between gap-2">
|
|
2954
|
+
<span class="text-muted-foreground">Duration</span>
|
|
2955
|
+
<span class="tabular-nums">{formatDuration(selectedAsset)}</span>
|
|
2956
|
+
</div>
|
|
2957
|
+
{/if}
|
|
2958
|
+
<div class="flex justify-between gap-2">
|
|
2959
|
+
<span class="text-muted-foreground">Uploaded</span>
|
|
2960
|
+
<span>{formatDate(selectedAsset.createdAt)}</span>
|
|
2961
|
+
</div>
|
|
2962
|
+
<!-- The id is the asset's real identity: what a document stores
|
|
2963
|
+
in `{ asset: { _ref } }`, what every storage key derives
|
|
2964
|
+
from, and the only stable handle once the filename is
|
|
2965
|
+
editable. Demoted, not dropped. -->
|
|
2966
|
+
<div class="flex items-center justify-between gap-2">
|
|
2967
|
+
<span class="text-muted-foreground">Asset ID</span>
|
|
2968
|
+
<button
|
|
2969
|
+
onclick={() => copyAssetId(selectedAsset!)}
|
|
2970
|
+
title="{selectedAsset.id} — click to copy"
|
|
2971
|
+
class="hover:text-foreground max-w-[180px] cursor-pointer truncate font-mono"
|
|
2972
|
+
>
|
|
2973
|
+
{copiedId ? 'Copied!' : selectedAsset.id}
|
|
2974
|
+
</button>
|
|
2975
|
+
</div>
|
|
2976
|
+
</div>
|
|
2977
|
+
</details>
|
|
1333
2978
|
</div>
|
|
1334
2979
|
{:else}
|
|
1335
2980
|
<!-- References tab -->
|
|
@@ -1357,7 +3002,9 @@
|
|
|
1357
3002
|
<div class="min-w-0">
|
|
1358
3003
|
<p class="truncate text-sm font-medium">{ref.title}</p>
|
|
1359
3004
|
<p class="text-muted-foreground truncate text-xs">
|
|
1360
|
-
{ref.type}{ref.status ? ` · ${ref.status}` : ''}
|
|
3005
|
+
{ref.type}{ref.status ? ` · ${ref.status}` : ''}{ref.fieldPaths?.length
|
|
3006
|
+
? ` · ${ref.fieldPaths.map(humanizeFieldPath).join(', ')}`
|
|
3007
|
+
: ''}
|
|
1361
3008
|
</p>
|
|
1362
3009
|
</div>
|
|
1363
3010
|
</button>
|
|
@@ -1366,6 +3013,31 @@
|
|
|
1366
3013
|
{/if}
|
|
1367
3014
|
{/if}
|
|
1368
3015
|
</div>
|
|
3016
|
+
|
|
3017
|
+
<!--
|
|
3018
|
+
Action footer — outside the scroll container, so Save is on screen
|
|
3019
|
+
whichever field is being edited.
|
|
3020
|
+
|
|
3021
|
+
`sticky bottom-0` is for the mobile layout, where the panel is
|
|
3022
|
+
stacked below the grid and the *page* is what scrolls; on desktop
|
|
3023
|
+
the flex column already puts it at the bottom and sticky is inert.
|
|
3024
|
+
|
|
3025
|
+
Disabled until something actually changed: the button used to be
|
|
3026
|
+
live at all times, so the only way to know whether an edit had been
|
|
3027
|
+
saved was to press it again.
|
|
3028
|
+
-->
|
|
3029
|
+
{#if detailTab === 'details' && canUpload}
|
|
3030
|
+
<div class="border-border bg-background sticky bottom-0 border-t p-3">
|
|
3031
|
+
<Button
|
|
3032
|
+
onclick={saveMetadata}
|
|
3033
|
+
disabled={isSaving || !metadataDirty}
|
|
3034
|
+
size="sm"
|
|
3035
|
+
class="w-full"
|
|
3036
|
+
>
|
|
3037
|
+
{isSaving ? 'Saving...' : metadataDirty ? 'Save changes' : 'Saved'}
|
|
3038
|
+
</Button>
|
|
3039
|
+
</div>
|
|
3040
|
+
{/if}
|
|
1369
3041
|
</div>
|
|
1370
3042
|
{/if}
|
|
1371
3043
|
</div>
|
|
@@ -1385,9 +3057,10 @@
|
|
|
1385
3057
|
>
|
|
1386
3058
|
</Dialog.Header>
|
|
1387
3059
|
<div class="flex flex-1 items-center justify-center overflow-hidden p-4">
|
|
1388
|
-
<
|
|
1389
|
-
src={
|
|
3060
|
+
<AssetImage
|
|
3061
|
+
src={getLightboxUrl(selectedAsset)}
|
|
1390
3062
|
alt={selectedAsset.alt || selectedAsset.originalFilename}
|
|
3063
|
+
mimeType={selectedAsset.mimeType}
|
|
1391
3064
|
class="max-h-[70vh] max-w-full object-contain"
|
|
1392
3065
|
/>
|
|
1393
3066
|
</div>
|
|
@@ -1427,17 +3100,26 @@
|
|
|
1427
3100
|
class="border-border mt-2 flex flex-col items-center justify-center rounded-lg border-2 border-dashed px-6 py-10 transition-colors {modalIsDragging
|
|
1428
3101
|
? 'border-primary bg-primary/5'
|
|
1429
3102
|
: 'hover:bg-muted/50'}"
|
|
3103
|
+
ondragenter={(e) => {
|
|
3104
|
+
if (!isFileDrag(e)) return;
|
|
3105
|
+
e.preventDefault();
|
|
3106
|
+
modalDragDepth++;
|
|
3107
|
+
}}
|
|
1430
3108
|
ondragover={(e) => {
|
|
3109
|
+
if (!isFileDrag(e)) return;
|
|
1431
3110
|
e.preventDefault();
|
|
1432
|
-
modalIsDragging = true;
|
|
1433
3111
|
}}
|
|
1434
3112
|
ondragleave={(e) => {
|
|
3113
|
+
if (modalDragDepth === 0) return;
|
|
1435
3114
|
e.preventDefault();
|
|
1436
|
-
|
|
3115
|
+
modalDragDepth--;
|
|
3116
|
+
}}
|
|
3117
|
+
ondragend={() => {
|
|
3118
|
+
modalDragDepth = 0;
|
|
1437
3119
|
}}
|
|
1438
3120
|
ondrop={(e) => {
|
|
1439
3121
|
e.preventDefault();
|
|
1440
|
-
|
|
3122
|
+
modalDragDepth = 0;
|
|
1441
3123
|
addFilesToQueue(e.dataTransfer?.files || null);
|
|
1442
3124
|
}}
|
|
1443
3125
|
role="button"
|
|
@@ -1458,7 +3140,7 @@
|
|
|
1458
3140
|
bind:this={modalFileInputRef}
|
|
1459
3141
|
type="file"
|
|
1460
3142
|
multiple
|
|
1461
|
-
accept=
|
|
3143
|
+
accept={acceptInputValue}
|
|
1462
3144
|
class="hidden"
|
|
1463
3145
|
onchange={(e) => {
|
|
1464
3146
|
const target = e.target as HTMLInputElement;
|
|
@@ -1468,13 +3150,79 @@
|
|
|
1468
3150
|
/>
|
|
1469
3151
|
|
|
1470
3152
|
<!-- Upload queue -->
|
|
3153
|
+
<!-- Rejected files are not part of the upload, so they get their own line in
|
|
3154
|
+
destructive tone; the queued tally below stays muted and counts only what
|
|
3155
|
+
will actually be sent. Two lines at the same weight read as competing
|
|
3156
|
+
descriptions of the same thing. -->
|
|
3157
|
+
{#if rejectedCount > 0}
|
|
3158
|
+
<p class="text-destructive mt-4 text-xs">
|
|
3159
|
+
{rejectedCount}
|
|
3160
|
+
{rejectedCount === 1 ? 'file can’t' : 'files can’t'} be uploaded
|
|
3161
|
+
</p>
|
|
3162
|
+
{/if}
|
|
3163
|
+
|
|
3164
|
+
{#if failedCount > 0}
|
|
3165
|
+
<div class="mt-4 flex items-center justify-between gap-3">
|
|
3166
|
+
<p class="text-destructive text-xs">
|
|
3167
|
+
{failedCount}
|
|
3168
|
+
{failedCount === 1 ? 'upload' : 'uploads'} failed
|
|
3169
|
+
</p>
|
|
3170
|
+
<!-- Kept mounted mid-flight rather than hidden: the row disappearing and
|
|
3171
|
+
coming back as other files settle makes the dialog jump. -->
|
|
3172
|
+
<Button variant="outline" size="sm" disabled={isUploading} onclick={retryAllFailed}>
|
|
3173
|
+
Retry all
|
|
3174
|
+
</Button>
|
|
3175
|
+
</div>
|
|
3176
|
+
{/if}
|
|
3177
|
+
|
|
1471
3178
|
{#if uploadQueue.length > 0}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
<
|
|
3179
|
+
{#if queuedItems.length > 0}
|
|
3180
|
+
<div class="text-muted-foreground mt-4 flex items-baseline justify-between text-xs">
|
|
3181
|
+
<span>
|
|
3182
|
+
{queuedItems.length}
|
|
3183
|
+
{queuedItems.length === 1 ? 'file' : 'files'} selected
|
|
3184
|
+
</span>
|
|
3185
|
+
<span class="tabular-nums">{formatSize(queuedBytes)}</span>
|
|
3186
|
+
</div>
|
|
3187
|
+
{/if}
|
|
3188
|
+
<div class="mt-2 max-h-64 space-y-2 overflow-y-auto">
|
|
3189
|
+
{#each uploadQueue as item, index}
|
|
3190
|
+
<div
|
|
3191
|
+
class="border-border flex items-center gap-3 rounded-md border px-3 py-2 {item.status ===
|
|
3192
|
+
'failed' || item.status === 'rejected'
|
|
3193
|
+
? 'border-destructive/50'
|
|
3194
|
+
: ''}"
|
|
3195
|
+
>
|
|
3196
|
+
<div class="bg-muted/40 border-border h-9 w-9 shrink-0 overflow-hidden rounded border">
|
|
3197
|
+
{#if item.previewUrl}
|
|
3198
|
+
<img src={item.previewUrl} alt="" class="h-full w-full object-cover" />
|
|
3199
|
+
{:else}
|
|
3200
|
+
<div class="flex h-full items-center justify-center">
|
|
3201
|
+
{@render fileIcon(item.file.type, 'h-4 w-4')}
|
|
3202
|
+
</div>
|
|
3203
|
+
{/if}
|
|
3204
|
+
</div>
|
|
1475
3205
|
<div class="min-w-0 flex-1">
|
|
1476
3206
|
<p class="truncate text-sm">{item.file.name}</p>
|
|
1477
|
-
|
|
3207
|
+
{#if (item.status === 'failed' || item.status === 'rejected') && item.error}
|
|
3208
|
+
<p class="text-destructive text-xs">{item.error}</p>
|
|
3209
|
+
{:else if item.status === 'pending' && isUploading}
|
|
3210
|
+
<p class="text-muted-foreground text-xs">Waiting…</p>
|
|
3211
|
+
{:else if item.status === 'uploading'}
|
|
3212
|
+
<div class="mt-1 flex items-center gap-2">
|
|
3213
|
+
<div class="bg-muted h-1 flex-1 overflow-hidden rounded-full">
|
|
3214
|
+
<div
|
|
3215
|
+
class="bg-primary h-full transition-[width] duration-150"
|
|
3216
|
+
style="width: {item.progress ?? 0}%"
|
|
3217
|
+
></div>
|
|
3218
|
+
</div>
|
|
3219
|
+
<span class="text-muted-foreground w-9 text-right text-xs tabular-nums">
|
|
3220
|
+
{item.progress ?? 0}%
|
|
3221
|
+
</span>
|
|
3222
|
+
</div>
|
|
3223
|
+
{:else}
|
|
3224
|
+
<p class="text-muted-foreground text-xs">{formatSize(item.file.size)}</p>
|
|
3225
|
+
{/if}
|
|
1478
3226
|
</div>
|
|
1479
3227
|
{#if item.status === 'uploading'}
|
|
1480
3228
|
<div
|
|
@@ -1483,13 +3231,58 @@
|
|
|
1483
3231
|
{:else if item.status === 'done'}
|
|
1484
3232
|
<CheckCircle2 size={16} class="shrink-0 text-green-500" />
|
|
1485
3233
|
{:else if item.status === 'failed'}
|
|
1486
|
-
<
|
|
3234
|
+
<div class="flex shrink-0 items-center gap-1">
|
|
3235
|
+
<AlertCircle size={16} class="text-destructive" />
|
|
3236
|
+
<Button
|
|
3237
|
+
variant="ghost"
|
|
3238
|
+
size="sm"
|
|
3239
|
+
class="h-6 px-2 text-xs"
|
|
3240
|
+
onclick={() => retryUpload(index)}
|
|
3241
|
+
>
|
|
3242
|
+
Retry
|
|
3243
|
+
</Button>
|
|
3244
|
+
</div>
|
|
3245
|
+
{:else if item.status === 'rejected'}
|
|
3246
|
+
<!-- No Retry here: the check that turned this file away is deterministic
|
|
3247
|
+
and would reach the same answer, so the button would do nothing.
|
|
3248
|
+
Removing it is the only action that helps. -->
|
|
3249
|
+
<div class="flex shrink-0 items-center gap-1">
|
|
3250
|
+
<AlertCircle size={16} class="text-destructive" />
|
|
3251
|
+
<Button
|
|
3252
|
+
variant="ghost"
|
|
3253
|
+
size="sm"
|
|
3254
|
+
class="h-6 w-6 p-0"
|
|
3255
|
+
aria-label="Remove {item.file.name}"
|
|
3256
|
+
onclick={() => removeQueueItem(index)}
|
|
3257
|
+
>
|
|
3258
|
+
<X class="h-3.5 w-3.5" />
|
|
3259
|
+
</Button>
|
|
3260
|
+
</div>
|
|
1487
3261
|
{:else}
|
|
1488
3262
|
<div class="bg-muted h-4 w-4 shrink-0 rounded-full"></div>
|
|
1489
3263
|
{/if}
|
|
1490
3264
|
</div>
|
|
1491
3265
|
{/each}
|
|
1492
3266
|
</div>
|
|
3267
|
+
|
|
3268
|
+
<!-- The dialog no longer closes itself, so it needs an explicit way out.
|
|
3269
|
+
Disabled mid-flight: dismissing it would hide in-progress uploads
|
|
3270
|
+
that are still running. -->
|
|
3271
|
+
<div class="mt-4 flex items-center justify-between gap-3">
|
|
3272
|
+
<Button variant="ghost" size="sm" disabled={isUploading} onclick={clearUploadQueue}>
|
|
3273
|
+
Clear list
|
|
3274
|
+
</Button>
|
|
3275
|
+
<Button
|
|
3276
|
+
size="sm"
|
|
3277
|
+
disabled={isUploading}
|
|
3278
|
+
onclick={() => {
|
|
3279
|
+
showUploadModal = false;
|
|
3280
|
+
clearUploadQueue();
|
|
3281
|
+
}}
|
|
3282
|
+
>
|
|
3283
|
+
Done
|
|
3284
|
+
</Button>
|
|
3285
|
+
</div>
|
|
1493
3286
|
{/if}
|
|
1494
3287
|
</Dialog.Content>
|
|
1495
3288
|
</Dialog.Root>
|