@viewfly/core 2.1.0 → 2.2.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.
Files changed (62) hide show
  1. package/README.md +67 -4
  2. package/dist/_utils/make-error.d.ts +1 -0
  3. package/dist/base/_api.d.ts +13 -0
  4. package/dist/base/_utils.d.ts +46 -0
  5. package/dist/base/component.d.ts +65 -0
  6. package/dist/base/context.d.ts +42 -0
  7. package/dist/base/dep.d.ts +9 -0
  8. package/dist/base/injection-tokens.d.ts +20 -0
  9. package/dist/base/jsx-element.d.ts +64 -0
  10. package/dist/base/lifecycle.d.ts +37 -0
  11. package/dist/base/memo.d.ts +8 -0
  12. package/dist/base/ref.d.ts +44 -0
  13. package/dist/base/renderer.d.ts +4 -0
  14. package/dist/base/root.component.d.ts +9 -0
  15. package/dist/base/types.d.ts +32 -0
  16. package/dist/di/_api.d.ts +10 -0
  17. package/dist/di/forward-ref.d.ts +10 -0
  18. package/dist/di/injectable.d.ts +20 -0
  19. package/dist/di/injection-token.d.ts +8 -0
  20. package/dist/di/injector.d.ts +26 -0
  21. package/dist/di/metadata.d.ts +43 -0
  22. package/dist/di/null-injector.d.ts +6 -0
  23. package/dist/di/provider.d.ts +30 -0
  24. package/dist/di/reflective-injector.d.ts +30 -0
  25. package/dist/di/reflective-provider.d.ts +20 -0
  26. package/dist/di/type.d.ts +7 -0
  27. package/dist/di/utils/_api.d.ts +3 -0
  28. package/dist/di/utils/annotations.d.ts +33 -0
  29. package/dist/di/utils/decorators.d.ts +17 -0
  30. package/dist/di/utils/stringify.d.ts +1 -0
  31. package/dist/index.d.ts +6 -0
  32. package/dist/index.esm.js +2243 -0
  33. package/dist/index.js +2322 -0
  34. package/dist/jsx-runtime/index.d.ts +7 -0
  35. package/dist/jsx-runtime/index.esm.js +2 -0
  36. package/dist/jsx-runtime/index.js +26 -0
  37. package/dist/jsx-runtime.d.ts +7 -0
  38. package/dist/reactive/_api.d.ts +5 -0
  39. package/dist/reactive/_help.d.ts +15 -0
  40. package/dist/reactive/array-handlers.d.ts +30 -0
  41. package/dist/reactive/computed.d.ts +4 -0
  42. package/dist/reactive/effect.d.ts +13 -0
  43. package/dist/reactive/iterable-iterator.d.ts +5 -0
  44. package/dist/reactive/map-handlers.d.ts +12 -0
  45. package/dist/reactive/reactive.d.ts +89 -0
  46. package/dist/reactive/set-handlers.d.ts +11 -0
  47. package/dist/reactive/shallow-reactive.d.ts +6 -0
  48. package/dist/reactive/watch.d.ts +1 -0
  49. package/dist/signals/_api.d.ts +3 -0
  50. package/dist/signals/derived.d.ts +9 -0
  51. package/dist/signals/effect.d.ts +22 -0
  52. package/dist/signals/signal.d.ts +38 -0
  53. package/dist/viewfly.d.ts +30 -0
  54. package/package.json +25 -25
  55. package/bundles/index.d.ts +0 -768
  56. package/bundles/index.esm.js +0 -2700
  57. package/bundles/index.js +0 -2777
  58. package/jsx-runtime/index.d.ts +0 -25
  59. package/jsx-runtime/index.esm.js +0 -11
  60. package/jsx-runtime/index.js +0 -14
  61. package/jsx-runtime/package.json +0 -29
  62. package/rollup-d.config.ts +0 -14
@@ -0,0 +1,30 @@
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 implements Injector {
11
+ parentInjector: Injector | null;
12
+ protected scope?: (Scope | null) | undefined;
13
+ protected normalizedProviders: NormalizedProvider[];
14
+ protected recordValues: Map<Type<any> | AbstractType<any> | InjectionToken<any>, any>;
15
+ constructor(parentInjector: Injector | null, staticProviders: Provider[], scope?: (Scope | null) | undefined);
16
+ /**
17
+ * 用于获取当前注入器上下文内的实例、对象或数据
18
+ * @param token 访问 token
19
+ * @param notFoundValue 如未查找到的返回值
20
+ * @param flags 查询规则
21
+ */
22
+ get<T extends Type<any> | AbstractType<any> | InjectionToken<any>, U = never>(token: T, notFoundValue?: U, flags?: InjectFlags): ExtractValueType<T> | U;
23
+ private getValue;
24
+ /**
25
+ * 解决并获取依赖参数
26
+ * @param deps 依赖规则
27
+ * @private
28
+ */
29
+ private resolveDeps;
30
+ }
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,7 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ export * from './annotations';
2
+ export * from './decorators';
3
+ export * from './stringify';
@@ -0,0 +1,33 @@
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
+ }
@@ -0,0 +1,17 @@
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;
@@ -0,0 +1 @@
1
+ export declare function stringify(token: any): string;
@@ -0,0 +1,6 @@
1
+ export * from './di/_api';
2
+ export * from './_utils/make-error';
3
+ export * from './base/_api';
4
+ export * from './viewfly';
5
+ export * from './reactive/_api';
6
+ export * from './signals/_api';