@skyroc/scripts 2.5.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.
Files changed (333) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +508 -0
  3. package/dist/cli.mjs +78 -0
  4. package/dist/config-BKkdncJS.mjs +987 -0
  5. package/dist/index.mjs +14 -0
  6. package/package.json +83 -0
  7. package/templates/admin/.env +62 -0
  8. package/templates/admin/.env.prod +7 -0
  9. package/templates/admin/.env.test +7 -0
  10. package/templates/admin/.oxlintrc.json +6 -0
  11. package/templates/admin/README.md +508 -0
  12. package/templates/admin/index.html +14 -0
  13. package/templates/admin/package.json +105 -0
  14. package/templates/admin/public/favicon.svg +3 -0
  15. package/templates/admin/src/App.tsx +71 -0
  16. package/templates/admin/src/assets/audio/wechat-style-notification.wav +0 -0
  17. package/templates/admin/src/assets/imgs/skyroc.jpg +0 -0
  18. package/templates/admin/src/assets/svg-icon/activity.svg +1 -0
  19. package/templates/admin/src/assets/svg-icon/at-sign.svg +1 -0
  20. package/templates/admin/src/assets/svg-icon/avatar.svg +1 -0
  21. package/templates/admin/src/assets/svg-icon/banner.svg +1 -0
  22. package/templates/admin/src/assets/svg-icon/cast.svg +1 -0
  23. package/templates/admin/src/assets/svg-icon/chrome.svg +1 -0
  24. package/templates/admin/src/assets/svg-icon/copy.svg +1 -0
  25. package/templates/admin/src/assets/svg-icon/custom-icon.svg +1 -0
  26. package/templates/admin/src/assets/svg-icon/empty-data.svg +1 -0
  27. package/templates/admin/src/assets/svg-icon/error.svg +1 -0
  28. package/templates/admin/src/assets/svg-icon/expectation.svg +1 -0
  29. package/templates/admin/src/assets/svg-icon/heart.svg +1 -0
  30. package/templates/admin/src/assets/svg-icon/logo.svg +15 -0
  31. package/templates/admin/src/assets/svg-icon/network-error.svg +1 -0
  32. package/templates/admin/src/assets/svg-icon/no-icon.svg +1 -0
  33. package/templates/admin/src/assets/svg-icon/no-permission.svg +1 -0
  34. package/templates/admin/src/assets/svg-icon/not-found.svg +1 -0
  35. package/templates/admin/src/assets/svg-icon/service-error.svg +1 -0
  36. package/templates/admin/src/bootstrap.tsx +60 -0
  37. package/templates/admin/src/components/SkyrocAvatar.tsx +13 -0
  38. package/templates/admin/src/components/SystemLogo.tsx +7 -0
  39. package/templates/admin/src/config.ts +125 -0
  40. package/templates/admin/src/features/antd/AntdProvider.tsx +21 -0
  41. package/templates/admin/src/features/auth/components/UserAvatar.tsx +76 -0
  42. package/templates/admin/src/features/auth/use-auth-form-rules.ts +83 -0
  43. package/templates/admin/src/features/auth/use-auth.ts +96 -0
  44. package/templates/admin/src/features/auth/use-login.ts +72 -0
  45. package/templates/admin/src/features/effects/GlobalEffect.tsx +15 -0
  46. package/templates/admin/src/features/menus/dynamic-routes.ts +10 -0
  47. package/templates/admin/src/features/menus/extras.ts +3 -0
  48. package/templates/admin/src/features/menus/menu-category.ts +14 -0
  49. package/templates/admin/src/features/menus/menu-config.ts +5 -0
  50. package/templates/admin/src/features/router/RouterProvider.tsx +18 -0
  51. package/templates/admin/src/features/router/guard.ts +97 -0
  52. package/templates/admin/src/features/router/index.ts +52 -0
  53. package/templates/admin/src/features/router/routeTree.gen.ts +237 -0
  54. package/templates/admin/src/features/router/router-ref.ts +24 -0
  55. package/templates/admin/src/locales/antd.ts +8 -0
  56. package/templates/admin/src/locales/index.ts +22 -0
  57. package/templates/admin/src/locales/sync.ts +14 -0
  58. package/templates/admin/src/main.tsx +9 -0
  59. package/templates/admin/src/pages/(admin)/home/index.tsx +46 -0
  60. package/templates/admin/src/pages/(admin)/layout.tsx +44 -0
  61. package/templates/admin/src/pages/(auth)/login/index.tsx +102 -0
  62. package/templates/admin/src/pages/(auth)/login/layout.tsx +71 -0
  63. package/templates/admin/src/pages/(auth)/login-out.tsx +27 -0
  64. package/templates/admin/src/pages/(errors)/403.tsx +16 -0
  65. package/templates/admin/src/pages/(errors)/404.tsx +16 -0
  66. package/templates/admin/src/pages/(errors)/500.tsx +16 -0
  67. package/templates/admin/src/pages/__root.tsx +54 -0
  68. package/templates/admin/src/pages/error.tsx +19 -0
  69. package/templates/admin/src/pages/index.tsx +14 -0
  70. package/templates/admin/src/pages/loading.tsx +45 -0
  71. package/templates/admin/src/pages/not-found.tsx +9 -0
  72. package/templates/admin/src/plugins/app.tsx +47 -0
  73. package/templates/admin/src/plugins/assets.ts +4 -0
  74. package/templates/admin/src/plugins/index.ts +32 -0
  75. package/templates/admin/src/service/adapter.ts +63 -0
  76. package/templates/admin/src/service/api/auth/api.ts +31 -0
  77. package/templates/admin/src/service/api/auth/hooks.ts +28 -0
  78. package/templates/admin/src/service/api/auth/index.ts +10 -0
  79. package/templates/admin/src/service/api/auth/keys.ts +7 -0
  80. package/templates/admin/src/service/api/auth/urls.ts +7 -0
  81. package/templates/admin/src/service/api/index.ts +2 -0
  82. package/templates/admin/src/service/api/route/api.ts +7 -0
  83. package/templates/admin/src/service/api/route/hooks.ts +21 -0
  84. package/templates/admin/src/service/api/route/index.ts +10 -0
  85. package/templates/admin/src/service/api/route/keys.ts +3 -0
  86. package/templates/admin/src/service/api/route/urls.ts +5 -0
  87. package/templates/admin/src/service/queryClient.ts +13 -0
  88. package/templates/admin/src/service/request/index.ts +62 -0
  89. package/templates/admin/src/styles/scss/global.scss +1 -0
  90. package/templates/admin/src/styles/scss/scrollbar.scss +28 -0
  91. package/templates/admin/src/types/auto-imports.d.ts +186 -0
  92. package/templates/admin/src/types/global.d.ts +16 -0
  93. package/templates/admin/src/types/router.d.ts +14 -0
  94. package/templates/admin/src/types/storage.d.ts +17 -0
  95. package/templates/admin/src/types/vite-env.d.ts +117 -0
  96. package/templates/admin/src/utils/common.tsx +38 -0
  97. package/templates/admin/src/utils/icon.ts +9 -0
  98. package/templates/admin/src/utils/service.ts +75 -0
  99. package/templates/admin/src/utils/storage.ts +7 -0
  100. package/templates/admin/tsconfig.json +22 -0
  101. package/templates/admin/uno.config.ts +18 -0
  102. package/templates/admin/vite.config.ts +13 -0
  103. package/templates/admin-shell/i18n/atoms/lang.ts +20 -0
  104. package/templates/admin-shell/i18n/config/default.ts +11 -0
  105. package/templates/admin-shell/i18n/features/lang/LangEffect.tsx +25 -0
  106. package/templates/admin-shell/i18n/features/lang/LangSwitch.tsx +49 -0
  107. package/templates/admin-shell/i18n/hooks/use-lang.ts +47 -0
  108. package/templates/admin-shell/i18n/i18n.ts +116 -0
  109. package/templates/admin-shell/i18n/index.ts +23 -0
  110. package/templates/admin-shell/i18n/langs/en-us/common.json +49 -0
  111. package/templates/admin-shell/i18n/langs/en-us/datatable.json +8 -0
  112. package/templates/admin-shell/i18n/langs/en-us/dropdown.json +9 -0
  113. package/templates/admin-shell/i18n/langs/en-us/form.json +27 -0
  114. package/templates/admin-shell/i18n/langs/en-us/icon.json +13 -0
  115. package/templates/admin-shell/i18n/langs/en-us/notification.json +20 -0
  116. package/templates/admin-shell/i18n/langs/en-us/page.json +442 -0
  117. package/templates/admin-shell/i18n/langs/en-us/request.json +8 -0
  118. package/templates/admin-shell/i18n/langs/en-us/route.json +84 -0
  119. package/templates/admin-shell/i18n/langs/en-us/system.json +9 -0
  120. package/templates/admin-shell/i18n/langs/en-us/theme.json +173 -0
  121. package/templates/admin-shell/i18n/langs/index.ts +63 -0
  122. package/templates/admin-shell/i18n/langs/zh-cn/common.json +49 -0
  123. package/templates/admin-shell/i18n/langs/zh-cn/datatable.json +8 -0
  124. package/templates/admin-shell/i18n/langs/zh-cn/dropdown.json +9 -0
  125. package/templates/admin-shell/i18n/langs/zh-cn/form.json +27 -0
  126. package/templates/admin-shell/i18n/langs/zh-cn/icon.json +13 -0
  127. package/templates/admin-shell/i18n/langs/zh-cn/notification.json +20 -0
  128. package/templates/admin-shell/i18n/langs/zh-cn/page.json +442 -0
  129. package/templates/admin-shell/i18n/langs/zh-cn/request.json +8 -0
  130. package/templates/admin-shell/i18n/langs/zh-cn/route.json +84 -0
  131. package/templates/admin-shell/i18n/langs/zh-cn/system.json +9 -0
  132. package/templates/admin-shell/i18n/langs/zh-cn/theme.json +173 -0
  133. package/templates/admin-shell/i18n/types/i18n.ts +29 -0
  134. package/templates/admin-shell/i18n/types.ts +53 -0
  135. package/templates/admin-shell/i18n/utils/helpers.ts +18 -0
  136. package/templates/admin-shell/layouts/AdminLayout.tsx +161 -0
  137. package/templates/admin-shell/layouts/constant.ts +56 -0
  138. package/templates/admin-shell/layouts/context.tsx +101 -0
  139. package/templates/admin-shell/layouts/features/menus/MenuBadge.tsx +76 -0
  140. package/templates/admin-shell/layouts/features/menus/dynamic-routes.ts +146 -0
  141. package/templates/admin-shell/layouts/features/menus/menu-generator.tsx +444 -0
  142. package/templates/admin-shell/layouts/features/menus/menu-renderer.tsx +149 -0
  143. package/templates/admin-shell/layouts/features/menus/permissions.ts +28 -0
  144. package/templates/admin-shell/layouts/features/menus/use-menus.ts +98 -0
  145. package/templates/admin-shell/layouts/features/use-route.ts +30 -0
  146. package/templates/admin-shell/layouts/index.ts +44 -0
  147. package/templates/admin-shell/layouts/materials/index.ts +6 -0
  148. package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css +63 -0
  149. package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css.d.ts +18 -0
  150. package/templates/admin-shell/layouts/materials/libs/admin-layout/index.tsx +238 -0
  151. package/templates/admin-shell/layouts/materials/libs/admin-layout/shared.ts +67 -0
  152. package/templates/admin-shell/layouts/materials/libs/page-tab/ButtonTab.tsx +44 -0
  153. package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTab.tsx +54 -0
  154. package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTabBg.tsx +30 -0
  155. package/templates/admin-shell/layouts/materials/libs/page-tab/SliderTab.tsx +44 -0
  156. package/templates/admin-shell/layouts/materials/libs/page-tab/SvgClose.tsx +51 -0
  157. package/templates/admin-shell/layouts/materials/libs/page-tab/hook.ts +34 -0
  158. package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css +120 -0
  159. package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css.d.ts +18 -0
  160. package/templates/admin-shell/layouts/materials/libs/page-tab/index.tsx +76 -0
  161. package/templates/admin-shell/layouts/materials/libs/page-tab/shared.ts +32 -0
  162. package/templates/admin-shell/layouts/materials/types/index.ts +322 -0
  163. package/templates/admin-shell/layouts/modules/AdminContent.tsx +285 -0
  164. package/templates/admin-shell/layouts/modules/AdminFooter.tsx +13 -0
  165. package/templates/admin-shell/layouts/modules/AdminLogo.tsx +28 -0
  166. package/templates/admin-shell/layouts/modules/AdminSider.tsx +50 -0
  167. package/templates/admin-shell/layouts/modules/admin-header/AdminHeader.tsx +132 -0
  168. package/templates/admin-shell/layouts/modules/admin-header/components/Breadcrumb.tsx +62 -0
  169. package/templates/admin-shell/layouts/modules/admin-header/components/ThemeButton.tsx +24 -0
  170. package/templates/admin-shell/layouts/modules/admin-menu/AdminMenu.tsx +37 -0
  171. package/templates/admin-shell/layouts/modules/admin-menu/components/FirstLevelMenu.tsx +156 -0
  172. package/templates/admin-shell/layouts/modules/admin-menu/components/HorizontalMenu.tsx +88 -0
  173. package/templates/admin-shell/layouts/modules/admin-menu/components/MenuPortal.tsx +28 -0
  174. package/templates/admin-shell/layouts/modules/admin-menu/components/VerticalMenu.tsx +123 -0
  175. package/templates/admin-shell/layouts/modules/admin-menu/enum.ts +47 -0
  176. package/templates/admin-shell/layouts/modules/admin-menu/modules/Horizontal.tsx +22 -0
  177. package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridHeaderFirst.tsx +15 -0
  178. package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridSidebarFirst.tsx +18 -0
  179. package/templates/admin-shell/layouts/modules/admin-menu/modules/Vertical.tsx +14 -0
  180. package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalHybridHeaderFirst.tsx +18 -0
  181. package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalMix.tsx +132 -0
  182. package/templates/admin-shell/layouts/modules/admin-search/AdminSearch.tsx +36 -0
  183. package/templates/admin-shell/layouts/modules/admin-search/components/SearchFooter.tsx +38 -0
  184. package/templates/admin-shell/layouts/modules/admin-search/components/SearchModal.tsx +171 -0
  185. package/templates/admin-shell/layouts/modules/admin-search/components/SearchResult.tsx +43 -0
  186. package/templates/admin-shell/layouts/modules/admin-tab/AdminTab.tsx +125 -0
  187. package/templates/admin-shell/layouts/modules/admin-tab/components/TabContextMenu.tsx +107 -0
  188. package/templates/admin-shell/layouts/modules/admin-tab/hooks/useTabScroll.ts +86 -0
  189. package/templates/admin-shell/layouts/modules/shared/logo.ts +42 -0
  190. package/templates/admin-shell/layouts/modules/theme-drawer/ThemeDrawer.tsx +68 -0
  191. package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedCollapse.tsx +36 -0
  192. package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedItem.tsx +35 -0
  193. package/templates/admin-shell/layouts/modules/theme-drawer/components/LayoutModeCard.tsx +110 -0
  194. package/templates/admin-shell/layouts/modules/theme-drawer/components/SettingItem.tsx +31 -0
  195. package/templates/admin-shell/layouts/modules/theme-drawer/modules/ConfigOperation.tsx +53 -0
  196. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/CustomPicker.tsx +105 -0
  197. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeColor.tsx +58 -0
  198. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeSchema.tsx +42 -0
  199. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeToken.tsx +44 -0
  200. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/index.tsx +23 -0
  201. package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/GlobalSettings.tsx +57 -0
  202. package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/ThemeGeneral.tsx +20 -0
  203. package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/WatermarkSettings.tsx +103 -0
  204. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ContentSettings.tsx +100 -0
  205. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/FooterSettings.tsx +71 -0
  206. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/HeaderSettings.tsx +63 -0
  207. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/LayoutMode.tsx +73 -0
  208. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/SiderSettings.tsx +124 -0
  209. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/TabSettings.tsx +95 -0
  210. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ThemeLayout.tsx +32 -0
  211. package/templates/admin-shell/layouts/modules/theme-drawer/modules/preset/ThemePreset.tsx +132 -0
  212. package/templates/admin-shell/layouts/options.tsx +79 -0
  213. package/templates/admin-shell/layouts/setup.ts +102 -0
  214. package/templates/admin-shell/layouts/state/AdminEffect.tsx +56 -0
  215. package/templates/admin-shell/layouts/state/AdminTabEffect.tsx +28 -0
  216. package/templates/admin-shell/layouts/state/index.ts +3 -0
  217. package/templates/admin-shell/layouts/state/menus/MenuToggler.tsx +53 -0
  218. package/templates/admin-shell/layouts/state/menus/use-admin-menu-badges.ts +46 -0
  219. package/templates/admin-shell/layouts/state/menus/use-admin-menus.tsx +164 -0
  220. package/templates/admin-shell/layouts/state/tabs/index.ts +1 -0
  221. package/templates/admin-shell/layouts/state/tabs/shared.tsx +148 -0
  222. package/templates/admin-shell/layouts/state/tabs/use-admin-tab.ts +377 -0
  223. package/templates/admin-shell/layouts/state/use-admin-state.ts +118 -0
  224. package/templates/admin-shell/layouts/types/router.d.ts +10 -0
  225. package/templates/admin-shell/layouts/types/storage.ts +18 -0
  226. package/templates/admin-shell/notification/NotificationButton.tsx +91 -0
  227. package/templates/admin-shell/notification/NotificationContext.ts +8 -0
  228. package/templates/admin-shell/notification/NotificationPanel.tsx +194 -0
  229. package/templates/admin-shell/notification/NotificationProvider.tsx +59 -0
  230. package/templates/admin-shell/notification/index.ts +12 -0
  231. package/templates/admin-shell/notification/mock.ts +59 -0
  232. package/templates/admin-shell/notification/notification-store.ts +438 -0
  233. package/templates/admin-shell/notification/notification.css +60 -0
  234. package/templates/admin-shell/notification/types.ts +104 -0
  235. package/templates/admin-shell/notification/use-notification.ts +51 -0
  236. package/templates/admin-shell/notification/useNotificationContext.ts +14 -0
  237. package/templates/admin-shell/runtime/app-update.ts +156 -0
  238. package/templates/admin-shell/runtime/dayjs.ts +20 -0
  239. package/templates/admin-shell/runtime/iconify.ts +17 -0
  240. package/templates/admin-shell/runtime/index.ts +10 -0
  241. package/templates/admin-shell/runtime/nprogress.ts +25 -0
  242. package/templates/admin-shell/runtime/plugins.ts +62 -0
  243. package/templates/admin-shell/styles/global.css +54 -0
  244. package/templates/admin-shell/styles/nprogress.css +85 -0
  245. package/templates/admin-shell/styles/reset.css +378 -0
  246. package/templates/admin-shell/theme/antd/AntdProvider.tsx +106 -0
  247. package/templates/admin-shell/theme/antd/index.ts +23 -0
  248. package/templates/admin-shell/theme/antd/shared.ts +80 -0
  249. package/templates/admin-shell/theme/antd/ui.ts +250 -0
  250. package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/colors.ts +99 -0
  251. package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/index.ts +87 -0
  252. package/templates/admin-shell/theme/antd-algorithm/algorithm/default/colors.ts +91 -0
  253. package/templates/admin-shell/theme/antd-algorithm/algorithm/default/index.ts +77 -0
  254. package/templates/admin-shell/theme/antd-algorithm/index.ts +80 -0
  255. package/templates/admin-shell/theme/antd-algorithm/seed/index.ts +41 -0
  256. package/templates/admin-shell/theme/antd-algorithm/shared/colorAlgorithm.ts +10 -0
  257. package/templates/admin-shell/theme/antd-algorithm/shared/genColorMapToken.ts +165 -0
  258. package/templates/admin-shell/theme/antd-algorithm/shared/genCommonMapToken.ts +23 -0
  259. package/templates/admin-shell/theme/antd-algorithm/shared/genControlHeight.ts +14 -0
  260. package/templates/admin-shell/theme/antd-algorithm/shared/genFontMapToken.ts +274 -0
  261. package/templates/admin-shell/theme/antd-algorithm/shared/genRadiusMapToken.ts +139 -0
  262. package/templates/admin-shell/theme/antd-algorithm/shared/genSizeMapToken.ts +114 -0
  263. package/templates/admin-shell/theme/antd-algorithm/types/index.ts +20 -0
  264. package/templates/admin-shell/theme/components/ThemeEffect.tsx +55 -0
  265. package/templates/admin-shell/theme/components/ThemeSchemaSegmented.tsx +27 -0
  266. package/templates/admin-shell/theme/components/ThemeSchemaSwitch.tsx +77 -0
  267. package/templates/admin-shell/theme/components/shared.ts +5 -0
  268. package/templates/admin-shell/theme/config/default.ts +108 -0
  269. package/templates/admin-shell/theme/config/index.ts +1 -0
  270. package/templates/admin-shell/theme/hooks/index.ts +2 -0
  271. package/templates/admin-shell/theme/hooks/use-theme.ts +244 -0
  272. package/templates/admin-shell/theme/index.ts +78 -0
  273. package/templates/admin-shell/theme/presets/azir.json +39 -0
  274. package/templates/admin-shell/theme/presets/compact.json +38 -0
  275. package/templates/admin-shell/theme/presets/dark.json +93 -0
  276. package/templates/admin-shell/theme/presets/default.json +95 -0
  277. package/templates/admin-shell/theme/presets/index.ts +29 -0
  278. package/templates/admin-shell/theme/presets/shadcn.json +99 -0
  279. package/templates/admin-shell/theme/setup.ts +115 -0
  280. package/templates/admin-shell/theme/types/index.ts +27 -0
  281. package/templates/admin-shell/theme/types/theme.d.ts +316 -0
  282. package/templates/admin-shell/theme/utils/dark-mode.ts +46 -0
  283. package/templates/admin-shell/theme/utils/filters.ts +20 -0
  284. package/templates/admin-shell/theme/utils/index.ts +3 -0
  285. package/templates/admin-shell/theme/utils/settings.ts +43 -0
  286. package/templates/admin-shell/types/api/auth.d.ts +148 -0
  287. package/templates/admin-shell/types/api/common.d.ts +54 -0
  288. package/templates/admin-shell/types/api/route.d.ts +104 -0
  289. package/templates/admin-shell/types/api/service.d.ts +51 -0
  290. package/templates/admin-shell/types/api/system-manage.d.ts +160 -0
  291. package/templates/admin-shell/types/app/common.d.ts +31 -0
  292. package/templates/admin-shell/types/app/global.d.ts +71 -0
  293. package/templates/admin-shell/types/app/menu.d.ts +57 -0
  294. package/templates/admin-shell/types/app/router.d.ts +201 -0
  295. package/templates/admin-shell/types/app/storage.d.ts +10 -0
  296. package/templates/admin-shell/types/app/union-key.d.ts +156 -0
  297. package/templates/admin-shell/types/locales/i18n.d.ts +135 -0
  298. package/templates/admin-shell/ui/antd/components/AppTree.tsx +62 -0
  299. package/templates/admin-shell/ui/antd/components/BeyondHiding.tsx +42 -0
  300. package/templates/admin-shell/ui/antd/components/ButtonIcon.tsx +123 -0
  301. package/templates/admin-shell/ui/antd/components/ButtonLink.tsx +30 -0
  302. package/templates/admin-shell/ui/antd/components/ErrorBoundary.tsx +45 -0
  303. package/templates/admin-shell/ui/antd/components/ExceptionBase.tsx +69 -0
  304. package/templates/admin-shell/ui/antd/components/FullScreen.tsx +33 -0
  305. package/templates/admin-shell/ui/antd/components/PinToggler.tsx +35 -0
  306. package/templates/admin-shell/ui/antd/components/ReloadButton.tsx +20 -0
  307. package/templates/admin-shell/ui/antd/components/index.ts +12 -0
  308. package/templates/admin-shell/ui/antd/components/styles/button-icon-animations.css +246 -0
  309. package/templates/admin-shell/ui/antd/index.ts +1 -0
  310. package/templates/admin-shell/ui/antd/styles.d.ts +1 -0
  311. package/templates/admin-shell/ui/compose/animate-feature.ts +5 -0
  312. package/templates/admin-shell/ui/compose/components/BetterScroll.tsx +51 -0
  313. package/templates/admin-shell/ui/compose/components/DarkModeContainer.tsx +22 -0
  314. package/templates/admin-shell/ui/compose/components/FlipText.tsx +41 -0
  315. package/templates/admin-shell/ui/compose/components/I18nLabel.tsx +18 -0
  316. package/templates/admin-shell/ui/compose/components/LazyAnimate.tsx +10 -0
  317. package/templates/admin-shell/ui/compose/components/LookForward.tsx +24 -0
  318. package/templates/admin-shell/ui/compose/components/NumberTicker.tsx +105 -0
  319. package/templates/admin-shell/ui/compose/components/Portal.tsx +74 -0
  320. package/templates/admin-shell/ui/compose/components/SvgIcon.tsx +39 -0
  321. package/templates/admin-shell/ui/compose/components/TypingAnimation.tsx +83 -0
  322. package/templates/admin-shell/ui/compose/components/WaveBg.tsx +56 -0
  323. package/templates/admin-shell/ui/compose/components/index.ts +11 -0
  324. package/templates/admin-shell/ui/compose/index.ts +2 -0
  325. package/templates/admin-shell/ui/compose/table/DragContent.tsx +239 -0
  326. package/templates/admin-shell/ui/compose/table/TableHeaderOperation.tsx +210 -0
  327. package/templates/admin-shell/ui/compose/table/hooks.ts +196 -0
  328. package/templates/admin-shell/ui/compose/table/index.ts +16 -0
  329. package/templates/admin-shell/ui/compose/table/types.ts +244 -0
  330. package/templates/admin-shell/ui/compose/table/use-table-operate.ts +136 -0
  331. package/templates/admin-shell/ui/compose/table/use-table-scroll.ts +49 -0
  332. package/templates/admin-shell/ui/compose/table/use-table.ts +303 -0
  333. package/templates/admin.meta.json +756 -0
@@ -0,0 +1,377 @@
1
+ import { atomWithPartial, createAtomWithStorage, getAtomValue, setAtomValue } from '@skyroc/core-state';
2
+ import { useSettingsTheme } from '@shell/theme';
3
+ import { useNavigate } from '@tanstack/react-router';
4
+ import { useAtom } from 'jotai';
5
+
6
+ import { ADMIN_LAYOUTS_STORAGE } from '../../setup';
7
+ import { useAdminMenus } from '../menus/use-admin-menus';
8
+
9
+ import {
10
+ extractTabsByAllRoutes,
11
+ filterTabsByIds,
12
+ getAllTabs,
13
+ getFixedTabIds,
14
+ getTabByMenuInfo,
15
+ getTabIdByRoute,
16
+ reorderFixedTabs
17
+ } from './shared';
18
+
19
+ interface TabState {
20
+ /** Active tab id */
21
+ activeTabId: string;
22
+ /** Home tab */
23
+ homeTab: App.Global.Tab | null;
24
+ /** All tabs (excluding home) */
25
+ tabs: App.Global.Tab[];
26
+ }
27
+
28
+ const initialState: TabState = {
29
+ homeTab: null,
30
+ tabs: [],
31
+ activeTabId: ''
32
+ };
33
+
34
+ const tabStateAtom = atomWithPartial(initialState);
35
+
36
+ /** Tabs persisted across reloads, restored on init when the tab cache setting is on. */
37
+ const cachedTabsAtom = createAtomWithStorage<App.Global.Tab[]>('globalTabs', [], {
38
+ storageName: ADMIN_LAYOUTS_STORAGE
39
+ });
40
+
41
+ /** Cache tabs to local storage */
42
+ export function cacheTabs() {
43
+ setAtomValue(cachedTabsAtom, getAtomValue(tabStateAtom).tabs);
44
+ }
45
+
46
+ export const useAdminTab = () => {
47
+ const [tabState, setTabState] = useAtom(tabStateAtom);
48
+
49
+ const navigate = useNavigate();
50
+
51
+ const { getMenuInfoByPath, home, quickReferenceMenus, route } = useAdminMenus();
52
+
53
+ const {
54
+ tab: { cache }
55
+ } = useSettingsTheme();
56
+
57
+ /** Get all tabs (including home tab and reordered by fixed index) */
58
+ const allTabs = getAllTabs(tabState.tabs, tabState.homeTab);
59
+
60
+ /**
61
+ * Set active tab id
62
+ *
63
+ * @param id Tab id
64
+ */
65
+ function setActiveTabId(id: string) {
66
+ setTabState({ activeTabId: id });
67
+ }
68
+
69
+ /**
70
+ * Init home tab
71
+ *
72
+ * @param homeRoute The home route path
73
+ */
74
+ function initHomeTab(homeRoute: Router.RoutePath) {
75
+ const routeInfo = getMenuInfoByPath(homeRoute);
76
+
77
+ if (!routeInfo) return null;
78
+
79
+ const info = {
80
+ fixedIndex: 0,
81
+ ...routeInfo?.tab
82
+ };
83
+
84
+ routeInfo.tab = info;
85
+
86
+ if (routeInfo) {
87
+ const homeTab = getTabByMenuInfo(routeInfo, homeRoute, homeRoute);
88
+
89
+ return homeTab;
90
+ }
91
+
92
+ return null;
93
+ }
94
+
95
+ /**
96
+ * Init tab store
97
+ *
98
+ * @param cache Whether to cache tabs
99
+ * @param allRoutes All available route IDs for validation
100
+ */
101
+ function initTabStore() {
102
+ const storageTabs = getAtomValue(cachedTabsAtom);
103
+
104
+ const homeTab = initHomeTab(home);
105
+
106
+ let tabs: App.Global.Tab[] = [];
107
+
108
+ if (cache && storageTabs.length) {
109
+ const allRoutes = Array.from(quickReferenceMenus?.keys() || []);
110
+
111
+ const extractedTabs = extractTabsByAllRoutes(allRoutes, storageTabs);
112
+ tabs = extractedTabs;
113
+ }
114
+
115
+ setTabState({ tabs, homeTab });
116
+
117
+ addTab(route.fullPath, route.originPath);
118
+ }
119
+
120
+ /**
121
+ * Add tab
122
+ *
123
+ * @param route Tab route
124
+ * @param active Whether to activate the added tab
125
+ */
126
+ function addTab(fullPath: string, routePath: Router.RoutePath, active = true) {
127
+ const routeInfo = getMenuInfoByPath(routePath);
128
+
129
+ if (!routeInfo) return;
130
+
131
+ const tab = getTabByMenuInfo(routeInfo, routePath, fullPath);
132
+
133
+ const homeTabId = tabState.homeTab?.id;
134
+
135
+ const isHomeTab = homeTabId && homeTabId === tab.id;
136
+
137
+ const oldTabs = getAtomValue(tabStateAtom).tabs;
138
+ const existingTab = oldTabs.find(item => item.id === tab.id);
139
+
140
+ if (!isHomeTab && !existingTab) {
141
+ setTabState({ tabs: [...oldTabs, tab] });
142
+ }
143
+
144
+ if (!isHomeTab && existingTab) {
145
+ setTabState({ tabs: oldTabs.map(item => (item.id === tab.id ? { ...item, ...tab } : item)) });
146
+ }
147
+
148
+ if (active) {
149
+ setActiveTabId(tab.id);
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Remove tab
155
+ *
156
+ * @param tabId Tab id
157
+ */
158
+ async function removeTab(tabId: string) {
159
+ const removeTabIndex = tabState.tabs.findIndex(tab => tab.id === tabId);
160
+ if (removeTabIndex === -1) return;
161
+
162
+ const isRemoveActiveTab = tabState.activeTabId === tabId;
163
+
164
+ // if remove the last tab, then switch to the second last tab
165
+ const nextTab = tabState.tabs[removeTabIndex + 1] || tabState.tabs[removeTabIndex - 1] || tabState.homeTab;
166
+
167
+ // remove tab
168
+ const newTabs = [...tabState.tabs];
169
+ newTabs.splice(removeTabIndex, 1);
170
+ setTabState({ tabs: newTabs });
171
+
172
+ // if current tab is removed, then switch to next tab
173
+ if (isRemoveActiveTab && nextTab) {
174
+ await switchRouteByTab(nextTab);
175
+ }
176
+ }
177
+
178
+ /** Remove active tab */
179
+ async function removeActiveTab() {
180
+ await removeTab(tabState.activeTabId);
181
+ }
182
+
183
+ /**
184
+ * Clear tabs
185
+ *
186
+ * @param excludes Exclude tab ids
187
+ */
188
+ async function clearTabs(excludes: string[] = []) {
189
+ const remainTabIds = [...getFixedTabIds(tabState.tabs), ...excludes];
190
+
191
+ const tabsToRemove = tabState.tabs.filter(tab => !remainTabIds.includes(tab.id));
192
+ const removedTabsIds = tabsToRemove.map(tab => tab.id);
193
+
194
+ if (removedTabsIds.length === 0) {
195
+ return;
196
+ }
197
+
198
+ const isRemoveActiveTab = removedTabsIds.includes(tabState.activeTabId);
199
+ const updatedTabs = filterTabsByIds(removedTabsIds, tabState.tabs);
200
+
201
+ if (!isRemoveActiveTab) {
202
+ setTabState({ tabs: updatedTabs });
203
+ } else {
204
+ const activeTabCandidate = updatedTabs[updatedTabs.length - 1] || tabState.homeTab;
205
+
206
+ if (activeTabCandidate) {
207
+ await switchRouteByTab(activeTabCandidate);
208
+ }
209
+ setTabState({ tabs: updatedTabs });
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Switch route by tab
215
+ *
216
+ * @param tab
217
+ */
218
+ async function switchRouteByTab(tab: App.Global.Tab) {
219
+ navigate({ to: tab.fullPath });
220
+ }
221
+
222
+ /**
223
+ * Clear left tabs
224
+ *
225
+ * @param tabId
226
+ */
227
+ async function clearLeftTabs(tabId: string) {
228
+ const tabIds = tabState.tabs.map(tab => tab.id);
229
+ const index = tabIds.indexOf(tabId);
230
+ if (index === -1) return;
231
+
232
+ const excludes = tabIds.slice(index);
233
+ await clearTabs(excludes);
234
+ }
235
+
236
+ /**
237
+ * Clear right tabs
238
+ *
239
+ * @param tabId
240
+ */
241
+ async function clearRightTabs(tabId: string) {
242
+ const isHomeTab = tabId === tabState.homeTab?.id;
243
+ if (isHomeTab) {
244
+ clearTabs();
245
+ return;
246
+ }
247
+
248
+ const tabIds = tabState.tabs.map(tab => tab.id);
249
+ const index = tabIds.indexOf(tabId);
250
+ if (index === -1) return;
251
+
252
+ const excludes = tabIds.slice(0, index + 1);
253
+ await clearTabs(excludes);
254
+ }
255
+
256
+ /**
257
+ * Fix tab
258
+ *
259
+ * @param tabId
260
+ */
261
+ function fixTab(tabId: string) {
262
+ const tabIndex = tabState.tabs.findIndex(t => t.id === tabId);
263
+ if (tabIndex === -1) return;
264
+
265
+ const newTabs = [...tabState.tabs];
266
+ const tab = newTabs[tabIndex];
267
+ const fixedCount = getFixedTabIds(newTabs).length;
268
+ tab.fixedIndex = fixedCount;
269
+
270
+ if (tabIndex !== fixedCount) {
271
+ newTabs.splice(tabIndex, 1);
272
+ newTabs.splice(fixedCount, 0, tab);
273
+ }
274
+
275
+ reorderFixedTabs(newTabs);
276
+ setTabState({ tabs: newTabs });
277
+ }
278
+
279
+ /**
280
+ * Unfix tab
281
+ *
282
+ * @param tabId
283
+ */
284
+ function unfixTab(tabId: string) {
285
+ const tabIndex = tabState.tabs.findIndex(t => t.id === tabId);
286
+ if (tabIndex === -1) return;
287
+
288
+ const newTabs = [...tabState.tabs];
289
+ const tab = newTabs[tabIndex];
290
+ tab.fixedIndex = undefined;
291
+
292
+ const fixedCount = getFixedTabIds(newTabs).length;
293
+ if (tabIndex !== fixedCount) {
294
+ newTabs.splice(tabIndex, 1);
295
+ newTabs.splice(fixedCount, 0, tab);
296
+ }
297
+
298
+ reorderFixedTabs(newTabs);
299
+ setTabState({ tabs: newTabs });
300
+ }
301
+
302
+ /**
303
+ * Set new label of tab
304
+ *
305
+ * @default activeTabId
306
+ * @param label New tab label
307
+ * @param tabId Tab id
308
+ */
309
+ function setTabLabel(label: string, tabId?: string) {
310
+ const id = tabId || tabState.activeTabId;
311
+
312
+ const newTabs = [...tabState.tabs];
313
+ const tab = newTabs.find(item => item.id === id);
314
+ if (!tab) return;
315
+
316
+ tab.i18nKey = label as I18n.I18nKey;
317
+
318
+ setTabState({ tabs: newTabs });
319
+ }
320
+
321
+ /**
322
+ * Reset tab label
323
+ *
324
+ * @default activeTabId
325
+ * @param tabId Tab id
326
+ */
327
+ function resetTabLabel(tabId?: string) {
328
+ const id = tabId || tabState.activeTabId;
329
+
330
+ const newTabs = [...tabState.tabs];
331
+ const tab = newTabs.find(item => item.id === id);
332
+ if (!tab) return;
333
+
334
+ tab.i18nKey = tab.oldLabel as I18n.I18nKey;
335
+ setTabState({ tabs: newTabs });
336
+ }
337
+
338
+ /**
339
+ * Is tab retain (home tab or fixed tab)
340
+ *
341
+ * @param tabId
342
+ */
343
+ function isTabRetain(tabId: string) {
344
+ if (tabId === tabState.homeTab?.id) return true;
345
+
346
+ const fixedTabIds = getFixedTabIds(allTabs);
347
+
348
+ return fixedTabIds.includes(tabId);
349
+ }
350
+
351
+ return {
352
+ // State
353
+ tabs: allTabs,
354
+ activeTabId: tabState.activeTabId,
355
+ homeTab: tabState.homeTab,
356
+ route,
357
+
358
+ // Actions
359
+ initHomeTab,
360
+ initTabStore,
361
+ addTab,
362
+ removeTab,
363
+ removeActiveTab,
364
+ clearTabs,
365
+ clearLeftTabs,
366
+ clearRightTabs,
367
+ fixTab,
368
+ unfixTab,
369
+ switchRouteByTab,
370
+ setTabLabel,
371
+ resetTabLabel,
372
+ isTabRetain,
373
+ getTabIdByRoute,
374
+ cacheTabs,
375
+ setActiveTabId
376
+ };
377
+ };
@@ -0,0 +1,118 @@
1
+ import { atomWithPartial } from '@skyroc/core-state';
2
+ import { useSettingsTheme } from '@shell/theme';
3
+ import { useResponsive } from 'ahooks';
4
+ import { useAtom } from 'jotai';
5
+ import { useEffect } from 'react';
6
+
7
+ import { LAYOUT_MODE_VERTICAL_HYBRID_HEADER_FIRST, LAYOUT_MODE_VERTICAL_MIX } from '../constant';
8
+ import { getAdminLayoutsOptions } from '../setup';
9
+
10
+ const initialState = {
11
+ siderCollapse: false,
12
+ themeDrawerVisible: false,
13
+ fullContent: false,
14
+ contentXScrollable: false,
15
+ reloadFlag: true,
16
+ mixSiderFixed: false
17
+ };
18
+
19
+ const adminStateAtom = atomWithPartial(initialState);
20
+
21
+ export function getVerticalMenuWidth(
22
+ layoutMode: Theme.ThemeLayoutMode,
23
+ sider: Theme.ThemeSetting['sider'],
24
+ siderCollapse: boolean
25
+ ) {
26
+ if (layoutMode === LAYOUT_MODE_VERTICAL_MIX || layoutMode === LAYOUT_MODE_VERTICAL_HYBRID_HEADER_FIRST) {
27
+ return sider.mixChildMenuWidth;
28
+ }
29
+
30
+ return siderCollapse ? sider.collapsedWidth : sider.width;
31
+ }
32
+
33
+ export const useAdminState = () => {
34
+ const [adminState, setAdminState] = useAtom(adminStateAtom);
35
+
36
+ const { layout, page, sider } = useSettingsTheme();
37
+ const { storage } = getAdminLayoutsOptions();
38
+
39
+ const responsive = useResponsive();
40
+
41
+ const isMobile = !responsive.sm;
42
+
43
+ const verticalMenuWidth = getVerticalMenuWidth(layout.mode, sider, adminState.siderCollapse);
44
+
45
+ useEffect(() => {
46
+ setAdminState({ mixSiderFixed: storage.get('mixSiderFixed') === 'Y' });
47
+ }, [setAdminState, storage]);
48
+
49
+ function toggleSiderCollapse() {
50
+ setAdminState({ siderCollapse: !adminState.siderCollapse });
51
+ }
52
+
53
+ function setSiderCollapse(siderCollapse: boolean) {
54
+ setAdminState({ siderCollapse });
55
+ }
56
+
57
+ function openThemeDrawer() {
58
+ setAdminState({ themeDrawerVisible: true });
59
+ }
60
+
61
+ function closeThemeDrawer() {
62
+ setAdminState({ themeDrawerVisible: false });
63
+ }
64
+
65
+ function toggleFullContent() {
66
+ setAdminState({ fullContent: !adminState.fullContent });
67
+ }
68
+
69
+ function setContentXScrollable(contentXScrollable: boolean) {
70
+ setAdminState({ contentXScrollable });
71
+ }
72
+
73
+ function toggleMixSiderFixed() {
74
+ setAdminState({ mixSiderFixed: !adminState.mixSiderFixed });
75
+ }
76
+
77
+ function setMixSiderFixed(mixSiderFixed: boolean) {
78
+ setAdminState({ mixSiderFixed });
79
+ }
80
+
81
+ function setReloadFlag(reloadFlag: boolean) {
82
+ setAdminState({ reloadFlag });
83
+ }
84
+
85
+ /**
86
+ * Reload page
87
+ *
88
+ * @param duration Duration time
89
+ */
90
+ async function reloadPage(duration = 300) {
91
+ setReloadFlag(false);
92
+
93
+ const d = page.animate ? duration : 40;
94
+
95
+ await new Promise(resolve => {
96
+ setTimeout(resolve, d);
97
+ });
98
+
99
+ setReloadFlag(true);
100
+ }
101
+
102
+ return {
103
+ adminState,
104
+ ...adminState,
105
+ isMobile,
106
+ verticalMenuWidth,
107
+ setAdminState,
108
+ reloadPage,
109
+ toggleSiderCollapse,
110
+ setSiderCollapse,
111
+ setContentXScrollable,
112
+ toggleFullContent,
113
+ openThemeDrawer,
114
+ closeThemeDrawer,
115
+ toggleMixSiderFixed,
116
+ setMixSiderFixed
117
+ };
118
+ };
@@ -0,0 +1,10 @@
1
+ // oxlint-disable import/no-unassigned-import
2
+ // oxlint-disable unicorn/require-module-specifiers
3
+ // oxlint-disable import/no-empty-named-blocks
4
+ import type {} from '@tanstack/react-router';
5
+
6
+ declare module '@tanstack/react-router' {
7
+ interface StaticDataRouteOption extends Router.Meta {}
8
+ }
9
+
10
+ export {};
@@ -0,0 +1,18 @@
1
+ // oxlint-disable unicorn/require-module-specifiers
2
+ declare global {
3
+ namespace StorageType {
4
+ interface Local {
5
+ /** Layout settings cached before switching to mobile mode. */
6
+ backupThemeSettingBeforeIsMobile: {
7
+ layout: UnionKey.ThemeLayoutMode;
8
+ siderCollapse: boolean;
9
+ };
10
+ /** Persisted admin layout tabs. */
11
+ globalTabs: App.Global.Tab[];
12
+ /** Whether the mixed menu sider is fixed. */
13
+ mixSiderFixed: Common.YesOrNo;
14
+ }
15
+ }
16
+ }
17
+
18
+ export {};
@@ -0,0 +1,91 @@
1
+ // oxlint-disable import/no-unassigned-import
2
+ import { ButtonIcon } from '@shell/ui/antd';
3
+ import { Badge, Dropdown } from 'antd';
4
+ import { clsx } from 'clsx';
5
+ import { memo, useState } from 'react';
6
+ import type { CSSProperties } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ import NotificationPanel from './NotificationPanel';
10
+ import './notification.css';
11
+ import { useNotificationContext } from './useNotificationContext';
12
+
13
+ export interface NotificationButtonProps {
14
+ /** Extra class name applied to the icon button. */
15
+ className?: string;
16
+ /** Jump handler of the notification center entry. The panel footer is hidden when the host does not pass it. */
17
+ onViewAll?: () => void;
18
+ /** Inline style forwarded to the icon button. */
19
+ style?: CSSProperties;
20
+ }
21
+
22
+ const NotificationButtonBase = (props: NotificationButtonProps) => {
23
+ const { className, onViewAll, style } = props;
24
+
25
+ const { t } = useTranslation();
26
+ const { markAllAsRead, markAsRead, notifications, unreadCount } = useNotificationContext();
27
+ const [open, setOpen] = useState(false);
28
+
29
+ const hasUnread = unreadCount > 0;
30
+ const displayCount = unreadCount > 99 ? '99+' : unreadCount;
31
+ const hoverAnimation = hasUnread ? 'swing' : 'scale';
32
+
33
+ function handleOpenChange(visible: boolean) {
34
+ setOpen(visible);
35
+ }
36
+
37
+ function handleNotificationClick(id: string) {
38
+ markAsRead(id);
39
+ }
40
+
41
+ function handleMarkAllRead() {
42
+ markAllAsRead();
43
+ }
44
+
45
+ function handleViewAll() {
46
+ setOpen(false);
47
+ onViewAll?.();
48
+ }
49
+
50
+ return (
51
+ <Dropdown
52
+ open={open}
53
+ placement="bottomRight"
54
+ popupRender={() => (
55
+ <NotificationPanel
56
+ notifications={notifications}
57
+ unreadCount={unreadCount}
58
+ onItemClick={handleNotificationClick}
59
+ onMarkAllRead={handleMarkAllRead}
60
+ onViewAll={onViewAll && handleViewAll}
61
+ />
62
+ )}
63
+ trigger={['click']}
64
+ onOpenChange={handleOpenChange}
65
+ >
66
+ <Badge
67
+ count={displayCount}
68
+ offset={[-4, 4]}
69
+ overflowCount={99}
70
+ size="small"
71
+ styles={{
72
+ indicator: {
73
+ boxShadow: hasUnread ? '0 0 0 1px var(--ant-color-bg-container)' : undefined
74
+ }
75
+ }}
76
+ >
77
+ <ButtonIcon
78
+ className={clsx(hasUnread ? 'admin-notification-button-unread' : '', className)}
79
+ hoverAnimation={hoverAnimation}
80
+ icon="carbon:notification"
81
+ style={style}
82
+ tooltipContent={t('notification.title')}
83
+ />
84
+ </Badge>
85
+ </Dropdown>
86
+ );
87
+ };
88
+
89
+ const NotificationButton = memo(NotificationButtonBase);
90
+
91
+ export default NotificationButton;
@@ -0,0 +1,8 @@
1
+ import { createContext } from 'react';
2
+
3
+ import type { useNotification } from './use-notification';
4
+
5
+ /** Value exposed by the notification provider. */
6
+ export type NotificationContextValue = ReturnType<typeof useNotification>;
7
+
8
+ export const NotificationContext = createContext<NotificationContextValue | null>(null);