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
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
2
|
-
|
|
3
|
-
export type Mock_RootDoc = RootComponentDefinition<{
|
|
4
|
-
properties: {
|
|
5
|
-
required_num: number;
|
|
6
|
-
optional_literal_num?: 123 | 456 | 789;
|
|
7
|
-
unionStrNum: string | number;
|
|
8
|
-
required_obj: object | null;
|
|
9
|
-
optional_obj?: object | null;
|
|
10
|
-
slot_num: number;
|
|
11
|
-
_slot_str: string;
|
|
12
|
-
};
|
|
13
|
-
data: {
|
|
14
|
-
str: string;
|
|
15
|
-
literal_str: "a" | "b" | "c";
|
|
16
|
-
bool: boolean;
|
|
17
|
-
};
|
|
18
|
-
store: {
|
|
19
|
-
Storeinon: string | boolean;
|
|
20
|
-
};
|
|
21
|
-
computed: {
|
|
22
|
-
Cuinon: string | boolean;
|
|
23
|
-
};
|
|
24
|
-
}>;
|
|
25
|
-
|
|
26
|
-
// export type Mock_SubDoc = {
|
|
27
|
-
// allDatas: {
|
|
28
|
-
// aaa_num: number;
|
|
29
|
-
// aaa_literal_num: 123 | 456;
|
|
30
|
-
// aaa_str?: string;
|
|
31
|
-
// aaa_union: string | boolean;
|
|
32
|
-
// aaa_obj: object | null;
|
|
33
|
-
// aaa_obj1?: object | null;
|
|
34
|
-
// aaa_computed: string | boolean;
|
|
35
|
-
// aaa_store: string | boolean;
|
|
36
|
-
// };
|
|
37
|
-
// };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Checking } from "hry-types";
|
|
2
|
-
import type { ComputeObject } from "../../../../types/ComputeObject";
|
|
3
|
-
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
4
|
-
import { ChunkComponent } from "../..";
|
|
5
|
-
import type { Mock_RootDoc } from "./mock";
|
|
6
|
-
|
|
7
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
8
|
-
data: {
|
|
9
|
-
slot_a: 1,
|
|
10
|
-
},
|
|
11
|
-
store: {
|
|
12
|
-
slot_b: () => 1,
|
|
13
|
-
},
|
|
14
|
-
computed: {
|
|
15
|
-
// 1. 可以使用Mock_RootDoc中的字段
|
|
16
|
-
slot_aaa(): object | null {
|
|
17
|
-
return this.data.optional_obj;
|
|
18
|
-
},
|
|
19
|
-
// 3. 可以使用data和store中的字段
|
|
20
|
-
_slot_ccc(): number {
|
|
21
|
-
return this.data.slot_a + this.data.slot_b;
|
|
22
|
-
},
|
|
23
|
-
// 4.可以使用computed中的字段
|
|
24
|
-
_slot_ddd(): number {
|
|
25
|
-
return this.data._slot_ccc + 1;
|
|
26
|
-
},
|
|
27
|
-
// 5. this.data
|
|
28
|
-
slot_eee(): number {
|
|
29
|
-
// 5 this.data
|
|
30
|
-
void Checking<
|
|
31
|
-
typeof this.data,
|
|
32
|
-
ComputeObject<
|
|
33
|
-
& {
|
|
34
|
-
slot_a: number;
|
|
35
|
-
slot_b: number;
|
|
36
|
-
slot_aaa: object | null;
|
|
37
|
-
_slot_ccc: number;
|
|
38
|
-
_slot_ddd: number;
|
|
39
|
-
slot_eee: number;
|
|
40
|
-
}
|
|
41
|
-
& Required<Mock_RootDoc["properties"]>
|
|
42
|
-
& Mock_RootDoc["data"]
|
|
43
|
-
& Mock_RootDoc["computed"]
|
|
44
|
-
& Mock_RootDoc["store"]
|
|
45
|
-
& IInjectAllData
|
|
46
|
-
>,
|
|
47
|
-
true
|
|
48
|
-
>;
|
|
49
|
-
|
|
50
|
-
return 123;
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// computed中可以使用this实例 之前只能使用this.data字段
|
|
56
|
-
type Custom = { type: "custom"; xxx: string };
|
|
57
|
-
type Chunk = { type: "chunk"; yyy: number };
|
|
58
|
-
type Union = Custom | Chunk;
|
|
59
|
-
ChunkComponent<{ data: { _num: number }; methods: { IsChunk: (union: Union) => union is Chunk } }, "aaa">()({
|
|
60
|
-
data: {
|
|
61
|
-
_aaa_union: { type: "custom", xxx: "123" } as Union,
|
|
62
|
-
},
|
|
63
|
-
computed: {
|
|
64
|
-
_aaa_count(): string | number {
|
|
65
|
-
const { _aaa_union } = this.data;
|
|
66
|
-
return this.aaa_isCustom(_aaa_union) ? _aaa_union.xxx : _aaa_union.yyy;
|
|
67
|
-
},
|
|
68
|
-
_aaa_isChunk(): boolean {
|
|
69
|
-
const { _aaa_union } = this.data;
|
|
70
|
-
return this.IsChunk(_aaa_union);
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
methods: {
|
|
74
|
-
aaa_isCustom(union: Union): union is Custom {
|
|
75
|
-
return union.type === "custom";
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
// 2
|
|
80
|
-
ChunkComponent<{}>()({
|
|
81
|
-
computed: {
|
|
82
|
-
xxx(): string {
|
|
83
|
-
return "";
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
-
|
|
3
|
-
export type ChunkDataConstraint<Prefix extends string> = IfExtends<
|
|
4
|
-
"",
|
|
5
|
-
Prefix,
|
|
6
|
-
{},
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
|
|
8
|
-
{ [k in (`${Prefix}_${string}` | `_${Prefix}_${string}`)]: unknown }
|
|
9
|
-
>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
|
-
import type { Validators } from "../../../types/Validators";
|
|
3
|
-
import type { ValidatorPrefix } from "./validatePrefix";
|
|
4
|
-
|
|
5
|
-
export type ChunkDataOption<TData extends object, TDuplicateKeys extends PropertyKey, Prefix extends string> = {
|
|
6
|
-
/**
|
|
7
|
-
* slot块数据
|
|
8
|
-
*/
|
|
9
|
-
data?:
|
|
10
|
-
& TData
|
|
11
|
-
& Validators<
|
|
12
|
-
[
|
|
13
|
-
G.DuplicateFieldValidator<TData, TDuplicateKeys, "字段重复">,
|
|
14
|
-
ValidatorPrefix<TData, Prefix>,
|
|
15
|
-
]
|
|
16
|
-
>;
|
|
17
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ChunkComponent } from "../..";
|
|
2
|
-
import type { Mock_RootDoc } from "./mock";
|
|
3
|
-
|
|
4
|
-
// 1 前缀错误
|
|
5
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
6
|
-
data: {
|
|
7
|
-
// @ts-expect-error "⚠️字段不合法,请使用'slot_'或'_slot_'开头的字段名⚠️")
|
|
8
|
-
xxx_num: 1,
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// 2. 内部字段前缀错误
|
|
13
|
-
ChunkComponent<Mock_RootDoc, "xxx">()({
|
|
14
|
-
data: {
|
|
15
|
-
// @ts-expect-error "⚠️字段不合法,请使用'xxx_'或'_xxx_'开头的字段名⚠️")
|
|
16
|
-
_xxxx_num: 1,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// 3. 与父级字段重复
|
|
21
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
22
|
-
data: {
|
|
23
|
-
// @ts-expect-error 与RootDoc中的 "⚠️字段重复⚠️")
|
|
24
|
-
slot_num: 1,
|
|
25
|
-
// @ts-expect-error 与RootDoc中的 "⚠️字段重复⚠️")
|
|
26
|
-
_slot_str: "1",
|
|
27
|
-
},
|
|
28
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
2
|
-
|
|
3
|
-
export type Mock_RootDoc = RootComponentDefinition<{
|
|
4
|
-
properties: {
|
|
5
|
-
required_num: number;
|
|
6
|
-
optional_literal_num?: 123 | 456 | 789;
|
|
7
|
-
unionStrNum: string | number;
|
|
8
|
-
required_obj: object | null;
|
|
9
|
-
optional_obj?: object | null;
|
|
10
|
-
slot_num: number;
|
|
11
|
-
_slot_str: string;
|
|
12
|
-
};
|
|
13
|
-
data: {
|
|
14
|
-
str: string;
|
|
15
|
-
literal_str: "a" | "b" | "c";
|
|
16
|
-
bool: boolean;
|
|
17
|
-
};
|
|
18
|
-
computed: {
|
|
19
|
-
Cuinon: string | boolean;
|
|
20
|
-
};
|
|
21
|
-
events: {
|
|
22
|
-
xxx_onTap: string;
|
|
23
|
-
};
|
|
24
|
-
methods: {
|
|
25
|
-
xxx_test: () => void;
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
28
|
-
|
|
29
|
-
// export type Mock_SubDoc = {
|
|
30
|
-
// allDatas: {
|
|
31
|
-
// aaa_num: number;
|
|
32
|
-
// aaa_literal_num: 123 | 456;
|
|
33
|
-
// aaa_str?: string;
|
|
34
|
-
// aaa_union: string | boolean;
|
|
35
|
-
// aaa_obj: object | null;
|
|
36
|
-
// aaa_obj1?: object | null;
|
|
37
|
-
// };
|
|
38
|
-
// events: {
|
|
39
|
-
// xxx_subEvent: () => string;
|
|
40
|
-
// };
|
|
41
|
-
// methods: {
|
|
42
|
-
// xxx_subMethods: () => void;
|
|
43
|
-
// };
|
|
44
|
-
// };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ChunkComponent } from "../..";
|
|
2
|
-
import type { Mock_RootDoc } from "./mock";
|
|
3
|
-
|
|
4
|
-
// 1 不传入第二个泛型,可写入任意字段
|
|
5
|
-
ChunkComponent<Mock_RootDoc>()({
|
|
6
|
-
data: {
|
|
7
|
-
xxx: 123,
|
|
8
|
-
_xxx: 123,
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// 2 传入第二个泛型,可写入前缀为 slot_ 或者 _slot_ 的字段
|
|
13
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
14
|
-
data: {
|
|
15
|
-
slot_xxx: 123,
|
|
16
|
-
_slot_xxx: 123,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
-
import { ChunkComponent } from "..";
|
|
3
|
-
import type { Mock_RootDoc } from "../ChunkData/test/mock";
|
|
4
|
-
|
|
5
|
-
// 1. 页面时组件的生命周期
|
|
6
|
-
ChunkComponent<Mock_RootDoc & { isPage: true }, "ggg">()({
|
|
7
|
-
lifetimes: {
|
|
8
|
-
attached() {
|
|
9
|
-
},
|
|
10
|
-
detached() {
|
|
11
|
-
},
|
|
12
|
-
// ...
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
// 2. 组件时组件的生命周期
|
|
16
|
-
ChunkComponent<Mock_RootDoc, "ggg">()({
|
|
17
|
-
lifetimes: {
|
|
18
|
-
attached() {
|
|
19
|
-
},
|
|
20
|
-
detached() {
|
|
21
|
-
},
|
|
22
|
-
// ...
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
3
|
-
import { ChunkComponent } from "..";
|
|
4
|
-
import type { Mock_RootDoc } from "../ChunkData/test/mock";
|
|
5
|
-
|
|
6
|
-
// 1. 页面时页面的生命周期
|
|
7
|
-
ChunkComponent<Mock_RootDoc & { isPage: true }, "ggg">()({
|
|
8
|
-
pageLifetimes: {
|
|
9
|
-
onLoad(props) {
|
|
10
|
-
props.required_num;
|
|
11
|
-
},
|
|
12
|
-
onShow() {
|
|
13
|
-
},
|
|
14
|
-
// ...
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
// 2. 组件时页面的生命周期
|
|
18
|
-
ChunkComponent<Mock_RootDoc, "ggg">()({
|
|
19
|
-
pageLifetimes: {
|
|
20
|
-
show() {
|
|
21
|
-
},
|
|
22
|
-
hide() {
|
|
23
|
-
},
|
|
24
|
-
// ...
|
|
25
|
-
},
|
|
26
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
|
-
import type { IfExtends } from "hry-types/src/Any/_api";
|
|
3
|
-
import type { Validators } from "../../../types/Validators";
|
|
4
|
-
import type { MethodsConstraint } from "../../RootComponent/Methods/MethodsConstraint";
|
|
5
|
-
|
|
6
|
-
export type ChunkMethodsOption<
|
|
7
|
-
TMethods extends MethodsConstraint,
|
|
8
|
-
TDuplicateKeys extends PropertyKey,
|
|
9
|
-
Prefix extends string,
|
|
10
|
-
> = {
|
|
11
|
-
/**
|
|
12
|
-
* 与customEvents和events字段重复检测
|
|
13
|
-
*/
|
|
14
|
-
methods?:
|
|
15
|
-
& TMethods
|
|
16
|
-
& Validators<
|
|
17
|
-
[
|
|
18
|
-
G.DuplicateFieldValidator<TMethods, TDuplicateKeys, "字段重复">,
|
|
19
|
-
IfExtends<
|
|
20
|
-
MethodsConstraint,
|
|
21
|
-
TMethods,
|
|
22
|
-
unknown,
|
|
23
|
-
IfExtends<Prefix, "", unknown, G.KeyValidator<TMethods, `${Prefix}_${string}`, "前缀错误">>
|
|
24
|
-
>,
|
|
25
|
-
]
|
|
26
|
-
>;
|
|
27
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
-
import { ChunkComponent } from "../..";
|
|
3
|
-
import type { Mock_RootDoc } from "../../ChunkData/test/mock";
|
|
4
|
-
|
|
5
|
-
// 1. 与RootDoc的event或methods重复
|
|
6
|
-
ChunkComponent<Mock_RootDoc, "xxx">()({
|
|
7
|
-
methods: {
|
|
8
|
-
// @ts-expect-error 与RootDoc的events中的字段重复
|
|
9
|
-
xxx_onTap() {},
|
|
10
|
-
// @ts-expect-error 与RootDoc的methods中的字段重复
|
|
11
|
-
xxx_test() {},
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// 3 与自身的events中的字段重复
|
|
16
|
-
ChunkComponent<Mock_RootDoc, "xxx">()({
|
|
17
|
-
events: {
|
|
18
|
-
xxx_eventA() {},
|
|
19
|
-
},
|
|
20
|
-
methods: {
|
|
21
|
-
// @ts-expect-error 与自身的events中的字段重复
|
|
22
|
-
xxx_eventA() {},
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
// 4 前缀错误
|
|
26
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
27
|
-
methods: {
|
|
28
|
-
// @ts-expect-error "⚠️字段不合法,请使用'slot_'或'_slot_'开头的字段名⚠️")
|
|
29
|
-
xxx_num() {},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
|
-
import { Checking } from "hry-types";
|
|
3
|
-
import { ChunkComponent } from "../..";
|
|
4
|
-
import type { Mock_RootDoc } from "../../ChunkData/test/mock";
|
|
5
|
-
|
|
6
|
-
// 1. 定义前缀为ddd的方法
|
|
7
|
-
ChunkComponent<Mock_RootDoc, "ddd">()({
|
|
8
|
-
methods: {
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10
|
-
ddd_xxx() {},
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// 2. 可以调用RootDoc中的methods字段
|
|
15
|
-
ChunkComponent<Mock_RootDoc, "ddd">()({
|
|
16
|
-
methods: {
|
|
17
|
-
ddd_xxx() {
|
|
18
|
-
Checking<ReturnType<typeof this.xxx_test>, void, true>;
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
|
-
import type { Validators } from "../../../types/Validators";
|
|
3
|
-
import type { TypeValidator } from "../../RootComponent/Store/StoreOption";
|
|
4
|
-
import type { ValidatorPrefix } from "../ChunkData/validatePrefix";
|
|
5
|
-
import type { ChunkStoreConstraint } from "./ChunkStoreConstraint";
|
|
6
|
-
|
|
7
|
-
export type ChunkStoreOption<
|
|
8
|
-
TStore extends ChunkStoreConstraint,
|
|
9
|
-
TDuplicateKeys extends PropertyKey,
|
|
10
|
-
Prefix extends string,
|
|
11
|
-
> = {
|
|
12
|
-
/**
|
|
13
|
-
* 全局响应式数据字段,全局store对应数据变化实例对应数据自动setData。与properties和data字段有重复检测
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* {
|
|
17
|
-
* //...
|
|
18
|
-
* store: {
|
|
19
|
-
* responsiveData: () => sroreX.str,
|
|
20
|
-
* },
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
store?:
|
|
25
|
-
& TStore
|
|
26
|
-
& Validators<
|
|
27
|
-
[
|
|
28
|
-
G.DuplicateFieldValidator<TStore, TDuplicateKeys, "字段重复">,
|
|
29
|
-
ValidatorPrefix<TStore, Prefix>,
|
|
30
|
-
TypeValidator<TStore>,
|
|
31
|
-
]
|
|
32
|
-
>;
|
|
33
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ChunkComponent } from "../..";
|
|
2
|
-
import type { Mock_RootDoc } from "./mock";
|
|
3
|
-
|
|
4
|
-
// 1 前缀错误
|
|
5
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
6
|
-
store: {
|
|
7
|
-
// @ts-expect-error "⚠️字段不合法,请使用'slot_'或'_slot_'开头的字段名⚠️")
|
|
8
|
-
xxx_num: () => 1,
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// 2. 内部字段前缀错误
|
|
13
|
-
ChunkComponent<Mock_RootDoc, "xxx">()({
|
|
14
|
-
store: {
|
|
15
|
-
// @ts-expect-error "⚠️字段不合法,请使用'xxx_'或'_xxx_'开头的字段名⚠️")
|
|
16
|
-
_xxxx_num: () => 1,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// 3. 与父级字段重复
|
|
21
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
22
|
-
store: {
|
|
23
|
-
// @ts-expect-error "⚠️字段重复⚠️")
|
|
24
|
-
slot_num: () => 1,
|
|
25
|
-
// @ts-expect-error "⚠️字段重复⚠️")
|
|
26
|
-
_slot_str: () => "1",
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// 4. 返回类型错误
|
|
31
|
-
ChunkComponent<{ properties: { categoryId: string } }>()({
|
|
32
|
-
store: {
|
|
33
|
-
// @ts-expect-error 4.1 返回类型中不可以包含undefined
|
|
34
|
-
categoryList: () => undefined,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
2
|
-
|
|
3
|
-
export type Mock_RootDoc = RootComponentDefinition<{
|
|
4
|
-
properties: {
|
|
5
|
-
required_num: number;
|
|
6
|
-
optional_literal_num?: 123 | 456 | 789;
|
|
7
|
-
unionStrNum: string | number;
|
|
8
|
-
required_obj: object | null;
|
|
9
|
-
optional_obj?: object | null;
|
|
10
|
-
slot_num: number;
|
|
11
|
-
_slot_str: string;
|
|
12
|
-
};
|
|
13
|
-
data: {
|
|
14
|
-
str: string;
|
|
15
|
-
literal_str: "a" | "b" | "c";
|
|
16
|
-
bool: boolean;
|
|
17
|
-
};
|
|
18
|
-
computed: {
|
|
19
|
-
Cuinon: string | boolean;
|
|
20
|
-
};
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
// export type Mock_SubDoc = {
|
|
24
|
-
// allDatas: {
|
|
25
|
-
// aaa_num: number;
|
|
26
|
-
// aaa_literal_num: 123 | 456;
|
|
27
|
-
// aaa_str?: string;
|
|
28
|
-
// aaa_union: string | boolean;
|
|
29
|
-
// aaa_obj: object | null;
|
|
30
|
-
// aaa_obj1?: object | null;
|
|
31
|
-
// };
|
|
32
|
-
// };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ChunkComponent } from "../..";
|
|
2
|
-
import type { Mock_RootDoc } from "./mock";
|
|
3
|
-
|
|
4
|
-
// 1 可以使用前缀字段
|
|
5
|
-
ChunkComponent<Mock_RootDoc, "slot">()({
|
|
6
|
-
store: {
|
|
7
|
-
slot_xxx: () => 123,
|
|
8
|
-
_slot_yyy: () => "str",
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// type User = {
|
|
13
|
-
// name: string;
|
|
14
|
-
// age?: number;
|
|
15
|
-
// };
|
|
16
|
-
// type AllGoods = Record<string, User[]>;
|
|
17
|
-
// const M_User = observable({
|
|
18
|
-
// allUser: {
|
|
19
|
-
// categoryA: [{ name: "zhao", age: 20 }],
|
|
20
|
-
// categoryB: [{ name: "zhao" }],
|
|
21
|
-
// } as AllGoods,
|
|
22
|
-
// });
|
|
23
|
-
|
|
24
|
-
// ChunkComponent<{ properties: { categoryId: string } }>()({
|
|
25
|
-
// data: {
|
|
26
|
-
// // categoryList:[],
|
|
27
|
-
// },
|
|
28
|
-
// store: {
|
|
29
|
-
// // 1 响应式不包含undefined时 只能写成getter函数形式
|
|
30
|
-
// categoryList: (data) => M_User.allUser[data.categoryId],
|
|
31
|
-
// // 2 响应式数据包含undefined时 只能写成对象形式
|
|
32
|
-
// _categoryList: {
|
|
33
|
-
// getter: (data) => M_User.allUser[data.categoryId][0].age,
|
|
34
|
-
// default: 0,
|
|
35
|
-
// },
|
|
36
|
-
// _categoryList1: {
|
|
37
|
-
// getter: (data) => M_User.allUser[data.categoryId] as User[] | undefined,
|
|
38
|
-
// // 默认值为[]
|
|
39
|
-
// default: [],
|
|
40
|
-
// },
|
|
41
|
-
// _categoryList2: {
|
|
42
|
-
// getter: (data) => M_User.allUser[data.categoryId][0] as User | undefined,
|
|
43
|
-
// // 对象类型 默认值为User类型
|
|
44
|
-
// default: { name: "zhao", age: 20 },
|
|
45
|
-
// },
|
|
46
|
-
// _categoryList3: {
|
|
47
|
-
// getter: (data) => M_User.allUser[data.categoryId][0] as User | undefined,
|
|
48
|
-
// // 对象类型 默认值可以为null
|
|
49
|
-
// default: null,
|
|
50
|
-
// },
|
|
51
|
-
// },
|
|
52
|
-
// });
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ChunkComponent } from "../..";
|
|
2
|
-
import type { Mock_RootDoc } from "../../ChunkComputed/test/mock";
|
|
3
|
-
export type User = {
|
|
4
|
-
name: string;
|
|
5
|
-
age?: number;
|
|
6
|
-
};
|
|
7
|
-
// 1. 没有对应字段报错
|
|
8
|
-
ChunkComponent<Mock_RootDoc, "zzz">()({
|
|
9
|
-
watch: {
|
|
10
|
-
// @ts-expect-error 没有对应字段报错
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
12
|
-
xxx() {},
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
// 2. 不可以watch含有null类型对象的子字段
|
|
16
|
-
ChunkComponent<{ data: { user: User | null } }, "zzz">()({
|
|
17
|
-
watch: {
|
|
18
|
-
user(newValue, oldValue) {
|
|
19
|
-
void oldValue;
|
|
20
|
-
void newValue;
|
|
21
|
-
},
|
|
22
|
-
// @ts-expect-error 不能watch子字段 因为user可能为null
|
|
23
|
-
"user.name"(newValue, oldValue) {
|
|
24
|
-
void oldValue;
|
|
25
|
-
void newValue;
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Checking } from "hry-types";
|
|
2
|
-
import { observable } from "mobx";
|
|
3
|
-
import { ChunkComponent } from "../..";
|
|
4
|
-
import type { Mock_RootDoc } from "../../ChunkData/test/mock";
|
|
5
|
-
|
|
6
|
-
const obj = observable({
|
|
7
|
-
gender: "male" as "male" | "female",
|
|
8
|
-
});
|
|
9
|
-
type Mock_user = {
|
|
10
|
-
name: string;
|
|
11
|
-
age?: number;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* watch data字段 深度只读
|
|
15
|
-
*/
|
|
16
|
-
ChunkComponent<Mock_RootDoc, "zzz">()({
|
|
17
|
-
data: {
|
|
18
|
-
zzz_num: 123,
|
|
19
|
-
zzz_obj: {} as Mock_user,
|
|
20
|
-
},
|
|
21
|
-
store: {
|
|
22
|
-
zzz_gender: () => obj.gender,
|
|
23
|
-
},
|
|
24
|
-
computed: {
|
|
25
|
-
zzz_computed(): number {
|
|
26
|
-
return this.data.zzz_num + (this.data.zzz_obj.age ?? 1);
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
watch: {
|
|
30
|
-
// watch data字段
|
|
31
|
-
zzz_num(newValue, oldValue) {
|
|
32
|
-
void oldValue;
|
|
33
|
-
void Checking<number, typeof newValue, true>;
|
|
34
|
-
|
|
35
|
-
void Checking<number, typeof oldValue, true>;
|
|
36
|
-
},
|
|
37
|
-
// watch store字段
|
|
38
|
-
zzz_obj(newValue, oldValue) {
|
|
39
|
-
void oldValue;
|
|
40
|
-
void Checking<Mock_user, typeof newValue, true>;
|
|
41
|
-
|
|
42
|
-
void Checking<Mock_user, typeof oldValue, true>;
|
|
43
|
-
},
|
|
44
|
-
// watch computed字段
|
|
45
|
-
zzz_computed(newValue: number, oldValue: number) {
|
|
46
|
-
void oldValue;
|
|
47
|
-
void Checking<number, typeof newValue, true>;
|
|
48
|
-
void Checking<number, typeof oldValue, true>;
|
|
49
|
-
},
|
|
50
|
-
// watch RootDoc字段
|
|
51
|
-
optional_obj(newValue, oldValue) {
|
|
52
|
-
void oldValue;
|
|
53
|
-
void Checking<object | null, typeof newValue, true>;
|
|
54
|
-
|
|
55
|
-
void Checking<object | null, typeof oldValue, true>;
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
|
-
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
3
|
-
import type { Validators } from "../../../types/Validators";
|
|
4
|
-
import type { ChunkEventsConstraint } from "./ChunkEventsConstraint";
|
|
5
|
-
|
|
6
|
-
export type ChunkEventsOption<
|
|
7
|
-
TEvents extends ChunkEventsConstraint,
|
|
8
|
-
TDuplicateKeys extends PropertyKey,
|
|
9
|
-
Prefix extends string,
|
|
10
|
-
> = {
|
|
11
|
-
/**
|
|
12
|
-
* slot块数据
|
|
13
|
-
*/
|
|
14
|
-
events?:
|
|
15
|
-
& TEvents
|
|
16
|
-
& Validators<
|
|
17
|
-
[
|
|
18
|
-
G.DuplicateFieldValidator<TEvents, TDuplicateKeys, "字段重复">,
|
|
19
|
-
IfExtends<
|
|
20
|
-
ChunkEventsConstraint,
|
|
21
|
-
TEvents,
|
|
22
|
-
unknown,
|
|
23
|
-
IfExtends<Prefix, "", unknown, G.KeyValidator<TEvents, `${Prefix}_${string}`, "前缀错误">>
|
|
24
|
-
>,
|
|
25
|
-
]
|
|
26
|
-
>;
|
|
27
|
-
};
|