@reown/appkit-cdn 0.0.3

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./W3MFrameProviderSingleton-BpWUndnw.cjs");function t(){if(typeof WebSocket<"u")return WebSocket;if(typeof e.global.WebSocket<"u")return e.global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const o=t();exports.WebSocket=o;
@@ -0,0 +1,16 @@
1
+ import { j as e } from "./W3MFrameProviderSingleton-CuVI_88U.js";
2
+ function t() {
3
+ if (typeof WebSocket < "u")
4
+ return WebSocket;
5
+ if (typeof e.WebSocket < "u")
6
+ return e.WebSocket;
7
+ if (typeof window.WebSocket < "u")
8
+ return window.WebSocket;
9
+ if (typeof self.WebSocket < "u")
10
+ return self.WebSocket;
11
+ throw new Error("`WebSocket` is not supported in this environment");
12
+ }
13
+ const n = t();
14
+ export {
15
+ n as WebSocket
16
+ };
@@ -0,0 +1,290 @@
1
+ import { q as g, u as v, M as n, m as d, y as m, O as p, b5 as y, x as C, v as k, R as h, U as S, K as E, z as A, a as f, f as x, c as N, w as c, t as O, b6 as L } from "./W3MFrameProviderSingleton-CuVI_88U.js";
2
+ const K = g`
3
+ :host {
4
+ z-index: var(--w3m-z-index);
5
+ display: block;
6
+ backface-visibility: hidden;
7
+ will-change: opacity;
8
+ position: fixed;
9
+ top: 0;
10
+ left: 0;
11
+ right: 0;
12
+ bottom: 0;
13
+ pointer-events: none;
14
+ opacity: 0;
15
+ background-color: var(--wui-cover);
16
+ transition: opacity 0.2s var(--wui-ease-out-power-2);
17
+ will-change: opacity;
18
+ }
19
+
20
+ :host(.open) {
21
+ opacity: 1;
22
+ }
23
+
24
+ wui-card {
25
+ max-width: var(--w3m-modal-width);
26
+ width: 100%;
27
+ position: relative;
28
+ animation: zoom-in 0.2s var(--wui-ease-out-power-2);
29
+ animation-fill-mode: backwards;
30
+ outline: none;
31
+ }
32
+
33
+ wui-card[shake='true'] {
34
+ animation:
35
+ zoom-in 0.2s var(--wui-ease-out-power-2),
36
+ w3m-shake 0.5s var(--wui-ease-out-power-2);
37
+ }
38
+
39
+ wui-flex {
40
+ overflow-x: hidden;
41
+ overflow-y: auto;
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ width: 100%;
46
+ height: 100%;
47
+ }
48
+
49
+ @media (max-height: 700px) and (min-width: 431px) {
50
+ wui-flex {
51
+ align-items: flex-start;
52
+ }
53
+
54
+ wui-card {
55
+ margin: var(--wui-spacing-xxl) 0px;
56
+ }
57
+ }
58
+
59
+ @media (max-width: 430px) {
60
+ wui-flex {
61
+ align-items: flex-end;
62
+ }
63
+
64
+ wui-card {
65
+ max-width: 100%;
66
+ border-bottom-left-radius: 0;
67
+ border-bottom-right-radius: 0;
68
+ border-bottom: none;
69
+ animation: slide-in 0.2s var(--wui-ease-out-power-2);
70
+ }
71
+
72
+ wui-card[shake='true'] {
73
+ animation:
74
+ slide-in 0.2s var(--wui-ease-out-power-2),
75
+ w3m-shake 0.5s var(--wui-ease-out-power-2);
76
+ }
77
+ }
78
+
79
+ @keyframes zoom-in {
80
+ 0% {
81
+ transform: scale(0.95) translateY(0);
82
+ }
83
+ 100% {
84
+ transform: scale(1) translateY(0);
85
+ }
86
+ }
87
+
88
+ @keyframes slide-in {
89
+ 0% {
90
+ transform: scale(1) translateY(50px);
91
+ }
92
+ 100% {
93
+ transform: scale(1) translateY(0);
94
+ }
95
+ }
96
+
97
+ @keyframes w3m-shake {
98
+ 0% {
99
+ transform: scale(1) rotate(0deg);
100
+ }
101
+ 20% {
102
+ transform: scale(1) rotate(-1deg);
103
+ }
104
+ 40% {
105
+ transform: scale(1) rotate(1.5deg);
106
+ }
107
+ 60% {
108
+ transform: scale(1) rotate(-1.5deg);
109
+ }
110
+ 80% {
111
+ transform: scale(1) rotate(1deg);
112
+ }
113
+ 100% {
114
+ transform: scale(1) rotate(0deg);
115
+ }
116
+ }
117
+
118
+ @keyframes w3m-view-height {
119
+ from {
120
+ height: var(--prev-height);
121
+ }
122
+ to {
123
+ height: var(--new-height);
124
+ }
125
+ }
126
+ `;
127
+ var l = function(w, e, t, i) {
128
+ var o = arguments.length, s = o < 3 ? e : i === null ? i = Object.getOwnPropertyDescriptor(e, t) : i, r;
129
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
130
+ s = Reflect.decorate(w, e, t, i);
131
+ else
132
+ for (var u = w.length - 1; u >= 0; u--)
133
+ (r = w[u]) && (s = (o < 3 ? r(s) : o > 3 ? r(e, t, s) : r(e, t)) || s);
134
+ return o > 3 && s && Object.defineProperty(e, t, s), s;
135
+ };
136
+ const b = "scroll-lock";
137
+ let a = class extends v {
138
+ constructor() {
139
+ super(), this.unsubscribe = [], this.abortController = void 0, this.open = n.state.open, this.caipAddress = d.state.caipAddress, this.caipNetwork = m.state.caipNetwork, this.isSiweEnabled = p.state.isSiweEnabled, this.connected = d.state.isConnected, this.loading = n.state.loading, this.shake = n.state.shake, this.initializeTheming(), y.prefetch(), this.unsubscribe.push(n.subscribeKey("open", (e) => e ? this.onOpen() : this.onClose()), n.subscribeKey("shake", (e) => this.shake = e), n.subscribeKey("loading", (e) => this.onLoadingChange(e)), d.subscribeKey("isConnected", (e) => this.onIsConnectedChange(e)), m.subscribeKey("caipNetwork", (e) => this.onNewNetwork(e)), d.subscribeKey("caipAddress", (e) => this.onNewAddress(e)), d.subscribeKey("siweStatus", (e) => this.onSiweStatusChange(e)), p.subscribeKey("isSiweEnabled", (e) => this.isSiweEnabled = e)), C.sendEvent({ type: "track", event: "MODAL_LOADED" });
140
+ }
141
+ disconnectedCallback() {
142
+ this.unsubscribe.forEach((e) => e()), this.onRemoveKeyboardListener();
143
+ }
144
+ render() {
145
+ return this.open ? k`
146
+ <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
147
+ <wui-card
148
+ shake="${this.shake}"
149
+ role="alertdialog"
150
+ aria-modal="true"
151
+ tabindex="0"
152
+ data-testid="w3m-modal-card"
153
+ >
154
+ <w3m-header></w3m-header>
155
+ <w3m-router></w3m-router>
156
+ <w3m-snackbar></w3m-snackbar>
157
+ </wui-card>
158
+ </wui-flex>
159
+ <w3m-tooltip></w3m-tooltip>
160
+ ` : null;
161
+ }
162
+ async onOverlayClick(e) {
163
+ e.target === e.currentTarget && await this.handleClose();
164
+ }
165
+ async handleClose() {
166
+ const e = h.state.view === "ConnectingSiwe", t = h.state.view === "ApproveTransaction";
167
+ if (this.isSiweEnabled) {
168
+ const { SIWEController: i } = await import("./index-DIBheNE_.js");
169
+ i.state.status !== "success" && (e || t) ? n.shake() : n.close();
170
+ } else
171
+ n.close();
172
+ }
173
+ initializeTheming() {
174
+ const { themeVariables: e, themeMode: t } = L.state, i = S.getColorTheme(t);
175
+ E(e, i);
176
+ }
177
+ onClose() {
178
+ this.open = !1, this.classList.remove("open"), this.onScrollUnlock(), A.hide(), this.onRemoveKeyboardListener();
179
+ }
180
+ onOpen() {
181
+ this.open = !0, this.classList.add("open"), this.onScrollLock(), this.onAddKeyboardListener();
182
+ }
183
+ onScrollLock() {
184
+ const e = document.createElement("style");
185
+ e.dataset.w3m = b, e.textContent = `
186
+ body {
187
+ touch-action: none;
188
+ overflow: hidden;
189
+ overscroll-behavior: contain;
190
+ }
191
+ w3m-modal {
192
+ pointer-events: auto;
193
+ }
194
+ `, document.head.appendChild(e);
195
+ }
196
+ onScrollUnlock() {
197
+ const e = document.head.querySelector(`style[data-w3m="${b}"]`);
198
+ e && e.remove();
199
+ }
200
+ onAddKeyboardListener() {
201
+ var t;
202
+ this.abortController = new AbortController();
203
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("wui-card");
204
+ e == null || e.focus(), window.addEventListener("keydown", (i) => {
205
+ if (i.key === "Escape")
206
+ this.handleClose();
207
+ else if (i.key === "Tab") {
208
+ const { tagName: o } = i.target;
209
+ o && !o.includes("W3M-") && !o.includes("WUI-") && (e == null || e.focus());
210
+ }
211
+ }, this.abortController);
212
+ }
213
+ onRemoveKeyboardListener() {
214
+ var e;
215
+ (e = this.abortController) == null || e.abort(), this.abortController = void 0;
216
+ }
217
+ async onNewAddress(e) {
218
+ var o;
219
+ if (!this.connected || this.loading)
220
+ return;
221
+ const t = f.getPlainAddress(this.caipAddress), i = f.getPlainAddress(e);
222
+ if (this.caipAddress = e, this.isSiweEnabled) {
223
+ const { SIWEController: s } = await import("./index-DIBheNE_.js");
224
+ await s.getSession() && t && i && t !== i && (o = s.state._client) != null && o.options.signOutOnAccountChange && (await s.signOut(), this.onSiweNavigation());
225
+ }
226
+ }
227
+ async onIsConnectedChange(e) {
228
+ const t = this.connected;
229
+ if (e && this.isSiweEnabled) {
230
+ const { SIWEController: i } = await import("./index-DIBheNE_.js");
231
+ await i.getSession() || this.onSiweNavigation();
232
+ } else
233
+ !t && e && (n.close(), h.reset("Connect"));
234
+ this.connected = e;
235
+ }
236
+ onSiweStatusChange(e) {
237
+ e === "success" && n.close();
238
+ }
239
+ onLoadingChange(e) {
240
+ this.loading = e;
241
+ }
242
+ async onNewNetwork(e) {
243
+ var o, s;
244
+ if (!this.connected) {
245
+ this.caipNetwork = e;
246
+ return;
247
+ }
248
+ const t = (o = this.caipNetwork) == null ? void 0 : o.id, i = e == null ? void 0 : e.id;
249
+ if (t && i && t !== i)
250
+ if (this.isSiweEnabled) {
251
+ const { SIWEController: r } = await import("./index-DIBheNE_.js");
252
+ await r.getSession() && (s = r.state._client) != null && s.options.signOutOnNetworkChange && (await r.signOut(), this.onSiweNavigation());
253
+ } else
254
+ h.goBack();
255
+ this.caipNetwork = e;
256
+ }
257
+ onSiweNavigation() {
258
+ x.state.activeChain === N.CHAIN.EVM && (this.open ? h.replace("ConnectingSiwe") : n.open({
259
+ view: "ConnectingSiwe"
260
+ }));
261
+ }
262
+ };
263
+ a.styles = K;
264
+ l([
265
+ c()
266
+ ], a.prototype, "open", void 0);
267
+ l([
268
+ c()
269
+ ], a.prototype, "caipAddress", void 0);
270
+ l([
271
+ c()
272
+ ], a.prototype, "caipNetwork", void 0);
273
+ l([
274
+ c()
275
+ ], a.prototype, "isSiweEnabled", void 0);
276
+ l([
277
+ c()
278
+ ], a.prototype, "connected", void 0);
279
+ l([
280
+ c()
281
+ ], a.prototype, "loading", void 0);
282
+ l([
283
+ c()
284
+ ], a.prototype, "shake", void 0);
285
+ a = l([
286
+ O("w3m-modal")
287
+ ], a);
288
+ export {
289
+ a as W3mModal
290
+ };
@@ -0,0 +1,149 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./W3MFrameProviderSingleton-BpWUndnw.cjs"),h=o.i`
2
+ :host {
3
+ z-index: var(--w3m-z-index);
4
+ display: block;
5
+ backface-visibility: hidden;
6
+ will-change: opacity;
7
+ position: fixed;
8
+ top: 0;
9
+ left: 0;
10
+ right: 0;
11
+ bottom: 0;
12
+ pointer-events: none;
13
+ opacity: 0;
14
+ background-color: var(--wui-cover);
15
+ transition: opacity 0.2s var(--wui-ease-out-power-2);
16
+ will-change: opacity;
17
+ }
18
+
19
+ :host(.open) {
20
+ opacity: 1;
21
+ }
22
+
23
+ wui-card {
24
+ max-width: var(--w3m-modal-width);
25
+ width: 100%;
26
+ position: relative;
27
+ animation: zoom-in 0.2s var(--wui-ease-out-power-2);
28
+ animation-fill-mode: backwards;
29
+ outline: none;
30
+ }
31
+
32
+ wui-card[shake='true'] {
33
+ animation:
34
+ zoom-in 0.2s var(--wui-ease-out-power-2),
35
+ w3m-shake 0.5s var(--wui-ease-out-power-2);
36
+ }
37
+
38
+ wui-flex {
39
+ overflow-x: hidden;
40
+ overflow-y: auto;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ width: 100%;
45
+ height: 100%;
46
+ }
47
+
48
+ @media (max-height: 700px) and (min-width: 431px) {
49
+ wui-flex {
50
+ align-items: flex-start;
51
+ }
52
+
53
+ wui-card {
54
+ margin: var(--wui-spacing-xxl) 0px;
55
+ }
56
+ }
57
+
58
+ @media (max-width: 430px) {
59
+ wui-flex {
60
+ align-items: flex-end;
61
+ }
62
+
63
+ wui-card {
64
+ max-width: 100%;
65
+ border-bottom-left-radius: 0;
66
+ border-bottom-right-radius: 0;
67
+ border-bottom: none;
68
+ animation: slide-in 0.2s var(--wui-ease-out-power-2);
69
+ }
70
+
71
+ wui-card[shake='true'] {
72
+ animation:
73
+ slide-in 0.2s var(--wui-ease-out-power-2),
74
+ w3m-shake 0.5s var(--wui-ease-out-power-2);
75
+ }
76
+ }
77
+
78
+ @keyframes zoom-in {
79
+ 0% {
80
+ transform: scale(0.95) translateY(0);
81
+ }
82
+ 100% {
83
+ transform: scale(1) translateY(0);
84
+ }
85
+ }
86
+
87
+ @keyframes slide-in {
88
+ 0% {
89
+ transform: scale(1) translateY(50px);
90
+ }
91
+ 100% {
92
+ transform: scale(1) translateY(0);
93
+ }
94
+ }
95
+
96
+ @keyframes w3m-shake {
97
+ 0% {
98
+ transform: scale(1) rotate(0deg);
99
+ }
100
+ 20% {
101
+ transform: scale(1) rotate(-1deg);
102
+ }
103
+ 40% {
104
+ transform: scale(1) rotate(1.5deg);
105
+ }
106
+ 60% {
107
+ transform: scale(1) rotate(-1.5deg);
108
+ }
109
+ 80% {
110
+ transform: scale(1) rotate(1deg);
111
+ }
112
+ 100% {
113
+ transform: scale(1) rotate(0deg);
114
+ }
115
+ }
116
+
117
+ @keyframes w3m-view-height {
118
+ from {
119
+ height: var(--prev-height);
120
+ }
121
+ to {
122
+ height: var(--new-height);
123
+ }
124
+ }
125
+ `;var a=function(l,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(l,e,t,i);else for(var d=l.length-1;d>=0;d--)(r=l[d])&&(n=(s<3?r(n):s>3?r(e,t,n):r(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n};const c="scroll-lock";exports.W3mModal=class extends o.h{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.open=o.ModalController.state.open,this.caipAddress=o.AccountController.state.caipAddress,this.caipNetwork=o.NetworkController.state.caipNetwork,this.isSiweEnabled=o.OptionsController.state.isSiweEnabled,this.connected=o.AccountController.state.isConnected,this.loading=o.ModalController.state.loading,this.shake=o.ModalController.state.shake,this.initializeTheming(),o.ApiController.prefetch(),this.unsubscribe.push(o.ModalController.subscribeKey("open",e=>e?this.onOpen():this.onClose()),o.ModalController.subscribeKey("shake",e=>this.shake=e),o.ModalController.subscribeKey("loading",e=>this.onLoadingChange(e)),o.AccountController.subscribeKey("isConnected",e=>this.onIsConnectedChange(e)),o.NetworkController.subscribeKey("caipNetwork",e=>this.onNewNetwork(e)),o.AccountController.subscribeKey("caipAddress",e=>this.onNewAddress(e)),o.AccountController.subscribeKey("siweStatus",e=>this.onSiweStatusChange(e)),o.OptionsController.subscribeKey("isSiweEnabled",e=>this.isSiweEnabled=e)),o.EventsController.sendEvent({type:"track",event:"MODAL_LOADED"})}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),this.onRemoveKeyboardListener()}render(){return this.open?o.ke`
126
+ <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
127
+ <wui-card
128
+ shake="${this.shake}"
129
+ role="alertdialog"
130
+ aria-modal="true"
131
+ tabindex="0"
132
+ data-testid="w3m-modal-card"
133
+ >
134
+ <w3m-header></w3m-header>
135
+ <w3m-router></w3m-router>
136
+ <w3m-snackbar></w3m-snackbar>
137
+ </wui-card>
138
+ </wui-flex>
139
+ <w3m-tooltip></w3m-tooltip>
140
+ `:null}async onOverlayClick(e){e.target===e.currentTarget&&await this.handleClose()}async handleClose(){const e=o.RouterController.state.view==="ConnectingSiwe",t=o.RouterController.state.view==="ApproveTransaction";if(this.isSiweEnabled){const{SIWEController:i}=await Promise.resolve().then(()=>require("./index-BgSdiVHK.cjs"));i.state.status!=="success"&&(e||t)?o.ModalController.shake():o.ModalController.close()}else o.ModalController.close()}initializeTheming(){const{themeVariables:e,themeMode:t}=o.ThemeController.state,i=o.UiHelperUtil.getColorTheme(t);o.initializeTheming(e,i)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),o.SnackController.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=c,e.textContent=`
141
+ body {
142
+ touch-action: none;
143
+ overflow: hidden;
144
+ overscroll-behavior: contain;
145
+ }
146
+ w3m-modal {
147
+ pointer-events: auto;
148
+ }
149
+ `,document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${c}"]`);e&&e.remove()}onAddKeyboardListener(){var t;this.abortController=new AbortController;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("wui-card");e==null||e.focus(),window.addEventListener("keydown",i=>{if(i.key==="Escape")this.handleClose();else if(i.key==="Tab"){const{tagName:s}=i.target;s&&!s.includes("W3M-")&&!s.includes("WUI-")&&(e==null||e.focus())}},this.abortController)}onRemoveKeyboardListener(){var e;(e=this.abortController)==null||e.abort(),this.abortController=void 0}async onNewAddress(e){var s;if(!this.connected||this.loading)return;const t=o.CoreHelperUtil.getPlainAddress(this.caipAddress),i=o.CoreHelperUtil.getPlainAddress(e);if(this.caipAddress=e,this.isSiweEnabled){const{SIWEController:n}=await Promise.resolve().then(()=>require("./index-BgSdiVHK.cjs"));await n.getSession()&&t&&i&&t!==i&&(s=n.state._client)!=null&&s.options.signOutOnAccountChange&&(await n.signOut(),this.onSiweNavigation())}}async onIsConnectedChange(e){const t=this.connected;if(e&&this.isSiweEnabled){const{SIWEController:i}=await Promise.resolve().then(()=>require("./index-BgSdiVHK.cjs"));await i.getSession()||this.onSiweNavigation()}else!t&&e&&(o.ModalController.close(),o.RouterController.reset("Connect"));this.connected=e}onSiweStatusChange(e){e==="success"&&o.ModalController.close()}onLoadingChange(e){this.loading=e}async onNewNetwork(e){var s,n;if(!this.connected){this.caipNetwork=e;return}const t=(s=this.caipNetwork)==null?void 0:s.id,i=e==null?void 0:e.id;if(t&&i&&t!==i)if(this.isSiweEnabled){const{SIWEController:r}=await Promise.resolve().then(()=>require("./index-BgSdiVHK.cjs"));await r.getSession()&&(n=r.state._client)!=null&&n.options.signOutOnNetworkChange&&(await r.signOut(),this.onSiweNavigation())}else o.RouterController.goBack();this.caipNetwork=e}onSiweNavigation(){o.ChainController.state.activeChain===o.ConstantsUtil$1.CHAIN.EVM&&(this.open?o.RouterController.replace("ConnectingSiwe"):o.ModalController.open({view:"ConnectingSiwe"}))}};exports.W3mModal.styles=h;a([o.r()],exports.W3mModal.prototype,"open",void 0);a([o.r()],exports.W3mModal.prototype,"caipAddress",void 0);a([o.r()],exports.W3mModal.prototype,"caipNetwork",void 0);a([o.r()],exports.W3mModal.prototype,"isSiweEnabled",void 0);a([o.r()],exports.W3mModal.prototype,"connected",void 0);a([o.r()],exports.W3mModal.prototype,"loading",void 0);a([o.r()],exports.W3mModal.prototype,"shake",void 0);exports.W3mModal=a([o.customElement("w3m-modal")],exports.W3mModal);