@m4l/graphics 7.0.8 → 7.0.10

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.
@@ -1,11 +1,11 @@
1
1
  import o from "date-fns/locale/en-US";
2
2
  async function g(n, e, s) {
3
- const r = l(n), i = { ...n };
4
- let t;
5
- return r === "es" ? t = (await import("date-fns/locale/es")).default : r === "fr" ? t = (await import("date-fns/locale/fr")).default : r === "en-US" ? t = o : (t = o, i.lang = "en", i.script = void 0, i.region = "US", i.url_icon = `${e}/${s}/frontend/commons/assets/icons/langs/lang_en.svg`, i.name = "English US*"), {
6
- ...i,
7
- module: t,
8
- localeString: l(i)
3
+ const r = l(n), t = { ...n };
4
+ let i;
5
+ return r === "es" ? i = (await import("date-fns/locale/es")).default : r === "fr" ? i = (await import("date-fns/locale/fr")).default : r === "en-US" ? i = o : (i = o, t.lang = "en", t.script = void 0, t.region = "US", t.urlIcon = `${e}/${s}/frontend/commons/assets/icons/langs/lang_en.svg`, t.name = "English US*"), {
6
+ ...t,
7
+ module: i,
8
+ localeString: l(t)
9
9
  };
10
10
  }
11
11
  function l(n) {
@@ -1,38 +1,40 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as f } from "react/jsx-runtime";
2
2
  import { createContext as A, useState as d, useCallback as O, useEffect as E } from "react";
3
3
  import { AdapterDateFns as k } from "@mui/x-date-pickers/AdapterDateFns";
4
4
  import { LocalizationProvider as x } from "@mui/x-date-pickers";
5
- import { useEnvironment as F, useNetwork as P, useHostTools as j, useLocalStorageWithListener as G, EmitEvents as i } from "@m4l/core";
5
+ import { useEnvironment as F, useNetwork as P, useHostTools as j, useLocalStorageWithListener as G, EmitEvents as a } from "@m4l/core";
6
6
  import { s as I, j as V } from "./helper.js";
7
- const U = A(null);
7
+ const b = A(null);
8
8
  function B(_) {
9
- const { children: g, isMicroFrontEnd: e, localeHost: a, getLocaleFromNetwork: s } = _;
10
- if (e && !a)
9
+ const { children: g, isMicroFrontEnd: e, localeHost: i, getLocaleFromNetwork: s } = _;
10
+ if (e && !i)
11
11
  throw Error("Must set localeHost in microfrontend");
12
12
  if (!e && !s)
13
13
  throw Error("Must set getLocaleFromNetwork in host");
14
- const { domain_token: L, host_static_assets: p, environment_assets: h } = F(), { networkOperation: v } = P(), { events_add_listener: S, events_remove_listener: C, events_emit: T } = j(), [r, l] = d(() => {
14
+ const { domain_token: L, host_static_assets: p, environment_assets: C } = F(), { networkOperation: S } = P(), { events_add_listener: h, events_remove_listener: v, events_emit: T } = j(), [r, l] = d(() => {
15
15
  if (e)
16
- return a;
16
+ return i;
17
17
  }), [o, c] = G(
18
18
  "localeHost",
19
19
  navigator.language
20
20
  ), [H, N] = d(""), u = O((t) => {
21
21
  l(t);
22
22
  }, []);
23
- if (E(() => (e && S(i.EMMIT_EVENT_HOST_LOCALE_CHANGE, u), () => {
24
- e && C(i.EMMIT_EVENT_HOST_LOCALE_CHANGE, u);
23
+ if (E(() => (e && h(a.EMMIT_EVENT_HOST_LOCALE_CHANGE, u), () => {
24
+ e && v(a.EMMIT_EVENT_HOST_LOCALE_CHANGE, u);
25
25
  }), []), E(() => {
26
26
  let t = !0;
27
27
  if (!e && s && !(o === H && o !== ""))
28
- return v({
28
+ return S({
29
29
  method: "POST",
30
30
  endPoint: "na/locales",
31
- data: { ...I(o), domain_token: L }
32
- }).then((f) => {
33
- t && s(f.data, p, h).then(
31
+ data: { ...I(o), domain_token: L },
32
+ responseToCamelCase: !0,
33
+ bodyToSnakeCase: !0
34
+ }).then((m) => {
35
+ t && s(m.data, p, C).then(
34
36
  (n) => {
35
- l(n), N(n.localeString), o !== n.localeString && c(n.localeString), T(i.EMMIT_EVENT_HOST_LOCALE_CHANGE, n);
37
+ l(n), N(n.localeString), o !== n.localeString && c(n.localeString), T(a.EMMIT_EVENT_HOST_LOCALE_CHANGE, n);
36
38
  }
37
39
  );
38
40
  }).finally(() => {
@@ -44,14 +46,14 @@ function B(_) {
44
46
  const M = (t) => {
45
47
  (t.lang !== r.lang || t.script !== r.script || t.region !== r.region) && c(V(t));
46
48
  };
47
- return /* @__PURE__ */ m(
48
- U.Provider,
49
+ return /* @__PURE__ */ f(
50
+ b.Provider,
49
51
  {
50
52
  value: {
51
53
  currentLocale: r,
52
54
  onChangeLocale: M
53
55
  },
54
- children: /* @__PURE__ */ m(
56
+ children: /* @__PURE__ */ f(
55
57
  x,
56
58
  {
57
59
  dateAdapter: k,
@@ -64,6 +66,6 @@ function B(_) {
64
66
  );
65
67
  }
66
68
  export {
67
- U as L,
69
+ b as L,
68
70
  B as a
69
71
  };
@@ -8,7 +8,7 @@ export interface BaseLocale {
8
8
  }
9
9
  export interface NetworkLocaleType extends BaseLocale {
10
10
  name: string;
11
- url_icon: string;
11
+ urlIcon: string;
12
12
  }
13
13
  export interface LocaleType extends NetworkLocaleType {
14
14
  module: Locale;
@@ -1,7 +1,7 @@
1
- import { createStore as c } from "zustand";
2
- import { devtools as l } from "zustand/middleware";
1
+ import { createStore as S } from "zustand";
2
+ import { devtools as c } from "zustand/middleware";
3
3
  import { immer as p } from "zustand/middleware/immer";
4
- import { getPaletteByPreset as a, typography as u, shadows as h, getColorPresets as d, createCustomShadows as f } from "@m4l/styles";
4
+ import { getPaletteByPreset as a, typographyOld as d, shadows as h, getColorPresets as u, createCustomShadows as f } from "@m4l/styles";
5
5
  import { alpha as U } from "@mui/system";
6
6
  import { d as s } from "./constants.js";
7
7
  function g(r, o = "m4l") {
@@ -9,8 +9,8 @@ function g(r, o = "m4l") {
9
9
  m && Object.keys(r).forEach((t) => {
10
10
  const e = r[t];
11
11
  if (typeof e == "string" || typeof e == "number") {
12
- const S = `--${o}-${t}`;
13
- m.style.setProperty(S, e.toString());
12
+ const l = `--${o}-${t}`;
13
+ m.style.setProperty(l, e.toString());
14
14
  } else typeof e == "object" && e !== null && g(e, `${o}-${t}`);
15
15
  });
16
16
  }
@@ -18,7 +18,7 @@ const n = (r) => {
18
18
  const o = r.themeUserSettings || s, m = o.themeMode === "light", t = a(o.themeColor), e = m ? t.light : t.dark;
19
19
  r.themeOptions = {
20
20
  ...r.themeOptions,
21
- typography: u,
21
+ ...d,
22
22
  palette: {
23
23
  ...r.themeOptions?.palette ?? {},
24
24
  ...e
@@ -28,7 +28,7 @@ const n = (r) => {
28
28
  shadows: m ? h.light : h.dark,
29
29
  customShadows: {
30
30
  primary: `0 8px 16px 0 ${U(
31
- d(o.themeColor)?.main || "#fff",
31
+ u(o.themeColor)?.main || "#fff",
32
32
  0.2
33
33
  )}`,
34
34
  ...f(o.themeMode)
@@ -37,8 +37,8 @@ const n = (r) => {
37
37
  }, g(r.themeOptions);
38
38
  }, i = (r) => {
39
39
  r.themeSettingsPersistFn && r.themeSettingsPersistFn(r.themeUserSettings);
40
- }, P = (r) => c(
41
- l(
40
+ }, P = (r) => S(
41
+ c(
42
42
  p((o, m) => ({
43
43
  ...r,
44
44
  settingsActions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "7.0.8",
3
+ "version": "7.0.10",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
6
  "type": "module",