@m4l/graphics 0.1.50 → 0.1.51
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/contexts/index.d.ts +0 -1
- package/hooks/index.33d67709.js +45 -0
- package/hooks/index.d.ts +0 -1
- package/hooks/useResizeObserver/index.d.ts +2 -2
- package/hooks/useResponsive/index.1409e387.js +7 -0
- package/index.js +28 -34
- package/package.json +1 -1
- package/commonjs.e3daa2e5.js +0 -9
- package/contexts/ResponsiveRelativeContext/constants.d.ts +0 -2
- package/contexts/ResponsiveRelativeContext/index.b1f839dc.js +0 -60
- package/contexts/ResponsiveRelativeContext/index.d.ts +0 -13
- package/contexts/ResponsiveRelativeContext/store.d.ts +0 -11
- package/contexts/ResponsiveRelativeContext/types.d.ts +0 -26
- package/hooks/index.9e1fde8c.js +0 -44
- package/hooks/useResponsive/index.d90a6b52.js +0 -17
- package/hooks/useResponsiveRelative/index.d.ts +0 -2
- package/node_modules.56b5d6e3.js +0 -4438
package/contexts/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './FormatterContext';
|
|
2
2
|
export type { Formatters, DateFormatter, NumberFormatter, CurrencyFormatter, } from './FormatterContext/types';
|
|
3
3
|
export * from './LocalesContext';
|
|
4
|
-
export * from './ResponsiveRelativeContext';
|
|
5
4
|
export type { NetworkLocaleType, LocaleType } from './LocalesContext/types';
|
|
6
5
|
export { getLocaleFromNetwork } from './LocalesContext/helper';
|
|
7
6
|
export * from './HostThemeContext';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useRef as n, useEffect as r, useState as f, useContext as c, useLayoutEffect as i } from "react";
|
|
2
|
+
import { H as l } from "../contexts/HostThemeContext/index.4291ba89.js";
|
|
3
|
+
function w() {
|
|
4
|
+
const e = n(!0);
|
|
5
|
+
return r(
|
|
6
|
+
() => () => {
|
|
7
|
+
e.current = !1;
|
|
8
|
+
},
|
|
9
|
+
[]
|
|
10
|
+
), e;
|
|
11
|
+
}
|
|
12
|
+
function d(e) {
|
|
13
|
+
const [s, t] = f(!1), o = e || 100;
|
|
14
|
+
return r(() => (window.onscroll = () => {
|
|
15
|
+
window.pageYOffset > o ? t(!0) : t(!1);
|
|
16
|
+
}, () => {
|
|
17
|
+
window.onscroll = null;
|
|
18
|
+
}), [o]), s;
|
|
19
|
+
}
|
|
20
|
+
const p = () => {
|
|
21
|
+
const e = c(l);
|
|
22
|
+
if (!e)
|
|
23
|
+
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
24
|
+
return e;
|
|
25
|
+
};
|
|
26
|
+
function T(e) {
|
|
27
|
+
const s = n(null);
|
|
28
|
+
return i(() => {
|
|
29
|
+
const t = s?.current;
|
|
30
|
+
if (!t)
|
|
31
|
+
return;
|
|
32
|
+
const o = new ResizeObserver((u) => {
|
|
33
|
+
e(t, u[0]);
|
|
34
|
+
});
|
|
35
|
+
return o.observe(t), () => {
|
|
36
|
+
o.disconnect();
|
|
37
|
+
};
|
|
38
|
+
}, [e, s.current]), s;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
d as a,
|
|
42
|
+
p as b,
|
|
43
|
+
T as c,
|
|
44
|
+
w as u
|
|
45
|
+
};
|
package/hooks/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { useFirstRender } from './useFirstRender';
|
|
|
2
2
|
export { useFormatter } from './useFormatter';
|
|
3
3
|
export { useIsMountedRef } from './useIsMountedRef';
|
|
4
4
|
export { useLocales } from './useLocales';
|
|
5
|
-
export { useResponsiveRelativeStore } from './useResponsiveRelative';
|
|
6
5
|
export { useOffSetTop } from './useOffSetTop';
|
|
7
6
|
export { useHostTheme } from './useHostTheme';
|
|
8
7
|
export { useResizeObserver } from './useResizeObserver';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useResizeObserver<T extends HTMLElement>(callback: (target: T, entry: ResizeObserverEntry) => void
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function useResizeObserver<T extends HTMLElement>(callback: (target: T, entry: ResizeObserverEntry) => void): import("react").RefObject<T>;
|
|
3
3
|
export default useResizeObserver;
|
package/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
import { L as
|
|
3
|
-
import { F, a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as z } from "./hooks/
|
|
8
|
-
import {
|
|
9
|
-
import { u as
|
|
10
|
-
import {
|
|
11
|
-
import { C as q, g as B } from "./utils/index.6909c662.js";
|
|
1
|
+
import { G as x } from "./components/GlobalStyle/index.fff91e86.js";
|
|
2
|
+
import { L as n, a as c, g as d } from "./contexts/LocalesContext/index.53f0b702.js";
|
|
3
|
+
import { F as v, a as C } from "./contexts/FormatterContext/index.92336f4c.js";
|
|
4
|
+
import { H as g, a as h } from "./contexts/HostThemeContext/index.4291ba89.js";
|
|
5
|
+
import { u as P } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
6
|
+
import { u as T } from "./hooks/useFormatter/index.57ac8cca.js";
|
|
7
|
+
import { b as k, u as w, a as z, c as G } from "./hooks/index.33d67709.js";
|
|
8
|
+
import { u as S } from "./hooks/useLocales/index.d5a80aff.js";
|
|
9
|
+
import { u as A } from "./hooks/useResponsive/index.1409e387.js";
|
|
10
|
+
import { C as E, g as I } from "./utils/index.6909c662.js";
|
|
12
11
|
import "@mui/material/styles";
|
|
13
12
|
import "@mui/material";
|
|
14
13
|
import "@m4l/styles";
|
|
@@ -18,28 +17,23 @@ import "@mui/x-date-pickers/AdapterDateFns";
|
|
|
18
17
|
import "@mui/x-date-pickers";
|
|
19
18
|
import "@m4l/core";
|
|
20
19
|
import "date-fns/locale/en-US";
|
|
21
|
-
import "./node_modules.56b5d6e3.js";
|
|
22
|
-
import "./commonjs.e3daa2e5.js";
|
|
23
20
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
k as
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
A as
|
|
42
|
-
D as useResizeObserver,
|
|
43
|
-
N as useResponsiveDesktop,
|
|
44
|
-
W as useResponsiveRelativeStore
|
|
21
|
+
E as Capitalize,
|
|
22
|
+
v as FormatterContext,
|
|
23
|
+
C as FormatterProvider,
|
|
24
|
+
x as GlobalStyles,
|
|
25
|
+
g as HostThemeContext,
|
|
26
|
+
h as HostThemeProvider,
|
|
27
|
+
n as LocalesContext,
|
|
28
|
+
c as LocalesProvider,
|
|
29
|
+
I as getAnchorElPositionWindow,
|
|
30
|
+
d as getLocaleFromNetwork,
|
|
31
|
+
P as useFirstRender,
|
|
32
|
+
T as useFormatter,
|
|
33
|
+
k as useHostTheme,
|
|
34
|
+
w as useIsMountedRef,
|
|
35
|
+
S as useLocales,
|
|
36
|
+
z as useOffSetTop,
|
|
37
|
+
G as useResizeObserver,
|
|
38
|
+
A as useResponsiveDesktop
|
|
45
39
|
};
|
package/package.json
CHANGED
package/commonjs.e3daa2e5.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
var l = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
3
|
-
function t(e) {
|
|
4
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
5
|
-
}
|
|
6
|
-
export {
|
|
7
|
-
l as c,
|
|
8
|
-
t as g
|
|
9
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { createContext as m, useRef as p, useMemo as u, useCallback as d } from "react";
|
|
2
|
-
import { c as f, d as k, i as b, l as h } from "../../node_modules.56b5d6e3.js";
|
|
3
|
-
import { jsx as g } from "react/jsx-runtime";
|
|
4
|
-
import { u as x } from "../../hooks/index.9e1fde8c.js";
|
|
5
|
-
const v = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, P = (r) => {
|
|
6
|
-
const s = {
|
|
7
|
-
...r
|
|
8
|
-
};
|
|
9
|
-
return f(
|
|
10
|
-
k(
|
|
11
|
-
b((t, e) => ({
|
|
12
|
-
...s,
|
|
13
|
-
responsiveRelativeActions: {
|
|
14
|
-
setBreakpoint: (o) => {
|
|
15
|
-
t(
|
|
16
|
-
(n) => {
|
|
17
|
-
n.breakPoint = o;
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
})),
|
|
23
|
-
{ name: "Responsive Relative Store" }
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
}, S = m(null), C = (r) => {
|
|
27
|
-
const {
|
|
28
|
-
children: s,
|
|
29
|
-
observedDivRef: t
|
|
30
|
-
} = r, e = p();
|
|
31
|
-
e.current || (e.current = P({
|
|
32
|
-
breakPoint: "md"
|
|
33
|
-
}));
|
|
34
|
-
const o = u(() => () => {
|
|
35
|
-
const i = t.current;
|
|
36
|
-
if (i instanceof HTMLElement && i.clientWidth) {
|
|
37
|
-
const l = Object.keys(v);
|
|
38
|
-
for (let a = 0; a < l.length; a++) {
|
|
39
|
-
const c = l[a];
|
|
40
|
-
if (i.clientWidth <= v[c] && c !== e.current?.getState().breakPoint) {
|
|
41
|
-
e.current?.getState().responsiveRelativeActions.setBreakpoint(c);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}, []), n = h.exports.throttle(o, 200, {
|
|
47
|
-
leading: !1,
|
|
48
|
-
trailing: !0
|
|
49
|
-
}), R = d(() => {
|
|
50
|
-
n();
|
|
51
|
-
}, [e.current]);
|
|
52
|
-
return x(R, t), /* @__PURE__ */ g(S.Provider, {
|
|
53
|
-
value: e.current,
|
|
54
|
-
children: s
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
S as R,
|
|
59
|
-
C as a
|
|
60
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ResponsiveRelativeProviderProps } from './types';
|
|
3
|
-
declare const ResponsiveRelativeContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./types").ResponsiveRelativeStateWithActions>, "setState"> & {
|
|
4
|
-
setState<A extends string | {
|
|
5
|
-
type: unknown;
|
|
6
|
-
}>(partial: import("./types").ResponsiveRelativeStateWithActions | Partial<import("./types").ResponsiveRelativeStateWithActions> | ((state: import("./types").ResponsiveRelativeStateWithActions) => import("./types").ResponsiveRelativeStateWithActions | Partial<import("./types").ResponsiveRelativeStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
7
|
-
}, "setState"> & {
|
|
8
|
-
setState(nextStateOrUpdater: import("./types").ResponsiveRelativeStateWithActions | Partial<import("./types").ResponsiveRelativeStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<import("./types").ResponsiveRelativeStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
9
|
-
type: unknown;
|
|
10
|
-
} | undefined): void;
|
|
11
|
-
}) | null>;
|
|
12
|
-
declare const ResponsiveRelativeProvider: (props: ResponsiveRelativeProviderProps) => import("react").JSX.Element;
|
|
13
|
-
export { ResponsiveRelativeProvider, ResponsiveRelativeContext };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InitialResponsiveRelativeProps, ResponsiveRelativeStateWithActions } from './types';
|
|
2
|
-
export declare const createResponsiveRelativeStore: (initProps: InitialResponsiveRelativeProps) => Omit<Omit<import("zustand").StoreApi<ResponsiveRelativeStateWithActions>, "setState"> & {
|
|
3
|
-
setState<A extends string | {
|
|
4
|
-
type: unknown;
|
|
5
|
-
}>(partial: ResponsiveRelativeStateWithActions | Partial<ResponsiveRelativeStateWithActions> | ((state: ResponsiveRelativeStateWithActions) => ResponsiveRelativeStateWithActions | Partial<ResponsiveRelativeStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
6
|
-
}, "setState"> & {
|
|
7
|
-
setState(nextStateOrUpdater: ResponsiveRelativeStateWithActions | Partial<ResponsiveRelativeStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<ResponsiveRelativeStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
8
|
-
type: unknown;
|
|
9
|
-
} | undefined): void;
|
|
10
|
-
};
|
|
11
|
-
export declare type ResponsiveRelativeStore = ReturnType<typeof createResponsiveRelativeStore>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare type BreakpointType = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
-
export declare type BreakPointsType = Record<BreakpointType, number>;
|
|
4
|
-
export interface ResponsiveRelativeContextProps {
|
|
5
|
-
breakPoint: BreakpointType;
|
|
6
|
-
}
|
|
7
|
-
export interface ResponsiveRelativeProviderProps {
|
|
8
|
-
observedDivRef: React.RefObject<HTMLElement>;
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
}
|
|
11
|
-
export declare type CurrentState = {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
mounted: boolean;
|
|
15
|
-
breakpoint: BreakpointType;
|
|
16
|
-
};
|
|
17
|
-
export interface ResponsiveRelativeState {
|
|
18
|
-
breakPoint: BreakpointType;
|
|
19
|
-
}
|
|
20
|
-
export interface InitialResponsiveRelativeProps extends Pick<ResponsiveRelativeState, 'breakPoint'> {
|
|
21
|
-
}
|
|
22
|
-
export interface ResponsiveRelativeStateWithActions extends ResponsiveRelativeState {
|
|
23
|
-
responsiveRelativeActions: {
|
|
24
|
-
setBreakpoint: (breakPoint: BreakpointType) => void;
|
|
25
|
-
};
|
|
26
|
-
}
|
package/hooks/index.9e1fde8c.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useRef as u, useEffect as n, useState as f, useContext as c, useLayoutEffect as i } from "react";
|
|
2
|
-
import { H as a } from "../contexts/HostThemeContext/index.4291ba89.js";
|
|
3
|
-
function w() {
|
|
4
|
-
const e = u(!0);
|
|
5
|
-
return n(
|
|
6
|
-
() => () => {
|
|
7
|
-
e.current = !1;
|
|
8
|
-
},
|
|
9
|
-
[]
|
|
10
|
-
), e;
|
|
11
|
-
}
|
|
12
|
-
function d(e) {
|
|
13
|
-
const [o, t] = f(!1), s = e || 100;
|
|
14
|
-
return n(() => (window.onscroll = () => {
|
|
15
|
-
window.pageYOffset > s ? t(!0) : t(!1);
|
|
16
|
-
}, () => {
|
|
17
|
-
window.onscroll = null;
|
|
18
|
-
}), [s]), o;
|
|
19
|
-
}
|
|
20
|
-
const p = () => {
|
|
21
|
-
const e = c(a);
|
|
22
|
-
if (!e)
|
|
23
|
-
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
24
|
-
return e;
|
|
25
|
-
};
|
|
26
|
-
function T(e, o) {
|
|
27
|
-
i(() => {
|
|
28
|
-
const t = o?.current;
|
|
29
|
-
if (!t)
|
|
30
|
-
return;
|
|
31
|
-
const s = new ResizeObserver((r) => {
|
|
32
|
-
e(t, r[0]);
|
|
33
|
-
});
|
|
34
|
-
return s.observe(t), () => {
|
|
35
|
-
s.disconnect();
|
|
36
|
-
};
|
|
37
|
-
}, [e, o.current]);
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
w as a,
|
|
41
|
-
d as b,
|
|
42
|
-
p as c,
|
|
43
|
-
T as u
|
|
44
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useContext as o } from "react";
|
|
2
|
-
import { u as r } from "../../node_modules.56b5d6e3.js";
|
|
3
|
-
import { R as n } from "../../contexts/ResponsiveRelativeContext/index.b1f839dc.js";
|
|
4
|
-
import { useResponsive as i } from "@m4l/styles";
|
|
5
|
-
function f(e, t) {
|
|
6
|
-
const s = o(n);
|
|
7
|
-
if (!s)
|
|
8
|
-
throw new Error("useAreasStore context must be use inside AreasContext");
|
|
9
|
-
return r(s, e, t);
|
|
10
|
-
}
|
|
11
|
-
function R() {
|
|
12
|
-
return i("up", "sm");
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
R as a,
|
|
16
|
-
f as u
|
|
17
|
-
};
|