@canvas-digital/blog-sdk 2.0.4 → 2.0.5
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/components/admin/AdminPostDetail.js +5 -5
- package/dist/components/admin/BrandSettings.js +5 -5
- package/dist/components/admin/BrandSwitcher.js +1 -1
- package/dist/components/admin/Chips.js +5 -5
- package/dist/components/admin/CommentsManager.js +6 -6
- package/dist/components/admin/Dashboard.js +1 -1
- package/dist/components/admin/MediaLibrary.js +5 -5
- package/dist/components/admin/MediaPicker.js +4 -4
- package/dist/components/admin/PostList.js +3 -3
- package/dist/components/admin/PostsTable.d.ts.map +1 -1
- package/dist/components/admin/PostsTable.js +10 -10
- package/dist/components/admin/Shell.js +3 -3
- package/dist/components/admin/TermManager.js +4 -4
- package/dist/components/admin/UsersManager.js +3 -3
- package/dist/components/admin/charts.js +7 -7
- package/dist/components/admin/editor/PostEditor.js +16 -16
- package/dist/components/admin/editor/RichTextEditor.js +8 -8
- package/dist/components/admin/editor/YoastCollapsible.js +2 -2
- package/dist/components/admin/editor/YoastInsightsPanel.js +1 -1
- package/dist/components/admin/editor/YoastInternalLinksPanel.js +1 -1
- package/dist/components/admin/editor/YoastSeoAnalysisPanel.js +6 -6
- package/dist/components/admin/editor/YoastSeoMetabox.js +8 -8
- package/dist/components/admin/editor/YoastSnippetField.js +2 -2
- package/dist/components/admin/internal/States.js +3 -3
- package/dist/components/admin/seo/Ga4Settings.js +6 -6
- package/dist/components/admin/seo/RedirectAnalyticsDashboard.js +1 -1
- package/dist/components/admin/seo/RedirectDetail.js +6 -6
- package/dist/components/admin/seo/RedirectForm.js +1 -1
- package/dist/components/admin/seo/RedirectList.js +4 -4
- package/dist/components/admin/seo/RobotsEditor.js +1 -1
- package/dist/components/admin/seo/shared.js +2 -2
- package/dist/components/admin/tools/ToolsHub.js +4 -4
- package/dist/components/user/BlogCard.js +3 -3
- package/dist/components/user/BlogCategories.js +1 -1
- package/dist/components/user/BlogDetail.js +1 -1
- package/dist/components/user/BlogList.js +1 -1
- package/dist/components/user/BlogSearch.js +2 -2
- package/dist/components/user/BlogTags.js +1 -1
- package/dist/components/user/FeaturedBlogs.js +1 -1
- package/dist/components/user/RelatedBlogs.js +1 -1
- package/dist/components/user/SiteMediaHero.js +1 -1
- package/dist/components/user/detail/ArticleDetailHero.js +5 -5
- package/dist/components/user/detail/ArticleRailDetails.js +2 -2
- package/dist/components/user/detail/CommentSection.js +2 -2
- package/dist/components/user/detail/HeroFadeSlide.js +1 -1
- package/dist/components/user/detail/ReadingProgress.js +1 -1
- package/dist/components/user/detail/ShareRow.js +1 -1
- package/dist/components/user/internal/States.js +4 -4
- package/dist/lib/lexical-doc.js +1 -1
- package/dist/pages/admin/BlogAdmin.js +7 -7
- package/dist/style.css +1018 -1018
- package/package.json +2 -1
|
@@ -7,5 +7,5 @@ import { EmptyState, ErrorState, LoadingState, Scope } from "./internal/States";
|
|
|
7
7
|
export function BlogTags({ config, theme, branding, className, onSelect, }) {
|
|
8
8
|
const client = useMemo(() => new BlogClient(config), [config.apiUrl, config.publicApiKey, config.email, config.domain, config.timeoutMs]);
|
|
9
9
|
const state = useAsync(() => client.getTags(), [client], (data) => data.length === 0);
|
|
10
|
-
return (_jsxs(Scope, { className: cx("
|
|
10
|
+
return (_jsxs(Scope, { className: cx("blog_bp-blog-tags", branding?.className, className), style: themeVars(theme, branding), css: branding?.css, children: [state.status === "loading" ? _jsx(LoadingState, { label: "Loading tags..." }) : null, state.status === "error" ? (_jsx(ErrorState, { message: state.error, authError: state.authError })) : null, state.status === "empty" ? _jsx(EmptyState, { label: "No tags yet." }) : null, state.status === "success" ? (_jsx("div", { className: "blog_bp-blog-tags__list", style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: state.data.map((tag) => (_jsx("button", { type: "button", onClick: () => onSelect?.(tag), children: tag.name }, tag.id))) })) : null] }));
|
|
11
11
|
}
|
|
@@ -8,5 +8,5 @@ import { EmptyState, ErrorState, LoadingState, Scope } from "./internal/States";
|
|
|
8
8
|
export function FeaturedBlogs({ config, theme, branding, className, limit = 3, onSelect, getHref, }) {
|
|
9
9
|
const client = useMemo(() => new BlogClient(config), [config.apiUrl, config.publicApiKey, config.email, config.domain, config.timeoutMs]);
|
|
10
10
|
const state = useAsync(() => client.getFeaturedBlogs(limit), [client, limit], (data) => data.length === 0);
|
|
11
|
-
return (_jsxs(Scope, { className: cx("
|
|
11
|
+
return (_jsxs(Scope, { className: cx("blog_bp-site-index", "blog_bp-featured-blogs", branding?.className, className), style: themeVars(theme, branding), css: branding?.css, children: [state.status === "loading" ? _jsx(LoadingState, {}) : null, state.status === "error" ? (_jsx(ErrorState, { message: state.error, authError: state.authError })) : null, state.status === "empty" ? _jsx(EmptyState, {}) : null, state.status === "success" ? (_jsx(BlogGrid, { blogs: state.data, theme: theme, onSelect: onSelect, getHref: getHref })) : null] }));
|
|
12
12
|
}
|
|
@@ -8,5 +8,5 @@ import { EmptyState, ErrorState, LoadingState, Scope } from "./internal/States";
|
|
|
8
8
|
export function RelatedBlogs({ config, blog, theme, branding, className, limit = 3, onSelect, getHref, }) {
|
|
9
9
|
const client = useMemo(() => new BlogClient(config), [config.apiUrl, config.publicApiKey, config.email, config.domain, config.timeoutMs]);
|
|
10
10
|
const state = useAsync(() => client.getRelatedBlogs(blog, limit), [client, blog.id, blog.category_id, limit], (data) => data.length === 0);
|
|
11
|
-
return (_jsxs(Scope, { className: cx("
|
|
11
|
+
return (_jsxs(Scope, { className: cx("blog_bp-site-index", "blog_bp-related-blogs", branding?.className, className), style: themeVars(theme, branding), css: branding?.css, children: [state.status === "loading" ? _jsx(LoadingState, {}) : null, state.status === "error" ? (_jsx(ErrorState, { message: state.error, authError: state.authError })) : null, state.status === "empty" ? _jsx(EmptyState, { label: "No related posts." }) : null, state.status === "success" ? (_jsx(BlogGrid, { blogs: state.data, theme: theme, onSelect: onSelect, getHref: getHref })) : null] }));
|
|
12
12
|
}
|
|
@@ -39,5 +39,5 @@ export function SiteMediaHero({ slides: rawSlides, siteName, onSelect }) {
|
|
|
39
39
|
const published = blog.published_at || blog.created_at;
|
|
40
40
|
const readingMinutes = estimateReadingMinutes([blog.excerpt, blog.content].filter(Boolean).join(" "));
|
|
41
41
|
const multi = slides.length > 1;
|
|
42
|
-
return (_jsxs("section", { className: "
|
|
42
|
+
return (_jsxs("section", { className: "blog_site-hero-media", "aria-labelledby": "site-hero-media-title", "aria-roledescription": multi ? "carousel" : undefined, children: [_jsxs("div", { className: "blog_site-hero-media-bg", children: [slides.map(({ blog: slideBlog }, i) => (_jsx("div", { className: `blog_site-hero-media-slide${i === safeIndex ? " blog_is-active" : ""}`, "aria-hidden": i !== safeIndex, children: _jsx("img", { className: "blog_site-hero-media-visual", src: slideBlog.featured_image, alt: "" }) }, slideBlog.id))), _jsx("div", { className: "blog_site-hero-media-scrim", "aria-hidden": "true" }), _jsx("div", { className: "blog_site-hero-media-grain", "aria-hidden": "true" })] }), _jsxs("div", { className: "blog_site-hero-media-content", children: [_jsxs("div", { className: "blog_site-hero-media-copy", children: [_jsx(HeroFadeSlide, { from: "left", delayMs: 100, children: _jsx("p", { className: "blog_site-hero-media-eyebrow", children: eyebrow }) }), _jsx(HeroFadeSlide, { from: "left", delayMs: 260, children: _jsx("h1", { id: "site-hero-media-title", className: "blog_site-hero-media-title", children: blog.title }) }), excerpt ? (_jsx(HeroFadeSlide, { from: "right", delayMs: 420, children: _jsx("p", { className: "blog_site-hero-media-desc", children: excerpt }) })) : null, _jsx(HeroFadeSlide, { from: "left", delayMs: excerpt ? 580 : 420, className: "blog_site-hero-media-meta-wrap", children: _jsxs("div", { className: "blog_site-hero-media-meta", children: [published ? _jsx("time", { dateTime: published, children: formatDate(published) }) : null, readingMinutes ? (_jsxs("span", { className: "blog_site-hero-media-reading", children: [readingMinutes, " min read"] })) : null] }) }), _jsx(HeroFadeSlide, { from: "left", delayMs: excerpt ? 700 : 540, children: href ? (_jsxs("a", { href: href, className: "blog_site-hero-media-cta", children: [_jsx("span", { className: "blog_site-hero-media-cta-label", children: "Read story" }), _jsx("span", { className: "blog_site-hero-media-cta-arrow", "aria-hidden": "true", children: "\u2192" })] })) : (_jsxs("button", { type: "button", className: "blog_site-hero-media-cta", onClick: () => onSelect?.(blog), children: [_jsx("span", { className: "blog_site-hero-media-cta-label", children: "Read story" }), _jsx("span", { className: "blog_site-hero-media-cta-arrow", "aria-hidden": "true", children: "\u2192" })] })) })] }, blog.id), multi ? (_jsx("div", { className: "blog_site-hero-media-dots", role: "tablist", "aria-label": "Featured posts", children: slides.map(({ blog: slideBlog }, i) => (_jsx("button", { type: "button", role: "tab", className: `blog_site-hero-media-dot${i === safeIndex ? " blog_is-active" : ""}`, "aria-selected": i === safeIndex, "aria-label": `Show ${slideBlog.title}`, onClick: () => setIndex(i) }, slideBlog.id))) })) : null] }), _jsx("div", { className: "blog_site-hero-media-edge", "aria-hidden": "true" })] }));
|
|
43
43
|
}
|
|
@@ -4,11 +4,11 @@ import { BackButton } from "./BackButton";
|
|
|
4
4
|
import { articleFormatDate } from "./toc";
|
|
5
5
|
export function ArticleDetailHero({ homeHref, homeLabel, category, categoryHref, title, excerpt, publishedAt, readingMinutes, authors, mediaUrl, mediaAlt, mediaCaption, formatHero, onBack, onHome, onCategory, }) {
|
|
6
6
|
const isBlogDetails = !mediaUrl && !formatHero;
|
|
7
|
-
const homeEl = onHome ? (_jsx("button", { type: "button", className: "
|
|
7
|
+
const homeEl = onHome ? (_jsx("button", { type: "button", className: "blog_bp-linkish", onClick: onHome, style: { color: "inherit", background: "none", border: 0, padding: 0, cursor: "pointer", font: "inherit" }, children: homeLabel })) : (_jsx("a", { href: homeHref, style: { color: "inherit", textDecoration: "none" }, children: homeLabel }));
|
|
8
8
|
const catEl = category ? (categoryHref || onCategory ? (onCategory ? (_jsx("button", { type: "button", onClick: () => onCategory(category.slug), style: { color: "inherit", background: "none", border: 0, padding: 0, cursor: "pointer", font: "inherit", textDecoration: "none" }, children: category.name })) : (_jsx("a", { href: categoryHref, style: { color: "inherit", textDecoration: "none" }, children: category.name }))) : (_jsx("span", { children: category.name }))) : null;
|
|
9
|
-
return (_jsxs("section", { className: `
|
|
9
|
+
return (_jsxs("section", { className: `blog_article-detail-hero${isBlogDetails ? " blog_blog-details-hero" : ""}`, "aria-labelledby": "article-hero-title", style: isBlogDetails
|
|
10
10
|
? { backgroundColor: "#0B4A75", color: "#fff", paddingTop: 40, paddingBottom: 60 }
|
|
11
|
-
: undefined, children: [mediaUrl ? (_jsxs("figure", { className: "
|
|
11
|
+
: undefined, children: [mediaUrl ? (_jsxs("figure", { className: "blog_article-hero-media", children: [_jsx("img", { className: "blog_article-hero-visual", src: mediaUrl, alt: mediaAlt || title }), mediaCaption ? _jsx("figcaption", { className: "blog_article-hero-caption", children: mediaCaption }) : null] })) : formatHero ? (_jsx("div", { className: "blog_article-hero-media blog_article-hero-format", children: formatHero })) : null, _jsx("header", { className: "blog_article-hero-copy", children: _jsxs("div", { className: "blog_article-hero-copy-inner", style: { maxWidth: 1200, margin: "0 auto", width: "100%" }, children: [_jsx(HeroFadeSlide, { from: "left", delayMs: 80, children: _jsxs("ul", { className: "blog_breadcrumb", style: {
|
|
12
12
|
display: "flex",
|
|
13
13
|
alignItems: "center",
|
|
14
14
|
flexWrap: "wrap",
|
|
@@ -18,12 +18,12 @@ export function ArticleDetailHero({ homeHref, homeLabel, category, categoryHref,
|
|
|
18
18
|
margin: "0 0 40px 0",
|
|
19
19
|
color: isBlogDetails ? "#fff" : "inherit",
|
|
20
20
|
fontSize: "0.9rem",
|
|
21
|
-
}, children: [_jsx("li", { children: homeEl }), category ? (_jsxs(_Fragment, { children: [_jsx("li", { "aria-hidden": "true", style: { opacity: 0.6, fontSize: "0.8em" }, children: "\u2794" }), _jsx("li", { children: catEl })] })) : null, _jsx("li", { "aria-hidden": "true", style: { opacity: 0.6, fontSize: "0.8em" }, children: "\u2794" }), _jsx("li", { style: { opacity: 0.9 }, children: title })] }) }), category && !isBlogDetails ? (_jsx(HeroFadeSlide, { from: "left", delayMs: 180, children: _jsx("p", { className: "
|
|
21
|
+
}, children: [_jsx("li", { children: homeEl }), category ? (_jsxs(_Fragment, { children: [_jsx("li", { "aria-hidden": "true", style: { opacity: 0.6, fontSize: "0.8em" }, children: "\u2794" }), _jsx("li", { children: catEl })] })) : null, _jsx("li", { "aria-hidden": "true", style: { opacity: 0.6, fontSize: "0.8em" }, children: "\u2794" }), _jsx("li", { style: { opacity: 0.9 }, children: title })] }) }), category && !isBlogDetails ? (_jsx(HeroFadeSlide, { from: "left", delayMs: 180, children: _jsx("p", { className: "blog_eyebrow", children: category.name }) })) : null, _jsx(HeroFadeSlide, { from: "left", delayMs: category ? 300 : 220, children: _jsxs("div", { style: {
|
|
22
22
|
display: "flex",
|
|
23
23
|
alignItems: "center",
|
|
24
24
|
justifyContent: isBlogDetails ? "center" : "flex-start",
|
|
25
25
|
gap: 16,
|
|
26
26
|
marginBottom: 24,
|
|
27
27
|
textAlign: isBlogDetails ? "center" : "left",
|
|
28
|
-
}, children: [!isBlogDetails ? _jsx(BackButton, { onBack: onBack }) : null, _jsx("h1", { id: "article-hero-title", className: "
|
|
28
|
+
}, children: [!isBlogDetails ? _jsx(BackButton, { onBack: onBack }) : null, _jsx("h1", { id: "article-hero-title", className: "blog_article-hero-title", style: { margin: 0, color: isBlogDetails ? "#fff" : "inherit" }, children: title })] }) }), excerpt ? (_jsx(HeroFadeSlide, { from: "right", delayMs: category ? 460 : 380, children: _jsx("p", { className: "blog_standfirst blog_article-hero-standfirst", children: excerpt }) })) : null, _jsx(HeroFadeSlide, { from: "left", delayMs: excerpt ? 620 : 500, children: _jsxs("div", { className: "blog_byline-row", children: [authors.length ? (_jsx("div", { className: "blog_byline-faces", children: authors.map((a) => a.avatarUrl ? (_jsx("img", { src: a.avatarUrl, alt: "", width: 34, height: 34 }, a.id)) : (_jsx("span", { className: "blog_face-fallback", "aria-hidden": "true", children: a.name.slice(0, 1) }, a.id))) })) : null, _jsxs("div", { className: "blog_byline-text", children: [authors.length ? (_jsx("span", { className: "blog_by", children: authors.map((a) => a.name).join(" and ") })) : null, _jsxs("span", { className: "blog_meta", children: [publishedAt ? (_jsx("time", { dateTime: publishedAt, children: articleFormatDate(publishedAt) })) : null, readingMinutes ? _jsxs("span", { children: [readingMinutes, " min read"] }) : null] })] })] }) })] }) })] }));
|
|
29
29
|
}
|
|
@@ -3,10 +3,10 @@ import { relativeTime } from "./toc";
|
|
|
3
3
|
export function ArticleRailDetails({ owners, related, hrefFor, onSelect, className }) {
|
|
4
4
|
if (!owners.length && !related.length)
|
|
5
5
|
return null;
|
|
6
|
-
return (_jsxs("div", { className: `
|
|
6
|
+
return (_jsxs("div", { className: `blog_article-rail-details${className ? ` ${className}` : ""}`, children: [owners.length ? (_jsxs("section", { className: "blog_rail-owner-panel", "aria-label": "Post owner", children: [_jsx("div", { className: "blog_rail-related-head", children: _jsx("h3", { children: owners.length > 1 ? "Authors" : "Owner" }) }), _jsx("ul", { className: "blog_rail-owner-list", children: owners.map((owner) => (_jsxs("li", { className: "blog_rail-owner", children: [owner.avatarUrl ? (_jsx("img", { src: owner.avatarUrl, alt: "", width: 40, height: 40 })) : (_jsx("span", { className: "blog_rail-owner-fallback", "aria-hidden": "true", children: owner.name
|
|
7
7
|
.split(/\s+/)
|
|
8
8
|
.filter(Boolean)
|
|
9
9
|
.slice(0, 2)
|
|
10
10
|
.map((p) => p[0]?.toUpperCase() ?? "")
|
|
11
|
-
.join("") || "?" })), _jsxs("div", { className: "
|
|
11
|
+
.join("") || "?" })), _jsxs("div", { className: "blog_rail-owner-body", children: [_jsx("p", { className: "blog_rail-owner-name", children: owner.name }), owner.jobTitle ? _jsx("p", { className: "blog_rail-owner-role", children: owner.jobTitle }) : null, owner.bio ? _jsx("p", { className: "blog_rail-owner-bio", children: owner.bio }) : null] })] }, owner.id))) })] })) : null, related.length ? (_jsxs("section", { className: "blog_rail-related-panel", "aria-label": "Related posts", children: [_jsx("div", { className: "blog_rail-related-head", children: _jsx("h3", { children: "Related posts" }) }), _jsx("div", { className: "blog_rail-related-rows", children: related.map((item) => (_jsx("div", { className: "blog_rail-related-row", children: _jsxs("div", { className: "blog_rail-related-row-main", children: [onSelect ? (_jsx("button", { type: "button", className: "blog_rail-related-t", onClick: () => onSelect(item.slug), children: item.title })) : (_jsx("a", { className: "blog_rail-related-t", href: hrefFor(item.slug), children: item.title })), _jsxs("div", { className: "blog_rail-related-sub", children: [_jsx("span", { children: relativeTime(item.publishedAt) }), item.readingMinutes ? _jsxs("span", { children: [item.readingMinutes, " min"] }) : null, onSelect ? (_jsx("button", { type: "button", className: "blog_bp-linkish", onClick: () => onSelect(item.slug), children: "View \u2197" })) : (_jsx("a", { href: hrefFor(item.slug), children: "View \u2197" }))] })] }) }, item.id))) })] })) : null] }));
|
|
12
12
|
}
|
|
@@ -22,7 +22,7 @@ export function CommentSection({ postId, allowComments, initialComments = [], on
|
|
|
22
22
|
setComments(initialComments);
|
|
23
23
|
}, [initialComments]);
|
|
24
24
|
if (!allowComments) {
|
|
25
|
-
return (_jsxs("section", { className: "
|
|
25
|
+
return (_jsxs("section", { className: "blog_comments", id: "comments", "aria-labelledby": "comments-heading", children: [_jsx("h2", { id: "comments-heading", children: "Comments" }), _jsx("p", { className: "blog_comments-closed", children: "Comments are closed for this post." })] }));
|
|
26
26
|
}
|
|
27
27
|
const submit = () => {
|
|
28
28
|
setError(null);
|
|
@@ -64,5 +64,5 @@ export function CommentSection({ postId, allowComments, initialComments = [], on
|
|
|
64
64
|
}
|
|
65
65
|
})();
|
|
66
66
|
};
|
|
67
|
-
return (_jsxs("section", { className: "
|
|
67
|
+
return (_jsxs("section", { className: "blog_comments", id: "comments", "aria-labelledby": "comments-heading", children: [_jsxs("h2", { id: "comments-heading", children: ["Comments", comments.length ? _jsxs("span", { className: "blog_comments-count", children: [" (", comments.length, ")"] }) : null] }), comments.length === 0 ? (_jsx("p", { className: "blog_comments-empty", children: "No comments yet. Be the first to share your thoughts." })) : (_jsx("ul", { className: "blog_comments-list", children: comments.map((c) => (_jsx("li", { className: "blog_comment-item", children: _jsxs("div", { className: "blog_comment-profile", children: [_jsx("span", { className: "blog_comment-avatar", "aria-hidden": "true", children: initialsFor(c.authorName) }), _jsxs("div", { className: "blog_comment-profile-body", children: [_jsxs("div", { className: "blog_comment-meta", children: [_jsx("strong", { className: "blog_comment-author", children: c.authorName }), _jsx("time", { dateTime: c.createdAt, children: articleFormatDate(c.createdAt) })] }), _jsx("p", { className: "blog_comment-body", children: c.body })] })] }) }, c.id))) })), _jsxs("div", { className: "blog_comment-form", children: [_jsx("h3", { className: "blog_comment-form-title", children: "Leave a comment" }), error ? (_jsx("p", { className: "blog_comment-error", role: "alert", children: error })) : null, flash ? (_jsx("p", { className: "blog_comment-ok", role: "status", children: flash })) : null, _jsxs("label", { className: "blog_comment-hp", "aria-hidden": "true", children: ["Website", _jsx("input", { tabIndex: -1, autoComplete: "off", value: website, onChange: (e) => setWebsite(e.target.value) })] }), _jsxs("div", { className: "blog_comment-form-grid", children: [_jsxs("label", { children: [_jsx("span", { children: "Name" }), _jsx("input", { value: name, onChange: (e) => setName(e.target.value), maxLength: 80, required: true, autoComplete: "name" })] }), _jsxs("label", { children: [_jsxs("span", { children: ["Email ", _jsx("em", { children: "(optional, never shown)" })] }), _jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoComplete: "email" })] })] }), _jsxs("label", { className: "blog_comment-body-field", children: [_jsx("span", { children: "Comment" }), _jsx("textarea", { rows: 5, value: body, onChange: (e) => setBody(e.target.value), maxLength: 4000, required: true })] }), _jsx("button", { type: "button", className: "blog_comment-submit", disabled: pending, onClick: submit, children: pending ? "Posting…" : "Post comment" }), _jsx("p", { className: "blog_comment-moderation-note", children: "Comments are reviewed before they appear on this post." })] })] }));
|
|
68
68
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/** BlogUploader looping fade/slide wrapper used on list media hero + article detail. */
|
|
3
3
|
export function HeroFadeSlide({ children, delayMs = 0, from = "left", className }) {
|
|
4
|
-
return (_jsx("div", { className: `
|
|
4
|
+
return (_jsx("div", { className: `blog_hero-fade-slide blog_hero-fade-slide-${from}${className ? ` ${className}` : ""}`.trim(), style: { ["--slide-delay"]: `${delayMs}ms` }, children: children }));
|
|
5
5
|
}
|
|
@@ -16,5 +16,5 @@ export function ReadingProgress() {
|
|
|
16
16
|
window.removeEventListener("resize", update);
|
|
17
17
|
};
|
|
18
18
|
}, []);
|
|
19
|
-
return (_jsx("div", { className: "
|
|
19
|
+
return (_jsx("div", { className: "blog_progress", "aria-hidden": "true", children: _jsx("span", { style: { width: `${pct}%` } }) }));
|
|
20
20
|
}
|
|
@@ -3,5 +3,5 @@ export function ShareRow({ title, slug, origin, path, }) {
|
|
|
3
3
|
const url = `${origin}${path ?? `/blogs/${slug}`}`;
|
|
4
4
|
const encoded = encodeURIComponent(url);
|
|
5
5
|
const text = encodeURIComponent(title);
|
|
6
|
-
return (_jsxs("div", { className: "
|
|
6
|
+
return (_jsxs("div", { className: "blog_share", children: [_jsx("span", { className: "blog_share-label", children: "Share" }), _jsx("a", { href: `https://www.linkedin.com/sharing/share-offsite/?url=${encoded}`, target: "_blank", rel: "noreferrer noopener", children: "LinkedIn" }), _jsx("a", { href: `https://x.com/intent/tweet?url=${encoded}&text=${text}`, target: "_blank", rel: "noreferrer noopener", children: "X" }), _jsx("a", { href: `https://api.whatsapp.com/send?text=${text}%20${encoded}`, target: "_blank", rel: "noreferrer noopener", children: "WhatsApp" }), _jsx("a", { href: `mailto:?subject=${text}&body=${encoded}`, children: "Email" }), _jsxs("details", { className: "blog_share-copy", children: [_jsx("summary", { children: "Copy link" }), _jsx("input", { readOnly: true, value: url, "aria-label": "Article URL" })] })] }));
|
|
7
7
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from "../../../styles/userTheme";
|
|
3
3
|
export function LoadingState({ label = "Loading..." }) {
|
|
4
|
-
return (_jsx("div", { className: "
|
|
4
|
+
return (_jsx("div", { className: "blog_bp-state blog_bp-state--loading", role: "status", children: label }));
|
|
5
5
|
}
|
|
6
6
|
export function ErrorState({ message, authError, }) {
|
|
7
|
-
return (_jsx("div", { className: "
|
|
7
|
+
return (_jsx("div", { className: "blog_bp-state blog_bp-state--error", role: "alert", children: authError
|
|
8
8
|
? "Authentication failed. Check the public API key."
|
|
9
9
|
: message || "Something went wrong." }));
|
|
10
10
|
}
|
|
11
11
|
export function EmptyState({ label = "No posts found." }) {
|
|
12
|
-
return (_jsx("div", { className: "
|
|
12
|
+
return (_jsx("div", { className: "blog_bp-state blog_bp-state--empty", children: label }));
|
|
13
13
|
}
|
|
14
14
|
export function Scope({ className, style, css, children, }) {
|
|
15
|
-
return (_jsxs("div", { className: cx("
|
|
15
|
+
return (_jsxs("div", { className: cx("blog_bp-root", className), style: {
|
|
16
16
|
width: "100%",
|
|
17
17
|
maxWidth: "100%",
|
|
18
18
|
boxSizing: "border-box",
|
package/dist/lib/lexical-doc.js
CHANGED
|
@@ -363,7 +363,7 @@ const nodeToHtml = (node) => {
|
|
|
363
363
|
const media = mediaFromNode(node.value);
|
|
364
364
|
if (!media)
|
|
365
365
|
return '';
|
|
366
|
-
return (`<figure class="
|
|
366
|
+
return (`<figure class="blog_ed-figure" contenteditable="false" data-media-id="${escapeHtml(media.id)}"` +
|
|
367
367
|
` data-node-id="${escapeHtml(str(node.id))}">` +
|
|
368
368
|
`<img src="${escapeHtml(media.url)}" alt="${escapeHtml(media.alt)}">` +
|
|
369
369
|
`<figcaption>${escapeHtml(media.alt || 'Image')}</figcaption>` +
|
|
@@ -71,7 +71,7 @@ function BlogAdminInner({ theme, branding, className, }) {
|
|
|
71
71
|
return _jsx(BrandPickPanel, { title: title, onPick: (id) => store.setActiveBrandId(id) });
|
|
72
72
|
}
|
|
73
73
|
if (!store.activeBrandId) {
|
|
74
|
-
return (_jsxs(_Fragment, { children: [_jsx(BrandPickPanel, { title: title, onPick: (id) => store.setActiveBrandId(id) }), _jsx("p", { className: "
|
|
74
|
+
return (_jsxs(_Fragment, { children: [_jsx(BrandPickPanel, { title: title, onPick: (id) => store.setActiveBrandId(id) }), _jsx("p", { className: "blog_note", children: "Showing first brand until one is selected." }), render(brandId)] }));
|
|
75
75
|
}
|
|
76
76
|
return render(brandId);
|
|
77
77
|
};
|
|
@@ -155,7 +155,7 @@ function BlogAdminInner({ theme, branding, className, }) {
|
|
|
155
155
|
case "comments":
|
|
156
156
|
return _jsx(CommentsManager, { onOpenPost: (id) => openEditor(id) });
|
|
157
157
|
case "redirects":
|
|
158
|
-
return (_jsxs(_Fragment, { children: [_jsx(RedirectAnalyticsDashboard, { data: store.redirectAnalytics }), _jsxs("div", { className: "
|
|
158
|
+
return (_jsxs(_Fragment, { children: [_jsx(RedirectAnalyticsDashboard, { data: store.redirectAnalytics }), _jsxs("div", { className: "blog_btn-row", style: { marginTop: 16 }, children: [_jsx("button", { type: "button", className: "blog_btn", onClick: () => navigate("redirects-all"), children: "All redirects" }), _jsx("button", { type: "button", className: "blog_btn blog_btn-primary", onClick: () => navigate("redirects-new"), children: "Add redirect" })] })] }));
|
|
159
159
|
case "redirects-all":
|
|
160
160
|
if (redirectId) {
|
|
161
161
|
return (_jsx(RedirectDetail, { redirectId: redirectId, onEdit: () => setActiveNav("redirects-new"), onBack: () => setRedirectId(undefined) }));
|
|
@@ -207,7 +207,7 @@ function BlogAdminInner({ theme, branding, className, }) {
|
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
209
|
const postCount = store.postCounts().all;
|
|
210
|
-
return (_jsxs("div", { className: cx("
|
|
210
|
+
return (_jsxs("div", { className: cx("blog_bp-admin-wrapper", branding?.className, className), style: {
|
|
211
211
|
...themeVars(theme, branding),
|
|
212
212
|
}, children: [branding?.css ? _jsx("style", { children: branding.css }) : null, _jsx(Shell, { active: activeNav, onNavigate: navigate, title: getTitle(), wide: Boolean(viewingId), subtitle: viewingId
|
|
213
213
|
? viewingPost?.status === "published"
|
|
@@ -219,17 +219,17 @@ function BlogAdminInner({ theme, branding, className, }) {
|
|
|
219
219
|
? `${postCount} posts across ${store.activeBrand ? "this brand" : "all brands"}`
|
|
220
220
|
: store.activeBrand
|
|
221
221
|
? store.activeBrand.name
|
|
222
|
-
: undefined, actions: _jsx(_Fragment, { children: _jsxs("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [_jsxs("select", { className: "
|
|
222
|
+
: undefined, actions: _jsx(_Fragment, { children: _jsxs("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [_jsxs("select", { className: "blog_fld blog_fld-sm", style: { minWidth: 140 }, "aria-label": "Brand filter", value: store.activeBrandId ?? "", onChange: (e) => store.setActiveBrandId(e.target.value || null), children: [_jsx("option", { value: "", children: "All brands" }), store.brands.map((b) => (_jsx("option", { value: b.id, children: b.name }, b.id)))] }), activeNav === "overview" ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "blog_btn-group", style: { display: "flex", background: "var(--d-rule)", borderRadius: 6, overflow: "hidden" }, children: [_jsx("button", { type: "button", className: "blog_btn blog_btn-ghost blog_btn-sm", style: { borderRadius: 0, opacity: 0.6 }, children: "7d" }), _jsx("button", { type: "button", className: "blog_btn blog_btn-ghost blog_btn-sm", style: {
|
|
223
223
|
borderRadius: 0,
|
|
224
224
|
background: "var(--d-accent-soft)",
|
|
225
225
|
color: "var(--d-accent)",
|
|
226
226
|
fontWeight: 600,
|
|
227
|
-
}, children: "30d" }), _jsx("button", { type: "button", className: "
|
|
227
|
+
}, children: "30d" }), _jsx("button", { type: "button", className: "blog_btn blog_btn-ghost blog_btn-sm", style: { borderRadius: 0, opacity: 0.6 }, children: "90d" })] }), _jsx("button", { type: "button", className: "blog_btn blog_btn-primary blog_btn-sm", onClick: () => openEditor(), children: "+ New post" })] })) : null, viewingId ? (_jsx("button", { type: "button", className: "blog_btn blog_btn-primary", onClick: () => openEditor(viewingId), children: "Edit post" })) : null, (activeNav.startsWith("posts") ||
|
|
228
228
|
activeNav === "attention" ||
|
|
229
229
|
activeNav === "scheduled" ||
|
|
230
230
|
activeNav === "trash") &&
|
|
231
231
|
activeNav !== "posts-new" &&
|
|
232
|
-
!viewingId ? (_jsx("button", { type: "button", className: "
|
|
232
|
+
!viewingId ? (_jsx("button", { type: "button", className: "blog_btn blog_btn-primary blog_btn-sm", onClick: () => openEditor(), children: "+ Add new" })) : null] }) }), branding: branding, userName: store.profile.name, userRole: store.profile.globalRole === "platform-admin" ? "Platform admin" : store.profile.globalRole, onProfile: () => navigate("profile"), children: renderContent() })] }));
|
|
233
233
|
}
|
|
234
234
|
function BlogAdminBootGate({ theme, branding, className, }) {
|
|
235
235
|
const store = useAdminMock();
|
|
@@ -237,7 +237,7 @@ function BlogAdminBootGate({ theme, branding, className, }) {
|
|
|
237
237
|
return (_jsx("div", { className: className, role: "status", style: { padding: 24 }, children: "Connecting to Admin API\u2026" }));
|
|
238
238
|
}
|
|
239
239
|
if (store.live && store.bootStatus === "error") {
|
|
240
|
-
return (_jsxs("div", { className: className, role: "alert", style: { padding: 24 }, children: [_jsx("p", { children: "Could not load Admin SDK data." }), _jsx("p", { style: { color: "#b91c1c" }, children: store.bootError ?? "Unknown error" }), _jsx("button", { type: "button", className: "
|
|
240
|
+
return (_jsxs("div", { className: className, role: "alert", style: { padding: 24 }, children: [_jsx("p", { children: "Could not load Admin SDK data." }), _jsx("p", { style: { color: "#b91c1c" }, children: store.bootError ?? "Unknown error" }), _jsx("button", { type: "button", className: "blog_btn blog_btn-primary", onClick: () => void store.refreshFromApi(), children: "Retry" })] }));
|
|
241
241
|
}
|
|
242
242
|
return _jsx(BlogAdminInner, { theme: theme, branding: branding, className: className });
|
|
243
243
|
}
|