annil 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (435) hide show
  1. package/README.md +38 -169
  2. package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.d.ts +1 -0
  3. package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js +2 -0
  4. package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js.map +1 -0
  5. package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.d.ts +10 -0
  6. package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js +2 -0
  7. package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js.map +1 -0
  8. package/dist/api/ChunkComponent/ChunkData/chunkDataOption.d.ts +9 -0
  9. package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js +2 -0
  10. package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js.map +1 -0
  11. package/dist/api/ChunkComponent/ChunkData/validatePrefix.d.ts +2 -0
  12. package/dist/api/ChunkComponent/ChunkData/validatePrefix.js +2 -0
  13. package/dist/api/ChunkComponent/ChunkData/validatePrefix.js.map +1 -0
  14. package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.d.ts +10 -0
  15. package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js +2 -0
  16. package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js.map +1 -0
  17. package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.d.ts +2 -0
  18. package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js +2 -0
  19. package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js.map +1 -0
  20. package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.d.ts +12 -0
  21. package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js +2 -0
  22. package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js.map +1 -0
  23. package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.d.ts +2 -0
  24. package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js +2 -0
  25. package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js.map +1 -0
  26. package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.d.ts +10 -0
  27. package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js +2 -0
  28. package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js.map +1 -0
  29. package/dist/api/ChunkComponent/SlotComponentReturnType.d.ts +20 -0
  30. package/dist/api/ChunkComponent/SlotComponentReturnType.js +2 -0
  31. package/dist/api/ChunkComponent/SlotComponentReturnType.js.map +1 -0
  32. package/dist/api/ChunkComponent/index.d.ts +24 -0
  33. package/dist/api/ChunkComponent/index.js +4 -0
  34. package/dist/api/ChunkComponent/index.js.map +1 -0
  35. package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.d.ts +3 -0
  36. package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js +2 -0
  37. package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js.map +1 -0
  38. package/dist/api/{SubComponent/SubComputed/SubComputedOption.d.ts → CustomComponent/CustomComputed/CustomComputedOption.d.ts} +1 -1
  39. package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js +2 -0
  40. package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js.map +1 -0
  41. package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.d.ts +3 -0
  42. package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js +2 -0
  43. package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js.map +1 -0
  44. package/dist/api/CustomComponent/CustomData/CustomDataConstraint.d.ts +3 -0
  45. package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js +2 -0
  46. package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js.map +1 -0
  47. package/dist/api/{SubComponent/SubData/SubDataOption.d.ts → CustomComponent/CustomData/CustomDataOption.d.ts} +1 -1
  48. package/dist/api/CustomComponent/CustomData/CustomDataOption.js +2 -0
  49. package/dist/api/CustomComponent/CustomData/CustomDataOption.js.map +1 -0
  50. package/dist/api/{SubComponent/SubEvents/SubEventsConstraint.d.ts → CustomComponent/CustomEvents/CustomEventsConstraint.d.ts} +1 -1
  51. package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js +2 -0
  52. package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js.map +1 -0
  53. package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.d.ts +4 -0
  54. package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js +2 -0
  55. package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js.map +1 -0
  56. package/dist/api/{SubComponent/SubInherit/SubInheritConstraint.d.ts → CustomComponent/CustomInherit/CustomInheritConstraint.d.ts} +1 -1
  57. package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js +2 -0
  58. package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js.map +1 -0
  59. package/dist/api/{SubComponent/SubInherit/SubInheritOption.d.ts → CustomComponent/CustomInherit/CustomInheritOption.d.ts} +1 -1
  60. package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js +2 -0
  61. package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js.map +1 -0
  62. package/dist/api/CustomComponent/CustomInstance/CustomInstance.d.ts +2 -0
  63. package/dist/api/CustomComponent/CustomInstance/CustomInstance.js +2 -0
  64. package/dist/api/CustomComponent/CustomInstance/CustomInstance.js.map +1 -0
  65. package/dist/api/{SubComponent/SubLifetimes/SubLifetimesOption.d.ts → CustomComponent/CustomLifetimes/CustomLifetimesOption.d.ts} +1 -1
  66. package/dist/api/CustomComponent/CustomLifetimes/CustomLifetimesOption.js +2 -0
  67. package/dist/api/CustomComponent/CustomLifetimes/CustomLifetimesOption.js.map +1 -0
  68. package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.d.ts +2 -0
  69. package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js +2 -0
  70. package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js.map +1 -0
  71. package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.d.ts +5 -0
  72. package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js +2 -0
  73. package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js.map +1 -0
  74. package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.d.ts +2 -0
  75. package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js +2 -0
  76. package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js.map +1 -0
  77. package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.d.ts +2 -0
  78. package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js +2 -0
  79. package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js.map +1 -0
  80. package/dist/api/{SubComponent/SubReturnType/CreateSubComponentDoc.d.ts → CustomComponent/CustomReturnType/CreateCustomComponentDoc.d.ts} +1 -1
  81. package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js +2 -0
  82. package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js.map +1 -0
  83. package/dist/api/{SubComponent/SubStore/SubStoreConstraint.d.ts → CustomComponent/CustomStore/CustomStoreConstraint.d.ts} +1 -1
  84. package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js +2 -0
  85. package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js.map +1 -0
  86. package/dist/api/{SubComponent/SubStore/SubStoreOption.d.ts → CustomComponent/CustomStore/CustomStoreOption.d.ts} +1 -1
  87. package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js +2 -0
  88. package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js.map +1 -0
  89. package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.d.ts +2 -0
  90. package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js +2 -0
  91. package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js.map +1 -0
  92. package/dist/api/CustomComponent/index.d.ts +49 -0
  93. package/dist/api/CustomComponent/index.js +4 -0
  94. package/dist/api/CustomComponent/index.js.map +1 -0
  95. package/dist/api/{SubComponent → CustomComponent}/returnType.d.ts +3 -3
  96. package/dist/api/CustomComponent/returnType.js.map +1 -0
  97. package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +2 -2
  98. package/dist/api/DefineComponent/index.d.ts +4 -4
  99. package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.d.ts +3 -2
  100. package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.js.map +1 -1
  101. package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js +3 -3
  102. package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js.map +1 -1
  103. package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js +1 -2
  104. package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js.map +1 -1
  105. package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.d.ts +3 -2
  106. package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.js.map +1 -1
  107. package/dist/api/DefineComponent/normalizeOptions/index.js +1 -2
  108. package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -1
  109. package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js +1 -1
  110. package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js.map +1 -1
  111. package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.d.ts +3 -2
  112. package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js +1 -2
  113. package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js.map +1 -1
  114. package/dist/api/DefineComponent/normalizeOptions/watchHandler/getPathsValue.js +1 -1
  115. package/dist/api/DefineComponent/normalizeOptions/watchHandler/getPathsValue.js.map +1 -1
  116. package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +3 -4
  117. package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js.map +1 -1
  118. package/dist/api/DefineComponent/returnType/ComponentDoc.d.ts +1 -4
  119. package/dist/api/DefineComponent/returnType/GenerateComponentDoc.d.ts +3 -3
  120. package/dist/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.d.ts +3 -3
  121. package/dist/api/InstanceInject/instanceConfig.d.ts +2 -2
  122. package/dist/api/InstanceInject/instanceConfig.js +1 -3
  123. package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
  124. package/dist/api/RootComponent/Events/EventsConstraint.d.ts +9 -7
  125. package/dist/api/RootComponent/index.d.ts +6 -5
  126. package/dist/api/RootComponent/index.js.map +1 -1
  127. package/dist/behaviors/BbeforeCreated.d.ts +1 -1
  128. package/dist/behaviors/BthrottleDebounce.d.ts +1 -1
  129. package/dist/index.d.ts +4 -4
  130. package/dist/index.js +3 -2
  131. package/dist/index.js.map +1 -1
  132. package/dist/thirdLib/vant/Button.d.ts +2 -2
  133. package/dist/thirdLib/vant/NoticeBar.d.ts +2 -2
  134. package/dist/thirdLib/vant/Popup.d.ts +2 -2
  135. package/dist/thirdLib/wm/Textarea.d.ts +2 -2
  136. package/dist/thirdLib/wm/map.d.ts +2 -2
  137. package/dist/thirdLib/wm/scrollView.d.ts +2 -2
  138. package/dist/thirdLib/wm/swiper.d.ts +2 -2
  139. package/dist/thirdLib/wm/view.d.ts +2 -2
  140. package/dist/types/{CreateComponentType.d.ts → CreateComponentDoc.d.ts} +5 -2
  141. package/dist/types/CreateComponentDoc.js +2 -0
  142. package/dist/types/CreateComponentDoc.js.map +1 -0
  143. package/dist/utils/nonNullable.js +1 -1
  144. package/dist/utils/nonNullable.js.map +1 -1
  145. package/package.json +8 -11
  146. package/CHANGELOG.md +0 -943
  147. package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.d.ts +0 -3
  148. package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js +0 -2
  149. package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js.map +0 -1
  150. package/dist/api/SubComponent/SubComputed/SubComputedConstraint.d.ts +0 -3
  151. package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js +0 -2
  152. package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js.map +0 -1
  153. package/dist/api/SubComponent/SubComputed/SubComputedOption.js +0 -2
  154. package/dist/api/SubComponent/SubComputed/SubComputedOption.js.map +0 -1
  155. package/dist/api/SubComponent/SubData/SubDataConstraint.d.ts +0 -3
  156. package/dist/api/SubComponent/SubData/SubDataConstraint.js +0 -2
  157. package/dist/api/SubComponent/SubData/SubDataConstraint.js.map +0 -1
  158. package/dist/api/SubComponent/SubData/SubDataOption.js +0 -2
  159. package/dist/api/SubComponent/SubData/SubDataOption.js.map +0 -1
  160. package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js +0 -2
  161. package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js.map +0 -1
  162. package/dist/api/SubComponent/SubEvents/SubEventsOption.d.ts +0 -4
  163. package/dist/api/SubComponent/SubEvents/SubEventsOption.js +0 -2
  164. package/dist/api/SubComponent/SubEvents/SubEventsOption.js.map +0 -1
  165. package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js +0 -2
  166. package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js.map +0 -1
  167. package/dist/api/SubComponent/SubInherit/SubInheritOption.js +0 -2
  168. package/dist/api/SubComponent/SubInherit/SubInheritOption.js.map +0 -1
  169. package/dist/api/SubComponent/SubInstance/SubInstance.d.ts +0 -2
  170. package/dist/api/SubComponent/SubInstance/SubInstance.js +0 -2
  171. package/dist/api/SubComponent/SubInstance/SubInstance.js.map +0 -1
  172. package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js +0 -2
  173. package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js.map +0 -1
  174. package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.d.ts +0 -2
  175. package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js +0 -2
  176. package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js.map +0 -1
  177. package/dist/api/SubComponent/SubMethods/SubMethodsOption.d.ts +0 -5
  178. package/dist/api/SubComponent/SubMethods/SubMethodsOption.js +0 -2
  179. package/dist/api/SubComponent/SubMethods/SubMethodsOption.js.map +0 -1
  180. package/dist/api/SubComponent/SubObservers/SubObserversOption.d.ts +0 -2
  181. package/dist/api/SubComponent/SubObservers/SubObserversOption.js +0 -2
  182. package/dist/api/SubComponent/SubObservers/SubObserversOption.js.map +0 -1
  183. package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.d.ts +0 -2
  184. package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js +0 -2
  185. package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js.map +0 -1
  186. package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js +0 -2
  187. package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js.map +0 -1
  188. package/dist/api/SubComponent/SubStore/SubStoreConstraint.js +0 -2
  189. package/dist/api/SubComponent/SubStore/SubStoreConstraint.js.map +0 -1
  190. package/dist/api/SubComponent/SubStore/SubStoreOption.js +0 -2
  191. package/dist/api/SubComponent/SubStore/SubStoreOption.js.map +0 -1
  192. package/dist/api/SubComponent/SubWatch/SubWatchOption.d.ts +0 -2
  193. package/dist/api/SubComponent/SubWatch/SubWatchOption.js +0 -2
  194. package/dist/api/SubComponent/SubWatch/SubWatchOption.js.map +0 -1
  195. package/dist/api/SubComponent/index.d.ts +0 -49
  196. package/dist/api/SubComponent/index.js +0 -4
  197. package/dist/api/SubComponent/index.js.map +0 -1
  198. package/dist/api/SubComponent/returnType.js.map +0 -1
  199. package/dist/types/CreateComponentType.js +0 -2
  200. package/dist/types/CreateComponentType.js.map +0 -1
  201. package/dist/types/ExtendComponentType.d.ts +0 -7
  202. package/dist/types/ExtendComponentType.js +0 -2
  203. package/dist/types/ExtendComponentType.js.map +0 -1
  204. package/dist/types/RemoveNullOfRequired.d.ts +0 -4
  205. package/dist/types/RemoveNullOfRequired.js +0 -2
  206. package/dist/types/RemoveNullOfRequired.js.map +0 -1
  207. package/src/api/DefineComponent/NameOrPath/NameOrPathOption.ts +0 -31
  208. package/src/api/DefineComponent/NameOrPath/test/error.test.ts +0 -32
  209. package/src/api/DefineComponent/NameOrPath/test/normal.test.ts +0 -13
  210. package/src/api/DefineComponent/RootComponent/RootComponentOption.ts +0 -11
  211. package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +0 -13
  212. package/src/api/DefineComponent/SubComponents/test/normal.test.ts +0 -1049
  213. package/src/api/DefineComponent/index.ts +0 -58
  214. package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +0 -29
  215. package/src/api/DefineComponent/normalizeOptions/customEventsHandle.ts +0 -55
  216. package/src/api/DefineComponent/normalizeOptions/handleRootComponent.ts +0 -33
  217. package/src/api/DefineComponent/normalizeOptions/handleStore/disposeStore.ts +0 -10
  218. package/src/api/DefineComponent/normalizeOptions/handleStore/initStore.ts +0 -9
  219. package/src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts +0 -70
  220. package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +0 -23
  221. package/src/api/DefineComponent/normalizeOptions/hijackHandle/addDetachedData.ts +0 -10
  222. package/src/api/DefineComponent/normalizeOptions/hijackHandle/hijack.ts +0 -26
  223. package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +0 -57
  224. package/src/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.ts +0 -22
  225. package/src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts +0 -25
  226. package/src/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.ts +0 -33
  227. package/src/api/DefineComponent/normalizeOptions/hijackHandle/pagePathCheck.ts +0 -9
  228. package/src/api/DefineComponent/normalizeOptions/index.ts +0 -143
  229. package/src/api/DefineComponent/normalizeOptions/initComputed/computedUpdater.ts +0 -51
  230. package/src/api/DefineComponent/normalizeOptions/initComputed/data-tracer.ts +0 -62
  231. package/src/api/DefineComponent/normalizeOptions/initComputed/dependencesOptimize.ts +0 -45
  232. package/src/api/DefineComponent/normalizeOptions/initComputed/index.ts +0 -42
  233. package/src/api/DefineComponent/normalizeOptions/initComputed/initComputedAndGetCache.ts +0 -105
  234. package/src/api/DefineComponent/normalizeOptions/injectInfoHandler.ts +0 -51
  235. package/src/api/DefineComponent/normalizeOptions/internalFieldProtection.ts +0 -27
  236. package/src/api/DefineComponent/normalizeOptions/otherFieldsHandle.ts +0 -29
  237. package/src/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.ts +0 -23
  238. package/src/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.ts +0 -36
  239. package/src/api/DefineComponent/normalizeOptions/watchHandler/getPathsValue.ts +0 -31
  240. package/src/api/DefineComponent/normalizeOptions/watchHandler/getPropertiesValue.ts +0 -51
  241. package/src/api/DefineComponent/normalizeOptions/watchHandler/hasComputedPath.ts +0 -9
  242. package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +0 -78
  243. package/src/api/DefineComponent/returnType/ComponentDoc.ts +0 -25
  244. package/src/api/DefineComponent/returnType/GenerateComponentDoc.ts +0 -46
  245. package/src/api/DefineComponent/returnType/GeneratePageDoc.ts +0 -22
  246. package/src/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.ts +0 -24
  247. package/src/api/DefineComponent/returnType/GetPropertiesDocOfSubDoc.ts +0 -7
  248. package/src/api/DefineComponent/returnType/PageDoc.ts +0 -19
  249. package/src/api/DefineComponent/returnType/test/normalComponentDoc.test.ts +0 -248
  250. package/src/api/DefineComponent/returnType/test/normalPageDoc.test.ts +0 -49
  251. package/src/api/InstanceInject/inject.ts +0 -36
  252. package/src/api/InstanceInject/instanceConfig.ts +0 -50
  253. package/src/api/InstanceInject/test/normal.test.ts +0 -41
  254. package/src/api/RootComponent/Computed/ComputedConstraint.ts +0 -4
  255. package/src/api/RootComponent/Computed/ComputedOption.ts +0 -35
  256. package/src/api/RootComponent/Computed/GetComputedDef.ts +0 -10
  257. package/src/api/RootComponent/Computed/test/GetComputedDoc.test.ts +0 -25
  258. package/src/api/RootComponent/Computed/test/error.test.ts +0 -50
  259. package/src/api/RootComponent/Computed/test/normal.test.ts +0 -124
  260. package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +0 -89
  261. package/src/api/RootComponent/CustomEvents/CustomEventsDef.ts +0 -4
  262. package/src/api/RootComponent/CustomEvents/CustomEventsDoc.ts +0 -4
  263. package/src/api/RootComponent/CustomEvents/CustomEventsOption.ts +0 -41
  264. package/src/api/RootComponent/CustomEvents/CustomEventsTag.ts +0 -59
  265. package/src/api/RootComponent/CustomEvents/GetCustomEventDef.ts +0 -29
  266. package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +0 -47
  267. package/src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts +0 -38
  268. package/src/api/RootComponent/CustomEvents/test/GetFullEventDoc.test.ts +0 -57
  269. package/src/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.ts +0 -36
  270. package/src/api/RootComponent/CustomEvents/test/error.test.ts +0 -101
  271. package/src/api/RootComponent/CustomEvents/test/normal.test.ts +0 -99
  272. package/src/api/RootComponent/Data/DataConstraint.ts +0 -1
  273. package/src/api/RootComponent/Data/DataOption.ts +0 -25
  274. package/src/api/RootComponent/Data/GetDataDef.ts +0 -8
  275. package/src/api/RootComponent/Data/GetDataDoc.ts +0 -8
  276. package/src/api/RootComponent/Data/test/GetDataDoc.test.ts +0 -32
  277. package/src/api/RootComponent/Data/test/error.test.ts +0 -14
  278. package/src/api/RootComponent/Data/test/normal.test.ts +0 -33
  279. package/src/api/RootComponent/Events/EventsConstraint.ts +0 -74
  280. package/src/api/RootComponent/Events/EventsOption.ts +0 -55
  281. package/src/api/RootComponent/Events/test/normal.test.ts +0 -161
  282. package/src/api/RootComponent/Instance/CustomEventMethods.ts +0 -11
  283. package/src/api/RootComponent/Instance/CustomSetData.ts +0 -17
  284. package/src/api/RootComponent/Instance/RootComponentInstance.ts +0 -46
  285. package/src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts +0 -70
  286. package/src/api/RootComponent/Instance/test/CustomSetData.test.ts +0 -44
  287. package/src/api/RootComponent/Instance/test/customEvents/error.test.ts +0 -13
  288. package/src/api/RootComponent/Instance/test/customEvents/normal.test.ts +0 -71
  289. package/src/api/RootComponent/Instance/test/methods/error.test.ts +0 -14
  290. package/src/api/RootComponent/Instance/test/methods/mormal.test.ts +0 -18
  291. package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +0 -58
  292. package/src/api/RootComponent/Instance/test/setData/error.test.ts +0 -65
  293. package/src/api/RootComponent/Instance/test/setData/normal.test.ts +0 -51
  294. package/src/api/RootComponent/IsPage/IsPageOption.ts +0 -6
  295. package/src/api/RootComponent/IsPage/test/normal.test.ts +0 -29
  296. package/src/api/RootComponent/Lifetimes/LifetimesConstraint.ts +0 -14
  297. package/src/api/RootComponent/Lifetimes/LifetimesOption.ts +0 -31
  298. package/src/api/RootComponent/Lifetimes/test/error.test.ts +0 -31
  299. package/src/api/RootComponent/Lifetimes/test/normal.test.ts +0 -34
  300. package/src/api/RootComponent/Methods/MethodsConstraint.ts +0 -3
  301. package/src/api/RootComponent/Methods/MethodsOption.ts +0 -15
  302. package/src/api/RootComponent/Methods/test/error.test.ts +0 -41
  303. package/src/api/RootComponent/Methods/test/mormal.test.ts +0 -25
  304. package/src/api/RootComponent/Observers/ObserversOption.ts +0 -58
  305. package/src/api/RootComponent/Observers/test/normal.test.ts +0 -30
  306. package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +0 -29
  307. package/src/api/RootComponent/PageLifetimes/test/error.test.ts +0 -37
  308. package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +0 -71
  309. package/src/api/RootComponent/Properties/GetOptionalDef.ts +0 -18
  310. package/src/api/RootComponent/Properties/GetPropertiesDef.ts +0 -22
  311. package/src/api/RootComponent/Properties/GetRequiredDef.ts +0 -16
  312. package/src/api/RootComponent/Properties/PropertiesConstraint.ts +0 -38
  313. package/src/api/RootComponent/Properties/PropertiesOption.ts +0 -25
  314. package/src/api/RootComponent/Properties/PropertiesValueValidator.ts +0 -21
  315. package/src/api/RootComponent/Properties/test/error.test.ts +0 -49
  316. package/src/api/RootComponent/Properties/test/normalEmpty.test.ts +0 -42
  317. package/src/api/RootComponent/Properties/test/normalOptional.test.ts +0 -118
  318. package/src/api/RootComponent/Properties/test/normalRequired.test.ts +0 -107
  319. package/src/api/RootComponent/Store/GetStoreDef.ts +0 -34
  320. package/src/api/RootComponent/Store/StoreConstraint.ts +0 -2
  321. package/src/api/RootComponent/Store/StoreOption.ts +0 -53
  322. package/src/api/RootComponent/Store/test/error.test.ts +0 -30
  323. package/src/api/RootComponent/Store/test/normal.test.ts +0 -35
  324. package/src/api/RootComponent/Watch/WatchOption.ts +0 -67
  325. package/src/api/RootComponent/Watch/test/WatchComputed.test.ts +0 -40
  326. package/src/api/RootComponent/Watch/test/WatchData.test.ts +0 -55
  327. package/src/api/RootComponent/Watch/test/WatchProperties.test.ts +0 -170
  328. package/src/api/RootComponent/Watch/test/WtachInject.test.ts +0 -16
  329. package/src/api/RootComponent/Watch/test/error.test.ts +0 -54
  330. package/src/api/RootComponent/index.ts +0 -151
  331. package/src/api/RootComponent/returnType.ts +0 -57
  332. package/src/api/SubComponent/SubComputed/GetSubComputedDoc.ts +0 -4
  333. package/src/api/SubComponent/SubComputed/SubComputedConstraint.ts +0 -1
  334. package/src/api/SubComponent/SubComputed/SubComputedOption.ts +0 -11
  335. package/src/api/SubComponent/SubComputed/test/error.test.ts +0 -88
  336. package/src/api/SubComponent/SubComputed/test/normal.test.ts +0 -207
  337. package/src/api/SubComponent/SubData/SubDataConstraint.ts +0 -9
  338. package/src/api/SubComponent/SubData/SubDataOption.ts +0 -17
  339. package/src/api/SubComponent/SubData/test/error.test.ts +0 -64
  340. package/src/api/SubComponent/SubData/test/normal.test.ts +0 -91
  341. package/src/api/SubComponent/SubEvents/SubEventsConstraint.ts +0 -27
  342. package/src/api/SubComponent/SubEvents/SubEventsOption.ts +0 -12
  343. package/src/api/SubComponent/SubEvents/test/error.test.ts +0 -36
  344. package/src/api/SubComponent/SubEvents/test/normal.test.ts +0 -209
  345. package/src/api/SubComponent/SubInherit/SubInheritConstraint.ts +0 -17
  346. package/src/api/SubComponent/SubInherit/SubInheritOption.ts +0 -15
  347. package/src/api/SubComponent/SubInherit/test/error.test.ts +0 -84
  348. package/src/api/SubComponent/SubInherit/test/normal.test.ts +0 -81
  349. package/src/api/SubComponent/SubInstance/SubInstance.ts +0 -9
  350. package/src/api/SubComponent/SubInstance/test/error.test.ts +0 -22
  351. package/src/api/SubComponent/SubInstance/test/normal.test.ts +0 -87
  352. package/src/api/SubComponent/SubLifetimes/SubLifetimesOption.ts +0 -3
  353. package/src/api/SubComponent/SubMethods/SubMethodsConstraint.ts +0 -3
  354. package/src/api/SubComponent/SubMethods/SubMethodsOption.ts +0 -17
  355. package/src/api/SubComponent/SubMethods/test/error.test.ts +0 -51
  356. package/src/api/SubComponent/SubMethods/test/normarl.test.ts +0 -33
  357. package/src/api/SubComponent/SubObservers/SubObserversOption.ts +0 -3
  358. package/src/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.ts +0 -6
  359. package/src/api/SubComponent/SubPageLifetimes/test/error.test.ts +0 -1
  360. package/src/api/SubComponent/SubPageLifetimes/test/normal.test.ts +0 -1
  361. package/src/api/SubComponent/SubReturnType/CreateSubComponentDoc.ts +0 -41
  362. package/src/api/SubComponent/SubReturnType/test/error.test.ts +0 -18
  363. package/src/api/SubComponent/SubReturnType/test/normal.test.ts +0 -98
  364. package/src/api/SubComponent/SubStore/SubStoreConstraint.ts +0 -13
  365. package/src/api/SubComponent/SubStore/SubStoreOption.ts +0 -32
  366. package/src/api/SubComponent/SubStore/test/error.test.ts +0 -60
  367. package/src/api/SubComponent/SubStore/test/normal.test.ts +0 -43
  368. package/src/api/SubComponent/SubWatch/SubWatchOption.ts +0 -3
  369. package/src/api/SubComponent/SubWatch/test/WatchComputed.test.ts +0 -90
  370. package/src/api/SubComponent/SubWatch/test/WatchProperties.test.ts +0 -151
  371. package/src/api/SubComponent/SubWatch/test/WatchRootData.test.ts +0 -122
  372. package/src/api/SubComponent/SubWatch/test/WatchSubData.test.ts +0 -49
  373. package/src/api/SubComponent/SubWatch/test/WtachInject.test.ts +0 -16
  374. package/src/api/SubComponent/SubWatch/test/error.test.ts +0 -60
  375. package/src/api/SubComponent/index.ts +0 -301
  376. package/src/api/SubComponent/returnType.ts +0 -39
  377. package/src/api/wxSugar.ts +0 -107
  378. package/src/behaviors/BbeforeCreated.ts +0 -18
  379. package/src/behaviors/BthrottleDebounce.ts +0 -28
  380. package/src/index.ts +0 -46
  381. package/src/thirdLib/index.ts +0 -3
  382. package/src/thirdLib/vant/Button.ts +0 -23
  383. package/src/thirdLib/vant/NoticeBar.ts +0 -32
  384. package/src/thirdLib/vant/Popup.ts +0 -70
  385. package/src/thirdLib/vant/index.ts +0 -5
  386. package/src/thirdLib/wm/Textarea.ts +0 -117
  387. package/src/thirdLib/wm/baseEvents.ts +0 -54
  388. package/src/thirdLib/wm/index.ts +0 -9
  389. package/src/thirdLib/wm/map.ts +0 -266
  390. package/src/thirdLib/wm/scrollView.ts +0 -86
  391. package/src/thirdLib/wm/swiper.test.ts +0 -22
  392. package/src/thirdLib/wm/swiper.ts +0 -111
  393. package/src/thirdLib/wm/view.ts +0 -28
  394. package/src/types/AddNullForObject.ts +0 -6
  395. package/src/types/AddPrefix.ts +0 -10
  396. package/src/types/Assert.ts +0 -1
  397. package/src/types/Assign.ts +0 -1
  398. package/src/types/ComputeObject.ts +0 -1
  399. package/src/types/CreateComponentType.ts +0 -37
  400. package/src/types/DetailedType.ts +0 -15
  401. package/src/types/ExtendComponentType.ts +0 -60
  402. package/src/types/Extra.ts +0 -1
  403. package/src/types/GetComponentPrefix.ts +0 -36
  404. package/src/types/GetPropertiesDuplicatedKeys.ts +0 -14
  405. package/src/types/Has.ts +0 -1
  406. package/src/types/InferDetailedType.test.ts +0 -13
  407. package/src/types/InferDetailedType.ts +0 -12
  408. package/src/types/InnerData.ts +0 -1
  409. package/src/types/ListOfSamePrimitive.ts +0 -20
  410. package/src/types/OfficialTypeAlias.ts +0 -107
  411. package/src/types/RemoveInnerData.ts +0 -5
  412. package/src/types/RemoveNever.ts +0 -6
  413. package/src/types/RemoveNullOfRequired.ts +0 -8
  414. package/src/types/RemovePrefix.ts +0 -3
  415. package/src/types/Replace.ts +0 -24
  416. package/src/types/ReplacePrefix.ts +0 -46
  417. package/src/types/RequiredKeys.ts +0 -8
  418. package/src/types/Shift.ts +0 -2
  419. package/src/types/TwoParamsEqual.ts +0 -3
  420. package/src/types/UnionToComma.test.ts +0 -9
  421. package/src/types/Validators.ts +0 -17
  422. package/src/types/includes.ts +0 -3
  423. package/src/utils/InnerMarker.ts +0 -3
  424. package/src/utils/_utils.ts +0 -8
  425. package/src/utils/applyDebounceAndThrottle.ts +0 -31
  426. package/src/utils/debounce.ts +0 -22
  427. package/src/utils/deepClone.ts +0 -20
  428. package/src/utils/deepEqual.ts +0 -32
  429. package/src/utils/isEmptyObject.ts +0 -14
  430. package/src/utils/nonNullable.ts +0 -20
  431. package/src/utils/throttle.ts +0 -24
  432. package/src/utils/typeEqual.ts +0 -30
  433. package/src/utils/typeNotEqual.ts +0 -48
  434. package/tsconfig.json +0 -24
  435. /package/dist/api/{SubComponent → CustomComponent}/returnType.js +0 -0
@@ -1,53 +0,0 @@
1
- import type { G } from "hry-types";
2
- import type { As } from "hry-types/src/Any/As";
3
- import type { IfContains } from "hry-types/src/Any/IfContains";
4
- import type { Func } from "hry-types/src/Misc/Func";
5
- import type { Validators } from "../../../types/Validators";
6
- import type { StoreConstraint } from "./StoreConstraint";
7
-
8
- export type StoreOption<
9
- TStore extends StoreConstraint,
10
- TDuplicateKeys extends PropertyKey,
11
- > = {
12
- /**
13
- * 全局响应式数据字段,全局store对应数据变化实例对应数据自动setData。与properties和data字段有重复检测
14
- * @example
15
- * ```ts
16
- * {
17
- * properties:{
18
- * useId: String,
19
- * }
20
- * //...
21
- * store: {
22
- * responsiveData: () => sroreX.str,
23
- * user:(data)=> M_AllUser[data.useId],
24
- * _user: {
25
- * getter: (data) => M_AllUser[data.useId],
26
- * default: null,
27
- * },
28
- * },
29
- * }
30
- * ```
31
- */
32
- store?:
33
- & TStore
34
- & Validators<[
35
- G.DuplicateFieldValidator<TStore, TDuplicateKeys, "字段重复">,
36
- // TypeValidator<TStore>,
37
- ]>;
38
- };
39
- /**
40
- * 验证properties的value类型是否正确
41
- * @returns unknown | `{ default: () => "⚠️类型错误⚠️" }`
42
- */
43
- export type TypeValidator<
44
- TStore,
45
- Result = {
46
- [k in keyof TStore]: IfContains<
47
- ReturnType<As<TStore[k], Func>>,
48
- undefined,
49
- () => "⚠️返回类型中不可以包含undefined⚠️",
50
- unknown
51
- >;
52
- },
53
- > = Record<keyof TStore, unknown> extends Result ? unknown : Result;
@@ -1,30 +0,0 @@
1
- import { observable } from "mobx";
2
- import { RootComponent } from "../..";
3
- const user = observable({
4
- name: "zhao",
5
- age: 20,
6
- });
7
-
8
- // 1 约束错误
9
- RootComponent()({
10
- store: {
11
- // @ts-expect-error 1.1 不能将类型“string”分配给类型“Getter<{}, unknown>”
12
- userName: user.name,
13
- },
14
- });
15
-
16
- // 2 重复字段错误
17
- RootComponent()({
18
- properties: {
19
- userName: String,
20
- },
21
- data: {
22
- userAge: 20,
23
- },
24
- store: {
25
- // @ts-expect-error 2.1 与properties字段重复
26
- userName: () => user.name,
27
- // @ts-expect-error 2.2 与userAge字段重复
28
- userAge: () => user.age,
29
- },
30
- });
@@ -1,35 +0,0 @@
1
- import { observable } from "mobx";
2
- import { typeEqual } from "../../../../utils/_utils";
3
- import { RootComponent } from "../..";
4
- const user = observable({
5
- name: "zhao",
6
- age: 20,
7
- });
8
-
9
- const storeDoc = RootComponent()({
10
- properties: {
11
- condition: Number,
12
- },
13
- store: {
14
- // normal
15
- userName: () => user.name,
16
- // 条件反应式,当condition>10时,响应式,否则不可响应式(返回undefined),但不报错(有警告).
17
- userAge: (props) => {
18
- if (props.condition > 10) {
19
- return user.age;
20
- }
21
- return undefined;
22
- },
23
- },
24
- });
25
-
26
- type StoreDocExpected = {
27
- properties: {
28
- condition: number;
29
- };
30
- store: {
31
- userName: string;
32
- userAge: number | undefined;
33
- };
34
- };
35
- typeEqual<StoreDocExpected>()(storeDoc);
@@ -1,67 +0,0 @@
1
- import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
- import type { IsPureObject } from "hry-types/src/Any/IsPureObject";
3
- import type { NoInfer } from "hry-types/src/Generic/NoInfer";
4
- import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
5
-
6
- type getFirstKeys<T extends string> = T extends `${infer F}.${string}` ? F : never;
7
-
8
- type getLastKeys<T extends string> = T extends `${string}.${infer L}` ? L : never;
9
-
10
- // 加入对象字段一级key 例如 `obj.xxx`(newValue,oldValue){...}和`obj.**`
11
- type AddFieldsOfObject<
12
- TWatchData extends object,
13
- _WatchKeys extends keyof TWatchData,
14
- secondKeys extends string = {
15
- [k in _WatchKeys]: IsPureObject<TWatchData[k]> extends true
16
- ? `${k & string}.${(keyof TWatchData[k]) & string}` | `${k & string}.**`
17
- : never;
18
- }[_WatchKeys],
19
- > = {
20
- [k in secondKeys]?: (
21
- // @ts-ignore
22
- newValue: IfExtends<
23
- getLastKeys<k>,
24
- "**",
25
- // @ts-ignore
26
- Exclude<TWatchData[getFirstKeys<k>], null>,
27
- // @ts-ignore
28
- NonNullable<(Exclude<TWatchData[getFirstKeys<k>], null>)[getLastKeys<k>]>
29
- >,
30
- oldValue: IfExtends<
31
- getLastKeys<k>,
32
- "**",
33
- // @ts-ignore
34
- TWatchData[getFirstKeys<k>],
35
- // @ts-ignore
36
- (Exclude<TWatchData[getFirstKeys<k>], null>)[getLastKeys<k>]
37
- >,
38
- ) => void | Promise<void>;
39
- };
40
-
41
- export type WatchOption<TWatchData extends object, _WatchKeys extends keyof TWatchData = keyof TWatchData> = {
42
- /**
43
- * 监控所有data字段,值变化时(JSON.stringify判断)运行watch函数,一参为最新值,二参为变化前值。
44
- * 对象数据可通过`obj.xxx:`监控具体字段(只加入了一级字段类型提示)
45
- */
46
- watch?: IfExtends<
47
- {},
48
- TWatchData,
49
- EmptyObject,
50
- // 不加NoInfer会导致只监控计算字段时错误
51
- NoInfer<
52
- & {
53
- [k in _WatchKeys]?: (
54
- newValue: TWatchData[k],
55
- oldValue: TWatchData[k],
56
- ) => void | Promise<void>;
57
- }
58
- // 解决单独书写计算书写字段的报错(猜测是:ts字面量约束检测提前计算属性key引起的错误提示)
59
- // eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
60
- & {
61
- [k in _WatchKeys as never]: unknown;
62
- }
63
- // 加入对象的一级字段类型提示
64
- & AddFieldsOfObject<TWatchData, _WatchKeys>
65
- >
66
- >;
67
- };
@@ -1,40 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
-
3
- import type { DetailedType } from "../../../../types/DetailedType";
4
- import { RootComponent } from "../..";
5
- import type { Mock_User } from "../../Properties/test/normalRequired.test";
6
-
7
- /**
8
- * 1 computed字段时需要手写类型,可悬停鼠标到key查看类型,深度只读
9
- */
10
- RootComponent()({
11
- properties: {
12
- Pnum: Number,
13
- obj: Object as DetailedType<Mock_User>,
14
- },
15
- data: {
16
- DNum: 123,
17
- },
18
- computed: {
19
- CNum() {
20
- return this.data.Pnum + this.data.DNum;
21
- },
22
- Cobj() {
23
- return this.data.obj;
24
- },
25
- },
26
- watch: {
27
- CNum(newValue: number, oldValue: number) {
28
- void oldValue;
29
- void Checking<number, typeof newValue, Test.Pass>;
30
-
31
- void Checking<number, typeof oldValue, Test.Pass>;
32
- },
33
- Cobj(newValue: Mock_User, oldValue: Mock_User | null) {
34
- void oldValue;
35
- void Checking<Mock_User, typeof newValue, Test.Pass>;
36
-
37
- void Checking<Mock_User | null, typeof oldValue, Test.Pass>;
38
- },
39
- },
40
- });
@@ -1,55 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
-
3
- import { observable } from "mobx";
4
- import { RootComponent } from "../..";
5
- import type { Mock_User } from "../../Properties/test/normalRequired.test";
6
-
7
- const obj = observable({
8
- gender: "male" as "male" | "female",
9
- });
10
-
11
- /**
12
- * watch data字段 深度只读
13
- */
14
- RootComponent()({
15
- data: {
16
- num: 123,
17
- obj: {} as Mock_User,
18
- },
19
- store: {
20
- reactiveLiteral: () => obj.gender,
21
- reactiveNumber: () => ({} as number),
22
- reactiveUser: () => ({} as Mock_User),
23
- },
24
- watch: {
25
- num(newValue, oldValue) {
26
- void oldValue;
27
- void Checking<number, typeof newValue, Test.Pass>;
28
-
29
- void Checking<number, typeof oldValue, Test.Pass>;
30
- },
31
- obj(newValue, oldValue) {
32
- void oldValue;
33
- void Checking<Mock_User, typeof newValue, Test.Pass>;
34
-
35
- void Checking<Mock_User, typeof oldValue, Test.Pass>;
36
- },
37
- reactiveNumber(newValue: number, oldValue) {
38
- void oldValue;
39
- void Checking<number, typeof newValue, Test.Pass>;
40
- void Checking<number, typeof oldValue, Test.Pass>;
41
- },
42
- reactiveLiteral(newValue, oldValue) {
43
- void oldValue;
44
- void Checking<"male" | "female", typeof newValue, Test.Pass>;
45
-
46
- void Checking<"male" | "female", typeof oldValue, Test.Pass>;
47
- },
48
- reactiveUser(newValue, oldValue) {
49
- void oldValue;
50
- void Checking<Mock_User, typeof newValue, Test.Pass>;
51
-
52
- void Checking<Mock_User, typeof oldValue, Test.Pass>;
53
- },
54
- },
55
- });
@@ -1,170 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
- import type { DetailedType } from "../../../..";
3
- import { RootComponent } from "../..";
4
- import type { OptionalType } from "../../Properties/PropertiesConstraint";
5
- import {
6
- type Mock_Cart,
7
- mock_requiredTypes,
8
- mock_requiredUnion,
9
- type Mock_User,
10
- } from "../../Properties/test/normalRequired.test";
11
- const mock_optional = {
12
- optional_num: {
13
- type: Number,
14
- value: 123,
15
- },
16
- optional_gender: {
17
- type: String as DetailedType<"male" | "female">,
18
- value: "male" as const,
19
- },
20
- optional_obj: {
21
- type: Object as DetailedType<Mock_User>,
22
- value: {
23
- id: "id",
24
- name: "name",
25
- age: 20,
26
- },
27
- },
28
- optional_objOrNull: {
29
- type: Object as DetailedType<Mock_User | null>,
30
- value: null,
31
- },
32
- } satisfies Record<string, OptionalType>;
33
-
34
- /**
35
- * watch properties字段 深度只读, 必传对象字段newValue去除null
36
- */
37
- RootComponent()({
38
- properties: {
39
- ...mock_requiredTypes,
40
- ...mock_requiredUnion,
41
- ...mock_optional,
42
- },
43
- watch: {
44
- // 必传单一字段
45
- str(newValue, oldValue) {
46
- void oldValue;
47
- void Checking<string, typeof newValue, Test.Pass>;
48
-
49
- void Checking<string, typeof oldValue, Test.Pass>;
50
- },
51
- num(newValue, oldValue) {
52
- void oldValue;
53
- void Checking<number, typeof newValue, Test.Pass>;
54
-
55
- void Checking<number, typeof oldValue, Test.Pass>;
56
- },
57
- bool(newValue, oldValue) {
58
- void oldValue;
59
- void Checking<boolean, typeof newValue, Test.Pass>;
60
-
61
- void Checking<boolean, typeof oldValue, Test.Pass>;
62
- },
63
-
64
- obj(newValue, oldValue) {
65
- void oldValue;
66
- void Checking<object, typeof newValue, Test.Pass>;
67
-
68
- void Checking<object, typeof oldValue, Test.Pass>;
69
- },
70
- tuple(newValue, oldValue) {
71
- void oldValue;
72
- void Checking<[string, number, boolean], typeof newValue, Test.Pass>;
73
-
74
- void Checking<[string, number, boolean], typeof oldValue, Test.Pass>;
75
- },
76
- union_str(newValue, oldValue) {
77
- void oldValue;
78
- void Checking<"male" | "female", typeof newValue, Test.Pass>;
79
-
80
- void Checking<"male" | "female", typeof oldValue, Test.Pass>;
81
- },
82
- union_num(newValue, oldValue) {
83
- void oldValue;
84
- void Checking<0 | 1 | 2, typeof newValue, Test.Pass>;
85
-
86
- void Checking<0 | 1 | 2, typeof oldValue, Test.Pass>;
87
- },
88
- union_bool(newValue, oldValue) {
89
- void oldValue;
90
- void Checking<false | true, typeof newValue, Test.Pass>;
91
-
92
- void Checking<false | true, typeof oldValue, Test.Pass>;
93
- },
94
- union_arr(newValue, oldValue) {
95
- void oldValue;
96
- void Checking<number[] | string[], typeof newValue, Test.Pass>;
97
-
98
- void Checking<number[] | string[], typeof oldValue, Test.Pass>;
99
- },
100
- union_obj(newValue, oldValue) {
101
- void oldValue;
102
- void Checking<Mock_User | Mock_Cart, typeof newValue, Test.Pass>;
103
-
104
- void Checking<Mock_User | Mock_Cart, typeof oldValue, Test.Pass>;
105
- },
106
- // 必传多类型联合
107
- union_str_num_bool(newValue, oldValue) {
108
- void oldValue;
109
- void Checking<string | number | boolean, typeof newValue, Test.Pass>;
110
-
111
- void Checking<string | number | boolean, typeof oldValue, Test.Pass>;
112
- },
113
- union_literalStr_Literalnum(newValue, oldValue) {
114
- void oldValue;
115
- void Checking<0 | 1 | 2 | "male" | "female", typeof newValue, Test.Pass>;
116
-
117
- void Checking<0 | 1 | 2 | "male" | "female", typeof oldValue, Test.Pass>;
118
- },
119
- union_mockUser_num(newValue, oldValue) {
120
- void oldValue;
121
- void Checking<number | Mock_User, typeof newValue, Test.Pass>;
122
-
123
- void Checking<number | Mock_User, typeof oldValue, Test.Pass>;
124
- },
125
- // 可选字段
126
- optional_gender(newValue, oldValue) {
127
- void oldValue;
128
- void Checking<"male" | "female", typeof newValue, Test.Pass>;
129
-
130
- void Checking<"male" | "female", typeof oldValue, Test.Pass>;
131
- },
132
- optional_num(newValue, oldValue) {
133
- void oldValue;
134
- void Checking<number, typeof newValue, Test.Pass>;
135
-
136
- void Checking<number, typeof oldValue, Test.Pass>;
137
- },
138
- optional_obj(newValue, oldValue) {
139
- void oldValue;
140
- void Checking<Mock_User, typeof newValue, Test.Pass>;
141
-
142
- void Checking<Mock_User, typeof oldValue, Test.Pass>;
143
- },
144
- // 对象的二段key
145
- "optional_obj.age"(newValue, oldValue) {
146
- void oldValue;
147
- void Checking<number, typeof newValue, Test.Pass>;
148
-
149
- void Checking<number | undefined, typeof oldValue, Test.Pass>;
150
- },
151
- "optional_obj.**"(newValue, oldValue) {
152
- void oldValue;
153
- void Checking<Mock_User, typeof newValue, Test.Pass>;
154
-
155
- void Checking<Mock_User, typeof oldValue, Test.Pass>;
156
- },
157
- "optional_obj.id"(newValue, oldValue) {
158
- void oldValue;
159
- void Checking<string, typeof newValue, Test.Pass>;
160
-
161
- void Checking<string, typeof oldValue, Test.Pass>;
162
- },
163
- optional_objOrNull(newValue, oldValue) {
164
- void oldValue;
165
- void Checking<Mock_User | null, typeof newValue, Test.Pass>;
166
-
167
- void Checking<Mock_User | null, typeof oldValue, Test.Pass>;
168
- },
169
- },
170
- });
@@ -1,16 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
- import { RootComponent } from "../..";
3
- /**
4
- * watch 只能监控 注入的store字段
5
- * 注入文件 https://github.com/missannil/annil/blob/main/src/api/InstanceInject/inject.ts
6
- */
7
- RootComponent()({
8
- watch: {
9
- injectTheme(newValue, oldValue) {
10
- void oldValue;
11
- void Checking<"dark" | "light" | undefined, typeof newValue, Test.Pass>;
12
-
13
- void Checking<"dark" | "light" | undefined, typeof oldValue, Test.Pass>;
14
- },
15
- },
16
- });
@@ -1,54 +0,0 @@
1
- import type { DetailedType } from "../../../../types/DetailedType";
2
- import { RootComponent } from "../..";
3
- // 1 没有data可以watch 约束为EmptyObject
4
- RootComponent()({
5
- watch: {
6
- // @ts-expect-error 无可监控字段时,约束为EmptyObject,即不可写任何字段
7
- xxx() {
8
- void 0;
9
- },
10
- },
11
- });
12
-
13
- /**
14
- * 2 超出约束字段报错
15
- */
16
- RootComponent()({
17
- properties: {
18
- num: Number,
19
- },
20
- data: {
21
- str: "123",
22
- },
23
- computed: {
24
- Cnum() {
25
- return this.data.num;
26
- },
27
- },
28
- watch: {
29
- // @ts-expect-error otherFields不在约束字段(num,str,Cnum)中
30
- otherFields() {
31
- void 0;
32
- },
33
- },
34
- });
35
- /**
36
- * 3 对象联合null的类型 不能watch子字段
37
- */
38
- RootComponent()({
39
- properties: {
40
- user: Object as DetailedType<{ name: string; age: number } | null>,
41
- },
42
-
43
- watch: {
44
- user(newValue, oldValue) {
45
- void oldValue;
46
- void newValue;
47
- },
48
- // @ts-expect-error 不能watch子字段 因为user可能为null
49
- "user.name"(newValue, oldValue) {
50
- void oldValue;
51
- void newValue;
52
- },
53
- },
54
- });
@@ -1,151 +0,0 @@
1
- import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
- import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
3
- import type { Func } from "hry-types/src/Misc/Func";
4
- import type { ComputeIntersection } from "hry-types/src/Object/_api";
5
- import type { ComputeObject } from "../../types/ComputeObject";
6
- import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
7
- import type { RemoveNullOfRequired } from "../../types/RemoveNullOfRequired";
8
- import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
9
- import type { IInjectStore } from "../InstanceInject/instanceConfig";
10
- import type { ComputedConstraint } from "./Computed/ComputedConstraint";
11
- import type { ComputedOption } from "./Computed/ComputedOption";
12
- import type { GetComputedDef } from "./Computed/GetComputedDef";
13
- import type { CustomEventConstraint } from "./CustomEvents/CustomEventConstraint";
14
- import type { CustomEventsOption } from "./CustomEvents/CustomEventsOption";
15
- import type { GetCustomEventsDef } from "./CustomEvents/GetCustomEventDef";
16
- import type { DataOption } from "./Data/DataOption";
17
- import type { EventsConstraint } from "./Events/EventsConstraint";
18
- import type { EventsOption } from "./Events/EventsOption";
19
- import type { RootComponentInstance } from "./Instance/RootComponentInstance";
20
- import type { IsPageOption } from "./IsPage/IsPageOption";
21
- import type { LifetimesOption } from "./Lifetimes/LifetimesOption";
22
- import type { MethodsConstraint } from "./Methods/MethodsConstraint";
23
- import type { MethodsOption } from "./Methods/MethodsOption";
24
- import type { ObserversOption } from "./Observers/ObserversOption";
25
- import type { PageLifetimesOption } from "./PageLifetimes/PageLifetimesOption";
26
- import type { GetPropertiesDef } from "./Properties/GetPropertiesDef";
27
- import type { PropertiesConstraint } from "./Properties/PropertiesConstraint";
28
- import type { PropertiesOption } from "./Properties/PropertiesOption";
29
- import type { GetStoreDef } from "./Store/GetStoreDef";
30
- import type { StoreConstraint } from "./Store/StoreConstraint";
31
- import type { StoreOption } from "./Store/StoreOption";
32
- import type { WatchOption } from "./Watch/WatchOption";
33
-
34
- type RootComponentOptions<
35
- TEvents extends object,
36
- TIsPage extends boolean,
37
- TCustomEvents extends CustomEventConstraint,
38
- TMethods extends MethodsConstraint,
39
- TProperties extends PropertiesConstraint,
40
- TData extends object,
41
- TStore extends StoreConstraint,
42
- TComputed extends Record<string, Func>,
43
- EventsDef extends object,
44
- CustomEventsDef extends object,
45
- PropertiesDef extends object,
46
- DataDef extends object,
47
- StoreDef extends object,
48
- ComputedDef extends object,
49
- > =
50
- & MethodsOption<TMethods, keyof (EventsDef & CustomEventsDef)>
51
- & PropertiesOption<TProperties>
52
- & IsPageOption<TIsPage>
53
- & EventsOption<TEvents>
54
- & IfExtends<TIsPage, false, CustomEventsOption<TCustomEvents, keyof EventsDef>, {}>
55
- & DataOption<TData, keyof PropertiesDef>
56
- & StoreOption<TStore, keyof (PropertiesDef & DataDef)>
57
- & ComputedOption<
58
- TComputed,
59
- keyof (PropertiesDef & DataDef & StoreDef)
60
- > // { data: ComputeObject<DataDef & Required<PropertiesDef> & StoreDef & ComputedDef & IInjectAllData> }
61
- & PageLifetimesOption<TIsPage, PropertiesDef>
62
- & LifetimesOption
63
- & WatchOption<
64
- & ComputedDef
65
- & Required<PropertiesDef>
66
- & DataDef
67
- & StoreDef
68
- & IInjectStore
69
- >
70
- & Partial<Omit<WMCompOtherOption, "pageLifetimes" | "definitionFilter" | "observers">>
71
- & ObserversOption<
72
- & ComputedDef
73
- & Required<PropertiesDef>
74
- & DataDef
75
- & StoreDef
76
- & IInjectStore
77
- >
78
- & ThisType<
79
- RootComponentInstance<
80
- TIsPage,
81
- TMethods,
82
- DataDef,
83
- DataDef & Required<PropertiesDef> & StoreDef & ComputedDef,
84
- CustomEventsDef,
85
- StoreDef
86
- >
87
- >;
88
-
89
- type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <
90
- TEvents extends EventsConstraint<TComponentDocList>,
91
- TStore extends StoreConstraint<PropertiesDef>,
92
- TIsPage extends boolean = false,
93
- const TProperties extends PropertiesConstraint = {},
94
- TData extends object = {},
95
- TComputed extends ComputedConstraint = {},
96
- // 页面时自定义事件无意义
97
- TCustomEvents extends IfExtends<TIsPage, false, CustomEventConstraint, EmptyObject> = {},
98
- TMethods extends MethodsConstraint = {},
99
- EventsDef extends object = IfExtends<EventsConstraint<TComponentDocList>, TEvents, {}, TEvents>,
100
- CustomEventsDef extends object = GetCustomEventsDef<TCustomEvents>,
101
- PropertiesDef extends object = GetPropertiesDef<TProperties>,
102
- DataDef extends object = TData,
103
- StoreDef extends object = StoreConstraint<PropertiesDef> extends TStore ? {} : GetStoreDef<TStore>,
104
- ComputedDef extends object = GetComputedDef<TComputed>,
105
- >(
106
- options: RootComponentOptions<
107
- TEvents,
108
- TIsPage,
109
- TCustomEvents,
110
- TMethods,
111
- TProperties,
112
- TData,
113
- TStore,
114
- TComputed,
115
- // TObservers,
116
- EventsDef,
117
- CustomEventsDef,
118
- PropertiesDef,
119
- DataDef,
120
- StoreDef,
121
- ComputedDef
122
- >,
123
- ) => // 生成RootComponentDefinition
124
- ComputeIntersection<
125
- & IfExtends<TIsPage, false, {}, { isPage: true }>
126
- & IfExtends<
127
- EmptyObject,
128
- PropertiesDef,
129
- {},
130
- { properties: IfExtends<false, TIsPage, PropertiesDef, RemoveNullOfRequired<PropertiesDef>> }
131
- >
132
- & IfExtends<EmptyObject, DataDef, {}, { data: DataDef }>
133
- & IfExtends<EmptyObject, StoreDef, {}, { store: ComputeObject<StoreDef> }>
134
- & IfExtends<EmptyObject, ComputedDef, {}, { computed: ComputedDef }>
135
- & IfExtends<EmptyObject, TMethods, {}, { methods: TMethods }>
136
- & IfExtends<EmptyObject, EventsDef, {}, { events: EventsDef }>
137
- & IfExtends<EmptyObject, CustomEventsDef, {}, { customEvents: ComputeObject<CustomEventsDef> }>
138
- >;
139
- /**
140
- * RootComponent API
141
- * @returns RootComponentDefinition
142
- */
143
- export function RootComponent<
144
- // TComponentDocList泛型为了给events字段提供类型约束
145
- TComponentDocList extends ComponentDoc[] = [],
146
- >(): RootComponentConstructor<
147
- TComponentDocList
148
- > {
149
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
150
- return (options: any) => options;
151
- }