@haneullabs/enoki-connect 0.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,353 @@
1
+ # @haneullabs/enoki-connect
2
+
3
+ ## 0.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [29e8b92]
8
+ - @haneullabs/haneul@1.45.2
9
+ - @haneullabs/wallet-standard@0.19.9
10
+
11
+ ## 0.1.11
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [e3811f1]
16
+ - @haneullabs/window-wallet-core@0.1.1
17
+ - @haneullabs/haneul@1.45.1
18
+ - @haneullabs/wallet-standard@0.19.8
19
+
20
+ ## 0.1.10
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [88bdbac]
25
+ - @haneullabs/haneul@1.45.0
26
+ - @haneullabs/wallet-standard@0.19.7
27
+
28
+ ## 0.1.9
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [44d9b4f]
33
+ - @haneullabs/haneul@1.44.0
34
+ - @haneullabs/wallet-standard@0.19.6
35
+
36
+ ## 0.1.8
37
+
38
+ ### Patch Changes
39
+
40
+ - @haneullabs/haneul@1.43.2
41
+ - @haneullabs/wallet-standard@0.19.5
42
+
43
+ ## 0.1.7
44
+
45
+ ### Patch Changes
46
+
47
+ - @haneullabs/haneul@1.43.1
48
+ - @haneullabs/wallet-standard@0.19.4
49
+
50
+ ## 0.1.6
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [f3b19a7]
55
+ - Updated dependencies [bf9f85c]
56
+ - @haneullabs/haneul@1.43.0
57
+ - @haneullabs/wallet-standard@0.19.3
58
+
59
+ ## 0.1.5
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies [98c8a27]
64
+ - @haneullabs/haneul@1.42.0
65
+ - @haneullabs/wallet-standard@0.19.2
66
+
67
+ ## 0.1.4
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [d554cd2]
72
+ - Updated dependencies [04fcfbc]
73
+ - @haneullabs/haneul@1.41.0
74
+ - @haneullabs/wallet-standard@0.19.1
75
+
76
+ ## 0.1.3
77
+
78
+ ### Patch Changes
79
+
80
+ - Updated dependencies [f5fc0c0]
81
+ - Updated dependencies [f5fc0c0]
82
+ - @haneullabs/wallet-standard@0.19.0
83
+ - @haneullabs/haneul@1.40.0
84
+
85
+ ## 0.1.2
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies [a9f9035]
90
+ - @haneullabs/haneul@1.39.1
91
+ - @haneullabs/wallet-standard@0.18.1
92
+
93
+ ## 0.1.1
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies [566b9ae]
98
+ - Updated dependencies [ca92487]
99
+ - Updated dependencies [5ab3c0a]
100
+ - @haneullabs/wallet-standard@0.18.0
101
+ - @haneullabs/haneul@1.39.0
102
+
103
+ ## 0.1.0
104
+
105
+ ### Minor Changes
106
+
107
+ - 45efc26: show fallback modal to click to open a popup when opening a new tab is blocked
108
+ - ea1ac70: Update dependencies and improve support for typescript 5.9
109
+
110
+ ### Patch Changes
111
+
112
+ - 45efc26: enhance wallet operation request popup fallback modal to support custom CSS variables for
113
+ improved styling flexibility
114
+ - Updated dependencies [45efc26]
115
+ - Updated dependencies [3c1741f]
116
+ - Updated dependencies [ea1ac70]
117
+ - @haneullabs/window-wallet-core@0.1.0
118
+ - @haneullabs/haneul@1.38.0
119
+ - @haneullabs/wallet-standard@0.17.0
120
+ - @haneullabs/utils@0.2.0
121
+
122
+ ## 0.0.26
123
+
124
+ ### Patch Changes
125
+
126
+ - Updated dependencies [c689b98]
127
+ - Updated dependencies [c689b98]
128
+ - Updated dependencies [5b9ff1a]
129
+ - @haneullabs/haneul@1.37.6
130
+ - @haneullabs/wallet-standard@0.16.14
131
+
132
+ ## 0.0.25
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [3980d04]
137
+ - @haneullabs/haneul@1.37.5
138
+ - @haneullabs/wallet-standard@0.16.13
139
+
140
+ ## 0.0.24
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [6b03e57]
145
+ - @haneullabs/haneul@1.37.4
146
+ - @haneullabs/wallet-standard@0.16.12
147
+
148
+ ## 0.0.23
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [8ff1471]
153
+ - @haneullabs/haneul@1.37.3
154
+ - @haneullabs/wallet-standard@0.16.11
155
+
156
+ ## 0.0.22
157
+
158
+ ### Patch Changes
159
+
160
+ - Updated dependencies [660377c]
161
+ - @haneullabs/haneul@1.37.2
162
+ - @haneullabs/wallet-standard@0.16.10
163
+
164
+ ## 0.0.21
165
+
166
+ ### Patch Changes
167
+
168
+ - @haneullabs/haneul@1.37.1
169
+ - @haneullabs/wallet-standard@0.16.9
170
+
171
+ ## 0.0.20
172
+
173
+ ### Patch Changes
174
+
175
+ - b21eed2: add docs for enoki-connect registerEnokiConnectWallets function
176
+ - Updated dependencies [72168f0]
177
+ - @haneullabs/haneul@1.37.0
178
+ - @haneullabs/wallet-standard@0.16.8
179
+
180
+ ## 0.0.19
181
+
182
+ ### Patch Changes
183
+
184
+ - Updated dependencies [44354ab]
185
+ - @haneullabs/haneul@1.36.2
186
+ - @haneullabs/wallet-standard@0.16.7
187
+
188
+ ## 0.0.18
189
+
190
+ ### Patch Changes
191
+
192
+ - Updated dependencies [c76ddc5]
193
+ - @haneullabs/haneul@1.36.1
194
+ - @haneullabs/wallet-standard@0.16.6
195
+
196
+ ## 0.0.17
197
+
198
+ ### Patch Changes
199
+
200
+ - 1c4a82d: update links in package.json
201
+ - Updated dependencies [1c4a82d]
202
+ - Updated dependencies [783bb9e]
203
+ - Updated dependencies [783bb9e]
204
+ - Updated dependencies [5cbbb21]
205
+ - @haneullabs/window-wallet-core@0.0.6
206
+ - @haneullabs/haneul@1.36.0
207
+ - @haneullabs/wallet-standard@0.16.5
208
+
209
+ ## 0.0.16
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [888afe6]
214
+ - @haneullabs/haneul@1.35.0
215
+ - @haneullabs/wallet-standard@0.16.4
216
+
217
+ ## 0.0.15
218
+
219
+ ### Patch Changes
220
+
221
+ - Updated dependencies [3fb7a83]
222
+ - @haneullabs/haneul@1.34.0
223
+ - @haneullabs/wallet-standard@0.16.3
224
+
225
+ ## 0.0.14
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies [a00522b]
230
+ - @haneullabs/haneul@1.33.0
231
+ - @haneullabs/wallet-standard@0.16.2
232
+ - @haneullabs/window-wallet-core@0.0.5
233
+
234
+ ## 0.0.13
235
+
236
+ ### Patch Changes
237
+
238
+ - Updated dependencies [6b7deb8]
239
+ - @haneullabs/haneul@1.32.0
240
+ - @haneullabs/wallet-standard@0.16.1
241
+
242
+ ## 0.0.12
243
+
244
+ ### Patch Changes
245
+
246
+ - Updated dependencies [1ff4e57]
247
+ - Updated dependencies [550e2e3]
248
+ - Updated dependencies [550e2e3]
249
+ - @haneullabs/haneul@1.31.0
250
+ - @haneullabs/wallet-standard@0.16.0
251
+
252
+ ## 0.0.11
253
+
254
+ ### Patch Changes
255
+
256
+ - Updated dependencies [5bd6ca3]
257
+ - @haneullabs/haneul@1.30.5
258
+ - @haneullabs/wallet-standard@0.15.6
259
+
260
+ ## 0.0.10
261
+
262
+ ### Patch Changes
263
+
264
+ - Updated dependencies [5dce590]
265
+ - Updated dependencies [4a5aef6]
266
+ - @haneullabs/haneul@1.30.4
267
+ - @haneullabs/wallet-standard@0.15.5
268
+
269
+ ## 0.0.9
270
+
271
+ ### Patch Changes
272
+
273
+ - bb7c03a: Update dependencies
274
+ - Updated dependencies [4457f10]
275
+ - Updated dependencies [bb7c03a]
276
+ - @haneullabs/haneul@1.30.3
277
+ - @haneullabs/window-wallet-core@0.0.4
278
+ - @haneullabs/wallet-standard@0.15.4
279
+
280
+ ## 0.0.8
281
+
282
+ ### Patch Changes
283
+
284
+ - Updated dependencies [b265f7e]
285
+ - @haneullabs/haneul@1.30.2
286
+ - @haneullabs/wallet-standard@0.15.3
287
+
288
+ ## 0.0.7
289
+
290
+ ### Patch Changes
291
+
292
+ - Updated dependencies [ec519fc]
293
+ - @haneullabs/haneul@1.30.1
294
+ - @haneullabs/wallet-standard@0.15.2
295
+
296
+ ## 0.0.6
297
+
298
+ ### Patch Changes
299
+
300
+ - Updated dependencies [2456052]
301
+ - Updated dependencies [5264038]
302
+ - Updated dependencies [2456052]
303
+ - Updated dependencies [a257600]
304
+ - Updated dependencies [933199c]
305
+ - Updated dependencies [2456052]
306
+ - Updated dependencies [2456052]
307
+ - Updated dependencies [2456052]
308
+ - @haneullabs/haneul@1.30.0
309
+ - @haneullabs/window-wallet-core@0.0.3
310
+ - @haneullabs/wallet-standard@0.15.1
311
+
312
+ ## 0.0.5
313
+
314
+ ### Patch Changes
315
+
316
+ - 0bb98c5: update metadata api
317
+ - 8126945: add devnet to supported networks
318
+ - Updated dependencies [afbbb80]
319
+ - @haneullabs/wallet-standard@0.15.0
320
+
321
+ ## 0.0.4
322
+
323
+ ### Patch Changes
324
+
325
+ - ff4193f: allow registering multiple enoki-connect wallets
326
+ - removes `registerEnokiConnectWallet`
327
+ - adds `registerEnokiConnectWallets`
328
+
329
+ ## 0.0.3
330
+
331
+ ### Patch Changes
332
+
333
+ - @haneullabs/haneul@1.29.1
334
+ - @haneullabs/wallet-standard@0.14.9
335
+
336
+ ## 0.0.2
337
+
338
+ ### Patch Changes
339
+
340
+ - Updated dependencies [7d66a32]
341
+ - Updated dependencies [eb91fba]
342
+ - Updated dependencies [19a8045]
343
+ - @haneullabs/haneul@1.29.0
344
+ - @haneullabs/wallet-standard@0.14.8
345
+
346
+ ## 0.0.1
347
+
348
+ ### Patch Changes
349
+
350
+ - d54cc09: initialization
351
+ - Updated dependencies [9a94aea]
352
+ - @haneullabs/haneul@1.28.2
353
+ - @haneullabs/wallet-standard@0.14.7
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # `@haneullabs/enoki-connect`
2
+
3
+ > ⚠️ **Warning**: This package is in active development and should be used with caution. APIs are
4
+ > experimental and subject to breaking changes without notice. We recommend thoroughly testing any
5
+ > implementation before using in production environments.
@@ -0,0 +1,43 @@
1
+ import { LitElement } from 'lit';
2
+ import type { PropertyValues } from 'lit';
3
+ import type { PromiseWithResolvers } from '@haneullabs/utils';
4
+ export declare class BaseModal extends LitElement {
5
+ #private;
6
+ static shadowRootOptions: {
7
+ delegatesFocus: boolean;
8
+ clonable?: boolean;
9
+ customElementRegistry?: CustomElementRegistry;
10
+ mode: ShadowRootMode;
11
+ serializable?: boolean;
12
+ slotAssignment?: SlotAssignmentMode;
13
+ };
14
+ /**
15
+ * Opens the dialog when set to `true` and closes it when set to `false`.
16
+ */
17
+ get open(): boolean;
18
+ set open(open: boolean);
19
+ disabled: boolean;
20
+ private readonly _dialog;
21
+ protected _closingResolvers?: PromiseWithResolvers<void>;
22
+ protected get _isClosing(): boolean;
23
+ firstUpdated(changedProperties: PropertyValues): void;
24
+ /**
25
+ * Opens the dialog and fires a cancelable `open` event. An `opened` event
26
+ * is fired after the dialog opens.
27
+ *
28
+ * @returns A `Promise` that resolves after the `opened` event was fired.
29
+ */
30
+ show(): Promise<void>;
31
+ /**
32
+ * Closes the dialog and fires a cancelable `close` event. After a dialog's
33
+ * animation, a `closed` event is fired.
34
+ *
35
+ */
36
+ close(): Promise<void>;
37
+ protected handleAnimationEnd(e: AnimationEvent): void;
38
+ connectedCallback(): void;
39
+ disconnectedCallback(): void;
40
+ protected handleContentClick(): void;
41
+ protected handleDialogClick(): void;
42
+ protected handleCancel(e?: Event): void;
43
+ }
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __typeError = (msg) => {
7
+ throw TypeError(msg);
8
+ };
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __decorateClass = (decorators, target, key, kind) => {
23
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
24
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
25
+ if (decorator = decorators[i])
26
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
27
+ if (kind && result) __defProp(target, key, result);
28
+ return result;
29
+ };
30
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
31
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
32
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
33
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
34
+ var base_modal_exports = {};
35
+ __export(base_modal_exports, {
36
+ BaseModal: () => BaseModal
37
+ });
38
+ module.exports = __toCommonJS(base_modal_exports);
39
+ var import_lit = require("lit");
40
+ var import_decorators = require("lit/decorators.js");
41
+ var import_utils = require("@haneullabs/utils");
42
+ var _isOpen, _isOpening, _isConnected, _nextClickIsFromContent, _keyDownHandler;
43
+ class BaseModal extends import_lit.LitElement {
44
+ constructor() {
45
+ super(...arguments);
46
+ __privateAdd(this, _isOpen, false);
47
+ __privateAdd(this, _isOpening, false);
48
+ __privateAdd(this, _isConnected, (0, import_utils.promiseWithResolvers)());
49
+ __privateAdd(this, _nextClickIsFromContent, false);
50
+ this.disabled = false;
51
+ __privateAdd(this, _keyDownHandler, (e) => {
52
+ if (e.key === "Escape" && this.open) {
53
+ this.handleCancel(e);
54
+ }
55
+ });
56
+ }
57
+ get open() {
58
+ return __privateGet(this, _isOpen);
59
+ }
60
+ set open(open) {
61
+ if (open === __privateGet(this, _isOpen)) {
62
+ return;
63
+ }
64
+ __privateSet(this, _isOpen, open);
65
+ if (__privateGet(this, _isOpen)) {
66
+ this.setAttribute("open", "");
67
+ this.show();
68
+ } else {
69
+ this.removeAttribute("open");
70
+ this.close();
71
+ }
72
+ }
73
+ get _isClosing() {
74
+ return !!this._closingResolvers;
75
+ }
76
+ firstUpdated(changedProperties) {
77
+ super.firstUpdated(changedProperties);
78
+ this._dialog.addEventListener("keydown", __privateGet(this, _keyDownHandler), { capture: true });
79
+ }
80
+ /**
81
+ * Opens the dialog and fires a cancelable `open` event. An `opened` event
82
+ * is fired after the dialog opens.
83
+ *
84
+ * @returns A `Promise` that resolves after the `opened` event was fired.
85
+ */
86
+ async show() {
87
+ this._closingResolvers?.resolve();
88
+ this._closingResolvers = void 0;
89
+ __privateSet(this, _isOpening, true);
90
+ await __privateGet(this, _isConnected).promise;
91
+ await this.updateComplete;
92
+ if (this._dialog.open || !__privateGet(this, _isOpening)) {
93
+ __privateSet(this, _isOpening, false);
94
+ return;
95
+ }
96
+ const wasDispatched = this.dispatchEvent(new Event("open", { cancelable: true }));
97
+ if (!wasDispatched) {
98
+ this.open = false;
99
+ __privateSet(this, _isOpening, false);
100
+ return;
101
+ }
102
+ this._dialog.showModal();
103
+ this.open = true;
104
+ this.dispatchEvent(new Event("opened"));
105
+ __privateSet(this, _isOpening, false);
106
+ }
107
+ /**
108
+ * Closes the dialog and fires a cancelable `close` event. After a dialog's
109
+ * animation, a `closed` event is fired.
110
+ *
111
+ */
112
+ async close() {
113
+ if (this._closingResolvers) {
114
+ return;
115
+ }
116
+ __privateSet(this, _isOpening, false);
117
+ if (!this.isConnected) {
118
+ this.open = false;
119
+ return;
120
+ }
121
+ await this.updateComplete;
122
+ if (!this._dialog.open || __privateGet(this, _isOpening)) {
123
+ this.open = false;
124
+ return;
125
+ }
126
+ const wasDispatched = this.dispatchEvent(new Event("close", { cancelable: true }));
127
+ if (!wasDispatched) {
128
+ return;
129
+ }
130
+ this._closingResolvers = (0, import_utils.promiseWithResolvers)();
131
+ this.open = false;
132
+ return this._closingResolvers.promise;
133
+ }
134
+ handleAnimationEnd(e) {
135
+ if (e.animationName === "fadeOut" && !this.open && this._dialog.open && this._closingResolvers) {
136
+ this._closingResolvers.resolve();
137
+ this._closingResolvers = void 0;
138
+ this._dialog.close();
139
+ this.dispatchEvent(new Event("closed"));
140
+ }
141
+ }
142
+ connectedCallback() {
143
+ super.connectedCallback();
144
+ __privateGet(this, _isConnected).resolve();
145
+ }
146
+ disconnectedCallback() {
147
+ super.disconnectedCallback();
148
+ __privateSet(this, _isConnected, Promise.withResolvers());
149
+ this._dialog.removeEventListener("keydown", __privateGet(this, _keyDownHandler), { capture: true });
150
+ }
151
+ handleContentClick() {
152
+ __privateSet(this, _nextClickIsFromContent, true);
153
+ }
154
+ handleDialogClick() {
155
+ if (__privateGet(this, _nextClickIsFromContent)) {
156
+ __privateSet(this, _nextClickIsFromContent, false);
157
+ return;
158
+ }
159
+ this.handleCancel();
160
+ }
161
+ handleCancel(e) {
162
+ if (this.disabled || this._closingResolvers) {
163
+ e?.preventDefault();
164
+ e?.stopPropagation();
165
+ return;
166
+ }
167
+ const wasDispatched = this.dispatchEvent(new Event("cancel", { cancelable: true }));
168
+ if (!wasDispatched) {
169
+ e?.preventDefault();
170
+ e?.stopPropagation();
171
+ return;
172
+ }
173
+ this.close();
174
+ }
175
+ }
176
+ _isOpen = new WeakMap();
177
+ _isOpening = new WeakMap();
178
+ _isConnected = new WeakMap();
179
+ _nextClickIsFromContent = new WeakMap();
180
+ _keyDownHandler = new WeakMap();
181
+ BaseModal.shadowRootOptions = {
182
+ ...import_lit.LitElement.shadowRootOptions,
183
+ delegatesFocus: true
184
+ };
185
+ __decorateClass([
186
+ (0, import_decorators.property)({ type: Boolean })
187
+ ], BaseModal.prototype, "open", 1);
188
+ __decorateClass([
189
+ (0, import_decorators.property)()
190
+ ], BaseModal.prototype, "disabled", 2);
191
+ __decorateClass([
192
+ (0, import_decorators.query)("dialog")
193
+ ], BaseModal.prototype, "_dialog", 2);
194
+ __decorateClass([
195
+ (0, import_decorators.state)()
196
+ ], BaseModal.prototype, "_closingResolvers", 2);
197
+ //# sourceMappingURL=base-modal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/base-modal.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LitElement } from 'lit';\nimport type { PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { promiseWithResolvers } from '@haneullabs/utils';\nimport type { PromiseWithResolvers } from '@haneullabs/utils';\n\nexport class BaseModal extends LitElement {\n\t#isOpen = false;\n\t#isOpening = false;\n\t#isConnected = promiseWithResolvers<void>();\n\t#nextClickIsFromContent = false;\n\n\tstatic override shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tdelegatesFocus: true,\n\t};\n\n\t/**\n\t * Opens the dialog when set to `true` and closes it when set to `false`.\n\t */\n\t@property({ type: Boolean })\n\tget open() {\n\t\treturn this.#isOpen;\n\t}\n\n\tset open(open: boolean) {\n\t\tif (open === this.#isOpen) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#isOpen = open;\n\t\tif (this.#isOpen) {\n\t\t\tthis.setAttribute('open', '');\n\t\t\tthis.show();\n\t\t} else {\n\t\t\tthis.removeAttribute('open');\n\t\t\tthis.close();\n\t\t}\n\t}\n\t@property()\n\tdisabled: boolean = false;\n\n\t@query('dialog')\n\tprivate readonly _dialog!: HTMLDialogElement;\n\n\t@state()\n\tprotected _closingResolvers?: PromiseWithResolvers<void>;\n\n\t#keyDownHandler = (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape' && this.open) {\n\t\t\tthis.handleCancel(e);\n\t\t}\n\t};\n\n\tprotected get _isClosing() {\n\t\treturn !!this._closingResolvers;\n\t}\n\n\toverride firstUpdated(changedProperties: PropertyValues) {\n\t\tsuper.firstUpdated(changedProperties);\n\t\t// NOTE: there is a bug in Chrome where even after canceling the dialog cancel event still closes the dialog. (The second time the user clicks escape)\n\t\t// Using this handler to mitigate this issue.\n\t\tthis._dialog.addEventListener('keydown', this.#keyDownHandler, { capture: true });\n\t}\n\n\t/**\n\t * Opens the dialog and fires a cancelable `open` event. An `opened` event\n\t * is fired after the dialog opens.\n\t *\n\t * @returns A `Promise` that resolves after the `opened` event was fired.\n\t */\n\tasync show() {\n\t\tthis._closingResolvers?.resolve();\n\t\tthis._closingResolvers = undefined;\n\t\tthis.#isOpening = true;\n\n\t\t// Dialogs can be opened before being attached to the DOM, so we need to\n\t\t// wait until we're connected before calling `showModal()`.\n\t\tawait this.#isConnected.promise;\n\t\tawait this.updateComplete;\n\n\t\t// Check if already opened or if `dialog.close()` was called while awaiting.\n\t\tif (this._dialog.open || !this.#isOpening) {\n\t\t\tthis.#isOpening = false;\n\t\t\treturn;\n\t\t}\n\n\t\tconst wasDispatched = this.dispatchEvent(new Event('open', { cancelable: true }));\n\t\tif (!wasDispatched) {\n\t\t\tthis.open = false;\n\t\t\tthis.#isOpening = false;\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dialog.showModal();\n\t\tthis.open = true;\n\n\t\tthis.dispatchEvent(new Event('opened'));\n\t\tthis.#isOpening = false;\n\t}\n\n\t/**\n\t * Closes the dialog and fires a cancelable `close` event. After a dialog's\n\t * animation, a `closed` event is fired.\n\t *\n\t */\n\tasync close() {\n\t\tif (this._closingResolvers) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#isOpening = false;\n\n\t\tif (!this.isConnected) {\n\t\t\t// Disconnected dialogs do not fire close events or animate.\n\t\t\tthis.open = false;\n\t\t\treturn;\n\t\t}\n\n\t\tawait this.updateComplete;\n\n\t\t// Check if already closed or if `dialog.show()` was called while awaiting.\n\t\tif (!this._dialog.open || this.#isOpening) {\n\t\t\tthis.open = false;\n\t\t\treturn;\n\t\t}\n\n\t\tconst wasDispatched = this.dispatchEvent(new Event('close', { cancelable: true }));\n\t\tif (!wasDispatched) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._closingResolvers = promiseWithResolvers<void>();\n\t\tthis.open = false;\n\n\t\treturn this._closingResolvers.promise;\n\t}\n\n\tprotected handleAnimationEnd(e: AnimationEvent) {\n\t\tif (\n\t\t\te.animationName === 'fadeOut' &&\n\t\t\t!this.open &&\n\t\t\tthis._dialog.open &&\n\t\t\tthis._closingResolvers\n\t\t) {\n\t\t\tthis._closingResolvers.resolve();\n\t\t\tthis._closingResolvers = undefined;\n\t\t\tthis._dialog.close();\n\t\t\tthis.dispatchEvent(new Event('closed'));\n\t\t}\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis.#isConnected.resolve();\n\t}\n\n\toverride disconnectedCallback() {\n\t\tsuper.disconnectedCallback();\n\t\tthis.#isConnected = Promise.withResolvers<void>();\n\t\tthis._dialog.removeEventListener('keydown', this.#keyDownHandler, { capture: true });\n\t}\n\n\tprotected handleContentClick() {\n\t\tthis.#nextClickIsFromContent = true;\n\t}\n\n\tprotected handleDialogClick() {\n\t\tif (this.#nextClickIsFromContent) {\n\t\t\t// This trick uses event bubbling to determine whether or not the click originated\n\t\t\t// from the dialog content or dialog backdrop psuedo-element. If you click the dialog\n\t\t\t// content, then `nextClickIsFromContent` will be set to true and we'll early exit.\n\t\t\tthis.#nextClickIsFromContent = false;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.handleCancel();\n\t}\n\n\tprotected handleCancel(e?: Event) {\n\t\tif (this.disabled || this._closingResolvers) {\n\t\t\te?.preventDefault();\n\t\t\te?.stopPropagation();\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst wasDispatched = this.dispatchEvent(new Event('cancel', { cancelable: true }));\n\n\t\tif (!wasDispatched) {\n\t\t\te?.preventDefault();\n\t\t\te?.stopPropagation();\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.close();\n\t}\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,24 @@
1
+ import { BaseModal } from './base-modal.js';
2
+ /**
3
+ * A modal component for displaying wallet operation request fallback UI.
4
+ *
5
+ * @element enoki-connect-modal
6
+ *
7
+ * @prop {string} walletName - The name of the wallet.
8
+ * @prop {string} dappName - The name of the dapp.
9
+ * @prop {boolean} disabled - Whether the modal is disabled.
10
+ * @prop {boolean} open - Whether the modal is open.
11
+ *
12
+ */
13
+ export declare class EnokiConnectModal extends BaseModal {
14
+ #private;
15
+ static styles: import("lit").CSSResult;
16
+ walletName: string;
17
+ dappName: string;
18
+ render(): import("lit").TemplateResult<1>;
19
+ }
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ 'enoki-connect-modal': EnokiConnectModal;
23
+ }
24
+ }