smoothly 0.1.82 → 0.1.86
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-14aca5d2.js → generate-a6821b82.js} +2 -2
- package/dist/cjs/index.cjs.js +214 -116
- package/dist/cjs/smoothly-accordion_47.cjs.entry.js +9 -17
- package/dist/cjs/smoothly-calendar.cjs.entry.js +6 -14
- package/dist/cjs/smoothly-input-date-range.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-input-date.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-input-month.cjs.entry.js +1 -1
- package/dist/collection/components/calendar/generate.js +2 -2
- package/dist/collection/components/calendar/index.js +9 -17
- package/dist/collection/components/input-date/style.css +4 -0
- package/dist/collection/components/input-date-range/style.css +4 -0
- 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 +230 -139
- package/dist/{smoothly/generate-be25a8d1.js → esm/generate-776b3b0f.js} +2 -2
- package/dist/esm/index.js +215 -116
- package/dist/esm/smoothly-accordion_47.entry.js +9 -17
- package/dist/esm/smoothly-calendar.entry.js +6 -14
- package/dist/esm/smoothly-input-date-range.entry.js +1 -1
- package/dist/esm/smoothly-input-date.entry.js +1 -1
- package/dist/esm/smoothly-input-month.entry.js +1 -1
- package/dist/{esm/generate-be25a8d1.js → smoothly/generate-776b3b0f.js} +2 -2
- package/dist/smoothly/index.esm.js +215 -116
- package/dist/smoothly/p-375a8d94.entry.js +1 -0
- package/dist/smoothly/smoothly-calendar.entry.js +6 -14
- package/dist/smoothly/smoothly-input-date-range.entry.js +1 -1
- package/dist/smoothly/smoothly-input-date.entry.js +1 -1
- package/dist/smoothly/smoothly-input-month.entry.js +1 -1
- package/dist/types/components/calendar/index.d.ts +2 -2
- package/dist/types/components.d.ts +2 -2
- 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 +1 -1
- package/dist/collection/utilities/colorTransform.js +0 -120
- package/dist/smoothly/p-e3ae8b97.entry.js +0 -1
- package/dist/types/utilities/colorNames.d.ts +0 -3
- package/dist/types/utilities/colorTransform.d.ts +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, i as createEvent, h, j as getElement } from './index-02a70ac1.js';
|
|
2
2
|
import { d as dist } from './index-a28d88cf.js';
|
|
3
|
-
import { w as weekdays, m as month } from './generate-
|
|
3
|
+
import { w as weekdays, m as month } from './generate-776b3b0f.js';
|
|
4
4
|
import './_commonjsHelpers-8fe71198.js';
|
|
5
5
|
|
|
6
6
|
const styleCss = ".sc-smoothly-calendar-h{display:block;--other-month-opacity:0.5}.sc-smoothly-calendar-h>smoothly-input-month.sc-smoothly-calendar{width:calc(100% - 1em);padding:0.5em 0.5em 0 0.5em}th.sc-smoothly-calendar,td.sc-smoothly-calendar{text-align:center;padding:0.5em;min-width:2em;background-color:rgb(var(--smoothly-default-shade));cursor:pointer;user-select:none}td.currentMonth.sc-smoothly-calendar{color:rgb(var(--smoothly-default-contrast))}td.sc-smoothly-calendar:not(.currentMonth){color:rgba(var(--smoothly-default-contrast), var(--other-month-opacity))}td.sc-smoothly-calendar:nth-child(6):not(.currentMonth).selected,td.sc-smoothly-calendar:nth-child(6):not(.currentMonth).dateRange,td.sc-smoothly-calendar:nth-child(7):not(.currentMonth).selected,td.sc-smoothly-calendar:nth-child(7):not(.currentMonth).dateRange{color:rgba(var(--smoothly-default-contrast))}td.sc-smoothly-calendar:nth-child(6),td.sc-smoothly-calendar:nth-child(7){color:rgb(var(--smoothly-danger-tint))}td.sc-smoothly-calendar:nth-child(6):not(.currentMonth),td.sc-smoothly-calendar:nth-child(7):not(.currentMonth){color:rgba(var(--smoothly-danger-tint), var(--other-month-opacity))}td.sc-smoothly-calendar:not(.selected,.disable).sc-smoothly-calendar:hover{color:rgb(var(--smoothly-primary-contrast));background:rgb(var(--smoothly-primary-tint))}td.selected.sc-smoothly-calendar{color:rgb(var(--smoothly-primary-contrast));background:rgb(var(--smoothly-primary-color))}td.sc-smoothly-calendar:not(.selected,.dateRange).sc-smoothly-calendar:not(:hover).today{background:rgb(var(--smoothly-dark-tint));color:rgb(var(--smoothly-dark-contrast))}td.dateRange.sc-smoothly-calendar{color:rgb(var(--smoothly-primary-contrast));background:rgb(var(--smoothly-primary-tint))}td.disable.sc-smoothly-calendar{cursor:not-allowed;background-color:rgb(var(--smoothly-default-tint), 0.5);color:rgb(var(--smoothly-default-contrast), 0.5)}";
|
|
@@ -40,22 +40,14 @@ let Calendar = class {
|
|
|
40
40
|
event.stopPropagation();
|
|
41
41
|
} }),
|
|
42
42
|
h("table", null, h("thead", null, h("tr", null, weekdays().map(day => (h("th", null, day))))), month((_b = this.month) !== null && _b !== void 0 ? _b : this.value).map(week => (h("tr", null, week.map(date => {
|
|
43
|
-
var _a, _b, _c
|
|
44
|
-
return (h("td", { tabindex: 1, onClick: this.min || this.max
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
: undefined
|
|
48
|
-
: () => this.onClick(date), class: (date == this.value ? ["selected"] : [])
|
|
49
|
-
.concat(...(date == dist.Date.now() ? ["today"] : []), dist.Date.firstOfMonth((_c = this.month) !== null && _c !== void 0 ? _c : this.value) == dist.Date.firstOfMonth(date) ? ["currentMonth"] : [], this.doubleInput
|
|
50
|
-
? date >= ((_d = this.start) !== null && _d !== void 0 ? _d : "") && date <= ((_e = this.end) !== null && _e !== void 0 ? _e : "")
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
return (h("td", { tabindex: 1, onClick: (this.min || this.max) && (date < this.min || date > this.max) ? undefined : () => this.onClick(date), class: (date == this.value ? ["selected"] : [])
|
|
45
|
+
.concat(...(date == dist.Date.now() ? ["today"] : []), dist.Date.firstOfMonth((_a = this.month) !== null && _a !== void 0 ? _a : this.value) == dist.Date.firstOfMonth(date) ? ["currentMonth"] : [], this.doubleInput
|
|
46
|
+
? date >= ((_b = this.start) !== null && _b !== void 0 ? _b : "") && date <= ((_c = this.end) !== null && _c !== void 0 ? _c : "")
|
|
51
47
|
? ["dateRange"]
|
|
52
48
|
: []
|
|
53
49
|
: "")
|
|
54
|
-
.concat(...(this.min || this.max
|
|
55
|
-
? date < ((_f = this.min) !== null && _f !== void 0 ? _f : "") || date > ((_g = this.max) !== null && _g !== void 0 ? _g : "")
|
|
56
|
-
? ["disable"]
|
|
57
|
-
: []
|
|
58
|
-
: ""))
|
|
50
|
+
.concat(...(this.min || this.max ? (date < this.min || date > this.max ? ["disable"] : []) : ""))
|
|
59
51
|
.join(" ") }, date.substring(8, 10)));
|
|
60
52
|
}))))),
|
|
61
53
|
];
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, i as createEvent, h } from './index-02a70ac1.js'
|
|
|
2
2
|
import { d as dist } from './index-a28d88cf.js';
|
|
3
3
|
import './_commonjsHelpers-8fe71198.js';
|
|
4
4
|
|
|
5
|
-
const styleCss = ".sc-smoothly-input-date-range-h{position:relative;display:block}.sc-smoothly-input-date-range-h>nav.sc-smoothly-input-date-range{position:absolute;z-index:10;top:3.5em;background-color:rgb(var(--smoothly-default-shade));max-width:22em}.sc-smoothly-input-date-range-h>div.sc-smoothly-input-date-range{position:fixed;width:100vw;height:100vh;z-index:2}.sc-smoothly-input-date-range-h>nav.sc-smoothly-input-date-range>.arrow.sc-smoothly-input-date-range{position:absolute;z-index:9;transform:translate(10em, -.55em) rotate(45deg);width:1em;height:1em;background-color:rgb(var(--smoothly-default-shade))}.sc-smoothly-input-date-range-h>section.sc-smoothly-input-date-range{display:flex;flex-direction:row;align-items:center}.sc-smoothly-input-date-range-h>smoothly-input.sc-smoothly-input-date-range{padding:0}";
|
|
5
|
+
const styleCss = ".sc-smoothly-input-date-range-h{position:relative;display:block}.sc-smoothly-input-date-range-h>nav.sc-smoothly-input-date-range{position:absolute;z-index:10;top:3.5em;background-color:rgb(var(--smoothly-default-shade));max-width:22em}.sc-smoothly-input-date-range-h>div.sc-smoothly-input-date-range{position:fixed;top:0px;left:0px;right:0px;bottom:0px;width:100vw;height:100vh;z-index:2}.sc-smoothly-input-date-range-h>nav.sc-smoothly-input-date-range>.arrow.sc-smoothly-input-date-range{position:absolute;z-index:9;transform:translate(10em, -.55em) rotate(45deg);width:1em;height:1em;background-color:rgb(var(--smoothly-default-shade))}.sc-smoothly-input-date-range-h>section.sc-smoothly-input-date-range{display:flex;flex-direction:row;align-items:center}.sc-smoothly-input-date-range-h>smoothly-input.sc-smoothly-input-date-range{padding:0}";
|
|
6
6
|
|
|
7
7
|
let InputDateRange = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, i as createEvent, h } from './index-02a70ac1.js'
|
|
|
2
2
|
import { d as dist } from './index-a28d88cf.js';
|
|
3
3
|
import './_commonjsHelpers-8fe71198.js';
|
|
4
4
|
|
|
5
|
-
const styleCss = ".sc-smoothly-input-date-h{position:relative}nav.sc-smoothly-input-date{position:absolute;z-index:10;top:3.5em;background-color:rgb(var(--smoothly-default-shade));max-width:22em}.sc-smoothly-input-date-h>div.sc-smoothly-input-date{position:fixed;width:100vw;height:100vh;z-index:2}.sc-smoothly-input-date-h>nav.sc-smoothly-input-date>.arrow.sc-smoothly-input-date{position:absolute;z-index:9;transform:translate(2em, -.55em) rotate(45deg);width:1em;height:1em;background-color:rgb(var(--smoothly-default-shade))}";
|
|
5
|
+
const styleCss = ".sc-smoothly-input-date-h{position:relative}nav.sc-smoothly-input-date{position:absolute;z-index:10;top:3.5em;background-color:rgb(var(--smoothly-default-shade));max-width:22em}.sc-smoothly-input-date-h>div.sc-smoothly-input-date{position:fixed;top:0px;left:0px;right:0px;bottom:0px;width:100vw;height:100vh;z-index:2}.sc-smoothly-input-date-h>nav.sc-smoothly-input-date>.arrow.sc-smoothly-input-date{position:absolute;z-index:9;transform:translate(2em, -.55em) rotate(45deg);width:1em;height:1em;background-color:rgb(var(--smoothly-default-shade))}";
|
|
6
6
|
|
|
7
7
|
let InputDate = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, i as createEvent, h } from './index-02a70ac1.js';
|
|
2
2
|
import { d as dist } from './index-a28d88cf.js';
|
|
3
|
-
import { y as years, a as months } from './generate-
|
|
3
|
+
import { y as years, a as months } from './generate-776b3b0f.js';
|
|
4
4
|
import './_commonjsHelpers-8fe71198.js';
|
|
5
5
|
|
|
6
6
|
const styleCss = ".sc-smoothly-input-month-h{display:flex;justify-content:space-between;font-size:large}smoothly-icon.sc-smoothly-input-month{font-size:smaller}";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Components, JSX } from "./components";
|
|
2
2
|
export { App } from "./components/App";
|
|
3
3
|
export { Autocomplete, ClientIdentifier, Color, Expand, Fill, Message, Notice, Trigger, OptionType } from "./model";
|
|
4
|
-
export {
|
|
4
|
+
export { Cosmetic } from "./utilities";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Hex } from "./Hex";
|
|
2
|
+
import { Hsl } from "./Hsl";
|
|
3
|
+
import { Rgb } from "./Rgb";
|
|
4
|
+
export declare type CommaRgb = string;
|
|
5
|
+
export declare namespace CommaRgb {
|
|
6
|
+
function is(value: any | CommaRgb): value is CommaRgb;
|
|
7
|
+
function from(color: any): CommaRgb | undefined;
|
|
8
|
+
function fromHex(hex: Hex): CommaRgb;
|
|
9
|
+
function fromRgb(rgb: Rgb): CommaRgb;
|
|
10
|
+
function fromHsl(hsl: Hsl): CommaRgb;
|
|
11
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export declare const Names: {
|
|
2
|
+
readonly aliceblue: "#f0f8ff";
|
|
3
|
+
readonly antiquewhite: "#faebd7";
|
|
4
|
+
readonly aqua: "#00ffff";
|
|
5
|
+
readonly aquamarine: "#7fffd4";
|
|
6
|
+
readonly azure: "#f0ffff";
|
|
7
|
+
readonly beige: "#f5f5dc";
|
|
8
|
+
readonly bisque: "#ffe4c4";
|
|
9
|
+
readonly black: "#000000";
|
|
10
|
+
readonly blanchedalmond: "#ffebcd";
|
|
11
|
+
readonly blue: "#0000ff";
|
|
12
|
+
readonly blueviolet: "#8a2be2";
|
|
13
|
+
readonly brown: "#a52a2a";
|
|
14
|
+
readonly burlywood: "#deb887";
|
|
15
|
+
readonly cadetblue: "#5f9ea0";
|
|
16
|
+
readonly chartreuse: "#7fff00";
|
|
17
|
+
readonly chocolate: "#d2691e";
|
|
18
|
+
readonly coral: "#ff7f50";
|
|
19
|
+
readonly cornflowerblue: "#6495ed";
|
|
20
|
+
readonly cornsilk: "#fff8dc";
|
|
21
|
+
readonly crimson: "#dc143c";
|
|
22
|
+
readonly cyan: "#00ffff";
|
|
23
|
+
readonly darkblue: "#00008b";
|
|
24
|
+
readonly darkcyan: "#008b8b";
|
|
25
|
+
readonly darkgoldenrod: "#b8860b";
|
|
26
|
+
readonly darkgray: "#a9a9a9";
|
|
27
|
+
readonly darkgreen: "#006400";
|
|
28
|
+
readonly darkgrey: "#a9a9a9";
|
|
29
|
+
readonly darkkhaki: "#bdb76b";
|
|
30
|
+
readonly darkmagenta: "#8b008b";
|
|
31
|
+
readonly darkolivegreen: "#556b2f";
|
|
32
|
+
readonly darkorange: "#ff8c00";
|
|
33
|
+
readonly darkorchid: "#9932cc";
|
|
34
|
+
readonly darkred: "#8b0000";
|
|
35
|
+
readonly darksalmon: "#e9967a";
|
|
36
|
+
readonly darkseagreen: "#8fbc8f";
|
|
37
|
+
readonly darkslateblue: "#483d8b";
|
|
38
|
+
readonly darkslategray: "#2f4f4f";
|
|
39
|
+
readonly darkslategrey: "#2f4f4f";
|
|
40
|
+
readonly darkturquoise: "#00ced1";
|
|
41
|
+
readonly darkviolet: "#9400d3";
|
|
42
|
+
readonly deeppink: "#ff1493";
|
|
43
|
+
readonly deepskyblue: "#00bfff";
|
|
44
|
+
readonly dimgray: "#696969";
|
|
45
|
+
readonly dimgrey: "#696969";
|
|
46
|
+
readonly dodgerblue: "#1e90ff";
|
|
47
|
+
readonly firebrick: "#b22222";
|
|
48
|
+
readonly floralwhite: "#fffaf0";
|
|
49
|
+
readonly forestgreen: "#228b22";
|
|
50
|
+
readonly fuchsia: "#ff00ff";
|
|
51
|
+
readonly gainsboro: "#dcdcdc";
|
|
52
|
+
readonly ghostwhite: "#f8f8ff";
|
|
53
|
+
readonly goldenrod: "#daa520";
|
|
54
|
+
readonly gold: "#ffd700";
|
|
55
|
+
readonly gray: "#808080";
|
|
56
|
+
readonly green: "#008000";
|
|
57
|
+
readonly greenyellow: "#adff2f";
|
|
58
|
+
readonly grey: "#808080";
|
|
59
|
+
readonly honeydew: "#f0fff0";
|
|
60
|
+
readonly hotpink: "#ff69b4";
|
|
61
|
+
readonly indianred: "#cd5c5c";
|
|
62
|
+
readonly indigo: "#4b0082";
|
|
63
|
+
readonly ivory: "#fffff0";
|
|
64
|
+
readonly khaki: "#f0e68c";
|
|
65
|
+
readonly lavenderblush: "#fff0f5";
|
|
66
|
+
readonly lavender: "#e6e6fa";
|
|
67
|
+
readonly lawngreen: "#7cfc00";
|
|
68
|
+
readonly lemonchiffon: "#fffacd";
|
|
69
|
+
readonly lightblue: "#add8e6";
|
|
70
|
+
readonly lightcoral: "#f08080";
|
|
71
|
+
readonly lightcyan: "#e0ffff";
|
|
72
|
+
readonly lightgoldenrodyellow: "#fafad2";
|
|
73
|
+
readonly lightgray: "#d3d3d3";
|
|
74
|
+
readonly lightgreen: "#90ee90";
|
|
75
|
+
readonly lightgrey: "#d3d3d3";
|
|
76
|
+
readonly lightpink: "#ffb6c1";
|
|
77
|
+
readonly lightsalmon: "#ffa07a";
|
|
78
|
+
readonly lightseagreen: "#20b2aa";
|
|
79
|
+
readonly lightskyblue: "#87cefa";
|
|
80
|
+
readonly lightslategray: "#778899";
|
|
81
|
+
readonly lightslategrey: "#778899";
|
|
82
|
+
readonly lightsteelblue: "#b0c4de";
|
|
83
|
+
readonly lightyellow: "#ffffe0";
|
|
84
|
+
readonly lime: "#00ff00";
|
|
85
|
+
readonly limegreen: "#32cd32";
|
|
86
|
+
readonly linen: "#faf0e6";
|
|
87
|
+
readonly magenta: "#ff00ff";
|
|
88
|
+
readonly maroon: "#800000";
|
|
89
|
+
readonly mediumaquamarine: "#66cdaa";
|
|
90
|
+
readonly mediumblue: "#0000cd";
|
|
91
|
+
readonly mediumorchid: "#ba55d3";
|
|
92
|
+
readonly mediumpurple: "#9370db";
|
|
93
|
+
readonly mediumseagreen: "#3cb371";
|
|
94
|
+
readonly mediumslateblue: "#7b68ee";
|
|
95
|
+
readonly mediumspringgreen: "#00fa9a";
|
|
96
|
+
readonly mediumturquoise: "#48d1cc";
|
|
97
|
+
readonly mediumvioletred: "#c71585";
|
|
98
|
+
readonly midnightblue: "#191970";
|
|
99
|
+
readonly mintcream: "#f5fffa";
|
|
100
|
+
readonly mistyrose: "#ffe4e1";
|
|
101
|
+
readonly moccasin: "#ffe4b5";
|
|
102
|
+
readonly navajowhite: "#ffdead";
|
|
103
|
+
readonly navy: "#000080";
|
|
104
|
+
readonly oldlace: "#fdf5e6";
|
|
105
|
+
readonly olive: "#808000";
|
|
106
|
+
readonly olivedrab: "#6b8e23";
|
|
107
|
+
readonly orange: "#ffa500";
|
|
108
|
+
readonly orangered: "#ff4500";
|
|
109
|
+
readonly orchid: "#da70d6";
|
|
110
|
+
readonly palegoldenrod: "#eee8aa";
|
|
111
|
+
readonly palegreen: "#98fb98";
|
|
112
|
+
readonly paleturquoise: "#afeeee";
|
|
113
|
+
readonly palevioletred: "#db7093";
|
|
114
|
+
readonly papayawhip: "#ffefd5";
|
|
115
|
+
readonly peachpuff: "#ffdab9";
|
|
116
|
+
readonly peru: "#cd853f";
|
|
117
|
+
readonly pink: "#ffc0cb";
|
|
118
|
+
readonly plum: "#dda0dd";
|
|
119
|
+
readonly powderblue: "#b0e0e6";
|
|
120
|
+
readonly purple: "#800080";
|
|
121
|
+
readonly rebeccapurple: "#663399";
|
|
122
|
+
readonly red: "#ff0000";
|
|
123
|
+
readonly rosybrown: "#bc8f8f";
|
|
124
|
+
readonly royalblue: "#4169e1";
|
|
125
|
+
readonly saddlebrown: "#8b4513";
|
|
126
|
+
readonly salmon: "#fa8072";
|
|
127
|
+
readonly sandybrown: "#f4a460";
|
|
128
|
+
readonly seagreen: "#2e8b57";
|
|
129
|
+
readonly seashell: "#fff5ee";
|
|
130
|
+
readonly sienna: "#a0522d";
|
|
131
|
+
readonly silver: "#c0c0c0";
|
|
132
|
+
readonly skyblue: "#87ceeb";
|
|
133
|
+
readonly slateblue: "#6a5acd";
|
|
134
|
+
readonly slategray: "#708090";
|
|
135
|
+
readonly slategrey: "#708090";
|
|
136
|
+
readonly snow: "#fffafa";
|
|
137
|
+
readonly springgreen: "#00ff7f";
|
|
138
|
+
readonly steelblue: "#4682b4";
|
|
139
|
+
readonly tan: "#d2b48c";
|
|
140
|
+
readonly teal: "#008080";
|
|
141
|
+
readonly thistle: "#d8bfd8";
|
|
142
|
+
readonly tomato: "#ff6347";
|
|
143
|
+
readonly turquoise: "#40e0d0";
|
|
144
|
+
readonly violet: "#ee82ee";
|
|
145
|
+
readonly wheat: "#f5deb3";
|
|
146
|
+
readonly white: "#ffffff";
|
|
147
|
+
readonly whitesmoke: "#f5f5f5";
|
|
148
|
+
readonly yellow: "#ffff00";
|
|
149
|
+
readonly yellowgreen: "#9acd32";
|
|
150
|
+
};
|
|
151
|
+
export declare type Name = keyof typeof Names;
|
|
152
|
+
export declare namespace Name {
|
|
153
|
+
const types: () => string[];
|
|
154
|
+
function is(value: any | Name): value is Name;
|
|
155
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { CommaRgb as ColorCommaRgb } from "./CommaRgb";
|
|
2
|
+
import { Hex as ColorHex } from "./Hex";
|
|
3
|
+
import { Hsl as ColorHsl } from "./Hsl";
|
|
4
|
+
import { Name as ColorName } from "./Name";
|
|
5
|
+
import { Rgb as ColorRgb } from "./Rgb";
|
|
6
|
+
export declare type Color = ColorCommaRgb | ColorHex | ColorHsl | ColorName | ColorRgb;
|
|
7
|
+
export declare namespace Color {
|
|
8
|
+
function is(value: any | Color): value is Color;
|
|
9
|
+
function from(value: any | Color): Color | undefined;
|
|
10
|
+
const Names: {
|
|
11
|
+
readonly aliceblue: "#f0f8ff";
|
|
12
|
+
readonly antiquewhite: "#faebd7";
|
|
13
|
+
readonly aqua: "#00ffff";
|
|
14
|
+
readonly aquamarine: "#7fffd4";
|
|
15
|
+
readonly azure: "#f0ffff";
|
|
16
|
+
readonly beige: "#f5f5dc";
|
|
17
|
+
readonly bisque: "#ffe4c4";
|
|
18
|
+
readonly black: "#000000";
|
|
19
|
+
readonly blanchedalmond: "#ffebcd";
|
|
20
|
+
readonly blue: "#0000ff";
|
|
21
|
+
readonly blueviolet: "#8a2be2";
|
|
22
|
+
readonly brown: "#a52a2a";
|
|
23
|
+
readonly burlywood: "#deb887";
|
|
24
|
+
readonly cadetblue: "#5f9ea0";
|
|
25
|
+
readonly chartreuse: "#7fff00";
|
|
26
|
+
readonly chocolate: "#d2691e";
|
|
27
|
+
readonly coral: "#ff7f50";
|
|
28
|
+
readonly cornflowerblue: "#6495ed";
|
|
29
|
+
readonly cornsilk: "#fff8dc";
|
|
30
|
+
readonly crimson: "#dc143c";
|
|
31
|
+
readonly cyan: "#00ffff";
|
|
32
|
+
readonly darkblue: "#00008b";
|
|
33
|
+
readonly darkcyan: "#008b8b";
|
|
34
|
+
readonly darkgoldenrod: "#b8860b";
|
|
35
|
+
readonly darkgray: "#a9a9a9";
|
|
36
|
+
readonly darkgreen: "#006400";
|
|
37
|
+
readonly darkgrey: "#a9a9a9";
|
|
38
|
+
readonly darkkhaki: "#bdb76b";
|
|
39
|
+
readonly darkmagenta: "#8b008b";
|
|
40
|
+
readonly darkolivegreen: "#556b2f";
|
|
41
|
+
readonly darkorange: "#ff8c00";
|
|
42
|
+
readonly darkorchid: "#9932cc";
|
|
43
|
+
readonly darkred: "#8b0000";
|
|
44
|
+
readonly darksalmon: "#e9967a";
|
|
45
|
+
readonly darkseagreen: "#8fbc8f";
|
|
46
|
+
readonly darkslateblue: "#483d8b";
|
|
47
|
+
readonly darkslategray: "#2f4f4f";
|
|
48
|
+
readonly darkslategrey: "#2f4f4f";
|
|
49
|
+
readonly darkturquoise: "#00ced1";
|
|
50
|
+
readonly darkviolet: "#9400d3";
|
|
51
|
+
readonly deeppink: "#ff1493";
|
|
52
|
+
readonly deepskyblue: "#00bfff";
|
|
53
|
+
readonly dimgray: "#696969";
|
|
54
|
+
readonly dimgrey: "#696969";
|
|
55
|
+
readonly dodgerblue: "#1e90ff";
|
|
56
|
+
readonly firebrick: "#b22222";
|
|
57
|
+
readonly floralwhite: "#fffaf0";
|
|
58
|
+
readonly forestgreen: "#228b22";
|
|
59
|
+
readonly fuchsia: "#ff00ff";
|
|
60
|
+
readonly gainsboro: "#dcdcdc";
|
|
61
|
+
readonly ghostwhite: "#f8f8ff";
|
|
62
|
+
readonly goldenrod: "#daa520";
|
|
63
|
+
readonly gold: "#ffd700";
|
|
64
|
+
readonly gray: "#808080";
|
|
65
|
+
readonly green: "#008000";
|
|
66
|
+
readonly greenyellow: "#adff2f";
|
|
67
|
+
readonly grey: "#808080";
|
|
68
|
+
readonly honeydew: "#f0fff0";
|
|
69
|
+
readonly hotpink: "#ff69b4";
|
|
70
|
+
readonly indianred: "#cd5c5c";
|
|
71
|
+
readonly indigo: "#4b0082";
|
|
72
|
+
readonly ivory: "#fffff0";
|
|
73
|
+
readonly khaki: "#f0e68c";
|
|
74
|
+
readonly lavenderblush: "#fff0f5";
|
|
75
|
+
readonly lavender: "#e6e6fa";
|
|
76
|
+
readonly lawngreen: "#7cfc00";
|
|
77
|
+
readonly lemonchiffon: "#fffacd";
|
|
78
|
+
readonly lightblue: "#add8e6";
|
|
79
|
+
readonly lightcoral: "#f08080";
|
|
80
|
+
readonly lightcyan: "#e0ffff";
|
|
81
|
+
readonly lightgoldenrodyellow: "#fafad2";
|
|
82
|
+
readonly lightgray: "#d3d3d3";
|
|
83
|
+
readonly lightgreen: "#90ee90";
|
|
84
|
+
readonly lightgrey: "#d3d3d3";
|
|
85
|
+
readonly lightpink: "#ffb6c1";
|
|
86
|
+
readonly lightsalmon: "#ffa07a";
|
|
87
|
+
readonly lightseagreen: "#20b2aa";
|
|
88
|
+
readonly lightskyblue: "#87cefa";
|
|
89
|
+
readonly lightslategray: "#778899";
|
|
90
|
+
readonly lightslategrey: "#778899";
|
|
91
|
+
readonly lightsteelblue: "#b0c4de";
|
|
92
|
+
readonly lightyellow: "#ffffe0";
|
|
93
|
+
readonly lime: "#00ff00";
|
|
94
|
+
readonly limegreen: "#32cd32";
|
|
95
|
+
readonly linen: "#faf0e6";
|
|
96
|
+
readonly magenta: "#ff00ff";
|
|
97
|
+
readonly maroon: "#800000";
|
|
98
|
+
readonly mediumaquamarine: "#66cdaa";
|
|
99
|
+
readonly mediumblue: "#0000cd";
|
|
100
|
+
readonly mediumorchid: "#ba55d3";
|
|
101
|
+
readonly mediumpurple: "#9370db";
|
|
102
|
+
readonly mediumseagreen: "#3cb371";
|
|
103
|
+
readonly mediumslateblue: "#7b68ee";
|
|
104
|
+
readonly mediumspringgreen: "#00fa9a";
|
|
105
|
+
readonly mediumturquoise: "#48d1cc";
|
|
106
|
+
readonly mediumvioletred: "#c71585";
|
|
107
|
+
readonly midnightblue: "#191970";
|
|
108
|
+
readonly mintcream: "#f5fffa";
|
|
109
|
+
readonly mistyrose: "#ffe4e1";
|
|
110
|
+
readonly moccasin: "#ffe4b5";
|
|
111
|
+
readonly navajowhite: "#ffdead";
|
|
112
|
+
readonly navy: "#000080";
|
|
113
|
+
readonly oldlace: "#fdf5e6";
|
|
114
|
+
readonly olive: "#808000";
|
|
115
|
+
readonly olivedrab: "#6b8e23";
|
|
116
|
+
readonly orange: "#ffa500";
|
|
117
|
+
readonly orangered: "#ff4500";
|
|
118
|
+
readonly orchid: "#da70d6";
|
|
119
|
+
readonly palegoldenrod: "#eee8aa";
|
|
120
|
+
readonly palegreen: "#98fb98";
|
|
121
|
+
readonly paleturquoise: "#afeeee";
|
|
122
|
+
readonly palevioletred: "#db7093";
|
|
123
|
+
readonly papayawhip: "#ffefd5";
|
|
124
|
+
readonly peachpuff: "#ffdab9";
|
|
125
|
+
readonly peru: "#cd853f";
|
|
126
|
+
readonly pink: "#ffc0cb";
|
|
127
|
+
readonly plum: "#dda0dd";
|
|
128
|
+
readonly powderblue: "#b0e0e6";
|
|
129
|
+
readonly purple: "#800080";
|
|
130
|
+
readonly rebeccapurple: "#663399";
|
|
131
|
+
readonly red: "#ff0000";
|
|
132
|
+
readonly rosybrown: "#bc8f8f";
|
|
133
|
+
readonly royalblue: "#4169e1";
|
|
134
|
+
readonly saddlebrown: "#8b4513";
|
|
135
|
+
readonly salmon: "#fa8072";
|
|
136
|
+
readonly sandybrown: "#f4a460";
|
|
137
|
+
readonly seagreen: "#2e8b57";
|
|
138
|
+
readonly seashell: "#fff5ee";
|
|
139
|
+
readonly sienna: "#a0522d";
|
|
140
|
+
readonly silver: "#c0c0c0";
|
|
141
|
+
readonly skyblue: "#87ceeb";
|
|
142
|
+
readonly slateblue: "#6a5acd";
|
|
143
|
+
readonly slategray: "#708090";
|
|
144
|
+
readonly slategrey: "#708090";
|
|
145
|
+
readonly snow: "#fffafa";
|
|
146
|
+
readonly springgreen: "#00ff7f";
|
|
147
|
+
readonly steelblue: "#4682b4";
|
|
148
|
+
readonly tan: "#d2b48c";
|
|
149
|
+
readonly teal: "#008080";
|
|
150
|
+
readonly thistle: "#d8bfd8";
|
|
151
|
+
readonly tomato: "#ff6347";
|
|
152
|
+
readonly turquoise: "#40e0d0";
|
|
153
|
+
readonly violet: "#ee82ee";
|
|
154
|
+
readonly wheat: "#f5deb3";
|
|
155
|
+
readonly white: "#ffffff";
|
|
156
|
+
readonly whitesmoke: "#f5f5f5";
|
|
157
|
+
readonly yellow: "#ffff00";
|
|
158
|
+
readonly yellowgreen: "#9acd32";
|
|
159
|
+
};
|
|
160
|
+
type Name = ColorName;
|
|
161
|
+
const Name: typeof ColorName;
|
|
162
|
+
type CommaRgb = ColorCommaRgb;
|
|
163
|
+
const CommaRgb: typeof ColorCommaRgb;
|
|
164
|
+
type Rgb = ColorRgb;
|
|
165
|
+
const Rgb: typeof ColorRgb;
|
|
166
|
+
type Hex = ColorHex;
|
|
167
|
+
const Hex: typeof ColorHex;
|
|
168
|
+
type Hsl = ColorHsl;
|
|
169
|
+
const Hsl: typeof ColorHsl;
|
|
170
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Color as CosmeticColor } from "./Color";
|
|
2
|
+
export declare type Cosmetic = {
|
|
3
|
+
text?: {
|
|
4
|
+
background?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
};
|
|
7
|
+
border?: {
|
|
8
|
+
color?: string;
|
|
9
|
+
style?: string;
|
|
10
|
+
radius?: string;
|
|
11
|
+
width?: string;
|
|
12
|
+
};
|
|
13
|
+
gap?: string;
|
|
14
|
+
dangerColor?: string;
|
|
15
|
+
fontFamily?: string;
|
|
16
|
+
background?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare namespace Cosmetic {
|
|
19
|
+
const types: typeof Cosmetic;
|
|
20
|
+
function from(value: any | Cosmetic): Cosmetic;
|
|
21
|
+
type Color = CosmeticColor;
|
|
22
|
+
const Color: typeof CosmeticColor;
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Cosmetic } from "./Cosmetic";
|
package/package.json
CHANGED
|
@@ -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
|
-
}
|