react-vant-nova 1.1.5-test → 1.1.7-test
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/bundle/react-vant-nova.es.js +33 -16
- package/bundle/react-vant-nova.js +31 -14
- package/bundle/react-vant-nova.min.js +2 -2
- package/es/toast/method.js +28 -11
- package/lib/toast/method.js +28 -11
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useState, useMemo, useCallback, useContext, createContext, forwardRef, useImperativeHandle, memo, isValidElement, Children, cloneElement } from "react";
|
|
1
|
+
import React, { useRef, useEffect, useState, useMemo, useCallback, useContext, createContext, forwardRef, useImperativeHandle, memo, isValidElement, version, Children, cloneElement } from "react";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { ArrowLeft, ArrowUp, ArrowDown, Arrow, Cross, Clear, QuestionO, PhotoFail, Photo, Checked, Success, Search as Search$1, Star, StarO, Close, Description, Photograph, ExpandO } from "@react-vant/icons";
|
|
4
4
|
import { CSSTransition } from "react-transition-group";
|
|
5
5
|
import * as ReactDOM from "react-dom";
|
|
6
|
-
import { createPortal } from "react-dom";
|
|
6
|
+
import { createPortal, version as version$1 } from "react-dom";
|
|
7
7
|
import { createUseGesture, dragAction, pinchAction, useDrag } from "@use-gesture/react";
|
|
8
8
|
import { useSpring, animated } from "@react-spring/web";
|
|
9
9
|
import { createPopper, offsetModifier } from "@vant/popperjs";
|
|
@@ -5665,6 +5665,11 @@ const Toast$1 = (p) => {
|
|
|
5665
5665
|
teleport: props.teleport
|
|
5666
5666
|
}, renderIcon(), renderMessage());
|
|
5667
5667
|
};
|
|
5668
|
+
const reactVersion = Number((version || "").split(".")[0]);
|
|
5669
|
+
Number((version$1 || "").split(".")[0]);
|
|
5670
|
+
console.log("method.tsx loaded");
|
|
5671
|
+
console.log("React version:", reactVersion);
|
|
5672
|
+
console.log("canUseDom:", canUseDom());
|
|
5668
5673
|
const defaultOptions = {
|
|
5669
5674
|
message: "",
|
|
5670
5675
|
className: "",
|
|
@@ -5689,9 +5694,13 @@ function nextTickClear() {
|
|
|
5689
5694
|
setTimeout(syncClear);
|
|
5690
5695
|
}
|
|
5691
5696
|
const ToastObj = (p) => {
|
|
5692
|
-
|
|
5697
|
+
console.log("ToastObj called");
|
|
5698
|
+
if (!canUseDom()) {
|
|
5699
|
+
console.log("canUseDom returned false");
|
|
5693
5700
|
return null;
|
|
5701
|
+
}
|
|
5694
5702
|
const props = parseOptions(p);
|
|
5703
|
+
console.log("props:", props);
|
|
5695
5704
|
const update = {
|
|
5696
5705
|
config: () => {
|
|
5697
5706
|
},
|
|
@@ -5701,16 +5710,20 @@ const ToastObj = (p) => {
|
|
|
5701
5710
|
const { onClose, teleport } = props;
|
|
5702
5711
|
const container = document.createElement("div");
|
|
5703
5712
|
const bodyContainer = resolveContainer(teleport);
|
|
5713
|
+
console.log("bodyContainer:", bodyContainer);
|
|
5704
5714
|
bodyContainer.appendChild(container);
|
|
5715
|
+
console.log("container added to bodyContainer");
|
|
5705
5716
|
const TempToast = () => {
|
|
5706
|
-
console.log("TempToast");
|
|
5717
|
+
console.log("TempToast component rendered");
|
|
5707
5718
|
const options = {
|
|
5708
5719
|
duration: 2e3,
|
|
5709
5720
|
...props
|
|
5710
5721
|
};
|
|
5711
5722
|
const [visible, setVisible] = useState(false);
|
|
5712
5723
|
const [state, setState] = useState({ ...options });
|
|
5724
|
+
console.log("TempToast useState initialized, visible:", visible);
|
|
5713
5725
|
const internalOnClosed = useCallback(() => {
|
|
5726
|
+
console.log("internalOnClosed called");
|
|
5714
5727
|
if (state.forbidClick) {
|
|
5715
5728
|
lockClick(false);
|
|
5716
5729
|
}
|
|
@@ -5723,7 +5736,7 @@ const ToastObj = (p) => {
|
|
|
5723
5736
|
}, +state.duration || +defaultOptions.duration);
|
|
5724
5737
|
}, [container]);
|
|
5725
5738
|
const destroy = useCallback(() => {
|
|
5726
|
-
console.log("destroy");
|
|
5739
|
+
console.log("destroy called");
|
|
5727
5740
|
setVisible(false);
|
|
5728
5741
|
if (onClose)
|
|
5729
5742
|
onClose();
|
|
@@ -5731,6 +5744,7 @@ const ToastObj = (p) => {
|
|
|
5731
5744
|
update.clear = internalOnClosed;
|
|
5732
5745
|
update.config = useCallback(
|
|
5733
5746
|
(nextState) => {
|
|
5747
|
+
console.log("update.config called:", nextState);
|
|
5734
5748
|
setState(
|
|
5735
5749
|
(prev2) => typeof nextState === "function" ? { ...prev2, ...nextState(prev2) } : { ...prev2, ...nextState }
|
|
5736
5750
|
);
|
|
@@ -5738,7 +5752,7 @@ const ToastObj = (p) => {
|
|
|
5738
5752
|
[setState]
|
|
5739
5753
|
);
|
|
5740
5754
|
useIsomorphicLayoutEffect(() => {
|
|
5741
|
-
console.log("useIsomorphicLayoutEffect");
|
|
5755
|
+
console.log("useIsomorphicLayoutEffect called");
|
|
5742
5756
|
setVisible(true);
|
|
5743
5757
|
if (!allowMultiple)
|
|
5744
5758
|
syncClear();
|
|
@@ -5760,24 +5774,27 @@ const ToastObj = (p) => {
|
|
|
5760
5774
|
onClosed: internalOnClosed
|
|
5761
5775
|
});
|
|
5762
5776
|
};
|
|
5777
|
+
console.log("Before render(<TempToast />)");
|
|
5763
5778
|
render(/* @__PURE__ */ React.createElement(TempToast, null), container);
|
|
5764
|
-
console.log("render(<TempToast
|
|
5765
|
-
|
|
5766
|
-
return update;
|
|
5767
|
-
}, 300);
|
|
5779
|
+
console.log("After render(<TempToast />)");
|
|
5780
|
+
return update;
|
|
5768
5781
|
};
|
|
5769
5782
|
function parseOptions(message) {
|
|
5783
|
+
console.log("parseOptions called:", message);
|
|
5770
5784
|
if (isObject(message)) {
|
|
5771
5785
|
return message;
|
|
5772
5786
|
}
|
|
5773
5787
|
return { message };
|
|
5774
5788
|
}
|
|
5775
|
-
const createMethod = (type) => (options) =>
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5789
|
+
const createMethod = (type) => (options) => {
|
|
5790
|
+
console.log("createMethod called:", type, options);
|
|
5791
|
+
return ToastObj({
|
|
5792
|
+
...currentOptions,
|
|
5793
|
+
...defaultOptionsMap.get(type),
|
|
5794
|
+
...parseOptions(options),
|
|
5795
|
+
type
|
|
5796
|
+
});
|
|
5797
|
+
};
|
|
5781
5798
|
["info", "loading", "success", "fail"].forEach((method) => {
|
|
5782
5799
|
ToastObj[method] = createMethod(method);
|
|
5783
5800
|
});
|
|
@@ -12224,6 +12224,11 @@
|
|
|
12224
12224
|
teleport: props.teleport
|
|
12225
12225
|
}, renderIcon(), renderMessage());
|
|
12226
12226
|
};
|
|
12227
|
+
const reactVersion = Number((React.version || "").split(".")[0]);
|
|
12228
|
+
Number((ReactDOM.version || "").split(".")[0]);
|
|
12229
|
+
console.log("method.tsx loaded");
|
|
12230
|
+
console.log("React version:", reactVersion);
|
|
12231
|
+
console.log("canUseDom:", canUseDom());
|
|
12227
12232
|
const defaultOptions = {
|
|
12228
12233
|
message: "",
|
|
12229
12234
|
className: "",
|
|
@@ -12248,9 +12253,13 @@
|
|
|
12248
12253
|
setTimeout(syncClear);
|
|
12249
12254
|
}
|
|
12250
12255
|
const ToastObj = (p2) => {
|
|
12251
|
-
|
|
12256
|
+
console.log("ToastObj called");
|
|
12257
|
+
if (!canUseDom()) {
|
|
12258
|
+
console.log("canUseDom returned false");
|
|
12252
12259
|
return null;
|
|
12260
|
+
}
|
|
12253
12261
|
const props = parseOptions(p2);
|
|
12262
|
+
console.log("props:", props);
|
|
12254
12263
|
const update2 = {
|
|
12255
12264
|
config: () => {
|
|
12256
12265
|
},
|
|
@@ -12260,16 +12269,20 @@
|
|
|
12260
12269
|
const { onClose, teleport } = props;
|
|
12261
12270
|
const container = document.createElement("div");
|
|
12262
12271
|
const bodyContainer = resolveContainer(teleport);
|
|
12272
|
+
console.log("bodyContainer:", bodyContainer);
|
|
12263
12273
|
bodyContainer.appendChild(container);
|
|
12274
|
+
console.log("container added to bodyContainer");
|
|
12264
12275
|
const TempToast = () => {
|
|
12265
|
-
console.log("TempToast");
|
|
12276
|
+
console.log("TempToast component rendered");
|
|
12266
12277
|
const options = {
|
|
12267
12278
|
duration: 2e3,
|
|
12268
12279
|
...props
|
|
12269
12280
|
};
|
|
12270
12281
|
const [visible, setVisible] = React.useState(false);
|
|
12271
12282
|
const [state, setState] = React.useState({ ...options });
|
|
12283
|
+
console.log("TempToast useState initialized, visible:", visible);
|
|
12272
12284
|
const internalOnClosed = React.useCallback(() => {
|
|
12285
|
+
console.log("internalOnClosed called");
|
|
12273
12286
|
if (state.forbidClick) {
|
|
12274
12287
|
lockClick(false);
|
|
12275
12288
|
}
|
|
@@ -12282,7 +12295,7 @@
|
|
|
12282
12295
|
}, +state.duration || +defaultOptions.duration);
|
|
12283
12296
|
}, [container]);
|
|
12284
12297
|
const destroy = React.useCallback(() => {
|
|
12285
|
-
console.log("destroy");
|
|
12298
|
+
console.log("destroy called");
|
|
12286
12299
|
setVisible(false);
|
|
12287
12300
|
if (onClose)
|
|
12288
12301
|
onClose();
|
|
@@ -12290,6 +12303,7 @@
|
|
|
12290
12303
|
update2.clear = internalOnClosed;
|
|
12291
12304
|
update2.config = React.useCallback(
|
|
12292
12305
|
(nextState) => {
|
|
12306
|
+
console.log("update.config called:", nextState);
|
|
12293
12307
|
setState(
|
|
12294
12308
|
(prev2) => typeof nextState === "function" ? { ...prev2, ...nextState(prev2) } : { ...prev2, ...nextState }
|
|
12295
12309
|
);
|
|
@@ -12297,7 +12311,7 @@
|
|
|
12297
12311
|
[setState]
|
|
12298
12312
|
);
|
|
12299
12313
|
useIsomorphicLayoutEffect$1(() => {
|
|
12300
|
-
console.log("useIsomorphicLayoutEffect");
|
|
12314
|
+
console.log("useIsomorphicLayoutEffect called");
|
|
12301
12315
|
setVisible(true);
|
|
12302
12316
|
if (!allowMultiple)
|
|
12303
12317
|
syncClear();
|
|
@@ -12319,24 +12333,27 @@
|
|
|
12319
12333
|
onClosed: internalOnClosed
|
|
12320
12334
|
});
|
|
12321
12335
|
};
|
|
12336
|
+
console.log("Before render(<TempToast />)");
|
|
12322
12337
|
render(/* @__PURE__ */ React__default["default"].createElement(TempToast, null), container);
|
|
12323
|
-
console.log("render(<TempToast
|
|
12324
|
-
|
|
12325
|
-
return update2;
|
|
12326
|
-
}, 300);
|
|
12338
|
+
console.log("After render(<TempToast />)");
|
|
12339
|
+
return update2;
|
|
12327
12340
|
};
|
|
12328
12341
|
function parseOptions(message) {
|
|
12342
|
+
console.log("parseOptions called:", message);
|
|
12329
12343
|
if (isObject$1(message)) {
|
|
12330
12344
|
return message;
|
|
12331
12345
|
}
|
|
12332
12346
|
return { message };
|
|
12333
12347
|
}
|
|
12334
|
-
const createMethod = (type2) => (options) =>
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12348
|
+
const createMethod = (type2) => (options) => {
|
|
12349
|
+
console.log("createMethod called:", type2, options);
|
|
12350
|
+
return ToastObj({
|
|
12351
|
+
...currentOptions,
|
|
12352
|
+
...defaultOptionsMap.get(type2),
|
|
12353
|
+
...parseOptions(options),
|
|
12354
|
+
type: type2
|
|
12355
|
+
});
|
|
12356
|
+
};
|
|
12340
12357
|
["info", "loading", "success", "fail"].forEach((method2) => {
|
|
12341
12358
|
ToastObj[method2] = createMethod(method2);
|
|
12342
12359
|
});
|