@tonconnect/ui 2.0.1-beta.5 → 2.0.1-beta.7

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/lib/index.cjs CHANGED
@@ -6853,7 +6853,7 @@ const Notification = (props) => {
6853
6853
  }
6854
6854
  }));
6855
6855
  };
6856
- const LoaderIconStyled$1 = styled(LoaderIcon)`
6856
+ const LoaderIconStyled$2 = styled(LoaderIcon)`
6857
6857
  align-self: center;
6858
6858
  `;
6859
6859
  const ConfirmOperationNotification = (props) => {
@@ -6873,7 +6873,7 @@ const ConfirmOperationNotification = (props) => {
6873
6873
  return props.class;
6874
6874
  },
6875
6875
  get icon() {
6876
- return createComponent(LoaderIconStyled$1, {});
6876
+ return createComponent(LoaderIconStyled$2, {});
6877
6877
  },
6878
6878
  "data-tc-notification-confirm": "true",
6879
6879
  children: "Confirm operation in your wallet"
@@ -7053,7 +7053,7 @@ const DropdownButtonStyled = styled(AccountButtonStyled)`
7053
7053
  justify-content: center;
7054
7054
  background-color: ${(props) => props.theme.colors.background.primary};
7055
7055
  `;
7056
- styled(Button)`
7056
+ const LoaderButtonStyled$1 = styled(Button)`
7057
7057
  min-width: 148px;
7058
7058
  height: 40px;
7059
7059
 
@@ -7065,7 +7065,7 @@ styled(Button)`
7065
7065
  align-items: center;
7066
7066
  justify-content: center;
7067
7067
  `;
7068
- styled(LoaderIcon)`
7068
+ const LoaderIconStyled$1 = styled(LoaderIcon)`
7069
7069
  height: 18px;
7070
7070
  width: 18px;
7071
7071
  `;
@@ -7836,6 +7836,7 @@ const AccountButton = () => {
7836
7836
  const tonConnectUI = useContext(TonConnectUiContext);
7837
7837
  const [isOpened, setIsOpened] = createSignal(false);
7838
7838
  const [account, setAccount] = createSignal(connector.account);
7839
+ const [restoringProcess, setRestoringProcess] = createSignal(true);
7839
7840
  let dropDownRef;
7840
7841
  const [floating, setFloating] = createSignal();
7841
7842
  const [anchor, setAnchor] = createSignal();
@@ -7851,13 +7852,16 @@ const AccountButton = () => {
7851
7852
  }
7852
7853
  return "";
7853
7854
  };
7855
+ tonConnectUI.connectionRestored.then(() => setRestoringProcess(false));
7854
7856
  const unsubscribe = connector.onStatusChange((wallet) => {
7855
7857
  if (!wallet) {
7856
7858
  setIsOpened(false);
7857
7859
  setAccount(null);
7860
+ setRestoringProcess(false);
7858
7861
  return;
7859
7862
  }
7860
7863
  setAccount(wallet.account);
7864
+ setRestoringProcess(false);
7861
7865
  });
7862
7866
  const onClick = (e2) => {
7863
7867
  if (!account() || !isOpened()) {
@@ -7881,123 +7885,143 @@ const AccountButton = () => {
7881
7885
  get children() {
7882
7886
  return [createComponent(Show, {
7883
7887
  get when() {
7884
- return !account();
7888
+ return restoringProcess();
7885
7889
  },
7886
7890
  get children() {
7887
- return createComponent(AccountButtonStyled, {
7888
- onClick: () => tonConnectUI.openModal(),
7889
- "data-tc-connect-button": "true",
7890
- scale: "s",
7891
+ return createComponent(LoaderButtonStyled$1, {
7892
+ disabled: true,
7893
+ "data-tc-connect-button-loading": "true",
7891
7894
  get children() {
7892
- return [createComponent(TonIcon, {
7893
- get fill() {
7894
- return theme.colors.connectButton.foreground;
7895
- }
7896
- }), createComponent(Text, {
7897
- translationKey: "button.connectWallet",
7898
- fontSize: "15px",
7899
- lineHeight: "18px",
7900
- fontWeight: "590",
7901
- get color() {
7902
- return theme.colors.connectButton.foreground;
7903
- },
7904
- children: "Connect wallet"
7905
- })];
7895
+ return createComponent(LoaderIconStyled$1, {});
7906
7896
  }
7907
7897
  });
7908
7898
  }
7909
7899
  }), createComponent(Show, {
7910
7900
  get when() {
7911
- return account();
7901
+ return !restoringProcess();
7912
7902
  },
7913
7903
  get children() {
7914
- return createComponent(DropdownContainerStyled, {
7904
+ return [createComponent(Show, {
7905
+ get when() {
7906
+ return !account();
7907
+ },
7915
7908
  get children() {
7916
- return [createComponent(DropdownButtonStyled, {
7917
- onClick: () => setIsOpened((v) => !v),
7918
- ref: setAnchor,
7919
- "data-tc-dropdown-button": "true",
7909
+ return createComponent(AccountButtonStyled, {
7910
+ onClick: () => tonConnectUI.openModal(),
7911
+ "data-tc-connect-button": "true",
7920
7912
  scale: "s",
7921
7913
  get children() {
7922
- return [createComponent(Text, {
7914
+ return [createComponent(TonIcon, {
7915
+ get fill() {
7916
+ return theme.colors.connectButton.foreground;
7917
+ }
7918
+ }), createComponent(Text, {
7919
+ translationKey: "button.connectWallet",
7923
7920
  fontSize: "15px",
7924
- fontWeight: "590",
7925
7921
  lineHeight: "18px",
7926
- get children() {
7927
- return normalizedAddress();
7928
- }
7929
- }), createComponent(ArrowIcon, {
7930
- direction: "bottom"
7922
+ fontWeight: "590",
7923
+ get color() {
7924
+ return theme.colors.connectButton.foreground;
7925
+ },
7926
+ children: "Connect wallet"
7931
7927
  })];
7932
7928
  }
7933
- }), createComponent(Portal, {
7929
+ });
7930
+ }
7931
+ }), createComponent(Show, {
7932
+ get when() {
7933
+ return account();
7934
+ },
7935
+ get children() {
7936
+ return createComponent(DropdownContainerStyled, {
7934
7937
  get children() {
7935
- const _el$ = untrack(() => document.importNode(_tmpl$$3, true));
7936
- use(setFloating, _el$);
7937
- _el$.style.setProperty("z-index", "999");
7938
- _el$._$owner = getOwner();
7939
- insert(_el$, createComponent(Transition, {
7940
- onBeforeEnter: (el) => {
7941
- animate(el, [{
7942
- opacity: 0,
7943
- transform: "translateY(-8px)"
7944
- }, {
7945
- opacity: 1,
7946
- transform: "translateY(0)"
7947
- }], {
7948
- duration: 150
7949
- });
7950
- },
7951
- onExit: (el, done) => {
7952
- const a2 = animate(el, [{
7953
- opacity: 1,
7954
- transform: "translateY(0)"
7955
- }, {
7956
- opacity: 0,
7957
- transform: "translateY(-8px)"
7958
- }], {
7959
- duration: 150
7960
- });
7961
- a2.finished.then(done);
7962
- },
7938
+ return [createComponent(DropdownButtonStyled, {
7939
+ onClick: () => setIsOpened((v) => !v),
7940
+ ref: setAnchor,
7941
+ "data-tc-dropdown-button": "true",
7942
+ scale: "s",
7963
7943
  get children() {
7964
- return createComponent(Show, {
7965
- get when() {
7966
- return isOpened();
7944
+ return [createComponent(Text, {
7945
+ fontSize: "15px",
7946
+ fontWeight: "590",
7947
+ lineHeight: "18px",
7948
+ get children() {
7949
+ return normalizedAddress();
7950
+ }
7951
+ }), createComponent(ArrowIcon, {
7952
+ direction: "bottom"
7953
+ })];
7954
+ }
7955
+ }), createComponent(Portal, {
7956
+ get children() {
7957
+ const _el$ = untrack(() => document.importNode(_tmpl$$3, true));
7958
+ use(setFloating, _el$);
7959
+ _el$.style.setProperty("z-index", "999");
7960
+ _el$._$owner = getOwner();
7961
+ insert(_el$, createComponent(Transition, {
7962
+ onBeforeEnter: (el) => {
7963
+ animate(el, [{
7964
+ opacity: 0,
7965
+ transform: "translateY(-8px)"
7966
+ }, {
7967
+ opacity: 1,
7968
+ transform: "translateY(0)"
7969
+ }], {
7970
+ duration: 150
7971
+ });
7972
+ },
7973
+ onExit: (el, done) => {
7974
+ const a2 = animate(el, [{
7975
+ opacity: 1,
7976
+ transform: "translateY(0)"
7977
+ }, {
7978
+ opacity: 0,
7979
+ transform: "translateY(-8px)"
7980
+ }], {
7981
+ duration: 150
7982
+ });
7983
+ a2.finished.then(done);
7967
7984
  },
7968
7985
  get children() {
7969
- return createComponent(DropdownStyled, {
7970
- get hidden() {
7971
- return !isOpened();
7986
+ return createComponent(Show, {
7987
+ get when() {
7988
+ return isOpened();
7972
7989
  },
7973
- onClose: () => setIsOpened(false),
7974
- ref(r$) {
7975
- const _ref$ = dropDownRef;
7976
- typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
7990
+ get children() {
7991
+ return createComponent(DropdownStyled, {
7992
+ get hidden() {
7993
+ return !isOpened();
7994
+ },
7995
+ onClose: () => setIsOpened(false),
7996
+ ref(r$) {
7997
+ const _ref$ = dropDownRef;
7998
+ typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
7999
+ }
8000
+ });
7977
8001
  }
7978
8002
  });
7979
8003
  }
8004
+ }), null);
8005
+ insert(_el$, createComponent(NotificationsStyled, {}), null);
8006
+ createRenderEffect((_p$) => {
8007
+ var _a2, _b2;
8008
+ const _v$ = position.strategy, _v$2 = `${(_a2 = position.y) != null ? _a2 : 0}px`, _v$3 = `${(_b2 = position.x) != null ? _b2 : 0}px`;
8009
+ _v$ !== _p$._v$ && _el$.style.setProperty("position", _p$._v$ = _v$);
8010
+ _v$2 !== _p$._v$2 && _el$.style.setProperty("top", _p$._v$2 = _v$2);
8011
+ _v$3 !== _p$._v$3 && _el$.style.setProperty("left", _p$._v$3 = _v$3);
8012
+ return _p$;
8013
+ }, {
8014
+ _v$: void 0,
8015
+ _v$2: void 0,
8016
+ _v$3: void 0
7980
8017
  });
8018
+ return _el$;
7981
8019
  }
7982
- }), null);
7983
- insert(_el$, createComponent(NotificationsStyled, {}), null);
7984
- createRenderEffect((_p$) => {
7985
- var _a2, _b2;
7986
- const _v$ = position.strategy, _v$2 = `${(_a2 = position.y) != null ? _a2 : 0}px`, _v$3 = `${(_b2 = position.x) != null ? _b2 : 0}px`;
7987
- _v$ !== _p$._v$ && _el$.style.setProperty("position", _p$._v$ = _v$);
7988
- _v$2 !== _p$._v$2 && _el$.style.setProperty("top", _p$._v$2 = _v$2);
7989
- _v$3 !== _p$._v$3 && _el$.style.setProperty("left", _p$._v$3 = _v$3);
7990
- return _p$;
7991
- }, {
7992
- _v$: void 0,
7993
- _v$2: void 0,
7994
- _v$3: void 0
7995
- });
7996
- return _el$;
8020
+ })];
7997
8021
  }
7998
- })];
8022
+ });
7999
8023
  }
8000
- });
8024
+ })];
8001
8025
  }
8002
8026
  })];
8003
8027
  }