@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,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress-style template hierarchy → Next.js Pages Router paths.
|
|
3
|
+
* @see https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
4
|
+
*/
|
|
5
|
+
export declare const ThemeTemplate: {
|
|
6
|
+
/** Site front page / blog index */
|
|
7
|
+
readonly HOME: "home";
|
|
8
|
+
/** Single post */
|
|
9
|
+
readonly SINGLE: "single";
|
|
10
|
+
/** Static page */
|
|
11
|
+
readonly PAGE: "page";
|
|
12
|
+
/** Category archive */
|
|
13
|
+
readonly ARCHIVE_CATEGORY: "archive-category";
|
|
14
|
+
/** Tag archive */
|
|
15
|
+
readonly ARCHIVE_TAG: "archive-tag";
|
|
16
|
+
/** Search results */
|
|
17
|
+
readonly SEARCH: "search";
|
|
18
|
+
/** Post archives by date */
|
|
19
|
+
readonly ARCHIVES: "archives";
|
|
20
|
+
/** Knowledge base index */
|
|
21
|
+
readonly KNOWLEDGE: "knowledge";
|
|
22
|
+
/** URL navigation hub */
|
|
23
|
+
readonly NAV: "nav";
|
|
24
|
+
/** Login page */
|
|
25
|
+
readonly LOGIN: "login";
|
|
26
|
+
/** 404 */
|
|
27
|
+
readonly NOT_FOUND: "404";
|
|
28
|
+
};
|
|
29
|
+
export type ThemeTemplateSlug = (typeof ThemeTemplate)[keyof typeof ThemeTemplate];
|
|
30
|
+
/** Default file mapping (override in `theme.json` → `templates`). */
|
|
31
|
+
export declare const DEFAULT_TEMPLATE_FILES: Record<ThemeTemplateSlug, string>;
|
|
32
|
+
export interface ThemeManifestLike {
|
|
33
|
+
templates?: Partial<Record<string, string>>;
|
|
34
|
+
}
|
|
35
|
+
export declare function resolveTemplateFiles(manifest?: ThemeManifestLike | null): Record<ThemeTemplateSlug, string>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TEMPLATE_FILES = exports.ThemeTemplate = void 0;
|
|
4
|
+
exports.resolveTemplateFiles = resolveTemplateFiles;
|
|
5
|
+
/**
|
|
6
|
+
* WordPress-style template hierarchy → Next.js Pages Router paths.
|
|
7
|
+
* @see https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
8
|
+
*/
|
|
9
|
+
exports.ThemeTemplate = {
|
|
10
|
+
/** Site front page / blog index */
|
|
11
|
+
HOME: 'home',
|
|
12
|
+
/** Single post */
|
|
13
|
+
SINGLE: 'single',
|
|
14
|
+
/** Static page */
|
|
15
|
+
PAGE: 'page',
|
|
16
|
+
/** Category archive */
|
|
17
|
+
ARCHIVE_CATEGORY: 'archive-category',
|
|
18
|
+
/** Tag archive */
|
|
19
|
+
ARCHIVE_TAG: 'archive-tag',
|
|
20
|
+
/** Search results */
|
|
21
|
+
SEARCH: 'search',
|
|
22
|
+
/** Post archives by date */
|
|
23
|
+
ARCHIVES: 'archives',
|
|
24
|
+
/** Knowledge base index */
|
|
25
|
+
KNOWLEDGE: 'knowledge',
|
|
26
|
+
/** URL navigation hub */
|
|
27
|
+
NAV: 'nav',
|
|
28
|
+
/** Login page */
|
|
29
|
+
LOGIN: 'login',
|
|
30
|
+
/** 404 */
|
|
31
|
+
NOT_FOUND: '404',
|
|
32
|
+
};
|
|
33
|
+
/** Default file mapping (override in `theme.json` → `templates`). */
|
|
34
|
+
exports.DEFAULT_TEMPLATE_FILES = {
|
|
35
|
+
[exports.ThemeTemplate.HOME]: 'pages/index.tsx',
|
|
36
|
+
[exports.ThemeTemplate.SINGLE]: 'pages/article/[id].tsx',
|
|
37
|
+
[exports.ThemeTemplate.PAGE]: 'pages/about.tsx',
|
|
38
|
+
[exports.ThemeTemplate.ARCHIVE_CATEGORY]: 'pages/category/[category].tsx',
|
|
39
|
+
[exports.ThemeTemplate.ARCHIVE_TAG]: 'pages/tag/[tag].tsx',
|
|
40
|
+
[exports.ThemeTemplate.SEARCH]: 'pages/search.tsx',
|
|
41
|
+
[exports.ThemeTemplate.ARCHIVES]: 'pages/archives/index.tsx',
|
|
42
|
+
[exports.ThemeTemplate.KNOWLEDGE]: 'pages/knowledge/index.tsx',
|
|
43
|
+
[exports.ThemeTemplate.NAV]: 'pages/nav/index.tsx',
|
|
44
|
+
[exports.ThemeTemplate.LOGIN]: 'pages/login/index.tsx',
|
|
45
|
+
[exports.ThemeTemplate.NOT_FOUND]: 'pages/404.tsx',
|
|
46
|
+
};
|
|
47
|
+
function resolveTemplateFiles(manifest) {
|
|
48
|
+
const custom = manifest?.templates ?? {};
|
|
49
|
+
return { ...exports.DEFAULT_TEMPLATE_FILES, ...custom };
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GetStaticPathsResult } from 'next';
|
|
2
|
+
/** WordPress-style on-demand ISR paths (`fallback: true`). */
|
|
3
|
+
export declare const themeOnDemandPaths: GetStaticPathsResult;
|
|
4
|
+
export declare function themeNotFound(): {
|
|
5
|
+
notFound: true;
|
|
6
|
+
};
|
|
7
|
+
export declare function themeStaticNotFound(revalidate?: number): {
|
|
8
|
+
notFound: true;
|
|
9
|
+
revalidate: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.themeOnDemandPaths = void 0;
|
|
4
|
+
exports.themeNotFound = themeNotFound;
|
|
5
|
+
exports.themeStaticNotFound = themeStaticNotFound;
|
|
6
|
+
const fetch_1 = require("./fetch");
|
|
7
|
+
/** WordPress-style on-demand ISR paths (`fallback: true`). */
|
|
8
|
+
exports.themeOnDemandPaths = {
|
|
9
|
+
paths: [],
|
|
10
|
+
fallback: true,
|
|
11
|
+
};
|
|
12
|
+
function themeNotFound() {
|
|
13
|
+
return { notFound: true };
|
|
14
|
+
}
|
|
15
|
+
function themeStaticNotFound(revalidate = fetch_1.THEME_ISR_REVALIDATE_SECONDS) {
|
|
16
|
+
return { notFound: true, revalidate };
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress-style template hierarchy → Next.js Pages Router paths.
|
|
3
|
+
* @see https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
4
|
+
*/
|
|
5
|
+
export declare const ThemeTemplate: {
|
|
6
|
+
/** Site front page / blog index */
|
|
7
|
+
readonly HOME: "home";
|
|
8
|
+
/** Single post */
|
|
9
|
+
readonly SINGLE: "single";
|
|
10
|
+
/** Static page */
|
|
11
|
+
readonly PAGE: "page";
|
|
12
|
+
/** Category archive */
|
|
13
|
+
readonly ARCHIVE_CATEGORY: "archive-category";
|
|
14
|
+
/** Tag archive */
|
|
15
|
+
readonly ARCHIVE_TAG: "archive-tag";
|
|
16
|
+
/** Search results */
|
|
17
|
+
readonly SEARCH: "search";
|
|
18
|
+
/** 404 */
|
|
19
|
+
readonly NOT_FOUND: "404";
|
|
20
|
+
};
|
|
21
|
+
export type ThemeTemplateSlug = (typeof ThemeTemplate)[keyof typeof ThemeTemplate];
|
|
22
|
+
/** Default file mapping (override in `theme.json` → `templates`). */
|
|
23
|
+
export declare const DEFAULT_TEMPLATE_FILES: Record<ThemeTemplateSlug, string>;
|
|
24
|
+
export interface ThemeManifestLike {
|
|
25
|
+
templates?: Partial<Record<string, string>>;
|
|
26
|
+
}
|
|
27
|
+
export declare function resolveTemplateFiles(manifest?: ThemeManifestLike | null): Record<ThemeTemplateSlug, string>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TEMPLATE_FILES = exports.ThemeTemplate = void 0;
|
|
4
|
+
exports.resolveTemplateFiles = resolveTemplateFiles;
|
|
5
|
+
/**
|
|
6
|
+
* WordPress-style template hierarchy → Next.js Pages Router paths.
|
|
7
|
+
* @see https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
8
|
+
*/
|
|
9
|
+
exports.ThemeTemplate = {
|
|
10
|
+
/** Site front page / blog index */
|
|
11
|
+
HOME: 'home',
|
|
12
|
+
/** Single post */
|
|
13
|
+
SINGLE: 'single',
|
|
14
|
+
/** Static page */
|
|
15
|
+
PAGE: 'page',
|
|
16
|
+
/** Category archive */
|
|
17
|
+
ARCHIVE_CATEGORY: 'archive-category',
|
|
18
|
+
/** Tag archive */
|
|
19
|
+
ARCHIVE_TAG: 'archive-tag',
|
|
20
|
+
/** Search results */
|
|
21
|
+
SEARCH: 'search',
|
|
22
|
+
/** 404 */
|
|
23
|
+
NOT_FOUND: '404',
|
|
24
|
+
};
|
|
25
|
+
/** Default file mapping (override in `theme.json` → `templates`). */
|
|
26
|
+
exports.DEFAULT_TEMPLATE_FILES = {
|
|
27
|
+
[exports.ThemeTemplate.HOME]: 'pages/index.tsx',
|
|
28
|
+
[exports.ThemeTemplate.SINGLE]: 'pages/article/[id].tsx',
|
|
29
|
+
[exports.ThemeTemplate.PAGE]: 'pages/about.tsx',
|
|
30
|
+
[exports.ThemeTemplate.ARCHIVE_CATEGORY]: 'pages/category/[category].tsx',
|
|
31
|
+
[exports.ThemeTemplate.ARCHIVE_TAG]: 'pages/tag/[tag].tsx',
|
|
32
|
+
[exports.ThemeTemplate.SEARCH]: 'pages/search.tsx',
|
|
33
|
+
[exports.ThemeTemplate.NOT_FOUND]: 'pages/404.tsx',
|
|
34
|
+
};
|
|
35
|
+
function resolveTemplateFiles(manifest) {
|
|
36
|
+
const custom = manifest?.templates ?? {};
|
|
37
|
+
return { ...exports.DEFAULT_TEMPLATE_FILES, ...custom };
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* Lazy UI exports with optional theme peer deps (nprogress, highlight.js, viewerjs).
|
|
4
|
+
* Kept out of ui/index + theme bulk re-exports so minimal themes do not webpack-load them.
|
|
5
|
+
*/
|
|
6
|
+
function lazyExport(name, loader) {
|
|
7
|
+
Object.defineProperty(exports, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get() {
|
|
10
|
+
return loader()[name];
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
lazyExport('RouteProgress', () => require('../ui/components/RouteProgress'));
|
|
15
|
+
const loadContent = () => require('../ui/components/content');
|
|
16
|
+
lazyExport('ArticleReader', loadContent);
|
|
17
|
+
lazyExport('ArticleToc', loadContent);
|
|
18
|
+
lazyExport('HtmlContent', loadContent);
|
|
19
|
+
lazyExport('ImageViewer', loadContent);
|
|
20
|
+
lazyExport('LocaleTime', loadContent);
|
|
21
|
+
lazyExport('parseArticleToc', loadContent);
|
|
@@ -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,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;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.THEME_USER_STORAGE_KEY = exports.THEME_TOKEN_STORAGE_KEY = exports.ADMIN_AUTH_STORAGE_KEY = void 0;
|
|
4
|
+
exports.getStoredAccessToken = getStoredAccessToken;
|
|
5
|
+
exports.resolveStoredUser = resolveStoredUser;
|
|
6
|
+
exports.persistThemeSession = persistThemeSession;
|
|
7
|
+
exports.clearThemeSession = clearThemeSession;
|
|
8
|
+
const json_1 = require("../api/json");
|
|
9
|
+
/** Zustand persist key used by the ReactPress admin (`web/src/stores/auth.ts`). */
|
|
10
|
+
exports.ADMIN_AUTH_STORAGE_KEY = 'auth-storage';
|
|
11
|
+
exports.THEME_TOKEN_STORAGE_KEY = 'token';
|
|
12
|
+
exports.THEME_USER_STORAGE_KEY = 'user';
|
|
13
|
+
function getStoredAccessToken() {
|
|
14
|
+
if (typeof window === 'undefined')
|
|
15
|
+
return null;
|
|
16
|
+
const themeToken = window.localStorage.getItem(exports.THEME_TOKEN_STORAGE_KEY);
|
|
17
|
+
if (themeToken)
|
|
18
|
+
return themeToken;
|
|
19
|
+
try {
|
|
20
|
+
const raw = window.localStorage.getItem(exports.ADMIN_AUTH_STORAGE_KEY);
|
|
21
|
+
if (!raw)
|
|
22
|
+
return null;
|
|
23
|
+
const parsed = JSON.parse(raw);
|
|
24
|
+
return parsed.state?.tokens?.accessToken ?? null;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function mapAdminUserToThemeUser(adminUser, token) {
|
|
31
|
+
if (!adminUser || !token)
|
|
32
|
+
return null;
|
|
33
|
+
const name = (adminUser.username || adminUser.name || '').trim();
|
|
34
|
+
if (!name)
|
|
35
|
+
return null;
|
|
36
|
+
return {
|
|
37
|
+
name,
|
|
38
|
+
email: adminUser.email ?? '',
|
|
39
|
+
avatar: adminUser.avatar ?? '',
|
|
40
|
+
token,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Resolve theme user from theme storage, or fall back to admin `auth-storage`. */
|
|
44
|
+
function resolveStoredUser() {
|
|
45
|
+
if (typeof window === 'undefined')
|
|
46
|
+
return null;
|
|
47
|
+
const userStr = window.localStorage.getItem(exports.THEME_USER_STORAGE_KEY);
|
|
48
|
+
if (userStr) {
|
|
49
|
+
const parsed = (0, json_1.safeJsonParse)(userStr, {});
|
|
50
|
+
if (parsed?.name) {
|
|
51
|
+
const token = getStoredAccessToken();
|
|
52
|
+
return {
|
|
53
|
+
name: parsed.name,
|
|
54
|
+
email: parsed.email ?? '',
|
|
55
|
+
avatar: parsed.avatar ?? '',
|
|
56
|
+
token: parsed.token ?? token ?? '',
|
|
57
|
+
role: parsed.role,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const raw = window.localStorage.getItem(exports.ADMIN_AUTH_STORAGE_KEY);
|
|
63
|
+
if (!raw)
|
|
64
|
+
return null;
|
|
65
|
+
const parsed = JSON.parse(raw);
|
|
66
|
+
const { state } = parsed;
|
|
67
|
+
if (!state?.isAuthenticated)
|
|
68
|
+
return null;
|
|
69
|
+
const token = state.tokens?.accessToken;
|
|
70
|
+
if (!token)
|
|
71
|
+
return null;
|
|
72
|
+
return mapAdminUserToThemeUser(state.user, token);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function persistThemeSession(user) {
|
|
79
|
+
if (typeof window === 'undefined')
|
|
80
|
+
return;
|
|
81
|
+
if (user.token) {
|
|
82
|
+
window.localStorage.setItem(exports.THEME_TOKEN_STORAGE_KEY, user.token);
|
|
83
|
+
}
|
|
84
|
+
window.localStorage.setItem(exports.THEME_USER_STORAGE_KEY, JSON.stringify(user));
|
|
85
|
+
}
|
|
86
|
+
function clearThemeSession() {
|
|
87
|
+
if (typeof window === 'undefined')
|
|
88
|
+
return;
|
|
89
|
+
window.localStorage.removeItem(exports.THEME_USER_STORAGE_KEY);
|
|
90
|
+
window.localStorage.removeItem(exports.THEME_TOKEN_STORAGE_KEY);
|
|
91
|
+
window.localStorage.removeItem(exports.ADMIN_AUTH_STORAGE_KEY);
|
|
92
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const COLOR_MODE_STORAGE_KEY = "dark";
|
|
2
|
+
export type ThemeColorMode = 'dark' | 'light';
|
|
3
|
+
export declare function resolvePreferredColorMode(): boolean;
|
|
4
|
+
export declare function applyColorModeClass(isDark: boolean, className?: string): void;
|
|
5
|
+
export declare function persistColorMode(isDark: boolean): void;
|
|
6
|
+
export declare function resolveInitialColorModeState(): ThemeColorMode | null;
|
|
7
|
+
/**
|
|
8
|
+
* Theme mode for the first client render (after `_document` color-mode script).
|
|
9
|
+
* SSR should use `'light'`; call only in browser or via `typeof window` guard.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveClientThemeMode(): ThemeColorMode;
|
|
12
|
+
/** Runs before paint to avoid light-mode flash on first visit. */
|
|
13
|
+
export declare function buildColorModeInitScript(options?: {
|
|
14
|
+
storageKey?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}): string;
|
|
17
|
+
export declare const colorModeInitScript: string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colorModeInitScript = exports.COLOR_MODE_STORAGE_KEY = void 0;
|
|
4
|
+
exports.resolvePreferredColorMode = resolvePreferredColorMode;
|
|
5
|
+
exports.applyColorModeClass = applyColorModeClass;
|
|
6
|
+
exports.persistColorMode = persistColorMode;
|
|
7
|
+
exports.resolveInitialColorModeState = resolveInitialColorModeState;
|
|
8
|
+
exports.resolveClientThemeMode = resolveClientThemeMode;
|
|
9
|
+
exports.buildColorModeInitScript = buildColorModeInitScript;
|
|
10
|
+
exports.COLOR_MODE_STORAGE_KEY = 'dark';
|
|
11
|
+
function resolvePreferredColorMode() {
|
|
12
|
+
if (typeof window === 'undefined') {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const storageTheme = window.localStorage.getItem(exports.COLOR_MODE_STORAGE_KEY);
|
|
16
|
+
if (storageTheme != null) {
|
|
17
|
+
return storageTheme === '1';
|
|
18
|
+
}
|
|
19
|
+
return window.matchMedia?.('(prefers-color-scheme: dark)').matches ?? false;
|
|
20
|
+
}
|
|
21
|
+
function applyColorModeClass(isDark, className = 'dark') {
|
|
22
|
+
if (typeof document === 'undefined') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
document.body.classList.toggle(className, isDark);
|
|
26
|
+
document.documentElement.style.colorScheme = isDark ? 'dark' : 'light';
|
|
27
|
+
}
|
|
28
|
+
function persistColorMode(isDark) {
|
|
29
|
+
if (typeof window === 'undefined') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
window.localStorage.setItem(exports.COLOR_MODE_STORAGE_KEY, isDark ? '1' : '-1');
|
|
33
|
+
}
|
|
34
|
+
function resolveInitialColorModeState() {
|
|
35
|
+
if (typeof window === 'undefined') {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return resolvePreferredColorMode() ? 'dark' : 'light';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Theme mode for the first client render (after `_document` color-mode script).
|
|
42
|
+
* SSR should use `'light'`; call only in browser or via `typeof window` guard.
|
|
43
|
+
*/
|
|
44
|
+
function resolveClientThemeMode() {
|
|
45
|
+
if (typeof window === 'undefined') {
|
|
46
|
+
return 'light';
|
|
47
|
+
}
|
|
48
|
+
if (document.body.classList.contains('dark')) {
|
|
49
|
+
return 'dark';
|
|
50
|
+
}
|
|
51
|
+
return resolveInitialColorModeState() ?? 'light';
|
|
52
|
+
}
|
|
53
|
+
/** Runs before paint to avoid light-mode flash on first visit. */
|
|
54
|
+
function buildColorModeInitScript(options = {}) {
|
|
55
|
+
const storageKey = options.storageKey ?? exports.COLOR_MODE_STORAGE_KEY;
|
|
56
|
+
const className = options.className ?? 'dark';
|
|
57
|
+
return `(function(){try{var k='${storageKey}';var s=localStorage.getItem(k);var d=s==='1'||(s==null&&window.matchMedia('(prefers-color-scheme: dark)').matches);if(d){document.documentElement.style.colorScheme='dark';document.body.classList.add('${className}');}else{document.documentElement.style.colorScheme='light';}}catch(e){}})();`;
|
|
58
|
+
}
|
|
59
|
+
exports.colorModeInitScript = buildColorModeInitScript();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { COMMENT_EMAIL_REGEXP, isValidCommentEmail } from '../../utils/email';
|
|
2
|
+
export declare const COMMENT_AUTHOR_STORAGE_KEY = "reactpress-comment-author";
|
|
3
|
+
export type CommentAuthor = {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
};
|
|
7
|
+
export { COMMENT_EMAIL_REGEXP, isValidCommentEmail };
|
|
8
|
+
export declare function isValidCommentAuthor(author: Partial<CommentAuthor> | null | undefined): author is CommentAuthor;
|
|
9
|
+
export declare function getCommentEmailError(email: string | undefined | null, messages: {
|
|
10
|
+
required: string;
|
|
11
|
+
invalid: string;
|
|
12
|
+
}, options?: {
|
|
13
|
+
touched?: boolean;
|
|
14
|
+
}): string;
|
|
15
|
+
export declare function readCommentAuthor(): CommentAuthor | null;
|
|
16
|
+
export declare function persistCommentAuthor(author: CommentAuthor): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidCommentEmail = exports.COMMENT_EMAIL_REGEXP = exports.COMMENT_AUTHOR_STORAGE_KEY = void 0;
|
|
4
|
+
exports.isValidCommentAuthor = isValidCommentAuthor;
|
|
5
|
+
exports.getCommentEmailError = getCommentEmailError;
|
|
6
|
+
exports.readCommentAuthor = readCommentAuthor;
|
|
7
|
+
exports.persistCommentAuthor = persistCommentAuthor;
|
|
8
|
+
const email_1 = require("../../utils/email");
|
|
9
|
+
Object.defineProperty(exports, "COMMENT_EMAIL_REGEXP", { enumerable: true, get: function () { return email_1.COMMENT_EMAIL_REGEXP; } });
|
|
10
|
+
Object.defineProperty(exports, "isValidCommentEmail", { enumerable: true, get: function () { return email_1.isValidCommentEmail; } });
|
|
11
|
+
exports.COMMENT_AUTHOR_STORAGE_KEY = 'reactpress-comment-author';
|
|
12
|
+
function isValidCommentAuthor(author) {
|
|
13
|
+
return Boolean(author?.name?.trim() && (0, email_1.isValidCommentEmail)(author.email));
|
|
14
|
+
}
|
|
15
|
+
function getCommentEmailError(email, messages, options = {}) {
|
|
16
|
+
const trimmed = email?.trim() ?? '';
|
|
17
|
+
if (!options.touched)
|
|
18
|
+
return '';
|
|
19
|
+
if (!trimmed)
|
|
20
|
+
return messages.required;
|
|
21
|
+
if (!(0, email_1.isValidCommentEmail)(trimmed))
|
|
22
|
+
return messages.invalid;
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
function readCommentAuthor() {
|
|
26
|
+
if (typeof window === 'undefined')
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const raw = window.localStorage.getItem(exports.COMMENT_AUTHOR_STORAGE_KEY);
|
|
30
|
+
if (!raw)
|
|
31
|
+
return null;
|
|
32
|
+
const parsed = JSON.parse(raw);
|
|
33
|
+
if (!isValidCommentAuthor(parsed))
|
|
34
|
+
return null;
|
|
35
|
+
return { name: parsed.name.trim(), email: parsed.email.trim() };
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function persistCommentAuthor(author) {
|
|
42
|
+
if (typeof window === 'undefined')
|
|
43
|
+
return;
|
|
44
|
+
window.localStorage.setItem(exports.COMMENT_AUTHOR_STORAGE_KEY, JSON.stringify({ name: author.name.trim(), email: author.email.trim() }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Remote CMS i18n may omit newer keys — fill from toolkit defaults. */
|
|
2
|
+
export declare function mergeVisitorI18n(apiI18n: Record<string, unknown>): Record<string, unknown>;
|
|
3
|
+
/** Keep only the active locale in SSR payload; other locales load client-side. */
|
|
4
|
+
export declare function slimVisitorI18nForSsr(i18n: Record<string, unknown>, locale: string): Record<string, unknown>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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.mergeVisitorI18n = mergeVisitorI18n;
|
|
7
|
+
exports.slimVisitorI18nForSsr = slimVisitorI18nForSsr;
|
|
8
|
+
const object_1 = require("../../utils/object");
|
|
9
|
+
const en_json_1 = __importDefault(require("../../config/locales/en.json"));
|
|
10
|
+
const zh_json_1 = __importDefault(require("../../config/locales/zh.json"));
|
|
11
|
+
const BUILTIN_VISITOR_LOCALES = {
|
|
12
|
+
en: en_json_1.default,
|
|
13
|
+
zh: zh_json_1.default,
|
|
14
|
+
};
|
|
15
|
+
/** Remote CMS i18n may omit newer keys — fill from toolkit defaults. */
|
|
16
|
+
function mergeVisitorI18n(apiI18n) {
|
|
17
|
+
const merged = { ...apiI18n };
|
|
18
|
+
for (const [locale, defaults] of Object.entries(BUILTIN_VISITOR_LOCALES)) {
|
|
19
|
+
const fromApi = apiI18n[locale] || {};
|
|
20
|
+
merged[locale] = (0, object_1.deepMerge)((0, object_1.deepMerge)({}, defaults), fromApi);
|
|
21
|
+
}
|
|
22
|
+
return merged;
|
|
23
|
+
}
|
|
24
|
+
/** Keep only the active locale in SSR payload; other locales load client-side. */
|
|
25
|
+
function slimVisitorI18nForSsr(i18n, locale) {
|
|
26
|
+
const messages = i18n[locale];
|
|
27
|
+
return messages && typeof messages === 'object' ? { [locale]: messages } : {};
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type LocaleMessages = Record<string, string>;
|
|
2
|
+
export type LocaleCatalog = Record<string, LocaleMessages>;
|
|
3
|
+
export interface SiteLocaleState {
|
|
4
|
+
locale: string;
|
|
5
|
+
locales: string[];
|
|
6
|
+
messages: LocaleMessages;
|
|
7
|
+
/** Full `{ zh: {...}, en: {...} }` catalog when available. */
|
|
8
|
+
catalog: LocaleCatalog;
|
|
9
|
+
}
|
|
10
|
+
export interface ParseSiteLocaleOptions {
|
|
11
|
+
locale?: string;
|
|
12
|
+
fallbackLocale?: string;
|
|
13
|
+
/** Cookie / query hint (checked before fallback). */
|
|
14
|
+
preferredLocale?: string;
|
|
15
|
+
acceptLanguage?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveRequestLocale(supported: string[], options?: {
|
|
18
|
+
preferred?: string;
|
|
19
|
+
fallback?: string;
|
|
20
|
+
acceptLanguage?: string;
|
|
21
|
+
}): string;
|
|
22
|
+
export declare function parseSiteLocale(i18nRaw: unknown, options?: ParseSiteLocaleOptions): SiteLocaleState;
|
|
23
|
+
export declare function createTranslator(messages: LocaleMessages): (key: string, fallback?: string) => string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRequestLocale = resolveRequestLocale;
|
|
4
|
+
exports.parseSiteLocale = parseSiteLocale;
|
|
5
|
+
exports.createTranslator = createTranslator;
|
|
6
|
+
const json_1 = require("../api/json");
|
|
7
|
+
function resolveRequestLocale(supported, options = {}) {
|
|
8
|
+
const fallback = options.fallback ?? 'zh';
|
|
9
|
+
const { preferred, acceptLanguage } = options;
|
|
10
|
+
if (preferred && supported.includes(preferred)) {
|
|
11
|
+
return preferred;
|
|
12
|
+
}
|
|
13
|
+
if (acceptLanguage) {
|
|
14
|
+
const parts = acceptLanguage.split(',');
|
|
15
|
+
for (const part of parts) {
|
|
16
|
+
const tag = part.split(';')[0]?.trim().toLowerCase();
|
|
17
|
+
if (!tag)
|
|
18
|
+
continue;
|
|
19
|
+
if (supported.includes(tag))
|
|
20
|
+
return tag;
|
|
21
|
+
const short = tag.split('-')[0];
|
|
22
|
+
if (short && supported.includes(short))
|
|
23
|
+
return short;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (supported.includes(fallback))
|
|
27
|
+
return fallback;
|
|
28
|
+
return supported[0] ?? 'en';
|
|
29
|
+
}
|
|
30
|
+
function parseSiteLocale(i18nRaw, options = {}) {
|
|
31
|
+
const catalog = (0, json_1.safeJsonParse)(i18nRaw, {});
|
|
32
|
+
const locales = Object.keys(catalog).filter((key) => catalog[key] && typeof catalog[key] === 'object');
|
|
33
|
+
const fallbackLocale = options.fallbackLocale ??
|
|
34
|
+
(locales.includes('zh') ? 'zh' : locales.includes('en') ? 'en' : locales[0] ?? 'en');
|
|
35
|
+
const locale = resolveRequestLocale(locales.length ? locales : [fallbackLocale], {
|
|
36
|
+
preferred: options.locale ?? options.preferredLocale,
|
|
37
|
+
acceptLanguage: options.acceptLanguage,
|
|
38
|
+
fallback: fallbackLocale,
|
|
39
|
+
});
|
|
40
|
+
const messages = { ...(catalog[locale] ?? {}) };
|
|
41
|
+
return {
|
|
42
|
+
locale,
|
|
43
|
+
locales: locales.length ? locales : [locale],
|
|
44
|
+
messages,
|
|
45
|
+
catalog,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function resolveLocaleMessage(messages, key) {
|
|
49
|
+
const flat = messages[key];
|
|
50
|
+
if (typeof flat === 'string' && flat !== '') {
|
|
51
|
+
return flat;
|
|
52
|
+
}
|
|
53
|
+
const parts = key.split('.');
|
|
54
|
+
let current = messages;
|
|
55
|
+
for (const part of parts) {
|
|
56
|
+
if (!current || typeof current !== 'object') {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
current = current[part];
|
|
60
|
+
}
|
|
61
|
+
return typeof current === 'string' && current !== '' ? current : undefined;
|
|
62
|
+
}
|
|
63
|
+
function createTranslator(messages) {
|
|
64
|
+
const lookup = messages;
|
|
65
|
+
return function t(key, fallback) {
|
|
66
|
+
const resolved = resolveLocaleMessage(lookup, key);
|
|
67
|
+
if (resolved != null) {
|
|
68
|
+
return resolved;
|
|
69
|
+
}
|
|
70
|
+
return fallback ?? key;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SiteThemeState, ThemeMods } from '../extension/theme';
|
|
2
|
+
export interface ThemeRuntime {
|
|
3
|
+
/** Theme package id (from `theme.json` or env). */
|
|
4
|
+
themeId: string;
|
|
5
|
+
/** Published active theme on the site. */
|
|
6
|
+
activeThemeId: string;
|
|
7
|
+
/** Customizer values for `themeId`. */
|
|
8
|
+
mods: ThemeMods;
|
|
9
|
+
/** `previewThemeId` differs from `activeThemeId` in customizer preview. */
|
|
10
|
+
isPreview: boolean;
|
|
11
|
+
themeState: SiteThemeState;
|
|
12
|
+
}
|
|
13
|
+
export interface ResolveThemeRuntimeOptions {
|
|
14
|
+
themeId: string;
|
|
15
|
+
/** When true (default), use `previewThemeId` from global settings when set. */
|
|
16
|
+
honorPreview?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function resolveThemeRuntime(globalSettingRaw: unknown, options: ResolveThemeRuntimeOptions): ThemeRuntime;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveThemeRuntime = resolveThemeRuntime;
|
|
4
|
+
const theme_1 = require("../extension/theme");
|
|
5
|
+
function resolveThemeRuntime(globalSettingRaw, options) {
|
|
6
|
+
const themeState = (0, theme_1.getThemeStateFromGlobalSetting)(globalSettingRaw);
|
|
7
|
+
const activeThemeId = themeState.activeTheme;
|
|
8
|
+
const previewId = themeState.previewThemeId;
|
|
9
|
+
const honorPreview = options.honorPreview !== false;
|
|
10
|
+
const effectiveId = honorPreview && previewId ? previewId : options.themeId || activeThemeId;
|
|
11
|
+
const isPreview = Boolean(previewId && previewId !== activeThemeId);
|
|
12
|
+
return {
|
|
13
|
+
themeId: effectiveId,
|
|
14
|
+
activeThemeId,
|
|
15
|
+
mods: themeState.mods[effectiveId] ?? {},
|
|
16
|
+
isPreview,
|
|
17
|
+
themeState,
|
|
18
|
+
};
|
|
19
|
+
}
|