This commit is contained in:
EthanShoeDev
2025-10-04 21:03:01 -04:00
parent 65a5249c8f
commit 8b38104373
7 changed files with 286 additions and 104 deletions

View File

@@ -0,0 +1,18 @@
<!doctype html>
<html style="margin: 0; padding: 0; width: 100%; height: 100%">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
</head>
<body style="margin: 0; padding: 0px; width: 100%; height: 100%">
<div
id="terminal"
style="margin: 0; padding: 0; width: 100%; height: 100%"
></div>
<script type="module" src="/src-internal/main.tsx"></script>
<script type="module" src="/src-internal/dev.ts"></script>
</body>
</html>

View File

@@ -0,0 +1,14 @@
// This file is only loaded in dev mode.
// These lines should replicate injectedJavaScriptBeforeContentLoaded from src/index.tsx
document.body.style.backgroundColor = '#0B1324';
// Replicate injectedJavaScriptObject from src/index.tsx
window.ReactNativeWebView = {
postMessage: (data: string) => {
console.log('postMessage', data);
},
injectedObjectJson: () => {
return JSON.stringify({});
},
};

View File

@@ -153,7 +153,19 @@ window.onload = () => {
window.addEventListener('message', handler);
// Initial handshake (send once)
setTimeout(() => sendToRn({ type: 'initialized' }), 100);
setTimeout(() => {
const ta = document.querySelector(
'.xterm-helper-textarea',
) as HTMLTextAreaElement | null;
if (!ta) throw new Error('xterm-helper-textarea not found');
ta.setAttribute('autocomplete', 'off');
ta.setAttribute('autocorrect', 'off');
ta.setAttribute('autocapitalize', 'none');
ta.setAttribute('spellcheck', 'false');
ta.setAttribute('inputmode', 'verbatim');
return sendToRn({ type: 'initialized' });
}, 200);
} catch (e) {
sendToRn({
type: 'debug',

View File

@@ -2,9 +2,13 @@ import { defineConfig } from 'vite';
import { viteSingleFile } from 'vite-plugin-singlefile';
// https://vite.dev/config/
export default defineConfig({
plugins: [viteSingleFile()],
build: {
outDir: 'dist-internal',
},
export default defineConfig((ctx) => {
const input = ctx.command === 'serve' ? 'index.html' : 'index.build.html';
console.log('Vite Internal Working with input', input);
return {
plugins: [viteSingleFile()],
build: {
outDir: 'dist-internal',
},
};
});