@@ -12,18 +12,18 @@ import type {
1212 VNode ,
1313} from "commontools" ;
1414
15+ /**
16+ * Used to represent DOM API's where users can either pass
17+ * true or false as a boolean or as its equivalent strings.
18+ */
19+ type Booleanish = boolean | "true" | "false" ;
20+
1521// DOM-ish types for the CT runtime.
1622// The DOM is not directly available within the runtime, but the JSX
1723// produced must be typed. This defines DOM types like React or Preact,
1824// with a subset of supported features, and cannot rely on globals
1925// existing like `HTMLElement` from TypeScript's `dom` lib.
2026declare namespace CTDOM {
21- /**
22- * Used to represent DOM API's where users can either pass
23- * true or false as a boolean or as its equivalent strings.
24- */
25- type Booleanish = boolean | "true" | "false" ;
26-
2727 /**
2828 * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN }
2929 */
@@ -1773,6 +1773,7 @@ declare namespace CTDOM {
17731773 export interface HTMLAttributes < T > extends AriaAttributes , DOMAttributes < T > {
17741774 // CT extensions
17751775 "onClick" ?: CellLike < HandlerEvent < unknown > > ;
1776+ "onChange" ?: CellLike < HandlerEvent < unknown > > ;
17761777 "children" ?: RenderNode | undefined ;
17771778 // Allow React-isms
17781779 "key" ?: number ;
@@ -1803,7 +1804,7 @@ declare namespace CTDOM {
18031804 | "search"
18041805 | "send"
18051806 | undefined ;
1806- hidden ?: boolean | undefined ;
1807+ hidden ?: Booleanish ; // CT addition to be compatible with our component usage of `hidden`
18071808 id ?: string | undefined ;
18081809 lang ?: string | undefined ;
18091810 nonce ?: string | undefined ;
@@ -2876,6 +2877,7 @@ interface CTHeadingElement extends CTHTMLElement {}
28762877interface CTCollapsibleElement extends CTHTMLElement { }
28772878interface CTThemeElement extends CTHTMLElement { }
28782879interface CTCodeEditorElement extends CTHTMLElement { }
2880+ interface CTCodeEditorLegacyElement extends CTHTMLElement { }
28792881interface CTScreenElement extends CTHTMLElement { }
28802882interface CTAutoLayoutElement extends CTHTMLElement { }
28812883interface CTButtonElement extends CTHTMLElement { }
@@ -2903,6 +2905,28 @@ interface CTCTCollapsibleElement extends CTHTMLElement {}
29032905interface CTFragmentElement extends CTHTMLElement { }
29042906interface CTUpdaterElement extends CTHTMLElement { }
29052907interface CTGoogleOAuthElement extends CTHTMLElement { }
2908+ interface CTCanvasElement extends CTHTMLElement { }
2909+ interface CTDraggableElement extends CTHTMLElement { }
2910+ interface CTPlaidLinkElement extends CTHTMLElement { }
2911+
2912+ interface CTDraggableAttributes < T > extends CTHTMLAttributes < T > {
2913+ "key" ?: number ;
2914+ "x" ?: CellLike < HandlerEvent < any > > ;
2915+ "y" ?: CellLike < HandlerEvent < any > > ;
2916+ "hidden" ?: Booleanish ;
2917+ "onpositionchange" ?: CellLike < HandlerEvent < any > > ;
2918+ }
2919+
2920+ interface CTCanvasAttributes < T > extends CTHTMLAttributes < T > {
2921+ "width" ?: string | number ;
2922+ "height" ?: string | number ;
2923+ "onct-canvas-click" ?: CellLike < HandlerEvent < any > > ;
2924+ }
2925+
2926+ interface CTPlaidLinkAttributes < T > extends CTHTMLAttributes < T > {
2927+ "$auth" ?: any ;
2928+ "products" ?: string [ ] ;
2929+ }
29062930
29072931interface CTGoogleOAuthAttributes < T > extends CTHTMLAttributes < T > {
29082932 "$auth" ?: any ;
@@ -3012,9 +3036,11 @@ interface CTMessageInputAttributes<T> extends CTHTMLAttributes<T> {
30123036
30133037interface CTSendMessageAttributes < T > extends CTHTMLAttributes < T > {
30143038 "name" ?: string ;
3039+ "value" ?: any ;
30153040 "placeholder" ?: string ;
30163041 "appearance" ?: "rounded" ;
30173042 "onmessagesend" ?: CellLike < HandlerEvent < { message : string } > > ;
3043+ "inline" ?: Booleanish ;
30183044}
30193045
30203046interface CTScrollAttributes < T > extends CTHTMLAttributes < T > {
@@ -3047,9 +3073,11 @@ interface CTButtonAttributes<T> extends CTHTMLAttributes<T> {
30473073 | "secondary"
30483074 | "ghost"
30493075 | "link"
3076+ | "danger"
30503077 | "pill" ;
30513078 "size" ?: "default" | "sm" | "lg" | "icon" ;
30523079 "disabled" ?: boolean ;
3080+ "outline" ?: boolean ;
30533081 "type" ?: "button" | "submit" | "reset" ;
30543082}
30553083
@@ -3121,7 +3149,7 @@ interface CTInputAttributes<T> extends CTHTMLAttributes<T> {
31213149 "validationPattern" ?: string ;
31223150 "showValidation" ?: boolean ;
31233151 "timingStrategy" ?: string ;
3124- "timingDelay" ?: number ;
3152+ "timingDelay" ?: number | string ;
31253153 "onct-change" ?: any ;
31263154 "onct-focus" ?: any ;
31273155 "onct-blur" ?: any ;
@@ -3144,7 +3172,7 @@ interface CTCheckboxAttributes<T> extends CTHTMLAttributes<T> {
31443172 "indeterminate" ?: boolean ;
31453173 "name" ?: string ;
31463174 "value" ?: string ;
3147- "onct-change" ?: any ;
3175+ "onct-change" ?: CellLike < HandlerEvent < any > > ;
31483176}
31493177
31503178interface CTSelectAttributes < T > extends CTHTMLAttributes < T > {
@@ -3188,11 +3216,17 @@ interface CTCollapsibleAttributes<T> extends CTHTMLAttributes<T> {
31883216interface CTThemeAttributes < T > extends CTHTMLAttributes < T > {
31893217 theme ?: CTThemeInput ;
31903218}
3219+ interface CTCodeEditorLegacyAttributes < T > extends CTHTMLAttributes < T > {
3220+ "source" ?: string ;
3221+ "language" ?: `text/${string } `;
3222+ "onChange" ?: any ;
3223+ "errors" ?: any [ ] ;
3224+ }
31913225
31923226interface CTCodeEditorAttributes < T > extends CTHTMLAttributes < T > {
31933227 "$value" ?: CellLike < string > ;
31943228 "value" ?: string ;
3195- "language" ?: string ;
3229+ "language" ?: `text/${ string } ` ;
31963230 "disabled" ?: boolean ;
31973231 "readonly" ?: boolean ;
31983232 "placeholder" ?: string ;
@@ -3799,6 +3833,30 @@ declare global {
37993833 CTGoogleOAuthAttributes < CTGoogleOAuthElement > ,
38003834 CTGoogleOAuthElement
38013835 > ;
3836+ "ct-canvas" : CTDOM . DetailedHTMLProps <
3837+ CTCanvasAttributes < CTCanvasElement > ,
3838+ CTCanvasElement
3839+ > ;
3840+ "ct-draggable" : CTDOM . DetailedHTMLProps <
3841+ CTDraggableAttributes < CTDraggableElement > ,
3842+ CTDraggableElement
3843+ > ;
3844+ "ct-alert" : CTDOM . DetailedHTMLProps <
3845+ CTHTMLAttributes < CTHTMLElement > ,
3846+ CTHTMLElement
3847+ > ;
3848+ "os-container" : CTDOM . DetailedHTMLProps <
3849+ CTHTMLAttributes < CTHTMLElement > ,
3850+ CTHTMLElement
3851+ > ;
3852+ "common-code-editor" : CTDOM . DetailedHTMLProps <
3853+ CTCodeEditorLegacyAttributes < CTCodeEditorLegacyElement > ,
3854+ CTCodeEditorLegacyElement
3855+ > ;
3856+ "common-plaid-link" : CTDOM . DetailedHTMLProps <
3857+ CTPlaidLinkAttributes < CTPlaidLinkElement > ,
3858+ CTPlaidLinkElement
3859+ > ;
38023860 // Define both `ct-` and `common-` variants
38033861 "ct-hstack" : CTDOM . DetailedHTMLProps <
38043862 CTStackAttributes < CTHStackElement > ,
0 commit comments