effector-vue
Advanced tools
Comparing version 20.4.2 to 20.5.0
@@ -7,3 +7,3 @@ import Vue, {ComponentOptions, WatchOptions, VueConstructor} from 'vue' | ||
import {ExtendedVue} from 'vue/types/vue' | ||
import {Store} from 'effector' | ||
import {Store, Event} from 'effector' | ||
@@ -16,3 +16,3 @@ type Inference<EffectorState> = EffectorState extends Store<infer State> | ||
type EffectorType = Store<any> | {[key: string]: Store<any>} | (() => Store<any>) | ||
type EffectorType = Store<any> | {[key: string]: Store<any> | Event<any>} | (() => Store<any>) | ||
@@ -99,3 +99,3 @@ type ExpandType<V extends Vue, EffectorState extends EffectorType> = EffectorState extends ((this: V) => Store<infer State>) | Store<infer State> | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -117,3 +117,3 @@ Data, | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -120,0 +120,0 @@ Data, |
@@ -1,2 +0,2 @@ | ||
'use strict';function t(t,e){var o=this;void 0===e&&(e={immediate:1});var i=r.createEvent(),n=r.restore(i,{}),s=function(){o.$watch(t,(function(t,e){i({oldValue:e,newValue:t})}),e)};return this._data?s():this.$once('hook:created',s),n}function e(t){return this.$watchAsStore(t).map((function(t){return t.newValue}))}Object.defineProperty(exports,'__esModule',{value:1});var o,i=(o=require('vue'))&&'object'==typeof o&&'default'in o?o.default:o,r=require('effector/compat'),n={beforeCreate:function(){var t=this,e=this.$options.effector;if('function'==typeof e&&(e=e.call(this)),e)if(r.is.store(e))i.util.defineReactive(this,"state",e.getState()),this._subscription=e.watch((function(e){t.state=e}));else{if('object'!=typeof e||null===e)throw Error('property should be Store');var o=r.combine(e);for(var n in e)i.util.defineReactive(this,n,o.defaultState[n]);this._subscription=o.watch((function(e){for(var o in e)t[o]=e[o]}))}},beforeDestroy:function(){this._subscription&&this._subscription.unsubscribe()}};exports.VueEffector=function(o){o.mixin(n),o.prototype.$watchAsStore=t,o.prototype.$store=e},exports.createComponent=function(t,e){return i.extend(Object.assign({},t,e&&{effector:function(){return e}}))}; | ||
'use strict';function t(t,e){var r=this;void 0===e&&(e={immediate:1});var o=n.createEvent(),i=n.restore(o,{}),a=function(){r.$watch(t,(function(t,e){o({oldValue:e,newValue:t})}),e)};return this._data?a():this.$once('hook:created',a),i}function e(t){return this.$watchAsStore(t).map((function(t){return t.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={beforeCreate:function(){var t=this,e=this.$options.effector;if("function"==typeof e&&(e=e.call(this)),e){this.$options.computed||(this.$options.computed={}),this.__clear=n.createEvent(),this.__forwards=[];var r={};for(var i in n.withRegion(this.__clear,(function(){if(n.is.store(e)){var i,a='state',f=o.observable(((i={})[a]=e.getState(),i)),s=n.createEvent(),c=n.forward({from:s,to:e});t.__forwards.push(c),e.watch((function(t){f[a]=t})),r[a]={get:function(){return f[a]},set:s}}else{if('object'!=typeof e||null===e)throw Error('property should be Store');(function(){var i={},a=0;for(var f in e){var s=e[f];if(n.is.store(s))i[f]=s;else{if(!n.is.unit(s))throw Error('property should be Store or Unit (will be transform to Store<number>)');i[f]=n.restore(s.map((function(){return++a})),null)}}var c=n.combine(i),u=o.observable(c.defaultState);c.watch((function(t){for(var e in t)u[e]=t[e]}));var h=function(e){var o=n.createEvent(),a=n.forward({from:o,to:i[e]});t.__forwards.push(a),r[e]={get:function(){return u[e]},set:o}};for(var l in u)h(l)})()}})),r)this.$options.computed[i]=r[i]}},beforeDestroy:function(){this.__clear&&(n.clearNode(this.__clear),this.__forwards.forEach((function(t){t()})))}};exports.VueEffector=function(r){r.mixin(i),r.prototype.$watchAsStore=t,r.prototype.$store=e},exports.createComponent=function(t,e){return o.extend(Object.assign({},t,e&&{effector:function(){return e}}))}; | ||
//# sourceMappingURL=compat.js.map |
@@ -7,3 +7,3 @@ import Vue, {ComponentOptions, WatchOptions, VueConstructor} from 'vue' | ||
import {ExtendedVue} from 'vue/types/vue' | ||
import {Store} from 'effector' | ||
import {Store, Event} from 'effector' | ||
@@ -16,3 +16,3 @@ type Inference<EffectorState> = EffectorState extends Store<infer State> | ||
type EffectorType = Store<any> | {[key: string]: Store<any>} | (() => Store<any>) | ||
type EffectorType = Store<any> | {[key: string]: Store<any> | Event<any>} | (() => Store<any>) | ||
@@ -99,3 +99,3 @@ type ExpandType<V extends Vue, EffectorState extends EffectorType> = EffectorState extends ((this: V) => Store<infer State>) | Store<infer State> | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -117,3 +117,3 @@ Data, | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -120,0 +120,0 @@ Data, |
@@ -1,2 +0,2 @@ | ||
function e(e,t={immediate:1}){let o=effector.createEvent(),i=effector.restore(o,{}),r=()=>{this.$watch(e,(e,t)=>{o({oldValue:t,newValue:e})},t)};return this._data?r():this.$once('hook:created',r),i}function t(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}Object.defineProperty(exports,'__esModule',{value:1});var o,i=(o=require('vue'))&&'object'==typeof o&&'default'in o?o.default:o,effector=require('effector');const r={beforeCreate(){let e=this.$options.effector;if('function'==typeof e&&(e=e.call(this)),e)if(effector.is.store(e))i.util.defineReactive(this,"state",e.getState()),this._subscription=e.watch(e=>{this.state=e});else{if('object'!=typeof e||null===e)throw Error('property should be Store');{let t=effector.combine(e);for(let o in e)i.util.defineReactive(this,o,t.defaultState[o]);this._subscription=t.watch(e=>{for(let t in e)this[t]=e[t]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}};exports.VueEffector=o=>{o.mixin(r),o.prototype.$watchAsStore=e,o.prototype.$store=t},exports.createComponent=(e,t)=>i.extend(Object.assign({},e,t&&{effector:()=>t})); | ||
function e(e,t={immediate:1}){let r=effector.createEvent(),o=effector.restore(r,{}),s=()=>{this.$watch(e,(e,t)=>{r({oldValue:t,newValue:e})},t)};return this._data?s():this.$once('hook:created',s),o}function t(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}Object.defineProperty(exports,'__esModule',{value:1});var r,o=(r=require('vue'))&&'object'==typeof r&&'default'in r?r.default:r,effector=require('effector');const s={beforeCreate(){let e=this.$options.effector;if("function"==typeof e&&(e=e.call(this)),!e)return;this.$options.computed||(this.$options.computed={}),this.__clear=effector.createEvent(),this.__forwards=[];let t={};effector.withRegion(this.__clear,()=>{if(effector.is.store(e)){let r='state',s=o.observable({[r]:e.getState()}),i=effector.createEvent(),a=effector.forward({from:i,to:e});this.__forwards.push(a),e.watch(e=>{s[r]=e}),t[r]={get:()=>s[r],set:i}}else{if('object'!=typeof e||null===e)throw Error('property should be Store');{let r={},s=0;for(let t in e){let o=e[t];if(effector.is.store(o))r[t]=o;else{if(!effector.is.unit(o))throw Error('property should be Store or Unit (will be transform to Store<number>)');r[t]=effector.restore(o.map(()=>++s),null)}}let i=effector.combine(r),a=o.observable(i.defaultState);i.watch(e=>{for(let t in e)a[t]=e[t]});for(let e in a){let o=effector.createEvent(),s=effector.forward({from:o,to:r[e]});this.__forwards.push(s),t[e]={get:()=>a[e],set:o}}}}});for(let e in t)this.$options.computed[e]=t[e]},beforeDestroy(){this.__clear&&(effector.clearNode(this.__clear),this.__forwards.forEach(e=>{e()}))}};exports.VueEffector=r=>{r.mixin(s),r.prototype.$watchAsStore=e,r.prototype.$store=t},exports.createComponent=(e,t)=>o.extend(Object.assign({},e,t&&{effector:()=>t})); | ||
//# sourceMappingURL=effector-vue.cjs.js.map |
@@ -7,3 +7,3 @@ import Vue, {ComponentOptions, WatchOptions, VueConstructor} from 'vue' | ||
import {ExtendedVue} from 'vue/types/vue' | ||
import {Store} from 'effector' | ||
import {Store, Event} from 'effector' | ||
@@ -16,3 +16,3 @@ type Inference<EffectorState> = EffectorState extends Store<infer State> | ||
type EffectorType = Store<any> | {[key: string]: Store<any>} | (() => Store<any>) | ||
type EffectorType = Store<any> | {[key: string]: Store<any> | Event<any>} | (() => Store<any>) | ||
@@ -99,3 +99,3 @@ type ExpandType<V extends Vue, EffectorState extends EffectorType> = EffectorState extends ((this: V) => Store<infer State>) | Store<infer State> | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -117,3 +117,3 @@ Data, | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -120,0 +120,0 @@ Data, |
@@ -1,2 +0,2 @@ | ||
function t(t,e={immediate:1}){let i=r(),o=s(i,{}),n=()=>{this.$watch(t,(t,e)=>{i({oldValue:e,newValue:t})},e)};return this._data?n():this.$once('hook:created',n),o}function e(t){return this.$watchAsStore(t).map(({newValue:t})=>t)}function i(t,e){return o.extend(Object.assign({},t,e&&{effector:()=>e}))}import o from'vue';import{createEvent as r,restore as s,is as n,combine as c}from'effector';let f=i=>{i.mixin(a),i.prototype.$watchAsStore=t,i.prototype.$store=e};const a={beforeCreate(){let t=this.$options.effector;if('function'==typeof t&&(t=t.call(this)),t)if(n.store(t))o.util.defineReactive(this,"state",t.getState()),this._subscription=t.watch(t=>{this.state=t});else{if('object'!=typeof t||null===t)throw Error('property should be Store');{let e=c(t);for(let i in t)o.util.defineReactive(this,i,e.defaultState[i]);this._subscription=e.watch(t=>{for(let e in t)this[e]=t[e]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}};export{f as VueEffector,i as createComponent}; | ||
function t(t,e){return r.extend(Object.assign({},t,e&&{effector:()=>e}))}function e(t,e={immediate:1}){let o=s(),r=a(o,{}),i=()=>{this.$watch(t,(t,e)=>{o({oldValue:e,newValue:t})},e)};return this._data?i():this.$once('hook:created',i),r}function o(t){return this.$watchAsStore(t).map(({newValue:t})=>t)}import r from'vue';import{createEvent as s,withRegion as i,is as l,forward as f,restore as a,combine as n,clearNode as h}from'effector';let c=t=>{t.mixin(p),t.prototype.$watchAsStore=e,t.prototype.$store=o};const p={beforeCreate(){let t=this.$options.effector;if("function"==typeof t&&(t=t.call(this)),!t)return;this.$options.computed||(this.$options.computed={}),this.__clear=s(),this.__forwards=[];let e={};i(this.__clear,()=>{if(l.store(t)){let o='state',i=r.observable({[o]:t.getState()}),l=s(),a=f({from:l,to:t});this.__forwards.push(a),t.watch(t=>{i[o]=t}),e[o]={get:()=>i[o],set:l}}else{if('object'!=typeof t||null===t)throw Error('property should be Store');{let o={},i=0;for(let e in t){let r=t[e];if(l.store(r))o[e]=r;else{if(!l.unit(r))throw Error('property should be Store or Unit (will be transform to Store<number>)');o[e]=a(r.map(()=>++i),null)}}let h=n(o),c=r.observable(h.defaultState);h.watch(t=>{for(let e in t)c[e]=t[e]});for(let t in c){let r=s(),i=f({from:r,to:o[t]});this.__forwards.push(i),e[t]={get:()=>c[t],set:r}}}}});for(let t in e)this.$options.computed[t]=e[t]},beforeDestroy(){this.__clear&&(h(this.__clear),this.__forwards.forEach(t=>{t()}))}};export{c as VueEffector,t as createComponent}; | ||
//# sourceMappingURL=effector-vue.es.js.map |
@@ -7,3 +7,3 @@ import Vue, {ComponentOptions, WatchOptions, VueConstructor} from 'vue' | ||
import {ExtendedVue} from 'vue/types/vue' | ||
import {Store} from 'effector' | ||
import {Store, Event} from 'effector' | ||
@@ -16,3 +16,3 @@ type Inference<EffectorState> = EffectorState extends Store<infer State> | ||
type EffectorType = Store<any> | {[key: string]: Store<any>} | (() => Store<any>) | ||
type EffectorType = Store<any> | {[key: string]: Store<any> | Event<any>} | (() => Store<any>) | ||
@@ -99,3 +99,3 @@ type ExpandType<V extends Vue, EffectorState extends EffectorType> = EffectorState extends ((this: V) => Store<infer State>) | Store<infer State> | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -117,3 +117,3 @@ Data, | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -120,0 +120,0 @@ Data, |
@@ -1,2 +0,2 @@ | ||
((e,t)=>{'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)})(this,(function(e,t,effector){function o(e,t={immediate:1}){let o=effector.createEvent(),i=effector.restore(o,{}),r=()=>{this.$watch(e,(e,t)=>{o({oldValue:t,newValue:e})},t)};return this._data?r():this.$once('hook:created',r),i}function i(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}t=t&&{}.hasOwnProperty.call(t,'default')?t.default:t;const r={beforeCreate(){let e=this.$options.effector;if('function'==typeof e&&(e=e.call(this)),e)if(effector.is.store(e))t.util.defineReactive(this,"state",e.getState()),this._subscription=e.watch(e=>{this.state=e});else{if('object'!=typeof e||null===e)throw Error('property should be Store');{let o=effector.combine(e);for(let i in e)t.util.defineReactive(this,i,o.defaultState[i]);this._subscription=o.watch(e=>{for(let t in e)this[t]=e[t]})}}},beforeDestroy(){this._subscription&&this._subscription.unsubscribe()}};e.VueEffector=e=>{e.mixin(r),e.prototype.$watchAsStore=o,e.prototype.$store=i},e.createComponent=(e,o)=>t.extend(Object.assign({},e,o&&{effector:()=>o})),Object.defineProperty(e,'__esModule',{value:1})})); | ||
((e,t)=>{'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)})(this,(function(e,t,effector){function o(e,t={immediate:1}){let o=effector.createEvent(),r=effector.restore(o,{}),s=()=>{this.$watch(e,(e,t)=>{o({oldValue:t,newValue:e})},t)};return this._data?s():this.$once('hook:created',s),r}function r(e){return this.$watchAsStore(e).map(({newValue:e})=>e)}t=t&&{}.hasOwnProperty.call(t,'default')?t.default:t;const s={beforeCreate(){let e=this.$options.effector;if("function"==typeof e&&(e=e.call(this)),!e)return;this.$options.computed||(this.$options.computed={}),this.__clear=effector.createEvent(),this.__forwards=[];let o={};effector.withRegion(this.__clear,()=>{if(effector.is.store(e)){let r='state',s=t.observable({[r]:e.getState()}),i=effector.createEvent(),f=effector.forward({from:i,to:e});this.__forwards.push(f),e.watch(e=>{s[r]=e}),o[r]={get:()=>s[r],set:i}}else{if('object'!=typeof e||null===e)throw Error('property should be Store');{let r={},s=0;for(let t in e){let o=e[t];if(effector.is.store(o))r[t]=o;else{if(!effector.is.unit(o))throw Error('property should be Store or Unit (will be transform to Store<number>)');r[t]=effector.restore(o.map(()=>++s),null)}}let i=effector.combine(r),f=t.observable(i.defaultState);i.watch(e=>{for(let t in e)f[t]=e[t]});for(let e in f){let t=effector.createEvent(),s=effector.forward({from:t,to:r[e]});this.__forwards.push(s),o[e]={get:()=>f[e],set:t}}}}});for(let e in o)this.$options.computed[e]=o[e]},beforeDestroy(){this.__clear&&(effector.clearNode(this.__clear),this.__forwards.forEach(e=>{e()}))}};e.VueEffector=e=>{e.mixin(s),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})})); | ||
//# sourceMappingURL=effector-vue.umd.js.map |
@@ -7,3 +7,3 @@ import Vue, {ComponentOptions, WatchOptions, VueConstructor} from 'vue' | ||
import {ExtendedVue} from 'vue/types/vue' | ||
import {Store} from 'effector' | ||
import {Store, Event} from 'effector' | ||
@@ -16,3 +16,3 @@ type Inference<EffectorState> = EffectorState extends Store<infer State> | ||
type EffectorType = Store<any> | {[key: string]: Store<any>} | (() => Store<any>) | ||
type EffectorType = Store<any> | {[key: string]: Store<any> | Event<any>} | (() => Store<any>) | ||
@@ -99,3 +99,3 @@ type ExpandType<V extends Vue, EffectorState extends EffectorType> = EffectorState extends ((this: V) => Store<infer State>) | Store<infer State> | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -117,3 +117,3 @@ Data, | ||
declare function createComponent< | ||
S extends {[field: string]: Store<any>}, | ||
S extends {[field: string]: Store<any> | Event<any>}, | ||
V extends Vue, | ||
@@ -120,0 +120,0 @@ Data, |
{ | ||
"name": "effector-vue", | ||
"version": "20.4.2", | ||
"version": "20.5.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
53283
623