← Files thinkcellARCHIVED FILE

ui/installation-help.html

4.2 KB · Nov 30, 2026 · 15:10 UTC

↓ Download file

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Set up think-cell Charts</title>
  <style>
    :root { color-scheme: light; font-family: system-ui, sans-serif; }
    * { box-sizing: border-box; }
    html, body, main, section { background: #fff; color: #222; }
    body { margin: 0; }
    main { max-width: 540px; }
    .brand { display: block; width: 100%; height: auto; }
    section { padding: 24px 28px 28px; }
    h1 { margin: 0 0 12px; font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -.025em; }
    p { margin: 0 0 20px; font-size: 15px; line-height: 1.55; color: #555; }
    .action { display: inline-block; padding: 12px 18px; border-radius: 7px; background: #E9163C; color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; }
    .action:hover { background: #a30f2a; }
    a:focus-visible { outline: 3px solid #2580bb; outline-offset: 4px; }
    .website { display: block; width: fit-content; margin: 14px 0 22px; color: inherit; font-size: 14px; text-underline-offset: 3px; }
    .next { margin: 0; font-size: 13px; }
    @media (max-width: 360px) { section { padding: 20px; } h1 { font-size: 22px; } }
  </style>
</head>
<body>
  <main>
    <img class="brand" src="__THINKCELL_BANNER__" alt="thinkcell">
    <section>
    <h1>__TITLE__</h1>
    <p>__MESSAGE__</p>
    <a class="action" href="__WEBSITE__" target="_blank" rel="noopener noreferrer">__ACTIONLABEL__</a>
    <p class="next">__RESTARTNOTE__</p>
    </section>
  </main>
  <script>
    (() => {
      // Standalone previews do not have an MCP Apps host to initialize.
      if (window.parent === window) return;

      const host = window.parent;
      const initializeId = 'thinkcell-installation-help-initialize';
      const content = document.querySelector('main');
      let initialized = false;
      let resizeObserver;
      let lastSize;

      function send(message) {
        // Sandboxed frames may have opaque origins; only accept replies from our parent.
        host.postMessage({ jsonrpc: '2.0', ...message }, '*');
      }

      function reportSize() {
        if (!initialized) return;
        const bounds = content.getBoundingClientRect();
        const size = { width: Math.ceil(bounds.width), height: Math.ceil(bounds.height) };
        if (lastSize && lastSize.width === size.width && lastSize.height === size.height) return;
        lastSize = size;
        send({ method: 'ui/notifications/size-changed', params: size });
      }

      function onMessage(event) {
        if (event.source !== host || event.data?.jsonrpc !== '2.0') return;
        const message = event.data;
        if (message.id === initializeId && !message.method) {
          if (initialized) return;
          if (message.error || !message.result?.protocolVersion) {
            console.error('thinkcell installation help initialization failed', message.error);
            return;
          }
          initialized = true;
          send({ method: 'ui/notifications/initialized', params: {} });
          reportSize();
          if (typeof ResizeObserver !== 'undefined') {
            resizeObserver = new ResizeObserver(reportSize);
            resizeObserver.observe(content);
          }
        } else if (message.method === 'ping' && message.id != null) {
          send({ id: message.id, result: {} });
        } else if (message.method === 'ui/resource-teardown' && message.id != null) {
          initialized = false;
          resizeObserver?.disconnect();
          window.removeEventListener('message', onMessage);
          send({ id: message.id, result: {} });
        } else if (message.method && message.id != null) {
          send({ id: message.id, error: { code: -32601, message: 'Method not found' } });
        }
      }

      window.addEventListener('message', onMessage);
      send({
        id: initializeId,
        method: 'ui/initialize',
        params: {
          appInfo: { name: 'thinkcell-installation-help', version: '0.1.4' },
          appCapabilities: {},
          protocolVersion: '2026-01-26'
        }
      });
    })();
  </script>
</body>
</html>

SHA-256: 4d3ab0da9841d373693f1ba9758bb1f339f8375598d90cd2ed8bde55a87dea34