@fecommunity/reactpress-toolkit 3.0.4 → 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.
- package/README.md +194 -309
- 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 +88 -0
- package/dist/app/createReactPressApp.js +262 -0
- package/dist/app/createThemeApp.d.ts +6 -0
- package/dist/app/createThemeApp.js +47 -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/registry.d.ts +62 -0
- package/dist/plugin/admin/registry.js +79 -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/index.d.ts +9 -0
- package/dist/plugin/index.js +48 -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/runtime.d.ts +18 -0
- package/dist/plugin/react/runtime.js +30 -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 +17 -0
- package/dist/theme/build/next-config.js +100 -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 +5 -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 +10 -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 +8 -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 +7 -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 +2 -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 +15 -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 +9 -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 +3 -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 +129 -16
- package/LICENSE +0 -21
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Permission } from './permissions';
|
|
2
|
+
export type MenuNodeKind = 'group' | 'item';
|
|
3
|
+
export interface AdminMenuItem {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: MenuNodeKind;
|
|
6
|
+
title: string;
|
|
7
|
+
path: string | null;
|
|
8
|
+
icon?: string | null;
|
|
9
|
+
sort?: number;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
permissions?: Permission[] | null;
|
|
12
|
+
children?: AdminMenuItem[];
|
|
13
|
+
}
|
|
14
|
+
export interface MenuRegisterInput {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
path?: string | null;
|
|
18
|
+
icon?: string | null;
|
|
19
|
+
sort?: number;
|
|
20
|
+
hidden?: boolean;
|
|
21
|
+
permissions?: Permission[] | null;
|
|
22
|
+
children?: MenuRegisterInput[];
|
|
23
|
+
}
|
|
24
|
+
export interface SettingsTabInput {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
path: string;
|
|
28
|
+
permission?: Permission;
|
|
29
|
+
sort?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface RoutePermissionInput {
|
|
32
|
+
path: string;
|
|
33
|
+
permission: Permission | null;
|
|
34
|
+
}
|
|
35
|
+
export interface MenuRegistry {
|
|
36
|
+
register(input: MenuRegisterInput): void;
|
|
37
|
+
getTree(): AdminMenuItem[];
|
|
38
|
+
}
|
|
39
|
+
export interface SettingsRegistry {
|
|
40
|
+
registerTab(input: SettingsTabInput): void;
|
|
41
|
+
getTabs(): SettingsTabInput[];
|
|
42
|
+
}
|
|
43
|
+
export interface PermissionRegistry {
|
|
44
|
+
register(perms: Permission[]): void;
|
|
45
|
+
getAll(): Permission[];
|
|
46
|
+
}
|
|
47
|
+
export interface RouteRegistry {
|
|
48
|
+
registerRoute(input: RoutePermissionInput): void;
|
|
49
|
+
getRoutePermissions(): RoutePermissionInput[];
|
|
50
|
+
}
|
|
51
|
+
export interface AdminContext {
|
|
52
|
+
menu: MenuRegistry;
|
|
53
|
+
settings: SettingsRegistry;
|
|
54
|
+
permissions: PermissionRegistry;
|
|
55
|
+
routes: RouteRegistry;
|
|
56
|
+
}
|
|
57
|
+
export interface AdminModule {
|
|
58
|
+
id: string;
|
|
59
|
+
register(ctx: AdminContext): void;
|
|
60
|
+
}
|
|
61
|
+
export declare function createAdminRegistry(): AdminContext;
|
|
62
|
+
export declare function filterMenuByPermissions(nodes: AdminMenuItem[], granted: Set<string>): AdminMenuItem[];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAdminRegistry = createAdminRegistry;
|
|
4
|
+
exports.filterMenuByPermissions = filterMenuByPermissions;
|
|
5
|
+
function normalizeMenuInput(input) {
|
|
6
|
+
const hasChildren = Boolean(input.children?.length);
|
|
7
|
+
return {
|
|
8
|
+
id: input.id,
|
|
9
|
+
kind: hasChildren && !input.path ? 'group' : 'item',
|
|
10
|
+
title: input.title,
|
|
11
|
+
path: input.path ?? (hasChildren ? null : '/'),
|
|
12
|
+
icon: input.icon ?? null,
|
|
13
|
+
sort: input.sort ?? 0,
|
|
14
|
+
hidden: input.hidden ?? false,
|
|
15
|
+
permissions: input.permissions ?? null,
|
|
16
|
+
children: input.children?.map(normalizeMenuInput),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function createAdminRegistry() {
|
|
20
|
+
const menuItems = [];
|
|
21
|
+
const settingsTabs = [];
|
|
22
|
+
const permissions = new Set();
|
|
23
|
+
const routePermissions = [];
|
|
24
|
+
const menu = {
|
|
25
|
+
register(input) {
|
|
26
|
+
menuItems.push(normalizeMenuInput(input));
|
|
27
|
+
},
|
|
28
|
+
getTree() {
|
|
29
|
+
return [...menuItems].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const settings = {
|
|
33
|
+
registerTab(input) {
|
|
34
|
+
settingsTabs.push(input);
|
|
35
|
+
},
|
|
36
|
+
getTabs() {
|
|
37
|
+
return [...settingsTabs].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const permissionRegistry = {
|
|
41
|
+
register(perms) {
|
|
42
|
+
for (const p of perms)
|
|
43
|
+
permissions.add(p);
|
|
44
|
+
},
|
|
45
|
+
getAll() {
|
|
46
|
+
return [...permissions];
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const routes = {
|
|
50
|
+
registerRoute(input) {
|
|
51
|
+
routePermissions.push(input);
|
|
52
|
+
},
|
|
53
|
+
getRoutePermissions() {
|
|
54
|
+
return routePermissions;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
return { menu, settings, permissions: permissionRegistry, routes };
|
|
58
|
+
}
|
|
59
|
+
function filterMenuByPermissions(nodes, granted) {
|
|
60
|
+
const can = (required) => {
|
|
61
|
+
if (!required?.length)
|
|
62
|
+
return true;
|
|
63
|
+
return required.every((p) => granted.has(p));
|
|
64
|
+
};
|
|
65
|
+
const walk = (list) => list
|
|
66
|
+
.map((node) => {
|
|
67
|
+
if (!can(node.permissions))
|
|
68
|
+
return null;
|
|
69
|
+
if (node.children?.length) {
|
|
70
|
+
const children = walk(node.children);
|
|
71
|
+
if (children.length === 0)
|
|
72
|
+
return null;
|
|
73
|
+
return { ...node, children };
|
|
74
|
+
}
|
|
75
|
+
return node;
|
|
76
|
+
})
|
|
77
|
+
.filter((n) => n != null);
|
|
78
|
+
return walk(nodes);
|
|
79
|
+
}
|
package/dist/api/HttpClient.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, ResponseType } from 'axios';
|
|
2
|
-
export
|
|
2
|
+
export type QueryParamsType = Record<string | number, any>;
|
|
3
3
|
export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'params' | 'url' | 'responseType'> {
|
|
4
4
|
/** set parameter to `true` for call `securityWorker` for this request */
|
|
5
5
|
secure?: boolean;
|
|
@@ -14,7 +14,7 @@ export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'pa
|
|
|
14
14
|
/** request body */
|
|
15
15
|
body?: unknown;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
18
18
|
export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, 'data' | 'cancelToken'> {
|
|
19
19
|
securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
|
|
20
20
|
secure?: boolean;
|
package/dist/api/HttpClient.js
CHANGED
|
@@ -21,7 +21,7 @@ var ContentType;
|
|
|
21
21
|
ContentType["FormData"] = "multipart/form-data";
|
|
22
22
|
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
23
23
|
ContentType["Text"] = "text/plain";
|
|
24
|
-
})(ContentType
|
|
24
|
+
})(ContentType || (exports.ContentType = ContentType = {}));
|
|
25
25
|
class HttpClient {
|
|
26
26
|
constructor({ securityWorker, secure, format, ...axiosConfig } = {}) {
|
|
27
27
|
this.securityData = null;
|
package/dist/api/Smtp.d.ts
CHANGED
|
@@ -30,4 +30,21 @@ export declare class Smtp<SecurityDataType = unknown> {
|
|
|
30
30
|
* @response `200` `ISmtpControllerDeleteByIdData`
|
|
31
31
|
*/
|
|
32
32
|
deleteById: (id: string, params?: RequestParams) => Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* 发送测试邮件(验证 SMTP 配置)
|
|
35
|
+
*
|
|
36
|
+
* @tags Smtp
|
|
37
|
+
* @name SmtpControllerTestSend
|
|
38
|
+
* @request POST:/smtp/test
|
|
39
|
+
*/
|
|
40
|
+
testSend: (data: {
|
|
41
|
+
to: string;
|
|
42
|
+
smtpHost?: string;
|
|
43
|
+
smtpPort?: string;
|
|
44
|
+
smtpUser?: string;
|
|
45
|
+
smtpPass?: string;
|
|
46
|
+
smtpFromUser?: string;
|
|
47
|
+
}, params?: RequestParams) => Promise<{
|
|
48
|
+
ok: true;
|
|
49
|
+
}>;
|
|
33
50
|
}
|
package/dist/api/Smtp.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.Smtp = void 0;
|
|
14
|
+
const HttpClient_1 = require("./HttpClient");
|
|
14
15
|
class Smtp {
|
|
15
16
|
constructor(http) {
|
|
16
17
|
/**
|
|
@@ -52,6 +53,20 @@ class Smtp {
|
|
|
52
53
|
method: 'DELETE',
|
|
53
54
|
...params,
|
|
54
55
|
});
|
|
56
|
+
/**
|
|
57
|
+
* 发送测试邮件(验证 SMTP 配置)
|
|
58
|
+
*
|
|
59
|
+
* @tags Smtp
|
|
60
|
+
* @name SmtpControllerTestSend
|
|
61
|
+
* @request POST:/smtp/test
|
|
62
|
+
*/
|
|
63
|
+
this.testSend = (data, params = {}) => this.http.request({
|
|
64
|
+
path: `/smtp/test`,
|
|
65
|
+
method: 'POST',
|
|
66
|
+
body: data,
|
|
67
|
+
type: HttpClient_1.ContentType.Json,
|
|
68
|
+
...params,
|
|
69
|
+
});
|
|
55
70
|
this.http = http;
|
|
56
71
|
}
|
|
57
72
|
}
|
package/dist/api/instance.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { HttpClient } from './HttpClient';
|
|
2
1
|
import { Article } from './Article';
|
|
3
2
|
import { Auth } from './Auth';
|
|
4
3
|
import { Category } from './Category';
|
|
5
4
|
import { Comment } from './Comment';
|
|
6
5
|
import { File } from './File';
|
|
6
|
+
import { HttpClient } from './HttpClient';
|
|
7
7
|
import { Knowledge } from './Knowledge';
|
|
8
8
|
import { Page } from './Page';
|
|
9
9
|
import { Search } from './Search';
|
package/dist/api/instance.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.View = exports.User = exports.Tag = exports.Smtp = exports.Setting = exports.Search = exports.Page = exports.Knowledge = exports.File = exports.Comment = exports.Category = exports.Auth = exports.Article = exports.
|
|
4
|
-
|
|
3
|
+
exports.View = exports.User = exports.Tag = exports.Smtp = exports.Setting = exports.Search = exports.Page = exports.Knowledge = exports.File = exports.Comment = exports.Category = exports.Auth = exports.Article = exports.api = exports.http = void 0;
|
|
4
|
+
exports.createApiInstance = createApiInstance;
|
|
5
5
|
// Auto-generated API instance
|
|
6
6
|
const Article_1 = require("./Article");
|
|
7
7
|
Object.defineProperty(exports, "Article", { enumerable: true, get: function () { return Article_1.Article; } });
|
|
@@ -13,6 +13,7 @@ const Comment_1 = require("./Comment");
|
|
|
13
13
|
Object.defineProperty(exports, "Comment", { enumerable: true, get: function () { return Comment_1.Comment; } });
|
|
14
14
|
const File_1 = require("./File");
|
|
15
15
|
Object.defineProperty(exports, "File", { enumerable: true, get: function () { return File_1.File; } });
|
|
16
|
+
const HttpClient_1 = require("./HttpClient");
|
|
16
17
|
const Knowledge_1 = require("./Knowledge");
|
|
17
18
|
Object.defineProperty(exports, "Knowledge", { enumerable: true, get: function () { return Knowledge_1.Knowledge; } });
|
|
18
19
|
const Page_1 = require("./Page");
|
|
@@ -66,6 +67,5 @@ function createApiInstance(config) {
|
|
|
66
67
|
view: new View_1.View(customHttp),
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
exports.createApiInstance = createApiInstance;
|
|
70
70
|
// Export default API instance
|
|
71
71
|
exports.default = exports.api;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full-featured theme `_app` factory (UI-framework agnostic).
|
|
3
|
+
* Alias: `createCatalogThemeApp` (deprecated name).
|
|
4
|
+
*/
|
|
5
|
+
export function createReactPressApp(manifest: any, options?: {}): {
|
|
6
|
+
new (props: any): {
|
|
7
|
+
state: {
|
|
8
|
+
locale: string;
|
|
9
|
+
user: null;
|
|
10
|
+
/** Keep SSR and the first client render identical; sync from storage in componentDidMount. */
|
|
11
|
+
theme: string;
|
|
12
|
+
collapsed: boolean;
|
|
13
|
+
setting: null;
|
|
14
|
+
/** Full locale catalog — SSR may ship only the active locale to shrink `__NEXT_DATA__`. */
|
|
15
|
+
i18n: null;
|
|
16
|
+
};
|
|
17
|
+
prefetchRemainingI18nLocales: () => void;
|
|
18
|
+
changeLocale: (key: any) => void;
|
|
19
|
+
setUser: (user: any) => void;
|
|
20
|
+
removeUser: () => void;
|
|
21
|
+
changeTheme: (nextTheme: any) => void;
|
|
22
|
+
getSetting: () => void;
|
|
23
|
+
toggleCollapse: () => void;
|
|
24
|
+
componentDidMount(): void;
|
|
25
|
+
componentDidUpdate(_prevProps: any, prevState: any): void;
|
|
26
|
+
render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
27
|
+
context: unknown;
|
|
28
|
+
setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
|
|
29
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
30
|
+
readonly props: Readonly<any>;
|
|
31
|
+
refs: {
|
|
32
|
+
[key: string]: React.ReactInstance;
|
|
33
|
+
};
|
|
34
|
+
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
35
|
+
componentWillUnmount?(): void;
|
|
36
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
37
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
38
|
+
componentWillMount?(): void;
|
|
39
|
+
UNSAFE_componentWillMount?(): void;
|
|
40
|
+
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
41
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
42
|
+
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
43
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
44
|
+
};
|
|
45
|
+
new (props: any, context: any): {
|
|
46
|
+
state: {
|
|
47
|
+
locale: string;
|
|
48
|
+
user: null;
|
|
49
|
+
/** Keep SSR and the first client render identical; sync from storage in componentDidMount. */
|
|
50
|
+
theme: string;
|
|
51
|
+
collapsed: boolean;
|
|
52
|
+
setting: null;
|
|
53
|
+
/** Full locale catalog — SSR may ship only the active locale to shrink `__NEXT_DATA__`. */
|
|
54
|
+
i18n: null;
|
|
55
|
+
};
|
|
56
|
+
prefetchRemainingI18nLocales: () => void;
|
|
57
|
+
changeLocale: (key: any) => void;
|
|
58
|
+
setUser: (user: any) => void;
|
|
59
|
+
removeUser: () => void;
|
|
60
|
+
changeTheme: (nextTheme: any) => void;
|
|
61
|
+
getSetting: () => void;
|
|
62
|
+
toggleCollapse: () => void;
|
|
63
|
+
componentDidMount(): void;
|
|
64
|
+
componentDidUpdate(_prevProps: any, prevState: any): void;
|
|
65
|
+
render(): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
66
|
+
context: unknown;
|
|
67
|
+
setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
|
|
68
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
69
|
+
readonly props: Readonly<any>;
|
|
70
|
+
refs: {
|
|
71
|
+
[key: string]: React.ReactInstance;
|
|
72
|
+
};
|
|
73
|
+
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
74
|
+
componentWillUnmount?(): void;
|
|
75
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
76
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
77
|
+
componentWillMount?(): void;
|
|
78
|
+
UNSAFE_componentWillMount?(): void;
|
|
79
|
+
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
80
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
81
|
+
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
82
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
83
|
+
};
|
|
84
|
+
getInitialProps: (appContext: any) => Promise<any>;
|
|
85
|
+
origGetInitialProps: ({ Component, ctx, }: import("next/app").AppContext) => Promise<import("next/app").AppInitialProps>;
|
|
86
|
+
contextType?: React.Context<any> | undefined;
|
|
87
|
+
};
|
|
88
|
+
import React = require("react");
|
|
@@ -0,0 +1,262 @@
|
|
|
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, createDefaultAppBootstrap } = require('../theme/ssr/bootstrap');
|
|
6
|
+
const { slimAppBootstrapForRoute } = require('../theme/ssr/slimBootstrap');
|
|
7
|
+
const { createThemeAxiosClient } = require('../theme/api/httpClient');
|
|
8
|
+
const { createThemeProviders } = require('../theme/providers');
|
|
9
|
+
const { applyColorModeClass, resolveInitialColorModeState, persistColorMode, } = require('../theme/visitor/colorMode');
|
|
10
|
+
const { persistVisitorLocale, readBrowserCookie, VISITOR_LOCALE_COOKIE, LEGACY_LOCALE_STORAGE_KEY, } = require('../theme/visitor/visitorLocale');
|
|
11
|
+
const { clearThemeSession, persistThemeSession, resolveStoredUser, } = require('../theme/visitor/authSession');
|
|
12
|
+
const { RouteProgress } = require('../ui/components/RouteProgress');
|
|
13
|
+
const { SiteAnalytics } = require('../ui/components/SiteAnalytics');
|
|
14
|
+
const { SiteCatalogProvider } = require('../ui/context/SiteCatalogContext');
|
|
15
|
+
const { useReportPageView } = require('../ui/hooks/useReportPageView');
|
|
16
|
+
const { safeJsonParse } = require('../theme/api/json');
|
|
17
|
+
const { mergeVisitorI18n } = require('../theme/visitor/i18n');
|
|
18
|
+
function resolveGlobalSettingForLocale(setting, locale, fallback) {
|
|
19
|
+
if (!setting?.globalSetting)
|
|
20
|
+
return fallback;
|
|
21
|
+
const raw = setting.globalSetting;
|
|
22
|
+
const parsed = typeof raw === 'string' ? safeJsonParse(raw, {}) : raw && typeof raw === 'object' ? raw : {};
|
|
23
|
+
return parsed[locale] ?? fallback;
|
|
24
|
+
}
|
|
25
|
+
function readStoredVisitorLocale(locales) {
|
|
26
|
+
if (typeof window === 'undefined')
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const supported = Array.isArray(locales) ? locales : [];
|
|
30
|
+
const stored = window.localStorage.getItem('reactpress-locale') ||
|
|
31
|
+
window.localStorage.getItem('locale');
|
|
32
|
+
if (stored && supported.includes(stored))
|
|
33
|
+
return stored;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// ignore
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
function ViewStatisticsBridge() {
|
|
41
|
+
useReportPageView();
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Full-featured theme `_app` factory (UI-framework agnostic).
|
|
46
|
+
* Alias: `createCatalogThemeApp` (deprecated name).
|
|
47
|
+
*/
|
|
48
|
+
function createReactPressApp(manifest, options = {}) {
|
|
49
|
+
var _a;
|
|
50
|
+
const { Layout, buildAppearanceCss, httpClientOptions = {}, scrollToTopOnRouteChange = true, IntlProvider, wrapContent, transformBootstrap,
|
|
51
|
+
/** When true, apply default catalog-theme SSR payload slimming (nav routes keep full siteConfig). */
|
|
52
|
+
slimBootstrap = false, } = options;
|
|
53
|
+
if (!Layout) {
|
|
54
|
+
throw new Error('createReactPressApp: options.Layout is required');
|
|
55
|
+
}
|
|
56
|
+
if (!IntlProvider) {
|
|
57
|
+
throw new Error('createReactPressApp: options.IntlProvider is required — import { NextIntlProvider } from "next-intl" in your theme');
|
|
58
|
+
}
|
|
59
|
+
if (scrollToTopOnRouteChange) {
|
|
60
|
+
Router.events.on('routeChangeComplete', () => {
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
if (document.documentElement.scrollTop > 0) {
|
|
63
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
64
|
+
}
|
|
65
|
+
}, 0);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
class ReactPressThemeApp extends App {
|
|
69
|
+
constructor() {
|
|
70
|
+
super(...arguments);
|
|
71
|
+
this.state = {
|
|
72
|
+
locale: '',
|
|
73
|
+
user: null,
|
|
74
|
+
/** Keep SSR and the first client render identical; sync from storage in componentDidMount. */
|
|
75
|
+
theme: 'light',
|
|
76
|
+
collapsed: false,
|
|
77
|
+
setting: null,
|
|
78
|
+
/** Full locale catalog — SSR may ship only the active locale to shrink `__NEXT_DATA__`. */
|
|
79
|
+
i18n: null,
|
|
80
|
+
};
|
|
81
|
+
this.prefetchRemainingI18nLocales = () => {
|
|
82
|
+
const locales = this.props.locales;
|
|
83
|
+
if (!Array.isArray(locales) || locales.length <= 1)
|
|
84
|
+
return;
|
|
85
|
+
const current = this.state.i18n ?? this.props.i18n ?? {};
|
|
86
|
+
if (locales.every((key) => current[key]))
|
|
87
|
+
return;
|
|
88
|
+
const http = createThemeAxiosClient(httpClientOptions);
|
|
89
|
+
const { SettingProvider } = createThemeProviders(http);
|
|
90
|
+
SettingProvider.getSetting()
|
|
91
|
+
.then((res) => {
|
|
92
|
+
const full = mergeVisitorI18n(safeJsonParse(res.i18n, {}));
|
|
93
|
+
this.setState((prev) => ({
|
|
94
|
+
i18n: { ...(prev.i18n ?? this.props.i18n ?? {}), ...full },
|
|
95
|
+
}));
|
|
96
|
+
})
|
|
97
|
+
.catch(() => {
|
|
98
|
+
// ignore — active locale messages already available from SSR
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
this.changeLocale = (key) => {
|
|
102
|
+
if (!key)
|
|
103
|
+
return;
|
|
104
|
+
const active = this.state.locale ||
|
|
105
|
+
this.props.initialLocale ||
|
|
106
|
+
(Array.isArray(this.props.locales) && this.props.locales[0]) ||
|
|
107
|
+
'zh';
|
|
108
|
+
if (key === active)
|
|
109
|
+
return;
|
|
110
|
+
persistVisitorLocale(key);
|
|
111
|
+
const catalog = this.state.i18n ?? this.props.i18n ?? {};
|
|
112
|
+
if (!catalog[key]) {
|
|
113
|
+
this.prefetchRemainingI18nLocales();
|
|
114
|
+
}
|
|
115
|
+
this.setState({ locale: key });
|
|
116
|
+
};
|
|
117
|
+
this.setUser = (user) => {
|
|
118
|
+
persistThemeSession(user);
|
|
119
|
+
this.setState({ user });
|
|
120
|
+
};
|
|
121
|
+
this.removeUser = () => {
|
|
122
|
+
clearThemeSession();
|
|
123
|
+
this.setState({ user: null });
|
|
124
|
+
window.location.reload();
|
|
125
|
+
};
|
|
126
|
+
this.changeTheme = (nextTheme) => {
|
|
127
|
+
const isDark = nextTheme === 'dark';
|
|
128
|
+
applyColorModeClass(isDark);
|
|
129
|
+
persistColorMode(isDark);
|
|
130
|
+
this.setState({ theme: nextTheme });
|
|
131
|
+
};
|
|
132
|
+
this.getSetting = () => {
|
|
133
|
+
const http = createThemeAxiosClient(httpClientOptions);
|
|
134
|
+
const { SettingProvider } = createThemeProviders(http);
|
|
135
|
+
SettingProvider.getSetting().then((res) => {
|
|
136
|
+
this.setState({ setting: res });
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
this.toggleCollapse = () => {
|
|
140
|
+
this.setState({ collapsed: !this.state.collapsed });
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
componentDidMount() {
|
|
144
|
+
const user = resolveStoredUser();
|
|
145
|
+
if (user) {
|
|
146
|
+
persistThemeSession(user);
|
|
147
|
+
this.setState({ user });
|
|
148
|
+
}
|
|
149
|
+
const preferred = resolveInitialColorModeState() ?? 'light';
|
|
150
|
+
applyColorModeClass(preferred === 'dark');
|
|
151
|
+
const patches = {};
|
|
152
|
+
if (this.state.theme !== preferred) {
|
|
153
|
+
patches.theme = preferred;
|
|
154
|
+
}
|
|
155
|
+
const ssrLocale = this.props.initialLocale ||
|
|
156
|
+
(Array.isArray(this.props.locales) && this.props.locales.length > 0
|
|
157
|
+
? this.props.locales[0]
|
|
158
|
+
: 'zh');
|
|
159
|
+
const cookieLocale = readBrowserCookie(VISITOR_LOCALE_COOKIE) ||
|
|
160
|
+
readBrowserCookie(LEGACY_LOCALE_STORAGE_KEY);
|
|
161
|
+
const storedLocale = readStoredVisitorLocale(this.props.locales);
|
|
162
|
+
if (this.state.locale === '') {
|
|
163
|
+
if (cookieLocale &&
|
|
164
|
+
Array.isArray(this.props.locales) &&
|
|
165
|
+
this.props.locales.includes(cookieLocale) &&
|
|
166
|
+
cookieLocale !== ssrLocale) {
|
|
167
|
+
// Cookie is the source of truth for an explicit prior choice.
|
|
168
|
+
patches.locale = cookieLocale;
|
|
169
|
+
}
|
|
170
|
+
else if (!cookieLocale) {
|
|
171
|
+
// First visit or stale storage — align cookie/storage with SSR locale.
|
|
172
|
+
persistVisitorLocale(ssrLocale);
|
|
173
|
+
}
|
|
174
|
+
else if (storedLocale && storedLocale !== ssrLocale) {
|
|
175
|
+
persistVisitorLocale(ssrLocale);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (Object.keys(patches).length > 0) {
|
|
179
|
+
this.setState(patches);
|
|
180
|
+
}
|
|
181
|
+
this.prefetchRemainingI18nLocales();
|
|
182
|
+
}
|
|
183
|
+
componentDidUpdate(_prevProps, prevState) {
|
|
184
|
+
if (prevState.theme !== this.state.theme) {
|
|
185
|
+
applyColorModeClass(this.state.theme === 'dark');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
render() {
|
|
189
|
+
const { Component, pageProps, i18n: i18nFromProps, globalSetting, siteConfig, locales, initialLocale, tags, categories, pages, colorPrimary, themeMods = {}, ...rest } = this.props;
|
|
190
|
+
const i18n = this.state.i18n ?? i18nFromProps;
|
|
191
|
+
const locale = this.state.locale ||
|
|
192
|
+
initialLocale ||
|
|
193
|
+
(Array.isArray(locales) && locales.length > 0 ? locales[0] : null) ||
|
|
194
|
+
'zh';
|
|
195
|
+
const { needLayoutFooter = true, hasBg = false } = pageProps;
|
|
196
|
+
const message = i18n?.[locale] || {};
|
|
197
|
+
const isDark = this.state.theme === 'dark';
|
|
198
|
+
const appearanceCss = buildAppearanceCss?.(themeMods);
|
|
199
|
+
const setting = this.state.setting ?? rest.setting;
|
|
200
|
+
const catalogValue = {
|
|
201
|
+
setting,
|
|
202
|
+
i18n,
|
|
203
|
+
locale,
|
|
204
|
+
locales,
|
|
205
|
+
globalSetting,
|
|
206
|
+
siteConfig,
|
|
207
|
+
tags,
|
|
208
|
+
categories,
|
|
209
|
+
pages,
|
|
210
|
+
theme: this.state.theme,
|
|
211
|
+
collapsed: this.state.collapsed,
|
|
212
|
+
changeLocale: this.changeLocale,
|
|
213
|
+
user: this.state.user,
|
|
214
|
+
setUser: this.setUser,
|
|
215
|
+
removeUser: this.removeUser,
|
|
216
|
+
changeTheme: this.changeTheme,
|
|
217
|
+
getSetting: this.getSetting,
|
|
218
|
+
toggleCollapse: this.toggleCollapse,
|
|
219
|
+
};
|
|
220
|
+
const layout = React.createElement(Layout, {
|
|
221
|
+
needHeader: true,
|
|
222
|
+
needFooter: needLayoutFooter,
|
|
223
|
+
hasBg,
|
|
224
|
+
}, React.createElement(RouteProgress, null), React.createElement(Component, pageProps));
|
|
225
|
+
const runtime = { locale, isDark, colorPrimary, themeMods, colorMode: this.state.theme };
|
|
226
|
+
const content = wrapContent ? wrapContent(layout, runtime) : layout;
|
|
227
|
+
return React.createElement(SiteCatalogProvider, { value: catalogValue }, React.createElement(IntlProvider, { messages: message, locale }, appearanceCss
|
|
228
|
+
? React.createElement('style', {
|
|
229
|
+
dangerouslySetInnerHTML: { __html: appearanceCss },
|
|
230
|
+
})
|
|
231
|
+
: null, React.createElement(ViewStatisticsBridge, null), React.createElement(SiteAnalytics, null), content));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
_a = ReactPressThemeApp;
|
|
235
|
+
ReactPressThemeApp.getInitialProps = async (appContext) => {
|
|
236
|
+
const appProps = await App.getInitialProps(appContext);
|
|
237
|
+
let bootstrap;
|
|
238
|
+
try {
|
|
239
|
+
bootstrap = await fetchAppBootstrap({
|
|
240
|
+
manifest,
|
|
241
|
+
ctx: appContext.ctx,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
console.error('[reactpress] fetchAppBootstrap failed, using defaults', error);
|
|
246
|
+
bootstrap = createDefaultAppBootstrap();
|
|
247
|
+
}
|
|
248
|
+
if (typeof transformBootstrap === 'function') {
|
|
249
|
+
bootstrap = transformBootstrap(bootstrap, appContext.ctx);
|
|
250
|
+
}
|
|
251
|
+
else if (slimBootstrap) {
|
|
252
|
+
bootstrap = slimAppBootstrapForRoute(bootstrap, appContext.ctx.pathname ?? '/', typeof slimBootstrap === 'object' ? slimBootstrap : undefined);
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
...appProps,
|
|
256
|
+
...bootstrap,
|
|
257
|
+
pageProps: appProps.pageProps,
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
return ReactPressThemeApp;
|
|
261
|
+
}
|
|
262
|
+
module.exports = { createReactPressApp };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Minimal theme `_app` — hello-world style, ReactPressProvider + ThemeCssVars only. */
|
|
2
|
+
export function createThemeApp(manifest: any): ({ Component, pageProps }: {
|
|
3
|
+
Component: any;
|
|
4
|
+
pageProps: any;
|
|
5
|
+
}) => React.FunctionComponentElement<import("../ui").ReactPressProviderProps>;
|
|
6
|
+
import React = require("react");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require('react');
|
|
3
|
+
const { createDefaultVisitorContext } = require('../theme/ssr/fetch');
|
|
4
|
+
const { ReactPressProvider } = require('../ui/context/ReactPressProvider');
|
|
5
|
+
const { ThemeCssVars } = require('../ui/components/ThemeCssVars');
|
|
6
|
+
const { PREVIEW_TOKEN_QUERY_KEY } = require('../theme/preview/preview-draft');
|
|
7
|
+
const { fetchPreviewDraft } = require('../theme/extension/preview');
|
|
8
|
+
const { mergePreviewMods } = require('../theme/preview/preview-mods');
|
|
9
|
+
const { DevChunkRecovery } = require('./devChunkRecovery');
|
|
10
|
+
function readPreviewTokenFromBrowser() {
|
|
11
|
+
if (typeof window === 'undefined')
|
|
12
|
+
return '';
|
|
13
|
+
return new URLSearchParams(window.location.search).get(PREVIEW_TOKEN_QUERY_KEY)?.trim() ?? '';
|
|
14
|
+
}
|
|
15
|
+
/** Minimal theme `_app` — hello-world style, ReactPressProvider + ThemeCssVars only. */
|
|
16
|
+
function createThemeApp(manifest) {
|
|
17
|
+
function ThemeApp({ Component, pageProps }) {
|
|
18
|
+
const { reactPress, ...rest } = pageProps;
|
|
19
|
+
const visitorContext = reactPress ?? createDefaultVisitorContext(manifest.id);
|
|
20
|
+
const [mods, setMods] = React.useState(() => visitorContext.mods ?? {});
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
const base = visitorContext.mods ?? {};
|
|
23
|
+
const token = readPreviewTokenFromBrowser();
|
|
24
|
+
if (!token) {
|
|
25
|
+
setMods(base);
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
let cancelled = false;
|
|
29
|
+
void fetchPreviewDraft(token).then((draft) => {
|
|
30
|
+
if (cancelled)
|
|
31
|
+
return;
|
|
32
|
+
setMods(mergePreviewMods(base, draft.mods ?? {}));
|
|
33
|
+
});
|
|
34
|
+
return () => {
|
|
35
|
+
cancelled = true;
|
|
36
|
+
};
|
|
37
|
+
}, [reactPress, visitorContext.mods]);
|
|
38
|
+
const providerProps = {
|
|
39
|
+
...visitorContext,
|
|
40
|
+
mods,
|
|
41
|
+
isPreview: visitorContext.isPreview || Boolean(readPreviewTokenFromBrowser()),
|
|
42
|
+
};
|
|
43
|
+
return React.createElement(ReactPressProvider, providerProps, React.createElement(DevChunkRecovery, null), React.createElement(ThemeCssVars, null), React.createElement(Component, rest));
|
|
44
|
+
}
|
|
45
|
+
return ThemeApp;
|
|
46
|
+
}
|
|
47
|
+
module.exports = { createThemeApp };
|