annil 1.14.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +15 -3
- package/dist/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.d.ts +2 -2
- package/dist/api/DefineComponent/NameOrPath/NameOrPathOption.js.map +1 -0
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +3 -3
- package/dist/api/DefineComponent/index.d.ts +5 -5
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.d.ts +2 -3
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js +31 -15
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.d.ts +2 -2
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js +0 -4
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.js +2 -2
- package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/initComputed/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.d.ts +2 -2
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.d.ts +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +6 -6
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js.map +1 -1
- package/dist/api/DefineComponent/returnType/GenerateComponentDoc.d.ts +2 -2
- package/dist/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.d.ts +3 -3
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +2 -6
- package/dist/api/RootComponent/Properties/GetPropertiesDef.d.ts +3 -2
- package/dist/api/RootComponent/Properties/PropertiesOption.d.ts +1 -3
- package/dist/api/RootComponent/Store/StoreOption.d.ts +1 -2
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.d.ts +3 -0
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js +2 -0
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js.map +1 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.d.ts +3 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js +2 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomComputed/CustomComputedOption.d.ts → SubComponent/SubComputed/SubComputedOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js +2 -0
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js.map +1 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.d.ts +3 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.js +2 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomData/CustomDataOption.d.ts → SubComponent/SubData/SubDataOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubData/SubDataOption.js +2 -0
- package/dist/api/SubComponent/SubData/SubDataOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomEvents/CustomEventsConstraint.d.ts → SubComponent/SubEvents/SubEventsConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js +2 -0
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomEvents/CustomEventsOption.d.ts → SubComponent/SubEvents/SubEventsOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js +2 -0
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomInherit/CustomInheritConstraint.d.ts → SubComponent/SubInherit/SubInheritConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js +2 -0
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomInherit/CustomInheritOption.d.ts → SubComponent/SubInherit/SubInheritOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js +2 -0
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js.map +1 -0
- package/dist/api/SubComponent/SubInstance/SubInstance.d.ts +2 -0
- package/dist/api/SubComponent/SubInstance/SubInstance.js.map +1 -0
- package/dist/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.d.ts +1 -1
- package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js.map +1 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.d.ts +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js.map +1 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.d.ts +5 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js.map +1 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.d.ts +2 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js +2 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js.map +1 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.d.ts +2 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js +2 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomReturnType/CreateCustomComponentDoc.d.ts → SubComponent/SubReturnType/CreateSubComponentDoc.d.ts} +1 -1
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js +2 -0
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js.map +1 -0
- package/dist/api/{CustomComponent/CustomStore/CustomStoreConstraint.d.ts → SubComponent/SubStore/SubStoreConstraint.d.ts} +2 -2
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js +2 -0
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomStore/CustomStoreOption.d.ts → SubComponent/SubStore/SubStoreOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubStore/SubStoreOption.js +2 -0
- package/dist/api/SubComponent/SubStore/SubStoreOption.js.map +1 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.d.ts +2 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js +2 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js.map +1 -0
- package/dist/api/SubComponent/index.d.ts +49 -0
- package/dist/api/SubComponent/index.js +4 -0
- package/dist/api/SubComponent/index.js.map +1 -0
- package/dist/api/{CustomComponent → SubComponent}/returnType.d.ts +3 -3
- package/dist/api/SubComponent/returnType.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/thirdLib/index.js +2 -1
- package/dist/thirdLib/index.js.map +1 -1
- package/package.json +5 -4
- package/src/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.ts +3 -3
- package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +3 -4
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +3 -3
- package/src/api/DefineComponent/index.ts +9 -9
- package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +2 -3
- package/src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts +56 -17
- package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +5 -5
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts +22 -22
- package/src/api/DefineComponent/normalizeOptions/index.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/initComputed/index.ts +0 -9
- package/src/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +23 -6
- package/src/api/DefineComponent/returnType/GenerateComponentDoc.ts +2 -2
- package/src/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.ts +4 -4
- package/src/api/DefineComponent/returnType/test/normalComponentDoc.test.ts +6 -6
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +1 -1
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +2 -15
- package/src/api/RootComponent/PageLifetimes/test/error.test.ts +0 -3
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +3 -36
- package/src/api/RootComponent/Properties/GetPropertiesDef.ts +4 -7
- package/src/api/RootComponent/Properties/PropertiesOption.ts +3 -4
- package/src/api/RootComponent/Store/StoreOption.ts +1 -1
- package/src/api/RootComponent/Store/test/error.test.ts +1 -8
- package/src/api/RootComponent/Store/test/normal.test.ts +20 -9
- package/src/api/{CustomComponent/CustomComputed/GetCustomComputedDoc.ts → SubComponent/SubComputed/GetSubComputedDoc.ts} +1 -1
- package/src/api/SubComponent/SubComputed/SubComputedConstraint.ts +1 -0
- package/src/api/{CustomComponent/CustomComputed/CustomComputedOption.ts → SubComponent/SubComputed/SubComputedOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/error.test.ts +7 -7
- package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/normal.test.ts +9 -9
- package/src/api/{CustomComponent/CustomData/CustomDataConstraint.ts → SubComponent/SubData/SubDataConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomData/CustomDataOption.ts → SubComponent/SubData/SubDataOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomData → SubComponent/SubData}/test/error.test.ts +5 -5
- package/src/api/{CustomComponent/CustomData → SubComponent/SubData}/test/normal.test.ts +6 -6
- package/src/api/{CustomComponent/CustomEvents/CustomEventsConstraint.ts → SubComponent/SubEvents/SubEventsConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomEvents/CustomEventsOption.ts → SubComponent/SubEvents/SubEventsOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomEvents → SubComponent/SubEvents}/test/error.test.ts +3 -3
- package/src/api/{CustomComponent/CustomEvents → SubComponent/SubEvents}/test/normal.test.ts +10 -10
- package/src/api/{CustomComponent/CustomInherit/CustomInheritConstraint.ts → SubComponent/SubInherit/SubInheritConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomInherit/CustomInheritOption.ts → SubComponent/SubInherit/SubInheritOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/error.test.ts +7 -7
- package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/normal.test.ts +5 -5
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/SubInstance.ts +1 -1
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/error.test.ts +2 -2
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/normal.test.ts +2 -2
- package/src/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.ts +1 -1
- package/src/api/SubComponent/SubMethods/SubMethodsConstraint.ts +3 -0
- package/src/api/{CustomComponent/CustomMethods/CustomMethodsOption.ts → SubComponent/SubMethods/SubMethodsOption.ts} +3 -3
- package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/error.test.ts +3 -3
- package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/normarl.test.ts +3 -3
- package/src/api/SubComponent/SubObservers/SubObserversOption.ts +3 -0
- package/src/api/{CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.ts → SubComponent/SubPageLifetimes/SubPageLifetimesOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomReturnType/CreateCustomComponentDoc.ts → SubComponent/SubReturnType/CreateSubComponentDoc.ts} +1 -1
- package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/error.test.ts +2 -2
- package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/normal.test.ts +4 -4
- package/src/api/{CustomComponent/CustomStore/CustomStoreConstraint.ts → SubComponent/SubStore/SubStoreConstraint.ts} +2 -2
- package/src/api/{CustomComponent/CustomStore/CustomStoreOption.ts → SubComponent/SubStore/SubStoreOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/error.test.ts +6 -6
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/normal.test.ts +13 -6
- package/src/api/SubComponent/SubWatch/SubWatchOption.ts +3 -0
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchComputed.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchProperties.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchRootData.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchSubData.test.ts +3 -3
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WtachInject.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/error.test.ts +5 -5
- package/src/api/{CustomComponent → SubComponent}/index.ts +50 -62
- package/src/api/{CustomComponent → SubComponent}/returnType.ts +6 -7
- package/src/index.ts +2 -4
- package/src/thirdLib/wm/swiper.test.ts +2 -2
- package/tsconfig.json +3 -3
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.d.ts +0 -1
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.d.ts +0 -9
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js +0 -2
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.d.ts +0 -12
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js.map +0 -1
- package/dist/api/ChunkComponent/SlotComponentReturnType.d.ts +0 -20
- package/dist/api/ChunkComponent/SlotComponentReturnType.js +0 -2
- package/dist/api/ChunkComponent/SlotComponentReturnType.js.map +0 -1
- package/dist/api/ChunkComponent/index.d.ts +0 -24
- package/dist/api/ChunkComponent/index.js +0 -4
- package/dist/api/ChunkComponent/index.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.d.ts +0 -3
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.d.ts +0 -3
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js.map +0 -1
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.d.ts +0 -3
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js +0 -2
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js +0 -2
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js +0 -2
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomInstance/SubInstance.d.ts +0 -2
- package/dist/api/CustomComponent/CustomInstance/SubInstance.js.map +0 -1
- package/dist/api/CustomComponent/CustomLifetimes/SubLifetimesOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.d.ts +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.d.ts +0 -5
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js +0 -2
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js +0 -2
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js +0 -2
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js.map +0 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js +0 -2
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js +0 -2
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js.map +0 -1
- package/dist/api/CustomComponent/index.d.ts +0 -49
- package/dist/api/CustomComponent/index.js +0 -4
- package/dist/api/CustomComponent/index.js.map +0 -1
- package/dist/api/CustomComponent/returnType.js.map +0 -1
- package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.js.map +0 -1
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.d.ts +0 -3
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js +0 -12
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js.map +0 -1
- package/src/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.ts +0 -1
- package/src/api/ChunkComponent/ChunkComputed/ChunkComputedOption.ts +0 -46
- package/src/api/ChunkComponent/ChunkComputed/GetChunkComputedDoc.ts +0 -9
- package/src/api/ChunkComponent/ChunkComputed/test/SlotGetComputedDoc.test.ts +0 -25
- package/src/api/ChunkComponent/ChunkComputed/test/error.test.ts +0 -33
- package/src/api/ChunkComponent/ChunkComputed/test/mock.ts +0 -37
- package/src/api/ChunkComponent/ChunkComputed/test/normal.test.ts +0 -86
- package/src/api/ChunkComponent/ChunkData/chunkDataConstraint.ts +0 -9
- package/src/api/ChunkComponent/ChunkData/chunkDataOption.ts +0 -17
- package/src/api/ChunkComponent/ChunkData/test/error.test.ts +0 -28
- package/src/api/ChunkComponent/ChunkData/test/mock.ts +0 -44
- package/src/api/ChunkComponent/ChunkData/test/normal.test.ts +0 -18
- package/src/api/ChunkComponent/ChunkData/validatePrefix.ts +0 -4
- package/src/api/ChunkComponent/ChunkLifetimes/ChunkLifetimes.test.ts +0 -24
- package/src/api/ChunkComponent/ChunkLifetimes/ChunkPageLifetimes.test.ts +0 -26
- package/src/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.ts +0 -27
- package/src/api/ChunkComponent/ChunkMethods/test/error.test.ts +0 -31
- package/src/api/ChunkComponent/ChunkMethods/test/normal.test.ts +0 -21
- package/src/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.ts +0 -3
- package/src/api/ChunkComponent/ChunkStore/ChunkStoreOption.ts +0 -33
- package/src/api/ChunkComponent/ChunkStore/test/error.test.ts +0 -36
- package/src/api/ChunkComponent/ChunkStore/test/mock.ts +0 -32
- package/src/api/ChunkComponent/ChunkStore/test/normal.test.ts +0 -52
- package/src/api/ChunkComponent/ChunkWatch/test/error.test.ts +0 -28
- package/src/api/ChunkComponent/ChunkWatch/test/normal.test.ts +0 -58
- package/src/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.ts +0 -3
- package/src/api/ChunkComponent/ChunklEvents/ChunkEventsOption.ts +0 -27
- package/src/api/ChunkComponent/ChunklEvents/test/error.test.ts +0 -24
- package/src/api/ChunkComponent/ChunklEvents/test/normal.test.ts +0 -26
- package/src/api/ChunkComponent/SlotComponentReturnType.ts +0 -32
- package/src/api/ChunkComponent/index.ts +0 -165
- package/src/api/CustomComponent/CustomComputed/CustomComputedConstraint.ts +0 -1
- package/src/api/CustomComponent/CustomMethods/CustomMethodsConstraint.ts +0 -3
- package/src/api/CustomComponent/CustomObservers/CustomObserversOption.ts +0 -3
- package/src/api/CustomComponent/CustomWatch/CustomWatchOption.ts +0 -3
- /package/dist/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.js +0 -0
- /package/dist/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/SubInstance.js +0 -0
- /package/dist/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.js +0 -0
- /package/dist/api/{CustomComponent → SubComponent}/returnType.js +0 -0
- /package/src/api/DefineComponent/{NameOrPage → NameOrPath}/test/error.test.ts +0 -0
- /package/src/api/DefineComponent/{NameOrPage → NameOrPath}/test/normal.test.ts +0 -0
- /package/src/api/{CustomComponent/CustomPageLifetimes → SubComponent/SubPageLifetimes}/test/error.test.ts +0 -0
- /package/src/api/{CustomComponent/CustomPageLifetimes → SubComponent/SubPageLifetimes}/test/normal.test.ts +0 -0
package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/normal.test.ts
RENAMED
|
@@ -4,7 +4,7 @@ import type { ComponentDoc } from "../../../DefineComponent/returnType/Component
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
|
-
import {
|
|
7
|
+
import { SubComponent } from "../..";
|
|
8
8
|
|
|
9
9
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
10
10
|
events: { aaa_str: string };
|
|
@@ -35,7 +35,7 @@ type $aaa = ComponentDoc<
|
|
|
35
35
|
{ properties: { aaa_str: string; aaa_user: User | null; aaa_num: number; aaa_age: number } }
|
|
36
36
|
>;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
39
39
|
// 1 CompDoc的properties为空时,可以写{}
|
|
40
40
|
computed: {},
|
|
41
41
|
});
|
|
@@ -49,7 +49,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
49
49
|
};
|
|
50
50
|
}>;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
SubComponent<Root, OnlyPropsCompDoc>()({
|
|
53
53
|
inherit: {
|
|
54
54
|
aaa_num: "num",
|
|
55
55
|
},
|
|
@@ -67,7 +67,7 @@ CustomComponent<Root, OnlyPropsCompDoc>()({
|
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
69
|
// 3 computed字段的返回类型应为对应的文档类型,避免返回字面量类型导致与实际文档类型不符
|
|
70
|
-
|
|
70
|
+
SubComponent<Root, OnlyPropsCompDoc>()({
|
|
71
71
|
computed: {
|
|
72
72
|
aaa_num() {
|
|
73
73
|
return 123;
|
|
@@ -127,7 +127,7 @@ CustomComponent<Root, OnlyPropsCompDoc>()({
|
|
|
127
127
|
|
|
128
128
|
// 计算属性可互相引用,但要加返回类型注释
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
SubComponent<Root, $aaa>()({
|
|
131
131
|
computed: {
|
|
132
132
|
aaa_num(): number {
|
|
133
133
|
return this.data.SNum;
|
|
@@ -144,7 +144,7 @@ CustomComponent<Root, $aaa>()({
|
|
|
144
144
|
},
|
|
145
145
|
});
|
|
146
146
|
// 计算属性this.data可获取store和data的字段中文档中的字段和内部字段(_开头的字段)
|
|
147
|
-
|
|
147
|
+
SubComponent<Root, $aaa>()({
|
|
148
148
|
data: {
|
|
149
149
|
aaa_age: 123,
|
|
150
150
|
_aaa_age1: 123,
|
|
@@ -161,7 +161,7 @@ CustomComponent<Root, $aaa>()({
|
|
|
161
161
|
},
|
|
162
162
|
});
|
|
163
163
|
// computed中可写 额外字段 isReady
|
|
164
|
-
|
|
164
|
+
SubComponent<{ data: { _num: number } }, $aaa>()({
|
|
165
165
|
computed: {
|
|
166
166
|
aaa_isReady() {
|
|
167
167
|
return true;
|
|
@@ -170,7 +170,7 @@ CustomComponent<{ data: { _num: number } }, $aaa>()({
|
|
|
170
170
|
});
|
|
171
171
|
|
|
172
172
|
// computed中可写 内部字段
|
|
173
|
-
|
|
173
|
+
SubComponent<{ data: { _num: number } }, $aaa>()({
|
|
174
174
|
computed: {
|
|
175
175
|
aaa_isReady() {
|
|
176
176
|
return true;
|
|
@@ -185,7 +185,7 @@ CustomComponent<{ data: { _num: number } }, $aaa>()({
|
|
|
185
185
|
type Custom = { type: "custom"; xxx: string };
|
|
186
186
|
type Chunk = { type: "chunk"; yyy: number };
|
|
187
187
|
type Union = Custom | Chunk;
|
|
188
|
-
|
|
188
|
+
SubComponent<{ data: { _num: number }; methods: { IsChunk: (union: Union) => union is Chunk } }, $aaa>()({
|
|
189
189
|
data: {
|
|
190
190
|
_aaa_union: { type: "custom", xxx: "123" } as Union,
|
|
191
191
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubDataOption<TData extends object, legalKeys extends PropertyKey, errMsg extends string> = {
|
|
4
4
|
/**
|
|
5
5
|
* 可写子组件所需数据和内部公共数据
|
|
6
6
|
* 非法字段检测和与Inherit字段的重复检测
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
|
|
3
3
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
4
|
-
import {
|
|
4
|
+
import { SubComponent } from "../..";
|
|
5
5
|
|
|
6
6
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
7
7
|
events: { aaa_str: string };
|
|
8
8
|
}>;
|
|
9
9
|
|
|
10
10
|
// 1 CompDoc无properties字段时 data字段只可写内部字段
|
|
11
|
-
|
|
11
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
12
12
|
data: {
|
|
13
13
|
// @ts-expect-error "⚠️ 与Inherit字段重复或组件文档无需字段 ⚠️"
|
|
14
14
|
aaa_str: "str",
|
|
@@ -25,7 +25,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
25
25
|
}>;
|
|
26
26
|
|
|
27
27
|
// 2 CompDoc有properties字段但去除Inherit字段后为空,只可写内部字段
|
|
28
|
-
|
|
28
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
29
29
|
inherit: {
|
|
30
30
|
aaa_str: "wxml",
|
|
31
31
|
aaa_num: "wxml",
|
|
@@ -41,7 +41,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
// 3 重复字段和非组件所需字段错误
|
|
44
|
-
|
|
44
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
45
45
|
inherit: {
|
|
46
46
|
aaa_str: "wxml",
|
|
47
47
|
},
|
|
@@ -56,7 +56,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
// 4 与root的数据字段重复
|
|
59
|
-
|
|
59
|
+
SubComponent<{ data: { aaa_str: 123 } }, OnlyPropsCompDoc>()({
|
|
60
60
|
data: {
|
|
61
61
|
// @ts-expect-error 与root的data字段重复
|
|
62
62
|
aaa_str: "a",
|
|
@@ -4,7 +4,7 @@ import type { ComponentDoc } from "../../../DefineComponent/returnType/Component
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
|
-
import {
|
|
7
|
+
import { SubComponent } from "../..";
|
|
8
8
|
|
|
9
9
|
type CompDoc = ComponentDoc<{
|
|
10
10
|
properties: {
|
|
@@ -14,7 +14,7 @@ type CompDoc = ComponentDoc<{
|
|
|
14
14
|
};
|
|
15
15
|
}>;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
SubComponent<{}, CompDoc>()({
|
|
18
18
|
inherit: {
|
|
19
19
|
aaa_obj: "wxml",
|
|
20
20
|
},
|
|
@@ -27,7 +27,7 @@ CustomComponent<{}, CompDoc>()({
|
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
SubComponent<{ data: { _num: number } }, CompDoc>()({
|
|
31
31
|
inherit: {
|
|
32
32
|
aaa_str: "wxml",
|
|
33
33
|
aaa_num: "wxml",
|
|
@@ -39,7 +39,7 @@ CustomComponent<{ data: { _num: number } }, CompDoc>()({
|
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
SubComponent<{}, CompDoc>()({
|
|
43
43
|
data: {
|
|
44
44
|
aaa_str: "a" as "a" | "b",
|
|
45
45
|
aaa_num: 123 as number,
|
|
@@ -66,7 +66,7 @@ CustomComponent<{}, CompDoc>()({
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
// 确保实例和setData中使用的data字段类型为文档中定义的类型而非data配置中的类型(data中配置的类型可能推导默认为字面量类型,通过加入Replace泛型替换为对应的文档类型。),
|
|
69
|
-
|
|
69
|
+
SubComponent<{ data: { _num: number } }, CompDoc>()({
|
|
70
70
|
data: {
|
|
71
71
|
aaa_obj: null, // 类型为null 而非 Mock_User | null
|
|
72
72
|
aaa_str: "a", // 类型为"a" 而非string
|
|
@@ -84,7 +84,7 @@ CustomComponent<{ data: { _num: number } }, CompDoc>()({
|
|
|
84
84
|
},
|
|
85
85
|
});
|
|
86
86
|
// data中可写 额外字段 isReady
|
|
87
|
-
|
|
87
|
+
SubComponent<{ data: { _num: number } }, CompDoc>()({
|
|
88
88
|
data: {
|
|
89
89
|
aaa_isReady: false,
|
|
90
90
|
},
|
|
@@ -7,7 +7,7 @@ import type { Bubbles, Capture, CustomEventsTags } from "../../RootComponent/Cus
|
|
|
7
7
|
/**
|
|
8
8
|
* 把组件事件类型转为函数类型,冒泡事件捕获事件会多一个加后缀(_catch)的key,表示阻止事件冒泡和捕获。
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type SubEventsConstraint<
|
|
11
11
|
CompDoc extends ComponentDoc,
|
|
12
12
|
> = {
|
|
13
13
|
[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubEventsOption<TSubEvents, SubEventsDoc extends object, legalKeys extends PropertyKey> = {
|
|
4
4
|
/**
|
|
5
5
|
* 子组件事件(基础事件|自定义事件)
|
|
6
6
|
* 可使用内部泛型(Detail、Mark、WMBaseEvent、WMCustomEvent、CurrentTargetDataset、TargetDataset)自定义事件类型
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
import type { Bubbles } from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
3
|
-
import {
|
|
3
|
+
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
type CompDoc = ComponentDoc<{
|
|
6
6
|
properties: {
|
|
@@ -9,7 +9,7 @@ type CompDoc = ComponentDoc<{
|
|
|
9
9
|
}>;
|
|
10
10
|
|
|
11
11
|
// 组件文档无自定义事件时,events字段类型为EmptyObject
|
|
12
|
-
|
|
12
|
+
SubComponent<{}, CompDoc>()({
|
|
13
13
|
events: {
|
|
14
14
|
// @ts-expect-error 非法字段
|
|
15
15
|
xxx: 123,
|
|
@@ -23,7 +23,7 @@ type CompDoc1 = ComponentDoc<{
|
|
|
23
23
|
}>;
|
|
24
24
|
|
|
25
25
|
// 非法字段检测 组件文档有自定义事件时,events下的字段仅可写文档包含字段
|
|
26
|
-
|
|
26
|
+
SubComponent<{}, CompDoc1>()({
|
|
27
27
|
events: {
|
|
28
28
|
aaa_str(e) { // ok
|
|
29
29
|
void e;
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
CaptureComposed,
|
|
15
15
|
} from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
16
16
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
17
|
-
import {
|
|
17
|
+
import { SubComponent } from "../..";
|
|
18
18
|
|
|
19
19
|
type CompDoc = ComponentDoc<{
|
|
20
20
|
events: {
|
|
@@ -29,7 +29,7 @@ type CompDoc = ComponentDoc<{
|
|
|
29
29
|
}>;
|
|
30
30
|
|
|
31
31
|
// 1.1 events字段提示 key为 CompDoc下customEvents的字段,类型为函数(e)=>void,e为对应keys类型去除事件标记(冒泡 捕获 穿透)
|
|
32
|
-
const custom1 =
|
|
32
|
+
const custom1 = SubComponent<{}, CompDoc>()({
|
|
33
33
|
events: {
|
|
34
34
|
aaa_str(e) {
|
|
35
35
|
Checking<typeof e.detail, string, Test.Pass>;
|
|
@@ -76,7 +76,7 @@ type custom1Expected = {
|
|
|
76
76
|
Checking<typeof custom1, custom1Expected, Test.Pass>;
|
|
77
77
|
|
|
78
78
|
// 2.1 key可写入后缀字段(_catch,表示阻止冒泡和捕获事件)。
|
|
79
|
-
const custom2 =
|
|
79
|
+
const custom2 = SubComponent<{}, CompDoc>()({
|
|
80
80
|
events: {
|
|
81
81
|
aaa_BubblesComposed_catch(e) {
|
|
82
82
|
Checking<typeof e.detail, string, Test.Pass>;
|
|
@@ -98,7 +98,7 @@ Checking<typeof custom2, {
|
|
|
98
98
|
// };
|
|
99
99
|
}, Test.Pass>;
|
|
100
100
|
|
|
101
|
-
const custom3 =
|
|
101
|
+
const custom3 = SubComponent<{}, CompDoc>()({
|
|
102
102
|
events: {
|
|
103
103
|
aaa_BubblesComposed_catch(e) {
|
|
104
104
|
Checking<typeof e.detail, string, Test.Pass>;
|
|
@@ -116,7 +116,7 @@ const custom3 = CustomComponent<{}, CompDoc>()({
|
|
|
116
116
|
Checking<typeof custom3, never, Test.Pass>;
|
|
117
117
|
|
|
118
118
|
// 3.1 基础组件基本事件参数为WMBaseEvent
|
|
119
|
-
|
|
119
|
+
SubComponent<{}, Wm.View>()({
|
|
120
120
|
events: {
|
|
121
121
|
view_tap(e) {
|
|
122
122
|
Checking<typeof e, WMBaseEvent, Test.Pass>;
|
|
@@ -129,7 +129,7 @@ CustomComponent<{}, Wm.View>()({
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
// 3.1 基础组件自定义事件参数为Detail<object>
|
|
132
|
-
|
|
132
|
+
SubComponent<{}, Wm.ScrollView>()({
|
|
133
133
|
events: {
|
|
134
134
|
scrollView_bindscroll(e) {
|
|
135
135
|
Checking<
|
|
@@ -150,7 +150,7 @@ CustomComponent<{}, Wm.ScrollView>()({
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
// 4 可为事件自定义类型
|
|
153
|
-
|
|
153
|
+
SubComponent<{}, Wm.View>()({
|
|
154
154
|
events: {
|
|
155
155
|
view_tap(e: Detail<number>) {
|
|
156
156
|
Checking<typeof e.detail, number, Test.Pass>;
|
|
@@ -163,7 +163,7 @@ CustomComponent<{}, Wm.View>()({
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
// 4 可为事件自定义类型
|
|
166
|
-
|
|
166
|
+
SubComponent<{}, Wm.View>()({
|
|
167
167
|
events: {
|
|
168
168
|
view_tap(e: Detail<number>) {
|
|
169
169
|
Checking<typeof e.detail, number, Test.Pass>;
|
|
@@ -176,7 +176,7 @@ CustomComponent<{}, Wm.View>()({
|
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
// 5 可以调用自身事件
|
|
179
|
-
|
|
179
|
+
SubComponent<{ methods: { aaa: () => string } }, Wm.View>()({
|
|
180
180
|
methods: {
|
|
181
181
|
view_xxx() {
|
|
182
182
|
return 123;
|
|
@@ -190,7 +190,7 @@ CustomComponent<{ methods: { aaa: () => string } }, Wm.View>()({
|
|
|
190
190
|
},
|
|
191
191
|
});
|
|
192
192
|
// 5 可以调用自身事件
|
|
193
|
-
|
|
193
|
+
SubComponent<{ methods: { aaa: () => string } }, Wm.Map>()({
|
|
194
194
|
methods: {
|
|
195
195
|
map_xxx() {
|
|
196
196
|
return 123;
|
|
@@ -10,7 +10,7 @@ type unionAddList<Keys extends string> = Keys | Keys[];
|
|
|
10
10
|
* 子组件inherit字段约束,key为构建组件所需的properties字段,类型为根组件数据的key或key[]或`WXMLSign`。要求根数据类型为子数据类型的子类型。当key的值来自wxml(循环产生的子数据等情况)时用`WXMLSign`表示。
|
|
11
11
|
* @returns object
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type SubInheritConstraint<AllRootData extends object, TComponentDoc extends ComponentDoc> = {
|
|
14
14
|
[k in keyof TComponentDoc["properties"]]?:
|
|
15
15
|
| unionAddList<RemoveInnerData<SelectKeys<AllRootData, TComponentDoc["properties"][k]> & string>>
|
|
16
16
|
| WXMLSign;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubInheritOption<TInherit extends object, legalKeys extends PropertyKey> = {
|
|
4
4
|
/**
|
|
5
5
|
* 继承来自根组件的数据(key)或'wxml',wxml表示数据来自`.wxml`文件(例如数据来自父元素循环wx:for的数据).
|
|
6
6
|
* inherit字段最终会在选项中删除,它的存在是为了ts开发时提供心智模型(类型检测),js开发好比注释功能.便于代码阅读。
|
package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/error.test.ts
RENAMED
|
@@ -2,8 +2,8 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import { DefineComponent } from "../../../DefineComponent";
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
4
4
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
5
|
+
import { SubComponent } from "../..";
|
|
6
|
+
import type { SubComponentDefinition } from "../../returnType";
|
|
7
7
|
|
|
8
8
|
type Mock_RootDoc = RootComponentDefinition<{
|
|
9
9
|
properties: {
|
|
@@ -37,7 +37,7 @@ type Mock_CompDoc = ComponentDoc<{
|
|
|
37
37
|
}>;
|
|
38
38
|
|
|
39
39
|
// 1 继承字段类型错误
|
|
40
|
-
|
|
40
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
41
41
|
inherit: {
|
|
42
42
|
// @ts-expect-error 1.1 [string | number] 不是 [number] 的子集
|
|
43
43
|
aaa_num: "unionStrNum",
|
|
@@ -49,13 +49,13 @@ CustomComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
// 2 inherit字段最终不会在组件配置中,意义在于通过声明继承字段便于类型判断,配置是否满足子组件文档的需求。下面示例中,配置不满足组件需求,Mock_CompDoc需要一些必传字段没有配置,即使这些字段存在在于根组件(或wmxl).而返回的字符串(错误),无法通过DefinedComponent Api 类型检测。
|
|
52
|
-
const customDoc =
|
|
52
|
+
const customDoc = SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
53
53
|
data: {
|
|
54
54
|
aaa_num: 123,
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
void Checking<typeof customDoc,
|
|
58
|
+
void Checking<typeof customDoc, SubComponentDefinition, Test.Fail>;
|
|
59
59
|
|
|
60
60
|
DefineComponent({
|
|
61
61
|
name: "xxx",
|
|
@@ -65,7 +65,7 @@ DefineComponent({
|
|
|
65
65
|
|
|
66
66
|
// 3 错误的key检查
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
69
69
|
inherit: {
|
|
70
70
|
aaa_num: "required_num",
|
|
71
71
|
// @ts-expect-error 3.1 不存在于组件中的key给错误提示
|
|
@@ -76,7 +76,7 @@ CustomComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
76
76
|
});
|
|
77
77
|
// 4 数组时类型错误
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
80
80
|
inherit: {
|
|
81
81
|
// @ts-expect-error 取消了数组类型,之前的版本允许数组类型表示三元表达式
|
|
82
82
|
aaa_num: ["optional_lit1eral_num", "require1d_num"],
|
package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/normal.test.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
3
|
-
import {
|
|
3
|
+
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* inherit字段最终会在选项中删除,它用ts开发类型检测。
|
|
@@ -35,7 +35,7 @@ type Mock_CompDoc = ComponentDoc<{
|
|
|
35
35
|
}>;
|
|
36
36
|
|
|
37
37
|
// 1 没有可继承的数据,类型可为'wxml',表示数据来自wxml(例如数据来自父元素循环wx:for后的数据等情况)
|
|
38
|
-
|
|
38
|
+
SubComponent<{}, Mock_CompDoc>()({
|
|
39
39
|
inherit: {
|
|
40
40
|
aaa_num: "wxml",
|
|
41
41
|
aaa_str: "wxml",
|
|
@@ -46,7 +46,7 @@ CustomComponent<{}, Mock_CompDoc>()({
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
// 2 RootDoc不为空时,可继承对应类型的字段。
|
|
49
|
-
|
|
49
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
50
50
|
inherit: {
|
|
51
51
|
aaa_num: "" as "optional_literal_num" | "required_num" | "wxml",
|
|
52
52
|
aaa_str: "" as "str" | "literal_str" | "wxml",
|
|
@@ -57,7 +57,7 @@ CustomComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
57
57
|
|
|
58
58
|
// 3 value为数组时,表示多个字段的联合类型
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
61
61
|
inherit: {
|
|
62
62
|
aaa_num: ["optional_literal_num", "required_num"],
|
|
63
63
|
aaa_str: ["literal_str", "str"],
|
|
@@ -67,7 +67,7 @@ CustomComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
// 4. 实例上没有computed字段。
|
|
70
|
-
|
|
70
|
+
SubComponent<{}, Mock_CompDoc>()({
|
|
71
71
|
computed: {
|
|
72
72
|
aaa_num() {
|
|
73
73
|
return 1;
|
package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/error.test.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { View } from "../../../../thirdLib/wm";
|
|
2
2
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
3
|
-
import {
|
|
3
|
+
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
type RootDoc = RootComponentDefinition<{
|
|
6
6
|
events: {
|
|
@@ -9,7 +9,7 @@ type RootDoc = RootComponentDefinition<{
|
|
|
9
9
|
}>;
|
|
10
10
|
|
|
11
11
|
// 实例中只存在RootDoc和自身的methods字段
|
|
12
|
-
|
|
12
|
+
SubComponent<RootDoc, View>()({
|
|
13
13
|
lifetimes: {
|
|
14
14
|
created() {
|
|
15
15
|
// @ts-expect-error 不存在的方法 (Root事件方法不可调用)
|
package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/normal.test.ts
RENAMED
|
@@ -5,7 +5,7 @@ import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersecti
|
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
7
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
8
|
-
import {
|
|
8
|
+
import { SubComponent } from "../..";
|
|
9
9
|
|
|
10
10
|
type RootDoc = RootComponentDefinition<{
|
|
11
11
|
properties: {
|
|
@@ -39,7 +39,7 @@ type CompDoc = ComponentDoc<{
|
|
|
39
39
|
};
|
|
40
40
|
}>;
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
SubComponent<RootDoc, CompDoc>()({
|
|
43
43
|
data: {
|
|
44
44
|
aaa_str: "str" as string,
|
|
45
45
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { SubMethodsConstraint } from "./SubMethodsConstraint";
|
|
4
4
|
|
|
5
|
-
export type
|
|
6
|
-
TMethods extends
|
|
5
|
+
export type SubMethodsOption<
|
|
6
|
+
TMethods extends SubMethodsConstraint,
|
|
7
7
|
TPrefix extends string,
|
|
8
8
|
ExcludedKeys extends PropertyKey,
|
|
9
9
|
> = {
|
package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/error.test.ts
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
import type { Bubbles } from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
3
3
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
4
|
-
import {
|
|
4
|
+
import { SubComponent } from "../..";
|
|
5
5
|
|
|
6
6
|
type RootDoc = RootComponentDefinition<{
|
|
7
7
|
methods: {
|
|
@@ -22,7 +22,7 @@ type CompDoc = ComponentDoc<{
|
|
|
22
22
|
}>;
|
|
23
23
|
|
|
24
24
|
// 1 前缀错误
|
|
25
|
-
|
|
25
|
+
SubComponent<RootDoc, CompDoc>()({
|
|
26
26
|
methods: {
|
|
27
27
|
// @ts-expect-error 1.1 前缀错误
|
|
28
28
|
xxx_yyy() {
|
|
@@ -32,7 +32,7 @@ CustomComponent<RootDoc, CompDoc>()({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// 2 重复检测
|
|
35
|
-
|
|
35
|
+
SubComponent<RootDoc, CompDoc>()({
|
|
36
36
|
events: {
|
|
37
37
|
aaa_str_catch() {
|
|
38
38
|
void 0;
|
package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/normarl.test.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
3
|
-
import {
|
|
3
|
+
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
type RootDoc = RootComponentDefinition<{
|
|
6
6
|
methods: {
|
|
@@ -15,7 +15,7 @@ type CompDoc = ComponentDoc<{
|
|
|
15
15
|
}>;
|
|
16
16
|
|
|
17
17
|
// methods字段同组件前缀
|
|
18
|
-
|
|
18
|
+
SubComponent<RootDoc, CompDoc>()({
|
|
19
19
|
methods: {
|
|
20
20
|
aaa_xxx() {
|
|
21
21
|
void 0;
|
|
@@ -28,6 +28,6 @@ CustomComponent<RootDoc, CompDoc>()({
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
// 2 默认可以为{}。
|
|
31
|
-
|
|
31
|
+
SubComponent<RootDoc, CompDoc>()({
|
|
32
32
|
methods: {},
|
|
33
33
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PageLifetimesOption } from "../../RootComponent/PageLifetimes/PageLifetimesOption";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubPageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends object> = PageLifetimesOption<
|
|
4
4
|
TIsPage,
|
|
5
5
|
PropertiesDoc
|
|
6
6
|
>;
|
package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/error.test.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
2
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
3
|
-
import {
|
|
3
|
+
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
type CompDoc = ComponentDoc<{
|
|
6
6
|
properties: {
|
|
@@ -10,7 +10,7 @@ type CompDoc = ComponentDoc<{
|
|
|
10
10
|
};
|
|
11
11
|
}>;
|
|
12
12
|
|
|
13
|
-
const SubDoc =
|
|
13
|
+
const SubDoc = SubComponent<{}, CompDoc>()({});
|
|
14
14
|
void SubDoc;
|
|
15
15
|
// 返回穿透的自定义事件, 并去除了前缀
|
|
16
16
|
type SubDocExpect = "缺少必传的字段aaa_str、aaa_bool";
|
package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/normal.test.ts
RENAMED
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
Capture,
|
|
9
9
|
CaptureComposed,
|
|
10
10
|
} from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
11
|
-
import {
|
|
11
|
+
import { SubComponent } from "../..";
|
|
12
12
|
|
|
13
13
|
type CompDoc = ComponentDoc<{
|
|
14
14
|
properties: {
|
|
@@ -24,7 +24,7 @@ type CompDoc = ComponentDoc<{
|
|
|
24
24
|
};
|
|
25
25
|
}>;
|
|
26
26
|
|
|
27
|
-
const SubDoc =
|
|
27
|
+
const SubDoc = SubComponent<{}, CompDoc>()({
|
|
28
28
|
data: {
|
|
29
29
|
aaa_str: "string",
|
|
30
30
|
},
|
|
@@ -44,7 +44,7 @@ type SubDocExpect = {
|
|
|
44
44
|
|
|
45
45
|
Checking<typeof SubDoc, SubDocExpect, Test.Pass>();
|
|
46
46
|
// 去除已经声明的穿透事件
|
|
47
|
-
const removeCatchedEvents =
|
|
47
|
+
const removeCatchedEvents = SubComponent<{}, CompDoc>()({
|
|
48
48
|
data: {
|
|
49
49
|
aaa_str: "string",
|
|
50
50
|
},
|
|
@@ -72,7 +72,7 @@ void removeCatchedEvents;
|
|
|
72
72
|
|
|
73
73
|
Checking<typeof removeCatchedEvents, never, Test.Pass>();
|
|
74
74
|
// 去除有后缀时,已经声明的穿透事件
|
|
75
|
-
const removeCatchedEventsOfSuffix =
|
|
75
|
+
const removeCatchedEventsOfSuffix = SubComponent<{}, CompDoc, "aa">()({
|
|
76
76
|
data: {
|
|
77
77
|
aaaAa_str: "string",
|
|
78
78
|
},
|