@viewfly/core 0.0.28 → 0.0.30
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/foundation/_api.d.ts +2 -2
- package/bundles/foundation/_utils.d.ts +8 -6
- package/bundles/foundation/component.d.ts +10 -16
- package/bundles/foundation/jsx-element.d.ts +16 -10
- package/bundles/foundation/memo.d.ts +1 -1
- package/bundles/foundation/root.component.d.ts +1 -1
- package/bundles/foundation/types.d.ts +1 -1
- package/bundles/index.esm.js +270 -211
- package/bundles/index.js +270 -211
- package/bundles/viewfly.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './component';
|
|
2
|
+
export * from './injection-tokens';
|
|
2
3
|
export * from './jsx-element';
|
|
3
4
|
export * from './memo';
|
|
5
|
+
export * from './renderer';
|
|
4
6
|
export * from './root.component';
|
|
5
7
|
export * from './types';
|
|
6
|
-
export * from './injection-tokens';
|
|
7
|
-
export * from './renderer';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JSXElement, JSXText, Props } from './jsx-element';
|
|
3
|
-
import { JSXInternal } from './types';
|
|
1
|
+
import { JSXComponent, JSXElement, JSXText } from './jsx-element';
|
|
4
2
|
import { NativeNode } from './injection-tokens';
|
|
3
|
+
import { Component } from './component';
|
|
5
4
|
export interface ListenDelegate {
|
|
6
5
|
delegate: () => any;
|
|
7
6
|
listenFn: ((...args: any[]) => any) | void;
|
|
@@ -13,10 +12,15 @@ export interface ObjectChanges {
|
|
|
13
12
|
}
|
|
14
13
|
export declare const refKey = "ref";
|
|
15
14
|
export declare function getObjectChanges(newProps: Record<string, any>, oldProps: Record<string, any>): ObjectChanges;
|
|
15
|
+
export interface ArrayChanges<T> {
|
|
16
|
+
remove: T[];
|
|
17
|
+
add: T[];
|
|
18
|
+
}
|
|
19
|
+
export declare function getArrayChanges<T>(left: T[], right: T[]): ArrayChanges<T>;
|
|
16
20
|
export declare function classToString(config: unknown): string;
|
|
17
21
|
export declare function styleToObject(style: string | Record<string, any>): Record<string, any>;
|
|
18
22
|
export interface Atom {
|
|
19
|
-
jsxNode: JSXElement | JSXText | Component;
|
|
23
|
+
jsxNode: JSXElement | JSXText | JSXComponent | Component;
|
|
20
24
|
parent: Atom | null;
|
|
21
25
|
nativeNode: NativeNode | null;
|
|
22
26
|
child: Atom | null;
|
|
@@ -24,8 +28,6 @@ export interface Atom {
|
|
|
24
28
|
}
|
|
25
29
|
export interface ComponentView {
|
|
26
30
|
atom: Atom;
|
|
27
|
-
template: JSXInternal.JSXNode;
|
|
28
31
|
host: NativeNode;
|
|
29
32
|
isParent: boolean;
|
|
30
|
-
render(newProps: Props, oldProps: Props): JSXInternal.JSXNode;
|
|
31
33
|
}
|
|
@@ -2,44 +2,38 @@ import { AbstractType, InjectFlags, InjectionToken, Injector, Provider, Reflecti
|
|
|
2
2
|
import { JSXTypeof, Key, Props } from './jsx-element';
|
|
3
3
|
import { ComponentView } from './_utils';
|
|
4
4
|
import { JSXInternal } from './types';
|
|
5
|
-
export declare class JSXComponent {
|
|
6
|
-
props: Props;
|
|
7
|
-
private factory;
|
|
8
|
-
constructor(props: Props, factory: (injector: Component, props: Props) => Component);
|
|
9
|
-
createInstance(injector: Component): Component;
|
|
10
|
-
}
|
|
11
5
|
/**
|
|
12
6
|
* Viewfly 组件管理类,用于管理组件的生命周期,上下文等
|
|
13
7
|
*/
|
|
14
|
-
export declare class Component extends ReflectiveInjector implements JSXTypeof {
|
|
8
|
+
export declare class Component extends ReflectiveInjector implements JSXTypeof<JSXInternal.ComponentSetup> {
|
|
9
|
+
private parentComponent;
|
|
15
10
|
type: JSXInternal.ComponentSetup;
|
|
16
11
|
props: Props;
|
|
17
12
|
key?: Key | undefined;
|
|
18
13
|
$$typeOf: JSXInternal.ComponentSetup<any>;
|
|
19
|
-
$$view: ComponentView;
|
|
20
14
|
destroyCallbacks: LifeCycleCallback[];
|
|
21
15
|
mountCallbacks: LifeCycleCallback[];
|
|
22
16
|
propsChangedCallbacks: PropsChangedCallback<any>[];
|
|
23
17
|
updatedCallbacks: LifeCycleCallback[];
|
|
18
|
+
instance: JSXInternal.ComponentInstance<Props>;
|
|
19
|
+
template: JSXInternal.JSXNode;
|
|
24
20
|
changedSubComponents: Set<Component>;
|
|
25
21
|
get dirty(): boolean;
|
|
26
22
|
get changed(): boolean;
|
|
23
|
+
$$view: ComponentView;
|
|
27
24
|
protected _dirty: boolean;
|
|
28
25
|
protected _changed: boolean;
|
|
29
|
-
private parentComponent;
|
|
30
26
|
private updatedDestroyCallbacks;
|
|
31
27
|
private propsChangedDestroyCallbacks;
|
|
32
28
|
private unWatch?;
|
|
33
29
|
private isFirstRending;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
provide<T>(providers: Provider<T> | Provider<T>[]): void;
|
|
37
|
-
setup(): {
|
|
38
|
-
template: any;
|
|
39
|
-
render: (newProps: Props, oldProps: Props) => any;
|
|
40
|
-
};
|
|
30
|
+
private refs;
|
|
31
|
+
constructor(parentComponent: Injector | null, type: JSXInternal.ComponentSetup, props: Props, key?: Key | undefined);
|
|
41
32
|
markAsDirtied(): void;
|
|
42
33
|
markAsChanged(changedComponent?: Component): void;
|
|
34
|
+
render(): any;
|
|
35
|
+
update(newProps: Props, forceUpdate?: boolean): any;
|
|
36
|
+
provide<T>(providers: Provider<T> | Provider<T>[]): void;
|
|
43
37
|
rendered(): void;
|
|
44
38
|
destroy(): void;
|
|
45
39
|
private invokePropsChangedHooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component } from './component';
|
|
2
2
|
import { JSXInternal } from './types';
|
|
3
3
|
import { ListenDelegate } from './_utils';
|
|
4
4
|
export interface Props {
|
|
@@ -11,23 +11,29 @@ export type Key = number | string;
|
|
|
11
11
|
export declare function jsx(name: string, props: Props, key?: Key): JSXElement;
|
|
12
12
|
export declare function jsx(setup: JSXInternal.ComponentSetup, props: Props, key?: Key): JSXComponent;
|
|
13
13
|
export declare const jsxs: typeof jsx;
|
|
14
|
-
export interface JSXTypeof {
|
|
15
|
-
$$typeOf:
|
|
16
|
-
is(target: JSXTypeof): boolean;
|
|
14
|
+
export interface JSXTypeof<T extends string | Symbol | JSXInternal.ComponentSetup = string | Symbol | JSXInternal.ComponentSetup> {
|
|
15
|
+
$$typeOf: T;
|
|
17
16
|
}
|
|
18
|
-
export declare class JSXText implements JSXTypeof {
|
|
17
|
+
export declare class JSXText implements JSXTypeof<Symbol> {
|
|
19
18
|
text: string;
|
|
20
|
-
$$typeOf:
|
|
19
|
+
$$typeOf: symbol;
|
|
21
20
|
constructor(text: string);
|
|
22
|
-
is(target: JSXTypeof): boolean;
|
|
23
21
|
}
|
|
24
|
-
export declare class JSXElement implements JSXTypeof {
|
|
22
|
+
export declare class JSXElement implements JSXTypeof<string> {
|
|
25
23
|
type: string;
|
|
26
24
|
props: Props;
|
|
27
25
|
key?: Key | undefined;
|
|
28
|
-
static create(name: string, props: Props, key?: Key): JSXElement;
|
|
29
26
|
$$typeOf: string;
|
|
27
|
+
static createInstance(type: string, props: Props, key?: Key): JSXElement;
|
|
30
28
|
on?: Record<string, ListenDelegate>;
|
|
31
29
|
constructor(type: string, props: Props, key?: Key | undefined);
|
|
32
|
-
|
|
30
|
+
}
|
|
31
|
+
export declare class JSXComponent implements JSXTypeof<JSXInternal.ComponentSetup> {
|
|
32
|
+
type: JSXInternal.ComponentSetup;
|
|
33
|
+
props: Props;
|
|
34
|
+
factory: (parentComponent: Component) => Component;
|
|
35
|
+
key?: Key | undefined;
|
|
36
|
+
$$typeOf: JSXInternal.ComponentSetup<any>;
|
|
37
|
+
constructor(type: JSXInternal.ComponentSetup, props: Props, factory: (parentComponent: Component) => Component, key?: Key | undefined);
|
|
38
|
+
createInstance(parentComponent: Component): Component;
|
|
33
39
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Props } from './jsx-element';
|
|
2
2
|
import { JSXInternal } from './types';
|
|
3
|
-
export declare function withMemo<T extends Props = Props>(
|
|
3
|
+
export declare function withMemo<T extends Props = Props>(canUseMemo: JSXInternal.ComponentInstance<T>['$useMemo'], render: () => JSXInternal.JSXNode): JSXInternal.ComponentInstance<T>;
|
|
@@ -6,6 +6,6 @@ import { Injector } from '../di/_api';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class RootComponent extends Component {
|
|
8
8
|
onChange: (() => void) | null;
|
|
9
|
-
constructor(parentInjector: Injector, factory: JSXInternal.ComponentSetup);
|
|
9
|
+
constructor(parentInjector: Injector | null, factory: JSXInternal.ComponentSetup);
|
|
10
10
|
markAsChanged(changedComponent?: Component): void;
|
|
11
11
|
}
|
|
@@ -5,7 +5,7 @@ export declare namespace JSXInternal {
|
|
|
5
5
|
type ClassNames = string | Record<string, unknown> | false | null | undefined | ClassNames[];
|
|
6
6
|
interface ComponentInstance<P> {
|
|
7
7
|
$render(): JSXNode;
|
|
8
|
-
$
|
|
8
|
+
$useMemo?(currentProps: P, prevProps: P): boolean;
|
|
9
9
|
}
|
|
10
10
|
type JSXNode = Element | JSXInternal.ElementClass | string | number | boolean | null | undefined | JSXNode[];
|
|
11
11
|
type ComponentSetup<P = any> = (props: P) => (() => Element) | ComponentInstance<P>;
|