@fecommunity/reactpress-toolkit 3.7.0 → 4.0.0-beta.1

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.
Files changed (52) hide show
  1. package/README.md +107 -107
  2. package/dist/plugin/admin/index.d.ts +2 -0
  3. package/dist/plugin/admin/index.js +2 -0
  4. package/dist/plugin/admin/plugin-admin.d.ts +7 -1
  5. package/dist/plugin/client/runtime.d.ts +6 -1
  6. package/dist/plugin/index.d.ts +4 -0
  7. package/dist/plugin/index.js +5 -1
  8. package/dist/plugin/react/index.d.ts +1 -0
  9. package/dist/plugin/react/index.js +1 -0
  10. package/dist/theme/content/assets.js +33 -1
  11. package/dist/theme/extension/theme.d.ts +1 -1
  12. package/dist/theme/extension/theme.js +1 -1
  13. package/dist/theme/ssr/fetch.d.ts +3 -0
  14. package/dist/theme/ssr/pageProps.d.ts +5 -4
  15. package/dist/theme/ssr/pageProps.js +20 -3
  16. package/dist/theme/ssr/setting.d.ts +1 -0
  17. package/dist/theme/ssr/setting.js +3 -0
  18. package/dist/theme/ssr/templates.js +1 -1
  19. package/dist/types/index.d.ts +3 -0
  20. package/dist/ui/components/ArchiveEmptyState.d.ts +1 -1
  21. package/dist/ui/components/ArchivePageLayout.d.ts +1 -1
  22. package/dist/ui/components/ArticleCard.d.ts +1 -1
  23. package/dist/ui/components/ArticleList.d.ts +1 -1
  24. package/dist/ui/components/BaseGlobalStyles.d.ts +1 -2
  25. package/dist/ui/components/LocaleSwitcher.d.ts +1 -1
  26. package/dist/ui/components/NavMenu.d.ts +1 -1
  27. package/dist/ui/components/NotFoundPanel.d.ts +1 -1
  28. package/dist/ui/components/PageHeader.d.ts +1 -1
  29. package/dist/ui/components/SiteAnalytics.d.ts +1 -1
  30. package/dist/ui/components/SiteBranding.d.ts +1 -2
  31. package/dist/ui/components/SiteDocument.d.ts +1 -1
  32. package/dist/ui/components/SiteDocumentFallback.d.ts +1 -1
  33. package/dist/ui/components/SiteLogo.d.ts +1 -2
  34. package/dist/ui/components/SiteSeo.d.ts +1 -1
  35. package/dist/ui/components/SiteTagline.d.ts +1 -2
  36. package/dist/ui/components/TaxonomyList.d.ts +1 -1
  37. package/dist/ui/components/ThemeCssVars.d.ts +1 -2
  38. package/dist/ui/components/ThemeLayout.d.ts +1 -1
  39. package/dist/ui/components/content/ArticleReader.d.ts +1 -1
  40. package/dist/ui/components/content/ArticleToc.d.ts +1 -1
  41. package/dist/ui/components/content/HtmlContent.d.ts +1 -2
  42. package/dist/ui/components/content/Image.d.ts +1 -1
  43. package/dist/ui/components/content/LocaleTime.d.ts +1 -2
  44. package/dist/ui/components/toolbar/LocaleToggleButton.d.ts +1 -1
  45. package/dist/ui/components/toolbar/ThemeToggleButton.d.ts +1 -1
  46. package/dist/ui/components/toolbar/ToolbarIconButton.d.ts +1 -1
  47. package/dist/ui/components/toolbar/icons.d.ts +7 -7
  48. package/dist/ui/context/LocaleContext.d.ts +1 -1
  49. package/dist/ui/context/ReactPressProvider.d.ts +1 -2
  50. package/dist/ui/context/SiteCatalogContext.d.ts +1 -1
  51. package/dist/ui/context/ThemeRuntimeContext.d.ts +1 -1
  52. package/package.json +13 -1
package/README.md CHANGED
@@ -1,89 +1,89 @@
1
1
  # @fecommunity/reactpress-toolkit
2
2
 
3
- ReactPress 的 TypeScript 工具包:从 OpenAPI/Swagger 生成的 API 客户端、站点配置类型、Next.js 主题 SSR 辅助,以及管理后台插件注册。
3
+ TypeScript toolkit for ReactPress: OpenAPI/Swagger-generated API clients, site config types, Next.js theme SSR helpers, and admin plugin registry.
4
4
 
5
- ## 包导出(`package.json` → `exports`)
5
+ ## Package exports (`package.json` → `exports`)
6
6
 
7
- | 子路径 | 用途 |
7
+ | Subpath | Purpose |
8
8
  |--------|------|
9
- | `.` | 根入口:`api`、`config`、`theme`、`ui`、`plugin` 命名空间及常用 re-export |
10
- | `./api` | 各资源 HTTP 客户端类 |
11
- | `./api/instance` | 默认 `api` 实例与 `createApiInstance` |
12
- | `./types` | Swagger 生成的请求/响应类型 |
13
- | `./utils` | 与业务无关的纯工具(见下方模块表) |
14
- | `./config` | 环境变量、全局默认、`i18n` 文案(`config/locales/*.json`) |
15
- | `./theme` | 访客主题:SSR 拉数、运行时、扩展配置类型,并 re-export `./ui` |
9
+ | `.` | Root entry: `api`, `config`, `theme`, `ui`, `plugin` namespaces and common re-exports |
10
+ | `./api` | HTTP client classes per resource |
11
+ | `./api/instance` | Default `api` instance and `createApiInstance` |
12
+ | `./types` | Swagger-generated request/response types |
13
+ | `./utils` | Framework-agnostic utilities (see module table below) |
14
+ | `./config` | Env vars, global defaults, `i18n` strings (`config/locales/*.json`) |
15
+ | `./theme` | Visitor themes: SSR data fetch, runtime, extension config types; re-exports `./ui` |
16
16
  | `./theme/next-config` | `createReactPressNextConfig()` |
17
- | `./theme/node` | Node 专用(如读取主题管理端 locale 文件) |
18
- | `./ui` | 无样式主题组件与 hooks |
19
- | `./plugin` | 管理端插件聚合入口 |
20
- | `./plugin/admin` | 菜单注册、权限常量 |
21
- | `./plugin/client` | Web/Electron API 客户端工厂(推荐) |
22
- | `./plugin/react` | 与 `./plugin/client` 相同(兼容旧路径) |
23
- | `./plugin/dev` | Vite 开发端口重定向等 |
17
+ | `./theme/node` | Node-only helpers (e.g. read theme admin locale files) |
18
+ | `./ui` | Unstyled theme components and hooks |
19
+ | `./plugin` | Admin plugin aggregate entry |
20
+ | `./plugin/admin` | Menu registration, permission constants |
21
+ | `./plugin/client` | Web/Electron API client factory (recommended) |
22
+ | `./plugin/react` | Same as `./plugin/client` (legacy path) |
23
+ | `./plugin/dev` | Vite dev port redirect, etc. |
24
24
 
25
- **约定:** `src/` 下仅保留与上述导出对应的一级目录;实现细节放在子目录中,根目录用薄 shim 保持对外路径稳定(例如 `theme/node.ts` → `theme/build/node.ts`)。
25
+ **Convention:** Only top-level directories under `src/` match the exports above; implementation details live in subdirectories with thin shims at the root (e.g. `theme/node.ts` → `theme/build/node.ts`).
26
26
 
27
- ## 源码结构
27
+ ## Source layout
28
28
 
29
29
  ```
30
30
  src/
31
- ├── api/ # OpenAPI 生成(勿手改业务逻辑)
32
- ├── config/ # env、global、i18n + locales/
33
- ├── types/ # Swagger 生成类型
34
- ├── utils/ # 纯函数工具(theme/plugin 共用)
31
+ ├── api/ # OpenAPI generated (do not hand-edit business logic)
32
+ ├── config/ # env, global, i18n + locales/
33
+ ├── types/ # Swagger generated types
34
+ ├── utils/ # Pure utilities (shared by theme/plugin)
35
35
  │ ├── api-envelope.ts # unpackList / unpackOne / unpackPaginated
36
36
  │ ├── cookie.ts # readRequestCookie
37
- │ ├── date.ts # formatDate、formatPublishDate*
38
- │ ├── email.ts # 评论邮箱校验
39
- │ ├── error.ts # ApiError、isApiError
37
+ │ ├── date.ts # formatDate, formatPublishDate*
38
+ │ ├── email.ts # Comment email validation
39
+ │ ├── error.ts # ApiError, isApiError
40
40
  │ ├── json.ts # safeJsonParse
41
- │ ├── jsonp.ts # 浏览器 JSONP
42
- │ ├── object.ts # deepMerge、getByPath、deepClone
41
+ │ ├── jsonp.ts # Browser JSONP
42
+ │ ├── object.ts # deepMerge, getByPath, deepClone
43
43
  │ ├── setting.ts # pickSiteSettings
44
- │ └── string.ts # stripHtml、truncateWords
44
+ │ └── string.ts # stripHtml, truncateWords
45
45
  ├── plugin/
46
- │ ├── admin/ # AdminModule、菜单注册、权限
47
- │ ├── client/ # createClient、resolveApiBaseUrl
48
- │ ├── dev/ # devPortRedirectPlugin 等
49
- │ └── react/ # 仅 re-export client(兼容)
46
+ │ ├── admin/ # AdminModule, menu registration, permissions
47
+ │ ├── client/ # createClient, resolveApiBaseUrl
48
+ │ ├── dev/ # devPortRedirectPlugin, etc.
49
+ │ └── react/ # Re-export client only (compat)
50
50
  ├── theme/
51
- │ ├── api/ # themeApi、axios 封装(JSON/解包 re-export utils)
52
- │ ├── ssr/ # fetch、static props、站点 meta
53
- │ ├── visitor/ # 语言、会话、配色、运行时 mods
54
- │ ├── content/ # SEO、导航路径、摘要、静态资源 URL
55
- │ ├── preview/ # 预览 token / mods / config 查询参数
56
- │ ├── createCatalogApp.js # 完整主题 _app 工厂(无 UI 框架依赖)
57
- │ ├── createApp.js # Next `_app` 工厂(allowJs,随 tsc 输出到 dist)
58
- │ ├── extension/ # theme.json schema、站点配置、与服务端共享的类型
51
+ │ ├── api/ # themeApi, axios wrapper
52
+ │ ├── ssr/ # fetch, static props, site meta
53
+ │ ├── visitor/ # Language, session, colors, runtime mods
54
+ │ ├── content/ # SEO, nav paths, excerpts, static asset URLs
55
+ │ ├── preview/ # Preview token / mods / config query params
56
+ │ ├── createCatalogApp.js # Full theme _app factory (no UI framework)
57
+ │ ├── createApp.js # Next `_app` factory (allowJs, emitted to dist)
58
+ │ ├── extension/ # theme.json schema, site config, shared server types
59
59
  │ ├── node.ts # → build/node
60
60
  │ ├── next-config.ts
61
- │ └── index.ts # 对外 barrel
61
+ │ └── index.ts # Public barrel
62
62
  └── ui/
63
- ├── components/ # 无样式 React 组件
64
- ├── context/ # ReactPressProvider、locale、runtime
65
- └── hooks/ # 通用 React hooks(与具体页面无关)
63
+ ├── components/ # Unstyled React components
64
+ ├── context/ # ReactPressProvider, locale, runtime
65
+ └── hooks/ # Generic React hooks
66
66
  ```
67
67
 
68
- ## 安装
68
+ ## Install
69
69
 
70
70
  ```bash
71
71
  pnpm add @fecommunity/reactpress-toolkit
72
72
  ```
73
73
 
74
- ## 快速开始
74
+ ## Quick start
75
75
 
76
- ### API 客户端
76
+ ### API client
77
77
 
78
78
  ```typescript
79
79
  import { api } from '@fecommunity/reactpress-toolkit';
80
- // 或
80
+ // or
81
81
  import { api, createApiInstance } from '@fecommunity/reactpress-toolkit/api/instance';
82
82
 
83
83
  const articles = await api.article.findAll();
84
84
  ```
85
85
 
86
- 自定义 baseURL:
86
+ Custom baseURL:
87
87
 
88
88
  ```typescript
89
89
  import { createApiInstance } from '@fecommunity/reactpress-toolkit/api/instance';
@@ -91,9 +91,9 @@ import { createApiInstance } from '@fecommunity/reactpress-toolkit/api/instance'
91
91
  const customApi = createApiInstance({ baseURL: 'https://api.example.com/api' });
92
92
  ```
93
93
 
94
- ### 通用工具(`./utils`)
94
+ ### Utilities (`./utils`)
95
95
 
96
- 与 Next/主题无关的逻辑应放在 `utils`,`theme` 仅 re-export 以保持 `@fecommunity/reactpress-toolkit/theme` 路径兼容:
96
+ Framework-agnostic logic belongs in `utils`; `theme` re-exports for `@fecommunity/reactpress-toolkit/theme` compatibility:
97
97
 
98
98
  ```typescript
99
99
  import {
@@ -107,49 +107,49 @@ import {
107
107
  } from '@fecommunity/reactpress-toolkit/utils';
108
108
  ```
109
109
 
110
- | 模块 | 典型用途 |
110
+ | Module | Typical use |
111
111
  |------|----------|
112
- | `json` | 解析 setting 里的 JSON 字符串 |
113
- | `api-envelope` | 解包 Nest `TransformInterceptor` 的 `{ data }` |
114
- | `date` | 文章发布日期展示 |
115
- | `string` | 归档摘要 HTML 剥离、截断 |
116
- | `object` | theme.json 配置合并、点路径读写 |
117
- | `setting` | 把 settings 行映射为 props |
118
- | `cookie` | SSR 读取 `Cookie` 头 |
119
- | `email` | 访客评论邮箱格式 |
112
+ | `json` | Parse JSON strings in settings |
113
+ | `api-envelope` | Unwrap Nest `TransformInterceptor` `{ data }` |
114
+ | `date` | Article publish date display |
115
+ | `string` | Strip HTML for archive excerpts, truncate |
116
+ | `object` | Merge theme.json config, dot-path read/write |
117
+ | `setting` | Map settings rows to props |
118
+ | `cookie` | Read `Cookie` header in SSR |
119
+ | `email` | Visitor comment email format |
120
120
 
121
- ### 管理后台插件
121
+ ### Admin plugins
122
122
 
123
123
  ```typescript
124
124
  import type { AdminModule } from '@fecommunity/reactpress-toolkit/plugin/admin';
125
125
  import { permissionsForRole } from '@fecommunity/reactpress-toolkit/plugin/admin';
126
126
  ```
127
127
 
128
- ### Web / Electron 客户端
128
+ ### Web / Electron client
129
129
 
130
130
  ```typescript
131
131
  import { createClient, resolveApiBaseUrl } from '@fecommunity/reactpress-toolkit/plugin/client';
132
132
  ```
133
133
 
134
- ## App 工厂(`./app`)
134
+ ## App factories (`./app`)
135
135
 
136
- 主题 `_app.tsx` 的入口工厂,与 UI 框架无关:
136
+ Entry factories for theme `_app.tsx`, UI-framework agnostic:
137
137
 
138
- | 工厂 | 用途 |
138
+ | Factory | Purpose |
139
139
  |------|------|
140
- | `createThemeApp` | 极简主题(hello-world):`ReactPressProvider` + `ThemeCssVars` |
141
- | `createReactPressApp` | 完整主题:SSR catalog、i18n、统计、PV;通过 `wrapContent` 注入 Ant Design 等 |
140
+ | `createThemeApp` | Minimal theme (hello-world): `ReactPressProvider` + `ThemeCssVars` |
141
+ | `createReactPressApp` | Full theme: SSR catalog, i18n, analytics, PV; inject Ant Design etc. via `wrapContent` |
142
142
 
143
143
  ```typescript
144
144
  import { createThemeApp } from '@fecommunity/reactpress-toolkit/app';
145
145
  import { createReactPressApp } from '@fecommunity/reactpress-toolkit/app';
146
146
  ```
147
147
 
148
- 也可从 `./theme` re-export 导入(兼容旧路径)。
148
+ Also re-exported from `./theme` (legacy paths).
149
149
 
150
- ## 主题开发(`./theme`)
150
+ ## Theme development (`./theme`)
151
151
 
152
- Next.js 访客主题应使用 toolkit 提供的 API 与 SSR 辅助,避免在每个主题里复制 `lib/api.ts`。
152
+ Next.js visitor themes should use toolkit API and SSR helpers instead of copying `lib/api.ts` per theme.
153
153
 
154
154
  ```typescript
155
155
  import {
@@ -175,7 +175,7 @@ import themeManifest from '../theme.json';
175
175
  export default createThemeApp(themeManifest);
176
176
  ```
177
177
 
178
- **完整功能主题** — 使用 `createReactPressApp`(UI 框架无关),Ant Design 等重型依赖留在主题内:
178
+ **Full-featured themes** — use `createReactPressApp` (UI-framework agnostic); keep Ant Design and heavy deps in the theme:
179
179
 
180
180
  ```typescript
181
181
  import { createReactPressApp } from '@fecommunity/reactpress-toolkit/app';
@@ -193,9 +193,9 @@ export default createReactPressApp(themeManifest, {
193
193
  });
194
194
  ```
195
195
 
196
- `createReactPressApp` 内置:SSR 站点数据、预览 mods、SiteCatalogProvider、路由进度条、统计脚本、PV 上报。**不含** Ant Design / cssinjs。
196
+ `createReactPressApp` includes: SSR site data, preview mods, SiteCatalogProvider, route progress, analytics scripts, PV reporting. **Does not** include Ant Design / cssinjs.
197
197
 
198
- **REST Provider** — 无需在每个主题复制 14 个 Provider 文件:
198
+ **REST providers** — avoid copying 14 provider files per theme:
199
199
 
200
200
  ```typescript
201
201
  import { createThemeAxiosClient, createThemeProviders } from '@fecommunity/reactpress-toolkit/theme';
@@ -204,68 +204,68 @@ export const httpProvider = createThemeAxiosClient({ onError, onUnauthorized });
204
204
  export const { ArticleProvider, CategoryProvider, TagProvider } = createThemeProviders(httpProvider);
205
205
  ```
206
206
 
207
- 环境变量:`REACTPRESS_API_URL`(SSR)、`NEXT_PUBLIC_REACTPRESS_API_URL`(浏览器),由 `reactpress theme dev` 注入。
207
+ Env: `REACTPRESS_API_URL` (SSR), `NEXT_PUBLIC_REACTPRESS_API_URL` (browser), injected by `reactpress theme dev`.
208
208
 
209
- ### 无样式 UI(`./ui`)
209
+ ### Headless UI (`./ui`)
210
210
 
211
- 也可从 `./theme` 一并导入:
211
+ Also importable from `./theme`:
212
212
 
213
213
  ```typescript
214
214
  import { NavMenu, ArticleList, ReactPressProvider, useLocale } from '@fecommunity/reactpress-toolkit/ui';
215
215
  ```
216
216
 
217
- | 符号 | 说明 |
217
+ | Symbol | Description |
218
218
  |------|------|
219
- | `ReactPressProvider` | 在 `_app` 注入站点上下文 |
220
- | `useLocale` / `useThemeRuntime` / `useThemeMod` | 语言与主题 mods |
221
- | `useToggle` / `useAsyncLoading` | 布尔切换、防抖 loading(评论/搜索等) |
222
- | `usePagination` | `[items, total]` 分页列表 |
223
- | `useReportArticleView` / `useReportPageView` | 文章阅读数、全站 PV 上报 |
224
- | `useRouteParam` / `useNavActive` | 动态路由参数、导航高亮 |
225
- | `useWarningOnExit` | 离开页面前确认(Next Router) |
226
- | `NavMenu` | 配置驱动导航,通过 `renderLink` 接 Next `Link` |
227
- | `ArticleList` | 列表渲染,通过 `renderArticle` 自定义卡片 |
228
- | `SiteCatalogProvider` / `useSiteSetting` / `useSiteUser` | 全站 catalog + 用户会话 |
229
- | `SiteSeo` / `RouteProgress` / `SiteAnalytics` | SEO meta、路由进度条、GA/百度统计 |
230
- | `ArticleReader` / `HtmlContent` / `ArticleToc` | 文章阅读、HTML 渲染、目录 |
231
- | `ImageViewer` / `LocaleTime` | 图片预览、本地化时间 |
232
- | `createReactPressApp` | 完整主题 `_app` 工厂(`@fecommunity/reactpress-toolkit/app`) |
233
- | `fetchAppBootstrap` | `_app.getInitialProps` SSR 数据(setting / taxonomy / preview) |
234
-
235
- ### 扩展配置类型
236
-
237
- `theme/extension` 中的类型与校验逻辑与 **server**、**web 外观设置** 共用,例如 `ThemeConfigurationSchema`、`resolveSiteConfig`、`PUBLIC_SETTING_KEYS`。服务端可:
219
+ | `ReactPressProvider` | Inject site context in `_app` |
220
+ | `useLocale` / `useThemeRuntime` / `useThemeMod` | Language and theme mods |
221
+ | `useToggle` / `useAsyncLoading` | Boolean toggle, debounced loading |
222
+ | `usePagination` | `[items, total]` paginated lists |
223
+ | `useReportArticleView` / `useReportPageView` | Article views, site PV |
224
+ | `useRouteParam` / `useNavActive` | Dynamic route params, nav highlight |
225
+ | `useWarningOnExit` | Confirm before leaving page (Next Router) |
226
+ | `NavMenu` | Config-driven nav via `renderLink` + Next `Link` |
227
+ | `ArticleList` | List renderer via `renderArticle` |
228
+ | `SiteCatalogProvider` / `useSiteSetting` / `useSiteUser` | Site catalog + user session |
229
+ | `SiteSeo` / `RouteProgress` / `SiteAnalytics` | SEO meta, progress bar, GA/Baidu |
230
+ | `ArticleReader` / `HtmlContent` / `ArticleToc` | Article reading, HTML, TOC |
231
+ | `ImageViewer` / `LocaleTime` | Image preview, localized time |
232
+ | `createReactPressApp` | Full theme `_app` factory |
233
+ | `fetchAppBootstrap` | `_app.getInitialProps` SSR data |
234
+
235
+ ### Extension config types
236
+
237
+ Types and validation in `theme/extension` are shared with **server** and **web appearance settings**, e.g. `ThemeConfigurationSchema`, `resolveSiteConfig`, `PUBLIC_SETTING_KEYS`. Server example:
238
238
 
239
239
  ```typescript
240
240
  import { PUBLIC_SETTING_KEYS, systemGlobalSettingDefaults } from '@fecommunity/reactpress-toolkit/theme';
241
241
  import { readThemeAdminLocaleFile } from '@fecommunity/reactpress-toolkit/theme/node';
242
242
  ```
243
243
 
244
- ## 从 Swagger 重新生成 API
244
+ ## Regenerate API from Swagger
245
245
 
246
- 在 monorepo 根目录确保 server 可构建后:
246
+ From monorepo root, ensure server builds:
247
247
 
248
248
  ```bash
249
249
  cd toolkit && pnpm run generate
250
250
  ```
251
251
 
252
- 将更新 `src/api/*` 与 `src/types/*`。
252
+ Updates `src/api/*` and `src/types/*`.
253
253
 
254
- ## 构建
254
+ ## Build
255
255
 
256
256
  ```bash
257
257
  cd toolkit && pnpm run build
258
258
  ```
259
259
 
260
- 输出到 `dist/`;`createApp.js` 随 `tsc`(`allowJs`)写入 `dist/theme/createApp.js`。
260
+ Output in `dist/`; `createApp.js` is emitted via `tsc` (`allowJs`) to `dist/theme/createApp.js`.
261
261
 
262
- ## 开发脚本
262
+ ## Scripts
263
263
 
264
- | 命令 | 说明 |
264
+ | Command | Description |
265
265
  |------|------|
266
- | `pnpm run generate` | 从 server Swagger 生成 API |
267
- | `pnpm run build` | `tsc` + 复制 locales |
268
- | `pnpm run typecheck` | 仅类型检查 |
266
+ | `pnpm run generate` | Generate API from server Swagger |
267
+ | `pnpm run build` | `tsc` + copy locales |
268
+ | `pnpm run typecheck` | Type check only |
269
269
 
270
270
  ## License
271
271
 
@@ -1,2 +1,4 @@
1
1
  export * from './permissions';
2
+ export * from './plugin-admin';
2
3
  export * from './registry';
4
+ export * from './slots';
@@ -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<void>;
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>;
@@ -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';
@@ -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);
@@ -1,2 +1,3 @@
1
1
  /** Stable export path: `@fecommunity/reactpress-toolkit/plugin/react`. */
2
2
  export * from '../client';
3
+ export * from './plugin-admin-ui';
@@ -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 = typeof window !== 'undefined' ? window.location.origin : origin;
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 = "twentytwentyfive";
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 = 'twentytwentyfive';
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
- /** CMS static page by id. */
56
- export declare function fetchCmsPageProps(api: ThemeApi, id: string): Promise<{
57
- page: unknown;
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, id) {
133
- return { page: (0, api_data_1.unpackOne)(await api.page.findById(id)) };
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) {
@@ -3,6 +3,7 @@ export declare function unwrapSetting(response: unknown): Record<string, unknown
3
3
  export interface SiteMeta {
4
4
  siteName: string;
5
5
  siteDescription: string;
6
+ siteKeywords?: string;
6
7
  siteUrl?: string;
7
8
  siteLogo?: string;
8
9
  siteFavicon?: string;
@@ -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/about.tsx',
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',
@@ -94,6 +94,9 @@ export interface IArticle {
94
94
  title: string;
95
95
  cover: string;
96
96
  summary: string;
97
+ slug?: string | null;
98
+ seoKeywords?: string | null;
99
+ seoDescription?: string | null;
97
100
  content: string;
98
101
  html: string;
99
102
  toc: string;
@@ -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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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>): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | null;
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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element | null;
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): React.JSX.Element;
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): React.JSX.Element | null;
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): React.JSX.Element;
25
+ export declare function TaxonomyList({ items, kind, variant, currentValue, className, itemClassName, hrefFor, renderLink, }: TaxonomyListProps): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
1
  /** Injects Customizer colors, background, dark mode, and extra CSS (WP `theme_mod` → `:root`). */
3
- export declare function ThemeCssVars(): React.JSX.Element;
2
+ export declare function ThemeCssVars(): 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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element | null;
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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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
- }): React.JSX.Element;
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): React.JSX.Element;
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.7.0",
3
+ "version": "4.0.0-beta.1",
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": {