@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,16 @@
|
|
|
1
|
+
import type { ThemeMods } from '../extension/theme';
|
|
2
|
+
/** Query key for draft customizer values in live preview iframe (`?reactpress_preview_mods=…`). */
|
|
3
|
+
export declare const PREVIEW_MODS_QUERY_KEY = "reactpress_preview_mods";
|
|
4
|
+
export declare function parsePreviewModsParam(raw: string | null | undefined): ThemeMods;
|
|
5
|
+
/** Read draft mods from a request URL or path+query string. */
|
|
6
|
+
export declare function parsePreviewModsFromRequestUrl(url: string | undefined): ThemeMods;
|
|
7
|
+
export declare function appendPreviewModsToUrl(baseUrl: string, mods: ThemeMods): string;
|
|
8
|
+
export declare function mergePreviewMods(base: ThemeMods, override: ThemeMods): ThemeMods;
|
|
9
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url` — used in `createThemeApp.getInitialProps`. */
|
|
10
|
+
export declare function parsePreviewModsFromNextCtx(ctx: {
|
|
11
|
+
query?: Record<string, string | string[] | undefined>;
|
|
12
|
+
asPath?: string;
|
|
13
|
+
req?: {
|
|
14
|
+
url?: string;
|
|
15
|
+
};
|
|
16
|
+
}): ThemeMods;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PREVIEW_MODS_QUERY_KEY = void 0;
|
|
4
|
+
exports.parsePreviewModsParam = parsePreviewModsParam;
|
|
5
|
+
exports.parsePreviewModsFromRequestUrl = parsePreviewModsFromRequestUrl;
|
|
6
|
+
exports.appendPreviewModsToUrl = appendPreviewModsToUrl;
|
|
7
|
+
exports.mergePreviewMods = mergePreviewMods;
|
|
8
|
+
exports.parsePreviewModsFromNextCtx = parsePreviewModsFromNextCtx;
|
|
9
|
+
/** Query key for draft customizer values in live preview iframe (`?reactpress_preview_mods=…`). */
|
|
10
|
+
exports.PREVIEW_MODS_QUERY_KEY = 'reactpress_preview_mods';
|
|
11
|
+
function parsePreviewModsParam(raw) {
|
|
12
|
+
if (!raw?.trim())
|
|
13
|
+
return {};
|
|
14
|
+
try {
|
|
15
|
+
const parsed = JSON.parse(decodeURIComponent(raw.trim()));
|
|
16
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
17
|
+
return {};
|
|
18
|
+
const out = {};
|
|
19
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
20
|
+
if (value == null || value === '')
|
|
21
|
+
continue;
|
|
22
|
+
out[key] = String(value);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Read draft mods from a request URL or path+query string. */
|
|
31
|
+
function parsePreviewModsFromRequestUrl(url) {
|
|
32
|
+
if (!url?.trim())
|
|
33
|
+
return {};
|
|
34
|
+
try {
|
|
35
|
+
const parsed = new URL(url, 'http://reactpress.local');
|
|
36
|
+
return parsePreviewModsParam(parsed.searchParams.get(exports.PREVIEW_MODS_QUERY_KEY));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function appendPreviewModsToUrl(baseUrl, mods) {
|
|
43
|
+
if (Object.keys(mods).length === 0)
|
|
44
|
+
return baseUrl;
|
|
45
|
+
try {
|
|
46
|
+
const url = baseUrl.includes('://')
|
|
47
|
+
? new URL(baseUrl)
|
|
48
|
+
: new URL(baseUrl, 'http://localhost');
|
|
49
|
+
url.searchParams.set(exports.PREVIEW_MODS_QUERY_KEY, JSON.stringify(mods));
|
|
50
|
+
return url.toString();
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return baseUrl;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function mergePreviewMods(base, override) {
|
|
57
|
+
if (!Object.keys(override).length)
|
|
58
|
+
return base;
|
|
59
|
+
return { ...base, ...override };
|
|
60
|
+
}
|
|
61
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url` — used in `createThemeApp.getInitialProps`. */
|
|
62
|
+
function parsePreviewModsFromNextCtx(ctx) {
|
|
63
|
+
const raw = ctx.query?.[exports.PREVIEW_MODS_QUERY_KEY];
|
|
64
|
+
if (typeof raw === 'string')
|
|
65
|
+
return parsePreviewModsParam(raw);
|
|
66
|
+
if (Array.isArray(raw) && typeof raw[0] === 'string')
|
|
67
|
+
return parsePreviewModsParam(raw[0]);
|
|
68
|
+
const asPath = typeof ctx.asPath === 'string' ? ctx.asPath : '';
|
|
69
|
+
if (asPath.includes('?')) {
|
|
70
|
+
return parsePreviewModsFromRequestUrl(`http://reactpress.local${asPath.startsWith('/') ? asPath : `/${asPath}`}`);
|
|
71
|
+
}
|
|
72
|
+
const reqUrl = ctx.req?.url;
|
|
73
|
+
if (reqUrl && String(reqUrl).includes('?')) {
|
|
74
|
+
const path = String(reqUrl).startsWith('/') ? reqUrl : `/${reqUrl}`;
|
|
75
|
+
return parsePreviewModsFromRequestUrl(`http://reactpress.local${path}`);
|
|
76
|
+
}
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Query key for draft theme configuration in live preview (`?reactpress_preview_config=…`). */
|
|
2
|
+
export declare const PREVIEW_CONFIG_QUERY_KEY = "reactpress_preview_config";
|
|
3
|
+
export declare function parsePreviewConfigParam(raw: string | null | undefined): Record<string, unknown>;
|
|
4
|
+
export declare function parsePreviewConfigFromRequestUrl(url: string | undefined): Record<string, unknown>;
|
|
5
|
+
export declare function appendPreviewConfigToUrl(baseUrl: string, configuration: Record<string, unknown>): string;
|
|
6
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url`. */
|
|
7
|
+
export declare function parsePreviewConfigFromNextCtx(ctx: {
|
|
8
|
+
query?: Record<string, string | string[] | undefined>;
|
|
9
|
+
asPath?: string;
|
|
10
|
+
req?: {
|
|
11
|
+
url?: string;
|
|
12
|
+
};
|
|
13
|
+
}): Record<string, unknown>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PREVIEW_CONFIG_QUERY_KEY = void 0;
|
|
4
|
+
exports.parsePreviewConfigParam = parsePreviewConfigParam;
|
|
5
|
+
exports.parsePreviewConfigFromRequestUrl = parsePreviewConfigFromRequestUrl;
|
|
6
|
+
exports.appendPreviewConfigToUrl = appendPreviewConfigToUrl;
|
|
7
|
+
exports.parsePreviewConfigFromNextCtx = parsePreviewConfigFromNextCtx;
|
|
8
|
+
/** Query key for draft theme configuration in live preview (`?reactpress_preview_config=…`). */
|
|
9
|
+
exports.PREVIEW_CONFIG_QUERY_KEY = 'reactpress_preview_config';
|
|
10
|
+
function parsePreviewConfigParam(raw) {
|
|
11
|
+
if (!raw?.trim())
|
|
12
|
+
return {};
|
|
13
|
+
try {
|
|
14
|
+
const parsed = JSON.parse(decodeURIComponent(raw.trim()));
|
|
15
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
16
|
+
return {};
|
|
17
|
+
return parsed;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function parsePreviewConfigFromRequestUrl(url) {
|
|
24
|
+
if (!url?.trim())
|
|
25
|
+
return {};
|
|
26
|
+
try {
|
|
27
|
+
const parsed = new URL(url, 'http://reactpress.local');
|
|
28
|
+
return parsePreviewConfigParam(parsed.searchParams.get(exports.PREVIEW_CONFIG_QUERY_KEY));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function appendPreviewConfigToUrl(baseUrl, configuration) {
|
|
35
|
+
if (!configuration || Object.keys(configuration).length === 0)
|
|
36
|
+
return baseUrl;
|
|
37
|
+
try {
|
|
38
|
+
const url = baseUrl.includes('://')
|
|
39
|
+
? new URL(baseUrl)
|
|
40
|
+
: new URL(baseUrl, 'http://localhost');
|
|
41
|
+
url.searchParams.set(exports.PREVIEW_CONFIG_QUERY_KEY, JSON.stringify(configuration));
|
|
42
|
+
return url.toString();
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return baseUrl;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url`. */
|
|
49
|
+
function parsePreviewConfigFromNextCtx(ctx) {
|
|
50
|
+
const raw = ctx.query?.[exports.PREVIEW_CONFIG_QUERY_KEY];
|
|
51
|
+
if (typeof raw === 'string')
|
|
52
|
+
return parsePreviewConfigParam(raw);
|
|
53
|
+
if (Array.isArray(raw) && typeof raw[0] === 'string')
|
|
54
|
+
return parsePreviewConfigParam(raw[0]);
|
|
55
|
+
const asPath = typeof ctx.asPath === 'string' ? ctx.asPath : '';
|
|
56
|
+
if (asPath.includes('?')) {
|
|
57
|
+
return parsePreviewConfigFromRequestUrl(`http://reactpress.local${asPath.startsWith('/') ? asPath : `/${asPath}`}`);
|
|
58
|
+
}
|
|
59
|
+
const reqUrl = ctx.req?.url;
|
|
60
|
+
if (reqUrl && String(reqUrl).includes('?')) {
|
|
61
|
+
const path = String(reqUrl).startsWith('/') ? reqUrl : `/${reqUrl}`;
|
|
62
|
+
return parsePreviewConfigFromRequestUrl(`http://reactpress.local${path}`);
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ThemeMods } from './extension/theme';
|
|
2
|
+
/** Short-lived preview payload id (avoids 414 from huge query strings). */
|
|
3
|
+
export declare const PREVIEW_TOKEN_QUERY_KEY = "reactpress_preview_token";
|
|
4
|
+
export type PreviewDraftPayload = {
|
|
5
|
+
/** Theme whose `configuration` / mods apply (defaults to active theme when omitted). */
|
|
6
|
+
themeId?: string;
|
|
7
|
+
mods?: ThemeMods;
|
|
8
|
+
configuration?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
export declare function appendPreviewTokenToUrl(baseUrl: string, token: string): string;
|
|
11
|
+
export declare function parsePreviewTokenFromRequestUrl(url: string | undefined): string;
|
|
12
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url`. */
|
|
13
|
+
export declare function parsePreviewTokenFromNextCtx(ctx: {
|
|
14
|
+
query?: Record<string, string | string[] | undefined>;
|
|
15
|
+
asPath?: string;
|
|
16
|
+
req?: {
|
|
17
|
+
url?: string;
|
|
18
|
+
};
|
|
19
|
+
}): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PREVIEW_TOKEN_QUERY_KEY = void 0;
|
|
4
|
+
exports.appendPreviewTokenToUrl = appendPreviewTokenToUrl;
|
|
5
|
+
exports.parsePreviewTokenFromRequestUrl = parsePreviewTokenFromRequestUrl;
|
|
6
|
+
exports.parsePreviewTokenFromNextCtx = parsePreviewTokenFromNextCtx;
|
|
7
|
+
/** Short-lived preview payload id (avoids 414 from huge query strings). */
|
|
8
|
+
exports.PREVIEW_TOKEN_QUERY_KEY = 'reactpress_preview_token';
|
|
9
|
+
function appendPreviewTokenToUrl(baseUrl, token) {
|
|
10
|
+
if (!token.trim())
|
|
11
|
+
return baseUrl;
|
|
12
|
+
try {
|
|
13
|
+
const url = baseUrl.includes('://')
|
|
14
|
+
? new URL(baseUrl)
|
|
15
|
+
: new URL(baseUrl, 'http://localhost');
|
|
16
|
+
url.searchParams.set(exports.PREVIEW_TOKEN_QUERY_KEY, token);
|
|
17
|
+
return url.toString();
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return baseUrl;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function parsePreviewTokenFromRequestUrl(url) {
|
|
24
|
+
if (!url?.trim())
|
|
25
|
+
return '';
|
|
26
|
+
try {
|
|
27
|
+
const parsed = new URL(url, 'http://reactpress.local');
|
|
28
|
+
return parsed.searchParams.get(exports.PREVIEW_TOKEN_QUERY_KEY)?.trim() ?? '';
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url`. */
|
|
35
|
+
function parsePreviewTokenFromNextCtx(ctx) {
|
|
36
|
+
const raw = ctx.query?.[exports.PREVIEW_TOKEN_QUERY_KEY];
|
|
37
|
+
if (typeof raw === 'string')
|
|
38
|
+
return raw.trim();
|
|
39
|
+
if (Array.isArray(raw) && typeof raw[0] === 'string')
|
|
40
|
+
return raw[0].trim();
|
|
41
|
+
const asPath = typeof ctx.asPath === 'string' ? ctx.asPath : '';
|
|
42
|
+
if (asPath.includes('?')) {
|
|
43
|
+
return parsePreviewTokenFromRequestUrl(`http://reactpress.local${asPath.startsWith('/') ? asPath : `/${asPath}`}`);
|
|
44
|
+
}
|
|
45
|
+
const reqUrl = ctx.req?.url;
|
|
46
|
+
if (reqUrl && String(reqUrl).includes('?')) {
|
|
47
|
+
const path = String(reqUrl).startsWith('/') ? reqUrl : `/${reqUrl}`;
|
|
48
|
+
return parsePreviewTokenFromRequestUrl(`http://reactpress.local${path}`);
|
|
49
|
+
}
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ThemeMods } from './extension/theme';
|
|
2
|
+
/** Query key for draft customizer values in live preview iframe (`?reactpress_preview_mods=…`). */
|
|
3
|
+
export declare const PREVIEW_MODS_QUERY_KEY = "reactpress_preview_mods";
|
|
4
|
+
export declare function parsePreviewModsParam(raw: string | null | undefined): ThemeMods;
|
|
5
|
+
/** Read draft mods from a request URL or path+query string. */
|
|
6
|
+
export declare function parsePreviewModsFromRequestUrl(url: string | undefined): ThemeMods;
|
|
7
|
+
export declare function appendPreviewModsToUrl(baseUrl: string, mods: ThemeMods): string;
|
|
8
|
+
export declare function mergePreviewMods(base: ThemeMods, override: ThemeMods): ThemeMods;
|
|
9
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url` — used in `createThemeApp.getInitialProps`. */
|
|
10
|
+
export declare function parsePreviewModsFromNextCtx(ctx: {
|
|
11
|
+
query?: Record<string, string | string[] | undefined>;
|
|
12
|
+
asPath?: string;
|
|
13
|
+
req?: {
|
|
14
|
+
url?: string;
|
|
15
|
+
};
|
|
16
|
+
}): ThemeMods;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PREVIEW_MODS_QUERY_KEY = void 0;
|
|
4
|
+
exports.parsePreviewModsParam = parsePreviewModsParam;
|
|
5
|
+
exports.parsePreviewModsFromRequestUrl = parsePreviewModsFromRequestUrl;
|
|
6
|
+
exports.appendPreviewModsToUrl = appendPreviewModsToUrl;
|
|
7
|
+
exports.mergePreviewMods = mergePreviewMods;
|
|
8
|
+
exports.parsePreviewModsFromNextCtx = parsePreviewModsFromNextCtx;
|
|
9
|
+
/** Query key for draft customizer values in live preview iframe (`?reactpress_preview_mods=…`). */
|
|
10
|
+
exports.PREVIEW_MODS_QUERY_KEY = 'reactpress_preview_mods';
|
|
11
|
+
function parsePreviewModsParam(raw) {
|
|
12
|
+
if (!raw?.trim())
|
|
13
|
+
return {};
|
|
14
|
+
try {
|
|
15
|
+
const parsed = JSON.parse(decodeURIComponent(raw.trim()));
|
|
16
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
17
|
+
return {};
|
|
18
|
+
const out = {};
|
|
19
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
20
|
+
if (value == null || value === '')
|
|
21
|
+
continue;
|
|
22
|
+
out[key] = String(value);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Read draft mods from a request URL or path+query string. */
|
|
31
|
+
function parsePreviewModsFromRequestUrl(url) {
|
|
32
|
+
if (!url?.trim())
|
|
33
|
+
return {};
|
|
34
|
+
try {
|
|
35
|
+
const parsed = new URL(url, 'http://reactpress.local');
|
|
36
|
+
return parsePreviewModsParam(parsed.searchParams.get(exports.PREVIEW_MODS_QUERY_KEY));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function appendPreviewModsToUrl(baseUrl, mods) {
|
|
43
|
+
if (Object.keys(mods).length === 0)
|
|
44
|
+
return baseUrl;
|
|
45
|
+
try {
|
|
46
|
+
const url = baseUrl.includes('://')
|
|
47
|
+
? new URL(baseUrl)
|
|
48
|
+
: new URL(baseUrl, 'http://localhost');
|
|
49
|
+
url.searchParams.set(exports.PREVIEW_MODS_QUERY_KEY, JSON.stringify(mods));
|
|
50
|
+
return url.toString();
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return baseUrl;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function mergePreviewMods(base, override) {
|
|
57
|
+
if (!Object.keys(override).length)
|
|
58
|
+
return base;
|
|
59
|
+
return { ...base, ...override };
|
|
60
|
+
}
|
|
61
|
+
/** Next.js Pages `ctx.query` / `asPath` / `req.url` — used in `createThemeApp.getInitialProps`. */
|
|
62
|
+
function parsePreviewModsFromNextCtx(ctx) {
|
|
63
|
+
const raw = ctx.query?.[exports.PREVIEW_MODS_QUERY_KEY];
|
|
64
|
+
if (typeof raw === 'string')
|
|
65
|
+
return parsePreviewModsParam(raw);
|
|
66
|
+
if (Array.isArray(raw) && typeof raw[0] === 'string')
|
|
67
|
+
return parsePreviewModsParam(raw[0]);
|
|
68
|
+
const asPath = typeof ctx.asPath === 'string' ? ctx.asPath : '';
|
|
69
|
+
if (asPath.includes('?')) {
|
|
70
|
+
return parsePreviewModsFromRequestUrl(`http://reactpress.local${asPath.startsWith('/') ? asPath : `/${asPath}`}`);
|
|
71
|
+
}
|
|
72
|
+
const reqUrl = ctx.req?.url;
|
|
73
|
+
if (reqUrl && String(reqUrl).includes('?')) {
|
|
74
|
+
const path = String(reqUrl).startsWith('/') ? reqUrl : `/${reqUrl}`;
|
|
75
|
+
return parsePreviewModsFromRequestUrl(`http://reactpress.local${path}`);
|
|
76
|
+
}
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
import type { IArticle, ICategory, IComment, IFile, IKnowledge, IPage, ISetting, ITag, IUser, IView } from '../../types';
|
|
3
|
+
/** Create REST provider classes bound to a theme HTTP client (axios + envelope unwrap). */
|
|
4
|
+
export declare function createThemeProviders(http: AxiosInstance): {
|
|
5
|
+
SettingProvider: {
|
|
6
|
+
new (): {};
|
|
7
|
+
getSetting(): Promise<ISetting>;
|
|
8
|
+
updateSetting(data: Partial<ISetting>): Promise<ISetting>;
|
|
9
|
+
};
|
|
10
|
+
ArticleProvider: {
|
|
11
|
+
new (): {};
|
|
12
|
+
getArticles(params: Record<string, unknown>): Promise<[IArticle[], number]>;
|
|
13
|
+
getAllRecommendArticles(): Promise<IArticle[]>;
|
|
14
|
+
getArticlesByCategory(category: string, params: Record<string, unknown>): Promise<[IArticle[], number]>;
|
|
15
|
+
getArticlesByTag(tag: string, params: Record<string, unknown>): Promise<[IArticle[], number]>;
|
|
16
|
+
getRecommend(articleId?: string | null, pageSize?: number): Promise<IArticle[]>;
|
|
17
|
+
getArchives(): Promise<Record<string, Record<string, IArticle[]>>>;
|
|
18
|
+
getArticle(id: string): Promise<IArticle>;
|
|
19
|
+
addArticle(data: Partial<IArticle>): Promise<IArticle>;
|
|
20
|
+
updateArticle(id: string, data: Partial<IArticle>): Promise<IArticle>;
|
|
21
|
+
updateArticleViews(id: string): Promise<IArticle>;
|
|
22
|
+
updateArticleLikes(id: string, type: string): Promise<IArticle>;
|
|
23
|
+
checkPassword(id: string, password: string): Promise<{
|
|
24
|
+
pass: boolean;
|
|
25
|
+
} & IArticle>;
|
|
26
|
+
deleteArticle(id: string): Promise<IArticle>;
|
|
27
|
+
};
|
|
28
|
+
CategoryProvider: {
|
|
29
|
+
new (): {};
|
|
30
|
+
getCategory(params?: Record<string, unknown>): Promise<ICategory[]>;
|
|
31
|
+
add(data: Partial<ICategory>): Promise<ICategory>;
|
|
32
|
+
getCategoryById(id: string): Promise<ICategory>;
|
|
33
|
+
update(id: string, data: Partial<ICategory>): Promise<ICategory>;
|
|
34
|
+
delete(id: string): Promise<ICategory>;
|
|
35
|
+
};
|
|
36
|
+
TagProvider: {
|
|
37
|
+
new (): {};
|
|
38
|
+
getTags(params?: Record<string, unknown>): Promise<ITag[]>;
|
|
39
|
+
getTagWithArticles(id: string, needFilter?: boolean): Promise<ITag>;
|
|
40
|
+
addTag(data: Partial<ITag>): Promise<ITag>;
|
|
41
|
+
getTagById(id: string): Promise<ITag>;
|
|
42
|
+
updateTag(id: string, data: Partial<ITag>): Promise<ITag>;
|
|
43
|
+
deleteTag(id: string): Promise<ITag>;
|
|
44
|
+
};
|
|
45
|
+
PageProvider: {
|
|
46
|
+
new (): {};
|
|
47
|
+
getPages(params: Record<string, unknown>): Promise<[IPage[], number]>;
|
|
48
|
+
getAllPublisedPages(): Promise<[IPage[], number]>;
|
|
49
|
+
getPage(id: string): Promise<IPage>;
|
|
50
|
+
addPage(data: Partial<IPage>): Promise<IPage>;
|
|
51
|
+
updatePage(id: string, data: Partial<IPage>): Promise<IPage>;
|
|
52
|
+
updatePageViews(id: string): Promise<IPage>;
|
|
53
|
+
deletePage(id: string): Promise<IPage>;
|
|
54
|
+
};
|
|
55
|
+
CommentProvider: {
|
|
56
|
+
new (): {};
|
|
57
|
+
getComments(params: Record<string, unknown>): Promise<[IComment[], number]>;
|
|
58
|
+
getComment(id: string): Promise<IComment>;
|
|
59
|
+
getArticleComments(hostId: string, params: Record<string, unknown>): Promise<[IComment[], number]>;
|
|
60
|
+
addComment(data: Partial<IComment>): Promise<IComment>;
|
|
61
|
+
updateComment(id: string, data: Partial<IComment>): Promise<IComment>;
|
|
62
|
+
deleteComment(id: string): Promise<IComment>;
|
|
63
|
+
};
|
|
64
|
+
UserProvider: {
|
|
65
|
+
new (): {};
|
|
66
|
+
login(data: Record<string, unknown>): Promise<IUser>;
|
|
67
|
+
loginWithGithub(code: string): Promise<IUser>;
|
|
68
|
+
register(data: Record<string, unknown>): Promise<IUser>;
|
|
69
|
+
getUsers(params: Record<string, unknown>): Promise<[IUser[], number]>;
|
|
70
|
+
update(data: Record<string, unknown>): Promise<IUser>;
|
|
71
|
+
updatePassword(data: Record<string, unknown>): Promise<IUser>;
|
|
72
|
+
};
|
|
73
|
+
KnowledgeProvider: {
|
|
74
|
+
new (): {};
|
|
75
|
+
createBook(data: Partial<IKnowledge>): Promise<IKnowledge>;
|
|
76
|
+
createChapters(data: Partial<IKnowledge>[]): Promise<IKnowledge[]>;
|
|
77
|
+
deleteKnowledge(id: string): Promise<IKnowledge>;
|
|
78
|
+
updateKnowledge(id: string, data: Partial<IKnowledge>): Promise<IKnowledge>;
|
|
79
|
+
getKnowledges(params?: Record<string, unknown>): Promise<[IKnowledge[], number]>;
|
|
80
|
+
getKnowledge(id: string): Promise<IKnowledge>;
|
|
81
|
+
updateKnowledgeViews(id: string): Promise<IKnowledge>;
|
|
82
|
+
updateKnowledgeLikes(id: string, type: string): Promise<IKnowledge>;
|
|
83
|
+
};
|
|
84
|
+
SearchProvider: {
|
|
85
|
+
new (): {};
|
|
86
|
+
searchArticles(keyword: string): Promise<IArticle[]>;
|
|
87
|
+
};
|
|
88
|
+
FileProvider: {
|
|
89
|
+
new (): {};
|
|
90
|
+
uploadFile(file: FormData, unique?: number): Promise<IFile>;
|
|
91
|
+
getFiles(params: Record<string, unknown>): Promise<[IFile[], number]>;
|
|
92
|
+
deleteFile(id: string): Promise<IFile>;
|
|
93
|
+
};
|
|
94
|
+
ViewProvider: {
|
|
95
|
+
new (): {};
|
|
96
|
+
getViews(params: Record<string, unknown>): Promise<[IView[], number]>;
|
|
97
|
+
addView(data: Record<string, unknown>): Promise<IView>;
|
|
98
|
+
getViewsByUrl(url: string): Promise<IView[]>;
|
|
99
|
+
deleteView(id: string): Promise<IView>;
|
|
100
|
+
};
|
|
101
|
+
MailProvider: {
|
|
102
|
+
new (): {};
|
|
103
|
+
getMails(params: Record<string, unknown>): Promise<[Record<string, unknown>[], number]>;
|
|
104
|
+
deleteMail(id: string): Promise<Record<string, unknown>>;
|
|
105
|
+
};
|
|
106
|
+
SmtpProvider: {
|
|
107
|
+
new (): {};
|
|
108
|
+
testSendMail(user: Record<string, unknown>): Promise<IFile>;
|
|
109
|
+
};
|
|
110
|
+
PosterProvider: {
|
|
111
|
+
new (): {};
|
|
112
|
+
createPoster(data: Record<string, unknown>): Promise<{
|
|
113
|
+
name: string;
|
|
114
|
+
url: string;
|
|
115
|
+
}>;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export type ThemeProviders = ReturnType<typeof createThemeProviders>;
|