social-embeds 0.9.2 → 0.9.3
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 +1 -1
- package/dist/components/apple-embed.js +4 -4
- package/dist/components/bluesky-embed.js +2 -2
- package/dist/components/dailymotion-embed.js +2 -2
- package/dist/components/facebook-embed.js +2 -2
- package/dist/components/flickr-embed.js +2 -2
- package/dist/components/giphy-embed.js +2 -2
- package/dist/components/imgur-embed.js +2 -2
- package/dist/components/instagram-embed.js +2 -2
- package/dist/components/kick-embed.js +2 -2
- package/dist/components/linkedin-embed.js +2 -2
- package/dist/components/pinterest-embed.js +2 -2
- package/dist/components/reddit-embed.js +2 -2
- package/dist/components/rumble-embed.js +2 -2
- package/dist/components/snapchat-embed.js +2 -2
- package/dist/components/soundcloud-embed.js +2 -2
- package/dist/components/spotify-embed.js +2 -2
- package/dist/components/strava-embed.js +2 -2
- package/dist/components/streamable-embed.js +2 -2
- package/dist/components/telegram-embed.js +2 -2
- package/dist/components/tenor-embed.js +2 -2
- package/dist/components/threads-embed.js +2 -2
- package/dist/components/tiktok-embed.js +2 -2
- package/dist/components/truthsocial-embed.js +2 -2
- package/dist/components/tumblr-embed.js +2 -2
- package/dist/components/twitch-embed.js +2 -2
- package/dist/components/vimeo-embed.js +2 -2
- package/dist/components/x-embed.js +2 -2
- package/dist/components/youtube-embed.js +2 -2
- package/dist/element.js +1 -1
- package/dist/parser/matchers/applemusic.js +33 -0
- package/dist/parser/matchers/applepodcasts.js +32 -0
- package/dist/parser/matchers/bluesky.js +41 -0
- package/dist/parser/matchers/dailymotion.js +47 -0
- package/dist/parser/matchers/facebook.js +118 -0
- package/dist/parser/matchers/flickr.js +100 -0
- package/dist/parser/matchers/giphy.js +38 -0
- package/dist/parser/matchers/imgur.js +76 -0
- package/dist/parser/matchers/instagram.js +43 -0
- package/dist/parser/matchers/kick.js +48 -0
- package/dist/parser/matchers/linkedin.js +31 -0
- package/dist/parser/matchers/pinterest.js +32 -0
- package/dist/parser/matchers/reddit.js +43 -0
- package/dist/parser/matchers/rumble.js +32 -0
- package/dist/parser/matchers/snapchat.js +60 -0
- package/dist/parser/matchers/soundcloud.js +87 -0
- package/dist/parser/matchers/spotify.js +39 -0
- package/dist/parser/matchers/strava.js +31 -0
- package/dist/parser/matchers/streamable.js +59 -0
- package/dist/parser/matchers/telegram.js +34 -0
- package/dist/parser/matchers/tenor.js +34 -0
- package/dist/parser/matchers/threads.js +36 -0
- package/dist/parser/matchers/tiktok.js +25 -0
- package/dist/parser/matchers/truthsocial.js +34 -0
- package/dist/parser/matchers/tumblr.js +51 -0
- package/dist/parser/matchers/twitch.js +90 -0
- package/dist/parser/matchers/vimeo.js +71 -0
- package/dist/parser/matchers/x.js +50 -0
- package/dist/parser/matchers/youtube.js +123 -0
- package/dist/parser/platform.d.ts +10 -4
- package/dist/parser/platforms/applemusic.js +4 -30
- package/dist/parser/platforms/applepodcasts.js +4 -29
- package/dist/parser/platforms/bluesky.js +4 -38
- package/dist/parser/platforms/dailymotion.js +4 -44
- package/dist/parser/platforms/facebook.js +5 -115
- package/dist/parser/platforms/flickr.js +5 -98
- package/dist/parser/platforms/giphy.js +4 -35
- package/dist/parser/platforms/imgur.js +4 -73
- package/dist/parser/platforms/instagram.js +4 -40
- package/dist/parser/platforms/kick.js +4 -45
- package/dist/parser/platforms/linkedin.js +4 -28
- package/dist/parser/platforms/pinterest.js +4 -29
- package/dist/parser/platforms/reddit.js +3 -40
- package/dist/parser/platforms/rumble.js +3 -29
- package/dist/parser/platforms/snapchat.js +3 -57
- package/dist/parser/platforms/soundcloud.js +4 -84
- package/dist/parser/platforms/spotify.js +4 -36
- package/dist/parser/platforms/strava.js +3 -28
- package/dist/parser/platforms/streamable.js +3 -56
- package/dist/parser/platforms/telegram.js +3 -31
- package/dist/parser/platforms/tenor.js +5 -32
- package/dist/parser/platforms/threads.js +4 -33
- package/dist/parser/platforms/tiktok.js +4 -22
- package/dist/parser/platforms/truthsocial.js +3 -31
- package/dist/parser/platforms/tumblr.js +3 -48
- package/dist/parser/platforms/twitch.js +4 -87
- package/dist/parser/platforms/vimeo.js +4 -68
- package/dist/parser/platforms/x.js +6 -46
- package/dist/parser/platforms/youtube.js +5 -120
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ export const SocialEmbed = createSocialEmbed([
|
|
|
121
121
|
|
|
122
122
|
Each platform component takes a `url`, or an `embed` already parsed by [`social-embeds/parser`](#parser), plus the shared props and its own option props. Option props override options from the embed code.
|
|
123
123
|
|
|
124
|
-
A platform component bundles only its own platform's parser: one component adds about 3
|
|
124
|
+
A platform component bundles only its own platform's parser: one component adds about 3 to 5 KB gzipped to an app (`FacebookEmbed` about 7 KB), against about 27 KB for `<SocialEmbed>`, which recognises every platform. A URL of another platform is reported as `social-embeds: not a {Platform} post URL: …`, and an `embed` of another platform as `social-embeds: expected a {Platform} embed, got {id}`.
|
|
125
125
|
|
|
126
126
|
```tsx
|
|
127
127
|
import {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { appleMusicPlan, applePodcastsPlan } from "../core/plans/apple.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { applemusicMatcher } from "../parser/matchers/applemusic.js";
|
|
3
|
+
import { applepodcastsMatcher } from "../parser/matchers/applepodcasts.js";
|
|
4
4
|
import { usePlan } from "./use-plan.js";
|
|
5
5
|
import { frameOf } from "./iframe-embed.js";
|
|
6
6
|
// src/components/apple-embed.tsx
|
|
7
7
|
/** A fixed height: the `height` prop, else the embed code's, else 175px for a song and 450px for the rest. */
|
|
8
8
|
function AppleMusicEmbed(props) {
|
|
9
|
-
const [plan, frame] = usePlan(props,
|
|
9
|
+
const [plan, frame] = usePlan(props, applemusicMatcher, [], appleMusicPlan);
|
|
10
10
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
11
11
|
}
|
|
12
12
|
/** A fixed height: the `height` prop, else the embed code's, else 160px for an episode and 450px for a show. */
|
|
13
13
|
function ApplePodcastsEmbed(props) {
|
|
14
|
-
const [plan, frame] = usePlan(props,
|
|
14
|
+
const [plan, frame] = usePlan(props, applepodcastsMatcher, [], applePodcastsPlan);
|
|
15
15
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
16
16
|
}
|
|
17
17
|
export { AppleMusicEmbed, ApplePodcastsEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { blueskyPlan } from "../core/plans/bluesky.js";
|
|
2
|
-
import {
|
|
2
|
+
import { blueskyMatcher } from "../parser/matchers/bluesky.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { fallbackPlaceholder, frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/bluesky-embed.tsx
|
|
@@ -10,7 +10,7 @@ const BLUESKY_OPTIONS = ["colorMode"];
|
|
|
10
10
|
* render: a handle URL needs a lookup, and `onError` says so.
|
|
11
11
|
*/
|
|
12
12
|
function BlueskyEmbed(props) {
|
|
13
|
-
const [plan, frame] = usePlan(props,
|
|
13
|
+
const [plan, frame] = usePlan(props, blueskyMatcher, BLUESKY_OPTIONS, blueskyPlan);
|
|
14
14
|
return plan?.kind === "iframe" ? frameOf(plan, frame, fallbackPlaceholder) : null;
|
|
15
15
|
}
|
|
16
16
|
export { BlueskyEmbed };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dailymotionMatcher } from "../parser/matchers/dailymotion.js";
|
|
2
2
|
import { dailymotionPlan } from "../core/plans/dailymotion.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
@@ -14,7 +14,7 @@ const DAILYMOTION_OPTIONS = [
|
|
|
14
14
|
* prop, never another account's (docs/decisions.md D63).
|
|
15
15
|
*/
|
|
16
16
|
function DailymotionEmbed(props) {
|
|
17
|
-
const [plan, frame] = usePlan(props,
|
|
17
|
+
const [plan, frame] = usePlan(props, dailymotionMatcher, DAILYMOTION_OPTIONS, dailymotionPlan);
|
|
18
18
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
19
19
|
}
|
|
20
20
|
export { DailymotionEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { facebookPlan } from "../core/plans/facebook.js";
|
|
2
|
-
import {
|
|
2
|
+
import { facebookMatcher } from "../parser/matchers/facebook.js";
|
|
3
3
|
import { frameOf } from "./iframe-embed.js";
|
|
4
4
|
import { scriptOf } from "./script-embed.js";
|
|
5
5
|
import { usePlan } from "./use-plan.js";
|
|
@@ -12,7 +12,7 @@ const FACEBOOK_OPTIONS = [
|
|
|
12
12
|
"showCaptions"
|
|
13
13
|
];
|
|
14
14
|
function FacebookEmbed(props) {
|
|
15
|
-
const [plan, frame] = usePlan(props,
|
|
15
|
+
const [plan, frame] = usePlan(props, facebookMatcher, FACEBOOK_OPTIONS, facebookPlan);
|
|
16
16
|
if (plan?.kind === "iframe") return frameOf(plan, frame);
|
|
17
17
|
return plan?.kind === "script" ? scriptOf(plan, frame) : null;
|
|
18
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { flickrPlan } from "../core/plans/flickr.js";
|
|
2
|
-
import {
|
|
2
|
+
import { flickrMatcher } from "../parser/matchers/flickr.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { fallbackPlaceholder, frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/flickr-embed.tsx
|
|
@@ -10,7 +10,7 @@ const FLICKR_OPTIONS = [
|
|
|
10
10
|
];
|
|
11
11
|
/** Embed code keeps its image's ratio and is at most as wide as the image; a URL renders at 4:3 (docs/decisions.md D98). */
|
|
12
12
|
function FlickrEmbed(props) {
|
|
13
|
-
const [plan, frame] = usePlan(props,
|
|
13
|
+
const [plan, frame] = usePlan(props, flickrMatcher, FLICKR_OPTIONS, flickrPlan);
|
|
14
14
|
return plan?.kind === "iframe" ? frameOf(plan, frame, fallbackPlaceholder) : null;
|
|
15
15
|
}
|
|
16
16
|
export { FlickrEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { giphyPlan } from "../core/plans/giphy.js";
|
|
2
|
-
import {
|
|
2
|
+
import { giphyMatcher } from "../parser/matchers/giphy.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/giphy-embed.tsx
|
|
6
6
|
/** The embed code's aspect ratio; a URL carries no size and renders square (docs/decisions.md D76). */
|
|
7
7
|
function GiphyEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, giphyMatcher, [], giphyPlan);
|
|
9
9
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { GiphyEmbed };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { imgurPlan } from "../core/plans/imgur.js";
|
|
2
|
-
import {
|
|
2
|
+
import { imgurMatcher } from "../parser/matchers/imgur.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { fallbackPlaceholder, frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/imgur-embed.tsx
|
|
6
6
|
const IMGUR_OPTIONS = ["context"];
|
|
7
7
|
/** At most 540px wide by default, the widest `embed.js` makes the frame (docs/decisions.md D94). */
|
|
8
8
|
function ImgurEmbed(props) {
|
|
9
|
-
const [plan, frame] = usePlan(props,
|
|
9
|
+
const [plan, frame] = usePlan(props, imgurMatcher, IMGUR_OPTIONS, imgurPlan);
|
|
10
10
|
return plan?.kind === "iframe" ? frameOf(plan, frame, fallbackPlaceholder) : null;
|
|
11
11
|
}
|
|
12
12
|
export { ImgurEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { instagramPlan } from "../core/plans/instagram.js";
|
|
2
|
-
import {
|
|
2
|
+
import { instagramMatcher } from "../parser/matchers/instagram.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { scriptOf } from "./script-embed.js";
|
|
5
5
|
// src/components/instagram-embed.tsx
|
|
6
6
|
const INSTAGRAM_OPTIONS = ["captioned"];
|
|
7
7
|
function InstagramEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, instagramMatcher, INSTAGRAM_OPTIONS, instagramPlan);
|
|
9
9
|
return plan?.kind === "script" ? scriptOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { InstagramEmbed };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { kickPlan } from "../core/plans/kick.js";
|
|
2
|
-
import {
|
|
2
|
+
import { kickMatcher } from "../parser/matchers/kick.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/kick-embed.tsx
|
|
6
6
|
const KICK_OPTIONS = ["autoplay", "muted"];
|
|
7
7
|
/** A live channel at 16:9. */
|
|
8
8
|
function KickEmbed(props) {
|
|
9
|
-
const [plan, frame] = usePlan(props,
|
|
9
|
+
const [plan, frame] = usePlan(props, kickMatcher, KICK_OPTIONS, kickPlan);
|
|
10
10
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
11
11
|
}
|
|
12
12
|
export { KickEmbed };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { linkedinPlan } from "../core/plans/linkedin.js";
|
|
2
|
-
import {
|
|
2
|
+
import { linkedinMatcher } from "../parser/matchers/linkedin.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/linkedin-embed.tsx
|
|
6
6
|
const LINKEDIN_OPTIONS = ["collapsed"];
|
|
7
7
|
/** A fixed height: the `height` prop, else the embed code's, else 670px. */
|
|
8
8
|
function LinkedInEmbed(props) {
|
|
9
|
-
const [plan, frame] = usePlan(props,
|
|
9
|
+
const [plan, frame] = usePlan(props, linkedinMatcher, LINKEDIN_OPTIONS, linkedinPlan);
|
|
10
10
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
11
11
|
}
|
|
12
12
|
export { LinkedInEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { pinterestPlan } from "../core/plans/pinterest.js";
|
|
2
|
-
import {
|
|
2
|
+
import { pinterestMatcher } from "../parser/matchers/pinterest.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { scriptOf } from "./script-embed.js";
|
|
5
5
|
// src/components/pinterest-embed.tsx
|
|
6
6
|
const PINTEREST_OPTIONS = ["pinWidth"];
|
|
7
7
|
function PinterestEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, pinterestMatcher, PINTEREST_OPTIONS, pinterestPlan);
|
|
9
9
|
return plan?.kind === "script" ? scriptOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { PinterestEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { redditPlan } from "../core/plans/reddit.js";
|
|
2
|
-
import {
|
|
2
|
+
import { redditMatcher } from "../parser/matchers/reddit.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/reddit-embed.tsx
|
|
@@ -13,7 +13,7 @@ const REDDIT_OPTIONS = [
|
|
|
13
13
|
];
|
|
14
14
|
/** At most 640px wide by default, the width widgets.js gives the frame (docs/decisions.md D52). */
|
|
15
15
|
function RedditEmbed(props) {
|
|
16
|
-
const [plan, frame] = usePlan(props,
|
|
16
|
+
const [plan, frame] = usePlan(props, redditMatcher, REDDIT_OPTIONS, redditPlan);
|
|
17
17
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
18
18
|
}
|
|
19
19
|
export { RedditEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { rumblePlan } from "../core/plans/rumble.js";
|
|
2
|
-
import {
|
|
2
|
+
import { rumbleMatcher } from "../parser/matchers/rumble.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/rumble-embed.tsx
|
|
6
6
|
/** Embed code only: a page URL holds another id than the player (docs/decisions.md D99). */
|
|
7
7
|
function RumbleEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, rumbleMatcher, [], rumblePlan);
|
|
9
9
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { RumbleEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { snapchatPlan } from "../core/plans/snapchat.js";
|
|
2
|
-
import {
|
|
2
|
+
import { snapchatMatcher } from "../parser/matchers/snapchat.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/snapchat-embed.tsx
|
|
6
6
|
/** At most 416px wide by default, the size of Snapchat's own embed code (docs/decisions.md D50). */
|
|
7
7
|
function SnapchatEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, snapchatMatcher, [], snapchatPlan);
|
|
9
9
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { SnapchatEmbed };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { soundcloudMatcher } from "../parser/matchers/soundcloud.js";
|
|
2
2
|
import { soundcloudPlan } from "../core/plans/soundcloud.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
@@ -16,7 +16,7 @@ const SOUNDCLOUD_OPTIONS = [
|
|
|
16
16
|
];
|
|
17
17
|
/** A fixed height: the `height` prop, else the embed code's, else 400px for the visual player. */
|
|
18
18
|
function SoundCloudEmbed(props) {
|
|
19
|
-
const [plan, frame] = usePlan(props,
|
|
19
|
+
const [plan, frame] = usePlan(props, soundcloudMatcher, SOUNDCLOUD_OPTIONS, soundcloudPlan);
|
|
20
20
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
21
21
|
}
|
|
22
22
|
export { SoundCloudEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spotifyPlan } from "../core/plans/spotify.js";
|
|
2
|
-
import {
|
|
2
|
+
import { spotifyMatcher } from "../parser/matchers/spotify.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/spotify-embed.tsx
|
|
@@ -9,7 +9,7 @@ const SPOTIFY_OPTIONS = ["theme"];
|
|
|
9
9
|
* and 352px for the rest. A video show keeps its 16:9 aspect ratio instead.
|
|
10
10
|
*/
|
|
11
11
|
function SpotifyEmbed(props) {
|
|
12
|
-
const [plan, frame] = usePlan(props,
|
|
12
|
+
const [plan, frame] = usePlan(props, spotifyMatcher, SPOTIFY_OPTIONS, spotifyPlan);
|
|
13
13
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
14
14
|
}
|
|
15
15
|
export { SpotifyEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stravaPlan } from "../core/plans/strava.js";
|
|
2
|
-
import {
|
|
2
|
+
import { stravaMatcher } from "../parser/matchers/strava.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/strava-embed.tsx
|
|
@@ -10,7 +10,7 @@ const STRAVA_OPTIONS = [
|
|
|
10
10
|
];
|
|
11
11
|
/** At most 554px wide by default, as `embed.js` makes the frame; a full-width route has no maximum (docs/decisions.md D97). */
|
|
12
12
|
function StravaEmbed(props) {
|
|
13
|
-
const [plan, frame] = usePlan(props,
|
|
13
|
+
const [plan, frame] = usePlan(props, stravaMatcher, STRAVA_OPTIONS, stravaPlan);
|
|
14
14
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
15
15
|
}
|
|
16
16
|
export { StravaEmbed };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { streamableMatcher } from "../parser/matchers/streamable.js";
|
|
2
2
|
import { streamablePlan } from "../core/plans/streamable.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
@@ -12,7 +12,7 @@ const STREAMABLE_OPTIONS = [
|
|
|
12
12
|
];
|
|
13
13
|
/** The embed code's aspect ratio, else 16:9. */
|
|
14
14
|
function StreamableEmbed(props) {
|
|
15
|
-
const [plan, frame] = usePlan(props,
|
|
15
|
+
const [plan, frame] = usePlan(props, streamableMatcher, STREAMABLE_OPTIONS, streamablePlan);
|
|
16
16
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
17
17
|
}
|
|
18
18
|
export { StreamableEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { telegramPlan } from "../core/plans/telegram.js";
|
|
2
|
-
import {
|
|
2
|
+
import { telegramMatcher } from "../parser/matchers/telegram.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/telegram-embed.tsx
|
|
@@ -11,7 +11,7 @@ const TELEGRAM_OPTIONS = [
|
|
|
11
11
|
];
|
|
12
12
|
/** At most 500px wide by default, the widest the post renders (docs/decisions.md D49). */
|
|
13
13
|
function TelegramEmbed(props) {
|
|
14
|
-
const [plan, frame] = usePlan(props,
|
|
14
|
+
const [plan, frame] = usePlan(props, telegramMatcher, TELEGRAM_OPTIONS, telegramPlan);
|
|
15
15
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
16
16
|
}
|
|
17
17
|
export { TelegramEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { tenorPlan } from "../core/plans/tenor.js";
|
|
2
|
-
import {
|
|
2
|
+
import { tenorMatcher } from "../parser/matchers/tenor.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/tenor-embed.tsx
|
|
6
6
|
/** The embed code's aspect ratio; a URL carries no size and renders at 1.33:1 (docs/decisions.md D95). */
|
|
7
7
|
function TenorEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, tenorMatcher, [], tenorPlan);
|
|
9
9
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { TenorEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { threadsPlan } from "../core/plans/threads.js";
|
|
2
|
-
import {
|
|
2
|
+
import { threadsMatcher } from "../parser/matchers/threads.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { scriptOf } from "./script-embed.js";
|
|
5
5
|
// src/components/threads-embed.tsx
|
|
6
6
|
const THREADS_OPTIONS = ["theme"];
|
|
7
7
|
function ThreadsEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, threadsMatcher, THREADS_OPTIONS, threadsPlan);
|
|
9
9
|
return plan?.kind === "script" ? scriptOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { ThreadsEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tiktokPlan } from "../core/plans/tiktok.js";
|
|
2
|
-
import {
|
|
2
|
+
import { tiktokMatcher } from "../parser/matchers/tiktok.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/tiktok-embed.tsx
|
|
@@ -21,7 +21,7 @@ const TIKTOK_OPTIONS = [
|
|
|
21
21
|
];
|
|
22
22
|
/** At most 325px wide by default, the size of TikTok's own embed code (docs/decisions.md D40). */
|
|
23
23
|
function TikTokEmbed(props) {
|
|
24
|
-
const [plan, frame] = usePlan(props,
|
|
24
|
+
const [plan, frame] = usePlan(props, tiktokMatcher, TIKTOK_OPTIONS, tiktokPlan);
|
|
25
25
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
26
26
|
}
|
|
27
27
|
export { TikTokEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { truthSocialPlan } from "../core/plans/truthsocial.js";
|
|
2
|
-
import {
|
|
2
|
+
import { truthsocialMatcher } from "../parser/matchers/truthsocial.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/truthsocial-embed.tsx
|
|
6
6
|
/** At most 600px wide by default, the width of Truth Social's embed code (docs/decisions.md D93). */
|
|
7
7
|
function TruthSocialEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, truthsocialMatcher, [], truthSocialPlan);
|
|
9
9
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { TruthSocialEmbed };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { tumblrPlan } from "../core/plans/tumblr.js";
|
|
2
|
-
import {
|
|
2
|
+
import { tumblrMatcher } from "../parser/matchers/tumblr.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/tumblr-embed.tsx
|
|
6
6
|
/** At most 540px wide by default, Tumblr's oEmbed width. Renders the frame `post.js` would create (docs/decisions.md D77). */
|
|
7
7
|
function TumblrEmbed(props) {
|
|
8
|
-
const [plan, frame] = usePlan(props,
|
|
8
|
+
const [plan, frame] = usePlan(props, tumblrMatcher, [], tumblrPlan);
|
|
9
9
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
10
10
|
}
|
|
11
11
|
export { TumblrEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { twitchPlan } from "../core/plans/twitch.js";
|
|
2
|
-
import {
|
|
2
|
+
import { twitchMatcher } from "../parser/matchers/twitch.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/twitch-embed.tsx
|
|
@@ -10,7 +10,7 @@ const TWITCH_OPTIONS = [
|
|
|
10
10
|
];
|
|
11
11
|
/** `parent` is the page's own host, added on the client (docs/decisions.md D62, D65). */
|
|
12
12
|
function TwitchEmbed(props) {
|
|
13
|
-
const [plan, frame] = usePlan(props,
|
|
13
|
+
const [plan, frame] = usePlan(props, twitchMatcher, TWITCH_OPTIONS, twitchPlan);
|
|
14
14
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
15
15
|
}
|
|
16
16
|
export { TwitchEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { vimeoPlan } from "../core/plans/vimeo.js";
|
|
2
|
-
import {
|
|
2
|
+
import { vimeoMatcher } from "../parser/matchers/vimeo.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/vimeo-embed.tsx
|
|
@@ -24,7 +24,7 @@ const VIMEO_OPTIONS = [
|
|
|
24
24
|
"t"
|
|
25
25
|
];
|
|
26
26
|
function VimeoEmbed(props) {
|
|
27
|
-
const [plan, frame] = usePlan(props,
|
|
27
|
+
const [plan, frame] = usePlan(props, vimeoMatcher, VIMEO_OPTIONS, vimeoPlan);
|
|
28
28
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
29
29
|
}
|
|
30
30
|
export { VimeoEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { xPlan } from "../core/plans/x.js";
|
|
2
|
-
import {
|
|
2
|
+
import { xMatcher } from "../parser/matchers/x.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { scriptOf } from "./script-embed.js";
|
|
5
5
|
// src/components/x-embed.tsx
|
|
@@ -12,7 +12,7 @@ const X_OPTIONS = [
|
|
|
12
12
|
"dnt"
|
|
13
13
|
];
|
|
14
14
|
function XEmbed(props) {
|
|
15
|
-
const [plan, frame] = usePlan(props,
|
|
15
|
+
const [plan, frame] = usePlan(props, xMatcher, X_OPTIONS, xPlan);
|
|
16
16
|
return plan?.kind === "script" ? scriptOf(plan, frame) : null;
|
|
17
17
|
}
|
|
18
18
|
export { XEmbed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { youtubePlan } from "../core/plans/youtube.js";
|
|
2
|
-
import {
|
|
2
|
+
import { youtubeMatcher } from "../parser/matchers/youtube.js";
|
|
3
3
|
import { usePlan } from "./use-plan.js";
|
|
4
4
|
import { frameOf } from "./iframe-embed.js";
|
|
5
5
|
// src/components/youtube-embed.tsx
|
|
@@ -27,7 +27,7 @@ const YOUTUBE_OPTIONS = [
|
|
|
27
27
|
"nocookie"
|
|
28
28
|
];
|
|
29
29
|
function YouTubeEmbed(props) {
|
|
30
|
-
const [plan, frame] = usePlan(props,
|
|
30
|
+
const [plan, frame] = usePlan(props, youtubeMatcher, YOUTUBE_OPTIONS, youtubePlan);
|
|
31
31
|
return plan?.kind === "iframe" ? frameOf(plan, frame) : null;
|
|
32
32
|
}
|
|
33
33
|
export { YouTubeEmbed };
|