clxx 2.1.6 → 2.1.8

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 (70) hide show
  1. package/AGENTS.md +2 -0
  2. package/README.md +63 -0
  3. package/build/Ago/index.js +14 -8
  4. package/build/Alert/Wrapper.js +20 -20
  5. package/build/Alert/index.js +17 -11
  6. package/build/Alert/style.js +44 -26
  7. package/build/AutoGrid/index.js +50 -14
  8. package/build/AutoGrid/style.js +9 -6
  9. package/build/CarouselNotice/index.js +22 -19
  10. package/build/CarouselNotice/style.js +6 -3
  11. package/build/CitySelect/data.d.ts +3 -0
  12. package/build/CitySelect/data.js +2355 -0
  13. package/build/CitySelect/index.d.ts +17 -0
  14. package/build/CitySelect/index.js +335 -0
  15. package/build/CitySelect/search.d.ts +2 -0
  16. package/build/CitySelect/search.js +70 -0
  17. package/build/CitySelect/style.d.ts +4 -0
  18. package/build/CitySelect/style.js +237 -0
  19. package/build/CitySelect/type.d.ts +17 -0
  20. package/build/CitySelect/type.js +2 -0
  21. package/build/Clickable/index.js +56 -20
  22. package/build/Container/index.js +52 -16
  23. package/build/Countdowner/index.js +50 -14
  24. package/build/Dialog/Wrapper.js +13 -10
  25. package/build/Dialog/index.js +18 -12
  26. package/build/Dialog/style.js +29 -25
  27. package/build/Effect/useInterval.js +7 -4
  28. package/build/Effect/useTick.js +9 -6
  29. package/build/Effect/useUpdate.js +6 -3
  30. package/build/Effect/useViewport.js +15 -8
  31. package/build/Effect/useWindowResize.js +7 -4
  32. package/build/Fixed/index.js +6 -3
  33. package/build/Flex/Col.js +23 -15
  34. package/build/Flex/Row.js +23 -15
  35. package/build/Flex/index.js +9 -5
  36. package/build/Indicator/index.js +20 -14
  37. package/build/Indicator/style.js +6 -3
  38. package/build/Loading/Wrapper.js +14 -11
  39. package/build/Loading/index.js +17 -10
  40. package/build/Loading/style.js +9 -6
  41. package/build/Overlay/index.js +12 -9
  42. package/build/SafeArea/index.js +8 -5
  43. package/build/ScrollView/index.js +24 -21
  44. package/build/ScrollView/style.js +4 -1
  45. package/build/Toast/Toast.js +53 -17
  46. package/build/Toast/index.js +21 -14
  47. package/build/Toast/style.d.ts +0 -3
  48. package/build/Toast/style.js +49 -41
  49. package/build/index.d.ts +1 -1
  50. package/build/index.js +102 -36
  51. package/build/utils/Countdown.js +7 -3
  52. package/build/utils/ago.js +10 -4
  53. package/build/utils/calendarTable.js +9 -3
  54. package/build/utils/createApp.js +35 -27
  55. package/build/utils/cssUtil.js +10 -5
  56. package/build/utils/defaultScroll.js +4 -1
  57. package/build/utils/dom.js +6 -3
  58. package/build/utils/is.js +6 -2
  59. package/build/utils/jsonp.js +4 -1
  60. package/build/utils/request.js +40 -27
  61. package/build/utils/tick.js +4 -1
  62. package/build/utils/uniqKey.js +4 -1
  63. package/build/utils/wait.js +8 -4
  64. package/package.json +1 -1
  65. package/test/src/city-select/index.jsx +21 -0
  66. package/test/src/index/index.jsx +1 -0
  67. package/test/src/toast/index.jsx +1 -0
  68. package/test/vite.config.js +6 -2
  69. package/build/context.d.ts +0 -14
  70. package/build/context.js +0 -21
@@ -1,8 +1,11 @@
1
- import { useEffect, useRef } from "react";
2
- export function useInterval(callback, delay) {
3
- const savedCallback = useRef(callback);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useInterval = useInterval;
4
+ const react_1 = require("react");
5
+ function useInterval(callback, delay) {
6
+ const savedCallback = (0, react_1.useRef)(callback);
4
7
  savedCallback.current = callback;
5
- useEffect(() => {
8
+ (0, react_1.useEffect)(() => {
6
9
  if (delay !== null) {
7
10
  const interval = setInterval(() => savedCallback.current(), delay || 0);
8
11
  return () => clearInterval(interval);
@@ -1,15 +1,18 @@
1
- import { tick } from '../utils/tick';
2
- import { useEffect, useRef } from 'react';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTick = useTick;
4
+ const tick_1 = require("../utils/tick");
5
+ const react_1 = require("react");
3
6
  /**
4
7
  * 逐帧执行的ticker
5
8
  * @param frame 帧函数
6
9
  * @param interval 执行间隔
7
10
  */
8
- export function useTick(frame) {
9
- const framer = useRef(frame);
11
+ function useTick(frame) {
12
+ const framer = (0, react_1.useRef)(frame);
10
13
  framer.current = frame;
11
- useEffect(() => {
12
- const stop = tick(() => framer.current());
14
+ (0, react_1.useEffect)(() => {
15
+ const stop = (0, tick_1.tick)(() => framer.current());
13
16
  return () => stop();
14
17
  }, []);
15
18
  }
@@ -1,10 +1,13 @@
1
- import { useReducer } from "react";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useUpdate = useUpdate;
4
+ const react_1 = require("react");
2
5
  const updateReducer = (num) => (num + 1) % 1000000;
3
6
  /**
4
7
  * 返回一个函数,调用该函数,组件会刷新一次
5
8
  * @returns
6
9
  */
7
- export function useUpdate() {
8
- const [, update] = useReducer(updateReducer, 0);
10
+ function useUpdate() {
11
+ const [, update] = (0, react_1.useReducer)(updateReducer, 0);
9
12
  return update;
10
13
  }
@@ -1,6 +1,13 @@
1
- import { useEffect } from "react";
2
- import isPlainObject from "lodash/isPlainObject";
3
- export const metaContent = {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.metaContent = void 0;
7
+ exports.useViewport = useViewport;
8
+ const react_1 = require("react");
9
+ const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
10
+ exports.metaContent = {
4
11
  /**
5
12
  * 解析meta的content字段
6
13
  * @param content
@@ -32,17 +39,17 @@ export const metaContent = {
32
39
  return parts.join(", ");
33
40
  },
34
41
  };
35
- export function useViewport(attr) {
42
+ function useViewport(attr) {
36
43
  let config = {
37
44
  width: "device-width",
38
45
  initialScale: 1,
39
46
  userScalable: "no",
40
47
  viewportFit: "cover",
41
48
  };
42
- if (isPlainObject(attr)) {
49
+ if ((0, isPlainObject_1.default)(attr)) {
43
50
  config = Object.assign(Object.assign({}, config), attr);
44
51
  }
45
- useEffect(() => {
52
+ (0, react_1.useEffect)(() => {
46
53
  // 确保viewport的合法逻辑
47
54
  let meta = document.querySelector("meta[name='viewport']");
48
55
  if (!meta) {
@@ -50,7 +57,7 @@ export function useViewport(attr) {
50
57
  meta.name = "viewport";
51
58
  document.head.prepend(meta);
52
59
  }
53
- const content = metaContent.parse(meta.content || "");
60
+ const content = exports.metaContent.parse(meta.content || "");
54
61
  if (config.width) {
55
62
  content.width = config.width;
56
63
  }
@@ -72,7 +79,7 @@ export function useViewport(attr) {
72
79
  if (config.viewportFit) {
73
80
  content["viewport-fit"] = config.viewportFit;
74
81
  }
75
- meta.content = metaContent.stringify(content);
82
+ meta.content = exports.metaContent.stringify(content);
76
83
  }, [
77
84
  config.width,
78
85
  config.height,
@@ -1,15 +1,18 @@
1
- import { useEffect, useRef } from "react";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useWindowResize = useWindowResize;
4
+ const react_1 = require("react");
2
5
  /**
3
6
  * 窗口尺寸变化时触发(包括屏幕旋转)
4
7
  * 注意:移动端 resize 事件通常只在旋转屏幕时触发,频率很低,不需要防抖
5
8
  *
6
9
  * @param onResize 窗口尺寸变化时的回调函数
7
10
  */
8
- export function useWindowResize(onResize) {
9
- const callbackRef = useRef(onResize);
11
+ function useWindowResize(onResize) {
12
+ const callbackRef = (0, react_1.useRef)(onResize);
10
13
  // 每次渲染都更新回调引用,避免闭包陈旧
11
14
  callbackRef.current = onResize;
12
- useEffect(() => {
15
+ (0, react_1.useEffect)(() => {
13
16
  const callback = () => callbackRef.current();
14
17
  // 监听窗口大小变化
15
18
  window.addEventListener("resize", callback);
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,8 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- export function Fixed(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Fixed = Fixed;
15
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
16
+ function Fixed(props) {
14
17
  const { children, position = "bottom" } = props, extra = __rest(props, ["children", "position"]);
15
18
  const styles = {
16
19
  position: "fixed",
@@ -33,5 +36,5 @@ export function Fixed(props) {
33
36
  styles.right = 0;
34
37
  styles.height = "100%";
35
38
  }
36
- return (_jsx("div", Object.assign({}, props, { css: styles }, extra, { children: props.children })));
39
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { css: styles }, extra, { children: props.children })));
37
40
  }
package/build/Flex/Col.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,30 +10,37 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { Flex } from '.';
14
- export function ColStart(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.ColStart = ColStart;
15
+ exports.Col = ColStart;
16
+ exports.ColEnd = ColEnd;
17
+ exports.ColCenter = ColCenter;
18
+ exports.ColBetween = ColBetween;
19
+ exports.ColAround = ColAround;
20
+ exports.ColEvenly = ColEvenly;
21
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
22
+ const _1 = require(".");
23
+ function ColStart(props) {
15
24
  const { flexDirection = 'column', justifyContent = 'flex-start' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
16
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
17
26
  }
18
- export function ColEnd(props) {
27
+ function ColEnd(props) {
19
28
  const { flexDirection = 'column', justifyContent = 'flex-end' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
20
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
21
30
  }
22
- export function ColCenter(props) {
31
+ function ColCenter(props) {
23
32
  const { flexDirection = 'column', justifyContent = 'center' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
24
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
34
  }
26
- export function ColBetween(props) {
35
+ function ColBetween(props) {
27
36
  const { flexDirection = 'column', justifyContent = 'space-between' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
28
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
38
  }
30
- export function ColAround(props) {
39
+ function ColAround(props) {
31
40
  const { flexDirection = 'column', justifyContent = 'space-around' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
32
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
41
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
42
  }
34
- export function ColEvenly(props) {
43
+ function ColEvenly(props) {
35
44
  const { flexDirection = 'column', justifyContent = 'space-evenly' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
36
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
45
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
46
  }
38
- export { ColStart as Col };
package/build/Flex/Row.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,30 +10,37 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { Flex } from '.';
14
- export function RowStart(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.RowStart = RowStart;
15
+ exports.Row = RowStart;
16
+ exports.RowEnd = RowEnd;
17
+ exports.RowCenter = RowCenter;
18
+ exports.RowBetween = RowBetween;
19
+ exports.RowAround = RowAround;
20
+ exports.RowEvenly = RowEvenly;
21
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
22
+ const _1 = require(".");
23
+ function RowStart(props) {
15
24
  const { flexDirection = 'row', justifyContent = 'flex-start' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
16
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
17
26
  }
18
- export function RowEnd(props) {
27
+ function RowEnd(props) {
19
28
  const { flexDirection = 'row', justifyContent = 'flex-end' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
20
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
21
30
  }
22
- export function RowCenter(props) {
31
+ function RowCenter(props) {
23
32
  const { flexDirection = 'row', justifyContent = 'center' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
24
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
34
  }
26
- export function RowBetween(props) {
35
+ function RowBetween(props) {
27
36
  const { flexDirection = 'row', justifyContent = 'space-between' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
28
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
38
  }
30
- export function RowAround(props) {
39
+ function RowAround(props) {
31
40
  const { flexDirection = 'row', justifyContent = 'space-around' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
32
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
41
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
42
  }
34
- export function RowEvenly(props) {
43
+ function RowEvenly(props) {
35
44
  const { flexDirection = 'row', justifyContent = 'space-evenly' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
36
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
45
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
46
  }
38
- export { RowStart as Row };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,10 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- export function Flex(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Flex = Flex;
15
+ exports.FlexItem = FlexItem;
16
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
17
+ function Flex(props) {
14
18
  const { children, alignItems = 'center', alignContent, justifyContent, flexFlow, flexWrap, flexDirection } = props, extra = __rest(props, ["children", "alignItems", "alignContent", "justifyContent", "flexFlow", "flexWrap", "flexDirection"]);
15
- return (_jsx("div", Object.assign({ css: {
19
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
16
20
  display: 'flex',
17
21
  alignItems,
18
22
  alignContent,
@@ -22,9 +26,9 @@ export function Flex(props) {
22
26
  flexDirection,
23
27
  } }, extra, { children: children })));
24
28
  }
25
- export function FlexItem(props) {
29
+ function FlexItem(props) {
26
30
  const { children, alignSelf, order, flex, flexGrow, flexShrink, flexBasis } = props, extra = __rest(props, ["children", "alignSelf", "order", "flex", "flexGrow", "flexShrink", "flexBasis"]);
27
- return (_jsx("div", Object.assign({ css: {
31
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
28
32
  alignSelf,
29
33
  order,
30
34
  flex,
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,51 +10,56 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { css } from '@emotion/react';
14
- import React from 'react';
15
- import { normalizeUnit } from '../utils/cssUtil';
16
- import { getBarChangeKeyFrames } from './style';
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Indicator = Indicator;
18
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
+ const react_1 = require("@emotion/react");
20
+ const react_2 = __importDefault(require("react"));
21
+ const cssUtil_1 = require("../utils/cssUtil");
22
+ const style_1 = require("./style");
17
23
  /**
18
24
  * SVG转圈指示器,一般用作loading效果
19
25
  * @param props
20
26
  */
21
- export function Indicator(props) {
27
+ function Indicator(props) {
22
28
  const { size, rounded = true, barWidth = 7, barHeight = 28, barColor = '#fff', barCount = 12, duration = 600, containerStyle } = props, attributes = __rest(props, ["size", "rounded", "barWidth", "barHeight", "barColor", "barCount", "duration", "containerStyle"]);
23
29
  const radius = rounded ? barWidth / 2 : 0;
24
30
  // 使用 useMemo 缓存 barList,避免每次渲染都重新生成
25
- const barList = React.useMemo(() => {
31
+ const barList = react_2.default.useMemo(() => {
26
32
  const bars = [];
27
33
  for (let i = 0; i < barCount; i++) {
28
- bars.push(_jsx("rect", { x: (100 - barWidth) / 2, y: "0", rx: radius, ry: radius, width: barWidth, height: barHeight, transform: `rotate(${(360 / barCount) * i}, 50, 50)`, css: {
34
+ bars.push((0, jsx_runtime_1.jsx)("rect", { x: (100 - barWidth) / 2, y: "0", rx: radius, ry: radius, width: barWidth, height: barHeight, transform: `rotate(${(360 / barCount) * i}, 50, 50)`, css: {
29
35
  animationDelay: `${-(duration * (barCount - i)) / barCount}ms`,
30
36
  } }, i));
31
37
  }
32
38
  return bars;
33
39
  }, [barCount, barWidth, barHeight, radius, duration]);
34
40
  // 使用 useMemo 缓存样式,避免每次都重新计算
35
- const style = React.useMemo(() => [
41
+ const style = react_2.default.useMemo(() => [
36
42
  {
37
43
  fontSize: 0,
38
44
  },
39
45
  typeof size !== 'undefined' ? {
40
- width: normalizeUnit(size),
41
- height: normalizeUnit(size),
46
+ width: (0, cssUtil_1.normalizeUnit)(size),
47
+ height: (0, cssUtil_1.normalizeUnit)(size),
42
48
  } : {
43
49
  width: '.6rem',
44
50
  height: '.6rem',
45
51
  }
46
52
  ], [size]);
47
- const svgStyle = React.useMemo(() => css({
53
+ const svgStyle = react_2.default.useMemo(() => (0, react_1.css)({
48
54
  width: '100%',
49
55
  height: '100%',
50
56
  rect: {
51
57
  fill: 'transparent',
52
- animationName: getBarChangeKeyFrames(barColor),
58
+ animationName: (0, style_1.getBarChangeKeyFrames)(barColor),
53
59
  animationDuration: `${duration}ms`,
54
60
  animationTimingFunction: 'linear',
55
61
  animationIterationCount: 'infinite',
56
62
  },
57
63
  }), [barColor, duration]);
58
- return (_jsx("div", Object.assign({ css: [style, containerStyle] }, attributes, { children: _jsx("svg", { viewBox: "0 0 100 100", css: svgStyle, children: barList }) })));
64
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: [style, containerStyle] }, attributes, { children: (0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 100 100", css: svgStyle, children: barList }) })));
59
65
  }
@@ -1,10 +1,13 @@
1
- import { keyframes } from '@emotion/react';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBarChangeKeyFrames = getBarChangeKeyFrames;
4
+ const react_1 = require("@emotion/react");
2
5
  /**
3
6
  * 获取转圈每一条bar的过渡动画
4
7
  * @param color
5
8
  */
6
- export function getBarChangeKeyFrames(color) {
7
- return keyframes `
9
+ function getBarChangeKeyFrames(color) {
10
+ return (0, react_1.keyframes) `
8
11
  from {
9
12
  fill: ${color};
10
13
  }
@@ -1,9 +1,12 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- import { style, LoadingHide } from './style';
3
- import { Indicator } from '../Indicator';
4
- import { RowCenter } from '../Flex/Row';
5
- import { Overlay } from '../Overlay';
6
- export function Wrapper(props) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Wrapper = Wrapper;
4
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
+ const style_1 = require("./style");
6
+ const Indicator_1 = require("../Indicator");
7
+ const Row_1 = require("../Flex/Row");
8
+ const Overlay_1 = require("../Overlay");
9
+ function Wrapper(props) {
7
10
  const { status = 'show', hint, overlay, indicator, onHide, containerStyle, } = props;
8
11
  // 覆盖层样式
9
12
  let overlayProps = {
@@ -24,19 +27,19 @@ export function Wrapper(props) {
24
27
  indicatorProps = Object.assign(Object.assign({}, indicatorProps), indicator);
25
28
  }
26
29
  // 根据状态设置动画
27
- const animation = status === 'show' ? style.boxShow : style.boxHide;
30
+ const animation = status === 'show' ? style_1.style.boxShow : style_1.style.boxHide;
28
31
  // 动画结束时触发的函数逻辑
29
32
  const animationEnd = (event) => {
30
- if (event.animationName === LoadingHide.name) {
33
+ if (event.animationName === style_1.LoadingHide.name) {
31
34
  onHide === null || onHide === void 0 ? void 0 : onHide();
32
35
  }
33
36
  };
34
37
  let box;
35
38
  if (hint && typeof hint === 'string') {
36
- box = (_jsxs(RowCenter, { css: [style.boxCommon, style.boxWithExtra, animation, containerStyle], onAnimationEnd: animationEnd, children: [_jsx(Indicator, Object.assign({}, indicatorProps)), _jsx("div", { css: style.hint, children: hint })] }));
39
+ box = ((0, jsx_runtime_1.jsxs)(Row_1.RowCenter, { css: [style_1.style.boxCommon, style_1.style.boxWithExtra, animation, containerStyle], onAnimationEnd: animationEnd, children: [(0, jsx_runtime_1.jsx)(Indicator_1.Indicator, Object.assign({}, indicatorProps)), (0, jsx_runtime_1.jsx)("div", { css: style_1.style.hint, children: hint })] }));
37
40
  }
38
41
  else {
39
- box = (_jsx(RowCenter, { css: [style.boxCommon, style.box, animation, containerStyle], onAnimationEnd: animationEnd, children: _jsx(Indicator, Object.assign({}, indicatorProps)) }));
42
+ box = ((0, jsx_runtime_1.jsx)(Row_1.RowCenter, { css: [style_1.style.boxCommon, style_1.style.box, animation, containerStyle], onAnimationEnd: animationEnd, children: (0, jsx_runtime_1.jsx)(Indicator_1.Indicator, Object.assign({}, indicatorProps)) }));
40
43
  }
41
- return _jsx(Overlay, Object.assign({}, overlayProps, { children: box }));
44
+ return (0, jsx_runtime_1.jsx)(Overlay_1.Overlay, Object.assign({}, overlayProps, { children: box }));
42
45
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,20 +8,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
- import { Wrapper } from './Wrapper';
12
- import { createPortalDOM } from '../utils/dom';
13
- import isPlainObject from 'lodash/isPlainObject';
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.showLoading = showLoading;
16
+ exports.showLoadingAtLeast = showLoadingAtLeast;
17
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
18
+ const Wrapper_1 = require("./Wrapper");
19
+ const dom_1 = require("../utils/dom");
20
+ const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
14
21
  /**
15
22
  * 显示loading
16
23
  * @param hint 提示文字
17
24
  * @param option
18
25
  * @returns
19
26
  */
20
- export function showLoading(hint, option) {
21
- const { mount, unmount } = createPortalDOM();
27
+ function showLoading(hint, option) {
28
+ const { mount, unmount } = (0, dom_1.createPortalDOM)();
22
29
  let props = { hint, status: 'show' };
23
- if (isPlainObject(option)) {
30
+ if ((0, isPlainObject_1.default)(option)) {
24
31
  delete option.status;
25
32
  props = Object.assign(Object.assign({}, props), option);
26
33
  }
@@ -28,10 +35,10 @@ export function showLoading(hint, option) {
28
35
  const closeLoading = () => __awaiter(this, void 0, void 0, function* () {
29
36
  props.status = 'hide';
30
37
  props.onHide = unmount;
31
- yield mount(_jsx(Wrapper, Object.assign({}, props)));
38
+ yield mount((0, jsx_runtime_1.jsx)(Wrapper_1.Wrapper, Object.assign({}, props)));
32
39
  });
33
40
  // 显示loading
34
- const mountShow = mount(_jsx(Wrapper, Object.assign({}, props)));
41
+ const mountShow = mount((0, jsx_runtime_1.jsx)(Wrapper_1.Wrapper, Object.assign({}, props)));
35
42
  // 关闭loading
36
43
  return () => __awaiter(this, void 0, void 0, function* () {
37
44
  yield mountShow;
@@ -45,7 +52,7 @@ export function showLoading(hint, option) {
45
52
  * @param option 各种可定制的选项
46
53
  * @returns
47
54
  */
48
- export function showLoadingAtLeast(atLeast = 300, hint, option) {
55
+ function showLoadingAtLeast(atLeast = 300, hint, option) {
49
56
  const closeLoading = showLoading(hint, option);
50
57
  // 记录开始展示的时间
51
58
  const start = Date.now();
@@ -1,5 +1,8 @@
1
- import { keyframes } from "@emotion/react";
2
- export const LoadingShow = keyframes `
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.style = exports.LoadingHide = exports.LoadingShow = void 0;
4
+ const react_1 = require("@emotion/react");
5
+ exports.LoadingShow = (0, react_1.keyframes) `
3
6
  from {
4
7
  opacity: 0;
5
8
  }
@@ -7,7 +10,7 @@ export const LoadingShow = keyframes `
7
10
  opacity: 1;
8
11
  }
9
12
  `;
10
- export const LoadingHide = keyframes `
13
+ exports.LoadingHide = (0, react_1.keyframes) `
11
14
  from {
12
15
  opacity: 1;
13
16
  }
@@ -15,7 +18,7 @@ export const LoadingHide = keyframes `
15
18
  opacity: 0;
16
19
  }
17
20
  `;
18
- export const style = {
21
+ exports.style = {
19
22
  boxCommon: {
20
23
  backgroundColor: `rgba(0, 0, 0, .8)`,
21
24
  borderRadius: '.16rem',
@@ -25,10 +28,10 @@ export const style = {
25
28
  height: '1.6rem',
26
29
  },
27
30
  boxShow: {
28
- animation: `${LoadingShow} 200ms`,
31
+ animation: `${exports.LoadingShow} 200ms`,
29
32
  },
30
33
  boxHide: {
31
- animation: `${LoadingHide} 200ms`,
34
+ animation: `${exports.LoadingHide} 200ms`,
32
35
  },
33
36
  boxWithExtra: [
34
37
  { padding: '.3rem' },
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,18 +10,20 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { useLayoutEffect, useMemo, useState } from "react";
14
- import { createPortal } from "react-dom";
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Overlay = Overlay;
15
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
16
+ const react_1 = require("react");
17
+ const react_dom_1 = require("react-dom");
15
18
  /**
16
19
  * 覆盖层,可以作为通用遮罩
17
20
  * @param props
18
21
  * @returns
19
22
  */
20
- export function Overlay(props) {
23
+ function Overlay(props) {
21
24
  const { children, outside = false, centerContent = true, fullScreen = true, maskColor = "rgba(0, 0, 0, .6)" } = props, extra = __rest(props, ["children", "outside", "centerContent", "fullScreen", "maskColor"]);
22
- const [mount, setMount] = useState(null);
23
- useLayoutEffect(() => {
25
+ const [mount, setMount] = (0, react_1.useState)(null);
26
+ (0, react_1.useLayoutEffect)(() => {
24
27
  if (outside) {
25
28
  const div = document.createElement("div");
26
29
  document.body.appendChild(div);
@@ -31,7 +34,7 @@ export function Overlay(props) {
31
34
  }
32
35
  }, [outside]);
33
36
  // 使用 useMemo 缓存样式计算,避免每次渲染都重新计算
34
- const style = useMemo(() => {
37
+ const style = (0, react_1.useMemo)(() => {
35
38
  const styles = [];
36
39
  // 如果是全屏,设置全屏样式
37
40
  if (fullScreen) {
@@ -55,7 +58,7 @@ export function Overlay(props) {
55
58
  }
56
59
  return styles;
57
60
  }, [fullScreen, maskColor, centerContent]);
58
- const content = (_jsx("div", Object.assign({ css: style }, extra, { children: children })));
61
+ const content = ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: style }, extra, { children: children })));
59
62
  /**
60
63
  * 如果是挂载到当前位置,直接返回
61
64
  */
@@ -71,5 +74,5 @@ export function Overlay(props) {
71
74
  /**
72
75
  * 挂载到外部,且挂载点已经准备好
73
76
  */
74
- return createPortal(content, mount);
77
+ return (0, react_dom_1.createPortal)(content, mount);
75
78
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,11 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { useViewport } from "../Effect/useViewport";
14
- export function SafeArea(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.SafeArea = SafeArea;
15
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
16
+ const useViewport_1 = require("../Effect/useViewport");
17
+ function SafeArea(props) {
15
18
  const { children, type = "bottom" } = props, extra = __rest(props, ["children", "type"]);
16
- useViewport({ viewportFit: "cover" });
19
+ (0, useViewport_1.useViewport)({ viewportFit: "cover" });
17
20
  let boxCss = {};
18
21
  if (type === "top") {
19
22
  boxCss = {
@@ -31,5 +34,5 @@ export function SafeArea(props) {
31
34
  ],
32
35
  };
33
36
  }
34
- return (_jsx("div", Object.assign({ css: boxCss }, extra, { children: children })));
37
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: boxCss }, extra, { children: children })));
35
38
  }