Socket
Socket
Sign inDemoInstall

vue-property-decorator

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-property-decorator - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

134

lib/vue-property-decorator.d.ts

@@ -0,2 +1,24 @@

/**
* decorator of an event
* @param {string} eventName the name of the event to listen
* @return {PropertyDecorator} PropertyDecorator
*/
export declare function event(eventName: string): PropertyDecorator;
/**
* decorator of a prop
* @param {PropOption} options the option for the prop
* @return {PropertyDecorator} PropertyDecorator
*/
export declare function prop(options: (PropOption | {
new (...args: any[]): any;
})): PropertyDecorator;
/**
* decorator of a watch function
* @param {string} path the path or the expression to observe
* @return {PropertyDecorator} PropertyDecorator
*/
export declare function watch(path: string): PropertyDecorator;
export declare function Data<T>(data: () => T): (Class: {
prototype: T;
}) => void;
export interface PropOption {

@@ -12,5 +34,109 @@ type: {

}
export declare function prop(options: (PropOption | {
new (...args: any[]): any;
})): PropertyDecorator;
export declare function watch(path: string): PropertyDecorator;
export interface DirectiveOption {
bind?(): any;
update?(newVal?: any, oldVal?: any): any;
unbind?(): any;
params?: string[];
deep?: boolean;
twoWay?: boolean;
acceptStatement?: boolean;
priority?: number;
[key: string]: any;
}
export interface FilterOption {
read: Function;
write: Function;
}
export interface TransitionOption {
css?: boolean;
beforeEnter?(el: HTMLElement): void;
enter?(el: HTMLElement, done?: () => void): void;
afterEnter?(el: HTMLElement): void;
enterCancelled?(el: HTMLElement): void;
beforeLeave?(el: HTMLElement): void;
leave?(el: HTMLElement, done?: () => void): void;
afterLeave?(el: HTMLElement): void;
leaveCancelled?(el: HTMLElement): void;
stagger?(index: number): number;
}
export interface PropOptions {
[key: string]: PropOption;
}
export interface DirectiveOptions {
[key: string]: DirectiveOption;
}
export interface FilterOptions {
[key: string]: FilterOption;
}
export interface TransitionOptions {
[key: string]: TransitionOption;
}
export interface $get {
(exp: string, asStatement?: boolean): any;
}
export interface $set {
<T>(key: string | number, value: T): T;
}
export interface $delete {
(key: string): void;
}
export interface $watch {
(expOrFn: string | Function, callback: ((newVal: any, oldVal?: any) => any) | string, options?: {
deep?: boolean;
immidiate?: boolean;
}): Function;
}
export interface $eval {
(expression: string): string;
}
export interface $interpolate {
(expression: string): string;
}
export interface $log {
(keypath?: string): void;
}
export interface $nextTick {
(callback: Function): void;
}
export interface $appendTo<V> {
(target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V;
}
export interface $prependTo<V> {
(target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V;
}
export interface $before<V> {
(target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V;
}
export interface $after<V> {
(target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V;
}
export interface $remove<V> {
(callback?: Function): V;
}
export interface $on<V> {
(event: string, callback: Function): V;
}
export interface $once<V> {
(event: string, callback: Function): V;
}
export interface $off<V> {
(event?: string, callback?: Function): V;
}
export interface $emit<V> {
(event: string, ...args: any[]): V;
}
export interface $broadcast<V> {
(event: string, ...args: any[]): V;
}
export interface $dispatch<V> {
(event: string, ...args: any[]): V;
}
export interface $mount<V> {
(elementOrSelector?: (HTMLElement | string)): V;
}
export interface $destroy {
(remove?: boolean): void;
}
export interface $compile {
(el: Element | DocumentFragment, host?: any): Function;
}

@@ -0,2 +1,8 @@

/* vue-property-decorator verson 2.1.0 MIT LICENSE copyright 2016 kaorun343 */
"use strict";
/**
* decorator of an event
* @param {string} eventName the name of the event to listen
* @return {PropertyDecorator} PropertyDecorator
*/
function event(eventName) {

@@ -8,2 +14,7 @@ return function (target, propertyKey) {

exports.event = event;
/**
* decorator of a prop
* @param {PropOption} options the option for the prop
* @return {PropertyDecorator} PropertyDecorator
*/
function prop(options) {

@@ -15,2 +26,7 @@ return function (target, propertyKey) {

exports.prop = prop;
/**
* decorator of a watch function
* @param {string} path the path or the expression to observe
* @return {PropertyDecorator} PropertyDecorator
*/
function watch(path) {

@@ -22,1 +38,7 @@ return function (target, propertyKey) {

exports.watch = watch;
function Data(data) {
return function (Class) {
Class.prototype.data = data;
};
}
exports.Data = Data;

2

package.json
{
"name": "vue-property-decorator",
"version": "2.0.2",
"version": "2.1.0",
"description": "property decorators for Vue Component",

@@ -5,0 +5,0 @@ "main": "lib/vue-property-decorator.js",

@@ -15,5 +15,6 @@ # Vue Property Decorator

import VueComponent = require('vue-class-component');
import {event, prop, watch} from 'vue-property-decorator';
import {event, prop, watch, Data, $emit} from 'vue-property-decorator';
@VueComponent
@Data(() => ({child: 'child'}))
export class Component {

@@ -36,10 +37,10 @@ @event('some:event')

data() {
return {
child: 'child';
};
}
@watch('child')
onChildChanged(val: string, oldVal: string) {}
$emit: $emit;
send() {
this.$emit('some:event');
}
}

@@ -66,4 +67,4 @@

twoWay: true,
validator: (value: string) => value.length > 1,
coerce: (val: string) => val.toLowerCase()
validator: (value) => value.length > 1,
coerce: (val) => val.toLowerCase()
}

@@ -73,3 +74,6 @@ },

onEventReceived() {},
onChildChanged() {}
onChildChanged() {},
send() {
this.$emit('some:event')
}
}

@@ -76,0 +80,0 @@ events: {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc