@tonconnect/ui 2.2.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/README.md +122 -0
- package/dist/tonconnect-ui.min.js +239 -239
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +441 -57
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.mjs +441 -57
- package/lib/index.mjs.map +1 -1
- package/package.json +9 -14
package/lib/index.mjs
CHANGED
|
@@ -17,6 +17,18 @@ var __spreadValues = (a2, b) => {
|
|
|
17
17
|
return a2;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
var __publicField = (obj, key, value) => {
|
|
21
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
34
|
return value;
|
|
@@ -78,7 +90,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
78
90
|
owned: null,
|
|
79
91
|
cleanups: null,
|
|
80
92
|
context: null,
|
|
81
|
-
owner: detachedOwner
|
|
93
|
+
owner: detachedOwner || owner
|
|
82
94
|
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
83
95
|
Owner = root;
|
|
84
96
|
Listener = null;
|
|
@@ -168,9 +180,9 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
168
180
|
}
|
|
169
181
|
function completeLoad(v, err) {
|
|
170
182
|
runUpdates(() => {
|
|
171
|
-
if (err
|
|
183
|
+
if (!err)
|
|
172
184
|
setValue(() => v);
|
|
173
|
-
setState(err
|
|
185
|
+
setState(err ? "errored" : "ready");
|
|
174
186
|
setError(err);
|
|
175
187
|
for (const c2 of contexts.keys())
|
|
176
188
|
c2.decrement();
|
|
@@ -179,7 +191,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
179
191
|
}
|
|
180
192
|
function read() {
|
|
181
193
|
const c2 = SuspenseContext, v = value(), err = error();
|
|
182
|
-
if (err
|
|
194
|
+
if (err && !pr)
|
|
183
195
|
throw err;
|
|
184
196
|
if (Listener && !Listener.user && c2) {
|
|
185
197
|
createComputed(() => {
|
|
@@ -259,8 +271,6 @@ function batch(fn) {
|
|
|
259
271
|
return runUpdates(fn, false);
|
|
260
272
|
}
|
|
261
273
|
function untrack(fn) {
|
|
262
|
-
if (Listener === null)
|
|
263
|
-
return fn();
|
|
264
274
|
const listener = Listener;
|
|
265
275
|
Listener = null;
|
|
266
276
|
try {
|
|
@@ -495,9 +505,8 @@ function runUpdates(fn, init) {
|
|
|
495
505
|
completeUpdates(wait);
|
|
496
506
|
return res;
|
|
497
507
|
} catch (err) {
|
|
498
|
-
if (!
|
|
508
|
+
if (!Updates)
|
|
499
509
|
Effects = null;
|
|
500
|
-
Updates = null;
|
|
501
510
|
handleError(err);
|
|
502
511
|
}
|
|
503
512
|
}
|
|
@@ -1820,8 +1829,10 @@ function fixMobileSafariActiveTransition() {
|
|
|
1820
1829
|
}
|
|
1821
1830
|
}
|
|
1822
1831
|
function defineStylesRoot() {
|
|
1823
|
-
customElements.
|
|
1824
|
-
|
|
1832
|
+
if (!customElements.get("tc-root")) {
|
|
1833
|
+
customElements.define(globalStylesTag, class TcRootElement extends HTMLElement {
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1825
1836
|
}
|
|
1826
1837
|
function createMacrotask(callback) {
|
|
1827
1838
|
return __async(this, null, function* () {
|
|
@@ -3029,6 +3040,7 @@ function useDataAttributes(props) {
|
|
|
3029
3040
|
const Button = (props) => {
|
|
3030
3041
|
const dataAttrs = useDataAttributes(props);
|
|
3031
3042
|
return createComponent(ButtonStyled$1, mergeProps({
|
|
3043
|
+
type: "button",
|
|
3032
3044
|
get appearance() {
|
|
3033
3045
|
return props.appearance || "primary";
|
|
3034
3046
|
},
|
|
@@ -4910,16 +4922,16 @@ var qrcode$1 = { exports: {} };
|
|
|
4910
4922
|
};
|
|
4911
4923
|
return _this;
|
|
4912
4924
|
}();
|
|
4913
|
-
function qrPolynomial(num,
|
|
4925
|
+
function qrPolynomial(num, shift2) {
|
|
4914
4926
|
if (typeof num.length == "undefined") {
|
|
4915
|
-
throw num.length + "/" +
|
|
4927
|
+
throw num.length + "/" + shift2;
|
|
4916
4928
|
}
|
|
4917
4929
|
var _num = function() {
|
|
4918
4930
|
var offset = 0;
|
|
4919
4931
|
while (offset < num.length && num[offset] == 0) {
|
|
4920
4932
|
offset += 1;
|
|
4921
4933
|
}
|
|
4922
|
-
var _num2 = new Array(num.length - offset +
|
|
4934
|
+
var _num2 = new Array(num.length - offset + shift2);
|
|
4923
4935
|
for (var i2 = 0; i2 < num.length - offset; i2 += 1) {
|
|
4924
4936
|
_num2[i2] = num[i2 + offset];
|
|
4925
4937
|
}
|
|
@@ -7293,18 +7305,18 @@ const NotificationsStyled = styled(Notifications)`
|
|
|
7293
7305
|
margin-top: 20px;
|
|
7294
7306
|
}
|
|
7295
7307
|
`;
|
|
7296
|
-
function getSide(placement) {
|
|
7297
|
-
return placement.split("-")[0];
|
|
7298
|
-
}
|
|
7299
7308
|
function getAlignment(placement) {
|
|
7300
7309
|
return placement.split("-")[1];
|
|
7301
7310
|
}
|
|
7302
|
-
function getMainAxisFromPlacement(placement) {
|
|
7303
|
-
return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
|
|
7304
|
-
}
|
|
7305
7311
|
function getLengthFromAxis(axis) {
|
|
7306
7312
|
return axis === "y" ? "height" : "width";
|
|
7307
7313
|
}
|
|
7314
|
+
function getSide(placement) {
|
|
7315
|
+
return placement.split("-")[0];
|
|
7316
|
+
}
|
|
7317
|
+
function getMainAxisFromPlacement(placement) {
|
|
7318
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
|
|
7319
|
+
}
|
|
7308
7320
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
7309
7321
|
let {
|
|
7310
7322
|
reference,
|
|
@@ -7460,6 +7472,22 @@ const computePosition$1 = (reference, floating, config) => __async(void 0, null,
|
|
|
7460
7472
|
middlewareData
|
|
7461
7473
|
};
|
|
7462
7474
|
});
|
|
7475
|
+
function expandPaddingObject(padding) {
|
|
7476
|
+
return __spreadValues({
|
|
7477
|
+
top: 0,
|
|
7478
|
+
right: 0,
|
|
7479
|
+
bottom: 0,
|
|
7480
|
+
left: 0
|
|
7481
|
+
}, padding);
|
|
7482
|
+
}
|
|
7483
|
+
function getSideObjectFromPadding(padding) {
|
|
7484
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
7485
|
+
top: padding,
|
|
7486
|
+
right: padding,
|
|
7487
|
+
bottom: padding,
|
|
7488
|
+
left: padding
|
|
7489
|
+
};
|
|
7490
|
+
}
|
|
7463
7491
|
function rectToClientRect(rect) {
|
|
7464
7492
|
return __spreadProps(__spreadValues({}, rect), {
|
|
7465
7493
|
top: rect.y,
|
|
@@ -7468,6 +7496,305 @@ function rectToClientRect(rect) {
|
|
|
7468
7496
|
bottom: rect.y + rect.height
|
|
7469
7497
|
});
|
|
7470
7498
|
}
|
|
7499
|
+
function detectOverflow(middlewareArguments, options) {
|
|
7500
|
+
return __async(this, null, function* () {
|
|
7501
|
+
var _await$platform$isEle;
|
|
7502
|
+
if (options === void 0) {
|
|
7503
|
+
options = {};
|
|
7504
|
+
}
|
|
7505
|
+
const {
|
|
7506
|
+
x,
|
|
7507
|
+
y,
|
|
7508
|
+
platform: platform2,
|
|
7509
|
+
rects,
|
|
7510
|
+
elements,
|
|
7511
|
+
strategy
|
|
7512
|
+
} = middlewareArguments;
|
|
7513
|
+
const {
|
|
7514
|
+
boundary = "clippingAncestors",
|
|
7515
|
+
rootBoundary = "viewport",
|
|
7516
|
+
elementContext = "floating",
|
|
7517
|
+
altBoundary = false,
|
|
7518
|
+
padding = 0
|
|
7519
|
+
} = options;
|
|
7520
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
7521
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
7522
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
7523
|
+
const clippingClientRect = rectToClientRect(yield platform2.getClippingRect({
|
|
7524
|
+
element: ((_await$platform$isEle = yield platform2.isElement == null ? void 0 : platform2.isElement(element)) != null ? _await$platform$isEle : true) ? element : element.contextElement || (yield platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
7525
|
+
boundary,
|
|
7526
|
+
rootBoundary,
|
|
7527
|
+
strategy
|
|
7528
|
+
}));
|
|
7529
|
+
const rect = elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
|
|
7530
|
+
x,
|
|
7531
|
+
y
|
|
7532
|
+
}) : rects.reference;
|
|
7533
|
+
const offsetParent = yield platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating);
|
|
7534
|
+
const offsetScale = (yield platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? (yield platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
7535
|
+
x: 1,
|
|
7536
|
+
y: 1
|
|
7537
|
+
} : {
|
|
7538
|
+
x: 1,
|
|
7539
|
+
y: 1
|
|
7540
|
+
};
|
|
7541
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? yield platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
7542
|
+
rect,
|
|
7543
|
+
offsetParent,
|
|
7544
|
+
strategy
|
|
7545
|
+
}) : rect);
|
|
7546
|
+
return {
|
|
7547
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
7548
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
7549
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
7550
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
7551
|
+
};
|
|
7552
|
+
});
|
|
7553
|
+
}
|
|
7554
|
+
const min$1 = Math.min;
|
|
7555
|
+
const max$1 = Math.max;
|
|
7556
|
+
function within(min$1$1, value, max$1$1) {
|
|
7557
|
+
return max$1(min$1$1, min$1(value, max$1$1));
|
|
7558
|
+
}
|
|
7559
|
+
const oppositeSideMap = {
|
|
7560
|
+
left: "right",
|
|
7561
|
+
right: "left",
|
|
7562
|
+
bottom: "top",
|
|
7563
|
+
top: "bottom"
|
|
7564
|
+
};
|
|
7565
|
+
function getOppositePlacement(placement) {
|
|
7566
|
+
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
7567
|
+
}
|
|
7568
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
7569
|
+
if (rtl === void 0) {
|
|
7570
|
+
rtl = false;
|
|
7571
|
+
}
|
|
7572
|
+
const alignment = getAlignment(placement);
|
|
7573
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
7574
|
+
const length = getLengthFromAxis(mainAxis);
|
|
7575
|
+
let mainAlignmentSide = mainAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
7576
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
7577
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
7578
|
+
}
|
|
7579
|
+
return {
|
|
7580
|
+
main: mainAlignmentSide,
|
|
7581
|
+
cross: getOppositePlacement(mainAlignmentSide)
|
|
7582
|
+
};
|
|
7583
|
+
}
|
|
7584
|
+
const oppositeAlignmentMap = {
|
|
7585
|
+
start: "end",
|
|
7586
|
+
end: "start"
|
|
7587
|
+
};
|
|
7588
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
7589
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
7590
|
+
}
|
|
7591
|
+
function getExpandedPlacements(placement) {
|
|
7592
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
7593
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
7594
|
+
}
|
|
7595
|
+
function getSideList(side, isStart, rtl) {
|
|
7596
|
+
const lr = ["left", "right"];
|
|
7597
|
+
const rl = ["right", "left"];
|
|
7598
|
+
const tb = ["top", "bottom"];
|
|
7599
|
+
const bt = ["bottom", "top"];
|
|
7600
|
+
switch (side) {
|
|
7601
|
+
case "top":
|
|
7602
|
+
case "bottom":
|
|
7603
|
+
if (rtl)
|
|
7604
|
+
return isStart ? rl : lr;
|
|
7605
|
+
return isStart ? lr : rl;
|
|
7606
|
+
case "left":
|
|
7607
|
+
case "right":
|
|
7608
|
+
return isStart ? tb : bt;
|
|
7609
|
+
default:
|
|
7610
|
+
return [];
|
|
7611
|
+
}
|
|
7612
|
+
}
|
|
7613
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
7614
|
+
const alignment = getAlignment(placement);
|
|
7615
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
7616
|
+
if (alignment) {
|
|
7617
|
+
list = list.map((side) => side + "-" + alignment);
|
|
7618
|
+
if (flipAlignment) {
|
|
7619
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
7620
|
+
}
|
|
7621
|
+
}
|
|
7622
|
+
return list;
|
|
7623
|
+
}
|
|
7624
|
+
const flip = function(options) {
|
|
7625
|
+
if (options === void 0) {
|
|
7626
|
+
options = {};
|
|
7627
|
+
}
|
|
7628
|
+
return {
|
|
7629
|
+
name: "flip",
|
|
7630
|
+
options,
|
|
7631
|
+
fn(middlewareArguments) {
|
|
7632
|
+
return __async(this, null, function* () {
|
|
7633
|
+
var _middlewareData$flip;
|
|
7634
|
+
const {
|
|
7635
|
+
placement,
|
|
7636
|
+
middlewareData,
|
|
7637
|
+
rects,
|
|
7638
|
+
initialPlacement,
|
|
7639
|
+
platform: platform2,
|
|
7640
|
+
elements
|
|
7641
|
+
} = middlewareArguments;
|
|
7642
|
+
const _a3 = options, {
|
|
7643
|
+
mainAxis: checkMainAxis = true,
|
|
7644
|
+
crossAxis: checkCrossAxis = true,
|
|
7645
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
7646
|
+
fallbackStrategy = "bestFit",
|
|
7647
|
+
fallbackAxisSideDirection = "none",
|
|
7648
|
+
flipAlignment = true
|
|
7649
|
+
} = _a3, detectOverflowOptions = __objRest(_a3, [
|
|
7650
|
+
"mainAxis",
|
|
7651
|
+
"crossAxis",
|
|
7652
|
+
"fallbackPlacements",
|
|
7653
|
+
"fallbackStrategy",
|
|
7654
|
+
"fallbackAxisSideDirection",
|
|
7655
|
+
"flipAlignment"
|
|
7656
|
+
]);
|
|
7657
|
+
const side = getSide(placement);
|
|
7658
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
7659
|
+
const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating);
|
|
7660
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
7661
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
|
|
7662
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
7663
|
+
}
|
|
7664
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
7665
|
+
const overflow = yield detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
7666
|
+
const overflows = [];
|
|
7667
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
7668
|
+
if (checkMainAxis) {
|
|
7669
|
+
overflows.push(overflow[side]);
|
|
7670
|
+
}
|
|
7671
|
+
if (checkCrossAxis) {
|
|
7672
|
+
const {
|
|
7673
|
+
main,
|
|
7674
|
+
cross
|
|
7675
|
+
} = getAlignmentSides(placement, rects, rtl);
|
|
7676
|
+
overflows.push(overflow[main], overflow[cross]);
|
|
7677
|
+
}
|
|
7678
|
+
overflowsData = [...overflowsData, {
|
|
7679
|
+
placement,
|
|
7680
|
+
overflows
|
|
7681
|
+
}];
|
|
7682
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
7683
|
+
var _middlewareData$flip2;
|
|
7684
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
7685
|
+
const nextPlacement = placements[nextIndex];
|
|
7686
|
+
if (nextPlacement) {
|
|
7687
|
+
return {
|
|
7688
|
+
data: {
|
|
7689
|
+
index: nextIndex,
|
|
7690
|
+
overflows: overflowsData
|
|
7691
|
+
},
|
|
7692
|
+
reset: {
|
|
7693
|
+
placement: nextPlacement
|
|
7694
|
+
}
|
|
7695
|
+
};
|
|
7696
|
+
}
|
|
7697
|
+
let resetPlacement = "bottom";
|
|
7698
|
+
switch (fallbackStrategy) {
|
|
7699
|
+
case "bestFit": {
|
|
7700
|
+
var _overflowsData$map$so;
|
|
7701
|
+
const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b) => a2[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
|
|
7702
|
+
if (placement2) {
|
|
7703
|
+
resetPlacement = placement2;
|
|
7704
|
+
}
|
|
7705
|
+
break;
|
|
7706
|
+
}
|
|
7707
|
+
case "initialPlacement":
|
|
7708
|
+
resetPlacement = initialPlacement;
|
|
7709
|
+
break;
|
|
7710
|
+
}
|
|
7711
|
+
if (placement !== resetPlacement) {
|
|
7712
|
+
return {
|
|
7713
|
+
reset: {
|
|
7714
|
+
placement: resetPlacement
|
|
7715
|
+
}
|
|
7716
|
+
};
|
|
7717
|
+
}
|
|
7718
|
+
}
|
|
7719
|
+
return {};
|
|
7720
|
+
});
|
|
7721
|
+
}
|
|
7722
|
+
};
|
|
7723
|
+
};
|
|
7724
|
+
function getCrossAxis(axis) {
|
|
7725
|
+
return axis === "x" ? "y" : "x";
|
|
7726
|
+
}
|
|
7727
|
+
const shift = function(options) {
|
|
7728
|
+
if (options === void 0) {
|
|
7729
|
+
options = {};
|
|
7730
|
+
}
|
|
7731
|
+
return {
|
|
7732
|
+
name: "shift",
|
|
7733
|
+
options,
|
|
7734
|
+
fn(middlewareArguments) {
|
|
7735
|
+
return __async(this, null, function* () {
|
|
7736
|
+
const {
|
|
7737
|
+
x,
|
|
7738
|
+
y,
|
|
7739
|
+
placement
|
|
7740
|
+
} = middlewareArguments;
|
|
7741
|
+
const _a3 = options, {
|
|
7742
|
+
mainAxis: checkMainAxis = true,
|
|
7743
|
+
crossAxis: checkCrossAxis = false,
|
|
7744
|
+
limiter = {
|
|
7745
|
+
fn: (_ref) => {
|
|
7746
|
+
let {
|
|
7747
|
+
x: x2,
|
|
7748
|
+
y: y2
|
|
7749
|
+
} = _ref;
|
|
7750
|
+
return {
|
|
7751
|
+
x: x2,
|
|
7752
|
+
y: y2
|
|
7753
|
+
};
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
} = _a3, detectOverflowOptions = __objRest(_a3, [
|
|
7757
|
+
"mainAxis",
|
|
7758
|
+
"crossAxis",
|
|
7759
|
+
"limiter"
|
|
7760
|
+
]);
|
|
7761
|
+
const coords = {
|
|
7762
|
+
x,
|
|
7763
|
+
y
|
|
7764
|
+
};
|
|
7765
|
+
const overflow = yield detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
7766
|
+
const mainAxis = getMainAxisFromPlacement(getSide(placement));
|
|
7767
|
+
const crossAxis = getCrossAxis(mainAxis);
|
|
7768
|
+
let mainAxisCoord = coords[mainAxis];
|
|
7769
|
+
let crossAxisCoord = coords[crossAxis];
|
|
7770
|
+
if (checkMainAxis) {
|
|
7771
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
7772
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
7773
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
7774
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
7775
|
+
mainAxisCoord = within(min2, mainAxisCoord, max2);
|
|
7776
|
+
}
|
|
7777
|
+
if (checkCrossAxis) {
|
|
7778
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
7779
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
7780
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
7781
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
7782
|
+
crossAxisCoord = within(min2, crossAxisCoord, max2);
|
|
7783
|
+
}
|
|
7784
|
+
const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, middlewareArguments), {
|
|
7785
|
+
[mainAxis]: mainAxisCoord,
|
|
7786
|
+
[crossAxis]: crossAxisCoord
|
|
7787
|
+
}));
|
|
7788
|
+
return __spreadProps(__spreadValues({}, limitedCoords), {
|
|
7789
|
+
data: {
|
|
7790
|
+
x: limitedCoords.x - x,
|
|
7791
|
+
y: limitedCoords.y - y
|
|
7792
|
+
}
|
|
7793
|
+
});
|
|
7794
|
+
});
|
|
7795
|
+
}
|
|
7796
|
+
};
|
|
7797
|
+
};
|
|
7471
7798
|
function getWindow(node) {
|
|
7472
7799
|
var _node$ownerDocument;
|
|
7473
7800
|
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
@@ -7513,7 +7840,7 @@ function isOverflowElement(element) {
|
|
|
7513
7840
|
overflowY,
|
|
7514
7841
|
display
|
|
7515
7842
|
} = getComputedStyle$1(element);
|
|
7516
|
-
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
7843
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
7517
7844
|
}
|
|
7518
7845
|
function isTableElement(element) {
|
|
7519
7846
|
return ["table", "td", "th"].includes(getNodeName(element));
|
|
@@ -7538,28 +7865,43 @@ function isLastTraversableNode(node) {
|
|
|
7538
7865
|
const min = Math.min;
|
|
7539
7866
|
const max = Math.max;
|
|
7540
7867
|
const round = Math.round;
|
|
7868
|
+
function getCssDimensions(element) {
|
|
7869
|
+
const css = getComputedStyle$1(element);
|
|
7870
|
+
let width = parseFloat(css.width);
|
|
7871
|
+
let height = parseFloat(css.height);
|
|
7872
|
+
const offsetWidth = element.offsetWidth;
|
|
7873
|
+
const offsetHeight = element.offsetHeight;
|
|
7874
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
7875
|
+
if (shouldFallback) {
|
|
7876
|
+
width = offsetWidth;
|
|
7877
|
+
height = offsetHeight;
|
|
7878
|
+
}
|
|
7879
|
+
return {
|
|
7880
|
+
width,
|
|
7881
|
+
height,
|
|
7882
|
+
fallback: shouldFallback
|
|
7883
|
+
};
|
|
7884
|
+
}
|
|
7885
|
+
function unwrapElement(element) {
|
|
7886
|
+
return !isElement(element) ? element.contextElement : element;
|
|
7887
|
+
}
|
|
7541
7888
|
const FALLBACK_SCALE = {
|
|
7542
7889
|
x: 1,
|
|
7543
7890
|
y: 1
|
|
7544
7891
|
};
|
|
7545
7892
|
function getScale(element) {
|
|
7546
|
-
const domElement =
|
|
7547
|
-
if (!domElement) {
|
|
7893
|
+
const domElement = unwrapElement(element);
|
|
7894
|
+
if (!isHTMLElement(domElement)) {
|
|
7548
7895
|
return FALLBACK_SCALE;
|
|
7549
7896
|
}
|
|
7550
7897
|
const rect = domElement.getBoundingClientRect();
|
|
7551
|
-
const
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
y: domElement.offsetHeight > 0 ? round(rect.height) / domElement.offsetHeight || 1 : 1
|
|
7559
|
-
};
|
|
7560
|
-
}
|
|
7561
|
-
let x = rect.width / parseFloat(css.width);
|
|
7562
|
-
let y = rect.height / parseFloat(css.height);
|
|
7898
|
+
const {
|
|
7899
|
+
width,
|
|
7900
|
+
height,
|
|
7901
|
+
fallback
|
|
7902
|
+
} = getCssDimensions(domElement);
|
|
7903
|
+
let x = (fallback ? round(rect.width) : rect.width) / width;
|
|
7904
|
+
let y = (fallback ? round(rect.height) : rect.height) / height;
|
|
7563
7905
|
if (!x || !Number.isFinite(x)) {
|
|
7564
7906
|
x = 1;
|
|
7565
7907
|
}
|
|
@@ -7572,7 +7914,7 @@ function getScale(element) {
|
|
|
7572
7914
|
};
|
|
7573
7915
|
}
|
|
7574
7916
|
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
7575
|
-
var _win$visualViewport
|
|
7917
|
+
var _win$visualViewport, _win$visualViewport2;
|
|
7576
7918
|
if (includeScale === void 0) {
|
|
7577
7919
|
includeScale = false;
|
|
7578
7920
|
}
|
|
@@ -7580,6 +7922,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
7580
7922
|
isFixedStrategy = false;
|
|
7581
7923
|
}
|
|
7582
7924
|
const clientRect = element.getBoundingClientRect();
|
|
7925
|
+
const domElement = unwrapElement(element);
|
|
7583
7926
|
let scale = FALLBACK_SCALE;
|
|
7584
7927
|
if (includeScale) {
|
|
7585
7928
|
if (offsetParent) {
|
|
@@ -7590,12 +7933,31 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
7590
7933
|
scale = getScale(element);
|
|
7591
7934
|
}
|
|
7592
7935
|
}
|
|
7593
|
-
const win =
|
|
7936
|
+
const win = domElement ? getWindow(domElement) : window;
|
|
7594
7937
|
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7938
|
+
let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
|
|
7939
|
+
let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
|
|
7940
|
+
let width = clientRect.width / scale.x;
|
|
7941
|
+
let height = clientRect.height / scale.y;
|
|
7942
|
+
if (domElement) {
|
|
7943
|
+
const win2 = getWindow(domElement);
|
|
7944
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
7945
|
+
let currentIFrame = win2.frameElement;
|
|
7946
|
+
while (currentIFrame && offsetParent && offsetWin !== win2) {
|
|
7947
|
+
const iframeScale = getScale(currentIFrame);
|
|
7948
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
7949
|
+
const css = getComputedStyle(currentIFrame);
|
|
7950
|
+
iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
7951
|
+
iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
7952
|
+
x *= iframeScale.x;
|
|
7953
|
+
y *= iframeScale.y;
|
|
7954
|
+
width *= iframeScale.x;
|
|
7955
|
+
height *= iframeScale.y;
|
|
7956
|
+
x += iframeRect.x;
|
|
7957
|
+
y += iframeRect.y;
|
|
7958
|
+
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
7959
|
+
}
|
|
7960
|
+
}
|
|
7599
7961
|
return {
|
|
7600
7962
|
width,
|
|
7601
7963
|
height,
|
|
@@ -7692,17 +8054,7 @@ function getOffsetParent(element) {
|
|
|
7692
8054
|
return offsetParent || getContainingBlock(element) || window2;
|
|
7693
8055
|
}
|
|
7694
8056
|
function getDimensions(element) {
|
|
7695
|
-
|
|
7696
|
-
return {
|
|
7697
|
-
width: element.offsetWidth,
|
|
7698
|
-
height: element.offsetHeight
|
|
7699
|
-
};
|
|
7700
|
-
}
|
|
7701
|
-
const rect = getBoundingClientRect(element);
|
|
7702
|
-
return {
|
|
7703
|
-
width: rect.width,
|
|
7704
|
-
height: rect.height
|
|
7705
|
-
};
|
|
8057
|
+
return getCssDimensions(element);
|
|
7706
8058
|
}
|
|
7707
8059
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
7708
8060
|
let {
|
|
@@ -8050,7 +8402,8 @@ const AccountButton = () => {
|
|
|
8050
8402
|
const [anchor, setAnchor] = createSignal();
|
|
8051
8403
|
const position = P(anchor, floating, {
|
|
8052
8404
|
whileElementsMounted: autoUpdate,
|
|
8053
|
-
placement: "bottom-end"
|
|
8405
|
+
placement: "bottom-end",
|
|
8406
|
+
middleware: [flip(), shift()]
|
|
8054
8407
|
});
|
|
8055
8408
|
const normalizedAddress = () => {
|
|
8056
8409
|
const acc = account();
|
|
@@ -12152,7 +12505,7 @@ class TonConnectUITracker {
|
|
|
12152
12505
|
}
|
|
12153
12506
|
}
|
|
12154
12507
|
}
|
|
12155
|
-
const tonConnectUiVersion = "2.
|
|
12508
|
+
const tonConnectUiVersion = "2.3.0-beta.1";
|
|
12156
12509
|
class TonConnectUI {
|
|
12157
12510
|
constructor(options) {
|
|
12158
12511
|
__publicField(this, "walletInfoStorage", new WalletInfoStorage());
|
|
@@ -12388,6 +12741,7 @@ class TonConnectUI {
|
|
|
12388
12741
|
});
|
|
12389
12742
|
const abortController = new AbortController();
|
|
12390
12743
|
const onRequestSent = () => {
|
|
12744
|
+
var _a2;
|
|
12391
12745
|
if (abortController.signal.aborted) {
|
|
12392
12746
|
return;
|
|
12393
12747
|
}
|
|
@@ -12401,6 +12755,20 @@ class TonConnectUI {
|
|
|
12401
12755
|
returnStrategy,
|
|
12402
12756
|
twaReturnUrl
|
|
12403
12757
|
});
|
|
12758
|
+
let firstClick = true;
|
|
12759
|
+
const redirectToWallet2 = () => {
|
|
12760
|
+
if (abortController.signal.aborted) {
|
|
12761
|
+
return;
|
|
12762
|
+
}
|
|
12763
|
+
const forceRedirect = !firstClick;
|
|
12764
|
+
firstClick = false;
|
|
12765
|
+
this.redirectAfterRequestSent({
|
|
12766
|
+
returnStrategy,
|
|
12767
|
+
twaReturnUrl,
|
|
12768
|
+
forceRedirect
|
|
12769
|
+
});
|
|
12770
|
+
};
|
|
12771
|
+
(_a2 = options == null ? void 0 : options.onRequestSent) == null ? void 0 : _a2.call(options, redirectToWallet2);
|
|
12404
12772
|
};
|
|
12405
12773
|
const unsubscribe = this.onTransactionModalStateChange((action2) => {
|
|
12406
12774
|
if (action2 == null ? void 0 : action2.openModal) {
|
|
@@ -12448,7 +12816,7 @@ class TonConnectUI {
|
|
|
12448
12816
|
}
|
|
12449
12817
|
});
|
|
12450
12818
|
}
|
|
12451
|
-
signData(data) {
|
|
12819
|
+
signData(data, options) {
|
|
12452
12820
|
return __async(this, null, function* () {
|
|
12453
12821
|
this.tracker.trackDataSentForSignature(this.wallet, data);
|
|
12454
12822
|
if (!this.connected) {
|
|
@@ -12467,6 +12835,7 @@ class TonConnectUI {
|
|
|
12467
12835
|
});
|
|
12468
12836
|
const abortController = new AbortController();
|
|
12469
12837
|
const onRequestSent = () => {
|
|
12838
|
+
var _a2;
|
|
12470
12839
|
if (abortController.signal.aborted) {
|
|
12471
12840
|
return;
|
|
12472
12841
|
}
|
|
@@ -12480,6 +12849,20 @@ class TonConnectUI {
|
|
|
12480
12849
|
returnStrategy,
|
|
12481
12850
|
twaReturnUrl
|
|
12482
12851
|
});
|
|
12852
|
+
let firstClick = true;
|
|
12853
|
+
const redirectToWallet2 = () => {
|
|
12854
|
+
if (abortController.signal.aborted) {
|
|
12855
|
+
return;
|
|
12856
|
+
}
|
|
12857
|
+
const forceRedirect = !firstClick;
|
|
12858
|
+
firstClick = false;
|
|
12859
|
+
this.redirectAfterRequestSent({
|
|
12860
|
+
returnStrategy,
|
|
12861
|
+
twaReturnUrl,
|
|
12862
|
+
forceRedirect
|
|
12863
|
+
});
|
|
12864
|
+
};
|
|
12865
|
+
(_a2 = options == null ? void 0 : options.onRequestSent) == null ? void 0 : _a2.call(options, redirectToWallet2);
|
|
12483
12866
|
};
|
|
12484
12867
|
const unsubscribe = this.onTransactionModalStateChange((action2) => {
|
|
12485
12868
|
if (action2 == null ? void 0 : action2.openModal) {
|
|
@@ -12529,14 +12912,15 @@ class TonConnectUI {
|
|
|
12529
12912
|
}
|
|
12530
12913
|
redirectAfterRequestSent({
|
|
12531
12914
|
returnStrategy,
|
|
12532
|
-
twaReturnUrl
|
|
12915
|
+
twaReturnUrl,
|
|
12916
|
+
forceRedirect
|
|
12533
12917
|
}) {
|
|
12534
12918
|
if (this.walletInfo && "universalLink" in this.walletInfo && (this.walletInfo.openMethod === "universal-link" || this.walletInfo.openMethod === "custom-deeplink")) {
|
|
12535
12919
|
if (isTelegramUrl(this.walletInfo.universalLink)) {
|
|
12536
12920
|
redirectToTelegram(this.walletInfo.universalLink, {
|
|
12537
12921
|
returnStrategy,
|
|
12538
12922
|
twaReturnUrl: twaReturnUrl || appState.twaReturnUrl,
|
|
12539
|
-
forceRedirect: false
|
|
12923
|
+
forceRedirect: forceRedirect || false
|
|
12540
12924
|
});
|
|
12541
12925
|
} else {
|
|
12542
12926
|
redirectToWallet(
|
|
@@ -12544,7 +12928,7 @@ class TonConnectUI {
|
|
|
12544
12928
|
this.walletInfo.deepLink,
|
|
12545
12929
|
{
|
|
12546
12930
|
returnStrategy,
|
|
12547
|
-
forceRedirect: false
|
|
12931
|
+
forceRedirect: forceRedirect || false
|
|
12548
12932
|
},
|
|
12549
12933
|
() => {
|
|
12550
12934
|
}
|