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,46 +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 { RootComponentDefinition } from "../../RootComponent/returnType";
|
|
4
|
-
import type { SubComponentDefinition } from "../../SubComponent/returnType";
|
|
5
|
-
import type { GetCustomEventDocOfSubDoc } from "./GetCustomEventDocOfSubDoc";
|
|
6
|
-
|
|
7
|
-
// 获取RootComponetDoc中events字段类型阻止事件(后最为catch)的key `${ 组件前缀 }_${infer Key}_${ bubbles | capture }_catch`
|
|
8
|
-
type GetStopKeys<O> = { [k in keyof O]: k extends `${string}_${infer Key}_${string}_catch` ? Key : never }[keyof O];
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 生成组件文档类型
|
|
12
|
-
*/
|
|
13
|
-
export type GenerateComponentDoc<
|
|
14
|
-
TRootDoc extends RootComponentDefinition,
|
|
15
|
-
TName extends string,
|
|
16
|
-
TSubComponentTuple extends SubComponentDefinition[],
|
|
17
|
-
// 获取RootDoc和SubComponent[]中所有的properties字段类型
|
|
18
|
-
AllPropertiesDoc extends unknown | object = TRootDoc["properties"],
|
|
19
|
-
AllEventsDoc extends unknown | object =
|
|
20
|
-
& TRootDoc["customEvents"]
|
|
21
|
-
& GetCustomEventDocOfSubDoc<TSubComponentTuple[number]>,
|
|
22
|
-
StopKeys extends string = GetStopKeys<TRootDoc["events"]>,
|
|
23
|
-
FinalEventsDoc extends object = Omit<AllEventsDoc, StopKeys>,
|
|
24
|
-
> = ComputeIntersection<
|
|
25
|
-
& IfExtends<
|
|
26
|
-
unknown,
|
|
27
|
-
AllPropertiesDoc,
|
|
28
|
-
{},
|
|
29
|
-
{
|
|
30
|
-
properties: {
|
|
31
|
-
// AddNullForObject 为了给子组件传值时,可以让异步对象数据初始值为null。
|
|
32
|
-
[k in keyof AllPropertiesDoc as `${TName}_${k & string}`]: AllPropertiesDoc[k];
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
>
|
|
36
|
-
& IfExtends<
|
|
37
|
-
{},
|
|
38
|
-
FinalEventsDoc,
|
|
39
|
-
{},
|
|
40
|
-
{
|
|
41
|
-
events: {
|
|
42
|
-
[k in keyof FinalEventsDoc as `${TName}_${k & string}`]: FinalEventsDoc[k];
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
>
|
|
46
|
-
>;
|
|
@@ -1,22 +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 { RootComponentDefinition } from "../../RootComponent/returnType";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 生成页面文档类型
|
|
7
|
-
* type PageDoc = { path: TPath, properties?: TRootDoc["properties"] }
|
|
8
|
-
*/
|
|
9
|
-
export type GeneratePageDoc<
|
|
10
|
-
TRootDoc extends RootComponentDefinition,
|
|
11
|
-
TPath extends string,
|
|
12
|
-
> = ComputeIntersection<
|
|
13
|
-
& { path: TPath }
|
|
14
|
-
& IfExtends<
|
|
15
|
-
unknown,
|
|
16
|
-
TRootDoc["properties"],
|
|
17
|
-
unknown,
|
|
18
|
-
{
|
|
19
|
-
properties: TRootDoc["properties"];
|
|
20
|
-
}
|
|
21
|
-
>
|
|
22
|
-
>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { IsNever, IsUnion } from "hry-types/src/Any/_api";
|
|
2
|
-
import type { UnionTwoObject } from "hry-types/src/Object/UnionTwoObject";
|
|
3
|
-
import type { Last } from "hry-types/src/Union/Last";
|
|
4
|
-
import type { Assert } from "../../../types/Assert";
|
|
5
|
-
import type { SubComponentDefinition } from "../../SubComponent/returnType";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 因为子组件文档customEvents字段有可能相同(无前缀),所以使用UnionTwoObject
|
|
9
|
-
* 由于SubComponentDoc为空时返回never而不`{}`,所以`Exclude<U, TLast>`不影响结果。
|
|
10
|
-
*/
|
|
11
|
-
type _GetCustomEventDocOfSubDoc<
|
|
12
|
-
U extends SubComponentDefinition,
|
|
13
|
-
Result = {},
|
|
14
|
-
TLast extends SubComponentDefinition = Assert<Last<U>, SubComponentDefinition>,
|
|
15
|
-
> = IsNever<U> extends true ? Result
|
|
16
|
-
: _GetCustomEventDocOfSubDoc<Exclude<U, TLast>, UnionTwoObject<Result, TLast["composedEvents"]>>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 获取子组件自定义事件文档
|
|
20
|
-
* @remarks U 中 相同字段类型联合,所以使用元组推导不如Last性能好。
|
|
21
|
-
*/
|
|
22
|
-
export type GetCustomEventDocOfSubDoc<UnionSubDoc extends SubComponentDefinition> = IsUnion<UnionSubDoc> extends true
|
|
23
|
-
? _GetCustomEventDocOfSubDoc<UnionSubDoc>
|
|
24
|
-
: UnionSubDoc["composedEvents"];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// import type { SubComponentType } from "../../SubComponent/SubComponentType";
|
|
2
|
-
|
|
3
|
-
// // 获取元组中所有SubComponentDoc的properties字段类型。这里忽略相同key的情况,结果为各个properties对象交叉类型。因为DefinComopnent API 在获取 SubComponentDoc字段类型时做了相同字段类型报错。
|
|
4
|
-
// export type GetPropertiesDocOfSubDoc<Tuple extends SubComponentType[], Result = unknown> = Tuple extends
|
|
5
|
-
// [infer Head extends SubComponentType, ...infer Rest extends SubComponentType[]]
|
|
6
|
-
// ? GetPropertiesDocOfSubDoc<Rest, Result & Head["properties"]>
|
|
7
|
-
// : Result;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type _PageDoc = {
|
|
2
|
-
path: `/${string}`;
|
|
3
|
-
properties?: object;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
type Error = "{ path: `/${string}`; properties?: object;}";
|
|
7
|
-
|
|
8
|
-
type _Validator<O> = keyof O extends keyof _PageDoc ? _PageDoc : Error;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 页面文档类型
|
|
12
|
-
* ```ts
|
|
13
|
-
* PageDoc = {
|
|
14
|
-
* path: `/${string}`;
|
|
15
|
-
* properties?: object;
|
|
16
|
-
* };
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export type PageDoc<O extends _Validator<O> = _PageDoc> = O;
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
import { Checking, type Test } from "hry-types";
|
|
4
|
-
import { type DetailedType, RootComponent, SubComponent } from "../../../..";
|
|
5
|
-
// import type { CustomEventConstraint } from "../../../rootComponent/CustomEvents/CustomEventConstraint";
|
|
6
|
-
import type {
|
|
7
|
-
Bubbles,
|
|
8
|
-
BubblesCapture,
|
|
9
|
-
BubblesCaptureComposed,
|
|
10
|
-
BubblesComposed,
|
|
11
|
-
Capture,
|
|
12
|
-
CaptureComposed,
|
|
13
|
-
Composed,
|
|
14
|
-
} from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
15
|
-
|
|
16
|
-
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
17
|
-
import type { CustomEventConstraint } from "../../../RootComponent/CustomEvents/CustomEventConstraint";
|
|
18
|
-
import type { PropertiesConstraint } from "../../../RootComponent/Properties/PropertiesConstraint";
|
|
19
|
-
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
20
|
-
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
21
|
-
import type { SubComponentDefinition } from "../../../SubComponent/returnType";
|
|
22
|
-
import { DefineComponent } from "../..";
|
|
23
|
-
|
|
24
|
-
const properties = {
|
|
25
|
-
str: String,
|
|
26
|
-
obj: Object as DetailedType<Mock_User>,
|
|
27
|
-
optionalObj: {
|
|
28
|
-
type: Object as DetailedType<Mock_User>,
|
|
29
|
-
value: {} as Mock_User,
|
|
30
|
-
},
|
|
31
|
-
optionalObjOrNull: {
|
|
32
|
-
type: Object as DetailedType<Mock_User | null>,
|
|
33
|
-
value: null,
|
|
34
|
-
},
|
|
35
|
-
} satisfies PropertiesConstraint;
|
|
36
|
-
const customEvents = {
|
|
37
|
-
str: String,
|
|
38
|
-
null: null,
|
|
39
|
-
unionStr: String as DetailedType<"male" | "female">,
|
|
40
|
-
list: [String, Number as DetailedType<0 | 1 | 2>, null],
|
|
41
|
-
bubbles: {
|
|
42
|
-
detail: String,
|
|
43
|
-
options: { bubbles: true },
|
|
44
|
-
},
|
|
45
|
-
capturePhase: {
|
|
46
|
-
detail: null,
|
|
47
|
-
options: { capturePhase: true },
|
|
48
|
-
},
|
|
49
|
-
bubbles_capturePhase: {
|
|
50
|
-
detail: [String, Number],
|
|
51
|
-
options: { bubbles: true, capturePhase: true },
|
|
52
|
-
},
|
|
53
|
-
bubbles_composed: {
|
|
54
|
-
detail: String as DetailedType<"male" | "female">,
|
|
55
|
-
options: { bubbles: true, composed: true },
|
|
56
|
-
},
|
|
57
|
-
capturePhase_composed: {
|
|
58
|
-
detail: [String, Number as DetailedType<0 | 1 | 2>, null],
|
|
59
|
-
options: { capturePhase: true, composed: true },
|
|
60
|
-
},
|
|
61
|
-
bubbles_capturePhase_composed: {
|
|
62
|
-
detail: Boolean,
|
|
63
|
-
options: { bubbles: true, capturePhase: true, composed: true },
|
|
64
|
-
},
|
|
65
|
-
} satisfies CustomEventConstraint;
|
|
66
|
-
|
|
67
|
-
const OnlyPropsRootDoc = RootComponent()({
|
|
68
|
-
properties,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const onlyProperties = DefineComponent({
|
|
72
|
-
name: "test",
|
|
73
|
-
rootComponent: OnlyPropsRootDoc,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// 1. 类型为typeof OnlyPropsRootDoc加前缀(组件名)
|
|
77
|
-
type OnlyPropertiesExpected = {
|
|
78
|
-
properties: {
|
|
79
|
-
test_optionalObj?: Mock_User;
|
|
80
|
-
test_optionalObjOrNull?: Mock_User | null;
|
|
81
|
-
test_str: string;
|
|
82
|
-
test_obj: Mock_User;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
Checking<typeof onlyProperties, OnlyPropertiesExpected, Test.Pass>;
|
|
87
|
-
|
|
88
|
-
const OnlyCustomEventsRootDoc = RootComponent()({
|
|
89
|
-
customEvents,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const compOnlyCustomEvents = DefineComponent({
|
|
93
|
-
name: "test",
|
|
94
|
-
rootComponent: OnlyCustomEventsRootDoc,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// 2 rootComponent中只有customEvents字段时 加前缀(组件名) 无properties字段
|
|
98
|
-
type CompOnlyCustomEventsExpected = {
|
|
99
|
-
events: {
|
|
100
|
-
test_str: string;
|
|
101
|
-
test_null: null;
|
|
102
|
-
test_unionStr: "male" | "female";
|
|
103
|
-
test_list: string | 0 | 1 | 2 | null;
|
|
104
|
-
test_bubbles: string | Bubbles;
|
|
105
|
-
test_capturePhase: null | Capture;
|
|
106
|
-
test_bubbles_capturePhase: string | number | BubblesCapture;
|
|
107
|
-
test_bubbles_composed: "male" | "female" | BubblesComposed;
|
|
108
|
-
test_capturePhase_composed: string | 0 | 1 | 2 | CaptureComposed | null;
|
|
109
|
-
test_bubbles_capturePhase_composed: boolean | BubblesCaptureComposed;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
// test_str: string;
|
|
113
|
-
// test_null: null;
|
|
114
|
-
// test_bubbles: string | Bubbles;
|
|
115
|
-
// test_capturePhase: Capture | null;
|
|
116
|
-
// test_list: string | 0 | 1 | 2 | null;
|
|
117
|
-
// test_bubbles_capturePhase: string | number | BubblesCapture;
|
|
118
|
-
// test_bubbles_composed: BubblesComposed | "male" | "female";
|
|
119
|
-
// test_capturePhase_composed: string | 0 | 1 | 2 | CaptureComposed | null;
|
|
120
|
-
// test_bubbles_capturePhase_composed: boolean | BubblesCaptureComposed;
|
|
121
|
-
// test_unionStr: "male" | "female";
|
|
122
|
-
// };
|
|
123
|
-
Checking<typeof compOnlyCustomEvents, CompOnlyCustomEventsExpected, Test.Pass>;
|
|
124
|
-
|
|
125
|
-
const rootComponent = RootComponent()({
|
|
126
|
-
properties,
|
|
127
|
-
customEvents,
|
|
128
|
-
});
|
|
129
|
-
// 3. properties和customEvents字段都有时
|
|
130
|
-
const compDoc = DefineComponent({
|
|
131
|
-
name: "test",
|
|
132
|
-
rootComponent,
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
Checking<typeof compDoc, ComputeIntersection<CompOnlyCustomEventsExpected & OnlyPropertiesExpected>, Test.Pass>;
|
|
136
|
-
|
|
137
|
-
type SubA = SubComponentDefinition<{
|
|
138
|
-
composedEvents: {
|
|
139
|
-
str: string | Bubbles | Composed;
|
|
140
|
-
num: number | Capture | Composed;
|
|
141
|
-
null: null | Bubbles | Capture | Composed;
|
|
142
|
-
};
|
|
143
|
-
}>;
|
|
144
|
-
|
|
145
|
-
const customEventsRootDoc = DefineComponent({
|
|
146
|
-
name: "test",
|
|
147
|
-
subComponents: [{} as SubA],
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// 4 子组件返回的事件类型是必带Composed的
|
|
151
|
-
type customEventsRootDocExpect = {
|
|
152
|
-
events: {
|
|
153
|
-
test_str: string | Bubbles | Composed;
|
|
154
|
-
test_num: number | Capture | Composed;
|
|
155
|
-
test_null: null | Bubbles | Capture | Composed;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
Checking<typeof customEventsRootDoc, customEventsRootDocExpect, Test.Pass>;
|
|
160
|
-
|
|
161
|
-
type SubB = SubComponentDefinition<{
|
|
162
|
-
composedEvents: {
|
|
163
|
-
str: number | Bubbles | Composed;
|
|
164
|
-
num: string | Capture | Composed;
|
|
165
|
-
null: boolean | Bubbles | Capture | Composed;
|
|
166
|
-
};
|
|
167
|
-
}>;
|
|
168
|
-
|
|
169
|
-
//
|
|
170
|
-
const WhenSameKeyOfCustomEventsRootDoc = DefineComponent({
|
|
171
|
-
name: "test",
|
|
172
|
-
subComponents: [{} as SubA, {} as SubB],
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// 5 子组件中存在相同自定义事件字段时,类型联合
|
|
176
|
-
type WhenSameKeyOfCustomEventsRootDocExpect = {
|
|
177
|
-
events: {
|
|
178
|
-
test_str: string | number | Bubbles | Composed;
|
|
179
|
-
test_num: string | number | Capture | Composed;
|
|
180
|
-
test_null: boolean | Bubbles | Capture | Composed | null;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
Checking<typeof WhenSameKeyOfCustomEventsRootDoc, WhenSameKeyOfCustomEventsRootDocExpect, Test.Pass>;
|
|
185
|
-
|
|
186
|
-
type RootDocCatch = RootComponentDefinition<{
|
|
187
|
-
events: {
|
|
188
|
-
aaa_str_bubbles_catch: () => void;
|
|
189
|
-
};
|
|
190
|
-
}>;
|
|
191
|
-
|
|
192
|
-
const whenRootDocCatch = DefineComponent({
|
|
193
|
-
name: "test",
|
|
194
|
-
rootComponent: {} as RootDocCatch,
|
|
195
|
-
subComponents: [{} as SubA],
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// 6 根组件有阻止(catch)子组件事件时(子组件aaa的str事件是阻止事件,不会被继续传递),去除对应的事件
|
|
199
|
-
type whenRootDocCatchExpect = {
|
|
200
|
-
events: {
|
|
201
|
-
// 少了str事件
|
|
202
|
-
test_num: number | Composed | Capture;
|
|
203
|
-
test_null: Bubbles | Composed | Capture | null;
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
Checking<typeof whenRootDocCatch, whenRootDocCatchExpect, Test.Pass>;
|
|
208
|
-
|
|
209
|
-
// 7 根组件和子组件都没有事件和properties时 返回组件类型为 {}
|
|
210
|
-
const ComponetDoc = DefineComponent({
|
|
211
|
-
name: "test",
|
|
212
|
-
rootComponent: {},
|
|
213
|
-
subComponents: [],
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
Checking<typeof ComponetDoc, {}, Test.Pass>;
|
|
217
|
-
|
|
218
|
-
// 8 自定义事件文档类型与定义的类型相同
|
|
219
|
-
const rootComponent8 = RootComponent()({
|
|
220
|
-
customEvents: {
|
|
221
|
-
// 减少商品
|
|
222
|
-
decrease: Object as DetailedType<Mock_User>,
|
|
223
|
-
},
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
Checking<(typeof rootComponent8)["customEvents"]["decrease"], Mock_User, Test.Pass>;
|
|
227
|
-
|
|
228
|
-
const subA = SubComponent<RootComponentDefinition, { properties: { subA_num: number } }>()({});
|
|
229
|
-
// SubComponent中计算属性字段函数若不写返回值,会造成结果中没有计算属性字段类型,若没有其他字段,结果就为'{}'
|
|
230
|
-
const subB = SubComponent<RootComponentDefinition, { properties: { subB_str: string } }>()({
|
|
231
|
-
computed: {
|
|
232
|
-
subB_str() {
|
|
233
|
-
return this.data.injectStr;
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
|
-
const c = {};
|
|
238
|
-
DefineComponent({
|
|
239
|
-
name: "test",
|
|
240
|
-
// subA 应该报错 但当前不会报错,因为c的类型是{},引起subA不报错
|
|
241
|
-
subComponents: [subA, c],
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
DefineComponent({
|
|
245
|
-
name: "test",
|
|
246
|
-
// @ts-expect-error 缺少必传的字段subB_str 正常报错
|
|
247
|
-
subComponents: [subA, subB],
|
|
248
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import { Checking, type Test } from "hry-types";
|
|
3
|
-
import { type DetailedType, RootComponent } from "../../../..";
|
|
4
|
-
|
|
5
|
-
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
6
|
-
import { DefineComponent } from "../..";
|
|
7
|
-
|
|
8
|
-
const OnlyPropsRootDoc = RootComponent()({
|
|
9
|
-
isPage: true,
|
|
10
|
-
properties: {
|
|
11
|
-
str: String,
|
|
12
|
-
obj: Object as DetailedType<Mock_User>,
|
|
13
|
-
optionalObj: {
|
|
14
|
-
type: Object as DetailedType<Mock_User>,
|
|
15
|
-
value: {} as Mock_User,
|
|
16
|
-
},
|
|
17
|
-
optionalObjOrNull: {
|
|
18
|
-
type: Object as DetailedType<Mock_User | null>,
|
|
19
|
-
value: null,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const compDocOnlyProperties = DefineComponent({
|
|
25
|
-
path: "/pages/index/index",
|
|
26
|
-
rootComponent: OnlyPropsRootDoc,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// 1 页面时返回的propertiesDoc无前缀
|
|
30
|
-
type CompDocOnlyPropertiesExpected = {
|
|
31
|
-
path: "/pages/index/index";
|
|
32
|
-
properties: {
|
|
33
|
-
optionalObj?: Mock_User;
|
|
34
|
-
optionalObjOrNull?: Mock_User | null;
|
|
35
|
-
str: string;
|
|
36
|
-
obj: Mock_User;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
void Checking<typeof compDocOnlyProperties, CompDocOnlyPropertiesExpected, Test.Pass>;
|
|
41
|
-
|
|
42
|
-
// 2 页面类型不受subComponents是[never,never]时影响
|
|
43
|
-
const whenSubIsAllNever = DefineComponent({
|
|
44
|
-
path: "/pages/index/index",
|
|
45
|
-
rootComponent: OnlyPropsRootDoc,
|
|
46
|
-
subComponents: [{} as never, {} as never],
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
void Checking<typeof whenSubIsAllNever, CompDocOnlyPropertiesExpected, Test.Pass>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import { observable, runInAction } from "mobx";
|
|
3
|
-
|
|
4
|
-
// 注入的响应式数据;
|
|
5
|
-
const themeStore = observable({ theme: wx.getSystemInfoSync().theme });
|
|
6
|
-
|
|
7
|
-
wx.onThemeChange((Res) => {
|
|
8
|
-
runInAction(() => {
|
|
9
|
-
themeStore.theme = Res.theme;
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// 注入的方法;
|
|
14
|
-
function injectMethod(data: string) {
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const data = {
|
|
19
|
-
injectStr: "injectStr",
|
|
20
|
-
};
|
|
21
|
-
const methods = {
|
|
22
|
-
injectMethod,
|
|
23
|
-
};
|
|
24
|
-
const store = {
|
|
25
|
-
injectTheme: () => themeStore.theme,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// 声明注入类型 js开发可以忽略
|
|
29
|
-
declare module "../.." {
|
|
30
|
-
interface IInjectInfo {
|
|
31
|
-
[key: string]: unknown;
|
|
32
|
-
data: typeof data;
|
|
33
|
-
store: typeof store;
|
|
34
|
-
methods: typeof methods;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { IfEquals } from "hry-types/src/Any/IfEquals";
|
|
2
|
-
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
3
|
-
import type { ReturnTypeInObject } from "hry-types/src/Object/ReturnTypeInObject";
|
|
4
|
-
import type { WMComponentOption } from "../../types/OfficialTypeAlias";
|
|
5
|
-
import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
|
|
6
|
-
import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
|
|
7
|
-
import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
|
|
8
|
-
|
|
9
|
-
export type InjectKey = "options" | "methods" | "data" | "store" | "behaviors";
|
|
10
|
-
// 利用继承的多态性 使得IInjectInfo类型可由使用者外部定义
|
|
11
|
-
interface BaseInjectInfo {
|
|
12
|
-
[key: string]: unknown;
|
|
13
|
-
options?: WMComponentOption;
|
|
14
|
-
methods?: MethodsConstraint;
|
|
15
|
-
data?: DataConstraint;
|
|
16
|
-
store?: StoreConstraint;
|
|
17
|
-
behaviors?: string[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface IInjectInfo extends BaseInjectInfo {
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type IInjectAllData = IfEquals<
|
|
24
|
-
{},
|
|
25
|
-
injectData & IInjectStore,
|
|
26
|
-
{},
|
|
27
|
-
ComputeIntersection<injectData & IInjectStore>
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
|
-
type injectData = DataConstraint extends IInjectInfo["data"] ? {} : IInjectInfo["data"];
|
|
31
|
-
|
|
32
|
-
export type IInjectStore = StoreConstraint extends IInjectInfo["store"] ? {}
|
|
33
|
-
: ReturnTypeInObject<IInjectInfo["store"]>;
|
|
34
|
-
|
|
35
|
-
export type IInjectMethods = MethodsConstraint extends IInjectInfo["methods"] ? {} : IInjectInfo["methods"];
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 实例配置接口
|
|
39
|
-
*/
|
|
40
|
-
class InstanceConfig {
|
|
41
|
-
private info: { injectInfo?: IInjectInfo } = {};
|
|
42
|
-
public get injectInfo() {
|
|
43
|
-
return this.info.injectInfo;
|
|
44
|
-
}
|
|
45
|
-
public setInjectInfo(info: IInjectInfo | undefined) {
|
|
46
|
-
if (info) this.info.injectInfo = info;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const instanceConfig = new InstanceConfig();
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
|
-
import { Checking, type Test } from "hry-types";
|
|
3
|
-
import { RootComponent } from "../../RootComponent";
|
|
4
|
-
|
|
5
|
-
// 1. 注入字段无重复时
|
|
6
|
-
RootComponent()({
|
|
7
|
-
methods: {
|
|
8
|
-
testInjectTypes() {
|
|
9
|
-
Checking<typeof this.data.injectStr, string, Test.Pass>;
|
|
10
|
-
|
|
11
|
-
Checking<typeof this.data.injectTheme, "dark" | "light" | undefined, Test.Pass>;
|
|
12
|
-
|
|
13
|
-
Checking<typeof this.injectMethod, (data: string) => string, Test.Pass>;
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// 2. 注入字段重复时,自身覆盖注入类型
|
|
19
|
-
RootComponent()({
|
|
20
|
-
data: {
|
|
21
|
-
// 覆盖注入的数据类型
|
|
22
|
-
injectStr: 123,
|
|
23
|
-
},
|
|
24
|
-
store: {
|
|
25
|
-
// 覆盖注入的数据类型
|
|
26
|
-
injectTheme: (() => "aaa") as () => "aaa",
|
|
27
|
-
},
|
|
28
|
-
methods: {
|
|
29
|
-
// 覆盖注入的方法类型
|
|
30
|
-
injectMethod() {
|
|
31
|
-
return 123;
|
|
32
|
-
},
|
|
33
|
-
testInjectTypes() {
|
|
34
|
-
Checking<typeof this.data.injectStr, number, Test.Pass>;
|
|
35
|
-
|
|
36
|
-
Checking<typeof this.data.injectTheme, "aaa", Test.Pass>;
|
|
37
|
-
|
|
38
|
-
Checking<typeof this.injectMethod, () => 123, Test.Pass>;
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { DuplicateFieldValidator } from "hry-types/src/Generic/DuplicateFieldValidator";
|
|
2
|
-
|
|
3
|
-
import type { ComputedConstraint } from "./ComputedConstraint";
|
|
4
|
-
|
|
5
|
-
export type ComputedOption<
|
|
6
|
-
TComputed extends ComputedConstraint,
|
|
7
|
-
CompareKeys extends PropertyKey,
|
|
8
|
-
> = {
|
|
9
|
-
/**
|
|
10
|
-
* computed字段
|
|
11
|
-
* @remarks
|
|
12
|
-
*
|
|
13
|
-
* 函数体内,可通过this.data获取实例其他数据(依赖),setData发生时,若数据(依赖)发生变化则重新运行函数体并setData。
|
|
14
|
-
*
|
|
15
|
-
* 带重复字段检测(与properties、data、store字段比较)
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* ```ts
|
|
20
|
-
* {
|
|
21
|
-
* data:{
|
|
22
|
-
* count:1
|
|
23
|
-
* },
|
|
24
|
-
* computed:{
|
|
25
|
-
* return this.data.count + 1
|
|
26
|
-
* }
|
|
27
|
-
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
computed?:
|
|
33
|
-
& TComputed
|
|
34
|
-
& DuplicateFieldValidator<TComputed, CompareKeys>;
|
|
35
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ComputedConstraint } from "./ComputedConstraint";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 获取computed字段文档类型
|
|
5
|
-
* @param T - ComputedConstraint
|
|
6
|
-
* @returns object
|
|
7
|
-
*/
|
|
8
|
-
export type GetComputedDef<TComputed extends ComputedConstraint> = {
|
|
9
|
-
[k in keyof TComputed]: ReturnType<TComputed[k]>;
|
|
10
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
|
-
import { Checking, type Test } from "hry-types";
|
|
3
|
-
import type { GetComputedDef } from "../GetComputedDef";
|
|
4
|
-
|
|
5
|
-
// test1 非空对象字段
|
|
6
|
-
|
|
7
|
-
type Test1 = GetComputedDef<{
|
|
8
|
-
a: () => number;
|
|
9
|
-
b: () => string;
|
|
10
|
-
c: () => "male" | "femal";
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
|
-
type Test1Expected = {
|
|
14
|
-
a: number;
|
|
15
|
-
b: string;
|
|
16
|
-
c: "male" | "femal";
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
Checking<Test1, Test1Expected, Test.Pass>;
|
|
20
|
-
|
|
21
|
-
// test2 空对象字段 返回空
|
|
22
|
-
|
|
23
|
-
type Test2 = GetComputedDef<{}>;
|
|
24
|
-
|
|
25
|
-
Checking<Test2, {}, Test.Pass>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { RootComponent } from "../..";
|
|
2
|
-
|
|
3
|
-
// 1 重复字段
|
|
4
|
-
RootComponent()({
|
|
5
|
-
properties: {
|
|
6
|
-
str: String,
|
|
7
|
-
},
|
|
8
|
-
data: {
|
|
9
|
-
num: 123,
|
|
10
|
-
},
|
|
11
|
-
computed: {
|
|
12
|
-
// @ts-expect-error '与properties字段重复'
|
|
13
|
-
str(): string {
|
|
14
|
-
return "与properties字段重复";
|
|
15
|
-
},
|
|
16
|
-
// @ts-expect-error "与data字段重复"
|
|
17
|
-
num(): string {
|
|
18
|
-
return "与data字段重复";
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// 2 循环引用
|
|
24
|
-
RootComponent()({
|
|
25
|
-
computed: {
|
|
26
|
-
// @ts-expect-error 相互引用
|
|
27
|
-
str() {
|
|
28
|
-
// @ts-expect-error 相互引用
|
|
29
|
-
return this.data.num;
|
|
30
|
-
},
|
|
31
|
-
// @ts-expect-error 相互引用
|
|
32
|
-
num() {
|
|
33
|
-
// @ts-expect-error 相互引用
|
|
34
|
-
return this.data.str;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
// 3 、实例上不存在的字段应该报错
|
|
39
|
-
RootComponent()({
|
|
40
|
-
computed: {
|
|
41
|
-
str(): number {
|
|
42
|
-
// @ts-expect-error 不存在的字段
|
|
43
|
-
return this.data.numd;
|
|
44
|
-
},
|
|
45
|
-
other(): string {
|
|
46
|
-
// @ts-expect-error 不存在的字段
|
|
47
|
-
return this.func;
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
});
|