{
  "antiPatterns": [
    "Submitting on key identity alone while a candidate list is open.",
    "Preventing the browser default for a candidate-confirming Enter."
  ],
  "api": {
    "importPath": "@ancrel/workspace/keyboard",
    "symbols": [
      "isImeComposing",
      "guardImeEnter",
      "isMacPlatform",
      "shouldSubmit",
      "formatSendShortcutDisplay",
      "useImeSafeSubmit",
      "KeyEventLike",
      "SendShortcut"
    ],
    "typeRef": "api/workspace/keyboard/index.d.ts"
  },
  "constraints": [
    "Attach all three useImeSafeSubmit handlers to the input receiving composition events.",
    "Use mod-enter for Command+Enter on Apple platforms or Ctrl+Enter elsewhere."
  ],
  "docs": "raw/frontend/ime.md",
  "examples": [
    {
      "code": "'use client'\n\nimport { formatSendShortcutDisplay, shouldSubmit } from '@ancrel/workspace/keyboard'\n\nexport default function App() {\n  return (\n    <form onSubmit={event => {\n      event.preventDefault()\n      const form = event.currentTarget\n      const result = form.elements.namedItem('sent') as HTMLOutputElement\n      result.value = String(new FormData(form).get('message'))\n    }}>\n      <label>\n        Message\n        <textarea name=\"message\" onKeyDown={event => {\n          if (shouldSubmit(event, 'enter')) {\n            event.preventDefault()\n            event.currentTarget.form?.requestSubmit()\n          }\n        }} />\n      </label>\n      <button type=\"submit\">Send {formatSendShortcutDisplay('enter')}</button>\n      <output name=\"sent\" aria-label=\"Last sent message\" />\n    </form>\n  )\n}\n",
      "command": "pnpm test",
      "entry": "examples/fe.ime/App.tsx",
      "fixture": "examples/fe.ime/",
      "id": "minimal"
    }
  ],
  "id": "fe.ime",
  "kind": "library",
  "language": "typescript",
  "layer": "frontend",
  "owner": "frontend-infra",
  "package": {
    "ecosystem": "npm",
    "name": "@ancrel/workspace",
    "version": "0.2.0"
  },
  "provenance": {
    "changes": "Separated DOM-compatible composition and platform checks from the React adapter. Preserved native and legacy composition signals and the trailing Enter guard used by the composer. Added platform-specific submission matching, SSR-safe platform detection and language-neutral shortcut display.",
    "commit": "4cc384c3bdbd09a3a50268adf81ba23f53aac93e",
    "mode": "extracted",
    "origin": "rule-studio",
    "path": "frontend/src/utils/ime.ts",
    "rights": "org-internal; approved-by=owner; ref=item-15"
  },
  "schemaVersion": 1,
  "stability": "experimental",
  "summary": "Recognize composition and platform modifiers before submitting a text input from Enter."
}
