@blocklet/ui-react 2.9.85 → 2.9.86
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { joinURL } from "ufo";
|
|
4
4
|
const WELL_KNOWN_SERVICE_PATH = "/.well-known/service";
|
|
5
5
|
function parseUrl(uri, params) {
|
|
@@ -34,11 +34,18 @@ function BlockletStudio({
|
|
|
34
34
|
zIndex = 9999,
|
|
35
35
|
...rest
|
|
36
36
|
}) {
|
|
37
|
+
const [opened, setOpened] = useState(false);
|
|
37
38
|
const didRef = useRef("");
|
|
38
39
|
didRef.current = componentDid;
|
|
39
40
|
const latestFunctionVersionRef = useRef({});
|
|
40
|
-
latestFunctionVersionRef.current["resourceDialog.close"] = () =>
|
|
41
|
-
|
|
41
|
+
latestFunctionVersionRef.current["resourceDialog.close"] = () => {
|
|
42
|
+
setOpened(false);
|
|
43
|
+
setOpen(false);
|
|
44
|
+
};
|
|
45
|
+
latestFunctionVersionRef.current["resourceDialog.loaded"] = () => {
|
|
46
|
+
setOpened(true);
|
|
47
|
+
onOpened?.();
|
|
48
|
+
};
|
|
42
49
|
latestFunctionVersionRef.current["studioDialog.uploaded"] = onUploaded;
|
|
43
50
|
latestFunctionVersionRef.current["studioDialog.connected"] = onConnected;
|
|
44
51
|
latestFunctionVersionRef.current["studioDialog.released"] = onReleased;
|
|
@@ -90,6 +97,7 @@ function BlockletStudio({
|
|
|
90
97
|
border: 0,
|
|
91
98
|
padding: 0,
|
|
92
99
|
margin: 0,
|
|
100
|
+
opacity: opened ? 1 : 0,
|
|
93
101
|
...style
|
|
94
102
|
},
|
|
95
103
|
...rest
|
|
@@ -40,11 +40,18 @@ function BlockletStudio({
|
|
|
40
40
|
zIndex = 9999,
|
|
41
41
|
...rest
|
|
42
42
|
}) {
|
|
43
|
+
const [opened, setOpened] = (0, _react.useState)(false);
|
|
43
44
|
const didRef = (0, _react.useRef)("");
|
|
44
45
|
didRef.current = componentDid;
|
|
45
46
|
const latestFunctionVersionRef = (0, _react.useRef)({});
|
|
46
|
-
latestFunctionVersionRef.current["resourceDialog.close"] = () =>
|
|
47
|
-
|
|
47
|
+
latestFunctionVersionRef.current["resourceDialog.close"] = () => {
|
|
48
|
+
setOpened(false);
|
|
49
|
+
setOpen(false);
|
|
50
|
+
};
|
|
51
|
+
latestFunctionVersionRef.current["resourceDialog.loaded"] = () => {
|
|
52
|
+
setOpened(true);
|
|
53
|
+
onOpened?.();
|
|
54
|
+
};
|
|
48
55
|
latestFunctionVersionRef.current["studioDialog.uploaded"] = onUploaded;
|
|
49
56
|
latestFunctionVersionRef.current["studioDialog.connected"] = onConnected;
|
|
50
57
|
latestFunctionVersionRef.current["studioDialog.released"] = onReleased;
|
|
@@ -91,6 +98,7 @@ function BlockletStudio({
|
|
|
91
98
|
border: 0,
|
|
92
99
|
padding: 0,
|
|
93
100
|
margin: 0,
|
|
101
|
+
opacity: opened ? 1 : 0,
|
|
94
102
|
...style
|
|
95
103
|
},
|
|
96
104
|
...rest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.86",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@arcblock/bridge": "^2.9.
|
|
66
|
-
"@arcblock/react-hooks": "^2.9.
|
|
65
|
+
"@arcblock/bridge": "^2.9.86",
|
|
66
|
+
"@arcblock/react-hooks": "^2.9.86",
|
|
67
67
|
"@blocklet/js-sdk": "1.16.27-beta-c450492a",
|
|
68
68
|
"@iconify-icons/logos": "^1.2.36",
|
|
69
69
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"jest": "^28.1.3",
|
|
109
109
|
"unbuild": "^2.0.0"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "608ebcab820c61f400bf2829cf2430191e9b1082"
|
|
112
112
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { joinURL } from 'ufo';
|
|
3
3
|
|
|
4
4
|
const WELL_KNOWN_SERVICE_PATH = '/.well-known/service';
|
|
@@ -59,11 +59,18 @@ function BlockletStudio({
|
|
|
59
59
|
zIndex = 9999,
|
|
60
60
|
...rest
|
|
61
61
|
}: BlockletStudioProps) {
|
|
62
|
+
const [opened, setOpened] = useState(false);
|
|
62
63
|
const didRef = useRef('');
|
|
63
64
|
didRef.current = componentDid;
|
|
64
65
|
const latestFunctionVersionRef = useRef<{ [key: string]: undefined | ((data: unknown) => void) }>({});
|
|
65
|
-
latestFunctionVersionRef.current['resourceDialog.close'] = () =>
|
|
66
|
-
|
|
66
|
+
latestFunctionVersionRef.current['resourceDialog.close'] = () => {
|
|
67
|
+
setOpened(false);
|
|
68
|
+
setOpen(false);
|
|
69
|
+
};
|
|
70
|
+
latestFunctionVersionRef.current['resourceDialog.loaded'] = () => {
|
|
71
|
+
setOpened(true);
|
|
72
|
+
onOpened?.();
|
|
73
|
+
};
|
|
67
74
|
latestFunctionVersionRef.current['studioDialog.uploaded'] = onUploaded;
|
|
68
75
|
latestFunctionVersionRef.current['studioDialog.connected'] = onConnected;
|
|
69
76
|
latestFunctionVersionRef.current['studioDialog.released'] = onReleased;
|
|
@@ -118,6 +125,7 @@ function BlockletStudio({
|
|
|
118
125
|
border: 0,
|
|
119
126
|
padding: 0,
|
|
120
127
|
margin: 0,
|
|
128
|
+
opacity: opened ? 1 : 0,
|
|
121
129
|
...style,
|
|
122
130
|
}}
|
|
123
131
|
{...rest}
|