bootstrap.ts 937 B

1234567891011121314151617181920212223
  1. import { TITLE } from "#office/wording.ts";
  2. import { readText } from "#ui/assets.ts";
  3. import { getHost } from "#ui/host.ts";
  4. // Small loader inlined in panel.html: connect once, then pull the UI bundle through MCP resources
  5. // (one large HTML resource would exceed host limits) and run it in the same page and App.
  6. (async () => {
  7. getHost();
  8. const manifest = JSON.parse(await readText("assets.json")) as { scripts: string[] };
  9. const [css, ...parts] = await Promise.all([
  10. readText("panel.css"),
  11. ...manifest.scripts.map(readText),
  12. ]);
  13. const style = document.createElement("style");
  14. style.textContent = css;
  15. document.head.append(style);
  16. const script = document.createElement("script");
  17. script.textContent = parts.join("");
  18. document.body.append(script);
  19. })().catch((error: Error) => {
  20. const root = document.getElementById("root");
  21. if (root) root.textContent = `${TITLE} failed to load: ${error.message}`;
  22. });