annil 1.7.4 → 1.7.5-beta.4
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 +30 -0
- package/README.md +11 -7
- package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.d.ts +9 -0
- package/dist/api/DefineComponent/ReturnType/ComponentDoc.d.ts +9 -0
- package/dist/api/DefineComponent/ReturnType/GetCustomEventDocOfSubDoc.d.ts +8 -0
- package/dist/api/DefineComponent/ReturnType/PageDoc.d.ts +9 -0
- package/dist/api/DefineComponent/RootComponent/RootComponentOption.d.ts +6 -0
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +6 -0
- package/dist/api/DefineComponent/index.d.ts +5 -4
- package/dist/api/DefineComponent/index.js +8 -2
- package/dist/api/DefineComponent/index.js.map +1 -1
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/computedUpdater.d.ts +1 -1
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/computedUpdater.js +5 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.js.map +1 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/data-tracer.d.ts +3 -1
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/data-tracer.js +4 -1
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/data-tracer.js.map +1 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/dependencesOptimize.js +5 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/dependencesOptimize.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPathsValue.d.ts +7 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPathsValue.js +30 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPathsValue.js.map +1 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/getPropertiesValue.js +3 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPropertiesValue.js.map +1 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/index.js +13 -3
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/index.js.map +1 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/initComputedAndGetCache.d.ts +9 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/initComputedAndGetCache.js +21 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/initComputedAndGetCache.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/isEqual.d.ts +7 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/isEqual.js +69 -0
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/isEqual.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.d.ts +6 -0
- package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js +23 -0
- package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.d.ts +6 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js +16 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.d.ts +5 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.js +17 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.d.ts +7 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js +20 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.d.ts +10 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.js +26 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.js.map +1 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/index.d.ts +20 -18
- package/dist/api/DefineComponent/normalizeOptions/index.js +77 -0
- package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -0
- package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/initStore/index.js +2 -0
- package/dist/api/DefineComponent/normalizeOptions/initStore/index.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.d.ts +3 -0
- package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js +43 -0
- package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.d.ts +5 -0
- package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.js +23 -0
- package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.d.ts +6 -0
- package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.js +24 -0
- package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.d.ts +9 -0
- package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.js +18 -0
- package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.d.ts +7 -0
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js +17 -0
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.d.ts +5 -0
- package/dist/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.js +34 -0
- package/dist/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.d.ts +3 -0
- package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.js +11 -0
- package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.js.map +1 -0
- package/dist/api/InstanceInject/instanceConfig.d.ts +4 -0
- package/dist/api/InstanceInject/instanceConfig.js +5 -1
- package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
- package/dist/api/RootComponent/Computed/ComputedConstraint.d.ts +4 -1
- package/dist/api/RootComponent/Computed/ComputedOption.d.ts +23 -0
- package/dist/api/RootComponent/Computed/GetComputedDoc.d.ts +5 -0
- package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +3 -0
- package/dist/api/RootComponent/CustomEvents/CustomEventsOption.d.ts +29 -0
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +13 -0
- package/dist/api/RootComponent/Data/DataOption.d.ts +14 -0
- package/dist/api/RootComponent/Events/EventsConstraint.d.ts +4 -1
- package/dist/api/RootComponent/Events/EventsOption.d.ts +52 -0
- package/dist/api/RootComponent/Instance/CustomSetData.d.ts +6 -0
- package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +9 -0
- package/dist/api/RootComponent/IsPage/IsPageOption.d.ts +3 -0
- package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.d.ts +5 -2
- package/dist/api/RootComponent/Lifetimes/LifetimesOption.d.ts +26 -0
- package/dist/api/RootComponent/Methods/MethodsOption.d.ts +3 -0
- package/dist/api/RootComponent/Observers/ObserversOption.d.ts +4 -0
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +11 -0
- package/dist/api/RootComponent/Properties/GetOptionalDoc.d.ts +3 -0
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.d.ts +3 -0
- package/dist/api/RootComponent/Properties/GetRequiredDoc.d.ts +4 -0
- package/dist/api/RootComponent/Properties/PropertiesConstraint.d.ts +18 -0
- package/dist/api/RootComponent/Properties/PropertiesOption.d.ts +10 -0
- package/dist/api/RootComponent/Properties/PropertiesValueValidator.d.ts +4 -0
- package/dist/api/RootComponent/RootComponentDoc.d.ts +19 -0
- package/dist/api/RootComponent/Store/StoreOption.d.ts +12 -0
- package/dist/api/RootComponent/Watch/WatchOption.d.ts +4 -0
- package/dist/api/RootComponent/index.d.ts +17 -19
- package/dist/api/RootComponent/index.js +1 -0
- package/dist/api/RootComponent/index.js.map +1 -1
- package/dist/api/SubComponent/SubComponentDoc.d.ts +9 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.d.ts +4 -0
- package/dist/api/SubComponent/SubData/SubDataOption.d.ts +4 -0
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.d.ts +3 -0
- package/dist/api/SubComponent/SubEvents/SubEventsOptions.d.ts +5 -0
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.d.ts +4 -0
- package/dist/api/SubComponent/SubInherit/SubInheritOption.d.ts +6 -1
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.d.ts +1 -3
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.d.ts +3 -0
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.d.ts +4 -0
- package/dist/api/SubComponent/SubStore/SubStoreOption.d.ts +14 -0
- package/dist/api/SubComponent/index.d.ts +10 -8
- package/dist/api/SubComponent/index.js +5 -0
- package/dist/api/SubComponent/index.js.map +1 -1
- package/dist/api/navigateTo.d.ts +5 -0
- package/dist/api/navigateTo.js +10 -1
- package/dist/api/navigateTo.js.map +1 -1
- package/dist/behaviors/BStore.d.ts +4 -0
- package/dist/behaviors/BStore.js +9 -0
- package/dist/behaviors/BStore.js.map +1 -1
- package/dist/behaviors/BbeforeCreated.d.ts +3 -0
- package/dist/behaviors/BbeforeCreated.js +8 -1
- package/dist/behaviors/BbeforeCreated.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/thirdLib/vant/Button.d.ts +14 -2
- package/dist/thirdLib/vant/NoticeBar.d.ts +2 -2
- package/dist/thirdLib/vant/Popup.d.ts +42 -2
- package/dist/thirdLib/wm/Textarea.d.ts +11 -2
- package/dist/thirdLib/wm/baseEvents.d.ts +39 -2
- package/dist/thirdLib/wm/scrollView.d.ts +4 -2
- package/dist/thirdLib/wm/scrollView.js +6 -0
- package/dist/thirdLib/wm/scrollView.js.map +1 -1
- package/dist/thirdLib/wm/swiper.d.ts +75 -5
- package/dist/thirdLib/wm/view.d.ts +20 -2
- package/dist/types/AddNullForObject.d.ts +3 -0
- package/dist/types/AddPrefix.d.ts +7 -0
- package/dist/types/{GenerateDoc.d.ts → CreateComponentType.d.ts} +3 -3
- package/dist/types/CreateComponentType.js +2 -0
- package/dist/types/CreateComponentType.js.map +1 -0
- package/dist/types/DetailedType.d.ts +15 -5
- package/dist/types/DocAssign.d.ts +3 -0
- package/dist/types/DocAssign.js +4 -0
- package/dist/types/DocAssign.js.map +1 -1
- package/dist/types/GetComponentPrefix.d.ts +3 -0
- package/dist/types/GetComponentPrefix.js +10 -0
- package/dist/types/GetComponentPrefix.js.map +1 -1
- package/dist/types/InferDetailedType.d.ts +3 -0
- package/dist/types/OfficialTypeAlias.d.ts +15 -9
- package/dist/types/OfficialTypeAlias.js +30 -0
- package/dist/types/OfficialTypeAlias.js.map +1 -1
- package/dist/types/RemoveInnerData.d.ts +3 -0
- package/dist/types/Replace.d.ts +11 -0
- package/dist/types/ReplacePrefix.d.ts +5 -0
- package/dist/types/ReplacePrefix.js +9 -0
- package/dist/types/ReplacePrefix.js.map +1 -1
- package/dist/types/RequiredKeys.d.ts +4 -0
- package/dist/types/Validators.js +7 -0
- package/dist/types/Validators.js.map +1 -1
- package/dist/utils/InnerMarker.js +1 -1
- package/dist/utils/InnerMarker.js.map +1 -1
- package/dist/utils/assertNonNullable.d.ts +2 -0
- package/dist/utils/assertNonNullable.js +7 -0
- package/dist/utils/assertNonNullable.js.map +1 -0
- package/dist/utils/deepClone.d.ts +3 -0
- package/dist/utils/deepClone.js +3 -0
- package/dist/utils/deepClone.js.map +1 -1
- package/dist/utils/isEmptyObject.d.ts +3 -0
- package/dist/utils/isEmptyObject.js +3 -0
- package/dist/utils/isEmptyObject.js.map +1 -1
- package/package.json +6 -6
- package/src/api/DefineComponent/ReturnType/ComponentDoc.ts +1 -0
- package/src/api/DefineComponent/ReturnType/test/normalComponentDoc.test.ts +2 -0
- package/src/api/DefineComponent/ReturnType/test/normalPageDoc.test.ts +3 -2
- package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +0 -5
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +2 -2
- package/src/api/DefineComponent/index.ts +21 -23
- package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/computedUpdater.ts +1 -1
- package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/data-tracer.ts +2 -3
- package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/getPathsValue.ts +2 -1
- package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/index.ts +7 -9
- package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/isEqual.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/customEventsHandle.ts +34 -0
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +26 -0
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.ts +22 -0
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts +25 -0
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.ts +33 -0
- package/src/api/DefineComponent/normalizeOptions/index.ts +142 -0
- package/src/api/DefineComponent/{assignOptions → normalizeOptions}/initStore/index.ts +1 -0
- package/src/api/DefineComponent/normalizeOptions/injectInfoHandler.ts +51 -0
- package/src/api/DefineComponent/normalizeOptions/internalFieldProtection.ts +26 -0
- package/src/api/DefineComponent/normalizeOptions/otherFieldsHandle.ts +27 -0
- package/src/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.ts +25 -0
- package/src/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.ts +22 -0
- package/src/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.ts +37 -0
- package/src/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.ts +18 -0
- package/src/api/InstanceInject/inject.ts +2 -0
- package/src/api/InstanceInject/instanceConfig.ts +2 -4
- package/src/api/InstanceInject/test/normal.test.ts +1 -0
- package/src/api/RootComponent/Computed/ComputedConstraint.ts +1 -1
- package/src/api/RootComponent/Computed/test/GetComputedDoc.test.ts +1 -0
- package/src/api/RootComponent/Computed/test/normal.test.ts +2 -0
- package/src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts +2 -2
- package/src/api/RootComponent/CustomEvents/test/GetFullEventDoc.test.ts +2 -1
- package/src/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.ts +2 -1
- package/src/api/RootComponent/CustomEvents/test/error.test.ts +2 -2
- package/src/api/RootComponent/CustomEvents/test/normal.test.ts +2 -0
- package/src/api/RootComponent/Data/test/GetDataDoc.test.ts +2 -2
- package/src/api/RootComponent/Data/test/normal.test.ts +3 -2
- package/src/api/RootComponent/Events/EventsConstraint.ts +1 -1
- package/src/api/RootComponent/Events/test/normal.test.ts +5 -2
- package/src/api/RootComponent/Instance/RootComponentInstance.ts +9 -0
- package/src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts +1 -0
- package/src/api/RootComponent/Instance/test/customEvents/normal.test.ts +1 -0
- package/src/api/RootComponent/Instance/test/methods/mormal.test.ts +2 -2
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +2 -0
- package/src/api/RootComponent/Instance/test/setData/error.test.ts +1 -1
- package/src/api/RootComponent/Instance/test/setData/normal.test.ts +1 -1
- package/src/api/RootComponent/IsPage/test/normal.test.ts +2 -0
- package/src/api/RootComponent/Lifetimes/LifetimesConstraint.ts +2 -2
- package/src/api/RootComponent/Lifetimes/test/error.test.ts +22 -8
- package/src/api/RootComponent/Lifetimes/test/normal.test.ts +8 -3
- package/src/api/RootComponent/Methods/test/error.test.ts +4 -4
- package/src/api/RootComponent/Methods/test/mormal.test.ts +2 -2
- package/src/api/RootComponent/Observers/test/normal.test.ts +8 -4
- package/src/api/RootComponent/PageLifetimes/test/error.test.ts +17 -7
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +12 -5
- package/src/api/RootComponent/Properties/test/normalEmpty.test.ts +6 -6
- package/src/api/RootComponent/Properties/test/normalOptional.test.ts +4 -4
- package/src/api/RootComponent/Properties/test/normalRequired.test.ts +3 -3
- package/src/api/RootComponent/Store/test/normal.test.ts +4 -4
- package/src/api/RootComponent/Watch/test/WatchComputed.test.ts +6 -4
- package/src/api/RootComponent/Watch/test/WatchData.test.ts +16 -12
- package/src/api/RootComponent/Watch/test/WatchProperties.test.ts +58 -40
- package/src/api/RootComponent/Watch/test/WtachInject.test.ts +3 -2
- package/src/api/RootComponent/Watch/test/error.test.ts +4 -2
- package/src/api/RootComponent/index.ts +47 -48
- package/src/api/SubComponent/SubComputed/test/error.test.ts +6 -2
- package/src/api/SubComponent/SubComputed/test/normal.test.ts +8 -7
- package/src/api/SubComponent/SubData/test/normal.test.ts +2 -2
- package/src/api/SubComponent/SubEvents/test/error.test.ts +4 -2
- package/src/api/SubComponent/SubEvents/test/normal.test.ts +4 -2
- package/src/api/SubComponent/SubInherit/SubInheritOption.ts +1 -3
- package/src/api/SubComponent/SubInherit/test/error.test.ts +2 -2
- package/src/api/SubComponent/SubInstance/test/error.test.ts +1 -1
- package/src/api/SubComponent/SubInstance/test/normal.test.ts +10 -6
- package/src/api/SubComponent/SubMethods/SubMethodsConstraint.ts +1 -3
- package/src/api/SubComponent/SubMethods/test/error.test.ts +8 -2
- package/src/api/SubComponent/SubMethods/test/normarl.test.ts +6 -2
- package/src/api/SubComponent/SubReturnType/test/error.test.ts +2 -2
- package/src/api/SubComponent/SubReturnType/test/normal.test.ts +2 -2
- package/src/api/SubComponent/SubWatch/test/WatchComputed.test.ts +21 -14
- package/src/api/SubComponent/SubWatch/test/WatchProperties.test.ts +58 -58
- package/src/api/SubComponent/SubWatch/test/WatchRootData.test.ts +43 -31
- package/src/api/SubComponent/SubWatch/test/WatchSubData.test.ts +9 -6
- package/src/api/SubComponent/SubWatch/test/WtachInject.test.ts +3 -2
- package/src/api/SubComponent/SubWatch/test/error.test.ts +5 -4
- package/src/api/SubComponent/index.ts +92 -95
- package/src/api/navigateTo.ts +1 -1
- package/src/behaviors/BStore.ts +7 -3
- package/src/behaviors/BbeforeCreated.ts +8 -3
- package/src/index.ts +2 -2
- package/src/thirdLib/vant/Button.ts +2 -2
- package/src/thirdLib/vant/NoticeBar.ts +2 -2
- package/src/thirdLib/vant/Popup.ts +2 -2
- package/src/thirdLib/wm/Textarea.ts +2 -2
- package/src/thirdLib/wm/baseEvents.ts +3 -2
- package/src/thirdLib/wm/scrollView.ts +4 -2
- package/src/thirdLib/wm/swiper.ts +10 -5
- package/src/thirdLib/wm/view.ts +4 -2
- package/src/types/{GenerateDoc.ts → CreateComponentType.ts} +3 -6
- package/src/types/DetailedType.ts +1 -1
- package/src/types/InferDetailedType.test.ts +8 -13
- package/src/types/OfficialTypeAlias.ts +31 -31
- package/src/utils/assertNonNullable.ts +11 -0
- package/src/utils/isEmptyObject.ts +1 -1
- package/tsconfig.json +11 -16
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/dependencesOptimize.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/getPathsValue.d.ts +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/getPathsValue.js +0 -19
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/getPathsValue.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/getPropertiesValue.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/index.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/isEqual.d.ts +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/isEqual.js +0 -48
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/isEqual.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/index.js +0 -203
- package/dist/api/DefineComponent/assignOptions/index.js.map +0 -1
- package/dist/api/DefineComponent/assignOptions/initStore/index.js.map +0 -1
- package/dist/types/CreateComponentDoc.d.ts +0 -10
- package/dist/types/CreateComponentDoc.js +0 -2
- package/dist/types/CreateComponentDoc.js.map +0 -1
- package/dist/types/GenerateDoc.js +0 -2
- package/dist/types/GenerateDoc.js.map +0 -1
- package/src/api/DefineComponent/assignOptions/index.ts +0 -469
- package/src/types/CreateComponentDoc.ts +0 -17
- /package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/dependencesOptimize.d.ts +0 -0
- /package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/getPropertiesValue.d.ts +0 -0
- /package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/index.d.ts +0 -0
- /package/dist/api/DefineComponent/{assignOptions → normalizeOptions}/initStore/index.d.ts +0 -0
- /package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/dependencesOptimize.ts +0 -0
- /package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/getPropertiesValue.ts +0 -0
- /package/src/api/DefineComponent/{assignOptions → normalizeOptions}/computedWatchHandle/initComputedAndGetCache.ts +0 -0
|
@@ -6,6 +6,7 @@ import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
|
|
|
6
6
|
import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
|
|
7
7
|
import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
|
|
8
8
|
interface BaseInjectInfo {
|
|
9
|
+
[key: string]: unknown;
|
|
9
10
|
options?: WMComponentOption;
|
|
10
11
|
methods?: MethodsConstraint;
|
|
11
12
|
data?: DataConstraint;
|
|
@@ -18,6 +19,9 @@ export type IInjectAllData = IfEquals<{}, injectData & IInjectStore, {}, Compute
|
|
|
18
19
|
type injectData = DataConstraint extends IInjectInfo["data"] ? {} : IInjectInfo["data"];
|
|
19
20
|
export type IInjectStore = StoreConstraint extends IInjectInfo["store"] ? {} : ReturnTypeInObject<IInjectInfo["store"]>;
|
|
20
21
|
export type IInjectMethods = IInjectInfo["methods"];
|
|
22
|
+
/**
|
|
23
|
+
* 实例配置接口
|
|
24
|
+
*/
|
|
21
25
|
declare class InstanceConfig {
|
|
22
26
|
private info;
|
|
23
27
|
get injectInfo(): IInjectInfo | undefined;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 实例配置接口
|
|
3
|
+
*/
|
|
1
4
|
class InstanceConfig {
|
|
2
5
|
constructor() {
|
|
3
6
|
this.info = {};
|
|
@@ -6,7 +9,8 @@ class InstanceConfig {
|
|
|
6
9
|
return this.info.injectInfo;
|
|
7
10
|
}
|
|
8
11
|
setInjectInfo(info) {
|
|
9
|
-
|
|
12
|
+
if (info)
|
|
13
|
+
this.info.injectInfo = info;
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
export const instanceConfig = new InstanceConfig();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instanceConfig.js","sourceRoot":"","sources":["../../../src/api/InstanceInject/instanceConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"instanceConfig.js","sourceRoot":"","sources":["../../../src/api/InstanceInject/instanceConfig.ts"],"names":[],"mappings":"AAmCA;;GAEG;AACH,MAAM,cAAc;IAApB;QACU,SAAI,GAAiC,EAAE,CAAC;IAOlD,CAAC;IANC,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;IAC9B,CAAC;IACM,aAAa,CAAC,IAA6B;QAChD,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACxC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import type { DuplicateFieldValidator } from "hry-types/src/Generic/DuplicateFieldValidator";
|
|
2
2
|
import type { ComputedConstraint } from "./ComputedConstraint";
|
|
3
3
|
export type ComputedOption<TComputed extends ComputedConstraint, CompareKeys extends PropertyKey, Instance extends object> = {
|
|
4
|
+
/**
|
|
5
|
+
* computed字段, [类型约束ComputedConstraint](ComputedConstraint.ts)
|
|
6
|
+
* @remarks
|
|
7
|
+
*
|
|
8
|
+
* 函数体内,可通过this.data获取实例其他数据(依赖),setData发生时,若数据(依赖)发生变化则重新运行函数体并setData。
|
|
9
|
+
*
|
|
10
|
+
* 带重复字段检测(与properties、data、store字段比较)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* {
|
|
16
|
+
* data:{
|
|
17
|
+
* count:1
|
|
18
|
+
* },
|
|
19
|
+
* computed:{
|
|
20
|
+
* return this.data.count + 1
|
|
21
|
+
* }
|
|
22
|
+
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
4
27
|
computed?: TComputed & ThisType<Instance> & DuplicateFieldValidator<TComputed, CompareKeys>;
|
|
5
28
|
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { ComputedConstraint } from "./ComputedConstraint";
|
|
2
|
+
/**
|
|
3
|
+
* 获取computed字段文档类型
|
|
4
|
+
* @param T - ComputedConstraint
|
|
5
|
+
* @returns object
|
|
6
|
+
*/
|
|
2
7
|
export type GetComputedDoc<TComputed extends ComputedConstraint> = {
|
|
3
8
|
[k in keyof TComputed]: ReturnType<TComputed[k]>;
|
|
4
9
|
};
|
|
@@ -27,6 +27,9 @@ export type BubblesComposedOption = BubblesConfig & ComposedCongifg & NonCapture
|
|
|
27
27
|
export type CaptureComposedOption = CaptureConfig & ComposedCongifg & NonBubblesConfig;
|
|
28
28
|
export type BubblesCaptureComposedOption = BubblesConfig & ComposedCongifg & CaptureConfig;
|
|
29
29
|
export type OptionsFieldsConfigOfCustomEvents = BubblesOption | CaptureOption | BubblesCaptureOption | BubblesComposedOption | CaptureComposedOption | BubblesCaptureComposedOption;
|
|
30
|
+
/**
|
|
31
|
+
* 带options的CustomEvents配置
|
|
32
|
+
*/
|
|
30
33
|
export type FullCustomEvents = {
|
|
31
34
|
detail: ShortCustomeEvents;
|
|
32
35
|
options: OptionsFieldsConfigOfCustomEvents;
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
import type { CustomEventConstraint } from "./CustomEventConstraint";
|
|
3
3
|
export type CustomEventsOption<TCustomEvents extends CustomEventConstraint, EventsKeys extends PropertyKey> = {
|
|
4
|
+
/**
|
|
5
|
+
* customEvents 定义组件的自定义事件 [类型约束](CustomEventConstraint.ts)
|
|
6
|
+
* @remarks 通过this.A(123)调用。与events字段重复检测
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* {
|
|
10
|
+
* customEvents: {
|
|
11
|
+
* A: Number, // number
|
|
12
|
+
* B: [String as DetailedType<"male" | "femal">, Number], // "male" | "femal" | number
|
|
13
|
+
* C: {
|
|
14
|
+
* detail: String,
|
|
15
|
+
* options: {
|
|
16
|
+
* bubbles: true,
|
|
17
|
+
* composed: true,
|
|
18
|
+
* capturePhase: true,
|
|
19
|
+
* },
|
|
20
|
+
* },
|
|
21
|
+
* },
|
|
22
|
+
* methods: {
|
|
23
|
+
* M1() {
|
|
24
|
+
* // 调用自定义事件
|
|
25
|
+
* this.A(123);
|
|
26
|
+
* this.B("femal");
|
|
27
|
+
* this.C("string");
|
|
28
|
+
* },
|
|
29
|
+
* },
|
|
30
|
+
* },
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
4
33
|
customEvents?: TCustomEvents & G.IllegalFieldValidator<TCustomEvents, "bubbles" | "composed" | "capturePhase", 1, "options"> & G.DuplicateFieldValidator<TCustomEvents, EventsKeys, "与events字段重复">;
|
|
5
34
|
};
|
|
@@ -4,6 +4,19 @@ import type { CustomEventConstraint, FullCustomEvents, ShortCustomeEvents, Simpl
|
|
|
4
4
|
import type { AddTagForCustomEventsDoc } from "./CustomEventsTag";
|
|
5
5
|
export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T> : T extends null ? null : T extends undefined ? undefined : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]> : never;
|
|
6
6
|
export type GetFullCustomEventsDoc<T extends FullCustomEvents> = GetShortCustomEventsDoc<T["detail"]> | AddTagForCustomEventsDoc<T["options"]>;
|
|
7
|
+
/**
|
|
8
|
+
* 获取自定义事件的文档
|
|
9
|
+
* demo
|
|
10
|
+
* ```ts
|
|
11
|
+
* customEvents:{
|
|
12
|
+
* a:Number,
|
|
13
|
+
* b:{ detail: String,options:{ bubbles:true } }
|
|
14
|
+
* c:{ detail: Number,options:{ bubbles:true, composed:true } }
|
|
15
|
+
* }
|
|
16
|
+
* //result => {a:number,b:string|()=>'bubbles',c:number | ()=>'composed' }
|
|
17
|
+
* ```
|
|
18
|
+
* @returns object
|
|
19
|
+
*/
|
|
7
20
|
export type GetCustomEventDoc<T extends CustomEventConstraint> = {
|
|
8
21
|
[k in keyof T]: T[k] extends ShortCustomeEvents ? GetShortCustomEventsDoc<T[k]> : GetShortCustomEventsDoc<T[k]["detail"]> | AddTagForCustomEventsDoc<T[k]["options"]>;
|
|
9
22
|
};
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
export type DataOption<TData extends object, PropertiesKeys extends PropertyKey> = {
|
|
3
|
+
/**
|
|
4
|
+
* 定义实例基本数据,默认下划线(`_`)开头的为内部数据,不会被渲染
|
|
5
|
+
* @remarks 与properties字段重复校验
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* {
|
|
9
|
+
* //...
|
|
10
|
+
* data:{
|
|
11
|
+
* num:123,
|
|
12
|
+
* _str:'string' //不会被渲染的内部数据
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
3
17
|
data?: TData & G.DuplicateFieldValidator<TData, PropertiesKeys, "与properties字段重复">;
|
|
4
18
|
};
|
|
@@ -11,7 +11,10 @@ type TransformCustomEventsDocTypeToFunctionTypeAndAddSuffix<T extends CustomEven
|
|
|
11
11
|
[k in keyof T as _AddSuffixForKey<k & string, Extract<T[k], CustomEventsTags>>]?: (detail: Detail<Exclude<T[k], CustomEventsTags>>) => void;
|
|
12
12
|
};
|
|
13
13
|
type GetAllSubCustomEventsConstraint<ComponentDocList extends ComponentDoc[], AllCustomEvents extends CustomEventsDoc = GetBubblesOrCaptureEventsFromCompDoc<ComponentDocList>> = IfExtends<{}, AllCustomEvents, BaseEvent, TransformCustomEventsDocTypeToFunctionTypeAndAddSuffix<AllCustomEvents>>;
|
|
14
|
-
type BaseEvent = Record<string, (e: WMBaseEvent) =>
|
|
14
|
+
type BaseEvent = Record<string, (e: WMBaseEvent) => unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* events字段约束 由自身事件和冒泡的子组件事件组成。带前缀是子组件事件,带后缀(_catch)表示阻止冒泡
|
|
17
|
+
*/
|
|
15
18
|
export type EventsConstraint<ComponentDocList extends ComponentDoc[] = []> = IfExtends<[
|
|
16
19
|
], ComponentDocList, BaseEvent, GetAllSubCustomEventsConstraint<ComponentDocList>>;
|
|
17
20
|
export {};
|
|
@@ -1,3 +1,55 @@
|
|
|
1
1
|
export type EventsOption<TEvents extends object> = {
|
|
2
|
+
/**
|
|
3
|
+
* 根组件事件字段,当RootComopnent传入组件泛型时,有子组件事件提示
|
|
4
|
+
*
|
|
5
|
+
* @example A 无子组件时
|
|
6
|
+
* ```ts
|
|
7
|
+
* RootComponent()({
|
|
8
|
+
* events: {
|
|
9
|
+
* onTap(e) {
|
|
10
|
+
* Checking<typeof e, WMBaseEvent, Test.Pass>;
|
|
11
|
+
* },
|
|
12
|
+
* },
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
* @example B
|
|
16
|
+
* ```ts
|
|
17
|
+
* type ComponentDocA = {
|
|
18
|
+
* customEvents: {
|
|
19
|
+
* aaa_str: string;
|
|
20
|
+
* aaa_num: number | Bubbles;
|
|
21
|
+
* };
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* type ComponentDocB = {
|
|
25
|
+
* customEvents: {
|
|
26
|
+
* bbb_str: string;
|
|
27
|
+
* bbb_num: number | Capture;
|
|
28
|
+
* };
|
|
29
|
+
* };
|
|
30
|
+
* RootComponent<[ComponentDocA, ComponentDocB]>()({
|
|
31
|
+
* events: {
|
|
32
|
+
* // 后缀bubbles表示为子组件的冒泡事件
|
|
33
|
+
* aaa_num_bubbles(e) {
|
|
34
|
+
* Checking<typeof e.detail, number, Test.Pass>;
|
|
35
|
+
* },
|
|
36
|
+
* // 后缀加catch表示阻止事件传递,当前组件类型将不会向上传递此事件类型。
|
|
37
|
+
* aaa_num_bubbles_catch(e) {
|
|
38
|
+
* Checking<typeof e.detail, number, Test.Pass>;
|
|
39
|
+
* },
|
|
40
|
+
* // 后缀capture表示是捕获事件
|
|
41
|
+
* bbb_num_capture(e: Dataset<{ currentTargetDataset: number }, { targetDataset: string }, number>) {
|
|
42
|
+
* Checking<typeof e.detail, number, Test.Pass>;
|
|
43
|
+
* Checking<typeof e.currentTarget.dataset.currentTargetDataset, number, Test.Pass>;
|
|
44
|
+
* Checking<typeof e.target.dataset.targetDataset, string, Test.Pass>;
|
|
45
|
+
* },
|
|
46
|
+
* // 后缀加catch表示阻止事件传递,由于捕获事件向下阻止,所以当发现捕获事件不触发时应查看上级组件是否有阻止事件。
|
|
47
|
+
* bbb_num_capture_catch(e) {
|
|
48
|
+
* Checking<typeof e.detail, number, Test.Pass>;
|
|
49
|
+
* },
|
|
50
|
+
* },
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
2
54
|
events?: TEvents;
|
|
3
55
|
};
|
|
@@ -2,6 +2,12 @@ import type { O } from "hry-types";
|
|
|
2
2
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
3
3
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
4
4
|
import type { AddSubObjectKey } from "hry-types/src/Object/AddSubObjectKey";
|
|
5
|
+
/**
|
|
6
|
+
* 重写实例的setData类型
|
|
7
|
+
*/
|
|
5
8
|
export type CustomSetData<TData extends object> = {
|
|
9
|
+
/**
|
|
10
|
+
* setData只可以对自身data中非响应式数据字段进行设置
|
|
11
|
+
*/
|
|
6
12
|
setData(options: IfExtends<{}, TData, EmptyObject, O.ComputeIntersectionDeep<Partial<AddSubObjectKey<TData>>>>, callback?: () => void): void;
|
|
7
13
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
3
3
|
import type { IReactionDisposer } from "mobx";
|
|
4
|
+
import type { Func } from "hry-types/src/Misc/Func";
|
|
4
5
|
import type { Assign } from "../../../types/Assign";
|
|
5
6
|
import type { ComputeObject } from "../../../types/ComputeObj";
|
|
6
7
|
import type { WMComponentInstance, WMInstanceMethods, WMPageInstance } from "../../../types/OfficialTypeAlias";
|
|
8
|
+
import type { OptionsInnerFields } from "../../DefineComponent/normalizeOptions";
|
|
7
9
|
import type { IInjectAllData, IInjectMethods } from "../../InstanceInject/instanceConfig";
|
|
8
10
|
import type { CustomEventMethods } from "./CustomEventMethods";
|
|
9
11
|
import type { CustomSetData } from "./CustomSetData";
|
|
@@ -16,3 +18,10 @@ export type RootComponentInstance<TIsPage extends boolean, TMethods extends obje
|
|
|
16
18
|
};
|
|
17
19
|
export type ComponentInstance = RootComponentInstance<false, {}, {}, {}, {}, {}>;
|
|
18
20
|
export type PageInstance = RootComponentInstance<true, {}, {}, {}, {}, {}>;
|
|
21
|
+
type InstanceInnerFields = {
|
|
22
|
+
data: OptionsInnerFields["data"];
|
|
23
|
+
disposer: Record<string, Func>;
|
|
24
|
+
cloneData: OptionsInnerFields["data"];
|
|
25
|
+
} & OptionsInnerFields["methods"];
|
|
26
|
+
export type Instance = (ComponentInstance | PageInstance) & InstanceInnerFields;
|
|
27
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
2
2
|
import type { WMCompLifetimes } from "../../../types/OfficialTypeAlias";
|
|
3
|
-
import type { FinalOptionsOfComponent } from "../../DefineComponent/
|
|
3
|
+
import type { FinalOptionsOfComponent } from "../../DefineComponent/normalizeOptions";
|
|
4
4
|
export type LifetimesConstraint = ComputeIntersection<WMCompLifetimes["lifetimes"] & {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* 建立组件时的真正配置对象
|
|
7
|
+
*/
|
|
8
|
+
beforeCreate?: (this: undefined, options: FinalOptionsOfComponent) => void;
|
|
6
9
|
}>;
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import type { LifetimesConstraint } from "./LifetimesConstraint";
|
|
2
2
|
export type LifetimesOption = {
|
|
3
|
+
/**
|
|
4
|
+
* 在原生类型上增加了beforeCreate周期
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* RootComponent()({
|
|
8
|
+
* lifetimes: {
|
|
9
|
+
* beforeCreate(opitons) {
|
|
10
|
+
* opitons;//为最终进入Component的配置对象
|
|
11
|
+
* },
|
|
12
|
+
* created() {
|
|
13
|
+
* },
|
|
14
|
+
* attached() {
|
|
15
|
+
* },
|
|
16
|
+
* ready() {
|
|
17
|
+
* },
|
|
18
|
+
* detached() {
|
|
19
|
+
* },
|
|
20
|
+
* error(err) {
|
|
21
|
+
* err.cause;
|
|
22
|
+
* },
|
|
23
|
+
* moved() {
|
|
24
|
+
* },
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
3
29
|
lifetimes?: LifetimesConstraint;
|
|
4
30
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
import type { MethodsConstraint } from "./MethodsConstraint";
|
|
3
3
|
export type MethodsOption<TMethods extends MethodsConstraint, DuplicateField extends PropertyKey> = {
|
|
4
|
+
/**
|
|
5
|
+
* 与customEvents和events字段重复检测
|
|
6
|
+
*/
|
|
4
7
|
methods?: TMethods & G.DuplicateFieldValidator<TMethods, DuplicateField>;
|
|
5
8
|
};
|
|
@@ -10,6 +10,10 @@ type AddFieldsOfObject<TWatchData extends object, _WatchKeys extends keyof TWatc
|
|
|
10
10
|
[k in secondKeys]?: (newValue: IfExtends<getLastKeys<k>, "**", TWatchData[getFirstKeys<k>], NonNullable<(Exclude<TWatchData[getFirstKeys<k>], null>)[getLastKeys<k>]>>) => void;
|
|
11
11
|
};
|
|
12
12
|
export type ObserversOption<TWatchData extends object, _WatchKeys extends keyof TWatchData = keyof TWatchData> = {
|
|
13
|
+
/**
|
|
14
|
+
* 监控所有data字段,值变化时(JSON.stringify判断)运行watch函数,一参为最新值,二参为变化前值。
|
|
15
|
+
* 对象数据可通过`obj.xxx:`监控具体字段(只加入了一级字段类型提示)
|
|
16
|
+
*/
|
|
13
17
|
observers?: IfExtends<{}, TWatchData, EmptyObject, NoInfer<{
|
|
14
18
|
[k in _WatchKeys | "**"]?: (newValue: k extends keyof TWatchData ? TWatchData[k] : unknown) => void;
|
|
15
19
|
} & {
|
|
@@ -3,10 +3,21 @@ import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersecti
|
|
|
3
3
|
import type { WMCompPageLifetimes, WMPageLifetimes } from "../../../types/OfficialTypeAlias";
|
|
4
4
|
export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends object> = IfExtends<TIsPage, false, {
|
|
5
5
|
pageLifetimes?: ComputeIntersection<Partial<WMCompPageLifetimes> & {
|
|
6
|
+
/**
|
|
7
|
+
* 周期发生在组件attached之后,页面onLoad之前,要求组件为同步组件
|
|
8
|
+
* 最低基础库: `3.0.2`
|
|
9
|
+
*/
|
|
6
10
|
load?: (props?: object) => void;
|
|
7
11
|
}>;
|
|
8
12
|
}, {
|
|
13
|
+
/**
|
|
14
|
+
* 官方要求写入methods中的页面生命周期
|
|
15
|
+
*/
|
|
9
16
|
pageLifetimes?: ComputeIntersection<Partial<Omit<WMPageLifetimes, "onLoad">> & {
|
|
17
|
+
/** 生命周期回调—监听页面加载
|
|
18
|
+
*
|
|
19
|
+
* 页面加载时触发。一个页面只会调用一次,可以在 onLoad 的参数中获取Properties定义的数据。
|
|
20
|
+
*/
|
|
10
21
|
onLoad?: (props: PropertiesDoc) => void | Promise<void>;
|
|
11
22
|
}>;
|
|
12
23
|
}>;
|
|
@@ -2,6 +2,9 @@ import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
|
2
2
|
import type { AddNullForObject } from "../../../types/AddNullForObject";
|
|
3
3
|
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
4
4
|
import type { OptionalType } from "./PropertiesConstraint";
|
|
5
|
+
/**
|
|
6
|
+
* 获取properties可传字段文档类型
|
|
7
|
+
*/
|
|
5
8
|
export type GetOptionalDoc<TOptionalProperties extends Record<string, OptionalType>, TIsPage extends boolean> = {
|
|
6
9
|
-readonly [k in keyof TOptionalProperties]?: IfExtends<unknown, TOptionalProperties[k]["optionalTypes"], IfExtends<false, TIsPage, AddNullForObject<InferDetailedType<TOptionalProperties[k]["type"]>>, InferDetailedType<TOptionalProperties[k]["type"]>>, IfExtends<false, TIsPage, AddNullForObject<InferDetailedType<TOptionalProperties[k]["type"]> | InferDetailedType<(TOptionalProperties[k]["optionalTypes"] & {})[number]>>, InferDetailedType<TOptionalProperties[k]["type"]> | InferDetailedType<(TOptionalProperties[k]["optionalTypes"] & {})[number]>>>;
|
|
7
10
|
};
|
|
@@ -4,5 +4,8 @@ import type { GetOptionalDoc } from "./GetOptionalDoc";
|
|
|
4
4
|
import type { GetRequiredDoc } from "./GetRequiredDoc";
|
|
5
5
|
import type { OptionalType, PropertiesConstraint } from "./PropertiesConstraint";
|
|
6
6
|
type _GetPropertiesDoc<TProperties extends PropertiesConstraint, TIsPage extends boolean, OptionalDoc extends object = GetOptionalDoc<Select<TProperties, OptionalType>, TIsPage>, RequiredDoc extends object = GetRequiredDoc<Omit<TProperties, keyof OptionalDoc>, TIsPage>> = ComputeIntersection<OptionalDoc & RequiredDoc>;
|
|
7
|
+
/**
|
|
8
|
+
* properties字段的文档类型
|
|
9
|
+
*/
|
|
7
10
|
export type GetPropertiesDoc<TProperties extends PropertiesConstraint, TisPage extends boolean> = _GetPropertiesDoc<TProperties, TisPage>;
|
|
8
11
|
export {};
|
|
@@ -2,6 +2,10 @@ import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
|
2
2
|
import type { AddNullForObject } from "../../../types/AddNullForObject";
|
|
3
3
|
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
4
4
|
import type { RequiredSingle, RequiredType } from "./PropertiesConstraint";
|
|
5
|
+
/**
|
|
6
|
+
* 获取properties必传字段的文档类型
|
|
7
|
+
* @remarks 小程序中必传字段如果是object,默认类型为null,所以组件文档对象类型要联合上null类型
|
|
8
|
+
*/
|
|
5
9
|
export type GetRequiredDoc<TProperties extends Record<string, RequiredType>, TIsPage extends boolean> = {
|
|
6
10
|
-readonly [k in keyof TProperties]: IfExtends<TProperties[k], RequiredSingle, IfExtends<false, TIsPage, AddNullForObject<InferDetailedType<TProperties[k]>>, InferDetailedType<TProperties[k]>>, IfExtends<false, TIsPage, AddNullForObject<InferDetailedType<TProperties[k]["type"]> | InferDetailedType<TProperties[k]["optionalTypes"][number]>>, InferDetailedType<TProperties[k]["type"]> | InferDetailedType<TProperties[k]["optionalTypes"][number]>>>;
|
|
7
11
|
};
|
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import type { DetailedType } from "../../../types/DetailedType";
|
|
2
|
+
/**
|
|
3
|
+
* properties 必传(单一)类型
|
|
4
|
+
*/
|
|
2
5
|
export type RequiredSingle = DetailedType;
|
|
6
|
+
/**
|
|
7
|
+
* properties 必传(联合)类型
|
|
8
|
+
*/
|
|
3
9
|
export type RequiredUnion = {
|
|
4
10
|
type: DetailedType;
|
|
5
11
|
optionalTypes: DetailedType[];
|
|
6
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* properties 必传类型
|
|
15
|
+
*/
|
|
7
16
|
export type RequiredType = RequiredUnion | RequiredSingle;
|
|
17
|
+
/**
|
|
18
|
+
* properties 选传类型
|
|
19
|
+
*/
|
|
8
20
|
export type OptionalType = {
|
|
9
21
|
type: DetailedType;
|
|
10
22
|
value: unknown;
|
|
11
23
|
optionalTypes?: DetailedType[];
|
|
12
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Properties 字段类型
|
|
27
|
+
*/
|
|
13
28
|
export type PropertiesTypes = OptionalType | RequiredType;
|
|
29
|
+
/**
|
|
30
|
+
* RootComponent API properties 字段约束
|
|
31
|
+
*/
|
|
14
32
|
export type PropertiesConstraint = Record<string, PropertiesTypes>;
|
|
@@ -3,6 +3,16 @@ import type { Validators } from "../../../types/Validators";
|
|
|
3
3
|
import type { PropertiesConstraint } from "./PropertiesConstraint";
|
|
4
4
|
import type { PropertiesValueValidator } from "./PropertiesValueValidator";
|
|
5
5
|
export type PropertiesOption<TProperties extends PropertiesConstraint> = {
|
|
6
|
+
/**
|
|
7
|
+
* 可通过 as DetailedType<anyType> 书写任意类型
|
|
8
|
+
* @remarks
|
|
9
|
+
*
|
|
10
|
+
* 禁用observable字段(watch代替)
|
|
11
|
+
*
|
|
12
|
+
* 简写或对象写法(无value字段)时为必传属性(组件时必传对象实际类型加入null,页面不加),对象写法有value字段为可选属性.
|
|
13
|
+
*
|
|
14
|
+
* 有value类型检测和非法字段检测(例如value写出values)
|
|
15
|
+
*/
|
|
6
16
|
properties?: TProperties & Validators<[
|
|
7
17
|
PropertiesValueValidator<TProperties>,
|
|
8
18
|
G.IllegalFieldValidator<TProperties, "value" | "type" | "optionalTypes", 1>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
2
2
|
import type { NonReadonly } from "hry-types/src/Object/NonReadonly";
|
|
3
3
|
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
4
|
+
/**
|
|
5
|
+
* 验证properties的value类型是否正确
|
|
6
|
+
* @returns unknown | `{ value: () => "⚠️类型错误⚠️" }`
|
|
7
|
+
*/
|
|
4
8
|
export type PropertiesValueValidator<TProperties, Result = {
|
|
5
9
|
[k in keyof TProperties as TProperties[k] extends {
|
|
6
10
|
type: infer R;
|
|
@@ -18,5 +18,24 @@ type _RootComponentDoc = {
|
|
|
18
18
|
export?: () => void;
|
|
19
19
|
};
|
|
20
20
|
type _Validator<O, Doc, ErrKeys = Exclude<keyof O, keyof Doc>> = [ErrKeys] extends [never] ? Doc : `错误的字段${ErrKeys & string}`;
|
|
21
|
+
/**
|
|
22
|
+
* RootComponent Api 返回的类型
|
|
23
|
+
* ```ts
|
|
24
|
+
* isPage?: boolean;
|
|
25
|
+
* properties?: object;
|
|
26
|
+
* data?: object;
|
|
27
|
+
* computed?: object;
|
|
28
|
+
* customEvents?: object;
|
|
29
|
+
* methods?: object;
|
|
30
|
+
* events?: object;
|
|
31
|
+
* store?: object;
|
|
32
|
+
* watch?: Record<string, AnyFunction>;
|
|
33
|
+
* lifetimes?: LifetimesConstraint;
|
|
34
|
+
* pageLifetimes?: Partial<WMCompPageLifetimes & { load: AnyFunction }> | Partial<WMPageLifetimes>;
|
|
35
|
+
* export?:AnyFunction
|
|
36
|
+
* externalClasses?: string[];
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
21
40
|
export type RootComponentDoc<O extends _Validator<O, _RootComponentDoc> = _RootComponentDoc> = O;
|
|
22
41
|
export {};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
import type { StoreConstraint } from "./StoreConstraint";
|
|
3
3
|
export type StoreOption<TStore extends StoreConstraint, TDuplicateKeys extends PropertyKey> = {
|
|
4
|
+
/**
|
|
5
|
+
* 全局响应式数据字段,全局store对应数据变化实例对应数据自动setData。与properties和data字段有重复检测
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* {
|
|
9
|
+
* //...
|
|
10
|
+
* store: {
|
|
11
|
+
* responsiveData: () => sroreX.str,
|
|
12
|
+
* },
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
4
16
|
store?: TStore & G.DuplicateFieldValidator<TStore, TDuplicateKeys, "字段重复">;
|
|
5
17
|
};
|
|
@@ -10,6 +10,10 @@ type AddFieldsOfObject<TWatchData extends object, _WatchKeys extends keyof TWatc
|
|
|
10
10
|
[k in secondKeys]?: (newValue: IfExtends<getLastKeys<k>, "**", Exclude<TWatchData[getFirstKeys<k>], null>, NonNullable<(Exclude<TWatchData[getFirstKeys<k>], null>)[getLastKeys<k>]>>, oldValue: IfExtends<getLastKeys<k>, "**", TWatchData[getFirstKeys<k>], (Exclude<TWatchData[getFirstKeys<k>], null>)[getLastKeys<k>]>) => void;
|
|
11
11
|
};
|
|
12
12
|
export type WatchOption<TWatchData extends object, _WatchKeys extends keyof TWatchData = keyof TWatchData> = {
|
|
13
|
+
/**
|
|
14
|
+
* 监控所有data字段,值变化时(JSON.stringify判断)运行watch函数,一参为最新值,二参为变化前值。
|
|
15
|
+
* 对象数据可通过`obj.xxx:`监控具体字段(只加入了一级字段类型提示)
|
|
16
|
+
*/
|
|
13
17
|
watch?: IfExtends<{}, TWatchData, EmptyObject, NoInfer<{
|
|
14
18
|
[k in _WatchKeys]?: (newValue: Exclude<TWatchData[k], null>, oldValue: TWatchData[k]) => void;
|
|
15
19
|
} & {
|
|
@@ -34,25 +34,23 @@ import type { WatchOption } from "./Watch/WatchOption";
|
|
|
34
34
|
type RootComponentOptions<TEvents extends object, TIsPage extends boolean, TCustomEvents extends CustomEventConstraint, TMethods extends MethodsConstraint, TProperties extends PropertiesConstraint, TData extends object, TStore extends StoreConstraint, TComputed extends Record<string, Func>, EventsDoc extends object, CustomEventsDoc extends object, PropertiesDoc extends object, DataDoc extends object, StoreDoc extends object, ComputedDoc extends object> = MethodsOption<TMethods, keyof (EventsDoc & CustomEventsDoc)> & PropertiesOption<TProperties> & IsPageOption<TIsPage> & EventsOption<TEvents> & CustomEventsOption<TCustomEvents, keyof EventsDoc> & DataOption<TData, keyof PropertiesDoc> & StoreOption<TStore, keyof (PropertiesDoc & DataDoc)> & ComputedOption<TComputed, keyof (PropertiesDoc & DataDoc & StoreDoc), {
|
|
35
35
|
data: ComputeObject<DataDoc & Required<PropertiesDoc> & StoreDoc & ComputedDoc & IInjectAllData>;
|
|
36
36
|
}> & PageLifetimesOption<TIsPage, PropertiesDoc> & LifetimesOption & WatchOption<ComputedDoc & Required<PropertiesDoc> & DataDoc & StoreDoc & IInjectStore> & Partial<Omit<WMCompOtherOption, "pageLifetimes" | "definitionFilter" | "observers">> & ObserversOption<ComputedDoc & Required<PropertiesDoc> & DataDoc & StoreDoc & IInjectStore> & ThisType<RootComponentInstance<TIsPage, TMethods, DataDoc, DataDoc & Required<PropertiesDoc> & StoreDoc & ComputedDoc, CustomEventsDoc, StoreDoc>>;
|
|
37
|
-
type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}>>;
|
|
55
|
-
};
|
|
37
|
+
type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <TEvents extends EventsConstraint<TComponentDocList>, TIsPage extends boolean = false, const TProperties extends PropertiesConstraint = {}, TData extends object = {}, TStore extends StoreConstraint = {}, TComputed extends ComputedConstraint = {}, TCustomEvents extends IfExtends<TIsPage, false, CustomEventConstraint, EmptyObject> = {}, TMethods extends MethodsConstraint = {}, EventsDoc extends object = IfExtends<EventsConstraint<TComponentDocList>, TEvents, {}, TEvents>, CustomEventsDoc extends object = GetCustomEventDoc<TCustomEvents>, PropertiesDoc extends object = GetPropertiesDoc<TProperties, TIsPage>, DataDoc extends object = TData, StoreDoc extends object = GetStoreDoc<TStore>, ComputedDoc extends object = GetComputedDoc<TComputed>>(options: RootComponentOptions<TEvents, TIsPage, TCustomEvents, TMethods, TProperties, TData, TStore, TComputed, EventsDoc, CustomEventsDoc, PropertiesDoc, DataDoc, StoreDoc, ComputedDoc>) => ComputeIntersection<IfExtends<TIsPage, false, {}, {
|
|
38
|
+
isPage: true;
|
|
39
|
+
}> & IfExtends<EmptyObject, PropertiesDoc, {}, {
|
|
40
|
+
properties: PropertiesDoc;
|
|
41
|
+
}> & IfExtends<EmptyObject, DataDoc, {}, {
|
|
42
|
+
data: DataDoc;
|
|
43
|
+
}> & IfExtends<EmptyObject, StoreDoc, {}, {
|
|
44
|
+
store: ComputeObject<StoreDoc>;
|
|
45
|
+
}> & IfExtends<EmptyObject, ComputedDoc, {}, {
|
|
46
|
+
computed: ComputedDoc;
|
|
47
|
+
}> & IfExtends<EmptyObject, TMethods, {}, {
|
|
48
|
+
methods: TMethods;
|
|
49
|
+
}> & IfExtends<EmptyObject, EventsDoc, {}, {
|
|
50
|
+
events: EventsDoc;
|
|
51
|
+
}> & IfExtends<EmptyObject, CustomEventsDoc, {}, {
|
|
52
|
+
customEvents: ComputeObject<CustomEventsDoc>;
|
|
53
|
+
}>>;
|
|
56
54
|
export declare function RootComponent<TComponentDocList extends ComponentDoc[] = []>(): RootComponentConstructor<TComponentDocList>;
|
|
57
55
|
export type RootComponentTrueOptions = {
|
|
58
56
|
isPage?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/RootComponent/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/RootComponent/index.ts"],"names":[],"mappings":"AAyIA,MAAM,UAAU,aAAa;IAM3B,8DAA8D;IAC9D,OAAO,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC;AACnC,CAAC"}
|
|
@@ -4,5 +4,14 @@ type _SubComponentDoc = {
|
|
|
4
4
|
[k in string]: string | number | bigint | boolean | symbol | null | Record<string, unknown> | unknown[] | CustomEventsTags;
|
|
5
5
|
};
|
|
6
6
|
type _Validator<O, ErrKeys = Exclude<keyof O, SelectKeys<O, Composed, "contains->">>> = [ErrKeys] extends [never] ? _SubComponentDoc : `${ErrKeys & string} 不是穿透事件`;
|
|
7
|
+
/**
|
|
8
|
+
* SubComponent API 返回类型
|
|
9
|
+
* @remarks 穿透的子组件自定义事件
|
|
10
|
+
* ```ts
|
|
11
|
+
* SubComponentDoc = {
|
|
12
|
+
* [k in string]: string | number | bigint | boolean | symbol | null | Record<string, unknown> | unknown[] | CustomEventsTags;
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
7
16
|
export type SubComponentDoc<O extends _Validator<O> = _SubComponentDoc> = O;
|
|
8
17
|
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
export type SubDataOption<TSubData extends object, legalKeys extends PropertyKey> = {
|
|
3
|
+
/**
|
|
4
|
+
* 可写子组件所需数据和内部公共数据
|
|
5
|
+
* 非法字段检测和与Inherit字段的重复检测
|
|
6
|
+
*/
|
|
3
7
|
data?: TSubData & G.IllegalFieldValidator<TSubData, legalKeys, 0, "", "子组件无需此字段或与Inherit字段重复">;
|
|
4
8
|
};
|