@pezkuwi/reactnative-identicon 3.16.7 → 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 +153 -6
- package/build/Identicon.js +0 -46
- package/build/README.md +0 -30
- package/build/bundle.js +0 -2
- package/build/cjs/Identicon.d.ts +0 -20
- package/build/cjs/Identicon.js +0 -50
- package/build/cjs/bundle.d.ts +0 -2
- package/build/cjs/bundle.js +0 -7
- package/build/cjs/icons/Empty.js +0 -11
- package/build/cjs/icons/Polkadot.js +0 -16
- package/build/cjs/icons/index.js +0 -8
- package/build/cjs/index.js +0 -7
- package/build/cjs/packageInfo.js +0 -4
- package/build/cjs/types.js +0 -2
- package/build/icons/Empty.d.ts +0 -3
- package/build/icons/Empty.js +0 -7
- package/build/icons/Polkadot.d.ts +0 -3
- package/build/icons/Polkadot.js +0 -12
- package/build/icons/index.d.ts +0 -2
- package/build/icons/index.js +0 -2
- package/build/index.d.ts +0 -4
- package/build/index.js +0 -4
- package/build/package.json +0 -186
- 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/types.d.ts +0 -6
- package/build/types.js +0 -1
- package/build-tsc-cjs/packageDetect.js +0 -6
- package/src/Identicon.tsx +0 -81
- package/src/bundle.ts +0 -5
- package/src/icons/Empty.tsx +0 -27
- package/src/icons/Polkadot.tsx +0 -43
- package/src/icons/index.ts +0 -5
- package/src/index.ts +0 -10
- package/src/packageDetect.ts +0 -12
- package/src/packageInfo.ts +0 -6
- package/src/types.ts +0 -9
- 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-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/Empty.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Empty.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}/types.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/types.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}/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/types.d.ts → types.d.ts} +0 -0
- /package/{build-tsc-esm/types.js → types.js} +0 -0
package/build/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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/src/Identicon.tsx
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/reactnative-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Prefix } from '@pezkuwi/util-crypto/address/types';
|
|
5
|
-
import type { Props as ComponentProps } from './types.js';
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { isHex, isU8a, u8aToHex } from '@pezkuwi/util';
|
|
10
|
-
import { decodeAddress, encodeAddress } from '@pezkuwi/util-crypto';
|
|
11
|
-
|
|
12
|
-
import { Empty, Polkadot } from './icons/index.js';
|
|
13
|
-
|
|
14
|
-
const Fallback = Polkadot;
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
prefix?: Prefix;
|
|
18
|
-
size?: number;
|
|
19
|
-
theme?: 'polkadot';
|
|
20
|
-
value?: string | Uint8Array | null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface State {
|
|
24
|
-
address: string;
|
|
25
|
-
publicKey: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const DEFAULT_SIZE = 64;
|
|
29
|
-
const DEFAULT_THEME = 'polkadot';
|
|
30
|
-
|
|
31
|
-
const Components: Record<string, React.ComponentType<ComponentProps>> = {
|
|
32
|
-
polkadot: Polkadot
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default class IdentityIcon extends React.PureComponent<Props, State> {
|
|
36
|
-
public override state: State = {
|
|
37
|
-
address: '',
|
|
38
|
-
publicKey: '0x'
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
private static prefix?: Prefix = undefined;
|
|
42
|
-
|
|
43
|
-
public static setDefaultPrefix (prefix: Prefix): void {
|
|
44
|
-
IdentityIcon.prefix = prefix;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public static getDerivedStateFromProps ({ prefix = IdentityIcon.prefix, value }: Props, prevState: State): State | null {
|
|
48
|
-
try {
|
|
49
|
-
const address = isU8a(value) || isHex(value)
|
|
50
|
-
? encodeAddress(value, prefix)
|
|
51
|
-
: (value || '');
|
|
52
|
-
const publicKey = u8aToHex(decodeAddress(address, true, prefix));
|
|
53
|
-
|
|
54
|
-
return address === prevState.address
|
|
55
|
-
? null
|
|
56
|
-
: { address, publicKey };
|
|
57
|
-
} catch {
|
|
58
|
-
return {
|
|
59
|
-
address: '',
|
|
60
|
-
publicKey: '0x'
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public override render (): React.ReactNode {
|
|
66
|
-
const { size = DEFAULT_SIZE, theme = DEFAULT_THEME } = this.props;
|
|
67
|
-
const { address, publicKey } = this.state;
|
|
68
|
-
|
|
69
|
-
const Component = !address
|
|
70
|
-
? Empty
|
|
71
|
-
: Components[theme] || Fallback;
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Component
|
|
75
|
-
address={address}
|
|
76
|
-
publicKey={publicKey}
|
|
77
|
-
size={size}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
}
|
package/src/bundle.ts
DELETED
package/src/icons/Empty.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/reactnative-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Props } from '../types.js';
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { View } from 'react-native';
|
|
8
|
-
import { Circle, Svg } from 'react-native-svg';
|
|
9
|
-
|
|
10
|
-
export default function Empty ({ size }: Props): React.ReactElement<Props> {
|
|
11
|
-
return (
|
|
12
|
-
<View>
|
|
13
|
-
<Svg
|
|
14
|
-
height={size}
|
|
15
|
-
viewBox='0 0 64 64'
|
|
16
|
-
width={size}
|
|
17
|
-
>
|
|
18
|
-
<Circle
|
|
19
|
-
cx='32'
|
|
20
|
-
cy='32'
|
|
21
|
-
fill='#eee'
|
|
22
|
-
r='32'
|
|
23
|
-
/>
|
|
24
|
-
</Svg>
|
|
25
|
-
</View>
|
|
26
|
-
);
|
|
27
|
-
}
|
package/src/icons/Polkadot.tsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2025 @pezkuwi/reactnative-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Circle as CircleType } from '@pezkuwi/ui-shared/icons/types';
|
|
5
|
-
import type { Props } from '../types.js';
|
|
6
|
-
|
|
7
|
-
import React, { useMemo } from 'react';
|
|
8
|
-
import { View } from 'react-native';
|
|
9
|
-
import { Circle as SvgCircle, Svg } from 'react-native-svg';
|
|
10
|
-
|
|
11
|
-
import { polkadotIcon } from '@pezkuwi/ui-shared';
|
|
12
|
-
|
|
13
|
-
function renderCircle ({ cx, cy, fill, r }: CircleType, key: number): React.ReactNode {
|
|
14
|
-
return (
|
|
15
|
-
<SvgCircle
|
|
16
|
-
cx={cx}
|
|
17
|
-
cy={cy}
|
|
18
|
-
fill={fill}
|
|
19
|
-
key={key}
|
|
20
|
-
r={r}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default function Identicon ({ address, isAlternative = false, size }: Props): React.ReactElement<Props> {
|
|
26
|
-
const circles = useMemo(
|
|
27
|
-
() => polkadotIcon(address, { isAlternative }),
|
|
28
|
-
[address, isAlternative]
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<View>
|
|
33
|
-
<Svg
|
|
34
|
-
height={size}
|
|
35
|
-
id={address}
|
|
36
|
-
viewBox='0 0 64 64'
|
|
37
|
-
width={size}
|
|
38
|
-
>
|
|
39
|
-
{circles.map(renderCircle)}
|
|
40
|
-
</Svg>
|
|
41
|
-
</View>
|
|
42
|
-
);
|
|
43
|
-
}
|
package/src/icons/index.ts
DELETED
package/src/index.ts
DELETED
package/src/packageDetect.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2026 @pezkuwi/reactnative-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// Do not edit, auto-generated by @pezkuwi/dev
|
|
5
|
-
// (packageInfo imports will be kept as-is, user-editable)
|
|
6
|
-
|
|
7
|
-
import { packageInfo as sharedInfo } from '@pezkuwi/ui-shared/packageInfo';
|
|
8
|
-
import { detectPackage } from '@pezkuwi/util';
|
|
9
|
-
|
|
10
|
-
import { packageInfo } from './packageInfo.js';
|
|
11
|
-
|
|
12
|
-
detectPackage(packageInfo, null, [sharedInfo]);
|
package/src/packageInfo.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2026 @pezkuwi/reactnative-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// Do not edit, auto-generated by @pezkuwi/dev
|
|
5
|
-
|
|
6
|
-
export const packageInfo = { name: '@pezkuwi/reactnative-identicon', path: 'auto', type: 'auto', version: '3.16.6' };
|
package/src/types.ts
DELETED