annil 1.8.0 → 1.8.2

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 (413) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.d.ts +16 -0
  3. package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.js +2 -0
  4. package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.js.map +1 -0
  5. package/dist/api/DefineComponent/ReturnType/ComponentType.d.ts +18 -0
  6. package/dist/api/DefineComponent/ReturnType/ComponentType.js +2 -0
  7. package/dist/api/DefineComponent/ReturnType/ComponentType.js.map +1 -0
  8. package/dist/api/DefineComponent/ReturnType/CreateComponentDoc.d.ts +19 -0
  9. package/dist/api/DefineComponent/ReturnType/CreateComponentDoc.js +2 -0
  10. package/dist/api/DefineComponent/ReturnType/CreateComponentDoc.js.map +1 -0
  11. package/dist/api/DefineComponent/ReturnType/CreatePageDoc.d.ts +8 -0
  12. package/dist/api/DefineComponent/ReturnType/CreatePageDoc.js +2 -0
  13. package/dist/api/DefineComponent/ReturnType/CreatePageDoc.js.map +1 -0
  14. package/dist/api/DefineComponent/ReturnType/GetCustomEventDocOfSubDoc.d.ts +15 -0
  15. package/dist/api/DefineComponent/ReturnType/GetCustomEventDocOfSubDoc.js +2 -0
  16. package/dist/api/DefineComponent/ReturnType/GetCustomEventDocOfSubDoc.js.map +1 -0
  17. package/dist/api/DefineComponent/ReturnType/PageDoc.d.ts +17 -0
  18. package/dist/api/DefineComponent/ReturnType/PageDoc.js +2 -0
  19. package/dist/api/DefineComponent/ReturnType/PageDoc.js.map +1 -0
  20. package/dist/api/DefineComponent/RootComponent/RootComponentOption.d.ts +10 -0
  21. package/dist/api/DefineComponent/RootComponent/RootComponentOption.js +2 -0
  22. package/dist/api/DefineComponent/RootComponent/RootComponentOption.js.map +1 -0
  23. package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +10 -0
  24. package/dist/api/DefineComponent/SubComponents/SubComponentsOption.js +2 -0
  25. package/dist/api/DefineComponent/SubComponents/SubComponentsOption.js.map +1 -0
  26. package/dist/api/DefineComponent/index.d.ts +23 -0
  27. package/dist/api/DefineComponent/index.js +11 -0
  28. package/dist/api/DefineComponent/index.js.map +1 -0
  29. package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.d.ts +3 -0
  30. package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.js +26 -0
  31. package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.js.map +1 -0
  32. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.d.ts +6 -0
  33. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.js +34 -0
  34. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.js.map +1 -0
  35. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/data-tracer.d.ts +5 -0
  36. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/data-tracer.js +35 -0
  37. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/data-tracer.js.map +1 -0
  38. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/dependencesOptimize.d.ts +3 -0
  39. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/dependencesOptimize.js +28 -0
  40. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/dependencesOptimize.js.map +1 -0
  41. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPathsValue.d.ts +7 -0
  42. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPathsValue.js +30 -0
  43. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPathsValue.js.map +1 -0
  44. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPropertiesValue.d.ts +2 -0
  45. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPropertiesValue.js +44 -0
  46. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/getPropertiesValue.js.map +1 -0
  47. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/index.d.ts +2 -0
  48. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/index.js +60 -0
  49. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/index.js.map +1 -0
  50. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/initComputedAndGetCache.d.ts +21 -0
  51. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/initComputedAndGetCache.js +57 -0
  52. package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/initComputedAndGetCache.js.map +1 -0
  53. package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.d.ts +6 -0
  54. package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js +39 -0
  55. package/dist/api/DefineComponent/normalizeOptions/customEventsHandle.js.map +1 -0
  56. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.d.ts +6 -0
  57. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js +16 -0
  58. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js.map +1 -0
  59. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.d.ts +5 -0
  60. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.js +17 -0
  61. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/isPageCheck.js.map +1 -0
  62. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.d.ts +7 -0
  63. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js +20 -0
  64. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js.map +1 -0
  65. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.d.ts +10 -0
  66. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.js +26 -0
  67. package/dist/api/DefineComponent/normalizeOptions/hijackHandle/onLoadReceivedDataHandle.js.map +1 -0
  68. package/dist/api/DefineComponent/normalizeOptions/index.d.ts +53 -0
  69. package/dist/api/DefineComponent/normalizeOptions/index.js +84 -0
  70. package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -0
  71. package/dist/api/DefineComponent/normalizeOptions/initStore/index.d.ts +2 -0
  72. package/dist/api/DefineComponent/normalizeOptions/initStore/index.js +14 -0
  73. package/dist/api/DefineComponent/normalizeOptions/initStore/index.js.map +1 -0
  74. package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.d.ts +3 -0
  75. package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js +43 -0
  76. package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js.map +1 -0
  77. package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.d.ts +5 -0
  78. package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.js +24 -0
  79. package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.js.map +1 -0
  80. package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.d.ts +6 -0
  81. package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.js +24 -0
  82. package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.js.map +1 -0
  83. package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.d.ts +9 -0
  84. package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.js +19 -0
  85. package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.js.map +1 -0
  86. package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.d.ts +7 -0
  87. package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js +17 -0
  88. package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js.map +1 -0
  89. package/dist/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.d.ts +5 -0
  90. package/dist/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.js +34 -0
  91. package/dist/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.js.map +1 -0
  92. package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.d.ts +3 -0
  93. package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.js +11 -0
  94. package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.js.map +1 -0
  95. package/dist/api/InstanceInject/instanceConfig.d.ts +31 -0
  96. package/dist/api/InstanceInject/instanceConfig.js +17 -0
  97. package/dist/api/InstanceInject/instanceConfig.js.map +1 -0
  98. package/dist/api/RootComponent/Computed/ComputedConstraint.d.ts +4 -0
  99. package/dist/api/RootComponent/Computed/ComputedConstraint.js +2 -0
  100. package/dist/api/RootComponent/Computed/ComputedConstraint.js.map +1 -0
  101. package/dist/api/RootComponent/Computed/ComputedOption.d.ts +28 -0
  102. package/dist/api/RootComponent/Computed/ComputedOption.js +2 -0
  103. package/dist/api/RootComponent/Computed/ComputedOption.js.map +1 -0
  104. package/dist/api/RootComponent/Computed/GetComputedDoc.d.ts +9 -0
  105. package/dist/api/RootComponent/Computed/GetComputedDoc.js +2 -0
  106. package/dist/api/RootComponent/Computed/GetComputedDoc.js.map +1 -0
  107. package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +61 -0
  108. package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.js +2 -0
  109. package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.js.map +1 -0
  110. package/dist/api/RootComponent/CustomEvents/CustomEventsDoc.d.ts +5 -0
  111. package/dist/api/RootComponent/CustomEvents/CustomEventsDoc.js +2 -0
  112. package/dist/api/RootComponent/CustomEvents/CustomEventsDoc.js.map +1 -0
  113. package/dist/api/RootComponent/CustomEvents/CustomEventsOption.d.ts +34 -0
  114. package/dist/api/RootComponent/CustomEvents/CustomEventsOption.js +2 -0
  115. package/dist/api/RootComponent/CustomEvents/CustomEventsOption.js.map +1 -0
  116. package/dist/api/RootComponent/CustomEvents/CustomEventsTag.d.ts +11 -0
  117. package/dist/api/RootComponent/CustomEvents/CustomEventsTag.js +2 -0
  118. package/dist/api/RootComponent/CustomEvents/CustomEventsTag.js.map +1 -0
  119. package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +23 -0
  120. package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.js +2 -0
  121. package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.js.map +1 -0
  122. package/dist/api/RootComponent/Data/DataConstraint.d.ts +1 -0
  123. package/dist/api/RootComponent/Data/DataConstraint.js +2 -0
  124. package/dist/api/RootComponent/Data/DataConstraint.js.map +1 -0
  125. package/dist/api/RootComponent/Data/DataOption.d.ts +18 -0
  126. package/dist/api/RootComponent/Data/DataOption.js +2 -0
  127. package/dist/api/RootComponent/Data/DataOption.js.map +1 -0
  128. package/dist/api/RootComponent/Events/EventsConstraint.d.ts +20 -0
  129. package/dist/api/RootComponent/Events/EventsConstraint.js +2 -0
  130. package/dist/api/RootComponent/Events/EventsConstraint.js.map +1 -0
  131. package/dist/api/RootComponent/Events/EventsOption.d.ts +55 -0
  132. package/dist/api/RootComponent/Events/EventsOption.js +2 -0
  133. package/dist/api/RootComponent/Events/EventsOption.js.map +1 -0
  134. package/dist/api/RootComponent/Instance/CustomEventMethods.d.ts +5 -0
  135. package/dist/api/RootComponent/Instance/CustomEventMethods.js +2 -0
  136. package/dist/api/RootComponent/Instance/CustomEventMethods.js.map +1 -0
  137. package/dist/api/RootComponent/Instance/CustomSetData.d.ts +13 -0
  138. package/dist/api/RootComponent/Instance/CustomSetData.js +2 -0
  139. package/dist/api/RootComponent/Instance/CustomSetData.js.map +1 -0
  140. package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +27 -0
  141. package/dist/api/RootComponent/Instance/RootComponentInstance.js +2 -0
  142. package/dist/api/RootComponent/Instance/RootComponentInstance.js.map +1 -0
  143. package/dist/api/RootComponent/IsPage/IsPageOption.d.ts +6 -0
  144. package/dist/api/RootComponent/IsPage/IsPageOption.js +2 -0
  145. package/dist/api/RootComponent/IsPage/IsPageOption.js.map +1 -0
  146. package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.d.ts +9 -0
  147. package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.js +2 -0
  148. package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.js.map +1 -0
  149. package/dist/api/RootComponent/Lifetimes/LifetimesOption.d.ts +30 -0
  150. package/dist/api/RootComponent/Lifetimes/LifetimesOption.js +2 -0
  151. package/dist/api/RootComponent/Lifetimes/LifetimesOption.js.map +1 -0
  152. package/dist/api/RootComponent/Methods/MethodsConstraint.d.ts +2 -0
  153. package/dist/api/RootComponent/Methods/MethodsConstraint.js +2 -0
  154. package/dist/api/RootComponent/Methods/MethodsConstraint.js.map +1 -0
  155. package/dist/api/RootComponent/Methods/MethodsOption.d.ts +8 -0
  156. package/dist/api/RootComponent/Methods/MethodsOption.js +2 -0
  157. package/dist/api/RootComponent/Methods/MethodsOption.js.map +1 -0
  158. package/dist/api/RootComponent/Observers/ObserversOption.d.ts +23 -0
  159. package/dist/api/RootComponent/Observers/ObserversOption.js +2 -0
  160. package/dist/api/RootComponent/Observers/ObserversOption.js.map +1 -0
  161. package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +25 -0
  162. package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.js +2 -0
  163. package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.js.map +1 -0
  164. package/dist/api/RootComponent/Properties/GetOptionalDoc.d.ts +10 -0
  165. package/dist/api/RootComponent/Properties/GetOptionalDoc.js +2 -0
  166. package/dist/api/RootComponent/Properties/GetOptionalDoc.js.map +1 -0
  167. package/dist/api/RootComponent/Properties/GetPropertiesDoc.d.ts +12 -0
  168. package/dist/api/RootComponent/Properties/GetPropertiesDoc.js +2 -0
  169. package/dist/api/RootComponent/Properties/GetPropertiesDoc.js.map +1 -0
  170. package/dist/api/RootComponent/Properties/GetRequiredDoc.d.ts +11 -0
  171. package/dist/api/RootComponent/Properties/GetRequiredDoc.js +2 -0
  172. package/dist/api/RootComponent/Properties/GetRequiredDoc.js.map +1 -0
  173. package/dist/api/RootComponent/Properties/PropertiesConstraint.d.ts +32 -0
  174. package/dist/api/RootComponent/Properties/PropertiesConstraint.js +2 -0
  175. package/dist/api/RootComponent/Properties/PropertiesConstraint.js.map +1 -0
  176. package/dist/api/RootComponent/Properties/PropertiesOption.d.ts +20 -0
  177. package/dist/api/RootComponent/Properties/PropertiesOption.js +2 -0
  178. package/dist/api/RootComponent/Properties/PropertiesOption.js.map +1 -0
  179. package/dist/api/RootComponent/Properties/PropertiesValueValidator.d.ts +15 -0
  180. package/dist/api/RootComponent/Properties/PropertiesValueValidator.js +2 -0
  181. package/dist/api/RootComponent/Properties/PropertiesValueValidator.js.map +1 -0
  182. package/dist/api/RootComponent/RootComponentType.d.ts +42 -0
  183. package/dist/api/RootComponent/RootComponentType.js +2 -0
  184. package/dist/api/RootComponent/RootComponentType.js.map +1 -0
  185. package/dist/api/RootComponent/Store/GeTStoreDoc.d.ts +4 -0
  186. package/dist/api/RootComponent/Store/GeTStoreDoc.js +2 -0
  187. package/dist/api/RootComponent/Store/GeTStoreDoc.js.map +1 -0
  188. package/dist/api/RootComponent/Store/StoreConstraint.d.ts +1 -0
  189. package/dist/api/RootComponent/Store/StoreConstraint.js +2 -0
  190. package/dist/api/RootComponent/Store/StoreConstraint.js.map +1 -0
  191. package/dist/api/RootComponent/Store/StoreOption.d.ts +17 -0
  192. package/dist/api/RootComponent/Store/StoreOption.js +2 -0
  193. package/dist/api/RootComponent/Store/StoreOption.js.map +1 -0
  194. package/dist/api/RootComponent/Watch/WatchOption.d.ts +23 -0
  195. package/dist/api/RootComponent/Watch/WatchOption.js +2 -0
  196. package/dist/api/RootComponent/Watch/WatchOption.js.map +1 -0
  197. package/dist/api/RootComponent/index.d.ts +71 -0
  198. package/dist/api/RootComponent/index.js +5 -0
  199. package/dist/api/RootComponent/index.js.map +1 -0
  200. package/dist/api/SubComponent/SubComponentType.d.ts +17 -0
  201. package/dist/api/SubComponent/SubComponentType.js +2 -0
  202. package/dist/api/SubComponent/SubComponentType.js.map +1 -0
  203. package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.d.ts +3 -0
  204. package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js +2 -0
  205. package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js.map +1 -0
  206. package/dist/api/SubComponent/SubComputed/SubComputedConstraint.d.ts +3 -0
  207. package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js +2 -0
  208. package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js.map +1 -0
  209. package/dist/api/SubComponent/SubComputed/SubComputedOption.d.ts +4 -0
  210. package/dist/api/SubComponent/SubComputed/SubComputedOption.js +2 -0
  211. package/dist/api/SubComponent/SubComputed/SubComputedOption.js.map +1 -0
  212. package/dist/api/SubComponent/SubData/SubDataConstraint.d.ts +7 -0
  213. package/dist/api/SubComponent/SubData/SubDataConstraint.js +2 -0
  214. package/dist/api/SubComponent/SubData/SubDataConstraint.js.map +1 -0
  215. package/dist/api/SubComponent/SubData/SubDataOption.d.ts +8 -0
  216. package/dist/api/SubComponent/SubData/SubDataOption.js +2 -0
  217. package/dist/api/SubComponent/SubData/SubDataOption.js.map +1 -0
  218. package/dist/api/SubComponent/SubEvents/SubEventsConstraint.d.ts +11 -0
  219. package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js +2 -0
  220. package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js.map +1 -0
  221. package/dist/api/SubComponent/SubEvents/SubEventsOptions.d.ts +9 -0
  222. package/dist/api/SubComponent/SubEvents/SubEventsOptions.js +2 -0
  223. package/dist/api/SubComponent/SubEvents/SubEventsOptions.js.map +1 -0
  224. package/dist/api/SubComponent/SubInherit/SubInheritConstraint.d.ts +13 -0
  225. package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js +2 -0
  226. package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js.map +1 -0
  227. package/dist/api/SubComponent/SubInherit/SubInheritOption.d.ts +9 -0
  228. package/dist/api/SubComponent/SubInherit/SubInheritOption.js +2 -0
  229. package/dist/api/SubComponent/SubInherit/SubInheritOption.js.map +1 -0
  230. package/dist/api/SubComponent/SubInstance/SubInstance.d.ts +2 -0
  231. package/dist/api/SubComponent/SubInstance/SubInstance.js +2 -0
  232. package/dist/api/SubComponent/SubInstance/SubInstance.js.map +1 -0
  233. package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.d.ts +2 -0
  234. package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js +2 -0
  235. package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js.map +1 -0
  236. package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.d.ts +2 -0
  237. package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js +2 -0
  238. package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js.map +1 -0
  239. package/dist/api/SubComponent/SubMethods/SubMethodsOption.d.ts +9 -0
  240. package/dist/api/SubComponent/SubMethods/SubMethodsOption.js +2 -0
  241. package/dist/api/SubComponent/SubMethods/SubMethodsOption.js.map +1 -0
  242. package/dist/api/SubComponent/SubObservers/SubObserversOption.d.ts +2 -0
  243. package/dist/api/SubComponent/SubObservers/SubObserversOption.js +2 -0
  244. package/dist/api/SubComponent/SubObservers/SubObserversOption.js.map +1 -0
  245. package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.d.ts +2 -0
  246. package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js +2 -0
  247. package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js.map +1 -0
  248. package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.d.ts +12 -0
  249. package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js +2 -0
  250. package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js.map +1 -0
  251. package/dist/api/SubComponent/SubStore/SubStoreConstraint.d.ts +7 -0
  252. package/dist/api/SubComponent/SubStore/SubStoreConstraint.js +2 -0
  253. package/dist/api/SubComponent/SubStore/SubStoreConstraint.js.map +1 -0
  254. package/dist/api/SubComponent/SubStore/SubStoreOption.d.ts +18 -0
  255. package/dist/api/SubComponent/SubStore/SubStoreOption.js +2 -0
  256. package/dist/api/SubComponent/SubStore/SubStoreOption.js.map +1 -0
  257. package/dist/api/SubComponent/SubWatch/SubWatchOption.d.ts +2 -0
  258. package/dist/api/SubComponent/SubWatch/SubWatchOption.js +2 -0
  259. package/dist/api/SubComponent/SubWatch/SubWatchOption.js.map +1 -0
  260. package/dist/api/SubComponent/index.d.ts +63 -0
  261. package/dist/api/SubComponent/index.js +9 -0
  262. package/dist/api/SubComponent/index.js.map +1 -0
  263. package/dist/api/navigateTo.d.ts +20 -0
  264. package/dist/api/navigateTo.js +27 -0
  265. package/dist/api/navigateTo.js.map +1 -0
  266. package/dist/behaviors/BStore.d.ts +5 -0
  267. package/dist/behaviors/BStore.js +51 -0
  268. package/dist/behaviors/BStore.js.map +1 -0
  269. package/dist/behaviors/BbeforeCreated.d.ts +4 -0
  270. package/dist/behaviors/BbeforeCreated.js +14 -0
  271. package/dist/behaviors/BbeforeCreated.js.map +1 -0
  272. package/dist/behaviors/BthrottleDebounce.d.ts +1 -0
  273. package/dist/behaviors/BthrottleDebounce.js +27 -0
  274. package/dist/behaviors/BthrottleDebounce.js.map +1 -0
  275. package/dist/index.d.ts +14 -0
  276. package/dist/index.js +8 -0
  277. package/dist/index.js.map +1 -0
  278. package/dist/thirdLib/index.d.ts +3 -0
  279. package/dist/thirdLib/index.js +2 -0
  280. package/dist/thirdLib/index.js.map +1 -0
  281. package/dist/thirdLib/vant/Button.d.ts +21 -0
  282. package/dist/thirdLib/vant/Button.js +2 -0
  283. package/dist/thirdLib/vant/Button.js.map +1 -0
  284. package/dist/thirdLib/vant/NoticeBar.d.ts +23 -0
  285. package/dist/thirdLib/vant/NoticeBar.js +2 -0
  286. package/dist/thirdLib/vant/NoticeBar.js.map +1 -0
  287. package/dist/thirdLib/vant/Popup.d.ts +65 -0
  288. package/dist/thirdLib/vant/Popup.js +2 -0
  289. package/dist/thirdLib/vant/Popup.js.map +1 -0
  290. package/dist/thirdLib/vant/index.d.ts +3 -0
  291. package/dist/thirdLib/vant/index.js +2 -0
  292. package/dist/thirdLib/vant/index.js.map +1 -0
  293. package/dist/thirdLib/wm/Textarea.d.ts +28 -0
  294. package/dist/thirdLib/wm/Textarea.js +2 -0
  295. package/dist/thirdLib/wm/Textarea.js.map +1 -0
  296. package/dist/thirdLib/wm/baseEvents.d.ts +53 -0
  297. package/dist/thirdLib/wm/baseEvents.js +2 -0
  298. package/dist/thirdLib/wm/baseEvents.js.map +1 -0
  299. package/dist/thirdLib/wm/index.d.ts +4 -0
  300. package/dist/thirdLib/wm/index.js +2 -0
  301. package/dist/thirdLib/wm/index.js.map +1 -0
  302. package/dist/thirdLib/wm/scrollView.d.ts +58 -0
  303. package/dist/thirdLib/wm/scrollView.js +8 -0
  304. package/dist/thirdLib/wm/scrollView.js.map +1 -0
  305. package/dist/thirdLib/wm/swiper.d.ts +109 -0
  306. package/dist/thirdLib/wm/swiper.js +2 -0
  307. package/dist/thirdLib/wm/swiper.js.map +1 -0
  308. package/dist/thirdLib/wm/view.d.ts +27 -0
  309. package/dist/thirdLib/wm/view.js +2 -0
  310. package/dist/thirdLib/wm/view.js.map +1 -0
  311. package/dist/types/AddNullForObject.d.ts +5 -0
  312. package/dist/types/AddNullForObject.js +2 -0
  313. package/dist/types/AddNullForObject.js.map +1 -0
  314. package/dist/types/AddPrefix.d.ts +10 -0
  315. package/dist/types/AddPrefix.js +2 -0
  316. package/dist/types/AddPrefix.js.map +1 -0
  317. package/dist/types/Assign.d.ts +1 -0
  318. package/dist/types/Assign.js +2 -0
  319. package/dist/types/Assign.js.map +1 -0
  320. package/dist/types/ComputeObj.d.ts +3 -0
  321. package/dist/types/ComputeObj.js +2 -0
  322. package/dist/types/ComputeObj.js.map +1 -0
  323. package/dist/types/CreateComponentType.d.ts +30 -0
  324. package/dist/types/CreateComponentType.js +2 -0
  325. package/dist/types/CreateComponentType.js.map +1 -0
  326. package/dist/types/DetailedType.d.ts +15 -0
  327. package/dist/types/DetailedType.js +2 -0
  328. package/dist/types/DetailedType.js.map +1 -0
  329. package/dist/types/ExtendComponentType.d.ts +34 -0
  330. package/dist/types/ExtendComponentType.js +6 -0
  331. package/dist/types/ExtendComponentType.js.map +1 -0
  332. package/dist/types/GetComponentPrefix.d.ts +7 -0
  333. package/dist/types/GetComponentPrefix.js +12 -0
  334. package/dist/types/GetComponentPrefix.js.map +1 -0
  335. package/dist/types/InferDetailedType.d.ts +5 -0
  336. package/dist/types/InferDetailedType.js +2 -0
  337. package/dist/types/InferDetailedType.js.map +1 -0
  338. package/dist/types/InnerData.d.ts +1 -0
  339. package/dist/types/InnerData.js +2 -0
  340. package/dist/types/InnerData.js.map +1 -0
  341. package/dist/types/OfficialTypeAlias.d.ts +33 -0
  342. package/dist/types/OfficialTypeAlias.js +32 -0
  343. package/dist/types/OfficialTypeAlias.js.map +1 -0
  344. package/dist/types/RemoveInnerData.d.ts +4 -0
  345. package/dist/types/RemoveInnerData.js +2 -0
  346. package/dist/types/RemoveInnerData.js.map +1 -0
  347. package/dist/types/RemoveNullOfRequired.d.ts +7 -0
  348. package/dist/types/RemoveNullOfRequired.js +2 -0
  349. package/dist/types/RemoveNullOfRequired.js.map +1 -0
  350. package/dist/types/RemovePrefix.d.ts +3 -0
  351. package/dist/types/RemovePrefix.js +2 -0
  352. package/dist/types/RemovePrefix.js.map +1 -0
  353. package/dist/types/Replace.d.ts +19 -0
  354. package/dist/types/Replace.js +2 -0
  355. package/dist/types/Replace.js.map +1 -0
  356. package/dist/types/ReplacePrefix.d.ts +16 -0
  357. package/dist/types/ReplacePrefix.js +11 -0
  358. package/dist/types/ReplacePrefix.js.map +1 -0
  359. package/dist/types/RequiredKeys.d.ts +7 -0
  360. package/dist/types/RequiredKeys.js +2 -0
  361. package/dist/types/RequiredKeys.js.map +1 -0
  362. package/dist/types/TwoParamsEqual.d.ts +2 -0
  363. package/dist/types/TwoParamsEqual.js +2 -0
  364. package/dist/types/TwoParamsEqual.js.map +1 -0
  365. package/dist/types/UnionToComma.test.d.ts +5 -0
  366. package/dist/types/UnionToComma.test.js +2 -0
  367. package/dist/types/UnionToComma.test.js.map +1 -0
  368. package/dist/types/Validators.d.ts +1 -0
  369. package/dist/types/Validators.js +9 -0
  370. package/dist/types/Validators.js.map +1 -0
  371. package/dist/types/includes.d.ts +1 -0
  372. package/dist/types/includes.js +2 -0
  373. package/dist/types/includes.js.map +1 -0
  374. package/dist/utils/InnerMarker.d.ts +3 -0
  375. package/dist/utils/InnerMarker.js +4 -0
  376. package/dist/utils/InnerMarker.js.map +1 -0
  377. package/dist/utils/_utils.d.ts +7 -0
  378. package/dist/utils/_utils.js +8 -0
  379. package/dist/utils/_utils.js.map +1 -0
  380. package/dist/utils/assertNonNullable.d.ts +7 -0
  381. package/dist/utils/assertNonNullable.js +13 -0
  382. package/dist/utils/assertNonNullable.js.map +1 -0
  383. package/dist/utils/debounce.d.ts +9 -0
  384. package/dist/utils/debounce.js +19 -0
  385. package/dist/utils/debounce.js.map +1 -0
  386. package/dist/utils/deepClone.d.ts +4 -0
  387. package/dist/utils/deepClone.js +17 -0
  388. package/dist/utils/deepClone.js.map +1 -0
  389. package/dist/utils/deepEqual.d.ts +1 -0
  390. package/dist/utils/deepEqual.js +28 -0
  391. package/dist/utils/deepEqual.js.map +1 -0
  392. package/dist/utils/isEmptyObject.d.ts +5 -0
  393. package/dist/utils/isEmptyObject.js +12 -0
  394. package/dist/utils/isEmptyObject.js.map +1 -0
  395. package/dist/utils/throttle.d.ts +10 -0
  396. package/dist/utils/throttle.js +18 -0
  397. package/dist/utils/throttle.js.map +1 -0
  398. package/package.json +5 -8
  399. package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +27 -0
  400. package/src/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.ts +3 -4
  401. package/src/api/DefineComponent/normalizeOptions/computedWatchHandle/data-tracer.ts +7 -13
  402. package/src/api/DefineComponent/normalizeOptions/computedWatchHandle/getPropertiesValue.ts +2 -4
  403. package/src/api/DefineComponent/normalizeOptions/computedWatchHandle/initComputedAndGetCache.ts +2 -2
  404. package/src/api/DefineComponent/normalizeOptions/customEventsHandle.ts +1 -0
  405. package/src/api/DefineComponent/normalizeOptions/index.ts +6 -0
  406. package/src/api/DefineComponent/normalizeOptions/internalFieldProtection.ts +1 -1
  407. package/src/api/DefineComponent/normalizeOptions/sameFuncOptionsHandle.ts +2 -2
  408. package/src/api/SubComponent/SubComponentType.ts +2 -1
  409. package/src/utils/assertNonNullable.ts +5 -0
  410. package/src/utils/debounce.ts +4 -4
  411. package/src/utils/deepClone.ts +2 -2
  412. package/src/utils/deepEqual.ts +8 -9
  413. package/src/utils/isEmptyObject.ts +6 -5
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  * 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
6
6
 
7
+ ## [1.8.2](https://github.com/missannil/annil/compare/v1.8.1...v1.8.2) (2024-09-07)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * 优化_SubComponentType类型,避免接口或类的类型由于无签名照成的报错 ([ab97097](https://github.com/missannil/annil/commit/ab970972717b08138c8438825a1e19f7e3dd7c38))
13
+
14
+ ## [1.8.1](https://github.com/missannil/annil/compare/v1.8.0...v1.8.1) (2024-09-07)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * 1.8.0发布问题,加入throttleDebounce测试用例,优化computed,提高覆盖率,依赖优化 ([67cfc49](https://github.com/missannil/annil/commit/67cfc4909acce7f5d4fe2d58b2d3b1d54b81163e))
20
+
7
21
  ## [1.8.0](https://github.com/missannil/annil/compare/v1.7.8...v1.8.0) (2024-09-06)
8
22
 
9
23
 
@@ -0,0 +1,16 @@
1
+ import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
+ import type { Includes } from "../../../types/includes";
3
+ /**
4
+ * 根据IsPage,生成name或path字段
5
+ */
6
+ export type NameOrPathOption<TName extends string, TPath extends `/${string}`, IsPage extends boolean> = IsPage extends true ? {
7
+ /**
8
+ * 页面路径已'/'开头
9
+ */
10
+ path: TPath;
11
+ } : {
12
+ /**
13
+ * 组件名不可为空串和含有下划线
14
+ */
15
+ name: TName & IfExtends<TName, "", () => "⚠️组件名不可为空⚠️", IfExtends<Includes<TName, "_">, true, () => "⚠️组件名不可包含下划线 _ ⚠️", unknown>>;
16
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NameOrPathOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NameOrPathOption.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/NameOrPage/NameOrPathOption.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ type PrefixKeys = `${string}_${string}`;
2
+ type _ComponentType = {
3
+ properties?: Record<PrefixKeys, unknown>;
4
+ customEvents?: Record<PrefixKeys, unknown>;
5
+ };
6
+ type Error = "{ properties?: Record<PrefixKeys, any>; customEvents?: Record<PrefixKeys, any>;}";
7
+ type _Validator<O> = keyof O extends keyof _ComponentType ? keyof (O["properties"] & O["customEvents"]) extends PrefixKeys ? _ComponentType : Error : Error;
8
+ /**
9
+ * RootComponent Api 返回的类型
10
+ * ```ts
11
+ * RootComponentDoc = {
12
+ * properties?: Record<PrefixKeys, any>;
13
+ * customEvents?: Record<PrefixKeys, any>;
14
+ * };
15
+ * ```
16
+ */
17
+ export type ComponentType<O extends _Validator<O> = _ComponentType> = O;
18
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ComponentType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentType.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/ReturnType/ComponentType.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
+ import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
3
+ import type { AddNullForObject } from "../../../types/AddNullForObject";
4
+ import type { RootComponentType } from "../../RootComponent/RootComponentType";
5
+ import type { SubComponentType } from "../../SubComponent/SubComponentType";
6
+ import type { GetCustomEventDocOfSubDoc } from "./GetCustomEventDocOfSubDoc";
7
+ type GetStopKeys<O> = {
8
+ [k in keyof O]: k extends `${string}_${infer Key}_${string}_catch` ? Key : never;
9
+ }[keyof O];
10
+ export type CreateComponentDoc<TRootDoc extends RootComponentType, TName extends string, TSubComponentTuple extends SubComponentType[], AllPropertiesDoc extends unknown | object = TRootDoc["properties"], AllCustomEventsDoc extends unknown | object = TRootDoc["customEvents"] & GetCustomEventDocOfSubDoc<TSubComponentTuple[number]>, StopKeys extends string = GetStopKeys<TRootDoc["events"]>, FinalCustomEventDoc extends object = Omit<AllCustomEventsDoc, StopKeys>> = ComputeIntersection<IfExtends<unknown, AllPropertiesDoc, {}, {
11
+ properties: {
12
+ [k in keyof AllPropertiesDoc as `${TName}_${k & string}`]: AddNullForObject<AllPropertiesDoc[k]>;
13
+ };
14
+ }> & IfExtends<{}, FinalCustomEventDoc, {}, {
15
+ customEvents: {
16
+ [k in keyof FinalCustomEventDoc as `${TName}_${k & string}`]: FinalCustomEventDoc[k];
17
+ };
18
+ }>>;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CreateComponentDoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateComponentDoc.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/ReturnType/CreateComponentDoc.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
+ import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
3
+ import type { RootComponentType } from "../../RootComponent/RootComponentType";
4
+ export type CreatePageDoc<TRootDoc extends RootComponentType, TPath extends string> = ComputeIntersection<{
5
+ path: TPath;
6
+ } & IfExtends<unknown, TRootDoc["properties"], unknown, {
7
+ properties: TRootDoc["properties"];
8
+ }>>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CreatePageDoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreatePageDoc.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/ReturnType/CreatePageDoc.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { IsNever, IsUnion } from "hry-types/src/Any/_api";
2
+ import type { UnionTwoObject } from "hry-types/src/Object/UnionTwoObject";
3
+ import type { Last } from "hry-types/src/Union/Last";
4
+ import type { SubComponentType } from "../../SubComponent/SubComponentType";
5
+ /**
6
+ * 因为子组件文档customEvents字段有可能相同(无前缀),所以使用UnionTwoObject
7
+ * 由于SubComponentDoc为空时返回never而不`{}`,所以`Exclude<U, TLast>`不影响结果。
8
+ */
9
+ type _GetCustomEventDocOfSubDoc<U extends SubComponentType, Result = {}, TLast = Last<U>> = IsNever<U> extends true ? Result : _GetCustomEventDocOfSubDoc<Exclude<U, TLast>, UnionTwoObject<Result, TLast>>;
10
+ /**
11
+ * 获取子组件自定义事件文档
12
+ * @remarks U 中 相同字段类型联合,所以使用元组推导不如Last性能好。
13
+ */
14
+ export type GetCustomEventDocOfSubDoc<UnionSubDoc extends SubComponentType> = IsUnion<UnionSubDoc> extends true ? _GetCustomEventDocOfSubDoc<UnionSubDoc> : UnionSubDoc;
15
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GetCustomEventDocOfSubDoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetCustomEventDocOfSubDoc.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/ReturnType/GetCustomEventDocOfSubDoc.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ type _PageDoc = {
2
+ path: `/${string}`;
3
+ properties?: object;
4
+ };
5
+ type Error = "{ path: `/${string}`; properties?: object;}";
6
+ type _Validator<O> = keyof O extends keyof _PageDoc ? _PageDoc : Error;
7
+ /**
8
+ * 页面文档类型
9
+ * ```ts
10
+ * PageDoc = {
11
+ * path: `/${string}`;
12
+ * properties?: object;
13
+ * };
14
+ * ```
15
+ */
16
+ export type PageDoc<O extends _Validator<O> = _PageDoc> = O;
17
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PageDoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageDoc.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/ReturnType/PageDoc.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { RootComponentType } from "../../RootComponent/RootComponentType";
2
+ /**
3
+ * DefineComponent API`rootComponent`字段配置
4
+ */
5
+ export type RootComponentOption<TRootComponent extends RootComponentType> = {
6
+ /**
7
+ * 根组件配置
8
+ */
9
+ rootComponent?: TRootComponent;
10
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RootComponentOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootComponentOption.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/RootComponent/RootComponentOption.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { SubComponentType } from "../../SubComponent/SubComponentType";
2
+ /**
3
+ * RootComponent API 的`subComponents`字段配置
4
+ */
5
+ export type SubComponentsOption<TSubComponentTuple extends SubComponentType[]> = {
6
+ /**
7
+ * 子组件列表
8
+ */
9
+ subComponents?: [...TSubComponentTuple];
10
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SubComponentsOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubComponentsOption.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/SubComponents/SubComponentsOption.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
+ import type { RootComponentTrueOptions } from "../RootComponent";
3
+ import type { RootComponentType } from "../RootComponent/RootComponentType";
4
+ import type { SubComponentType } from "../SubComponent/SubComponentType";
5
+ import type { NameOrPathOption } from "./NameOrPage/NameOrPathOption";
6
+ import type { CreateComponentDoc } from "./ReturnType/CreateComponentDoc";
7
+ import type { CreatePageDoc } from "./ReturnType/CreatePageDoc";
8
+ import type { RootComponentOption } from "./RootComponent/RootComponentOption";
9
+ import type { SubComponentsOption } from "./SubComponents/SubComponentsOption";
10
+ export type Path = `/${string}`;
11
+ type RootOptions<TRootComponentDoc extends RootComponentType, TSubComponentTuple extends SubComponentType[], TName extends string, TPath extends Path> = NameOrPathOption<TName, TPath, TRootComponentDoc["isPage"] & {}> & RootComponentOption<TRootComponentDoc> & SubComponentsOption<TSubComponentTuple>;
12
+ type DefineComponentConstructor = <TRootComponentDoc extends RootComponentType = {}, TSubComponentTuple extends SubComponentType[] = [], TName extends string = "", TPath extends Path = "/">(options: RootOptions<TRootComponentDoc, TSubComponentTuple, TName, TPath>) => IfExtends<"", TName, CreatePageDoc<TRootComponentDoc, TPath>, CreateComponentDoc<TRootComponentDoc, TName, TSubComponentTuple>>;
13
+ export type DefineComponentOption = {
14
+ name?: string;
15
+ path?: string;
16
+ rootComponent?: RootComponentTrueOptions;
17
+ subComponents?: SubComponentType[];
18
+ };
19
+ /**
20
+ * 把根组件选项和子组件选项转化为原生Component API选项并执行
21
+ */
22
+ export declare const DefineComponent: DefineComponentConstructor;
23
+ export {};
@@ -0,0 +1,11 @@
1
+ import { normalizeOptions } from "./normalizeOptions";
2
+ /**
3
+ * 把根组件选项和子组件选项转化为原生Component API选项并执行
4
+ */
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ export const DefineComponent = function (options) {
7
+ Component(
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ normalizeOptions(options));
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAyCtD;;GAEG;AACH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAA+B,UAAS,OAAO;IACzE,SAAS;IACP,8DAA8D;IAC9D,gBAAgB,CAAC,OAAgC,CAAQ,CAC1D,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RootComponentTrueOptions } from "../../RootComponent";
2
+ import type { SubComponentType } from "../../SubComponent/SubComponentType";
3
+ export declare function __throttleDebounce__FieldCheck(config: RootComponentTrueOptions | SubComponentType[]): void;
@@ -0,0 +1,26 @@
1
+ export function __throttleDebounce__FieldCheck(config) {
2
+ if (Array.isArray(config)) {
3
+ for (const subComponent of config) {
4
+ __throttleDebounce__FieldCheck(subComponent);
5
+ }
6
+ }
7
+ else {
8
+ const dataKeys = [];
9
+ if (config.data) {
10
+ dataKeys.push(...Object.keys(config.data));
11
+ }
12
+ if (config.computed) {
13
+ dataKeys.push(...Object.keys(config.computed));
14
+ }
15
+ if (config.properties) {
16
+ dataKeys.push(...Object.keys(config.properties));
17
+ }
18
+ if (config.store) {
19
+ dataKeys.push(...Object.keys(config.store));
20
+ }
21
+ if (dataKeys.includes("__throttleDebounce__")) {
22
+ throw Error(`__throttleDebounce__字段已被内部字段占用`);
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=__throttleDebounce__FieldCheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__throttleDebounce__FieldCheck.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,8BAA8B,CAAC,MAAqD;IAClG,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,KAAK,MAAM,YAAY,IAAI,MAAM,EAAE,CAAC;YAClC,8BAA8B,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAC9C,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Instance } from "../../../RootComponent/Instance/RootComponentInstance";
2
+ export type ComputedDependence = {
3
+ paths: string[];
4
+ val: unknown;
5
+ };
6
+ export declare function computedUpdater(this: Instance, isUpdated?: boolean): boolean;
@@ -0,0 +1,34 @@
1
+ import { deepEqual } from "../../../../utils/deepEqual";
2
+ import { deepProxy, getOriginalValue } from "./data-tracer";
3
+ import { removeSubDependences } from "./dependencesOptimize";
4
+ import { getPathsValue } from "./getPathsValue";
5
+ export function computedUpdater(isUpdated = false) {
6
+ for (const key in this.data.__computedCache__) {
7
+ const itemCache = this.data.__computedCache__[key];
8
+ let changed = false;
9
+ for (const dep of itemCache.dependences) {
10
+ // getPathsValue返回的是数组
11
+ const curVal = getPathsValue(this.data, dep.paths.join("."))[0];
12
+ // 检查依赖是否改变了
13
+ if (!deepEqual(curVal, dep.val)) {
14
+ changed = true;
15
+ break;
16
+ }
17
+ }
18
+ if (changed) {
19
+ const newDependences = [];
20
+ const newValue = itemCache.method.call({ data: deepProxy(this.data, newDependences) });
21
+ // 更新值不会立即再次进入**函数,而是当前**函数运行完毕后触发**函数,\
22
+ this.setData({
23
+ [key]: getOriginalValue(newValue),
24
+ });
25
+ isUpdated = true;
26
+ // 更新依赖(优化)
27
+ this.data.__computedCache__[key].dependences = removeSubDependences(newDependences);
28
+ // 有一个计算属性更新就重新更新所有计算互相,避免后置依赖导致前置依赖错误
29
+ return computedUpdater.call(this, isUpdated);
30
+ }
31
+ }
32
+ return isUpdated;
33
+ }
34
+ //# sourceMappingURL=computedUpdater.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computedUpdater.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,UAAU,eAAe,CAAiB,SAAS,GAAG,KAAK;IAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YACxC,sBAAsB;YACtB,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAEhE,YAAY;YACZ,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,OAAO,GAAG,IAAI,CAAC;gBAEf,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,cAAc,GAAyB,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;YACvF,wCAAwC;YACxC,IAAI,CAAC,OAAO,CAAC;gBACX,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC;aAClC,CAAC,CAAC;YAEH,SAAS,GAAG,IAAI,CAAC;YAEjB,WAAW;YACX,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;YAEpF,sCAAsC;YACtC,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ComputedDependence } from "./computedUpdater";
2
+ export declare function deepProxy(data: object, dependences: ComputedDependence[], basePath?: string[]): object;
3
+ export declare function getOriginalValue(value: {
4
+ __original__?: unknown;
5
+ }): unknown;
@@ -0,0 +1,35 @@
1
+ import { removePreviousDependence } from "./dependencesOptimize";
2
+ export function deepProxy(data, dependences, basePath = []) {
3
+ const handler = {
4
+ get(target, prop) {
5
+ if (prop === "__original__") {
6
+ return target;
7
+ }
8
+ const val = target[prop];
9
+ // 自身没有但原型链上有的属性不收集依赖,比如数组上的方法 slice map forEach
10
+ if (prop in target && !Object.prototype.hasOwnProperty.call(target, prop)) {
11
+ return typeof val === "function" ? val.bind(target) : val; // : val 覆盖测试不到.
12
+ }
13
+ removePreviousDependence(dependences, basePath);
14
+ const curPath = basePath.concat(prop);
15
+ dependences.push({ paths: curPath, val });
16
+ // 非对象不代理
17
+ if (typeof val !== "object" || val === null)
18
+ return val;
19
+ // console.log(val, typeof val);
20
+ return deepProxy(val, dependences, curPath);
21
+ },
22
+ set(_target, prop) {
23
+ throw Error(`${prop}字段是只读的`);
24
+ },
25
+ };
26
+ return new Proxy(data, handler);
27
+ }
28
+ // 如果是代理对象可以从__original__中获取原始值,否则返回自身
29
+ export function getOriginalValue(value) {
30
+ if (typeof value !== "object" || value === null || value.__original__ === undefined) {
31
+ return value;
32
+ }
33
+ return value.__original__;
34
+ }
35
+ //# sourceMappingURL=data-tracer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-tracer.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/computedWatchHandle/data-tracer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,WAAiC,EACjC,WAAqB,EAAE;IAEvB,MAAM,OAAO,GAAG;QACd,GAAG,CAAmB,MAAS,EAAE,IAAsB;YACrD,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;gBAC5B,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAEzB,gDAAgD;YAChD,IAAI,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC1E,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,gBAAgB;YAC7E,CAAC;YACD,wBAAwB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAEhD,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEtC,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;YAE1C,SAAS;YACT,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;gBAAE,OAAO,GAAG,CAAC;YACxD,gCAAgC;YAChC,OAAO,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;QACD,GAAG,CAAC,OAAe,EAAE,IAAY;YAC/B,MAAM,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;IAEF,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,gBAAgB,CAAC,KAAiC;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACpF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,YAAY,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ComputedDependence } from "./computedUpdater";
2
+ export declare function removeSubDependences(dependences: ComputedDependence[]): ComputedDependence[];
3
+ export declare function removePreviousDependence(dependences: ComputedDependence[], basePath: string[]): ComputedDependence[];
@@ -0,0 +1,28 @@
1
+ // 去除子依赖
2
+ export function removeSubDependences(dependences) {
3
+ // 把dependences按照路径长度排序
4
+ dependences.sort((a, b) => a.paths.length - b.paths.length);
5
+ // 从最长的路径开始遍历,如果当前路径是上一个路径的子路径,则删除当前路径
6
+ for (let f = 0; f < dependences.length; f++) {
7
+ const sortPath = dependences[f].paths.toString();
8
+ // 从后往前遍历,删除子依赖,保留父依赖
9
+ for (let i = dependences.length - 1; i > f; i--) {
10
+ const curPath = dependences[i].paths.toString();
11
+ if (curPath.startsWith(sortPath)) {
12
+ dependences.splice(i, 1);
13
+ }
14
+ }
15
+ }
16
+ return dependences;
17
+ }
18
+ // 当前依赖是上一个依赖的子依赖时,去除上一个依赖
19
+ export function removePreviousDependence(dependences, basePath) {
20
+ if (dependences.length === 0 || basePath.length === 0)
21
+ return dependences;
22
+ const lastDependence = dependences[dependences.length - 1];
23
+ if (lastDependence.paths.toString() === basePath.toString()) {
24
+ dependences.pop();
25
+ }
26
+ return dependences;
27
+ }
28
+ //# sourceMappingURL=dependencesOptimize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencesOptimize.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/computedWatchHandle/dependencesOptimize.ts"],"names":[],"mappings":"AACA,QAAQ;AACR,MAAM,UAAU,oBAAoB,CAAC,WAAiC;IACpE,uBAAuB;IACvB,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5D,sCAAsC;IACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjD,qBAAqB;QACrB,KAAK,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACjC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,0BAA0B;AAC1B,MAAM,UAAU,wBAAwB,CAAC,WAAiC,EAAE,QAAkB;IAC5F,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC;IAE1E,MAAM,cAAc,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE3D,IAAI,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC5D,WAAW,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 获取指定paths的值
3
+ * @param this - 组件实例 Instance
4
+ * @param paths - 支持多字段(用`,`分开) 例如 'obj.xxx,a,b.**' 监控了3个字段
5
+ * @returns unknown[] 每项对应paths每项的值
6
+ */
7
+ export declare function getPathsValue(data: object, paths: string): unknown[];
@@ -0,0 +1,30 @@
1
+ /**
2
+ * 获取指定paths的值
3
+ * @param this - 组件实例 Instance
4
+ * @param paths - 支持多字段(用`,`分开) 例如 'obj.xxx,a,b.**' 监控了3个字段
5
+ * @returns unknown[] 每项对应paths每项的值
6
+ */
7
+ export function getPathsValue(data, paths) {
8
+ const valueList = [];
9
+ // ['obj.xxx','a','b.**'].forEach
10
+ paths.split(",").forEach(path => {
11
+ // path : 'obj.xxx' | 'a' | 'b.**'
12
+ if (path.includes(".**")) {
13
+ // "b.**" => 'b'
14
+ path = path.slice(0, -3);
15
+ }
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ const value = path.split(".").reduce((pre, path) => {
18
+ // pre有可能为undefined|null,比如obj是未初始化的计算属性(undefined),还有可能是properties的对象类型(默认为null)
19
+ try {
20
+ return pre[path];
21
+ }
22
+ catch (_a) {
23
+ return undefined;
24
+ }
25
+ }, data);
26
+ valueList.push(value);
27
+ });
28
+ return valueList;
29
+ }
30
+ //# sourceMappingURL=getPathsValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPathsValue.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/computedWatchHandle/getPathsValue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAAa;IACvD,MAAM,SAAS,GAAc,EAAE,CAAC;IAEhC,iCAAiC;IACjC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC9B,kCAAkC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,gBAAgB;YAChB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,8DAA8D;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,IAAI,EAAE,EAAE;YACtD,iFAAiF;YACjF,IAAI,CAAC;gBACH,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;YAAC,WAAM,CAAC;gBACP,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { PropertiesConstraint } from "../../../RootComponent/Properties/PropertiesConstraint";
2
+ export declare function getPropertiesValue(propertiesOpt: PropertiesConstraint): object;
@@ -0,0 +1,44 @@
1
+ /* istanbul ignore next */
2
+ function getRequiredSingleValue(PropType) {
3
+ switch (PropType) {
4
+ case String:
5
+ return "";
6
+ case Number:
7
+ return 0;
8
+ case Array:
9
+ return [];
10
+ case Object:
11
+ return null;
12
+ case Boolean:
13
+ return false;
14
+ default:
15
+ /* istanbul ignore next */
16
+ throw Error("properties字段类型只能为 String | Number | Array | Object | Boolean ");
17
+ }
18
+ }
19
+ function IsRequiredSingle(config) {
20
+ return config instanceof Function;
21
+ }
22
+ function IsRequiredUnion(config) {
23
+ return !Reflect.has(config, "value");
24
+ }
25
+ export function getPropertiesValue(propertiesOpt) {
26
+ const result = {};
27
+ for (const key in propertiesOpt) {
28
+ const config = propertiesOpt[key];
29
+ if (IsRequiredSingle(config)) {
30
+ // @ts-ignore 隐式索引
31
+ result[key] = getRequiredSingleValue(config);
32
+ }
33
+ else if (IsRequiredUnion(config)) {
34
+ // @ts-ignore 隐式索引
35
+ result[key] = getRequiredSingleValue(config.type);
36
+ }
37
+ else {
38
+ // @ts-ignore 隐式索引
39
+ result[key] = config.value;
40
+ }
41
+ }
42
+ return result;
43
+ }
44
+ //# sourceMappingURL=getPropertiesValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPropertiesValue.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/computedWatchHandle/getPropertiesValue.ts"],"names":[],"mappings":"AAQA,0BAA0B;AAC1B,SAAS,sBAAsB,CAC7B,QAAwB;IAExB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,EAAE,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,CAAC,CAAC;QACX,KAAK,KAAK;YACR,OAAO,EAAE,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf;YACE,0BAA0B;YAC1B,MAAM,KAAK,CACT,+DAA+D,CAChE,CAAC;IACN,CAAC;AACH,CAAC;AACD,SAAS,gBAAgB,CAAC,MAAuB;IAC/C,OAAO,MAAM,YAAY,QAAQ,CAAC;AACpC,CAAC;AACD,SAAS,eAAe,CAAC,MAAuB;IAC9C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AACD,MAAM,UAAU,kBAAkB,CAAC,aAAmC;IACpE,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,kBAAkB;YAClB,MAAM,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;YACnC,kBAAkB;YAClB,MAAM,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,kBAAkB;YAClB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { FinalOptionsOfComponent } from "..";
2
+ export declare function computedWatchHandle(options: FinalOptionsOfComponent): void;
@@ -0,0 +1,60 @@
1
+ import { deepEqual } from "../../../../utils/deepEqual";
2
+ import { computedUpdater } from "./computedUpdater";
3
+ import { getPathsValue } from "./getPathsValue";
4
+ import { getPropertiesValue } from "./getPropertiesValue";
5
+ import { initComputedAndGetCache } from "./initComputedAndGetCache";
6
+ import { assertNonNullable } from "../../../../utils/assertNonNullable";
7
+ import { deepClone } from "../../../../utils/deepClone";
8
+ import { isEmptyObject } from "../../../../utils/isEmptyObject";
9
+ function initWatchOldValue(data, watchConfig) {
10
+ const watchOldValue = {};
11
+ for (const key in watchConfig) {
12
+ // @ts-ignore 隐式索引
13
+ watchOldValue[key] = deepClone(getPathsValue(data, key));
14
+ }
15
+ return watchOldValue;
16
+ }
17
+ export function computedWatchHandle(options) {
18
+ // 计算属性初始化和首次依赖收集
19
+ const computedConfig = options.computed;
20
+ const rawPropertiesValue = getPropertiesValue(options.properties);
21
+ if (computedConfig && !isEmptyObject(computedConfig)) {
22
+ // 此时store已经初始化数据到data了(__storeConfig__)
23
+ const __computedInitCache__ = initComputedAndGetCache(options, computedConfig, Object.assign(Object.assign({}, options.data), rawPropertiesValue));
24
+ // 缓存放入data中
25
+ options.data.__computedCache__ = __computedInitCache__;
26
+ // 计算属性更新函数放入methods中 要做冲突判断,避免用户定义了同名methods字段
27
+ options.methods.__computedUpdater__ = computedUpdater;
28
+ }
29
+ const observersConfig = options.observers;
30
+ // 通过observers加入`**`字段来触发计算属性更新
31
+ const originalFunc = observersConfig["**"];
32
+ observersConfig["**"] = function () {
33
+ var _a;
34
+ // 任何setData都会触发计算属性更新(可能依赖数据并没变化)
35
+ (_a = this.__computedUpdater__) === null || _a === void 0 ? void 0 : _a.call(this);
36
+ originalFunc === null || originalFunc === void 0 ? void 0 : originalFunc.call(this);
37
+ };
38
+ // watch handle
39
+ const watchConfig = options.watch;
40
+ if (watchConfig && !isEmptyObject(watchConfig)) {
41
+ const data = options.data;
42
+ data.__watchOldValue__ = initWatchOldValue(Object.assign(Object.assign({}, data), rawPropertiesValue), watchConfig);
43
+ const observersConfig = options.observers;
44
+ for (const key in watchConfig) {
45
+ const watchHadle = watchConfig[key];
46
+ const originObserversHandle = observersConfig[key];
47
+ // 在监控多个数据时,参数是多个值
48
+ observersConfig[key] = function (...newValue) {
49
+ originObserversHandle === null || originObserversHandle === void 0 ? void 0 : originObserversHandle.call(this, ...newValue);
50
+ const watchOldValue = assertNonNullable(this.data.__watchOldValue__);
51
+ const oldValue = watchOldValue[key];
52
+ if (deepEqual(newValue, oldValue))
53
+ return;
54
+ watchOldValue[key] = deepClone(newValue);
55
+ watchHadle.call(this, ...newValue, ...oldValue);
56
+ };
57
+ }
58
+ }
59
+ }
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/computedWatchHandle/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAMhE,SAAS,iBAAiB,CAAC,IAAqC,EAAE,WAAmB;IACnF,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,kBAAkB;QAClB,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AACD,MAAM,UAAU,mBAAmB,CAAC,OAAgC;IAClE,iBAAiB;IACjB,MAAM,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IACxC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClE,IAAI,cAAc,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,CAAC;QACrD,wCAAwC;QAExC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,OAAO,EAAE,cAAc,kCACxE,OAAO,CAAC,IAAI,GACZ,kBAAkB,EACrB,CAAC;QAEH,YAAY;QACZ,OAAO,CAAC,IAAI,CAAC,iBAAiB,GAAG,qBAAqB,CAAC;QAEvD,+CAA+C;QAC/C,OAAO,CAAC,OAAO,CAAC,mBAAmB,GAAG,eAAe,CAAC;IACxD,CAAC;IACD,MAAM,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IAC1C,+BAA+B;IAC/B,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAqB,CAAC;IAE/D,eAAe,CAAC,IAAI,CAAC,GAAG;;QACtB,kCAAkC;QAClC,MAAA,IAAI,CAAC,mBAAmB,oDAAI,CAAC;QAE7B,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,eAAe;IACf,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;IAElC,IAAI,WAAW,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,iCAAM,IAAI,GAAK,kBAAkB,GAAI,WAAW,CAAC,CAAC;QAE5F,MAAM,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;QAC1C,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YACpC,MAAM,qBAAqB,GAAG,eAAe,CAAC,GAAG,CAAqB,CAAC;YAEvE,kBAAkB;YAClB,eAAe,CAAC,GAAG,CAAC,GAAG,UAAyB,GAAG,QAAmB;gBACpE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,IAAI,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;gBAE/C,MAAM,aAAa,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBACrE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;gBAEpC,IAAI,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;oBAAE,OAAO;gBAC1C,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAEzC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;YAClD,CAAC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}