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.
Files changed (51) hide show
  1. package/dist/cjs/{generate-14aca5d2.js → generate-a6821b82.js} +2 -2
  2. package/dist/cjs/index.cjs.js +214 -116
  3. package/dist/cjs/smoothly-accordion_47.cjs.entry.js +9 -17
  4. package/dist/cjs/smoothly-calendar.cjs.entry.js +6 -14
  5. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +1 -1
  6. package/dist/cjs/smoothly-input-date.cjs.entry.js +1 -1
  7. package/dist/cjs/smoothly-input-month.cjs.entry.js +1 -1
  8. package/dist/collection/components/calendar/generate.js +2 -2
  9. package/dist/collection/components/calendar/index.js +9 -17
  10. package/dist/collection/components/input-date/style.css +4 -0
  11. package/dist/collection/components/input-date-range/style.css +4 -0
  12. package/dist/collection/index.js +1 -1
  13. package/dist/collection/utilities/Cosmetic/Color/CommaRgb.js +90 -0
  14. package/dist/collection/utilities/Cosmetic/Color/Hex.js +11 -0
  15. package/dist/collection/utilities/Cosmetic/Color/Hsl.js +32 -0
  16. package/dist/collection/utilities/{colorNames.js → Cosmetic/Color/Name.js} +9 -1
  17. package/dist/collection/utilities/Cosmetic/Color/Rgb.js +19 -0
  18. package/dist/collection/utilities/Cosmetic/Color/index.js +23 -0
  19. package/dist/collection/utilities/Cosmetic/index.js +40 -0
  20. package/dist/collection/utilities/index.js +1 -1
  21. package/dist/custom-elements/index.js +230 -139
  22. package/dist/{smoothly/generate-be25a8d1.js → esm/generate-776b3b0f.js} +2 -2
  23. package/dist/esm/index.js +215 -116
  24. package/dist/esm/smoothly-accordion_47.entry.js +9 -17
  25. package/dist/esm/smoothly-calendar.entry.js +6 -14
  26. package/dist/esm/smoothly-input-date-range.entry.js +1 -1
  27. package/dist/esm/smoothly-input-date.entry.js +1 -1
  28. package/dist/esm/smoothly-input-month.entry.js +1 -1
  29. package/dist/{esm/generate-be25a8d1.js → smoothly/generate-776b3b0f.js} +2 -2
  30. package/dist/smoothly/index.esm.js +215 -116
  31. package/dist/smoothly/p-375a8d94.entry.js +1 -0
  32. package/dist/smoothly/smoothly-calendar.entry.js +6 -14
  33. package/dist/smoothly/smoothly-input-date-range.entry.js +1 -1
  34. package/dist/smoothly/smoothly-input-date.entry.js +1 -1
  35. package/dist/smoothly/smoothly-input-month.entry.js +1 -1
  36. package/dist/types/components/calendar/index.d.ts +2 -2
  37. package/dist/types/components.d.ts +2 -2
  38. package/dist/types/index.d.ts +1 -1
  39. package/dist/types/utilities/Cosmetic/Color/CommaRgb.d.ts +11 -0
  40. package/dist/types/utilities/Cosmetic/Color/Hex.d.ts +4 -0
  41. package/dist/types/utilities/Cosmetic/Color/Hsl.d.ts +4 -0
  42. package/dist/types/utilities/Cosmetic/Color/Name.d.ts +155 -0
  43. package/dist/types/utilities/Cosmetic/Color/Rgb.d.ts +4 -0
  44. package/dist/types/utilities/Cosmetic/Color/index.d.ts +170 -0
  45. package/dist/types/utilities/Cosmetic/index.d.ts +23 -0
  46. package/dist/types/utilities/index.d.ts +1 -1
  47. package/package.json +1 -1
  48. package/dist/collection/utilities/colorTransform.js +0 -120
  49. package/dist/smoothly/p-e3ae8b97.entry.js +0 -1
  50. package/dist/types/utilities/colorNames.d.ts +0 -3
  51. package/dist/types/utilities/colorTransform.d.ts +0 -8
@@ -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
- const colorNames = {
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
- function toCommaRgb(color) {
157
- let result;
158
- const colorWithoutSpace = color.replace(/ /g, "").toLowerCase();
159
- if (isCommaRgb(colorWithoutSpace))
160
- result = colorWithoutSpace;
161
- else if (isHex(colorWithoutSpace))
162
- result = hexToCommaRgb(colorWithoutSpace);
163
- else if (isRgb(colorWithoutSpace))
164
- result = rgbToCommaRgb(colorWithoutSpace);
165
- else if (colorWithoutSpace in colorNames)
166
- result = hexToCommaRgb(colorNames[colorWithoutSpace]);
167
- else if (isHsl(colorWithoutSpace))
168
- result = hslToCommaRgb(colorWithoutSpace);
169
- return result;
170
- }
171
- function isCommaRgb(commaRgb) {
172
- const values = commaRgb.split(",");
173
- return (values.length == 3 &&
174
- values.every(value => {
175
- var _a;
176
- return !Number.isNaN(value) &&
177
- ((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
178
- Number(value) >= 0 &&
179
- Number(value) <= 255;
180
- }));
181
- }
182
- function isHex(hex) {
183
- const matchArray = hex.match(/[0-9a-fA-F]/g);
184
- return hex[0] == "#" && ((matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 3 || (matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 6);
185
- }
186
- function hexToCommaRgb(hex) {
187
- let result = "0,0,0";
188
- if (hex.length == 7)
189
- result = `${parseInt(hex.substr(1, 2), 16)},${parseInt(hex.substr(3, 2), 16)},${parseInt(hex.substr(5, 2), 16)}`;
190
- else if (hex.length == 4)
191
- result = hexToCommaRgb(`#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`);
192
- return result;
193
- }
194
- function isRgb(rgb) {
195
- const values = rgb.substring(4, rgb.length - 1).split(",");
196
- return (rgb.substr(0, 4) == "rgb(" &&
197
- rgb.substr(rgb.length - 1, 1) == ")" &&
198
- values.length == 3 &&
199
- values.every(value => {
200
- var _a;
201
- return !Number.isNaN(value) &&
202
- ((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
203
- Number(value) >= 0 &&
204
- Number(value) <= 255;
205
- }));
206
- }
207
- function rgbToCommaRgb(rgb) {
208
- return rgb.substring(4, rgb.length - 1);
209
- }
210
- function isHsl(hsl) {
211
- const values = hsl.substring(4, hsl.length - 1).split(",");
212
- return (hsl.substr(0, 4) == "hsl(" &&
213
- hsl.substr(hsl.length - 1, 1) == ")" &&
214
- values.length == 3 &&
215
- values.every((value, index) => {
216
- var _a, _b;
217
- let result = false;
218
- if (index == 0)
219
- result =
220
- !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) <= 360;
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 number = value.substr(0, value.length - 1);
226
- result =
227
- value[value.length - 1] == "%" &&
228
- !Number.isNaN(number) &&
229
- ((_b = number.match(/[0-9]/g)) === null || _b === void 0 ? void 0 : _b.length) == number.length &&
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
- return result;
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 = `${Math.round(255 * r)},${Math.round(255 * g)},${Math.round(255 * b)}`;
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
- return result;
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 { toCommaRgb };
375
+ export { Cosmetic };