annil 1.13.0 → 1.13.1
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/CHANGELOG.md +9 -0
- package/dist/api/ChunkComponent/index.d.ts +3 -3
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.d.ts +1 -1
- package/dist/api/CustomComponent/index.d.ts +2 -2
- package/dist/api/RootComponent/Computed/{GetComputedDoc.d.ts → GetComputedDef.d.ts} +1 -1
- package/dist/api/RootComponent/Computed/GetComputedDef.js +2 -0
- package/dist/api/RootComponent/Computed/GetComputedDef.js.map +1 -0
- package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +10 -5
- package/dist/api/RootComponent/CustomEvents/CustomEventsTag.d.ts +2 -2
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDef.d.ts +10 -0
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDef.js +2 -0
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDef.js.map +1 -0
- package/dist/api/RootComponent/Events/EventsConstraint.d.ts +2 -2
- package/dist/api/RootComponent/Instance/CustomEventMethods.d.ts +2 -2
- package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +4 -4
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +1 -1
- package/dist/api/RootComponent/Properties/{GetOptionalDoc.d.ts → GetOptionalDef.d.ts} +1 -1
- package/dist/api/RootComponent/Properties/GetOptionalDef.js +2 -0
- package/dist/api/RootComponent/Properties/GetOptionalDef.js.map +1 -0
- package/dist/api/RootComponent/Properties/GetPropertiesDef.d.ts +8 -0
- package/dist/api/RootComponent/Properties/GetPropertiesDef.js +2 -0
- package/dist/api/RootComponent/Properties/GetPropertiesDef.js.map +1 -0
- package/dist/api/RootComponent/Properties/GetRequiredDef.d.ts +5 -0
- package/dist/api/RootComponent/Properties/GetRequiredDef.js +2 -0
- package/dist/api/RootComponent/Properties/GetRequiredDef.js.map +1 -0
- package/dist/api/RootComponent/Store/{GeTStoreDoc.d.ts → GetStoreDef.d.ts} +1 -1
- package/dist/api/RootComponent/Store/GetStoreDef.js +3 -0
- package/dist/api/RootComponent/Store/GetStoreDef.js.map +1 -0
- package/dist/api/RootComponent/index.d.ts +19 -19
- package/dist/api/wxSugar.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js.map +1 -1
- package/dist/types/ComputeObject.js +2 -0
- package/dist/types/ComputeObject.js.map +1 -0
- package/dist/utils/typeEqual.d.ts +1 -1
- package/dist/utils/typeEqual.js +2 -2
- package/dist/utils/typeEqual.js.map +1 -1
- package/package.json +1 -1
- package/src/api/ChunkComponent/ChunkComputed/test/normal.test.ts +1 -1
- package/src/api/ChunkComponent/index.ts +4 -4
- package/src/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.ts +1 -1
- package/src/api/CustomComponent/index.ts +2 -2
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +4 -4
- package/src/api/DefineComponent/index.ts +4 -4
- package/src/api/DefineComponent/returnType/test/normalPageDoc.test.ts +0 -1
- package/src/api/RootComponent/Computed/ComputedOption.ts +2 -3
- package/src/api/RootComponent/Computed/{GetComputedDoc.ts → GetComputedDef.ts} +1 -1
- package/src/api/RootComponent/Computed/test/GetComputedDoc.test.ts +3 -3
- package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +20 -5
- package/src/api/RootComponent/CustomEvents/CustomEventsDef.ts +4 -0
- package/src/api/RootComponent/CustomEvents/CustomEventsTag.ts +2 -2
- package/src/api/RootComponent/CustomEvents/GetCustomEventDef.ts +29 -0
- package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +3 -3
- package/src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts +2 -2
- package/src/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.ts +6 -6
- package/src/api/RootComponent/CustomEvents/test/normal.test.ts +8 -8
- package/src/api/RootComponent/Data/GetDataDef.ts +8 -0
- package/src/api/RootComponent/Data/test/GetDataDoc.test.ts +3 -3
- package/src/api/RootComponent/Events/EventsConstraint.ts +3 -3
- package/src/api/RootComponent/Events/test/normal.test.ts +16 -0
- package/src/api/RootComponent/Instance/CustomEventMethods.ts +4 -4
- package/src/api/RootComponent/Instance/RootComponentInstance.ts +4 -4
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +1 -1
- package/src/api/RootComponent/Properties/{GetOptionalDoc.ts → GetOptionalDef.ts} +1 -1
- package/src/api/RootComponent/Properties/GetPropertiesDef.ts +25 -0
- package/src/api/RootComponent/Properties/GetRequiredDef.ts +16 -0
- package/src/api/RootComponent/Store/{GeTStoreDoc.ts → GetStoreDef.ts} +10 -14
- package/src/api/RootComponent/index.ts +50 -50
- package/src/api/wxSugar.ts +1 -1
- package/src/index.ts +1 -2
- package/src/thirdLib/wm/swiper.test.ts +4 -6
- package/src/utils/typeEqual.ts +11 -8
- package/src/utils/typeNotEqual.ts +48 -0
- package/dist/api/RootComponent/Computed/GetComputedDoc.js +0 -2
- package/dist/api/RootComponent/Computed/GetComputedDoc.js.map +0 -1
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +0 -10
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.js +0 -2
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.js.map +0 -1
- package/dist/api/RootComponent/Properties/GetOptionalDoc.js +0 -2
- package/dist/api/RootComponent/Properties/GetOptionalDoc.js.map +0 -1
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.d.ts +0 -8
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.js +0 -2
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.js.map +0 -1
- package/dist/api/RootComponent/Properties/GetRequiredDoc.d.ts +0 -6
- package/dist/api/RootComponent/Properties/GetRequiredDoc.js +0 -2
- package/dist/api/RootComponent/Properties/GetRequiredDoc.js.map +0 -1
- package/dist/api/RootComponent/Store/GeTStoreDoc.js +0 -2
- package/dist/api/RootComponent/Store/GeTStoreDoc.js.map +0 -1
- package/dist/types/ComputeObj.js +0 -2
- package/dist/types/ComputeObj.js.map +0 -1
- package/dist/types/TwoParamsEqual.d.ts +0 -2
- package/dist/types/TwoParamsEqual.js +0 -2
- package/dist/types/TwoParamsEqual.js.map +0 -1
- package/src/api/RootComponent/Properties/GetPropertiesDoc.ts +0 -24
- package/src/api/RootComponent/Properties/GetRequiredDoc.ts +0 -23
- /package/dist/types/{ComputeObj.d.ts → ComputeObject.d.ts} +0 -0
- /package/src/types/{ComputeObj.ts → ComputeObject.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
* 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
|
|
6
6
|
|
|
7
|
+
## [1.13.1](https://github.com/missannil/annil/compare/v1.13.0...v1.13.1) (2026-03-26)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* root事件无法与子事件共存的问题 ([13ceb70](https://github.com/missannil/annil/commit/13ceb704add0e31c75dbff65a5818f9b5e13e0da))
|
|
13
|
+
* typeEqual增加参数验证方式 ([08e4cf6](https://github.com/missannil/annil/commit/08e4cf634c919018bd7aab4279637016a40b2274))
|
|
14
|
+
* 去除api类型 ParamsEqual ([a57b0ac](https://github.com/missannil/annil/commit/a57b0acc0199c1e022bb3784f35e1fc95733d52b))
|
|
15
|
+
|
|
7
16
|
## [1.13.0](https://github.com/missannil/annil/compare/v1.12.7...v1.13.0) (2026-03-22)
|
|
8
17
|
|
|
9
18
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/_api";
|
|
2
2
|
import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
|
|
3
3
|
import type { IInjectAllData, IInjectMethods, IInjectStore } from "../InstanceInject/instanceConfig";
|
|
4
|
-
import type {
|
|
4
|
+
import type { GetComputedDef } from "../RootComponent/Computed/GetComputedDef";
|
|
5
5
|
import type { RootComponentInstance } from "../RootComponent/Instance/RootComponentInstance";
|
|
6
6
|
import type { LifetimesOption } from "../RootComponent/Lifetimes/LifetimesOption";
|
|
7
7
|
import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
|
|
8
8
|
import type { ObserversOption } from "../RootComponent/Observers/ObserversOption";
|
|
9
9
|
import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
|
|
10
10
|
import type { RootComponentDefinition } from "../RootComponent/returnType";
|
|
11
|
-
import type {
|
|
11
|
+
import type { GetStoreDef } from "../RootComponent/Store/GetStoreDef";
|
|
12
12
|
import type { WatchOption } from "../RootComponent/Watch/WatchOption";
|
|
13
13
|
import type { ChunkComputedConstraint } from "./ChunkComputed/ChunkComputedConstraint";
|
|
14
14
|
import type { ChunkComputedOption } from "./ChunkComputed/ChunkComputedOption";
|
|
@@ -19,6 +19,6 @@ import type { ChunkMethodsOption } from "./ChunkMethods/ChunkMethodsOption";
|
|
|
19
19
|
import type { ChunkStoreConstraint } from "./ChunkStore/ChunkStoreConstraint";
|
|
20
20
|
import type { ChunkStoreOption } from "./ChunkStore/ChunkStoreOption";
|
|
21
21
|
type ChunkComponentOptions<TIsPage extends boolean, Prefix extends string, RootDatas extends object, TEvents extends ChunkEventsConstraint, TData extends object, TStore extends ChunkStoreConstraint, StoreDoc extends object, TComputed extends ChunkComputedConstraint, ComputedDoc extends object, RootMethods extends object, RootEvents extends object, TMethods extends MethodsConstraint, EventsDoc extends object, PropertiesDoc extends object> = ChunkDataOption<TData, keyof (RootDatas & IInjectAllData), Prefix> & ChunkStoreOption<TStore, keyof (TData & RootDatas & IInjectAllData), Prefix> & ChunkComputedOption<TComputed, keyof (TData & StoreDoc & RootDatas & IInjectAllData), Prefix> & ChunkEventsOption<TEvents, keyof (RootMethods & RootEvents & IInjectMethods), Prefix> & ChunkMethodsOption<TMethods, keyof (RootMethods & RootEvents & EventsDoc & IInjectMethods), Prefix> & ThisType<RootComponentInstance<TIsPage, TMethods & RootMethods, TData, TData & StoreDoc & ComputedDoc & RootDatas & IInjectAllData, {}, StoreDoc>> & PageLifetimesOption<TIsPage, PropertiesDoc> & LifetimesOption & WatchOption<ComputedDoc & Required<RootDatas> & TData & StoreDoc & IInjectStore> & Partial<Omit<WMCompOtherOption, "pageLifetimes" | "definitionFilter" | "observers">> & ObserversOption<ComputedDoc & Required<RootDatas> & TData & StoreDoc & IInjectStore>;
|
|
22
|
-
type ChunkComponentConstructor<TRootComponentReturnType extends RootComponentDefinition, TPrefix extends string, IsPage extends boolean = TRootComponentReturnType["isPage"] extends true ? true : false, RootDatas extends object = Required<TRootComponentReturnType["properties"]> & TRootComponentReturnType["data"] & TRootComponentReturnType["computed"] & TRootComponentReturnType["store"], RootMethods extends object = TRootComponentReturnType["methods"] & {}, RootEvents extends object = TRootComponentReturnType["events"] & {}> = <TEvents extends ChunkEventsConstraint, TStore extends ChunkStoreConstraint<Required<TRootComponentReturnType["properties"]>>, TMethods extends MethodsConstraint = {}, TData extends object = {}, StoreDoc extends object = ChunkStoreConstraint<Required<TRootComponentReturnType["properties"]>> extends TStore ? {} :
|
|
22
|
+
type ChunkComponentConstructor<TRootComponentReturnType extends RootComponentDefinition, TPrefix extends string, IsPage extends boolean = TRootComponentReturnType["isPage"] extends true ? true : false, RootDatas extends object = Required<TRootComponentReturnType["properties"]> & TRootComponentReturnType["data"] & TRootComponentReturnType["computed"] & TRootComponentReturnType["store"], RootMethods extends object = TRootComponentReturnType["methods"] & {}, RootEvents extends object = TRootComponentReturnType["events"] & {}> = <TEvents extends ChunkEventsConstraint, TStore extends ChunkStoreConstraint<Required<TRootComponentReturnType["properties"]>>, TMethods extends MethodsConstraint = {}, TData extends object = {}, StoreDoc extends object = ChunkStoreConstraint<Required<TRootComponentReturnType["properties"]>> extends TStore ? {} : GetStoreDef<TStore>, TComputed extends ChunkComputedConstraint = {}, ComputedDoc extends object = GetComputedDef<TComputed>, EventsDoc extends object = IfExtends<ChunkEventsConstraint, TEvents, {}, TEvents>, PropertiesDoc extends object = NonNullable<TRootComponentReturnType["properties"]>>(options: ChunkComponentOptions<IsPage, TPrefix, RootDatas, TEvents, TData, TStore, StoreDoc, TComputed, ComputedDoc, RootMethods, RootEvents, TMethods, EventsDoc, PropertiesDoc>) => never;
|
|
23
23
|
export declare function ChunkComponent<TRootComponentReturnType extends RootComponentDefinition, TPrefix extends string = "">(): ChunkComponentConstructor<TRootComponentReturnType, TPrefix>;
|
|
24
24
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
3
3
|
import type { ComputeIntersection, Select } from "hry-types/src/Object/_api";
|
|
4
|
-
import type { ComputeObject } from "../../../types/
|
|
4
|
+
import type { ComputeObject } from "../../../types/ComputeObject";
|
|
5
5
|
import type { RemovePrefix } from "../../../types/RemovePrefix";
|
|
6
6
|
import type { Composed } from "../../RootComponent/CustomEvents/CustomEventsTag";
|
|
7
7
|
type SelectStopEvents<T extends object> = {
|
|
@@ -11,7 +11,7 @@ import type { UnionToComma } from "../../types/UnionToComma.test";
|
|
|
11
11
|
import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
|
|
12
12
|
import type { IInjectStore } from "../InstanceInject/instanceConfig";
|
|
13
13
|
import type { RootComponentDefinition } from "../RootComponent/returnType";
|
|
14
|
-
import type {
|
|
14
|
+
import type { GetStoreDef } from "../RootComponent/Store/GetStoreDef";
|
|
15
15
|
import type { CustomComputedConstraint } from "./CustomComputed/CustomComputedConstraint";
|
|
16
16
|
import type { CustomComputedOption } from "./CustomComputed/CustomComputedOption";
|
|
17
17
|
import type { GetCustomComputedDoc } from "./CustomComputed/GetCustomComputedDoc";
|
|
@@ -44,6 +44,6 @@ type CustomComponentConstructor<TRootDoc extends RootComponentDefinition, TOrigi
|
|
|
44
44
|
properties: Extra<CurrentPrefix>;
|
|
45
45
|
}, ReplacePrefix<TOriginalCompDoc & {
|
|
46
46
|
properties: Extra<CurrentPrefix>;
|
|
47
|
-
}, CurrentPrefix>>, AllRootDataDoc extends object = Required<TRootDoc["properties"]> & TRootDoc["data"] & TRootDoc["computed"] & TRootDoc["store"]> = <TInherit extends CustomInheritConstraint<AllRootDataDoc, CurrentCompDoc>, TData extends CustomDataConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc> & Record<InnerFields<CurrentPrefix>, unknown>>, TStore extends CustomStoreConstraint<Required<TRootDoc["properties"]>, Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TEvents extends CustomEventsConstraint<CurrentCompDoc>, TComputed extends CustomComputedConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TMethods extends CustomMethodsConstraint = {}, InheritDoc extends object = IfExtends<CustomInheritConstraint<AllRootDataDoc, CurrentCompDoc>, TInherit, {}, TInherit>, DataDoc extends object = IfExtends<CustomDataConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc> & Record<InnerFields<CurrentPrefix>, unknown>>, TData, {}, TData>, StoreDoc extends object = IfExtends<CustomStoreConstraint<Required<TRootDoc["properties"]>, Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TStore, {},
|
|
47
|
+
}, CurrentPrefix>>, AllRootDataDoc extends object = Required<TRootDoc["properties"]> & TRootDoc["data"] & TRootDoc["computed"] & TRootDoc["store"]> = <TInherit extends CustomInheritConstraint<AllRootDataDoc, CurrentCompDoc>, TData extends CustomDataConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc> & Record<InnerFields<CurrentPrefix>, unknown>>, TStore extends CustomStoreConstraint<Required<TRootDoc["properties"]>, Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TEvents extends CustomEventsConstraint<CurrentCompDoc>, TComputed extends CustomComputedConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TMethods extends CustomMethodsConstraint = {}, InheritDoc extends object = IfExtends<CustomInheritConstraint<AllRootDataDoc, CurrentCompDoc>, TInherit, {}, TInherit>, DataDoc extends object = IfExtends<CustomDataConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc> & Record<InnerFields<CurrentPrefix>, unknown>>, TData, {}, TData>, StoreDoc extends object = IfExtends<CustomStoreConstraint<Required<TRootDoc["properties"]>, Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TStore, {}, GetStoreDef<TStore>>, ComputedDoc extends object = IfExtends<CustomComputedConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TComputed, {}, GetCustomComputedDoc<TComputed>>, EventsDoc extends object = IfExtends<CustomEventsConstraint<CurrentCompDoc>, TEvents, {}, TEvents>, MethodsDoc extends object = TMethods, MissingRequiredField extends PropertyKey = Exclude<RequiredKeys<NonNullable<CurrentCompDoc["properties"]>>, keyof (InheritDoc & DataDoc & StoreDoc & IfExtends<CustomComputedConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)>>, TComputed, {}, GetCustomComputedDoc<TComputed>>)>>(options: Options<TRootDoc, IsPage, CurrentCompDoc, CurrentPrefix, AllRootDataDoc, TInherit, TData, TStore, TComputed, TEvents, TMethods, InheritDoc, DataDoc, StoreDoc, ComputedDoc, EventsDoc, MethodsDoc>) => IfExtends<MissingRequiredField, never, CreatCustomComponentDoc<NonNullable<CurrentCompDoc["events"]>, EventsDoc>, `缺少必传的字段${UnionToComma<MissingRequiredField & string>}`>;
|
|
48
48
|
export declare function CustomComponent<TRootComponentDefinition extends RootComponentDefinition, TCompDoc extends ComponentDoc, Prefix extends string = "">(): IfExtends<EmptyObject, TCompDoc, (opt: EmptyObject) => never, CustomComponentConstructor<TRootComponentDefinition, TCompDoc, Prefix>>;
|
|
49
49
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetComputedDef.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Computed/GetComputedDef.ts"],"names":[],"mappings":""}
|
|
@@ -27,32 +27,37 @@ export type BubblesComposedOption = BubblesConfig & ComposedCongifg & NonCapture
|
|
|
27
27
|
export type CaptureComposedOption = CaptureConfig & ComposedCongifg & NonBubblesConfig;
|
|
28
28
|
export type BubblesCaptureComposedOption = BubblesConfig & ComposedCongifg & CaptureConfig;
|
|
29
29
|
export type OptionsFieldsConfigOfCustomEvents = BubblesOption | CaptureOption | BubblesCaptureOption | BubblesComposedOption | CaptureComposedOption | BubblesCaptureComposedOption;
|
|
30
|
-
export type
|
|
30
|
+
export type FullCustomEventsOptions = {
|
|
31
31
|
detail: ShortCustomeEvents;
|
|
32
32
|
options: OptionsFieldsConfigOfCustomEvents;
|
|
33
33
|
debounce?: never;
|
|
34
34
|
throttle?: never;
|
|
35
|
-
}
|
|
35
|
+
};
|
|
36
|
+
export type FullCustomEventsWithDebounce = {
|
|
36
37
|
detail: ShortCustomeEvents;
|
|
37
38
|
options?: never;
|
|
38
39
|
debounce: number;
|
|
39
40
|
throttle?: never;
|
|
40
|
-
}
|
|
41
|
+
};
|
|
42
|
+
export type FullCustomEventsWithThrottle = {
|
|
41
43
|
detail: ShortCustomeEvents;
|
|
42
44
|
options?: never;
|
|
43
45
|
debounce?: never;
|
|
44
46
|
throttle: number;
|
|
45
|
-
}
|
|
47
|
+
};
|
|
48
|
+
export type FullCustomEventsOptionsWithThrottle = {
|
|
46
49
|
detail: ShortCustomeEvents;
|
|
47
50
|
options: OptionsFieldsConfigOfCustomEvents;
|
|
48
51
|
debounce?: never;
|
|
49
52
|
throttle: number;
|
|
50
|
-
}
|
|
53
|
+
};
|
|
54
|
+
export type FullCustomEventsOptionsWithDebounce = {
|
|
51
55
|
detail: ShortCustomeEvents;
|
|
52
56
|
options: OptionsFieldsConfigOfCustomEvents;
|
|
53
57
|
debounce: number;
|
|
54
58
|
throttle?: never;
|
|
55
59
|
};
|
|
60
|
+
export type FullCustomEvents = FullCustomEventsOptions | FullCustomEventsWithDebounce | FullCustomEventsWithThrottle | FullCustomEventsOptionsWithThrottle | FullCustomEventsOptionsWithDebounce;
|
|
56
61
|
export type CustomEvents = FullCustomEvents | ShortCustomeEvents;
|
|
57
62
|
export type CustomEventConstraint = Record<string, CustomEvents>;
|
|
58
63
|
export {};
|
|
@@ -2,10 +2,10 @@ import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
|
2
2
|
import type { BubblesCaptureComposedOption, BubblesCaptureOption, BubblesComposedOption, BubblesOption, CaptureComposedOption, CaptureOption, OptionsFieldsConfigOfCustomEvents } from "./CustomEventConstraint";
|
|
3
3
|
export type Bubbles = () => "bubbles";
|
|
4
4
|
export type Capture = () => "capture";
|
|
5
|
-
export type Composed = () => "
|
|
5
|
+
export type Composed = () => "composed";
|
|
6
6
|
export type BubblesCapture = Bubbles | Capture;
|
|
7
7
|
export type BubblesComposed = Bubbles | Composed;
|
|
8
8
|
export type CaptureComposed = Capture | Composed;
|
|
9
9
|
export type BubblesCaptureComposed = Bubbles | Capture | Composed;
|
|
10
10
|
export type CustomEventsTags = Bubbles | Capture | BubblesCapture | BubblesComposed | CaptureComposed | BubblesCaptureComposed;
|
|
11
|
-
export type
|
|
11
|
+
export type AddTagForCustomEventsDef<Options extends OptionsFieldsConfigOfCustomEvents> = IfExtends<BubblesOption, Options, Bubbles, IfExtends<CaptureOption, Options, Capture, IfExtends<BubblesCaptureOption, Options, BubblesCapture, IfExtends<BubblesComposedOption, Options, BubblesComposed, IfExtends<CaptureComposedOption, Options, CaptureComposed, IfExtends<BubblesCaptureComposedOption, Options, BubblesCaptureComposed>>>>>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
+
import type { DetailedType } from "../../../types/DetailedType";
|
|
3
|
+
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
4
|
+
import type { CustomEventConstraint, FullCustomEvents, ShortCustomeEvents, SimpleCustomeEventsList } from "./CustomEventConstraint";
|
|
5
|
+
import type { AddTagForCustomEventsDef } from "./CustomEventsTag";
|
|
6
|
+
export type GetShortCustomEventsDef<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T> : T extends null ? null : T extends undefined ? undefined : T extends SimpleCustomeEventsList ? GetShortCustomEventsDef<T[number]> : never;
|
|
7
|
+
export type GetFullCustomEventsDef<T extends FullCustomEvents> = GetShortCustomEventsDef<T["detail"]> | IfExtends<unknown, T["options"], never, AddTagForCustomEventsDef<T["options"] & {}>>;
|
|
8
|
+
export type GetCustomEventsDef<T extends CustomEventConstraint> = {
|
|
9
|
+
[k in keyof T]: T[k] extends ShortCustomeEvents ? GetShortCustomEventsDef<T[k]> : T[k] extends FullCustomEvents ? GetShortCustomEventsDef<T[k]["detail"]> | IfExtends<unknown, T[k]["options"], never, AddTagForCustomEventsDef<NonNullable<T[k]["options"]>>> : never;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetCustomEventDef.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/CustomEvents/GetCustomEventDef.ts"],"names":[],"mappings":""}
|
|
@@ -10,8 +10,8 @@ type _AddSuffixForKey<key extends string, Value extends CustomEventsTags> = Valu
|
|
|
10
10
|
type TransformCustomEventsDocTypeToFunctionTypeAndAddSuffix<T extends CustomEventsDoc> = {
|
|
11
11
|
[k in keyof T as _AddSuffixForKey<k & string, Extract<T[k], CustomEventsTags>>]?: (detail: Detail<Exclude<T[k], CustomEventsTags>>) => void;
|
|
12
12
|
};
|
|
13
|
-
type GetAllSubCustomEventsConstraint<
|
|
13
|
+
type GetAllSubCustomEventsConstraint<TComponentDocList extends ComponentDoc[], AllCustomEvents extends CustomEventsDoc = GetBubblesOrCaptureEventsFromCompDoc<TComponentDocList>> = IfExtends<{}, AllCustomEvents, BaseEvent, TransformCustomEventsDocTypeToFunctionTypeAndAddSuffix<AllCustomEvents>>;
|
|
14
14
|
type BaseEvent = Record<string, (e: WMBaseEvent) => unknown>;
|
|
15
15
|
export type EventsConstraint<ComponentDocList extends ComponentDoc[] = []> = IfExtends<[
|
|
16
|
-
], ComponentDocList, BaseEvent, GetAllSubCustomEventsConstraint<ComponentDocList
|
|
16
|
+
], ComponentDocList, BaseEvent, GetAllSubCustomEventsConstraint<ComponentDocList> & BaseEvent>;
|
|
17
17
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { CustomEventsTags } from "../CustomEvents/CustomEventsTag";
|
|
3
|
-
export type
|
|
4
|
-
[k in keyof
|
|
3
|
+
export type generateCustomEventMethods<TCustomEventsDef extends object> = {
|
|
4
|
+
[k in keyof TCustomEventsDef]: IfExtends<Exclude<TCustomEventsDef[k], CustomEventsTags>, undefined, () => void, (detail: Exclude<TCustomEventsDef[k], CustomEventsTags>) => void>;
|
|
5
5
|
};
|
|
@@ -4,17 +4,17 @@ import type { IReactionDisposer } from "mobx";
|
|
|
4
4
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
5
5
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
6
6
|
import type { Assign } from "../../../types/Assign";
|
|
7
|
-
import type { ComputeObject } from "../../../types/
|
|
7
|
+
import type { ComputeObject } from "../../../types/ComputeObject";
|
|
8
8
|
import type { WMComponentInstance, WMInstanceMethods, WMPageInstance } from "../../../types/OfficialTypeAlias";
|
|
9
9
|
import type { OptionsInnerFields } from "../../DefineComponent/normalizeOptions";
|
|
10
10
|
import type { IInjectAllData, IInjectMethods } from "../../InstanceInject/instanceConfig";
|
|
11
|
-
import type {
|
|
11
|
+
import type { generateCustomEventMethods } from "./CustomEventMethods";
|
|
12
12
|
import type { CustomSetData } from "./CustomSetData";
|
|
13
|
-
export type RootComponentInstance<TIsPage extends boolean, TMethods extends object, TDataForSetData extends object, AllData extends object,
|
|
13
|
+
export type RootComponentInstance<TIsPage extends boolean, TMethods extends object, TDataForSetData extends object, AllData extends object, CustomEventsDef extends object, StoreDoc extends object, instanceData = ComputeObject<Assign<IInjectAllData, ComputeIntersection<AllData>>>> = IfExtends<false, TIsPage, WMComponentInstance, WMPageInstance> & Omit<WMInstanceMethods<{}>, "setData"> & CustomSetData<TDataForSetData> & IfExtends<EmptyObject, StoreDoc, unknown, {
|
|
14
14
|
disposer: {
|
|
15
15
|
[k in keyof StoreDoc]: IReactionDisposer;
|
|
16
16
|
};
|
|
17
|
-
}> & Assign<IInjectMethods, TMethods &
|
|
17
|
+
}> & Assign<IInjectMethods, TMethods & generateCustomEventMethods<CustomEventsDef>> & {
|
|
18
18
|
data: instanceData;
|
|
19
19
|
};
|
|
20
20
|
export type ComponentInstance = RootComponentInstance<false, {}, {}, {}, {}, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
3
|
-
import type { ComputeObject } from "../../../types/
|
|
3
|
+
import type { ComputeObject } from "../../../types/ComputeObject";
|
|
4
4
|
import type { WMCompPageLifetimes, WMPageLifetimes } from "../../../types/OfficialTypeAlias";
|
|
5
5
|
import type { RemoveNullOfRequired } from "../../../types/RemoveNullOfRequired";
|
|
6
6
|
export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends object> = IfExtends<TIsPage, false, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
3
3
|
import type { OptionalType } from "./PropertiesConstraint";
|
|
4
|
-
export type
|
|
4
|
+
export type GetOptionalDef<TOptionalProperties extends Record<string, OptionalType>> = {
|
|
5
5
|
-readonly [k in keyof TOptionalProperties]?: IfExtends<unknown, TOptionalProperties[k]["optionalTypes"], InferDetailedType<TOptionalProperties[k]["type"]>, InferDetailedType<TOptionalProperties[k]["type"]> | InferDetailedType<(TOptionalProperties[k]["optionalTypes"] & {})[number]>>;
|
|
6
6
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetOptionalDef.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Properties/GetOptionalDef.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Select } from "hry-types/src/Object/Select";
|
|
2
|
+
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
3
|
+
import type { GetOptionalDef } from "./GetOptionalDef";
|
|
4
|
+
import type { GetRequiredDef } from "./GetRequiredDef";
|
|
5
|
+
import type { OptionalType, PropertiesConstraint } from "./PropertiesConstraint";
|
|
6
|
+
type _GetPropertiesDef<TProperties extends PropertiesConstraint, OptionalDef extends object = GetOptionalDef<Select<TProperties, OptionalType>>, RequiredDef extends object = GetRequiredDef<Omit<TProperties, keyof OptionalDef>>> = ComputeIntersection<OptionalDef & RequiredDef>;
|
|
7
|
+
export type GetPropertiesDef<TProperties extends PropertiesConstraint> = _GetPropertiesDef<TProperties>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetPropertiesDef.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Properties/GetPropertiesDef.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
2
|
+
import type { RequiredSingle, RequiredType, RequiredUnion } from "./PropertiesConstraint";
|
|
3
|
+
export type GetRequiredDef<TProperties extends Record<string, RequiredType>> = {
|
|
4
|
+
-readonly [k in keyof TProperties]: TProperties[k] extends RequiredSingle ? InferDetailedType<TProperties[k]> : TProperties[k] extends RequiredUnion ? InferDetailedType<TProperties[k]["type"]> | InferDetailedType<TProperties[k]["optionalTypes"][number]> : never;
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetRequiredDef.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Properties/GetRequiredDef.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Getter } from "./StoreConstraint";
|
|
2
|
-
export type
|
|
2
|
+
export type GetStoreDef<TStore extends object> = {
|
|
3
3
|
[k in keyof TStore]: TStore[k] extends Getter ? ReturnType<TStore[k]> : TStore[k] extends {
|
|
4
4
|
getter: (...args: unknown[]) => infer R;
|
|
5
5
|
default: infer D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetStoreDef.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Store/GetStoreDef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAiCrD,SAAS,EAAkB,CAAC"}
|
|
@@ -2,17 +2,17 @@ import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
|
2
2
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
3
3
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
5
|
-
import type { ComputeObject } from "../../types/
|
|
5
|
+
import type { ComputeObject } from "../../types/ComputeObject";
|
|
6
6
|
import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
|
|
7
7
|
import type { RemoveNullOfRequired } from "../../types/RemoveNullOfRequired";
|
|
8
8
|
import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
|
|
9
9
|
import type { IInjectStore } from "../InstanceInject/instanceConfig";
|
|
10
10
|
import type { ComputedConstraint } from "./Computed/ComputedConstraint";
|
|
11
11
|
import type { ComputedOption } from "./Computed/ComputedOption";
|
|
12
|
-
import type {
|
|
12
|
+
import type { GetComputedDef } from "./Computed/GetComputedDef";
|
|
13
13
|
import type { CustomEventConstraint } from "./CustomEvents/CustomEventConstraint";
|
|
14
14
|
import type { CustomEventsOption } from "./CustomEvents/CustomEventsOption";
|
|
15
|
-
import type {
|
|
15
|
+
import type { GetCustomEventsDef } from "./CustomEvents/GetCustomEventDef";
|
|
16
16
|
import type { DataOption } from "./Data/DataOption";
|
|
17
17
|
import type { EventsConstraint } from "./Events/EventsConstraint";
|
|
18
18
|
import type { EventsOption } from "./Events/EventsOption";
|
|
@@ -23,30 +23,30 @@ import type { MethodsConstraint } from "./Methods/MethodsConstraint";
|
|
|
23
23
|
import type { MethodsOption } from "./Methods/MethodsOption";
|
|
24
24
|
import type { ObserversOption } from "./Observers/ObserversOption";
|
|
25
25
|
import type { PageLifetimesOption } from "./PageLifetimes/PageLifetimesOption";
|
|
26
|
-
import type {
|
|
26
|
+
import type { GetPropertiesDef } from "./Properties/GetPropertiesDef";
|
|
27
27
|
import type { PropertiesConstraint } from "./Properties/PropertiesConstraint";
|
|
28
28
|
import type { PropertiesOption } from "./Properties/PropertiesOption";
|
|
29
|
-
import type {
|
|
29
|
+
import type { GetStoreDef } from "./Store/GetStoreDef";
|
|
30
30
|
import type { StoreConstraint } from "./Store/StoreConstraint";
|
|
31
31
|
import type { StoreOption } from "./Store/StoreOption";
|
|
32
32
|
import type { WatchOption } from "./Watch/WatchOption";
|
|
33
|
-
type RootComponentOptions<TEvents extends object, TIsPage extends boolean, TCustomEvents extends CustomEventConstraint, TMethods extends MethodsConstraint, TProperties extends PropertiesConstraint, TData extends object, TStore extends StoreConstraint, TComputed extends Record<string, Func>,
|
|
34
|
-
type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <TEvents extends EventsConstraint<TComponentDocList>, TStore extends StoreConstraint<
|
|
33
|
+
type RootComponentOptions<TEvents extends object, TIsPage extends boolean, TCustomEvents extends CustomEventConstraint, TMethods extends MethodsConstraint, TProperties extends PropertiesConstraint, TData extends object, TStore extends StoreConstraint, TComputed extends Record<string, Func>, EventsDef extends object, CustomEventsDef extends object, PropertiesDef extends object, DataDef extends object, StoreDef extends object, ComputedDef extends object> = MethodsOption<TMethods, keyof (EventsDef & CustomEventsDef)> & PropertiesOption<TProperties> & IsPageOption<TIsPage> & EventsOption<TEvents> & IfExtends<TIsPage, false, CustomEventsOption<TCustomEvents, keyof EventsDef>, {}> & DataOption<TData, keyof PropertiesDef> & StoreOption<TStore, keyof (PropertiesDef & DataDef)> & ComputedOption<TComputed, keyof (PropertiesDef & DataDef & StoreDef)> & PageLifetimesOption<TIsPage, PropertiesDef> & LifetimesOption & WatchOption<ComputedDef & Required<PropertiesDef> & DataDef & StoreDef & IInjectStore> & Partial<Omit<WMCompOtherOption, "pageLifetimes" | "definitionFilter" | "observers">> & ObserversOption<ComputedDef & Required<PropertiesDef> & DataDef & StoreDef & IInjectStore> & ThisType<RootComponentInstance<TIsPage, TMethods, DataDef, DataDef & Required<PropertiesDef> & StoreDef & ComputedDef, CustomEventsDef, StoreDef>>;
|
|
34
|
+
type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <TEvents extends EventsConstraint<TComponentDocList>, TStore extends StoreConstraint<PropertiesDef>, TIsPage extends boolean = false, const TProperties extends PropertiesConstraint = {}, TData extends object = {}, TComputed extends ComputedConstraint = {}, TCustomEvents extends IfExtends<TIsPage, false, CustomEventConstraint, EmptyObject> = {}, TMethods extends MethodsConstraint = {}, EventsDef extends object = IfExtends<EventsConstraint<TComponentDocList>, TEvents, {}, TEvents>, CustomEventsDef extends object = GetCustomEventsDef<TCustomEvents>, PropertiesDef extends object = GetPropertiesDef<TProperties>, DataDef extends object = TData, StoreDef extends object = StoreConstraint<PropertiesDef> extends TStore ? {} : GetStoreDef<TStore>, ComputedDef extends object = GetComputedDef<TComputed>>(options: RootComponentOptions<TEvents, TIsPage, TCustomEvents, TMethods, TProperties, TData, TStore, TComputed, EventsDef, CustomEventsDef, PropertiesDef, DataDef, StoreDef, ComputedDef>) => ComputeIntersection<IfExtends<TIsPage, false, {}, {
|
|
35
35
|
isPage: true;
|
|
36
|
-
}> & IfExtends<EmptyObject,
|
|
37
|
-
properties: IfExtends<false, TIsPage,
|
|
38
|
-
}> & IfExtends<EmptyObject,
|
|
39
|
-
data:
|
|
40
|
-
}> & IfExtends<EmptyObject,
|
|
41
|
-
store: ComputeObject<
|
|
42
|
-
}> & IfExtends<EmptyObject,
|
|
43
|
-
computed:
|
|
36
|
+
}> & IfExtends<EmptyObject, PropertiesDef, {}, {
|
|
37
|
+
properties: IfExtends<false, TIsPage, PropertiesDef, RemoveNullOfRequired<PropertiesDef>>;
|
|
38
|
+
}> & IfExtends<EmptyObject, DataDef, {}, {
|
|
39
|
+
data: DataDef;
|
|
40
|
+
}> & IfExtends<EmptyObject, StoreDef, {}, {
|
|
41
|
+
store: ComputeObject<StoreDef>;
|
|
42
|
+
}> & IfExtends<EmptyObject, ComputedDef, {}, {
|
|
43
|
+
computed: ComputedDef;
|
|
44
44
|
}> & IfExtends<EmptyObject, TMethods, {}, {
|
|
45
45
|
methods: TMethods;
|
|
46
|
-
}> & IfExtends<EmptyObject,
|
|
47
|
-
events:
|
|
48
|
-
}> & IfExtends<EmptyObject,
|
|
49
|
-
customEvents: ComputeObject<
|
|
46
|
+
}> & IfExtends<EmptyObject, EventsDef, {}, {
|
|
47
|
+
events: EventsDef;
|
|
48
|
+
}> & IfExtends<EmptyObject, CustomEventsDef, {}, {
|
|
49
|
+
customEvents: ComputeObject<CustomEventsDef>;
|
|
50
50
|
}>>;
|
|
51
51
|
export declare function RootComponent<TComponentDocList extends ComponentDoc[] = []>(): RootComponentConstructor<TComponentDocList>;
|
|
52
52
|
export {};
|
package/dist/api/wxSugar.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IfEquals } from "hry-types/src/Any/IfEquals";
|
|
2
2
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
3
3
|
import type { NoInfer } from "hry-types/src/Generic/NoInfer";
|
|
4
|
-
import type { ComputeObject } from "../types/
|
|
4
|
+
import type { ComputeObject } from "../types/ComputeObject";
|
|
5
5
|
import type { WMNavigateToOption } from "../types/OfficialTypeAlias";
|
|
6
6
|
import type { RequiredKeys } from "../types/RequiredKeys";
|
|
7
7
|
import type { PageDoc } from "./DefineComponent/returnType/PageDoc";
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,8 @@ import { navigateBack, navigateTo, redirectTo } from "./api/wxSugar";
|
|
|
7
7
|
import type { CreateComponentType } from "./types/CreateComponentType";
|
|
8
8
|
import type { DetailedType } from "./types/DetailedType";
|
|
9
9
|
import type { ExtendComponentType } from "./types/ExtendComponentType";
|
|
10
|
-
import type { ParamsEqual } from "./types/TwoParamsEqual";
|
|
11
10
|
export * from "./utils/_utils";
|
|
12
11
|
export type { Bubbles, BubblesCapture, BubblesCaptureComposed, BubblesComposed, Capture, CaptureComposed, Composed, CustomEventsTags, } from "./api/RootComponent/CustomEvents/CustomEventsTag";
|
|
13
12
|
export type { Vant, Wm } from "./thirdLib";
|
|
14
13
|
export type { CurrentTargetDataset, Dataset, Detail, Mark, TargetDataset, WMBaseEvent, WMCustomEvent, } from "./types/OfficialTypeAlias";
|
|
15
|
-
export { ChunkComponent, type CreateComponentType, CustomComponent, DefineComponent, type DetailedType, type ExtendComponentType, type IInjectInfo, instanceConfig, navigateBack, navigateTo,
|
|
14
|
+
export { ChunkComponent, type CreateComponentType, CustomComponent, DefineComponent, type DetailedType, type ExtendComponentType, type IInjectInfo, instanceConfig, navigateBack, navigateTo, redirectTo, RootComponent, };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAoB,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKrE,cAAc,gBAAgB,CAAC;AAwB/B,OAAO,EACL,cAAc,EAEd,eAAe,EACf,eAAe,EAIf,cAAc,EACd,YAAY,EACZ,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAoB,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKrE,cAAc,gBAAgB,CAAC;AAwB/B,OAAO,EACL,cAAc,EAEd,eAAe,EACf,eAAe,EAIf,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComputeObject.js","sourceRoot":"","sources":["../../src/types/ComputeObject.ts"],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Equals } from "hry-types/src/Any/Equals";
|
|
2
|
-
export declare function typeEqual<A, B extends Equals<A, B> extends true ? unknown : never>(): void;
|
|
2
|
+
export declare function typeEqual<const A, const B extends Equals<A, B> extends true ? unknown : never = never>(a?: NoInfer<A>): void;
|
package/dist/utils/typeEqual.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeEqual.js","sourceRoot":"","sources":["../../src/utils/typeEqual.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeEqual.js","sourceRoot":"","sources":["../../src/utils/typeEqual.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,SAAS,CAGvB,CAAc;IACd,KAAK,CAAC,CAAC;AACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Checking } from "hry-types";
|
|
2
|
-
import type { ComputeObject } from "../../../../types/
|
|
2
|
+
import type { ComputeObject } from "../../../../types/ComputeObject";
|
|
3
3
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
4
4
|
import { ChunkComponent } from "../..";
|
|
5
5
|
import type { Mock_RootDoc } from "./mock";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/_api";
|
|
2
2
|
import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
|
|
3
3
|
import type { IInjectAllData, IInjectMethods, IInjectStore } from "../InstanceInject/instanceConfig";
|
|
4
|
-
import type {
|
|
4
|
+
import type { GetComputedDef } from "../RootComponent/Computed/GetComputedDef";
|
|
5
5
|
import type { RootComponentInstance } from "../RootComponent/Instance/RootComponentInstance";
|
|
6
6
|
import type { LifetimesOption } from "../RootComponent/Lifetimes/LifetimesOption";
|
|
7
7
|
import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
|
|
8
8
|
import type { ObserversOption } from "../RootComponent/Observers/ObserversOption";
|
|
9
9
|
import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
|
|
10
10
|
import type { RootComponentDefinition } from "../RootComponent/returnType";
|
|
11
|
-
import type {
|
|
11
|
+
import type { GetStoreDef } from "../RootComponent/Store/GetStoreDef";
|
|
12
12
|
import type { WatchOption } from "../RootComponent/Watch/WatchOption";
|
|
13
13
|
import type { ChunkComputedConstraint } from "./ChunkComputed/ChunkComputedConstraint";
|
|
14
14
|
import type { ChunkComputedOption } from "./ChunkComputed/ChunkComputedOption";
|
|
@@ -99,9 +99,9 @@ type ChunkComponentConstructor<
|
|
|
99
99
|
TMethods extends MethodsConstraint = {},
|
|
100
100
|
TData extends object = {},
|
|
101
101
|
StoreDoc extends object = ChunkStoreConstraint<Required<TRootComponentReturnType["properties"]>> extends TStore ? {}
|
|
102
|
-
:
|
|
102
|
+
: GetStoreDef<TStore>,
|
|
103
103
|
TComputed extends ChunkComputedConstraint = {},
|
|
104
|
-
ComputedDoc extends object =
|
|
104
|
+
ComputedDoc extends object = GetComputedDef<TComputed>,
|
|
105
105
|
EventsDoc extends object = IfExtends<ChunkEventsConstraint, TEvents, {}, TEvents>,
|
|
106
106
|
PropertiesDoc extends object = NonNullable<TRootComponentReturnType["properties"]>,
|
|
107
107
|
>(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
3
3
|
import type { ComputeIntersection, Select } from "hry-types/src/Object/_api";
|
|
4
|
-
import type { ComputeObject } from "../../../types/
|
|
4
|
+
import type { ComputeObject } from "../../../types/ComputeObject";
|
|
5
5
|
import type { RemovePrefix } from "../../../types/RemovePrefix";
|
|
6
6
|
import type { Composed } from "../../RootComponent/CustomEvents/CustomEventsTag";
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ import type { UnionToComma } from "../../types/UnionToComma.test";
|
|
|
11
11
|
import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
|
|
12
12
|
import type { IInjectStore } from "../InstanceInject/instanceConfig";
|
|
13
13
|
import type { RootComponentDefinition } from "../RootComponent/returnType";
|
|
14
|
-
import type {
|
|
14
|
+
import type { GetStoreDef } from "../RootComponent/Store/GetStoreDef";
|
|
15
15
|
import type { CustomComputedConstraint } from "./CustomComputed/CustomComputedConstraint";
|
|
16
16
|
import type { CustomComputedOption } from "./CustomComputed/CustomComputedOption";
|
|
17
17
|
import type { GetCustomComputedDoc } from "./CustomComputed/GetCustomComputedDoc";
|
|
@@ -224,7 +224,7 @@ type CustomComponentConstructor<
|
|
|
224
224
|
>,
|
|
225
225
|
TStore,
|
|
226
226
|
{},
|
|
227
|
-
|
|
227
|
+
GetStoreDef<TStore>
|
|
228
228
|
>,
|
|
229
229
|
// 无效的计算
|
|
230
230
|
ComputedDoc extends object = IfExtends<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { typeEqual } from "../../../../utils/typeEqual";
|
|
2
2
|
import type { CustomComponentDefinition } from "../../../CustomComponent/returnType";
|
|
3
3
|
import type { Bubbles, Composed } from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
4
4
|
import { DefineComponent } from "../..";
|
|
@@ -1039,11 +1039,11 @@ const aaa = DefineComponent({
|
|
|
1039
1039
|
A,
|
|
1040
1040
|
],
|
|
1041
1041
|
});
|
|
1042
|
-
|
|
1043
|
-
void Checking<typeof aaa, {
|
|
1042
|
+
type Epected = {
|
|
1044
1043
|
events: {
|
|
1045
1044
|
test_a: string | number | boolean | Composed;
|
|
1046
1045
|
test_b: string | number | Composed;
|
|
1047
1046
|
test_c: boolean | Composed;
|
|
1048
1047
|
};
|
|
1049
|
-
}
|
|
1048
|
+
};
|
|
1049
|
+
typeEqual<Epected>(aaa);
|
|
@@ -27,7 +27,7 @@ type Constructor = <
|
|
|
27
27
|
TPath extends Path = "/",
|
|
28
28
|
>(
|
|
29
29
|
options: Options<TRootComponentDefinition, TCustomComponentDefinitionList, TName, TPath>,
|
|
30
|
-
) => // 根据是否传入name
|
|
30
|
+
) => // 根据是否传入name字段(当isPage不为true时,类型约束name不为空字符串)来区分生成页面文档还是组件文档。
|
|
31
31
|
IfExtends<
|
|
32
32
|
"",
|
|
33
33
|
TName,
|
|
@@ -45,14 +45,14 @@ export type DefineComponentOptionRuntime = {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* DefineComponent是构建组件的核心API
|
|
49
|
-
* 它返回的类型可能是页面文档(`PageDoc`)或者自定义组件文档(`ComponentDoc`)
|
|
48
|
+
* DefineComponent是构建组件的核心API,所有组件(页面组件和自定义组件)都通过它来构建的。
|
|
49
|
+
* 它返回的类型可能是页面文档(`PageDoc`)或者自定义组件文档(`ComponentDoc`),具体取决于传入rootComponent中isPage的值。
|
|
50
50
|
* 它的作用是把根组件定义(`RootComponentDefinition`)和子组件定义(`CustomComponentDefinition`和`ChunkComponentDefinition`)整合成原生`Component`的选项配置,最终通过原生`Component`来构建组件。
|
|
51
51
|
*/
|
|
52
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- 返回类型由Constructor定义,实现无需。
|
|
53
53
|
export const DefineComponent: Constructor = function(options): any {
|
|
54
54
|
Component(
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Options泛型中properties字段类型与WechatMiniprogram.Component.Constructor中的properties字段类型不兼容,但运行时是兼容的,所以这里使用any
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Options泛型中properties字段类型与WechatMiniprogram.Component.Constructor中的properties字段类型不兼容,但运行时是兼容的,所以这里使用any。
|
|
56
56
|
normalizeOptions(options as DefineComponentOptionRuntime) as any,
|
|
57
57
|
);
|
|
58
58
|
};
|