@pezkuwi/reactnative-identicon 3.16.8 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{cjs → build}/Identicon.d.ts +1 -1
- package/build/Identicon.js +46 -0
- package/build/README.md +30 -0
- package/build/bundle.js +2 -0
- package/build/cjs/Identicon.d.ts +20 -0
- package/build/cjs/Identicon.js +50 -0
- package/build/cjs/bundle.d.ts +2 -0
- package/build/cjs/bundle.js +7 -0
- package/build/cjs/icons/Empty.js +11 -0
- package/build/cjs/icons/Pezkuwi.js +16 -0
- package/build/cjs/icons/index.d.ts +2 -0
- package/build/cjs/icons/index.js +8 -0
- package/build/cjs/index.js +7 -0
- package/build/cjs/packageInfo.js +4 -0
- package/build/cjs/types.js +2 -0
- package/build/icons/Empty.d.ts +3 -0
- package/build/icons/Empty.js +7 -0
- package/build/icons/Pezkuwi.d.ts +3 -0
- package/build/icons/Pezkuwi.js +12 -0
- package/build/icons/index.d.ts +2 -0
- package/build/icons/index.js +2 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +4 -0
- package/build/package.json +186 -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/types.d.ts +6 -0
- package/build/types.js +1 -0
- package/{Identicon.d.ts → build-tsc/Identicon.d.ts} +1 -1
- package/build-tsc/icons/index.d.ts +2 -0
- package/{cjs → build-tsc-cjs}/Identicon.js +3 -3
- package/{cjs/icons/Polkadot.js → build-tsc-cjs/icons/Pezkuwi.js} +1 -1
- package/{cjs → build-tsc-cjs}/icons/index.js +3 -3
- package/build-tsc-cjs/packageDetect.js +6 -0
- package/{cjs → build-tsc-cjs}/packageInfo.js +1 -1
- package/{Identicon.js → build-tsc-esm/Identicon.js} +4 -4
- package/{icons/Polkadot.js → build-tsc-esm/icons/Pezkuwi.js} +2 -2
- package/build-tsc-esm/icons/index.js +2 -0
- package/{packageInfo.js → build-tsc-esm/packageInfo.js} +1 -1
- package/package.json +6 -153
- package/src/Identicon.tsx +81 -0
- package/src/bundle.ts +5 -0
- package/src/icons/Empty.tsx +27 -0
- package/src/icons/Pezkuwi.tsx +43 -0
- package/src/icons/index.ts +5 -0
- package/src/index.ts +10 -0
- package/src/packageDetect.ts +12 -0
- package/src/packageInfo.ts +6 -0
- package/src/types.ts +9 -0
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/cjs/icons/index.d.ts +0 -2
- package/icons/index.d.ts +0 -2
- package/icons/index.js +0 -2
- /package/{LICENSE → build/LICENSE} +0 -0
- /package/{cjs → build}/bundle.d.ts +0 -0
- /package/{icons → build/cjs/icons}/Empty.d.ts +0 -0
- /package/{icons/Polkadot.d.ts → build/cjs/icons/Pezkuwi.d.ts} +0 -0
- /package/{index.d.ts → build/cjs/index.d.ts} +0 -0
- /package/{cjs → build/cjs}/package.json +0 -0
- /package/{packageDetect.d.ts → build/cjs/packageDetect.d.ts} +0 -0
- /package/{cjs → build/cjs}/packageDetect.js +0 -0
- /package/{packageInfo.d.ts → build/cjs/packageInfo.d.ts} +0 -0
- /package/{types.d.ts → build/cjs/types.d.ts} +0 -0
- /package/{bundle.d.ts → build-tsc/bundle.d.ts} +0 -0
- /package/{cjs → build-tsc}/icons/Empty.d.ts +0 -0
- /package/{cjs/icons/Polkadot.d.ts → build-tsc/icons/Pezkuwi.d.ts} +0 -0
- /package/{cjs → build-tsc}/index.d.ts +0 -0
- /package/{cjs → build-tsc}/packageDetect.d.ts +0 -0
- /package/{cjs → build-tsc}/packageInfo.d.ts +0 -0
- /package/{cjs → build-tsc}/types.d.ts +0 -0
- /package/{cjs → build-tsc-cjs}/bundle.js +0 -0
- /package/{cjs → build-tsc-cjs}/icons/Empty.js +0 -0
- /package/{cjs → build-tsc-cjs}/index.js +0 -0
- /package/{cjs → build-tsc-cjs}/types.js +0 -0
- /package/{bundle.js → build-tsc-esm/bundle.js} +0 -0
- /package/{icons → build-tsc-esm/icons}/Empty.js +0 -0
- /package/{index.js → build-tsc-esm/index.js} +0 -0
- /package/{packageDetect.js → build-tsc-esm/packageDetect.js} +0 -0
- /package/{types.js → build-tsc-esm/types.js} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { isHex, isU8a, u8aToHex } from '@pezkuwi/util';
|
|
4
|
+
import { decodeAddress, encodeAddress } from '@pezkuwi/util-crypto';
|
|
5
|
+
import { Empty, Pezkuwi } from './icons/index.js';
|
|
6
|
+
const Fallback = Pezkuwi;
|
|
7
|
+
const DEFAULT_SIZE = 64;
|
|
8
|
+
const DEFAULT_THEME = 'pezkuwi';
|
|
9
|
+
const Components = {
|
|
10
|
+
pezkuwi: Pezkuwi
|
|
11
|
+
};
|
|
12
|
+
export default class IdentityIcon extends React.PureComponent {
|
|
13
|
+
state = {
|
|
14
|
+
address: '',
|
|
15
|
+
publicKey: '0x'
|
|
16
|
+
};
|
|
17
|
+
static prefix = undefined;
|
|
18
|
+
static setDefaultPrefix(prefix) {
|
|
19
|
+
IdentityIcon.prefix = prefix;
|
|
20
|
+
}
|
|
21
|
+
static getDerivedStateFromProps({ prefix = IdentityIcon.prefix, value }, prevState) {
|
|
22
|
+
try {
|
|
23
|
+
const address = isU8a(value) || isHex(value)
|
|
24
|
+
? encodeAddress(value, prefix)
|
|
25
|
+
: (value || '');
|
|
26
|
+
const publicKey = u8aToHex(decodeAddress(address, true, prefix));
|
|
27
|
+
return address === prevState.address
|
|
28
|
+
? null
|
|
29
|
+
: { address, publicKey };
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return {
|
|
33
|
+
address: '',
|
|
34
|
+
publicKey: '0x'
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const { size = DEFAULT_SIZE, theme = DEFAULT_THEME } = this.props;
|
|
40
|
+
const { address, publicKey } = this.state;
|
|
41
|
+
const Component = !address
|
|
42
|
+
? Empty
|
|
43
|
+
: Components[theme] || Fallback;
|
|
44
|
+
return (_jsx(Component, { address: address, publicKey: publicKey, size: size }));
|
|
45
|
+
}
|
|
46
|
+
}
|
package/build/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @pezkuwi/reactnative-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/reactnative-identicon`
|
|
8
|
+
|
|
9
|
+
Inside a React component, you can now render any account with the associated icon -
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import Identicon from '@pezkuwi/reactnative-identicon';
|
|
13
|
+
|
|
14
|
+
...
|
|
15
|
+
render () {
|
|
16
|
+
// address is an ss58-encoded address or publicKey (hex string or Uint8Array)
|
|
17
|
+
const { address } = this.props;
|
|
18
|
+
// size (optional) is a number, indicating the size (in pixels, 64 as default)
|
|
19
|
+
const size = 32;
|
|
20
|
+
|
|
21
|
+
// standard className & style props are also available
|
|
22
|
+
return (
|
|
23
|
+
<Identicon
|
|
24
|
+
value={address}
|
|
25
|
+
size={size}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
...
|
|
30
|
+
```
|
package/build/bundle.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Prefix } from '@pezkuwi/util-crypto/address/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
prefix?: Prefix;
|
|
5
|
+
size?: number;
|
|
6
|
+
theme?: 'pezkuwi';
|
|
7
|
+
value?: string | Uint8Array | null;
|
|
8
|
+
}
|
|
9
|
+
interface State {
|
|
10
|
+
address: string;
|
|
11
|
+
publicKey: string;
|
|
12
|
+
}
|
|
13
|
+
export default class IdentityIcon extends React.PureComponent<Props, State> {
|
|
14
|
+
state: State;
|
|
15
|
+
private static prefix?;
|
|
16
|
+
static setDefaultPrefix(prefix: Prefix): void;
|
|
17
|
+
static getDerivedStateFromProps({ prefix, value }: Props, prevState: State): State | null;
|
|
18
|
+
render(): React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
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 Fallback = index_js_1.Pezkuwi;
|
|
10
|
+
const DEFAULT_SIZE = 64;
|
|
11
|
+
const DEFAULT_THEME = 'pezkuwi';
|
|
12
|
+
const Components = {
|
|
13
|
+
pezkuwi: index_js_1.Pezkuwi
|
|
14
|
+
};
|
|
15
|
+
class IdentityIcon extends react_1.default.PureComponent {
|
|
16
|
+
state = {
|
|
17
|
+
address: '',
|
|
18
|
+
publicKey: '0x'
|
|
19
|
+
};
|
|
20
|
+
static prefix = undefined;
|
|
21
|
+
static setDefaultPrefix(prefix) {
|
|
22
|
+
IdentityIcon.prefix = prefix;
|
|
23
|
+
}
|
|
24
|
+
static getDerivedStateFromProps({ prefix = IdentityIcon.prefix, value }, prevState) {
|
|
25
|
+
try {
|
|
26
|
+
const address = (0, util_1.isU8a)(value) || (0, util_1.isHex)(value)
|
|
27
|
+
? (0, util_crypto_1.encodeAddress)(value, prefix)
|
|
28
|
+
: (value || '');
|
|
29
|
+
const publicKey = (0, util_1.u8aToHex)((0, util_crypto_1.decodeAddress)(address, true, prefix));
|
|
30
|
+
return address === prevState.address
|
|
31
|
+
? null
|
|
32
|
+
: { address, publicKey };
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return {
|
|
36
|
+
address: '',
|
|
37
|
+
publicKey: '0x'
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const { size = DEFAULT_SIZE, theme = DEFAULT_THEME } = this.props;
|
|
43
|
+
const { address, publicKey } = this.state;
|
|
44
|
+
const Component = !address
|
|
45
|
+
? index_js_1.Empty
|
|
46
|
+
: Components[theme] || Fallback;
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(Component, { address: address, publicKey: publicKey, size: size }));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.default = IdentityIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./icons/index.js"), exports);
|
|
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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Empty;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const react_native_svg_1 = require("react-native-svg");
|
|
9
|
+
function Empty({ size }) {
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Svg, { height: size, viewBox: '0 0 64 64', width: size, children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: '32', cy: '32', fill: '#eee', r: '32' }) }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Identicon;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const react_native_svg_1 = require("react-native-svg");
|
|
9
|
+
const ui_shared_1 = require("@pezkuwi/ui-shared");
|
|
10
|
+
function renderCircle({ cx, cy, fill, r }, key) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: cx, cy: cy, fill: fill, r: r }, key));
|
|
12
|
+
}
|
|
13
|
+
function Identicon({ address, isAlternative = false, size }) {
|
|
14
|
+
const circles = (0, react_1.useMemo)(() => (0, ui_shared_1.pezkuwiIcon)(address, { isAlternative }), [address, isAlternative]);
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Svg, { height: size, id: address, viewBox: '0 0 64 64', width: size, children: circles.map(renderCircle) }) }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pezkuwi = exports.Empty = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var Empty_js_1 = require("./Empty.js");
|
|
6
|
+
Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return tslib_1.__importDefault(Empty_js_1).default; } });
|
|
7
|
+
var Pezkuwi_js_1 = require("./Pezkuwi.js");
|
|
8
|
+
Object.defineProperty(exports, "Pezkuwi", { enumerable: true, get: function () { return tslib_1.__importDefault(Pezkuwi_js_1).default; } });
|
|
@@ -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 Identicon_js_1 = tslib_1.__importDefault(require("./Identicon.js"));
|
|
6
|
+
tslib_1.__exportStar(require("./bundle.js"), exports);
|
|
7
|
+
exports.default = Identicon_js_1.default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Circle, Svg } from 'react-native-svg';
|
|
5
|
+
export default function Empty({ size }) {
|
|
6
|
+
return (_jsx(View, { children: _jsx(Svg, { height: size, viewBox: '0 0 64 64', width: size, children: _jsx(Circle, { cx: '32', cy: '32', fill: '#eee', r: '32' }) }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Circle as SvgCircle, Svg } from 'react-native-svg';
|
|
5
|
+
import { pezkuwiIcon } from '@pezkuwi/ui-shared';
|
|
6
|
+
function renderCircle({ cx, cy, fill, r }, key) {
|
|
7
|
+
return (_jsx(SvgCircle, { cx: cx, cy: cy, fill: fill, r: r }, key));
|
|
8
|
+
}
|
|
9
|
+
export default function Identicon({ address, isAlternative = false, size }) {
|
|
10
|
+
const circles = useMemo(() => pezkuwiIcon(address, { isAlternative }), [address, isAlternative]);
|
|
11
|
+
return (_jsx(View, { children: _jsx(Svg, { height: size, id: address, viewBox: '0 0 64 64', width: size, children: circles.map(renderCircle) }) }));
|
|
12
|
+
}
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
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/reactnative-identicon#readme",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"name": "@pezkuwi/reactnative-identicon",
|
|
11
|
+
"repository": {
|
|
12
|
+
"directory": "packages/reactnative-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.17.0",
|
|
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/Empty": {
|
|
71
|
+
"module": {
|
|
72
|
+
"types": "./icons/Empty.d.ts",
|
|
73
|
+
"default": "./icons/Empty.js"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./cjs/icons/Empty.d.ts",
|
|
77
|
+
"default": "./cjs/icons/Empty.js"
|
|
78
|
+
},
|
|
79
|
+
"default": {
|
|
80
|
+
"types": "./icons/Empty.d.ts",
|
|
81
|
+
"default": "./icons/Empty.js"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"./icons/Pezkuwi": {
|
|
85
|
+
"module": {
|
|
86
|
+
"types": "./icons/Pezkuwi.d.ts",
|
|
87
|
+
"default": "./icons/Pezkuwi.js"
|
|
88
|
+
},
|
|
89
|
+
"require": {
|
|
90
|
+
"types": "./cjs/icons/Pezkuwi.d.ts",
|
|
91
|
+
"default": "./cjs/icons/Pezkuwi.js"
|
|
92
|
+
},
|
|
93
|
+
"default": {
|
|
94
|
+
"types": "./icons/Pezkuwi.d.ts",
|
|
95
|
+
"default": "./icons/Pezkuwi.js"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"./Identicon": {
|
|
99
|
+
"module": {
|
|
100
|
+
"types": "./Identicon.d.ts",
|
|
101
|
+
"default": "./Identicon.js"
|
|
102
|
+
},
|
|
103
|
+
"require": {
|
|
104
|
+
"types": "./cjs/Identicon.d.ts",
|
|
105
|
+
"default": "./cjs/Identicon.js"
|
|
106
|
+
},
|
|
107
|
+
"default": {
|
|
108
|
+
"types": "./Identicon.d.ts",
|
|
109
|
+
"default": "./Identicon.js"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"./package.json": {
|
|
113
|
+
"require": "./cjs/package.json",
|
|
114
|
+
"default": "./package.json"
|
|
115
|
+
},
|
|
116
|
+
"./packageDetect": {
|
|
117
|
+
"module": {
|
|
118
|
+
"types": "./packageDetect.d.ts",
|
|
119
|
+
"default": "./packageDetect.js"
|
|
120
|
+
},
|
|
121
|
+
"require": {
|
|
122
|
+
"types": "./cjs/packageDetect.d.ts",
|
|
123
|
+
"default": "./cjs/packageDetect.js"
|
|
124
|
+
},
|
|
125
|
+
"default": {
|
|
126
|
+
"types": "./packageDetect.d.ts",
|
|
127
|
+
"default": "./packageDetect.js"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"./packageInfo.js": {
|
|
131
|
+
"module": {
|
|
132
|
+
"types": "./packageInfo.d.ts",
|
|
133
|
+
"default": "./packageInfo.js"
|
|
134
|
+
},
|
|
135
|
+
"require": {
|
|
136
|
+
"types": "./cjs/packageInfo.d.ts",
|
|
137
|
+
"default": "./cjs/packageInfo.js"
|
|
138
|
+
},
|
|
139
|
+
"default": {
|
|
140
|
+
"types": "./packageInfo.d.ts",
|
|
141
|
+
"default": "./packageInfo.js"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"./packageInfo": {
|
|
145
|
+
"module": {
|
|
146
|
+
"types": "./packageInfo.d.ts",
|
|
147
|
+
"default": "./packageInfo.js"
|
|
148
|
+
},
|
|
149
|
+
"require": {
|
|
150
|
+
"types": "./cjs/packageInfo.d.ts",
|
|
151
|
+
"default": "./cjs/packageInfo.js"
|
|
152
|
+
},
|
|
153
|
+
"default": {
|
|
154
|
+
"types": "./packageInfo.d.ts",
|
|
155
|
+
"default": "./packageInfo.js"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"./types": {
|
|
159
|
+
"module": {
|
|
160
|
+
"types": "./types.d.ts",
|
|
161
|
+
"default": "./types.js"
|
|
162
|
+
},
|
|
163
|
+
"require": {
|
|
164
|
+
"types": "./cjs/types.d.ts",
|
|
165
|
+
"default": "./cjs/types.js"
|
|
166
|
+
},
|
|
167
|
+
"default": {
|
|
168
|
+
"types": "./types.d.ts",
|
|
169
|
+
"default": "./types.js"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"dependencies": {
|
|
174
|
+
"@pezkuwi/ui-shared": "3.16.6",
|
|
175
|
+
"@pezkuwi/util": "^14.0.5",
|
|
176
|
+
"@pezkuwi/util-crypto": "^14.0.5",
|
|
177
|
+
"react-native-svg": "^14.1.0",
|
|
178
|
+
"tslib": "^2.8.1"
|
|
179
|
+
},
|
|
180
|
+
"peerDependencies": {
|
|
181
|
+
"@pezkuwi/util": "*",
|
|
182
|
+
"@pezkuwi/util-crypto": "*",
|
|
183
|
+
"react": "*",
|
|
184
|
+
"react-native": "*"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const packageInfo = { name: '@pezkuwi/reactnative-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.17.0' };
|
package/build/types.d.ts
ADDED
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,11 +6,11 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const util_1 = require("@pezkuwi/util");
|
|
7
7
|
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
8
8
|
const index_js_1 = require("./icons/index.js");
|
|
9
|
-
const Fallback = index_js_1.
|
|
9
|
+
const Fallback = index_js_1.Pezkuwi;
|
|
10
10
|
const DEFAULT_SIZE = 64;
|
|
11
|
-
const DEFAULT_THEME = '
|
|
11
|
+
const DEFAULT_THEME = 'pezkuwi';
|
|
12
12
|
const Components = {
|
|
13
|
-
|
|
13
|
+
pezkuwi: index_js_1.Pezkuwi
|
|
14
14
|
};
|
|
15
15
|
class IdentityIcon extends react_1.default.PureComponent {
|
|
16
16
|
state = {
|
|
@@ -11,6 +11,6 @@ function renderCircle({ cx, cy, fill, r }, key) {
|
|
|
11
11
|
return ((0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: cx, cy: cy, fill: fill, r: r }, key));
|
|
12
12
|
}
|
|
13
13
|
function Identicon({ address, isAlternative = false, size }) {
|
|
14
|
-
const circles = (0, react_1.useMemo)(() => (0, ui_shared_1.
|
|
14
|
+
const circles = (0, react_1.useMemo)(() => (0, ui_shared_1.pezkuwiIcon)(address, { isAlternative }), [address, isAlternative]);
|
|
15
15
|
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Svg, { height: size, id: address, viewBox: '0 0 64 64', width: size, children: circles.map(renderCircle) }) }));
|
|
16
16
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Pezkuwi = exports.Empty = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var Empty_js_1 = require("./Empty.js");
|
|
6
6
|
Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return tslib_1.__importDefault(Empty_js_1).default; } });
|
|
7
|
-
var
|
|
8
|
-
Object.defineProperty(exports, "
|
|
7
|
+
var Pezkuwi_js_1 = require("./Pezkuwi.js");
|
|
8
|
+
Object.defineProperty(exports, "Pezkuwi", { enumerable: true, get: function () { return tslib_1.__importDefault(Pezkuwi_js_1).default; } });
|
|
@@ -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]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageInfo = void 0;
|
|
4
|
-
exports.packageInfo = { name: '@pezkuwi/reactnative-identicon', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '3.
|
|
4
|
+
exports.packageInfo = { name: '@pezkuwi/reactnative-identicon', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '3.17.0' };
|
|
@@ -2,12 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { isHex, isU8a, u8aToHex } from '@pezkuwi/util';
|
|
4
4
|
import { decodeAddress, encodeAddress } from '@pezkuwi/util-crypto';
|
|
5
|
-
import { Empty,
|
|
6
|
-
const Fallback =
|
|
5
|
+
import { Empty, Pezkuwi } from './icons/index.js';
|
|
6
|
+
const Fallback = Pezkuwi;
|
|
7
7
|
const DEFAULT_SIZE = 64;
|
|
8
|
-
const DEFAULT_THEME = '
|
|
8
|
+
const DEFAULT_THEME = 'pezkuwi';
|
|
9
9
|
const Components = {
|
|
10
|
-
|
|
10
|
+
pezkuwi: Pezkuwi
|
|
11
11
|
};
|
|
12
12
|
export default class IdentityIcon extends React.PureComponent {
|
|
13
13
|
state = {
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { Circle as SvgCircle, Svg } from 'react-native-svg';
|
|
5
|
-
import {
|
|
5
|
+
import { pezkuwiIcon } from '@pezkuwi/ui-shared';
|
|
6
6
|
function renderCircle({ cx, cy, fill, r }, key) {
|
|
7
7
|
return (_jsx(SvgCircle, { cx: cx, cy: cy, fill: fill, r: r }, key));
|
|
8
8
|
}
|
|
9
9
|
export default function Identicon({ address, isAlternative = false, size }) {
|
|
10
|
-
const circles = useMemo(() =>
|
|
10
|
+
const circles = useMemo(() => pezkuwiIcon(address, { isAlternative }), [address, isAlternative]);
|
|
11
11
|
return (_jsx(View, { children: _jsx(Svg, { height: size, id: address, viewBox: '0 0 64 64', width: size, children: circles.map(renderCircle) }) }));
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageInfo = { name: '@pezkuwi/reactnative-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.
|
|
1
|
+
export const packageInfo = { name: '@pezkuwi/reactnative-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.17.0' };
|