From 2b2dffcc4f74d76d6e1814e5dfd13fa86ac492ca Mon Sep 17 00:00:00 2001 From: Dean Tarisai Date: Mon, 20 Nov 2023 03:23:33 +0200 Subject: [PATCH] Added a default forb iterations in earthtone --- build.cjs | 12 ++++++------ package.json | 1 - src/fp/array/customSort.ts | 4 ++-- src/fp/array/sortedArr.ts | 4 ++-- src/palettes/earthtone.ts | 5 +++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/build.cjs b/build.cjs index a25fc605..7fdd2be4 100644 --- a/build.cjs +++ b/build.cjs @@ -4,12 +4,12 @@ // eslint-disable-next-line no-undef var { build } = require('esbuild'); - +var { dependencies } = require('./package.json') const sharedConfig = { entryPoints: ['.//src/index.ts'], - bundle: false, + bundle: true, minify: false }; @@ -49,7 +49,6 @@ build({ format: 'esm', entryPoints: ['.//src/colors/index.ts'], outfile: 'dist/colors/index.esm.mjs', - }); @@ -67,8 +66,9 @@ build({ //Bundled ESM build({ ...sharedConfig, + external: Object.keys(dependencies), format: 'esm', - outfile: 'dist/huetiful.esm.mjs', minifySyntax: true + outfile: 'dist/huetiful.esm.mjs', minifySyntax: true, }); @@ -78,7 +78,7 @@ build({ format: 'esm', outfile: 'dist/huetiful.esm.min.mjs', minify: true, - bundle: true, minifySyntax: true + }); //Bundled IIFE @@ -87,7 +87,7 @@ build({ format: 'iife', outfile: 'dist/huetiful.min.js', globalName: 'huetiful', - bundle: true, minifySyntax: true, minify: true + minify: true }); diff --git a/package.json b/package.json index 8fff246c..783ae809 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "huetiful-js", "version": "1.7.6", "type": "module", - "main": "./dist/huetiful.cjs", "module": "./dist/huetiful.esm.mjs", "browser": "./dist/huetiful.min.js", "exports": { diff --git a/src/fp/array/customSort.ts b/src/fp/array/customSort.ts index d87e60f2..d14a5483 100644 --- a/src/fp/array/customSort.ts +++ b/src/fp/array/customSort.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { Factor, order } from '../../paramTypes'; +import { Factor, Order } from '../../paramTypes'; /** * @description Helper function for native sorting method for arrays. @@ -7,7 +7,7 @@ import { Factor, order } from '../../paramTypes'; * @param order Either ascending or descending. * @returns A sorted array. */ -export const customSort = (order: order, factor?: Factor) => { +export const customSort = (order: Order, factor?: Factor) => { // Special thanks to deechris27 on youtube // a-b gives asc order & b-a gives desc order factor = factor || 'factor'; diff --git a/src/fp/array/sortedArr.ts b/src/fp/array/sortedArr.ts index 4cddc153..0ae00f57 100644 --- a/src/fp/array/sortedArr.ts +++ b/src/fp/array/sortedArr.ts @@ -1,4 +1,4 @@ -import { Factor, Color, callback, order } from '../../paramTypes'; +import { Factor, Color, callback, Order } from '../../paramTypes'; import { colorObjArr } from './colorObjArr'; import { customSort } from './customSort'; @@ -9,7 +9,7 @@ import { customSort } from './customSort'; * @returns An array of colors or color objects. */ const sortedArr = - (factor: Factor, callback: callback, order: order, colorObj = false) => + (factor: Factor, callback: callback, order: Order, colorObj = false) => (colors: Color[]) => { const results: Color[] | Array<{ factor: number; name: Color }> = colorObjArr(factor, callback)(colors); diff --git a/src/palettes/earthtone.ts b/src/palettes/earthtone.ts index b4914c1a..1ab83612 100644 --- a/src/palettes/earthtone.ts +++ b/src/palettes/earthtone.ts @@ -36,8 +36,8 @@ console.log(earthtone("pink", "clay", 5)) const earthtone = ( color: Color, earthtone?: Earthtones, - iterations = 1, - options: EarthtoneOptions + iterations?: number, + options?: EarthtoneOptions ): Color[] => { options = { easingFunc: easingSmootherstep, @@ -46,6 +46,7 @@ const earthtone = ( hueFixup: fixupHueShorter, lightnessInterpolator: interpolatorSplineMonotone }; + iterations = iterations < 1 ? 1 : iterations; earthtone = earthtone.toLowerCase(); const tones = { 'light-gray': '#e5e5e5',