@aurora-is-near/intents-swap-widget 3.14.1 → 3.15.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 (101) hide show
  1. package/dist/{config-QBojKcju.js → config-DWuCYXia.js} +7 -7
  2. package/dist/{config-QBojKcju.js.map → config-DWuCYXia.js.map} +1 -1
  3. package/dist/config.js +1 -1
  4. package/dist/errors.js +1 -1
  5. package/dist/ext/alchemy/index.js +1 -1
  6. package/dist/ext/index.js +1 -1
  7. package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
  8. package/dist/features/BalanceRpcLoader/index.js +1 -1
  9. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
  10. package/dist/features/ChainsDropdown/AllNetworksIcon.js +1 -1
  11. package/dist/features/ChainsDropdown/AllNetworksIcon.js.map +1 -1
  12. package/dist/features/ChainsDropdown/index.js +2 -9
  13. package/dist/features/ChainsDropdown/index.js.map +1 -1
  14. package/dist/features/DepositMethodSwitcher.js +1 -1
  15. package/dist/features/ErrorBoundary.js +1 -1
  16. package/dist/features/ExternalDeposit.js +1 -1
  17. package/dist/features/SendAddress/index.js +1 -1
  18. package/dist/features/SendAddress/useNotification.js +1 -1
  19. package/dist/features/SubmitButton/index.js +1 -1
  20. package/dist/features/SuccessScreen/CheckIcon.js +1 -1
  21. package/dist/features/SuccessScreen/CheckIcon.js.map +1 -1
  22. package/dist/features/SuccessScreen/index.js +1 -1
  23. package/dist/features/SwapDirectionSwitcher.js +1 -1
  24. package/dist/features/SwapQuote/SwapQuote.js +1 -1
  25. package/dist/features/SwapQuote/index.js +1 -1
  26. package/dist/features/TokenInput/TokenInput.js +1 -1
  27. package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
  28. package/dist/features/TokenInput/TokenInputSource.js +1 -1
  29. package/dist/features/TokenInput/TokenInputTarget.js +1 -1
  30. package/dist/features/TokenInput/WalletBalance.js +1 -1
  31. package/dist/features/TokenInput/hooks/index.js +1 -1
  32. package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
  33. package/dist/features/TokenInput/index.js +1 -1
  34. package/dist/features/TokensList/TokenItem.js +1 -1
  35. package/dist/features/TokensList/TokensList.js +1 -1
  36. package/dist/features/TokensList/index.js +1 -1
  37. package/dist/features/TokensModal.js +1 -1
  38. package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
  39. package/dist/features/WalletCompatibilityCheck/index.js +1 -1
  40. package/dist/features/index.js +1 -1
  41. package/dist/hooks/index.js +1 -1
  42. package/dist/hooks/useAllTokens.js +1 -1
  43. package/dist/hooks/useChains.js +1 -1
  44. package/dist/hooks/useCompatibilityCheck.js +1 -1
  45. package/dist/hooks/useDefaultToken.js +1 -1
  46. package/dist/hooks/useExternalDepositStatus/index.js +1 -1
  47. package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
  48. package/dist/hooks/useIntentsBalance.js +1 -1
  49. package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
  50. package/dist/hooks/useMakeDepositAddress.js +1 -1
  51. package/dist/hooks/useMakeIntentsTransfer.js +1 -1
  52. package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
  53. package/dist/hooks/useMakeQuote.js +1 -1
  54. package/dist/hooks/useMakeQuoteTransfer.js +1 -1
  55. package/dist/hooks/useMakeTransfer.js +1 -1
  56. package/dist/hooks/useMergedBalance.js +1 -1
  57. package/dist/hooks/useSwitchChain.js +1 -1
  58. package/dist/hooks/useTheme.js +1 -1
  59. package/dist/hooks/useTokenInputPair.js +1 -1
  60. package/dist/hooks/useTokens.js +1 -1
  61. package/dist/hooks/useTokensFiltered.js +1 -1
  62. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/machine/effects/index.js +1 -1
  65. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  66. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  67. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  68. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  69. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  70. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  71. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  72. package/dist/machine/events/index.js +1 -1
  73. package/dist/machine/events/tokenSelect.js +1 -1
  74. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  75. package/dist/machine/events/validateInputs.js +1 -1
  76. package/dist/machine/index.js +1 -1
  77. package/dist/machine/snap.js +1 -1
  78. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  79. package/dist/machine/subscriptions/index.js +1 -1
  80. package/dist/styles.css +1 -1
  81. package/dist/theme/ThemeProvider.js +1 -1
  82. package/dist/theme/createColorPalette.d.ts +4 -1
  83. package/dist/theme/createColorPalette.js +26 -29
  84. package/dist/theme/createColorPalette.js.map +1 -1
  85. package/dist/types/theme.d.ts +1 -1
  86. package/dist/utils/intents/signers/near.js +1 -1
  87. package/dist/utils/intents/signers/privy.js +1 -1
  88. package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
  89. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
  90. package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
  91. package/dist/widgets/WidgetSwap/WidgetSwapContent.js +1 -1
  92. package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
  93. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
  94. package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
  95. package/package.json +1 -1
  96. package/src/features/ChainsDropdown/AllNetworksIcon.tsx +1 -1
  97. package/src/features/ChainsDropdown/index.tsx +1 -5
  98. package/src/features/SuccessScreen/CheckIcon.tsx +1 -1
  99. package/src/theme/ThemeProvider.tsx +13 -9
  100. package/src/theme/createColorPalette.ts +13 -17
  101. package/src/types/theme.ts +1 -1
@@ -2,12 +2,15 @@ import chroma from 'chroma-js';
2
2
  import { Hsluv } from 'hsluv';
3
3
  import { ColorPalette } from '../types/theme';
4
4
 
5
- const VALUE_STOP = 500;
6
-
7
5
  // All available stops (including 0 and 1000 for calculation)
8
6
  const ALL_STOPS = [
9
7
  0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950, 1000,
10
- ];
8
+ ] as const;
9
+
10
+ const LIGHTNESS_MIN = 0;
11
+ const LIGHTNESS_MAX = 100;
12
+
13
+ export type ColorStop = (typeof ALL_STOPS)[number];
11
14
 
12
15
  /**
13
16
  * Chroma-js based implementation for stable palette generation.
@@ -18,14 +21,8 @@ const ALL_STOPS = [
18
21
  export const createColorPalette = (
19
22
  baseColor: `#${string}`,
20
23
  mode: 'light' | 'dark',
24
+ colorStop: ColorStop,
21
25
  ): ColorPalette => {
22
- // 1. Create hue scale
23
- const valueStopIndex = ALL_STOPS.indexOf(VALUE_STOP);
24
-
25
- if (valueStopIndex === -1) {
26
- throw new Error(`Invalid valueStop: ${VALUE_STOP}`);
27
- }
28
-
29
26
  const hueScale = ALL_STOPS.map((stop) => {
30
27
  const tweakValue = 0;
31
28
 
@@ -49,9 +46,9 @@ export const createColorPalette = (
49
46
 
50
47
  // Create the three anchor points
51
48
  const distributionAnchors = [
52
- { stop: 0, tweak: 0 },
53
- { stop: VALUE_STOP, tweak: lightnessValue },
54
- { stop: 1000, tweak: 100 },
49
+ { stop: 0, tweak: LIGHTNESS_MAX },
50
+ { stop: colorStop, tweak: lightnessValue },
51
+ { stop: 1000, tweak: LIGHTNESS_MIN },
55
52
  ];
56
53
 
57
54
  // Interpolate for missing stops
@@ -67,7 +64,7 @@ export const createColorPalette = (
67
64
  let leftAnchor;
68
65
  let rightAnchor;
69
66
 
70
- if (stop < VALUE_STOP) {
67
+ if (stop < colorStop) {
71
68
  [leftAnchor, rightAnchor] = distributionAnchors;
72
69
  } else {
73
70
  [leftAnchor, rightAnchor] = distributionAnchors.slice(1);
@@ -88,7 +85,7 @@ export const createColorPalette = (
88
85
  });
89
86
 
90
87
  const hexColors = ALL_STOPS.map((stop, stopIndex): string => {
91
- if (stop === VALUE_STOP) {
88
+ if (stop === colorStop) {
92
89
  return baseColor.toUpperCase();
93
90
  }
94
91
 
@@ -126,7 +123,7 @@ export const createColorPalette = (
126
123
  return newColor.hex().toUpperCase();
127
124
  });
128
125
 
129
- const themeValues = mode === 'light' ? hexColors : [...hexColors].reverse();
126
+ const themeValues = mode === 'dark' ? hexColors : [...hexColors].reverse();
130
127
 
131
128
  const getStopValue = (index: number): string => {
132
129
  const value = themeValues[index];
@@ -150,6 +147,5 @@ export const createColorPalette = (
150
147
  800: getStopValue(9),
151
148
  900: getStopValue(10),
152
149
  950: getStopValue(11),
153
- 975: getStopValue(12),
154
150
  };
155
151
  };
@@ -10,6 +10,6 @@ export type Theme = {
10
10
  };
11
11
 
12
12
  export type ColorPalette = Record<
13
- 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950 | 975,
13
+ 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950,
14
14
  string
15
15
  >;