@fecommunity/reactpress-toolkit 3.0.4 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +194 -309
- package/dist/.source-fingerprint-toolkit +1 -0
- package/dist/admin/index.d.ts +2 -0
- package/dist/admin/index.js +18 -0
- package/dist/admin/permissions.d.ts +5 -0
- package/dist/admin/permissions.js +33 -0
- package/dist/admin/registry.d.ts +62 -0
- package/dist/admin/registry.js +79 -0
- package/dist/api/HttpClient.d.ts +2 -2
- package/dist/api/HttpClient.js +1 -1
- package/dist/api/Smtp.d.ts +17 -0
- package/dist/api/Smtp.js +15 -0
- package/dist/api/instance.d.ts +1 -1
- package/dist/api/instance.js +3 -3
- package/dist/app/createReactPressApp.d.ts +8 -0
- package/dist/app/createReactPressApp.js +265 -0
- package/dist/app/createThemeApp.d.ts +8 -0
- package/dist/app/createThemeApp.js +51 -0
- package/dist/app/devChunkRecovery.d.ts +2 -0
- package/dist/app/devChunkRecovery.js +68 -0
- package/dist/app/index.d.ts +39 -0
- package/dist/app/index.js +11 -0
- package/dist/config/env.js +29 -15
- package/dist/config/global.d.ts +7 -1
- package/dist/config/global.js +9 -3
- package/dist/config/i18n.js +27 -11
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.js +6 -5
- package/dist/{locales → config/locales}/en.json +31 -3
- package/dist/{locales → config/locales}/zh.json +31 -3
- package/dist/dev/index.d.ts +3 -0
- package/dist/dev/index.js +12 -0
- package/dist/dev/portRedirect.d.ts +20 -0
- package/dist/dev/portRedirect.js +93 -0
- package/dist/dev/vitePortRedirectPlugin.d.ts +24 -0
- package/dist/dev/vitePortRedirectPlugin.js +40 -0
- package/dist/extension/branding-mods.d.ts +10 -0
- package/dist/extension/branding-mods.js +65 -0
- package/dist/extension/configuration/defaults.d.ts +3 -0
- package/dist/extension/configuration/defaults.js +32 -0
- package/dist/extension/configuration/formily.d.ts +10 -0
- package/dist/extension/configuration/formily.js +170 -0
- package/dist/extension/configuration/index.d.ts +7 -0
- package/dist/extension/configuration/index.js +28 -0
- package/dist/extension/configuration/paths.d.ts +4 -0
- package/dist/extension/configuration/paths.js +50 -0
- package/dist/extension/configuration/presets/twentytwentyfive.d.ts +7 -0
- package/dist/extension/configuration/presets/twentytwentyfive.js +94 -0
- package/dist/extension/configuration/resolve.d.ts +24 -0
- package/dist/extension/configuration/resolve.js +98 -0
- package/dist/extension/configuration/types.d.ts +68 -0
- package/dist/extension/configuration/types.js +3 -0
- package/dist/extension/configuration/validate.d.ts +8 -0
- package/dist/extension/configuration/validate.js +21 -0
- package/dist/extension/index.d.ts +9 -0
- package/dist/extension/index.js +35 -0
- package/dist/extension/manifest-normalize.d.ts +5 -0
- package/dist/extension/manifest-normalize.js +75 -0
- package/dist/extension/node.d.ts +2 -0
- package/dist/extension/node.js +6 -0
- package/dist/extension/presets/twentytwentyfive-appearance.d.ts +10 -0
- package/dist/extension/presets/twentytwentyfive-appearance.js +193 -0
- package/dist/extension/presets/twentytwentyfive-customizer.d.ts +19 -0
- package/dist/extension/presets/twentytwentyfive-customizer.js +199 -0
- package/dist/extension/preview.d.ts +46 -0
- package/dist/extension/preview.js +92 -0
- package/dist/extension/site-notices.d.ts +19 -0
- package/dist/extension/site-notices.js +88 -0
- package/dist/extension/site-settings.d.ts +37 -0
- package/dist/extension/site-settings.js +144 -0
- package/dist/extension/theme-admin-locale.d.ts +11 -0
- package/dist/extension/theme-admin-locale.io.d.ts +2 -0
- package/dist/extension/theme-admin-locale.io.js +54 -0
- package/dist/extension/theme-admin-locale.js +81 -0
- package/dist/extension/theme.d.ts +89 -0
- package/dist/extension/theme.js +93 -0
- package/dist/extension/twentytwentyfive-vars.d.ts +7 -0
- package/dist/extension/twentytwentyfive-vars.js +100 -0
- package/dist/index.d.ts +15 -7
- package/dist/index.js +44 -22
- package/dist/plugin/admin/index.d.ts +2 -0
- package/dist/plugin/admin/index.js +18 -0
- package/dist/plugin/admin/permissions.d.ts +5 -0
- package/dist/plugin/admin/permissions.js +33 -0
- package/dist/plugin/admin/plugin-admin.d.ts +37 -0
- package/dist/plugin/admin/plugin-admin.js +41 -0
- package/dist/plugin/admin/registry.d.ts +62 -0
- package/dist/plugin/admin/registry.js +79 -0
- package/dist/plugin/admin/slots.d.ts +36 -0
- package/dist/plugin/admin/slots.js +16 -0
- package/dist/plugin/client/client.d.ts +14 -0
- package/dist/plugin/client/client.js +95 -0
- package/dist/plugin/client/index.d.ts +4 -0
- package/dist/plugin/client/index.js +11 -0
- package/dist/plugin/client/runtime.d.ts +18 -0
- package/dist/plugin/client/runtime.js +30 -0
- package/dist/plugin/dev/index.d.ts +4 -0
- package/dist/plugin/dev/index.js +16 -0
- package/dist/plugin/dev/portRedirect.d.ts +26 -0
- package/dist/plugin/dev/portRedirect.js +111 -0
- package/dist/plugin/dev/vitePortRedirectPlugin.d.ts +24 -0
- package/dist/plugin/dev/vitePortRedirectPlugin.js +40 -0
- package/dist/plugin/extension/index.d.ts +4 -0
- package/dist/plugin/extension/index.js +20 -0
- package/dist/plugin/extension/plugin-admin-locale.d.ts +21 -0
- package/dist/plugin/extension/plugin-admin-locale.io.d.ts +2 -0
- package/dist/plugin/extension/plugin-admin-locale.io.js +54 -0
- package/dist/plugin/extension/plugin-admin-locale.js +60 -0
- package/dist/plugin/extension/plugin.d.ts +82 -0
- package/dist/plugin/extension/plugin.js +146 -0
- package/dist/plugin/extension/security.d.ts +7 -0
- package/dist/plugin/extension/security.js +74 -0
- package/dist/plugin/extension/validate.d.ts +8 -0
- package/dist/plugin/extension/validate.js +55 -0
- package/dist/plugin/index.d.ts +9 -0
- package/dist/plugin/index.js +48 -0
- package/dist/plugin/node.d.ts +2 -0
- package/dist/plugin/node.js +6 -0
- package/dist/plugin/react/client.d.ts +14 -0
- package/dist/plugin/react/client.js +95 -0
- package/dist/plugin/react/index.d.ts +2 -0
- package/dist/plugin/react/index.js +18 -0
- package/dist/plugin/react/plugin-admin-ui.d.ts +23 -0
- package/dist/plugin/react/plugin-admin-ui.js +38 -0
- package/dist/plugin/react/runtime.d.ts +18 -0
- package/dist/plugin/react/runtime.js +30 -0
- package/dist/plugin/server/hook-reject.d.ts +12 -0
- package/dist/plugin/server/hook-reject.js +39 -0
- package/dist/plugin/server/index.d.ts +2 -0
- package/dist/plugin/server/index.js +18 -0
- package/dist/plugin/server/types.d.ts +34 -0
- package/dist/plugin/server/types.js +3 -0
- package/dist/primitives/AntdStyleTransitionFix.d.ts +2 -0
- package/dist/primitives/AntdStyleTransitionFix.js +16 -0
- package/dist/primitives/Badge.d.ts +7 -0
- package/dist/primitives/Badge.js +9 -0
- package/dist/primitives/Button.d.ts +10 -0
- package/dist/primitives/Button.js +38 -0
- package/dist/primitives/ColorModeToggle.d.ts +8 -0
- package/dist/primitives/ColorModeToggle.js +13 -0
- package/dist/primitives/IconButton.d.ts +7 -0
- package/dist/primitives/IconButton.js +13 -0
- package/dist/primitives/ScrollToTarget.d.ts +9 -0
- package/dist/primitives/ScrollToTarget.js +48 -0
- package/dist/primitives/Separator.d.ts +7 -0
- package/dist/primitives/Separator.js +9 -0
- package/dist/primitives/Skeleton.d.ts +7 -0
- package/dist/primitives/Skeleton.js +9 -0
- package/dist/primitives/Slot.d.ts +10 -0
- package/dist/primitives/Slot.js +25 -0
- package/dist/primitives/Spinner.d.ts +6 -0
- package/dist/primitives/Spinner.js +9 -0
- package/dist/primitives/animation/ConditionTransition.d.ts +8 -0
- package/dist/primitives/animation/ConditionTransition.js +13 -0
- package/dist/primitives/animation/ListTrail.d.ts +10 -0
- package/dist/primitives/animation/ListTrail.js +14 -0
- package/dist/primitives/animation/Opacity.d.ts +3 -0
- package/dist/primitives/animation/Opacity.js +10 -0
- package/dist/primitives/animation/Spring.d.ts +9 -0
- package/dist/primitives/animation/Spring.js +29 -0
- package/dist/primitives/animation/index.d.ts +7 -0
- package/dist/primitives/animation/index.js +11 -0
- package/dist/primitives/cn.d.ts +4 -0
- package/dist/primitives/cn.js +7 -0
- package/dist/primitives/icons.d.ts +4 -0
- package/dist/primitives/icons.js +15 -0
- package/dist/primitives/index.d.ts +22 -0
- package/dist/primitives/index.js +44 -0
- package/dist/react/client.d.ts +14 -0
- package/dist/react/client.js +95 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.js +11 -0
- package/dist/react/runtime.d.ts +18 -0
- package/dist/react/runtime.js +30 -0
- package/dist/theme/antdDocument.d.ts +18 -0
- package/dist/theme/antdDocument.js +59 -0
- package/dist/theme/api/api-data.d.ts +2 -0
- package/dist/theme/api/api-data.js +8 -0
- package/dist/theme/api/api.d.ts +28 -0
- package/dist/theme/api/api.js +27 -0
- package/dist/theme/api/httpClient.d.ts +24 -0
- package/dist/theme/api/httpClient.js +83 -0
- package/dist/theme/api/json.d.ts +1 -0
- package/dist/theme/api/json.js +5 -0
- package/dist/theme/api/jsonp.d.ts +1 -0
- package/dist/theme/api/jsonp.js +5 -0
- package/dist/theme/api-data.d.ts +12 -0
- package/dist/theme/api-data.js +22 -0
- package/dist/theme/api.d.ts +28 -0
- package/dist/theme/api.js +27 -0
- package/dist/theme/appearance.d.ts +4 -0
- package/dist/theme/appearance.js +16 -0
- package/dist/theme/assets.d.ts +2 -0
- package/dist/theme/assets.js +27 -0
- package/dist/theme/authSession.d.ts +16 -0
- package/dist/theme/authSession.js +92 -0
- package/dist/theme/build/antdDocument.d.ts +145 -0
- package/dist/theme/build/antdDocument.js +70 -0
- package/dist/theme/build/next-config.d.ts +15 -0
- package/dist/theme/build/next-config.js +63 -0
- package/dist/theme/build/node.d.ts +2 -0
- package/dist/theme/build/node.js +6 -0
- package/dist/theme/colorMode.d.ts +12 -0
- package/dist/theme/colorMode.js +45 -0
- package/dist/theme/commentAuthor.d.ts +17 -0
- package/dist/theme/commentAuthor.js +48 -0
- package/dist/theme/content/archiveSlim.d.ts +7 -0
- package/dist/theme/content/archiveSlim.js +38 -0
- package/dist/theme/content/articleSlim.d.ts +10 -0
- package/dist/theme/content/articleSlim.js +35 -0
- package/dist/theme/content/assets.d.ts +8 -0
- package/dist/theme/content/assets.js +74 -0
- package/dist/theme/content/carouselArticles.d.ts +10 -0
- package/dist/theme/content/carouselArticles.js +39 -0
- package/dist/theme/content/excerpt.d.ts +15 -0
- package/dist/theme/content/excerpt.js +42 -0
- package/dist/theme/content/nav.d.ts +10 -0
- package/dist/theme/content/nav.js +30 -0
- package/dist/theme/content/seo.d.ts +6 -0
- package/dist/theme/content/seo.js +12 -0
- package/dist/theme/createAntdApp.d.ts +106 -0
- package/dist/theme/createAntdApp.js +175 -0
- package/dist/theme/createApp.d.ts +10 -0
- package/dist/theme/createApp.js +141 -0
- package/dist/theme/createCatalogApp.d.ts +108 -0
- package/dist/theme/createCatalogApp.js +168 -0
- package/dist/theme/customizer.d.ts +1 -0
- package/dist/theme/customizer.js +5 -0
- package/dist/theme/excerpt.d.ts +16 -0
- package/dist/theme/excerpt.js +31 -0
- package/dist/theme/extension/branding-mods.d.ts +10 -0
- package/dist/theme/extension/branding-mods.js +65 -0
- package/dist/theme/extension/configuration/defaults.d.ts +3 -0
- package/dist/theme/extension/configuration/defaults.js +32 -0
- package/dist/theme/extension/configuration/formily.d.ts +10 -0
- package/dist/theme/extension/configuration/formily.js +170 -0
- package/dist/theme/extension/configuration/index.d.ts +7 -0
- package/dist/theme/extension/configuration/index.js +28 -0
- package/dist/theme/extension/configuration/paths.d.ts +1 -0
- package/dist/theme/extension/configuration/paths.js +7 -0
- package/dist/theme/extension/configuration/presets/twentytwentyfive.d.ts +7 -0
- package/dist/theme/extension/configuration/presets/twentytwentyfive.js +94 -0
- package/dist/theme/extension/configuration/resolve.d.ts +24 -0
- package/dist/theme/extension/configuration/resolve.js +98 -0
- package/dist/theme/extension/configuration/types.d.ts +68 -0
- package/dist/theme/extension/configuration/types.js +3 -0
- package/dist/theme/extension/configuration/validate.d.ts +8 -0
- package/dist/theme/extension/configuration/validate.js +21 -0
- package/dist/theme/extension/index.d.ts +11 -0
- package/dist/theme/extension/index.js +38 -0
- package/dist/theme/extension/manifest-normalize.d.ts +5 -0
- package/dist/theme/extension/manifest-normalize.js +75 -0
- package/dist/theme/extension/presets/twentytwentyfive-appearance.d.ts +10 -0
- package/dist/theme/extension/presets/twentytwentyfive-appearance.js +193 -0
- package/dist/theme/extension/preview.d.ts +46 -0
- package/dist/theme/extension/preview.js +92 -0
- package/dist/theme/extension/site-notices.d.ts +19 -0
- package/dist/theme/extension/site-notices.js +88 -0
- package/dist/theme/extension/site-settings.d.ts +37 -0
- package/dist/theme/extension/site-settings.js +144 -0
- package/dist/theme/extension/siteNav.d.ts +18 -0
- package/dist/theme/extension/siteNav.js +17 -0
- package/dist/theme/extension/theme-admin-locale.d.ts +11 -0
- package/dist/theme/extension/theme-admin-locale.io.d.ts +2 -0
- package/dist/theme/extension/theme-admin-locale.io.js +54 -0
- package/dist/theme/extension/theme-admin-locale.js +68 -0
- package/dist/theme/extension/theme.d.ts +89 -0
- package/dist/theme/extension/theme.js +93 -0
- package/dist/theme/extension/twentytwentyfive-vars.d.ts +9 -0
- package/dist/theme/extension/twentytwentyfive-vars.js +103 -0
- package/dist/theme/fetch.d.ts +134 -0
- package/dist/theme/fetch.js +241 -0
- package/dist/theme/format.d.ts +16 -0
- package/dist/theme/format.js +48 -0
- package/dist/theme/httpClient.d.ts +20 -0
- package/dist/theme/httpClient.js +89 -0
- package/dist/theme/index.d.ts +63 -0
- package/dist/theme/index.js +226 -0
- package/dist/theme/json.d.ts +1 -0
- package/dist/theme/json.js +17 -0
- package/dist/theme/jsonp.d.ts +8 -0
- package/dist/theme/jsonp.js +27 -0
- package/dist/theme/locale.d.ts +23 -0
- package/dist/theme/locale.js +55 -0
- package/dist/theme/nav.d.ts +10 -0
- package/dist/theme/nav.js +30 -0
- package/dist/theme/next-config.d.ts +2 -0
- package/dist/theme/next-config.js +18 -0
- package/dist/theme/node.d.ts +2 -0
- package/dist/theme/node.js +18 -0
- package/dist/theme/preview/preview-config.d.ts +13 -0
- package/dist/theme/preview/preview-config.js +65 -0
- package/dist/theme/preview/preview-draft.d.ts +19 -0
- package/dist/theme/preview/preview-draft.js +51 -0
- package/dist/theme/preview/preview-mods.d.ts +16 -0
- package/dist/theme/preview/preview-mods.js +78 -0
- package/dist/theme/preview-config.d.ts +13 -0
- package/dist/theme/preview-config.js +65 -0
- package/dist/theme/preview-draft.d.ts +19 -0
- package/dist/theme/preview-draft.js +51 -0
- package/dist/theme/preview-mods.d.ts +16 -0
- package/dist/theme/preview-mods.js +78 -0
- package/dist/theme/providers/index.d.ts +118 -0
- package/dist/theme/providers/index.js +251 -0
- package/dist/theme/providers/setup.d.ts +124 -0
- package/dist/theme/providers/setup.js +29 -0
- package/dist/theme/runtime.d.ts +18 -0
- package/dist/theme/runtime.js +19 -0
- package/dist/theme/seo.d.ts +6 -0
- package/dist/theme/seo.js +12 -0
- package/dist/theme/server.d.ts +65 -0
- package/dist/theme/server.js +177 -0
- package/dist/theme/setting.d.ts +12 -0
- package/dist/theme/setting.js +42 -0
- package/dist/theme/ssr/bootstrap.d.ts +48 -0
- package/dist/theme/ssr/bootstrap.js +112 -0
- package/dist/theme/ssr/fetch.d.ts +134 -0
- package/dist/theme/ssr/fetch.js +264 -0
- package/dist/theme/ssr/format.d.ts +3 -0
- package/dist/theme/ssr/format.js +8 -0
- package/dist/theme/ssr/pageProps.d.ts +62 -0
- package/dist/theme/ssr/pageProps.js +138 -0
- package/dist/theme/ssr/setting.d.ts +12 -0
- package/dist/theme/ssr/setting.js +42 -0
- package/dist/theme/ssr/slimBootstrap.d.ts +11 -0
- package/dist/theme/ssr/slimBootstrap.js +75 -0
- package/dist/theme/ssr/static.d.ts +10 -0
- package/dist/theme/ssr/static.js +17 -0
- package/dist/theme/ssr/templates.d.ts +35 -0
- package/dist/theme/ssr/templates.js +50 -0
- package/dist/theme/static.d.ts +10 -0
- package/dist/theme/static.js +17 -0
- package/dist/theme/templates.d.ts +27 -0
- package/dist/theme/templates.js +38 -0
- package/dist/theme/ui-optional.d.ts +1 -0
- package/dist/theme/ui-optional.js +21 -0
- package/dist/theme/visitor/appearance.d.ts +4 -0
- package/dist/theme/visitor/appearance.js +16 -0
- package/dist/theme/visitor/authSession.d.ts +16 -0
- package/dist/theme/visitor/authSession.js +92 -0
- package/dist/theme/visitor/colorMode.d.ts +17 -0
- package/dist/theme/visitor/colorMode.js +59 -0
- package/dist/theme/visitor/commentAuthor.d.ts +16 -0
- package/dist/theme/visitor/commentAuthor.js +45 -0
- package/dist/theme/visitor/i18n.d.ts +4 -0
- package/dist/theme/visitor/i18n.js +28 -0
- package/dist/theme/visitor/locale.d.ts +23 -0
- package/dist/theme/visitor/locale.js +72 -0
- package/dist/theme/visitor/runtime.d.ts +18 -0
- package/dist/theme/visitor/runtime.js +19 -0
- package/dist/theme/visitor/visitorLocale.d.ts +11 -0
- package/dist/theme/visitor/visitorLocale.js +56 -0
- package/dist/theme/visitorLocale.d.ts +6 -0
- package/dist/theme/visitorLocale.js +39 -0
- package/dist/types/index.d.ts +79 -68
- package/dist/ui/AntdStyleTransitionFix.d.ts +5 -0
- package/dist/ui/AntdStyleTransitionFix.js +16 -0
- package/dist/ui/ArchiveEmptyState.d.ts +13 -0
- package/dist/ui/ArchiveEmptyState.js +8 -0
- package/dist/ui/ArchivePageLayout.d.ts +10 -0
- package/dist/ui/ArchivePageLayout.js +8 -0
- package/dist/ui/ArticleCard.d.ts +27 -0
- package/dist/ui/ArticleCard.js +16 -0
- package/dist/ui/ArticleList.d.ts +14 -0
- package/dist/ui/ArticleList.js +16 -0
- package/dist/ui/BaseGlobalStyles.d.ts +5 -0
- package/dist/ui/BaseGlobalStyles.js +18 -0
- package/dist/ui/LocaleSwitcher.d.ts +7 -0
- package/dist/ui/LocaleSwitcher.js +15 -0
- package/dist/ui/NavMenu.d.ts +16 -0
- package/dist/ui/NavMenu.js +8 -0
- package/dist/ui/NotFoundPanel.d.ts +11 -0
- package/dist/ui/NotFoundPanel.js +8 -0
- package/dist/ui/PageHeader.d.ts +10 -0
- package/dist/ui/PageHeader.js +8 -0
- package/dist/ui/SiteBranding.d.ts +10 -0
- package/dist/ui/SiteBranding.js +14 -0
- package/dist/ui/SiteDocument.d.ts +20 -0
- package/dist/ui/SiteDocument.js +13 -0
- package/dist/ui/SiteDocumentFallback.d.ts +8 -0
- package/dist/ui/SiteDocumentFallback.js +9 -0
- package/dist/ui/SiteLogo.d.ts +6 -0
- package/dist/ui/SiteLogo.js +16 -0
- package/dist/ui/SiteTagline.d.ts +7 -0
- package/dist/ui/SiteTagline.js +15 -0
- package/dist/ui/TaxonomyList.d.ts +25 -0
- package/dist/ui/TaxonomyList.js +30 -0
- package/dist/ui/ThemeCssVars.d.ts +2 -0
- package/dist/ui/ThemeCssVars.js +85 -0
- package/dist/ui/ThemeLayout.d.ts +13 -0
- package/dist/ui/ThemeLayout.js +11 -0
- package/dist/ui/components/AntdStyleTransitionFix.d.ts +5 -0
- package/dist/ui/components/AntdStyleTransitionFix.js +16 -0
- package/dist/ui/components/ArchiveEmptyState.d.ts +13 -0
- package/dist/ui/components/ArchiveEmptyState.js +8 -0
- package/dist/ui/components/ArchivePageLayout.d.ts +10 -0
- package/dist/ui/components/ArchivePageLayout.js +8 -0
- package/dist/ui/components/ArticleCard.d.ts +27 -0
- package/dist/ui/components/ArticleCard.js +16 -0
- package/dist/ui/components/ArticleList.d.ts +14 -0
- package/dist/ui/components/ArticleList.js +16 -0
- package/dist/ui/components/BaseGlobalStyles.d.ts +6 -0
- package/dist/ui/components/BaseGlobalStyles.js +18 -0
- package/dist/ui/components/LocaleSwitcher.d.ts +10 -0
- package/dist/ui/components/LocaleSwitcher.js +11 -0
- package/dist/ui/components/NavMenu.d.ts +16 -0
- package/dist/ui/components/NavMenu.js +8 -0
- package/dist/ui/components/NotFoundPanel.d.ts +11 -0
- package/dist/ui/components/NotFoundPanel.js +8 -0
- package/dist/ui/components/PageHeader.d.ts +10 -0
- package/dist/ui/components/PageHeader.js +8 -0
- package/dist/ui/components/RouteProgress.d.ts +9 -0
- package/dist/ui/components/RouteProgress.js +40 -0
- package/dist/ui/components/SiteAnalytics.d.ts +5 -0
- package/dist/ui/components/SiteAnalytics.js +42 -0
- package/dist/ui/components/SiteBranding.d.ts +11 -0
- package/dist/ui/components/SiteBranding.js +14 -0
- package/dist/ui/components/SiteDocument.d.ts +20 -0
- package/dist/ui/components/SiteDocument.js +13 -0
- package/dist/ui/components/SiteDocumentFallback.d.ts +8 -0
- package/dist/ui/components/SiteDocumentFallback.js +9 -0
- package/dist/ui/components/SiteLogo.d.ts +9 -0
- package/dist/ui/components/SiteLogo.js +23 -0
- package/dist/ui/components/SiteSeo.d.ts +13 -0
- package/dist/ui/components/SiteSeo.js +19 -0
- package/dist/ui/components/SiteTagline.d.ts +8 -0
- package/dist/ui/components/SiteTagline.js +15 -0
- package/dist/ui/components/TaxonomyList.d.ts +25 -0
- package/dist/ui/components/TaxonomyList.js +30 -0
- package/dist/ui/components/ThemeCssVars.d.ts +3 -0
- package/dist/ui/components/ThemeCssVars.js +85 -0
- package/dist/ui/components/ThemeLayout.d.ts +13 -0
- package/dist/ui/components/ThemeLayout.js +11 -0
- package/dist/ui/components/content/ArticleReader.d.ts +45 -0
- package/dist/ui/components/content/ArticleReader.js +23 -0
- package/dist/ui/components/content/ArticleToc.d.ts +21 -0
- package/dist/ui/components/content/ArticleToc.js +75 -0
- package/dist/ui/components/content/HtmlContent.d.ts +16 -0
- package/dist/ui/components/content/HtmlContent.js +237 -0
- package/dist/ui/components/content/Image.d.ts +9 -0
- package/dist/ui/components/content/Image.js +13 -0
- package/dist/ui/components/content/ImageViewer.d.ts +8 -0
- package/dist/ui/components/content/ImageViewer.js +33 -0
- package/dist/ui/components/content/LocaleTime.d.ts +10 -0
- package/dist/ui/components/content/LocaleTime.js +63 -0
- package/dist/ui/components/content/index.d.ts +14 -0
- package/dist/ui/components/content/index.js +18 -0
- package/dist/ui/components/toolbar/LocaleToggleButton.d.ts +8 -0
- package/dist/ui/components/toolbar/LocaleToggleButton.js +18 -0
- package/dist/ui/components/toolbar/ThemeToggleButton.d.ts +7 -0
- package/dist/ui/components/toolbar/ThemeToggleButton.js +10 -0
- package/dist/ui/components/toolbar/ToolbarIconButton.d.ts +7 -0
- package/dist/ui/components/toolbar/ToolbarIconButton.js +22 -0
- package/dist/ui/components/toolbar/constants.d.ts +5 -0
- package/dist/ui/components/toolbar/constants.js +8 -0
- package/dist/ui/components/toolbar/icons.d.ts +17 -0
- package/dist/ui/components/toolbar/icons.js +44 -0
- package/dist/ui/components/toolbar/index.d.ts +9 -0
- package/dist/ui/components/toolbar/index.js +25 -0
- package/dist/ui/components/toolbar/locale-label.d.ts +3 -0
- package/dist/ui/components/toolbar/locale-label.js +19 -0
- package/dist/ui/context/LocaleContext.d.ts +15 -0
- package/dist/ui/context/LocaleContext.js +59 -0
- package/dist/ui/context/ReactPressProvider.d.ts +4 -0
- package/dist/ui/context/ReactPressProvider.js +10 -0
- package/dist/ui/context/SiteCatalogContext.d.ts +41 -0
- package/dist/ui/context/SiteCatalogContext.js +60 -0
- package/dist/ui/context/ThemeRuntimeContext.d.ts +21 -0
- package/dist/ui/context/ThemeRuntimeContext.js +59 -0
- package/dist/ui/context/index.d.ts +8 -0
- package/dist/ui/context/index.js +26 -0
- package/dist/ui/context/siteCatalogTypes.d.ts +64 -0
- package/dist/ui/context/siteCatalogTypes.js +20 -0
- package/dist/ui/context/types.d.ts +34 -0
- package/dist/ui/context/types.js +2 -0
- package/dist/ui/hooks/index.d.ts +12 -0
- package/dist/ui/hooks/index.js +29 -0
- package/dist/ui/hooks/useAsyncLoading.d.ts +4 -0
- package/dist/ui/hooks/useAsyncLoading.js +31 -0
- package/dist/ui/hooks/useForceUpdate.d.ts +2 -0
- package/dist/ui/hooks/useForceUpdate.js +11 -0
- package/dist/ui/hooks/useNavActive.d.ts +5 -0
- package/dist/ui/hooks/useNavActive.js +11 -0
- package/dist/ui/hooks/usePagination.d.ts +34 -0
- package/dist/ui/hooks/usePagination.js +55 -0
- package/dist/ui/hooks/useReportArticleView.d.ts +4 -0
- package/dist/ui/hooks/useReportArticleView.js +40 -0
- package/dist/ui/hooks/useReportPageView.d.ts +11 -0
- package/dist/ui/hooks/useReportPageView.js +28 -0
- package/dist/ui/hooks/useRouteParam.d.ts +5 -0
- package/dist/ui/hooks/useRouteParam.js +15 -0
- package/dist/ui/hooks/useToggle.d.ts +2 -0
- package/dist/ui/hooks/useToggle.js +17 -0
- package/dist/ui/hooks/useWarningOnExit.d.ts +5 -0
- package/dist/ui/hooks/useWarningOnExit.js +59 -0
- package/dist/ui/index.d.ts +43 -0
- package/dist/ui/index.js +87 -0
- package/dist/utils/api-envelope.d.ts +14 -0
- package/dist/utils/api-envelope.js +31 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.js +24 -0
- package/dist/utils/cookie.d.ts +2 -0
- package/dist/utils/cookie.js +15 -0
- package/dist/utils/date.d.ts +4 -0
- package/dist/utils/date.js +45 -0
- package/dist/utils/email.d.ts +3 -0
- package/dist/utils/email.js +9 -0
- package/dist/utils/error.d.ts +7 -0
- package/dist/utils/error.js +26 -0
- package/dist/utils/image.d.ts +7 -0
- package/dist/utils/image.js +34 -0
- package/dist/utils/index.d.ts +15 -33
- package/dist/utils/index.js +37 -57
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.js +18 -0
- package/dist/utils/jsonp.d.ts +8 -0
- package/dist/utils/jsonp.js +27 -0
- package/dist/utils/object.d.ts +7 -0
- package/dist/utils/object.js +63 -0
- package/dist/utils/setting.d.ts +12 -0
- package/dist/utils/setting.js +13 -0
- package/dist/utils/string.d.ts +4 -0
- package/dist/utils/string.js +15 -0
- package/dist/utils/viewport.d.ts +3 -0
- package/dist/utils/viewport.js +14 -0
- package/package.json +141 -12
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
exports.createClient = createClient;
|
|
5
|
+
exports.getDefaultApiBaseUrl = getDefaultApiBaseUrl;
|
|
6
|
+
const instance_1 = require("../api/instance");
|
|
7
|
+
class ApiError extends Error {
|
|
8
|
+
constructor(code, message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'ApiError';
|
|
11
|
+
this.code = code;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ApiError = ApiError;
|
|
15
|
+
function readApiMessage(value) {
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
const trimmed = value.trim();
|
|
18
|
+
return trimmed ? trimmed : null;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
const parts = value
|
|
22
|
+
.map((item) => readApiMessage(item))
|
|
23
|
+
.filter((item) => Boolean(item));
|
|
24
|
+
return parts.length ? parts.join(', ') : null;
|
|
25
|
+
}
|
|
26
|
+
if (value && typeof value === 'object') {
|
|
27
|
+
const payload = value;
|
|
28
|
+
return readApiMessage(payload.message) ?? readApiMessage(payload.msg);
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function rejectApiError(status, payload) {
|
|
33
|
+
if (typeof payload.code === 'number' && payload.code !== 0) {
|
|
34
|
+
return Promise.reject(new ApiError(payload.code, readApiMessage(payload.message) ?? 'Request failed'));
|
|
35
|
+
}
|
|
36
|
+
const message = readApiMessage(payload.msg) ?? readApiMessage(payload.message);
|
|
37
|
+
if (message) {
|
|
38
|
+
return Promise.reject(new ApiError(Number(payload.statusCode ?? status ?? 500), message));
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
function attachInterceptors(http, options) {
|
|
43
|
+
http.instance.interceptors.request.use((config) => {
|
|
44
|
+
const token = options.getAccessToken?.();
|
|
45
|
+
if (token && config.headers) {
|
|
46
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
47
|
+
}
|
|
48
|
+
return config;
|
|
49
|
+
});
|
|
50
|
+
http.instance.interceptors.response.use((response) => {
|
|
51
|
+
const body = response.data;
|
|
52
|
+
if (!body || typeof body !== 'object')
|
|
53
|
+
return response;
|
|
54
|
+
if (typeof body.code === 'number') {
|
|
55
|
+
if (body.code !== 0) {
|
|
56
|
+
throw new ApiError(body.code, readApiMessage(body.message) ?? 'Request failed');
|
|
57
|
+
}
|
|
58
|
+
response.data = body.data;
|
|
59
|
+
return response;
|
|
60
|
+
}
|
|
61
|
+
if (typeof body.success === 'boolean') {
|
|
62
|
+
if (!body.success) {
|
|
63
|
+
throw new ApiError(Number(body.statusCode ?? 500), readApiMessage(body.msg) ?? 'Request failed');
|
|
64
|
+
}
|
|
65
|
+
response.data = body.data;
|
|
66
|
+
return response;
|
|
67
|
+
}
|
|
68
|
+
return response;
|
|
69
|
+
}, (error) => {
|
|
70
|
+
const status = error?.response?.status;
|
|
71
|
+
if (status === 401) {
|
|
72
|
+
options.onUnauthorized?.();
|
|
73
|
+
}
|
|
74
|
+
const body = error?.response?.data;
|
|
75
|
+
if (body && typeof body === 'object') {
|
|
76
|
+
const rejected = rejectApiError(status, body);
|
|
77
|
+
if (rejected)
|
|
78
|
+
return rejected;
|
|
79
|
+
}
|
|
80
|
+
return Promise.reject(error);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** Single factory for web / theme / plugins — wraps generated API modules. */
|
|
84
|
+
function createClient(options = {}) {
|
|
85
|
+
const baseURL = options.baseURL ?? 'http://localhost:3002/api';
|
|
86
|
+
const client = (0, instance_1.createApiInstance)({ baseURL });
|
|
87
|
+
attachInterceptors(client.article.http, options);
|
|
88
|
+
return client;
|
|
89
|
+
}
|
|
90
|
+
function getDefaultApiBaseUrl() {
|
|
91
|
+
if (typeof process !== 'undefined' && process.env?.SERVER_API_URL) {
|
|
92
|
+
return process.env.SERVER_API_URL;
|
|
93
|
+
}
|
|
94
|
+
return 'http://localhost:3002/api';
|
|
95
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ClientOptions, ReactPressClient } from './client';
|
|
2
|
+
export { ApiError, createClient, getDefaultApiBaseUrl } from './client';
|
|
3
|
+
export type { AppRuntime, DesktopApi } from './runtime';
|
|
4
|
+
export { getDesktopApi, getRuntime, resolveApiBaseUrl, } from './runtime';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveApiBaseUrl = exports.getRuntime = exports.getDesktopApi = exports.getDefaultApiBaseUrl = exports.createClient = exports.ApiError = void 0;
|
|
4
|
+
var client_1 = require("./client");
|
|
5
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return client_1.ApiError; } });
|
|
6
|
+
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } });
|
|
7
|
+
Object.defineProperty(exports, "getDefaultApiBaseUrl", { enumerable: true, get: function () { return client_1.getDefaultApiBaseUrl; } });
|
|
8
|
+
var runtime_1 = require("./runtime");
|
|
9
|
+
Object.defineProperty(exports, "getDesktopApi", { enumerable: true, get: function () { return runtime_1.getDesktopApi; } });
|
|
10
|
+
Object.defineProperty(exports, "getRuntime", { enumerable: true, get: function () { return runtime_1.getRuntime; } });
|
|
11
|
+
Object.defineProperty(exports, "resolveApiBaseUrl", { enumerable: true, get: function () { return runtime_1.resolveApiBaseUrl; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type AppRuntime = 'web' | 'electron';
|
|
2
|
+
export interface DesktopApi {
|
|
3
|
+
getApiBaseUrl: () => Promise<string>;
|
|
4
|
+
setApiBaseUrl: (url: string) => Promise<void>;
|
|
5
|
+
showSaveDialog: (opts: {
|
|
6
|
+
defaultPath?: string;
|
|
7
|
+
}) => Promise<string | undefined>;
|
|
8
|
+
openExternal: (url: string) => Promise<void>;
|
|
9
|
+
platform: NodeJS.Platform;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface Window {
|
|
13
|
+
reactpressDesktop?: DesktopApi;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export declare function getRuntime(): AppRuntime;
|
|
17
|
+
export declare function getDesktopApi(): DesktopApi | undefined;
|
|
18
|
+
export declare function resolveApiBaseUrl(fallback: string): Promise<string>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntime = getRuntime;
|
|
4
|
+
exports.getDesktopApi = getDesktopApi;
|
|
5
|
+
exports.resolveApiBaseUrl = resolveApiBaseUrl;
|
|
6
|
+
function getRuntime() {
|
|
7
|
+
if (typeof window !== 'undefined' && window.reactpressDesktop) {
|
|
8
|
+
return 'electron';
|
|
9
|
+
}
|
|
10
|
+
return 'web';
|
|
11
|
+
}
|
|
12
|
+
function getDesktopApi() {
|
|
13
|
+
if (typeof window === 'undefined')
|
|
14
|
+
return undefined;
|
|
15
|
+
return window.reactpressDesktop;
|
|
16
|
+
}
|
|
17
|
+
async function resolveApiBaseUrl(fallback) {
|
|
18
|
+
const desktop = getDesktopApi();
|
|
19
|
+
if (desktop) {
|
|
20
|
+
try {
|
|
21
|
+
const url = await desktop.getApiBaseUrl();
|
|
22
|
+
if (url)
|
|
23
|
+
return url;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// fall through
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return fallback;
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DocumentContext } from 'next/document';
|
|
2
|
+
import type { IncomingMessage } from 'http';
|
|
3
|
+
export type CreateAntdThemeDocumentOptions = {
|
|
4
|
+
resolveLocale?: (req?: IncomingMessage) => string;
|
|
5
|
+
colorModeScript?: string | false;
|
|
6
|
+
defaultLocale?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function createAntdThemeDocument(options?: CreateAntdThemeDocumentOptions): {
|
|
9
|
+
({ locale }: {
|
|
10
|
+
locale?: string;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
getInitialProps(ctx: DocumentContext): Promise<{
|
|
13
|
+
locale: string;
|
|
14
|
+
styles: import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
html: string;
|
|
16
|
+
head?: Array<JSX.Element | null>;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createAntdThemeDocument = createAntdThemeDocument;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const cssinjs_1 = require("@ant-design/cssinjs");
|
|
39
|
+
const document_1 = __importStar(require("next/document"));
|
|
40
|
+
const colorMode_1 = require("./colorMode");
|
|
41
|
+
function createAntdThemeDocument(options = {}) {
|
|
42
|
+
const { resolveLocale, colorModeScript = colorMode_1.colorModeInitScript, defaultLocale = 'zh', } = options;
|
|
43
|
+
const ThemeDocument = ({ locale }) => ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale || defaultLocale, suppressHydrationWarning: true, children: [(0, jsx_runtime_1.jsx)(document_1.Head, {}), (0, jsx_runtime_1.jsxs)("body", { suppressHydrationWarning: true, children: [colorModeScript ? ((0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: { __html: colorModeScript } })) : null, (0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
|
|
44
|
+
ThemeDocument.getInitialProps = async (ctx) => {
|
|
45
|
+
const cache = (0, cssinjs_1.createCache)();
|
|
46
|
+
const originalRenderPage = ctx.renderPage;
|
|
47
|
+
ctx.renderPage = () => originalRenderPage({
|
|
48
|
+
enhanceApp: (App) => (props) => ((0, jsx_runtime_1.jsx)(cssinjs_1.StyleProvider, { cache: cache, children: (0, jsx_runtime_1.jsx)(App, { ...props }) })),
|
|
49
|
+
});
|
|
50
|
+
const initialProps = await document_1.default.getInitialProps(ctx);
|
|
51
|
+
const style = (0, cssinjs_1.extractStyle)(cache, true);
|
|
52
|
+
return {
|
|
53
|
+
...initialProps,
|
|
54
|
+
locale: resolveLocale?.(ctx.req) ?? defaultLocale,
|
|
55
|
+
styles: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [initialProps.styles, (0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: style } })] })),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
return ThemeDocument;
|
|
59
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unpackPaginatedPair = exports.unpackPaginated = exports.unpackOne = exports.unpackList = void 0;
|
|
4
|
+
var api_envelope_1 = require("../../utils/api-envelope");
|
|
5
|
+
Object.defineProperty(exports, "unpackList", { enumerable: true, get: function () { return api_envelope_1.unpackList; } });
|
|
6
|
+
Object.defineProperty(exports, "unpackOne", { enumerable: true, get: function () { return api_envelope_1.unpackOne; } });
|
|
7
|
+
Object.defineProperty(exports, "unpackPaginated", { enumerable: true, get: function () { return api_envelope_1.unpackPaginated; } });
|
|
8
|
+
Object.defineProperty(exports, "unpackPaginatedPair", { enumerable: true, get: function () { return api_envelope_1.unpackPaginatedPair; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createApiInstance } from '../../api/instance';
|
|
2
|
+
export type ThemeApi = ReturnType<typeof createApiInstance>;
|
|
3
|
+
/**
|
|
4
|
+
* Base URL for theme API calls.
|
|
5
|
+
* SSR uses REACTPRESS_API_URL (direct :3002); browser uses NEXT_PUBLIC_* (often nginx /api).
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveThemeApiBaseUrl(): string;
|
|
8
|
+
/** Create a theme-scoped API client (override baseURL for tests or multi-tenant). */
|
|
9
|
+
export declare function createThemeApi(config?: {
|
|
10
|
+
baseURL?: string;
|
|
11
|
+
}): ThemeApi;
|
|
12
|
+
/** Default theme API client — same env contract as `reactpress theme dev`. */
|
|
13
|
+
export declare const themeApi: {
|
|
14
|
+
article: import("../../api/Article").Article<unknown>;
|
|
15
|
+
auth: import("../../api/Auth").Auth<unknown>;
|
|
16
|
+
category: import("../../api/Category").Category<unknown>;
|
|
17
|
+
comment: import("../../api/Comment").Comment<unknown>;
|
|
18
|
+
file: import("../../api/File").File<unknown>;
|
|
19
|
+
knowledge: import("../../api/Knowledge").Knowledge<unknown>;
|
|
20
|
+
page: import("../../api/Page").Page<unknown>;
|
|
21
|
+
search: import("../../api/Search").Search<unknown>;
|
|
22
|
+
setting: import("../../api/Setting").Setting<unknown>;
|
|
23
|
+
smtp: import("../../api/Smtp").Smtp<unknown>;
|
|
24
|
+
tag: import("../../api/Tag").Tag<unknown>;
|
|
25
|
+
user: import("../../api/User").User<unknown>;
|
|
26
|
+
view: import("../../api/View").View<unknown>;
|
|
27
|
+
};
|
|
28
|
+
export declare function getThemeApiBaseUrl(): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.themeApi = void 0;
|
|
4
|
+
exports.resolveThemeApiBaseUrl = resolveThemeApiBaseUrl;
|
|
5
|
+
exports.createThemeApi = createThemeApi;
|
|
6
|
+
exports.getThemeApiBaseUrl = getThemeApiBaseUrl;
|
|
7
|
+
const instance_1 = require("../../api/instance");
|
|
8
|
+
/**
|
|
9
|
+
* Base URL for theme API calls.
|
|
10
|
+
* SSR uses REACTPRESS_API_URL (direct :3002); browser uses NEXT_PUBLIC_* (often nginx /api).
|
|
11
|
+
*/
|
|
12
|
+
function resolveThemeApiBaseUrl() {
|
|
13
|
+
const serverBaseURL = process.env.REACTPRESS_API_URL || 'http://localhost:3002/api';
|
|
14
|
+
const browserBaseURL = process.env.NEXT_PUBLIC_REACTPRESS_API_URL || serverBaseURL;
|
|
15
|
+
return typeof window === 'undefined' ? serverBaseURL : browserBaseURL;
|
|
16
|
+
}
|
|
17
|
+
/** Create a theme-scoped API client (override baseURL for tests or multi-tenant). */
|
|
18
|
+
function createThemeApi(config) {
|
|
19
|
+
return (0, instance_1.createApiInstance)({
|
|
20
|
+
baseURL: config?.baseURL ?? resolveThemeApiBaseUrl(),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Default theme API client — same env contract as `reactpress theme dev`. */
|
|
24
|
+
exports.themeApi = createThemeApi();
|
|
25
|
+
function getThemeApiBaseUrl() {
|
|
26
|
+
return resolveThemeApiBaseUrl();
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
|
+
export interface ThemeApiEnvelope<T = unknown> {
|
|
3
|
+
statusCode: number;
|
|
4
|
+
success: boolean;
|
|
5
|
+
msg: string | null;
|
|
6
|
+
data: T;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateThemeAxiosClientOptions {
|
|
9
|
+
baseURL?: string;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
getAccessToken?: () => string | null;
|
|
12
|
+
onError?: (message: string, status?: number) => void;
|
|
13
|
+
onUnauthorized?: () => void;
|
|
14
|
+
unwrapEnvelope?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Theme axios base URL (SSR + client).
|
|
18
|
+
* Do not read `process.env.SERVER_API_URL` here — Next inlines it from next.config at compile time
|
|
19
|
+
* and stale values (e.g. localhost:3002) break `--remote-origin` dev.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveThemeAxiosBaseUrl(): string;
|
|
22
|
+
/** Encode dynamic path segments (e.g. Chinese tag names) for Node fetch / axios. */
|
|
23
|
+
export declare function encodeAxiosUrlPath(url: string): string;
|
|
24
|
+
export declare function createThemeAxiosClient(options?: CreateThemeAxiosClientOptions): AxiosInstance;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveThemeAxiosBaseUrl = resolveThemeAxiosBaseUrl;
|
|
7
|
+
exports.encodeAxiosUrlPath = encodeAxiosUrlPath;
|
|
8
|
+
exports.createThemeAxiosClient = createThemeAxiosClient;
|
|
9
|
+
const axios_1 = __importDefault(require("axios"));
|
|
10
|
+
const authSession_1 = require("../visitor/authSession");
|
|
11
|
+
const api_1 = require("./api");
|
|
12
|
+
/**
|
|
13
|
+
* Theme axios base URL (SSR + client).
|
|
14
|
+
* Do not read `process.env.SERVER_API_URL` here — Next inlines it from next.config at compile time
|
|
15
|
+
* and stale values (e.g. localhost:3002) break `--remote-origin` dev.
|
|
16
|
+
*/
|
|
17
|
+
function resolveThemeAxiosBaseUrl() {
|
|
18
|
+
return (0, api_1.resolveThemeApiBaseUrl)();
|
|
19
|
+
}
|
|
20
|
+
/** Encode dynamic path segments (e.g. Chinese tag names) for Node fetch / axios. */
|
|
21
|
+
function encodeAxiosUrlPath(url) {
|
|
22
|
+
const qIndex = url.indexOf('?');
|
|
23
|
+
const pathname = qIndex === -1 ? url : url.slice(0, qIndex);
|
|
24
|
+
const search = qIndex === -1 ? '' : url.slice(qIndex);
|
|
25
|
+
const encodedPath = pathname
|
|
26
|
+
.split('/')
|
|
27
|
+
.map((segment) => {
|
|
28
|
+
if (!segment)
|
|
29
|
+
return segment;
|
|
30
|
+
try {
|
|
31
|
+
return encodeURIComponent(decodeURIComponent(segment));
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return encodeURIComponent(segment);
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.join('/');
|
|
38
|
+
return encodedPath + search;
|
|
39
|
+
}
|
|
40
|
+
function createThemeAxiosClient(options = {}) {
|
|
41
|
+
const isBrowser = typeof window !== 'undefined';
|
|
42
|
+
const { baseURL = resolveThemeAxiosBaseUrl(), timeout = 60000, getAccessToken = authSession_1.getStoredAccessToken, onError, onUnauthorized, unwrapEnvelope = true, } = options;
|
|
43
|
+
const client = axios_1.default.create({ baseURL, timeout });
|
|
44
|
+
client.interceptors.request.use((config) => {
|
|
45
|
+
if (config.url) {
|
|
46
|
+
config.url = encodeAxiosUrlPath(config.url);
|
|
47
|
+
}
|
|
48
|
+
if (isBrowser) {
|
|
49
|
+
const token = getAccessToken();
|
|
50
|
+
if (config.headers && token) {
|
|
51
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return config;
|
|
55
|
+
}, () => {
|
|
56
|
+
throw new Error('Failed to send request');
|
|
57
|
+
});
|
|
58
|
+
client.interceptors.response.use((response) => {
|
|
59
|
+
if (!unwrapEnvelope) {
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
const payload = response.data;
|
|
63
|
+
if (!payload?.success) {
|
|
64
|
+
onError?.(payload?.msg || 'Request failed');
|
|
65
|
+
const message = payload?.msg || `Request failed (${payload?.statusCode ?? 'unknown'})`;
|
|
66
|
+
return Promise.reject(new Error(message));
|
|
67
|
+
}
|
|
68
|
+
return payload.data;
|
|
69
|
+
}, (err) => {
|
|
70
|
+
const status = err?.response?.status;
|
|
71
|
+
const msg = err?.response?.data?.msg;
|
|
72
|
+
if (status === 401) {
|
|
73
|
+
onUnauthorized?.();
|
|
74
|
+
onError?.(msg || 'Unauthorized');
|
|
75
|
+
}
|
|
76
|
+
else if (status) {
|
|
77
|
+
onError?.(msg || 'Server error', status);
|
|
78
|
+
}
|
|
79
|
+
const message = msg || err?.message || `HTTP ${status ?? 'error'}`;
|
|
80
|
+
return Promise.reject(new Error(message));
|
|
81
|
+
});
|
|
82
|
+
return client;
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { safeJsonParse } from '../../utils/json';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeJsonParse = void 0;
|
|
4
|
+
var json_1 = require("../../utils/json");
|
|
5
|
+
Object.defineProperty(exports, "safeJsonParse", { enumerable: true, get: function () { return json_1.safeJsonParse; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jsonp } from '../../utils/jsonp';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Nest TransformInterceptor body (axios already returns this as `response.data`). */
|
|
2
|
+
export interface ApiEnvelope<T = unknown> {
|
|
3
|
+
statusCode?: number;
|
|
4
|
+
msg?: string | null;
|
|
5
|
+
success?: boolean;
|
|
6
|
+
data?: T;
|
|
7
|
+
}
|
|
8
|
+
/** Paginated endpoints: `data` is `[items, total]`. */
|
|
9
|
+
export declare function unpackPaginated<T>(res: ApiEnvelope<[T[], number]> | null | undefined): T[];
|
|
10
|
+
/** List or single entity wrapped in `data`. */
|
|
11
|
+
export declare function unpackList<T>(res: ApiEnvelope<T[]> | null | undefined): T[];
|
|
12
|
+
export declare function unpackOne<T>(res: ApiEnvelope<T> | null | undefined): T | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unpackPaginated = unpackPaginated;
|
|
4
|
+
exports.unpackList = unpackList;
|
|
5
|
+
exports.unpackOne = unpackOne;
|
|
6
|
+
/** Paginated endpoints: `data` is `[items, total]`. */
|
|
7
|
+
function unpackPaginated(res) {
|
|
8
|
+
const payload = res?.data;
|
|
9
|
+
if (Array.isArray(payload) && Array.isArray(payload[0])) {
|
|
10
|
+
return payload[0];
|
|
11
|
+
}
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
/** List or single entity wrapped in `data`. */
|
|
15
|
+
function unpackList(res) {
|
|
16
|
+
const data = res?.data;
|
|
17
|
+
return Array.isArray(data) ? data : [];
|
|
18
|
+
}
|
|
19
|
+
function unpackOne(res) {
|
|
20
|
+
const data = res?.data;
|
|
21
|
+
return data != null ? data : null;
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createApiInstance } from '../api/instance';
|
|
2
|
+
export type ThemeApi = ReturnType<typeof createApiInstance>;
|
|
3
|
+
/**
|
|
4
|
+
* Base URL for theme API calls.
|
|
5
|
+
* SSR uses REACTPRESS_API_URL (direct :3002); browser uses NEXT_PUBLIC_* (often nginx /api).
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveThemeApiBaseUrl(): string;
|
|
8
|
+
/** Create a theme-scoped API client (override baseURL for tests or multi-tenant). */
|
|
9
|
+
export declare function createThemeApi(config?: {
|
|
10
|
+
baseURL?: string;
|
|
11
|
+
}): ThemeApi;
|
|
12
|
+
/** Default theme API client — same env contract as `reactpress theme dev`. */
|
|
13
|
+
export declare const themeApi: {
|
|
14
|
+
article: import("../api/Article").Article<unknown>;
|
|
15
|
+
auth: import("../api/Auth").Auth<unknown>;
|
|
16
|
+
category: import("../api/Category").Category<unknown>;
|
|
17
|
+
comment: import("../api/Comment").Comment<unknown>;
|
|
18
|
+
file: import("../api/File").File<unknown>;
|
|
19
|
+
knowledge: import("../api/Knowledge").Knowledge<unknown>;
|
|
20
|
+
page: import("../api/Page").Page<unknown>;
|
|
21
|
+
search: import("../api/Search").Search<unknown>;
|
|
22
|
+
setting: import("../api/Setting").Setting<unknown>;
|
|
23
|
+
smtp: import("../api/Smtp").Smtp<unknown>;
|
|
24
|
+
tag: import("../api/Tag").Tag<unknown>;
|
|
25
|
+
user: import("../api/User").User<unknown>;
|
|
26
|
+
view: import("../api/View").View<unknown>;
|
|
27
|
+
};
|
|
28
|
+
export declare function getThemeApiBaseUrl(): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.themeApi = void 0;
|
|
4
|
+
exports.resolveThemeApiBaseUrl = resolveThemeApiBaseUrl;
|
|
5
|
+
exports.createThemeApi = createThemeApi;
|
|
6
|
+
exports.getThemeApiBaseUrl = getThemeApiBaseUrl;
|
|
7
|
+
const instance_1 = require("../api/instance");
|
|
8
|
+
/**
|
|
9
|
+
* Base URL for theme API calls.
|
|
10
|
+
* SSR uses REACTPRESS_API_URL (direct :3002); browser uses NEXT_PUBLIC_* (often nginx /api).
|
|
11
|
+
*/
|
|
12
|
+
function resolveThemeApiBaseUrl() {
|
|
13
|
+
const serverBaseURL = process.env.REACTPRESS_API_URL || 'http://localhost:3002/api';
|
|
14
|
+
const browserBaseURL = process.env.NEXT_PUBLIC_REACTPRESS_API_URL || serverBaseURL;
|
|
15
|
+
return typeof window === 'undefined' ? serverBaseURL : browserBaseURL;
|
|
16
|
+
}
|
|
17
|
+
/** Create a theme-scoped API client (override baseURL for tests or multi-tenant). */
|
|
18
|
+
function createThemeApi(config) {
|
|
19
|
+
return (0, instance_1.createApiInstance)({
|
|
20
|
+
baseURL: config?.baseURL ?? resolveThemeApiBaseUrl(),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Default theme API client — same env contract as `reactpress theme dev`. */
|
|
24
|
+
exports.themeApi = createThemeApi();
|
|
25
|
+
function getThemeApiBaseUrl() {
|
|
26
|
+
return resolveThemeApiBaseUrl();
|
|
27
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ThemeManifest } from './extension/theme';
|
|
2
|
+
import type { ThemeMods } from './extension/theme';
|
|
3
|
+
/** Build default theme_mod values from `theme.json` → `appearance.sections`. */
|
|
4
|
+
export declare function defaultModsFromManifest(manifest: ThemeManifest | null | undefined): ThemeMods;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultModsFromManifest = defaultModsFromManifest;
|
|
4
|
+
/** Build default theme_mod values from `theme.json` → `appearance.sections`. */
|
|
5
|
+
function defaultModsFromManifest(manifest) {
|
|
6
|
+
const mods = {};
|
|
7
|
+
const sections = manifest?.appearance?.sections ?? [];
|
|
8
|
+
for (const section of sections) {
|
|
9
|
+
for (const setting of section.settings ?? []) {
|
|
10
|
+
if (setting.id && setting.default != null) {
|
|
11
|
+
mods[setting.id] = String(setting.default);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return mods;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvePublicAssetUrl = resolvePublicAssetUrl;
|
|
4
|
+
const api_1 = require("./api");
|
|
5
|
+
/** Resolve media / logo URLs for theme pages (relative `/api/...` → public API origin). */
|
|
6
|
+
function resolvePublicAssetUrl(url) {
|
|
7
|
+
const trimmed = (url ?? '').trim();
|
|
8
|
+
if (!trimmed)
|
|
9
|
+
return '';
|
|
10
|
+
if (/^https?:\/\//i.test(trimmed) || trimmed.startsWith('data:'))
|
|
11
|
+
return trimmed;
|
|
12
|
+
if (trimmed.startsWith('//')) {
|
|
13
|
+
const protocol = typeof window !== 'undefined' ? window.location.protocol : 'http:';
|
|
14
|
+
return `${protocol}${trimmed}`;
|
|
15
|
+
}
|
|
16
|
+
const apiBase = (0, api_1.resolveThemeApiBaseUrl)().replace(/\/$/, '');
|
|
17
|
+
const siteOrigin = typeof window !== 'undefined'
|
|
18
|
+
? window.location.origin
|
|
19
|
+
: apiBase.replace(/\/api\/?$/, '');
|
|
20
|
+
if (trimmed.startsWith('/api/')) {
|
|
21
|
+
return `${siteOrigin}${trimmed}`;
|
|
22
|
+
}
|
|
23
|
+
if (trimmed.startsWith('/')) {
|
|
24
|
+
return `${siteOrigin}${trimmed}`;
|
|
25
|
+
}
|
|
26
|
+
return trimmed;
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Zustand persist key used by the ReactPress admin (`web/src/stores/auth.ts`). */
|
|
2
|
+
export declare const ADMIN_AUTH_STORAGE_KEY = "auth-storage";
|
|
3
|
+
export declare const THEME_TOKEN_STORAGE_KEY = "token";
|
|
4
|
+
export declare const THEME_USER_STORAGE_KEY = "user";
|
|
5
|
+
export interface ThemeSessionUser {
|
|
6
|
+
name: string;
|
|
7
|
+
email: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
token: string;
|
|
10
|
+
role?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getStoredAccessToken(): string | null;
|
|
13
|
+
/** Resolve theme user from theme storage, or fall back to admin `auth-storage`. */
|
|
14
|
+
export declare function resolveStoredUser(): ThemeSessionUser | null;
|
|
15
|
+
export declare function persistThemeSession(user: ThemeSessionUser): void;
|
|
16
|
+
export declare function clearThemeSession(): void;
|