@pravosleva/reactive-engine 1.8.2-beta → 2.0.0-beta

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 (328) hide show
  1. package/README.md +271 -0
  2. package/dist/AbstractService.cjs.map +1 -1
  3. package/dist/AbstractService.mjs.map +1 -1
  4. package/dist/BaseREServiceEnhanced.cjs.map +1 -1
  5. package/dist/BaseREServiceEnhanced.mjs.map +1 -1
  6. package/dist/_react-bindings.d.ts +1 -1
  7. package/dist/_react-bindings.d.ts.map +1 -1
  8. package/dist/angular/core.angular-adapter.cjs +2 -0
  9. package/dist/angular/core.angular-adapter.cjs.map +1 -0
  10. package/dist/angular/core.angular-adapter.d.ts +15 -0
  11. package/dist/angular/core.angular-adapter.d.ts.map +1 -0
  12. package/dist/angular/core.angular-adapter.mjs +28 -0
  13. package/dist/angular/core.angular-adapter.mjs.map +1 -0
  14. package/dist/angular/core.angular-adapter.test.d.ts +2 -0
  15. package/dist/angular/core.angular-adapter.test.d.ts.map +1 -0
  16. package/dist/angular/index.cjs +2 -1
  17. package/dist/angular/index.cjs.map +1 -0
  18. package/dist/angular/index.d.ts +19 -2
  19. package/dist/angular/index.d.ts.map +1 -1
  20. package/dist/angular/index.mjs +28 -2
  21. package/dist/angular/index.mjs.map +1 -0
  22. package/dist/core/AbstractService.d.ts +3 -3
  23. package/dist/core/AbstractService.d.ts.map +1 -1
  24. package/dist/core/BaseREServiceEnhanced.d.ts +3 -3
  25. package/dist/core/BaseREServiceEnhanced.d.ts.map +1 -1
  26. package/dist/core/_draft.core.methods.d.ts +13 -0
  27. package/dist/core/_draft.core.methods.d.ts.map +1 -0
  28. package/dist/core/core.advanced.reactive-framework-test-suite.p2.test.d.ts +2 -0
  29. package/dist/core/core.advanced.reactive-framework-test-suite.p2.test.d.ts.map +1 -0
  30. package/dist/core/core.advanced.test.d.ts +2 -0
  31. package/dist/core/core.advanced.test.d.ts.map +1 -0
  32. package/dist/core/core.autolog.d.ts +15 -0
  33. package/dist/core/core.autolog.d.ts.map +1 -0
  34. package/dist/core/core.automatic.d.ts +23 -0
  35. package/dist/core/core.automatic.d.ts.map +1 -0
  36. package/dist/core/core.automatic.test.d.ts +2 -0
  37. package/dist/core/core.automatic.test.d.ts.map +1 -0
  38. package/dist/core/core.d.ts +38 -152
  39. package/dist/core/core.d.ts.map +1 -1
  40. package/dist/core/core.method.batch.d.ts +6 -0
  41. package/dist/core/core.method.batch.d.ts.map +1 -0
  42. package/dist/core/core.method.computed.d.ts +7 -0
  43. package/dist/core/core.method.computed.d.ts.map +1 -0
  44. package/dist/core/core.method.effect.d.ts +7 -0
  45. package/dist/core/core.method.effect.d.ts.map +1 -0
  46. package/dist/core/core.method.reactive.d.ts +6 -0
  47. package/dist/core/core.method.reactive.d.ts.map +1 -0
  48. package/dist/core/core.method.signal.d.ts +7 -0
  49. package/dist/core/core.method.signal.d.ts.map +1 -0
  50. package/dist/core/core.method.untrack.d.ts +6 -0
  51. package/dist/core/core.method.untrack.d.ts.map +1 -0
  52. package/dist/core/core.propagation.test.d.ts +2 -0
  53. package/dist/core/core.propagation.test.d.ts.map +1 -0
  54. package/dist/core/core.test.d.ts +2 -0
  55. package/dist/core/core.test.d.ts.map +1 -0
  56. package/dist/core/index.d.ts +4 -1
  57. package/dist/core/index.d.ts.map +1 -1
  58. package/dist/core/types.d.ts +31 -4
  59. package/dist/core/types.d.ts.map +1 -1
  60. package/dist/core.autolog.cjs +2 -0
  61. package/dist/core.autolog.cjs.map +1 -0
  62. package/dist/core.autolog.mjs +41 -0
  63. package/dist/core.autolog.mjs.map +1 -0
  64. package/dist/core.automatic.cjs +2 -0
  65. package/dist/core.automatic.cjs.map +1 -0
  66. package/dist/core.automatic.mjs +26 -0
  67. package/dist/core.automatic.mjs.map +1 -0
  68. package/dist/core.cjs +1 -1
  69. package/dist/core.cjs.map +1 -1
  70. package/dist/core.method.batch.cjs +2 -0
  71. package/dist/core.method.batch.cjs.map +1 -0
  72. package/dist/core.method.batch.mjs +13 -0
  73. package/dist/core.method.batch.mjs.map +1 -0
  74. package/dist/core.method.computed.cjs +2 -0
  75. package/dist/core.method.computed.cjs.map +1 -0
  76. package/dist/core.method.computed.mjs +122 -0
  77. package/dist/core.method.computed.mjs.map +1 -0
  78. package/dist/core.method.effect.cjs +2 -0
  79. package/dist/core.method.effect.cjs.map +1 -0
  80. package/dist/core.method.effect.mjs +49 -0
  81. package/dist/core.method.effect.mjs.map +1 -0
  82. package/dist/core.method.reactive.cjs +2 -0
  83. package/dist/core.method.reactive.cjs.map +1 -0
  84. package/dist/core.method.reactive.mjs +39 -0
  85. package/dist/core.method.reactive.mjs.map +1 -0
  86. package/dist/core.method.signal.cjs +2 -0
  87. package/dist/core.method.signal.cjs.map +1 -0
  88. package/dist/core.method.signal.mjs +75 -0
  89. package/dist/core.method.signal.mjs.map +1 -0
  90. package/dist/core.method.untrack.cjs +2 -0
  91. package/dist/core.method.untrack.cjs.map +1 -0
  92. package/dist/core.method.untrack.mjs +14 -0
  93. package/dist/core.method.untrack.mjs.map +1 -0
  94. package/dist/core.mjs +268 -531
  95. package/dist/core.mjs.map +1 -1
  96. package/dist/decorators/index.d.ts +1 -0
  97. package/dist/decorators/index.d.ts.map +1 -1
  98. package/dist/decorators/withCache/types.d.ts +29 -0
  99. package/dist/decorators/withCache/types.d.ts.map +1 -0
  100. package/dist/decorators/withCache/withCache.cjs +1 -1
  101. package/dist/decorators/withCache/withCache.cjs.map +1 -1
  102. package/dist/decorators/withCache/withCache.d.ts +4 -61
  103. package/dist/decorators/withCache/withCache.d.ts.map +1 -1
  104. package/dist/decorators/withCache/withCache.mjs +29 -9
  105. package/dist/decorators/withCache/withCache.mjs.map +1 -1
  106. package/dist/decorators/withValidation/index.d.ts +2 -0
  107. package/dist/decorators/withValidation/index.d.ts.map +1 -0
  108. package/dist/decorators/withValidation/withValidation.cjs +2 -0
  109. package/dist/decorators/withValidation/withValidation.cjs.map +1 -0
  110. package/dist/decorators/withValidation/withValidation.d.ts +18 -0
  111. package/dist/decorators/withValidation/withValidation.d.ts.map +1 -0
  112. package/dist/decorators/withValidation/withValidation.mjs +27 -0
  113. package/dist/decorators/withValidation/withValidation.mjs.map +1 -0
  114. package/dist/index.cjs +1 -1
  115. package/dist/index.d.ts +7 -1
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.mjs +14 -11
  118. package/dist/react/core.react-adapter.test.d.ts +2 -0
  119. package/dist/react/core.react-adapter.test.d.ts.map +1 -0
  120. package/dist/react/hooks/_draft.useReactiveValue.v2.d.ts +9 -0
  121. package/dist/react/hooks/_draft.useReactiveValue.v2.d.ts.map +1 -0
  122. package/dist/react/hooks/useReactiveSubscription.cjs +2 -0
  123. package/dist/react/hooks/useReactiveSubscription.cjs.map +1 -0
  124. package/dist/react/hooks/useReactiveSubscription.d.ts +7 -0
  125. package/dist/react/hooks/useReactiveSubscription.d.ts.map +1 -0
  126. package/dist/react/hooks/useReactiveSubscription.mjs +21 -0
  127. package/dist/react/hooks/useReactiveSubscription.mjs.map +1 -0
  128. package/dist/react/hooks/useReactiveValue.cjs +2 -0
  129. package/dist/react/hooks/useReactiveValue.cjs.map +1 -0
  130. package/dist/react/hooks/useReactiveValue.d.ts +3 -0
  131. package/dist/react/hooks/useReactiveValue.d.ts.map +1 -0
  132. package/dist/react/hooks/useReactiveValue.mjs +25 -0
  133. package/dist/react/hooks/useReactiveValue.mjs.map +1 -0
  134. package/dist/react/index.cjs +2 -1
  135. package/dist/react/index.cjs.map +1 -0
  136. package/dist/react/index.d.ts +9 -3
  137. package/dist/react/index.d.ts.map +1 -1
  138. package/dist/react/index.mjs +13 -6
  139. package/dist/react/index.mjs.map +1 -0
  140. package/dist/react/types.d.ts +0 -1
  141. package/dist/react/types.d.ts.map +1 -1
  142. package/dist/reactive-engine.umd.js +2 -2
  143. package/dist/reactive-engine.umd.js.map +1 -1
  144. package/dist/report/reactive-framework-test-suite/scripts/update-readme.d.mts +2 -0
  145. package/dist/report/reactive-framework-test-suite/scripts/update-readme.d.mts.map +1 -0
  146. package/dist/report/reactive-framework-test-suite/src/assert.d.ts +10 -0
  147. package/dist/report/reactive-framework-test-suite/src/assert.d.ts.map +1 -0
  148. package/dist/report/reactive-framework-test-suite/src/batching.d.ts +19 -0
  149. package/dist/report/reactive-framework-test-suite/src/batching.d.ts.map +1 -0
  150. package/dist/report/reactive-framework-test-suite/src/behaviorDifferences.d.ts +19 -0
  151. package/dist/report/reactive-framework-test-suite/src/behaviorDifferences.d.ts.map +1 -0
  152. package/dist/report/reactive-framework-test-suite/src/computedEval.d.ts +19 -0
  153. package/dist/report/reactive-framework-test-suite/src/computedEval.d.ts.map +1 -0
  154. package/dist/report/reactive-framework-test-suite/src/cycleDetection.d.ts +18 -0
  155. package/dist/report/reactive-framework-test-suite/src/cycleDetection.d.ts.map +1 -0
  156. package/dist/report/reactive-framework-test-suite/src/dynamicDeps.d.ts +20 -0
  157. package/dist/report/reactive-framework-test-suite/src/dynamicDeps.d.ts.map +1 -0
  158. package/dist/report/reactive-framework-test-suite/src/effectLifecycle.d.ts +20 -0
  159. package/dist/report/reactive-framework-test-suite/src/effectLifecycle.d.ts.map +1 -0
  160. package/dist/report/reactive-framework-test-suite/src/equality.d.ts +19 -0
  161. package/dist/report/reactive-framework-test-suite/src/equality.d.ts.map +1 -0
  162. package/dist/report/reactive-framework-test-suite/src/errorHandling.d.ts +20 -0
  163. package/dist/report/reactive-framework-test-suite/src/errorHandling.d.ts.map +1 -0
  164. package/dist/report/reactive-framework-test-suite/src/framework.d.ts +24 -0
  165. package/dist/report/reactive-framework-test-suite/src/framework.d.ts.map +1 -0
  166. package/dist/report/reactive-framework-test-suite/src/graphPropagation.d.ts +18 -0
  167. package/dist/report/reactive-framework-test-suite/src/graphPropagation.d.ts.map +1 -0
  168. package/dist/report/reactive-framework-test-suite/src/index.d.ts +11 -0
  169. package/dist/report/reactive-framework-test-suite/src/index.d.ts.map +1 -0
  170. package/dist/report/reactive-framework-test-suite/src/innerWrite.d.ts +20 -0
  171. package/dist/report/reactive-framework-test-suite/src/innerWrite.d.ts.map +1 -0
  172. package/dist/report/reactive-framework-test-suite/src/memoryGc.d.ts +18 -0
  173. package/dist/report/reactive-framework-test-suite/src/memoryGc.d.ts.map +1 -0
  174. package/dist/report/reactive-framework-test-suite/src/nestedEffects.d.ts +20 -0
  175. package/dist/report/reactive-framework-test-suite/src/nestedEffects.d.ts.map +1 -0
  176. package/dist/report/reactive-framework-test-suite/src/reactiveEngine.test.d.ts +2 -0
  177. package/dist/report/reactive-framework-test-suite/src/reactiveEngine.test.d.ts.map +1 -0
  178. package/dist/report/reactive-framework-test-suite/src/staleEvaluation.d.ts +18 -0
  179. package/dist/report/reactive-framework-test-suite/src/staleEvaluation.d.ts.map +1 -0
  180. package/dist/report/reactive-framework-test-suite/src/untracked.d.ts +18 -0
  181. package/dist/report/reactive-framework-test-suite/src/untracked.d.ts.map +1 -0
  182. package/dist/report/reactive-framework-test-suite/test/frameworks/alienSignals.d.ts +3 -0
  183. package/dist/report/reactive-framework-test-suite/test/frameworks/alienSignals.d.ts.map +1 -0
  184. package/dist/report/reactive-framework-test-suite/test/frameworks/angularSignals.d.ts +3 -0
  185. package/dist/report/reactive-framework-test-suite/test/frameworks/angularSignals.d.ts.map +1 -0
  186. package/dist/report/reactive-framework-test-suite/test/frameworks/anod.d.ts +3 -0
  187. package/dist/report/reactive-framework-test-suite/test/frameworks/anod.d.ts.map +1 -0
  188. package/dist/report/reactive-framework-test-suite/test/frameworks/index.d.ts +3 -0
  189. package/dist/report/reactive-framework-test-suite/test/frameworks/index.d.ts.map +1 -0
  190. package/dist/report/reactive-framework-test-suite/test/frameworks/mobx.d.ts +3 -0
  191. package/dist/report/reactive-framework-test-suite/test/frameworks/mobx.d.ts.map +1 -0
  192. package/dist/report/reactive-framework-test-suite/test/frameworks/pota.d.ts +3 -0
  193. package/dist/report/reactive-framework-test-suite/test/frameworks/pota.d.ts.map +1 -0
  194. package/dist/report/reactive-framework-test-suite/test/frameworks/preactSignals.d.ts +3 -0
  195. package/dist/report/reactive-framework-test-suite/test/frameworks/preactSignals.d.ts.map +1 -0
  196. package/dist/report/reactive-framework-test-suite/test/frameworks/reactively.d.ts +3 -0
  197. package/dist/report/reactive-framework-test-suite/test/frameworks/reactively.d.ts.map +1 -0
  198. package/dist/report/reactive-framework-test-suite/test/frameworks/reatom.d.ts +3 -0
  199. package/dist/report/reactive-framework-test-suite/test/frameworks/reatom.d.ts.map +1 -0
  200. package/dist/report/reactive-framework-test-suite/test/frameworks/sjs.d.ts +3 -0
  201. package/dist/report/reactive-framework-test-suite/test/frameworks/sjs.d.ts.map +1 -0
  202. package/dist/report/reactive-framework-test-suite/test/frameworks/solid.d.ts +3 -0
  203. package/dist/report/reactive-framework-test-suite/test/frameworks/solid.d.ts.map +1 -0
  204. package/dist/report/reactive-framework-test-suite/test/frameworks/solidSignals.d.ts +3 -0
  205. package/dist/report/reactive-framework-test-suite/test/frameworks/solidSignals.d.ts.map +1 -0
  206. package/dist/report/reactive-framework-test-suite/test/frameworks/svelte.d.ts +3 -0
  207. package/dist/report/reactive-framework-test-suite/test/frameworks/svelte.d.ts.map +1 -0
  208. package/dist/report/reactive-framework-test-suite/test/frameworks/tansu.d.ts +3 -0
  209. package/dist/report/reactive-framework-test-suite/test/frameworks/tansu.d.ts.map +1 -0
  210. package/dist/report/reactive-framework-test-suite/test/frameworks/tc39Signals.d.ts +3 -0
  211. package/dist/report/reactive-framework-test-suite/test/frameworks/tc39Signals.d.ts.map +1 -0
  212. package/dist/report/reactive-framework-test-suite/test/frameworks/vueReactivity.d.ts +3 -0
  213. package/dist/report/reactive-framework-test-suite/test/frameworks/vueReactivity.d.ts.map +1 -0
  214. package/dist/report/reactive-framework-test-suite/test/run.test.d.ts +2 -0
  215. package/dist/report/reactive-framework-test-suite/test/run.test.d.ts.map +1 -0
  216. package/dist/report/reactive-framework-test-suite/vitest.config.d.ts +3 -0
  217. package/dist/report/reactive-framework-test-suite/vitest.config.d.ts.map +1 -0
  218. package/dist/utils/getExtractedValues.cjs +2 -0
  219. package/dist/utils/getExtractedValues.cjs.map +1 -0
  220. package/dist/utils/getExtractedValues.mjs +24 -0
  221. package/dist/utils/getExtractedValues.mjs.map +1 -0
  222. package/dist/vue/core.vue-adapter.cjs +2 -0
  223. package/dist/vue/core.vue-adapter.cjs.map +1 -0
  224. package/dist/vue/core.vue-adapter.d.ts +8 -0
  225. package/dist/vue/core.vue-adapter.d.ts.map +1 -0
  226. package/dist/vue/core.vue-adapter.mjs +22 -0
  227. package/dist/vue/core.vue-adapter.mjs.map +1 -0
  228. package/dist/vue/core.vue-adapter.test.d.ts +2 -0
  229. package/dist/vue/core.vue-adapter.test.d.ts.map +1 -0
  230. package/dist/vue/index.cjs +2 -1
  231. package/dist/vue/index.cjs.map +1 -0
  232. package/dist/vue/index.d.ts +14 -2
  233. package/dist/vue/index.d.ts.map +1 -1
  234. package/dist/vue/index.mjs +54 -3
  235. package/dist/vue/index.mjs.map +1 -0
  236. package/package.json +4 -3
  237. package/dist/angular/ReactiveEngine4Angular.cjs +0 -2
  238. package/dist/angular/ReactiveEngine4Angular.cjs.map +0 -1
  239. package/dist/angular/ReactiveEngine4Angular.d.ts +0 -37
  240. package/dist/angular/ReactiveEngine4Angular.d.ts.map +0 -1
  241. package/dist/angular/ReactiveEngine4Angular.mjs +0 -45
  242. package/dist/angular/ReactiveEngine4Angular.mjs.map +0 -1
  243. package/dist/angular/core.angular.auto.test.d.ts +0 -2
  244. package/dist/angular/core.angular.auto.test.d.ts.map +0 -1
  245. package/dist/angular/core.angular.test.d.ts +0 -2
  246. package/dist/angular/core.angular.test.d.ts.map +0 -1
  247. package/dist/core/core.auto.test.d.ts +0 -2
  248. package/dist/core/core.auto.test.d.ts.map +0 -1
  249. package/dist/react/ReactiveEngine4React.cjs +0 -2
  250. package/dist/react/ReactiveEngine4React.cjs.map +0 -1
  251. package/dist/react/ReactiveEngine4React.d.ts +0 -34
  252. package/dist/react/ReactiveEngine4React.d.ts.map +0 -1
  253. package/dist/react/ReactiveEngine4React.mjs +0 -51
  254. package/dist/react/ReactiveEngine4React.mjs.map +0 -1
  255. package/dist/react/core.react.auto.test.d.ts +0 -2
  256. package/dist/react/core.react.auto.test.d.ts.map +0 -1
  257. package/dist/react/core.react.test.d.ts +0 -2
  258. package/dist/react/core.react.test.d.ts.map +0 -1
  259. package/dist/react/hooks/FilteredCatalog.auto.test.d.ts +0 -2
  260. package/dist/react/hooks/FilteredCatalog.auto.test.d.ts.map +0 -1
  261. package/dist/react/hooks/FilteredCatalog.test.d.ts +0 -2
  262. package/dist/react/hooks/FilteredCatalog.test.d.ts.map +0 -1
  263. package/dist/react/hooks/index.cjs +0 -1
  264. package/dist/react/hooks/index.d.ts +0 -4
  265. package/dist/react/hooks/index.d.ts.map +0 -1
  266. package/dist/react/hooks/index.mjs +0 -7
  267. package/dist/react/hooks/types.d.ts +0 -20
  268. package/dist/react/hooks/types.d.ts.map +0 -1
  269. package/dist/react/hooks/useReactiveSubscription/index.cjs +0 -1
  270. package/dist/react/hooks/useReactiveSubscription/index.d.ts +0 -2
  271. package/dist/react/hooks/useReactiveSubscription/index.d.ts.map +0 -1
  272. package/dist/react/hooks/useReactiveSubscription/index.mjs +0 -2
  273. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.auto.test.d.ts +0 -2
  274. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.auto.test.d.ts.map +0 -1
  275. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.cjs +0 -2
  276. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.cjs.map +0 -1
  277. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.d.ts +0 -7
  278. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.d.ts.map +0 -1
  279. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.mjs +0 -27
  280. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.mjs.map +0 -1
  281. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.test.d.ts +0 -2
  282. package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.test.d.ts.map +0 -1
  283. package/dist/react/hooks/useReactiveValue/index.cjs +0 -1
  284. package/dist/react/hooks/useReactiveValue/index.d.ts +0 -2
  285. package/dist/react/hooks/useReactiveValue/index.d.ts.map +0 -1
  286. package/dist/react/hooks/useReactiveValue/index.mjs +0 -2
  287. package/dist/react/hooks/useReactiveValue/useReactiveValue.auto.test.d.ts +0 -2
  288. package/dist/react/hooks/useReactiveValue/useReactiveValue.auto.test.d.ts.map +0 -1
  289. package/dist/react/hooks/useReactiveValue/useReactiveValue.cjs +0 -2
  290. package/dist/react/hooks/useReactiveValue/useReactiveValue.cjs.map +0 -1
  291. package/dist/react/hooks/useReactiveValue/useReactiveValue.d.ts +0 -18
  292. package/dist/react/hooks/useReactiveValue/useReactiveValue.d.ts.map +0 -1
  293. package/dist/react/hooks/useReactiveValue/useReactiveValue.mjs +0 -25
  294. package/dist/react/hooks/useReactiveValue/useReactiveValue.mjs.map +0 -1
  295. package/dist/react/hooks/useReactiveValue/useReactiveValue.test.d.ts +0 -2
  296. package/dist/react/hooks/useReactiveValue/useReactiveValue.test.d.ts.map +0 -1
  297. package/dist/react/hooks/useReactiveValue0/index.cjs +0 -1
  298. package/dist/react/hooks/useReactiveValue0/index.d.ts +0 -2
  299. package/dist/react/hooks/useReactiveValue0/index.d.ts.map +0 -1
  300. package/dist/react/hooks/useReactiveValue0/index.mjs +0 -2
  301. package/dist/react/hooks/useReactiveValue0/useReactiveValue0.cjs +0 -2
  302. package/dist/react/hooks/useReactiveValue0/useReactiveValue0.cjs.map +0 -1
  303. package/dist/react/hooks/useReactiveValue0/useReactiveValue0.d.ts +0 -51
  304. package/dist/react/hooks/useReactiveValue0/useReactiveValue0.d.ts.map +0 -1
  305. package/dist/react/hooks/useReactiveValue0/useReactiveValue0.mjs +0 -23
  306. package/dist/react/hooks/useReactiveValue0/useReactiveValue0.mjs.map +0 -1
  307. package/dist/vue/ReactiveEngine4Vue.cjs +0 -2
  308. package/dist/vue/ReactiveEngine4Vue.cjs.map +0 -1
  309. package/dist/vue/ReactiveEngine4Vue.d.ts +0 -37
  310. package/dist/vue/ReactiveEngine4Vue.d.ts.map +0 -1
  311. package/dist/vue/ReactiveEngine4Vue.mjs +0 -53
  312. package/dist/vue/ReactiveEngine4Vue.mjs.map +0 -1
  313. package/dist/vue/composables/index.d.ts +0 -2
  314. package/dist/vue/composables/index.d.ts.map +0 -1
  315. package/dist/vue/composables/useReactiveValue.auto.test.d.ts +0 -2
  316. package/dist/vue/composables/useReactiveValue.auto.test.d.ts.map +0 -1
  317. package/dist/vue/composables/useReactiveValue.cjs +0 -2
  318. package/dist/vue/composables/useReactiveValue.cjs.map +0 -1
  319. package/dist/vue/composables/useReactiveValue.d.ts +0 -12
  320. package/dist/vue/composables/useReactiveValue.d.ts.map +0 -1
  321. package/dist/vue/composables/useReactiveValue.mjs +0 -19
  322. package/dist/vue/composables/useReactiveValue.mjs.map +0 -1
  323. package/dist/vue/composables/useReactiveValue.test.d.ts +0 -2
  324. package/dist/vue/composables/useReactiveValue.test.d.ts.map +0 -1
  325. package/dist/vue/core.vue.auto.test.d.ts +0 -2
  326. package/dist/vue/core.vue.auto.test.d.ts.map +0 -1
  327. package/dist/vue/core.vue.test.d.ts +0 -2
  328. package/dist/vue/core.vue.test.d.ts.map +0 -1
package/dist/core.mjs CHANGED
@@ -1,589 +1,326 @@
1
+ import { getExtractedValues as e } from "./utils/getExtractedValues.mjs";
2
+ import { createComputed as t } from "./core.method.computed.mjs";
3
+ import { createSignal as n } from "./core.method.signal.mjs";
4
+ import { executeBatch as r } from "./core.method.batch.mjs";
5
+ import { executeUntrack as i } from "./core.method.untrack.mjs";
6
+ import { createReactive as a } from "./core.method.reactive.mjs";
7
+ import { createEffect as o } from "./core.method.effect.mjs";
1
8
  //#region src/core/core.ts
2
- var e = class {
9
+ var s = {
10
+ signal: "background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
11
+ computed: "background: #42b883; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
12
+ effect: "background: #e01e5a; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
13
+ batch: "background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
14
+ resource: "background: #d97706; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
15
+ reactive: "background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;"
16
+ }, c = null;
17
+ function l(e) {
18
+ if (e === null) return "null";
19
+ if (e === void 0) return "undefined";
20
+ if (typeof e == "object") try {
21
+ return JSON.stringify(e);
22
+ } catch {
23
+ return "[Cyclic Object or Layer]";
24
+ }
25
+ return String(e);
26
+ }
27
+ function u(e, t, n) {
28
+ c || (c = {
29
+ id: Math.random().toString(36).substring(2, 9),
30
+ pendingLogQueue: [],
31
+ isFlushing: !1
32
+ }, queueMicrotask(() => d())), c.pendingLogQueue.push({
33
+ type: e,
34
+ label: t,
35
+ from: n?.from,
36
+ to: n?.to,
37
+ payload: n?.payload,
38
+ timestamp: Date.now()
39
+ });
40
+ }
41
+ function d() {
42
+ if (!c || c.isFlushing) return;
43
+ c.isFlushing = !0;
44
+ let e = c.pendingLogQueue;
45
+ if (e.length === 0) {
46
+ c = null;
47
+ return;
48
+ }
49
+ console.groupCollapsed(`%cREACTIVE TRANSACTION%c [id: ${c.id}] (${e.length} operations)`, "background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;", "color: #888; font-weight: normal;");
50
+ for (let t of e) {
51
+ let e = s[t.type], n = t.from !== void 0 || t.to !== void 0, r = `%c${t.type.toUpperCase()}%c ${t.label}`;
52
+ n && (t.from ? r += `(${l(t.from)} → ${l(t.to)})` : r += `(${l(t.to)})`), t.payload === void 0 ? console.log(r, e, "color: inherit;") : (console.groupCollapsed(r, e, "color: inherit;"), console.log("Payload:", t.payload), console.groupEnd());
53
+ }
54
+ console.groupEnd(), c = null;
55
+ }
56
+ var f = class {
3
57
  frameworkPrefix = "core";
58
+ logger;
59
+ epoch = 0;
4
60
  activeConsumer = null;
5
- subscriberId = 0;
6
61
  batchDepth = 0;
62
+ subscriberId = 0;
7
63
  pendingEffects = /* @__PURE__ */ new Set();
8
- allEffects = /* @__PURE__ */ new Set();
9
64
  computedCache = /* @__PURE__ */ new Map();
10
- computed(e, t) {
11
- let n = this;
12
- if (n.computedCache.has(e)) {
13
- let t = n.computedCache.get(e)?.deref();
14
- if (t) return t;
15
- }
16
- let r = t || "unnamed_computed", i, a = /* @__PURE__ */ new Set(), o = {
17
- id: ++n.subscriberId,
18
- isDirty: !0,
19
- cleanups: /* @__PURE__ */ new Set(),
20
- markDirty() {
21
- this.isDirty || (this.isDirty = !0, Array.from(a).forEach((e) => {
22
- e !== n.activeConsumer && e.markDirty();
23
- }));
24
- }
25
- }, s = {
26
- get value() {
27
- if (n.activeConsumer) {
28
- let e = n.activeConsumer;
29
- a.has(e) || (a.add(e), e.cleanups.add(() => a.delete(e)));
30
- }
31
- if (o.isDirty) {
32
- let t = Array.from(o.cleanups);
33
- o.cleanups.clear(), t.forEach((e) => e());
34
- let r = n.activeConsumer;
35
- n.activeConsumer = o;
36
- try {
37
- i = e(), o.isDirty = !1;
38
- } finally {
39
- n.activeConsumer = r;
40
- }
41
- }
42
- return i;
43
- },
44
- subscribe: (e) => n.effect(() => e(s.value), `computed:use:${r}`),
45
- destroy() {
46
- let t = Array.from(o.cleanups);
47
- o.cleanups.clear(), t.forEach((e) => e()), a.clear(), n.computedCache.delete(e);
48
- for (let [e, t] of n.computedCache.entries()) t.deref() === s && n.computedCache.delete(e);
49
- }
50
- };
51
- return n.cleanupRegistry && n.cleanupRegistry.register(s, () => s.destroy()), n.computedCache.set(e, new WeakRef(s)), s;
65
+ diRegistry = /* @__PURE__ */ new Map();
66
+ diCache = /* @__PURE__ */ new Map();
67
+ proxyCache = /* @__PURE__ */ new WeakMap();
68
+ proxyTargets = /* @__PURE__ */ new WeakSet();
69
+ reactiveSignals = /* @__PURE__ */ new WeakMap();
70
+ cycleDetectionStack = /* @__PURE__ */ new Set();
71
+ constructor(e) {
72
+ this.logger = e?.logger || { isEnabled: !1 };
52
73
  }
53
- effect(e, t) {
54
- let n = this, r = {
55
- id: ++n.subscriberId,
56
- label: t,
57
- cleanups: /* @__PURE__ */ new Set(),
58
- markDirty() {
59
- n.pendingEffects.add(r), n.batchDepth === 0 && n.flushEffects();
60
- },
61
- run() {
62
- let t = Array.from(r.cleanups);
63
- r.cleanups.clear(), t.forEach((e) => {
64
- try {
65
- e();
74
+ queueLog(e, t, n) {
75
+ u(e, t, n);
76
+ }
77
+ flushEffects() {
78
+ if (this.batchDepth > 0) return;
79
+ let e = Array.from(this.pendingEffects);
80
+ this.pendingEffects.clear(), e.sort((e, t) => (e.depth || 0) - (t.depth || 0) || e.id - t.id);
81
+ let t = this.activeConsumer;
82
+ try {
83
+ for (let t of e) if (!t.isDisposed) {
84
+ if (t.dependencies && t.dependencies.size > 0) for (let e of t.dependencies) {
85
+ let t = e._node || e;
86
+ if (t.type === "computed" && t._isDirty && t._isDirty()) try {
87
+ t.run();
66
88
  } catch (e) {
67
- console.error("[Reactive Engine:Cleanup Error]", e);
89
+ if (this.batchDepth === 0) throw e;
68
90
  }
69
- });
70
- let i = n.activeConsumer;
71
- n.activeConsumer = r;
72
- try {
73
- let t = e();
74
- typeof t == "function" && r.cleanups.add(t);
75
- } catch (e) {
76
- console.error("[Reactive Error] Ошибка при выполнении тела эффекта:", e);
77
- } finally {
78
- n.activeConsumer = i;
79
91
  }
80
- }
81
- };
82
- return n.allEffects.add(r), r.run(), () => {
83
- Array.from(r.cleanups).forEach((e) => {
84
- try {
85
- e();
92
+ if (t.isDirty) try {
93
+ t.run();
86
94
  } catch (e) {
87
- console.error("[Reactive Engine:Dispose Cleanup Error]", e);
88
- }
89
- }), r.cleanups.clear(), n.pendingEffects.delete(r), n.allEffects.delete(r);
90
- };
91
- }
92
- signal(e, t) {
93
- let n = this, r = e, i = /* @__PURE__ */ new Set(), a = typeof t == "string" ? { name: t } : t || {}, o = a.name || "unnamed_signal";
94
- return {
95
- get value() {
96
- if (n.activeConsumer) {
97
- let e = n.activeConsumer;
98
- i.has(e) || (i.add(e), e.cleanups.add(() => i.delete(e)));
99
- }
100
- return r;
101
- },
102
- set value(e) {
103
- if (a?.validate) {
104
- let t = a.validate(e);
105
- if (t !== !0) {
106
- console.error(`[Reactive Engine: Validation Error] ${t}`);
107
- return;
108
- }
95
+ if (this.batchDepth === 0) throw e;
109
96
  }
110
- if ((e === null || typeof e != "object" && typeof e != "function") && r === e) return;
111
- let t = r;
112
- r = e, n.onSignalChange?.(o, e, t), Array.from(i).forEach((e) => {
113
- e !== n.activeConsumer && e.markDirty();
114
- });
115
- },
116
- subscribe(e) {
117
- return n.effect(() => e(this.value), `use:${o}`);
118
97
  }
119
- };
120
- }
121
- batch(e) {
122
- this.batchDepth++;
123
- try {
124
- e();
125
98
  } finally {
126
- this.batchDepth--, this.batchDepth === 0 && this.flushEffects();
99
+ this.activeConsumer = t;
127
100
  }
128
101
  }
129
- flushEffects() {
130
- let e = Array.from(this.pendingEffects);
131
- this.pendingEffects.clear(), e.forEach((e) => {
132
- try {
133
- e.run();
134
- } catch (e) {
135
- console.error("[Reactive Engine: Effect Execution Error]", e);
136
- }
137
- });
102
+ batch(e) {
103
+ return r(this, e);
138
104
  }
139
- untrack(e) {
140
- let t = this.activeConsumer;
141
- this.activeConsumer = null;
142
- try {
143
- return e();
144
- } finally {
145
- this.activeConsumer = t;
146
- }
105
+ log({ type: e, label: t, details: n, isInternalCoreSignal: r = !1 }) {
106
+ let i = this.logger.isEnabled, a = this.logger.isCoreOptimizationDebugEnabled;
107
+ i && (r ? a && u(e, t, n) : u(e, t, n));
147
108
  }
148
- }, t = class extends e {
149
- services = /* @__PURE__ */ new Map();
150
- factories = /* @__PURE__ */ new Map();
151
- proxyCache = /* @__PURE__ */ new WeakMap();
152
- loggerOptions;
153
- pendingLogQueue = [];
154
- signalMutationCounts = /* @__PURE__ */ new Map();
155
- lastComputedDurations = /* @__PURE__ */ new Map();
156
- effectExecutionCounts = /* @__PURE__ */ new Map();
157
- batchTickCounts = 0;
158
- lastTransactionDuration = null;
159
- constructor(e) {
160
- super(), this.loggerOptions = e?.logger;
109
+ signal(e, t) {
110
+ return n(this, e, t);
161
111
  }
162
- reactive(e, t = "reactive") {
163
- if (this.proxyCache.has(e)) return this.proxyCache.get(e);
164
- let n = this, r = /* @__PURE__ */ new Map(), i = !1, a = new Proxy(e, {
165
- get(e, o, s) {
166
- if (o === "__subscribe") return (e) => {
167
- let t = !1;
168
- return n.effect(() => {
169
- try {
170
- JSON.stringify(a);
171
- } catch {
172
- Object.values(a);
173
- }
174
- typeof window < "u" && (window.__VUE__ || globalThis.__VUE__ || e.toString().includes("triggerRef")) ? t || (t = !0, queueMicrotask(() => {
175
- t = !1, e();
176
- })) : e();
177
- }, "framework-proxy-internal-subscription");
178
- };
179
- if (n.activeConsumer) {
180
- let e = n.activeConsumer;
181
- r.has(o) || r.set(o, /* @__PURE__ */ new Map());
182
- let t = r.get(o);
183
- if (!t.has(e)) {
184
- let n = () => {
185
- t.delete(e);
186
- };
187
- t.set(e, n), e.cleanups.add(n);
188
- }
189
- }
190
- if (Array.isArray(e) && typeof o == "string" && [
191
- "push",
192
- "pop",
193
- "shift",
194
- "unshift",
195
- "splice",
196
- "sort",
197
- "reverse"
198
- ].includes(o)) {
199
- let t = e[o];
200
- return function(...a) {
201
- n.batchDepth++, i = !0;
202
- let s = t.apply(e, a);
203
- return i = !1, r.forEach((e, t) => {
204
- t !== o && Array.from(e.keys()).forEach((e) => {
205
- e !== n.activeConsumer && e.markDirty();
206
- });
207
- }), n.batchDepth--, n.batchDepth === 0 && n.flushEffects(), s;
208
- };
209
- }
210
- let c = Reflect.get(e, o, s);
211
- return typeof c == "object" && c ? n.reactive(c, `${t}.${String(o)}`) : c;
212
- },
213
- set(e, a, o, s) {
214
- let c = Reflect.get(e, a, s);
215
- if (c === o || (Reflect.set(e, a, o, s), n.onSignalChange?.(`${t}.${String(a)}`, o, c), i)) return !0;
216
- let l = r.get(a), u = l ? Array.from(l.keys()) : [];
217
- if (Array.isArray(e)) {
218
- let e = r.get("length");
219
- e && u.push(...Array.from(e.keys()));
220
- }
221
- return u.forEach((e) => {
222
- e !== n.activeConsumer && e.markDirty();
223
- }), typeof n.queueLog == "function" && n.queueLog("reactive", `${t}.${String(a)}`, {
224
- action: "set",
225
- property: String(a),
226
- oldValue: c,
227
- newValue: o
228
- }), !0;
229
- }
230
- });
231
- return this.proxyCache.set(e, a), a;
112
+ computed(e, n) {
113
+ return t(this, e, n);
114
+ }
115
+ effect(e, t) {
116
+ return o(this, e, t);
117
+ }
118
+ untrack(e) {
119
+ return i(this, e);
120
+ }
121
+ reactive(e, t) {
122
+ return a(this, e, t);
232
123
  }
233
124
  provide(e, t) {
234
- typeof t == "function" && (!t.prototype || t.name === "mockConstructor" || t._isMockFunction) ? this.factories.set(e, t) : this.services.set(e, t);
125
+ this.diRegistry.set(e, t), this.diCache.delete(e);
235
126
  }
236
127
  inject(e) {
237
- if (!e) throw Error("[DI Error]: Вы пытаетесь внедрить пустой токен.");
238
- let t = e;
239
- if (this.services.has(t)) return this.services.get(t);
128
+ if (e == null) throw Error("[DI Error] Token is empty");
129
+ if (this.diCache.has(e)) return this.diCache.get(e);
130
+ if (this.cycleDetectionStack.has(e)) throw Error("[DI Error] Cyclic dependency detected");
131
+ this.cycleDetectionStack.add(e);
240
132
  try {
241
- let n = this.factories.get(t);
242
- if (n) {
243
- let e = n(this);
244
- return this.services.set(t, e), e;
133
+ if (this.diRegistry.has(e)) {
134
+ let t = this.diRegistry.get(e);
135
+ if (typeof t == "function") {
136
+ if (t._isMockFunction) {
137
+ let n = t(this);
138
+ return n === void 0 ? t : (this.diCache.set(e, n), n);
139
+ }
140
+ let n = t.toString();
141
+ if (!(n.startsWith("class ") || n.startsWith("class{") || t.prototype && t.prototype.constructor === t && !n.startsWith("function") && !n.includes("=>"))) {
142
+ let n = t(this);
143
+ return this.diCache.set(e, n), n;
144
+ }
145
+ return t;
146
+ }
147
+ return t;
245
148
  }
246
- if (typeof e == "function" && e.prototype) {
247
- let n = new e(this);
248
- return this.services.set(t, n), n;
149
+ if (typeof e == "function") {
150
+ let t = new e(this);
151
+ return this.diCache.set(e, t), t;
249
152
  }
250
- throw Error(`Service not found: ${String(e)}`);
251
- } catch {
252
- throw Error(`[DI Error]: Не удалось создать сервис ${String(e)}.`);
153
+ throw Error("[DI Error] Token not found");
154
+ } finally {
155
+ this.cycleDetectionStack.delete(e);
253
156
  }
254
157
  }
255
- queueLog(e, t, n) {
256
- this.loggerOptions?.isEnabled && (this.pendingLogQueue.push({
257
- type: e,
258
- name: t,
259
- detail: n
260
- }), this.batchDepth === 0 && this.flushLogs());
261
- }
262
- flushLogs() {
263
- !this.loggerOptions?.isEnabled || this.pendingLogQueue.length === 0 || (this.pendingLogQueue = []);
158
+ delay(e, t) {
159
+ return new Promise((n, r) => {
160
+ if (t.aborted) return r(new DOMException("Aborted", "AbortError"));
161
+ let i = setTimeout(() => {
162
+ t.removeEventListener("abort", a), n();
163
+ }, e), a = () => {
164
+ clearTimeout(i), r(new DOMException("Aborted", "AbortError"));
165
+ };
166
+ t.addEventListener("abort", a, { once: !0 });
167
+ });
264
168
  }
265
- resource(e, t, n) {
266
- let r = n && typeof n == "object" ? n.name : n || "unnamed_resource", i = this.signal({
169
+ resource(t, n, r) {
170
+ let i = r && typeof r == "object", a = i ? r.name || "unnamed_resource" : r || "unnamed_resource", o = i ? r : {}, s = o.resetDataOnSourceChange ?? !0, c = o.responseValidate, l = o.validateBeforeFetch, u = this.signal({
267
171
  data: null,
268
172
  loading: !0,
269
173
  error: null,
270
174
  isRetrying: !1
271
- }, `resource:state:${r}`), a = this, o = null, s = async (t, n) => {
272
- if (!n.aborted) {
273
- a.untrack(() => {
274
- i.value = {
275
- data: i.value.data,
276
- loading: !0,
277
- error: null,
175
+ }, `[CORE_INTERNAL_SIGNAL=1]:resource:state:${a}`), d = (e) => {
176
+ this.log({
177
+ type: "resource",
178
+ label: a,
179
+ details: {
180
+ to: e,
181
+ from: u.value
182
+ }
183
+ }), u.value = e;
184
+ }, f = async (n, r, i = !1) => {
185
+ if (r.aborted) return;
186
+ let f = o.validateBeforeFetch ? o.validateBeforeFetch(n) : !0;
187
+ if (f === !1) {
188
+ u.value = {
189
+ loading: !1,
190
+ data: null,
191
+ error: null,
192
+ isRetrying: !1
193
+ };
194
+ return;
195
+ }
196
+ if (typeof f == "string") {
197
+ u.value = {
198
+ loading: !1,
199
+ data: null,
200
+ error: "Core internal stopper",
201
+ isRetrying: !1
202
+ };
203
+ return;
204
+ }
205
+ if (l) {
206
+ let e = l(n);
207
+ if (e === !1 || typeof e == "string") {
208
+ if (r.aborted) return;
209
+ let t = typeof e == "string" ? e : "Pre-fetch validation failed for resource", n = i ? null : this.untrack(() => u.value.data);
210
+ d({
211
+ data: n,
212
+ loading: !1,
213
+ error: t,
278
214
  isRetrying: !1
279
- };
280
- });
215
+ });
216
+ return;
217
+ }
218
+ }
219
+ let p = i && s ? null : this.untrack(() => u.value.data);
220
+ d({
221
+ data: p,
222
+ loading: !0,
223
+ error: null,
224
+ isRetrying: !1
225
+ });
226
+ for (let i = 0; i <= 0; i++) {
227
+ if (r.aborted) return;
228
+ let o = r;
281
229
  try {
282
- let r = await e(t, n);
283
- n.aborted || a.untrack(() => {
284
- i.value = {
285
- data: r,
286
- loading: !1,
287
- error: null,
288
- isRetrying: !1
289
- };
230
+ let e = await t(n, o);
231
+ if (r.aborted) return;
232
+ if (o.aborted) throw new DOMException("The operation timed out.", "TimeoutError");
233
+ if (c) {
234
+ let t = c(e);
235
+ if (t === !1 || typeof t == "string") {
236
+ if (r.aborted) return;
237
+ d({
238
+ data: null,
239
+ loading: !1,
240
+ error: typeof t == "string" ? t : "Validation failed",
241
+ isRetrying: !1
242
+ });
243
+ return;
244
+ }
245
+ }
246
+ if (r.aborted) return;
247
+ d({
248
+ data: e,
249
+ loading: !1,
250
+ error: null,
251
+ isRetrying: !1
290
252
  });
291
- } catch (e) {
292
- n.aborted || a.untrack(() => {
293
- i.value = {
253
+ return;
254
+ } catch (t) {
255
+ if (r.aborted || t.name === "AbortError" && r.aborted) return;
256
+ let n = t.name === "TimeoutError" || t.name === "AbortError" || t.message?.includes("timeout"), o = e({
257
+ tested: [t.message],
258
+ expectedKey: "THROW_CUSTOM_VALIDATION_ERROR_NO_RETRY",
259
+ valueType: "number"
260
+ })?.[0] === "1" || !1, s = o && e({
261
+ tested: [t.message],
262
+ expectedKey: "MESSAGE",
263
+ valueType: "string"
264
+ })?.[0] || "Custom validation error", c = o || t.name === "ValidationError";
265
+ if (i === 0 || c) {
266
+ if (r.aborted) return;
267
+ let e = n ? Error("Request timed out after 1000ms", { cause: t }) : o ? Error(s, { cause: t }) : t;
268
+ d({
294
269
  data: null,
295
270
  loading: !1,
296
- error: e,
271
+ error: e instanceof Error ? e.message : typeof e == "string" ? e : `typeof finalError is ${typeof e}`,
297
272
  isRetrying: !1
298
- };
299
- });
273
+ });
274
+ return;
275
+ } else {
276
+ if (r.aborted) return;
277
+ let e = 1e3 * 2 ** i;
278
+ e = Math.min(e, 3e5);
279
+ let t = Math.random() * 200;
280
+ e += t, d({
281
+ data: u.value.data,
282
+ loading: !0,
283
+ error: null,
284
+ isRetrying: !0
285
+ }), console.warn(`[Resource Retry] "${a}" сбой по ${n ? "таймауту" : "ошибке сети"}. Попытка ${i + 1}/${i + 1}...`);
286
+ try {
287
+ if (await this.delay(e, r), r.aborted) return;
288
+ } catch {
289
+ return;
290
+ }
291
+ }
300
292
  }
301
293
  }
302
- };
294
+ }, p = null;
303
295
  return this.effect(() => {
304
- let e = t ? t.value : void 0;
305
- return o && o.abort(), o = new AbortController(), s(e, o.signal), () => {
306
- o && o.abort();
307
- };
308
- }), {
296
+ let e = n ? n.value : void 0, t = new AbortController();
297
+ return p = t, this.untrack(() => {
298
+ f(e, t.signal, !0);
299
+ }), () => t.abort();
300
+ }, "[CORE_INTERNAL_SIGNAL=1]:effect"), {
309
301
  get data() {
310
- return i.value.data;
302
+ return u.value.data;
311
303
  },
312
304
  get loading() {
313
- return i.value.loading;
305
+ return u.value.loading;
314
306
  },
315
307
  get error() {
316
- return i.value.error;
317
- },
318
- get value() {
319
- return i.value;
320
- },
321
- refetch: () => {
322
- o && o.abort(), o = new AbortController(), s(t ? t.value : void 0, o.signal);
323
- },
324
- subscribe: (e) => i.subscribe(e)
325
- };
326
- }
327
- }, n = class extends t {
328
- isFlushScheduled = !1;
329
- nodeDepths = /* @__PURE__ */ new WeakMap();
330
- constructor(e) {
331
- super(e), this.frameworkPrefix = "auto-core";
332
- }
333
- getNodeDepth(e) {
334
- return e ? this.nodeDepths.has(e) ? this.nodeDepths.get(e) : 1 : 0;
335
- }
336
- effect(e, t) {
337
- let n = this, r = n.activeConsumer, i = {
338
- id: ++n.subscriberId,
339
- label: t,
340
- cleanups: /* @__PURE__ */ new Set(),
341
- markDirty() {
342
- n.pendingEffects.add(i), n.flushEffects();
343
- },
344
- run() {
345
- let t = Array.from(i.cleanups);
346
- i.cleanups.clear(), t.forEach((e) => {
347
- try {
348
- e();
349
- } catch (e) {
350
- console.error("[Reactive Engine:Cleanup Error]", e);
351
- }
352
- });
353
- let r = n.activeConsumer;
354
- n.activeConsumer = i;
355
- let a = n.getNodeDepth(r) + 1;
356
- n.nodeDepths.set(i, a);
357
- try {
358
- let t = e();
359
- typeof t == "function" && i.cleanups.add(t);
360
- } finally {
361
- n.activeConsumer = r;
362
- }
363
- }
364
- };
365
- return r && r.cleanups.add(() => {
366
- Array.from(i.cleanups).forEach((e) => {
367
- try {
368
- e();
369
- } catch {}
370
- }), i.cleanups.clear(), n.pendingEffects.delete(i), n.allEffects.delete(i);
371
- }), n.allEffects.add(i), i.run(), () => {
372
- Array.from(i.cleanups).forEach((e) => {
373
- try {
374
- e();
375
- } catch {}
376
- }), i.cleanups.clear(), n.pendingEffects.delete(i), n.allEffects.delete(i);
377
- };
378
- }
379
- flushEffects() {
380
- this.batchDepth > 0 || this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => {
381
- this.isFlushScheduled = !1;
382
- let e = 0;
383
- for (; this.pendingEffects.size > 0 && e < 100;) {
384
- e++;
385
- let t = Array.from(this.pendingEffects).sort((e, t) => this.getNodeDepth(e) - this.getNodeDepth(t) || e.id - t.id);
386
- this.pendingEffects.clear(), t.forEach((e) => {
387
- try {
388
- e.run();
389
- } catch (e) {
390
- console.error("[Reactive Engine Automatic: Effect Error]", e);
391
- }
392
- });
393
- }
394
- e >= 100 && console.warn("[Reactive Engine Automatic] Превышен лимит схождения графа. Обнаружен бесконечный цикл мутаций.");
395
- }));
396
- }
397
- }, r = class extends n {
398
- autoLogQueue = [];
399
- isHardFlushScheduled = !1;
400
- constructor(e) {
401
- let t = {
402
- ...e,
403
- logger: {
404
- isEnabled: !0,
405
- traceTime: !0,
406
- isCoreOptimizationDebugEnabled: !0,
407
- instanceName: e?.logger?.instanceName || "AUTOMATIC_HARD_CORE",
408
- filter: e?.logger?.filter
409
- }
410
- };
411
- super(t), this.frameworkPrefix = "auto-hard-core";
412
- }
413
- queueLog(e, t, n) {
414
- this.autoLogQueue.push({
415
- type: e,
416
- name: t,
417
- detail: n
418
- });
419
- }
420
- flushLogs() {
421
- if (this.autoLogQueue.length === 0) return;
422
- let e = {
423
- signal: "background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
424
- computed: "background: #42b883; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
425
- effect: "background: #e01e5a; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
426
- batch: "background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
427
- resource: "background: #d97706; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
428
- reactive: "background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;"
429
- };
430
- console.groupCollapsed(`%cREACTIVE TRANSACTION [${this.frameworkPrefix.toUpperCase()}]%c Microtask Tick (Size: ${this.autoLogQueue.length})`, "background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;", "color: #aaa; font-weight: normal;"), this.autoLogQueue.forEach((t) => {
431
- let n = "";
432
- if (t.type === "signal") {
433
- let e = t.detail;
434
- n = ` 🔄 Изменение: [${String(e.from)} -> ${String(e.to)}]`;
435
- } else if (t.type === "computed") n = ` 🧮 Расчет кэша (${t.detail.duration})`;
436
- else if (t.type === "effect") {
437
- let e = t.detail;
438
- n = e?.isTriggered ? ` ⚡️ Ререндер/Вызов (${e.duration || "0ms"})` : " 🟢 Инициализация подписки";
439
- } else if (t.type === "resource") {
440
- let e = t.detail;
441
- n = e.loading ? " ⏳ ЗАГРУЗКА СЕТИ" : e.error ? " 🔴 ОШИБКА" : " 🟢 УСПЕШНО ОТВЕТИЛ";
442
- }
443
- console.groupCollapsed(`%c${t.type.toUpperCase()}%c [${t.name}]%c${n}`, e[t.type] || e.signal, "color: #aaa; font-weight: bold;", "color: #42b883; font-weight: bold;"), console.log("Детали операции:", t.detail), console.groupEnd();
444
- }), console.groupEnd(), this.autoLogQueue = [];
445
- }
446
- flushEffects() {
447
- this.batchDepth > 0 || this.isHardFlushScheduled || (this.isHardFlushScheduled = !0, queueMicrotask(() => {
448
- this.isHardFlushScheduled = !1, this.flushLogs(), super.flushEffects();
449
- }));
450
- }
451
- effect(e, t) {
452
- let n = this, r = t || "unnamed_effect", i = !0;
453
- n.queueLog("effect", r, {
454
- isTriggered: !1,
455
- phase: "mount"
456
- });
457
- let a = {
458
- id: ++n.subscriberId,
459
- label: r,
460
- cleanups: /* @__PURE__ */ new Set(),
461
- markDirty() {
462
- n.pendingEffects.add(a), n.flushEffects();
308
+ return u.value.error;
463
309
  },
464
- run() {
465
- let t = typeof performance < "u" ? performance.now() : 0, o = Array.from(a.cleanups);
466
- a.cleanups.clear(), o.forEach((e) => {
467
- try {
468
- e();
469
- } catch (e) {
470
- console.error("[Reactive Engine:Cleanup Error]", e);
471
- }
472
- });
473
- let s = n.activeConsumer;
474
- n.activeConsumer = a;
475
- try {
476
- let t = e();
477
- typeof t == "function" && a.cleanups.add(t);
478
- } finally {
479
- if (n.activeConsumer = s, !i && t && typeof n.queueLog == "function") {
480
- let e = performance.now() - t;
481
- n.queueLog("effect", r, {
482
- isTriggered: !0,
483
- phase: "update",
484
- duration: `${e.toFixed(3)}ms`
485
- });
486
- }
487
- i = !1;
488
- }
489
- }
490
- };
491
- return n.allEffects.add(a), a.run(), () => {
492
- Array.from(a.cleanups).forEach((e) => {
493
- try {
494
- e();
495
- } catch (e) {
496
- console.error("[Reactive Engine:Dispose Cleanup Error]", e);
497
- }
498
- }), a.cleanups.clear(), n.pendingEffects.delete(a), n.allEffects.delete(a), n.queueLog("effect", r, { phase: "unmount" });
499
- };
500
- }
501
- resource(e, t, n) {
502
- let r = n && typeof n == "object" ? n.name : n || "unnamed_resource", i = this;
503
- return super.resource(async (t, n) => {
504
- i.queueLog("resource", r, {
505
- loading: !0,
506
- error: null,
507
- data: null
508
- });
509
- try {
510
- let a = await e(t, n);
511
- return i.queueLog("resource", r, {
512
- loading: !1,
513
- error: null,
514
- data: a
515
- }), a;
516
- } catch (e) {
517
- throw i.queueLog("resource", r, {
518
- loading: !1,
519
- error: e,
520
- data: null
521
- }), e;
522
- }
523
- }, t, n);
524
- }
525
- reactive(e, t = "reactive") {
526
- let n = this, r = super.reactive(e, t);
527
- return new Proxy(r, {
528
- get(e, r, i) {
529
- let a = Reflect.get(e, r, i);
530
- return typeof a == "object" && a ? n.reactive(a, `${t}.${String(r)}`) : a;
310
+ get isRetrying() {
311
+ return u.value.isRetrying;
531
312
  },
532
- set(e, r, i, a) {
533
- let o = Reflect.get(e, r, a);
534
- return o === i ? !0 : (n.queueLog("signal", `${t}.${String(r)}`, {
535
- from: o,
536
- to: i,
537
- subscribersCount: 0,
538
- subscribers: ["framework-reactive-proxy-subscriber"]
539
- }), Reflect.set(e, r, i, a));
540
- }
541
- });
542
- }
543
- signal(e, t) {
544
- let n = this, r = (typeof t == "string" ? { name: t } : t || {}).name || "unnamed_signal", i = super.signal(e, t);
545
- return {
546
313
  get value() {
547
- return i.value;
548
- },
549
- set value(e) {
550
- let t = i.value;
551
- if ((e === null || typeof e != "object" && typeof e != "function") && t === e) return;
552
- let a = n.activeConsumer, o = a && "label" in a && typeof a.label == "string" ? a.label : "unnamed_effect";
553
- n.queueLog("signal", r, {
554
- from: t,
555
- to: e,
556
- subscribersCount: 0,
557
- subscribers: [o]
558
- }), i.value = e;
314
+ return u.value;
559
315
  },
560
- subscribe(e) {
561
- return i.subscribe(e);
562
- }
563
- };
564
- }
565
- computed(e, t) {
566
- let n = this, r = t || "unnamed_computed", i = super.computed(e, t);
567
- return {
568
- get value() {
569
- let e = typeof performance < "u" ? performance.now() : 0, t = i.value;
570
- if (e) {
571
- let i = performance.now() - e;
572
- n.queueLog("computed", r, {
573
- value: t,
574
- duration: `${i.toFixed(3)}ms`
575
- });
576
- }
577
- return t;
316
+ refetch: () => {
317
+ p?.abort(), p = new AbortController(), f(n ? n.value : void 0, p.signal, !1);
578
318
  },
579
- subscribe: (e) => i.subscribe(e),
580
- destroy() {
581
- i.destroy();
582
- }
319
+ subscribe: (e) => u.subscribe(e)
583
320
  };
584
321
  }
585
322
  };
586
323
  //#endregion
587
- export { t as ReactiveEngine, n as ReactiveEngineAutomatic, r as ReactiveEngineAutomaticHard, e as ReactiveEngineCore };
324
+ export { f as ReactiveEngine, f as ReactiveEngineAutomatic, f as ReactiveEngineCore, d as flushLogs, u as queueLog };
588
325
 
589
326
  //# sourceMappingURL=core.mjs.map