annil 1.15.1 → 1.17.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 +14 -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/injectInfoHandler.js +1 -1
- package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.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/InstanceInject/instanceConfig.d.ts +2 -2
- package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +1 -3
- package/dist/api/RootComponent/index.d.ts +3 -3
- package/dist/api/RootComponent/index.js.map +1 -1
- 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/injectInfoHandler.ts +1 -1
- 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/InstanceInject/inject.ts +7 -2
- package/src/api/InstanceInject/instanceConfig.ts +3 -4
- package/src/api/InstanceInject/test/normal.test.ts +7 -6
- package/src/api/RootComponent/Instance/test/datas/mormal.test.ts +43 -0
- package/src/api/RootComponent/Instance/test/methods/mormal.test.ts +11 -2
- 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/RootComponent/Store/test/normal.test.ts +24 -4
- package/src/api/RootComponent/index.ts +20 -7
- 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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
+
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
3
|
+
import type { RequiredKeys } from "hry-types/src/Object/RequiredKeys";
|
|
4
|
+
import type { Extra } from "../../types/Extra";
|
|
5
|
+
import type { GetComponentPrefix } from "../../types/GetComponentPrefix";
|
|
6
|
+
import type { InnerFields } from "../../types/InnerData";
|
|
7
|
+
import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
|
|
8
|
+
import type { Replace } from "../../types/Replace";
|
|
9
|
+
import type { ReplacePrefix } from "../../types/ReplacePrefix";
|
|
10
|
+
import type { UnionToComma } from "../../types/UnionToComma.test";
|
|
11
|
+
import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
|
|
12
|
+
import type { IInjectStore } from "../InstanceInject/instanceConfig";
|
|
13
|
+
import type { RootComponentDefinition } from "../RootComponent/returnType";
|
|
14
|
+
import type { GetStoreDef } from "../RootComponent/Store/GetStoreDef";
|
|
15
|
+
import type { GetSubComputedDoc } from "./SubComputed/GetSubComputedDoc";
|
|
16
|
+
import type { SubComputedConstraint } from "./SubComputed/SubComputedConstraint";
|
|
17
|
+
import type { SubComputedOption } from "./SubComputed/SubComputedOption";
|
|
18
|
+
import type { SubDataConstraint } from "./SubData/SubDataConstraint";
|
|
19
|
+
import type { SubDataOption } from "./SubData/SubDataOption";
|
|
20
|
+
import type { SubEventsConstraint } from "./SubEvents/SubEventsConstraint";
|
|
21
|
+
import type { SubEventsOption } from "./SubEvents/SubEventsOption";
|
|
22
|
+
import type { SubInheritConstraint } from "./SubInherit/SubInheritConstraint";
|
|
23
|
+
import type { SubInheritOption } from "./SubInherit/SubInheritOption";
|
|
24
|
+
import type { SubInstance } from "./SubInstance/SubInstance";
|
|
25
|
+
import type { SubLifetimesOption } from "./SubLifetimes/SubLifetimesOption";
|
|
26
|
+
import type { SubMethodsConstraint } from "./SubMethods/SubMethodsConstraint";
|
|
27
|
+
import type { SubMethodsOption } from "./SubMethods/SubMethodsOption";
|
|
28
|
+
import type { SubObserversOption } from "./SubObservers/SubObserversOption";
|
|
29
|
+
import type { SubPageLifetimesOption } from "./SubPageLifetimes/SubPageLifetimesOption";
|
|
30
|
+
import type { CreatSubComponentDoc } from "./SubReturnType/CreateSubComponentDoc";
|
|
31
|
+
import type { SubStoreConstraint } from "./SubStore/SubStoreConstraint";
|
|
32
|
+
import type { SubStoreOption } from "./SubStore/SubStoreOption";
|
|
33
|
+
import type { SubWatchOption } from "./SubWatch/SubWatchOption";
|
|
34
|
+
type Options<RootDoc extends RootComponentDefinition, IsPage extends boolean, CurrentCompDoc extends ComponentDoc, Prefix extends string, AllRootDataDoc extends object, TInherit extends object, TSubData extends object, TSubStore extends object, TSubComputed extends object, TEvents extends object, TSubMethods extends SubMethodsConstraint, InheritDoc extends object, SubDataDoc extends object, SubStoreDoc extends object, SubComputedDoc extends object, SubEventsDoc extends object, SubMethodsDoc extends object, CompDocKeys extends PropertyKey = keyof CurrentCompDoc["properties"]> = SubInheritOption<TInherit, {
|
|
35
|
+
[k in keyof NoInfer<TInherit>]: k extends keyof (AllRootDataDoc) ? never : k extends CompDocKeys ? k : never;
|
|
36
|
+
}[keyof NoInfer<TInherit>]> & SubDataOption<TSubData, {
|
|
37
|
+
[k in keyof NoInfer<TSubData>]: k extends keyof (AllRootDataDoc) ? never : k extends Exclude<CompDocKeys, (keyof (InheritDoc))> ? k : k extends InnerFields<Prefix> ? k : never;
|
|
38
|
+
}[keyof NoInfer<TSubData>], "子组件无需此字段或与Inherit字段重复"> & SubStoreOption<TSubStore, {
|
|
39
|
+
[k in keyof NoInfer<TSubStore>]: k extends keyof (AllRootDataDoc & SubDataDoc) ? never : k extends Exclude<CompDocKeys, (keyof (InheritDoc & SubDataDoc))> ? k : k extends InnerFields<Prefix> ? k : never;
|
|
40
|
+
}[keyof NoInfer<TSubStore>]> & SubComputedOption<TSubComputed, {
|
|
41
|
+
[k in keyof NoInfer<TSubComputed>]: k extends keyof (AllRootDataDoc & SubDataDoc & SubStoreDoc) ? never : k extends Exclude<CompDocKeys, (keyof (InheritDoc & SubDataDoc & SubStoreDoc))> ? k : k extends InnerFields<Prefix> ? k : never;
|
|
42
|
+
}[keyof NoInfer<TSubComputed>]> & SubEventsOption<TEvents, SubEventsDoc, keyof SubEventsConstraint<CurrentCompDoc>> & SubMethodsOption<TSubMethods, Prefix, keyof (CurrentCompDoc["events"] & SubEventsDoc)> & SubPageLifetimesOption<IsPage, NonNullable<RootDoc["properties"]>> & SubLifetimesOption & SubWatchOption<SubComputedDoc & SubDataDoc & AllRootDataDoc & SubStoreDoc & IInjectStore> & Partial<Omit<WMCompOtherOption, "pageLifetimes" | "definitionFilter" | "export" | "observers" | "relations">> & SubObserversOption<SubComputedDoc & SubDataDoc & AllRootDataDoc & SubStoreDoc & IInjectStore> & ThisType<SubInstance<SubMethodsDoc & RootDoc["methods"], Replace<SubDataDoc, Required<CurrentCompDoc["properties"]>>, AllRootDataDoc & Replace<SubDataDoc & SubComputedDoc & SubStoreDoc, Required<CurrentCompDoc["properties"]>>, NonNullable<RootDoc["customEvents"]>, SubStoreDoc>>;
|
|
43
|
+
type SubComponentConstructor<TRootDoc extends RootComponentDefinition, TOriginalCompDoc extends ComponentDoc, TSupplementalPrefix extends string = "", IsPage extends boolean = TRootDoc["isPage"] extends true ? true : false, CurrentPrefix extends string = `${GetComponentPrefix<TOriginalCompDoc>}${Capitalize<TSupplementalPrefix>}`, CurrentCompDoc extends ComponentDoc = IfExtends<TSupplementalPrefix, "", TOriginalCompDoc & {
|
|
44
|
+
properties: Extra<CurrentPrefix>;
|
|
45
|
+
}, ReplacePrefix<TOriginalCompDoc & {
|
|
46
|
+
properties: Extra<CurrentPrefix>;
|
|
47
|
+
}, CurrentPrefix>>, AllRootDataDoc extends object = Required<TRootDoc["properties"]> & TRootDoc["data"] & TRootDoc["computed"] & TRootDoc["store"]> = <TInherit extends SubInheritConstraint<AllRootDataDoc, CurrentCompDoc>, TData extends SubDataConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc> & Record<InnerFields<CurrentPrefix>, unknown>>, TStore extends SubStoreConstraint<Required<TRootDoc["properties"]>, Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TEvents extends SubEventsConstraint<CurrentCompDoc>, TComputed extends SubComputedConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TMethods extends SubMethodsConstraint = {}, InheritDoc extends object = IfExtends<SubInheritConstraint<AllRootDataDoc, CurrentCompDoc>, TInherit, {}, TInherit>, DataDoc extends object = IfExtends<SubDataConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc> & Record<InnerFields<CurrentPrefix>, unknown>>, TData, {}, TData>, StoreDoc extends object = IfExtends<SubStoreConstraint<Required<TRootDoc["properties"]>, Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TStore, {}, GetStoreDef<TStore>>, ComputedDoc extends object = IfExtends<SubComputedConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)> & Record<InnerFields<CurrentPrefix>, unknown>>, TComputed, {}, GetSubComputedDoc<TComputed>>, EventsDoc extends object = IfExtends<SubEventsConstraint<CurrentCompDoc>, TEvents, {}, TEvents>, MethodsDoc extends object = TMethods, MissingRequiredField extends PropertyKey = Exclude<RequiredKeys<NonNullable<CurrentCompDoc["properties"]>>, keyof (InheritDoc & DataDoc & StoreDoc & IfExtends<SubComputedConstraint<Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)>>, TComputed, {}, GetSubComputedDoc<TComputed>>)>>(options: Options<TRootDoc, IsPage, CurrentCompDoc, CurrentPrefix, AllRootDataDoc, TInherit, TData, TStore, TComputed, TEvents, TMethods, InheritDoc, DataDoc, StoreDoc, ComputedDoc, EventsDoc, MethodsDoc>) => IfExtends<MissingRequiredField, never, CreatSubComponentDoc<NonNullable<CurrentCompDoc["events"]>, EventsDoc>, `缺少必传的字段${UnionToComma<MissingRequiredField & string>}`>;
|
|
48
|
+
export declare function SubComponent<TRootComponentDefinition extends RootComponentDefinition, TCompDoc extends ComponentDoc, Prefix extends string = "">(): IfExtends<EmptyObject, TCompDoc, (opt: EmptyObject) => never, SubComponentConstructor<TRootComponentDefinition, TCompDoc, Prefix>>;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/SubComponent/index.ts"],"names":[],"mappings":"AAgSA,MAAM,UAAU,YAAY;IAW1B,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAQ,CAAC;AAC5C,CAAC"}
|
|
@@ -6,12 +6,12 @@ import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesCo
|
|
|
6
6
|
import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
|
|
7
7
|
import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
|
|
8
8
|
import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
|
|
9
|
-
type
|
|
9
|
+
type _SubComponentDefinition = {
|
|
10
10
|
composedEvents?: Record<string, unknown>;
|
|
11
11
|
};
|
|
12
12
|
type _Validator<O, Doc, ErrKeys = Exclude<keyof O, keyof Doc>> = [ErrKeys] extends [never] ? Doc : `错误的字段${ErrKeys & string}`;
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
13
|
+
export type SubComponentDefinition<O extends _Validator<O, _SubComponentDefinition> = _SubComponentDefinition> = O;
|
|
14
|
+
export type SubComponentDefinitionRuntime = {
|
|
15
15
|
inhrit?: string;
|
|
16
16
|
data?: DataConstraint;
|
|
17
17
|
computed?: ComputedConstraint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"returnType.js","sourceRoot":"","sources":["../../../src/api/SubComponent/returnType.ts"],"names":[],"mappings":""}
|
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;
|
|
@@ -11,15 +11,20 @@ wx.onThemeChange((Res) => {
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
// 注入的方法;
|
|
14
|
-
function
|
|
14
|
+
function injectMethodA(data: string) {
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function injectMethodB(data: number) {
|
|
15
18
|
return data;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
const data = {
|
|
19
22
|
injectStr: "injectStr",
|
|
23
|
+
injectNum: 123,
|
|
20
24
|
};
|
|
21
25
|
const methods = {
|
|
22
|
-
|
|
26
|
+
injectMethodA,
|
|
27
|
+
injectMethodB,
|
|
23
28
|
};
|
|
24
29
|
const store = {
|
|
25
30
|
injectTheme: () => themeStore.theme,
|
|
@@ -19,16 +19,15 @@ interface BaseInjectInfo {
|
|
|
19
19
|
|
|
20
20
|
export interface IInjectInfo extends BaseInjectInfo {
|
|
21
21
|
}
|
|
22
|
+
export type InjectData = DataConstraint extends IInjectInfo["data"] ? {} : IInjectInfo["data"];
|
|
22
23
|
|
|
23
24
|
export type IInjectAllData = IfEquals<
|
|
24
25
|
{},
|
|
25
|
-
|
|
26
|
+
InjectData & IInjectStore,
|
|
26
27
|
{},
|
|
27
|
-
ComputeIntersection<
|
|
28
|
+
ComputeIntersection<InjectData & IInjectStore>
|
|
28
29
|
>;
|
|
29
30
|
|
|
30
|
-
type injectData = DataConstraint extends IInjectInfo["data"] ? {} : IInjectInfo["data"];
|
|
31
|
-
|
|
32
31
|
export type IInjectStore = StoreConstraint extends IInjectInfo["store"] ? {}
|
|
33
32
|
: ReturnTypeInObject<IInjectInfo["store"]>;
|
|
34
33
|
|
|
@@ -10,7 +10,7 @@ RootComponent()({
|
|
|
10
10
|
|
|
11
11
|
Checking<typeof this.data.injectTheme, "dark" | "light" | undefined, Test.Pass>;
|
|
12
12
|
|
|
13
|
-
Checking<typeof this.
|
|
13
|
+
Checking<typeof this.injectMethodA, (data: string) => string, Test.Pass>;
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
});
|
|
@@ -18,12 +18,12 @@ RootComponent()({
|
|
|
18
18
|
// 2. 注入字段重复时,自身覆盖注入类型
|
|
19
19
|
RootComponent()({
|
|
20
20
|
data: {
|
|
21
|
-
//
|
|
21
|
+
// 覆盖注入的数据类型,注入的类型为string。
|
|
22
22
|
injectStr: 123,
|
|
23
23
|
},
|
|
24
24
|
store: {
|
|
25
|
-
//
|
|
26
|
-
injectTheme: (
|
|
25
|
+
// 覆盖注入的数据类型,注入的类型为"dark" | "light" | undefined。
|
|
26
|
+
injectTheme: () => "aaa",
|
|
27
27
|
},
|
|
28
28
|
methods: {
|
|
29
29
|
// 覆盖注入的方法类型
|
|
@@ -31,9 +31,10 @@ RootComponent()({
|
|
|
31
31
|
return 123;
|
|
32
32
|
},
|
|
33
33
|
testInjectTypes() {
|
|
34
|
+
// 覆盖注入的数据类型,注入的类型为string。
|
|
34
35
|
Checking<typeof this.data.injectStr, number, Test.Pass>;
|
|
35
|
-
|
|
36
|
-
Checking<typeof this.data.injectTheme,
|
|
36
|
+
// 覆盖注入的数据类型,注入的类型为"dark" | "light" | undefined。
|
|
37
|
+
Checking<typeof this.data.injectTheme, string, Test.Pass>;
|
|
37
38
|
|
|
38
39
|
Checking<typeof this.injectMethod, () => 123, Test.Pass>;
|
|
39
40
|
},
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Checking, type Test } from "hry-types";
|
|
2
|
+
import { type DetailedType, RootComponent } from "../../../../..";
|
|
3
|
+
|
|
4
|
+
// 组件时
|
|
5
|
+
RootComponent()({
|
|
6
|
+
properties: {
|
|
7
|
+
obj: Object,
|
|
8
|
+
optionalObj: {
|
|
9
|
+
type: Object as DetailedType<{ name: string }>,
|
|
10
|
+
value: { name: "zhao" },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
data: {
|
|
14
|
+
dataStr: "dataStr",
|
|
15
|
+
// 相同字段覆盖注入类型
|
|
16
|
+
injectStr: 123,
|
|
17
|
+
},
|
|
18
|
+
store: {
|
|
19
|
+
storeData: (data) => {
|
|
20
|
+
return data.optionalObj.name;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
lifetimes: {
|
|
24
|
+
attached() {
|
|
25
|
+
// 组件实例对象格外添加null类型
|
|
26
|
+
Checking<
|
|
27
|
+
typeof this.data,
|
|
28
|
+
{
|
|
29
|
+
optionalObj: {
|
|
30
|
+
name: string;
|
|
31
|
+
};
|
|
32
|
+
obj: object;
|
|
33
|
+
dataStr: string;
|
|
34
|
+
storeData: string;
|
|
35
|
+
injectTheme: "dark" | "light" | undefined;
|
|
36
|
+
injectStr: number; // 相同字段覆盖注入类型 injectStr: string -> number
|
|
37
|
+
injectNum: number;
|
|
38
|
+
},
|
|
39
|
+
Test.Pass
|
|
40
|
+
>();
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -3,14 +3,23 @@ import { RootComponent } from "../../../../..";
|
|
|
3
3
|
|
|
4
4
|
RootComponent()({
|
|
5
5
|
methods: {
|
|
6
|
+
// 与注入方法同名,会覆盖注入方法
|
|
7
|
+
injectMethodB(num: string) {
|
|
8
|
+
return num;
|
|
9
|
+
},
|
|
10
|
+
|
|
6
11
|
M1() {
|
|
7
12
|
return 1;
|
|
8
13
|
},
|
|
9
14
|
|
|
10
15
|
M2(str: string) {
|
|
11
|
-
|
|
16
|
+
Checking<typeof this.M1, () => 1, Test.Pass>();
|
|
17
|
+
|
|
18
|
+
Checking<typeof this.M2, (str: string) => string, Test.Pass>();
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
Checking<typeof this.injectMethodA, (str: string) => string, Test.Pass>();
|
|
21
|
+
// 自身方法会覆盖注入方法,所以类型为自身方法的类型
|
|
22
|
+
Checking<typeof this.injectMethodB, (num: string) => string, Test.Pass>();
|
|
14
23
|
|
|
15
24
|
return str;
|
|
16
25
|
},
|
|
@@ -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
|
>;
|