annil 1.15.1 → 1.16.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.
- package/CHANGELOG.md +7 -0
- package/README.md +0 -2
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +3 -3
- package/dist/api/DefineComponent/index.d.ts +4 -4
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.d.ts +2 -3
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.d.ts +2 -2
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/initComputed/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.d.ts +2 -2
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +3 -3
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js.map +1 -1
- package/dist/api/DefineComponent/returnType/GenerateComponentDoc.d.ts +2 -2
- package/dist/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.d.ts +3 -3
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +1 -3
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.d.ts +3 -0
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js +2 -0
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js.map +1 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.d.ts +3 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js +2 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomComputed/CustomComputedOption.d.ts → SubComponent/SubComputed/SubComputedOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js +2 -0
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js.map +1 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.d.ts +3 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.js +2 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomData/CustomDataOption.d.ts → SubComponent/SubData/SubDataOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubData/SubDataOption.js +2 -0
- package/dist/api/SubComponent/SubData/SubDataOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomEvents/CustomEventsConstraint.d.ts → SubComponent/SubEvents/SubEventsConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js +2 -0
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomEvents/CustomEventsOption.d.ts → SubComponent/SubEvents/SubEventsOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js +2 -0
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomInherit/CustomInheritConstraint.d.ts → SubComponent/SubInherit/SubInheritConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js +2 -0
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomInherit/CustomInheritOption.d.ts → SubComponent/SubInherit/SubInheritOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js +2 -0
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js.map +1 -0
- package/dist/api/SubComponent/SubInstance/SubInstance.d.ts +2 -0
- package/dist/api/SubComponent/SubInstance/SubInstance.js.map +1 -0
- package/dist/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.d.ts +1 -1
- package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js.map +1 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.d.ts +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js.map +1 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.d.ts +5 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js.map +1 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.d.ts +2 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js +2 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js.map +1 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.d.ts +2 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js +2 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomReturnType/CreateCustomComponentDoc.d.ts → SubComponent/SubReturnType/CreateSubComponentDoc.d.ts} +1 -1
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js +2 -0
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js.map +1 -0
- package/dist/api/{CustomComponent/CustomStore/CustomStoreConstraint.d.ts → SubComponent/SubStore/SubStoreConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js +2 -0
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomStore/CustomStoreOption.d.ts → SubComponent/SubStore/SubStoreOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubStore/SubStoreOption.js +2 -0
- package/dist/api/SubComponent/SubStore/SubStoreOption.js.map +1 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.d.ts +2 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js +2 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js.map +1 -0
- package/dist/api/SubComponent/index.d.ts +49 -0
- package/dist/api/SubComponent/index.js +4 -0
- package/dist/api/SubComponent/index.js.map +1 -0
- package/dist/api/{CustomComponent → SubComponent}/returnType.d.ts +3 -3
- package/dist/api/SubComponent/returnType.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +3 -4
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +3 -3
- package/src/api/DefineComponent/index.ts +8 -8
- package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +2 -3
- package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/initComputed/index.ts +0 -9
- package/src/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +6 -3
- package/src/api/DefineComponent/returnType/GenerateComponentDoc.ts +2 -2
- package/src/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.ts +4 -4
- package/src/api/DefineComponent/returnType/test/normalComponentDoc.test.ts +6 -6
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +1 -1
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +1 -4
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +3 -31
- package/src/api/{CustomComponent/CustomComputed/GetCustomComputedDoc.ts → SubComponent/SubComputed/GetSubComputedDoc.ts} +1 -1
- package/src/api/SubComponent/SubComputed/SubComputedConstraint.ts +1 -0
- package/src/api/{CustomComponent/CustomComputed/CustomComputedOption.ts → SubComponent/SubComputed/SubComputedOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/error.test.ts +7 -7
- package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/normal.test.ts +9 -9
- package/src/api/{CustomComponent/CustomData/CustomDataConstraint.ts → SubComponent/SubData/SubDataConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomData/CustomDataOption.ts → SubComponent/SubData/SubDataOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomData → SubComponent/SubData}/test/error.test.ts +5 -5
- package/src/api/{CustomComponent/CustomData → SubComponent/SubData}/test/normal.test.ts +6 -6
- package/src/api/{CustomComponent/CustomEvents/CustomEventsConstraint.ts → SubComponent/SubEvents/SubEventsConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomEvents/CustomEventsOption.ts → SubComponent/SubEvents/SubEventsOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomEvents → SubComponent/SubEvents}/test/error.test.ts +3 -3
- package/src/api/{CustomComponent/CustomEvents → SubComponent/SubEvents}/test/normal.test.ts +10 -10
- package/src/api/{CustomComponent/CustomInherit/CustomInheritConstraint.ts → SubComponent/SubInherit/SubInheritConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomInherit/CustomInheritOption.ts → SubComponent/SubInherit/SubInheritOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/error.test.ts +7 -7
- package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/normal.test.ts +5 -5
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/SubInstance.ts +1 -1
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/error.test.ts +2 -2
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/normal.test.ts +2 -2
- package/src/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.ts +1 -1
- package/src/api/SubComponent/SubMethods/SubMethodsConstraint.ts +3 -0
- package/src/api/{CustomComponent/CustomMethods/CustomMethodsOption.ts → SubComponent/SubMethods/SubMethodsOption.ts} +3 -3
- package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/error.test.ts +3 -3
- package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/normarl.test.ts +3 -3
- package/src/api/SubComponent/SubObservers/SubObserversOption.ts +3 -0
- package/src/api/{CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.ts → SubComponent/SubPageLifetimes/SubPageLifetimesOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomReturnType/CreateCustomComponentDoc.ts → SubComponent/SubReturnType/CreateSubComponentDoc.ts} +1 -1
- package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/error.test.ts +2 -2
- package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/normal.test.ts +4 -4
- package/src/api/{CustomComponent/CustomStore/CustomStoreConstraint.ts → SubComponent/SubStore/SubStoreConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomStore/CustomStoreOption.ts → SubComponent/SubStore/SubStoreOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/error.test.ts +4 -4
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/normal.test.ts +5 -5
- package/src/api/SubComponent/SubWatch/SubWatchOption.ts +3 -0
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchComputed.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchProperties.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchRootData.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchSubData.test.ts +3 -3
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WtachInject.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/error.test.ts +5 -5
- package/src/api/{CustomComponent → SubComponent}/index.ts +49 -49
- package/src/api/{CustomComponent → SubComponent}/returnType.ts +6 -6
- package/src/index.ts +2 -4
- package/src/thirdLib/wm/swiper.test.ts +2 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.d.ts +0 -1
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.d.ts +0 -9
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js +0 -2
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.d.ts +0 -12
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js.map +0 -1
- package/dist/api/ChunkComponent/SlotComponentReturnType.d.ts +0 -20
- package/dist/api/ChunkComponent/SlotComponentReturnType.js +0 -2
- package/dist/api/ChunkComponent/SlotComponentReturnType.js.map +0 -1
- package/dist/api/ChunkComponent/index.d.ts +0 -24
- package/dist/api/ChunkComponent/index.js +0 -4
- package/dist/api/ChunkComponent/index.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.d.ts +0 -3
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.d.ts +0 -3
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js.map +0 -1
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.d.ts +0 -3
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js +0 -2
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js +0 -2
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js +0 -2
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomInstance/SubInstance.d.ts +0 -2
- package/dist/api/CustomComponent/CustomInstance/SubInstance.js.map +0 -1
- package/dist/api/CustomComponent/CustomLifetimes/SubLifetimesOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.d.ts +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.d.ts +0 -5
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js +0 -2
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js +0 -2
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js +0 -2
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js.map +0 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js +0 -2
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js +0 -2
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js.map +0 -1
- package/dist/api/CustomComponent/index.d.ts +0 -49
- package/dist/api/CustomComponent/index.js +0 -4
- package/dist/api/CustomComponent/index.js.map +0 -1
- package/dist/api/CustomComponent/returnType.js.map +0 -1
- package/src/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.ts +0 -1
- package/src/api/ChunkComponent/ChunkComputed/ChunkComputedOption.ts +0 -46
- package/src/api/ChunkComponent/ChunkComputed/GetChunkComputedDoc.ts +0 -9
- package/src/api/ChunkComponent/ChunkComputed/test/SlotGetComputedDoc.test.ts +0 -25
- package/src/api/ChunkComponent/ChunkComputed/test/error.test.ts +0 -33
- package/src/api/ChunkComponent/ChunkComputed/test/mock.ts +0 -37
- package/src/api/ChunkComponent/ChunkComputed/test/normal.test.ts +0 -86
- package/src/api/ChunkComponent/ChunkData/chunkDataConstraint.ts +0 -9
- package/src/api/ChunkComponent/ChunkData/chunkDataOption.ts +0 -17
- package/src/api/ChunkComponent/ChunkData/test/error.test.ts +0 -28
- package/src/api/ChunkComponent/ChunkData/test/mock.ts +0 -44
- package/src/api/ChunkComponent/ChunkData/test/normal.test.ts +0 -18
- package/src/api/ChunkComponent/ChunkData/validatePrefix.ts +0 -4
- package/src/api/ChunkComponent/ChunkLifetimes/ChunkLifetimes.test.ts +0 -24
- package/src/api/ChunkComponent/ChunkLifetimes/ChunkPageLifetimes.test.ts +0 -26
- package/src/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.ts +0 -27
- package/src/api/ChunkComponent/ChunkMethods/test/error.test.ts +0 -31
- package/src/api/ChunkComponent/ChunkMethods/test/normal.test.ts +0 -21
- package/src/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.ts +0 -3
- package/src/api/ChunkComponent/ChunkStore/ChunkStoreOption.ts +0 -33
- package/src/api/ChunkComponent/ChunkStore/test/error.test.ts +0 -36
- package/src/api/ChunkComponent/ChunkStore/test/mock.ts +0 -32
- package/src/api/ChunkComponent/ChunkStore/test/normal.test.ts +0 -52
- package/src/api/ChunkComponent/ChunkWatch/test/error.test.ts +0 -28
- package/src/api/ChunkComponent/ChunkWatch/test/normal.test.ts +0 -58
- package/src/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.ts +0 -3
- package/src/api/ChunkComponent/ChunklEvents/ChunkEventsOption.ts +0 -27
- package/src/api/ChunkComponent/ChunklEvents/test/error.test.ts +0 -24
- package/src/api/ChunkComponent/ChunklEvents/test/normal.test.ts +0 -26
- package/src/api/ChunkComponent/SlotComponentReturnType.ts +0 -32
- package/src/api/ChunkComponent/index.ts +0 -165
- package/src/api/CustomComponent/CustomComputed/CustomComputedConstraint.ts +0 -1
- package/src/api/CustomComponent/CustomMethods/CustomMethodsConstraint.ts +0 -3
- package/src/api/CustomComponent/CustomObservers/CustomObserversOption.ts +0 -3
- package/src/api/CustomComponent/CustomWatch/CustomWatchOption.ts +0 -3
- /package/dist/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/SubInstance.js +0 -0
- /package/dist/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.js +0 -0
- /package/dist/api/{CustomComponent → SubComponent}/returnType.js +0 -0
- /package/src/api/{CustomComponent/CustomPageLifetimes → SubComponent/SubPageLifetimes}/test/error.test.ts +0 -0
- /package/src/api/{CustomComponent/CustomPageLifetimes → SubComponent/SubPageLifetimes}/test/normal.test.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ChunkComponent } from "./api/ChunkComponent";
|
|
2
|
-
import { CustomComponent } from "./api/CustomComponent";
|
|
3
1
|
import { DefineComponent } from "./api/DefineComponent";
|
|
4
2
|
import { type IInjectInfo, instanceConfig } from "./api/InstanceInject/instanceConfig";
|
|
5
3
|
import { RootComponent } from "./api/RootComponent";
|
|
4
|
+
import { SubComponent } from "./api/SubComponent";
|
|
6
5
|
import { navigateBack, navigateTo, redirectTo } from "./api/wxSugar";
|
|
7
6
|
import type { CreateComponentType } from "./types/CreateComponentType";
|
|
8
7
|
import type { DetailedType } from "./types/DetailedType";
|
|
@@ -11,4 +10,4 @@ export * from "./utils/_utils";
|
|
|
11
10
|
export type { Bubbles, BubblesCapture, BubblesCaptureComposed, BubblesComposed, Capture, CaptureComposed, Composed, CustomEventsTags, } from "./api/RootComponent/CustomEvents/CustomEventsTag";
|
|
12
11
|
export type { Vant, Wm } from "./thirdLib";
|
|
13
12
|
export type { CurrentTargetDataset, Dataset, Detail, Mark, TargetDataset, WMBaseEvent, WMCustomEvent, } from "./types/OfficialTypeAlias";
|
|
14
|
-
export {
|
|
13
|
+
export { type CreateComponentType, DefineComponent, type DetailedType, type ExtendComponentType, type IInjectInfo, instanceConfig, navigateBack, navigateTo, redirectTo, RootComponent, SubComponent, };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ChunkComponent } from "./api/ChunkComponent";
|
|
2
|
-
import { CustomComponent } from "./api/CustomComponent";
|
|
3
1
|
import { DefineComponent } from "./api/DefineComponent";
|
|
4
2
|
import { instanceConfig } from "./api/InstanceInject/instanceConfig";
|
|
5
3
|
import { RootComponent } from "./api/RootComponent";
|
|
4
|
+
import { SubComponent } from "./api/SubComponent";
|
|
6
5
|
import { navigateBack, navigateTo, redirectTo } from "./api/wxSugar";
|
|
7
6
|
export * from "./utils/_utils";
|
|
8
|
-
export {
|
|
7
|
+
export { DefineComponent, instanceConfig, navigateBack, navigateTo, redirectTo, RootComponent, SubComponent, };
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKrE,cAAc,gBAAgB,CAAC;AAwB/B,OAAO,EAEL,eAAe,EAIf,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,GACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SubComponentDefinition } from "../../SubComponent/returnType";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* RootComponent API 的`subComponents`字段配置
|
|
5
|
-
* 实际子组件包括CustomComponent和ChunkComponent,但ChunkComponent的返回类型为never,所以这里只用CustomComponentReturnType来约束子组件类型。
|
|
6
5
|
*/
|
|
7
6
|
export type SubComponentsOption<
|
|
8
|
-
|
|
7
|
+
TSubComponentReturnTypeList extends SubComponentDefinition[],
|
|
9
8
|
> = {
|
|
10
9
|
/**
|
|
11
10
|
* 子组件列表
|
|
12
11
|
*/
|
|
13
|
-
subComponents?: [...
|
|
12
|
+
subComponents?: [...TSubComponentReturnTypeList];
|
|
14
13
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { typeEqual } from "../../../../utils/typeEqual";
|
|
2
|
-
import type { CustomComponentDefinition } from "../../../CustomComponent/returnType";
|
|
3
2
|
import type { Bubbles, Composed } from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
3
|
+
import type { SubComponentDefinition } from "../../../SubComponent/returnType";
|
|
4
4
|
import { DefineComponent } from "../..";
|
|
5
5
|
|
|
6
|
-
const SubDocIsAny = {} as
|
|
6
|
+
const SubDocIsAny = {} as SubComponentDefinition<{
|
|
7
7
|
composedEvents: {
|
|
8
8
|
a: number | Composed;
|
|
9
9
|
};
|
|
10
10
|
}>;
|
|
11
11
|
|
|
12
|
-
const NonEmptyRootDoc = {} as
|
|
12
|
+
const NonEmptyRootDoc = {} as SubComponentDefinition<{
|
|
13
13
|
composedEvents: {
|
|
14
14
|
a: string | Bubbles | Composed;
|
|
15
15
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
|
|
3
|
-
import type { CustomComponentDefinition, CustomComponentDefinitionRuntime } from "../CustomComponent/returnType";
|
|
4
3
|
import type { RootComponentDefinition, RootComponentDefinitionRuntime } from "../RootComponent/returnType";
|
|
4
|
+
import type { SubComponentDefinition, SubComponentDefinitionRuntime } from "../SubComponent/returnType";
|
|
5
5
|
import type { NameOrPathOption } from "./NameOrPath/NameOrPathOption";
|
|
6
6
|
import { normalizeOptions } from "./normalizeOptions";
|
|
7
7
|
import type { GenerateComponentDoc } from "./returnType/GenerateComponentDoc";
|
|
@@ -12,27 +12,27 @@ export type Path = `/${string}`;
|
|
|
12
12
|
|
|
13
13
|
type Options<
|
|
14
14
|
TRootComponentDefinition extends RootComponentDefinition,
|
|
15
|
-
|
|
15
|
+
TSubComponentDefinitionList extends SubComponentDefinition[],
|
|
16
16
|
TName extends string,
|
|
17
17
|
TPath extends Path,
|
|
18
18
|
> =
|
|
19
19
|
& NameOrPathOption<TName, TPath, NonNullable<TRootComponentDefinition["isPage"]>>
|
|
20
20
|
& RootComponentOption<TRootComponentDefinition>
|
|
21
|
-
& SubComponentsOption<
|
|
21
|
+
& SubComponentsOption<TSubComponentDefinitionList>;
|
|
22
22
|
|
|
23
23
|
type Constructor = <
|
|
24
24
|
TRootComponentDefinition extends RootComponentDefinition = {},
|
|
25
|
-
|
|
25
|
+
TSubComponentDefinitionList extends SubComponentDefinition[] = [],
|
|
26
26
|
TName extends string = "",
|
|
27
27
|
TPath extends Path = "/",
|
|
28
28
|
>(
|
|
29
|
-
options: Options<TRootComponentDefinition,
|
|
29
|
+
options: Options<TRootComponentDefinition, TSubComponentDefinitionList, TName, TPath>,
|
|
30
30
|
) => // 根据是否传入name字段(当isPage不为true时,类型约束name不为空字符串)来区分生成页面文档还是组件文档。
|
|
31
31
|
IfExtends<
|
|
32
32
|
"",
|
|
33
33
|
TName,
|
|
34
34
|
GeneratePageDoc<TRootComponentDefinition, TPath>,
|
|
35
|
-
GenerateComponentDoc<TRootComponentDefinition, TName,
|
|
35
|
+
GenerateComponentDoc<TRootComponentDefinition, TName, TSubComponentDefinitionList>
|
|
36
36
|
>;
|
|
37
37
|
/**
|
|
38
38
|
* DefineComponentOptionRuntime是DefineComponent的options参数的运行时类型。
|
|
@@ -41,13 +41,13 @@ export type DefineComponentOptionRuntime = {
|
|
|
41
41
|
name?: string;
|
|
42
42
|
path?: string;
|
|
43
43
|
rootComponent?: RootComponentDefinitionRuntime;
|
|
44
|
-
subComponents?:
|
|
44
|
+
subComponents?: SubComponentDefinitionRuntime[];
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* DefineComponent是构建组件的核心API,所有组件(页面组件和自定义组件)都通过它来构建的。
|
|
49
49
|
* 它返回的类型可能是页面文档(`PageDoc`)或者自定义组件文档(`ComponentDoc`),具体取决于传入rootComponent中isPage的值。
|
|
50
|
-
* 它的作用是把根组件定义(`RootComponentDefinition`)和子组件定义(`
|
|
50
|
+
* 它的作用是把根组件定义(`RootComponentDefinition`)和子组件定义(`SubComponentDefinition`)整合成原生`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 {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { SlotComponentReturnType } from "../../ChunkComponent/SlotComponentReturnType";
|
|
2
|
-
import type { CustomComponentDefinitionRuntime } from "../../CustomComponent/returnType";
|
|
3
1
|
import type { RootComponentDefinitionRuntime } from "../../RootComponent/returnType";
|
|
2
|
+
import type { SubComponentDefinitionRuntime } from "../../SubComponent/returnType";
|
|
4
3
|
|
|
5
4
|
export function __throttleDebounce__FieldCheck(
|
|
6
|
-
config: RootComponentDefinitionRuntime |
|
|
5
|
+
config: RootComponentDefinitionRuntime | SubComponentDefinitionRuntime[],
|
|
7
6
|
) {
|
|
8
7
|
if (Array.isArray(config)) {
|
|
9
8
|
for (const subComponent of config) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SubComponentDefinitionRuntime } from "../../SubComponent/returnType";
|
|
2
2
|
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
3
|
import { __throttleDebounce__FieldCheck } from "./__throttleDebounce__FieldCheck";
|
|
4
4
|
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
@@ -6,7 +6,7 @@ import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
|
6
6
|
|
|
7
7
|
export function handleSubComponents(
|
|
8
8
|
componentOptions: FinalOptionsOfComponent,
|
|
9
|
-
subComponents:
|
|
9
|
+
subComponents: SubComponentDefinitionRuntime[] | undefined,
|
|
10
10
|
funcOptions: SameFuncOptions,
|
|
11
11
|
) {
|
|
12
12
|
if (subComponents && subComponents.length !== 0) {
|
|
@@ -7,15 +7,6 @@ import type { Instance } from "../../../RootComponent/Instance/RootComponentInst
|
|
|
7
7
|
import { getPathsValue } from "../watchHandler/getPathsValue";
|
|
8
8
|
import { hasComputedPath } from "../watchHandler/hasComputedPath";
|
|
9
9
|
import { initComputedAndGetCache } from "./initComputedAndGetCache";
|
|
10
|
-
// function initWatchOldValue(this: Instance, watchConfig: object): WatchOldValue {
|
|
11
|
-
// const watchOldValue: Record<string, unknown[]> = {};
|
|
12
|
-
// for (const key in watchConfig) {
|
|
13
|
-
// watchOldValue[key] = deepClone(getPathsValue(this.data, key));
|
|
14
|
-
// }
|
|
15
|
-
|
|
16
|
-
// return watchOldValue;
|
|
17
|
-
// }
|
|
18
|
-
|
|
19
10
|
/**
|
|
20
11
|
* 初始化会在2个时间渲染,一个是observers.**的回调函数,一个是attached周期。
|
|
21
12
|
* @param computedConfig
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
2
|
|
|
3
|
-
import type { CustomComponentDefinitionRuntime } from "../../CustomComponent/returnType";
|
|
4
3
|
import type { RootComponentDefinitionRuntime } from "../../RootComponent/returnType";
|
|
4
|
+
import type { SubComponentDefinitionRuntime } from "../../SubComponent/returnType";
|
|
5
5
|
import type { SameFuncOptions } from ".";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 把配置为函数的字段方法收集到funcOptions中
|
|
9
9
|
*/
|
|
10
10
|
export function sameFuncFieldsCollect(
|
|
11
|
-
options:
|
|
11
|
+
options: SubComponentDefinitionRuntime | RootComponentDefinitionRuntime,
|
|
12
12
|
funcOptions: SameFuncOptions,
|
|
13
13
|
) {
|
|
14
14
|
let key: keyof SameFuncOptions;
|
|
@@ -52,6 +52,7 @@ export function handleWatchConfig(
|
|
|
52
52
|
if (!isEmptyObject(watchConfig)) {
|
|
53
53
|
const rawPropertiesValue = getPropertiesValue(properties);
|
|
54
54
|
const computedKeys = Object.keys(computedConfig);
|
|
55
|
+
|
|
55
56
|
data.__watchOldValue__ = initWatchOldValuesWithoutComputed(
|
|
56
57
|
{ ...data, ...rawPropertiesValue },
|
|
57
58
|
watchConfig,
|
|
@@ -61,12 +62,14 @@ export function handleWatchConfig(
|
|
|
61
62
|
const watchHadle = watchConfig[key];
|
|
62
63
|
const originObserversHandle = observersConfig[key] as Func | undefined;
|
|
63
64
|
// 在监控多个数据时,参数是多个值
|
|
64
|
-
observersConfig[key] = function(this: Instance, ...
|
|
65
|
+
observersConfig[key] = function(this: Instance, ...values: unknown[]) {
|
|
66
|
+
// 计算属性初始化完成时直接调用。
|
|
65
67
|
if (this.data.__computedInited__) {
|
|
66
|
-
observerHandler.call(this, key, originObserversHandle, watchHadle, ...
|
|
68
|
+
observerHandler.call(this, key, originObserversHandle, watchHadle, ...values);
|
|
67
69
|
} else {
|
|
70
|
+
// 计算属性未初始化完成时,先把watch的回调函数注册到实例上,等计算属性初始化完成时再调用。因为计算属性初始化完成时会把data中的值setData一次,会触发observers回调函数,所以在这里注册watch的回调函数,就能保证计算属性初始化完成后能正确调用watch的回调函数。
|
|
68
71
|
(this.data.__oberverHandler__ ||= []).push(
|
|
69
|
-
observerHandler.bind(this, key, originObserversHandle, watchHadle, ...
|
|
72
|
+
observerHandler.bind(this, key, originObserversHandle, watchHadle, ...values),
|
|
70
73
|
);
|
|
71
74
|
}
|
|
72
75
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { CustomComponentDefinition } from "../../CustomComponent/returnType";
|
|
4
3
|
import type { RootComponentDefinition } from "../../RootComponent/returnType";
|
|
4
|
+
import type { SubComponentDefinition } from "../../SubComponent/returnType";
|
|
5
5
|
import type { GetCustomEventDocOfSubDoc } from "./GetCustomEventDocOfSubDoc";
|
|
6
6
|
|
|
7
7
|
// 获取RootComponetDoc中events字段类型阻止事件(后最为catch)的key `${ 组件前缀 }_${infer Key}_${ bubbles | capture }_catch`
|
|
@@ -13,7 +13,7 @@ type GetStopKeys<O> = { [k in keyof O]: k extends `${string}_${infer Key}_${stri
|
|
|
13
13
|
export type GenerateComponentDoc<
|
|
14
14
|
TRootDoc extends RootComponentDefinition,
|
|
15
15
|
TName extends string,
|
|
16
|
-
TSubComponentTuple extends
|
|
16
|
+
TSubComponentTuple extends SubComponentDefinition[],
|
|
17
17
|
// 获取RootDoc和SubComponent[]中所有的properties字段类型
|
|
18
18
|
AllPropertiesDoc extends unknown | object = TRootDoc["properties"],
|
|
19
19
|
AllEventsDoc extends unknown | object =
|
|
@@ -2,16 +2,16 @@ import type { IsNever, IsUnion } from "hry-types/src/Any/_api";
|
|
|
2
2
|
import type { UnionTwoObject } from "hry-types/src/Object/UnionTwoObject";
|
|
3
3
|
import type { Last } from "hry-types/src/Union/Last";
|
|
4
4
|
import type { Assert } from "../../../types/Assert";
|
|
5
|
-
import type {
|
|
5
|
+
import type { SubComponentDefinition } from "../../SubComponent/returnType";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 因为子组件文档customEvents字段有可能相同(无前缀),所以使用UnionTwoObject
|
|
9
9
|
* 由于SubComponentDoc为空时返回never而不`{}`,所以`Exclude<U, TLast>`不影响结果。
|
|
10
10
|
*/
|
|
11
11
|
type _GetCustomEventDocOfSubDoc<
|
|
12
|
-
U extends
|
|
12
|
+
U extends SubComponentDefinition,
|
|
13
13
|
Result = {},
|
|
14
|
-
TLast extends
|
|
14
|
+
TLast extends SubComponentDefinition = Assert<Last<U>, SubComponentDefinition>,
|
|
15
15
|
> = IsNever<U> extends true ? Result
|
|
16
16
|
: _GetCustomEventDocOfSubDoc<Exclude<U, TLast>, UnionTwoObject<Result, TLast["composedEvents"]>>;
|
|
17
17
|
|
|
@@ -19,6 +19,6 @@ type _GetCustomEventDocOfSubDoc<
|
|
|
19
19
|
* 获取子组件自定义事件文档
|
|
20
20
|
* @remarks U 中 相同字段类型联合,所以使用元组推导不如Last性能好。
|
|
21
21
|
*/
|
|
22
|
-
export type GetCustomEventDocOfSubDoc<UnionSubDoc extends
|
|
22
|
+
export type GetCustomEventDocOfSubDoc<UnionSubDoc extends SubComponentDefinition> = IsUnion<UnionSubDoc> extends true
|
|
23
23
|
? _GetCustomEventDocOfSubDoc<UnionSubDoc>
|
|
24
24
|
: UnionSubDoc["composedEvents"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
import { Checking, type Test } from "hry-types";
|
|
4
|
-
import {
|
|
4
|
+
import { type DetailedType, RootComponent, SubComponent } from "../../../..";
|
|
5
5
|
// import type { CustomEventConstraint } from "../../../rootComponent/CustomEvents/CustomEventConstraint";
|
|
6
6
|
import type {
|
|
7
7
|
Bubbles,
|
|
@@ -14,11 +14,11 @@ import type {
|
|
|
14
14
|
} from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
15
15
|
|
|
16
16
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
17
|
-
import type { CustomComponentDefinition } from "../../../CustomComponent/returnType";
|
|
18
17
|
import type { CustomEventConstraint } from "../../../RootComponent/CustomEvents/CustomEventConstraint";
|
|
19
18
|
import type { PropertiesConstraint } from "../../../RootComponent/Properties/PropertiesConstraint";
|
|
20
19
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
21
20
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
21
|
+
import type { SubComponentDefinition } from "../../../SubComponent/returnType";
|
|
22
22
|
import { DefineComponent } from "../..";
|
|
23
23
|
|
|
24
24
|
const properties = {
|
|
@@ -134,7 +134,7 @@ const compDoc = DefineComponent({
|
|
|
134
134
|
|
|
135
135
|
Checking<typeof compDoc, ComputeIntersection<CompOnlyCustomEventsExpected & OnlyPropertiesExpected>, Test.Pass>;
|
|
136
136
|
|
|
137
|
-
type SubA =
|
|
137
|
+
type SubA = SubComponentDefinition<{
|
|
138
138
|
composedEvents: {
|
|
139
139
|
str: string | Bubbles | Composed;
|
|
140
140
|
num: number | Capture | Composed;
|
|
@@ -158,7 +158,7 @@ type customEventsRootDocExpect = {
|
|
|
158
158
|
|
|
159
159
|
Checking<typeof customEventsRootDoc, customEventsRootDocExpect, Test.Pass>;
|
|
160
160
|
|
|
161
|
-
type SubB =
|
|
161
|
+
type SubB = SubComponentDefinition<{
|
|
162
162
|
composedEvents: {
|
|
163
163
|
str: number | Bubbles | Composed;
|
|
164
164
|
num: string | Capture | Composed;
|
|
@@ -225,9 +225,9 @@ const rootComponent8 = RootComponent()({
|
|
|
225
225
|
|
|
226
226
|
Checking<(typeof rootComponent8)["customEvents"]["decrease"], Mock_User, Test.Pass>;
|
|
227
227
|
|
|
228
|
-
const subA =
|
|
228
|
+
const subA = SubComponent<RootComponentDefinition, { properties: { subA_num: number } }>()({});
|
|
229
229
|
// SubComponent中计算属性字段函数若不写返回值,会造成结果中没有计算属性字段类型,若没有其他字段,结果就为'{}'
|
|
230
|
-
const subB =
|
|
230
|
+
const subB = SubComponent<RootComponentDefinition, { properties: { subB_str: string } }>()({
|
|
231
231
|
computed: {
|
|
232
232
|
subB_str() {
|
|
233
233
|
return this.data.injectStr;
|
|
@@ -1,8 +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/ComputeObject";
|
|
4
3
|
import type { WMCompPageLifetimes, WMPageLifetimes } from "../../../types/OfficialTypeAlias";
|
|
5
|
-
import type { RemoveNullOfRequired } from "../../../types/RemoveNullOfRequired";
|
|
6
4
|
|
|
7
5
|
export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends object> = IfExtends<
|
|
8
6
|
TIsPage,
|
|
@@ -23,8 +21,7 @@ export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends o
|
|
|
23
21
|
* 页面加载时触发。一个页面只会调用一次,可以在 onLoad 的参数中获取Properties定义的数据。
|
|
24
22
|
*/
|
|
25
23
|
onLoad?: (
|
|
26
|
-
|
|
27
|
-
props: ComputeObject<RemoveNullOfRequired<PropertiesDoc>>,
|
|
24
|
+
props: Required<PropertiesDoc>,
|
|
28
25
|
) => void | Promise<void>;
|
|
29
26
|
}
|
|
30
27
|
>;
|
|
@@ -2,10 +2,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import { type DetailedType, RootComponent } from "../../../..";
|
|
3
3
|
|
|
4
4
|
import type { Mock_User } from "../../Properties/test/normalRequired.test";
|
|
5
|
-
|
|
6
|
-
name: string;
|
|
7
|
-
age?: number;
|
|
8
|
-
};
|
|
5
|
+
|
|
9
6
|
/**
|
|
10
7
|
* 组件时
|
|
11
8
|
*/
|
|
@@ -49,8 +46,8 @@ RootComponent()({
|
|
|
49
46
|
void Checking<
|
|
50
47
|
typeof props,
|
|
51
48
|
{
|
|
52
|
-
union
|
|
53
|
-
optionalObject
|
|
49
|
+
union: Mock_User;
|
|
50
|
+
optionalObject: Mock_User | null;
|
|
54
51
|
str: string;
|
|
55
52
|
obj: object;
|
|
56
53
|
},
|
|
@@ -72,28 +69,3 @@ RootComponent()({
|
|
|
72
69
|
// ...
|
|
73
70
|
},
|
|
74
71
|
});
|
|
75
|
-
// prop中必传对象没有null,但在实例中却需要有null
|
|
76
|
-
RootComponent()({
|
|
77
|
-
isPage: true,
|
|
78
|
-
properties: {
|
|
79
|
-
optionalObj: {
|
|
80
|
-
type: Object,
|
|
81
|
-
value: {},
|
|
82
|
-
},
|
|
83
|
-
requiredObj: Object as DetailedType<User>,
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
pageLifetimes: {
|
|
87
|
-
onLoad(prop) {
|
|
88
|
-
void prop;
|
|
89
|
-
// 页面外部传值时没必要传null,组件时有需要的。
|
|
90
|
-
void Checking<typeof prop.requiredObj, User, true>;
|
|
91
|
-
// 虽然传值不应该是null,但由于实例建立时默认为null,所以实例类型加上null
|
|
92
|
-
void Checking<typeof this.data.requiredObj, User, true>;
|
|
93
|
-
// 页面传入的可选对象不需要null,有undefined
|
|
94
|
-
void Checking<typeof prop.optionalObj, object | undefined, true>;
|
|
95
|
-
// 实例中的可选对象不需要null,有默认值。
|
|
96
|
-
void Checking<typeof this.data.optionalObj, object, true>;
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
-
export type
|
|
2
|
+
export type GetSubComputedDoc<TComputed extends Record<string, any>> = {
|
|
3
3
|
[k in keyof TComputed]: ReturnType<TComputed[k]>;
|
|
4
4
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SubComputedConstraint<obj extends object> = { [k in keyof obj]?: () => obj[k] };
|
package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/error.test.ts
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
|
-
import {
|
|
2
|
+
import { SubComponent } from "../..";
|
|
3
3
|
|
|
4
4
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
5
5
|
events: { aaa_str: string };
|
|
6
6
|
}>;
|
|
7
7
|
|
|
8
8
|
// 1 CompDoc的properties为空时,写任何字段都报错
|
|
9
|
-
|
|
9
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
10
10
|
computed: {
|
|
11
11
|
// @ts-expect-error ⚠️"重复或无效的字段"⚠️
|
|
12
12
|
aaa_xxx() {
|
|
@@ -23,7 +23,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
23
23
|
}>;
|
|
24
24
|
|
|
25
25
|
// 2 去除inhrit和data字段后无组件字段约束时,只可写内部字段
|
|
26
|
-
|
|
26
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
27
27
|
inherit: {
|
|
28
28
|
aaa_str: "wxml",
|
|
29
29
|
},
|
|
@@ -42,7 +42,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
// 3 类型错误
|
|
45
|
-
|
|
45
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
46
46
|
inherit: {
|
|
47
47
|
aaa_str: "wxml",
|
|
48
48
|
},
|
|
@@ -54,7 +54,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
54
54
|
},
|
|
55
55
|
});
|
|
56
56
|
// 4 与data的内部字段重复
|
|
57
|
-
|
|
57
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
58
58
|
data: {
|
|
59
59
|
_aaa_fff: 123,
|
|
60
60
|
},
|
|
@@ -66,7 +66,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
66
66
|
},
|
|
67
67
|
});
|
|
68
68
|
// 5 与store的内部字段重复
|
|
69
|
-
|
|
69
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
70
70
|
store: {
|
|
71
71
|
_aaa_ccc: () => 123,
|
|
72
72
|
},
|
|
@@ -78,7 +78,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
78
78
|
},
|
|
79
79
|
});
|
|
80
80
|
// 6 与root字段重复
|
|
81
|
-
|
|
81
|
+
SubComponent<{ data: { _aaa_ccc: 123 } }, OnlyPropsCompDoc>()({
|
|
82
82
|
computed: {
|
|
83
83
|
// @ts-expect-error 与store的内部字段重复
|
|
84
84
|
_aaa_ccc(): number {
|
package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/normal.test.ts
RENAMED
|
@@ -4,7 +4,7 @@ import type { ComponentDoc } from "../../../DefineComponent/returnType/Component
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
|
-
import {
|
|
7
|
+
import { SubComponent } from "../..";
|
|
8
8
|
|
|
9
9
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
10
10
|
events: { aaa_str: string };
|
|
@@ -35,7 +35,7 @@ type $aaa = ComponentDoc<
|
|
|
35
35
|
{ properties: { aaa_str: string; aaa_user: User | null; aaa_num: number; aaa_age: number } }
|
|
36
36
|
>;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
39
39
|
// 1 CompDoc的properties为空时,可以写{}
|
|
40
40
|
computed: {},
|
|
41
41
|
});
|
|
@@ -49,7 +49,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
49
49
|
};
|
|
50
50
|
}>;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
SubComponent<Root, OnlyPropsCompDoc>()({
|
|
53
53
|
inherit: {
|
|
54
54
|
aaa_num: "num",
|
|
55
55
|
},
|
|
@@ -67,7 +67,7 @@ CustomComponent<Root, OnlyPropsCompDoc>()({
|
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
69
|
// 3 computed字段的返回类型应为对应的文档类型,避免返回字面量类型导致与实际文档类型不符
|
|
70
|
-
|
|
70
|
+
SubComponent<Root, OnlyPropsCompDoc>()({
|
|
71
71
|
computed: {
|
|
72
72
|
aaa_num() {
|
|
73
73
|
return 123;
|
|
@@ -127,7 +127,7 @@ CustomComponent<Root, OnlyPropsCompDoc>()({
|
|
|
127
127
|
|
|
128
128
|
// 计算属性可互相引用,但要加返回类型注释
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
SubComponent<Root, $aaa>()({
|
|
131
131
|
computed: {
|
|
132
132
|
aaa_num(): number {
|
|
133
133
|
return this.data.SNum;
|
|
@@ -144,7 +144,7 @@ CustomComponent<Root, $aaa>()({
|
|
|
144
144
|
},
|
|
145
145
|
});
|
|
146
146
|
// 计算属性this.data可获取store和data的字段中文档中的字段和内部字段(_开头的字段)
|
|
147
|
-
|
|
147
|
+
SubComponent<Root, $aaa>()({
|
|
148
148
|
data: {
|
|
149
149
|
aaa_age: 123,
|
|
150
150
|
_aaa_age1: 123,
|
|
@@ -161,7 +161,7 @@ CustomComponent<Root, $aaa>()({
|
|
|
161
161
|
},
|
|
162
162
|
});
|
|
163
163
|
// computed中可写 额外字段 isReady
|
|
164
|
-
|
|
164
|
+
SubComponent<{ data: { _num: number } }, $aaa>()({
|
|
165
165
|
computed: {
|
|
166
166
|
aaa_isReady() {
|
|
167
167
|
return true;
|
|
@@ -170,7 +170,7 @@ CustomComponent<{ data: { _num: number } }, $aaa>()({
|
|
|
170
170
|
});
|
|
171
171
|
|
|
172
172
|
// computed中可写 内部字段
|
|
173
|
-
|
|
173
|
+
SubComponent<{ data: { _num: number } }, $aaa>()({
|
|
174
174
|
computed: {
|
|
175
175
|
aaa_isReady() {
|
|
176
176
|
return true;
|
|
@@ -185,7 +185,7 @@ CustomComponent<{ data: { _num: number } }, $aaa>()({
|
|
|
185
185
|
type Custom = { type: "custom"; xxx: string };
|
|
186
186
|
type Chunk = { type: "chunk"; yyy: number };
|
|
187
187
|
type Union = Custom | Chunk;
|
|
188
|
-
|
|
188
|
+
SubComponent<{ data: { _num: number }; methods: { IsChunk: (union: Union) => union is Chunk } }, $aaa>()({
|
|
189
189
|
data: {
|
|
190
190
|
_aaa_union: { type: "custom", xxx: "123" } as Union,
|
|
191
191
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubDataOption<TData extends object, legalKeys extends PropertyKey, errMsg extends string> = {
|
|
4
4
|
/**
|
|
5
5
|
* 可写子组件所需数据和内部公共数据
|
|
6
6
|
* 非法字段检测和与Inherit字段的重复检测
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
|
|
3
3
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
4
|
-
import {
|
|
4
|
+
import { SubComponent } from "../..";
|
|
5
5
|
|
|
6
6
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
7
7
|
events: { aaa_str: string };
|
|
8
8
|
}>;
|
|
9
9
|
|
|
10
10
|
// 1 CompDoc无properties字段时 data字段只可写内部字段
|
|
11
|
-
|
|
11
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
12
12
|
data: {
|
|
13
13
|
// @ts-expect-error "⚠️ 与Inherit字段重复或组件文档无需字段 ⚠️"
|
|
14
14
|
aaa_str: "str",
|
|
@@ -25,7 +25,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
25
25
|
}>;
|
|
26
26
|
|
|
27
27
|
// 2 CompDoc有properties字段但去除Inherit字段后为空,只可写内部字段
|
|
28
|
-
|
|
28
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
29
29
|
inherit: {
|
|
30
30
|
aaa_str: "wxml",
|
|
31
31
|
aaa_num: "wxml",
|
|
@@ -41,7 +41,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
// 3 重复字段和非组件所需字段错误
|
|
44
|
-
|
|
44
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
45
45
|
inherit: {
|
|
46
46
|
aaa_str: "wxml",
|
|
47
47
|
},
|
|
@@ -56,7 +56,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
// 4 与root的数据字段重复
|
|
59
|
-
|
|
59
|
+
SubComponent<{ data: { aaa_str: 123 } }, OnlyPropsCompDoc>()({
|
|
60
60
|
data: {
|
|
61
61
|
// @ts-expect-error 与root的data字段重复
|
|
62
62
|
aaa_str: "a",
|