@m4l/graphics 2.0.2 → 2.0.3

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.
@@ -7,6 +7,7 @@ function s() {
7
7
  return /* @__PURE__ */ a(e, {
8
8
  styles: {
9
9
  body: {
10
+ /* backgroundColor: `${theme.vars.palette.background.background}!important`, */
10
11
  textRendering: "geometricPrecision",
11
12
  width: "100%",
12
13
  height: "100vh",
@@ -14,19 +15,26 @@ function s() {
14
15
  color: t.vars.palette.text.primary
15
16
  },
16
17
  "*::-webkit-scrollbar": {
18
+ // camino de la barra con radio
17
19
  width: "7px",
18
20
  height: "7px",
19
21
  borderRadius: "3px",
20
22
  backgroundColor: "transparent"
21
23
  },
22
24
  "*::-webkit-scrollbar-track": {
25
+ // Camino de la barrra sin radio
23
26
  backgroundColor: "transparent",
24
27
  border: "0px solid transparent"
25
28
  },
26
29
  "*::-webkit-scrollbar-corner": {
27
30
  backgroundColor: "transparent"
28
31
  },
32
+ // FireFox
33
+ // scrollbarColor: `${theme.vars.palette.primary.main} white`,
34
+ // scrollbarWidth: 'thin',
35
+ // Chrome
29
36
  "*::-webkit-scrollbar-thumb": {
37
+ // barra que se mueve
30
38
  background: t.vars.palette.state.scrollBar,
31
39
  borderRadius: "2px!important"
32
40
  },
@@ -0,0 +1 @@
1
+
@@ -1,6 +1,6 @@
1
1
  import { createContext as D, useState as C, useCallback as k, useEffect as p } from "react";
2
2
  import { useHostTools as v, usePropageteMF as R, EmitEvents as f } from "@m4l/core";
3
- import { u as h } from "../../hooks/useFirstRender/index.1e9b02fb.js";
3
+ import { u as h } from "../../hooks/useFirstRender/index-B-Q0TTn0.js";
4
4
  import { jsx as V } from "react/jsx-runtime";
5
5
  const x = D(null);
6
6
  function I(T) {
@@ -10,7 +10,7 @@ function I(T) {
10
10
  currencyFormatter: l,
11
11
  numberFormatter: M,
12
12
  dateFormatter: t
13
- } = T, r = l?.decimalDigits || 0, o = l?.code || "USD", a = M?.decimalSymbol || 0.1 .toLocaleString().substring(1, 2), s = M?.thousandsSymbol || 1e3 .toLocaleString().substring(1, 2), m = t?.dateFormat || "yyyy-MM-dd", n = t?.dateMask || "____-__-__", c = t?.datetimeFormat || "yyyy-MM-dd HH:mm:ss", i = t?.datetimeMask || "____-__-__ __:__:__", _ = t?.timeFormat || "HH:mm:ss", d = t?.timeMask || "__:__:__", u = t?.formatDate || (() => {
13
+ } = T, r = l?.decimalDigits || 0, o = l?.code || "USD", a = M?.decimalSymbol || 0.1.toLocaleString().substring(1, 2), s = M?.thousandsSymbol || 1e3.toLocaleString().substring(1, 2), m = t?.dateFormat || "yyyy-MM-dd", n = t?.dateMask || "____-__-__", c = t?.datetimeFormat || "yyyy-MM-dd HH:mm:ss", i = t?.datetimeMask || "____-__-__ __:__:__", _ = t?.timeFormat || "HH:mm:ss", d = t?.timeMask || "__:__:__", u = t?.formatDate || (() => {
14
14
  throw new Error("Incorrect use of formatDate");
15
15
  }), y = h(), {
16
16
  events_emit: g
@@ -1,6 +1,6 @@
1
1
  import { createContext as c, useMemo as a } from "react";
2
2
  import { CssBaseline as h } from "@mui/material";
3
- import { G as d } from "../../components/GlobalStyle/index.b7393a44.js";
3
+ import { G as d } from "../../components/GlobalStyle/index-DHBkshRk.js";
4
4
  import { createTheme as p, experimental_extendTheme as x, Experimental_CssVarsProvider as f, StyledEngineProvider as u } from "@mui/material/styles";
5
5
  import { jsxs as s, jsx as t } from "react/jsx-runtime";
6
6
  const T = c(null);
@@ -65,7 +65,7 @@ function J(t) {
65
65
  o && T(u.EMMIT_EVENT_HOST_LOCALE_CHANGE, d);
66
66
  }), []), _(() => {
67
67
  let n = !0;
68
- if (!o && !!r && !(l === M && l !== ""))
68
+ if (!o && r && !(l === M && l !== ""))
69
69
  return C({
70
70
  method: "POST",
71
71
  endPoint: "na/locales",
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ThemeSettingsProviderProps } from './types';
2
+ import type { ThemeSettingsProviderProps } from './types';
3
3
  declare const ThemeSettingsContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./types").ThemeSettingsStateWithActions>, "setState"> & {
4
4
  setState<A extends string | {
5
5
  type: unknown;
@@ -1,6 +1,6 @@
1
1
  import { NetworkProps } from '@m4l/core';
2
2
  import { ThemeColorPresets } from '@m4l/styles';
3
- import { CssVarsTheme, Theme, PaletteColor } from '@mui/material/styles';
3
+ import { CssVarsTheme, Theme } from '@mui/material/styles';
4
4
  import { ReactNode } from 'react';
5
5
  export declare type ThemeMode = 'light' | 'dark';
6
6
  export declare type ThemeDirection = 'rtl' | 'ltr';
@@ -16,7 +16,6 @@ export declare type ThemeSettingsType = {
16
16
  export interface ThemeSettingsStore {
17
17
  networkOperation: (props: NetworkProps) => Promise<any>;
18
18
  currentThemeSettings: ThemeSettingsType;
19
- currentPreset: PaletteColor;
20
19
  themeOptions: Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme;
21
20
  colorOption: {
22
21
  name: string | undefined;
@@ -0,0 +1,278 @@
1
+ import { createContext as f, useRef as T, useMemo as O, useLayoutEffect as y } from "react";
2
+ import { c as v, d as R, i as x, l as b } from "../node_modules-BHhXVwYT.js";
3
+ import { jsx as P } from "react/jsx-runtime";
4
+ import { useNetwork as E, useLocalStorageWithListener as M } from "@m4l/core";
5
+ import { getColorPresets as g, getColorState as d, typography as w, palette as C, SECONDARY as L, COMMON as A, ERROR as N, WARNING as D, INFO as B, SUCCESS as z, shadows as p, createCustomShadows as W, defaultThemeOptions as $, colorPresets as j } from "@m4l/styles";
6
+ import { alpha as _ } from "@mui/system";
7
+ const u = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, I = (r) => {
8
+ const n = {
9
+ ...r
10
+ };
11
+ return v(
12
+ R(
13
+ x((o, t) => ({
14
+ ...n,
15
+ responsiveContainerActions: {
16
+ setBreakpoint: (e) => {
17
+ o((s) => {
18
+ s.breakPoint = e, s.isUpSm = e !== "xs" && e !== "sm", s.isXs = e == "xs";
19
+ });
20
+ }
21
+ }
22
+ })),
23
+ { name: "Responsive Relative Store" }
24
+ )
25
+ );
26
+ }, U = f(null), J = (r) => {
27
+ const {
28
+ children: n,
29
+ observedDivRef: o
30
+ } = r, t = T();
31
+ t.current || (t.current = I({
32
+ breakPoint: "md",
33
+ isUpSm: !1,
34
+ isXs: !1
35
+ }));
36
+ const e = () => {
37
+ const i = o;
38
+ if (i instanceof HTMLElement && i.clientWidth) {
39
+ const a = Object.keys(u);
40
+ for (let c = 0; c < a.length; c++) {
41
+ const m = a[c];
42
+ if (i.clientWidth <= u[m]) {
43
+ t.current?.getState().responsiveContainerActions.setBreakpoint(m);
44
+ break;
45
+ } else c === a.length - 1 && i.clientWidth >= u[m] && t.current?.getState().responsiveContainerActions.setBreakpoint(m);
46
+ }
47
+ }
48
+ }, s = O(() => b.throttle(e, 200, {
49
+ leading: !1,
50
+ trailing: !0
51
+ }), [e]);
52
+ return y(() => {
53
+ const i = () => {
54
+ s();
55
+ }, a = o;
56
+ if (a && a instanceof Element) {
57
+ const c = new ResizeObserver((m) => {
58
+ i();
59
+ });
60
+ return c.observe(a), () => {
61
+ c.disconnect();
62
+ };
63
+ }
64
+ }, [o]), /* @__PURE__ */ P(U.Provider, {
65
+ value: t.current,
66
+ children: n
67
+ });
68
+ }, S = {
69
+ themeMode: "light",
70
+ themeDirection: "ltr",
71
+ themeColorPresets: "patronus",
72
+ themeLayout: "horizontal",
73
+ themeStretch: !1
74
+ };
75
+ function k(r, n = "m4l") {
76
+ const o = document.querySelector('[data-mui-color-scheme="light"]');
77
+ if (!o) {
78
+ console.error('Element with data-mui-color-scheme="light" not found.');
79
+ return;
80
+ }
81
+ Object.keys(r).forEach((t) => {
82
+ const e = r[t];
83
+ if (typeof e == "string" || typeof e == "number") {
84
+ const s = `--${n}-${t}`;
85
+ o.style.setProperty(s, e.toString());
86
+ } else typeof e == "object" && e !== null && k(e, `${n}-${t}`);
87
+ });
88
+ }
89
+ const h = (r) => {
90
+ const n = r.currentThemeSettings || S;
91
+ console.log("getColorPresets", g(n.themeColorPresets)), console.log(
92
+ "getColorState",
93
+ d(n.themeColorPresets, n.themeMode)
94
+ );
95
+ const o = n.themeMode === "light";
96
+ r.themeOptions = {
97
+ ...r.themeOptions,
98
+ typography: w,
99
+ palette: {
100
+ ...r.themeOptions?.palette ?? {},
101
+ ...o ? C.light : C.dark,
102
+ primary: g(n.themeColorPresets),
103
+ state: d(n.themeColorPresets, n.themeMode),
104
+ representative: n.themeMode === "light" ? g(n.themeColorPresets)?.light : g(n.themeColorPresets)?.darker,
105
+ secondary: {
106
+ ...L,
107
+ contrastText: "",
108
+ mainChannel: "",
109
+ lightChannel: "",
110
+ darkChannel: "",
111
+ contrastTextChannel: ""
112
+ },
113
+ common: {
114
+ ...A,
115
+ black: "#000",
116
+ white: "#fff",
117
+ background: "",
118
+ backgroundChannel: "",
119
+ onBackground: "",
120
+ onBackgroundChannel: ""
121
+ },
122
+ error: {
123
+ ...N,
124
+ contrastText: "",
125
+ mainChannel: "",
126
+ lightChannel: "",
127
+ darkChannel: "",
128
+ contrastTextChannel: ""
129
+ },
130
+ warning: {
131
+ ...D,
132
+ contrastText: "",
133
+ mainChannel: "",
134
+ lightChannel: "",
135
+ darkChannel: "",
136
+ contrastTextChannel: ""
137
+ },
138
+ info: {
139
+ ...B,
140
+ contrastText: "",
141
+ mainChannel: "",
142
+ lightChannel: "",
143
+ darkChannel: "",
144
+ contrastTextChannel: ""
145
+ },
146
+ success: {
147
+ ...z,
148
+ contrastText: "",
149
+ mainChannel: "",
150
+ lightChannel: "",
151
+ darkChannel: "",
152
+ contrastTextChannel: ""
153
+ }
154
+ },
155
+ shape: { borderRadius: 8 },
156
+ direction: n.themeDirection,
157
+ shadows: o ? p.light : p.dark,
158
+ customShadows: {
159
+ primary: `0 8px 16px 0 ${_(
160
+ g(n.themeColorPresets)?.main || "#fff",
161
+ 0.2
162
+ )}`,
163
+ ...W(n.themeMode)
164
+ },
165
+ stretch: n.themeStretch
166
+ }, k(r.themeOptions);
167
+ }, l = (r) => {
168
+ r.setterThemeSettings && r.setterThemeSettings(r.currentThemeSettings);
169
+ }, K = (r) => v(
170
+ R(
171
+ x((n, o) => ({
172
+ ...r,
173
+ settingsActions: {
174
+ init: () => {
175
+ n((t) => {
176
+ h(t);
177
+ });
178
+ },
179
+ // setThemeOptions: newObj => {
180
+ // set(state => {
181
+ // state.themeOptions = { ...state.themeOptions, ...newObj };
182
+ // });
183
+ // },
184
+ setThemeSettings: (t) => {
185
+ n((e) => {
186
+ e.currentThemeSettings = { ...e.currentThemeSettings, ...t }, l(e), h(e);
187
+ });
188
+ },
189
+ onChangeMode: (t) => {
190
+ n((e) => {
191
+ e.currentThemeSettings = {
192
+ ...e.currentThemeSettings,
193
+ themeMode: t.target.value
194
+ }, l(e), h(e);
195
+ });
196
+ },
197
+ handleOpen: () => {
198
+ n((t) => {
199
+ t.open = !t.open;
200
+ });
201
+ },
202
+ onChangeDirection: (t) => {
203
+ n((e) => {
204
+ e.currentThemeSettings = {
205
+ ...e.currentThemeSettings,
206
+ themeDirection: t.target.value
207
+ }, l(e), h(e);
208
+ });
209
+ },
210
+ onChangeColor: (t) => {
211
+ n((e) => {
212
+ e.currentThemeSettings = {
213
+ ...e.currentThemeSettings,
214
+ themeColorPresets: t.target.value
215
+ }, l(e), h(e);
216
+ });
217
+ },
218
+ onChangeLayout: (t) => {
219
+ n((e) => {
220
+ e.currentThemeSettings = {
221
+ ...e.currentThemeSettings,
222
+ themeLayout: t.target.value
223
+ }, l(e), h(e);
224
+ });
225
+ },
226
+ onToggleStretch: () => {
227
+ n((t) => {
228
+ t.currentThemeSettings = {
229
+ ...t.currentThemeSettings,
230
+ themeStretch: !t.currentThemeSettings.themeStretch
231
+ }, l(t), h(t);
232
+ });
233
+ },
234
+ onResetSetting: () => {
235
+ n((t) => {
236
+ t.currentThemeSettings = {
237
+ ...S
238
+ }, l(t), h(t);
239
+ });
240
+ }
241
+ }
242
+ })),
243
+ { name: "ExampleStore" }
244
+ )
245
+ ), X = f(null);
246
+ function Q({
247
+ children: r,
248
+ themeSettings: n
249
+ }) {
250
+ const {
251
+ networkOperation: o
252
+ } = E(), [t, e] = M("theme_setting", {}), s = T();
253
+ return s.current || (s.current = K({
254
+ networkOperation: o,
255
+ currentThemeSettings: {
256
+ ...S,
257
+ ...n,
258
+ ...t
259
+ },
260
+ themeOptions: $,
261
+ colorOption: j.map((i) => ({
262
+ name: i.name,
263
+ value: i.main
264
+ })),
265
+ open: !1,
266
+ setterThemeSettings: n ? void 0 : e
267
+ }), s.current.getState().settingsActions.init()), /* @__PURE__ */ P(X.Provider, {
268
+ value: s.current,
269
+ children: r
270
+ });
271
+ }
272
+ export {
273
+ U as R,
274
+ X as T,
275
+ J as a,
276
+ Q as b,
277
+ S as d
278
+ };
@@ -0,0 +1,52 @@
1
+ import { useRef as n, useEffect as r, useState as i, useContext as u, useLayoutEffect as c } from "react";
2
+ import { H as m } from "../contexts/HostThemeContext/index-C5Z07fH1.js";
3
+ import { u as a } from "../node_modules-BHhXVwYT.js";
4
+ import { T as l } from "../contexts/index-CvzLutB3.js";
5
+ function S() {
6
+ const e = n(!0);
7
+ return r(
8
+ () => () => {
9
+ e.current = !1;
10
+ },
11
+ []
12
+ ), e;
13
+ }
14
+ function x(e) {
15
+ const [s, t] = i(!1), o = e || 100;
16
+ return r(() => (window.onscroll = () => {
17
+ window.pageYOffset > o ? t(!0) : t(!1);
18
+ }, () => {
19
+ window.onscroll = null;
20
+ }), [o]), s;
21
+ }
22
+ const h = () => {
23
+ const e = u(m);
24
+ if (!e) throw new Error("useHostTheme context must be use inside HostThemeProvider");
25
+ return e;
26
+ };
27
+ function b(e) {
28
+ const s = n(null);
29
+ return c(() => {
30
+ const t = s?.current;
31
+ if (!t)
32
+ return;
33
+ const o = new ResizeObserver((f) => {
34
+ e(t, f[0]);
35
+ });
36
+ return o.observe(t), () => {
37
+ o.disconnect();
38
+ };
39
+ }, [e, s.current]), s;
40
+ }
41
+ function g(e, s) {
42
+ const t = u(l);
43
+ if (!t) throw new Error("useSettingsStore context must be use inside SettignsContext");
44
+ return a(t, e, s);
45
+ }
46
+ export {
47
+ x as a,
48
+ h as b,
49
+ b as c,
50
+ g as d,
51
+ S as u
52
+ };
@@ -0,0 +1,10 @@
1
+ import { useContext as r } from "react";
2
+ import { F as e } from "../../contexts/FormatterContext/index-BHG3bJJo.js";
3
+ const m = () => {
4
+ const t = r(e);
5
+ if (!t) throw new Error("useFormatter context must be use inside FormatterProvider");
6
+ return t;
7
+ };
8
+ export {
9
+ m as u
10
+ };
@@ -1,5 +1,5 @@
1
1
  import { useState as n, useEffect as o } from "react";
2
- import { t as s } from "../../node_modules.9690bbee.js";
2
+ import { t as s } from "../../node_modules-BHhXVwYT.js";
3
3
  const t = () => typeof navigator > "u" ? !1 : /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), l = () => {
4
4
  const [i, r] = n(t());
5
5
  return o(() => {
@@ -0,0 +1,10 @@
1
+ import { useContext as o } from "react";
2
+ import { L as t } from "../../contexts/LocalesContext/index--VwMF60R.js";
3
+ const n = () => {
4
+ const e = o(t);
5
+ if (!e) throw new Error("useLocales context must be use inside LocalesProvider");
6
+ return e;
7
+ };
8
+ export {
9
+ n as u
10
+ };
@@ -1,11 +1,10 @@
1
1
  import { useContext as t } from "react";
2
- import { u as r } from "../../node_modules.9690bbee.js";
3
- import { R as n } from "../../contexts/index.d4e2c292.js";
2
+ import { u as r } from "../../node_modules-BHhXVwYT.js";
3
+ import { R as n } from "../../contexts/index-CvzLutB3.js";
4
4
  import { useResponsive as i } from "@m4l/styles";
5
5
  function f(e, s) {
6
6
  const o = t(n);
7
- if (!o)
8
- throw new Error("useAreasStore context must be use inside AreasContext");
7
+ if (!o) throw new Error("useAreasStore context must be use inside AreasContext");
9
8
  return r(o, e, s);
10
9
  }
11
10
  function c() {
package/index.js CHANGED
@@ -1,52 +1,40 @@
1
- import { G as l } from "./components/GlobalStyle/index.b7393a44.js";
2
- import { F as C, a as T } from "./contexts/FormatterContext/index.92336f4c.js";
3
- import { L as h, a as R, g as S } from "./contexts/LocalesContext/index.53f0b702.js";
4
- import { R as F, a as P, T as b, b as L, d as H } from "./contexts/index.d4e2c292.js";
5
- import { H as w, a as z } from "./contexts/HostThemeContext/index.89c85eb6.js";
6
- import { u as I } from "./hooks/useFirstRender/index.1e9b02fb.js";
7
- import { u as O } from "./hooks/useFormatter/index.57ac8cca.js";
8
- import { b as A, u as D, a as E, c as N, d as W } from "./hooks/index.953df5ed.js";
9
- import { u as q } from "./hooks/useLocales/index.d5a80aff.js";
10
- import { u as J, a as K } from "./hooks/useResponsive/index.49db561d.js";
11
- import { u as U } from "./hooks/useIsMobile/index.54bf37f7.js";
12
- import { C as X, g as Y } from "./utils/index.6909c662.js";
13
- import "@mui/material/styles";
14
- import "@mui/material";
15
- import "@m4l/styles";
16
- import "react/jsx-runtime";
17
- import "react";
18
- import "@m4l/core";
19
- import "@mui/x-date-pickers/AdapterDateFns";
20
- import "@mui/x-date-pickers";
21
- import "date-fns/locale/en-US";
22
- import "./node_modules.9690bbee.js";
23
- import "./commonjs.e3daa2e5.js";
24
- import "@mui/system";
1
+ import { G as s } from "./components/GlobalStyle/index-DHBkshRk.js";
2
+ import { L as r, a, g as i } from "./contexts/LocalesContext/index--VwMF60R.js";
3
+ import { F as m, a as p } from "./contexts/FormatterContext/index-BHG3bJJo.js";
4
+ import { R as x, a as f, T as d, b as l, d as v } from "./contexts/index-CvzLutB3.js";
5
+ import { H as T, a as g } from "./contexts/HostThemeContext/index-C5Z07fH1.js";
6
+ import { u as R } from "./hooks/useFirstRender/index-B-Q0TTn0.js";
7
+ import { u as c } from "./hooks/useFormatter/index-DfdAcbzw.js";
8
+ import { b as P, u as b, a as L, c as H, d as k } from "./hooks/index-Cg3zl6cl.js";
9
+ import { u as z } from "./hooks/useLocales/index-mTHn9nqY.js";
10
+ import { u as I, a as M } from "./hooks/useResponsive/index-Cq8kt3PV.js";
11
+ import { u as y } from "./hooks/useIsMobile/index-Bro0dV28.js";
12
+ import { C as D, g as E } from "./utils/index-DZG6QXjf.js";
25
13
  export {
26
- X as Capitalize,
27
- C as FormatterContext,
28
- T as FormatterProvider,
29
- l as GlobalStyles,
30
- w as HostThemeContext,
31
- z as HostThemeProvider,
32
- h as LocalesContext,
33
- R as LocalesProvider,
34
- F as ResponsiveContainerContext,
35
- P as ResponsiveContainerProvider,
36
- b as ThemeSettingsContext,
37
- L as ThemeSettingsProvider,
38
- H as defaultThemeSettings,
39
- Y as getAnchorElPositionWindow,
40
- S as getLocaleFromNetwork,
41
- I as useFirstRender,
42
- O as useFormatter,
43
- A as useHostTheme,
44
- U as useIsMobile,
45
- D as useIsMountedRef,
46
- q as useLocales,
47
- E as useOffSetTop,
48
- N as useResizeObserver,
49
- J as useResponsiveContainerStore,
50
- K as useResponsiveDesktop,
51
- W as useThemeSettingsStore
14
+ D as Capitalize,
15
+ m as FormatterContext,
16
+ p as FormatterProvider,
17
+ s as GlobalStyles,
18
+ T as HostThemeContext,
19
+ g as HostThemeProvider,
20
+ r as LocalesContext,
21
+ a as LocalesProvider,
22
+ x as ResponsiveContainerContext,
23
+ f as ResponsiveContainerProvider,
24
+ d as ThemeSettingsContext,
25
+ l as ThemeSettingsProvider,
26
+ v as defaultThemeSettings,
27
+ E as getAnchorElPositionWindow,
28
+ i as getLocaleFromNetwork,
29
+ R as useFirstRender,
30
+ c as useFormatter,
31
+ P as useHostTheme,
32
+ y as useIsMobile,
33
+ b as useIsMountedRef,
34
+ z as useLocales,
35
+ L as useOffSetTop,
36
+ H as useResizeObserver,
37
+ I as useResponsiveContainerStore,
38
+ M as useResponsiveDesktop,
39
+ k as useThemeSettingsStore
52
40
  };