Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
'use client';
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var react = require('react');
var core = require('@mantine/core');
var getAutoClose = require('./get-auto-close/get-auto-close.cjs');
const NotificationContainer = react.forwardRef(
({ data, onHide, autoClose, ...others }, ref) => {
const { autoClose: _autoClose, message, ...notificationProps } = data;
const autoCloseDuration = getAutoClose.getAutoClose(autoClose, data.autoClose);
const autoCloseTimeout = react.useRef(-1);
const cancelAutoClose = () => window.clearTimeout(autoCloseTimeout.current);
const handleHide = () => {
onHide(data.id);
cancelAutoClose();
};
const handleAutoClose = () => {
if (typeof autoCloseDuration === "number") {
autoCloseTimeout.current = window.setTimeout(handleHide, autoCloseDuration);
}
};
react.useEffect(() => {
data.onOpen?.(data);
}, []);
react.useEffect(() => {
handleAutoClose();
return cancelAutoClose;
}, [autoCloseDuration]);
return /* @__PURE__ */ jsxRuntime.jsx(
core.Notification,
{
...others,
...notificationProps,
onClose: handleHide,
ref,
onMouseEnter: cancelAutoClose,
onMouseLeave: handleAutoClose,
children: message
}
);
}
);
NotificationContainer.displayName = "@mantine/notifications/NotificationContainer";
exports.NotificationContainer = NotificationContainer;
//# sourceMappingURL=NotificationContainer.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,162 @@
'use client';
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var react = require('react');
var reactTransitionGroup = require('react-transition-group');
var core = require('@mantine/core');
var hooks = require('@mantine/hooks');
var getGroupedNotifications = require('./get-grouped-notifications/get-grouped-notifications.cjs');
var getNotificationStateStyles = require('./get-notification-state-styles.cjs');
var NotificationContainer = require('./NotificationContainer.cjs');
var Notifications_module = require('./Notifications.module.css.cjs');
var notifications_store = require('./notifications.store.cjs');
const Transition = reactTransitionGroup.Transition;
const defaultProps = {
position: "bottom-right",
autoClose: 4e3,
transitionDuration: 250,
containerWidth: 440,
notificationMaxHeight: 200,
limit: 5,
zIndex: core.getDefaultZIndex("overlay"),
store: notifications_store.notificationsStore,
withinPortal: true
};
const varsResolver = core.createVarsResolver((_, { zIndex, containerWidth }) => ({
root: {
"--notifications-z-index": zIndex?.toString(),
"--notifications-container-width": core.rem(containerWidth)
}
}));
const Notifications = core.factory((_props, ref) => {
const props = core.useProps("Notifications", defaultProps, _props);
const {
classNames,
className,
style,
styles,
unstyled,
vars,
position,
autoClose,
transitionDuration,
containerWidth,
notificationMaxHeight,
limit,
zIndex,
store,
portalProps,
withinPortal,
...others
} = props;
const theme = core.useMantineTheme();
const data = notifications_store.useNotifications(store);
const forceUpdate = hooks.useForceUpdate();
const shouldReduceMotion = hooks.useReducedMotion();
const refs = react.useRef({});
const previousLength = react.useRef(0);
const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
const duration = reduceMotion ? 1 : transitionDuration;
const getStyles = core.useStyles({
name: "Notifications",
classes: Notifications_module,
props,
className,
style,
classNames,
styles,
unstyled,
vars,
varsResolver
});
react.useEffect(() => {
store?.updateState((current) => ({
...current,
limit: limit || 5,
defaultPosition: position
}));
}, [limit, position]);
hooks.useDidUpdate(() => {
if (data.notifications.length > previousLength.current) {
setTimeout(() => forceUpdate(), 0);
}
previousLength.current = data.notifications.length;
}, [data.notifications]);
const grouped = getGroupedNotifications.getGroupedNotifications(data.notifications, position);
const groupedComponents = getGroupedNotifications.positions.reduce(
(acc, pos) => {
acc[pos] = grouped[pos].map(({ style: notificationStyle, ...notification }) => /* @__PURE__ */ jsxRuntime.jsx(
Transition,
{
timeout: duration,
onEnter: () => refs.current[notification.id].offsetHeight,
nodeRef: { current: refs.current[notification.id] },
children: (state) => /* @__PURE__ */ jsxRuntime.jsx(
NotificationContainer.NotificationContainer,
{
ref: (node) => {
if (node) {
refs.current[notification.id] = node;
}
},
data: notification,
onHide: (id) => notifications_store.hideNotification(id, store),
autoClose,
...getStyles("notification", {
style: {
...getNotificationStateStyles.getNotificationStateStyles({
state,
position: pos,
transitionDuration: duration,
maxHeight: notificationMaxHeight
}),
...notificationStyle
}
})
}
)
},
notification.id
));
return acc;
},
{}
);
return /* @__PURE__ */ jsxRuntime.jsxs(core.OptionalPortal, { withinPortal, ...portalProps, children: [
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { ...getStyles("root"), "data-position": "top-center", ref, ...others, children: /* @__PURE__ */ jsxRuntime.jsx(reactTransitionGroup.TransitionGroup, { children: groupedComponents["top-center"] }) }),
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { ...getStyles("root"), "data-position": "top-left", ...others, children: /* @__PURE__ */ jsxRuntime.jsx(reactTransitionGroup.TransitionGroup, { children: groupedComponents["top-left"] }) }),
/* @__PURE__ */ jsxRuntime.jsx(
core.Box,
{
...getStyles("root", { className: core.RemoveScroll.classNames.fullWidth }),
"data-position": "top-right",
...others,
children: /* @__PURE__ */ jsxRuntime.jsx(reactTransitionGroup.TransitionGroup, { children: groupedComponents["top-right"] })
}
),
/* @__PURE__ */ jsxRuntime.jsx(
core.Box,
{
...getStyles("root", { className: core.RemoveScroll.classNames.fullWidth }),
"data-position": "bottom-right",
...others,
children: /* @__PURE__ */ jsxRuntime.jsx(reactTransitionGroup.TransitionGroup, { children: groupedComponents["bottom-right"] })
}
),
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { ...getStyles("root"), "data-position": "bottom-left", ...others, children: /* @__PURE__ */ jsxRuntime.jsx(reactTransitionGroup.TransitionGroup, { children: groupedComponents["bottom-left"] }) }),
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { ...getStyles("root"), "data-position": "bottom-center", ...others, children: /* @__PURE__ */ jsxRuntime.jsx(reactTransitionGroup.TransitionGroup, { children: groupedComponents["bottom-center"] }) })
] });
});
Notifications.classes = Notifications_module;
Notifications.displayName = "@mantine/notifications/Notifications";
Notifications.show = notifications_store.notifications.show;
Notifications.hide = notifications_store.notifications.hide;
Notifications.update = notifications_store.notifications.update;
Notifications.clean = notifications_store.notifications.clean;
Notifications.cleanQueue = notifications_store.notifications.cleanQueue;
Notifications.updateState = notifications_store.notifications.updateState;
exports.Notifications = Notifications;
//# sourceMappingURL=Notifications.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
'use client';
'use strict';
var classes = {"root":"m_b37d9ac7","notification":"m_5ed0edd0"};
module.exports = classes;
//# sourceMappingURL=Notifications.module.css.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Notifications.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}

View File

@@ -0,0 +1,15 @@
'use client';
'use strict';
function getAutoClose(autoClose, notificationAutoClose) {
if (typeof notificationAutoClose === "number") {
return notificationAutoClose;
}
if (notificationAutoClose === false || autoClose === false) {
return false;
}
return autoClose;
}
exports.getAutoClose = getAutoClose;
//# sourceMappingURL=get-auto-close.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"get-auto-close.cjs","sources":["../../src/get-auto-close/get-auto-close.ts"],"sourcesContent":["export function getAutoClose(\n autoClose: boolean | number | undefined,\n notificationAutoClose: boolean | number | undefined\n) {\n if (typeof notificationAutoClose === 'number') {\n return notificationAutoClose;\n }\n\n if (notificationAutoClose === false || autoClose === false) {\n return false;\n }\n\n return autoClose;\n}\n"],"names":[],"mappings":";;;AAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GACA,qBAAA,CAAA,CACA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAA0B,QAAA,CAAA,CAAU,CAAA;AAC7C,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACT,CAAA;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,qBAAA,CAAA,CAAA,CAAA,CAAA,CAA0B,CAAA,CAAA,CAAA,CAAA,CAAA,IAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,KAAA,CAAA,CAAO,CAAA;AAC1D,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACT,CAAA;AAEA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACT,CAAA;;"}

View File

@@ -0,0 +1,27 @@
'use client';
'use strict';
const positions = [
"bottom-center",
"bottom-left",
"bottom-right",
"top-center",
"top-left",
"top-right"
];
function getGroupedNotifications(notifications, defaultPosition) {
return notifications.reduce(
(acc, notification) => {
acc[notification.position || defaultPosition].push(notification);
return acc;
},
positions.reduce((acc, item) => {
acc[item] = [];
return acc;
}, {})
);
}
exports.getGroupedNotifications = getGroupedNotifications;
exports.positions = positions;
//# sourceMappingURL=get-grouped-notifications.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"get-grouped-notifications.cjs","sources":["../../src/get-grouped-notifications/get-grouped-notifications.ts"],"sourcesContent":["import { NotificationData, NotificationPosition } from '../notifications.store';\n\nexport type GroupedNotifications = Record<NotificationPosition, NotificationData[]>;\n\nexport const positions: NotificationPosition[] = [\n 'bottom-center',\n 'bottom-left',\n 'bottom-right',\n 'top-center',\n 'top-left',\n 'top-right',\n];\n\nexport function getGroupedNotifications(\n notifications: NotificationData[],\n defaultPosition: NotificationPosition\n) {\n return notifications.reduce<GroupedNotifications>(\n (acc, notification) => {\n acc[notification.position || defaultPosition].push(notification);\n return acc;\n },\n positions.reduce<GroupedNotifications>((acc, item) => {\n acc[item] = [];\n return acc;\n }, {} as GroupedNotifications)\n );\n}\n"],"names":[],"mappings":";;;AAIO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,SAAA,CAAA,CAAA,CAAoC,CAAA;AAAA,CAAA,CAC/C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACF,CAAA,CAAA;AAEO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GACA,eAAA,CAAA,CACA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACT,CAAA,EAAG,CAAA,CAA0B,CAAA;AAAA,CAAA,CAAA,CAC/B,CAAA;AACF,CAAA;;;"}

View File

@@ -0,0 +1,51 @@
'use client';
'use strict';
const transforms = {
left: "translateX(-100%)",
right: "translateX(100%)",
"top-center": "translateY(-100%)",
"bottom-center": "translateY(100%)"
};
const noTransform = {
left: "translateX(0)",
right: "translateX(0)",
"top-center": "translateY(0)",
"bottom-center": "translateY(0)"
};
function getNotificationStateStyles({
state,
maxHeight,
position,
transitionDuration
}) {
const [vertical, horizontal] = position.split("-");
const property = horizontal === "center" ? `${vertical}-center` : horizontal;
const commonStyles = {
opacity: 0,
maxHeight,
transform: transforms[property],
transitionDuration: `${transitionDuration}ms, ${transitionDuration}ms, ${transitionDuration}ms`,
transitionTimingFunction: "cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",
transitionProperty: "opacity, transform, max-height"
};
const inState = {
opacity: 1,
transform: noTransform[property]
};
const outState = {
opacity: 0,
maxHeight: 0,
transform: transforms[property]
};
const transitionStyles = {
entering: inState,
entered: inState,
exiting: outState,
exited: outState
};
return { ...commonStyles, ...transitionStyles[state] };
}
exports.getNotificationStateStyles = getNotificationStateStyles;
//# sourceMappingURL=get-notification-state-styles.cjs.map

File diff suppressed because one or more lines are too long

19
node_modules/@mantine/notifications/cjs/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,19 @@
'use strict';
var notifications_store = require('./notifications.store.cjs');
var Notifications = require('./Notifications.cjs');
exports.cleanNotifications = notifications_store.cleanNotifications;
exports.cleanNotificationsQueue = notifications_store.cleanNotificationsQueue;
exports.createNotificationsStore = notifications_store.createNotificationsStore;
exports.hideNotification = notifications_store.hideNotification;
exports.notifications = notifications_store.notifications;
exports.notificationsStore = notifications_store.notificationsStore;
exports.showNotification = notifications_store.showNotification;
exports.updateNotification = notifications_store.updateNotification;
exports.updateNotificationsState = notifications_store.updateNotificationsState;
exports.useNotifications = notifications_store.useNotifications;
exports.Notifications = Notifications.Notifications;
//# sourceMappingURL=index.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,105 @@
'use client';
'use strict';
var hooks = require('@mantine/hooks');
var store = require('@mantine/store');
function getDistributedNotifications(data, defaultPosition, limit) {
const queue = [];
const notifications2 = [];
const count = {};
for (const item of data) {
const position = item.position || defaultPosition;
count[position] = count[position] || 0;
count[position] += 1;
if (count[position] <= limit) {
notifications2.push(item);
} else {
queue.push(item);
}
}
return { notifications: notifications2, queue };
}
const createNotificationsStore = () => store.createStore({
notifications: [],
queue: [],
defaultPosition: "bottom-right",
limit: 5
});
const notificationsStore = createNotificationsStore();
const useNotifications = (store$1 = notificationsStore) => store.useStore(store$1);
function updateNotificationsState(store, update) {
const state = store.getState();
const notifications2 = update([...state.notifications, ...state.queue]);
const updated = getDistributedNotifications(notifications2, state.defaultPosition, state.limit);
store.setState({
notifications: updated.notifications,
queue: updated.queue,
limit: state.limit,
defaultPosition: state.defaultPosition
});
}
function showNotification(notification, store = notificationsStore) {
const id = notification.id || hooks.randomId();
updateNotificationsState(store, (notifications2) => {
if (notification.id && notifications2.some((n) => n.id === notification.id)) {
return notifications2;
}
return [...notifications2, { ...notification, id }];
});
return id;
}
function hideNotification(id, store = notificationsStore) {
updateNotificationsState(
store,
(notifications2) => notifications2.filter((notification) => {
if (notification.id === id) {
notification.onClose?.(notification);
return false;
}
return true;
})
);
return id;
}
function updateNotification(notification, store = notificationsStore) {
updateNotificationsState(
store,
(notifications2) => notifications2.map((item) => {
if (item.id === notification.id) {
return { ...item, ...notification };
}
return item;
})
);
return notification.id;
}
function cleanNotifications(store = notificationsStore) {
updateNotificationsState(store, () => []);
}
function cleanNotificationsQueue(store = notificationsStore) {
updateNotificationsState(
store,
(notifications2) => notifications2.slice(0, store.getState().limit)
);
}
const notifications = {
show: showNotification,
hide: hideNotification,
update: updateNotification,
clean: cleanNotifications,
cleanQueue: cleanNotificationsQueue,
updateState: updateNotificationsState
};
exports.cleanNotifications = cleanNotifications;
exports.cleanNotificationsQueue = cleanNotificationsQueue;
exports.createNotificationsStore = createNotificationsStore;
exports.hideNotification = hideNotification;
exports.notifications = notifications;
exports.notificationsStore = notificationsStore;
exports.showNotification = showNotification;
exports.updateNotification = updateNotification;
exports.updateNotificationsState = updateNotificationsState;
exports.useNotifications = useNotifications;
//# sourceMappingURL=notifications.store.cjs.map

File diff suppressed because one or more lines are too long