@arcblock/ux 2.13.13 → 2.13.15

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 (72) hide show
  1. package/lib/Address/responsive-did-address.js +3 -1
  2. package/lib/Config/theme-mode-toggle.js +1 -1
  3. package/lib/DIDConnect/app-icon.d.ts +8 -0
  4. package/lib/DIDConnect/app-icon.js +31 -0
  5. package/lib/DIDConnect/app-info-item.d.ts +7 -0
  6. package/lib/DIDConnect/app-info-item.js +73 -0
  7. package/lib/DIDConnect/did-connect-footer.d.ts +4 -0
  8. package/lib/DIDConnect/did-connect-footer.js +54 -0
  9. package/lib/DIDConnect/did-connect-logo.d.ts +1 -0
  10. package/lib/DIDConnect/did-connect-logo.js +11 -0
  11. package/lib/DIDConnect/index.d.ts +7 -0
  12. package/lib/DIDConnect/index.js +7 -0
  13. package/lib/DIDConnect/powered-by.d.ts +3 -0
  14. package/lib/DIDConnect/powered-by.js +46 -0
  15. package/lib/DIDConnect/with-container.d.ts +11 -0
  16. package/lib/DIDConnect/with-container.js +273 -0
  17. package/lib/DIDConnect/with-ux-theme.d.ts +1 -0
  18. package/lib/DIDConnect/with-ux-theme.js +23 -0
  19. package/lib/Datatable/CustomToolbar.js +0 -3
  20. package/lib/Datatable/index.d.ts +3 -0
  21. package/lib/Datatable/index.js +36 -20
  22. package/lib/Dialog/confirm.d.ts +6 -1
  23. package/lib/Dialog/confirm.js +7 -3
  24. package/lib/Dialog/use-confirm.js +6 -0
  25. package/lib/LoadingMask/index.js +1 -1
  26. package/lib/Locale/util.d.ts +3 -3
  27. package/lib/Locale/util.js +6 -1
  28. package/lib/LoginButton/index.d.ts +12 -0
  29. package/lib/LoginButton/index.js +74 -0
  30. package/lib/NavMenu/style.js +0 -1
  31. package/lib/SessionUser/components/un-login.js +42 -31
  32. package/lib/SharedBridge/index.d.ts +16 -0
  33. package/lib/SharedBridge/index.js +109 -0
  34. package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +7 -0
  35. package/lib/SharedBridge/need-storage-access-api-dialog.js +212 -0
  36. package/lib/Theme/index.d.ts +2 -2
  37. package/lib/Theme/index.js +1 -1
  38. package/lib/Util/iframe.d.ts +5 -0
  39. package/lib/Util/iframe.js +24 -0
  40. package/lib/Util/index.d.ts +10 -1
  41. package/lib/Util/index.js +67 -4
  42. package/lib/hooks/use-blocklet-logo.d.ts +8 -0
  43. package/lib/hooks/use-blocklet-logo.js +31 -0
  44. package/lib/hooks/use-mobile.d.ts +4 -0
  45. package/lib/hooks/use-mobile.js +7 -0
  46. package/package.json +7 -6
  47. package/src/Address/responsive-did-address.tsx +11 -1
  48. package/src/Config/theme-mode-toggle.tsx +1 -1
  49. package/src/DIDConnect/app-icon.tsx +36 -0
  50. package/src/DIDConnect/app-info-item.tsx +82 -0
  51. package/src/DIDConnect/did-connect-footer.tsx +51 -0
  52. package/src/DIDConnect/did-connect-logo.tsx +8 -0
  53. package/src/DIDConnect/index.ts +7 -0
  54. package/src/DIDConnect/powered-by.tsx +48 -0
  55. package/src/DIDConnect/with-container.tsx +307 -0
  56. package/src/DIDConnect/with-ux-theme.tsx +22 -0
  57. package/src/Datatable/CustomToolbar.jsx +0 -1
  58. package/src/Datatable/index.jsx +32 -20
  59. package/src/Dialog/confirm.jsx +31 -23
  60. package/src/Dialog/use-confirm.jsx +6 -0
  61. package/src/LoadingMask/index.tsx +1 -1
  62. package/src/Locale/util.ts +7 -2
  63. package/src/LoginButton/index.tsx +73 -0
  64. package/src/NavMenu/style.ts +0 -1
  65. package/src/SessionUser/components/un-login.tsx +34 -27
  66. package/src/SharedBridge/index.tsx +123 -0
  67. package/src/SharedBridge/need-storage-access-api-dialog.tsx +171 -0
  68. package/src/Theme/index.ts +2 -2
  69. package/src/Util/iframe.ts +19 -0
  70. package/src/Util/index.ts +77 -4
  71. package/src/hooks/use-blocklet-logo.tsx +32 -0
  72. package/src/hooks/use-mobile.tsx +6 -0
@@ -0,0 +1,32 @@
1
+ import { type Breakpoint } from '@mui/material';
2
+ import { type ThemeOptions } from '@blocklet/theme';
3
+ import { useCreation } from 'ahooks';
4
+ import { useTheme } from '../Theme';
5
+ import useMobile from './use-mobile';
6
+
7
+ export default function useBlockletLogo({
8
+ key = 'sm',
9
+ meta = {},
10
+ theme: themeOverrides = {},
11
+ square,
12
+ }: { key?: number | Breakpoint; meta?: any; theme?: ThemeOptions; square?: boolean } = {}) {
13
+ const isMobileDevice = useMobile({ key });
14
+ const theme = useTheme();
15
+
16
+ const mode = useCreation(() => {
17
+ return themeOverrides?.palette?.mode || theme.palette.mode;
18
+ }, [theme, themeOverrides]);
19
+
20
+ const finalAppLogo = useCreation(() => {
21
+ const { appLogo, appLogoDark, appLogoRect, appLogoRectDark } = Object.assign({}, window.blocklet ?? {}, meta);
22
+ const isDark = mode === 'dark';
23
+
24
+ const squareLogo = (isDark ? appLogoDark : appLogo) || appLogo;
25
+ // 深色模式尽可能优先使用深色图标
26
+ const rectLogo = (isDark ? appLogoRectDark || appLogoDark : appLogoRect) || appLogoRect;
27
+
28
+ return isMobileDevice || square ? squareLogo : rectLogo || squareLogo || '';
29
+ }, [mode, meta, isMobileDevice, square]);
30
+
31
+ return finalAppLogo;
32
+ }
@@ -0,0 +1,6 @@
1
+ import { Breakpoint, useTheme, useMediaQuery } from '@mui/material';
2
+
3
+ export default function useMobile({ key = 'sm' }: { key?: number | Breakpoint } = {}) {
4
+ const theme = useTheme();
5
+ return useMediaQuery(theme.breakpoints.down(key));
6
+ }