@zw-team/react-lib 1.0.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/README.md +207 -0
- package/dist/components/AccessReport/index.d.ts +29 -0
- package/dist/components/AccessReport/index.js +129 -0
- package/dist/components/Avatar/Avatar.d.ts +3 -0
- package/dist/components/Avatar/Avatar.js +58 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Avatar/types.d.ts +9 -0
- package/dist/components/Avatar/types.js +0 -0
- package/dist/components/Block/Block.css +8 -0
- package/dist/components/Block/Block.d.ts +4 -0
- package/dist/components/Block/Block.js +11 -0
- package/dist/components/Block/index.d.ts +2 -0
- package/dist/components/Block/index.js +2 -0
- package/dist/components/Block/types.d.ts +3 -0
- package/dist/components/Block/types.js +0 -0
- package/dist/components/ConfigProvider/ConfigContext.d.ts +4 -0
- package/dist/components/ConfigProvider/ConfigContext.js +19 -0
- package/dist/components/ConfigProvider/ConfigProvider.d.ts +4 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +57 -0
- package/dist/components/ConfigProvider/index.d.ts +2 -0
- package/dist/components/ConfigProvider/index.js +2 -0
- package/dist/components/ConfigProvider/types.d.ts +19 -0
- package/dist/components/ConfigProvider/types.js +0 -0
- package/dist/components/CustomColumn/CustomColumn.d.ts +4 -0
- package/dist/components/CustomColumn/CustomColumn.js +388 -0
- package/dist/components/CustomColumn/CustomColumn.scss +135 -0
- package/dist/components/CustomColumn/index.d.ts +2 -0
- package/dist/components/CustomColumn/index.js +2 -0
- package/dist/components/CustomColumn/types.d.ts +19 -0
- package/dist/components/CustomColumn/types.js +0 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.js +89 -0
- package/dist/components/DatePicker/datePickerOption.d.ts +14 -0
- package/dist/components/DatePicker/datePickerOption.js +149 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DatePicker/types.d.ts +12 -0
- package/dist/components/DatePicker/types.js +0 -0
- package/dist/components/DatePickerPanel/DatePickerPanel.d.ts +6 -0
- package/dist/components/DatePickerPanel/DatePickerPanel.js +397 -0
- package/dist/components/DatePickerPanel/datePickerPanel.scss +362 -0
- package/dist/components/DatePickerPanel/index.d.ts +2 -0
- package/dist/components/DatePickerPanel/index.js +2 -0
- package/dist/components/DatePickerPanel/type.d.ts +23 -0
- package/dist/components/DatePickerPanel/type.js +0 -0
- package/dist/components/DownloadCenter/DownloadCenter.d.ts +5 -0
- package/dist/components/DownloadCenter/DownloadCenter.js +367 -0
- package/dist/components/DownloadCenter/index.css +54 -0
- package/dist/components/DownloadCenter/index.d.ts +2 -0
- package/dist/components/DownloadCenter/index.js +2 -0
- package/dist/components/DownloadCenter/types.d.ts +27 -0
- package/dist/components/DownloadCenter/types.js +0 -0
- package/dist/components/Fireworks/Fireworks.d.ts +11 -0
- package/dist/components/Fireworks/Fireworks.js +415 -0
- package/dist/components/Fireworks/imgs/birthday-cake.svg +180 -0
- package/dist/components/Fireworks/imgs/hb.png +0 -0
- package/dist/components/Fireworks/imgs/sd.png +0 -0
- package/dist/components/Fireworks/imgs/xc.png +0 -0
- package/dist/components/Fireworks/imgs/yd.png +0 -0
- package/dist/components/Fireworks/index.d.ts +2 -0
- package/dist/components/Fireworks/index.js +2 -0
- package/dist/components/Fireworks/index.scss +9 -0
- package/dist/components/Fireworks/types.d.ts +6 -0
- package/dist/components/Fireworks/types.js +0 -0
- package/dist/components/Form/Form.css +4 -0
- package/dist/components/Form/Form.d.ts +9 -0
- package/dist/components/Form/Form.js +18 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/FormItem/FormItem.css +38 -0
- package/dist/components/FormItem/FormItem.d.ts +9 -0
- package/dist/components/FormItem/FormItem.js +25 -0
- package/dist/components/FormItem/index.d.ts +1 -0
- package/dist/components/FormItem/index.js +2 -0
- package/dist/components/HomeData/HomeData.d.ts +6 -0
- package/dist/components/HomeData/HomeData.js +364 -0
- package/dist/components/HomeData/HomeData.scss +161 -0
- package/dist/components/HomeData/index.d.ts +1 -0
- package/dist/components/HomeData/index.js +2 -0
- package/dist/components/Icon/Icon.d.ts +4 -0
- package/dist/components/Icon/Icon.js +34 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Icon/types.d.ts +8 -0
- package/dist/components/Icon/types.js +0 -0
- package/dist/components/Log/index.d.ts +2 -0
- package/dist/components/Log/index.js +2 -0
- package/dist/components/Log/src/Detail.d.ts +7 -0
- package/dist/components/Log/src/Detail.js +71 -0
- package/dist/components/Log/src/Detail.scss +27 -0
- package/dist/components/Log/src/Log.d.ts +5 -0
- package/dist/components/Log/src/Log.js +335 -0
- package/dist/components/Log/src/Log.scss +50 -0
- package/dist/components/Log/src/useLogTableColumns.d.ts +2 -0
- package/dist/components/Log/src/useLogTableColumns.js +141 -0
- package/dist/components/Log/types.d.ts +5 -0
- package/dist/components/Log/types.js +0 -0
- package/dist/components/LogButton/LogButton.d.ts +4 -0
- package/dist/components/LogButton/LogButton.js +30 -0
- package/dist/components/LogButton/index.d.ts +2 -0
- package/dist/components/LogButton/index.js +2 -0
- package/dist/components/LogButton/logbutton.css +15 -0
- package/dist/components/LogButton/types.d.ts +10 -0
- package/dist/components/LogButton/types.js +0 -0
- package/dist/components/LogDialog/BiLogManager.d.ts +29 -0
- package/dist/components/LogDialog/BiLogManager.js +78 -0
- package/dist/components/LogDialog/LogDialog.d.ts +8 -0
- package/dist/components/LogDialog/LogDialog.js +106 -0
- package/dist/components/LogDialog/LogDialog.scss +29 -0
- package/dist/components/LogDialog/index.d.ts +3 -0
- package/dist/components/LogDialog/index.js +3 -0
- package/dist/components/LogDialog/types.d.ts +8 -0
- package/dist/components/LogDialog/types.js +0 -0
- package/dist/components/MediaPreview/MediaPreview.d.ts +5 -0
- package/dist/components/MediaPreview/MediaPreview.js +124 -0
- package/dist/components/MediaPreview/hook.d.ts +26 -0
- package/dist/components/MediaPreview/hook.js +174 -0
- package/dist/components/MediaPreview/index.css +202 -0
- package/dist/components/MediaPreview/index.d.ts +2 -0
- package/dist/components/MediaPreview/index.js +2 -0
- package/dist/components/MediaPreview/types.d.ts +24 -0
- package/dist/components/MediaPreview/types.js +0 -0
- package/dist/components/Modal/Modal.d.ts +3 -0
- package/dist/components/Modal/Modal.js +31 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/Modal/types.d.ts +8 -0
- package/dist/components/Modal/types.js +0 -0
- package/dist/components/ModalStore/ModalProvider.d.ts +11 -0
- package/dist/components/ModalStore/ModalProvider.js +15 -0
- package/dist/components/ModalStore/ModalStore.d.ts +78 -0
- package/dist/components/ModalStore/ModalStore.js +188 -0
- package/dist/components/ModalStore/index.d.ts +3 -0
- package/dist/components/ModalStore/index.js +4 -0
- package/dist/components/ModalStore/types.d.ts +73 -0
- package/dist/components/ModalStore/types.js +0 -0
- package/dist/components/MoreButton/MoreButton.d.ts +3 -0
- package/dist/components/MoreButton/MoreButton.js +50 -0
- package/dist/components/MoreButton/index.d.ts +2 -0
- package/dist/components/MoreButton/index.js +2 -0
- package/dist/components/MoreButton/types.d.ts +15 -0
- package/dist/components/MoreButton/types.js +0 -0
- package/dist/components/NavbarTool/NavbarTool.d.ts +5 -0
- package/dist/components/NavbarTool/NavbarTool.js +143 -0
- package/dist/components/NavbarTool/components/index.css +49 -0
- package/dist/components/NavbarTool/components/index.d.ts +5 -0
- package/dist/components/NavbarTool/components/index.js +98 -0
- package/dist/components/NavbarTool/index.css +14 -0
- package/dist/components/NavbarTool/index.d.ts +2 -0
- package/dist/components/NavbarTool/index.js +2 -0
- package/dist/components/NavbarTool/types.d.ts +40 -0
- package/dist/components/NavbarTool/types.js +0 -0
- package/dist/components/NoticeCenter/NoticeCenter.d.ts +4 -0
- package/dist/components/NoticeCenter/NoticeCenter.js +334 -0
- package/dist/components/NoticeCenter/assets/notice.png +0 -0
- package/dist/components/NoticeCenter/assets/tongzhi.png +0 -0
- package/dist/components/NoticeCenter/index.d.ts +2 -0
- package/dist/components/NoticeCenter/index.js +2 -0
- package/dist/components/NoticeCenter/noticeCenter.scss +232 -0
- package/dist/components/NoticeCenter/types.d.ts +6 -0
- package/dist/components/NoticeCenter/types.js +0 -0
- package/dist/components/Pagination/BiPagination.css +152 -0
- package/dist/components/Pagination/Pagination.d.ts +5 -0
- package/dist/components/Pagination/Pagination.js +67 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.js +2 -0
- package/dist/components/Pagination/types.d.ts +14 -0
- package/dist/components/Pagination/types.js +0 -0
- package/dist/components/ResponseInterceptor/index.d.ts +17 -0
- package/dist/components/ResponseInterceptor/index.js +43 -0
- package/dist/components/SuperDate/SuperDate.d.ts +6 -0
- package/dist/components/SuperDate/SuperDate.js +113 -0
- package/dist/components/SuperDate/SuperDate.scss +42 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.d.ts +5 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.js +87 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.scss +52 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/DynamicTimeCom.d.ts +6 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/DynamicTimeCom.js +129 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/dynamicTimeCom.scss +70 -0
- package/dist/components/SuperDate/constant.d.ts +35 -0
- package/dist/components/SuperDate/constant.js +27 -0
- package/dist/components/SuperDate/index.d.ts +2 -0
- package/dist/components/SuperDate/index.js +2 -0
- package/dist/components/SuperDate/store.d.ts +68 -0
- package/dist/components/SuperDate/store.js +254 -0
- package/dist/components/SuperDate/types.d.ts +34 -0
- package/dist/components/SuperDate/types.js +0 -0
- package/dist/components/SuperDate/utils.d.ts +18 -0
- package/dist/components/SuperDate/utils.js +14 -0
- package/dist/components/SystemLink/SystemLink.d.ts +4 -0
- package/dist/components/SystemLink/SystemLink.js +85 -0
- package/dist/components/SystemLink/index.d.ts +1 -0
- package/dist/components/SystemLink/index.js +2 -0
- package/dist/components/SystemLink/index.scss +142 -0
- package/dist/components/Table/ResizableTitle.d.ts +3 -0
- package/dist/components/Table/ResizableTitle.js +43 -0
- package/dist/components/Table/Table.d.ts +9 -0
- package/dist/components/Table/Table.js +189 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Table/index.scss +42 -0
- package/dist/components/Table/types.d.ts +24 -0
- package/dist/components/Table/types.js +0 -0
- package/dist/components/Table/useHeaderPopper.d.ts +8 -0
- package/dist/components/Table/useHeaderPopper.js +95 -0
- package/dist/components/TableHeaderPopper/EditBox.d.ts +6 -0
- package/dist/components/TableHeaderPopper/EditBox.js +208 -0
- package/dist/components/TableHeaderPopper/Popover.d.ts +6 -0
- package/dist/components/TableHeaderPopper/Popover.js +85 -0
- package/dist/components/TableHeaderPopper/index.d.ts +3 -0
- package/dist/components/TableHeaderPopper/index.js +3 -0
- package/dist/components/TableHeaderPopper/index.scss +96 -0
- package/dist/components/TaskCenter/TaskCenter.d.ts +4 -0
- package/dist/components/TaskCenter/TaskCenter.js +257 -0
- package/dist/components/TaskCenter/TaskCenter.scss +44 -0
- package/dist/components/TaskCenter/api.d.ts +13 -0
- package/dist/components/TaskCenter/api.js +13 -0
- package/dist/components/TaskCenter/index.d.ts +2 -0
- package/dist/components/TaskCenter/index.js +2 -0
- package/dist/components/TaskCenter/types.d.ts +29 -0
- package/dist/components/TaskCenter/types.js +0 -0
- package/dist/components/TooltipIcon/TooltipIcon.d.ts +3 -0
- package/dist/components/TooltipIcon/TooltipIcon.js +43 -0
- package/dist/components/TooltipIcon/index.d.ts +2 -0
- package/dist/components/TooltipIcon/index.js +2 -0
- package/dist/components/TooltipIcon/types.d.ts +14 -0
- package/dist/components/TooltipIcon/types.js +0 -0
- package/dist/components/Verification/content.d.ts +11 -0
- package/dist/components/Verification/content.js +223 -0
- package/dist/components/Verification/index.css +43 -0
- package/dist/components/Verification/index.d.ts +1 -0
- package/dist/components/Verification/index.js +37 -0
- package/dist/components/index.d.ts +32 -0
- package/dist/components/index.js +29 -0
- package/dist/config/index.d.ts +83 -0
- package/dist/config/index.js +115 -0
- package/dist/config/theme/index.d.ts +368 -0
- package/dist/config/theme/index.js +369 -0
- package/dist/hooks/createAlive.d.ts +11 -0
- package/dist/hooks/createAlive.js +22 -0
- package/dist/hooks/createGlobalState.d.ts +7 -0
- package/dist/hooks/createGlobalState.js +28 -0
- package/dist/hooks/index.d.ts +26 -0
- package/dist/hooks/index.js +25 -0
- package/dist/hooks/useAsync.d.ts +27 -0
- package/dist/hooks/useAsync.js +76 -0
- package/dist/hooks/useClickOther.d.ts +10 -0
- package/dist/hooks/useClickOther.js +30 -0
- package/dist/hooks/useCopyToClipboard.d.ts +7 -0
- package/dist/hooks/useCopyToClipboard.js +32 -0
- package/dist/hooks/useCreate.d.ts +7 -0
- package/dist/hooks/useCreate.js +21 -0
- package/dist/hooks/useEventListener.d.ts +22 -0
- package/dist/hooks/useEventListener.js +33 -0
- package/dist/hooks/useHistoryStore.d.ts +16 -0
- package/dist/hooks/useHistoryStore.js +106 -0
- package/dist/hooks/useIntersectionObserver.d.ts +8 -0
- package/dist/hooks/useIntersectionObserver.js +23 -0
- package/dist/hooks/useInterval.d.ts +8 -0
- package/dist/hooks/useInterval.js +19 -0
- package/dist/hooks/useLatest.d.ts +2 -0
- package/dist/hooks/useLatest.js +12 -0
- package/dist/hooks/useLockAsyncFn.d.ts +7 -0
- package/dist/hooks/useLockAsyncFn.js +24 -0
- package/dist/hooks/useLockFn.d.ts +7 -0
- package/dist/hooks/useLockFn.js +17 -0
- package/dist/hooks/useMergedState.d.ts +10 -0
- package/dist/hooks/useMergedState.js +30 -0
- package/dist/hooks/useMountedState.d.ts +4 -0
- package/dist/hooks/useMountedState.js +13 -0
- package/dist/hooks/usePermission.d.ts +8 -0
- package/dist/hooks/usePermission.js +21 -0
- package/dist/hooks/usePersistFn.d.ts +8 -0
- package/dist/hooks/usePersistFn.js +13 -0
- package/dist/hooks/useReactive.d.ts +7 -0
- package/dist/hooks/useReactive.js +34 -0
- package/dist/hooks/useRefresh.d.ts +5 -0
- package/dist/hooks/useRefresh.js +8 -0
- package/dist/hooks/useToggle.d.ts +16 -0
- package/dist/hooks/useToggle.js +20 -0
- package/dist/hooks/useUnmount.d.ts +6 -0
- package/dist/hooks/useUnmount.js +10 -0
- package/dist/hooks/useUpdateEffect.d.ts +9 -0
- package/dist/hooks/useUpdateEffect.js +10 -0
- package/dist/hooks/useWindowSize.d.ts +6 -0
- package/dist/hooks/useWindowSize.js +15 -0
- package/dist/hooks/util.d.ts +9 -0
- package/dist/hooks/util.js +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/utils/array.d.ts +12 -0
- package/dist/utils/array.js +15 -0
- package/dist/utils/classNames.d.ts +4 -0
- package/dist/utils/classNames.js +19 -0
- package/dist/utils/date.d.ts +98 -0
- package/dist/utils/date.js +101 -0
- package/dist/utils/debounce.d.ts +8 -0
- package/dist/utils/debounce.js +38 -0
- package/dist/utils/deepClone.d.ts +6 -0
- package/dist/utils/deepClone.js +10 -0
- package/dist/utils/empty.d.ts +16 -0
- package/dist/utils/empty.js +24 -0
- package/dist/utils/formatPrice.d.ts +2 -0
- package/dist/utils/formatPrice.js +15 -0
- package/dist/utils/getUUID.d.ts +1 -0
- package/dist/utils/getUUID.js +17 -0
- package/dist/utils/getUrlParams.d.ts +11 -0
- package/dist/utils/getUrlParams.js +10 -0
- package/dist/utils/index.d.ts +20 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/listToTree.d.ts +12 -0
- package/dist/utils/listToTree.js +14 -0
- package/dist/utils/object.d.ts +6 -0
- package/dist/utils/object.js +5 -0
- package/dist/utils/ossUpload.d.ts +45 -0
- package/dist/utils/ossUpload.js +88 -0
- package/dist/utils/parseTo.d.ts +6 -0
- package/dist/utils/parseTo.js +9 -0
- package/dist/utils/request/accessReport.d.ts +2 -0
- package/dist/utils/request/accessReport.js +27 -0
- package/dist/utils/request/defaultRequest.d.ts +9 -0
- package/dist/utils/request/defaultRequest.js +33 -0
- package/dist/utils/request/exportDownload.d.ts +2 -0
- package/dist/utils/request/exportDownload.js +28 -0
- package/dist/utils/request/index.d.ts +29 -0
- package/dist/utils/request/index.js +40 -0
- package/dist/utils/request/noticeCenter.d.ts +2 -0
- package/dist/utils/request/noticeCenter.js +28 -0
- package/dist/utils/svgIcon/index.d.ts +47 -0
- package/dist/utils/svgIcon/index.js +76 -0
- package/dist/utils/throttle.d.ts +10 -0
- package/dist/utils/throttle.js +21 -0
- package/dist/utils/time/index.d.ts +7 -0
- package/dist/utils/time/index.js +12 -0
- package/dist/utils/tools.d.ts +43 -0
- package/dist/utils/tools.js +57 -0
- package/package.json +116 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { eventEmitter } from "../../utils/tools.js";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
const POOL_SIZE = 600;
|
|
6
|
+
const CONFIG = {
|
|
7
|
+
PARTICLES_PER_BURST: 200,
|
|
8
|
+
SIZES: {
|
|
9
|
+
RECTANGLE: {
|
|
10
|
+
WIDTH: 24,
|
|
11
|
+
HEIGHT: 12
|
|
12
|
+
},
|
|
13
|
+
SQUARE: {
|
|
14
|
+
SIZE: 12
|
|
15
|
+
},
|
|
16
|
+
CIRCLE: {
|
|
17
|
+
SIZE: 12
|
|
18
|
+
},
|
|
19
|
+
TRIANGLE: {
|
|
20
|
+
SIZE: 10
|
|
21
|
+
},
|
|
22
|
+
OVAL: {
|
|
23
|
+
WIDTH: 24,
|
|
24
|
+
HEIGHT: 12
|
|
25
|
+
},
|
|
26
|
+
IMAGE: {
|
|
27
|
+
WIDTH: 30,
|
|
28
|
+
HEIGHT: 30
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
ROTATION: {
|
|
32
|
+
BASE_SPEED: 2,
|
|
33
|
+
RANDOM_SPEED: 3,
|
|
34
|
+
DECAY: 0.85
|
|
35
|
+
},
|
|
36
|
+
COLORS: [
|
|
37
|
+
'rgba(255, 68, 68, 1)',
|
|
38
|
+
'rgba(255, 68, 68, 0.9)',
|
|
39
|
+
'rgba(255, 68, 68, 0.8)',
|
|
40
|
+
'rgba(255, 116, 188, 1)',
|
|
41
|
+
'rgba(255, 116, 188, 0.9)',
|
|
42
|
+
'rgba(255, 116, 188, 0.8)',
|
|
43
|
+
'rgba(68, 68, 255, 0.8)',
|
|
44
|
+
'rgba(92, 202, 56, 0.7)',
|
|
45
|
+
'rgba(255, 68, 255, 0.8)',
|
|
46
|
+
'rgba(68, 255, 255, 0.7)',
|
|
47
|
+
'rgba(255, 136, 68, 0.7)',
|
|
48
|
+
'rgba(68, 136, 255, 1)',
|
|
49
|
+
'rgba(250, 198, 122, 0.8)'
|
|
50
|
+
],
|
|
51
|
+
SHAPES: [
|
|
52
|
+
'rectangle',
|
|
53
|
+
'rectangle',
|
|
54
|
+
'rectangle',
|
|
55
|
+
'rectangle',
|
|
56
|
+
'rectangle',
|
|
57
|
+
'rectangle',
|
|
58
|
+
'rectangle',
|
|
59
|
+
'circle',
|
|
60
|
+
'triangle',
|
|
61
|
+
'oval'
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
const imageCache = {};
|
|
65
|
+
const preloadImage = (item)=>new Promise((resolve, reject)=>{
|
|
66
|
+
if (imageCache[item.key]) if (imageCache[item.key].complete) resolve({
|
|
67
|
+
key: item.key,
|
|
68
|
+
val: imageCache[item.key]
|
|
69
|
+
});
|
|
70
|
+
else {
|
|
71
|
+
imageCache[item.key].onload = ()=>resolve({
|
|
72
|
+
key: item.key,
|
|
73
|
+
val: imageCache[item.key]
|
|
74
|
+
});
|
|
75
|
+
imageCache[item.key].onerror = reject;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const img = new Image();
|
|
79
|
+
img.crossOrigin = 'anonymous';
|
|
80
|
+
img.src = item.url;
|
|
81
|
+
resolve({
|
|
82
|
+
key: item.key,
|
|
83
|
+
val: img
|
|
84
|
+
});
|
|
85
|
+
img.onerror = reject;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var Fireworks_TriggerFireworksKeys = /*#__PURE__*/ function(TriggerFireworksKeys) {
|
|
89
|
+
TriggerFireworksKeys["BIRTHDAY_CAKE"] = "birthdayCake";
|
|
90
|
+
TriggerFireworksKeys["SD"] = "sd";
|
|
91
|
+
TriggerFireworksKeys["YD"] = "yd";
|
|
92
|
+
TriggerFireworksKeys["BP"] = "bp";
|
|
93
|
+
TriggerFireworksKeys["XC"] = "xc";
|
|
94
|
+
return TriggerFireworksKeys;
|
|
95
|
+
}({});
|
|
96
|
+
const Fireworks = ({ extraImageList = [] })=>{
|
|
97
|
+
const canvasRef = useRef(null);
|
|
98
|
+
const canvasCtx = useRef(null);
|
|
99
|
+
const particlePool = useRef([]);
|
|
100
|
+
const fireworks = useRef([]);
|
|
101
|
+
const animationFrame = useRef(null);
|
|
102
|
+
const showBirthdayCake = useRef(false);
|
|
103
|
+
const cakeImage = useRef(null);
|
|
104
|
+
const lastFrameTime = useRef(0);
|
|
105
|
+
const cakeHideTimer = useRef(null);
|
|
106
|
+
const init = async ()=>{
|
|
107
|
+
if (canvasRef.current) {
|
|
108
|
+
canvasCtx.current = canvasRef.current.getContext('2d');
|
|
109
|
+
resizeCanvas();
|
|
110
|
+
}
|
|
111
|
+
initParticlePool();
|
|
112
|
+
await preloadAllImages();
|
|
113
|
+
animate();
|
|
114
|
+
addEventListeners();
|
|
115
|
+
eventEmitter.on('triggerFireworks', handleTriggerFireworks);
|
|
116
|
+
};
|
|
117
|
+
const cleanup = ()=>{
|
|
118
|
+
if (animationFrame.current) cancelAnimationFrame(animationFrame.current);
|
|
119
|
+
if (cakeHideTimer.current) {
|
|
120
|
+
clearTimeout(cakeHideTimer.current);
|
|
121
|
+
cakeHideTimer.current = null;
|
|
122
|
+
}
|
|
123
|
+
removeEventListeners();
|
|
124
|
+
eventEmitter.off('triggerFireworks', ()=>handleTriggerFireworks());
|
|
125
|
+
};
|
|
126
|
+
const initParticlePool = ()=>{
|
|
127
|
+
for(let i = 0; i < POOL_SIZE; i++)particlePool.current.push({
|
|
128
|
+
x: 0,
|
|
129
|
+
y: 0,
|
|
130
|
+
color: '',
|
|
131
|
+
velocity: {
|
|
132
|
+
x: 0,
|
|
133
|
+
y: 0
|
|
134
|
+
},
|
|
135
|
+
rotation: 0,
|
|
136
|
+
rotationX: 0,
|
|
137
|
+
rotationY: 0,
|
|
138
|
+
scale: 1,
|
|
139
|
+
shape: 'circle',
|
|
140
|
+
active: false,
|
|
141
|
+
rotationSpeed: {
|
|
142
|
+
x: 0,
|
|
143
|
+
y: 0,
|
|
144
|
+
z: 0
|
|
145
|
+
},
|
|
146
|
+
opacity: 1
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
const getParticleFromPool = ()=>{
|
|
150
|
+
const particle = particlePool.current.find((p)=>!p.active);
|
|
151
|
+
if (particle) {
|
|
152
|
+
particle.active = true;
|
|
153
|
+
return particle;
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
};
|
|
157
|
+
const createFirework = (imageUrl)=>{
|
|
158
|
+
setTimeout(()=>{
|
|
159
|
+
const startX = Math.random() * window.innerWidth;
|
|
160
|
+
const startY = window.innerHeight;
|
|
161
|
+
const availableShapes = imageUrl && imageCache[imageUrl] ? [
|
|
162
|
+
'image'
|
|
163
|
+
] : CONFIG.SHAPES;
|
|
164
|
+
for(let i = 0; i < CONFIG.PARTICLES_PER_BURST; i++){
|
|
165
|
+
const particle = getParticleFromPool();
|
|
166
|
+
if (!particle) continue;
|
|
167
|
+
const angle = Math.PI * i / (CONFIG.PARTICLES_PER_BURST / 2);
|
|
168
|
+
const speed = (12 + 6 * Math.random()) * 1.5;
|
|
169
|
+
const spread = Math.random() * Math.PI * 2;
|
|
170
|
+
Object.assign(particle, {
|
|
171
|
+
x: startX,
|
|
172
|
+
y: startY,
|
|
173
|
+
color: CONFIG.COLORS[Math.floor(Math.random() * CONFIG.COLORS.length)],
|
|
174
|
+
velocity: {
|
|
175
|
+
x: Math.cos(angle) * Math.cos(spread) * speed * (0.5 * Math.random() + 0.5),
|
|
176
|
+
y: Math.sin(angle) * speed - 15
|
|
177
|
+
},
|
|
178
|
+
rotation: 360 * Math.random(),
|
|
179
|
+
rotationX: 360 * Math.random() - 180,
|
|
180
|
+
rotationY: 360 * Math.random() - 180,
|
|
181
|
+
scale: 0.8 + 0.4 * Math.random(),
|
|
182
|
+
shape: availableShapes[Math.floor(Math.random() * availableShapes.length)],
|
|
183
|
+
imageUrl: imageUrl && imageCache[imageUrl] ? imageUrl : void 0,
|
|
184
|
+
rotationSpeed: {
|
|
185
|
+
x: (Math.random() * CONFIG.ROTATION.RANDOM_SPEED + CONFIG.ROTATION.BASE_SPEED) * (Math.random() > 0.5 ? 1 : -1),
|
|
186
|
+
y: (Math.random() * CONFIG.ROTATION.RANDOM_SPEED + CONFIG.ROTATION.BASE_SPEED) * (Math.random() > 0.5 ? 1 : -1),
|
|
187
|
+
z: (Math.random() * CONFIG.ROTATION.RANDOM_SPEED + CONFIG.ROTATION.BASE_SPEED) * (Math.random() > 0.5 ? 1 : -1)
|
|
188
|
+
},
|
|
189
|
+
opacity: 1
|
|
190
|
+
});
|
|
191
|
+
fireworks.current.push(particle);
|
|
192
|
+
}
|
|
193
|
+
}, 0);
|
|
194
|
+
};
|
|
195
|
+
const updateFireworks = ()=>{
|
|
196
|
+
const velocityThreshold = 10;
|
|
197
|
+
const opacityDecay = 0.02;
|
|
198
|
+
for(let i = fireworks.current.length - 1; i >= 0; i--){
|
|
199
|
+
const firework = fireworks.current[i];
|
|
200
|
+
firework.x += firework.velocity.x;
|
|
201
|
+
firework.y += firework.velocity.y;
|
|
202
|
+
firework.velocity.y += 0.525;
|
|
203
|
+
firework.rotation += firework.rotationSpeed.z;
|
|
204
|
+
firework.rotationX += firework.rotationSpeed.x;
|
|
205
|
+
firework.rotationY += firework.rotationSpeed.y;
|
|
206
|
+
firework.rotationSpeed.x *= CONFIG.ROTATION.DECAY;
|
|
207
|
+
firework.rotationSpeed.y *= CONFIG.ROTATION.DECAY;
|
|
208
|
+
firework.rotationSpeed.z *= CONFIG.ROTATION.DECAY;
|
|
209
|
+
if (firework.velocity.y > velocityThreshold) {
|
|
210
|
+
firework.opacity -= opacityDecay;
|
|
211
|
+
if (firework.opacity <= 0) {
|
|
212
|
+
firework.active = false;
|
|
213
|
+
fireworks.current.splice(i, 1);
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (firework.x < -100 || firework.x > window.innerWidth + 100 || firework.y < -100 || firework.y > window.innerHeight + 100) {
|
|
218
|
+
firework.active = false;
|
|
219
|
+
fireworks.current.splice(i, 1);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (showBirthdayCake.current && 0 === fireworks.current.length && !cakeHideTimer.current) cakeHideTimer.current = setTimeout(()=>{
|
|
223
|
+
showBirthdayCake.current = false;
|
|
224
|
+
cakeHideTimer.current = null;
|
|
225
|
+
}, 1000);
|
|
226
|
+
};
|
|
227
|
+
const drawFirework = (firework)=>{
|
|
228
|
+
if (!canvasCtx.current) return;
|
|
229
|
+
canvasCtx.current.save();
|
|
230
|
+
canvasCtx.current.globalAlpha = firework.opacity;
|
|
231
|
+
canvasCtx.current.translate(firework.x, firework.y);
|
|
232
|
+
canvasCtx.current.rotate(firework.rotation * Math.PI / 180);
|
|
233
|
+
canvasCtx.current.scale(firework.scale, firework.scale);
|
|
234
|
+
switch(firework.shape){
|
|
235
|
+
case 'rectangle':
|
|
236
|
+
canvasCtx.current.fillStyle = firework.color;
|
|
237
|
+
canvasCtx.current.fillRect(-CONFIG.SIZES.RECTANGLE.WIDTH / 2, -CONFIG.SIZES.RECTANGLE.HEIGHT / 2, CONFIG.SIZES.RECTANGLE.WIDTH, CONFIG.SIZES.RECTANGLE.HEIGHT);
|
|
238
|
+
break;
|
|
239
|
+
case 'square':
|
|
240
|
+
canvasCtx.current.fillStyle = firework.color;
|
|
241
|
+
canvasCtx.current.fillRect(-CONFIG.SIZES.SQUARE.SIZE / 2, -CONFIG.SIZES.SQUARE.SIZE / 2, CONFIG.SIZES.SQUARE.SIZE, CONFIG.SIZES.SQUARE.SIZE);
|
|
242
|
+
break;
|
|
243
|
+
case 'circle':
|
|
244
|
+
canvasCtx.current.fillStyle = firework.color;
|
|
245
|
+
canvasCtx.current.beginPath();
|
|
246
|
+
canvasCtx.current.arc(0, 0, CONFIG.SIZES.CIRCLE.SIZE / 2, 0, 2 * Math.PI);
|
|
247
|
+
canvasCtx.current.closePath();
|
|
248
|
+
canvasCtx.current.fill();
|
|
249
|
+
break;
|
|
250
|
+
case 'triangle':
|
|
251
|
+
canvasCtx.current.fillStyle = firework.color;
|
|
252
|
+
canvasCtx.current.beginPath();
|
|
253
|
+
canvasCtx.current.moveTo(0, -CONFIG.SIZES.TRIANGLE.SIZE);
|
|
254
|
+
canvasCtx.current.lineTo(CONFIG.SIZES.TRIANGLE.SIZE, CONFIG.SIZES.TRIANGLE.SIZE);
|
|
255
|
+
canvasCtx.current.lineTo(-CONFIG.SIZES.TRIANGLE.SIZE, CONFIG.SIZES.TRIANGLE.SIZE);
|
|
256
|
+
canvasCtx.current.closePath();
|
|
257
|
+
canvasCtx.current.fill();
|
|
258
|
+
break;
|
|
259
|
+
case 'oval':
|
|
260
|
+
canvasCtx.current.fillStyle = firework.color;
|
|
261
|
+
canvasCtx.current.beginPath();
|
|
262
|
+
if (canvasCtx.current.ellipse) canvasCtx.current.ellipse(0, 0, CONFIG.SIZES.OVAL.WIDTH / 2, CONFIG.SIZES.OVAL.HEIGHT / 2, 0, 0, 2 * Math.PI);
|
|
263
|
+
else canvasCtx.current.arc(0, 0, Math.max(CONFIG.SIZES.OVAL.WIDTH, CONFIG.SIZES.OVAL.HEIGHT) / 2, 0, 2 * Math.PI);
|
|
264
|
+
canvasCtx.current.closePath();
|
|
265
|
+
canvasCtx.current.fill();
|
|
266
|
+
break;
|
|
267
|
+
case 'image':
|
|
268
|
+
if (firework.imageUrl) {
|
|
269
|
+
const img = imageCache[firework.imageUrl];
|
|
270
|
+
if (img?.complete) canvasCtx.current.drawImage(img, -CONFIG.SIZES.IMAGE.WIDTH / 2, -CONFIG.SIZES.IMAGE.HEIGHT / 2, CONFIG.SIZES.IMAGE.WIDTH, CONFIG.SIZES.IMAGE.HEIGHT);
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
default:
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
canvasCtx.current.restore();
|
|
277
|
+
};
|
|
278
|
+
const draw = ()=>{
|
|
279
|
+
if (!canvasCtx.current || !canvasRef.current) return;
|
|
280
|
+
canvasCtx.current.clearRect(0, 0, canvasRef.current.width, canvasRef.current.height);
|
|
281
|
+
if (showBirthdayCake.current) drawBirthdayCake();
|
|
282
|
+
canvasCtx.current.globalCompositeOperation = 'lighter';
|
|
283
|
+
fireworks.current.forEach((firework)=>{
|
|
284
|
+
drawFirework(firework);
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
const drawBirthdayCake = ()=>{
|
|
288
|
+
if (!canvasCtx.current || !canvasRef.current) return;
|
|
289
|
+
const canvas = canvasRef.current;
|
|
290
|
+
const cakeWidth = 300;
|
|
291
|
+
const cakeHeight = 360;
|
|
292
|
+
const x = (canvas.width - cakeWidth) / 2;
|
|
293
|
+
const y = (canvas.height - cakeHeight) / 2;
|
|
294
|
+
canvasCtx.current.save();
|
|
295
|
+
if (cakeImage.current?.complete) {
|
|
296
|
+
canvasCtx.current.globalAlpha = 0.8;
|
|
297
|
+
canvasCtx.current.drawImage(cakeImage.current, x, y, cakeWidth, cakeHeight);
|
|
298
|
+
} else {
|
|
299
|
+
canvasCtx.current.fillStyle = 'rgba(255, 182, 193, 0.8)';
|
|
300
|
+
canvasCtx.current.fillRect(x, y, cakeWidth, cakeHeight);
|
|
301
|
+
canvasCtx.current.strokeStyle = 'rgba(255, 105, 180, 1)';
|
|
302
|
+
canvasCtx.current.lineWidth = 3;
|
|
303
|
+
canvasCtx.current.strokeRect(x, y, cakeWidth, cakeHeight);
|
|
304
|
+
canvasCtx.current.fillStyle = 'white';
|
|
305
|
+
canvasCtx.current.font = 'bold 24px Arial';
|
|
306
|
+
canvasCtx.current.textAlign = 'center';
|
|
307
|
+
canvasCtx.current.fillText('🎂 Birthday Cake 🎂', canvas.width / 2, canvas.height / 2);
|
|
308
|
+
}
|
|
309
|
+
canvasCtx.current.restore();
|
|
310
|
+
};
|
|
311
|
+
const animate = ()=>{
|
|
312
|
+
const currentTime = performance.now();
|
|
313
|
+
updateFireworks();
|
|
314
|
+
draw();
|
|
315
|
+
lastFrameTime.current = currentTime;
|
|
316
|
+
animationFrame.current = requestAnimationFrame(animate);
|
|
317
|
+
};
|
|
318
|
+
const handleKeyPress = (event)=>{
|
|
319
|
+
if (event.ctrlKey && event.shiftKey && 'p' === event.key.toLowerCase() || event.metaKey && event.shiftKey && 'p' === event.key.toLowerCase()) {
|
|
320
|
+
event.preventDefault();
|
|
321
|
+
createFirework();
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
const resizeCanvas = ()=>{
|
|
325
|
+
if (canvasRef.current) {
|
|
326
|
+
canvasRef.current.width = window.innerWidth;
|
|
327
|
+
canvasRef.current.height = window.innerHeight;
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
const preloadAllImages = async ()=>{
|
|
331
|
+
const birthdayCake = await import("./imgs/birthday-cake.svg");
|
|
332
|
+
const sd = await import("./imgs/sd.png");
|
|
333
|
+
const yd = await import("./imgs/yd.png");
|
|
334
|
+
const bp = await import("./imgs/hb.png");
|
|
335
|
+
const xc = await import("./imgs/xc.png");
|
|
336
|
+
const defaultImageList = [
|
|
337
|
+
{
|
|
338
|
+
key: 'birthdayCake',
|
|
339
|
+
url: birthdayCake.default
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
key: 'sd',
|
|
343
|
+
url: sd.default
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
key: 'yd',
|
|
347
|
+
url: yd.default
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
key: 'bp',
|
|
351
|
+
url: bp.default
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
key: 'xc',
|
|
355
|
+
url: xc.default
|
|
356
|
+
}
|
|
357
|
+
];
|
|
358
|
+
const _loadImages = async (urls)=>{
|
|
359
|
+
try {
|
|
360
|
+
const images = await Promise.all(urls.map((item)=>preloadImage(item)));
|
|
361
|
+
if (images.length > 0) {
|
|
362
|
+
const cache = images.reduce((acc, item)=>{
|
|
363
|
+
acc[item.key] = item.val;
|
|
364
|
+
return acc;
|
|
365
|
+
}, {});
|
|
366
|
+
Object.assign(imageCache, cache);
|
|
367
|
+
}
|
|
368
|
+
cakeImage.current = imageCache['birthdayCake'];
|
|
369
|
+
} catch (error) {
|
|
370
|
+
console.error('Image preloading failed', error);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
_loadImages([
|
|
374
|
+
...defaultImageList,
|
|
375
|
+
...extraImageList
|
|
376
|
+
]);
|
|
377
|
+
};
|
|
378
|
+
const addEventListeners = ()=>{
|
|
379
|
+
window.addEventListener('keydown', handleKeyPress);
|
|
380
|
+
window.addEventListener('resize', resizeCanvas);
|
|
381
|
+
};
|
|
382
|
+
const removeEventListeners = ()=>{
|
|
383
|
+
window.removeEventListener('keydown', handleKeyPress);
|
|
384
|
+
window.removeEventListener('resize', resizeCanvas);
|
|
385
|
+
};
|
|
386
|
+
const handleTriggerFireworks = (imageUrl)=>{
|
|
387
|
+
console.log('imageUrl', imageUrl);
|
|
388
|
+
if ('cake-mode' === imageUrl) {
|
|
389
|
+
if (!showBirthdayCake.current) showBirthdayCake.current = true;
|
|
390
|
+
if (cakeHideTimer.current) {
|
|
391
|
+
clearTimeout(cakeHideTimer.current);
|
|
392
|
+
cakeHideTimer.current = null;
|
|
393
|
+
}
|
|
394
|
+
cakeHideTimer.current = setTimeout(()=>{
|
|
395
|
+
showBirthdayCake.current = false;
|
|
396
|
+
cakeHideTimer.current = null;
|
|
397
|
+
}, 2000);
|
|
398
|
+
createFirework();
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
imageUrl && imageCache[imageUrl] && imageCache[imageUrl].complete ? createFirework(imageUrl) : createFirework();
|
|
402
|
+
};
|
|
403
|
+
useEffect(()=>{
|
|
404
|
+
init();
|
|
405
|
+
return ()=>{
|
|
406
|
+
cleanup();
|
|
407
|
+
};
|
|
408
|
+
}, []);
|
|
409
|
+
return /*#__PURE__*/ jsx("canvas", {
|
|
410
|
+
ref: canvasRef,
|
|
411
|
+
className: 'layout-fireworks'
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
const Fireworks_Fireworks = Fireworks;
|
|
415
|
+
export { Fireworks_TriggerFireworksKeys as TriggerFireworksKeys, Fireworks_Fireworks as default };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
<svg width="200" height="240" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<!-- 渐变定义 -->
|
|
4
|
+
<linearGradient id="cakeGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
5
|
+
<stop offset="0%" style="stop-color:#FFB6C1;stop-opacity:1" />
|
|
6
|
+
<stop offset="100%" style="stop-color:#FF69B4;stop-opacity:1" />
|
|
7
|
+
</linearGradient>
|
|
8
|
+
|
|
9
|
+
<linearGradient id="cakeGradient2" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
10
|
+
<stop offset="0%" style="stop-color:#F0E68C;stop-opacity:1" />
|
|
11
|
+
<stop offset="100%" style="stop-color:#DAA520;stop-opacity:1" />
|
|
12
|
+
</linearGradient>
|
|
13
|
+
|
|
14
|
+
<linearGradient id="cakeGradient3" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
15
|
+
<stop offset="0%" style="stop-color:#98FB98;stop-opacity:1" />
|
|
16
|
+
<stop offset="100%" style="stop-color:#32CD32;stop-opacity:1" />
|
|
17
|
+
</linearGradient>
|
|
18
|
+
|
|
19
|
+
<radialGradient id="flameGradient" cx="50%" cy="80%" r="60%">
|
|
20
|
+
<stop offset="0%" style="stop-color:#FFF8DC;stop-opacity:1" />
|
|
21
|
+
<stop offset="30%" style="stop-color:#FFD700;stop-opacity:1" />
|
|
22
|
+
<stop offset="60%" style="stop-color:#FF8C00;stop-opacity:1" />
|
|
23
|
+
<stop offset="100%" style="stop-color:#FF4500;stop-opacity:0.9" />
|
|
24
|
+
</radialGradient>
|
|
25
|
+
|
|
26
|
+
<radialGradient id="plateGradient" cx="50%" cy="30%" r="70%">
|
|
27
|
+
<stop offset="0%" style="stop-color:#F5F5F5;stop-opacity:1" />
|
|
28
|
+
<stop offset="100%" style="stop-color:#DCDCDC;stop-opacity:1" />
|
|
29
|
+
</radialGradient>
|
|
30
|
+
</defs>
|
|
31
|
+
|
|
32
|
+
<!-- 盘子 -->
|
|
33
|
+
<ellipse cx="100" cy="220" rx="90" ry="15" fill="url(#plateGradient)" stroke="#C0C0C0" stroke-width="2"/>
|
|
34
|
+
|
|
35
|
+
<!-- 蛋糕底层 -->
|
|
36
|
+
<ellipse cx="100" cy="190" rx="75" ry="12" fill="url(#cakeGradient3)"/>
|
|
37
|
+
<rect x="25" y="178" width="150" height="25" fill="url(#cakeGradient3)"/>
|
|
38
|
+
<ellipse cx="100" cy="178" rx="75" ry="12" fill="#90EE90"/>
|
|
39
|
+
|
|
40
|
+
<!-- 蛋糕中层 -->
|
|
41
|
+
<ellipse cx="100" cy="160" rx="60" ry="10" fill="url(#cakeGradient2)"/>
|
|
42
|
+
<rect x="40" y="150" width="120" height="20" fill="url(#cakeGradient2)"/>
|
|
43
|
+
<ellipse cx="100" cy="150" rx="60" ry="10" fill="#F5DEB3"/>
|
|
44
|
+
|
|
45
|
+
<!-- 蛋糕顶层 -->
|
|
46
|
+
<ellipse cx="100" cy="135" rx="45" ry="8" fill="url(#cakeGradient)"/>
|
|
47
|
+
<rect x="55" y="127" width="90" height="16" fill="url(#cakeGradient)"/>
|
|
48
|
+
<ellipse cx="100" cy="127" rx="45" ry="8" fill="#FFB6C1"/>
|
|
49
|
+
|
|
50
|
+
<!-- 装饰樱桃 -->
|
|
51
|
+
<circle cx="80" cy="127" r="3" fill="#DC143C">
|
|
52
|
+
<animate attributeName="r" values="3;4;3" dur="2s" repeatCount="indefinite"/>
|
|
53
|
+
</circle>
|
|
54
|
+
<circle cx="120" cy="127" r="3" fill="#DC143C">
|
|
55
|
+
<animate attributeName="r" values="3;4;3" dur="2s" begin="0.5s" repeatCount="indefinite"/>
|
|
56
|
+
</circle>
|
|
57
|
+
<circle cx="100" cy="132" r="3" fill="#DC143C">
|
|
58
|
+
<animate attributeName="r" values="3;4;3" dur="2s" begin="1s" repeatCount="indefinite"/>
|
|
59
|
+
</circle>
|
|
60
|
+
|
|
61
|
+
<!-- 蛋糕装饰波浪线 -->
|
|
62
|
+
<path d="M 60 130 Q 70 128 80 130 Q 90 132 100 130 Q 110 128 120 130 Q 130 132 140 130"
|
|
63
|
+
stroke="#FF69B4" stroke-width="1.5" fill="none" opacity="0.6"/>
|
|
64
|
+
<path d="M 45 155 Q 60 153 75 155 Q 90 157 105 155 Q 120 153 135 155 Q 150 157 155 155"
|
|
65
|
+
stroke="#DAA520" stroke-width="1.5" fill="none" opacity="0.6"/>
|
|
66
|
+
<path d="M 30 183 Q 50 181 70 183 Q 90 185 110 183 Q 130 181 150 183 Q 170 185 175 183"
|
|
67
|
+
stroke="#32CD32" stroke-width="1.5" fill="none" opacity="0.6"/>
|
|
68
|
+
|
|
69
|
+
<!-- 蜡烛 -->
|
|
70
|
+
<!-- 蜡烛1 -->
|
|
71
|
+
<rect x="88" y="110" width="4" height="18" fill="#FFE4B5" stroke="#D2691E" stroke-width="0.5"/>
|
|
72
|
+
<!-- 蜡烛2 -->
|
|
73
|
+
<rect x="98" y="108" width="4" height="20" fill="#F0E68C" stroke="#DAA520" stroke-width="0.5"/>
|
|
74
|
+
<!-- 蜡烛3 -->
|
|
75
|
+
<rect x="108" y="110" width="4" height="18" fill="#FFB6C1" stroke="#FF69B4" stroke-width="0.5"/>
|
|
76
|
+
|
|
77
|
+
<!-- 火焰动画 -->
|
|
78
|
+
<!-- 火焰1 - 左边蜡烛 (蜡烛中心x=90, 顶部y=110) -->
|
|
79
|
+
<ellipse cx="90" cy="107" rx="2.5" ry="4" fill="url(#flameGradient)">
|
|
80
|
+
<animate attributeName="opacity" values="0.95;1;0.95" dur="1.5s" repeatCount="indefinite"/>
|
|
81
|
+
</ellipse>
|
|
82
|
+
|
|
83
|
+
<!-- 火焰2 - 中间蜡烛(最高,蜡烛中心x=100, 顶部y=108) -->
|
|
84
|
+
<ellipse cx="100" cy="105" rx="2.5" ry="4" fill="url(#flameGradient)">
|
|
85
|
+
<animate attributeName="opacity" values="0.9;1;0.9" dur="1.8s" repeatCount="indefinite"/>
|
|
86
|
+
</ellipse>
|
|
87
|
+
|
|
88
|
+
<!-- 火焰3 - 右边蜡烛 (蜡烛中心x=110, 顶部y=110) -->
|
|
89
|
+
<ellipse cx="110" cy="107" rx="2.5" ry="4" fill="url(#flameGradient)">
|
|
90
|
+
<animate attributeName="opacity" values="1;0.95;1" dur="1.2s" repeatCount="indefinite"/>
|
|
91
|
+
</ellipse>
|
|
92
|
+
|
|
93
|
+
<!-- 火焰内核 - 增加层次感 -->
|
|
94
|
+
<ellipse cx="90" cy="108" rx="1" ry="2" fill="#FFD700" opacity="0.7">
|
|
95
|
+
<animate attributeName="opacity" values="0.7;0.8;0.7" dur="1.5s" repeatCount="indefinite"/>
|
|
96
|
+
</ellipse>
|
|
97
|
+
<ellipse cx="100" cy="106" rx="1" ry="2" fill="#FFD700" opacity="0.7">
|
|
98
|
+
<animate attributeName="opacity" values="0.6;0.8;0.6" dur="1.8s" repeatCount="indefinite"/>
|
|
99
|
+
</ellipse>
|
|
100
|
+
<ellipse cx="110" cy="108" rx="1" ry="2" fill="#FFD700" opacity="0.7">
|
|
101
|
+
<animate attributeName="opacity" values="0.8;0.7;0.8" dur="1.2s" repeatCount="indefinite"/>
|
|
102
|
+
</ellipse>
|
|
103
|
+
|
|
104
|
+
<!-- 漂浮的生日祝福文字 -->
|
|
105
|
+
<text x="100" y="50" text-anchor="middle" font-family="Arial, sans-serif"
|
|
106
|
+
font-size="16" font-weight="bold" fill="#FF1493">
|
|
107
|
+
Happy Birthday!
|
|
108
|
+
<animate attributeName="y" values="50;45;50" dur="3s" repeatCount="indefinite"/>
|
|
109
|
+
<animate attributeName="fill" values="#FF1493;#FFD700;#FF69B4;#FF1493" dur="4s" repeatCount="indefinite"/>
|
|
110
|
+
</text>
|
|
111
|
+
|
|
112
|
+
<!-- 漂浮的小星星 -->
|
|
113
|
+
<g>
|
|
114
|
+
<polygon points="30,70 32,76 38,76 33,80 35,86 30,82 25,86 27,80 22,76 28,76" fill="#FFD700" opacity="0.8">
|
|
115
|
+
<animateTransform attributeName="transform" type="rotate"
|
|
116
|
+
values="0 30 78;360 30 78" dur="4s" repeatCount="indefinite"/>
|
|
117
|
+
<animate attributeName="opacity" values="0.8;0.3;0.8" dur="2s" repeatCount="indefinite"/>
|
|
118
|
+
</polygon>
|
|
119
|
+
|
|
120
|
+
<polygon points="170,85 172,91 178,91 173,95 175,101 170,97 165,101 167,95 162,91 168,91" fill="#FFD700" opacity="0.8">
|
|
121
|
+
<animateTransform attributeName="transform" type="rotate"
|
|
122
|
+
values="360 170 93;0 170 93" dur="3s" repeatCount="indefinite"/>
|
|
123
|
+
<animate attributeName="opacity" values="0.8;0.3;0.8" dur="2.5s" repeatCount="indefinite"/>
|
|
124
|
+
</polygon>
|
|
125
|
+
|
|
126
|
+
<polygon points="180,60 182,66 188,66 183,70 185,76 180,72 175,76 177,70 172,66 178,66" fill="#FFD700" opacity="0.8">
|
|
127
|
+
<animateTransform attributeName="transform" type="rotate"
|
|
128
|
+
values="0 180 68;360 180 68" dur="5s" repeatCount="indefinite"/>
|
|
129
|
+
<animate attributeName="opacity" values="0.8;0.3;0.8" dur="1.8s" repeatCount="indefinite"/>
|
|
130
|
+
</polygon>
|
|
131
|
+
|
|
132
|
+
<polygon points="25,95 27,101 33,101 28,105 30,111 25,107 20,111 22,105 17,101 23,101" fill="#FFD700" opacity="0.8">
|
|
133
|
+
<animateTransform attributeName="transform" type="rotate"
|
|
134
|
+
values="360 25 103;0 25 103" dur="3.5s" repeatCount="indefinite"/>
|
|
135
|
+
<animate attributeName="opacity" values="0.8;0.3;0.8" dur="2.2s" repeatCount="indefinite"/>
|
|
136
|
+
</polygon>
|
|
137
|
+
</g>
|
|
138
|
+
|
|
139
|
+
<!-- 漂浮的心形 -->
|
|
140
|
+
<g opacity="0.7">
|
|
141
|
+
<path d="M15,115 C15,110 20,105 25,105 C30,105 35,110 35,115 C35,125 25,135 25,135 C25,135 15,125 15,115 Z" fill="#FF69B4">
|
|
142
|
+
<animate attributeName="d"
|
|
143
|
+
values="M15,115 C15,110 20,105 25,105 C30,105 35,110 35,115 C35,125 25,135 25,135 C25,135 15,125 15,115 Z;
|
|
144
|
+
M15,112 C15,107 20,102 25,102 C30,102 35,107 35,112 C35,122 25,132 25,132 C25,132 15,122 15,112 Z;
|
|
145
|
+
M15,115 C15,110 20,105 25,105 C30,105 35,110 35,115 C35,125 25,135 25,135 C25,135 15,125 15,115 Z"
|
|
146
|
+
dur="2s" repeatCount="indefinite"/>
|
|
147
|
+
<animateTransform attributeName="transform" type="translate"
|
|
148
|
+
values="0,0;-2,-3;0,0" dur="2s" repeatCount="indefinite"/>
|
|
149
|
+
</path>
|
|
150
|
+
|
|
151
|
+
<path d="M165,140 C165,135 170,130 175,130 C180,130 185,135 185,140 C185,150 175,160 175,160 C175,160 165,150 165,140 Z" fill="#FF1493">
|
|
152
|
+
<animate attributeName="d"
|
|
153
|
+
values="M165,140 C165,135 170,130 175,130 C180,130 185,135 185,140 C185,150 175,160 175,160 C175,160 165,150 165,140 Z;
|
|
154
|
+
M165,137 C165,132 170,127 175,127 C180,127 185,132 185,137 C185,147 175,157 175,157 C175,157 165,147 165,137 Z;
|
|
155
|
+
M165,140 C165,135 170,130 175,130 C180,130 185,135 185,140 C185,150 175,160 175,160 C175,160 165,150 165,140 Z"
|
|
156
|
+
dur="2.5s" repeatCount="indefinite"/>
|
|
157
|
+
<animateTransform attributeName="transform" type="translate"
|
|
158
|
+
values="0,0;2,-2;0,0" dur="2.5s" repeatCount="indefinite"/>
|
|
159
|
+
</path>
|
|
160
|
+
</g>
|
|
161
|
+
|
|
162
|
+
<!-- 漂浮的气泡 -->
|
|
163
|
+
<circle cx="50" cy="160" r="3" fill="#87CEEB" opacity="0.6">
|
|
164
|
+
<animate attributeName="cy" values="160;120;160" dur="4s" repeatCount="indefinite"/>
|
|
165
|
+
<animate attributeName="opacity" values="0.6;0.1;0.6" dur="4s" repeatCount="indefinite"/>
|
|
166
|
+
<animate attributeName="r" values="3;1;3" dur="4s" repeatCount="indefinite"/>
|
|
167
|
+
</circle>
|
|
168
|
+
|
|
169
|
+
<circle cx="150" cy="170" r="2" fill="#87CEEB" opacity="0.6">
|
|
170
|
+
<animate attributeName="cy" values="170;130;170" dur="3s" repeatCount="indefinite"/>
|
|
171
|
+
<animate attributeName="opacity" values="0.6;0.1;0.6" dur="3s" repeatCount="indefinite"/>
|
|
172
|
+
<animate attributeName="r" values="2;0.5;2" dur="3s" repeatCount="indefinite"/>
|
|
173
|
+
</circle>
|
|
174
|
+
|
|
175
|
+
<circle cx="60" cy="180" r="4" fill="#87CEEB" opacity="0.5">
|
|
176
|
+
<animate attributeName="cy" values="180;140;180" dur="5s" repeatCount="indefinite"/>
|
|
177
|
+
<animate attributeName="opacity" values="0.5;0.1;0.5" dur="5s" repeatCount="indefinite"/>
|
|
178
|
+
<animate attributeName="r" values="4;1;4" dur="5s" repeatCount="indefinite"/>
|
|
179
|
+
</circle>
|
|
180
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './Form.css';
|
|
2
|
+
import { type FormInstance, type FormProps } from 'antd';
|
|
3
|
+
import type React from 'react';
|
|
4
|
+
interface BaseFormProps extends Omit<FormProps, 'form'> {
|
|
5
|
+
form?: FormInstance;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const BaseForm: (props: BaseFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default BaseForm;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./Form.css";
|
|
3
|
+
import { Form } from "antd";
|
|
4
|
+
const BaseForm = (props)=>{
|
|
5
|
+
const { form: externalForm, children, ...rest } = props;
|
|
6
|
+
const [internalForm] = Form.useForm();
|
|
7
|
+
const form = externalForm ?? internalForm;
|
|
8
|
+
return /*#__PURE__*/ jsx("div", {
|
|
9
|
+
className: "search-form",
|
|
10
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
11
|
+
form: form,
|
|
12
|
+
...rest,
|
|
13
|
+
children: children
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const Form_Form = BaseForm;
|
|
18
|
+
export { Form_Form as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BiForm } from './Form';
|