@tiny-codes/react-easy 1.7.5 → 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.
Files changed (76) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/es/components/Animation/Pulse/index.d.ts +18 -2
  3. package/es/components/Animation/Pulse/index.js +1 -1
  4. package/es/components/Animation/Pulse/index.js.map +1 -1
  5. package/es/components/BreakLines/index.d.ts +7 -7
  6. package/es/components/BreakLines/index.js.map +1 -1
  7. package/es/components/ColumnSetting/index.d.ts +7 -2
  8. package/es/components/ColumnSetting/index.js +27 -16
  9. package/es/components/ColumnSetting/index.js.map +1 -1
  10. package/es/components/ConfigProvider/context.d.ts +2 -0
  11. package/es/components/ConfigProvider/context.js +1 -1
  12. package/es/components/ConfigProvider/context.js.map +1 -1
  13. package/es/components/ConfigProvider/index.d.ts +17 -1
  14. package/es/components/ConfigProvider/index.js +15 -8
  15. package/es/components/ConfigProvider/index.js.map +1 -1
  16. package/es/components/ContextMenu/index.d.ts +16 -0
  17. package/es/components/ContextMenu/index.js.map +1 -1
  18. package/es/components/EditableText/form.d.ts +4 -0
  19. package/es/components/EditableText/form.js.map +1 -1
  20. package/es/components/EditableText/index.d.ts +6 -2
  21. package/es/components/EditableText/index.js.map +1 -1
  22. package/es/components/FloatDrawer/index.d.ts +10 -0
  23. package/es/components/FloatDrawer/index.js.map +1 -1
  24. package/es/components/OverflowTags/index.d.ts +2 -0
  25. package/es/components/OverflowTags/index.js.map +1 -1
  26. package/es/hooks/index.d.ts +2 -0
  27. package/es/hooks/index.js +2 -0
  28. package/es/hooks/index.js.map +1 -1
  29. package/es/hooks/useLocalStorage.d.ts +16 -0
  30. package/es/hooks/useLocalStorage.js +115 -0
  31. package/es/hooks/useLocalStorage.js.map +1 -0
  32. package/es/hooks/useMovable.js +2 -2
  33. package/es/hooks/useMovable.js.map +1 -1
  34. package/es/locales/index.js +1 -1
  35. package/es/locales/index.js.map +1 -1
  36. package/es/utils/math.d.ts +11 -3
  37. package/es/utils/math.js +62 -9
  38. package/es/utils/math.js.map +1 -1
  39. package/lib/components/Animation/Pulse/index.d.ts +18 -2
  40. package/lib/components/Animation/Pulse/index.js +0 -5
  41. package/lib/components/Animation/Pulse/index.js.map +2 -2
  42. package/lib/components/BreakLines/index.d.ts +7 -7
  43. package/lib/components/BreakLines/index.js.map +1 -1
  44. package/lib/components/ColumnSetting/index.d.ts +7 -2
  45. package/lib/components/ColumnSetting/index.js +18 -14
  46. package/lib/components/ColumnSetting/index.js.map +3 -3
  47. package/lib/components/ConfigProvider/context.d.ts +2 -0
  48. package/lib/components/ConfigProvider/context.js +1 -1
  49. package/lib/components/ConfigProvider/context.js.map +2 -2
  50. package/lib/components/ConfigProvider/index.d.ts +17 -1
  51. package/lib/components/ConfigProvider/index.js +13 -6
  52. package/lib/components/ConfigProvider/index.js.map +2 -2
  53. package/lib/components/ContextMenu/index.d.ts +16 -0
  54. package/lib/components/ContextMenu/index.js.map +2 -2
  55. package/lib/components/EditableText/form.d.ts +4 -0
  56. package/lib/components/EditableText/form.js.map +2 -2
  57. package/lib/components/EditableText/index.d.ts +6 -2
  58. package/lib/components/EditableText/index.js.map +2 -2
  59. package/lib/components/FloatDrawer/index.d.ts +10 -0
  60. package/lib/components/FloatDrawer/index.js.map +2 -2
  61. package/lib/components/OverflowTags/index.d.ts +2 -0
  62. package/lib/components/OverflowTags/index.js.map +2 -2
  63. package/lib/hooks/index.d.ts +2 -0
  64. package/lib/hooks/index.js +5 -0
  65. package/lib/hooks/index.js.map +2 -2
  66. package/lib/hooks/useLocalStorage.d.ts +16 -0
  67. package/lib/hooks/useLocalStorage.js +120 -0
  68. package/lib/hooks/useLocalStorage.js.map +7 -0
  69. package/lib/hooks/useMovable.js +2 -2
  70. package/lib/hooks/useMovable.js.map +3 -3
  71. package/lib/locales/index.js +1 -1
  72. package/lib/locales/index.js.map +1 -1
  73. package/lib/utils/math.d.ts +11 -3
  74. package/lib/utils/math.js +43 -8
  75. package/lib/utils/math.js.map +3 -3
  76. package/package.json +14 -7
@@ -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 import_react_use = require("react-use");
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, import_react_use.useLocalStorage)(storageKey ?? "");
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 { useLocalStorage } from 'react-use';\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 // 调整:在窗口 resize 时自动收敛位置,防止超出可视区域\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,uBAAgC;AAChC,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,kCAA8B,cAAc,EAAE;AACpF,QAAM,sBAAkB,mBAAAA,SAAY,YAAY;AAChD,QAAM,CAAC,UAA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WAAO,MAAM;AACX,aAAO,oBAAoB,eAAe,MAAM;AAChD,aAAO,oBAAoB,aAAa,IAAI;AAC5C,aAAO,oBAAoB,iBAAiB,IAAI;AAAA,IAClD;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,EACF;AACF;AAOA,IAAO,qBAAQ;",
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,mBAAmB,OAAO,QAAQ,gBAAgB,KAAK,GAAG,CAAC;AAAG;AAElE,QAAI,CAAC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tD;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AAGjB,8BAAU,MAAM;AACd,UAAM,SAAS,CAAC,MAAoB;AAClC,UAAI,CAAC,YAAY;AAAS;AAC1B,YAAM,UAAU,EAAE,UAAU,cAAc,QAAQ;AAClD,YAAM,SAAS,EAAE,UAAU,cAAc,QAAQ;AACjD,YAAM,UAAU,KAAK,IAAI,GAAG,OAAO,aAAa,QAAQ,QAAQ,CAAC;AACjE,YAAM,SAAS,KAAK,IAAI,GAAG,OAAO,cAAc,QAAQ,QAAQ,CAAC;AACjE,YAAM,cAAc,KAAK,IAAI,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO;AAC1D,YAAM,aAAa,KAAK,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM;AACvD,YAAM,MAAM,EAAE,MAAM,aAAa,KAAK,WAAW;AACjD,kBAAY,GAAG;AACf,UAAI,cAAc,SAAS;AACzB,wBAAgB,QAAQ,GAAG;AAAA,MAC7B;AAAA,IACF;AACA,UAAM,OAAO,MAAM;AACjB,UAAI,YAAY;AAAS,oBAAY,UAAU;AAAA,IACjD;AACA,QAAI,SAAS;AACX,aAAO,iBAAiB,eAAe,MAAM;AAC7C,aAAO,iBAAiB,aAAa,IAAI;AACzC,aAAO,iBAAiB,iBAAiB,IAAI;AAAA,IAC/C;AACA,WAAO,MAAM;AACX,aAAO,oBAAoB,eAAe,MAAM;AAChD,aAAO,oBAAoB,aAAa,IAAI;AAC5C,aAAO,oBAAoB,iBAAiB,IAAI;AAAA,IAClD;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO;AAAA,IACL,eAAe;AAAA,IACf;AAAA,EACF;AACF;AAOA,IAAO,qBAAQ;",
6
+ "names": ["useRefValue", "useLocalStorage", "useRefFunction"]
7
7
  }
@@ -46,7 +46,7 @@ var resources = {
46
46
  };
47
47
  var reactEasyI18n = (0, import_i18next.createInstance)({});
48
48
  reactEasyI18n.init({
49
- lng: "en",
49
+ lng: "en-US",
50
50
  resources
51
51
  });
52
52
  var t = (...args) => {
@@ -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
  }
@@ -1,11 +1,19 @@
1
1
  /**
2
- * **EN**: Generate a random number within a specified range (inclusive on both ends)
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 number | 生成的随机数
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 nodeCrypto;
43
+ let nodeCrypto2;
37
44
  if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
38
45
  try {
39
- nodeCrypto = require("crypto");
40
- } catch {
46
+ nodeCrypto2 = require("crypto");
47
+ } catch (error) {
41
48
  }
42
49
  }
43
- if (nodeCrypto == null ? void 0 : nodeCrypto.randomInt) {
44
- return nodeCrypto.randomInt(min, max + 1);
50
+ if (nodeCrypto2 == null ? void 0 : nodeCrypto2.randomInt) {
51
+ return nodeCrypto2.randomInt(min, max + 1);
45
52
  }
46
- const webCrypto = globalThis.crypto || (nodeCrypto == null ? void 0 : nodeCrypto.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
- const _math = Math;
62
- return Math.floor(_math.random() * (max - min + 1)) + min;
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 = {
@@ -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**: 生成指定范围(两端包含)内的随机数\n *\n * @param min The minimum value (inclusive) | 最小值(包含)\n * @param max The maximum value (inclusive) | 最大值(包含)\n *\n * @returns The generated random number | 生成的随机数\n */\nexport function random(min: number, max: number): number {\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 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 {\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 = (globalThis as any).crypto || nodeCrypto?.webcrypto;\n\n if (webCrypto?.getRandomValues) {\n const range = max - min + 1;\n if (range <= 0) return min;\n\n // 使用拒绝采样避免 (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, should not be used for cryptographic purposes\n const _math = Math;\n return Math.floor(_math.random() * (max - min + 1)) + min;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,OAAO,KAAa,KAAqB;AAVzD;AAWE,MAAI,CAAC,OAAO,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG,GAAG;AAClD,UAAM,IAAI,UAAU,oCAAoC;AAAA,EAC1D;AACA,MAAI,KAAK,MAAM,GAAG,MAAM,OAAO,KAAK,MAAM,GAAG,MAAM,KAAK;AACtD,UAAM,IAAI,UAAU,8BAA8B;AAAA,EACpD;AACA,MAAI,MAAM,KAAK;AACb,KAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG;AAAA,EACxB;AAIA,MAAI;AACJ,MAAI,OAAO,YAAY,iBAAe,aAAQ,aAAR,mBAAkB,OAAM;AAC5D,QAAI;AAEF,mBAAa,QAAQ,QAAQ;AAAA,IAC/B,QAAE;AAAA,IAEF;AAAA,EACF;AAGA,MAAI,yCAAY,WAAW;AACzB,WAAO,WAAW,UAAU,KAAK,MAAM,CAAC;AAAA,EAC1C;AAIA,QAAM,YAAiC,WAAmB,WAAU,yCAAY;AAEhF,MAAI,uCAAW,iBAAiB;AAC9B,UAAM,QAAQ,MAAM,MAAM;AAC1B,QAAI,SAAS;AAAG,aAAO;AAGvB,UAAM,YAAY;AAClB,UAAM,QAAQ,KAAK,OAAO,YAAY,KAAK,KAAK,IAAI;AACpD,UAAM,MAAM,IAAI,YAAY,CAAC;AAC7B,QAAI;AACJ,OAAG;AACD,gBAAU,gBAAgB,GAAG;AAC7B,UAAI,IAAI,CAAC;AAAA,IACX,SAAS,KAAK;AACd,WAAO,MAAO,IAAI;AAAA,EACpB;AAGA,QAAM,QAAQ;AACd,SAAO,KAAK,MAAM,MAAM,OAAO,KAAK,MAAM,MAAM,EAAE,IAAI;AACxD;",
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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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": "^4.6.0",
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.24.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": "^7.0.2",
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",