social-embeds 0.4.1 → 0.5.1

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 CHANGED
@@ -4,7 +4,7 @@ Turn social media embed code or post URLs into working React components.
4
4
 
5
5
  Pasting a platform's embed code into `dangerouslySetInnerHTML` does not work in React: the `<script>` tag never runs, every embed adds the same script again, and nothing initialises after client-side navigation. `social-embeds` recognises the platform, reads the post and its options from the embed code, drops the `<script>` tag, loads each platform script once per page and asks the platform to render the post. Iframe-based platforms get a responsive `<iframe>` instead.
6
6
 
7
- - X, Instagram, Threads, Facebook, TikTok, YouTube, Telegram, Snapchat, LinkedIn, Reddit, Pinterest, Spotify, Vimeo, Twitch and Dailymotion
7
+ - X, Instagram, Threads, Facebook, TikTok, YouTube, Telegram, Snapchat, LinkedIn, Reddit, Pinterest, Spotify, Vimeo, Twitch, Dailymotion, Bluesky, SoundCloud, Apple Music, Apple Podcasts, Tumblr, Kick and Giphy
8
8
  - React 19, Next.js App Router (Server Components, client navigation), or plain React
9
9
  - Zero runtime dependencies, ESM only, typed
10
10
  - No styling and no defaults beyond what the embed code or your props ask for
@@ -83,17 +83,24 @@ Each platform component takes a `url`, or an `embed` already parsed by [`social-
83
83
 
84
84
  ```tsx
85
85
  import {
86
+ AppleMusicEmbed,
87
+ ApplePodcastsEmbed,
88
+ BlueskyEmbed,
86
89
  DailymotionEmbed,
87
90
  FacebookEmbed,
91
+ GiphyEmbed,
88
92
  InstagramEmbed,
93
+ KickEmbed,
89
94
  LinkedInEmbed,
90
95
  PinterestEmbed,
91
96
  RedditEmbed,
92
97
  SnapchatEmbed,
98
+ SoundCloudEmbed,
93
99
  SpotifyEmbed,
94
100
  TelegramEmbed,
95
101
  ThreadsEmbed,
96
102
  TikTokEmbed,
103
+ TumblrEmbed,
97
104
  TwitchEmbed,
98
105
  VimeoEmbed,
99
106
  XEmbed,
@@ -149,27 +156,48 @@ import {
149
156
  playerId={process.env.NEXT_PUBLIC_DAILYMOTION_PLAYER_ID}
150
157
  mute
151
158
  />
159
+
160
+ <BlueskyEmbed
161
+ url="https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur/post/3n2mkgfb4tk2d"
162
+ colorMode="dark"
163
+ />
164
+
165
+ <SoundCloudEmbed url="https://soundcloud.com/forss/flickermood" visual={false} height={166} />
166
+
167
+ <AppleMusicEmbed url="https://music.apple.com/us/album/better-together/1440857781?i=1440857786" />
168
+
169
+ <ApplePodcastsEmbed url="https://podcasts.apple.com/us/podcast/the-daily/id1200361736" />
170
+
171
+ <TumblrEmbed url="https://staff.tumblr.com/post/832577330595643392" />
172
+
173
+ <KickEmbed url="https://kick.com/xqc" muted />
174
+
175
+ <GiphyEmbed url="https://giphy.com/gifs/cat-funny-JIX9t2j0ZTN9S" maxWidth={480} />
152
176
  ```
153
177
 
154
- | Component | Option props |
155
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
156
- | `XEmbed` | `theme` (`'light'` \| `'dark'`), `conversation` (`'none'`), `cards` (`'hidden'`), `align` (`'left'` \| `'center'` \| `'right'`), `lang`, `dnt` |
157
- | `InstagramEmbed` | `captioned` |
158
- | `ThreadsEmbed` | `theme` (`'light'` \| `'dark'` \| `'auto'`) |
159
- | `FacebookEmbed` | `locale` (SDK locale, default `'en_US'`), `showText`; videos also `allowfullscreen`, `autoplay`, `showCaptions` |
160
- | `TikTokEmbed` | the [Embed Player](https://developers.tiktok.com/doc/embed-player) parameters: `controls`, `progressBar`, `playButton`, `volumeControl`, `fullscreenButton`, `timestamp`, `loop`, `autoplay`, `musicInfo`, `description`, `rel`, `nativeContextMenu`, `closedCaption`, `forceMuted` |
161
- | `YouTubeEmbed` | the [player parameters](https://developers.google.com/youtube/player_parameters): `autoplay`, `ccLangPref`, `ccLoadPolicy`, `color`, `controls`, `disablekb`, `enablejsapi`, `end`, `fs`, `hl`, `ivLoadPolicy`, `list`, `listType`, `loop`, `origin`, `playlist`, `playsinline`, `rel`, `start`, `widgetReferrer`; plus `nocookie` (play from youtube-nocookie.com) |
162
- | `TelegramEmbed` | the widget configurator's options: `userpic`, `color` (hex, no `#`), `dark`, `darkColor` |
163
- | `SnapchatEmbed` | none |
164
- | `LinkedInEmbed` | `collapsed` (the Embed dialog's "less text") |
165
- | `RedditEmbed` | `theme` (`'light'` \| `'dark'`), `showMedia`, `showTitle`, `showUsername`, `locale`, `depth` (replies under a comment) |
166
- | `PinterestEmbed` | `pinWidth` (`'small'` \| `'medium'` \| `'large'`): `data-pin-width`, since `width` is the wrapper's |
167
- | `SpotifyEmbed` | `theme` (`0`, the dark player) |
168
- | `VimeoEmbed` | Vimeo's player parameters: `autopause`, `autoplay`, `background`, `byline`, `color` (hex, no `#`), `controls`, `dnt`, `keyboard`, `loop`, `muted`, `pip`, `playsinline`, `portrait`, `quality`, `speed`, `title`, `transparent`; plus `t` (start time, seconds or `1m2s`) |
169
- | `TwitchEmbed` | `autoplay`, `muted`, `time` (a video's start, `1h2m3s`) |
170
- | `DailymotionEmbed` | `playerId` (your Player ID; required unless the embed code has one), `mute`, `startTime` (seconds), `loop` |
171
-
172
- Boolean player parameters are written as `1`/`0`; Telegram's, Reddit's, Twitch's and Dailymotion's options are written the way their own embed code writes them.
178
+ | Component | Option props |
179
+ | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
180
+ | `XEmbed` | `theme` (`'light'` \| `'dark'`), `conversation` (`'none'`), `cards` (`'hidden'`), `align` (`'left'` \| `'center'` \| `'right'`), `lang`, `dnt` |
181
+ | `InstagramEmbed` | `captioned` |
182
+ | `ThreadsEmbed` | `theme` (`'light'` \| `'dark'` \| `'auto'`) |
183
+ | `FacebookEmbed` | `locale` (SDK locale, default `'en_US'`), `showText`; videos also `allowfullscreen`, `autoplay`, `showCaptions` |
184
+ | `TikTokEmbed` | the [Embed Player](https://developers.tiktok.com/doc/embed-player) parameters: `controls`, `progressBar`, `playButton`, `volumeControl`, `fullscreenButton`, `timestamp`, `loop`, `autoplay`, `musicInfo`, `description`, `rel`, `nativeContextMenu`, `closedCaption`, `forceMuted` |
185
+ | `YouTubeEmbed` | the [player parameters](https://developers.google.com/youtube/player_parameters): `autoplay`, `ccLangPref`, `ccLoadPolicy`, `color`, `controls`, `disablekb`, `enablejsapi`, `end`, `fs`, `hl`, `ivLoadPolicy`, `list`, `listType`, `loop`, `origin`, `playlist`, `playsinline`, `rel`, `start`, `widgetReferrer`; plus `nocookie` (play from youtube-nocookie.com) |
186
+ | `TelegramEmbed` | the widget configurator's options: `userpic`, `color` (hex, no `#`), `dark`, `darkColor` |
187
+ | `SnapchatEmbed` | none |
188
+ | `LinkedInEmbed` | `collapsed` (the Embed dialog's "less text") |
189
+ | `RedditEmbed` | `theme` (`'light'` \| `'dark'`), `showMedia`, `showTitle`, `showUsername`, `locale`, `depth` (replies under a comment) |
190
+ | `PinterestEmbed` | `pinWidth` (`'small'` \| `'medium'` \| `'large'`): `data-pin-width`, since `width` is the wrapper's |
191
+ | `SpotifyEmbed` | `theme` (`0`, the dark player) |
192
+ | `VimeoEmbed` | Vimeo's player parameters: `autopause`, `autoplay`, `background`, `byline`, `color` (hex, no `#`), `controls`, `dnt`, `keyboard`, `loop`, `muted`, `pip`, `playsinline`, `portrait`, `quality`, `speed`, `title`, `transparent`; plus `t` (start time, seconds or `1m2s`) |
193
+ | `TwitchEmbed` | `autoplay`, `muted`, `time` (a video's start, `1h2m3s`) |
194
+ | `DailymotionEmbed` | `playerId` (your Player ID; required unless the embed code has one), `mute`, `startTime` (seconds), `loop` |
195
+ | `BlueskyEmbed` | `colorMode` (`'light'` \| `'dark'` \| `'system'`) |
196
+ | `SoundCloudEmbed` | SoundCloud's player parameters, in camelCase: `visual`, `color` (with `#`), `autoPlay`, `hideRelated`, `showComments`, `showUser`, `showReposts`, `showTeaser`, `showArtwork` |
197
+ | `AppleMusicEmbed`, `ApplePodcastsEmbed`, `TumblrEmbed`, `GiphyEmbed` | none |
198
+ | `KickEmbed` | `autoplay`, `muted` |
199
+
200
+ Boolean player parameters are written as `1`/`0`; Telegram's, Reddit's, Twitch's, Dailymotion's, SoundCloud's and Kick's options are written the way their own embed code writes them.
173
201
 
174
202
  ### Parser
175
203
 
@@ -228,42 +256,49 @@ A component checks an `embed` before using it: its `url` must be the exact URL `
228
256
 
229
257
  ## Shared props
230
258
 
231
- | Prop | Type | Default | Notes |
232
- | ------------- | ------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
233
- | `url` | `string` | | Post URL. Platform components take `url` or `embed`; `<SocialEmbed>` takes `url` or `html`. |
234
- | `embed` | `ParsedEmbed` | | Platform components only. |
235
- | `html` | `string` | | `<SocialEmbed>` only. |
236
- | `width` | `number \| string` | `'100%'` | Wrapper width. |
237
- | `maxWidth` | `number` | per platform | The embed fills its container up to this width, in pixels. See [Platforms](#platforms). |
238
- | `height` | `number` | | Fixed-size iframe embeds only (YouTube, TikTok, Facebook video embed code, Snapchat, LinkedIn, Spotify, Vimeo, Twitch, Dailymotion): a fixed height instead of the aspect ratio, or instead of LinkedIn's default 670 px or Spotify's 152 or 352 px. The others size themselves. |
239
- | `maxHeight` | `number` | | Fixed-size iframe embeds only: the embed is at most this tall, in pixels. It narrows to keep its aspect ratio, so a vertical video does not fill the column. |
240
- | `placeholder` | `ReactNode` | a skeleton | Shown until the post has loaded. The default skeleton has a per-platform minimum height to limit layout shift. |
241
- | `lazy` | `boolean` | `true` | Load the embed only when it comes within 200 px of the viewport. |
242
- | `onLoad` | `() => void` | | Called once the platform has rendered the post (iframe embeds: when the iframe has loaded; Telegram and Reddit: when the frame first reports its height). |
243
- | `onError` | `(error: Error) => void` | | Called on invalid input, a script that fails to load, or a post that does not render. Components never throw. |
244
- | `...rest` | `ComponentProps<'div'>` | | Passed to the wrapper `div` (`className`, `style`, `data-*`, …). |
245
-
246
- Script-based embeds try to render three times, waiting 15 s each time, 1 s and then 2 s apart, before `onError` reports the failure. Telegram and Reddit frames that report no height within 15 s show at their starting height, and `onError` reports it.
259
+ | Prop | Type | Default | Notes |
260
+ | ------------- | ------------------------ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
261
+ | `url` | `string` | | Post URL. Platform components take `url` or `embed`; `<SocialEmbed>` takes `url` or `html`. |
262
+ | `embed` | `ParsedEmbed` | | Platform components only. |
263
+ | `html` | `string` | | `<SocialEmbed>` only. |
264
+ | `width` | `number \| string` | `'100%'` | Wrapper width. |
265
+ | `maxWidth` | `number` | per platform | The embed fills its container up to this width, in pixels. See [Platforms](#platforms). |
266
+ | `height` | `number` | | Fixed-size iframe embeds only (YouTube, TikTok, Facebook video embed code, Snapchat, LinkedIn, Spotify, Vimeo, Twitch, Dailymotion, SoundCloud, Apple Music, Apple Podcasts, Kick, Giphy): a fixed height instead of the aspect ratio, or instead of a fixed-height player's default. The others size themselves. |
267
+ | `maxHeight` | `number` | | Fixed-size iframe embeds only: the embed is at most this tall, in pixels. It narrows to keep its aspect ratio, so a vertical video does not fill the column. |
268
+ | `placeholder` | `ReactNode` | a skeleton | Shown until the post has loaded. The default skeleton has a per-platform minimum height to limit layout shift. |
269
+ | `lazy` | `boolean` | `true` | Load the embed only when it comes within 200 px of the viewport. |
270
+ | `onLoad` | `() => void` | | Called once the platform has rendered the post (iframe embeds: when the iframe has loaded; Telegram, Reddit, Bluesky and Tumblr: when the frame first reports its height). |
271
+ | `onError` | `(error: Error) => void` | | Called on invalid input, a script that fails to load, or a post that does not render. Components never throw. |
272
+ | `...rest` | `ComponentProps<'div'>` | | Passed to the wrapper `div` (`className`, `style`, `data-*`, …). |
273
+
274
+ Script-based embeds try to render three times, waiting 15 s each time, 1 s and then 2 s apart, before `onError` reports the failure. Telegram, Reddit, Bluesky and Tumblr frames that report no height within 15 s show at their starting height, and `onError` reports it. Bluesky's and Tumblr's frames report only once they are painted, so with `lazy={false}` an embed far below the fold can report this before it is scrolled to, and then still take its height.
247
275
 
248
276
  ## Platforms
249
277
 
250
- | Platform | Mechanism | URL formats | Options read from embed code | Default `maxWidth` |
251
- | ----------- | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
252
- | X | script (`widgets.js`), `twttr.widgets.load` | `x.com/{user}/status/{id}`, `twitter.com/…` (also `www.` and `mobile.`) | `data-theme`, `data-conversation`, `data-cards`, `data-align` or `align`, `data-lang`, `data-dnt`, `data-width` | 550 |
253
- | Instagram | script (`embed.js`), `instgrm.Embeds.process` | `instagram.com/p/{code}/`, `/reel/`, `/reels/`, `/tv/`, `/{user}/p/{code}/`, `/{user}/reel/{code}/` | `data-instgrm-captioned`, `data-instgrm-version` | 540 |
254
- | Threads | script (`embed.js`), `instgrm.Embeds.process` | `threads.com/@{user}/post/{code}`, `threads.com/t/{code}` (and `threads.net`) | `data-theme`, `data-text-post-version` | 658 |
255
- | Facebook | posts and video URLs: SDK (`sdk.js`), `FB.XFBML.parse`; video embed code: iframe | see [Facebook](#facebook) | `data-width`, `data-show-text`, `data-lazy`, `data-allowfullscreen`, `data-autoplay`, `data-show-captions`; iframe query (`show_text`, `width`, …); SDK locale | posts 750, videos none |
256
- | TikTok | iframe ([Embed Player](https://developers.tiktok.com/doc/embed-player)) | `tiktok.com/@{user}/video/{id}` | every player query parameter | 325 |
257
- | YouTube | iframe | `youtube.com/watch?v={id}`, `youtu.be/{id}`, `/shorts/{id}`, `/embed/{id}`, `/live/{id}`, `youtube-nocookie.com/embed/{id}`; `t` and `start` are kept | every player query parameter; the youtube-nocookie.com host | none |
258
- | Telegram | iframe (`t.me/{post}?embed=1`), height from the frame | `t.me/{channel}/{id}`, `t.me/s/{channel}/{id}`, `telegram.me/…`; `single` and `comment` are kept | `data-width`, `data-userpic`, `data-color`, `data-dark`, `data-dark-color`, `data-comment`, `data-mode`, `data-single` | 500 |
259
- | Snapchat | iframe (`{url}/embed`) | see [Snapchat](#snapchat) | `data-snapchat-embed-width`, `data-snapchat-embed-height`, `data-snapchat-embed-title` | 416 |
260
- | LinkedIn | iframe, fixed height | `linkedin.com/feed/update/urn:li:{activity\|share\|ugcPost}:{id}`, `linkedin.com/posts/{slug}-activity-{id}-…` (also country hosts such as `bg.`) | iframe query (`collapsed`), `width`, `height` | embed code width, else 504 |
261
- | Reddit | iframe (`embed.reddit.com`), height from the frame | `reddit.com/r/{sub}/comments/{id}/…`, comments `…/comments/{id}/comment/{commentId}/` (also `old.` and `new.`) | `data-embed-height`, `data-embed-theme`, `data-embed-showmedia`, `data-embed-showtitle`, `data-embed-locale`, `data-embed-depth` and the other `data-embed-*` | 640 |
262
- | Pinterest | script (`pinit_main.js`), `PinUtils.build` | `pinterest.com/pin/{id}/`, `/pin/{slug}--{id}/`, country hosts (`bg.pinterest.com`, `pinterest.co.uk`, …) | `data-pin-width`, `data-pin-lang`, `data-pin-terse` | the pin's width: 236, 345 or 600 |
263
- | Spotify | iframe (`open.spotify.com/embed/…`), fixed height | `open.spotify.com/{track\|album\|playlist\|artist\|episode\|show\|audiobook\|chapter}/{id}`, also with an `intl-{lang}/` prefix | iframe query (`theme`, …; `utm_source` and `si` dropped), `height`; `/video` for a video show | none |
264
- | Vimeo | iframe (`player.vimeo.com/video/{id}`) | `vimeo.com/{id}`, `vimeo.com/{id}/{hash}` (unlisted), `/channels/{name}/{id}`, `/groups/{name}/videos/{id}`, `/showcase/{id}/video/{id}`, `player.vimeo.com/video/{id}`; `#t=` is kept | every player query parameter (`app_id` and `player_id` dropped); `width` and `height`, or the responsive wrapper's ratio | none |
265
- | Twitch | iframe (`player.twitch.tv`, `clips.twitch.tv/embed`), `parent` set in the browser | `twitch.tv/{channel}`, `/videos/{id}` (`t` is kept), `/collections/{id}`, `/{channel}/clip/{slug}`, `clips.twitch.tv/{slug}` (also `www.` and `m.`) | `autoplay`, `muted`, `time`, `width`, `height`; `parent` is dropped | none |
266
- | Dailymotion | iframe (`geo.dailymotion.com/player/{playerId}.html`), Player ID required | `dailymotion.com/video/{id}`, `dailymotion.com/embed/video/{id}`, `dai.ly/{id}` | the Player ID, every player query parameter; `width` and `height`, or the responsive wrapper's ratio | none |
278
+ | Platform | Mechanism | URL formats | Options read from embed code | Default `maxWidth` |
279
+ | -------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
280
+ | X | script (`widgets.js`), `twttr.widgets.load` | `x.com/{user}/status/{id}`, `twitter.com/…` (also `www.` and `mobile.`) | `data-theme`, `data-conversation`, `data-cards`, `data-align` or `align`, `data-lang`, `data-dnt`, `data-width` | 550 |
281
+ | Instagram | script (`embed.js`), `instgrm.Embeds.process` | `instagram.com/p/{code}/`, `/reel/`, `/reels/`, `/tv/`, `/{user}/p/{code}/`, `/{user}/reel/{code}/` | `data-instgrm-captioned`, `data-instgrm-version` | 540 |
282
+ | Threads | script (`embed.js`), `instgrm.Embeds.process` | `threads.com/@{user}/post/{code}`, `threads.com/t/{code}` (and `threads.net`) | `data-theme`, `data-text-post-version` | 658 |
283
+ | Facebook | posts and video URLs: SDK (`sdk.js`), `FB.XFBML.parse`; video embed code: iframe | see [Facebook](#facebook) | `data-width`, `data-show-text`, `data-lazy`, `data-allowfullscreen`, `data-autoplay`, `data-show-captions`; iframe query (`show_text`, `width`, …); SDK locale | posts 750, videos none |
284
+ | TikTok | iframe ([Embed Player](https://developers.tiktok.com/doc/embed-player)) | `tiktok.com/@{user}/video/{id}` | every player query parameter | 325 |
285
+ | YouTube | iframe | `youtube.com/watch?v={id}`, `youtu.be/{id}`, `/shorts/{id}`, `/embed/{id}`, `/live/{id}`, `youtube-nocookie.com/embed/{id}`; `t` and `start` are kept | every player query parameter; the youtube-nocookie.com host | none |
286
+ | Telegram | iframe (`t.me/{post}?embed=1`), height from the frame | `t.me/{channel}/{id}`, `t.me/s/{channel}/{id}`, `telegram.me/…`; `single` and `comment` are kept | `data-width`, `data-userpic`, `data-color`, `data-dark`, `data-dark-color`, `data-comment`, `data-mode`, `data-single` | 500 |
287
+ | Snapchat | iframe (`{url}/embed`) | see [Snapchat](#snapchat) | `data-snapchat-embed-width`, `data-snapchat-embed-height`, `data-snapchat-embed-title` | 416 |
288
+ | LinkedIn | iframe, fixed height | `linkedin.com/feed/update/urn:li:{activity\|share\|ugcPost}:{id}`, `linkedin.com/posts/{slug}-activity-{id}-…` (also country hosts such as `bg.`) | iframe query (`collapsed`), `width`, `height` | embed code width, else 504 |
289
+ | Reddit | iframe (`embed.reddit.com`), height from the frame | `reddit.com/r/{sub}/comments/{id}/…`, comments `…/comments/{id}/comment/{commentId}/` (also `old.` and `new.`) | `data-embed-height`, `data-embed-theme`, `data-embed-showmedia`, `data-embed-showtitle`, `data-embed-locale`, `data-embed-depth` and the other `data-embed-*` | 640 |
290
+ | Pinterest | script (`pinit_main.js`), `PinUtils.build` | `pinterest.com/pin/{id}/`, `/pin/{slug}--{id}/`, country hosts (`bg.pinterest.com`, `pinterest.co.uk`, …) | `data-pin-width`, `data-pin-lang`, `data-pin-terse` | the pin's width: 236, 345 or 600 |
291
+ | Spotify | iframe (`open.spotify.com/embed/…`), fixed height | `open.spotify.com/{track\|album\|playlist\|artist\|episode\|show\|audiobook\|chapter}/{id}`, also with an `intl-{lang}/` prefix | iframe query (`theme`, …; `utm_source` and `si` dropped), `height`; `/video` for a video show | none |
292
+ | Vimeo | iframe (`player.vimeo.com/video/{id}`) | `vimeo.com/{id}`, `vimeo.com/{id}/{hash}` (unlisted), `/channels/{name}/{id}`, `/groups/{name}/videos/{id}`, `/showcase/{id}/video/{id}`, `player.vimeo.com/video/{id}`; `#t=` is kept | every player query parameter (`app_id` and `player_id` dropped); `width` and `height`, or the responsive wrapper's ratio | none |
293
+ | Twitch | iframe (`player.twitch.tv`, `clips.twitch.tv/embed`), `parent` set in the browser | `twitch.tv/{channel}`, `/videos/{id}` (`t` is kept), `/collections/{id}`, `/{channel}/clip/{slug}`, `clips.twitch.tv/{slug}` (also `www.` and `m.`) | `autoplay`, `muted`, `time`, `width`, `height`; `parent` is dropped | none |
294
+ | Dailymotion | iframe (`geo.dailymotion.com/player/{playerId}.html`), Player ID required | `dailymotion.com/video/{id}`, `dailymotion.com/embed/video/{id}`, `dai.ly/{id}` | the Player ID, every player query parameter; `width` and `height`, or the responsive wrapper's ratio | none |
295
+ | Bluesky | iframe (`embed.bsky.app/embed/…`), height from the frame; `embed.js` is not loaded | `bsky.app/profile/{did}/post/{rkey}` only: see [Bluesky](#bluesky) | `data-bluesky-uri`, `data-bluesky-cid`, `data-bluesky-embed-color-mode` | 600 |
296
+ | SoundCloud | iframe (`w.soundcloud.com/player`), fixed height | `soundcloud.com/{user}/{track}`, `/{user}/sets/{playlist}`, `/{user}`, a private track's `/s-{token}`, `api.soundcloud.com/{tracks\|playlists\|users}/{id}` (also `www.` and `m.`) | every player query parameter, `height`; the `url` parameter is the content | none |
297
+ | Apple Music | iframe (`embed.music.apple.com`), fixed height | `music.apple.com/{country}/{album\|song\|playlist}/{slug}/{id}`, a song on its album with `?i={id}` | `height` | 660 |
298
+ | Apple Podcasts | iframe (`embed.podcasts.apple.com`), fixed height | `podcasts.apple.com/{country}/podcast/{slug}/id{id}`, an episode with `?i={id}` | `width`, `height` | 640 |
299
+ | Tumblr | iframe (`embed.tumblr.com/embed/post/…`), height from the frame; `post.js` is not loaded | `www.tumblr.com/{blog}/{id}`, `{blog}.tumblr.com/post/{id}`, with or without the slug | none | 540 |
300
+ | Kick | iframe (`player.kick.com/{channel}`) | `kick.com/{channel}` | `autoplay`, `muted`, `width`, `height` | none |
301
+ | Giphy | iframe (`giphy.com/embed/{id}`) | `giphy.com/gifs/{slug}-{id}`, `giphy.com/gifs/{id}`, `giphy.com/embed/{id}`, `media.giphy.com/media/{id}/giphy.gif` | `width` and `height`, or the responsive wrapper's ratio | none |
267
302
 
268
303
  URLs must be absolute `http(s)` URLs. Hosts may have `www.`; YouTube also `m.`, Facebook also `m.`.
269
304
 
@@ -383,9 +418,36 @@ URL shapes, each tested against Facebook's plugins on `www.facebook.com`, `faceb
383
418
  - The package never uses a Player ID you did not give it.
384
419
  - Playlists are not supported.
385
420
 
421
+ ### Bluesky
422
+
423
+ - Embed code carries the post's permanent address (`at://did:…`), so it renders without a network request. A URL renders only when it names the account by its DID (`bsky.app/profile/did:plc:…/post/…`), as the post link in Bluesky's embed code does.
424
+ - A URL with a handle (`bsky.app/profile/alice.bsky.social/post/…`) needs a lookup to find the DID, and the package makes none: it renders nothing, and `onError` reports `social-embeds: a Bluesky URL needs a lookup: use the embed code`. `matchUrl` returns `null`.
425
+ - The post text from the embed code is rendered on the server and shown until the frame has loaded.
426
+
427
+ ### SoundCloud
428
+
429
+ - A URL renders the visual player (large artwork) at 400 px, as SoundCloud's oEmbed does. Embed code keeps its own player and height: 166 px for the classic player, 300 px for the visual one from the Share dialog.
430
+ - The artist and track links that the Share dialog adds after the iframe are accepted and not rendered.
431
+ - A private track keeps its `secret_token`.
432
+
433
+ ### Apple Music and Apple Podcasts
434
+
435
+ - Albums, songs and playlists from Apple Music; episodes and shows from Apple Podcasts. Apple's embed code has Apple's own `sandbox` and rounded corners, and so does every embed from a URL; `style` replaces the corners.
436
+ - Heights: 175 px for a song, 160 px for an episode, 450 px for an album, playlist or show; `height` replaces them.
437
+ - Music videos and artists are not supported: Apple offers no embed code for them.
438
+
439
+ ### Tumblr
440
+
441
+ - Tumblr's embed code names the post by a token; the package renders it by blog name, which the post link in the same code gives, so URLs work too.
442
+
443
+ ### Kick and Giphy
444
+
445
+ - Kick has no embed dialog: use a channel URL or Kick's player URL in an iframe. Videos and clips are not supported.
446
+ - Giphy's "via GIPHY" credit is accepted and not rendered. A URL carries no size and renders square; `maxWidth` keeps it small.
447
+
386
448
  ### Not supported
387
449
 
388
- - Redirecting short links: `fb.watch/…`, Facebook share links (`/share/p/…`, `/share/v/…`), `vm.tiktok.com/…`, `vt.tiktok.com/…`, `redd.it/…`, Reddit share links (`/r/{sub}/s/…`), `pin.it/…`, `lnkd.in/…`, `t.snapchat.com/…`, `spotify.link/…` and `spotify.app.link/…`. A redirect cannot be followed without a network request, and the package makes none. `matchUrl` returns `null`.
450
+ - Redirecting short links: `fb.watch/…`, Facebook share links (`/share/p/…`, `/share/v/…`), `vm.tiktok.com/…`, `vt.tiktok.com/…`, `redd.it/…`, Reddit share links (`/r/{sub}/s/…`), `pin.it/…`, `lnkd.in/…`, `t.snapchat.com/…`, `spotify.link/…`, `spotify.app.link/…`, `on.soundcloud.com/…` and `gph.is/…`. A redirect cannot be followed without a network request, and the package makes none. `matchUrl` returns `null`.
389
451
  - Facebook group posts.
390
452
  - Fetching embed code from oEmbed endpoints, consent gating and HTML sanitising: these stay with the host.
391
453
 
@@ -1,4 +1,4 @@
1
- type Platform = 'x' | 'instagram' | 'facebook' | 'threads' | 'tiktok' | 'youtube' | 'telegram' | 'snapchat' | 'linkedin' | 'reddit' | 'pinterest' | 'spotify' | 'vimeo' | 'twitch' | 'dailymotion';
1
+ type Platform = 'x' | 'instagram' | 'facebook' | 'threads' | 'tiktok' | 'youtube' | 'telegram' | 'snapchat' | 'linkedin' | 'reddit' | 'pinterest' | 'spotify' | 'vimeo' | 'twitch' | 'dailymotion' | 'bluesky' | 'soundcloud' | 'applemusic' | 'applepodcasts' | 'tumblr' | 'kick' | 'giphy';
2
2
  type ParsedEmbed = {
3
3
  platform: Platform;
4
4
  kind: 'post' | 'video';
@@ -16,7 +16,8 @@ type ParsedEmbed = {
16
16
  declare function matchUrl(url: string): ParsedEmbed | null;
17
17
  /**
18
18
  * Never throws. `null` unless the input is one embed element plus, at most, the platform's
19
- * own scripts, `<div id="fb-root">`, whitespace and comments (docs/decisions.md D14).
19
+ * own scripts, `<div id="fb-root">`, one platform-owned extra such as a credit, whitespace and
20
+ * comments (docs/decisions.md D14).
20
21
  */
21
22
  declare function parseEmbed(html: string): ParsedEmbed | null;
22
23
  export { Platform as i, matchUrl as n, ParsedEmbed as r, parseEmbed as t };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as ParsedEmbed } from "./index-CSSlJIJU.js";
1
+ import { r as ParsedEmbed } from "./index-BOBhkTW6.js";
2
2
  import { ComponentProps, ReactNode } from "react";
3
3
  type EmbedSource = {
4
4
  url: string;
@@ -27,6 +27,16 @@ type FrameProps = SharedProps & {
27
27
  /** The embed is at most this tall, in pixels: it narrows to keep its aspect ratio. */
28
28
  maxHeight?: number;
29
29
  };
30
+ type BlueskyOptions = {
31
+ colorMode?: 'light' | 'dark' | 'system';
32
+ };
33
+ type BlueskyEmbedProps = EmbedSource & Omit<SharedProps, keyof BlueskyOptions> & BlueskyOptions;
34
+ /**
35
+ * At most 600px wide by default, Bluesky's oEmbed width. Renders the frame `embed.js` would
36
+ * create, without the script (docs/decisions.md D77). Only embed code and URLs with a DID
37
+ * render: a handle URL needs a lookup, and `onError` says so.
38
+ */
39
+ export declare function BlueskyEmbed(props: BlueskyEmbedProps): import("react").JSX.Element | null;
30
40
  type DailymotionOptions = {
31
41
  /** The publisher's Player ID from Dailymotion Studio. Replaces the embed code's own. */
32
42
  playerId?: string;
@@ -65,6 +75,14 @@ type InstagramOptions = {
65
75
  };
66
76
  type InstagramEmbedProps = EmbedSource & Omit<SharedProps, keyof InstagramOptions> & InstagramOptions;
67
77
  export declare function InstagramEmbed(props: InstagramEmbedProps): import("react").JSX.Element | null;
78
+ /** Kick's player parameters; undocumented, read from its player URL (docs/decisions.md D75). */
79
+ type KickOptions = {
80
+ autoplay?: boolean;
81
+ muted?: boolean;
82
+ };
83
+ type KickEmbedProps = EmbedSource & Omit<FrameProps, keyof KickOptions> & KickOptions;
84
+ /** A live channel at 16:9. */
85
+ export declare function KickEmbed(props: KickEmbedProps): import("react").JSX.Element | null;
68
86
  type LinkedInOptions = {
69
87
  /** The Embed dialog's "less text" option. */
70
88
  collapsed?: boolean;
@@ -92,6 +110,23 @@ type RedditOptions = {
92
110
  type RedditEmbedProps = EmbedSource & Omit<SharedProps, keyof RedditOptions> & RedditOptions;
93
111
  /** At most 640px wide by default, the width widgets.js gives the frame (docs/decisions.md D52). */
94
112
  export declare function RedditEmbed(props: RedditEmbedProps): import("react").JSX.Element | null;
113
+ /** SoundCloud's player parameters, in camelCase. */
114
+ type SoundCloudOptions = {
115
+ /** The large-artwork player; `false` for the classic one. */
116
+ visual?: boolean;
117
+ /** Accent colour, such as `'#ff5500'`. */
118
+ color?: string;
119
+ autoPlay?: boolean;
120
+ hideRelated?: boolean;
121
+ showComments?: boolean;
122
+ showUser?: boolean;
123
+ showReposts?: boolean;
124
+ showTeaser?: boolean;
125
+ showArtwork?: boolean;
126
+ };
127
+ type SoundCloudEmbedProps = EmbedSource & Omit<FrameProps, keyof SoundCloudOptions> & SoundCloudOptions;
128
+ /** A fixed height: the `height` prop, else the embed code's, else 400px for the visual player. */
129
+ export declare function SoundCloudEmbed(props: SoundCloudEmbedProps): import("react").JSX.Element | null;
95
130
  /** The options of Telegram's post widget configurator (core.telegram.org/widgets/post). */
96
131
  type TelegramOptions = {
97
132
  /** Show the author's photo. */
@@ -214,7 +249,7 @@ type SocialEmbedSource = {
214
249
  url: string;
215
250
  html?: never;
216
251
  };
217
- type PlatformOption = keyof XOptions | keyof InstagramOptions | keyof ThreadsOptions | keyof FacebookOptions | keyof TikTokOptions | keyof YouTubeOptions | keyof TelegramOptions | keyof RedditOptions | keyof LinkedInOptions | keyof PinterestOptions | keyof VimeoOptions | keyof TwitchOptions | keyof DailymotionOptions;
252
+ type PlatformOption = keyof XOptions | keyof InstagramOptions | keyof ThreadsOptions | keyof FacebookOptions | keyof TikTokOptions | keyof YouTubeOptions | keyof TelegramOptions | keyof RedditOptions | keyof LinkedInOptions | keyof PinterestOptions | keyof VimeoOptions | keyof TwitchOptions | keyof DailymotionOptions | keyof BlueskyOptions | keyof SoundCloudOptions | keyof KickOptions;
218
253
  type SocialEmbedProps = SocialEmbedSource & Omit<FrameProps, PlatformOption> & {
219
254
  /**
220
255
  * Called with the original string when `html` is not a recognised embed code. Without
@@ -237,4 +272,16 @@ type SpotifyEmbedProps = EmbedSource & Omit<FrameProps, keyof SpotifyOptions> &
237
272
  * and 352px for the rest. A video show keeps its 16:9 aspect ratio instead.
238
273
  */
239
274
  export declare function SpotifyEmbed(props: SpotifyEmbedProps): import("react").JSX.Element | null;
240
- export type { DailymotionEmbedProps, DailymotionOptions, EmbedSource, FacebookEmbedProps, FacebookOptions, FrameProps, InstagramEmbedProps, InstagramOptions, LinkedInEmbedProps, LinkedInOptions, PinterestEmbedProps, PinterestOptions, RedditEmbedProps, RedditOptions, SharedProps, SnapchatEmbedProps, SocialEmbedProps, SocialEmbedSource, SpotifyEmbedProps, SpotifyOptions, TelegramEmbedProps, TelegramOptions, ThreadsEmbedProps, ThreadsOptions, TikTokEmbedProps, TikTokOptions, TwitchEmbedProps, TwitchOptions, VimeoEmbedProps, VimeoOptions, XEmbedProps, XOptions, YouTubeEmbedProps, YouTubeOptions };
275
+ type AppleMusicEmbedProps = EmbedSource & FrameProps;
276
+ type ApplePodcastsEmbedProps = EmbedSource & FrameProps;
277
+ /** A fixed height: the `height` prop, else the embed code's, else 175px for a song and 450px for the rest. */
278
+ export declare function AppleMusicEmbed(props: AppleMusicEmbedProps): import("react").JSX.Element | null;
279
+ /** A fixed height: the `height` prop, else the embed code's, else 160px for an episode and 450px for a show. */
280
+ export declare function ApplePodcastsEmbed(props: ApplePodcastsEmbedProps): import("react").JSX.Element | null;
281
+ type GiphyEmbedProps = EmbedSource & FrameProps;
282
+ /** The embed code's aspect ratio; a URL carries no size and renders square (docs/decisions.md D76). */
283
+ export declare function GiphyEmbed(props: GiphyEmbedProps): import("react").JSX.Element | null;
284
+ type TumblrEmbedProps = EmbedSource & SharedProps;
285
+ /** At most 540px wide by default, Tumblr's oEmbed width. Renders the frame `post.js` would create (docs/decisions.md D77). */
286
+ export declare function TumblrEmbed(props: TumblrEmbedProps): import("react").JSX.Element | null;
287
+ export type { AppleMusicEmbedProps, ApplePodcastsEmbedProps, BlueskyEmbedProps, BlueskyOptions, DailymotionEmbedProps, DailymotionOptions, EmbedSource, FacebookEmbedProps, FacebookOptions, FrameProps, GiphyEmbedProps, InstagramEmbedProps, InstagramOptions, KickEmbedProps, KickOptions, LinkedInEmbedProps, LinkedInOptions, PinterestEmbedProps, PinterestOptions, RedditEmbedProps, RedditOptions, SharedProps, SnapchatEmbedProps, SocialEmbedProps, SocialEmbedSource, SoundCloudEmbedProps, SoundCloudOptions, SpotifyEmbedProps, SpotifyOptions, TelegramEmbedProps, TelegramOptions, ThreadsEmbedProps, ThreadsOptions, TikTokEmbedProps, TikTokOptions, TumblrEmbedProps, TwitchEmbedProps, TwitchOptions, VimeoEmbedProps, VimeoOptions, XEmbedProps, XOptions, YouTubeEmbedProps, YouTubeOptions };