import type { ResolvedStateInfo } from '@blocksuite/affine-components/resource'; import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme'; import { WithDisposable } from '@blocksuite/global/lit'; import { ShadowlessElement } from '@blocksuite/std'; import { css, html } from 'lit'; import { property } from 'lit/decorators.js'; import { classMap } from 'lit/directives/class-map.js'; export const SURFACE_IMAGE_CARD_WIDTH = 220; export const SURFACE_IMAGE_CARD_HEIGHT = 122; export const NOTE_IMAGE_CARD_WIDTH = 752; export const NOTE_IMAGE_CARD_HEIGHT = 78; export class ImageBlockFallbackCard extends WithDisposable(ShadowlessElement) { static override styles = css` affine-image-fallback-card { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; user-select: none; } .affine-image-fallback-card { display: flex; flex: 1; gap: 8px; align-self: stretch; flex-direction: column; justify-content: space-between; border-radius: 8px; border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')}; background: ${unsafeCSSVarV2('layer/background/secondary')}; padding: 12px; } .truncate { align-self: stretch; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } .affine-image-fallback-card-title { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; } .affine-image-fallback-card-title-icon { display: flex; width: 16px; height: 16px; align-items: center; justify-content: center; color: var(--affine-text-primary-color); } .affine-image-fallback-card-title-text { color: var(--affine-placeholder-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-image-fallback-card-description { color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-image-fallback-card.loading { .affine-image-fallback-card-title { color: var(--affine-placeholder-color); } } .affine-image-fallback-card.error { .affine-image-fallback-card-title-icon { color: ${unsafeCSSVarV2('status/error')}; } } `; override render() { const { icon, title, description, loading, error } = this.state; const classInfo = { 'affine-image-fallback-card': true, 'drag-target': true, loading, error, }; return html`