@oomfware/jsx 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/README.md +164 -0
- package/dist/index.d.mts +77 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +408 -0
- package/dist/index.mjs.map +1 -0
- package/dist/jsx-runtime-BQHdv_66.d.mts +1311 -0
- package/dist/jsx-runtime-BQHdv_66.d.mts.map +1 -0
- package/dist/jsx-runtime.d.mts +2 -0
- package/dist/jsx-runtime.mjs +34 -0
- package/dist/jsx-runtime.mjs.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +9 -0
- package/src/jsx-runtime.ts +33 -0
- package/src/lib/context.ts +98 -0
- package/src/lib/intrinsic-elements.ts +1592 -0
- package/src/lib/render.ts +504 -0
- package/src/lib/stream.test.tsx +625 -0
- package/src/lib/suspense.ts +57 -0
- package/src/lib/types.ts +37 -0
package/src/lib/types.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core JSX types, modeled after React's type definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// #region Component types
|
|
6
|
+
|
|
7
|
+
/** function component */
|
|
8
|
+
export type Component<P = {}> = (props: P) => JSXNode;
|
|
9
|
+
|
|
10
|
+
/** function component (alias for Component) */
|
|
11
|
+
export type FC<P = {}> = Component<P>;
|
|
12
|
+
|
|
13
|
+
// #endregion
|
|
14
|
+
|
|
15
|
+
// #region JSXElement
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* virtual element representing a JSX element
|
|
19
|
+
* @template P props type
|
|
20
|
+
* @template T element type (tag string or component)
|
|
21
|
+
*/
|
|
22
|
+
export interface JSXElement<P = unknown, T extends string | Component<any> = string | Component<any>> {
|
|
23
|
+
type: T;
|
|
24
|
+
props: P;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// #endregion
|
|
28
|
+
|
|
29
|
+
// #region JSXNode (children)
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* valid JSX child types - anything that can appear as children
|
|
33
|
+
* modeled after React's ReactNode
|
|
34
|
+
*/
|
|
35
|
+
export type JSXNode = JSXElement | string | number | bigint | boolean | null | undefined | Iterable<JSXNode>;
|
|
36
|
+
|
|
37
|
+
// #endregion
|