Skip to content

Commit

Permalink
fix: repair non-default imports (#348)
Browse files Browse the repository at this point in the history
resolves #346
  • Loading branch information
gka authored Aug 14, 2024
1 parent 6622770 commit 60e072d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
17 changes: 13 additions & 4 deletions index-light.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@ import './src/interpolator/lrgb.js';
import './src/interpolator/oklab.js';

// generators -- > create new colors
import mix from './src/generator/mix';
chroma.mix = chroma.interpolate = mix;
import mix from './src/generator/mix.js';

// other utility methods
import valid from './src/utils/valid';
chroma.valid = valid;
import valid from './src/utils/valid.js';

import Color from './src/Color.js';

Object.assign(chroma, {
Color,
valid,
mix,
interpolate: mix
});

export default chroma;

export { Color, valid, mix, mix as interpolate };
40 changes: 32 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,50 @@ import scales from './src/utils/scales.js';
// colors
import colors from './src/colors/w3cx11.js';
import brewer from './src/colors/colorbrewer.js';
import Color from './src/Color.js';

Object.assign(chroma, {
analyze,
average,
bezier,
blend,
brewer,
Color,
colors,
contrast,
cubehelix,
mix,
deltaE,
distance,
input,
interpolate: mix,
limits,
mix,
random,
scale,
scales,
valid
});

export default chroma;

export {
analyze,
average,
bezier,
blend,
brewer,
Color,
colors,
contrast,
cubehelix,
deltaE,
distance,
input,
limits,
valid,
mix,
mix as interpolate,
random,
scale,
scales,
input,
colors,
brewer
});

export default chroma;
valid
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
".": {
"import": "./index.js",
"require": "./dist/chroma.cjs"
},
"./light": {
"import": "./index-light.js",
"require": "./dist/chroma-light.cjs"
}
},
"main": "./index.js",
Expand Down
3 changes: 1 addition & 2 deletions src/chroma.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import Color from './Color.js';
import { version } from './version.js';

const chroma = (...args) => {
return new chroma.Color(...args);
return new Color(...args);
};

chroma.Color = Color;
chroma.version = version;

export default chroma;

0 comments on commit 60e072d

Please sign in to comment.