ext-apps/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
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
..
generated Add ui/notifications/request-teardown notification for view-initiated termination (#215) 2026-03-19 22:01:59 +02:00
react Add addEventListener/removeEventListener with DOM-model on* semantics (#573) 2026-03-30 18:48:33 +01:00
server Clarify spec and SDK: accept UIResourceMeta in both resources/list and resources/read (#410) 2026-02-04 14:26:09 +00:00
app-bridge.examples.ts docs: standardize UI terminology to use "view" consistently (#325) 2026-01-23 04:36:52 +02:00
app-bridge.test.ts Add addEventListener/removeEventListener with DOM-model on* semantics (#573) 2026-03-30 18:48:33 +01:00
app-bridge.ts Add addEventListener/removeEventListener with DOM-model on* semantics (#573) 2026-03-30 18:48:33 +01:00
app.examples.ts Add addEventListener/removeEventListener with DOM-model on* semantics (#573) 2026-03-30 18:48:33 +01:00
app.ts Add addEventListener/removeEventListener with DOM-model on* semantics (#573) 2026-03-30 18:48:33 +01:00
events.ts Add addEventListener/removeEventListener with DOM-model on* semantics (#573) 2026-03-30 18:48:33 +01:00
message-transport.examples.ts docs: standardize UI terminology to use "view" consistently (#325) 2026-01-23 04:36:52 +02:00
message-transport.ts fix: skip debug log for high-frequency tool-input-partial notifications 2026-03-10 17:25:12 +00:00
spec.types.ts Add ui/notifications/request-teardown notification for view-initiated termination (#215) 2026-03-19 22:01:59 +02:00
styles.examples.ts Improve patterns guide with concrete examples and safe area insets 2026-01-27 17:32:41 -06:00
styles.ts Improve patterns guide with concrete examples and safe area insets 2026-01-27 17:32:41 -06:00
types.ts Add ui/notifications/request-teardown notification for view-initiated termination (#215) 2026-03-19 22:01:59 +02:00