@xexr/blog-platform 1.0.2 → 1.0.4

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.d.mts CHANGED
@@ -1,14 +1,46 @@
1
1
  import { PublishedArticle, PublishedSite, PublishResult, PublishedAuthor } from './types/index.mjs';
2
2
  export { PublishPayload } from './types/index.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import * as class_variance_authority_types from 'class-variance-authority/types';
5
4
  import * as React from 'react';
5
+ import { CSSProperties } from 'react';
6
+ import * as class_variance_authority_types from 'class-variance-authority/types';
6
7
  import { VariantProps } from 'class-variance-authority';
7
8
  import { ClassValue } from 'clsx';
8
9
  import { NextRequest, NextResponse } from 'next/server';
9
10
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
10
11
  import { LibSQLDatabase } from 'drizzle-orm/libsql';
11
12
 
13
+ interface BlogTheme {
14
+ accentColor?: string;
15
+ accentHoverColor?: string;
16
+ textAccentColor?: string;
17
+ textAccentHoverColor?: string;
18
+ accentBackgroundColor?: string;
19
+ accentBorderColor?: string;
20
+ }
21
+ interface TocItem {
22
+ id: string;
23
+ text: string;
24
+ level: 2 | 3;
25
+ }
26
+ interface ArticleDateMeta {
27
+ publishedDateLabel: string;
28
+ publishedRelativeLabel: string;
29
+ updatedDateLabel: string;
30
+ isUpdated: boolean;
31
+ }
32
+ type BlogThemeStyle = CSSProperties & {
33
+ "--blog-accent": string;
34
+ "--blog-accent-hover": string;
35
+ "--blog-text-accent": string;
36
+ "--blog-text-accent-hover": string;
37
+ "--blog-accent-bg": string;
38
+ "--blog-accent-border": string;
39
+ };
40
+ declare function getBlogThemeStyle(theme?: BlogTheme): BlogThemeStyle;
41
+ declare function formatArticleDateMeta(publishedAt: string, updatedAt: string): ArticleDateMeta;
42
+ declare function extractTableOfContents(markdown: string): TocItem[];
43
+
12
44
  interface BlogHomePageProps {
13
45
  articles: PublishedArticle[];
14
46
  siteName?: string;
@@ -26,6 +58,8 @@ interface BlogHomePageProps {
26
58
  totalPages: number;
27
59
  baseUrl?: string;
28
60
  };
61
+ /** Optional theme values for host-site brand integration. */
62
+ theme?: BlogTheme;
29
63
  }
30
64
  /**
31
65
  * Blog home page component that displays a list of published articles.
@@ -34,7 +68,7 @@ interface BlogHomePageProps {
34
68
  * @xexr/blog-platform package. It provides a clean, SEO-friendly
35
69
  * article listing with proper metadata.
36
70
  */
37
- declare function BlogHomePage({ articles, siteName, siteTagline, className, site, includeStructuredData, basePath, pagination, }: BlogHomePageProps): react_jsx_runtime.JSX.Element;
71
+ declare function BlogHomePage({ articles, siteName, siteTagline, className, site, includeStructuredData, basePath, pagination, theme, }: BlogHomePageProps): react_jsx_runtime.JSX.Element;
38
72
  /**
39
73
  * Generate metadata for the blog home page for SEO optimization.
40
74
  * This function should be used in the Next.js metadata API.
@@ -77,16 +111,33 @@ interface ArticlePageProps {
77
111
  previousArticle?: {
78
112
  url: string;
79
113
  title: string;
114
+ featuredImage?: string;
115
+ featuredImageAlt?: string;
80
116
  };
81
117
  nextArticle?: {
82
118
  url: string;
83
119
  title: string;
120
+ featuredImage?: string;
121
+ featuredImageAlt?: string;
84
122
  };
85
123
  };
86
124
  /** Public path where this blog is mounted, e.g. "/blog" or "/new-blog". */
87
125
  basePath?: string;
126
+ /** Optional theme values for host-site brand integration. */
127
+ theme?: BlogTheme;
128
+ /** Optional post-article CTA supplied by the host site. */
129
+ postArticleCta?: {
130
+ title: string;
131
+ description?: string;
132
+ href: string;
133
+ label: string;
134
+ };
135
+ /** Optional related articles supplied by the host site. */
136
+ relatedArticles?: PublishedArticle[];
137
+ /** Whether to render static article share links. */
138
+ showShareLinks?: boolean;
88
139
  }
89
- declare function ArticlePage({ article, className, navigation, basePath, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
140
+ declare function ArticlePage({ article, className, navigation, basePath, theme, postArticleCta, relatedArticles, showShareLinks, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
90
141
  /**
91
142
  * Generate metadata for the article page for SEO optimization.
92
143
  * This function should be used in the Next.js metadata API.
@@ -1807,4 +1858,4 @@ declare function OPTIONS(request: NextRequest): Promise<NextResponse>;
1807
1858
 
1808
1859
  declare const PACKAGE_VERSION: string;
1809
1860
 
1810
- export { ApiKeyAuth, type AuthConfig, type AuthResult, ArticlePage as BlogArticlePage, BlogHomePage, type BlogPlatformConfig, type BlogPlatformStorage, type BlogPostingSchema, type BlogSitemapConfig, type BreadcrumbListSchema, Button, type CanonicalUrlOptions, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DrizzleStorage, EnvAuth, type GeneratedMetadata, InMemoryStorage, type LinkTag, type MetaTag, type MetadataOptions, type NextjsSitemapEntry, NoAuth, type OrganizationSchema, PACKAGE_VERSION, Pagination$1 as Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, type PersonSchema, PublishResult, PublishedArticle, PublishedAuthor, PublishedSite, type RateLimitConfig, type RateLimitResult, Pagination as ShadcnPagination, type SitemapChangeFreq, type SitemapData, type SitemapEntry, type SitemapOptions, StructuredDataError, type StructuredDataOptions, UninitializedAuth, type WebSiteSchema, autoConfigureRateLimit, bpArticles, bpOperations, buildBlogPath, buttonVariants, checkRateLimit, cn, configureRateLimit, createBlogSitemapRoute, createDynamicBlogSitemap, createRateLimitErrorResponse, createStructuredDataScript, enforceRateLimit, extractKeywordsFromArticle, extractTokenFromHeader, generateArticleMetadata, generateArticleStructuredData, generateAuthorStructuredData, generateBlogHomeMetadata, generateBlogHomeStructuredData, generateBlogSitemapEntries, generateBreadcrumbStructuredData, generateCanonicalUrl, generateCanonicalUrlFromSlug, generateCompleteArticleStructuredData, generateOrganizationStructuredData, generatePaginationMetadata, generateSiteMetadata, generateSitemap, generateSitemapIndex, generateWebSiteStructuredData, getAuthConfig, getBaseUrl, getDrizzleAdapterSql, getPathPrefixFromBlogUrl, getRateLimitHeaders, getStorage, initBlogPlatform, initBlogPlatformDev, initBlogPlatformOnce, initBlogPlatformProd, initEnvAuth, isValidCanonicalUrl, metadataToHtml, normalizeBlogBasePath, normalizeDomain, normalizeSlug, POST$1 as publishHandler, safeGenerateArticleStructuredData, setAuthConfig, setStorage, shouldSkipAuth, sitemapToXml, GET as slugExistsHandler, OPTIONS as slugExistsOptionsHandler, structuredDataToJsonLd, POST as unpublishHandler, updateArticleCanonicalUrl, usePagination, validateMetadata, validateSitemap, validateStructuredData, GET$1 as versionHandler };
1861
+ export { ApiKeyAuth, type AuthConfig, type AuthResult, ArticlePage as BlogArticlePage, BlogHomePage, type BlogPlatformConfig, type BlogPlatformStorage, type BlogPostingSchema, type BlogSitemapConfig, type BlogTheme, type BreadcrumbListSchema, Button, type CanonicalUrlOptions, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DrizzleStorage, EnvAuth, type GeneratedMetadata, InMemoryStorage, type LinkTag, type MetaTag, type MetadataOptions, type NextjsSitemapEntry, NoAuth, type OrganizationSchema, PACKAGE_VERSION, Pagination$1 as Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, type PersonSchema, PublishResult, PublishedArticle, PublishedAuthor, PublishedSite, type RateLimitConfig, type RateLimitResult, Pagination as ShadcnPagination, type SitemapChangeFreq, type SitemapData, type SitemapEntry, type SitemapOptions, StructuredDataError, type StructuredDataOptions, UninitializedAuth, type WebSiteSchema, autoConfigureRateLimit, bpArticles, bpOperations, buildBlogPath, buttonVariants, checkRateLimit, cn, configureRateLimit, createBlogSitemapRoute, createDynamicBlogSitemap, createRateLimitErrorResponse, createStructuredDataScript, enforceRateLimit, extractKeywordsFromArticle, extractTableOfContents, extractTokenFromHeader, formatArticleDateMeta, generateArticleMetadata, generateArticleStructuredData, generateAuthorStructuredData, generateBlogHomeMetadata, generateBlogHomeStructuredData, generateBlogSitemapEntries, generateBreadcrumbStructuredData, generateCanonicalUrl, generateCanonicalUrlFromSlug, generateCompleteArticleStructuredData, generateOrganizationStructuredData, generatePaginationMetadata, generateSiteMetadata, generateSitemap, generateSitemapIndex, generateWebSiteStructuredData, getAuthConfig, getBaseUrl, getBlogThemeStyle, getDrizzleAdapterSql, getPathPrefixFromBlogUrl, getRateLimitHeaders, getStorage, initBlogPlatform, initBlogPlatformDev, initBlogPlatformOnce, initBlogPlatformProd, initEnvAuth, isValidCanonicalUrl, metadataToHtml, normalizeBlogBasePath, normalizeDomain, normalizeSlug, POST$1 as publishHandler, safeGenerateArticleStructuredData, setAuthConfig, setStorage, shouldSkipAuth, sitemapToXml, GET as slugExistsHandler, OPTIONS as slugExistsOptionsHandler, structuredDataToJsonLd, POST as unpublishHandler, updateArticleCanonicalUrl, usePagination, validateMetadata, validateSitemap, validateStructuredData, GET$1 as versionHandler };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,46 @@
1
1
  import { PublishedArticle, PublishedSite, PublishResult, PublishedAuthor } from './types/index.js';
2
2
  export { PublishPayload } from './types/index.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import * as class_variance_authority_types from 'class-variance-authority/types';
5
4
  import * as React from 'react';
5
+ import { CSSProperties } from 'react';
6
+ import * as class_variance_authority_types from 'class-variance-authority/types';
6
7
  import { VariantProps } from 'class-variance-authority';
7
8
  import { ClassValue } from 'clsx';
8
9
  import { NextRequest, NextResponse } from 'next/server';
9
10
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
10
11
  import { LibSQLDatabase } from 'drizzle-orm/libsql';
11
12
 
13
+ interface BlogTheme {
14
+ accentColor?: string;
15
+ accentHoverColor?: string;
16
+ textAccentColor?: string;
17
+ textAccentHoverColor?: string;
18
+ accentBackgroundColor?: string;
19
+ accentBorderColor?: string;
20
+ }
21
+ interface TocItem {
22
+ id: string;
23
+ text: string;
24
+ level: 2 | 3;
25
+ }
26
+ interface ArticleDateMeta {
27
+ publishedDateLabel: string;
28
+ publishedRelativeLabel: string;
29
+ updatedDateLabel: string;
30
+ isUpdated: boolean;
31
+ }
32
+ type BlogThemeStyle = CSSProperties & {
33
+ "--blog-accent": string;
34
+ "--blog-accent-hover": string;
35
+ "--blog-text-accent": string;
36
+ "--blog-text-accent-hover": string;
37
+ "--blog-accent-bg": string;
38
+ "--blog-accent-border": string;
39
+ };
40
+ declare function getBlogThemeStyle(theme?: BlogTheme): BlogThemeStyle;
41
+ declare function formatArticleDateMeta(publishedAt: string, updatedAt: string): ArticleDateMeta;
42
+ declare function extractTableOfContents(markdown: string): TocItem[];
43
+
12
44
  interface BlogHomePageProps {
13
45
  articles: PublishedArticle[];
14
46
  siteName?: string;
@@ -26,6 +58,8 @@ interface BlogHomePageProps {
26
58
  totalPages: number;
27
59
  baseUrl?: string;
28
60
  };
61
+ /** Optional theme values for host-site brand integration. */
62
+ theme?: BlogTheme;
29
63
  }
30
64
  /**
31
65
  * Blog home page component that displays a list of published articles.
@@ -34,7 +68,7 @@ interface BlogHomePageProps {
34
68
  * @xexr/blog-platform package. It provides a clean, SEO-friendly
35
69
  * article listing with proper metadata.
36
70
  */
37
- declare function BlogHomePage({ articles, siteName, siteTagline, className, site, includeStructuredData, basePath, pagination, }: BlogHomePageProps): react_jsx_runtime.JSX.Element;
71
+ declare function BlogHomePage({ articles, siteName, siteTagline, className, site, includeStructuredData, basePath, pagination, theme, }: BlogHomePageProps): react_jsx_runtime.JSX.Element;
38
72
  /**
39
73
  * Generate metadata for the blog home page for SEO optimization.
40
74
  * This function should be used in the Next.js metadata API.
@@ -77,16 +111,33 @@ interface ArticlePageProps {
77
111
  previousArticle?: {
78
112
  url: string;
79
113
  title: string;
114
+ featuredImage?: string;
115
+ featuredImageAlt?: string;
80
116
  };
81
117
  nextArticle?: {
82
118
  url: string;
83
119
  title: string;
120
+ featuredImage?: string;
121
+ featuredImageAlt?: string;
84
122
  };
85
123
  };
86
124
  /** Public path where this blog is mounted, e.g. "/blog" or "/new-blog". */
87
125
  basePath?: string;
126
+ /** Optional theme values for host-site brand integration. */
127
+ theme?: BlogTheme;
128
+ /** Optional post-article CTA supplied by the host site. */
129
+ postArticleCta?: {
130
+ title: string;
131
+ description?: string;
132
+ href: string;
133
+ label: string;
134
+ };
135
+ /** Optional related articles supplied by the host site. */
136
+ relatedArticles?: PublishedArticle[];
137
+ /** Whether to render static article share links. */
138
+ showShareLinks?: boolean;
88
139
  }
89
- declare function ArticlePage({ article, className, navigation, basePath, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
140
+ declare function ArticlePage({ article, className, navigation, basePath, theme, postArticleCta, relatedArticles, showShareLinks, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
90
141
  /**
91
142
  * Generate metadata for the article page for SEO optimization.
92
143
  * This function should be used in the Next.js metadata API.
@@ -1807,4 +1858,4 @@ declare function OPTIONS(request: NextRequest): Promise<NextResponse>;
1807
1858
 
1808
1859
  declare const PACKAGE_VERSION: string;
1809
1860
 
1810
- export { ApiKeyAuth, type AuthConfig, type AuthResult, ArticlePage as BlogArticlePage, BlogHomePage, type BlogPlatformConfig, type BlogPlatformStorage, type BlogPostingSchema, type BlogSitemapConfig, type BreadcrumbListSchema, Button, type CanonicalUrlOptions, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DrizzleStorage, EnvAuth, type GeneratedMetadata, InMemoryStorage, type LinkTag, type MetaTag, type MetadataOptions, type NextjsSitemapEntry, NoAuth, type OrganizationSchema, PACKAGE_VERSION, Pagination$1 as Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, type PersonSchema, PublishResult, PublishedArticle, PublishedAuthor, PublishedSite, type RateLimitConfig, type RateLimitResult, Pagination as ShadcnPagination, type SitemapChangeFreq, type SitemapData, type SitemapEntry, type SitemapOptions, StructuredDataError, type StructuredDataOptions, UninitializedAuth, type WebSiteSchema, autoConfigureRateLimit, bpArticles, bpOperations, buildBlogPath, buttonVariants, checkRateLimit, cn, configureRateLimit, createBlogSitemapRoute, createDynamicBlogSitemap, createRateLimitErrorResponse, createStructuredDataScript, enforceRateLimit, extractKeywordsFromArticle, extractTokenFromHeader, generateArticleMetadata, generateArticleStructuredData, generateAuthorStructuredData, generateBlogHomeMetadata, generateBlogHomeStructuredData, generateBlogSitemapEntries, generateBreadcrumbStructuredData, generateCanonicalUrl, generateCanonicalUrlFromSlug, generateCompleteArticleStructuredData, generateOrganizationStructuredData, generatePaginationMetadata, generateSiteMetadata, generateSitemap, generateSitemapIndex, generateWebSiteStructuredData, getAuthConfig, getBaseUrl, getDrizzleAdapterSql, getPathPrefixFromBlogUrl, getRateLimitHeaders, getStorage, initBlogPlatform, initBlogPlatformDev, initBlogPlatformOnce, initBlogPlatformProd, initEnvAuth, isValidCanonicalUrl, metadataToHtml, normalizeBlogBasePath, normalizeDomain, normalizeSlug, POST$1 as publishHandler, safeGenerateArticleStructuredData, setAuthConfig, setStorage, shouldSkipAuth, sitemapToXml, GET as slugExistsHandler, OPTIONS as slugExistsOptionsHandler, structuredDataToJsonLd, POST as unpublishHandler, updateArticleCanonicalUrl, usePagination, validateMetadata, validateSitemap, validateStructuredData, GET$1 as versionHandler };
1861
+ export { ApiKeyAuth, type AuthConfig, type AuthResult, ArticlePage as BlogArticlePage, BlogHomePage, type BlogPlatformConfig, type BlogPlatformStorage, type BlogPostingSchema, type BlogSitemapConfig, type BlogTheme, type BreadcrumbListSchema, Button, type CanonicalUrlOptions, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DrizzleStorage, EnvAuth, type GeneratedMetadata, InMemoryStorage, type LinkTag, type MetaTag, type MetadataOptions, type NextjsSitemapEntry, NoAuth, type OrganizationSchema, PACKAGE_VERSION, Pagination$1 as Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, type PersonSchema, PublishResult, PublishedArticle, PublishedAuthor, PublishedSite, type RateLimitConfig, type RateLimitResult, Pagination as ShadcnPagination, type SitemapChangeFreq, type SitemapData, type SitemapEntry, type SitemapOptions, StructuredDataError, type StructuredDataOptions, UninitializedAuth, type WebSiteSchema, autoConfigureRateLimit, bpArticles, bpOperations, buildBlogPath, buttonVariants, checkRateLimit, cn, configureRateLimit, createBlogSitemapRoute, createDynamicBlogSitemap, createRateLimitErrorResponse, createStructuredDataScript, enforceRateLimit, extractKeywordsFromArticle, extractTableOfContents, extractTokenFromHeader, formatArticleDateMeta, generateArticleMetadata, generateArticleStructuredData, generateAuthorStructuredData, generateBlogHomeMetadata, generateBlogHomeStructuredData, generateBlogSitemapEntries, generateBreadcrumbStructuredData, generateCanonicalUrl, generateCanonicalUrlFromSlug, generateCompleteArticleStructuredData, generateOrganizationStructuredData, generatePaginationMetadata, generateSiteMetadata, generateSitemap, generateSitemapIndex, generateWebSiteStructuredData, getAuthConfig, getBaseUrl, getBlogThemeStyle, getDrizzleAdapterSql, getPathPrefixFromBlogUrl, getRateLimitHeaders, getStorage, initBlogPlatform, initBlogPlatformDev, initBlogPlatformOnce, initBlogPlatformProd, initEnvAuth, isValidCanonicalUrl, metadataToHtml, normalizeBlogBasePath, normalizeDomain, normalizeSlug, POST$1 as publishHandler, safeGenerateArticleStructuredData, setAuthConfig, setStorage, shouldSkipAuth, sitemapToXml, GET as slugExistsHandler, OPTIONS as slugExistsOptionsHandler, structuredDataToJsonLd, POST as unpublishHandler, updateArticleCanonicalUrl, usePagination, validateMetadata, validateSitemap, validateStructuredData, GET$1 as versionHandler };