clxx 2.1.5 → 2.1.7
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/AGENTS.md +2 -0
- package/README.md +827 -420
- package/build/Ago/index.js +14 -8
- package/build/Alert/Wrapper.js +13 -10
- package/build/Alert/index.js +17 -11
- package/build/Alert/style.js +44 -58
- package/build/AutoGrid/index.js +66 -48
- package/build/AutoGrid/style.d.ts +3 -4
- package/build/AutoGrid/style.js +13 -22
- package/build/CarouselNotice/index.js +22 -19
- package/build/CarouselNotice/style.js +12 -14
- package/build/CitySelect/data.d.ts +3 -0
- package/build/CitySelect/data.js +2355 -0
- package/build/CitySelect/index.d.ts +17 -0
- package/build/CitySelect/index.js +300 -0
- package/build/CitySelect/search.d.ts +2 -0
- package/build/CitySelect/search.js +70 -0
- package/build/CitySelect/style.d.ts +4 -0
- package/build/CitySelect/style.js +237 -0
- package/build/CitySelect/type.d.ts +17 -0
- package/build/CitySelect/type.js +2 -0
- package/build/Clickable/index.d.ts +1 -0
- package/build/Clickable/index.js +113 -31
- package/build/Container/index.js +62 -47
- package/build/Countdowner/index.js +50 -14
- package/build/Dialog/Wrapper.js +13 -10
- package/build/Dialog/index.js +18 -12
- package/build/Dialog/style.js +29 -25
- package/build/Effect/useInterval.js +7 -4
- package/build/Effect/useTick.js +9 -6
- package/build/Effect/useUpdate.js +6 -3
- package/build/Effect/useViewport.js +15 -8
- package/build/Effect/useWindowResize.js +7 -4
- package/build/Fixed/index.d.ts +5 -0
- package/build/Fixed/index.js +40 -0
- package/build/Flex/Col.js +23 -15
- package/build/Flex/Row.js +23 -15
- package/build/Flex/index.js +9 -5
- package/build/Indicator/index.js +24 -18
- package/build/Indicator/style.js +6 -3
- package/build/Loading/Wrapper.js +14 -11
- package/build/Loading/index.js +17 -10
- package/build/Loading/style.js +25 -23
- package/build/Overlay/index.js +15 -31
- package/build/SafeArea/index.js +8 -5
- package/build/ScrollView/index.js +24 -21
- package/build/ScrollView/style.js +16 -14
- package/build/Toast/Toast.js +53 -17
- package/build/Toast/index.js +21 -14
- package/build/Toast/style.js +31 -30
- package/build/index.d.ts +2 -2
- package/build/index.js +102 -36
- package/build/utils/Countdown.js +7 -3
- package/build/utils/ago.js +10 -4
- package/build/utils/calendarTable.js +9 -3
- package/build/utils/createApp.d.ts +1 -2
- package/build/utils/createApp.js +35 -31
- package/build/utils/cssUtil.d.ts +0 -9
- package/build/utils/cssUtil.js +10 -43
- package/build/utils/defaultScroll.js +4 -1
- package/build/utils/dom.js +6 -3
- package/build/utils/is.js +6 -2
- package/build/utils/jsonp.js +4 -1
- package/build/utils/request.js +40 -27
- package/build/utils/tick.js +4 -1
- package/build/utils/uniqKey.js +4 -1
- package/build/utils/wait.js +8 -4
- package/package.json +1 -1
- package/test/src/city-select/index.jsx +21 -0
- package/test/src/dialog/index.module.css +1 -1
- package/test/src/index/index.jsx +1 -0
- package/test/vite.config.js +6 -2
- package/build/context.d.ts +0 -15
- package/build/context.js +0 -24
package/build/Toast/style.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.style = exports.bottomHideAnimation = exports.bottomShowAnimation = exports.topHideAnimation = exports.topShowAnimation = exports.middleHideAnimation = exports.middleShowAnimation = void 0;
|
|
4
|
+
exports.getAnimation = getAnimation;
|
|
5
|
+
const react_1 = require("@emotion/react");
|
|
6
|
+
exports.middleShowAnimation = (0, react_1.keyframes) `
|
|
4
7
|
from {
|
|
5
8
|
opacity: 0;
|
|
6
9
|
transform: translateX(-50%) scale(0.9);
|
|
@@ -10,7 +13,7 @@ export const middleShowAnimation = keyframes `
|
|
|
10
13
|
transform: translateX(-50%) scale(1);
|
|
11
14
|
}
|
|
12
15
|
`;
|
|
13
|
-
|
|
16
|
+
exports.middleHideAnimation = (0, react_1.keyframes) `
|
|
14
17
|
from {
|
|
15
18
|
opacity: 1;
|
|
16
19
|
transform: translateX(-50%) scale(1);
|
|
@@ -20,7 +23,7 @@ export const middleHideAnimation = keyframes `
|
|
|
20
23
|
transform: translateX(-50%) scale(0.9);
|
|
21
24
|
}
|
|
22
25
|
`;
|
|
23
|
-
|
|
26
|
+
exports.topShowAnimation = (0, react_1.keyframes) `
|
|
24
27
|
from {
|
|
25
28
|
opacity: 0;
|
|
26
29
|
transform: translate(-50%, -100%);
|
|
@@ -30,7 +33,7 @@ export const topShowAnimation = keyframes `
|
|
|
30
33
|
transform: translate(-50%, 0);
|
|
31
34
|
}
|
|
32
35
|
`;
|
|
33
|
-
|
|
36
|
+
exports.topHideAnimation = (0, react_1.keyframes) `
|
|
34
37
|
from {
|
|
35
38
|
opacity: 1;
|
|
36
39
|
transform: translate(-50%, 0);
|
|
@@ -40,7 +43,7 @@ export const topHideAnimation = keyframes `
|
|
|
40
43
|
transform: translate(-50%, -100%);
|
|
41
44
|
}
|
|
42
45
|
`;
|
|
43
|
-
|
|
46
|
+
exports.bottomShowAnimation = (0, react_1.keyframes) `
|
|
44
47
|
from {
|
|
45
48
|
opacity: 0;
|
|
46
49
|
transform: translate(-50%, 100%);
|
|
@@ -50,7 +53,7 @@ export const bottomShowAnimation = keyframes `
|
|
|
50
53
|
transform: translate(-50%, 0);
|
|
51
54
|
}
|
|
52
55
|
`;
|
|
53
|
-
|
|
56
|
+
exports.bottomHideAnimation = (0, react_1.keyframes) `
|
|
54
57
|
from {
|
|
55
58
|
opacity: 1;
|
|
56
59
|
transform: translate(-50%, 0);
|
|
@@ -66,11 +69,11 @@ export const bottomHideAnimation = keyframes `
|
|
|
66
69
|
* @param type
|
|
67
70
|
* @returns
|
|
68
71
|
*/
|
|
69
|
-
|
|
72
|
+
function getAnimation(position, type) {
|
|
70
73
|
const animation = {
|
|
71
|
-
top: [topShowAnimation, topHideAnimation],
|
|
72
|
-
middle: [middleShowAnimation, middleHideAnimation],
|
|
73
|
-
bottom: [bottomShowAnimation, bottomHideAnimation],
|
|
74
|
+
top: [exports.topShowAnimation, exports.topHideAnimation],
|
|
75
|
+
middle: [exports.middleShowAnimation, exports.middleHideAnimation],
|
|
76
|
+
bottom: [exports.bottomShowAnimation, exports.bottomHideAnimation],
|
|
74
77
|
};
|
|
75
78
|
let keyframes;
|
|
76
79
|
if (type === "show") {
|
|
@@ -81,31 +84,30 @@ export function getAnimation(position, type) {
|
|
|
81
84
|
}
|
|
82
85
|
return {
|
|
83
86
|
keyframes,
|
|
84
|
-
animation: css({
|
|
87
|
+
animation: (0, react_1.css)({
|
|
85
88
|
animation: `${keyframes} 300ms ease`,
|
|
86
89
|
}),
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
|
-
|
|
92
|
+
exports.style = {
|
|
90
93
|
container() {
|
|
91
|
-
return css({
|
|
94
|
+
return (0, react_1.css)({
|
|
92
95
|
position: "fixed",
|
|
93
96
|
left: "50%",
|
|
94
97
|
transform: "translateX(-50%)",
|
|
95
98
|
zIndex: 9999,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}));
|
|
99
|
+
maxWidth: '6rem',
|
|
100
|
+
});
|
|
99
101
|
},
|
|
100
102
|
top(offset) {
|
|
101
|
-
return
|
|
103
|
+
return (0, react_1.css)({ top: offset / 100 + 'rem' });
|
|
102
104
|
},
|
|
103
|
-
middle: css({ top: "50%" }),
|
|
105
|
+
middle: (0, react_1.css)({ top: "50%" }),
|
|
104
106
|
bottom(offset) {
|
|
105
|
-
return
|
|
107
|
+
return (0, react_1.css)({ bottom: offset / 100 + 'rem' });
|
|
106
108
|
},
|
|
107
109
|
content: (radius) => {
|
|
108
|
-
return css({
|
|
110
|
+
return (0, react_1.css)({
|
|
109
111
|
position: "relative",
|
|
110
112
|
backgroundColor: "rgba(0, 0, 0, .8)",
|
|
111
113
|
color: "#fff",
|
|
@@ -114,14 +116,13 @@ export const style = {
|
|
|
114
116
|
textOverflow: "ellipsis",
|
|
115
117
|
overflow: "hidden",
|
|
116
118
|
lineHeight: 1,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}));
|
|
119
|
+
fontSize: '.26rem',
|
|
120
|
+
paddingLeft: '.3rem',
|
|
121
|
+
paddingRight: '.3rem',
|
|
122
|
+
paddingTop: '.4rem',
|
|
123
|
+
paddingBottom: '.4rem',
|
|
124
|
+
borderRadius: radius ? radius / 100 + 'rem' : 0,
|
|
125
|
+
});
|
|
125
126
|
},
|
|
126
127
|
contentMiddle: {
|
|
127
128
|
transform: `translateY(-50%)`,
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { tick } from './utils/tick';
|
|
2
|
-
export { setContextValue, getContextValue } from './context';
|
|
3
2
|
export { jsonp } from './utils/jsonp';
|
|
4
3
|
export { uniqKey } from './utils/uniqKey';
|
|
5
4
|
export { ago } from './utils/ago';
|
|
@@ -9,7 +8,7 @@ export { Countdown } from './utils/Countdown';
|
|
|
9
8
|
export { defaultScroll } from './utils/defaultScroll';
|
|
10
9
|
export { is } from './utils/is';
|
|
11
10
|
export { waitFor, waitUntil } from './utils/wait';
|
|
12
|
-
export { normalizeUnit, splitValue
|
|
11
|
+
export { normalizeUnit, splitValue } from './utils/cssUtil';
|
|
13
12
|
export { createApp, history, getHistory } from './utils/createApp';
|
|
14
13
|
export { createPortalDOM } from './utils/dom';
|
|
15
14
|
export { useInterval } from './Effect/useInterval';
|
|
@@ -34,3 +33,4 @@ export { AutoGrid } from './AutoGrid';
|
|
|
34
33
|
export { showAlert } from './Alert';
|
|
35
34
|
export { ScrollView } from './ScrollView';
|
|
36
35
|
export { CarouselNotice } from './CarouselNotice';
|
|
36
|
+
export { CitySelect, showCitySelect } from './CitySelect';
|
package/build/index.js
CHANGED
|
@@ -1,36 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showUniqToast = exports.showToast = exports.Overlay = exports.Countdowner = exports.ColStart = exports.ColEvenly = exports.ColEnd = exports.ColCenter = exports.ColBetween = exports.ColAround = exports.Col = exports.RowStart = exports.RowEvenly = exports.RowEnd = exports.RowCenter = exports.RowBetween = exports.RowAround = exports.Row = exports.FlexItem = exports.Flex = exports.Container = exports.Ago = exports.useViewport = exports.useWindowResize = exports.useUpdate = exports.useTick = exports.useInterval = exports.createPortalDOM = exports.getHistory = exports.history = exports.createApp = exports.splitValue = exports.normalizeUnit = exports.waitUntil = exports.waitFor = exports.is = exports.defaultScroll = exports.Countdown = exports.calendarTable = exports.registerHostAlias = exports.buildUrlByOption = exports.sendRequest = exports.sugarSend = exports.sendJSON = exports.POST = exports.GET = exports.ago = exports.uniqKey = exports.jsonp = exports.tick = void 0;
|
|
4
|
+
exports.showCitySelect = exports.CitySelect = exports.CarouselNotice = exports.ScrollView = exports.showAlert = exports.AutoGrid = exports.SafeArea = exports.showLoadingAtLeast = exports.showLoading = exports.Indicator = exports.Clickable = exports.showDialog = void 0;
|
|
5
|
+
var tick_1 = require("./utils/tick");
|
|
6
|
+
Object.defineProperty(exports, "tick", { enumerable: true, get: function () { return tick_1.tick; } });
|
|
7
|
+
var jsonp_1 = require("./utils/jsonp");
|
|
8
|
+
Object.defineProperty(exports, "jsonp", { enumerable: true, get: function () { return jsonp_1.jsonp; } });
|
|
9
|
+
var uniqKey_1 = require("./utils/uniqKey");
|
|
10
|
+
Object.defineProperty(exports, "uniqKey", { enumerable: true, get: function () { return uniqKey_1.uniqKey; } });
|
|
11
|
+
var ago_1 = require("./utils/ago");
|
|
12
|
+
Object.defineProperty(exports, "ago", { enumerable: true, get: function () { return ago_1.ago; } });
|
|
13
|
+
var request_1 = require("./utils/request");
|
|
14
|
+
Object.defineProperty(exports, "GET", { enumerable: true, get: function () { return request_1.GET; } });
|
|
15
|
+
Object.defineProperty(exports, "POST", { enumerable: true, get: function () { return request_1.POST; } });
|
|
16
|
+
Object.defineProperty(exports, "sendJSON", { enumerable: true, get: function () { return request_1.sendJSON; } });
|
|
17
|
+
Object.defineProperty(exports, "sugarSend", { enumerable: true, get: function () { return request_1.sugarSend; } });
|
|
18
|
+
Object.defineProperty(exports, "sendRequest", { enumerable: true, get: function () { return request_1.sendRequest; } });
|
|
19
|
+
Object.defineProperty(exports, "buildUrlByOption", { enumerable: true, get: function () { return request_1.buildUrlByOption; } });
|
|
20
|
+
Object.defineProperty(exports, "registerHostAlias", { enumerable: true, get: function () { return request_1.registerHostAlias; } });
|
|
21
|
+
var calendarTable_1 = require("./utils/calendarTable");
|
|
22
|
+
Object.defineProperty(exports, "calendarTable", { enumerable: true, get: function () { return calendarTable_1.calendarTable; } });
|
|
23
|
+
var Countdown_1 = require("./utils/Countdown");
|
|
24
|
+
Object.defineProperty(exports, "Countdown", { enumerable: true, get: function () { return Countdown_1.Countdown; } });
|
|
25
|
+
var defaultScroll_1 = require("./utils/defaultScroll");
|
|
26
|
+
Object.defineProperty(exports, "defaultScroll", { enumerable: true, get: function () { return defaultScroll_1.defaultScroll; } });
|
|
27
|
+
var is_1 = require("./utils/is");
|
|
28
|
+
Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.is; } });
|
|
29
|
+
var wait_1 = require("./utils/wait");
|
|
30
|
+
Object.defineProperty(exports, "waitFor", { enumerable: true, get: function () { return wait_1.waitFor; } });
|
|
31
|
+
Object.defineProperty(exports, "waitUntil", { enumerable: true, get: function () { return wait_1.waitUntil; } });
|
|
32
|
+
var cssUtil_1 = require("./utils/cssUtil");
|
|
33
|
+
Object.defineProperty(exports, "normalizeUnit", { enumerable: true, get: function () { return cssUtil_1.normalizeUnit; } });
|
|
34
|
+
Object.defineProperty(exports, "splitValue", { enumerable: true, get: function () { return cssUtil_1.splitValue; } });
|
|
35
|
+
var createApp_1 = require("./utils/createApp");
|
|
36
|
+
Object.defineProperty(exports, "createApp", { enumerable: true, get: function () { return createApp_1.createApp; } });
|
|
37
|
+
Object.defineProperty(exports, "history", { enumerable: true, get: function () { return createApp_1.history; } });
|
|
38
|
+
Object.defineProperty(exports, "getHistory", { enumerable: true, get: function () { return createApp_1.getHistory; } });
|
|
39
|
+
var dom_1 = require("./utils/dom");
|
|
40
|
+
Object.defineProperty(exports, "createPortalDOM", { enumerable: true, get: function () { return dom_1.createPortalDOM; } });
|
|
41
|
+
var useInterval_1 = require("./Effect/useInterval");
|
|
42
|
+
Object.defineProperty(exports, "useInterval", { enumerable: true, get: function () { return useInterval_1.useInterval; } });
|
|
43
|
+
var useTick_1 = require("./Effect/useTick");
|
|
44
|
+
Object.defineProperty(exports, "useTick", { enumerable: true, get: function () { return useTick_1.useTick; } });
|
|
45
|
+
var useUpdate_1 = require("./Effect/useUpdate");
|
|
46
|
+
Object.defineProperty(exports, "useUpdate", { enumerable: true, get: function () { return useUpdate_1.useUpdate; } });
|
|
47
|
+
var useWindowResize_1 = require("./Effect/useWindowResize");
|
|
48
|
+
Object.defineProperty(exports, "useWindowResize", { enumerable: true, get: function () { return useWindowResize_1.useWindowResize; } });
|
|
49
|
+
var useViewport_1 = require("./Effect/useViewport");
|
|
50
|
+
Object.defineProperty(exports, "useViewport", { enumerable: true, get: function () { return useViewport_1.useViewport; } });
|
|
51
|
+
var Ago_1 = require("./Ago");
|
|
52
|
+
Object.defineProperty(exports, "Ago", { enumerable: true, get: function () { return Ago_1.Ago; } });
|
|
53
|
+
var Container_1 = require("./Container");
|
|
54
|
+
Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return Container_1.Container; } });
|
|
55
|
+
var Flex_1 = require("./Flex");
|
|
56
|
+
Object.defineProperty(exports, "Flex", { enumerable: true, get: function () { return Flex_1.Flex; } });
|
|
57
|
+
Object.defineProperty(exports, "FlexItem", { enumerable: true, get: function () { return Flex_1.FlexItem; } });
|
|
58
|
+
var Row_1 = require("./Flex/Row");
|
|
59
|
+
Object.defineProperty(exports, "Row", { enumerable: true, get: function () { return Row_1.Row; } });
|
|
60
|
+
Object.defineProperty(exports, "RowAround", { enumerable: true, get: function () { return Row_1.RowAround; } });
|
|
61
|
+
Object.defineProperty(exports, "RowBetween", { enumerable: true, get: function () { return Row_1.RowBetween; } });
|
|
62
|
+
Object.defineProperty(exports, "RowCenter", { enumerable: true, get: function () { return Row_1.RowCenter; } });
|
|
63
|
+
Object.defineProperty(exports, "RowEnd", { enumerable: true, get: function () { return Row_1.RowEnd; } });
|
|
64
|
+
Object.defineProperty(exports, "RowEvenly", { enumerable: true, get: function () { return Row_1.RowEvenly; } });
|
|
65
|
+
Object.defineProperty(exports, "RowStart", { enumerable: true, get: function () { return Row_1.RowStart; } });
|
|
66
|
+
var Col_1 = require("./Flex/Col");
|
|
67
|
+
Object.defineProperty(exports, "Col", { enumerable: true, get: function () { return Col_1.Col; } });
|
|
68
|
+
Object.defineProperty(exports, "ColAround", { enumerable: true, get: function () { return Col_1.ColAround; } });
|
|
69
|
+
Object.defineProperty(exports, "ColBetween", { enumerable: true, get: function () { return Col_1.ColBetween; } });
|
|
70
|
+
Object.defineProperty(exports, "ColCenter", { enumerable: true, get: function () { return Col_1.ColCenter; } });
|
|
71
|
+
Object.defineProperty(exports, "ColEnd", { enumerable: true, get: function () { return Col_1.ColEnd; } });
|
|
72
|
+
Object.defineProperty(exports, "ColEvenly", { enumerable: true, get: function () { return Col_1.ColEvenly; } });
|
|
73
|
+
Object.defineProperty(exports, "ColStart", { enumerable: true, get: function () { return Col_1.ColStart; } });
|
|
74
|
+
var Countdowner_1 = require("./Countdowner");
|
|
75
|
+
Object.defineProperty(exports, "Countdowner", { enumerable: true, get: function () { return Countdowner_1.Countdowner; } });
|
|
76
|
+
var Overlay_1 = require("./Overlay");
|
|
77
|
+
Object.defineProperty(exports, "Overlay", { enumerable: true, get: function () { return Overlay_1.Overlay; } });
|
|
78
|
+
var Toast_1 = require("./Toast");
|
|
79
|
+
Object.defineProperty(exports, "showToast", { enumerable: true, get: function () { return Toast_1.showToast; } });
|
|
80
|
+
Object.defineProperty(exports, "showUniqToast", { enumerable: true, get: function () { return Toast_1.showUniqToast; } });
|
|
81
|
+
var Dialog_1 = require("./Dialog");
|
|
82
|
+
Object.defineProperty(exports, "showDialog", { enumerable: true, get: function () { return Dialog_1.showDialog; } });
|
|
83
|
+
var Clickable_1 = require("./Clickable");
|
|
84
|
+
Object.defineProperty(exports, "Clickable", { enumerable: true, get: function () { return Clickable_1.Clickable; } });
|
|
85
|
+
var Indicator_1 = require("./Indicator");
|
|
86
|
+
Object.defineProperty(exports, "Indicator", { enumerable: true, get: function () { return Indicator_1.Indicator; } });
|
|
87
|
+
var Loading_1 = require("./Loading");
|
|
88
|
+
Object.defineProperty(exports, "showLoading", { enumerable: true, get: function () { return Loading_1.showLoading; } });
|
|
89
|
+
Object.defineProperty(exports, "showLoadingAtLeast", { enumerable: true, get: function () { return Loading_1.showLoadingAtLeast; } });
|
|
90
|
+
var SafeArea_1 = require("./SafeArea");
|
|
91
|
+
Object.defineProperty(exports, "SafeArea", { enumerable: true, get: function () { return SafeArea_1.SafeArea; } });
|
|
92
|
+
var AutoGrid_1 = require("./AutoGrid");
|
|
93
|
+
Object.defineProperty(exports, "AutoGrid", { enumerable: true, get: function () { return AutoGrid_1.AutoGrid; } });
|
|
94
|
+
var Alert_1 = require("./Alert");
|
|
95
|
+
Object.defineProperty(exports, "showAlert", { enumerable: true, get: function () { return Alert_1.showAlert; } });
|
|
96
|
+
var ScrollView_1 = require("./ScrollView");
|
|
97
|
+
Object.defineProperty(exports, "ScrollView", { enumerable: true, get: function () { return ScrollView_1.ScrollView; } });
|
|
98
|
+
var CarouselNotice_1 = require("./CarouselNotice");
|
|
99
|
+
Object.defineProperty(exports, "CarouselNotice", { enumerable: true, get: function () { return CarouselNotice_1.CarouselNotice; } });
|
|
100
|
+
var CitySelect_1 = require("./CitySelect");
|
|
101
|
+
Object.defineProperty(exports, "CitySelect", { enumerable: true, get: function () { return CitySelect_1.CitySelect; } });
|
|
102
|
+
Object.defineProperty(exports, "showCitySelect", { enumerable: true, get: function () { return CitySelect_1.showCitySelect; } });
|
package/build/utils/Countdown.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Countdown = void 0;
|
|
4
|
+
const tick_1 = require("./tick");
|
|
5
|
+
class Countdown {
|
|
3
6
|
constructor(option) {
|
|
4
7
|
/**
|
|
5
8
|
* 倒计时的剩余时间,单位为秒
|
|
@@ -61,7 +64,7 @@ export class Countdown {
|
|
|
61
64
|
// 记录倒计时开启时的时间
|
|
62
65
|
const start = Date.now();
|
|
63
66
|
// 使用 1000ms 间隔,避免每帧都执行(性能优化)
|
|
64
|
-
this._stopTick = tick(() => {
|
|
67
|
+
this._stopTick = (0, tick_1.tick)(() => {
|
|
65
68
|
var _a, _b, _c, _d;
|
|
66
69
|
// 获取倒计时已经持续的时间
|
|
67
70
|
const duration = Math.floor((Date.now() - start) / 1000);
|
|
@@ -121,3 +124,4 @@ export class Countdown {
|
|
|
121
124
|
return result;
|
|
122
125
|
}
|
|
123
126
|
}
|
|
127
|
+
exports.Countdown = Countdown;
|
package/build/utils/ago.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
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.ago = ago;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
2
8
|
/**
|
|
3
9
|
* 用于格式化显示:多久以前
|
|
4
10
|
* @param date
|
|
5
11
|
*/
|
|
6
|
-
|
|
7
|
-
const now =
|
|
8
|
-
const input =
|
|
12
|
+
function ago(date) {
|
|
13
|
+
const now = (0, dayjs_1.default)();
|
|
14
|
+
const input = (0, dayjs_1.default)(date);
|
|
9
15
|
if (!input.isValid()) {
|
|
10
16
|
return {
|
|
11
17
|
num: 0,
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
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.calendarTable = calendarTable;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
2
8
|
/**
|
|
3
9
|
* 创建一个月历视图的原始数据表
|
|
4
10
|
* @param usefulFormat dayjs构造函数可以识别的任意值
|
|
5
11
|
* @param startFromSunday 是否以星期天作为一周的第一天
|
|
6
12
|
* @param sizeGuarantee 是否保证生成表格始终有6行
|
|
7
13
|
*/
|
|
8
|
-
|
|
9
|
-
const value =
|
|
14
|
+
function calendarTable(usefulFormat = (0, dayjs_1.default)(), startFromSunday = false, sizeGuarantee = true) {
|
|
15
|
+
const value = (0, dayjs_1.default)(usefulFormat);
|
|
10
16
|
const startOfMonth = value.startOf("month");
|
|
11
17
|
const endOfMonth = value.endOf("month");
|
|
12
18
|
const monthStartDay = startOfMonth.date();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { History } from "history";
|
|
3
3
|
import { ContainerProps } from "../Container";
|
|
4
|
-
import { ContextValue } from "../context";
|
|
5
4
|
export type RouterMode = "browser" | "hash" | "memory";
|
|
6
5
|
export type AwaitValue<T> = T | Promise<T>;
|
|
7
|
-
export interface CreateAppOption extends Omit<ContainerProps, "children"
|
|
6
|
+
export interface CreateAppOption extends Omit<ContainerProps, "children"> {
|
|
8
7
|
onBefore?: (pathname: string) => AwaitValue<void>;
|
|
9
8
|
onAfter?: (pathname: string) => AwaitValue<void>;
|
|
10
9
|
loading?: (pathname: string) => AwaitValue<React.ReactNode>;
|
package/build/utils/createApp.js
CHANGED
|
@@ -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,32 +8,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
9
|
});
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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.history = void 0;
|
|
16
|
+
exports.getHistory = getHistory;
|
|
17
|
+
exports.createApp = createApp;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const client_1 = require("react-dom/client");
|
|
21
|
+
const history_1 = require("history");
|
|
22
|
+
const Container_1 = require("../Container");
|
|
23
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
17
24
|
// 存储历史记录对象
|
|
18
|
-
|
|
25
|
+
exports.history = null;
|
|
19
26
|
// 获取历史记录对象
|
|
20
|
-
|
|
21
|
-
if (history === null) {
|
|
27
|
+
function getHistory(mode = "browser") {
|
|
28
|
+
if (exports.history === null) {
|
|
22
29
|
const createMap = {
|
|
23
|
-
browser: createBrowserHistory,
|
|
24
|
-
hash: createHashHistory,
|
|
25
|
-
memory: createMemoryHistory,
|
|
30
|
+
browser: history_1.createBrowserHistory,
|
|
31
|
+
hash: history_1.createHashHistory,
|
|
32
|
+
memory: history_1.createMemoryHistory,
|
|
26
33
|
};
|
|
27
|
-
history = createMap[mode]();
|
|
34
|
+
exports.history = createMap[mode]();
|
|
28
35
|
}
|
|
29
|
-
return history;
|
|
36
|
+
return exports.history;
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
32
39
|
* 创建带路由的APP对象,全局对象,绝大部分情况下只需要调用一次
|
|
33
40
|
* @param option CreateAppOption
|
|
34
41
|
*/
|
|
35
|
-
|
|
42
|
+
function createApp(option) {
|
|
36
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
44
|
// 设置默认的路由方式
|
|
38
45
|
if (!option.mode ||
|
|
@@ -44,16 +51,13 @@ export function createApp(option) {
|
|
|
44
51
|
option.default = "/index";
|
|
45
52
|
}
|
|
46
53
|
// 这里是为了确保历史记录对象在组件渲染之前一定存在
|
|
47
|
-
history = getHistory(option.mode);
|
|
54
|
+
exports.history = getHistory(option.mode);
|
|
48
55
|
// 提取关键数据
|
|
49
|
-
const
|
|
50
|
-
const containerProps = pick(option, [
|
|
56
|
+
const containerProps = (0, pick_1.default)(option, [
|
|
51
57
|
"designWidth",
|
|
52
58
|
"globalStyle",
|
|
53
59
|
]);
|
|
54
60
|
const { onBefore, onAfter, loading, render, notFound } = option;
|
|
55
|
-
// 设置上下文属性
|
|
56
|
-
setContextValue(context);
|
|
57
61
|
// 规范化路径:移除首尾斜杠
|
|
58
62
|
const PATH_TRIM_REGEX = /^\/*|\/*$/g;
|
|
59
63
|
const normalizePath = (path) => {
|
|
@@ -65,11 +69,11 @@ export function createApp(option) {
|
|
|
65
69
|
* @returns
|
|
66
70
|
*/
|
|
67
71
|
const App = () => {
|
|
68
|
-
const [page, setPage] = useState(null);
|
|
72
|
+
const [page, setPage] = (0, react_1.useState)(null);
|
|
69
73
|
/**
|
|
70
74
|
* 加载并渲染页面
|
|
71
75
|
*/
|
|
72
|
-
const loadAndRenderPage = useCallback((pathname) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const loadAndRenderPage = (0, react_1.useCallback)((pathname) => __awaiter(this, void 0, void 0, function* () {
|
|
73
77
|
const normalizedPath = normalizePath(pathname);
|
|
74
78
|
// 如果有 loading 占位符,先显示
|
|
75
79
|
if (typeof loading === "function") {
|
|
@@ -88,7 +92,7 @@ export function createApp(option) {
|
|
|
88
92
|
}
|
|
89
93
|
else {
|
|
90
94
|
// 默认 404 页面
|
|
91
|
-
setPage(
|
|
95
|
+
setPage((0, jsx_runtime_1.jsxs)("div", { children: ["Not Found: ", normalizedPath] }));
|
|
92
96
|
}
|
|
93
97
|
return;
|
|
94
98
|
}
|
|
@@ -100,7 +104,7 @@ export function createApp(option) {
|
|
|
100
104
|
setPage(yield notFound(normalizedPath));
|
|
101
105
|
}
|
|
102
106
|
else {
|
|
103
|
-
setPage(
|
|
107
|
+
setPage((0, jsx_runtime_1.jsxs)("div", { children: ["Not Found: ", normalizedPath] }));
|
|
104
108
|
}
|
|
105
109
|
return;
|
|
106
110
|
}
|
|
@@ -114,17 +118,17 @@ export function createApp(option) {
|
|
|
114
118
|
/**
|
|
115
119
|
* 监听路由变化
|
|
116
120
|
*/
|
|
117
|
-
useEffect(() => {
|
|
121
|
+
(0, react_1.useEffect)(() => {
|
|
118
122
|
// 监听页面变化,一旦变化渲染新页面
|
|
119
|
-
const unlisten = history.listen(({ location }) => {
|
|
123
|
+
const unlisten = exports.history.listen(({ location }) => {
|
|
120
124
|
loadAndRenderPage(location.pathname);
|
|
121
125
|
});
|
|
122
126
|
// 初始化时渲染当前路径对应的页面
|
|
123
|
-
loadAndRenderPage(history.location.pathname);
|
|
127
|
+
loadAndRenderPage(exports.history.location.pathname);
|
|
124
128
|
// 卸载时,取消监听
|
|
125
129
|
return unlisten;
|
|
126
130
|
}, [loadAndRenderPage]);
|
|
127
|
-
return
|
|
131
|
+
return (0, jsx_runtime_1.jsx)(Container_1.Container, Object.assign({}, containerProps, { children: page }));
|
|
128
132
|
};
|
|
129
133
|
// 获取挂载对象
|
|
130
134
|
let mount = null;
|
|
@@ -137,7 +141,7 @@ export function createApp(option) {
|
|
|
137
141
|
if (!mount) {
|
|
138
142
|
throw new Error(`Mount target not found: ${typeof option.target === "string" ? option.target : "invalid element"}`);
|
|
139
143
|
}
|
|
140
|
-
const root = createRoot(mount);
|
|
141
|
-
root.render(
|
|
144
|
+
const root = (0, client_1.createRoot)(mount);
|
|
145
|
+
root.render((0, jsx_runtime_1.jsx)(App, {}));
|
|
142
146
|
});
|
|
143
147
|
}
|
package/build/utils/cssUtil.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Interpolation, Theme } from '@emotion/react';
|
|
2
1
|
/**
|
|
3
2
|
* 匹配所有的CSS数值类型的值
|
|
4
3
|
*/
|
|
@@ -32,11 +31,3 @@ export interface SplitedValue {
|
|
|
32
31
|
* @param defaultUnit
|
|
33
32
|
*/
|
|
34
33
|
export declare function splitValue(value: number | string, defaultUnit?: string): SplitedValue;
|
|
35
|
-
/**
|
|
36
|
-
* 生成自适应的样式,仅供库内部使用
|
|
37
|
-
* 所有内部组件的默认设计尺寸约定为750
|
|
38
|
-
*
|
|
39
|
-
* @param style
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
export declare function adaptive(style: Record<string, Interpolation<Theme>>): import("@emotion/react").SerializedStyles;
|
package/build/utils/cssUtil.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CSSValueReg = void 0;
|
|
4
|
+
exports.normalizeUnit = normalizeUnit;
|
|
5
|
+
exports.splitValue = splitValue;
|
|
3
6
|
/**
|
|
4
7
|
* 匹配所有的CSS数值类型的值
|
|
5
8
|
*/
|
|
6
9
|
// eslint-disable-next-line no-useless-escape
|
|
7
|
-
|
|
10
|
+
exports.CSSValueReg = /^((?:\-)?(?:\d+\.?|\.\d+|\d+\.\d+))([a-zA-Z%]*)$/;
|
|
8
11
|
/**
|
|
9
12
|
* 标准化长度值单位
|
|
10
13
|
* @param value 长度值
|
|
11
14
|
* @param defaultUnit 默认长度值单位
|
|
12
15
|
*/
|
|
13
|
-
|
|
16
|
+
function normalizeUnit(value, defaultUnit = 'px') {
|
|
14
17
|
if (typeof value === 'number') {
|
|
15
18
|
return value + defaultUnit;
|
|
16
19
|
}
|
|
17
20
|
if (typeof value === 'string') {
|
|
18
|
-
const result = value.match(CSSValueReg);
|
|
21
|
+
const result = value.match(exports.CSSValueReg);
|
|
19
22
|
if (Array.isArray(result)) {
|
|
20
23
|
return result[2]
|
|
21
24
|
? parseFloat(value) + result[2]
|
|
@@ -39,51 +42,15 @@ export function normalizeUnit(value, defaultUnit = 'px') {
|
|
|
39
42
|
* @param value
|
|
40
43
|
* @param defaultUnit
|
|
41
44
|
*/
|
|
42
|
-
|
|
45
|
+
function splitValue(value, defaultUnit = 'px') {
|
|
43
46
|
if (typeof value === 'number') {
|
|
44
47
|
return { num: value, unit: defaultUnit };
|
|
45
48
|
}
|
|
46
49
|
if (typeof value === 'string') {
|
|
47
|
-
const result = value.match(CSSValueReg);
|
|
50
|
+
const result = value.match(exports.CSSValueReg);
|
|
48
51
|
if (Array.isArray(result)) {
|
|
49
52
|
return { num: parseFloat(result[1]), unit: result[2] || defaultUnit };
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
throw new Error('Invalid numeric format');
|
|
53
56
|
}
|
|
54
|
-
/**
|
|
55
|
-
* 生成自适应的样式,仅供库内部使用
|
|
56
|
-
* 所有内部组件的默认设计尺寸约定为750
|
|
57
|
-
*
|
|
58
|
-
* @param style
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
export function adaptive(style) {
|
|
62
|
-
const ctx = getContextValue();
|
|
63
|
-
const max = {};
|
|
64
|
-
const min = {};
|
|
65
|
-
const normal = {};
|
|
66
|
-
for (let name in style) {
|
|
67
|
-
let value = style[name];
|
|
68
|
-
if (typeof value !== 'number') {
|
|
69
|
-
normal[name] = value;
|
|
70
|
-
}
|
|
71
|
-
else if ([
|
|
72
|
-
'flex',
|
|
73
|
-
'flexGrow',
|
|
74
|
-
'flexShrink',
|
|
75
|
-
'lineHeight',
|
|
76
|
-
'fontWeight',
|
|
77
|
-
'zIndex',
|
|
78
|
-
].includes(name) &&
|
|
79
|
-
typeof value === 'number') {
|
|
80
|
-
normal[name] = value;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
normal[name] = (value * 100) / 750 + 'vw';
|
|
84
|
-
max[name] = (value * ctx.maxDocWidth) / 750 + 'px';
|
|
85
|
-
min[name] = (value * ctx.minDocWidth) / 750 + 'px';
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return css(Object.assign(Object.assign({}, normal), { [`@media (min-width: ${ctx.maxDocWidth}px)`]: max, [`@media (max-width: ${ctx.minDocWidth}px)`]: min }));
|
|
89
|
-
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultScroll = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* 触摸移动事件处理器
|
|
3
6
|
*/
|
|
@@ -11,7 +14,7 @@ const touchMoveHandler = (event) => {
|
|
|
11
14
|
* 默认视为 passive: true,此时 preventDefault() 会静默失效。
|
|
12
15
|
* 因此必须显式声明 passive: false 才能真正阻止默认滚动行为。
|
|
13
16
|
*/
|
|
14
|
-
|
|
17
|
+
exports.defaultScroll = {
|
|
15
18
|
disable() {
|
|
16
19
|
document.documentElement.addEventListener('touchmove', touchMoveHandler, { capture: false, passive: false });
|
|
17
20
|
},
|