@m4l/graphics 0.1.32 → 0.1.34
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 +1 -0
- package/hooks/useFirstRender/index.d.ts +2 -1
- package/hooks/useHostTheme/index.d.ts +1 -1
- package/index.js +23 -22
- package/package.json +1 -1
- package/utils/anchorEl.d.ts +13 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.e35c6547.js +56 -0
- package/utils/index.54cae015.js +0 -4
package/contexts/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export * from './LocalesContext';
|
|
|
4
4
|
export type { NetworkLocaleType, LocaleType } from './LocalesContext/types';
|
|
5
5
|
export { getLocaleFromNetwork } from './LocalesContext/helper';
|
|
6
6
|
export * from './HostThemeContext';
|
|
7
|
+
export type { HostThemeType } from './HostThemeContext/types';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
export declare function useFirstRender(dependencies?: DependencyList): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useHostTheme: () => import("
|
|
1
|
+
export declare const useHostTheme: () => import("../..").HostThemeType;
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { P as x } from "./components/ProgressBarStyle/index.fb6fd9ed.js";
|
|
2
|
-
import { F as l, a as
|
|
3
|
-
import { L as
|
|
4
|
-
import { H as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { b as
|
|
2
|
+
import { F as l, a as d } from "./contexts/FormatterContext/index.92336f4c.js";
|
|
3
|
+
import { L as P, a as c, g } from "./contexts/LocalesContext/index.5b555637.js";
|
|
4
|
+
import { H as C, a as L } from "./contexts/HostThemeContext/index.9fe9854f.js";
|
|
5
|
+
import { u as H } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
6
|
+
import { u as T } from "./hooks/useFormatter/index.57ac8cca.js";
|
|
7
|
+
import { b as w, u as S, a as b } from "./hooks/index.64cf4fc4.js";
|
|
8
8
|
import { u as z } from "./hooks/useLocales/index.f676279e.js";
|
|
9
|
-
import { u as
|
|
10
|
-
import { C as
|
|
9
|
+
import { u as B, a as D } from "./hooks/useResponsive/index.fc5e1b4f.js";
|
|
10
|
+
import { C as I, g as M } from "./utils/index.e35c6547.js";
|
|
11
11
|
import "@mui/material/styles";
|
|
12
12
|
import "@mui/material";
|
|
13
13
|
import "react/jsx-runtime";
|
|
@@ -18,21 +18,22 @@ import "@mui/x-date-pickers";
|
|
|
18
18
|
import "date-fns/locale/en-US";
|
|
19
19
|
import "@mui/material/useMediaQuery";
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
I as Capitalize,
|
|
22
22
|
l as FormatterContext,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
d as FormatterProvider,
|
|
24
|
+
C as HostThemeContext,
|
|
25
|
+
L as HostThemeProvider,
|
|
26
|
+
P as LocalesContext,
|
|
27
|
+
c as LocalesProvider,
|
|
28
28
|
x as ProgressBarStyle,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
M as getAnchorElPositionWindow,
|
|
30
|
+
g as getLocaleFromNetwork,
|
|
31
|
+
H as useFirstRender,
|
|
32
|
+
T as useFormatter,
|
|
33
|
+
w as useHostTheme,
|
|
34
|
+
S as useIsMountedRef,
|
|
34
35
|
z as useLocales,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
b as useOffSetTop,
|
|
37
|
+
B as useResponsive,
|
|
38
|
+
D as useResponsiveDesktop
|
|
38
39
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare 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
|
+
export declare const getAnchorElPositionWindow: (anchorElement: HTMLElement, newWindowRect: Pick<DOMRect, 'width' | 'height'>, anchorOrigin: AnchorOrigin, transformOrigin: AnchorOrigin, marginThreshold?: number) => {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
};
|
package/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const v = (t) => t && t[0].toUpperCase() + t.slice(1) || "";
|
|
2
|
+
function A(t, e) {
|
|
3
|
+
let o = 0;
|
|
4
|
+
return typeof e == "number" ? o = e : e === "center" ? o = t.height / 2 : e === "bottom" && (o = t.height), o;
|
|
5
|
+
}
|
|
6
|
+
function C(t, e) {
|
|
7
|
+
let o = 0;
|
|
8
|
+
return typeof e == "number" ? o = e : e === "center" ? o = t.width / 2 : e === "right" && (o = t.width), o;
|
|
9
|
+
}
|
|
10
|
+
function O(t) {
|
|
11
|
+
return typeof t == "function" ? t() : t;
|
|
12
|
+
}
|
|
13
|
+
const b = (t, e) => {
|
|
14
|
+
const i = O(t).getBoundingClientRect();
|
|
15
|
+
return {
|
|
16
|
+
top: i.top + A(i, e.vertical),
|
|
17
|
+
left: i.left + C(i, e.horizontal)
|
|
18
|
+
};
|
|
19
|
+
}, m = (t, e) => ({
|
|
20
|
+
vertical: A(t, e.vertical),
|
|
21
|
+
horizontal: C(t, e.horizontal)
|
|
22
|
+
}), w = (t, e, o, i, s = 16) => {
|
|
23
|
+
const l = b(t, o);
|
|
24
|
+
console.log("anchoEl", l);
|
|
25
|
+
const r = m(e, i);
|
|
26
|
+
console.log("elemTransformOrigin", r);
|
|
27
|
+
const h = document.getElementById("ContainerAreas")?.getBoundingClientRect() || {
|
|
28
|
+
top: 0,
|
|
29
|
+
left: 0
|
|
30
|
+
};
|
|
31
|
+
console.log("getAnchorOffset-container", h);
|
|
32
|
+
let n = l.top - r.vertical, c = l.left - r.horizontal;
|
|
33
|
+
const g = n + e.height, d = c + e.width, p = window, u = p.innerHeight - s, a = p.innerWidth - s;
|
|
34
|
+
if (console.log("Final top,bottom,heightThreshold", n, g, u), n < s) {
|
|
35
|
+
const f = n - s;
|
|
36
|
+
n -= f;
|
|
37
|
+
} else if (g > u) {
|
|
38
|
+
const f = g - u;
|
|
39
|
+
n -= f;
|
|
40
|
+
}
|
|
41
|
+
if (c < s) {
|
|
42
|
+
const f = c - s;
|
|
43
|
+
c -= f;
|
|
44
|
+
} else if (d > a) {
|
|
45
|
+
const f = d - a;
|
|
46
|
+
c -= f;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
top: Math.round(n) - h.top,
|
|
50
|
+
left: Math.round(c) - h.left
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
v as C,
|
|
55
|
+
w as g
|
|
56
|
+
};
|
package/utils/index.54cae015.js
DELETED