zikofy 0.6.0 → 0.7.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zikofy",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./*": {
@@ -0,0 +1,14 @@
1
+ export async function asyncDomify(Component, props) {
2
+ if (typeof Component !== 'function') {
3
+ throw new Error('asyncDomify expects a function component');
4
+ }
5
+
6
+ const container = document.createElement('div');
7
+
8
+ const result = await Component(props); // await async JSX
9
+ render(result, container);
10
+
11
+ return container.children.length === 1
12
+ ? container.firstChild
13
+ : [...container.children];
14
+ }
@@ -6,6 +6,11 @@ export declare function domify<P = {}>(
6
6
  props?: P
7
7
  ): HTMLElement | HTMLElement[];
8
8
 
9
+ export declare function asyncDomify<P = {}>(
10
+ Component: ComponentType<P> | (() => Promise<JSX.Element>),
11
+ props?: P
12
+ ): Promise<HTMLElement | HTMLElement[]>;
13
+
9
14
  export declare function zikofy<P = {}>(
10
15
  Component: ComponentType<P> | JSX.Element,
11
16
  props?: P
@@ -1,2 +1,3 @@
1
1
  export * from './domify.js';
2
- export * from './zikofy.js';
2
+ export * from './zikofy.js';
3
+ export * from './async-domify.js'