Skip to content

Conversation

@jsantell
Copy link
Collaborator

@jsantell jsantell commented Oct 29, 2025

  • Extend RenderNode with undefined and Opaque<any>
  • Extend CellLike to include OpaqueRefMethods and Opaque
  • Added namespace CTDOM, defining valid native DOM elements and attributes, similar to what Preact/React provides. Native events elided.
    • In lieu of a "compiling .d.ts" files solution, or change how we handle implicit types in compiler, this is one big file
  • Extend jsx.d.ts with our own Elements.
    • Types were mostly added as-needed. We have a lot of components! Not sure how we want to type some of the events/CellLike values.
  • Extend native and CT elements with our own onClick cell-based handler. Can extend more as needed.
  • The permissive parameter [elemName: string]: any; has been disabled for now. Can re-enable to allow undefined elements as needed.
  • Applies to workspace as well as patterns

Summary by cubic

Defined CTDOM types directly in jsx.d.ts to replace TypeScript’s DOM lib, adding strong typings for native HTML tags and CT custom elements in the sandboxed runtime. Also extended JSX wrappers and RenderNode to support Opaque and undefined.

  • New Features

    • Introduced CTDOM with DOM/ARIA typings and a comprehensive native IntrinsicElements mapping.
    • Typed a broader set of CT elements (e.g., ct-screen, ct-button, ct-chat, ct-code-editor, ct-prompt-input, ct-tags, ct-toolbar, ct-vscroll/hscroll, common-* variants) with structured props.
    • Added a cell-based onClick handler in HTMLAttributes; expanded CellLike to include Opaque and OpaqueRefMethods; RenderNode now allows undefined and Opaque.
  • Refactors

    • Rewrote jsx.d.ts to use CTDOM and DetailedHTMLProps-based mappings; removed loose prop shapes.

Written for commit b536562. Summary will update automatically on new commits.

@jsantell jsantell marked this pull request as ready for review October 30, 2025 17:40
@jsantell jsantell force-pushed the jsx-types branch 3 times, most recently from 82e5fb4 to 8f05c24 Compare October 30, 2025 18:37
export interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
// CT extensions
"onClick"?: CellLike<HandlerEvent<unknown>>;
"children"?: RenderNode | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this always be an array?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type RenderNode = RenderNode[] | .. so this suffices, I think in the html renderer we make it an array if not

Copy link
Contributor

@seefeldb seefeldb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! obviously a lot to eventually carefully trim down, but this will last us for a bit, thank you!

@jsantell jsantell force-pushed the jsx-types branch 2 times, most recently from 3c3a3c6 to 9ff6045 Compare October 30, 2025 20:57
@jsantell jsantell merged commit a0c21d9 into main Oct 31, 2025
8 checks passed
@jsantell jsantell deleted the jsx-types branch October 31, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants