@rstreamlabs/react 1.6.4 → 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.
@@ -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 },
@@ -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.
@@ -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 },
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WebTTYTerminal
3
- } from "../chunk-JW275FK7.mjs";
3
+ } from "../chunk-6EXRCHLM.mjs";
4
4
  export {
5
5
  WebTTYTerminal
6
6
  };
@@ -43,8 +43,8 @@ declare function useRstream(options?: UseRstreamOptions): {
43
43
  workspace_id: string;
44
44
  id: string;
45
45
  type?: "bytestream" | "datagram" | undefined;
46
- name?: string | undefined;
47
46
  creation_date?: Date | undefined;
47
+ name?: string | undefined;
48
48
  publish?: boolean | undefined;
49
49
  protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
50
50
  labels?: Record<string, string | undefined> | undefined;
@@ -43,8 +43,8 @@ declare function useRstream(options?: UseRstreamOptions): {
43
43
  workspace_id: string;
44
44
  id: string;
45
45
  type?: "bytestream" | "datagram" | undefined;
46
- name?: string | undefined;
47
46
  creation_date?: Date | undefined;
47
+ name?: string | undefined;
48
48
  publish?: boolean | undefined;
49
49
  protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
50
50
  labels?: Record<string, string | undefined> | undefined;
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 },
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WebTTYTerminal
3
- } from "./chunk-JW275FK7.mjs";
3
+ } from "./chunk-6EXRCHLM.mjs";
4
4
  import "./chunk-2JFL7TS5.mjs";
5
5
  import {
6
6
  RstreamProvider,
@@ -18,8 +18,8 @@ declare function useRstreamContext(): {
18
18
  workspace_id: string;
19
19
  id: string;
20
20
  type?: "bytestream" | "datagram" | undefined;
21
- name?: string | undefined;
22
21
  creation_date?: Date | undefined;
22
+ name?: string | undefined;
23
23
  publish?: boolean | undefined;
24
24
  protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
25
25
  labels?: Record<string, string | undefined> | undefined;
@@ -18,8 +18,8 @@ declare function useRstreamContext(): {
18
18
  workspace_id: string;
19
19
  id: string;
20
20
  type?: "bytestream" | "datagram" | undefined;
21
- name?: string | undefined;
22
21
  creation_date?: Date | undefined;
22
+ name?: string | undefined;
23
23
  publish?: boolean | undefined;
24
24
  protocol?: "tls" | "dtls" | "quic" | "http" | undefined;
25
25
  labels?: Record<string, string | undefined> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstreamlabs/react",
3
- "version": "1.6.4",
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.2",
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",