@fecommunity/reactpress-toolkit 3.7.0 → 4.0.0-beta.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/plugin/admin/index.d.ts +2 -0
- package/dist/plugin/admin/index.js +2 -0
- package/dist/plugin/admin/plugin-admin.d.ts +7 -1
- package/dist/plugin/client/runtime.d.ts +6 -1
- package/dist/plugin/index.d.ts +4 -0
- package/dist/plugin/index.js +5 -1
- package/dist/plugin/react/index.d.ts +1 -0
- package/dist/plugin/react/index.js +1 -0
- package/dist/theme/content/assets.js +33 -1
- package/dist/theme/extension/theme.d.ts +1 -1
- package/dist/theme/extension/theme.js +1 -1
- package/dist/theme/ssr/fetch.d.ts +3 -0
- package/dist/theme/ssr/pageProps.d.ts +5 -4
- package/dist/theme/ssr/pageProps.js +20 -3
- package/dist/theme/ssr/setting.d.ts +1 -0
- package/dist/theme/ssr/setting.js +3 -0
- package/dist/theme/ssr/templates.js +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/ui/components/ArchiveEmptyState.d.ts +1 -1
- package/dist/ui/components/ArchivePageLayout.d.ts +1 -1
- package/dist/ui/components/ArticleCard.d.ts +1 -1
- package/dist/ui/components/ArticleList.d.ts +1 -1
- package/dist/ui/components/BaseGlobalStyles.d.ts +1 -2
- package/dist/ui/components/LocaleSwitcher.d.ts +1 -1
- package/dist/ui/components/NavMenu.d.ts +1 -1
- package/dist/ui/components/NotFoundPanel.d.ts +1 -1
- package/dist/ui/components/PageHeader.d.ts +1 -1
- package/dist/ui/components/SiteAnalytics.d.ts +1 -1
- package/dist/ui/components/SiteBranding.d.ts +1 -2
- package/dist/ui/components/SiteDocument.d.ts +1 -1
- package/dist/ui/components/SiteDocumentFallback.d.ts +1 -1
- package/dist/ui/components/SiteLogo.d.ts +1 -2
- package/dist/ui/components/SiteSeo.d.ts +1 -1
- package/dist/ui/components/SiteTagline.d.ts +1 -2
- package/dist/ui/components/TaxonomyList.d.ts +1 -1
- package/dist/ui/components/ThemeCssVars.d.ts +1 -2
- package/dist/ui/components/ThemeLayout.d.ts +1 -1
- package/dist/ui/components/content/ArticleReader.d.ts +1 -1
- package/dist/ui/components/content/ArticleToc.d.ts +1 -1
- package/dist/ui/components/content/HtmlContent.d.ts +1 -2
- package/dist/ui/components/content/Image.d.ts +1 -1
- package/dist/ui/components/content/LocaleTime.d.ts +1 -2
- package/dist/ui/components/toolbar/LocaleToggleButton.d.ts +1 -1
- package/dist/ui/components/toolbar/ThemeToggleButton.d.ts +1 -1
- package/dist/ui/components/toolbar/ToolbarIconButton.d.ts +1 -1
- package/dist/ui/components/toolbar/icons.d.ts +7 -7
- package/dist/ui/context/LocaleContext.d.ts +1 -1
- package/dist/ui/context/ReactPressProvider.d.ts +1 -2
- package/dist/ui/context/SiteCatalogContext.d.ts +1 -1
- package/dist/ui/context/ThemeRuntimeContext.d.ts +1 -1
- package/package.json +13 -1
|
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./permissions"), exports);
|
|
18
|
+
__exportStar(require("./plugin-admin"), exports);
|
|
18
19
|
__exportStar(require("./registry"), exports);
|
|
20
|
+
__exportStar(require("./slots"), exports);
|
|
@@ -3,9 +3,15 @@ export interface PluginAdminContext {
|
|
|
3
3
|
id: string;
|
|
4
4
|
config: Record<string, unknown>;
|
|
5
5
|
}
|
|
6
|
+
export interface PluginSettingsPanelProps {
|
|
7
|
+
pluginId: string;
|
|
8
|
+
config: Record<string, unknown>;
|
|
9
|
+
pluginActive: boolean;
|
|
10
|
+
}
|
|
6
11
|
/** Plugin admin entry — called once per active plugin when admin shell loads. */
|
|
7
12
|
export interface PluginAdminModule {
|
|
8
|
-
registerAdmin(registry: PluginAdminRegistry, ctx: PluginAdminContext): void | Promise<void>;
|
|
13
|
+
registerAdmin?(registry: PluginAdminRegistry, ctx: PluginAdminContext): void | Promise<void>;
|
|
14
|
+
SettingsPanel?: (props: PluginSettingsPanelProps) => unknown;
|
|
9
15
|
}
|
|
10
16
|
/** Opaque component type — React `ComponentType` lives in `@fecommunity/reactpress-toolkit/plugin/react`. */
|
|
11
17
|
export type PluginAdminSlotComponent = (props: PluginAdminSlotComponentProps<unknown>) => unknown;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export type AppRuntime = 'web' | 'electron';
|
|
2
|
+
export type DesktopApiMode = 'local' | 'remote';
|
|
2
3
|
export interface DesktopApi {
|
|
4
|
+
getApiMode: () => Promise<DesktopApiMode>;
|
|
5
|
+
setApiMode: (mode: DesktopApiMode) => Promise<DesktopApiMode>;
|
|
3
6
|
getApiBaseUrl: () => Promise<string>;
|
|
4
|
-
setApiBaseUrl: (url: string) => Promise<
|
|
7
|
+
setApiBaseUrl: (url: string) => Promise<string>;
|
|
8
|
+
getRemoteApiBaseUrl: () => Promise<string>;
|
|
9
|
+
setRemoteApiBaseUrl: (url: string) => Promise<string>;
|
|
5
10
|
showSaveDialog: (opts: {
|
|
6
11
|
defaultPath?: string;
|
|
7
12
|
}) => Promise<string | undefined>;
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export * as admin from './admin';
|
|
2
2
|
export * as client from './client';
|
|
3
3
|
export * as dev from './dev';
|
|
4
|
+
export * as extension from './extension';
|
|
5
|
+
export * as server from './server';
|
|
4
6
|
/** @deprecated Use `plugin/client`; path kept for compatibility. */
|
|
5
7
|
export * as react from './react';
|
|
6
8
|
export * from './admin';
|
|
7
9
|
export * from './client';
|
|
8
10
|
export * from './dev';
|
|
11
|
+
export * from './extension';
|
|
12
|
+
export * from './server';
|
|
9
13
|
export * from './react';
|
package/dist/plugin/index.js
CHANGED
|
@@ -36,13 +36,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.react = exports.dev = exports.client = exports.admin = void 0;
|
|
39
|
+
exports.react = exports.server = exports.extension = exports.dev = exports.client = exports.admin = void 0;
|
|
40
40
|
exports.admin = __importStar(require("./admin"));
|
|
41
41
|
exports.client = __importStar(require("./client"));
|
|
42
42
|
exports.dev = __importStar(require("./dev"));
|
|
43
|
+
exports.extension = __importStar(require("./extension"));
|
|
44
|
+
exports.server = __importStar(require("./server"));
|
|
43
45
|
/** @deprecated Use `plugin/client`; path kept for compatibility. */
|
|
44
46
|
exports.react = __importStar(require("./react"));
|
|
45
47
|
__exportStar(require("./admin"), exports);
|
|
46
48
|
__exportStar(require("./client"), exports);
|
|
47
49
|
__exportStar(require("./dev"), exports);
|
|
50
|
+
__exportStar(require("./extension"), exports);
|
|
51
|
+
__exportStar(require("./server"), exports);
|
|
48
52
|
__exportStar(require("./react"), exports);
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/** Stable export path: `@fecommunity/reactpress-toolkit/plugin/react`. */
|
|
18
18
|
__exportStar(require("../client"), exports);
|
|
19
|
+
__exportStar(require("./plugin-admin-ui"), exports);
|
|
@@ -10,9 +10,18 @@ const PUBLIC_PATH_ALIASES = {
|
|
|
10
10
|
'/favicon.png': '/public/favicon.png',
|
|
11
11
|
'/favicon.ico': '/public/favicon.ico',
|
|
12
12
|
};
|
|
13
|
+
/** Theme Next rewrites serve alias keys (e.g. `/logo.png`), not `/public/*` API paths. */
|
|
14
|
+
const THEME_LOCAL_PUBLIC_PATHS = Object.fromEntries(Object.entries(PUBLIC_PATH_ALIASES).map(([themePath, apiPath]) => [apiPath, themePath]));
|
|
13
15
|
function normalizePublicAssetPath(path) {
|
|
14
16
|
return PUBLIC_PATH_ALIASES[path] ?? path;
|
|
15
17
|
}
|
|
18
|
+
function toThemeServablePath(apiPath) {
|
|
19
|
+
return THEME_LOCAL_PUBLIC_PATHS[apiPath] ?? apiPath;
|
|
20
|
+
}
|
|
21
|
+
/** Paths proxied by theme `next.config` rewrites — keep relative, never bake absolute API URLs. */
|
|
22
|
+
function isThemeRewritePath(path) {
|
|
23
|
+
return path in THEME_LOCAL_PUBLIC_PATHS || path.startsWith('/public/') || path.startsWith('/uploads/');
|
|
24
|
+
}
|
|
16
25
|
/** Whether a configured asset path is likely to resolve (skip broken defaults like `/logo.png`). */
|
|
17
26
|
function isLikelyValidAssetPath(url) {
|
|
18
27
|
const trimmed = (url ?? '').trim();
|
|
@@ -44,6 +53,26 @@ function resolvePublicSiteOrigin() {
|
|
|
44
53
|
'http://localhost:3002/api';
|
|
45
54
|
return serverApi.replace(/\/api\/?$/, '').replace(/\/$/, '');
|
|
46
55
|
}
|
|
56
|
+
/** Visitor site origin — differs from API origin during SSR (theme :3001 vs API :3002). */
|
|
57
|
+
function resolveThemeSiteOrigin() {
|
|
58
|
+
if (typeof window !== 'undefined') {
|
|
59
|
+
return window.location.origin;
|
|
60
|
+
}
|
|
61
|
+
const clientSite = process.env.CLIENT_SITE_URL?.trim();
|
|
62
|
+
if (clientSite) {
|
|
63
|
+
try {
|
|
64
|
+
return new URL(clientSite).origin;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return clientSite.replace(/\/$/, '');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const clientPort = process.env.CLIENT_PORT?.trim() || process.env.PORT?.trim();
|
|
71
|
+
if (clientPort) {
|
|
72
|
+
return `http://127.0.0.1:${clientPort}`;
|
|
73
|
+
}
|
|
74
|
+
return resolvePublicSiteOrigin();
|
|
75
|
+
}
|
|
47
76
|
/** Resolve media / logo URLs for theme pages. */
|
|
48
77
|
function resolvePublicAssetUrl(url) {
|
|
49
78
|
const trimmed = (url ?? '').trim();
|
|
@@ -57,8 +86,11 @@ function resolvePublicAssetUrl(url) {
|
|
|
57
86
|
}
|
|
58
87
|
if (trimmed.startsWith('/')) {
|
|
59
88
|
const normalized = normalizePublicAssetPath(trimmed);
|
|
89
|
+
if (isThemeRewritePath(normalized)) {
|
|
90
|
+
return toThemeServablePath(normalized);
|
|
91
|
+
}
|
|
60
92
|
const origin = resolvePublicSiteOrigin();
|
|
61
|
-
const themeOrigin =
|
|
93
|
+
const themeOrigin = resolveThemeSiteOrigin();
|
|
62
94
|
if (origin === themeOrigin) {
|
|
63
95
|
return normalized;
|
|
64
96
|
}
|
|
@@ -71,7 +71,7 @@ export interface SiteThemeState {
|
|
|
71
71
|
mods: Record<string, ThemeMods>;
|
|
72
72
|
previewThemeId?: string;
|
|
73
73
|
}
|
|
74
|
-
export declare const DEFAULT_ACTIVE_THEME = "
|
|
74
|
+
export declare const DEFAULT_ACTIVE_THEME = "hello-world";
|
|
75
75
|
export declare const defaultSiteThemeState: SiteThemeState;
|
|
76
76
|
export interface GlobalSettingWithTheme {
|
|
77
77
|
zh?: unknown;
|
|
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "appearancePrimaryColorForMode", { enumerable: tr
|
|
|
19
19
|
function appearancePrimaryColor(mods, fallback = '#f44336') {
|
|
20
20
|
return (0, twentytwentyfive_vars_1.appearancePrimaryColorForMode)(mods, false, fallback);
|
|
21
21
|
}
|
|
22
|
-
exports.DEFAULT_ACTIVE_THEME = '
|
|
22
|
+
exports.DEFAULT_ACTIVE_THEME = 'hello-world';
|
|
23
23
|
exports.defaultSiteThemeState = {
|
|
24
24
|
activeTheme: exports.DEFAULT_ACTIVE_THEME,
|
|
25
25
|
installedThemes: [exports.DEFAULT_ACTIVE_THEME],
|
|
@@ -73,7 +73,10 @@ export declare function fetchTagArchive(api: ThemeApi, tag: string): Promise<{
|
|
|
73
73
|
export type ThemeArticlePage = {
|
|
74
74
|
id: string;
|
|
75
75
|
title: string;
|
|
76
|
+
slug?: string;
|
|
76
77
|
summary?: string;
|
|
78
|
+
seoDescription?: string;
|
|
79
|
+
seoKeywords?: string;
|
|
77
80
|
html?: string;
|
|
78
81
|
cover?: string;
|
|
79
82
|
publishAt?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ThemeApi } from '../api/api';
|
|
2
2
|
import { type CarouselArticle, type ListArticle } from '../content/articleSlim';
|
|
3
3
|
import { type ArchiveTree } from '../content/archiveSlim';
|
|
4
|
-
import type { IArticle, ICategory, IKnowledge, ITag } from '../../types';
|
|
4
|
+
import type { IArticle, ICategory, IKnowledge, IPage, ITag } from '../../types';
|
|
5
5
|
export type HomePageProps = {
|
|
6
6
|
articles: ListArticle[];
|
|
7
7
|
total: number;
|
|
@@ -52,9 +52,10 @@ export declare function fetchKnowledgeChapterPageProps(api: ThemeApi, pId: strin
|
|
|
52
52
|
}>;
|
|
53
53
|
/** Site search results for `/search?keyword=`. */
|
|
54
54
|
export declare function fetchSearchPageProps(api: ThemeApi, keyword: string): Promise<SearchPageProps>;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
export type CmsPageProps = Pick<IPage, 'id' | 'name' | 'path' | 'html' | 'toc' | 'status' | 'publishAt' | 'views'>;
|
|
56
|
+
/** CMS static page by id or path slug (admin → 页面). */
|
|
57
|
+
export declare function fetchCmsPageProps(api: ThemeApi, idOrPath: string | undefined): Promise<{
|
|
58
|
+
page: CmsPageProps | null;
|
|
58
59
|
}>;
|
|
59
60
|
/** Single article by id (full entity from API). */
|
|
60
61
|
export declare function fetchArticleDetailProps(api: ThemeApi, id: string): Promise<{
|
|
@@ -15,6 +15,7 @@ const api_data_1 = require("../api/api-data");
|
|
|
15
15
|
const articleSlim_1 = require("../content/articleSlim");
|
|
16
16
|
const archiveSlim_1 = require("../content/archiveSlim");
|
|
17
17
|
const carouselArticles_1 = require("../content/carouselArticles");
|
|
18
|
+
const assets_1 = require("../content/assets");
|
|
18
19
|
const fetch_1 = require("./fetch");
|
|
19
20
|
const DEFAULT_PAGE_SIZE = 12;
|
|
20
21
|
function fallbackCategory(value) {
|
|
@@ -128,9 +129,25 @@ async function fetchSearchPageProps(api, keyword) {
|
|
|
128
129
|
const articles = (0, api_data_1.unpackList)(response).filter((article) => article.status === 'publish');
|
|
129
130
|
return { keyword: trimmed, articles };
|
|
130
131
|
}
|
|
131
|
-
/** CMS static page by id. */
|
|
132
|
-
async function fetchCmsPageProps(api,
|
|
133
|
-
|
|
132
|
+
/** CMS static page by id or path slug (admin → 页面). */
|
|
133
|
+
async function fetchCmsPageProps(api, idOrPath) {
|
|
134
|
+
if (!idOrPath?.trim())
|
|
135
|
+
return { page: null };
|
|
136
|
+
const raw = (0, api_data_1.unpackOne)(await api.page.findById(idOrPath.trim()));
|
|
137
|
+
if (!raw || raw.status !== 'publish')
|
|
138
|
+
return { page: null };
|
|
139
|
+
return {
|
|
140
|
+
page: {
|
|
141
|
+
id: raw.id,
|
|
142
|
+
name: raw.name,
|
|
143
|
+
path: raw.path,
|
|
144
|
+
html: raw.html ? (0, assets_1.rewriteArticleHtmlAssets)(raw.html) : raw.html,
|
|
145
|
+
toc: raw.toc,
|
|
146
|
+
status: raw.status,
|
|
147
|
+
publishAt: raw.publishAt,
|
|
148
|
+
views: raw.views,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
134
151
|
}
|
|
135
152
|
/** Single article by id (full entity from API). */
|
|
136
153
|
async function fetchArticleDetailProps(api, id) {
|
|
@@ -31,6 +31,9 @@ function parseSiteMeta(row) {
|
|
|
31
31
|
siteName: String(row.systemTitle ?? 'ReactPress Site').trim() || exports.DEFAULT_SITE_META.siteName,
|
|
32
32
|
siteDescription: String(row.systemSubTitle ?? exports.DEFAULT_SITE_META.siteDescription).trim() ||
|
|
33
33
|
exports.DEFAULT_SITE_META.siteDescription,
|
|
34
|
+
siteKeywords: row.seoKeyword != null && String(row.seoKeyword).trim()
|
|
35
|
+
? String(row.seoKeyword).trim()
|
|
36
|
+
: undefined,
|
|
34
37
|
siteUrl: row.systemUrl != null ? String(row.systemUrl).trim() || undefined : undefined,
|
|
35
38
|
siteLogo: row.systemLogo != null && String(row.systemLogo).trim()
|
|
36
39
|
? String(row.systemLogo).trim()
|
|
@@ -34,7 +34,7 @@ exports.ThemeTemplate = {
|
|
|
34
34
|
exports.DEFAULT_TEMPLATE_FILES = {
|
|
35
35
|
[exports.ThemeTemplate.HOME]: 'pages/index.tsx',
|
|
36
36
|
[exports.ThemeTemplate.SINGLE]: 'pages/article/[id].tsx',
|
|
37
|
-
[exports.ThemeTemplate.PAGE]: 'pages/
|
|
37
|
+
[exports.ThemeTemplate.PAGE]: 'pages/[path].tsx',
|
|
38
38
|
[exports.ThemeTemplate.ARCHIVE_CATEGORY]: 'pages/category/[category].tsx',
|
|
39
39
|
[exports.ThemeTemplate.ARCHIVE_TAG]: 'pages/tag/[tag].tsx',
|
|
40
40
|
[exports.ThemeTemplate.SEARCH]: 'pages/search.tsx',
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export interface ArchiveEmptyStateProps {
|
|
|
10
10
|
}) => React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
/** Headless empty archive/search state with optional back link slot. */
|
|
13
|
-
export declare function ArchiveEmptyState({ message, backHref, backLabel, className, renderBackLink, }: ArchiveEmptyStateProps):
|
|
13
|
+
export declare function ArchiveEmptyState({ message, backHref, backLabel, className, renderBackLink, }: ArchiveEmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,4 +7,4 @@ export interface ArchivePageLayoutProps {
|
|
|
7
7
|
sidebarClassName?: string;
|
|
8
8
|
}
|
|
9
9
|
/** Two-column archive layout (main list + sidebar widgets). */
|
|
10
|
-
export declare function ArchivePageLayout({ main, sidebar, className, mainClassName, sidebarClassName, }: ArchivePageLayoutProps):
|
|
10
|
+
export declare function ArchivePageLayout({ main, sidebar, className, mainClassName, sidebarClassName, }: ArchivePageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -24,4 +24,4 @@ export interface ArticleCardProps {
|
|
|
24
24
|
renderDate?: (publishAt: string) => React.ReactNode;
|
|
25
25
|
}
|
|
26
26
|
/** Headless article card — theme supplies Link markup and CSS. */
|
|
27
|
-
export declare function ArticleCard({ article, className, titleTag, showCategory, renderTitleLink, renderCategoryLink, renderDate, }: ArticleCardProps):
|
|
27
|
+
export declare function ArticleCard({ article, className, titleTag, showCategory, renderTitleLink, renderCategoryLink, renderDate, }: ArticleCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,4 +11,4 @@ export interface ArticleListProps<T extends {
|
|
|
11
11
|
/** Headless article grid/list — theme supplies markup and styles per item. */
|
|
12
12
|
export declare function ArticleList<T extends {
|
|
13
13
|
id: string;
|
|
14
|
-
}>({ articles, limit, className, empty, renderArticle, }: ArticleListProps<T>):
|
|
14
|
+
}>({ articles, limit, className, empty, renderArticle, }: ArticleListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface BaseGlobalStylesProps {
|
|
3
2
|
extra?: string;
|
|
4
3
|
}
|
|
5
4
|
/** Shared reset used by starter themes (override via `extra` CSS). */
|
|
6
|
-
export declare function BaseGlobalStyles({ extra }: BaseGlobalStylesProps):
|
|
5
|
+
export declare function BaseGlobalStyles({ extra }: BaseGlobalStylesProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,4 +7,4 @@ export interface LocaleSwitcherProps {
|
|
|
7
7
|
ariaLabel?: string;
|
|
8
8
|
}
|
|
9
9
|
/** Click to cycle locales — same control as admin and theme headers. */
|
|
10
|
-
export declare function LocaleSwitcher({ className, buttonClassName, size, ariaLabel, }: LocaleSwitcherProps): import("react").JSX.Element;
|
|
10
|
+
export declare function LocaleSwitcher({ className, buttonClassName, size, ariaLabel, }: LocaleSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,4 +13,4 @@ export interface NavMenuProps {
|
|
|
13
13
|
renderLink: (props: NavMenuRenderLinkProps) => React.ReactNode;
|
|
14
14
|
}
|
|
15
15
|
/** Headless site navigation — styling via theme `renderLink` (e.g. Next.js `Link`). */
|
|
16
|
-
export declare function NavMenu({ items, activeId, className, listClassName, itemClassName, renderLink, }: NavMenuProps):
|
|
16
|
+
export declare function NavMenu({ items, activeId, className, listClassName, itemClassName, renderLink, }: NavMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,4 +8,4 @@ export interface NotFoundPanelProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
10
|
/** Headless 404 / not-found content block (theme supplies styles). */
|
|
11
|
-
export declare function NotFoundPanel({ title, subtitle, description, illustration, actions, className, }: NotFoundPanelProps):
|
|
11
|
+
export declare function NotFoundPanel({ title, subtitle, description, illustration, actions, className, }: NotFoundPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,4 +7,4 @@ export interface PageHeaderProps {
|
|
|
7
7
|
descriptionClassName?: string;
|
|
8
8
|
}
|
|
9
9
|
/** Unstyled archive / page title block (WP `the_archive_title` pattern). */
|
|
10
|
-
export declare function PageHeader({ title, description, className, titleClassName, descriptionClassName, }: PageHeaderProps):
|
|
10
|
+
export declare function PageHeader({ title, description, className, titleClassName, descriptionClassName, }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,4 +2,4 @@ export interface SiteAnalyticsProps {
|
|
|
2
2
|
children?: React.ReactNode;
|
|
3
3
|
}
|
|
4
4
|
/** Inject Google Analytics / Baidu Tongji scripts from site settings. */
|
|
5
|
-
export declare function SiteAnalytics({ children }: SiteAnalyticsProps): string | number | boolean | import("react").ReactElement<
|
|
5
|
+
export declare function SiteAnalytics({ children }: SiteAnalyticsProps): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface SiteBrandingProps {
|
|
3
2
|
/** Last-resort title when customizer mod and site settings are both empty. */
|
|
4
3
|
fallback?: string;
|
|
@@ -8,4 +7,4 @@ export interface SiteBrandingProps {
|
|
|
8
7
|
/**
|
|
9
8
|
* Site title: customizer `displayTitle` when set, otherwise `systemTitle` from site settings.
|
|
10
9
|
*/
|
|
11
|
-
export declare function SiteBranding({ fallback, className, as: Tag }: SiteBrandingProps):
|
|
10
|
+
export declare function SiteBranding({ fallback, className, as: Tag }: SiteBrandingProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,4 +17,4 @@ export interface SiteDocumentProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* WordPress-style shell: head slot + header + main + footer (like `get_header()` / `get_footer()`).
|
|
19
19
|
*/
|
|
20
|
-
export declare function SiteDocument({ head, header, footer, children, className, mainClassName, contentClassName, wrapContent, globalCss, skipBaseStyles, skipCssVars, }: SiteDocumentProps):
|
|
20
|
+
export declare function SiteDocument({ head, header, footer, children, className, mainClassName, contentClassName, wrapContent, globalCss, skipBaseStyles, skipCssVars, }: SiteDocumentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,4 +5,4 @@ export interface SiteDocumentFallbackProps extends Omit<SiteDocumentProps, 'chil
|
|
|
5
5
|
messageClassName?: string;
|
|
6
6
|
}
|
|
7
7
|
/** Standard ISR fallback shell while on-demand pages compile. */
|
|
8
|
-
export declare function SiteDocumentFallback({ message, messageClassName, ...shell }: SiteDocumentFallbackProps):
|
|
8
|
+
export declare function SiteDocumentFallback({ message, messageClassName, ...shell }: SiteDocumentFallbackProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface SiteLogoProps {
|
|
3
2
|
className?: string;
|
|
4
3
|
alt?: string;
|
|
@@ -6,4 +5,4 @@ export interface SiteLogoProps {
|
|
|
6
5
|
height?: number;
|
|
7
6
|
}
|
|
8
7
|
/** Site logo: customizer `siteLogo` when set, otherwise `systemLogo` from site settings. */
|
|
9
|
-
export declare function SiteLogo({ className, alt, width, height }: SiteLogoProps):
|
|
8
|
+
export declare function SiteLogo({ className, alt, width, height }: SiteLogoProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -10,4 +10,4 @@ export interface SiteSeoProps {
|
|
|
10
10
|
description?: string;
|
|
11
11
|
}
|
|
12
12
|
/** Inject default site meta tags from catalog `setting`. */
|
|
13
|
-
export declare function SiteSeo({ children, favicon, keywords, description }: SiteSeoProps):
|
|
13
|
+
export declare function SiteSeo({ children, favicon, keywords, description }: SiteSeoProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface SiteTaglineProps {
|
|
3
2
|
/** Used when customizer tagline and site subtitle are both empty. */
|
|
4
3
|
fallback?: string;
|
|
5
4
|
className?: string;
|
|
6
5
|
}
|
|
7
6
|
/** Site tagline: customizer `displayTagline` when set, otherwise `systemSubTitle`. */
|
|
8
|
-
export declare function SiteTagline({ fallback, className }: SiteTaglineProps):
|
|
7
|
+
export declare function SiteTagline({ fallback, className }: SiteTaglineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -22,4 +22,4 @@ export interface TaxonomyListProps {
|
|
|
22
22
|
renderLink: (props: TaxonomyListRenderLinkProps) => React.ReactNode;
|
|
23
23
|
}
|
|
24
24
|
/** Headless category/tag list (sidebar, footer, tag cloud). */
|
|
25
|
-
export declare function TaxonomyList({ items, kind, variant, currentValue, className, itemClassName, hrefFor, renderLink, }: TaxonomyListProps):
|
|
25
|
+
export declare function TaxonomyList({ items, kind, variant, currentValue, className, itemClassName, hrefFor, renderLink, }: TaxonomyListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,4 +10,4 @@ export interface ThemeLayoutProps {
|
|
|
10
10
|
wrapContent?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/** Unstyled page shell: header + main (+ optional content wrapper) + footer. */
|
|
13
|
-
export declare function ThemeLayout({ header, footer, children, className, mainClassName, contentClassName, wrapContent, }: ThemeLayoutProps):
|
|
13
|
+
export declare function ThemeLayout({ header, footer, children, className, mainClassName, contentClassName, wrapContent, }: ThemeLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -40,6 +40,6 @@ export interface ArticleReaderProps {
|
|
|
40
40
|
* Headless single-article reader — meta, cover, HTML body, optional TOC slot.
|
|
41
41
|
* Theme supplies layout shell, comments, and tag links via render props.
|
|
42
42
|
*/
|
|
43
|
-
export declare function ArticleReader({ article, className, articleClassName, containerId, locale, copyLabel, onCopy, labels, renderTags, renderFooter, children, }: ArticleReaderProps):
|
|
43
|
+
export declare function ArticleReader({ article, className, articleClassName, containerId, locale, copyLabel, onCopy, labels, renderTags, renderFooter, children, }: ArticleReaderProps): import("react/jsx-runtime").JSX.Element;
|
|
44
44
|
export { ArticleToc, HtmlContent, ImageViewer, LocaleTime, parseArticleToc };
|
|
45
45
|
export type { TocItem };
|
|
@@ -16,6 +16,6 @@ export interface ArticleTocProps {
|
|
|
16
16
|
indentStep?: number;
|
|
17
17
|
}
|
|
18
18
|
/** Headless table-of-contents for article pages. */
|
|
19
|
-
export declare function ArticleToc({ items, className, listClassName, itemClassName, activeClassName, maxHeight, title, showTitle, indentStep, }: ArticleTocProps):
|
|
19
|
+
export declare function ArticleToc({ items, className, listClassName, itemClassName, activeClassName, maxHeight, title, showTitle, indentStep, }: ArticleTocProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
20
|
/** Parse TOC JSON stored on article records. Supports legacy `[level, id, text]` tuples. */
|
|
21
21
|
export declare function parseArticleToc(raw?: string | null): TocItem[];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface HtmlContentProps {
|
|
3
2
|
/** Server-rendered HTML (article body). */
|
|
4
3
|
content?: string;
|
|
@@ -13,4 +12,4 @@ export interface HtmlContentProps {
|
|
|
13
12
|
highlightCode?: boolean;
|
|
14
13
|
}
|
|
15
14
|
/** Render HTML article body with optional code highlight and copy buttons. */
|
|
16
|
-
export declare function HtmlContent({ content, className, copyLabel, copySuccessLabel, onCopy, highlightCode, }: HtmlContentProps):
|
|
15
|
+
export declare function HtmlContent({ content, className, copyLabel, copySuccessLabel, onCopy, highlightCode, }: HtmlContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,4 +6,4 @@ export interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 's
|
|
|
6
6
|
size?: ImageVariant;
|
|
7
7
|
}
|
|
8
8
|
/** 按上传变体尺寸渲染 `<img>`,`url` + `size` 外其余属性透传。 */
|
|
9
|
-
export declare function Image({ url, size, alt, ...rest }: ImageProps): import("react").JSX.Element | null;
|
|
9
|
+
export declare function Image({ url, size, alt, ...rest }: ImageProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface LocaleTimeProps {
|
|
3
2
|
date: string | number | Date;
|
|
4
3
|
format?: string;
|
|
@@ -7,4 +6,4 @@ export interface LocaleTimeProps {
|
|
|
7
6
|
locale?: string;
|
|
8
7
|
}
|
|
9
8
|
/** Locale-aware `<time>` — absolute date or relative timeago. */
|
|
10
|
-
export declare function LocaleTime({ date, timeago, format, locale, }: LocaleTimeProps):
|
|
9
|
+
export declare function LocaleTime({ date, timeago, format, locale, }: LocaleTimeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,4 +5,4 @@ export interface LocaleToggleButtonProps extends Omit<ToolbarIconButtonProps, 'c
|
|
|
5
5
|
onLocaleChange: (locale: string) => void;
|
|
6
6
|
}
|
|
7
7
|
/** Click to cycle locales. Shows zh/en translation bubble icons (like theme sun/moon). */
|
|
8
|
-
export declare function LocaleToggleButton({ locale, locales, onLocaleChange, size, title, ...rest }: LocaleToggleButtonProps): import("react").JSX.Element | null;
|
|
8
|
+
export declare function LocaleToggleButton({ locale, locales, onLocaleChange, size, title, ...rest }: LocaleToggleButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,4 +4,4 @@ export interface ThemeToggleButtonProps extends Omit<ToolbarIconButtonProps, 'ch
|
|
|
4
4
|
onToggle: () => void;
|
|
5
5
|
}
|
|
6
6
|
/** Click to switch light/dark. Shows sun in light mode, moon in dark mode. */
|
|
7
|
-
export declare function ThemeToggleButton({ isDark, onToggle, size, ...rest }: ThemeToggleButtonProps): import("react").JSX.Element;
|
|
7
|
+
export declare function ThemeToggleButton({ isDark, onToggle, size, ...rest }: ThemeToggleButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,4 +4,4 @@ export interface ToolbarIconButtonProps extends Omit<ButtonHTMLAttributes<HTMLBu
|
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
size?: number;
|
|
6
6
|
}
|
|
7
|
-
export declare function ToolbarIconButton({ children, className, style, ...rest }: ToolbarIconButtonProps): import("react").JSX.Element;
|
|
7
|
+
export declare function ToolbarIconButton({ children, className, style, ...rest }: ToolbarIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,16 +2,16 @@ import type { SVGProps } from 'react';
|
|
|
2
2
|
type IconProps = Pick<SVGProps<SVGSVGElement>, 'className'> & {
|
|
3
3
|
size?: number;
|
|
4
4
|
};
|
|
5
|
-
export declare function SunIcon({ size, className }: IconProps): import("react").JSX.Element;
|
|
6
|
-
export declare function MoonIcon({ size, className }: IconProps): import("react").JSX.Element;
|
|
7
|
-
export declare function LanguagesIcon({ size, className }: IconProps): import("react").JSX.Element;
|
|
8
|
-
export declare function SearchIcon({ size, className }: IconProps): import("react").JSX.Element;
|
|
5
|
+
export declare function SunIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function MoonIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function LanguagesIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function SearchIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
/** 中文态:气泡内「中」,右下角「A」。 */
|
|
10
|
-
export declare function LocaleZhToggleIcon(props: IconProps): import("react").JSX.Element;
|
|
10
|
+
export declare function LocaleZhToggleIcon(props: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
/** 英文态:气泡内「A」,右下角「中」。 */
|
|
12
|
-
export declare function LocaleEnToggleIcon(props: IconProps): import("react").JSX.Element;
|
|
12
|
+
export declare function LocaleEnToggleIcon(props: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
/** Active locale — switches between zh/en translation bubble icons. */
|
|
14
14
|
export declare function LocaleActiveIcon({ locale, size, className, }: IconProps & {
|
|
15
15
|
locale: string;
|
|
16
|
-
}): import("react").JSX.Element;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -10,6 +10,6 @@ export interface LocaleProviderProps {
|
|
|
10
10
|
persistLocale?: boolean;
|
|
11
11
|
onLocaleChange?: (locale: string) => void;
|
|
12
12
|
}
|
|
13
|
-
export declare function LocaleProvider({ locale: initialLocale, locales, messages: initialMessages, catalog, children, persistLocale, onLocaleChange, }: LocaleProviderProps):
|
|
13
|
+
export declare function LocaleProvider({ locale: initialLocale, locales, messages: initialMessages, catalog, children, persistLocale, onLocaleChange, }: LocaleProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export declare function useLocale(): LocaleContextValue;
|
|
15
15
|
export declare function readPersistedLocale(locales: string[], fallback: string): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { ReactPressProviderProps } from './types';
|
|
3
2
|
/** Wraps the theme app with locale + active theme / customizer context. */
|
|
4
|
-
export declare function ReactPressProvider({ locale, locales, messages, catalog, themeId, activeThemeId, mods, isPreview, siteMeta, children, persistLocale, onLocaleChange, }: ReactPressProviderProps):
|
|
3
|
+
export declare function ReactPressProvider({ locale, locales, messages, catalog, themeId, activeThemeId, mods, isPreview, siteMeta, children, persistLocale, onLocaleChange, }: ReactPressProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ export declare const SiteCatalogContext: React.Context<SiteCatalogContextValue>;
|
|
|
6
6
|
export declare function SiteCatalogProvider({ value, children, }: {
|
|
7
7
|
value: SiteCatalogContextValue;
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
-
}):
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export declare function useSiteCatalog(): {
|
|
11
11
|
categories: import("../..").ICategory[];
|
|
12
12
|
tags: import("../..").ITag[];
|
|
@@ -9,7 +9,7 @@ export interface ThemeRuntimeProviderProps {
|
|
|
9
9
|
siteMeta?: ThemeRuntimeContextValue['siteMeta'];
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}
|
|
12
|
-
export declare function ThemeRuntimeProvider({ themeId, activeThemeId, mods, isPreview, siteMeta, children, }: ThemeRuntimeProviderProps):
|
|
12
|
+
export declare function ThemeRuntimeProvider({ themeId, activeThemeId, mods, isPreview, siteMeta, children, }: ThemeRuntimeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export declare function useThemeRuntime(): ThemeRuntimeContextValue;
|
|
14
14
|
/** Read a single customizer mod with optional default (from `theme.json` customizer). */
|
|
15
15
|
export declare function useThemeMod(modId: string, defaultValue?: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fecommunity/reactpress-toolkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -79,6 +79,18 @@
|
|
|
79
79
|
"./plugin/dev": {
|
|
80
80
|
"types": "./dist/plugin/dev/index.d.ts",
|
|
81
81
|
"default": "./dist/plugin/dev/index.js"
|
|
82
|
+
},
|
|
83
|
+
"./plugin/extension": {
|
|
84
|
+
"types": "./dist/plugin/extension/index.d.ts",
|
|
85
|
+
"default": "./dist/plugin/extension/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./plugin/server": {
|
|
88
|
+
"types": "./dist/plugin/server/index.d.ts",
|
|
89
|
+
"default": "./dist/plugin/server/index.js"
|
|
90
|
+
},
|
|
91
|
+
"./plugin/node": {
|
|
92
|
+
"types": "./dist/plugin/node.d.ts",
|
|
93
|
+
"default": "./dist/plugin/node.js"
|
|
82
94
|
}
|
|
83
95
|
},
|
|
84
96
|
"peerDependencies": {
|