@postrun/react 2.7.0 → 2.9.0
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/dist/index.cjs +622 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -36
- package/dist/index.d.ts +116 -36
- package/dist/index.js +623 -198
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -15,6 +15,7 @@ var fi = require('react-icons/fi');
|
|
|
15
15
|
var twitterText = require('twitter-text');
|
|
16
16
|
var lu = require('react-icons/lu');
|
|
17
17
|
var useEmblaCarousel = require('embla-carousel-react');
|
|
18
|
+
var md = require('react-icons/md');
|
|
18
19
|
var io5 = require('react-icons/io5');
|
|
19
20
|
|
|
20
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1124,6 +1125,38 @@ var ACTIONS = [
|
|
|
1124
1125
|
function XPreviewActions() {
|
|
1125
1126
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: ROW, children: ACTIONS.map(({ label, Icon: Icon2 }) => /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 18, "aria-label": label, role: "img" }, label)) });
|
|
1126
1127
|
}
|
|
1128
|
+
function twitterMediaUrl(src) {
|
|
1129
|
+
try {
|
|
1130
|
+
const url = new URL(src);
|
|
1131
|
+
const extension = url.pathname.split(".").pop();
|
|
1132
|
+
if (!extension) {
|
|
1133
|
+
return src;
|
|
1134
|
+
}
|
|
1135
|
+
url.pathname = url.pathname.replace(`.${extension}`, "");
|
|
1136
|
+
url.searchParams.set("format", extension);
|
|
1137
|
+
url.searchParams.set("name", "small");
|
|
1138
|
+
return url.toString();
|
|
1139
|
+
} catch {
|
|
1140
|
+
return src;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
function rawSrcLookup(...lists) {
|
|
1144
|
+
const map = /* @__PURE__ */ new Map();
|
|
1145
|
+
for (const list of lists) {
|
|
1146
|
+
for (const item of list) {
|
|
1147
|
+
const poster = item.posterSrc ?? item.src;
|
|
1148
|
+
map.set(twitterMediaUrl(item.src), item.src);
|
|
1149
|
+
map.set(twitterMediaUrl(poster), poster);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
return map;
|
|
1153
|
+
}
|
|
1154
|
+
function makeRawMediaImg(rawBySrc) {
|
|
1155
|
+
return function RawMediaImg(props) {
|
|
1156
|
+
const raw = typeof props.src === "string" ? rawBySrc.get(props.src) ?? props.src : props.src;
|
|
1157
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { ...props, src: raw });
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1127
1160
|
var {
|
|
1128
1161
|
extractCashtagsWithIndices,
|
|
1129
1162
|
extractHashtagsWithIndices,
|
|
@@ -1174,9 +1207,12 @@ function buildUser(author) {
|
|
|
1174
1207
|
return {
|
|
1175
1208
|
id_str: "",
|
|
1176
1209
|
name: author.name,
|
|
1177
|
-
profile_image_url_https: author.
|
|
1210
|
+
profile_image_url_https: author.avatar_url ?? PLACEHOLDER_AVATAR,
|
|
1178
1211
|
profile_image_shape: "Circle",
|
|
1179
|
-
|
|
1212
|
+
// `username`/`avatar_url` derive from the SDK Connection and are nullable.
|
|
1213
|
+
screen_name: author.username ?? "",
|
|
1214
|
+
// Legacy (pre-X-era) verification flag — always false for organic posts; the
|
|
1215
|
+
// X Blue checkmark rides on `is_blue_verified`.
|
|
1180
1216
|
verified: false,
|
|
1181
1217
|
is_blue_verified: verified
|
|
1182
1218
|
};
|
|
@@ -1239,7 +1275,11 @@ function buildQuoted(quote, hasQuoteId) {
|
|
|
1239
1275
|
if (!quote && !hasQuoteId) {
|
|
1240
1276
|
return void 0;
|
|
1241
1277
|
}
|
|
1242
|
-
const author = quote?.author ?? {
|
|
1278
|
+
const author = quote?.author ?? {
|
|
1279
|
+
name: "Quoted post",
|
|
1280
|
+
username: "",
|
|
1281
|
+
avatar_url: null
|
|
1282
|
+
};
|
|
1243
1283
|
const body = quote?.body ?? "";
|
|
1244
1284
|
const media = quote?.media ?? [];
|
|
1245
1285
|
return {
|
|
@@ -1305,7 +1345,7 @@ function XPostPreviewImpl({
|
|
|
1305
1345
|
showActions = true,
|
|
1306
1346
|
className,
|
|
1307
1347
|
style,
|
|
1308
|
-
components
|
|
1348
|
+
components: componentsProp
|
|
1309
1349
|
}) {
|
|
1310
1350
|
const resolvedMedia = useResolvedMedia(
|
|
1311
1351
|
media,
|
|
@@ -1313,6 +1353,15 @@ function XPostPreviewImpl({
|
|
|
1313
1353
|
altSignatureOf(variant.media)
|
|
1314
1354
|
);
|
|
1315
1355
|
const resolvedQuotedMedia = useResolvedMedia(quotedTweet?.media, void 0, "");
|
|
1356
|
+
const components = react.useMemo(
|
|
1357
|
+
() => ({
|
|
1358
|
+
MediaImg: makeRawMediaImg(
|
|
1359
|
+
rawSrcLookup(resolvedMedia, resolvedQuotedMedia)
|
|
1360
|
+
),
|
|
1361
|
+
...componentsProp
|
|
1362
|
+
}),
|
|
1363
|
+
[resolvedMedia, resolvedQuotedMedia, componentsProp]
|
|
1364
|
+
);
|
|
1316
1365
|
const tweet = react.useMemo(() => {
|
|
1317
1366
|
const resolvedQuoted = quotedTweet ? {
|
|
1318
1367
|
author: quotedTweet.author,
|
|
@@ -1355,6 +1404,8 @@ function XPostPreviewImpl({
|
|
|
1355
1404
|
);
|
|
1356
1405
|
}
|
|
1357
1406
|
var XPostPreview = react.memo(XPostPreviewImpl);
|
|
1407
|
+
|
|
1408
|
+
// src/preview/linkedin/theme.ts
|
|
1358
1409
|
var LI_VAR = {
|
|
1359
1410
|
bg: "--pr-li-bg",
|
|
1360
1411
|
text: "--pr-li-text",
|
|
@@ -1362,53 +1413,21 @@ var LI_VAR = {
|
|
|
1362
1413
|
border: "--pr-li-border",
|
|
1363
1414
|
accent: "--pr-li-accent"
|
|
1364
1415
|
};
|
|
1365
|
-
var LIGHT = {
|
|
1366
|
-
bg: "#ffffff",
|
|
1367
|
-
text: "rgba(0,0,0,0.9)",
|
|
1368
|
-
muted: "rgba(0,0,0,0.6)",
|
|
1369
|
-
border: "rgba(0,0,0,0.08)",
|
|
1370
|
-
accent: "rgb(10,102,194)"
|
|
1371
|
-
};
|
|
1372
|
-
var DARK = {
|
|
1373
|
-
bg: "#1b1f23",
|
|
1374
|
-
text: "rgba(255,255,255,0.9)",
|
|
1375
|
-
muted: "rgba(255,255,255,0.6)",
|
|
1376
|
-
border: "rgba(255,255,255,0.15)",
|
|
1377
|
-
accent: "rgb(112,181,249)"
|
|
1378
|
-
};
|
|
1379
1416
|
function varRef(name) {
|
|
1380
1417
|
return `var(${name})`;
|
|
1381
1418
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
}
|
|
1392
|
-
function usePrefersDark() {
|
|
1393
|
-
const [dark, setDark] = react.useState(false);
|
|
1394
|
-
react.useEffect(() => {
|
|
1395
|
-
if (typeof window === "undefined" || !window.matchMedia) {
|
|
1396
|
-
return;
|
|
1397
|
-
}
|
|
1398
|
-
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1399
|
-
setDark(mq.matches);
|
|
1400
|
-
const onChange = (event) => setDark(event.matches);
|
|
1401
|
-
mq.addEventListener("change", onChange);
|
|
1402
|
-
return () => mq.removeEventListener("change", onChange);
|
|
1403
|
-
}, []);
|
|
1404
|
-
return dark;
|
|
1419
|
+
var PALETTE_VARS = {
|
|
1420
|
+
[LI_VAR.bg]: "light-dark(#ffffff, #1b1f23)",
|
|
1421
|
+
[LI_VAR.text]: "light-dark(rgba(0,0,0,0.9), rgba(255,255,255,0.9))",
|
|
1422
|
+
[LI_VAR.muted]: "light-dark(rgba(0,0,0,0.6), rgba(255,255,255,0.6))",
|
|
1423
|
+
[LI_VAR.border]: "light-dark(rgba(0,0,0,0.08), rgba(255,255,255,0.15))",
|
|
1424
|
+
[LI_VAR.accent]: "light-dark(rgb(10,102,194), rgb(112,181,249))"
|
|
1425
|
+
};
|
|
1426
|
+
function paletteVars() {
|
|
1427
|
+
return PALETTE_VARS;
|
|
1405
1428
|
}
|
|
1406
|
-
function
|
|
1407
|
-
|
|
1408
|
-
if (theme === "auto") {
|
|
1409
|
-
return prefersDark;
|
|
1410
|
-
}
|
|
1411
|
-
return theme === "dark";
|
|
1429
|
+
function colorSchemeFor(theme) {
|
|
1430
|
+
return theme === "auto" ? "light dark" : theme;
|
|
1412
1431
|
}
|
|
1413
1432
|
function domainOf(source) {
|
|
1414
1433
|
try {
|
|
@@ -1551,7 +1570,7 @@ function Header({ author, visibility, time = "Now" }) {
|
|
|
1551
1570
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1552
1571
|
"img",
|
|
1553
1572
|
{
|
|
1554
|
-
src: author.
|
|
1573
|
+
src: author.avatar_url ?? PLACEHOLDER_AVATAR2,
|
|
1555
1574
|
alt: "",
|
|
1556
1575
|
width: 48,
|
|
1557
1576
|
height: 48,
|
|
@@ -1650,7 +1669,6 @@ function Tile({
|
|
|
1650
1669
|
overlay ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1651
1670
|
"div",
|
|
1652
1671
|
{
|
|
1653
|
-
"aria-hidden": false,
|
|
1654
1672
|
style: {
|
|
1655
1673
|
position: "absolute",
|
|
1656
1674
|
inset: 0,
|
|
@@ -1821,7 +1839,18 @@ function linkify(text, colors, mentionNames) {
|
|
|
1821
1839
|
);
|
|
1822
1840
|
} else if (token.startsWith("#")) {
|
|
1823
1841
|
nodes.push(
|
|
1824
|
-
|
|
1842
|
+
// Preview-only hashtag: no real destination, so prevent the host SPA from
|
|
1843
|
+
// navigating / scrolling to top on click.
|
|
1844
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1845
|
+
"a",
|
|
1846
|
+
{
|
|
1847
|
+
href: "#",
|
|
1848
|
+
style: linkStyle(colors.accent),
|
|
1849
|
+
onClick: (e) => e.preventDefault(),
|
|
1850
|
+
children: token
|
|
1851
|
+
},
|
|
1852
|
+
key++
|
|
1853
|
+
)
|
|
1825
1854
|
);
|
|
1826
1855
|
} else {
|
|
1827
1856
|
nodes.push(
|
|
@@ -1839,32 +1868,41 @@ function PostBody({ text, mentionNames = [], colors }) {
|
|
|
1839
1868
|
const [expanded, setExpanded] = react.useState(false);
|
|
1840
1869
|
const isLong = text.length > FOLD_CHARS;
|
|
1841
1870
|
const shown = isLong && !expanded ? truncateAtWord(text, FOLD_CHARS) : text;
|
|
1871
|
+
const nodes = react.useMemo(
|
|
1872
|
+
() => linkify(shown, colors, mentionNames),
|
|
1873
|
+
[shown, colors, mentionNames]
|
|
1874
|
+
);
|
|
1875
|
+
const toggleStyle2 = {
|
|
1876
|
+
background: "none",
|
|
1877
|
+
border: "none",
|
|
1878
|
+
padding: 0,
|
|
1879
|
+
cursor: "pointer",
|
|
1880
|
+
color: colors.muted,
|
|
1881
|
+
fontWeight: 600,
|
|
1882
|
+
fontSize: 14
|
|
1883
|
+
};
|
|
1842
1884
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: BODY_STYLE, children: [
|
|
1843
|
-
|
|
1844
|
-
isLong
|
|
1845
|
-
"\u2026",
|
|
1846
|
-
" ",
|
|
1885
|
+
nodes,
|
|
1886
|
+
isLong ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1887
|
+
!expanded ? "\u2026 " : " ",
|
|
1847
1888
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1848
1889
|
"button",
|
|
1849
1890
|
{
|
|
1850
1891
|
type: "button",
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
padding: 0,
|
|
1856
|
-
cursor: "pointer",
|
|
1857
|
-
color: colors.muted,
|
|
1858
|
-
fontWeight: 600,
|
|
1859
|
-
fontSize: 14
|
|
1860
|
-
},
|
|
1861
|
-
children: "more"
|
|
1892
|
+
"aria-expanded": expanded,
|
|
1893
|
+
onClick: () => setExpanded((v) => !v),
|
|
1894
|
+
style: toggleStyle2,
|
|
1895
|
+
children: expanded ? "see less" : "more"
|
|
1862
1896
|
}
|
|
1863
1897
|
)
|
|
1864
1898
|
] }) : null
|
|
1865
1899
|
] });
|
|
1866
1900
|
}
|
|
1867
1901
|
var FONT_STACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
|
|
1902
|
+
var BODY_COLORS = {
|
|
1903
|
+
accent: varRef(LI_VAR.accent),
|
|
1904
|
+
muted: varRef(LI_VAR.muted)
|
|
1905
|
+
};
|
|
1868
1906
|
function LinkedInPostPreviewImpl({
|
|
1869
1907
|
variant,
|
|
1870
1908
|
author,
|
|
@@ -1875,20 +1913,19 @@ function LinkedInPostPreviewImpl({
|
|
|
1875
1913
|
className,
|
|
1876
1914
|
style
|
|
1877
1915
|
}) {
|
|
1878
|
-
const dark = useIsDark(theme);
|
|
1879
1916
|
const resolvedMedia = useResolvedMedia(
|
|
1880
1917
|
media,
|
|
1881
1918
|
variant.media,
|
|
1882
1919
|
altSignatureOf(variant.media)
|
|
1883
1920
|
);
|
|
1884
1921
|
const visibility = variant.settings?.visibility ?? "PUBLIC";
|
|
1885
|
-
const mentionNames =
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1922
|
+
const mentionNames = react.useMemo(
|
|
1923
|
+
() => (variant.settings?.mentions ?? []).map((m) => m.name),
|
|
1924
|
+
[variant.settings?.mentions]
|
|
1925
|
+
);
|
|
1926
|
+
const cardStyle5 = {
|
|
1927
|
+
...paletteVars(),
|
|
1928
|
+
colorScheme: colorSchemeFor(theme),
|
|
1892
1929
|
background: varRef(LI_VAR.bg),
|
|
1893
1930
|
color: varRef(LI_VAR.text),
|
|
1894
1931
|
border: `1px solid ${varRef(LI_VAR.border)}`,
|
|
@@ -1898,14 +1935,14 @@ function LinkedInPostPreviewImpl({
|
|
|
1898
1935
|
fontFamily: FONT_STACK,
|
|
1899
1936
|
...style
|
|
1900
1937
|
};
|
|
1901
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style:
|
|
1938
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: cardStyle5, children: [
|
|
1902
1939
|
/* @__PURE__ */ jsxRuntime.jsx(Header, { author, visibility, time }),
|
|
1903
1940
|
variant.body ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "8px 16px 0" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1904
1941
|
PostBody,
|
|
1905
1942
|
{
|
|
1906
1943
|
text: variant.body,
|
|
1907
1944
|
mentionNames,
|
|
1908
|
-
colors:
|
|
1945
|
+
colors: BODY_COLORS
|
|
1909
1946
|
}
|
|
1910
1947
|
) }) : null,
|
|
1911
1948
|
renderContent(variant, resolvedMedia),
|
|
@@ -1929,10 +1966,59 @@ function renderContent(variant, media) {
|
|
|
1929
1966
|
}
|
|
1930
1967
|
var INSET = { padding: "12px 16px 0" };
|
|
1931
1968
|
var LinkedInPostPreview = react.memo(LinkedInPostPreviewImpl);
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
var
|
|
1935
|
-
|
|
1969
|
+
|
|
1970
|
+
// src/preview/instagram/theme.ts
|
|
1971
|
+
var IG_VAR = {
|
|
1972
|
+
bg: "--pr-ig-bg",
|
|
1973
|
+
text: "--pr-ig-text",
|
|
1974
|
+
muted: "--pr-ig-muted",
|
|
1975
|
+
border: "--pr-ig-border",
|
|
1976
|
+
accent: "--pr-ig-accent"
|
|
1977
|
+
};
|
|
1978
|
+
function varRef2(name) {
|
|
1979
|
+
return `var(${name})`;
|
|
1980
|
+
}
|
|
1981
|
+
var PALETTE_VARS2 = {
|
|
1982
|
+
[IG_VAR.bg]: "light-dark(#ffffff, #000000)",
|
|
1983
|
+
[IG_VAR.text]: "light-dark(#000000, #f5f5f5)",
|
|
1984
|
+
[IG_VAR.muted]: "light-dark(#737373, #a8a8a8)",
|
|
1985
|
+
[IG_VAR.border]: "light-dark(#dbdbdb, #262626)",
|
|
1986
|
+
[IG_VAR.accent]: "light-dark(#00376b, #e0f1ff)"
|
|
1987
|
+
};
|
|
1988
|
+
function paletteVars2() {
|
|
1989
|
+
return PALETTE_VARS2;
|
|
1990
|
+
}
|
|
1991
|
+
function colorSchemeFor2(theme) {
|
|
1992
|
+
return theme === "auto" ? "light dark" : theme;
|
|
1993
|
+
}
|
|
1994
|
+
function Actions() {
|
|
1995
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle, children: [
|
|
1996
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: leftStyle, children: [
|
|
1997
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiHeart, { size: 24, "aria-label": "Like", role: "img" }),
|
|
1998
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiMessageCircle, { size: 24, "aria-label": "Comment", role: "img" }),
|
|
1999
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiSend, { size: 24, "aria-label": "Share", role: "img" })
|
|
2000
|
+
] }),
|
|
2001
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiBookmark, { size: 24, "aria-label": "Save", role: "img" })
|
|
2002
|
+
] });
|
|
2003
|
+
}
|
|
2004
|
+
var rowStyle = {
|
|
2005
|
+
display: "flex",
|
|
2006
|
+
alignItems: "center",
|
|
2007
|
+
justifyContent: "space-between",
|
|
2008
|
+
padding: "10px 12px 4px",
|
|
2009
|
+
color: varRef2(IG_VAR.text)
|
|
2010
|
+
};
|
|
2011
|
+
var leftStyle = {
|
|
2012
|
+
display: "flex",
|
|
2013
|
+
alignItems: "center",
|
|
2014
|
+
gap: 16
|
|
2015
|
+
};
|
|
2016
|
+
function ExpandableText({
|
|
2017
|
+
children,
|
|
2018
|
+
lines = 2,
|
|
2019
|
+
toggleColor,
|
|
2020
|
+
style
|
|
2021
|
+
}) {
|
|
1936
2022
|
const [expanded, setExpanded] = react.useState(false);
|
|
1937
2023
|
const [overflowing, setOverflowing] = react.useState(false);
|
|
1938
2024
|
const ref = react.useRef(null);
|
|
@@ -1941,56 +2027,418 @@ function Caption({ body }) {
|
|
|
1941
2027
|
if (!el || expanded) {
|
|
1942
2028
|
return;
|
|
1943
2029
|
}
|
|
1944
|
-
setOverflowing(el.scrollHeight > el.clientHeight + 1);
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
)
|
|
2030
|
+
const measure = () => setOverflowing(el.scrollHeight > el.clientHeight + 1);
|
|
2031
|
+
measure();
|
|
2032
|
+
if (typeof ResizeObserver === "undefined") {
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
const ro = new ResizeObserver(measure);
|
|
2036
|
+
ro.observe(el);
|
|
2037
|
+
return () => ro.disconnect();
|
|
2038
|
+
}, [expanded, children]);
|
|
2039
|
+
const textStyle = expanded ? FULL : { ...FULL, ...clampStyle(lines) };
|
|
2040
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style, children: [
|
|
2041
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref, style: textStyle, children }),
|
|
1951
2042
|
overflowing || expanded ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1952
2043
|
"button",
|
|
1953
2044
|
{
|
|
1954
2045
|
type: "button",
|
|
1955
2046
|
"aria-expanded": expanded,
|
|
1956
|
-
"aria-label": expanded ? "
|
|
2047
|
+
"aria-label": expanded ? "Show less" : "Show more",
|
|
1957
2048
|
onClick: () => setExpanded((v) => !v),
|
|
1958
|
-
style:
|
|
2049
|
+
style: { ...toggleStyle, color: toggleColor ?? "inherit" },
|
|
1959
2050
|
children: expanded ? "less" : "more"
|
|
1960
2051
|
}
|
|
1961
2052
|
) : null
|
|
1962
2053
|
] });
|
|
1963
2054
|
}
|
|
1964
|
-
var
|
|
1965
|
-
fontSize: 14,
|
|
1966
|
-
lineHeight: 1.35
|
|
1967
|
-
};
|
|
1968
|
-
var clampedTextStyle = {
|
|
1969
|
-
display: "-webkit-box",
|
|
1970
|
-
WebkitLineClamp: 2,
|
|
1971
|
-
WebkitBoxOrient: "vertical",
|
|
1972
|
-
overflow: "hidden",
|
|
2055
|
+
var FULL = {
|
|
1973
2056
|
whiteSpace: "pre-wrap",
|
|
1974
2057
|
wordBreak: "break-word"
|
|
1975
2058
|
};
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
};
|
|
1983
|
-
|
|
2059
|
+
function clampStyle(lines) {
|
|
2060
|
+
return {
|
|
2061
|
+
display: "-webkit-box",
|
|
2062
|
+
WebkitLineClamp: lines,
|
|
2063
|
+
WebkitBoxOrient: "vertical",
|
|
2064
|
+
overflow: "hidden"
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
var toggleStyle = {
|
|
1984
2068
|
display: "inline-block",
|
|
1985
2069
|
marginTop: 2,
|
|
1986
2070
|
padding: 0,
|
|
1987
2071
|
border: 0,
|
|
1988
2072
|
background: "transparent",
|
|
1989
|
-
|
|
1990
|
-
fontSize: 13,
|
|
2073
|
+
font: "inherit",
|
|
1991
2074
|
fontWeight: 600,
|
|
1992
|
-
cursor: "pointer"
|
|
1993
|
-
|
|
2075
|
+
cursor: "pointer"
|
|
2076
|
+
};
|
|
2077
|
+
var TOKEN = /([#@][\p{L}\p{N}_.]+)/gu;
|
|
2078
|
+
var IS_TOKEN = /^[#@][\p{L}\p{N}_.]+$/u;
|
|
2079
|
+
function Caption({
|
|
2080
|
+
username,
|
|
2081
|
+
body
|
|
2082
|
+
}) {
|
|
2083
|
+
const parts = body.split(TOKEN);
|
|
2084
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2085
|
+
ExpandableText,
|
|
2086
|
+
{
|
|
2087
|
+
lines: 2,
|
|
2088
|
+
toggleColor: varRef2(IG_VAR.muted),
|
|
2089
|
+
style: wrapStyle3,
|
|
2090
|
+
children: [
|
|
2091
|
+
username ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontWeight: 600 }, children: [
|
|
2092
|
+
username,
|
|
2093
|
+
" "
|
|
2094
|
+
] }) : null,
|
|
2095
|
+
parts.map(
|
|
2096
|
+
(part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: varRef2(IG_VAR.accent) }, children: part }, i) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: part }, i)
|
|
2097
|
+
)
|
|
2098
|
+
]
|
|
2099
|
+
}
|
|
2100
|
+
);
|
|
2101
|
+
}
|
|
2102
|
+
var wrapStyle3 = {
|
|
2103
|
+
padding: "4px 12px 0",
|
|
2104
|
+
fontSize: 14,
|
|
2105
|
+
lineHeight: 1.4,
|
|
2106
|
+
color: varRef2(IG_VAR.text)
|
|
2107
|
+
};
|
|
2108
|
+
function FeedMedia({ media }) {
|
|
2109
|
+
if (media.length <= 1) {
|
|
2110
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: frameStyle, children: media[0] ? /* @__PURE__ */ jsxRuntime.jsx(Tile2, { item: media[0] }) : null });
|
|
2111
|
+
}
|
|
2112
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Carousel, { media });
|
|
2113
|
+
}
|
|
2114
|
+
function Tile2({ item }) {
|
|
2115
|
+
if (item.kind === "video") {
|
|
2116
|
+
return /* @__PURE__ */ jsxRuntime.jsx("video", { src: item.src, poster: item.posterSrc, controls: true, style: mediaStyle });
|
|
2117
|
+
}
|
|
2118
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.src, alt: item.alt ?? "", style: mediaStyle });
|
|
2119
|
+
}
|
|
2120
|
+
function Carousel({ media }) {
|
|
2121
|
+
const [emblaRef, emblaApi] = useEmblaCarousel__default.default({ loop: false, align: "start" });
|
|
2122
|
+
const [selected, setSelected] = react.useState(0);
|
|
2123
|
+
const sync = react.useCallback((api) => {
|
|
2124
|
+
setSelected(api.selectedScrollSnap());
|
|
2125
|
+
}, []);
|
|
2126
|
+
react.useEffect(() => {
|
|
2127
|
+
if (!emblaApi) {
|
|
2128
|
+
return;
|
|
2129
|
+
}
|
|
2130
|
+
sync(emblaApi);
|
|
2131
|
+
emblaApi.on("select", sync).on("reInit", sync);
|
|
2132
|
+
return () => {
|
|
2133
|
+
emblaApi.off("select", sync).off("reInit", sync);
|
|
2134
|
+
};
|
|
2135
|
+
}, [emblaApi, sync]);
|
|
2136
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: frameStyle, children: [
|
|
2137
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: emblaRef, style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", height: "100%" }, children: media.map((item) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: slideStyle, children: /* @__PURE__ */ jsxRuntime.jsx(Tile2, { item }) }, item.src)) }) }),
|
|
2138
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: pillStyle, children: [
|
|
2139
|
+
selected + 1,
|
|
2140
|
+
"/",
|
|
2141
|
+
media.length
|
|
2142
|
+
] }),
|
|
2143
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: dotsStyle, children: media.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2144
|
+
"span",
|
|
2145
|
+
{
|
|
2146
|
+
style: { ...dotStyle, opacity: i === selected ? 1 : 0.5 }
|
|
2147
|
+
},
|
|
2148
|
+
`dot-${item.src}`
|
|
2149
|
+
)) })
|
|
2150
|
+
] });
|
|
2151
|
+
}
|
|
2152
|
+
var frameStyle = {
|
|
2153
|
+
position: "relative",
|
|
2154
|
+
width: "100%",
|
|
2155
|
+
aspectRatio: "1 / 1",
|
|
2156
|
+
background: "#000",
|
|
2157
|
+
overflow: "hidden"
|
|
2158
|
+
};
|
|
2159
|
+
var mediaStyle = {
|
|
2160
|
+
position: "absolute",
|
|
2161
|
+
inset: 0,
|
|
2162
|
+
width: "100%",
|
|
2163
|
+
height: "100%",
|
|
2164
|
+
objectFit: "cover"
|
|
2165
|
+
};
|
|
2166
|
+
var slideStyle = {
|
|
2167
|
+
position: "relative",
|
|
2168
|
+
flex: "0 0 100%",
|
|
2169
|
+
minWidth: 0,
|
|
2170
|
+
height: "100%"
|
|
2171
|
+
};
|
|
2172
|
+
var pillStyle = {
|
|
2173
|
+
position: "absolute",
|
|
2174
|
+
top: 12,
|
|
2175
|
+
right: 12,
|
|
2176
|
+
background: "rgba(0,0,0,0.6)",
|
|
2177
|
+
color: "#fff",
|
|
2178
|
+
fontSize: 12,
|
|
2179
|
+
fontWeight: 600,
|
|
2180
|
+
padding: "2px 9px",
|
|
2181
|
+
borderRadius: 999
|
|
2182
|
+
};
|
|
2183
|
+
var dotsStyle = {
|
|
2184
|
+
position: "absolute",
|
|
2185
|
+
bottom: 10,
|
|
2186
|
+
left: "50%",
|
|
2187
|
+
transform: "translateX(-50%)",
|
|
2188
|
+
display: "flex",
|
|
2189
|
+
gap: 4
|
|
2190
|
+
};
|
|
2191
|
+
var dotStyle = {
|
|
2192
|
+
width: 6,
|
|
2193
|
+
height: 6,
|
|
2194
|
+
borderRadius: "50%",
|
|
2195
|
+
background: "#fff"
|
|
2196
|
+
};
|
|
2197
|
+
var PLACEHOLDER_AVATAR3 = "data:image/svg+xml;utf8," + encodeURIComponent(
|
|
2198
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="16" fill="#b3b3b3"/></svg>'
|
|
2199
|
+
);
|
|
2200
|
+
function Header2({
|
|
2201
|
+
author,
|
|
2202
|
+
collaborators
|
|
2203
|
+
}) {
|
|
2204
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle2, children: [
|
|
2205
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2206
|
+
"img",
|
|
2207
|
+
{
|
|
2208
|
+
src: author.avatar_url ?? PLACEHOLDER_AVATAR3,
|
|
2209
|
+
alt: "",
|
|
2210
|
+
width: 32,
|
|
2211
|
+
height: 32,
|
|
2212
|
+
style: avatarStyle
|
|
2213
|
+
}
|
|
2214
|
+
),
|
|
2215
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column" }, children: [
|
|
2216
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: nameStyle, children: [
|
|
2217
|
+
author.username ?? "",
|
|
2218
|
+
author.verified ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2219
|
+
md.MdVerified,
|
|
2220
|
+
{
|
|
2221
|
+
size: 13,
|
|
2222
|
+
"aria-label": "Verified",
|
|
2223
|
+
role: "img",
|
|
2224
|
+
style: { color: "#3897f0", marginLeft: 3, flex: "0 0 auto" }
|
|
2225
|
+
}
|
|
2226
|
+
) : null
|
|
2227
|
+
] }),
|
|
2228
|
+
collaborators.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: collabStyle, children: [
|
|
2229
|
+
"with ",
|
|
2230
|
+
collaborators.map((c) => `@${c}`).join(", ")
|
|
2231
|
+
] }) : null
|
|
2232
|
+
] }),
|
|
2233
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2234
|
+
fi.FiMoreHorizontal,
|
|
2235
|
+
{
|
|
2236
|
+
size: 18,
|
|
2237
|
+
"aria-hidden": true,
|
|
2238
|
+
style: { marginLeft: "auto", color: varRef2(IG_VAR.text) }
|
|
2239
|
+
}
|
|
2240
|
+
)
|
|
2241
|
+
] });
|
|
2242
|
+
}
|
|
2243
|
+
var rowStyle2 = {
|
|
2244
|
+
display: "flex",
|
|
2245
|
+
alignItems: "center",
|
|
2246
|
+
gap: 10,
|
|
2247
|
+
padding: "10px 12px"
|
|
2248
|
+
};
|
|
2249
|
+
var avatarStyle = {
|
|
2250
|
+
width: 32,
|
|
2251
|
+
height: 32,
|
|
2252
|
+
borderRadius: "50%",
|
|
2253
|
+
objectFit: "cover",
|
|
2254
|
+
flex: "0 0 auto"
|
|
2255
|
+
};
|
|
2256
|
+
var nameStyle = {
|
|
2257
|
+
display: "flex",
|
|
2258
|
+
alignItems: "center",
|
|
2259
|
+
fontSize: 14,
|
|
2260
|
+
fontWeight: 600,
|
|
2261
|
+
color: varRef2(IG_VAR.text),
|
|
2262
|
+
lineHeight: 1.2
|
|
2263
|
+
};
|
|
2264
|
+
var collabStyle = {
|
|
2265
|
+
fontSize: 12,
|
|
2266
|
+
color: varRef2(IG_VAR.muted),
|
|
2267
|
+
lineHeight: 1.2
|
|
2268
|
+
};
|
|
2269
|
+
function ReelPreview({
|
|
2270
|
+
author,
|
|
2271
|
+
body,
|
|
2272
|
+
media,
|
|
2273
|
+
audioName,
|
|
2274
|
+
className,
|
|
2275
|
+
style
|
|
2276
|
+
}) {
|
|
2277
|
+
const first = media[0];
|
|
2278
|
+
const username = author.username;
|
|
2279
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...cardStyle3, ...style }, children: [
|
|
2280
|
+
first ? first.kind === "video" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2281
|
+
"video",
|
|
2282
|
+
{
|
|
2283
|
+
src: first.src,
|
|
2284
|
+
poster: first.posterSrc,
|
|
2285
|
+
autoPlay: true,
|
|
2286
|
+
muted: true,
|
|
2287
|
+
loop: true,
|
|
2288
|
+
playsInline: true,
|
|
2289
|
+
style: coverStyle2
|
|
2290
|
+
}
|
|
2291
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: first.src, alt: first.alt ?? "", style: coverStyle2 }) : null,
|
|
2292
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: scrimStyle }),
|
|
2293
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: infoStyle, children: [
|
|
2294
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: authorRowStyle, children: [
|
|
2295
|
+
username ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 600, fontSize: 14 }, children: username }) : null,
|
|
2296
|
+
author.verified ? /* @__PURE__ */ jsxRuntime.jsx(md.MdVerified, { size: 13, "aria-label": "Verified", role: "img", style: { color: "#fff" } }) : null
|
|
2297
|
+
] }),
|
|
2298
|
+
body ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2299
|
+
ExpandableText,
|
|
2300
|
+
{
|
|
2301
|
+
lines: 2,
|
|
2302
|
+
toggleColor: "rgba(255,255,255,0.7)",
|
|
2303
|
+
style: captionStyle,
|
|
2304
|
+
children: body
|
|
2305
|
+
}
|
|
2306
|
+
) : null,
|
|
2307
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: audioStyle, children: [
|
|
2308
|
+
/* @__PURE__ */ jsxRuntime.jsx(md.MdMusicNote, { size: 14, "aria-hidden": true }),
|
|
2309
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: audioName ?? "Original audio" })
|
|
2310
|
+
] })
|
|
2311
|
+
] }),
|
|
2312
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: railStyle, children: [
|
|
2313
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiHeart, { size: 26, "aria-label": "Like", role: "img" }),
|
|
2314
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiMessageCircle, { size: 26, "aria-label": "Comment", role: "img" }),
|
|
2315
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiSend, { size: 26, "aria-label": "Share", role: "img" }),
|
|
2316
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiBookmark, { size: 26, "aria-label": "Save", role: "img" }),
|
|
2317
|
+
/* @__PURE__ */ jsxRuntime.jsx(fi.FiMoreHorizontal, { size: 22, "aria-hidden": true })
|
|
2318
|
+
] })
|
|
2319
|
+
] });
|
|
2320
|
+
}
|
|
2321
|
+
var cardStyle3 = {
|
|
2322
|
+
position: "relative",
|
|
2323
|
+
width: "100%",
|
|
2324
|
+
maxWidth: 320,
|
|
2325
|
+
aspectRatio: "9 / 16",
|
|
2326
|
+
borderRadius: 12,
|
|
2327
|
+
overflow: "hidden",
|
|
2328
|
+
background: "#000",
|
|
2329
|
+
color: "#fff",
|
|
2330
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
|
|
2331
|
+
};
|
|
2332
|
+
var coverStyle2 = {
|
|
2333
|
+
position: "absolute",
|
|
2334
|
+
inset: 0,
|
|
2335
|
+
width: "100%",
|
|
2336
|
+
height: "100%",
|
|
2337
|
+
objectFit: "cover"
|
|
2338
|
+
};
|
|
2339
|
+
var scrimStyle = {
|
|
2340
|
+
position: "absolute",
|
|
2341
|
+
inset: 0,
|
|
2342
|
+
background: "linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.55) 100%)",
|
|
2343
|
+
pointerEvents: "none"
|
|
2344
|
+
};
|
|
2345
|
+
var infoStyle = {
|
|
2346
|
+
position: "absolute",
|
|
2347
|
+
left: 12,
|
|
2348
|
+
right: 60,
|
|
2349
|
+
bottom: 14,
|
|
2350
|
+
display: "flex",
|
|
2351
|
+
flexDirection: "column",
|
|
2352
|
+
gap: 6,
|
|
2353
|
+
textShadow: "0 1px 3px rgba(0,0,0,0.5)"
|
|
2354
|
+
};
|
|
2355
|
+
var authorRowStyle = {
|
|
2356
|
+
display: "flex",
|
|
2357
|
+
alignItems: "center",
|
|
2358
|
+
gap: 5
|
|
2359
|
+
};
|
|
2360
|
+
var captionStyle = {
|
|
2361
|
+
fontSize: 13,
|
|
2362
|
+
lineHeight: 1.35
|
|
2363
|
+
};
|
|
2364
|
+
var audioStyle = {
|
|
2365
|
+
display: "flex",
|
|
2366
|
+
alignItems: "center",
|
|
2367
|
+
gap: 6,
|
|
2368
|
+
fontSize: 12
|
|
2369
|
+
};
|
|
2370
|
+
var railStyle = {
|
|
2371
|
+
position: "absolute",
|
|
2372
|
+
right: 8,
|
|
2373
|
+
bottom: 16,
|
|
2374
|
+
display: "flex",
|
|
2375
|
+
flexDirection: "column",
|
|
2376
|
+
alignItems: "center",
|
|
2377
|
+
gap: 18,
|
|
2378
|
+
color: "#fff",
|
|
2379
|
+
filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.4))"
|
|
2380
|
+
};
|
|
2381
|
+
function InstagramPostPreviewImpl({
|
|
2382
|
+
variant,
|
|
2383
|
+
author,
|
|
2384
|
+
media,
|
|
2385
|
+
theme = "auto",
|
|
2386
|
+
className,
|
|
2387
|
+
style
|
|
2388
|
+
}) {
|
|
2389
|
+
const resolvedMedia = useResolvedMedia(
|
|
2390
|
+
media,
|
|
2391
|
+
variant.media,
|
|
2392
|
+
altSignatureOf(variant.media)
|
|
2393
|
+
);
|
|
2394
|
+
const settings = variant.settings;
|
|
2395
|
+
const isReel = variant.post_type === "reel";
|
|
2396
|
+
if (isReel) {
|
|
2397
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2398
|
+
ReelPreview,
|
|
2399
|
+
{
|
|
2400
|
+
author,
|
|
2401
|
+
body: variant.body ?? "",
|
|
2402
|
+
media: resolvedMedia,
|
|
2403
|
+
audioName: settings?.audio_name,
|
|
2404
|
+
className,
|
|
2405
|
+
style
|
|
2406
|
+
}
|
|
2407
|
+
);
|
|
2408
|
+
}
|
|
2409
|
+
const collaborators = settings?.collaborators ?? [];
|
|
2410
|
+
const cardStyle5 = {
|
|
2411
|
+
...paletteVars2(),
|
|
2412
|
+
colorScheme: colorSchemeFor2(theme),
|
|
2413
|
+
background: varRef2(IG_VAR.bg),
|
|
2414
|
+
color: varRef2(IG_VAR.text),
|
|
2415
|
+
border: `1px solid ${varRef2(IG_VAR.border)}`,
|
|
2416
|
+
borderRadius: 8,
|
|
2417
|
+
maxWidth: 470,
|
|
2418
|
+
overflow: "hidden",
|
|
2419
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
|
2420
|
+
...style
|
|
2421
|
+
};
|
|
2422
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: cardStyle5, children: [
|
|
2423
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header2, { author, collaborators }),
|
|
2424
|
+
/* @__PURE__ */ jsxRuntime.jsx(FeedMedia, { media: resolvedMedia }),
|
|
2425
|
+
/* @__PURE__ */ jsxRuntime.jsx(Actions, {}),
|
|
2426
|
+
variant.body ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { paddingBottom: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(Caption, { username: author.username, body: variant.body }) }) : null
|
|
2427
|
+
] });
|
|
2428
|
+
}
|
|
2429
|
+
var InstagramPostPreview = react.memo(InstagramPostPreviewImpl);
|
|
2430
|
+
var LINK_COLOR = "#8ab4ff";
|
|
2431
|
+
var TOKEN2 = /([#@][\p{L}\p{N}_.]+)/gu;
|
|
2432
|
+
var IS_TOKEN2 = /^[#@][\p{L}\p{N}_.]+$/u;
|
|
2433
|
+
function Caption2({ body }) {
|
|
2434
|
+
const parts = body.split(TOKEN2);
|
|
2435
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ExpandableText, { lines: 2, toggleColor: "rgba(255,255,255,0.82)", style: wrapStyle4, children: parts.map(
|
|
2436
|
+
(part, i) => IS_TOKEN2.test(part) ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: part }, i)
|
|
2437
|
+
) });
|
|
2438
|
+
}
|
|
2439
|
+
var wrapStyle4 = {
|
|
2440
|
+
fontSize: 14,
|
|
2441
|
+
lineHeight: 1.35
|
|
1994
2442
|
};
|
|
1995
2443
|
function Media2({
|
|
1996
2444
|
media,
|
|
@@ -2010,7 +2458,7 @@ function Media2({
|
|
|
2010
2458
|
muted: true,
|
|
2011
2459
|
loop: true,
|
|
2012
2460
|
playsInline: true,
|
|
2013
|
-
style:
|
|
2461
|
+
style: coverStyle3
|
|
2014
2462
|
}
|
|
2015
2463
|
);
|
|
2016
2464
|
}
|
|
@@ -2037,11 +2485,11 @@ function PhotoCarousel({ media }) {
|
|
|
2037
2485
|
};
|
|
2038
2486
|
}, [emblaApi, sync]);
|
|
2039
2487
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "absolute", inset: 0 }, children: [
|
|
2040
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
2041
|
-
media.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
2488
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: slideStyle2, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: m.src, alt: m.alt ?? "", style: coverStyle3 }) }, `${m.src}-${i}`)) }) }),
|
|
2489
|
+
media.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: dotsStyle2, children: media.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2042
2490
|
"span",
|
|
2043
2491
|
{
|
|
2044
|
-
style: { ...
|
|
2492
|
+
style: { ...dotStyle2, opacity: i === selected ? 1 : 0.4 }
|
|
2045
2493
|
},
|
|
2046
2494
|
`dot-${m.src}-${i}`
|
|
2047
2495
|
)) }) : null
|
|
@@ -2052,11 +2500,13 @@ function EmptyMedia() {
|
|
|
2052
2500
|
}
|
|
2053
2501
|
function ProcessingMedia() {
|
|
2054
2502
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: emptyStyle, children: [
|
|
2503
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: SHIMMER_KEYFRAME }),
|
|
2055
2504
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: shimmerStyle }),
|
|
2056
2505
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { position: "relative", zIndex: 1 }, children: "Processing media\u2026" })
|
|
2057
2506
|
] });
|
|
2058
2507
|
}
|
|
2059
|
-
var
|
|
2508
|
+
var SHIMMER_KEYFRAME = `@keyframes pr-tt-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}`;
|
|
2509
|
+
var coverStyle3 = {
|
|
2060
2510
|
position: "absolute",
|
|
2061
2511
|
inset: 0,
|
|
2062
2512
|
width: "100%",
|
|
@@ -2072,13 +2522,13 @@ var containerStyle = {
|
|
|
2072
2522
|
display: "flex",
|
|
2073
2523
|
height: "100%"
|
|
2074
2524
|
};
|
|
2075
|
-
var
|
|
2525
|
+
var slideStyle2 = {
|
|
2076
2526
|
position: "relative",
|
|
2077
2527
|
flex: "0 0 100%",
|
|
2078
2528
|
minWidth: 0,
|
|
2079
2529
|
height: "100%"
|
|
2080
2530
|
};
|
|
2081
|
-
var
|
|
2531
|
+
var dotsStyle2 = {
|
|
2082
2532
|
position: "absolute",
|
|
2083
2533
|
bottom: 124,
|
|
2084
2534
|
left: "50%",
|
|
@@ -2087,7 +2537,7 @@ var dotsStyle = {
|
|
|
2087
2537
|
gap: 5,
|
|
2088
2538
|
alignItems: "center"
|
|
2089
2539
|
};
|
|
2090
|
-
var
|
|
2540
|
+
var dotStyle2 = {
|
|
2091
2541
|
width: 6,
|
|
2092
2542
|
height: 6,
|
|
2093
2543
|
borderRadius: "50%",
|
|
@@ -2182,16 +2632,16 @@ function TikTokPostPreviewImpl({
|
|
|
2182
2632
|
const label = commercialLabel(variant.settings);
|
|
2183
2633
|
const isAigc = Boolean(variant.settings?.is_aigc);
|
|
2184
2634
|
const pending = (media?.length ?? 0) > 0 && resolvedMedia.length === 0;
|
|
2185
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...
|
|
2635
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...cardStyle4, ...style }, children: [
|
|
2186
2636
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES }),
|
|
2187
2637
|
/* @__PURE__ */ jsxRuntime.jsx(Media2, { media: resolvedMedia, pending }),
|
|
2188
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
2189
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
2638
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: scrimStyle2 }),
|
|
2639
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: infoStyle2, children: [
|
|
2190
2640
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: usernameStyle, children: handle }),
|
|
2191
|
-
variant.body ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2641
|
+
variant.body ? /* @__PURE__ */ jsxRuntime.jsx(Caption2, { body: variant.body }) : null,
|
|
2192
2642
|
label || isAigc ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: labelsStyle, children: [
|
|
2193
|
-
label ? /* @__PURE__ */ jsxRuntime.jsx("span", { style:
|
|
2194
|
-
isAigc ? /* @__PURE__ */ jsxRuntime.jsx("span", { style:
|
|
2643
|
+
label ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: pillStyle2, children: label }) : null,
|
|
2644
|
+
isAigc ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: pillStyle2, children: "Creator labeled as AI-generated" }) : null
|
|
2195
2645
|
] }) : null,
|
|
2196
2646
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: musicRowStyle, children: [
|
|
2197
2647
|
/* @__PURE__ */ jsxRuntime.jsx(io5.IoMusicalNotes, { size: 13 }),
|
|
@@ -2201,7 +2651,7 @@ function TikTokPostPreviewImpl({
|
|
|
2201
2651
|
] })
|
|
2202
2652
|
] })
|
|
2203
2653
|
] }),
|
|
2204
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
2654
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: railStyle2, children: [
|
|
2205
2655
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: avatarWrapStyle, children: [
|
|
2206
2656
|
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { url: creator.avatar_url, name: creator.nickname }),
|
|
2207
2657
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: followBadgeStyle, children: /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, { size: 14 }) })
|
|
@@ -2222,14 +2672,14 @@ function RailAction({ icon, count }) {
|
|
|
2222
2672
|
}
|
|
2223
2673
|
function Avatar({ url, name }) {
|
|
2224
2674
|
if (url) {
|
|
2225
|
-
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: name, style:
|
|
2675
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: name, style: avatarStyle2 });
|
|
2226
2676
|
}
|
|
2227
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...
|
|
2677
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...avatarStyle2, ...avatarFallbackStyle }, children: name.slice(0, 1).toUpperCase() });
|
|
2228
2678
|
}
|
|
2229
2679
|
function Disc({ url }) {
|
|
2230
2680
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: discStyle, children: url ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: "", style: discImgStyle }) : null });
|
|
2231
2681
|
}
|
|
2232
|
-
var
|
|
2682
|
+
var cardStyle4 = {
|
|
2233
2683
|
position: "relative",
|
|
2234
2684
|
width: "100%",
|
|
2235
2685
|
maxWidth: 320,
|
|
@@ -2240,13 +2690,13 @@ var cardStyle3 = {
|
|
|
2240
2690
|
color: "#fff",
|
|
2241
2691
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
|
|
2242
2692
|
};
|
|
2243
|
-
var
|
|
2693
|
+
var scrimStyle2 = {
|
|
2244
2694
|
position: "absolute",
|
|
2245
2695
|
inset: 0,
|
|
2246
2696
|
background: "linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%)",
|
|
2247
2697
|
pointerEvents: "none"
|
|
2248
2698
|
};
|
|
2249
|
-
var
|
|
2699
|
+
var infoStyle2 = {
|
|
2250
2700
|
position: "absolute",
|
|
2251
2701
|
left: 14,
|
|
2252
2702
|
right: 70,
|
|
@@ -2267,7 +2717,7 @@ var labelsStyle = {
|
|
|
2267
2717
|
gap: 4,
|
|
2268
2718
|
marginTop: 2
|
|
2269
2719
|
};
|
|
2270
|
-
var
|
|
2720
|
+
var pillStyle2 = {
|
|
2271
2721
|
display: "inline-flex",
|
|
2272
2722
|
alignItems: "center",
|
|
2273
2723
|
background: "rgba(255,255,255,0.18)",
|
|
@@ -2284,7 +2734,7 @@ var musicRowStyle = {
|
|
|
2284
2734
|
fontSize: 13,
|
|
2285
2735
|
marginTop: 4
|
|
2286
2736
|
};
|
|
2287
|
-
var
|
|
2737
|
+
var railStyle2 = {
|
|
2288
2738
|
position: "absolute",
|
|
2289
2739
|
right: 8,
|
|
2290
2740
|
bottom: 14,
|
|
@@ -2298,7 +2748,7 @@ var avatarWrapStyle = {
|
|
|
2298
2748
|
position: "relative",
|
|
2299
2749
|
marginBottom: 8
|
|
2300
2750
|
};
|
|
2301
|
-
var
|
|
2751
|
+
var avatarStyle2 = {
|
|
2302
2752
|
width: 46,
|
|
2303
2753
|
height: 46,
|
|
2304
2754
|
borderRadius: "50%",
|
|
@@ -2361,6 +2811,8 @@ var discImgStyle = {
|
|
|
2361
2811
|
};
|
|
2362
2812
|
var KEYFRAMES = `@keyframes pr-tt-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pr-tt-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}`;
|
|
2363
2813
|
var TikTokPostPreview = react.memo(TikTokPostPreviewImpl);
|
|
2814
|
+
|
|
2815
|
+
// src/preview/tiktok/theme.ts
|
|
2364
2816
|
var TT_VAR = {
|
|
2365
2817
|
text: "--pr-tt-text",
|
|
2366
2818
|
muted: "--pr-tt-muted",
|
|
@@ -2368,58 +2820,26 @@ var TT_VAR = {
|
|
|
2368
2820
|
accent: "--pr-tt-accent",
|
|
2369
2821
|
switchOff: "--pr-tt-switch-off"
|
|
2370
2822
|
};
|
|
2371
|
-
|
|
2372
|
-
text: "rgba(0,0,0,0.9)",
|
|
2373
|
-
muted: "rgba(0,0,0,0.55)",
|
|
2374
|
-
border: "rgba(0,0,0,0.12)",
|
|
2375
|
-
accent: "#fe2c55",
|
|
2376
|
-
switchOff: "rgba(0,0,0,0.18)"
|
|
2377
|
-
};
|
|
2378
|
-
var DARK2 = {
|
|
2379
|
-
text: "rgba(255,255,255,0.92)",
|
|
2380
|
-
muted: "#8a8a92",
|
|
2381
|
-
border: "rgba(255,255,255,0.14)",
|
|
2382
|
-
accent: "#fe2c55",
|
|
2383
|
-
switchOff: "rgba(255,255,255,0.22)"
|
|
2384
|
-
};
|
|
2385
|
-
function varRef2(name) {
|
|
2823
|
+
function varRef3(name) {
|
|
2386
2824
|
return `var(${name})`;
|
|
2387
2825
|
}
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
}
|
|
2398
|
-
function usePrefersDark2() {
|
|
2399
|
-
const [dark, setDark] = react.useState(false);
|
|
2400
|
-
react.useEffect(() => {
|
|
2401
|
-
if (typeof window === "undefined" || !window.matchMedia) {
|
|
2402
|
-
return;
|
|
2403
|
-
}
|
|
2404
|
-
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2405
|
-
setDark(mq.matches);
|
|
2406
|
-
const onChange = (event) => setDark(event.matches);
|
|
2407
|
-
mq.addEventListener("change", onChange);
|
|
2408
|
-
return () => mq.removeEventListener("change", onChange);
|
|
2409
|
-
}, []);
|
|
2410
|
-
return dark;
|
|
2826
|
+
var PALETTE_VARS3 = {
|
|
2827
|
+
[TT_VAR.text]: "light-dark(rgba(0,0,0,0.9), rgba(255,255,255,0.92))",
|
|
2828
|
+
[TT_VAR.muted]: "light-dark(rgba(0,0,0,0.55), #8a8a92)",
|
|
2829
|
+
[TT_VAR.border]: "light-dark(rgba(0,0,0,0.12), rgba(255,255,255,0.14))",
|
|
2830
|
+
[TT_VAR.accent]: "#fe2c55",
|
|
2831
|
+
[TT_VAR.switchOff]: "light-dark(rgba(0,0,0,0.18), rgba(255,255,255,0.22))"
|
|
2832
|
+
};
|
|
2833
|
+
function paletteVars3() {
|
|
2834
|
+
return PALETTE_VARS3;
|
|
2411
2835
|
}
|
|
2412
|
-
function
|
|
2413
|
-
|
|
2414
|
-
if (theme === "auto") {
|
|
2415
|
-
return prefersDark;
|
|
2416
|
-
}
|
|
2417
|
-
return theme === "dark";
|
|
2836
|
+
function colorSchemeFor3(theme) {
|
|
2837
|
+
return theme === "auto" ? "light dark" : theme;
|
|
2418
2838
|
}
|
|
2419
|
-
var MUTED2 =
|
|
2420
|
-
var BORDER =
|
|
2421
|
-
var ACCENT =
|
|
2422
|
-
var SWITCH_OFF =
|
|
2839
|
+
var MUTED2 = varRef3(TT_VAR.muted);
|
|
2840
|
+
var BORDER = varRef3(TT_VAR.border);
|
|
2841
|
+
var ACCENT = varRef3(TT_VAR.accent);
|
|
2842
|
+
var SWITCH_OFF = varRef3(TT_VAR.switchOff);
|
|
2423
2843
|
var ON = "#34c759";
|
|
2424
2844
|
function Row({
|
|
2425
2845
|
label,
|
|
@@ -2427,11 +2847,17 @@ function Row({
|
|
|
2427
2847
|
control,
|
|
2428
2848
|
htmlFor
|
|
2429
2849
|
}) {
|
|
2430
|
-
|
|
2431
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2850
|
+
const text = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2851
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 14 }, children: label }),
|
|
2852
|
+
sublabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: MUTED2 }, children: sublabel }) : null
|
|
2853
|
+
] });
|
|
2854
|
+
const textStyle = {
|
|
2855
|
+
display: "flex",
|
|
2856
|
+
flexDirection: "column",
|
|
2857
|
+
gap: 2
|
|
2858
|
+
};
|
|
2859
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle3, children: [
|
|
2860
|
+
htmlFor ? /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor, style: textStyle, children: text }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: textStyle, children: text }),
|
|
2435
2861
|
control
|
|
2436
2862
|
] });
|
|
2437
2863
|
}
|
|
@@ -2499,7 +2925,7 @@ function CheckRow({
|
|
|
2499
2925
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 14 }, children: label })
|
|
2500
2926
|
] });
|
|
2501
2927
|
}
|
|
2502
|
-
var
|
|
2928
|
+
var rowStyle3 = {
|
|
2503
2929
|
display: "flex",
|
|
2504
2930
|
alignItems: "center",
|
|
2505
2931
|
justifyContent: "space-between",
|
|
@@ -2553,7 +2979,6 @@ function AudienceSelect({
|
|
|
2553
2979
|
value,
|
|
2554
2980
|
onChange
|
|
2555
2981
|
}) {
|
|
2556
|
-
const id = react.useId();
|
|
2557
2982
|
const options = js.audiencePrivacyOptions(creatorInfo.privacy_options, value);
|
|
2558
2983
|
const unselected = js.audienceUnselected(value);
|
|
2559
2984
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
@@ -2561,7 +2986,7 @@ function AudienceSelect({
|
|
|
2561
2986
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2562
2987
|
"select",
|
|
2563
2988
|
{
|
|
2564
|
-
|
|
2989
|
+
"aria-label": "Who can view this post",
|
|
2565
2990
|
value: value.privacy_level ?? "",
|
|
2566
2991
|
onChange: (e) => onChange({
|
|
2567
2992
|
...value,
|
|
@@ -2604,7 +3029,7 @@ function TikTokCaptionField({
|
|
|
2604
3029
|
const max = js.captionMaxFor(postType);
|
|
2605
3030
|
const count = value.length;
|
|
2606
3031
|
const over = count > max;
|
|
2607
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...
|
|
3032
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...wrapStyle5, ...style }, children: [
|
|
2608
3033
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: labelRowStyle, children: [
|
|
2609
3034
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, style: labelStyle, children: "Caption" }),
|
|
2610
3035
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2612,7 +3037,7 @@ function TikTokCaptionField({
|
|
|
2612
3037
|
{
|
|
2613
3038
|
style: {
|
|
2614
3039
|
...countStyle,
|
|
2615
|
-
color: over ?
|
|
3040
|
+
color: over ? varRef3(TT_VAR.accent) : varRef3(TT_VAR.muted)
|
|
2616
3041
|
},
|
|
2617
3042
|
children: [
|
|
2618
3043
|
count.toLocaleString(),
|
|
@@ -2632,13 +3057,13 @@ function TikTokCaptionField({
|
|
|
2632
3057
|
rows: 4,
|
|
2633
3058
|
style: {
|
|
2634
3059
|
...textareaStyle,
|
|
2635
|
-
borderColor: over ?
|
|
3060
|
+
borderColor: over ? varRef3(TT_VAR.accent) : varRef3(TT_VAR.border)
|
|
2636
3061
|
}
|
|
2637
3062
|
}
|
|
2638
3063
|
)
|
|
2639
3064
|
] });
|
|
2640
3065
|
}
|
|
2641
|
-
var
|
|
3066
|
+
var wrapStyle5 = {
|
|
2642
3067
|
display: "flex",
|
|
2643
3068
|
flexDirection: "column",
|
|
2644
3069
|
gap: 6,
|
|
@@ -2794,7 +3219,6 @@ function TikTokPublishPanel({
|
|
|
2794
3219
|
className,
|
|
2795
3220
|
style
|
|
2796
3221
|
}) {
|
|
2797
|
-
const dark = useIsDark2(theme);
|
|
2798
3222
|
const isVideo = variant.post_type === "video";
|
|
2799
3223
|
const captionOver = caption.length > js.captionMaxFor(variant.post_type);
|
|
2800
3224
|
const mediaOk = mediaCountValid(variant.post_type, variant.media?.length ?? 0);
|
|
@@ -2804,9 +3228,10 @@ function TikTokPublishPanel({
|
|
|
2804
3228
|
{
|
|
2805
3229
|
className,
|
|
2806
3230
|
style: {
|
|
2807
|
-
...
|
|
3231
|
+
...paletteVars3(),
|
|
3232
|
+
colorScheme: colorSchemeFor3(theme),
|
|
2808
3233
|
...panelStyle,
|
|
2809
|
-
color:
|
|
3234
|
+
color: varRef3(TT_VAR.text),
|
|
2810
3235
|
...style
|
|
2811
3236
|
},
|
|
2812
3237
|
children: [
|
|
@@ -2911,10 +3336,12 @@ exports.CommercialDisclosure = CommercialDisclosure;
|
|
|
2911
3336
|
exports.Connect = Connect;
|
|
2912
3337
|
exports.Declaration = Declaration;
|
|
2913
3338
|
exports.DocumentCard = DocumentCard;
|
|
3339
|
+
exports.InstagramPostPreview = InstagramPostPreview;
|
|
2914
3340
|
exports.InteractionToggles = InteractionToggles;
|
|
2915
3341
|
exports.LinkedInPostPreview = LinkedInPostPreview;
|
|
2916
3342
|
exports.Poll = Poll;
|
|
2917
3343
|
exports.PostrunProvider = PostrunProvider;
|
|
3344
|
+
exports.ReelPreview = ReelPreview;
|
|
2918
3345
|
exports.TikTokCaptionField = TikTokCaptionField;
|
|
2919
3346
|
exports.TikTokPostPreview = TikTokPostPreview;
|
|
2920
3347
|
exports.TikTokPublishPanel = TikTokPublishPanel;
|