effector-vue
Advanced tools
Comparing version 21.1.1 to 22.0.0
import {DeepReadonly, Ref, UnwrapRef} from '@vue/reactivity' | ||
import {Domain, Store, Event} from 'effector' | ||
type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRef<T> | ||
type GateConfig<T> = { | ||
@@ -20,5 +18,5 @@ name?: string; | ||
export function useStore<T>(store: Store<T>): DeepReadonly<UnwrapNestedRefs<T>> | ||
export function useStore<T>(store: Store<T>): DeepReadonly<Ref<T>> | ||
export function useVModel<T>(store: Store<T>): Ref<UnwrapRef<T>> | ||
export function createGate<Props>(config?: GateConfig<Props>): Gate<Props> | ||
export function useGate<Props>(GateComponent: Gate<Props>, cb?: () => Props): void |
@@ -1,2 +0,2 @@ | ||
function e(e){let t=n.unref(e);return n.isReactive(t)?n.toRaw(t):t}function t(e,o=[]){if(null===e||'object'!=typeof e)return e;let n=o.filter((t=>t.original===e))[0];if(n)return n.copy;let a=Array.isArray(e)?[]:{};return o.push({original:e,copy:a}),Object.keys(e).forEach((n=>{a[n]=t(e[n],o)})),a}function o(o,a){let r,l;a&&(l=n.computed(a),r=n.watch(l,(n=>{let a=e(n);o.set(t(a))}),{deep:1,immediate:1})),n.onMounted((()=>{let n=e(l);o.open(t(n))})),n.onUnmounted((()=>{let n=e(l);o.close(t(n)),r&&r()}))}Object.defineProperty(exports,'__esModule',{value:1});var n=require('vue'),effector=require('effector');exports.createGate=e=>{function t(e){o(t,(()=>e))}var n;let a=effector.createStore(null!==(n=null==e?void 0:e.defaultState)&&void 0!==n?n:null,{named:'state'}),r=effector.createStore(Boolean(0),{named:'status'}),{set:l}=effector.createApi(a,{set:(e,t)=>t}),{open:u,close:s}=effector.createApi(r,{open:()=>Boolean(1),close:()=>Boolean(0)});if(t.open=u,t.close=s,t.status=r,t.state=a,t.set=l,a.reset(s),null==e?void 0:e.domain){let{hooks:t}=e.domain;effector.launch({target:[t.store,t.store,t.event,t.event,t.event],params:[r,a,u,s,l]})}return t},exports.useGate=o,exports.useStore=e=>{let t,o=n.shallowRef(e.getState());return n.onMounted((()=>{t=e.updates.watch((e=>{o.value=n.shallowRef(e).value}))})),n.onUnmounted((()=>{t()})),n.readonly(o)},exports.useVModel=o=>{let a,r=n.ref(t(o.getState())),l=0,u=0;return n.onMounted((()=>{a=o.updates.watch((e=>{l||(u=1,r.value=n.ref(t(e)).value)}))})),n.onUnmounted((()=>{a()})),n.watch((()=>r.value),(a=>{if(l=1,!u){let r=n.ref(e(a)).value;o.setState(t(r))}u=0,l=0}),{deep:1,immediate:0}),r}; | ||
function e(e){let t=a.unref(e);return a.isReactive(t)?a.toRaw(t):t}function t(e,o=[]){if(null===e||'object'!=typeof e)return e;let a=o.filter((t=>t.original===e))[0];if(a)return a.copy;let r=Array.isArray(e)?[]:{};return o.push({original:e,copy:r}),Object.keys(e).forEach((a=>{r[a]=t(e[a],o)})),r}function o(o,r){let n,l;r&&(l=a.computed(r),n=a.watch(l,(a=>{let r=e(a);o.set(t(r))}),{deep:1,immediate:1})),a.onMounted((()=>{let a=e(l);o.open(t(a))})),a.onUnmounted((()=>{let a=e(l);o.close(t(a)),n&&n()}))}Object.defineProperty(exports,'__esModule',{value:1});var a=require('vue'),effector=require('effector');exports.createGate=e=>{function t(e){o(t,(()=>e))}var a;let r=effector.createStore(null!==(a=null==e?void 0:e.defaultState)&&void 0!==a?a:null,{named:'state'}),n=effector.createStore(Boolean(0),{named:'status'}),{set:l}=effector.createApi(r,{set:(e,t)=>t}),{open:u,close:s}=effector.createApi(n,{open:()=>Boolean(1),close:()=>Boolean(0)});if(t.open=u,t.close=s,t.status=n,t.state=r,t.set=l,r.reset(s),null!=e&&e.domain){let{hooks:t}=e.domain;effector.launch({target:[t.store,t.store,t.event,t.event,t.event],params:[n,r,u,s,l]})}return t},exports.useGate=o,exports.useStore=e=>{let t=a.shallowRef(e.getState()),o=e.updates.watch((e=>{t.value=a.shallowRef(e).value}));return a.onUnmounted((()=>{o()})),a.readonly(t)},exports.useVModel=o=>{let r=a.ref(t(o.getState())),n=0,l=0,u=o.updates.watch((e=>{n||(l=1,r.value=a.ref(t(e)).value)}));return a.onUnmounted((()=>{u()})),a.watch((()=>r.value),(r=>{if(n=1,!l){let n=a.ref(e(r)).value;o.setState(t(n))}l=0,n=0}),{deep:1,immediate:0}),r}; | ||
//# sourceMappingURL=composition.cjs.js.map |
import {DeepReadonly, Ref, UnwrapRef} from '@vue/reactivity' | ||
import {Domain, Store, Event} from 'effector' | ||
type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRef<T> | ||
type GateConfig<T> = { | ||
@@ -20,5 +18,5 @@ name?: string; | ||
export function useStore<T>(store: Store<T>): DeepReadonly<UnwrapNestedRefs<T>> | ||
export function useStore<T>(store: Store<T>): DeepReadonly<Ref<T>> | ||
export function useVModel<T>(store: Store<T>): Ref<UnwrapRef<T>> | ||
export function createGate<Props>(config?: GateConfig<Props>): Gate<Props> | ||
export function useGate<Props>(GateComponent: Gate<Props>, cb?: () => Props): void |
import {DeepReadonly, Ref, UnwrapRef} from '@vue/reactivity' | ||
import {Domain, Store, Event} from 'effector' | ||
type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRef<T> | ||
type GateConfig<T> = { | ||
@@ -20,5 +18,5 @@ name?: string; | ||
export function useStore<T>(store: Store<T>): DeepReadonly<UnwrapNestedRefs<T>> | ||
export function useStore<T>(store: Store<T>): DeepReadonly<Ref<T>> | ||
export function useVModel<T>(store: Store<T>): Ref<UnwrapRef<T>> | ||
export function createGate<Props>(config?: GateConfig<Props>): Gate<Props> | ||
export function useGate<Props>(GateComponent: Gate<Props>, cb?: () => Props): void |
{ | ||
"name": "effector-vue", | ||
"version": "21.1.1", | ||
"version": "22.0.0", | ||
"description": "Vue bindings for effector", | ||
@@ -9,2 +9,3 @@ "main": "effector-vue.cjs.js", | ||
".": { | ||
"import": "./effector-vue.mjs", | ||
"require": "./effector-vue.cjs.js", | ||
@@ -14,2 +15,3 @@ "default": "./effector-vue.mjs" | ||
"./composition": { | ||
"import": "./composition.mjs", | ||
"require": "./composition.cjs.js", | ||
@@ -28,3 +30,3 @@ "default": "./composition.mjs" | ||
"vue": "*", | ||
"effector": "^21.0.2", | ||
"effector": "^22.0.0", | ||
"@vue/reactivity": "^3.0.2", | ||
@@ -88,3 +90,3 @@ "@vue/runtime-core": "^3.0.2" | ||
"repository": "https://github.com/effector/effector", | ||
"bugs": "https://github.com/effector/effector/issues", | ||
"bugs": "https://github.com/effector/effector/issues?q=is:issue+label:effector-vue", | ||
"homepage": "https://effector.dev", | ||
@@ -91,0 +93,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
69093
697