annil 1.14.0 → 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 +32 -0
- package/README.md +15 -3
- package/dist/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.d.ts +2 -2
- package/dist/api/DefineComponent/NameOrPath/NameOrPathOption.js.map +1 -0
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +3 -3
- package/dist/api/DefineComponent/index.d.ts +5 -5
- 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/handleStore/reactionRegister.js +31 -15
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.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/hijackHandle/index.js +0 -4
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.js +2 -2
- package/dist/api/DefineComponent/normalizeOptions/index.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.d.ts +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +6 -6
- 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 +2 -6
- package/dist/api/RootComponent/Properties/GetPropertiesDef.d.ts +3 -2
- package/dist/api/RootComponent/Properties/PropertiesOption.d.ts +1 -3
- package/dist/api/RootComponent/Store/StoreOption.d.ts +1 -2
- 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} +2 -2
- 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/dist/thirdLib/index.js +2 -1
- package/dist/thirdLib/index.js.map +1 -1
- package/package.json +5 -4
- package/src/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.ts +3 -3
- 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 +9 -9
- package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +2 -3
- package/src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts +56 -17
- package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +5 -5
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts +22 -22
- package/src/api/DefineComponent/normalizeOptions/index.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 +23 -6
- 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 +2 -15
- package/src/api/RootComponent/PageLifetimes/test/error.test.ts +0 -3
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +3 -36
- package/src/api/RootComponent/Properties/GetPropertiesDef.ts +4 -7
- package/src/api/RootComponent/Properties/PropertiesOption.ts +3 -4
- package/src/api/RootComponent/Store/StoreOption.ts +1 -1
- package/src/api/RootComponent/Store/test/error.test.ts +1 -8
- package/src/api/RootComponent/Store/test/normal.test.ts +20 -9
- 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} +2 -2
- package/src/api/{CustomComponent/CustomStore/CustomStoreOption.ts → SubComponent/SubStore/SubStoreOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/error.test.ts +6 -6
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/normal.test.ts +13 -6
- 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 +50 -62
- package/src/api/{CustomComponent → SubComponent}/returnType.ts +6 -7
- package/src/index.ts +2 -4
- package/src/thirdLib/wm/swiper.test.ts +2 -2
- package/tsconfig.json +3 -3
- 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/dist/api/DefineComponent/NameOrPage/NameOrPathOption.js.map +0 -1
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.d.ts +0 -3
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js +0 -12
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.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/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.js +0 -0
- /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/DefineComponent/{NameOrPage → NameOrPath}/test/error.test.ts +0 -0
- /package/src/api/DefineComponent/{NameOrPage → NameOrPath}/test/normal.test.ts +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
|
@@ -5,9 +5,9 @@ import type { Getter } from "../../RootComponent/Store/StoreConstraint";
|
|
|
5
5
|
* 子组件Data字段约束
|
|
6
6
|
* @returns 当剩余对象不为空对象,约束对象的key为剩余key,类型为剩余key对应的文档类型或函数返回类型。
|
|
7
7
|
*/
|
|
8
|
-
export type
|
|
8
|
+
export type SubStoreConstraint<
|
|
9
9
|
PropertyDoc extends object,
|
|
10
10
|
legal extends object,
|
|
11
11
|
> = {
|
|
12
|
-
[k in keyof legal]?: Getter<PropertyDoc, AddNullForObject<legal[k]
|
|
12
|
+
[k in keyof legal]?: Getter<PropertyDoc, AddNullForObject<legal[k]> | undefined>;
|
|
13
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
import type { Validators } from "../../../types/Validators";
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type SubStoreOption<TStore extends object, legalKeys extends PropertyKey> = {
|
|
5
5
|
/**
|
|
6
6
|
* 全局响应式数据字段,全局store对应数据变化实例对应数据自动setData。
|
|
7
7
|
* 约束为组件properties字段去除inherit和data的剩余字段和内部字段
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { observable } from "mobx";
|
|
2
2
|
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
4
|
-
import {
|
|
4
|
+
import { SubComponent } from "../..";
|
|
5
5
|
const user = observable({
|
|
6
6
|
name: "zhao",
|
|
7
7
|
age: 20,
|
|
@@ -14,7 +14,7 @@ type DocA = ComponentDoc<{
|
|
|
14
14
|
};
|
|
15
15
|
}>;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
SubComponent<{
|
|
18
18
|
properties: {
|
|
19
19
|
str: string;
|
|
20
20
|
};
|
|
@@ -34,10 +34,10 @@ CustomComponent<{
|
|
|
34
34
|
// @ts-expect-error 3 超出约束字段
|
|
35
35
|
nu1m: () => user.age,
|
|
36
36
|
// @ts-expect-error 4 与data的内部字段重复
|
|
37
|
-
|
|
37
|
+
_aaa_xxx: () => user.age,
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
|
-
|
|
40
|
+
SubComponent<{
|
|
41
41
|
properties: {
|
|
42
42
|
aaa_num: number;
|
|
43
43
|
};
|
|
@@ -48,13 +48,13 @@ CustomComponent<{
|
|
|
48
48
|
},
|
|
49
49
|
});
|
|
50
50
|
// 类型约束错误
|
|
51
|
-
|
|
51
|
+
SubComponent<{
|
|
52
52
|
properties: {
|
|
53
53
|
aaa_num: number;
|
|
54
54
|
};
|
|
55
55
|
}, DocA>()({
|
|
56
56
|
store: {
|
|
57
57
|
// @ts-expect-error 返回类型错误
|
|
58
|
-
aaa_num: () =>
|
|
58
|
+
aaa_num: () => "str",
|
|
59
59
|
},
|
|
60
60
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { observable } from "mobx";
|
|
2
2
|
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
4
|
-
import {
|
|
4
|
+
import { SubComponent } from "../..";
|
|
5
5
|
const user = observable({
|
|
6
6
|
name: "zhao",
|
|
7
7
|
age: 20,
|
|
8
|
+
isReady: false,
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
type DocA = ComponentDoc<{
|
|
@@ -14,23 +15,29 @@ type DocA = ComponentDoc<{
|
|
|
14
15
|
};
|
|
15
16
|
}>;
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
SubComponent<{}, DocA>()({
|
|
18
19
|
store: {
|
|
19
|
-
// 1
|
|
20
|
+
// 1 可写文档字段
|
|
20
21
|
aaa_str: () => user.name,
|
|
21
22
|
aaa_num: () => user.age,
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
SubComponent<{}, DocA, "a">()({
|
|
26
27
|
store: {
|
|
27
28
|
// 2 可写内部字段
|
|
28
29
|
_aaaA_xxx: () => user.age,
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
32
|
// store中可写 额外字段 isReady
|
|
32
|
-
|
|
33
|
+
SubComponent<{ data: { _num: number } }, DocA, "a">()({
|
|
33
34
|
store: {
|
|
34
|
-
aaaA_isReady: () =>
|
|
35
|
+
aaaA_isReady: () => user.isReady,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// 4 可以返回undefined,表示该字段不可响应式,不报错,有警告。
|
|
39
|
+
SubComponent<{ properties: { num: number } }, DocA, "a">()({
|
|
40
|
+
store: {
|
|
41
|
+
aaaA_num: (data) => data.num > 10 ? user.age : void 0,
|
|
35
42
|
},
|
|
36
43
|
});
|
package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchComputed.test.ts
RENAMED
|
@@ -2,7 +2,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
3
3
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
4
4
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
5
|
-
import {
|
|
5
|
+
import { SubComponent } from "../..";
|
|
6
6
|
|
|
7
7
|
type RootDoc = RootComponentDefinition<{
|
|
8
8
|
properties: {
|
|
@@ -28,7 +28,7 @@ type CompDoc = ComponentDoc<{
|
|
|
28
28
|
/**
|
|
29
29
|
* watch computed字段时需要手写类型,可悬停鼠标到key查看类型
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
SubComponent<RootDoc, CompDoc>()({
|
|
32
32
|
computed: {
|
|
33
33
|
aaa_str(): string {
|
|
34
34
|
return this.data.aaa_num.toString();
|
package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchProperties.test.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import {
|
|
2
|
+
import { type DetailedType, RootComponent, SubComponent } from "../../../..";
|
|
3
3
|
import type { OptionalType } from "../../../RootComponent/Properties/PropertiesConstraint";
|
|
4
4
|
import {
|
|
5
5
|
type Mock_Cart,
|
|
@@ -45,7 +45,7 @@ void rootComponent;
|
|
|
45
45
|
/**
|
|
46
46
|
* watch properties字段 深度只读, 必传对象字段newValue去除null
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
SubComponent<Root, { properties: { aaa_num: number } }>()({
|
|
49
49
|
watch: {
|
|
50
50
|
// 必传单一字段
|
|
51
51
|
str(newValue, oldValue) {
|
package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchRootData.test.ts
RENAMED
|
@@ -3,7 +3,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
4
4
|
|
|
5
5
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
6
|
-
import {
|
|
6
|
+
import { SubComponent } from "../..";
|
|
7
7
|
|
|
8
8
|
interface TestObj {
|
|
9
9
|
subObj: Mock_User;
|
|
@@ -37,7 +37,7 @@ interface RootDoc {
|
|
|
37
37
|
/**
|
|
38
38
|
* watch RootDoc中的数据字段
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
SubComponent<RootDoc, CompDoc>()({
|
|
41
41
|
data: {
|
|
42
42
|
aaa_str: "str",
|
|
43
43
|
},
|
package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchSubData.test.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
2
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
3
|
-
import {
|
|
3
|
+
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
type CompDoc = ComponentDoc<{
|
|
6
6
|
properties: {
|
|
@@ -10,14 +10,14 @@ type CompDoc = ComponentDoc<{
|
|
|
10
10
|
}>;
|
|
11
11
|
|
|
12
12
|
// 可以为空对象
|
|
13
|
-
|
|
13
|
+
SubComponent<{}, CompDoc>()({
|
|
14
14
|
watch: {},
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* watch 自身data字段
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
SubComponent<{}, CompDoc>()({
|
|
21
21
|
data: {
|
|
22
22
|
aaa_str: "123",
|
|
23
23
|
|
package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WtachInject.test.ts
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import {
|
|
2
|
+
import { SubComponent } from "../..";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* watch 注入的store字段
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
SubComponent<{}, { properties: { aaa_num: number } }>()({
|
|
8
8
|
watch: {
|
|
9
9
|
injectTheme(newValue, oldValue) {
|
|
10
10
|
void Checking<"dark" | "light" | undefined, typeof newValue, Test.Pass>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Wm } from "../../../..";
|
|
2
|
-
import {
|
|
2
|
+
import { SubComponent } from "../..";
|
|
3
3
|
|
|
4
4
|
// 测试1
|
|
5
|
-
|
|
5
|
+
SubComponent<{ events: { a: string } }, Wm.View>()({
|
|
6
6
|
watch: {
|
|
7
7
|
// @ts-expect-error 无可监控字段时,约束为EmptyObject,不可写任何字段
|
|
8
8
|
nothing() {
|
|
@@ -14,7 +14,7 @@ CustomComponent<{ events: { a: string } }, Wm.View>()({
|
|
|
14
14
|
/**
|
|
15
15
|
* 测试2 超出约束字段报错
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
SubComponent<{ events: { a: string } }, Wm.View>()({
|
|
18
18
|
data: {
|
|
19
19
|
view_hoverClass: " h-100",
|
|
20
20
|
},
|
|
@@ -28,7 +28,7 @@ CustomComponent<{ events: { a: string } }, Wm.View>()({
|
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
SubComponent<{ data: { user: null | object } }, Wm.View>()({
|
|
32
32
|
data: {
|
|
33
33
|
view_hoverClass: " h-100",
|
|
34
34
|
},
|
|
@@ -45,7 +45,7 @@ CustomComponent<{ data: { user: null | object } }, Wm.View>()({
|
|
|
45
45
|
/**
|
|
46
46
|
* 3 对象联合null的类型 不能watch子字段
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
SubComponent<{ data: { user: null | object } }, { properties: { a: number } }>()({
|
|
49
49
|
watch: {
|
|
50
50
|
user(newValue, oldValue) {
|
|
51
51
|
void oldValue;
|
|
@@ -12,29 +12,26 @@ import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
|
|
|
12
12
|
import type { IInjectStore } from "../InstanceInject/instanceConfig";
|
|
13
13
|
import type { RootComponentDefinition } from "../RootComponent/returnType";
|
|
14
14
|
import type { GetStoreDef } from "../RootComponent/Store/GetStoreDef";
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type {
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import type {
|
|
26
|
-
import type {
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
29
|
-
import type {
|
|
30
|
-
import type {
|
|
31
|
-
import type {
|
|
32
|
-
import type {
|
|
33
|
-
import type {
|
|
34
|
-
|
|
35
|
-
// : K extends keyof AllRootDataDoc ? never
|
|
36
|
-
// : K extends Extract<Exclude<keyof NoInfer<TSubStore>, keyof SubDataDoc>, InnerFields<Prefix>> ? K
|
|
37
|
-
// : never;
|
|
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
|
+
|
|
38
35
|
type Options<
|
|
39
36
|
RootDoc extends RootComponentDefinition,
|
|
40
37
|
IsPage extends boolean,
|
|
@@ -46,7 +43,7 @@ type Options<
|
|
|
46
43
|
TSubStore extends object,
|
|
47
44
|
TSubComputed extends object,
|
|
48
45
|
TEvents extends object,
|
|
49
|
-
TSubMethods extends
|
|
46
|
+
TSubMethods extends SubMethodsConstraint,
|
|
50
47
|
InheritDoc extends object,
|
|
51
48
|
SubDataDoc extends object,
|
|
52
49
|
SubStoreDoc extends object,
|
|
@@ -55,7 +52,7 @@ type Options<
|
|
|
55
52
|
SubMethodsDoc extends object,
|
|
56
53
|
CompDocKeys extends PropertyKey = keyof CurrentCompDoc["properties"],
|
|
57
54
|
> =
|
|
58
|
-
&
|
|
55
|
+
& SubInheritOption<
|
|
59
56
|
TInherit,
|
|
60
57
|
{
|
|
61
58
|
[k in keyof NoInfer<TInherit>]:
|
|
@@ -66,7 +63,7 @@ type Options<
|
|
|
66
63
|
: never;
|
|
67
64
|
}[keyof NoInfer<TInherit>]
|
|
68
65
|
>
|
|
69
|
-
&
|
|
66
|
+
& SubDataOption<
|
|
70
67
|
TSubData,
|
|
71
68
|
// 合法的配置
|
|
72
69
|
{
|
|
@@ -81,7 +78,7 @@ type Options<
|
|
|
81
78
|
}[keyof NoInfer<TSubData>],
|
|
82
79
|
"子组件无需此字段或与Inherit字段重复"
|
|
83
80
|
>
|
|
84
|
-
&
|
|
81
|
+
& SubStoreOption<
|
|
85
82
|
TSubStore,
|
|
86
83
|
{
|
|
87
84
|
[k in keyof NoInfer<TSubStore>]:
|
|
@@ -94,16 +91,7 @@ type Options<
|
|
|
94
91
|
: never;
|
|
95
92
|
}[keyof NoInfer<TSubStore>]
|
|
96
93
|
>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// // 合法的字段(继承组件类型的keys)
|
|
100
|
-
// | Exclude<CompDocKeys, (keyof (InheritDoc & SubDataDoc))>
|
|
101
|
-
// // 合法的内部字段(不与data重复的内部字段)
|
|
102
|
-
// | Extract<Exclude<keyof NoInfer<TSubStore>, keyof SubDataDoc>, InnerFields<Prefix>>
|
|
103
|
-
// 不与allData重复的字段
|
|
104
|
-
// | Exclude<keyof NoInfer<TSubStore>, keyof AllRootDataDoc>
|
|
105
|
-
|
|
106
|
-
& CustomComputedOption<
|
|
94
|
+
& SubComputedOption<
|
|
107
95
|
TSubComputed,
|
|
108
96
|
{
|
|
109
97
|
[k in keyof NoInfer<TSubComputed>]:
|
|
@@ -128,11 +116,11 @@ type Options<
|
|
|
128
116
|
// >;
|
|
129
117
|
// }
|
|
130
118
|
// 无需与根组件的events字段重复检测,因为根组件多了bubbles字段,一定不会重复
|
|
131
|
-
&
|
|
132
|
-
&
|
|
133
|
-
&
|
|
134
|
-
&
|
|
135
|
-
&
|
|
119
|
+
& SubEventsOption<TEvents, SubEventsDoc, keyof SubEventsConstraint<CurrentCompDoc>>
|
|
120
|
+
& SubMethodsOption<TSubMethods, Prefix, keyof (CurrentCompDoc["events"] & SubEventsDoc)>
|
|
121
|
+
& SubPageLifetimesOption<IsPage, NonNullable<RootDoc["properties"]>>
|
|
122
|
+
& SubLifetimesOption
|
|
123
|
+
& SubWatchOption<
|
|
136
124
|
& SubComputedDoc
|
|
137
125
|
& SubDataDoc
|
|
138
126
|
& AllRootDataDoc
|
|
@@ -140,7 +128,7 @@ type Options<
|
|
|
140
128
|
& IInjectStore
|
|
141
129
|
>
|
|
142
130
|
& Partial<Omit<WMCompOtherOption, "pageLifetimes" | "definitionFilter" | "export" | "observers" | "relations">>
|
|
143
|
-
&
|
|
131
|
+
& SubObserversOption<
|
|
144
132
|
& SubComputedDoc
|
|
145
133
|
& SubDataDoc
|
|
146
134
|
& AllRootDataDoc
|
|
@@ -148,7 +136,7 @@ type Options<
|
|
|
148
136
|
& IInjectStore
|
|
149
137
|
>
|
|
150
138
|
& ThisType<
|
|
151
|
-
|
|
139
|
+
SubInstance<
|
|
152
140
|
SubMethodsDoc & RootDoc["methods"],
|
|
153
141
|
Replace<SubDataDoc, Required<CurrentCompDoc["properties"]>>, // Replace目的是让setData中的类型与文档中定义的类型一致
|
|
154
142
|
// SubDataDoc,
|
|
@@ -159,7 +147,7 @@ type Options<
|
|
|
159
147
|
>
|
|
160
148
|
>;
|
|
161
149
|
|
|
162
|
-
type
|
|
150
|
+
type SubComponentConstructor<
|
|
163
151
|
TRootDoc extends RootComponentDefinition,
|
|
164
152
|
TOriginalCompDoc extends ComponentDoc,
|
|
165
153
|
// 补充的前缀
|
|
@@ -181,34 +169,34 @@ type CustomComponentConstructor<
|
|
|
181
169
|
& TRootDoc["computed"]
|
|
182
170
|
& TRootDoc["store"],
|
|
183
171
|
> = <
|
|
184
|
-
TInherit extends
|
|
185
|
-
TData extends
|
|
172
|
+
TInherit extends SubInheritConstraint<AllRootDataDoc, CurrentCompDoc>,
|
|
173
|
+
TData extends SubDataConstraint<
|
|
186
174
|
& Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc>
|
|
187
175
|
& Record<InnerFields<CurrentPrefix>, unknown> // 内部字段
|
|
188
176
|
>,
|
|
189
|
-
TStore extends
|
|
177
|
+
TStore extends SubStoreConstraint<
|
|
190
178
|
Required<TRootDoc["properties"]>,
|
|
191
179
|
& Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)>
|
|
192
180
|
& Record<InnerFields<CurrentPrefix>, unknown> // 内部字段
|
|
193
181
|
>,
|
|
194
|
-
TEvents extends
|
|
182
|
+
TEvents extends SubEventsConstraint<CurrentCompDoc>,
|
|
195
183
|
// 加默认值计算字段无提示且需要手写返回类型,不加watch无法对computed监控
|
|
196
|
-
TComputed extends
|
|
184
|
+
TComputed extends SubComputedConstraint<
|
|
197
185
|
& Omit<
|
|
198
186
|
Required<CurrentCompDoc["properties"]>,
|
|
199
187
|
keyof (InheritDoc & DataDoc & StoreDoc)
|
|
200
188
|
>
|
|
201
189
|
& Record<InnerFields<CurrentPrefix>, unknown> // 内部字段
|
|
202
190
|
>,
|
|
203
|
-
TMethods extends
|
|
191
|
+
TMethods extends SubMethodsConstraint = {},
|
|
204
192
|
InheritDoc extends object = IfExtends<
|
|
205
|
-
|
|
193
|
+
SubInheritConstraint<AllRootDataDoc, CurrentCompDoc>,
|
|
206
194
|
TInherit,
|
|
207
195
|
{},
|
|
208
196
|
TInherit
|
|
209
197
|
>,
|
|
210
198
|
DataDoc extends object = IfExtends<
|
|
211
|
-
|
|
199
|
+
SubDataConstraint<
|
|
212
200
|
& Omit<Required<CurrentCompDoc["properties"]>, keyof InheritDoc>
|
|
213
201
|
& Record<InnerFields<CurrentPrefix>, unknown>
|
|
214
202
|
>,
|
|
@@ -217,7 +205,7 @@ type CustomComponentConstructor<
|
|
|
217
205
|
TData
|
|
218
206
|
>,
|
|
219
207
|
StoreDoc extends object = IfExtends<
|
|
220
|
-
|
|
208
|
+
SubStoreConstraint<
|
|
221
209
|
Required<TRootDoc["properties"]>,
|
|
222
210
|
& Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc)>
|
|
223
211
|
& Record<InnerFields<CurrentPrefix>, unknown>
|
|
@@ -228,7 +216,7 @@ type CustomComponentConstructor<
|
|
|
228
216
|
>,
|
|
229
217
|
// 无效的计算
|
|
230
218
|
ComputedDoc extends object = IfExtends<
|
|
231
|
-
|
|
219
|
+
SubComputedConstraint<
|
|
232
220
|
& Omit<
|
|
233
221
|
Required<CurrentCompDoc["properties"]>,
|
|
234
222
|
keyof (InheritDoc & DataDoc & StoreDoc)
|
|
@@ -237,10 +225,10 @@ type CustomComponentConstructor<
|
|
|
237
225
|
>,
|
|
238
226
|
TComputed,
|
|
239
227
|
{},
|
|
240
|
-
|
|
228
|
+
GetSubComputedDoc<TComputed>
|
|
241
229
|
>,
|
|
242
230
|
EventsDoc extends object = IfExtends<
|
|
243
|
-
|
|
231
|
+
SubEventsConstraint<CurrentCompDoc>,
|
|
244
232
|
TEvents,
|
|
245
233
|
{},
|
|
246
234
|
TEvents
|
|
@@ -255,12 +243,12 @@ type CustomComponentConstructor<
|
|
|
255
243
|
& StoreDoc
|
|
256
244
|
// 改用ComputedDoc是会报错的
|
|
257
245
|
& IfExtends<
|
|
258
|
-
|
|
246
|
+
SubComputedConstraint<
|
|
259
247
|
Omit<Required<CurrentCompDoc["properties"]>, keyof (InheritDoc & DataDoc & StoreDoc)>
|
|
260
248
|
>,
|
|
261
249
|
TComputed,
|
|
262
250
|
{},
|
|
263
|
-
|
|
251
|
+
GetSubComputedDoc<TComputed>
|
|
264
252
|
>
|
|
265
253
|
)
|
|
266
254
|
>,
|
|
@@ -287,7 +275,7 @@ type CustomComponentConstructor<
|
|
|
287
275
|
) => IfExtends<
|
|
288
276
|
MissingRequiredField,
|
|
289
277
|
never,
|
|
290
|
-
|
|
278
|
+
CreatSubComponentDoc<
|
|
291
279
|
NonNullable<CurrentCompDoc["events"]>,
|
|
292
280
|
EventsDoc
|
|
293
281
|
>,
|
|
@@ -298,7 +286,7 @@ type CustomComponentConstructor<
|
|
|
298
286
|
* 自定义组件构建函数
|
|
299
287
|
* @returns `(options:) => ComponentDoc`
|
|
300
288
|
*/
|
|
301
|
-
export function
|
|
289
|
+
export function SubComponent<
|
|
302
290
|
TRootComponentDefinition extends RootComponentDefinition,
|
|
303
291
|
TCompDoc extends ComponentDoc,
|
|
304
292
|
Prefix extends string = "",
|
|
@@ -306,7 +294,7 @@ export function CustomComponent<
|
|
|
306
294
|
EmptyObject,
|
|
307
295
|
TCompDoc,
|
|
308
296
|
(opt: EmptyObject) => never,
|
|
309
|
-
|
|
297
|
+
SubComponentConstructor<TRootComponentDefinition, TCompDoc, Prefix>
|
|
310
298
|
> {
|
|
311
299
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
300
|
return ((options: any) => options) as any;
|
|
@@ -7,7 +7,7 @@ import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstrai
|
|
|
7
7
|
import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
|
|
8
8
|
import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type _SubComponentDefinition = {
|
|
11
11
|
composedEvents?: Record<string, unknown>;
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -15,15 +15,15 @@ type _CustomComponentDefinition = {
|
|
|
15
15
|
type _Validator<O, Doc, ErrKeys = Exclude<keyof O, keyof Doc>> = [ErrKeys] extends [never] ? Doc
|
|
16
16
|
: `错误的字段${ErrKeys & string}`;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* SubComponent API 的返回类型
|
|
19
19
|
*/
|
|
20
|
-
export type
|
|
21
|
-
O extends _Validator<O,
|
|
20
|
+
export type SubComponentDefinition<
|
|
21
|
+
O extends _Validator<O, _SubComponentDefinition> = _SubComponentDefinition,
|
|
22
22
|
> = O;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* SubComponent API 返回的运行时类型
|
|
25
25
|
*/
|
|
26
|
-
export type
|
|
26
|
+
export type SubComponentDefinitionRuntime = {
|
|
27
27
|
inhrit?: string;
|
|
28
28
|
data?: DataConstraint;
|
|
29
29
|
computed?: ComputedConstraint;
|
|
@@ -37,4 +37,3 @@ export type CustomComponentDefinitionRuntime = {
|
|
|
37
37
|
| PageLifetimesOption<false, object>["pageLifetimes"]
|
|
38
38
|
| PageLifetimesOption<true, object>["pageLifetimes"];
|
|
39
39
|
};
|
|
40
|
-
// import type { CustomComponentRuntime } from "../CustomComponent";
|
package/src/index.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";
|
|
@@ -33,9 +32,7 @@ export type {
|
|
|
33
32
|
} from "./types/OfficialTypeAlias";
|
|
34
33
|
|
|
35
34
|
export {
|
|
36
|
-
ChunkComponent,
|
|
37
35
|
type CreateComponentType,
|
|
38
|
-
CustomComponent,
|
|
39
36
|
DefineComponent,
|
|
40
37
|
type DetailedType,
|
|
41
38
|
type ExtendComponentType,
|
|
@@ -45,4 +42,5 @@ export {
|
|
|
45
42
|
navigateTo,
|
|
46
43
|
redirectTo,
|
|
47
44
|
RootComponent,
|
|
45
|
+
SubComponent,
|
|
48
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SubComponent, typeEqual } from "../../index";
|
|
2
2
|
import type { Wm } from "../index";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
SubComponent<{}, Wm.Swiper>()({
|
|
5
5
|
data: {
|
|
6
6
|
swiper_style: "16/9",
|
|
7
7
|
},
|
package/tsconfig.json
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": ["ES2022", "DOM"], // jest中用到了DOM类型
|
|
4
4
|
"target": "ES2017",
|
|
5
|
-
"module": "
|
|
6
|
-
"moduleResolution": "
|
|
5
|
+
"module": "es2022",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
7
|
"skipLibCheck": true, // 跳过声明文件的类型检查(.d.ts),你引用的依然会检查, 默认false(不跳过)。
|
|
8
8
|
"esModuleInterop": true, // 默认false. 兼容非ES模块引用的写法(如 import fs from 'fs').
|
|
9
9
|
"allowSyntheticDefaultImports": true, // 默认false. 允许从没有设置默认导出的模块中默认导入。
|
|
10
|
+
"verbatimModuleSyntax": true, // 保留原始import/export语法, 与ESM写法一致。
|
|
10
11
|
"strict": true,
|
|
11
12
|
"noEmit": true, // 不生成输出文件。
|
|
12
13
|
// "resolveJsonModule": true, // 允许导入json模块。
|
|
@@ -16,7 +17,6 @@
|
|
|
16
17
|
"exactOptionalPropertyTypes": true, // 带有?标志的属性类型不在包含undefined类型
|
|
17
18
|
"noImplicitReturns": true, // 当启用时,TypeScript会检查函数中的所有代码路径,以确保它们返回值
|
|
18
19
|
"isolatedModules": true, // 模块化(.ts文件必须有导入或导出) 默认false
|
|
19
|
-
// "verbatimModuleSyntax": true, // 5.0后新增配置,替代preserveValueImports。
|
|
20
20
|
"types": ["hry-types", "mobx", "jest", "miniprogram-api-typings", "node"]
|
|
21
21
|
},
|
|
22
22
|
"include": ["src/**/*.ts", "jest/**/*.ts"],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ChunkComputedConstraint = Record<string, () => void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChunkComputedConstraint.js","sourceRoot":"","sources":["../../../../src/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
|
-
import type { Validators } from "../../../types/Validators";
|
|
3
|
-
import type { ValidatorPrefix } from "../ChunkData/validatePrefix";
|
|
4
|
-
import type { ChunkComputedConstraint } from "./ChunkComputedConstraint";
|
|
5
|
-
export type ChunkComputedOption<TComputed extends ChunkComputedConstraint, CompareKeys extends PropertyKey, TPrefix extends string> = {
|
|
6
|
-
computed?: TComputed & Validators<[
|
|
7
|
-
G.DuplicateFieldValidator<TComputed, CompareKeys, "字段重复">,
|
|
8
|
-
ValidatorPrefix<TComputed, TPrefix>
|
|
9
|
-
]>;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChunkComputedOption.js","sourceRoot":"","sources":["../../../../src/api/ChunkComponent/ChunkComputed/ChunkComputedOption.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
|
-
import type { Validators } from "../../../types/Validators";
|
|
3
|
-
import type { ValidatorPrefix } from "./validatePrefix";
|
|
4
|
-
export type ChunkDataOption<TData extends object, TDuplicateKeys extends PropertyKey, Prefix extends string> = {
|
|
5
|
-
data?: TData & Validators<[
|
|
6
|
-
G.DuplicateFieldValidator<TData, TDuplicateKeys, "字段重复">,
|
|
7
|
-
ValidatorPrefix<TData, Prefix>
|
|
8
|
-
]>;
|
|
9
|
-
};
|