@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.
- package/README.md +271 -0
- package/dist/AbstractService.cjs.map +1 -1
- package/dist/AbstractService.mjs.map +1 -1
- package/dist/BaseREServiceEnhanced.cjs.map +1 -1
- package/dist/BaseREServiceEnhanced.mjs.map +1 -1
- package/dist/_react-bindings.d.ts +1 -1
- package/dist/_react-bindings.d.ts.map +1 -1
- package/dist/angular/core.angular-adapter.cjs +2 -0
- package/dist/angular/core.angular-adapter.cjs.map +1 -0
- package/dist/angular/core.angular-adapter.d.ts +15 -0
- package/dist/angular/core.angular-adapter.d.ts.map +1 -0
- package/dist/angular/core.angular-adapter.mjs +28 -0
- package/dist/angular/core.angular-adapter.mjs.map +1 -0
- package/dist/angular/core.angular-adapter.test.d.ts +2 -0
- package/dist/angular/core.angular-adapter.test.d.ts.map +1 -0
- package/dist/angular/index.cjs +2 -1
- package/dist/angular/index.cjs.map +1 -0
- package/dist/angular/index.d.ts +19 -2
- package/dist/angular/index.d.ts.map +1 -1
- package/dist/angular/index.mjs +28 -2
- package/dist/angular/index.mjs.map +1 -0
- package/dist/core/AbstractService.d.ts +3 -3
- package/dist/core/AbstractService.d.ts.map +1 -1
- package/dist/core/BaseREServiceEnhanced.d.ts +3 -3
- package/dist/core/BaseREServiceEnhanced.d.ts.map +1 -1
- package/dist/core/_draft.core.methods.d.ts +13 -0
- package/dist/core/_draft.core.methods.d.ts.map +1 -0
- package/dist/core/core.advanced.reactive-framework-test-suite.p2.test.d.ts +2 -0
- package/dist/core/core.advanced.reactive-framework-test-suite.p2.test.d.ts.map +1 -0
- package/dist/core/core.advanced.test.d.ts +2 -0
- package/dist/core/core.advanced.test.d.ts.map +1 -0
- package/dist/core/core.autolog.d.ts +15 -0
- package/dist/core/core.autolog.d.ts.map +1 -0
- package/dist/core/core.automatic.d.ts +23 -0
- package/dist/core/core.automatic.d.ts.map +1 -0
- package/dist/core/core.automatic.test.d.ts +2 -0
- package/dist/core/core.automatic.test.d.ts.map +1 -0
- package/dist/core/core.d.ts +38 -152
- package/dist/core/core.d.ts.map +1 -1
- package/dist/core/core.method.batch.d.ts +6 -0
- package/dist/core/core.method.batch.d.ts.map +1 -0
- package/dist/core/core.method.computed.d.ts +7 -0
- package/dist/core/core.method.computed.d.ts.map +1 -0
- package/dist/core/core.method.effect.d.ts +7 -0
- package/dist/core/core.method.effect.d.ts.map +1 -0
- package/dist/core/core.method.reactive.d.ts +6 -0
- package/dist/core/core.method.reactive.d.ts.map +1 -0
- package/dist/core/core.method.signal.d.ts +7 -0
- package/dist/core/core.method.signal.d.ts.map +1 -0
- package/dist/core/core.method.untrack.d.ts +6 -0
- package/dist/core/core.method.untrack.d.ts.map +1 -0
- package/dist/core/core.propagation.test.d.ts +2 -0
- package/dist/core/core.propagation.test.d.ts.map +1 -0
- package/dist/core/core.test.d.ts +2 -0
- package/dist/core/core.test.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/types.d.ts +31 -4
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core.autolog.cjs +2 -0
- package/dist/core.autolog.cjs.map +1 -0
- package/dist/core.autolog.mjs +41 -0
- package/dist/core.autolog.mjs.map +1 -0
- package/dist/core.automatic.cjs +2 -0
- package/dist/core.automatic.cjs.map +1 -0
- package/dist/core.automatic.mjs +26 -0
- package/dist/core.automatic.mjs.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.method.batch.cjs +2 -0
- package/dist/core.method.batch.cjs.map +1 -0
- package/dist/core.method.batch.mjs +13 -0
- package/dist/core.method.batch.mjs.map +1 -0
- package/dist/core.method.computed.cjs +2 -0
- package/dist/core.method.computed.cjs.map +1 -0
- package/dist/core.method.computed.mjs +122 -0
- package/dist/core.method.computed.mjs.map +1 -0
- package/dist/core.method.effect.cjs +2 -0
- package/dist/core.method.effect.cjs.map +1 -0
- package/dist/core.method.effect.mjs +49 -0
- package/dist/core.method.effect.mjs.map +1 -0
- package/dist/core.method.reactive.cjs +2 -0
- package/dist/core.method.reactive.cjs.map +1 -0
- package/dist/core.method.reactive.mjs +39 -0
- package/dist/core.method.reactive.mjs.map +1 -0
- package/dist/core.method.signal.cjs +2 -0
- package/dist/core.method.signal.cjs.map +1 -0
- package/dist/core.method.signal.mjs +75 -0
- package/dist/core.method.signal.mjs.map +1 -0
- package/dist/core.method.untrack.cjs +2 -0
- package/dist/core.method.untrack.cjs.map +1 -0
- package/dist/core.method.untrack.mjs +14 -0
- package/dist/core.method.untrack.mjs.map +1 -0
- package/dist/core.mjs +268 -531
- package/dist/core.mjs.map +1 -1
- package/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/withCache/types.d.ts +29 -0
- package/dist/decorators/withCache/types.d.ts.map +1 -0
- package/dist/decorators/withCache/withCache.cjs +1 -1
- package/dist/decorators/withCache/withCache.cjs.map +1 -1
- package/dist/decorators/withCache/withCache.d.ts +4 -61
- package/dist/decorators/withCache/withCache.d.ts.map +1 -1
- package/dist/decorators/withCache/withCache.mjs +29 -9
- package/dist/decorators/withCache/withCache.mjs.map +1 -1
- package/dist/decorators/withValidation/index.d.ts +2 -0
- package/dist/decorators/withValidation/index.d.ts.map +1 -0
- package/dist/decorators/withValidation/withValidation.cjs +2 -0
- package/dist/decorators/withValidation/withValidation.cjs.map +1 -0
- package/dist/decorators/withValidation/withValidation.d.ts +18 -0
- package/dist/decorators/withValidation/withValidation.d.ts.map +1 -0
- package/dist/decorators/withValidation/withValidation.mjs +27 -0
- package/dist/decorators/withValidation/withValidation.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +14 -11
- package/dist/react/core.react-adapter.test.d.ts +2 -0
- package/dist/react/core.react-adapter.test.d.ts.map +1 -0
- package/dist/react/hooks/_draft.useReactiveValue.v2.d.ts +9 -0
- package/dist/react/hooks/_draft.useReactiveValue.v2.d.ts.map +1 -0
- package/dist/react/hooks/useReactiveSubscription.cjs +2 -0
- package/dist/react/hooks/useReactiveSubscription.cjs.map +1 -0
- package/dist/react/hooks/useReactiveSubscription.d.ts +7 -0
- package/dist/react/hooks/useReactiveSubscription.d.ts.map +1 -0
- package/dist/react/hooks/useReactiveSubscription.mjs +21 -0
- package/dist/react/hooks/useReactiveSubscription.mjs.map +1 -0
- package/dist/react/hooks/useReactiveValue.cjs +2 -0
- package/dist/react/hooks/useReactiveValue.cjs.map +1 -0
- package/dist/react/hooks/useReactiveValue.d.ts +3 -0
- package/dist/react/hooks/useReactiveValue.d.ts.map +1 -0
- package/dist/react/hooks/useReactiveValue.mjs +25 -0
- package/dist/react/hooks/useReactiveValue.mjs.map +1 -0
- package/dist/react/index.cjs +2 -1
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.ts +9 -3
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.mjs +13 -6
- package/dist/react/index.mjs.map +1 -0
- package/dist/react/types.d.ts +0 -1
- package/dist/react/types.d.ts.map +1 -1
- package/dist/reactive-engine.umd.js +2 -2
- package/dist/reactive-engine.umd.js.map +1 -1
- package/dist/report/reactive-framework-test-suite/scripts/update-readme.d.mts +2 -0
- package/dist/report/reactive-framework-test-suite/scripts/update-readme.d.mts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/assert.d.ts +10 -0
- package/dist/report/reactive-framework-test-suite/src/assert.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/batching.d.ts +19 -0
- package/dist/report/reactive-framework-test-suite/src/batching.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/behaviorDifferences.d.ts +19 -0
- package/dist/report/reactive-framework-test-suite/src/behaviorDifferences.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/computedEval.d.ts +19 -0
- package/dist/report/reactive-framework-test-suite/src/computedEval.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/cycleDetection.d.ts +18 -0
- package/dist/report/reactive-framework-test-suite/src/cycleDetection.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/dynamicDeps.d.ts +20 -0
- package/dist/report/reactive-framework-test-suite/src/dynamicDeps.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/effectLifecycle.d.ts +20 -0
- package/dist/report/reactive-framework-test-suite/src/effectLifecycle.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/equality.d.ts +19 -0
- package/dist/report/reactive-framework-test-suite/src/equality.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/errorHandling.d.ts +20 -0
- package/dist/report/reactive-framework-test-suite/src/errorHandling.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/framework.d.ts +24 -0
- package/dist/report/reactive-framework-test-suite/src/framework.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/graphPropagation.d.ts +18 -0
- package/dist/report/reactive-framework-test-suite/src/graphPropagation.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/index.d.ts +11 -0
- package/dist/report/reactive-framework-test-suite/src/index.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/innerWrite.d.ts +20 -0
- package/dist/report/reactive-framework-test-suite/src/innerWrite.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/memoryGc.d.ts +18 -0
- package/dist/report/reactive-framework-test-suite/src/memoryGc.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/nestedEffects.d.ts +20 -0
- package/dist/report/reactive-framework-test-suite/src/nestedEffects.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/reactiveEngine.test.d.ts +2 -0
- package/dist/report/reactive-framework-test-suite/src/reactiveEngine.test.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/staleEvaluation.d.ts +18 -0
- package/dist/report/reactive-framework-test-suite/src/staleEvaluation.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/src/untracked.d.ts +18 -0
- package/dist/report/reactive-framework-test-suite/src/untracked.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/alienSignals.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/alienSignals.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/angularSignals.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/angularSignals.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/anod.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/anod.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/index.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/index.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/mobx.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/mobx.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/pota.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/pota.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/preactSignals.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/preactSignals.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/reactively.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/reactively.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/reatom.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/reatom.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/sjs.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/sjs.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/solid.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/solid.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/solidSignals.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/solidSignals.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/svelte.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/svelte.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/tansu.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/tansu.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/tc39Signals.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/tc39Signals.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/vueReactivity.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/test/frameworks/vueReactivity.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/test/run.test.d.ts +2 -0
- package/dist/report/reactive-framework-test-suite/test/run.test.d.ts.map +1 -0
- package/dist/report/reactive-framework-test-suite/vitest.config.d.ts +3 -0
- package/dist/report/reactive-framework-test-suite/vitest.config.d.ts.map +1 -0
- package/dist/utils/getExtractedValues.cjs +2 -0
- package/dist/utils/getExtractedValues.cjs.map +1 -0
- package/dist/utils/getExtractedValues.mjs +24 -0
- package/dist/utils/getExtractedValues.mjs.map +1 -0
- package/dist/vue/core.vue-adapter.cjs +2 -0
- package/dist/vue/core.vue-adapter.cjs.map +1 -0
- package/dist/vue/core.vue-adapter.d.ts +8 -0
- package/dist/vue/core.vue-adapter.d.ts.map +1 -0
- package/dist/vue/core.vue-adapter.mjs +22 -0
- package/dist/vue/core.vue-adapter.mjs.map +1 -0
- package/dist/vue/core.vue-adapter.test.d.ts +2 -0
- package/dist/vue/core.vue-adapter.test.d.ts.map +1 -0
- package/dist/vue/index.cjs +2 -1
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.ts +14 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.mjs +54 -3
- package/dist/vue/index.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/angular/ReactiveEngine4Angular.cjs +0 -2
- package/dist/angular/ReactiveEngine4Angular.cjs.map +0 -1
- package/dist/angular/ReactiveEngine4Angular.d.ts +0 -37
- package/dist/angular/ReactiveEngine4Angular.d.ts.map +0 -1
- package/dist/angular/ReactiveEngine4Angular.mjs +0 -45
- package/dist/angular/ReactiveEngine4Angular.mjs.map +0 -1
- package/dist/angular/core.angular.auto.test.d.ts +0 -2
- package/dist/angular/core.angular.auto.test.d.ts.map +0 -1
- package/dist/angular/core.angular.test.d.ts +0 -2
- package/dist/angular/core.angular.test.d.ts.map +0 -1
- package/dist/core/core.auto.test.d.ts +0 -2
- package/dist/core/core.auto.test.d.ts.map +0 -1
- package/dist/react/ReactiveEngine4React.cjs +0 -2
- package/dist/react/ReactiveEngine4React.cjs.map +0 -1
- package/dist/react/ReactiveEngine4React.d.ts +0 -34
- package/dist/react/ReactiveEngine4React.d.ts.map +0 -1
- package/dist/react/ReactiveEngine4React.mjs +0 -51
- package/dist/react/ReactiveEngine4React.mjs.map +0 -1
- package/dist/react/core.react.auto.test.d.ts +0 -2
- package/dist/react/core.react.auto.test.d.ts.map +0 -1
- package/dist/react/core.react.test.d.ts +0 -2
- package/dist/react/core.react.test.d.ts.map +0 -1
- package/dist/react/hooks/FilteredCatalog.auto.test.d.ts +0 -2
- package/dist/react/hooks/FilteredCatalog.auto.test.d.ts.map +0 -1
- package/dist/react/hooks/FilteredCatalog.test.d.ts +0 -2
- package/dist/react/hooks/FilteredCatalog.test.d.ts.map +0 -1
- package/dist/react/hooks/index.cjs +0 -1
- package/dist/react/hooks/index.d.ts +0 -4
- package/dist/react/hooks/index.d.ts.map +0 -1
- package/dist/react/hooks/index.mjs +0 -7
- package/dist/react/hooks/types.d.ts +0 -20
- package/dist/react/hooks/types.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveSubscription/index.cjs +0 -1
- package/dist/react/hooks/useReactiveSubscription/index.d.ts +0 -2
- package/dist/react/hooks/useReactiveSubscription/index.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveSubscription/index.mjs +0 -2
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.auto.test.d.ts +0 -2
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.auto.test.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.cjs +0 -2
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.cjs.map +0 -1
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.d.ts +0 -7
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.mjs +0 -27
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.mjs.map +0 -1
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.test.d.ts +0 -2
- package/dist/react/hooks/useReactiveSubscription/useReactiveSubscription.test.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveValue/index.cjs +0 -1
- package/dist/react/hooks/useReactiveValue/index.d.ts +0 -2
- package/dist/react/hooks/useReactiveValue/index.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveValue/index.mjs +0 -2
- package/dist/react/hooks/useReactiveValue/useReactiveValue.auto.test.d.ts +0 -2
- package/dist/react/hooks/useReactiveValue/useReactiveValue.auto.test.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveValue/useReactiveValue.cjs +0 -2
- package/dist/react/hooks/useReactiveValue/useReactiveValue.cjs.map +0 -1
- package/dist/react/hooks/useReactiveValue/useReactiveValue.d.ts +0 -18
- package/dist/react/hooks/useReactiveValue/useReactiveValue.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveValue/useReactiveValue.mjs +0 -25
- package/dist/react/hooks/useReactiveValue/useReactiveValue.mjs.map +0 -1
- package/dist/react/hooks/useReactiveValue/useReactiveValue.test.d.ts +0 -2
- package/dist/react/hooks/useReactiveValue/useReactiveValue.test.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveValue0/index.cjs +0 -1
- package/dist/react/hooks/useReactiveValue0/index.d.ts +0 -2
- package/dist/react/hooks/useReactiveValue0/index.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveValue0/index.mjs +0 -2
- package/dist/react/hooks/useReactiveValue0/useReactiveValue0.cjs +0 -2
- package/dist/react/hooks/useReactiveValue0/useReactiveValue0.cjs.map +0 -1
- package/dist/react/hooks/useReactiveValue0/useReactiveValue0.d.ts +0 -51
- package/dist/react/hooks/useReactiveValue0/useReactiveValue0.d.ts.map +0 -1
- package/dist/react/hooks/useReactiveValue0/useReactiveValue0.mjs +0 -23
- package/dist/react/hooks/useReactiveValue0/useReactiveValue0.mjs.map +0 -1
- package/dist/vue/ReactiveEngine4Vue.cjs +0 -2
- package/dist/vue/ReactiveEngine4Vue.cjs.map +0 -1
- package/dist/vue/ReactiveEngine4Vue.d.ts +0 -37
- package/dist/vue/ReactiveEngine4Vue.d.ts.map +0 -1
- package/dist/vue/ReactiveEngine4Vue.mjs +0 -53
- package/dist/vue/ReactiveEngine4Vue.mjs.map +0 -1
- package/dist/vue/composables/index.d.ts +0 -2
- package/dist/vue/composables/index.d.ts.map +0 -1
- package/dist/vue/composables/useReactiveValue.auto.test.d.ts +0 -2
- package/dist/vue/composables/useReactiveValue.auto.test.d.ts.map +0 -1
- package/dist/vue/composables/useReactiveValue.cjs +0 -2
- package/dist/vue/composables/useReactiveValue.cjs.map +0 -1
- package/dist/vue/composables/useReactiveValue.d.ts +0 -12
- package/dist/vue/composables/useReactiveValue.d.ts.map +0 -1
- package/dist/vue/composables/useReactiveValue.mjs +0 -19
- package/dist/vue/composables/useReactiveValue.mjs.map +0 -1
- package/dist/vue/composables/useReactiveValue.test.d.ts +0 -2
- package/dist/vue/composables/useReactiveValue.test.d.ts.map +0 -1
- package/dist/vue/core.vue.auto.test.d.ts +0 -2
- package/dist/vue/core.vue.auto.test.d.ts.map +0 -1
- package/dist/vue/core.vue.test.d.ts +0 -2
- package/dist/vue/core.vue.test.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { ReactiveEngine as e
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
import { ReactiveEngine as e } from "./core.mjs";
|
|
2
|
+
import { ReactiveEngineAutomatic as t } from "./core.automatic.mjs";
|
|
3
|
+
import { ReactiveEngineAutolog as n } from "./core.autolog.mjs";
|
|
4
|
+
import { AbstractService as r, BaseREService as i } from "./AbstractService.mjs";
|
|
5
|
+
import { BaseREServiceEnhanced as a } from "./BaseREServiceEnhanced.mjs";
|
|
6
|
+
import { withCache as o } from "./decorators/withCache/withCache.mjs";
|
|
7
|
+
import { withDebounce as s } from "./decorators/withDebounce/withDebounce.mjs";
|
|
8
|
+
import { withLongPolling as c } from "./decorators/withLongPolling/withLongPolling.mjs";
|
|
9
|
+
import { withThrottle as l } from "./decorators/withThrottle/withThrottle.mjs";
|
|
10
|
+
import { withThrottleComputed as u } from "./decorators/withThrottleComputed/withThrottleComputed.mjs";
|
|
11
|
+
import { withThrottleAndCache as d } from "./decorators/withThrottleAndCache/withThrottleAndCache.mjs";
|
|
12
|
+
import { withStaleWhileRevalidate as f } from "./decorators/withStaleWhileRevalidate/withStaleWhileRevalidate.mjs";
|
|
13
|
+
import { withResourceValidation as p, withValidation as m } from "./decorators/withValidation/withValidation.mjs";
|
|
14
|
+
export { r as AbstractService, i as BaseREService, a as BaseREServiceEnhanced, t as ReactiveEngine, n as ReactiveEngineAutolog, t as ReactiveEngineAutomatic, e as ReactiveEngineCore, o as withCache, s as withDebounce, c as withLongPolling, p as withResourceValidation, f as withStaleWhileRevalidate, l as withThrottle, d as withThrottleAndCache, u as withThrottleComputed, m as withValidation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.react-adapter.test.d.ts","sourceRoot":"","sources":["../../src/react/core.react-adapter.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ISignalLike } from '../../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* ⚛️ REACTIVE ENGINE ADAPTER FOR REACT (v1.9.190)
|
|
4
|
+
*
|
|
5
|
+
* Нативно интегрирует синхронные и асингулярные графы вычислений ядра с React 18/19.
|
|
6
|
+
* Полностью исключает Tearing, бесконечные циклы и Object.is лаги в любой тестовой среде.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useReactiveValue<T>(item: T): T extends ISignalLike<infer V> ? V : T;
|
|
9
|
+
//# sourceMappingURL=_draft.useReactiveValue.v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_draft.useReactiveValue.v2.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/_draft.useReactiveValue.v2.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CA8HnF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e=require("react");function t(t,n){let r=(0,e.useRef)(n);(0,e.useEffect)(()=>{r.current=n},[n]),(0,e.useEffect)(()=>{if(!(!t||typeof t!=`object`)){if(`subscribe`in t&&typeof t.subscribe==`function`)return t.subscribe(e=>{r.current(e)});if(`__subscribe`in t&&typeof t.__subscribe==`function`)return t.__subscribe(()=>{r.current(t)})}},[t])}exports.useReactiveSubscription=t;
|
|
2
|
+
//# sourceMappingURL=useReactiveSubscription.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactiveSubscription.cjs","names":[],"sources":["../../../src/react/hooks/useReactiveSubscription.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport { ISignalLike } from '../../core/types'\n\ntype CleanupFn = () => void\n\n/**\n * 🔄 Универсальный хук подписки без принудительного рендеринга самого компонента.\n * Идеален для вызова аналитики, сайд-эффектов или логов при изменении коллекций.\n */\nexport function useReactiveSubscription<T>(\n item: T,\n callback: (val: T extends ISignalLike<infer V> ? V : T) => void\n): void {\n const callbackRef = useRef(callback)\n\n useEffect(() => {\n callbackRef.current = callback\n }, [callback])\n\n useEffect(() => {\n if (!item || typeof item !== 'object') return\n\n if ('subscribe' in item && typeof (item as Record<string, unknown>).subscribe === 'function') {\n const signalItem = (item as unknown) as ISignalLike<unknown>\n return signalItem.subscribe((newValue) => {\n callbackRef.current(newValue as any)\n })\n }\n\n if ('__subscribe' in item && typeof (item as Record<string, unknown>).__subscribe === 'function') {\n return ((item as Record<string, unknown>).__subscribe as (cb: () => void) => CleanupFn)(() => {\n callbackRef.current(item as any)\n })\n }\n }, [item])\n}\n"],"mappings":"uBASA,SAAgB,EACd,EACA,EACM,CACN,IAAM,GAAA,EAAA,EAAA,OAAA,CAAqB,CAAQ,GAEnC,EAAA,EAAA,UAAA,KAAgB,CACd,EAAY,QAAU,CACxB,EAAG,CAAC,CAAQ,CAAC,GAEb,EAAA,EAAA,UAAA,KAAgB,CACV,MAAC,GAAQ,OAAO,GAAS,UAE7B,IAAI,cAAe,GAAQ,OAAQ,EAAiC,WAAc,WAEhF,OAAO,EAAW,UAAW,GAAa,CACxC,EAAY,QAAQ,CAAe,CACrC,CAAC,EAGH,GAAI,gBAAiB,GAAQ,OAAQ,EAAiC,aAAgB,WACpF,OAAS,EAAiC,gBAAoD,CAC5F,EAAY,QAAQ,CAAW,CACjC,CAAC,CANA,CAQL,EAAG,CAAC,CAAI,CAAC,CACX"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ISignalLike } from '../../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* 🔄 Универсальный хук подписки без принудительного рендеринга самого компонента.
|
|
4
|
+
* Идеален для вызова аналитики, сайд-эффектов или логов при изменении коллекций.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useReactiveSubscription<T>(item: T, callback: (val: T extends ISignalLike<infer V> ? V : T) => void): void;
|
|
7
|
+
//# sourceMappingURL=useReactiveSubscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactiveSubscription.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useReactiveSubscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,GAC9D,IAAI,CAuBN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t } from "react";
|
|
2
|
+
//#region src/react/hooks/useReactiveSubscription.ts
|
|
3
|
+
function n(n, r) {
|
|
4
|
+
let i = t(r);
|
|
5
|
+
e(() => {
|
|
6
|
+
i.current = r;
|
|
7
|
+
}, [r]), e(() => {
|
|
8
|
+
if (!(!n || typeof n != "object")) {
|
|
9
|
+
if ("subscribe" in n && typeof n.subscribe == "function") return n.subscribe((e) => {
|
|
10
|
+
i.current(e);
|
|
11
|
+
});
|
|
12
|
+
if ("__subscribe" in n && typeof n.__subscribe == "function") return n.__subscribe(() => {
|
|
13
|
+
i.current(n);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}, [n]);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as useReactiveSubscription };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=useReactiveSubscription.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactiveSubscription.mjs","names":[],"sources":["../../../src/react/hooks/useReactiveSubscription.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport { ISignalLike } from '../../core/types'\n\ntype CleanupFn = () => void\n\n/**\n * 🔄 Универсальный хук подписки без принудительного рендеринга самого компонента.\n * Идеален для вызова аналитики, сайд-эффектов или логов при изменении коллекций.\n */\nexport function useReactiveSubscription<T>(\n item: T,\n callback: (val: T extends ISignalLike<infer V> ? V : T) => void\n): void {\n const callbackRef = useRef(callback)\n\n useEffect(() => {\n callbackRef.current = callback\n }, [callback])\n\n useEffect(() => {\n if (!item || typeof item !== 'object') return\n\n if ('subscribe' in item && typeof (item as Record<string, unknown>).subscribe === 'function') {\n const signalItem = (item as unknown) as ISignalLike<unknown>\n return signalItem.subscribe((newValue) => {\n callbackRef.current(newValue as any)\n })\n }\n\n if ('__subscribe' in item && typeof (item as Record<string, unknown>).__subscribe === 'function') {\n return ((item as Record<string, unknown>).__subscribe as (cb: () => void) => CleanupFn)(() => {\n callbackRef.current(item as any)\n })\n }\n }, [item])\n}\n"],"mappings":";;AASA,SAAgB,EACd,GACA,GACM;CACN,IAAM,IAAc,EAAO,CAAQ;CAMnC,AAJA,QAAgB;EACd,EAAY,UAAU;CACxB,GAAG,CAAC,CAAQ,CAAC,GAEb,QAAgB;EACV,OAAC,KAAQ,OAAO,KAAS,WAE7B;OAAI,eAAe,KAAQ,OAAQ,EAAiC,aAAc,YAEhF,OAAO,EAAW,WAAW,MAAa;IACxC,EAAY,QAAQ,CAAe;GACrC,CAAC;GAGH,IAAI,iBAAiB,KAAQ,OAAQ,EAAiC,eAAgB,YACpF,OAAS,EAAiC,kBAAoD;IAC5F,EAAY,QAAQ,CAAW;GACjC,CAAC;EANA;CAQL,GAAG,CAAC,CAAI,CAAC;AACX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e=require("react");function t(t){if(typeof t!=`object`||!t)return t;let n=`subscribe`in t&&typeof t.subscribe==`function`,r=(0,e.useRef)({version:0,unsubscribe:null,listeners:new Set});return(0,e.useSyncExternalStore)(e=>{if(r.current.listeners.add(e),!r.current.unsubscribe){let e=!0,i=()=>{e||(r.current.version++,r.current.listeners.forEach(e=>e()))};n?r.current.unsubscribe=t.subscribe(i):`__subscribe`in t&&typeof t.__subscribe==`function`&&(r.current.unsubscribe=t.__subscribe(i)),e=!1}return()=>{r.current.listeners.delete(e),r.current.listeners.size===0&&r.current.unsubscribe&&(r.current.unsubscribe(),r.current.unsubscribe=null)}},()=>r.current.version,()=>r.current.version),n?t.value:t}exports.useReactiveValue=t;
|
|
2
|
+
//# sourceMappingURL=useReactiveValue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactiveValue.cjs","names":[],"sources":["../../../src/react/hooks/useReactiveValue.ts"],"sourcesContent":["import { useSyncExternalStore, useRef } from 'react'\nimport { ISignalLike } from '../../core/types'\n\nexport function useReactiveValue<T>(item: T): T extends ISignalLike<infer V> ? V : T {\n if (item === null || item === undefined || typeof item !== 'object') {\n return item as any\n }\n\n const isSignal = 'subscribe' in item && typeof (item as Record<string, unknown>).subscribe === 'function'\n\n const storeRef = useRef<{\n version: number\n unsubscribe: (() => void) | null\n listeners: Set<() => void>\n }>({\n version: 0,\n unsubscribe: null,\n listeners: new Set()\n })\n\n const subscribeStore = (cb: () => void) => {\n storeRef.current.listeners.add(cb)\n\n if (!storeRef.current.unsubscribe) {\n let isInitializing = true\n\n const triggerUpdate = () => {\n if (isInitializing) return\n storeRef.current.version++\n storeRef.current.listeners.forEach(listener => listener())\n }\n\n if (isSignal) {\n storeRef.current.unsubscribe = (item as any).subscribe(triggerUpdate)\n } else if ('__subscribe' in item && typeof (item as any).__subscribe === 'function') {\n // Нативно подписываемся на сквозной эмиттер Proxy-коллекции ядра\n storeRef.current.unsubscribe = (item as any).__subscribe(triggerUpdate)\n }\n\n isInitializing = false\n }\n\n return () => {\n storeRef.current.listeners.delete(cb)\n if (storeRef.current.listeners.size === 0 && storeRef.current.unsubscribe) {\n storeRef.current.unsubscribe()\n storeRef.current.unsubscribe = null\n }\n }\n }\n\n // useSyncExternalStore реагирует строго на инкремент версии, перезапуская ререндер\n useSyncExternalStore(\n subscribeStore,\n () => storeRef.current.version,\n () => storeRef.current.version\n )\n\n const rawValue = isSignal ? (item as any).value : item\n\n // Возвращаем оригинальный Proxy-объект напрямую! Ссылочная идентичность инпутов в React сохраняется на 100%\n return rawValue as any\n}\n"],"mappings":"uBAGA,SAAgB,EAAoB,EAAiD,CACnF,GAA2C,OAAO,GAAS,WAAvD,EACF,OAAO,EAGT,IAAM,EAAW,cAAe,GAAQ,OAAQ,EAAiC,WAAc,WAEzF,GAAA,EAAA,EAAA,OAAA,CAIH,CACD,QAAS,EACT,YAAa,KACb,UAAW,IAAI,GACjB,CAAC,EA2CD,OATA,EAAA,EAAA,qBAAA,CAhCwB,GAAmB,CAGzC,GAFA,EAAS,QAAQ,UAAU,IAAI,CAAE,EAE7B,CAAC,EAAS,QAAQ,YAAa,CACjC,IAAI,EAAiB,GAEf,MAAsB,CACtB,IACJ,EAAS,QAAQ,UACjB,EAAS,QAAQ,UAAU,QAAQ,GAAY,EAAS,CAAC,EAC3D,EAEI,EACF,EAAS,QAAQ,YAAe,EAAa,UAAU,CAAa,EAC3D,gBAAiB,GAAQ,OAAQ,EAAa,aAAgB,aAEvE,EAAS,QAAQ,YAAe,EAAa,YAAY,CAAa,GAGxE,EAAiB,EACnB,CAEA,UAAa,CACX,EAAS,QAAQ,UAAU,OAAO,CAAE,EAChC,EAAS,QAAQ,UAAU,OAAS,GAAK,EAAS,QAAQ,cAC5D,EAAS,QAAQ,YAAY,EAC7B,EAAS,QAAQ,YAAc,KAEnC,CACF,MAKQ,EAAS,QAAQ,YACjB,EAAS,QAAQ,OACzB,EAEiB,EAAY,EAAa,MAAQ,CAIpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactiveValue.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useReactiveValue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CA2DnF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useRef as e, useSyncExternalStore as t } from "react";
|
|
2
|
+
//#region src/react/hooks/useReactiveValue.ts
|
|
3
|
+
function n(n) {
|
|
4
|
+
if (typeof n != "object" || !n) return n;
|
|
5
|
+
let r = "subscribe" in n && typeof n.subscribe == "function", i = e({
|
|
6
|
+
version: 0,
|
|
7
|
+
unsubscribe: null,
|
|
8
|
+
listeners: /* @__PURE__ */ new Set()
|
|
9
|
+
});
|
|
10
|
+
return t((e) => {
|
|
11
|
+
if (i.current.listeners.add(e), !i.current.unsubscribe) {
|
|
12
|
+
let e = !0, t = () => {
|
|
13
|
+
e || (i.current.version++, i.current.listeners.forEach((e) => e()));
|
|
14
|
+
};
|
|
15
|
+
r ? i.current.unsubscribe = n.subscribe(t) : "__subscribe" in n && typeof n.__subscribe == "function" && (i.current.unsubscribe = n.__subscribe(t)), e = !1;
|
|
16
|
+
}
|
|
17
|
+
return () => {
|
|
18
|
+
i.current.listeners.delete(e), i.current.listeners.size === 0 && i.current.unsubscribe && (i.current.unsubscribe(), i.current.unsubscribe = null);
|
|
19
|
+
};
|
|
20
|
+
}, () => i.current.version, () => i.current.version), r ? n.value : n;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { n as useReactiveValue };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=useReactiveValue.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactiveValue.mjs","names":[],"sources":["../../../src/react/hooks/useReactiveValue.ts"],"sourcesContent":["import { useSyncExternalStore, useRef } from 'react'\nimport { ISignalLike } from '../../core/types'\n\nexport function useReactiveValue<T>(item: T): T extends ISignalLike<infer V> ? V : T {\n if (item === null || item === undefined || typeof item !== 'object') {\n return item as any\n }\n\n const isSignal = 'subscribe' in item && typeof (item as Record<string, unknown>).subscribe === 'function'\n\n const storeRef = useRef<{\n version: number\n unsubscribe: (() => void) | null\n listeners: Set<() => void>\n }>({\n version: 0,\n unsubscribe: null,\n listeners: new Set()\n })\n\n const subscribeStore = (cb: () => void) => {\n storeRef.current.listeners.add(cb)\n\n if (!storeRef.current.unsubscribe) {\n let isInitializing = true\n\n const triggerUpdate = () => {\n if (isInitializing) return\n storeRef.current.version++\n storeRef.current.listeners.forEach(listener => listener())\n }\n\n if (isSignal) {\n storeRef.current.unsubscribe = (item as any).subscribe(triggerUpdate)\n } else if ('__subscribe' in item && typeof (item as any).__subscribe === 'function') {\n // Нативно подписываемся на сквозной эмиттер Proxy-коллекции ядра\n storeRef.current.unsubscribe = (item as any).__subscribe(triggerUpdate)\n }\n\n isInitializing = false\n }\n\n return () => {\n storeRef.current.listeners.delete(cb)\n if (storeRef.current.listeners.size === 0 && storeRef.current.unsubscribe) {\n storeRef.current.unsubscribe()\n storeRef.current.unsubscribe = null\n }\n }\n }\n\n // useSyncExternalStore реагирует строго на инкремент версии, перезапуская ререндер\n useSyncExternalStore(\n subscribeStore,\n () => storeRef.current.version,\n () => storeRef.current.version\n )\n\n const rawValue = isSignal ? (item as any).value : item\n\n // Возвращаем оригинальный Proxy-объект напрямую! Ссылочная идентичность инпутов в React сохраняется на 100%\n return rawValue as any\n}\n"],"mappings":";;AAGA,SAAgB,EAAoB,GAAiD;CACnF,IAA2C,OAAO,KAAS,aAAvD,GACF,OAAO;CAGT,IAAM,IAAW,eAAe,KAAQ,OAAQ,EAAiC,aAAc,YAEzF,IAAW,EAId;EACD,SAAS;EACT,aAAa;EACb,2BAAW,IAAI,IAAI;CACrB,CAAC;CA2CD,OATA,GAhCwB,MAAmB;EAGzC,IAFA,EAAS,QAAQ,UAAU,IAAI,CAAE,GAE7B,CAAC,EAAS,QAAQ,aAAa;GACjC,IAAI,IAAiB,IAEf,UAAsB;IACtB,MACJ,EAAS,QAAQ,WACjB,EAAS,QAAQ,UAAU,SAAQ,MAAY,EAAS,CAAC;GAC3D;GASA,AAPI,IACF,EAAS,QAAQ,cAAe,EAAa,UAAU,CAAa,IAC3D,iBAAiB,KAAQ,OAAQ,EAAa,eAAgB,eAEvE,EAAS,QAAQ,cAAe,EAAa,YAAY,CAAa,IAGxE,IAAiB;EACnB;EAEA,aAAa;GAEX,AADA,EAAS,QAAQ,UAAU,OAAO,CAAE,GAChC,EAAS,QAAQ,UAAU,SAAS,KAAK,EAAS,QAAQ,gBAC5D,EAAS,QAAQ,YAAY,GAC7B,EAAS,QAAQ,cAAc;EAEnC;CACF,SAKQ,EAAS,QAAQ,eACjB,EAAS,QAAQ,OACzB,GAEiB,IAAY,EAAa,QAAQ;AAIpD"}
|
package/dist/react/index.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core.automatic.cjs"),t=require("./hooks/useReactiveValue.cjs"),n=require("./hooks/useReactiveSubscription.cjs");var r=class extends e.ReactiveEngineAutomatic{use(e){return t.useReactiveValue(e)}};exports.ReactiveEngine=r,exports.use=t.useReactiveValue,exports.useReactiveValue=t.useReactiveValue,exports.useReactiveSubscription=n.useReactiveSubscription;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/react/index.ts"],"sourcesContent":["// Точка входа субпакета \"@pravosleva/reactive-engine/react\"\nimport { ReactiveEngineAutomatic } from '../core/core.automatic'\nimport { useReactiveValue } from './hooks/useReactiveValue'\nimport { ISignalLike } from '../core/types'\n\nclass ExtendedReactiveEngine extends ReactiveEngineAutomatic {\n public use<T>(item: T): T extends ISignalLike<infer V> ? V : T {\n return useReactiveValue(item)\n }\n}\n\nexport { ExtendedReactiveEngine as ReactiveEngine, useReactiveValue as use }\nexport { useReactiveValue }\nexport { useReactiveSubscription } from './hooks/useReactiveSubscription'\n"],"mappings":"uMAKA,IAAM,EAAN,cAAqC,EAAA,uBAAwB,CAC3D,IAAc,EAAiD,CAC7D,OAAO,EAAA,iBAAiB,CAAI,CAC9B,CACF"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ReactiveEngineAutomatic } from '../core/core.automatic';
|
|
2
|
+
import { useReactiveValue } from './hooks/useReactiveValue';
|
|
3
|
+
import { ISignalLike } from '../core/types';
|
|
4
|
+
declare class ExtendedReactiveEngine extends ReactiveEngineAutomatic {
|
|
5
|
+
use<T>(item: T): T extends ISignalLike<infer V> ? V : T;
|
|
6
|
+
}
|
|
7
|
+
export { ExtendedReactiveEngine as ReactiveEngine, useReactiveValue as use };
|
|
8
|
+
export { useReactiveValue };
|
|
9
|
+
export { useReactiveSubscription } from './hooks/useReactiveSubscription';
|
|
4
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,cAAM,sBAAuB,SAAQ,uBAAuB;IACnD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CAG/D;AAED,OAAO,EAAE,sBAAsB,IAAI,cAAc,EAAE,gBAAgB,IAAI,GAAG,EAAE,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA"}
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ReactiveEngineAutomatic as e } from "../core.automatic.mjs";
|
|
2
|
+
import { useReactiveValue as t } from "./hooks/useReactiveValue.mjs";
|
|
3
|
+
import { useReactiveSubscription as n } from "./hooks/useReactiveSubscription.mjs";
|
|
4
|
+
//#region src/react/index.ts
|
|
5
|
+
var r = class extends e {
|
|
6
|
+
use(e) {
|
|
7
|
+
return t(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { r as ReactiveEngine, t as use, t as useReactiveValue, n as useReactiveSubscription };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/react/index.ts"],"sourcesContent":["// Точка входа субпакета \"@pravosleva/reactive-engine/react\"\nimport { ReactiveEngineAutomatic } from '../core/core.automatic'\nimport { useReactiveValue } from './hooks/useReactiveValue'\nimport { ISignalLike } from '../core/types'\n\nclass ExtendedReactiveEngine extends ReactiveEngineAutomatic {\n public use<T>(item: T): T extends ISignalLike<infer V> ? V : T {\n return useReactiveValue(item)\n }\n}\n\nexport { ExtendedReactiveEngine as ReactiveEngine, useReactiveValue as use }\nexport { useReactiveValue }\nexport { useReactiveSubscription } from './hooks/useReactiveSubscription'\n"],"mappings":";;;;AAKA,IAAM,IAAN,cAAqC,EAAwB;CAC3D,IAAc,GAAiD;EAC7D,OAAO,EAAiB,CAAI;CAC9B;AACF"}
|
package/dist/react/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/react/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/react/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pravosleva/reactive-engine
|
|
2
|
+
* @pravosleva/reactive-engine v2.0.0-beta
|
|
3
3
|
* High-performance transactional reactive engine with microtask batching.
|
|
4
4
|
*
|
|
5
5
|
* @license MIT
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* @contact Telegram Channel: https://t.me/bash_exp_ru/3393
|
|
10
10
|
* @contact Developer Telegram: https://t.me/pravosleva
|
|
11
11
|
*/
|
|
12
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactiveEngineLib={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=class{frameworkPrefix=`core`;activeConsumer=null;subscriberId=0;batchDepth=0;pendingEffects=new Set;allEffects=new Set;computedCache=new Map;computed(e,t){let n=this;if(n.computedCache.has(e)){let t=n.computedCache.get(e)?.deref();if(t)return t}let r=t||`unnamed_computed`,i,a=new Set,o={id:++n.subscriberId,isDirty:!0,cleanups:new Set,markDirty(){this.isDirty||(this.isDirty=!0,Array.from(a).forEach(e=>{e!==n.activeConsumer&&e.markDirty()}))}},s={get value(){if(n.activeConsumer){let e=n.activeConsumer;a.has(e)||(a.add(e),e.cleanups.add(()=>a.delete(e)))}if(o.isDirty){let t=Array.from(o.cleanups);o.cleanups.clear(),t.forEach(e=>e());let r=n.activeConsumer;n.activeConsumer=o;try{i=e(),o.isDirty=!1}finally{n.activeConsumer=r}}return i},subscribe:e=>n.effect(()=>e(s.value),`computed:use:${r}`),destroy(){let t=Array.from(o.cleanups);o.cleanups.clear(),t.forEach(e=>e()),a.clear(),n.computedCache.delete(e);for(let[e,t]of n.computedCache.entries())t.deref()===s&&n.computedCache.delete(e)}};return n.cleanupRegistry&&n.cleanupRegistry.register(s,()=>s.destroy()),n.computedCache.set(e,new WeakRef(s)),s}effect(e,t){let n=this,r={id:++n.subscriberId,label:t,cleanups:new Set,markDirty(){n.pendingEffects.add(r),n.batchDepth===0&&n.flushEffects()},run(){let t=Array.from(r.cleanups);r.cleanups.clear(),t.forEach(e=>{try{e()}catch(e){console.error(`[Reactive Engine:Cleanup Error]`,e)}});let i=n.activeConsumer;n.activeConsumer=r;try{let t=e();typeof t==`function`&&r.cleanups.add(t)}catch(e){console.error(`[Reactive Error] Ошибка при выполнении тела эффекта:`,e)}finally{n.activeConsumer=i}}};return n.allEffects.add(r),r.run(),()=>{Array.from(r.cleanups).forEach(e=>{try{e()}catch(e){console.error(`[Reactive Engine:Dispose Cleanup Error]`,e)}}),r.cleanups.clear(),n.pendingEffects.delete(r),n.allEffects.delete(r)}}signal(e,t){let n=this,r=e,i=new Set,a=typeof t==`string`?{name:t}:t||{},o=a.name||`unnamed_signal`;return{get value(){if(n.activeConsumer){let e=n.activeConsumer;i.has(e)||(i.add(e),e.cleanups.add(()=>i.delete(e)))}return r},set value(e){if(a?.validate){let t=a.validate(e);if(t!==!0){console.error(`[Reactive Engine: Validation Error] ${t}`);return}}if((e===null||typeof e!=`object`&&typeof e!=`function`)&&r===e)return;let t=r;r=e,n.onSignalChange?.(o,e,t),Array.from(i).forEach(e=>{e!==n.activeConsumer&&e.markDirty()})},subscribe(e){return n.effect(()=>e(this.value),`use:${o}`)}}}batch(e){this.batchDepth++;try{e()}finally{this.batchDepth--,this.batchDepth===0&&this.flushEffects()}}flushEffects(){let e=Array.from(this.pendingEffects);this.pendingEffects.clear(),e.forEach(e=>{try{e.run()}catch(e){console.error(`[Reactive Engine: Effect Execution Error]`,e)}})}untrack(e){let t=this.activeConsumer;this.activeConsumer=null;try{return e()}finally{this.activeConsumer=t}}},n=class extends t{services=new Map;factories=new Map;proxyCache=new WeakMap;loggerOptions;pendingLogQueue=[];signalMutationCounts=new Map;lastComputedDurations=new Map;effectExecutionCounts=new Map;batchTickCounts=0;lastTransactionDuration=null;constructor(e){super(),this.loggerOptions=e?.logger}reactive(e,t=`reactive`){if(this.proxyCache.has(e))return this.proxyCache.get(e);let n=this,r=new Map,i=!1,a=new Proxy(e,{get(e,o,s){if(o===`__subscribe`)return e=>{let t=!1;return n.effect(()=>{try{JSON.stringify(a)}catch{Object.values(a)}typeof window<`u`&&(window.__VUE__||globalThis.__VUE__||e.toString().includes(`triggerRef`))?t||(t=!0,queueMicrotask(()=>{t=!1,e()})):e()},`framework-proxy-internal-subscription`)};if(n.activeConsumer){let e=n.activeConsumer;r.has(o)||r.set(o,new Map);let t=r.get(o);if(!t.has(e)){let n=()=>{t.delete(e)};t.set(e,n),e.cleanups.add(n)}}if(Array.isArray(e)&&typeof o==`string`&&[`push`,`pop`,`shift`,`unshift`,`splice`,`sort`,`reverse`].includes(o)){let t=e[o];return function(...a){n.batchDepth++,i=!0;let s=t.apply(e,a);return i=!1,r.forEach((e,t)=>{t!==o&&Array.from(e.keys()).forEach(e=>{e!==n.activeConsumer&&e.markDirty()})}),n.batchDepth--,n.batchDepth===0&&n.flushEffects(),s}}let c=Reflect.get(e,o,s);return typeof c==`object`&&c?n.reactive(c,`${t}.${String(o)}`):c},set(e,a,o,s){let c=Reflect.get(e,a,s);if(c===o||(Reflect.set(e,a,o,s),n.onSignalChange?.(`${t}.${String(a)}`,o,c),i))return!0;let l=r.get(a),u=l?Array.from(l.keys()):[];if(Array.isArray(e)){let e=r.get(`length`);e&&u.push(...Array.from(e.keys()))}return u.forEach(e=>{e!==n.activeConsumer&&e.markDirty()}),typeof n.queueLog==`function`&&n.queueLog(`reactive`,`${t}.${String(a)}`,{action:`set`,property:String(a),oldValue:c,newValue:o}),!0}});return this.proxyCache.set(e,a),a}provide(e,t){typeof t==`function`&&(!t.prototype||t.name===`mockConstructor`||t._isMockFunction)?this.factories.set(e,t):this.services.set(e,t)}inject(e){if(!e)throw Error(`[DI Error]: Вы пытаетесь внедрить пустой токен.`);let t=e;if(this.services.has(t))return this.services.get(t);try{let n=this.factories.get(t);if(n){let e=n(this);return this.services.set(t,e),e}if(typeof e==`function`&&e.prototype){let n=new e(this);return this.services.set(t,n),n}throw Error(`Service not found: ${String(e)}`)}catch{throw Error(`[DI Error]: Не удалось создать сервис ${String(e)}.`)}}queueLog(e,t,n){this.loggerOptions?.isEnabled&&(this.pendingLogQueue.push({type:e,name:t,detail:n}),this.batchDepth===0&&this.flushLogs())}flushLogs(){!this.loggerOptions?.isEnabled||this.pendingLogQueue.length===0||(this.pendingLogQueue=[])}resource(e,t,n){let r=n&&typeof n==`object`?n.name:n||`unnamed_resource`,i=this.signal({data:null,loading:!0,error:null,isRetrying:!1},`resource:state:${r}`),a=this,o=null,s=async(t,n)=>{if(!n.aborted){a.untrack(()=>{i.value={data:i.value.data,loading:!0,error:null,isRetrying:!1}});try{let r=await e(t,n);n.aborted||a.untrack(()=>{i.value={data:r,loading:!1,error:null,isRetrying:!1}})}catch(e){n.aborted||a.untrack(()=>{i.value={data:null,loading:!1,error:e,isRetrying:!1}})}}};return this.effect(()=>{let e=t?t.value:void 0;return o&&o.abort(),o=new AbortController,s(e,o.signal),()=>{o&&o.abort()}}),{get data(){return i.value.data},get loading(){return i.value.loading},get error(){return i.value.error},get value(){return i.value},refetch:()=>{o&&o.abort(),o=new AbortController,s(t?t.value:void 0,o.signal)},subscribe:e=>i.subscribe(e)}}},r=class extends n{isFlushScheduled=!1;nodeDepths=new WeakMap;constructor(e){super(e),this.frameworkPrefix=`auto-core`}getNodeDepth(e){return e?this.nodeDepths.has(e)?this.nodeDepths.get(e):1:0}effect(e,t){let n=this,r=n.activeConsumer,i={id:++n.subscriberId,label:t,cleanups:new Set,markDirty(){n.pendingEffects.add(i),n.flushEffects()},run(){let t=Array.from(i.cleanups);i.cleanups.clear(),t.forEach(e=>{try{e()}catch(e){console.error(`[Reactive Engine:Cleanup Error]`,e)}});let r=n.activeConsumer;n.activeConsumer=i;let a=n.getNodeDepth(r)+1;n.nodeDepths.set(i,a);try{let t=e();typeof t==`function`&&i.cleanups.add(t)}finally{n.activeConsumer=r}}};return r&&r.cleanups.add(()=>{Array.from(i.cleanups).forEach(e=>{try{e()}catch{}}),i.cleanups.clear(),n.pendingEffects.delete(i),n.allEffects.delete(i)}),n.allEffects.add(i),i.run(),()=>{Array.from(i.cleanups).forEach(e=>{try{e()}catch{}}),i.cleanups.clear(),n.pendingEffects.delete(i),n.allEffects.delete(i)}}flushEffects(){this.batchDepth>0||this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>{this.isFlushScheduled=!1;let e=0;for(;this.pendingEffects.size>0&&e<100;){e++;let t=Array.from(this.pendingEffects).sort((e,t)=>this.getNodeDepth(e)-this.getNodeDepth(t)||e.id-t.id);this.pendingEffects.clear(),t.forEach(e=>{try{e.run()}catch(e){console.error(`[Reactive Engine Automatic: Effect Error]`,e)}})}e>=100&&console.warn(`[Reactive Engine Automatic] Превышен лимит схождения графа. Обнаружен бесконечный цикл мутаций.`)}))}},i=class extends r{autoLogQueue=[];isHardFlushScheduled=!1;constructor(e){let t={...e,logger:{isEnabled:!0,traceTime:!0,isCoreOptimizationDebugEnabled:!0,instanceName:e?.logger?.instanceName||`AUTOMATIC_HARD_CORE`,filter:e?.logger?.filter}};super(t),this.frameworkPrefix=`auto-hard-core`}queueLog(e,t,n){this.autoLogQueue.push({type:e,name:t,detail:n})}flushLogs(){if(this.autoLogQueue.length===0)return;let e={signal:`background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,computed:`background: #42b883; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,effect:`background: #e01e5a; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,batch:`background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,resource:`background: #d97706; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,reactive:`background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`};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=>{let n=``;if(t.type===`signal`){let e=t.detail;n=` 🔄 Изменение: [${String(e.from)} -> ${String(e.to)}]`}else if(t.type===`computed`)n=` 🧮 Расчет кэша (${t.detail.duration})`;else if(t.type===`effect`){let e=t.detail;n=e?.isTriggered?` ⚡️ Ререндер/Вызов (${e.duration||`0ms`})`:` 🟢 Инициализация подписки`}else if(t.type===`resource`){let e=t.detail;n=e.loading?` ⏳ ЗАГРУЗКА СЕТИ`:e.error?` 🔴 ОШИБКА`:` 🟢 УСПЕШНО ОТВЕТИЛ`}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()}),console.groupEnd(),this.autoLogQueue=[]}flushEffects(){this.batchDepth>0||this.isHardFlushScheduled||(this.isHardFlushScheduled=!0,queueMicrotask(()=>{this.isHardFlushScheduled=!1,this.flushLogs(),super.flushEffects()}))}effect(e,t){let n=this,r=t||`unnamed_effect`,i=!0;n.queueLog(`effect`,r,{isTriggered:!1,phase:`mount`});let a={id:++n.subscriberId,label:r,cleanups:new Set,markDirty(){n.pendingEffects.add(a),n.flushEffects()},run(){let t=typeof performance<`u`?performance.now():0,o=Array.from(a.cleanups);a.cleanups.clear(),o.forEach(e=>{try{e()}catch(e){console.error(`[Reactive Engine:Cleanup Error]`,e)}});let s=n.activeConsumer;n.activeConsumer=a;try{let t=e();typeof t==`function`&&a.cleanups.add(t)}finally{if(n.activeConsumer=s,!i&&t&&typeof n.queueLog==`function`){let e=performance.now()-t;n.queueLog(`effect`,r,{isTriggered:!0,phase:`update`,duration:`${e.toFixed(3)}ms`})}i=!1}}};return n.allEffects.add(a),a.run(),()=>{Array.from(a.cleanups).forEach(e=>{try{e()}catch(e){console.error(`[Reactive Engine:Dispose Cleanup Error]`,e)}}),a.cleanups.clear(),n.pendingEffects.delete(a),n.allEffects.delete(a),n.queueLog(`effect`,r,{phase:`unmount`})}}resource(e,t,n){let r=n&&typeof n==`object`?n.name:n||`unnamed_resource`,i=this;return super.resource(async(t,n)=>{i.queueLog(`resource`,r,{loading:!0,error:null,data:null});try{let a=await e(t,n);return i.queueLog(`resource`,r,{loading:!1,error:null,data:a}),a}catch(e){throw i.queueLog(`resource`,r,{loading:!1,error:e,data:null}),e}},t,n)}reactive(e,t=`reactive`){let n=this,r=super.reactive(e,t);return new Proxy(r,{get(e,r,i){let a=Reflect.get(e,r,i);return typeof a==`object`&&a?n.reactive(a,`${t}.${String(r)}`):a},set(e,r,i,a){let o=Reflect.get(e,r,a);return o===i?!0:(n.queueLog(`signal`,`${t}.${String(r)}`,{from:o,to:i,subscribersCount:0,subscribers:[`framework-reactive-proxy-subscriber`]}),Reflect.set(e,r,i,a))}})}signal(e,t){let n=this,r=(typeof t==`string`?{name:t}:t||{}).name||`unnamed_signal`,i=super.signal(e,t);return{get value(){return i.value},set value(e){let t=i.value;if((e===null||typeof e!=`object`&&typeof e!=`function`)&&t===e)return;let a=n.activeConsumer,o=a&&`label`in a&&typeof a.label==`string`?a.label:`unnamed_effect`;n.queueLog(`signal`,r,{from:t,to:e,subscribersCount:0,subscribers:[o]}),i.value=e},subscribe(e){return i.subscribe(e)}}}computed(e,t){let n=this,r=t||`unnamed_computed`,i=super.computed(e,t);return{get value(){let e=typeof performance<`u`?performance.now():0,t=i.value;if(e){let i=performance.now()-e;n.queueLog(`computed`,r,{value:t,duration:`${i.toFixed(3)}ms`})}return t},subscribe:e=>i.subscribe(e),destroy(){i.destroy()}}}},a=class{engine;constructor(e){this.engine=e,this.onInit()}createNumericSignal(e,t){return this.engine.signal(e,{name:t,validate:e=>typeof e==`number`&&!isNaN(e)})}createComputed(e){return this.engine.computed(e)}createSignal(e,t){return this.engine.signal(e,t)}onInit(){}},o=a,s=class{engine;constructor(e){this.engine=e,setTimeout(()=>this.onInit(),0)}onInit(){}};e.AbstractService=a,e.BaseREService=o,e.BaseREServiceEnhanced=s,e.ReactiveEngine=n,e.ReactiveEngineAutomatic=r,e.ReactiveEngineAutomaticHard=i,e.ReactiveEngineCore=t});
|
|
12
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactiveEngineLib={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=({tested:e,expectedKey:t,valueType:n})=>{let r=[];if(!e||!Array.isArray(e))return r;for(let i=0,a=e.length;i<a;i++){let a=e[i];if(typeof a!=`string`)continue;let o;switch(n){case`number`:o=RegExp(`\\[${t}=(?<value>\\d+)\\]`,`g`);break;default:o=RegExp(`\\[${t}=(?<value>.*?)\\]`,`g`);break}for(let e of a.matchAll(o))e?.groups&&r.push(e.groups.value)}return r};function n(e,t,n){let r=e.computedCache.get(t)?.deref();if(r)return r;let i,a=!0,o=0,s=new Set,c=new Map,l=e=>{if(!e)return;let t=e._node||e;if(t.dependencies&&t.dependencies.size>0){let n=Array.from(t.dependencies);t.dependencies.clear(),t.depVersions&&t.depVersions.clear(),n.forEach(n=>{let r=n._node||n;r.subscribers&&(r.subscribers.delete(t),r.subscribers.delete(e),r.subscribers.delete(d),r.type===`computed`&&r.subscribers.size===0&&l(r))})}},u=new class extends Set{delete(n){let r=super.delete(n);return this.size===0&&(a=!0,l(d),e.computedCache.delete(t)),r}},d={id:e.subscriberId++,dependencies:s,subscribers:u,depth:1,type:`computed`,fn:t,get version(){return o},run:()=>{if(e.cycleDetectionStack.has(d))throw Error(`[Graph Error] Cyclic dependency detected`);e.cycleDetectionStack.add(d);let n=e.activeConsumer;e.activeConsumer=d,s.forEach(e=>{let t=e._node||e;t.subscribers&&t.subscribers.delete(d)}),s.clear(),c.clear();try{let n=t(),r=i&&typeof i==`object`,l=a||!r&&i!==n||r&&JSON.stringify(i)!==JSON.stringify(n);l?(i=n,o++,u.forEach(t=>{t.isDirty=!0,e.pendingEffects.add(t)})):u.forEach(e=>{e.isDirty=!1}),a=!1;let f=0;return s.forEach(t=>{let n=t._node||t;c.set(t,n.version===void 0?e.epoch:n.version),n.depth!==void 0&&n.depth>f&&(f=n.depth)}),d.depth=f+1,l}finally{e.activeConsumer=n,e.cycleDetectionStack.delete(d)}},markDirty:()=>{a||(a=!0,u.forEach(t=>{let n=t.isDirty;t.isDirty=!0,e.pendingEffects.add(t),!n&&t.subscribers&&t.subscribers.forEach(t=>{t.isDirty=!0,e.pendingEffects.add(t)})}))}},f={get value(){e.activeConsumer&&e.activeConsumer!==d&&(d.subscribers.add(e.activeConsumer),e.activeConsumer.dependencies.add(d));let t=a;if(!t&&s.size>0)for(let n of Array.from(s)){let r=n._node||n;if((r.version===void 0?n.version===void 0?e.epoch:n.version:r.version)!==c.get(n)){t=!0;break}}return t&&d.run(),i},get version(){return o},subscribe(t){let n={id:e.subscriberId++,isDirty:!0,depth:9999,dependencies:new Set,type:`effect`,run:()=>{if(!n.isDisposed)try{t(f.value)}catch(e){console.error(e)}}};return d.subscribers.add(n),t(f.value),()=>{n.isDisposed=!0,d.subscribers.delete(n)}},subscribeState(e){return f.subscribe(e)},destroy:()=>{d.subscribers.clear(),l(d),e.computedCache.delete(t),a=!0},__subscribe(t){let n={id:e.subscriberId++,type:`effect`,run:t,isDirty:!1};return d.subscribers.add(n),()=>{u.delete(n)}}};return f._node=d,f.subscribers=u,f.dependencies=s,f._isDirty=()=>a,f.type=`computed`,f.run=()=>d.run(),d.destroy=()=>{e.computedCache.delete(t)},e.computedCache.set(t,new WeakRef(f)),f}function r(e,n,r){let i=n,a=0,o=new Set,s=typeof r==`string`?r:r?.name||``,c=t({tested:[s],expectedKey:`CORE_INTERNAL_SIGNAL`,valueType:`number`})?.toString()===`1`||!1,l={subscribers:o,id:e.subscriberId++,depth:0,type:`signal`,get version(){return a}},u={get value(){return e.activeConsumer&&(o.add(e.activeConsumer),e.activeConsumer.dependencies.add(l)),i},set value(t){if(i===t&&!(i&&typeof i==`object`))return;if(r&&typeof r==`object`&&r.validate){let e=r.validate(t);if(e!==!0){console.error(typeof e==`string`?e:`[Validation Error]`);return}}let n=i;i=t,a++,e.epoch++,e.log({type:`signal`,label:s||`signal`,details:{from:n,to:t},isInternalCoreSignal:c});let o=t=>{t.subscribers.forEach(t=>{if(t===e.activeConsumer)return;let n=t.isDirty;t.isDirty=!0,t.type===`effect`?e.pendingEffects.add(t):(e.pendingEffects.add(t),t.markDirty?t.markDirty():!n&&t.subscribers&&o(t))})};o(l),e.batchDepth===0&&e.flushEffects()},get version(){return a},subscribe(t){let n={id:e.subscriberId++,isDirty:!0,depth:9999,dependencies:new Set,run:()=>{if(!n.isDisposed)try{t(i)}catch(e){console.error(e)}}};return o.add(n),t(i),()=>{n.isDisposed=!0,o.delete(n)}}};return u._node=l,u}function i(e,t){e.batchDepth++;try{return t()}finally{e.batchDepth--,e.batchDepth===0&&e.flushEffects()}}function a(e,t){let n=e.activeConsumer;e.activeConsumer=null;try{return t()}finally{e.activeConsumer=n}}function o(e,t,n){if(e.proxyTargets.has(t))return t;if(e.proxyCache.has(t))return e.proxyCache.get(t);e.reactiveSignals.has(t)||e.reactiveSignals.set(t,new Map);let r=e.reactiveSignals.get(t),i=new Proxy(t,{get(t,i,a){if(i===`__subscribe`&&Array.isArray(t))return n=>{let i=r.get(`length`);return i||(i=e.signal(t.length),r.set(`length`,i)),i.subscribe(n)};if(typeof i==`symbol`||i===`constructor`||i===`toJSON`)return Reflect.get(t,i,a);let o=r.get(i);o||(o=e.signal(Reflect.get(t,i)),r.set(i,o));let s=o.value;return e.activeConsumer&&e.log({type:`reactive`,label:`Read ${n||``}.${String(i)}`,details:{to:s}}),typeof s==`object`&&s?e.reactive(s,n?`${n}.${String(i)}`:String(i)):s},set(t,n,i,a){let o=(e.proxyTargets.has(i),i),s=Reflect.get(t,n);if(s===o&&n!==`length`)return!0;Reflect.set(t,n,o);let c=r.get(n);if(c||(c=e.signal(s),r.set(n,c)),c.value=o,Array.isArray(t)&&n!==`length`){let e=r.get(`length`);e&&(e.value=t.length)}return!0}});return e.proxyCache.set(t,i),e.proxyTargets.add(i),i}function s(e,t,n){let r=new Set,i=new Set,a={id:e.subscriberId++,isDirty:!0,depth:1e3,dependencies:i,cleanups:r,type:`effect`,run:()=>{if(a.isDisposed||a===e.activeConsumer)return;let o=e.activeConsumer;e.activeConsumer=a;let s=new Set(i);i.clear();try{r.forEach(e=>{try{e()}catch(e){console.error(e)}}),r.clear();let o=t();typeof o==`function`&&r.add(o),a.isDirty=!1,s.forEach(e=>{i.has(e)||e.subscribers.delete(a)}),e.log({type:`effect`,label:n||`unnamed_effect`})}finally{e.activeConsumer=o}}};return a.run(),()=>{a.isDisposed=!0,r.forEach(e=>{try{e()}catch(e){console.error(e)}}),r.clear(),i.forEach(e=>e.subscribers.delete(a)),i.clear(),e.pendingEffects.delete(a)}}var c={signal:`background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,computed:`background: #42b883; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,effect:`background: #e01e5a; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,batch:`background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,resource:`background: #d97706; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,reactive:`background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`},l=null;function u(e){if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e==`object`)try{return JSON.stringify(e)}catch{return`[Cyclic Object or Layer]`}return String(e)}function d(e,t,n){l||(l={id:Math.random().toString(36).substring(2,9),pendingLogQueue:[],isFlushing:!1},queueMicrotask(()=>f())),l.pendingLogQueue.push({type:e,label:t,from:n?.from,to:n?.to,payload:n?.payload,timestamp:Date.now()})}function f(){if(!l||l.isFlushing)return;l.isFlushing=!0;let e=l.pendingLogQueue;if(e.length===0){l=null;return}console.groupCollapsed(`%cREACTIVE TRANSACTION%c [id: ${l.id}] (${e.length} operations)`,`background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;`,`color: #888; font-weight: normal;`);for(let t of e){let e=c[t.type],n=t.from!==void 0||t.to!==void 0,r=`%c${t.type.toUpperCase()}%c ${t.label}`;n&&(t.from?r+=`(${u(t.from)} → ${u(t.to)})`:r+=`(${u(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())}console.groupEnd(),l=null}var p=class{frameworkPrefix=`core`;logger;epoch=0;activeConsumer=null;batchDepth=0;subscriberId=0;pendingEffects=new Set;computedCache=new Map;diRegistry=new Map;diCache=new Map;proxyCache=new WeakMap;proxyTargets=new WeakSet;reactiveSignals=new WeakMap;cycleDetectionStack=new Set;constructor(e){this.logger=e?.logger||{isEnabled:!1}}queueLog(e,t,n){d(e,t,n)}flushEffects(){if(this.batchDepth>0)return;let e=Array.from(this.pendingEffects);this.pendingEffects.clear(),e.sort((e,t)=>(e.depth||0)-(t.depth||0)||e.id-t.id);let t=this.activeConsumer;try{for(let t of e)if(!t.isDisposed){if(t.dependencies&&t.dependencies.size>0)for(let e of t.dependencies){let t=e._node||e;if(t.type===`computed`&&t._isDirty&&t._isDirty())try{t.run()}catch(e){if(this.batchDepth===0)throw e}}if(t.isDirty)try{t.run()}catch(e){if(this.batchDepth===0)throw e}}}finally{this.activeConsumer=t}}batch(e){return i(this,e)}log({type:e,label:t,details:n,isInternalCoreSignal:r=!1}){let i=this.logger.isEnabled,a=this.logger.isCoreOptimizationDebugEnabled;i&&(r?a&&d(e,t,n):d(e,t,n))}signal(e,t){return r(this,e,t)}computed(e,t){return n(this,e,t)}effect(e,t){return s(this,e,t)}untrack(e){return a(this,e)}reactive(e,t){return o(this,e,t)}provide(e,t){this.diRegistry.set(e,t),this.diCache.delete(e)}inject(e){if(e==null)throw Error(`[DI Error] Token is empty`);if(this.diCache.has(e))return this.diCache.get(e);if(this.cycleDetectionStack.has(e))throw Error(`[DI Error] Cyclic dependency detected`);this.cycleDetectionStack.add(e);try{if(this.diRegistry.has(e)){let t=this.diRegistry.get(e);if(typeof t==`function`){if(t._isMockFunction){let n=t(this);return n===void 0?t:(this.diCache.set(e,n),n)}let n=t.toString();if(!(n.startsWith(`class `)||n.startsWith(`class{`)||t.prototype&&t.prototype.constructor===t&&!n.startsWith(`function`)&&!n.includes(`=>`))){let n=t(this);return this.diCache.set(e,n),n}return t}return t}if(typeof e==`function`){let t=new e(this);return this.diCache.set(e,t),t}throw Error(`[DI Error] Token not found`)}finally{this.cycleDetectionStack.delete(e)}}delay(e,t){return new Promise((n,r)=>{if(t.aborted)return r(new DOMException(`Aborted`,`AbortError`));let i=setTimeout(()=>{t.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(new DOMException(`Aborted`,`AbortError`))};t.addEventListener(`abort`,a,{once:!0})})}resource(e,n,r){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({data:null,loading:!0,error:null,isRetrying:!1},`[CORE_INTERNAL_SIGNAL=1]:resource:state:${a}`),d=e=>{this.log({type:`resource`,label:a,details:{to:e,from:u.value}}),u.value=e},f=async(n,r,i=!1)=>{if(r.aborted)return;let f=o.validateBeforeFetch?o.validateBeforeFetch(n):!0;if(f===!1){u.value={loading:!1,data:null,error:null,isRetrying:!1};return}if(typeof f==`string`){u.value={loading:!1,data:null,error:`Core internal stopper`,isRetrying:!1};return}if(l){let e=l(n);if(e===!1||typeof e==`string`){if(r.aborted)return;let t=typeof e==`string`?e:`Pre-fetch validation failed for resource`,n=i?null:this.untrack(()=>u.value.data);d({data:n,loading:!1,error:t,isRetrying:!1});return}}let p=i&&s?null:this.untrack(()=>u.value.data);d({data:p,loading:!0,error:null,isRetrying:!1});for(let i=0;i<=0;i++){if(r.aborted)return;let o=r;try{let t=await e(n,o);if(r.aborted)return;if(o.aborted)throw new DOMException(`The operation timed out.`,`TimeoutError`);if(c){let e=c(t);if(e===!1||typeof e==`string`){if(r.aborted)return;d({data:null,loading:!1,error:typeof e==`string`?e:`Validation failed`,isRetrying:!1});return}}if(r.aborted)return;d({data:t,loading:!1,error:null,isRetrying:!1});return}catch(e){if(r.aborted||e.name===`AbortError`&&r.aborted)return;let n=e.name===`TimeoutError`||e.name===`AbortError`||e.message?.includes(`timeout`),o=t({tested:[e.message],expectedKey:`THROW_CUSTOM_VALIDATION_ERROR_NO_RETRY`,valueType:`number`})?.[0]===`1`||!1,s=o&&t({tested:[e.message],expectedKey:`MESSAGE`,valueType:`string`})?.[0]||`Custom validation error`,c=o||e.name===`ValidationError`;if(i===0||c){if(r.aborted)return;let t=n?Error(`Request timed out after 1000ms`,{cause:e}):o?Error(s,{cause:e}):e;d({data:null,loading:!1,error:t instanceof Error?t.message:typeof t==`string`?t:`typeof finalError is ${typeof t}`,isRetrying:!1});return}else{if(r.aborted)return;let e=1e3*2**i;e=Math.min(e,3e5);let t=Math.random()*200;e+=t,d({data:u.value.data,loading:!0,error:null,isRetrying:!0}),console.warn(`[Resource Retry] "${a}" сбой по ${n?`таймауту`:`ошибке сети`}. Попытка ${i+1}/${i+1}...`);try{if(await this.delay(e,r),r.aborted)return}catch{return}}}}},p=null;return this.effect(()=>{let e=n?n.value:void 0,t=new AbortController;return p=t,this.untrack(()=>{f(e,t.signal,!0)}),()=>t.abort()},`[CORE_INTERNAL_SIGNAL=1]:effect`),{get data(){return u.value.data},get loading(){return u.value.loading},get error(){return u.value.error},get isRetrying(){return u.value.isRetrying},get value(){return u.value},refetch:()=>{p?.abort(),p=new AbortController,f(n?n.value:void 0,p.signal,!1)},subscribe:e=>u.subscribe(e)}}},m=class extends p{microtaskScheduled=!1;flushEffects(){try{super.flushEffects()}finally{this.pendingEffects.size===0&&(this.microtaskScheduled=!1)}}batch(e){this.batchDepth++;try{return e()}catch(e){throw this.batchDepth=0,this.microtaskScheduled=!1,this.flushEffects(),e}finally{this.batchDepth>0&&this.batchDepth--,this.batchDepth===0&&(this.microtaskScheduled=!1,this.flushEffects())}}},h=class extends m{autoLogQueue=[];isHardFlushScheduled=!1;queueLog(e,t,n){this.autoLogQueue.push({type:e,name:t,meta:n,timestamp:Date.now()}),this.isHardFlushScheduled||(this.isHardFlushScheduled=!0,queueMicrotask(()=>this.flushLogs()))}flushLogs(){this.isHardFlushScheduled=!1,this.autoLogQueue.length!==0&&(typeof process<`u`&&process.env.NODE_ENV!==`test`&&(console.group(`📊 [Autolog] Срез транзакций: ${this.autoLogQueue.length} операций`),this.autoLogQueue.forEach(e=>console.log(`[${e.type.toUpperCase()}] ${e.name}`,e.meta||``)),console.groupEnd()),this.autoLogQueue=[])}computed(e,t){let n=this,r=t||`unnamed_computed`,i=super.computed(e,t),a=!1,o={get value(){if(a)return i.value;let e=typeof performance<`u`?performance.now():0,t=i.value;return e&&n.queueLog(`computed`,r,{value:t,duration:`${(performance.now()-e).toFixed(3)}ms`}),t},subscribe:e=>i.subscribe(e),destroy(){a=!0,i.destroy()}};return`_node`in i&&Object.defineProperty(o,"_node",{value:i._node,enumerable:!1}),o}},g=class{engine;constructor(e){this.engine=e,this.onInit()}createNumericSignal(e,t){return this.engine.signal(e,{name:t,validate:e=>typeof e==`number`&&!isNaN(e)})}createComputed(e){return this.engine.computed(e)}createSignal(e,t){return this.engine.signal(e,t)}onInit(){}},_=g,v=class{engine;constructor(e){this.engine=e,setTimeout(()=>this.onInit(),0)}onInit(){}};e.AbstractService=g,e.BaseREService=_,e.BaseREServiceEnhanced=v,e.ReactiveEngine=m,e.ReactiveEngineAutolog=h,e.ReactiveEngineAutomatic=p,e.ReactiveEngineCore=p,e.flushLogs=f,e.queueLog=d});
|
|
13
13
|
//# sourceMappingURL=reactive-engine.umd.js.map
|