social-embeds 0.7.1 → 0.8.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 +63 -51
- package/dist/components/apple-embed.d.ts +7 -0
- package/dist/components/apple-embed.js +39 -0
- package/dist/components/bluesky-embed.d.ts +10 -0
- package/dist/components/bluesky-embed.js +27 -0
- package/dist/components/dailymotion-embed.d.ts +9 -0
- package/dist/components/dailymotion-embed.js +30 -0
- package/dist/components/facebook-embed.d.ts +6 -0
- package/dist/components/facebook-embed.js +40 -0
- package/dist/components/flickr-embed.d.ts +6 -0
- package/dist/components/flickr-embed.js +27 -0
- package/dist/components/generic-iframe-embed.d.ts +11 -0
- package/dist/components/generic-iframe-embed.js +26 -0
- package/dist/components/giphy-embed.d.ts +4 -0
- package/dist/components/giphy-embed.js +22 -0
- package/dist/components/hooks.js +38 -0
- package/dist/components/iframe-embed.js +169 -0
- package/dist/components/imgur-embed.d.ts +6 -0
- package/dist/components/imgur-embed.js +23 -0
- package/dist/components/instagram-embed.d.ts +5 -0
- package/dist/components/instagram-embed.js +25 -0
- package/dist/components/kick-embed.d.ts +6 -0
- package/dist/components/kick-embed.js +25 -0
- package/dist/components/linkedin-embed.d.ts +6 -0
- package/dist/components/linkedin-embed.js +23 -0
- package/dist/components/pinterest-embed.d.ts +5 -0
- package/dist/components/pinterest-embed.js +25 -0
- package/dist/components/reddit-embed.d.ts +6 -0
- package/dist/components/reddit-embed.js +29 -0
- package/dist/components/rumble-embed.d.ts +4 -0
- package/dist/components/rumble-embed.js +22 -0
- package/dist/components/script-embed.js +108 -0
- package/dist/components/shared.d.ts +29 -0
- package/dist/components/snapchat-embed.d.ts +4 -0
- package/dist/components/snapchat-embed.js +22 -0
- package/dist/components/social-embed.d.ts +60 -0
- package/dist/components/social-embed.js +221 -0
- package/dist/components/soundcloud-embed.d.ts +6 -0
- package/dist/components/soundcloud-embed.js +33 -0
- package/dist/components/spotify-embed.d.ts +9 -0
- package/dist/components/spotify-embed.js +25 -0
- package/dist/components/strava-embed.d.ts +6 -0
- package/dist/components/strava-embed.js +26 -0
- package/dist/components/streamable-embed.d.ts +6 -0
- package/dist/components/streamable-embed.js +28 -0
- package/dist/components/telegram-embed.d.ts +6 -0
- package/dist/components/telegram-embed.js +27 -0
- package/dist/components/tenor-embed.d.ts +4 -0
- package/dist/components/tenor-embed.js +22 -0
- package/dist/components/threads-embed.d.ts +5 -0
- package/dist/components/threads-embed.js +25 -0
- package/dist/components/tiktok-embed.d.ts +6 -0
- package/dist/components/tiktok-embed.js +37 -0
- package/dist/components/truthsocial-embed.d.ts +4 -0
- package/dist/components/truthsocial-embed.js +22 -0
- package/dist/components/tumblr-embed.d.ts +4 -0
- package/dist/components/tumblr-embed.js +22 -0
- package/dist/components/twitch-embed.d.ts +6 -0
- package/dist/components/twitch-embed.js +26 -0
- package/dist/components/vimeo-embed.d.ts +5 -0
- package/dist/components/vimeo-embed.js +40 -0
- package/dist/components/x-embed.d.ts +5 -0
- package/dist/components/x-embed.js +32 -0
- package/dist/components/youtube-embed.d.ts +5 -0
- package/dist/components/youtube-embed.js +43 -0
- package/dist/core/drivers.js +125 -0
- package/dist/core/layout.js +73 -0
- package/dist/core/markup.js +30 -0
- package/dist/core/params.js +26 -0
- package/dist/core/plans/apple.js +44 -0
- package/dist/core/plans/bluesky.d.ts +3 -0
- package/dist/core/plans/bluesky.js +34 -0
- package/dist/core/plans/dailymotion.d.ts +8 -0
- package/dist/core/plans/dailymotion.js +37 -0
- package/dist/core/plans/facebook.d.ts +15 -0
- package/dist/core/plans/facebook.js +79 -0
- package/dist/core/plans/flickr.d.ts +7 -0
- package/dist/core/plans/flickr.js +37 -0
- package/dist/core/plans/generic.js +44 -0
- package/dist/core/plans/giphy.js +16 -0
- package/dist/core/plans/imgur.d.ts +4 -0
- package/dist/core/plans/imgur.js +34 -0
- package/dist/core/plans/instagram.d.ts +4 -0
- package/dist/core/plans/instagram.js +26 -0
- package/dist/core/plans/kick.d.ts +5 -0
- package/dist/core/plans/kick.js +22 -0
- package/dist/core/plans/linkedin.d.ts +4 -0
- package/dist/core/plans/linkedin.js +23 -0
- package/dist/core/plans/pinterest.d.ts +4 -0
- package/dist/core/plans/pinterest.js +31 -0
- package/dist/core/plans/reddit.d.ts +11 -0
- package/dist/core/plans/reddit.js +46 -0
- package/dist/core/plans/rumble.js +21 -0
- package/dist/core/plans/snapchat.js +20 -0
- package/dist/core/plans/soundcloud.d.ts +14 -0
- package/dist/core/plans/soundcloud.js +37 -0
- package/dist/core/plans/spotify.d.ts +4 -0
- package/dist/core/plans/spotify.js +29 -0
- package/dist/core/plans/strava.d.ts +8 -0
- package/dist/core/plans/strava.js +38 -0
- package/dist/core/plans/streamable.d.ts +8 -0
- package/dist/core/plans/streamable.js +31 -0
- package/dist/core/plans/telegram.d.ts +10 -0
- package/dist/core/plans/telegram.js +59 -0
- package/dist/core/plans/tenor.js +16 -0
- package/dist/core/plans/threads.d.ts +4 -0
- package/dist/core/plans/threads.js +25 -0
- package/dist/core/plans/tiktok.d.ts +17 -0
- package/dist/core/plans/tiktok.js +36 -0
- package/dist/core/plans/truthsocial.js +43 -0
- package/dist/core/plans/tumblr.js +29 -0
- package/dist/core/plans/twitch.d.ts +7 -0
- package/dist/core/plans/twitch.js +38 -0
- package/dist/core/plans/vimeo.d.ts +23 -0
- package/dist/core/plans/vimeo.js +42 -0
- package/dist/core/plans/x.d.ts +12 -0
- package/dist/core/plans/x.js +31 -0
- package/dist/core/plans/youtube.d.ts +25 -0
- package/dist/core/plans/youtube.js +59 -0
- package/dist/core/post-link.js +19 -0
- package/dist/core/resolve.js +57 -0
- package/dist/core/timing.js +7 -0
- package/dist/element.d.ts +1 -1
- package/dist/element.js +1 -1
- package/dist/index.d.ts +53 -344
- package/dist/index.js +30 -2575
- package/dist/loader/load-script.js +116 -0
- package/dist/loader/platform-scripts.js +89 -0
- package/dist/parser/frames.js +70 -0
- package/dist/parser/html.js +172 -0
- package/dist/parser/iframe.d.ts +24 -0
- package/dist/parser/iframe.js +151 -0
- package/dist/parser/lookup.js +20 -0
- package/dist/parser/match-url.d.ts +3 -0
- package/dist/parser/match-url.js +22 -0
- package/dist/parser/parse-embed.d.ts +7 -0
- package/dist/parser/parse-embed.js +69 -0
- package/dist/parser/platform.js +60 -0
- package/dist/parser/platforms/applemusic.js +45 -0
- package/dist/parser/platforms/applepodcasts.js +41 -0
- package/dist/parser/platforms/bluesky.js +64 -0
- package/dist/parser/platforms/dailymotion.js +57 -0
- package/dist/parser/platforms/facebook.js +181 -0
- package/dist/parser/platforms/flickr.js +134 -0
- package/dist/parser/platforms/giphy.js +68 -0
- package/dist/parser/platforms/imgur.js +107 -0
- package/dist/parser/platforms/index.js +62 -0
- package/dist/parser/platforms/instagram.js +59 -0
- package/dist/parser/platforms/kick.js +61 -0
- package/dist/parser/platforms/linkedin.js +42 -0
- package/dist/parser/platforms/pinterest.js +59 -0
- package/dist/parser/platforms/reddit.js +69 -0
- package/dist/parser/platforms/rumble.js +44 -0
- package/dist/parser/platforms/snapchat.js +87 -0
- package/dist/parser/platforms/soundcloud.js +128 -0
- package/dist/parser/platforms/spotify.js +51 -0
- package/dist/parser/platforms/strava.js +55 -0
- package/dist/parser/platforms/streamable.js +95 -0
- package/dist/parser/platforms/telegram.js +61 -0
- package/dist/parser/platforms/tenor.js +79 -0
- package/dist/parser/platforms/threads.js +51 -0
- package/dist/parser/platforms/tiktok.js +48 -0
- package/dist/parser/platforms/truthsocial.js +50 -0
- package/dist/parser/platforms/tumblr.js +72 -0
- package/dist/parser/platforms/twitch.js +128 -0
- package/dist/parser/platforms/vimeo.js +95 -0
- package/dist/parser/platforms/x.js +65 -0
- package/dist/parser/platforms/youtube.js +140 -0
- package/dist/parser/types.d.ts +14 -0
- package/dist/parser/url.js +41 -0
- package/dist/parser/verify.js +63 -0
- package/dist/parser.d.ts +4 -1
- package/dist/parser.js +4 -1
- package/package.json +1 -1
- package/dist/index-DrMHAkyG.d.ts +0 -46
- package/dist/parser-CovaPg5T.js +0 -2585
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { matchUrl } from "../parser/match-url.js";
|
|
2
|
+
import { parseEmbed } from "../parser/parse-embed.js";
|
|
3
|
+
import { parseIframe } from "../parser/iframe.js";
|
|
4
|
+
import { sourceError } from "../core/resolve.js";
|
|
5
|
+
import { AppleMusicEmbed, ApplePodcastsEmbed } from "./apple-embed.js";
|
|
6
|
+
import { BlueskyEmbed } from "./bluesky-embed.js";
|
|
7
|
+
import { DailymotionEmbed } from "./dailymotion-embed.js";
|
|
8
|
+
import { FacebookEmbed } from "./facebook-embed.js";
|
|
9
|
+
import { FlickrEmbed } from "./flickr-embed.js";
|
|
10
|
+
import { GenericIframeEmbed } from "./generic-iframe-embed.js";
|
|
11
|
+
import { GiphyEmbed } from "./giphy-embed.js";
|
|
12
|
+
import { useReportError } from "./hooks.js";
|
|
13
|
+
import { ImgurEmbed } from "./imgur-embed.js";
|
|
14
|
+
import { InstagramEmbed } from "./instagram-embed.js";
|
|
15
|
+
import { KickEmbed } from "./kick-embed.js";
|
|
16
|
+
import { LinkedInEmbed } from "./linkedin-embed.js";
|
|
17
|
+
import { PinterestEmbed } from "./pinterest-embed.js";
|
|
18
|
+
import { RedditEmbed } from "./reddit-embed.js";
|
|
19
|
+
import { SnapchatEmbed } from "./snapchat-embed.js";
|
|
20
|
+
import { SoundCloudEmbed } from "./soundcloud-embed.js";
|
|
21
|
+
import { SpotifyEmbed } from "./spotify-embed.js";
|
|
22
|
+
import { StravaEmbed } from "./strava-embed.js";
|
|
23
|
+
import { StreamableEmbed } from "./streamable-embed.js";
|
|
24
|
+
import { RumbleEmbed } from "./rumble-embed.js";
|
|
25
|
+
import { TenorEmbed } from "./tenor-embed.js";
|
|
26
|
+
import { TelegramEmbed } from "./telegram-embed.js";
|
|
27
|
+
import { ThreadsEmbed } from "./threads-embed.js";
|
|
28
|
+
import { TikTokEmbed } from "./tiktok-embed.js";
|
|
29
|
+
import { TruthSocialEmbed } from "./truthsocial-embed.js";
|
|
30
|
+
import { TumblrEmbed } from "./tumblr-embed.js";
|
|
31
|
+
import { TwitchEmbed } from "./twitch-embed.js";
|
|
32
|
+
import { VimeoEmbed } from "./vimeo-embed.js";
|
|
33
|
+
import { XEmbed } from "./x-embed.js";
|
|
34
|
+
import { YouTubeEmbed } from "./youtube-embed.js";
|
|
35
|
+
import { useMemo } from "react";
|
|
36
|
+
import { jsx } from "react/jsx-runtime";
|
|
37
|
+
// src/components/social-embed.tsx
|
|
38
|
+
/** `height` and `maxHeight` reach only the iframe-based embeds: the others size themselves. */
|
|
39
|
+
function SocialEmbed(props) {
|
|
40
|
+
const { html, url, fallback, height, maxHeight, onError, ...shared } = props;
|
|
41
|
+
const frame = {
|
|
42
|
+
height,
|
|
43
|
+
maxHeight
|
|
44
|
+
};
|
|
45
|
+
const embed = useMemo(() => html !== void 0 ? parseEmbed(html) : matchUrl(url), [html, url]);
|
|
46
|
+
const iframe = useMemo(() => embed === null && html !== void 0 ? parseIframe(html) : null, [embed, html]);
|
|
47
|
+
useReportError(embed === null && iframe === null && !(html !== void 0 && fallback) ? sourceError(html !== void 0 ? { html } : { url }) : void 0, onError);
|
|
48
|
+
if (iframe) return /* @__PURE__ */ jsx(GenericIframeEmbed, {
|
|
49
|
+
...shared,
|
|
50
|
+
...frame,
|
|
51
|
+
onError,
|
|
52
|
+
embed: iframe
|
|
53
|
+
});
|
|
54
|
+
if (!embed) return html !== void 0 && fallback ? fallback(html) : null;
|
|
55
|
+
switch (embed.platform) {
|
|
56
|
+
case "x": return /* @__PURE__ */ jsx(XEmbed, {
|
|
57
|
+
...shared,
|
|
58
|
+
onError,
|
|
59
|
+
embed
|
|
60
|
+
});
|
|
61
|
+
case "instagram": return /* @__PURE__ */ jsx(InstagramEmbed, {
|
|
62
|
+
...shared,
|
|
63
|
+
onError,
|
|
64
|
+
embed
|
|
65
|
+
});
|
|
66
|
+
case "threads": return /* @__PURE__ */ jsx(ThreadsEmbed, {
|
|
67
|
+
...shared,
|
|
68
|
+
onError,
|
|
69
|
+
embed
|
|
70
|
+
});
|
|
71
|
+
case "facebook": return /* @__PURE__ */ jsx(FacebookEmbed, {
|
|
72
|
+
...shared,
|
|
73
|
+
...frame,
|
|
74
|
+
onError,
|
|
75
|
+
embed
|
|
76
|
+
});
|
|
77
|
+
case "tiktok": return /* @__PURE__ */ jsx(TikTokEmbed, {
|
|
78
|
+
...shared,
|
|
79
|
+
...frame,
|
|
80
|
+
onError,
|
|
81
|
+
embed
|
|
82
|
+
});
|
|
83
|
+
case "youtube": return /* @__PURE__ */ jsx(YouTubeEmbed, {
|
|
84
|
+
...shared,
|
|
85
|
+
...frame,
|
|
86
|
+
onError,
|
|
87
|
+
embed
|
|
88
|
+
});
|
|
89
|
+
case "telegram": return /* @__PURE__ */ jsx(TelegramEmbed, {
|
|
90
|
+
...shared,
|
|
91
|
+
onError,
|
|
92
|
+
embed
|
|
93
|
+
});
|
|
94
|
+
case "snapchat": return /* @__PURE__ */ jsx(SnapchatEmbed, {
|
|
95
|
+
...shared,
|
|
96
|
+
...frame,
|
|
97
|
+
onError,
|
|
98
|
+
embed
|
|
99
|
+
});
|
|
100
|
+
case "linkedin": return /* @__PURE__ */ jsx(LinkedInEmbed, {
|
|
101
|
+
...shared,
|
|
102
|
+
...frame,
|
|
103
|
+
onError,
|
|
104
|
+
embed
|
|
105
|
+
});
|
|
106
|
+
case "reddit": return /* @__PURE__ */ jsx(RedditEmbed, {
|
|
107
|
+
...shared,
|
|
108
|
+
onError,
|
|
109
|
+
embed
|
|
110
|
+
});
|
|
111
|
+
case "pinterest": return /* @__PURE__ */ jsx(PinterestEmbed, {
|
|
112
|
+
...shared,
|
|
113
|
+
onError,
|
|
114
|
+
embed
|
|
115
|
+
});
|
|
116
|
+
case "spotify": return /* @__PURE__ */ jsx(SpotifyEmbed, {
|
|
117
|
+
...shared,
|
|
118
|
+
...frame,
|
|
119
|
+
onError,
|
|
120
|
+
embed
|
|
121
|
+
});
|
|
122
|
+
case "vimeo": return /* @__PURE__ */ jsx(VimeoEmbed, {
|
|
123
|
+
...shared,
|
|
124
|
+
...frame,
|
|
125
|
+
onError,
|
|
126
|
+
embed
|
|
127
|
+
});
|
|
128
|
+
case "twitch": return /* @__PURE__ */ jsx(TwitchEmbed, {
|
|
129
|
+
...shared,
|
|
130
|
+
...frame,
|
|
131
|
+
onError,
|
|
132
|
+
embed
|
|
133
|
+
});
|
|
134
|
+
case "dailymotion": return /* @__PURE__ */ jsx(DailymotionEmbed, {
|
|
135
|
+
...shared,
|
|
136
|
+
...frame,
|
|
137
|
+
onError,
|
|
138
|
+
embed
|
|
139
|
+
});
|
|
140
|
+
case "bluesky": return /* @__PURE__ */ jsx(BlueskyEmbed, {
|
|
141
|
+
...shared,
|
|
142
|
+
onError,
|
|
143
|
+
embed
|
|
144
|
+
});
|
|
145
|
+
case "soundcloud": return /* @__PURE__ */ jsx(SoundCloudEmbed, {
|
|
146
|
+
...shared,
|
|
147
|
+
...frame,
|
|
148
|
+
onError,
|
|
149
|
+
embed
|
|
150
|
+
});
|
|
151
|
+
case "applemusic": return /* @__PURE__ */ jsx(AppleMusicEmbed, {
|
|
152
|
+
...shared,
|
|
153
|
+
...frame,
|
|
154
|
+
onError,
|
|
155
|
+
embed
|
|
156
|
+
});
|
|
157
|
+
case "applepodcasts": return /* @__PURE__ */ jsx(ApplePodcastsEmbed, {
|
|
158
|
+
...shared,
|
|
159
|
+
...frame,
|
|
160
|
+
onError,
|
|
161
|
+
embed
|
|
162
|
+
});
|
|
163
|
+
case "tumblr": return /* @__PURE__ */ jsx(TumblrEmbed, {
|
|
164
|
+
...shared,
|
|
165
|
+
onError,
|
|
166
|
+
embed
|
|
167
|
+
});
|
|
168
|
+
case "kick": return /* @__PURE__ */ jsx(KickEmbed, {
|
|
169
|
+
...shared,
|
|
170
|
+
...frame,
|
|
171
|
+
onError,
|
|
172
|
+
embed
|
|
173
|
+
});
|
|
174
|
+
case "giphy": return /* @__PURE__ */ jsx(GiphyEmbed, {
|
|
175
|
+
...shared,
|
|
176
|
+
...frame,
|
|
177
|
+
onError,
|
|
178
|
+
embed
|
|
179
|
+
});
|
|
180
|
+
case "tenor": return /* @__PURE__ */ jsx(TenorEmbed, {
|
|
181
|
+
...shared,
|
|
182
|
+
...frame,
|
|
183
|
+
onError,
|
|
184
|
+
embed
|
|
185
|
+
});
|
|
186
|
+
case "streamable": return /* @__PURE__ */ jsx(StreamableEmbed, {
|
|
187
|
+
...shared,
|
|
188
|
+
...frame,
|
|
189
|
+
onError,
|
|
190
|
+
embed
|
|
191
|
+
});
|
|
192
|
+
case "rumble": return /* @__PURE__ */ jsx(RumbleEmbed, {
|
|
193
|
+
...shared,
|
|
194
|
+
...frame,
|
|
195
|
+
onError,
|
|
196
|
+
embed
|
|
197
|
+
});
|
|
198
|
+
case "truthsocial": return /* @__PURE__ */ jsx(TruthSocialEmbed, {
|
|
199
|
+
...shared,
|
|
200
|
+
onError,
|
|
201
|
+
embed
|
|
202
|
+
});
|
|
203
|
+
case "imgur": return /* @__PURE__ */ jsx(ImgurEmbed, {
|
|
204
|
+
...shared,
|
|
205
|
+
onError,
|
|
206
|
+
embed
|
|
207
|
+
});
|
|
208
|
+
case "strava": return /* @__PURE__ */ jsx(StravaEmbed, {
|
|
209
|
+
...shared,
|
|
210
|
+
onError,
|
|
211
|
+
embed
|
|
212
|
+
});
|
|
213
|
+
case "flickr": return /* @__PURE__ */ jsx(FlickrEmbed, {
|
|
214
|
+
...shared,
|
|
215
|
+
...frame,
|
|
216
|
+
onError,
|
|
217
|
+
embed
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
export { SocialEmbed };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SoundCloudOptions } from "../core/plans/soundcloud.js";
|
|
2
|
+
import { EmbedSource, FrameProps } from "./shared.js";
|
|
3
|
+
export type SoundCloudEmbedProps = EmbedSource & Omit<FrameProps, keyof SoundCloudOptions> & SoundCloudOptions;
|
|
4
|
+
/** A fixed height: the `height` prop, else the embed code's, else 400px for the visual player. */
|
|
5
|
+
export declare function SoundCloudEmbed(props: SoundCloudEmbedProps): import("react").JSX.Element | null;
|
|
6
|
+
export type { SoundCloudOptions };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { soundcloud } from "../parser/platforms/soundcloud.js";
|
|
2
|
+
import { soundcloudPlan } from "../core/plans/soundcloud.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/soundcloud-embed.tsx
|
|
8
|
+
/** A fixed height: the `height` prop, else the embed code's, else 400px for the visual player. */
|
|
9
|
+
function SoundCloudEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, height, visual, color, autoPlay, hideRelated, showComments, showUser, showReposts, showTeaser, showArtwork, ...frame } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, soundcloud);
|
|
12
|
+
const plan = embed ? soundcloudPlan(embed, {
|
|
13
|
+
visual,
|
|
14
|
+
color,
|
|
15
|
+
autoPlay,
|
|
16
|
+
hideRelated,
|
|
17
|
+
showComments,
|
|
18
|
+
showUser,
|
|
19
|
+
showReposts,
|
|
20
|
+
showTeaser,
|
|
21
|
+
showArtwork
|
|
22
|
+
}) : void 0;
|
|
23
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
24
|
+
if (plan?.kind !== "iframe") return null;
|
|
25
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
26
|
+
...frame,
|
|
27
|
+
...planProps(plan),
|
|
28
|
+
onError,
|
|
29
|
+
maxWidth: maxWidth ?? plan.maxWidth,
|
|
30
|
+
height: height ?? plan.height
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export { SoundCloudEmbed };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SpotifyOptions } from "../core/plans/spotify.js";
|
|
2
|
+
import { EmbedSource, FrameProps } from "./shared.js";
|
|
3
|
+
export type SpotifyEmbedProps = EmbedSource & Omit<FrameProps, keyof SpotifyOptions> & SpotifyOptions;
|
|
4
|
+
/**
|
|
5
|
+
* A fixed height: the `height` prop, else the embed code's, else 152px for a track or episode
|
|
6
|
+
* and 352px for the rest. A video show keeps its 16:9 aspect ratio instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare function SpotifyEmbed(props: SpotifyEmbedProps): import("react").JSX.Element | null;
|
|
9
|
+
export type { SpotifyOptions };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { spotifyPlan } from "../core/plans/spotify.js";
|
|
2
|
+
import { spotify } from "../parser/platforms/spotify.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/spotify-embed.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A fixed height: the `height` prop, else the embed code's, else 152px for a track or episode
|
|
10
|
+
* and 352px for the rest. A video show keeps its 16:9 aspect ratio instead.
|
|
11
|
+
*/
|
|
12
|
+
function SpotifyEmbed(props) {
|
|
13
|
+
const { url, embed: given, onError, height, theme, ...frame } = props;
|
|
14
|
+
const { embed, error } = resolveEmbed(url, given, spotify);
|
|
15
|
+
const plan = embed ? spotifyPlan(embed, { theme }) : void 0;
|
|
16
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
17
|
+
if (plan?.kind !== "iframe") return null;
|
|
18
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
19
|
+
...frame,
|
|
20
|
+
...planProps(plan),
|
|
21
|
+
onError,
|
|
22
|
+
height: height ?? plan.height
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export { SpotifyEmbed };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StravaOptions } from "../core/plans/strava.js";
|
|
2
|
+
import { EmbedSource, SharedProps } from "./shared.js";
|
|
3
|
+
export type StravaEmbedProps = EmbedSource & Omit<SharedProps, keyof StravaOptions> & StravaOptions;
|
|
4
|
+
/** At most 554px wide by default, as `embed.js` makes the frame; a full-width route has no maximum (docs/decisions.md D97). */
|
|
5
|
+
export declare function StravaEmbed(props: StravaEmbedProps): import("react").JSX.Element | null;
|
|
6
|
+
export type { StravaOptions };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { stravaPlan } from "../core/plans/strava.js";
|
|
2
|
+
import { strava } from "../parser/platforms/strava.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/strava-embed.tsx
|
|
8
|
+
/** At most 554px wide by default, as `embed.js` makes the frame; a full-width route has no maximum (docs/decisions.md D97). */
|
|
9
|
+
function StravaEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, embedStyle, fullWidth, mapHash, ...shared } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, strava);
|
|
12
|
+
const plan = embed ? stravaPlan(embed, {
|
|
13
|
+
embedStyle,
|
|
14
|
+
fullWidth,
|
|
15
|
+
mapHash
|
|
16
|
+
}) : void 0;
|
|
17
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
18
|
+
if (plan?.kind !== "iframe") return null;
|
|
19
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
20
|
+
...shared,
|
|
21
|
+
...planProps(plan),
|
|
22
|
+
onError,
|
|
23
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { StravaEmbed };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StreamableOptions } from "../core/plans/streamable.js";
|
|
2
|
+
import { EmbedSource, FrameProps } from "./shared.js";
|
|
3
|
+
export type StreamableEmbedProps = EmbedSource & Omit<FrameProps, keyof StreamableOptions> & StreamableOptions;
|
|
4
|
+
/** The embed code's aspect ratio, else 16:9. */
|
|
5
|
+
export declare function StreamableEmbed(props: StreamableEmbedProps): import("react").JSX.Element | null;
|
|
6
|
+
export type { StreamableOptions };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { streamable } from "../parser/platforms/streamable.js";
|
|
2
|
+
import { streamablePlan } from "../core/plans/streamable.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/streamable-embed.tsx
|
|
8
|
+
/** The embed code's aspect ratio, else 16:9. */
|
|
9
|
+
function StreamableEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, autoplay, hd, loop, muted, nocontrols, ...frame } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, streamable);
|
|
12
|
+
const plan = embed ? streamablePlan(embed, {
|
|
13
|
+
autoplay,
|
|
14
|
+
hd,
|
|
15
|
+
loop,
|
|
16
|
+
muted,
|
|
17
|
+
nocontrols
|
|
18
|
+
}) : void 0;
|
|
19
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
20
|
+
if (plan?.kind !== "iframe") return null;
|
|
21
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
22
|
+
...frame,
|
|
23
|
+
...planProps(plan),
|
|
24
|
+
onError,
|
|
25
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { StreamableEmbed };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TelegramOptions } from "../core/plans/telegram.js";
|
|
2
|
+
import { EmbedSource, SharedProps } from "./shared.js";
|
|
3
|
+
export type TelegramEmbedProps = EmbedSource & Omit<SharedProps, keyof TelegramOptions> & TelegramOptions;
|
|
4
|
+
/** At most 500px wide by default, the widest the post renders (docs/decisions.md D49). */
|
|
5
|
+
export declare function TelegramEmbed(props: TelegramEmbedProps): import("react").JSX.Element | null;
|
|
6
|
+
export type { TelegramOptions };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { telegramPlan } from "../core/plans/telegram.js";
|
|
2
|
+
import { telegram } from "../parser/platforms/telegram.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/telegram-embed.tsx
|
|
8
|
+
/** At most 500px wide by default, the widest the post renders (docs/decisions.md D49). */
|
|
9
|
+
function TelegramEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, userpic, color, dark, darkColor, ...shared } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, telegram);
|
|
12
|
+
const plan = embed ? telegramPlan(embed, {
|
|
13
|
+
userpic,
|
|
14
|
+
color,
|
|
15
|
+
dark,
|
|
16
|
+
darkColor
|
|
17
|
+
}) : void 0;
|
|
18
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
19
|
+
if (plan?.kind !== "iframe") return null;
|
|
20
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
21
|
+
...shared,
|
|
22
|
+
...planProps(plan),
|
|
23
|
+
onError,
|
|
24
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { TelegramEmbed };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EmbedSource, FrameProps } from "./shared.js";
|
|
2
|
+
export type TenorEmbedProps = EmbedSource & FrameProps;
|
|
3
|
+
/** The embed code's aspect ratio; a URL carries no size and renders at 1.33:1 (docs/decisions.md D95). */
|
|
4
|
+
export declare function TenorEmbed(props: TenorEmbedProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tenorPlan } from "../core/plans/tenor.js";
|
|
2
|
+
import { tenor } from "../parser/platforms/tenor.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/tenor-embed.tsx
|
|
8
|
+
/** The embed code's aspect ratio; a URL carries no size and renders at 1.33:1 (docs/decisions.md D95). */
|
|
9
|
+
function TenorEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, ...frame } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, tenor);
|
|
12
|
+
const plan = embed ? tenorPlan(embed) : void 0;
|
|
13
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
14
|
+
if (plan?.kind !== "iframe") return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
16
|
+
...frame,
|
|
17
|
+
...planProps(plan),
|
|
18
|
+
onError,
|
|
19
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { TenorEmbed };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ThreadsOptions } from "../core/plans/threads.js";
|
|
2
|
+
import { EmbedSource, SharedProps } from "./shared.js";
|
|
3
|
+
export type ThreadsEmbedProps = EmbedSource & Omit<SharedProps, keyof ThreadsOptions> & ThreadsOptions;
|
|
4
|
+
export declare function ThreadsEmbed(props: ThreadsEmbedProps): import("react").JSX.Element | null;
|
|
5
|
+
export type { ThreadsOptions };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { threadsPlan } from "../core/plans/threads.js";
|
|
2
|
+
import { threads } from "../parser/platforms/threads.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { ScriptEmbed } from "./script-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/threads-embed.tsx
|
|
8
|
+
function ThreadsEmbed(props) {
|
|
9
|
+
const { url, embed: given, onError, maxWidth, theme, ...shared } = props;
|
|
10
|
+
const { embed, error } = resolveEmbed(url, given, threads);
|
|
11
|
+
const plan = embed ? threadsPlan(embed, { theme }) : void 0;
|
|
12
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
13
|
+
if (plan?.kind !== "script") return null;
|
|
14
|
+
return /* @__PURE__ */ jsx(ScriptEmbed, {
|
|
15
|
+
...shared,
|
|
16
|
+
onError,
|
|
17
|
+
maxWidth: maxWidth ?? plan.maxWidth,
|
|
18
|
+
driver: plan.driver,
|
|
19
|
+
markup: plan.markup,
|
|
20
|
+
hasFallback: plan.hasFallback,
|
|
21
|
+
minHeight: plan.minHeight,
|
|
22
|
+
label: plan.label
|
|
23
|
+
}, plan.key);
|
|
24
|
+
}
|
|
25
|
+
export { ThreadsEmbed };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TikTokOptions } from "../core/plans/tiktok.js";
|
|
2
|
+
import { EmbedSource, FrameProps } from "./shared.js";
|
|
3
|
+
export type TikTokEmbedProps = EmbedSource & Omit<FrameProps, keyof TikTokOptions> & TikTokOptions;
|
|
4
|
+
/** At most 325px wide by default, the size of TikTok's own embed code (docs/decisions.md D40). */
|
|
5
|
+
export declare function TikTokEmbed(props: TikTokEmbedProps): import("react").JSX.Element | null;
|
|
6
|
+
export type { TikTokOptions };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { tiktokPlan } from "../core/plans/tiktok.js";
|
|
2
|
+
import { tiktok } from "../parser/platforms/tiktok.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/tiktok-embed.tsx
|
|
8
|
+
/** At most 325px wide by default, the size of TikTok's own embed code (docs/decisions.md D40). */
|
|
9
|
+
function TikTokEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, controls, progressBar, playButton, volumeControl, fullscreenButton, timestamp, loop, autoplay, musicInfo, description, rel, nativeContextMenu, closedCaption, forceMuted, ...frame } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, tiktok);
|
|
12
|
+
const plan = embed ? tiktokPlan(embed, {
|
|
13
|
+
controls,
|
|
14
|
+
progressBar,
|
|
15
|
+
playButton,
|
|
16
|
+
volumeControl,
|
|
17
|
+
fullscreenButton,
|
|
18
|
+
timestamp,
|
|
19
|
+
loop,
|
|
20
|
+
autoplay,
|
|
21
|
+
musicInfo,
|
|
22
|
+
description,
|
|
23
|
+
rel,
|
|
24
|
+
nativeContextMenu,
|
|
25
|
+
closedCaption,
|
|
26
|
+
forceMuted
|
|
27
|
+
}) : void 0;
|
|
28
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
29
|
+
if (plan?.kind !== "iframe") return null;
|
|
30
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
31
|
+
...frame,
|
|
32
|
+
...planProps(plan),
|
|
33
|
+
onError,
|
|
34
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export { TikTokEmbed };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EmbedSource, SharedProps } from "./shared.js";
|
|
2
|
+
export type TruthSocialEmbedProps = EmbedSource & SharedProps;
|
|
3
|
+
/** At most 600px wide by default, the width of Truth Social's embed code (docs/decisions.md D93). */
|
|
4
|
+
export declare function TruthSocialEmbed(props: TruthSocialEmbedProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { truthSocialPlan } from "../core/plans/truthsocial.js";
|
|
2
|
+
import { truthsocial } from "../parser/platforms/truthsocial.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/truthsocial-embed.tsx
|
|
8
|
+
/** At most 600px wide by default, the width of Truth Social's embed code (docs/decisions.md D93). */
|
|
9
|
+
function TruthSocialEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, ...shared } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, truthsocial);
|
|
12
|
+
const plan = embed ? truthSocialPlan(embed) : void 0;
|
|
13
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
14
|
+
if (plan?.kind !== "iframe") return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
16
|
+
...shared,
|
|
17
|
+
...planProps(plan),
|
|
18
|
+
onError,
|
|
19
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { TruthSocialEmbed };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EmbedSource, SharedProps } from "./shared.js";
|
|
2
|
+
export type TumblrEmbedProps = EmbedSource & SharedProps;
|
|
3
|
+
/** At most 540px wide by default, Tumblr's oEmbed width. Renders the frame `post.js` would create (docs/decisions.md D77). */
|
|
4
|
+
export declare function TumblrEmbed(props: TumblrEmbedProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tumblrPlan } from "../core/plans/tumblr.js";
|
|
2
|
+
import { tumblr } from "../parser/platforms/tumblr.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/tumblr-embed.tsx
|
|
8
|
+
/** At most 540px wide by default, Tumblr's oEmbed width. Renders the frame `post.js` would create (docs/decisions.md D77). */
|
|
9
|
+
function TumblrEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, ...shared } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, tumblr);
|
|
12
|
+
const plan = embed ? tumblrPlan(embed) : void 0;
|
|
13
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
14
|
+
if (plan?.kind !== "iframe") return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
16
|
+
...shared,
|
|
17
|
+
...planProps(plan),
|
|
18
|
+
onError,
|
|
19
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { TumblrEmbed };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TwitchOptions } from "../core/plans/twitch.js";
|
|
2
|
+
import { EmbedSource, FrameProps } from "./shared.js";
|
|
3
|
+
export type TwitchEmbedProps = EmbedSource & Omit<FrameProps, keyof TwitchOptions> & TwitchOptions;
|
|
4
|
+
/** `parent` is the page's own host, added on the client (docs/decisions.md D62, D65). */
|
|
5
|
+
export declare function TwitchEmbed(props: TwitchEmbedProps): import("react").JSX.Element | null;
|
|
6
|
+
export type { TwitchOptions };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { twitchPlan } from "../core/plans/twitch.js";
|
|
2
|
+
import { twitch } from "../parser/platforms/twitch.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/twitch-embed.tsx
|
|
8
|
+
/** `parent` is the page's own host, added on the client (docs/decisions.md D62, D65). */
|
|
9
|
+
function TwitchEmbed(props) {
|
|
10
|
+
const { url, embed: given, onError, maxWidth, autoplay, muted, time, ...frame } = props;
|
|
11
|
+
const { embed, error } = resolveEmbed(url, given, twitch);
|
|
12
|
+
const plan = embed ? twitchPlan(embed, {
|
|
13
|
+
autoplay,
|
|
14
|
+
muted,
|
|
15
|
+
time
|
|
16
|
+
}) : void 0;
|
|
17
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
18
|
+
if (plan?.kind !== "iframe") return null;
|
|
19
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
20
|
+
...frame,
|
|
21
|
+
...planProps(plan),
|
|
22
|
+
onError,
|
|
23
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { TwitchEmbed };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VimeoOptions } from "../core/plans/vimeo.js";
|
|
2
|
+
import { EmbedSource, FrameProps } from "./shared.js";
|
|
3
|
+
export type VimeoEmbedProps = EmbedSource & Omit<FrameProps, keyof VimeoOptions> & VimeoOptions;
|
|
4
|
+
export declare function VimeoEmbed(props: VimeoEmbedProps): import("react").JSX.Element | null;
|
|
5
|
+
export type { VimeoOptions };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { vimeoPlan } from "../core/plans/vimeo.js";
|
|
2
|
+
import { vimeo } from "../parser/platforms/vimeo.js";
|
|
3
|
+
import { useReportError } from "./hooks.js";
|
|
4
|
+
import { IframeEmbed, planProps } from "./iframe-embed.js";
|
|
5
|
+
import { resolveEmbed } from "../core/resolve.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/components/vimeo-embed.tsx
|
|
8
|
+
function VimeoEmbed(props) {
|
|
9
|
+
const { url, embed: given, onError, maxWidth, autopause, autoplay, background, byline, color, controls, dnt, keyboard, loop, muted, pip, playsinline, portrait, quality, speed, title, transparent, t, ...frame } = props;
|
|
10
|
+
const { embed, error } = resolveEmbed(url, given, vimeo);
|
|
11
|
+
const plan = embed ? vimeoPlan(embed, {
|
|
12
|
+
autopause,
|
|
13
|
+
autoplay,
|
|
14
|
+
background,
|
|
15
|
+
byline,
|
|
16
|
+
color,
|
|
17
|
+
controls,
|
|
18
|
+
dnt,
|
|
19
|
+
keyboard,
|
|
20
|
+
loop,
|
|
21
|
+
muted,
|
|
22
|
+
pip,
|
|
23
|
+
playsinline,
|
|
24
|
+
portrait,
|
|
25
|
+
quality,
|
|
26
|
+
speed,
|
|
27
|
+
title,
|
|
28
|
+
transparent,
|
|
29
|
+
t
|
|
30
|
+
}) : void 0;
|
|
31
|
+
useReportError(error ?? (plan?.kind === "error" ? plan.message : void 0), onError);
|
|
32
|
+
if (plan?.kind !== "iframe") return null;
|
|
33
|
+
return /* @__PURE__ */ jsx(IframeEmbed, {
|
|
34
|
+
...frame,
|
|
35
|
+
...planProps(plan),
|
|
36
|
+
onError,
|
|
37
|
+
maxWidth: maxWidth ?? plan.maxWidth
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { VimeoEmbed };
|