@viewfly/core 0.6.0 → 0.6.2
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/di/injector.d.ts +5 -1
- package/bundles/di/reflective-injector.d.ts +3 -3
- package/bundles/foundation/_utils.d.ts +0 -1
- package/bundles/foundation/component.d.ts +0 -1
- package/bundles/foundation/jsx-element.d.ts +0 -1
- package/bundles/foundation/memo.d.ts +0 -1
- package/bundles/foundation/root.component.d.ts +0 -1
- package/bundles/foundation/types.d.ts +31 -29
- package/bundles/index.esm.js +1 -1
- package/bundles/index.js +1 -1
- package/bundles/viewfly.d.ts +1 -1
- package/jsx-runtime/index.d.ts +2 -3
- package/jsx-runtime/package.json +1 -2
- package/package.json +2 -2
package/bundles/di/injector.d.ts
CHANGED
|
@@ -13,10 +13,14 @@ export declare enum InjectFlags {
|
|
|
13
13
|
/** 可选查找 */
|
|
14
14
|
Optional = "Optional"
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* 根据 token 推断返回数据类型
|
|
18
|
+
*/
|
|
19
|
+
export type ExtractValueType<T> = T extends Type<any> ? InstanceType<T> : T extends AbstractType<infer K> ? K : T extends InjectionToken<infer V> ? V : never;
|
|
16
20
|
/**
|
|
17
21
|
* DI 容器抽象基类
|
|
18
22
|
*/
|
|
19
23
|
export declare abstract class Injector {
|
|
20
24
|
abstract parentInjector: Injector | null;
|
|
21
|
-
abstract get<T
|
|
25
|
+
abstract get<T extends Type<any> | AbstractType<any> | InjectionToken<any>, U = ExtractValueType<T>>(token: T, notFoundValue?: U, flags?: InjectFlags): U;
|
|
22
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Provider } from './provider';
|
|
2
|
-
import { InjectFlags, Injector } from './injector';
|
|
2
|
+
import { ExtractValueType, InjectFlags, Injector } from './injector';
|
|
3
3
|
import { NormalizedProvider } from './reflective-provider';
|
|
4
4
|
import { AbstractType, Type } from './type';
|
|
5
5
|
import { InjectionToken } from './injection-token';
|
|
@@ -12,7 +12,7 @@ export declare class ReflectiveInjector extends Injector {
|
|
|
12
12
|
protected staticProviders: Provider[];
|
|
13
13
|
protected scope?: Scope | undefined;
|
|
14
14
|
protected normalizedProviders: NormalizedProvider[];
|
|
15
|
-
protected recordValues: Map<
|
|
15
|
+
protected recordValues: Map<Type<any> | AbstractType<any> | InjectionToken<any>, any>;
|
|
16
16
|
constructor(parentInjector: Injector | null, staticProviders: Provider[], scope?: Scope | undefined);
|
|
17
17
|
/**
|
|
18
18
|
* 用于获取当前注入器上下文内的实例、对象或数据
|
|
@@ -20,7 +20,7 @@ export declare class ReflectiveInjector extends Injector {
|
|
|
20
20
|
* @param notFoundValue 如未查找到的返回值
|
|
21
21
|
* @param flags 查询规则
|
|
22
22
|
*/
|
|
23
|
-
get<T
|
|
23
|
+
get<T extends Type<any> | AbstractType<any> | InjectionToken<any>, U = ExtractValueType<T>>(token: T, notFoundValue?: U, flags?: InjectFlags): U;
|
|
24
24
|
private getValue;
|
|
25
25
|
/**
|
|
26
26
|
* 解决并获取依赖参数
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { JSXNode } from './jsx-element';
|
|
2
2
|
import { NativeNode } from './injection-tokens';
|
|
3
3
|
import { Component } from './component';
|
|
4
|
-
import { JSXInternal } from './types';
|
|
5
4
|
export interface ListenDelegate {
|
|
6
5
|
delegate: () => any;
|
|
7
6
|
listenFn: ((...args: any[]) => any) | void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AbstractType, InjectFlags, InjectionToken, Injector, Provider, ReflectiveInjector, Type } from '../di/_api';
|
|
2
2
|
import { Key, Props } from './jsx-element';
|
|
3
3
|
import { ComponentView } from './_utils';
|
|
4
|
-
import { JSXInternal } from './types';
|
|
5
4
|
/**
|
|
6
5
|
* Viewfly 组件管理类,用于管理组件的生命周期,上下文等
|
|
7
6
|
*/
|
|
@@ -3,34 +3,36 @@ import { ExtractInstanceType, DynamicRef } from './component';
|
|
|
3
3
|
import { Scope } from '../di/injectable';
|
|
4
4
|
import { NativeNode } from './injection-tokens';
|
|
5
5
|
export type ViewNode = JSXInternal.ViewNode;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
declare global {
|
|
7
|
+
namespace JSXInternal {
|
|
8
|
+
type ClassNames = string | Record<string, unknown> | false | null | undefined | ClassNames[];
|
|
9
|
+
interface ComponentInstance<P> {
|
|
10
|
+
$portalHost?: NativeNode;
|
|
11
|
+
$render(): ViewNode;
|
|
12
|
+
$useMemo?(currentProps: P, prevProps: P): boolean;
|
|
13
|
+
}
|
|
14
|
+
type ViewNode = Element | JSXInternal.ElementClass | string | number | boolean | null | undefined | Iterable<ViewNode>;
|
|
15
|
+
interface ComponentSetup<P = any> {
|
|
16
|
+
(props: P): (() => ViewNode) | ComponentInstance<P>;
|
|
17
|
+
scope?: Scope;
|
|
18
|
+
}
|
|
19
|
+
type Element<P = any, C extends string | ComponentSetup<P> = string | ComponentSetup<P>> = C extends string ? IntrinsicElements[C] : (() => Element) | ComponentInstance<P>;
|
|
20
|
+
interface IntrinsicAttributes {
|
|
21
|
+
key?: Key;
|
|
22
|
+
ref?: any;
|
|
23
|
+
}
|
|
24
|
+
interface RefAttributes<T> extends IntrinsicAttributes {
|
|
25
|
+
ref?: DynamicRef<ExtractInstanceType<T>> | DynamicRef<ExtractInstanceType<T>>[];
|
|
26
|
+
}
|
|
27
|
+
interface ElementClass<P = any> extends ComponentInstance<P> {
|
|
28
|
+
}
|
|
29
|
+
interface ElementChildrenAttribute {
|
|
30
|
+
}
|
|
31
|
+
interface IntrinsicElements {
|
|
32
|
+
[name: string]: any;
|
|
33
|
+
}
|
|
34
|
+
interface IntrinsicClassAttributes<T> {
|
|
35
|
+
ref?: DynamicRef<T>;
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
38
|
}
|
package/bundles/index.esm.js
CHANGED
|
@@ -1502,7 +1502,7 @@ function updateComponent(newAtom, reusedAtom, expectIndex, oldIndex, nativeRende
|
|
|
1502
1502
|
newAtom.child = createChildChain(newTemplate, newAtom.isSvg);
|
|
1503
1503
|
}
|
|
1504
1504
|
if (newAtom.child) {
|
|
1505
|
-
diff(nativeRenderer, component, newAtom.child, reusedAtom.child, context, expectIndex, oldIndex);
|
|
1505
|
+
diff(nativeRenderer, component, newAtom.child, reusedAtom.child, context, expectIndex, oldIndex + offset);
|
|
1506
1506
|
}
|
|
1507
1507
|
else if (reusedAtom.child) {
|
|
1508
1508
|
let atom = reusedAtom.child;
|
package/bundles/index.js
CHANGED
|
@@ -1504,7 +1504,7 @@ function updateComponent(newAtom, reusedAtom, expectIndex, oldIndex, nativeRende
|
|
|
1504
1504
|
newAtom.child = createChildChain(newTemplate, newAtom.isSvg);
|
|
1505
1505
|
}
|
|
1506
1506
|
if (newAtom.child) {
|
|
1507
|
-
diff(nativeRenderer, component, newAtom.child, reusedAtom.child, context, expectIndex, oldIndex);
|
|
1507
|
+
diff(nativeRenderer, component, newAtom.child, reusedAtom.child, context, expectIndex, oldIndex + offset);
|
|
1508
1508
|
}
|
|
1509
1509
|
else if (reusedAtom.child) {
|
|
1510
1510
|
let atom = reusedAtom.child;
|
package/bundles/viewfly.d.ts
CHANGED
package/jsx-runtime/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment
|
|
2
|
-
import { NativeElements } from '@viewfly/platform-browser';
|
|
1
|
+
import { jsx, jsxs, Fragment } from '@viewfly/core';
|
|
3
2
|
/**
|
|
4
3
|
* JSX namespace for usage with @jsxImportsSource directive
|
|
5
4
|
* when ts compilerOptions.jsx is 'react-jsx'
|
|
@@ -11,7 +10,7 @@ export declare namespace JSX {
|
|
|
11
10
|
type Element = JSXInternal.Element;
|
|
12
11
|
interface ElementClass extends JSXInternal.ElementClass {
|
|
13
12
|
}
|
|
14
|
-
interface IntrinsicElements extends
|
|
13
|
+
interface IntrinsicElements extends JSXInternal.IntrinsicElements {
|
|
15
14
|
}
|
|
16
15
|
interface IntrinsicAttributes extends JSXInternal.IntrinsicAttributes {
|
|
17
16
|
}
|
package/jsx-runtime/package.json
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
"build:lib": "rimraf index.esm.js index.js index.d.ts && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript && tsc index.ts -d"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@viewfly/core": "*"
|
|
10
|
-
"@viewfly/platform-browser": "*"
|
|
9
|
+
"@viewfly/core": "*"
|
|
11
10
|
},
|
|
12
11
|
"devDependencies": {
|
|
13
12
|
"@rollup/plugin-commonjs": "^25.0.3",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
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",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"bugs": {
|
|
48
48
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f3db648a596358d6966d006a24fb85b3b7d993d1",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"reflect-metadata": "^0.1.13"
|
|
53
53
|
}
|