@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/build/icons/Empty.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}>;
|
package/build/icons/Empty.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* @name Empty
|
|
4
|
-
* @description An empty identicon
|
|
5
|
-
*/
|
|
6
|
-
export const Empty = defineComponent({
|
|
7
|
-
props: ['size'],
|
|
8
|
-
template: `
|
|
9
|
-
<svg :height="size" :width="size" viewBox="0 0 64 64">
|
|
10
|
-
<circle cx="50%" cy="50%" fill="#eee" r="50%" />
|
|
11
|
-
</svg>
|
|
12
|
-
`
|
|
13
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}>;
|
package/build/icons/Jdenticon.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as jdenticon from 'jdenticon';
|
|
2
|
-
import { defineComponent, h } from 'vue';
|
|
3
|
-
/**
|
|
4
|
-
* @name Jdenticon
|
|
5
|
-
* @description The substrate default via Jdenticon
|
|
6
|
-
*/
|
|
7
|
-
export const Jdenticon = defineComponent({
|
|
8
|
-
props: ['publicKey', 'size'],
|
|
9
|
-
render() {
|
|
10
|
-
const { publicKey, size } = this.$props;
|
|
11
|
-
return h({
|
|
12
|
-
template: jdenticon.toSvg(publicKey.substring(2), size)
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}>;
|
package/build/icons/Polkadot.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
2
|
-
import { polkadotIcon } from '@pezkuwi/ui-shared';
|
|
3
|
-
import { adaptVNodeAttrs } from '../util.js';
|
|
4
|
-
/**
|
|
5
|
-
* @name Polkadot
|
|
6
|
-
* @description The Polkadot default identicon
|
|
7
|
-
*/
|
|
8
|
-
export const Polkadot = defineComponent({
|
|
9
|
-
props: ['address', 'isAlternative', 'size'],
|
|
10
|
-
render() {
|
|
11
|
-
const { address, isAlternative, size } = this.$props;
|
|
12
|
-
const circles = polkadotIcon(address, { isAlternative }).map(({ cx, cy, fill, r }) => h('circle', { ...adaptVNodeAttrs({ cx, cy, fill, r }) }, []));
|
|
13
|
-
return h('svg', {
|
|
14
|
-
...adaptVNodeAttrs({
|
|
15
|
-
height: size,
|
|
16
|
-
viewBox: '0 0 64 64',
|
|
17
|
-
width: size
|
|
18
|
-
})
|
|
19
|
-
}, circles);
|
|
20
|
-
}
|
|
21
|
-
});
|
package/build/icons/index.d.ts
DELETED
package/build/icons/index.js
DELETED
package/build/index.d.ts
DELETED
package/build/index.js
DELETED
package/build/package.json
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
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
|
-
}
|
package/build/packageDetect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/packageDetect.js
DELETED
package/build/packageInfo.d.ts
DELETED
package/build/packageInfo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
package/build/util.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
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]);
|
package/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" />
|
|
4
|
-
<style>
|
|
5
|
-
#demo {
|
|
6
|
-
padding: 0.5em;
|
|
7
|
-
}
|
|
8
|
-
.padded {
|
|
9
|
-
margin: 0.5em !important;
|
|
10
|
-
}
|
|
11
|
-
</style>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<div id="demo"></div>
|
|
15
|
-
<script src="./build/Demo.js"></script>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
package/src/Identicon.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/vue-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { VNode } from 'vue';
|
|
5
|
-
import type { Prefix } from '@pezkuwi/util-crypto/address/types';
|
|
6
|
-
|
|
7
|
-
import { defineComponent, h } from 'vue';
|
|
8
|
-
|
|
9
|
-
import { isHex, isU8a, u8aToHex } from '@pezkuwi/util';
|
|
10
|
-
import { decodeAddress, encodeAddress, isEthereumAddress } from '@pezkuwi/util-crypto';
|
|
11
|
-
|
|
12
|
-
import { Beachball, Empty, Jdenticon, Polkadot } from './icons/index.js';
|
|
13
|
-
import { adaptVNodeAttrs } from './util.js';
|
|
14
|
-
|
|
15
|
-
interface Account {
|
|
16
|
-
address: string;
|
|
17
|
-
publicKey: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface Data {
|
|
21
|
-
address: string;
|
|
22
|
-
iconSize: number;
|
|
23
|
-
isAlternativeIcon: boolean;
|
|
24
|
-
publicKey: string;
|
|
25
|
-
type: 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const DEFAULT_SIZE = 64;
|
|
29
|
-
|
|
30
|
-
function resolvePublicKey (value: string | Uint8Array, prefix?: Prefix): string {
|
|
31
|
-
if (isHex(value) && isEthereumAddress(value)) {
|
|
32
|
-
return value.padEnd(66, '0');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return isU8a(value) || isHex(value)
|
|
36
|
-
? encodeAddress(value as string, prefix)
|
|
37
|
-
: value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function encodeAccount (value: string | Uint8Array, prefix?: Prefix): Account {
|
|
41
|
-
try {
|
|
42
|
-
const address = resolvePublicKey(value, prefix);
|
|
43
|
-
const publicKey = u8aToHex(decodeAddress(address, false, prefix));
|
|
44
|
-
|
|
45
|
-
return { address, publicKey };
|
|
46
|
-
} catch {
|
|
47
|
-
return { address: '', publicKey: '0x' };
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @name Identicon
|
|
53
|
-
* @description The main Identicon component, taking a number of properties
|
|
54
|
-
* @example
|
|
55
|
-
* ```html
|
|
56
|
-
* <Identicon :size="128" :theme="polkadot" :value="..." />
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export const Identicon = defineComponent({
|
|
60
|
-
components: {
|
|
61
|
-
Beachball,
|
|
62
|
-
Empty,
|
|
63
|
-
Jdenticon,
|
|
64
|
-
Polkadot
|
|
65
|
-
},
|
|
66
|
-
created: function (): void {
|
|
67
|
-
this.createData();
|
|
68
|
-
},
|
|
69
|
-
data: function (): Data {
|
|
70
|
-
return {
|
|
71
|
-
address: '',
|
|
72
|
-
iconSize: DEFAULT_SIZE,
|
|
73
|
-
isAlternativeIcon: false,
|
|
74
|
-
publicKey: '0x',
|
|
75
|
-
type: 'empty'
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
methods: {
|
|
79
|
-
createData: function (): void {
|
|
80
|
-
this.iconSize = this.size as number || DEFAULT_SIZE;
|
|
81
|
-
this.type = this.theme as 'empty';
|
|
82
|
-
this.isAlternativeIcon = this.isAlternative as boolean || false;
|
|
83
|
-
this.recodeAddress();
|
|
84
|
-
},
|
|
85
|
-
recodeAddress: function (): void {
|
|
86
|
-
const { address, publicKey } = encodeAccount(this.value as string);
|
|
87
|
-
|
|
88
|
-
this.address = address;
|
|
89
|
-
this.publicKey = publicKey;
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
props: ['prefix', 'isAlternative', 'size', 'theme', 'value'],
|
|
93
|
-
render (): VNode {
|
|
94
|
-
const { address, iconSize, isAlternativeIcon, publicKey, type } = this.$data;
|
|
95
|
-
|
|
96
|
-
if (type === 'empty') {
|
|
97
|
-
return h(Empty, {
|
|
98
|
-
...adaptVNodeAttrs({
|
|
99
|
-
key: address,
|
|
100
|
-
size: iconSize
|
|
101
|
-
})
|
|
102
|
-
}, []);
|
|
103
|
-
} else if (type === 'jdenticon') {
|
|
104
|
-
return h(Jdenticon, {
|
|
105
|
-
...adaptVNodeAttrs(
|
|
106
|
-
{
|
|
107
|
-
key: address,
|
|
108
|
-
publicKey,
|
|
109
|
-
size: iconSize
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
}, []);
|
|
113
|
-
} else if (type === 'substrate') {
|
|
114
|
-
throw new Error('substrate type is not supported');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const cmp = type.charAt(0).toUpperCase() + type.slice(1);
|
|
118
|
-
|
|
119
|
-
if (['Beachball', 'Polkadot'].includes(cmp)) {
|
|
120
|
-
const component = cmp === 'Beachball'
|
|
121
|
-
? Beachball
|
|
122
|
-
: Polkadot;
|
|
123
|
-
|
|
124
|
-
return h(component, {
|
|
125
|
-
...adaptVNodeAttrs({
|
|
126
|
-
address,
|
|
127
|
-
isAlternative: isAlternativeIcon,
|
|
128
|
-
key: address,
|
|
129
|
-
size: iconSize
|
|
130
|
-
})
|
|
131
|
-
}, []);
|
|
132
|
-
} else {
|
|
133
|
-
return h(cmp, {}, []);
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
watch: {
|
|
137
|
-
value: function (): void {
|
|
138
|
-
this.recodeAddress();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
package/src/bundle.ts
DELETED
package/src/icons/Beachball.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/vue-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { VNode } from 'vue';
|
|
5
|
-
|
|
6
|
-
import { defineComponent, h } from 'vue';
|
|
7
|
-
|
|
8
|
-
import { beachballIcon } from '@pezkuwi/ui-shared';
|
|
9
|
-
|
|
10
|
-
interface PropsType {
|
|
11
|
-
address: string;
|
|
12
|
-
size: number;
|
|
13
|
-
isAlternative: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @name Beachball
|
|
18
|
-
* @description The Beachball identicon
|
|
19
|
-
*/
|
|
20
|
-
export const Beachball = defineComponent({
|
|
21
|
-
props: ['address', 'size', 'isAlternative'],
|
|
22
|
-
render (): VNode {
|
|
23
|
-
const { address, isAlternative, size } = this.$props as PropsType;
|
|
24
|
-
|
|
25
|
-
return h({
|
|
26
|
-
template: beachballIcon(address, {
|
|
27
|
-
isAlternative,
|
|
28
|
-
size
|
|
29
|
-
}).outerHTML
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
package/src/icons/Empty.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/vue-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { defineComponent } from 'vue';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name Empty
|
|
8
|
-
* @description An empty identicon
|
|
9
|
-
*/
|
|
10
|
-
export const Empty = defineComponent({
|
|
11
|
-
props: ['size'],
|
|
12
|
-
template: `
|
|
13
|
-
<svg :height="size" :width="size" viewBox="0 0 64 64">
|
|
14
|
-
<circle cx="50%" cy="50%" fill="#eee" r="50%" />
|
|
15
|
-
</svg>
|
|
16
|
-
`
|
|
17
|
-
});
|
package/src/icons/Jdenticon.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/vue-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { VNode } from 'vue';
|
|
5
|
-
|
|
6
|
-
import * as jdenticon from 'jdenticon';
|
|
7
|
-
import { defineComponent, h } from 'vue';
|
|
8
|
-
|
|
9
|
-
interface PropsType {
|
|
10
|
-
publicKey: string,
|
|
11
|
-
size: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @name Jdenticon
|
|
16
|
-
* @description The substrate default via Jdenticon
|
|
17
|
-
*/
|
|
18
|
-
export const Jdenticon = defineComponent({
|
|
19
|
-
props: ['publicKey', 'size'],
|
|
20
|
-
render (): VNode {
|
|
21
|
-
const { publicKey, size } = this.$props as PropsType;
|
|
22
|
-
|
|
23
|
-
return h({
|
|
24
|
-
template: jdenticon.toSvg(publicKey.substring(2), size)
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
package/src/icons/Polkadot.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/vue-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { VNode } from 'vue';
|
|
5
|
-
|
|
6
|
-
import { defineComponent, h } from 'vue';
|
|
7
|
-
|
|
8
|
-
import { polkadotIcon } from '@pezkuwi/ui-shared';
|
|
9
|
-
|
|
10
|
-
import { adaptVNodeAttrs } from '../util.js';
|
|
11
|
-
|
|
12
|
-
interface propsType {
|
|
13
|
-
address: string;
|
|
14
|
-
isAlternative: boolean;
|
|
15
|
-
size: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @name Polkadot
|
|
20
|
-
* @description The Polkadot default identicon
|
|
21
|
-
*/
|
|
22
|
-
export const Polkadot = defineComponent({
|
|
23
|
-
props: ['address', 'isAlternative', 'size'],
|
|
24
|
-
render (): VNode {
|
|
25
|
-
const { address, isAlternative, size } = this.$props as propsType;
|
|
26
|
-
const circles = polkadotIcon(address, { isAlternative }).map(({ cx, cy, fill, r }) =>
|
|
27
|
-
h('circle', { ...adaptVNodeAttrs({ cx, cy, fill, r }) }, [])
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
return h('svg', {
|
|
31
|
-
...adaptVNodeAttrs({
|
|
32
|
-
height: size,
|
|
33
|
-
viewBox: '0 0 64 64',
|
|
34
|
-
width: size
|
|
35
|
-
})
|
|
36
|
-
}, circles);
|
|
37
|
-
}
|
|
38
|
-
});
|
package/src/icons/index.ts
DELETED