Add app.bsky.embed.gallery embed type support

Wires the new gallery embed (atproto PR #4827) through the display and
compose pipelines while the lexicon is unpublished. Gallery posts render
via the existing carousel for >4 items and grid for <=4. Compose now
allows up to 10 images and auto-promotes images -> gallery above 4
(demotes back when count drops to <=4 so old clients still see legacy
embeds when possible). Drafts persist as the new `embedGallery` field.

Local shim types in `src/lib/api/gallery-embed-shim*.ts` mirror the
lexicon shape; delete both files once @atproto/api ships the generated
types.
This commit is contained in:
vineyardbovines
2026-06-03 13:12:27 -04:00
parent b6650d8d5c
commit 9aea4362d5
15 changed files with 408 additions and 84 deletions
+11
View File
@@ -10,6 +10,8 @@ import {
AppBskyLabelerDefs,
} from '@atproto/api'
import {AppBskyEmbedGallery} from '#/lib/api/gallery-embed-shim'
export type Embed =
| {
type: 'post'
@@ -47,6 +49,10 @@ export type Embed =
type: 'images'
view: $Typed<AppBskyEmbedImages.View>
}
| {
type: 'gallery'
view: $Typed<AppBskyEmbedGallery.View>
}
| {
type: 'link'
view: $Typed<AppBskyEmbedExternal.View>
@@ -122,6 +128,11 @@ export function parseEmbed(embed: AppBskyFeedDefs.PostView['embed']): Embed {
type: 'images',
view: embed,
}
} else if (AppBskyEmbedGallery.isView(embed)) {
return {
type: 'gallery',
view: embed,
}
} else if (AppBskyEmbedExternal.isView(embed)) {
return {
type: 'link',