-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
90 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './jsx-runtime'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
'use strict'; | ||
module.exports = require('./jsx-runtime'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './es/jsx/jsx-runtime'; | ||
export { JSX } from './es/jsx/jsx-namespace'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { JSX as JSXNamespace } from './jsx-namespace'; | ||
import { ElementType } from '../types'; | ||
|
||
export namespace jsx { | ||
export namespace JSX { | ||
export type Element = JSXNamespace.Element; | ||
export type ElementClass = JSXNamespace.ElementClass; | ||
export type IntrinsicElements = JSXNamespace.IntrinsicElements; | ||
} | ||
} | ||
|
||
// 实现jsx-classic 入口 | ||
export function jsx(type: ElementType, config, ...children): JSXNamespace.Element { | ||
const { key, ref, ...props } = config || {}; | ||
|
||
// 保持和automatic模式一致 | ||
if (children.length) { | ||
props.children = children.length === 1 ? children[0] : children; | ||
} | ||
return { | ||
key, | ||
ref, | ||
type, | ||
props, | ||
// 存储一些过程中的cache值 | ||
_cache: {}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
Ref, | ||
ElementType, | ||
Props, | ||
RectProps, | ||
CircleProps, | ||
LineProps, | ||
PolygonProps, | ||
PolylineProps, | ||
ArcProps, | ||
SectorProps, | ||
TextProps, | ||
CustomProps, | ||
MarkerProps, | ||
ImageProps, | ||
} from '../types'; | ||
|
||
export namespace JSX { | ||
export interface Element { | ||
key: string; | ||
ref?: Ref; | ||
type: ElementType; | ||
props: Props; | ||
[key: string]: any; | ||
} | ||
|
||
export interface ElementClass { | ||
refs: {}; | ||
props: Props; | ||
render(): Element | null; | ||
} | ||
|
||
export interface IntrinsicElements { | ||
group: RectProps; | ||
rect: RectProps; | ||
circle: CircleProps; | ||
line: LineProps; | ||
polygon: PolygonProps; | ||
polyline: PolylineProps; | ||
arc: ArcProps; | ||
sector: SectorProps; | ||
text: TextProps; | ||
custom: CustomProps; | ||
marker: MarkerProps; | ||
image: ImageProps; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { jsx } from './jsx-automatic'; | ||
import Fragment from './fragment'; | ||
|
||
export { Fragment, jsx, jsx as jsxs }; | ||
export { Fragment, jsx, jsx as jsxs, jsx as jsxDEV }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters