@viewfly/core 0.0.1-alpha.12 → 0.0.1-alpha.14

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Viewfly
2
2
  ================================
3
3
 
4
- Viewfly 是一个简单、数据驱动的前端视图库。此包为 Viewfly 的内核实现,要开发完整的应该的应用,还需要结合 `@viewfly/platform-browser` 包,才能在浏览器运行。
4
+ Viewfly 是一个简单、数据驱动的前端框架。此项目为 Viewfly 的内核实现,要开发完整的应该的应用,还需要结合 `@viewfly/platform-browser` 包,才能在浏览器运行。
5
5
 
6
6
  完整文档请参考官方网站:[viewfly.org](https://viewfly.org)
@@ -4,6 +4,6 @@ export interface ObjectChanges {
4
4
  replace: [string, any, any][];
5
5
  }
6
6
  export declare const refKey = "ref";
7
- export declare function getObjectChanges(newProps?: Record<string, any>, oldProps?: Record<string, any>): ObjectChanges;
7
+ export declare function getObjectChanges(newProps: Record<string, any>, oldProps: Record<string, any>): ObjectChanges;
8
8
  export declare function classToString(config: unknown): any;
9
9
  export declare function styleToObject(style: string | Record<string, any>): Record<string, any>;
@@ -544,20 +544,6 @@ function getObjectChanges(newProps, oldProps) {
544
544
  add: [],
545
545
  replace: []
546
546
  };
547
- if (!newProps) {
548
- if (oldProps) {
549
- Object.keys(oldProps).forEach(key => {
550
- changes.remove.push([key, oldProps[key]]);
551
- });
552
- }
553
- return changes;
554
- }
555
- if (!oldProps) {
556
- Object.keys(newProps).forEach(key => {
557
- changes.add.push([key, newProps[key]]);
558
- });
559
- return changes;
560
- }
561
547
  Object.keys(newProps).forEach(key => {
562
548
  const leftValue = newProps[key];
563
549
  const rightValue = oldProps[key];
@@ -940,7 +926,8 @@ let Renderer = class Renderer {
940
926
  createChainByComponentFactory(context, factory, parent) {
941
927
  const component = factory.createInstance(context);
942
928
  if (component.setup === Fragment) {
943
- return this.createChainByChildren(component, component.props.children, parent);
929
+ const children = component.props.children;
930
+ return this.createChainByChildren(component, Array.isArray(children) ? children : [children], parent);
944
931
  }
945
932
  return new Atom(component, parent);
946
933
  }
@@ -1088,7 +1075,7 @@ let Renderer = class Renderer {
1088
1075
  continue;
1089
1076
  }
1090
1077
  if (key === 'style') {
1091
- const styleChanges = getObjectChanges(styleToObject(newValue), styleToObject(oldValue));
1078
+ const styleChanges = getObjectChanges(styleToObject(newValue) || {}, styleToObject(oldValue) || {});
1092
1079
  for (const [styleName] of styleChanges.remove) {
1093
1080
  this.nativeRenderer.removeStyle(nativeNode, styleName);
1094
1081
  }
package/bundles/index.js CHANGED
@@ -545,20 +545,6 @@ function getObjectChanges(newProps, oldProps) {
545
545
  add: [],
546
546
  replace: []
547
547
  };
548
- if (!newProps) {
549
- if (oldProps) {
550
- Object.keys(oldProps).forEach(key => {
551
- changes.remove.push([key, oldProps[key]]);
552
- });
553
- }
554
- return changes;
555
- }
556
- if (!oldProps) {
557
- Object.keys(newProps).forEach(key => {
558
- changes.add.push([key, newProps[key]]);
559
- });
560
- return changes;
561
- }
562
548
  Object.keys(newProps).forEach(key => {
563
549
  const leftValue = newProps[key];
564
550
  const rightValue = oldProps[key];
@@ -941,7 +927,8 @@ exports.Renderer = class Renderer {
941
927
  createChainByComponentFactory(context, factory, parent) {
942
928
  const component = factory.createInstance(context);
943
929
  if (component.setup === Fragment) {
944
- return this.createChainByChildren(component, component.props.children, parent);
930
+ const children = component.props.children;
931
+ return this.createChainByChildren(component, Array.isArray(children) ? children : [children], parent);
945
932
  }
946
933
  return new Atom(component, parent);
947
934
  }
@@ -1089,7 +1076,7 @@ exports.Renderer = class Renderer {
1089
1076
  continue;
1090
1077
  }
1091
1078
  if (key === 'style') {
1092
- const styleChanges = getObjectChanges(styleToObject(newValue), styleToObject(oldValue));
1079
+ const styleChanges = getObjectChanges(styleToObject(newValue) || {}, styleToObject(oldValue) || {});
1093
1080
  for (const [styleName] of styleChanges.remove) {
1094
1081
  this.nativeRenderer.removeStyle(nativeNode, styleName);
1095
1082
  }
package/package.json CHANGED
@@ -1,22 +1,19 @@
1
1
  {
2
2
  "name": "@viewfly/core",
3
- "version": "0.0.1-alpha.12",
3
+ "version": "0.0.1-alpha.14",
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",
7
7
  "typings": "./bundles/public-api.d.ts",
8
8
  "scripts": {
9
- "start": "webpack-dev-server",
10
- "test": "cross-env env=test jest",
11
- "test-c": "cross-env env=test jest --coverage",
12
9
  "build:lib": "rimraf bundles && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
13
10
  "publish:lib": "npm run build:lib && npm publish --access=public"
14
11
  },
15
12
  "license": "MIT",
16
13
  "keywords": [],
17
14
  "dependencies": {
18
- "@tanbo/di": "^1.1.4",
19
- "@tanbo/stream": "^1.1.9",
15
+ "@tanbo/di": "^1.1.5",
16
+ "@tanbo/stream": "^1.2.0",
20
17
  "reflect-metadata": "^0.1.13"
21
18
  },
22
19
  "devDependencies": {
@@ -37,5 +34,5 @@
37
34
  "bugs": {
38
35
  "url": "https://github.com/viewfly/viewfly.git/issues"
39
36
  },
40
- "gitHead": "e5fdc69779bbfd6a1128b98a30d8732dbda7fcd3"
37
+ "gitHead": "6b490f936251fa5aca6f715b5cb94ded9c360a1b"
41
38
  }