xtreme-ui 0.0.94 → 0.0.96

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/components/base/ActionCard/actionCard.module.scss.js +6 -6
  2. package/dist/components/base/Button/button.module.scss.js +23 -23
  3. package/dist/components/base/ColorPicker/ColorPicker.d.ts.map +1 -1
  4. package/dist/components/base/ColorPicker/ColorPicker.js +18 -16
  5. package/dist/components/base/ColorPicker/colorPicker.module.scss.js +8 -8
  6. package/dist/components/base/ColorPopper/ColorPopper.d.ts +10 -1
  7. package/dist/components/base/ColorPopper/ColorPopper.d.ts.map +1 -1
  8. package/dist/components/base/ColorPopper/ColorPopper.js +168 -67
  9. package/dist/components/base/ColorPopper/types.d.ts +16 -4
  10. package/dist/components/base/ColorPopper/types.d.ts.map +1 -1
  11. package/dist/components/base/Icon/Icon.js +13 -13
  12. package/dist/components/base/Icon/types.d.ts +2 -0
  13. package/dist/components/base/Icon/types.d.ts.map +1 -1
  14. package/dist/components/base/ProgressBar/progressbar.module.scss.js +1 -1
  15. package/dist/components/base/Select/Select.d.ts.map +1 -1
  16. package/dist/components/base/Select/Select.js +56 -47
  17. package/dist/components/base/Select/types.d.ts +9 -4
  18. package/dist/components/base/Select/types.d.ts.map +1 -1
  19. package/dist/components/base/Textfield/Textfield.d.ts.map +1 -1
  20. package/dist/components/base/Textfield/Textfield.js +23 -21
  21. package/dist/components/base/Textfield/textfield.module.scss.js +22 -20
  22. package/dist/components/base/Textfield/types.d.ts +1 -0
  23. package/dist/components/base/Textfield/types.d.ts.map +1 -1
  24. package/dist/components/context/Theme/ThemeContext.d.ts.map +1 -1
  25. package/dist/components/context/Theme/ThemeContext.js +19 -14
  26. package/dist/components/context/Theme/types.d.ts +12 -17
  27. package/dist/components/context/Theme/types.d.ts.map +1 -1
  28. package/dist/components/context/Theme/types.js +4 -8
  29. package/dist/components/layout/Navigation/navigation.module.scss.js +9 -9
  30. package/dist/components/layout/Sider/sider.module.scss.js +6 -6
  31. package/dist/components/layout/ThemePicker/ThemePicker.d.ts.map +1 -1
  32. package/dist/components/layout/ThemePicker/ThemePicker.js +53 -50
  33. package/dist/components/layout/ThemeSelect/ThemeSelect.d.ts +3 -0
  34. package/dist/components/layout/ThemeSelect/ThemeSelect.d.ts.map +1 -0
  35. package/dist/components/layout/ThemeSelect/ThemeSelect.js +37 -0
  36. package/dist/components/layout/ThemeSelect/types.d.ts +8 -0
  37. package/dist/components/layout/ThemeSelect/types.d.ts.map +1 -0
  38. package/dist/components/layout/ThemeSwitch/ThemeSwitch.d.ts.map +1 -1
  39. package/dist/components/layout/ThemeSwitch/ThemeSwitch.js +40 -40
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +99 -95
  43. package/dist/utils/constants/theme.d.ts +19 -0
  44. package/dist/utils/constants/theme.d.ts.map +1 -0
  45. package/dist/utils/constants/theme.js +27 -0
  46. package/dist/utils/function/common.d.ts +2 -0
  47. package/dist/utils/function/common.d.ts.map +1 -0
  48. package/dist/utils/function/common.js +4 -0
  49. package/dist/utils/helper/colorHelper.d.ts +5 -0
  50. package/dist/utils/helper/colorHelper.d.ts.map +1 -0
  51. package/dist/utils/helper/colorHelper.js +24 -0
  52. package/dist/utils/helper/themeController.d.ts +2 -1
  53. package/dist/utils/helper/themeController.d.ts.map +1 -1
  54. package/dist/utils/helper/themeController.js +32 -13
  55. package/dist/utils/index.d.ts +1 -1
  56. package/dist/utils/index.d.ts.map +1 -1
  57. package/dist/xtreme-ui.css +1 -1
  58. package/package.json +4 -1
  59. package/dist/components/base/ColorPopper/colorPopper.module.scss.js +0 -11
  60. package/dist/components/layout/ThemePicker/themePicker.module.scss.js +0 -39
  61. package/dist/utils/constants/commons.d.ts +0 -18
  62. package/dist/utils/constants/commons.d.ts.map +0 -1
  63. package/dist/utils/constants/commons.js +0 -15
@@ -0,0 +1,3 @@
1
+ import { TThemeSelectProps } from './types';
2
+ export declare const ThemeSelect: import('react').ForwardRefExoticComponent<TThemeSelectProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ //# sourceMappingURL=ThemeSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSelect/ThemeSelect.tsx"],"names":[],"mappings":"AAUA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,WAAW,8GA4BtB,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { jsx as a } from "react/jsx-runtime";
3
+ import { forwardRef as p } from "react";
4
+ import n from "clsx";
5
+ import { ColorPopper as f } from "../../base/ColorPopper/ColorPopper.js";
6
+ import { useXTheme as T } from "../../context/useContext.js";
7
+ import { useScreenType as d } from "../../hooks/useScreen.js";
8
+ import { isValidThemeColor as u } from "../../../utils/helper/colorHelper.js";
9
+ import { ThemeColorsPreset as C } from "../../../utils/constants/theme.js";
10
+ /* empty css */
11
+ const S = p((o, m) => {
12
+ const { className: r, withSwatch: t } = o, { themeScheme: s, setThemeScheme: l, themeColor: e, setThemeColor: i } = T(), { isMobile: c } = d(), h = n(
13
+ "xtrThemeSelect",
14
+ r
15
+ );
16
+ return !e || !u(e) ? null : /* @__PURE__ */ a(
17
+ f,
18
+ {
19
+ ref: m,
20
+ className: h,
21
+ placeholder: "Theme",
22
+ alpha: !1,
23
+ swatch: t ? Object.values(C) : void 0,
24
+ colorHeading: "Theme Color",
25
+ schemeHeading: "Theme scheme",
26
+ themeScheme: s,
27
+ size: c ? "mini" : "default",
28
+ setThemeScheme: l,
29
+ color: e,
30
+ setColor: i
31
+ }
32
+ );
33
+ });
34
+ S.displayName = "ThemeSelect";
35
+ export {
36
+ S as ThemeSelect
37
+ };
@@ -0,0 +1,8 @@
1
+ import { EIconType } from '../../base/Icon/types';
2
+ export type TThemeSelectProps = {
3
+ className?: string;
4
+ withLabel?: boolean;
5
+ withSwatch?: boolean;
6
+ iconType?: keyof typeof EIconType;
7
+ };
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,MAAM,MAAM,iBAAiB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,OAAO,SAAS,CAAC;CAClC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeSwitch.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSwitch/ThemeSwitch.tsx"],"names":[],"mappings":"AAWA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQ5C,eAAO,MAAM,WAAW,8GAiEtB,CAAC"}
1
+ {"version":3,"file":"ThemeSwitch.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSwitch/ThemeSwitch.tsx"],"names":[],"mappings":"AAWA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAS5C,eAAO,MAAM,WAAW,8GA+DtB,CAAC"}
@@ -1,67 +1,67 @@
1
1
  "use client";
2
- import { jsxs as N, jsx as a } from "react/jsx-runtime";
3
- import { forwardRef as O, useMemo as c } from "react";
4
- import M from "clsx";
5
- import { Button as u } from "../../base/Button/Button.js";
6
- import { Select as j } from "../../base/Select/Select.js";
7
- import { EThemeColor as T } from "../../context/Theme/types.js";
8
- import { useXTheme as I } from "../../context/useContext.js";
9
- import { useScreenType as g } from "../../hooks/useScreen.js";
10
- import { THEME_SCHEME as m } from "../../../utils/constants/commons.js";
2
+ import { jsxs as O, jsx as c } from "react/jsx-runtime";
3
+ import { forwardRef as v, useMemo as a } from "react";
4
+ import w from "clsx";
5
+ import { Button as d } from "../../base/Button/Button.js";
6
+ import { Select as M } from "../../base/Select/Select.js";
7
+ import { useXTheme as g } from "../../context/useContext.js";
8
+ import { useScreenType as j } from "../../hooks/useScreen.js";
9
+ import { isValidThemeColor as I, getColorLabel as k } from "../../../utils/helper/colorHelper.js";
10
+ import { ThemeColorsPreset as u, THEME_SCHEME as m } from "../../../utils/constants/theme.js";
11
11
  /* empty css */
12
- const k = Object.values(T).map((t) => ({
13
- value: t,
14
- label: t.charAt(0).toUpperCase() + t.slice(1)
15
- })), i = Object.values(T), H = O((t, d) => {
16
- const { className: C, type: x = "secondary", size: n = "default", iconType: s = "solid" } = t, { themeScheme: e, setThemeScheme: b, themeColor: r, setThemeColor: h } = I(), { isMobile: S, isDesktop: y } = g(), l = !S, p = c(() => m[(m.findIndex((o) => o.name === e) + 1) % m.length], [e]), v = c(() => {
12
+ const H = Object.entries(u).map(([r, n]) => ({
13
+ label: r.charAt(0).toUpperCase() + r.slice(1),
14
+ value: n
15
+ })), h = Object.values(u), L = v((r, n) => {
16
+ const { className: C, type: x = "secondary", size: s = "default", iconType: i = "solid" } = r, { themeScheme: e, setThemeScheme: S, themeColor: t, setThemeColor: p } = g(), { isMobile: l, isDesktop: b } = j(), f = a(() => m[(m.findIndex((o) => o.name === e) + 1) % m.length], [e]), y = a(() => {
17
17
  var o;
18
- return ((o = m.find((w) => w.name === e)) == null ? void 0 : o.icon) ?? "";
19
- }, [e]), f = c(() => i[(i.findIndex((o) => o === r) + 1) % i.length], [r]), E = M(
18
+ return ((o = m.find((N) => N.name === e)) == null ? void 0 : o.icon) ?? "";
19
+ }, [e]), T = a(() => h[(h.findIndex((o) => o === t) + 1) % h.length], [t]), E = w(
20
20
  "xtrThemeSwitch",
21
21
  C,
22
- l && "withLabel"
22
+ !l && "withLabel"
23
23
  );
24
- return !e || !r ? null : /* @__PURE__ */ N("div", { ref: d, className: E, children: [
25
- /* @__PURE__ */ a(
26
- u,
24
+ return !e || !I(t) ? null : /* @__PURE__ */ O("div", { ref: n, className: E, children: [
25
+ /* @__PURE__ */ c(
26
+ d,
27
27
  {
28
28
  className: "xtrThemeScheme",
29
29
  type: x,
30
- size: n,
31
- icon: v,
32
- iconType: s,
33
- label: l ? e === "system" ? "auto" : e : void 0,
34
- onClick: () => p.name && b(p.name)
30
+ size: s,
31
+ icon: y,
32
+ iconType: i,
33
+ label: l ? void 0 : e,
34
+ onClick: () => f.name && S(f.name)
35
35
  }
36
36
  ),
37
- y ? /* @__PURE__ */ a(
38
- j,
37
+ b ? /* @__PURE__ */ c(
38
+ M,
39
39
  {
40
40
  clearable: !1,
41
41
  searchable: !1,
42
- size: n,
43
- options: k,
42
+ size: s,
44
43
  icon: "f53f",
45
- iconType: s,
44
+ iconType: i,
46
45
  placeholder: "Theme",
47
- value: r,
48
- onChange: h
46
+ options: H,
47
+ value: t,
48
+ onChange: p
49
49
  }
50
- ) : /* @__PURE__ */ a(
51
- u,
50
+ ) : /* @__PURE__ */ c(
51
+ d,
52
52
  {
53
53
  className: "xtrThemeColor",
54
54
  type: "primary",
55
- size: n,
55
+ size: s,
56
56
  icon: "f53f",
57
- iconType: s,
58
- label: l ? r : void 0,
59
- onClick: () => f && h(f)
57
+ iconType: i,
58
+ label: l ? void 0 : k(t),
59
+ onClick: () => T && p(T)
60
60
  }
61
61
  )
62
62
  ] });
63
63
  });
64
- H.displayName = "ThemeSwitch";
64
+ L.displayName = "ThemeSwitch";
65
65
  export {
66
- H as ThemeSwitch
66
+ L as ThemeSwitch
67
67
  };
package/dist/index.d.ts CHANGED
@@ -34,6 +34,8 @@ export { Navigation } from './components/layout/Navigation/Navigation';
34
34
  export { type TNavigationProps, type TNavigationRoute } from './components/layout/Navigation/types';
35
35
  export { ThemePicker } from './components/layout/ThemePicker/ThemePicker';
36
36
  export { type TThemePickerProps } from './components/layout/ThemePicker/types';
37
+ export { ThemeSelect } from './components/layout/ThemeSelect/ThemeSelect';
38
+ export { type TThemeSelectProps } from './components/layout/ThemeSelect/types';
37
39
  export { ThemeSwitch } from './components/layout/ThemeSwitch/ThemeSwitch';
38
40
  export { type TThemeSwitchProps } from './components/layout/ThemeSwitch/types';
39
41
  export { ImageEditor } from './components/layout/ImageEditor/ImageEditor';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,EAAE,KAAK,gBAAgB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAG5F,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGhF,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAGjF,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG1F,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGhF,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAG7E,OAAO,EAAE,OAAO,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AU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGpG,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC1E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC1E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC1E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC1E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -1,102 +1,106 @@
1
1
  /* empty css */
2
- import { STORAGE as t, THEME_SCHEME as p } from "./utils/constants/commons.js";
3
- import { FACE_ICONS as f } from "./utils/constants/iconCollection.js";
4
- import { getLocalState as x, setLocalState as a } from "./utils/function/localStorage.js";
5
- import { assignRef as n, mergeRefs as c } from "./utils/function/mergeRefs.js";
6
- import { capitalizeFirstLetter as g, safeStringFromCodePoint as l, unicodeToString as d } from "./utils/function/string.js";
7
- import { doc as P, elementObserver as C, getCssProperty as I, getCssPropertyPx as T, getCssPropertyVh as u, getCssPropertyVw as y, isClient as z, localStore as A, setCssProperty as F, waitForElement as h, win as k } from "./utils/helper/domHelper.js";
8
- import { createImage as L, getCroppedImg as w, getImageSize as D, getRadianAngle as R, readImageFile as B, readImageSrc as M } from "./utils/helper/imageHelper.js";
9
- import { themeController as X } from "./utils/helper/themeController.js";
10
- import { XProvider as H } from "./components/context/index.js";
11
- import { useXData as V, useXTheme as _ } from "./components/context/useContext.js";
12
- import { ActionCard as j } from "./components/base/ActionCard/ActionCard.js";
13
- import { EActionCardSize as J } from "./components/base/ActionCard/types.js";
14
- import { Avatar as Q } from "./components/base/Avatar/Avatar.js";
15
- import { EAvatarSize as W } from "./components/base/Avatar/types.js";
16
- import { Button as Z } from "./components/base/Button/Button.js";
17
- import { EButtonTypes as ee } from "./components/base/Button/types.js";
18
- import { Icon as oe } from "./components/base/Icon/Icon.js";
19
- import { EIconSize as pe } from "./components/base/Icon/types.js";
20
- import { Lottie as fe } from "./components/base/Lottie/Lottie.js";
21
- import { ELottieSize as xe } from "./components/base/Lottie/types.js";
22
- import { ProgressBar as se } from "./components/base/ProgressBar/ProgressBar.js";
23
- import { Spinner as ce } from "./components/base/Spinner/Spinner.js";
24
- import { ESpinnerSize as ge } from "./components/base/Spinner/types.js";
25
- import { Textfield as de } from "./components/base/Textfield/Textfield.js";
26
- import { DatePicker as Pe } from "./components/base/DatePicker/DatePicker.js";
2
+ import { STORAGE as t, THEME_SCHEME as m, ThemeColorsPreset as p, defaultColorPreset as f } from "./utils/constants/theme.js";
3
+ import { FACE_ICONS as x } from "./utils/constants/iconCollection.js";
4
+ import { getLocalState as s, setLocalState as n } from "./utils/function/localStorage.js";
5
+ import { assignRef as S, mergeRefs as g } from "./utils/function/mergeRefs.js";
6
+ import { capitalizeFirstLetter as P, safeStringFromCodePoint as d, unicodeToString as C } from "./utils/function/string.js";
7
+ import { doc as T, elementObserver as u, getCssProperty as I, getCssPropertyPx as h, getCssPropertyVh as y, getCssPropertyVw as z, isClient as A, localStore as F, setCssProperty as k, waitForElement as v, win as L } from "./utils/helper/domHelper.js";
8
+ import { createImage as D, getCroppedImg as R, getImageSize as B, getRadianAngle as M, readImageFile as O, readImageSrc as X } from "./utils/helper/imageHelper.js";
9
+ import { themeController as H } from "./utils/helper/themeController.js";
10
+ import { XProvider as V } from "./components/context/index.js";
11
+ import { useXData as G, useXTheme as j } from "./components/context/useContext.js";
12
+ import { ActionCard as J } from "./components/base/ActionCard/ActionCard.js";
13
+ import { EActionCardSize as Q } from "./components/base/ActionCard/types.js";
14
+ import { Avatar as W } from "./components/base/Avatar/Avatar.js";
15
+ import { EAvatarSize as Z } from "./components/base/Avatar/types.js";
16
+ import { Button as ee } from "./components/base/Button/Button.js";
17
+ import { EButtonTypes as oe } from "./components/base/Button/types.js";
18
+ import { Icon as me } from "./components/base/Icon/Icon.js";
19
+ import { EIconSize as fe } from "./components/base/Icon/types.js";
20
+ import { Lottie as xe } from "./components/base/Lottie/Lottie.js";
21
+ import { ELottieSize as se } from "./components/base/Lottie/types.js";
22
+ import { ProgressBar as ce } from "./components/base/ProgressBar/ProgressBar.js";
23
+ import { Spinner as ge } from "./components/base/Spinner/Spinner.js";
24
+ import { ESpinnerSize as Pe } from "./components/base/Spinner/types.js";
25
+ import { Textfield as Ce } from "./components/base/Textfield/Textfield.js";
26
+ import { DatePicker as Te } from "./components/base/DatePicker/DatePicker.js";
27
27
  import { EDatePickerTypes as Ie } from "./components/base/DatePicker/types.js";
28
- import { FilePicker as ue } from "./components/base/FilePicker/FilePicker.js";
29
- import { FilePickerIcon as ze } from "./components/base/FilePicker/types.js";
30
- import { Select as Fe } from "./components/base/Select/Select.js";
31
- import { ColorPopper as ke } from "./components/base/ColorPopper/ColorPopper.js";
32
- import { Sider as Le } from "./components/layout/Sider/Sider.js";
33
- import { SiderModal as De } from "./components/layout/SiderModal/SiderModal.js";
34
- import { Navigation as Be } from "./components/layout/Navigation/Navigation.js";
35
- import { ThemePicker as Oe } from "./components/layout/ThemePicker/ThemePicker.js";
36
- import { ThemeSwitch as be } from "./components/layout/ThemeSwitch/ThemeSwitch.js";
37
- import { ImageEditor as Ne } from "./components/layout/ImageEditor/ImageEditor.js";
38
- import { useScreenType as _e } from "./components/hooks/useScreen.js";
39
- import { usePersistingState as je } from "./components/hooks/usePersistingState.js";
40
- import { useDebouncedEffect as Je } from "./components/hooks/useDebouncedEffect.js";
28
+ import { FilePicker as ye } from "./components/base/FilePicker/FilePicker.js";
29
+ import { FilePickerIcon as Ae } from "./components/base/FilePicker/types.js";
30
+ import { Select as ke } from "./components/base/Select/Select.js";
31
+ import { ColorPopper as Le } from "./components/base/ColorPopper/ColorPopper.js";
32
+ import { Sider as De } from "./components/layout/Sider/Sider.js";
33
+ import { SiderModal as Be } from "./components/layout/SiderModal/SiderModal.js";
34
+ import { Navigation as Oe } from "./components/layout/Navigation/Navigation.js";
35
+ import { ThemePicker as be } from "./components/layout/ThemePicker/ThemePicker.js";
36
+ import { ThemeSelect as Ne } from "./components/layout/ThemeSelect/ThemeSelect.js";
37
+ import { ThemeSwitch as _e } from "./components/layout/ThemeSwitch/ThemeSwitch.js";
38
+ import { ImageEditor as je } from "./components/layout/ImageEditor/ImageEditor.js";
39
+ import { useScreenType as Je } from "./components/hooks/useScreen.js";
40
+ import { usePersistingState as Qe } from "./components/hooks/usePersistingState.js";
41
+ import { useDebouncedEffect as We } from "./components/hooks/useDebouncedEffect.js";
41
42
  export {
42
- j as ActionCard,
43
- Q as Avatar,
44
- Z as Button,
45
- ke as ColorPopper,
46
- Pe as DatePicker,
47
- J as EActionCardSize,
48
- W as EAvatarSize,
49
- ee as EButtonTypes,
43
+ J as ActionCard,
44
+ W as Avatar,
45
+ ee as Button,
46
+ Le as ColorPopper,
47
+ Te as DatePicker,
48
+ Q as EActionCardSize,
49
+ Z as EAvatarSize,
50
+ oe as EButtonTypes,
50
51
  Ie as EDatePickerTypes,
51
- pe as EIconSize,
52
- xe as ELottieSize,
53
- ge as ESpinnerSize,
54
- f as FACE_ICONS,
55
- ue as FilePicker,
56
- ze as FilePickerIcon,
57
- oe as Icon,
58
- Ne as ImageEditor,
59
- fe as Lottie,
60
- Be as Navigation,
61
- se as ProgressBar,
52
+ fe as EIconSize,
53
+ se as ELottieSize,
54
+ Pe as ESpinnerSize,
55
+ x as FACE_ICONS,
56
+ ye as FilePicker,
57
+ Ae as FilePickerIcon,
58
+ me as Icon,
59
+ je as ImageEditor,
60
+ xe as Lottie,
61
+ Oe as Navigation,
62
+ ce as ProgressBar,
62
63
  t as STORAGE,
63
- Fe as Select,
64
- Le as Sider,
65
- De as SiderModal,
66
- ce as Spinner,
67
- p as THEME_SCHEME,
68
- de as Textfield,
69
- Oe as ThemePicker,
70
- be as ThemeSwitch,
71
- H as XProvider,
72
- n as assignRef,
73
- g as capitalizeFirstLetter,
74
- L as createImage,
75
- P as doc,
76
- C as elementObserver,
77
- w as getCroppedImg,
64
+ ke as Select,
65
+ De as Sider,
66
+ Be as SiderModal,
67
+ ge as Spinner,
68
+ m as THEME_SCHEME,
69
+ Ce as Textfield,
70
+ p as ThemeColorsPreset,
71
+ be as ThemePicker,
72
+ Ne as ThemeSelect,
73
+ _e as ThemeSwitch,
74
+ V as XProvider,
75
+ S as assignRef,
76
+ P as capitalizeFirstLetter,
77
+ D as createImage,
78
+ f as defaultColorPreset,
79
+ T as doc,
80
+ u as elementObserver,
81
+ R as getCroppedImg,
78
82
  I as getCssProperty,
79
- T as getCssPropertyPx,
80
- u as getCssPropertyVh,
81
- y as getCssPropertyVw,
82
- D as getImageSize,
83
- x as getLocalState,
84
- R as getRadianAngle,
85
- z as isClient,
86
- A as localStore,
87
- c as mergeRefs,
88
- B as readImageFile,
89
- M as readImageSrc,
90
- l as safeStringFromCodePoint,
91
- F as setCssProperty,
92
- a as setLocalState,
93
- X as themeController,
94
- d as unicodeToString,
95
- Je as useDebouncedEffect,
96
- je as usePersistingState,
97
- _e as useScreenType,
98
- V as useXData,
99
- _ as useXTheme,
100
- h as waitForElement,
101
- k as win
83
+ h as getCssPropertyPx,
84
+ y as getCssPropertyVh,
85
+ z as getCssPropertyVw,
86
+ B as getImageSize,
87
+ s as getLocalState,
88
+ M as getRadianAngle,
89
+ A as isClient,
90
+ F as localStore,
91
+ g as mergeRefs,
92
+ O as readImageFile,
93
+ X as readImageSrc,
94
+ d as safeStringFromCodePoint,
95
+ k as setCssProperty,
96
+ n as setLocalState,
97
+ H as themeController,
98
+ C as unicodeToString,
99
+ We as useDebouncedEffect,
100
+ Qe as usePersistingState,
101
+ Je as useScreenType,
102
+ G as useXData,
103
+ j as useXTheme,
104
+ v as waitForElement,
105
+ L as win
102
106
  };
@@ -0,0 +1,19 @@
1
+ import { EThemeScheme, TThemeColor } from '../../components/context/Theme/types';
2
+ export declare const STORAGE: {
3
+ themeSchemeAttr: string;
4
+ themeScheme: string;
5
+ themeColor: string;
6
+ };
7
+ export declare const THEME_SCHEME: readonly [{
8
+ readonly name: EThemeScheme.auto;
9
+ readonly icon: "e163";
10
+ }, {
11
+ readonly name: EThemeScheme.light;
12
+ readonly icon: "f763";
13
+ }, {
14
+ readonly name: EThemeScheme.dark;
15
+ readonly icon: "f754";
16
+ }];
17
+ export declare const ThemeColorsPreset: Record<string, TThemeColor>;
18
+ export declare const defaultColorPreset: TThemeColor;
19
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/utils/constants/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE5E,eAAO,MAAM,OAAO;;;;CAInB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;EAIf,CAAC;AAEX,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAWzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAA2B,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { EThemeScheme as e } from "../../components/context/Theme/types.js";
2
+ const s = {
3
+ themeSchemeAttr: "data-theme-scheme",
4
+ themeScheme: "xThemeScheme",
5
+ themeColor: "xThemeColor"
6
+ }, m = [
7
+ { name: e.auto, icon: "e163" },
8
+ { name: e.light, icon: "f763" },
9
+ { name: e.dark, icon: "f754" }
10
+ ], h = {
11
+ cherry: { h: 350, s: 70, l: 50 },
12
+ blush: { h: 335, s: 75, l: 55 },
13
+ saffron: { h: 19, s: 100, l: 56 },
14
+ sunset: { h: 28, s: 80, l: 55 },
15
+ mango: { h: 45, s: 80, l: 50 },
16
+ clay: { h: 20, s: 25, l: 50 },
17
+ mint: { h: 135, s: 45, l: 50 },
18
+ ocean: { h: 170, s: 60, l: 55 },
19
+ sky: { h: 205, s: 75, l: 50 },
20
+ plum: { h: 280, s: 40, l: 55 }
21
+ }, t = h.orange;
22
+ export {
23
+ s as STORAGE,
24
+ m as THEME_SCHEME,
25
+ h as ThemeColorsPreset,
26
+ t as defaultColorPreset
27
+ };
@@ -0,0 +1,2 @@
1
+ export declare const isEqual: (a: unknown, b: unknown) => boolean;
2
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/function/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,GAAG,OAAO,EAAE,GAAG,OAAO,KAAG,OAKhD,CAAC"}
@@ -0,0 +1,4 @@
1
+ const o = (e, t) => typeof e == "string" && typeof t == "string" ? e === t : typeof e == "object" && typeof t == "object" && e !== null && t !== null ? Object.entries(e).every(([r, n]) => t[r] === n) : !1;
2
+ export {
3
+ o as isEqual
4
+ };
@@ -0,0 +1,5 @@
1
+ import { TThemeColor } from '../../components/context/Theme/types';
2
+ export declare const guessClosestColorName: (color: TThemeColor) => any;
3
+ export declare function getColorLabel(c?: TThemeColor): string | undefined;
4
+ export declare const isValidThemeColor: (c?: TThemeColor) => boolean;
5
+ //# sourceMappingURL=colorHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorHelper.d.ts","sourceRoot":"","sources":["../../../src/utils/helper/colorHelper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,eAAO,MAAM,qBAAqB,GAAI,OAAO,WAAW,QAUvD,CAAC;AAEF,wBAAgB,aAAa,CAAE,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAMlE;AAED,eAAO,MAAM,iBAAiB,GAAI,IAAI,WAAW,KAAG,OACiC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import s from "color-namer";
2
+ import { colord as l } from "colord";
3
+ import { ThemeColorsPreset as m } from "../constants/theme.js";
4
+ const f = (e) => {
5
+ const t = l(e).toHex(), r = s(t);
6
+ let o = null;
7
+ for (const n of r.ntc)
8
+ (!o || n.distance < o.distance) && (o = n);
9
+ return (o == null ? void 0 : o.name) || void 0;
10
+ };
11
+ function p(e) {
12
+ if (e) {
13
+ for (const [t, r] of Object.entries(m))
14
+ if (e.h === r.h && e.s === r.s && e.l === r.l)
15
+ return t;
16
+ return f(e);
17
+ }
18
+ }
19
+ const b = (e) => !!e && typeof e.h == "number" && typeof e.s == "number" && typeof e.l == "number";
20
+ export {
21
+ p as getColorLabel,
22
+ f as guessClosestColorName,
23
+ b as isValidThemeColor
24
+ };
@@ -1,2 +1,3 @@
1
- export declare const themeController: (scheme?: string, color?: string) => string;
1
+ import { TThemeColor } from '../../components/context/Theme/types';
2
+ export declare const themeController: (preferredScheme: string | undefined | null, preferredColor: TThemeColor | undefined | null, defaultScheme?: string, defaultColorPreset?: TThemeColor) => string;
2
3
  //# sourceMappingURL=themeController.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"themeController.d.ts","sourceRoot":"","sources":["../../../src/utils/helper/themeController.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,GAAI,SAAQ,MAAsB,EAAE,QAAO,MAAqB,WAW3F,CAAC"}
1
+ {"version":3,"file":"themeController.d.ts","sourceRoot":"","sources":["../../../src/utils/helper/themeController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG/F,eAAO,MAAM,eAAe,GAC3B,iBAAiB,MAAM,GAAG,SAAS,GAAG,IAAI,EAC1C,gBAAgB,WAAW,GAAG,SAAS,GAAG,IAAI,EAC9C,gBAAe,MAAuB,EACtC,qBAAoB,WAAiC,WAiCrD,CAAC"}
@@ -1,16 +1,35 @@
1
- import { defaultScheme as m, defaultColor as r } from "../../components/context/Theme/types.js";
2
- import { STORAGE as e } from "../constants/commons.js";
3
- const l = (t = m, o = r) => `
4
- (function() {
5
- try {
6
- const themeScheme = localStorage.getItem('${e.themeScheme}') || '${t}';
7
- const themeColor = localStorage.getItem('${e.themeColor}') || '${o}';
1
+ import { defaultScheme as c } from "../../components/context/Theme/types.js";
2
+ import { defaultColorPreset as d, STORAGE as e } from "../constants/theme.js";
3
+ const S = (r, t, o = c, m = d) => {
4
+ const s = JSON.stringify(r), l = t ? JSON.stringify(t) : "null", n = JSON.stringify(m);
5
+ return `(function() {
6
+ try {
7
+ const storedScheme = localStorage.getItem('${e.themeScheme}');
8
+ const themeScheme = ${s} ?? storedScheme ?? '${o}';
8
9
 
9
- document.documentElement.setAttribute('${e.themeSchemeAttr}', themeScheme);
10
- document.documentElement.setAttribute('${e.themeColorAttr}', themeColor);
11
- } catch (e) {}
12
- })();
13
- `;
10
+ const themeColorRaw = localStorage.getItem('${e.themeColor}');
11
+ let {h, s, l} = ${n};
12
+
13
+ const preferredColor = ${l};
14
+
15
+ if (preferredColor) {
16
+ ({h, s, l} = preferredColor);
17
+ } else {
18
+ try {
19
+ const parsed = JSON.parse(themeColorRaw);
20
+ if (parsed && typeof parsed.h === 'number' && typeof parsed.s === 'number' && typeof parsed.l === 'number') {
21
+ ({h, s, l} = parsed);
22
+ }
23
+ } catch {}
24
+ }
25
+
26
+ document.documentElement.setAttribute('${e.themeSchemeAttr}', themeScheme);
27
+ document.documentElement.style.setProperty('--H', h.toString());
28
+ document.documentElement.style.setProperty('--S', s + '%');
29
+ document.documentElement.style.setProperty('--L', l + '%');
30
+ } catch {}
31
+ })();`;
32
+ };
14
33
  export {
15
- l as themeController
34
+ S as themeController
16
35
  };
@@ -1,4 +1,4 @@
1
- export * from './constants/commons';
1
+ export * from './constants/theme';
2
2
  export * from './constants/iconCollection';
3
3
  export * from './function/localStorage';
4
4
  export * from './function/mergeRefs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}