@canmingir/link 1.2.44 → 1.2.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canmingir/link",
3
- "version": "1.2.44",
3
+ "version": "1.2.48",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -1,18 +1,18 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+
1
3
  import Box from "@mui/material/Box";
2
4
  import Link from "@mui/material/Link";
3
5
  import { RouterLink } from "../../routes/components";
4
6
  import config from "../../config/config";
5
7
 
6
- import React, { useEffect, useRef, useState } from "react";
7
-
8
8
  const resolvedDimensions = {};
9
9
 
10
10
  const Logo = ({ disabledLink = false, sx, maxSize = 65, isLogin = false }) => {
11
11
  const { icon } = config().template.login;
12
- const key = `${icon}`;
12
+ const key = `${icon}_${maxSize}_${isLogin}`;
13
13
 
14
14
  const [dimensions, setDimensions] = useState(
15
- resolvedDimensions[key] || { width: maxSize, height: maxSize }
15
+ resolvedDimensions[key] || { width: maxSize, height: maxSize },
16
16
  );
17
17
 
18
18
  useEffect(() => {
@@ -0,0 +1,117 @@
1
+ import { Box, Divider } from "@mui/material";
2
+
3
+ import React from "react";
4
+
5
+ const DevTool = ({
6
+ width = 62,
7
+ height = "auto",
8
+ top = "50%",
9
+ open = true,
10
+ content,
11
+ header,
12
+ footer,
13
+ sx,
14
+ }) => {
15
+ if (!open) return null;
16
+
17
+ return (
18
+ <Box
19
+ component="aside"
20
+ sx={{
21
+ position: "fixed",
22
+ top,
23
+ right: 0,
24
+ transform: "translateY(-50%)",
25
+ width,
26
+ height,
27
+ bgcolor: (theme) =>
28
+ theme.palette.mode === "dark"
29
+ ? "background.paper"
30
+ : "rgba(255, 255, 255, 0.85)",
31
+ backdropFilter: "blur(16px) saturate(180%)",
32
+ WebkitBackdropFilter: "blur(16px) saturate(180%)",
33
+ border: (theme) =>
34
+ `1px solid ${
35
+ theme.palette.mode === "dark"
36
+ ? "rgba(255,255,255,0.07)"
37
+ : "rgba(0,0,0,0.07)"
38
+ }`,
39
+ borderRadius: "4px",
40
+ boxShadow: (theme) =>
41
+ theme.palette.mode === "dark"
42
+ ? "0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04)"
43
+ : "0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04)",
44
+ zIndex: (theme) => theme.zIndex.modal + 3,
45
+ display: "flex",
46
+ flexDirection: "column",
47
+ alignItems: "center",
48
+ py: 1.5,
49
+ overflowY: "hidden",
50
+ overflowX: "hidden",
51
+ "&::-webkit-scrollbar": { display: "none" },
52
+ scrollbarWidth: "none",
53
+ ...(sx || {}),
54
+ }}
55
+ >
56
+ {header && (
57
+ <Box
58
+ sx={{
59
+ width: "100%",
60
+ display: "flex",
61
+ flexDirection: "column",
62
+ alignItems: "center",
63
+ flexShrink: 0,
64
+ }}
65
+ >
66
+ {header}
67
+ </Box>
68
+ )}
69
+
70
+ <Box
71
+ sx={{
72
+ flex: 1,
73
+ width: "100%",
74
+ display: "flex",
75
+ flexDirection: "column",
76
+ alignItems: "center",
77
+ overflowY: "auto",
78
+ overflowX: "hidden",
79
+ "&::-webkit-scrollbar": { display: "none" },
80
+ scrollbarWidth: "none",
81
+ }}
82
+ >
83
+ {content}
84
+ </Box>
85
+
86
+ {footer && (
87
+ <>
88
+ <Divider
89
+ flexItem
90
+ sx={{
91
+ borderColor: (theme) =>
92
+ theme.palette.mode === "dark"
93
+ ? "rgba(255,255,255,0.07)"
94
+ : "rgba(0,0,0,0.07)",
95
+ width: "100%",
96
+ flexShrink: 0,
97
+ }}
98
+ />
99
+ <Box
100
+ sx={{
101
+ width: "100%",
102
+ display: "flex",
103
+ flexDirection: "column",
104
+ alignItems: "center",
105
+ flexShrink: 0,
106
+ pt: 0.5,
107
+ }}
108
+ >
109
+ {footer}
110
+ </Box>
111
+ </>
112
+ )}
113
+ </Box>
114
+ );
115
+ };
116
+
117
+ export default DevTool;
@@ -0,0 +1 @@
1
+ export { default } from "./DevTool";
@@ -8,7 +8,7 @@ const DraggableNode = ({
8
8
  registerRef,
9
9
  onDrag,
10
10
  nodeId,
11
- selectionColor = "#64748b",
11
+ selectionColor = "#373739",
12
12
  initialPosition,
13
13
  onConnect,
14
14
  }) => {
@@ -164,20 +164,55 @@ const DraggableNode = ({
164
164
  transform: `translate(${offset.x}px, ${offset.y}px)`,
165
165
  cursor: "grab",
166
166
  "&:active": { cursor: "grabbing" },
167
- ...(selected && {
168
- "&::after": {
169
- content: '""',
170
- position: "absolute",
171
- inset: -6,
172
- border: `2px solid ${selectionColor}`,
173
- borderRadius: "12px",
174
- pointerEvents: "none",
175
- boxShadow: `0 0 8px ${selectionColor}66`,
176
- },
177
- }),
178
167
  }}
179
168
  >
180
169
  {children}
170
+ {selected &&
171
+ selectedIds.size > 1 &&
172
+ [
173
+ {
174
+ top: -10,
175
+ left: -6,
176
+ borderTop: 2,
177
+ borderLeft: 2,
178
+ color: selectionColor,
179
+ },
180
+ {
181
+ top: -8,
182
+ right: -12,
183
+ borderTop: 2,
184
+ borderRight: 2,
185
+ color: selectionColor,
186
+ },
187
+ {
188
+ bottom: -14,
189
+ left: -6,
190
+ borderBottom: 2,
191
+ borderLeft: 2,
192
+ color: selectionColor,
193
+ },
194
+ {
195
+ bottom: -16,
196
+ right: -12,
197
+ borderBottom: 2,
198
+ borderRight: 2,
199
+ color: selectionColor,
200
+ },
201
+ ].map((pos, i) => (
202
+ <Box
203
+ key={i}
204
+ sx={{
205
+ position: "absolute",
206
+ width: 10,
207
+ height: 10,
208
+ borderStyle: "solid",
209
+ borderColor: selectionColor,
210
+ borderWidth: 0,
211
+ pointerEvents: "none",
212
+ ...pos,
213
+ }}
214
+ />
215
+ ))}
181
216
  </Box>
182
217
  );
183
218
  };
@@ -1,6 +1,49 @@
1
1
  import { Box } from "@mui/material";
2
2
  import { hexToRgba } from "../utils/flowUtils";
3
3
 
4
+ const HANDLE_SIZE = 10;
5
+ const HANDLE_THICKNESS = 2;
6
+
7
+ const cornerStyles = (placement) => {
8
+ const base = {
9
+ position: "absolute",
10
+ width: HANDLE_SIZE,
11
+ height: HANDLE_SIZE,
12
+ borderColor: "inherit",
13
+ borderStyle: "solid",
14
+ borderWidth: 0,
15
+ };
16
+
17
+ const map = {
18
+ topLeft: {
19
+ top: 0,
20
+ left: 0,
21
+ borderTopWidth: HANDLE_THICKNESS,
22
+ borderLeftWidth: HANDLE_THICKNESS,
23
+ },
24
+ topRight: {
25
+ top: 0,
26
+ right: 0,
27
+ borderTopWidth: HANDLE_THICKNESS,
28
+ borderRightWidth: HANDLE_THICKNESS,
29
+ },
30
+ bottomLeft: {
31
+ bottom: 0,
32
+ left: 0,
33
+ borderBottomWidth: HANDLE_THICKNESS,
34
+ borderLeftWidth: HANDLE_THICKNESS,
35
+ },
36
+ bottomRight: {
37
+ bottom: 0,
38
+ right: 0,
39
+ borderBottomWidth: HANDLE_THICKNESS,
40
+ borderRightWidth: HANDLE_THICKNESS,
41
+ },
42
+ };
43
+
44
+ return { ...base, ...map[placement] };
45
+ };
46
+
4
47
  const SelectionOverlay = ({ box, selectionColor = "#64748b" }) => {
5
48
  if (!box) return null;
6
49
 
@@ -18,13 +61,17 @@ const SelectionOverlay = ({ box, selectionColor = "#64748b" }) => {
18
61
  top,
19
62
  width,
20
63
  height,
21
- border: `2px solid ${selectionColor}`,
22
- backgroundColor: hexToRgba(selectionColor, 0.1),
64
+ backgroundColor: hexToRgba(selectionColor, 0.08),
23
65
  pointerEvents: "none",
24
66
  zIndex: 9999,
25
67
  borderRadius: "4px",
68
+ color: selectionColor,
26
69
  }}
27
- />
70
+ >
71
+ {["topLeft", "topRight", "bottomLeft", "bottomRight"].map((placement) => (
72
+ <Box key={placement} sx={cornerStyles(placement)} />
73
+ ))}
74
+ </Box>
28
75
  );
29
76
  };
30
77
 
package/src/lib/index.js CHANGED
@@ -55,3 +55,4 @@ export {
55
55
  GlassCardContent,
56
56
  GlassCardActions,
57
57
  } from "./GlassCard/GlassCard";
58
+ export { default as DevTool } from "./DevTool";