@qrvey/utils 1.13.0-6.performance.1 → 1.112.2

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 (196) hide show
  1. package/README.md +2173 -2649
  2. package/dist/charts/adapters/endpointData.js +1 -1
  3. package/dist/charts/adapters/endpointDataGet.js +1 -1
  4. package/dist/cjs/charts/adapters/endpointData.js +1 -1
  5. package/dist/cjs/charts/adapters/endpointDataGet.js +1 -1
  6. package/dist/cjs/dates/adapters/dateToMonthYear.js +1 -3
  7. package/dist/cjs/dates/constants/index.d.ts +0 -1
  8. package/dist/cjs/dates/constants/index.js +0 -1
  9. package/dist/cjs/dates/relative/RelativeStatementAdapter.d.ts +1 -1
  10. package/dist/cjs/dates/relative/RelativeStatementAdapter.js +1 -2
  11. package/dist/cjs/dates/relative/relative.d.ts +4 -3
  12. package/dist/cjs/dates/relative/relative.js +9 -5
  13. package/dist/cjs/filters/constants/common/FILTER_SCOPE.d.ts +8 -8
  14. package/dist/cjs/filters/helpers/common/getFiltersByScopesIds.d.ts +1 -0
  15. package/dist/cjs/filters/helpers/common/getFiltersByScopesIds.js +3 -3
  16. package/dist/cjs/filters/helpers/common/getFiltersByVisibility.d.ts +1 -1
  17. package/dist/cjs/filters/helpers/common/getFiltersByVisibility.js +1 -1
  18. package/dist/cjs/filters/services/Filters.api.js +7 -4
  19. package/dist/cjs/filters/services/UChartApi.d.ts +1 -1
  20. package/dist/cjs/filters/services/UChartApi.js +1 -2
  21. package/dist/cjs/filters/services/UChartPaginationApi.d.ts +1 -1
  22. package/dist/cjs/filters/services/UChartPaginationApi.js +2 -3
  23. package/dist/cjs/general/object/objectCopy.d.ts +5 -4
  24. package/dist/cjs/general/object/objectCopy.js +26 -16
  25. package/dist/cjs/services/api/Charts.api.d.ts +0 -2
  26. package/dist/cjs/services/api/Charts.api.js +0 -22
  27. package/dist/cjs/services/api/getAllQrveys.api.d.ts +1 -1
  28. package/dist/cjs/services/api/getModel.api.d.ts +1 -1
  29. package/dist/cjs/services/api/getModel.api.js +2 -1
  30. package/dist/cjs/services/helpers/getDefaultQuestionListOptionsAttributes.js +7 -7
  31. package/dist/cjs/services/interfaces/IPayloadQrveyAll.d.ts +1 -1
  32. package/dist/cjs/themes/constants/AUTOMATIC_CSS_VARIABLES.d.ts +0 -2
  33. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.d.ts +0 -1
  34. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.js +0 -1
  35. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.d.ts +0 -1
  36. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +0 -1
  37. package/dist/cjs/themes/constants/COLOR_TYPE.d.ts +0 -3
  38. package/dist/cjs/themes/constants/COLOR_TYPE.js +0 -3
  39. package/dist/cjs/themes/constants/CSS_VARIABLE_DESTINATION.d.ts +0 -3
  40. package/dist/cjs/themes/constants/CSS_VARIABLE_DESTINATION.js +0 -3
  41. package/dist/cjs/themes/constants/GLOBAL_CSS_VARIABLES.d.ts +1 -2
  42. package/dist/cjs/themes/constants/GLOBAL_CSS_VARIABLES.js +0 -1
  43. package/dist/cjs/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.d.ts +0 -3
  44. package/dist/cjs/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.js +0 -3
  45. package/dist/cjs/themes/constants/RGBA_REGULAR_EXPRESION.d.ts +0 -3
  46. package/dist/cjs/themes/constants/RGBA_REGULAR_EXPRESION.js +0 -3
  47. package/dist/cjs/themes/constants/index.d.ts +0 -4
  48. package/dist/cjs/themes/constants/index.js +0 -4
  49. package/dist/cjs/themes/helpers/getCSSVariablesByDestination.d.ts +6 -3
  50. package/dist/cjs/themes/helpers/getCSSVariablesByDestination.js +0 -3
  51. package/dist/cjs/themes/helpers/index.d.ts +1 -6
  52. package/dist/cjs/themes/helpers/index.js +1 -6
  53. package/dist/cjs/themes/helpers/isHexadecimalColor.js +1 -2
  54. package/dist/cjs/themes/helpers/isRGBAColor.js +1 -2
  55. package/dist/cjs/themes/helpers/lightOrDark.js +30 -14
  56. package/dist/cjs/themes/helpers/setAutomaticCSSVariablesForDark.js +1 -1
  57. package/dist/cjs/themes/interfaces/IColorCSSVariableDestination.d.ts +0 -3
  58. package/dist/cjs/themes/interfaces/IColorType.d.ts +0 -3
  59. package/dist/cjs/themes/interfaces/index.d.ts +0 -1
  60. package/dist/cjs/themes/interfaces/index.js +0 -1
  61. package/dist/dates/adapters/dateToMonthYear.js +1 -3
  62. package/dist/dates/constants/index.d.ts +0 -1
  63. package/dist/dates/constants/index.js +0 -1
  64. package/dist/dates/relative/RelativeStatementAdapter.d.ts +1 -1
  65. package/dist/dates/relative/RelativeStatementAdapter.js +1 -1
  66. package/dist/dates/relative/relative.d.ts +4 -3
  67. package/dist/dates/relative/relative.js +5 -4
  68. package/dist/filters/constants/common/FILTER_SCOPE.d.ts +8 -8
  69. package/dist/filters/helpers/common/getFiltersByScopesIds.d.ts +1 -0
  70. package/dist/filters/helpers/common/getFiltersByScopesIds.js +3 -3
  71. package/dist/filters/helpers/common/getFiltersByVisibility.d.ts +1 -1
  72. package/dist/filters/helpers/common/getFiltersByVisibility.js +1 -1
  73. package/dist/filters/services/Filters.api.js +2 -2
  74. package/dist/filters/services/UChartApi.d.ts +1 -1
  75. package/dist/filters/services/UChartApi.js +2 -1
  76. package/dist/filters/services/UChartPaginationApi.d.ts +1 -1
  77. package/dist/filters/services/UChartPaginationApi.js +3 -2
  78. package/dist/general/object/objectCopy.d.ts +5 -4
  79. package/dist/general/object/objectCopy.js +26 -16
  80. package/dist/services/api/Charts.api.d.ts +0 -2
  81. package/dist/services/api/Charts.api.js +0 -22
  82. package/dist/services/api/getAllQrveys.api.d.ts +1 -1
  83. package/dist/services/api/getModel.api.d.ts +1 -1
  84. package/dist/services/api/getModel.api.js +2 -1
  85. package/dist/services/helpers/getDefaultQuestionListOptionsAttributes.js +7 -7
  86. package/dist/services/interfaces/IPayloadQrveyAll.d.ts +1 -1
  87. package/dist/themes/constants/AUTOMATIC_CSS_VARIABLES.d.ts +0 -2
  88. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.d.ts +0 -1
  89. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.js +0 -1
  90. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.d.ts +0 -1
  91. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +0 -1
  92. package/dist/themes/constants/COLOR_TYPE.d.ts +0 -3
  93. package/dist/themes/constants/COLOR_TYPE.js +0 -3
  94. package/dist/themes/constants/CSS_VARIABLE_DESTINATION.d.ts +0 -3
  95. package/dist/themes/constants/CSS_VARIABLE_DESTINATION.js +0 -3
  96. package/dist/themes/constants/GLOBAL_CSS_VARIABLES.d.ts +1 -2
  97. package/dist/themes/constants/GLOBAL_CSS_VARIABLES.js +0 -1
  98. package/dist/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.d.ts +0 -3
  99. package/dist/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.js +0 -3
  100. package/dist/themes/constants/RGBA_REGULAR_EXPRESION.d.ts +0 -3
  101. package/dist/themes/constants/RGBA_REGULAR_EXPRESION.js +0 -3
  102. package/dist/themes/constants/index.d.ts +0 -4
  103. package/dist/themes/constants/index.js +0 -4
  104. package/dist/themes/helpers/getCSSVariablesByDestination.d.ts +6 -3
  105. package/dist/themes/helpers/getCSSVariablesByDestination.js +0 -3
  106. package/dist/themes/helpers/index.d.ts +1 -6
  107. package/dist/themes/helpers/index.js +1 -6
  108. package/dist/themes/helpers/isHexadecimalColor.js +1 -2
  109. package/dist/themes/helpers/isRGBAColor.js +1 -2
  110. package/dist/themes/helpers/lightOrDark.js +30 -14
  111. package/dist/themes/helpers/setAutomaticCSSVariablesForDark.js +1 -1
  112. package/dist/themes/interfaces/IColorCSSVariableDestination.d.ts +0 -3
  113. package/dist/themes/interfaces/IColorType.d.ts +0 -3
  114. package/dist/themes/interfaces/index.d.ts +0 -1
  115. package/dist/themes/interfaces/index.js +0 -1
  116. package/package.json +17 -21
  117. package/dist/cache-managers/cache-chart-manager.d.ts +0 -34
  118. package/dist/cache-managers/cache-chart-manager.js +0 -43
  119. package/dist/cache-managers/cache-manager.d.ts +0 -27
  120. package/dist/cache-managers/cache-manager.js +0 -39
  121. package/dist/cache-managers/cache-metric-manager.d.ts +0 -34
  122. package/dist/cache-managers/cache-metric-manager.js +0 -43
  123. package/dist/cache-managers/cache-model-manager.d.ts +0 -29
  124. package/dist/cache-managers/cache-model-manager.js +0 -40
  125. package/dist/cache-managers/cache-permissions-manager.d.ts +0 -26
  126. package/dist/cache-managers/cache-permissions-manager.js +0 -39
  127. package/dist/cjs/cache-managers/cache-chart-manager.d.ts +0 -34
  128. package/dist/cjs/cache-managers/cache-chart-manager.js +0 -50
  129. package/dist/cjs/cache-managers/cache-manager.d.ts +0 -27
  130. package/dist/cjs/cache-managers/cache-manager.js +0 -43
  131. package/dist/cjs/cache-managers/cache-metric-manager.d.ts +0 -34
  132. package/dist/cjs/cache-managers/cache-metric-manager.js +0 -50
  133. package/dist/cjs/cache-managers/cache-model-manager.d.ts +0 -29
  134. package/dist/cjs/cache-managers/cache-model-manager.js +0 -44
  135. package/dist/cjs/cache-managers/cache-permissions-manager.d.ts +0 -26
  136. package/dist/cjs/cache-managers/cache-permissions-manager.js +0 -43
  137. package/dist/cjs/dates/constants/INTL_DATE_FORMATS.d.ts +0 -1
  138. package/dist/cjs/dates/constants/INTL_DATE_FORMATS.js +0 -8
  139. package/dist/cjs/interfaces/AdminPermissions.interface.d.ts +0 -53
  140. package/dist/cjs/interfaces/AdminPermissions.interface.js +0 -7
  141. package/dist/cjs/services/api/adminPermissions.api.d.ts +0 -2
  142. package/dist/cjs/services/api/adminPermissions.api.js +0 -20
  143. package/dist/cjs/services/api/metrics.api.d.ts +0 -4
  144. package/dist/cjs/services/api/metrics.api.js +0 -19
  145. package/dist/cjs/services/constants/METRIC_ENDPOINT.d.ts +0 -2
  146. package/dist/cjs/services/constants/METRIC_ENDPOINT.js +0 -7
  147. package/dist/cjs/themes/constants/CHANNEL_BLACK_COLOR.d.ts +0 -5
  148. package/dist/cjs/themes/constants/CHANNEL_BLACK_COLOR.js +0 -12
  149. package/dist/cjs/themes/constants/CHANNEL_WHITE_COLOR.d.ts +0 -5
  150. package/dist/cjs/themes/constants/CHANNEL_WHITE_COLOR.js +0 -12
  151. package/dist/cjs/themes/constants/COLOR_NAME.d.ts +0 -154
  152. package/dist/cjs/themes/constants/COLOR_NAME.js +0 -157
  153. package/dist/cjs/themes/helpers/calculateHSP.d.ts +0 -8
  154. package/dist/cjs/themes/helpers/calculateHSP.js +0 -20
  155. package/dist/cjs/themes/helpers/getChannelsByHexadecimalColor.d.ts +0 -8
  156. package/dist/cjs/themes/helpers/getChannelsByHexadecimalColor.js +0 -26
  157. package/dist/cjs/themes/helpers/getChannelsByNameColor.d.ts +0 -8
  158. package/dist/cjs/themes/helpers/getChannelsByNameColor.js +0 -26
  159. package/dist/cjs/themes/helpers/getChannelsByRgbaColor.d.ts +0 -8
  160. package/dist/cjs/themes/helpers/getChannelsByRgbaColor.js +0 -25
  161. package/dist/cjs/themes/helpers/getHexadecimalOpacity.d.ts +0 -7
  162. package/dist/cjs/themes/helpers/getHexadecimalOpacity.js +0 -19
  163. package/dist/cjs/themes/helpers/getRgbaOpacity.d.ts +0 -7
  164. package/dist/cjs/themes/helpers/getRgbaOpacity.js +0 -21
  165. package/dist/cjs/themes/interfaces/IColorChannel.d.ts +0 -9
  166. package/dist/cjs/themes/interfaces/IColorChannel.js +0 -2
  167. package/dist/dates/constants/INTL_DATE_FORMATS.d.ts +0 -1
  168. package/dist/dates/constants/INTL_DATE_FORMATS.js +0 -5
  169. package/dist/interfaces/AdminPermissions.interface.d.ts +0 -53
  170. package/dist/interfaces/AdminPermissions.interface.js +0 -4
  171. package/dist/services/api/adminPermissions.api.d.ts +0 -2
  172. package/dist/services/api/adminPermissions.api.js +0 -16
  173. package/dist/services/api/metrics.api.d.ts +0 -4
  174. package/dist/services/api/metrics.api.js +0 -16
  175. package/dist/services/constants/METRIC_ENDPOINT.d.ts +0 -2
  176. package/dist/services/constants/METRIC_ENDPOINT.js +0 -4
  177. package/dist/themes/constants/CHANNEL_BLACK_COLOR.d.ts +0 -5
  178. package/dist/themes/constants/CHANNEL_BLACK_COLOR.js +0 -9
  179. package/dist/themes/constants/CHANNEL_WHITE_COLOR.d.ts +0 -5
  180. package/dist/themes/constants/CHANNEL_WHITE_COLOR.js +0 -9
  181. package/dist/themes/constants/COLOR_NAME.d.ts +0 -154
  182. package/dist/themes/constants/COLOR_NAME.js +0 -154
  183. package/dist/themes/helpers/calculateHSP.d.ts +0 -8
  184. package/dist/themes/helpers/calculateHSP.js +0 -16
  185. package/dist/themes/helpers/getChannelsByHexadecimalColor.d.ts +0 -8
  186. package/dist/themes/helpers/getChannelsByHexadecimalColor.js +0 -22
  187. package/dist/themes/helpers/getChannelsByNameColor.d.ts +0 -8
  188. package/dist/themes/helpers/getChannelsByNameColor.js +0 -22
  189. package/dist/themes/helpers/getChannelsByRgbaColor.d.ts +0 -8
  190. package/dist/themes/helpers/getChannelsByRgbaColor.js +0 -21
  191. package/dist/themes/helpers/getHexadecimalOpacity.d.ts +0 -7
  192. package/dist/themes/helpers/getHexadecimalOpacity.js +0 -15
  193. package/dist/themes/helpers/getRgbaOpacity.d.ts +0 -7
  194. package/dist/themes/helpers/getRgbaOpacity.js +0 -17
  195. package/dist/themes/interfaces/IColorChannel.d.ts +0 -9
  196. package/dist/themes/interfaces/IColorChannel.js +0 -1
@@ -13,5 +13,4 @@ export const AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK = {
13
13
  [GLOBAL_CSS_VARIABLES.TEXT_COLOR]: "#FFFFFF",
14
14
  [GLOBAL_CSS_VARIABLES.TEXT_SECONDARY_COLOR]: "#FFFFFF90",
15
15
  [GLOBAL_CSS_VARIABLES.TEXT_TERTIARY_COLOR]: "#FFFFFF80",
16
- [GLOBAL_CSS_VARIABLES.INFO_COLOR]: "#FFFFFFCC",
17
16
  };
@@ -12,5 +12,4 @@ export declare const AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT: {
12
12
  "--qv-global-text-color": any;
13
13
  "--qv-global-text-secondary-color": string;
14
14
  "--qv-global-text-tertiary-color": string;
15
- "--qv-global-info-color": any;
16
15
  };
@@ -13,5 +13,4 @@ export const AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT = {
13
13
  [GLOBAL_CSS_VARIABLES.TEXT_COLOR]: undefined,
14
14
  [GLOBAL_CSS_VARIABLES.TEXT_SECONDARY_COLOR]: "#00000080",
15
15
  [GLOBAL_CSS_VARIABLES.TEXT_TERTIARY_COLOR]: "#00000070",
16
- [GLOBAL_CSS_VARIABLES.INFO_COLOR]: undefined,
17
16
  };
@@ -1,6 +1,3 @@
1
- /**
2
- * The color luminosity type
3
- */
4
1
  export declare enum COLOR_TYPE {
5
2
  DARK = "DARK",
6
3
  LIGHT = "LIGHT"
@@ -1,6 +1,3 @@
1
- /**
2
- * The color luminosity type
3
- */
4
1
  export var COLOR_TYPE;
5
2
  (function (COLOR_TYPE) {
6
3
  COLOR_TYPE["DARK"] = "DARK";
@@ -1,6 +1,3 @@
1
- /**
2
- * The Destination places to inject the css variables
3
- */
4
1
  export declare enum CSS_VARIABLE_DESTINATION {
5
2
  CANVAS = "CANVAS",
6
3
  GLOBAL = "GLOBAL"
@@ -1,6 +1,3 @@
1
- /**
2
- * The Destination places to inject the css variables
3
- */
4
1
  export var CSS_VARIABLE_DESTINATION;
5
2
  (function (CSS_VARIABLE_DESTINATION) {
6
3
  CSS_VARIABLE_DESTINATION["CANVAS"] = "CANVAS";
@@ -11,6 +11,5 @@ export declare enum GLOBAL_CSS_VARIABLES {
11
11
  PILLS_BACKGROUND_COLOR = "--qv-pills-background-color",
12
12
  TEXT_COLOR = "--qv-global-text-color",
13
13
  TEXT_SECONDARY_COLOR = "--qv-global-text-secondary-color",
14
- TEXT_TERTIARY_COLOR = "--qv-global-text-tertiary-color",
15
- INFO_COLOR = "--qv-global-info-color"
14
+ TEXT_TERTIARY_COLOR = "--qv-global-text-tertiary-color"
16
15
  }
@@ -13,5 +13,4 @@ export var GLOBAL_CSS_VARIABLES;
13
13
  GLOBAL_CSS_VARIABLES["TEXT_COLOR"] = "--qv-global-text-color";
14
14
  GLOBAL_CSS_VARIABLES["TEXT_SECONDARY_COLOR"] = "--qv-global-text-secondary-color";
15
15
  GLOBAL_CSS_VARIABLES["TEXT_TERTIARY_COLOR"] = "--qv-global-text-tertiary-color";
16
- GLOBAL_CSS_VARIABLES["INFO_COLOR"] = "--qv-global-info-color";
17
16
  })(GLOBAL_CSS_VARIABLES || (GLOBAL_CSS_VARIABLES = {}));
@@ -1,4 +1 @@
1
- /**
2
- * Hexadecimal Regular Expression
3
- */
4
1
  export declare const HEXADECIMAL_REGULAR_EXPRESSION: RegExp;
@@ -1,4 +1 @@
1
- /**
2
- * Hexadecimal Regular Expression
3
- */
4
1
  export const HEXADECIMAL_REGULAR_EXPRESSION = /^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;
@@ -1,4 +1 @@
1
- /**
2
- * RGBA Regular Expression
3
- */
4
1
  export declare const RGBA_REGULAR_EXPRESSION: RegExp;
@@ -1,4 +1 @@
1
- /**
2
- * RGBA Regular Expression
3
- */
4
1
  export const RGBA_REGULAR_EXPRESSION = /^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/;
@@ -3,10 +3,6 @@ export * from "./AUTOMATIC_CANVAS_CSS_VARIABLES_FOR_LIGHT";
3
3
  export * from "./AUTOMATIC_CSS_VARIABLES";
4
4
  export * from "./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK";
5
5
  export * from "./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT";
6
- export * from "./CANVAS_CSS_VARIABLES";
7
- export * from "./CHANNEL_BLACK_COLOR";
8
- export * from "./CHANNEL_WHITE_COLOR";
9
- export * from "./COLOR_NAME";
10
6
  export * from "./COLOR_TYPE";
11
7
  export * from "./CSS_VARIABLE_DESTINATION";
12
8
  export * from "./GLOBAL_CSS_VARIABLES";
@@ -3,10 +3,6 @@ export * from "./AUTOMATIC_CANVAS_CSS_VARIABLES_FOR_LIGHT";
3
3
  export * from "./AUTOMATIC_CSS_VARIABLES";
4
4
  export * from "./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK";
5
5
  export * from "./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT";
6
- export * from "./CANVAS_CSS_VARIABLES";
7
- export * from "./CHANNEL_BLACK_COLOR";
8
- export * from "./CHANNEL_WHITE_COLOR";
9
- export * from "./COLOR_NAME";
10
6
  export * from "./COLOR_TYPE";
11
7
  export * from "./CSS_VARIABLE_DESTINATION";
12
8
  export * from "./GLOBAL_CSS_VARIABLES";
@@ -7,7 +7,12 @@ import { IColorCSSVariableDestination } from "../interfaces/IColorCSSVariableDes
7
7
  */
8
8
  export declare function getCSSVariablesByDestination(destination?: IColorCSSVariableDestination): {
9
9
  DARK: {
10
- "--qv-global-header-background-color": string;
10
+ "--qv-global-header-background-color": string; /**
11
+ * Gets CSS variables depending on the destination of them.
12
+ * - Destination is the place where the CSS variables are going to be applied. With this, the right CSS variables are searched and set.
13
+ * @param destination the string of the destination.
14
+ * @returns the CSS variables and their values.
15
+ */
11
16
  "--qv-global-opacity-black-color": string;
12
17
  "--qv-global-border-color": string;
13
18
  "--qv-global-divider-color": string;
@@ -17,7 +22,6 @@ export declare function getCSSVariablesByDestination(destination?: IColorCSSVari
17
22
  "--qv-global-text-color": string;
18
23
  "--qv-global-text-secondary-color": string;
19
24
  "--qv-global-text-tertiary-color": string;
20
- "--qv-global-info-color": string;
21
25
  };
22
26
  LIGHT: {
23
27
  "--qv-global-header-background-color": string;
@@ -30,7 +34,6 @@ export declare function getCSSVariablesByDestination(destination?: IColorCSSVari
30
34
  "--qv-global-text-color": any;
31
35
  "--qv-global-text-secondary-color": string;
32
36
  "--qv-global-text-tertiary-color": string;
33
- "--qv-global-info-color": any;
34
37
  };
35
38
  } | {
36
39
  DARK: {
@@ -1,4 +1,3 @@
1
- import { isEmpty } from "../../general/mix/isEmpty";
2
1
  import { AUTOMATIC_CANVAS_CSS_VARIABLES } from "../constants/AUTOMATIC_CSS_VARIABLES";
3
2
  import { CSS_VARIABLE_DESTINATION } from "../constants/CSS_VARIABLE_DESTINATION";
4
3
  /**
@@ -8,7 +7,5 @@ import { CSS_VARIABLE_DESTINATION } from "../constants/CSS_VARIABLE_DESTINATION"
8
7
  * @returns the CSS variables and their values.
9
8
  */
10
9
  export function getCSSVariablesByDestination(destination = CSS_VARIABLE_DESTINATION.GLOBAL) {
11
- if (isEmpty(destination))
12
- return AUTOMATIC_CANVAS_CSS_VARIABLES[CSS_VARIABLE_DESTINATION.GLOBAL];
13
10
  return AUTOMATIC_CANVAS_CSS_VARIABLES[destination];
14
11
  }
@@ -1,10 +1,5 @@
1
- export * from "./calculateHSP";
2
- export * from "./getChannelsByHexadecimalColor";
3
- export * from "./getChannelsByNameColor";
4
- export * from "./getChannelsByRgbaColor";
5
1
  export * from "./getCSSVariablesByDestination";
6
- export * from "./getHexadecimalOpacity";
7
- export * from "./getRgbaOpacity";
2
+ export * from "./lightOrDark";
8
3
  export * from "./isDarkColor";
9
4
  export * from "./isHexadecimalColor";
10
5
  export * from "./isRGBAColor";
@@ -1,10 +1,5 @@
1
- export * from "./calculateHSP";
2
- export * from "./getChannelsByHexadecimalColor";
3
- export * from "./getChannelsByNameColor";
4
- export * from "./getChannelsByRgbaColor";
5
1
  export * from "./getCSSVariablesByDestination";
6
- export * from "./getHexadecimalOpacity";
7
- export * from "./getRgbaOpacity";
2
+ export * from "./lightOrDark";
8
3
  export * from "./isDarkColor";
9
4
  export * from "./isHexadecimalColor";
10
5
  export * from "./isRGBAColor";
@@ -6,6 +6,5 @@ import { HEXADECIMAL_REGULAR_EXPRESSION } from "../constants/HEXADECIMAL_REGULAR
6
6
  * @returns true: the color is an hexadecimal type
7
7
  */
8
8
  export function isHexadecimalColor(color = "") {
9
- return (typeof color === "string" &&
10
- !isEmpty(color.match(HEXADECIMAL_REGULAR_EXPRESSION)));
9
+ return !isEmpty(color === null || color === void 0 ? void 0 : color.match(HEXADECIMAL_REGULAR_EXPRESSION));
11
10
  }
@@ -6,6 +6,5 @@ import { RGBA_REGULAR_EXPRESSION } from "../constants/RGBA_REGULAR_EXPRESION";
6
6
  * @returns true: the color is an RGBA type
7
7
  */
8
8
  export function isRGBAColor(color = "") {
9
- return (typeof color === "string" &&
10
- !isEmpty(color.toLowerCase().match(RGBA_REGULAR_EXPRESSION)));
9
+ return !isEmpty(color === null || color === void 0 ? void 0 : color.match(RGBA_REGULAR_EXPRESSION));
11
10
  }
@@ -1,9 +1,6 @@
1
1
  import { isEmpty } from "../../general/mix/isEmpty";
2
2
  import { COLOR_TYPE } from "../constants/COLOR_TYPE";
3
- import { calculateHSP } from "./calculateHSP";
4
- import { getChannelsByHexadecimalColor } from "./getChannelsByHexadecimalColor";
5
- import { getChannelsByNameColor } from "./getChannelsByNameColor";
6
- import { getChannelsByRgbaColor } from "./getChannelsByRgbaColor";
3
+ import { RGBA_REGULAR_EXPRESSION } from "../constants/RGBA_REGULAR_EXPRESION";
7
4
  import { isHexadecimalColor } from "./isHexadecimalColor";
8
5
  import { isRGBAColor } from "./isRGBAColor";
9
6
  /**
@@ -14,23 +11,42 @@ import { isRGBAColor } from "./isRGBAColor";
14
11
  * @returns the color type (Dark or Light)
15
12
  */
16
13
  export function lightOrDark(color, brightnessThreshold = 127.5, opacityThreshold = 0.5) {
17
- if (isEmpty(color) || typeof color !== "string")
14
+ if (isEmpty(color))
18
15
  return COLOR_TYPE.LIGHT;
19
- let rgbaChannel = { r: 0, g: 0, b: 0, a: 1 };
20
16
  const rgbaColor = isRGBAColor(color);
21
17
  const hexadecimalColor = isHexadecimalColor(color);
18
+ if (!rgbaColor && !hexadecimalColor)
19
+ return;
20
+ let r, g, b, a;
22
21
  if (rgbaColor) {
23
- rgbaChannel = getChannelsByRgbaColor(color);
22
+ const colors = color.match(RGBA_REGULAR_EXPRESSION);
23
+ r = Number(colors[1]);
24
+ g = Number(colors[2]);
25
+ b = Number(colors[3]);
26
+ a = rgbaOpacity(color);
24
27
  }
25
- else if (hexadecimalColor) {
26
- rgbaChannel = getChannelsByHexadecimalColor(color);
28
+ if (hexadecimalColor) {
29
+ const colorCode = +`0x${color
30
+ .slice(1)
31
+ .replace(color.length < 5 && /./g, "$&$&")}`;
32
+ r = colorCode >> 16;
33
+ g = (colorCode >> 8) & 255;
34
+ b = colorCode & 255;
35
+ a = hexadecimalOpacity(color);
27
36
  }
28
- else {
29
- rgbaChannel = getChannelsByNameColor(color);
30
- }
31
- const hsp = calculateHSP(rgbaChannel);
32
- if (hsp > brightnessThreshold || rgbaChannel.a < opacityThreshold) {
37
+ // HSP equation from http://alienryderflex.com/hsp.html
38
+ const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
39
+ if (hsp > brightnessThreshold || a < opacityThreshold) {
33
40
  return COLOR_TYPE.LIGHT;
34
41
  }
35
42
  return COLOR_TYPE.DARK;
36
43
  }
44
+ function hexadecimalOpacity(hexadecimal) {
45
+ const opacityHexa = hexadecimal.slice(7) || "FF";
46
+ return parseInt(opacityHexa, 16) / 255;
47
+ }
48
+ function rgbaOpacity(rgba) {
49
+ var _a;
50
+ const colors = rgba.match(RGBA_REGULAR_EXPRESSION);
51
+ return (_a = Number(colors[4])) !== null && _a !== void 0 ? _a : 1;
52
+ }
@@ -8,7 +8,7 @@ import { getCSSVariablesByDestination } from "./getCSSVariablesByDestination";
8
8
  * @param wrapperTags the html elements to set the CSS variables
9
9
  */
10
10
  export function setAutomaticCSSVariablesForDark(colorType, wrapperTags, destination = CSS_VARIABLE_DESTINATION.GLOBAL) {
11
- if (isEmpty(colorType) || !Array.isArray(wrapperTags))
11
+ if (isEmpty(colorType) || isEmpty(wrapperTags))
12
12
  return;
13
13
  const cssVariables = getCSSVariablesByDestination(destination);
14
14
  const cssVariablesKeys = Object.keys(cssVariables[colorType] || {});
@@ -1,5 +1,2 @@
1
1
  import { CSS_VARIABLE_DESTINATION } from "../constants/CSS_VARIABLE_DESTINATION";
2
- /**
3
- * CSS Variable Destination types
4
- */
5
2
  export type IColorCSSVariableDestination = CSS_VARIABLE_DESTINATION;
@@ -1,5 +1,2 @@
1
1
  import { COLOR_TYPE } from "../constants/COLOR_TYPE";
2
- /**
3
- * Color types
4
- */
5
2
  export type IColorType = COLOR_TYPE;
@@ -1,3 +1,2 @@
1
- export * from "./IColorChannel";
2
1
  export * from "./IColorCSSVariableDestination";
3
2
  export * from "./IColorType";
@@ -1,3 +1,2 @@
1
- export * from "./IColorChannel";
2
1
  export * from "./IColorCSSVariableDestination";
3
2
  export * from "./IColorType";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.13.0-6.performance.1",
3
+ "version": "1.112.2",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",
@@ -13,7 +13,7 @@
13
13
  "lint.dev": "eslint . --debug --ext .ts,.tsx",
14
14
  "prepare": "husky install",
15
15
  "publishing.beta.1": "node ./scripts/publishing --np-new-version=$npm_config_np_new_version --np-any-branch=$npm_config_np_any_branch --np-tag=$npm_config_np_tag",
16
- "publishing": "node ./scripts/clean-build && np $npm_config_np_new_version --any-branch --tag=$npm_config_np_tag --no-yarn",
16
+ "publishing": "node ./scripts/clean-build && np $npm_config_np_new_version --any-branch --tag=$npm_config_np_tag",
17
17
  "publishing.win": "node ./scripts/clean-build && np %npm_config_np_new_version% --any-branch --tag=%npm_config_np_tag%",
18
18
  "test": "jest test --verbose",
19
19
  "test.coverage": "jest test --collect-coverage",
@@ -23,34 +23,30 @@
23
23
  "author": "Qrvey Inc",
24
24
  "license": "MIT",
25
25
  "engines": {
26
- "node": ">=18 <=20"
26
+ "node": ">=14 <=18"
27
27
  },
28
28
  "devDependencies": {
29
- "@types/jest": "29.5.11",
30
- "@typescript-eslint/eslint-plugin": "6.19.0",
31
- "@typescript-eslint/parser": "6.19.0",
29
+ "@types/jest": "29.5.3",
30
+ "@types/responselike": "1.0.0",
31
+ "@typescript-eslint/eslint-plugin": "6.2.1",
32
+ "@typescript-eslint/parser": "6.2.1",
32
33
  "auto-changelog": "2.4.0",
33
- "eslint": "8.56.0",
34
- "eslint-config-prettier": "9.1.0",
35
- "eslint-import-resolver-typescript": "3.6.1",
36
- "eslint-plugin-import": "2.29.1",
37
- "eslint-plugin-jsdoc": "48.0.2",
38
- "eslint-plugin-prettier": "5.1.3",
39
- "eslint-plugin-sonarjs": "0.23.0",
34
+ "eslint": "8.46.0",
35
+ "eslint-config-prettier": "8.9.0",
36
+ "eslint-plugin-prettier": "5.0.0",
37
+ "eslint-plugin-sonarjs": "0.19.0",
40
38
  "husky": "8.0.3",
41
- "jest": "29.7.0",
42
- "jest-environment-jsdom": "29.7.0",
43
- "lint-staged": "15.2.0",
39
+ "jest": "29.6.2",
40
+ "lint-staged": "13.2.3",
44
41
  "np": "8.0.4",
45
- "prettier": "3.2.4",
42
+ "prettier": "3.0.0",
46
43
  "ts-jest": "29.1.1",
47
- "typescript": "5.3.3"
44
+ "typescript": "5.1.6"
48
45
  },
49
46
  "dependencies": {
50
- "@stencil/store": "2.0.13",
51
47
  "d3-format": "2.0.0",
52
- "dayjs": "1.11.10",
53
- "i18next": "23.7.16"
48
+ "dayjs": "1.11.9",
49
+ "i18next": "22.4.9"
54
50
  },
55
51
  "files": [
56
52
  "dist/**/*"
@@ -1,34 +0,0 @@
1
- import { OnChangeType, QrveyCacheManager } from "./cache-manager";
2
- export interface IGetChartConfig {
3
- qv_token?: string;
4
- api_key?: string;
5
- app_id?: string;
6
- user_id?: string;
7
- domain?: string;
8
- timezone?: any;
9
- qrvey_id?: string;
10
- i18n?: any;
11
- chart_id?: string;
12
- lang?: string;
13
- translated?: boolean;
14
- headers?: {
15
- "temporal-tokens"?: boolean;
16
- };
17
- }
18
- interface IChartStoreState {
19
- chart: any;
20
- loading: boolean;
21
- error: any;
22
- }
23
- export declare class ChartCacheManager extends QrveyCacheManager<IChartStoreState, IGetChartConfig> {
24
- static getInstance(): ChartCacheManager;
25
- protected getConfigPropertyName(): keyof IGetChartConfig;
26
- protected getStorePropertyName(): keyof IChartStoreState;
27
- protected buildStoreId({ chart_id, translated }: IGetChartConfig): string;
28
- protected createStore(): {
29
- state: IChartStoreState;
30
- onChange: OnChangeType;
31
- };
32
- protected fetchDataAndUpdateStore(state: IChartStoreState, config: IGetChartConfig): void;
33
- }
34
- export {};
@@ -1,43 +0,0 @@
1
- import { createStore } from "@stencil/store";
2
- import { QrveyCacheManager } from "./cache-manager";
3
- import ChartsApi from "../services/api/Charts.api";
4
- import { isEmpty } from "../general/mix/isEmpty";
5
- export class ChartCacheManager extends QrveyCacheManager {
6
- static getInstance() {
7
- if (!window.chartCacheManager) {
8
- window.chartCacheManager = new ChartCacheManager();
9
- }
10
- return window.chartCacheManager;
11
- }
12
- getConfigPropertyName() {
13
- return "chart_id";
14
- }
15
- getStorePropertyName() {
16
- return "chart";
17
- }
18
- buildStoreId({ chart_id, translated }) {
19
- const translate = isEmpty(translated) ? true : translated;
20
- return `${chart_id}-${translate ? "translated" : ""}`;
21
- }
22
- createStore() {
23
- return createStore({
24
- chart: null,
25
- loading: true,
26
- error: null,
27
- });
28
- }
29
- fetchDataAndUpdateStore(state, config) {
30
- const api = new ChartsApi(config);
31
- api
32
- .getChart(config)
33
- .then((chart) => {
34
- state.chart = chart;
35
- state.error = null;
36
- state.loading = false;
37
- })
38
- .catch((e) => {
39
- state.error = e;
40
- state.loading = false;
41
- });
42
- }
43
- }
@@ -1,27 +0,0 @@
1
- export type OnChangeType = (property: string | number | symbol, callback: (entity: unknown) => void) => () => void;
2
- export declare abstract class QrveyCacheManager<TStoreState, TConfig> {
3
- protected stores: Map<string, {
4
- state: TStoreState;
5
- onChange: OnChangeType;
6
- }>;
7
- protected abstract getConfigPropertyName(): keyof TConfig;
8
- protected abstract getStorePropertyName(): keyof TStoreState;
9
- protected abstract buildStoreId(config: TConfig): string;
10
- protected abstract fetchDataAndUpdateStore(state: TStoreState, config: TConfig): void;
11
- protected abstract createStore(): {
12
- state: TStoreState;
13
- onChange: OnChangeType;
14
- };
15
- protected getStoreFromPromise(config: TConfig, id: string): Promise<{
16
- state: TStoreState;
17
- onChange: OnChangeType;
18
- }>;
19
- getStore(config: TConfig): {
20
- state: TStoreState;
21
- onChange: OnChangeType;
22
- };
23
- getMultipleStores(config: TConfig, ids: string[]): Promise<{
24
- state: TStoreState;
25
- onChange: OnChangeType;
26
- }[]>;
27
- }
@@ -1,39 +0,0 @@
1
- export class QrveyCacheManager {
2
- constructor() {
3
- this.stores = new Map();
4
- }
5
- getStoreFromPromise(config, id) {
6
- return new Promise((resolve) => {
7
- const configProperty = this.getConfigPropertyName();
8
- const storeProperty = this.getStorePropertyName();
9
- const extendedConfig = Object.assign(Object.assign({}, config), { [configProperty]: id });
10
- const store = this.getStore(extendedConfig);
11
- if (store.state[storeProperty] !== null) {
12
- resolve(store);
13
- }
14
- else {
15
- const unsubscribe = store.onChange(storeProperty, (entity) => {
16
- if (entity !== null) {
17
- unsubscribe();
18
- resolve(store);
19
- }
20
- });
21
- }
22
- });
23
- }
24
- getStore(config) {
25
- const storeId = this.buildStoreId(config);
26
- const store = this.stores.get(storeId);
27
- if (store) {
28
- return store;
29
- }
30
- const { state, onChange } = store !== null && store !== void 0 ? store : this.createStore();
31
- this.stores.set(storeId, { state, onChange });
32
- this.fetchDataAndUpdateStore(state, config);
33
- return { state, onChange };
34
- }
35
- getMultipleStores(config, ids) {
36
- const promises = ids.map((id) => this.getStoreFromPromise(config, id));
37
- return Promise.all(promises);
38
- }
39
- }
@@ -1,34 +0,0 @@
1
- import { OnChangeType, QrveyCacheManager } from "./cache-manager";
2
- export interface IGetMetricConfig {
3
- qv_token?: string;
4
- api_key?: string;
5
- app_id?: string;
6
- user_id?: string;
7
- domain?: string;
8
- timezone?: any;
9
- qrvey_id?: string;
10
- i18n?: any;
11
- metric_id?: string;
12
- lang?: string;
13
- translated?: boolean;
14
- headers?: {
15
- "temporal-tokens"?: boolean;
16
- };
17
- }
18
- interface IMetricStoreState {
19
- metric: any;
20
- loading: boolean;
21
- error: any;
22
- }
23
- export declare class MetricCacheManager extends QrveyCacheManager<IMetricStoreState, IGetMetricConfig> {
24
- static getInstance(): MetricCacheManager;
25
- protected getConfigPropertyName(): keyof IGetMetricConfig;
26
- protected getStorePropertyName(): keyof IMetricStoreState;
27
- protected buildStoreId({ metric_id, translated }: IGetMetricConfig): string;
28
- protected createStore(): {
29
- state: IMetricStoreState;
30
- onChange: OnChangeType;
31
- };
32
- protected fetchDataAndUpdateStore(state: IMetricStoreState, config: IGetMetricConfig): void;
33
- }
34
- export {};
@@ -1,43 +0,0 @@
1
- import { createStore } from "@stencil/store";
2
- import { QrveyCacheManager } from "./cache-manager";
3
- import { isEmpty } from "../general/mix/isEmpty";
4
- import MetricPanelApi from "../services/api/metrics.api";
5
- export class MetricCacheManager extends QrveyCacheManager {
6
- static getInstance() {
7
- if (!window.metricCacheManager) {
8
- window.metricCacheManager = new MetricCacheManager();
9
- }
10
- return window.metricCacheManager;
11
- }
12
- getConfigPropertyName() {
13
- return "metric_id";
14
- }
15
- getStorePropertyName() {
16
- return "metric";
17
- }
18
- buildStoreId({ metric_id, translated }) {
19
- const translate = isEmpty(translated) ? true : translated;
20
- return `${metric_id}-${translate ? "translated" : ""}`;
21
- }
22
- createStore() {
23
- return createStore({
24
- metric: null,
25
- loading: true,
26
- error: null,
27
- });
28
- }
29
- fetchDataAndUpdateStore(state, config) {
30
- const api = new MetricPanelApi();
31
- api
32
- .getMetricConfig(config)
33
- .then((metric) => {
34
- state.metric = metric;
35
- state.error = null;
36
- state.loading = false;
37
- })
38
- .catch((e) => {
39
- state.error = e;
40
- state.loading = false;
41
- });
42
- }
43
- }
@@ -1,29 +0,0 @@
1
- import { OnChangeType, QrveyCacheManager } from "./cache-manager";
2
- import { IModel } from "../qrvey";
3
- interface IGetModelConfig {
4
- qv_token?: string;
5
- api_key?: string;
6
- app_id?: string;
7
- user_id?: string;
8
- domain?: string;
9
- timezone?: any;
10
- qrvey_id: string;
11
- i18n?: any;
12
- }
13
- interface IModelStoreState {
14
- model: IModel;
15
- loading: boolean;
16
- error: any;
17
- }
18
- export declare class ModelCacheManager extends QrveyCacheManager<IModelStoreState, IGetModelConfig> {
19
- static getInstance(): ModelCacheManager;
20
- protected getConfigPropertyName(): keyof IGetModelConfig;
21
- protected getStorePropertyName(): keyof IModelStoreState;
22
- protected buildStoreId({ qrvey_id }: IGetModelConfig): string;
23
- protected createStore(): {
24
- state: IModelStoreState;
25
- onChange: OnChangeType;
26
- };
27
- protected fetchDataAndUpdateStore(state: IModelStoreState, config: IGetModelConfig): void;
28
- }
29
- export {};