Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move global JSX namespace to separate export #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./jsx": {
"import": "./dist/jsx/index.js",
"types": "./dist/jsx/index.d.ts"
},
"./jsx-runtime": {
"import": "./dist/jsx/runtime.js",
"types": "./dist/jsx/runtime.d.ts"
Expand Down Expand Up @@ -89,8 +93,8 @@
"oby": "^15.1.1"
},
"devDependencies": {
"@types/node": "^18.19.28",
"tsex": "^3.2.1",
"@types/node": "^22.5.4",
"tsex": "^4.0.2",
"typescript": "^5.4.3"
}
}
129 changes: 129 additions & 0 deletions src/jsx/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

/* IMPORT */

import type { JSX as JSXInternal } from "./types";

/* GLOBALS */

declare global {
namespace JSX {
type ArrayMaybe = JSXInternal.ArrayMaybe
type FunctionMaybe = JSXInternal.FunctionMaybe
type ObservableMaybe = JSXInternal.ObservableMaybe
type Nullable = JSXInternal.Nullable
type AllClassProperties = JSXInternal.AllClassProperties
type DOMCSSProperties = JSXInternal.DOMCSSProperties
type DOMCSSVariables = JSXInternal.DOMCSSVariables
type HTMLAttributeReferrerPolicy = JSXInternal.HTMLAttributeReferrerPolicy
type Child = JSXInternal.Child
type Children = JSXInternal.Children
type Class = JSXInternal.Class
type Component = JSXInternal.Component
type Element = JSXInternal.Element
type Ref = JSXInternal.Ref
type Refs = JSXInternal.Refs
type Style = JSXInternal.Style
type IntrinsicElement<T extends keyof JSXInternal.IntrinsicElements> = JSXInternal.IntrinsicElement<T>
interface ClassProperties extends JSXInternal.ClassProperties { }
interface StyleProperties extends JSXInternal.StyleProperties { }
type TargetedEvent = JSXInternal.TargetedEvent
type TargetedAnimationEvent<T extends EventTarget> = JSXInternal.TargetedAnimationEvent<T>
type TargetedClipboardEvent<T extends EventTarget> = JSXInternal.TargetedClipboardEvent<T>
type TargetedCompositionEvent<T extends EventTarget> = JSXInternal.TargetedCompositionEvent<T>
type TargetedDragEvent<T extends EventTarget> = JSXInternal.TargetedDragEvent<T>
type TargetedFocusEvent<T extends EventTarget> = JSXInternal.TargetedFocusEvent<T>
type TargetedInputEvent<T extends EventTarget> = JSXInternal.TargetedInputEvent<T>
type TargetedKeyboardEvent<T extends EventTarget> = JSXInternal.TargetedKeyboardEvent<T>
type TargetedMouseEvent<T extends EventTarget> = JSXInternal.TargetedMouseEvent<T>
type TargetedPointerEvent<T extends EventTarget> = JSXInternal.TargetedPointerEvent<T>
type TargetedSubmitEvent<T extends EventTarget> = JSXInternal.TargetedSubmitEvent<T>
type TargetedTouchEvent<T extends EventTarget> = JSXInternal.TargetedTouchEvent<T>
type TargetedTransitionEvent<T extends EventTarget> = JSXInternal.TargetedTransitionEvent<T>
type TargetedUIEvent<T extends EventTarget> = JSXInternal.TargetedUIEvent<T>
type TargetedWheelEvent<T extends EventTarget> = JSXInternal.TargetedWheelEvent<T>
type EventHandler<T extends JSXInternal.TargetedEvent> = JSXInternal.EventHandler<T>
type AnimationEventHandler<T extends EventTarget> = JSXInternal.AnimationEventHandler<T>
type ClipboardEventHandler<T extends EventTarget> = JSXInternal.ClipboardEventHandler<T>
type CompositionEventHandler<T extends EventTarget> = JSXInternal.CompositionEventHandler<T>
type DragEventHandler<T extends EventTarget> = JSXInternal.DragEventHandler<T>
type FocusEventHandler<T extends EventTarget> = JSXInternal.FocusEventHandler<T>
type GenericEventHandler<T extends EventTarget> = JSXInternal.GenericEventHandler<T>
type InputEventHandler<T extends EventTarget> = JSXInternal.InputEventHandler<T>
type KeyboardEventHandler<T extends EventTarget> = JSXInternal.KeyboardEventHandler<T>
type MouseEventHandler<T extends EventTarget> = JSXInternal.MouseEventHandler<T>
type PointerEventHandler<T extends EventTarget> = JSXInternal.PointerEventHandler<T>
type SubmitEventHandler<T extends EventTarget> = JSXInternal.SubmitEventHandler<T>
type TouchEventHandler<T extends EventTarget> = JSXInternal.TouchEventHandler<T>
type TransitionEventHandler<T extends EventTarget> = JSXInternal.TransitionEventHandler<T>
type UIEventHandler<T extends EventTarget> = JSXInternal.UIEventHandler<T>
type WheelEventHandler<T extends EventTarget> = JSXInternal.WheelEventHandler<T>
interface ElementAttributesProperty extends JSXInternal.ElementAttributesProperty { }
interface ElementChildrenAttribute extends JSXInternal.ElementChildrenAttribute { }
interface IntrinsicAttributes extends JSXInternal.IntrinsicAttributes { }
interface AriaAttributes extends JSXInternal.AriaAttributes { }
interface Directives extends JSXInternal.Directives { }
type DirectiveAttributes = JSXInternal.DirectiveAttributes
interface EventAttributes<T extends EventTarget> extends JSXInternal.EventAttributes<T> { }
interface ViewAttributes extends JSXInternal.ViewAttributes { }
interface DOMAttributes<T extends EventTarget> extends JSXInternal.DOMAttributes<T> { }
interface VoidHTMLAttributes<T extends EventTarget> extends JSXInternal.VoidHTMLAttributes<T> { }
interface HTMLAttributes<T extends EventTarget> extends JSXInternal.HTMLAttributes<T> { }
interface SVGAttributes<T extends EventTarget> extends JSXInternal.SVGAttributes<T> { }
interface AnchorHTMLAttributes<T extends EventTarget> extends JSXInternal.AnchorHTMLAttributes<T> { }
interface AudioHTMLAttributes<T extends EventTarget> extends JSXInternal.AudioHTMLAttributes<T> { }
interface AreaHTMLAttributes<T extends EventTarget> extends JSXInternal.AreaHTMLAttributes<T> { }
interface BaseHTMLAttributes<T extends EventTarget> extends JSXInternal.BaseHTMLAttributes<T> { }
interface BlockquoteHTMLAttributes<T extends EventTarget> extends JSXInternal.BlockquoteHTMLAttributes<T> { }
interface BrHTMLAttributes<T extends EventTarget> extends JSXInternal.BrHTMLAttributes<T> { }
interface ButtonHTMLAttributes<T extends EventTarget> extends JSXInternal.ButtonHTMLAttributes<T> { }
interface CanvasHTMLAttributes<T extends EventTarget> extends JSXInternal.CanvasHTMLAttributes<T> { }
interface ColHTMLAttributes<T extends EventTarget> extends JSXInternal.ColHTMLAttributes<T> { }
interface ColgroupHTMLAttributes<T extends EventTarget> extends JSXInternal.ColgroupHTMLAttributes<T> { }
interface DataHTMLAttributes<T extends EventTarget> extends JSXInternal.DataHTMLAttributes<T> { }
interface DetailsHTMLAttributes<T extends EventTarget> extends JSXInternal.DetailsHTMLAttributes<T> { }
interface DelHTMLAttributes<T extends EventTarget> extends JSXInternal.DelHTMLAttributes<T> { }
interface DialogHTMLAttributes<T extends EventTarget> extends JSXInternal.DialogHTMLAttributes<T> { }
interface EmbedHTMLAttributes<T extends EventTarget> extends JSXInternal.EmbedHTMLAttributes<T> { }
interface FieldsetHTMLAttributes<T extends EventTarget> extends JSXInternal.FieldsetHTMLAttributes<T> { }
interface FormHTMLAttributes<T extends EventTarget> extends JSXInternal.FormHTMLAttributes<T> { }
interface HrHTMLAttributes<T extends EventTarget> extends JSXInternal.HrHTMLAttributes<T> { }
interface HtmlHTMLAttributes<T extends EventTarget> extends JSXInternal.HtmlHTMLAttributes<T> { }
interface IframeHTMLAttributes<T extends EventTarget> extends JSXInternal.IframeHTMLAttributes<T> { }
interface ImgHTMLAttributes<T extends EventTarget> extends JSXInternal.ImgHTMLAttributes<T> { }
interface InsHTMLAttributes<T extends EventTarget> extends JSXInternal.InsHTMLAttributes<T> { }
interface InputHTMLAttributes<T extends EventTarget> extends JSXInternal.InputHTMLAttributes<T> { }
interface KeygenHTMLAttributes<T extends EventTarget> extends JSXInternal.KeygenHTMLAttributes<T> { }
interface LabelHTMLAttributes<T extends EventTarget> extends JSXInternal.LabelHTMLAttributes<T> { }
interface LiHTMLAttributes<T extends EventTarget> extends JSXInternal.LiHTMLAttributes<T> { }
interface LinkHTMLAttributes<T extends EventTarget> extends JSXInternal.LinkHTMLAttributes<T> { }
interface MapHTMLAttributes<T extends EventTarget> extends JSXInternal.MapHTMLAttributes<T> { }
interface MenuHTMLAttributes<T extends EventTarget> extends JSXInternal.MenuHTMLAttributes<T> { }
interface MediaHTMLAttributes<T extends EventTarget> extends JSXInternal.MediaHTMLAttributes<T> { }
interface MetaHTMLAttributes<T extends EventTarget> extends JSXInternal.MetaHTMLAttributes<T> { }
interface MeterHTMLAttributes<T extends EventTarget> extends JSXInternal.MeterHTMLAttributes<T> { }
interface QuoteHTMLAttributes<T extends EventTarget> extends JSXInternal.QuoteHTMLAttributes<T> { }
interface ObjectHTMLAttributes<T extends EventTarget> extends JSXInternal.ObjectHTMLAttributes<T> { }
interface OlHTMLAttributes<T extends EventTarget> extends JSXInternal.OlHTMLAttributes<T> { }
interface OptgroupHTMLAttributes<T extends EventTarget> extends JSXInternal.OptgroupHTMLAttributes<T> { }
interface OptionHTMLAttributes<T extends EventTarget> extends JSXInternal.OptionHTMLAttributes<T> { }
interface OutputHTMLAttributes<T extends EventTarget> extends JSXInternal.OutputHTMLAttributes<T> { }
interface ParamHTMLAttributes<T extends EventTarget> extends JSXInternal.ParamHTMLAttributes<T> { }
interface ProgressHTMLAttributes<T extends EventTarget> extends JSXInternal.ProgressHTMLAttributes<T> { }
interface SlotHTMLAttributes<T extends EventTarget> extends JSXInternal.SlotHTMLAttributes<T> { }
interface ScriptHTMLAttributes<T extends EventTarget> extends JSXInternal.ScriptHTMLAttributes<T> { }
interface SelectHTMLAttributes<T extends EventTarget> extends JSXInternal.SelectHTMLAttributes<T> { }
interface SourceHTMLAttributes<T extends EventTarget> extends JSXInternal.SourceHTMLAttributes<T> { }
interface StyleHTMLAttributes<T extends EventTarget> extends JSXInternal.StyleHTMLAttributes<T> { }
interface TableHTMLAttributes<T extends EventTarget> extends JSXInternal.TableHTMLAttributes<T> { }
interface TextareaHTMLAttributes<T extends EventTarget> extends JSXInternal.TextareaHTMLAttributes<T> { }
interface TdHTMLAttributes<T extends EventTarget> extends JSXInternal.TdHTMLAttributes<T> { }
interface ThHTMLAttributes<T extends EventTarget> extends JSXInternal.ThHTMLAttributes<T> { }
interface TimeHTMLAttributes<T extends EventTarget> extends JSXInternal.TimeHTMLAttributes<T> { }
interface TrackHTMLAttributes<T extends EventTarget> extends JSXInternal.TrackHTMLAttributes<T> { }
interface VideoHTMLAttributes<T extends EventTarget> extends JSXInternal.VideoHTMLAttributes<T> { }
interface WbrHTMLAttributes<T extends EventTarget> extends JSXInternal.WbrHTMLAttributes<T> { }
interface WebViewHTMLAttributes<T extends EventTarget> extends JSXInternal.WebViewHTMLAttributes<T> { }
interface IntrinsicElementsMap extends JSXInternal.IntrinsicElementsMap { }
interface IntrinsicElements extends JSXInternal.IntrinsicElements { }
}
}
2 changes: 1 addition & 1 deletion src/jsx/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

/* IMPORT */

import './types';
import Fragment from '~/components/fragment';
import createElement from '~/methods/create_element';
import type {Component, Element} from '~/types';
Expand All @@ -18,4 +17,5 @@ const jsx = <P extends {} = {}> ( component: Component<P>, props?: P | null, key

/* EXPORT */

export * from './types';
export {jsx, jsx as jsxs, jsx as jsxDEV, Fragment};
Loading