+ >;
+ if (store instanceof Map)
+ return Object.fromEntries(
+ Array.from(store, ([key, { value_ }]) => [key, value_])
+ ) as T;
+ }
+}
diff --git a/source/WebCell.tsx b/source/WebCell.tsx
index 32ec502..566df34 100644
--- a/source/WebCell.tsx
+++ b/source/WebCell.tsx
@@ -3,6 +3,7 @@ import {
CustomElement,
DelegateEventHandler,
delegate,
+ isEmpty,
stringifyDOM
} from 'web-utility';
@@ -80,7 +81,7 @@ export function component(meta: ComponentMeta) {
update() {
const vNode = this.render?.();
- if (vNode) this.renderer.render(vNode, this.root);
+ this.renderer.render(isEmpty(vNode) ? <>> : vNode, this.root);
}
disconnectedCallback() {
diff --git a/source/decorator.ts b/source/decorator.ts
index 4a2845a..dd2bd3a 100644
--- a/source/decorator.ts
+++ b/source/decorator.ts
@@ -14,6 +14,7 @@ import {
} from 'web-utility';
import { ClassComponent } from './WebCell';
+import { getMobxData } from './MobX';
export type PropsWithChildren = P & {
children?: JsxChildren;
@@ -33,6 +34,7 @@ function wrapFunction
(func: FC
) {
});
const { unRef } = tree;
+ tree.ref = node => (tree.node = node);
tree.unRef = node => (disposer(), unRef?.(node));
return tree;
@@ -52,6 +54,10 @@ function wrapClass(Component: T) {
{
protected disposers: IReactionDisposer[] = [];
+ get props() {
+ return getMobxData(this);
+ }
+
constructor() {
super();
diff --git a/source/index.ts b/source/index.ts
index 99184dd..a68df65 100644
--- a/source/index.ts
+++ b/source/index.ts
@@ -1,4 +1,5 @@
export * from './decorator';
+export * from './MobX';
export * from './WebCell';
export * from './WebField';
export * from './Async';