@lark-apaas/client-toolkit 0.1.0-alpha.log.2 → 0.1.0-alpha.message.1
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/lib/apis/hooks/useTheme.d.ts +1 -0
- package/lib/apis/hooks/useTheme.js +1 -0
- package/lib/components/AppContainer/LogInterceptor.js +27 -5
- package/lib/components/AppContainer/api-proxy/core.d.ts +155 -0
- package/lib/components/AppContainer/api-proxy/core.js +270 -0
- package/lib/components/AppContainer/index.js +2 -0
- package/lib/components/AppContainer/utils/api-panel.d.ts +29 -0
- package/lib/components/AppContainer/utils/api-panel.js +66 -0
- package/lib/components/AppContainer/utils/childApi.js +11 -1
- package/lib/components/ErrorRender/index.js +3 -3
- package/lib/components/User/UserDisplay.d.ts +2 -1
- package/lib/components/User/UserDisplay.js +103 -26
- package/lib/components/User/UserProfile/UserProfile.css +1 -1
- package/lib/components/User/UserProfile/UserProfileContainer.d.ts +1 -1
- package/lib/components/User/UserProfile/UserProfileSkeleton.d.ts +0 -1
- package/lib/components/User/UserProfile/UserProfileSkeleton.js +21 -29
- package/lib/components/User/UserProfile/UserProfileUI.d.ts +1 -2
- package/lib/components/User/UserProfile/UserProfileUI.js +106 -92
- package/lib/components/User/UserSelect.d.ts +1 -1
- package/lib/components/User/UserSelect.js +17 -143
- package/lib/components/User/UserSelectUI/ActionButtons.d.ts +11 -0
- package/lib/components/User/UserSelectUI/ActionButtons.js +44 -0
- package/lib/components/User/UserSelectUI/Dropdown.d.ts +12 -0
- package/lib/components/User/UserSelectUI/Dropdown.js +66 -0
- package/lib/components/User/UserSelectUI/MultipleSelectionTags.d.ts +14 -0
- package/lib/components/User/UserSelectUI/MultipleSelectionTags.js +48 -0
- package/lib/components/User/UserSelectUI/SingleSelectionPreview.d.ts +9 -0
- package/lib/components/User/UserSelectUI/SingleSelectionPreview.js +37 -0
- package/lib/components/User/UserSelectUI/Spinner.d.ts +2 -0
- package/lib/components/User/UserSelectUI/Spinner.js +13 -0
- package/lib/components/User/UserSelectUI/UserSelectUI.d.ts +5 -0
- package/lib/components/User/UserSelectUI/UserSelectUI.js +230 -0
- package/lib/components/User/UserSelectUI/index.d.ts +2 -0
- package/lib/components/User/UserSelectUI/index.js +2 -0
- package/lib/components/User/UserSelectUI/types.d.ts +14 -0
- package/lib/components/User/UserSelectUI/types.js +0 -0
- package/lib/components/User/UserWithAvatar.d.ts +1 -1
- package/lib/components/User/UserWithAvatar.js +39 -22
- package/lib/components/User/type.d.ts +4 -0
- package/lib/components/index.d.ts +2 -5
- package/lib/components/index.js +2 -3
- package/lib/components/ui/avatar.d.ts +6 -0
- package/lib/components/ui/avatar.js +27 -0
- package/lib/components/ui/badge.d.ts +9 -0
- package/lib/components/ui/badge.js +29 -0
- package/lib/components/ui/button.d.ts +10 -0
- package/lib/components/ui/button.js +42 -0
- package/lib/components/ui/input.d.ts +3 -0
- package/lib/components/ui/input.js +12 -0
- package/lib/components/ui/overflow-tooltip-text.d.ts +8 -0
- package/lib/components/ui/overflow-tooltip-text.js +66 -0
- package/lib/components/ui/popover.d.ts +7 -0
- package/lib/components/ui/popover.js +35 -0
- package/lib/components/ui/skeleton.d.ts +7 -0
- package/lib/components/ui/skeleton.js +10 -0
- package/lib/components/ui/tooltip.d.ts +7 -0
- package/lib/components/ui/tooltip.js +24 -0
- package/lib/hooks/useAppInfo.js +12 -1
- package/lib/integrations/getAppInfo.js +4 -2
- package/lib/logger/__tests__/batch-logger.test.d.ts +1 -0
- package/lib/logger/__tests__/batch-logger.test.js +367 -0
- package/lib/logger/batch-logger.d.ts +78 -0
- package/lib/logger/batch-logger.js +134 -0
- package/lib/override.css +0 -16
- package/lib/types/iframe-events.d.ts +9 -0
- package/lib/types/index.d.ts +0 -29
- package/lib/utils/axiosConfig.js +7 -7
- package/lib/utils/getAppId.js +4 -3
- package/lib/utils/getParentOrigin.d.ts +1 -1
- package/lib/utils/getParentOrigin.js +1 -0
- package/package.json +8 -1
- package/lib/apis/components/SidebarNav.d.ts +0 -1
- package/lib/apis/components/SidebarNav.js +0 -2
- package/lib/components/SidebarNav/DrawerNav.d.ts +0 -3
- package/lib/components/SidebarNav/DrawerNav.js +0 -64
- package/lib/components/SidebarNav/DropdownNav.d.ts +0 -3
- package/lib/components/SidebarNav/DropdownNav.js +0 -40
- package/lib/components/SidebarNav/Sidebar.d.ts +0 -3
- package/lib/components/SidebarNav/Sidebar.js +0 -33
- package/lib/components/SidebarNav/index.d.ts +0 -5
- package/lib/components/SidebarNav/index.js +0 -61
- package/lib/components/User/UserSelect.css +0 -11
- package/lib/components/common/LogoInfo.d.ts +0 -5
- package/lib/components/common/LogoInfo.js +0 -30
- package/lib/components/common/NavItem.d.ts +0 -20
- package/lib/components/common/NavItem.js +0 -112
- package/lib/components/common/NavMenu.d.ts +0 -9
- package/lib/components/common/NavMenu.js +0 -50
- package/lib/components/common/UserAvatarLayout.d.ts +0 -4
- package/lib/components/common/UserAvatarLayout.js +0 -41
- package/lib/components/common/UserAvatarMenu.d.ts +0 -4
- package/lib/components/common/UserAvatarMenu.js +0 -58
- package/lib/components/common/index.d.ts +0 -9
- package/lib/components/common/index.js +0 -10
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Fallback, Image, Root } from "@radix-ui/react-avatar";
|
|
5
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
+
function Avatar({ className, ...props }) {
|
|
7
|
+
return /*#__PURE__*/ jsx(Root, {
|
|
8
|
+
"data-slot": "avatar",
|
|
9
|
+
className: clsxWithTw("relative flex size-8 shrink-0 overflow-hidden rounded-full", className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function AvatarImage({ className, ...props }) {
|
|
14
|
+
return /*#__PURE__*/ jsx(Image, {
|
|
15
|
+
"data-slot": "avatar-image",
|
|
16
|
+
className: clsxWithTw("aspect-square size-full", className),
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function AvatarFallback({ className, ...props }) {
|
|
21
|
+
return /*#__PURE__*/ jsx(Fallback, {
|
|
22
|
+
"data-slot": "avatar-fallback",
|
|
23
|
+
className: clsxWithTw("bg-muted flex size-full items-center justify-center rounded-full", className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const badgeVariants: (props?: {
|
|
4
|
+
variant?: "default" | "destructive" | "outline" | "secondary";
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
|
6
|
+
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
+
const badgeVariants = cva("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
10
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
11
|
+
destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
12
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function Badge({ className, variant, asChild = false, ...props }) {
|
|
20
|
+
const Comp = asChild ? Slot : "span";
|
|
21
|
+
return /*#__PURE__*/ jsx(Comp, {
|
|
22
|
+
"data-slot": "badge",
|
|
23
|
+
className: clsxWithTw(badgeVariants({
|
|
24
|
+
variant
|
|
25
|
+
}), className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: {
|
|
4
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost";
|
|
5
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg";
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
10
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
11
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
13
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
14
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
18
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
19
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
20
|
+
icon: "size-9",
|
|
21
|
+
"icon-sm": "size-8",
|
|
22
|
+
"icon-lg": "size-10"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default",
|
|
27
|
+
size: "default"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function Button({ className, variant, size, asChild = false, ...props }) {
|
|
31
|
+
const Comp = asChild ? Slot : "button";
|
|
32
|
+
return /*#__PURE__*/ jsx(Comp, {
|
|
33
|
+
"data-slot": "button",
|
|
34
|
+
className: clsxWithTw(buttonVariants({
|
|
35
|
+
variant,
|
|
36
|
+
size,
|
|
37
|
+
className
|
|
38
|
+
})),
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
4
|
+
const Input = /*#__PURE__*/ forwardRef(({ className, type, ...props }, ref)=>/*#__PURE__*/ jsx("input", {
|
|
5
|
+
ref: ref,
|
|
6
|
+
type: type,
|
|
7
|
+
"data-slot": "input",
|
|
8
|
+
className: clsxWithTw("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
|
|
9
|
+
...props
|
|
10
|
+
}));
|
|
11
|
+
Input.displayName = "Input";
|
|
12
|
+
export { Input };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface OverflowTooltipTextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Displays truncated inline text and shows a tooltip with the full content when overflowed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function OverflowTooltipText({ text, className, ...props }: OverflowTooltipTextProps): React.JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
4
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
5
|
+
function OverflowTooltipText({ text, className, ...props }) {
|
|
6
|
+
const textRef = useRef(null);
|
|
7
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
8
|
+
const checkOverflow = useCallback(()=>{
|
|
9
|
+
const el = textRef.current;
|
|
10
|
+
if (!el) return;
|
|
11
|
+
setIsOverflowing(el.scrollWidth > el.clientWidth + 1);
|
|
12
|
+
}, []);
|
|
13
|
+
useLayoutEffect(()=>{
|
|
14
|
+
checkOverflow();
|
|
15
|
+
}, [
|
|
16
|
+
checkOverflow
|
|
17
|
+
]);
|
|
18
|
+
useEffect(()=>{
|
|
19
|
+
const el = textRef.current;
|
|
20
|
+
if (!el) return;
|
|
21
|
+
const observer = new ResizeObserver(()=>{
|
|
22
|
+
checkOverflow();
|
|
23
|
+
});
|
|
24
|
+
observer.observe(el);
|
|
25
|
+
return ()=>{
|
|
26
|
+
observer.disconnect();
|
|
27
|
+
};
|
|
28
|
+
}, [
|
|
29
|
+
checkOverflow
|
|
30
|
+
]);
|
|
31
|
+
useEffect(()=>{
|
|
32
|
+
const handleResize = ()=>{
|
|
33
|
+
checkOverflow();
|
|
34
|
+
};
|
|
35
|
+
window.addEventListener('resize', handleResize);
|
|
36
|
+
return ()=>{
|
|
37
|
+
window.removeEventListener('resize', handleResize);
|
|
38
|
+
};
|
|
39
|
+
}, [
|
|
40
|
+
checkOverflow
|
|
41
|
+
]);
|
|
42
|
+
const textNode = /*#__PURE__*/ jsx("span", {
|
|
43
|
+
ref: textRef,
|
|
44
|
+
className: clsxWithTw('inline-block truncate', className),
|
|
45
|
+
...props,
|
|
46
|
+
children: text
|
|
47
|
+
});
|
|
48
|
+
if (!isOverflowing) return textNode;
|
|
49
|
+
return /*#__PURE__*/ jsx(TooltipProvider, {
|
|
50
|
+
children: /*#__PURE__*/ jsxs(Tooltip, {
|
|
51
|
+
delayDuration: 80,
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
54
|
+
asChild: true,
|
|
55
|
+
children: textNode
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ jsx(TooltipContent, {
|
|
58
|
+
sideOffset: 4,
|
|
59
|
+
className: "bg-[rgb(31,35,41)] text-white ring-0",
|
|
60
|
+
children: text
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export { OverflowTooltipText };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
6
|
+
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
|
|
7
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Anchor, Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
|
|
5
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
+
function Popover({ ...props }) {
|
|
7
|
+
return /*#__PURE__*/ jsx(Root, {
|
|
8
|
+
"data-slot": "popover",
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function PopoverTrigger({ ...props }) {
|
|
13
|
+
return /*#__PURE__*/ jsx(Trigger, {
|
|
14
|
+
"data-slot": "popover-trigger",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
19
|
+
return /*#__PURE__*/ jsx(Portal, {
|
|
20
|
+
children: /*#__PURE__*/ jsx(Content, {
|
|
21
|
+
"data-slot": "popover-content",
|
|
22
|
+
align: align,
|
|
23
|
+
sideOffset: sideOffset,
|
|
24
|
+
className: clsxWithTw("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className),
|
|
25
|
+
...props
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function PopoverAnchor({ ...props }) {
|
|
30
|
+
return /*#__PURE__*/ jsx(Anchor, {
|
|
31
|
+
"data-slot": "popover-anchor",
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type SkeletonProps = React.HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
/**
|
|
4
|
+
* Minimal shadcn/ui-compatible Skeleton primitive.
|
|
5
|
+
* Mirrors the upstream API so that downstream components can swap in seamlessly.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
4
|
+
const Skeleton = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
5
|
+
ref: ref,
|
|
6
|
+
className: clsxWithTw('animate-pulse rounded-md bg-accent', className),
|
|
7
|
+
...props
|
|
8
|
+
}));
|
|
9
|
+
Skeleton.displayName = 'Skeleton';
|
|
10
|
+
export { Skeleton };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
4
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
5
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { Arrow, Content, Portal, Provider, Root, Trigger } from "@radix-ui/react-tooltip";
|
|
5
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
+
const TooltipProvider = Provider;
|
|
7
|
+
const Tooltip = Root;
|
|
8
|
+
const TooltipTrigger = Trigger;
|
|
9
|
+
const TooltipContent = /*#__PURE__*/ forwardRef(({ className, sideOffset = 4, children, ...props }, ref)=>/*#__PURE__*/ jsx(Portal, {
|
|
10
|
+
children: /*#__PURE__*/ jsxs(Content, {
|
|
11
|
+
ref: ref,
|
|
12
|
+
sideOffset: sideOffset,
|
|
13
|
+
className: clsxWithTw('z-50 w-fit rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-lg ring-1 ring-border data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 animate-in fade-in-0 zoom-in-95', className),
|
|
14
|
+
...props,
|
|
15
|
+
children: [
|
|
16
|
+
children,
|
|
17
|
+
/*#__PURE__*/ jsx(Arrow, {
|
|
18
|
+
className: "fill-[rgb(31,35,41)] stroke-[rgb(31,35,41)]"
|
|
19
|
+
})
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
TooltipContent.displayName = Content.displayName;
|
|
24
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/lib/hooks/useAppInfo.js
CHANGED
|
@@ -4,7 +4,18 @@ const useAppInfo = ()=>{
|
|
|
4
4
|
const [appInfo, setAppInfo] = useState({});
|
|
5
5
|
useEffect(()=>{
|
|
6
6
|
const handleMetaInfoChanged = async ()=>{
|
|
7
|
-
|
|
7
|
+
const info = await getAppInfo();
|
|
8
|
+
if (info.name) document.title = info.name;
|
|
9
|
+
if (info.avatar) {
|
|
10
|
+
let link = document.querySelector("link[rel~='icon']");
|
|
11
|
+
if (!link) {
|
|
12
|
+
link = document.createElement('link');
|
|
13
|
+
link.rel = 'icon';
|
|
14
|
+
document.head.appendChild(link);
|
|
15
|
+
}
|
|
16
|
+
link.href = info.avatar;
|
|
17
|
+
}
|
|
18
|
+
setAppInfo(info);
|
|
8
19
|
};
|
|
9
20
|
handleMetaInfoChanged();
|
|
10
21
|
window.addEventListener('MiaoDaMetaInfoChanged', handleMetaInfoChanged);
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { getInitialInfo } from "../utils/getInitialInfo.js";
|
|
2
2
|
import { isSparkRuntime } from "../utils/utils.js";
|
|
3
3
|
async function getAppInfo() {
|
|
4
|
-
let appInfo = window._appInfo;
|
|
4
|
+
let appInfo = 'undefined' != typeof window ? window._appInfo : void 0;
|
|
5
5
|
if (!appInfo && isSparkRuntime()) {
|
|
6
|
-
const info = (await getInitialInfo())
|
|
6
|
+
const info = (await getInitialInfo())?.app_info;
|
|
7
7
|
appInfo = {
|
|
8
8
|
name: info?.app_name || '',
|
|
9
9
|
avatar: info?.app_avatar || ''
|
|
10
10
|
};
|
|
11
|
+
if (appInfo.name) appInfo.name = appInfo.name.trim();
|
|
12
|
+
if ('undefined' != typeof window) window._appInfo = appInfo;
|
|
11
13
|
}
|
|
12
14
|
return appInfo ?? {};
|
|
13
15
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|