|
20 | 20 |
|
21 | 21 | <meta name=description content=''> |
22 | 22 |
|
23 | | - <base href='https://ext-code.com/utils/misc/terminal/'> |
24 | | - <link rel=canonical href='https://ext-code.com/utils/misc/terminal/terminal.html'> |
| 23 | + <base href='https://ext-code.com/utils/misc/nodejs-terminal/nodejs-terminal.html'> |
| 24 | + <link rel=canonical href='https://ext-code.com/utils/misc/nodejs-terminal/nodejs-terminal.html'> |
25 | 25 |
|
26 | 26 | <link rel='shortcut icon' type='image/x-icon' href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAMAAABBJv+bAAAAQlBMVEVHcEwyODg0ODkzNzgxNzc0ODk0ODkzODgzODgzNzgyNzgzODg0ODkzODgyNzgzODgzODgzODk0ODk0ODkyNzg0ODmObyvDAAAAFXRSTlMABvaSDbPHe15GL5u9hRxvO6rn2VJXM6DpAAAAxElEQVQoz71TyRbDIAh0Ie6J2fz/Xy3Y2pDktZ5aTiODCAMK0QxAPoFsgNk0JrMEQmEwyU5ndt4K2khQEzLhdNeQTznCWREegNEOOe18fRO8i6ooz+gRw1k9gMkyo/E9zY5yKMX+ihbLq8mjFB5N4UepYLGRmdM7OnLlpYtJXWQQkFCIpHcpfBVpCxeRV/KuodHzmfaNxuTmlpxmoEzc5bs0rnGdQQZeybWxRX6Vxf5rJJ116CxTZxX5Isf7Ive+wadP9AAuFg97y3bd7gAAAABJRU5ErkJggg=='> |
27 | 27 | <meta name=viewport content='width=device-width, initial-scale=1'> |
|
63 | 63 |
|
64 | 64 | var menu; |
65 | 65 |
|
66 | | - var hdr; |
| 66 | + var misc; |
| 67 | + var filemod; |
| 68 | + var log; |
67 | 69 |
|
68 | 70 |
|
| 71 | + //: |
| 72 | + |
| 73 | + |
69 | 74 | async function init(){ |
70 | 75 |
|
71 | 76 |
|
|
74 | 79 | mod.base.add({ext,$,datatype,keydown,menu,menumod}); |
75 | 80 |
|
76 | 81 |
|
77 | | - hdr = mod['misc-hdr']; |
| 82 | + misc = mod['misc-hdr']; |
| 83 | + filemod = mod['file-mod']; |
| 84 | + log = mod['log-mod']; |
78 | 85 |
|
79 | | - hdr.initmod({ext,$}); |
| 86 | + misc.initmod({ext,$}); |
| 87 | + filemod.initmod({ext,$,menumod,menu,complete,source,log}); |
| 88 | + log.initmod({ext,$}); |
80 | 89 |
|
81 | 90 |
|
82 | 91 | await Promise.all([ |
83 | | - hdr.init(), |
| 92 | + misc.init(), |
| 93 | + filemod.init(), |
| 94 | + log.init(), |
84 | 95 | ]); |
85 | 96 |
|
86 | 97 |
|
87 | 98 | initdom(); |
88 | 99 |
|
89 | 100 |
|
| 101 | + log.green('ready'); |
| 102 | + |
| 103 | + |
90 | 104 | }//init |
91 | 105 |
|
92 | 106 |
|
| 107 | + |
93 | 108 | (async()=>{ |
94 | 109 |
|
95 | 110 | mod.stack.add; |
|
125 | 140 | {margin:20px;height:calc(100% - 40px);display:flex;flex-direction:column;gap:10px} |
126 | 141 |
|
127 | 142 |
|
| 143 | + #hdr |
| 144 | + {} |
| 145 | + |
| 146 | + #hldr |
| 147 | + {padding:10px;border:2px solid lightgray;box-sizing:border-box;flex:1} |
| 148 | + |
128 | 149 | #terminal |
129 | | - {flex:1} |
| 150 | + {height:100%} |
130 | 151 |
|
131 | | - .terminal |
132 | | - {padding:10px;border:2px solid lightgray;box-sizing:border-box} |
| 152 | + |
| 153 | + |
| 154 | + .icon |
| 155 | + {width:32px;height:32px;border:1px solid gray;border-radius:3px;box-sizing:border-box;cursor:pointer} |
133 | 156 |
|
134 | 157 |
|
135 | 158 | </style> |
|
141 | 164 |
|
142 | 165 |
|
143 | 166 | <misc-hdr v2.0 component=grp> |
144 | | - <img slot=title class=title src='images/terminal.png' style='top:-15px;height:50px' alt='Node.js Terminal'> |
| 167 | + <img slot=title class=title src='images/nodejs-terminal.png' style='top:-15px;height:80px' alt='Node.js Terminal'> |
145 | 168 | <time slot=date datetime=2026-04-19> |
146 | 169 | 19 Apr 2026 |
147 | 170 | </time> |
148 | 171 | </misc-hdr> |
149 | 172 |
|
| 173 | + <div id=hdr> |
| 174 | + |
| 175 | + <file-mod component></file-mod> |
| 176 | + |
| 177 | + </div> |
| 178 | + |
| 179 | + <div id=hldr> |
| 180 | + <div id=terminal> |
| 181 | + </div> |
| 182 | + </div> |
150 | 183 |
|
151 | | - <div id=terminal></div> |
152 | 184 |
|
| 185 | + <log-mod component></log-mod> |
153 | 186 |
|
154 | 187 | </body> |
155 | 188 |
|
156 | 189 |
|
157 | 190 | <script> |
158 | 191 |
|
159 | 192 |
|
| 193 | + var cur = {}; |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + var complete = {}; |
| 198 | + |
| 199 | + |
| 200 | + //: |
| 201 | + |
160 | 202 | function initdom(){ |
161 | 203 |
|
| 204 | + |
| 205 | + misc.initdom(); |
| 206 | + misc.set.version(version); |
| 207 | + |
| 208 | + filemod.initdom(); |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + $('#hldr').style.background = theme.light.background; |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + log.initdom(); |
| 217 | + |
| 218 | + |
162 | 219 | }//initdom |
163 | 220 |
|
164 | 221 |
|
| 222 | + //: |
| 223 | + |
| 224 | + |
| 225 | + function source(){ |
| 226 | + }//source |
| 227 | + |
165 | 228 |
|
| 229 | + complete.load = function(file,blob){ |
166 | 230 |
|
| 231 | + |
| 232 | + cur.file = file; |
| 233 | + cur.blob = blob; |
| 234 | + |
| 235 | + |
| 236 | + }//load |
| 237 | + |
| 238 | + |
| 239 | + complete.save = function(file,confirm){ |
| 240 | + }//save |
| 241 | + |
| 242 | + |
| 243 | + //: |
| 244 | + |
| 245 | + |
167 | 246 | var theme = {}; |
168 | 247 |
|
169 | 248 | theme.light = { |
|
272 | 351 | rendererType : 'dom', |
273 | 352 |
|
274 | 353 | }); |
| 354 | + |
275 | 355 | var fitAddon = new FitAddon(); |
276 | 356 | term.loadAddon(fitAddon); |
277 | 357 | term.open(terminal); |
278 | 358 | fitAddon.fit(); |
279 | 359 | term.write('booting container ...\r\n') |
280 | | - var webcontainer = await WebContainer.boot(); |
| 360 | + webcontainer = await WebContainer.boot(); |
281 | 361 | term.write('spawn jsh ...\r\n') |
282 | | - var shell = await webcontainer.spawn('jsh'); |
| 362 | + shell = await webcontainer.spawn('jsh'); |
283 | 363 | var output = new WritableStream({write(data){term.write(data)}}); |
284 | 364 | shell.output.pipeTo(output); |
285 | 365 |
|
286 | 366 | var input = shell.input.getWriter(); |
287 | 367 | term.onData(data=>input.write(data)); |
288 | 368 |
|
| 369 | + term.resize(); |
289 | 370 | term.focus(); |
290 | 371 |
|
291 | 372 | </script> |
|
0 commit comments