;; ── Compile handler (POST endpoint) ─────────────────────────────
(defcomp
  (&key source description)
  (div
    (~tw :tokens "border border-gray-200 rounded-lg p-4 mb-4")
    (when
      description
      (p (~tw :tokens "text-sm text-gray-600 mb-2") description))
    (div
      (~tw :tokens "flex gap-4 items-start mb-3")
      (div
        (~tw :tokens "flex-1")
        (h4
          (~tw
            :tokens "text-xs font-semibold uppercase tracking-wider text-gray-400 mb-1")
          "Source")
        (pre
          (~tw
            :tokens "bg-gray-50 text-gray-900 p-3 rounded text-sm font-mono whitespace-pre-wrap break-words")
          (str "_=\"" source "\"")))
      (when
        (string-contains? source "on click")
        (div
          (~tw :tokens "flex-shrink-0 pt-5")
          (button
            (~tw
              :tokens "px-4 py-2 border border-violet-300 rounded-lg text-sm font-medium text-violet-700 hover:bg-violet-50 transition-colors")
            :_ source
            "Try it"))))
    (~hyperscript/compile-result :source source)))
