@viewfly/core 0.0.1-alpha.16 → 0.0.1-alpha.18

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.
@@ -72,12 +72,12 @@ class Component extends ReflectiveInjector {
72
72
  get changed() {
73
73
  return this._changed;
74
74
  }
75
- constructor(context, setup, props, key) {
75
+ constructor(context, type, props, key) {
76
76
  super(context, []);
77
- this.setup = setup;
77
+ this.type = type;
78
78
  this.props = props;
79
79
  this.key = key;
80
- this.$$typeOf = this.setup;
80
+ this.$$typeOf = this.type;
81
81
  this.destroyCallbacks = [];
82
82
  this.mountCallbacks = [];
83
83
  this.propsChangedCallbacks = [];
@@ -114,7 +114,7 @@ class Component extends ReflectiveInjector {
114
114
  });
115
115
  componentSetupStack.push(this);
116
116
  let isSetup = true;
117
- const render = this.setup(props);
117
+ const render = this.type(props);
118
118
  isSetup = false;
119
119
  componentSetupStack.pop();
120
120
  signalDepsStack.push([]);
@@ -499,11 +499,11 @@ class JSXText {
499
499
  }
500
500
  }
501
501
  class JSXElement {
502
- constructor(name, props, key) {
503
- this.name = name;
502
+ constructor(type, props, key) {
503
+ this.type = type;
504
504
  this.props = props;
505
505
  this.key = key;
506
- this.$$typeOf = this.name;
506
+ this.$$typeOf = this.type;
507
507
  }
508
508
  is(target) {
509
509
  return target.$$typeOf === this.$$typeOf;
@@ -973,7 +973,7 @@ let Renderer = class Renderer {
973
973
  parent.child = children[0] || null;
974
974
  }
975
975
  createElement(vNode) {
976
- const nativeNode = this.nativeRenderer.createElement(vNode.name);
976
+ const nativeNode = this.nativeRenderer.createElement(vNode.type);
977
977
  const props = vNode.props;
978
978
  let bindingRefs;
979
979
  const keys = Object.keys(props);
package/bundles/index.js CHANGED
@@ -73,12 +73,12 @@ class Component extends di.ReflectiveInjector {
73
73
  get changed() {
74
74
  return this._changed;
75
75
  }
76
- constructor(context, setup, props, key) {
76
+ constructor(context, type, props, key) {
77
77
  super(context, []);
78
- this.setup = setup;
78
+ this.type = type;
79
79
  this.props = props;
80
80
  this.key = key;
81
- this.$$typeOf = this.setup;
81
+ this.$$typeOf = this.type;
82
82
  this.destroyCallbacks = [];
83
83
  this.mountCallbacks = [];
84
84
  this.propsChangedCallbacks = [];
@@ -115,7 +115,7 @@ class Component extends di.ReflectiveInjector {
115
115
  });
116
116
  componentSetupStack.push(this);
117
117
  let isSetup = true;
118
- const render = this.setup(props);
118
+ const render = this.type(props);
119
119
  isSetup = false;
120
120
  componentSetupStack.pop();
121
121
  signalDepsStack.push([]);
@@ -500,11 +500,11 @@ class JSXText {
500
500
  }
501
501
  }
502
502
  class JSXElement {
503
- constructor(name, props, key) {
504
- this.name = name;
503
+ constructor(type, props, key) {
504
+ this.type = type;
505
505
  this.props = props;
506
506
  this.key = key;
507
- this.$$typeOf = this.name;
507
+ this.$$typeOf = this.type;
508
508
  }
509
509
  is(target) {
510
510
  return target.$$typeOf === this.$$typeOf;
@@ -974,7 +974,7 @@ exports.Renderer = class Renderer {
974
974
  parent.child = children[0] || null;
975
975
  }
976
976
  createElement(vNode) {
977
- const nativeNode = this.nativeRenderer.createElement(vNode.name);
977
+ const nativeNode = this.nativeRenderer.createElement(vNode.type);
978
978
  const props = vNode.props;
979
979
  let bindingRefs;
980
980
  const keys = Object.keys(props);
@@ -0,0 +1,13 @@
1
+ import { Key, Ref } from '@viewfly/core';
2
+ export declare namespace JSX {
3
+ interface Attributes<T extends object> {
4
+ ref?: Ref<T>;
5
+ key?: Key;
6
+ }
7
+ interface ElementClass {
8
+ }
9
+ interface IntrinsicElements {
10
+ }
11
+ interface IntrinsicAttributes {
12
+ }
13
+ }
@@ -11,7 +11,7 @@ export interface ComponentSetup<T extends Props<any> = Props<any>> {
11
11
  * Viewfly 组件管理类,用于管理组件的生命周期,上下文等
12
12
  */
13
13
  export declare class Component extends ReflectiveInjector implements JSXTypeof {
14
- setup: ComponentSetup;
14
+ type: ComponentSetup;
15
15
  props: Props<any>;
16
16
  key?: Key | undefined;
17
17
  $$typeOf: ComponentSetup<Props<any>>;
@@ -28,7 +28,7 @@ export declare class Component extends ReflectiveInjector implements JSXTypeof {
28
28
  private propsChangedDestroyCallbacks;
29
29
  private unWatch?;
30
30
  private isFirstRending;
31
- constructor(context: Injector, setup: ComponentSetup, props: Props<any>, key?: Key | undefined);
31
+ constructor(context: Injector, type: ComponentSetup, props: Props<any>, key?: Key | undefined);
32
32
  is(target: JSXTypeof): boolean;
33
33
  addProvide<T>(providers: Provider<T> | Provider<T>[]): void;
34
34
  init(): {
@@ -22,10 +22,10 @@ export declare class JSXText implements JSXTypeof {
22
22
  is(target: JSXTypeof): boolean;
23
23
  }
24
24
  export declare class JSXElement implements JSXTypeof {
25
- name: string;
25
+ type: string;
26
26
  props: Props<any>;
27
27
  key?: Key | undefined;
28
28
  $$typeOf: string;
29
- constructor(name: string, props: Props<any>, key?: Key | undefined);
29
+ constructor(type: string, props: Props<any>, key?: Key | undefined);
30
30
  is(target: JSXTypeof): boolean;
31
31
  }
@@ -3,4 +3,5 @@ export * from '@tanbo/di';
3
3
  export * from './_utils/make-error';
4
4
  export * from './foundation/_api';
5
5
  export * from './model/_api';
6
+ export * from './jsx';
6
7
  export * from './viewfly';
@@ -1,4 +1,4 @@
1
- import type { JSXElement, Ref, jsx, jsxs, Fragment } from '@viewfly/core'
1
+ import type { JSXComponent, jsx, jsxs, Fragment } from '@viewfly/core'
2
2
  import type { NativeElements } from '@viewfly/platform-browser'
3
3
 
4
4
  /**
@@ -10,13 +10,9 @@ import type { NativeElements } from '@viewfly/platform-browser'
10
10
  export { jsx, jsxs, Fragment }
11
11
 
12
12
  export namespace JSX {
13
- export interface Element extends JSXElement {
13
+ export interface ElementClass extends JSXComponent {
14
14
  }
15
15
 
16
16
  export interface IntrinsicElements extends NativeElements {
17
17
  }
18
-
19
- export interface IntrinsicAttributes {
20
- ref?: Ref<any>
21
- }
22
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viewfly/core",
3
- "version": "0.0.1-alpha.16",
3
+ "version": "0.0.1-alpha.18",
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": "c87e571f0caf71e5bb99183643388f9adb4501c1"
37
+ "gitHead": "742425d66d4b9db93239f5fb50d5faaa41c92571"
38
38
  }