-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #379 from ymarcov/master
- Loading branch information
Showing
20 changed files
with
1,241 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Parameters that can be passed to the @Action decorator | ||
*/ | ||
export interface ActionDecoratorParams { | ||
commit?: string; | ||
rawError?: boolean; | ||
root?: boolean; | ||
} | ||
export declare function Action<T, R>(target: T, key: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => R>): void; | ||
export declare function Action<T>(params: ActionDecoratorParams): MethodDecorator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export declare const config: IConfig; | ||
export interface IConfig { | ||
rawError?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Takes the properties on object from parameter source and adds them to the object | ||
* parameter target | ||
* @param {object} target Object to have properties copied onto from y | ||
* @param {object} source Object with properties to be copied to x | ||
*/ | ||
export declare function addPropertiesToObject(target: any, source: any): void; | ||
/** | ||
* Returns a namespaced name of the module to be used as a store getter | ||
* @param module | ||
*/ | ||
export declare function getModuleName(module: any): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export { VuexModule, getModule } from './vuexmodule'; | ||
export { Module } from './module'; | ||
export { Action } from './action'; | ||
export { Mutation } from './mutation'; | ||
export { MutationAction } from './mutationaction'; | ||
export { config } from './config'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Module as Mod } from 'vuex'; | ||
import { ModuleOptions } from '../moduleoptions'; | ||
export declare function Module<S>(module: Function & Mod<S, any>): void; | ||
export declare function Module<S>(options: ModuleOptions): ClassDecorator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { Module as Mod } from 'vuex'; | ||
export declare function stateFactory<S>(module: Function & Mod<S, any>): S; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Module as Mod } from 'vuex'; | ||
import { DynamicModuleOptions } from '../moduleoptions'; | ||
export declare function staticStateGenerator<S extends Object>(module: Function & Mod<S, any>, modOpt: DynamicModuleOptions, statics: any): void; | ||
export declare function staticGetterGenerator<S>(module: Function & Mod<S, any>, modOpt: DynamicModuleOptions, statics: any): void; | ||
export declare function staticMutationGenerator<S>(module: Function & Mod<S, any>, modOpt: DynamicModuleOptions, statics: any): void; | ||
export declare function staticActionGenerators<S>(module: Function & Mod<S, any>, modOpt: DynamicModuleOptions, statics: any): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Store } from 'vuex'; | ||
/** | ||
* Options to pass to the @Module decorator | ||
*/ | ||
export interface StaticModuleOptions { | ||
/** | ||
* name of module, if being namespaced | ||
*/ | ||
name?: string; | ||
/** | ||
* whether or not the module is namespaced | ||
*/ | ||
namespaced?: boolean; | ||
/** | ||
* Whether to generate a plain state object, or a state factory for the module | ||
*/ | ||
stateFactory?: boolean; | ||
} | ||
export interface DynamicModuleOptions { | ||
/** | ||
* If this is a dynamic module (added to store after store is created) | ||
*/ | ||
dynamic: true; | ||
/** | ||
* The store into which this module will be injected | ||
*/ | ||
store: Store<any>; | ||
/** | ||
* name of module, compulsory for dynamic modules | ||
*/ | ||
name: string; | ||
/** | ||
* If this is enabled it will preserve the state when loading the module | ||
*/ | ||
preserveState?: boolean; | ||
/** | ||
* whether or not the module is namespaced | ||
*/ | ||
namespaced?: boolean; | ||
/** | ||
* Whether to generate a plain state object, or a state factory for the module | ||
*/ | ||
stateFactory?: boolean; | ||
} | ||
export declare type ModuleOptions = StaticModuleOptions | DynamicModuleOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare function Mutation<T extends Object, R>(target: T, key: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => R>): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export interface MutationActionParams<M> { | ||
mutate?: (keyof Partial<M>)[]; | ||
rawError?: boolean; | ||
root?: boolean; | ||
} | ||
export declare function MutationAction<K, T extends K>(target: { | ||
[k in keyof T]: T[k] | null; | ||
}, key: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<K>>): void; | ||
export declare function MutationAction<T>(params: MutationActionParams<T>): (target: T, key: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<T>>) => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ActionTree, GetterTree, Module as Mod, ModuleTree, MutationTree, Store, ActionContext } from 'vuex'; | ||
export declare class VuexModule<S = ThisType<any>, R = any> implements Mod<S, R> { | ||
static namespaced?: boolean; | ||
static state?: any | (() => any); | ||
static getters?: GetterTree<any, any>; | ||
static actions?: ActionTree<any, any>; | ||
static mutations?: MutationTree<any>; | ||
static modules?: ModuleTree<any>; | ||
modules?: ModuleTree<any>; | ||
namespaced?: boolean; | ||
getters?: GetterTree<S, R>; | ||
state?: S | (() => S); | ||
mutations?: MutationTree<S>; | ||
actions?: ActionTree<S, R>; | ||
context: ActionContext<S, R>; | ||
constructor(module: Mod<S, any>); | ||
} | ||
declare type ConstructorOf<C> = { | ||
new (...args: any[]): C; | ||
}; | ||
export declare function getModule<M extends VuexModule>(moduleClass: ConstructorOf<M>, store?: Store<any>): M; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters