annil 1.16.0 → 1.18.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/README.md +38 -169
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.d.ts +1 -0
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js +2 -0
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js.map +1 -0
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.d.ts +10 -0
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js +2 -0
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js.map +1 -0
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.d.ts +9 -0
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js +2 -0
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js.map +1 -0
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.d.ts +2 -0
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js +2 -0
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js.map +1 -0
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.d.ts +10 -0
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js +2 -0
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js.map +1 -0
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.d.ts +2 -0
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js +2 -0
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js.map +1 -0
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.d.ts +12 -0
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js +2 -0
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js.map +1 -0
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.d.ts +2 -0
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js +2 -0
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js.map +1 -0
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.d.ts +10 -0
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js +2 -0
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js.map +1 -0
- package/dist/api/ChunkComponent/SlotComponentReturnType.d.ts +20 -0
- package/dist/api/ChunkComponent/SlotComponentReturnType.js +2 -0
- package/dist/api/ChunkComponent/SlotComponentReturnType.js.map +1 -0
- package/dist/api/ChunkComponent/index.d.ts +24 -0
- package/dist/api/ChunkComponent/index.js +4 -0
- package/dist/api/ChunkComponent/index.js.map +1 -0
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.d.ts +3 -0
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js +2 -0
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js.map +1 -0
- package/dist/api/{SubComponent/SubComputed/SubComputedOption.d.ts → CustomComponent/CustomComputed/CustomComputedOption.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js +2 -0
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js.map +1 -0
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.d.ts +3 -0
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js +2 -0
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js.map +1 -0
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.d.ts +3 -0
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js +2 -0
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js.map +1 -0
- package/dist/api/{SubComponent/SubData/SubDataOption.d.ts → CustomComponent/CustomData/CustomDataOption.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js +2 -0
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js.map +1 -0
- package/dist/api/{SubComponent/SubEvents/SubEventsConstraint.d.ts → CustomComponent/CustomEvents/CustomEventsConstraint.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js +2 -0
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js.map +1 -0
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.d.ts +4 -0
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js +2 -0
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js.map +1 -0
- package/dist/api/{SubComponent/SubInherit/SubInheritConstraint.d.ts → CustomComponent/CustomInherit/CustomInheritConstraint.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js +2 -0
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js.map +1 -0
- package/dist/api/{SubComponent/SubInherit/SubInheritOption.d.ts → CustomComponent/CustomInherit/CustomInheritOption.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js +2 -0
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js.map +1 -0
- package/dist/api/CustomComponent/CustomInstance/CustomInstance.d.ts +2 -0
- package/dist/api/CustomComponent/CustomInstance/CustomInstance.js +2 -0
- package/dist/api/CustomComponent/CustomInstance/CustomInstance.js.map +1 -0
- package/dist/api/{SubComponent/SubLifetimes/SubLifetimesOption.d.ts → CustomComponent/CustomLifetimes/CustomLifetimesOption.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomLifetimes/CustomLifetimesOption.js +2 -0
- package/dist/api/CustomComponent/CustomLifetimes/CustomLifetimesOption.js.map +1 -0
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.d.ts +2 -0
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js +2 -0
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js.map +1 -0
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.d.ts +5 -0
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js +2 -0
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js.map +1 -0
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.d.ts +2 -0
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js +2 -0
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js.map +1 -0
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.d.ts +2 -0
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js +2 -0
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js.map +1 -0
- package/dist/api/{SubComponent/SubReturnType/CreateSubComponentDoc.d.ts → CustomComponent/CustomReturnType/CreateCustomComponentDoc.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js +2 -0
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js.map +1 -0
- package/dist/api/{SubComponent/SubStore/SubStoreConstraint.d.ts → CustomComponent/CustomStore/CustomStoreConstraint.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js +2 -0
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js.map +1 -0
- package/dist/api/{SubComponent/SubStore/SubStoreOption.d.ts → CustomComponent/CustomStore/CustomStoreOption.d.ts} +1 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js +2 -0
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js.map +1 -0
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.d.ts +2 -0
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js +2 -0
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js.map +1 -0
- package/dist/api/CustomComponent/index.d.ts +49 -0
- package/dist/api/CustomComponent/index.js +4 -0
- package/dist/api/CustomComponent/index.js.map +1 -0
- package/dist/api/{SubComponent → CustomComponent}/returnType.d.ts +3 -3
- package/dist/api/CustomComponent/returnType.js.map +1 -0
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +2 -2
- package/dist/api/DefineComponent/index.d.ts +4 -4
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.d.ts +3 -2
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js +3 -3
- package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js +1 -2
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.d.ts +3 -2
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.js +1 -2
- package/dist/api/DefineComponent/normalizeOptions/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 +3 -2
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js +1 -2
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/getPathsValue.js +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/getPathsValue.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +3 -4
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js.map +1 -1
- package/dist/api/DefineComponent/returnType/ComponentDoc.d.ts +1 -4
- package/dist/api/DefineComponent/returnType/GenerateComponentDoc.d.ts +3 -3
- 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 +1 -3
- package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
- package/dist/api/RootComponent/Events/EventsConstraint.d.ts +9 -7
- package/dist/api/RootComponent/index.d.ts +6 -5
- package/dist/api/RootComponent/index.js.map +1 -1
- package/dist/behaviors/BbeforeCreated.d.ts +1 -1
- package/dist/behaviors/BthrottleDebounce.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/thirdLib/vant/Button.d.ts +2 -2
- package/dist/thirdLib/vant/NoticeBar.d.ts +2 -2
- package/dist/thirdLib/vant/Popup.d.ts +2 -2
- package/dist/thirdLib/wm/Textarea.d.ts +2 -2
- package/dist/thirdLib/wm/map.d.ts +2 -2
- package/dist/thirdLib/wm/scrollView.d.ts +2 -2
- package/dist/thirdLib/wm/swiper.d.ts +2 -2
- package/dist/thirdLib/wm/view.d.ts +2 -2
- package/dist/types/{CreateComponentType.d.ts → CreateComponentDoc.d.ts} +5 -2
- package/dist/types/CreateComponentDoc.js +2 -0
- package/dist/types/CreateComponentDoc.js.map +1 -0
- package/dist/utils/nonNullable.js +1 -1
- package/dist/utils/nonNullable.js.map +1 -1
- package/package.json +8 -11
- package/CHANGELOG.md +0 -943
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.d.ts +0 -3
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js +0 -2
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js.map +0 -1
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.d.ts +0 -3
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js +0 -2
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js.map +0 -1
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js +0 -2
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js.map +0 -1
- package/dist/api/SubComponent/SubData/SubDataConstraint.d.ts +0 -3
- package/dist/api/SubComponent/SubData/SubDataConstraint.js +0 -2
- package/dist/api/SubComponent/SubData/SubDataConstraint.js.map +0 -1
- package/dist/api/SubComponent/SubData/SubDataOption.js +0 -2
- package/dist/api/SubComponent/SubData/SubDataOption.js.map +0 -1
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js +0 -2
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js.map +0 -1
- package/dist/api/SubComponent/SubEvents/SubEventsOption.d.ts +0 -4
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js +0 -2
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js.map +0 -1
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js +0 -2
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js.map +0 -1
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js +0 -2
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js.map +0 -1
- package/dist/api/SubComponent/SubInstance/SubInstance.d.ts +0 -2
- package/dist/api/SubComponent/SubInstance/SubInstance.js +0 -2
- package/dist/api/SubComponent/SubInstance/SubInstance.js.map +0 -1
- package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js +0 -2
- package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js.map +0 -1
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.d.ts +0 -2
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js +0 -2
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js.map +0 -1
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.d.ts +0 -5
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js +0 -2
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js.map +0 -1
- package/dist/api/SubComponent/SubObservers/SubObserversOption.d.ts +0 -2
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js +0 -2
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js.map +0 -1
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.d.ts +0 -2
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js +0 -2
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js.map +0 -1
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js +0 -2
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js.map +0 -1
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js +0 -2
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js.map +0 -1
- package/dist/api/SubComponent/SubStore/SubStoreOption.js +0 -2
- package/dist/api/SubComponent/SubStore/SubStoreOption.js.map +0 -1
- package/dist/api/SubComponent/SubWatch/SubWatchOption.d.ts +0 -2
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js +0 -2
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js.map +0 -1
- package/dist/api/SubComponent/index.d.ts +0 -49
- package/dist/api/SubComponent/index.js +0 -4
- package/dist/api/SubComponent/index.js.map +0 -1
- package/dist/api/SubComponent/returnType.js.map +0 -1
- package/dist/types/CreateComponentType.js +0 -2
- package/dist/types/CreateComponentType.js.map +0 -1
- package/dist/types/ExtendComponentType.d.ts +0 -7
- package/dist/types/ExtendComponentType.js +0 -2
- package/dist/types/ExtendComponentType.js.map +0 -1
- package/dist/types/RemoveNullOfRequired.d.ts +0 -4
- package/dist/types/RemoveNullOfRequired.js +0 -2
- package/dist/types/RemoveNullOfRequired.js.map +0 -1
- package/src/api/DefineComponent/NameOrPath/NameOrPathOption.ts +0 -31
- package/src/api/DefineComponent/NameOrPath/test/error.test.ts +0 -32
- package/src/api/DefineComponent/NameOrPath/test/normal.test.ts +0 -13
- package/src/api/DefineComponent/RootComponent/RootComponentOption.ts +0 -11
- package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +0 -13
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +0 -1049
- package/src/api/DefineComponent/index.ts +0 -58
- package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +0 -29
- package/src/api/DefineComponent/normalizeOptions/customEventsHandle.ts +0 -55
- package/src/api/DefineComponent/normalizeOptions/handleRootComponent.ts +0 -33
- package/src/api/DefineComponent/normalizeOptions/handleStore/disposeStore.ts +0 -10
- package/src/api/DefineComponent/normalizeOptions/handleStore/initStore.ts +0 -9
- package/src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts +0 -70
- package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +0 -23
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/addDetachedData.ts +0 -10
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/hijack.ts +0 -26
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +0 -57
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.ts +0 -22
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts +0 -25
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.ts +0 -33
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/pagePathCheck.ts +0 -9
- package/src/api/DefineComponent/normalizeOptions/index.ts +0 -143
- package/src/api/DefineComponent/normalizeOptions/initComputed/computedUpdater.ts +0 -51
- package/src/api/DefineComponent/normalizeOptions/initComputed/data-tracer.ts +0 -62
- package/src/api/DefineComponent/normalizeOptions/initComputed/dependencesOptimize.ts +0 -45
- package/src/api/DefineComponent/normalizeOptions/initComputed/index.ts +0 -42
- package/src/api/DefineComponent/normalizeOptions/initComputed/initComputedAndGetCache.ts +0 -105
- package/src/api/DefineComponent/normalizeOptions/injectInfoHandler.ts +0 -51
- package/src/api/DefineComponent/normalizeOptions/internalFieldProtection.ts +0 -27
- package/src/api/DefineComponent/normalizeOptions/otherFieldsHandle.ts +0 -29
- package/src/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.ts +0 -23
- package/src/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.ts +0 -36
- package/src/api/DefineComponent/normalizeOptions/watchHandler/getPathsValue.ts +0 -31
- package/src/api/DefineComponent/normalizeOptions/watchHandler/getPropertiesValue.ts +0 -51
- package/src/api/DefineComponent/normalizeOptions/watchHandler/hasComputedPath.ts +0 -9
- package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +0 -78
- package/src/api/DefineComponent/returnType/ComponentDoc.ts +0 -25
- package/src/api/DefineComponent/returnType/GenerateComponentDoc.ts +0 -46
- package/src/api/DefineComponent/returnType/GeneratePageDoc.ts +0 -22
- package/src/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.ts +0 -24
- package/src/api/DefineComponent/returnType/GetPropertiesDocOfSubDoc.ts +0 -7
- package/src/api/DefineComponent/returnType/PageDoc.ts +0 -19
- package/src/api/DefineComponent/returnType/test/normalComponentDoc.test.ts +0 -248
- package/src/api/DefineComponent/returnType/test/normalPageDoc.test.ts +0 -49
- package/src/api/InstanceInject/inject.ts +0 -36
- package/src/api/InstanceInject/instanceConfig.ts +0 -50
- package/src/api/InstanceInject/test/normal.test.ts +0 -41
- package/src/api/RootComponent/Computed/ComputedConstraint.ts +0 -4
- package/src/api/RootComponent/Computed/ComputedOption.ts +0 -35
- package/src/api/RootComponent/Computed/GetComputedDef.ts +0 -10
- package/src/api/RootComponent/Computed/test/GetComputedDoc.test.ts +0 -25
- package/src/api/RootComponent/Computed/test/error.test.ts +0 -50
- package/src/api/RootComponent/Computed/test/normal.test.ts +0 -124
- package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +0 -89
- package/src/api/RootComponent/CustomEvents/CustomEventsDef.ts +0 -4
- package/src/api/RootComponent/CustomEvents/CustomEventsDoc.ts +0 -4
- package/src/api/RootComponent/CustomEvents/CustomEventsOption.ts +0 -41
- package/src/api/RootComponent/CustomEvents/CustomEventsTag.ts +0 -59
- package/src/api/RootComponent/CustomEvents/GetCustomEventDef.ts +0 -29
- package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +0 -47
- package/src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts +0 -38
- package/src/api/RootComponent/CustomEvents/test/GetFullEventDoc.test.ts +0 -57
- package/src/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.ts +0 -36
- package/src/api/RootComponent/CustomEvents/test/error.test.ts +0 -101
- package/src/api/RootComponent/CustomEvents/test/normal.test.ts +0 -99
- package/src/api/RootComponent/Data/DataConstraint.ts +0 -1
- package/src/api/RootComponent/Data/DataOption.ts +0 -25
- package/src/api/RootComponent/Data/GetDataDef.ts +0 -8
- package/src/api/RootComponent/Data/GetDataDoc.ts +0 -8
- package/src/api/RootComponent/Data/test/GetDataDoc.test.ts +0 -32
- package/src/api/RootComponent/Data/test/error.test.ts +0 -14
- package/src/api/RootComponent/Data/test/normal.test.ts +0 -33
- package/src/api/RootComponent/Events/EventsConstraint.ts +0 -74
- package/src/api/RootComponent/Events/EventsOption.ts +0 -55
- package/src/api/RootComponent/Events/test/normal.test.ts +0 -161
- package/src/api/RootComponent/Instance/CustomEventMethods.ts +0 -11
- package/src/api/RootComponent/Instance/CustomSetData.ts +0 -17
- package/src/api/RootComponent/Instance/RootComponentInstance.ts +0 -46
- package/src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts +0 -70
- package/src/api/RootComponent/Instance/test/CustomSetData.test.ts +0 -44
- package/src/api/RootComponent/Instance/test/customEvents/error.test.ts +0 -13
- package/src/api/RootComponent/Instance/test/customEvents/normal.test.ts +0 -71
- package/src/api/RootComponent/Instance/test/methods/error.test.ts +0 -14
- package/src/api/RootComponent/Instance/test/methods/mormal.test.ts +0 -18
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +0 -58
- package/src/api/RootComponent/Instance/test/setData/error.test.ts +0 -65
- package/src/api/RootComponent/Instance/test/setData/normal.test.ts +0 -51
- package/src/api/RootComponent/IsPage/IsPageOption.ts +0 -6
- package/src/api/RootComponent/IsPage/test/normal.test.ts +0 -29
- package/src/api/RootComponent/Lifetimes/LifetimesConstraint.ts +0 -14
- package/src/api/RootComponent/Lifetimes/LifetimesOption.ts +0 -31
- package/src/api/RootComponent/Lifetimes/test/error.test.ts +0 -31
- package/src/api/RootComponent/Lifetimes/test/normal.test.ts +0 -34
- package/src/api/RootComponent/Methods/MethodsConstraint.ts +0 -3
- package/src/api/RootComponent/Methods/MethodsOption.ts +0 -15
- package/src/api/RootComponent/Methods/test/error.test.ts +0 -41
- package/src/api/RootComponent/Methods/test/mormal.test.ts +0 -25
- package/src/api/RootComponent/Observers/ObserversOption.ts +0 -58
- package/src/api/RootComponent/Observers/test/normal.test.ts +0 -30
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +0 -29
- package/src/api/RootComponent/PageLifetimes/test/error.test.ts +0 -37
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +0 -71
- package/src/api/RootComponent/Properties/GetOptionalDef.ts +0 -18
- package/src/api/RootComponent/Properties/GetPropertiesDef.ts +0 -22
- package/src/api/RootComponent/Properties/GetRequiredDef.ts +0 -16
- package/src/api/RootComponent/Properties/PropertiesConstraint.ts +0 -38
- package/src/api/RootComponent/Properties/PropertiesOption.ts +0 -25
- package/src/api/RootComponent/Properties/PropertiesValueValidator.ts +0 -21
- package/src/api/RootComponent/Properties/test/error.test.ts +0 -49
- package/src/api/RootComponent/Properties/test/normalEmpty.test.ts +0 -42
- package/src/api/RootComponent/Properties/test/normalOptional.test.ts +0 -118
- package/src/api/RootComponent/Properties/test/normalRequired.test.ts +0 -107
- package/src/api/RootComponent/Store/GetStoreDef.ts +0 -34
- package/src/api/RootComponent/Store/StoreConstraint.ts +0 -2
- package/src/api/RootComponent/Store/StoreOption.ts +0 -53
- package/src/api/RootComponent/Store/test/error.test.ts +0 -30
- package/src/api/RootComponent/Store/test/normal.test.ts +0 -35
- package/src/api/RootComponent/Watch/WatchOption.ts +0 -67
- package/src/api/RootComponent/Watch/test/WatchComputed.test.ts +0 -40
- package/src/api/RootComponent/Watch/test/WatchData.test.ts +0 -55
- package/src/api/RootComponent/Watch/test/WatchProperties.test.ts +0 -170
- package/src/api/RootComponent/Watch/test/WtachInject.test.ts +0 -16
- package/src/api/RootComponent/Watch/test/error.test.ts +0 -54
- package/src/api/RootComponent/index.ts +0 -151
- package/src/api/RootComponent/returnType.ts +0 -57
- package/src/api/SubComponent/SubComputed/GetSubComputedDoc.ts +0 -4
- package/src/api/SubComponent/SubComputed/SubComputedConstraint.ts +0 -1
- package/src/api/SubComponent/SubComputed/SubComputedOption.ts +0 -11
- package/src/api/SubComponent/SubComputed/test/error.test.ts +0 -88
- package/src/api/SubComponent/SubComputed/test/normal.test.ts +0 -207
- package/src/api/SubComponent/SubData/SubDataConstraint.ts +0 -9
- package/src/api/SubComponent/SubData/SubDataOption.ts +0 -17
- package/src/api/SubComponent/SubData/test/error.test.ts +0 -64
- package/src/api/SubComponent/SubData/test/normal.test.ts +0 -91
- package/src/api/SubComponent/SubEvents/SubEventsConstraint.ts +0 -27
- package/src/api/SubComponent/SubEvents/SubEventsOption.ts +0 -12
- package/src/api/SubComponent/SubEvents/test/error.test.ts +0 -36
- package/src/api/SubComponent/SubEvents/test/normal.test.ts +0 -209
- package/src/api/SubComponent/SubInherit/SubInheritConstraint.ts +0 -17
- package/src/api/SubComponent/SubInherit/SubInheritOption.ts +0 -15
- package/src/api/SubComponent/SubInherit/test/error.test.ts +0 -84
- package/src/api/SubComponent/SubInherit/test/normal.test.ts +0 -81
- package/src/api/SubComponent/SubInstance/SubInstance.ts +0 -9
- package/src/api/SubComponent/SubInstance/test/error.test.ts +0 -22
- package/src/api/SubComponent/SubInstance/test/normal.test.ts +0 -87
- package/src/api/SubComponent/SubLifetimes/SubLifetimesOption.ts +0 -3
- package/src/api/SubComponent/SubMethods/SubMethodsConstraint.ts +0 -3
- package/src/api/SubComponent/SubMethods/SubMethodsOption.ts +0 -17
- package/src/api/SubComponent/SubMethods/test/error.test.ts +0 -51
- package/src/api/SubComponent/SubMethods/test/normarl.test.ts +0 -33
- package/src/api/SubComponent/SubObservers/SubObserversOption.ts +0 -3
- package/src/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.ts +0 -6
- package/src/api/SubComponent/SubPageLifetimes/test/error.test.ts +0 -1
- package/src/api/SubComponent/SubPageLifetimes/test/normal.test.ts +0 -1
- package/src/api/SubComponent/SubReturnType/CreateSubComponentDoc.ts +0 -41
- package/src/api/SubComponent/SubReturnType/test/error.test.ts +0 -18
- package/src/api/SubComponent/SubReturnType/test/normal.test.ts +0 -98
- package/src/api/SubComponent/SubStore/SubStoreConstraint.ts +0 -13
- package/src/api/SubComponent/SubStore/SubStoreOption.ts +0 -32
- package/src/api/SubComponent/SubStore/test/error.test.ts +0 -60
- package/src/api/SubComponent/SubStore/test/normal.test.ts +0 -43
- package/src/api/SubComponent/SubWatch/SubWatchOption.ts +0 -3
- package/src/api/SubComponent/SubWatch/test/WatchComputed.test.ts +0 -90
- package/src/api/SubComponent/SubWatch/test/WatchProperties.test.ts +0 -151
- package/src/api/SubComponent/SubWatch/test/WatchRootData.test.ts +0 -122
- package/src/api/SubComponent/SubWatch/test/WatchSubData.test.ts +0 -49
- package/src/api/SubComponent/SubWatch/test/WtachInject.test.ts +0 -16
- package/src/api/SubComponent/SubWatch/test/error.test.ts +0 -60
- package/src/api/SubComponent/index.ts +0 -301
- package/src/api/SubComponent/returnType.ts +0 -39
- package/src/api/wxSugar.ts +0 -107
- package/src/behaviors/BbeforeCreated.ts +0 -18
- package/src/behaviors/BthrottleDebounce.ts +0 -28
- package/src/index.ts +0 -46
- package/src/thirdLib/index.ts +0 -3
- package/src/thirdLib/vant/Button.ts +0 -23
- package/src/thirdLib/vant/NoticeBar.ts +0 -32
- package/src/thirdLib/vant/Popup.ts +0 -70
- package/src/thirdLib/vant/index.ts +0 -5
- package/src/thirdLib/wm/Textarea.ts +0 -117
- package/src/thirdLib/wm/baseEvents.ts +0 -54
- package/src/thirdLib/wm/index.ts +0 -9
- package/src/thirdLib/wm/map.ts +0 -266
- package/src/thirdLib/wm/scrollView.ts +0 -86
- package/src/thirdLib/wm/swiper.test.ts +0 -22
- package/src/thirdLib/wm/swiper.ts +0 -111
- package/src/thirdLib/wm/view.ts +0 -28
- package/src/types/AddNullForObject.ts +0 -6
- package/src/types/AddPrefix.ts +0 -10
- package/src/types/Assert.ts +0 -1
- package/src/types/Assign.ts +0 -1
- package/src/types/ComputeObject.ts +0 -1
- package/src/types/CreateComponentType.ts +0 -37
- package/src/types/DetailedType.ts +0 -15
- package/src/types/ExtendComponentType.ts +0 -60
- package/src/types/Extra.ts +0 -1
- package/src/types/GetComponentPrefix.ts +0 -36
- package/src/types/GetPropertiesDuplicatedKeys.ts +0 -14
- package/src/types/Has.ts +0 -1
- package/src/types/InferDetailedType.test.ts +0 -13
- package/src/types/InferDetailedType.ts +0 -12
- package/src/types/InnerData.ts +0 -1
- package/src/types/ListOfSamePrimitive.ts +0 -20
- package/src/types/OfficialTypeAlias.ts +0 -107
- package/src/types/RemoveInnerData.ts +0 -5
- package/src/types/RemoveNever.ts +0 -6
- package/src/types/RemoveNullOfRequired.ts +0 -8
- package/src/types/RemovePrefix.ts +0 -3
- package/src/types/Replace.ts +0 -24
- package/src/types/ReplacePrefix.ts +0 -46
- package/src/types/RequiredKeys.ts +0 -8
- package/src/types/Shift.ts +0 -2
- package/src/types/TwoParamsEqual.ts +0 -3
- package/src/types/UnionToComma.test.ts +0 -9
- package/src/types/Validators.ts +0 -17
- package/src/types/includes.ts +0 -3
- package/src/utils/InnerMarker.ts +0 -3
- package/src/utils/_utils.ts +0 -8
- package/src/utils/applyDebounceAndThrottle.ts +0 -31
- package/src/utils/debounce.ts +0 -22
- package/src/utils/deepClone.ts +0 -20
- package/src/utils/deepEqual.ts +0 -32
- package/src/utils/isEmptyObject.ts +0 -14
- package/src/utils/nonNullable.ts +0 -20
- package/src/utils/throttle.ts +0 -24
- package/src/utils/typeEqual.ts +0 -30
- package/src/utils/typeNotEqual.ts +0 -48
- package/tsconfig.json +0 -24
- /package/dist/api/{SubComponent → CustomComponent}/returnType.js +0 -0
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
-
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
3
|
-
import type { WMCompPageLifetimes, WMPageLifetimes } from "../../../types/OfficialTypeAlias";
|
|
4
|
-
|
|
5
|
-
export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends object> = IfExtends<
|
|
6
|
-
TIsPage,
|
|
7
|
-
false,
|
|
8
|
-
{
|
|
9
|
-
pageLifetimes?: Partial<WMCompPageLifetimes>;
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
/**
|
|
13
|
-
* 官方要求写入methods中的页面生命周期
|
|
14
|
-
*/
|
|
15
|
-
pageLifetimes?: ComputeIntersection<
|
|
16
|
-
& Partial<Omit<WMPageLifetimes, "onLoad">>
|
|
17
|
-
// 替换掉官方的 Parameters<WechatMiniprogram.Page.ILifetime['onLoad']>
|
|
18
|
-
& {
|
|
19
|
-
/** 生命周期回调—监听页面加载
|
|
20
|
-
*
|
|
21
|
-
* 页面加载时触发。一个页面只会调用一次,可以在 onLoad 的参数中获取Properties定义的数据。
|
|
22
|
-
*/
|
|
23
|
-
onLoad?: (
|
|
24
|
-
props: Required<PropertiesDoc>,
|
|
25
|
-
) => void | Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
>;
|
|
28
|
-
}
|
|
29
|
-
>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { RootComponent } from "../..";
|
|
2
|
-
/**
|
|
3
|
-
* 组件时 非法字段错误
|
|
4
|
-
*/
|
|
5
|
-
RootComponent()({
|
|
6
|
-
pageLifetimes: {
|
|
7
|
-
show() {
|
|
8
|
-
void 0;
|
|
9
|
-
},
|
|
10
|
-
hide() {
|
|
11
|
-
void 0;
|
|
12
|
-
},
|
|
13
|
-
resize() {
|
|
14
|
-
void 0;
|
|
15
|
-
},
|
|
16
|
-
// @ts-expect-error 1 错误的声明周期
|
|
17
|
-
xxx() {
|
|
18
|
-
void 0;
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 页面时
|
|
25
|
-
*/
|
|
26
|
-
RootComponent()({
|
|
27
|
-
isPage: true,
|
|
28
|
-
pageLifetimes: {
|
|
29
|
-
onLoad(props) {
|
|
30
|
-
void props;
|
|
31
|
-
},
|
|
32
|
-
// @ts-expect-error 2 错误的声明周期
|
|
33
|
-
xxx() {
|
|
34
|
-
void 0;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import { type DetailedType, RootComponent } from "../../../..";
|
|
3
|
-
|
|
4
|
-
import type { Mock_User } from "../../Properties/test/normalRequired.test";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 组件时
|
|
8
|
-
*/
|
|
9
|
-
RootComponent()({
|
|
10
|
-
pageLifetimes: {
|
|
11
|
-
hide() {
|
|
12
|
-
void 0;
|
|
13
|
-
},
|
|
14
|
-
resize(size) {
|
|
15
|
-
void size;
|
|
16
|
-
void Checking<typeof size, WechatMiniprogram.Page.IResizeOption, Test.Pass>;
|
|
17
|
-
},
|
|
18
|
-
show() {
|
|
19
|
-
void 0;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 页面时
|
|
26
|
-
*/
|
|
27
|
-
RootComponent()({
|
|
28
|
-
isPage: true,
|
|
29
|
-
properties: {
|
|
30
|
-
str: String,
|
|
31
|
-
obj: Object,
|
|
32
|
-
union: {
|
|
33
|
-
type: Object as DetailedType<Mock_User>,
|
|
34
|
-
value: { id: "001", name: "zhao" },
|
|
35
|
-
},
|
|
36
|
-
optionalObject: {
|
|
37
|
-
type: Object as DetailedType<Mock_User | null>,
|
|
38
|
-
value: null,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
// 2 官方是把事件写在methods字段中,更改为写在pageLifetimes字段下
|
|
42
|
-
pageLifetimes: {
|
|
43
|
-
// 3 重写onLoad周期参数props的类型(同页面properties定义类型).
|
|
44
|
-
onLoad(props) {
|
|
45
|
-
void props;
|
|
46
|
-
void Checking<
|
|
47
|
-
typeof props,
|
|
48
|
-
{
|
|
49
|
-
union: Mock_User;
|
|
50
|
-
optionalObject: Mock_User | null;
|
|
51
|
-
str: string;
|
|
52
|
-
obj: object;
|
|
53
|
-
},
|
|
54
|
-
Test.Pass
|
|
55
|
-
>;
|
|
56
|
-
},
|
|
57
|
-
onHide() {
|
|
58
|
-
console.log("onHide");
|
|
59
|
-
},
|
|
60
|
-
// onReady
|
|
61
|
-
// onResize
|
|
62
|
-
// onUnload
|
|
63
|
-
// onPageScroll
|
|
64
|
-
// onPullDownRefresh
|
|
65
|
-
// onReachBottom
|
|
66
|
-
// onShareAppMessage
|
|
67
|
-
// onShareTimeline
|
|
68
|
-
// onTabItemTap
|
|
69
|
-
// ...
|
|
70
|
-
},
|
|
71
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
-
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
3
|
-
import type { OptionalType } from "./PropertiesConstraint";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 获取properties可传字段文档类型
|
|
7
|
-
*/
|
|
8
|
-
export type GetOptionalDef<
|
|
9
|
-
TOptionalProperties extends Record<string, OptionalType>,
|
|
10
|
-
> = {
|
|
11
|
-
-readonly [k in keyof TOptionalProperties]?: IfExtends<
|
|
12
|
-
unknown,
|
|
13
|
-
TOptionalProperties[k]["optionalTypes"],
|
|
14
|
-
InferDetailedType<TOptionalProperties[k]["type"]>,
|
|
15
|
-
| InferDetailedType<TOptionalProperties[k]["type"]>
|
|
16
|
-
| InferDetailedType<(TOptionalProperties[k]["optionalTypes"] & {})[number]>
|
|
17
|
-
>;
|
|
18
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Select } from "hry-types/src/Object/Select";
|
|
2
|
-
|
|
3
|
-
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
4
|
-
import type { GetOptionalDef } from "./GetOptionalDef";
|
|
5
|
-
|
|
6
|
-
import type { As } from "hry-types/src/Any/As";
|
|
7
|
-
import type { GetRequiredDef } from "./GetRequiredDef";
|
|
8
|
-
import type { OptionalType, PropertiesConstraint, RequiredType } from "./PropertiesConstraint";
|
|
9
|
-
|
|
10
|
-
type _GetPropertiesDef<
|
|
11
|
-
TProperties extends PropertiesConstraint,
|
|
12
|
-
OptionalDef extends object = GetOptionalDef<As<Select<TProperties, OptionalType>, Record<string, OptionalType>>>,
|
|
13
|
-
RequiredDef extends object = GetRequiredDef<As<Omit<TProperties, keyof OptionalDef>, Record<string, RequiredType>>>,
|
|
14
|
-
> = ComputeIntersection<OptionalDef & RequiredDef>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* properties字段的文档类型
|
|
18
|
-
* @remarks 必传的字段如果是object,要联合上null类型,选传的object根据是否是页面来决定是否加null
|
|
19
|
-
*/
|
|
20
|
-
export type GetPropertiesDef<
|
|
21
|
-
TProperties extends PropertiesConstraint,
|
|
22
|
-
> = _GetPropertiesDef<TProperties>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
2
|
-
import type { RequiredSingle, RequiredType, RequiredUnion } from "./PropertiesConstraint";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 获取properties必传字段的文档类型
|
|
6
|
-
* @remarks 小程序中必传字段如果是object,默认类型为null,所以组件文档对象类型要联合上null类型
|
|
7
|
-
*/
|
|
8
|
-
export type GetRequiredDef<
|
|
9
|
-
TProperties extends Record<string, RequiredType>,
|
|
10
|
-
> = {
|
|
11
|
-
-readonly [k in keyof TProperties]: TProperties[k] extends RequiredSingle ? InferDetailedType<TProperties[k]>
|
|
12
|
-
: TProperties[k] extends RequiredUnion ?
|
|
13
|
-
| InferDetailedType<TProperties[k]["type"]>
|
|
14
|
-
| InferDetailedType<TProperties[k]["optionalTypes"][number]>
|
|
15
|
-
: never;
|
|
16
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { DetailedType } from "../../../types/DetailedType";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* properties 必传(单一)类型
|
|
5
|
-
*/
|
|
6
|
-
export type RequiredSingle = DetailedType;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* properties 必传(联合)类型
|
|
10
|
-
*/
|
|
11
|
-
export type RequiredUnion = {
|
|
12
|
-
type: DetailedType;
|
|
13
|
-
optionalTypes: DetailedType[];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* properties 必传类型
|
|
18
|
-
*/
|
|
19
|
-
export type RequiredType = RequiredUnion | RequiredSingle;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* properties 选传类型
|
|
23
|
-
*/
|
|
24
|
-
export type OptionalType = {
|
|
25
|
-
type: DetailedType;
|
|
26
|
-
value: unknown;
|
|
27
|
-
optionalTypes?: DetailedType[];
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Properties 字段类型
|
|
32
|
-
*/
|
|
33
|
-
export type PropertiesTypes = OptionalType | RequiredType;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* RootComponent API properties 字段约束
|
|
37
|
-
*/
|
|
38
|
-
export type PropertiesConstraint = Record<string, PropertiesTypes>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Validators } from "../../../types/Validators";
|
|
2
|
-
import type { PropertiesConstraint } from "./PropertiesConstraint";
|
|
3
|
-
import type { PropertiesValueValidator } from "./PropertiesValueValidator";
|
|
4
|
-
|
|
5
|
-
export type PropertiesOption<
|
|
6
|
-
TProperties extends PropertiesConstraint,
|
|
7
|
-
> = {
|
|
8
|
-
/**
|
|
9
|
-
* 可通过 as DetailedType<anyType> 书写任意类型
|
|
10
|
-
* @remarks
|
|
11
|
-
*
|
|
12
|
-
* 禁用observable字段(watch代替)
|
|
13
|
-
*
|
|
14
|
-
* 简写 → 必传,单一类型。对象写法 + optionalTypes → 必传,联合类型。对象写法 + value → 可选传(有默认值),可同时配合 optionalTypes。
|
|
15
|
-
*
|
|
16
|
-
* 有value类型检测和非法字段检测(例如value写出values)
|
|
17
|
-
*/
|
|
18
|
-
properties?:
|
|
19
|
-
& TProperties
|
|
20
|
-
& Validators<[
|
|
21
|
-
PropertiesValueValidator<TProperties>,
|
|
22
|
-
// // 放在最后一个,正常返回不是unknown 而是Record<string,unknown>
|
|
23
|
-
// G.IllegalFieldValidator<TProperties, "value" | "type" | "optionalTypes", 1>,
|
|
24
|
-
]>;
|
|
25
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
2
|
-
import type { NonReadonly } from "hry-types/src/Object/NonReadonly";
|
|
3
|
-
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 验证properties的value类型是否正确
|
|
7
|
-
* @returns unknown | `{ value: () => "⚠️类型错误⚠️" }`
|
|
8
|
-
*/
|
|
9
|
-
export type PropertiesValueValidator<
|
|
10
|
-
TProperties,
|
|
11
|
-
Result = {
|
|
12
|
-
[
|
|
13
|
-
k in keyof TProperties as TProperties[k] extends {
|
|
14
|
-
type: infer R;
|
|
15
|
-
value: infer V;
|
|
16
|
-
} ? NonReadonly<V> extends NonReadonly<InferDetailedType<R>> ? never
|
|
17
|
-
: k
|
|
18
|
-
: never
|
|
19
|
-
]: { value: () => "⚠️类型错误⚠️" };
|
|
20
|
-
},
|
|
21
|
-
> = EmptyObject extends Result ? unknown : Result;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type DetailedType, RootComponent } from "../../../../index";
|
|
2
|
-
import type { Mock_Cart } from "./normalRequired.test";
|
|
3
|
-
|
|
4
|
-
// 1 非法字段
|
|
5
|
-
RootComponent()({
|
|
6
|
-
properties: {
|
|
7
|
-
num: {
|
|
8
|
-
type: Number,
|
|
9
|
-
// @ts-expect-error 非法字段 values多了`s`
|
|
10
|
-
values: 123,
|
|
11
|
-
},
|
|
12
|
-
bool: {
|
|
13
|
-
type: Boolean,
|
|
14
|
-
value: true,
|
|
15
|
-
// @ts-expect-error 非法字段 optionalType少了`s`
|
|
16
|
-
optionalType: [String],
|
|
17
|
-
},
|
|
18
|
-
union: {
|
|
19
|
-
type: Number,
|
|
20
|
-
value: 123,
|
|
21
|
-
optionalTypes: [String],
|
|
22
|
-
// @ts-expect-error 非法字段 observable
|
|
23
|
-
observable: "",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// 2 value 类型错误
|
|
29
|
-
RootComponent()({
|
|
30
|
-
properties: {
|
|
31
|
-
str: {
|
|
32
|
-
type: String,
|
|
33
|
-
// @ts-expect-error 类型错误
|
|
34
|
-
value: 123,
|
|
35
|
-
},
|
|
36
|
-
optionalObj: {
|
|
37
|
-
// @ts-expect-error 对象默认值要写null则必须先定义
|
|
38
|
-
type: Object as DetailedType<Mock_Cart>,
|
|
39
|
-
// @ts-expect-error 对象默认值要写null则必须先定义
|
|
40
|
-
value: null,
|
|
41
|
-
},
|
|
42
|
-
str_num: {
|
|
43
|
-
type: String,
|
|
44
|
-
// @ts-expect-error 类型错误 应该写type字段类型(string)而非optionalTypes中的类型
|
|
45
|
-
value: 123,
|
|
46
|
-
optionalTypes: [Number],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
3
|
-
import { RootComponent } from "../..";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Properties配置为`{}`时
|
|
7
|
-
*/
|
|
8
|
-
const emptyObj = RootComponent()({
|
|
9
|
-
properties: {},
|
|
10
|
-
methods: {
|
|
11
|
-
foo() {
|
|
12
|
-
// 1 this.data 为注入数据类型
|
|
13
|
-
void Checking<typeof this.data, IInjectAllData, Test.Pass>;
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
void emptyObj;
|
|
18
|
-
// 2 返回文档类型无properties字段
|
|
19
|
-
void Checking<typeof emptyObj, {
|
|
20
|
-
methods: {
|
|
21
|
-
foo(): void;
|
|
22
|
-
};
|
|
23
|
-
}, Test.Pass>;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 无Properties配置时
|
|
27
|
-
*/
|
|
28
|
-
const noProperties = RootComponent()({
|
|
29
|
-
methods: {
|
|
30
|
-
foo() {
|
|
31
|
-
// 3 this.data 为注入数据类型
|
|
32
|
-
void Checking<typeof this.data, IInjectAllData, Test.Pass>;
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
void noProperties;
|
|
37
|
-
// 4 返回文档类型无properties字段
|
|
38
|
-
void Checking<typeof noProperties, {
|
|
39
|
-
methods: {
|
|
40
|
-
foo(): void;
|
|
41
|
-
};
|
|
42
|
-
}, Test.Pass>;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
3
|
-
import type { DetailedType } from "../../../../types/DetailedType";
|
|
4
|
-
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
5
|
-
import { RootComponent } from "../..";
|
|
6
|
-
import { type Mock_User } from "./normalRequired.test";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* properties字段选传类型配置 类型为[OptionalType](../PropertiesConstraint.ts)
|
|
10
|
-
*/
|
|
11
|
-
const OptionalDoc = RootComponent()({
|
|
12
|
-
properties: {
|
|
13
|
-
optional_num: { // 普通类型
|
|
14
|
-
type: Number,
|
|
15
|
-
value: 123,
|
|
16
|
-
},
|
|
17
|
-
optional_gender: {
|
|
18
|
-
type: String as DetailedType<"male" | "female">, // 同类字面量联合类型
|
|
19
|
-
value: "male",
|
|
20
|
-
},
|
|
21
|
-
optional_tuple: {
|
|
22
|
-
type: Array as unknown as DetailedType<[number, string, boolean]>, // 元组类型
|
|
23
|
-
value: [1, "a", true],
|
|
24
|
-
},
|
|
25
|
-
optional_obj: {
|
|
26
|
-
type: Object as DetailedType<Mock_User>, // 对象类型
|
|
27
|
-
value: {
|
|
28
|
-
id: "id",
|
|
29
|
-
age: 20,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
optional_objOrNull: {
|
|
33
|
-
type: Object as DetailedType<Mock_User | null>, // 对象类型与null的联合
|
|
34
|
-
value: null,
|
|
35
|
-
},
|
|
36
|
-
optional_union: { // 非同类联合类型 string | number
|
|
37
|
-
type: String,
|
|
38
|
-
value: "string",
|
|
39
|
-
optionalTypes: [Number],
|
|
40
|
-
},
|
|
41
|
-
optional_arr: {
|
|
42
|
-
type: Array as DetailedType<string[]>,
|
|
43
|
-
value: [],
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
methods: {
|
|
47
|
-
foo() {
|
|
48
|
-
// 1. 内部this.data中的类型(去除可选)
|
|
49
|
-
void Checking<
|
|
50
|
-
typeof this.data,
|
|
51
|
-
ComputeIntersection<
|
|
52
|
-
{
|
|
53
|
-
optional_num: number;
|
|
54
|
-
optional_gender: "male" | "female";
|
|
55
|
-
optional_tuple: [number, string, boolean];
|
|
56
|
-
optional_obj: Mock_User;
|
|
57
|
-
optional_objOrNull: Mock_User | null;
|
|
58
|
-
optional_union: string | number;
|
|
59
|
-
optional_arr: string[];
|
|
60
|
-
} & IInjectAllData
|
|
61
|
-
>,
|
|
62
|
-
Test.Pass
|
|
63
|
-
>;
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
void OptionalDoc;
|
|
68
|
-
type OptionalDocExpected = {
|
|
69
|
-
// 2. 预期返回类型 key为可选(带`?`)
|
|
70
|
-
properties: {
|
|
71
|
-
optional_num?: number;
|
|
72
|
-
optional_gender?: "male" | "female";
|
|
73
|
-
optional_tuple?: [number, string, boolean];
|
|
74
|
-
optional_obj?: Mock_User;
|
|
75
|
-
optional_objOrNull?: Mock_User | null;
|
|
76
|
-
optional_union?: string | number;
|
|
77
|
-
optional_arr?: string[];
|
|
78
|
-
};
|
|
79
|
-
methods: {
|
|
80
|
-
foo(): void;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
void Checking<typeof OptionalDoc, OptionalDocExpected, Test.Pass>;
|
|
85
|
-
|
|
86
|
-
// properties 使用DetailedType时,接受interface类型
|
|
87
|
-
interface Foo {
|
|
88
|
-
name: string;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
RootComponent()({
|
|
92
|
-
properties: {
|
|
93
|
-
xxx: Object as DetailedType<{ dd: Foo }>,
|
|
94
|
-
user: {
|
|
95
|
-
type: Object as DetailedType<Foo>,
|
|
96
|
-
value: { name: "zhao" },
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
computed: {
|
|
100
|
-
ddd() {
|
|
101
|
-
void this.data.user?.name;
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* 对象类型字面量类型可验证通过。
|
|
108
|
-
*/
|
|
109
|
-
type obj = { gender: "male" | "femal" };
|
|
110
|
-
|
|
111
|
-
RootComponent()({
|
|
112
|
-
properties: {
|
|
113
|
-
obj: {
|
|
114
|
-
type: Object as DetailedType<obj>,
|
|
115
|
-
value: { gender: "male" },
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
3
|
-
import type { DetailedType } from "../../../../types/DetailedType";
|
|
4
|
-
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
5
|
-
import { RootComponent } from "../..";
|
|
6
|
-
import type { RequiredSingle, RequiredType, RequiredUnion } from "../PropertiesConstraint";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 共用测试对象类型
|
|
10
|
-
*/
|
|
11
|
-
export interface Mock_User {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
age?: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 共用测试对象类型
|
|
18
|
-
*/
|
|
19
|
-
export type Mock_Cart = {
|
|
20
|
-
id: string;
|
|
21
|
-
selectedCount: number;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* properties 必传单一类型配置
|
|
26
|
-
*/
|
|
27
|
-
export const mock_requiredSingle = {
|
|
28
|
-
str: String,
|
|
29
|
-
num: Number,
|
|
30
|
-
bool: Boolean,
|
|
31
|
-
arr: Array,
|
|
32
|
-
obj: Object,
|
|
33
|
-
tuple: Array as unknown as DetailedType<[string, number, boolean]>,
|
|
34
|
-
union_str: String as DetailedType<"male" | "female">,
|
|
35
|
-
union_num: Number as DetailedType<0 | 1 | 2>,
|
|
36
|
-
union_bool: Boolean as DetailedType<false | true>,
|
|
37
|
-
union_arr: Array as DetailedType<number[] | string[]>,
|
|
38
|
-
union_obj: Object as DetailedType<Mock_User | Mock_Cart>,
|
|
39
|
-
} satisfies Record<string, RequiredSingle>;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* properties 必传联合类型配置
|
|
43
|
-
*/
|
|
44
|
-
export const mock_requiredUnion = {
|
|
45
|
-
union_str_num_bool: {
|
|
46
|
-
type: String,
|
|
47
|
-
optionalTypes: [Number, Boolean],
|
|
48
|
-
},
|
|
49
|
-
union_literalStr_Literalnum: {
|
|
50
|
-
type: String as DetailedType<"male" | "female">,
|
|
51
|
-
optionalTypes: [Number as DetailedType<0 | 1 | 2>],
|
|
52
|
-
},
|
|
53
|
-
union_mockUser_num: {
|
|
54
|
-
type: Object as DetailedType<Mock_User>,
|
|
55
|
-
optionalTypes: [Number],
|
|
56
|
-
},
|
|
57
|
-
union_num_mockUser: {
|
|
58
|
-
type: Number,
|
|
59
|
-
optionalTypes: [Object as DetailedType<Mock_User>],
|
|
60
|
-
},
|
|
61
|
-
} satisfies Record<string, RequiredUnion>;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* properties 必传字段全配置(单一类型 + 联合类型)
|
|
65
|
-
*/
|
|
66
|
-
export const mock_requiredTypes = {
|
|
67
|
-
...mock_requiredSingle,
|
|
68
|
-
...mock_requiredUnion,
|
|
69
|
-
} satisfies Record<string, RequiredType>;
|
|
70
|
-
|
|
71
|
-
type RequiredTypeExpected = {
|
|
72
|
-
str: string;
|
|
73
|
-
num: number;
|
|
74
|
-
bool: boolean;
|
|
75
|
-
arr: unknown[];
|
|
76
|
-
obj: object;
|
|
77
|
-
tuple: [string, number, boolean];
|
|
78
|
-
union_str: "male" | "female";
|
|
79
|
-
union_num: 0 | 1 | 2;
|
|
80
|
-
union_bool: boolean;
|
|
81
|
-
union_arr: number[] | string[];
|
|
82
|
-
union_obj: Mock_User | Mock_Cart;
|
|
83
|
-
union_str_num_bool: string | number | boolean;
|
|
84
|
-
union_literalStr_Literalnum: 0 | 1 | 2 | "male" | "female";
|
|
85
|
-
union_mockUser_num: number | Mock_User;
|
|
86
|
-
union_num_mockUser: number | Mock_User;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const RequiredDoc = RootComponent()({
|
|
90
|
-
properties: mock_requiredTypes,
|
|
91
|
-
methods: {
|
|
92
|
-
foo() {
|
|
93
|
-
// 1 this.data中的类型(对象类型加null)
|
|
94
|
-
void Checking<typeof this.data, ComputeIntersection<RequiredTypeExpected & IInjectAllData>, Test.Pass>;
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
void RequiredDoc;
|
|
99
|
-
/**
|
|
100
|
-
* 2 properties配置为必传类型时预期文档类型(与this.data一致)
|
|
101
|
-
*/
|
|
102
|
-
export type RequiredDocExpected = {
|
|
103
|
-
properties: RequiredTypeExpected;
|
|
104
|
-
methods: { foo: () => void };
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
void Checking<typeof RequiredDoc, RequiredDocExpected, Test.Pass>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { typeEqual } from "../../../utils/typeEqual";
|
|
2
|
-
import type { Getter } from "./StoreConstraint";
|
|
3
|
-
// 单独Getter类型返回值会把undefined转换为null
|
|
4
|
-
// 但是WithDefault类型返回值为getter的返回值去除undefined和default的类型联合。
|
|
5
|
-
export type GetStoreDef<TStore extends object> = {
|
|
6
|
-
[k in keyof TStore]: TStore[k] extends Getter ? ReturnType<TStore[k]>
|
|
7
|
-
: TStore[k] extends {
|
|
8
|
-
getter: (...args: unknown[]) => infer R;
|
|
9
|
-
default: infer D;
|
|
10
|
-
} ? Exclude<R, undefined> | (D extends null ? null : never)
|
|
11
|
-
: never;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// test
|
|
15
|
-
type User = { name: string; age: number };
|
|
16
|
-
type test = GetStoreDef<{
|
|
17
|
-
userName: (data: { aaa: "string" }) => string;
|
|
18
|
-
userAge: (data: { aaa: "string" }) => number;
|
|
19
|
-
userInfo: {
|
|
20
|
-
getter: (data: { aaa: "string" }) => User | undefined;
|
|
21
|
-
default: null;
|
|
22
|
-
};
|
|
23
|
-
list: {
|
|
24
|
-
getter: (data: { aaa: "string" }) => User[] | undefined;
|
|
25
|
-
default: [];
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
28
|
-
type expected = {
|
|
29
|
-
userName: string;
|
|
30
|
-
userAge: number;
|
|
31
|
-
userInfo: User | null;
|
|
32
|
-
list: User[];
|
|
33
|
-
};
|
|
34
|
-
typeEqual<test, expected>();
|