@arcblock/ux 2.10.66 → 2.10.68

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. package/lib/Address/did-address.d.ts +6 -5
  2. package/lib/Address/index.d.ts +1 -1
  3. package/lib/Avatar/index.d.ts +10 -8
  4. package/lib/Avatar/index.js +6 -4
  5. package/lib/Blocklet/blocklet.d.ts +4 -4
  6. package/lib/Blocklet/blocklet.js +2 -2
  7. package/lib/BlockletContext/index.d.ts +3 -3
  8. package/lib/BlockletNFT/index.d.ts +6 -6
  9. package/lib/BlockletNFT/index.js +3 -3
  10. package/lib/BlockletV2/blocklet.d.ts +2 -2
  11. package/lib/Button/wrap.d.ts +4 -4
  12. package/lib/Button/wrap.js +2 -2
  13. package/lib/CardSelector/index.js +0 -1
  14. package/lib/Center/index.d.ts +1 -1
  15. package/lib/ClickToCopy/copy-button.d.ts +5 -4
  16. package/lib/ClickToCopy/copy-button.js +0 -1
  17. package/lib/ClickToCopy/hook.d.ts +3 -8
  18. package/lib/ClickToCopy/index.d.ts +6 -4
  19. package/lib/CodeBlock/index.d.ts +3 -1
  20. package/lib/CookieConsent/index.d.ts +8 -29
  21. package/lib/CookieConsent/index.js +3 -17
  22. package/lib/CountDown/index.d.ts +21 -25
  23. package/lib/CountDown/index.js +12 -11
  24. package/lib/DID/index.d.ts +9 -8
  25. package/lib/Datatable/index.d.ts +5 -5
  26. package/lib/Datatable/index.js +5 -5
  27. package/lib/Dialog/confirm.d.ts +6 -6
  28. package/lib/Dialog/confirm.js +3 -3
  29. package/lib/Dialog/types.d.ts +1 -1
  30. package/lib/DidLogo/index.d.ts +5 -25
  31. package/lib/DidLogo/index.js +4 -15
  32. package/lib/DriftBot/index.d.ts +13 -19
  33. package/lib/DriftBot/index.js +5 -6
  34. package/lib/Earth/index.d.ts +28 -10
  35. package/lib/Earth/index.js +12 -52
  36. package/lib/Earth/util.d.ts +10 -5
  37. package/lib/Earth/util.js +1 -0
  38. package/lib/ErrorBoundary/fallback.d.ts +12 -19
  39. package/lib/ErrorBoundary/fallback.js +2 -19
  40. package/lib/ErrorBoundary/index.d.ts +1 -1
  41. package/lib/Footer/index.d.ts +17 -24
  42. package/lib/Footer/index.js +2 -11
  43. package/lib/Header/header.d.ts +2 -2
  44. package/lib/Icon/image.d.ts +3 -2
  45. package/lib/Icon/index.d.ts +6 -4
  46. package/lib/Img/index.d.ts +1 -1
  47. package/lib/Img/index.js +1 -1
  48. package/lib/InfoRow/index.d.ts +9 -32
  49. package/lib/InfoRow/index.js +10 -23
  50. package/lib/Layout/dashboard/external-link.d.ts +13 -14
  51. package/lib/Layout/dashboard/external-link.js +5 -22
  52. package/lib/Layout/dashboard/full-page.d.ts +19 -11
  53. package/lib/Layout/dashboard/full-page.js +2 -6
  54. package/lib/Layout/dashboard/index.d.ts +20 -39
  55. package/lib/Layout/dashboard/index.js +10 -38
  56. package/lib/Layout/dashboard/sidebar.d.ts +17 -20
  57. package/lib/Layout/dashboard/sidebar.js +3 -16
  58. package/lib/Layout/dashboard-legacy/header.d.ts +10 -36
  59. package/lib/Layout/dashboard-legacy/header.js +5 -24
  60. package/lib/Layout/dashboard-legacy/index.d.ts +17 -56
  61. package/lib/Layout/dashboard-legacy/index.js +12 -41
  62. package/lib/Layout/dashboard-legacy/sidebar.d.ts +15 -26
  63. package/lib/Layout/dashboard-legacy/sidebar.js +5 -15
  64. package/lib/Layout/index.d.ts +17 -56
  65. package/lib/Layout/index.js +24 -50
  66. package/lib/LoadingMask/index.d.ts +8 -31
  67. package/lib/LoadingMask/index.js +2 -18
  68. package/lib/Locale/browser-lang.d.ts +4 -1
  69. package/lib/Locale/browser-lang.js +8 -3
  70. package/lib/Locale/context.d.ts +18 -8
  71. package/lib/Locale/context.js +1 -1
  72. package/lib/Locale/languages.d.ts +9 -55
  73. package/lib/Locale/selector.d.ts +10 -26
  74. package/lib/Locale/selector.js +8 -25
  75. package/lib/Locale/util.d.ts +4 -3
  76. package/lib/Locale/util.js +0 -1
  77. package/lib/Logo/index.d.ts +9 -40
  78. package/lib/Logo/index.js +88 -46
  79. package/lib/Metric/index.d.ts +9 -31
  80. package/lib/Metric/index.js +5 -20
  81. package/lib/NFTDisplay/aspect-ratio-container.d.ts +5 -12
  82. package/lib/NFTDisplay/aspect-ratio-container.js +0 -5
  83. package/lib/NFTDisplay/broken.d.ts +3 -13
  84. package/lib/NFTDisplay/broken.js +80 -10
  85. package/lib/NFTDisplay/displayApi.d.ts +1 -1
  86. package/lib/NFTDisplay/index.d.ts +28 -6
  87. package/lib/NFTDisplay/index.js +17 -51
  88. package/lib/NFTDisplay/svg-embedder/img.d.ts +8 -23
  89. package/lib/NFTDisplay/svg-embedder/img.js +3 -17
  90. package/lib/NFTDisplay/svg-embedder/inline-svg.d.ts +7 -13
  91. package/lib/NFTDisplay/svg-embedder/inline-svg.js +1 -8
  92. package/lib/NavMenu/nav-menu.d.ts +2 -0
  93. package/lib/NavMenu/nav-menu.js +0 -1
  94. package/lib/PageScroller/index.d.ts +14 -13
  95. package/lib/PageScroller/index.js +12 -37
  96. package/lib/PageScroller/usePrevValue.d.ts +1 -1
  97. package/lib/PageScroller/usePrevValue.js +1 -2
  98. package/lib/Passport/index.d.ts +1 -1
  99. package/lib/Passport/passport.d.ts +10 -30
  100. package/lib/Passport/passport.js +5 -19
  101. package/lib/PoweredByArcBlock/index.d.ts +4 -14
  102. package/lib/PoweredByArcBlock/index.js +1 -8
  103. package/lib/PricingTable/PricingPlan.d.ts +11 -9
  104. package/lib/PricingTable/PricingPlan.js +0 -4
  105. package/lib/PricingTable/index.d.ts +5 -3
  106. package/lib/PricingTable/index.js +1 -5
  107. package/lib/QRCode/index.d.ts +11 -22
  108. package/lib/QRCode/index.js +1 -15
  109. package/lib/RelativeTime/index.d.ts +12 -40
  110. package/lib/RelativeTime/index.js +7 -27
  111. package/lib/Result/common.d.ts +26 -45
  112. package/lib/Result/common.js +2 -4
  113. package/lib/Result/index.d.ts +5 -18
  114. package/lib/Result/index.js +1 -9
  115. package/lib/Result/result.d.ts +7 -29
  116. package/lib/Result/result.js +2 -17
  117. package/lib/Result/translations.d.ts +2 -54
  118. package/lib/Screenshot/BaseScreenshot/index.d.ts +7 -24
  119. package/lib/Screenshot/BaseScreenshot/index.js +2 -15
  120. package/lib/Screenshot/BaseScreenshot/shells/Macbook.d.ts +25 -19
  121. package/lib/Screenshot/BaseScreenshot/shells/Phone.d.ts +25 -19
  122. package/lib/Screenshot/index.d.ts +84 -28
  123. package/lib/Screenshot/index.js +14 -43
  124. package/lib/SessionBlocklet/index.d.ts +6 -19
  125. package/lib/SessionBlocklet/index.js +3 -14
  126. package/lib/SessionManager/index.d.ts +1 -1
  127. package/lib/SessionPermission/index.d.ts +9 -17
  128. package/lib/SessionPermission/index.js +3 -11
  129. package/lib/SessionUser/components/logged-in.d.ts +9 -31
  130. package/lib/SessionUser/components/logged-in.js +13 -29
  131. package/lib/SessionUser/components/session-user-item.d.ts +8 -1
  132. package/lib/SessionUser/components/session-user-item.js +2 -12
  133. package/lib/SessionUser/components/session-user-switch.d.ts +9 -21
  134. package/lib/SessionUser/components/session-user-switch.js +3 -15
  135. package/lib/SessionUser/components/un-login.d.ts +7 -23
  136. package/lib/SessionUser/components/un-login.js +4 -16
  137. package/lib/SessionUser/components/user-info.d.ts +12 -29
  138. package/lib/SessionUser/components/user-info.js +4 -19
  139. package/lib/SessionUser/index.d.ts +7 -30
  140. package/lib/SessionUser/index.js +5 -26
  141. package/lib/SessionUser/libs/translation.d.ts +2 -31
  142. package/lib/SessionUser/libs/translation.js +1 -0
  143. package/lib/SessionUser/libs/utils.d.ts +10 -9
  144. package/lib/Sparkline/index.d.ts +22 -1
  145. package/lib/Sparkline/index.js +25 -17
  146. package/lib/Spinner/index.d.ts +6 -1
  147. package/lib/Spinner/index.js +4 -11
  148. package/lib/Success/index.d.ts +5 -21
  149. package/lib/Success/index.js +4 -16
  150. package/lib/Tabs/index.d.ts +12 -26
  151. package/lib/Tabs/index.js +7 -37
  152. package/lib/TextCollapse/index.d.ts +10 -10
  153. package/lib/TextCollapse/index.js +4 -21
  154. package/lib/Theme/index.js +0 -2
  155. package/lib/Theme/theme-provider.d.ts +1 -1
  156. package/lib/Theme/theme.d.ts +4 -1
  157. package/lib/Theme/theme.js +1 -2
  158. package/lib/Typography/index.d.ts +5 -24
  159. package/lib/Typography/index.js +5 -17
  160. package/lib/Util/index.d.ts +11 -6
  161. package/lib/Util/index.js +6 -0
  162. package/lib/Video/index.d.ts +12 -16
  163. package/lib/Video/index.js +0 -14
  164. package/lib/Wallet/Action.d.ts +13 -18
  165. package/lib/Wallet/Action.js +0 -7
  166. package/lib/Wallet/Download.d.ts +24 -30
  167. package/lib/Wallet/Download.js +201 -18
  168. package/lib/Wallet/Open.d.ts +5 -15
  169. package/lib/Wallet/Open.js +5 -11
  170. package/lib/WalletOSIcon/index.d.ts +6 -25
  171. package/lib/WalletOSIcon/index.js +3 -16
  172. package/lib/WebWalletSWKeeper/index.d.ts +8 -20
  173. package/lib/WebWalletSWKeeper/index.js +14 -19
  174. package/lib/WechatPrompt/index.js +2 -0
  175. package/lib/global.d.ts +15 -0
  176. package/lib/type.d.ts +12 -3
  177. package/lib/withTheme/index.d.ts +8 -6
  178. package/lib/withTracker/index.d.ts +1 -1
  179. package/lib/withTracker/index.js +3 -0
  180. package/package.json +9 -5
  181. package/src/Address/did-address.tsx +7 -6
  182. package/src/Address/index.tsx +1 -1
  183. package/src/Avatar/index.jsx +6 -4
  184. package/src/Blocklet/blocklet.jsx +2 -2
  185. package/src/BlockletContext/index.tsx +3 -3
  186. package/src/BlockletNFT/index.jsx +3 -3
  187. package/src/BlockletV2/blocklet.tsx +2 -2
  188. package/src/Button/wrap.jsx +2 -2
  189. package/src/CardSelector/index.tsx +0 -1
  190. package/src/Center/index.tsx +1 -1
  191. package/src/ClickToCopy/copy-button.tsx +4 -4
  192. package/src/ClickToCopy/hook.ts +3 -2
  193. package/src/ClickToCopy/index.tsx +6 -5
  194. package/src/CodeBlock/index.tsx +3 -1
  195. package/src/CookieConsent/{index.jsx → index.tsx} +16 -19
  196. package/src/CountDown/{index.jsx → index.tsx} +30 -16
  197. package/src/DID/index.tsx +9 -8
  198. package/src/Datatable/index.jsx +5 -5
  199. package/src/Dialog/confirm.jsx +3 -3
  200. package/src/Dialog/types.d.ts +1 -1
  201. package/src/DidLogo/{index.jsx → index.tsx} +7 -14
  202. package/src/DriftBot/{index.jsx → index.tsx} +13 -11
  203. package/src/Earth/{index.jsx → index.tsx} +94 -66
  204. package/src/Earth/{util.js → util.ts} +20 -17
  205. package/src/ErrorBoundary/{fallback.jsx → fallback.tsx} +20 -21
  206. package/src/Footer/{index.jsx → index.tsx} +17 -14
  207. package/src/Header/header.tsx +2 -3
  208. package/src/Header/responsive-header.tsx +0 -1
  209. package/src/Icon/image.tsx +3 -3
  210. package/src/Icon/index.tsx +7 -4
  211. package/src/Img/index.jsx +1 -1
  212. package/src/InfoRow/{index.jsx → index.tsx} +32 -25
  213. package/src/Layout/dashboard/external-link.tsx +46 -0
  214. package/src/Layout/dashboard/{full-page.jsx → full-page.tsx} +20 -9
  215. package/src/Layout/dashboard/{index.jsx → index.tsx} +42 -44
  216. package/src/Layout/dashboard/{sidebar.jsx → sidebar.tsx} +23 -20
  217. package/src/Layout/dashboard-legacy/{header.jsx → header.tsx} +16 -26
  218. package/src/Layout/dashboard-legacy/{index.jsx → index.tsx} +32 -46
  219. package/src/Layout/dashboard-legacy/{sidebar.jsx → sidebar.tsx} +27 -19
  220. package/src/Layout/{index.jsx → index.tsx} +41 -47
  221. package/src/LoadingMask/{index.jsx → index.tsx} +17 -19
  222. package/src/Locale/{browser-lang.js → browser-lang.ts} +9 -7
  223. package/src/Locale/context.tsx +18 -11
  224. package/src/Locale/{languages.js → languages.ts} +1 -1
  225. package/src/Locale/{selector.jsx → selector.tsx} +32 -29
  226. package/src/Locale/{util.js → util.ts} +9 -2
  227. package/src/Logo/index.tsx +58 -0
  228. package/src/Metric/{index.jsx → index.tsx} +23 -18
  229. package/src/NFTDisplay/{aspect-ratio-container.jsx → aspect-ratio-container.tsx} +9 -7
  230. package/src/NFTDisplay/{broken.jsx → broken.tsx} +7 -12
  231. package/src/NFTDisplay/{displayApi.js → displayApi.ts} +4 -4
  232. package/src/NFTDisplay/{index.jsx → index.tsx} +59 -64
  233. package/src/NFTDisplay/svg-embedder/{img.jsx → img.tsx} +10 -18
  234. package/src/NFTDisplay/svg-embedder/{inline-svg.jsx → inline-svg.tsx} +8 -9
  235. package/src/NavMenu/nav-menu.tsx +2 -3
  236. package/src/PageScroller/{index.jsx → index.tsx} +40 -53
  237. package/src/PageScroller/{usePrevValue.js → usePrevValue.ts} +2 -3
  238. package/src/Passport/{passport.jsx → passport.tsx} +22 -19
  239. package/src/PoweredByArcBlock/{index.jsx → index.tsx} +6 -11
  240. package/src/PricingTable/{PricingPlan.jsx → PricingPlan.tsx} +15 -5
  241. package/src/PricingTable/{index.jsx → index.tsx} +9 -6
  242. package/src/QRCode/{index.jsx → index.tsx} +13 -17
  243. package/src/RelativeTime/{index.jsx → index.tsx} +24 -24
  244. package/src/Result/{common.jsx → common.tsx} +17 -13
  245. package/src/Result/index.tsx +30 -0
  246. package/src/Result/{result.jsx → result.tsx} +8 -17
  247. package/src/Result/{translations.js → translations.ts} +3 -1
  248. package/src/Screenshot/BaseScreenshot/{index.jsx → index.tsx} +9 -15
  249. package/src/Screenshot/BaseScreenshot/shells/{Macbook.jsx → Macbook.tsx} +3 -1
  250. package/src/Screenshot/BaseScreenshot/shells/{Phone.jsx → Phone.tsx} +3 -1
  251. package/src/Screenshot/{index.jsx → index.tsx} +60 -54
  252. package/src/SessionBlocklet/{index.jsx → index.tsx} +8 -14
  253. package/src/SessionPermission/index.tsx +25 -0
  254. package/src/SessionUser/components/{logged-in.jsx → logged-in.tsx} +49 -31
  255. package/src/SessionUser/components/session-user-item.tsx +97 -0
  256. package/src/SessionUser/components/{session-user-switch.jsx → session-user-switch.tsx} +16 -21
  257. package/src/SessionUser/components/{un-login.jsx → un-login.tsx} +10 -15
  258. package/src/SessionUser/components/{user-info.jsx → user-info.tsx} +16 -22
  259. package/src/SessionUser/index.tsx +26 -0
  260. package/src/SessionUser/libs/{translation.js → translation.ts} +3 -1
  261. package/src/SessionUser/libs/utils.ts +39 -0
  262. package/src/Sparkline/{index.jsx → index.tsx} +38 -22
  263. package/src/Spinner/index.tsx +20 -0
  264. package/src/Success/{index.jsx → index.tsx} +7 -13
  265. package/src/Tabs/{index.jsx → index.tsx} +26 -40
  266. package/src/TextCollapse/{index.jsx → index.tsx} +26 -21
  267. package/src/Theme/index.ts +0 -1
  268. package/src/Theme/theme-provider.tsx +1 -1
  269. package/src/Theme/theme.ts +6 -3
  270. package/src/Typography/{index.jsx → index.tsx} +19 -22
  271. package/src/Util/index.ts +14 -8
  272. package/src/Video/{index.jsx → index.tsx} +7 -10
  273. package/src/Wallet/{Action.jsx → Action.tsx} +16 -12
  274. package/src/Wallet/{Download.jsx → Download.tsx} +25 -21
  275. package/src/Wallet/{Open.jsx → Open.tsx} +8 -11
  276. package/src/WalletOSIcon/{index.jsx → index.tsx} +8 -16
  277. package/src/WebWalletSWKeeper/{index.jsx → index.tsx} +21 -24
  278. package/src/WechatPrompt/{index.jsx → index.tsx} +1 -0
  279. package/src/global.d.ts +15 -0
  280. package/src/type.d.ts +12 -3
  281. package/src/withTheme/{index.jsx → index.tsx} +12 -2
  282. package/src/withTracker/{index.jsx → index.tsx} +6 -4
  283. package/src/Layout/dashboard/external-link.jsx +0 -47
  284. package/src/Logo/index.jsx +0 -66
  285. package/src/Result/index.jsx +0 -33
  286. package/src/SessionPermission/index.jsx +0 -28
  287. package/src/SessionUser/components/session-user-item.jsx +0 -93
  288. package/src/SessionUser/index.jsx +0 -38
  289. package/src/SessionUser/libs/utils.js +0 -37
  290. package/src/Spinner/index.jsx +0 -21
  291. /package/src/ErrorBoundary/{index.jsx → index.ts} +0 -0
  292. /package/src/NFTDisplay/{loading.jsx → loading.tsx} +0 -0
  293. /package/src/Passport/{index.jsx → index.ts} +0 -0
  294. /package/src/SessionManager/{index.jsx → index.tsx} +0 -0
package/lib/Logo/index.js CHANGED
@@ -1,64 +1,106 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import PropTypes from 'prop-types';
2
+ import React from "react";
3
3
  import { styled } from '../Theme';
4
-
5
- // eslint-disable-next-line import/no-unresolved
6
- import LightLogo from './images/logo-light-top.svg?react';
7
- // eslint-disable-next-line import/no-unresolved
8
- import LightText from './images/logo-light-text.svg?react';
9
- // eslint-disable-next-line import/no-unresolved
10
- import DarkLogo from './images/logo-dark-top.svg?react';
11
- // eslint-disable-next-line import/no-unresolved
12
- import DarkText from './images/logo-dark-text.svg?react';
13
-
14
- /**
15
- @typedef {import('react').HTMLAttributes<HTMLSpanElement> & {
16
- mode?: 'light' | 'dark',
17
- layout?: 'vertical' | 'horizontal',
18
- showText?: boolean,
19
- showLogo?: boolean,
20
- }} LogoProps
21
- */
22
-
23
- /**
24
- * @description
25
- * @export
26
- * @param {LogoProps} props
27
- * @return {React.ReactComponentElement}
28
- */
4
+ var LightLogo = function LightLogo(props) {
5
+ return /*#__PURE__*/_jsx("svg", {
6
+ ...props,
7
+ children: /*#__PURE__*/_jsxs("g", {
8
+ fill: "none",
9
+ fillRule: "evenodd",
10
+ stroke: "#FFF",
11
+ children: [/*#__PURE__*/_jsx("path", {
12
+ d: "M.5 13.077L22.15.577l21.651 12.5v25l-21.65 12.5L.5 38.077zM22.15.577v50M.5 13.077l43.301 25m-43.301 0l43.301-25"
13
+ }), /*#__PURE__*/_jsx("path", {
14
+ d: "M22.15 38.077l10.826-6.25-10.825-18.75-10.825 18.75z"
15
+ })]
16
+ })
17
+ });
18
+ };
19
+ LightLogo.defaultProps = {
20
+ xmlns: "http://www.w3.org/2000/svg",
21
+ width: "45",
22
+ height: "52",
23
+ viewBox: "0 0 45 52"
24
+ };
25
+ var LightText = function LightText(props) {
26
+ return /*#__PURE__*/_jsx("svg", {
27
+ ...props,
28
+ children: /*#__PURE__*/_jsx("path", {
29
+ fill: "#FFF",
30
+ fillRule: "evenodd",
31
+ d: "M6.5.053h2.864L16.028 18h-2.114l-1.391-3.795H3.504L2.14 18H0L6.5.053zm1.474 1.481L4.04 12.563h7.895L7.975 1.534zm14.44 3.542c1.27 0 2.198.296 2.78.892.58.597.871 1.52.871 2.765v.36c0 .117-.008.245-.026.385h-1.826c.018-.14.027-.292.027-.452v-.48c0-.766-.186-1.283-.551-1.55-.367-.266-.916-.4-1.65-.4-.968 0-1.698.24-2.189.723-.493.48-.738 1.208-.738 2.187v8.308h-1.88V5.341h1.824l-.079 1.443c.376-.614.863-1.053 1.463-1.316a4.868 4.868 0 0 1 1.974-.392zM35.95 15.903c.501-.328.752-1.205.752-2.63h1.852c0 1.924-.403 3.178-1.208 3.765-.806.589-2.158.882-4.055.882-2.65 0-4.24-.538-4.766-1.616-.529-1.076-.793-2.781-.793-5.114 0-2.118.367-3.645 1.102-4.581.732-.934 2.209-1.401 4.43-1.401 1.378 0 2.569.221 3.572.665 1.002.446 1.503 1.497 1.503 3.153v.188a.234.234 0 0 0-.027.106v.106h-1.826c0-1.12-.228-1.851-.685-2.188-.455-.34-1.23-.507-2.322-.507-1.665 0-2.713.259-3.142.782-.43.524-.646 1.67-.646 3.44V12.2c0 1.4.161 2.448.485 3.15.322.7 1.297 1.048 2.926 1.048 1.397 0 2.346-.165 2.848-.495zm15.87-.318c.606-.328.912-1.263.912-2.805 0-.924-.147-1.69-.444-2.302-.294-.611-1.007-.917-2.133-.917h-7.09v6.516h5.528c1.543 0 2.617-.165 3.226-.492zm-8.754-13.85v6.036h5.665c1.325 0 2.239-.214 2.737-.643.503-.428.755-1.288.755-2.575 0-1.09-.192-1.834-.577-2.226-.385-.394-1.116-.591-2.19-.591h-6.39zM52 8.466c1.185.322 1.956.816 2.314 1.482.359.67.54 1.581.54 2.739 0 1.6-.325 2.858-.97 3.764-.647.909-1.874 1.363-3.686 1.363H41.05V0h8.62c1.592 0 2.759.312 3.503.934.744.624 1.115 1.78 1.115 3.473 0 1.014-.129 1.855-.386 2.522-.258.669-.89 1.181-1.903 1.536zm5.43 9.348V.001h1.907v17.812H57.43zm13.374-6.168v-.708c0-1.539-.141-2.636-.426-3.297-.284-.658-1.191-.99-2.718-.99h-.401c-1.617 0-2.625.25-3.025.75-.399.5-.599 1.632-.599 3.4v2.021c0 .206.008.407.024.602a9.48 9.48 0 0 0 .216 1.474c.106.465.275.822.505 1.072.196.179.435.302.72.373.283.072.586.116.905.135h1.254c1.083 0 1.914-.151 2.492-.456.577-.302.9-1.043.972-2.22a18.338 18.338 0 0 0 .054-1.447c.015-.233.027-.47.027-.71zm-3.786-6.518c2.399 0 3.956.414 4.672 1.243.717.828 1.074 2.418 1.074 4.766 0 2.048-.219 3.704-.657 4.966C71.668 17.367 70.16 18 67.581 18c-2.237 0-3.782-.347-4.632-1.042-.85-.694-1.275-2.205-1.275-4.54v-1.174c0-2.12.318-3.669.954-4.646.635-.98 2.099-1.471 4.39-1.471zm16.434 10.776c.501-.328.752-1.205.752-2.63h1.853c0 1.924-.403 3.178-1.209 3.765-.804.589-2.157.882-4.054.882-2.648 0-4.24-.538-4.767-1.616-.528-1.076-.79-2.781-.79-5.114 0-2.118.365-3.645 1.1-4.581.732-.934 2.21-1.401 4.43-1.401 1.377 0 2.568.221 3.571.665 1.003.446 1.504 1.497 1.504 3.153v.188a.232.232 0 0 0-.026.106v.106H83.99c0-1.12-.229-1.851-.686-2.188-.455-.34-1.23-.507-2.323-.507-1.665 0-2.712.259-3.142.782-.43.524-.643 1.67-.643 3.44V12.2c0 1.4.16 2.448.482 3.15.324.7 1.298 1.048 2.927 1.048 1.397 0 2.346-.165 2.847-.495zm9.236-4.82L99 17.813h-2.47l-5.317-6.01h-.752v6.01h-1.907V0h1.907v10.362h.752l4.512-5.02h2.309l-5.346 5.741z"
32
+ })
33
+ });
34
+ };
35
+ LightText.defaultProps = {
36
+ xmlns: "http://www.w3.org/2000/svg",
37
+ width: "99",
38
+ height: "18",
39
+ viewBox: "0 0 99 18"
40
+ };
41
+ var DarkLogo = function DarkLogo(props) {
42
+ return /*#__PURE__*/_jsx("svg", {
43
+ ...props,
44
+ children: /*#__PURE__*/_jsxs("g", {
45
+ fill: "none",
46
+ fillRule: "evenodd",
47
+ stroke: "#000",
48
+ children: [/*#__PURE__*/_jsx("path", {
49
+ d: "M.5 13.077L22.15.577l21.651 12.5v25l-21.65 12.5L.5 38.077zM22.15.577v50M.5 13.077l43.301 25m-43.301 0l43.301-25"
50
+ }), /*#__PURE__*/_jsx("path", {
51
+ d: "M22.15 38.077l10.826-6.25-10.825-18.75-10.825 18.75z"
52
+ })]
53
+ })
54
+ });
55
+ };
56
+ DarkLogo.defaultProps = {
57
+ xmlns: "http://www.w3.org/2000/svg",
58
+ width: "45",
59
+ height: "52",
60
+ viewBox: "0 0 45 52"
61
+ };
62
+ var DarkText = function DarkText(props) {
63
+ return /*#__PURE__*/_jsx("svg", {
64
+ ...props,
65
+ children: /*#__PURE__*/_jsx("path", {
66
+ fillRule: "evenodd",
67
+ d: "M6.5.053h2.864L16.028 18h-2.114l-1.391-3.795H3.504L2.14 18H0L6.5.053zm1.474 1.481L4.04 12.563h7.895L7.975 1.534zm14.44 3.542c1.27 0 2.198.296 2.78.892.58.597.871 1.52.871 2.765v.36c0 .117-.008.245-.026.385h-1.826c.018-.14.027-.292.027-.452v-.48c0-.766-.186-1.283-.551-1.55-.367-.266-.916-.4-1.65-.4-.968 0-1.698.24-2.189.723-.493.48-.738 1.208-.738 2.187v8.308h-1.88V5.341h1.824l-.079 1.443c.376-.614.863-1.053 1.463-1.316a4.868 4.868 0 0 1 1.974-.392zM35.95 15.903c.501-.328.752-1.205.752-2.63h1.852c0 1.924-.403 3.178-1.208 3.765-.806.589-2.158.882-4.055.882-2.65 0-4.24-.538-4.766-1.616-.529-1.076-.793-2.781-.793-5.114 0-2.118.367-3.645 1.102-4.581.732-.934 2.209-1.401 4.43-1.401 1.378 0 2.569.221 3.572.665 1.002.446 1.503 1.497 1.503 3.153v.188a.234.234 0 0 0-.027.106v.106h-1.826c0-1.12-.228-1.851-.685-2.188-.455-.34-1.23-.507-2.322-.507-1.665 0-2.713.259-3.142.782-.43.524-.646 1.67-.646 3.44V12.2c0 1.4.161 2.448.485 3.15.322.7 1.297 1.048 2.926 1.048 1.397 0 2.346-.165 2.848-.495zm15.87-.318c.606-.328.912-1.263.912-2.805 0-.924-.147-1.69-.444-2.302-.294-.611-1.007-.917-2.133-.917h-7.09v6.516h5.528c1.543 0 2.617-.165 3.226-.492zm-8.754-13.85v6.036h5.665c1.325 0 2.239-.214 2.737-.643.503-.428.755-1.288.755-2.575 0-1.09-.192-1.834-.577-2.226-.385-.394-1.116-.591-2.19-.591h-6.39zM52 8.466c1.185.322 1.956.816 2.314 1.482.359.67.54 1.581.54 2.739 0 1.6-.325 2.858-.97 3.764-.647.909-1.874 1.363-3.686 1.363H41.05V0h8.62c1.592 0 2.759.312 3.503.934.744.624 1.115 1.78 1.115 3.473 0 1.014-.129 1.855-.386 2.522-.258.669-.89 1.181-1.903 1.536zm5.43 9.348V.001h1.907v17.812H57.43zm13.374-6.168v-.708c0-1.539-.141-2.636-.426-3.297-.284-.658-1.191-.99-2.718-.99h-.401c-1.617 0-2.625.25-3.025.75-.399.5-.599 1.632-.599 3.4v2.021c0 .206.008.407.024.602a9.48 9.48 0 0 0 .216 1.474c.106.465.275.822.505 1.072.196.179.435.302.72.373.283.072.586.116.905.135h1.254c1.083 0 1.914-.151 2.492-.456.577-.302.9-1.043.972-2.22a18.338 18.338 0 0 0 .054-1.447c.015-.233.027-.47.027-.71zm-3.786-6.518c2.399 0 3.956.414 4.672 1.243.717.828 1.074 2.418 1.074 4.766 0 2.048-.219 3.704-.657 4.966C71.668 17.367 70.16 18 67.581 18c-2.237 0-3.782-.347-4.632-1.042-.85-.694-1.275-2.205-1.275-4.54v-1.174c0-2.12.318-3.669.954-4.646.635-.98 2.099-1.471 4.39-1.471zm16.434 10.776c.501-.328.752-1.205.752-2.63h1.853c0 1.924-.403 3.178-1.209 3.765-.804.589-2.157.882-4.054.882-2.648 0-4.24-.538-4.767-1.616-.528-1.076-.79-2.781-.79-5.114 0-2.118.365-3.645 1.1-4.581.732-.934 2.21-1.401 4.43-1.401 1.377 0 2.568.221 3.571.665 1.003.446 1.504 1.497 1.504 3.153v.188a.232.232 0 0 0-.026.106v.106H83.99c0-1.12-.229-1.851-.686-2.188-.455-.34-1.23-.507-2.323-.507-1.665 0-2.712.259-3.142.782-.43.524-.643 1.67-.643 3.44V12.2c0 1.4.16 2.448.482 3.15.324.7 1.298 1.048 2.927 1.048 1.397 0 2.346-.165 2.847-.495zm9.236-4.82L99 17.813h-2.47l-5.317-6.01h-.752v6.01h-1.907V0h1.907v10.362h.752l4.512-5.02h2.309l-5.346 5.741z"
68
+ })
69
+ });
70
+ };
71
+ DarkText.defaultProps = {
72
+ xmlns: "http://www.w3.org/2000/svg",
73
+ width: "99",
74
+ height: "18",
75
+ viewBox: "0 0 99 18"
76
+ };
29
77
  export default function Logo({
30
- showText,
31
- showLogo,
32
- mode,
33
- layout,
78
+ showText = true,
79
+ showLogo = true,
80
+ mode = 'dark',
81
+ layout = 'vertical',
82
+ size,
83
+ style = {},
34
84
  ...rest
35
85
  }) {
36
- const logo = mode === 'light' ? /*#__PURE__*/_jsx(LightLogo, {}) : /*#__PURE__*/_jsx(DarkLogo, {});
37
- const text = mode === 'light' ? /*#__PURE__*/_jsx(LightText, {
86
+ const isLight = mode === 'light';
87
+ const logo = isLight ? /*#__PURE__*/_jsx(LightLogo, {}) : /*#__PURE__*/_jsx(DarkLogo, {});
88
+ const text = isLight ? /*#__PURE__*/_jsx(LightText, {
38
89
  className: "logo-text"
39
90
  }) : /*#__PURE__*/_jsx(DarkText, {
40
91
  className: "logo-text"
41
92
  });
93
+ if (size) {
94
+ style.width = `${size}px`;
95
+ style.height = `${size}px`;
96
+ }
42
97
  return /*#__PURE__*/_jsxs(Container, {
43
98
  layout: layout,
99
+ style: style,
44
100
  ...rest,
45
101
  children: [showLogo && logo, showText && text]
46
102
  });
47
103
  }
48
- Logo.propTypes = {
49
- mode: PropTypes.oneOf(['light', 'dark']),
50
- layout: PropTypes.oneOf(['vertical', 'horizontal']),
51
- showText: PropTypes.bool,
52
- showLogo: PropTypes.bool
53
- };
54
- Logo.defaultProps = {
55
- mode: 'dark',
56
- layout: 'vertical',
57
- showText: true,
58
- showLogo: true
59
- };
60
-
61
- /** @type {import('@emotion/styled').StyledComponent<HTMLSpanElement, {}, { ref?: React.Ref<any> | undefined;}>} */
62
104
  const Container = styled('span')`
63
105
  display: inline-flex;
64
106
  flex-direction: ${props => props.layout === 'horizontal' ? 'row' : 'column'};
@@ -1,32 +1,10 @@
1
- declare function Metric({ icon, value, name, url, animated, LinkComponent, prefix }: {
2
- icon: any;
3
- value: any;
4
- name: any;
5
- url: any;
6
- animated: any;
7
- LinkComponent: any;
8
- prefix: any;
9
- }): import("react/jsx-runtime").JSX.Element;
10
- declare namespace Metric {
11
- namespace propTypes {
12
- let icon: PropTypes.Validator<string>;
13
- let value: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
14
- let name: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
15
- let animated: PropTypes.Requireable<boolean>;
16
- let url: PropTypes.Requireable<string>;
17
- let LinkComponent: PropTypes.Requireable<any>;
18
- let prefix: PropTypes.Requireable<string>;
19
- }
20
- namespace defaultProps {
21
- let animated_1: boolean;
22
- export { animated_1 as animated };
23
- let url_1: string;
24
- export { url_1 as url };
25
- let LinkComponent_1: null;
26
- export { LinkComponent_1 as LinkComponent };
27
- let prefix_1: string;
28
- export { prefix_1 as prefix };
29
- }
1
+ export interface MetricProps {
2
+ icon: string;
3
+ value: string | number;
4
+ name: React.ReactNode;
5
+ url?: string;
6
+ animated?: false | true;
7
+ LinkComponent?: React.ElementType;
8
+ prefix?: string;
30
9
  }
31
- export default Metric;
32
- import PropTypes from 'prop-types';
10
+ export default function Metric({ icon, value, name, url, animated, LinkComponent, prefix, }: MetricProps): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /* eslint-disable react/no-danger */
3
- import PropTypes from 'prop-types';
3
+ import { Link } from '@mui/material';
4
4
  import ImageIcon from '../Icon/image';
5
5
  import { styled } from '../Theme';
6
6
  export default function Metric({
7
7
  icon,
8
8
  value,
9
9
  name,
10
- url,
11
- animated,
12
- LinkComponent,
13
- prefix
10
+ url = '',
11
+ animated = false,
12
+ LinkComponent = Link,
13
+ prefix = '/images'
14
14
  }) {
15
15
  const metric = /*#__PURE__*/_jsxs(_Fragment, {
16
16
  children: [/*#__PURE__*/_jsx("div", {
@@ -41,21 +41,6 @@ export default function Metric({
41
41
  }) : metric
42
42
  });
43
43
  }
44
- Metric.propTypes = {
45
- icon: PropTypes.string.isRequired,
46
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
47
- name: PropTypes.node.isRequired,
48
- animated: PropTypes.bool,
49
- url: PropTypes.string,
50
- LinkComponent: PropTypes.any,
51
- prefix: PropTypes.string
52
- };
53
- Metric.defaultProps = {
54
- animated: false,
55
- url: '',
56
- LinkComponent: null,
57
- prefix: '/images'
58
- };
59
44
  const Container = styled('div')`
60
45
  border-left: 1px solid ${props => props.theme.typography.color.main};
61
46
  padding: 10px 0 10px 16px;
@@ -1,13 +1,6 @@
1
- export default AspectRatioContainer;
2
- declare function AspectRatioContainer({ aspect, children, ...rest }: {
3
- [x: string]: any;
4
- aspect: any;
5
- children: any;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- declare namespace AspectRatioContainer {
8
- namespace propTypes {
9
- let aspect: PropTypes.Validator<number>;
10
- let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
11
- }
1
+ export interface AspectRatioContainerProps {
2
+ aspect: number;
3
+ children?: React.ReactNode;
12
4
  }
13
- import PropTypes from 'prop-types';
5
+ declare function AspectRatioContainer({ aspect, children, ...rest }: AspectRatioContainerProps): import("react/jsx-runtime").JSX.Element;
6
+ export default AspectRatioContainer;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import PropTypes from 'prop-types';
3
2
  import { styled } from '../Theme';
4
3
  function AspectRatioContainer({
5
4
  aspect,
@@ -15,10 +14,6 @@ function AspectRatioContainer({
15
14
  })
16
15
  });
17
16
  }
18
- AspectRatioContainer.propTypes = {
19
- aspect: PropTypes.number.isRequired,
20
- children: PropTypes.node.isRequired
21
- };
22
17
  const Root = styled('span')`
23
18
  display: block;
24
19
  position: relative;
@@ -1,14 +1,4 @@
1
- declare function Broken({ children }?: {
2
- children: any;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- declare namespace Broken {
5
- namespace propTypes {
6
- let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
7
- }
8
- namespace defaultProps {
9
- let children_1: string;
10
- export { children_1 as children };
11
- }
1
+ export interface BrokenProps {
2
+ children?: React.ReactNode;
12
3
  }
13
- export default Broken;
14
- import PropTypes from 'prop-types';
4
+ export default function Broken({ children }?: BrokenProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,87 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
2
3
  import Box from '@mui/material/Box';
3
- import PropTypes from 'prop-types';
4
- // eslint-disable-next-line import/no-unresolved
5
- import NFTBroken from './NFTBroken.svg?react';
6
4
  import { styled } from '../Theme';
5
+ var NFTBroken = function NFTBroken(props) {
6
+ return /*#__PURE__*/_jsxs("svg", {
7
+ ...props,
8
+ children: [/*#__PURE__*/_jsxs("g", {
9
+ clipPath: "url(#a)",
10
+ children: [/*#__PURE__*/_jsx("path", {
11
+ fill: "color(display-p3 .9529 .9569 .9647)",
12
+ d: "M60 0h60v60H60z"
13
+ }), /*#__PURE__*/_jsx("path", {
14
+ fill: "color(display-p3 .9765 .9804 .9843)",
15
+ d: "M0 0h60v60H0zM180 0h60v60h-60z"
16
+ }), /*#__PURE__*/_jsx("path", {
17
+ fill: "color(display-p3 .898 .9059 .9216)",
18
+ d: "M120 0h60v60h-60zM240 0h60v60h-60zM0 60h60v60H0z"
19
+ }), /*#__PURE__*/_jsx("path", {
20
+ fill: "color(display-p3 .9765 .9804 .9843)",
21
+ d: "M60 60h60v60H60z"
22
+ }), /*#__PURE__*/_jsx("path", {
23
+ fill: "color(display-p3 .9529 .9569 .9647)",
24
+ d: "M120 60h60v60h-60zM240 60h60v60h-60z"
25
+ }), /*#__PURE__*/_jsx("path", {
26
+ fill: "color(display-p3 .898 .9059 .9216)",
27
+ d: "M180 60h60v60h-60z"
28
+ }), /*#__PURE__*/_jsx("path", {
29
+ fill: "color(display-p3 .9529 .9569 .9647)",
30
+ d: "M0 120h60v60H0z"
31
+ }), /*#__PURE__*/_jsx("path", {
32
+ fill: "color(display-p3 .9765 .9804 .9843)",
33
+ d: "M0 180h60v60H0z"
34
+ }), /*#__PURE__*/_jsx("path", {
35
+ fill: "color(display-p3 .9529 .9569 .9647)",
36
+ d: "M0 240h60v60H0z"
37
+ }), /*#__PURE__*/_jsx("path", {
38
+ fill: "color(display-p3 .898 .9059 .9216)",
39
+ d: "M60 120h60v60H60z"
40
+ }), /*#__PURE__*/_jsx("path", {
41
+ fill: "color(display-p3 .9529 .9569 .9647)",
42
+ d: "M60 180h60v60H60z"
43
+ }), /*#__PURE__*/_jsx("path", {
44
+ fill: "color(display-p3 .898 .9059 .9216)",
45
+ d: "M60 240h60v60H60z"
46
+ }), /*#__PURE__*/_jsx("path", {
47
+ fill: "color(display-p3 .9765 .9804 .9843)",
48
+ d: "M120 120h60v60h-60zM180 180h60v60h-60z"
49
+ }), /*#__PURE__*/_jsx("path", {
50
+ fill: "color(display-p3 .9529 .9569 .9647)",
51
+ d: "M120 240h60v60h-60z"
52
+ }), /*#__PURE__*/_jsx("path", {
53
+ fill: "color(display-p3 .9765 .9804 .9843)",
54
+ d: "M240 120h60v60h-60z"
55
+ }), /*#__PURE__*/_jsx("path", {
56
+ fill: "color(display-p3 .898 .9059 .9216)",
57
+ d: "M120 180h60v60h-60zM180 240h60v60h-60z"
58
+ }), /*#__PURE__*/_jsx("path", {
59
+ fill: "color(display-p3 .9529 .9569 .9647)",
60
+ d: "M180 120h60v60h-60zM240 180h60v60h-60z"
61
+ }), /*#__PURE__*/_jsx("path", {
62
+ fill: "color(display-p3 .9765 .9804 .9843)",
63
+ d: "M240 240h60v60h-60z"
64
+ })]
65
+ }), /*#__PURE__*/_jsx("defs", {
66
+ children: /*#__PURE__*/_jsx("clipPath", {
67
+ id: "a",
68
+ children: /*#__PURE__*/_jsx("path", {
69
+ fill: "#fff",
70
+ d: "M0 0h300v300H0z"
71
+ })
72
+ })
73
+ })]
74
+ });
75
+ };
76
+ NFTBroken.defaultProps = {
77
+ width: "300",
78
+ height: "300",
79
+ viewBox: "0 0 300 300",
80
+ fill: "none",
81
+ xmlns: "http://www.w3.org/2000/svg"
82
+ };
7
83
  export default function Broken({
8
- children
84
+ children = 'Non-publicly accessible NFT'
9
85
  } = {}) {
10
86
  return /*#__PURE__*/_jsxs(Root, {
11
87
  children: [/*#__PURE__*/_jsx(NFTBroken, {
@@ -16,12 +92,6 @@ export default function Broken({
16
92
  })]
17
93
  });
18
94
  }
19
- Broken.propTypes = {
20
- children: PropTypes.node
21
- };
22
- Broken.defaultProps = {
23
- children: 'Non-publicly accessible NFT'
24
- };
25
95
  const Root = styled(Box)`
26
96
  width: 100%;
27
97
  height: 100%;
@@ -1,2 +1,2 @@
1
- export default instance;
2
1
  declare const instance: import("axios").AxiosInstance;
2
+ export default instance;
@@ -1,12 +1,34 @@
1
+ import React from 'react';
2
+ import { type BoxProps } from '@mui/material';
1
3
  /**
2
4
  * 从 assetState 中获取 nft data, 兼容新旧两种类型的数据结构, 建议将该方法的返回值传入 NFTDisplay 组件的 data prop
3
5
  * - 旧: assetState.data.value (.credentialSubject.display)
4
6
  * - 新: assetState.display
5
7
  */
6
- export function getNFTData(assetState: any): any;
7
- declare function _default({ aspect, inset, ...rest }: {
8
- [x: string]: any;
9
- aspect: any;
10
- inset: any;
11
- }): import("react/jsx-runtime").JSX.Element;
8
+ export declare function getNFTData(assetState: Record<string, any>): any;
9
+ export interface NFTDisplayProps extends BoxProps {
10
+ /** asset data 可以是 raw data 和 parsed data */
11
+ data: string | Record<string, any>;
12
+ address: string;
13
+ inset?: false | true;
14
+ aspect?: number;
15
+ component?: React.ElementType<any>;
16
+ className?: string;
17
+ renderError?: () => React.ReactNode;
18
+ renderLoading?: () => React.ReactNode;
19
+ /** 对于非 url type 的情况, 支持优先选用的 svg 嵌入方式, 默认是 img */
20
+ preferredSvgEmbedder?: 'img' | 'svg';
21
+ /** 针对非 url type 的情况, 检测 svg 有效性, 默认禁用 */
22
+ checkSvg?: false | true;
23
+ /** loading 最小显示时间 (避免闪烁) */
24
+ minimumLoadingTime?: number;
25
+ /** 完成回调, 无论加载成功|失败 */
26
+ onCompleted?: () => void;
27
+ /**
28
+ * 图片处理,参考:https://team.arcblock.io/comment/docs/c158aee4-accd-42f4-9ced-6a23f28c00e0/en/blocklet-image-service-guide
29
+ * 配置参数会全部转发给 Image Service
30
+ */
31
+ imageFilter?: object | null;
32
+ }
33
+ declare const _default: ({ aspect, inset, ...rest }: NFTDisplayProps) => import("react/jsx-runtime").JSX.Element;
12
34
  export default _default;
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /* eslint-disable react-hooks/rules-of-hooks */
3
- import { useRef, useEffect, useState } from 'react';
4
- import PropTypes from 'prop-types';
3
+ import React, { useRef, useEffect, useState } from 'react';
5
4
  import clsx from 'clsx';
6
5
  import { Buffer } from 'buffer';
7
6
  import get from 'lodash/get';
@@ -9,6 +8,7 @@ import pako from 'pako';
9
8
  import base64 from 'base64-url';
10
9
  import isSvg from 'is-svg';
11
10
  import noop from 'lodash/noop';
11
+ import { Box } from '@mui/material';
12
12
  import AspectRatioContainer from './aspect-ratio-container';
13
13
  import ImgSvgEmbedder from './svg-embedder/img';
14
14
  import InlineSvgEmbedder from './svg-embedder/inline-svg';
@@ -44,7 +44,6 @@ const getSvgEmbedder = preferredSvgEmbedder => {
44
44
  };
45
45
  return embedders[preferredSvgEmbedder];
46
46
  };
47
-
48
47
  /**
49
48
  * TODO:
50
49
  * 考虑把 asset data 解析部分和 nft display 分离, android 端有相关使用场景 - 只传入 svg 或 url, 也可以传入 asset data,
@@ -55,31 +54,32 @@ function NFTDisplay({
55
54
  address,
56
55
  inset,
57
56
  aspect,
58
- component,
59
- className,
57
+ component = 'span',
58
+ className = '',
60
59
  renderError,
61
60
  renderLoading,
62
- preferredSvgEmbedder,
63
- checkSvg,
64
- minimumLoadingTime,
65
- onCompleted,
66
- imageFilter,
61
+ preferredSvgEmbedder = 'img',
62
+ checkSvg = false,
63
+ minimumLoadingTime = 0,
64
+ onCompleted = noop,
65
+ imageFilter = null,
67
66
  ...rest
68
67
  }) {
69
68
  const wrapRoot = children => /*#__PURE__*/_jsx(Root, {
70
- as: component,
69
+ component: component,
71
70
  ...rest,
72
71
  className: clsx(className, {
73
72
  'nft-display--inset': inset
74
73
  }),
75
74
  children: children
76
75
  });
77
- const parsed = useRef(data);
76
+ const parsed = useRef({});
78
77
  try {
79
78
  // 如果是 raw data 先解析
80
- if (typeof parsed.current === 'string') {
79
+ if (typeof data === 'string') {
81
80
  parsed.current = JSON.parse(data);
82
- // console.log('[debug] parse data')
81
+ } else {
82
+ parsed.current = data;
83
83
  }
84
84
  const {
85
85
  vcId
@@ -144,6 +144,7 @@ function NFTDisplay({
144
144
  }),
145
145
  method: 'HEAD'
146
146
  });
147
+ // @ts-expect-error
147
148
  const contentType = response?.headers?.get('Content-Type');
148
149
  setState({
149
150
  ...state,
@@ -324,42 +325,7 @@ function NFTDisplay({
324
325
  return wrapRoot(renderError ? renderError() : /*#__PURE__*/_jsx(DefaultBrokenImage, {}));
325
326
  }
326
327
  }
327
- NFTDisplay.propTypes = {
328
- // asset data 可以是 raw data 和 parsed data
329
- data: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired,
330
- address: PropTypes.string.isRequired,
331
- component: PropTypes.string,
332
- inset: PropTypes.bool,
333
- aspect: PropTypes.number,
334
- className: PropTypes.string,
335
- renderError: PropTypes.func,
336
- renderLoading: PropTypes.func,
337
- // 对于非 url type 的情况, 支持优先选用的 svg 嵌入方式, 默认是 img
338
- preferredSvgEmbedder: PropTypes.oneOf(['img', 'svg']),
339
- // 针对非 url type 的情况, 检测 svg 有效性, 默认禁用
340
- checkSvg: PropTypes.bool,
341
- // loading 最小显示时间 (避免闪烁)
342
- minimumLoadingTime: PropTypes.number,
343
- // 完成回调, 无论加载成功|失败
344
- onCompleted: PropTypes.func,
345
- // 图片处理,参考:https://team.arcblock.io/comment/docs/c158aee4-accd-42f4-9ced-6a23f28c00e0/en/blocklet-image-service-guide
346
- // 配置参数会全部转发给 Image Service
347
- imageFilter: PropTypes.object
348
- };
349
- NFTDisplay.defaultProps = {
350
- component: 'span',
351
- inset: false,
352
- aspect: 0,
353
- className: '',
354
- renderError: null,
355
- renderLoading: null,
356
- preferredSvgEmbedder: 'img',
357
- checkSvg: false,
358
- minimumLoadingTime: 0,
359
- onCompleted: noop,
360
- imageFilter: null
361
- };
362
- const Root = styled('div')`
328
+ const Root = styled(Box)`
363
329
  display: flex;
364
330
  justify-content: center;
365
331
  align-items: center;
@@ -395,7 +361,7 @@ function withAspectRatio(Component) {
395
361
  ...rest
396
362
  }) {
397
363
  // inset 比 aspect ratio 优先级高, 如果同时设置了 inset 和 aspect, 则后者不生效
398
- const applyAspectRatio = aspect > 0 && !inset;
364
+ const applyAspectRatio = aspect && aspect > 0 && !inset;
399
365
  if (applyAspectRatio) {
400
366
  return /*#__PURE__*/_jsx(AspectRatioContainer, {
401
367
  aspect: aspect,
@@ -1,24 +1,9 @@
1
- export default ImgEmbedder;
2
- /**
3
- * 基于 <img> 嵌入 svg
4
- */
5
- declare function ImgEmbedder({ svg, alt, fallback, ...rest }: {
6
- [x: string]: any;
7
- svg: any;
8
- alt: any;
9
- fallback: any;
10
- }): import("react/jsx-runtime").JSX.Element;
11
- declare namespace ImgEmbedder {
12
- namespace propTypes {
13
- let svg: PropTypes.Validator<string>;
14
- let alt: PropTypes.Requireable<string>;
15
- let fallback: PropTypes.Requireable<boolean>;
16
- }
17
- namespace defaultProps {
18
- let alt_1: string;
19
- export { alt_1 as alt };
20
- let fallback_1: boolean;
21
- export { fallback_1 as fallback };
22
- }
1
+ export interface ImgEmbedderProps extends React.HTMLAttributes<HTMLImageElement> {
2
+ svg: string;
3
+ alt?: string;
4
+ /** 对于包含 foreignObject 的 svg, fallback 到 inline svg + shadow DOM */
5
+ fallback?: true | false;
23
6
  }
24
- import PropTypes from 'prop-types';
7
+ /** 基于 <img> 嵌入 svg */
8
+ declare function ImgEmbedder({ svg, alt, fallback, ...rest }: ImgEmbedderProps): import("react/jsx-runtime").JSX.Element;
9
+ export default ImgEmbedder;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import PropTypes from 'prop-types';
3
2
  import InlineSvgEmbedder from './inline-svg';
4
3
  const svgToImgUrl = svg => {
5
4
  // fix: #225, https://stackoverflow.com/a/52135328)
@@ -8,14 +7,11 @@ const svgToImgUrl = svg => {
8
7
  });
9
8
  return URL.createObjectURL(blob);
10
9
  };
11
-
12
- /**
13
- * 基于 <img> 嵌入 svg
14
- */
10
+ /** 基于 <img> 嵌入 svg */
15
11
  function ImgEmbedder({
16
12
  svg,
17
- alt,
18
- fallback,
13
+ alt = '',
14
+ fallback = true,
19
15
  ...rest
20
16
  }) {
21
17
  // 包含 foreignObject 的 svg, fallback 到 shadow dom
@@ -32,14 +28,4 @@ function ImgEmbedder({
32
28
  ...rest
33
29
  });
34
30
  }
35
- ImgEmbedder.propTypes = {
36
- svg: PropTypes.string.isRequired,
37
- alt: PropTypes.string,
38
- // 对于包含 foreignObject 的 svg, fallback 到 inline svg + shadow DOM
39
- fallback: PropTypes.bool
40
- };
41
- ImgEmbedder.defaultProps = {
42
- alt: '',
43
- fallback: true
44
- };
45
31
  export default ImgEmbedder;