@rstreamlabs/react 1.6.3 → 1.6.5
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/dist/{chunk-JW275FK7.mjs → chunk-6EXRCHLM.mjs} +8 -1
- package/dist/{chunk-MJTSTB5H.mjs → chunk-GFWVYPSE.mjs} +4 -4
- package/dist/{chunk-2WDUPTYY.mjs → chunk-KZOS6ZKQ.mjs} +1 -1
- package/dist/components/index.d.mts +4 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +8 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/index.d.mts +2 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.js +12 -5
- package/dist/index.mjs +3 -3
- package/dist/providers/index.d.mts +2 -1
- package/dist/providers/index.d.ts +2 -1
- package/dist/providers/index.js +4 -4
- package/dist/providers/index.mjs +2 -2
- package/package.json +2 -2
|
@@ -34,7 +34,8 @@ function WebTTYTerminal(props) {
|
|
|
34
34
|
// xterm.js options
|
|
35
35
|
terminalOptions,
|
|
36
36
|
// Callbacks
|
|
37
|
-
onTerminalCreated
|
|
37
|
+
onTerminalCreated,
|
|
38
|
+
onTitleChange
|
|
38
39
|
} = props;
|
|
39
40
|
const ref = React.useRef(null);
|
|
40
41
|
React.useEffect(() => {
|
|
@@ -43,12 +44,15 @@ function WebTTYTerminal(props) {
|
|
|
43
44
|
}
|
|
44
45
|
let disposeOnData = null;
|
|
45
46
|
let disposeOnResize = null;
|
|
47
|
+
let disposeOnTitleChange = null;
|
|
46
48
|
let resizeObserver = null;
|
|
47
49
|
const clear = () => {
|
|
48
50
|
disposeOnData?.dispose();
|
|
49
51
|
disposeOnData = null;
|
|
50
52
|
disposeOnResize?.dispose();
|
|
51
53
|
disposeOnResize = null;
|
|
54
|
+
disposeOnTitleChange?.dispose();
|
|
55
|
+
disposeOnTitleChange = null;
|
|
52
56
|
resizeObserver?.disconnect();
|
|
53
57
|
resizeObserver = null;
|
|
54
58
|
};
|
|
@@ -69,6 +73,9 @@ function WebTTYTerminal(props) {
|
|
|
69
73
|
}
|
|
70
74
|
terminal.open(ref.current);
|
|
71
75
|
onTerminalCreated?.(terminal);
|
|
76
|
+
disposeOnTitleChange = terminal.onTitleChange((title) => {
|
|
77
|
+
onTitleChange?.(title);
|
|
78
|
+
});
|
|
72
79
|
const webtty = new WebTTY(
|
|
73
80
|
{ url, sendHeartbeat, heartbeatIntervalMs },
|
|
74
81
|
{ cmdArgs, envVars, allocateTty, interactive, username, workdir },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRstream
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KZOS6ZKQ.mjs";
|
|
4
4
|
|
|
5
5
|
// src/providers/rstream.tsx
|
|
6
6
|
import * as React from "react";
|
|
@@ -15,10 +15,10 @@ function useRstreamContext() {
|
|
|
15
15
|
return ctx;
|
|
16
16
|
}
|
|
17
17
|
function RstreamProvider({ options, children }) {
|
|
18
|
-
const { error, tunnels, clients } = useRstream(options);
|
|
18
|
+
const { state, error, tunnels, clients } = useRstream(options);
|
|
19
19
|
const value = React.useMemo(
|
|
20
|
-
() => ({ error, tunnels, clients }),
|
|
21
|
-
[error, tunnels, clients]
|
|
20
|
+
() => ({ state, error, tunnels, clients }),
|
|
21
|
+
[state, error, tunnels, clients]
|
|
22
22
|
);
|
|
23
23
|
const content = isRenderProp(children) ? children(value) : children;
|
|
24
24
|
return /* @__PURE__ */ jsx(RstreamContext.Provider, { value, children: content });
|
|
@@ -12,6 +12,10 @@ interface WebTTYTerminalProps extends WebTTYClientConfig, WebTTYExecutionConfig,
|
|
|
12
12
|
* Can be used to add your own add-ons or manipulate the Terminal instance.
|
|
13
13
|
*/
|
|
14
14
|
onTerminalCreated?: (terminal: Terminal) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Called whenever the terminal title changes.
|
|
17
|
+
*/
|
|
18
|
+
onTitleChange?: (title: string) => void;
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
21
|
* A React component that binds a WebTTY session to an xterm.js instance.
|
|
@@ -12,6 +12,10 @@ interface WebTTYTerminalProps extends WebTTYClientConfig, WebTTYExecutionConfig,
|
|
|
12
12
|
* Can be used to add your own add-ons or manipulate the Terminal instance.
|
|
13
13
|
*/
|
|
14
14
|
onTerminalCreated?: (terminal: Terminal) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Called whenever the terminal title changes.
|
|
17
|
+
*/
|
|
18
|
+
onTitleChange?: (title: string) => void;
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
21
|
* A React component that binds a WebTTY session to an xterm.js instance.
|
package/dist/components/index.js
CHANGED
|
@@ -68,7 +68,8 @@ function WebTTYTerminal(props) {
|
|
|
68
68
|
// xterm.js options
|
|
69
69
|
terminalOptions,
|
|
70
70
|
// Callbacks
|
|
71
|
-
onTerminalCreated
|
|
71
|
+
onTerminalCreated,
|
|
72
|
+
onTitleChange
|
|
72
73
|
} = props;
|
|
73
74
|
const ref = React.useRef(null);
|
|
74
75
|
React.useEffect(() => {
|
|
@@ -77,12 +78,15 @@ function WebTTYTerminal(props) {
|
|
|
77
78
|
}
|
|
78
79
|
let disposeOnData = null;
|
|
79
80
|
let disposeOnResize = null;
|
|
81
|
+
let disposeOnTitleChange = null;
|
|
80
82
|
let resizeObserver = null;
|
|
81
83
|
const clear = () => {
|
|
82
84
|
disposeOnData?.dispose();
|
|
83
85
|
disposeOnData = null;
|
|
84
86
|
disposeOnResize?.dispose();
|
|
85
87
|
disposeOnResize = null;
|
|
88
|
+
disposeOnTitleChange?.dispose();
|
|
89
|
+
disposeOnTitleChange = null;
|
|
86
90
|
resizeObserver?.disconnect();
|
|
87
91
|
resizeObserver = null;
|
|
88
92
|
};
|
|
@@ -103,6 +107,9 @@ function WebTTYTerminal(props) {
|
|
|
103
107
|
}
|
|
104
108
|
terminal.open(ref.current);
|
|
105
109
|
onTerminalCreated?.(terminal);
|
|
110
|
+
disposeOnTitleChange = terminal.onTitleChange((title) => {
|
|
111
|
+
onTitleChange?.(title);
|
|
112
|
+
});
|
|
106
113
|
const webtty = new import_webtty.WebTTY(
|
|
107
114
|
{ url, sendHeartbeat, heartbeatIntervalMs },
|
|
108
115
|
{ cmdArgs, envVars, allocateTty, interactive, username, workdir },
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -30,6 +30,7 @@ interface UseRstreamOptions extends Partial<WatchConfig> {
|
|
|
30
30
|
* @returns An object with the current error (if any), and arrays of tunnels and clients.
|
|
31
31
|
*/
|
|
32
32
|
declare function useRstream(options?: UseRstreamOptions): {
|
|
33
|
+
state: "disconnected" | "connecting" | "connected";
|
|
33
34
|
error: {
|
|
34
35
|
message: string;
|
|
35
36
|
type: "warning" | "danger";
|
|
@@ -42,8 +43,8 @@ declare function useRstream(options?: UseRstreamOptions): {
|
|
|
42
43
|
workspace_id: string;
|
|
43
44
|
id: string;
|
|
44
45
|
type?: "bytestream" | "datagram" | undefined;
|
|
45
|
-
name?: string | undefined;
|
|
46
46
|
creation_date?: Date | undefined;
|
|
47
|
+
name?: string | undefined;
|
|
47
48
|
publish?: boolean | undefined;
|
|
48
49
|
protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
|
|
49
50
|
labels?: Record<string, string | undefined> | undefined;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ interface UseRstreamOptions extends Partial<WatchConfig> {
|
|
|
30
30
|
* @returns An object with the current error (if any), and arrays of tunnels and clients.
|
|
31
31
|
*/
|
|
32
32
|
declare function useRstream(options?: UseRstreamOptions): {
|
|
33
|
+
state: "disconnected" | "connecting" | "connected";
|
|
33
34
|
error: {
|
|
34
35
|
message: string;
|
|
35
36
|
type: "warning" | "danger";
|
|
@@ -42,8 +43,8 @@ declare function useRstream(options?: UseRstreamOptions): {
|
|
|
42
43
|
workspace_id: string;
|
|
43
44
|
id: string;
|
|
44
45
|
type?: "bytestream" | "datagram" | undefined;
|
|
45
|
-
name?: string | undefined;
|
|
46
46
|
creation_date?: Date | undefined;
|
|
47
|
+
name?: string | undefined;
|
|
47
48
|
publish?: boolean | undefined;
|
|
48
49
|
protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
|
|
49
50
|
labels?: Record<string, string | undefined> | undefined;
|
package/dist/hooks/index.js
CHANGED
|
@@ -160,7 +160,7 @@ function useRstream(options) {
|
|
|
160
160
|
setTunnels([]);
|
|
161
161
|
}
|
|
162
162
|
}, [options, state]);
|
|
163
|
-
return { error, tunnels, clients };
|
|
163
|
+
return { state, error, tunnels, clients };
|
|
164
164
|
}
|
|
165
165
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
166
|
0 && (module.exports = {
|
package/dist/hooks/index.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -71,7 +71,8 @@ function WebTTYTerminal(props) {
|
|
|
71
71
|
// xterm.js options
|
|
72
72
|
terminalOptions,
|
|
73
73
|
// Callbacks
|
|
74
|
-
onTerminalCreated
|
|
74
|
+
onTerminalCreated,
|
|
75
|
+
onTitleChange
|
|
75
76
|
} = props;
|
|
76
77
|
const ref = React.useRef(null);
|
|
77
78
|
React.useEffect(() => {
|
|
@@ -80,12 +81,15 @@ function WebTTYTerminal(props) {
|
|
|
80
81
|
}
|
|
81
82
|
let disposeOnData = null;
|
|
82
83
|
let disposeOnResize = null;
|
|
84
|
+
let disposeOnTitleChange = null;
|
|
83
85
|
let resizeObserver = null;
|
|
84
86
|
const clear = () => {
|
|
85
87
|
disposeOnData?.dispose();
|
|
86
88
|
disposeOnData = null;
|
|
87
89
|
disposeOnResize?.dispose();
|
|
88
90
|
disposeOnResize = null;
|
|
91
|
+
disposeOnTitleChange?.dispose();
|
|
92
|
+
disposeOnTitleChange = null;
|
|
89
93
|
resizeObserver?.disconnect();
|
|
90
94
|
resizeObserver = null;
|
|
91
95
|
};
|
|
@@ -106,6 +110,9 @@ function WebTTYTerminal(props) {
|
|
|
106
110
|
}
|
|
107
111
|
terminal.open(ref.current);
|
|
108
112
|
onTerminalCreated?.(terminal);
|
|
113
|
+
disposeOnTitleChange = terminal.onTitleChange((title) => {
|
|
114
|
+
onTitleChange?.(title);
|
|
115
|
+
});
|
|
109
116
|
const webtty = new import_webtty.WebTTY(
|
|
110
117
|
{ url, sendHeartbeat, heartbeatIntervalMs },
|
|
111
118
|
{ cmdArgs, envVars, allocateTty, interactive, username, workdir },
|
|
@@ -309,7 +316,7 @@ function useRstream(options) {
|
|
|
309
316
|
setTunnels([]);
|
|
310
317
|
}
|
|
311
318
|
}, [options, state]);
|
|
312
|
-
return { error, tunnels, clients };
|
|
319
|
+
return { state, error, tunnels, clients };
|
|
313
320
|
}
|
|
314
321
|
|
|
315
322
|
// src/providers/rstream.tsx
|
|
@@ -325,10 +332,10 @@ function useRstreamContext() {
|
|
|
325
332
|
return ctx;
|
|
326
333
|
}
|
|
327
334
|
function RstreamProvider({ options, children }) {
|
|
328
|
-
const { error, tunnels, clients } = useRstream(options);
|
|
335
|
+
const { state, error, tunnels, clients } = useRstream(options);
|
|
329
336
|
const value = React3.useMemo(
|
|
330
|
-
() => ({ error, tunnels, clients }),
|
|
331
|
-
[error, tunnels, clients]
|
|
337
|
+
() => ({ state, error, tunnels, clients }),
|
|
338
|
+
[state, error, tunnels, clients]
|
|
332
339
|
);
|
|
333
340
|
const content = isRenderProp(children) ? children(value) : children;
|
|
334
341
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RstreamContext.Provider, { value, children: content });
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WebTTYTerminal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6EXRCHLM.mjs";
|
|
4
4
|
import "./chunk-2JFL7TS5.mjs";
|
|
5
5
|
import {
|
|
6
6
|
RstreamProvider,
|
|
7
7
|
useRstreamContext
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GFWVYPSE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
useRstream
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KZOS6ZKQ.mjs";
|
|
12
12
|
export {
|
|
13
13
|
RstreamProvider,
|
|
14
14
|
WebTTYTerminal,
|
|
@@ -5,6 +5,7 @@ import '@rstreamlabs/rstream';
|
|
|
5
5
|
|
|
6
6
|
type RstreamContextValue = ReturnType<typeof useRstream>;
|
|
7
7
|
declare function useRstreamContext(): {
|
|
8
|
+
state: "disconnected" | "connecting" | "connected";
|
|
8
9
|
error: {
|
|
9
10
|
message: string;
|
|
10
11
|
type: "warning" | "danger";
|
|
@@ -17,8 +18,8 @@ declare function useRstreamContext(): {
|
|
|
17
18
|
workspace_id: string;
|
|
18
19
|
id: string;
|
|
19
20
|
type?: "bytestream" | "datagram" | undefined;
|
|
20
|
-
name?: string | undefined;
|
|
21
21
|
creation_date?: Date | undefined;
|
|
22
|
+
name?: string | undefined;
|
|
22
23
|
publish?: boolean | undefined;
|
|
23
24
|
protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
|
|
24
25
|
labels?: Record<string, string | undefined> | undefined;
|
|
@@ -5,6 +5,7 @@ import '@rstreamlabs/rstream';
|
|
|
5
5
|
|
|
6
6
|
type RstreamContextValue = ReturnType<typeof useRstream>;
|
|
7
7
|
declare function useRstreamContext(): {
|
|
8
|
+
state: "disconnected" | "connecting" | "connected";
|
|
8
9
|
error: {
|
|
9
10
|
message: string;
|
|
10
11
|
type: "warning" | "danger";
|
|
@@ -17,8 +18,8 @@ declare function useRstreamContext(): {
|
|
|
17
18
|
workspace_id: string;
|
|
18
19
|
id: string;
|
|
19
20
|
type?: "bytestream" | "datagram" | undefined;
|
|
20
|
-
name?: string | undefined;
|
|
21
21
|
creation_date?: Date | undefined;
|
|
22
|
+
name?: string | undefined;
|
|
22
23
|
publish?: boolean | undefined;
|
|
23
24
|
protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
|
|
24
25
|
labels?: Record<string, string | undefined> | undefined;
|
package/dist/providers/index.js
CHANGED
|
@@ -161,7 +161,7 @@ function useRstream(options) {
|
|
|
161
161
|
setTunnels([]);
|
|
162
162
|
}
|
|
163
163
|
}, [options, state]);
|
|
164
|
-
return { error, tunnels, clients };
|
|
164
|
+
return { state, error, tunnels, clients };
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// src/providers/rstream.tsx
|
|
@@ -177,10 +177,10 @@ function useRstreamContext() {
|
|
|
177
177
|
return ctx;
|
|
178
178
|
}
|
|
179
179
|
function RstreamProvider({ options, children }) {
|
|
180
|
-
const { error, tunnels, clients } = useRstream(options);
|
|
180
|
+
const { state, error, tunnels, clients } = useRstream(options);
|
|
181
181
|
const value = React2.useMemo(
|
|
182
|
-
() => ({ error, tunnels, clients }),
|
|
183
|
-
[error, tunnels, clients]
|
|
182
|
+
() => ({ state, error, tunnels, clients }),
|
|
183
|
+
[state, error, tunnels, clients]
|
|
184
184
|
);
|
|
185
185
|
const content = isRenderProp(children) ? children(value) : children;
|
|
186
186
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RstreamContext.Provider, { value, children: content });
|
package/dist/providers/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstreamlabs/react",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "React hooks and components for building rstream-enabled UIs.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"typescript": "5.9.3"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@rstreamlabs/rstream": "1.6.
|
|
53
|
+
"@rstreamlabs/rstream": "1.6.3",
|
|
54
54
|
"@rstreamlabs/webtty": "1.6.2",
|
|
55
55
|
"@xterm/addon-fit": "^0.11.0",
|
|
56
56
|
"@xterm/addon-unicode11": "^0.9.0",
|