@viewfly/core 1.0.0-alpha.13 → 1.0.0-alpha.15
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.d.ts +2 -3
- package/bundles/index.esm.js +8 -12
- package/bundles/index.js +8 -12
- package/package.json +2 -2
package/bundles/index.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ interface Prop {
|
|
|
113
113
|
declare const Prop: PropDecorator;
|
|
114
114
|
|
|
115
115
|
declare const THROW_IF_NOT_FOUND: any;
|
|
116
|
-
declare class NullInjector
|
|
116
|
+
declare class NullInjector implements Injector {
|
|
117
117
|
parentInjector: null;
|
|
118
118
|
get(token: any, notFoundValue?: any, _?: InjectFlags): any;
|
|
119
119
|
}
|
|
@@ -167,9 +167,8 @@ declare function normalizeProvider(provider: Provider): NormalizedProvider;
|
|
|
167
167
|
/**
|
|
168
168
|
* 反射注入器
|
|
169
169
|
*/
|
|
170
|
-
declare class ReflectiveInjector
|
|
170
|
+
declare class ReflectiveInjector implements Injector {
|
|
171
171
|
parentInjector: Injector | null;
|
|
172
|
-
protected staticProviders: Provider[];
|
|
173
172
|
protected scope?: Scope | undefined;
|
|
174
173
|
protected normalizedProviders: NormalizedProvider[];
|
|
175
174
|
protected recordValues: Map<Type<any> | AbstractType<any> | InjectionToken<any>, any>;
|
package/bundles/index.esm.js
CHANGED
|
@@ -234,9 +234,8 @@ const THROW_IF_NOT_FOUND = {
|
|
|
234
234
|
const nullInjectorErrorFn = (token) => {
|
|
235
235
|
return makeError('NullInjector')(`No provide for \`${stringify(token)}\`!`);
|
|
236
236
|
};
|
|
237
|
-
class NullInjector
|
|
237
|
+
class NullInjector {
|
|
238
238
|
constructor() {
|
|
239
|
-
super(...arguments);
|
|
240
239
|
this.parentInjector = null;
|
|
241
240
|
}
|
|
242
241
|
/* eslint-disable-next-line */
|
|
@@ -411,11 +410,9 @@ const provideScopeError = (token) => {
|
|
|
411
410
|
/**
|
|
412
411
|
* 反射注入器
|
|
413
412
|
*/
|
|
414
|
-
class ReflectiveInjector
|
|
413
|
+
class ReflectiveInjector {
|
|
415
414
|
constructor(parentInjector, staticProviders, scope) {
|
|
416
|
-
super();
|
|
417
415
|
this.parentInjector = parentInjector;
|
|
418
|
-
this.staticProviders = staticProviders;
|
|
419
416
|
this.scope = scope;
|
|
420
417
|
this.recordValues = new Map();
|
|
421
418
|
this.normalizedProviders = staticProviders.map(provide => {
|
|
@@ -1404,7 +1401,6 @@ function createChanges(newAtom, oldAtom, nativeRenderer, commits, context, paren
|
|
|
1404
1401
|
const key = newJsxNode.key;
|
|
1405
1402
|
let prev = null;
|
|
1406
1403
|
while (oldAtom) {
|
|
1407
|
-
const diffIndex = oldAtom.index;
|
|
1408
1404
|
if (type === oldAtom.type) {
|
|
1409
1405
|
let commit;
|
|
1410
1406
|
if (type === TextAtomType) {
|
|
@@ -1418,10 +1414,10 @@ function createChanges(newAtom, oldAtom, nativeRenderer, commits, context, paren
|
|
|
1418
1414
|
continue;
|
|
1419
1415
|
}
|
|
1420
1416
|
if (type === ComponentAtomType) {
|
|
1421
|
-
commit = updateComponent(newAtom, oldAtom,
|
|
1417
|
+
commit = updateComponent(newAtom, oldAtom, nativeRenderer, context);
|
|
1422
1418
|
}
|
|
1423
1419
|
else {
|
|
1424
|
-
commit = updateElement(newAtom, oldAtom,
|
|
1420
|
+
commit = updateElement(newAtom, oldAtom, nativeRenderer, context, parentComponent);
|
|
1425
1421
|
}
|
|
1426
1422
|
}
|
|
1427
1423
|
commits.push(commit);
|
|
@@ -1455,10 +1451,10 @@ function updateText(newAtom, oldAtom, nativeRenderer, context) {
|
|
|
1455
1451
|
context.isParent = false;
|
|
1456
1452
|
};
|
|
1457
1453
|
}
|
|
1458
|
-
function updateElement(newAtom, oldAtom,
|
|
1454
|
+
function updateElement(newAtom, oldAtom, nativeRenderer, context, parentComponent) {
|
|
1459
1455
|
return function (offset) {
|
|
1460
1456
|
newAtom.nativeNode = oldAtom.nativeNode;
|
|
1461
|
-
if (
|
|
1457
|
+
if (newAtom.index - offset !== oldAtom.index) {
|
|
1462
1458
|
insertNode(nativeRenderer, newAtom, context);
|
|
1463
1459
|
}
|
|
1464
1460
|
context.host = newAtom.nativeNode;
|
|
@@ -1466,7 +1462,7 @@ function updateElement(newAtom, oldAtom, expectIndex, oldIndex, nativeRenderer,
|
|
|
1466
1462
|
updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComponent, context);
|
|
1467
1463
|
};
|
|
1468
1464
|
}
|
|
1469
|
-
function updateComponent(newAtom, reusedAtom,
|
|
1465
|
+
function updateComponent(newAtom, reusedAtom, nativeRenderer, context) {
|
|
1470
1466
|
return function (offset) {
|
|
1471
1467
|
const component = reusedAtom.jsxNode;
|
|
1472
1468
|
const newProps = newAtom.jsxNode.props;
|
|
@@ -1477,7 +1473,7 @@ function updateComponent(newAtom, reusedAtom, expectIndex, oldIndex, nativeRende
|
|
|
1477
1473
|
componentViewCache.set(component, Object.assign({ atom: newAtom }, context));
|
|
1478
1474
|
newAtom.jsxNode = component;
|
|
1479
1475
|
if (newTemplate === oldTemplate) {
|
|
1480
|
-
reuseComponentView(nativeRenderer, newAtom, reusedAtom, context,
|
|
1476
|
+
reuseComponentView(nativeRenderer, newAtom, reusedAtom, context, newAtom.index - offset !== reusedAtom.index);
|
|
1481
1477
|
updateView(nativeRenderer, component);
|
|
1482
1478
|
return;
|
|
1483
1479
|
}
|
package/bundles/index.js
CHANGED
|
@@ -236,9 +236,8 @@ const THROW_IF_NOT_FOUND = {
|
|
|
236
236
|
const nullInjectorErrorFn = (token) => {
|
|
237
237
|
return makeError('NullInjector')(`No provide for \`${stringify(token)}\`!`);
|
|
238
238
|
};
|
|
239
|
-
class NullInjector
|
|
239
|
+
class NullInjector {
|
|
240
240
|
constructor() {
|
|
241
|
-
super(...arguments);
|
|
242
241
|
this.parentInjector = null;
|
|
243
242
|
}
|
|
244
243
|
/* eslint-disable-next-line */
|
|
@@ -413,11 +412,9 @@ const provideScopeError = (token) => {
|
|
|
413
412
|
/**
|
|
414
413
|
* 反射注入器
|
|
415
414
|
*/
|
|
416
|
-
class ReflectiveInjector
|
|
415
|
+
class ReflectiveInjector {
|
|
417
416
|
constructor(parentInjector, staticProviders, scope) {
|
|
418
|
-
super();
|
|
419
417
|
this.parentInjector = parentInjector;
|
|
420
|
-
this.staticProviders = staticProviders;
|
|
421
418
|
this.scope = scope;
|
|
422
419
|
this.recordValues = new Map();
|
|
423
420
|
this.normalizedProviders = staticProviders.map(provide => {
|
|
@@ -1406,7 +1403,6 @@ function createChanges(newAtom, oldAtom, nativeRenderer, commits, context, paren
|
|
|
1406
1403
|
const key = newJsxNode.key;
|
|
1407
1404
|
let prev = null;
|
|
1408
1405
|
while (oldAtom) {
|
|
1409
|
-
const diffIndex = oldAtom.index;
|
|
1410
1406
|
if (type === oldAtom.type) {
|
|
1411
1407
|
let commit;
|
|
1412
1408
|
if (type === TextAtomType) {
|
|
@@ -1420,10 +1416,10 @@ function createChanges(newAtom, oldAtom, nativeRenderer, commits, context, paren
|
|
|
1420
1416
|
continue;
|
|
1421
1417
|
}
|
|
1422
1418
|
if (type === ComponentAtomType) {
|
|
1423
|
-
commit = updateComponent(newAtom, oldAtom,
|
|
1419
|
+
commit = updateComponent(newAtom, oldAtom, nativeRenderer, context);
|
|
1424
1420
|
}
|
|
1425
1421
|
else {
|
|
1426
|
-
commit = updateElement(newAtom, oldAtom,
|
|
1422
|
+
commit = updateElement(newAtom, oldAtom, nativeRenderer, context, parentComponent);
|
|
1427
1423
|
}
|
|
1428
1424
|
}
|
|
1429
1425
|
commits.push(commit);
|
|
@@ -1457,10 +1453,10 @@ function updateText(newAtom, oldAtom, nativeRenderer, context) {
|
|
|
1457
1453
|
context.isParent = false;
|
|
1458
1454
|
};
|
|
1459
1455
|
}
|
|
1460
|
-
function updateElement(newAtom, oldAtom,
|
|
1456
|
+
function updateElement(newAtom, oldAtom, nativeRenderer, context, parentComponent) {
|
|
1461
1457
|
return function (offset) {
|
|
1462
1458
|
newAtom.nativeNode = oldAtom.nativeNode;
|
|
1463
|
-
if (
|
|
1459
|
+
if (newAtom.index - offset !== oldAtom.index) {
|
|
1464
1460
|
insertNode(nativeRenderer, newAtom, context);
|
|
1465
1461
|
}
|
|
1466
1462
|
context.host = newAtom.nativeNode;
|
|
@@ -1468,7 +1464,7 @@ function updateElement(newAtom, oldAtom, expectIndex, oldIndex, nativeRenderer,
|
|
|
1468
1464
|
updateNativeNodeProperties(nativeRenderer, newAtom, oldAtom, parentComponent, context);
|
|
1469
1465
|
};
|
|
1470
1466
|
}
|
|
1471
|
-
function updateComponent(newAtom, reusedAtom,
|
|
1467
|
+
function updateComponent(newAtom, reusedAtom, nativeRenderer, context) {
|
|
1472
1468
|
return function (offset) {
|
|
1473
1469
|
const component = reusedAtom.jsxNode;
|
|
1474
1470
|
const newProps = newAtom.jsxNode.props;
|
|
@@ -1479,7 +1475,7 @@ function updateComponent(newAtom, reusedAtom, expectIndex, oldIndex, nativeRende
|
|
|
1479
1475
|
componentViewCache.set(component, Object.assign({ atom: newAtom }, context));
|
|
1480
1476
|
newAtom.jsxNode = component;
|
|
1481
1477
|
if (newTemplate === oldTemplate) {
|
|
1482
|
-
reuseComponentView(nativeRenderer, newAtom, reusedAtom, context,
|
|
1478
|
+
reuseComponentView(nativeRenderer, newAtom, reusedAtom, context, newAtom.index - offset !== reusedAtom.index);
|
|
1483
1479
|
updateView(nativeRenderer, component);
|
|
1484
1480
|
return;
|
|
1485
1481
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.15",
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "20910725ab3302fe98b04db6e6f6b44a3f5b64b5",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"reflect-metadata": "^0.2.2"
|
|
56
56
|
}
|