From 19f1902919cdd2bd02a95853554a68e1c4d1817a Mon Sep 17 00:00:00 2001 From: Luiz Felipe Moureau Date: Tue, 20 Jun 2023 23:38:31 -0300 Subject: [PATCH 1/4] feat: added element ref type --- types/JSX.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/JSX.d.ts b/types/JSX.d.ts index 8995bee4..8d38a83d 100644 --- a/types/JSX.d.ts +++ b/types/JSX.d.ts @@ -44,12 +44,12 @@ type Booleanish = boolean | 'true' | 'false' // Nullstack Elements // ---------------------------------------------------------------------- -export interface Attributes { +export interface Attributes { html?: string source?: object bind?: any debounce?: number - ref?: any + ref?: NodeType 'data-'?: any children?: NullstackNode route?: string @@ -57,9 +57,9 @@ export interface Attributes { [key: string]: any } -export interface NullstackAttributes extends Attributes {} +export interface NullstackAttributes extends Attributes {} -export interface ClassAttributes extends Attributes { +export interface ClassAttributes extends Attributes { key?: string } @@ -218,9 +218,9 @@ type WheelEventHandler = EventHandler> type DetailedHTMLProps, T> = E -export interface SVGProps extends SVGAttributes, ClassAttributes {} +export interface SVGProps extends SVGAttributes, ClassAttributes {} -export interface DOMAttributes extends Attributes { +export interface DOMAttributes extends Attributes { // Focus Events onfocus?: FocusEventHandler onblur?: FocusEventHandler @@ -1243,8 +1243,8 @@ declare global { namespace JSX { type Element = NullstackNode - type IntrinsicAttributes = NullstackAttributes - type IntrinsicClassAttributes = ClassAttributes + type IntrinsicAttributes = NullstackAttributes + type IntrinsicClassAttributes = ClassAttributes interface AllElements { // HTML @@ -1429,7 +1429,7 @@ declare global { element: ElementTagHTMLAttributes } - interface IntrinsicElements extends ExoticElements, AllElements {} + interface IntrinsicElements extends AllElements {} interface ElementChildrenAttribute { children: NullstackNode From 36973d874ab94af776c6837dd82293729679e102 Mon Sep 17 00:00:00 2001 From: Luiz Felipe Moureau Date: Tue, 20 Jun 2023 23:41:14 -0300 Subject: [PATCH 2/4] revert instrinsicelements change --- types/JSX.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/JSX.d.ts b/types/JSX.d.ts index 8d38a83d..52c2535d 100644 --- a/types/JSX.d.ts +++ b/types/JSX.d.ts @@ -1429,7 +1429,7 @@ declare global { element: ElementTagHTMLAttributes } - interface IntrinsicElements extends AllElements {} + interface IntrinsicElements extends ExoticElements, AllElements {} interface ElementChildrenAttribute { children: NullstackNode From 567a4622f3e2a48765eb29f3582125a83b33dc64 Mon Sep 17 00:00:00 2001 From: Luiz Felipe Moureau Date: Tue, 20 Jun 2023 23:46:39 -0300 Subject: [PATCH 3/4] better naming --- types/JSX.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/JSX.d.ts b/types/JSX.d.ts index 52c2535d..fea00751 100644 --- a/types/JSX.d.ts +++ b/types/JSX.d.ts @@ -44,12 +44,12 @@ type Booleanish = boolean | 'true' | 'false' // Nullstack Elements // ---------------------------------------------------------------------- -export interface Attributes { +export interface Attributes { html?: string source?: object bind?: any debounce?: number - ref?: NodeType + ref?: HTMLElementType 'data-'?: any children?: NullstackNode route?: string From 59a66dde25b40f97488f3f96f6b0f2091710f67d Mon Sep 17 00:00:00 2001 From: Luiz Felipe Moureau Date: Wed, 21 Jun 2023 18:07:30 -0300 Subject: [PATCH 4/4] feat(JSX.d.ts): add support for function refs in NullstackClientContext to be able to use functional components with refs --- types/JSX.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/JSX.d.ts b/types/JSX.d.ts index fea00751..5c26248e 100644 --- a/types/JSX.d.ts +++ b/types/JSX.d.ts @@ -49,7 +49,7 @@ export interface Attributes { source?: object bind?: any debounce?: number - ref?: HTMLElementType + ref?: HTMLElementType | ((context?: Partial) => void) 'data-'?: any children?: NullstackNode route?: string