@cripty2001/utils 0.0.94 → 0.0.95

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.
@@ -0,0 +1 @@
1
+ export declare function LoggerReactDisplay(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LoggerReactDisplay = LoggerReactDisplay;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const lucide_react_1 = require("lucide-react");
9
+ const Logger_1 = __importDefault(require("../Logger/Logger"));
10
+ const react_whispr_1 = require("../react-whispr");
11
+ function LoggerReactDisplay() {
12
+ const messages = (0, react_whispr_1.useWhisprValue)(Logger_1.default.lines);
13
+ const getColor = (severity) => {
14
+ switch (severity) {
15
+ case 'success':
16
+ return '#4CAF50';
17
+ case 'info':
18
+ return '#2196F3';
19
+ case 'warning':
20
+ return '#FF9800';
21
+ case 'error':
22
+ return '#F44336';
23
+ default:
24
+ return '#333';
25
+ }
26
+ };
27
+ const relTs = (0, react_whispr_1.useRelTime)();
28
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
29
+ position: 'fixed',
30
+ bottom: 0,
31
+ right: 0,
32
+ width: '100%',
33
+ zIndex: 50,
34
+ padding: '1rem',
35
+ borderRadius: '0.5rem',
36
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
37
+ display: 'flex',
38
+ flexDirection: 'column',
39
+ gap: '0.5rem',
40
+ alignItems: 'center',
41
+ width: '100%',
42
+ justifyContent: 'center',
43
+ }, children: [...messages]
44
+ .reverse()
45
+ .slice(0, 3)
46
+ .map((message) => ((0, jsx_runtime_1.jsxs)("div", { style: {
47
+ padding: '0.5rem',
48
+ borderRadius: '0.375rem',
49
+ boxShadow: '0 1px 3px rgba(0,0,0,0.2)',
50
+ color: '#fff',
51
+ width: '100%',
52
+ maxWidth: '65ch',
53
+ cursor: 'pointer',
54
+ backgroundColor: getColor(message.severity)
55
+ }, onClick: message.dismiss, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
56
+ display: 'flex',
57
+ justifyContent: 'space-between',
58
+ alignItems: 'center',
59
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("strong", { children: ["[", relTs(message.date), "] "] }), message.context && (0, jsx_runtime_1.jsxs)("span", { style: {
60
+ marginLeft: '0.5rem',
61
+ }, children: [" - ", message.context, " "] })] }), (0, jsx_runtime_1.jsx)("button", { onClick: message.dismiss, style: {
62
+ marginLeft: '1rem',
63
+ color: '#fff',
64
+ fontWeight: 'bold',
65
+ background: 'none',
66
+ border: 'none',
67
+ cursor: 'pointer',
68
+ padding: 0,
69
+ }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 16 }) })] }), (0, jsx_runtime_1.jsx)("div", { style: {
70
+ marginTop: '0.25rem',
71
+ }, children: message.message })] }, message.id))) }) }));
72
+ }
@@ -0,0 +1,6 @@
1
+ export type ModalComponentProps = {
2
+ children: React.ReactNode;
3
+ open: boolean | undefined;
4
+ setOpen: (open: boolean) => void | undefined;
5
+ };
6
+ export default function ModalComponent(props: ModalComponentProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ModalComponent;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_whispr_1 = require("../react-whispr");
7
+ let modalCount = 0;
8
+ function ModalComponent(props) {
9
+ const zIndex = (0, react_1.useRef)(1000 + modalCount++).current;
10
+ const id = (0, react_1.useRef)(`modal-${zIndex}`).current;
11
+ const [open, setOpen] = (0, react_whispr_1.useSynced)(true, props.open, props.setOpen);
12
+ if (!open)
13
+ return null;
14
+ return ((0, jsx_runtime_1.jsx)("div", { id: id, className: "fixed inset-0 bg-black/50 flex items-center justify-center p-6", style: { zIndex: zIndex }, onClick: () => setOpen(false), children: (0, jsx_runtime_1.jsx)("div", { className: "w-full animate-slide-up", onClick: (e) => e.stopPropagation(), children: props.children }) }));
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.94",
3
+ "version": "0.0.95",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {
@@ -40,7 +40,7 @@
40
40
  "dotenv": "^17.2.3",
41
41
  "express": "^5.1.0",
42
42
  "handlebars": "^4.7.8",
43
- "lucide-react": "^0.552.0",
43
+ "lucide-react": ">=0.552.0",
44
44
  "mjml": "^4.17.1",
45
45
  "react": "^19"
46
46
  },