@viewfly/core 1.0.0-alpha.8 → 1.0.0

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.
@@ -1,20 +0,0 @@
1
- export declare class Scope {
2
- name: string;
3
- constructor(name: string);
4
- toString(): string;
5
- }
6
- export type ProvideScope = 'root' | Scope;
7
- export interface InjectableOptions {
8
- provideIn: ProvideScope;
9
- }
10
- export interface Injectable {
11
- provideIn?: ProvideScope;
12
- }
13
- export interface InjectableDecorator {
14
- (options?: InjectableOptions): ClassDecorator;
15
- new (options?: InjectableOptions): Injectable;
16
- }
17
- /**
18
- * 可注入类的装饰器
19
- */
20
- export declare const Injectable: InjectableDecorator;
@@ -1,8 +0,0 @@
1
- /**
2
- * 生成自定义依赖注入 token 的类
3
- */
4
- export declare class InjectionToken<T> {
5
- readonly description: string;
6
- constructor(description: string);
7
- toString(): string;
8
- }
@@ -1,26 +0,0 @@
1
- import { AbstractType, Type } from './type';
2
- import { InjectionToken } from './injection-token';
3
- /**
4
- * 查找规则
5
- */
6
- export declare enum InjectFlags {
7
- /** 默认查找规则 */
8
- Default = "Default",
9
- /** 锁定当前容器 */
10
- Self = "Self",
11
- /** 跳过当前容器 */
12
- SkipSelf = "SkipSelf",
13
- /** 可选查找 */
14
- Optional = "Optional"
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;
20
- /**
21
- * DI 容器抽象基类
22
- */
23
- export declare abstract class Injector {
24
- abstract parentInjector: Injector | null;
25
- abstract get<T extends Type<any> | AbstractType<any> | InjectionToken<any>, U = never>(token: T, notFoundValue?: U, flags?: InjectFlags): ExtractValueType<T> | U;
26
- }
@@ -1,43 +0,0 @@
1
- import { AbstractType, Type } from './type';
2
- import { ExtractValueType, InjectFlags } from './injector';
3
- import { InjectionToken } from './injection-token';
4
- import { ForwardRef } from './forward-ref';
5
- export interface Inject {
6
- token: InjectionToken<any> | Type<any> | ForwardRef<InjectionToken<any> | Type<any>>;
7
- }
8
- export interface InjectDecorator {
9
- (token: InjectionToken<any> | Type<any> | ForwardRef<InjectionToken<any> | Type<any>>): ParameterDecorator;
10
- new (token: InjectionToken<any> | Type<any> | ForwardRef<InjectionToken<any> | Type<any>>): Inject;
11
- }
12
- /**
13
- * 构造函数参数装饰器,用于改变注入 token
14
- */
15
- export declare const Inject: InjectDecorator;
16
- export interface Self {
17
- }
18
- export interface SelfDecorator {
19
- (): ParameterDecorator;
20
- new (): Self;
21
- }
22
- export declare const Self: SelfDecorator;
23
- export interface SkipSelf {
24
- }
25
- export interface SkipSelfDecorator {
26
- (): ParameterDecorator;
27
- new (): SkipSelf;
28
- }
29
- export declare const SkipSelf: SkipSelfDecorator;
30
- export interface Optional {
31
- }
32
- export interface OptionalDecorator {
33
- (): ParameterDecorator;
34
- new (): Optional;
35
- }
36
- export declare const Optional: OptionalDecorator;
37
- export interface Prop {
38
- }
39
- export interface PropDecorator {
40
- <T extends Type<any> | AbstractType<any> | InjectionToken<any>, U = never>(token?: T | ForwardRef<ExtractValueType<T>>, notFoundValue?: U, flags?: InjectFlags): PropertyDecorator;
41
- new (token: any): Prop;
42
- }
43
- export declare const Prop: PropDecorator;
@@ -1,6 +0,0 @@
1
- import { InjectFlags, Injector } from './injector';
2
- export declare const THROW_IF_NOT_FOUND: any;
3
- export declare class NullInjector extends Injector {
4
- parentInjector: null;
5
- get(token: any, notFoundValue?: any, _?: InjectFlags): any;
6
- }
@@ -1,30 +0,0 @@
1
- import { AbstractType, Type } from './type';
2
- import { InjectionToken } from './injection-token';
3
- export interface ClassProvider<T = any> {
4
- provide: Type<T> | AbstractType<T> | InjectionToken<T>;
5
- useClass: Type<T>;
6
- deps?: any[];
7
- }
8
- export interface FactoryProvider<T = any> {
9
- provide: Type<T> | AbstractType<T> | InjectionToken<T>;
10
- useFactory: (...args: any[]) => T;
11
- deps?: any[];
12
- }
13
- export interface ValueProvider<T = any> {
14
- provide: Type<T> | AbstractType<T> | InjectionToken<T>;
15
- useValue: T;
16
- }
17
- export interface ExistingProvider<T = any> {
18
- provide: Type<T> | AbstractType<T> | InjectionToken<T>;
19
- useExisting: T;
20
- }
21
- export interface ConstructorProvider<T = any> {
22
- provide: Type<T>;
23
- deps?: [];
24
- }
25
- export interface TypeProvider<T = any> extends Type<T> {
26
- }
27
- export interface AbstractProvider<T = any> extends AbstractType<T> {
28
- }
29
- export type StaticProvider<T = any> = ClassProvider<T> | FactoryProvider<T> | ValueProvider<T> | ExistingProvider<T> | ConstructorProvider<T>;
30
- export type Provider<T = any> = TypeProvider<T> | AbstractProvider<T> | StaticProvider<T>;
@@ -1,31 +0,0 @@
1
- import { Provider } from './provider';
2
- import { ExtractValueType, InjectFlags, Injector } from './injector';
3
- import { NormalizedProvider } from './reflective-provider';
4
- import { AbstractType, Type } from './type';
5
- import { InjectionToken } from './injection-token';
6
- import { Scope } from './injectable';
7
- /**
8
- * 反射注入器
9
- */
10
- export declare class ReflectiveInjector extends Injector {
11
- parentInjector: Injector | null;
12
- protected staticProviders: Provider[];
13
- protected scope?: Scope | undefined;
14
- protected normalizedProviders: NormalizedProvider[];
15
- protected recordValues: Map<Type<any> | AbstractType<any> | InjectionToken<any>, any>;
16
- constructor(parentInjector: Injector | null, staticProviders: Provider[], scope?: Scope | undefined);
17
- /**
18
- * 用于获取当前注入器上下文内的实例、对象或数据
19
- * @param token 访问 token
20
- * @param notFoundValue 如未查找到的返回值
21
- * @param flags 查询规则
22
- */
23
- get<T extends Type<any> | AbstractType<any> | InjectionToken<any>, U = never>(token: T, notFoundValue?: U, flags?: InjectFlags): ExtractValueType<T> | U;
24
- private getValue;
25
- /**
26
- * 解决并获取依赖参数
27
- * @param deps 依赖规则
28
- * @private
29
- */
30
- private resolveDeps;
31
- }
@@ -1,20 +0,0 @@
1
- import { Provider } from './provider';
2
- import { Injector } from './injector';
3
- import { Self, SkipSelf } from './metadata';
4
- import { ProvideScope } from './injectable';
5
- export interface ReflectiveDependency {
6
- injectKey: any;
7
- visibility: SkipSelf | Self | null;
8
- optional: boolean;
9
- }
10
- export interface NormalizedProvider {
11
- provide: any;
12
- generateFactory: (injector: Injector, cacheFn: (token: any, value: any) => void) => (...args: any[]) => any;
13
- deps: ReflectiveDependency[];
14
- scope: ProvideScope | null;
15
- }
16
- /**
17
- * 标准化 provide,并返回统一数据结构
18
- * @param provider
19
- */
20
- export declare function normalizeProvider(provider: Provider): NormalizedProvider;
@@ -1,7 +0,0 @@
1
- export declare const Type: FunctionConstructor;
2
- export interface Type<T> extends Function {
3
- new (...args: any[]): T;
4
- }
5
- export interface AbstractType<T> extends Function {
6
- prototype: T;
7
- }
@@ -1,3 +0,0 @@
1
- export * from './annotations';
2
- export * from './decorators';
3
- export * from './stringify';
@@ -1,33 +0,0 @@
1
- import { Injector } from '../injector';
2
- export interface ClassAnnotation {
3
- paramTypes: any[];
4
- metadata: any;
5
- }
6
- export interface ParamAnnotation {
7
- propertyKey: string | symbol;
8
- parameterIndex: number;
9
- metadata: any;
10
- }
11
- export interface PropertyDecoratorContextCallback {
12
- (instance: any, propertyName: string | symbol, token: any, injector: Injector): void;
13
- }
14
- export interface PropertyAnnotation {
15
- injectToken: any;
16
- propertyKey: string | symbol;
17
- contextCallback: PropertyDecoratorContextCallback;
18
- }
19
- /**
20
- * 用于保存 class 的元数据
21
- */
22
- export declare class Annotations {
23
- private classes;
24
- private props;
25
- private params;
26
- setClassMetadata(token: any, params: ClassAnnotation): void;
27
- getClassMetadata(token: any): ClassAnnotation | undefined;
28
- pushParamMetadata(token: any, params: ParamAnnotation): void;
29
- getParamMetadata(token: any): ParamAnnotation[] | undefined;
30
- getPropMetadataKeys(): any[];
31
- pushPropMetadata(token: any, params: PropertyAnnotation): void;
32
- getPropMetadata(token: any): PropertyAnnotation[] | undefined;
33
- }
@@ -1,17 +0,0 @@
1
- import { Annotations, PropertyDecoratorContextCallback } from './annotations';
2
- /**
3
- * 创建参数装饰器的工厂函数
4
- */
5
- export declare function makeParamDecorator(token: any, metadata: any): ParameterDecorator;
6
- /**
7
- * 创建属性装饰器的工厂函数
8
- */
9
- export declare function makePropertyDecorator(token: any, injectToken: any, contextCallback: PropertyDecoratorContextCallback): PropertyDecorator;
10
- /**
11
- * 创建类装饰器的工厂函数
12
- */
13
- export declare function makeClassDecorator(token: any, metadata: any): ClassDecorator;
14
- /**
15
- * 获取类注解的工具函数
16
- */
17
- export declare function getAnnotations(target: any): Annotations;
@@ -1 +0,0 @@
1
- export declare function stringify(token: any): string;
@@ -1,8 +0,0 @@
1
- export * from './component';
2
- export * from './injection-tokens';
3
- export * from './jsx-element';
4
- export * from './memo';
5
- export * from './renderer';
6
- export * from './root.component';
7
- export * from './types';
8
- export { Atom, ComponentView } from './_utils';
@@ -1,55 +0,0 @@
1
- import { JSXNode } from './jsx-element';
2
- import { NativeNode } from './injection-tokens';
3
- import { Component } from './component';
4
- export interface ListenDelegate {
5
- delegate: () => any;
6
- listenFn: ((...args: any[]) => any) | void;
7
- }
8
- export interface ObjectChanges {
9
- remove: [string, any][];
10
- add: [string, any][];
11
- replace: [string, any, any][];
12
- }
13
- export declare const refKey = "ref";
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>;
20
- export declare function classToString(config: unknown): string;
21
- export declare function styleToObject(style: string | Record<string, any>): Record<string, any>;
22
- export interface TextAtom {
23
- type: 'text';
24
- index: number;
25
- jsxNode: string;
26
- nativeNode: NativeNode | null;
27
- child: Atom | null;
28
- sibling: Atom | null;
29
- isSvg: boolean;
30
- }
31
- export interface ElementAtom {
32
- type: 'element';
33
- index: number;
34
- jsxNode: JSXNode<string>;
35
- nativeNode: NativeNode | null;
36
- child: Atom | null;
37
- sibling: Atom | null;
38
- isSvg: boolean;
39
- }
40
- export interface ComponentAtom {
41
- type: 'component';
42
- index: number;
43
- jsxNode: JSXNode<JSXInternal.ComponentSetup> | Component;
44
- nativeNode: NativeNode | null;
45
- child: Atom | null;
46
- sibling: Atom | null;
47
- isSvg: boolean;
48
- }
49
- export type Atom = TextAtom | ElementAtom | ComponentAtom;
50
- export interface ComponentView {
51
- atom: Atom;
52
- host: NativeNode;
53
- isParent: boolean;
54
- rootHost: NativeNode;
55
- }
@@ -1,243 +0,0 @@
1
- import { AbstractType, ExtractValueType, InjectFlags, InjectionToken, Injector, Provider, ReflectiveInjector, Type } from '../di/_api';
2
- import { Key, Props } from './jsx-element';
3
- /**
4
- * Viewfly 组件管理类,用于管理组件的生命周期,上下文等
5
- */
6
- export declare class Component extends ReflectiveInjector {
7
- private readonly parentComponent;
8
- readonly type: JSXInternal.ComponentSetup;
9
- props: Props;
10
- readonly key?: Key | undefined;
11
- instance: JSXInternal.ComponentInstance<Props>;
12
- template: JSXInternal.ViewNode;
13
- changedSubComponents: Set<Component>;
14
- get dirty(): boolean;
15
- get changed(): boolean;
16
- unmountedCallbacks?: LifeCycleCallback[] | null;
17
- mountCallbacks?: LifeCycleCallback[] | null;
18
- propsChangedCallbacks?: PropsChangedCallback<any>[] | null;
19
- updatedCallbacks?: LifeCycleCallback[] | null;
20
- private updatedDestroyCallbacks?;
21
- private propsChangedDestroyCallbacks?;
22
- protected _dirty: boolean;
23
- protected _changed: boolean;
24
- private unWatch?;
25
- private isFirstRendering;
26
- private refs;
27
- constructor(parentComponent: Injector | null, type: JSXInternal.ComponentSetup, props: Props, key?: Key | undefined);
28
- markAsDirtied(): void;
29
- markAsChanged(changedComponent?: Component): void;
30
- render(): {
31
- template: any;
32
- portalHost: import("./injection-tokens").NativeNode | undefined;
33
- };
34
- update(newProps: Record<string, any>, forceUpdate?: boolean): any;
35
- provide<T>(providers: Provider<T> | Provider<T>[]): void;
36
- rendered(): void;
37
- destroy(): void;
38
- private invokePropsChangedHooks;
39
- private invokeMountHooks;
40
- private invokeUpdatedHooks;
41
- }
42
- export interface LifeCycleCallback {
43
- (): void | (() => void);
44
- }
45
- export interface PropsChangedCallback<T extends Props> {
46
- (currentProps: T | null, oldProps: T | null): void | (() => void);
47
- }
48
- /**
49
- * 当组件第一次渲染完成时触发
50
- * @param callback
51
- * ```tsx
52
- * function App() {
53
- * onMount(() => {
54
- * console.log('App mounted!')
55
- * })
56
- * return () => <div>...</div>
57
- * }
58
- * ```
59
- */
60
- export declare function onMounted(callback: LifeCycleCallback): void;
61
- /**
62
- * 当组件视图更新后调用
63
- * @param callback
64
- * ```tsx
65
- * function App() {
66
- * onUpdated(() => {
67
- * console.log('App updated!')
68
- * return () => {
69
- * console.log('destroy prev update!')
70
- * }
71
- * })
72
- * return () => <div>...</div>
73
- * }
74
- * ```
75
- */
76
- export declare function onUpdated(callback: LifeCycleCallback): () => void;
77
- /**
78
- * 当组件 props 更新地调用
79
- * @param callback
80
- * @example
81
- * ```tsx
82
- * function YourComponent(props) {
83
- * onPropsChanged((currentProps, prevProps) => {
84
- * console.log(currentProps, prevProps)
85
- *
86
- * return () => {
87
- * console.log('destroy prev changed!')
88
- * }
89
- * })
90
- * return () => {
91
- * return <div>xxx</div>
92
- * }
93
- * }
94
- * ```
95
- */
96
- export declare function onPropsChanged<T extends Props>(callback: PropsChangedCallback<T>): () => void;
97
- /**
98
- * 当组件销毁时调用回调函数
99
- * @param callback
100
- */
101
- export declare function onUnmounted(callback: () => void): void;
102
- export interface RefListener<T> {
103
- (current: T): void | (() => void);
104
- }
105
- export type ExtractInstanceType<T, U = T extends (...args: any) => any ? ReturnType<T> : T> = U extends JSXInternal.ComponentInstance<any> ? Omit<U, keyof JSXInternal.ComponentInstance<any>> : U extends Function ? never : T;
106
- export interface AbstractInstanceType<T extends Record<string, any>> {
107
- (): T & JSXInternal.ComponentInstance<any>;
108
- }
109
- export declare class DynamicRef<T> {
110
- private callback;
111
- private unBindMap;
112
- private targetCaches;
113
- constructor(callback: RefListener<T>);
114
- bind(value: T): void;
115
- unBind(value: T): void;
116
- }
117
- /**
118
- * 用于节点渲染完成时获取 DOM 节点
119
- * @param callback 获取 DOM 节点的回调函数
120
- * @example
121
- * ```tsx
122
- * function App() {
123
- * const ref = createDynamicRef(node => {
124
- * function fn() {
125
- * // do something...
126
- * }
127
- * node.addEventListener('click', fn)
128
- * return () => {
129
- * node.removeEventListener('click', fn)
130
- * }
131
- * })
132
- * return () => {
133
- * return <div ref={ref}>xxx</div>
134
- * }
135
- * }
136
- * ```
137
- */
138
- export declare function createDynamicRef<T, U = ExtractInstanceType<T>>(callback: RefListener<U>): DynamicRef<U>;
139
- export declare class StaticRef<T> extends DynamicRef<T> {
140
- readonly current: T | null;
141
- constructor();
142
- }
143
- export declare function createRef<T, U = ExtractInstanceType<T>>(): StaticRef<U>;
144
- declare const depsKey: unique symbol;
145
- /**
146
- * 组件状态实例,直接调用可以获取最新的状态,通过 set 方法可以更新状态
147
- * ```
148
- */
149
- export interface Signal<T> {
150
- $isSignal: true;
151
- /**
152
- * 直接调用一个 Signal 实例,可以获取最新状态
153
- */
154
- (): T;
155
- /**
156
- * 更新组件状态的方法,可以传入最新的值
157
- * @param newState
158
- */
159
- set(newState: T): void;
160
- [depsKey]: Set<LifeCycleCallback>;
161
- }
162
- /**
163
- * 组件状态管理器
164
- * @param state 初始状态
165
- * @example
166
- * ```tsx
167
- * function App() {
168
- * // 初始化状态
169
- * const state = createSignal(1)
170
- *
171
- * return () => {
172
- * <div>
173
- * <div>当前值为:{state()}</div>
174
- * <div>
175
- * <button type="button" onClick={() => {
176
- * // 当点击时更新状态
177
- * state.set(state() + 1)
178
- * }
179
- * }>updateState</button>
180
- * </div>
181
- * </div>
182
- * }
183
- * }
184
- */
185
- export declare function createSignal<T>(state: T): Signal<T>;
186
- /**
187
- * 使用派生值,Viewfly 会收集回调函数内同步执行时访问的 Signal,
188
- * 并在你获取 useDerived 函数返回的 Signal 的值时,自动计算最新的值。
189
- *
190
- * @param callback
191
- * @param isContinue 可选的停止函数,在每次值更新后调用,当返回值为 false 时,将不再监听依赖的变化
192
- */
193
- export declare function createDerived<T>(callback: () => T, isContinue?: (data: T) => unknown): Signal<T>;
194
- export interface WatchCallback<T, U> {
195
- (newValue: T, oldValue: U): void | (() => void);
196
- }
197
- /**
198
- * 监听状态变化,当任意一个状态发生变更时,触发回调。
199
- * watch 会返回一个取消监听的函数,调用此函数,可以取消监听。
200
- * 当在组件中调用时,组件销毁时会自动取消监听。
201
- * @param deps 依赖的状态 Signal,可以是一个 Signal,只可以一个数包含 Signal 的数组,或者是一个求值函数
202
- * @param callback 状态变更后的回调函数
203
- */
204
- export declare function watch<T>(deps: Signal<T>, callback: WatchCallback<T, T>): () => void;
205
- export declare function watch<T>(deps: [Signal<T>], callback: WatchCallback<[T], [T]>): () => void;
206
- export declare function watch<T, T1>(deps: [Signal<T>, Signal<T1>], callback: WatchCallback<[T, T1], [T, T1]>): () => void;
207
- export declare function watch<T, T1, T2>(deps: [Signal<T>, Signal<T1>, Signal<T2>], callback: WatchCallback<[T, T1, T2], [T, T1, T2]>): () => void;
208
- export declare function watch<T, T1, T2, T3>(deps: [Signal<T>, Signal<T1>, Signal<T2>, Signal<T3>], callback: WatchCallback<[T, T1, T2, T3], [T, T1, T2, T3]>): () => void;
209
- export declare function watch<T, T1, T2, T3, T4>(deps: [Signal<T>, Signal<T1>, Signal<T2>, Signal<T3>, Signal<T4>], callback: WatchCallback<[T, T1, T2, T3, T4], [T, T1, T2, T3, T4]>): () => void;
210
- export declare function watch<T, T1, T2, T3, T4, T5>(deps: [Signal<T>, Signal<T1>, Signal<T2>, Signal<T3>, Signal<T4>, Signal<T5>], callback: WatchCallback<[T, T1, T2, T3, T4, T5], [T, T1, T2, T3, T4, T5]>): () => void;
211
- export declare function watch<T, T1, T2, T3, T4, T5, T6>(deps: [Signal<T>, Signal<T1>, Signal<T2>, Signal<T3>, Signal<T4>, Signal<T5>, Signal<T6>], callback: WatchCallback<[T, T1, T2, T3, T4, T5, T6], [T, T1, T2, T3, T4, T5, T6]>): () => void;
212
- export declare function watch<T, T1, T2, T3, T4, T5, T6, T7>(deps: [Signal<T>, Signal<T1>, Signal<T2>, Signal<T3>, Signal<T4>, Signal<T5>, Signal<T6>, Signal<T7>], callback: WatchCallback<[T, T1, T2, T3, T4, T5, T6, T7], [T, T1, T2, T3, T4, T5, T6, T7]>): () => void;
213
- export declare function watch<T>(deps: () => T, callback: WatchCallback<T, T>): () => void;
214
- export declare function watch<T = any>(deps: Signal<any>[], callback: WatchCallback<T[], T[]>): () => void;
215
- /**
216
- * 给组件添加注解
217
- * @param annotation
218
- * @param componentSetup
219
- * @example
220
- * ```ts
221
- * export customScope = new Scope('scopeName')
222
- * export const App = withAnnotation({
223
- * scope: customScope,
224
- * providers: [
225
- * ExampleService
226
- * ]
227
- * }, function(props: Props) {
228
- * return () => {
229
- * return <div>...</div>
230
- * }
231
- * })
232
- * ```
233
- */
234
- export declare function withAnnotation<T extends JSXInternal.ComponentSetup>(annotation: JSXInternal.ComponentAnnotation, componentSetup: T): T;
235
- /**
236
- * 通过组件上下文获取 IoC 容器内数据的勾子方法
237
- */
238
- export declare function inject<T extends Type<any> | AbstractType<any> | InjectionToken<any>, U = never>(token: T, notFoundValue?: U, flags?: InjectFlags): ExtractValueType<T> | U;
239
- /**
240
- * 获取当前组件实例
241
- */
242
- export declare function getCurrentInstance(): Component;
243
- export {};
@@ -1,18 +0,0 @@
1
- export type NativeNode = Record<string, any>;
2
- export declare abstract class NativeRenderer<ElementNode = NativeNode, TextNode = NativeNode> {
3
- abstract createElement(name: string, isSvg: boolean): ElementNode;
4
- abstract createTextNode(textContent: string, isSvg: boolean): TextNode;
5
- abstract setProperty(node: ElementNode, key: string, value: any, isSvg: boolean): void;
6
- abstract appendChild(parent: ElementNode, newChild: ElementNode | TextNode, isSvg: boolean): void;
7
- abstract prependChild(parent: ElementNode, newChild: ElementNode | TextNode, isSvg: boolean): void;
8
- abstract removeProperty(node: ElementNode, key: string, isSvg: boolean): void;
9
- abstract setStyle(target: ElementNode, key: string, value: any, isSvg: boolean): void;
10
- abstract removeStyle(target: ElementNode, key: string, isSvg: boolean): void;
11
- abstract setClass(target: ElementNode, value: string, isSvg: boolean): void;
12
- abstract listen<T = any>(node: ElementNode, type: string, callback: (ev: T) => any, isSvg: boolean): void;
13
- abstract unListen(node: ElementNode, type: string, callback: (ev: any) => any, isSvg: boolean): void;
14
- abstract remove(node: ElementNode | TextNode, isSvg: boolean): void;
15
- abstract cleanChildren(node: ElementNode, isSvg: boolean): void;
16
- abstract syncTextContent(target: TextNode, content: string, isSvg: boolean): void;
17
- abstract insertAfter(newNode: ElementNode | TextNode, ref: ElementNode | TextNode, isSvg: boolean): void;
18
- }
@@ -1,17 +0,0 @@
1
- import { ListenDelegate } from './_utils';
2
- export interface Props {
3
- children?: JSXInternal.ViewNode | JSXInternal.ViewNode[];
4
- }
5
- export declare function Fragment(props: Props): () => any;
6
- export type Key = number | string;
7
- export declare function jsx(type: string | JSXInternal.ComponentSetup, props: Props & Record<string, any>, key?: Key): JSXNode;
8
- export declare const jsxs: typeof jsx;
9
- export interface JSXNode<T = string | JSXInternal.ComponentSetup> {
10
- type: T;
11
- props: Props & Record<string, any>;
12
- key?: Key;
13
- on?: Record<string, ListenDelegate>;
14
- }
15
- export declare const JSXNodeFactory: {
16
- createNode<T = string | JSXInternal.ComponentSetup<any>>(type: T, props: Props & Record<string, any>, key?: Key): JSXNode<T>;
17
- };
@@ -1,2 +0,0 @@
1
- import { Props } from './jsx-element';
2
- export declare function withMemo<T extends Props = Props>(canUseMemo: JSXInternal.ComponentInstance<T>['$useMemo'], render: () => JSXInternal.ViewNode): JSXInternal.ComponentInstance<T>;
@@ -1,3 +0,0 @@
1
- import { NativeNode, NativeRenderer } from './injection-tokens';
2
- import { Component } from './component';
3
- export declare function createRenderer(component: Component, nativeRenderer: NativeRenderer): (host: NativeNode) => void;
@@ -1,10 +0,0 @@
1
- import { Component } from './component';
2
- import { Injector } from '../di/_api';
3
- /**
4
- * Viewfly 根组件,用于实现组件状态更新事件通知
5
- */
6
- export declare class RootComponent extends Component {
7
- private refresh;
8
- constructor(parentInjector: Injector | null, factory: JSXInternal.ComponentSetup, refresh: () => void);
9
- markAsChanged(changedComponent?: Component): void;
10
- }