@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,89 @@
|
|
|
1
|
+
/** WordPress-style theme manifest and site theme state (shared by server / web / themes). */
|
|
2
|
+
import type { ThemeConfigurationSchema } from './configuration/types';
|
|
3
|
+
export interface ThemeAppearanceChoice {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
/** Appearance control (declared in `theme.json` → `appearance.sections`). */
|
|
8
|
+
export interface ThemeAppearanceSetting {
|
|
9
|
+
id: string;
|
|
10
|
+
type: 'color' | 'text' | 'image' | 'textarea' | 'checkbox' | 'select' | 'noticeList';
|
|
11
|
+
label: string;
|
|
12
|
+
default?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
choices?: ThemeAppearanceChoice[];
|
|
15
|
+
/** Sub-group within a section (e.g. light vs dark colors). */
|
|
16
|
+
group?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Sidebar nav panel (Site Identity, Colors, …). */
|
|
19
|
+
export interface ThemeAppearancePanel {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Control group inside a section panel (e.g. Light / Dark). */
|
|
25
|
+
export interface ThemeAppearanceGroup {
|
|
26
|
+
id: string;
|
|
27
|
+
title: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ThemeAppearanceSection {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
/** Nav panel id (`appearance.panels[].id`). */
|
|
34
|
+
panel?: string;
|
|
35
|
+
settings?: ThemeAppearanceSetting[];
|
|
36
|
+
groups?: ThemeAppearanceGroup[];
|
|
37
|
+
/** Embed the theme `options` schema form instead of inline controls. */
|
|
38
|
+
embed?: 'options';
|
|
39
|
+
description?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ThemeAppearanceManifest {
|
|
42
|
+
panels?: ThemeAppearancePanel[];
|
|
43
|
+
sections: ThemeAppearanceSection[];
|
|
44
|
+
}
|
|
45
|
+
export type { ThemeMods } from './branding-mods';
|
|
46
|
+
export { applyThemeModsToSiteSetting, seedThemeModsFromLegacySetting, THEME_BRANDING_DIRECT_MODS, THEME_BRANDING_MOD_TO_SETTING, } from './branding-mods';
|
|
47
|
+
import type { ThemeMods } from './branding-mods';
|
|
48
|
+
export { appearancePrimaryColorForMode } from './twentytwentyfive-vars';
|
|
49
|
+
/** Primary color from appearance mods (Ant Design / CSS), light mode. */
|
|
50
|
+
export declare function appearancePrimaryColor(mods: ThemeMods, fallback?: string): string;
|
|
51
|
+
export interface ThemeManifest {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
version: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
author?: string;
|
|
57
|
+
authorUri?: string;
|
|
58
|
+
themeUri?: string;
|
|
59
|
+
tags?: string[];
|
|
60
|
+
/** Theme cover image path (relative to theme root). Shown in admin theme list / preview. */
|
|
61
|
+
cover?: string;
|
|
62
|
+
requires?: string;
|
|
63
|
+
supports?: Record<string, unknown>;
|
|
64
|
+
templates?: Record<string, string>;
|
|
65
|
+
options?: ThemeConfigurationSchema;
|
|
66
|
+
appearance?: ThemeAppearanceManifest;
|
|
67
|
+
}
|
|
68
|
+
export interface SiteThemeState {
|
|
69
|
+
activeTheme: string;
|
|
70
|
+
installedThemes: string[];
|
|
71
|
+
mods: Record<string, ThemeMods>;
|
|
72
|
+
previewThemeId?: string;
|
|
73
|
+
}
|
|
74
|
+
export declare const DEFAULT_ACTIVE_THEME = "twentytwentyfive";
|
|
75
|
+
export declare const defaultSiteThemeState: SiteThemeState;
|
|
76
|
+
export interface GlobalSettingWithTheme {
|
|
77
|
+
zh?: unknown;
|
|
78
|
+
en?: unknown;
|
|
79
|
+
theme?: SiteThemeState;
|
|
80
|
+
config?: Record<string, Record<string, unknown>>;
|
|
81
|
+
[key: string]: unknown;
|
|
82
|
+
}
|
|
83
|
+
export declare function parseThemeManifest(raw: unknown): ThemeManifest | null;
|
|
84
|
+
export declare function getThemeStateFromGlobalSetting(raw: unknown): SiteThemeState;
|
|
85
|
+
export { resolvePublicAssetUrl } from '../theme/assets';
|
|
86
|
+
export { appendPreviewConfigToUrl, parsePreviewConfigFromNextCtx, parsePreviewConfigFromRequestUrl, parsePreviewConfigParam, PREVIEW_CONFIG_QUERY_KEY, } from '../theme/preview-config';
|
|
87
|
+
export { appendPreviewTokenToUrl, parsePreviewTokenFromNextCtx, parsePreviewTokenFromRequestUrl, PREVIEW_TOKEN_QUERY_KEY, type PreviewDraftPayload, } from '../theme/preview-draft';
|
|
88
|
+
export { appendPreviewModsToUrl, mergePreviewMods, parsePreviewModsFromNextCtx, parsePreviewModsFromRequestUrl, parsePreviewModsParam, PREVIEW_MODS_QUERY_KEY, } from '../theme/preview-mods';
|
|
89
|
+
export declare function mergeThemeStateIntoGlobalSetting(raw: unknown, patch: Partial<SiteThemeState>): GlobalSettingWithTheme;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** WordPress-style theme manifest and site theme state (shared by server / web / themes). */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PREVIEW_MODS_QUERY_KEY = exports.parsePreviewModsParam = exports.parsePreviewModsFromRequestUrl = exports.parsePreviewModsFromNextCtx = exports.mergePreviewMods = exports.appendPreviewModsToUrl = exports.PREVIEW_TOKEN_QUERY_KEY = exports.parsePreviewTokenFromRequestUrl = exports.parsePreviewTokenFromNextCtx = exports.appendPreviewTokenToUrl = exports.PREVIEW_CONFIG_QUERY_KEY = exports.parsePreviewConfigParam = exports.parsePreviewConfigFromRequestUrl = exports.parsePreviewConfigFromNextCtx = exports.appendPreviewConfigToUrl = exports.resolvePublicAssetUrl = exports.defaultSiteThemeState = exports.DEFAULT_ACTIVE_THEME = exports.appearancePrimaryColorForMode = exports.THEME_BRANDING_MOD_TO_SETTING = exports.THEME_BRANDING_DIRECT_MODS = exports.seedThemeModsFromLegacySetting = exports.applyThemeModsToSiteSetting = void 0;
|
|
5
|
+
exports.appearancePrimaryColor = appearancePrimaryColor;
|
|
6
|
+
exports.parseThemeManifest = parseThemeManifest;
|
|
7
|
+
exports.getThemeStateFromGlobalSetting = getThemeStateFromGlobalSetting;
|
|
8
|
+
exports.mergeThemeStateIntoGlobalSetting = mergeThemeStateIntoGlobalSetting;
|
|
9
|
+
const manifest_normalize_1 = require("./manifest-normalize");
|
|
10
|
+
var branding_mods_1 = require("./branding-mods");
|
|
11
|
+
Object.defineProperty(exports, "applyThemeModsToSiteSetting", { enumerable: true, get: function () { return branding_mods_1.applyThemeModsToSiteSetting; } });
|
|
12
|
+
Object.defineProperty(exports, "seedThemeModsFromLegacySetting", { enumerable: true, get: function () { return branding_mods_1.seedThemeModsFromLegacySetting; } });
|
|
13
|
+
Object.defineProperty(exports, "THEME_BRANDING_DIRECT_MODS", { enumerable: true, get: function () { return branding_mods_1.THEME_BRANDING_DIRECT_MODS; } });
|
|
14
|
+
Object.defineProperty(exports, "THEME_BRANDING_MOD_TO_SETTING", { enumerable: true, get: function () { return branding_mods_1.THEME_BRANDING_MOD_TO_SETTING; } });
|
|
15
|
+
const twentytwentyfive_vars_1 = require("./twentytwentyfive-vars");
|
|
16
|
+
var twentytwentyfive_vars_2 = require("./twentytwentyfive-vars");
|
|
17
|
+
Object.defineProperty(exports, "appearancePrimaryColorForMode", { enumerable: true, get: function () { return twentytwentyfive_vars_2.appearancePrimaryColorForMode; } });
|
|
18
|
+
/** Primary color from appearance mods (Ant Design / CSS), light mode. */
|
|
19
|
+
function appearancePrimaryColor(mods, fallback = '#f44336') {
|
|
20
|
+
return (0, twentytwentyfive_vars_1.appearancePrimaryColorForMode)(mods, false, fallback);
|
|
21
|
+
}
|
|
22
|
+
exports.DEFAULT_ACTIVE_THEME = 'twentytwentyfive';
|
|
23
|
+
exports.defaultSiteThemeState = {
|
|
24
|
+
activeTheme: exports.DEFAULT_ACTIVE_THEME,
|
|
25
|
+
installedThemes: [exports.DEFAULT_ACTIVE_THEME],
|
|
26
|
+
mods: {},
|
|
27
|
+
};
|
|
28
|
+
function parseThemeManifest(raw) {
|
|
29
|
+
if (!raw || typeof raw !== 'object')
|
|
30
|
+
return null;
|
|
31
|
+
const o = raw;
|
|
32
|
+
if (typeof o.id !== 'string' || typeof o.name !== 'string')
|
|
33
|
+
return null;
|
|
34
|
+
const platform = (0, manifest_normalize_1.normalizePlatformFields)(o);
|
|
35
|
+
const appearance = (0, manifest_normalize_1.normalizeAppearance)(o.appearance);
|
|
36
|
+
return {
|
|
37
|
+
id: o.id,
|
|
38
|
+
name: o.name,
|
|
39
|
+
version: typeof o.version === 'string' ? o.version : '1.0.0',
|
|
40
|
+
description: typeof o.description === 'string' ? o.description : undefined,
|
|
41
|
+
author: typeof o.author === 'string' ? o.author : undefined,
|
|
42
|
+
authorUri: typeof o.authorUri === 'string' ? o.authorUri : undefined,
|
|
43
|
+
themeUri: typeof o.themeUri === 'string' ? o.themeUri : undefined,
|
|
44
|
+
tags: Array.isArray(o.tags) ? o.tags.filter((t) => typeof t === 'string') : undefined,
|
|
45
|
+
cover: typeof o.cover === 'string' ? o.cover : undefined,
|
|
46
|
+
...platform,
|
|
47
|
+
appearance,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function getThemeStateFromGlobalSetting(raw) {
|
|
51
|
+
if (!raw || typeof raw !== 'object')
|
|
52
|
+
return { ...exports.defaultSiteThemeState };
|
|
53
|
+
const gs = raw;
|
|
54
|
+
const theme = gs.theme;
|
|
55
|
+
if (!theme || typeof theme !== 'object')
|
|
56
|
+
return { ...exports.defaultSiteThemeState };
|
|
57
|
+
return {
|
|
58
|
+
activeTheme: typeof theme.activeTheme === 'string' ? theme.activeTheme : exports.defaultSiteThemeState.activeTheme,
|
|
59
|
+
installedThemes: Array.isArray(theme.installedThemes)
|
|
60
|
+
? theme.installedThemes.filter((id) => typeof id === 'string')
|
|
61
|
+
: [...exports.defaultSiteThemeState.installedThemes],
|
|
62
|
+
mods: theme.mods && typeof theme.mods === 'object'
|
|
63
|
+
? theme.mods
|
|
64
|
+
: {},
|
|
65
|
+
previewThemeId: typeof theme.previewThemeId === 'string' ? theme.previewThemeId : undefined,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
var assets_1 = require("../theme/assets");
|
|
69
|
+
Object.defineProperty(exports, "resolvePublicAssetUrl", { enumerable: true, get: function () { return assets_1.resolvePublicAssetUrl; } });
|
|
70
|
+
var preview_config_1 = require("../theme/preview-config");
|
|
71
|
+
Object.defineProperty(exports, "appendPreviewConfigToUrl", { enumerable: true, get: function () { return preview_config_1.appendPreviewConfigToUrl; } });
|
|
72
|
+
Object.defineProperty(exports, "parsePreviewConfigFromNextCtx", { enumerable: true, get: function () { return preview_config_1.parsePreviewConfigFromNextCtx; } });
|
|
73
|
+
Object.defineProperty(exports, "parsePreviewConfigFromRequestUrl", { enumerable: true, get: function () { return preview_config_1.parsePreviewConfigFromRequestUrl; } });
|
|
74
|
+
Object.defineProperty(exports, "parsePreviewConfigParam", { enumerable: true, get: function () { return preview_config_1.parsePreviewConfigParam; } });
|
|
75
|
+
Object.defineProperty(exports, "PREVIEW_CONFIG_QUERY_KEY", { enumerable: true, get: function () { return preview_config_1.PREVIEW_CONFIG_QUERY_KEY; } });
|
|
76
|
+
var preview_draft_1 = require("../theme/preview-draft");
|
|
77
|
+
Object.defineProperty(exports, "appendPreviewTokenToUrl", { enumerable: true, get: function () { return preview_draft_1.appendPreviewTokenToUrl; } });
|
|
78
|
+
Object.defineProperty(exports, "parsePreviewTokenFromNextCtx", { enumerable: true, get: function () { return preview_draft_1.parsePreviewTokenFromNextCtx; } });
|
|
79
|
+
Object.defineProperty(exports, "parsePreviewTokenFromRequestUrl", { enumerable: true, get: function () { return preview_draft_1.parsePreviewTokenFromRequestUrl; } });
|
|
80
|
+
Object.defineProperty(exports, "PREVIEW_TOKEN_QUERY_KEY", { enumerable: true, get: function () { return preview_draft_1.PREVIEW_TOKEN_QUERY_KEY; } });
|
|
81
|
+
var preview_mods_1 = require("../theme/preview-mods");
|
|
82
|
+
Object.defineProperty(exports, "appendPreviewModsToUrl", { enumerable: true, get: function () { return preview_mods_1.appendPreviewModsToUrl; } });
|
|
83
|
+
Object.defineProperty(exports, "mergePreviewMods", { enumerable: true, get: function () { return preview_mods_1.mergePreviewMods; } });
|
|
84
|
+
Object.defineProperty(exports, "parsePreviewModsFromNextCtx", { enumerable: true, get: function () { return preview_mods_1.parsePreviewModsFromNextCtx; } });
|
|
85
|
+
Object.defineProperty(exports, "parsePreviewModsFromRequestUrl", { enumerable: true, get: function () { return preview_mods_1.parsePreviewModsFromRequestUrl; } });
|
|
86
|
+
Object.defineProperty(exports, "parsePreviewModsParam", { enumerable: true, get: function () { return preview_mods_1.parsePreviewModsParam; } });
|
|
87
|
+
Object.defineProperty(exports, "PREVIEW_MODS_QUERY_KEY", { enumerable: true, get: function () { return preview_mods_1.PREVIEW_MODS_QUERY_KEY; } });
|
|
88
|
+
function mergeThemeStateIntoGlobalSetting(raw, patch) {
|
|
89
|
+
const base = raw && typeof raw === 'object' ? { ...raw } : {};
|
|
90
|
+
const current = getThemeStateFromGlobalSetting(base);
|
|
91
|
+
base.theme = { ...current, ...patch };
|
|
92
|
+
return base;
|
|
93
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ThemeMods } from './branding-mods';
|
|
2
|
+
export declare function appearanceBackgroundColor(mods: ThemeMods, fallback?: string): string | undefined;
|
|
3
|
+
export declare function appearanceSecondaryBackgroundColor(mods: ThemeMods): string | undefined;
|
|
4
|
+
export declare function appearanceLinkColor(mods: ThemeMods): string | undefined;
|
|
5
|
+
export declare function appearancePrimaryColorForMode(mods: ThemeMods, dark: boolean, fallback?: string): string;
|
|
6
|
+
/** Maps Twenty Twenty-Five appearance color mods to theme CSS variables. */
|
|
7
|
+
export declare function buildTwentyTwentyFiveAppearanceCss(mods: ThemeMods): string;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appearanceBackgroundColor = appearanceBackgroundColor;
|
|
4
|
+
exports.appearanceSecondaryBackgroundColor = appearanceSecondaryBackgroundColor;
|
|
5
|
+
exports.appearanceLinkColor = appearanceLinkColor;
|
|
6
|
+
exports.appearancePrimaryColorForMode = appearancePrimaryColorForMode;
|
|
7
|
+
exports.buildTwentyTwentyFiveAppearanceCss = buildTwentyTwentyFiveAppearanceCss;
|
|
8
|
+
const branding_mods_1 = require("./branding-mods");
|
|
9
|
+
const HEX_COLOR = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
10
|
+
function normalizeHexColor(value) {
|
|
11
|
+
if (!value)
|
|
12
|
+
return undefined;
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
if (!HEX_COLOR.test(trimmed))
|
|
15
|
+
return undefined;
|
|
16
|
+
if (trimmed.length === 4) {
|
|
17
|
+
const [, r, g, b] = trimmed;
|
|
18
|
+
return `#${r}${r}${g}${g}${b}${b}`.toLowerCase();
|
|
19
|
+
}
|
|
20
|
+
return trimmed.toLowerCase();
|
|
21
|
+
}
|
|
22
|
+
function hexToRgbChannels(hex) {
|
|
23
|
+
const normalized = normalizeHexColor(hex);
|
|
24
|
+
if (!normalized)
|
|
25
|
+
return null;
|
|
26
|
+
const raw = normalized.slice(1);
|
|
27
|
+
const r = parseInt(raw.slice(0, 2), 16);
|
|
28
|
+
const g = parseInt(raw.slice(2, 4), 16);
|
|
29
|
+
const b = parseInt(raw.slice(4, 6), 16);
|
|
30
|
+
if ([r, g, b].some((n) => Number.isNaN(n)))
|
|
31
|
+
return null;
|
|
32
|
+
return `${r}, ${g}, ${b}`;
|
|
33
|
+
}
|
|
34
|
+
const LIGHT_COLOR_KEYS = {
|
|
35
|
+
primary: 'primaryColor',
|
|
36
|
+
background: 'backgroundColor',
|
|
37
|
+
secondaryBackground: 'secondaryBackgroundColor',
|
|
38
|
+
link: 'linkColor',
|
|
39
|
+
};
|
|
40
|
+
const DARK_COLOR_KEYS = {
|
|
41
|
+
primary: 'darkPrimaryColor',
|
|
42
|
+
background: 'darkBackgroundColor',
|
|
43
|
+
secondaryBackground: 'darkSecondaryBackgroundColor',
|
|
44
|
+
link: 'darkLinkColor',
|
|
45
|
+
};
|
|
46
|
+
function buildModeColorDeclarations(mods, keys) {
|
|
47
|
+
const primary = normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, keys.primary));
|
|
48
|
+
const background = normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, keys.background));
|
|
49
|
+
const secondaryBg = normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, keys.secondaryBackground));
|
|
50
|
+
const link = normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, keys.link));
|
|
51
|
+
const declarations = [];
|
|
52
|
+
if (primary)
|
|
53
|
+
declarations.push(`--primary-color: ${primary};`);
|
|
54
|
+
if (background) {
|
|
55
|
+
declarations.push(`--bg: ${background};`);
|
|
56
|
+
declarations.push(`--bg-body: ${background};`);
|
|
57
|
+
}
|
|
58
|
+
if (secondaryBg) {
|
|
59
|
+
declarations.push(`--bg-second: ${secondaryBg};`);
|
|
60
|
+
declarations.push(`--bg-box: ${secondaryBg};`);
|
|
61
|
+
const rgb = hexToRgbChannels(secondaryBg);
|
|
62
|
+
if (rgb)
|
|
63
|
+
declarations.push(`--rgb-bg-second: ${rgb};`);
|
|
64
|
+
}
|
|
65
|
+
else if (background) {
|
|
66
|
+
declarations.push(`--bg-box: ${background};`);
|
|
67
|
+
}
|
|
68
|
+
if (link)
|
|
69
|
+
declarations.push(`--link-color: ${link};`);
|
|
70
|
+
return declarations;
|
|
71
|
+
}
|
|
72
|
+
function appearanceBackgroundColor(mods, fallback) {
|
|
73
|
+
const v = (0, branding_mods_1.brandingModValue)(mods, LIGHT_COLOR_KEYS.background);
|
|
74
|
+
return normalizeHexColor(v) ?? (fallback ? normalizeHexColor(fallback) : undefined);
|
|
75
|
+
}
|
|
76
|
+
function appearanceSecondaryBackgroundColor(mods) {
|
|
77
|
+
return normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, LIGHT_COLOR_KEYS.secondaryBackground));
|
|
78
|
+
}
|
|
79
|
+
function appearanceLinkColor(mods) {
|
|
80
|
+
return normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, LIGHT_COLOR_KEYS.link));
|
|
81
|
+
}
|
|
82
|
+
function appearancePrimaryColorForMode(mods, dark, fallback = '#f44336') {
|
|
83
|
+
const keys = dark ? DARK_COLOR_KEYS : LIGHT_COLOR_KEYS;
|
|
84
|
+
return (normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, keys.primary)) ??
|
|
85
|
+
normalizeHexColor((0, branding_mods_1.brandingModValue)(mods, LIGHT_COLOR_KEYS.primary)) ??
|
|
86
|
+
fallback);
|
|
87
|
+
}
|
|
88
|
+
/** Maps Twenty Twenty-Five appearance color mods to theme CSS variables. */
|
|
89
|
+
function buildTwentyTwentyFiveAppearanceCss(mods) {
|
|
90
|
+
const lightDecl = buildModeColorDeclarations(mods, LIGHT_COLOR_KEYS);
|
|
91
|
+
const darkDecl = buildModeColorDeclarations(mods, DARK_COLOR_KEYS);
|
|
92
|
+
const blocks = [];
|
|
93
|
+
if (lightDecl.length > 0) {
|
|
94
|
+
blocks.push(`body:not(.dark) { ${lightDecl.join(' ')} }`);
|
|
95
|
+
}
|
|
96
|
+
if (darkDecl.length > 0) {
|
|
97
|
+
blocks.push(`body.dark { ${darkDecl.join(' ')} }`);
|
|
98
|
+
}
|
|
99
|
+
return blocks.join('\n');
|
|
100
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export * as config from './config';
|
|
2
|
+
export * as plugin from './plugin';
|
|
3
|
+
export * as theme from './theme';
|
|
4
|
+
export * as types from './types';
|
|
5
|
+
export * as ui from './ui';
|
|
6
|
+
export * as utils from './utils';
|
|
7
|
+
/** @deprecated Prefer `@fecommunity/reactpress-toolkit/api` subpath imports. */
|
|
8
|
+
export { api, createApiInstance, http as httpInstance } from './api/instance';
|
|
9
|
+
export * from './config';
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './utils';
|
|
12
|
+
import { createApiInstance } from './api/instance';
|
|
13
|
+
/** @deprecated Prefer `createApiInstance` from `@fecommunity/reactpress-toolkit/api/instance`. */
|
|
14
|
+
export declare const http: {
|
|
6
15
|
createApiInstance: typeof createApiInstance;
|
|
7
16
|
instance: import("axios").AxiosInstance;
|
|
8
|
-
setSecurityData: (data:
|
|
17
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
9
18
|
request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: import("./api/HttpClient").FullRequestParams) => Promise<T>;
|
|
10
19
|
};
|
|
11
|
-
export { api, types, utils, config, http };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// Do not manually modify this file
|
|
4
|
-
// Generated at: 9/25/2025, 9:47:27 PM
|
|
2
|
+
// Public subpath modules: api, types, ui, utils, theme, plugin, config
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
|
-
Object.
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
8
10
|
}) : (function(o, m, k, k2) {
|
|
9
11
|
if (k2 === undefined) k2 = k;
|
|
10
12
|
o[k2] = m[k];
|
|
@@ -14,25 +16,45 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
16
|
}) : function(o, v) {
|
|
15
17
|
o["default"] = v;
|
|
16
18
|
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
37
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
38
|
};
|
|
24
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.http = exports.
|
|
26
|
-
|
|
40
|
+
exports.http = exports.httpInstance = exports.createApiInstance = exports.api = exports.utils = exports.ui = exports.types = exports.theme = exports.plugin = exports.config = void 0;
|
|
41
|
+
exports.config = __importStar(require("./config"));
|
|
42
|
+
exports.plugin = __importStar(require("./plugin"));
|
|
43
|
+
exports.theme = __importStar(require("./theme"));
|
|
44
|
+
exports.types = __importStar(require("./types"));
|
|
45
|
+
exports.ui = __importStar(require("./ui"));
|
|
46
|
+
exports.utils = __importStar(require("./utils"));
|
|
47
|
+
/** @deprecated Prefer `@fecommunity/reactpress-toolkit/api` subpath imports. */
|
|
48
|
+
var instance_1 = require("./api/instance");
|
|
27
49
|
Object.defineProperty(exports, "api", { enumerable: true, get: function () { return instance_1.api; } });
|
|
28
|
-
|
|
29
|
-
exports.
|
|
30
|
-
|
|
31
|
-
exports
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
Object.defineProperty(exports, "createApiInstance", { enumerable: true, get: function () { return instance_1.createApiInstance; } });
|
|
51
|
+
Object.defineProperty(exports, "httpInstance", { enumerable: true, get: function () { return instance_1.http; } });
|
|
52
|
+
__exportStar(require("./config"), exports);
|
|
53
|
+
__exportStar(require("./types"), exports);
|
|
54
|
+
__exportStar(require("./utils"), exports);
|
|
55
|
+
const instance_2 = require("./api/instance");
|
|
56
|
+
/** @deprecated Prefer `createApiInstance` from `@fecommunity/reactpress-toolkit/api/instance`. */
|
|
57
|
+
exports.http = {
|
|
58
|
+
...instance_2.http,
|
|
59
|
+
createApiInstance: instance_2.createApiInstance,
|
|
37
60
|
};
|
|
38
|
-
exports.http = http;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./permissions"), exports);
|
|
18
|
+
__exportStar(require("./registry"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Admin capability strings — keep in sync with server guards. */
|
|
2
|
+
export type Permission = 'article:read' | 'article:write' | 'article:publish' | 'media:manage' | 'page:manage' | 'user:manage' | 'setting:manage' | 'extension:manage' | 'comment:manage' | 'view:read';
|
|
3
|
+
export declare const ADMIN_PERMISSIONS: Permission[];
|
|
4
|
+
/** Map legacy server roles to capability strings. */
|
|
5
|
+
export declare function permissionsForRole(role: string | undefined): Permission[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ADMIN_PERMISSIONS = void 0;
|
|
4
|
+
exports.permissionsForRole = permissionsForRole;
|
|
5
|
+
exports.ADMIN_PERMISSIONS = [
|
|
6
|
+
'article:read',
|
|
7
|
+
'article:write',
|
|
8
|
+
'article:publish',
|
|
9
|
+
'media:manage',
|
|
10
|
+
'page:manage',
|
|
11
|
+
'user:manage',
|
|
12
|
+
'setting:manage',
|
|
13
|
+
'extension:manage',
|
|
14
|
+
'comment:manage',
|
|
15
|
+
'view:read',
|
|
16
|
+
];
|
|
17
|
+
/** Map legacy server roles to capability strings. */
|
|
18
|
+
function permissionsForRole(role) {
|
|
19
|
+
if (role === 'admin')
|
|
20
|
+
return [...exports.ADMIN_PERMISSIONS];
|
|
21
|
+
if (role === 'editor') {
|
|
22
|
+
return [
|
|
23
|
+
'article:read',
|
|
24
|
+
'article:write',
|
|
25
|
+
'article:publish',
|
|
26
|
+
'media:manage',
|
|
27
|
+
'page:manage',
|
|
28
|
+
'comment:manage',
|
|
29
|
+
'view:read',
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
return ['article:read', 'view:read'];
|
|
33
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Permission } from './permissions';
|
|
2
|
+
export type MenuNodeKind = 'group' | 'item';
|
|
3
|
+
export interface AdminMenuItem {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: MenuNodeKind;
|
|
6
|
+
title: string;
|
|
7
|
+
path: string | null;
|
|
8
|
+
icon?: string | null;
|
|
9
|
+
sort?: number;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
permissions?: Permission[] | null;
|
|
12
|
+
children?: AdminMenuItem[];
|
|
13
|
+
}
|
|
14
|
+
export interface MenuRegisterInput {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
path?: string | null;
|
|
18
|
+
icon?: string | null;
|
|
19
|
+
sort?: number;
|
|
20
|
+
hidden?: boolean;
|
|
21
|
+
permissions?: Permission[] | null;
|
|
22
|
+
children?: MenuRegisterInput[];
|
|
23
|
+
}
|
|
24
|
+
export interface SettingsTabInput {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
path: string;
|
|
28
|
+
permission?: Permission;
|
|
29
|
+
sort?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface RoutePermissionInput {
|
|
32
|
+
path: string;
|
|
33
|
+
permission: Permission | null;
|
|
34
|
+
}
|
|
35
|
+
export interface MenuRegistry {
|
|
36
|
+
register(input: MenuRegisterInput): void;
|
|
37
|
+
getTree(): AdminMenuItem[];
|
|
38
|
+
}
|
|
39
|
+
export interface SettingsRegistry {
|
|
40
|
+
registerTab(input: SettingsTabInput): void;
|
|
41
|
+
getTabs(): SettingsTabInput[];
|
|
42
|
+
}
|
|
43
|
+
export interface PermissionRegistry {
|
|
44
|
+
register(perms: Permission[]): void;
|
|
45
|
+
getAll(): Permission[];
|
|
46
|
+
}
|
|
47
|
+
export interface RouteRegistry {
|
|
48
|
+
registerRoute(input: RoutePermissionInput): void;
|
|
49
|
+
getRoutePermissions(): RoutePermissionInput[];
|
|
50
|
+
}
|
|
51
|
+
export interface AdminContext {
|
|
52
|
+
menu: MenuRegistry;
|
|
53
|
+
settings: SettingsRegistry;
|
|
54
|
+
permissions: PermissionRegistry;
|
|
55
|
+
routes: RouteRegistry;
|
|
56
|
+
}
|
|
57
|
+
export interface AdminModule {
|
|
58
|
+
id: string;
|
|
59
|
+
register(ctx: AdminContext): void;
|
|
60
|
+
}
|
|
61
|
+
export declare function createAdminRegistry(): AdminContext;
|
|
62
|
+
export declare function filterMenuByPermissions(nodes: AdminMenuItem[], granted: Set<string>): AdminMenuItem[];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAdminRegistry = createAdminRegistry;
|
|
4
|
+
exports.filterMenuByPermissions = filterMenuByPermissions;
|
|
5
|
+
function normalizeMenuInput(input) {
|
|
6
|
+
const hasChildren = Boolean(input.children?.length);
|
|
7
|
+
return {
|
|
8
|
+
id: input.id,
|
|
9
|
+
kind: hasChildren && !input.path ? 'group' : 'item',
|
|
10
|
+
title: input.title,
|
|
11
|
+
path: input.path ?? (hasChildren ? null : '/'),
|
|
12
|
+
icon: input.icon ?? null,
|
|
13
|
+
sort: input.sort ?? 0,
|
|
14
|
+
hidden: input.hidden ?? false,
|
|
15
|
+
permissions: input.permissions ?? null,
|
|
16
|
+
children: input.children?.map(normalizeMenuInput),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function createAdminRegistry() {
|
|
20
|
+
const menuItems = [];
|
|
21
|
+
const settingsTabs = [];
|
|
22
|
+
const permissions = new Set();
|
|
23
|
+
const routePermissions = [];
|
|
24
|
+
const menu = {
|
|
25
|
+
register(input) {
|
|
26
|
+
menuItems.push(normalizeMenuInput(input));
|
|
27
|
+
},
|
|
28
|
+
getTree() {
|
|
29
|
+
return [...menuItems].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const settings = {
|
|
33
|
+
registerTab(input) {
|
|
34
|
+
settingsTabs.push(input);
|
|
35
|
+
},
|
|
36
|
+
getTabs() {
|
|
37
|
+
return [...settingsTabs].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const permissionRegistry = {
|
|
41
|
+
register(perms) {
|
|
42
|
+
for (const p of perms)
|
|
43
|
+
permissions.add(p);
|
|
44
|
+
},
|
|
45
|
+
getAll() {
|
|
46
|
+
return [...permissions];
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const routes = {
|
|
50
|
+
registerRoute(input) {
|
|
51
|
+
routePermissions.push(input);
|
|
52
|
+
},
|
|
53
|
+
getRoutePermissions() {
|
|
54
|
+
return routePermissions;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
return { menu, settings, permissions: permissionRegistry, routes };
|
|
58
|
+
}
|
|
59
|
+
function filterMenuByPermissions(nodes, granted) {
|
|
60
|
+
const can = (required) => {
|
|
61
|
+
if (!required?.length)
|
|
62
|
+
return true;
|
|
63
|
+
return required.every((p) => granted.has(p));
|
|
64
|
+
};
|
|
65
|
+
const walk = (list) => list
|
|
66
|
+
.map((node) => {
|
|
67
|
+
if (!can(node.permissions))
|
|
68
|
+
return null;
|
|
69
|
+
if (node.children?.length) {
|
|
70
|
+
const children = walk(node.children);
|
|
71
|
+
if (children.length === 0)
|
|
72
|
+
return null;
|
|
73
|
+
return { ...node, children };
|
|
74
|
+
}
|
|
75
|
+
return node;
|
|
76
|
+
})
|
|
77
|
+
.filter((n) => n != null);
|
|
78
|
+
return walk(nodes);
|
|
79
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createApiInstance } from '../../api/instance';
|
|
2
|
+
export declare class ApiError extends Error {
|
|
3
|
+
code: number;
|
|
4
|
+
constructor(code: number, message: string);
|
|
5
|
+
}
|
|
6
|
+
export interface ClientOptions {
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
getAccessToken?: () => string | null | undefined;
|
|
9
|
+
onUnauthorized?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export type ReactPressClient = ReturnType<typeof createApiInstance>;
|
|
12
|
+
/** Single factory for web / theme / plugins — wraps generated API modules. */
|
|
13
|
+
export declare function createClient(options?: ClientOptions): ReactPressClient;
|
|
14
|
+
export declare function getDefaultApiBaseUrl(): string;
|