@cniot/android-pda-components 0.0.34 → 0.1.3
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/build/assets/index.5b9ffba3.js +372 -0
- package/build/assets/index.cd5db7bf.css +1 -0
- package/build/assets/vendor.1a748dfd.js +38 -0
- package/build/index.html +3 -3
- package/change.md +15 -0
- package/doc/index.jsx +22 -8
- package/es/index.cjs.js +2 -2
- package/es/index.es.js +417 -3838
- package/es/style.css +1 -1
- package/package.json +2 -3
- package/vite.config.doc.js +8 -0
- package/vite.config.js +0 -16
- package/build/assets/index.c5691218.css +0 -1
- package/build/assets/index.f4cdaf13.js +0 -318
- package/build/assets/vendor.1ac3b6a0.js +0 -38
- package/test/.gsignore +0 -6
- package/test/META-INF/MANIFEST.MF +0 -8
- package/test/README.md +0 -29
- package/test/_vite_plugins/autoRegisterPages.js +0 -35
- package/test/_vite_plugins/importCustomLib.js +0 -17
- package/test/_vite_plugins/insertMeta2html.js +0 -64
- package/test/config/pre/pageflow.xml +0 -51
- package/test/config/prod/pageflow.xml +0 -41
- package/test/package.json +0 -22
- package/test/pageflow.prog +0 -4
- package/test/src/gs/api.gs +0 -38
- package/test/src/gs/context.gs +0 -13
- package/test/src/gs/lib/common.gs +0 -35
- package/test/src/gs/lib/flow.gs +0 -206
- package/test/src/gs/lib/request.gs +0 -93
- package/test/src/gs/start.gs +0 -116
- package/test/src/web/index.html +0 -40
- package/test/src/web/index.jsx +0 -53
- package/test/src/web/pages/index/index.jsx +0 -47
- package/test/src/web/pages/index/index.less +0 -0
- package/test/src/web/pages/rfidOnce/index.jsx +0 -57
- package/test/src/web/pages/rfidOnce/index.less +0 -0
- package/test/src/web/pages/rfidScan/index.jsx +0 -45
- package/test/src/web/pages/success/index.jsx +0 -36
- package/test/src/web/pages/success/index.less +0 -0
- package/test/src/web/system/index-android-pda.jsx +0 -71
- package/test/src/web/system/index-pc.jsx +0 -24
- package/test/src/web/utils/index.js +0 -4
- package/test/vite.config.js +0 -27
package/es/index.es.js
CHANGED
|
@@ -30,38 +30,8 @@ var __publicField = (obj, key, value) => {
|
|
|
30
30
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
31
|
return value;
|
|
32
32
|
};
|
|
33
|
-
import
|
|
34
|
-
|
|
35
|
-
import { unstable_batchedUpdates } from "react-dom";
|
|
36
|
-
var global$1 = "";
|
|
37
|
-
var index$k = "";
|
|
38
|
-
function getTypeClass$1(type) {
|
|
39
|
-
return {
|
|
40
|
-
"center": "op-overlay center",
|
|
41
|
-
"top": "op-overlay top",
|
|
42
|
-
"bottom": "op-overlay bottom"
|
|
43
|
-
}[type] || "op-overlay";
|
|
44
|
-
}
|
|
45
|
-
function Overlay(props) {
|
|
46
|
-
const { verticalPosition = "center", visible = true, closable = false, onClosed = () => {
|
|
47
|
-
} } = props;
|
|
48
|
-
const [hidden, setHidden2] = useState(!visible);
|
|
49
|
-
const option = {};
|
|
50
|
-
if (closable) {
|
|
51
|
-
option.onClick = (e) => {
|
|
52
|
-
setHidden2(true);
|
|
53
|
-
onClosed();
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
setHidden2(!visible);
|
|
58
|
-
}, [visible]);
|
|
59
|
-
return !hidden ? /* @__PURE__ */ React__default.createElement("div", __spreadValues({
|
|
60
|
-
className: getTypeClass$1(verticalPosition)
|
|
61
|
-
}, option), props.children) : null;
|
|
62
|
-
}
|
|
63
|
-
var index$j = "";
|
|
64
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
33
|
+
import React, { useState, useEffect, useRef, cloneElement, useCallback } from "react";
|
|
34
|
+
var global = "";
|
|
65
35
|
var _classnames_2_3_1_classnames = { exports: {} };
|
|
66
36
|
/*!
|
|
67
37
|
Copyright (c) 2018 Jed Watson.
|
|
@@ -110,31 +80,36 @@ var _classnames_2_3_1_classnames = { exports: {} };
|
|
|
110
80
|
})();
|
|
111
81
|
})(_classnames_2_3_1_classnames);
|
|
112
82
|
var classNames = _classnames_2_3_1_classnames.exports;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
className: classNames({ [className]: true, "pda-button": true, [buttonType]: true }),
|
|
121
|
-
style,
|
|
122
|
-
onClick
|
|
123
|
-
}, this.props.children);
|
|
124
|
-
}
|
|
83
|
+
var index$m = "";
|
|
84
|
+
function getTypeClass$1(type) {
|
|
85
|
+
return {
|
|
86
|
+
"center": "op-overlay center",
|
|
87
|
+
"top": "op-overlay top",
|
|
88
|
+
"bottom": "op-overlay bottom"
|
|
89
|
+
}[type] || "op-overlay";
|
|
125
90
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
91
|
+
function Overlay(props) {
|
|
92
|
+
const { verticalPosition = "center", visible = true, closable = false, onClosed = () => {
|
|
93
|
+
} } = props;
|
|
94
|
+
const [hidden, setHidden] = useState(!visible);
|
|
95
|
+
const option = {};
|
|
96
|
+
if (closable) {
|
|
97
|
+
option.onClick = (e) => {
|
|
98
|
+
setHidden(true);
|
|
99
|
+
onClosed();
|
|
100
|
+
};
|
|
131
101
|
}
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
setHidden(!visible);
|
|
104
|
+
}, [visible]);
|
|
105
|
+
return !hidden ? /* @__PURE__ */ React.createElement("div", __spreadValues({
|
|
106
|
+
className: getTypeClass$1(verticalPosition)
|
|
107
|
+
}, option), props.children) : null;
|
|
132
108
|
}
|
|
133
|
-
|
|
134
|
-
var index$i = "";
|
|
109
|
+
var index$l = "";
|
|
135
110
|
const blankFunc$5 = () => {
|
|
136
111
|
};
|
|
137
|
-
class PdaTitle extends
|
|
112
|
+
class PdaTitle extends React.Component {
|
|
138
113
|
constructor(props) {
|
|
139
114
|
super(props);
|
|
140
115
|
__publicField(this, "state", {
|
|
@@ -144,92 +119,147 @@ class PdaTitle extends React__default.Component {
|
|
|
144
119
|
render() {
|
|
145
120
|
const { className, goBack = true, goBackHandle = blankFunc$5, icon = "scan", title = "\u4EFB\u52A1", menuList = null } = this.props;
|
|
146
121
|
const { showMenu } = this.state;
|
|
147
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
148
123
|
className: classNames({ [className]: true, "pda-header": true })
|
|
149
|
-
}, /* @__PURE__ */
|
|
124
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
150
125
|
className: "header-click-area",
|
|
151
126
|
onClick: goBack ? goBackHandle : blankFunc$5
|
|
152
|
-
}, goBack && /* @__PURE__ */
|
|
127
|
+
}, goBack && /* @__PURE__ */ React.createElement("div", {
|
|
153
128
|
className: "pda-goback"
|
|
154
|
-
}), icon && /* @__PURE__ */
|
|
129
|
+
}), icon && /* @__PURE__ */ React.createElement("div", {
|
|
155
130
|
className: classNames({ "pda-header-icon": true, ["pda-header-icon-" + icon]: true })
|
|
156
|
-
})), /* @__PURE__ */
|
|
131
|
+
})), /* @__PURE__ */ React.createElement("p", {
|
|
157
132
|
className: classNames({ "pda-title-text": true })
|
|
158
|
-
}, title), menuList ? /* @__PURE__ */
|
|
133
|
+
}, title), menuList ? /* @__PURE__ */ React.createElement("div", {
|
|
159
134
|
className: "pda-header-more",
|
|
160
135
|
onClick: (e) => {
|
|
161
136
|
this.setState({ showMenu: true });
|
|
162
137
|
}
|
|
163
|
-
}) : null, /* @__PURE__ */
|
|
138
|
+
}) : null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
164
139
|
visible: showMenu,
|
|
165
140
|
verticalPosition: "bottom",
|
|
166
141
|
closable: true,
|
|
167
142
|
onClosed: (e) => this.setState({ showMenu: false })
|
|
168
|
-
}, /* @__PURE__ */
|
|
143
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
169
144
|
className: "pda-menus"
|
|
170
145
|
}, menuList)));
|
|
171
146
|
}
|
|
172
147
|
}
|
|
148
|
+
var index$k = "";
|
|
149
|
+
function Button(props) {
|
|
150
|
+
const { type = "default", onClick, className = "" } = props;
|
|
151
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
152
|
+
className: `pda-button pda-button-${type} ${className}`,
|
|
153
|
+
onClick
|
|
154
|
+
}, props.children);
|
|
155
|
+
}
|
|
156
|
+
function ButtonGroup(props) {
|
|
157
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
158
|
+
className: "button-group"
|
|
159
|
+
}, props.children);
|
|
160
|
+
}
|
|
161
|
+
Button.Group = ButtonGroup;
|
|
162
|
+
var index$j = "";
|
|
163
|
+
const empty$2 = () => {
|
|
164
|
+
};
|
|
165
|
+
function index$i(props) {
|
|
166
|
+
const { onBack, icon, title, menus = [], onClickMenuItem = empty$2, cancelMenuText } = props;
|
|
167
|
+
const [showMenus, setShowMenus] = React.useState(false);
|
|
168
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
169
|
+
className: "pda-header"
|
|
170
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
171
|
+
className: "header-click-area"
|
|
172
|
+
}, onBack ? /* @__PURE__ */ React.createElement("div", {
|
|
173
|
+
className: "pda-goback",
|
|
174
|
+
onClick: () => onBack("back")
|
|
175
|
+
}) : null, icon && /* @__PURE__ */ React.createElement("div", {
|
|
176
|
+
className: `pda-header-icon pda-header-icon-${icon}`
|
|
177
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
178
|
+
className: "pda-title-text"
|
|
179
|
+
}, title), menus && menus.length ? /* @__PURE__ */ React.createElement("div", {
|
|
180
|
+
className: "pda-header-more",
|
|
181
|
+
onClick: () => setShowMenus(true)
|
|
182
|
+
}) : null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
183
|
+
visible: showMenus,
|
|
184
|
+
verticalPosition: "bottom",
|
|
185
|
+
closable: false,
|
|
186
|
+
onClosed: () => setShowMenus(false)
|
|
187
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
188
|
+
className: "pda-menus"
|
|
189
|
+
}, menus.map((item, index2) => {
|
|
190
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
191
|
+
onClick: () => {
|
|
192
|
+
setShowMenus(false);
|
|
193
|
+
onClickMenuItem(item);
|
|
194
|
+
},
|
|
195
|
+
key: item.key || index2
|
|
196
|
+
}, item.label);
|
|
197
|
+
}), cancelMenuText ? /* @__PURE__ */ React.createElement("div", {
|
|
198
|
+
style: { marginTop: 20 }
|
|
199
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
200
|
+
onClick: () => setShowMenus(false)
|
|
201
|
+
}, cancelMenuText)) : null)));
|
|
202
|
+
}
|
|
173
203
|
var index$h = "";
|
|
174
|
-
class PdaInfoCard$2 extends
|
|
204
|
+
class PdaInfoCard$2 extends React.Component {
|
|
175
205
|
constructor(props) {
|
|
176
206
|
super(props);
|
|
177
207
|
}
|
|
178
208
|
render() {
|
|
179
209
|
const { className = "", title, highlightInfo, subTitle, subHighlightInfo, subHighlightSubInfo, infoImage, tagText, highlightInfoCN, highlightSubInfo, percentage, highlightSubInfoCN, boldInfo, infoList = [], style = {}, theme = "light" } = this.props;
|
|
180
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
181
211
|
className: classNames({ [className]: true, "pda-info-card": true, "pda-info-card-dark": theme === "dark" }),
|
|
182
212
|
style
|
|
183
|
-
}, /* @__PURE__ */
|
|
213
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
184
214
|
className: "pda-info-card-title-section"
|
|
185
|
-
}, /* @__PURE__ */
|
|
215
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
186
216
|
className: "pda-info-card-title"
|
|
187
|
-
}, title), tagText ? /* @__PURE__ */
|
|
217
|
+
}, title), tagText ? /* @__PURE__ */ React.createElement("div", {
|
|
188
218
|
className: "pda-info-card-tag"
|
|
189
|
-
}, /* @__PURE__ */
|
|
219
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
190
220
|
className: "pda-info-card-tag-text"
|
|
191
|
-
}, tagText)) : null), /* @__PURE__ */
|
|
221
|
+
}, tagText)) : null), /* @__PURE__ */ React.createElement("div", {
|
|
192
222
|
className: "pda-info-card-highlight-section"
|
|
193
|
-
}, /* @__PURE__ */
|
|
223
|
+
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", {
|
|
194
224
|
className: "pda-info-card-highlight"
|
|
195
|
-
}, /* @__PURE__ */
|
|
225
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
196
226
|
className: "pda-info-card-highlight1"
|
|
197
|
-
}, highlightInfo), /* @__PURE__ */
|
|
227
|
+
}, highlightInfo), /* @__PURE__ */ React.createElement("span", {
|
|
198
228
|
className: "pda-info-card-highlight1CN"
|
|
199
|
-
}, highlightInfoCN), /* @__PURE__ */
|
|
229
|
+
}, highlightInfoCN), /* @__PURE__ */ React.createElement("span", {
|
|
200
230
|
className: "pda-info-card-highlight2"
|
|
201
|
-
}, highlightSubInfo), /* @__PURE__ */
|
|
231
|
+
}, highlightSubInfo), /* @__PURE__ */ React.createElement("span", {
|
|
202
232
|
className: "pda-info-card-highlight2CN"
|
|
203
|
-
}, highlightSubInfoCN)), subTitle ? /* @__PURE__ */
|
|
233
|
+
}, highlightSubInfoCN)), subTitle ? /* @__PURE__ */ React.createElement("div", {
|
|
204
234
|
className: "pda-info-card-title"
|
|
205
|
-
}, subTitle) : null, subHighlightInfo ? /* @__PURE__ */
|
|
235
|
+
}, subTitle) : null, subHighlightInfo ? /* @__PURE__ */ React.createElement("div", {
|
|
206
236
|
className: "pda-info-card-highlight"
|
|
207
|
-
}, /* @__PURE__ */
|
|
237
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
208
238
|
className: "pda-info-card-highlight1"
|
|
209
|
-
}, subHighlightInfo), /* @__PURE__ */
|
|
239
|
+
}, subHighlightInfo), /* @__PURE__ */ React.createElement("span", {
|
|
210
240
|
className: "pda-info-card-highlight2"
|
|
211
|
-
}, subHighlightSubInfo)) : null), infoImage ? /* @__PURE__ */
|
|
241
|
+
}, subHighlightSubInfo)) : null), infoImage ? /* @__PURE__ */ React.createElement("img", {
|
|
212
242
|
src: infoImage,
|
|
213
243
|
width: 150,
|
|
214
244
|
height: 150
|
|
215
|
-
}) : null), percentage !== void 0 ? /* @__PURE__ */
|
|
245
|
+
}) : null), percentage !== void 0 ? /* @__PURE__ */ React.createElement("div", {
|
|
216
246
|
className: "pda-info-card-progress"
|
|
217
|
-
}, /* @__PURE__ */
|
|
247
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
218
248
|
className: "pda-info-card-progress-inside",
|
|
219
249
|
style: { width: `${percentage * 100}%` }
|
|
220
|
-
})) : null, /* @__PURE__ */
|
|
250
|
+
})) : null, /* @__PURE__ */ React.createElement("div", {
|
|
221
251
|
className: "pda-info-card-bold"
|
|
222
252
|
}, boldInfo), infoList.map((item, index2) => {
|
|
223
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
224
254
|
key: index2,
|
|
225
255
|
className: "pda-info-card-list"
|
|
226
|
-
}, /* @__PURE__ */
|
|
256
|
+
}, /* @__PURE__ */ React.createElement("span", null, item.label || ""), "\xA0\xA0", /* @__PURE__ */ React.createElement("span", null, item.content || ""));
|
|
227
257
|
}));
|
|
228
258
|
}
|
|
229
259
|
}
|
|
230
260
|
PdaInfoCard$2.IMAGE_1 = "https://img.alicdn.com/imgextra/i2/O1CN01qYuxip1ME9zhdL9XG_!!6000000001402-2-tps-150-150.png";
|
|
231
261
|
var index$g = "";
|
|
232
|
-
class PdaListItem extends
|
|
262
|
+
class PdaListItem extends React.Component {
|
|
233
263
|
constructor(props) {
|
|
234
264
|
super(props);
|
|
235
265
|
}
|
|
@@ -238,38 +268,38 @@ class PdaListItem extends React__default.Component {
|
|
|
238
268
|
}, onHeightLightClick = () => {
|
|
239
269
|
}, onIconClick = () => {
|
|
240
270
|
}, highlightText, highlightSubText, stateTextList = [], stateList = [], subInfoList = [], style = {}, icon } = this.props;
|
|
241
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
242
272
|
className: classNames({ [className]: true, "pda-list-item": true }),
|
|
243
273
|
style,
|
|
244
274
|
onClick
|
|
245
|
-
}, /* @__PURE__ */
|
|
275
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
246
276
|
className: "pda-listitem-header"
|
|
247
|
-
}, header), /* @__PURE__ */
|
|
277
|
+
}, header), /* @__PURE__ */ React.createElement("div", {
|
|
248
278
|
onClick: onHeightLightClick,
|
|
249
279
|
className: "pda-listitem-highlight"
|
|
250
|
-
}, /* @__PURE__ */
|
|
280
|
+
}, /* @__PURE__ */ React.createElement("div", null, highlightText), /* @__PURE__ */ React.createElement("div", null, highlightSubText)), /* @__PURE__ */ React.createElement("div", {
|
|
251
281
|
className: "pda-listitem-state-text"
|
|
252
282
|
}, stateTextList.map((item, index2) => {
|
|
253
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
254
284
|
key: index2
|
|
255
285
|
}, item.label || "", "\uFF5C");
|
|
256
|
-
})), /* @__PURE__ */
|
|
286
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
257
287
|
className: "pda-listitem-state-block"
|
|
258
288
|
}, stateList.map((item, index2) => {
|
|
259
289
|
const type = item && item.type ? item.type : "default";
|
|
260
|
-
return /* @__PURE__ */
|
|
290
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
261
291
|
key: index2,
|
|
262
292
|
className: type
|
|
263
293
|
}, item.label || "");
|
|
264
294
|
})), subInfoList.map((item, index2) => {
|
|
265
|
-
return /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
266
296
|
key: index2,
|
|
267
297
|
className: "pda-listitem-subinfo"
|
|
268
|
-
}, /* @__PURE__ */
|
|
269
|
-
}), icon ? /* @__PURE__ */
|
|
298
|
+
}, /* @__PURE__ */ React.createElement("span", null, item.label || ""), "\xA0\xA0", /* @__PURE__ */ React.createElement("span", null, item.content || ""));
|
|
299
|
+
}), icon ? /* @__PURE__ */ React.createElement("div", {
|
|
270
300
|
onClick: onIconClick,
|
|
271
301
|
className: "pda-listitem-icon"
|
|
272
|
-
}, /* @__PURE__ */
|
|
302
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
273
303
|
className: classNames({ "listitem-icon-container": true, ["listitem-icon-" + icon]: true })
|
|
274
304
|
})) : null);
|
|
275
305
|
}
|
|
@@ -279,25 +309,25 @@ function empty$1() {
|
|
|
279
309
|
}
|
|
280
310
|
function Confirm$1(props) {
|
|
281
311
|
const { title = "title", message = null, subMessage = [], okText = "okText", cancelText = null, onClick = empty$1, type = "primary" } = props;
|
|
282
|
-
return /* @__PURE__ */
|
|
312
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
283
313
|
className: classNames({ "confirm-wrap": true, ["confirm-" + type]: true })
|
|
284
|
-
}, /* @__PURE__ */
|
|
314
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
285
315
|
className: "confirm-title"
|
|
286
|
-
}, title), message ? /* @__PURE__ */
|
|
316
|
+
}, title), message ? /* @__PURE__ */ React.createElement("div", {
|
|
287
317
|
className: "confirm-message"
|
|
288
|
-
}, message) : null, subMessage.length ? /* @__PURE__ */
|
|
318
|
+
}, message) : null, subMessage.length ? /* @__PURE__ */ React.createElement("div", {
|
|
289
319
|
className: "confirm-sub-message"
|
|
290
320
|
}, subMessage.map((item, index2) => {
|
|
291
|
-
return /* @__PURE__ */
|
|
321
|
+
return /* @__PURE__ */ React.createElement("p", {
|
|
292
322
|
key: index2,
|
|
293
323
|
className: "pda-listitem-subinfo"
|
|
294
|
-
}, /* @__PURE__ */
|
|
295
|
-
})) : null, /* @__PURE__ */
|
|
324
|
+
}, /* @__PURE__ */ React.createElement("span", null, item.label || ""), ":\xA0", /* @__PURE__ */ React.createElement("span", null, item.content || ""));
|
|
325
|
+
})) : null, /* @__PURE__ */ React.createElement("div", {
|
|
296
326
|
className: "confirm-btns"
|
|
297
|
-
}, cancelText ? /* @__PURE__ */
|
|
327
|
+
}, cancelText ? /* @__PURE__ */ React.createElement(Button, {
|
|
298
328
|
className: "confirm-cancel-button",
|
|
299
329
|
onClick: () => onClick(false)
|
|
300
|
-
}, cancelText) : null, /* @__PURE__ */
|
|
330
|
+
}, cancelText) : null, /* @__PURE__ */ React.createElement(Button, {
|
|
301
331
|
type: "primary",
|
|
302
332
|
onClick: () => onClick(true)
|
|
303
333
|
}, okText)));
|
|
@@ -312,29 +342,29 @@ function getTypeClass(type) {
|
|
|
312
342
|
}
|
|
313
343
|
function Confirm(props) {
|
|
314
344
|
const { title = "title", message = "message", type = "success", duration = null } = props;
|
|
315
|
-
const [hidden,
|
|
345
|
+
const [hidden, setHidden] = useState(false);
|
|
316
346
|
if (duration) {
|
|
317
347
|
setTimeout(() => {
|
|
318
|
-
|
|
348
|
+
setHidden(true);
|
|
319
349
|
}, duration);
|
|
320
350
|
}
|
|
321
|
-
return !hidden ? /* @__PURE__ */
|
|
351
|
+
return !hidden ? /* @__PURE__ */ React.createElement("div", {
|
|
322
352
|
className: getTypeClass(type)
|
|
323
|
-
}, /* @__PURE__ */
|
|
353
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
324
354
|
className: "toast-title"
|
|
325
|
-
}, title), /* @__PURE__ */
|
|
355
|
+
}, title), /* @__PURE__ */ React.createElement("div", {
|
|
326
356
|
className: "toast-message"
|
|
327
357
|
}, message)) : null;
|
|
328
358
|
}
|
|
329
359
|
function Alert(props) {
|
|
330
360
|
const { service, data = {} } = props;
|
|
331
361
|
const { title = "title", message = "message", okText = "okText", cancelText = "" } = data;
|
|
332
|
-
const onClickCallback =
|
|
362
|
+
const onClickCallback = React.useCallback(function() {
|
|
333
363
|
service.onNext(true);
|
|
334
364
|
}, [service]);
|
|
335
|
-
return /* @__PURE__ */
|
|
365
|
+
return /* @__PURE__ */ React.createElement(Overlay, {
|
|
336
366
|
verticalPosition: "bottom"
|
|
337
|
-
}, /* @__PURE__ */
|
|
367
|
+
}, /* @__PURE__ */ React.createElement(Confirm$1, {
|
|
338
368
|
title,
|
|
339
369
|
message,
|
|
340
370
|
okText,
|
|
@@ -344,10 +374,10 @@ function Alert(props) {
|
|
|
344
374
|
}
|
|
345
375
|
function Start(props) {
|
|
346
376
|
const { action, appManager, service } = props;
|
|
347
|
-
const onReStart =
|
|
377
|
+
const onReStart = React.useCallback(function() {
|
|
348
378
|
service.onStart(appManager.config.appId);
|
|
349
379
|
});
|
|
350
|
-
return /* @__PURE__ */
|
|
380
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
351
381
|
style: {
|
|
352
382
|
display: "flex",
|
|
353
383
|
flexDirection: "column",
|
|
@@ -356,20 +386,20 @@ function Start(props) {
|
|
|
356
386
|
width: "100vw",
|
|
357
387
|
height: "100vh"
|
|
358
388
|
}
|
|
359
|
-
}, /* @__PURE__ */
|
|
389
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
360
390
|
type: "primary",
|
|
361
391
|
onClick: onReStart
|
|
362
|
-
}, "\u5F00\u59CB\u4F5C\u4E1A"), /* @__PURE__ */
|
|
392
|
+
}, "\u5F00\u59CB\u4F5C\u4E1A"), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("div", null, appManager.config.appId), /* @__PURE__ */ React.createElement("div", null, appManager.config.groupId));
|
|
363
393
|
}
|
|
364
394
|
function confirm(props) {
|
|
365
395
|
const { service, data = {} } = props;
|
|
366
396
|
const { title = "title", message, subMessage = [], okText = "okText", cancelText = "" } = data;
|
|
367
|
-
const onClickCallback =
|
|
397
|
+
const onClickCallback = React.useCallback(function(isConfirm) {
|
|
368
398
|
service.onNext(isConfirm);
|
|
369
399
|
}, [service]);
|
|
370
|
-
return /* @__PURE__ */
|
|
400
|
+
return /* @__PURE__ */ React.createElement(Overlay, {
|
|
371
401
|
verticalPosition: "bottom"
|
|
372
|
-
}, /* @__PURE__ */
|
|
402
|
+
}, /* @__PURE__ */ React.createElement(Confirm$1, {
|
|
373
403
|
title,
|
|
374
404
|
message,
|
|
375
405
|
subMessage,
|
|
@@ -379,17 +409,17 @@ function confirm(props) {
|
|
|
379
409
|
}));
|
|
380
410
|
}
|
|
381
411
|
function Prompt(props) {
|
|
382
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ React.createElement("div", null, "\u9875\u9762\u4E0D\u5B58\u5728");
|
|
383
413
|
}
|
|
384
414
|
function toast(props) {
|
|
385
415
|
const { data = {}, service } = props;
|
|
386
416
|
const { title, level, message, duration = null } = data;
|
|
387
|
-
const [hidden,
|
|
388
|
-
|
|
417
|
+
const [hidden, setHidden] = useState(false);
|
|
418
|
+
React.useEffect(() => {
|
|
389
419
|
let timeout = null;
|
|
390
420
|
if (duration) {
|
|
391
421
|
setTimeout(() => {
|
|
392
|
-
|
|
422
|
+
setHidden(true);
|
|
393
423
|
service.onNext("");
|
|
394
424
|
}, duration);
|
|
395
425
|
}
|
|
@@ -397,13 +427,15 @@ function toast(props) {
|
|
|
397
427
|
clearTimeout(timeout);
|
|
398
428
|
};
|
|
399
429
|
}, []);
|
|
400
|
-
return !hidden ? /* @__PURE__ */
|
|
430
|
+
return !hidden ? /* @__PURE__ */ React.createElement(Overlay, {
|
|
401
431
|
verticalPosition: "bottom"
|
|
402
|
-
}, /* @__PURE__ */
|
|
432
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
433
|
+
style: { width: "90%" }
|
|
434
|
+
}, /* @__PURE__ */ React.createElement(Confirm, {
|
|
403
435
|
type: level,
|
|
404
436
|
title,
|
|
405
437
|
message: splitMessage(message)
|
|
406
|
-
})) : null;
|
|
438
|
+
}))) : null;
|
|
407
439
|
}
|
|
408
440
|
function splitMessage(message) {
|
|
409
441
|
var msg = String(message).split("by Error:");
|
|
@@ -411,14 +443,14 @@ function splitMessage(message) {
|
|
|
411
443
|
}
|
|
412
444
|
var index$d = "";
|
|
413
445
|
function NotFound(props) {
|
|
414
|
-
return /* @__PURE__ */
|
|
446
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
415
447
|
style: { padding: "20%" }
|
|
416
|
-
}, /* @__PURE__ */
|
|
448
|
+
}, /* @__PURE__ */ React.createElement("h1", null, "404 ", /* @__PURE__ */ React.createElement("small", {
|
|
417
449
|
style: { fontSize: "60%" }
|
|
418
|
-
}, "Not found")), /* @__PURE__ */
|
|
450
|
+
}, "Not found")), /* @__PURE__ */ React.createElement("div", null, props.action.getPage()));
|
|
419
451
|
}
|
|
420
|
-
function _extends
|
|
421
|
-
_extends
|
|
452
|
+
function _extends() {
|
|
453
|
+
_extends = Object.assign || function(target) {
|
|
422
454
|
for (var i = 1; i < arguments.length; i++) {
|
|
423
455
|
var source = arguments[i];
|
|
424
456
|
for (var key in source) {
|
|
@@ -429,7 +461,7 @@ function _extends$3() {
|
|
|
429
461
|
}
|
|
430
462
|
return target;
|
|
431
463
|
};
|
|
432
|
-
return _extends
|
|
464
|
+
return _extends.apply(this, arguments);
|
|
433
465
|
}
|
|
434
466
|
var r, B = r || (r = {});
|
|
435
467
|
B.Pop = "POP";
|
|
@@ -510,7 +542,7 @@ function createHashHistory(b) {
|
|
|
510
542
|
}
|
|
511
543
|
function z(a, e) {
|
|
512
544
|
e === void 0 && (e = null);
|
|
513
|
-
return C(_extends
|
|
545
|
+
return C(_extends({ pathname: d.pathname, hash: "", search: "" }, typeof a === "string" ? J(a) : a, { state: e, key: H() }));
|
|
514
546
|
}
|
|
515
547
|
function A(a) {
|
|
516
548
|
v = a;
|
|
@@ -541,11 +573,7 @@ function createHashHistory(b) {
|
|
|
541
573
|
w(a, e);
|
|
542
574
|
}
|
|
543
575
|
var g = r.Replace, n = z(a, e);
|
|
544
|
-
c.length && (c.call({
|
|
545
|
-
action: g,
|
|
546
|
-
location: n,
|
|
547
|
-
retry: l
|
|
548
|
-
}), 1) || (n = [{ usr: n.state, key: n.key, idx: q }, x(n)], u.replaceState(n[0], "", n[1]), A(g));
|
|
576
|
+
c.length && (c.call({ action: g, location: n, retry: l }), 1) || (n = [{ usr: n.state, key: n.key, idx: q }, x(n)], u.replaceState(n[0], "", n[1]), A(g));
|
|
549
577
|
}
|
|
550
578
|
function p(a) {
|
|
551
579
|
u.go(a);
|
|
@@ -561,7 +589,7 @@ function createHashHistory(b) {
|
|
|
561
589
|
var v = r.Pop;
|
|
562
590
|
b = h();
|
|
563
591
|
var q = b[0], d = b[1], f = F(), c = F();
|
|
564
|
-
q == null && (q = 0, u.replaceState(_extends
|
|
592
|
+
q == null && (q = 0, u.replaceState(_extends({}, u.state, { idx: q }), ""));
|
|
565
593
|
return {
|
|
566
594
|
get action() {
|
|
567
595
|
return v;
|
|
@@ -596,7 +624,7 @@ var index$c = "";
|
|
|
596
624
|
function Debug(props) {
|
|
597
625
|
const { appManager } = props;
|
|
598
626
|
const pages = Array.from(appManager.pageManager.keys()).reverse();
|
|
599
|
-
|
|
627
|
+
React.useEffect(function() {
|
|
600
628
|
const history = createHashHistory();
|
|
601
629
|
const unListen = history.listen(({ action, location }) => {
|
|
602
630
|
const pathname = location.pathname;
|
|
@@ -604,18 +632,18 @@ function Debug(props) {
|
|
|
604
632
|
});
|
|
605
633
|
return unListen;
|
|
606
634
|
}, []);
|
|
607
|
-
return /* @__PURE__ */
|
|
635
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
608
636
|
className: "local-debug-side"
|
|
609
|
-
}, /* @__PURE__ */
|
|
637
|
+
}, /* @__PURE__ */ React.createElement("ul", null, pages.map((pathname) => /* @__PURE__ */ React.createElement("li", {
|
|
610
638
|
key: pathname
|
|
611
|
-
}, /* @__PURE__ */
|
|
639
|
+
}, /* @__PURE__ */ React.createElement("a", {
|
|
612
640
|
href: `#${pathname}`
|
|
613
641
|
}, pathname)))));
|
|
614
642
|
}
|
|
615
643
|
function Loading$1(props) {
|
|
616
|
-
const [showLoading, setShowLoading] =
|
|
644
|
+
const [showLoading, setShowLoading] = React.useState(false);
|
|
617
645
|
const edgeService = props.edgeService;
|
|
618
|
-
|
|
646
|
+
React.useEffect(function() {
|
|
619
647
|
let currentLoading = false;
|
|
620
648
|
const throttleSetShowLoading = function(loading) {
|
|
621
649
|
currentLoading = loading;
|
|
@@ -638,7 +666,7 @@ function Loading$1(props) {
|
|
|
638
666
|
edgeService.off("IO_STATUS", throttleSetShowLoading);
|
|
639
667
|
};
|
|
640
668
|
}, [edgeService]);
|
|
641
|
-
return showLoading ? /* @__PURE__ */
|
|
669
|
+
return showLoading ? /* @__PURE__ */ React.createElement("div", {
|
|
642
670
|
style: { position: "absolute", left: 0, top: 0, zIndex: 100 }
|
|
643
671
|
}, "LOADING...") : null;
|
|
644
672
|
}
|
|
@@ -658,17 +686,15 @@ function Presentation(props) {
|
|
|
658
686
|
image = Presentation.IMAGE_1,
|
|
659
687
|
text = "",
|
|
660
688
|
subText = "",
|
|
661
|
-
transparent
|
|
662
|
-
imageStyle
|
|
689
|
+
transparent
|
|
663
690
|
} = props;
|
|
664
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
665
692
|
className: transparent ? "presentation-card transparent" : "presentation-card"
|
|
666
|
-
}, /* @__PURE__ */
|
|
667
|
-
src: image
|
|
668
|
-
|
|
669
|
-
}), text ? /* @__PURE__ */ React__default.createElement("div", {
|
|
693
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
694
|
+
src: image
|
|
695
|
+
}), text ? /* @__PURE__ */ React.createElement("div", {
|
|
670
696
|
className: "text"
|
|
671
|
-
}, text) : null, subText ? /* @__PURE__ */
|
|
697
|
+
}, text) : null, subText ? /* @__PURE__ */ React.createElement("div", {
|
|
672
698
|
className: "sub-text"
|
|
673
699
|
}, subText) : null);
|
|
674
700
|
}
|
|
@@ -680,41 +706,44 @@ var index$9 = "";
|
|
|
680
706
|
function empty() {
|
|
681
707
|
}
|
|
682
708
|
function List(props) {
|
|
683
|
-
const {
|
|
684
|
-
return /* @__PURE__ */
|
|
685
|
-
className: "android-pda-list"
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
itemPropsOnClick && itemPropsOnClick(event);
|
|
694
|
-
onItemClick(event);
|
|
695
|
-
}
|
|
696
|
-
}), item.props.children);
|
|
697
|
-
}));
|
|
709
|
+
const { dataSource = [], onClickItem, onItemClick = empty } = props;
|
|
710
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
711
|
+
className: "android-pda-list"
|
|
712
|
+
}, dataSource.map((item, index2) => {
|
|
713
|
+
return /* @__PURE__ */ React.createElement(DefaultItem, {
|
|
714
|
+
key: item.key || index2,
|
|
715
|
+
dataSource: item,
|
|
716
|
+
onClick: onClickItem || onItemClick
|
|
717
|
+
});
|
|
718
|
+
}), props.children);
|
|
698
719
|
}
|
|
699
720
|
function DefaultItem(props) {
|
|
700
|
-
const
|
|
701
|
-
|
|
721
|
+
const dataSource = props.dataSource || {
|
|
722
|
+
title: props.title,
|
|
723
|
+
subTitle: props.subTitle,
|
|
724
|
+
extra: props.extra,
|
|
725
|
+
tags: props.tags
|
|
726
|
+
};
|
|
727
|
+
const { title, subTitle, extra, tags = [], tabIndex } = dataSource;
|
|
728
|
+
const { onClick } = props;
|
|
729
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
702
730
|
className: "default-item",
|
|
703
731
|
onClick: () => {
|
|
704
|
-
onClick(props);
|
|
732
|
+
onClick(props.dataSource);
|
|
705
733
|
},
|
|
706
734
|
tabIndex
|
|
707
|
-
}, /* @__PURE__ */
|
|
735
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
708
736
|
className: "text"
|
|
709
|
-
}, /* @__PURE__ */
|
|
737
|
+
}, /* @__PURE__ */ React.createElement("div", null, title), /* @__PURE__ */ React.createElement("div", {
|
|
710
738
|
className: "sub-text"
|
|
711
|
-
}, subTitle), /* @__PURE__ */
|
|
739
|
+
}, subTitle), /* @__PURE__ */ React.createElement("div", {
|
|
712
740
|
className: "sub-tags"
|
|
713
741
|
}, tags.map((text) => {
|
|
714
|
-
return /* @__PURE__ */
|
|
715
|
-
className: "sub-tag-item"
|
|
742
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
743
|
+
className: "sub-tag-item",
|
|
744
|
+
key: text
|
|
716
745
|
}, text);
|
|
717
|
-
}))), /* @__PURE__ */
|
|
746
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
718
747
|
className: "extra"
|
|
719
748
|
}, extra));
|
|
720
749
|
}
|
|
@@ -722,7 +751,7 @@ List.Item = DefaultItem;
|
|
|
722
751
|
var index$8 = "";
|
|
723
752
|
const blankFunc$4 = () => {
|
|
724
753
|
};
|
|
725
|
-
class BaseLayoutContainer extends
|
|
754
|
+
class BaseLayoutContainer extends React.Component {
|
|
726
755
|
constructor(props) {
|
|
727
756
|
super(props);
|
|
728
757
|
this.state = {};
|
|
@@ -772,21 +801,21 @@ class BaseLayoutContainer extends React__default.Component {
|
|
|
772
801
|
render() {
|
|
773
802
|
const props = this.props;
|
|
774
803
|
const { style = {}, header, footer } = this.props;
|
|
775
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
776
805
|
className: classNames({ "baselayout-wrapper": true }),
|
|
777
806
|
style
|
|
778
|
-
}, header && /* @__PURE__ */
|
|
807
|
+
}, header && /* @__PURE__ */ React.createElement("div", {
|
|
779
808
|
className: classNames({ "baselayout-header": true })
|
|
780
|
-
}, header), /* @__PURE__ */
|
|
809
|
+
}, header), /* @__PURE__ */ React.createElement("div", {
|
|
781
810
|
className: classNames({ "baselayout-container": true })
|
|
782
|
-
}, props.children), footer && /* @__PURE__ */
|
|
811
|
+
}, props.children), footer && /* @__PURE__ */ React.createElement("div", {
|
|
783
812
|
className: classNames({ "baselayout-footer": true })
|
|
784
813
|
}, footer));
|
|
785
814
|
}
|
|
786
815
|
}
|
|
787
816
|
const blankFunc$3 = () => {
|
|
788
817
|
};
|
|
789
|
-
class RfidOnce$1 extends
|
|
818
|
+
class RfidOnce$1 extends React.Component {
|
|
790
819
|
constructor(props) {
|
|
791
820
|
super(props);
|
|
792
821
|
this._rfidBeginScan = false;
|
|
@@ -853,12 +882,12 @@ class RfidOnce$1 extends React__default.Component {
|
|
|
853
882
|
render() {
|
|
854
883
|
const props = this.props;
|
|
855
884
|
const _a = props, { onRfidOnce = blankFunc$3 } = _a, opts = __objRest(_a, ["onRfidOnce"]);
|
|
856
|
-
return /* @__PURE__ */
|
|
885
|
+
return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, opts));
|
|
857
886
|
}
|
|
858
887
|
}
|
|
859
888
|
const blankFunc$2 = () => {
|
|
860
889
|
};
|
|
861
|
-
class RfidOnce extends
|
|
890
|
+
class RfidOnce extends React.Component {
|
|
862
891
|
constructor(props) {
|
|
863
892
|
super(props);
|
|
864
893
|
this._rfidBeginScan = false;
|
|
@@ -934,7 +963,7 @@ class RfidOnce extends React__default.Component {
|
|
|
934
963
|
render() {
|
|
935
964
|
const props = this.props;
|
|
936
965
|
const _a = props, { onRfidScan = blankFunc$2, autoRfidScan } = _a, opts = __objRest(_a, ["onRfidScan", "autoRfidScan"]);
|
|
937
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, opts));
|
|
938
967
|
}
|
|
939
968
|
}
|
|
940
969
|
__publicField(RfidOnce, "defaultProps", {
|
|
@@ -942,7 +971,7 @@ __publicField(RfidOnce, "defaultProps", {
|
|
|
942
971
|
});
|
|
943
972
|
const blankFunc$1 = () => {
|
|
944
973
|
};
|
|
945
|
-
class BarcodeScan extends
|
|
974
|
+
class BarcodeScan extends React.Component {
|
|
946
975
|
constructor(props) {
|
|
947
976
|
super(props);
|
|
948
977
|
this._barcodeBeginScan = false;
|
|
@@ -988,10 +1017,10 @@ class BarcodeScan extends React__default.Component {
|
|
|
988
1017
|
render() {
|
|
989
1018
|
const props = this.props;
|
|
990
1019
|
const _a = props, { onBarcodeScan = blankFunc$1 } = _a, opts = __objRest(_a, ["onBarcodeScan"]);
|
|
991
|
-
return /* @__PURE__ */
|
|
1020
|
+
return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, opts));
|
|
992
1021
|
}
|
|
993
1022
|
}
|
|
994
|
-
class BaseLayout extends
|
|
1023
|
+
class BaseLayout extends React.Component {
|
|
995
1024
|
constructor(props) {
|
|
996
1025
|
super(props);
|
|
997
1026
|
}
|
|
@@ -999,15 +1028,15 @@ class BaseLayout extends React__default.Component {
|
|
|
999
1028
|
const props = this.props;
|
|
1000
1029
|
const { onBarcodeScan, onRfidOnce, onRfidBoxOnce, onRfidPalletOnce, onRfidScan, onRfidBoxScan, onRfidPalletScan } = props;
|
|
1001
1030
|
if (onRfidOnce || onRfidBoxOnce || onRfidPalletOnce) {
|
|
1002
|
-
return /* @__PURE__ */
|
|
1031
|
+
return /* @__PURE__ */ React.createElement(RfidOnce$1, __spreadValues({}, props));
|
|
1003
1032
|
}
|
|
1004
1033
|
if (onRfidScan || onRfidBoxScan || onRfidPalletScan) {
|
|
1005
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ React.createElement(RfidOnce, __spreadValues({}, props));
|
|
1006
1035
|
}
|
|
1007
1036
|
if (onBarcodeScan) {
|
|
1008
|
-
return /* @__PURE__ */
|
|
1037
|
+
return /* @__PURE__ */ React.createElement(BarcodeScan, __spreadValues({}, props));
|
|
1009
1038
|
}
|
|
1010
|
-
return /* @__PURE__ */
|
|
1039
|
+
return /* @__PURE__ */ React.createElement(BaseLayoutContainer, __spreadValues({}, props));
|
|
1011
1040
|
}
|
|
1012
1041
|
}
|
|
1013
1042
|
var index$7 = "";
|
|
@@ -1032,22 +1061,22 @@ function WakeKeyborard(props) {
|
|
|
1032
1061
|
document.removeEventListener("keyup", handleKeyUp);
|
|
1033
1062
|
};
|
|
1034
1063
|
}, []);
|
|
1035
|
-
return /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1036
1065
|
className: "wakekeyborard"
|
|
1037
|
-
}, inputVisible ? /* @__PURE__ */
|
|
1066
|
+
}, inputVisible ? /* @__PURE__ */ React.createElement("div", {
|
|
1038
1067
|
className: "wakekeyborard-overlay"
|
|
1039
|
-
}, /* @__PURE__ */
|
|
1068
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1040
1069
|
className: "wakekeyborard-inputbox"
|
|
1041
|
-
}, /* @__PURE__ */
|
|
1070
|
+
}, /* @__PURE__ */ React.createElement("input", {
|
|
1042
1071
|
ref: inputRef,
|
|
1043
1072
|
type: "tel"
|
|
1044
|
-
}), /* @__PURE__ */
|
|
1073
|
+
}), /* @__PURE__ */ React.createElement(Button, {
|
|
1045
1074
|
type: "primary",
|
|
1046
1075
|
onClick: (e) => {
|
|
1047
1076
|
onClick(inputRef.current.value);
|
|
1048
1077
|
setInputVisible(!inputVisible);
|
|
1049
1078
|
}
|
|
1050
|
-
}, "\u67E5\u8BE2"))) : null, !inputVisible ? /* @__PURE__ */
|
|
1079
|
+
}, "\u67E5\u8BE2"))) : null, !inputVisible ? /* @__PURE__ */ React.createElement("div", {
|
|
1051
1080
|
className: "wakekeyborard-icon",
|
|
1052
1081
|
onClick: (e) => {
|
|
1053
1082
|
setInputVisible(!inputVisible);
|
|
@@ -1060,42 +1089,42 @@ function WakeKeyborard(props) {
|
|
|
1060
1089
|
}
|
|
1061
1090
|
var index$6 = "";
|
|
1062
1091
|
var index$5 = "";
|
|
1063
|
-
class PdaInfoCard$1 extends
|
|
1092
|
+
class PdaInfoCard$1 extends React.Component {
|
|
1064
1093
|
constructor(props) {
|
|
1065
1094
|
super(props);
|
|
1066
1095
|
}
|
|
1067
1096
|
render() {
|
|
1068
1097
|
const { className, title, isActive, infoList = [], style = {}, index: index2, isLast } = this.props;
|
|
1069
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1070
1099
|
className: classNames({ [className]: true, "pda-step-card": true }),
|
|
1071
1100
|
style
|
|
1072
|
-
}, /* @__PURE__ */
|
|
1101
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1073
1102
|
className: "pda-step-indictor"
|
|
1074
|
-
}, /* @__PURE__ */
|
|
1103
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1075
1104
|
className: classNames({ "pda-step-indictor-top": true, "pda-step-indictor-top-hidden": index2 === 0 })
|
|
1076
|
-
}), /* @__PURE__ */
|
|
1105
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1077
1106
|
className: classNames({ "pda-step-indictor-center": true, "pda-step-indictor-center-active": isActive })
|
|
1078
|
-
}), /* @__PURE__ */
|
|
1107
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1079
1108
|
className: classNames({ "pda-step-indictor-bottom": true, "pda-step-indictor-bottom-hidden": isLast })
|
|
1080
|
-
})), /* @__PURE__ */
|
|
1109
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1081
1110
|
className: classNames({ "pda-step": true, "pda-step-dark": !isActive })
|
|
1082
|
-
}, /* @__PURE__ */
|
|
1111
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
1083
1112
|
className: "pda-step-title"
|
|
1084
1113
|
}, title), infoList.map((item, index22) => {
|
|
1085
|
-
return /* @__PURE__ */
|
|
1114
|
+
return /* @__PURE__ */ React.createElement("p", {
|
|
1086
1115
|
key: index22,
|
|
1087
1116
|
className: "pda-step-list"
|
|
1088
|
-
}, /* @__PURE__ */
|
|
1117
|
+
}, /* @__PURE__ */ React.createElement("span", null, item.label || ""), "\xA0\xA0", /* @__PURE__ */ React.createElement("span", null, item.content || ""));
|
|
1089
1118
|
})));
|
|
1090
1119
|
}
|
|
1091
1120
|
}
|
|
1092
|
-
class PdaInfoCard extends
|
|
1121
|
+
class PdaInfoCard extends React.Component {
|
|
1093
1122
|
constructor(props) {
|
|
1094
1123
|
super(props);
|
|
1095
1124
|
}
|
|
1096
1125
|
render() {
|
|
1097
1126
|
const { className, style = {}, theme = "light", current = 0, children } = this.props;
|
|
1098
|
-
return /* @__PURE__ */
|
|
1127
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1099
1128
|
className: classNames({ [className]: true }),
|
|
1100
1129
|
style
|
|
1101
1130
|
}, (children || []).map((child, index2) => {
|
|
@@ -1114,43 +1143,43 @@ class PdaInfoCard extends React__default.Component {
|
|
|
1114
1143
|
}
|
|
1115
1144
|
__publicField(PdaInfoCard, "Step", PdaInfoCard$1);
|
|
1116
1145
|
var index$4 = "";
|
|
1117
|
-
class PdaFinishCard extends
|
|
1146
|
+
class PdaFinishCard extends React.Component {
|
|
1118
1147
|
constructor(props) {
|
|
1119
1148
|
super(props);
|
|
1120
1149
|
}
|
|
1121
1150
|
render() {
|
|
1122
1151
|
const { className, title, infoList = [], isError = false, buttonMultiLines = false, style = {}, onClick = () => {
|
|
1123
1152
|
}, okText = "\u8FD4\u56DE\u9996\u9875", cancelText = null } = this.props;
|
|
1124
|
-
const footer = /* @__PURE__ */
|
|
1153
|
+
const footer = /* @__PURE__ */ React.createElement(Button.Group, null, cancelText ? /* @__PURE__ */ React.createElement(Button, {
|
|
1125
1154
|
style: buttonMultiLines ? { height: "auto", lineHeight: "50px" } : {},
|
|
1126
1155
|
type: "dark",
|
|
1127
1156
|
onClick: () => onClick(false)
|
|
1128
|
-
}, cancelText) : null, /* @__PURE__ */
|
|
1157
|
+
}, cancelText) : null, /* @__PURE__ */ React.createElement(Button, {
|
|
1129
1158
|
type: "primary",
|
|
1130
1159
|
style: buttonMultiLines ? { height: "auto", lineHeight: "normal" } : {},
|
|
1131
1160
|
onClick: () => onClick(true)
|
|
1132
1161
|
}, okText));
|
|
1133
|
-
return /* @__PURE__ */
|
|
1162
|
+
return /* @__PURE__ */ React.createElement(BaseLayout, {
|
|
1134
1163
|
footer
|
|
1135
|
-
}, /* @__PURE__ */
|
|
1164
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1136
1165
|
className: "pda-finish-card-top"
|
|
1137
|
-
}, /* @__PURE__ */
|
|
1166
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
1138
1167
|
className: "pda-finish-card-img",
|
|
1139
1168
|
src: isError ? PdaFinishCard.ERROR_SUCCESS : PdaFinishCard.SUCCESS
|
|
1140
|
-
}), /* @__PURE__ */
|
|
1169
|
+
}), /* @__PURE__ */ React.createElement("p", {
|
|
1141
1170
|
className: "pda-finish-card-title"
|
|
1142
1171
|
}, title), infoList.map((item, index2) => {
|
|
1143
|
-
return /* @__PURE__ */
|
|
1172
|
+
return /* @__PURE__ */ React.createElement("p", {
|
|
1144
1173
|
key: index2,
|
|
1145
1174
|
className: "pda-finish-card-list"
|
|
1146
|
-
}, /* @__PURE__ */
|
|
1175
|
+
}, /* @__PURE__ */ React.createElement("span", null, item.label || ""), /* @__PURE__ */ React.createElement("span", null, item.content || ""));
|
|
1147
1176
|
})));
|
|
1148
1177
|
}
|
|
1149
1178
|
}
|
|
1150
1179
|
PdaFinishCard.SUCCESS = "https://img.alicdn.com/imgextra/i2/O1CN01yYwwSx1uNV0M1gHlQ_!!6000000006025-1-tps-630-436.gif";
|
|
1151
1180
|
PdaFinishCard.ERROR_SUCCESS = "https://img.alicdn.com/imgextra/i3/O1CN01p5Oc5t1VMFWtBomQc_!!6000000002638-1-tps-600-456.gif";
|
|
1152
1181
|
var index$3 = "";
|
|
1153
|
-
class PdaDistanceCard extends
|
|
1182
|
+
class PdaDistanceCard extends React.Component {
|
|
1154
1183
|
constructor(props) {
|
|
1155
1184
|
super(props);
|
|
1156
1185
|
}
|
|
@@ -1158,178 +1187,194 @@ class PdaDistanceCard extends React__default.Component {
|
|
|
1158
1187
|
const { className, title, infoText, percentage = 0, style = {} } = this.props;
|
|
1159
1188
|
const distanceImg = "https://img.alicdn.com/imgextra/i3/O1CN01EFksWL1DBZCu0H1JH_!!6000000000178-2-tps-21-30.png";
|
|
1160
1189
|
const indictorImg = "https://img.alicdn.com/imgextra/i1/O1CN01YEhCSg1aObe8UZq7K_!!6000000003320-2-tps-379-17.png";
|
|
1161
|
-
return /* @__PURE__ */
|
|
1190
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1162
1191
|
className: classNames({ [className]: true, "pda-distance-card": true }),
|
|
1163
1192
|
style
|
|
1164
|
-
}, /* @__PURE__ */
|
|
1193
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
1165
1194
|
className: "pda-distance-card-highlight"
|
|
1166
|
-
}, /* @__PURE__ */
|
|
1195
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1167
1196
|
className: "pda-distance-card-highlight1"
|
|
1168
|
-
}, title)), /* @__PURE__ */
|
|
1197
|
+
}, title)), /* @__PURE__ */ React.createElement("div", {
|
|
1169
1198
|
className: "pda-distance-indictor"
|
|
1170
|
-
}, /* @__PURE__ */
|
|
1199
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
1171
1200
|
src: distanceImg,
|
|
1172
1201
|
width: 20,
|
|
1173
1202
|
height: 29
|
|
1174
|
-
}), /* @__PURE__ */
|
|
1203
|
+
}), /* @__PURE__ */ React.createElement("p", null, infoText)), /* @__PURE__ */ React.createElement("div", {
|
|
1175
1204
|
className: "pda-distance-card-progress"
|
|
1176
|
-
}, /* @__PURE__ */
|
|
1205
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1177
1206
|
className: "pda-distance-card-progress-inside",
|
|
1178
1207
|
style: { width: `${percentage * 100}%` }
|
|
1179
|
-
}), /* @__PURE__ */
|
|
1208
|
+
}), /* @__PURE__ */ React.createElement("img", {
|
|
1180
1209
|
className: "pda-distance-card-progress-indictor",
|
|
1181
1210
|
src: indictorImg
|
|
1182
|
-
})), /* @__PURE__ */
|
|
1211
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1183
1212
|
className: "pda-distance-label"
|
|
1184
|
-
}, /* @__PURE__ */
|
|
1213
|
+
}, /* @__PURE__ */ React.createElement("p", null, "\u8FDC"), /* @__PURE__ */ React.createElement("p", null, "\u8FD1")));
|
|
1185
1214
|
}
|
|
1186
1215
|
}
|
|
1187
1216
|
var index$2 = "";
|
|
1188
1217
|
function SubCard(props) {
|
|
1189
1218
|
const { title, context, name, tag, attrs = [], style } = props;
|
|
1190
|
-
return /* @__PURE__ */
|
|
1219
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1191
1220
|
className: "android-sub-card",
|
|
1192
1221
|
style
|
|
1193
|
-
}, /* @__PURE__ */
|
|
1222
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1194
1223
|
className: "android-sub-card-title-section"
|
|
1195
|
-
}, /* @__PURE__ */
|
|
1224
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1196
1225
|
className: "android-sub-card-title"
|
|
1197
|
-
}, title), tag ? /* @__PURE__ */
|
|
1226
|
+
}, title), tag ? /* @__PURE__ */ React.createElement("div", {
|
|
1198
1227
|
className: "android-sub-card-tag"
|
|
1199
|
-
}, /* @__PURE__ */
|
|
1228
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1200
1229
|
className: tag.type
|
|
1201
|
-
}, tag.label || "")) : null), /* @__PURE__ */
|
|
1230
|
+
}, tag.label || "")) : null), /* @__PURE__ */ React.createElement("div", {
|
|
1202
1231
|
className: "android-sub-card-context"
|
|
1203
|
-
}, context), name ? /* @__PURE__ */
|
|
1232
|
+
}, context), name ? /* @__PURE__ */ React.createElement("div", {
|
|
1204
1233
|
className: "android-sub-card-name"
|
|
1205
|
-
}, name) : null, /* @__PURE__ */
|
|
1234
|
+
}, name) : null, /* @__PURE__ */ React.createElement("div", {
|
|
1206
1235
|
className: "android-sub-card-attrs"
|
|
1207
1236
|
}, attrs.map((text) => {
|
|
1208
|
-
return /* @__PURE__ */
|
|
1237
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1238
|
+
key: text
|
|
1239
|
+
}, text);
|
|
1209
1240
|
})));
|
|
1210
1241
|
}
|
|
1211
1242
|
var index$1 = "";
|
|
1212
|
-
|
|
1213
|
-
var
|
|
1214
|
-
|
|
1215
|
-
var
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1243
|
+
function usePersistFn(fn) {
|
|
1244
|
+
var fnRef = useRef(fn);
|
|
1245
|
+
fnRef.current = fn;
|
|
1246
|
+
var persistFn = useRef();
|
|
1247
|
+
if (!persistFn.current) {
|
|
1248
|
+
persistFn.current = function() {
|
|
1249
|
+
var args = [];
|
|
1250
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1251
|
+
args[_i] = arguments[_i];
|
|
1252
|
+
}
|
|
1253
|
+
return fnRef.current.apply(this, args);
|
|
1254
|
+
};
|
|
1221
1255
|
}
|
|
1222
|
-
return
|
|
1256
|
+
return persistFn.current;
|
|
1223
1257
|
}
|
|
1224
|
-
function
|
|
1225
|
-
|
|
1226
|
-
return
|
|
1258
|
+
var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1259
|
+
function adopt(value) {
|
|
1260
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
1261
|
+
resolve(value);
|
|
1262
|
+
});
|
|
1227
1263
|
}
|
|
1228
|
-
return
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
try {
|
|
1236
|
-
while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
|
|
1237
|
-
ar.push(r2.value);
|
|
1238
|
-
}
|
|
1239
|
-
} catch (error) {
|
|
1240
|
-
e = {
|
|
1241
|
-
error
|
|
1242
|
-
};
|
|
1243
|
-
} finally {
|
|
1244
|
-
try {
|
|
1245
|
-
if (r2 && !r2.done && (m = i["return"]))
|
|
1246
|
-
m.call(i);
|
|
1247
|
-
} finally {
|
|
1248
|
-
if (e)
|
|
1249
|
-
throw e.error;
|
|
1264
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1265
|
+
function fulfilled(value) {
|
|
1266
|
+
try {
|
|
1267
|
+
step(generator.next(value));
|
|
1268
|
+
} catch (e) {
|
|
1269
|
+
reject(e);
|
|
1270
|
+
}
|
|
1250
1271
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
(
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
}
|
|
1258
|
-
return ar;
|
|
1259
|
-
});
|
|
1260
|
-
var __read$6 = function(o, n) {
|
|
1261
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1262
|
-
if (!m)
|
|
1263
|
-
return o;
|
|
1264
|
-
var i = m.call(o), r2, ar = [], e;
|
|
1265
|
-
try {
|
|
1266
|
-
while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
|
|
1267
|
-
ar.push(r2.value);
|
|
1272
|
+
function rejected(value) {
|
|
1273
|
+
try {
|
|
1274
|
+
step(generator["throw"](value));
|
|
1275
|
+
} catch (e) {
|
|
1276
|
+
reject(e);
|
|
1277
|
+
}
|
|
1268
1278
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
error
|
|
1272
|
-
};
|
|
1273
|
-
} finally {
|
|
1274
|
-
try {
|
|
1275
|
-
if (r2 && !r2.done && (m = i["return"]))
|
|
1276
|
-
m.call(i);
|
|
1277
|
-
} finally {
|
|
1278
|
-
if (e)
|
|
1279
|
-
throw e.error;
|
|
1279
|
+
function step(result) {
|
|
1280
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1280
1281
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1282
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1283
|
+
});
|
|
1283
1284
|
};
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1285
|
+
var __generator = globalThis && globalThis.__generator || function(thisArg, body) {
|
|
1286
|
+
var _ = {
|
|
1287
|
+
label: 0,
|
|
1288
|
+
sent: function sent() {
|
|
1289
|
+
if (t[0] & 1)
|
|
1290
|
+
throw t[1];
|
|
1291
|
+
return t[1];
|
|
1292
|
+
},
|
|
1293
|
+
trys: [],
|
|
1294
|
+
ops: []
|
|
1295
|
+
}, f, y, t, g;
|
|
1296
|
+
return g = {
|
|
1297
|
+
next: verb(0),
|
|
1298
|
+
"throw": verb(1),
|
|
1299
|
+
"return": verb(2)
|
|
1300
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1301
|
+
return this;
|
|
1302
|
+
}), g;
|
|
1303
|
+
function verb(n) {
|
|
1304
|
+
return function(v) {
|
|
1305
|
+
return step([n, v]);
|
|
1306
|
+
};
|
|
1287
1307
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1308
|
+
function step(op) {
|
|
1309
|
+
if (f)
|
|
1310
|
+
throw new TypeError("Generator is already executing.");
|
|
1311
|
+
while (_) {
|
|
1312
|
+
try {
|
|
1313
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
1314
|
+
return t;
|
|
1315
|
+
if (y = 0, t)
|
|
1316
|
+
op = [op[0] & 2, t.value];
|
|
1317
|
+
switch (op[0]) {
|
|
1318
|
+
case 0:
|
|
1319
|
+
case 1:
|
|
1320
|
+
t = op;
|
|
1321
|
+
break;
|
|
1322
|
+
case 4:
|
|
1323
|
+
_.label++;
|
|
1324
|
+
return {
|
|
1325
|
+
value: op[1],
|
|
1326
|
+
done: false
|
|
1327
|
+
};
|
|
1328
|
+
case 5:
|
|
1329
|
+
_.label++;
|
|
1330
|
+
y = op[1];
|
|
1331
|
+
op = [0];
|
|
1332
|
+
continue;
|
|
1333
|
+
case 7:
|
|
1334
|
+
op = _.ops.pop();
|
|
1335
|
+
_.trys.pop();
|
|
1336
|
+
continue;
|
|
1337
|
+
default:
|
|
1338
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1339
|
+
_ = 0;
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1343
|
+
_.label = op[1];
|
|
1344
|
+
break;
|
|
1345
|
+
}
|
|
1346
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
1347
|
+
_.label = t[1];
|
|
1348
|
+
t = op;
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
if (t && _.label < t[2]) {
|
|
1352
|
+
_.label = t[2];
|
|
1353
|
+
_.ops.push(op);
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
if (t[2])
|
|
1357
|
+
_.ops.pop();
|
|
1358
|
+
_.trys.pop();
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
op = body.call(thisArg, _);
|
|
1362
|
+
} catch (e) {
|
|
1363
|
+
op = [6, e];
|
|
1364
|
+
y = 0;
|
|
1365
|
+
} finally {
|
|
1366
|
+
f = t = 0;
|
|
1326
1367
|
}
|
|
1327
1368
|
}
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1369
|
+
if (op[0] & 5)
|
|
1370
|
+
throw op[1];
|
|
1371
|
+
return {
|
|
1372
|
+
value: op[0] ? op[1] : void 0,
|
|
1373
|
+
done: true
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1331
1376
|
};
|
|
1332
|
-
var __read
|
|
1377
|
+
var __read = globalThis && globalThis.__read || function(o, n) {
|
|
1333
1378
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1334
1379
|
if (!m)
|
|
1335
1380
|
return o;
|
|
@@ -1353,344 +1398,9 @@ var __read$5 = function(o, n) {
|
|
|
1353
1398
|
}
|
|
1354
1399
|
return ar;
|
|
1355
1400
|
};
|
|
1356
|
-
|
|
1401
|
+
var __spread = globalThis && globalThis.__spread || function() {
|
|
1357
1402
|
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
1358
|
-
ar = ar.concat(__read
|
|
1359
|
-
}
|
|
1360
|
-
return ar;
|
|
1361
|
-
});
|
|
1362
|
-
var __assign$2 = function() {
|
|
1363
|
-
__assign$2 = Object.assign || function(t) {
|
|
1364
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1365
|
-
s = arguments[i];
|
|
1366
|
-
for (var p in s) {
|
|
1367
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1368
|
-
t[p] = s[p];
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
return t;
|
|
1372
|
-
};
|
|
1373
|
-
return __assign$2.apply(this, arguments);
|
|
1374
|
-
};
|
|
1375
|
-
(function(s, e) {
|
|
1376
|
-
var t = {};
|
|
1377
|
-
for (var p in s) {
|
|
1378
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1379
|
-
t[p] = s[p];
|
|
1380
|
-
}
|
|
1381
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1382
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1383
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1384
|
-
t[p[i]] = s[p[i]];
|
|
1385
|
-
}
|
|
1386
|
-
return t;
|
|
1387
|
-
});
|
|
1388
|
-
var __read$4 = function(o, n) {
|
|
1389
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1390
|
-
if (!m)
|
|
1391
|
-
return o;
|
|
1392
|
-
var i = m.call(o), r2, ar = [], e;
|
|
1393
|
-
try {
|
|
1394
|
-
while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
|
|
1395
|
-
ar.push(r2.value);
|
|
1396
|
-
}
|
|
1397
|
-
} catch (error) {
|
|
1398
|
-
e = {
|
|
1399
|
-
error
|
|
1400
|
-
};
|
|
1401
|
-
} finally {
|
|
1402
|
-
try {
|
|
1403
|
-
if (r2 && !r2.done && (m = i["return"]))
|
|
1404
|
-
m.call(i);
|
|
1405
|
-
} finally {
|
|
1406
|
-
if (e)
|
|
1407
|
-
throw e.error;
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
return ar;
|
|
1411
|
-
};
|
|
1412
|
-
(function() {
|
|
1413
|
-
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
1414
|
-
ar = ar.concat(__read$4(arguments[i]));
|
|
1415
|
-
}
|
|
1416
|
-
return ar;
|
|
1417
|
-
});
|
|
1418
|
-
var __assign$1 = function() {
|
|
1419
|
-
__assign$1 = Object.assign || function(t) {
|
|
1420
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1421
|
-
s = arguments[i];
|
|
1422
|
-
for (var p in s) {
|
|
1423
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1424
|
-
t[p] = s[p];
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
return t;
|
|
1428
|
-
};
|
|
1429
|
-
return __assign$1.apply(this, arguments);
|
|
1430
|
-
};
|
|
1431
|
-
(function(s, e) {
|
|
1432
|
-
var t = {};
|
|
1433
|
-
for (var p in s) {
|
|
1434
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1435
|
-
t[p] = s[p];
|
|
1436
|
-
}
|
|
1437
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1438
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1439
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1440
|
-
t[p[i]] = s[p[i]];
|
|
1441
|
-
}
|
|
1442
|
-
return t;
|
|
1443
|
-
});
|
|
1444
|
-
var __read$3 = function(o, n) {
|
|
1445
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1446
|
-
if (!m)
|
|
1447
|
-
return o;
|
|
1448
|
-
var i = m.call(o), r2, ar = [], e;
|
|
1449
|
-
try {
|
|
1450
|
-
while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
|
|
1451
|
-
ar.push(r2.value);
|
|
1452
|
-
}
|
|
1453
|
-
} catch (error) {
|
|
1454
|
-
e = {
|
|
1455
|
-
error
|
|
1456
|
-
};
|
|
1457
|
-
} finally {
|
|
1458
|
-
try {
|
|
1459
|
-
if (r2 && !r2.done && (m = i["return"]))
|
|
1460
|
-
m.call(i);
|
|
1461
|
-
} finally {
|
|
1462
|
-
if (e)
|
|
1463
|
-
throw e.error;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
return ar;
|
|
1467
|
-
};
|
|
1468
|
-
(function() {
|
|
1469
|
-
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
1470
|
-
ar = ar.concat(__read$3(arguments[i]));
|
|
1471
|
-
}
|
|
1472
|
-
return ar;
|
|
1473
|
-
});
|
|
1474
|
-
var ConfigContext = /* @__PURE__ */ React__default.createContext({});
|
|
1475
|
-
ConfigContext.displayName = "UseRequestConfigContext";
|
|
1476
|
-
var __assign = function() {
|
|
1477
|
-
__assign = Object.assign || function(t) {
|
|
1478
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1479
|
-
s = arguments[i];
|
|
1480
|
-
for (var p in s) {
|
|
1481
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1482
|
-
t[p] = s[p];
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
return t;
|
|
1486
|
-
};
|
|
1487
|
-
return __assign.apply(this, arguments);
|
|
1488
|
-
};
|
|
1489
|
-
(function(s, e) {
|
|
1490
|
-
var t = {};
|
|
1491
|
-
for (var p in s) {
|
|
1492
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1493
|
-
t[p] = s[p];
|
|
1494
|
-
}
|
|
1495
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1496
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1497
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1498
|
-
t[p[i]] = s[p[i]];
|
|
1499
|
-
}
|
|
1500
|
-
return t;
|
|
1501
|
-
});
|
|
1502
|
-
var __read$2 = function(o, n) {
|
|
1503
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1504
|
-
if (!m)
|
|
1505
|
-
return o;
|
|
1506
|
-
var i = m.call(o), r2, ar = [], e;
|
|
1507
|
-
try {
|
|
1508
|
-
while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
|
|
1509
|
-
ar.push(r2.value);
|
|
1510
|
-
}
|
|
1511
|
-
} catch (error) {
|
|
1512
|
-
e = {
|
|
1513
|
-
error
|
|
1514
|
-
};
|
|
1515
|
-
} finally {
|
|
1516
|
-
try {
|
|
1517
|
-
if (r2 && !r2.done && (m = i["return"]))
|
|
1518
|
-
m.call(i);
|
|
1519
|
-
} finally {
|
|
1520
|
-
if (e)
|
|
1521
|
-
throw e.error;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
return ar;
|
|
1525
|
-
};
|
|
1526
|
-
(function() {
|
|
1527
|
-
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
1528
|
-
ar = ar.concat(__read$2(arguments[i]));
|
|
1529
|
-
}
|
|
1530
|
-
return ar;
|
|
1531
|
-
});
|
|
1532
|
-
ConfigContext.Provider;
|
|
1533
|
-
function usePersistFn(fn) {
|
|
1534
|
-
var fnRef = useRef(fn);
|
|
1535
|
-
fnRef.current = fn;
|
|
1536
|
-
var persistFn = useRef();
|
|
1537
|
-
if (!persistFn.current) {
|
|
1538
|
-
persistFn.current = function() {
|
|
1539
|
-
var args = [];
|
|
1540
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1541
|
-
args[_i] = arguments[_i];
|
|
1542
|
-
}
|
|
1543
|
-
return fnRef.current.apply(this, args);
|
|
1544
|
-
};
|
|
1545
|
-
}
|
|
1546
|
-
return persistFn.current;
|
|
1547
|
-
}
|
|
1548
|
-
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
1549
|
-
function adopt(value) {
|
|
1550
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1551
|
-
resolve(value);
|
|
1552
|
-
});
|
|
1553
|
-
}
|
|
1554
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1555
|
-
function fulfilled(value) {
|
|
1556
|
-
try {
|
|
1557
|
-
step(generator.next(value));
|
|
1558
|
-
} catch (e) {
|
|
1559
|
-
reject(e);
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
function rejected(value) {
|
|
1563
|
-
try {
|
|
1564
|
-
step(generator["throw"](value));
|
|
1565
|
-
} catch (e) {
|
|
1566
|
-
reject(e);
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
function step(result) {
|
|
1570
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1571
|
-
}
|
|
1572
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1573
|
-
});
|
|
1574
|
-
};
|
|
1575
|
-
var __generator = function(thisArg, body) {
|
|
1576
|
-
var _ = {
|
|
1577
|
-
label: 0,
|
|
1578
|
-
sent: function sent() {
|
|
1579
|
-
if (t[0] & 1)
|
|
1580
|
-
throw t[1];
|
|
1581
|
-
return t[1];
|
|
1582
|
-
},
|
|
1583
|
-
trys: [],
|
|
1584
|
-
ops: []
|
|
1585
|
-
}, f, y, t, g;
|
|
1586
|
-
return g = {
|
|
1587
|
-
next: verb(0),
|
|
1588
|
-
"throw": verb(1),
|
|
1589
|
-
"return": verb(2)
|
|
1590
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1591
|
-
return this;
|
|
1592
|
-
}), g;
|
|
1593
|
-
function verb(n) {
|
|
1594
|
-
return function(v) {
|
|
1595
|
-
return step([n, v]);
|
|
1596
|
-
};
|
|
1597
|
-
}
|
|
1598
|
-
function step(op) {
|
|
1599
|
-
if (f)
|
|
1600
|
-
throw new TypeError("Generator is already executing.");
|
|
1601
|
-
while (_) {
|
|
1602
|
-
try {
|
|
1603
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
1604
|
-
return t;
|
|
1605
|
-
if (y = 0, t)
|
|
1606
|
-
op = [op[0] & 2, t.value];
|
|
1607
|
-
switch (op[0]) {
|
|
1608
|
-
case 0:
|
|
1609
|
-
case 1:
|
|
1610
|
-
t = op;
|
|
1611
|
-
break;
|
|
1612
|
-
case 4:
|
|
1613
|
-
_.label++;
|
|
1614
|
-
return {
|
|
1615
|
-
value: op[1],
|
|
1616
|
-
done: false
|
|
1617
|
-
};
|
|
1618
|
-
case 5:
|
|
1619
|
-
_.label++;
|
|
1620
|
-
y = op[1];
|
|
1621
|
-
op = [0];
|
|
1622
|
-
continue;
|
|
1623
|
-
case 7:
|
|
1624
|
-
op = _.ops.pop();
|
|
1625
|
-
_.trys.pop();
|
|
1626
|
-
continue;
|
|
1627
|
-
default:
|
|
1628
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1629
|
-
_ = 0;
|
|
1630
|
-
continue;
|
|
1631
|
-
}
|
|
1632
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1633
|
-
_.label = op[1];
|
|
1634
|
-
break;
|
|
1635
|
-
}
|
|
1636
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1637
|
-
_.label = t[1];
|
|
1638
|
-
t = op;
|
|
1639
|
-
break;
|
|
1640
|
-
}
|
|
1641
|
-
if (t && _.label < t[2]) {
|
|
1642
|
-
_.label = t[2];
|
|
1643
|
-
_.ops.push(op);
|
|
1644
|
-
break;
|
|
1645
|
-
}
|
|
1646
|
-
if (t[2])
|
|
1647
|
-
_.ops.pop();
|
|
1648
|
-
_.trys.pop();
|
|
1649
|
-
continue;
|
|
1650
|
-
}
|
|
1651
|
-
op = body.call(thisArg, _);
|
|
1652
|
-
} catch (e) {
|
|
1653
|
-
op = [6, e];
|
|
1654
|
-
y = 0;
|
|
1655
|
-
} finally {
|
|
1656
|
-
f = t = 0;
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
if (op[0] & 5)
|
|
1660
|
-
throw op[1];
|
|
1661
|
-
return {
|
|
1662
|
-
value: op[0] ? op[1] : void 0,
|
|
1663
|
-
done: true
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
|
-
};
|
|
1667
|
-
var __read$1 = function(o, n) {
|
|
1668
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1669
|
-
if (!m)
|
|
1670
|
-
return o;
|
|
1671
|
-
var i = m.call(o), r2, ar = [], e;
|
|
1672
|
-
try {
|
|
1673
|
-
while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
|
|
1674
|
-
ar.push(r2.value);
|
|
1675
|
-
}
|
|
1676
|
-
} catch (error) {
|
|
1677
|
-
e = {
|
|
1678
|
-
error
|
|
1679
|
-
};
|
|
1680
|
-
} finally {
|
|
1681
|
-
try {
|
|
1682
|
-
if (r2 && !r2.done && (m = i["return"]))
|
|
1683
|
-
m.call(i);
|
|
1684
|
-
} finally {
|
|
1685
|
-
if (e)
|
|
1686
|
-
throw e.error;
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
return ar;
|
|
1690
|
-
};
|
|
1691
|
-
var __spread = function() {
|
|
1692
|
-
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
1693
|
-
ar = ar.concat(__read$1(arguments[i]));
|
|
1403
|
+
ar = ar.concat(__read(arguments[i]));
|
|
1694
1404
|
}
|
|
1695
1405
|
return ar;
|
|
1696
1406
|
};
|
|
@@ -1739,36 +1449,6 @@ function useLockFn(fn) {
|
|
|
1739
1449
|
});
|
|
1740
1450
|
}, [fn]);
|
|
1741
1451
|
}
|
|
1742
|
-
var __read = function(o, n) {
|
|
1743
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1744
|
-
if (!m)
|
|
1745
|
-
return o;
|
|
1746
|
-
var i = m.call(o), r2, ar = [], e;
|
|
1747
|
-
try {
|
|
1748
|
-
while ((n === void 0 || n-- > 0) && !(r2 = i.next()).done) {
|
|
1749
|
-
ar.push(r2.value);
|
|
1750
|
-
}
|
|
1751
|
-
} catch (error) {
|
|
1752
|
-
e = {
|
|
1753
|
-
error
|
|
1754
|
-
};
|
|
1755
|
-
} finally {
|
|
1756
|
-
try {
|
|
1757
|
-
if (r2 && !r2.done && (m = i["return"]))
|
|
1758
|
-
m.call(i);
|
|
1759
|
-
} finally {
|
|
1760
|
-
if (e)
|
|
1761
|
-
throw e.error;
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
return ar;
|
|
1765
|
-
};
|
|
1766
|
-
(function() {
|
|
1767
|
-
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
1768
|
-
ar = ar.concat(__read(arguments[i]));
|
|
1769
|
-
}
|
|
1770
|
-
return ar;
|
|
1771
|
-
});
|
|
1772
1452
|
const overflowScrollReg = /scroll|auto/i;
|
|
1773
1453
|
function isElement(node) {
|
|
1774
1454
|
const ELEMENT_NODE_TYPE = 1;
|
|
@@ -1786,26 +1466,26 @@ function getScrollParent(el, root) {
|
|
|
1786
1466
|
return root;
|
|
1787
1467
|
}
|
|
1788
1468
|
function Loading(props) {
|
|
1789
|
-
return /* @__PURE__ */
|
|
1469
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1790
1470
|
style: {
|
|
1791
1471
|
color: props.color || "#999"
|
|
1792
1472
|
}
|
|
1793
|
-
}, /* @__PURE__ */
|
|
1473
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
1794
1474
|
height: "1em",
|
|
1795
1475
|
viewBox: "0 0 100 40",
|
|
1796
1476
|
style: { verticalAlign: "-0.125em" }
|
|
1797
|
-
}, /* @__PURE__ */
|
|
1477
|
+
}, /* @__PURE__ */ React.createElement("g", {
|
|
1798
1478
|
stroke: "none",
|
|
1799
1479
|
strokeWidth: "1",
|
|
1800
1480
|
fill: "none",
|
|
1801
1481
|
fillRule: "evenodd"
|
|
1802
|
-
}, /* @__PURE__ */
|
|
1482
|
+
}, /* @__PURE__ */ React.createElement("g", {
|
|
1803
1483
|
transform: "translate(-100.000000, -71.000000)"
|
|
1804
|
-
}, /* @__PURE__ */
|
|
1484
|
+
}, /* @__PURE__ */ React.createElement("g", {
|
|
1805
1485
|
transform: "translate(95.000000, 71.000000)"
|
|
1806
|
-
}, /* @__PURE__ */
|
|
1486
|
+
}, /* @__PURE__ */ React.createElement("g", {
|
|
1807
1487
|
transform: "translate(5.000000, 0.000000)"
|
|
1808
|
-
}, [0, 1, 2].map((i) => /* @__PURE__ */
|
|
1488
|
+
}, [0, 1, 2].map((i) => /* @__PURE__ */ React.createElement("rect", {
|
|
1809
1489
|
key: i,
|
|
1810
1490
|
fill: "currentColor",
|
|
1811
1491
|
x: 20 + i * 26,
|
|
@@ -1813,7 +1493,7 @@ function Loading(props) {
|
|
|
1813
1493
|
width: "8",
|
|
1814
1494
|
height: "8",
|
|
1815
1495
|
rx: "2"
|
|
1816
|
-
}, /* @__PURE__ */
|
|
1496
|
+
}, /* @__PURE__ */ React.createElement("animate", {
|
|
1817
1497
|
attributeName: "y",
|
|
1818
1498
|
from: "16",
|
|
1819
1499
|
to: "16",
|
|
@@ -1867,3127 +1547,25 @@ function InfiniteScroll(props) {
|
|
|
1867
1547
|
parent.removeEventListener("scroll", onScroll);
|
|
1868
1548
|
};
|
|
1869
1549
|
}, []);
|
|
1870
|
-
return /* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1871
1551
|
className: classNames({ [className]: true, "pda-infinite-scroll": true }),
|
|
1872
1552
|
style,
|
|
1873
1553
|
ref: elementRef
|
|
1874
|
-
}, hasMore ? /* @__PURE__ */
|
|
1554
|
+
}, hasMore ? /* @__PURE__ */ React.createElement("div", {
|
|
1875
1555
|
className: "pda-infinite-scroll-view"
|
|
1876
|
-
}, /* @__PURE__ */
|
|
1556
|
+
}, /* @__PURE__ */ React.createElement("span", null, "\u52A0\u8F7D\u4E2D"), /* @__PURE__ */ React.createElement(Loading, null)) : /* @__PURE__ */ React.createElement("div", {
|
|
1877
1557
|
className: "pda-infinite-scroll-view"
|
|
1878
|
-
}, /* @__PURE__ */
|
|
1558
|
+
}, /* @__PURE__ */ React.createElement("span", null, "\u6CA1\u6709\u66F4\u591A\u4E86~")));
|
|
1879
1559
|
}
|
|
1880
1560
|
var index = "";
|
|
1881
|
-
let updateQueue = makeQueue();
|
|
1882
|
-
const raf = (fn) => schedule(fn, updateQueue);
|
|
1883
|
-
let writeQueue = makeQueue();
|
|
1884
|
-
raf.write = (fn) => schedule(fn, writeQueue);
|
|
1885
|
-
let onStartQueue = makeQueue();
|
|
1886
|
-
raf.onStart = (fn) => schedule(fn, onStartQueue);
|
|
1887
|
-
let onFrameQueue = makeQueue();
|
|
1888
|
-
raf.onFrame = (fn) => schedule(fn, onFrameQueue);
|
|
1889
|
-
let onFinishQueue = makeQueue();
|
|
1890
|
-
raf.onFinish = (fn) => schedule(fn, onFinishQueue);
|
|
1891
|
-
let timeouts = [];
|
|
1892
|
-
raf.setTimeout = (handler, ms) => {
|
|
1893
|
-
let time = raf.now() + ms;
|
|
1894
|
-
let cancel = () => {
|
|
1895
|
-
let i = timeouts.findIndex((t) => t.cancel == cancel);
|
|
1896
|
-
if (~i)
|
|
1897
|
-
timeouts.splice(i, 1);
|
|
1898
|
-
__raf.count -= ~i ? 1 : 0;
|
|
1899
|
-
};
|
|
1900
|
-
let timeout = {
|
|
1901
|
-
time,
|
|
1902
|
-
handler,
|
|
1903
|
-
cancel
|
|
1904
|
-
};
|
|
1905
|
-
timeouts.splice(findTimeout(time), 0, timeout);
|
|
1906
|
-
__raf.count += 1;
|
|
1907
|
-
start();
|
|
1908
|
-
return timeout;
|
|
1909
|
-
};
|
|
1910
|
-
let findTimeout = (time) => ~(~timeouts.findIndex((t) => t.time > time) || ~timeouts.length);
|
|
1911
|
-
raf.cancel = (fn) => {
|
|
1912
|
-
updateQueue.delete(fn);
|
|
1913
|
-
writeQueue.delete(fn);
|
|
1914
|
-
};
|
|
1915
|
-
raf.sync = (fn) => {
|
|
1916
|
-
sync = true;
|
|
1917
|
-
raf.batchedUpdates(fn);
|
|
1918
|
-
sync = false;
|
|
1919
|
-
};
|
|
1920
|
-
raf.throttle = (fn) => {
|
|
1921
|
-
let lastArgs;
|
|
1922
|
-
function queuedFn() {
|
|
1923
|
-
try {
|
|
1924
|
-
fn(...lastArgs);
|
|
1925
|
-
} finally {
|
|
1926
|
-
lastArgs = null;
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
function throttled(...args) {
|
|
1930
|
-
lastArgs = args;
|
|
1931
|
-
raf.onStart(queuedFn);
|
|
1932
|
-
}
|
|
1933
|
-
throttled.handler = fn;
|
|
1934
|
-
throttled.cancel = () => {
|
|
1935
|
-
onStartQueue.delete(queuedFn);
|
|
1936
|
-
lastArgs = null;
|
|
1937
|
-
};
|
|
1938
|
-
return throttled;
|
|
1939
|
-
};
|
|
1940
|
-
let nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : () => {
|
|
1941
|
-
};
|
|
1942
|
-
raf.use = (impl) => nativeRaf = impl;
|
|
1943
|
-
raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now;
|
|
1944
|
-
raf.batchedUpdates = (fn) => fn();
|
|
1945
|
-
raf.catch = console.error;
|
|
1946
|
-
raf.frameLoop = "always";
|
|
1947
|
-
raf.advance = () => {
|
|
1948
|
-
if (raf.frameLoop !== "demand") {
|
|
1949
|
-
console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand");
|
|
1950
|
-
} else {
|
|
1951
|
-
update();
|
|
1952
|
-
}
|
|
1953
|
-
};
|
|
1954
|
-
let ts = -1;
|
|
1955
|
-
let sync = false;
|
|
1956
|
-
function schedule(fn, queue) {
|
|
1957
|
-
if (sync) {
|
|
1958
|
-
queue.delete(fn);
|
|
1959
|
-
fn(0);
|
|
1960
|
-
} else {
|
|
1961
|
-
queue.add(fn);
|
|
1962
|
-
start();
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
function start() {
|
|
1966
|
-
if (ts < 0) {
|
|
1967
|
-
ts = 0;
|
|
1968
|
-
if (raf.frameLoop !== "demand") {
|
|
1969
|
-
nativeRaf(loop);
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
function loop() {
|
|
1974
|
-
if (~ts) {
|
|
1975
|
-
nativeRaf(loop);
|
|
1976
|
-
raf.batchedUpdates(update);
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
function update() {
|
|
1980
|
-
let prevTs = ts;
|
|
1981
|
-
ts = raf.now();
|
|
1982
|
-
let count = findTimeout(ts);
|
|
1983
|
-
if (count) {
|
|
1984
|
-
eachSafely(timeouts.splice(0, count), (t) => t.handler());
|
|
1985
|
-
__raf.count -= count;
|
|
1986
|
-
}
|
|
1987
|
-
onStartQueue.flush();
|
|
1988
|
-
updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);
|
|
1989
|
-
onFrameQueue.flush();
|
|
1990
|
-
writeQueue.flush();
|
|
1991
|
-
onFinishQueue.flush();
|
|
1992
|
-
}
|
|
1993
|
-
function makeQueue() {
|
|
1994
|
-
let next = new Set();
|
|
1995
|
-
let current = next;
|
|
1996
|
-
return {
|
|
1997
|
-
add(fn) {
|
|
1998
|
-
__raf.count += current == next && !next.has(fn) ? 1 : 0;
|
|
1999
|
-
next.add(fn);
|
|
2000
|
-
},
|
|
2001
|
-
delete(fn) {
|
|
2002
|
-
__raf.count -= current == next && next.has(fn) ? 1 : 0;
|
|
2003
|
-
return next.delete(fn);
|
|
2004
|
-
},
|
|
2005
|
-
flush(arg) {
|
|
2006
|
-
if (current.size) {
|
|
2007
|
-
next = new Set();
|
|
2008
|
-
__raf.count -= current.size;
|
|
2009
|
-
eachSafely(current, (fn) => fn(arg) && next.add(fn));
|
|
2010
|
-
__raf.count += next.size;
|
|
2011
|
-
current = next;
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
};
|
|
2015
|
-
}
|
|
2016
|
-
function eachSafely(values, each2) {
|
|
2017
|
-
values.forEach((value) => {
|
|
2018
|
-
try {
|
|
2019
|
-
each2(value);
|
|
2020
|
-
} catch (e) {
|
|
2021
|
-
raf.catch(e);
|
|
2022
|
-
}
|
|
2023
|
-
});
|
|
2024
|
-
}
|
|
2025
|
-
const __raf = {
|
|
2026
|
-
count: 0,
|
|
2027
|
-
clear() {
|
|
2028
|
-
ts = -1;
|
|
2029
|
-
timeouts = [];
|
|
2030
|
-
onStartQueue = makeQueue();
|
|
2031
|
-
updateQueue = makeQueue();
|
|
2032
|
-
onFrameQueue = makeQueue();
|
|
2033
|
-
writeQueue = makeQueue();
|
|
2034
|
-
onFinishQueue = makeQueue();
|
|
2035
|
-
__raf.count = 0;
|
|
2036
|
-
}
|
|
2037
|
-
};
|
|
2038
|
-
function noop() {
|
|
2039
|
-
}
|
|
2040
|
-
const defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {
|
|
2041
|
-
value,
|
|
2042
|
-
writable: true,
|
|
2043
|
-
configurable: true
|
|
2044
|
-
});
|
|
2045
|
-
const is = {
|
|
2046
|
-
arr: Array.isArray,
|
|
2047
|
-
obj: (a) => !!a && a.constructor.name === "Object",
|
|
2048
|
-
fun: (a) => typeof a === "function",
|
|
2049
|
-
str: (a) => typeof a === "string",
|
|
2050
|
-
num: (a) => typeof a === "number",
|
|
2051
|
-
und: (a) => a === void 0
|
|
2052
|
-
};
|
|
2053
|
-
function isEqual(a, b) {
|
|
2054
|
-
if (is.arr(a)) {
|
|
2055
|
-
if (!is.arr(b) || a.length !== b.length)
|
|
2056
|
-
return false;
|
|
2057
|
-
for (let i = 0; i < a.length; i++) {
|
|
2058
|
-
if (a[i] !== b[i])
|
|
2059
|
-
return false;
|
|
2060
|
-
}
|
|
2061
|
-
return true;
|
|
2062
|
-
}
|
|
2063
|
-
return a === b;
|
|
2064
|
-
}
|
|
2065
|
-
const each = (obj, fn) => obj.forEach(fn);
|
|
2066
|
-
function eachProp(obj, fn, ctx2) {
|
|
2067
|
-
if (is.arr(obj)) {
|
|
2068
|
-
for (let i = 0; i < obj.length; i++) {
|
|
2069
|
-
fn.call(ctx2, obj[i], `${i}`);
|
|
2070
|
-
}
|
|
2071
|
-
return;
|
|
2072
|
-
}
|
|
2073
|
-
for (const key in obj) {
|
|
2074
|
-
if (obj.hasOwnProperty(key)) {
|
|
2075
|
-
fn.call(ctx2, obj[key], key);
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
const toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
|
|
2080
|
-
function flush(queue, iterator) {
|
|
2081
|
-
if (queue.size) {
|
|
2082
|
-
const items = Array.from(queue);
|
|
2083
|
-
queue.clear();
|
|
2084
|
-
each(items, iterator);
|
|
2085
|
-
}
|
|
2086
|
-
}
|
|
2087
|
-
const flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args));
|
|
2088
|
-
let createStringInterpolator$1;
|
|
2089
|
-
let to;
|
|
2090
|
-
let colors$1 = null;
|
|
2091
|
-
let skipAnimation = false;
|
|
2092
|
-
let willAdvance = noop;
|
|
2093
|
-
const assign = (globals2) => {
|
|
2094
|
-
if (globals2.to)
|
|
2095
|
-
to = globals2.to;
|
|
2096
|
-
if (globals2.now)
|
|
2097
|
-
raf.now = globals2.now;
|
|
2098
|
-
if (globals2.colors !== void 0)
|
|
2099
|
-
colors$1 = globals2.colors;
|
|
2100
|
-
if (globals2.skipAnimation != null)
|
|
2101
|
-
skipAnimation = globals2.skipAnimation;
|
|
2102
|
-
if (globals2.createStringInterpolator)
|
|
2103
|
-
createStringInterpolator$1 = globals2.createStringInterpolator;
|
|
2104
|
-
if (globals2.requestAnimationFrame)
|
|
2105
|
-
raf.use(globals2.requestAnimationFrame);
|
|
2106
|
-
if (globals2.batchedUpdates)
|
|
2107
|
-
raf.batchedUpdates = globals2.batchedUpdates;
|
|
2108
|
-
if (globals2.willAdvance)
|
|
2109
|
-
willAdvance = globals2.willAdvance;
|
|
2110
|
-
if (globals2.frameLoop)
|
|
2111
|
-
raf.frameLoop = globals2.frameLoop;
|
|
2112
|
-
};
|
|
2113
|
-
var globals = /* @__PURE__ */ Object.freeze({
|
|
2114
|
-
__proto__: null,
|
|
2115
|
-
get createStringInterpolator() {
|
|
2116
|
-
return createStringInterpolator$1;
|
|
2117
|
-
},
|
|
2118
|
-
get to() {
|
|
2119
|
-
return to;
|
|
2120
|
-
},
|
|
2121
|
-
get colors() {
|
|
2122
|
-
return colors$1;
|
|
2123
|
-
},
|
|
2124
|
-
get skipAnimation() {
|
|
2125
|
-
return skipAnimation;
|
|
2126
|
-
},
|
|
2127
|
-
get willAdvance() {
|
|
2128
|
-
return willAdvance;
|
|
2129
|
-
},
|
|
2130
|
-
assign
|
|
2131
|
-
});
|
|
2132
|
-
const startQueue = new Set();
|
|
2133
|
-
let currentFrame = [];
|
|
2134
|
-
let prevFrame = [];
|
|
2135
|
-
let priority = 0;
|
|
2136
|
-
const frameLoop = {
|
|
2137
|
-
get idle() {
|
|
2138
|
-
return !startQueue.size && !currentFrame.length;
|
|
2139
|
-
},
|
|
2140
|
-
start(animation) {
|
|
2141
|
-
if (priority > animation.priority) {
|
|
2142
|
-
startQueue.add(animation);
|
|
2143
|
-
raf.onStart(flushStartQueue);
|
|
2144
|
-
} else {
|
|
2145
|
-
startSafely(animation);
|
|
2146
|
-
raf(advance);
|
|
2147
|
-
}
|
|
2148
|
-
},
|
|
2149
|
-
advance,
|
|
2150
|
-
sort(animation) {
|
|
2151
|
-
if (priority) {
|
|
2152
|
-
raf.onFrame(() => frameLoop.sort(animation));
|
|
2153
|
-
} else {
|
|
2154
|
-
const prevIndex = currentFrame.indexOf(animation);
|
|
2155
|
-
if (~prevIndex) {
|
|
2156
|
-
currentFrame.splice(prevIndex, 1);
|
|
2157
|
-
startUnsafely(animation);
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
},
|
|
2161
|
-
clear() {
|
|
2162
|
-
currentFrame = [];
|
|
2163
|
-
startQueue.clear();
|
|
2164
|
-
}
|
|
2165
|
-
};
|
|
2166
|
-
function flushStartQueue() {
|
|
2167
|
-
startQueue.forEach(startSafely);
|
|
2168
|
-
startQueue.clear();
|
|
2169
|
-
raf(advance);
|
|
2170
|
-
}
|
|
2171
|
-
function startSafely(animation) {
|
|
2172
|
-
if (!currentFrame.includes(animation))
|
|
2173
|
-
startUnsafely(animation);
|
|
2174
|
-
}
|
|
2175
|
-
function startUnsafely(animation) {
|
|
2176
|
-
currentFrame.splice(findIndex(currentFrame, (other) => other.priority > animation.priority), 0, animation);
|
|
2177
|
-
}
|
|
2178
|
-
function advance(dt) {
|
|
2179
|
-
const nextFrame = prevFrame;
|
|
2180
|
-
for (let i = 0; i < currentFrame.length; i++) {
|
|
2181
|
-
const animation = currentFrame[i];
|
|
2182
|
-
priority = animation.priority;
|
|
2183
|
-
if (!animation.idle) {
|
|
2184
|
-
willAdvance(animation);
|
|
2185
|
-
animation.advance(dt);
|
|
2186
|
-
if (!animation.idle) {
|
|
2187
|
-
nextFrame.push(animation);
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
priority = 0;
|
|
2192
|
-
prevFrame = currentFrame;
|
|
2193
|
-
prevFrame.length = 0;
|
|
2194
|
-
currentFrame = nextFrame;
|
|
2195
|
-
return currentFrame.length > 0;
|
|
2196
|
-
}
|
|
2197
|
-
function findIndex(arr, test) {
|
|
2198
|
-
const index2 = arr.findIndex(test);
|
|
2199
|
-
return index2 < 0 ? arr.length : index2;
|
|
2200
|
-
}
|
|
2201
|
-
const colors = {
|
|
2202
|
-
transparent: 0,
|
|
2203
|
-
aliceblue: 4042850303,
|
|
2204
|
-
antiquewhite: 4209760255,
|
|
2205
|
-
aqua: 16777215,
|
|
2206
|
-
aquamarine: 2147472639,
|
|
2207
|
-
azure: 4043309055,
|
|
2208
|
-
beige: 4126530815,
|
|
2209
|
-
bisque: 4293182719,
|
|
2210
|
-
black: 255,
|
|
2211
|
-
blanchedalmond: 4293643775,
|
|
2212
|
-
blue: 65535,
|
|
2213
|
-
blueviolet: 2318131967,
|
|
2214
|
-
brown: 2771004159,
|
|
2215
|
-
burlywood: 3736635391,
|
|
2216
|
-
burntsienna: 3934150143,
|
|
2217
|
-
cadetblue: 1604231423,
|
|
2218
|
-
chartreuse: 2147418367,
|
|
2219
|
-
chocolate: 3530104575,
|
|
2220
|
-
coral: 4286533887,
|
|
2221
|
-
cornflowerblue: 1687547391,
|
|
2222
|
-
cornsilk: 4294499583,
|
|
2223
|
-
crimson: 3692313855,
|
|
2224
|
-
cyan: 16777215,
|
|
2225
|
-
darkblue: 35839,
|
|
2226
|
-
darkcyan: 9145343,
|
|
2227
|
-
darkgoldenrod: 3095792639,
|
|
2228
|
-
darkgray: 2846468607,
|
|
2229
|
-
darkgreen: 6553855,
|
|
2230
|
-
darkgrey: 2846468607,
|
|
2231
|
-
darkkhaki: 3182914559,
|
|
2232
|
-
darkmagenta: 2332068863,
|
|
2233
|
-
darkolivegreen: 1433087999,
|
|
2234
|
-
darkorange: 4287365375,
|
|
2235
|
-
darkorchid: 2570243327,
|
|
2236
|
-
darkred: 2332033279,
|
|
2237
|
-
darksalmon: 3918953215,
|
|
2238
|
-
darkseagreen: 2411499519,
|
|
2239
|
-
darkslateblue: 1211993087,
|
|
2240
|
-
darkslategray: 793726975,
|
|
2241
|
-
darkslategrey: 793726975,
|
|
2242
|
-
darkturquoise: 13554175,
|
|
2243
|
-
darkviolet: 2483082239,
|
|
2244
|
-
deeppink: 4279538687,
|
|
2245
|
-
deepskyblue: 12582911,
|
|
2246
|
-
dimgray: 1768516095,
|
|
2247
|
-
dimgrey: 1768516095,
|
|
2248
|
-
dodgerblue: 512819199,
|
|
2249
|
-
firebrick: 2988581631,
|
|
2250
|
-
floralwhite: 4294635775,
|
|
2251
|
-
forestgreen: 579543807,
|
|
2252
|
-
fuchsia: 4278255615,
|
|
2253
|
-
gainsboro: 3705462015,
|
|
2254
|
-
ghostwhite: 4177068031,
|
|
2255
|
-
gold: 4292280575,
|
|
2256
|
-
goldenrod: 3668254975,
|
|
2257
|
-
gray: 2155905279,
|
|
2258
|
-
green: 8388863,
|
|
2259
|
-
greenyellow: 2919182335,
|
|
2260
|
-
grey: 2155905279,
|
|
2261
|
-
honeydew: 4043305215,
|
|
2262
|
-
hotpink: 4285117695,
|
|
2263
|
-
indianred: 3445382399,
|
|
2264
|
-
indigo: 1258324735,
|
|
2265
|
-
ivory: 4294963455,
|
|
2266
|
-
khaki: 4041641215,
|
|
2267
|
-
lavender: 3873897215,
|
|
2268
|
-
lavenderblush: 4293981695,
|
|
2269
|
-
lawngreen: 2096890111,
|
|
2270
|
-
lemonchiffon: 4294626815,
|
|
2271
|
-
lightblue: 2916673279,
|
|
2272
|
-
lightcoral: 4034953471,
|
|
2273
|
-
lightcyan: 3774873599,
|
|
2274
|
-
lightgoldenrodyellow: 4210742015,
|
|
2275
|
-
lightgray: 3553874943,
|
|
2276
|
-
lightgreen: 2431553791,
|
|
2277
|
-
lightgrey: 3553874943,
|
|
2278
|
-
lightpink: 4290167295,
|
|
2279
|
-
lightsalmon: 4288707327,
|
|
2280
|
-
lightseagreen: 548580095,
|
|
2281
|
-
lightskyblue: 2278488831,
|
|
2282
|
-
lightslategray: 2005441023,
|
|
2283
|
-
lightslategrey: 2005441023,
|
|
2284
|
-
lightsteelblue: 2965692159,
|
|
2285
|
-
lightyellow: 4294959359,
|
|
2286
|
-
lime: 16711935,
|
|
2287
|
-
limegreen: 852308735,
|
|
2288
|
-
linen: 4210091775,
|
|
2289
|
-
magenta: 4278255615,
|
|
2290
|
-
maroon: 2147483903,
|
|
2291
|
-
mediumaquamarine: 1724754687,
|
|
2292
|
-
mediumblue: 52735,
|
|
2293
|
-
mediumorchid: 3126187007,
|
|
2294
|
-
mediumpurple: 2473647103,
|
|
2295
|
-
mediumseagreen: 1018393087,
|
|
2296
|
-
mediumslateblue: 2070474495,
|
|
2297
|
-
mediumspringgreen: 16423679,
|
|
2298
|
-
mediumturquoise: 1221709055,
|
|
2299
|
-
mediumvioletred: 3340076543,
|
|
2300
|
-
midnightblue: 421097727,
|
|
2301
|
-
mintcream: 4127193855,
|
|
2302
|
-
mistyrose: 4293190143,
|
|
2303
|
-
moccasin: 4293178879,
|
|
2304
|
-
navajowhite: 4292783615,
|
|
2305
|
-
navy: 33023,
|
|
2306
|
-
oldlace: 4260751103,
|
|
2307
|
-
olive: 2155872511,
|
|
2308
|
-
olivedrab: 1804477439,
|
|
2309
|
-
orange: 4289003775,
|
|
2310
|
-
orangered: 4282712319,
|
|
2311
|
-
orchid: 3664828159,
|
|
2312
|
-
palegoldenrod: 4008225535,
|
|
2313
|
-
palegreen: 2566625535,
|
|
2314
|
-
paleturquoise: 2951671551,
|
|
2315
|
-
palevioletred: 3681588223,
|
|
2316
|
-
papayawhip: 4293907967,
|
|
2317
|
-
peachpuff: 4292524543,
|
|
2318
|
-
peru: 3448061951,
|
|
2319
|
-
pink: 4290825215,
|
|
2320
|
-
plum: 3718307327,
|
|
2321
|
-
powderblue: 2967529215,
|
|
2322
|
-
purple: 2147516671,
|
|
2323
|
-
rebeccapurple: 1714657791,
|
|
2324
|
-
red: 4278190335,
|
|
2325
|
-
rosybrown: 3163525119,
|
|
2326
|
-
royalblue: 1097458175,
|
|
2327
|
-
saddlebrown: 2336560127,
|
|
2328
|
-
salmon: 4202722047,
|
|
2329
|
-
sandybrown: 4104413439,
|
|
2330
|
-
seagreen: 780883967,
|
|
2331
|
-
seashell: 4294307583,
|
|
2332
|
-
sienna: 2689740287,
|
|
2333
|
-
silver: 3233857791,
|
|
2334
|
-
skyblue: 2278484991,
|
|
2335
|
-
slateblue: 1784335871,
|
|
2336
|
-
slategray: 1887473919,
|
|
2337
|
-
slategrey: 1887473919,
|
|
2338
|
-
snow: 4294638335,
|
|
2339
|
-
springgreen: 16744447,
|
|
2340
|
-
steelblue: 1182971135,
|
|
2341
|
-
tan: 3535047935,
|
|
2342
|
-
teal: 8421631,
|
|
2343
|
-
thistle: 3636451583,
|
|
2344
|
-
tomato: 4284696575,
|
|
2345
|
-
turquoise: 1088475391,
|
|
2346
|
-
violet: 4001558271,
|
|
2347
|
-
wheat: 4125012991,
|
|
2348
|
-
white: 4294967295,
|
|
2349
|
-
whitesmoke: 4126537215,
|
|
2350
|
-
yellow: 4294902015,
|
|
2351
|
-
yellowgreen: 2597139199
|
|
2352
|
-
};
|
|
2353
|
-
const NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
2354
|
-
const PERCENTAGE = NUMBER + "%";
|
|
2355
|
-
function call(...parts) {
|
|
2356
|
-
return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)";
|
|
2357
|
-
}
|
|
2358
|
-
const rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
|
|
2359
|
-
const rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
2360
|
-
const hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
|
2361
|
-
const hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
|
2362
|
-
const hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
2363
|
-
const hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
2364
|
-
const hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
2365
|
-
const hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
2366
|
-
function normalizeColor(color) {
|
|
2367
|
-
let match;
|
|
2368
|
-
if (typeof color === "number") {
|
|
2369
|
-
return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
|
|
2370
|
-
}
|
|
2371
|
-
if (match = hex6.exec(color))
|
|
2372
|
-
return parseInt(match[1] + "ff", 16) >>> 0;
|
|
2373
|
-
if (colors$1 && colors$1[color] !== void 0) {
|
|
2374
|
-
return colors$1[color];
|
|
2375
|
-
}
|
|
2376
|
-
if (match = rgb.exec(color)) {
|
|
2377
|
-
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0;
|
|
2378
|
-
}
|
|
2379
|
-
if (match = rgba.exec(color)) {
|
|
2380
|
-
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;
|
|
2381
|
-
}
|
|
2382
|
-
if (match = hex3.exec(color)) {
|
|
2383
|
-
return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", 16) >>> 0;
|
|
2384
|
-
}
|
|
2385
|
-
if (match = hex8.exec(color))
|
|
2386
|
-
return parseInt(match[1], 16) >>> 0;
|
|
2387
|
-
if (match = hex4.exec(color)) {
|
|
2388
|
-
return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
|
|
2389
|
-
}
|
|
2390
|
-
if (match = hsl.exec(color)) {
|
|
2391
|
-
return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 255) >>> 0;
|
|
2392
|
-
}
|
|
2393
|
-
if (match = hsla.exec(color)) {
|
|
2394
|
-
return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
|
|
2395
|
-
}
|
|
2396
|
-
return null;
|
|
2397
|
-
}
|
|
2398
|
-
function hue2rgb(p, q, t) {
|
|
2399
|
-
if (t < 0)
|
|
2400
|
-
t += 1;
|
|
2401
|
-
if (t > 1)
|
|
2402
|
-
t -= 1;
|
|
2403
|
-
if (t < 1 / 6)
|
|
2404
|
-
return p + (q - p) * 6 * t;
|
|
2405
|
-
if (t < 1 / 2)
|
|
2406
|
-
return q;
|
|
2407
|
-
if (t < 2 / 3)
|
|
2408
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
2409
|
-
return p;
|
|
2410
|
-
}
|
|
2411
|
-
function hslToRgb(h, s, l) {
|
|
2412
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
2413
|
-
const p = 2 * l - q;
|
|
2414
|
-
const r2 = hue2rgb(p, q, h + 1 / 3);
|
|
2415
|
-
const g = hue2rgb(p, q, h);
|
|
2416
|
-
const b = hue2rgb(p, q, h - 1 / 3);
|
|
2417
|
-
return Math.round(r2 * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
|
2418
|
-
}
|
|
2419
|
-
function parse255(str) {
|
|
2420
|
-
const int = parseInt(str, 10);
|
|
2421
|
-
if (int < 0)
|
|
2422
|
-
return 0;
|
|
2423
|
-
if (int > 255)
|
|
2424
|
-
return 255;
|
|
2425
|
-
return int;
|
|
2426
|
-
}
|
|
2427
|
-
function parse360(str) {
|
|
2428
|
-
const int = parseFloat(str);
|
|
2429
|
-
return (int % 360 + 360) % 360 / 360;
|
|
2430
|
-
}
|
|
2431
|
-
function parse1(str) {
|
|
2432
|
-
const num = parseFloat(str);
|
|
2433
|
-
if (num < 0)
|
|
2434
|
-
return 0;
|
|
2435
|
-
if (num > 1)
|
|
2436
|
-
return 255;
|
|
2437
|
-
return Math.round(num * 255);
|
|
2438
|
-
}
|
|
2439
|
-
function parsePercentage(str) {
|
|
2440
|
-
const int = parseFloat(str);
|
|
2441
|
-
if (int < 0)
|
|
2442
|
-
return 0;
|
|
2443
|
-
if (int > 100)
|
|
2444
|
-
return 1;
|
|
2445
|
-
return int / 100;
|
|
2446
|
-
}
|
|
2447
|
-
function colorToRgba(input) {
|
|
2448
|
-
let int32Color = normalizeColor(input);
|
|
2449
|
-
if (int32Color === null)
|
|
2450
|
-
return input;
|
|
2451
|
-
int32Color = int32Color || 0;
|
|
2452
|
-
let r2 = (int32Color & 4278190080) >>> 24;
|
|
2453
|
-
let g = (int32Color & 16711680) >>> 16;
|
|
2454
|
-
let b = (int32Color & 65280) >>> 8;
|
|
2455
|
-
let a = (int32Color & 255) / 255;
|
|
2456
|
-
return `rgba(${r2}, ${g}, ${b}, ${a})`;
|
|
2457
|
-
}
|
|
2458
|
-
const createInterpolator = (range, output, extrapolate) => {
|
|
2459
|
-
if (is.fun(range)) {
|
|
2460
|
-
return range;
|
|
2461
|
-
}
|
|
2462
|
-
if (is.arr(range)) {
|
|
2463
|
-
return createInterpolator({
|
|
2464
|
-
range,
|
|
2465
|
-
output,
|
|
2466
|
-
extrapolate
|
|
2467
|
-
});
|
|
2468
|
-
}
|
|
2469
|
-
if (is.str(range.output[0])) {
|
|
2470
|
-
return createStringInterpolator$1(range);
|
|
2471
|
-
}
|
|
2472
|
-
const config2 = range;
|
|
2473
|
-
const outputRange = config2.output;
|
|
2474
|
-
const inputRange = config2.range || [0, 1];
|
|
2475
|
-
const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend";
|
|
2476
|
-
const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend";
|
|
2477
|
-
const easing = config2.easing || ((t) => t);
|
|
2478
|
-
return (input) => {
|
|
2479
|
-
const range2 = findRange(input, inputRange);
|
|
2480
|
-
return interpolate(input, inputRange[range2], inputRange[range2 + 1], outputRange[range2], outputRange[range2 + 1], easing, extrapolateLeft, extrapolateRight, config2.map);
|
|
2481
|
-
};
|
|
2482
|
-
};
|
|
2483
|
-
function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
|
|
2484
|
-
let result = map ? map(input) : input;
|
|
2485
|
-
if (result < inputMin) {
|
|
2486
|
-
if (extrapolateLeft === "identity")
|
|
2487
|
-
return result;
|
|
2488
|
-
else if (extrapolateLeft === "clamp")
|
|
2489
|
-
result = inputMin;
|
|
2490
|
-
}
|
|
2491
|
-
if (result > inputMax) {
|
|
2492
|
-
if (extrapolateRight === "identity")
|
|
2493
|
-
return result;
|
|
2494
|
-
else if (extrapolateRight === "clamp")
|
|
2495
|
-
result = inputMax;
|
|
2496
|
-
}
|
|
2497
|
-
if (outputMin === outputMax)
|
|
2498
|
-
return outputMin;
|
|
2499
|
-
if (inputMin === inputMax)
|
|
2500
|
-
return input <= inputMin ? outputMin : outputMax;
|
|
2501
|
-
if (inputMin === -Infinity)
|
|
2502
|
-
result = -result;
|
|
2503
|
-
else if (inputMax === Infinity)
|
|
2504
|
-
result = result - inputMin;
|
|
2505
|
-
else
|
|
2506
|
-
result = (result - inputMin) / (inputMax - inputMin);
|
|
2507
|
-
result = easing(result);
|
|
2508
|
-
if (outputMin === -Infinity)
|
|
2509
|
-
result = -result;
|
|
2510
|
-
else if (outputMax === Infinity)
|
|
2511
|
-
result = result + outputMin;
|
|
2512
|
-
else
|
|
2513
|
-
result = result * (outputMax - outputMin) + outputMin;
|
|
2514
|
-
return result;
|
|
2515
|
-
}
|
|
2516
|
-
function findRange(input, inputRange) {
|
|
2517
|
-
for (var i = 1; i < inputRange.length - 1; ++i)
|
|
2518
|
-
if (inputRange[i] >= input)
|
|
2519
|
-
break;
|
|
2520
|
-
return i - 1;
|
|
2521
|
-
}
|
|
2522
|
-
function _extends$2() {
|
|
2523
|
-
_extends$2 = Object.assign || function(target) {
|
|
2524
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2525
|
-
var source = arguments[i];
|
|
2526
|
-
for (var key in source) {
|
|
2527
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2528
|
-
target[key] = source[key];
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
return target;
|
|
2533
|
-
};
|
|
2534
|
-
return _extends$2.apply(this, arguments);
|
|
2535
|
-
}
|
|
2536
|
-
const $get = Symbol.for("FluidValue.get");
|
|
2537
|
-
const $observers = Symbol.for("FluidValue.observers");
|
|
2538
|
-
const hasFluidValue = (arg) => Boolean(arg && arg[$get]);
|
|
2539
|
-
const getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg;
|
|
2540
|
-
const getFluidObservers = (target) => target[$observers] || null;
|
|
2541
|
-
function callFluidObserver(observer, event) {
|
|
2542
|
-
if (observer.eventObserved) {
|
|
2543
|
-
observer.eventObserved(event);
|
|
2544
|
-
} else {
|
|
2545
|
-
observer(event);
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
function callFluidObservers(target, event) {
|
|
2549
|
-
let observers = target[$observers];
|
|
2550
|
-
if (observers) {
|
|
2551
|
-
observers.forEach((observer) => {
|
|
2552
|
-
callFluidObserver(observer, event);
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
}
|
|
2556
|
-
class FluidValue {
|
|
2557
|
-
constructor(get) {
|
|
2558
|
-
this[$get] = void 0;
|
|
2559
|
-
this[$observers] = void 0;
|
|
2560
|
-
if (!get && !(get = this.get)) {
|
|
2561
|
-
throw Error("Unknown getter");
|
|
2562
|
-
}
|
|
2563
|
-
setFluidGetter(this, get);
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
const setFluidGetter = (target, get) => setHidden(target, $get, get);
|
|
2567
|
-
function addFluidObserver(target, observer) {
|
|
2568
|
-
if (target[$get]) {
|
|
2569
|
-
let observers = target[$observers];
|
|
2570
|
-
if (!observers) {
|
|
2571
|
-
setHidden(target, $observers, observers = new Set());
|
|
2572
|
-
}
|
|
2573
|
-
if (!observers.has(observer)) {
|
|
2574
|
-
observers.add(observer);
|
|
2575
|
-
if (target.observerAdded) {
|
|
2576
|
-
target.observerAdded(observers.size, observer);
|
|
2577
|
-
}
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
return observer;
|
|
2581
|
-
}
|
|
2582
|
-
function removeFluidObserver(target, observer) {
|
|
2583
|
-
let observers = target[$observers];
|
|
2584
|
-
if (observers && observers.has(observer)) {
|
|
2585
|
-
const count = observers.size - 1;
|
|
2586
|
-
if (count) {
|
|
2587
|
-
observers.delete(observer);
|
|
2588
|
-
} else {
|
|
2589
|
-
target[$observers] = null;
|
|
2590
|
-
}
|
|
2591
|
-
if (target.observerRemoved) {
|
|
2592
|
-
target.observerRemoved(count, observer);
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
const setHidden = (target, key, value) => Object.defineProperty(target, key, {
|
|
2597
|
-
value,
|
|
2598
|
-
writable: true,
|
|
2599
|
-
configurable: true
|
|
2600
|
-
});
|
|
2601
|
-
const numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
|
|
2602
|
-
const colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;
|
|
2603
|
-
const unitRegex = new RegExp(`(${numberRegex.source})(%|[a-z]+)`, "i");
|
|
2604
|
-
let namedColorRegex;
|
|
2605
|
-
const rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi;
|
|
2606
|
-
const rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`;
|
|
2607
|
-
const createStringInterpolator = (config2) => {
|
|
2608
|
-
if (!namedColorRegex)
|
|
2609
|
-
namedColorRegex = colors$1 ? new RegExp(`(${Object.keys(colors$1).join("|")})(?!\\w)`, "g") : /^\b$/;
|
|
2610
|
-
const output = config2.output.map((value) => getFluidValue(value).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba));
|
|
2611
|
-
const keyframes = output.map((value) => value.match(numberRegex).map(Number));
|
|
2612
|
-
const outputRanges = keyframes[0].map((_, i) => keyframes.map((values) => {
|
|
2613
|
-
if (!(i in values)) {
|
|
2614
|
-
throw Error('The arity of each "output" value must be equal');
|
|
2615
|
-
}
|
|
2616
|
-
return values[i];
|
|
2617
|
-
}));
|
|
2618
|
-
const interpolators = outputRanges.map((output2) => createInterpolator(_extends$2({}, config2, {
|
|
2619
|
-
output: output2
|
|
2620
|
-
})));
|
|
2621
|
-
return (input) => {
|
|
2622
|
-
var _output$find;
|
|
2623
|
-
const missingUnit = !unitRegex.test(output[0]) && ((_output$find = output.find((value) => unitRegex.test(value))) == null ? void 0 : _output$find.replace(numberRegex, ""));
|
|
2624
|
-
let i = 0;
|
|
2625
|
-
return output[0].replace(numberRegex, () => `${interpolators[i++](input)}${missingUnit || ""}`).replace(rgbaRegex, rgbaRound);
|
|
2626
|
-
};
|
|
2627
|
-
};
|
|
2628
|
-
const prefix = "react-spring: ";
|
|
2629
|
-
const once = (fn) => {
|
|
2630
|
-
const func = fn;
|
|
2631
|
-
let called = false;
|
|
2632
|
-
if (typeof func != "function") {
|
|
2633
|
-
throw new TypeError(`${prefix}once requires a function parameter`);
|
|
2634
|
-
}
|
|
2635
|
-
return (...args) => {
|
|
2636
|
-
if (!called) {
|
|
2637
|
-
func(...args);
|
|
2638
|
-
called = true;
|
|
2639
|
-
}
|
|
2640
|
-
};
|
|
2641
|
-
};
|
|
2642
|
-
const warnInterpolate = once(console.warn);
|
|
2643
|
-
function deprecateInterpolate() {
|
|
2644
|
-
warnInterpolate(`${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`);
|
|
2645
|
-
}
|
|
2646
|
-
const warnDirectCall = once(console.warn);
|
|
2647
|
-
function deprecateDirectCall() {
|
|
2648
|
-
warnDirectCall(`${prefix}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`);
|
|
2649
|
-
}
|
|
2650
|
-
function isAnimatedString(value) {
|
|
2651
|
-
return is.str(value) && (value[0] == "#" || /\d/.test(value) || value in (colors$1 || {}));
|
|
2652
|
-
}
|
|
2653
|
-
const useOnce = (effect) => useEffect(effect, emptyDeps);
|
|
2654
|
-
const emptyDeps = [];
|
|
2655
|
-
function useForceUpdate() {
|
|
2656
|
-
const update2 = useState()[1];
|
|
2657
|
-
const mounted = useState(makeMountedRef)[0];
|
|
2658
|
-
useOnce(mounted.unmount);
|
|
2659
|
-
return () => {
|
|
2660
|
-
if (mounted.current) {
|
|
2661
|
-
update2({});
|
|
2662
|
-
}
|
|
2663
|
-
};
|
|
2664
|
-
}
|
|
2665
|
-
function makeMountedRef() {
|
|
2666
|
-
const mounted = {
|
|
2667
|
-
current: true,
|
|
2668
|
-
unmount: () => () => {
|
|
2669
|
-
mounted.current = false;
|
|
2670
|
-
}
|
|
2671
|
-
};
|
|
2672
|
-
return mounted;
|
|
2673
|
-
}
|
|
2674
|
-
function useMemoOne(getResult, inputs) {
|
|
2675
|
-
const [initial] = useState(() => ({
|
|
2676
|
-
inputs,
|
|
2677
|
-
result: getResult()
|
|
2678
|
-
}));
|
|
2679
|
-
const committed = useRef();
|
|
2680
|
-
const prevCache = committed.current;
|
|
2681
|
-
let cache = prevCache;
|
|
2682
|
-
if (cache) {
|
|
2683
|
-
const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs));
|
|
2684
|
-
if (!useCache) {
|
|
2685
|
-
cache = {
|
|
2686
|
-
inputs,
|
|
2687
|
-
result: getResult()
|
|
2688
|
-
};
|
|
2689
|
-
}
|
|
2690
|
-
} else {
|
|
2691
|
-
cache = initial;
|
|
2692
|
-
}
|
|
2693
|
-
useEffect(() => {
|
|
2694
|
-
committed.current = cache;
|
|
2695
|
-
if (prevCache == initial) {
|
|
2696
|
-
initial.inputs = initial.result = void 0;
|
|
2697
|
-
}
|
|
2698
|
-
}, [cache]);
|
|
2699
|
-
return cache.result;
|
|
2700
|
-
}
|
|
2701
|
-
function areInputsEqual(next, prev) {
|
|
2702
|
-
if (next.length !== prev.length) {
|
|
2703
|
-
return false;
|
|
2704
|
-
}
|
|
2705
|
-
for (let i = 0; i < next.length; i++) {
|
|
2706
|
-
if (next[i] !== prev[i]) {
|
|
2707
|
-
return false;
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
return true;
|
|
2711
|
-
}
|
|
2712
|
-
function usePrev(value) {
|
|
2713
|
-
const prevRef = useRef();
|
|
2714
|
-
useEffect(() => {
|
|
2715
|
-
prevRef.current = value;
|
|
2716
|
-
});
|
|
2717
|
-
return prevRef.current;
|
|
2718
|
-
}
|
|
2719
|
-
const useLayoutEffect = typeof window !== "undefined" && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;
|
|
2720
|
-
const $node = Symbol.for("Animated:node");
|
|
2721
|
-
const isAnimated = (value) => !!value && value[$node] === value;
|
|
2722
|
-
const getAnimated = (owner) => owner && owner[$node];
|
|
2723
|
-
const setAnimated = (owner, node) => defineHidden(owner, $node, node);
|
|
2724
|
-
const getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload();
|
|
2725
|
-
class Animated {
|
|
2726
|
-
constructor() {
|
|
2727
|
-
this.payload = void 0;
|
|
2728
|
-
setAnimated(this, this);
|
|
2729
|
-
}
|
|
2730
|
-
getPayload() {
|
|
2731
|
-
return this.payload || [];
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
class AnimatedValue extends Animated {
|
|
2735
|
-
constructor(_value) {
|
|
2736
|
-
super();
|
|
2737
|
-
this.done = true;
|
|
2738
|
-
this.elapsedTime = void 0;
|
|
2739
|
-
this.lastPosition = void 0;
|
|
2740
|
-
this.lastVelocity = void 0;
|
|
2741
|
-
this.v0 = void 0;
|
|
2742
|
-
this.durationProgress = 0;
|
|
2743
|
-
this._value = _value;
|
|
2744
|
-
if (is.num(this._value)) {
|
|
2745
|
-
this.lastPosition = this._value;
|
|
2746
|
-
}
|
|
2747
|
-
}
|
|
2748
|
-
static create(value) {
|
|
2749
|
-
return new AnimatedValue(value);
|
|
2750
|
-
}
|
|
2751
|
-
getPayload() {
|
|
2752
|
-
return [this];
|
|
2753
|
-
}
|
|
2754
|
-
getValue() {
|
|
2755
|
-
return this._value;
|
|
2756
|
-
}
|
|
2757
|
-
setValue(value, step) {
|
|
2758
|
-
if (is.num(value)) {
|
|
2759
|
-
this.lastPosition = value;
|
|
2760
|
-
if (step) {
|
|
2761
|
-
value = Math.round(value / step) * step;
|
|
2762
|
-
if (this.done) {
|
|
2763
|
-
this.lastPosition = value;
|
|
2764
|
-
}
|
|
2765
|
-
}
|
|
2766
|
-
}
|
|
2767
|
-
if (this._value === value) {
|
|
2768
|
-
return false;
|
|
2769
|
-
}
|
|
2770
|
-
this._value = value;
|
|
2771
|
-
return true;
|
|
2772
|
-
}
|
|
2773
|
-
reset() {
|
|
2774
|
-
const {
|
|
2775
|
-
done
|
|
2776
|
-
} = this;
|
|
2777
|
-
this.done = false;
|
|
2778
|
-
if (is.num(this._value)) {
|
|
2779
|
-
this.elapsedTime = 0;
|
|
2780
|
-
this.durationProgress = 0;
|
|
2781
|
-
this.lastPosition = this._value;
|
|
2782
|
-
if (done)
|
|
2783
|
-
this.lastVelocity = null;
|
|
2784
|
-
this.v0 = null;
|
|
2785
|
-
}
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
class AnimatedString extends AnimatedValue {
|
|
2789
|
-
constructor(value) {
|
|
2790
|
-
super(0);
|
|
2791
|
-
this._string = null;
|
|
2792
|
-
this._toString = void 0;
|
|
2793
|
-
this._toString = createInterpolator({
|
|
2794
|
-
output: [value, value]
|
|
2795
|
-
});
|
|
2796
|
-
}
|
|
2797
|
-
static create(value) {
|
|
2798
|
-
return new AnimatedString(value);
|
|
2799
|
-
}
|
|
2800
|
-
getValue() {
|
|
2801
|
-
let value = this._string;
|
|
2802
|
-
return value == null ? this._string = this._toString(this._value) : value;
|
|
2803
|
-
}
|
|
2804
|
-
setValue(value) {
|
|
2805
|
-
if (is.str(value)) {
|
|
2806
|
-
if (value == this._string) {
|
|
2807
|
-
return false;
|
|
2808
|
-
}
|
|
2809
|
-
this._string = value;
|
|
2810
|
-
this._value = 1;
|
|
2811
|
-
} else if (super.setValue(value)) {
|
|
2812
|
-
this._string = null;
|
|
2813
|
-
} else {
|
|
2814
|
-
return false;
|
|
2815
|
-
}
|
|
2816
|
-
return true;
|
|
2817
|
-
}
|
|
2818
|
-
reset(goal) {
|
|
2819
|
-
if (goal) {
|
|
2820
|
-
this._toString = createInterpolator({
|
|
2821
|
-
output: [this.getValue(), goal]
|
|
2822
|
-
});
|
|
2823
|
-
}
|
|
2824
|
-
this._value = 0;
|
|
2825
|
-
super.reset();
|
|
2826
|
-
}
|
|
2827
|
-
}
|
|
2828
|
-
const TreeContext = {
|
|
2829
|
-
dependencies: null
|
|
2830
|
-
};
|
|
2831
|
-
class AnimatedObject extends Animated {
|
|
2832
|
-
constructor(source) {
|
|
2833
|
-
super();
|
|
2834
|
-
this.source = source;
|
|
2835
|
-
this.setValue(source);
|
|
2836
|
-
}
|
|
2837
|
-
getValue(animated2) {
|
|
2838
|
-
const values = {};
|
|
2839
|
-
eachProp(this.source, (source, key) => {
|
|
2840
|
-
if (isAnimated(source)) {
|
|
2841
|
-
values[key] = source.getValue(animated2);
|
|
2842
|
-
} else if (hasFluidValue(source)) {
|
|
2843
|
-
values[key] = getFluidValue(source);
|
|
2844
|
-
} else if (!animated2) {
|
|
2845
|
-
values[key] = source;
|
|
2846
|
-
}
|
|
2847
|
-
});
|
|
2848
|
-
return values;
|
|
2849
|
-
}
|
|
2850
|
-
setValue(source) {
|
|
2851
|
-
this.source = source;
|
|
2852
|
-
this.payload = this._makePayload(source);
|
|
2853
|
-
}
|
|
2854
|
-
reset() {
|
|
2855
|
-
if (this.payload) {
|
|
2856
|
-
each(this.payload, (node) => node.reset());
|
|
2857
|
-
}
|
|
2858
|
-
}
|
|
2859
|
-
_makePayload(source) {
|
|
2860
|
-
if (source) {
|
|
2861
|
-
const payload = new Set();
|
|
2862
|
-
eachProp(source, this._addToPayload, payload);
|
|
2863
|
-
return Array.from(payload);
|
|
2864
|
-
}
|
|
2865
|
-
}
|
|
2866
|
-
_addToPayload(source) {
|
|
2867
|
-
if (TreeContext.dependencies && hasFluidValue(source)) {
|
|
2868
|
-
TreeContext.dependencies.add(source);
|
|
2869
|
-
}
|
|
2870
|
-
const payload = getPayload(source);
|
|
2871
|
-
if (payload) {
|
|
2872
|
-
each(payload, (node) => this.add(node));
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
class AnimatedArray extends AnimatedObject {
|
|
2877
|
-
constructor(source) {
|
|
2878
|
-
super(source);
|
|
2879
|
-
}
|
|
2880
|
-
static create(source) {
|
|
2881
|
-
return new AnimatedArray(source);
|
|
2882
|
-
}
|
|
2883
|
-
getValue() {
|
|
2884
|
-
return this.source.map((node) => node.getValue());
|
|
2885
|
-
}
|
|
2886
|
-
setValue(source) {
|
|
2887
|
-
const payload = this.getPayload();
|
|
2888
|
-
if (source.length == payload.length) {
|
|
2889
|
-
return payload.map((node, i) => node.setValue(source[i])).some(Boolean);
|
|
2890
|
-
}
|
|
2891
|
-
super.setValue(source.map(makeAnimated));
|
|
2892
|
-
return true;
|
|
2893
|
-
}
|
|
2894
|
-
}
|
|
2895
|
-
function makeAnimated(value) {
|
|
2896
|
-
const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue;
|
|
2897
|
-
return nodeType.create(value);
|
|
2898
|
-
}
|
|
2899
|
-
function getAnimatedType(value) {
|
|
2900
|
-
const parentNode = getAnimated(value);
|
|
2901
|
-
return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue;
|
|
2902
|
-
}
|
|
2903
|
-
function _extends$1() {
|
|
2904
|
-
_extends$1 = Object.assign || function(target) {
|
|
2905
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2906
|
-
var source = arguments[i];
|
|
2907
|
-
for (var key in source) {
|
|
2908
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2909
|
-
target[key] = source[key];
|
|
2910
|
-
}
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
return target;
|
|
2914
|
-
};
|
|
2915
|
-
return _extends$1.apply(this, arguments);
|
|
2916
|
-
}
|
|
2917
|
-
const withAnimated = (Component, host2) => {
|
|
2918
|
-
const hasInstance = !is.fun(Component) || Component.prototype && Component.prototype.isReactComponent;
|
|
2919
|
-
return forwardRef((givenProps, givenRef) => {
|
|
2920
|
-
const instanceRef = useRef(null);
|
|
2921
|
-
const ref = hasInstance && useCallback((value) => {
|
|
2922
|
-
instanceRef.current = updateRef(givenRef, value);
|
|
2923
|
-
}, [givenRef]);
|
|
2924
|
-
const [props, deps] = getAnimatedState(givenProps, host2);
|
|
2925
|
-
const forceUpdate = useForceUpdate();
|
|
2926
|
-
const callback = () => {
|
|
2927
|
-
const instance = instanceRef.current;
|
|
2928
|
-
if (hasInstance && !instance) {
|
|
2929
|
-
return;
|
|
2930
|
-
}
|
|
2931
|
-
const didUpdate = instance ? host2.applyAnimatedValues(instance, props.getValue(true)) : false;
|
|
2932
|
-
if (didUpdate === false) {
|
|
2933
|
-
forceUpdate();
|
|
2934
|
-
}
|
|
2935
|
-
};
|
|
2936
|
-
const observer = new PropsObserver(callback, deps);
|
|
2937
|
-
const observerRef = useRef();
|
|
2938
|
-
useLayoutEffect(() => {
|
|
2939
|
-
const lastObserver = observerRef.current;
|
|
2940
|
-
observerRef.current = observer;
|
|
2941
|
-
each(deps, (dep) => addFluidObserver(dep, observer));
|
|
2942
|
-
if (lastObserver) {
|
|
2943
|
-
each(lastObserver.deps, (dep) => removeFluidObserver(dep, lastObserver));
|
|
2944
|
-
raf.cancel(lastObserver.update);
|
|
2945
|
-
}
|
|
2946
|
-
});
|
|
2947
|
-
useEffect(callback, []);
|
|
2948
|
-
useOnce(() => () => {
|
|
2949
|
-
const observer2 = observerRef.current;
|
|
2950
|
-
each(observer2.deps, (dep) => removeFluidObserver(dep, observer2));
|
|
2951
|
-
});
|
|
2952
|
-
const usedProps = host2.getComponentProps(props.getValue());
|
|
2953
|
-
return React.createElement(Component, _extends$1({}, usedProps, {
|
|
2954
|
-
ref
|
|
2955
|
-
}));
|
|
2956
|
-
});
|
|
2957
|
-
};
|
|
2958
|
-
class PropsObserver {
|
|
2959
|
-
constructor(update2, deps) {
|
|
2960
|
-
this.update = update2;
|
|
2961
|
-
this.deps = deps;
|
|
2962
|
-
}
|
|
2963
|
-
eventObserved(event) {
|
|
2964
|
-
if (event.type == "change") {
|
|
2965
|
-
raf.write(this.update);
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
}
|
|
2969
|
-
function getAnimatedState(props, host2) {
|
|
2970
|
-
const dependencies = new Set();
|
|
2971
|
-
TreeContext.dependencies = dependencies;
|
|
2972
|
-
if (props.style)
|
|
2973
|
-
props = _extends$1({}, props, {
|
|
2974
|
-
style: host2.createAnimatedStyle(props.style)
|
|
2975
|
-
});
|
|
2976
|
-
props = new AnimatedObject(props);
|
|
2977
|
-
TreeContext.dependencies = null;
|
|
2978
|
-
return [props, dependencies];
|
|
2979
|
-
}
|
|
2980
|
-
function updateRef(ref, value) {
|
|
2981
|
-
if (ref) {
|
|
2982
|
-
if (is.fun(ref))
|
|
2983
|
-
ref(value);
|
|
2984
|
-
else
|
|
2985
|
-
ref.current = value;
|
|
2986
|
-
}
|
|
2987
|
-
return value;
|
|
2988
|
-
}
|
|
2989
|
-
const cacheKey = Symbol.for("AnimatedComponent");
|
|
2990
|
-
const createHost = (components, {
|
|
2991
|
-
applyAnimatedValues: _applyAnimatedValues = () => false,
|
|
2992
|
-
createAnimatedStyle: _createAnimatedStyle = (style) => new AnimatedObject(style),
|
|
2993
|
-
getComponentProps: _getComponentProps = (props) => props
|
|
2994
|
-
} = {}) => {
|
|
2995
|
-
const hostConfig = {
|
|
2996
|
-
applyAnimatedValues: _applyAnimatedValues,
|
|
2997
|
-
createAnimatedStyle: _createAnimatedStyle,
|
|
2998
|
-
getComponentProps: _getComponentProps
|
|
2999
|
-
};
|
|
3000
|
-
const animated2 = (Component) => {
|
|
3001
|
-
const displayName = getDisplayName(Component) || "Anonymous";
|
|
3002
|
-
if (is.str(Component)) {
|
|
3003
|
-
Component = animated2[Component] || (animated2[Component] = withAnimated(Component, hostConfig));
|
|
3004
|
-
} else {
|
|
3005
|
-
Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig));
|
|
3006
|
-
}
|
|
3007
|
-
Component.displayName = `Animated(${displayName})`;
|
|
3008
|
-
return Component;
|
|
3009
|
-
};
|
|
3010
|
-
eachProp(components, (Component, key) => {
|
|
3011
|
-
if (is.arr(components)) {
|
|
3012
|
-
key = getDisplayName(Component);
|
|
3013
|
-
}
|
|
3014
|
-
animated2[key] = animated2(Component);
|
|
3015
|
-
});
|
|
3016
|
-
return {
|
|
3017
|
-
animated: animated2
|
|
3018
|
-
};
|
|
3019
|
-
};
|
|
3020
|
-
const getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null;
|
|
3021
|
-
function _extends() {
|
|
3022
|
-
_extends = Object.assign || function(target) {
|
|
3023
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3024
|
-
var source = arguments[i];
|
|
3025
|
-
for (var key in source) {
|
|
3026
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3027
|
-
target[key] = source[key];
|
|
3028
|
-
}
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
return target;
|
|
3032
|
-
};
|
|
3033
|
-
return _extends.apply(this, arguments);
|
|
3034
|
-
}
|
|
3035
|
-
function callProp(value, ...args) {
|
|
3036
|
-
return is.fun(value) ? value(...args) : value;
|
|
3037
|
-
}
|
|
3038
|
-
const matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key)));
|
|
3039
|
-
const resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop;
|
|
3040
|
-
const getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0;
|
|
3041
|
-
const noopTransform = (value) => value;
|
|
3042
|
-
const getDefaultProps = (props, transform = noopTransform) => {
|
|
3043
|
-
let keys = DEFAULT_PROPS;
|
|
3044
|
-
if (props.default && props.default !== true) {
|
|
3045
|
-
props = props.default;
|
|
3046
|
-
keys = Object.keys(props);
|
|
3047
|
-
}
|
|
3048
|
-
const defaults2 = {};
|
|
3049
|
-
for (const key of keys) {
|
|
3050
|
-
const value = transform(props[key], key);
|
|
3051
|
-
if (!is.und(value)) {
|
|
3052
|
-
defaults2[key] = value;
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
return defaults2;
|
|
3056
|
-
};
|
|
3057
|
-
const DEFAULT_PROPS = ["config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest"];
|
|
3058
|
-
const RESERVED_PROPS = {
|
|
3059
|
-
config: 1,
|
|
3060
|
-
from: 1,
|
|
3061
|
-
to: 1,
|
|
3062
|
-
ref: 1,
|
|
3063
|
-
loop: 1,
|
|
3064
|
-
reset: 1,
|
|
3065
|
-
pause: 1,
|
|
3066
|
-
cancel: 1,
|
|
3067
|
-
reverse: 1,
|
|
3068
|
-
immediate: 1,
|
|
3069
|
-
default: 1,
|
|
3070
|
-
delay: 1,
|
|
3071
|
-
onProps: 1,
|
|
3072
|
-
onStart: 1,
|
|
3073
|
-
onChange: 1,
|
|
3074
|
-
onPause: 1,
|
|
3075
|
-
onResume: 1,
|
|
3076
|
-
onRest: 1,
|
|
3077
|
-
onResolve: 1,
|
|
3078
|
-
items: 1,
|
|
3079
|
-
trail: 1,
|
|
3080
|
-
sort: 1,
|
|
3081
|
-
expires: 1,
|
|
3082
|
-
initial: 1,
|
|
3083
|
-
enter: 1,
|
|
3084
|
-
update: 1,
|
|
3085
|
-
leave: 1,
|
|
3086
|
-
children: 1,
|
|
3087
|
-
onDestroyed: 1,
|
|
3088
|
-
keys: 1,
|
|
3089
|
-
callId: 1,
|
|
3090
|
-
parentId: 1
|
|
3091
|
-
};
|
|
3092
|
-
function getForwardProps(props) {
|
|
3093
|
-
const forward = {};
|
|
3094
|
-
let count = 0;
|
|
3095
|
-
eachProp(props, (value, prop) => {
|
|
3096
|
-
if (!RESERVED_PROPS[prop]) {
|
|
3097
|
-
forward[prop] = value;
|
|
3098
|
-
count++;
|
|
3099
|
-
}
|
|
3100
|
-
});
|
|
3101
|
-
if (count) {
|
|
3102
|
-
return forward;
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3105
|
-
function inferTo(props) {
|
|
3106
|
-
const to2 = getForwardProps(props);
|
|
3107
|
-
if (to2) {
|
|
3108
|
-
const out = {
|
|
3109
|
-
to: to2
|
|
3110
|
-
};
|
|
3111
|
-
eachProp(props, (val, key) => key in to2 || (out[key] = val));
|
|
3112
|
-
return out;
|
|
3113
|
-
}
|
|
3114
|
-
return _extends({}, props);
|
|
3115
|
-
}
|
|
3116
|
-
function computeGoal(value) {
|
|
3117
|
-
value = getFluidValue(value);
|
|
3118
|
-
return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({
|
|
3119
|
-
range: [0, 1],
|
|
3120
|
-
output: [value, value]
|
|
3121
|
-
})(1) : value;
|
|
3122
|
-
}
|
|
3123
|
-
function hasProps(props) {
|
|
3124
|
-
for (const _ in props)
|
|
3125
|
-
return true;
|
|
3126
|
-
return false;
|
|
3127
|
-
}
|
|
3128
|
-
function isAsyncTo(to2) {
|
|
3129
|
-
return is.fun(to2) || is.arr(to2) && is.obj(to2[0]);
|
|
3130
|
-
}
|
|
3131
|
-
function detachRefs(ctrl, ref) {
|
|
3132
|
-
var _ctrl$ref;
|
|
3133
|
-
(_ctrl$ref = ctrl.ref) == null ? void 0 : _ctrl$ref.delete(ctrl);
|
|
3134
|
-
ref == null ? void 0 : ref.delete(ctrl);
|
|
3135
|
-
}
|
|
3136
|
-
function replaceRef(ctrl, ref) {
|
|
3137
|
-
if (ref && ctrl.ref !== ref) {
|
|
3138
|
-
var _ctrl$ref2;
|
|
3139
|
-
(_ctrl$ref2 = ctrl.ref) == null ? void 0 : _ctrl$ref2.delete(ctrl);
|
|
3140
|
-
ref.add(ctrl);
|
|
3141
|
-
ctrl.ref = ref;
|
|
3142
|
-
}
|
|
3143
|
-
}
|
|
3144
|
-
const config = {
|
|
3145
|
-
default: {
|
|
3146
|
-
tension: 170,
|
|
3147
|
-
friction: 26
|
|
3148
|
-
},
|
|
3149
|
-
gentle: {
|
|
3150
|
-
tension: 120,
|
|
3151
|
-
friction: 14
|
|
3152
|
-
},
|
|
3153
|
-
wobbly: {
|
|
3154
|
-
tension: 180,
|
|
3155
|
-
friction: 12
|
|
3156
|
-
},
|
|
3157
|
-
stiff: {
|
|
3158
|
-
tension: 210,
|
|
3159
|
-
friction: 20
|
|
3160
|
-
},
|
|
3161
|
-
slow: {
|
|
3162
|
-
tension: 280,
|
|
3163
|
-
friction: 60
|
|
3164
|
-
},
|
|
3165
|
-
molasses: {
|
|
3166
|
-
tension: 280,
|
|
3167
|
-
friction: 120
|
|
3168
|
-
}
|
|
3169
|
-
};
|
|
3170
|
-
const linear = (t) => t;
|
|
3171
|
-
const defaults = _extends({}, config.default, {
|
|
3172
|
-
mass: 1,
|
|
3173
|
-
damping: 1,
|
|
3174
|
-
easing: linear,
|
|
3175
|
-
clamp: false
|
|
3176
|
-
});
|
|
3177
|
-
class AnimationConfig {
|
|
3178
|
-
constructor() {
|
|
3179
|
-
this.tension = void 0;
|
|
3180
|
-
this.friction = void 0;
|
|
3181
|
-
this.frequency = void 0;
|
|
3182
|
-
this.damping = void 0;
|
|
3183
|
-
this.mass = void 0;
|
|
3184
|
-
this.velocity = 0;
|
|
3185
|
-
this.restVelocity = void 0;
|
|
3186
|
-
this.precision = void 0;
|
|
3187
|
-
this.progress = void 0;
|
|
3188
|
-
this.duration = void 0;
|
|
3189
|
-
this.easing = void 0;
|
|
3190
|
-
this.clamp = void 0;
|
|
3191
|
-
this.bounce = void 0;
|
|
3192
|
-
this.decay = void 0;
|
|
3193
|
-
this.round = void 0;
|
|
3194
|
-
Object.assign(this, defaults);
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
|
-
function mergeConfig(config2, newConfig, defaultConfig) {
|
|
3198
|
-
if (defaultConfig) {
|
|
3199
|
-
defaultConfig = _extends({}, defaultConfig);
|
|
3200
|
-
sanitizeConfig(defaultConfig, newConfig);
|
|
3201
|
-
newConfig = _extends({}, defaultConfig, newConfig);
|
|
3202
|
-
}
|
|
3203
|
-
sanitizeConfig(config2, newConfig);
|
|
3204
|
-
Object.assign(config2, newConfig);
|
|
3205
|
-
for (const key in defaults) {
|
|
3206
|
-
if (config2[key] == null) {
|
|
3207
|
-
config2[key] = defaults[key];
|
|
3208
|
-
}
|
|
3209
|
-
}
|
|
3210
|
-
let {
|
|
3211
|
-
mass,
|
|
3212
|
-
frequency,
|
|
3213
|
-
damping
|
|
3214
|
-
} = config2;
|
|
3215
|
-
if (!is.und(frequency)) {
|
|
3216
|
-
if (frequency < 0.01)
|
|
3217
|
-
frequency = 0.01;
|
|
3218
|
-
if (damping < 0)
|
|
3219
|
-
damping = 0;
|
|
3220
|
-
config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass;
|
|
3221
|
-
config2.friction = 4 * Math.PI * damping * mass / frequency;
|
|
3222
|
-
}
|
|
3223
|
-
return config2;
|
|
3224
|
-
}
|
|
3225
|
-
function sanitizeConfig(config2, props) {
|
|
3226
|
-
if (!is.und(props.decay)) {
|
|
3227
|
-
config2.duration = void 0;
|
|
3228
|
-
} else {
|
|
3229
|
-
const isTensionConfig = !is.und(props.tension) || !is.und(props.friction);
|
|
3230
|
-
if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) {
|
|
3231
|
-
config2.duration = void 0;
|
|
3232
|
-
config2.decay = void 0;
|
|
3233
|
-
}
|
|
3234
|
-
if (isTensionConfig) {
|
|
3235
|
-
config2.frequency = void 0;
|
|
3236
|
-
}
|
|
3237
|
-
}
|
|
3238
|
-
}
|
|
3239
|
-
const emptyArray = [];
|
|
3240
|
-
class Animation {
|
|
3241
|
-
constructor() {
|
|
3242
|
-
this.changed = false;
|
|
3243
|
-
this.values = emptyArray;
|
|
3244
|
-
this.toValues = null;
|
|
3245
|
-
this.fromValues = emptyArray;
|
|
3246
|
-
this.to = void 0;
|
|
3247
|
-
this.from = void 0;
|
|
3248
|
-
this.config = new AnimationConfig();
|
|
3249
|
-
this.immediate = false;
|
|
3250
|
-
}
|
|
3251
|
-
}
|
|
3252
|
-
function scheduleProps(callId, {
|
|
3253
|
-
key,
|
|
3254
|
-
props,
|
|
3255
|
-
defaultProps,
|
|
3256
|
-
state,
|
|
3257
|
-
actions
|
|
3258
|
-
}) {
|
|
3259
|
-
return new Promise((resolve, reject) => {
|
|
3260
|
-
var _props$cancel;
|
|
3261
|
-
let delay;
|
|
3262
|
-
let timeout;
|
|
3263
|
-
let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key);
|
|
3264
|
-
if (cancel) {
|
|
3265
|
-
onStart();
|
|
3266
|
-
} else {
|
|
3267
|
-
if (!is.und(props.pause)) {
|
|
3268
|
-
state.paused = matchProp(props.pause, key);
|
|
3269
|
-
}
|
|
3270
|
-
let pause = defaultProps == null ? void 0 : defaultProps.pause;
|
|
3271
|
-
if (pause !== true) {
|
|
3272
|
-
pause = state.paused || matchProp(pause, key);
|
|
3273
|
-
}
|
|
3274
|
-
delay = callProp(props.delay || 0, key);
|
|
3275
|
-
if (pause) {
|
|
3276
|
-
state.resumeQueue.add(onResume);
|
|
3277
|
-
actions.pause();
|
|
3278
|
-
} else {
|
|
3279
|
-
actions.resume();
|
|
3280
|
-
onResume();
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
function onPause() {
|
|
3284
|
-
state.resumeQueue.add(onResume);
|
|
3285
|
-
state.timeouts.delete(timeout);
|
|
3286
|
-
timeout.cancel();
|
|
3287
|
-
delay = timeout.time - raf.now();
|
|
3288
|
-
}
|
|
3289
|
-
function onResume() {
|
|
3290
|
-
if (delay > 0) {
|
|
3291
|
-
timeout = raf.setTimeout(onStart, delay);
|
|
3292
|
-
state.pauseQueue.add(onPause);
|
|
3293
|
-
state.timeouts.add(timeout);
|
|
3294
|
-
} else {
|
|
3295
|
-
onStart();
|
|
3296
|
-
}
|
|
3297
|
-
}
|
|
3298
|
-
function onStart() {
|
|
3299
|
-
state.pauseQueue.delete(onPause);
|
|
3300
|
-
state.timeouts.delete(timeout);
|
|
3301
|
-
if (callId <= (state.cancelId || 0)) {
|
|
3302
|
-
cancel = true;
|
|
3303
|
-
}
|
|
3304
|
-
try {
|
|
3305
|
-
actions.start(_extends({}, props, {
|
|
3306
|
-
callId,
|
|
3307
|
-
cancel
|
|
3308
|
-
}), resolve);
|
|
3309
|
-
} catch (err) {
|
|
3310
|
-
reject(err);
|
|
3311
|
-
}
|
|
3312
|
-
}
|
|
3313
|
-
});
|
|
3314
|
-
}
|
|
3315
|
-
const getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some((result) => result.cancelled) ? getCancelledResult(target.get()) : results.every((result) => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every((result) => result.finished));
|
|
3316
|
-
const getNoopResult = (value) => ({
|
|
3317
|
-
value,
|
|
3318
|
-
noop: true,
|
|
3319
|
-
finished: true,
|
|
3320
|
-
cancelled: false
|
|
3321
|
-
});
|
|
3322
|
-
const getFinishedResult = (value, finished, cancelled = false) => ({
|
|
3323
|
-
value,
|
|
3324
|
-
finished,
|
|
3325
|
-
cancelled
|
|
3326
|
-
});
|
|
3327
|
-
const getCancelledResult = (value) => ({
|
|
3328
|
-
value,
|
|
3329
|
-
cancelled: true,
|
|
3330
|
-
finished: false
|
|
3331
|
-
});
|
|
3332
|
-
function runAsync(to2, props, state, target) {
|
|
3333
|
-
const {
|
|
3334
|
-
callId,
|
|
3335
|
-
parentId,
|
|
3336
|
-
onRest
|
|
3337
|
-
} = props;
|
|
3338
|
-
const {
|
|
3339
|
-
asyncTo: prevTo,
|
|
3340
|
-
promise: prevPromise
|
|
3341
|
-
} = state;
|
|
3342
|
-
if (!parentId && to2 === prevTo && !props.reset) {
|
|
3343
|
-
return prevPromise;
|
|
3344
|
-
}
|
|
3345
|
-
return state.promise = (async () => {
|
|
3346
|
-
state.asyncId = callId;
|
|
3347
|
-
state.asyncTo = to2;
|
|
3348
|
-
const defaultProps = getDefaultProps(props, (value, key) => key === "onRest" ? void 0 : value);
|
|
3349
|
-
let preventBail;
|
|
3350
|
-
let bail;
|
|
3351
|
-
const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject));
|
|
3352
|
-
const bailIfEnded = (bailSignal) => {
|
|
3353
|
-
const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false);
|
|
3354
|
-
if (bailResult) {
|
|
3355
|
-
bailSignal.result = bailResult;
|
|
3356
|
-
bail(bailSignal);
|
|
3357
|
-
throw bailSignal;
|
|
3358
|
-
}
|
|
3359
|
-
};
|
|
3360
|
-
const animate = (arg1, arg2) => {
|
|
3361
|
-
const bailSignal = new BailSignal();
|
|
3362
|
-
const skipAnimationSignal = new SkipAniamtionSignal();
|
|
3363
|
-
return (async () => {
|
|
3364
|
-
if (globals.skipAnimation) {
|
|
3365
|
-
stopAsync(state);
|
|
3366
|
-
skipAnimationSignal.result = getFinishedResult(target, false);
|
|
3367
|
-
bail(skipAnimationSignal);
|
|
3368
|
-
throw skipAnimationSignal;
|
|
3369
|
-
}
|
|
3370
|
-
bailIfEnded(bailSignal);
|
|
3371
|
-
const props2 = is.obj(arg1) ? _extends({}, arg1) : _extends({}, arg2, {
|
|
3372
|
-
to: arg1
|
|
3373
|
-
});
|
|
3374
|
-
props2.parentId = callId;
|
|
3375
|
-
eachProp(defaultProps, (value, key) => {
|
|
3376
|
-
if (is.und(props2[key])) {
|
|
3377
|
-
props2[key] = value;
|
|
3378
|
-
}
|
|
3379
|
-
});
|
|
3380
|
-
const result2 = await target.start(props2);
|
|
3381
|
-
bailIfEnded(bailSignal);
|
|
3382
|
-
if (state.paused) {
|
|
3383
|
-
await new Promise((resume) => {
|
|
3384
|
-
state.resumeQueue.add(resume);
|
|
3385
|
-
});
|
|
3386
|
-
}
|
|
3387
|
-
return result2;
|
|
3388
|
-
})();
|
|
3389
|
-
};
|
|
3390
|
-
let result;
|
|
3391
|
-
if (globals.skipAnimation) {
|
|
3392
|
-
stopAsync(state);
|
|
3393
|
-
return getFinishedResult(target, false);
|
|
3394
|
-
}
|
|
3395
|
-
try {
|
|
3396
|
-
let animating;
|
|
3397
|
-
if (is.arr(to2)) {
|
|
3398
|
-
animating = (async (queue) => {
|
|
3399
|
-
for (const props2 of queue) {
|
|
3400
|
-
await animate(props2);
|
|
3401
|
-
}
|
|
3402
|
-
})(to2);
|
|
3403
|
-
} else {
|
|
3404
|
-
animating = Promise.resolve(to2(animate, target.stop.bind(target)));
|
|
3405
|
-
}
|
|
3406
|
-
await Promise.all([animating.then(preventBail), bailPromise]);
|
|
3407
|
-
result = getFinishedResult(target.get(), true, false);
|
|
3408
|
-
} catch (err) {
|
|
3409
|
-
if (err instanceof BailSignal) {
|
|
3410
|
-
result = err.result;
|
|
3411
|
-
} else if (err instanceof SkipAniamtionSignal) {
|
|
3412
|
-
result = err.result;
|
|
3413
|
-
} else {
|
|
3414
|
-
throw err;
|
|
3415
|
-
}
|
|
3416
|
-
} finally {
|
|
3417
|
-
if (callId == state.asyncId) {
|
|
3418
|
-
state.asyncId = parentId;
|
|
3419
|
-
state.asyncTo = parentId ? prevTo : void 0;
|
|
3420
|
-
state.promise = parentId ? prevPromise : void 0;
|
|
3421
|
-
}
|
|
3422
|
-
}
|
|
3423
|
-
if (is.fun(onRest)) {
|
|
3424
|
-
raf.batchedUpdates(() => {
|
|
3425
|
-
onRest(result, target, target.item);
|
|
3426
|
-
});
|
|
3427
|
-
}
|
|
3428
|
-
return result;
|
|
3429
|
-
})();
|
|
3430
|
-
}
|
|
3431
|
-
function stopAsync(state, cancelId) {
|
|
3432
|
-
flush(state.timeouts, (t) => t.cancel());
|
|
3433
|
-
state.pauseQueue.clear();
|
|
3434
|
-
state.resumeQueue.clear();
|
|
3435
|
-
state.asyncId = state.asyncTo = state.promise = void 0;
|
|
3436
|
-
if (cancelId)
|
|
3437
|
-
state.cancelId = cancelId;
|
|
3438
|
-
}
|
|
3439
|
-
class BailSignal extends Error {
|
|
3440
|
-
constructor() {
|
|
3441
|
-
super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.");
|
|
3442
|
-
this.result = void 0;
|
|
3443
|
-
}
|
|
3444
|
-
}
|
|
3445
|
-
class SkipAniamtionSignal extends Error {
|
|
3446
|
-
constructor() {
|
|
3447
|
-
super("SkipAnimationSignal");
|
|
3448
|
-
this.result = void 0;
|
|
3449
|
-
}
|
|
3450
|
-
}
|
|
3451
|
-
const isFrameValue = (value) => value instanceof FrameValue;
|
|
3452
|
-
let nextId$1 = 1;
|
|
3453
|
-
class FrameValue extends FluidValue {
|
|
3454
|
-
constructor(...args) {
|
|
3455
|
-
super(...args);
|
|
3456
|
-
this.id = nextId$1++;
|
|
3457
|
-
this.key = void 0;
|
|
3458
|
-
this._priority = 0;
|
|
3459
|
-
}
|
|
3460
|
-
get priority() {
|
|
3461
|
-
return this._priority;
|
|
3462
|
-
}
|
|
3463
|
-
set priority(priority2) {
|
|
3464
|
-
if (this._priority != priority2) {
|
|
3465
|
-
this._priority = priority2;
|
|
3466
|
-
this._onPriorityChange(priority2);
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
get() {
|
|
3470
|
-
const node = getAnimated(this);
|
|
3471
|
-
return node && node.getValue();
|
|
3472
|
-
}
|
|
3473
|
-
to(...args) {
|
|
3474
|
-
return globals.to(this, args);
|
|
3475
|
-
}
|
|
3476
|
-
interpolate(...args) {
|
|
3477
|
-
deprecateInterpolate();
|
|
3478
|
-
return globals.to(this, args);
|
|
3479
|
-
}
|
|
3480
|
-
toJSON() {
|
|
3481
|
-
return this.get();
|
|
3482
|
-
}
|
|
3483
|
-
observerAdded(count) {
|
|
3484
|
-
if (count == 1)
|
|
3485
|
-
this._attach();
|
|
3486
|
-
}
|
|
3487
|
-
observerRemoved(count) {
|
|
3488
|
-
if (count == 0)
|
|
3489
|
-
this._detach();
|
|
3490
|
-
}
|
|
3491
|
-
_attach() {
|
|
3492
|
-
}
|
|
3493
|
-
_detach() {
|
|
3494
|
-
}
|
|
3495
|
-
_onChange(value, idle = false) {
|
|
3496
|
-
callFluidObservers(this, {
|
|
3497
|
-
type: "change",
|
|
3498
|
-
parent: this,
|
|
3499
|
-
value,
|
|
3500
|
-
idle
|
|
3501
|
-
});
|
|
3502
|
-
}
|
|
3503
|
-
_onPriorityChange(priority2) {
|
|
3504
|
-
if (!this.idle) {
|
|
3505
|
-
frameLoop.sort(this);
|
|
3506
|
-
}
|
|
3507
|
-
callFluidObservers(this, {
|
|
3508
|
-
type: "priority",
|
|
3509
|
-
parent: this,
|
|
3510
|
-
priority: priority2
|
|
3511
|
-
});
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
const $P = Symbol.for("SpringPhase");
|
|
3515
|
-
const HAS_ANIMATED = 1;
|
|
3516
|
-
const IS_ANIMATING = 2;
|
|
3517
|
-
const IS_PAUSED = 4;
|
|
3518
|
-
const hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0;
|
|
3519
|
-
const isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0;
|
|
3520
|
-
const isPaused = (target) => (target[$P] & IS_PAUSED) > 0;
|
|
3521
|
-
const setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING;
|
|
3522
|
-
const setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED;
|
|
3523
|
-
class SpringValue extends FrameValue {
|
|
3524
|
-
constructor(arg1, arg2) {
|
|
3525
|
-
super();
|
|
3526
|
-
this.key = void 0;
|
|
3527
|
-
this.animation = new Animation();
|
|
3528
|
-
this.queue = void 0;
|
|
3529
|
-
this.defaultProps = {};
|
|
3530
|
-
this._state = {
|
|
3531
|
-
paused: false,
|
|
3532
|
-
pauseQueue: new Set(),
|
|
3533
|
-
resumeQueue: new Set(),
|
|
3534
|
-
timeouts: new Set()
|
|
3535
|
-
};
|
|
3536
|
-
this._pendingCalls = new Set();
|
|
3537
|
-
this._lastCallId = 0;
|
|
3538
|
-
this._lastToId = 0;
|
|
3539
|
-
this._memoizedDuration = 0;
|
|
3540
|
-
if (!is.und(arg1) || !is.und(arg2)) {
|
|
3541
|
-
const props = is.obj(arg1) ? _extends({}, arg1) : _extends({}, arg2, {
|
|
3542
|
-
from: arg1
|
|
3543
|
-
});
|
|
3544
|
-
if (is.und(props.default)) {
|
|
3545
|
-
props.default = true;
|
|
3546
|
-
}
|
|
3547
|
-
this.start(props);
|
|
3548
|
-
}
|
|
3549
|
-
}
|
|
3550
|
-
get idle() {
|
|
3551
|
-
return !(isAnimating(this) || this._state.asyncTo) || isPaused(this);
|
|
3552
|
-
}
|
|
3553
|
-
get goal() {
|
|
3554
|
-
return getFluidValue(this.animation.to);
|
|
3555
|
-
}
|
|
3556
|
-
get velocity() {
|
|
3557
|
-
const node = getAnimated(this);
|
|
3558
|
-
return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map((node2) => node2.lastVelocity || 0);
|
|
3559
|
-
}
|
|
3560
|
-
get hasAnimated() {
|
|
3561
|
-
return hasAnimated(this);
|
|
3562
|
-
}
|
|
3563
|
-
get isAnimating() {
|
|
3564
|
-
return isAnimating(this);
|
|
3565
|
-
}
|
|
3566
|
-
get isPaused() {
|
|
3567
|
-
return isPaused(this);
|
|
3568
|
-
}
|
|
3569
|
-
advance(dt) {
|
|
3570
|
-
let idle = true;
|
|
3571
|
-
let changed = false;
|
|
3572
|
-
const anim = this.animation;
|
|
3573
|
-
let {
|
|
3574
|
-
config: config2,
|
|
3575
|
-
toValues
|
|
3576
|
-
} = anim;
|
|
3577
|
-
const payload = getPayload(anim.to);
|
|
3578
|
-
if (!payload && hasFluidValue(anim.to)) {
|
|
3579
|
-
toValues = toArray(getFluidValue(anim.to));
|
|
3580
|
-
}
|
|
3581
|
-
anim.values.forEach((node2, i) => {
|
|
3582
|
-
if (node2.done)
|
|
3583
|
-
return;
|
|
3584
|
-
const to2 = node2.constructor == AnimatedString ? 1 : payload ? payload[i].lastPosition : toValues[i];
|
|
3585
|
-
let finished = anim.immediate;
|
|
3586
|
-
let position = to2;
|
|
3587
|
-
if (!finished) {
|
|
3588
|
-
position = node2.lastPosition;
|
|
3589
|
-
if (config2.tension <= 0) {
|
|
3590
|
-
node2.done = true;
|
|
3591
|
-
return;
|
|
3592
|
-
}
|
|
3593
|
-
let elapsed = node2.elapsedTime += dt;
|
|
3594
|
-
const from = anim.fromValues[i];
|
|
3595
|
-
const v0 = node2.v0 != null ? node2.v0 : node2.v0 = is.arr(config2.velocity) ? config2.velocity[i] : config2.velocity;
|
|
3596
|
-
let velocity;
|
|
3597
|
-
if (!is.und(config2.duration)) {
|
|
3598
|
-
let p = 1;
|
|
3599
|
-
if (config2.duration > 0) {
|
|
3600
|
-
if (this._memoizedDuration !== config2.duration) {
|
|
3601
|
-
this._memoizedDuration = config2.duration;
|
|
3602
|
-
if (node2.durationProgress > 0) {
|
|
3603
|
-
node2.elapsedTime = config2.duration * node2.durationProgress;
|
|
3604
|
-
elapsed = node2.elapsedTime += dt;
|
|
3605
|
-
}
|
|
3606
|
-
}
|
|
3607
|
-
p = (config2.progress || 0) + elapsed / this._memoizedDuration;
|
|
3608
|
-
p = p > 1 ? 1 : p < 0 ? 0 : p;
|
|
3609
|
-
node2.durationProgress = p;
|
|
3610
|
-
}
|
|
3611
|
-
position = from + config2.easing(p) * (to2 - from);
|
|
3612
|
-
velocity = (position - node2.lastPosition) / dt;
|
|
3613
|
-
finished = p == 1;
|
|
3614
|
-
} else if (config2.decay) {
|
|
3615
|
-
const decay = config2.decay === true ? 0.998 : config2.decay;
|
|
3616
|
-
const e = Math.exp(-(1 - decay) * elapsed);
|
|
3617
|
-
position = from + v0 / (1 - decay) * (1 - e);
|
|
3618
|
-
finished = Math.abs(node2.lastPosition - position) < 0.1;
|
|
3619
|
-
velocity = v0 * e;
|
|
3620
|
-
} else {
|
|
3621
|
-
velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity;
|
|
3622
|
-
const precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3));
|
|
3623
|
-
const restVelocity = config2.restVelocity || precision / 10;
|
|
3624
|
-
const bounceFactor = config2.clamp ? 0 : config2.bounce;
|
|
3625
|
-
const canBounce = !is.und(bounceFactor);
|
|
3626
|
-
const isGrowing = from == to2 ? node2.v0 > 0 : from < to2;
|
|
3627
|
-
let isMoving;
|
|
3628
|
-
let isBouncing = false;
|
|
3629
|
-
const step = 1;
|
|
3630
|
-
const numSteps = Math.ceil(dt / step);
|
|
3631
|
-
for (let n = 0; n < numSteps; ++n) {
|
|
3632
|
-
isMoving = Math.abs(velocity) > restVelocity;
|
|
3633
|
-
if (!isMoving) {
|
|
3634
|
-
finished = Math.abs(to2 - position) <= precision;
|
|
3635
|
-
if (finished) {
|
|
3636
|
-
break;
|
|
3637
|
-
}
|
|
3638
|
-
}
|
|
3639
|
-
if (canBounce) {
|
|
3640
|
-
isBouncing = position == to2 || position > to2 == isGrowing;
|
|
3641
|
-
if (isBouncing) {
|
|
3642
|
-
velocity = -velocity * bounceFactor;
|
|
3643
|
-
position = to2;
|
|
3644
|
-
}
|
|
3645
|
-
}
|
|
3646
|
-
const springForce = -config2.tension * 1e-6 * (position - to2);
|
|
3647
|
-
const dampingForce = -config2.friction * 1e-3 * velocity;
|
|
3648
|
-
const acceleration = (springForce + dampingForce) / config2.mass;
|
|
3649
|
-
velocity = velocity + acceleration * step;
|
|
3650
|
-
position = position + velocity * step;
|
|
3651
|
-
}
|
|
3652
|
-
}
|
|
3653
|
-
node2.lastVelocity = velocity;
|
|
3654
|
-
if (Number.isNaN(position)) {
|
|
3655
|
-
console.warn(`Got NaN while animating:`, this);
|
|
3656
|
-
finished = true;
|
|
3657
|
-
}
|
|
3658
|
-
}
|
|
3659
|
-
if (payload && !payload[i].done) {
|
|
3660
|
-
finished = false;
|
|
3661
|
-
}
|
|
3662
|
-
if (finished) {
|
|
3663
|
-
node2.done = true;
|
|
3664
|
-
} else {
|
|
3665
|
-
idle = false;
|
|
3666
|
-
}
|
|
3667
|
-
if (node2.setValue(position, config2.round)) {
|
|
3668
|
-
changed = true;
|
|
3669
|
-
}
|
|
3670
|
-
});
|
|
3671
|
-
const node = getAnimated(this);
|
|
3672
|
-
const currVal = node.getValue();
|
|
3673
|
-
if (idle) {
|
|
3674
|
-
const finalVal = getFluidValue(anim.to);
|
|
3675
|
-
if ((currVal !== finalVal || changed) && !config2.decay) {
|
|
3676
|
-
node.setValue(finalVal);
|
|
3677
|
-
this._onChange(finalVal);
|
|
3678
|
-
} else if (changed && config2.decay) {
|
|
3679
|
-
this._onChange(currVal);
|
|
3680
|
-
}
|
|
3681
|
-
this._stop();
|
|
3682
|
-
} else if (changed) {
|
|
3683
|
-
this._onChange(currVal);
|
|
3684
|
-
}
|
|
3685
|
-
}
|
|
3686
|
-
set(value) {
|
|
3687
|
-
raf.batchedUpdates(() => {
|
|
3688
|
-
this._stop();
|
|
3689
|
-
this._focus(value);
|
|
3690
|
-
this._set(value);
|
|
3691
|
-
});
|
|
3692
|
-
return this;
|
|
3693
|
-
}
|
|
3694
|
-
pause() {
|
|
3695
|
-
this._update({
|
|
3696
|
-
pause: true
|
|
3697
|
-
});
|
|
3698
|
-
}
|
|
3699
|
-
resume() {
|
|
3700
|
-
this._update({
|
|
3701
|
-
pause: false
|
|
3702
|
-
});
|
|
3703
|
-
}
|
|
3704
|
-
finish() {
|
|
3705
|
-
if (isAnimating(this)) {
|
|
3706
|
-
const {
|
|
3707
|
-
to: to2,
|
|
3708
|
-
config: config2
|
|
3709
|
-
} = this.animation;
|
|
3710
|
-
raf.batchedUpdates(() => {
|
|
3711
|
-
this._onStart();
|
|
3712
|
-
if (!config2.decay) {
|
|
3713
|
-
this._set(to2, false);
|
|
3714
|
-
}
|
|
3715
|
-
this._stop();
|
|
3716
|
-
});
|
|
3717
|
-
}
|
|
3718
|
-
return this;
|
|
3719
|
-
}
|
|
3720
|
-
update(props) {
|
|
3721
|
-
const queue = this.queue || (this.queue = []);
|
|
3722
|
-
queue.push(props);
|
|
3723
|
-
return this;
|
|
3724
|
-
}
|
|
3725
|
-
start(to2, arg2) {
|
|
3726
|
-
let queue;
|
|
3727
|
-
if (!is.und(to2)) {
|
|
3728
|
-
queue = [is.obj(to2) ? to2 : _extends({}, arg2, {
|
|
3729
|
-
to: to2
|
|
3730
|
-
})];
|
|
3731
|
-
} else {
|
|
3732
|
-
queue = this.queue || [];
|
|
3733
|
-
this.queue = [];
|
|
3734
|
-
}
|
|
3735
|
-
return Promise.all(queue.map((props) => this._update(props))).then((results) => getCombinedResult(this, results));
|
|
3736
|
-
}
|
|
3737
|
-
stop(cancel) {
|
|
3738
|
-
const {
|
|
3739
|
-
to: to2
|
|
3740
|
-
} = this.animation;
|
|
3741
|
-
this._focus(this.get());
|
|
3742
|
-
stopAsync(this._state, cancel && this._lastCallId);
|
|
3743
|
-
raf.batchedUpdates(() => this._stop(to2, cancel));
|
|
3744
|
-
return this;
|
|
3745
|
-
}
|
|
3746
|
-
reset() {
|
|
3747
|
-
this._update({
|
|
3748
|
-
reset: true
|
|
3749
|
-
});
|
|
3750
|
-
}
|
|
3751
|
-
eventObserved(event) {
|
|
3752
|
-
if (event.type == "change") {
|
|
3753
|
-
this._start();
|
|
3754
|
-
} else if (event.type == "priority") {
|
|
3755
|
-
this.priority = event.priority + 1;
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
_prepareNode(props) {
|
|
3759
|
-
const key = this.key || "";
|
|
3760
|
-
let {
|
|
3761
|
-
to: to2,
|
|
3762
|
-
from
|
|
3763
|
-
} = props;
|
|
3764
|
-
to2 = is.obj(to2) ? to2[key] : to2;
|
|
3765
|
-
if (to2 == null || isAsyncTo(to2)) {
|
|
3766
|
-
to2 = void 0;
|
|
3767
|
-
}
|
|
3768
|
-
from = is.obj(from) ? from[key] : from;
|
|
3769
|
-
if (from == null) {
|
|
3770
|
-
from = void 0;
|
|
3771
|
-
}
|
|
3772
|
-
const range = {
|
|
3773
|
-
to: to2,
|
|
3774
|
-
from
|
|
3775
|
-
};
|
|
3776
|
-
if (!hasAnimated(this)) {
|
|
3777
|
-
if (props.reverse)
|
|
3778
|
-
[to2, from] = [from, to2];
|
|
3779
|
-
from = getFluidValue(from);
|
|
3780
|
-
if (!is.und(from)) {
|
|
3781
|
-
this._set(from);
|
|
3782
|
-
} else if (!getAnimated(this)) {
|
|
3783
|
-
this._set(to2);
|
|
3784
|
-
}
|
|
3785
|
-
}
|
|
3786
|
-
return range;
|
|
3787
|
-
}
|
|
3788
|
-
_update(_ref, isLoop) {
|
|
3789
|
-
let props = _extends({}, _ref);
|
|
3790
|
-
const {
|
|
3791
|
-
key,
|
|
3792
|
-
defaultProps
|
|
3793
|
-
} = this;
|
|
3794
|
-
if (props.default)
|
|
3795
|
-
Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value));
|
|
3796
|
-
mergeActiveFn(this, props, "onProps");
|
|
3797
|
-
sendEvent(this, "onProps", props, this);
|
|
3798
|
-
const range = this._prepareNode(props);
|
|
3799
|
-
if (Object.isFrozen(this)) {
|
|
3800
|
-
throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");
|
|
3801
|
-
}
|
|
3802
|
-
const state = this._state;
|
|
3803
|
-
return scheduleProps(++this._lastCallId, {
|
|
3804
|
-
key,
|
|
3805
|
-
props,
|
|
3806
|
-
defaultProps,
|
|
3807
|
-
state,
|
|
3808
|
-
actions: {
|
|
3809
|
-
pause: () => {
|
|
3810
|
-
if (!isPaused(this)) {
|
|
3811
|
-
setPausedBit(this, true);
|
|
3812
|
-
flushCalls(state.pauseQueue);
|
|
3813
|
-
sendEvent(this, "onPause", getFinishedResult(this, checkFinished(this, this.animation.to)), this);
|
|
3814
|
-
}
|
|
3815
|
-
},
|
|
3816
|
-
resume: () => {
|
|
3817
|
-
if (isPaused(this)) {
|
|
3818
|
-
setPausedBit(this, false);
|
|
3819
|
-
if (isAnimating(this)) {
|
|
3820
|
-
this._resume();
|
|
3821
|
-
}
|
|
3822
|
-
flushCalls(state.resumeQueue);
|
|
3823
|
-
sendEvent(this, "onResume", getFinishedResult(this, checkFinished(this, this.animation.to)), this);
|
|
3824
|
-
}
|
|
3825
|
-
},
|
|
3826
|
-
start: this._merge.bind(this, range)
|
|
3827
|
-
}
|
|
3828
|
-
}).then((result) => {
|
|
3829
|
-
if (props.loop && result.finished && !(isLoop && result.noop)) {
|
|
3830
|
-
const nextProps = createLoopUpdate(props);
|
|
3831
|
-
if (nextProps) {
|
|
3832
|
-
return this._update(nextProps, true);
|
|
3833
|
-
}
|
|
3834
|
-
}
|
|
3835
|
-
return result;
|
|
3836
|
-
});
|
|
3837
|
-
}
|
|
3838
|
-
_merge(range, props, resolve) {
|
|
3839
|
-
if (props.cancel) {
|
|
3840
|
-
this.stop(true);
|
|
3841
|
-
return resolve(getCancelledResult(this));
|
|
3842
|
-
}
|
|
3843
|
-
const hasToProp = !is.und(range.to);
|
|
3844
|
-
const hasFromProp = !is.und(range.from);
|
|
3845
|
-
if (hasToProp || hasFromProp) {
|
|
3846
|
-
if (props.callId > this._lastToId) {
|
|
3847
|
-
this._lastToId = props.callId;
|
|
3848
|
-
} else {
|
|
3849
|
-
return resolve(getCancelledResult(this));
|
|
3850
|
-
}
|
|
3851
|
-
}
|
|
3852
|
-
const {
|
|
3853
|
-
key,
|
|
3854
|
-
defaultProps,
|
|
3855
|
-
animation: anim
|
|
3856
|
-
} = this;
|
|
3857
|
-
const {
|
|
3858
|
-
to: prevTo,
|
|
3859
|
-
from: prevFrom
|
|
3860
|
-
} = anim;
|
|
3861
|
-
let {
|
|
3862
|
-
to: to2 = prevTo,
|
|
3863
|
-
from = prevFrom
|
|
3864
|
-
} = range;
|
|
3865
|
-
if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) {
|
|
3866
|
-
to2 = from;
|
|
3867
|
-
}
|
|
3868
|
-
if (props.reverse)
|
|
3869
|
-
[to2, from] = [from, to2];
|
|
3870
|
-
const hasFromChanged = !isEqual(from, prevFrom);
|
|
3871
|
-
if (hasFromChanged) {
|
|
3872
|
-
anim.from = from;
|
|
3873
|
-
}
|
|
3874
|
-
from = getFluidValue(from);
|
|
3875
|
-
const hasToChanged = !isEqual(to2, prevTo);
|
|
3876
|
-
if (hasToChanged) {
|
|
3877
|
-
this._focus(to2);
|
|
3878
|
-
}
|
|
3879
|
-
const hasAsyncTo = isAsyncTo(props.to);
|
|
3880
|
-
const {
|
|
3881
|
-
config: config2
|
|
3882
|
-
} = anim;
|
|
3883
|
-
const {
|
|
3884
|
-
decay,
|
|
3885
|
-
velocity
|
|
3886
|
-
} = config2;
|
|
3887
|
-
if (hasToProp || hasFromProp) {
|
|
3888
|
-
config2.velocity = 0;
|
|
3889
|
-
}
|
|
3890
|
-
if (props.config && !hasAsyncTo) {
|
|
3891
|
-
mergeConfig(config2, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0);
|
|
3892
|
-
}
|
|
3893
|
-
let node = getAnimated(this);
|
|
3894
|
-
if (!node || is.und(to2)) {
|
|
3895
|
-
return resolve(getFinishedResult(this, true));
|
|
3896
|
-
}
|
|
3897
|
-
const reset = is.und(props.reset) ? hasFromProp && !props.default : !is.und(from) && matchProp(props.reset, key);
|
|
3898
|
-
const value = reset ? from : this.get();
|
|
3899
|
-
const goal = computeGoal(to2);
|
|
3900
|
-
const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal);
|
|
3901
|
-
const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key));
|
|
3902
|
-
if (hasToChanged) {
|
|
3903
|
-
const nodeType = getAnimatedType(to2);
|
|
3904
|
-
if (nodeType !== node.constructor) {
|
|
3905
|
-
if (immediate) {
|
|
3906
|
-
node = this._set(goal);
|
|
3907
|
-
} else
|
|
3908
|
-
throw Error(`Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the "to" prop suggests`);
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
|
-
const goalType = node.constructor;
|
|
3912
|
-
let started = hasFluidValue(to2);
|
|
3913
|
-
let finished = false;
|
|
3914
|
-
if (!started) {
|
|
3915
|
-
const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
|
|
3916
|
-
if (hasToChanged || hasValueChanged) {
|
|
3917
|
-
finished = isEqual(computeGoal(value), goal);
|
|
3918
|
-
started = !finished;
|
|
3919
|
-
}
|
|
3920
|
-
if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {
|
|
3921
|
-
started = true;
|
|
3922
|
-
}
|
|
3923
|
-
}
|
|
3924
|
-
if (finished && isAnimating(this)) {
|
|
3925
|
-
if (anim.changed && !reset) {
|
|
3926
|
-
started = true;
|
|
3927
|
-
} else if (!started) {
|
|
3928
|
-
this._stop(prevTo);
|
|
3929
|
-
}
|
|
3930
|
-
}
|
|
3931
|
-
if (!hasAsyncTo) {
|
|
3932
|
-
if (started || hasFluidValue(prevTo)) {
|
|
3933
|
-
anim.values = node.getPayload();
|
|
3934
|
-
anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
|
|
3935
|
-
}
|
|
3936
|
-
if (anim.immediate != immediate) {
|
|
3937
|
-
anim.immediate = immediate;
|
|
3938
|
-
if (!immediate && !reset) {
|
|
3939
|
-
this._set(prevTo);
|
|
3940
|
-
}
|
|
3941
|
-
}
|
|
3942
|
-
if (started) {
|
|
3943
|
-
const {
|
|
3944
|
-
onRest
|
|
3945
|
-
} = anim;
|
|
3946
|
-
each(ACTIVE_EVENTS, (type) => mergeActiveFn(this, props, type));
|
|
3947
|
-
const result = getFinishedResult(this, checkFinished(this, prevTo));
|
|
3948
|
-
flushCalls(this._pendingCalls, result);
|
|
3949
|
-
this._pendingCalls.add(resolve);
|
|
3950
|
-
if (anim.changed)
|
|
3951
|
-
raf.batchedUpdates(() => {
|
|
3952
|
-
anim.changed = !reset;
|
|
3953
|
-
onRest == null ? void 0 : onRest(result, this);
|
|
3954
|
-
if (reset) {
|
|
3955
|
-
callProp(defaultProps.onRest, result);
|
|
3956
|
-
} else {
|
|
3957
|
-
anim.onStart == null ? void 0 : anim.onStart(result, this);
|
|
3958
|
-
}
|
|
3959
|
-
});
|
|
3960
|
-
}
|
|
3961
|
-
}
|
|
3962
|
-
if (reset) {
|
|
3963
|
-
this._set(value);
|
|
3964
|
-
}
|
|
3965
|
-
if (hasAsyncTo) {
|
|
3966
|
-
resolve(runAsync(props.to, props, this._state, this));
|
|
3967
|
-
} else if (started) {
|
|
3968
|
-
this._start();
|
|
3969
|
-
} else if (isAnimating(this) && !hasToChanged) {
|
|
3970
|
-
this._pendingCalls.add(resolve);
|
|
3971
|
-
} else {
|
|
3972
|
-
resolve(getNoopResult(value));
|
|
3973
|
-
}
|
|
3974
|
-
}
|
|
3975
|
-
_focus(value) {
|
|
3976
|
-
const anim = this.animation;
|
|
3977
|
-
if (value !== anim.to) {
|
|
3978
|
-
if (getFluidObservers(this)) {
|
|
3979
|
-
this._detach();
|
|
3980
|
-
}
|
|
3981
|
-
anim.to = value;
|
|
3982
|
-
if (getFluidObservers(this)) {
|
|
3983
|
-
this._attach();
|
|
3984
|
-
}
|
|
3985
|
-
}
|
|
3986
|
-
}
|
|
3987
|
-
_attach() {
|
|
3988
|
-
let priority2 = 0;
|
|
3989
|
-
const {
|
|
3990
|
-
to: to2
|
|
3991
|
-
} = this.animation;
|
|
3992
|
-
if (hasFluidValue(to2)) {
|
|
3993
|
-
addFluidObserver(to2, this);
|
|
3994
|
-
if (isFrameValue(to2)) {
|
|
3995
|
-
priority2 = to2.priority + 1;
|
|
3996
|
-
}
|
|
3997
|
-
}
|
|
3998
|
-
this.priority = priority2;
|
|
3999
|
-
}
|
|
4000
|
-
_detach() {
|
|
4001
|
-
const {
|
|
4002
|
-
to: to2
|
|
4003
|
-
} = this.animation;
|
|
4004
|
-
if (hasFluidValue(to2)) {
|
|
4005
|
-
removeFluidObserver(to2, this);
|
|
4006
|
-
}
|
|
4007
|
-
}
|
|
4008
|
-
_set(arg, idle = true) {
|
|
4009
|
-
const value = getFluidValue(arg);
|
|
4010
|
-
if (!is.und(value)) {
|
|
4011
|
-
const oldNode = getAnimated(this);
|
|
4012
|
-
if (!oldNode || !isEqual(value, oldNode.getValue())) {
|
|
4013
|
-
const nodeType = getAnimatedType(value);
|
|
4014
|
-
if (!oldNode || oldNode.constructor != nodeType) {
|
|
4015
|
-
setAnimated(this, nodeType.create(value));
|
|
4016
|
-
} else {
|
|
4017
|
-
oldNode.setValue(value);
|
|
4018
|
-
}
|
|
4019
|
-
if (oldNode) {
|
|
4020
|
-
raf.batchedUpdates(() => {
|
|
4021
|
-
this._onChange(value, idle);
|
|
4022
|
-
});
|
|
4023
|
-
}
|
|
4024
|
-
}
|
|
4025
|
-
}
|
|
4026
|
-
return getAnimated(this);
|
|
4027
|
-
}
|
|
4028
|
-
_onStart() {
|
|
4029
|
-
const anim = this.animation;
|
|
4030
|
-
if (!anim.changed) {
|
|
4031
|
-
anim.changed = true;
|
|
4032
|
-
sendEvent(this, "onStart", getFinishedResult(this, checkFinished(this, anim.to)), this);
|
|
4033
|
-
}
|
|
4034
|
-
}
|
|
4035
|
-
_onChange(value, idle) {
|
|
4036
|
-
if (!idle) {
|
|
4037
|
-
this._onStart();
|
|
4038
|
-
callProp(this.animation.onChange, value, this);
|
|
4039
|
-
}
|
|
4040
|
-
callProp(this.defaultProps.onChange, value, this);
|
|
4041
|
-
super._onChange(value, idle);
|
|
4042
|
-
}
|
|
4043
|
-
_start() {
|
|
4044
|
-
const anim = this.animation;
|
|
4045
|
-
getAnimated(this).reset(getFluidValue(anim.to));
|
|
4046
|
-
if (!anim.immediate) {
|
|
4047
|
-
anim.fromValues = anim.values.map((node) => node.lastPosition);
|
|
4048
|
-
}
|
|
4049
|
-
if (!isAnimating(this)) {
|
|
4050
|
-
setActiveBit(this, true);
|
|
4051
|
-
if (!isPaused(this)) {
|
|
4052
|
-
this._resume();
|
|
4053
|
-
}
|
|
4054
|
-
}
|
|
4055
|
-
}
|
|
4056
|
-
_resume() {
|
|
4057
|
-
if (globals.skipAnimation) {
|
|
4058
|
-
this.finish();
|
|
4059
|
-
} else {
|
|
4060
|
-
frameLoop.start(this);
|
|
4061
|
-
}
|
|
4062
|
-
}
|
|
4063
|
-
_stop(goal, cancel) {
|
|
4064
|
-
if (isAnimating(this)) {
|
|
4065
|
-
setActiveBit(this, false);
|
|
4066
|
-
const anim = this.animation;
|
|
4067
|
-
each(anim.values, (node) => {
|
|
4068
|
-
node.done = true;
|
|
4069
|
-
});
|
|
4070
|
-
if (anim.toValues) {
|
|
4071
|
-
anim.onChange = anim.onPause = anim.onResume = void 0;
|
|
4072
|
-
}
|
|
4073
|
-
callFluidObservers(this, {
|
|
4074
|
-
type: "idle",
|
|
4075
|
-
parent: this
|
|
4076
|
-
});
|
|
4077
|
-
const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to));
|
|
4078
|
-
flushCalls(this._pendingCalls, result);
|
|
4079
|
-
if (anim.changed) {
|
|
4080
|
-
anim.changed = false;
|
|
4081
|
-
sendEvent(this, "onRest", result, this);
|
|
4082
|
-
}
|
|
4083
|
-
}
|
|
4084
|
-
}
|
|
4085
|
-
}
|
|
4086
|
-
function checkFinished(target, to2) {
|
|
4087
|
-
const goal = computeGoal(to2);
|
|
4088
|
-
const value = computeGoal(target.get());
|
|
4089
|
-
return isEqual(value, goal);
|
|
4090
|
-
}
|
|
4091
|
-
function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
|
|
4092
|
-
let loopRet = callProp(loop2);
|
|
4093
|
-
if (loopRet) {
|
|
4094
|
-
const overrides = loopRet !== true && inferTo(loopRet);
|
|
4095
|
-
const reverse = (overrides || props).reverse;
|
|
4096
|
-
const reset = !overrides || overrides.reset;
|
|
4097
|
-
return createUpdate(_extends({}, props, {
|
|
4098
|
-
loop: loop2,
|
|
4099
|
-
default: false,
|
|
4100
|
-
pause: void 0,
|
|
4101
|
-
to: !reverse || isAsyncTo(to2) ? to2 : void 0,
|
|
4102
|
-
from: reset ? props.from : void 0,
|
|
4103
|
-
reset
|
|
4104
|
-
}, overrides));
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
function createUpdate(props) {
|
|
4108
|
-
const {
|
|
4109
|
-
to: to2,
|
|
4110
|
-
from
|
|
4111
|
-
} = props = inferTo(props);
|
|
4112
|
-
const keys = new Set();
|
|
4113
|
-
if (is.obj(to2))
|
|
4114
|
-
findDefined(to2, keys);
|
|
4115
|
-
if (is.obj(from))
|
|
4116
|
-
findDefined(from, keys);
|
|
4117
|
-
props.keys = keys.size ? Array.from(keys) : null;
|
|
4118
|
-
return props;
|
|
4119
|
-
}
|
|
4120
|
-
function declareUpdate(props) {
|
|
4121
|
-
const update2 = createUpdate(props);
|
|
4122
|
-
if (is.und(update2.default)) {
|
|
4123
|
-
update2.default = getDefaultProps(update2);
|
|
4124
|
-
}
|
|
4125
|
-
return update2;
|
|
4126
|
-
}
|
|
4127
|
-
function findDefined(values, keys) {
|
|
4128
|
-
eachProp(values, (value, key) => value != null && keys.add(key));
|
|
4129
|
-
}
|
|
4130
|
-
const ACTIVE_EVENTS = ["onStart", "onRest", "onChange", "onPause", "onResume"];
|
|
4131
|
-
function mergeActiveFn(target, props, type) {
|
|
4132
|
-
target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0;
|
|
4133
|
-
}
|
|
4134
|
-
function sendEvent(target, type, ...args) {
|
|
4135
|
-
var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps;
|
|
4136
|
-
(_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args);
|
|
4137
|
-
(_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args);
|
|
4138
|
-
}
|
|
4139
|
-
const BATCHED_EVENTS = ["onStart", "onChange", "onRest"];
|
|
4140
|
-
let nextId = 1;
|
|
4141
|
-
class Controller {
|
|
4142
|
-
constructor(props, flush2) {
|
|
4143
|
-
this.id = nextId++;
|
|
4144
|
-
this.springs = {};
|
|
4145
|
-
this.queue = [];
|
|
4146
|
-
this.ref = void 0;
|
|
4147
|
-
this._flush = void 0;
|
|
4148
|
-
this._initialProps = void 0;
|
|
4149
|
-
this._lastAsyncId = 0;
|
|
4150
|
-
this._active = new Set();
|
|
4151
|
-
this._changed = new Set();
|
|
4152
|
-
this._started = false;
|
|
4153
|
-
this._item = void 0;
|
|
4154
|
-
this._state = {
|
|
4155
|
-
paused: false,
|
|
4156
|
-
pauseQueue: new Set(),
|
|
4157
|
-
resumeQueue: new Set(),
|
|
4158
|
-
timeouts: new Set()
|
|
4159
|
-
};
|
|
4160
|
-
this._events = {
|
|
4161
|
-
onStart: new Map(),
|
|
4162
|
-
onChange: new Map(),
|
|
4163
|
-
onRest: new Map()
|
|
4164
|
-
};
|
|
4165
|
-
this._onFrame = this._onFrame.bind(this);
|
|
4166
|
-
if (flush2) {
|
|
4167
|
-
this._flush = flush2;
|
|
4168
|
-
}
|
|
4169
|
-
if (props) {
|
|
4170
|
-
this.start(_extends({
|
|
4171
|
-
default: true
|
|
4172
|
-
}, props));
|
|
4173
|
-
}
|
|
4174
|
-
}
|
|
4175
|
-
get idle() {
|
|
4176
|
-
return !this._state.asyncTo && Object.values(this.springs).every((spring) => spring.idle);
|
|
4177
|
-
}
|
|
4178
|
-
get item() {
|
|
4179
|
-
return this._item;
|
|
4180
|
-
}
|
|
4181
|
-
set item(item) {
|
|
4182
|
-
this._item = item;
|
|
4183
|
-
}
|
|
4184
|
-
get() {
|
|
4185
|
-
const values = {};
|
|
4186
|
-
this.each((spring, key) => values[key] = spring.get());
|
|
4187
|
-
return values;
|
|
4188
|
-
}
|
|
4189
|
-
set(values) {
|
|
4190
|
-
for (const key in values) {
|
|
4191
|
-
const value = values[key];
|
|
4192
|
-
if (!is.und(value)) {
|
|
4193
|
-
this.springs[key].set(value);
|
|
4194
|
-
}
|
|
4195
|
-
}
|
|
4196
|
-
}
|
|
4197
|
-
update(props) {
|
|
4198
|
-
if (props) {
|
|
4199
|
-
this.queue.push(createUpdate(props));
|
|
4200
|
-
}
|
|
4201
|
-
return this;
|
|
4202
|
-
}
|
|
4203
|
-
start(props) {
|
|
4204
|
-
let {
|
|
4205
|
-
queue
|
|
4206
|
-
} = this;
|
|
4207
|
-
if (props) {
|
|
4208
|
-
queue = toArray(props).map(createUpdate);
|
|
4209
|
-
} else {
|
|
4210
|
-
this.queue = [];
|
|
4211
|
-
}
|
|
4212
|
-
if (this._flush) {
|
|
4213
|
-
return this._flush(this, queue);
|
|
4214
|
-
}
|
|
4215
|
-
prepareKeys(this, queue);
|
|
4216
|
-
return flushUpdateQueue(this, queue);
|
|
4217
|
-
}
|
|
4218
|
-
stop(arg, keys) {
|
|
4219
|
-
if (arg !== !!arg) {
|
|
4220
|
-
keys = arg;
|
|
4221
|
-
}
|
|
4222
|
-
if (keys) {
|
|
4223
|
-
const springs = this.springs;
|
|
4224
|
-
each(toArray(keys), (key) => springs[key].stop(!!arg));
|
|
4225
|
-
} else {
|
|
4226
|
-
stopAsync(this._state, this._lastAsyncId);
|
|
4227
|
-
this.each((spring) => spring.stop(!!arg));
|
|
4228
|
-
}
|
|
4229
|
-
return this;
|
|
4230
|
-
}
|
|
4231
|
-
pause(keys) {
|
|
4232
|
-
if (is.und(keys)) {
|
|
4233
|
-
this.start({
|
|
4234
|
-
pause: true
|
|
4235
|
-
});
|
|
4236
|
-
} else {
|
|
4237
|
-
const springs = this.springs;
|
|
4238
|
-
each(toArray(keys), (key) => springs[key].pause());
|
|
4239
|
-
}
|
|
4240
|
-
return this;
|
|
4241
|
-
}
|
|
4242
|
-
resume(keys) {
|
|
4243
|
-
if (is.und(keys)) {
|
|
4244
|
-
this.start({
|
|
4245
|
-
pause: false
|
|
4246
|
-
});
|
|
4247
|
-
} else {
|
|
4248
|
-
const springs = this.springs;
|
|
4249
|
-
each(toArray(keys), (key) => springs[key].resume());
|
|
4250
|
-
}
|
|
4251
|
-
return this;
|
|
4252
|
-
}
|
|
4253
|
-
each(iterator) {
|
|
4254
|
-
eachProp(this.springs, iterator);
|
|
4255
|
-
}
|
|
4256
|
-
_onFrame() {
|
|
4257
|
-
const {
|
|
4258
|
-
onStart,
|
|
4259
|
-
onChange,
|
|
4260
|
-
onRest
|
|
4261
|
-
} = this._events;
|
|
4262
|
-
const active = this._active.size > 0;
|
|
4263
|
-
const changed = this._changed.size > 0;
|
|
4264
|
-
if (active && !this._started || changed && !this._started) {
|
|
4265
|
-
this._started = true;
|
|
4266
|
-
flush(onStart, ([onStart2, result]) => {
|
|
4267
|
-
result.value = this.get();
|
|
4268
|
-
onStart2(result, this, this._item);
|
|
4269
|
-
});
|
|
4270
|
-
}
|
|
4271
|
-
const idle = !active && this._started;
|
|
4272
|
-
const values = changed || idle && onRest.size ? this.get() : null;
|
|
4273
|
-
if (changed && onChange.size) {
|
|
4274
|
-
flush(onChange, ([onChange2, result]) => {
|
|
4275
|
-
result.value = values;
|
|
4276
|
-
onChange2(result, this, this._item);
|
|
4277
|
-
});
|
|
4278
|
-
}
|
|
4279
|
-
if (idle) {
|
|
4280
|
-
this._started = false;
|
|
4281
|
-
flush(onRest, ([onRest2, result]) => {
|
|
4282
|
-
result.value = values;
|
|
4283
|
-
onRest2(result, this, this._item);
|
|
4284
|
-
});
|
|
4285
|
-
}
|
|
4286
|
-
}
|
|
4287
|
-
eventObserved(event) {
|
|
4288
|
-
if (event.type == "change") {
|
|
4289
|
-
this._changed.add(event.parent);
|
|
4290
|
-
if (!event.idle) {
|
|
4291
|
-
this._active.add(event.parent);
|
|
4292
|
-
}
|
|
4293
|
-
} else if (event.type == "idle") {
|
|
4294
|
-
this._active.delete(event.parent);
|
|
4295
|
-
} else
|
|
4296
|
-
return;
|
|
4297
|
-
raf.onFrame(this._onFrame);
|
|
4298
|
-
}
|
|
4299
|
-
}
|
|
4300
|
-
function flushUpdateQueue(ctrl, queue) {
|
|
4301
|
-
return Promise.all(queue.map((props) => flushUpdate(ctrl, props))).then((results) => getCombinedResult(ctrl, results));
|
|
4302
|
-
}
|
|
4303
|
-
async function flushUpdate(ctrl, props, isLoop) {
|
|
4304
|
-
const {
|
|
4305
|
-
keys,
|
|
4306
|
-
to: to2,
|
|
4307
|
-
from,
|
|
4308
|
-
loop: loop2,
|
|
4309
|
-
onRest,
|
|
4310
|
-
onResolve
|
|
4311
|
-
} = props;
|
|
4312
|
-
const defaults2 = is.obj(props.default) && props.default;
|
|
4313
|
-
if (loop2) {
|
|
4314
|
-
props.loop = false;
|
|
4315
|
-
}
|
|
4316
|
-
if (to2 === false)
|
|
4317
|
-
props.to = null;
|
|
4318
|
-
if (from === false)
|
|
4319
|
-
props.from = null;
|
|
4320
|
-
const asyncTo = is.arr(to2) || is.fun(to2) ? to2 : void 0;
|
|
4321
|
-
if (asyncTo) {
|
|
4322
|
-
props.to = void 0;
|
|
4323
|
-
props.onRest = void 0;
|
|
4324
|
-
if (defaults2) {
|
|
4325
|
-
defaults2.onRest = void 0;
|
|
4326
|
-
}
|
|
4327
|
-
} else {
|
|
4328
|
-
each(BATCHED_EVENTS, (key) => {
|
|
4329
|
-
const handler = props[key];
|
|
4330
|
-
if (is.fun(handler)) {
|
|
4331
|
-
const queue = ctrl["_events"][key];
|
|
4332
|
-
props[key] = ({
|
|
4333
|
-
finished,
|
|
4334
|
-
cancelled
|
|
4335
|
-
}) => {
|
|
4336
|
-
const result2 = queue.get(handler);
|
|
4337
|
-
if (result2) {
|
|
4338
|
-
if (!finished)
|
|
4339
|
-
result2.finished = false;
|
|
4340
|
-
if (cancelled)
|
|
4341
|
-
result2.cancelled = true;
|
|
4342
|
-
} else {
|
|
4343
|
-
queue.set(handler, {
|
|
4344
|
-
value: null,
|
|
4345
|
-
finished: finished || false,
|
|
4346
|
-
cancelled: cancelled || false
|
|
4347
|
-
});
|
|
4348
|
-
}
|
|
4349
|
-
};
|
|
4350
|
-
if (defaults2) {
|
|
4351
|
-
defaults2[key] = props[key];
|
|
4352
|
-
}
|
|
4353
|
-
}
|
|
4354
|
-
});
|
|
4355
|
-
}
|
|
4356
|
-
const state = ctrl["_state"];
|
|
4357
|
-
if (props.pause === !state.paused) {
|
|
4358
|
-
state.paused = props.pause;
|
|
4359
|
-
flushCalls(props.pause ? state.pauseQueue : state.resumeQueue);
|
|
4360
|
-
} else if (state.paused) {
|
|
4361
|
-
props.pause = true;
|
|
4362
|
-
}
|
|
4363
|
-
const promises = (keys || Object.keys(ctrl.springs)).map((key) => ctrl.springs[key].start(props));
|
|
4364
|
-
const cancel = props.cancel === true || getDefaultProp(props, "cancel") === true;
|
|
4365
|
-
if (asyncTo || cancel && state.asyncId) {
|
|
4366
|
-
promises.push(scheduleProps(++ctrl["_lastAsyncId"], {
|
|
4367
|
-
props,
|
|
4368
|
-
state,
|
|
4369
|
-
actions: {
|
|
4370
|
-
pause: noop,
|
|
4371
|
-
resume: noop,
|
|
4372
|
-
start(props2, resolve) {
|
|
4373
|
-
if (cancel) {
|
|
4374
|
-
stopAsync(state, ctrl["_lastAsyncId"]);
|
|
4375
|
-
resolve(getCancelledResult(ctrl));
|
|
4376
|
-
} else {
|
|
4377
|
-
props2.onRest = onRest;
|
|
4378
|
-
resolve(runAsync(asyncTo, props2, state, ctrl));
|
|
4379
|
-
}
|
|
4380
|
-
}
|
|
4381
|
-
}
|
|
4382
|
-
}));
|
|
4383
|
-
}
|
|
4384
|
-
if (state.paused) {
|
|
4385
|
-
await new Promise((resume) => {
|
|
4386
|
-
state.resumeQueue.add(resume);
|
|
4387
|
-
});
|
|
4388
|
-
}
|
|
4389
|
-
const result = getCombinedResult(ctrl, await Promise.all(promises));
|
|
4390
|
-
if (loop2 && result.finished && !(isLoop && result.noop)) {
|
|
4391
|
-
const nextProps = createLoopUpdate(props, loop2, to2);
|
|
4392
|
-
if (nextProps) {
|
|
4393
|
-
prepareKeys(ctrl, [nextProps]);
|
|
4394
|
-
return flushUpdate(ctrl, nextProps, true);
|
|
4395
|
-
}
|
|
4396
|
-
}
|
|
4397
|
-
if (onResolve) {
|
|
4398
|
-
raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item));
|
|
4399
|
-
}
|
|
4400
|
-
return result;
|
|
4401
|
-
}
|
|
4402
|
-
function getSprings(ctrl, props) {
|
|
4403
|
-
const springs = _extends({}, ctrl.springs);
|
|
4404
|
-
if (props) {
|
|
4405
|
-
each(toArray(props), (props2) => {
|
|
4406
|
-
if (is.und(props2.keys)) {
|
|
4407
|
-
props2 = createUpdate(props2);
|
|
4408
|
-
}
|
|
4409
|
-
if (!is.obj(props2.to)) {
|
|
4410
|
-
props2 = _extends({}, props2, {
|
|
4411
|
-
to: void 0
|
|
4412
|
-
});
|
|
4413
|
-
}
|
|
4414
|
-
prepareSprings(springs, props2, (key) => {
|
|
4415
|
-
return createSpring(key);
|
|
4416
|
-
});
|
|
4417
|
-
});
|
|
4418
|
-
}
|
|
4419
|
-
setSprings(ctrl, springs);
|
|
4420
|
-
return springs;
|
|
4421
|
-
}
|
|
4422
|
-
function setSprings(ctrl, springs) {
|
|
4423
|
-
eachProp(springs, (spring, key) => {
|
|
4424
|
-
if (!ctrl.springs[key]) {
|
|
4425
|
-
ctrl.springs[key] = spring;
|
|
4426
|
-
addFluidObserver(spring, ctrl);
|
|
4427
|
-
}
|
|
4428
|
-
});
|
|
4429
|
-
}
|
|
4430
|
-
function createSpring(key, observer) {
|
|
4431
|
-
const spring = new SpringValue();
|
|
4432
|
-
spring.key = key;
|
|
4433
|
-
if (observer) {
|
|
4434
|
-
addFluidObserver(spring, observer);
|
|
4435
|
-
}
|
|
4436
|
-
return spring;
|
|
4437
|
-
}
|
|
4438
|
-
function prepareSprings(springs, props, create) {
|
|
4439
|
-
if (props.keys) {
|
|
4440
|
-
each(props.keys, (key) => {
|
|
4441
|
-
const spring = springs[key] || (springs[key] = create(key));
|
|
4442
|
-
spring["_prepareNode"](props);
|
|
4443
|
-
});
|
|
4444
|
-
}
|
|
4445
|
-
}
|
|
4446
|
-
function prepareKeys(ctrl, queue) {
|
|
4447
|
-
each(queue, (props) => {
|
|
4448
|
-
prepareSprings(ctrl.springs, props, (key) => {
|
|
4449
|
-
return createSpring(key, ctrl);
|
|
4450
|
-
});
|
|
4451
|
-
});
|
|
4452
|
-
}
|
|
4453
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
4454
|
-
if (source == null)
|
|
4455
|
-
return {};
|
|
4456
|
-
var target = {};
|
|
4457
|
-
var sourceKeys = Object.keys(source);
|
|
4458
|
-
var key, i;
|
|
4459
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
4460
|
-
key = sourceKeys[i];
|
|
4461
|
-
if (excluded.indexOf(key) >= 0)
|
|
4462
|
-
continue;
|
|
4463
|
-
target[key] = source[key];
|
|
4464
|
-
}
|
|
4465
|
-
return target;
|
|
4466
|
-
}
|
|
4467
|
-
const _excluded$3 = ["children"];
|
|
4468
|
-
const SpringContext = (_ref) => {
|
|
4469
|
-
let {
|
|
4470
|
-
children
|
|
4471
|
-
} = _ref, props = _objectWithoutPropertiesLoose$1(_ref, _excluded$3);
|
|
4472
|
-
const inherited = useContext(ctx);
|
|
4473
|
-
const pause = props.pause || !!inherited.pause, immediate = props.immediate || !!inherited.immediate;
|
|
4474
|
-
props = useMemoOne(() => ({
|
|
4475
|
-
pause,
|
|
4476
|
-
immediate
|
|
4477
|
-
}), [pause, immediate]);
|
|
4478
|
-
const {
|
|
4479
|
-
Provider
|
|
4480
|
-
} = ctx;
|
|
4481
|
-
return React.createElement(Provider, {
|
|
4482
|
-
value: props
|
|
4483
|
-
}, children);
|
|
4484
|
-
};
|
|
4485
|
-
const ctx = makeContext(SpringContext, {});
|
|
4486
|
-
SpringContext.Provider = ctx.Provider;
|
|
4487
|
-
SpringContext.Consumer = ctx.Consumer;
|
|
4488
|
-
function makeContext(target, init) {
|
|
4489
|
-
Object.assign(target, React.createContext(init));
|
|
4490
|
-
target.Provider._context = target;
|
|
4491
|
-
target.Consumer._context = target;
|
|
4492
|
-
return target;
|
|
4493
|
-
}
|
|
4494
|
-
const SpringRef = () => {
|
|
4495
|
-
const current = [];
|
|
4496
|
-
const SpringRef2 = function SpringRef3(props) {
|
|
4497
|
-
deprecateDirectCall();
|
|
4498
|
-
const results = [];
|
|
4499
|
-
each(current, (ctrl, i) => {
|
|
4500
|
-
if (is.und(props)) {
|
|
4501
|
-
results.push(ctrl.start());
|
|
4502
|
-
} else {
|
|
4503
|
-
const update2 = _getProps(props, ctrl, i);
|
|
4504
|
-
if (update2) {
|
|
4505
|
-
results.push(ctrl.start(update2));
|
|
4506
|
-
}
|
|
4507
|
-
}
|
|
4508
|
-
});
|
|
4509
|
-
return results;
|
|
4510
|
-
};
|
|
4511
|
-
SpringRef2.current = current;
|
|
4512
|
-
SpringRef2.add = function(ctrl) {
|
|
4513
|
-
if (!current.includes(ctrl)) {
|
|
4514
|
-
current.push(ctrl);
|
|
4515
|
-
}
|
|
4516
|
-
};
|
|
4517
|
-
SpringRef2.delete = function(ctrl) {
|
|
4518
|
-
const i = current.indexOf(ctrl);
|
|
4519
|
-
if (~i)
|
|
4520
|
-
current.splice(i, 1);
|
|
4521
|
-
};
|
|
4522
|
-
SpringRef2.pause = function() {
|
|
4523
|
-
each(current, (ctrl) => ctrl.pause(...arguments));
|
|
4524
|
-
return this;
|
|
4525
|
-
};
|
|
4526
|
-
SpringRef2.resume = function() {
|
|
4527
|
-
each(current, (ctrl) => ctrl.resume(...arguments));
|
|
4528
|
-
return this;
|
|
4529
|
-
};
|
|
4530
|
-
SpringRef2.set = function(values) {
|
|
4531
|
-
each(current, (ctrl) => ctrl.set(values));
|
|
4532
|
-
};
|
|
4533
|
-
SpringRef2.start = function(props) {
|
|
4534
|
-
const results = [];
|
|
4535
|
-
each(current, (ctrl, i) => {
|
|
4536
|
-
if (is.und(props)) {
|
|
4537
|
-
results.push(ctrl.start());
|
|
4538
|
-
} else {
|
|
4539
|
-
const update2 = this._getProps(props, ctrl, i);
|
|
4540
|
-
if (update2) {
|
|
4541
|
-
results.push(ctrl.start(update2));
|
|
4542
|
-
}
|
|
4543
|
-
}
|
|
4544
|
-
});
|
|
4545
|
-
return results;
|
|
4546
|
-
};
|
|
4547
|
-
SpringRef2.stop = function() {
|
|
4548
|
-
each(current, (ctrl) => ctrl.stop(...arguments));
|
|
4549
|
-
return this;
|
|
4550
|
-
};
|
|
4551
|
-
SpringRef2.update = function(props) {
|
|
4552
|
-
each(current, (ctrl, i) => ctrl.update(this._getProps(props, ctrl, i)));
|
|
4553
|
-
return this;
|
|
4554
|
-
};
|
|
4555
|
-
const _getProps = function _getProps2(arg, ctrl, index2) {
|
|
4556
|
-
return is.fun(arg) ? arg(index2, ctrl) : arg;
|
|
4557
|
-
};
|
|
4558
|
-
SpringRef2._getProps = _getProps;
|
|
4559
|
-
return SpringRef2;
|
|
4560
|
-
};
|
|
4561
|
-
function useSprings(length, props, deps) {
|
|
4562
|
-
const propsFn = is.fun(props) && props;
|
|
4563
|
-
if (propsFn && !deps)
|
|
4564
|
-
deps = [];
|
|
4565
|
-
const ref = useMemo(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []);
|
|
4566
|
-
const layoutId = useRef(0);
|
|
4567
|
-
const forceUpdate = useForceUpdate();
|
|
4568
|
-
const state = useMemo(() => ({
|
|
4569
|
-
ctrls: [],
|
|
4570
|
-
queue: [],
|
|
4571
|
-
flush(ctrl, updates2) {
|
|
4572
|
-
const springs2 = getSprings(ctrl, updates2);
|
|
4573
|
-
const canFlushSync = layoutId.current > 0 && !state.queue.length && !Object.keys(springs2).some((key) => !ctrl.springs[key]);
|
|
4574
|
-
return canFlushSync ? flushUpdateQueue(ctrl, updates2) : new Promise((resolve) => {
|
|
4575
|
-
setSprings(ctrl, springs2);
|
|
4576
|
-
state.queue.push(() => {
|
|
4577
|
-
resolve(flushUpdateQueue(ctrl, updates2));
|
|
4578
|
-
});
|
|
4579
|
-
forceUpdate();
|
|
4580
|
-
});
|
|
4581
|
-
}
|
|
4582
|
-
}), []);
|
|
4583
|
-
const ctrls = useRef([...state.ctrls]);
|
|
4584
|
-
const updates = [];
|
|
4585
|
-
const prevLength = usePrev(length) || 0;
|
|
4586
|
-
useMemo(() => {
|
|
4587
|
-
each(ctrls.current.slice(length, prevLength), (ctrl) => {
|
|
4588
|
-
detachRefs(ctrl, ref);
|
|
4589
|
-
ctrl.stop(true);
|
|
4590
|
-
});
|
|
4591
|
-
ctrls.current.length = length;
|
|
4592
|
-
declareUpdates(prevLength, length);
|
|
4593
|
-
}, [length]);
|
|
4594
|
-
useMemo(() => {
|
|
4595
|
-
declareUpdates(0, Math.min(prevLength, length));
|
|
4596
|
-
}, deps);
|
|
4597
|
-
function declareUpdates(startIndex, endIndex) {
|
|
4598
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
4599
|
-
const ctrl = ctrls.current[i] || (ctrls.current[i] = new Controller(null, state.flush));
|
|
4600
|
-
const update2 = propsFn ? propsFn(i, ctrl) : props[i];
|
|
4601
|
-
if (update2) {
|
|
4602
|
-
updates[i] = declareUpdate(update2);
|
|
4603
|
-
}
|
|
4604
|
-
}
|
|
4605
|
-
}
|
|
4606
|
-
const springs = ctrls.current.map((ctrl, i) => getSprings(ctrl, updates[i]));
|
|
4607
|
-
const context = useContext(SpringContext);
|
|
4608
|
-
const prevContext = usePrev(context);
|
|
4609
|
-
const hasContext = context !== prevContext && hasProps(context);
|
|
4610
|
-
useLayoutEffect(() => {
|
|
4611
|
-
layoutId.current++;
|
|
4612
|
-
state.ctrls = ctrls.current;
|
|
4613
|
-
const {
|
|
4614
|
-
queue
|
|
4615
|
-
} = state;
|
|
4616
|
-
if (queue.length) {
|
|
4617
|
-
state.queue = [];
|
|
4618
|
-
each(queue, (cb) => cb());
|
|
4619
|
-
}
|
|
4620
|
-
each(ctrls.current, (ctrl, i) => {
|
|
4621
|
-
ref == null ? void 0 : ref.add(ctrl);
|
|
4622
|
-
if (hasContext) {
|
|
4623
|
-
ctrl.start({
|
|
4624
|
-
default: context
|
|
4625
|
-
});
|
|
4626
|
-
}
|
|
4627
|
-
const update2 = updates[i];
|
|
4628
|
-
if (update2) {
|
|
4629
|
-
replaceRef(ctrl, update2.ref);
|
|
4630
|
-
if (ctrl.ref) {
|
|
4631
|
-
ctrl.queue.push(update2);
|
|
4632
|
-
} else {
|
|
4633
|
-
ctrl.start(update2);
|
|
4634
|
-
}
|
|
4635
|
-
}
|
|
4636
|
-
});
|
|
4637
|
-
});
|
|
4638
|
-
useOnce(() => () => {
|
|
4639
|
-
each(state.ctrls, (ctrl) => ctrl.stop(true));
|
|
4640
|
-
});
|
|
4641
|
-
const values = springs.map((x) => _extends({}, x));
|
|
4642
|
-
return ref ? [values, ref] : values;
|
|
4643
|
-
}
|
|
4644
|
-
function useSpring(props, deps) {
|
|
4645
|
-
const isFn = is.fun(props);
|
|
4646
|
-
const [[values], ref] = useSprings(1, isFn ? props : [props], isFn ? deps || [] : deps);
|
|
4647
|
-
return isFn || arguments.length == 2 ? [values, ref] : values;
|
|
4648
|
-
}
|
|
4649
|
-
let TransitionPhase;
|
|
4650
|
-
(function(TransitionPhase2) {
|
|
4651
|
-
TransitionPhase2["MOUNT"] = "mount";
|
|
4652
|
-
TransitionPhase2["ENTER"] = "enter";
|
|
4653
|
-
TransitionPhase2["UPDATE"] = "update";
|
|
4654
|
-
TransitionPhase2["LEAVE"] = "leave";
|
|
4655
|
-
})(TransitionPhase || (TransitionPhase = {}));
|
|
4656
|
-
class Interpolation extends FrameValue {
|
|
4657
|
-
constructor(source, args) {
|
|
4658
|
-
super();
|
|
4659
|
-
this.key = void 0;
|
|
4660
|
-
this.idle = true;
|
|
4661
|
-
this.calc = void 0;
|
|
4662
|
-
this._active = new Set();
|
|
4663
|
-
this.source = source;
|
|
4664
|
-
this.calc = createInterpolator(...args);
|
|
4665
|
-
const value = this._get();
|
|
4666
|
-
const nodeType = getAnimatedType(value);
|
|
4667
|
-
setAnimated(this, nodeType.create(value));
|
|
4668
|
-
}
|
|
4669
|
-
advance(_dt) {
|
|
4670
|
-
const value = this._get();
|
|
4671
|
-
const oldValue = this.get();
|
|
4672
|
-
if (!isEqual(value, oldValue)) {
|
|
4673
|
-
getAnimated(this).setValue(value);
|
|
4674
|
-
this._onChange(value, this.idle);
|
|
4675
|
-
}
|
|
4676
|
-
if (!this.idle && checkIdle(this._active)) {
|
|
4677
|
-
becomeIdle(this);
|
|
4678
|
-
}
|
|
4679
|
-
}
|
|
4680
|
-
_get() {
|
|
4681
|
-
const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
|
|
4682
|
-
return this.calc(...inputs);
|
|
4683
|
-
}
|
|
4684
|
-
_start() {
|
|
4685
|
-
if (this.idle && !checkIdle(this._active)) {
|
|
4686
|
-
this.idle = false;
|
|
4687
|
-
each(getPayload(this), (node) => {
|
|
4688
|
-
node.done = false;
|
|
4689
|
-
});
|
|
4690
|
-
if (globals.skipAnimation) {
|
|
4691
|
-
raf.batchedUpdates(() => this.advance());
|
|
4692
|
-
becomeIdle(this);
|
|
4693
|
-
} else {
|
|
4694
|
-
frameLoop.start(this);
|
|
4695
|
-
}
|
|
4696
|
-
}
|
|
4697
|
-
}
|
|
4698
|
-
_attach() {
|
|
4699
|
-
let priority2 = 1;
|
|
4700
|
-
each(toArray(this.source), (source) => {
|
|
4701
|
-
if (hasFluidValue(source)) {
|
|
4702
|
-
addFluidObserver(source, this);
|
|
4703
|
-
}
|
|
4704
|
-
if (isFrameValue(source)) {
|
|
4705
|
-
if (!source.idle) {
|
|
4706
|
-
this._active.add(source);
|
|
4707
|
-
}
|
|
4708
|
-
priority2 = Math.max(priority2, source.priority + 1);
|
|
4709
|
-
}
|
|
4710
|
-
});
|
|
4711
|
-
this.priority = priority2;
|
|
4712
|
-
this._start();
|
|
4713
|
-
}
|
|
4714
|
-
_detach() {
|
|
4715
|
-
each(toArray(this.source), (source) => {
|
|
4716
|
-
if (hasFluidValue(source)) {
|
|
4717
|
-
removeFluidObserver(source, this);
|
|
4718
|
-
}
|
|
4719
|
-
});
|
|
4720
|
-
this._active.clear();
|
|
4721
|
-
becomeIdle(this);
|
|
4722
|
-
}
|
|
4723
|
-
eventObserved(event) {
|
|
4724
|
-
if (event.type == "change") {
|
|
4725
|
-
if (event.idle) {
|
|
4726
|
-
this.advance();
|
|
4727
|
-
} else {
|
|
4728
|
-
this._active.add(event.parent);
|
|
4729
|
-
this._start();
|
|
4730
|
-
}
|
|
4731
|
-
} else if (event.type == "idle") {
|
|
4732
|
-
this._active.delete(event.parent);
|
|
4733
|
-
} else if (event.type == "priority") {
|
|
4734
|
-
this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
|
|
4735
|
-
}
|
|
4736
|
-
}
|
|
4737
|
-
}
|
|
4738
|
-
function isIdle(source) {
|
|
4739
|
-
return source.idle !== false;
|
|
4740
|
-
}
|
|
4741
|
-
function checkIdle(active) {
|
|
4742
|
-
return !active.size || Array.from(active).every(isIdle);
|
|
4743
|
-
}
|
|
4744
|
-
function becomeIdle(self2) {
|
|
4745
|
-
if (!self2.idle) {
|
|
4746
|
-
self2.idle = true;
|
|
4747
|
-
each(getPayload(self2), (node) => {
|
|
4748
|
-
node.done = true;
|
|
4749
|
-
});
|
|
4750
|
-
callFluidObservers(self2, {
|
|
4751
|
-
type: "idle",
|
|
4752
|
-
parent: self2
|
|
4753
|
-
});
|
|
4754
|
-
}
|
|
4755
|
-
}
|
|
4756
|
-
globals.assign({
|
|
4757
|
-
createStringInterpolator,
|
|
4758
|
-
to: (source, args) => new Interpolation(source, args)
|
|
4759
|
-
});
|
|
4760
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
4761
|
-
if (source == null)
|
|
4762
|
-
return {};
|
|
4763
|
-
var target = {};
|
|
4764
|
-
var sourceKeys = Object.keys(source);
|
|
4765
|
-
var key, i;
|
|
4766
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
4767
|
-
key = sourceKeys[i];
|
|
4768
|
-
if (excluded.indexOf(key) >= 0)
|
|
4769
|
-
continue;
|
|
4770
|
-
target[key] = source[key];
|
|
4771
|
-
}
|
|
4772
|
-
return target;
|
|
4773
|
-
}
|
|
4774
|
-
const _excluded$2 = ["style", "children", "scrollTop", "scrollLeft"];
|
|
4775
|
-
const isCustomPropRE = /^--/;
|
|
4776
|
-
function dangerousStyleValue(name, value) {
|
|
4777
|
-
if (value == null || typeof value === "boolean" || value === "")
|
|
4778
|
-
return "";
|
|
4779
|
-
if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name) && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]))
|
|
4780
|
-
return value + "px";
|
|
4781
|
-
return ("" + value).trim();
|
|
4782
|
-
}
|
|
4783
|
-
const attributeCache = {};
|
|
4784
|
-
function applyAnimatedValues(instance, props) {
|
|
4785
|
-
if (!instance.nodeType || !instance.setAttribute) {
|
|
4786
|
-
return false;
|
|
4787
|
-
}
|
|
4788
|
-
const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter";
|
|
4789
|
-
const _ref = props, {
|
|
4790
|
-
style,
|
|
4791
|
-
children,
|
|
4792
|
-
scrollTop,
|
|
4793
|
-
scrollLeft
|
|
4794
|
-
} = _ref, attributes = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
4795
|
-
const values = Object.values(attributes);
|
|
4796
|
-
const names = Object.keys(attributes).map((name) => isFilterElement || instance.hasAttribute(name) ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, (n) => "-" + n.toLowerCase())));
|
|
4797
|
-
if (children !== void 0) {
|
|
4798
|
-
instance.textContent = children;
|
|
4799
|
-
}
|
|
4800
|
-
for (let name in style) {
|
|
4801
|
-
if (style.hasOwnProperty(name)) {
|
|
4802
|
-
const value = dangerousStyleValue(name, style[name]);
|
|
4803
|
-
if (isCustomPropRE.test(name)) {
|
|
4804
|
-
instance.style.setProperty(name, value);
|
|
4805
|
-
} else {
|
|
4806
|
-
instance.style[name] = value;
|
|
4807
|
-
}
|
|
4808
|
-
}
|
|
4809
|
-
}
|
|
4810
|
-
names.forEach((name, i) => {
|
|
4811
|
-
instance.setAttribute(name, values[i]);
|
|
4812
|
-
});
|
|
4813
|
-
if (scrollTop !== void 0) {
|
|
4814
|
-
instance.scrollTop = scrollTop;
|
|
4815
|
-
}
|
|
4816
|
-
if (scrollLeft !== void 0) {
|
|
4817
|
-
instance.scrollLeft = scrollLeft;
|
|
4818
|
-
}
|
|
4819
|
-
}
|
|
4820
|
-
let isUnitlessNumber = {
|
|
4821
|
-
animationIterationCount: true,
|
|
4822
|
-
borderImageOutset: true,
|
|
4823
|
-
borderImageSlice: true,
|
|
4824
|
-
borderImageWidth: true,
|
|
4825
|
-
boxFlex: true,
|
|
4826
|
-
boxFlexGroup: true,
|
|
4827
|
-
boxOrdinalGroup: true,
|
|
4828
|
-
columnCount: true,
|
|
4829
|
-
columns: true,
|
|
4830
|
-
flex: true,
|
|
4831
|
-
flexGrow: true,
|
|
4832
|
-
flexPositive: true,
|
|
4833
|
-
flexShrink: true,
|
|
4834
|
-
flexNegative: true,
|
|
4835
|
-
flexOrder: true,
|
|
4836
|
-
gridRow: true,
|
|
4837
|
-
gridRowEnd: true,
|
|
4838
|
-
gridRowSpan: true,
|
|
4839
|
-
gridRowStart: true,
|
|
4840
|
-
gridColumn: true,
|
|
4841
|
-
gridColumnEnd: true,
|
|
4842
|
-
gridColumnSpan: true,
|
|
4843
|
-
gridColumnStart: true,
|
|
4844
|
-
fontWeight: true,
|
|
4845
|
-
lineClamp: true,
|
|
4846
|
-
lineHeight: true,
|
|
4847
|
-
opacity: true,
|
|
4848
|
-
order: true,
|
|
4849
|
-
orphans: true,
|
|
4850
|
-
tabSize: true,
|
|
4851
|
-
widows: true,
|
|
4852
|
-
zIndex: true,
|
|
4853
|
-
zoom: true,
|
|
4854
|
-
fillOpacity: true,
|
|
4855
|
-
floodOpacity: true,
|
|
4856
|
-
stopOpacity: true,
|
|
4857
|
-
strokeDasharray: true,
|
|
4858
|
-
strokeDashoffset: true,
|
|
4859
|
-
strokeMiterlimit: true,
|
|
4860
|
-
strokeOpacity: true,
|
|
4861
|
-
strokeWidth: true
|
|
4862
|
-
};
|
|
4863
|
-
const prefixKey = (prefix2, key) => prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
|
|
4864
|
-
const prefixes = ["Webkit", "Ms", "Moz", "O"];
|
|
4865
|
-
isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
|
|
4866
|
-
prefixes.forEach((prefix2) => acc[prefixKey(prefix2, prop)] = acc[prop]);
|
|
4867
|
-
return acc;
|
|
4868
|
-
}, isUnitlessNumber);
|
|
4869
|
-
const _excluded$1 = ["x", "y", "z"];
|
|
4870
|
-
const domTransforms = /^(matrix|translate|scale|rotate|skew)/;
|
|
4871
|
-
const pxTransforms = /^(translate)/;
|
|
4872
|
-
const degTransforms = /^(rotate|skew)/;
|
|
4873
|
-
const addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value;
|
|
4874
|
-
const isValueIdentity = (value, id) => is.arr(value) ? value.every((v) => isValueIdentity(v, id)) : is.num(value) ? value === id : parseFloat(value) === id;
|
|
4875
|
-
class AnimatedStyle extends AnimatedObject {
|
|
4876
|
-
constructor(_ref) {
|
|
4877
|
-
let {
|
|
4878
|
-
x,
|
|
4879
|
-
y,
|
|
4880
|
-
z
|
|
4881
|
-
} = _ref, style = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
4882
|
-
const inputs = [];
|
|
4883
|
-
const transforms = [];
|
|
4884
|
-
if (x || y || z) {
|
|
4885
|
-
inputs.push([x || 0, y || 0, z || 0]);
|
|
4886
|
-
transforms.push((xyz) => [`translate3d(${xyz.map((v) => addUnit(v, "px")).join(",")})`, isValueIdentity(xyz, 0)]);
|
|
4887
|
-
}
|
|
4888
|
-
eachProp(style, (value, key) => {
|
|
4889
|
-
if (key === "transform") {
|
|
4890
|
-
inputs.push([value || ""]);
|
|
4891
|
-
transforms.push((transform) => [transform, transform === ""]);
|
|
4892
|
-
} else if (domTransforms.test(key)) {
|
|
4893
|
-
delete style[key];
|
|
4894
|
-
if (is.und(value))
|
|
4895
|
-
return;
|
|
4896
|
-
const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : "";
|
|
4897
|
-
inputs.push(toArray(value));
|
|
4898
|
-
transforms.push(key === "rotate3d" ? ([x2, y2, z2, deg]) => [`rotate3d(${x2},${y2},${z2},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`${key}(${input.map((v) => addUnit(v, unit)).join(",")})`, isValueIdentity(input, key.startsWith("scale") ? 1 : 0)]);
|
|
4899
|
-
}
|
|
4900
|
-
});
|
|
4901
|
-
if (inputs.length) {
|
|
4902
|
-
style.transform = new FluidTransform(inputs, transforms);
|
|
4903
|
-
}
|
|
4904
|
-
super(style);
|
|
4905
|
-
}
|
|
4906
|
-
}
|
|
4907
|
-
class FluidTransform extends FluidValue {
|
|
4908
|
-
constructor(inputs, transforms) {
|
|
4909
|
-
super();
|
|
4910
|
-
this._value = null;
|
|
4911
|
-
this.inputs = inputs;
|
|
4912
|
-
this.transforms = transforms;
|
|
4913
|
-
}
|
|
4914
|
-
get() {
|
|
4915
|
-
return this._value || (this._value = this._get());
|
|
4916
|
-
}
|
|
4917
|
-
_get() {
|
|
4918
|
-
let transform = "";
|
|
4919
|
-
let identity = true;
|
|
4920
|
-
each(this.inputs, (input, i) => {
|
|
4921
|
-
const arg1 = getFluidValue(input[0]);
|
|
4922
|
-
const [t, id] = this.transforms[i](is.arr(arg1) ? arg1 : input.map(getFluidValue));
|
|
4923
|
-
transform += " " + t;
|
|
4924
|
-
identity = identity && id;
|
|
4925
|
-
});
|
|
4926
|
-
return identity ? "none" : transform;
|
|
4927
|
-
}
|
|
4928
|
-
observerAdded(count) {
|
|
4929
|
-
if (count == 1)
|
|
4930
|
-
each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && addFluidObserver(value, this)));
|
|
4931
|
-
}
|
|
4932
|
-
observerRemoved(count) {
|
|
4933
|
-
if (count == 0)
|
|
4934
|
-
each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && removeFluidObserver(value, this)));
|
|
4935
|
-
}
|
|
4936
|
-
eventObserved(event) {
|
|
4937
|
-
if (event.type == "change") {
|
|
4938
|
-
this._value = null;
|
|
4939
|
-
}
|
|
4940
|
-
callFluidObservers(this, event);
|
|
4941
|
-
}
|
|
4942
|
-
}
|
|
4943
|
-
const primitives = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
|
|
4944
|
-
const _excluded = ["scrollTop", "scrollLeft"];
|
|
4945
|
-
globals.assign({
|
|
4946
|
-
batchedUpdates: unstable_batchedUpdates,
|
|
4947
|
-
createStringInterpolator,
|
|
4948
|
-
colors
|
|
4949
|
-
});
|
|
4950
|
-
const host = createHost(primitives, {
|
|
4951
|
-
applyAnimatedValues,
|
|
4952
|
-
createAnimatedStyle: (style) => new AnimatedStyle(style),
|
|
4953
|
-
getComponentProps: (_ref) => {
|
|
4954
|
-
let props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
4955
|
-
return props;
|
|
4956
|
-
}
|
|
4957
|
-
});
|
|
4958
|
-
const animated = host.animated;
|
|
4959
1561
|
function PdaActionSheet(props) {
|
|
4960
|
-
const { className, visible, actions } = props;
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
config: {
|
|
4966
|
-
precision: 0.1,
|
|
4967
|
-
mass: 0.4,
|
|
4968
|
-
tension: 300,
|
|
4969
|
-
friction: 30
|
|
4970
|
-
},
|
|
4971
|
-
onStart: () => {
|
|
4972
|
-
setActive(true);
|
|
4973
|
-
},
|
|
4974
|
-
onRest: () => {
|
|
4975
|
-
setActive(props.visible);
|
|
4976
|
-
}
|
|
4977
|
-
});
|
|
4978
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4979
|
-
className: classNames({ [className]: true, "pda-action-sheet": true }),
|
|
4980
|
-
style: { display: active ? "unset" : "none" }
|
|
4981
|
-
}, /* @__PURE__ */ React__default.createElement(animated.div, {
|
|
4982
|
-
className: "pda-action-sheet-body",
|
|
4983
|
-
style: {
|
|
4984
|
-
transform: percent.to((v) => {
|
|
4985
|
-
return `translate(0, ${v}%)`;
|
|
4986
|
-
})
|
|
4987
|
-
},
|
|
4988
|
-
ref
|
|
1562
|
+
const { className = "", visible, actions } = props;
|
|
1563
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1564
|
+
className: classNames({ [className]: true, "pda-action-sheet": true, "show": visible })
|
|
1565
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1566
|
+
className: "pda-action-sheet-body"
|
|
4989
1567
|
}, actions.map((item, index2) => {
|
|
4990
|
-
return /* @__PURE__ */
|
|
1568
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4991
1569
|
onClick: () => {
|
|
4992
1570
|
item.onClick(item.key);
|
|
4993
1571
|
},
|
|
@@ -4996,4 +1574,5 @@ function PdaActionSheet(props) {
|
|
|
4996
1574
|
}, item.title);
|
|
4997
1575
|
})));
|
|
4998
1576
|
}
|
|
4999
|
-
|
|
1577
|
+
const ListItem = PdaListItem;
|
|
1578
|
+
export { PdaActionSheet as ActionSheet, BaseLayout, Button, Confirm$1 as Confirm, PdaDistanceCard as DistanceCard, PdaFinishCard as FinishCard, index$i as Header, InfiniteScroll, PdaInfoCard$2 as InfoCard, List, ListItem, Overlay, index$b as PageFlowSystemPages, Presentation, PdaInfoCard as Steps, SubCard, PdaListItem as TaskCard, PdaTitle as Title, Confirm as Toast, WakeKeyborard };
|