@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/README.md +1 -1
- package/dist/bundles/tinycolor.umd.min.js +1 -1
- package/dist/bundles/tinycolor.umd.min.js.map +1 -1
- package/dist/conversion.d.ts +1 -1
- package/dist/conversion.js +58 -58
- package/dist/format-input.d.ts +1 -1
- package/dist/format-input.js +44 -45
- package/dist/from-ratio.d.ts +1 -1
- package/dist/from-ratio.js +8 -8
- package/dist/index.d.ts +1 -2
- package/dist/index.js +172 -200
- package/dist/module/conversion.js +32 -32
- package/dist/module/css-color-names.js +1 -1
- package/dist/module/format-input.js +20 -21
- package/dist/module/from-ratio.js +3 -3
- package/dist/module/index.js +161 -189
- package/dist/module/public_api.js +9 -12
- package/dist/module/random.js +38 -41
- package/dist/module/readability.js +13 -17
- package/dist/module/to-ms-filter.js +8 -8
- package/dist/module/umd_api.js +20 -19
- package/dist/module/util.js +3 -3
- package/dist/public_api.d.ts +9 -11
- package/dist/public_api.js +9 -12
- package/dist/random.d.ts +1 -1
- package/dist/random.js +38 -41
- package/dist/readability.d.ts +1 -1
- package/dist/readability.js +14 -18
- package/dist/to-ms-filter.d.ts +1 -1
- package/dist/to-ms-filter.js +9 -9
- package/dist/umd_api.d.ts +7 -8
- package/dist/umd_api.js +20 -19
- package/dist/util.js +3 -3
- package/package.json +19 -36
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
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
|
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
|
+
"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
|
29
|
-
"watch
|
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
|
35
|
-
"test": "
|
36
|
-
"test:
|
37
|
-
"test:
|
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
|
-
"@
|
42
|
-
"@
|
43
|
-
"@
|
44
|
-
"@
|
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
|
-
"
|
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.
|
57
|
-
"typescript": "
|
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": ">=
|
58
|
+
"node": ">=14"
|
76
59
|
}
|
77
60
|
}
|