@rango-dev/widget-embedded 0.30.1-next.0 → 0.30.1-next.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.30.1-next.0",
3
+ "version": "0.30.1-next.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -24,15 +24,15 @@
24
24
  "dependencies": {
25
25
  "@lingui/core": "4.2.1",
26
26
  "@lingui/react": "4.2.1",
27
- "@rango-dev/logging-core": "^0.5.0",
28
- "@rango-dev/provider-all": "^0.35.0",
27
+ "@rango-dev/logging-core": "^0.5.1-next.0",
28
+ "@rango-dev/provider-all": "^0.35.2-next.0",
29
29
  "@rango-dev/queue-manager-core": "^0.26.0",
30
- "@rango-dev/queue-manager-rango-preset": "^0.35.0",
30
+ "@rango-dev/queue-manager-rango-preset": "^0.35.2-next.0",
31
31
  "@rango-dev/queue-manager-react": "^0.26.0",
32
- "@rango-dev/signer-solana": "^0.30.0",
33
- "@rango-dev/ui": "^0.36.1-next.0",
34
- "@rango-dev/wallets-react": "^0.21.0",
35
- "@rango-dev/wallets-shared": "^0.35.0",
32
+ "@rango-dev/signer-solana": "^0.30.1-next.0",
33
+ "@rango-dev/ui": "^0.36.1-next.1",
34
+ "@rango-dev/wallets-react": "^0.21.2-next.0",
35
+ "@rango-dev/wallets-shared": "^0.35.1",
36
36
  "bignumber.js": "^9.1.1",
37
37
  "copy-to-clipboard": "^3.3.3",
38
38
  "dayjs": "^1.11.7",
@@ -53,4 +53,4 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  }
56
- }
56
+ }
@@ -10,10 +10,10 @@ import {
10
10
  Select,
11
11
  TextField,
12
12
  } from '@rango-dev/ui';
13
+ import { namespaces } from '@rango-dev/wallets-shared';
13
14
  import React, { useEffect, useState } from 'react';
14
15
 
15
16
  import { WIDGET_UI_ID } from '../../constants';
16
- import { namespaces } from '../../constants/namespaces';
17
17
  import { WatermarkedModal } from '../common/WatermarkedModal';
18
18
  import {
19
19
  LogoContainer,
@@ -13,10 +13,10 @@ import {
13
13
  Radio,
14
14
  RadioRoot,
15
15
  } from '@rango-dev/ui';
16
+ import { namespaces } from '@rango-dev/wallets-shared';
16
17
  import React, { useMemo, useState } from 'react';
17
18
 
18
19
  import { WIDGET_UI_ID } from '../../constants';
19
- import { namespaces } from '../../constants/namespaces';
20
20
  import { useAppStore } from '../../store/AppStore';
21
21
  import { WatermarkedModal } from '../common/WatermarkedModal';
22
22
  import { WalletImageContainer } from '../HeaderButtons/HeaderButtons.styles';
@@ -15,6 +15,13 @@ import {
15
15
  } from '../utils/configs';
16
16
  import { customizedThemeTokens } from '../utils/ui';
17
17
 
18
+ function doesWindowPreferDarkColorScheme() {
19
+ return (
20
+ window.matchMedia &&
21
+ window.matchMedia('(prefers-color-scheme: dark)').matches
22
+ );
23
+ }
24
+
18
25
  export function useTheme(props: WidgetTheme) {
19
26
  const {
20
27
  colors,
@@ -23,7 +30,9 @@ export function useTheme(props: WidgetTheme) {
23
30
  secondaryBorderRadius = DEFAULT_SECONDARY_RADIUS,
24
31
  } = props;
25
32
 
26
- const [OSTheme, setOSTheme] = useState('light');
33
+ const [OSTheme, setOSTheme] = useState(
34
+ doesWindowPreferDarkColorScheme() ? 'dark' : 'light'
35
+ );
27
36
 
28
37
  const { theme } = useAppStore();
29
38
 
@@ -64,10 +73,7 @@ export function useTheme(props: WidgetTheme) {
64
73
  }
65
74
  };
66
75
 
67
- if (
68
- window.matchMedia &&
69
- window.matchMedia('(prefers-color-scheme: dark)').matches
70
- ) {
76
+ if (doesWindowPreferDarkColorScheme()) {
71
77
  setOSTheme('dark');
72
78
  }
73
79
 
@@ -1,8 +0,0 @@
1
- import type { DerivationPath } from '@rango-dev/wallets-shared';
2
- import { Namespace } from '@rango-dev/wallets-shared';
3
- export declare const namespaces: Record<Namespace, {
4
- mainBlockchain: string;
5
- title: string;
6
- derivationPaths?: DerivationPath[];
7
- }>;
8
- //# sourceMappingURL=namespaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"namespaces.d.ts","sourceRoot":"","sources":["../../src/constants/namespaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,SAAS,EACT;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;CAAE,CAuD9E,CAAC"}
@@ -1,62 +0,0 @@
1
- import type { DerivationPath } from '@rango-dev/wallets-shared';
2
-
3
- import { Namespace } from '@rango-dev/wallets-shared';
4
-
5
- export const namespaces: Record<
6
- Namespace,
7
- { mainBlockchain: string; title: string; derivationPaths?: DerivationPath[] }
8
- > = {
9
- [Namespace.Evm]: {
10
- mainBlockchain: 'ETH',
11
- title: 'Ethereum',
12
- derivationPaths: [
13
- {
14
- id: 'metamask',
15
- label: `Metamask (m/44'/60'/0'/0/index)`,
16
- generateDerivationPath: (index: string) => `44'/60'/0'/0/${index}`,
17
- },
18
- {
19
- id: 'ledgerLive',
20
- label: `LedgerLive (m/44'/60'/index'/0/0)`,
21
- generateDerivationPath: (index: string) => `44'/60'/${index}'/0/0`,
22
- },
23
- {
24
- id: 'legacy',
25
- label: `Legacy (m/44'/60'/0'/index)`,
26
- generateDerivationPath: (index: string) => `44'/60'/0'/${index}`,
27
- },
28
- ],
29
- },
30
- [Namespace.Solana]: {
31
- mainBlockchain: 'SOLANA',
32
- title: 'Solana',
33
- derivationPaths: [
34
- {
35
- id: `(m/44'/501'/index')`,
36
- label: `(m/44'/501'/index')`,
37
- generateDerivationPath: (index: string) => `44'/501'/${index}'`,
38
- },
39
- {
40
- id: `(m/44'/501'/0'/index)`,
41
- label: `(m/44'/501'/0'/index)`,
42
- generateDerivationPath: (index: string) => `44'/501'/0'/${index}`,
43
- },
44
- ],
45
- },
46
- [Namespace.Cosmos]: {
47
- mainBlockchain: 'COSMOS',
48
- title: 'Cosmos',
49
- },
50
- [Namespace.Utxo]: {
51
- mainBlockchain: 'BTC',
52
- title: 'Utxo',
53
- },
54
- [Namespace.Starknet]: {
55
- title: 'Starknet',
56
- mainBlockchain: 'STARKNET',
57
- },
58
- [Namespace.Tron]: {
59
- title: 'Tron',
60
- mainBlockchain: 'TRON',
61
- },
62
- };