@tiny-codes/react-easy 1.7.4 → 1.7.6
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/CHANGELOG.md +25 -0
- package/es/components/Animation/Pulse/index.d.ts +18 -2
- package/es/components/Animation/Pulse/index.js +1 -1
- package/es/components/Animation/Pulse/index.js.map +1 -1
- package/es/components/BreakLines/index.d.ts +7 -7
- package/es/components/BreakLines/index.js.map +1 -1
- package/es/components/ColumnSetting/index.d.ts +7 -2
- package/es/components/ColumnSetting/index.js +27 -16
- package/es/components/ColumnSetting/index.js.map +1 -1
- package/es/components/ConfigProvider/context.d.ts +2 -0
- package/es/components/ConfigProvider/context.js +1 -1
- package/es/components/ConfigProvider/context.js.map +1 -1
- package/es/components/ConfigProvider/index.d.ts +17 -1
- package/es/components/ConfigProvider/index.js +15 -8
- package/es/components/ConfigProvider/index.js.map +1 -1
- package/es/components/ContextMenu/index.d.ts +16 -0
- package/es/components/ContextMenu/index.js.map +1 -1
- package/es/components/EditableText/form.d.ts +4 -0
- package/es/components/EditableText/form.js.map +1 -1
- package/es/components/EditableText/index.d.ts +6 -2
- package/es/components/EditableText/index.js.map +1 -1
- package/es/components/EllipsisTypography/EllipsisLink.d.ts +19 -0
- package/es/components/EllipsisTypography/EllipsisLink.js +19 -0
- package/es/components/EllipsisTypography/EllipsisLink.js.map +1 -0
- package/es/components/FloatDrawer/index.d.ts +10 -0
- package/es/components/FloatDrawer/index.js.map +1 -1
- package/es/components/OverflowTags/index.d.ts +2 -0
- package/es/components/OverflowTags/index.js.map +1 -1
- package/es/components/index.d.ts +2 -0
- package/es/components/index.js +2 -0
- package/es/components/index.js.map +1 -1
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/index.js.map +1 -1
- package/es/hooks/useLocalStorage.d.ts +16 -0
- package/es/hooks/useLocalStorage.js +115 -0
- package/es/hooks/useLocalStorage.js.map +1 -0
- package/es/hooks/useMovable.js +2 -2
- package/es/hooks/useMovable.js.map +1 -1
- package/es/locales/index.js +1 -1
- package/es/locales/index.js.map +1 -1
- package/es/utils/math.d.ts +11 -3
- package/es/utils/math.js +62 -9
- package/es/utils/math.js.map +1 -1
- package/lib/components/Animation/Pulse/index.d.ts +18 -2
- package/lib/components/Animation/Pulse/index.js +0 -5
- package/lib/components/Animation/Pulse/index.js.map +2 -2
- package/lib/components/BreakLines/index.d.ts +7 -7
- package/lib/components/BreakLines/index.js.map +1 -1
- package/lib/components/ColumnSetting/index.d.ts +7 -2
- package/lib/components/ColumnSetting/index.js +18 -14
- package/lib/components/ColumnSetting/index.js.map +3 -3
- package/lib/components/ConfigProvider/context.d.ts +2 -0
- package/lib/components/ConfigProvider/context.js +1 -1
- package/lib/components/ConfigProvider/context.js.map +2 -2
- package/lib/components/ConfigProvider/index.d.ts +17 -1
- package/lib/components/ConfigProvider/index.js +13 -6
- package/lib/components/ConfigProvider/index.js.map +2 -2
- package/lib/components/ContextMenu/index.d.ts +16 -0
- package/lib/components/ContextMenu/index.js.map +2 -2
- package/lib/components/EditableText/form.d.ts +4 -0
- package/lib/components/EditableText/form.js.map +2 -2
- package/lib/components/EditableText/index.d.ts +6 -2
- package/lib/components/EditableText/index.js.map +2 -2
- package/lib/components/EllipsisTypography/EllipsisLink.d.ts +19 -0
- package/lib/components/EllipsisTypography/EllipsisLink.js +39 -0
- package/lib/components/EllipsisTypography/EllipsisLink.js.map +7 -0
- package/lib/components/FloatDrawer/index.d.ts +10 -0
- package/lib/components/FloatDrawer/index.js.map +2 -2
- package/lib/components/OverflowTags/index.d.ts +2 -0
- package/lib/components/OverflowTags/index.js.map +2 -2
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +6 -1
- package/lib/components/index.js.map +2 -2
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +5 -0
- package/lib/hooks/index.js.map +2 -2
- package/lib/hooks/useLocalStorage.d.ts +16 -0
- package/lib/hooks/useLocalStorage.js +120 -0
- package/lib/hooks/useLocalStorage.js.map +7 -0
- package/lib/hooks/useMovable.js +2 -2
- package/lib/hooks/useMovable.js.map +3 -3
- package/lib/locales/index.js +1 -1
- package/lib/locales/index.js.map +1 -1
- package/lib/utils/math.d.ts +11 -3
- package/lib/utils/math.js +43 -8
- package/lib/utils/math.js.map +3 -3
- package/package.json +14 -7
package/lib/components/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(components_exports, {
|
|
|
37
37
|
ContextMenu: () => import_ContextMenu.default,
|
|
38
38
|
DeleteConfirmAction: () => import_DeleteConfirmAction.default,
|
|
39
39
|
EditableText: () => import_EditableText.default,
|
|
40
|
+
EllipsisLink: () => import_EllipsisLink.default,
|
|
40
41
|
EllipsisParagraph: () => import_EllipsisParagraph.default,
|
|
41
42
|
EllipsisText: () => import_EllipsisText.default,
|
|
42
43
|
EllipsisTitle: () => import_EllipsisTitle.default,
|
|
@@ -71,6 +72,8 @@ __reExport(components_exports, require("./EllipsisTypography/EllipsisText"), mod
|
|
|
71
72
|
var import_EllipsisText = __toESM(require("./EllipsisTypography/EllipsisText"));
|
|
72
73
|
__reExport(components_exports, require("./EllipsisTypography/EllipsisTitle"), module.exports);
|
|
73
74
|
var import_EllipsisTitle = __toESM(require("./EllipsisTypography/EllipsisTitle"));
|
|
75
|
+
__reExport(components_exports, require("./EllipsisTypography/EllipsisLink"), module.exports);
|
|
76
|
+
var import_EllipsisLink = __toESM(require("./EllipsisTypography/EllipsisLink"));
|
|
74
77
|
var import_FloatDrawer = __toESM(require("./FloatDrawer"));
|
|
75
78
|
var import_FormItemControl = __toESM(require("./FormItemControl"));
|
|
76
79
|
var import_Loading = __toESM(require("./Loading"));
|
|
@@ -87,6 +90,7 @@ var import_Pulse = __toESM(require("./Animation/Pulse"));
|
|
|
87
90
|
ContextMenu,
|
|
88
91
|
DeleteConfirmAction,
|
|
89
92
|
EditableText,
|
|
93
|
+
EllipsisLink,
|
|
90
94
|
EllipsisParagraph,
|
|
91
95
|
EllipsisText,
|
|
92
96
|
EllipsisTitle,
|
|
@@ -104,6 +108,7 @@ var import_Pulse = __toESM(require("./Animation/Pulse"));
|
|
|
104
108
|
withModalAction,
|
|
105
109
|
...require("./EllipsisTypography/EllipsisParagraph"),
|
|
106
110
|
...require("./EllipsisTypography/EllipsisText"),
|
|
107
|
-
...require("./EllipsisTypography/EllipsisTitle")
|
|
111
|
+
...require("./EllipsisTypography/EllipsisTitle"),
|
|
112
|
+
...require("./EllipsisTypography/EllipsisLink")
|
|
108
113
|
});
|
|
109
114
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/index.tsx"],
|
|
4
|
-
"sourcesContent": ["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ColumnSettingProps } from './ColumnSetting';\nexport { default as ColumnSetting } from './ColumnSetting';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef, ActionCompConstraint } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as withConfirmAction } from './ConfirmAction/withConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\nexport type {\n ContextMenuProps,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuSubmenu,\n ContextMenuRef,\n} from './ContextMenu';\nexport { default as ContextMenu } from './ContextMenu';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\nexport { default as withDeleteConfirmAction } from './DeleteConfirmAction/withDeleteConfirmAction';\n\nexport type { EditableTextProps } from './EditableText';\nexport { default as EditableText } from './EditableText';\n\nexport * from './EllipsisTypography/EllipsisParagraph';\nexport { default as EllipsisParagraph } from './EllipsisTypography/EllipsisParagraph';\n\nexport * from './EllipsisTypography/EllipsisText';\nexport { default as EllipsisText } from './EllipsisTypography/EllipsisText';\n\nexport * from './EllipsisTypography/EllipsisTitle';\nexport { default as EllipsisTitle } from './EllipsisTypography/EllipsisTitle';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { FormItemControlProps } from './FormItemControl';\nexport { default as FormItemControl } from './FormItemControl';\n\nexport type { LoadingProps } from './Loading';\nexport { default as Loading } from './Loading';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\nexport type { OverflowTagsProps } from './OverflowTags';\nexport { default as OverflowTags } from './OverflowTags';\n\nexport type { PulseAnimationProps } from './Animation/Pulse';\nexport { default as PulseAnimation } from './Animation/Pulse';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AAGtC,2BAAyC;AAGzC,4BAA0C;AAE1C,qBAA4C;AAG5C,2BAA8C;AAC9C,+BAA6C;AAC7C,IAAAA,wBAAyC;AASzC,yBAAuC;AAGvC,iCAA+C;AAC/C,qCAAmD;AAGnD,0BAAwC;AAExC,+BAAc,mDAhCd;AAiCA,+BAA6C;AAE7C,+BAAc,8CAnCd;AAoCA,0BAAwC;AAExC,+BAAc,+CAtCd;AAuCA,2BAAyC;
|
|
4
|
+
"sourcesContent": ["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ColumnSettingProps } from './ColumnSetting';\nexport { default as ColumnSetting } from './ColumnSetting';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef, ActionCompConstraint } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as withConfirmAction } from './ConfirmAction/withConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\nexport type {\n ContextMenuProps,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuSubmenu,\n ContextMenuRef,\n} from './ContextMenu';\nexport { default as ContextMenu } from './ContextMenu';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\nexport { default as withDeleteConfirmAction } from './DeleteConfirmAction/withDeleteConfirmAction';\n\nexport type { EditableTextProps } from './EditableText';\nexport { default as EditableText } from './EditableText';\n\nexport * from './EllipsisTypography/EllipsisParagraph';\nexport { default as EllipsisParagraph } from './EllipsisTypography/EllipsisParagraph';\n\nexport * from './EllipsisTypography/EllipsisText';\nexport { default as EllipsisText } from './EllipsisTypography/EllipsisText';\n\nexport * from './EllipsisTypography/EllipsisTitle';\nexport { default as EllipsisTitle } from './EllipsisTypography/EllipsisTitle';\n\nexport * from './EllipsisTypography/EllipsisLink';\nexport { default as EllipsisLink } from './EllipsisTypography/EllipsisLink';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { FormItemControlProps } from './FormItemControl';\nexport { default as FormItemControl } from './FormItemControl';\n\nexport type { LoadingProps } from './Loading';\nexport { default as Loading } from './Loading';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\nexport type { OverflowTagsProps } from './OverflowTags';\nexport { default as OverflowTags } from './OverflowTags';\n\nexport type { PulseAnimationProps } from './Animation/Pulse';\nexport { default as PulseAnimation } from './Animation/Pulse';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AAGtC,2BAAyC;AAGzC,4BAA0C;AAE1C,qBAA4C;AAG5C,2BAA8C;AAC9C,+BAA6C;AAC7C,IAAAA,wBAAyC;AASzC,yBAAuC;AAGvC,iCAA+C;AAC/C,qCAAmD;AAGnD,0BAAwC;AAExC,+BAAc,mDAhCd;AAiCA,+BAA6C;AAE7C,+BAAc,8CAnCd;AAoCA,0BAAwC;AAExC,+BAAc,+CAtCd;AAuCA,2BAAyC;AAEzC,+BAAc,8CAzCd;AA0CA,0BAAwC;AAGxC,yBAAuC;AAGvC,6BAA2C;AAG3C,qBAAmC;AAGnC,yBAA6D;AAC7D,IAAAC,sBAAuC;AAGvC,0BAAwC;AAGxC,mBAA0C;",
|
|
6
6
|
"names": ["import_ConfirmAction", "import_ModalAction"]
|
|
7
7
|
}
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as useAudioPlayer } from './useAudioPlayer';
|
|
2
2
|
export { default as useDebounce } from './useDebounce';
|
|
3
|
+
export * from './useLocalStorage';
|
|
4
|
+
export { default as useLocalStorage } from './useLocalStorage';
|
|
3
5
|
export * from './useMovable';
|
|
4
6
|
export { default as useMovable } from './useMovable';
|
|
5
7
|
export * from './useProcessingText';
|
package/lib/hooks/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var hooks_exports = {};
|
|
|
32
32
|
__export(hooks_exports, {
|
|
33
33
|
useAudioPlayer: () => import_useAudioPlayer.default,
|
|
34
34
|
useDebounce: () => import_useDebounce.default,
|
|
35
|
+
useLocalStorage: () => import_useLocalStorage.default,
|
|
35
36
|
useMovable: () => import_useMovable.default,
|
|
36
37
|
useProcessingText: () => import_useProcessingText.default,
|
|
37
38
|
useRefFunction: () => import_useRefFunction.default,
|
|
@@ -47,6 +48,8 @@ __export(hooks_exports, {
|
|
|
47
48
|
module.exports = __toCommonJS(hooks_exports);
|
|
48
49
|
var import_useAudioPlayer = __toESM(require("./useAudioPlayer"));
|
|
49
50
|
var import_useDebounce = __toESM(require("./useDebounce"));
|
|
51
|
+
__reExport(hooks_exports, require("./useLocalStorage"), module.exports);
|
|
52
|
+
var import_useLocalStorage = __toESM(require("./useLocalStorage"));
|
|
50
53
|
__reExport(hooks_exports, require("./useMovable"), module.exports);
|
|
51
54
|
var import_useMovable = __toESM(require("./useMovable"));
|
|
52
55
|
__reExport(hooks_exports, require("./useProcessingText"), module.exports);
|
|
@@ -68,6 +71,7 @@ var import_useValidatorBuilder = __toESM(require("./useValidatorBuilder"));
|
|
|
68
71
|
0 && (module.exports = {
|
|
69
72
|
useAudioPlayer,
|
|
70
73
|
useDebounce,
|
|
74
|
+
useLocalStorage,
|
|
71
75
|
useMovable,
|
|
72
76
|
useProcessingText,
|
|
73
77
|
useRefFunction,
|
|
@@ -79,6 +83,7 @@ var import_useValidatorBuilder = __toESM(require("./useValidatorBuilder"));
|
|
|
79
83
|
useValidator,
|
|
80
84
|
useValidatorBuilder,
|
|
81
85
|
useValidators,
|
|
86
|
+
...require("./useLocalStorage"),
|
|
82
87
|
...require("./useMovable"),
|
|
83
88
|
...require("./useProcessingText"),
|
|
84
89
|
...require("./useSplitter"),
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as useAudioPlayer } from './useAudioPlayer';\n\nexport { default as useDebounce } from './useDebounce';\n\nexport * from './useMovable';\nexport { default as useMovable } from './useMovable';\n\nexport * from './useProcessingText';\nexport { default as useProcessingText } from './useProcessingText';\n\nexport { default as useRefValue } from './useRefValue';\n\nexport { default as useRefFunction } from './useRefFunction';\n\nexport * from './useSplitter';\nexport { default as useSplitter } from './useSplitter';\n\nexport * from './useSSE';\nexport { default as useSSE } from './useSSE';\n\nexport * from './useStompSocket';\nexport { default as useStompSocket } from './useStompSocket';\n\nexport * from './useUserMedia';\nexport { default as useUserMedia } from './useUserMedia';\n\nexport type { ValidatorRuleMap } from './useValidators';\nexport { default as useValidators } from './useValidators';\n\nexport { default as useValidator } from './useValidator';\n\nexport type { Validator, RuleRegExpFlags, ValidatorRule, BuilderOptions } from './useValidatorBuilder';\nexport { default as useValidatorBuilder } from './useValidatorBuilder';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA0C;AAE1C,yBAAuC;AAEvC,0BAAc,
|
|
4
|
+
"sourcesContent": ["export { default as useAudioPlayer } from './useAudioPlayer';\n\nexport { default as useDebounce } from './useDebounce';\n\nexport * from './useLocalStorage';\nexport { default as useLocalStorage } from './useLocalStorage';\n\nexport * from './useMovable';\nexport { default as useMovable } from './useMovable';\n\nexport * from './useProcessingText';\nexport { default as useProcessingText } from './useProcessingText';\n\nexport { default as useRefValue } from './useRefValue';\n\nexport { default as useRefFunction } from './useRefFunction';\n\nexport * from './useSplitter';\nexport { default as useSplitter } from './useSplitter';\n\nexport * from './useSSE';\nexport { default as useSSE } from './useSSE';\n\nexport * from './useStompSocket';\nexport { default as useStompSocket } from './useStompSocket';\n\nexport * from './useUserMedia';\nexport { default as useUserMedia } from './useUserMedia';\n\nexport type { ValidatorRuleMap } from './useValidators';\nexport { default as useValidators } from './useValidators';\n\nexport { default as useValidator } from './useValidator';\n\nexport type { Validator, RuleRegExpFlags, ValidatorRule, BuilderOptions } from './useValidatorBuilder';\nexport { default as useValidatorBuilder } from './useValidatorBuilder';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA0C;AAE1C,yBAAuC;AAEvC,0BAAc,8BAJd;AAKA,6BAA2C;AAE3C,0BAAc,yBAPd;AAQA,wBAAsC;AAEtC,0BAAc,gCAVd;AAWA,+BAA6C;AAE7C,yBAAuC;AAEvC,4BAA0C;AAE1C,0BAAc,0BAjBd;AAkBA,yBAAuC;AAEvC,0BAAc,qBApBd;AAqBA,oBAAkC;AAElC,0BAAc,6BAvBd;AAwBA,4BAA0C;AAE1C,0BAAc,2BA1Bd;AA2BA,0BAAwC;AAGxC,2BAAyC;AAEzC,0BAAwC;AAGxC,iCAA+C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type SetStateAction<T> = T | ((prev: T) => T);
|
|
2
|
+
export interface UseLocalStorageOptions<T> {
|
|
3
|
+
/** When true, listen to `storage` events and keep state in sync across tabs. Defaults to true. */
|
|
4
|
+
sync?: boolean;
|
|
5
|
+
/** Custom serializer. Defaults to JSON.stringify. */
|
|
6
|
+
serialize?: (value: T) => string;
|
|
7
|
+
/** Custom deserializer. Defaults to JSON.parse. */
|
|
8
|
+
deserialize?: (raw: string) => T;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* useLocalStorage
|
|
12
|
+
*
|
|
13
|
+
* - If `key` is empty/falsy, behaves like useState and does not touch localStorage.
|
|
14
|
+
*/
|
|
15
|
+
declare function useLocalStorage<T>(key?: string | null, initialValue?: T | (() => T), options?: UseLocalStorageOptions<T>): [T, (action: SetStateAction<T>) => void, () => void];
|
|
16
|
+
export default useLocalStorage;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useLocalStorage.ts
|
|
20
|
+
var useLocalStorage_exports = {};
|
|
21
|
+
__export(useLocalStorage_exports, {
|
|
22
|
+
default: () => useLocalStorage_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useLocalStorage_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
function isBrowser() {
|
|
27
|
+
return typeof window !== "undefined" && typeof window.localStorage !== "undefined";
|
|
28
|
+
}
|
|
29
|
+
function defaultSerialize(value) {
|
|
30
|
+
return JSON.stringify(value);
|
|
31
|
+
}
|
|
32
|
+
function defaultDeserialize(raw) {
|
|
33
|
+
return JSON.parse(raw);
|
|
34
|
+
}
|
|
35
|
+
function useLocalStorage(key, initialValue, options) {
|
|
36
|
+
const storageKey = (key ?? "").trim();
|
|
37
|
+
const enabled = storageKey.length > 0;
|
|
38
|
+
const sync = (options == null ? void 0 : options.sync) ?? true;
|
|
39
|
+
const serialize = (options == null ? void 0 : options.serialize) ?? defaultSerialize;
|
|
40
|
+
const deserialize = (options == null ? void 0 : options.deserialize) ?? defaultDeserialize;
|
|
41
|
+
const initialValueRef = (0, import_react.useRef)(initialValue);
|
|
42
|
+
initialValueRef.current = initialValue;
|
|
43
|
+
const getInitial = (0, import_react.useCallback)(() => {
|
|
44
|
+
const fallback = (() => {
|
|
45
|
+
const v = initialValueRef.current;
|
|
46
|
+
return typeof v === "function" ? v() : v;
|
|
47
|
+
})();
|
|
48
|
+
if (!enabled || !isBrowser())
|
|
49
|
+
return fallback;
|
|
50
|
+
try {
|
|
51
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
52
|
+
if (raw == null)
|
|
53
|
+
return fallback;
|
|
54
|
+
return deserialize(raw);
|
|
55
|
+
} catch {
|
|
56
|
+
return fallback;
|
|
57
|
+
}
|
|
58
|
+
}, [deserialize, enabled, storageKey]);
|
|
59
|
+
const [value, setValueState] = (0, import_react.useState)(getInitial);
|
|
60
|
+
const writeStorage = (0, import_react.useCallback)(
|
|
61
|
+
(nextValue) => {
|
|
62
|
+
if (!enabled || !isBrowser())
|
|
63
|
+
return;
|
|
64
|
+
try {
|
|
65
|
+
window.localStorage.setItem(storageKey, serialize(nextValue));
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
[enabled, serialize, storageKey]
|
|
70
|
+
);
|
|
71
|
+
const setValue = (0, import_react.useCallback)(
|
|
72
|
+
(action) => {
|
|
73
|
+
setValueState((prev) => {
|
|
74
|
+
const next = typeof action === "function" ? action(prev) : action;
|
|
75
|
+
writeStorage(next);
|
|
76
|
+
return next;
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
[writeStorage]
|
|
80
|
+
);
|
|
81
|
+
const remove = (0, import_react.useCallback)(() => {
|
|
82
|
+
const next = (() => {
|
|
83
|
+
const v = initialValueRef.current;
|
|
84
|
+
return typeof v === "function" ? v() : v;
|
|
85
|
+
})();
|
|
86
|
+
setValueState(next);
|
|
87
|
+
if (!enabled || !isBrowser())
|
|
88
|
+
return;
|
|
89
|
+
try {
|
|
90
|
+
window.localStorage.removeItem(storageKey);
|
|
91
|
+
} catch {
|
|
92
|
+
}
|
|
93
|
+
}, [enabled, storageKey]);
|
|
94
|
+
(0, import_react.useEffect)(() => {
|
|
95
|
+
setValueState(getInitial());
|
|
96
|
+
}, [getInitial]);
|
|
97
|
+
(0, import_react.useEffect)(() => {
|
|
98
|
+
if (!enabled || !sync || !isBrowser())
|
|
99
|
+
return;
|
|
100
|
+
const onStorage = (e) => {
|
|
101
|
+
if (e.storageArea !== window.localStorage)
|
|
102
|
+
return;
|
|
103
|
+
if (e.key !== storageKey)
|
|
104
|
+
return;
|
|
105
|
+
if (e.newValue == null) {
|
|
106
|
+
setValueState(getInitial());
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
setValueState(deserialize(e.newValue));
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
window.addEventListener("storage", onStorage);
|
|
115
|
+
return () => window.removeEventListener("storage", onStorage);
|
|
116
|
+
}, [deserialize, enabled, getInitial, storageKey, sync]);
|
|
117
|
+
return (0, import_react.useMemo)(() => [value, setValue, remove], [remove, setValue, value]);
|
|
118
|
+
}
|
|
119
|
+
var useLocalStorage_default = useLocalStorage;
|
|
120
|
+
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/useLocalStorage.ts"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\ntype SetStateAction<T> = T | ((prev: T) => T);\n\nexport interface UseLocalStorageOptions<T> {\n /** When true, listen to `storage` events and keep state in sync across tabs. Defaults to true. */\n sync?: boolean;\n /** Custom serializer. Defaults to JSON.stringify. */\n serialize?: (value: T) => string;\n /** Custom deserializer. Defaults to JSON.parse. */\n deserialize?: (raw: string) => T;\n}\n\nfunction isBrowser() {\n return typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';\n}\n\nfunction defaultSerialize<T>(value: T) {\n return JSON.stringify(value);\n}\n\nfunction defaultDeserialize<T>(raw: string) {\n return JSON.parse(raw) as T;\n}\n\n/**\n * useLocalStorage\n *\n * - If `key` is empty/falsy, behaves like useState and does not touch localStorage.\n */\nfunction useLocalStorage<T>(\n key?: string | null,\n initialValue?: T | (() => T),\n options?: UseLocalStorageOptions<T>\n): [T, (action: SetStateAction<T>) => void, () => void] {\n const storageKey = (key ?? '').trim();\n const enabled = storageKey.length > 0;\n const sync = options?.sync ?? true;\n const serialize = options?.serialize ?? defaultSerialize;\n const deserialize = options?.deserialize ?? defaultDeserialize;\n\n const initialValueRef = useRef(initialValue);\n initialValueRef.current = initialValue;\n\n const getInitial = useCallback((): T => {\n const fallback = (() => {\n const v = initialValueRef.current;\n return (typeof v === 'function' ? (v as () => T)() : (v as T)) as T;\n })();\n\n if (!enabled || !isBrowser()) return fallback;\n\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (raw == null) return fallback;\n return deserialize(raw);\n } catch {\n return fallback;\n }\n }, [deserialize, enabled, storageKey]);\n\n const [value, setValueState] = useState<T>(getInitial);\n\n const writeStorage = useCallback(\n (nextValue: T) => {\n if (!enabled || !isBrowser()) return;\n try {\n window.localStorage.setItem(storageKey, serialize(nextValue));\n } catch {\n // ignore write errors (e.g., quota exceeded, blocked storage)\n }\n },\n [enabled, serialize, storageKey]\n );\n\n const setValue = useCallback(\n (action: SetStateAction<T>) => {\n setValueState((prev) => {\n const next = typeof action === 'function' ? (action as (p: T) => T)(prev) : action;\n writeStorage(next);\n return next;\n });\n },\n [writeStorage]\n );\n\n const remove = useCallback(() => {\n // If key is empty/falsy, just reset to initial value.\n const next = (() => {\n const v = initialValueRef.current;\n return (typeof v === 'function' ? (v as () => T)() : (v as T)) as T;\n })();\n\n setValueState(next);\n\n if (!enabled || !isBrowser()) return;\n try {\n window.localStorage.removeItem(storageKey);\n } catch {\n // ignore\n }\n }, [enabled, storageKey]);\n\n // Keep state updated if key changes.\n useEffect(() => {\n setValueState(getInitial());\n }, [getInitial]);\n\n // Cross-tab sync.\n useEffect(() => {\n if (!enabled || !sync || !isBrowser()) return;\n\n const onStorage = (e: StorageEvent) => {\n if (e.storageArea !== window.localStorage) return;\n if (e.key !== storageKey) return;\n\n // When removed, fall back to initial.\n if (e.newValue == null) {\n setValueState(getInitial());\n return;\n }\n\n try {\n setValueState(deserialize(e.newValue));\n } catch {\n // ignore parse errors\n }\n };\n\n window.addEventListener('storage', onStorage);\n return () => window.removeEventListener('storage', onStorage);\n }, [deserialize, enabled, getInitial, storageKey, sync]);\n\n // Stable tuple identity.\n return useMemo(() => [value, setValue, remove] as const, [remove, setValue, value]);\n}\n\nexport default useLocalStorage;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkE;AAalE,SAAS,YAAY;AACnB,SAAO,OAAO,WAAW,eAAe,OAAO,OAAO,iBAAiB;AACzE;AAEA,SAAS,iBAAoB,OAAU;AACrC,SAAO,KAAK,UAAU,KAAK;AAC7B;AAEA,SAAS,mBAAsB,KAAa;AAC1C,SAAO,KAAK,MAAM,GAAG;AACvB;AAOA,SAAS,gBACP,KACA,cACA,SACsD;AACtD,QAAM,cAAc,OAAO,IAAI,KAAK;AACpC,QAAM,UAAU,WAAW,SAAS;AACpC,QAAM,QAAO,mCAAS,SAAQ;AAC9B,QAAM,aAAY,mCAAS,cAAa;AACxC,QAAM,eAAc,mCAAS,gBAAe;AAE5C,QAAM,sBAAkB,qBAAO,YAAY;AAC3C,kBAAgB,UAAU;AAE1B,QAAM,iBAAa,0BAAY,MAAS;AACtC,UAAM,YAAY,MAAM;AACtB,YAAM,IAAI,gBAAgB;AAC1B,aA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I,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU;AAAG;AAEvC,UAAM,YAAY,CAAC,MAAoB;AACrC,UAAI,EAAE,gBAAgB,OAAO;AAAc;AAC3C,UAAI,EAAE,QAAQ;AAAY;AAG1B,UAAI,EAAE,YAAY,MAAM;AACtB,sBAAc,WAAW,CAAC;AAC1B;AAAA,MACF;AAEA,UAAI;AACF,sBAAc,YAAY,EAAE,QAAQ,CAAC;AAAA,MACvC,QAAE;AAAA,MAEF;AAAA,IACF;AAEA,WAAO,iBAAiB,WAAW,SAAS;AAC5C,WAAO,MAAM,OAAO,oBAAoB,WAAW,SAAS;AAAA,EAC9D,GAAG,CAAC,aAAa,SAAS,YAAY,YAAY,IAAI,CAAC;AAGvD,aAAO,sBAAQ,MAAM,CAAC,OAAO,UAAU,MAAM,GAAY,CAAC,QAAQ,UAAU,KAAK,CAAC;AACpF;AAEA,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/hooks/useMovable.js
CHANGED
|
@@ -33,13 +33,13 @@ __export(useMovable_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(useMovable_exports);
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
var
|
|
36
|
+
var import_useLocalStorage = __toESM(require("./useLocalStorage"));
|
|
37
37
|
var import_useRefFunction = __toESM(require("./useRefFunction"));
|
|
38
38
|
var import_useRefValue = __toESM(require("./useRefValue"));
|
|
39
39
|
var useMovable = (props) => {
|
|
40
40
|
const { enabled, containerRef, ignoreSelectors, storageKey } = props;
|
|
41
41
|
const storageKeyRef = (0, import_useRefValue.default)(storageKey);
|
|
42
|
-
const [savedPosition, savePosition] = (0,
|
|
42
|
+
const [savedPosition, savePosition] = (0, import_useLocalStorage.default)(storageKey ?? "");
|
|
43
43
|
const savePositionRef = (0, import_useRefValue.default)(savePosition);
|
|
44
44
|
const [position, setPosition] = (0, import_react.useState)(savedPosition ?? void 0);
|
|
45
45
|
const positionRef = (0, import_useRefValue.default)(position);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/useMovable.ts"],
|
|
4
|
-
"sourcesContent": ["import { type RefObject, useEffect, useRef, useState } from 'react';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4D;AAC5D,
|
|
6
|
-
"names": ["useRefValue", "useRefFunction"]
|
|
4
|
+
"sourcesContent": ["import { type RefObject, useEffect, useRef, useState } from 'react';\nimport useLocalStorage from './useLocalStorage';\nimport useRefFunction from './useRefFunction';\nimport useRefValue from './useRefValue';\n\nexport interface UseMovableProps {\n /**\n * - **EN:** Whether dragging is enabled, default is `true`\n * - **CN:** 是否启用拖动,默认`true`\n */\n enabled?: boolean;\n /**\n * - **EN:** The ref of the container element\n * - **CN:** 容器元素的ref\n */\n containerRef: RefObject<HTMLElement>;\n /**\n * - **EN:** Selectors of elements that should not trigger dragging, e.g., interactive controls\n * - **CN:** 不应触发拖动的元素的选择器,例如交互控件\n */\n ignoreSelectors?: string[];\n /**\n * - **EN:** Key for storing position in localStorage; if not provided, position won't be saved\n * - **CN:** 用于在 localStorage 中存储位置的键;如果未提供,则不会保存位置\n */\n storageKey?: string;\n}\n\n/**\n * - **EN:** Hook to make an element movable by dragging, with position persistence using localStorage\n * - **CN:** 通过拖动使元素可移动的钩子,并使用 localStorage 持久化位置\n */\nconst useMovable = (props: UseMovableProps) => {\n const { enabled, containerRef, ignoreSelectors, storageKey } = props;\n\n const storageKeyRef = useRefValue(storageKey);\n const [savedPosition, savePosition] = useLocalStorage<MovePosition>(storageKey ?? '');\n const savePositionRef = useRefValue(savePosition);\n const [position, setPosition] = useState<MovePosition | undefined>(savedPosition ?? undefined);\n const positionRef = useRefValue(position);\n const draggingRef = useRef(false);\n const dragOffsetRef = useRef({ x: 0, y: 0 });\n const sizeRef = useRef({ w: 0, h: 0 });\n\n // Drag start (exclude interactive controls)\n const handlePointerDown = useRefFunction((e: React.PointerEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement;\n // Set the selector for elements that do not trigger dragging\n if (ignoreSelectors && target.closest(ignoreSelectors.join(','))) return;\n\n if (!containerRef.current) return;\n const rect = containerRef.current.getBoundingClientRect();\n sizeRef.current = { w: rect.width, h: rect.height };\n const currentLeft = position?.left ?? rect.left;\n const currentTop = position?.top ?? rect.top;\n\n dragOffsetRef.current = { x: e.clientX - currentLeft, y: e.clientY - currentTop };\n draggingRef.current = true;\n try {\n containerRef.current.setPointerCapture?.(e.pointerId);\n } catch {\n // do nothing\n }\n e.preventDefault();\n });\n\n // Automatically adjust the position during window resize to prevent it from exceeding the visible area.\n useEffect(() => {\n const clampToViewport = () => {\n const pos = positionRef.current;\n if (!pos) return;\n\n // Refresh the container size before each convergence to ensure accurate boundaries.\n const rect = containerRef.current?.getBoundingClientRect();\n if (rect) {\n sizeRef.current = { w: rect.width, h: rect.height };\n }\n\n const maxLeft = Math.max(0, window.innerWidth - sizeRef.current.w);\n const maxTop = Math.max(0, window.innerHeight - sizeRef.current.h);\n const clampedLeft = Math.min(Math.max(0, pos.left), maxLeft);\n const clampedTop = Math.min(Math.max(0, pos.top), maxTop);\n\n if (clampedLeft !== pos.left || clampedTop !== pos.top) {\n const next = { left: clampedLeft, top: clampedTop };\n setPosition(next);\n if (storageKeyRef.current) {\n savePositionRef.current(next);\n }\n }\n };\n\n window.addEventListener('resize', clampToViewport);\n // Calibrate immediately after the first mount/position change.\n clampToViewport();\n\n return () => {\n window.removeEventListener('resize', clampToViewport);\n };\n }, [containerRef]);\n\n // Update position during dragging; restrict within the visible area.\n useEffect(() => {\n const onMove = (e: PointerEvent) => {\n if (!draggingRef.current) return;\n const newLeft = e.clientX - dragOffsetRef.current.x;\n const newTop = e.clientY - dragOffsetRef.current.y;\n const maxLeft = Math.max(0, window.innerWidth - sizeRef.current.w);\n const maxTop = Math.max(0, window.innerHeight - sizeRef.current.h);\n const clampedLeft = Math.min(Math.max(0, newLeft), maxLeft);\n const clampedTop = Math.min(Math.max(0, newTop), maxTop);\n const pos = { left: clampedLeft, top: clampedTop };\n setPosition(pos);\n if (storageKeyRef.current) {\n savePositionRef.current(pos);\n }\n };\n const onUp = () => {\n if (draggingRef.current) draggingRef.current = false;\n };\n if (enabled) {\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n }\n return () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n };\n }, [enabled]);\n\n return {\n onPointerDown: handlePointerDown,\n position,\n };\n};\n\nexport interface MovePosition {\n left: number;\n top: number;\n}\n\nexport default useMovable;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4D;AAC5D,6BAA4B;AAC5B,4BAA2B;AAC3B,yBAAwB;AA6BxB,IAAM,aAAa,CAAC,UAA2B;AAC7C,QAAM,EAAE,SAAS,cAAc,iBAAiB,WAAW,IAAI;AAE/D,QAAM,oBAAgB,mBAAAA,SAAY,UAAU;AAC5C,QAAM,CAAC,eAAe,YAAY,QAAI,uBAAAC,SAA8B,cAAc,EAAE;AACpF,QAAM,sBAAkB,mBAAAD,SAAY,YAAY;AAChD,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAmC,iBAAiB,MAAS;AAC7F,QAAM,kBAAc,mBAAAA,SAAY,QAAQ;AACxC,QAAM,kBAAc,qBAAO,KAAK;AAChC,QAAM,oBAAgB,qBAAO,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;AAC3C,QAAM,cAAU,qBAAO,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;AAGrC,QAAM,wBAAoB,sBAAAE,SAAe,CAAC,MAA0C;AA7CtF;AA8CI,UAAM,SAAS,EAAE;AAEjB,QAAI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/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/locales/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { createInstance, type i18n } from 'i18next';\nimport enUS from './langs/en-US';\nimport zhCN from './langs/zh-CN';\n\nexport const langs = ['en', 'en-US', 'zh-CN'] as const;\n\nexport type Langs = (typeof langs)[number];\n\nexport const resources = {\n en: { translation: enUS },\n 'en-US': { translation: enUS },\n 'zh-CN': { translation: zhCN },\n} as const;\n\nconst reactEasyI18n: i18n = createInstance({});\n\nreactEasyI18n.init({\n lng: 'en',\n resources,\n});\n\nexport const t: i18n['t'] = ((...args) => {\n return reactEasyI18n.t(...args);\n}) as i18n['t'];\n\nexport default reactEasyI18n;\n"],
|
|
4
|
+
"sourcesContent": ["import { createInstance, type i18n } from 'i18next';\nimport enUS from './langs/en-US';\nimport zhCN from './langs/zh-CN';\n\nexport const langs = ['en', 'en-US', 'zh-CN'] as const;\n\nexport type Langs = (typeof langs)[number];\n\nexport const resources = {\n en: { translation: enUS },\n 'en-US': { translation: enUS },\n 'zh-CN': { translation: zhCN },\n} as const;\n\nconst reactEasyI18n: i18n = createInstance({});\n\nreactEasyI18n.init({\n lng: 'en-US',\n resources,\n});\n\nexport const t: i18n['t'] = ((...args) => {\n return reactEasyI18n.t(...args);\n}) as i18n['t'];\n\nexport default reactEasyI18n;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA0C;AAC1C,mBAAiB;AACjB,mBAAiB;AAEV,IAAM,QAAQ,CAAC,MAAM,SAAS,OAAO;AAIrC,IAAM,YAAY;AAAA,EACvB,IAAI,EAAE,aAAa,aAAAA,QAAK;AAAA,EACxB,SAAS,EAAE,aAAa,aAAAA,QAAK;AAAA,EAC7B,SAAS,EAAE,aAAa,aAAAC,QAAK;AAC/B;AAEA,IAAM,oBAAsB,+BAAe,CAAC,CAAC;AAE7C,cAAc,KAAK;AAAA,EACjB,KAAK;AAAA,EACL;AACF,CAAC;AAEM,IAAM,IAAgB,IAAI,SAAS;AACxC,SAAO,cAAc,EAAE,GAAG,IAAI;AAChC;AAEA,IAAO,kBAAQ;",
|
|
6
6
|
"names": ["enUS", "zhCN"]
|
|
7
7
|
}
|
package/lib/utils/math.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **EN**: Generate a random number
|
|
2
|
+
* **EN**: Generate a random decimal number between 0 and 1
|
|
3
3
|
*
|
|
4
|
-
* **CN**:
|
|
4
|
+
* **CN**: 生成一个0~1之间的小数
|
|
5
|
+
*
|
|
6
|
+
* @returns The generated random number | 生成的随机数
|
|
7
|
+
*/
|
|
8
|
+
export declare function random(): number;
|
|
9
|
+
/**
|
|
10
|
+
* **EN**: Generate a random integer within a specified range (inclusive on both ends)
|
|
11
|
+
*
|
|
12
|
+
* **CN**: 生成指定范围(两端包含)内的随机整数
|
|
5
13
|
*
|
|
6
14
|
* @param min The minimum value (inclusive) | 最小值(包含)
|
|
7
15
|
* @param max The maximum value (inclusive) | 最大值(包含)
|
|
8
16
|
*
|
|
9
|
-
* @returns The generated random
|
|
17
|
+
* @returns The generated random integer | 生成的随机整数
|
|
10
18
|
*/
|
|
11
19
|
export declare function random(min: number, max: number): number;
|
package/lib/utils/math.js
CHANGED
|
@@ -24,26 +24,33 @@ __export(math_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(math_exports);
|
|
25
25
|
function random(min, max) {
|
|
26
26
|
var _a;
|
|
27
|
+
if (min == null && max == null) {
|
|
28
|
+
return randomLikeMath();
|
|
29
|
+
}
|
|
30
|
+
if (min == null || max == null) {
|
|
31
|
+
throw new TypeError("Both min and max must be provided");
|
|
32
|
+
}
|
|
27
33
|
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
|
28
34
|
throw new TypeError("min and max must be finite numbers");
|
|
29
35
|
}
|
|
30
36
|
if (Math.floor(min) !== min || Math.floor(max) !== max) {
|
|
31
37
|
throw new TypeError("min and max must be integers");
|
|
32
38
|
}
|
|
39
|
+
const globalThat2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
33
40
|
if (min > max) {
|
|
34
41
|
[min, max] = [max, min];
|
|
35
42
|
}
|
|
36
|
-
let
|
|
43
|
+
let nodeCrypto2;
|
|
37
44
|
if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
|
|
38
45
|
try {
|
|
39
|
-
|
|
40
|
-
} catch {
|
|
46
|
+
nodeCrypto2 = require("crypto");
|
|
47
|
+
} catch (error) {
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
50
|
+
if (nodeCrypto2 == null ? void 0 : nodeCrypto2.randomInt) {
|
|
51
|
+
return nodeCrypto2.randomInt(min, max + 1);
|
|
45
52
|
}
|
|
46
|
-
const webCrypto =
|
|
53
|
+
const webCrypto = globalThat2.crypto || (nodeCrypto2 == null ? void 0 : nodeCrypto2.webcrypto);
|
|
47
54
|
if (webCrypto == null ? void 0 : webCrypto.getRandomValues) {
|
|
48
55
|
const range = max - min + 1;
|
|
49
56
|
if (range <= 0)
|
|
@@ -58,8 +65,36 @@ function random(min, max) {
|
|
|
58
65
|
} while (v >= limit);
|
|
59
66
|
return min + v % range;
|
|
60
67
|
}
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
return randomLikeMath();
|
|
69
|
+
}
|
|
70
|
+
function randomLikeMath() {
|
|
71
|
+
var _a;
|
|
72
|
+
const globalThat = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
73
|
+
const cryptoObj = globalThat.crypto;
|
|
74
|
+
if (cryptoObj == null ? void 0 : cryptoObj.getRandomValues) {
|
|
75
|
+
const buf = new Uint32Array(2);
|
|
76
|
+
cryptoObj.getRandomValues(buf);
|
|
77
|
+
const high = buf[0] >>> 5;
|
|
78
|
+
const low = buf[1] >>> 6;
|
|
79
|
+
return (high * 67108864 + low) / 9007199254740992;
|
|
80
|
+
}
|
|
81
|
+
const req = typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node) && typeof globalThat.require === "function" ? globalThat.require : (() => {
|
|
82
|
+
try {
|
|
83
|
+
return eval("require");
|
|
84
|
+
} catch (error) {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
})();
|
|
88
|
+
if (!req) {
|
|
89
|
+
throw new Error("No secure random source available in this environment");
|
|
90
|
+
}
|
|
91
|
+
const nodeCrypto = req("crypto");
|
|
92
|
+
if (typeof nodeCrypto.randomBytes !== "function") {
|
|
93
|
+
throw new Error("No secure random source available in this environment");
|
|
94
|
+
}
|
|
95
|
+
const b = nodeCrypto.randomBytes(7);
|
|
96
|
+
const x = (b[0] & 31) * 2 ** 48 + b[1] * 2 ** 40 + b[2] * 2 ** 32 + b[3] * 2 ** 24 + b[4] * 2 ** 16 + b[5] * 2 ** 8 + b[6];
|
|
97
|
+
return x / 9007199254740992;
|
|
63
98
|
}
|
|
64
99
|
// Annotate the CommonJS export names for ESM import in node:
|
|
65
100
|
0 && (module.exports = {
|
package/lib/utils/math.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/math.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * **EN**: Generate a random number within a specified range (inclusive on both ends)\n *\n * **CN**:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/**\n * **EN**: Generate a random decimal number between 0 and 1\n *\n * **CN**: 生成一个0~1之间的小数\n *\n * @returns The generated random number | 生成的随机数\n */\nexport function random(): number;\n/**\n * **EN**: Generate a random integer within a specified range (inclusive on both ends)\n *\n * **CN**: 生成指定范围(两端包含)内的随机整数\n *\n * @param min The minimum value (inclusive) | 最小值(包含)\n * @param max The maximum value (inclusive) | 最大值(包含)\n *\n * @returns The generated random integer | 生成的随机整数\n */\nexport function random(min: number, max: number): number;\nexport function random(min?: number, max?: number): number {\n if (min == null && max == null) {\n return randomLikeMath();\n }\n if (min == null || max == null) {\n throw new TypeError('Both min and max must be provided');\n }\n if (!Number.isFinite(min) || !Number.isFinite(max)) {\n throw new TypeError('min and max must be finite numbers');\n }\n if (Math.floor(min) !== min || Math.floor(max) !== max) {\n throw new TypeError('min and max must be integers');\n }\n const globalThat =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : ({} as typeof globalThis);\n if (min > max) {\n [min, max] = [max, min];\n }\n\n // Try to require Node.js crypto\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let nodeCrypto: any;\n if (typeof process !== 'undefined' && process.versions?.node) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n nodeCrypto = require('crypto');\n } catch (error) {\n // ignore\n }\n }\n\n // 1. Node.js crypto.randomInt\n if (nodeCrypto?.randomInt) {\n return nodeCrypto.randomInt(min, max + 1);\n }\n\n // 2. Web Crypto (Browsers or Node 19+ webcrypto)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const webCrypto: Crypto | undefined = globalThat.crypto || nodeCrypto?.webcrypto;\n\n if (webCrypto?.getRandomValues) {\n const range = max - min + 1;\n if (range <= 0) return min;\n\n // Use rejection sampling to avoid the slight bias caused by (2^32 % range).\n const maxUint32 = 0xffffffff;\n const limit = Math.floor((maxUint32 + 1) / range) * range;\n const arr = new Uint32Array(1);\n let v: number;\n do {\n webCrypto.getRandomValues(arr);\n v = arr[0];\n } while (v >= limit);\n return min + (v % range);\n }\n\n // 3. Fallback\n return randomLikeMath();\n}\n\nfunction randomLikeMath(): number {\n const globalThat =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : ({} as typeof globalThis);\n // Browser / Node(with webcrypto)\n const cryptoObj = globalThat.crypto;\n if (cryptoObj?.getRandomValues) {\n const buf = new Uint32Array(2);\n cryptoObj.getRandomValues(buf);\n\n // 53-bit precision, mapped to [0, 1)\n const high = buf[0] >>> 5; // 27 bits\n const low = buf[1] >>> 6; // 26 bits\n return (high * 67108864 + low) / 9007199254740992; // 2^53\n }\n\n // Old Node fallback (No webcrypto)\n // Use eval('require') to avoid \"require is not defined\" error during browser bundling\n const req: NodeRequire | undefined =\n typeof process !== 'undefined' &&\n process.versions?.node &&\n typeof (globalThat as unknown as { require?: unknown }).require === 'function'\n ? (globalThat as unknown as { require: NodeRequire }).require\n : (() => {\n try {\n // eslint-disable-next-line no-eval\n return eval('require') as NodeRequire;\n } catch (error) {\n return undefined;\n }\n })();\n\n if (!req) {\n throw new Error('No secure random source available in this environment');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const nodeCrypto = req('crypto') as { randomBytes?: (size: number) => Uint8Array };\n if (typeof nodeCrypto.randomBytes !== 'function') {\n throw new Error('No secure random source available in this environment');\n }\n\n const b = nodeCrypto.randomBytes(7); // 56 bits\n const x =\n (b[0] & 0x1f) * 2 ** 48 + b[1] * 2 ** 40 + b[2] * 2 ** 32 + b[3] * 2 ** 24 + b[4] * 2 ** 16 + b[5] * 2 ** 8 + b[6];\n\n return x / 9007199254740992; // 2^53 => [0,1)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,OAAO,KAAc,KAAsB;AAnB3D;AAoBE,MAAI,OAAO,QAAQ,OAAO,MAAM;AAC9B,WAAO,eAAe;AAAA,EACxB;AACA,MAAI,OAAO,QAAQ,OAAO,MAAM;AAC9B,UAAM,IAAI,UAAU,mCAAmC;AAAA,EACzD;A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;AAC7B,MAAI,uCAAW,iBAAiB;AAC9B,UAAM,MAAM,IAAI,YAAY,CAAC;AAC7B,cAAU,gBAAgB,GAAG;AAG7B,UAAM,OAAO,IAAI,CAAC,MAAM;AACxB,UAAM,MAAM,IAAI,CAAC,MAAM;AACvB,YAAQ,OAAO,WAAW,OAAO;AAAA,EACnC;AAIA,QAAM,MACJ,OAAO,YAAY,iBACnB,aAAQ,aAAR,mBAAkB,SAClB,OAAQ,WAAgD,YAAY,aAC/D,WAAmD,WACnD,MAAM;AACL,QAAI;AAEF,aAAO,KAAK,SAAS;AAAA,IACvB,SAAS,OAAP;AACA,aAAO;AAAA,IACT;AAAA,EACF,GAAG;AAET,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,QAAM,aAAa,IAAI,QAAQ;AAC/B,MAAI,OAAO,WAAW,gBAAgB,YAAY;AAChD,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAEA,QAAM,IAAI,WAAW,YAAY,CAAC;AAClC,QAAM,KACH,EAAE,CAAC,IAAI,MAAQ,KAAK,KAAK,EAAE,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;AAEnH,SAAO,IAAI;AACb;",
|
|
6
|
+
"names": ["globalThat", "nodeCrypto"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiny-codes/react-easy",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "Simplify React and AntDesign development with practical components and hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "run-s build-core correct-sourcemap",
|
|
35
35
|
"build-core": "father build",
|
|
36
|
+
"build-storybook": "storybook build",
|
|
36
37
|
"correct-sourcemap": "tsx scripts/correct-sourcemap.ts",
|
|
37
38
|
"prepare": "husky",
|
|
38
|
-
"prepublishOnly": "npm run build"
|
|
39
|
+
"prepublishOnly": "npm run build",
|
|
40
|
+
"storybook": "storybook dev -p 6006"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
43
|
"@lexical/react": "^0.33.1",
|
|
@@ -44,12 +46,14 @@
|
|
|
44
46
|
"crypto-js": "^4.2.0",
|
|
45
47
|
"lexical": "^0.33.1",
|
|
46
48
|
"react-contexify": "^6.0.0",
|
|
47
|
-
"react-use": "^17.6.0",
|
|
48
49
|
"sockjs-client": "^1.6.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
52
|
+
"@storybook/addon-docs": "^10.2.12",
|
|
53
|
+
"@storybook/addon-links": "^10.2.12",
|
|
54
|
+
"@storybook/react-vite": "^10.2.12",
|
|
51
55
|
"@tiny-codes/code-style-all-in-one": "^1.1.5",
|
|
52
|
-
"@tiny-codes/eslint-plugin-react-hooks": "^
|
|
56
|
+
"@tiny-codes/eslint-plugin-react-hooks": "^5.2.0",
|
|
53
57
|
"@types/crypto-js": "^4.2.2",
|
|
54
58
|
"@types/jest": "^29.5.14",
|
|
55
59
|
"@types/node": "^22.15.32",
|
|
@@ -57,16 +61,19 @@
|
|
|
57
61
|
"@types/react-dom": "^19.0.4",
|
|
58
62
|
"@types/react-is": "^19.0.0",
|
|
59
63
|
"@types/sockjs-client": "^1.5.4",
|
|
60
|
-
"antd": "^5.
|
|
64
|
+
"antd": "^5.29.3",
|
|
65
|
+
"eslint-plugin-storybook": "10.2.13",
|
|
61
66
|
"father": "^4.5.2",
|
|
62
67
|
"jest": "^29.7.0",
|
|
63
|
-
"npm-run-all2": "^
|
|
68
|
+
"npm-run-all2": "^8.0.4",
|
|
64
69
|
"react": "^19.0.0",
|
|
65
70
|
"react-dom": "^19.0.0",
|
|
66
71
|
"react-is": "^19.0.0",
|
|
72
|
+
"storybook": "^10.2.12",
|
|
67
73
|
"ts-jest": "^29.3.0",
|
|
68
74
|
"tsx": "^4.20.5",
|
|
69
|
-
"typescript": "^5.8.2"
|
|
75
|
+
"typescript": "^5.8.2",
|
|
76
|
+
"vite": "^7.3.1"
|
|
70
77
|
},
|
|
71
78
|
"peerDependencies": {
|
|
72
79
|
"antd": ">=5.1.0",
|