33// deno-lint-ignore-file ban-types
44import type { Cell , CellLike , Props , RenderNode , VNode } from "commontools" ;
55
6+ /**
7+ * Used to represent DOM API's where users can either pass
8+ * true or false as a boolean or as its equivalent strings.
9+ */
10+ type Booleanish = boolean | "true" | "false" ;
11+
612// DOM-ish types for the CT runtime.
713// The DOM is not directly available within the runtime, but the JSX
814// produced must be typed. This defines DOM types like React or Preact,
915// with a subset of supported features, and cannot rely on globals
1016// existing like `HTMLElement` from TypeScript's `dom` lib.
1117declare namespace CTDOM {
12- /**
13- * Used to represent DOM API's where users can either pass
14- * true or false as a boolean or as its equivalent strings.
15- */
16- type Booleanish = boolean | "true" | "false" ;
17-
1818 /**
1919 * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN }
2020 */
@@ -1764,6 +1764,7 @@ declare namespace CTDOM {
17641764 export interface HTMLAttributes < T > extends AriaAttributes , DOMAttributes < T > {
17651765 // CT extensions
17661766 "onClick" ?: CellLike < HandlerEvent < unknown > > ;
1767+ "onChange" ?: CellLike < HandlerEvent < unknown > > ;
17671768 "children" ?: RenderNode | undefined ;
17681769 // Allow React-isms
17691770 "key" ?: number ;
@@ -1794,7 +1795,7 @@ declare namespace CTDOM {
17941795 | "search"
17951796 | "send"
17961797 | undefined ;
1797- hidden ?: boolean | undefined ;
1798+ hidden ?: Booleanish ; // CT addition to be compatible with our component usage of `hidden`
17981799 id ?: string | undefined ;
17991800 lang ?: string | undefined ;
18001801 nonce ?: string | undefined ;
@@ -2854,6 +2855,7 @@ interface CTHeadingElement extends CTHTMLElement {}
28542855interface CTCollapsibleElement extends CTHTMLElement { }
28552856interface CTThemeElement extends CTHTMLElement { }
28562857interface CTCodeEditorElement extends CTHTMLElement { }
2858+ interface CTCodeEditorLegacyElement extends CTHTMLElement { }
28572859interface CTScreenElement extends CTHTMLElement { }
28582860interface CTAutoLayoutElement extends CTHTMLElement { }
28592861interface CTButtonElement extends CTHTMLElement { }
@@ -2881,6 +2883,28 @@ interface CTCTCollapsibleElement extends CTHTMLElement {}
28812883interface CTFragmentElement extends CTHTMLElement { }
28822884interface CTUpdaterElement extends CTHTMLElement { }
28832885interface CTGoogleOAuthElement extends CTHTMLElement { }
2886+ interface CTCanvasElement extends CTHTMLElement { }
2887+ interface CTDraggableElement extends CTHTMLElement { }
2888+ interface CTPlaidLinkElement extends CTHTMLElement { }
2889+
2890+ interface CTDraggableAttributes < T > extends CTHTMLAttributes < T > {
2891+ "key" ?: number ;
2892+ "x" ?: CellLike < HandlerEvent < any > > ;
2893+ "y" ?: CellLike < HandlerEvent < any > > ;
2894+ "hidden" ?: Booleanish ;
2895+ "onpositionchange" ?: CellLike < HandlerEvent < any > > ;
2896+ }
2897+
2898+ interface CTCanvasAttributes < T > extends CTHTMLAttributes < T > {
2899+ "width" ?: string | number ;
2900+ "height" ?: string | number ;
2901+ "onct-canvas-click" ?: CellLike < HandlerEvent < any > > ;
2902+ }
2903+
2904+ interface CTPlaidLinkAttributes < T > extends CTHTMLAttributes < T > {
2905+ "$auth" ?: any ;
2906+ "products" ?: string [ ] ;
2907+ }
28842908
28852909interface CTGoogleOAuthAttributes < T > extends CTHTMLAttributes < T > {
28862910 "$auth" ?: any ;
@@ -2990,9 +3014,11 @@ interface CTMessageInputAttributes<T> extends CTHTMLAttributes<T> {
29903014
29913015interface CTSendMessageAttributes < T > extends CTHTMLAttributes < T > {
29923016 "name" ?: string ;
3017+ "value" ?: any ;
29933018 "placeholder" ?: string ;
29943019 "appearance" ?: "rounded" ;
29953020 "onmessagesend" ?: CellLike < HandlerEvent < { message : string } > > ;
3021+ "inline" ?: Booleanish ;
29963022}
29973023
29983024interface CTScrollAttributes < T > extends CTHTMLAttributes < T > {
@@ -3025,9 +3051,11 @@ interface CTButtonAttributes<T> extends CTHTMLAttributes<T> {
30253051 | "secondary"
30263052 | "ghost"
30273053 | "link"
3054+ | "danger"
30283055 | "pill" ;
30293056 "size" ?: "default" | "sm" | "lg" | "icon" ;
30303057 "disabled" ?: boolean ;
3058+ "outline" ?: boolean ;
30313059 "type" ?: "button" | "submit" | "reset" ;
30323060}
30333061
@@ -3099,7 +3127,7 @@ interface CTInputAttributes<T> extends CTHTMLAttributes<T> {
30993127 "validationPattern" ?: string ;
31003128 "showValidation" ?: boolean ;
31013129 "timingStrategy" ?: string ;
3102- "timingDelay" ?: number ;
3130+ "timingDelay" ?: number | string ;
31033131 "onct-change" ?: any ;
31043132 "onct-focus" ?: any ;
31053133 "onct-blur" ?: any ;
@@ -3122,7 +3150,7 @@ interface CTCheckboxAttributes<T> extends CTHTMLAttributes<T> {
31223150 "indeterminate" ?: boolean ;
31233151 "name" ?: string ;
31243152 "value" ?: string ;
3125- "onct-change" ?: any ;
3153+ "onct-change" ?: CellLike < HandlerEvent < any > > ;
31263154}
31273155
31283156interface CTSelectAttributes < T > extends CTHTMLAttributes < T > {
@@ -3166,11 +3194,17 @@ interface CTCollapsibleAttributes<T> extends CTHTMLAttributes<T> {
31663194interface CTThemeAttributes < T > extends CTHTMLAttributes < T > {
31673195 theme ?: CTThemeInput ;
31683196}
3197+ interface CTCodeEditorLegacyAttributes < T > extends CTHTMLAttributes < T > {
3198+ "source" ?: string ;
3199+ "language" ?: `text/${string } `;
3200+ "onChange" ?: any ;
3201+ "errors" ?: any [ ] ;
3202+ }
31693203
31703204interface CTCodeEditorAttributes < T > extends CTHTMLAttributes < T > {
31713205 "$value" ?: CellLike < string > ;
31723206 "value" ?: string ;
3173- "language" ?: string ;
3207+ "language" ?: `text/${ string } ` ;
31743208 "disabled" ?: boolean ;
31753209 "readonly" ?: boolean ;
31763210 "placeholder" ?: string ;
@@ -3777,6 +3811,30 @@ declare global {
37773811 CTGoogleOAuthAttributes < CTGoogleOAuthElement > ,
37783812 CTGoogleOAuthElement
37793813 > ;
3814+ "ct-canvas" : CTDOM . DetailedHTMLProps <
3815+ CTCanvasAttributes < CTCanvasElement > ,
3816+ CTCanvasElement
3817+ > ;
3818+ "ct-draggable" : CTDOM . DetailedHTMLProps <
3819+ CTDraggableAttributes < CTDraggableElement > ,
3820+ CTDraggableElement
3821+ > ;
3822+ "ct-alert" : CTDOM . DetailedHTMLProps <
3823+ CTHTMLAttributes < CTHTMLElement > ,
3824+ CTHTMLElement
3825+ > ;
3826+ "os-container" : CTDOM . DetailedHTMLProps <
3827+ CTHTMLAttributes < CTHTMLElement > ,
3828+ CTHTMLElement
3829+ > ;
3830+ "common-code-editor" : CTDOM . DetailedHTMLProps <
3831+ CTCodeEditorLegacyAttributes < CTCodeEditorLegacyElement > ,
3832+ CTCodeEditorLegacyElement
3833+ > ;
3834+ "common-plaid-link" : CTDOM . DetailedHTMLProps <
3835+ CTPlaidLinkAttributes < CTPlaidLinkElement > ,
3836+ CTPlaidLinkElement
3837+ > ;
37803838 // Define both `ct-` and `common-` variants
37813839 "ct-hstack" : CTDOM . DetailedHTMLProps <
37823840 CTStackAttributes < CTHStackElement > ,
0 commit comments