@yimingliao/cms 0.0.118 → 0.0.119
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import * as React15 from 'react';
|
|
2
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
|
+
import { UAParser } from 'ua-parser-js';
|
|
1
4
|
import { clsx } from 'clsx';
|
|
2
5
|
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
import * as React15 from 'react';
|
|
4
|
-
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
5
6
|
import { usePathname } from 'next/navigation';
|
|
6
|
-
import { UAParser } from 'ua-parser-js';
|
|
7
7
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -17,10 +17,47 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
|
17
17
|
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
18
18
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
19
19
|
|
|
20
|
-
// src/client/applications/
|
|
20
|
+
// src/client/applications/auth/sign-in/use-device-info.ts
|
|
21
|
+
function useDeviceInfo() {
|
|
22
|
+
const [deviceInfo, setDeviceInfo] = useState(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const parser = new UAParser(navigator.userAgent);
|
|
25
|
+
const result = parser.getResult();
|
|
26
|
+
setDeviceInfo({
|
|
27
|
+
deviceType: result.device.type || "desktop",
|
|
28
|
+
platform: result.os.name || "Unknown",
|
|
29
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
30
|
+
language: navigator.language,
|
|
31
|
+
screenResolution: {
|
|
32
|
+
width: window.screen.width,
|
|
33
|
+
height: window.screen.height
|
|
34
|
+
},
|
|
35
|
+
browser: result.browser.name || "Unknown",
|
|
36
|
+
browserVersion: result.browser.version || "",
|
|
37
|
+
userAgent: navigator.userAgent
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
return deviceInfo;
|
|
41
|
+
}
|
|
21
42
|
var cn = (...inputs) => {
|
|
22
43
|
return twMerge(clsx(inputs));
|
|
23
44
|
};
|
|
45
|
+
var MOBILE_BREAKPOINT = 768;
|
|
46
|
+
var useIsMobile = () => {
|
|
47
|
+
const [isMobile, setIsMobile] = React15.useState();
|
|
48
|
+
React15.useEffect(() => {
|
|
49
|
+
const mql = globalThis.matchMedia(
|
|
50
|
+
`(max-width: ${MOBILE_BREAKPOINT - 1}px)`
|
|
51
|
+
);
|
|
52
|
+
const onChange = () => {
|
|
53
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
54
|
+
};
|
|
55
|
+
mql.addEventListener("change", onChange);
|
|
56
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
57
|
+
return () => mql.removeEventListener("change", onChange);
|
|
58
|
+
}, []);
|
|
59
|
+
return !!isMobile;
|
|
60
|
+
};
|
|
24
61
|
var useCountdown = (initialTime) => {
|
|
25
62
|
const [timeLeft, setTimeLeft] = useState(initialTime);
|
|
26
63
|
const [isCounting, setIsCounting] = useState(false);
|
|
@@ -62,43 +99,6 @@ var useParentPathname = () => {
|
|
|
62
99
|
var isConfirm = (t, key = "ui.dialog.confirm.text") => {
|
|
63
100
|
return confirm(t(key));
|
|
64
101
|
};
|
|
65
|
-
function useDeviceInfo() {
|
|
66
|
-
const [deviceInfo, setDeviceInfo] = useState(null);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
const parser = new UAParser(navigator.userAgent);
|
|
69
|
-
const result = parser.getResult();
|
|
70
|
-
setDeviceInfo({
|
|
71
|
-
deviceType: result.device.type || "desktop",
|
|
72
|
-
platform: result.os.name || "Unknown",
|
|
73
|
-
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
74
|
-
language: navigator.language,
|
|
75
|
-
screenResolution: {
|
|
76
|
-
width: window.screen.width,
|
|
77
|
-
height: window.screen.height
|
|
78
|
-
},
|
|
79
|
-
browser: result.browser.name || "Unknown",
|
|
80
|
-
browserVersion: result.browser.version || "",
|
|
81
|
-
userAgent: navigator.userAgent
|
|
82
|
-
});
|
|
83
|
-
}, []);
|
|
84
|
-
return deviceInfo;
|
|
85
|
-
}
|
|
86
|
-
var MOBILE_BREAKPOINT = 768;
|
|
87
|
-
var useIsMobile = () => {
|
|
88
|
-
const [isMobile, setIsMobile] = React15.useState();
|
|
89
|
-
React15.useEffect(() => {
|
|
90
|
-
const mql = globalThis.matchMedia(
|
|
91
|
-
`(max-width: ${MOBILE_BREAKPOINT - 1}px)`
|
|
92
|
-
);
|
|
93
|
-
const onChange = () => {
|
|
94
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
95
|
-
};
|
|
96
|
-
mql.addEventListener("change", onChange);
|
|
97
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
98
|
-
return () => mql.removeEventListener("change", onChange);
|
|
99
|
-
}, []);
|
|
100
|
-
return !!isMobile;
|
|
101
|
-
};
|
|
102
102
|
|
|
103
103
|
// src/client/interfaces/styles/constants.ts
|
|
104
104
|
var NAVBAR_HEIGHT = 60;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -615,8 +615,8 @@ declare const NAVBAR_HEIGHT = 60;
|
|
|
615
615
|
declare const SIDEBAR_WIDTH = 288;
|
|
616
616
|
declare const PAGE_HEADER_HEIGHT = 56;
|
|
617
617
|
|
|
618
|
-
declare const cn: (...inputs: ClassValue[]) => string;
|
|
619
|
-
|
|
620
618
|
declare function useDeviceInfo(): DeviceInfo | null;
|
|
621
619
|
|
|
620
|
+
declare const cn: (...inputs: ClassValue[]) => string;
|
|
621
|
+
|
|
622
622
|
export { AdminProvider, ArrayInput, Button, type ButtonProps, Checkbox, ContentContainer, ControlFields, type ControlMeta, Field, FieldBody, FieldsContainer, Form, IndexField, Input, type InputProps, LayoutSkeleton, ListCardsContainer, MainFields, NAVBAR_HEIGHT, type NavItem, NavMain, Option, PAGE_HEADER_HEIGHT, PageHeader, PasswordInput, ReturnButton, SIDEBAR_WIDTH, SearchInput, Select, type ShowToastOption, SideFields, SlugField, Textarea, ThemeProvider, cn, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createI18nSelector, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSignOutButton, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin, useDeviceInfo };
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../chunk-
|
|
2
|
-
export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, useDeviceInfo, useSidebar } from '../chunk-
|
|
1
|
+
import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../chunk-NDMQTMQL.js';
|
|
2
|
+
export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, useDeviceInfo, useSidebar } from '../chunk-NDMQTMQL.js';
|
|
3
3
|
import { ensureArray, findTranslation, joinUrl } from '../chunk-VSV6SQWC.js';
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-
|
|
1
|
+
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-NDMQTMQL.js';
|