@windrun-huaiin/third-ui 14.3.0 → 14.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@ var creditNavButton = require('./credit/credit-nav-button.js');
22
22
 
23
23
  exports.GoToTop = goToTop.GoToTop;
24
24
  exports.Loading = loading.Loading;
25
+ exports.getLoadingCycleDurationMs = loading.getLoadingCycleDurationMs;
25
26
  exports.NProgressBar = nprogressBar.NProgressBar;
26
27
  exports.AdsAlertDialog = adsAlertDialog.AdsAlertDialog;
27
28
  exports.XButton = xButton.XButton;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  export { GoToTop } from './go-to-top.mjs';
3
- export { Loading } from './loading.mjs';
3
+ export { Loading, getLoadingCycleDurationMs } from './loading.mjs';
4
4
  export { NProgressBar } from './nprogress-bar.mjs';
5
5
  export { AdsAlertDialog } from './ads-alert-dialog.mjs';
6
6
  export { XButton } from './x-button.mjs';
@@ -1,3 +1,4 @@
1
+ export declare function getLoadingCycleDurationMs(): number;
1
2
  interface LoadingProps {
2
3
  themeColor?: string;
3
4
  compact?: boolean;
@@ -11,6 +11,12 @@ const DOT_SIZE = 6; // px, dot diameter
11
11
  const SPACING = 12; // px, space between dot centers
12
12
  const ANIMATION_DURATION = 1.8; // seconds
13
13
  const STAGGER_DELAY_FACTOR = 0.08; // seconds, delay per unit of distance from center
14
+ function getLoadingCycleDurationMs() {
15
+ const centerX = (NUM_COLS - 1) / 2;
16
+ const centerY = (NUM_ROWS - 1) / 2;
17
+ const furthestDistance = Math.sqrt(Math.pow(centerY, 2) + Math.pow(centerX, 2));
18
+ return (ANIMATION_DURATION + furthestDistance * STAGGER_DELAY_FACTOR) * 1000;
19
+ }
14
20
  function clampChannel(value) {
15
21
  return Math.max(0, Math.min(255, Math.round(value)));
16
22
  }
@@ -95,3 +101,4 @@ function Loading({ themeColor = lib.themeSvgIconColor, compact = false, classNam
95
101
  }
96
102
 
97
103
  exports.Loading = Loading;
104
+ exports.getLoadingCycleDurationMs = getLoadingCycleDurationMs;
@@ -9,6 +9,12 @@ const DOT_SIZE = 6; // px, dot diameter
9
9
  const SPACING = 12; // px, space between dot centers
10
10
  const ANIMATION_DURATION = 1.8; // seconds
11
11
  const STAGGER_DELAY_FACTOR = 0.08; // seconds, delay per unit of distance from center
12
+ function getLoadingCycleDurationMs() {
13
+ const centerX = (NUM_COLS - 1) / 2;
14
+ const centerY = (NUM_ROWS - 1) / 2;
15
+ const furthestDistance = Math.sqrt(Math.pow(centerY, 2) + Math.pow(centerX, 2));
16
+ return (ANIMATION_DURATION + furthestDistance * STAGGER_DELAY_FACTOR) * 1000;
17
+ }
12
18
  function clampChannel(value) {
13
19
  return Math.max(0, Math.min(255, Math.round(value)));
14
20
  }
@@ -92,4 +98,4 @@ function Loading({ themeColor = themeSvgIconColor, compact = false, className, l
92
98
  } }, dot.id))), jsx("div", { className: "absolute inset-0 flex items-center justify-center", style: { pointerEvents: 'none' }, children: jsx("p", { className: cn('text-xl font-semibold text-white', labelClassName), children: label }) })] }) }));
93
99
  }
94
100
 
95
- export { Loading };
101
+ export { Loading, getLoadingCycleDurationMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/third-ui",
3
- "version": "14.3.0",
3
+ "version": "14.3.1",
4
4
  "description": "Third-party integrated UI components for windrun-huaiin projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -10,6 +10,14 @@ const SPACING = 12; // px, space between dot centers
10
10
  const ANIMATION_DURATION = 1.8; // seconds
11
11
  const STAGGER_DELAY_FACTOR = 0.08; // seconds, delay per unit of distance from center
12
12
 
13
+ export function getLoadingCycleDurationMs() {
14
+ const centerX = (NUM_COLS - 1) / 2;
15
+ const centerY = (NUM_ROWS - 1) / 2;
16
+ const furthestDistance = Math.sqrt(Math.pow(centerY, 2) + Math.pow(centerX, 2));
17
+
18
+ return (ANIMATION_DURATION + furthestDistance * STAGGER_DELAY_FACTOR) * 1000;
19
+ }
20
+
13
21
  function clampChannel(value: number) {
14
22
  return Math.max(0, Math.min(255, Math.round(value)));
15
23
  }