@m4l/graphics 7.2.2 → 7.2.3-beta.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.
- package/index.d.ts +1 -0
- package/index.js +43 -43
- package/lib/graphics.d.ts +6 -0
- package/lib/graphics.d.ts.map +1 -0
- package/package.json +29 -57
- package/components/GlobalStyles/index.d.ts +0 -8
- package/components/GlobalStyles/index.js +0 -82
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/contexts/DeviceTypeContext/helper.d.ts +0 -9
- package/contexts/DeviceTypeContext/helper.js +0 -4
- package/contexts/DeviceTypeContext/index.d.ts +0 -15
- package/contexts/DeviceTypeContext/index.js +0 -18
- package/contexts/DeviceTypeContext/store.d.ts +0 -18
- package/contexts/DeviceTypeContext/store.js +0 -36
- package/contexts/DeviceTypeContext/types.d.ts +0 -36
- package/contexts/FormatterContext/index.d.ts +0 -12
- package/contexts/FormatterContext/index.js +0 -74
- package/contexts/FormatterContext/types.d.ts +0 -58
- package/contexts/HostThemeContext/index.d.ts +0 -11
- package/contexts/HostThemeContext/index.js +0 -46
- package/contexts/HostThemeContext/types.d.ts +0 -17
- package/contexts/LocalesContext/helper.d.ts +0 -25
- package/contexts/LocalesContext/helper.js +0 -35
- package/contexts/LocalesContext/index.d.ts +0 -11
- package/contexts/LocalesContext/index.js +0 -71
- package/contexts/LocalesContext/types.d.ts +0 -26
- package/contexts/ResponsiveContainerContext/constants.d.ts +0 -2
- package/contexts/ResponsiveContainerContext/constants.js +0 -4
- package/contexts/ResponsiveContainerContext/index.d.ts +0 -16
- package/contexts/ResponsiveContainerContext/index.js +0 -51
- package/contexts/ResponsiveContainerContext/store.d.ts +0 -18
- package/contexts/ResponsiveContainerContext/store.js +0 -33
- package/contexts/ResponsiveContainerContext/types.d.ts +0 -26
- package/contexts/ThemeSettingsContext/ThemeSettingsContext.d.ts +0 -19
- package/contexts/ThemeSettingsContext/ThemeSettingsContext.js +0 -32
- package/contexts/ThemeSettingsContext/constants.d.ts +0 -2
- package/contexts/ThemeSettingsContext/constants.js +0 -10
- package/contexts/ThemeSettingsContext/index.d.ts +0 -3
- package/contexts/ThemeSettingsContext/index.js +0 -1
- package/contexts/ThemeSettingsContext/store.d.ts +0 -19
- package/contexts/ThemeSettingsContext/store.js +0 -177
- package/contexts/ThemeSettingsContext/types.d.ts +0 -71
- package/contexts/index.d.ts +0 -12
- package/contexts/index.js +0 -1
- package/hooks/index.d.ts +0 -14
- package/hooks/index.js +0 -1
- package/hooks/useFirstRender/index.d.ts +0 -9
- package/hooks/useFirstRender/index.js +0 -10
- package/hooks/useFormatter/index.d.ts +0 -8
- package/hooks/useFormatter/index.js +0 -11
- package/hooks/useHostTheme/index.d.ts +0 -8
- package/hooks/useHostTheme/index.js +0 -11
- package/hooks/useIsMobile/index.d.ts +0 -14
- package/hooks/useIsMobile/index.js +0 -16
- package/hooks/useIsMountedRef/index.d.ts +0 -8
- package/hooks/useIsMountedRef/index.js +0 -13
- package/hooks/useLocales/index.d.ts +0 -8
- package/hooks/useLocales/index.js +0 -11
- package/hooks/useOffSetTop.d.ts +0 -8
- package/hooks/useOffSetTop.js +0 -12
- package/hooks/usePaginate/index.d.ts +0 -14
- package/hooks/usePaginate/index.js +0 -76
- package/hooks/usePaginate/index.test.d.ts +0 -35
- package/hooks/usePaginate/types.d.ts +0 -21
- package/hooks/usePaginate/types.js +0 -8
- package/hooks/useResizeObserver/index.d.ts +0 -9
- package/hooks/useResizeObserver/index.js +0 -18
- package/hooks/useResponsive/index.d.ts +0 -5
- package/hooks/useResponsive/index.js +0 -7
- package/hooks/useResponsiveContainer/index.d.ts +0 -6
- package/hooks/useResponsiveContainer/index.js +0 -12
- package/hooks/useRows/index.d.ts +0 -11
- package/hooks/useRows/index.js +0 -70
- package/hooks/useRows/index.test.d.ts +0 -1
- package/hooks/useRows/state.d.ts +0 -29
- package/hooks/useRows/state.js +0 -25
- package/hooks/useRows/state.test.d.ts +0 -1
- package/hooks/useRows/types.d.ts +0 -9
- package/hooks/useThemSettingsStore/index.d.ts +0 -9
- package/hooks/useThemSettingsStore/index.js +0 -12
- package/hooks/useUserAgent/index.d.ts +0 -4
- package/hooks/useUserAgent/index.js +0 -25
- package/test/setup.d.ts +0 -0
- package/test/utils.d.ts +0 -9
- package/utils/anchorEl.d.ts +0 -20
- package/utils/anchorEl.js +0 -49
- package/utils/getContrastTextColor/getContrastTextColor.d.ts +0 -5
- package/utils/getContrastTextColor/getContrastTextColor.js +0 -14
- package/utils/getContrastTextColor/index.d.ts +0 -2
- package/utils/getContrastTextColor/index.js +0 -1
- package/utils/getContrastTextColor/types.d.ts +0 -2
- package/utils/index.d.ts +0 -3
- package/utils/index.js +0 -1
- package/utils/strings.d.ts +0 -1
- package/utils/strings.js +0 -4
- package/vite-env.d.ts +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useContext as r } from "react";
|
|
2
|
-
import { useStore as n } from "zustand";
|
|
3
|
-
import { R as s } from "../../contexts/ResponsiveContainerContext/index.js";
|
|
4
|
-
function a(t, o) {
|
|
5
|
-
const e = r(s);
|
|
6
|
-
if (!e)
|
|
7
|
-
throw new Error("useAreasStore context must be use inside AreasContext");
|
|
8
|
-
return n(e, t, o);
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
a as u
|
|
12
|
-
};
|
package/hooks/useRows/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UseRowsProps } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para obtener las filas de la lista de elementos
|
|
4
|
-
*/
|
|
5
|
-
export declare const useRows: <TRow>(props: UseRowsProps<TRow>) => {
|
|
6
|
-
rows: TRow[];
|
|
7
|
-
clearRows: () => void;
|
|
8
|
-
refresh: () => void;
|
|
9
|
-
setRows: (rows: TRow[]) => void;
|
|
10
|
-
loading: boolean;
|
|
11
|
-
};
|
package/hooks/useRows/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useReducer as D, useRef as F, useCallback as i, useEffect as u } from "react";
|
|
2
|
-
import { useHostTools as I, useNetwork as W, useModuleSkeleton as b, useModuleDictionary as A } from "@m4l/core";
|
|
3
|
-
import { u as G } from "../useFirstRender/index.js";
|
|
4
|
-
import { r as M, g as H, s as q } from "./state.js";
|
|
5
|
-
const v = (R) => {
|
|
6
|
-
const {
|
|
7
|
-
endPoint: y,
|
|
8
|
-
timeout: m = 5e3,
|
|
9
|
-
queryParams: s,
|
|
10
|
-
fireOnChangeParms: n = !1,
|
|
11
|
-
fireOnFirstLoad: S = !0,
|
|
12
|
-
startProgress: g,
|
|
13
|
-
stopProgress: h,
|
|
14
|
-
isRemote: E = !0,
|
|
15
|
-
bodyToSnakeCase: P = !1,
|
|
16
|
-
responseToCamelCase: O = !1,
|
|
17
|
-
initialRows: T = [],
|
|
18
|
-
onNetworkError: l,
|
|
19
|
-
refreshOnChangeDictionary: c = !1
|
|
20
|
-
} = R, [t, e] = D(
|
|
21
|
-
M,
|
|
22
|
-
H(n, S, T)
|
|
23
|
-
), { startProgress: w, stopProgress: C } = I(), { networkOperation: k } = W(), f = b(), { getLabel: _ } = A(), p = F(s), d = G([s]), r = i(() => {
|
|
24
|
-
e({ type: "INCREMENT_REFRESH" });
|
|
25
|
-
}, []);
|
|
26
|
-
u(() => {
|
|
27
|
-
q(d, t, s, p.current, n) && r(), p.current = s;
|
|
28
|
-
}, [s, d, t, n, r]), u(() => {
|
|
29
|
-
let o = !0;
|
|
30
|
-
if (t.countRefresh !== 0)
|
|
31
|
-
return e({ type: "SET_LOADING", payload: !0 }), k({
|
|
32
|
-
method: "GET",
|
|
33
|
-
endPoint: y,
|
|
34
|
-
timeout: m,
|
|
35
|
-
parms: {
|
|
36
|
-
...s
|
|
37
|
-
},
|
|
38
|
-
bodyToSnakeCase: P,
|
|
39
|
-
responseToCamelCase: O,
|
|
40
|
-
options: {
|
|
41
|
-
startProgress: g || w,
|
|
42
|
-
stopProgress: h || C
|
|
43
|
-
},
|
|
44
|
-
isRemote: E
|
|
45
|
-
}).then((a) => {
|
|
46
|
-
o && e({ type: "SET_ROWS", payload: a.data });
|
|
47
|
-
}).catch((a) => {
|
|
48
|
-
e({ type: "SET_ROWS", payload: [] }), l && l(a.status);
|
|
49
|
-
}).finally(() => {
|
|
50
|
-
e({ type: "SET_LOADING", payload: !1 });
|
|
51
|
-
}), function() {
|
|
52
|
-
o = !1;
|
|
53
|
-
};
|
|
54
|
-
}, [t.countRefresh]), u(() => {
|
|
55
|
-
!f && c && r();
|
|
56
|
-
}, [_, c, f]);
|
|
57
|
-
const N = i(() => {
|
|
58
|
-
e({ type: "CLEAR_ROWS" });
|
|
59
|
-
}, []), L = i((o) => e({ type: "SET_ROWS", payload: o }), [e]);
|
|
60
|
-
return {
|
|
61
|
-
rows: t.rows,
|
|
62
|
-
clearRows: N,
|
|
63
|
-
refresh: r,
|
|
64
|
-
setRows: L,
|
|
65
|
-
loading: t.loading
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
export {
|
|
69
|
-
v as u
|
|
70
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/hooks/useRows/state.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface State<TRow> {
|
|
2
|
-
countRefresh: number;
|
|
3
|
-
rows: TRow[];
|
|
4
|
-
fireOnFirstLoad: boolean;
|
|
5
|
-
loading: boolean;
|
|
6
|
-
}
|
|
7
|
-
export type Action<TRow> = {
|
|
8
|
-
type: 'INCREMENT_REFRESH';
|
|
9
|
-
} | {
|
|
10
|
-
type: 'SET_ROWS';
|
|
11
|
-
payload: TRow[];
|
|
12
|
-
} | {
|
|
13
|
-
type: 'SET_LOADING';
|
|
14
|
-
payload: boolean;
|
|
15
|
-
} | {
|
|
16
|
-
type: 'CLEAR_ROWS';
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Obtiene el estado inicial de la lista de elementos
|
|
20
|
-
*/
|
|
21
|
-
export declare const getInitialState: <TRow>(fireOnChangeParms: boolean, fireOnFirstLoad: boolean, initialRows: TRow[]) => State<TRow>;
|
|
22
|
-
/**
|
|
23
|
-
* Reducer para actualizar el estado de la lista de elementos
|
|
24
|
-
*/
|
|
25
|
-
export declare const reducer: <TRow>(state: State<TRow>, action: Action<TRow>) => State<TRow>;
|
|
26
|
-
/**
|
|
27
|
-
* Verifica si se debe actualizar la lista de elementos
|
|
28
|
-
*/
|
|
29
|
-
export declare const shouldRefresh: <T>(isFirstRender: boolean, state: State<T>, currentParams: any, previousParams: any, fireOnChangeParms: boolean) => boolean;
|
package/hooks/useRows/state.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { deepEqual as n } from "fast-equals";
|
|
2
|
-
const t = (r, e, u) => ({
|
|
3
|
-
countRefresh: r ? 1 : 0,
|
|
4
|
-
rows: u,
|
|
5
|
-
fireOnFirstLoad: e,
|
|
6
|
-
loading: !1
|
|
7
|
-
}), f = (r, e) => {
|
|
8
|
-
switch (e.type) {
|
|
9
|
-
case "INCREMENT_REFRESH":
|
|
10
|
-
return { ...r, countRefresh: r.countRefresh + 1 };
|
|
11
|
-
case "SET_ROWS":
|
|
12
|
-
return { ...r, rows: e.payload };
|
|
13
|
-
case "SET_LOADING":
|
|
14
|
-
return { ...r, loading: e.payload };
|
|
15
|
-
case "CLEAR_ROWS":
|
|
16
|
-
return { ...r, rows: [] };
|
|
17
|
-
default:
|
|
18
|
-
return r;
|
|
19
|
-
}
|
|
20
|
-
}, c = (r, e, u, o, s) => !!(r && e.fireOnFirstLoad || !r && !n(o, u) && s);
|
|
21
|
-
export {
|
|
22
|
-
t as g,
|
|
23
|
-
f as r,
|
|
24
|
-
c as s
|
|
25
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/hooks/useRows/types.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AxiosOptions, NetworkProps } from '@m4l/core';
|
|
2
|
-
export interface UseRowsProps<TRow> extends Pick<NetworkProps, 'endPoint' | 'timeout' | 'isRemote' | 'bodyToSnakeCase' | 'responseToCamelCase'>, AxiosOptions {
|
|
3
|
-
fireOnChangeParms?: boolean;
|
|
4
|
-
fireOnFirstLoad?: boolean;
|
|
5
|
-
queryParams: Record<string, unknown>;
|
|
6
|
-
initialRows?: TRow[];
|
|
7
|
-
onNetworkError?: (code: number) => void;
|
|
8
|
-
refreshOnChangeDictionary?: boolean;
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ThemeSettingsStateWithActions } from '../../contexts/ThemeSettingsContext/types';
|
|
2
|
-
/**
|
|
3
|
-
* Hook to use the settings store
|
|
4
|
-
* @author Juan Escobar - automatic
|
|
5
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
6
|
-
* @updatedAt 2024-10-06 20:07:18 - automatic
|
|
7
|
-
* @updatedUser Juan Escobar - automatic
|
|
8
|
-
*/
|
|
9
|
-
export declare function useThemeSettingsStore<T>(selector: (state: ThemeSettingsStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useContext as r } from "react";
|
|
2
|
-
import { useStore as n } from "zustand";
|
|
3
|
-
import { T as s } from "../../contexts/ThemeSettingsContext/ThemeSettingsContext.js";
|
|
4
|
-
function S(e, o) {
|
|
5
|
-
const t = r(s);
|
|
6
|
-
if (!t)
|
|
7
|
-
throw new Error("useSettingsStore context must be use inside SettignsContext");
|
|
8
|
-
return n(t, e, o);
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
S as u
|
|
12
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { debounce as s } from "@mui/material";
|
|
2
|
-
import { useSyncExternalStore as o } from "react";
|
|
3
|
-
const t = () => navigator.userAgent, i = (e) => {
|
|
4
|
-
const n = s(
|
|
5
|
-
() => {
|
|
6
|
-
e(navigator.userAgent);
|
|
7
|
-
},
|
|
8
|
-
500
|
|
9
|
-
), r = () => {
|
|
10
|
-
e(navigator.userAgent);
|
|
11
|
-
};
|
|
12
|
-
return window.addEventListener("userAgentChange", r), window.addEventListener("resize", n), () => {
|
|
13
|
-
window.removeEventListener("userAgentChange", r), window.removeEventListener("resize", n);
|
|
14
|
-
};
|
|
15
|
-
}, u = () => o(
|
|
16
|
-
i,
|
|
17
|
-
// Función de suscripción
|
|
18
|
-
t,
|
|
19
|
-
// Función para obtener el estado actual
|
|
20
|
-
t
|
|
21
|
-
// (Opcional) Función para obtener el valor en SSR
|
|
22
|
-
);
|
|
23
|
-
export {
|
|
24
|
-
u
|
|
25
|
-
};
|
package/test/setup.d.ts
DELETED
|
File without changes
|
package/test/utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { cleanup, screen } from '@testing-library/react';
|
|
2
|
-
import { renderHook } from '@testing-library/react-hooks';
|
|
3
|
-
import { default as React, act } from 'react';
|
|
4
|
-
/**
|
|
5
|
-
* customRender
|
|
6
|
-
*/
|
|
7
|
-
declare const customRender: (ui: React.ReactElement, options?: {}) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
8
|
-
export { default as userEvent } from '@testing-library/user-event';
|
|
9
|
-
export { customRender as render, renderHook, screen, cleanup, act };
|
package/utils/anchorEl.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type AnchorEl = HTMLElement | (() => HTMLElement);
|
|
2
|
-
export interface AnchorOrigin {
|
|
3
|
-
vertical: 'top' | 'center' | 'bottom' | number;
|
|
4
|
-
horizontal: 'left' | 'center' | 'right' | number;
|
|
5
|
-
}
|
|
6
|
-
export interface AnchorPosition {
|
|
7
|
-
top: number;
|
|
8
|
-
left: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Get the position of the element based on the anchor element
|
|
12
|
-
* @author Juan Escobar - automatic
|
|
13
|
-
* @createdAt 2024-10-06 20:06:37 - automatic
|
|
14
|
-
* @updatedAt 2024-10-06 20:06:38 - automatic
|
|
15
|
-
* @updatedUser Juan Escobar - automatic
|
|
16
|
-
*/
|
|
17
|
-
export declare const getAnchorElPositionWindow: (anchorElement: HTMLElement, newWindowRect: Pick<DOMRect, "width" | "height">, anchorOrigin: AnchorOrigin, transformOrigin: AnchorOrigin, marginThreshold?: number) => {
|
|
18
|
-
top: number;
|
|
19
|
-
left: number;
|
|
20
|
-
};
|
package/utils/anchorEl.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function a(e, t) {
|
|
2
|
-
let o = 0;
|
|
3
|
-
return typeof t == "number" ? o = t : t === "center" ? o = e.height / 2 : t === "bottom" && (o = e.height), o;
|
|
4
|
-
}
|
|
5
|
-
function b(e, t) {
|
|
6
|
-
let o = 0;
|
|
7
|
-
return typeof t == "number" ? o = t : t === "center" ? o = e.width / 2 : t === "right" && (o = e.width), o;
|
|
8
|
-
}
|
|
9
|
-
function v(e) {
|
|
10
|
-
return typeof e == "function" ? e() : e;
|
|
11
|
-
}
|
|
12
|
-
const w = (e, t) => {
|
|
13
|
-
const f = v(e).getBoundingClientRect();
|
|
14
|
-
return {
|
|
15
|
-
top: f.top + a(f, t.vertical),
|
|
16
|
-
left: f.left + b(f, t.horizontal)
|
|
17
|
-
};
|
|
18
|
-
}, y = (e, t) => ({
|
|
19
|
-
vertical: a(e, t.vertical),
|
|
20
|
-
horizontal: b(e, t.horizontal)
|
|
21
|
-
}), O = (e, t, o, f, i = 16) => {
|
|
22
|
-
const r = w(e, o), l = y(t, f), h = document.getElementById("ContainerAreas")?.getBoundingClientRect() || {
|
|
23
|
-
top: 0,
|
|
24
|
-
left: 0
|
|
25
|
-
};
|
|
26
|
-
let s = r.top - l.vertical, c = r.left - l.horizontal;
|
|
27
|
-
const u = s + t.height, d = c + t.width, g = window, p = g.innerHeight - i, A = g.innerWidth - i;
|
|
28
|
-
if (s < i) {
|
|
29
|
-
const n = s - i;
|
|
30
|
-
s -= n;
|
|
31
|
-
} else if (u > p) {
|
|
32
|
-
const n = u - p;
|
|
33
|
-
s -= n;
|
|
34
|
-
}
|
|
35
|
-
if (c < i) {
|
|
36
|
-
const n = c - i;
|
|
37
|
-
c -= n;
|
|
38
|
-
} else if (d > A) {
|
|
39
|
-
const n = d - A;
|
|
40
|
-
c -= n;
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
top: Math.round(s) - h.top,
|
|
44
|
-
left: Math.round(c) - h.left
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
O as g
|
|
49
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const e = /* @__PURE__ */ new Map();
|
|
2
|
-
function u(r, n = !0) {
|
|
3
|
-
try {
|
|
4
|
-
if (n && e.has(r))
|
|
5
|
-
return e.get(r);
|
|
6
|
-
const t = r.replace("#", ""), s = t.length === 3 ? t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, c = parseInt(s.substr(0, 2), 16) * 299, a = parseInt(s.substr(2, 2), 16) * 587, f = parseInt(s.substr(4, 2), 16) * 114, o = c + a + f > 128e3 ? "#000000" : "#ffffff";
|
|
7
|
-
return n && e.set(r, o), o;
|
|
8
|
-
} catch {
|
|
9
|
-
return "#000000";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
u as g
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/utils/index.d.ts
DELETED
package/utils/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/utils/strings.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const capitalize: (s: string) => string;
|
package/utils/strings.js
DELETED
package/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|