deepsea-components 5.11.6 → 5.12.0
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/dist/components/AutoFit.cjs +116 -0
- package/dist/components/AutoFit.js +82 -0
- package/dist/components/AutoScroll.cjs +125 -0
- package/dist/components/AutoScroll.js +91 -0
- package/dist/components/AutoSizeTextarea.cjs +73 -0
- package/dist/components/AutoSizeTextarea.js +39 -0
- package/dist/components/CircleText.cjs +68 -0
- package/dist/components/CircleText.js +34 -0
- package/dist/components/CopyButton.cjs +73 -0
- package/dist/{cjs/components → components}/CopyButton.d.ts +3 -3
- package/dist/components/CopyButton.js +27 -0
- package/dist/components/Echart.cjs +74 -0
- package/dist/components/Echart.js +34 -0
- package/dist/components/Flow.cjs +211 -0
- package/dist/components/Flow.js +168 -0
- package/dist/components/FormLabel.cjs +77 -0
- package/dist/components/FormLabel.js +37 -0
- package/dist/components/HlsPlayer.cjs +76 -0
- package/dist/components/HlsPlayer.js +32 -0
- package/dist/components/InfiniteScroll.cjs +135 -0
- package/dist/{cjs/components → components}/InfiniteScroll.d.ts +7 -7
- package/dist/components/InfiniteScroll.js +101 -0
- package/dist/components/InputFile.cjs +102 -0
- package/dist/components/InputFile.js +65 -0
- package/dist/components/InputFileButton.cjs +109 -0
- package/dist/components/InputFileButton.js +75 -0
- package/dist/components/LoopSwiper.cjs +147 -0
- package/dist/components/LoopSwiper.js +113 -0
- package/dist/components/ReadExcel.cjs +48 -0
- package/dist/components/ReadExcel.js +14 -0
- package/dist/components/Ring.cjs +53 -0
- package/dist/components/Ring.js +19 -0
- package/dist/components/Scroll.cjs +143 -0
- package/dist/components/Scroll.js +54 -0
- package/dist/components/SectionRing.cjs +59 -0
- package/dist/components/SectionRing.js +25 -0
- package/dist/components/Skeleton.cjs +66 -0
- package/dist/components/Skeleton.js +32 -0
- package/dist/components/Title.cjs +61 -0
- package/dist/components/Title.js +27 -0
- package/dist/components/TransitionBox.cjs +79 -0
- package/dist/components/TransitionBox.js +45 -0
- package/dist/components/TransitionNum.cjs +83 -0
- package/dist/components/TransitionNum.js +49 -0
- package/dist/components/Trapezium.cjs +67 -0
- package/dist/components/Trapezium.js +33 -0
- package/dist/components/Unify.cjs +68 -0
- package/dist/components/Unify.js +31 -0
- package/dist/components/WriteExcel.cjs +50 -0
- package/dist/components/WriteExcel.js +16 -0
- package/dist/index.cjs +285 -0
- package/dist/index.js +26 -0
- package/dist/utils/getReactVersion.cjs +40 -0
- package/dist/utils/getReactVersion.js +6 -0
- package/dist/utils/index.cjs +57 -0
- package/dist/utils/index.js +17 -0
- package/package.json +26 -17
- package/src/components/WriteExcel.tsx +25 -25
- package/tsconfig.json +16 -0
- package/dist/cjs/components/AutoFit.js +0 -106
- package/dist/cjs/components/AutoFit.js.map +0 -7
- package/dist/cjs/components/AutoScroll.js +0 -127
- package/dist/cjs/components/AutoScroll.js.map +0 -7
- package/dist/cjs/components/AutoSizeTextarea.js +0 -70
- package/dist/cjs/components/AutoSizeTextarea.js.map +0 -7
- package/dist/cjs/components/CircleText.js +0 -77
- package/dist/cjs/components/CircleText.js.map +0 -7
- package/dist/cjs/components/CopyButton.js +0 -60
- package/dist/cjs/components/CopyButton.js.map +0 -7
- package/dist/cjs/components/Echart.js +0 -56
- package/dist/cjs/components/Echart.js.map +0 -7
- package/dist/cjs/components/Flow.js +0 -220
- package/dist/cjs/components/Flow.js.map +0 -7
- package/dist/cjs/components/FormLabel.js +0 -42
- package/dist/cjs/components/FormLabel.js.map +0 -7
- package/dist/cjs/components/HlsPlayer.js +0 -65
- package/dist/cjs/components/HlsPlayer.js.map +0 -7
- package/dist/cjs/components/InfiniteScroll.js +0 -148
- package/dist/cjs/components/InfiniteScroll.js.map +0 -7
- package/dist/cjs/components/InputFile.js +0 -90
- package/dist/cjs/components/InputFile.js.map +0 -7
- package/dist/cjs/components/InputFileButton.js +0 -113
- package/dist/cjs/components/InputFileButton.js.map +0 -7
- package/dist/cjs/components/LoopSwiper.js +0 -137
- package/dist/cjs/components/LoopSwiper.js.map +0 -7
- package/dist/cjs/components/ReadExcel.js +0 -36
- package/dist/cjs/components/ReadExcel.js.map +0 -7
- package/dist/cjs/components/Ring.js +0 -49
- package/dist/cjs/components/Ring.js.map +0 -7
- package/dist/cjs/components/Scroll.js +0 -103
- package/dist/cjs/components/Scroll.js.map +0 -7
- package/dist/cjs/components/SectionRing.js +0 -54
- package/dist/cjs/components/SectionRing.js.map +0 -7
- package/dist/cjs/components/Skeleton.js +0 -66
- package/dist/cjs/components/Skeleton.js.map +0 -7
- package/dist/cjs/components/Title.js +0 -48
- package/dist/cjs/components/Title.js.map +0 -7
- package/dist/cjs/components/TransitionBox.js +0 -53
- package/dist/cjs/components/TransitionBox.js.map +0 -7
- package/dist/cjs/components/TransitionNum.js +0 -62
- package/dist/cjs/components/TransitionNum.js.map +0 -7
- package/dist/cjs/components/Trapezium.js +0 -69
- package/dist/cjs/components/Trapezium.js.map +0 -7
- package/dist/cjs/components/Unify.js +0 -48
- package/dist/cjs/components/Unify.js.map +0 -7
- package/dist/cjs/components/WriteExcel.js +0 -45
- package/dist/cjs/components/WriteExcel.js.map +0 -7
- package/dist/cjs/index.js +0 -74
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/utils/getReactVersion.js +0 -34
- package/dist/cjs/utils/getReactVersion.js.map +0 -7
- package/dist/cjs/utils/index.js +0 -52
- package/dist/cjs/utils/index.js.map +0 -7
- package/dist/esm/components/AutoFit.d.ts +0 -25
- package/dist/esm/components/AutoFit.js +0 -97
- package/dist/esm/components/AutoFit.js.map +0 -1
- package/dist/esm/components/AutoScroll.d.ts +0 -38
- package/dist/esm/components/AutoScroll.js +0 -102
- package/dist/esm/components/AutoScroll.js.map +0 -1
- package/dist/esm/components/AutoSizeTextarea.d.ts +0 -5
- package/dist/esm/components/AutoSizeTextarea.js +0 -48
- package/dist/esm/components/AutoSizeTextarea.js.map +0 -1
- package/dist/esm/components/CircleText.d.ts +0 -25
- package/dist/esm/components/CircleText.js +0 -49
- package/dist/esm/components/CircleText.js.map +0 -1
- package/dist/esm/components/CopyButton.d.ts +0 -13
- package/dist/esm/components/CopyButton.js +0 -31
- package/dist/esm/components/CopyButton.js.map +0 -1
- package/dist/esm/components/Echart.d.ts +0 -15
- package/dist/esm/components/Echart.js +0 -41
- package/dist/esm/components/Echart.js.map +0 -1
- package/dist/esm/components/Flow.d.ts +0 -86
- package/dist/esm/components/Flow.js +0 -186
- package/dist/esm/components/Flow.js.map +0 -1
- package/dist/esm/components/FormLabel.d.ts +0 -22
- package/dist/esm/components/FormLabel.js +0 -52
- package/dist/esm/components/FormLabel.js.map +0 -1
- package/dist/esm/components/HlsPlayer.d.ts +0 -5
- package/dist/esm/components/HlsPlayer.js +0 -36
- package/dist/esm/components/HlsPlayer.js.map +0 -1
- package/dist/esm/components/InfiniteScroll.d.ts +0 -54
- package/dist/esm/components/InfiniteScroll.js +0 -102
- package/dist/esm/components/InfiniteScroll.js.map +0 -1
- package/dist/esm/components/InputFile.d.ts +0 -26
- package/dist/esm/components/InputFile.js +0 -78
- package/dist/esm/components/InputFile.js.map +0 -1
- package/dist/esm/components/InputFileButton.d.ts +0 -11
- package/dist/esm/components/InputFileButton.js +0 -95
- package/dist/esm/components/InputFileButton.js.map +0 -1
- package/dist/esm/components/LoopSwiper.d.ts +0 -9
- package/dist/esm/components/LoopSwiper.js +0 -122
- package/dist/esm/components/LoopSwiper.js.map +0 -1
- package/dist/esm/components/ReadExcel.d.ts +0 -8
- package/dist/esm/components/ReadExcel.js +0 -19
- package/dist/esm/components/ReadExcel.js.map +0 -1
- package/dist/esm/components/Ring.d.ts +0 -7
- package/dist/esm/components/Ring.js +0 -26
- package/dist/esm/components/Ring.js.map +0 -1
- package/dist/esm/components/Scroll.d.ts +0 -24
- package/dist/esm/components/Scroll.js +0 -67
- package/dist/esm/components/Scroll.js.map +0 -1
- package/dist/esm/components/SectionRing.d.ts +0 -8
- package/dist/esm/components/SectionRing.js +0 -33
- package/dist/esm/components/SectionRing.js.map +0 -1
- package/dist/esm/components/Skeleton.d.ts +0 -5
- package/dist/esm/components/Skeleton.js +0 -38
- package/dist/esm/components/Skeleton.js.map +0 -1
- package/dist/esm/components/Title.d.ts +0 -3
- package/dist/esm/components/Title.js +0 -26
- package/dist/esm/components/Title.js.map +0 -1
- package/dist/esm/components/TransitionBox.d.ts +0 -10
- package/dist/esm/components/TransitionBox.js +0 -50
- package/dist/esm/components/TransitionBox.js.map +0 -1
- package/dist/esm/components/TransitionNum.d.ts +0 -16
- package/dist/esm/components/TransitionNum.js +0 -65
- package/dist/esm/components/TransitionNum.js.map +0 -1
- package/dist/esm/components/Trapezium.d.ts +0 -9
- package/dist/esm/components/Trapezium.js +0 -43
- package/dist/esm/components/Trapezium.js.map +0 -1
- package/dist/esm/components/Unify.d.ts +0 -13
- package/dist/esm/components/Unify.js +0 -47
- package/dist/esm/components/Unify.js.map +0 -1
- package/dist/esm/components/WriteExcel.d.ts +0 -8
- package/dist/esm/components/WriteExcel.js +0 -23
- package/dist/esm/components/WriteExcel.js.map +0 -1
- package/dist/esm/index.d.ts +0 -26
- package/dist/esm/index.js +0 -27
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/utils/getReactVersion.d.ts +0 -1
- package/dist/esm/utils/getReactVersion.js +0 -6
- package/dist/esm/utils/getReactVersion.js.map +0 -1
- package/dist/esm/utils/index.d.ts +0 -9
- package/dist/esm/utils/index.js +0 -17
- package/dist/esm/utils/index.js.map +0 -1
- /package/dist/{cjs/components → components}/AutoFit.d.ts +0 -0
- /package/dist/{cjs/components → components}/AutoScroll.d.ts +0 -0
- /package/dist/{cjs/components → components}/AutoSizeTextarea.d.ts +0 -0
- /package/dist/{cjs/components → components}/CircleText.d.ts +0 -0
- /package/dist/{cjs/components → components}/Echart.d.ts +0 -0
- /package/dist/{cjs/components → components}/Flow.d.ts +0 -0
- /package/dist/{cjs/components → components}/FormLabel.d.ts +0 -0
- /package/dist/{cjs/components → components}/HlsPlayer.d.ts +0 -0
- /package/dist/{cjs/components → components}/InputFile.d.ts +0 -0
- /package/dist/{cjs/components → components}/InputFileButton.d.ts +0 -0
- /package/dist/{cjs/components → components}/LoopSwiper.d.ts +0 -0
- /package/dist/{cjs/components → components}/ReadExcel.d.ts +0 -0
- /package/dist/{cjs/components → components}/Ring.d.ts +0 -0
- /package/dist/{cjs/components → components}/Scroll.d.ts +0 -0
- /package/dist/{cjs/components → components}/SectionRing.d.ts +0 -0
- /package/dist/{cjs/components → components}/Skeleton.d.ts +0 -0
- /package/dist/{cjs/components → components}/Title.d.ts +0 -0
- /package/dist/{cjs/components → components}/TransitionBox.d.ts +0 -0
- /package/dist/{cjs/components → components}/TransitionNum.d.ts +0 -0
- /package/dist/{cjs/components → components}/Trapezium.d.ts +0 -0
- /package/dist/{cjs/components → components}/Unify.d.ts +0 -0
- /package/dist/{cjs/components → components}/WriteExcel.d.ts +0 -0
- /package/dist/{cjs/index.d.ts → index.d.ts} +0 -0
- /package/dist/{cjs/utils → utils}/getReactVersion.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/index.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useState","jsx","_jsx","getFileData","file","type","fileReader","FileReader","readAsArrayBuffer","readAsBinaryString","readAsDataURL","readAsText","Promise","resolve","addEventListener","result","InputFile","props","multiple","onChange","_onChange","disabled","_disabled","clearAfterChange","onValueChange","onFileChange","rest","setDisabled","e","input","target","files","length","files2","Array","from","values","value","push"],"sources":["../../../src/components/InputFile.tsx"],"sourcesContent":["\"use client\"\n\nimport { ChangeEvent, ComponentProps, ReactNode, useState } from \"react\"\n\nexport interface InputFileDataTypeMap {\n base64: string\n text: string\n arrayBuffer: ArrayBuffer\n binary: string\n file: File\n}\n\nexport type InputFileDataType = keyof InputFileDataTypeMap\n\nexport async function getFileData<T extends InputFileDataType>(file: File, type: T): Promise<InputFileDataTypeMap[T]> {\n const fileReader = new FileReader()\n switch (type) {\n case \"arrayBuffer\":\n fileReader.readAsArrayBuffer(file)\n break\n case \"binary\":\n fileReader.readAsBinaryString(file)\n break\n case \"base64\":\n fileReader.readAsDataURL(file)\n break\n case \"text\":\n fileReader.readAsText(file)\n break\n default:\n return file as any\n }\n return new Promise(resolve => {\n fileReader.addEventListener(\"load\", () => {\n resolve(fileReader.result as any)\n })\n })\n}\n\nexport interface InputFileBaseProps extends Omit<ComponentProps<\"input\">, \"multiple\" | \"type\"> {}\n\nexport type FileType<Multiple extends boolean> = Multiple extends true ? File[] : File\nexport type ValueType<Multiple extends boolean, Type extends InputFileDataType> = Multiple extends true\n ? InputFileDataTypeMap[Type][]\n : InputFileDataTypeMap[Type]\n\nexport interface InputFileExtraProps<Multiple extends boolean = false, Type extends InputFileDataType = \"file\"> {\n multiple?: Multiple\n type?: Type\n onValueChange?: (data: ValueType<Multiple, Type>) => void\n onFileChange?: (data: FileType<Multiple>) => void\n /** 是否在捕获文件后清除 input 上的文件,默认为 false,主要区别在于如果不清除,连续两次选择同样的文件不会触发 onChange 事件,如果用于 form 表单,请设置为 flase */\n clearAfterChange?: boolean\n}\n\nexport interface InputFileProps<Multiple extends boolean = false, Type extends InputFileDataType = \"file\">\n extends InputFileBaseProps,\n InputFileExtraProps<Multiple, Type> {}\n\n/** 专用于读取文件的组件 */\nexport function InputFile<Multiple extends boolean = false, Type extends InputFileDataType = \"file\">(props: InputFileProps<Multiple, Type>): ReactNode {\n const { multiple = false, type = \"file\", onChange: _onChange, disabled: _disabled, clearAfterChange, onValueChange, onFileChange, ...rest } = props\n const [disabled, setDisabled] = useState(false)\n\n async function onChange(e: ChangeEvent<HTMLInputElement>) {\n _onChange?.(e)\n const input = e.target\n const { files } = input\n if (!files || files.length === 0) return\n setDisabled(true)\n try {\n if (multiple) {\n const files2: File[] = Array.from(files)\n const values: InputFileDataTypeMap[Type][] = []\n for (const file of files2) {\n const value = (await getFileData(file, type)) as InputFileDataTypeMap[Type]\n values.push(value)\n }\n onFileChange?.(files2 as FileType<Multiple>)\n onValueChange?.(values as ValueType<Multiple, Type>)\n } else {\n const file = files[0]\n onFileChange?.(file as FileType<Multiple>)\n onValueChange?.((await getFileData(file, type)) as ValueType<Multiple, Type>)\n }\n } finally {\n if (clearAfterChange) input.value = \"\"\n setDisabled(false)\n }\n }\n\n return <input disabled={disabled || _disabled} type=\"file\" multiple={multiple} onChange={onChange} {...rest} />\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAiDA,QAAQ,QAAQ,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAYxE,OAAO,eAAeC,WAAWA,CAA8BC,IAAU,EAAEC,IAAO,EAAoC;EAClH,MAAMC,UAAU,GAAG,IAAIC,UAAU,CAAC,CAAC;EACnC,QAAQF,IAAI;IACR,KAAK,aAAa;MACdC,UAAU,CAACE,iBAAiB,CAACJ,IAAI,CAAC;MAClC;IACJ,KAAK,QAAQ;MACTE,UAAU,CAACG,kBAAkB,CAACL,IAAI,CAAC;MACnC;IACJ,KAAK,QAAQ;MACTE,UAAU,CAACI,aAAa,CAACN,IAAI,CAAC;MAC9B;IACJ,KAAK,MAAM;MACPE,UAAU,CAACK,UAAU,CAACP,IAAI,CAAC;MAC3B;IACJ;MACI,OAAOA,IAAI;EACnB;EACA,OAAO,IAAIQ,OAAO,CAACC,OAAO,IAAI;IAC1BP,UAAU,CAACQ,gBAAgB,CAAC,MAAM,EAAE,MAAM;MACtCD,OAAO,CAACP,UAAU,CAACS,MAAa,CAAC;IACrC,CAAC,CAAC;EACN,CAAC,CAAC;AACN;AAsBA;AACA,OAAO,SAASC,SAASA,CAA4EC,KAAqC,EAAa;EACnJ,MAAM;IAAEC,QAAQ,GAAG,KAAK;IAAEb,IAAI,GAAG,MAAM;IAAEc,QAAQ,EAAEC,SAAS;IAAEC,QAAQ,EAAEC,SAAS;IAAEC,gBAAgB;IAAEC,aAAa;IAAEC,YAAY;IAAE,GAAGC;EAAK,CAAC,GAAGT,KAAK;EACnJ,MAAM,CAACI,QAAQ,EAAEM,WAAW,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"react";
|
|
2
|
-
import { InputFileBaseProps, InputFileDataType, InputFileExtraProps } from "./InputFile";
|
|
3
|
-
export type InputFileButtonProps<Multiple extends boolean = false, Type extends InputFileDataType = "file", AS extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> = "button"> = Omit<ComponentProps<AS>, "as" | "type" | "disabled"> & InputFileExtraProps<Multiple, Type> & {
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
inputProps?: Omit<InputFileBaseProps, "accept">;
|
|
6
|
-
accept?: string;
|
|
7
|
-
dragFile?: boolean;
|
|
8
|
-
as?: AS;
|
|
9
|
-
};
|
|
10
|
-
/** 专用于读取文件的 button 组件 */
|
|
11
|
-
export declare function InputFileButton<Multiple extends boolean = false, Type extends InputFileDataType = "file", AS extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> = "button">(props: InputFileButtonProps<Multiple, Type, AS>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Fragment, createElement, useImperativeHandle, useRef, useState } from "react";
|
|
4
|
-
import { InputFile, getFileData } from "./InputFile";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
/** 专用于读取文件的 button 组件 */
|
|
8
|
-
export function InputFileButton(props) {
|
|
9
|
-
const {
|
|
10
|
-
as = "button",
|
|
11
|
-
onClick: _onClick,
|
|
12
|
-
inputProps = {},
|
|
13
|
-
accept,
|
|
14
|
-
onDrop: _onDrop,
|
|
15
|
-
onDragOver: _onDragOver,
|
|
16
|
-
dragFile,
|
|
17
|
-
disabled: _disabled,
|
|
18
|
-
type = "file",
|
|
19
|
-
multiple,
|
|
20
|
-
onValueChange,
|
|
21
|
-
onFileChange,
|
|
22
|
-
clearAfterChange,
|
|
23
|
-
...rest
|
|
24
|
-
} = props;
|
|
25
|
-
const {
|
|
26
|
-
ref,
|
|
27
|
-
style,
|
|
28
|
-
disabled: __disabled,
|
|
29
|
-
...restInputProps
|
|
30
|
-
} = inputProps;
|
|
31
|
-
const [disabled, setDisabled] = useState(false);
|
|
32
|
-
const input = useRef(null);
|
|
33
|
-
useImperativeHandle(ref, () => input.current, [input.current]);
|
|
34
|
-
function onClick(e) {
|
|
35
|
-
input.current?.click();
|
|
36
|
-
_onClick?.(e);
|
|
37
|
-
}
|
|
38
|
-
async function onDrop(e) {
|
|
39
|
-
_onDrop?.(e);
|
|
40
|
-
if (disabled || !dragFile) return;
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
const {
|
|
43
|
-
files
|
|
44
|
-
} = e.dataTransfer;
|
|
45
|
-
if (!files || files.length === 0) return;
|
|
46
|
-
setDisabled(true);
|
|
47
|
-
try {
|
|
48
|
-
if (multiple) {
|
|
49
|
-
const files2 = Array.from(files);
|
|
50
|
-
const values = [];
|
|
51
|
-
for (const file of files2) {
|
|
52
|
-
const value = await getFileData(file, type);
|
|
53
|
-
values.push(value);
|
|
54
|
-
}
|
|
55
|
-
onFileChange?.(files2);
|
|
56
|
-
onValueChange?.(values);
|
|
57
|
-
} else {
|
|
58
|
-
const file = files[0];
|
|
59
|
-
onFileChange?.(file);
|
|
60
|
-
onValueChange?.(await getFileData(file, type));
|
|
61
|
-
}
|
|
62
|
-
} finally {
|
|
63
|
-
setDisabled(false);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function onDragOver(e) {
|
|
67
|
-
_onDragOver?.(e);
|
|
68
|
-
if (disabled || !dragFile) return;
|
|
69
|
-
e.preventDefault();
|
|
70
|
-
}
|
|
71
|
-
return /*#__PURE__*/_jsxs(Fragment, {
|
|
72
|
-
children: [/*#__PURE__*/_jsx(InputFile, {
|
|
73
|
-
ref: input,
|
|
74
|
-
disabled: disabled || _disabled || __disabled,
|
|
75
|
-
style: {
|
|
76
|
-
display: "none",
|
|
77
|
-
...style
|
|
78
|
-
},
|
|
79
|
-
multiple: multiple,
|
|
80
|
-
accept: accept,
|
|
81
|
-
type: type,
|
|
82
|
-
onValueChange: onValueChange,
|
|
83
|
-
onFileChange: onFileChange,
|
|
84
|
-
clearAfterChange: clearAfterChange,
|
|
85
|
-
...restInputProps
|
|
86
|
-
}), /*#__PURE__*/createElement(as, {
|
|
87
|
-
disabled: disabled || _disabled,
|
|
88
|
-
onClick,
|
|
89
|
-
onDrop,
|
|
90
|
-
onDragOver,
|
|
91
|
-
...rest
|
|
92
|
-
})]
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=InputFileButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Fragment","createElement","useImperativeHandle","useRef","useState","InputFile","getFileData","jsx","_jsx","jsxs","_jsxs","InputFileButton","props","as","onClick","_onClick","inputProps","accept","onDrop","_onDrop","onDragOver","_onDragOver","dragFile","disabled","_disabled","type","multiple","onValueChange","onFileChange","clearAfterChange","rest","ref","style","__disabled","restInputProps","setDisabled","input","current","e","click","preventDefault","files","dataTransfer","length","files2","Array","from","values","file","value","push","children","display"],"sources":["../../../src/components/InputFileButton.tsx"],"sourcesContent":["\"use client\"\n\nimport {\n ComponentProps,\n ComponentRef,\n DragEvent,\n Fragment,\n JSX,\n JSXElementConstructor,\n MouseEvent as ReactMouseEvent,\n createElement,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\"\n\nimport { FileType, InputFile, InputFileBaseProps, InputFileDataType, InputFileDataTypeMap, InputFileExtraProps, ValueType, getFileData } from \"./InputFile\"\n\nexport type InputFileButtonProps<\n Multiple extends boolean = false,\n Type extends InputFileDataType = \"file\",\n AS extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> = \"button\",\n> = Omit<ComponentProps<AS>, \"as\" | \"type\" | \"disabled\"> &\n InputFileExtraProps<Multiple, Type> & {\n disabled?: boolean\n inputProps?: Omit<InputFileBaseProps, \"accept\">\n accept?: string\n dragFile?: boolean\n as?: AS\n }\n\n/** 专用于读取文件的 button 组件 */\nexport function InputFileButton<\n Multiple extends boolean = false,\n Type extends InputFileDataType = \"file\",\n AS extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> = \"button\",\n>(props: InputFileButtonProps<Multiple, Type, AS>) {\n const {\n as = \"button\",\n onClick: _onClick,\n inputProps = {},\n accept,\n onDrop: _onDrop,\n onDragOver: _onDragOver,\n dragFile,\n disabled: _disabled,\n type = \"file\",\n multiple,\n onValueChange,\n onFileChange,\n clearAfterChange,\n ...rest\n } = props\n\n const { ref, style, disabled: __disabled, ...restInputProps } = inputProps\n const [disabled, setDisabled] = useState(false)\n const input = useRef<HTMLInputElement>(null)\n\n useImperativeHandle(ref, () => input.current!, [input.current])\n\n function onClick(e: ReactMouseEvent<ComponentRef<AS>, MouseEvent>) {\n input.current?.click()\n _onClick?.(e as any)\n }\n\n async function onDrop(e: DragEvent<ComponentRef<AS>>) {\n _onDrop?.(e as any)\n if (disabled || !dragFile) return\n e.preventDefault()\n const { files } = e.dataTransfer\n if (!files || files.length === 0) return\n setDisabled(true)\n try {\n if (multiple) {\n const files2: File[] = Array.from(files)\n const values: InputFileDataTypeMap[Type][] = []\n for (const file of files2) {\n const value = (await getFileData(file, type)) as InputFileDataTypeMap[Type]\n values.push(value)\n }\n onFileChange?.(files2 as FileType<Multiple>)\n onValueChange?.(values as ValueType<Multiple, Type>)\n } else {\n const file = files[0]\n onFileChange?.(file as FileType<Multiple>)\n onValueChange?.((await getFileData(file, type)) as ValueType<Multiple, Type>)\n }\n } finally {\n setDisabled(false)\n }\n }\n\n function onDragOver(e: DragEvent<ComponentRef<AS>>) {\n _onDragOver?.(e as any)\n if (disabled || !dragFile) return\n e.preventDefault()\n }\n\n return (\n <Fragment>\n <InputFile<Multiple, Type>\n ref={input}\n disabled={disabled || _disabled || __disabled}\n style={{ display: \"none\", ...style }}\n multiple={multiple}\n accept={accept}\n type={type as Type}\n onValueChange={onValueChange}\n onFileChange={onFileChange}\n clearAfterChange={clearAfterChange}\n {...restInputProps}\n />\n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GAAGpB;MAAM,CAAE;MACrCN,QAAQ,EAAEA,QAAS;MACnBT,MAAM,EAAEA,MAAO;MACfQ,IAAI,EAAEA,IAAa;MACnBE,aAAa,EAAEA,aAAc;MAC7BC,YAAY,EAAEA,YAAa;MAC3BC,gBAAgB,EAAEA,gBAAiB;MAAA,GAC/BK;IAAc,CACrB,CAAC,eACDjC,aAAa,CAACY,EAAE,EAAE;MACfU,QAAQ,EAAEA,QAAQ,IAAIC,SAAS;MAC/BV,OAAO;MACPI,MAAM;MACNE,UAAU;MACV,GAAGU;IACP,CAAC,CAAC;EAAA,CACI,CAAC;AAEnB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes } from "react";
|
|
2
|
-
export interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
direction?: "horizontal" | "vertical";
|
|
4
|
-
reverse?: boolean;
|
|
5
|
-
period: number;
|
|
6
|
-
gap?: CSSProperties["gap"];
|
|
7
|
-
}
|
|
8
|
-
/** 循环播放组件 */
|
|
9
|
-
export declare const LoopSwiper: import("react").ForwardRefExoticComponent<LoopSwiperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
4
|
-
import { css } from "@emotion/css";
|
|
5
|
-
import { clsx } from "deepsea-tools";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
/** 循环播放组件 */
|
|
9
|
-
export const LoopSwiper = /*#__PURE__*/forwardRef((props, ref) => {
|
|
10
|
-
const {
|
|
11
|
-
className,
|
|
12
|
-
style,
|
|
13
|
-
children,
|
|
14
|
-
direction,
|
|
15
|
-
period,
|
|
16
|
-
reverse,
|
|
17
|
-
gap,
|
|
18
|
-
...rest
|
|
19
|
-
} = props;
|
|
20
|
-
const wrapper = useRef(null);
|
|
21
|
-
const container = useRef(null);
|
|
22
|
-
const [swiper, setSwiper] = useState(false);
|
|
23
|
-
const directionRef = useRef(direction);
|
|
24
|
-
directionRef.current = direction;
|
|
25
|
-
const flexDirection = direction === "vertical" ? reverse ? "column-reverse" : "column" : reverse ? "row-reverse" : "row";
|
|
26
|
-
const animationName = swiper ? direction === "vertical" ? reverse ? "deepsea-reverse-vertical-loop-swipe" : "deepsea-vertical-loop-swipe" : reverse ? "deepsea-reverse-horizontal-loop-swipe" : "deepsea-horizontal-loop-swipe" : "none";
|
|
27
|
-
const animationDuration = `${period}ms`;
|
|
28
|
-
const animationTimingFunction = "linear";
|
|
29
|
-
const animationIterationCount = "infinite";
|
|
30
|
-
useImperativeHandle(ref, () => wrapper.current, []);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const wrapperEle = wrapper.current;
|
|
33
|
-
const containerEle = container.current;
|
|
34
|
-
let wrapperWidth = 0;
|
|
35
|
-
let wrapperHeight = 0;
|
|
36
|
-
let containerWidth = 0;
|
|
37
|
-
let containerHeight = 0;
|
|
38
|
-
const observer = new ResizeObserver(entries => {
|
|
39
|
-
entries.forEach(entry => {
|
|
40
|
-
if (entry.target === wrapperEle) {
|
|
41
|
-
wrapperWidth = entry.contentRect.width;
|
|
42
|
-
wrapperHeight = entry.contentRect.height;
|
|
43
|
-
} else if (entry.target === containerEle) {
|
|
44
|
-
containerWidth = entry.contentRect.width;
|
|
45
|
-
containerHeight = entry.contentRect.height;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
setSwiper(directionRef.current === "vertical" ? containerHeight > wrapperHeight : containerWidth > wrapperWidth);
|
|
49
|
-
});
|
|
50
|
-
observer.observe(wrapperEle);
|
|
51
|
-
observer.observe(containerEle);
|
|
52
|
-
}, []);
|
|
53
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
54
|
-
ref: wrapper,
|
|
55
|
-
className: clsx(css`
|
|
56
|
-
@keyframes deepsea-horizontal-loop-swipe {
|
|
57
|
-
from {
|
|
58
|
-
transform: translateX(0);
|
|
59
|
-
}
|
|
60
|
-
to {
|
|
61
|
-
transform: translateX(-100%);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
@keyframes deepsea-reverse-horizontal-loop-swipe {
|
|
65
|
-
from {
|
|
66
|
-
transform: translateX(0);
|
|
67
|
-
}
|
|
68
|
-
to {
|
|
69
|
-
transform: translateX(100%);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
@keyframes deepsea-vertical-loop-swipe {
|
|
73
|
-
from {
|
|
74
|
-
transform: translateY(0);
|
|
75
|
-
}
|
|
76
|
-
to {
|
|
77
|
-
transform: translateY(-100%);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
@keyframes deepsea-reverse-vertical-loop-swipe {
|
|
81
|
-
from {
|
|
82
|
-
transform: translateY(0);
|
|
83
|
-
}
|
|
84
|
-
to {
|
|
85
|
-
transform: translateY(100%);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
`, className),
|
|
89
|
-
style: {
|
|
90
|
-
display: "flex",
|
|
91
|
-
flexDirection,
|
|
92
|
-
gap,
|
|
93
|
-
...style
|
|
94
|
-
},
|
|
95
|
-
...rest,
|
|
96
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
97
|
-
ref: container,
|
|
98
|
-
style: {
|
|
99
|
-
display: "flex",
|
|
100
|
-
flexDirection,
|
|
101
|
-
gap,
|
|
102
|
-
animationName,
|
|
103
|
-
animationTimingFunction,
|
|
104
|
-
animationDuration,
|
|
105
|
-
animationIterationCount
|
|
106
|
-
},
|
|
107
|
-
children: children
|
|
108
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
109
|
-
style: {
|
|
110
|
-
display: swiper ? "flex" : "none",
|
|
111
|
-
flexDirection,
|
|
112
|
-
gap,
|
|
113
|
-
animationName,
|
|
114
|
-
animationTimingFunction,
|
|
115
|
-
animationDuration,
|
|
116
|
-
animationIterationCount
|
|
117
|
-
},
|
|
118
|
-
children: children
|
|
119
|
-
})]
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
//# sourceMappingURL=LoopSwiper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useEffect","useImperativeHandle","useRef","useState","css","clsx","jsx","_jsx","jsxs","_jsxs","LoopSwiper","props","ref","className","style","children","direction","period","reverse","gap","rest","wrapper","container","swiper","setSwiper","directionRef","current","flexDirection","animationName","animationDuration","animationTimingFunction","animationIterationCount","wrapperEle","containerEle","wrapperWidth","wrapperHeight","containerWidth","containerHeight","observer","ResizeObserver","entries","forEach","entry","target","contentRect","width","height","observe","display"],"sources":["../../../src/components/LoopSwiper.tsx"],"sourcesContent":["\"use client\"\n\nimport { CSSProperties, HTMLAttributes, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\"\nimport { css } from \"@emotion/css\"\nimport { clsx } from \"deepsea-tools\"\n\nexport interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {\n direction?: \"horizontal\" | \"vertical\"\n reverse?: boolean\n period: number\n gap?: CSSProperties[\"gap\"]\n}\n\n/** 循环播放组件 */\nexport const LoopSwiper = forwardRef<HTMLDivElement, LoopSwiperProps>((props, ref) => {\n const { className, style, children, direction, period, reverse, gap, ...rest } = props\n const wrapper = useRef<HTMLDivElement>(null)\n const container = useRef<HTMLDivElement>(null)\n const [swiper, setSwiper] = useState(false)\n const directionRef = useRef(direction)\n directionRef.current = direction\n const flexDirection: CSSProperties[\"flexDirection\"] = direction === \"vertical\" ? (reverse ? \"column-reverse\" : \"column\") : reverse ? \"row-reverse\" : \"row\"\n const animationName = swiper\n ? direction === \"vertical\"\n ? reverse\n ? \"deepsea-reverse-vertical-loop-swipe\"\n : \"deepsea-vertical-loop-swipe\"\n : reverse\n ? \"deepsea-reverse-horizontal-loop-swipe\"\n : \"deepsea-horizontal-loop-swipe\"\n : \"none\"\n const animationDuration = `${period}ms`\n const animationTimingFunction = \"linear\"\n const animationIterationCount = \"infinite\"\n\n useImperativeHandle(ref, () => wrapper.current!, [])\n\n useEffect(() => {\n const wrapperEle = wrapper.current!\n const containerEle = container.current!\n let wrapperWidth = 0\n let wrapperHeight = 0\n let containerWidth = 0\n let containerHeight = 0\n const observer = new ResizeObserver(entries => {\n entries.forEach(entry => {\n if (entry.target === wrapperEle) {\n wrapperWidth = entry.contentRect.width\n wrapperHeight = entry.contentRect.height\n } else if (entry.target === containerEle) {\n containerWidth = entry.contentRect.width\n containerHeight = entry.contentRect.height\n }\n })\n setSwiper(directionRef.current === \"vertical\" ? containerHeight > wrapperHeight : containerWidth > wrapperWidth)\n })\n observer.observe(wrapperEle)\n observer.observe(containerEle)\n }, [])\n\n return (\n <div\n ref={wrapper}\n className={clsx(\n css`\n @keyframes deepsea-horizontal-loop-swipe {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-100%);\n }\n }\n @keyframes deepsea-reverse-horizontal-loop-swipe {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n }\n @keyframes deepsea-vertical-loop-swipe {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-100%);\n }\n }\n @keyframes deepsea-reverse-vertical-loop-swipe {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(100%);\n }\n }\n `,\n className,\n )}\n style={{ display: \"flex\", flexDirection, gap, ...style }}\n {...rest}\n >\n <div\n ref={container}\n style={{ display: \"flex\", flexDirection, gap, animationName, animationTimingFunction, animationDuration, animationIterationCount }}\n >\n {children}\n </div>\n <div\n style={{\n display: swiper ? \"flex\" : \"none\",\n flexDirection,\n gap,\n animationName,\n animationTimingFunction,\n animationDuration,\n animationIterationCount,\n }}\n >\n {children}\n </div>\n </div>\n )\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAwCA,UAAU,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnH,SAASC,GAA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AU;MACfR,KAAK,EAAE;QAAEkC,OAAO,EAAE,MAAM;QAAErB,aAAa;QAAER,GAAG;QAAES,aAAa;QAAEE,uBAAuB;QAAED,iBAAiB;QAAEE;MAAwB,CAAE;MAAAhB,QAAA,EAElIA;IAAQ,CACR,CAAC,eACNR,IAAA;MACIO,KAAK,EAAE;QACHkC,OAAO,EAAEzB,MAAM,GAAG,MAAM,GAAG,MAAM;QACjCI,aAAa;QACbR,GAAG;QACHS,aAAa;QACbE,uBAAuB;QACvBD,iBAAiB;QACjBE;MACJ,CAAE;MAAAhB,QAAA,EAEDA;IAAQ,CACR,CAAC;EAAA,CACL,CAAC;AAEd,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
import { WorkBookData, WorkSheetData } from "deepsea-tools";
|
|
3
|
-
import { InputFileProps } from "./InputFile";
|
|
4
|
-
export interface ReadExcelProps extends Omit<InputFileProps<false, "arrayBuffer">, "multiple" | "accept" | "type" | "onValueChange"> {
|
|
5
|
-
onValueChange?: <Sheet = WorkSheetData>(data: WorkBookData<Sheet>) => void;
|
|
6
|
-
}
|
|
7
|
-
/** 专门用于读取 excel 的组件 */
|
|
8
|
-
export declare const ReadExcel: FC<ReadExcelProps>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { readExcel } from "deepsea-tools";
|
|
4
|
-
import { InputFile } from "./InputFile";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
/** 专门用于读取 excel 的组件 */
|
|
7
|
-
export const ReadExcel = props => {
|
|
8
|
-
const {
|
|
9
|
-
onValueChange,
|
|
10
|
-
...rest
|
|
11
|
-
} = props;
|
|
12
|
-
return /*#__PURE__*/_jsx(InputFile, {
|
|
13
|
-
accept: ".xlsx",
|
|
14
|
-
type: "arrayBuffer",
|
|
15
|
-
onValueChange: data => onValueChange?.(readExcel(data)),
|
|
16
|
-
...rest
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=ReadExcel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["readExcel","InputFile","jsx","_jsx","ReadExcel","props","onValueChange","rest","accept","type","data"],"sources":["../../../src/components/ReadExcel.tsx"],"sourcesContent":["\"use client\"\n\nimport { FC } from \"react\"\nimport { WorkBookData, WorkSheetData, readExcel } from \"deepsea-tools\"\n\nimport { InputFile, InputFileProps } from \"./InputFile\"\n\nexport interface ReadExcelProps extends Omit<InputFileProps<false, \"arrayBuffer\">, \"multiple\" | \"accept\" | \"type\" | \"onValueChange\"> {\n onValueChange?: <Sheet = WorkSheetData>(data: WorkBookData<Sheet>) => void\n}\n\n/** 专门用于读取 excel 的组件 */\nexport const ReadExcel: FC<ReadExcelProps> = props => {\n const { onValueChange, ...rest } = props\n\n return <InputFile accept=\".xlsx\" type=\"arrayBuffer\" onValueChange={data => onValueChange?.(readExcel(data))} {...rest} />\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAAsCA,SAAS,QAAQ,eAAe;AAEtE,SAASC,SAAS;AAAqC,SAAAC,GAAA,IAAAC,IAAA;AAMvD;AACA,OAAO,MAAMC,SAA6B,GAAGC,KAAK,IAAI;EAClD,MAAM;IAAEC,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGF,KAAK;EAExC,oBAAOF,IAAA,CAACF,SAAS;IAACO,MAAM,EAAC,OAAO;IAACC,IAAI,EAAC,aAAa;IAACH,aAAa,EAAEI,IAAI,IAAIJ,aAAa,GAAGN,SAAS,CAACU,IAAI,CAAC,CAAE;IAAA,GAAKH;EAAI,CAAG,CAAC;AAC7H,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
2
|
-
export interface RingProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
outerWidth: number;
|
|
4
|
-
innerWidth: number;
|
|
5
|
-
}
|
|
6
|
-
/** 环形组件 */
|
|
7
|
-
export declare const Ring: import("react").ForwardRefExoticComponent<RingProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
/** 环形组件 */
|
|
6
|
-
export const Ring = /*#__PURE__*/forwardRef((props, ref) => {
|
|
7
|
-
const {
|
|
8
|
-
outerWidth,
|
|
9
|
-
innerWidth,
|
|
10
|
-
style,
|
|
11
|
-
...rest
|
|
12
|
-
} = props;
|
|
13
|
-
const outerRadius = outerWidth / 2;
|
|
14
|
-
const innerRadius = innerWidth / 2;
|
|
15
|
-
return /*#__PURE__*/_jsx("div", {
|
|
16
|
-
ref: ref,
|
|
17
|
-
style: {
|
|
18
|
-
...style,
|
|
19
|
-
width: `${outerWidth}px`,
|
|
20
|
-
height: `${outerWidth}px`,
|
|
21
|
-
clipPath: `path("M0,${outerRadius} a${outerRadius},${outerRadius},0,1,0,${outerWidth},0 a${outerRadius},${outerRadius},0,1,0,-${outerWidth},0 l${outerRadius - innerRadius},0 a${innerRadius},${innerRadius},0,0,1,${innerRadius * 2},0 a${innerRadius},${innerRadius},0,0,1,-${innerRadius * 2},0 Z")`
|
|
22
|
-
},
|
|
23
|
-
...rest
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=Ring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","jsx","_jsx","Ring","props","ref","outerWidth","innerWidth","style","rest","outerRadius","innerRadius","width","height","clipPath"],"sources":["../../../src/components/Ring.tsx"],"sourcesContent":["\"use client\"\n\nimport { HTMLAttributes, forwardRef } from \"react\"\n\nexport interface RingProps extends HTMLAttributes<HTMLDivElement> {\n outerWidth: number\n innerWidth: number\n}\n\n/** 环形组件 */\nexport const Ring = forwardRef<HTMLDivElement, RingProps>((props, ref) => {\n const { outerWidth, innerWidth, style, ...rest } = props\n\n const outerRadius = outerWidth / 2\n\n const innerRadius = innerWidth / 2\n\n return (\n <div\n ref={ref}\n style={{\n ...style,\n width: `${outerWidth}px`,\n height: `${outerWidth}px`,\n clipPath: `path(\"M0,${outerRadius} a${outerRadius},${outerRadius},0,1,0,${outerWidth},0 a${outerRadius},${outerRadius},0,1,0,-${outerWidth},0 l${outerRadius - innerRadius},0 a${innerRadius},${innerRadius},0,0,1,${innerRadius * 2},0 a${innerRadius},${innerRadius},0,0,1,-${innerRadius * 2},0 Z\")`,\n }}\n {...rest}\n />\n )\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAyBA,UAAU,QAAQ,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOlD;AACA,OAAO,MAAMC,IAAI,gBAAGH,UAAU,CAA4B,CAACI,KAAK,EAAEC,GAAG,KAAK;EACtE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,KAAK;IAAE,GAAGC;EAAK,CAAC,GAAGL,KAAK;EAExD,MAAMM,WAAW,GAAGJ,UAAU,GAAG,CAAC;EAElC,MAAMK,WAAW,GAAGJ,UAAU,GAAG,CAAC;EAElC,oBACIL,IAAA;IACIG,GAAG,EAAEA,GAAI;IACTG,KAAK,EAAE;MACH,GAAGA,KAAK;MACRI,KAAK,EAAG,GAAEN,UAAW,IAAG;MACxBO,MAAM,EAAG,GAAEP,UAAW,IAAG;MACzBQ,QAAQ,EAAG,YAAWJ,WAAY,KAAIA,WAAY,IAAGA,WAAY,UAASJ,UAAW,OAAMI,WAAY,IAAGA,WAAY,WAAUJ,UAAW,OAAMI,WAAW,GAAGC,WAAY,OAAMA,WAAY,IAAGA,WAAY,UAASA,WAAW,GAAG,CAAE,OAAMA,WAAY,IAAGA,WAAY,WAAUA,WAAW,GAAG,CAAE;IACpS,CAAE;IAAA,GACEF;EAAI,CACX,CAAC;AAEV,CAAC,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, ForwardedRef, HTMLAttributes } from "react";
|
|
2
|
-
import Scrollbar from "smooth-scrollbar";
|
|
3
|
-
import type { ScrollListener, ScrollbarOptions } from "smooth-scrollbar/interfaces";
|
|
4
|
-
export { default as Scrollbar } from "smooth-scrollbar";
|
|
5
|
-
export * from "smooth-scrollbar/interfaces";
|
|
6
|
-
export interface ScrollOptions extends Partial<ScrollbarOptions> {
|
|
7
|
-
/** 滑块宽度 */
|
|
8
|
-
thumbWidth?: number | string;
|
|
9
|
-
/** 滑块圆角大小 */
|
|
10
|
-
thumbRadius?: number | string;
|
|
11
|
-
/** 滑块背景颜色 */
|
|
12
|
-
thumbColor?: CSSProperties["backgroundColor"];
|
|
13
|
-
/** 滚动条背景颜色 */
|
|
14
|
-
trackColor?: CSSProperties["backgroundColor"];
|
|
15
|
-
}
|
|
16
|
-
export interface ScrollProps extends HTMLAttributes<HTMLDivElement> {
|
|
17
|
-
/** 滚动的配置 */
|
|
18
|
-
options?: ScrollOptions;
|
|
19
|
-
/** 滚动条实例 */
|
|
20
|
-
scrollbar?: ForwardedRef<Scrollbar>;
|
|
21
|
-
/** 滚动条滚动事件 */
|
|
22
|
-
onScrollbar?: ScrollListener;
|
|
23
|
-
}
|
|
24
|
-
export declare const Scroll: import("react").ForwardRefExoticComponent<ScrollProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
4
|
-
import { css } from "@emotion/css";
|
|
5
|
-
import { clsx } from "deepsea-tools";
|
|
6
|
-
import Scrollbar from "smooth-scrollbar";
|
|
7
|
-
import { px, transformCSSVariable } from "../utils";
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
export { default as Scrollbar } from "smooth-scrollbar";
|
|
10
|
-
export * from "smooth-scrollbar/interfaces";
|
|
11
|
-
export const Scroll = /*#__PURE__*/forwardRef((props, ref) => {
|
|
12
|
-
const {
|
|
13
|
-
children,
|
|
14
|
-
options,
|
|
15
|
-
className,
|
|
16
|
-
style,
|
|
17
|
-
scrollbar,
|
|
18
|
-
onScrollbar,
|
|
19
|
-
...rest
|
|
20
|
-
} = props;
|
|
21
|
-
const {
|
|
22
|
-
thumbWidth,
|
|
23
|
-
thumbRadius,
|
|
24
|
-
thumbColor,
|
|
25
|
-
trackColor,
|
|
26
|
-
...scrollbarOptions
|
|
27
|
-
} = options || {};
|
|
28
|
-
const ele = useRef(null);
|
|
29
|
-
const bar = useRef(null);
|
|
30
|
-
useLayoutEffect(() => {
|
|
31
|
-
bar.current = Scrollbar.init(ele.current, scrollbarOptions);
|
|
32
|
-
return () => bar.current?.destroy();
|
|
33
|
-
}, []);
|
|
34
|
-
useImperativeHandle(ref, () => ele.current, []);
|
|
35
|
-
useImperativeHandle(scrollbar, () => bar.current, []);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (!onScrollbar) return;
|
|
38
|
-
bar.current?.addListener(onScrollbar);
|
|
39
|
-
return () => bar.current?.removeListener(onScrollbar);
|
|
40
|
-
}, [onScrollbar]);
|
|
41
|
-
return /*#__PURE__*/_jsx("div", {
|
|
42
|
-
ref: ele,
|
|
43
|
-
className: clsx(css`
|
|
44
|
-
.scrollbar-track.scrollbar-track-x {
|
|
45
|
-
${thumbWidth !== undefined ? "height: var(--thumb-width);" : ""} ${trackColor !== undefined ? "background-color: var(--track-color);" : ""}
|
|
46
|
-
}
|
|
47
|
-
.scrollbar-thumb.scrollbar-thumb-x {
|
|
48
|
-
${thumbWidth !== undefined ? "height: var(--thumb-width);" : ""} ${thumbRadius !== undefined ? "border-radius: var(--thumb-radius);" : ""} ${thumbColor !== undefined ? "background-color: var(--thumb-color);" : ""}
|
|
49
|
-
}
|
|
50
|
-
.scrollbar-track.scrollbar-track-y {
|
|
51
|
-
${thumbWidth !== undefined ? "width: var(--thumb-width);" : ""} ${trackColor !== undefined ? "background-color: var(--track-color);" : ""}
|
|
52
|
-
}
|
|
53
|
-
.scrollbar-thumb.scrollbar-thumb-y {
|
|
54
|
-
${thumbWidth !== undefined ? "width: var(--thumb-width);" : ""} ${thumbRadius !== undefined ? "border-radius: var(--thumb-radius);" : ""} ${thumbColor !== undefined ? "background-color: var(--thumb-color);" : ""}
|
|
55
|
-
}
|
|
56
|
-
`, className),
|
|
57
|
-
style: transformCSSVariable({
|
|
58
|
-
thumbWidth: px(thumbWidth),
|
|
59
|
-
thumbRadius: px(thumbRadius),
|
|
60
|
-
thumbColor,
|
|
61
|
-
trackColor
|
|
62
|
-
}, style),
|
|
63
|
-
...rest,
|
|
64
|
-
children: children
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=Scroll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useEffect","useImperativeHandle","useLayoutEffect","useRef","css","clsx","Scrollbar","px","transformCSSVariable","jsx","_jsx","default","Scroll","props","ref","children","options","className","style","scrollbar","onScrollbar","rest","thumbWidth","thumbRadius","thumbColor","trackColor","scrollbarOptions","ele","bar","current","init","destroy","addListener","removeListener","undefined"],"sources":["../../../src/components/Scroll.tsx"],"sourcesContent":["\"use client\"\n\nimport { CSSProperties, ForwardedRef, HTMLAttributes, forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\nimport { css } from \"@emotion/css\"\nimport { clsx } from \"deepsea-tools\"\nimport Scrollbar from \"smooth-scrollbar\"\nimport type { ScrollListener, ScrollbarOptions } from \"smooth-scrollbar/interfaces\"\n\nimport { px, transformCSSVariable } from \"@/utils\"\n\nexport { default as Scrollbar } from \"smooth-scrollbar\"\nexport * from \"smooth-scrollbar/interfaces\"\n\nexport interface ScrollOptions extends Partial<ScrollbarOptions> {\n /** 滑块宽度 */\n thumbWidth?: number | string\n /** 滑块圆角大小 */\n thumbRadius?: number | string\n /** 滑块背景颜色 */\n thumbColor?: CSSProperties[\"backgroundColor\"]\n /** 滚动条背景颜色 */\n trackColor?: CSSProperties[\"backgroundColor\"]\n}\n\nexport interface ScrollProps extends HTMLAttributes<HTMLDivElement> {\n /** 滚动的配置 */\n options?: ScrollOptions\n /** 滚动条实例 */\n scrollbar?: ForwardedRef<Scrollbar>\n /** 滚动条滚动事件 */\n onScrollbar?: ScrollListener\n}\n\nexport const Scroll = forwardRef<HTMLDivElement, ScrollProps>((props, ref) => {\n const { children, options, className, style, scrollbar, onScrollbar, ...rest } = props\n const { thumbWidth, thumbRadius, thumbColor, trackColor, ...scrollbarOptions } = options || {}\n const ele = useRef<HTMLDivElement>(null)\n const bar = useRef<Scrollbar | null>(null)\n\n useLayoutEffect(() => {\n bar.current = Scrollbar.init(ele.current!, scrollbarOptions)\n return () => bar.current?.destroy()\n }, [])\n\n useImperativeHandle(ref, () => ele.current!, [])\n\n useImperativeHandle(scrollbar, () => bar.current!, [])\n\n useEffect(() => {\n if (!onScrollbar) return\n bar.current?.addListener(onScrollbar)\n return () => bar.current?.removeListener(onScrollbar)\n }, [onScrollbar])\n\n return (\n <div\n ref={ele}\n className={clsx(\n css`\n .scrollbar-track.scrollbar-track-x {\n ${thumbWidth !== undefined ? \"height: var(--thumb-width);\" : \"\"} ${trackColor !== undefined\n ? \"background-color: var(--track-color);\"\n : \"\"}\n }\n .scrollbar-thumb.scrollbar-thumb-x {\n ${thumbWidth !== undefined ? \"height: var(--thumb-width);\" : \"\"} ${thumbRadius !== undefined\n ? \"border-radius: var(--thumb-radius);\"\n : \"\"} ${thumbColor !== undefined ? \"background-color: var(--thumb-color);\" : \"\"}\n }\n .scrollbar-track.scrollbar-track-y {\n ${thumbWidth !== undefined ? \"width: var(--thumb-width);\" : \"\"} ${trackColor !== undefined\n ? \"background-color: var(--track-color);\"\n : \"\"}\n }\n .scrollbar-thumb.scrollbar-thumb-y {\n ${thumbWidth !== undefined ? \"width: var(--thumb-width);\" : \"\"} ${thumbRadius !== undefined\n ? \"border-radius: var(--thumb-radius);\"\n : \"\"} ${thumbColor !== undefined ? \"background-color: var(--thumb-color);\" : \"\"}\n }\n `,\n className,\n )}\n style={transformCSSVariable(\n {\n thumbWidth: px(thumbWidth),\n thumbRadius: px(thumbRadius),\n thumbColor,\n trackColor,\n },\n style,\n )}\n {...rest}\n >\n {children}\n </div>\n )\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAsDA,UAAU,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AACxI,SAASC,GAAG,QAAQ,cAAc;AAClC,SAASC,IAAI,QAAQ,eAAe;AACpC,OAAOC,SAAS,MAAM,kBAAkB;AAGxC,SAASC,EAAE,EAAEC,oBAAoB;AAAiB,SAAAC,GAAA,IAAAC,IAAA;AAElD,SAASC,OAAO,IAAIL,SAAS,QAAQ,kBAAkB;AACvD,cAAc,6BAA6B;AAsB3C,OAAO,MAAMM,MAAM,gBAAGb,UAAU,CAA8B,CAACc,KAAK,EAAEC,GAAG,KAAK;EAC1E,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,SAAS;IAAEC,KAAK;IAAEC,SAAS;IAAEC,WAAW;IAAE,GAAGC;EAAK,CAAC,GAAGR,KAAK;EACtF,MAAM;IAAES,UAAU;IAAEC,WAAW;IAAEC,UAAU;IAAEC,UAAU;IAAE,GAAGC;EAAiB,CAAC,GAAGV,OAAO,IAAI,CAAC,CAAC;EAC9F,MAAMW,GAAG,GAAGxB,MAAM,CAAiB,IAAI,CAAC;EACxC,MAAMyB,GAAG,GAAGzB,MAAM,CAAmB,IAAI,CAAC;EAE1CD,eAAe,CAAC,MAAM;IAClB0B,GAAG,CAACC,OAAO,GAAGvB,SAAS,CAACwB,IAAI,CAACH,GAAG,CAACE,OAAO,EAAGH,gBAAgB,CAAC;IAC5D,OAAO,MAAME,GAAG,CAACC,OAAO,EAAEE,OAAO,CAAC,CAAC;EACvC,CAAC,EAAE,EAAE,CAAC;EAEN9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AC;MAC5BC,UAAU;MACVC;IACJ,CAAC,EACDP,KACJ,CAAE;IAAA,GACEG,IAAI;IAAAN,QAAA,EAEPA;EAAQ,CACR,CAAC;AAEd,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
2
|
-
export interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
outerRadius: number;
|
|
4
|
-
innerRadius: number;
|
|
5
|
-
count: number;
|
|
6
|
-
angel: number;
|
|
7
|
-
}
|
|
8
|
-
export declare const SectionRing: import("react").ForwardRefExoticComponent<SectionRingProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
import { drawArc } from "deepsea-tools";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
export const SectionRing = /*#__PURE__*/forwardRef((props, ref) => {
|
|
7
|
-
const {
|
|
8
|
-
outerRadius: o,
|
|
9
|
-
innerRadius: i,
|
|
10
|
-
count: c,
|
|
11
|
-
angel: a,
|
|
12
|
-
style,
|
|
13
|
-
...rest
|
|
14
|
-
} = props;
|
|
15
|
-
const s = Math.PI * 2 / c - a;
|
|
16
|
-
function arc(radius, startAngle, endAngle, options = {}) {
|
|
17
|
-
return drawArc(o, o, radius, startAngle, endAngle, options);
|
|
18
|
-
}
|
|
19
|
-
return /*#__PURE__*/_jsx("div", {
|
|
20
|
-
ref: ref,
|
|
21
|
-
style: {
|
|
22
|
-
width: o * 2,
|
|
23
|
-
height: o * 2,
|
|
24
|
-
clipPath: `path("${Array(c).fill(0).map((it, idx) => `${arc(o, idx * (a + s), idx * (a + s) + a)} ${arc(i, idx * (a + s) + a, idx * (a + s), {
|
|
25
|
-
line: true,
|
|
26
|
-
anticlockwise: true
|
|
27
|
-
})}`).join(" ")} Z")`,
|
|
28
|
-
...style
|
|
29
|
-
},
|
|
30
|
-
...rest
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=SectionRing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","drawArc","jsx","_jsx","SectionRing","props","ref","outerRadius","o","innerRadius","i","count","c","angel","a","style","rest","s","Math","PI","arc","radius","startAngle","endAngle","options","width","height","clipPath","Array","fill","map","it","idx","line","anticlockwise","join"],"sources":["../../../src/components/SectionRing.tsx"],"sourcesContent":["\"use client\"\n\nimport { HTMLAttributes, forwardRef } from \"react\"\nimport { DrawArcOptions, drawArc } from \"deepsea-tools\"\n\nexport interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {\n outerRadius: number\n innerRadius: number\n count: number\n angel: number\n}\n\nexport const SectionRing = forwardRef<HTMLDivElement, SectionRingProps>((props, ref) => {\n const { outerRadius: o, innerRadius: i, count: c, angel: a, style, ...rest } = props\n\n const s = (Math.PI * 2) / c - a\n\n function arc(radius: number, startAngle: number, endAngle: number, options: DrawArcOptions = {}) {\n return drawArc(o, o, radius, startAngle, endAngle, options)\n }\n\n return (\n <div\n ref={ref}\n style={{\n width: o * 2,\n height: o * 2,\n clipPath: `path(\"${Array(c)\n .fill(0)\n .map(\n (it, idx) =>\n `${arc(o, idx * (a + s), idx * (a + s) + a)} ${arc(i, idx * (a + s) + a, idx * (a + s), { line: true, anticlockwise: true })}`,\n )\n .join(\" \")} Z\")`,\n ...style,\n }}\n {...rest}\n />\n )\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAyBA,UAAU,QAAQ,OAAO;AAClD,SAAyBC,OAAO,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AASvD,OAAO,MAAMC,WAAW,gBAAGJ,UAAU,CAAmC,CAACK,KAAK,EAAEC,GAAG,KAAK;EACpF,MAAM;IAAEC,WAAW,EAAEC,CAAC;IAAEC,WAAW,EAAEC,CAAC;IAAEC,KAAK,EAAEC,CAAC;IA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|
-
loading?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare const Skeleton: import("react").ForwardRefExoticComponent<SkeletonProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
import { css } from "@emotion/css";
|
|
5
|
-
import { clsx } from "deepsea-tools";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export const Skeleton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
|
-
const {
|
|
9
|
-
className,
|
|
10
|
-
children,
|
|
11
|
-
loading = children === undefined || children === null,
|
|
12
|
-
...rest
|
|
13
|
-
} = props;
|
|
14
|
-
return /*#__PURE__*/_jsx("div", {
|
|
15
|
-
ref: ref,
|
|
16
|
-
className: clsx(css`
|
|
17
|
-
@keyframes shimmer {
|
|
18
|
-
0% {
|
|
19
|
-
background-position: -400px 0px;
|
|
20
|
-
}
|
|
21
|
-
100% {
|
|
22
|
-
background-position: 400px 0px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
`, loading && css`
|
|
26
|
-
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.067) 8%, rgba(0, 0, 0, 0.133) 18%, rgba(0, 0, 0, 0.067) 33%);
|
|
27
|
-
animation-duration: 1s;
|
|
28
|
-
animation-fill-mode: forwards;
|
|
29
|
-
animation-iteration-count: infinite;
|
|
30
|
-
animation-name: shimmer;
|
|
31
|
-
animation-timing-function: linear;
|
|
32
|
-
background-size: 800px 104px;
|
|
33
|
-
`, className),
|
|
34
|
-
...rest,
|
|
35
|
-
children: children
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","css","clsx","jsx","_jsx","Skeleton","props","ref","className","children","loading","undefined","rest"],"sources":["../../../src/components/Skeleton.tsx"],"sourcesContent":["\"use client\"\n\nimport { HTMLAttributes, forwardRef } from \"react\"\nimport { css } from \"@emotion/css\"\nimport { clsx } from \"deepsea-tools\"\n\nexport interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n loading?: boolean\n}\n\nexport const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>((props, ref) => {\n const { className, children, loading = children === undefined || children === null, ...rest } = props\n\n return (\n <div\n ref={ref}\n className={clsx(\n css`\n @keyframes shimmer {\n 0% {\n background-position: -400px 0px;\n }\n 100% {\n background-position: 400px 0px;\n }\n }\n `,\n loading &&\n css`\n background-image: linear-gradient(to right, rgba(0, 0, 0, 0.067) 8%, rgba(0, 0, 0, 0.133) 18%, rgba(0, 0, 0, 0.067) 33%);\n animation-duration: 1s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: shimmer;\n animation-timing-function: linear;\n background-size: 800px 104px;\n `,\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n )\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAyBA,UAAU,QAAQ,OAAO;AAClD,SAASC,GAAG,QAAQ,cAAc;AAClC,SAASC,IAAI,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMpC,OAAO,MAAMC,QAAQ,gBAAGL,UAAU,CAAgC,CAACM,KAAK,EAAEC,GAAG,KAAK;EAC9E,MAAM;IAAEC,SAAS;IAAEC,QAAQ;IAAEC,OAAO,GAAGD,QAAQ,KAAKE,SAAS,IAAIF,QAAQ,KAAK,IAAI;IAAE,GAAGG;EAAK,CAAC,GAAGN,KAAK;EAErG,oBACIF,IAAA;IACIG,GAAG,EAAEA,GAAI;IACTC,SAAS,EAAEN,IAAI,CACXD,GAAI;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,EACDS,OAAO,IACHT,GAAI;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,EACLO,SACJ,CAAE;IAAA,GACEI,IAAI;IAAAH,QAAA,EAEPA;EAAQ,CACR,CAAC;AAEd,CAAC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
export type TitleProps = ComponentPropsWithoutRef<"title">;
|
|
3
|
-
export declare const Title: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>, "ref"> & import("react").RefAttributes<HTMLTitleElement>>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
4
|
-
import { createPortal } from "react-dom";
|
|
5
|
-
import { isBrowser } from "deepsea-tools";
|
|
6
|
-
import { getReactVersion } from "../utils/getReactVersion";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const [major] = getReactVersion();
|
|
9
|
-
export const Title = /*#__PURE__*/forwardRef((props, ref) => {
|
|
10
|
-
if (major >= 19) return /*#__PURE__*/_jsx("title", {
|
|
11
|
-
ref: ref,
|
|
12
|
-
...props
|
|
13
|
-
});
|
|
14
|
-
const ele = useRef(null);
|
|
15
|
-
useImperativeHandle(ref, () => ele.current, [ele.current]);
|
|
16
|
-
useLayoutEffect(() => {
|
|
17
|
-
const title = document.head.querySelector("title");
|
|
18
|
-
if (title === ele.current) return;
|
|
19
|
-
document.head.insertBefore(ele.current, title);
|
|
20
|
-
}, []);
|
|
21
|
-
return isBrowser && /*#__PURE__*/createPortal( /*#__PURE__*/_jsx("title", {
|
|
22
|
-
ref: ele,
|
|
23
|
-
...props
|
|
24
|
-
}), document.head);
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=Title.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useImperativeHandle","useLayoutEffect","useRef","createPortal","isBrowser","getReactVersion","jsx","_jsx","major","Title","props","ref","ele","current","title","document","head","querySelector","insertBefore"],"sources":["../../../src/components/Title.tsx"],"sourcesContent":["\"use client\"\n\nimport { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { isBrowser } from \"deepsea-tools\"\n\nimport { getReactVersion } from \"@/utils/getReactVersion\"\n\nexport type TitleProps = ComponentPropsWithoutRef<\"title\">\n\nconst [major] = getReactVersion()\n\nexport const Title = forwardRef<HTMLTitleElement, TitleProps>((props, ref) => {\n if (major >= 19) return <title ref={ref} {...props} />\n\n const ele = useRef<HTMLTitleElement>(null)\n\n useImperativeHandle(ref, () => ele.current as HTMLTitleElement, [ele.current])\n\n useLayoutEffect(() => {\n const title = document.head.querySelector(\"title\")\n if (title === ele.current) return\n document.head.insertBefore(ele.current as HTMLTitleElement, title)\n }, [])\n\n return isBrowser && createPortal(<title ref={ele} {...props} />, document.head)\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAmCA,UAAU,EAAEC,mBAAmB,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAC1G,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,SAAS,QAAQ,eAAe;AAEzC,SAASC,eAAe;AAAiC,SAAAC,GAAA,IAAAC,IAAA;AAIzD,MAAM,CAACC,KAAK,CAAC,GAAGH,eAAe,CAAC,CAAC;AAEjC,OAAO,MAAMI,KAAK,gBAAGV,UAAU,CAA+B,CAACW,KAAK,EAAEC,GAAG,KAAK;EAC1E,IAAIH,KAAK,IAAI,EAAE,EAAE,oBAAOD,IAAA;IAAOI,GAAG,EAAEA,GAAI;IAAA,GAAKD;EAAK,CAAG,CAAC;EAEtD,MAAME,GAAG,GAAGV,MAAM,CAAmB,IAAI,CAAC;EAE1CF,mBAAmB,CAACW,GAAG,EAAE,MAAMC,GAAG,CAACC,OAA2B,EAAE,CAACD,GAAG,CAACC,OAAO,CAAC,CAAC;EAE9EZ,eAAe,CAAC,MAAM;IAClB,MAAMa,KAAK,GAAGC,QAAQ,CAACC,IAAI,CAACC,aAAa,CAAC,OAAO,CAAC;IAClD,IAAIH,KAAK,KAAKF,GAAG,CAACC,OAAO,EAAE;IAC3BE,QAAQ,CAACC,IAAI,CAACE,YAAY,CAACN,GAAG,CAACC,OAAO,EAAsBC,KAAK,CAAC;EACtE,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOV,SAAS,iBAAID,YAAY,eAACI,IAAA;IAAOI,GAAG,EAAEC,GAAI;IAAA,GAAKF;EAAK,CAAG,CAAC,EAAEK,QAAQ,CAACC,IAAI,CAAC;AACnF,CAAC,CAAC"}
|