@pezkuwi/vue-identicon 3.16.6 → 3.16.8
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/package.json +181 -6
- package/build/Identicon.js +0 -111
- package/build/README.md +0 -37
- package/build/bundle.js +0 -2
- package/build/cjs/Identicon.d.ts +0 -28
- package/build/cjs/Identicon.js +0 -115
- package/build/cjs/bundle.d.ts +0 -2
- package/build/cjs/bundle.js +0 -7
- package/build/cjs/icons/Beachball.js +0 -21
- package/build/cjs/icons/Empty.js +0 -16
- package/build/cjs/icons/Jdenticon.js +0 -19
- package/build/cjs/icons/Polkadot.js +0 -24
- package/build/cjs/icons/index.js +0 -7
- package/build/cjs/index.js +0 -7
- package/build/cjs/packageInfo.js +0 -4
- package/build/cjs/util.js +0 -15
- package/build/icons/Beachball.d.ts +0 -17
- package/build/icons/Beachball.js +0 -18
- package/build/icons/Empty.d.ts +0 -11
- package/build/icons/Empty.js +0 -13
- package/build/icons/Jdenticon.d.ts +0 -14
- package/build/icons/Jdenticon.js +0 -15
- package/build/icons/Polkadot.d.ts +0 -17
- package/build/icons/Polkadot.js +0 -21
- package/build/icons/index.d.ts +0 -4
- package/build/icons/index.js +0 -4
- package/build/index.d.ts +0 -4
- package/build/index.js +0 -4
- package/build/package.json +0 -213
- package/build/packageDetect.d.ts +0 -1
- package/build/packageDetect.js +0 -4
- package/build/packageInfo.d.ts +0 -6
- package/build/packageInfo.js +0 -1
- package/build/util.d.ts +0 -6
- package/build/util.js +0 -12
- package/build-tsc-cjs/packageDetect.js +0 -6
- package/index.html +0 -17
- package/src/Identicon.ts +0 -141
- package/src/bundle.ts +0 -5
- package/src/icons/Beachball.ts +0 -32
- package/src/icons/Empty.ts +0 -17
- package/src/icons/Jdenticon.ts +0 -27
- package/src/icons/Polkadot.ts +0 -38
- package/src/icons/index.ts +0 -7
- package/src/index.ts +0 -10
- package/src/packageDetect.ts +0 -12
- package/src/packageInfo.ts +0 -6
- package/src/util.ts +0 -17
- package/tsconfig.build.json +0 -11
- package/tsconfig.build.tsbuildinfo +0 -1
- /package/{build-tsc/Identicon.d.ts → Identicon.d.ts} +0 -0
- /package/{build-tsc-esm/Identicon.js → Identicon.js} +0 -0
- /package/{build/LICENSE → LICENSE} +0 -0
- /package/{build/bundle-pezkuwi-vue-identicon.js → bundle-pezkuwi-vue-identicon.js} +0 -0
- /package/{build-tsc/bundle.d.ts → bundle.d.ts} +0 -0
- /package/{build-tsc-esm/bundle.js → bundle.js} +0 -0
- /package/{build → cjs}/Identicon.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/Identicon.js +0 -0
- /package/{build → cjs}/bundle.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/bundle.js +0 -0
- /package/{build-tsc → cjs}/icons/Beachball.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Beachball.js +0 -0
- /package/{build-tsc → cjs}/icons/Empty.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Empty.js +0 -0
- /package/{build-tsc → cjs}/icons/Jdenticon.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Jdenticon.js +0 -0
- /package/{build-tsc → cjs}/icons/Polkadot.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Polkadot.js +0 -0
- /package/{build-tsc → cjs}/icons/index.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/index.js +0 -0
- /package/{build-tsc → cjs}/index.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/index.js +0 -0
- /package/{build/cjs → cjs}/package.json +0 -0
- /package/{build-tsc → cjs}/packageDetect.d.ts +0 -0
- /package/{build/cjs → cjs}/packageDetect.js +0 -0
- /package/{build-tsc → cjs}/packageInfo.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/packageInfo.js +0 -0
- /package/{build-tsc → cjs}/util.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/util.js +0 -0
- /package/{build/cjs/icons → icons}/Beachball.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Beachball.js +0 -0
- /package/{build/cjs/icons → icons}/Empty.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Empty.js +0 -0
- /package/{build/cjs/icons → icons}/Jdenticon.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Jdenticon.js +0 -0
- /package/{build/cjs/icons → icons}/Polkadot.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Polkadot.js +0 -0
- /package/{build/cjs/icons → icons}/index.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/index.js +0 -0
- /package/{build/cjs/index.d.ts → index.d.ts} +0 -0
- /package/{build-tsc-esm/index.js → index.js} +0 -0
- /package/{build/cjs/packageDetect.d.ts → packageDetect.d.ts} +0 -0
- /package/{build-tsc-esm/packageDetect.js → packageDetect.js} +0 -0
- /package/{build/cjs/packageInfo.d.ts → packageInfo.d.ts} +0 -0
- /package/{build-tsc-esm/packageInfo.js → packageInfo.js} +0 -0
- /package/{build/cjs/util.d.ts → util.d.ts} +0 -0
- /package/{build-tsc-esm/util.js → util.js} +0 -0
package/package.json
CHANGED
|
@@ -15,11 +15,189 @@
|
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": [
|
|
17
17
|
"./packageDetect.js",
|
|
18
|
-
"./packageDetect.
|
|
18
|
+
"./cjs/packageDetect.js"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "3.16.
|
|
22
|
-
"main": "index.js",
|
|
21
|
+
"version": "3.16.8",
|
|
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
|
+
},
|
|
23
201
|
"dependencies": {
|
|
24
202
|
"@pezkuwi/ui-shared": "3.16.6",
|
|
25
203
|
"@pezkuwi/util": "^14.0.5",
|
|
@@ -27,9 +205,6 @@
|
|
|
27
205
|
"jdenticon": "3.2.0",
|
|
28
206
|
"tslib": "^2.8.1"
|
|
29
207
|
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"vue": "^2.7.16"
|
|
32
|
-
},
|
|
33
208
|
"peerDependencies": {
|
|
34
209
|
"@pezkuwi/util": "*",
|
|
35
210
|
"@pezkuwi/util-crypto": "*",
|
package/build/Identicon.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
2
|
-
import { isHex, isU8a, u8aToHex } from '@pezkuwi/util';
|
|
3
|
-
import { decodeAddress, encodeAddress, isEthereumAddress } from '@pezkuwi/util-crypto';
|
|
4
|
-
import { Beachball, Empty, Jdenticon, Polkadot } from './icons/index.js';
|
|
5
|
-
import { adaptVNodeAttrs } from './util.js';
|
|
6
|
-
const DEFAULT_SIZE = 64;
|
|
7
|
-
function resolvePublicKey(value, prefix) {
|
|
8
|
-
if (isHex(value) && isEthereumAddress(value)) {
|
|
9
|
-
return value.padEnd(66, '0');
|
|
10
|
-
}
|
|
11
|
-
return isU8a(value) || isHex(value)
|
|
12
|
-
? encodeAddress(value, prefix)
|
|
13
|
-
: value;
|
|
14
|
-
}
|
|
15
|
-
export function encodeAccount(value, prefix) {
|
|
16
|
-
try {
|
|
17
|
-
const address = resolvePublicKey(value, prefix);
|
|
18
|
-
const publicKey = u8aToHex(decodeAddress(address, false, prefix));
|
|
19
|
-
return { address, publicKey };
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return { address: '', publicKey: '0x' };
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @name Identicon
|
|
27
|
-
* @description The main Identicon component, taking a number of properties
|
|
28
|
-
* @example
|
|
29
|
-
* ```html
|
|
30
|
-
* <Identicon :size="128" :theme="polkadot" :value="..." />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export const Identicon = defineComponent({
|
|
34
|
-
components: {
|
|
35
|
-
Beachball,
|
|
36
|
-
Empty,
|
|
37
|
-
Jdenticon,
|
|
38
|
-
Polkadot
|
|
39
|
-
},
|
|
40
|
-
created: function () {
|
|
41
|
-
this.createData();
|
|
42
|
-
},
|
|
43
|
-
data: function () {
|
|
44
|
-
return {
|
|
45
|
-
address: '',
|
|
46
|
-
iconSize: DEFAULT_SIZE,
|
|
47
|
-
isAlternativeIcon: false,
|
|
48
|
-
publicKey: '0x',
|
|
49
|
-
type: 'empty'
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
methods: {
|
|
53
|
-
createData: function () {
|
|
54
|
-
this.iconSize = this.size || DEFAULT_SIZE;
|
|
55
|
-
this.type = this.theme;
|
|
56
|
-
this.isAlternativeIcon = this.isAlternative || false;
|
|
57
|
-
this.recodeAddress();
|
|
58
|
-
},
|
|
59
|
-
recodeAddress: function () {
|
|
60
|
-
const { address, publicKey } = encodeAccount(this.value);
|
|
61
|
-
this.address = address;
|
|
62
|
-
this.publicKey = publicKey;
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
props: ['prefix', 'isAlternative', 'size', 'theme', 'value'],
|
|
66
|
-
render() {
|
|
67
|
-
const { address, iconSize, isAlternativeIcon, publicKey, type } = this.$data;
|
|
68
|
-
if (type === 'empty') {
|
|
69
|
-
return h(Empty, {
|
|
70
|
-
...adaptVNodeAttrs({
|
|
71
|
-
key: address,
|
|
72
|
-
size: iconSize
|
|
73
|
-
})
|
|
74
|
-
}, []);
|
|
75
|
-
}
|
|
76
|
-
else if (type === 'jdenticon') {
|
|
77
|
-
return h(Jdenticon, {
|
|
78
|
-
...adaptVNodeAttrs({
|
|
79
|
-
key: address,
|
|
80
|
-
publicKey,
|
|
81
|
-
size: iconSize
|
|
82
|
-
})
|
|
83
|
-
}, []);
|
|
84
|
-
}
|
|
85
|
-
else if (type === 'substrate') {
|
|
86
|
-
throw new Error('substrate type is not supported');
|
|
87
|
-
}
|
|
88
|
-
const cmp = type.charAt(0).toUpperCase() + type.slice(1);
|
|
89
|
-
if (['Beachball', 'Polkadot'].includes(cmp)) {
|
|
90
|
-
const component = cmp === 'Beachball'
|
|
91
|
-
? Beachball
|
|
92
|
-
: Polkadot;
|
|
93
|
-
return h(component, {
|
|
94
|
-
...adaptVNodeAttrs({
|
|
95
|
-
address,
|
|
96
|
-
isAlternative: isAlternativeIcon,
|
|
97
|
-
key: address,
|
|
98
|
-
size: iconSize
|
|
99
|
-
})
|
|
100
|
-
}, []);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return h(cmp, {}, []);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
watch: {
|
|
107
|
-
value: function () {
|
|
108
|
-
this.recodeAddress();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
});
|
package/build/README.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# @pezkuwi/vue-identicon
|
|
2
|
-
|
|
3
|
-
A generic identity icon that can render icons based on an address.
|
|
4
|
-
|
|
5
|
-
## Usage Examples
|
|
6
|
-
|
|
7
|
-
To install the component, do `yarn add @pezkuwi/vue-identicon` and then use it with `import Identicon from '@pezkuwi/vue-identicon';`
|
|
8
|
-
|
|
9
|
-
Inside a Vue component, you can now render any account with the associated icon, with associated props -
|
|
10
|
-
|
|
11
|
-
- `value` - the address you wish to display
|
|
12
|
-
- `size` (optional, defaults to `64`) - the size in pixels
|
|
13
|
-
- `theme` (optional, defaults to `substrate`) - the theme to use, one of
|
|
14
|
-
- `polkadot` or
|
|
15
|
-
- `substrate` (equivalent to `jdenticon`) or
|
|
16
|
-
- `beachball` or
|
|
17
|
-
- `empty` (displays nothing)
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
<template>
|
|
21
|
-
<Identicon
|
|
22
|
-
:size="128"
|
|
23
|
-
:theme="'polkadot'"
|
|
24
|
-
:value="'5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'"
|
|
25
|
-
/>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script>
|
|
29
|
-
import Identicon from '@pezkuwi/vue-identicon';
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
...
|
|
33
|
-
components: { Identicon }
|
|
34
|
-
...
|
|
35
|
-
};
|
|
36
|
-
</script>
|
|
37
|
-
```
|
package/build/bundle.js
DELETED
package/build/cjs/Identicon.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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 {};
|
package/build/cjs/Identicon.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
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
|
-
});
|
package/build/cjs/bundle.d.ts
DELETED
package/build/cjs/bundle.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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; } });
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
});
|
package/build/cjs/icons/Empty.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
});
|
package/build/cjs/icons/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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);
|
package/build/cjs/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
package/build/cjs/packageInfo.js
DELETED
package/build/cjs/util.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}>;
|
package/build/icons/Beachball.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
2
|
-
import { beachballIcon } from '@pezkuwi/ui-shared';
|
|
3
|
-
/**
|
|
4
|
-
* @name Beachball
|
|
5
|
-
* @description The Beachball identicon
|
|
6
|
-
*/
|
|
7
|
-
export const Beachball = defineComponent({
|
|
8
|
-
props: ['address', 'size', 'isAlternative'],
|
|
9
|
-
render() {
|
|
10
|
-
const { address, isAlternative, size } = this.$props;
|
|
11
|
-
return h({
|
|
12
|
-
template: beachballIcon(address, {
|
|
13
|
-
isAlternative,
|
|
14
|
-
size
|
|
15
|
-
}).outerHTML
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|