vue-class-component
Advanced tools
Comparing version 4.4.0 to 5.0.0
/** | ||
* vue-class-component v4.4.0 | ||
* (c) 2015-2016 Evan You | ||
* vue-class-component v5.0.0 | ||
* (c) 2015-2017 Evan You | ||
* @license MIT | ||
@@ -10,4 +10,6 @@ */ | ||
var Vue = require('vue'); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var Vue = _interopDefault(require('vue')); | ||
function createDecorator(factory) { | ||
@@ -30,7 +32,17 @@ return function (_, key, index) { | ||
var _this = this; | ||
Object.getOwnPropertyNames(vm).forEach(function (key) { | ||
Object.defineProperty(_this, key, { | ||
get: function () { return vm[key]; }, | ||
set: function (value) { return vm[key] = value; } | ||
}); | ||
var keys = Object.getOwnPropertyNames(vm); | ||
if (vm.$options.props) { | ||
for (var key in vm.$options.props) { | ||
if (!vm.hasOwnProperty(key)) { | ||
keys.push(key); | ||
} | ||
} | ||
} | ||
keys.forEach(function (key) { | ||
if (key.charAt(0) !== '_') { | ||
Object.defineProperty(_this, key, { | ||
get: function () { return vm[key]; }, | ||
set: function (value) { return vm[key] = value; } | ||
}); | ||
} | ||
}); | ||
@@ -37,0 +49,0 @@ }; |
/** | ||
* vue-class-component v4.4.0 | ||
* (c) 2015-2016 Evan You | ||
* vue-class-component v5.0.0 | ||
* (c) 2015-2017 Evan You | ||
* @license MIT | ||
@@ -12,2 +12,4 @@ */ | ||
Vue = 'default' in Vue ? Vue['default'] : Vue; | ||
function createDecorator(factory) { | ||
@@ -30,7 +32,17 @@ return function (_, key, index) { | ||
var _this = this; | ||
Object.getOwnPropertyNames(vm).forEach(function (key) { | ||
Object.defineProperty(_this, key, { | ||
get: function () { return vm[key]; }, | ||
set: function (value) { return vm[key] = value; } | ||
}); | ||
var keys = Object.getOwnPropertyNames(vm); | ||
if (vm.$options.props) { | ||
for (var key in vm.$options.props) { | ||
if (!vm.hasOwnProperty(key)) { | ||
keys.push(key); | ||
} | ||
} | ||
} | ||
keys.forEach(function (key) { | ||
if (key.charAt(0) !== '_') { | ||
Object.defineProperty(_this, key, { | ||
get: function () { return vm[key]; }, | ||
set: function (value) { return vm[key] = value; } | ||
}); | ||
} | ||
}); | ||
@@ -37,0 +49,0 @@ }; |
/** | ||
* vue-class-component v4.4.0 | ||
* (c) 2015-2016 Evan You | ||
* vue-class-component v5.0.0 | ||
* (c) 2015-2017 Evan You | ||
* @license MIT | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t(e.VueClassComponent=e.VueClassComponent||{},e.Vue)}(this,function(e,t){"use strict";function n(e){return function(t,n,o){"number"!=typeof o&&(o=void 0),c.push(function(t){return e(t,n,o)})}}function o(e,t){t.prototype._init=function(){var t=this;Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){return e[n]=t}})})};var n=new t,o={};return Object.keys(n).forEach(function(e){void 0!==n[e]&&(o[e]=n[e])}),o}function r(e,n){void 0===n&&(n={}),n.name=n.name||e._componentTag;var r=e.prototype;Object.getOwnPropertyNames(r).forEach(function(e){if("constructor"!==e){if(i.indexOf(e)>-1)return void(n[e]=r[e]);var t=Object.getOwnPropertyDescriptor(r,e);"function"==typeof t.value?(n.methods||(n.methods={}))[e]=t.value:(t.get||t.set)&&((n.computed||(n.computed={}))[e]={get:t.get,set:t.set})}}),(n.mixins||(n.mixins=[])).push({data:function(){return o(this,e)}}),c.forEach(function(e){return e(n)}),c=[];var u=Object.getPrototypeOf(e.prototype),f=u instanceof t?u.constructor:t;return f.extend(n)}function u(e){return"function"==typeof e?r(e):function(t){return r(t,e)}}var i=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render"],c=[];!function(e){function t(e){i.push.apply(i,e)}e.registerHooks=t}(u||(u={}));var f=u;e.default=f,e.createDecorator=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t(e.VueClassComponent=e.VueClassComponent||{},e.Vue)}(this,function(e,t){"use strict";function n(e){return function(t,n,o){"number"!=typeof o&&(o=void 0),f.push(function(t){return e(t,n,o)})}}function o(e,t){t.prototype._init=function(){var t=this,n=Object.getOwnPropertyNames(e);if(e.$options.props)for(var o in e.$options.props)e.hasOwnProperty(o)||n.push(o);n.forEach(function(n){"_"!==n.charAt(0)&&Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){return e[n]=t}})})};var n=new t,o={};return Object.keys(n).forEach(function(e){void 0!==n[e]&&(o[e]=n[e])}),o}function r(e,n){void 0===n&&(n={}),n.name=n.name||e._componentTag;var r=e.prototype;Object.getOwnPropertyNames(r).forEach(function(e){if("constructor"!==e){if(i.indexOf(e)>-1)return void(n[e]=r[e]);var t=Object.getOwnPropertyDescriptor(r,e);"function"==typeof t.value?(n.methods||(n.methods={}))[e]=t.value:(t.get||t.set)&&((n.computed||(n.computed={}))[e]={get:t.get,set:t.set})}}),(n.mixins||(n.mixins=[])).push({data:function(){return o(this,e)}}),f.forEach(function(e){return e(n)}),f=[];var u=Object.getPrototypeOf(e.prototype),c=u instanceof t?u.constructor:t;return c.extend(n)}function u(e){return"function"==typeof e?r(e):function(t){return r(t,e)}}t="default"in t?t.default:t;var i=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render"],f=[];!function(e){function t(e){i.push.apply(i,e)}e.registerHooks=t}(u||(u={}));var c=u;e.default=c,e.createDecorator=n,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -1,5 +0,5 @@ | ||
import * as Vue from 'vue'; | ||
import Vue, { ComponentOptions } from 'vue'; | ||
import { VueClass } from './declarations'; | ||
export declare const $internalHooks: string[]; | ||
export declare let $decoratorQueue: ((options: Vue.ComponentOptions<Vue>) => void)[]; | ||
export declare function componentFactory(Component: VueClass, options?: Vue.ComponentOptions<any>): VueClass; | ||
export declare let $decoratorQueue: ((options: ComponentOptions<Vue>) => void)[]; | ||
export declare function componentFactory(Component: VueClass, options?: ComponentOptions<any>): VueClass; |
@@ -1,2 +0,2 @@ | ||
import * as Vue from 'vue'; | ||
import Vue from 'vue'; | ||
import { collectDataFromConstructor } from './data'; | ||
@@ -3,0 +3,0 @@ export var $internalHooks = [ |
@@ -1,3 +0,3 @@ | ||
import * as Vue from 'vue'; | ||
import Vue from 'vue'; | ||
import { VueClass } from './declarations'; | ||
export declare function collectDataFromConstructor(vm: Vue, Component: VueClass): {}; |
@@ -1,2 +0,2 @@ | ||
import * as Vue from 'vue'; | ||
import Vue from 'vue'; | ||
import { warn } from './util'; | ||
@@ -6,7 +6,17 @@ export function collectDataFromConstructor(vm, Component) { | ||
var _this = this; | ||
Object.getOwnPropertyNames(vm).forEach(function (key) { | ||
Object.defineProperty(_this, key, { | ||
get: function () { return vm[key]; }, | ||
set: function (value) { return vm[key] = value; } | ||
}); | ||
var keys = Object.getOwnPropertyNames(vm); | ||
if (vm.$options.props) { | ||
for (var key in vm.$options.props) { | ||
if (!vm.hasOwnProperty(key)) { | ||
keys.push(key); | ||
} | ||
} | ||
} | ||
keys.forEach(function (key) { | ||
if (key.charAt(0) !== '_') { | ||
Object.defineProperty(_this, key, { | ||
get: function () { return vm[key]; }, | ||
set: function (value) { return vm[key] = value; } | ||
}); | ||
} | ||
}); | ||
@@ -13,0 +23,0 @@ }; |
@@ -1,4 +0,4 @@ | ||
import * as Vue from 'vue'; | ||
import Vue from 'vue'; | ||
export declare type VueClass = { | ||
new (): Vue; | ||
} & typeof Vue; |
@@ -1,5 +0,5 @@ | ||
import * as Vue from 'vue'; | ||
import Vue, { ComponentOptions } from 'vue'; | ||
import { VueClass } from './declarations'; | ||
export { createDecorator } from './util'; | ||
declare function Component<U extends Vue>(options: Vue.ComponentOptions<U>): <V extends VueClass>(target: V) => V; | ||
declare function Component<U extends Vue>(options: ComponentOptions<U>): <V extends VueClass>(target: V) => V; | ||
declare function Component<V extends VueClass>(target: V): V; | ||
@@ -6,0 +6,0 @@ declare namespace Component { |
@@ -1,5 +0,5 @@ | ||
import * as Vue from 'vue'; | ||
import Vue, { ComponentOptions } from 'vue'; | ||
export declare const noop: () => void; | ||
export declare function createDecorator(factory: (options: Vue.ComponentOptions<Vue>, key: string) => void): (target: Vue, key: string) => void; | ||
export declare function createDecorator(factory: (options: Vue.ComponentOptions<Vue>, key: string, index: number) => void): (target: Vue, key: string, index: number) => void; | ||
export declare function createDecorator(factory: (options: ComponentOptions<Vue>, key: string) => void): (target: Vue, key: string) => void; | ||
export declare function createDecorator(factory: (options: ComponentOptions<Vue>, key: string, index: number) => void): (target: Vue, key: string, index: number) => void; | ||
export declare function warn(message: string): void; |
{ | ||
"name": "vue-class-component", | ||
"version": "4.4.0", | ||
"version": "5.0.0", | ||
"description": "ES201X/TypeScript class decorator for Vue components", | ||
@@ -46,2 +46,3 @@ "main": "dist/vue-class-component.common.js", | ||
"chai-spies": "^0.7.1", | ||
"css-loader": "^0.26.1", | ||
"mocha": "^3.1.2", | ||
@@ -52,8 +53,10 @@ "node-libs-browser": "^1.0.0", | ||
"rollup-plugin-replace": "^1.1.1", | ||
"ts-loader": "^0.9.5", | ||
"ts-loader": "^2.0.0", | ||
"typescript": "^2.0.6", | ||
"uglify-js": "^2.7.5", | ||
"vue": "^2.1.6", | ||
"webpack": "^2.1.0-beta.27" | ||
"vue": "^2.1.10", | ||
"vue-loader": "^10.0.2", | ||
"vue-template-compiler": "^2.1.10", | ||
"webpack": "^2.2.0" | ||
} | ||
} |
@@ -25,5 +25,17 @@ # vue-class-component | ||
Following is the example written in Babel. If you are looking for TypeScript version, [it's in the example directory](example/example.ts). | ||
Following is the example written in Babel. If you are looking for TypeScript version, [it's in the example directory](example/App.vue). | ||
``` js | ||
``` vue | ||
<template> | ||
<div> | ||
<input v-model="msg"> | ||
<p>prop: {{propMessage}}</p> | ||
<p>msg: {{msg}}</p> | ||
<p>helloMsg: {{helloMsg}}</p> | ||
<p>computed msg: {{computedMsg}}</p> | ||
<button @click="greet">Greet</button> | ||
</div> | ||
</template> | ||
<script> | ||
import Vue from 'vue' | ||
@@ -35,15 +47,5 @@ import Component from 'vue-class-component' | ||
propMessage: String | ||
}, | ||
template: ` | ||
<div> | ||
<input v-model="msg"> | ||
<p>prop: {{propMessage}}</p> | ||
<p>msg: {{msg}}</p> | ||
<p>helloMsg: {{helloMsg}}</p> | ||
<p>computed msg: {{computedMsg}}</p> | ||
<button @click="greet">Greet</button> | ||
</div> | ||
` | ||
} | ||
}) | ||
class App extends Vue { | ||
export default class App extends Vue { | ||
// initial data | ||
@@ -70,2 +72,3 @@ msg = 123 | ||
} | ||
</script> | ||
``` | ||
@@ -72,0 +75,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22749
407
171
0
22