@tonconnect/ui 2.3.0-beta.0 → 2.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tonconnect-ui.min.js +239 -239
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +112 -55
- package/lib/index.cjs.map +1 -1
- package/lib/index.mjs +112 -55
- package/lib/index.mjs.map +1 -1
- package/package.json +9 -14
package/lib/index.cjs
CHANGED
|
@@ -95,7 +95,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
95
95
|
owned: null,
|
|
96
96
|
cleanups: null,
|
|
97
97
|
context: null,
|
|
98
|
-
owner: detachedOwner
|
|
98
|
+
owner: detachedOwner || owner
|
|
99
99
|
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
100
100
|
Owner = root;
|
|
101
101
|
Listener = null;
|
|
@@ -185,9 +185,9 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
185
185
|
}
|
|
186
186
|
function completeLoad(v, err) {
|
|
187
187
|
runUpdates(() => {
|
|
188
|
-
if (err
|
|
188
|
+
if (!err)
|
|
189
189
|
setValue(() => v);
|
|
190
|
-
setState(err
|
|
190
|
+
setState(err ? "errored" : "ready");
|
|
191
191
|
setError(err);
|
|
192
192
|
for (const c2 of contexts.keys())
|
|
193
193
|
c2.decrement();
|
|
@@ -196,7 +196,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
196
196
|
}
|
|
197
197
|
function read() {
|
|
198
198
|
const c2 = SuspenseContext, v = value(), err = error();
|
|
199
|
-
if (err
|
|
199
|
+
if (err && !pr)
|
|
200
200
|
throw err;
|
|
201
201
|
if (Listener && !Listener.user && c2) {
|
|
202
202
|
createComputed(() => {
|
|
@@ -276,8 +276,6 @@ function batch(fn) {
|
|
|
276
276
|
return runUpdates(fn, false);
|
|
277
277
|
}
|
|
278
278
|
function untrack(fn) {
|
|
279
|
-
if (Listener === null)
|
|
280
|
-
return fn();
|
|
281
279
|
const listener = Listener;
|
|
282
280
|
Listener = null;
|
|
283
281
|
try {
|
|
@@ -512,9 +510,8 @@ function runUpdates(fn, init) {
|
|
|
512
510
|
completeUpdates(wait);
|
|
513
511
|
return res;
|
|
514
512
|
} catch (err) {
|
|
515
|
-
if (!
|
|
513
|
+
if (!Updates)
|
|
516
514
|
Effects = null;
|
|
517
|
-
Updates = null;
|
|
518
515
|
handleError(err);
|
|
519
516
|
}
|
|
520
517
|
}
|
|
@@ -7313,18 +7310,18 @@ const NotificationsStyled = styled(Notifications)`
|
|
|
7313
7310
|
margin-top: 20px;
|
|
7314
7311
|
}
|
|
7315
7312
|
`;
|
|
7316
|
-
function getSide(placement) {
|
|
7317
|
-
return placement.split("-")[0];
|
|
7318
|
-
}
|
|
7319
7313
|
function getAlignment(placement) {
|
|
7320
7314
|
return placement.split("-")[1];
|
|
7321
7315
|
}
|
|
7322
|
-
function getMainAxisFromPlacement(placement) {
|
|
7323
|
-
return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
|
|
7324
|
-
}
|
|
7325
7316
|
function getLengthFromAxis(axis) {
|
|
7326
7317
|
return axis === "y" ? "height" : "width";
|
|
7327
7318
|
}
|
|
7319
|
+
function getSide(placement) {
|
|
7320
|
+
return placement.split("-")[0];
|
|
7321
|
+
}
|
|
7322
|
+
function getMainAxisFromPlacement(placement) {
|
|
7323
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
|
|
7324
|
+
}
|
|
7328
7325
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
7329
7326
|
let {
|
|
7330
7327
|
reference,
|
|
@@ -7564,14 +7561,14 @@ const max$1 = Math.max;
|
|
|
7564
7561
|
function within(min$1$1, value, max$1$1) {
|
|
7565
7562
|
return max$1(min$1$1, min$1(value, max$1$1));
|
|
7566
7563
|
}
|
|
7567
|
-
const
|
|
7564
|
+
const oppositeSideMap = {
|
|
7568
7565
|
left: "right",
|
|
7569
7566
|
right: "left",
|
|
7570
7567
|
bottom: "top",
|
|
7571
7568
|
top: "bottom"
|
|
7572
7569
|
};
|
|
7573
7570
|
function getOppositePlacement(placement) {
|
|
7574
|
-
return placement.replace(/left|right|bottom|top/g, (
|
|
7571
|
+
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
7575
7572
|
}
|
|
7576
7573
|
function getAlignmentSides(placement, rects, rtl) {
|
|
7577
7574
|
if (rtl === void 0) {
|
|
@@ -7589,17 +7586,46 @@ function getAlignmentSides(placement, rects, rtl) {
|
|
|
7589
7586
|
cross: getOppositePlacement(mainAlignmentSide)
|
|
7590
7587
|
};
|
|
7591
7588
|
}
|
|
7592
|
-
const
|
|
7589
|
+
const oppositeAlignmentMap = {
|
|
7593
7590
|
start: "end",
|
|
7594
7591
|
end: "start"
|
|
7595
7592
|
};
|
|
7596
7593
|
function getOppositeAlignmentPlacement(placement) {
|
|
7597
|
-
return placement.replace(/start|end/g, (
|
|
7594
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
7598
7595
|
}
|
|
7599
7596
|
function getExpandedPlacements(placement) {
|
|
7600
7597
|
const oppositePlacement = getOppositePlacement(placement);
|
|
7601
7598
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
7602
7599
|
}
|
|
7600
|
+
function getSideList(side, isStart, rtl) {
|
|
7601
|
+
const lr = ["left", "right"];
|
|
7602
|
+
const rl = ["right", "left"];
|
|
7603
|
+
const tb = ["top", "bottom"];
|
|
7604
|
+
const bt = ["bottom", "top"];
|
|
7605
|
+
switch (side) {
|
|
7606
|
+
case "top":
|
|
7607
|
+
case "bottom":
|
|
7608
|
+
if (rtl)
|
|
7609
|
+
return isStart ? rl : lr;
|
|
7610
|
+
return isStart ? lr : rl;
|
|
7611
|
+
case "left":
|
|
7612
|
+
case "right":
|
|
7613
|
+
return isStart ? tb : bt;
|
|
7614
|
+
default:
|
|
7615
|
+
return [];
|
|
7616
|
+
}
|
|
7617
|
+
}
|
|
7618
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
7619
|
+
const alignment = getAlignment(placement);
|
|
7620
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
7621
|
+
if (alignment) {
|
|
7622
|
+
list = list.map((side) => side + "-" + alignment);
|
|
7623
|
+
if (flipAlignment) {
|
|
7624
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
7625
|
+
}
|
|
7626
|
+
}
|
|
7627
|
+
return list;
|
|
7628
|
+
}
|
|
7603
7629
|
const flip = function(options) {
|
|
7604
7630
|
if (options === void 0) {
|
|
7605
7631
|
options = {};
|
|
@@ -7623,17 +7649,23 @@ const flip = function(options) {
|
|
|
7623
7649
|
crossAxis: checkCrossAxis = true,
|
|
7624
7650
|
fallbackPlacements: specifiedFallbackPlacements,
|
|
7625
7651
|
fallbackStrategy = "bestFit",
|
|
7652
|
+
fallbackAxisSideDirection = "none",
|
|
7626
7653
|
flipAlignment = true
|
|
7627
7654
|
} = _a3, detectOverflowOptions = __objRest(_a3, [
|
|
7628
7655
|
"mainAxis",
|
|
7629
7656
|
"crossAxis",
|
|
7630
7657
|
"fallbackPlacements",
|
|
7631
7658
|
"fallbackStrategy",
|
|
7659
|
+
"fallbackAxisSideDirection",
|
|
7632
7660
|
"flipAlignment"
|
|
7633
7661
|
]);
|
|
7634
7662
|
const side = getSide(placement);
|
|
7635
|
-
const isBasePlacement =
|
|
7663
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
7664
|
+
const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating);
|
|
7636
7665
|
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
7666
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
|
|
7667
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
7668
|
+
}
|
|
7637
7669
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
7638
7670
|
const overflow = yield detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
7639
7671
|
const overflows = [];
|
|
@@ -7645,7 +7677,7 @@ const flip = function(options) {
|
|
|
7645
7677
|
const {
|
|
7646
7678
|
main,
|
|
7647
7679
|
cross
|
|
7648
|
-
} = getAlignmentSides(placement, rects,
|
|
7680
|
+
} = getAlignmentSides(placement, rects, rtl);
|
|
7649
7681
|
overflows.push(overflow[main], overflow[cross]);
|
|
7650
7682
|
}
|
|
7651
7683
|
overflowsData = [...overflowsData, {
|
|
@@ -7653,8 +7685,8 @@ const flip = function(options) {
|
|
|
7653
7685
|
overflows
|
|
7654
7686
|
}];
|
|
7655
7687
|
if (!overflows.every((side2) => side2 <= 0)) {
|
|
7656
|
-
var _middlewareData$
|
|
7657
|
-
const nextIndex = ((
|
|
7688
|
+
var _middlewareData$flip2;
|
|
7689
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
7658
7690
|
const nextPlacement = placements[nextIndex];
|
|
7659
7691
|
if (nextPlacement) {
|
|
7660
7692
|
return {
|
|
@@ -7813,7 +7845,7 @@ function isOverflowElement(element) {
|
|
|
7813
7845
|
overflowY,
|
|
7814
7846
|
display
|
|
7815
7847
|
} = getComputedStyle$1(element);
|
|
7816
|
-
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
7848
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
7817
7849
|
}
|
|
7818
7850
|
function isTableElement(element) {
|
|
7819
7851
|
return ["table", "td", "th"].includes(getNodeName(element));
|
|
@@ -7838,28 +7870,43 @@ function isLastTraversableNode(node) {
|
|
|
7838
7870
|
const min = Math.min;
|
|
7839
7871
|
const max = Math.max;
|
|
7840
7872
|
const round = Math.round;
|
|
7873
|
+
function getCssDimensions(element) {
|
|
7874
|
+
const css = getComputedStyle$1(element);
|
|
7875
|
+
let width = parseFloat(css.width);
|
|
7876
|
+
let height = parseFloat(css.height);
|
|
7877
|
+
const offsetWidth = element.offsetWidth;
|
|
7878
|
+
const offsetHeight = element.offsetHeight;
|
|
7879
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
7880
|
+
if (shouldFallback) {
|
|
7881
|
+
width = offsetWidth;
|
|
7882
|
+
height = offsetHeight;
|
|
7883
|
+
}
|
|
7884
|
+
return {
|
|
7885
|
+
width,
|
|
7886
|
+
height,
|
|
7887
|
+
fallback: shouldFallback
|
|
7888
|
+
};
|
|
7889
|
+
}
|
|
7890
|
+
function unwrapElement(element) {
|
|
7891
|
+
return !isElement(element) ? element.contextElement : element;
|
|
7892
|
+
}
|
|
7841
7893
|
const FALLBACK_SCALE = {
|
|
7842
7894
|
x: 1,
|
|
7843
7895
|
y: 1
|
|
7844
7896
|
};
|
|
7845
7897
|
function getScale(element) {
|
|
7846
|
-
const domElement =
|
|
7847
|
-
if (!domElement) {
|
|
7898
|
+
const domElement = unwrapElement(element);
|
|
7899
|
+
if (!isHTMLElement(domElement)) {
|
|
7848
7900
|
return FALLBACK_SCALE;
|
|
7849
7901
|
}
|
|
7850
7902
|
const rect = domElement.getBoundingClientRect();
|
|
7851
|
-
const
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
y: domElement.offsetHeight > 0 ? round(rect.height) / domElement.offsetHeight || 1 : 1
|
|
7859
|
-
};
|
|
7860
|
-
}
|
|
7861
|
-
let x = rect.width / parseFloat(css.width);
|
|
7862
|
-
let y = rect.height / parseFloat(css.height);
|
|
7903
|
+
const {
|
|
7904
|
+
width,
|
|
7905
|
+
height,
|
|
7906
|
+
fallback
|
|
7907
|
+
} = getCssDimensions(domElement);
|
|
7908
|
+
let x = (fallback ? round(rect.width) : rect.width) / width;
|
|
7909
|
+
let y = (fallback ? round(rect.height) : rect.height) / height;
|
|
7863
7910
|
if (!x || !Number.isFinite(x)) {
|
|
7864
7911
|
x = 1;
|
|
7865
7912
|
}
|
|
@@ -7872,7 +7919,7 @@ function getScale(element) {
|
|
|
7872
7919
|
};
|
|
7873
7920
|
}
|
|
7874
7921
|
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
7875
|
-
var _win$visualViewport
|
|
7922
|
+
var _win$visualViewport, _win$visualViewport2;
|
|
7876
7923
|
if (includeScale === void 0) {
|
|
7877
7924
|
includeScale = false;
|
|
7878
7925
|
}
|
|
@@ -7880,6 +7927,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
7880
7927
|
isFixedStrategy = false;
|
|
7881
7928
|
}
|
|
7882
7929
|
const clientRect = element.getBoundingClientRect();
|
|
7930
|
+
const domElement = unwrapElement(element);
|
|
7883
7931
|
let scale = FALLBACK_SCALE;
|
|
7884
7932
|
if (includeScale) {
|
|
7885
7933
|
if (offsetParent) {
|
|
@@ -7890,12 +7938,31 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
7890
7938
|
scale = getScale(element);
|
|
7891
7939
|
}
|
|
7892
7940
|
}
|
|
7893
|
-
const win =
|
|
7941
|
+
const win = domElement ? getWindow(domElement) : window;
|
|
7894
7942
|
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7943
|
+
let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
|
|
7944
|
+
let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
|
|
7945
|
+
let width = clientRect.width / scale.x;
|
|
7946
|
+
let height = clientRect.height / scale.y;
|
|
7947
|
+
if (domElement) {
|
|
7948
|
+
const win2 = getWindow(domElement);
|
|
7949
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
7950
|
+
let currentIFrame = win2.frameElement;
|
|
7951
|
+
while (currentIFrame && offsetParent && offsetWin !== win2) {
|
|
7952
|
+
const iframeScale = getScale(currentIFrame);
|
|
7953
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
7954
|
+
const css = getComputedStyle(currentIFrame);
|
|
7955
|
+
iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
7956
|
+
iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
7957
|
+
x *= iframeScale.x;
|
|
7958
|
+
y *= iframeScale.y;
|
|
7959
|
+
width *= iframeScale.x;
|
|
7960
|
+
height *= iframeScale.y;
|
|
7961
|
+
x += iframeRect.x;
|
|
7962
|
+
y += iframeRect.y;
|
|
7963
|
+
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
7964
|
+
}
|
|
7965
|
+
}
|
|
7899
7966
|
return {
|
|
7900
7967
|
width,
|
|
7901
7968
|
height,
|
|
@@ -7992,17 +8059,7 @@ function getOffsetParent(element) {
|
|
|
7992
8059
|
return offsetParent || getContainingBlock(element) || window2;
|
|
7993
8060
|
}
|
|
7994
8061
|
function getDimensions(element) {
|
|
7995
|
-
|
|
7996
|
-
return {
|
|
7997
|
-
width: element.offsetWidth,
|
|
7998
|
-
height: element.offsetHeight
|
|
7999
|
-
};
|
|
8000
|
-
}
|
|
8001
|
-
const rect = getBoundingClientRect(element);
|
|
8002
|
-
return {
|
|
8003
|
-
width: rect.width,
|
|
8004
|
-
height: rect.height
|
|
8005
|
-
};
|
|
8062
|
+
return getCssDimensions(element);
|
|
8006
8063
|
}
|
|
8007
8064
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
8008
8065
|
let {
|
|
@@ -12453,7 +12510,7 @@ class TonConnectUITracker {
|
|
|
12453
12510
|
}
|
|
12454
12511
|
}
|
|
12455
12512
|
}
|
|
12456
|
-
const tonConnectUiVersion = "2.3.0-beta.
|
|
12513
|
+
const tonConnectUiVersion = "2.3.0-beta.1";
|
|
12457
12514
|
class TonConnectUI {
|
|
12458
12515
|
constructor(options) {
|
|
12459
12516
|
__publicField(this, "walletInfoStorage", new WalletInfoStorage());
|