@lukso/up-connector 0.4.0-dev.a8c9315
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/LICENSE +201 -0
- package/README.md +280 -0
- package/dist/account-modal.cjs +9 -0
- package/dist/account-modal.cjs.map +1 -0
- package/dist/account-modal.d.cts +16 -0
- package/dist/account-modal.d.ts +16 -0
- package/dist/account-modal.js +9 -0
- package/dist/account-modal.js.map +1 -0
- package/dist/auto-setup.cjs +17 -0
- package/dist/auto-setup.cjs.map +1 -0
- package/dist/auto-setup.d.cts +123 -0
- package/dist/auto-setup.d.ts +123 -0
- package/dist/auto-setup.js +17 -0
- package/dist/auto-setup.js.map +1 -0
- package/dist/avatar-CmUCtW_w.d.cts +205 -0
- package/dist/avatar-CmUCtW_w.d.ts +205 -0
- package/dist/avatar.cjs +12 -0
- package/dist/avatar.cjs.map +1 -0
- package/dist/avatar.d.cts +1 -0
- package/dist/avatar.d.ts +1 -0
- package/dist/avatar.js +12 -0
- package/dist/avatar.js.map +1 -0
- package/dist/backup-modal.cjs +9 -0
- package/dist/backup-modal.cjs.map +1 -0
- package/dist/backup-modal.d.cts +41 -0
- package/dist/backup-modal.d.ts +41 -0
- package/dist/backup-modal.js +9 -0
- package/dist/backup-modal.js.map +1 -0
- package/dist/chunk-3SGSPHOZ.js +595 -0
- package/dist/chunk-3SGSPHOZ.js.map +1 -0
- package/dist/chunk-6AYZOIFY.js +181 -0
- package/dist/chunk-6AYZOIFY.js.map +1 -0
- package/dist/chunk-6N35TCFT.js +852 -0
- package/dist/chunk-6N35TCFT.js.map +1 -0
- package/dist/chunk-7ETKG6KR.cjs +387 -0
- package/dist/chunk-7ETKG6KR.cjs.map +1 -0
- package/dist/chunk-EUXUH3YW.js +15 -0
- package/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/chunk-GFVUWAG4.cjs +158 -0
- package/dist/chunk-GFVUWAG4.cjs.map +1 -0
- package/dist/chunk-IAKQFHFD.cjs +595 -0
- package/dist/chunk-IAKQFHFD.cjs.map +1 -0
- package/dist/chunk-MH7MP7XK.cjs +181 -0
- package/dist/chunk-MH7MP7XK.cjs.map +1 -0
- package/dist/chunk-NWCNJSG3.js +387 -0
- package/dist/chunk-NWCNJSG3.js.map +1 -0
- package/dist/chunk-NXU2DQAV.js +1128 -0
- package/dist/chunk-NXU2DQAV.js.map +1 -0
- package/dist/chunk-ORJK2YGG.cjs +852 -0
- package/dist/chunk-ORJK2YGG.cjs.map +1 -0
- package/dist/chunk-RFA6SEIS.cjs +1128 -0
- package/dist/chunk-RFA6SEIS.cjs.map +1 -0
- package/dist/chunk-XGIT7YUY.js +31 -0
- package/dist/chunk-XGIT7YUY.js.map +1 -0
- package/dist/chunk-XOKG3KIL.cjs +31 -0
- package/dist/chunk-XOKG3KIL.cjs.map +1 -0
- package/dist/chunk-YIWSPI4I.js +158 -0
- package/dist/chunk-YIWSPI4I.js.map +1 -0
- package/dist/chunk-ZBDE64SD.cjs +15 -0
- package/dist/chunk-ZBDE64SD.cjs.map +1 -0
- package/dist/connect-modal/index.cjs +20 -0
- package/dist/connect-modal/index.cjs.map +1 -0
- package/dist/connect-modal/index.d.cts +9 -0
- package/dist/connect-modal/index.d.ts +9 -0
- package/dist/connect-modal/index.js +20 -0
- package/dist/connect-modal/index.js.map +1 -0
- package/dist/index-D2orHGFi.d.cts +8 -0
- package/dist/index-D2orHGFi.d.ts +8 -0
- package/dist/index.cjs +793 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +189 -0
- package/dist/index.d.ts +189 -0
- package/dist/index.js +793 -0
- package/dist/index.js.map +1 -0
- package/dist/restore-modal.cjs +9 -0
- package/dist/restore-modal.cjs.map +1 -0
- package/dist/restore-modal.d.cts +68 -0
- package/dist/restore-modal.d.ts +68 -0
- package/dist/restore-modal.js +9 -0
- package/dist/restore-modal.js.map +1 -0
- package/dist/wagmi-CVuDs_0h.d.cts +386 -0
- package/dist/wagmi-CVuDs_0h.d.ts +386 -0
- package/package.json +158 -0
- package/src/account-modal.ts +142 -0
- package/src/auto-setup.ts +362 -0
- package/src/avatar.ts +1135 -0
- package/src/backup-modal.ts +439 -0
- package/src/connect-modal/components/connection-view.ts +398 -0
- package/src/connect-modal/components/eoa-connection-view.ts +408 -0
- package/src/connect-modal/components/qr-code-view.ts +71 -0
- package/src/connect-modal/connect-modal.base.ts +18 -0
- package/src/connect-modal/connect-modal.config.ts +27 -0
- package/src/connect-modal/connect-modal.templates.ts +21 -0
- package/src/connect-modal/connect-modal.ts +270 -0
- package/src/connect-modal/connect-modal.types.ts +104 -0
- package/src/connect-modal/images/up-cube-glass.png +0 -0
- package/src/connect-modal/index.ts +23 -0
- package/src/connect-modal/services/wagmi.ts +266 -0
- package/src/connect-modal/styles/styles.css +1 -0
- package/src/connect-modal/utils/walletConnectDeepLinkUrl.ts +43 -0
- package/src/connector.ts +544 -0
- package/src/index.ts +62 -0
- package/src/popup-instance.ts +537 -0
- package/src/restore-modal.ts +702 -0
- package/src/styles/index.ts +28 -0
- package/src/styles/styles.css +1 -0
- package/src/types/css-raw.d.ts +4 -0
- package/src/types/images.d.ts +4 -0
- package/src/types.ts +168 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# @lukso/up-connector
|
|
2
|
+
|
|
3
|
+
Universal Profile connector with draggable avatar and responsive connection modal.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎯 **Draggable Avatar** - Floating avatar that snaps to corners and can be hidden at edges
|
|
8
|
+
- 📱 **Responsive Modal** - Mobile-first design that scales from overlay to full-screen
|
|
9
|
+
- ✨ **Smooth Animations** - Beautiful avatar-to-modal animations
|
|
10
|
+
- 🔗 **Connection Management** - Auto-connect, persistence, and state management
|
|
11
|
+
- 🎨 **IconView Integration** - Works with `@lukso/transaction-view-core` components
|
|
12
|
+
- 🌙 **Theme Support** - Light/dark themes with auto-detection
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @lukso/up-connector
|
|
18
|
+
# or
|
|
19
|
+
pnpm add @lukso/up-connector
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
import { createConnector } from '@lukso/up-connector';
|
|
26
|
+
|
|
27
|
+
// Create connector instance
|
|
28
|
+
const connector = createConnector({
|
|
29
|
+
avatar: {
|
|
30
|
+
initialPosition: 'top-right',
|
|
31
|
+
avatarSize: 60
|
|
32
|
+
},
|
|
33
|
+
modal: {
|
|
34
|
+
theme: 'auto',
|
|
35
|
+
closeOnBackdrop: true
|
|
36
|
+
},
|
|
37
|
+
autoConnect: true,
|
|
38
|
+
onConnectionChange: (state, data) => {
|
|
39
|
+
console.log('Connection state:', state, data);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API Reference
|
|
45
|
+
|
|
46
|
+
### UPConnector
|
|
47
|
+
|
|
48
|
+
Main class that orchestrates the avatar and modal components.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
interface ConnectorConfig {
|
|
52
|
+
avatar?: AvatarOptions;
|
|
53
|
+
modal?: ModalOptions;
|
|
54
|
+
autoConnect?: boolean;
|
|
55
|
+
persistConnection?: boolean;
|
|
56
|
+
storageKey?: string;
|
|
57
|
+
chainId?: number;
|
|
58
|
+
rpcUrl?: string;
|
|
59
|
+
onConnectionChange?: (state: ConnectionState, data?: any) => void;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Methods
|
|
64
|
+
|
|
65
|
+
- `connect(providerId?: string)` - Connect to wallet
|
|
66
|
+
- `disconnect()` - Disconnect wallet
|
|
67
|
+
- `showModal()` - Show connection/account modal
|
|
68
|
+
- `hideModal()` - Hide modal
|
|
69
|
+
- `isConnected()` - Check connection status
|
|
70
|
+
- `getConnectionState()` - Get current connection state
|
|
71
|
+
- `getConnectedAddress()` - Get connected wallet address
|
|
72
|
+
- `destroy()` - Clean up and remove components
|
|
73
|
+
|
|
74
|
+
### DraggableAvatar
|
|
75
|
+
|
|
76
|
+
Floating avatar component with drag-and-drop functionality.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
interface AvatarOptions {
|
|
80
|
+
// IconView integration
|
|
81
|
+
address?: string;
|
|
82
|
+
resolved?: AddressData;
|
|
83
|
+
size?: 'x-small' | 'small' | 'medium' | 'large';
|
|
84
|
+
label?: string;
|
|
85
|
+
|
|
86
|
+
// Fallback options
|
|
87
|
+
fallbackColor?: string;
|
|
88
|
+
fallbackText?: string;
|
|
89
|
+
fallbackImage?: string;
|
|
90
|
+
|
|
91
|
+
// Behavior
|
|
92
|
+
avatarSize?: number;
|
|
93
|
+
initialPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
94
|
+
hideThreshold?: number;
|
|
95
|
+
hideOffset?: number;
|
|
96
|
+
|
|
97
|
+
// Callbacks
|
|
98
|
+
onClick?: (event: MouseEvent, data: any) => void;
|
|
99
|
+
onPositionChange?: (position: string) => void;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### ConnectorModal
|
|
104
|
+
|
|
105
|
+
Responsive modal dialog for wallet connection and account management.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
interface ModalOptions {
|
|
109
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
110
|
+
borderRadius?: number;
|
|
111
|
+
closeOnBackdrop?: boolean;
|
|
112
|
+
closeOnEscape?: boolean;
|
|
113
|
+
showCloseButton?: boolean;
|
|
114
|
+
animationDuration?: number;
|
|
115
|
+
|
|
116
|
+
// Animation from avatar
|
|
117
|
+
animateFrom?: {
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
width: number;
|
|
121
|
+
height: number;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Callbacks
|
|
125
|
+
onConnect?: (result: { address: string; provider: any }) => void;
|
|
126
|
+
onDisconnect?: () => void;
|
|
127
|
+
onClose?: () => void;
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Usage Examples
|
|
132
|
+
|
|
133
|
+
### Basic Usage
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
import { createConnector } from '@lukso/up-connector';
|
|
137
|
+
|
|
138
|
+
const connector = createConnector({
|
|
139
|
+
onConnectionChange: (state, data) => {
|
|
140
|
+
if (state === 'connected') {
|
|
141
|
+
console.log('Connected to:', data.address);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### With IconView Integration
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
const connector = createConnector({
|
|
151
|
+
avatar: {
|
|
152
|
+
address: '0x1234567890123456789012345678901234567890',
|
|
153
|
+
size: 'large',
|
|
154
|
+
avatarSize: 80,
|
|
155
|
+
componentLoader: async () => {
|
|
156
|
+
await import('@lukso/transaction-view-core/shared');
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Custom Styling
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const connector = createConnector({
|
|
167
|
+
avatar: {
|
|
168
|
+
fallbackColor: 'linear-gradient(45deg, #ff6b6b, #4ecdc4)',
|
|
169
|
+
fallbackText: '🚀',
|
|
170
|
+
avatarSize: 70
|
|
171
|
+
},
|
|
172
|
+
modal: {
|
|
173
|
+
theme: 'dark',
|
|
174
|
+
borderRadius: 20,
|
|
175
|
+
animationDuration: 400
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### React Integration
|
|
181
|
+
|
|
182
|
+
```jsx
|
|
183
|
+
import { createConnector } from '@lukso/up-connector';
|
|
184
|
+
import { useEffect, useState } from 'react';
|
|
185
|
+
|
|
186
|
+
function WalletConnector() {
|
|
187
|
+
const [connector, setConnector] = useState(null);
|
|
188
|
+
const [isConnected, setIsConnected] = useState(false);
|
|
189
|
+
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
const conn = createConnector({
|
|
192
|
+
onConnectionChange: (state) => {
|
|
193
|
+
setIsConnected(state === 'connected');
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
setConnector(conn);
|
|
197
|
+
|
|
198
|
+
return () => conn.destroy();
|
|
199
|
+
}, []);
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<div>
|
|
203
|
+
<button onClick={() => connector?.showModal()}>
|
|
204
|
+
{isConnected ? 'Account' : 'Connect'}
|
|
205
|
+
</button>
|
|
206
|
+
</div>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Vue Integration
|
|
212
|
+
|
|
213
|
+
```vue
|
|
214
|
+
<template>
|
|
215
|
+
<button @click="showConnector">
|
|
216
|
+
{{ isConnected ? 'Account' : 'Connect' }}
|
|
217
|
+
</button>
|
|
218
|
+
</template>
|
|
219
|
+
|
|
220
|
+
<script setup>
|
|
221
|
+
import { createConnector } from '@lukso/up-connector';
|
|
222
|
+
import { onMounted, onUnmounted, ref } from 'vue';
|
|
223
|
+
|
|
224
|
+
const isConnected = ref(false);
|
|
225
|
+
let connector = null;
|
|
226
|
+
|
|
227
|
+
onMounted(() => {
|
|
228
|
+
connector = createConnector({
|
|
229
|
+
onConnectionChange: (state) => {
|
|
230
|
+
isConnected.value = state === 'connected';
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
onUnmounted(() => {
|
|
236
|
+
connector?.destroy();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const showConnector = () => {
|
|
240
|
+
connector?.showModal();
|
|
241
|
+
};
|
|
242
|
+
</script>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Mobile Design
|
|
246
|
+
|
|
247
|
+
The modal automatically adapts to different screen sizes:
|
|
248
|
+
|
|
249
|
+
- **Desktop** (>640px): Centered overlay modal
|
|
250
|
+
- **Mobile** (≤640px): Bottom sheet that slides up
|
|
251
|
+
- **Small screens** (≤480px): Full-screen takeover
|
|
252
|
+
|
|
253
|
+
The avatar remains draggable and functional on all screen sizes with proper touch event handling.
|
|
254
|
+
|
|
255
|
+
## Animation System
|
|
256
|
+
|
|
257
|
+
The connector features a sophisticated animation system:
|
|
258
|
+
|
|
259
|
+
1. **Avatar-to-Modal**: Modal expands from the avatar's position
|
|
260
|
+
2. **Scale Animation**: Avatar scales during drag operations
|
|
261
|
+
3. **Smooth Transitions**: All state changes are smoothly animated
|
|
262
|
+
4. **Mobile Optimized**: Touch-friendly animations
|
|
263
|
+
|
|
264
|
+
## Debug Logs
|
|
265
|
+
|
|
266
|
+
At runtime we look at the Local Storage `debug` key to show various logs. The following log streams are
|
|
267
|
+
available:
|
|
268
|
+
|
|
269
|
+
- `connect-modal:info` -> Show info logs for connect modal
|
|
270
|
+
|
|
271
|
+
## Browser Support
|
|
272
|
+
|
|
273
|
+
- Chrome/Edge 88+
|
|
274
|
+
- Firefox 85+
|
|
275
|
+
- Safari 14+
|
|
276
|
+
- Mobile browsers with modern JavaScript support
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkGFVUWAG4cjs = require('./chunk-GFVUWAG4.cjs');
|
|
4
|
+
require('./chunk-XOKG3KIL.cjs');
|
|
5
|
+
require('./chunk-ZBDE64SD.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.AccountModal = _chunkGFVUWAG4cjs.AccountModal;
|
|
9
|
+
//# sourceMappingURL=account-modal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/up-connector/dist/account-modal.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,sDAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/up-connector/dist/account-modal.cjs"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { C as CoreLitElement } from './index-D2orHGFi.cjs';
|
|
3
|
+
|
|
4
|
+
declare class AccountModal extends CoreLitElement {
|
|
5
|
+
open: boolean;
|
|
6
|
+
theme: 'light' | 'dark' | 'auto';
|
|
7
|
+
address: string;
|
|
8
|
+
chainId?: number;
|
|
9
|
+
connectorName: string;
|
|
10
|
+
private close;
|
|
11
|
+
private handleDisconnect;
|
|
12
|
+
private getChainName;
|
|
13
|
+
render(): lit.TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { AccountModal };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { C as CoreLitElement } from './index-D2orHGFi.js';
|
|
3
|
+
|
|
4
|
+
declare class AccountModal extends CoreLitElement {
|
|
5
|
+
open: boolean;
|
|
6
|
+
theme: 'light' | 'dark' | 'auto';
|
|
7
|
+
address: string;
|
|
8
|
+
chainId?: number;
|
|
9
|
+
connectorName: string;
|
|
10
|
+
private close;
|
|
11
|
+
private handleDisconnect;
|
|
12
|
+
private getChainName;
|
|
13
|
+
render(): lit.TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { AccountModal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkMH7MP7XKcjs = require('./chunk-MH7MP7XK.cjs');
|
|
8
|
+
require('./chunk-RFA6SEIS.cjs');
|
|
9
|
+
require('./chunk-ZBDE64SD.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.EMBEDDED_WALLET_ID = _chunkMH7MP7XKcjs.EMBEDDED_WALLET_ID; exports.EMBEDDED_WALLET_URL_DEV = _chunkMH7MP7XKcjs.EMBEDDED_WALLET_URL_DEV; exports.EMBEDDED_WALLET_URL_PROD = _chunkMH7MP7XKcjs.EMBEDDED_WALLET_URL_PROD; exports.UP_EXTENSION_ID = _chunkMH7MP7XKcjs.UP_EXTENSION_ID; exports.setupLuksoConnector = _chunkMH7MP7XKcjs.setupLuksoConnector;
|
|
17
|
+
//# sourceMappingURL=auto-setup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/up-connector/dist/auto-setup.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,gWAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/up-connector/dist/auto-setup.cjs"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Config } from '@wagmi/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Auto-setup utilities for LUKSO products
|
|
5
|
+
*
|
|
6
|
+
* Provides zero-config setup for:
|
|
7
|
+
* - Embedded Wallet (passkey-based)
|
|
8
|
+
* - UP Extension (browser extension)
|
|
9
|
+
* - UP Mobile (WalletConnect)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Embedded wallet constants
|
|
14
|
+
*/
|
|
15
|
+
declare const EMBEDDED_WALLET_ID = "dev.lukso.auth";
|
|
16
|
+
declare const EMBEDDED_WALLET_URL_DEV = "http://localhost:9100";
|
|
17
|
+
declare const EMBEDDED_WALLET_URL_PROD = "https://auth-simple.pages.dev";
|
|
18
|
+
/**
|
|
19
|
+
* UP Extension ID
|
|
20
|
+
*/
|
|
21
|
+
declare const UP_EXTENSION_ID = "cloud.universalprofile";
|
|
22
|
+
interface LuksoConnectorConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Embedded wallet configuration
|
|
25
|
+
*/
|
|
26
|
+
embeddedWallet?: {
|
|
27
|
+
/**
|
|
28
|
+
* Enable embedded wallet option (default: true)
|
|
29
|
+
*/
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* URL to the wallet service
|
|
33
|
+
* @default 'http://localhost:9100'
|
|
34
|
+
*/
|
|
35
|
+
url?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Storage key for UP Provider state
|
|
38
|
+
* @default 'up-provider'
|
|
39
|
+
*/
|
|
40
|
+
storageKey?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Display name for the wallet
|
|
43
|
+
* @default 'Create Passkey Wallet'
|
|
44
|
+
*/
|
|
45
|
+
name?: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* WalletConnect configuration for mobile app
|
|
49
|
+
*/
|
|
50
|
+
walletConnect?: {
|
|
51
|
+
/**
|
|
52
|
+
* Enable WalletConnect (default: true)
|
|
53
|
+
*/
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* WalletConnect Project ID
|
|
57
|
+
* @default LUKSO's default project ID
|
|
58
|
+
*/
|
|
59
|
+
projectId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Show QR code modal on mobile devices (default: false)
|
|
62
|
+
*/
|
|
63
|
+
showQrModal?: boolean;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Chain configuration
|
|
67
|
+
*/
|
|
68
|
+
chains?: {
|
|
69
|
+
/**
|
|
70
|
+
* Default chain ID
|
|
71
|
+
* @default 42 (LUKSO mainnet)
|
|
72
|
+
*/
|
|
73
|
+
defaultChainId?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Enable testnet (default: true)
|
|
76
|
+
*/
|
|
77
|
+
enableTestnet?: boolean;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Storage configuration
|
|
81
|
+
*/
|
|
82
|
+
storage?: {
|
|
83
|
+
/**
|
|
84
|
+
* Storage key prefix for wagmi state
|
|
85
|
+
* @default 'up-wagmi'
|
|
86
|
+
*/
|
|
87
|
+
key?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Pass an existing wagmi config instead of auto-creating one
|
|
91
|
+
*/
|
|
92
|
+
wagmiConfig?: any;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Auto-setup LUKSO connector with sensible defaults
|
|
96
|
+
*
|
|
97
|
+
* This function creates a wagmi config and sets up the connect modal
|
|
98
|
+
* with support for:
|
|
99
|
+
* - Embedded Wallet (passkey-based)
|
|
100
|
+
* - UP Extension (auto-detected via EIP-6963)
|
|
101
|
+
* - UP Mobile (WalletConnect)
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Zero config - uses all defaults
|
|
106
|
+
* setupLuksoConnector()
|
|
107
|
+
*
|
|
108
|
+
* // Custom configuration
|
|
109
|
+
* setupLuksoConnector({
|
|
110
|
+
* embeddedWallet: {
|
|
111
|
+
* url: 'https://wallet.example.com'
|
|
112
|
+
* },
|
|
113
|
+
* chains: {
|
|
114
|
+
* defaultChainId: 4201 // LUKSO Testnet
|
|
115
|
+
* }
|
|
116
|
+
* })
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
declare function setupLuksoConnector(config?: LuksoConnectorConfig): Promise<{
|
|
120
|
+
wagmiConfig: Config;
|
|
121
|
+
}>;
|
|
122
|
+
|
|
123
|
+
export { EMBEDDED_WALLET_ID, EMBEDDED_WALLET_URL_DEV, EMBEDDED_WALLET_URL_PROD, type LuksoConnectorConfig, UP_EXTENSION_ID, setupLuksoConnector };
|