From 4edb0a6ef963ec92914cf355e03afa0daa2a5379 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Thu, 16 Aug 2018 09:38:34 -0700 Subject: [PATCH] fixed cyclic color import --- src/mol-util/color/color.ts | 12 ++++++++---- src/mol-util/color/index.ts | 12 ++---------- src/mol-util/color/scale.ts | 2 +- src/mol-util/color/tables.ts | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/mol-util/color/color.ts b/src/mol-util/color/color.ts index 21f28c785..ea0c4efc0 100644 --- a/src/mol-util/color/color.ts +++ b/src/mol-util/color/color.ts @@ -5,11 +5,11 @@ */ /** RGB color triplet expressed as a single number */ -type Color = { readonly '@type': 'color' } & number +export type Color = { readonly '@type': 'color' } & number -function Color(hex: number) { return hex as Color } +export function Color(hex: number) { return hex as Color } -namespace Color { +export namespace Color { export function toRgb(hexColor: Color) { return [ hexColor >> 16 & 255, hexColor >> 8 & 255, hexColor & 255 ] } @@ -53,4 +53,8 @@ namespace Color { } } -export default Color \ No newline at end of file +type ColorTable<T extends { [k: string]: number[] }> = { [k in keyof T]: Color[] } +export function ColorTable<T extends { [k: string]: number[] }>(o: T) { return o as ColorTable<T> } + +type ColorMap<T extends { [k: string]: number }> = { [k in keyof T]: Color } +export function ColorMap<T extends { [k: string]: number }>(o: T) { return o as ColorMap<T> } \ No newline at end of file diff --git a/src/mol-util/color/index.ts b/src/mol-util/color/index.ts index dbf65d1e9..2332d4a24 100644 --- a/src/mol-util/color/index.ts +++ b/src/mol-util/color/index.ts @@ -4,14 +4,6 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -import Color from './color' -import { ColorScale } from './scale'; - -type ColorTable<T extends { [k: string]: number[] }> = { [k in keyof T]: Color[] } -export function ColorTable<T extends { [k: string]: number[] }>(o: T) { return o as ColorTable<T> } - -type ColorMap<T extends { [k: string]: number }> = { [k in keyof T]: Color } -export function ColorMap<T extends { [k: string]: number }>(o: T) { return o as ColorMap<T> } - -export { Color, ColorScale } +export { Color, ColorMap, ColorTable } from './color' +export { ColorScale } from './scale'; export { ColorBrewer, ColorNames } from './tables' \ No newline at end of file diff --git a/src/mol-util/color/scale.ts b/src/mol-util/color/scale.ts index f60fe54ba..f03b75399 100644 --- a/src/mol-util/color/scale.ts +++ b/src/mol-util/color/scale.ts @@ -4,7 +4,7 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -import Color from './color' +import { Color } from './color' import { ColorBrewer } from './tables' export interface ColorScale { diff --git a/src/mol-util/color/tables.ts b/src/mol-util/color/tables.ts index dbaf80d55..a9012c3ea 100644 --- a/src/mol-util/color/tables.ts +++ b/src/mol-util/color/tables.ts @@ -4,7 +4,7 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -import { ColorMap, ColorTable } from './index'; +import { ColorMap, ColorTable } from './color'; /** * Brewer Color Lists -- GitLab