diff --git a/core/react/src/index.ts b/core/react/src/index.ts index 260cf48..39e5c82 100644 --- a/core/react/src/index.ts +++ b/core/react/src/index.ts @@ -15,7 +15,7 @@ export const store = create( })) ); -subStateChange(Emitter, store); +subStateChange(Emitter, store) export const useStatus = () => store(selectors.status); export const useChainId = () => store(selectors.chainId); diff --git a/examples/docs/index.html b/dev-examples/docs/index.html similarity index 100% rename from examples/docs/index.html rename to dev-examples/docs/index.html diff --git a/examples/docs/package.json b/dev-examples/docs/package.json similarity index 100% rename from examples/docs/package.json rename to dev-examples/docs/package.json diff --git a/examples/docs/postcss.config.js b/dev-examples/docs/postcss.config.js similarity index 100% rename from examples/docs/postcss.config.js rename to dev-examples/docs/postcss.config.js diff --git a/examples/docs/src/assets/cfx.svg b/dev-examples/docs/src/assets/cfx.svg similarity index 100% rename from examples/docs/src/assets/cfx.svg rename to dev-examples/docs/src/assets/cfx.svg diff --git a/examples/docs/src/assets/close.svg b/dev-examples/docs/src/assets/close.svg similarity index 100% rename from examples/docs/src/assets/close.svg rename to dev-examples/docs/src/assets/close.svg diff --git a/examples/docs/src/assets/code.svg b/dev-examples/docs/src/assets/code.svg similarity index 100% rename from examples/docs/src/assets/code.svg rename to dev-examples/docs/src/assets/code.svg diff --git a/examples/docs/src/assets/dark-mode.svg b/dev-examples/docs/src/assets/dark-mode.svg similarity index 100% rename from examples/docs/src/assets/dark-mode.svg rename to dev-examples/docs/src/assets/dark-mode.svg diff --git a/examples/docs/src/assets/fluentAdvance1.jpg b/dev-examples/docs/src/assets/fluentAdvance1.jpg similarity index 100% rename from examples/docs/src/assets/fluentAdvance1.jpg rename to dev-examples/docs/src/assets/fluentAdvance1.jpg diff --git a/examples/docs/src/assets/fluentAdvance2.jpg b/dev-examples/docs/src/assets/fluentAdvance2.jpg similarity index 100% rename from examples/docs/src/assets/fluentAdvance2.jpg rename to dev-examples/docs/src/assets/fluentAdvance2.jpg diff --git a/examples/docs/src/assets/light-mode.svg b/dev-examples/docs/src/assets/light-mode.svg similarity index 100% rename from examples/docs/src/assets/light-mode.svg rename to dev-examples/docs/src/assets/light-mode.svg diff --git a/examples/docs/src/assets/logo.svg b/dev-examples/docs/src/assets/logo.svg similarity index 100% rename from examples/docs/src/assets/logo.svg rename to dev-examples/docs/src/assets/logo.svg diff --git a/examples/docs/src/assets/metamask-fox.svg b/dev-examples/docs/src/assets/metamask-fox.svg similarity index 100% rename from examples/docs/src/assets/metamask-fox.svg rename to dev-examples/docs/src/assets/metamask-fox.svg diff --git a/examples/docs/src/assets/success.svg b/dev-examples/docs/src/assets/success.svg similarity index 100% rename from examples/docs/src/assets/success.svg rename to dev-examples/docs/src/assets/success.svg diff --git a/examples/docs/src/components/Animation/index.tsx b/dev-examples/docs/src/components/Animation/index.tsx similarity index 100% rename from examples/docs/src/components/Animation/index.tsx rename to dev-examples/docs/src/components/Animation/index.tsx diff --git a/examples/docs/src/components/Code/index.css b/dev-examples/docs/src/components/Code/index.css similarity index 100% rename from examples/docs/src/components/Code/index.css rename to dev-examples/docs/src/components/Code/index.css diff --git a/examples/docs/src/components/Code/index.tsx b/dev-examples/docs/src/components/Code/index.tsx similarity index 100% rename from examples/docs/src/components/Code/index.tsx rename to dev-examples/docs/src/components/Code/index.tsx diff --git a/examples/docs/src/components/List/index.tsx b/dev-examples/docs/src/components/List/index.tsx similarity index 100% rename from examples/docs/src/components/List/index.tsx rename to dev-examples/docs/src/components/List/index.tsx diff --git a/examples/docs/src/components/Mask/index.tsx b/dev-examples/docs/src/components/Mask/index.tsx similarity index 100% rename from examples/docs/src/components/Mask/index.tsx rename to dev-examples/docs/src/components/Mask/index.tsx diff --git a/examples/docs/src/components/Popup/Popup.tsx b/dev-examples/docs/src/components/Popup/Popup.tsx similarity index 100% rename from examples/docs/src/components/Popup/Popup.tsx rename to dev-examples/docs/src/components/Popup/Popup.tsx diff --git a/examples/docs/src/components/Popup/index.tsx b/dev-examples/docs/src/components/Popup/index.tsx similarity index 100% rename from examples/docs/src/components/Popup/index.tsx rename to dev-examples/docs/src/components/Popup/index.tsx diff --git a/examples/docs/src/components/tools/Modal/index.css b/dev-examples/docs/src/components/tools/Modal/index.css similarity index 100% rename from examples/docs/src/components/tools/Modal/index.css rename to dev-examples/docs/src/components/tools/Modal/index.css diff --git a/examples/docs/src/components/tools/Modal/index.tsx b/dev-examples/docs/src/components/tools/Modal/index.tsx similarity index 100% rename from examples/docs/src/components/tools/Modal/index.tsx rename to dev-examples/docs/src/components/tools/Modal/index.tsx diff --git a/examples/docs/src/components/tools/Toast/index.tsx b/dev-examples/docs/src/components/tools/Toast/index.tsx similarity index 100% rename from examples/docs/src/components/tools/Toast/index.tsx rename to dev-examples/docs/src/components/tools/Toast/index.tsx diff --git a/examples/docs/src/favicon.ico b/dev-examples/docs/src/favicon.ico similarity index 100% rename from examples/docs/src/favicon.ico rename to dev-examples/docs/src/favicon.ico diff --git a/examples/docs/src/hooks/useClickOutside.ts b/dev-examples/docs/src/hooks/useClickOutside.ts similarity index 100% rename from examples/docs/src/hooks/useClickOutside.ts rename to dev-examples/docs/src/hooks/useClickOutside.ts diff --git a/examples/docs/src/hooks/useCurrentLib.ts b/dev-examples/docs/src/hooks/useCurrentLib.ts similarity index 100% rename from examples/docs/src/hooks/useCurrentLib.ts rename to dev-examples/docs/src/hooks/useCurrentLib.ts diff --git a/examples/docs/src/hooks/useI18n.ts b/dev-examples/docs/src/hooks/useI18n.ts similarity index 100% rename from examples/docs/src/hooks/useI18n.ts rename to dev-examples/docs/src/hooks/useI18n.ts diff --git a/examples/docs/src/hooks/useMeasure.ts b/dev-examples/docs/src/hooks/useMeasure.ts similarity index 100% rename from examples/docs/src/hooks/useMeasure.ts rename to dev-examples/docs/src/hooks/useMeasure.ts diff --git a/examples/docs/src/hooks/useMode.ts b/dev-examples/docs/src/hooks/useMode.ts similarity index 100% rename from examples/docs/src/hooks/useMode.ts rename to dev-examples/docs/src/hooks/useMode.ts diff --git a/examples/docs/src/index.css b/dev-examples/docs/src/index.css similarity index 100% rename from examples/docs/src/index.css rename to dev-examples/docs/src/index.css diff --git a/examples/docs/src/main.tsx b/dev-examples/docs/src/main.tsx similarity index 100% rename from examples/docs/src/main.tsx rename to dev-examples/docs/src/main.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Basic/BasicUsage.tsx b/dev-examples/docs/src/pages/API/Catalogue/Basic/BasicUsage.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Basic/BasicUsage.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Basic/BasicUsage.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Basic/Install.tsx b/dev-examples/docs/src/pages/API/Catalogue/Basic/Install.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Basic/Install.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Basic/Install.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Basic/index.tsx b/dev-examples/docs/src/pages/API/Catalogue/Basic/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Basic/index.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Basic/index.tsx diff --git a/examples/docs/src/pages/API/Catalogue/FAQ/FluentAndMetaMask.tsx b/dev-examples/docs/src/pages/API/Catalogue/FAQ/FluentAndMetaMask.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/FAQ/FluentAndMetaMask.tsx rename to dev-examples/docs/src/pages/API/Catalogue/FAQ/FluentAndMetaMask.tsx diff --git a/examples/docs/src/pages/API/Catalogue/FAQ/FluentHostMetaMask.tsx b/dev-examples/docs/src/pages/API/Catalogue/FAQ/FluentHostMetaMask.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/FAQ/FluentHostMetaMask.tsx rename to dev-examples/docs/src/pages/API/Catalogue/FAQ/FluentHostMetaMask.tsx diff --git a/examples/docs/src/pages/API/Catalogue/FAQ/OnlyFluent.tsx b/dev-examples/docs/src/pages/API/Catalogue/FAQ/OnlyFluent.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/FAQ/OnlyFluent.tsx rename to dev-examples/docs/src/pages/API/Catalogue/FAQ/OnlyFluent.tsx diff --git a/examples/docs/src/pages/API/Catalogue/FAQ/index.tsx b/dev-examples/docs/src/pages/API/Catalogue/FAQ/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/FAQ/index.tsx rename to dev-examples/docs/src/pages/API/Catalogue/FAQ/index.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/AddChain.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/AddChain.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/AddChain.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/AddChain.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/Connect.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/Connect.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/Connect.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/Connect.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/PersonalSign.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/PersonalSign.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/PersonalSign.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/PersonalSign.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/SendTransaction.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/SendTransaction.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/SendTransaction.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/SendTransaction.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/SwitchChain.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/SwitchChain.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/SwitchChain.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/SwitchChain.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/TypedSign.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/TypedSign.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/TypedSign.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/TypedSign.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/WatchAsset.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/WatchAsset.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/WatchAsset.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/WatchAsset.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Function/index.tsx b/dev-examples/docs/src/pages/API/Catalogue/Function/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Function/index.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Function/index.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Hooks/UseAccount.tsx b/dev-examples/docs/src/pages/API/Catalogue/Hooks/UseAccount.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Hooks/UseAccount.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Hooks/UseAccount.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Hooks/UseBalance.tsx b/dev-examples/docs/src/pages/API/Catalogue/Hooks/UseBalance.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Hooks/UseBalance.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Hooks/UseBalance.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Hooks/UseChainId.tsx b/dev-examples/docs/src/pages/API/Catalogue/Hooks/UseChainId.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Hooks/UseChainId.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Hooks/UseChainId.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Hooks/UseStatus.tsx b/dev-examples/docs/src/pages/API/Catalogue/Hooks/UseStatus.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Hooks/UseStatus.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Hooks/UseStatus.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Hooks/index.tsx b/dev-examples/docs/src/pages/API/Catalogue/Hooks/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Hooks/index.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Hooks/index.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Others/CompleteDetectApi.tsx b/dev-examples/docs/src/pages/API/Catalogue/Others/CompleteDetectApi.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Others/CompleteDetectApi.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Others/CompleteDetectApi.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Others/ProviderApi.tsx b/dev-examples/docs/src/pages/API/Catalogue/Others/ProviderApi.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Others/ProviderApi.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Others/ProviderApi.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Others/index.tsx b/dev-examples/docs/src/pages/API/Catalogue/Others/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Others/index.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Others/index.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Utils/TrackBalanceChangeOnce-Util.tsx b/dev-examples/docs/src/pages/API/Catalogue/Utils/TrackBalanceChangeOnce-Util.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Utils/TrackBalanceChangeOnce-Util.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Utils/TrackBalanceChangeOnce-Util.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Utils/Unit.tsx b/dev-examples/docs/src/pages/API/Catalogue/Utils/Unit.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Utils/Unit.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Utils/Unit.tsx diff --git a/examples/docs/src/pages/API/Catalogue/Utils/index.tsx b/dev-examples/docs/src/pages/API/Catalogue/Utils/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/Utils/index.tsx rename to dev-examples/docs/src/pages/API/Catalogue/Utils/index.tsx diff --git a/examples/docs/src/pages/API/Catalogue/index.css b/dev-examples/docs/src/pages/API/Catalogue/index.css similarity index 100% rename from examples/docs/src/pages/API/Catalogue/index.css rename to dev-examples/docs/src/pages/API/Catalogue/index.css diff --git a/examples/docs/src/pages/API/Catalogue/index.tsx b/dev-examples/docs/src/pages/API/Catalogue/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Catalogue/index.tsx rename to dev-examples/docs/src/pages/API/Catalogue/index.tsx diff --git a/examples/docs/src/pages/API/Menu/index.tsx b/dev-examples/docs/src/pages/API/Menu/index.tsx similarity index 100% rename from examples/docs/src/pages/API/Menu/index.tsx rename to dev-examples/docs/src/pages/API/Menu/index.tsx diff --git a/examples/docs/src/pages/API/index.tsx b/dev-examples/docs/src/pages/API/index.tsx similarity index 100% rename from examples/docs/src/pages/API/index.tsx rename to dev-examples/docs/src/pages/API/index.tsx diff --git a/examples/docs/src/pages/Demo/AddSwitch/index.tsx b/dev-examples/docs/src/pages/Demo/AddSwitch/index.tsx similarity index 100% rename from examples/docs/src/pages/Demo/AddSwitch/index.tsx rename to dev-examples/docs/src/pages/Demo/AddSwitch/index.tsx diff --git a/examples/docs/src/pages/Demo/Connect/index.module.css b/dev-examples/docs/src/pages/Demo/Connect/index.module.css similarity index 100% rename from examples/docs/src/pages/Demo/Connect/index.module.css rename to dev-examples/docs/src/pages/Demo/Connect/index.module.css diff --git a/examples/docs/src/pages/Demo/Connect/index.tsx b/dev-examples/docs/src/pages/Demo/Connect/index.tsx similarity index 100% rename from examples/docs/src/pages/Demo/Connect/index.tsx rename to dev-examples/docs/src/pages/Demo/Connect/index.tsx diff --git a/examples/docs/src/pages/Demo/ConnectBoth/WalletCard.tsx b/dev-examples/docs/src/pages/Demo/ConnectBoth/WalletCard.tsx similarity index 100% rename from examples/docs/src/pages/Demo/ConnectBoth/WalletCard.tsx rename to dev-examples/docs/src/pages/Demo/ConnectBoth/WalletCard.tsx diff --git a/examples/docs/src/pages/Demo/ConnectBoth/index.tsx b/dev-examples/docs/src/pages/Demo/ConnectBoth/index.tsx similarity index 100% rename from examples/docs/src/pages/Demo/ConnectBoth/index.tsx rename to dev-examples/docs/src/pages/Demo/ConnectBoth/index.tsx diff --git a/examples/docs/src/pages/Demo/ConnectSwitch/index.tsx b/dev-examples/docs/src/pages/Demo/ConnectSwitch/index.tsx similarity index 100% rename from examples/docs/src/pages/Demo/ConnectSwitch/index.tsx rename to dev-examples/docs/src/pages/Demo/ConnectSwitch/index.tsx diff --git a/examples/docs/src/pages/Demo/SendTransaction/index.tsx b/dev-examples/docs/src/pages/Demo/SendTransaction/index.tsx similarity index 100% rename from examples/docs/src/pages/Demo/SendTransaction/index.tsx rename to dev-examples/docs/src/pages/Demo/SendTransaction/index.tsx diff --git a/examples/docs/src/pages/Demo/Sign/index.tsx b/dev-examples/docs/src/pages/Demo/Sign/index.tsx similarity index 100% rename from examples/docs/src/pages/Demo/Sign/index.tsx rename to dev-examples/docs/src/pages/Demo/Sign/index.tsx diff --git a/examples/docs/src/pages/Demo/index.tsx b/dev-examples/docs/src/pages/Demo/index.tsx similarity index 100% rename from examples/docs/src/pages/Demo/index.tsx rename to dev-examples/docs/src/pages/Demo/index.tsx diff --git a/examples/docs/src/pages/Guide/index.css b/dev-examples/docs/src/pages/Guide/index.css similarity index 100% rename from examples/docs/src/pages/Guide/index.css rename to dev-examples/docs/src/pages/Guide/index.css diff --git a/examples/docs/src/pages/Guide/index.tsx b/dev-examples/docs/src/pages/Guide/index.tsx similarity index 100% rename from examples/docs/src/pages/Guide/index.tsx rename to dev-examples/docs/src/pages/Guide/index.tsx diff --git a/examples/docs/src/pages/Navbar/index.tsx b/dev-examples/docs/src/pages/Navbar/index.tsx similarity index 100% rename from examples/docs/src/pages/Navbar/index.tsx rename to dev-examples/docs/src/pages/Navbar/index.tsx diff --git a/examples/docs/src/router/index.tsx b/dev-examples/docs/src/router/index.tsx similarity index 100% rename from examples/docs/src/router/index.tsx rename to dev-examples/docs/src/router/index.tsx diff --git a/examples/docs/src/utils/body-scroll-lock/index.ts b/dev-examples/docs/src/utils/body-scroll-lock/index.ts similarity index 100% rename from examples/docs/src/utils/body-scroll-lock/index.ts rename to dev-examples/docs/src/utils/body-scroll-lock/index.ts diff --git a/examples/docs/src/utils/body-scroll-lock/util.ts b/dev-examples/docs/src/utils/body-scroll-lock/util.ts similarity index 100% rename from examples/docs/src/utils/body-scroll-lock/util.ts rename to dev-examples/docs/src/utils/body-scroll-lock/util.ts diff --git a/examples/docs/src/utils/isDOMElement.ts b/dev-examples/docs/src/utils/isDOMElement.ts similarity index 100% rename from examples/docs/src/utils/isDOMElement.ts rename to dev-examples/docs/src/utils/isDOMElement.ts diff --git a/examples/docs/src/utils/runAsync.ts b/dev-examples/docs/src/utils/runAsync.ts similarity index 100% rename from examples/docs/src/utils/runAsync.ts rename to dev-examples/docs/src/utils/runAsync.ts diff --git a/examples/docs/src/vite-env.d.ts b/dev-examples/docs/src/vite-env.d.ts similarity index 100% rename from examples/docs/src/vite-env.d.ts rename to dev-examples/docs/src/vite-env.d.ts diff --git a/examples/docs/tailwind.config.js b/dev-examples/docs/tailwind.config.js similarity index 100% rename from examples/docs/tailwind.config.js rename to dev-examples/docs/tailwind.config.js diff --git a/examples/docs/tsconfig.json b/dev-examples/docs/tsconfig.json similarity index 100% rename from examples/docs/tsconfig.json rename to dev-examples/docs/tsconfig.json diff --git a/examples/docs/tsconfig.node.json b/dev-examples/docs/tsconfig.node.json similarity index 100% rename from examples/docs/tsconfig.node.json rename to dev-examples/docs/tsconfig.node.json diff --git a/examples/docs/vite.config.ts b/dev-examples/docs/vite.config.ts similarity index 100% rename from examples/docs/vite.config.ts rename to dev-examples/docs/vite.config.ts diff --git a/examples/example-react/index.html b/dev-examples/example-react/index.html similarity index 100% rename from examples/example-react/index.html rename to dev-examples/example-react/index.html diff --git a/examples/example-react/package.json b/dev-examples/example-react/package.json similarity index 100% rename from examples/example-react/package.json rename to dev-examples/example-react/package.json diff --git a/examples/example-react/src/App.tsx b/dev-examples/example-react/src/App.tsx similarity index 100% rename from examples/example-react/src/App.tsx rename to dev-examples/example-react/src/App.tsx diff --git a/examples/example-react/src/main.tsx b/dev-examples/example-react/src/main.tsx similarity index 100% rename from examples/example-react/src/main.tsx rename to dev-examples/example-react/src/main.tsx diff --git a/examples/example-react/src/vite-env.d.ts b/dev-examples/example-react/src/vite-env.d.ts similarity index 100% rename from examples/example-react/src/vite-env.d.ts rename to dev-examples/example-react/src/vite-env.d.ts diff --git a/examples/example-react/tsconfig.json b/dev-examples/example-react/tsconfig.json similarity index 100% rename from examples/example-react/tsconfig.json rename to dev-examples/example-react/tsconfig.json diff --git a/examples/example-react/tsconfig.node.json b/dev-examples/example-react/tsconfig.node.json similarity index 100% rename from examples/example-react/tsconfig.node.json rename to dev-examples/example-react/tsconfig.node.json diff --git a/examples/example-react/vite.config.ts b/dev-examples/example-react/vite.config.ts similarity index 100% rename from examples/example-react/vite.config.ts rename to dev-examples/example-react/vite.config.ts diff --git a/examples/example-svelte/README.md b/dev-examples/example-svelte/README.md similarity index 100% rename from examples/example-svelte/README.md rename to dev-examples/example-svelte/README.md diff --git a/examples/example-svelte/index.html b/dev-examples/example-svelte/index.html similarity index 100% rename from examples/example-svelte/index.html rename to dev-examples/example-svelte/index.html diff --git a/examples/example-svelte/package.json b/dev-examples/example-svelte/package.json similarity index 100% rename from examples/example-svelte/package.json rename to dev-examples/example-svelte/package.json diff --git a/examples/example-svelte/public/favicon.ico b/dev-examples/example-svelte/public/favicon.ico similarity index 100% rename from examples/example-svelte/public/favicon.ico rename to dev-examples/example-svelte/public/favicon.ico diff --git a/examples/example-svelte/src/App.svelte b/dev-examples/example-svelte/src/App.svelte similarity index 100% rename from examples/example-svelte/src/App.svelte rename to dev-examples/example-svelte/src/App.svelte diff --git a/examples/example-svelte/src/assets/svelte.png b/dev-examples/example-svelte/src/assets/svelte.png similarity index 100% rename from examples/example-svelte/src/assets/svelte.png rename to dev-examples/example-svelte/src/assets/svelte.png diff --git a/examples/example-svelte/src/lib/Counter.svelte b/dev-examples/example-svelte/src/lib/Counter.svelte similarity index 100% rename from examples/example-svelte/src/lib/Counter.svelte rename to dev-examples/example-svelte/src/lib/Counter.svelte diff --git a/examples/example-svelte/src/main.ts b/dev-examples/example-svelte/src/main.ts similarity index 100% rename from examples/example-svelte/src/main.ts rename to dev-examples/example-svelte/src/main.ts diff --git a/examples/example-svelte/src/vite-env.d.ts b/dev-examples/example-svelte/src/vite-env.d.ts similarity index 100% rename from examples/example-svelte/src/vite-env.d.ts rename to dev-examples/example-svelte/src/vite-env.d.ts diff --git a/examples/example-svelte/svelte.config.js b/dev-examples/example-svelte/svelte.config.js similarity index 100% rename from examples/example-svelte/svelte.config.js rename to dev-examples/example-svelte/svelte.config.js diff --git a/examples/example-svelte/tsconfig.json b/dev-examples/example-svelte/tsconfig.json similarity index 100% rename from examples/example-svelte/tsconfig.json rename to dev-examples/example-svelte/tsconfig.json diff --git a/examples/example-svelte/tsconfig.node.json b/dev-examples/example-svelte/tsconfig.node.json similarity index 100% rename from examples/example-svelte/tsconfig.node.json rename to dev-examples/example-svelte/tsconfig.node.json diff --git a/examples/example-svelte/vite.config.ts b/dev-examples/example-svelte/vite.config.ts similarity index 100% rename from examples/example-svelte/vite.config.ts rename to dev-examples/example-svelte/vite.config.ts diff --git a/examples/example-vue3/README.md b/dev-examples/example-vue3/README.md similarity index 100% rename from examples/example-vue3/README.md rename to dev-examples/example-vue3/README.md diff --git a/examples/example-vue3/index.html b/dev-examples/example-vue3/index.html similarity index 100% rename from examples/example-vue3/index.html rename to dev-examples/example-vue3/index.html diff --git a/examples/example-vue3/package.json b/dev-examples/example-vue3/package.json similarity index 100% rename from examples/example-vue3/package.json rename to dev-examples/example-vue3/package.json diff --git a/examples/example-vue3/public/favicon.ico b/dev-examples/example-vue3/public/favicon.ico similarity index 100% rename from examples/example-vue3/public/favicon.ico rename to dev-examples/example-vue3/public/favicon.ico diff --git a/examples/example-vue3/src/App.vue b/dev-examples/example-vue3/src/App.vue similarity index 100% rename from examples/example-vue3/src/App.vue rename to dev-examples/example-vue3/src/App.vue diff --git a/examples/example-vue3/src/env.d.ts b/dev-examples/example-vue3/src/env.d.ts similarity index 100% rename from examples/example-vue3/src/env.d.ts rename to dev-examples/example-vue3/src/env.d.ts diff --git a/examples/example-vue3/src/main.ts b/dev-examples/example-vue3/src/main.ts similarity index 100% rename from examples/example-vue3/src/main.ts rename to dev-examples/example-vue3/src/main.ts diff --git a/examples/example-vue3/tsconfig.json b/dev-examples/example-vue3/tsconfig.json similarity index 100% rename from examples/example-vue3/tsconfig.json rename to dev-examples/example-vue3/tsconfig.json diff --git a/examples/example-vue3/tsconfig.node.json b/dev-examples/example-vue3/tsconfig.node.json similarity index 100% rename from examples/example-vue3/tsconfig.node.json rename to dev-examples/example-vue3/tsconfig.node.json diff --git a/examples/example-vue3/vite.config.ts b/dev-examples/example-vue3/vite.config.ts similarity index 100% rename from examples/example-vue3/vite.config.ts rename to dev-examples/example-vue3/vite.config.ts diff --git a/examples/ReactDemo/.eslintrc.cjs b/examples/ReactDemo/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/examples/ReactDemo/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/examples/ReactDemo/.gitignore b/examples/ReactDemo/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/examples/ReactDemo/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/examples/ReactDemo/README.md b/examples/ReactDemo/README.md new file mode 100644 index 0000000..0d6babe --- /dev/null +++ b/examples/ReactDemo/README.md @@ -0,0 +1,30 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: + +- Configure the top-level `parserOptions` property like this: + +```js +export default { + // other rules... + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, + }, +} +``` + +- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` +- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list diff --git a/examples/ReactDemo/index.html b/examples/ReactDemo/index.html new file mode 100644 index 0000000..5a8c2ec --- /dev/null +++ b/examples/ReactDemo/index.html @@ -0,0 +1,13 @@ + + + + + + + ReactDemo + + +
+ + + diff --git a/examples/ReactDemo/package.json b/examples/ReactDemo/package.json new file mode 100644 index 0000000..9bc947f --- /dev/null +++ b/examples/ReactDemo/package.json @@ -0,0 +1,31 @@ +{ + "name": "reactdemo", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "@cfxjs/use-wallet-react": "^0.0.2-6", + "decimal.js": "^10.4.3", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "zustand": "^4.5.2" + }, + "devDependencies": { + "@types/react": "^18.3.2", + "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^7.8.0", + "@typescript-eslint/parser": "^7.8.0", + "@vitejs/plugin-react": "^4.2.1", + "eslint": "^8.57.0", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.7", + "typescript": "^5.4.5", + "vite": "^5.2.11" + } +} diff --git a/examples/ReactDemo/src/App.tsx b/examples/ReactDemo/src/App.tsx new file mode 100644 index 0000000..67bfa27 --- /dev/null +++ b/examples/ReactDemo/src/App.tsx @@ -0,0 +1,142 @@ +import React, { memo, useCallback } from 'react'; +import { useStatus, useAccount, useChainId, useBalance, connect, Unit, sendTransaction, typedSign, switchChain } from '@cfxjs/use-wallet-react/ethereum/Fluent'; +// import { useStatus, useAccount, useChainId, useBalance, connect, Unit, sendTransaction, typedSign } from '@cfxjs/use-wallet-react/ethereum'; + +enum TargetChains { + eSpaceMainnet = '1030', + eSpaceTestnet = '71', +} + +const TargetChain = TargetChains.eSpaceMainnet; + +const BasicUsage: React.FC = () => { + const status = useStatus(); + + return ( +
+ {status !== 'in-detecting' && status !== 'active' && ( + + )} + {status === 'active' && } +
+ ); +}; + +const WalletInfo: React.FC = memo(() => { + const account = useAccount(); + const chainId = useChainId(); + const balance = useBalance(); + const isChainMatch = chainId === TargetChain; + + // Send 1 native token to self (connected account) + const handleClickSendTransaction = useCallback(async () => { + // For ts Type Guards. when status turn to 'active', account|chainId|balance must be exist. + if (!account) return; + + try { + const TxnHash = await sendTransaction({ + to: account, + value: Unit.fromStandardUnit('1').toHexMinUnit(), + }); + console.log(TxnHash); + } catch (err) { + console.error(err); + } + }, [account]); + + const handleTypedSign = useCallback(async () => { + if (!account) return; + try { + const hash = await typedSign({ + domain: { + // This defines the network, in this case, Mainnet. + chainId: 1, + // Give a user-friendly name to the specific contract you're signing for. + name: 'Ether Mail', + // Add a verifying contract to make sure you're establishing contracts with the proper entity. + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + // This identifies the latest version. + version: '1', + }, + + // This defines the message you're proposing the user to sign, is dapp-specific, and contains + // anything you want. There are no required fields. Be as explicit as possible when building out + // the message schema. + message: { + contents: 'Hello, Bob!', + attachedMoneyInEth: 4.2, + from: { + name: 'Cow', + wallets: ['0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF'], + }, + to: [ + { + name: 'Bob', + wallets: [ + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', + ], + }, + ], + }, + // This refers to the keys of the following types object. + primaryType: 'Mail', + types: { + // This refers to the domain the contract is hosted on. + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + // Not an EIP712Domain definition. + Group: [ + { name: 'name', type: 'string' }, + { name: 'members', type: 'Person[]' }, + ], + // Refer to primaryType. + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + // Not an EIP712Domain definition. + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }); + console.log(hash); + } catch (err) { + console.log(err); + } + }, [account]); + + return ( + <> + {isChainMatch && ( + <> +

account: {account}

+

chainId: {chainId}

+

balance: {`${balance?.toDecimalStandardUnit()} CFX`}

+ + + + )} + {!isChainMatch && ( + <> +

Current Chain is not Target Chain -- {TargetChain === TargetChains.eSpaceMainnet ? 'eSpaceMainnet' : 'eSpaceTestnet'}

+ + + )} + + ); +}); + +export default BasicUsage; diff --git a/examples/ReactDemo/src/main.tsx b/examples/ReactDemo/src/main.tsx new file mode 100644 index 0000000..e63eef4 --- /dev/null +++ b/examples/ReactDemo/src/main.tsx @@ -0,0 +1,9 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.tsx' + +ReactDOM.createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/examples/ReactDemo/src/vite-env.d.ts b/examples/ReactDemo/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/examples/ReactDemo/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/ReactDemo/tsconfig.json b/examples/ReactDemo/tsconfig.json new file mode 100644 index 0000000..a7fc6fb --- /dev/null +++ b/examples/ReactDemo/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/examples/ReactDemo/tsconfig.node.json b/examples/ReactDemo/tsconfig.node.json new file mode 100644 index 0000000..97ede7e --- /dev/null +++ b/examples/ReactDemo/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true + }, + "include": ["vite.config.ts"] +} diff --git a/examples/ReactDemo/vite.config.ts b/examples/ReactDemo/vite.config.ts new file mode 100644 index 0000000..5a33944 --- /dev/null +++ b/examples/ReactDemo/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/examples/VanillaDemo/.gitignore b/examples/VanillaDemo/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/examples/VanillaDemo/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/examples/VanillaDemo/index.html b/examples/VanillaDemo/index.html new file mode 100644 index 0000000..8697b5c --- /dev/null +++ b/examples/VanillaDemo/index.html @@ -0,0 +1,13 @@ + + + + + + + VanillaDemo + + +
+ + + diff --git a/examples/VanillaDemo/package.json b/examples/VanillaDemo/package.json new file mode 100644 index 0000000..daa209e --- /dev/null +++ b/examples/VanillaDemo/package.json @@ -0,0 +1,20 @@ +{ + "name": "vanillademo", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@cfxjs/use-wallet-react": "^0.0.2-6", + "decimal.js": "^10.4.3", + "zustand": "^4.5.2" + }, + "devDependencies": { + "typescript": "^5.4.5", + "vite": "^5.2.11" + } +} diff --git a/examples/VanillaDemo/src/main.ts b/examples/VanillaDemo/src/main.ts new file mode 100644 index 0000000..08ef4ef --- /dev/null +++ b/examples/VanillaDemo/src/main.ts @@ -0,0 +1,139 @@ +import { store, connect, Unit, sendTransaction, typedSign, switchChain } from '@cfxjs/use-wallet-react/ethereum/Fluent'; +// import { useStatus, useAccount, useChainId, useBalance, connect, Unit, sendTransaction, typedSign } from '@cfxjs/use-wallet-react/ethereum'; + +enum TargetChains { + eSpaceMainnet = '1030', + eSpaceTestnet = '71', +} + +const TargetChain = TargetChains.eSpaceMainnet; + +let unsubWallState: ReturnType<(typeof store)['subscribe']> | null = null; +store.subscribe( + (state) => state.status, + (status) => { + if (status !== 'in-detecting' && status !== 'active') { + unsubWallState?.(); + document.querySelector('#app')!.innerHTML = ` + + `; + const connectBtn = document.querySelector('#connect')!; + connectBtn.disabled = status !== 'not-active'; + connectBtn!.innerText = status === 'not-installed' ? 'Fluent Not Install' : status === 'not-active' ? 'Connect Fluent' : 'connecting...'; + } else if (status === 'active') { + unsubWallState?.(); + unsubWallState = store.subscribe( + (state) => [state.accounts, state.chainId, state.balance] as const, + ([accounts, chainId, balance]) => { + const isChainMatch = chainId === TargetChain; + if (isChainMatch) { + const account = accounts?.[0]; + document.querySelector('#app')!.innerHTML = ` +

account: ${account}

+

chainId: ${chainId}

+

balance: ${balance?.toDecimalStandardUnit()} CFX

+ + + `; + const sendTransactionBtn = document.querySelector('#sendTransaction')!; + const typedSignBtn = document.querySelector('#typedSign')!; + sendTransactionBtn.addEventListener('click', async () => { + if (!account) return; + try { + const TxnHash = await sendTransaction({ + to: account, + value: Unit.fromStandardUnit('1').toHexMinUnit(), + }); + console.log(TxnHash); + } catch (err) { + console.error(err); + } + }); + typedSignBtn.addEventListener('click', async () => { + if (!account) return; + try { + const hash = await typedSign({ + domain: { + // This defines the network, in this case, Mainnet. + chainId: 1, + // Give a user-friendly name to the specific contract you're signing for. + name: 'Ether Mail', + // Add a verifying contract to make sure you're establishing contracts with the proper entity. + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + // This identifies the latest version. + version: '1', + }, + + // This defines the message you're proposing the user to sign, is dapp-specific, and contains + // anything you want. There are no required fields. Be as explicit as possible when building out + // the message schema. + message: { + contents: 'Hello, Bob!', + attachedMoneyInEth: 4.2, + from: { + name: 'Cow', + wallets: ['0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF'], + }, + to: [ + { + name: 'Bob', + wallets: [ + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', + ], + }, + ], + }, + // This refers to the keys of the following types object. + primaryType: 'Mail', + types: { + // This refers to the domain the contract is hosted on. + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + // Not an EIP712Domain definition. + Group: [ + { name: 'name', type: 'string' }, + { name: 'members', type: 'Person[]' }, + ], + // Refer to primaryType. + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + // Not an EIP712Domain definition. + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }); + console.log(hash); + } catch (err) { + console.log(err); + } + }); + } else { + document.querySelector('#app')!.innerHTML = ` +

Current Chain is not Target Chain -- ${TargetChain === TargetChains.eSpaceMainnet ? 'eSpaceMainnet' : 'eSpaceTestnet'}

+ + `; + const switchBtn = document.querySelector('#switch')!; + switchBtn.addEventListener('click', () => switchChain(`0x${(+TargetChain).toString(16)}`)); + } + }, + { + equalityFn: ([accountsA, chainIdA, balanceA], [accountsB, chainIdB, balanceB]) => + accountsA?.[0] === accountsB?.[0] && chainIdA === chainIdB && (balanceA && balanceB ? balanceA?.equalsWith(balanceB) : false), + }, + ); + } + }, +); diff --git a/examples/VanillaDemo/src/vite-env.d.ts b/examples/VanillaDemo/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/examples/VanillaDemo/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/VanillaDemo/tsconfig.json b/examples/VanillaDemo/tsconfig.json new file mode 100644 index 0000000..75abdef --- /dev/null +++ b/examples/VanillaDemo/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/examples/Vue3Demo/.gitignore b/examples/Vue3Demo/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/examples/Vue3Demo/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/examples/Vue3Demo/.vscode/extensions.json b/examples/Vue3Demo/.vscode/extensions.json new file mode 100644 index 0000000..a7cea0b --- /dev/null +++ b/examples/Vue3Demo/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["Vue.volar"] +} diff --git a/examples/Vue3Demo/README.md b/examples/Vue3Demo/README.md new file mode 100644 index 0000000..0bfecb0 --- /dev/null +++ b/examples/Vue3Demo/README.md @@ -0,0 +1,9 @@ +# Vue 3 + TypeScript + Vite + +This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 ` + + diff --git a/examples/Vue3Demo/package.json b/examples/Vue3Demo/package.json new file mode 100644 index 0000000..41d65ac --- /dev/null +++ b/examples/Vue3Demo/package.json @@ -0,0 +1,23 @@ +{ + "name": "vue3demo", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "vue": "^3.4.27", + "@cfxjs/use-wallet-vue3": "^0.0.2-6", + "decimal.js": "^10.4.3", + "zustand": "^4.5.2" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.0.4", + "typescript": "^5.4.5", + "vite": "^5.2.11", + "vue-tsc": "^2.0.17" + } +} diff --git a/examples/Vue3Demo/src/App.vue b/examples/Vue3Demo/src/App.vue new file mode 100644 index 0000000..184f236 --- /dev/null +++ b/examples/Vue3Demo/src/App.vue @@ -0,0 +1,128 @@ + + + diff --git a/examples/Vue3Demo/src/main.ts b/examples/Vue3Demo/src/main.ts new file mode 100644 index 0000000..01433bc --- /dev/null +++ b/examples/Vue3Demo/src/main.ts @@ -0,0 +1,4 @@ +import { createApp } from 'vue' +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/examples/Vue3Demo/src/vite-env.d.ts b/examples/Vue3Demo/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/examples/Vue3Demo/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/Vue3Demo/tsconfig.json b/examples/Vue3Demo/tsconfig.json new file mode 100644 index 0000000..9e03e60 --- /dev/null +++ b/examples/Vue3Demo/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/examples/Vue3Demo/tsconfig.node.json b/examples/Vue3Demo/tsconfig.node.json new file mode 100644 index 0000000..97ede7e --- /dev/null +++ b/examples/Vue3Demo/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true + }, + "include": ["vite.config.ts"] +} diff --git a/examples/Vue3Demo/vite.config.ts b/examples/Vue3Demo/vite.config.ts new file mode 100644 index 0000000..05c1740 --- /dev/null +++ b/examples/Vue3Demo/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue()], +}) diff --git a/package.json b/package.json index 9d3938c..db0d649 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dev:docs": "turbo run dev --scope=docs", "build:react": "turbo run build --scope=react", "build:vue3": "turbo run build --scope=vue3", - "build:lib": "turbo run build --scope=vanilla --scope=react --scope=vue --scope=svelte", + "build:lib": "turbo run build --scope=react --scope=vue", "build:docs": "turbo run build --scope=docs", "build:enhance-react": "turbo run build --scope=enhance-react", "release:react": "node ./core/react/build/release.js",