@lark-apaas/client-toolkit 1.1.17 → 1.1.19-alpha.error.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/components/AppContainer/safety.js +197 -94
- package/lib/components/ErrorRender/index.d.ts +1 -0
- package/lib/components/ErrorRender/index.js +13 -3
- package/lib/components/ui/badge.d.ts +1 -1
- package/lib/components/ui/button.d.ts +1 -1
- package/lib/components/ui/drawer.d.ts +13 -0
- package/lib/components/ui/drawer.js +78 -0
- package/lib/logger/intercept-global-error.js +14 -6
- package/lib/types/iframe-events.d.ts +1 -1
- package/lib/utils/module-hot.d.ts +24 -0
- package/lib/utils/module-hot.js +22 -0
- package/package.json +2 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
|
|
4
4
|
import { getCsrfToken } from "../../utils/getCsrfToken.js";
|
|
5
5
|
import { getAppId } from "../../utils/getAppId.js";
|
|
6
6
|
import { useIsMobile } from "../../hooks/index.js";
|
|
7
7
|
import { X } from "lucide-react";
|
|
8
|
-
import {
|
|
8
|
+
import { Sheet, SheetContent, SheetTrigger } from "../ui/drawer.js";
|
|
9
9
|
const Component = ()=>{
|
|
10
10
|
const HasClosedKey = `miaoda-creatByMiaoda-has-closed-${getAppId(window.location.pathname)}`;
|
|
11
11
|
const [visible, setVisible] = useState(!window.localStorage?.getItem(HasClosedKey));
|
|
@@ -24,8 +24,127 @@ const Component = ()=>{
|
|
|
24
24
|
setIsInternetVisible(data?.data?.is_internet_visible);
|
|
25
25
|
});
|
|
26
26
|
}, []);
|
|
27
|
+
useEffect(()=>{
|
|
28
|
+
if (isMobile) {
|
|
29
|
+
const link = document.createElement('link');
|
|
30
|
+
link.rel = 'preload';
|
|
31
|
+
link.as = 'image';
|
|
32
|
+
link.href = 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-mobile.png';
|
|
33
|
+
document.head.appendChild(link);
|
|
34
|
+
}
|
|
35
|
+
}, [
|
|
36
|
+
isMobile
|
|
37
|
+
]);
|
|
27
38
|
if ('production' !== process.env.NODE_ENV) return null;
|
|
28
|
-
if (
|
|
39
|
+
if (!visible) return null;
|
|
40
|
+
if (isMobile) return /*#__PURE__*/ jsxs(Sheet, {
|
|
41
|
+
open: open,
|
|
42
|
+
onOpenChange: setOpen,
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ jsx(SheetTrigger, {
|
|
45
|
+
asChild: true,
|
|
46
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
47
|
+
className: "fixed right-3 bottom-20 inline-flex items-center gap-x-1 border-solid border-[#ffffff1a] border px-2.5 py-1.5 bg-[#1f2329e5] backdrop-blur-[5px] shadow-[0px_6px_12px_0px_#41444a0a,0px_8px_24px_8px_#41444a0a] rounded-md text-[#ebebeb)] font-['PingFang_SC'] text-xs leading-[20px] tracking-[0px] z-[10000000]",
|
|
48
|
+
onClick: ()=>{
|
|
49
|
+
setOpen(true);
|
|
50
|
+
},
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ jsx("img", {
|
|
53
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodalogo.svg",
|
|
54
|
+
className: "shrink-0 w-[16px] h-[16px]"
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ jsx("p", {
|
|
57
|
+
className: "shrink-0 min-w-[28px] m-0! text-[#EBEBEB]",
|
|
58
|
+
children: "妙搭"
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ jsx(SheetContent, {
|
|
64
|
+
side: "bottom",
|
|
65
|
+
className: "z-[10000001] border-none bg-transparent outline-0!",
|
|
66
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
67
|
+
className: "flex flex-col bg-white overflow-hidden rounded-t-2xl relative",
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ jsx(X, {
|
|
70
|
+
className: "absolute top-2 left-4 size-6 text-[#2B2F36]",
|
|
71
|
+
onClick: ()=>setOpen(false)
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ jsx("img", {
|
|
74
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover-mobile.png",
|
|
75
|
+
alt: "",
|
|
76
|
+
className: "w-full h-full",
|
|
77
|
+
onClick: ()=>{
|
|
78
|
+
window.open('https://miaoda.feishu.cn/landing', '_blank');
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ jsxs("div", {
|
|
82
|
+
className: "flex flex-col w-full justify-center items-end gap-y-4 border-solid border-[#ffffff0d] border px-5 pt-4 pb-12 shadow-(--shadow-2xs,0px_2px_8px_2px_var(--shadow-2xs-1-color,#1f232905),0px_2px_8px_2px_var(--shadow-2xs-1-color,#1f232905),0px_2px_4px_0px_var(--shadow-2xs-1-color,#1f232905)) rounded-t-[12px] text-[#a6a6a6] font-['PingFang_SC'] text-[12px] leading-[20px] tracking-[0px]",
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ jsxs("div", {
|
|
85
|
+
className: "self-stretch shrink-0 flex flex-col items-start gap-y-[4px]",
|
|
86
|
+
children: [
|
|
87
|
+
isInternetVisible && /*#__PURE__*/ jsxs("div", {
|
|
88
|
+
className: "self-stretch shrink-0 flex items-center gap-x-[6px]",
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ jsx("img", {
|
|
91
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_company_outlined.svg",
|
|
92
|
+
className: "shrink-0 w-3.5 h-3.5"
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ jsxs("p", {
|
|
95
|
+
className: "shrink-0 min-w-[96px] m-0! text-[#646A73] text-sm",
|
|
96
|
+
children: [
|
|
97
|
+
userinfo?.name,
|
|
98
|
+
"运营"
|
|
99
|
+
]
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ jsxs("div", {
|
|
104
|
+
className: "self-stretch shrink-0 flex items-center gap-x-[6px]",
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ jsx("img", {
|
|
107
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_efficiency-ai_outlined.svg",
|
|
108
|
+
className: "shrink-0 w-3.5 h-3.5"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ jsx("p", {
|
|
111
|
+
className: "shrink-0 min-w-[163px] m-0! text-[#646A73] text-sm",
|
|
112
|
+
children: "包含 AI 生成内容,请注意甄别"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ jsxs("div", {
|
|
119
|
+
className: "self-stretch shrink-0 flex items-start gap-x-4",
|
|
120
|
+
children: [
|
|
121
|
+
/*#__PURE__*/ jsx("div", {
|
|
122
|
+
className: "flex-1 flex rounded-[99px] items-center justify-center border-[0.5px] border-[#D0D3D6] bg-white text-[#1F2329] cursor-pointer text-lg py-3",
|
|
123
|
+
onClick: (e)=>{
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
setOpen(false);
|
|
127
|
+
setTimeout(()=>setVisible(false), 200);
|
|
128
|
+
window.localStorage?.setItem(HasClosedKey, 'true');
|
|
129
|
+
},
|
|
130
|
+
children: "不再展示"
|
|
131
|
+
}),
|
|
132
|
+
/*#__PURE__*/ jsx("div", {
|
|
133
|
+
className: "flex-1 flex rounded-[99px] items-center justify-center border-[0.5px] border-black bg-black text-white cursor-pointer text-lg py-3",
|
|
134
|
+
onClick: ()=>{
|
|
135
|
+
window.open('https://miaoda.feishu.cn/landing', '_blank');
|
|
136
|
+
},
|
|
137
|
+
children: "了解更多"
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
});
|
|
29
148
|
return /*#__PURE__*/ jsxs(Popover, {
|
|
30
149
|
open: open,
|
|
31
150
|
onOpenChange: setOpen,
|
|
@@ -33,7 +152,7 @@ const Component = ()=>{
|
|
|
33
152
|
/*#__PURE__*/ jsx(PopoverTrigger, {
|
|
34
153
|
asChild: true,
|
|
35
154
|
children: /*#__PURE__*/ jsxs("div", {
|
|
36
|
-
className: "fixed right-
|
|
155
|
+
className: "fixed right-3 bottom-3 inline-flex items-center gap-x-1 border-solid border-[#ffffff1a] border px-2.5 py-1.5 bg-[#1f2329e5] backdrop-blur-[5px] shadow-[0px_6px_12px_0px_#41444a0a,0px_8px_24px_8px_#41444a0a] rounded-md text-[#ebebeb)] font-['PingFang_SC'] text-xs leading-[20px] tracking-[0px] z-[10000000] cursor-pointer",
|
|
37
156
|
onMouseEnter: ()=>{
|
|
38
157
|
clearTimeout(timeoutRef.current);
|
|
39
158
|
setOpen(true);
|
|
@@ -44,31 +163,20 @@ const Component = ()=>{
|
|
|
44
163
|
children: [
|
|
45
164
|
/*#__PURE__*/ jsx("img", {
|
|
46
165
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodalogo.svg",
|
|
47
|
-
className: "shrink-0 w-[
|
|
166
|
+
className: "shrink-0 w-[16px] h-[16px]"
|
|
48
167
|
}),
|
|
49
168
|
/*#__PURE__*/ jsx("p", {
|
|
50
|
-
className: "shrink-0 min-w-[
|
|
51
|
-
children: "
|
|
52
|
-
}),
|
|
53
|
-
/*#__PURE__*/ jsx(Button, {
|
|
54
|
-
size: "icon",
|
|
55
|
-
variant: "ghost",
|
|
56
|
-
className: "cursor-pointer rounded-full w-4 h-4 hover:bg-[#1f232914]",
|
|
57
|
-
onClick: (e)=>{
|
|
58
|
-
e.stopPropagation();
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
setVisible(false);
|
|
61
|
-
window.localStorage?.setItem(HasClosedKey, 'true');
|
|
62
|
-
},
|
|
63
|
-
children: /*#__PURE__*/ jsx(X, {
|
|
64
|
-
className: "text-[#646A73] !w-[10px] !h-[10px]"
|
|
65
|
-
})
|
|
169
|
+
className: "shrink-0 min-w-[60px] m-0! text-[#EBEBEB]",
|
|
170
|
+
children: "由妙搭搭建"
|
|
66
171
|
})
|
|
67
172
|
]
|
|
68
173
|
})
|
|
69
174
|
}),
|
|
70
|
-
/*#__PURE__*/
|
|
71
|
-
className: "
|
|
175
|
+
/*#__PURE__*/ jsx(PopoverContent, {
|
|
176
|
+
className: "overflow-hidden p-0 m-0 border-0 rounded-xl!",
|
|
177
|
+
style: {
|
|
178
|
+
boxShadow: '0 6px 12px 0 #41444a0a, 0 8px 24px 0 #41444a0a'
|
|
179
|
+
},
|
|
72
180
|
side: "top",
|
|
73
181
|
align: "end",
|
|
74
182
|
sideOffset: 8,
|
|
@@ -79,87 +187,82 @@ const Component = ()=>{
|
|
|
79
187
|
onMouseLeave: ()=>{
|
|
80
188
|
timeoutRef.current = setTimeout(()=>setOpen(false), 100);
|
|
81
189
|
},
|
|
82
|
-
children:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
190
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
191
|
+
className: "flex flex-col bg-[#1F2021]",
|
|
192
|
+
children: [
|
|
193
|
+
/*#__PURE__*/ jsx("img", {
|
|
194
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/miaodacover.png",
|
|
195
|
+
alt: "",
|
|
196
|
+
className: "w-72 h-32 cursor-pointer",
|
|
197
|
+
onClick: ()=>{
|
|
198
|
+
window.open('https://miaoda.feishu.cn/landing', '_blank');
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
/*#__PURE__*/ jsxs("div", {
|
|
202
|
+
className: "flex flex-col justify-center items-end gap-y-[12px] border-solid border-[#ffffff0d] border pl-[14px] pr-[15px] pt-[11px] pb-[15px] w-[286px] shadow-(--shadow-2xs,0px_2px_8px_2px_var(--shadow-2xs-1-color,#1f232905),0px_2px_8px_2px_var(--shadow-2xs-1-color,#1f232905),0px_2px_4px_0px_var(--shadow-2xs-1-color,#1f232905)) rounded-t-[12px] text-[#a6a6a6] font-['PingFang_SC'] text-[12px] leading-[20px] tracking-[0px]",
|
|
203
|
+
children: [
|
|
204
|
+
/*#__PURE__*/ jsxs("div", {
|
|
205
|
+
className: "self-stretch shrink-0 flex flex-col items-start gap-y-[4px]",
|
|
206
|
+
children: [
|
|
207
|
+
isInternetVisible && /*#__PURE__*/ jsxs("div", {
|
|
208
|
+
className: "self-stretch shrink-0 flex items-center gap-x-[6px]",
|
|
92
209
|
children: [
|
|
93
|
-
/*#__PURE__*/
|
|
94
|
-
|
|
210
|
+
/*#__PURE__*/ jsx("img", {
|
|
211
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_company_outlined.svg",
|
|
212
|
+
className: "shrink-0 w-[12px] h-[12px]"
|
|
213
|
+
}),
|
|
214
|
+
/*#__PURE__*/ jsxs("p", {
|
|
215
|
+
className: "shrink-0 min-w-[96px] m-0! text-[#a6a6a6]",
|
|
95
216
|
children: [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
className: "shrink-0 w-[14px] h-[14px]"
|
|
99
|
-
}),
|
|
100
|
-
/*#__PURE__*/ jsx("div", {
|
|
101
|
-
className: "flex-1 justify-start text-[#2B2F36] text-sm font-normal font-['PingFang_SC'] leading-5",
|
|
102
|
-
children: "运营方"
|
|
103
|
-
})
|
|
217
|
+
userinfo?.name,
|
|
218
|
+
"运营"
|
|
104
219
|
]
|
|
220
|
+
})
|
|
221
|
+
]
|
|
222
|
+
}),
|
|
223
|
+
/*#__PURE__*/ jsxs("div", {
|
|
224
|
+
className: "self-stretch shrink-0 flex items-center gap-x-[6px]",
|
|
225
|
+
children: [
|
|
226
|
+
/*#__PURE__*/ jsx("img", {
|
|
227
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/icon_efficiency-ai_outlined.svg",
|
|
228
|
+
className: "shrink-0 w-[12px] h-[12px]"
|
|
105
229
|
}),
|
|
106
|
-
/*#__PURE__*/ jsx("
|
|
107
|
-
className: "
|
|
108
|
-
children:
|
|
109
|
-
className: "justify-start text-[#646A73] text-sm font-normal font-['PingFang_SC'] leading-5",
|
|
110
|
-
children: userinfo?.name
|
|
111
|
-
})
|
|
230
|
+
/*#__PURE__*/ jsx("p", {
|
|
231
|
+
className: "shrink-0 min-w-[163px] m-0! text-[#a6a6a6]",
|
|
232
|
+
children: "包含 AI 生成内容,请注意甄别"
|
|
112
233
|
})
|
|
113
234
|
]
|
|
114
235
|
})
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
236
|
+
]
|
|
237
|
+
}),
|
|
238
|
+
/*#__PURE__*/ jsxs("div", {
|
|
239
|
+
className: "self-stretch shrink-0 flex items-start gap-x-[8px]",
|
|
240
|
+
children: [
|
|
241
|
+
/*#__PURE__*/ jsx("div", {
|
|
242
|
+
className: "flex-1 flex rounded-lg h-[34px] items-center justify-center border-[0.5px] bg-transparent border-solid hover:bg-[#ffffff08] text-[#ebebeb99] hover:text-[#ebebebe6] cursor-pointer border-[#ffffff1c]",
|
|
243
|
+
"data-custom-element": "safety-close",
|
|
244
|
+
onClick: (e)=>{
|
|
245
|
+
e.stopPropagation();
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
setVisible(false);
|
|
248
|
+
window.localStorage?.setItem(HasClosedKey, 'true');
|
|
249
|
+
},
|
|
250
|
+
children: "不再展示"
|
|
251
|
+
}),
|
|
252
|
+
/*#__PURE__*/ jsx("div", {
|
|
253
|
+
className: "flex-1 flex rounded-lg items-center justify-center h-[34px] border-[0.5px] border-solid border-[#ffffff1c] hover:border-[#ffffff33] bg-[#ffffff08] hover:bg-[#ffffff14] cursor-pointer text-[#ebebeb]",
|
|
254
|
+
"data-custom-element": "safety-more",
|
|
255
|
+
onClick: ()=>{
|
|
256
|
+
window.open('https://miaoda.feishu.cn/landing', '_blank');
|
|
257
|
+
},
|
|
258
|
+
children: "了解更多"
|
|
120
259
|
})
|
|
121
|
-
|
|
122
|
-
]
|
|
123
|
-
}),
|
|
124
|
-
/*#__PURE__*/ jsx("div", {
|
|
125
|
-
className: "self-stretch h-10 p-3 bg-token-bg-body rounded-lg flex flex-col justify-center items-start gap-2.5 hover:bg-[var(--token-fill-hover,rgba(31,35,41,0.08))] cursor-pointer transition-colors",
|
|
126
|
-
onClick: ()=>{
|
|
127
|
-
window.open('https://miaoda.feishu.cn/', '_blank');
|
|
128
|
-
},
|
|
129
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
130
|
-
className: "self-stretch inline-flex justify-start items-center gap-2",
|
|
131
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
132
|
-
className: "flex-1 flex justify-start items-center gap-1",
|
|
133
|
-
children: [
|
|
134
|
-
/*#__PURE__*/ jsx("img", {
|
|
135
|
-
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/icon_efficiency_outlined.svg",
|
|
136
|
-
className: "shrink-0 w-[14px] h-[14px]"
|
|
137
|
-
}),
|
|
138
|
-
/*#__PURE__*/ jsx("div", {
|
|
139
|
-
className: "flex-1 justify-start text-[#2B2F36] text-sm font-normal font-['PingFang_SC'] leading-5",
|
|
140
|
-
children: "了解妙搭"
|
|
141
|
-
}),
|
|
142
|
-
/*#__PURE__*/ jsx("img", {
|
|
143
|
-
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/logo/icon_window-new_outlined.svg",
|
|
144
|
-
className: "shrink-0 w-[12px] h-[12px]"
|
|
145
|
-
})
|
|
146
|
-
]
|
|
147
|
-
})
|
|
260
|
+
]
|
|
148
261
|
})
|
|
149
|
-
|
|
150
|
-
]
|
|
151
|
-
}),
|
|
152
|
-
/*#__PURE__*/ jsx("div", {
|
|
153
|
-
className: "self-stretch h-10 px-5 py-3 bg-[var(--token-bg-content-base,#F8F9FA)] inline-flex justify-start items-center gap-2",
|
|
154
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
155
|
-
className: "flex-1 flex justify-start items-center gap-2",
|
|
156
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
157
|
-
className: "justify-start text-[#8F959E] text-xs font-normal font-['PingFang_SC'] leading-5",
|
|
158
|
-
children: "包含 AI 生成内容,请注意甄别"
|
|
159
|
-
})
|
|
262
|
+
]
|
|
160
263
|
})
|
|
161
|
-
|
|
162
|
-
|
|
264
|
+
]
|
|
265
|
+
})
|
|
163
266
|
})
|
|
164
267
|
]
|
|
165
268
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { logger } from "../../logger/index.js";
|
|
4
|
+
import { createApplyHandle, getModuleHot } from "../../utils/module-hot.js";
|
|
4
5
|
const RenderError = (props)=>{
|
|
5
|
-
const { error } = props;
|
|
6
|
+
const { error, resetErrorBoundary } = props;
|
|
6
7
|
useEffect(()=>{
|
|
7
|
-
if (
|
|
8
|
+
if (error) logger.log({
|
|
8
9
|
level: 'error',
|
|
9
10
|
args: [
|
|
10
11
|
'Render Error',
|
|
@@ -15,7 +16,16 @@ const RenderError = (props)=>{
|
|
|
15
16
|
}
|
|
16
17
|
});
|
|
17
18
|
}, [
|
|
18
|
-
|
|
19
|
+
error
|
|
20
|
+
]);
|
|
21
|
+
useEffect(()=>{
|
|
22
|
+
if (!resetErrorBoundary) return;
|
|
23
|
+
const hot = getModuleHot();
|
|
24
|
+
if (hot) hot.addStatusHandler(createApplyHandle((success)=>{
|
|
25
|
+
if (success) resetErrorBoundary();
|
|
26
|
+
}));
|
|
27
|
+
}, [
|
|
28
|
+
resetErrorBoundary
|
|
19
29
|
]);
|
|
20
30
|
return /*#__PURE__*/ jsx("div", {
|
|
21
31
|
className: "min-h-screen flex items-center justify-center bg-white",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const badgeVariants: (props?: {
|
|
4
|
-
variant?: "default" | "
|
|
4
|
+
variant?: "default" | "secondary" | "destructive" | "outline";
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
|
6
6
|
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
7
7
|
asChild?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: {
|
|
4
|
-
variant?: "default" | "link" | "
|
|
4
|
+
variant?: "default" | "link" | "secondary" | "destructive" | "outline" | "ghost";
|
|
5
5
|
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg";
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): React.JSX.Element;
|
|
6
|
+
declare function SheetContent({ className, children, side, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
7
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare function SheetFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>): React.JSX.Element;
|
|
12
|
+
declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>): React.JSX.Element;
|
|
13
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Close, Content, Description, Overlay, Portal, Root, Title, Trigger } from "@radix-ui/react-dialog";
|
|
5
|
+
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
+
function Sheet({ ...props }) {
|
|
7
|
+
return /*#__PURE__*/ jsx(Root, {
|
|
8
|
+
"data-slot": "sheet",
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function SheetTrigger({ ...props }) {
|
|
13
|
+
return /*#__PURE__*/ jsx(Trigger, {
|
|
14
|
+
"data-slot": "sheet-trigger",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function SheetClose({ ...props }) {
|
|
19
|
+
return /*#__PURE__*/ jsx(Close, {
|
|
20
|
+
"data-slot": "sheet-close",
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function SheetPortal({ ...props }) {
|
|
25
|
+
return /*#__PURE__*/ jsx(Portal, {
|
|
26
|
+
"data-slot": "sheet-portal",
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function SheetOverlay({ className, ...props }) {
|
|
31
|
+
return /*#__PURE__*/ jsx(Overlay, {
|
|
32
|
+
"data-slot": "sheet-overlay",
|
|
33
|
+
className: clsxWithTw("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className),
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function SheetContent({ className, children, side = "right", ...props }) {
|
|
38
|
+
return /*#__PURE__*/ jsxs(SheetPortal, {
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ jsx(SheetOverlay, {}),
|
|
41
|
+
/*#__PURE__*/ jsx(Content, {
|
|
42
|
+
"data-slot": "sheet-content",
|
|
43
|
+
className: clsxWithTw("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", "right" === side && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", "left" === side && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", "top" === side && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", "bottom" === side && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", className),
|
|
44
|
+
...props,
|
|
45
|
+
children: children
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function SheetHeader({ className, ...props }) {
|
|
51
|
+
return /*#__PURE__*/ jsx("div", {
|
|
52
|
+
"data-slot": "sheet-header",
|
|
53
|
+
className: clsxWithTw("flex flex-col gap-1.5 p-4", className),
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function SheetFooter({ className, ...props }) {
|
|
58
|
+
return /*#__PURE__*/ jsx("div", {
|
|
59
|
+
"data-slot": "sheet-footer",
|
|
60
|
+
className: clsxWithTw("mt-auto flex flex-col gap-2 p-4", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function SheetTitle({ className, ...props }) {
|
|
65
|
+
return /*#__PURE__*/ jsx(Title, {
|
|
66
|
+
"data-slot": "sheet-title",
|
|
67
|
+
className: clsxWithTw("text-foreground font-semibold", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function SheetDescription({ className, ...props }) {
|
|
72
|
+
return /*#__PURE__*/ jsx(Description, {
|
|
73
|
+
"data-slot": "sheet-description",
|
|
74
|
+
className: clsxWithTw("text-muted-foreground text-sm", className),
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createApplyHandle, getModuleHot } from "../utils/module-hot.js";
|
|
1
2
|
import { submitPostMessage, submitSlardarEvent } from "../utils/postMessage.js";
|
|
2
3
|
import { levelSchema } from "./log-types.js";
|
|
3
4
|
import { logger } from "./logger.js";
|
|
@@ -61,10 +62,17 @@ function processDevServerLog(log) {
|
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
-
const hot =
|
|
66
|
-
if (hot) hot.addStatusHandler((
|
|
67
|
-
if (
|
|
65
|
+
function listenModuleHmr() {
|
|
66
|
+
const hot = getModuleHot();
|
|
67
|
+
if (hot) hot.addStatusHandler(createApplyHandle((success)=>{
|
|
68
|
+
if (success) submitPostMessage({
|
|
69
|
+
type: 'DevServerMessage',
|
|
70
|
+
data: {
|
|
71
|
+
type: 'devServer-status',
|
|
72
|
+
status: 'hmr-apply-success'
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
else {
|
|
68
76
|
console.warn('hmr apply failed', status);
|
|
69
77
|
submitSlardarEvent({
|
|
70
78
|
name: 'sandbox-devServer',
|
|
@@ -74,7 +82,7 @@ function listenHmrApplyFailed() {
|
|
|
74
82
|
}
|
|
75
83
|
});
|
|
76
84
|
}
|
|
77
|
-
});
|
|
85
|
+
}));
|
|
78
86
|
}
|
|
79
87
|
function interceptErrors() {
|
|
80
88
|
window.addEventListener('error', (event)=>{
|
|
@@ -83,7 +91,7 @@ function interceptErrors() {
|
|
|
83
91
|
window.addEventListener('unhandledrejection', (event)=>{
|
|
84
92
|
logger.error(event.reason);
|
|
85
93
|
});
|
|
86
|
-
|
|
94
|
+
listenModuleHmr();
|
|
87
95
|
const PROXY_CONSOLE_METHOD = [
|
|
88
96
|
'log',
|
|
89
97
|
'info',
|
|
@@ -41,7 +41,7 @@ export interface HmrMessage extends IframeMessage<Record<string, never>> {
|
|
|
41
41
|
/** devServer相关消息 */
|
|
42
42
|
export interface DevServerMessage extends IframeMessage<{
|
|
43
43
|
type: 'devServer-status';
|
|
44
|
-
status: 'connected' | 'disconnected';
|
|
44
|
+
status: 'connected' | 'disconnected' | 'hmr-apply-success';
|
|
45
45
|
}> {
|
|
46
46
|
type: 'DevServerMessage';
|
|
47
47
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module Hot Replacement 状态类型定义
|
|
3
|
+
*
|
|
4
|
+
* - idle: The process is waiting for a call to check
|
|
5
|
+
* - check: The process is checking for updates
|
|
6
|
+
* - prepare: The process is getting ready for the update (e.g. downloading the updated module)
|
|
7
|
+
* - ready: The update is prepared and available
|
|
8
|
+
* - dispose: The process is calling the dispose handlers on the modules that will be replaced
|
|
9
|
+
* - apply: The process is calling the accept handlers and re-executing self-accepted modules
|
|
10
|
+
* - abort: An update was aborted, but the system is still in its previous state
|
|
11
|
+
* - fail: An update has thrown an exception and the system's state has been compromised
|
|
12
|
+
*/
|
|
13
|
+
type ModuleHotType = 'idle' | 'check' | 'prepare' | 'ready' | 'dispose' | 'apply' | 'abort' | 'fail';
|
|
14
|
+
interface ModuleHotInstance {
|
|
15
|
+
addStatusHandler: (handler: (status: ModuleHotType) => void) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function getModuleHot(): ModuleHotInstance | null;
|
|
18
|
+
/**
|
|
19
|
+
* 创建模块热更成功处理函数
|
|
20
|
+
* 监听模块热更状态,当状态为apply时,调用回调函数并传入true
|
|
21
|
+
* @param callback 热更成功回调函数,参数为是否成功
|
|
22
|
+
*/
|
|
23
|
+
export declare function createApplyHandle(callback: (success: boolean) => void): (status: ModuleHotType) => void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function getModuleHot() {
|
|
2
|
+
if ('production' === process.env.NODE_ENV) return null;
|
|
3
|
+
return import.meta.webpackHot || module.hot;
|
|
4
|
+
}
|
|
5
|
+
function createApplyHandle(callback) {
|
|
6
|
+
let hasApply = false;
|
|
7
|
+
return (status)=>{
|
|
8
|
+
if ('fail' === status || 'abort' === status) {
|
|
9
|
+
hasApply = false;
|
|
10
|
+
return callback(false);
|
|
11
|
+
}
|
|
12
|
+
if (hasApply) {
|
|
13
|
+
if ('idle' === status) {
|
|
14
|
+
hasApply = false;
|
|
15
|
+
callback(true);
|
|
16
|
+
}
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
hasApply = 'apply' === status;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export { createApplyHandle, getModuleHot };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.19-alpha.error.1",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@biomejs/biome": "2.0.6",
|
|
105
105
|
"@changesets/cli": "^2.29.5",
|
|
106
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
106
107
|
"@rsbuild/core": "~1.4.13",
|
|
107
108
|
"@rsbuild/plugin-react": "^1.3.4",
|
|
108
109
|
"@rslib/core": "^0.15.0",
|