smoothly 0.1.84 → 0.1.88
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/cjs/{generate-a6821b82.js → generate-f9a36f25.js} +1 -1
- package/dist/cjs/{index-fc82954f.js → index-ac32385c.js} +230 -184
- package/dist/cjs/index-bc3845e8.js +1670 -0
- package/dist/cjs/index.cjs.js +214 -116
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/smoothly-accordion_47.cjs.entry.js +1163 -19143
- package/dist/cjs/smoothly-calendar.cjs.entry.js +40 -12
- package/dist/cjs/smoothly-display-amount.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-display.cjs.entry.js +2 -1
- package/dist/cjs/smoothly-input-date-range.cjs.entry.js +10 -11
- package/dist/cjs/smoothly-input-date.cjs.entry.js +6 -2
- package/dist/cjs/smoothly-input-month.cjs.entry.js +2 -2
- package/dist/cjs/smoothly-input.cjs.entry.js +17 -10
- package/dist/cjs/smoothly-select-demo.cjs.entry.js +2 -2
- package/dist/cjs/smoothly.cjs.js +1 -1
- package/dist/collection/components/calendar/index.js +80 -11
- package/dist/collection/components/display/index.js +1 -1
- package/dist/collection/components/input/index.js +17 -10
- package/dist/collection/components/input-date/index.js +12 -1
- package/dist/collection/components/input-date/style.css +4 -0
- package/dist/collection/components/input-date-range/index.js +14 -15
- package/dist/collection/components/input-date-range/style.css +4 -0
- package/dist/collection/components/select-demo/index.js +2 -2
- package/dist/collection/index.js +1 -1
- package/dist/collection/utilities/Cosmetic/Color/CommaRgb.js +90 -0
- package/dist/collection/utilities/Cosmetic/Color/Hex.js +11 -0
- package/dist/collection/utilities/Cosmetic/Color/Hsl.js +32 -0
- package/dist/collection/utilities/{colorNames.js → Cosmetic/Color/Name.js} +9 -1
- package/dist/collection/utilities/Cosmetic/Color/Rgb.js +19 -0
- package/dist/collection/utilities/Cosmetic/Color/index.js +23 -0
- package/dist/collection/utilities/Cosmetic/index.js +40 -0
- package/dist/collection/utilities/index.js +1 -1
- package/dist/custom-elements/index.js +1539 -19619
- package/dist/esm/{generate-776b3b0f.js → generate-50b98474.js} +1 -1
- package/dist/esm/index-37a67c97.js +1668 -0
- package/dist/{smoothly/index-a28d88cf.js → esm/index-a5a08f46.js} +230 -184
- package/dist/esm/index.js +215 -116
- package/dist/esm/loader.js +1 -1
- package/dist/esm/smoothly-accordion_47.entry.js +1163 -19143
- package/dist/esm/smoothly-calendar.entry.js +40 -12
- package/dist/esm/smoothly-display-amount.entry.js +1 -1
- package/dist/esm/smoothly-display.entry.js +2 -1
- package/dist/esm/smoothly-input-date-range.entry.js +10 -11
- package/dist/esm/smoothly-input-date.entry.js +6 -2
- package/dist/esm/smoothly-input-month.entry.js +2 -2
- package/dist/esm/smoothly-input.entry.js +17 -10
- package/dist/esm/smoothly-select-demo.entry.js +2 -2
- package/dist/esm/smoothly.js +1 -1
- package/dist/smoothly/{generate-776b3b0f.js → generate-50b98474.js} +1 -1
- package/dist/smoothly/index-37a67c97.js +1668 -0
- package/dist/{esm/index-a28d88cf.js → smoothly/index-a5a08f46.js} +230 -184
- package/dist/smoothly/index.esm.js +215 -116
- package/dist/smoothly/p-0286085b.entry.js +1 -0
- package/dist/smoothly/smoothly-calendar.entry.js +40 -12
- package/dist/smoothly/smoothly-display-amount.entry.js +1 -1
- package/dist/smoothly/smoothly-display.entry.js +2 -1
- package/dist/smoothly/smoothly-input-date-range.entry.js +10 -11
- package/dist/smoothly/smoothly-input-date.entry.js +6 -2
- package/dist/smoothly/smoothly-input-month.entry.js +2 -2
- package/dist/smoothly/smoothly-input.entry.js +17 -10
- package/dist/smoothly/smoothly-select-demo.entry.js +2 -2
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/calendar/index.d.ts +6 -1
- package/dist/types/components/input/index.d.ts +1 -0
- package/dist/types/components/input-date/index.d.ts +1 -0
- package/dist/types/components/input-date-range/index.d.ts +2 -2
- package/dist/types/components.d.ts +3 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utilities/Cosmetic/Color/CommaRgb.d.ts +11 -0
- package/dist/types/utilities/Cosmetic/Color/Hex.d.ts +4 -0
- package/dist/types/utilities/Cosmetic/Color/Hsl.d.ts +4 -0
- package/dist/types/utilities/Cosmetic/Color/Name.d.ts +155 -0
- package/dist/types/utilities/Cosmetic/Color/Rgb.d.ts +4 -0
- package/dist/types/utilities/Cosmetic/Color/index.d.ts +170 -0
- package/dist/types/utilities/Cosmetic/index.d.ts +23 -0
- package/dist/types/utilities/index.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cjs/index-42db74b3.js +0 -19931
- package/dist/collection/utilities/colorTransform.js +0 -120
- package/dist/esm/index-36a04e8c.js +0 -19929
- package/dist/smoothly/index-36a04e8c.js +0 -19929
- package/dist/smoothly/p-5ca32c49.entry.js +0 -1
- package/dist/types/utilities/colorNames.d.ts +0 -3
- package/dist/types/utilities/colorTransform.d.ts +0 -8
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { colorNames } from "./colorNames";
|
|
2
|
-
export function toCommaRgb(color) {
|
|
3
|
-
let result;
|
|
4
|
-
const colorWithoutSpace = color.replace(/ /g, "").toLowerCase();
|
|
5
|
-
if (isCommaRgb(colorWithoutSpace))
|
|
6
|
-
result = colorWithoutSpace;
|
|
7
|
-
else if (isHex(colorWithoutSpace))
|
|
8
|
-
result = hexToCommaRgb(colorWithoutSpace);
|
|
9
|
-
else if (isRgb(colorWithoutSpace))
|
|
10
|
-
result = rgbToCommaRgb(colorWithoutSpace);
|
|
11
|
-
else if (colorWithoutSpace in colorNames)
|
|
12
|
-
result = hexToCommaRgb(colorNames[colorWithoutSpace]);
|
|
13
|
-
else if (isHsl(colorWithoutSpace))
|
|
14
|
-
result = hslToCommaRgb(colorWithoutSpace);
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
export function isCommaRgb(commaRgb) {
|
|
18
|
-
const values = commaRgb.split(",");
|
|
19
|
-
return (values.length == 3 &&
|
|
20
|
-
values.every(value => {
|
|
21
|
-
var _a;
|
|
22
|
-
return !Number.isNaN(value) &&
|
|
23
|
-
((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
|
|
24
|
-
Number(value) >= 0 &&
|
|
25
|
-
Number(value) <= 255;
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
export function isHex(hex) {
|
|
29
|
-
const matchArray = hex.match(/[0-9a-fA-F]/g);
|
|
30
|
-
return hex[0] == "#" && ((matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 3 || (matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 6);
|
|
31
|
-
}
|
|
32
|
-
export function hexToCommaRgb(hex) {
|
|
33
|
-
let result = "0,0,0";
|
|
34
|
-
if (hex.length == 7)
|
|
35
|
-
result = `${parseInt(hex.substr(1, 2), 16)},${parseInt(hex.substr(3, 2), 16)},${parseInt(hex.substr(5, 2), 16)}`;
|
|
36
|
-
else if (hex.length == 4)
|
|
37
|
-
result = hexToCommaRgb(`#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`);
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
export function isRgb(rgb) {
|
|
41
|
-
const values = rgb.substring(4, rgb.length - 1).split(",");
|
|
42
|
-
return (rgb.substr(0, 4) == "rgb(" &&
|
|
43
|
-
rgb.substr(rgb.length - 1, 1) == ")" &&
|
|
44
|
-
values.length == 3 &&
|
|
45
|
-
values.every(value => {
|
|
46
|
-
var _a;
|
|
47
|
-
return !Number.isNaN(value) &&
|
|
48
|
-
((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
|
|
49
|
-
Number(value) >= 0 &&
|
|
50
|
-
Number(value) <= 255;
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
export function rgbToCommaRgb(rgb) {
|
|
54
|
-
return rgb.substring(4, rgb.length - 1);
|
|
55
|
-
}
|
|
56
|
-
export function isHsl(hsl) {
|
|
57
|
-
const values = hsl.substring(4, hsl.length - 1).split(",");
|
|
58
|
-
return (hsl.substr(0, 4) == "hsl(" &&
|
|
59
|
-
hsl.substr(hsl.length - 1, 1) == ")" &&
|
|
60
|
-
values.length == 3 &&
|
|
61
|
-
values.every((value, index) => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
let result = false;
|
|
64
|
-
if (index == 0)
|
|
65
|
-
result =
|
|
66
|
-
!Number.isNaN(value) &&
|
|
67
|
-
((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
|
|
68
|
-
Number(value) >= 0 &&
|
|
69
|
-
Number(value) <= 360;
|
|
70
|
-
else {
|
|
71
|
-
const number = value.substr(0, value.length - 1);
|
|
72
|
-
result =
|
|
73
|
-
value[value.length - 1] == "%" &&
|
|
74
|
-
!Number.isNaN(number) &&
|
|
75
|
-
((_b = number.match(/[0-9]/g)) === null || _b === void 0 ? void 0 : _b.length) == number.length &&
|
|
76
|
-
Number(number) >= 0 &&
|
|
77
|
-
Number(number) <= 100;
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
function hue2rgb(p, q, t) {
|
|
83
|
-
let result = p;
|
|
84
|
-
if (t < 0)
|
|
85
|
-
t += 1;
|
|
86
|
-
if (t > 1)
|
|
87
|
-
t -= 1;
|
|
88
|
-
if (t < 1 / 6)
|
|
89
|
-
result = p + (q - p) * 6 * t;
|
|
90
|
-
else if (t < 1 / 2)
|
|
91
|
-
result = q;
|
|
92
|
-
else if (t < 2 / 3)
|
|
93
|
-
result = p + (q - p) * (2 / 3 - t) * 6;
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
export function hslToCommaRgb(hsl) {
|
|
97
|
-
let result;
|
|
98
|
-
let h, s, l;
|
|
99
|
-
let r, g, b;
|
|
100
|
-
const HSL = hsl
|
|
101
|
-
.substring(4, hsl.length - 1)
|
|
102
|
-
.split(",")
|
|
103
|
-
.map((value, index) => Number(index == 0 ? value : value.substr(0, value.length - 1)));
|
|
104
|
-
if (HSL.length == 3) {
|
|
105
|
-
h = HSL[0] / 360;
|
|
106
|
-
s = HSL[1] / 100;
|
|
107
|
-
l = HSL[2] / 100;
|
|
108
|
-
if (s == 0)
|
|
109
|
-
r = g = b = l;
|
|
110
|
-
else {
|
|
111
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
112
|
-
const p = 2 * l - q;
|
|
113
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
114
|
-
g = hue2rgb(p, q, h);
|
|
115
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
116
|
-
}
|
|
117
|
-
result = `${Math.round(255 * r)},${Math.round(255 * g)},${Math.round(255 * b)}`;
|
|
118
|
-
}
|
|
119
|
-
return result;
|
|
120
|
-
}
|