@postrun/react 2.6.0 → 2.8.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 +533 -156
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -17
- package/dist/index.d.ts +94 -17
- package/dist/index.js +533 -159
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, memo, useMemo, useState, useEffect,
|
|
2
|
+
import { createContext, memo, useMemo, useState, useEffect, Fragment as Fragment$1, useCallback, useRef, useLayoutEffect, createElement, useContext, useId } from 'react';
|
|
3
3
|
import { useInfiniteQuery, useQuery, useMutation, QueryClient } from '@tanstack/react-query';
|
|
4
4
|
import { xPollDurationLabel, linkedinPollDurationLabel, createPostrunClient, profilesList, profilesGet, profilesCreate, profilesUpdate, profilesDelete, connectionsConnect, connectionsListByProfile, connectionsGet, connectionsListAccounts, connectionsSelect, connectionsDelete, mediaGet, mediaList, mediaUpdate, mediaDelete, postsList, postsGet, postsCreate, buildCreatePost, isPostPlatform, failedVariants, isPublished, postsValidate, postsUpdate, postsDelete, tiktokCreatorInfo, audiencePrivacyOptions, audienceUnselected, tiktokPrivacyLabel, parsePrivacyLevel, TIKTOK_AUDIENCE_REQUIRED_HINT, captionMaxFor, commercialLabelNotice, commercialDisclosureIncomplete, setCommercialDisclosure, setBrandKind, TIKTOK_DISCLOSURE_REQUIRED_HINT, TIKTOK_BRANDED_CONTENT_POLICY_URL, TIKTOK_MUSIC_CONFIRMATION_URL, interactionRows, interactionValueKey, toggleInteraction, tiktokOptionsReady, TIKTOK_PROCESSING_NOTICE, brandedContentDeclared, mediaCreate, PostrunError } from '@postrun/js';
|
|
5
5
|
export { TIKTOK_CAPTION_MAX, captionMaxFor } from '@postrun/js';
|
|
@@ -10,10 +10,11 @@ import pRetry, { AbortError } from 'p-retry';
|
|
|
10
10
|
import axios, { isAxiosError } from 'axios';
|
|
11
11
|
import { enrichTweet, TweetContainer, TweetHeader, TweetInReplyTo, TweetBody, TweetMedia, QuotedTweet } from 'react-tweet';
|
|
12
12
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
|
-
import { FiMessageCircle, FiRepeat, FiHeart, FiBarChart2, FiShare, FiGlobe, FiUsers, FiThumbsUp, FiMessageSquare, FiSend, FiFileText } from 'react-icons/fi';
|
|
13
|
+
import { FiMessageCircle, FiRepeat, FiHeart, FiBarChart2, FiShare, FiGlobe, FiUsers, FiThumbsUp, FiMessageSquare, FiSend, FiBookmark, FiMoreHorizontal, FiFileText } from 'react-icons/fi';
|
|
14
14
|
import twitterText from 'twitter-text';
|
|
15
15
|
import { LuBadgeCheck } from 'react-icons/lu';
|
|
16
16
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
17
|
+
import { MdVerified, MdMusicNote } from 'react-icons/md';
|
|
17
18
|
import { IoMusicalNotes } from 'react-icons/io5';
|
|
18
19
|
|
|
19
20
|
// src/context.tsx
|
|
@@ -973,6 +974,42 @@ function useTikTokCreatorInfo(connectionId) {
|
|
|
973
974
|
queryClient
|
|
974
975
|
);
|
|
975
976
|
}
|
|
977
|
+
|
|
978
|
+
// src/preview/from-upload.ts
|
|
979
|
+
function previewKind(item) {
|
|
980
|
+
const detected = item.media?.kind;
|
|
981
|
+
if (detected) {
|
|
982
|
+
return detected === "document" ? null : detected;
|
|
983
|
+
}
|
|
984
|
+
const mime = item.file.type;
|
|
985
|
+
if (mime === "image/gif") {
|
|
986
|
+
return "gif";
|
|
987
|
+
}
|
|
988
|
+
if (mime.startsWith("video/")) {
|
|
989
|
+
return "video";
|
|
990
|
+
}
|
|
991
|
+
if (mime.startsWith("image/")) {
|
|
992
|
+
return "image";
|
|
993
|
+
}
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
996
|
+
function toPreviewMedia(items) {
|
|
997
|
+
return items.flatMap((item) => {
|
|
998
|
+
const kind = previewKind(item);
|
|
999
|
+
if (!kind) {
|
|
1000
|
+
return [];
|
|
1001
|
+
}
|
|
1002
|
+
return [
|
|
1003
|
+
{
|
|
1004
|
+
kind,
|
|
1005
|
+
file: item.file,
|
|
1006
|
+
width: item.media?.source?.width ?? void 0,
|
|
1007
|
+
height: item.media?.source?.height ?? void 0,
|
|
1008
|
+
alt: item.media?.alt_text ?? void 0
|
|
1009
|
+
}
|
|
1010
|
+
];
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
976
1013
|
function fileKey(file) {
|
|
977
1014
|
return file ? `${file.name}:${file.size}:${file.lastModified}` : "";
|
|
978
1015
|
}
|
|
@@ -1308,6 +1345,8 @@ function XPostPreviewImpl({
|
|
|
1308
1345
|
);
|
|
1309
1346
|
}
|
|
1310
1347
|
var XPostPreview = memo(XPostPreviewImpl);
|
|
1348
|
+
|
|
1349
|
+
// src/preview/linkedin/theme.ts
|
|
1311
1350
|
var LI_VAR = {
|
|
1312
1351
|
bg: "--pr-li-bg",
|
|
1313
1352
|
text: "--pr-li-text",
|
|
@@ -1315,53 +1354,20 @@ var LI_VAR = {
|
|
|
1315
1354
|
border: "--pr-li-border",
|
|
1316
1355
|
accent: "--pr-li-accent"
|
|
1317
1356
|
};
|
|
1318
|
-
var LIGHT = {
|
|
1319
|
-
bg: "#ffffff",
|
|
1320
|
-
text: "rgba(0,0,0,0.9)",
|
|
1321
|
-
muted: "rgba(0,0,0,0.6)",
|
|
1322
|
-
border: "rgba(0,0,0,0.08)",
|
|
1323
|
-
accent: "rgb(10,102,194)"
|
|
1324
|
-
};
|
|
1325
|
-
var DARK = {
|
|
1326
|
-
bg: "#1b1f23",
|
|
1327
|
-
text: "rgba(255,255,255,0.9)",
|
|
1328
|
-
muted: "rgba(255,255,255,0.6)",
|
|
1329
|
-
border: "rgba(255,255,255,0.15)",
|
|
1330
|
-
accent: "rgb(112,181,249)"
|
|
1331
|
-
};
|
|
1332
1357
|
function varRef(name) {
|
|
1333
1358
|
return `var(${name})`;
|
|
1334
1359
|
}
|
|
1335
|
-
function paletteVars(
|
|
1336
|
-
const p = dark ? DARK : LIGHT;
|
|
1360
|
+
function paletteVars() {
|
|
1337
1361
|
return {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
"
|
|
1362
|
+
[LI_VAR.bg]: "light-dark(#ffffff, #1b1f23)",
|
|
1363
|
+
[LI_VAR.text]: "light-dark(rgba(0,0,0,0.9), rgba(255,255,255,0.9))",
|
|
1364
|
+
[LI_VAR.muted]: "light-dark(rgba(0,0,0,0.6), rgba(255,255,255,0.6))",
|
|
1365
|
+
[LI_VAR.border]: "light-dark(rgba(0,0,0,0.08), rgba(255,255,255,0.15))",
|
|
1366
|
+
[LI_VAR.accent]: "light-dark(rgb(10,102,194), rgb(112,181,249))"
|
|
1343
1367
|
};
|
|
1344
1368
|
}
|
|
1345
|
-
function
|
|
1346
|
-
|
|
1347
|
-
useEffect(() => {
|
|
1348
|
-
if (typeof window === "undefined" || !window.matchMedia) {
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1352
|
-
setDark(mq.matches);
|
|
1353
|
-
const onChange = (event) => setDark(event.matches);
|
|
1354
|
-
mq.addEventListener("change", onChange);
|
|
1355
|
-
return () => mq.removeEventListener("change", onChange);
|
|
1356
|
-
}, []);
|
|
1357
|
-
return dark;
|
|
1358
|
-
}
|
|
1359
|
-
function useIsDark(theme) {
|
|
1360
|
-
const prefersDark = usePrefersDark();
|
|
1361
|
-
if (theme === "auto") {
|
|
1362
|
-
return prefersDark;
|
|
1363
|
-
}
|
|
1364
|
-
return theme === "dark";
|
|
1369
|
+
function colorSchemeFor(theme) {
|
|
1370
|
+
return theme === "auto" ? "light dark" : theme;
|
|
1365
1371
|
}
|
|
1366
1372
|
function domainOf(source) {
|
|
1367
1373
|
try {
|
|
@@ -1828,7 +1834,6 @@ function LinkedInPostPreviewImpl({
|
|
|
1828
1834
|
className,
|
|
1829
1835
|
style
|
|
1830
1836
|
}) {
|
|
1831
|
-
const dark = useIsDark(theme);
|
|
1832
1837
|
const resolvedMedia = useResolvedMedia(
|
|
1833
1838
|
media,
|
|
1834
1839
|
variant.media,
|
|
@@ -1840,8 +1845,9 @@ function LinkedInPostPreviewImpl({
|
|
|
1840
1845
|
accent: varRef(LI_VAR.accent),
|
|
1841
1846
|
muted: varRef(LI_VAR.muted)
|
|
1842
1847
|
};
|
|
1843
|
-
const
|
|
1844
|
-
...paletteVars(
|
|
1848
|
+
const cardStyle5 = {
|
|
1849
|
+
...paletteVars(),
|
|
1850
|
+
colorScheme: colorSchemeFor(theme),
|
|
1845
1851
|
background: varRef(LI_VAR.bg),
|
|
1846
1852
|
color: varRef(LI_VAR.text),
|
|
1847
1853
|
border: `1px solid ${varRef(LI_VAR.border)}`,
|
|
@@ -1851,7 +1857,7 @@ function LinkedInPostPreviewImpl({
|
|
|
1851
1857
|
fontFamily: FONT_STACK,
|
|
1852
1858
|
...style
|
|
1853
1859
|
};
|
|
1854
|
-
return /* @__PURE__ */ jsxs("div", { className, style:
|
|
1860
|
+
return /* @__PURE__ */ jsxs("div", { className, style: cardStyle5, children: [
|
|
1855
1861
|
/* @__PURE__ */ jsx(Header, { author, visibility, time }),
|
|
1856
1862
|
variant.body ? /* @__PURE__ */ jsx("div", { style: { padding: "8px 16px 0" }, children: /* @__PURE__ */ jsx(
|
|
1857
1863
|
PostBody,
|
|
@@ -1882,10 +1888,58 @@ function renderContent(variant, media) {
|
|
|
1882
1888
|
}
|
|
1883
1889
|
var INSET = { padding: "12px 16px 0" };
|
|
1884
1890
|
var LinkedInPostPreview = memo(LinkedInPostPreviewImpl);
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
var
|
|
1888
|
-
|
|
1891
|
+
|
|
1892
|
+
// src/preview/instagram/theme.ts
|
|
1893
|
+
var IG_VAR = {
|
|
1894
|
+
bg: "--pr-ig-bg",
|
|
1895
|
+
text: "--pr-ig-text",
|
|
1896
|
+
muted: "--pr-ig-muted",
|
|
1897
|
+
border: "--pr-ig-border",
|
|
1898
|
+
accent: "--pr-ig-accent"
|
|
1899
|
+
};
|
|
1900
|
+
function varRef2(name) {
|
|
1901
|
+
return `var(${name})`;
|
|
1902
|
+
}
|
|
1903
|
+
function paletteVars2() {
|
|
1904
|
+
return {
|
|
1905
|
+
[IG_VAR.bg]: "light-dark(#ffffff, #000000)",
|
|
1906
|
+
[IG_VAR.text]: "light-dark(#000000, #f5f5f5)",
|
|
1907
|
+
[IG_VAR.muted]: "light-dark(#737373, #a8a8a8)",
|
|
1908
|
+
[IG_VAR.border]: "light-dark(#dbdbdb, #262626)",
|
|
1909
|
+
[IG_VAR.accent]: "light-dark(#00376b, #e0f1ff)"
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1912
|
+
function colorSchemeFor2(theme) {
|
|
1913
|
+
return theme === "auto" ? "light dark" : theme;
|
|
1914
|
+
}
|
|
1915
|
+
function Actions() {
|
|
1916
|
+
return /* @__PURE__ */ jsxs("div", { style: rowStyle, children: [
|
|
1917
|
+
/* @__PURE__ */ jsxs("div", { style: leftStyle, children: [
|
|
1918
|
+
/* @__PURE__ */ jsx(FiHeart, { size: 24, "aria-label": "Like", role: "img" }),
|
|
1919
|
+
/* @__PURE__ */ jsx(FiMessageCircle, { size: 24, "aria-label": "Comment", role: "img" }),
|
|
1920
|
+
/* @__PURE__ */ jsx(FiSend, { size: 24, "aria-label": "Share", role: "img" })
|
|
1921
|
+
] }),
|
|
1922
|
+
/* @__PURE__ */ jsx(FiBookmark, { size: 24, "aria-label": "Save", role: "img" })
|
|
1923
|
+
] });
|
|
1924
|
+
}
|
|
1925
|
+
var rowStyle = {
|
|
1926
|
+
display: "flex",
|
|
1927
|
+
alignItems: "center",
|
|
1928
|
+
justifyContent: "space-between",
|
|
1929
|
+
padding: "10px 12px 4px",
|
|
1930
|
+
color: varRef2(IG_VAR.text)
|
|
1931
|
+
};
|
|
1932
|
+
var leftStyle = {
|
|
1933
|
+
display: "flex",
|
|
1934
|
+
alignItems: "center",
|
|
1935
|
+
gap: 16
|
|
1936
|
+
};
|
|
1937
|
+
function ExpandableText({
|
|
1938
|
+
children,
|
|
1939
|
+
lines = 2,
|
|
1940
|
+
toggleColor,
|
|
1941
|
+
style
|
|
1942
|
+
}) {
|
|
1889
1943
|
const [expanded, setExpanded] = useState(false);
|
|
1890
1944
|
const [overflowing, setOverflowing] = useState(false);
|
|
1891
1945
|
const ref = useRef(null);
|
|
@@ -1895,55 +1949,406 @@ function Caption({ body }) {
|
|
|
1895
1949
|
return;
|
|
1896
1950
|
}
|
|
1897
1951
|
setOverflowing(el.scrollHeight > el.clientHeight + 1);
|
|
1898
|
-
}, [
|
|
1899
|
-
const
|
|
1900
|
-
return /* @__PURE__ */ jsxs("div", { style
|
|
1901
|
-
/* @__PURE__ */ jsx("div", { ref, style:
|
|
1902
|
-
(part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
|
|
1903
|
-
) }),
|
|
1952
|
+
}, [expanded, children]);
|
|
1953
|
+
const textStyle = expanded ? FULL : { ...FULL, ...clampStyle(lines) };
|
|
1954
|
+
return /* @__PURE__ */ jsxs("div", { style, children: [
|
|
1955
|
+
/* @__PURE__ */ jsx("div", { ref, style: textStyle, children }),
|
|
1904
1956
|
overflowing || expanded ? /* @__PURE__ */ jsx(
|
|
1905
1957
|
"button",
|
|
1906
1958
|
{
|
|
1907
1959
|
type: "button",
|
|
1908
1960
|
"aria-expanded": expanded,
|
|
1909
|
-
"aria-label": expanded ? "
|
|
1961
|
+
"aria-label": expanded ? "Show less" : "Show more",
|
|
1910
1962
|
onClick: () => setExpanded((v) => !v),
|
|
1911
|
-
style:
|
|
1963
|
+
style: { ...toggleStyle, color: toggleColor ?? "inherit" },
|
|
1912
1964
|
children: expanded ? "less" : "more"
|
|
1913
1965
|
}
|
|
1914
1966
|
) : null
|
|
1915
1967
|
] });
|
|
1916
1968
|
}
|
|
1917
|
-
var
|
|
1918
|
-
fontSize: 14,
|
|
1919
|
-
lineHeight: 1.35
|
|
1920
|
-
};
|
|
1921
|
-
var clampedTextStyle = {
|
|
1922
|
-
display: "-webkit-box",
|
|
1923
|
-
WebkitLineClamp: 2,
|
|
1924
|
-
WebkitBoxOrient: "vertical",
|
|
1925
|
-
overflow: "hidden",
|
|
1969
|
+
var FULL = {
|
|
1926
1970
|
whiteSpace: "pre-wrap",
|
|
1927
1971
|
wordBreak: "break-word"
|
|
1928
1972
|
};
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
};
|
|
1936
|
-
|
|
1973
|
+
function clampStyle(lines) {
|
|
1974
|
+
return {
|
|
1975
|
+
display: "-webkit-box",
|
|
1976
|
+
WebkitLineClamp: lines,
|
|
1977
|
+
WebkitBoxOrient: "vertical",
|
|
1978
|
+
overflow: "hidden"
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
var toggleStyle = {
|
|
1937
1982
|
display: "inline-block",
|
|
1938
1983
|
marginTop: 2,
|
|
1939
1984
|
padding: 0,
|
|
1940
1985
|
border: 0,
|
|
1941
1986
|
background: "transparent",
|
|
1942
|
-
|
|
1943
|
-
|
|
1987
|
+
font: "inherit",
|
|
1988
|
+
fontWeight: 600,
|
|
1989
|
+
cursor: "pointer"
|
|
1990
|
+
};
|
|
1991
|
+
var TOKEN = /([#@][\p{L}\p{N}_.]+)/gu;
|
|
1992
|
+
var IS_TOKEN = /^[#@][\p{L}\p{N}_.]+$/u;
|
|
1993
|
+
function Caption({
|
|
1994
|
+
username,
|
|
1995
|
+
body
|
|
1996
|
+
}) {
|
|
1997
|
+
const parts = body.split(TOKEN);
|
|
1998
|
+
return /* @__PURE__ */ jsxs(
|
|
1999
|
+
ExpandableText,
|
|
2000
|
+
{
|
|
2001
|
+
lines: 2,
|
|
2002
|
+
toggleColor: varRef2(IG_VAR.muted),
|
|
2003
|
+
style: wrapStyle3,
|
|
2004
|
+
children: [
|
|
2005
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 600 }, children: [
|
|
2006
|
+
username,
|
|
2007
|
+
" "
|
|
2008
|
+
] }),
|
|
2009
|
+
parts.map(
|
|
2010
|
+
(part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsx("span", { style: { color: varRef2(IG_VAR.accent) }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
|
|
2011
|
+
)
|
|
2012
|
+
]
|
|
2013
|
+
}
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
var wrapStyle3 = {
|
|
2017
|
+
padding: "4px 12px 0",
|
|
2018
|
+
fontSize: 14,
|
|
2019
|
+
lineHeight: 1.4,
|
|
2020
|
+
color: varRef2(IG_VAR.text)
|
|
2021
|
+
};
|
|
2022
|
+
function FeedMedia({ media }) {
|
|
2023
|
+
if (media.length <= 1) {
|
|
2024
|
+
return /* @__PURE__ */ jsx("div", { style: frameStyle, children: media[0] ? /* @__PURE__ */ jsx(Tile2, { item: media[0] }) : null });
|
|
2025
|
+
}
|
|
2026
|
+
return /* @__PURE__ */ jsx(Carousel, { media });
|
|
2027
|
+
}
|
|
2028
|
+
function Tile2({ item }) {
|
|
2029
|
+
if (item.kind === "video") {
|
|
2030
|
+
return /* @__PURE__ */ jsx("video", { src: item.src, poster: item.posterSrc, controls: true, style: mediaStyle });
|
|
2031
|
+
}
|
|
2032
|
+
return /* @__PURE__ */ jsx("img", { src: item.src, alt: item.alt ?? "", style: mediaStyle });
|
|
2033
|
+
}
|
|
2034
|
+
function Carousel({ media }) {
|
|
2035
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({ loop: false, align: "start" });
|
|
2036
|
+
const [selected, setSelected] = useState(0);
|
|
2037
|
+
const sync = useCallback((api) => {
|
|
2038
|
+
setSelected(api.selectedScrollSnap());
|
|
2039
|
+
}, []);
|
|
2040
|
+
useEffect(() => {
|
|
2041
|
+
if (!emblaApi) {
|
|
2042
|
+
return;
|
|
2043
|
+
}
|
|
2044
|
+
sync(emblaApi);
|
|
2045
|
+
emblaApi.on("select", sync).on("reInit", sync);
|
|
2046
|
+
return () => {
|
|
2047
|
+
emblaApi.off("select", sync).off("reInit", sync);
|
|
2048
|
+
};
|
|
2049
|
+
}, [emblaApi, sync]);
|
|
2050
|
+
return /* @__PURE__ */ jsxs("div", { style: frameStyle, children: [
|
|
2051
|
+
/* @__PURE__ */ jsx("div", { ref: emblaRef, style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx("div", { style: { display: "flex", height: "100%" }, children: media.map((item, i) => /* @__PURE__ */ jsx("div", { style: slideStyle, children: /* @__PURE__ */ jsx(Tile2, { item }) }, `${item.src}-${i}`)) }) }),
|
|
2052
|
+
/* @__PURE__ */ jsxs("div", { style: pillStyle, children: [
|
|
2053
|
+
selected + 1,
|
|
2054
|
+
"/",
|
|
2055
|
+
media.length
|
|
2056
|
+
] }),
|
|
2057
|
+
/* @__PURE__ */ jsx("div", { style: dotsStyle, children: media.map((item, i) => /* @__PURE__ */ jsx(
|
|
2058
|
+
"span",
|
|
2059
|
+
{
|
|
2060
|
+
style: { ...dotStyle, opacity: i === selected ? 1 : 0.5 }
|
|
2061
|
+
},
|
|
2062
|
+
`dot-${item.src}-${i}`
|
|
2063
|
+
)) })
|
|
2064
|
+
] });
|
|
2065
|
+
}
|
|
2066
|
+
var frameStyle = {
|
|
2067
|
+
position: "relative",
|
|
2068
|
+
width: "100%",
|
|
2069
|
+
aspectRatio: "1 / 1",
|
|
2070
|
+
background: "#000",
|
|
2071
|
+
overflow: "hidden"
|
|
2072
|
+
};
|
|
2073
|
+
var mediaStyle = {
|
|
2074
|
+
position: "absolute",
|
|
2075
|
+
inset: 0,
|
|
2076
|
+
width: "100%",
|
|
2077
|
+
height: "100%",
|
|
2078
|
+
objectFit: "cover"
|
|
2079
|
+
};
|
|
2080
|
+
var slideStyle = {
|
|
2081
|
+
position: "relative",
|
|
2082
|
+
flex: "0 0 100%",
|
|
2083
|
+
minWidth: 0,
|
|
2084
|
+
height: "100%"
|
|
2085
|
+
};
|
|
2086
|
+
var pillStyle = {
|
|
2087
|
+
position: "absolute",
|
|
2088
|
+
top: 12,
|
|
2089
|
+
right: 12,
|
|
2090
|
+
background: "rgba(0,0,0,0.6)",
|
|
2091
|
+
color: "#fff",
|
|
2092
|
+
fontSize: 12,
|
|
2093
|
+
fontWeight: 600,
|
|
2094
|
+
padding: "2px 9px",
|
|
2095
|
+
borderRadius: 999
|
|
2096
|
+
};
|
|
2097
|
+
var dotsStyle = {
|
|
2098
|
+
position: "absolute",
|
|
2099
|
+
bottom: 10,
|
|
2100
|
+
left: "50%",
|
|
2101
|
+
transform: "translateX(-50%)",
|
|
2102
|
+
display: "flex",
|
|
2103
|
+
gap: 4
|
|
2104
|
+
};
|
|
2105
|
+
var dotStyle = {
|
|
2106
|
+
width: 6,
|
|
2107
|
+
height: 6,
|
|
2108
|
+
borderRadius: "50%",
|
|
2109
|
+
background: "#fff"
|
|
2110
|
+
};
|
|
2111
|
+
var PLACEHOLDER_AVATAR3 = "data:image/svg+xml;utf8," + encodeURIComponent(
|
|
2112
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="16" fill="#b3b3b3"/></svg>'
|
|
2113
|
+
);
|
|
2114
|
+
function Header2({
|
|
2115
|
+
author,
|
|
2116
|
+
collaborators
|
|
2117
|
+
}) {
|
|
2118
|
+
return /* @__PURE__ */ jsxs("div", { style: rowStyle2, children: [
|
|
2119
|
+
/* @__PURE__ */ jsx(
|
|
2120
|
+
"img",
|
|
2121
|
+
{
|
|
2122
|
+
src: author.avatar_url ?? PLACEHOLDER_AVATAR3,
|
|
2123
|
+
alt: "",
|
|
2124
|
+
width: 32,
|
|
2125
|
+
height: 32,
|
|
2126
|
+
style: avatarStyle
|
|
2127
|
+
}
|
|
2128
|
+
),
|
|
2129
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column" }, children: [
|
|
2130
|
+
/* @__PURE__ */ jsxs("span", { style: nameStyle, children: [
|
|
2131
|
+
author.username ?? "",
|
|
2132
|
+
author.verified ? /* @__PURE__ */ jsx(
|
|
2133
|
+
MdVerified,
|
|
2134
|
+
{
|
|
2135
|
+
size: 13,
|
|
2136
|
+
"aria-label": "Verified",
|
|
2137
|
+
role: "img",
|
|
2138
|
+
style: { color: "#3897f0", marginLeft: 3, flex: "0 0 auto" }
|
|
2139
|
+
}
|
|
2140
|
+
) : null
|
|
2141
|
+
] }),
|
|
2142
|
+
collaborators.length > 0 ? /* @__PURE__ */ jsxs("span", { style: collabStyle, children: [
|
|
2143
|
+
"with ",
|
|
2144
|
+
collaborators.map((c) => `@${c}`).join(", ")
|
|
2145
|
+
] }) : null
|
|
2146
|
+
] }),
|
|
2147
|
+
/* @__PURE__ */ jsx(
|
|
2148
|
+
FiMoreHorizontal,
|
|
2149
|
+
{
|
|
2150
|
+
size: 18,
|
|
2151
|
+
"aria-hidden": true,
|
|
2152
|
+
style: { marginLeft: "auto", color: varRef2(IG_VAR.text) }
|
|
2153
|
+
}
|
|
2154
|
+
)
|
|
2155
|
+
] });
|
|
2156
|
+
}
|
|
2157
|
+
var rowStyle2 = {
|
|
2158
|
+
display: "flex",
|
|
2159
|
+
alignItems: "center",
|
|
2160
|
+
gap: 10,
|
|
2161
|
+
padding: "10px 12px"
|
|
2162
|
+
};
|
|
2163
|
+
var avatarStyle = {
|
|
2164
|
+
width: 32,
|
|
2165
|
+
height: 32,
|
|
2166
|
+
borderRadius: "50%",
|
|
2167
|
+
objectFit: "cover",
|
|
2168
|
+
flex: "0 0 auto"
|
|
2169
|
+
};
|
|
2170
|
+
var nameStyle = {
|
|
2171
|
+
display: "flex",
|
|
2172
|
+
alignItems: "center",
|
|
2173
|
+
fontSize: 14,
|
|
1944
2174
|
fontWeight: 600,
|
|
1945
|
-
|
|
1946
|
-
|
|
2175
|
+
color: varRef2(IG_VAR.text),
|
|
2176
|
+
lineHeight: 1.2
|
|
2177
|
+
};
|
|
2178
|
+
var collabStyle = {
|
|
2179
|
+
fontSize: 12,
|
|
2180
|
+
color: varRef2(IG_VAR.muted),
|
|
2181
|
+
lineHeight: 1.2
|
|
2182
|
+
};
|
|
2183
|
+
function ReelPreview({
|
|
2184
|
+
author,
|
|
2185
|
+
body,
|
|
2186
|
+
media,
|
|
2187
|
+
audioName,
|
|
2188
|
+
className,
|
|
2189
|
+
style
|
|
2190
|
+
}) {
|
|
2191
|
+
const first = media[0];
|
|
2192
|
+
const username = author.username ?? "";
|
|
2193
|
+
return /* @__PURE__ */ jsxs("div", { className, style: { ...cardStyle3, ...style }, children: [
|
|
2194
|
+
first ? first.kind === "video" ? /* @__PURE__ */ jsx(
|
|
2195
|
+
"video",
|
|
2196
|
+
{
|
|
2197
|
+
src: first.src,
|
|
2198
|
+
poster: first.posterSrc,
|
|
2199
|
+
autoPlay: true,
|
|
2200
|
+
muted: true,
|
|
2201
|
+
loop: true,
|
|
2202
|
+
playsInline: true,
|
|
2203
|
+
style: coverStyle2
|
|
2204
|
+
}
|
|
2205
|
+
) : /* @__PURE__ */ jsx("img", { src: first.src, alt: first.alt ?? "", style: coverStyle2 }) : null,
|
|
2206
|
+
/* @__PURE__ */ jsx("div", { style: scrimStyle }),
|
|
2207
|
+
/* @__PURE__ */ jsxs("div", { style: infoStyle, children: [
|
|
2208
|
+
/* @__PURE__ */ jsxs("div", { style: authorRowStyle, children: [
|
|
2209
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: 14 }, children: username }),
|
|
2210
|
+
author.verified ? /* @__PURE__ */ jsx(MdVerified, { size: 13, "aria-label": "Verified", role: "img", style: { color: "#fff" } }) : null
|
|
2211
|
+
] }),
|
|
2212
|
+
body ? /* @__PURE__ */ jsx("div", { style: captionStyle, children: body }) : null,
|
|
2213
|
+
/* @__PURE__ */ jsxs("div", { style: audioStyle, children: [
|
|
2214
|
+
/* @__PURE__ */ jsx(MdMusicNote, { size: 14, "aria-hidden": true }),
|
|
2215
|
+
/* @__PURE__ */ jsx("span", { children: audioName ?? "Original audio" })
|
|
2216
|
+
] })
|
|
2217
|
+
] }),
|
|
2218
|
+
/* @__PURE__ */ jsxs("div", { style: railStyle, children: [
|
|
2219
|
+
/* @__PURE__ */ jsx(FiHeart, { size: 26, "aria-label": "Like", role: "img" }),
|
|
2220
|
+
/* @__PURE__ */ jsx(FiMessageCircle, { size: 26, "aria-label": "Comment", role: "img" }),
|
|
2221
|
+
/* @__PURE__ */ jsx(FiSend, { size: 26, "aria-label": "Share", role: "img" }),
|
|
2222
|
+
/* @__PURE__ */ jsx(FiBookmark, { size: 26, "aria-label": "Save", role: "img" }),
|
|
2223
|
+
/* @__PURE__ */ jsx(FiMoreHorizontal, { size: 22, "aria-hidden": true })
|
|
2224
|
+
] })
|
|
2225
|
+
] });
|
|
2226
|
+
}
|
|
2227
|
+
var cardStyle3 = {
|
|
2228
|
+
position: "relative",
|
|
2229
|
+
width: "100%",
|
|
2230
|
+
maxWidth: 320,
|
|
2231
|
+
aspectRatio: "9 / 16",
|
|
2232
|
+
borderRadius: 12,
|
|
2233
|
+
overflow: "hidden",
|
|
2234
|
+
background: "#000",
|
|
2235
|
+
color: "#fff",
|
|
2236
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
|
|
2237
|
+
};
|
|
2238
|
+
var coverStyle2 = {
|
|
2239
|
+
position: "absolute",
|
|
2240
|
+
inset: 0,
|
|
2241
|
+
width: "100%",
|
|
2242
|
+
height: "100%",
|
|
2243
|
+
objectFit: "cover"
|
|
2244
|
+
};
|
|
2245
|
+
var scrimStyle = {
|
|
2246
|
+
position: "absolute",
|
|
2247
|
+
inset: 0,
|
|
2248
|
+
background: "linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.55) 100%)",
|
|
2249
|
+
pointerEvents: "none"
|
|
2250
|
+
};
|
|
2251
|
+
var infoStyle = {
|
|
2252
|
+
position: "absolute",
|
|
2253
|
+
left: 12,
|
|
2254
|
+
right: 60,
|
|
2255
|
+
bottom: 14,
|
|
2256
|
+
display: "flex",
|
|
2257
|
+
flexDirection: "column",
|
|
2258
|
+
gap: 6,
|
|
2259
|
+
textShadow: "0 1px 3px rgba(0,0,0,0.5)"
|
|
2260
|
+
};
|
|
2261
|
+
var authorRowStyle = {
|
|
2262
|
+
display: "flex",
|
|
2263
|
+
alignItems: "center",
|
|
2264
|
+
gap: 5
|
|
2265
|
+
};
|
|
2266
|
+
var captionStyle = {
|
|
2267
|
+
fontSize: 13,
|
|
2268
|
+
lineHeight: 1.35,
|
|
2269
|
+
display: "-webkit-box",
|
|
2270
|
+
WebkitLineClamp: 2,
|
|
2271
|
+
WebkitBoxOrient: "vertical",
|
|
2272
|
+
overflow: "hidden"
|
|
2273
|
+
};
|
|
2274
|
+
var audioStyle = {
|
|
2275
|
+
display: "flex",
|
|
2276
|
+
alignItems: "center",
|
|
2277
|
+
gap: 6,
|
|
2278
|
+
fontSize: 12
|
|
2279
|
+
};
|
|
2280
|
+
var railStyle = {
|
|
2281
|
+
position: "absolute",
|
|
2282
|
+
right: 8,
|
|
2283
|
+
bottom: 16,
|
|
2284
|
+
display: "flex",
|
|
2285
|
+
flexDirection: "column",
|
|
2286
|
+
alignItems: "center",
|
|
2287
|
+
gap: 18,
|
|
2288
|
+
color: "#fff",
|
|
2289
|
+
filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.4))"
|
|
2290
|
+
};
|
|
2291
|
+
function InstagramPostPreviewImpl({
|
|
2292
|
+
variant,
|
|
2293
|
+
author,
|
|
2294
|
+
media,
|
|
2295
|
+
theme = "auto",
|
|
2296
|
+
className,
|
|
2297
|
+
style
|
|
2298
|
+
}) {
|
|
2299
|
+
const resolvedMedia = useResolvedMedia(
|
|
2300
|
+
media,
|
|
2301
|
+
variant.media,
|
|
2302
|
+
altSignatureOf(variant.media)
|
|
2303
|
+
);
|
|
2304
|
+
const settings = variant.settings;
|
|
2305
|
+
const isReel = variant.post_type === "reel" || settings?.media_type === "REELS";
|
|
2306
|
+
if (isReel) {
|
|
2307
|
+
return /* @__PURE__ */ jsx(
|
|
2308
|
+
ReelPreview,
|
|
2309
|
+
{
|
|
2310
|
+
author,
|
|
2311
|
+
body: variant.body ?? "",
|
|
2312
|
+
media: resolvedMedia,
|
|
2313
|
+
audioName: settings?.audio_name,
|
|
2314
|
+
className,
|
|
2315
|
+
style
|
|
2316
|
+
}
|
|
2317
|
+
);
|
|
2318
|
+
}
|
|
2319
|
+
const collaborators = settings?.collaborators ?? [];
|
|
2320
|
+
const cardStyle5 = {
|
|
2321
|
+
...paletteVars2(),
|
|
2322
|
+
colorScheme: colorSchemeFor2(theme),
|
|
2323
|
+
background: varRef2(IG_VAR.bg),
|
|
2324
|
+
color: varRef2(IG_VAR.text),
|
|
2325
|
+
border: `1px solid ${varRef2(IG_VAR.border)}`,
|
|
2326
|
+
borderRadius: 8,
|
|
2327
|
+
maxWidth: 470,
|
|
2328
|
+
overflow: "hidden",
|
|
2329
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
|
2330
|
+
...style
|
|
2331
|
+
};
|
|
2332
|
+
return /* @__PURE__ */ jsxs("div", { className, style: cardStyle5, children: [
|
|
2333
|
+
/* @__PURE__ */ jsx(Header2, { author, collaborators }),
|
|
2334
|
+
/* @__PURE__ */ jsx(FeedMedia, { media: resolvedMedia }),
|
|
2335
|
+
/* @__PURE__ */ jsx(Actions, {}),
|
|
2336
|
+
variant.body ? /* @__PURE__ */ jsx("div", { style: { paddingBottom: 12 }, children: /* @__PURE__ */ jsx(Caption, { username: author.username ?? "", body: variant.body }) }) : null
|
|
2337
|
+
] });
|
|
2338
|
+
}
|
|
2339
|
+
var InstagramPostPreview = memo(InstagramPostPreviewImpl);
|
|
2340
|
+
var LINK_COLOR = "#8ab4ff";
|
|
2341
|
+
var TOKEN2 = /([#@][\p{L}\p{N}_.]+)/gu;
|
|
2342
|
+
var IS_TOKEN2 = /^[#@][\p{L}\p{N}_.]+$/u;
|
|
2343
|
+
function Caption2({ body }) {
|
|
2344
|
+
const parts = body.split(TOKEN2);
|
|
2345
|
+
return /* @__PURE__ */ jsx(ExpandableText, { lines: 2, toggleColor: "rgba(255,255,255,0.82)", style: wrapStyle4, children: parts.map(
|
|
2346
|
+
(part, i) => IS_TOKEN2.test(part) ? /* @__PURE__ */ jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
|
|
2347
|
+
) });
|
|
2348
|
+
}
|
|
2349
|
+
var wrapStyle4 = {
|
|
2350
|
+
fontSize: 14,
|
|
2351
|
+
lineHeight: 1.35
|
|
1947
2352
|
};
|
|
1948
2353
|
function Media2({
|
|
1949
2354
|
media,
|
|
@@ -1963,7 +2368,7 @@ function Media2({
|
|
|
1963
2368
|
muted: true,
|
|
1964
2369
|
loop: true,
|
|
1965
2370
|
playsInline: true,
|
|
1966
|
-
style:
|
|
2371
|
+
style: coverStyle3
|
|
1967
2372
|
}
|
|
1968
2373
|
);
|
|
1969
2374
|
}
|
|
@@ -1990,11 +2395,11 @@ function PhotoCarousel({ media }) {
|
|
|
1990
2395
|
};
|
|
1991
2396
|
}, [emblaApi, sync]);
|
|
1992
2397
|
return /* @__PURE__ */ jsxs("div", { style: { position: "absolute", inset: 0 }, children: [
|
|
1993
|
-
/* @__PURE__ */ jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsx("div", { style:
|
|
1994
|
-
media.length > 1 ? /* @__PURE__ */ jsx("div", { style:
|
|
2398
|
+
/* @__PURE__ */ jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsx("div", { style: slideStyle2, children: /* @__PURE__ */ jsx("img", { src: m.src, alt: m.alt ?? "", style: coverStyle3 }) }, `${m.src}-${i}`)) }) }),
|
|
2399
|
+
media.length > 1 ? /* @__PURE__ */ jsx("div", { style: dotsStyle2, children: media.map((m, i) => /* @__PURE__ */ jsx(
|
|
1995
2400
|
"span",
|
|
1996
2401
|
{
|
|
1997
|
-
style: { ...
|
|
2402
|
+
style: { ...dotStyle2, opacity: i === selected ? 1 : 0.4 }
|
|
1998
2403
|
},
|
|
1999
2404
|
`dot-${m.src}-${i}`
|
|
2000
2405
|
)) }) : null
|
|
@@ -2009,7 +2414,7 @@ function ProcessingMedia() {
|
|
|
2009
2414
|
/* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children: "Processing media\u2026" })
|
|
2010
2415
|
] });
|
|
2011
2416
|
}
|
|
2012
|
-
var
|
|
2417
|
+
var coverStyle3 = {
|
|
2013
2418
|
position: "absolute",
|
|
2014
2419
|
inset: 0,
|
|
2015
2420
|
width: "100%",
|
|
@@ -2025,13 +2430,13 @@ var containerStyle = {
|
|
|
2025
2430
|
display: "flex",
|
|
2026
2431
|
height: "100%"
|
|
2027
2432
|
};
|
|
2028
|
-
var
|
|
2433
|
+
var slideStyle2 = {
|
|
2029
2434
|
position: "relative",
|
|
2030
2435
|
flex: "0 0 100%",
|
|
2031
2436
|
minWidth: 0,
|
|
2032
2437
|
height: "100%"
|
|
2033
2438
|
};
|
|
2034
|
-
var
|
|
2439
|
+
var dotsStyle2 = {
|
|
2035
2440
|
position: "absolute",
|
|
2036
2441
|
bottom: 124,
|
|
2037
2442
|
left: "50%",
|
|
@@ -2040,7 +2445,7 @@ var dotsStyle = {
|
|
|
2040
2445
|
gap: 5,
|
|
2041
2446
|
alignItems: "center"
|
|
2042
2447
|
};
|
|
2043
|
-
var
|
|
2448
|
+
var dotStyle2 = {
|
|
2044
2449
|
width: 6,
|
|
2045
2450
|
height: 6,
|
|
2046
2451
|
borderRadius: "50%",
|
|
@@ -2135,16 +2540,16 @@ function TikTokPostPreviewImpl({
|
|
|
2135
2540
|
const label = commercialLabel(variant.settings);
|
|
2136
2541
|
const isAigc = Boolean(variant.settings?.is_aigc);
|
|
2137
2542
|
const pending = (media?.length ?? 0) > 0 && resolvedMedia.length === 0;
|
|
2138
|
-
return /* @__PURE__ */ jsxs("div", { className, style: { ...
|
|
2543
|
+
return /* @__PURE__ */ jsxs("div", { className, style: { ...cardStyle4, ...style }, children: [
|
|
2139
2544
|
/* @__PURE__ */ jsx("style", { children: KEYFRAMES }),
|
|
2140
2545
|
/* @__PURE__ */ jsx(Media2, { media: resolvedMedia, pending }),
|
|
2141
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
2142
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
2546
|
+
/* @__PURE__ */ jsx("div", { style: scrimStyle2 }),
|
|
2547
|
+
/* @__PURE__ */ jsxs("div", { style: infoStyle2, children: [
|
|
2143
2548
|
/* @__PURE__ */ jsx("div", { style: usernameStyle, children: handle }),
|
|
2144
|
-
variant.body ? /* @__PURE__ */ jsx(
|
|
2549
|
+
variant.body ? /* @__PURE__ */ jsx(Caption2, { body: variant.body }) : null,
|
|
2145
2550
|
label || isAigc ? /* @__PURE__ */ jsxs("div", { style: labelsStyle, children: [
|
|
2146
|
-
label ? /* @__PURE__ */ jsx("span", { style:
|
|
2147
|
-
isAigc ? /* @__PURE__ */ jsx("span", { style:
|
|
2551
|
+
label ? /* @__PURE__ */ jsx("span", { style: pillStyle2, children: label }) : null,
|
|
2552
|
+
isAigc ? /* @__PURE__ */ jsx("span", { style: pillStyle2, children: "Creator labeled as AI-generated" }) : null
|
|
2148
2553
|
] }) : null,
|
|
2149
2554
|
/* @__PURE__ */ jsxs("div", { style: musicRowStyle, children: [
|
|
2150
2555
|
/* @__PURE__ */ jsx(IoMusicalNotes, { size: 13 }),
|
|
@@ -2154,7 +2559,7 @@ function TikTokPostPreviewImpl({
|
|
|
2154
2559
|
] })
|
|
2155
2560
|
] })
|
|
2156
2561
|
] }),
|
|
2157
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
2562
|
+
/* @__PURE__ */ jsxs("div", { style: railStyle2, children: [
|
|
2158
2563
|
/* @__PURE__ */ jsxs("div", { style: avatarWrapStyle, children: [
|
|
2159
2564
|
/* @__PURE__ */ jsx(Avatar, { url: creator.avatar_url, name: creator.nickname }),
|
|
2160
2565
|
/* @__PURE__ */ jsx("span", { style: followBadgeStyle, children: /* @__PURE__ */ jsx(PlusIcon, { size: 14 }) })
|
|
@@ -2175,14 +2580,14 @@ function RailAction({ icon, count }) {
|
|
|
2175
2580
|
}
|
|
2176
2581
|
function Avatar({ url, name }) {
|
|
2177
2582
|
if (url) {
|
|
2178
|
-
return /* @__PURE__ */ jsx("img", { src: url, alt: name, style:
|
|
2583
|
+
return /* @__PURE__ */ jsx("img", { src: url, alt: name, style: avatarStyle2 });
|
|
2179
2584
|
}
|
|
2180
|
-
return /* @__PURE__ */ jsx("div", { style: { ...
|
|
2585
|
+
return /* @__PURE__ */ jsx("div", { style: { ...avatarStyle2, ...avatarFallbackStyle }, children: name.slice(0, 1).toUpperCase() });
|
|
2181
2586
|
}
|
|
2182
2587
|
function Disc({ url }) {
|
|
2183
2588
|
return /* @__PURE__ */ jsx("div", { style: discStyle, children: url ? /* @__PURE__ */ jsx("img", { src: url, alt: "", style: discImgStyle }) : null });
|
|
2184
2589
|
}
|
|
2185
|
-
var
|
|
2590
|
+
var cardStyle4 = {
|
|
2186
2591
|
position: "relative",
|
|
2187
2592
|
width: "100%",
|
|
2188
2593
|
maxWidth: 320,
|
|
@@ -2193,13 +2598,13 @@ var cardStyle3 = {
|
|
|
2193
2598
|
color: "#fff",
|
|
2194
2599
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
|
|
2195
2600
|
};
|
|
2196
|
-
var
|
|
2601
|
+
var scrimStyle2 = {
|
|
2197
2602
|
position: "absolute",
|
|
2198
2603
|
inset: 0,
|
|
2199
2604
|
background: "linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%)",
|
|
2200
2605
|
pointerEvents: "none"
|
|
2201
2606
|
};
|
|
2202
|
-
var
|
|
2607
|
+
var infoStyle2 = {
|
|
2203
2608
|
position: "absolute",
|
|
2204
2609
|
left: 14,
|
|
2205
2610
|
right: 70,
|
|
@@ -2220,7 +2625,7 @@ var labelsStyle = {
|
|
|
2220
2625
|
gap: 4,
|
|
2221
2626
|
marginTop: 2
|
|
2222
2627
|
};
|
|
2223
|
-
var
|
|
2628
|
+
var pillStyle2 = {
|
|
2224
2629
|
display: "inline-flex",
|
|
2225
2630
|
alignItems: "center",
|
|
2226
2631
|
background: "rgba(255,255,255,0.18)",
|
|
@@ -2237,7 +2642,7 @@ var musicRowStyle = {
|
|
|
2237
2642
|
fontSize: 13,
|
|
2238
2643
|
marginTop: 4
|
|
2239
2644
|
};
|
|
2240
|
-
var
|
|
2645
|
+
var railStyle2 = {
|
|
2241
2646
|
position: "absolute",
|
|
2242
2647
|
right: 8,
|
|
2243
2648
|
bottom: 14,
|
|
@@ -2251,7 +2656,7 @@ var avatarWrapStyle = {
|
|
|
2251
2656
|
position: "relative",
|
|
2252
2657
|
marginBottom: 8
|
|
2253
2658
|
};
|
|
2254
|
-
var
|
|
2659
|
+
var avatarStyle2 = {
|
|
2255
2660
|
width: 46,
|
|
2256
2661
|
height: 46,
|
|
2257
2662
|
borderRadius: "50%",
|
|
@@ -2314,6 +2719,8 @@ var discImgStyle = {
|
|
|
2314
2719
|
};
|
|
2315
2720
|
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}}`;
|
|
2316
2721
|
var TikTokPostPreview = memo(TikTokPostPreviewImpl);
|
|
2722
|
+
|
|
2723
|
+
// src/preview/tiktok/theme.ts
|
|
2317
2724
|
var TT_VAR = {
|
|
2318
2725
|
text: "--pr-tt-text",
|
|
2319
2726
|
muted: "--pr-tt-muted",
|
|
@@ -2321,58 +2728,25 @@ var TT_VAR = {
|
|
|
2321
2728
|
accent: "--pr-tt-accent",
|
|
2322
2729
|
switchOff: "--pr-tt-switch-off"
|
|
2323
2730
|
};
|
|
2324
|
-
|
|
2325
|
-
text: "rgba(0,0,0,0.9)",
|
|
2326
|
-
muted: "rgba(0,0,0,0.55)",
|
|
2327
|
-
border: "rgba(0,0,0,0.12)",
|
|
2328
|
-
accent: "#fe2c55",
|
|
2329
|
-
switchOff: "rgba(0,0,0,0.18)"
|
|
2330
|
-
};
|
|
2331
|
-
var DARK2 = {
|
|
2332
|
-
text: "rgba(255,255,255,0.92)",
|
|
2333
|
-
muted: "#8a8a92",
|
|
2334
|
-
border: "rgba(255,255,255,0.14)",
|
|
2335
|
-
accent: "#fe2c55",
|
|
2336
|
-
switchOff: "rgba(255,255,255,0.22)"
|
|
2337
|
-
};
|
|
2338
|
-
function varRef2(name) {
|
|
2731
|
+
function varRef3(name) {
|
|
2339
2732
|
return `var(${name})`;
|
|
2340
2733
|
}
|
|
2341
|
-
function
|
|
2342
|
-
const p = dark ? DARK2 : LIGHT2;
|
|
2734
|
+
function paletteVars3() {
|
|
2343
2735
|
return {
|
|
2344
|
-
[TT_VAR.text]:
|
|
2345
|
-
[TT_VAR.muted]:
|
|
2346
|
-
[TT_VAR.border]:
|
|
2347
|
-
[TT_VAR.accent]:
|
|
2348
|
-
[TT_VAR.switchOff]:
|
|
2736
|
+
[TT_VAR.text]: "light-dark(rgba(0,0,0,0.9), rgba(255,255,255,0.92))",
|
|
2737
|
+
[TT_VAR.muted]: "light-dark(rgba(0,0,0,0.55), #8a8a92)",
|
|
2738
|
+
[TT_VAR.border]: "light-dark(rgba(0,0,0,0.12), rgba(255,255,255,0.14))",
|
|
2739
|
+
[TT_VAR.accent]: "#fe2c55",
|
|
2740
|
+
[TT_VAR.switchOff]: "light-dark(rgba(0,0,0,0.18), rgba(255,255,255,0.22))"
|
|
2349
2741
|
};
|
|
2350
2742
|
}
|
|
2351
|
-
function
|
|
2352
|
-
|
|
2353
|
-
useEffect(() => {
|
|
2354
|
-
if (typeof window === "undefined" || !window.matchMedia) {
|
|
2355
|
-
return;
|
|
2356
|
-
}
|
|
2357
|
-
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2358
|
-
setDark(mq.matches);
|
|
2359
|
-
const onChange = (event) => setDark(event.matches);
|
|
2360
|
-
mq.addEventListener("change", onChange);
|
|
2361
|
-
return () => mq.removeEventListener("change", onChange);
|
|
2362
|
-
}, []);
|
|
2363
|
-
return dark;
|
|
2743
|
+
function colorSchemeFor3(theme) {
|
|
2744
|
+
return theme === "auto" ? "light dark" : theme;
|
|
2364
2745
|
}
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
}
|
|
2370
|
-
return theme === "dark";
|
|
2371
|
-
}
|
|
2372
|
-
var MUTED2 = varRef2(TT_VAR.muted);
|
|
2373
|
-
var BORDER = varRef2(TT_VAR.border);
|
|
2374
|
-
var ACCENT = varRef2(TT_VAR.accent);
|
|
2375
|
-
var SWITCH_OFF = varRef2(TT_VAR.switchOff);
|
|
2746
|
+
var MUTED2 = varRef3(TT_VAR.muted);
|
|
2747
|
+
var BORDER = varRef3(TT_VAR.border);
|
|
2748
|
+
var ACCENT = varRef3(TT_VAR.accent);
|
|
2749
|
+
var SWITCH_OFF = varRef3(TT_VAR.switchOff);
|
|
2376
2750
|
var ON = "#34c759";
|
|
2377
2751
|
function Row({
|
|
2378
2752
|
label,
|
|
@@ -2380,7 +2754,7 @@ function Row({
|
|
|
2380
2754
|
control,
|
|
2381
2755
|
htmlFor
|
|
2382
2756
|
}) {
|
|
2383
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
2757
|
+
return /* @__PURE__ */ jsxs("div", { style: rowStyle3, children: [
|
|
2384
2758
|
/* @__PURE__ */ jsxs("label", { htmlFor, style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
2385
2759
|
/* @__PURE__ */ jsx("span", { style: { fontSize: 14 }, children: label }),
|
|
2386
2760
|
sublabel ? /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: MUTED2 }, children: sublabel }) : null
|
|
@@ -2452,7 +2826,7 @@ function CheckRow({
|
|
|
2452
2826
|
/* @__PURE__ */ jsx("span", { style: { fontSize: 14 }, children: label })
|
|
2453
2827
|
] });
|
|
2454
2828
|
}
|
|
2455
|
-
var
|
|
2829
|
+
var rowStyle3 = {
|
|
2456
2830
|
display: "flex",
|
|
2457
2831
|
alignItems: "center",
|
|
2458
2832
|
justifyContent: "space-between",
|
|
@@ -2557,7 +2931,7 @@ function TikTokCaptionField({
|
|
|
2557
2931
|
const max = captionMaxFor(postType);
|
|
2558
2932
|
const count = value.length;
|
|
2559
2933
|
const over = count > max;
|
|
2560
|
-
return /* @__PURE__ */ jsxs("div", { className, style: { ...
|
|
2934
|
+
return /* @__PURE__ */ jsxs("div", { className, style: { ...wrapStyle5, ...style }, children: [
|
|
2561
2935
|
/* @__PURE__ */ jsxs("div", { style: labelRowStyle, children: [
|
|
2562
2936
|
/* @__PURE__ */ jsx("label", { htmlFor: id, style: labelStyle, children: "Caption" }),
|
|
2563
2937
|
/* @__PURE__ */ jsxs(
|
|
@@ -2565,7 +2939,7 @@ function TikTokCaptionField({
|
|
|
2565
2939
|
{
|
|
2566
2940
|
style: {
|
|
2567
2941
|
...countStyle,
|
|
2568
|
-
color: over ?
|
|
2942
|
+
color: over ? varRef3(TT_VAR.accent) : varRef3(TT_VAR.muted)
|
|
2569
2943
|
},
|
|
2570
2944
|
children: [
|
|
2571
2945
|
count.toLocaleString(),
|
|
@@ -2585,13 +2959,13 @@ function TikTokCaptionField({
|
|
|
2585
2959
|
rows: 4,
|
|
2586
2960
|
style: {
|
|
2587
2961
|
...textareaStyle,
|
|
2588
|
-
borderColor: over ?
|
|
2962
|
+
borderColor: over ? varRef3(TT_VAR.accent) : varRef3(TT_VAR.border)
|
|
2589
2963
|
}
|
|
2590
2964
|
}
|
|
2591
2965
|
)
|
|
2592
2966
|
] });
|
|
2593
2967
|
}
|
|
2594
|
-
var
|
|
2968
|
+
var wrapStyle5 = {
|
|
2595
2969
|
display: "flex",
|
|
2596
2970
|
flexDirection: "column",
|
|
2597
2971
|
gap: 6,
|
|
@@ -2747,7 +3121,6 @@ function TikTokPublishPanel({
|
|
|
2747
3121
|
className,
|
|
2748
3122
|
style
|
|
2749
3123
|
}) {
|
|
2750
|
-
const dark = useIsDark2(theme);
|
|
2751
3124
|
const isVideo = variant.post_type === "video";
|
|
2752
3125
|
const captionOver = caption.length > captionMaxFor(variant.post_type);
|
|
2753
3126
|
const mediaOk = mediaCountValid(variant.post_type, variant.media?.length ?? 0);
|
|
@@ -2757,9 +3130,10 @@ function TikTokPublishPanel({
|
|
|
2757
3130
|
{
|
|
2758
3131
|
className,
|
|
2759
3132
|
style: {
|
|
2760
|
-
...
|
|
3133
|
+
...paletteVars3(),
|
|
3134
|
+
colorScheme: colorSchemeFor3(theme),
|
|
2761
3135
|
...panelStyle,
|
|
2762
|
-
color:
|
|
3136
|
+
color: varRef3(TT_VAR.text),
|
|
2763
3137
|
...style
|
|
2764
3138
|
},
|
|
2765
3139
|
children: [
|
|
@@ -2850,6 +3224,6 @@ var postButtonStyle = {
|
|
|
2850
3224
|
transition: "opacity 160ms ease"
|
|
2851
3225
|
};
|
|
2852
3226
|
|
|
2853
|
-
export { ArticleCard, AudienceSelect, CommercialDisclosure, Connect, Declaration, DocumentCard, InteractionToggles, LinkedInPostPreview, Poll, PostrunProvider, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel, UploadError, XPoll, XPostPreview, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useTikTokCreatorInfo, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
|
|
3227
|
+
export { ArticleCard, AudienceSelect, CommercialDisclosure, Connect, Declaration, DocumentCard, InstagramPostPreview, InteractionToggles, LinkedInPostPreview, Poll, PostrunProvider, ReelPreview, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel, UploadError, XPoll, XPostPreview, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, toPreviewMedia, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useTikTokCreatorInfo, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
|
|
2854
3228
|
//# sourceMappingURL=index.js.map
|
|
2855
3229
|
//# sourceMappingURL=index.js.map
|