@mysten/dapp-kit-core 1.2.2 → 1.3.1
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/CHANGELOG.md +30 -0
- package/dist/web/index.d.mts +8 -0
- package/dist/web/index.d.mts.map +1 -1
- package/dist/web/index.mjs +16 -1
- package/dist/web/index.mjs.map +1 -1
- package/package.json +8 -9
- package/src/web/dapp-kit-connect-button.ts +4 -0
- package/src/web/dapp-kit-connect-modal.ts +4 -0
- package/src/web/internal/button.styles.ts +5 -0
- package/src/web/internal/connected-account-menu.styles.ts +3 -1
- package/src/web/internal/wallet-list-item.styles.ts +1 -0
- package/src/web/styles/icon-button.ts +1 -0
- package/src/web/styles/theme.ts +6 -0
- package/docs/actions/connect-wallet.md +0 -68
- package/docs/actions/disconnect-wallet.md +0 -37
- package/docs/actions/sign-and-execute-transaction.md +0 -95
- package/docs/actions/sign-personal-message.md +0 -57
- package/docs/actions/sign-transaction.md +0 -64
- package/docs/actions/switch-account.md +0 -36
- package/docs/actions/switch-network.md +0 -36
- package/docs/dapp-kit-instance.md +0 -163
- package/docs/getting-started/create-dapp.md +0 -151
- package/docs/getting-started/next-js.md +0 -162
- package/docs/getting-started/react.md +0 -170
- package/docs/getting-started/vue.md +0 -188
- package/docs/index.md +0 -70
- package/docs/llms-index.md +0 -34
- package/docs/react/components/connect-button.md +0 -42
- package/docs/react/components/connect-modal.md +0 -51
- package/docs/react/components/index.md +0 -13
- package/docs/react/dapp-kit-provider.md +0 -86
- package/docs/react/hooks/index.md +0 -25
- package/docs/react/hooks/use-current-account.md +0 -33
- package/docs/react/hooks/use-current-client.md +0 -36
- package/docs/react/hooks/use-current-network.md +0 -28
- package/docs/react/hooks/use-current-wallet.md +0 -36
- package/docs/react/hooks/use-dapp-kit.md +0 -100
- package/docs/react/hooks/use-wallet-connection.md +0 -48
- package/docs/react/hooks/use-wallets.md +0 -33
- package/docs/state.md +0 -168
- package/docs/theming.md +0 -196
- package/docs/web-components/connect-button.md +0 -87
- package/docs/web-components/connect-modal.md +0 -176
- package/src/web/dapp-kit-connect-button.stories.ts +0 -107
- package/src/web/dapp-kit-connect-modal.stories.ts +0 -62
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
5
|
-
import { html } from 'lit';
|
|
6
|
-
import type { DAppKitConnectButton } from './dapp-kit-connect-button.js';
|
|
7
|
-
import { createDAppKit } from '../core/index.js';
|
|
8
|
-
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
9
|
-
|
|
10
|
-
const GRPC_URLS = {
|
|
11
|
-
testnet: 'https://fullnode.testnet.sui.io:443',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const dAppKit = createDAppKit({
|
|
15
|
-
networks: ['testnet'],
|
|
16
|
-
createClient(network) {
|
|
17
|
-
return new SuiGrpcClient({ network, baseUrl: GRPC_URLS[network] });
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const meta = {
|
|
22
|
-
title: 'Connect Button',
|
|
23
|
-
component: 'mysten-dapp-kit-connect-button',
|
|
24
|
-
render: (args) =>
|
|
25
|
-
html`<mysten-dapp-kit-connect-button
|
|
26
|
-
.modalOptions=${args['modalOptions']}
|
|
27
|
-
.instance=${dAppKit}
|
|
28
|
-
></mysten-dapp-kit-connect-button>`,
|
|
29
|
-
tags: ['autodocs'],
|
|
30
|
-
} satisfies Meta;
|
|
31
|
-
|
|
32
|
-
export default meta;
|
|
33
|
-
|
|
34
|
-
export const Default: StoryObj<DAppKitConnectButton> = {};
|
|
35
|
-
|
|
36
|
-
export const WithCustomLabel: StoryObj<DAppKitConnectButton> = {
|
|
37
|
-
render: () =>
|
|
38
|
-
html`<mysten-dapp-kit-connect-button .instance=${dAppKit}>
|
|
39
|
-
Sign In
|
|
40
|
-
</mysten-dapp-kit-connect-button>`,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const WithCustomTheme: StoryObj<DAppKitConnectButton> = {
|
|
44
|
-
render: () => html`
|
|
45
|
-
<div>
|
|
46
|
-
<style>
|
|
47
|
-
:root {
|
|
48
|
-
--background: oklch(0.2161 0.0061 56.0434);
|
|
49
|
-
--foreground: oklch(0.9299 0.0334 272.7879);
|
|
50
|
-
--card: oklch(0.2805 0.0309 307.2326);
|
|
51
|
-
--card-foreground: oklch(0.9299 0.0334 272.7879);
|
|
52
|
-
--primary: oklch(0.7874 0.1179 295.7538);
|
|
53
|
-
--primary-foreground: oklch(0.2161 0.0061 56.0434);
|
|
54
|
-
--secondary: oklch(0.3416 0.0444 308.8496);
|
|
55
|
-
--secondary-foreground: oklch(0.8717 0.0093 258.3382);
|
|
56
|
-
--muted: oklch(0.2805 0.0309 307.2326);
|
|
57
|
-
--muted-foreground: oklch(0.7137 0.0192 261.3246);
|
|
58
|
-
--accent: oklch(0.3858 0.0509 304.6383);
|
|
59
|
-
--accent-foreground: oklch(0.8717 0.0093 258.3382);
|
|
60
|
-
--popover: oklch(0.2284 0.0384 282.9324);
|
|
61
|
-
--popover-foreground: oklch(0.9185 0.0257 285.8834);
|
|
62
|
-
--border: oklch(0.3416 0.0444 308.8496);
|
|
63
|
-
--input: oklch(0.3416 0.0444 308.8496);
|
|
64
|
-
--ring: oklch(0.7874 0.1179 295.7538);
|
|
65
|
-
--font-sans: Open Sans, sans-serif;
|
|
66
|
-
--radius: 1.5rem;
|
|
67
|
-
}
|
|
68
|
-
</style>
|
|
69
|
-
<mysten-dapp-kit-connect-button .instance=${dAppKit}></mysten-dapp-kit-connect-button>
|
|
70
|
-
</div>
|
|
71
|
-
`,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const WithCustomTriggerPart: StoryObj<DAppKitConnectButton> = {
|
|
75
|
-
render: () => html`
|
|
76
|
-
<style>
|
|
77
|
-
.custom-part-demo::part(trigger) {
|
|
78
|
-
height: 56px;
|
|
79
|
-
padding: 12px 32px;
|
|
80
|
-
border-radius: 999px;
|
|
81
|
-
background-color: #e63946;
|
|
82
|
-
color: #f1faee;
|
|
83
|
-
font-size: 18px;
|
|
84
|
-
letter-spacing: 0.5px;
|
|
85
|
-
}
|
|
86
|
-
</style>
|
|
87
|
-
<mysten-dapp-kit-connect-button class="custom-part-demo" .instance=${dAppKit}>
|
|
88
|
-
Connect
|
|
89
|
-
</mysten-dapp-kit-connect-button>
|
|
90
|
-
`,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const WithRandomSort: StoryObj<DAppKitConnectButton> = {
|
|
94
|
-
args: {
|
|
95
|
-
modalOptions: {
|
|
96
|
-
sortFn: () => 0.5 - Math.random(),
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export const WithRandomFilter: StoryObj<DAppKitConnectButton> = {
|
|
102
|
-
args: {
|
|
103
|
-
modalOptions: {
|
|
104
|
-
filterFn: () => Math.random() > 0.5,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
5
|
-
import { html } from 'lit';
|
|
6
|
-
import type { DAppKitConnectModal } from './dapp-kit-connect-modal.js';
|
|
7
|
-
import { createDAppKit } from '../core/index.js';
|
|
8
|
-
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
9
|
-
|
|
10
|
-
const GRPC_URLS = {
|
|
11
|
-
testnet: 'https://fullnode.testnet.sui.io:443',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const dAppKit = createDAppKit({
|
|
15
|
-
networks: ['testnet'],
|
|
16
|
-
createClient(network) {
|
|
17
|
-
return new SuiGrpcClient({ network, baseUrl: GRPC_URLS[network] });
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const meta = {
|
|
22
|
-
title: 'Connect Modal',
|
|
23
|
-
component: 'mysten-dapp-kit-connect-modal',
|
|
24
|
-
render: (args) => html`
|
|
25
|
-
<mysten-dapp-kit-connect-modal
|
|
26
|
-
?open="${args['open']}"
|
|
27
|
-
.sortFn=${args['sortFn']}
|
|
28
|
-
.filterFn=${args['filterFn']}
|
|
29
|
-
.instance=${dAppKit}
|
|
30
|
-
></mysten-dapp-kit-connect-modal>
|
|
31
|
-
`,
|
|
32
|
-
tags: ['autodocs'],
|
|
33
|
-
} satisfies Meta;
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
|
|
37
|
-
export const Default: StoryObj<DAppKitConnectModal> = {
|
|
38
|
-
args: {
|
|
39
|
-
open: true,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const WithRandomSort: StoryObj<DAppKitConnectModal> = {
|
|
44
|
-
args: {
|
|
45
|
-
open: true,
|
|
46
|
-
sortFn: () => 0.5 - Math.random(),
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const WithRandomFilter: StoryObj<DAppKitConnectModal> = {
|
|
51
|
-
args: {
|
|
52
|
-
open: true,
|
|
53
|
-
filterFn: () => Math.random() > 0.5,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const NoDetectedWallets: StoryObj<DAppKitConnectModal> = {
|
|
58
|
-
args: {
|
|
59
|
-
open: true,
|
|
60
|
-
filterFn: () => false,
|
|
61
|
-
},
|
|
62
|
-
};
|