@fecommunity/reactpress-toolkit 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,145 @@
|
|
|
1
|
+
import { type DocumentContext } from 'next/document';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface CreateAntdThemeDocumentOptions {
|
|
4
|
+
/** Resolve `<html lang>` from the incoming request. */
|
|
5
|
+
resolveLocale?: (req: DocumentContext['req']) => string;
|
|
6
|
+
defaultLocale?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Factory for Next.js `_document.tsx` with Ant Design CSS-in-JS SSR extraction.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAntdThemeDocument(options?: CreateAntdThemeDocumentOptions): {
|
|
12
|
+
new (props: import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
13
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
14
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
15
|
+
locale?: string;
|
|
16
|
+
}): {
|
|
17
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
context: unknown;
|
|
19
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
20
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
21
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
22
|
+
locale?: string;
|
|
23
|
+
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
24
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
25
|
+
readonly props: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
26
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
27
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
28
|
+
locale?: string;
|
|
29
|
+
}>;
|
|
30
|
+
state: Readonly<{}>;
|
|
31
|
+
refs: {
|
|
32
|
+
[key: string]: React.ReactInstance;
|
|
33
|
+
};
|
|
34
|
+
componentDidMount?(): void;
|
|
35
|
+
shouldComponentUpdate?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
36
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
37
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
38
|
+
locale?: string;
|
|
39
|
+
}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
40
|
+
componentWillUnmount?(): void;
|
|
41
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
42
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
43
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
44
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
45
|
+
locale?: string;
|
|
46
|
+
}>, prevState: Readonly<{}>): any;
|
|
47
|
+
componentDidUpdate?(prevProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
48
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
49
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
50
|
+
locale?: string;
|
|
51
|
+
}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
52
|
+
componentWillMount?(): void;
|
|
53
|
+
UNSAFE_componentWillMount?(): void;
|
|
54
|
+
componentWillReceiveProps?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
55
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
56
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
57
|
+
locale?: string;
|
|
58
|
+
}>, nextContext: any): void;
|
|
59
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
60
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
61
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
62
|
+
locale?: string;
|
|
63
|
+
}>, nextContext: any): void;
|
|
64
|
+
componentWillUpdate?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
65
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
66
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
67
|
+
locale?: string;
|
|
68
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
69
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
70
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
71
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
72
|
+
locale?: string;
|
|
73
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
74
|
+
};
|
|
75
|
+
new (props: import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
76
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
77
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
78
|
+
locale?: string;
|
|
79
|
+
}, context: any): {
|
|
80
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
context: unknown;
|
|
82
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
83
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
84
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
85
|
+
locale?: string;
|
|
86
|
+
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
87
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
88
|
+
readonly props: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
89
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
90
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
91
|
+
locale?: string;
|
|
92
|
+
}>;
|
|
93
|
+
state: Readonly<{}>;
|
|
94
|
+
refs: {
|
|
95
|
+
[key: string]: React.ReactInstance;
|
|
96
|
+
};
|
|
97
|
+
componentDidMount?(): void;
|
|
98
|
+
shouldComponentUpdate?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
99
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
100
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
101
|
+
locale?: string;
|
|
102
|
+
}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
103
|
+
componentWillUnmount?(): void;
|
|
104
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
105
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
106
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
107
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
108
|
+
locale?: string;
|
|
109
|
+
}>, prevState: Readonly<{}>): any;
|
|
110
|
+
componentDidUpdate?(prevProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
111
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
112
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
113
|
+
locale?: string;
|
|
114
|
+
}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
115
|
+
componentWillMount?(): void;
|
|
116
|
+
UNSAFE_componentWillMount?(): void;
|
|
117
|
+
componentWillReceiveProps?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
118
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
119
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
120
|
+
locale?: string;
|
|
121
|
+
}>, nextContext: any): void;
|
|
122
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
123
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
124
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
125
|
+
locale?: string;
|
|
126
|
+
}>, nextContext: any): void;
|
|
127
|
+
componentWillUpdate?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
128
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
129
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
130
|
+
locale?: string;
|
|
131
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
132
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("next/dist/shared/lib/utils").RenderPageResult & {
|
|
133
|
+
styles?: React.ReactElement[] | React.ReactFragment | JSX.Element;
|
|
134
|
+
} & import("next/dist/shared/lib/html-context").HtmlProps & {
|
|
135
|
+
locale?: string;
|
|
136
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
137
|
+
};
|
|
138
|
+
getInitialProps(ctx: DocumentContext): Promise<{
|
|
139
|
+
locale: string;
|
|
140
|
+
styles: import("react/jsx-runtime").JSX.Element;
|
|
141
|
+
html: string;
|
|
142
|
+
head?: Array<JSX.Element | null>;
|
|
143
|
+
}>;
|
|
144
|
+
contextType?: React.Context<any> | undefined;
|
|
145
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.createAntdThemeDocument = createAntdThemeDocument;
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const cssinjs_1 = require("@ant-design/cssinjs");
|
|
42
|
+
const document_1 = __importStar(require("next/document"));
|
|
43
|
+
const react_1 = __importDefault(require("react"));
|
|
44
|
+
/**
|
|
45
|
+
* Factory for Next.js `_document.tsx` with Ant Design CSS-in-JS SSR extraction.
|
|
46
|
+
*/
|
|
47
|
+
function createAntdThemeDocument(options = {}) {
|
|
48
|
+
const defaultLocale = options.defaultLocale ?? 'zh';
|
|
49
|
+
return class AntdThemeDocument extends document_1.default {
|
|
50
|
+
static async getInitialProps(ctx) {
|
|
51
|
+
const cache = (0, cssinjs_1.createCache)();
|
|
52
|
+
const originalRenderPage = ctx.renderPage;
|
|
53
|
+
ctx.renderPage = () => originalRenderPage({
|
|
54
|
+
enhanceApp: (App) => (props) => react_1.default.createElement(cssinjs_1.StyleProvider, { cache }, react_1.default.createElement(App, props)),
|
|
55
|
+
});
|
|
56
|
+
const initialProps = await document_1.default.getInitialProps(ctx);
|
|
57
|
+
const style = (0, cssinjs_1.extractStyle)(cache, true);
|
|
58
|
+
const locale = options.resolveLocale?.(ctx.req) ?? defaultLocale;
|
|
59
|
+
return {
|
|
60
|
+
...initialProps,
|
|
61
|
+
locale,
|
|
62
|
+
styles: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [initialProps.styles, (0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: style } })] })),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const locale = this.props.locale ?? defaultLocale;
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale, children: [(0, jsx_runtime_1.jsx)(document_1.Head, {}), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Shared Next.js defaults for ReactPress theme packages (Pages Router). */
|
|
2
|
+
export interface ReactPressNextConfig {
|
|
3
|
+
reactStrictMode?: boolean;
|
|
4
|
+
eslint?: {
|
|
5
|
+
ignoreDuringBuilds?: boolean;
|
|
6
|
+
};
|
|
7
|
+
transpilePackages?: string[];
|
|
8
|
+
webpack?: (config: Record<string, unknown>, context: unknown) => Record<string, unknown>;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
/** API + admin URLs for Next `env` (read at theme build / dev startup). */
|
|
12
|
+
export declare function resolveThemeNextEnv(): {
|
|
13
|
+
SERVER_API_URL: string;
|
|
14
|
+
NEXT_PUBLIC_REACTPRESS_API_URL: string;
|
|
15
|
+
NEXT_PUBLIC_REACTPRESS_ADMIN_URL: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function createReactPressNextConfig(overrides?: ReactPressNextConfig): ReactPressNextConfig;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Shared Next.js defaults for ReactPress theme packages (Pages Router). */
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.resolveThemeNextEnv = resolveThemeNextEnv;
|
|
8
|
+
exports.createReactPressNextConfig = createReactPressNextConfig;
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
function resolveFromApp(appDir, spec) {
|
|
11
|
+
return require.resolve(spec, { paths: [appDir] });
|
|
12
|
+
}
|
|
13
|
+
/** Pin React to one copy so lazy-loaded page chunks share the same runtime (pnpm monorepo). */
|
|
14
|
+
function applyThemeWebpackResolve(config, appDir) {
|
|
15
|
+
const nextConfig = config;
|
|
16
|
+
nextConfig.resolve = nextConfig.resolve || {};
|
|
17
|
+
const reactDir = path_1.default.dirname(resolveFromApp(appDir, 'react/package.json'));
|
|
18
|
+
const reactDomDir = path_1.default.dirname(resolveFromApp(appDir, 'react-dom/package.json'));
|
|
19
|
+
const themeNodeModules = path_1.default.join(appDir, 'node_modules');
|
|
20
|
+
nextConfig.resolve.modules = [
|
|
21
|
+
themeNodeModules,
|
|
22
|
+
...(Array.isArray(nextConfig.resolve.modules)
|
|
23
|
+
? nextConfig.resolve.modules
|
|
24
|
+
: nextConfig.resolve.modules
|
|
25
|
+
? [nextConfig.resolve.modules]
|
|
26
|
+
: []),
|
|
27
|
+
'node_modules',
|
|
28
|
+
];
|
|
29
|
+
nextConfig.resolve.alias = {
|
|
30
|
+
...nextConfig.resolve.alias,
|
|
31
|
+
// axios → follow-redirects → debug optional peer supports-color@9 (ESM-only)
|
|
32
|
+
'supports-color': false,
|
|
33
|
+
react: reactDir,
|
|
34
|
+
'react-dom': reactDomDir,
|
|
35
|
+
'react/jsx-runtime': resolveFromApp(appDir, 'react/jsx-runtime'),
|
|
36
|
+
'react/jsx-dev-runtime': resolveFromApp(appDir, 'react/jsx-dev-runtime'),
|
|
37
|
+
};
|
|
38
|
+
return config;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Baseline Next config for themes: strict mode, eslint relaxed in CI, axios webpack alias.
|
|
42
|
+
* Pass overrides to extend (your `webpack` runs after the supports-color alias).
|
|
43
|
+
*/
|
|
44
|
+
function resolveNginxEntryUrl() {
|
|
45
|
+
const raw = process.env.REACTPRESS_NGINX_ENTRY_URL?.trim() ||
|
|
46
|
+
process.env.NGINX_ENTRY_URL?.trim();
|
|
47
|
+
return raw ? raw.replace(/\/$/, '') : undefined;
|
|
48
|
+
}
|
|
49
|
+
/** API + admin URLs for Next `env` (read at theme build / dev startup). */
|
|
50
|
+
function resolveThemeNextEnv() {
|
|
51
|
+
const nginxEntry = resolveNginxEntryUrl();
|
|
52
|
+
const serverApi = process.env.REACTPRESS_API_URL?.trim() ||
|
|
53
|
+
process.env.SERVER_API_URL?.trim() ||
|
|
54
|
+
(process.env.SERVER_SITE_URL
|
|
55
|
+
? `${process.env.SERVER_SITE_URL.replace(/\/$/, '')}/api`
|
|
56
|
+
: 'http://localhost:3002/api');
|
|
57
|
+
const publicApi = process.env.NEXT_PUBLIC_REACTPRESS_API_URL?.trim() ||
|
|
58
|
+
(nginxEntry ? `${nginxEntry}/api` : serverApi);
|
|
59
|
+
const adminUrl = process.env.NEXT_PUBLIC_REACTPRESS_ADMIN_URL?.trim() ||
|
|
60
|
+
(nginxEntry ? `${nginxEntry}/admin` : 'http://localhost:3000');
|
|
61
|
+
return {
|
|
62
|
+
SERVER_API_URL: serverApi.replace(/\/$/, ''),
|
|
63
|
+
NEXT_PUBLIC_REACTPRESS_API_URL: publicApi.replace(/\/$/, ''),
|
|
64
|
+
NEXT_PUBLIC_REACTPRESS_ADMIN_URL: adminUrl.replace(/\/$/, ''),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function createReactPressNextConfig(overrides = {}) {
|
|
68
|
+
const { webpack: userWebpack, eslint, transpilePackages, ...rest } = overrides;
|
|
69
|
+
const nginxEntry = resolveNginxEntryUrl();
|
|
70
|
+
return {
|
|
71
|
+
reactStrictMode: true,
|
|
72
|
+
env: resolveThemeNextEnv(),
|
|
73
|
+
transpilePackages: ['@fecommunity/reactpress-toolkit', ...(transpilePackages ?? [])],
|
|
74
|
+
eslint: {
|
|
75
|
+
ignoreDuringBuilds: true,
|
|
76
|
+
...(eslint || {}),
|
|
77
|
+
},
|
|
78
|
+
typescript: {
|
|
79
|
+
ignoreBuildErrors: true,
|
|
80
|
+
...(typeof overrides.typescript === 'object' ? overrides.typescript : {}),
|
|
81
|
+
},
|
|
82
|
+
...(nginxEntry
|
|
83
|
+
? {
|
|
84
|
+
async rewrites() {
|
|
85
|
+
return [{ source: '/api/:path*', destination: `${nginxEntry}/api/:path*` }];
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
: {}),
|
|
89
|
+
...rest,
|
|
90
|
+
webpack: (config, context) => {
|
|
91
|
+
const ctx = context;
|
|
92
|
+
const appDir = ctx.dir ?? process.cwd();
|
|
93
|
+
applyThemeWebpackResolve(config, appDir);
|
|
94
|
+
if (typeof userWebpack === 'function') {
|
|
95
|
+
return userWebpack(config, context);
|
|
96
|
+
}
|
|
97
|
+
return config;
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readThemeAdminLocaleFile = void 0;
|
|
4
|
+
/** Node-only theme helpers (filesystem, etc.). Do not import from browser bundles. */
|
|
5
|
+
var theme_admin_locale_io_1 = require("../extension/theme-admin-locale.io");
|
|
6
|
+
Object.defineProperty(exports, "readThemeAdminLocaleFile", { enumerable: true, get: function () { return theme_admin_locale_io_1.readThemeAdminLocaleFile; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
/** Runs before paint to avoid light-mode flash on first visit. */
|
|
8
|
+
export declare function buildColorModeInitScript(options?: {
|
|
9
|
+
storageKey?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}): string;
|
|
12
|
+
export declare const colorModeInitScript: string;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.buildColorModeInitScript = buildColorModeInitScript;
|
|
9
|
+
exports.COLOR_MODE_STORAGE_KEY = 'dark';
|
|
10
|
+
function resolvePreferredColorMode() {
|
|
11
|
+
if (typeof window === 'undefined') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const storageTheme = window.localStorage.getItem(exports.COLOR_MODE_STORAGE_KEY);
|
|
15
|
+
if (storageTheme != null) {
|
|
16
|
+
return storageTheme === '1';
|
|
17
|
+
}
|
|
18
|
+
return window.matchMedia?.('(prefers-color-scheme: dark)').matches ?? false;
|
|
19
|
+
}
|
|
20
|
+
function applyColorModeClass(isDark, className = 'dark') {
|
|
21
|
+
if (typeof document === 'undefined') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
document.body.classList.toggle(className, isDark);
|
|
25
|
+
document.documentElement.style.colorScheme = isDark ? 'dark' : 'light';
|
|
26
|
+
}
|
|
27
|
+
function persistColorMode(isDark) {
|
|
28
|
+
if (typeof window === 'undefined') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
window.localStorage.setItem(exports.COLOR_MODE_STORAGE_KEY, isDark ? '1' : '-1');
|
|
32
|
+
}
|
|
33
|
+
function resolveInitialColorModeState() {
|
|
34
|
+
if (typeof window === 'undefined') {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return resolvePreferredColorMode() ? 'dark' : 'light';
|
|
38
|
+
}
|
|
39
|
+
/** Runs before paint to avoid light-mode flash on first visit. */
|
|
40
|
+
function buildColorModeInitScript(options = {}) {
|
|
41
|
+
const storageKey = options.storageKey ?? exports.COLOR_MODE_STORAGE_KEY;
|
|
42
|
+
const className = options.className ?? 'dark';
|
|
43
|
+
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){}})();`;
|
|
44
|
+
}
|
|
45
|
+
exports.colorModeInitScript = buildColorModeInitScript();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const COMMENT_AUTHOR_STORAGE_KEY = "reactpress-comment-author";
|
|
2
|
+
export type CommentAuthor = {
|
|
3
|
+
name: string;
|
|
4
|
+
email: string;
|
|
5
|
+
};
|
|
6
|
+
/** Permissive enough for common guest comment emails (qq/163/gmail, subdomains). */
|
|
7
|
+
export declare const COMMENT_EMAIL_REGEXP: RegExp;
|
|
8
|
+
export declare function isValidCommentEmail(email: string | undefined | null): boolean;
|
|
9
|
+
export declare function isValidCommentAuthor(author: Partial<CommentAuthor> | null | undefined): author is CommentAuthor;
|
|
10
|
+
export declare function getCommentEmailError(email: string | undefined | null, messages: {
|
|
11
|
+
required: string;
|
|
12
|
+
invalid: string;
|
|
13
|
+
}, options?: {
|
|
14
|
+
touched?: boolean;
|
|
15
|
+
}): string;
|
|
16
|
+
export declare function readCommentAuthor(): CommentAuthor | null;
|
|
17
|
+
export declare function persistCommentAuthor(author: CommentAuthor): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMENT_EMAIL_REGEXP = exports.COMMENT_AUTHOR_STORAGE_KEY = void 0;
|
|
4
|
+
exports.isValidCommentEmail = isValidCommentEmail;
|
|
5
|
+
exports.isValidCommentAuthor = isValidCommentAuthor;
|
|
6
|
+
exports.getCommentEmailError = getCommentEmailError;
|
|
7
|
+
exports.readCommentAuthor = readCommentAuthor;
|
|
8
|
+
exports.persistCommentAuthor = persistCommentAuthor;
|
|
9
|
+
exports.COMMENT_AUTHOR_STORAGE_KEY = 'reactpress-comment-author';
|
|
10
|
+
/** Permissive enough for common guest comment emails (qq/163/gmail, subdomains). */
|
|
11
|
+
exports.COMMENT_EMAIL_REGEXP = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
12
|
+
function isValidCommentEmail(email) {
|
|
13
|
+
return Boolean(email?.trim() && exports.COMMENT_EMAIL_REGEXP.test(email.trim()));
|
|
14
|
+
}
|
|
15
|
+
function isValidCommentAuthor(author) {
|
|
16
|
+
return Boolean(author?.name?.trim() && isValidCommentEmail(author.email));
|
|
17
|
+
}
|
|
18
|
+
function getCommentEmailError(email, messages, options = {}) {
|
|
19
|
+
const trimmed = email?.trim() ?? '';
|
|
20
|
+
if (!options.touched)
|
|
21
|
+
return '';
|
|
22
|
+
if (!trimmed)
|
|
23
|
+
return messages.required;
|
|
24
|
+
if (!isValidCommentEmail(trimmed))
|
|
25
|
+
return messages.invalid;
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
function readCommentAuthor() {
|
|
29
|
+
if (typeof window === 'undefined')
|
|
30
|
+
return null;
|
|
31
|
+
try {
|
|
32
|
+
const raw = window.localStorage.getItem(exports.COMMENT_AUTHOR_STORAGE_KEY);
|
|
33
|
+
if (!raw)
|
|
34
|
+
return null;
|
|
35
|
+
const parsed = JSON.parse(raw);
|
|
36
|
+
if (!isValidCommentAuthor(parsed))
|
|
37
|
+
return null;
|
|
38
|
+
return { name: parsed.name.trim(), email: parsed.email.trim() };
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function persistCommentAuthor(author) {
|
|
45
|
+
if (typeof window === 'undefined')
|
|
46
|
+
return;
|
|
47
|
+
window.localStorage.setItem(exports.COMMENT_AUTHOR_STORAGE_KEY, JSON.stringify({ name: author.name.trim(), email: author.email.trim() }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IArticle } from '../../types';
|
|
2
|
+
export type ArchiveArticle = Pick<IArticle, 'id' | 'title' | 'publishAt'>;
|
|
3
|
+
export type ArchiveTree = Record<string, Record<string, ArchiveArticle[]>>;
|
|
4
|
+
export declare function slimArchiveTree(raw: Record<string, Record<string, IArticle[]>>): ArchiveTree;
|
|
5
|
+
export declare function countArchiveArticles(articles: ArchiveTree): number;
|
|
6
|
+
export declare function formatArchiveDay(publishAt: string): string;
|
|
7
|
+
export declare function sortedArchiveYears(articles: ArchiveTree): string[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.slimArchiveTree = slimArchiveTree;
|
|
4
|
+
exports.countArchiveArticles = countArchiveArticles;
|
|
5
|
+
exports.formatArchiveDay = formatArchiveDay;
|
|
6
|
+
exports.sortedArchiveYears = sortedArchiveYears;
|
|
7
|
+
function slimArchiveTree(raw) {
|
|
8
|
+
const out = {};
|
|
9
|
+
for (const year of Object.keys(raw)) {
|
|
10
|
+
out[year] = {};
|
|
11
|
+
for (const month of Object.keys(raw[year])) {
|
|
12
|
+
out[year][month] = raw[year][month].map(({ id, title, publishAt }) => ({
|
|
13
|
+
id,
|
|
14
|
+
title,
|
|
15
|
+
publishAt,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
function countArchiveArticles(articles) {
|
|
22
|
+
let total = 0;
|
|
23
|
+
for (const year of Object.keys(articles)) {
|
|
24
|
+
for (const month of Object.keys(articles[year])) {
|
|
25
|
+
total += articles[year][month].length;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return total;
|
|
29
|
+
}
|
|
30
|
+
function formatArchiveDay(publishAt) {
|
|
31
|
+
const date = new Date(publishAt);
|
|
32
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
33
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
34
|
+
return `${month}-${day}`;
|
|
35
|
+
}
|
|
36
|
+
function sortedArchiveYears(articles) {
|
|
37
|
+
return Object.keys(articles).sort((a, b) => +b - +a);
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IArticle } from '../../types';
|
|
2
|
+
/** Fields required by article list cards — omit content/html/toc from SSR payload. */
|
|
3
|
+
export type ListArticle = Pick<IArticle, 'id' | 'title' | 'cover' | 'summary' | 'likes' | 'views' | 'publishAt'> & {
|
|
4
|
+
category?: Pick<NonNullable<IArticle['category']>, 'value' | 'label'>;
|
|
5
|
+
};
|
|
6
|
+
export type CarouselArticle = Pick<IArticle, 'id' | 'title' | 'cover' | 'publishAt' | 'views'>;
|
|
7
|
+
export declare function slimArticleForList(article: IArticle): ListArticle;
|
|
8
|
+
export declare function slimArticlesForList(articles: IArticle[]): ListArticle[];
|
|
9
|
+
export declare function slimArticleForCarousel(article: IArticle): CarouselArticle;
|
|
10
|
+
export declare function slimArticlesForCarousel(articles: IArticle[]): CarouselArticle[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.slimArticleForList = slimArticleForList;
|
|
4
|
+
exports.slimArticlesForList = slimArticlesForList;
|
|
5
|
+
exports.slimArticleForCarousel = slimArticleForCarousel;
|
|
6
|
+
exports.slimArticlesForCarousel = slimArticlesForCarousel;
|
|
7
|
+
function slimArticleForList(article) {
|
|
8
|
+
return {
|
|
9
|
+
id: article.id,
|
|
10
|
+
title: article.title,
|
|
11
|
+
cover: article.cover,
|
|
12
|
+
summary: article.summary,
|
|
13
|
+
likes: article.likes,
|
|
14
|
+
views: article.views,
|
|
15
|
+
publishAt: article.publishAt,
|
|
16
|
+
category: article.category
|
|
17
|
+
? { value: article.category.value, label: article.category.label }
|
|
18
|
+
: undefined,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function slimArticlesForList(articles) {
|
|
22
|
+
return articles.map(slimArticleForList);
|
|
23
|
+
}
|
|
24
|
+
function slimArticleForCarousel(article) {
|
|
25
|
+
return {
|
|
26
|
+
id: article.id,
|
|
27
|
+
title: article.title,
|
|
28
|
+
cover: article.cover,
|
|
29
|
+
publishAt: article.publishAt,
|
|
30
|
+
views: article.views,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function slimArticlesForCarousel(articles) {
|
|
34
|
+
return articles.map(slimArticleForCarousel);
|
|
35
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Whether a configured asset path is likely to resolve (skip broken defaults like `/logo.png`). */
|
|
2
|
+
export declare function isLikelyValidAssetPath(url: string | undefined | null): boolean;
|
|
3
|
+
/** Header logo — uploads only; default wordmark `/logo.png` is shown via `SiteBranding` text instead. */
|
|
4
|
+
export declare function isLikelyValidHeaderLogoPath(url: string | undefined | null): boolean;
|
|
5
|
+
/** Resolve media / logo URLs for theme pages. */
|
|
6
|
+
export declare function resolvePublicAssetUrl(url: string | undefined | null): string;
|
|
7
|
+
/** Rewrite relative asset URLs inside rendered article HTML (`src`, `href`). */
|
|
8
|
+
export declare function rewriteArticleHtmlAssets(html: string | undefined | null): string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLikelyValidAssetPath = isLikelyValidAssetPath;
|
|
4
|
+
exports.isLikelyValidHeaderLogoPath = isLikelyValidHeaderLogoPath;
|
|
5
|
+
exports.resolvePublicAssetUrl = resolvePublicAssetUrl;
|
|
6
|
+
exports.rewriteArticleHtmlAssets = rewriteArticleHtmlAssets;
|
|
7
|
+
/** Legacy root paths that live under API `/public` on the server. */
|
|
8
|
+
const PUBLIC_PATH_ALIASES = {
|
|
9
|
+
'/logo.png': '/public/logo.png',
|
|
10
|
+
'/favicon.png': '/public/favicon.png',
|
|
11
|
+
'/favicon.ico': '/public/favicon.ico',
|
|
12
|
+
};
|
|
13
|
+
function normalizePublicAssetPath(path) {
|
|
14
|
+
return PUBLIC_PATH_ALIASES[path] ?? path;
|
|
15
|
+
}
|
|
16
|
+
/** Whether a configured asset path is likely to resolve (skip broken defaults like `/logo.png`). */
|
|
17
|
+
function isLikelyValidAssetPath(url) {
|
|
18
|
+
const trimmed = (url ?? '').trim();
|
|
19
|
+
if (!trimmed)
|
|
20
|
+
return false;
|
|
21
|
+
if (/^https?:\/\//i.test(trimmed) || trimmed.startsWith('/api/') || trimmed.startsWith('/uploads/')) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (trimmed.startsWith('/public/') && !PUBLIC_PATH_ALIASES[trimmed.replace('/public', '')]) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/** Header logo — uploads only; default wordmark `/logo.png` is shown via `SiteBranding` text instead. */
|
|
30
|
+
function isLikelyValidHeaderLogoPath(url) {
|
|
31
|
+
return isLikelyValidAssetPath(url);
|
|
32
|
+
}
|
|
33
|
+
/** Stable public site origin for asset URLs — matches on SSR and client when `NEXT_PUBLIC_*` is set. */
|
|
34
|
+
function resolvePublicSiteOrigin() {
|
|
35
|
+
const publicApi = (typeof process !== 'undefined' && process.env.NEXT_PUBLIC_REACTPRESS_API_URL?.trim()) || '';
|
|
36
|
+
if (publicApi) {
|
|
37
|
+
return publicApi.replace(/\/api\/?$/, '').replace(/\/$/, '');
|
|
38
|
+
}
|
|
39
|
+
if (typeof window !== 'undefined') {
|
|
40
|
+
return window.location.origin;
|
|
41
|
+
}
|
|
42
|
+
const serverApi = process.env.REACTPRESS_API_URL?.trim() ||
|
|
43
|
+
process.env.SERVER_API_URL?.trim() ||
|
|
44
|
+
'http://localhost:3002/api';
|
|
45
|
+
return serverApi.replace(/\/api\/?$/, '').replace(/\/$/, '');
|
|
46
|
+
}
|
|
47
|
+
/** Resolve media / logo URLs for theme pages. */
|
|
48
|
+
function resolvePublicAssetUrl(url) {
|
|
49
|
+
const trimmed = (url ?? '').trim();
|
|
50
|
+
if (!trimmed)
|
|
51
|
+
return '';
|
|
52
|
+
if (/^https?:\/\//i.test(trimmed) || trimmed.startsWith('data:'))
|
|
53
|
+
return trimmed;
|
|
54
|
+
if (trimmed.startsWith('//')) {
|
|
55
|
+
const protocol = typeof window !== 'undefined' ? window.location.protocol : 'http:';
|
|
56
|
+
return `${protocol}${trimmed}`;
|
|
57
|
+
}
|
|
58
|
+
if (trimmed.startsWith('/')) {
|
|
59
|
+
const normalized = normalizePublicAssetPath(trimmed);
|
|
60
|
+
const origin = resolvePublicSiteOrigin();
|
|
61
|
+
const themeOrigin = typeof window !== 'undefined' ? window.location.origin : origin;
|
|
62
|
+
if (origin === themeOrigin) {
|
|
63
|
+
return normalized;
|
|
64
|
+
}
|
|
65
|
+
return `${origin}${normalized}`;
|
|
66
|
+
}
|
|
67
|
+
return trimmed;
|
|
68
|
+
}
|
|
69
|
+
/** Rewrite relative asset URLs inside rendered article HTML (`src`, `href`). */
|
|
70
|
+
function rewriteArticleHtmlAssets(html) {
|
|
71
|
+
if (!html?.trim())
|
|
72
|
+
return html ?? '';
|
|
73
|
+
return html.replace(/(\b(?:src|href)\s*=\s*)(["'])([^"']+)\2/gi, (_, prefix, quote, url) => `${prefix}${quote}${resolvePublicAssetUrl(url)}${quote}`);
|
|
74
|
+
}
|