@lark-apaas/coding-template-nestjs-react-fullstack 0.1.0-alpha.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.
Files changed (250) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +41 -0
  3. package/hooks/after-install.mjs +3 -0
  4. package/hooks/after-render.mjs +3 -0
  5. package/hooks/before-render.mjs +3 -0
  6. package/package.json +36 -0
  7. package/template/.codebase/pipelines/ci.yaml +34 -0
  8. package/template/.codebase/pipelines/coco-code-review.yaml +21 -0
  9. package/template/.prettierrc +8 -0
  10. package/template/.spark_project +16 -0
  11. package/template/.stylelintrc.js +12 -0
  12. package/template/_env.local +38 -0
  13. package/template/_gitignore +64 -0
  14. package/template/_npmrc +1 -0
  15. package/template/client/index.html +23 -0
  16. package/template/client/public/favicon.svg +40 -0
  17. package/template/client/src/api/index.ts +19 -0
  18. package/template/client/src/app.tsx +22 -0
  19. package/template/client/src/components/Layout.tsx +11 -0
  20. package/template/client/src/components/business-ui/README.md +519 -0
  21. package/template/client/src/components/business-ui/api/chats/queries.ts +39 -0
  22. package/template/client/src/components/business-ui/api/chats/service.ts +29 -0
  23. package/template/client/src/components/business-ui/api/departments/queries.ts +42 -0
  24. package/template/client/src/components/business-ui/api/departments/service.ts +18 -0
  25. package/template/client/src/components/business-ui/api/files/service.ts +28 -0
  26. package/template/client/src/components/business-ui/api/user-profiles/queries.ts +42 -0
  27. package/template/client/src/components/business-ui/api/user-profiles/service.ts +23 -0
  28. package/template/client/src/components/business-ui/api/users/queries.ts +34 -0
  29. package/template/client/src/components/business-ui/api/users/service.ts +40 -0
  30. package/template/client/src/components/business-ui/chat-select/README.md +128 -0
  31. package/template/client/src/components/business-ui/chat-select/chat-item.tsx +85 -0
  32. package/template/client/src/components/business-ui/chat-select/chat-select-tag.tsx +83 -0
  33. package/template/client/src/components/business-ui/chat-select/chat-select.tsx +197 -0
  34. package/template/client/src/components/business-ui/chat-select/index.tsx +12 -0
  35. package/template/client/src/components/business-ui/chat-select/types.ts +102 -0
  36. package/template/client/src/components/business-ui/chat-select/use-chat-value.ts +180 -0
  37. package/template/client/src/components/business-ui/chat-select/utils.ts +81 -0
  38. package/template/client/src/components/business-ui/department-select/department-item.tsx +55 -0
  39. package/template/client/src/components/business-ui/department-select/department-select-field.tsx +86 -0
  40. package/template/client/src/components/business-ui/department-select/department-select-tag.tsx +56 -0
  41. package/template/client/src/components/business-ui/department-select/department-select.tsx +168 -0
  42. package/template/client/src/components/business-ui/department-select/icon-department.tsx +22 -0
  43. package/template/client/src/components/business-ui/department-select/index.tsx +7 -0
  44. package/template/client/src/components/business-ui/department-select/types.ts +15 -0
  45. package/template/client/src/components/business-ui/department-select/utils.ts +17 -0
  46. package/template/client/src/components/business-ui/entity-combobox/base-combobox-content.tsx +35 -0
  47. package/template/client/src/components/business-ui/entity-combobox/base-combobox-empty.tsx +28 -0
  48. package/template/client/src/components/business-ui/entity-combobox/base-combobox-error.tsx +35 -0
  49. package/template/client/src/components/business-ui/entity-combobox/base-combobox-item.tsx +55 -0
  50. package/template/client/src/components/business-ui/entity-combobox/base-combobox-list.tsx +174 -0
  51. package/template/client/src/components/business-ui/entity-combobox/base-combobox-loading.tsx +19 -0
  52. package/template/client/src/components/business-ui/entity-combobox/base-combobox-search.tsx +31 -0
  53. package/template/client/src/components/business-ui/entity-combobox/base-combobox-trigger.tsx +281 -0
  54. package/template/client/src/components/business-ui/entity-combobox/base-combobox.tsx +132 -0
  55. package/template/client/src/components/business-ui/entity-combobox/context.tsx +19 -0
  56. package/template/client/src/components/business-ui/entity-combobox/entity-combobox.tsx +145 -0
  57. package/template/client/src/components/business-ui/entity-combobox/highlight-text.tsx +52 -0
  58. package/template/client/src/components/business-ui/entity-combobox/hooks.tsx +21 -0
  59. package/template/client/src/components/business-ui/entity-combobox/index.tsx +31 -0
  60. package/template/client/src/components/business-ui/entity-combobox/item-pill.tsx +179 -0
  61. package/template/client/src/components/business-ui/entity-combobox/popover-wrapper.tsx +149 -0
  62. package/template/client/src/components/business-ui/entity-combobox/search-trigger.tsx +262 -0
  63. package/template/client/src/components/business-ui/entity-combobox/shared-types.ts +296 -0
  64. package/template/client/src/components/business-ui/entity-combobox/size-variants.tsx +322 -0
  65. package/template/client/src/components/business-ui/entity-combobox/types.ts +246 -0
  66. package/template/client/src/components/business-ui/entity-combobox/use-fetch-data.tsx +81 -0
  67. package/template/client/src/components/business-ui/entity-combobox/use-infinite-scroll.tsx +99 -0
  68. package/template/client/src/components/business-ui/entity-combobox/use-popover-outside-click.tsx +32 -0
  69. package/template/client/src/components/business-ui/form/checkbox-field.tsx +83 -0
  70. package/template/client/src/components/business-ui/form/context.tsx +38 -0
  71. package/template/client/src/components/business-ui/form/field-layout.tsx +91 -0
  72. package/template/client/src/components/business-ui/form/form.tsx +54 -0
  73. package/template/client/src/components/business-ui/form/hooks/form-context.tsx +4 -0
  74. package/template/client/src/components/business-ui/form/hooks/form-utils.ts +23 -0
  75. package/template/client/src/components/business-ui/form/hooks/form.tsx +40 -0
  76. package/template/client/src/components/business-ui/form/index.tsx +4 -0
  77. package/template/client/src/components/business-ui/form/input-field.tsx +74 -0
  78. package/template/client/src/components/business-ui/form/radio-group-field.tsx +138 -0
  79. package/template/client/src/components/business-ui/form/select-field.tsx +155 -0
  80. package/template/client/src/components/business-ui/form/switch-field.tsx +66 -0
  81. package/template/client/src/components/business-ui/form/textarea-field.tsx +72 -0
  82. package/template/client/src/components/business-ui/form/types.ts +32 -0
  83. package/template/client/src/components/business-ui/tiptap-editor/README.md +324 -0
  84. package/template/client/src/components/business-ui/tiptap-editor/components/attachment-toolbar-button.tsx +74 -0
  85. package/template/client/src/components/business-ui/tiptap-editor/components/blockquote-toolbar-button.tsx +41 -0
  86. package/template/client/src/components/business-ui/tiptap-editor/components/code-block-toolbar-button.tsx +41 -0
  87. package/template/client/src/components/business-ui/tiptap-editor/components/color-highlight-toolbar-button.tsx +141 -0
  88. package/template/client/src/components/business-ui/tiptap-editor/components/heading-toolbar-button.tsx +99 -0
  89. package/template/client/src/components/business-ui/tiptap-editor/components/horizontal-rule-toolbar-button.tsx +39 -0
  90. package/template/client/src/components/business-ui/tiptap-editor/components/image-upload-toolbar-button.tsx +65 -0
  91. package/template/client/src/components/business-ui/tiptap-editor/components/link-edit-form.tsx +127 -0
  92. package/template/client/src/components/business-ui/tiptap-editor/components/link-hover-toolbar.tsx +380 -0
  93. package/template/client/src/components/business-ui/tiptap-editor/components/link-toolbar-button.tsx +96 -0
  94. package/template/client/src/components/business-ui/tiptap-editor/components/list-toolbar-button.tsx +75 -0
  95. package/template/client/src/components/business-ui/tiptap-editor/components/mark-toolbar-button.tsx +118 -0
  96. package/template/client/src/components/business-ui/tiptap-editor/components/text-align-toolbar-button.tsx +84 -0
  97. package/template/client/src/components/business-ui/tiptap-editor/components/undo-redo-toolbar-button.tsx +54 -0
  98. package/template/client/src/components/business-ui/tiptap-editor/extensions/attachment.tsx +539 -0
  99. package/template/client/src/components/business-ui/tiptap-editor/extensions/code-block-shiki.tsx +236 -0
  100. package/template/client/src/components/business-ui/tiptap-editor/extensions/complete-kit.ts +260 -0
  101. package/template/client/src/components/business-ui/tiptap-editor/extensions/image.tsx +456 -0
  102. package/template/client/src/components/business-ui/tiptap-editor/hooks/use-tiptap-editor.ts +47 -0
  103. package/template/client/src/components/business-ui/tiptap-editor/index.ts +38 -0
  104. package/template/client/src/components/business-ui/tiptap-editor/tiptap-editor-complete.tsx +112 -0
  105. package/template/client/src/components/business-ui/tiptap-editor/tiptap-editor.tsx +169 -0
  106. package/template/client/src/components/business-ui/types/user.ts +74 -0
  107. package/template/client/src/components/business-ui/user-display/index.tsx +2 -0
  108. package/template/client/src/components/business-ui/user-display/overflow-tooltip-text.tsx +90 -0
  109. package/template/client/src/components/business-ui/user-display/type.ts +27 -0
  110. package/template/client/src/components/business-ui/user-display/user-display.tsx +99 -0
  111. package/template/client/src/components/business-ui/user-display/user-with-avatar.tsx +158 -0
  112. package/template/client/src/components/business-ui/user-display/utils.ts +37 -0
  113. package/template/client/src/components/business-ui/user-profile/error-image.tsx +302 -0
  114. package/template/client/src/components/business-ui/user-profile/user-external-script.ts +73 -0
  115. package/template/client/src/components/business-ui/user-profile/user-profile.tsx +370 -0
  116. package/template/client/src/components/business-ui/user-select/index.tsx +28 -0
  117. package/template/client/src/components/business-ui/user-select/types.ts +109 -0
  118. package/template/client/src/components/business-ui/user-select/use-user-value.ts +160 -0
  119. package/template/client/src/components/business-ui/user-select/user-item.tsx +98 -0
  120. package/template/client/src/components/business-ui/user-select/user-pill.tsx +140 -0
  121. package/template/client/src/components/business-ui/user-select/user-select-tag.tsx +82 -0
  122. package/template/client/src/components/business-ui/user-select/user-select.tsx +359 -0
  123. package/template/client/src/components/business-ui/user-select/utils.tsx +188 -0
  124. package/template/client/src/components/business-ui/utils/user.ts +72 -0
  125. package/template/client/src/components/ui/README.md +134 -0
  126. package/template/client/src/components/ui/accordion.tsx +66 -0
  127. package/template/client/src/components/ui/alert-dialog.tsx +157 -0
  128. package/template/client/src/components/ui/alert.tsx +71 -0
  129. package/template/client/src/components/ui/aspect-ratio.tsx +11 -0
  130. package/template/client/src/components/ui/avatar.tsx +53 -0
  131. package/template/client/src/components/ui/badge.tsx +42 -0
  132. package/template/client/src/components/ui/breadcrumb.tsx +109 -0
  133. package/template/client/src/components/ui/button-group.tsx +83 -0
  134. package/template/client/src/components/ui/button.tsx +69 -0
  135. package/template/client/src/components/ui/calendar.tsx +213 -0
  136. package/template/client/src/components/ui/card.tsx +82 -0
  137. package/template/client/src/components/ui/carousel.tsx +241 -0
  138. package/template/client/src/components/ui/chart.tsx +357 -0
  139. package/template/client/src/components/ui/checkbox.tsx +32 -0
  140. package/template/client/src/components/ui/collapsible.tsx +33 -0
  141. package/template/client/src/components/ui/command.tsx +208 -0
  142. package/template/client/src/components/ui/context-menu.tsx +324 -0
  143. package/template/client/src/components/ui/dialog.tsx +143 -0
  144. package/template/client/src/components/ui/drawer.tsx +135 -0
  145. package/template/client/src/components/ui/dropdown-menu.tsx +329 -0
  146. package/template/client/src/components/ui/empty.tsx +104 -0
  147. package/template/client/src/components/ui/field.tsx +248 -0
  148. package/template/client/src/components/ui/form.tsx +167 -0
  149. package/template/client/src/components/ui/hover-card.tsx +44 -0
  150. package/template/client/src/components/ui/icons/file-ae-colorful-icon.tsx +21 -0
  151. package/template/client/src/components/ui/icons/file-ai-colorful-icon.tsx +36 -0
  152. package/template/client/src/components/ui/icons/file-android-colorful-icon.tsx +33 -0
  153. package/template/client/src/components/ui/icons/file-audio-colorful-icon.tsx +21 -0
  154. package/template/client/src/components/ui/icons/file-code-colorful-icon.tsx +28 -0
  155. package/template/client/src/components/ui/icons/file-csv-colorful-icon.tsx +21 -0
  156. package/template/client/src/components/ui/icons/file-eml-colorful-icon.tsx +29 -0
  157. package/template/client/src/components/ui/icons/file-ios-colorful-icon.tsx +25 -0
  158. package/template/client/src/components/ui/icons/file-keynote-colorful-icon.tsx +29 -0
  159. package/template/client/src/components/ui/icons/file-pages-colorful-icon.tsx +29 -0
  160. package/template/client/src/components/ui/icons/file-ps-colorful-icon.tsx +21 -0
  161. package/template/client/src/components/ui/icons/file-sketch-colorful-icon.tsx +21 -0
  162. package/template/client/src/components/ui/icons/file-slide-colorful-icon.tsx +21 -0
  163. package/template/client/src/components/ui/icons/file-vcf-colorful-icon.tsx +29 -0
  164. package/template/client/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +23 -0
  165. package/template/client/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +27 -0
  166. package/template/client/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +20 -0
  167. package/template/client/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +21 -0
  168. package/template/client/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +12 -0
  169. package/template/client/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +14 -0
  170. package/template/client/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +23 -0
  171. package/template/client/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +38 -0
  172. package/template/client/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +21 -0
  173. package/template/client/src/components/ui/image.tsx +183 -0
  174. package/template/client/src/components/ui/input-group.tsx +166 -0
  175. package/template/client/src/components/ui/input-otp.tsx +77 -0
  176. package/template/client/src/components/ui/input.tsx +21 -0
  177. package/template/client/src/components/ui/item.tsx +193 -0
  178. package/template/client/src/components/ui/kbd.tsx +28 -0
  179. package/template/client/src/components/ui/label.tsx +24 -0
  180. package/template/client/src/components/ui/menubar.tsx +348 -0
  181. package/template/client/src/components/ui/native-select.tsx +48 -0
  182. package/template/client/src/components/ui/navigation-menu.tsx +168 -0
  183. package/template/client/src/components/ui/pagination.tsx +127 -0
  184. package/template/client/src/components/ui/popover.tsx +48 -0
  185. package/template/client/src/components/ui/progress.tsx +31 -0
  186. package/template/client/src/components/ui/radio-group.tsx +45 -0
  187. package/template/client/src/components/ui/resizable.tsx +56 -0
  188. package/template/client/src/components/ui/scroll-area.tsx +58 -0
  189. package/template/client/src/components/ui/select.tsx +243 -0
  190. package/template/client/src/components/ui/separator.tsx +28 -0
  191. package/template/client/src/components/ui/sheet.tsx +139 -0
  192. package/template/client/src/components/ui/sidebar.tsx +727 -0
  193. package/template/client/src/components/ui/skeleton.tsx +13 -0
  194. package/template/client/src/components/ui/slider.tsx +87 -0
  195. package/template/client/src/components/ui/sonner.tsx +67 -0
  196. package/template/client/src/components/ui/spinner.tsx +16 -0
  197. package/template/client/src/components/ui/streamdown.tsx +186 -0
  198. package/template/client/src/components/ui/switch.tsx +31 -0
  199. package/template/client/src/components/ui/table.tsx +116 -0
  200. package/template/client/src/components/ui/tabs.tsx +66 -0
  201. package/template/client/src/components/ui/textarea.tsx +18 -0
  202. package/template/client/src/components/ui/toggle-group.tsx +83 -0
  203. package/template/client/src/components/ui/toggle.tsx +47 -0
  204. package/template/client/src/components/ui/tooltip.tsx +61 -0
  205. package/template/client/src/hooks/use-example.ts +52 -0
  206. package/template/client/src/hooks/use-mobile.ts +19 -0
  207. package/template/client/src/index.css +7 -0
  208. package/template/client/src/index.tsx +36 -0
  209. package/template/client/src/lib/shiki.ts +92 -0
  210. package/template/client/src/lib/utils.ts +6 -0
  211. package/template/client/src/pages/ExamplePage/ExamplePage.tsx +37 -0
  212. package/template/client/src/pages/NotFound/NotFound.tsx +11 -0
  213. package/template/client/src/tailwind-theme.css +257 -0
  214. package/template/client/src/types/common.ts +34 -0
  215. package/template/client/src/types/global.d.ts +53 -0
  216. package/template/client/src/types/index.ts +4 -0
  217. package/template/client/src/typography.css +41 -0
  218. package/template/client/src/utils/img-resources/avatar-placeholders.ts +12 -0
  219. package/template/client/src/utils/img-resources/banner-placeholders.ts +29 -0
  220. package/template/client/src/utils/img-resources/cover-placeholders.ts +47 -0
  221. package/template/components.json +21 -0
  222. package/template/eslint.config.js +50 -0
  223. package/template/nest-cli.json +25 -0
  224. package/template/package-lock.json +29195 -0
  225. package/template/package.json +202 -0
  226. package/template/postcss.config.js +10 -0
  227. package/template/scripts/build.sh +120 -0
  228. package/template/scripts/dev.js +295 -0
  229. package/template/scripts/dev.sh +2 -0
  230. package/template/scripts/lint.js +150 -0
  231. package/template/scripts/prune-smart.js +281 -0
  232. package/template/scripts/run.sh +5 -0
  233. package/template/server/app.module.ts +27 -0
  234. package/template/server/common/constants/api_response_code.ts +54 -0
  235. package/template/server/common/filters/exception.filter.ts +78 -0
  236. package/template/server/common/interfaces/api_response.interface.ts +21 -0
  237. package/template/server/common/interfaces/exception.interface.ts +19 -0
  238. package/template/server/database/schema.ts +90 -0
  239. package/template/server/main.ts +31 -0
  240. package/template/server/modules/hello/hello.controller.ts +16 -0
  241. package/template/server/modules/hello/hello.module.ts +10 -0
  242. package/template/server/modules/hello/hello.service.ts +28 -0
  243. package/template/server/modules/view/view.controller.ts +17 -0
  244. package/template/server/modules/view/view.module.ts +8 -0
  245. package/template/shared/api.interface.ts +1 -0
  246. package/template/tailwind.config.ts +9 -0
  247. package/template/tsconfig.app.json +23 -0
  248. package/template/tsconfig.json +8 -0
  249. package/template/tsconfig.node.json +16 -0
  250. package/template/vite.config.ts +10 -0
@@ -0,0 +1,302 @@
1
+ export function ErrorImage() {
2
+ return (
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="120"
6
+ height="120"
7
+ viewBox="0 0 120 120"
8
+ fill="none"
9
+ >
10
+ <path
11
+ d="M60 110C87.6142 110 110 87.6142 110 60C110 32.3858 87.6142 10 60 10C32.3858 10 10 32.3858 10 60C10 87.6142 32.3858 110 60 110Z"
12
+ fill="url(#paint0_linear_27256_157)"
13
+ fillOpacity="0.15"
14
+ />
15
+ <path
16
+ d="M27.5024 98H92.4976C103.211 88.8296 110 75.2077 110 60C110 45.8619 104.132 33.0944 94.6988 24H25.3012C23.4743 25.7613 21.781 27.6604 20.2383 29.6806V90.3194C22.3837 93.1287 24.8201 95.7039 27.5024 98Z"
17
+ fill="url(#paint1_linear_27256_157)"
18
+ />
19
+ <path
20
+ d="M94.6988 24H25.2383C22.4769 24 20.2383 26.2386 20.2383 29V37.3336H104.579C102.039 32.3483 98.6878 27.8458 94.6988 24Z"
21
+ fill="url(#paint2_linear_27256_157)"
22
+ />
23
+ <foreignObject x="9.22852" y="45.2422" width="49.614" height="56.7302">
24
+ <div
25
+ style={{
26
+ backdropFilter: 'blur(3px)',
27
+ clipPath: 'url(#bgblur_0_27256_157_clip_path)',
28
+ height: '100%',
29
+ width: '100%',
30
+ }}
31
+ />
32
+ </foreignObject>
33
+ <g filter="url(#filter0_d_27256_157)" data-figma-bg-blur-radius="6">
34
+ <path
35
+ d="M52.8426 95.9724L15.2285 95.703L27.7349 55.8064C28.1529 54.4807 28.9866 53.3247 30.1125 52.5094C31.2488 51.6857 32.6163 51.2422 34.0197 51.2422C35.4231 51.2422 36.7907 51.6857 37.9269 52.5094C39.0558 53.3251 39.8901 54.4847 40.3046 55.8143L52.8426 95.9724Z"
36
+ fill="url(#paint3_linear_27256_157)"
37
+ fillOpacity="0.9"
38
+ shapeRendering="crispEdges"
39
+ />
40
+ </g>
41
+ <foreignObject x="15.9766" y="73.7109" width="36.05" height="13.0391">
42
+ <div
43
+ style={{
44
+ backdropFilter: 'blur(1.5px)',
45
+ clipPath: 'url(#bgblur_1_27256_157_clip_path)',
46
+ height: '100%',
47
+ width: '100%',
48
+ }}
49
+ />
50
+ </foreignObject>
51
+ <g filter="url(#filter1_i_27256_157)" data-figma-bg-blur-radius="3">
52
+ <path
53
+ d="M49.0266 83.75H18.9766V83.7463L21.1819 76.7109H46.8289L49.0266 83.75Z"
54
+ fill="url(#paint4_linear_27256_157)"
55
+ fillOpacity="0.8"
56
+ />
57
+ </g>
58
+ <foreignObject x="21.0864" y="57.4062" width="25.8496" height="13.0391">
59
+ <div
60
+ style={{
61
+ backdropFilter: 'blur(1.5px)',
62
+ clipPath: 'url(#bgblur_2_27256_157_clip_path)',
63
+ height: '100%',
64
+ width: '100%',
65
+ }}
66
+ />
67
+ </foreignObject>
68
+ <g filter="url(#filter2_i_27256_157)" data-figma-bg-blur-radius="3">
69
+ <path
70
+ d="M43.936 67.4453H24.0864L26.293 60.4062H41.7383L43.936 67.4453Z"
71
+ fill="url(#paint5_linear_27256_157)"
72
+ fillOpacity="0.8"
73
+ />
74
+ </g>
75
+ <path
76
+ d="M9.19531 97.0234C9.19531 95.7463 10.2307 94.7109 11.5078 94.7109H56.1504C57.4275 94.7109 58.4629 95.7463 58.4629 97.0234C58.4629 98.3006 57.4275 99.3359 56.1504 99.3359H11.5078C10.2307 99.3359 9.19531 98.3006 9.19531 97.0234Z"
77
+ fill="url(#paint6_linear_27256_157)"
78
+ />
79
+ <path
80
+ d="M73.2383 83C63.2974 83 55.2383 74.9409 55.2383 65C55.2383 55.0591 63.2974 47 73.2383 47C83.1792 47 91.2383 55.0591 91.2383 65C91.2383 74.9409 83.1792 83 73.2383 83Z"
81
+ fill="url(#paint7_linear_27256_157)"
82
+ />
83
+ <path
84
+ d="M65.8172 59.895L70.9248 65.0026L65.8172 70.1102C65.1781 70.7493 65.1781 71.7854 65.8172 72.4244C66.4562 73.0634 67.4923 73.0634 68.1313 72.4244L73.239 67.3168L78.3466 72.4244C78.9856 73.0634 80.0217 73.0634 80.6607 72.4244C81.2998 71.7854 81.2998 70.7493 80.6607 70.1102L75.5531 65.0026L80.6607 59.895C81.2998 59.256 81.2998 58.2199 80.6607 57.5808C80.0217 56.9418 78.9856 56.9418 78.3466 57.5808L73.239 62.6885L68.1313 57.5808C67.4923 56.9418 66.4562 56.9418 65.8172 57.5808C65.1781 58.2199 65.1781 59.256 65.8172 59.895Z"
85
+ fill="#F5F6F7"
86
+ />
87
+ <defs>
88
+ <filter
89
+ id="filter0_d_27256_157"
90
+ x="9.22852"
91
+ y="45.2422"
92
+ width="49.614"
93
+ height="56.7302"
94
+ filterUnits="userSpaceOnUse"
95
+ colorInterpolationFilters="sRGB"
96
+ >
97
+ <feFlood floodOpacity="0" result="BackgroundImageFix" />
98
+ <feColorMatrix
99
+ in="SourceAlpha"
100
+ type="matrix"
101
+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
102
+ result="hardAlpha"
103
+ />
104
+ <feOffset dx="2" />
105
+ <feGaussianBlur stdDeviation="2" />
106
+ <feComposite in2="hardAlpha" operator="out" />
107
+ <feColorMatrix
108
+ type="matrix"
109
+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"
110
+ />
111
+ <feBlend
112
+ mode="normal"
113
+ in2="BackgroundImageFix"
114
+ result="effect1_dropShadow_27256_157"
115
+ />
116
+ <feBlend
117
+ mode="normal"
118
+ in="SourceGraphic"
119
+ in2="effect1_dropShadow_27256_157"
120
+ result="shape"
121
+ />
122
+ </filter>
123
+ <clipPath
124
+ id="bgblur_0_27256_157_clip_path"
125
+ transform="translate(-9.22852 -45.2422)"
126
+ >
127
+ <path d="M52.8426 95.9724L15.2285 95.703L27.7349 55.8064C28.1529 54.4807 28.9866 53.3247 30.1125 52.5094C31.2488 51.6857 32.6163 51.2422 34.0197 51.2422C35.4231 51.2422 36.7907 51.6857 37.9269 52.5094C39.0558 53.3251 39.8901 54.4847 40.3046 55.8143L52.8426 95.9724Z" />
128
+ </clipPath>
129
+ <filter
130
+ id="filter1_i_27256_157"
131
+ x="15.9766"
132
+ y="73.7109"
133
+ width="36.05"
134
+ height="13.0391"
135
+ filterUnits="userSpaceOnUse"
136
+ colorInterpolationFilters="sRGB"
137
+ >
138
+ <feFlood floodOpacity="0" result="BackgroundImageFix" />
139
+ <feBlend
140
+ mode="normal"
141
+ in="SourceGraphic"
142
+ in2="BackgroundImageFix"
143
+ result="shape"
144
+ />
145
+ <feColorMatrix
146
+ in="SourceAlpha"
147
+ type="matrix"
148
+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
149
+ result="hardAlpha"
150
+ />
151
+ <feOffset dx="1" dy="1" />
152
+ <feGaussianBlur stdDeviation="2.5" />
153
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />
154
+ <feColorMatrix
155
+ type="matrix"
156
+ values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0"
157
+ />
158
+ <feBlend
159
+ mode="normal"
160
+ in2="shape"
161
+ result="effect1_innerShadow_27256_157"
162
+ />
163
+ </filter>
164
+ <clipPath
165
+ id="bgblur_1_27256_157_clip_path"
166
+ transform="translate(-15.9766 -73.7109)"
167
+ >
168
+ <path d="M49.0266 83.75H18.9766V83.7463L21.1819 76.7109H46.8289L49.0266 83.75Z" />
169
+ </clipPath>
170
+ <filter
171
+ id="filter2_i_27256_157"
172
+ x="21.0864"
173
+ y="57.4062"
174
+ width="25.8496"
175
+ height="13.0391"
176
+ filterUnits="userSpaceOnUse"
177
+ colorInterpolationFilters="sRGB"
178
+ >
179
+ <feFlood floodOpacity="0" result="BackgroundImageFix" />
180
+ <feBlend
181
+ mode="normal"
182
+ in="SourceGraphic"
183
+ in2="BackgroundImageFix"
184
+ result="shape"
185
+ />
186
+ <feColorMatrix
187
+ in="SourceAlpha"
188
+ type="matrix"
189
+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
190
+ result="hardAlpha"
191
+ />
192
+ <feOffset dx="1" dy="1" />
193
+ <feGaussianBlur stdDeviation="2.5" />
194
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />
195
+ <feColorMatrix
196
+ type="matrix"
197
+ values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0"
198
+ />
199
+ <feBlend
200
+ mode="normal"
201
+ in2="shape"
202
+ result="effect1_innerShadow_27256_157"
203
+ />
204
+ </filter>
205
+ <clipPath
206
+ id="bgblur_2_27256_157_clip_path"
207
+ transform="translate(-21.0864 -57.4062)"
208
+ >
209
+ <path d="M43.936 67.4453H24.0864L26.293 60.4062H41.7383L43.936 67.4453Z" />
210
+ </clipPath>
211
+ <linearGradient
212
+ id="paint0_linear_27256_157"
213
+ x1="34.5399"
214
+ y1="10"
215
+ x2="104.021"
216
+ y2="36.7684"
217
+ gradientUnits="userSpaceOnUse"
218
+ >
219
+ <stop stopColor="#D0D3D6" />
220
+ <stop offset="1" stopColor="#8F959E" />
221
+ </linearGradient>
222
+ <linearGradient
223
+ id="paint1_linear_27256_157"
224
+ x1="42.2657"
225
+ y1="24"
226
+ x2="101.052"
227
+ y2="51.472"
228
+ gradientUnits="userSpaceOnUse"
229
+ >
230
+ <stop stopColor="#EFF0F1" />
231
+ <stop offset="1" stopColor="#D0D3D6" />
232
+ </linearGradient>
233
+ <linearGradient
234
+ id="paint2_linear_27256_157"
235
+ x1="40.9355"
236
+ y1="24"
237
+ x2="50.6346"
238
+ y2="47.6361"
239
+ gradientUnits="userSpaceOnUse"
240
+ >
241
+ <stop stopColor="#D0D3D6" />
242
+ <stop offset="1" stopColor="#BBBFC4" />
243
+ </linearGradient>
244
+ <linearGradient
245
+ id="paint3_linear_27256_157"
246
+ x1="28.5527"
247
+ y1="62.2286"
248
+ x2="43.9116"
249
+ y2="64.8991"
250
+ gradientUnits="userSpaceOnUse"
251
+ >
252
+ <stop stopColor="#D0D3D6" />
253
+ <stop offset="1" stopColor="#8F959E" />
254
+ </linearGradient>
255
+ <linearGradient
256
+ id="paint4_linear_27256_157"
257
+ x1="30.8635"
258
+ y1="76.7109"
259
+ x2="37.6562"
260
+ y2="83.75"
261
+ gradientUnits="userSpaceOnUse"
262
+ >
263
+ <stop stopColor="white" />
264
+ <stop offset="1" stopColor="#EFF0F1" />
265
+ </linearGradient>
266
+ <linearGradient
267
+ id="paint5_linear_27256_157"
268
+ x1="29.8238"
269
+ y1="60.4062"
270
+ x2="38.0615"
271
+ y2="67.4453"
272
+ gradientUnits="userSpaceOnUse"
273
+ >
274
+ <stop stopColor="white" />
275
+ <stop offset="1" stopColor="#EFF0F1" />
276
+ </linearGradient>
277
+ <linearGradient
278
+ id="paint6_linear_27256_157"
279
+ x1="9.19531"
280
+ y1="97.0239"
281
+ x2="19.1019"
282
+ y2="116.771"
283
+ gradientUnits="userSpaceOnUse"
284
+ >
285
+ <stop stopColor="#D0D3D6" />
286
+ <stop offset="1" stopColor="#8F959E" />
287
+ </linearGradient>
288
+ <linearGradient
289
+ id="paint7_linear_27256_157"
290
+ x1="64.0727"
291
+ y1="47"
292
+ x2="89.0859"
293
+ y2="56.6366"
294
+ gradientUnits="userSpaceOnUse"
295
+ >
296
+ <stop stopColor="#BBBFC4" />
297
+ <stop offset="1" stopColor="#8F959E" />
298
+ </linearGradient>
299
+ </defs>
300
+ </svg>
301
+ );
302
+ }
@@ -0,0 +1,73 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ export type ExternalScriptStatus = 'idle' | 'loading' | 'ready' | 'error';
4
+
5
+ export interface UseExternalScriptOptions {
6
+ removeOnUnmount?: boolean;
7
+ attributes?: Record<string, string>;
8
+ nonce?: string;
9
+ onloadCallback?: () => void;
10
+ }
11
+
12
+ /**
13
+ * 在组件生命周期内按需注入外链脚本(追加到 <body> 末尾),并返回加载状态。
14
+ * - 避免重复注入:如果页面已存在同 src 的脚本,直接标记为 ready。
15
+ * - 支持 CSP:可通过 nonce 传入。
16
+ * - 可选清理:removeOnUnmount=true 时卸载时移除脚本。
17
+ */
18
+ export function useExternalScript(
19
+ src: string,
20
+ options: UseExternalScriptOptions = {},
21
+ ): ExternalScriptStatus {
22
+ const [status, setStatus] = useState<ExternalScriptStatus>('idle');
23
+
24
+ useEffect(() => {
25
+ if (!src) return;
26
+
27
+ // 如果已经存在同 src 的脚本,直接认为已就绪
28
+ const existing = document.querySelector<HTMLScriptElement>(
29
+ `script[src="${src}"]`,
30
+ );
31
+ if (existing) {
32
+ queueMicrotask(() => {
33
+ setStatus('ready');
34
+ });
35
+ return;
36
+ }
37
+ // 在 effect 中避免同步 setState,使用微任务调度,防止级联渲染警告
38
+ let cancelled = false;
39
+ queueMicrotask(() => {
40
+ if (!cancelled) setStatus('loading');
41
+ });
42
+ const script = document.createElement('script');
43
+ script.src = src;
44
+ script.async = true;
45
+ script.defer = true;
46
+ script.crossOrigin = 'anonymous';
47
+ if (options.nonce) script.nonce = options.nonce;
48
+ Object.entries(options.attributes ?? {}).forEach(([k, v]) => {
49
+ script.setAttribute(k, v);
50
+ });
51
+
52
+ script.onload = () => {
53
+ if (!cancelled) setStatus('ready');
54
+ if (options.onloadCallback) {
55
+ options.onloadCallback();
56
+ }
57
+ };
58
+
59
+ script.onerror = () => {
60
+ if (!cancelled) setStatus('error');
61
+ };
62
+
63
+ document.body.append(script);
64
+ return () => {
65
+ cancelled = true;
66
+ if (options.removeOnUnmount) {
67
+ script.remove();
68
+ }
69
+ };
70
+ }, [options, src]);
71
+
72
+ return status;
73
+ }