@fecommunity/reactpress-toolkit 3.0.0 → 3.1.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.
Files changed (500) hide show
  1. package/README.md +194 -309
  2. package/dist/admin/index.d.ts +2 -0
  3. package/dist/admin/index.js +18 -0
  4. package/dist/admin/permissions.d.ts +5 -0
  5. package/dist/admin/permissions.js +33 -0
  6. package/dist/admin/registry.d.ts +62 -0
  7. package/dist/admin/registry.js +79 -0
  8. package/dist/api/HttpClient.d.ts +2 -2
  9. package/dist/api/HttpClient.js +1 -1
  10. package/dist/api/Smtp.d.ts +17 -0
  11. package/dist/api/Smtp.js +15 -0
  12. package/dist/api/instance.d.ts +1 -1
  13. package/dist/api/instance.js +3 -3
  14. package/dist/app/createReactPressApp.d.ts +88 -0
  15. package/dist/app/createReactPressApp.js +262 -0
  16. package/dist/app/createThemeApp.d.ts +6 -0
  17. package/dist/app/createThemeApp.js +47 -0
  18. package/dist/app/devChunkRecovery.d.ts +2 -0
  19. package/dist/app/devChunkRecovery.js +68 -0
  20. package/dist/app/index.d.ts +39 -0
  21. package/dist/app/index.js +11 -0
  22. package/dist/config/env.js +29 -15
  23. package/dist/config/global.d.ts +7 -1
  24. package/dist/config/global.js +9 -3
  25. package/dist/config/i18n.js +27 -11
  26. package/dist/config/index.d.ts +3 -3
  27. package/dist/config/index.js +6 -5
  28. package/dist/{locales → config/locales}/en.json +31 -3
  29. package/dist/{locales → config/locales}/zh.json +31 -3
  30. package/dist/dev/index.d.ts +3 -0
  31. package/dist/dev/index.js +12 -0
  32. package/dist/dev/portRedirect.d.ts +20 -0
  33. package/dist/dev/portRedirect.js +93 -0
  34. package/dist/dev/vitePortRedirectPlugin.d.ts +24 -0
  35. package/dist/dev/vitePortRedirectPlugin.js +40 -0
  36. package/dist/extension/branding-mods.d.ts +10 -0
  37. package/dist/extension/branding-mods.js +65 -0
  38. package/dist/extension/configuration/defaults.d.ts +3 -0
  39. package/dist/extension/configuration/defaults.js +32 -0
  40. package/dist/extension/configuration/formily.d.ts +10 -0
  41. package/dist/extension/configuration/formily.js +170 -0
  42. package/dist/extension/configuration/index.d.ts +7 -0
  43. package/dist/extension/configuration/index.js +28 -0
  44. package/dist/extension/configuration/paths.d.ts +4 -0
  45. package/dist/extension/configuration/paths.js +50 -0
  46. package/dist/extension/configuration/presets/twentytwentyfive.d.ts +7 -0
  47. package/dist/extension/configuration/presets/twentytwentyfive.js +94 -0
  48. package/dist/extension/configuration/resolve.d.ts +24 -0
  49. package/dist/extension/configuration/resolve.js +98 -0
  50. package/dist/extension/configuration/types.d.ts +68 -0
  51. package/dist/extension/configuration/types.js +3 -0
  52. package/dist/extension/configuration/validate.d.ts +8 -0
  53. package/dist/extension/configuration/validate.js +21 -0
  54. package/dist/extension/index.d.ts +9 -0
  55. package/dist/extension/index.js +35 -0
  56. package/dist/extension/manifest-normalize.d.ts +5 -0
  57. package/dist/extension/manifest-normalize.js +75 -0
  58. package/dist/extension/node.d.ts +2 -0
  59. package/dist/extension/node.js +6 -0
  60. package/dist/extension/presets/twentytwentyfive-appearance.d.ts +10 -0
  61. package/dist/extension/presets/twentytwentyfive-appearance.js +193 -0
  62. package/dist/extension/presets/twentytwentyfive-customizer.d.ts +19 -0
  63. package/dist/extension/presets/twentytwentyfive-customizer.js +199 -0
  64. package/dist/extension/preview.d.ts +46 -0
  65. package/dist/extension/preview.js +92 -0
  66. package/dist/extension/site-notices.d.ts +19 -0
  67. package/dist/extension/site-notices.js +88 -0
  68. package/dist/extension/site-settings.d.ts +37 -0
  69. package/dist/extension/site-settings.js +144 -0
  70. package/dist/extension/theme-admin-locale.d.ts +11 -0
  71. package/dist/extension/theme-admin-locale.io.d.ts +2 -0
  72. package/dist/extension/theme-admin-locale.io.js +54 -0
  73. package/dist/extension/theme-admin-locale.js +81 -0
  74. package/dist/extension/theme.d.ts +89 -0
  75. package/dist/extension/theme.js +93 -0
  76. package/dist/extension/twentytwentyfive-vars.d.ts +7 -0
  77. package/dist/extension/twentytwentyfive-vars.js +100 -0
  78. package/dist/index.d.ts +15 -7
  79. package/dist/index.js +44 -22
  80. package/dist/plugin/admin/index.d.ts +2 -0
  81. package/dist/plugin/admin/index.js +18 -0
  82. package/dist/plugin/admin/permissions.d.ts +5 -0
  83. package/dist/plugin/admin/permissions.js +33 -0
  84. package/dist/plugin/admin/registry.d.ts +62 -0
  85. package/dist/plugin/admin/registry.js +79 -0
  86. package/dist/plugin/client/client.d.ts +14 -0
  87. package/dist/plugin/client/client.js +95 -0
  88. package/dist/plugin/client/index.d.ts +4 -0
  89. package/dist/plugin/client/index.js +11 -0
  90. package/dist/plugin/client/runtime.d.ts +18 -0
  91. package/dist/plugin/client/runtime.js +30 -0
  92. package/dist/plugin/dev/index.d.ts +4 -0
  93. package/dist/plugin/dev/index.js +16 -0
  94. package/dist/plugin/dev/portRedirect.d.ts +26 -0
  95. package/dist/plugin/dev/portRedirect.js +111 -0
  96. package/dist/plugin/dev/vitePortRedirectPlugin.d.ts +24 -0
  97. package/dist/plugin/dev/vitePortRedirectPlugin.js +40 -0
  98. package/dist/plugin/index.d.ts +9 -0
  99. package/dist/plugin/index.js +48 -0
  100. package/dist/plugin/react/client.d.ts +14 -0
  101. package/dist/plugin/react/client.js +95 -0
  102. package/dist/plugin/react/index.d.ts +2 -0
  103. package/dist/plugin/react/index.js +18 -0
  104. package/dist/plugin/react/runtime.d.ts +18 -0
  105. package/dist/plugin/react/runtime.js +30 -0
  106. package/dist/primitives/AntdStyleTransitionFix.d.ts +2 -0
  107. package/dist/primitives/AntdStyleTransitionFix.js +16 -0
  108. package/dist/primitives/Badge.d.ts +7 -0
  109. package/dist/primitives/Badge.js +9 -0
  110. package/dist/primitives/Button.d.ts +10 -0
  111. package/dist/primitives/Button.js +38 -0
  112. package/dist/primitives/ColorModeToggle.d.ts +8 -0
  113. package/dist/primitives/ColorModeToggle.js +13 -0
  114. package/dist/primitives/IconButton.d.ts +7 -0
  115. package/dist/primitives/IconButton.js +13 -0
  116. package/dist/primitives/ScrollToTarget.d.ts +9 -0
  117. package/dist/primitives/ScrollToTarget.js +48 -0
  118. package/dist/primitives/Separator.d.ts +7 -0
  119. package/dist/primitives/Separator.js +9 -0
  120. package/dist/primitives/Skeleton.d.ts +7 -0
  121. package/dist/primitives/Skeleton.js +9 -0
  122. package/dist/primitives/Slot.d.ts +10 -0
  123. package/dist/primitives/Slot.js +25 -0
  124. package/dist/primitives/Spinner.d.ts +6 -0
  125. package/dist/primitives/Spinner.js +9 -0
  126. package/dist/primitives/animation/ConditionTransition.d.ts +8 -0
  127. package/dist/primitives/animation/ConditionTransition.js +13 -0
  128. package/dist/primitives/animation/ListTrail.d.ts +10 -0
  129. package/dist/primitives/animation/ListTrail.js +14 -0
  130. package/dist/primitives/animation/Opacity.d.ts +3 -0
  131. package/dist/primitives/animation/Opacity.js +10 -0
  132. package/dist/primitives/animation/Spring.d.ts +9 -0
  133. package/dist/primitives/animation/Spring.js +29 -0
  134. package/dist/primitives/animation/index.d.ts +7 -0
  135. package/dist/primitives/animation/index.js +11 -0
  136. package/dist/primitives/cn.d.ts +4 -0
  137. package/dist/primitives/cn.js +7 -0
  138. package/dist/primitives/icons.d.ts +4 -0
  139. package/dist/primitives/icons.js +15 -0
  140. package/dist/primitives/index.d.ts +22 -0
  141. package/dist/primitives/index.js +44 -0
  142. package/dist/react/client.d.ts +14 -0
  143. package/dist/react/client.js +95 -0
  144. package/dist/react/index.d.ts +4 -0
  145. package/dist/react/index.js +11 -0
  146. package/dist/react/runtime.d.ts +18 -0
  147. package/dist/react/runtime.js +30 -0
  148. package/dist/theme/antdDocument.d.ts +18 -0
  149. package/dist/theme/antdDocument.js +59 -0
  150. package/dist/theme/api/api-data.d.ts +2 -0
  151. package/dist/theme/api/api-data.js +8 -0
  152. package/dist/theme/api/api.d.ts +28 -0
  153. package/dist/theme/api/api.js +27 -0
  154. package/dist/theme/api/httpClient.d.ts +24 -0
  155. package/dist/theme/api/httpClient.js +83 -0
  156. package/dist/theme/api/json.d.ts +1 -0
  157. package/dist/theme/api/json.js +5 -0
  158. package/dist/theme/api/jsonp.d.ts +1 -0
  159. package/dist/theme/api/jsonp.js +5 -0
  160. package/dist/theme/api-data.d.ts +12 -0
  161. package/dist/theme/api-data.js +22 -0
  162. package/dist/theme/api.d.ts +28 -0
  163. package/dist/theme/api.js +27 -0
  164. package/dist/theme/appearance.d.ts +4 -0
  165. package/dist/theme/appearance.js +16 -0
  166. package/dist/theme/assets.d.ts +2 -0
  167. package/dist/theme/assets.js +27 -0
  168. package/dist/theme/authSession.d.ts +16 -0
  169. package/dist/theme/authSession.js +92 -0
  170. package/dist/theme/build/antdDocument.d.ts +145 -0
  171. package/dist/theme/build/antdDocument.js +70 -0
  172. package/dist/theme/build/next-config.d.ts +17 -0
  173. package/dist/theme/build/next-config.js +100 -0
  174. package/dist/theme/build/node.d.ts +2 -0
  175. package/dist/theme/build/node.js +6 -0
  176. package/dist/theme/colorMode.d.ts +12 -0
  177. package/dist/theme/colorMode.js +45 -0
  178. package/dist/theme/commentAuthor.d.ts +17 -0
  179. package/dist/theme/commentAuthor.js +48 -0
  180. package/dist/theme/content/archiveSlim.d.ts +7 -0
  181. package/dist/theme/content/archiveSlim.js +38 -0
  182. package/dist/theme/content/articleSlim.d.ts +10 -0
  183. package/dist/theme/content/articleSlim.js +35 -0
  184. package/dist/theme/content/assets.d.ts +8 -0
  185. package/dist/theme/content/assets.js +74 -0
  186. package/dist/theme/content/carouselArticles.d.ts +10 -0
  187. package/dist/theme/content/carouselArticles.js +39 -0
  188. package/dist/theme/content/excerpt.d.ts +15 -0
  189. package/dist/theme/content/excerpt.js +42 -0
  190. package/dist/theme/content/nav.d.ts +10 -0
  191. package/dist/theme/content/nav.js +30 -0
  192. package/dist/theme/content/seo.d.ts +6 -0
  193. package/dist/theme/content/seo.js +12 -0
  194. package/dist/theme/createAntdApp.d.ts +106 -0
  195. package/dist/theme/createAntdApp.js +175 -0
  196. package/dist/theme/createApp.d.ts +10 -0
  197. package/dist/theme/createApp.js +141 -0
  198. package/dist/theme/createCatalogApp.d.ts +108 -0
  199. package/dist/theme/createCatalogApp.js +168 -0
  200. package/dist/theme/customizer.d.ts +1 -0
  201. package/dist/theme/customizer.js +5 -0
  202. package/dist/theme/excerpt.d.ts +16 -0
  203. package/dist/theme/excerpt.js +31 -0
  204. package/dist/theme/extension/branding-mods.d.ts +10 -0
  205. package/dist/theme/extension/branding-mods.js +65 -0
  206. package/dist/theme/extension/configuration/defaults.d.ts +3 -0
  207. package/dist/theme/extension/configuration/defaults.js +32 -0
  208. package/dist/theme/extension/configuration/formily.d.ts +10 -0
  209. package/dist/theme/extension/configuration/formily.js +170 -0
  210. package/dist/theme/extension/configuration/index.d.ts +7 -0
  211. package/dist/theme/extension/configuration/index.js +28 -0
  212. package/dist/theme/extension/configuration/paths.d.ts +1 -0
  213. package/dist/theme/extension/configuration/paths.js +7 -0
  214. package/dist/theme/extension/configuration/presets/twentytwentyfive.d.ts +7 -0
  215. package/dist/theme/extension/configuration/presets/twentytwentyfive.js +94 -0
  216. package/dist/theme/extension/configuration/resolve.d.ts +24 -0
  217. package/dist/theme/extension/configuration/resolve.js +98 -0
  218. package/dist/theme/extension/configuration/types.d.ts +68 -0
  219. package/dist/theme/extension/configuration/types.js +3 -0
  220. package/dist/theme/extension/configuration/validate.d.ts +8 -0
  221. package/dist/theme/extension/configuration/validate.js +21 -0
  222. package/dist/theme/extension/index.d.ts +11 -0
  223. package/dist/theme/extension/index.js +38 -0
  224. package/dist/theme/extension/manifest-normalize.d.ts +5 -0
  225. package/dist/theme/extension/manifest-normalize.js +75 -0
  226. package/dist/theme/extension/presets/twentytwentyfive-appearance.d.ts +10 -0
  227. package/dist/theme/extension/presets/twentytwentyfive-appearance.js +193 -0
  228. package/dist/theme/extension/preview.d.ts +46 -0
  229. package/dist/theme/extension/preview.js +92 -0
  230. package/dist/theme/extension/site-notices.d.ts +19 -0
  231. package/dist/theme/extension/site-notices.js +88 -0
  232. package/dist/theme/extension/site-settings.d.ts +37 -0
  233. package/dist/theme/extension/site-settings.js +144 -0
  234. package/dist/theme/extension/siteNav.d.ts +18 -0
  235. package/dist/theme/extension/siteNav.js +17 -0
  236. package/dist/theme/extension/theme-admin-locale.d.ts +11 -0
  237. package/dist/theme/extension/theme-admin-locale.io.d.ts +2 -0
  238. package/dist/theme/extension/theme-admin-locale.io.js +54 -0
  239. package/dist/theme/extension/theme-admin-locale.js +68 -0
  240. package/dist/theme/extension/theme.d.ts +89 -0
  241. package/dist/theme/extension/theme.js +93 -0
  242. package/dist/theme/extension/twentytwentyfive-vars.d.ts +9 -0
  243. package/dist/theme/extension/twentytwentyfive-vars.js +103 -0
  244. package/dist/theme/fetch.d.ts +134 -0
  245. package/dist/theme/fetch.js +241 -0
  246. package/dist/theme/format.d.ts +16 -0
  247. package/dist/theme/format.js +48 -0
  248. package/dist/theme/httpClient.d.ts +20 -0
  249. package/dist/theme/httpClient.js +89 -0
  250. package/dist/theme/index.d.ts +63 -0
  251. package/dist/theme/index.js +226 -0
  252. package/dist/theme/json.d.ts +1 -0
  253. package/dist/theme/json.js +17 -0
  254. package/dist/theme/jsonp.d.ts +8 -0
  255. package/dist/theme/jsonp.js +27 -0
  256. package/dist/theme/locale.d.ts +23 -0
  257. package/dist/theme/locale.js +55 -0
  258. package/dist/theme/nav.d.ts +10 -0
  259. package/dist/theme/nav.js +30 -0
  260. package/dist/theme/next-config.d.ts +2 -0
  261. package/dist/theme/next-config.js +18 -0
  262. package/dist/theme/node.d.ts +2 -0
  263. package/dist/theme/node.js +18 -0
  264. package/dist/theme/preview/preview-config.d.ts +13 -0
  265. package/dist/theme/preview/preview-config.js +65 -0
  266. package/dist/theme/preview/preview-draft.d.ts +19 -0
  267. package/dist/theme/preview/preview-draft.js +51 -0
  268. package/dist/theme/preview/preview-mods.d.ts +16 -0
  269. package/dist/theme/preview/preview-mods.js +78 -0
  270. package/dist/theme/preview-config.d.ts +13 -0
  271. package/dist/theme/preview-config.js +65 -0
  272. package/dist/theme/preview-draft.d.ts +19 -0
  273. package/dist/theme/preview-draft.js +51 -0
  274. package/dist/theme/preview-mods.d.ts +16 -0
  275. package/dist/theme/preview-mods.js +78 -0
  276. package/dist/theme/providers/index.d.ts +118 -0
  277. package/dist/theme/providers/index.js +251 -0
  278. package/dist/theme/providers/setup.d.ts +124 -0
  279. package/dist/theme/providers/setup.js +29 -0
  280. package/dist/theme/runtime.d.ts +18 -0
  281. package/dist/theme/runtime.js +19 -0
  282. package/dist/theme/seo.d.ts +6 -0
  283. package/dist/theme/seo.js +12 -0
  284. package/dist/theme/server.d.ts +65 -0
  285. package/dist/theme/server.js +177 -0
  286. package/dist/theme/setting.d.ts +12 -0
  287. package/dist/theme/setting.js +42 -0
  288. package/dist/theme/ssr/bootstrap.d.ts +48 -0
  289. package/dist/theme/ssr/bootstrap.js +112 -0
  290. package/dist/theme/ssr/fetch.d.ts +134 -0
  291. package/dist/theme/ssr/fetch.js +264 -0
  292. package/dist/theme/ssr/format.d.ts +3 -0
  293. package/dist/theme/ssr/format.js +8 -0
  294. package/dist/theme/ssr/pageProps.d.ts +62 -0
  295. package/dist/theme/ssr/pageProps.js +138 -0
  296. package/dist/theme/ssr/setting.d.ts +12 -0
  297. package/dist/theme/ssr/setting.js +42 -0
  298. package/dist/theme/ssr/slimBootstrap.d.ts +11 -0
  299. package/dist/theme/ssr/slimBootstrap.js +75 -0
  300. package/dist/theme/ssr/static.d.ts +10 -0
  301. package/dist/theme/ssr/static.js +17 -0
  302. package/dist/theme/ssr/templates.d.ts +35 -0
  303. package/dist/theme/ssr/templates.js +50 -0
  304. package/dist/theme/static.d.ts +10 -0
  305. package/dist/theme/static.js +17 -0
  306. package/dist/theme/templates.d.ts +27 -0
  307. package/dist/theme/templates.js +38 -0
  308. package/dist/theme/ui-optional.d.ts +1 -0
  309. package/dist/theme/ui-optional.js +21 -0
  310. package/dist/theme/visitor/appearance.d.ts +4 -0
  311. package/dist/theme/visitor/appearance.js +16 -0
  312. package/dist/theme/visitor/authSession.d.ts +16 -0
  313. package/dist/theme/visitor/authSession.js +92 -0
  314. package/dist/theme/visitor/colorMode.d.ts +17 -0
  315. package/dist/theme/visitor/colorMode.js +59 -0
  316. package/dist/theme/visitor/commentAuthor.d.ts +16 -0
  317. package/dist/theme/visitor/commentAuthor.js +45 -0
  318. package/dist/theme/visitor/i18n.d.ts +4 -0
  319. package/dist/theme/visitor/i18n.js +28 -0
  320. package/dist/theme/visitor/locale.d.ts +23 -0
  321. package/dist/theme/visitor/locale.js +72 -0
  322. package/dist/theme/visitor/runtime.d.ts +18 -0
  323. package/dist/theme/visitor/runtime.js +19 -0
  324. package/dist/theme/visitor/visitorLocale.d.ts +11 -0
  325. package/dist/theme/visitor/visitorLocale.js +56 -0
  326. package/dist/theme/visitorLocale.d.ts +6 -0
  327. package/dist/theme/visitorLocale.js +39 -0
  328. package/dist/types/index.d.ts +79 -68
  329. package/dist/ui/AntdStyleTransitionFix.d.ts +5 -0
  330. package/dist/ui/AntdStyleTransitionFix.js +16 -0
  331. package/dist/ui/ArchiveEmptyState.d.ts +13 -0
  332. package/dist/ui/ArchiveEmptyState.js +8 -0
  333. package/dist/ui/ArchivePageLayout.d.ts +10 -0
  334. package/dist/ui/ArchivePageLayout.js +8 -0
  335. package/dist/ui/ArticleCard.d.ts +27 -0
  336. package/dist/ui/ArticleCard.js +16 -0
  337. package/dist/ui/ArticleList.d.ts +14 -0
  338. package/dist/ui/ArticleList.js +16 -0
  339. package/dist/ui/BaseGlobalStyles.d.ts +5 -0
  340. package/dist/ui/BaseGlobalStyles.js +18 -0
  341. package/dist/ui/LocaleSwitcher.d.ts +7 -0
  342. package/dist/ui/LocaleSwitcher.js +15 -0
  343. package/dist/ui/NavMenu.d.ts +16 -0
  344. package/dist/ui/NavMenu.js +8 -0
  345. package/dist/ui/NotFoundPanel.d.ts +11 -0
  346. package/dist/ui/NotFoundPanel.js +8 -0
  347. package/dist/ui/PageHeader.d.ts +10 -0
  348. package/dist/ui/PageHeader.js +8 -0
  349. package/dist/ui/SiteBranding.d.ts +10 -0
  350. package/dist/ui/SiteBranding.js +14 -0
  351. package/dist/ui/SiteDocument.d.ts +20 -0
  352. package/dist/ui/SiteDocument.js +13 -0
  353. package/dist/ui/SiteDocumentFallback.d.ts +8 -0
  354. package/dist/ui/SiteDocumentFallback.js +9 -0
  355. package/dist/ui/SiteLogo.d.ts +6 -0
  356. package/dist/ui/SiteLogo.js +16 -0
  357. package/dist/ui/SiteTagline.d.ts +7 -0
  358. package/dist/ui/SiteTagline.js +15 -0
  359. package/dist/ui/TaxonomyList.d.ts +25 -0
  360. package/dist/ui/TaxonomyList.js +30 -0
  361. package/dist/ui/ThemeCssVars.d.ts +2 -0
  362. package/dist/ui/ThemeCssVars.js +85 -0
  363. package/dist/ui/ThemeLayout.d.ts +13 -0
  364. package/dist/ui/ThemeLayout.js +11 -0
  365. package/dist/ui/components/AntdStyleTransitionFix.d.ts +5 -0
  366. package/dist/ui/components/AntdStyleTransitionFix.js +16 -0
  367. package/dist/ui/components/ArchiveEmptyState.d.ts +13 -0
  368. package/dist/ui/components/ArchiveEmptyState.js +8 -0
  369. package/dist/ui/components/ArchivePageLayout.d.ts +10 -0
  370. package/dist/ui/components/ArchivePageLayout.js +8 -0
  371. package/dist/ui/components/ArticleCard.d.ts +27 -0
  372. package/dist/ui/components/ArticleCard.js +16 -0
  373. package/dist/ui/components/ArticleList.d.ts +14 -0
  374. package/dist/ui/components/ArticleList.js +16 -0
  375. package/dist/ui/components/BaseGlobalStyles.d.ts +5 -0
  376. package/dist/ui/components/BaseGlobalStyles.js +18 -0
  377. package/dist/ui/components/LocaleSwitcher.d.ts +10 -0
  378. package/dist/ui/components/LocaleSwitcher.js +11 -0
  379. package/dist/ui/components/NavMenu.d.ts +16 -0
  380. package/dist/ui/components/NavMenu.js +8 -0
  381. package/dist/ui/components/NotFoundPanel.d.ts +11 -0
  382. package/dist/ui/components/NotFoundPanel.js +8 -0
  383. package/dist/ui/components/PageHeader.d.ts +10 -0
  384. package/dist/ui/components/PageHeader.js +8 -0
  385. package/dist/ui/components/RouteProgress.d.ts +9 -0
  386. package/dist/ui/components/RouteProgress.js +40 -0
  387. package/dist/ui/components/SiteAnalytics.d.ts +5 -0
  388. package/dist/ui/components/SiteAnalytics.js +42 -0
  389. package/dist/ui/components/SiteBranding.d.ts +10 -0
  390. package/dist/ui/components/SiteBranding.js +14 -0
  391. package/dist/ui/components/SiteDocument.d.ts +20 -0
  392. package/dist/ui/components/SiteDocument.js +13 -0
  393. package/dist/ui/components/SiteDocumentFallback.d.ts +8 -0
  394. package/dist/ui/components/SiteDocumentFallback.js +9 -0
  395. package/dist/ui/components/SiteLogo.d.ts +8 -0
  396. package/dist/ui/components/SiteLogo.js +23 -0
  397. package/dist/ui/components/SiteSeo.d.ts +13 -0
  398. package/dist/ui/components/SiteSeo.js +19 -0
  399. package/dist/ui/components/SiteTagline.d.ts +7 -0
  400. package/dist/ui/components/SiteTagline.js +15 -0
  401. package/dist/ui/components/TaxonomyList.d.ts +25 -0
  402. package/dist/ui/components/TaxonomyList.js +30 -0
  403. package/dist/ui/components/ThemeCssVars.d.ts +2 -0
  404. package/dist/ui/components/ThemeCssVars.js +85 -0
  405. package/dist/ui/components/ThemeLayout.d.ts +13 -0
  406. package/dist/ui/components/ThemeLayout.js +11 -0
  407. package/dist/ui/components/content/ArticleReader.d.ts +45 -0
  408. package/dist/ui/components/content/ArticleReader.js +23 -0
  409. package/dist/ui/components/content/ArticleToc.d.ts +21 -0
  410. package/dist/ui/components/content/ArticleToc.js +75 -0
  411. package/dist/ui/components/content/HtmlContent.d.ts +15 -0
  412. package/dist/ui/components/content/HtmlContent.js +237 -0
  413. package/dist/ui/components/content/Image.d.ts +9 -0
  414. package/dist/ui/components/content/Image.js +13 -0
  415. package/dist/ui/components/content/ImageViewer.d.ts +8 -0
  416. package/dist/ui/components/content/ImageViewer.js +33 -0
  417. package/dist/ui/components/content/LocaleTime.d.ts +9 -0
  418. package/dist/ui/components/content/LocaleTime.js +63 -0
  419. package/dist/ui/components/content/index.d.ts +14 -0
  420. package/dist/ui/components/content/index.js +18 -0
  421. package/dist/ui/components/toolbar/LocaleToggleButton.d.ts +8 -0
  422. package/dist/ui/components/toolbar/LocaleToggleButton.js +18 -0
  423. package/dist/ui/components/toolbar/ThemeToggleButton.d.ts +7 -0
  424. package/dist/ui/components/toolbar/ThemeToggleButton.js +10 -0
  425. package/dist/ui/components/toolbar/ToolbarIconButton.d.ts +7 -0
  426. package/dist/ui/components/toolbar/ToolbarIconButton.js +22 -0
  427. package/dist/ui/components/toolbar/constants.d.ts +5 -0
  428. package/dist/ui/components/toolbar/constants.js +8 -0
  429. package/dist/ui/components/toolbar/icons.d.ts +17 -0
  430. package/dist/ui/components/toolbar/icons.js +44 -0
  431. package/dist/ui/components/toolbar/index.d.ts +9 -0
  432. package/dist/ui/components/toolbar/index.js +25 -0
  433. package/dist/ui/components/toolbar/locale-label.d.ts +3 -0
  434. package/dist/ui/components/toolbar/locale-label.js +19 -0
  435. package/dist/ui/context/LocaleContext.d.ts +15 -0
  436. package/dist/ui/context/LocaleContext.js +59 -0
  437. package/dist/ui/context/ReactPressProvider.d.ts +3 -0
  438. package/dist/ui/context/ReactPressProvider.js +10 -0
  439. package/dist/ui/context/SiteCatalogContext.d.ts +41 -0
  440. package/dist/ui/context/SiteCatalogContext.js +60 -0
  441. package/dist/ui/context/ThemeRuntimeContext.d.ts +21 -0
  442. package/dist/ui/context/ThemeRuntimeContext.js +59 -0
  443. package/dist/ui/context/index.d.ts +8 -0
  444. package/dist/ui/context/index.js +26 -0
  445. package/dist/ui/context/siteCatalogTypes.d.ts +64 -0
  446. package/dist/ui/context/siteCatalogTypes.js +20 -0
  447. package/dist/ui/context/types.d.ts +34 -0
  448. package/dist/ui/context/types.js +2 -0
  449. package/dist/ui/hooks/index.d.ts +12 -0
  450. package/dist/ui/hooks/index.js +29 -0
  451. package/dist/ui/hooks/useAsyncLoading.d.ts +4 -0
  452. package/dist/ui/hooks/useAsyncLoading.js +31 -0
  453. package/dist/ui/hooks/useForceUpdate.d.ts +2 -0
  454. package/dist/ui/hooks/useForceUpdate.js +11 -0
  455. package/dist/ui/hooks/useNavActive.d.ts +5 -0
  456. package/dist/ui/hooks/useNavActive.js +11 -0
  457. package/dist/ui/hooks/usePagination.d.ts +34 -0
  458. package/dist/ui/hooks/usePagination.js +55 -0
  459. package/dist/ui/hooks/useReportArticleView.d.ts +4 -0
  460. package/dist/ui/hooks/useReportArticleView.js +40 -0
  461. package/dist/ui/hooks/useReportPageView.d.ts +11 -0
  462. package/dist/ui/hooks/useReportPageView.js +28 -0
  463. package/dist/ui/hooks/useRouteParam.d.ts +5 -0
  464. package/dist/ui/hooks/useRouteParam.js +15 -0
  465. package/dist/ui/hooks/useToggle.d.ts +2 -0
  466. package/dist/ui/hooks/useToggle.js +17 -0
  467. package/dist/ui/hooks/useWarningOnExit.d.ts +5 -0
  468. package/dist/ui/hooks/useWarningOnExit.js +59 -0
  469. package/dist/ui/index.d.ts +43 -0
  470. package/dist/ui/index.js +87 -0
  471. package/dist/utils/api-envelope.d.ts +14 -0
  472. package/dist/utils/api-envelope.js +31 -0
  473. package/dist/utils/clipboard.d.ts +2 -0
  474. package/dist/utils/clipboard.js +24 -0
  475. package/dist/utils/cookie.d.ts +2 -0
  476. package/dist/utils/cookie.js +15 -0
  477. package/dist/utils/date.d.ts +4 -0
  478. package/dist/utils/date.js +45 -0
  479. package/dist/utils/email.d.ts +3 -0
  480. package/dist/utils/email.js +9 -0
  481. package/dist/utils/error.d.ts +7 -0
  482. package/dist/utils/error.js +26 -0
  483. package/dist/utils/image.d.ts +7 -0
  484. package/dist/utils/image.js +34 -0
  485. package/dist/utils/index.d.ts +15 -33
  486. package/dist/utils/index.js +37 -57
  487. package/dist/utils/json.d.ts +2 -0
  488. package/dist/utils/json.js +18 -0
  489. package/dist/utils/jsonp.d.ts +8 -0
  490. package/dist/utils/jsonp.js +27 -0
  491. package/dist/utils/object.d.ts +7 -0
  492. package/dist/utils/object.js +63 -0
  493. package/dist/utils/setting.d.ts +12 -0
  494. package/dist/utils/setting.js +13 -0
  495. package/dist/utils/string.d.ts +4 -0
  496. package/dist/utils/string.js +15 -0
  497. package/dist/utils/viewport.d.ts +3 -0
  498. package/dist/utils/viewport.js +14 -0
  499. package/package.json +129 -16
  500. package/LICENSE +0 -21
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Full-featured theme `_app` factory (UI-framework agnostic).
3
+ *
4
+ * @param {object} manifest — theme.json manifest
5
+ * @param {object} options
6
+ * @param {React.ComponentType} options.Layout
7
+ * @param {React.ComponentType} options.IntlProvider — from the theme's `next-intl` install
8
+ * @param {(mods: object) => string} [options.buildAppearanceCss]
9
+ * @param {(content: React.ReactNode, runtime: object) => React.ReactNode} [options.wrapContent]
10
+ * @param {object} [options.httpClientOptions]
11
+ * @param {boolean} [options.scrollToTopOnRouteChange=true]
12
+ */
13
+ export function createCatalogThemeApp(manifest: object, options?: {
14
+ Layout: React.ComponentType;
15
+ IntlProvider: React.ComponentType;
16
+ buildAppearanceCss?: ((mods: object) => string) | undefined;
17
+ wrapContent?: ((content: React.ReactNode, runtime: object) => React.ReactNode) | undefined;
18
+ httpClientOptions?: object | undefined;
19
+ scrollToTopOnRouteChange?: boolean | undefined;
20
+ }): {
21
+ new (props: any): {
22
+ state: {
23
+ locale: string;
24
+ user: null;
25
+ theme: import("./visitor/colorMode").ThemeColorMode;
26
+ collapsed: boolean;
27
+ setting: null;
28
+ };
29
+ changeLocale: (key: any) => void;
30
+ setUser: (user: any) => void;
31
+ removeUser: () => void;
32
+ changeTheme: (nextTheme: any) => void;
33
+ getSetting: () => void;
34
+ toggleCollapse: () => void;
35
+ componentDidMount(): void;
36
+ componentDidUpdate(_prevProps: any, prevState: any): void;
37
+ render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
38
+ context: unknown;
39
+ setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
40
+ forceUpdate(callback?: (() => void) | undefined): void;
41
+ readonly props: Readonly<any>;
42
+ refs: {
43
+ [key: string]: React.ReactInstance;
44
+ };
45
+ shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
46
+ componentWillUnmount?(): void;
47
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
48
+ getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
49
+ componentWillMount?(): void;
50
+ UNSAFE_componentWillMount?(): void;
51
+ componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
52
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
53
+ componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
54
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
55
+ };
56
+ new (props: any, context: any): {
57
+ state: {
58
+ locale: string;
59
+ user: null;
60
+ theme: import("./visitor/colorMode").ThemeColorMode;
61
+ collapsed: boolean;
62
+ setting: null;
63
+ };
64
+ changeLocale: (key: any) => void;
65
+ setUser: (user: any) => void;
66
+ removeUser: () => void;
67
+ changeTheme: (nextTheme: any) => void;
68
+ getSetting: () => void;
69
+ toggleCollapse: () => void;
70
+ componentDidMount(): void;
71
+ componentDidUpdate(_prevProps: any, prevState: any): void;
72
+ render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
73
+ context: unknown;
74
+ setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
75
+ forceUpdate(callback?: (() => void) | undefined): void;
76
+ readonly props: Readonly<any>;
77
+ refs: {
78
+ [key: string]: React.ReactInstance;
79
+ };
80
+ shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
81
+ componentWillUnmount?(): void;
82
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
83
+ getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
84
+ componentWillMount?(): void;
85
+ UNSAFE_componentWillMount?(): void;
86
+ componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
87
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
88
+ componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
89
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
90
+ };
91
+ getInitialProps: (appContext: any) => Promise<{
92
+ pageProps: any;
93
+ setting: Record<string, unknown>;
94
+ tags: unknown[];
95
+ categories: unknown[];
96
+ pages: unknown[];
97
+ i18n: Record<string, unknown>;
98
+ globalSetting: Record<string, unknown> | undefined;
99
+ siteConfig: Record<string, unknown>;
100
+ locales: string[];
101
+ initialLocale: string;
102
+ colorPrimary: string;
103
+ themeMods: import("./extension").ThemeMods;
104
+ }>;
105
+ origGetInitialProps: ({ Component, ctx, }: import("next/app").AppContext) => Promise<import("next/app").AppInitialProps>;
106
+ contextType?: React.Context<any> | undefined;
107
+ };
108
+ import React = require("react");
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ const React = require('react');
3
+ const App = require('next/app').default;
4
+ const Router = require('next/router').default;
5
+ const { fetchAppBootstrap } = require('./ssr/bootstrap');
6
+ const { createThemeAxiosClient } = require('./api/httpClient');
7
+ const { createThemeProviders } = require('./providers');
8
+ const { applyColorModeClass, resolveClientThemeMode, resolveInitialColorModeState, persistVisitorLocale, } = require('./visitor/colorMode');
9
+ const { clearThemeSession, persistThemeSession, resolveStoredUser, } = require('./visitor/authSession');
10
+ const { RouteProgress } = require('../ui/components/RouteProgress');
11
+ const { SiteAnalytics } = require('../ui/components/SiteAnalytics');
12
+ const { SiteCatalogProvider } = require('../ui/context/SiteCatalogContext');
13
+ const { useReportPageView } = require('../ui/hooks/useReportPageView');
14
+ function readInitialColorMode() {
15
+ if (typeof window === 'undefined')
16
+ return 'light';
17
+ return resolveClientThemeMode();
18
+ }
19
+ function ViewStatisticsBridge() {
20
+ useReportPageView();
21
+ return null;
22
+ }
23
+ /**
24
+ * Full-featured theme `_app` factory (UI-framework agnostic).
25
+ *
26
+ * @param {object} manifest — theme.json manifest
27
+ * @param {object} options
28
+ * @param {React.ComponentType} options.Layout
29
+ * @param {React.ComponentType} options.IntlProvider — from the theme's `next-intl` install
30
+ * @param {(mods: object) => string} [options.buildAppearanceCss]
31
+ * @param {(content: React.ReactNode, runtime: object) => React.ReactNode} [options.wrapContent]
32
+ * @param {object} [options.httpClientOptions]
33
+ * @param {boolean} [options.scrollToTopOnRouteChange=true]
34
+ */
35
+ function createCatalogThemeApp(manifest, options = {}) {
36
+ var _a;
37
+ const { Layout, buildAppearanceCss, httpClientOptions = {}, scrollToTopOnRouteChange = true, IntlProvider, wrapContent, } = options;
38
+ if (!Layout) {
39
+ throw new Error('createCatalogThemeApp: options.Layout is required');
40
+ }
41
+ if (!IntlProvider) {
42
+ throw new Error('createCatalogThemeApp: options.IntlProvider is required — import { NextIntlProvider } from "next-intl" in your theme');
43
+ }
44
+ if (scrollToTopOnRouteChange) {
45
+ Router.events.on('routeChangeComplete', () => {
46
+ setTimeout(() => {
47
+ if (document.documentElement.scrollTop > 0) {
48
+ window.scrollTo({ top: 0, behavior: 'smooth' });
49
+ }
50
+ }, 0);
51
+ });
52
+ }
53
+ class CatalogThemeApp extends App {
54
+ constructor() {
55
+ super(...arguments);
56
+ this.state = {
57
+ locale: '',
58
+ user: null,
59
+ theme: readInitialColorMode(),
60
+ collapsed: false,
61
+ setting: null,
62
+ };
63
+ this.changeLocale = (key) => {
64
+ persistVisitorLocale(key);
65
+ window.location.reload();
66
+ };
67
+ this.setUser = (user) => {
68
+ persistThemeSession(user);
69
+ this.setState({ user });
70
+ };
71
+ this.removeUser = () => {
72
+ clearThemeSession();
73
+ this.setState({ user: null });
74
+ window.location.reload();
75
+ };
76
+ this.changeTheme = (nextTheme) => {
77
+ applyColorModeClass(nextTheme === 'dark');
78
+ this.setState({ theme: nextTheme });
79
+ };
80
+ this.getSetting = () => {
81
+ const http = createThemeAxiosClient(httpClientOptions);
82
+ const { SettingProvider } = createThemeProviders(http);
83
+ SettingProvider.getSetting().then((res) => {
84
+ this.setState({ setting: res });
85
+ });
86
+ };
87
+ this.toggleCollapse = () => {
88
+ this.setState({ collapsed: !this.state.collapsed });
89
+ };
90
+ }
91
+ componentDidMount() {
92
+ const user = resolveStoredUser();
93
+ if (user) {
94
+ persistThemeSession(user);
95
+ this.setState({ user });
96
+ }
97
+ const preferred = resolveInitialColorModeState() ?? 'light';
98
+ applyColorModeClass(preferred === 'dark');
99
+ if (this.state.theme !== preferred) {
100
+ this.setState({ theme: preferred });
101
+ }
102
+ }
103
+ componentDidUpdate(_prevProps, prevState) {
104
+ if (prevState.theme !== this.state.theme) {
105
+ applyColorModeClass(this.state.theme === 'dark');
106
+ }
107
+ }
108
+ render() {
109
+ const { Component, pageProps, i18n, globalSetting, siteConfig, locales, initialLocale, tags, categories, pages, colorPrimary, themeMods = {}, ...rest } = this.props;
110
+ const locale = this.state.locale ||
111
+ initialLocale ||
112
+ (Array.isArray(locales) && locales.length > 0 ? locales[0] : null) ||
113
+ 'zh';
114
+ const { needLayoutFooter = true, hasBg = false } = pageProps;
115
+ const message = i18n?.[locale] || {};
116
+ const isDark = this.state.theme === 'dark';
117
+ const appearanceCss = buildAppearanceCss?.(themeMods);
118
+ const setting = this.state.setting ?? rest.setting;
119
+ const catalogValue = {
120
+ setting,
121
+ i18n,
122
+ locale,
123
+ locales,
124
+ globalSetting,
125
+ siteConfig,
126
+ tags,
127
+ categories,
128
+ pages,
129
+ theme: this.state.theme,
130
+ collapsed: this.state.collapsed,
131
+ changeLocale: this.changeLocale,
132
+ user: this.state.user,
133
+ setUser: this.setUser,
134
+ removeUser: this.removeUser,
135
+ changeTheme: this.changeTheme,
136
+ getSetting: this.getSetting,
137
+ toggleCollapse: this.toggleCollapse,
138
+ };
139
+ const layout = React.createElement(Layout, {
140
+ needHeader: true,
141
+ needFooter: needLayoutFooter,
142
+ hasBg,
143
+ }, React.createElement(RouteProgress, null), React.createElement(Component, pageProps));
144
+ const runtime = { locale, isDark, colorPrimary, themeMods, colorMode: this.state.theme };
145
+ const content = wrapContent ? wrapContent(layout, runtime) : layout;
146
+ return React.createElement(SiteCatalogProvider, { value: catalogValue }, React.createElement(IntlProvider, { messages: message, locale }, appearanceCss
147
+ ? React.createElement('style', {
148
+ dangerouslySetInnerHTML: { __html: appearanceCss },
149
+ })
150
+ : null, React.createElement(ViewStatisticsBridge, null), React.createElement(SiteAnalytics, null), content));
151
+ }
152
+ }
153
+ _a = CatalogThemeApp;
154
+ CatalogThemeApp.getInitialProps = async (appContext) => {
155
+ const appProps = await App.getInitialProps(appContext);
156
+ const bootstrap = await fetchAppBootstrap({
157
+ manifest,
158
+ ctx: appContext.ctx,
159
+ });
160
+ return {
161
+ ...appProps,
162
+ ...bootstrap,
163
+ pageProps: appProps.pageProps,
164
+ };
165
+ };
166
+ return CatalogThemeApp;
167
+ }
168
+ module.exports = { createCatalogThemeApp };
@@ -0,0 +1 @@
1
+ export { defaultModsFromManifest } from './appearance';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultModsFromManifest = void 0;
4
+ var appearance_1 = require("./appearance");
5
+ Object.defineProperty(exports, "defaultModsFromManifest", { enumerable: true, get: function () { return appearance_1.defaultModsFromManifest; } });
@@ -0,0 +1,16 @@
1
+ export type ArchiveExcerptMode = 'excerpt' | 'full' | 'none';
2
+ /** Strip HTML tags and collapse whitespace for archive excerpts. */
3
+ export declare function stripHtml(html: string): string;
4
+ /** Truncate text to a word limit with an ellipsis. */
5
+ export declare function truncateWords(text: string, limit?: number): string;
6
+ export interface ResolveArchiveExcerptOptions {
7
+ mode?: ArchiveExcerptMode;
8
+ content?: string | null;
9
+ summary?: string | null;
10
+ wordLimit?: number;
11
+ }
12
+ /**
13
+ * Resolve archive list excerpt text from customizer `archiveExcerpt` mode.
14
+ * Returns `null` when the excerpt should be hidden.
15
+ */
16
+ export declare function resolveArchiveExcerpt({ mode, content, summary, wordLimit, }: ResolveArchiveExcerptOptions): string | null;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripHtml = stripHtml;
4
+ exports.truncateWords = truncateWords;
5
+ exports.resolveArchiveExcerpt = resolveArchiveExcerpt;
6
+ const DEFAULT_EXCERPT_WORD_LIMIT = 55;
7
+ /** Strip HTML tags and collapse whitespace for archive excerpts. */
8
+ function stripHtml(html) {
9
+ return html.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim();
10
+ }
11
+ /** Truncate text to a word limit with an ellipsis. */
12
+ function truncateWords(text, limit = DEFAULT_EXCERPT_WORD_LIMIT) {
13
+ const words = text.trim().split(/\s+/).filter(Boolean);
14
+ if (words.length <= limit)
15
+ return text.trim();
16
+ return `${words.slice(0, limit).join(' ')}…`;
17
+ }
18
+ /**
19
+ * Resolve archive list excerpt text from customizer `archiveExcerpt` mode.
20
+ * Returns `null` when the excerpt should be hidden.
21
+ */
22
+ function resolveArchiveExcerpt({ mode = 'excerpt', content, summary, wordLimit = DEFAULT_EXCERPT_WORD_LIMIT, }) {
23
+ if (mode === 'none')
24
+ return null;
25
+ const raw = stripHtml(content ?? '') || summary?.trim() || '';
26
+ if (!raw)
27
+ return null;
28
+ if (mode === 'full')
29
+ return raw;
30
+ return truncateWords(raw, wordLimit);
31
+ }
@@ -0,0 +1,10 @@
1
+ export type ThemeMods = Record<string, string>;
2
+ /** Customizer mod id → legacy Setting column (runtime overlay for themes). */
3
+ export declare const THEME_BRANDING_MOD_TO_SETTING: Record<string, string>;
4
+ /** Mod ids stored under the same key in mods and Setting overlay. */
5
+ export declare const THEME_BRANDING_DIRECT_MODS: readonly ["systemFooterInfo", "aboutUsGithubUrl", "aboutUsCommentQr", "aboutUsWechatQr"];
6
+ /** Build customizer form seed from legacy Setting columns (one-time / fallback). */
7
+ export declare function seedThemeModsFromLegacySetting(setting: Record<string, unknown> | null | undefined, mods?: ThemeMods): ThemeMods;
8
+ /** Overlay theme mods onto a Setting-shaped object for theme runtime & mail templates. */
9
+ export declare function applyThemeModsToSiteSetting<T extends Record<string, unknown>>(setting: T, mods: ThemeMods): T;
10
+ export declare function brandingModValue(mods: ThemeMods, modId: string): string | undefined;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.THEME_BRANDING_DIRECT_MODS = exports.THEME_BRANDING_MOD_TO_SETTING = void 0;
4
+ exports.seedThemeModsFromLegacySetting = seedThemeModsFromLegacySetting;
5
+ exports.applyThemeModsToSiteSetting = applyThemeModsToSiteSetting;
6
+ exports.brandingModValue = brandingModValue;
7
+ /** Customizer mod id → legacy Setting column (runtime overlay for themes). */
8
+ exports.THEME_BRANDING_MOD_TO_SETTING = {
9
+ displayTitle: 'systemTitle',
10
+ displayTagline: 'systemSubTitle',
11
+ siteLogo: 'systemLogo',
12
+ backgroundImage: 'systemBg',
13
+ siteFavicon: 'systemFavicon',
14
+ siteNotice: 'systemNoticeInfo',
15
+ seoKeyword: 'seoKeyword',
16
+ seoDesc: 'seoDesc',
17
+ baiduAnalyticsId: 'baiduAnalyticsId',
18
+ googleAnalyticsId: 'googleAnalyticsId',
19
+ };
20
+ /** Mod ids stored under the same key in mods and Setting overlay. */
21
+ exports.THEME_BRANDING_DIRECT_MODS = [
22
+ 'systemFooterInfo',
23
+ 'aboutUsGithubUrl',
24
+ 'aboutUsCommentQr',
25
+ 'aboutUsWechatQr',
26
+ ];
27
+ function modValue(mods, modId) {
28
+ const v = mods[modId];
29
+ if (v == null || String(v).trim() === '')
30
+ return undefined;
31
+ return String(v);
32
+ }
33
+ /** Build customizer form seed from legacy Setting columns (one-time / fallback). */
34
+ function seedThemeModsFromLegacySetting(setting, mods = {}) {
35
+ const merged = { ...mods };
36
+ for (const [modId, settingKey] of Object.entries(exports.THEME_BRANDING_MOD_TO_SETTING)) {
37
+ if (!modValue(merged, modId) && setting?.[settingKey] != null) {
38
+ merged[modId] = String(setting[settingKey]);
39
+ }
40
+ }
41
+ for (const key of exports.THEME_BRANDING_DIRECT_MODS) {
42
+ if (!modValue(merged, key) && setting?.[key] != null) {
43
+ merged[key] = String(setting[key]);
44
+ }
45
+ }
46
+ return merged;
47
+ }
48
+ /** Overlay theme mods onto a Setting-shaped object for theme runtime & mail templates. */
49
+ function applyThemeModsToSiteSetting(setting, mods) {
50
+ const next = { ...setting };
51
+ for (const [modId, settingKey] of Object.entries(exports.THEME_BRANDING_MOD_TO_SETTING)) {
52
+ const v = modValue(mods, modId);
53
+ if (v)
54
+ next[settingKey] = v;
55
+ }
56
+ for (const key of exports.THEME_BRANDING_DIRECT_MODS) {
57
+ const v = modValue(mods, key);
58
+ if (v)
59
+ next[key] = v;
60
+ }
61
+ return next;
62
+ }
63
+ function brandingModValue(mods, modId) {
64
+ return modValue(mods, modId);
65
+ }
@@ -0,0 +1,3 @@
1
+ import type { ThemeConfigurationSchema } from './types';
2
+ /** Collect `default` values from a JSON Schema object tree. */
3
+ export declare function defaultsFromSchema(schema: ThemeConfigurationSchema | null | undefined): Record<string, unknown>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultsFromSchema = defaultsFromSchema;
4
+ /** Collect `default` values from a JSON Schema object tree. */
5
+ function defaultsFromSchema(schema) {
6
+ if (!schema?.properties)
7
+ return {};
8
+ const out = {};
9
+ for (const [key, prop] of Object.entries(schema.properties)) {
10
+ const value = defaultFromProperty(prop);
11
+ if (value !== undefined) {
12
+ out[key] = value;
13
+ }
14
+ }
15
+ return out;
16
+ }
17
+ function defaultFromProperty(prop) {
18
+ if (!prop)
19
+ return undefined;
20
+ if (prop.default !== undefined)
21
+ return prop.default;
22
+ if (prop.type === 'object' && prop.properties) {
23
+ const nested = {};
24
+ for (const [k, p] of Object.entries(prop.properties)) {
25
+ const v = defaultFromProperty(p);
26
+ if (v !== undefined)
27
+ nested[k] = v;
28
+ }
29
+ return Object.keys(nested).length ? nested : undefined;
30
+ }
31
+ return undefined;
32
+ }
@@ -0,0 +1,10 @@
1
+ import type { ThemeConfigurationSchema } from './types';
2
+ /** Formily `ISchema` node (JSON Schema + Formily x-* extensions). */
3
+ export type FormilySchemaNode = Record<string, unknown>;
4
+ export declare function registerFormilyWidget(widgetId: string, componentName: string): void;
5
+ /**
6
+ * Convert theme `reactpress.configuration` JSON Schema to Formily render schema.
7
+ * Adds `x-decorator` / `x-component` from types and `x-ui.widget`.
8
+ */
9
+ export declare function toFormilyJsonSchema(schema: ThemeConfigurationSchema | null | undefined): FormilySchemaNode | null;
10
+ export declare function getFormilyVoidComponents(): string[];
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerFormilyWidget = registerFormilyWidget;
4
+ exports.toFormilyJsonSchema = toFormilyJsonSchema;
5
+ exports.getFormilyVoidComponents = getFormilyVoidComponents;
6
+ const VOID_COMPONENTS = [
7
+ 'FormLayout',
8
+ 'FormGrid',
9
+ 'FormGrid.GridColumn',
10
+ 'SectionCard',
11
+ 'FormCollapse',
12
+ 'FormCollapse.CollapsePanel',
13
+ 'CollapsePanel',
14
+ 'FormTab',
15
+ 'FormTab.TabPane',
16
+ ];
17
+ /** Map `x-ui.widget` → Formily `x-component` (extend via registerFormilyWidget). */
18
+ const WIDGET_COMPONENT_MAP = {
19
+ navLinkList: 'NavLinkListField',
20
+ urlConfigEditor: 'JsonConfigEditor',
21
+ navSearchEditor: 'JsonConfigEditor',
22
+ };
23
+ const registeredWidgets = { ...WIDGET_COMPONENT_MAP };
24
+ function registerFormilyWidget(widgetId, componentName) {
25
+ registeredWidgets[widgetId] = componentName;
26
+ }
27
+ /**
28
+ * Convert theme `reactpress.configuration` JSON Schema to Formily render schema.
29
+ * Adds `x-decorator` / `x-component` from types and `x-ui.widget`.
30
+ */
31
+ function toFormilyJsonSchema(schema) {
32
+ if (!schema || schema.type !== 'object')
33
+ return null;
34
+ const root = convertProperty({ ...schema, type: 'object' }, 0, true);
35
+ const sectionProps = (root.properties ?? {});
36
+ return {
37
+ type: 'object',
38
+ 'x-component': 'FormLayout',
39
+ 'x-component-props': { layout: 'vertical', style: { width: '100%' } },
40
+ properties: wrapRootSections(sectionProps),
41
+ };
42
+ }
43
+ /** Full-width section cards; field paths stay `header.*` / `nav.*`. */
44
+ function wrapRootSections(properties) {
45
+ return Object.fromEntries(Object.entries(properties).map(([key, child]) => {
46
+ const title = typeof child.title === 'string' ? child.title : key;
47
+ const inner = withObjectLayout(child);
48
+ return [
49
+ key,
50
+ {
51
+ ...inner,
52
+ 'x-decorator': 'SectionCard',
53
+ 'x-decorator-props': {
54
+ title,
55
+ sectionId: `theme-section-${key}`,
56
+ feedbackLayout: 'none',
57
+ layout: 'vertical',
58
+ fullness: true,
59
+ },
60
+ },
61
+ ];
62
+ }));
63
+ }
64
+ /** Ensure nested object fields render their properties in Formily. */
65
+ function withObjectLayout(node, title) {
66
+ if (node.type !== 'object' || !node.properties)
67
+ return node;
68
+ const props = node.properties;
69
+ const keys = Object.keys(props);
70
+ return {
71
+ ...node,
72
+ ...(keys.length > 1 ? { title } : {}),
73
+ 'x-component': 'FormLayout',
74
+ 'x-component-props': { layout: 'vertical' },
75
+ };
76
+ }
77
+ function convertProperty(node, depth, isRoot = false) {
78
+ const ui = node['x-ui'];
79
+ if (ui?.hidden) {
80
+ return { ...node, 'x-display': 'hidden' };
81
+ }
82
+ const type = typeof node.type === 'string' ? node.type : undefined;
83
+ if (type === 'object') {
84
+ const widget = ui?.widget ? registeredWidgets[ui.widget] : undefined;
85
+ if (widget === 'JsonConfigEditor') {
86
+ return {
87
+ ...stripMeta(node),
88
+ type: 'object',
89
+ 'x-decorator': 'FormItem',
90
+ 'x-decorator-props': {
91
+ feedbackLayout: 'none',
92
+ layout: 'vertical',
93
+ fullness: true,
94
+ wrapperCol: 24,
95
+ },
96
+ 'x-component': 'JsonConfigEditor',
97
+ 'x-component-props': { height: 360 },
98
+ };
99
+ }
100
+ if (node.properties) {
101
+ const properties = Object.fromEntries(Object.entries(node.properties).map(([key, child]) => [
102
+ key,
103
+ convertProperty(child, depth + 1),
104
+ ]));
105
+ return {
106
+ ...stripMeta(node),
107
+ type: 'object',
108
+ properties,
109
+ };
110
+ }
111
+ }
112
+ if (type === 'array') {
113
+ const widget = ui?.widget ? registeredWidgets[ui.widget] : undefined;
114
+ const out = {
115
+ ...stripMeta(node),
116
+ type: 'array',
117
+ 'x-decorator': 'FormItem',
118
+ 'x-decorator-props': {
119
+ feedbackLayout: 'none',
120
+ layout: 'vertical',
121
+ colon: false,
122
+ fullness: true,
123
+ wrapperCol: 24,
124
+ },
125
+ 'x-component': widget ?? 'ArrayCards',
126
+ 'x-component-props': widget === 'NavLinkListField'
127
+ ? {}
128
+ : widget === 'ArrayCards'
129
+ ? { title: node.title ?? 'Item' }
130
+ : {},
131
+ };
132
+ if (widget !== 'NavLinkListField' && node.items && typeof node.items === 'object' && !Array.isArray(node.items)) {
133
+ out.items = convertProperty(node.items, depth + 1);
134
+ }
135
+ return out;
136
+ }
137
+ if (type === 'boolean') {
138
+ return {
139
+ ...stripMeta(node),
140
+ type: 'boolean',
141
+ 'x-decorator': 'FormItem',
142
+ 'x-component': 'Switch',
143
+ };
144
+ }
145
+ if (type === 'number' || type === 'integer') {
146
+ return {
147
+ ...stripMeta(node),
148
+ type: 'number',
149
+ 'x-decorator': 'FormItem',
150
+ 'x-component': 'NumberPicker',
151
+ };
152
+ }
153
+ if (type === 'string') {
154
+ const component = node.enum ? 'Select' : 'Input';
155
+ return {
156
+ ...stripMeta(node),
157
+ type: 'string',
158
+ 'x-decorator': 'FormItem',
159
+ 'x-component': component,
160
+ };
161
+ }
162
+ return { ...stripMeta(node) };
163
+ }
164
+ function stripMeta(node) {
165
+ const { ['x-ui']: _ui, ...rest } = node;
166
+ return { ...rest };
167
+ }
168
+ function getFormilyVoidComponents() {
169
+ return [...VOID_COMPONENTS];
170
+ }
@@ -0,0 +1,7 @@
1
+ export * from './defaults';
2
+ export * from './formily';
3
+ export * from './paths';
4
+ export { getThemeConfigurationSchema, getThemeConfigurationSeed, TWENTYTWENTYFIVE_CONFIGURATION_SCHEMA, twentytwentyfiveConfigSeed, } from './presets/twentytwentyfive';
5
+ export * from './resolve';
6
+ export * from './types';
7
+ export * from './validate';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.twentytwentyfiveConfigSeed = exports.TWENTYTWENTYFIVE_CONFIGURATION_SCHEMA = exports.getThemeConfigurationSeed = exports.getThemeConfigurationSchema = void 0;
18
+ __exportStar(require("./defaults"), exports);
19
+ __exportStar(require("./formily"), exports);
20
+ __exportStar(require("./paths"), exports);
21
+ var twentytwentyfive_1 = require("./presets/twentytwentyfive");
22
+ Object.defineProperty(exports, "getThemeConfigurationSchema", { enumerable: true, get: function () { return twentytwentyfive_1.getThemeConfigurationSchema; } });
23
+ Object.defineProperty(exports, "getThemeConfigurationSeed", { enumerable: true, get: function () { return twentytwentyfive_1.getThemeConfigurationSeed; } });
24
+ Object.defineProperty(exports, "TWENTYTWENTYFIVE_CONFIGURATION_SCHEMA", { enumerable: true, get: function () { return twentytwentyfive_1.TWENTYTWENTYFIVE_CONFIGURATION_SCHEMA; } });
25
+ Object.defineProperty(exports, "twentytwentyfiveConfigSeed", { enumerable: true, get: function () { return twentytwentyfive_1.twentytwentyfiveConfigSeed; } });
26
+ __exportStar(require("./resolve"), exports);
27
+ __exportStar(require("./types"), exports);
28
+ __exportStar(require("./validate"), exports);
@@ -0,0 +1 @@
1
+ export { deepMerge, getByPath, setByPath, } from '../../../utils/object';