smoothly 0.1.84 → 0.1.85
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/index.cjs.js +214 -116
- 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 +221 -122
- package/dist/esm/index.js +215 -116
- package/dist/smoothly/index.esm.js +215 -116
- 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/types/utilities/colorNames.d.ts +0 -3
- package/dist/types/utilities/colorTransform.d.ts +0 -8
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,52 @@ export { A as App } from './App-c5f6000f.js';
|
|
|
2
2
|
export { C as ClientIdentifier, M as Message, N as Notice, T as Trigger } from './index-68492ed9.js';
|
|
3
3
|
import './index-02a70ac1.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var Hex;
|
|
6
|
+
(function (Hex) {
|
|
7
|
+
function is(value) {
|
|
8
|
+
const matchArray = (typeof value == "string" && value.match(/[0-9a-fA-F]/g)) || undefined;
|
|
9
|
+
return (typeof value == "string" &&
|
|
10
|
+
value.length > 3 &&
|
|
11
|
+
value[0] == "#" &&
|
|
12
|
+
((matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 3 || (matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 6));
|
|
13
|
+
}
|
|
14
|
+
Hex.is = is;
|
|
15
|
+
})(Hex || (Hex = {}));
|
|
16
|
+
|
|
17
|
+
var Hsl;
|
|
18
|
+
(function (Hsl) {
|
|
19
|
+
function is(value) {
|
|
20
|
+
const values = typeof value == "string" && value.length > 11 ? value.substring(4, value.length - 1).split(",") : [];
|
|
21
|
+
return (typeof value == "string" &&
|
|
22
|
+
value.length > 11 &&
|
|
23
|
+
value.substr(0, 4) == "hsl(" &&
|
|
24
|
+
value.substr(value.length - 1, 1) == ")" &&
|
|
25
|
+
values.length == 3 &&
|
|
26
|
+
values.every((single, index) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
let result = false;
|
|
29
|
+
if (index == 0)
|
|
30
|
+
result =
|
|
31
|
+
!Number.isNaN(single) &&
|
|
32
|
+
((_a = single.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == single.length &&
|
|
33
|
+
Number(single) >= 0 &&
|
|
34
|
+
Number(single) <= 360;
|
|
35
|
+
else {
|
|
36
|
+
const number = single.substr(0, single.length - 1);
|
|
37
|
+
result =
|
|
38
|
+
single[single.length - 1] == "%" &&
|
|
39
|
+
!Number.isNaN(number) &&
|
|
40
|
+
((_b = number.match(/[0-9]/g)) === null || _b === void 0 ? void 0 : _b.length) == number.length &&
|
|
41
|
+
Number(number) >= 0 &&
|
|
42
|
+
Number(number) <= 100;
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
Hsl.is = is;
|
|
48
|
+
})(Hsl || (Hsl = {}));
|
|
49
|
+
|
|
50
|
+
const Names = {
|
|
6
51
|
aliceblue: "#f0f8ff",
|
|
7
52
|
antiquewhite: "#faebd7",
|
|
8
53
|
aqua: "#00ffff",
|
|
@@ -152,125 +197,179 @@ const colorNames = {
|
|
|
152
197
|
yellow: "#ffff00",
|
|
153
198
|
yellowgreen: "#9acd32",
|
|
154
199
|
};
|
|
200
|
+
var Name;
|
|
201
|
+
(function (Name) {
|
|
202
|
+
Name.types = () => Object.keys(Names);
|
|
203
|
+
function is(value) {
|
|
204
|
+
return typeof value == "string" && Name.types().includes(value.toLowerCase());
|
|
205
|
+
}
|
|
206
|
+
Name.is = is;
|
|
207
|
+
})(Name || (Name = {}));
|
|
155
208
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
result
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
209
|
+
var Rgb;
|
|
210
|
+
(function (Rgb) {
|
|
211
|
+
function is(value) {
|
|
212
|
+
const values = typeof value == "string" && value.length > 9 ? value.substring(4, value.length - 1).split(",") : [];
|
|
213
|
+
return (typeof value == "string" &&
|
|
214
|
+
value.length > 9 &&
|
|
215
|
+
value.substr(0, 4) == "rgb(" &&
|
|
216
|
+
value.substr(value.length - 1, 1) == ")" &&
|
|
217
|
+
values.length == 3 &&
|
|
218
|
+
values.every((value) => {
|
|
219
|
+
var _a;
|
|
220
|
+
return !Number.isNaN(value) &&
|
|
221
|
+
((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
|
|
222
|
+
Number(value) >= 0 &&
|
|
223
|
+
Number(value) <= 255;
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
Rgb.is = is;
|
|
227
|
+
})(Rgb || (Rgb = {}));
|
|
228
|
+
|
|
229
|
+
var CommaRgb;
|
|
230
|
+
(function (CommaRgb) {
|
|
231
|
+
function is(value) {
|
|
232
|
+
const values = typeof value == "string" ? value.split(",") : [];
|
|
233
|
+
return (values.length == 3 &&
|
|
234
|
+
values.every((value) => {
|
|
235
|
+
var _a;
|
|
236
|
+
return !Number.isNaN(value) &&
|
|
237
|
+
((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
|
|
238
|
+
Number(value) >= 0 &&
|
|
239
|
+
Number(value) <= 255;
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
CommaRgb.is = is;
|
|
243
|
+
function from(color) {
|
|
244
|
+
let result;
|
|
245
|
+
const colorWithoutSpace = typeof color == "string" ? color.replace(/ /g, "").toLowerCase() : undefined;
|
|
246
|
+
if (!colorWithoutSpace)
|
|
247
|
+
result = undefined;
|
|
248
|
+
else if (CommaRgb.is(colorWithoutSpace))
|
|
249
|
+
result = colorWithoutSpace;
|
|
250
|
+
else if (Hex.is(colorWithoutSpace))
|
|
251
|
+
result = fromHex(colorWithoutSpace);
|
|
252
|
+
else if (Rgb.is(colorWithoutSpace))
|
|
253
|
+
result = fromRgb(colorWithoutSpace);
|
|
254
|
+
else if (Name.is(colorWithoutSpace))
|
|
255
|
+
result = fromHex(Names[colorWithoutSpace]);
|
|
256
|
+
else if (Hsl.is(colorWithoutSpace))
|
|
257
|
+
result = fromHsl(colorWithoutSpace);
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
CommaRgb.from = from;
|
|
261
|
+
function fromHex(hex) {
|
|
262
|
+
let result = "0,0,0";
|
|
263
|
+
if (hex.length == 7)
|
|
264
|
+
result = `${parseInt(hex.substr(1, 2), 16)},${parseInt(hex.substr(3, 2), 16)},${parseInt(hex.substr(5, 2), 16)}`;
|
|
265
|
+
else if (hex.length == 4)
|
|
266
|
+
result = fromHex(`#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`);
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
CommaRgb.fromHex = fromHex;
|
|
270
|
+
function fromRgb(rgb) {
|
|
271
|
+
return rgb.substring(4, rgb.length - 1);
|
|
272
|
+
}
|
|
273
|
+
CommaRgb.fromRgb = fromRgb;
|
|
274
|
+
function fromHsl(hsl) {
|
|
275
|
+
let result = "";
|
|
276
|
+
let h, s, l;
|
|
277
|
+
let r, g, b;
|
|
278
|
+
const HSL = hsl
|
|
279
|
+
.substring(4, hsl.length - 1)
|
|
280
|
+
.split(",")
|
|
281
|
+
.map((value, index) => Number(index == 0 ? value : value.substr(0, value.length - 1)));
|
|
282
|
+
if (HSL.length == 3) {
|
|
283
|
+
h = HSL[0] / 360;
|
|
284
|
+
s = HSL[1] / 100;
|
|
285
|
+
l = HSL[2] / 100;
|
|
286
|
+
if (s == 0)
|
|
287
|
+
r = g = b = l;
|
|
224
288
|
else {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
Number(number) >= 0 &&
|
|
231
|
-
Number(number) <= 100;
|
|
289
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
290
|
+
const p = 2 * l - q;
|
|
291
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
292
|
+
g = hue2rgb(p, q, h);
|
|
293
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
232
294
|
}
|
|
233
|
-
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
function hue2rgb(p, q, t) {
|
|
237
|
-
let result = p;
|
|
238
|
-
if (t < 0)
|
|
239
|
-
t += 1;
|
|
240
|
-
if (t > 1)
|
|
241
|
-
t -= 1;
|
|
242
|
-
if (t < 1 / 6)
|
|
243
|
-
result = p + (q - p) * 6 * t;
|
|
244
|
-
else if (t < 1 / 2)
|
|
245
|
-
result = q;
|
|
246
|
-
else if (t < 2 / 3)
|
|
247
|
-
result = p + (q - p) * (2 / 3 - t) * 6;
|
|
248
|
-
return result;
|
|
249
|
-
}
|
|
250
|
-
function hslToCommaRgb(hsl) {
|
|
251
|
-
let result;
|
|
252
|
-
let h, s, l;
|
|
253
|
-
let r, g, b;
|
|
254
|
-
const HSL = hsl
|
|
255
|
-
.substring(4, hsl.length - 1)
|
|
256
|
-
.split(",")
|
|
257
|
-
.map((value, index) => Number(index == 0 ? value : value.substr(0, value.length - 1)));
|
|
258
|
-
if (HSL.length == 3) {
|
|
259
|
-
h = HSL[0] / 360;
|
|
260
|
-
s = HSL[1] / 100;
|
|
261
|
-
l = HSL[2] / 100;
|
|
262
|
-
if (s == 0)
|
|
263
|
-
r = g = b = l;
|
|
264
|
-
else {
|
|
265
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
266
|
-
const p = 2 * l - q;
|
|
267
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
268
|
-
g = hue2rgb(p, q, h);
|
|
269
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
295
|
+
result = `${Math.round(255 * r)},${Math.round(255 * g)},${Math.round(255 * b)}`;
|
|
270
296
|
}
|
|
271
|
-
result
|
|
297
|
+
return result;
|
|
298
|
+
}
|
|
299
|
+
CommaRgb.fromHsl = fromHsl;
|
|
300
|
+
function hue2rgb(p, q, t) {
|
|
301
|
+
let result = p;
|
|
302
|
+
if (t < 0)
|
|
303
|
+
t += 1;
|
|
304
|
+
if (t > 1)
|
|
305
|
+
t -= 1;
|
|
306
|
+
if (t < 1 / 6)
|
|
307
|
+
result = p + (q - p) * 6 * t;
|
|
308
|
+
else if (t < 1 / 2)
|
|
309
|
+
result = q;
|
|
310
|
+
else if (t < 2 / 3)
|
|
311
|
+
result = p + (q - p) * (2 / 3 - t) * 6;
|
|
312
|
+
return result;
|
|
272
313
|
}
|
|
273
|
-
|
|
314
|
+
})(CommaRgb || (CommaRgb = {}));
|
|
315
|
+
|
|
316
|
+
var Color;
|
|
317
|
+
(function (Color) {
|
|
318
|
+
function is(value) {
|
|
319
|
+
return (typeof value == "string" &&
|
|
320
|
+
(CommaRgb.is(value) || Hex.is(value) || Hsl.is(value) || Name.is(value) || Rgb.is(value)));
|
|
321
|
+
}
|
|
322
|
+
Color.is = is;
|
|
323
|
+
function from(value) {
|
|
324
|
+
return is(value) ? value : undefined;
|
|
325
|
+
}
|
|
326
|
+
Color.from = from;
|
|
327
|
+
Color.Names = Names;
|
|
328
|
+
Color.Name = Name;
|
|
329
|
+
Color.CommaRgb = CommaRgb;
|
|
330
|
+
Color.Rgb = Rgb;
|
|
331
|
+
Color.Hex = Hex;
|
|
332
|
+
Color.Hsl = Hsl;
|
|
333
|
+
})(Color || (Color = {}));
|
|
334
|
+
|
|
335
|
+
function reduce(types, value) {
|
|
336
|
+
return types.reduce((r, c) => typeof value == "object" && value != null && typeof value[c] == "string"
|
|
337
|
+
? Object.assign(Object.assign({}, r), { [c]: value[c] }) : r, {});
|
|
274
338
|
}
|
|
339
|
+
var Cosmetic;
|
|
340
|
+
(function (Cosmetic) {
|
|
341
|
+
Cosmetic.types = Cosmetic;
|
|
342
|
+
function from(value) {
|
|
343
|
+
let result = {};
|
|
344
|
+
if (typeof value == "object" && value) {
|
|
345
|
+
result = {
|
|
346
|
+
text: reduce(["background", "color"], value.text),
|
|
347
|
+
border: reduce(["background", "color", "style", "radius", "width"], value.border),
|
|
348
|
+
gap: typeof value.gap == "string" ? value.gap : undefined,
|
|
349
|
+
dangerColor: typeof value.dangerColor == "string"
|
|
350
|
+
? value.dangerColor
|
|
351
|
+
: typeof value.danger_color == "string"
|
|
352
|
+
? value.danger_color
|
|
353
|
+
: undefined,
|
|
354
|
+
fontFamily: typeof value.fontFamily == "string"
|
|
355
|
+
? value.fontFamily
|
|
356
|
+
: typeof value.font_family == "string"
|
|
357
|
+
? value.font_family
|
|
358
|
+
: undefined,
|
|
359
|
+
background: typeof value.background == "string" ? value.background : undefined,
|
|
360
|
+
};
|
|
361
|
+
Object.keys(result).forEach((key) => {
|
|
362
|
+
var _a;
|
|
363
|
+
if (result[key] == undefined ||
|
|
364
|
+
(typeof result[key] == "object" && result[key] && Object.keys((_a = result[key]) !== null && _a !== void 0 ? _a : {}).length == 0)) {
|
|
365
|
+
delete result[key];
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
return result;
|
|
370
|
+
}
|
|
371
|
+
Cosmetic.from = from;
|
|
372
|
+
Cosmetic.Color = Color;
|
|
373
|
+
})(Cosmetic || (Cosmetic = {}));
|
|
275
374
|
|
|
276
|
-
export {
|
|
375
|
+
export { Cosmetic };
|