effector-vue
Advanced tools
Comparing version 20.2.1 to 20.3.0
@@ -1,2 +0,2 @@ | ||
'use strict';function e(e,t){void 0===t&&(t={immediate:1});var r=this,o=i.createEvent(),n=i.createStore({});n.on(o,function(e,t){return t});var u=function(){r.$watch(e,function(e,t){o({oldValue:t,newValue:e})},t)};return r._data?u():r.$once('hook:created',u),n}function t(e){return this.$watchAsStore(e).map(function(e){return e.newValue})}Object.defineProperty(exports,'__esModule',{value:1});var r,o=(r=require('vue'))&&'object'==typeof r&&'default'in r?r.default:r,i=require('effector/compat'),n={created:function(){var e=this,t=e.$options.effector;if('function'==typeof t&&(t=t.call(e)),t)if(i.is.store(t))o.util.defineReactive(e,"state",t.getState()),e._subscription=t.subscribe(function(t){e.state=t});else{if('object'!=typeof t||null===t)throw Error('property should be Store');var r=i.createStoreObject(t);for(var n in t)o.util.defineReactive(e,n,r.defaultState[n]);e._subscription=r.subscribe(function(t){for(var r in t)e[r]=t[r]})}},beforeDestroy:function(){this._subscription&&this._subscription.unsubscribe()}};exports.VueEffector=function(r){r.mixin(n),r.prototype.$watchAsStore=e,r.prototype.$store=t}; | ||
'use strict';function e(e,t){void 0===t&&(t={immediate:1});var r=this,o=n.createEvent(),i=n.createStore({});i.on(o,function(e,t){return t});var c=function(){r.$watch(e,function(e,t){o({oldValue:t,newValue:e})},t)};return r._data?c():r.$once('hook:created',c),i}function t(e){return this.$watchAsStore(e).map(function(e){return e.newValue})}Object.defineProperty(exports,'__esModule',{value:1});var r,o=(r=require('vue'))&&'object'==typeof r&&'default'in r?r.default:r,n=require('effector/compat'),i={created:function(){var e=this,t=e.$options.effector;if('function'==typeof t&&(t=t.call(e)),t)if(n.is.store(t))o.util.defineReactive(e,"state",t.getState()),e._subscription=t.subscribe(function(t){e.state=t});else{if('object'!=typeof t||null===t)throw Error('property should be Store');var r=n.createStoreObject(t);for(var i in t)o.util.defineReactive(e,i,r.defaultState[i]);e._subscription=r.subscribe(function(t){for(var r in t)e[r]=t[r]})}},beforeDestroy:function(){this._subscription&&this._subscription.unsubscribe()}};exports.VueEffector=function(r){r.mixin(i),r.prototype.$watchAsStore=e,r.prototype.$store=t},exports.createComponent=function(e,t){return o.extend(Object.assign({},e,t&&{effector:function(){return t}}))}; | ||
//# sourceMappingURL=compat.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e,t={immediate:1}){const o=this,r=effector.createEvent(),i=effector.createStore({});let s;i.on(r,(e,t)=>t);const c=()=>{s=o.$watch(e,(e,t)=>{r({oldValue:t,newValue:e})},t)};return o._data?c():o.$once('hook:created',c),i}function t(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}Object.defineProperty(exports,'__esModule',{value:1});var o,r=(o=require('vue'))&&'object'==typeof o&&'default'in o?o.default:o,effector=require('effector');const i={created(){const e=this;let t=e.$options.effector;if('function'==typeof t&&(t=t.call(e)),t)if(effector.is.store(t))r.util.defineReactive(e,"state",t.getState()),e._subscription=t.subscribe(t=>{e.state=t});else{if('object'!=typeof t||null===t)throw Error('property should be Store');{const o=effector.createStoreObject(t);for(const i in t)r.util.defineReactive(e,i,o.defaultState[i]);e._subscription=o.subscribe(t=>{for(const o in t)e[o]=t[o]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}};exports.VueEffector=o=>{o.mixin(i),o.prototype.$watchAsStore=e,o.prototype.$store=t}; | ||
function e(e,t={immediate:1}){const o=this,r=effector.createEvent(),s=effector.createStore({});let i;s.on(r,(e,t)=>t);const c=()=>{i=o.$watch(e,(e,t)=>{r({oldValue:t,newValue:e})},t)};return o._data?c():o.$once('hook:created',c),s}function t(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}Object.defineProperty(exports,'__esModule',{value:1});var o,r=(o=require('vue'))&&'object'==typeof o&&'default'in o?o.default:o,effector=require('effector');const s={created(){const e=this;let t=e.$options.effector;if('function'==typeof t&&(t=t.call(e)),t)if(effector.is.store(t))r.util.defineReactive(e,"state",t.getState()),e._subscription=t.subscribe(t=>{e.state=t});else{if('object'!=typeof t||null===t)throw Error('property should be Store');{const o=effector.createStoreObject(t);for(const s in t)r.util.defineReactive(e,s,o.defaultState[s]);e._subscription=o.subscribe(t=>{for(const o in t)e[o]=t[o]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}};exports.VueEffector=o=>{o.mixin(s),o.prototype.$watchAsStore=e,o.prototype.$store=t},exports.createComponent=(e,t)=>r.extend(Object.assign({},e,t&&{effector:()=>t})); | ||
//# sourceMappingURL=effector-vue.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
function t(t,e={immediate:1}){const o=this,i=s(),r=n({});let c;r.on(i,(t,e)=>e);const u=()=>{c=o.$watch(t,(t,e)=>{i({oldValue:e,newValue:t})},e)};return o._data?u():o.$once('hook:created',u),r}function e(t){return this.$watchAsStore(t).map(({newValue:t})=>t)}import o from'vue';import{is as i,createStoreObject as r,createEvent as s,createStore as n}from'effector';const c={created(){const t=this;let e=t.$options.effector;if('function'==typeof e&&(e=e.call(t)),e)if(i.store(e))o.util.defineReactive(t,"state",e.getState()),t._subscription=e.subscribe(e=>{t.state=e});else{if('object'!=typeof e||null===e)throw Error('property should be Store');{const i=r(e);for(const r in e)o.util.defineReactive(t,r,i.defaultState[r]);t._subscription=i.subscribe(e=>{for(const o in e)t[o]=e[o]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}},u=o=>{o.mixin(c),o.prototype.$watchAsStore=t,o.prototype.$store=e};export{u as VueEffector}; | ||
function t(t,e){return r.extend(Object.assign({},t,e&&{effector:()=>e}))}function e(t,e={immediate:1}){const o=this,r=n(),i=c({});let s;i.on(r,(t,e)=>e);const u=()=>{s=o.$watch(t,(t,e)=>{r({oldValue:e,newValue:t})},e)};return o._data?u():o.$once('hook:created',u),i}function o(t){return this.$watchAsStore(t).map(({newValue:t})=>t)}import r from'vue';import{is as i,createStoreObject as s,createEvent as n,createStore as c}from'effector';const u={created(){const t=this;let e=t.$options.effector;if('function'==typeof e&&(e=e.call(t)),e)if(i.store(e))r.util.defineReactive(t,"state",e.getState()),t._subscription=e.subscribe(e=>{t.state=e});else{if('object'!=typeof e||null===e)throw Error('property should be Store');{const o=s(e);for(const i in e)r.util.defineReactive(t,i,o.defaultState[i]);t._subscription=o.subscribe(e=>{for(const o in e)t[o]=e[o]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}},f=t=>{t.mixin(u),t.prototype.$watchAsStore=e,t.prototype.$store=o};export{f as VueEffector,t as createComponent}; | ||
//# sourceMappingURL=effector-vue.es.js.map |
@@ -1,2 +0,2 @@ | ||
return e=this,t=function(e,t,effector){function o(e,t={immediate:1}){const o=this,r=effector.createEvent(),i=effector.createStore({});let n;i.on(r,(e,t)=>t);const s=()=>{n=o.$watch(e,(e,t)=>{r({oldValue:t,newValue:e})},t)};return o._data?s():o.$once('hook:created',s),i}function r(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}t=t&&t.hasOwnProperty('default')?t.default:t;const i={created(){const e=this;let o=e.$options.effector;if('function'==typeof o&&(o=o.call(e)),o)if(effector.is.store(o))t.util.defineReactive(e,"state",o.getState()),e._subscription=o.subscribe(t=>{e.state=t});else{if('object'!=typeof o||null===o)throw Error('property should be Store');{const r=effector.createStoreObject(o);for(const i in o)t.util.defineReactive(e,i,r.defaultState[i]);e._subscription=r.subscribe(t=>{for(const o in t)e[o]=t[o]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}};e.VueEffector=e=>{e.mixin(i),e.prototype.$watchAsStore=o,e.prototype.$store=r},Object.defineProperty(e,'__esModule',{value:1})},void('object'==typeof exports&&'undefined'!=typeof module?t(exports,require('vue'),require('effector')):'function'==typeof define&&define.amd?define(['exports','vue','effector'],t):t((e=e||self).effectorVue={},e.Vue,e.effector));var e,t; | ||
return e=this,t=function(e,t,effector){function o(e,t={immediate:1}){const o=this,r=effector.createEvent(),i=effector.createStore({});let n;i.on(r,(e,t)=>t);const s=()=>{n=o.$watch(e,(e,t)=>{r({oldValue:t,newValue:e})},t)};return o._data?s():o.$once('hook:created',s),i}function r(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}t=t&&t.hasOwnProperty('default')?t.default:t;const i={created(){const e=this;let o=e.$options.effector;if('function'==typeof o&&(o=o.call(e)),o)if(effector.is.store(o))t.util.defineReactive(e,"state",o.getState()),e._subscription=o.subscribe(t=>{e.state=t});else{if('object'!=typeof o||null===o)throw Error('property should be Store');{const r=effector.createStoreObject(o);for(const i in o)t.util.defineReactive(e,i,r.defaultState[i]);e._subscription=r.subscribe(t=>{for(const o in t)e[o]=t[o]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}};e.VueEffector=e=>{e.mixin(i),e.prototype.$watchAsStore=o,e.prototype.$store=r},e.createComponent=(e,o)=>t.extend(Object.assign({},e,o&&{effector:()=>o})),Object.defineProperty(e,'__esModule',{value:1})},void('object'==typeof exports&&'undefined'!=typeof module?t(exports,require('vue'),require('effector')):'function'==typeof define&&define.amd?define(['exports','vue','effector'],t):t((e=e||self).effectorVue={},e.Vue,e.effector));var e,t; | ||
//# sourceMappingURL=effector-vue.umd.js.map |
import Vue, {ComponentOptions, WatchOptions, VueConstructor} from 'vue' | ||
import { | ||
ThisTypedComponentOptionsWithArrayProps, | ||
ThisTypedComponentOptionsWithRecordProps, | ||
} from 'vue/types/options' | ||
import {ExtendedVue} from 'vue/types/vue' | ||
import {Store} from 'effector' | ||
type Inference<S> = S extends Store<infer State> | ||
? State | ||
: S extends {[storeName: string]: Store<any>} | ||
? {[K in keyof S]: S[K] extends Store<infer U> ? U : never} | ||
: never | ||
declare module 'vue/types/vue' { | ||
@@ -9,2 +20,23 @@ interface Vue { | ||
} | ||
interface VueConstructor<V extends Vue> { | ||
extend<S, Data, Methods, Computed, PropNames extends string = never>( | ||
options?: ThisTypedComponentOptionsWithArrayProps< | ||
S & V, | ||
Data, | ||
Methods, | ||
Computed, | ||
PropNames | ||
>, | ||
): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>> | ||
extend<S, Data, Methods, Computed, Props>( | ||
options?: ThisTypedComponentOptionsWithRecordProps< | ||
S & V, | ||
Data, | ||
Methods, | ||
Computed, | ||
Props | ||
>, | ||
): ExtendedVue<V, Data, Methods, Computed, Props> | ||
} | ||
} | ||
@@ -30,1 +62,62 @@ | ||
declare function VueEffector(vm: VueConstructor<Vue>, options?: Object): void | ||
declare function createComponent<V extends Vue, Data, Methods, Computed, Props>( | ||
options: ThisTypedComponentOptionsWithRecordProps< | ||
V, | ||
Data, | ||
Methods, | ||
Computed, | ||
Props | ||
>, | ||
): ExtendedVue<V, Data, Methods, Computed, Props> | ||
declare function createComponent< | ||
V extends Vue, | ||
Data, | ||
Methods, | ||
Computed, | ||
PropNames extends string | ||
>( | ||
options: ThisTypedComponentOptionsWithArrayProps< | ||
V, | ||
Data, | ||
Methods, | ||
Computed, | ||
PropNames | ||
>, | ||
): ExtendedVue<V, Data, Methods, Computed, PropNames> | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
V extends Vue, | ||
Data, | ||
Methods, | ||
Computed, | ||
Props | ||
>( | ||
options: ThisTypedComponentOptionsWithRecordProps< | ||
Inference<S> & V, | ||
Data, | ||
Methods, | ||
Computed, | ||
Props | ||
>, | ||
store?: S, | ||
): ExtendedVue<V, Data, Methods, Computed, Props> | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
V extends Vue, | ||
Data, | ||
Methods, | ||
Computed, | ||
PropNames extends string | ||
>( | ||
options: ThisTypedComponentOptionsWithArrayProps< | ||
Inference<S> & V, | ||
Data, | ||
Methods, | ||
Computed, | ||
PropNames | ||
>, | ||
store?: S, | ||
): ExtendedVue<V, Data, Methods, Computed, Props> |
{ | ||
"name": "effector-vue", | ||
"version": "20.2.1", | ||
"version": "20.3.0", | ||
"description": "Vue bindings for effector", | ||
@@ -5,0 +5,0 @@ "main": "effector-vue.cjs.js", |
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
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
30009
136