ext-apps/typedoc.config.mjs
Olivier Chafik 0266171b92
Add addEventListener/removeEventListener with DOM-model on* semantics (#573)
* feat(events): DOM-model on* semantics with addEventListener/removeEventListener

Fixes #551 (useHostStyles broken: fonts clobber theme/CSS variables)
Fixes #225 (user onhostcontextchanged and SDK hooks mutually exclusive)

The on* setters now follow the DOM event model:
- Replace semantics (like el.onclick) with getters
- Coexist with addEventListener/removeEventListener listeners
- Both channels fire on dispatch: on* handler then listeners

Introduces ProtocolWithEvents base class between Protocol and
App/AppBridge. Each notification event gets a slot with two independent
channels (singular on* handler + addEventListener listener array).

useHostStyles hooks now use addEventListener with proper cleanup,
so they compose correctly with user on* handlers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix typedoc validation warnings

- Export AppEventMap, AppBridgeEventMap, ProtocolWithEvents so they
  appear in generated docs (they're part of public addEventListener
  signatures)
- Move AppBridgeEventMap above the AppBridge class JSDoc — it had been
  inserted between the doc block and the class, orphaning the AppBridge
  docs onto the wrong type
- Drop @param callback tags from on* getter/setter pairs — typedoc
  attaches the doc block to the getter signature which has no params
- Add MethodSchema to intentionallyNotExported (internal zod helper
  referenced by the now-documented eventSchemas field)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 18:48:33 +01:00

66 lines
1.8 KiB
JavaScript

import { OptionDefaults } from "typedoc";
/** @type {Partial<import('typedoc').TypeDocOptions>} */
const config = {
name: "MCP Apps",
readme: "README.md",
headings: {
readme: false,
},
gitRevision: "main",
projectDocuments: [
"docs/overview.md",
"docs/quickstart.md",
"docs/agent-skills.md",
"docs/testing-mcp-apps.md",
"docs/patterns.md",
"docs/authorization.md",
"docs/csp-cors.md",
"docs/migrate_from_openai_apps.md",
],
entryPoints: [
"src/server/index.ts",
"src/app.ts",
"src/react/index.tsx",
"src/app-bridge.ts",
"src/message-transport.ts",
"src/types.ts",
],
excludePrivate: true,
excludeInternal: false,
intentionallyNotExported: ["AppOptions", "MethodSchema"],
blockTags: [...OptionDefaults.blockTags, "@description"],
jsDocCompatibility: {
exampleTag: false,
},
includeVersion: false,
categorizeByGroup: true,
groupOrder: ["Getting Started", "Security", "Modules", "*"],
navigation: {
includeGroups: true,
},
navigationLinks: {
GitHub: "https://github.com/modelcontextprotocol/ext-apps",
Specification:
"https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx",
},
hostedBaseUrl: "https://apps.extensions.modelcontextprotocol.io/api/",
customCss: "./docs/mcp-theme.css",
out: "docs/api",
plugin: [
"typedoc-github-theme",
"./scripts/typedoc-plugin-fix-mermaid-entities.mjs",
"./scripts/typedoc-plugin-seo.mjs",
"./scripts/typedoc-plugin-mcpstyle.mjs",
"@boneskull/typedoc-plugin-mermaid",
],
ignoredHighlightLanguages: ["mermaid"],
locales: {
en: {
kind_plural_document: "Getting Started",
kind_plural_module: "API Documentation",
},
},
};
export default config;