@viewfly/core 0.0.2 → 0.0.3
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/bundles/index.esm.js +14 -10
- package/bundles/index.js +14 -10
- package/bundles/jsx.d.ts +1 -0
- package/bundles/model/component.d.ts +4 -2
- package/bundles/model/jsx-element.d.ts +4 -4
- package/package.json +2 -2
package/bundles/index.esm.js
CHANGED
|
@@ -58,8 +58,12 @@ function getSignalDepsContext() {
|
|
|
58
58
|
return signalDepsStack[signalDepsStack.length - 1];
|
|
59
59
|
}
|
|
60
60
|
class JSXComponent {
|
|
61
|
-
constructor(
|
|
62
|
-
this.
|
|
61
|
+
constructor(props, factory) {
|
|
62
|
+
this.props = props;
|
|
63
|
+
this.factory = factory;
|
|
64
|
+
}
|
|
65
|
+
createInstance(injector) {
|
|
66
|
+
return this.factory(injector, this.props);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
@@ -473,20 +477,20 @@ const Fragment = function Fragment(props) {
|
|
|
473
477
|
return props.children;
|
|
474
478
|
};
|
|
475
479
|
};
|
|
476
|
-
function jsx(setup,
|
|
480
|
+
function jsx(setup, props, key) {
|
|
477
481
|
if (typeof setup === 'string') {
|
|
478
|
-
return new JSXElement(setup,
|
|
482
|
+
return new JSXElement(setup, props, key);
|
|
479
483
|
}
|
|
480
|
-
return new JSXComponent(function (context) {
|
|
481
|
-
return new Component(context, setup,
|
|
484
|
+
return new JSXComponent(props, function (context, props) {
|
|
485
|
+
return new Component(context, setup, props, key);
|
|
482
486
|
});
|
|
483
487
|
}
|
|
484
|
-
function jsxs(setup,
|
|
488
|
+
function jsxs(setup, props, key) {
|
|
485
489
|
if (typeof setup === 'string') {
|
|
486
|
-
return new JSXElement(setup,
|
|
490
|
+
return new JSXElement(setup, props, key);
|
|
487
491
|
}
|
|
488
|
-
return new JSXComponent(function (context) {
|
|
489
|
-
return new Component(context, setup,
|
|
492
|
+
return new JSXComponent(props, function (context, props) {
|
|
493
|
+
return new Component(context, setup, props, key);
|
|
490
494
|
});
|
|
491
495
|
}
|
|
492
496
|
class JSXText {
|
package/bundles/index.js
CHANGED
|
@@ -59,8 +59,12 @@ function getSignalDepsContext() {
|
|
|
59
59
|
return signalDepsStack[signalDepsStack.length - 1];
|
|
60
60
|
}
|
|
61
61
|
class JSXComponent {
|
|
62
|
-
constructor(
|
|
63
|
-
this.
|
|
62
|
+
constructor(props, factory) {
|
|
63
|
+
this.props = props;
|
|
64
|
+
this.factory = factory;
|
|
65
|
+
}
|
|
66
|
+
createInstance(injector) {
|
|
67
|
+
return this.factory(injector, this.props);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
@@ -474,20 +478,20 @@ const Fragment = function Fragment(props) {
|
|
|
474
478
|
return props.children;
|
|
475
479
|
};
|
|
476
480
|
};
|
|
477
|
-
function jsx(setup,
|
|
481
|
+
function jsx(setup, props, key) {
|
|
478
482
|
if (typeof setup === 'string') {
|
|
479
|
-
return new JSXElement(setup,
|
|
483
|
+
return new JSXElement(setup, props, key);
|
|
480
484
|
}
|
|
481
|
-
return new JSXComponent(function (context) {
|
|
482
|
-
return new Component(context, setup,
|
|
485
|
+
return new JSXComponent(props, function (context, props) {
|
|
486
|
+
return new Component(context, setup, props, key);
|
|
483
487
|
});
|
|
484
488
|
}
|
|
485
|
-
function jsxs(setup,
|
|
489
|
+
function jsxs(setup, props, key) {
|
|
486
490
|
if (typeof setup === 'string') {
|
|
487
|
-
return new JSXElement(setup,
|
|
491
|
+
return new JSXElement(setup, props, key);
|
|
488
492
|
}
|
|
489
|
-
return new JSXComponent(function (context) {
|
|
490
|
-
return new Component(context, setup,
|
|
493
|
+
return new JSXComponent(props, function (context, props) {
|
|
494
|
+
return new Component(context, setup, props, key);
|
|
491
495
|
});
|
|
492
496
|
}
|
|
493
497
|
class JSXText {
|
package/bundles/jsx.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Provider, ReflectiveInjector, AbstractType, Type, InjectionToken, InjectFlags, Injector } from '@tanbo/di';
|
|
2
2
|
import { Props, Key, JSXTypeof, JSXChildNode } from './jsx-element';
|
|
3
3
|
export declare class JSXComponent {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
props: Props;
|
|
5
|
+
private factory;
|
|
6
|
+
constructor(props: Props, factory: (injector: Component, props: Props) => Component);
|
|
7
|
+
createInstance(injector: Component): Component;
|
|
6
8
|
}
|
|
7
9
|
export interface ComponentSetup<T extends Props<any> = Props<any>> {
|
|
8
10
|
(props?: T): () => JSXChildNode;
|
|
@@ -7,10 +7,10 @@ export interface Props<T = JSXChildNode | JSXChildNode[]> {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const Fragment: (props: Props) => () => JSXChildNode | JSXChildNode[];
|
|
9
9
|
export type Key = number | string;
|
|
10
|
-
export declare function jsx<T extends JSXChildNode>(name: string,
|
|
11
|
-
export declare function jsx<T extends JSXChildNode>(setup: ComponentSetup,
|
|
12
|
-
export declare function jsxs<T extends JSXChildNode[]>(name: string,
|
|
13
|
-
export declare function jsxs<T extends JSXChildNode[]>(setup: ComponentSetup,
|
|
10
|
+
export declare function jsx<T extends JSXChildNode>(name: string, props: Props<T>, key?: Key): JSXElement;
|
|
11
|
+
export declare function jsx<T extends JSXChildNode>(setup: ComponentSetup, props: Props<T>, key?: Key): JSXComponent;
|
|
12
|
+
export declare function jsxs<T extends JSXChildNode[]>(name: string, props: Props<T>, key?: Key): JSXElement;
|
|
13
|
+
export declare function jsxs<T extends JSXChildNode[]>(setup: ComponentSetup, props: Props<T>, key?: Key): JSXComponent;
|
|
14
14
|
export interface JSXTypeof {
|
|
15
15
|
$$typeOf: string | ComponentSetup;
|
|
16
16
|
is(target: JSXTypeof): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "55152a4c7db778d22e4ed1d8cd648f9800a01992"
|
|
38
38
|
}
|