@ckb-ccc/connector-react 0.0.4 → 0.0.5-alpha.1
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 +6 -0
- package/dist/hooks/useCcc.d.ts +3 -1
- package/dist/hooks/useCcc.d.ts.map +1 -1
- package/dist/hooks/useCcc.js +2 -2
- package/package.json +3 -3
- package/src/hooks/useCcc.tsx +6 -0
- package/tsconfig.base.json +0 -22
- package/tsconfig.commonjs.json +0 -8
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://ckbccc-demo.vercel.app/">
|
|
3
|
+
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/logo.svg" width="20%" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
1
7
|
<h1 align="center" style="font-size: 48px;">
|
|
2
8
|
CCC Connector for React
|
|
3
9
|
</h1>
|
package/dist/hooks/useCcc.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/connector";
|
|
2
2
|
import React from "react";
|
|
3
|
-
export declare function Provider({ children, connectorProps, }: {
|
|
3
|
+
export declare function Provider({ children, connectorProps, name, icon, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
connectorProps?: React.HTMLAttributes<{}>;
|
|
6
|
+
name?: string;
|
|
7
|
+
icon?: string;
|
|
6
8
|
}): React.JSX.Element;
|
|
7
9
|
export declare function useCcc(): {
|
|
8
10
|
open: () => unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCcc.d.ts","sourceRoot":"","sources":["../../src/hooks/useCcc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAwD,MAAM,OAAO,CAAC;AAe7E,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,cAAc,
|
|
1
|
+
{"version":3,"file":"useCcc.d.ts","sourceRoot":"","sources":["../../src/hooks/useCcc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAwD,MAAM,OAAO,CAAC;AAe7E,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,IAAI,GACL,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,qBA8CA;AAED,wBAAgB,MAAM;;;;;;;EAQrB"}
|
package/dist/hooks/useCcc.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ccc } from "@ckb-ccc/connector";
|
|
|
2
2
|
import React, { createContext, useCallback, useMemo, useState } from "react";
|
|
3
3
|
import { Connector } from "../components";
|
|
4
4
|
const CCC_CONTEXT = createContext(undefined);
|
|
5
|
-
export function Provider({ children, connectorProps, }) {
|
|
5
|
+
export function Provider({ children, connectorProps, name, icon, }) {
|
|
6
6
|
const [ref, setRef] = useState(null);
|
|
7
7
|
const [_, setFlag] = useState(0);
|
|
8
8
|
const client = useMemo(() => ref?.client ?? new ccc.ClientPublicTestnet(), [ref?.client]);
|
|
@@ -17,7 +17,7 @@ export function Provider({ children, connectorProps, }) {
|
|
|
17
17
|
wallet: ref?.wallet,
|
|
18
18
|
signerInfo: ref?.signer,
|
|
19
19
|
} },
|
|
20
|
-
React.createElement(Connector, { ref: setRef, onWillUpdate: () => setFlag((f) => f + 1), ...connectorProps,
|
|
20
|
+
React.createElement(Connector, { name: name, icon: icon, ref: setRef, onWillUpdate: () => setFlag((f) => f + 1), ...connectorProps,
|
|
21
21
|
style: {
|
|
22
22
|
...connectorProps?.style,
|
|
23
23
|
zIndex: connectorProps?.style?.zIndex ?? 999,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/connector-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5-alpha.1",
|
|
4
4
|
"description": "Common Chains Connector UI Component for React",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@ckb-ccc/connector": "0.0.
|
|
41
|
+
"@ckb-ccc/connector": "0.0.5-alpha.1",
|
|
42
42
|
"@lit/react": "^1.0.5",
|
|
43
43
|
"react": "^18"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "98d6d902fff0cc3d65f536cb85b32c867045d15d"
|
|
46
46
|
}
|
package/src/hooks/useCcc.tsx
CHANGED
|
@@ -17,9 +17,13 @@ const CCC_CONTEXT = createContext<
|
|
|
17
17
|
export function Provider({
|
|
18
18
|
children,
|
|
19
19
|
connectorProps,
|
|
20
|
+
name,
|
|
21
|
+
icon,
|
|
20
22
|
}: {
|
|
21
23
|
children: React.ReactNode;
|
|
22
24
|
connectorProps?: React.HTMLAttributes<{}>;
|
|
25
|
+
name?: string;
|
|
26
|
+
icon?: string;
|
|
23
27
|
}) {
|
|
24
28
|
const [ref, setRef] = useState<WebComponentConnector | null>(null);
|
|
25
29
|
const [_, setFlag] = useState(0);
|
|
@@ -51,6 +55,8 @@ export function Provider({
|
|
|
51
55
|
}}
|
|
52
56
|
>
|
|
53
57
|
<Connector
|
|
58
|
+
name={name}
|
|
59
|
+
icon={icon}
|
|
54
60
|
ref={setRef}
|
|
55
61
|
onWillUpdate={() => setFlag((f) => f + 1)}
|
|
56
62
|
{...{
|
package/tsconfig.base.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2020",
|
|
4
|
-
"jsx": "react",
|
|
5
|
-
"incremental": true,
|
|
6
|
-
"allowJs": true,
|
|
7
|
-
"importHelpers": false,
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationMap": true,
|
|
10
|
-
"experimentalDecorators": true,
|
|
11
|
-
"useDefineForClassFields": false,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"noImplicitAny": true,
|
|
15
|
-
"strictBindCallApply": true,
|
|
16
|
-
"strictNullChecks": true,
|
|
17
|
-
"alwaysStrict": true,
|
|
18
|
-
"noFallthroughCasesInSwitch": true,
|
|
19
|
-
"forceConsistentCasingInFileNames": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/**/*"]
|
|
22
|
-
}
|