File size: 780 Bytes
811916b
 
 
c86c048
 
811916b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d0136a
 
811916b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// @ts-check

import './app.css';
// Import only the basic Crepe CSS, avoiding LaTeX/math dependencies
import '@milkdown/crepe/theme/frame.css';

import { cleanBody } from './clean-body';

export function initHTML() {
  const ui = document.createElement('div');
  ui.innerHTML = `
<div class=chat-log>Loading...</div>
<div class=chat-input>[Input]</div>
`;

  if (!document.body) {
    document.documentElement.appendChild(document.createElement('body'));
  } else {
    cleanBody();
  }

  for (const elem of [...ui.children]) {
    document.body.appendChild(elem);
  }

  const chatLog = /** @type {HTMLElement} */ (document.querySelector('.chat-log'));
  const chatInput = /** @type {HTMLElement} */ (document.querySelector('.chat-input'));

  return { chatLog, chatInput };
}