Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

5.8 KB
Raw Blame
import { colors, getMobileColorScheme } from '../../theme/mobile-theme'
import { TEXT_INPUT_FONT_SIZE } from '../../platform/text-input-font-size'

// Read theme at build time; native embeds sheet, page scopes it to editor host.
// Bind size to text-input seam: native body size, web>=16px floor prevents iOS focus zoom that keyboard seam mistakes for no keyboard; one binding keeps both hosts aligned.
export function richMarkdownEditorStyle(): string {
  return `    :root {
      color-scheme: ${getMobileColorScheme()};
      --background: ${colors.bgBase};
      --editor-surface: ${colors.bgBase};
      --foreground: ${colors.textPrimary};
      --muted-foreground: ${colors.textSecondary};
      --muted: ${colors.bgRaised};
      --border: ${colors.borderSubtle};
      --primary: ${colors.textPrimary};
      --primary-foreground: ${colors.bgBase};
      --accent-link: ${colors.accentBlue};
      --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
      --font-sans: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }
    * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
    html, body {
      width: 100%;
      min-height: 100%;
      margin: 0;
      background: var(--editor-surface);
      color: var(--foreground);
      font-family: var(--font-sans);
      overscroll-behavior: contain;
    }
    body { overflow: auto; }
    #editor {
      min-height: 100vh;
      padding: 18px 16px 112px;
      outline: none;
      font-size: ${TEXT_INPUT_FONT_SIZE}px;
      line-height: 1.7;
      word-wrap: break-word;
      overflow-wrap: anywhere;
      caret-color: var(--foreground);
    }
    #editor[contenteditable="false"] {
      opacity: 0.78;
    }
    #editor:empty::before,
    #editor p.is-empty:first-child::before {
      content: attr(data-placeholder);
      color: var(--muted-foreground);
      pointer-events: none;
    }
    #editor > :first-child { margin-top: 0; }
    h1, h2, h3, h4, h5, h6 {
      margin: 1.5em 0 0.5em;
      font-weight: 600;
      line-height: 1.3;
      letter-spacing: 0;
    }
    h1 { font-size: 1.85em; font-weight: 700; }
    h2 { font-size: 1.4em; }
    h3 { font-size: 1.15em; }
    p, ul, ol, blockquote { margin: 0.75em 0; }
    ul, ol { padding-left: 1.5em; }
    ul { list-style: disc; }
    ol { list-style: decimal; }
    li { margin: 0.15em 0; }
    li > p, ul[data-type="taskList"] > li > div > p { margin: 0; }
    ul[data-type="taskList"] {
      padding-left: 0;
      list-style: none;
    }
    ul[data-type="taskList"] > li {
      display: flex;
      align-items: flex-start;
      gap: 6px;
    }
    ul[data-type="taskList"] > li > label {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      height: 1.55em;
      user-select: none;
    }
    ul[data-type="taskList"] input[type="checkbox"] {
      appearance: none;
      width: 16px;
      height: 16px;
      margin: 0;
      border: 1.5px solid color-mix(in srgb, var(--foreground) 55%, transparent);
      border-radius: 4px;
      background: transparent;
      position: relative;
    }
    ul[data-type="taskList"] input[type="checkbox"]:checked {
      background: var(--primary);
      border-color: var(--primary);
    }
    ul[data-type="taskList"] input[type="checkbox"]:checked::after {
      content: "";
      position: absolute;
      left: 4px;
      top: 1px;
      width: 5px;
      height: 9px;
      border: solid var(--primary-foreground);
      border-width: 0 2px 2px 0;
      transform: rotate(45deg);
    }
    ul[data-type="taskList"] input[type="checkbox"]:disabled {
      opacity: 0.65;
    }
    ul[data-type="taskList"] > li > div {
      flex: 1;
      min-width: 0;
    }
    ul[data-type="taskList"] > li[data-checked="true"] > div {
      text-decoration: line-through;
      color: var(--muted-foreground);
    }
    blockquote {
      padding: 0.5em 1em;
      border-left: 3px solid var(--border);
      border-radius: 0 6px 6px 0;
      color: var(--muted-foreground);
      background: color-mix(in srgb, var(--foreground) 2%, transparent);
    }
    table {
      width: 100%;
      margin: 1em 0;
      border-collapse: collapse;
      font-size: 0.95em;
    }
    th, td {
      padding: 8px 14px;
      border: 1px solid var(--border);
      text-align: left;
      vertical-align: top;
    }
    th {
      font-weight: 600;
      background: color-mix(in srgb, var(--foreground) 4%, transparent);
    }
    tr:nth-child(odd) td {
      background: color-mix(in srgb, var(--foreground) 1.5%, transparent);
    }
    code {
      padding: 0.2em 0.4em;
      border-radius: 5px;
      background: color-mix(in srgb, var(--foreground) 8%, transparent);
      font-size: 0.88em;
      font-family: var(--font-mono);
    }
    pre {
      margin: 0.75em 0;
      padding: 14px 18px;
      border-radius: 8px;
      border: 1px solid color-mix(in srgb, var(--foreground) 6%, transparent);
      overflow-x: auto;
      line-height: 1.55;
      background: color-mix(in srgb, var(--foreground) 6%, transparent);
      font-family: var(--font-mono);
      white-space: pre-wrap;
    }
    pre::before {
      content: attr(data-language);
      display: block;
      min-height: 13px;
      margin-bottom: 4px;
      color: var(--muted-foreground);
      font-size: 11px;
      text-transform: uppercase;
    }
    pre code {
      padding: 0;
      border-radius: 0;
      background: transparent;
      font-size: 0.92em;
      white-space: pre-wrap;
    }
    hr {
      margin: 1.5em 0;
      border: none;
      border-top: 1px solid var(--border);
    }
    a {
      color: var(--accent-link);
      text-decoration: underline;
      text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
      text-underline-offset: 2px;
    }
    img {
      display: block;
      max-width: 100%;
      margin: 0.75em 0;
      border-radius: 8px;
    }`
}