@mks2508/mks-ui 0.5.0 → 0.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"TerminalDisplay.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/blocks/Terminal/TerminalDisplay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAM1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,eAAe,uHAmL3B,CAAC"}
1
+ {"version":3,"file":"TerminalDisplay.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/blocks/Terminal/TerminalDisplay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAM1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,eAAe,uHA8L3B,CAAC"}
@@ -96,9 +96,16 @@ const TerminalDisplay = forwardRef(({ content, title = "Output", variant = "defa
96
96
  if (builtinTheme) restty.applyTheme(builtinTheme);
97
97
  } else if (theme) restty.applyTheme(xtermThemeToGhostty(theme));
98
98
  else restty.applyTheme(getSynthwaveGhosttyTheme());
99
- if (contentRef.current) restty.sendInput(contentRef.current, "pty");
100
- setIsReady(true);
101
- callbacksRef.current.onReady?.(restty);
99
+ const waitForWasm = () => {
100
+ if (destroyed) return;
101
+ const panes = restty.panes();
102
+ if (panes && panes.length > 0) {
103
+ if (contentRef.current) restty.sendInput(contentRef.current, "pty");
104
+ setIsReady(true);
105
+ callbacksRef.current.onReady?.(restty);
106
+ } else requestAnimationFrame(waitForWasm);
107
+ };
108
+ requestAnimationFrame(waitForWasm);
102
109
  };
103
110
  init().catch(() => {});
104
111
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mks2508/mks-ui",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "UI component library - Shadcn/Animate UI based with DevEnv components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -138,13 +138,24 @@ export const TerminalDisplay = forwardRef<ITerminalDisplayRef, ITerminalDisplayP
138
138
  restty.applyTheme(getSynthwaveGhosttyTheme());
139
139
  }
140
140
 
141
- // Write initial content
142
- if (contentRef.current) {
143
- restty.sendInput(contentRef.current, 'pty');
144
- }
145
-
146
- setIsReady(true);
147
- callbacksRef.current.onReady?.(restty);
141
+ // Wait for WASM to be ready before writing content.
142
+ // Restty loads WASM async internally — panes() returns empty until ready.
143
+ const waitForWasm = () => {
144
+ if (destroyed) return;
145
+ const panes = restty.panes();
146
+ if (panes && panes.length > 0) {
147
+ // WASM loaded, pane created — safe to write
148
+ if (contentRef.current) {
149
+ restty.sendInput(contentRef.current, 'pty');
150
+ }
151
+ setIsReady(true);
152
+ callbacksRef.current.onReady?.(restty);
153
+ } else {
154
+ // Not ready yet, retry
155
+ requestAnimationFrame(waitForWasm);
156
+ }
157
+ };
158
+ requestAnimationFrame(waitForWasm);
148
159
  };
149
160
 
150
161
  init().catch(() => {