smoothly 0.1.81 → 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.
Files changed (63) 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/loader.cjs.js +1 -1
  4. package/dist/cjs/smoothly-accordion_47.cjs.entry.js +22 -21
  5. package/dist/cjs/smoothly-calendar.cjs.entry.js +17 -16
  6. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +1 -1
  7. package/dist/cjs/smoothly-input-date.cjs.entry.js +1 -1
  8. package/dist/cjs/smoothly-input-month.cjs.entry.js +1 -1
  9. package/dist/cjs/smoothly-select-demo.cjs.entry.js +2 -2
  10. package/dist/cjs/smoothly.cjs.js +1 -1
  11. package/dist/collection/components/calendar/generate.js +2 -2
  12. package/dist/collection/components/calendar/index.js +59 -14
  13. package/dist/collection/components/calendar/style.css +7 -1
  14. package/dist/collection/components/input-date/index.js +45 -1
  15. package/dist/collection/components/input-date-range/index.js +45 -1
  16. package/dist/collection/components/select-demo/index.js +2 -2
  17. package/dist/collection/index.js +1 -1
  18. package/dist/collection/utilities/Cosmetic/Color/CommaRgb.js +90 -0
  19. package/dist/collection/utilities/Cosmetic/Color/Hex.js +11 -0
  20. package/dist/collection/utilities/Cosmetic/Color/Hsl.js +32 -0
  21. package/dist/collection/utilities/{colorNames.js → Cosmetic/Color/Name.js} +9 -1
  22. package/dist/collection/utilities/Cosmetic/Color/Rgb.js +19 -0
  23. package/dist/collection/utilities/Cosmetic/Color/index.js +23 -0
  24. package/dist/collection/utilities/Cosmetic/index.js +40 -0
  25. package/dist/collection/utilities/index.js +1 -1
  26. package/dist/custom-elements/index.js +246 -146
  27. package/dist/{smoothly/generate-be25a8d1.js → esm/generate-776b3b0f.js} +2 -2
  28. package/dist/esm/index.js +215 -116
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/smoothly-accordion_47.entry.js +22 -21
  31. package/dist/esm/smoothly-calendar.entry.js +17 -16
  32. package/dist/esm/smoothly-input-date-range.entry.js +1 -1
  33. package/dist/esm/smoothly-input-date.entry.js +1 -1
  34. package/dist/esm/smoothly-input-month.entry.js +1 -1
  35. package/dist/esm/smoothly-select-demo.entry.js +2 -2
  36. package/dist/esm/smoothly.js +1 -1
  37. package/dist/{esm/generate-be25a8d1.js → smoothly/generate-776b3b0f.js} +2 -2
  38. package/dist/smoothly/index.esm.js +215 -116
  39. package/dist/smoothly/p-5ca32c49.entry.js +1 -0
  40. package/dist/smoothly/smoothly-calendar.entry.js +17 -16
  41. package/dist/smoothly/smoothly-input-date-range.entry.js +1 -1
  42. package/dist/smoothly/smoothly-input-date.entry.js +1 -1
  43. package/dist/smoothly/smoothly-input-month.entry.js +1 -1
  44. package/dist/smoothly/smoothly-select-demo.entry.js +2 -2
  45. package/dist/smoothly/smoothly.esm.js +1 -1
  46. package/dist/types/components/calendar/index.d.ts +3 -0
  47. package/dist/types/components/input-date/index.d.ts +2 -0
  48. package/dist/types/components/input-date-range/index.d.ts +2 -0
  49. package/dist/types/components.d.ts +12 -0
  50. package/dist/types/index.d.ts +1 -1
  51. package/dist/types/utilities/Cosmetic/Color/CommaRgb.d.ts +11 -0
  52. package/dist/types/utilities/Cosmetic/Color/Hex.d.ts +4 -0
  53. package/dist/types/utilities/Cosmetic/Color/Hsl.d.ts +4 -0
  54. package/dist/types/utilities/Cosmetic/Color/Name.d.ts +155 -0
  55. package/dist/types/utilities/Cosmetic/Color/Rgb.d.ts +4 -0
  56. package/dist/types/utilities/Cosmetic/Color/index.d.ts +170 -0
  57. package/dist/types/utilities/Cosmetic/index.d.ts +23 -0
  58. package/dist/types/utilities/index.d.ts +1 -1
  59. package/package.json +1 -1
  60. package/dist/collection/utilities/colorTransform.js +0 -120
  61. package/dist/smoothly/p-c9d01e9b.entry.js +0 -1
  62. package/dist/types/utilities/colorNames.d.ts +0 -3
  63. package/dist/types/utilities/colorTransform.d.ts +0 -8
@@ -121,5 +121,5 @@ const patchCloneNodeFix = (HTMLElementPrototype) => {
121
121
 
122
122
  patchBrowser().then(options => {
123
123
  globalScripts();
124
- return bootstrapLazy([["smoothly-app-demo",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}]]],["smoothly-radio-group",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder",[[0,"smoothly-reorder"]]],["smoothly-trigger-sink",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-input-demo",[[0,"smoothly-input-demo"]]],["smoothly-select-demo",[[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]]]],["smoothly-table-demo",[[2,"smoothly-table-demo"]]],["smoothly-display-demo",[[0,"smoothly-display-demo"]]],["smoothly-app",[[4,"smoothly-app",{"color":[1]}]]],["smoothly-dialog-demo",[[0,"smoothly-dialog-demo"]]],["smoothly-icon-demo",[[2,"smoothly-icon-demo"]]],["smoothly-room",[[4,"smoothly-room",{"label":[1],"icon":[1],"path":[1],"to":[1]}]]],["smoothly-input-date-range",[[2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"open":[1028]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"]]]]],["smoothly-notifier",[[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]]]],["smoothly-picker",[[1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"isOpen":[32]},[[0,"optionSelect","optionSelectHander"]]]]],["smoothly-dialog",[[6,"smoothly-dialog",{"color":[513],"open":[1540],"closable":[516],"header":[513]},[[0,"trigger","TriggerListener"]]]]],["smoothly-checkbox",[[2,"smoothly-checkbox",{"selectAll":[4,"select-all"],"selected":[1540],"disabled":[1540],"t":[32]}]]],["smoothly-submit",[[6,"smoothly-submit",{"processing":[1540],"color":[513],"expand":[513],"fill":[513],"disabled":[516],"prevent":[4],"submit":[64]},[[0,"click","handleSubmit"]]]]],["smoothly-urlencoded",[[0,"smoothly-urlencoded",{"data":[1]}]]],["smoothly-accordion",[[6,"smoothly-accordion",{"value":[1025]},[[0,"smoothlyOpen","handleOpenClose"],[0,"smoothlyClose","handleOpenClose"],[0,"smoothlyAccordionItemDidLoad","onAccordionItemDidLoad"],[0,"smoothlyAccordionItemDidUnload","onAccordionItemDidUnload"]]]]],["smoothly-accordion-item",[[6,"smoothly-accordion-item",{"name":[1],"brand":[1],"open":[1540]}]]],["smoothly-display-amount",[[2,"smoothly-display-amount",{"amount":[8],"currency":[1]}]]],["smoothly-frame",[[2,"smoothly-frame",{"url":[1],"name":[1],"origin":[1],"send":[64]}]]],["smoothly-popup",[[6,"smoothly-popup",{"visible":[1540],"direction":[1537],"cssVariables":[32]}]]],["smoothly-quiet",[[6,"smoothly-quiet",{"color":[1]}]]],["smoothly-radio",[[6,"smoothly-radio",{"name":[1],"value":[1],"checked":[1540],"tabIndex":[2,"tab-index"]}]]],["smoothly-select",[[6,"smoothly-select",{"identifier":[1],"background":[513],"value":[1025]}]]],["smoothly-tab",[[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]]]],["smoothly-tab-switch",[[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]]]],["smoothly-table",[[6,"smoothly-table",null,[[0,"sort","onSort"]]]]],["smoothly-table-cell",[[6,"smoothly-table-cell"]]],["smoothly-table-expandable-cell",[[6,"smoothly-table-expandable-cell",{"align":[1],"open":[1540],"beginOpen":[32]},[[0,"click","onClick"]]]]],["smoothly-table-expandable-row",[[6,"smoothly-table-expandable-row",null,[[0,"expansionLoaded","onExpansionLoaded"],[0,"expansionOpen","onDetailsLoaded"]]]]],["smoothly-table-header",[[6,"smoothly-table-header",{"name":[1],"sortDirection":[1025,"sort-direction"]},[[0,"click","onClick"]]]]],["smoothly-table-row",[[6,"smoothly-table-row",{"align":[1],"open":[1540],"beginOpen":[32]},[[0,"click","onClick"]]]]],["smoothly-icon",[[2,"smoothly-icon",{"color":[513],"fill":[513],"name":[1],"size":[513],"toolTip":[1,"tool-tip"],"document":[32]}]]],["smoothly-selector",[[6,"smoothly-selector",{"opened":[32],"selectedElement":[32],"missing":[32],"filter":[32]},[[0,"click","onClick"],[0,"itemSelected","onItemSelected"],[0,"keydown","onKeyDown"]]]]],["smoothly-input-date",[[6,"smoothly-input-date",{"value":[1025],"open":[1028]}]]],["smoothly-notification",[[2,"smoothly-notification",{"notice":[16],"tick":[32]},[[0,"trigger","onTrigger"]]]]],["smoothly-option",[[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537]}]]],["smoothly-menu-options",[[1,"smoothly-menu-options",{"emptyMenuLabel":[1025,"empty-menu-label"],"maxMenuHeight":[1,"max-menu-height"],"order":[4],"optionStyle":[8,"option-style"],"options":[1040],"resetHighlightOnOptionsChange":[1028,"reset-highlight-on-options-change"],"filteredOptions":[32],"highlightIndex":[32],"moveHighlight":[64],"setHighlight":[64],"getHighlighted":[64],"filterOptions":[64]},[[0,"optionHover","optionHoverHandler"]]]]],["smoothly-display",[[2,"smoothly-display",{"type":[1],"value":[8],"currency":[1],"country":[1]}]]],["smoothly-display-date-time",[[2,"smoothly-display-date-time",{"datetime":[1]}]]],["smoothly-spinner",[[2,"smoothly-spinner",{"active":[516]}]]],["smoothly-tuple",[[0,"smoothly-tuple",{"tuple":[16]}]]],["smoothly-item",[[6,"smoothly-item",{"value":[8],"selected":[1540],"filter":[64]},[[0,"click","onClick"]]]]],["smoothly-input-month",[[2,"smoothly-input-month",{"value":[1025]}]]],["smoothly-calendar",[[2,"smoothly-calendar",{"month":[1025],"value":[1025],"start":[1025],"end":[1025],"doubleInput":[516,"double-input"]}]]],["smoothly-input",[[6,"smoothly-input",{"name":[513],"value":[1032],"type":[513],"required":[1540],"minLength":[1026,"min-length"],"maxLength":[1026,"max-length"],"autocomplete":[1028],"pattern":[1040],"placeholder":[1025],"disabled":[1028],"currency":[513],"setKeepFocusOnReRender":[64],"setSelectionRange":[64]}]]],["smoothly-trigger",[[6,"smoothly-trigger",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"name":[1],"value":[8]},[[0,"click","onClick"]]]]]], options);
124
+ return bootstrapLazy([["smoothly-app-demo",[[0,"smoothly-app-demo",{"baseUrl":[1,"base-url"]}]]],["smoothly-radio-group",[[4,"smoothly-radio-group",{"orientation":[513]}]]],["smoothly-reorder",[[0,"smoothly-reorder"]]],["smoothly-trigger-sink",[[6,"smoothly-trigger-sink",{"context":[16],"destination":[1],"filter":[1]},[[0,"trigger","TriggerListener"]]]]],["smoothly-trigger-source",[[6,"smoothly-trigger-source",{"listen":[1]}]]],["smoothly-input-demo",[[0,"smoothly-input-demo"]]],["smoothly-select-demo",[[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]]]],["smoothly-table-demo",[[2,"smoothly-table-demo"]]],["smoothly-display-demo",[[0,"smoothly-display-demo"]]],["smoothly-app",[[4,"smoothly-app",{"color":[1]}]]],["smoothly-dialog-demo",[[0,"smoothly-dialog-demo"]]],["smoothly-icon-demo",[[2,"smoothly-icon-demo"]]],["smoothly-room",[[4,"smoothly-room",{"label":[1],"icon":[1],"path":[1],"to":[1]}]]],["smoothly-input-date-range",[[2,"smoothly-input-date-range",{"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"open":[1028]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"]]]]],["smoothly-notifier",[[6,"smoothly-notifier",{"notices":[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]]]],["smoothly-picker",[[1,"smoothly-picker",{"maxMenuHeight":[1,"max-menu-height"],"maxHeight":[1,"max-height"],"emptyMenuLabel":[1025,"empty-menu-label"],"multiple":[516],"optionStyle":[8,"option-style"],"options":[16],"labelSetting":[513,"label-setting"],"label":[513],"selections":[1040],"selectNoneName":[1025,"select-none-name"],"isOpen":[32]},[[0,"optionSelect","optionSelectHander"]]]]],["smoothly-dialog",[[6,"smoothly-dialog",{"color":[513],"open":[1540],"closable":[516],"header":[513]},[[0,"trigger","TriggerListener"]]]]],["smoothly-checkbox",[[2,"smoothly-checkbox",{"selectAll":[4,"select-all"],"selected":[1540],"disabled":[1540],"t":[32]}]]],["smoothly-submit",[[6,"smoothly-submit",{"processing":[1540],"color":[513],"expand":[513],"fill":[513],"disabled":[516],"prevent":[4],"submit":[64]},[[0,"click","handleSubmit"]]]]],["smoothly-urlencoded",[[0,"smoothly-urlencoded",{"data":[1]}]]],["smoothly-accordion",[[6,"smoothly-accordion",{"value":[1025]},[[0,"smoothlyOpen","handleOpenClose"],[0,"smoothlyClose","handleOpenClose"],[0,"smoothlyAccordionItemDidLoad","onAccordionItemDidLoad"],[0,"smoothlyAccordionItemDidUnload","onAccordionItemDidUnload"]]]]],["smoothly-accordion-item",[[6,"smoothly-accordion-item",{"name":[1],"brand":[1],"open":[1540]}]]],["smoothly-display-amount",[[2,"smoothly-display-amount",{"amount":[8],"currency":[1]}]]],["smoothly-frame",[[2,"smoothly-frame",{"url":[1],"name":[1],"origin":[1],"send":[64]}]]],["smoothly-popup",[[6,"smoothly-popup",{"visible":[1540],"direction":[1537],"cssVariables":[32]}]]],["smoothly-quiet",[[6,"smoothly-quiet",{"color":[1]}]]],["smoothly-radio",[[6,"smoothly-radio",{"name":[1],"value":[1],"checked":[1540],"tabIndex":[2,"tab-index"]}]]],["smoothly-select",[[6,"smoothly-select",{"identifier":[1],"background":[513],"value":[1025]}]]],["smoothly-tab",[[6,"smoothly-tab",{"label":[1],"open":[1540]},[[0,"click","onClick"]]]]],["smoothly-tab-switch",[[6,"smoothly-tab-switch",{"selectedElement":[32]},[[0,"expansionOpen","openChanged"]]]]],["smoothly-table",[[6,"smoothly-table",null,[[0,"sort","onSort"]]]]],["smoothly-table-cell",[[6,"smoothly-table-cell"]]],["smoothly-table-expandable-cell",[[6,"smoothly-table-expandable-cell",{"align":[1],"open":[1540],"beginOpen":[32]},[[0,"click","onClick"]]]]],["smoothly-table-expandable-row",[[6,"smoothly-table-expandable-row",null,[[0,"expansionLoaded","onExpansionLoaded"],[0,"expansionOpen","onDetailsLoaded"]]]]],["smoothly-table-header",[[6,"smoothly-table-header",{"name":[1],"sortDirection":[1025,"sort-direction"]},[[0,"click","onClick"]]]]],["smoothly-table-row",[[6,"smoothly-table-row",{"align":[1],"open":[1540],"beginOpen":[32]},[[0,"click","onClick"]]]]],["smoothly-icon",[[2,"smoothly-icon",{"color":[513],"fill":[513],"name":[1],"size":[513],"toolTip":[1,"tool-tip"],"document":[32]}]]],["smoothly-selector",[[6,"smoothly-selector",{"opened":[32],"selectedElement":[32],"missing":[32],"filter":[32]},[[0,"click","onClick"],[0,"itemSelected","onItemSelected"],[0,"keydown","onKeyDown"]]]]],["smoothly-input-date",[[6,"smoothly-input-date",{"value":[1025],"open":[1028],"max":[1025],"min":[1025]}]]],["smoothly-notification",[[2,"smoothly-notification",{"notice":[16],"tick":[32]},[[0,"trigger","onTrigger"]]]]],["smoothly-option",[[1,"smoothly-option",{"aliases":[513],"dataHighlight":[1540,"data-highlight"],"name":[1537],"value":[1537]}]]],["smoothly-menu-options",[[1,"smoothly-menu-options",{"emptyMenuLabel":[1025,"empty-menu-label"],"maxMenuHeight":[1,"max-menu-height"],"order":[4],"optionStyle":[8,"option-style"],"options":[1040],"resetHighlightOnOptionsChange":[1028,"reset-highlight-on-options-change"],"filteredOptions":[32],"highlightIndex":[32],"moveHighlight":[64],"setHighlight":[64],"getHighlighted":[64],"filterOptions":[64]},[[0,"optionHover","optionHoverHandler"]]]]],["smoothly-display",[[2,"smoothly-display",{"type":[1],"value":[8],"currency":[1],"country":[1]}]]],["smoothly-display-date-time",[[2,"smoothly-display-date-time",{"datetime":[1]}]]],["smoothly-spinner",[[2,"smoothly-spinner",{"active":[516]}]]],["smoothly-tuple",[[0,"smoothly-tuple",{"tuple":[16]}]]],["smoothly-item",[[6,"smoothly-item",{"value":[8],"selected":[1540],"filter":[64]},[[0,"click","onClick"]]]]],["smoothly-input-month",[[2,"smoothly-input-month",{"value":[1025]}]]],["smoothly-calendar",[[2,"smoothly-calendar",{"month":[1025],"value":[1025],"start":[1025],"end":[1025],"max":[1025],"min":[1025],"doubleInput":[516,"double-input"]}]]],["smoothly-input",[[6,"smoothly-input",{"name":[513],"value":[1032],"type":[513],"required":[1540],"minLength":[1026,"min-length"],"maxLength":[1026,"max-length"],"autocomplete":[1028],"pattern":[1040],"placeholder":[1025],"disabled":[1028],"currency":[513],"setKeepFocusOnReRender":[64],"setSelectionRange":[64]}]]],["smoothly-trigger",[[6,"smoothly-trigger",{"color":[513],"expand":[513],"fill":[513],"disabled":[516],"type":[513],"name":[1],"value":[8]},[[0,"click","onClick"]]]]]], options);
125
125
  });
@@ -31,12 +31,12 @@ function months(current) {
31
31
  const day = new globalThis.Date(current);
32
32
  const result = [];
33
33
  for (let i = 0; i < 12; i++) {
34
- day.setMonth(i);
34
+ day.setMonth(i, 28);
35
35
  const date = dist.Date.create(day);
36
36
  result.push({
37
37
  date,
38
38
  name: day.toLocaleString(undefined, { month: "long" }),
39
- selected: date == current,
39
+ selected: date.substr(0, 7) == current.substr(0, 7),
40
40
  });
41
41
  }
42
42
  return result;
@@ -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 };