Skip to content

Commit

Permalink
fix(color): update ColorMode & Hue const enum handling
Browse files Browse the repository at this point in the history
- remove reverse `__ColorMode` hack
- should fix bundling issues w/ webpack
  • Loading branch information
postspectacular committed Feb 28, 2019
1 parent 17bf599 commit bb71b7c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions packages/color/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ export const enum ColorMode {
YCBCRA
}

/**
* Reverse lookup for `ColorMode` enums
*/
export const __ColorMode = (<any>exports).ColorMode;

export interface IColor {
readonly mode: ColorMode;
}
Expand All @@ -54,7 +49,7 @@ export const RGB_LUMINANCE = [0.299, 0.587, 0.114];

// Hue names

export enum Hue {
export const enum Hue {
RED,
ORANGE,
YELLOW,
Expand Down
3 changes: 1 addition & 2 deletions packages/color/src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@thi.ng/defmulti";
import { illegalArgs } from "@thi.ng/errors";
import {
__ColorMode,
Color,
ColorConversion,
ColorMode,
Expand Down Expand Up @@ -49,7 +48,7 @@ convert.add(
(col: any, mdest, msrc) =>
(col.mode !== undefined && col.mode === mdest) || (mdest === msrc) ?
col :
illegalArgs(`missing conversion for ${__ColorMode[msrc]} -> ${__ColorMode[mdest]}`)
illegalArgs(`missing conversion for mode ${msrc} -> ${mdest}`)
);

export function asCSS(col: IColor): string;
Expand Down
3 changes: 2 additions & 1 deletion packages/color/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"outDir": ".",
"module": "es6",
"target": "es6"
"target": "es6",
"preserveConstEnums": false
},
"include": [
"./src/**/*.ts"
Expand Down

0 comments on commit bb71b7c

Please sign in to comment.