@pezkuwi/vue-identicon 3.16.6
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/README.md +37 -0
- package/build/Identicon.d.ts +28 -0
- package/build/Identicon.js +111 -0
- package/build/LICENSE +201 -0
- package/build/README.md +37 -0
- package/build/bundle-pezkuwi-vue-identicon.js +887 -0
- package/build/bundle.d.ts +2 -0
- package/build/bundle.js +2 -0
- package/build/cjs/Identicon.d.ts +28 -0
- package/build/cjs/Identicon.js +115 -0
- package/build/cjs/bundle.d.ts +2 -0
- package/build/cjs/bundle.js +7 -0
- package/build/cjs/icons/Beachball.d.ts +17 -0
- package/build/cjs/icons/Beachball.js +21 -0
- package/build/cjs/icons/Empty.d.ts +11 -0
- package/build/cjs/icons/Empty.js +16 -0
- package/build/cjs/icons/Jdenticon.d.ts +14 -0
- package/build/cjs/icons/Jdenticon.js +19 -0
- package/build/cjs/icons/Polkadot.d.ts +17 -0
- package/build/cjs/icons/Polkadot.js +24 -0
- package/build/cjs/icons/index.d.ts +4 -0
- package/build/cjs/icons/index.js +7 -0
- package/build/cjs/index.d.ts +4 -0
- package/build/cjs/index.js +7 -0
- package/build/cjs/package.json +3 -0
- package/build/cjs/packageDetect.d.ts +1 -0
- package/build/cjs/packageDetect.js +6 -0
- package/build/cjs/packageInfo.d.ts +6 -0
- package/build/cjs/packageInfo.js +4 -0
- package/build/cjs/util.d.ts +6 -0
- package/build/cjs/util.js +15 -0
- package/build/icons/Beachball.d.ts +17 -0
- package/build/icons/Beachball.js +18 -0
- package/build/icons/Empty.d.ts +11 -0
- package/build/icons/Empty.js +13 -0
- package/build/icons/Jdenticon.d.ts +14 -0
- package/build/icons/Jdenticon.js +15 -0
- package/build/icons/Polkadot.d.ts +17 -0
- package/build/icons/Polkadot.js +21 -0
- package/build/icons/index.d.ts +4 -0
- package/build/icons/index.js +4 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +4 -0
- package/build/package.json +213 -0
- package/build/packageDetect.d.ts +1 -0
- package/build/packageDetect.js +4 -0
- package/build/packageInfo.d.ts +6 -0
- package/build/packageInfo.js +1 -0
- package/build/util.d.ts +6 -0
- package/build/util.js +12 -0
- package/build-tsc/Identicon.d.ts +28 -0
- package/build-tsc/bundle.d.ts +2 -0
- package/build-tsc/icons/Beachball.d.ts +17 -0
- package/build-tsc/icons/Empty.d.ts +11 -0
- package/build-tsc/icons/Jdenticon.d.ts +14 -0
- package/build-tsc/icons/Polkadot.d.ts +17 -0
- package/build-tsc/icons/index.d.ts +4 -0
- package/build-tsc/index.d.ts +4 -0
- package/build-tsc/packageDetect.d.ts +1 -0
- package/build-tsc/packageInfo.d.ts +6 -0
- package/build-tsc/util.d.ts +6 -0
- package/build-tsc-cjs/Identicon.js +115 -0
- package/build-tsc-cjs/bundle.js +7 -0
- package/build-tsc-cjs/icons/Beachball.js +21 -0
- package/build-tsc-cjs/icons/Empty.js +16 -0
- package/build-tsc-cjs/icons/Jdenticon.js +19 -0
- package/build-tsc-cjs/icons/Polkadot.js +24 -0
- package/build-tsc-cjs/icons/index.js +7 -0
- package/build-tsc-cjs/index.js +7 -0
- package/build-tsc-cjs/packageDetect.js +6 -0
- package/build-tsc-cjs/packageInfo.js +4 -0
- package/build-tsc-cjs/util.js +15 -0
- package/build-tsc-esm/Identicon.js +111 -0
- package/build-tsc-esm/bundle.js +2 -0
- package/build-tsc-esm/icons/Beachball.js +18 -0
- package/build-tsc-esm/icons/Empty.js +13 -0
- package/build-tsc-esm/icons/Jdenticon.js +15 -0
- package/build-tsc-esm/icons/Polkadot.js +21 -0
- package/build-tsc-esm/icons/index.js +4 -0
- package/build-tsc-esm/index.js +4 -0
- package/build-tsc-esm/packageDetect.js +4 -0
- package/build-tsc-esm/packageInfo.js +1 -0
- package/build-tsc-esm/util.js +12 -0
- package/index.html +17 -0
- package/package.json +38 -0
- package/src/Identicon.ts +141 -0
- package/src/bundle.ts +5 -0
- package/src/icons/Beachball.ts +32 -0
- package/src/icons/Empty.ts +17 -0
- package/src/icons/Jdenticon.ts +27 -0
- package/src/icons/Polkadot.ts +38 -0
- package/src/icons/index.ts +7 -0
- package/src/index.ts +10 -0
- package/src/packageDetect.ts +12 -0
- package/src/packageInfo.ts +6 -0
- package/src/util.ts +17 -0
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Jaco Greeff <jacogr@gmail.com>",
|
|
3
|
+
"bugs": "https://github.com/pezkuwichain/ui/issues",
|
|
4
|
+
"description": "Renders an SVG picture representing an address",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/pezkuwichain/ui/tree/master/packages/vue-identicon#readme",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"name": "@pezkuwi/vue-identicon",
|
|
11
|
+
"repository": {
|
|
12
|
+
"directory": "packages/vue-identicon",
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/pezkuwichain/ui.git"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"./packageDetect.js",
|
|
18
|
+
"./cjs/packageDetect.js"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"version": "3.16.6",
|
|
22
|
+
"main": "./cjs/index.js",
|
|
23
|
+
"module": "./index.js",
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./cjs/package.json": "./cjs/package.json",
|
|
27
|
+
"./cjs/*": "./cjs/*.js",
|
|
28
|
+
".": {
|
|
29
|
+
"module": {
|
|
30
|
+
"types": "./index.d.ts",
|
|
31
|
+
"default": "./index.js"
|
|
32
|
+
},
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./cjs/index.d.ts",
|
|
35
|
+
"default": "./cjs/index.js"
|
|
36
|
+
},
|
|
37
|
+
"default": {
|
|
38
|
+
"types": "./index.d.ts",
|
|
39
|
+
"default": "./index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"./bundle": {
|
|
43
|
+
"module": {
|
|
44
|
+
"types": "./bundle.d.ts",
|
|
45
|
+
"default": "./bundle.js"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./cjs/bundle.d.ts",
|
|
49
|
+
"default": "./cjs/bundle.js"
|
|
50
|
+
},
|
|
51
|
+
"default": {
|
|
52
|
+
"types": "./bundle.d.ts",
|
|
53
|
+
"default": "./bundle.js"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"./icons": {
|
|
57
|
+
"module": {
|
|
58
|
+
"types": "./icons/index.d.ts",
|
|
59
|
+
"default": "./icons/index.js"
|
|
60
|
+
},
|
|
61
|
+
"require": {
|
|
62
|
+
"types": "./cjs/icons/index.d.ts",
|
|
63
|
+
"default": "./cjs/icons/index.js"
|
|
64
|
+
},
|
|
65
|
+
"default": {
|
|
66
|
+
"types": "./icons/index.d.ts",
|
|
67
|
+
"default": "./icons/index.js"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"./icons/Beachball": {
|
|
71
|
+
"module": {
|
|
72
|
+
"types": "./icons/Beachball.d.ts",
|
|
73
|
+
"default": "./icons/Beachball.js"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./cjs/icons/Beachball.d.ts",
|
|
77
|
+
"default": "./cjs/icons/Beachball.js"
|
|
78
|
+
},
|
|
79
|
+
"default": {
|
|
80
|
+
"types": "./icons/Beachball.d.ts",
|
|
81
|
+
"default": "./icons/Beachball.js"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"./icons/Empty": {
|
|
85
|
+
"module": {
|
|
86
|
+
"types": "./icons/Empty.d.ts",
|
|
87
|
+
"default": "./icons/Empty.js"
|
|
88
|
+
},
|
|
89
|
+
"require": {
|
|
90
|
+
"types": "./cjs/icons/Empty.d.ts",
|
|
91
|
+
"default": "./cjs/icons/Empty.js"
|
|
92
|
+
},
|
|
93
|
+
"default": {
|
|
94
|
+
"types": "./icons/Empty.d.ts",
|
|
95
|
+
"default": "./icons/Empty.js"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"./icons/Jdenticon": {
|
|
99
|
+
"module": {
|
|
100
|
+
"types": "./icons/Jdenticon.d.ts",
|
|
101
|
+
"default": "./icons/Jdenticon.js"
|
|
102
|
+
},
|
|
103
|
+
"require": {
|
|
104
|
+
"types": "./cjs/icons/Jdenticon.d.ts",
|
|
105
|
+
"default": "./cjs/icons/Jdenticon.js"
|
|
106
|
+
},
|
|
107
|
+
"default": {
|
|
108
|
+
"types": "./icons/Jdenticon.d.ts",
|
|
109
|
+
"default": "./icons/Jdenticon.js"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"./icons/Polkadot": {
|
|
113
|
+
"module": {
|
|
114
|
+
"types": "./icons/Polkadot.d.ts",
|
|
115
|
+
"default": "./icons/Polkadot.js"
|
|
116
|
+
},
|
|
117
|
+
"require": {
|
|
118
|
+
"types": "./cjs/icons/Polkadot.d.ts",
|
|
119
|
+
"default": "./cjs/icons/Polkadot.js"
|
|
120
|
+
},
|
|
121
|
+
"default": {
|
|
122
|
+
"types": "./icons/Polkadot.d.ts",
|
|
123
|
+
"default": "./icons/Polkadot.js"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"./Identicon": {
|
|
127
|
+
"module": {
|
|
128
|
+
"types": "./Identicon.d.ts",
|
|
129
|
+
"default": "./Identicon.js"
|
|
130
|
+
},
|
|
131
|
+
"require": {
|
|
132
|
+
"types": "./cjs/Identicon.d.ts",
|
|
133
|
+
"default": "./cjs/Identicon.js"
|
|
134
|
+
},
|
|
135
|
+
"default": {
|
|
136
|
+
"types": "./Identicon.d.ts",
|
|
137
|
+
"default": "./Identicon.js"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"./package.json": {
|
|
141
|
+
"require": "./cjs/package.json",
|
|
142
|
+
"default": "./package.json"
|
|
143
|
+
},
|
|
144
|
+
"./packageDetect": {
|
|
145
|
+
"module": {
|
|
146
|
+
"types": "./packageDetect.d.ts",
|
|
147
|
+
"default": "./packageDetect.js"
|
|
148
|
+
},
|
|
149
|
+
"require": {
|
|
150
|
+
"types": "./cjs/packageDetect.d.ts",
|
|
151
|
+
"default": "./cjs/packageDetect.js"
|
|
152
|
+
},
|
|
153
|
+
"default": {
|
|
154
|
+
"types": "./packageDetect.d.ts",
|
|
155
|
+
"default": "./packageDetect.js"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"./packageInfo.js": {
|
|
159
|
+
"module": {
|
|
160
|
+
"types": "./packageInfo.d.ts",
|
|
161
|
+
"default": "./packageInfo.js"
|
|
162
|
+
},
|
|
163
|
+
"require": {
|
|
164
|
+
"types": "./cjs/packageInfo.d.ts",
|
|
165
|
+
"default": "./cjs/packageInfo.js"
|
|
166
|
+
},
|
|
167
|
+
"default": {
|
|
168
|
+
"types": "./packageInfo.d.ts",
|
|
169
|
+
"default": "./packageInfo.js"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"./packageInfo": {
|
|
173
|
+
"module": {
|
|
174
|
+
"types": "./packageInfo.d.ts",
|
|
175
|
+
"default": "./packageInfo.js"
|
|
176
|
+
},
|
|
177
|
+
"require": {
|
|
178
|
+
"types": "./cjs/packageInfo.d.ts",
|
|
179
|
+
"default": "./cjs/packageInfo.js"
|
|
180
|
+
},
|
|
181
|
+
"default": {
|
|
182
|
+
"types": "./packageInfo.d.ts",
|
|
183
|
+
"default": "./packageInfo.js"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"./util": {
|
|
187
|
+
"module": {
|
|
188
|
+
"types": "./util.d.ts",
|
|
189
|
+
"default": "./util.js"
|
|
190
|
+
},
|
|
191
|
+
"require": {
|
|
192
|
+
"types": "./cjs/util.d.ts",
|
|
193
|
+
"default": "./cjs/util.js"
|
|
194
|
+
},
|
|
195
|
+
"default": {
|
|
196
|
+
"types": "./util.d.ts",
|
|
197
|
+
"default": "./util.js"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"dependencies": {
|
|
202
|
+
"@pezkuwi/ui-shared": "3.16.6",
|
|
203
|
+
"@pezkuwi/util": "^14.0.5",
|
|
204
|
+
"@pezkuwi/util-crypto": "^14.0.5",
|
|
205
|
+
"jdenticon": "3.2.0",
|
|
206
|
+
"tslib": "^2.8.1"
|
|
207
|
+
},
|
|
208
|
+
"peerDependencies": {
|
|
209
|
+
"@pezkuwi/util": "*",
|
|
210
|
+
"@pezkuwi/util-crypto": "*",
|
|
211
|
+
"vue": ">= 2.7"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const packageInfo = { name: '@pezkuwi/vue-identicon', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '3.16.6' };
|
package/build/util.d.ts
ADDED
package/build/util.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { version } from 'vue';
|
|
2
|
+
const isV3 = version.startsWith('3.');
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* Adjust attributes to be usable in both Vue 2 and Vue 3 components.
|
|
7
|
+
*/
|
|
8
|
+
export function adaptVNodeAttrs(data) {
|
|
9
|
+
return isV3
|
|
10
|
+
? data
|
|
11
|
+
: { attrs: data };
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Prefix } from '@pezkuwi/util-crypto/address/types';
|
|
2
|
+
interface Account {
|
|
3
|
+
address: string;
|
|
4
|
+
publicKey: string;
|
|
5
|
+
}
|
|
6
|
+
interface Data {
|
|
7
|
+
address: string;
|
|
8
|
+
iconSize: number;
|
|
9
|
+
isAlternativeIcon: boolean;
|
|
10
|
+
publicKey: string;
|
|
11
|
+
type: 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate';
|
|
12
|
+
}
|
|
13
|
+
export declare function encodeAccount(value: string | Uint8Array, prefix?: Prefix): Account;
|
|
14
|
+
/**
|
|
15
|
+
* @name Identicon
|
|
16
|
+
* @description The main Identicon component, taking a number of properties
|
|
17
|
+
* @example
|
|
18
|
+
* ```html
|
|
19
|
+
* <Identicon :size="128" :theme="polkadot" :value="..." />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const Identicon: import("vue").DefineComponent<string[], {}, Data, {}, {
|
|
23
|
+
createData: () => void;
|
|
24
|
+
recodeAddress: () => void;
|
|
25
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<string[]>>, {
|
|
26
|
+
[x: number]: string;
|
|
27
|
+
}>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name Beachball
|
|
3
|
+
* @description The Beachball identicon
|
|
4
|
+
*/
|
|
5
|
+
export declare const Beachball: import("vue").DefineComponent<Readonly<{
|
|
6
|
+
address?: any;
|
|
7
|
+
size?: any;
|
|
8
|
+
isAlternative?: any;
|
|
9
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<Readonly<{
|
|
10
|
+
address?: any;
|
|
11
|
+
size?: any;
|
|
12
|
+
isAlternative?: any;
|
|
13
|
+
}>>>, {
|
|
14
|
+
readonly address?: any;
|
|
15
|
+
readonly size?: any;
|
|
16
|
+
readonly isAlternative?: any;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name Empty
|
|
3
|
+
* @description An empty identicon
|
|
4
|
+
*/
|
|
5
|
+
export declare const Empty: import("vue").DefineComponent<Readonly<{
|
|
6
|
+
size?: any;
|
|
7
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<Readonly<{
|
|
8
|
+
size?: any;
|
|
9
|
+
}>>>, {
|
|
10
|
+
readonly size?: any;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name Jdenticon
|
|
3
|
+
* @description The substrate default via Jdenticon
|
|
4
|
+
*/
|
|
5
|
+
export declare const Jdenticon: import("vue").DefineComponent<Readonly<{
|
|
6
|
+
size?: any;
|
|
7
|
+
publicKey?: any;
|
|
8
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<Readonly<{
|
|
9
|
+
size?: any;
|
|
10
|
+
publicKey?: any;
|
|
11
|
+
}>>>, {
|
|
12
|
+
readonly size?: any;
|
|
13
|
+
readonly publicKey?: any;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name Polkadot
|
|
3
|
+
* @description The Polkadot default identicon
|
|
4
|
+
*/
|
|
5
|
+
export declare const Polkadot: import("vue").DefineComponent<Readonly<{
|
|
6
|
+
address?: any;
|
|
7
|
+
size?: any;
|
|
8
|
+
isAlternative?: any;
|
|
9
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<Readonly<{
|
|
10
|
+
address?: any;
|
|
11
|
+
size?: any;
|
|
12
|
+
isAlternative?: any;
|
|
13
|
+
}>>>, {
|
|
14
|
+
readonly address?: any;
|
|
15
|
+
readonly size?: any;
|
|
16
|
+
readonly isAlternative?: any;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Identicon = void 0;
|
|
4
|
+
exports.encodeAccount = encodeAccount;
|
|
5
|
+
const vue_1 = require("vue");
|
|
6
|
+
const util_1 = require("@pezkuwi/util");
|
|
7
|
+
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
8
|
+
const index_js_1 = require("./icons/index.js");
|
|
9
|
+
const util_js_1 = require("./util.js");
|
|
10
|
+
const DEFAULT_SIZE = 64;
|
|
11
|
+
function resolvePublicKey(value, prefix) {
|
|
12
|
+
if ((0, util_1.isHex)(value) && (0, util_crypto_1.isEthereumAddress)(value)) {
|
|
13
|
+
return value.padEnd(66, '0');
|
|
14
|
+
}
|
|
15
|
+
return (0, util_1.isU8a)(value) || (0, util_1.isHex)(value)
|
|
16
|
+
? (0, util_crypto_1.encodeAddress)(value, prefix)
|
|
17
|
+
: value;
|
|
18
|
+
}
|
|
19
|
+
function encodeAccount(value, prefix) {
|
|
20
|
+
try {
|
|
21
|
+
const address = resolvePublicKey(value, prefix);
|
|
22
|
+
const publicKey = (0, util_1.u8aToHex)((0, util_crypto_1.decodeAddress)(address, false, prefix));
|
|
23
|
+
return { address, publicKey };
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return { address: '', publicKey: '0x' };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @name Identicon
|
|
31
|
+
* @description The main Identicon component, taking a number of properties
|
|
32
|
+
* @example
|
|
33
|
+
* ```html
|
|
34
|
+
* <Identicon :size="128" :theme="polkadot" :value="..." />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
exports.Identicon = (0, vue_1.defineComponent)({
|
|
38
|
+
components: {
|
|
39
|
+
Beachball: index_js_1.Beachball,
|
|
40
|
+
Empty: index_js_1.Empty,
|
|
41
|
+
Jdenticon: index_js_1.Jdenticon,
|
|
42
|
+
Polkadot: index_js_1.Polkadot
|
|
43
|
+
},
|
|
44
|
+
created: function () {
|
|
45
|
+
this.createData();
|
|
46
|
+
},
|
|
47
|
+
data: function () {
|
|
48
|
+
return {
|
|
49
|
+
address: '',
|
|
50
|
+
iconSize: DEFAULT_SIZE,
|
|
51
|
+
isAlternativeIcon: false,
|
|
52
|
+
publicKey: '0x',
|
|
53
|
+
type: 'empty'
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
createData: function () {
|
|
58
|
+
this.iconSize = this.size || DEFAULT_SIZE;
|
|
59
|
+
this.type = this.theme;
|
|
60
|
+
this.isAlternativeIcon = this.isAlternative || false;
|
|
61
|
+
this.recodeAddress();
|
|
62
|
+
},
|
|
63
|
+
recodeAddress: function () {
|
|
64
|
+
const { address, publicKey } = encodeAccount(this.value);
|
|
65
|
+
this.address = address;
|
|
66
|
+
this.publicKey = publicKey;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
props: ['prefix', 'isAlternative', 'size', 'theme', 'value'],
|
|
70
|
+
render() {
|
|
71
|
+
const { address, iconSize, isAlternativeIcon, publicKey, type } = this.$data;
|
|
72
|
+
if (type === 'empty') {
|
|
73
|
+
return (0, vue_1.h)(index_js_1.Empty, {
|
|
74
|
+
...(0, util_js_1.adaptVNodeAttrs)({
|
|
75
|
+
key: address,
|
|
76
|
+
size: iconSize
|
|
77
|
+
})
|
|
78
|
+
}, []);
|
|
79
|
+
}
|
|
80
|
+
else if (type === 'jdenticon') {
|
|
81
|
+
return (0, vue_1.h)(index_js_1.Jdenticon, {
|
|
82
|
+
...(0, util_js_1.adaptVNodeAttrs)({
|
|
83
|
+
key: address,
|
|
84
|
+
publicKey,
|
|
85
|
+
size: iconSize
|
|
86
|
+
})
|
|
87
|
+
}, []);
|
|
88
|
+
}
|
|
89
|
+
else if (type === 'substrate') {
|
|
90
|
+
throw new Error('substrate type is not supported');
|
|
91
|
+
}
|
|
92
|
+
const cmp = type.charAt(0).toUpperCase() + type.slice(1);
|
|
93
|
+
if (['Beachball', 'Polkadot'].includes(cmp)) {
|
|
94
|
+
const component = cmp === 'Beachball'
|
|
95
|
+
? index_js_1.Beachball
|
|
96
|
+
: index_js_1.Polkadot;
|
|
97
|
+
return (0, vue_1.h)(component, {
|
|
98
|
+
...(0, util_js_1.adaptVNodeAttrs)({
|
|
99
|
+
address,
|
|
100
|
+
isAlternative: isAlternativeIcon,
|
|
101
|
+
key: address,
|
|
102
|
+
size: iconSize
|
|
103
|
+
})
|
|
104
|
+
}, []);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return (0, vue_1.h)(cmp, {}, []);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
watch: {
|
|
111
|
+
value: function () {
|
|
112
|
+
this.recodeAddress();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageInfo = exports.Identicon = void 0;
|
|
4
|
+
var Identicon_js_1 = require("./Identicon.js");
|
|
5
|
+
Object.defineProperty(exports, "Identicon", { enumerable: true, get: function () { return Identicon_js_1.Identicon; } });
|
|
6
|
+
var packageInfo_js_1 = require("./packageInfo.js");
|
|
7
|
+
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Beachball = void 0;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
const ui_shared_1 = require("@pezkuwi/ui-shared");
|
|
6
|
+
/**
|
|
7
|
+
* @name Beachball
|
|
8
|
+
* @description The Beachball identicon
|
|
9
|
+
*/
|
|
10
|
+
exports.Beachball = (0, vue_1.defineComponent)({
|
|
11
|
+
props: ['address', 'size', 'isAlternative'],
|
|
12
|
+
render() {
|
|
13
|
+
const { address, isAlternative, size } = this.$props;
|
|
14
|
+
return (0, vue_1.h)({
|
|
15
|
+
template: (0, ui_shared_1.beachballIcon)(address, {
|
|
16
|
+
isAlternative,
|
|
17
|
+
size
|
|
18
|
+
}).outerHTML
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Empty = void 0;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
/**
|
|
6
|
+
* @name Empty
|
|
7
|
+
* @description An empty identicon
|
|
8
|
+
*/
|
|
9
|
+
exports.Empty = (0, vue_1.defineComponent)({
|
|
10
|
+
props: ['size'],
|
|
11
|
+
template: `
|
|
12
|
+
<svg :height="size" :width="size" viewBox="0 0 64 64">
|
|
13
|
+
<circle cx="50%" cy="50%" fill="#eee" r="50%" />
|
|
14
|
+
</svg>
|
|
15
|
+
`
|
|
16
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Jdenticon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jdenticon = tslib_1.__importStar(require("jdenticon"));
|
|
6
|
+
const vue_1 = require("vue");
|
|
7
|
+
/**
|
|
8
|
+
* @name Jdenticon
|
|
9
|
+
* @description The substrate default via Jdenticon
|
|
10
|
+
*/
|
|
11
|
+
exports.Jdenticon = (0, vue_1.defineComponent)({
|
|
12
|
+
props: ['publicKey', 'size'],
|
|
13
|
+
render() {
|
|
14
|
+
const { publicKey, size } = this.$props;
|
|
15
|
+
return (0, vue_1.h)({
|
|
16
|
+
template: jdenticon.toSvg(publicKey.substring(2), size)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Polkadot = void 0;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
const ui_shared_1 = require("@pezkuwi/ui-shared");
|
|
6
|
+
const util_js_1 = require("../util.js");
|
|
7
|
+
/**
|
|
8
|
+
* @name Polkadot
|
|
9
|
+
* @description The Polkadot default identicon
|
|
10
|
+
*/
|
|
11
|
+
exports.Polkadot = (0, vue_1.defineComponent)({
|
|
12
|
+
props: ['address', 'isAlternative', 'size'],
|
|
13
|
+
render() {
|
|
14
|
+
const { address, isAlternative, size } = this.$props;
|
|
15
|
+
const circles = (0, ui_shared_1.polkadotIcon)(address, { isAlternative }).map(({ cx, cy, fill, r }) => (0, vue_1.h)('circle', { ...(0, util_js_1.adaptVNodeAttrs)({ cx, cy, fill, r }) }, []));
|
|
16
|
+
return (0, vue_1.h)('svg', {
|
|
17
|
+
...(0, util_js_1.adaptVNodeAttrs)({
|
|
18
|
+
height: size,
|
|
19
|
+
viewBox: '0 0 64 64',
|
|
20
|
+
width: size
|
|
21
|
+
})
|
|
22
|
+
}, circles);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./Beachball.js"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./Empty.js"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./Jdenticon.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./Polkadot.js"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
require("./packageDetect.js");
|
|
5
|
+
const bundle_js_1 = require("./bundle.js");
|
|
6
|
+
tslib_1.__exportStar(require("./bundle.js"), exports);
|
|
7
|
+
exports.default = bundle_js_1.Identicon;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const packageInfo_1 = require("@pezkuwi/ui-shared/packageInfo");
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const packageInfo_js_1 = require("./packageInfo.js");
|
|
6
|
+
(0, util_1.detectPackage)(packageInfo_js_1.packageInfo, null, [packageInfo_1.packageInfo]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adaptVNodeAttrs = adaptVNodeAttrs;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
const isV3 = vue_1.version.startsWith('3.');
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*
|
|
9
|
+
* Adjust attributes to be usable in both Vue 2 and Vue 3 components.
|
|
10
|
+
*/
|
|
11
|
+
function adaptVNodeAttrs(data) {
|
|
12
|
+
return isV3
|
|
13
|
+
? data
|
|
14
|
+
: { attrs: data };
|
|
15
|
+
}
|