From 6aefc06586c499748654aac96055e544f783afc8 Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Thu, 23 Feb 2017 20:35:23 -0600 Subject: [PATCH] chore(decorators): remove decorators (moved to decorators branch since they're not ready) --- src/decorators/index.ts | 3 --- src/decorators/resolve.ts | 18 --------------- src/decorators/resolveData.ts | 41 ----------------------------------- src/decorators/state.ts | 8 ------- src/index.ts | 1 - 5 files changed, 71 deletions(-) delete mode 100644 src/decorators/index.ts delete mode 100644 src/decorators/resolve.ts delete mode 100644 src/decorators/resolveData.ts delete mode 100644 src/decorators/state.ts diff --git a/src/decorators/index.ts b/src/decorators/index.ts deleted file mode 100644 index 5e722737..00000000 --- a/src/decorators/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./resolve"; -export * from "./resolveData"; -export * from "./state"; diff --git a/src/decorators/resolve.ts b/src/decorators/resolve.ts deleted file mode 100644 index da2c60cd..00000000 --- a/src/decorators/resolve.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { StateDeclaration } from '../state/interface'; -import { isArray } from '../common/predicates'; - -export function Resolve(resolveConfig: { token?: string, deps?: any[] }): PropertyDecorator { - resolveConfig = resolveConfig || {}; - - return function(target: StateDeclaration, property) { - const resolve = target.resolve = target.resolve || []; - const token = resolveConfig.token || property; - const deps = resolveConfig.deps || []; - - if (!isArray(resolve)) { - throw new Error(`@ResolveData() only supports array style resolve: state: '${target.name}', resolve: ${property}, token: ${token}.`) - } - - resolve.push({ token, deps, resolveFn: target[property] }); - }; -} diff --git a/src/decorators/resolveData.ts b/src/decorators/resolveData.ts deleted file mode 100644 index b638e975..00000000 --- a/src/decorators/resolveData.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * An ES7 decorator which maps resolve data to a component. - * - * Add this decorator to a property of your component. - * The decorator marks the component's property to receive resolve data. - * - * When resolve data of the same name (token) is found, - * the resolve data will be assigned to the component's property. - * - * #### Example: - * - * The component's properties receive resolve data from the state definition. - * ```js - * @Component({ selector: 'foo' }) - * export class FooComponent { - * @Resolve() resolveToken1; - * @Resolve('resolveToken2') prop2; - * @Input() @Resolve() resolveToken3; - * } - * - * const fooState = { - * name: 'foo', - * component: FooComponent, - * resolve: [ - * { token: 'resolveToken1', deps: [], resolveFn: resolve1Fn }, - * { token: 'resolveToken2', deps: [], resolveFn: resolve2Fn }, - * { token: 'resolveToken3', deps: [], resolveFn: resolve3Fn }, - * ] - * } - * ``` - * - * @param token The resolve token to bind to this property - * (if omitted, the property name is used as the token) - */ -export function ResolveData(token?: string): PropertyDecorator { - return function(target, property: string) { - const inputs = target['__inputs'] = target['__inputs'] || {}; - token = token || property; - inputs[token] = property; - }; -} \ No newline at end of file diff --git a/src/decorators/state.ts b/src/decorators/state.ts deleted file mode 100644 index c9d441c9..00000000 --- a/src/decorators/state.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { isString } from '../common/predicates'; - -export function State(stateName?: string): ClassDecorator { - return function(targetClass: { new(...args: any[]): T }) { - if (isString(stateName)) targetClass.prototype.name = stateName; - targetClass['__uiRouterState'] = true; - }; -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 1c962282..634f9861 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,6 @@ export * from "./state/index"; export * from "./transition/index"; export * from "./url/index"; export * from "./view/index"; -export * from "./decorators/index"; export * from "./globals"; export * from "./router";