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,41 +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 { ComputeIntersection, Select } from "hry-types/src/Object/_api";
4
- import type { ComputeObject } from "../../../types/ComputeObject";
5
- import type { RemovePrefix } from "../../../types/RemovePrefix";
6
- import type { Composed } from "../../RootComponent/CustomEvents/CustomEventsTag";
7
-
8
- type SelectStopEvents<T extends object> = {
9
- [k in keyof T as k extends `${infer R}_catch` ? R : never]: unknown;
10
- };
11
-
12
- type GetComposedEvents<
13
- TCustomEventsDoc extends object,
14
- > = Select<
15
- TCustomEventsDoc,
16
- Composed,
17
- "contains->"
18
- >;
19
-
20
- export type CreatSubComponentDoc<
21
- ComponentCustomEvents extends object,
22
- EventsDoc extends object,
23
- // allDatas extends object,
24
- // SubMethods extends object,
25
- ComposedEvents extends object = ComputeObject<
26
- RemovePrefix<
27
- Omit<
28
- GetComposedEvents<ComponentCustomEvents>,
29
- keyof SelectStopEvents<EventsDoc>
30
- >
31
- >
32
- >,
33
- CustomCompDoc = ComputeIntersection<
34
- // 1. 从原始组件文档中排除子组件文档中的事件
35
- IfExtends<EmptyObject, ComposedEvents, {}, { composedEvents: ComposedEvents }>
36
- >, // & IfExtends<EmptyObject, SubMethods, {}, { methods: SubMethods }>
37
- > // & IfExtends<EmptyObject, allDatas, {}, { allDatas: allDatas }>
38
- =
39
- // SubComponent中计算属性字段函数若不写返回类型,可能会造成结果中没有计算属性字段类型,若没有其他字段,结果就为'{}',如果加入到DefineComponent的subComponents字段中会引起本来应该报错的组件(例如:'aaa组件缺少xxx必传字段')不报错。所以这里把结果为{}的情况替换为never。可以让组件类型为字符串时报错。
40
- // & IfExtends<EmptyObject, SubEventsDoc, {}, { events: SubEventsDoc }>
41
- IfExtends<EmptyObject, CustomCompDoc, never, CustomCompDoc>;
@@ -1,18 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
- import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
3
- import { SubComponent } from "../..";
4
-
5
- type CompDoc = ComponentDoc<{
6
- properties: {
7
- aaa_str: string;
8
- aaa_bool: boolean;
9
- aaa_num?: number;
10
- };
11
- }>;
12
-
13
- const SubDoc = SubComponent<{}, CompDoc>()({});
14
- void SubDoc;
15
- // 返回穿透的自定义事件, 并去除了前缀
16
- type SubDocExpect = "缺少必传的字段aaa_str、aaa_bool";
17
-
18
- Checking<typeof SubDoc, SubDocExpect, Test.Pass>();
@@ -1,98 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-empty-function */
2
- import { Checking, type Test } from "hry-types";
3
- import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
4
- import type {
5
- Bubbles,
6
- BubblesCaptureComposed,
7
- BubblesComposed,
8
- Capture,
9
- CaptureComposed,
10
- } from "../../../RootComponent/CustomEvents/CustomEventsTag";
11
- import { SubComponent } from "../..";
12
-
13
- type CompDoc = ComponentDoc<{
14
- properties: {
15
- aaa_str: string;
16
- };
17
- events: {
18
- aaa_num: number;
19
- aaa_bubbles: number | Bubbles;
20
- aaa_bubblesComposed: number | BubblesComposed;
21
- aaa_captrue: number | Capture;
22
- aaa_captrueComposed: number | CaptureComposed;
23
- aaa_bubblesCaptrueComposed: number | BubblesCaptureComposed;
24
- };
25
- }>;
26
-
27
- const SubDoc = SubComponent<{}, CompDoc>()({
28
- data: {
29
- aaa_str: "string",
30
- },
31
- });
32
- void SubDoc;
33
- // 返回穿透的自定义事件,并去除了前缀
34
- type SubDocExpect = {
35
- composedEvents: {
36
- bubblesComposed: number | BubblesComposed;
37
- captrueComposed: number | CaptureComposed;
38
- bubblesCaptrueComposed: number | BubblesCaptureComposed;
39
- };
40
- // allDatas: {
41
- // aaa_str: "string";
42
- // };
43
- };
44
-
45
- Checking<typeof SubDoc, SubDocExpect, Test.Pass>();
46
- // 去除已经声明的穿透事件
47
- const removeCatchedEvents = SubComponent<{}, CompDoc>()({
48
- data: {
49
- aaa_str: "string",
50
- },
51
- events: {
52
- aaa_bubblesCaptrueComposed_catch() {
53
- },
54
- aaa_bubblesComposed_catch() {
55
- },
56
- aaa_captrueComposed_catch() {
57
- },
58
- },
59
- });
60
- void removeCatchedEvents;
61
- // 返回穿透的自定义事件,并去除了前缀
62
- // type RemoveSubDoc = {
63
- // allDatas: {
64
- // aaa_str: "string";
65
- // };
66
- // events: {
67
- // aaa_bubblesCaptrueComposed_catch(): void;
68
- // aaa_bubblesComposed_catch(): void;
69
- // aaa_captrueComposed_catch(): void;
70
- // };
71
- // };
72
-
73
- Checking<typeof removeCatchedEvents, never, Test.Pass>();
74
- // 去除有后缀时,已经声明的穿透事件
75
- const removeCatchedEventsOfSuffix = SubComponent<{}, CompDoc, "aa">()({
76
- data: {
77
- aaaAa_str: "string",
78
- },
79
- events: {
80
- aaaAa_bubblesCaptrueComposed_catch() {},
81
- aaaAa_bubblesComposed_catch() {},
82
- aaaAa_captrueComposed_catch() {},
83
- },
84
- });
85
- void removeCatchedEventsOfSuffix;
86
- // 返回穿透的自定义事件,并去除了前缀
87
- // type RemoveCatchedEventsOfSuffix = {
88
- // allDatas: {
89
- // aaaAa_str: "string";
90
- // };
91
- // events: {
92
- // aaaAa_bubblesCaptrueComposed_catch(): void;
93
- // aaaAa_bubblesComposed_catch(): void;
94
- // aaaAa_captrueComposed_catch(): void;
95
- // };
96
- // };
97
-
98
- Checking<typeof removeCatchedEventsOfSuffix, never, Test.Pass>();
@@ -1,13 +0,0 @@
1
- import type { AddNullForObject } from "../../../types/AddNullForObject";
2
- import type { Getter } from "../../RootComponent/Store/StoreConstraint";
3
-
4
- /**
5
- * 子组件Data字段约束
6
- * @returns 当剩余对象不为空对象,约束对象的key为剩余key,类型为剩余key对应的文档类型或函数返回类型。
7
- */
8
- export type SubStoreConstraint<
9
- PropertyDoc extends object,
10
- legal extends object,
11
- > = {
12
- [k in keyof legal]?: Getter<PropertyDoc, AddNullForObject<legal[k]> | undefined>;
13
- };
@@ -1,32 +0,0 @@
1
- import type { G } from "hry-types";
2
- import type { Validators } from "../../../types/Validators";
3
-
4
- export type SubStoreOption<TStore extends object, legalKeys extends PropertyKey> = {
5
- /**
6
- * 全局响应式数据字段,全局store对应数据变化实例对应数据自动setData。
7
- * 约束为组件properties字段去除inherit和data的剩余字段和内部字段
8
- * 有非法字段(除了约束字段外的字段)检测
9
- * @example
10
- * ```ts
11
- * {
12
- * //...
13
- * store: {
14
- * aaa_str: () => sroreX.str,
15
- * },
16
- * }
17
- * ```
18
- */
19
- store?:
20
- & TStore
21
- & Validators<
22
- [
23
- G.IllegalFieldValidator<
24
- TStore,
25
- legalKeys,
26
- 0,
27
- "",
28
- "与inherit和data字段重复或前缀错误"
29
- >,
30
- ]
31
- >;
32
- };
@@ -1,60 +0,0 @@
1
- import { observable } from "mobx";
2
-
3
- import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
4
- import { SubComponent } from "../..";
5
- const user = observable({
6
- name: "zhao",
7
- age: 20,
8
- });
9
-
10
- type DocA = ComponentDoc<{
11
- properties: {
12
- aaa_str: string;
13
- aaa_num: number;
14
- };
15
- }>;
16
-
17
- SubComponent<{
18
- properties: {
19
- str: string;
20
- };
21
- }, DocA>()({
22
- inherit: {
23
- aaa_str: "str",
24
- },
25
- data: {
26
- aaa_num: 20,
27
- _aaa_xxx: 30,
28
- },
29
- store: {
30
- // @ts-expect-error 1 与 inherit 字段重复
31
- aaa_str: () => user.name,
32
- // @ts-expect-error 2 与 data 字段重复
33
- aaa_num: () => user.age,
34
- // @ts-expect-error 3 超出约束字段
35
- nu1m: () => user.age,
36
- // @ts-expect-error 4 与data的内部字段重复
37
- _aaa_xxx: () => user.age,
38
- },
39
- });
40
- SubComponent<{
41
- properties: {
42
- aaa_num: number;
43
- };
44
- }, DocA>()({
45
- store: {
46
- // @ts-expect-error 与 root 的 properties 字段重复
47
- aaa_num: () => 123,
48
- },
49
- });
50
- // 类型约束错误
51
- SubComponent<{
52
- properties: {
53
- aaa_num: number;
54
- };
55
- }, DocA>()({
56
- store: {
57
- // @ts-expect-error 返回类型错误
58
- aaa_num: () => "str",
59
- },
60
- });
@@ -1,43 +0,0 @@
1
- import { observable } from "mobx";
2
-
3
- import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
4
- import { SubComponent } from "../..";
5
- const user = observable({
6
- name: "zhao",
7
- age: 20,
8
- isReady: false,
9
- });
10
-
11
- type DocA = ComponentDoc<{
12
- properties: {
13
- aaa_str: string;
14
- aaa_num: number;
15
- };
16
- }>;
17
-
18
- SubComponent<{}, DocA>()({
19
- store: {
20
- // 1 可写文档字段
21
- aaa_str: () => user.name,
22
- aaa_num: () => user.age,
23
- },
24
- });
25
-
26
- SubComponent<{}, DocA, "a">()({
27
- store: {
28
- // 2 可写内部字段
29
- _aaaA_xxx: () => user.age,
30
- },
31
- });
32
- // store中可写 额外字段 isReady
33
- SubComponent<{ data: { _num: number } }, DocA, "a">()({
34
- store: {
35
- aaaA_isReady: () => user.isReady,
36
- },
37
- });
38
- // 4 可以返回undefined,表示该字段不可响应式,不报错,有警告。
39
- SubComponent<{ properties: { num: number } }, DocA, "a">()({
40
- store: {
41
- aaaA_num: (data) => data.num > 10 ? user.age : void 0,
42
- },
43
- });
@@ -1,3 +0,0 @@
1
- import type { WatchOption } from "../../RootComponent/Watch/WatchOption";
2
-
3
- export type SubWatchOption<TWatchData extends object> = WatchOption<TWatchData>;
@@ -1,90 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
- import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
3
- import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
4
- import type { RootComponentDefinition } from "../../../RootComponent/returnType";
5
- import { SubComponent } from "../..";
6
-
7
- type RootDoc = RootComponentDefinition<{
8
- properties: {
9
- obj: Mock_User | null;
10
- };
11
- data: {
12
- num: number;
13
- };
14
- store: {
15
- bool: boolean;
16
- };
17
- }>;
18
-
19
- type CompDoc = ComponentDoc<{
20
- properties: {
21
- aaa_obj: Mock_User | null;
22
- aaa_str: string;
23
- aaa_num: number;
24
- aaa_bool: boolean;
25
- };
26
- }>;
27
-
28
- /**
29
- * watch computed字段时需要手写类型,可悬停鼠标到key查看类型
30
- */
31
- SubComponent<RootDoc, CompDoc>()({
32
- computed: {
33
- aaa_str(): string {
34
- return this.data.aaa_num.toString();
35
- },
36
- aaa_num(): number {
37
- return 123;
38
- },
39
- aaa_bool(): boolean {
40
- return this.data.bool;
41
- },
42
- aaa_obj(): Mock_User {
43
- return {} as Mock_User;
44
- },
45
- },
46
- watch: {
47
- aaa_num(newValue: number, oldValue: number) {
48
- void oldValue;
49
- Checking<number, typeof newValue, Test.Pass>();
50
-
51
- Checking<number, typeof oldValue, Test.Pass>();
52
- },
53
- aaa_str(newValue: string, oldValue: string) {
54
- void oldValue;
55
- Checking<string, typeof newValue, Test.Pass>();
56
-
57
- Checking<string, typeof oldValue, Test.Pass>();
58
- },
59
- aaa_bool(newValue: boolean, oldValue: boolean) {
60
- void oldValue;
61
- Checking<boolean, typeof newValue, Test.Pass>();
62
-
63
- Checking<boolean, typeof oldValue, Test.Pass>();
64
- },
65
- aaa_obj(newValue: Mock_User, oldValue: Mock_User | null) {
66
- void oldValue;
67
- Checking<Mock_User, typeof newValue, Test.Pass>();
68
-
69
- Checking<Mock_User | null, typeof oldValue, Test.Pass>();
70
- },
71
- "aaa_obj.**"(newValue: Mock_User, oldValue: Mock_User | null) {
72
- void oldValue;
73
- Checking<Mock_User, typeof newValue, Test.Pass>();
74
-
75
- Checking<Mock_User | null, typeof oldValue, Test.Pass>();
76
- },
77
- "aaa_obj.id"(newValue: string, oldValue: string) {
78
- void oldValue;
79
- Checking<string, typeof newValue, Test.Pass>();
80
-
81
- Checking<string, typeof oldValue, Test.Pass>();
82
- },
83
- "aaa_obj.age"(newValue: number, oldValue: number) {
84
- void oldValue;
85
- Checking<number, typeof newValue, Test.Pass>();
86
-
87
- Checking<number, typeof oldValue, Test.Pass>();
88
- },
89
- },
90
- });
@@ -1,151 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
- import { type DetailedType, RootComponent, SubComponent } from "../../../..";
3
- import type { OptionalType } from "../../../RootComponent/Properties/PropertiesConstraint";
4
- import {
5
- type Mock_Cart,
6
- mock_requiredTypes,
7
- mock_requiredUnion,
8
- type Mock_User,
9
- } from "../../../RootComponent/Properties/test/normalRequired.test";
10
-
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>, // 可选类型定义null默认值方可为null
30
- value: null,
31
- },
32
- } satisfies Record<string, OptionalType>;
33
-
34
- const rootComponent = RootComponent()({
35
- properties: {
36
- ...mock_requiredTypes,
37
- ...mock_requiredUnion,
38
- ...mock_optional,
39
- },
40
- });
41
-
42
- type Root = typeof rootComponent;
43
- void rootComponent;
44
-
45
- /**
46
- * watch properties字段 深度只读, 必传对象字段newValue去除null
47
- */
48
- SubComponent<Root, { properties: { aaa_num: number } }>()({
49
- watch: {
50
- // 必传单一字段
51
- str(newValue, oldValue) {
52
- void oldValue;
53
- void Checking<string, typeof newValue, Test.Pass>;
54
- void Checking<string, typeof oldValue, Test.Pass>;
55
- },
56
- num(newValue, oldValue) {
57
- void oldValue;
58
- void Checking<number, typeof newValue, Test.Pass>;
59
- void Checking<number, typeof oldValue, Test.Pass>;
60
- },
61
- bool(newValue, oldValue) {
62
- void oldValue;
63
- void Checking<boolean, typeof newValue, Test.Pass>;
64
- void Checking<boolean, typeof oldValue, Test.Pass>;
65
- },
66
-
67
- obj(newValue, oldValue) {
68
- void oldValue;
69
- void Checking<object, typeof newValue, Test.Pass>;
70
- void Checking<object, typeof oldValue, Test.Pass>;
71
- },
72
- tuple(newValue, oldValue) {
73
- void oldValue;
74
- void Checking<[string, number, boolean], typeof newValue, Test.Pass>;
75
- void Checking<[string, number, boolean], typeof oldValue, Test.Pass>;
76
- },
77
- union_str(newValue, oldValue) {
78
- void oldValue;
79
- void Checking<"male" | "female", typeof newValue, Test.Pass>;
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
- void Checking<0 | 1 | 2, typeof oldValue, Test.Pass>;
86
- },
87
- union_bool(newValue, oldValue) {
88
- void oldValue;
89
- void Checking<false | true, typeof newValue, Test.Pass>;
90
- void Checking<false | true, typeof oldValue, Test.Pass>;
91
- },
92
- union_arr(newValue, oldValue) {
93
- void oldValue;
94
- void Checking<number[] | string[], typeof newValue, Test.Pass>;
95
- void Checking<number[] | string[], typeof oldValue, Test.Pass>;
96
- },
97
- union_obj(newValue, oldValue) {
98
- void oldValue;
99
- void Checking<Mock_User | Mock_Cart, typeof newValue, Test.Pass>;
100
- void Checking<Mock_User | Mock_Cart, typeof oldValue, Test.Pass>;
101
- },
102
- // 必传多类型联合
103
- union_str_num_bool(newValue, oldValue) {
104
- void oldValue;
105
- void Checking<string | number | boolean, typeof newValue, Test.Pass>;
106
- void Checking<string | number | boolean, typeof oldValue, Test.Pass>;
107
- },
108
- union_literalStr_Literalnum(newValue, oldValue) {
109
- void oldValue;
110
- void Checking<0 | 1 | 2 | "male" | "female", typeof newValue, Test.Pass>;
111
- void Checking<0 | 1 | 2 | "male" | "female", typeof oldValue, Test.Pass>;
112
- },
113
- union_mockUser_num(newValue, oldValue) {
114
- void oldValue;
115
- void Checking<number | Mock_User, typeof newValue, Test.Pass>;
116
- void Checking<number | Mock_User, typeof oldValue, Test.Pass>;
117
- },
118
- // 可选字段
119
- optional_gender(newValue, oldValue) {
120
- void oldValue;
121
- void Checking<"male" | "female", typeof newValue, Test.Pass>;
122
- void Checking<"male" | "female", typeof oldValue, Test.Pass>;
123
- },
124
- optional_num(newValue, oldValue) {
125
- void oldValue;
126
- void Checking<number, typeof newValue, Test.Pass>;
127
- void Checking<number, typeof oldValue, Test.Pass>;
128
- },
129
- optional_obj(newValue, oldValue) {
130
- void oldValue;
131
- void Checking<Mock_User, typeof newValue, Test.Pass>;
132
- void Checking<Mock_User, typeof oldValue, Test.Pass>;
133
- },
134
- // 对象的二段key
135
- "optional_obj.age"(newValue, oldValue) {
136
- void oldValue;
137
- void Checking<number, typeof newValue, Test.Pass>;
138
- void Checking<number | undefined, typeof oldValue, Test.Pass>;
139
- },
140
- "optional_obj.**"(newValue, oldValue) {
141
- void oldValue;
142
- void Checking<Mock_User, typeof newValue, Test.Pass>;
143
- void Checking<Mock_User, typeof oldValue, Test.Pass>;
144
- },
145
- "optional_obj.id"(newValue, oldValue) {
146
- void oldValue;
147
- void Checking<string, typeof newValue, Test.Pass>;
148
- void Checking<string, typeof oldValue, Test.Pass>;
149
- },
150
- },
151
- });
@@ -1,122 +0,0 @@
1
- import { Checking, type Test } from "hry-types";
2
-
3
- import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
4
-
5
- import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
6
- import { SubComponent } from "../..";
7
-
8
- interface TestObj {
9
- subObj: Mock_User;
10
- }
11
-
12
- type CompDoc = ComponentDoc<{
13
- properties: {
14
- aaa_str: string;
15
- aaa_num: number;
16
- };
17
- }>;
18
-
19
- interface RootDoc {
20
- properties: {
21
- num: number;
22
- literal_num: 123 | 456;
23
- unionStrNum: string | number;
24
- required_obj: Mock_User | null;
25
- optional_obj?: TestObj;
26
- };
27
- data: {
28
- str: string;
29
- literal_str: "a" | "b";
30
- arr: string[];
31
- };
32
- computed: {
33
- Cuinon: string | boolean;
34
- };
35
- }
36
-
37
- /**
38
- * watch RootDoc中的数据字段
39
- */
40
- SubComponent<RootDoc, CompDoc>()({
41
- data: {
42
- aaa_str: "str",
43
- },
44
- store: {
45
- aaa_num() {
46
- return 123;
47
- },
48
- },
49
- watch: {
50
- // properties 字段
51
-
52
- num(newValue, oldValue) {
53
- void oldValue;
54
- void Checking<number, typeof newValue, Test.Pass>;
55
-
56
- void Checking<number, typeof oldValue, Test.Pass>;
57
- },
58
- literal_num(newValue, oldValue) {
59
- void oldValue;
60
- void Checking<123 | 456, typeof newValue, Test.Pass>;
61
-
62
- void Checking<123 | 456, typeof oldValue, Test.Pass>;
63
- },
64
- unionStrNum(newValue, oldValue) {
65
- void oldValue;
66
- void Checking<string | number, typeof newValue, Test.Pass>;
67
-
68
- void Checking<string | number, typeof oldValue, Test.Pass>;
69
- },
70
- required_obj(newValue, oldValue) {
71
- void oldValue;
72
- void Checking<Mock_User | null, typeof newValue, Test.Pass>;
73
-
74
- void Checking<Mock_User | null, typeof oldValue, Test.Pass>;
75
- },
76
- optional_obj(newValue, oldValue) {
77
- void oldValue;
78
- void Checking<TestObj, typeof newValue, Test.Pass>;
79
-
80
- void Checking<TestObj, typeof oldValue, Test.Pass>;
81
- },
82
- "optional_obj.**"(newValue, oldValue) {
83
- void oldValue;
84
- void Checking<TestObj, typeof newValue, Test.Pass>;
85
-
86
- void Checking<TestObj, typeof oldValue, Test.Pass>;
87
- },
88
- "optional_obj.subObj"(newValue, oldValue) {
89
- void oldValue;
90
- void Checking<Mock_User, typeof newValue, Test.Pass>;
91
-
92
- void Checking<Mock_User, typeof oldValue, Test.Pass>;
93
- },
94
-
95
- // data 字段
96
- str(newValue, oldValue) {
97
- void oldValue;
98
- void Checking<string, typeof newValue, Test.Pass>;
99
-
100
- void Checking<string, typeof oldValue, Test.Pass>;
101
- },
102
- arr(newValue, oldValue) {
103
- void oldValue;
104
- void Checking<string[], typeof newValue, Test.Pass>;
105
-
106
- void Checking<string[], typeof oldValue, Test.Pass>;
107
- },
108
-
109
- literal_str(newValue, oldValue) {
110
- void oldValue;
111
- void Checking<"a" | "b", typeof newValue, Test.Pass>;
112
-
113
- void Checking<"a" | "b", typeof oldValue, Test.Pass>;
114
- },
115
- // 计算字段
116
- Cuinon(newValue, oldValue) {
117
- void oldValue;
118
- void Checking<string | boolean, typeof newValue, Test.Pass>;
119
- void Checking<string | boolean, typeof oldValue, Test.Pass>;
120
- },
121
- },
122
- });