@ctrl/tinycolor 3.6.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd_api.d.ts CHANGED
@@ -1,12 +1,11 @@
1
- import { names } from './css-color-names';
2
- import { inputToRGB, isValidCSSUnit, stringInputToObject } from './format-input';
3
- import { fromRatio, legacyRandom } from './from-ratio';
4
- import { TinyColor } from './index';
5
- import { random } from './random';
6
- import { mostReadable, readability } from './readability';
7
- import { toMsFilter } from './to-ms-filter';
1
+ import { names } from './css-color-names.js';
2
+ import { inputToRGB, isValidCSSUnit, stringInputToObject } from './format-input.js';
3
+ import { fromRatio, legacyRandom } from './from-ratio.js';
4
+ import { TinyColor } from './index.js';
5
+ import { random } from './random.js';
6
+ import { mostReadable, readability } from './readability.js';
7
+ import { toMsFilter } from './to-ms-filter.js';
8
8
  export interface TinyColorUMD {
9
- (): TinyColor;
10
9
  TinyColor: typeof TinyColor;
11
10
  readability: typeof readability;
12
11
  random: typeof random;
package/dist/umd_api.js CHANGED
@@ -1,22 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var css_color_names_1 = require("./css-color-names");
4
- var format_input_1 = require("./format-input");
5
- var from_ratio_1 = require("./from-ratio");
6
- var index_1 = require("./index");
7
- var random_1 = require("./random");
8
- var readability_1 = require("./readability");
9
- var to_ms_filter_1 = require("./to-ms-filter");
10
- var tinycolorumd = index_1.tinycolor;
11
- tinycolorumd.TinyColor = index_1.TinyColor;
12
- tinycolorumd.readability = readability_1.readability;
13
- tinycolorumd.mostReadable = readability_1.mostReadable;
14
- tinycolorumd.random = random_1.random;
15
- tinycolorumd.names = css_color_names_1.names;
16
- tinycolorumd.fromRatio = from_ratio_1.fromRatio;
17
- tinycolorumd.legacyRandom = from_ratio_1.legacyRandom;
18
- tinycolorumd.toMsFilter = to_ms_filter_1.toMsFilter;
19
- tinycolorumd.inputToRGB = format_input_1.inputToRGB;
20
- tinycolorumd.stringInputToObject = format_input_1.stringInputToObject;
21
- tinycolorumd.isValidCSSUnit = format_input_1.isValidCSSUnit;
3
+ const css_color_names_js_1 = require("./css-color-names.js");
4
+ const format_input_js_1 = require("./format-input.js");
5
+ const from_ratio_js_1 = require("./from-ratio.js");
6
+ const index_js_1 = require("./index.js");
7
+ const random_js_1 = require("./random.js");
8
+ const readability_js_1 = require("./readability.js");
9
+ const to_ms_filter_js_1 = require("./to-ms-filter.js");
10
+ const tinycolorumd = {
11
+ TinyColor: index_js_1.TinyColor,
12
+ readability: readability_js_1.readability,
13
+ mostReadable: readability_js_1.mostReadable,
14
+ random: random_js_1.random,
15
+ names: css_color_names_js_1.names,
16
+ fromRatio: from_ratio_js_1.fromRatio,
17
+ legacyRandom: from_ratio_js_1.legacyRandom,
18
+ toMsFilter: to_ms_filter_js_1.toMsFilter,
19
+ inputToRGB: format_input_js_1.inputToRGB,
20
+ stringInputToObject: format_input_js_1.stringInputToObject,
21
+ isValidCSSUnit: format_input_js_1.isValidCSSUnit,
22
+ };
22
23
  exports.default = tinycolorumd;
package/dist/util.js CHANGED
@@ -9,7 +9,7 @@ function bound01(n, max) {
9
9
  if (isOnePointZero(n)) {
10
10
  n = '100%';
11
11
  }
12
- var isPercent = isPercentage(n);
12
+ const isPercent = isPercentage(n);
13
13
  n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
14
14
  // Automatically convert percentage into number
15
15
  if (isPercent) {
@@ -76,8 +76,8 @@ exports.boundAlpha = boundAlpha;
76
76
  * @hidden
77
77
  */
78
78
  function convertToPercentage(n) {
79
- if (n <= 1) {
80
- return "".concat(Number(n) * 100, "%");
79
+ if (Number(n) <= 1) {
80
+ return `${Number(n) * 100}%`;
81
81
  }
82
82
  return n;
83
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/tinycolor",
3
- "version": "3.6.0",
3
+ "version": "4.0.0",
4
4
  "description": "Fast, small color manipulation and conversion for JavaScript",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "publishConfig": {
@@ -25,53 +25,36 @@
25
25
  ],
26
26
  "sideEffects": false,
27
27
  "scripts": {
28
- "build:demo": "rollup -c rollup.demo.js",
29
- "watch:demo": "rollup -c rollup.demo.js -w",
28
+ "demo:build": "npm run build --workspace=demo",
29
+ "demo:watch": "npm run dev --workspace=demo",
30
30
  "lint": "eslint --ext .js,.ts, .",
31
31
  "lint:fix": "eslint --fix --ext .js,.ts, .",
32
32
  "prepare": "npm run build",
33
33
  "build": "del-cli dist && tsc -p tsconfig.build.json && tsc -p tsconfig.module.json && ts-node build",
34
- "build:docs": "typedoc --out demo/public/docs --hideGenerator --tsconfig tsconfig.build.json src/public_api.ts",
35
- "test": "jest",
36
- "test:ci": "jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage",
37
- "test:watch": "jest --watch"
34
+ "docs:build": "typedoc --out demo/dist/docs --hideGenerator --tsconfig tsconfig.build.json src/public_api.ts",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "test:ci": "vitest run --coverage --reporter=default --reporter=junit --outputFile=./junit.xml"
38
38
  },
39
- "dependencies": {},
40
39
  "devDependencies": {
41
- "@babel/plugin-transform-modules-commonjs": "7.19.6",
42
- "@babel/preset-typescript": "7.18.6",
43
- "@ctrl/eslint-config": "3.5.6",
44
- "@jest/globals": "29.3.1",
45
- "@types/node": "18.11.11",
40
+ "@ctrl/eslint-config": "4.0.3",
41
+ "@rollup/plugin-terser": "0.4.3",
42
+ "@types/node": "20.5.4",
43
+ "@vitest/coverage-v8": "0.34.2",
46
44
  "del-cli": "5.0.0",
47
- "jest": "29.3.1",
48
- "jest-junit": "15.0.0",
49
- "rollup": "2.70.1",
50
- "rollup-plugin-livereload": "2.0.5",
51
- "rollup-plugin-serve": "1.1.0",
52
- "rollup-plugin-sourcemaps": "0.6.3",
53
- "rollup-plugin-terser": "7.0.2",
54
- "rollup-plugin-typescript2": "0.34.1",
45
+ "rollup": "3.28.1",
55
46
  "ts-node": "10.9.1",
56
- "typedoc": "0.23.21",
57
- "typescript": "4.9.3"
58
- },
59
- "jest": {
60
- "testEnvironment": "node",
61
- "coverageProvider": "v8"
62
- },
63
- "babel": {
64
- "presets": [
65
- "@babel/preset-typescript"
66
- ],
67
- "plugins": [
68
- "@babel/plugin-transform-modules-commonjs"
69
- ]
47
+ "typedoc": "0.24.8",
48
+ "typescript": "5.1.6",
49
+ "vitest": "0.34.2"
70
50
  },
51
+ "workspaces": [
52
+ "demo"
53
+ ],
71
54
  "release": {
72
55
  "branch": "master"
73
56
  },
74
57
  "engines": {
75
- "node": ">=10"
58
+ "node": ">=14"
76
59
  }
77
60
  }