@krainovsd/js-helpers 0.13.3 → 0.13.5
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/lib/cjs/index.cjs +223 -354
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/lib/api/core.js +21 -8
- package/lib/esm/lib/api/core.js.map +1 -1
- package/lib/esm/lib/browser/get-visible-position.js +197 -341
- package/lib/esm/lib/browser/get-visible-position.js.map +1 -1
- package/lib/esm/lib/utils/limit-stream-of-requests.js +5 -5
- package/lib/esm/lib/utils/limit-stream-of-requests.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -396,7 +396,7 @@ function limitStreamOfRequests({ countRequests, maxCountInParallel, promiseGette
|
|
|
396
396
|
cancel: () => {
|
|
397
397
|
isStopped = true;
|
|
398
398
|
},
|
|
399
|
-
promise: new Promise((resolve) => {
|
|
399
|
+
promise: new Promise((resolve, reject) => {
|
|
400
400
|
let currentRequests = 0;
|
|
401
401
|
let currentResponses = 0;
|
|
402
402
|
const results = [];
|
|
@@ -408,9 +408,9 @@ function limitStreamOfRequests({ countRequests, maxCountInParallel, promiseGette
|
|
|
408
408
|
return void resolve(results);
|
|
409
409
|
if (currentResponses === countRequests)
|
|
410
410
|
return void resolve(results);
|
|
411
|
-
if (position > countRequests
|
|
412
|
-
|
|
413
|
-
promise
|
|
411
|
+
if (position > countRequests)
|
|
412
|
+
resolve(results);
|
|
413
|
+
Promise.resolve(promise)
|
|
414
414
|
.then((result) => {
|
|
415
415
|
if (isStopped)
|
|
416
416
|
return void resolve(results);
|
|
@@ -432,7 +432,7 @@ function limitStreamOfRequests({ countRequests, maxCountInParallel, promiseGette
|
|
|
432
432
|
return void wait(1000).then(() => request(promiseGetter(position), position, tryCount + 1));
|
|
433
433
|
}
|
|
434
434
|
if (throwError) {
|
|
435
|
-
|
|
435
|
+
reject(error);
|
|
436
436
|
}
|
|
437
437
|
currentResponses++;
|
|
438
438
|
request(promiseGetter(++currentRequests), currentRequests);
|
|
@@ -689,35 +689,36 @@ function getVisiblePosition({ initialPosition, node, visibleArea, placement = "b
|
|
|
689
689
|
placement === "right-center"
|
|
690
690
|
? 0
|
|
691
691
|
: 10, flex, }) {
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
}
|
|
692
|
+
/** Viewport Variables */
|
|
693
|
+
const viewport = visibleArea ?? document.documentElement;
|
|
694
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
695
|
+
const scrollLeft = document.documentElement.scrollLeft;
|
|
696
|
+
const rect = viewport.getBoundingClientRect();
|
|
697
|
+
const viewportWidth = viewport.clientWidth;
|
|
698
|
+
const viewportHeight = viewport.clientHeight;
|
|
699
|
+
const xStart = visibleArea ? viewport.offsetLeft - viewport.scrollLeft : Math.abs(rect.left);
|
|
700
|
+
const xEnd = xStart + viewportWidth;
|
|
701
|
+
const yStart = visibleArea ? viewport.offsetTop : Math.abs(rect.top);
|
|
702
|
+
const yEnd = yStart + viewportHeight;
|
|
703
|
+
/** Target Variables */
|
|
705
704
|
let targetHeight = 0;
|
|
706
705
|
let targetWidth = 0;
|
|
707
|
-
let
|
|
706
|
+
let targetTopPosition = 0;
|
|
707
|
+
let targetLeftPosition = 0;
|
|
708
|
+
const { height: nodeHeight, width: nodeWidth } = node.getBoundingClientRect();
|
|
708
709
|
if (initialPosition?.targetNode) {
|
|
709
|
-
const { top
|
|
710
|
+
const { top, left, height, width } = initialPosition.targetNode.getBoundingClientRect();
|
|
710
711
|
targetHeight = height;
|
|
711
712
|
targetWidth = width;
|
|
712
|
-
targetTopPosition =
|
|
713
|
-
targetLeftPosition =
|
|
713
|
+
targetTopPosition = top + scrollTop;
|
|
714
|
+
targetLeftPosition = left + scrollLeft;
|
|
714
715
|
}
|
|
715
716
|
if (initialPosition?.position) {
|
|
716
717
|
if (initialPosition.position.x) {
|
|
717
|
-
targetLeftPosition = initialPosition.position.x;
|
|
718
|
+
targetLeftPosition = initialPosition.position.x + scrollLeft;
|
|
718
719
|
}
|
|
719
720
|
if (initialPosition.position.y) {
|
|
720
|
-
targetTopPosition = initialPosition.position.y;
|
|
721
|
+
targetTopPosition = initialPosition.position.y + scrollTop;
|
|
721
722
|
}
|
|
722
723
|
if (initialPosition.position.height) {
|
|
723
724
|
targetHeight = initialPosition.position.height;
|
|
@@ -726,6 +727,25 @@ function getVisiblePosition({ initialPosition, node, visibleArea, placement = "b
|
|
|
726
727
|
targetWidth = initialPosition.position.width;
|
|
727
728
|
}
|
|
728
729
|
}
|
|
730
|
+
/** Initial Position */
|
|
731
|
+
const targetXCenter = targetWidth ? targetLeftPosition + targetWidth / 2 : targetLeftPosition;
|
|
732
|
+
const targetYCenter = targetHeight ? targetTopPosition + targetHeight / 2 : targetTopPosition;
|
|
733
|
+
const targetYEnd = targetHeight ? targetTopPosition + targetHeight : targetTopPosition;
|
|
734
|
+
const x = {
|
|
735
|
+
insideCenter: targetXCenter - nodeWidth / 2 + stepX,
|
|
736
|
+
insideRight: targetLeftPosition + targetWidth + stepX - nodeWidth,
|
|
737
|
+
insideLeft: targetLeftPosition + stepX,
|
|
738
|
+
left: targetLeftPosition - nodeWidth - stepX,
|
|
739
|
+
right: targetLeftPosition + targetWidth + stepX,
|
|
740
|
+
};
|
|
741
|
+
const y = {
|
|
742
|
+
bottom: targetYEnd + stepY,
|
|
743
|
+
top: targetTopPosition - stepY - nodeHeight,
|
|
744
|
+
insideCenter: targetYCenter - nodeHeight / 2 + stepY,
|
|
745
|
+
insideBottom: targetTopPosition + targetHeight - nodeHeight + stepY,
|
|
746
|
+
insideTop: targetTopPosition + stepY,
|
|
747
|
+
};
|
|
748
|
+
/** Find visible position */
|
|
729
749
|
function isCompletelyVisibleX(left) {
|
|
730
750
|
const endXPosition = nodeWidth + left;
|
|
731
751
|
return xStart <= left && xEnd >= endXPosition;
|
|
@@ -734,496 +754,356 @@ function getVisiblePosition({ initialPosition, node, visibleArea, placement = "b
|
|
|
734
754
|
const endYPosition = nodeHeight + top;
|
|
735
755
|
return yStart <= top && yEnd >= endYPosition;
|
|
736
756
|
}
|
|
737
|
-
let
|
|
738
|
-
let correctTop = targetTopPosition;
|
|
739
|
-
const { x, y } = getStartPositions({
|
|
740
|
-
targetHeight,
|
|
741
|
-
targetWidth,
|
|
757
|
+
let visiblePositions = processVisiblePositions({
|
|
742
758
|
targetLeftPosition,
|
|
759
|
+
targetTopPosition,
|
|
760
|
+
x,
|
|
761
|
+
y,
|
|
762
|
+
placement,
|
|
763
|
+
flex,
|
|
743
764
|
nodeHeight,
|
|
744
765
|
nodeWidth,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
766
|
+
xEnd,
|
|
767
|
+
xStart,
|
|
768
|
+
yEnd,
|
|
769
|
+
yStart,
|
|
770
|
+
isCompletelyVisibleX,
|
|
771
|
+
isCompletelyVisibleY,
|
|
748
772
|
});
|
|
749
|
-
|
|
773
|
+
if (flex &&
|
|
774
|
+
(!isCompletelyVisibleX(visiblePositions.left) || !isCompletelyVisibleY(visiblePositions.top))) {
|
|
775
|
+
visiblePositions = getFlexVisiblePosition({
|
|
776
|
+
initialLeft: visiblePositions.left,
|
|
777
|
+
initialTop: visiblePositions.top,
|
|
778
|
+
isCompletelyVisibleX,
|
|
779
|
+
isCompletelyVisibleY,
|
|
780
|
+
nodeHeight,
|
|
781
|
+
nodeWidth,
|
|
782
|
+
xEnd,
|
|
783
|
+
yEnd,
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
return {
|
|
787
|
+
placement: visiblePositions.placement,
|
|
788
|
+
left: visiblePositions.left,
|
|
789
|
+
top: visiblePositions.top,
|
|
790
|
+
bottom: yEnd - scrollTop - (visiblePositions.top + nodeHeight),
|
|
791
|
+
right: xEnd - scrollLeft - (visiblePositions.left + nodeWidth),
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function processVisiblePositions(opts) {
|
|
795
|
+
let correctLeft = opts.targetLeftPosition;
|
|
796
|
+
let correctTop = opts.targetTopPosition;
|
|
797
|
+
switch (opts.placement) {
|
|
750
798
|
case "bottom-center": {
|
|
751
|
-
correctLeft = x.
|
|
752
|
-
correctTop = y.bottom;
|
|
799
|
+
correctLeft = opts.x.insideCenter;
|
|
800
|
+
correctTop = opts.y.bottom;
|
|
753
801
|
let placement = "bottom-center";
|
|
754
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
755
|
-
if (isCompletelyVisibleX(x.
|
|
802
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
803
|
+
if (opts.isCompletelyVisibleX(opts.x.insideLeft)) {
|
|
756
804
|
placement = "bottom-left";
|
|
757
|
-
correctLeft = x.
|
|
805
|
+
correctLeft = opts.x.insideLeft;
|
|
758
806
|
}
|
|
759
|
-
else if (isCompletelyVisibleX(x.
|
|
807
|
+
else if (opts.isCompletelyVisibleX(opts.x.insideRight)) {
|
|
760
808
|
placement = "bottom-right";
|
|
761
|
-
correctLeft = x.
|
|
809
|
+
correctLeft = opts.x.insideRight;
|
|
762
810
|
}
|
|
763
811
|
}
|
|
764
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
765
|
-
if (isCompletelyVisibleY(y.top)) {
|
|
812
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
813
|
+
if (opts.isCompletelyVisibleY(opts.y.top)) {
|
|
766
814
|
placement = placement.replace("bottom", "top");
|
|
767
|
-
correctTop = y.top;
|
|
815
|
+
correctTop = opts.y.top;
|
|
768
816
|
}
|
|
769
817
|
}
|
|
770
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
771
|
-
return getFlexVisiblePosition({
|
|
772
|
-
initialLeft: correctLeft,
|
|
773
|
-
initialTop: correctTop,
|
|
774
|
-
isCompletelyVisibleX,
|
|
775
|
-
isCompletelyVisibleY,
|
|
776
|
-
nodeHeight,
|
|
777
|
-
nodeWidth,
|
|
778
|
-
xEnd,
|
|
779
|
-
yEnd,
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
818
|
return {
|
|
783
819
|
top: correctTop,
|
|
784
820
|
left: correctLeft,
|
|
785
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
786
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
787
821
|
placement,
|
|
788
822
|
};
|
|
789
823
|
}
|
|
790
824
|
case "bottom-left": {
|
|
791
|
-
correctLeft = x.
|
|
792
|
-
correctTop = y.bottom;
|
|
825
|
+
correctLeft = opts.x.insideLeft;
|
|
826
|
+
correctTop = opts.y.bottom;
|
|
793
827
|
let placement = "bottom-left";
|
|
794
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
795
|
-
if (isCompletelyVisibleX(x.
|
|
828
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
829
|
+
if (opts.isCompletelyVisibleX(opts.x.insideCenter)) {
|
|
796
830
|
placement = "bottom-center";
|
|
797
|
-
correctLeft = x.
|
|
831
|
+
correctLeft = opts.x.insideCenter;
|
|
798
832
|
}
|
|
799
|
-
else if (isCompletelyVisibleX(x.
|
|
833
|
+
else if (opts.isCompletelyVisibleX(opts.x.insideRight)) {
|
|
800
834
|
placement = "bottom-right";
|
|
801
|
-
correctLeft = x.
|
|
835
|
+
correctLeft = opts.x.insideRight;
|
|
802
836
|
}
|
|
803
837
|
}
|
|
804
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
805
|
-
if (isCompletelyVisibleY(y.top)) {
|
|
838
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
839
|
+
if (opts.isCompletelyVisibleY(opts.y.top)) {
|
|
806
840
|
placement = placement.replace("bottom", "top");
|
|
807
|
-
correctTop = y.top;
|
|
841
|
+
correctTop = opts.y.top;
|
|
808
842
|
}
|
|
809
843
|
}
|
|
810
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
811
|
-
return getFlexVisiblePosition({
|
|
812
|
-
initialLeft: correctLeft,
|
|
813
|
-
initialTop: correctTop,
|
|
814
|
-
isCompletelyVisibleX,
|
|
815
|
-
isCompletelyVisibleY,
|
|
816
|
-
nodeHeight,
|
|
817
|
-
nodeWidth,
|
|
818
|
-
xEnd,
|
|
819
|
-
yEnd,
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
844
|
return {
|
|
823
845
|
top: correctTop,
|
|
824
846
|
left: correctLeft,
|
|
825
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
826
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
827
847
|
placement,
|
|
828
848
|
};
|
|
829
849
|
}
|
|
830
850
|
case "bottom-right": {
|
|
831
|
-
correctLeft = x.
|
|
832
|
-
correctTop = y.bottom;
|
|
851
|
+
correctLeft = opts.x.insideRight;
|
|
852
|
+
correctTop = opts.y.bottom;
|
|
833
853
|
let placement = "bottom-right";
|
|
834
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
835
|
-
if (isCompletelyVisibleX(x.
|
|
854
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
855
|
+
if (opts.isCompletelyVisibleX(opts.x.insideCenter)) {
|
|
836
856
|
placement = "bottom-center";
|
|
837
|
-
correctLeft = x.
|
|
857
|
+
correctLeft = opts.x.insideCenter;
|
|
838
858
|
}
|
|
839
|
-
else if (isCompletelyVisibleX(x.
|
|
859
|
+
else if (opts.isCompletelyVisibleX(opts.x.insideLeft)) {
|
|
840
860
|
placement = "bottom-left";
|
|
841
|
-
correctLeft = x.
|
|
861
|
+
correctLeft = opts.x.insideLeft;
|
|
842
862
|
}
|
|
843
863
|
}
|
|
844
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
845
|
-
if (isCompletelyVisibleY(y.top)) {
|
|
864
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
865
|
+
if (opts.isCompletelyVisibleY(opts.y.top)) {
|
|
846
866
|
placement = placement.replace("bottom", "top");
|
|
847
|
-
correctTop = y.top;
|
|
867
|
+
correctTop = opts.y.top;
|
|
848
868
|
}
|
|
849
869
|
}
|
|
850
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
851
|
-
return getFlexVisiblePosition({
|
|
852
|
-
initialLeft: correctLeft,
|
|
853
|
-
initialTop: correctTop,
|
|
854
|
-
isCompletelyVisibleX,
|
|
855
|
-
isCompletelyVisibleY,
|
|
856
|
-
nodeHeight,
|
|
857
|
-
nodeWidth,
|
|
858
|
-
xEnd,
|
|
859
|
-
yEnd,
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
870
|
return {
|
|
863
871
|
top: correctTop,
|
|
864
872
|
left: correctLeft,
|
|
865
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
866
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
867
873
|
placement,
|
|
868
874
|
};
|
|
869
875
|
}
|
|
870
876
|
case "right-bottom": {
|
|
871
|
-
correctLeft = x.right;
|
|
872
|
-
correctTop = y.
|
|
877
|
+
correctLeft = opts.x.right;
|
|
878
|
+
correctTop = opts.y.insideBottom;
|
|
873
879
|
let placement = "right-bottom";
|
|
874
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
875
|
-
if (isCompletelyVisibleY(y.
|
|
880
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
881
|
+
if (opts.isCompletelyVisibleY(opts.y.insideCenter)) {
|
|
876
882
|
placement = "right-center";
|
|
877
|
-
correctTop = y.
|
|
883
|
+
correctTop = opts.y.insideCenter;
|
|
878
884
|
}
|
|
879
|
-
else if (isCompletelyVisibleY(y.
|
|
885
|
+
else if (opts.isCompletelyVisibleY(opts.y.insideTop)) {
|
|
880
886
|
placement = "right-top";
|
|
881
|
-
correctTop = y.
|
|
887
|
+
correctTop = opts.y.insideTop;
|
|
882
888
|
}
|
|
883
889
|
}
|
|
884
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
885
|
-
if (isCompletelyVisibleX(x.left)) {
|
|
890
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
891
|
+
if (opts.isCompletelyVisibleX(opts.x.left)) {
|
|
886
892
|
placement = placement.replace("right", "left");
|
|
887
|
-
correctLeft = x.left;
|
|
893
|
+
correctLeft = opts.x.left;
|
|
888
894
|
}
|
|
889
895
|
}
|
|
890
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
891
|
-
return getFlexVisiblePosition({
|
|
892
|
-
initialLeft: correctLeft,
|
|
893
|
-
initialTop: correctTop,
|
|
894
|
-
isCompletelyVisibleX,
|
|
895
|
-
isCompletelyVisibleY,
|
|
896
|
-
nodeHeight,
|
|
897
|
-
nodeWidth,
|
|
898
|
-
xEnd,
|
|
899
|
-
yEnd,
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
896
|
return {
|
|
903
897
|
top: correctTop,
|
|
904
898
|
left: correctLeft,
|
|
905
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
906
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
907
899
|
placement,
|
|
908
900
|
};
|
|
909
901
|
}
|
|
910
902
|
case "right-center": {
|
|
911
|
-
correctLeft = x.right;
|
|
912
|
-
correctTop = y.
|
|
903
|
+
correctLeft = opts.x.right;
|
|
904
|
+
correctTop = opts.y.insideCenter;
|
|
913
905
|
let placement = "right-center";
|
|
914
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
915
|
-
if (isCompletelyVisibleY(y.
|
|
906
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
907
|
+
if (opts.isCompletelyVisibleY(opts.y.insideTop)) {
|
|
916
908
|
placement = "right-top";
|
|
917
|
-
correctTop = y.
|
|
909
|
+
correctTop = opts.y.insideTop;
|
|
918
910
|
}
|
|
919
|
-
else if (isCompletelyVisibleY(y.
|
|
911
|
+
else if (opts.isCompletelyVisibleY(opts.y.insideBottom)) {
|
|
920
912
|
placement = "right-bottom";
|
|
921
|
-
correctTop = y.
|
|
913
|
+
correctTop = opts.y.insideBottom;
|
|
922
914
|
}
|
|
923
915
|
}
|
|
924
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
925
|
-
if (isCompletelyVisibleX(x.left)) {
|
|
916
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
917
|
+
if (opts.isCompletelyVisibleX(opts.x.left)) {
|
|
926
918
|
placement = placement.replace("right", "left");
|
|
927
|
-
correctLeft = x.left;
|
|
919
|
+
correctLeft = opts.x.left;
|
|
928
920
|
}
|
|
929
921
|
}
|
|
930
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
931
|
-
return getFlexVisiblePosition({
|
|
932
|
-
initialLeft: correctLeft,
|
|
933
|
-
initialTop: correctTop,
|
|
934
|
-
isCompletelyVisibleX,
|
|
935
|
-
isCompletelyVisibleY,
|
|
936
|
-
nodeHeight,
|
|
937
|
-
nodeWidth,
|
|
938
|
-
xEnd,
|
|
939
|
-
yEnd,
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
922
|
return {
|
|
943
923
|
top: correctTop,
|
|
944
924
|
left: correctLeft,
|
|
945
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
946
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
947
925
|
placement,
|
|
948
926
|
};
|
|
949
927
|
}
|
|
950
928
|
case "right-top": {
|
|
951
|
-
correctLeft = x.right;
|
|
952
|
-
correctTop = y.
|
|
929
|
+
correctLeft = opts.x.right;
|
|
930
|
+
correctTop = opts.y.insideTop;
|
|
953
931
|
let placement = "right-top";
|
|
954
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
955
|
-
if (isCompletelyVisibleY(y.
|
|
932
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
933
|
+
if (opts.isCompletelyVisibleY(opts.y.insideCenter)) {
|
|
956
934
|
placement = "right-center";
|
|
957
|
-
correctTop = y.
|
|
935
|
+
correctTop = opts.y.insideCenter;
|
|
958
936
|
}
|
|
959
|
-
else if (isCompletelyVisibleY(y.
|
|
937
|
+
else if (opts.isCompletelyVisibleY(opts.y.insideBottom)) {
|
|
960
938
|
placement = "right-bottom";
|
|
961
|
-
correctTop = y.
|
|
939
|
+
correctTop = opts.y.insideBottom;
|
|
962
940
|
}
|
|
963
941
|
}
|
|
964
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
965
|
-
if (isCompletelyVisibleX(x.left)) {
|
|
942
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
943
|
+
if (opts.isCompletelyVisibleX(opts.x.left)) {
|
|
966
944
|
placement = placement.replace("right", "left");
|
|
967
|
-
correctLeft = x.left;
|
|
945
|
+
correctLeft = opts.x.left;
|
|
968
946
|
}
|
|
969
947
|
}
|
|
970
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
971
|
-
return getFlexVisiblePosition({
|
|
972
|
-
initialLeft: correctLeft,
|
|
973
|
-
initialTop: correctTop,
|
|
974
|
-
isCompletelyVisibleX,
|
|
975
|
-
isCompletelyVisibleY,
|
|
976
|
-
nodeHeight,
|
|
977
|
-
nodeWidth,
|
|
978
|
-
xEnd,
|
|
979
|
-
yEnd,
|
|
980
|
-
});
|
|
981
|
-
}
|
|
982
948
|
return {
|
|
983
949
|
top: correctTop,
|
|
984
950
|
left: correctLeft,
|
|
985
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
986
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
987
951
|
placement,
|
|
988
952
|
};
|
|
989
953
|
}
|
|
990
954
|
case "top-center": {
|
|
991
|
-
correctLeft = x.
|
|
992
|
-
correctTop = y.top;
|
|
955
|
+
correctLeft = opts.x.insideCenter;
|
|
956
|
+
correctTop = opts.y.top;
|
|
993
957
|
let placement = "top-center";
|
|
994
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
995
|
-
if (isCompletelyVisibleX(x.
|
|
958
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
959
|
+
if (opts.isCompletelyVisibleX(opts.x.insideLeft)) {
|
|
996
960
|
placement = "top-left";
|
|
997
|
-
correctLeft = x.
|
|
961
|
+
correctLeft = opts.x.insideLeft;
|
|
998
962
|
}
|
|
999
|
-
else if (isCompletelyVisibleX(x.
|
|
963
|
+
else if (opts.isCompletelyVisibleX(opts.x.insideRight)) {
|
|
1000
964
|
placement = "top-right";
|
|
1001
|
-
correctLeft = x.
|
|
965
|
+
correctLeft = opts.x.insideRight;
|
|
1002
966
|
}
|
|
1003
967
|
}
|
|
1004
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
1005
|
-
if (isCompletelyVisibleY(y.bottom)) {
|
|
968
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
969
|
+
if (opts.isCompletelyVisibleY(opts.y.bottom)) {
|
|
1006
970
|
placement = placement.replace("top", "bottom");
|
|
1007
|
-
correctTop = y.bottom;
|
|
971
|
+
correctTop = opts.y.bottom;
|
|
1008
972
|
}
|
|
1009
973
|
}
|
|
1010
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
1011
|
-
return getFlexVisiblePosition({
|
|
1012
|
-
initialLeft: correctLeft,
|
|
1013
|
-
initialTop: correctTop,
|
|
1014
|
-
isCompletelyVisibleX,
|
|
1015
|
-
isCompletelyVisibleY,
|
|
1016
|
-
nodeHeight,
|
|
1017
|
-
nodeWidth,
|
|
1018
|
-
xEnd,
|
|
1019
|
-
yEnd,
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
974
|
return {
|
|
1023
975
|
top: correctTop,
|
|
1024
976
|
left: correctLeft,
|
|
1025
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
1026
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
1027
977
|
placement,
|
|
1028
978
|
};
|
|
1029
979
|
}
|
|
1030
980
|
case "top-left": {
|
|
1031
|
-
correctLeft = x.
|
|
1032
|
-
correctTop = y.top;
|
|
981
|
+
correctLeft = opts.x.insideLeft;
|
|
982
|
+
correctTop = opts.y.top;
|
|
1033
983
|
let placement = "top-left";
|
|
1034
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
1035
|
-
if (isCompletelyVisibleX(x.
|
|
984
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
985
|
+
if (opts.isCompletelyVisibleX(opts.x.insideCenter)) {
|
|
1036
986
|
placement = "top-center";
|
|
1037
|
-
correctLeft = x.
|
|
987
|
+
correctLeft = opts.x.insideCenter;
|
|
1038
988
|
}
|
|
1039
|
-
else if (isCompletelyVisibleX(x.
|
|
989
|
+
else if (opts.isCompletelyVisibleX(opts.x.insideRight)) {
|
|
1040
990
|
placement = "top-right";
|
|
1041
|
-
correctLeft = x.
|
|
991
|
+
correctLeft = opts.x.insideRight;
|
|
1042
992
|
}
|
|
1043
993
|
}
|
|
1044
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
1045
|
-
if (isCompletelyVisibleY(y.bottom)) {
|
|
994
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
995
|
+
if (opts.isCompletelyVisibleY(opts.y.bottom)) {
|
|
1046
996
|
placement = placement.replace("top", "bottom");
|
|
1047
|
-
correctTop = y.bottom;
|
|
997
|
+
correctTop = opts.y.bottom;
|
|
1048
998
|
}
|
|
1049
999
|
}
|
|
1050
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
1051
|
-
return getFlexVisiblePosition({
|
|
1052
|
-
initialLeft: correctLeft,
|
|
1053
|
-
initialTop: correctTop,
|
|
1054
|
-
isCompletelyVisibleX,
|
|
1055
|
-
isCompletelyVisibleY,
|
|
1056
|
-
nodeHeight,
|
|
1057
|
-
nodeWidth,
|
|
1058
|
-
xEnd,
|
|
1059
|
-
yEnd,
|
|
1060
|
-
});
|
|
1061
|
-
}
|
|
1062
1000
|
return {
|
|
1063
1001
|
top: correctTop,
|
|
1064
1002
|
left: correctLeft,
|
|
1065
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
1066
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
1067
1003
|
placement,
|
|
1068
1004
|
};
|
|
1069
1005
|
}
|
|
1070
1006
|
case "top-right": {
|
|
1071
|
-
correctLeft = x.
|
|
1072
|
-
correctTop = y.top;
|
|
1007
|
+
correctLeft = opts.x.insideRight;
|
|
1008
|
+
correctTop = opts.y.top;
|
|
1073
1009
|
let placement = "top-right";
|
|
1074
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
1075
|
-
if (isCompletelyVisibleX(x.
|
|
1010
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
1011
|
+
if (opts.isCompletelyVisibleX(opts.x.insideCenter)) {
|
|
1076
1012
|
placement = "top-center";
|
|
1077
|
-
correctLeft = x.
|
|
1013
|
+
correctLeft = opts.x.insideCenter;
|
|
1078
1014
|
}
|
|
1079
|
-
else if (isCompletelyVisibleX(x.
|
|
1015
|
+
else if (opts.isCompletelyVisibleX(opts.x.insideLeft)) {
|
|
1080
1016
|
placement = "top-left";
|
|
1081
|
-
correctLeft = x.
|
|
1017
|
+
correctLeft = opts.x.insideLeft;
|
|
1082
1018
|
}
|
|
1083
1019
|
}
|
|
1084
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
1085
|
-
if (isCompletelyVisibleY(y.bottom)) {
|
|
1020
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
1021
|
+
if (opts.isCompletelyVisibleY(opts.y.bottom)) {
|
|
1086
1022
|
placement = placement.replace("top", "bottom");
|
|
1087
|
-
correctTop = y.bottom;
|
|
1023
|
+
correctTop = opts.y.bottom;
|
|
1088
1024
|
}
|
|
1089
1025
|
}
|
|
1090
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
1091
|
-
return getFlexVisiblePosition({
|
|
1092
|
-
initialLeft: correctLeft,
|
|
1093
|
-
initialTop: correctTop,
|
|
1094
|
-
isCompletelyVisibleX,
|
|
1095
|
-
isCompletelyVisibleY,
|
|
1096
|
-
nodeHeight,
|
|
1097
|
-
nodeWidth,
|
|
1098
|
-
xEnd,
|
|
1099
|
-
yEnd,
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
1026
|
return {
|
|
1103
1027
|
top: correctTop,
|
|
1104
1028
|
left: correctLeft,
|
|
1105
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
1106
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
1107
1029
|
placement,
|
|
1108
1030
|
};
|
|
1109
1031
|
}
|
|
1110
1032
|
case "left-bottom": {
|
|
1111
|
-
correctLeft = x.left;
|
|
1112
|
-
correctTop = y.
|
|
1033
|
+
correctLeft = opts.x.left;
|
|
1034
|
+
correctTop = opts.y.insideBottom;
|
|
1113
1035
|
let placement = "left-bottom";
|
|
1114
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
1115
|
-
if (isCompletelyVisibleY(y.
|
|
1036
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
1037
|
+
if (opts.isCompletelyVisibleY(opts.y.insideCenter)) {
|
|
1116
1038
|
placement = "left-center";
|
|
1117
|
-
correctTop = y.
|
|
1039
|
+
correctTop = opts.y.insideCenter;
|
|
1118
1040
|
}
|
|
1119
|
-
else if (isCompletelyVisibleY(y.
|
|
1041
|
+
else if (opts.isCompletelyVisibleY(opts.y.insideTop)) {
|
|
1120
1042
|
placement = "left-top";
|
|
1121
|
-
correctTop = y.
|
|
1043
|
+
correctTop = opts.y.insideTop;
|
|
1122
1044
|
}
|
|
1123
1045
|
}
|
|
1124
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
1125
|
-
if (isCompletelyVisibleX(x.right)) {
|
|
1046
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
1047
|
+
if (opts.isCompletelyVisibleX(opts.x.right)) {
|
|
1126
1048
|
placement = placement.replace("left", "right");
|
|
1127
|
-
correctLeft = x.right;
|
|
1049
|
+
correctLeft = opts.x.right;
|
|
1128
1050
|
}
|
|
1129
1051
|
}
|
|
1130
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
1131
|
-
return getFlexVisiblePosition({
|
|
1132
|
-
initialLeft: correctLeft,
|
|
1133
|
-
initialTop: correctTop,
|
|
1134
|
-
isCompletelyVisibleX,
|
|
1135
|
-
isCompletelyVisibleY,
|
|
1136
|
-
nodeHeight,
|
|
1137
|
-
nodeWidth,
|
|
1138
|
-
xEnd,
|
|
1139
|
-
yEnd,
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
1052
|
return {
|
|
1143
1053
|
top: correctTop,
|
|
1144
1054
|
left: correctLeft,
|
|
1145
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
1146
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
1147
1055
|
placement,
|
|
1148
1056
|
};
|
|
1149
1057
|
}
|
|
1150
1058
|
case "left-center": {
|
|
1151
|
-
correctLeft = x.left;
|
|
1152
|
-
correctTop = y.
|
|
1059
|
+
correctLeft = opts.x.left;
|
|
1060
|
+
correctTop = opts.y.insideCenter;
|
|
1153
1061
|
let placement = "left-center";
|
|
1154
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
1155
|
-
if (isCompletelyVisibleY(y.
|
|
1062
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
1063
|
+
if (opts.isCompletelyVisibleY(opts.y.insideTop)) {
|
|
1156
1064
|
placement = "left-top";
|
|
1157
|
-
correctTop = y.
|
|
1065
|
+
correctTop = opts.y.insideTop;
|
|
1158
1066
|
}
|
|
1159
|
-
else if (isCompletelyVisibleY(y.
|
|
1067
|
+
else if (opts.isCompletelyVisibleY(opts.y.insideBottom)) {
|
|
1160
1068
|
placement = "left-bottom";
|
|
1161
|
-
correctTop = y.
|
|
1069
|
+
correctTop = opts.y.insideBottom;
|
|
1162
1070
|
}
|
|
1163
1071
|
}
|
|
1164
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
1165
|
-
if (isCompletelyVisibleX(x.right)) {
|
|
1072
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
1073
|
+
if (opts.isCompletelyVisibleX(opts.x.right)) {
|
|
1166
1074
|
placement = placement.replace("left", "right");
|
|
1167
|
-
correctLeft = x.right;
|
|
1075
|
+
correctLeft = opts.x.right;
|
|
1168
1076
|
}
|
|
1169
1077
|
}
|
|
1170
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
1171
|
-
return getFlexVisiblePosition({
|
|
1172
|
-
initialLeft: correctLeft,
|
|
1173
|
-
initialTop: correctTop,
|
|
1174
|
-
isCompletelyVisibleX,
|
|
1175
|
-
isCompletelyVisibleY,
|
|
1176
|
-
nodeHeight,
|
|
1177
|
-
nodeWidth,
|
|
1178
|
-
xEnd,
|
|
1179
|
-
yEnd,
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
1078
|
return {
|
|
1183
1079
|
top: correctTop,
|
|
1184
1080
|
left: correctLeft,
|
|
1185
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
1186
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
1187
1081
|
placement,
|
|
1188
1082
|
};
|
|
1189
1083
|
}
|
|
1190
1084
|
case "left-top": {
|
|
1191
|
-
correctLeft = x.left;
|
|
1192
|
-
correctTop = y.
|
|
1085
|
+
correctLeft = opts.x.left;
|
|
1086
|
+
correctTop = opts.y.insideTop;
|
|
1193
1087
|
let placement = "left-top";
|
|
1194
|
-
if (!isCompletelyVisibleY(correctTop)) {
|
|
1195
|
-
if (isCompletelyVisibleY(y.
|
|
1088
|
+
if (!opts.isCompletelyVisibleY(correctTop)) {
|
|
1089
|
+
if (opts.isCompletelyVisibleY(opts.y.insideCenter)) {
|
|
1196
1090
|
placement = "left-center";
|
|
1197
|
-
correctTop = y.
|
|
1091
|
+
correctTop = opts.y.insideCenter;
|
|
1198
1092
|
}
|
|
1199
|
-
else if (isCompletelyVisibleY(y.
|
|
1093
|
+
else if (opts.isCompletelyVisibleY(opts.y.insideBottom)) {
|
|
1200
1094
|
placement = "left-bottom";
|
|
1201
|
-
correctTop = y.
|
|
1095
|
+
correctTop = opts.y.insideBottom;
|
|
1202
1096
|
}
|
|
1203
1097
|
}
|
|
1204
|
-
if (!isCompletelyVisibleX(correctLeft)) {
|
|
1205
|
-
if (isCompletelyVisibleX(x.right)) {
|
|
1098
|
+
if (!opts.isCompletelyVisibleX(correctLeft)) {
|
|
1099
|
+
if (opts.isCompletelyVisibleX(opts.x.right)) {
|
|
1206
1100
|
placement = placement.replace("left", "right");
|
|
1207
|
-
correctLeft = x.right;
|
|
1101
|
+
correctLeft = opts.x.right;
|
|
1208
1102
|
}
|
|
1209
1103
|
}
|
|
1210
|
-
if (flex && (!isCompletelyVisibleX(correctLeft) || !isCompletelyVisibleY(correctTop))) {
|
|
1211
|
-
return getFlexVisiblePosition({
|
|
1212
|
-
initialLeft: correctLeft,
|
|
1213
|
-
initialTop: correctTop,
|
|
1214
|
-
isCompletelyVisibleX,
|
|
1215
|
-
isCompletelyVisibleY,
|
|
1216
|
-
nodeHeight,
|
|
1217
|
-
nodeWidth,
|
|
1218
|
-
xEnd,
|
|
1219
|
-
yEnd,
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
1104
|
return {
|
|
1223
1105
|
top: correctTop,
|
|
1224
1106
|
left: correctLeft,
|
|
1225
|
-
right: xEnd - correctLeft - nodeWidth,
|
|
1226
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
1227
1107
|
placement,
|
|
1228
1108
|
};
|
|
1229
1109
|
}
|
|
@@ -1231,33 +1111,11 @@ function getVisiblePosition({ initialPosition, node, visibleArea, placement = "b
|
|
|
1231
1111
|
return {
|
|
1232
1112
|
top: correctTop,
|
|
1233
1113
|
left: correctLeft,
|
|
1234
|
-
|
|
1235
|
-
bottom: yEnd - correctTop - nodeHeight,
|
|
1236
|
-
placement,
|
|
1114
|
+
placement: opts.placement,
|
|
1237
1115
|
};
|
|
1238
1116
|
}
|
|
1239
1117
|
}
|
|
1240
1118
|
}
|
|
1241
|
-
function getStartPositions({ targetHeight, targetWidth, nodeHeight, nodeWidth, targetLeftPosition, targetTopPosition, stepX, stepY, }) {
|
|
1242
|
-
const childBottomCenter = targetWidth ? targetLeftPosition + targetWidth / 2 : targetLeftPosition;
|
|
1243
|
-
const childBottom = targetHeight ? targetTopPosition + targetHeight : targetTopPosition;
|
|
1244
|
-
const childRightCenter = targetHeight ? targetTopPosition + targetHeight / 2 : targetTopPosition;
|
|
1245
|
-
const x = {
|
|
1246
|
-
bottomCenter: childBottomCenter - nodeWidth / 2 + stepX,
|
|
1247
|
-
bottomRight: targetLeftPosition + targetWidth + stepX - nodeWidth,
|
|
1248
|
-
bottomLeft: targetLeftPosition + stepX,
|
|
1249
|
-
left: targetLeftPosition - nodeWidth - stepX,
|
|
1250
|
-
right: targetLeftPosition + targetWidth + stepX,
|
|
1251
|
-
};
|
|
1252
|
-
const y = {
|
|
1253
|
-
bottom: childBottom + stepY,
|
|
1254
|
-
top: targetTopPosition - stepY - nodeHeight,
|
|
1255
|
-
rightCenter: childRightCenter - nodeHeight / 2 + stepY,
|
|
1256
|
-
rightBottom: targetTopPosition + targetHeight - nodeHeight + stepY,
|
|
1257
|
-
rightTop: targetTopPosition + stepY,
|
|
1258
|
-
};
|
|
1259
|
-
return { x, y };
|
|
1260
|
-
}
|
|
1261
1119
|
function getFlexVisiblePosition({ initialLeft, initialTop, isCompletelyVisibleX, isCompletelyVisibleY, nodeHeight, nodeWidth, xEnd, yEnd, }) {
|
|
1262
1120
|
if (!isCompletelyVisibleY(initialTop)) {
|
|
1263
1121
|
initialTop = yEnd - nodeHeight;
|
|
@@ -1268,8 +1126,6 @@ function getFlexVisiblePosition({ initialLeft, initialTop, isCompletelyVisibleX,
|
|
|
1268
1126
|
return {
|
|
1269
1127
|
top: initialTop,
|
|
1270
1128
|
left: initialLeft,
|
|
1271
|
-
bottom: yEnd - initialTop - nodeHeight,
|
|
1272
|
-
right: xEnd - initialLeft - nodeWidth,
|
|
1273
1129
|
placement: "flex",
|
|
1274
1130
|
};
|
|
1275
1131
|
}
|
|
@@ -1716,6 +1572,27 @@ function createRequestClientInstance(options) {
|
|
|
1716
1572
|
throw new Error("hasn't response");
|
|
1717
1573
|
}
|
|
1718
1574
|
if (!response.ok) {
|
|
1575
|
+
if (response.status === 304) {
|
|
1576
|
+
return responseWithStatus
|
|
1577
|
+
? {
|
|
1578
|
+
data: undefined,
|
|
1579
|
+
status: response.status,
|
|
1580
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
1581
|
+
}
|
|
1582
|
+
: undefined;
|
|
1583
|
+
}
|
|
1584
|
+
if (request.defaultResponse) {
|
|
1585
|
+
const defaultResponse = typeof request.defaultResponse === "function"
|
|
1586
|
+
? request.defaultResponse()
|
|
1587
|
+
: request.defaultResponse;
|
|
1588
|
+
return responseWithStatus
|
|
1589
|
+
? {
|
|
1590
|
+
data: defaultResponse,
|
|
1591
|
+
status: response.status,
|
|
1592
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
1593
|
+
}
|
|
1594
|
+
: defaultResponse;
|
|
1595
|
+
}
|
|
1719
1596
|
let result;
|
|
1720
1597
|
try {
|
|
1721
1598
|
const contentType = response.headers.get("content-type");
|
|
@@ -1760,14 +1637,6 @@ function createRequestClientInstance(options) {
|
|
|
1760
1637
|
}
|
|
1761
1638
|
: data;
|
|
1762
1639
|
}
|
|
1763
|
-
if (request.withoutResponse)
|
|
1764
|
-
return responseWithStatus
|
|
1765
|
-
? {
|
|
1766
|
-
data: true,
|
|
1767
|
-
status: response.status,
|
|
1768
|
-
headers: Object.fromEntries(response.headers.entries()),
|
|
1769
|
-
}
|
|
1770
|
-
: true;
|
|
1771
1640
|
const contentType = response.headers.get("content-type");
|
|
1772
1641
|
let result;
|
|
1773
1642
|
if (contentType?.includes?.("text")) {
|