@quidgest/ui 0.20.0 → 0.21.0

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 (145) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/README.md +10 -0
  3. package/dist/json/api.json +312 -14
  4. package/dist/manifest/components.json +1 -0
  5. package/dist/ui.css +245 -248
  6. package/dist/ui.esm.js +805 -683
  7. package/dist/ui.js +1083 -961
  8. package/dist/ui.min.css +1 -1
  9. package/dist/ui.min.js +1083 -961
  10. package/dist/ui.scss +535 -299
  11. package/esm/components/QAccordion/QAccordionItem.vue.js +1 -1
  12. package/esm/components/QBadge/QBadge.d.ts.map +1 -1
  13. package/esm/components/QBadge/QBadge.vue.js +20 -24
  14. package/esm/components/QButton/QButton.d.ts.map +1 -1
  15. package/esm/components/QButton/QButton.vue.js +32 -29
  16. package/esm/components/QCheckbox/QCheckbox.vue.js +1 -1
  17. package/esm/components/QDialog/QDialog.d.ts +4 -2
  18. package/esm/components/QDialog/QDialog.d.ts.map +1 -1
  19. package/esm/components/QDialog/QDialog.vue.js +84 -74
  20. package/esm/components/QDialog/QDialogProvider.d.ts.map +1 -1
  21. package/esm/components/QDialog/QDialogProvider.vue.js +21 -12
  22. package/esm/components/QDialog/index.d.ts +72 -3
  23. package/esm/components/QDialog/index.d.ts.map +1 -1
  24. package/esm/components/QDialog/types.d.ts +10 -1
  25. package/esm/components/QDialog/types.d.ts.map +1 -1
  26. package/esm/components/QDismissibleLayer/QDismissibleLayer.d.ts.map +1 -1
  27. package/esm/components/QDismissibleLayer/QDismissibleLayer.vue.js +9 -8
  28. package/esm/components/QDivider/QDivider.d.ts.map +1 -1
  29. package/esm/components/QDivider/QDivider.vue.js +3 -3
  30. package/esm/components/QFileUpload/QFileUpload.vue.js +1 -1
  31. package/esm/components/QGauge/QGauge.d.ts +56 -0
  32. package/esm/components/QGauge/QGauge.d.ts.map +1 -0
  33. package/esm/components/QGauge/QGauge.vue.js +305 -0
  34. package/esm/components/QGauge/QGauge2.vue.js +5 -0
  35. package/esm/components/QGauge/constants.d.ts +6 -0
  36. package/esm/components/QGauge/constants.d.ts.map +1 -0
  37. package/esm/components/QGauge/constants.js +8 -0
  38. package/esm/components/QGauge/index.d.ts +124 -0
  39. package/esm/components/QGauge/index.d.ts.map +1 -0
  40. package/esm/components/QGauge/index.js +6 -0
  41. package/esm/components/QGauge/types.d.ts +146 -0
  42. package/esm/components/QGauge/types.d.ts.map +1 -0
  43. package/esm/components/QList/QListItem.d.ts.map +1 -1
  44. package/esm/components/QList/QListItem.vue.js +5 -2
  45. package/esm/components/QList/QListItemGroup.vue.js +1 -1
  46. package/esm/components/QObfuscation/QObfuscation.vue.js +1 -1
  47. package/esm/components/QPhoneField/QPhoneField.d.ts.map +1 -1
  48. package/esm/components/QPhoneField/QPhoneField.vue.js +1 -1
  49. package/esm/components/QPropertyList/QPropertyListGroup.vue.js +1 -1
  50. package/esm/components/QPropertyList/QPropertyListRow.vue.js +1 -1
  51. package/esm/components/QPropertyList/index.d.ts.map +1 -1
  52. package/esm/components/QRadioGroup/QRadioButton.vue.js +1 -1
  53. package/esm/components/QRadioGroup/QRadioGroup.vue.js +2 -2
  54. package/esm/components/QSelect/QSelect.d.ts.map +1 -1
  55. package/esm/components/QSelect/QSelect.vue.js +1 -1
  56. package/esm/components/QSidebar/QSidebar.d.ts.map +1 -1
  57. package/esm/components/QSidebar/QSidebar.vue.js +19 -10
  58. package/esm/components/QSidebar/QSidebarItem.d.ts.map +1 -1
  59. package/esm/components/QSidebar/QSidebarItem.vue.js +51 -49
  60. package/esm/components/QSidebar/context.d.ts +7 -0
  61. package/esm/components/QSidebar/context.d.ts.map +1 -1
  62. package/esm/components/QSwitch/QSwitch.vue.js +1 -1
  63. package/esm/components/QTabs/QTab.d.ts.map +1 -1
  64. package/esm/components/QTabs/QTab.vue.js +52 -50
  65. package/esm/components/QTabs/QTabs.d.ts.map +1 -1
  66. package/esm/components/QTabs/QTabs.vue.js +37 -12
  67. package/esm/components/QTabs/context.d.ts +7 -0
  68. package/esm/components/QTabs/context.d.ts.map +1 -1
  69. package/esm/components/QTextArea/QTextArea.vue.js +1 -1
  70. package/esm/components/QTextField/QTextField.d.ts.map +1 -1
  71. package/esm/components/QTextField/QTextField.vue.js +1 -1
  72. package/esm/components/QThemeProvider/QThemeProvider.vue.js +1 -1
  73. package/esm/components/QToast/QToast.d.ts +4 -2
  74. package/esm/components/QToast/QToast.d.ts.map +1 -1
  75. package/esm/components/QToast/QToast.vue.js +80 -67
  76. package/esm/components/QToast/QToaster.d.ts.map +1 -1
  77. package/esm/components/QToast/QToaster.vue.js +21 -16
  78. package/esm/components/QToast/index.d.ts +39 -3
  79. package/esm/components/QToast/index.d.ts.map +1 -1
  80. package/esm/components/QToast/types.d.ts +6 -2
  81. package/esm/components/QToast/types.d.ts.map +1 -1
  82. package/esm/components/QToggleGroup/QToggleGroupItem.vue.js +1 -1
  83. package/esm/components/QTooltip/QTooltip.vue.js +1 -1
  84. package/esm/components/index.d.ts +1 -0
  85. package/esm/components/index.d.ts.map +1 -1
  86. package/esm/components/index.js +64 -62
  87. package/esm/composables/index.d.ts +2 -2
  88. package/esm/composables/index.d.ts.map +1 -1
  89. package/esm/composables/useColor/index.d.ts +49 -12
  90. package/esm/composables/useColor/index.d.ts.map +1 -1
  91. package/esm/composables/useColor/index.js +56 -30
  92. package/esm/composables/useColor/types.d.ts +4 -1
  93. package/esm/composables/useColor/types.d.ts.map +1 -1
  94. package/esm/composables/useDialog/_internal.d.ts +2 -0
  95. package/esm/composables/useDialog/_internal.d.ts.map +1 -0
  96. package/esm/composables/useDialog/_internal.js +65 -0
  97. package/esm/composables/useDialog/index.d.ts +11 -3
  98. package/esm/composables/useDialog/index.d.ts.map +1 -1
  99. package/esm/composables/useDialog/index.js +38 -22
  100. package/esm/composables/useDialog/types.d.ts +25 -11
  101. package/esm/composables/useDialog/types.d.ts.map +1 -1
  102. package/esm/composables/useDismissibleLayerStack/index.d.ts +17 -2
  103. package/esm/composables/useDismissibleLayerStack/index.d.ts.map +1 -1
  104. package/esm/composables/useDismissibleLayerStack/index.js +28 -11
  105. package/esm/composables/useGroup/index.d.ts.map +1 -1
  106. package/esm/composables/useGroup/index.js +12 -1
  107. package/esm/composables/useId/index.d.ts +18 -0
  108. package/esm/composables/useId/index.d.ts.map +1 -0
  109. package/esm/composables/useId/index.js +10 -0
  110. package/esm/composables/useToast/_internal.d.ts +2 -0
  111. package/esm/composables/useToast/_internal.d.ts.map +1 -0
  112. package/esm/composables/useToast/_internal.js +142 -0
  113. package/esm/composables/useToast/index.d.ts +8 -25
  114. package/esm/composables/useToast/index.d.ts.map +1 -1
  115. package/esm/composables/useToast/index.js +29 -26
  116. package/esm/composables/useToast/types.d.ts +31 -17
  117. package/esm/composables/useToast/types.d.ts.map +1 -1
  118. package/esm/framework.d.ts.map +1 -1
  119. package/esm/framework.js +16 -12
  120. package/esm/index.d.ts +1 -0
  121. package/esm/templates/theme.js +39 -39
  122. package/esm/utils/color/contrast.d.ts +11 -4
  123. package/esm/utils/color/contrast.d.ts.map +1 -1
  124. package/esm/utils/color/contrast.js +16 -3
  125. package/esm/utils/color/index.d.ts +1 -0
  126. package/esm/utils/color/index.d.ts.map +1 -1
  127. package/esm/utils/color/merge.d.ts +9 -0
  128. package/esm/utils/color/merge.d.ts.map +1 -1
  129. package/esm/utils/color/merge.js +21 -22
  130. package/esm/utils/color/parse.d.ts +21 -5
  131. package/esm/utils/color/parse.d.ts.map +1 -1
  132. package/esm/utils/color/parse.js +88 -20
  133. package/esm/utils/color/theme-colors.d.ts +35 -0
  134. package/esm/utils/color/theme-colors.d.ts.map +1 -0
  135. package/esm/utils/color/theme-colors.js +25 -0
  136. package/esm/utils/index.js +50 -42
  137. package/package.json +3 -5
  138. package/esm/composables/uid.d.ts +0 -9
  139. package/esm/composables/uid.d.ts.map +0 -1
  140. package/esm/composables/uid.js +0 -8
  141. package/esm/composables/useToast/types.js +0 -4
  142. package/esm/vendors/uuid/dist/native.js +0 -3
  143. package/esm/vendors/uuid/dist/rng.js +0 -11
  144. package/esm/vendors/uuid/dist/stringify.js +0 -8
  145. package/esm/vendors/uuid/dist/v4.js +0 -20
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,aAAa,CAAyB,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAA;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,KAAK,EAAE,WAAW,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC5C;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAEjD;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAO,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AA+H1D;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX;;OAEG;IACH,KAAK,EAAE,WAAW,CAAA;CAClB,CAAA;AAoBD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAA;IAEhC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAE7C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE7B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,qBAAqB,CAAA;AAMrE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEtC,gFAAgF;IAChF,MAAM,CAAC,EAAE,SAAS,CAAA;IAElB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,eAAoB,GAAG,MAAM,CAwBpE"}
1
+ {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,qBAAqB,CAAA;AAMrE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEtC,gFAAgF;IAChF,MAAM,CAAC,EAAE,SAAS,CAAA;IAElB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,eAAoB,GAAG,MAAM,CA2BpE"}
package/esm/framework.js CHANGED
@@ -4,21 +4,21 @@ import { createThemeInstance as r, generateRootStyle as i } from "./utils/theme.
4
4
  import { ThemeSymbol as a } from "./composables/theme.js";
5
5
  import { DismissibleLayerKey as o } from "./symbols/dismissibleLayer.js";
6
6
  import { useDismissibleLayerStack as s } from "./composables/useDismissibleLayerStack/index.js";
7
- import { ToastSymbol as c } from "./composables/useToast/types.js";
8
- import { createToastInstance as l } from "./composables/useToast/index.js";
9
- import { ref as u, watch as d } from "vue";
7
+ import { DialogSymbol as c, createDialogInstance as l } from "./composables/useDialog/_internal.js";
8
+ import { ToastSymbol as u, createToastInstance as d } from "./composables/useToast/_internal.js";
9
+ import { ref as f, watch as p } from "vue";
10
10
  //#region src/framework.ts
11
- function f(e = {}) {
11
+ function m(e = {}) {
12
12
  return { install: (t) => {
13
13
  let r = e.components || {};
14
14
  for (let e in r) t.component(e, r[e]);
15
15
  let i = e.defaults || {};
16
- t.provide(n, u(i)), p(t, e.themes);
16
+ t.provide(n, f(i)), h(t, e.themes);
17
17
  let a = s();
18
- t.provide(o, a), m(t);
18
+ t.provide(o, a), g(t), _(t);
19
19
  } };
20
20
  }
21
- function p(n, o) {
21
+ function h(n, o) {
22
22
  let s = [], c;
23
23
  if (o) for (let n of o.themes) {
24
24
  let r = {
@@ -44,17 +44,21 @@ function p(n, o) {
44
44
  s.push(...n), c = "light";
45
45
  }
46
46
  if (c) {
47
- let e = r(u(c), u(s));
48
- i(s), d(e.class, h, { immediate: !0 }), n.provide(a, e);
47
+ let e = r(f(c), f(s));
48
+ i(s), p(e.class, v, { immediate: !0 }), n.provide(a, e);
49
49
  }
50
50
  }
51
- function m(e) {
51
+ function g(e) {
52
+ let t = d();
53
+ e.provide(u, t);
54
+ }
55
+ function _(e) {
52
56
  let t = l();
53
57
  e.provide(c, t);
54
58
  }
55
- function h(e) {
59
+ function v(e) {
56
60
  let t = document.documentElement;
57
61
  t.className = Array.from(t.classList).filter((e) => !e.startsWith("q-theme")).join(" "), t.classList.add(e);
58
62
  }
59
63
  //#endregion
60
- export { f as createFramework };
64
+ export { m as createFramework };
package/esm/index.d.ts CHANGED
@@ -32,6 +32,7 @@ declare module '@vue/runtime-core' {
32
32
  QField: typeof import('@quidgest/ui/components')['QField']
33
33
  QFileUpload: typeof import('@quidgest/ui/components')['QFileUpload']
34
34
  QFocusWrap: typeof import('@quidgest/ui/components')['QFocusWrap']
35
+ QGauge: typeof import('@quidgest/ui/components')['QGauge']
35
36
  QCol: typeof import('@quidgest/ui/components')['QCol']
36
37
  QContainer: typeof import('@quidgest/ui/components')['QContainer']
37
38
  QRow: typeof import('@quidgest/ui/components')['QRow']
@@ -1,56 +1,56 @@
1
1
  //#region src/templates/theme.ts
2
2
  var e = {
3
3
  primary: "#008ad2",
4
- primaryLight: "#cde5ff",
5
- primaryDark: "#006398",
4
+ primaryLight: "#b4e5ff",
5
+ primaryDark: "#00669d",
6
6
  secondary: "#001d31",
7
7
  secondaryLight: "#e6eef3",
8
8
  secondaryDark: "#001425",
9
9
  highlight: "#ff8241",
10
- highlightLight: "#ffe4d6",
11
- highlightDark: "#cc4700",
10
+ highlightLight: "#ffe0d0",
11
+ highlightDark: "#f15400",
12
12
  info: "#17a2b8",
13
13
  infoLight: "#bceff7",
14
- infoDark: "#11798a",
14
+ infoDark: "#117b8c",
15
15
  success: "#28a745",
16
16
  successLight: "#c2f0cd",
17
- successDark: "#1e7d34",
17
+ successDark: "#1f7e35",
18
18
  warning: "#ffa900",
19
19
  warningLight: "#ffeabf",
20
- warningDark: "#bf7f00",
20
+ warningDark: "#bf8000",
21
21
  danger: "#b71c1c",
22
- dangerLight: "#f7cccc",
23
- dangerDark: "#891515",
22
+ dangerLight: "#f5bebe",
23
+ dangerDark: "#881515",
24
24
  background: "#fff",
25
25
  container: "#fff",
26
- neutral: "#7c858d",
27
- neutralLight: "#c4c5ca",
28
- neutralDark: "#40474f",
29
- onPrimary: "#fff",
30
- onPrimaryLight: "#202428",
26
+ neutral: "#6d767f",
27
+ neutralLight: "#dadddf",
28
+ neutralDark: "#51585f",
29
+ onPrimary: "#000",
30
+ onPrimaryLight: "#000",
31
31
  onPrimaryDark: "#fff",
32
32
  onSecondary: "#fff",
33
- onSecondaryLight: "#202428",
33
+ onSecondaryLight: "#000",
34
34
  onSecondaryDark: "#fff",
35
- onHighlight: "#fff",
36
- onHighlightLight: "#202428",
37
- onHighlightDark: "#fff",
38
- onInfo: "#fff",
39
- onInfoLight: "#202428",
35
+ onHighlight: "#000",
36
+ onHighlightLight: "#000",
37
+ onHighlightDark: "#000",
38
+ onInfo: "#000",
39
+ onInfoLight: "#000",
40
40
  onInfoDark: "#fff",
41
- onSuccess: "#fff",
42
- onSuccessLight: "#202428",
41
+ onSuccess: "#000",
42
+ onSuccessLight: "#000",
43
43
  onSuccessDark: "#fff",
44
- onWarning: "#fff",
45
- onWarningLight: "#202428",
46
- onWarningDark: "#fff",
44
+ onWarning: "#000",
45
+ onWarningLight: "#000",
46
+ onWarningDark: "#000",
47
47
  onDanger: "#fff",
48
- onDangerLight: "#202428",
48
+ onDangerLight: "#000",
49
49
  onDangerDark: "#fff",
50
- onBackground: "#202428",
51
- onContainer: "#202428",
50
+ onBackground: "#000",
51
+ onContainer: "#000",
52
52
  onNeutral: "#fff",
53
- onNeutralLight: "#202428",
53
+ onNeutralLight: "#000",
54
54
  onNeutralDark: "#fff"
55
55
  }, t = {
56
56
  primary: "#4da6e0",
@@ -80,30 +80,30 @@ var e = {
80
80
  neutralLight: "#2a2d31",
81
81
  neutralDark: "#c8ced6",
82
82
  onPrimary: "#000",
83
- onPrimaryLight: "#e0e0e0",
83
+ onPrimaryLight: "#fff",
84
84
  onPrimaryDark: "#000",
85
85
  onSecondary: "#000",
86
- onSecondaryLight: "#e0e0e0",
86
+ onSecondaryLight: "#fff",
87
87
  onSecondaryDark: "#000",
88
88
  onHighlight: "#000",
89
- onHighlightLight: "#e0e0e0",
89
+ onHighlightLight: "#fff",
90
90
  onHighlightDark: "#000",
91
91
  onInfo: "#000",
92
- onInfoLight: "#e0e0e0",
92
+ onInfoLight: "#fff",
93
93
  onInfoDark: "#000",
94
94
  onSuccess: "#000",
95
- onSuccessLight: "#e0e0e0",
95
+ onSuccessLight: "#fff",
96
96
  onSuccessDark: "#000",
97
97
  onWarning: "#000",
98
- onWarningLight: "#e0e0e0",
98
+ onWarningLight: "#fff",
99
99
  onWarningDark: "#000",
100
100
  onDanger: "#000",
101
- onDangerLight: "#e0e0e0",
101
+ onDangerLight: "#fff",
102
102
  onDangerDark: "#000",
103
- onBackground: "#e0e0e0",
104
- onContainer: "#e0e0e0",
103
+ onBackground: "#fff",
104
+ onContainer: "#fff",
105
105
  onNeutral: "#000",
106
- onNeutralLight: "#e0e0e0",
106
+ onNeutralLight: "#fff",
107
107
  onNeutralDark: "#000"
108
108
  };
109
109
  //#endregion
@@ -1,11 +1,18 @@
1
+ import { RGB } from './types';
1
2
  /**
2
- * Determines a contrasting color (black or white) based on the given luminance.
3
- * Useful for ensuring text readability against a background color with the given luminance.
3
+ * Calculates the WCAG 2.x relative luminance for an sRGB color.
4
4
  *
5
- * @param luminance - The luminance value (between 0 and 100) of the background color.
5
+ * @param rgb - The color in RGB space.
6
+ * @returns Relative luminance between 0 and 1.
7
+ */
8
+ export declare function getRelativeLuminance(rgb: RGB): number;
9
+ /**
10
+ * Determines a contrasting color (black or white) based on WCAG relative luminance.
11
+ *
12
+ * @param rgb - The background color in RGB space.
6
13
  * @returns A hex string representing either black ('#000') or white ('#fff').
7
14
  */
8
- export declare function getContrastingColor(luminance: number): '#000' | '#fff';
15
+ export declare function getContrastingColor(rgb: RGB): '#000' | '#fff';
9
16
  /**
10
17
  * Calculates the complementary color for a given color string.
11
18
  * The complementary color is the color directly opposite on the color wheel,
@@ -1 +1 @@
1
- {"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../../src/utils/color/contrast.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAMtE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW3D"}
1
+ {"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../../src/utils/color/contrast.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAiBlC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAMrD;AAgBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAM7D;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ3D"}
@@ -2,11 +2,24 @@ import { rgbToHex as e } from "./conversion.js";
2
2
  import { parseColor as t } from "./parse.js";
3
3
  //#region src/utils/color/contrast.ts
4
4
  function n(e) {
5
- return e > 50 ? "#000" : "#fff";
5
+ let t = e / 255;
6
+ return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
6
7
  }
7
- function r(n) {
8
+ function r(e) {
9
+ let t = n(e.r), r = n(e.g), i = n(e.b);
10
+ return .2126 * t + .7152 * r + .0722 * i;
11
+ }
12
+ function i(e, t) {
13
+ let n = Math.max(e, t), r = Math.min(e, t);
14
+ return (n + .05) / (r + .05);
15
+ }
16
+ function a(e) {
17
+ let t = r(e), n = i(t, 0);
18
+ return i(t, 1) >= n ? "#fff" : "#000";
19
+ }
20
+ function o(n) {
8
21
  let r = t(n);
9
22
  return r.r = 255 - r.r, r.g = 255 - r.g, r.b = 255 - r.b, e(r);
10
23
  }
11
24
  //#endregion
12
- export { r as getComplementaryColor, n as getContrastingColor };
25
+ export { o as getComplementaryColor, a as getContrastingColor, r as getRelativeLuminance };
@@ -3,5 +3,6 @@ export * from './conversion';
3
3
  export * from './manipulate';
4
4
  export * from './merge';
5
5
  export * from './parse';
6
+ export * from './theme-colors';
6
7
  export * from './types';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/color/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/color/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA"}
@@ -1,4 +1,13 @@
1
1
  import { ColorScheme } from './types';
2
+ /**
3
+ * Amount passed to {@link lighten} when auto-generating scheme `*Light` variants.
4
+ */
5
+ export declare const COLOR_SCHEME_LIGHTEN_AMOUNT = 75;
6
+ /**
7
+ * Amount passed to {@link darken} when auto-generating scheme `*Dark` variants
8
+ * (and `useColor` hover fallback when no scheme `*Dark` token applies).
9
+ */
10
+ export declare const COLOR_SCHEME_DARKEN_AMOUNT = 25;
2
11
  /**
3
12
  * Merges two color schemes, generating color variants and contrasting text colors as needed.
4
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/utils/color/merge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,SAAS,CAAA;AAQ3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAkGtF"}
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/utils/color/merge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,SAAS,CAAA;AAQ3D;;GAEG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAE5C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAiGtF"}
@@ -1,17 +1,16 @@
1
- import { rgbToHex as e, rgbToHsl as t } from "./conversion.js";
2
- import { parseColor as n } from "./parse.js";
3
- import { getComplementaryColor as r, getContrastingColor as i } from "./contrast.js";
4
- import { darken as a, lighten as o } from "./manipulate.js";
5
- //#region src/utils/color/merge.ts
6
- function s(s, c) {
7
- let l = { ...s }, u = (t, r) => {
8
- let i = n(t), s = e(o(i, 85)), c = e(a(i, 25)), l = r.toString().replace(/(Light|Dark)$/, "");
1
+ import { rgbToHex as e } from "./conversion.js";
2
+ import { parseColor as t } from "./parse.js";
3
+ import { getComplementaryColor as n, getContrastingColor as r } from "./contrast.js";
4
+ import { darken as i, lighten as a } from "./manipulate.js";
5
+ function o(o, s) {
6
+ let c = { ...o }, l = (n, r) => {
7
+ let o = t(n), s = e(a(o, 75)), c = e(i(o, 25)), l = r.toString().replace(/(Light|Dark)$/, "");
9
8
  return {
10
- [l]: t,
9
+ [l]: n,
11
10
  [`${l}Light`]: s,
12
11
  [`${l}Dark`]: c
13
12
  };
14
- }, d = (e) => i(t(n(e)).l);
13
+ }, u = (e) => r(t(e));
15
14
  for (let e of [
16
15
  "primary",
17
16
  "secondary",
@@ -23,22 +22,22 @@ function s(s, c) {
23
22
  "neutral"
24
23
  ]) {
25
24
  let t = e, n = `${e}Light`, r = `${e}Dark`, i = `on${e.charAt(0).toUpperCase() + e.slice(1)}`, a = `on${e.charAt(0).toUpperCase() + e.slice(1)}Light`, o = `on${e.charAt(0).toUpperCase() + e.slice(1)}Dark`;
26
- if (c[t]) {
27
- let e = u(c[t], t);
28
- Object.assign(l, e), l[i] = d(c[t]), l[a] = d(e[n]), l[o] = d(e[r]);
25
+ if (s[t]) {
26
+ let e = l(s[t], t);
27
+ Object.assign(c, e), c[i] = u(s[t]), c[a] = u(e[n]), c[o] = u(e[r]);
29
28
  }
30
- c[t] || (c[n] && (l[n] = c[n], c[a] || (l[a] = d(c[n]))), c[r] && (l[r] = c[r], c[o] || (l[o] = d(c[r])))), c[i] && (l[i] = c[i]), c[a] && (l[a] = c[a]), c[o] && (l[o] = c[o]);
29
+ s[t] || (s[n] && (c[n] = s[n], s[a] || (c[a] = u(s[n]))), s[r] && (c[r] = s[r], s[o] || (c[o] = u(s[r])))), s[i] && (c[i] = s[i]), s[a] && (c[a] = s[a]), s[o] && (c[o] = s[o]);
31
30
  }
32
- if (c.primary && !c.highlight) {
33
- let e = r(c.primary), t = u(e, "highlight");
34
- Object.assign(l, t), l.onHighlight = d(e), l.onHighlightLight = d(t.highlightLight), l.onHighlightDark = d(t.highlightDark);
31
+ if (s.primary && !s.highlight) {
32
+ let e = n(s.primary), t = l(e, "highlight");
33
+ Object.assign(c, t), c.onHighlight = u(e), c.onHighlightLight = u(t.highlightLight), c.onHighlightDark = u(t.highlightDark);
35
34
  }
36
- for (let e of ["background", "container"]) if (c[e]) {
37
- l[e] = c[e];
35
+ for (let e of ["background", "container"]) if (s[e]) {
36
+ c[e] = s[e];
38
37
  let t = `on${e.charAt(0).toUpperCase() + e.slice(1)}`;
39
- c[t] || (l[t] = d(c[e]));
38
+ s[t] || (c[t] = u(s[e]));
40
39
  }
41
- return c.onBackground && (l.onBackground = c.onBackground), c.onContainer && (l.onContainer = c.onContainer), l;
40
+ return s.onBackground && (c.onBackground = s.onBackground), s.onContainer && (c.onContainer = s.onContainer), c;
42
41
  }
43
42
  //#endregion
44
- export { s as mergeColorSchemes };
43
+ export { o as mergeColorSchemes };
@@ -2,23 +2,39 @@ import { RGB } from './types';
2
2
  /**
3
3
  * Checks if the given string represents a valid hexadecimal color code.
4
4
  *
5
+ * When `enforceSixChars` is false, accepts `#rgb`, `#rrggbb`, and `#rrggbbaa`
6
+ * (aligned with {@link tryParseColor} / hex parsing). When true, only `#rrggbb`.
7
+ *
5
8
  * @param hexColorCode - The color code to validate.
6
9
  * @param enforceSixChars - Whether to enforce only the 6-character format (default is false).
7
10
  * @returns True if the color code is valid, false otherwise.
8
11
  */
9
12
  export declare function isValidHex(hexColorCode: string, enforceSixChars?: boolean): boolean;
10
13
  /**
11
- * Tries to parse a string in the format 'rgb(r, g, b)' to an RGB object.
14
+ * Tries to parse an `rgb()` or `rgba()` color string to an RGB object.
15
+ *
16
+ * Supports comma-separated and modern space-separated syntax. Alpha is ignored.
12
17
  *
13
- * @param tr The input string to parse, expected in the format 'rgb(r, g, b)'.
14
- * @returns An object containing parsed RGB values if the input string is valid, otherwise undefined.
18
+ * @param str - The input string to parse.
19
+ * @returns Parsed RGB values when valid, otherwise undefined.
15
20
  */
16
21
  export declare function tryParseRgb(str: string): RGB | undefined;
17
22
  /**
18
- * Parses a color from a hex string.
23
+ * Attempts to parse a color string into an RGB object without throwing.
24
+ *
25
+ * Supports hex (`#rgb`, `#rrggbb`, `#rrggbbaa`), `rgb`/`rgba`, and `hsl`/`hsla`.
26
+ * Alpha channels are ignored.
27
+ *
28
+ * @param color - A CSS color string.
29
+ * @returns The parsed RGB object, or undefined when parsing fails.
30
+ */
31
+ export declare function tryParseColor(color: string): RGB | undefined;
32
+ /**
33
+ * Parses a supported CSS color string.
19
34
  *
20
- * @param color A hex string representing the color, e.g., "#aabbcc".
35
+ * @param color - A CSS color string, e.g. `#aabbcc` or `rgb(170, 187, 204)`.
21
36
  * @returns A `RGB` object representing the parsed color.
37
+ * @throws {Error} When the color format is not supported.
22
38
  */
23
39
  export declare function parseColor(color: string): RGB;
24
40
  //# sourceMappingURL=parse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/utils/color/parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,GAAE,OAAe,GAAG,OAAO,CAQ1F;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CASxD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAkB7C"}
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/utils/color/parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AASlC;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,GAAE,OAAe,GAAG,OAAO,CAQ1F;AAuMD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAExD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAS5D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAQ7C"}
@@ -1,26 +1,94 @@
1
+ import { hslToRgb as e } from "./conversion.js";
1
2
  //#region src/utils/color/parse.ts
2
- function e(e, t = !1) {
3
- return t ? /^#[a-fA-F0-9]{6}$/.test(e) : /^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(e);
4
- }
5
- function t(e) {
6
- let t = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
7
- if (t) return {
8
- r: parseInt(t[1], 10),
9
- g: parseInt(t[2], 10),
10
- b: parseInt(t[3], 10)
11
- };
3
+ var t = /^#([a-fA-F0-9]{3})$/, n = /^#([a-fA-F0-9]{6})$/, r = /^#([a-fA-F0-9]{8})$/;
4
+ function i(e, i = !1) {
5
+ return i ? n.test(e) : t.test(e) || n.test(e) || r.test(e);
6
+ }
7
+ function a(e) {
8
+ return Math.max(0, Math.min(255, Math.round(e)));
12
9
  }
13
- function n(n) {
14
- if (e(n)) return n.length === 4 && (n = "#" + n[1] + n[1] + n[2] + n[2] + n[3] + n[3]), {
15
- r: parseInt(n.slice(1, 3), 16),
16
- g: parseInt(n.slice(3, 5), 16),
17
- b: parseInt(n.slice(5, 7), 16)
10
+ function o(e) {
11
+ return {
12
+ r: parseInt(e.slice(0, 2), 16),
13
+ g: parseInt(e.slice(2, 4), 16),
14
+ b: parseInt(e.slice(4, 6), 16)
18
15
  };
19
- {
20
- let e = t(n);
21
- if (e) return e;
16
+ }
17
+ function s(e) {
18
+ if (t.test(e)) return o(("#" + e[1] + e[1] + e[2] + e[2] + e[3] + e[3]).slice(1));
19
+ if (n.test(e)) return o(e.slice(1));
20
+ if (r.test(e)) return o(e.slice(1, 7));
21
+ }
22
+ function c(e) {
23
+ let t = e.trim(), n = t.match(/^(-?\d*\.?\d+)%$/);
24
+ if (n) {
25
+ let e = Number.parseFloat(n[1]);
26
+ return Number.isNaN(e) ? void 0 : a(e / 100 * 255);
22
27
  }
23
- throw Error("Invalid color format");
28
+ let r = t.match(/^(-?\d*\.?\d+)$/);
29
+ if (!r) return;
30
+ let i = Number.parseFloat(r[1]);
31
+ if (!Number.isNaN(i)) return a(i);
32
+ }
33
+ function l(e) {
34
+ let t = e.trim().toLowerCase().match(/^(-?\d*\.?\d+)(deg)?$/);
35
+ if (!t) return;
36
+ let n = Number.parseFloat(t[1]);
37
+ if (!Number.isNaN(n)) return (n % 360 + 360) % 360;
38
+ }
39
+ function u(e) {
40
+ let t = e.trim();
41
+ if (!t.endsWith("%")) return;
42
+ let n = Number.parseFloat(t.slice(0, -1));
43
+ if (!Number.isNaN(n)) return Math.max(0, Math.min(100, n));
44
+ }
45
+ function d(e) {
46
+ let t = e.match(/^rgba?\(([^)]+)\)$/i);
47
+ if (!t) return;
48
+ let n = t[1].split("/")[0].split(",").map((e) => e.trim()).filter(Boolean);
49
+ if (n.length < 3) return;
50
+ let r = c(n[0]), i = c(n[1]), a = c(n[2]);
51
+ if (!(r === void 0 || i === void 0 || a === void 0)) return {
52
+ r,
53
+ g: i,
54
+ b: a
55
+ };
56
+ }
57
+ function f(e) {
58
+ let t = e.match(/^rgba?\(([^)]+)\)$/i);
59
+ if (!t) return;
60
+ let [n] = t[1].split("/"), r = n.trim().split(/\s+/).filter(Boolean);
61
+ if (r.length !== 3) return;
62
+ let i = c(r[0]), a = c(r[1]), o = c(r[2]);
63
+ if (!(i === void 0 || a === void 0 || o === void 0)) return {
64
+ r: i,
65
+ g: a,
66
+ b: o
67
+ };
68
+ }
69
+ function p(t) {
70
+ let n = t.match(/^hsla?\(([^)]+)\)$/i);
71
+ if (!n) return;
72
+ let [r] = n[1].split("/"), i = r.includes(",") ? "," : /\s+/, a = r.split(i).map((e) => e.trim()).filter(Boolean);
73
+ if (a.length < 3) return;
74
+ let o = l(a[0]), s = u(a[1]), c = u(a[2]);
75
+ if (!(o === void 0 || s === void 0 || c === void 0)) return e({
76
+ h: o,
77
+ s,
78
+ l: c
79
+ });
80
+ }
81
+ function m(e) {
82
+ return d(e) ?? f(e);
83
+ }
84
+ function h(e) {
85
+ let t = e.trim();
86
+ return s(t) ?? d(t) ?? f(t) ?? p(t);
87
+ }
88
+ function g(e) {
89
+ let t = h(e);
90
+ if (!t) throw Error("Invalid color format");
91
+ return t;
24
92
  }
25
93
  //#endregion
26
- export { e as isValidHex, n as parseColor, t as tryParseRgb };
94
+ export { i as isValidHex, g as parseColor, h as tryParseColor, m as tryParseRgb };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Theme utility color keys used for BEM classification via `isThemeColor` /
3
+ * `isUtilityColor`.
4
+ *
5
+ * Brand/semantic keys match the historical `$theme-colors` SCSS map. Color CSS
6
+ * vars for QButton / QBadge / QToast come from bound `useColor` styles rather
7
+ * than `$theme-colors` BEM loops. `background` remains a utility key so QButton
8
+ * can apply its hand-written `--background` modifier (and skip inline vars for
9
+ * that color). `container` is omitted (scheme resolve only).
10
+ */
11
+ export declare const THEME_COLOR_KEYS: readonly ["primary", "secondary", "highlight", "info", "success", "warning", "danger", "neutral", "background"];
12
+ /**
13
+ * A theme utility color key that resolves against the active color scheme.
14
+ */
15
+ export type ThemeColorKey = (typeof THEME_COLOR_KEYS)[number];
16
+ /**
17
+ * Checks whether a color string is a theme utility color key.
18
+ *
19
+ * Does not trim: BEM consumers build classes from the raw prop
20
+ * (`q-button--${color}`), so padded keys must not be classified as utilities
21
+ * or the modifier class would miss while the prop still looks theme-like.
22
+ *
23
+ * @param color - The color value to check.
24
+ * @returns True when the value matches a key in {@link THEME_COLOR_KEYS}.
25
+ */
26
+ export declare function isThemeColor(color: string): color is ThemeColorKey;
27
+ /**
28
+ * Checks whether a color string is an unsupported CSS keyword or function
29
+ * that cannot be resolved by `useColor`.
30
+ *
31
+ * @param color - The color value to check.
32
+ * @returns True for `transparent`, `currentColor`, `inherit`, and `var(...)`.
33
+ */
34
+ export declare function isUnsupportedColor(color: string): boolean;
35
+ //# sourceMappingURL=theme-colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-colors.d.ts","sourceRoot":"","sources":["../../../src/utils/color/theme-colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,iHAUnB,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAI7D;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIzD"}
@@ -0,0 +1,25 @@
1
+ //#region src/utils/color/theme-colors.ts
2
+ var e = [
3
+ "primary",
4
+ "secondary",
5
+ "highlight",
6
+ "info",
7
+ "success",
8
+ "warning",
9
+ "danger",
10
+ "neutral",
11
+ "background"
12
+ ], t = /* @__PURE__ */ new Set([
13
+ "transparent",
14
+ "currentcolor",
15
+ "inherit"
16
+ ]);
17
+ function n(t) {
18
+ return e.includes(t);
19
+ }
20
+ function r(e) {
21
+ let n = e.trim().toLowerCase();
22
+ return t.has(n) || n.startsWith("var(");
23
+ }
24
+ //#endregion
25
+ export { e as THEME_COLOR_KEYS, n as isThemeColor, r as isUnsupportedColor };