@pravosleva/reactive-engine 1.8.3-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 -158
- 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 -592
- 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/core.mjs
CHANGED
|
@@ -1,650 +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
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
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
|
-
|
|
95
|
+
if (this.batchDepth === 0) throw e;
|
|
88
96
|
}
|
|
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", s = { version: 0 };
|
|
94
|
-
return {
|
|
95
|
-
get value() {
|
|
96
|
-
if (n.activeConsumer) {
|
|
97
|
-
let e = n.activeConsumer;
|
|
98
|
-
if (!i.has(e)) {
|
|
99
|
-
i.add(e);
|
|
100
|
-
let t = () => {
|
|
101
|
-
i.delete(e);
|
|
102
|
-
};
|
|
103
|
-
t._sourceNode = s, e.cleanups.add(t);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return r;
|
|
107
|
-
},
|
|
108
|
-
set value(e) {
|
|
109
|
-
if (a?.validate) {
|
|
110
|
-
let t = a.validate(e);
|
|
111
|
-
if (t !== !0) {
|
|
112
|
-
console.error(`[Reactive Engine: Validation Error] ${t}`);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if ((e === null || typeof e != "object" && typeof e != "function") && r === e) return;
|
|
117
|
-
let t = r;
|
|
118
|
-
r = e, s.version++, n.onSignalChange?.(o, e, t), Array.from(i).forEach((e) => {
|
|
119
|
-
e !== n.activeConsumer && e.markDirty();
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
subscribe(e) {
|
|
123
|
-
return n.effect(() => e(this.value), `use:${o}`);
|
|
124
97
|
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
batch(e) {
|
|
128
|
-
this.batchDepth++;
|
|
129
|
-
try {
|
|
130
|
-
e();
|
|
131
98
|
} finally {
|
|
132
|
-
this.
|
|
99
|
+
this.activeConsumer = t;
|
|
133
100
|
}
|
|
134
101
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.pendingEffects.clear(), e.forEach((e) => {
|
|
138
|
-
try {
|
|
139
|
-
e.run();
|
|
140
|
-
} catch (e) {
|
|
141
|
-
console.error("[Reactive Engine: Effect Execution Error]", e);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
102
|
+
batch(e) {
|
|
103
|
+
return r(this, e);
|
|
144
104
|
}
|
|
145
|
-
|
|
146
|
-
let
|
|
147
|
-
|
|
148
|
-
try {
|
|
149
|
-
return e();
|
|
150
|
-
} finally {
|
|
151
|
-
this.activeConsumer = t;
|
|
152
|
-
}
|
|
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));
|
|
153
108
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
factories = /* @__PURE__ */ new Map();
|
|
157
|
-
proxyCache = /* @__PURE__ */ new WeakMap();
|
|
158
|
-
loggerOptions;
|
|
159
|
-
pendingLogQueue = [];
|
|
160
|
-
signalMutationCounts = /* @__PURE__ */ new Map();
|
|
161
|
-
lastComputedDurations = /* @__PURE__ */ new Map();
|
|
162
|
-
effectExecutionCounts = /* @__PURE__ */ new Map();
|
|
163
|
-
batchTickCounts = 0;
|
|
164
|
-
lastTransactionDuration = null;
|
|
165
|
-
constructor(e) {
|
|
166
|
-
super(), this.loggerOptions = e?.logger;
|
|
109
|
+
signal(e, t) {
|
|
110
|
+
return n(this, e, t);
|
|
167
111
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
typeof window < "u" && (window.__VUE__ || globalThis.__VUE__ || e.toString().includes("triggerRef")) ? t || (t = !0, queueMicrotask(() => {
|
|
181
|
-
t = !1, e();
|
|
182
|
-
})) : e();
|
|
183
|
-
}, "framework-proxy-internal-subscription");
|
|
184
|
-
};
|
|
185
|
-
if (n.activeConsumer) {
|
|
186
|
-
let e = n.activeConsumer;
|
|
187
|
-
r.has(o) || r.set(o, /* @__PURE__ */ new Map());
|
|
188
|
-
let t = r.get(o);
|
|
189
|
-
if (!t.has(e)) {
|
|
190
|
-
let n = () => {
|
|
191
|
-
t.delete(e);
|
|
192
|
-
};
|
|
193
|
-
t.set(e, n), e.cleanups.add(n);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (Array.isArray(e) && typeof o == "string" && [
|
|
197
|
-
"push",
|
|
198
|
-
"pop",
|
|
199
|
-
"shift",
|
|
200
|
-
"unshift",
|
|
201
|
-
"splice",
|
|
202
|
-
"sort",
|
|
203
|
-
"reverse"
|
|
204
|
-
].includes(o)) {
|
|
205
|
-
let t = e[o];
|
|
206
|
-
return function(...a) {
|
|
207
|
-
n.batchDepth++, i = !0;
|
|
208
|
-
let s = t.apply(e, a);
|
|
209
|
-
return i = !1, r.forEach((e, t) => {
|
|
210
|
-
t !== o && Array.from(e.keys()).forEach((e) => {
|
|
211
|
-
e !== n.activeConsumer && e.markDirty();
|
|
212
|
-
});
|
|
213
|
-
}), n.batchDepth--, n.batchDepth === 0 && n.flushEffects(), s;
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
let c = Reflect.get(e, o, s);
|
|
217
|
-
return typeof c == "object" && c ? n.reactive(c, `${t}.${String(o)}`) : c;
|
|
218
|
-
},
|
|
219
|
-
set(e, a, o, s) {
|
|
220
|
-
let c = Reflect.get(e, a, s);
|
|
221
|
-
if (c === o || (Reflect.set(e, a, o, s), n.onSignalChange?.(`${t}.${String(a)}`, o, c), i)) return !0;
|
|
222
|
-
let l = r.get(a), u = l ? Array.from(l.keys()) : [];
|
|
223
|
-
if (Array.isArray(e)) {
|
|
224
|
-
let e = r.get("length");
|
|
225
|
-
e && u.push(...Array.from(e.keys()));
|
|
226
|
-
}
|
|
227
|
-
return u.forEach((e) => {
|
|
228
|
-
e !== n.activeConsumer && e.markDirty();
|
|
229
|
-
}), typeof n.queueLog == "function" && n.queueLog("reactive", `${t}.${String(a)}`, {
|
|
230
|
-
action: "set",
|
|
231
|
-
property: String(a),
|
|
232
|
-
oldValue: c,
|
|
233
|
-
newValue: o
|
|
234
|
-
}), !0;
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
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);
|
|
238
123
|
}
|
|
239
124
|
provide(e, t) {
|
|
240
|
-
|
|
125
|
+
this.diRegistry.set(e, t), this.diCache.delete(e);
|
|
241
126
|
}
|
|
242
127
|
inject(e) {
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
if (this.
|
|
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);
|
|
246
132
|
try {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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;
|
|
251
148
|
}
|
|
252
|
-
if (typeof e == "function"
|
|
253
|
-
let
|
|
254
|
-
return this.
|
|
149
|
+
if (typeof e == "function") {
|
|
150
|
+
let t = new e(this);
|
|
151
|
+
return this.diCache.set(e, t), t;
|
|
255
152
|
}
|
|
256
|
-
throw Error(
|
|
257
|
-
}
|
|
258
|
-
|
|
153
|
+
throw Error("[DI Error] Token not found");
|
|
154
|
+
} finally {
|
|
155
|
+
this.cycleDetectionStack.delete(e);
|
|
259
156
|
}
|
|
260
157
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
+
});
|
|
270
168
|
}
|
|
271
|
-
resource(
|
|
272
|
-
let
|
|
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({
|
|
273
171
|
data: null,
|
|
274
172
|
loading: !0,
|
|
275
173
|
error: null,
|
|
276
174
|
isRetrying: !1
|
|
277
|
-
}, `resource:state:${
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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,
|
|
284
214
|
isRetrying: !1
|
|
285
|
-
};
|
|
286
|
-
|
|
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;
|
|
287
229
|
try {
|
|
288
|
-
let
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
|
296
252
|
});
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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({
|
|
300
269
|
data: null,
|
|
301
270
|
loading: !1,
|
|
302
|
-
error: e
|
|
271
|
+
error: e instanceof Error ? e.message : typeof e == "string" ? e : `typeof finalError is ${typeof e}`,
|
|
303
272
|
isRetrying: !1
|
|
304
|
-
};
|
|
305
|
-
|
|
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
|
+
}
|
|
306
292
|
}
|
|
307
293
|
}
|
|
308
|
-
};
|
|
294
|
+
}, p = null;
|
|
309
295
|
return this.effect(() => {
|
|
310
|
-
let e =
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
};
|
|
314
|
-
}), {
|
|
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"), {
|
|
315
301
|
get data() {
|
|
316
|
-
return
|
|
302
|
+
return u.value.data;
|
|
317
303
|
},
|
|
318
304
|
get loading() {
|
|
319
|
-
return
|
|
305
|
+
return u.value.loading;
|
|
320
306
|
},
|
|
321
307
|
get error() {
|
|
322
|
-
return
|
|
323
|
-
},
|
|
324
|
-
get value() {
|
|
325
|
-
return i.value;
|
|
308
|
+
return u.value.error;
|
|
326
309
|
},
|
|
327
|
-
|
|
328
|
-
|
|
310
|
+
get isRetrying() {
|
|
311
|
+
return u.value.isRetrying;
|
|
329
312
|
},
|
|
330
|
-
subscribe: (e) => i.subscribe(e)
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
}, n = class extends t {
|
|
334
|
-
isFlushScheduled = !1;
|
|
335
|
-
nodeDepths = /* @__PURE__ */ new WeakMap();
|
|
336
|
-
constructor(e) {
|
|
337
|
-
super(e), this.frameworkPrefix = "auto-core";
|
|
338
|
-
}
|
|
339
|
-
computed(e, t) {
|
|
340
|
-
let n = this;
|
|
341
|
-
if (n.computedCache.has(e)) {
|
|
342
|
-
let t = n.computedCache.get(e)?.deref();
|
|
343
|
-
if (t) return t;
|
|
344
|
-
}
|
|
345
|
-
let r = t || "unnamed_auto_computed", i, a = !1, o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), c = {
|
|
346
|
-
id: ++n.subscriberId,
|
|
347
|
-
isDirty: !0,
|
|
348
|
-
cleanups: /* @__PURE__ */ new Set(),
|
|
349
|
-
markDirty() {
|
|
350
|
-
this.isDirty || (this.isDirty = !0, Array.from(o).forEach((e) => {
|
|
351
|
-
e !== n.activeConsumer && e.markDirty();
|
|
352
|
-
}));
|
|
353
|
-
}
|
|
354
|
-
}, l = {
|
|
355
313
|
get value() {
|
|
356
|
-
|
|
357
|
-
let e = n.activeConsumer;
|
|
358
|
-
o.has(e) || (o.add(e), e.cleanups.add(() => o.delete(e)));
|
|
359
|
-
}
|
|
360
|
-
if (c.isDirty && a) {
|
|
361
|
-
let e = !1;
|
|
362
|
-
for (let [t, n] of s.entries()) if (t.version !== n) {
|
|
363
|
-
e = !0;
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
e || (c.isDirty = !1);
|
|
367
|
-
}
|
|
368
|
-
if (c.isDirty || !a) {
|
|
369
|
-
let t = Array.from(c.cleanups);
|
|
370
|
-
c.cleanups.clear(), t.forEach((e) => e());
|
|
371
|
-
let r = n.activeConsumer;
|
|
372
|
-
n.activeConsumer = c;
|
|
373
|
-
try {
|
|
374
|
-
i = e(), c.isDirty = !1, a = !0, s.clear(), c.cleanups.forEach((e) => {
|
|
375
|
-
if (e && typeof e == "function") {
|
|
376
|
-
let t = n.allEffects?.has(e) || e._sourceNode;
|
|
377
|
-
t && s.set(t, t.version || 0);
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
} finally {
|
|
381
|
-
n.activeConsumer = r;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return i;
|
|
314
|
+
return u.value;
|
|
385
315
|
},
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
let t = Array.from(c.cleanups);
|
|
389
|
-
c.cleanups.clear(), t.forEach((e) => e()), o.clear(), s.clear(), n.computedCache.delete(e);
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
return n.computedCache.set(e, new WeakRef(l)), l;
|
|
393
|
-
}
|
|
394
|
-
getNodeDepth(e) {
|
|
395
|
-
return e ? this.nodeDepths.has(e) ? this.nodeDepths.get(e) : 1 : 0;
|
|
396
|
-
}
|
|
397
|
-
effect(e, t) {
|
|
398
|
-
let n = this, r = n.activeConsumer, i = {
|
|
399
|
-
id: ++n.subscriberId,
|
|
400
|
-
label: t,
|
|
401
|
-
cleanups: /* @__PURE__ */ new Set(),
|
|
402
|
-
markDirty() {
|
|
403
|
-
n.pendingEffects.add(i), n.flushEffects();
|
|
404
|
-
},
|
|
405
|
-
run() {
|
|
406
|
-
let t = Array.from(i.cleanups);
|
|
407
|
-
i.cleanups.clear(), t.forEach((e) => {
|
|
408
|
-
try {
|
|
409
|
-
e();
|
|
410
|
-
} catch (e) {
|
|
411
|
-
console.error("[Reactive Engine:Cleanup Error]", e);
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
let r = n.activeConsumer;
|
|
415
|
-
n.activeConsumer = i;
|
|
416
|
-
let a = n.getNodeDepth(r) + 1;
|
|
417
|
-
n.nodeDepths.set(i, a);
|
|
418
|
-
try {
|
|
419
|
-
let t = e();
|
|
420
|
-
typeof t == "function" && i.cleanups.add(t);
|
|
421
|
-
} finally {
|
|
422
|
-
n.activeConsumer = r;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
return r && r.cleanups.add(() => {
|
|
427
|
-
Array.from(i.cleanups).forEach((e) => {
|
|
428
|
-
try {
|
|
429
|
-
e();
|
|
430
|
-
} catch {}
|
|
431
|
-
}), i.cleanups.clear(), n.pendingEffects.delete(i), n.allEffects.delete(i);
|
|
432
|
-
}), n.allEffects.add(i), i.run(), () => {
|
|
433
|
-
Array.from(i.cleanups).forEach((e) => {
|
|
434
|
-
try {
|
|
435
|
-
e();
|
|
436
|
-
} catch {}
|
|
437
|
-
}), i.cleanups.clear(), n.pendingEffects.delete(i), n.allEffects.delete(i);
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
flushEffects() {
|
|
441
|
-
this.batchDepth > 0 || this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => {
|
|
442
|
-
this.isFlushScheduled = !1;
|
|
443
|
-
let e = 0;
|
|
444
|
-
for (; this.pendingEffects.size > 0 && e < 100;) {
|
|
445
|
-
e++;
|
|
446
|
-
let t = Array.from(this.pendingEffects).sort((e, t) => this.getNodeDepth(e) - this.getNodeDepth(t) || e.id - t.id);
|
|
447
|
-
this.pendingEffects.clear(), t.forEach((e) => {
|
|
448
|
-
try {
|
|
449
|
-
e.run();
|
|
450
|
-
} catch (e) {
|
|
451
|
-
console.error("[Reactive Engine Automatic: Effect Error]", e);
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
e >= 100 && console.warn("[Reactive Engine Automatic] Превышен лимит схождения графа. Обнаружен бесконечный цикл мутаций.");
|
|
456
|
-
}));
|
|
457
|
-
}
|
|
458
|
-
}, r = class extends n {
|
|
459
|
-
autoLogQueue = [];
|
|
460
|
-
isHardFlushScheduled = !1;
|
|
461
|
-
constructor(e) {
|
|
462
|
-
let t = {
|
|
463
|
-
...e,
|
|
464
|
-
logger: {
|
|
465
|
-
isEnabled: !0,
|
|
466
|
-
traceTime: !0,
|
|
467
|
-
isCoreOptimizationDebugEnabled: !0,
|
|
468
|
-
instanceName: e?.logger?.instanceName || "AUTOMATIC_HARD_CORE",
|
|
469
|
-
filter: e?.logger?.filter
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
super(t), this.frameworkPrefix = "auto-hard-core";
|
|
473
|
-
}
|
|
474
|
-
queueLog(e, t, n) {
|
|
475
|
-
this.autoLogQueue.push({
|
|
476
|
-
type: e,
|
|
477
|
-
name: t,
|
|
478
|
-
detail: n
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
flushLogs() {
|
|
482
|
-
if (this.autoLogQueue.length === 0) return;
|
|
483
|
-
let e = {
|
|
484
|
-
signal: "background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
|
|
485
|
-
computed: "background: #42b883; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
|
|
486
|
-
effect: "background: #e01e5a; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
|
|
487
|
-
batch: "background: #7952b3; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
|
|
488
|
-
resource: "background: #d97706; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;",
|
|
489
|
-
reactive: "background: #007acc; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: bold;"
|
|
490
|
-
};
|
|
491
|
-
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) => {
|
|
492
|
-
let n = "";
|
|
493
|
-
if (t.type === "signal") {
|
|
494
|
-
let e = t.detail;
|
|
495
|
-
n = ` 🔄 Изменение: [${String(e.from)} -> ${String(e.to)}]`;
|
|
496
|
-
} else if (t.type === "computed") n = ` 🧮 Расчет кэша (${t.detail.duration})`;
|
|
497
|
-
else if (t.type === "effect") {
|
|
498
|
-
let e = t.detail;
|
|
499
|
-
n = e?.isTriggered ? ` ⚡️ Ререндер/Вызов (${e.duration || "0ms"})` : " 🟢 Инициализация подписки";
|
|
500
|
-
} else if (t.type === "resource") {
|
|
501
|
-
let e = t.detail;
|
|
502
|
-
n = e.loading ? " ⏳ ЗАГРУЗКА СЕТИ" : e.error ? " 🔴 ОШИБКА" : " 🟢 УСПЕШНО ОТВЕТИЛ";
|
|
503
|
-
}
|
|
504
|
-
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();
|
|
505
|
-
}), console.groupEnd(), this.autoLogQueue = [];
|
|
506
|
-
}
|
|
507
|
-
flushEffects() {
|
|
508
|
-
this.batchDepth > 0 || this.isHardFlushScheduled || (this.isHardFlushScheduled = !0, queueMicrotask(() => {
|
|
509
|
-
this.isHardFlushScheduled = !1, this.flushLogs(), super.flushEffects();
|
|
510
|
-
}));
|
|
511
|
-
}
|
|
512
|
-
effect(e, t) {
|
|
513
|
-
let n = this, r = t || "unnamed_effect", i = !0;
|
|
514
|
-
n.queueLog("effect", r, {
|
|
515
|
-
isTriggered: !1,
|
|
516
|
-
phase: "mount"
|
|
517
|
-
});
|
|
518
|
-
let a = {
|
|
519
|
-
id: ++n.subscriberId,
|
|
520
|
-
label: r,
|
|
521
|
-
cleanups: /* @__PURE__ */ new Set(),
|
|
522
|
-
markDirty() {
|
|
523
|
-
n.pendingEffects.add(a), n.flushEffects();
|
|
524
|
-
},
|
|
525
|
-
run() {
|
|
526
|
-
let t = typeof performance < "u" ? performance.now() : 0, o = Array.from(a.cleanups);
|
|
527
|
-
a.cleanups.clear(), o.forEach((e) => {
|
|
528
|
-
try {
|
|
529
|
-
e();
|
|
530
|
-
} catch (e) {
|
|
531
|
-
console.error("[Reactive Engine:Cleanup Error]", e);
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
let s = n.activeConsumer;
|
|
535
|
-
n.activeConsumer = a;
|
|
536
|
-
try {
|
|
537
|
-
let t = e();
|
|
538
|
-
typeof t == "function" && a.cleanups.add(t);
|
|
539
|
-
} finally {
|
|
540
|
-
if (n.activeConsumer = s, !i && t && typeof n.queueLog == "function") {
|
|
541
|
-
let e = performance.now() - t;
|
|
542
|
-
n.queueLog("effect", r, {
|
|
543
|
-
isTriggered: !0,
|
|
544
|
-
phase: "update",
|
|
545
|
-
duration: `${e.toFixed(3)}ms`
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
i = !1;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
return n.allEffects.add(a), a.run(), () => {
|
|
553
|
-
Array.from(a.cleanups).forEach((e) => {
|
|
554
|
-
try {
|
|
555
|
-
e();
|
|
556
|
-
} catch (e) {
|
|
557
|
-
console.error("[Reactive Engine:Dispose Cleanup Error]", e);
|
|
558
|
-
}
|
|
559
|
-
}), a.cleanups.clear(), n.pendingEffects.delete(a), n.allEffects.delete(a), n.queueLog("effect", r, { phase: "unmount" });
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
resource(e, t, n) {
|
|
563
|
-
let r = n && typeof n == "object" ? n.name : n || "unnamed_resource", i = this;
|
|
564
|
-
return super.resource(async (t, n) => {
|
|
565
|
-
i.queueLog("resource", r, {
|
|
566
|
-
loading: !0,
|
|
567
|
-
error: null,
|
|
568
|
-
data: null
|
|
569
|
-
});
|
|
570
|
-
try {
|
|
571
|
-
let a = await e(t, n);
|
|
572
|
-
return i.queueLog("resource", r, {
|
|
573
|
-
loading: !1,
|
|
574
|
-
error: null,
|
|
575
|
-
data: a
|
|
576
|
-
}), a;
|
|
577
|
-
} catch (e) {
|
|
578
|
-
throw i.queueLog("resource", r, {
|
|
579
|
-
loading: !1,
|
|
580
|
-
error: e,
|
|
581
|
-
data: null
|
|
582
|
-
}), e;
|
|
583
|
-
}
|
|
584
|
-
}, t, n);
|
|
585
|
-
}
|
|
586
|
-
reactive(e, t = "reactive") {
|
|
587
|
-
let n = this, r = super.reactive(e, t);
|
|
588
|
-
return new Proxy(r, {
|
|
589
|
-
get(e, r, i) {
|
|
590
|
-
let a = Reflect.get(e, r, i);
|
|
591
|
-
return typeof a == "object" && a ? n.reactive(a, `${t}.${String(r)}`) : a;
|
|
592
|
-
},
|
|
593
|
-
set(e, r, i, a) {
|
|
594
|
-
let o = Reflect.get(e, r, a);
|
|
595
|
-
return o === i ? !0 : (n.queueLog("signal", `${t}.${String(r)}`, {
|
|
596
|
-
from: o,
|
|
597
|
-
to: i,
|
|
598
|
-
subscribersCount: 0,
|
|
599
|
-
subscribers: ["framework-reactive-proxy-subscriber"]
|
|
600
|
-
}), Reflect.set(e, r, i, a));
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
signal(e, t) {
|
|
605
|
-
let n = this, r = (typeof t == "string" ? { name: t } : t || {}).name || "unnamed_signal", i = super.signal(e, t);
|
|
606
|
-
return {
|
|
607
|
-
get value() {
|
|
608
|
-
return i.value;
|
|
609
|
-
},
|
|
610
|
-
set value(e) {
|
|
611
|
-
let t = i.value;
|
|
612
|
-
if ((e === null || typeof e != "object" && typeof e != "function") && t === e) return;
|
|
613
|
-
let a = n.activeConsumer, o = a && "label" in a && typeof a.label == "string" ? a.label : "unnamed_effect";
|
|
614
|
-
n.queueLog("signal", r, {
|
|
615
|
-
from: t,
|
|
616
|
-
to: e,
|
|
617
|
-
subscribersCount: 0,
|
|
618
|
-
subscribers: [o]
|
|
619
|
-
}), i.value = e;
|
|
620
|
-
},
|
|
621
|
-
subscribe(e) {
|
|
622
|
-
return i.subscribe(e);
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
computed(e, t) {
|
|
627
|
-
let n = this, r = t || "unnamed_computed", i = super.computed(e, t);
|
|
628
|
-
return {
|
|
629
|
-
get value() {
|
|
630
|
-
let e = typeof performance < "u" ? performance.now() : 0, t = i.value;
|
|
631
|
-
if (e) {
|
|
632
|
-
let i = performance.now() - e;
|
|
633
|
-
n.queueLog("computed", r, {
|
|
634
|
-
value: t,
|
|
635
|
-
duration: `${i.toFixed(3)}ms`
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
return t;
|
|
316
|
+
refetch: () => {
|
|
317
|
+
p?.abort(), p = new AbortController(), f(n ? n.value : void 0, p.signal, !1);
|
|
639
318
|
},
|
|
640
|
-
subscribe: (e) =>
|
|
641
|
-
destroy() {
|
|
642
|
-
i.destroy();
|
|
643
|
-
}
|
|
319
|
+
subscribe: (e) => u.subscribe(e)
|
|
644
320
|
};
|
|
645
321
|
}
|
|
646
322
|
};
|
|
647
323
|
//#endregion
|
|
648
|
-
export {
|
|
324
|
+
export { f as ReactiveEngine, f as ReactiveEngineAutomatic, f as ReactiveEngineCore, d as flushLogs, u as queueLog };
|
|
649
325
|
|
|
650
326
|
//# sourceMappingURL=core.mjs.map
|