@rededor/cura 2.0.0-alpha.5 → 2.0.0-alpha.8
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/assets/assets/icons/iconset-default-list.ts +1 -1
- package/dist/assets/assets/icons/iconset-default-tmp.svg +40 -0
- package/dist/assets/assets/icons/iconset-default.svg +1 -1
- package/dist/cjs/cura-accordion_21.cjs.entry.js +179 -69
- package/dist/cjs/cura-accordion_21.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-icons-view.entry.cjs.js.map +1 -1
- package/dist/cjs/index-BK9MSAiE.js.map +1 -1
- package/dist/collection/assets/icons/iconset-default-list.js +1 -1
- package/dist/collection/assets/icons/iconset-default-list.js.map +1 -1
- package/dist/collection/assets/icons/iconset-default-tmp.svg +40 -0
- package/dist/collection/assets/icons/iconset-default.svg +1 -1
- package/dist/collection/assets-raw/icons/default/autism.svg +3 -0
- package/dist/collection/assets-raw/icons/default/biop.svg +3 -0
- package/dist/collection/assets-raw/icons/default/lab.svg +3 -0
- package/dist/collection/assets-raw/icons/default/mobileClick.svg +3 -0
- package/dist/collection/assets-raw/icons/default/mobileRotate1.svg +3 -0
- package/dist/collection/assets-raw/icons/default/mobileRotate2.svg +3 -0
- package/dist/collection/assets-raw/icons/default/mobileRotate3.svg +3 -0
- package/dist/collection/assets-raw/icons/default/star.svg +3 -0
- package/dist/collection/assets-raw/icons/default/stop.svg +3 -0
- package/dist/collection/assets-raw/icons/default/xray.svg +3 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
- package/dist/components/cura-calendar.js +1 -1
- package/dist/components/cura-icons-view.js +1 -1
- package/dist/components/cura-icons-view.js.map +1 -1
- package/dist/components/cura-input-date.js +2 -2
- package/dist/components/cura-select.js +1 -1
- package/dist/components/{p-Cs5scX1L.js → p-CvdWbsfO.js} +181 -71
- package/dist/components/p-CvdWbsfO.js.map +1 -0
- package/dist/components/p-D1cPOZpG.js.map +1 -1
- package/dist/components/{p-D6PpdPRJ.js → p-DETZu2ie.js} +3 -3
- package/dist/components/{p-D6PpdPRJ.js.map → p-DETZu2ie.js.map} +1 -1
- package/dist/cura/cura-icons-view.entry.esm.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/{p-6dfc7c02.entry.js → p-2ab58335.entry.js} +2 -2
- package/dist/cura/p-2ab58335.entry.js.map +1 -0
- package/dist/cura/p-76603652.entry.js +2 -0
- package/dist/cura/p-76603652.entry.js.map +1 -0
- package/dist/cura/p-PPMZr_VE.js.map +1 -1
- package/dist/esm/cura-accordion_21.entry.js +179 -69
- package/dist/esm/cura-accordion_21.entry.js.map +1 -1
- package/dist/esm/cura-icons-view.entry.js +1 -1
- package/dist/esm/cura-icons-view.entry.js.map +1 -1
- package/dist/esm/index-OdKytJIH.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/p-Cs5scX1L.js.map +0 -1
- package/dist/cura/p-2632183e.entry.js +0 -2
- package/dist/cura/p-2632183e.entry.js.map +0 -1
- package/dist/cura/p-6dfc7c02.entry.js.map +0 -1
|
@@ -43,8 +43,9 @@ function getOppositeAxis(axis) {
|
|
|
43
43
|
function getAxisLength(axis) {
|
|
44
44
|
return axis === 'y' ? 'height' : 'width';
|
|
45
45
|
}
|
|
46
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
46
47
|
function getSideAxis(placement) {
|
|
47
|
-
return
|
|
48
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
48
49
|
}
|
|
49
50
|
function getAlignmentAxis(placement) {
|
|
50
51
|
return getOppositeAxis(getSideAxis(placement));
|
|
@@ -69,19 +70,19 @@ function getExpandedPlacements(placement) {
|
|
|
69
70
|
function getOppositeAlignmentPlacement(placement) {
|
|
70
71
|
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
71
72
|
}
|
|
73
|
+
const lrPlacement = ['left', 'right'];
|
|
74
|
+
const rlPlacement = ['right', 'left'];
|
|
75
|
+
const tbPlacement = ['top', 'bottom'];
|
|
76
|
+
const btPlacement = ['bottom', 'top'];
|
|
72
77
|
function getSideList(side, isStart, rtl) {
|
|
73
|
-
const lr = ['left', 'right'];
|
|
74
|
-
const rl = ['right', 'left'];
|
|
75
|
-
const tb = ['top', 'bottom'];
|
|
76
|
-
const bt = ['bottom', 'top'];
|
|
77
78
|
switch (side) {
|
|
78
79
|
case 'top':
|
|
79
80
|
case 'bottom':
|
|
80
|
-
if (rtl) return isStart ?
|
|
81
|
-
return isStart ?
|
|
81
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
82
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
82
83
|
case 'left':
|
|
83
84
|
case 'right':
|
|
84
|
-
return isStart ?
|
|
85
|
+
return isStart ? tbPlacement : btPlacement;
|
|
85
86
|
default:
|
|
86
87
|
return [];
|
|
87
88
|
}
|
|
@@ -419,16 +420,22 @@ const flip$1 = function (options) {
|
|
|
419
420
|
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
420
421
|
const nextPlacement = placements[nextIndex];
|
|
421
422
|
if (nextPlacement) {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
423
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
424
|
+
if (!ignoreCrossAxisOverflow ||
|
|
425
|
+
// We leave the current main axis only if every placement on that axis
|
|
426
|
+
// overflows the main axis.
|
|
427
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
428
|
+
// Try next placement and re-run the lifecycle.
|
|
429
|
+
return {
|
|
430
|
+
data: {
|
|
431
|
+
index: nextIndex,
|
|
432
|
+
overflows: overflowsData
|
|
433
|
+
},
|
|
434
|
+
reset: {
|
|
435
|
+
placement: nextPlacement
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
}
|
|
432
439
|
}
|
|
433
440
|
|
|
434
441
|
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
@@ -474,6 +481,8 @@ const flip$1 = function (options) {
|
|
|
474
481
|
};
|
|
475
482
|
};
|
|
476
483
|
|
|
484
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
485
|
+
|
|
477
486
|
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
478
487
|
// Derivable.
|
|
479
488
|
|
|
@@ -487,7 +496,7 @@ async function convertValueToCoords(state, options) {
|
|
|
487
496
|
const side = getSide(placement);
|
|
488
497
|
const alignment = getAlignment(placement);
|
|
489
498
|
const isVertical = getSideAxis(placement) === 'y';
|
|
490
|
-
const mainAxisMulti =
|
|
499
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
491
500
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
492
501
|
const rawValue = evaluate(options, state);
|
|
493
502
|
|
|
@@ -501,10 +510,9 @@ async function convertValueToCoords(state, options) {
|
|
|
501
510
|
crossAxis: 0,
|
|
502
511
|
alignmentAxis: null
|
|
503
512
|
} : {
|
|
504
|
-
mainAxis: 0,
|
|
505
|
-
crossAxis: 0,
|
|
506
|
-
alignmentAxis:
|
|
507
|
-
...rawValue
|
|
513
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
514
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
515
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
508
516
|
};
|
|
509
517
|
if (alignment && typeof alignmentAxis === 'number') {
|
|
510
518
|
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
@@ -626,7 +634,11 @@ const shift$1 = function (options) {
|
|
|
626
634
|
...limitedCoords,
|
|
627
635
|
data: {
|
|
628
636
|
x: limitedCoords.x - x,
|
|
629
|
-
y: limitedCoords.y - y
|
|
637
|
+
y: limitedCoords.y - y,
|
|
638
|
+
enabled: {
|
|
639
|
+
[mainAxis]: checkMainAxis,
|
|
640
|
+
[crossAxis]: checkCrossAxis
|
|
641
|
+
}
|
|
630
642
|
}
|
|
631
643
|
};
|
|
632
644
|
}
|
|
@@ -647,6 +659,7 @@ const size$1 = function (options) {
|
|
|
647
659
|
name: 'size',
|
|
648
660
|
options,
|
|
649
661
|
async fn(state) {
|
|
662
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
650
663
|
const {
|
|
651
664
|
placement,
|
|
652
665
|
rects,
|
|
@@ -681,10 +694,11 @@ const size$1 = function (options) {
|
|
|
681
694
|
const noShift = !state.middlewareData.shift;
|
|
682
695
|
let availableHeight = overflowAvailableHeight;
|
|
683
696
|
let availableWidth = overflowAvailableWidth;
|
|
684
|
-
if (
|
|
685
|
-
availableWidth =
|
|
686
|
-
}
|
|
687
|
-
|
|
697
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
698
|
+
availableWidth = maximumClippingWidth;
|
|
699
|
+
}
|
|
700
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
701
|
+
availableHeight = maximumClippingHeight;
|
|
688
702
|
}
|
|
689
703
|
if (noShift && !alignment) {
|
|
690
704
|
const xMin = max(overflow.left, 0);
|
|
@@ -715,6 +729,9 @@ const size$1 = function (options) {
|
|
|
715
729
|
};
|
|
716
730
|
};
|
|
717
731
|
|
|
732
|
+
function hasWindow() {
|
|
733
|
+
return typeof window !== 'undefined';
|
|
734
|
+
}
|
|
718
735
|
function getNodeName(node) {
|
|
719
736
|
if (isNode(node)) {
|
|
720
737
|
return (node.nodeName || '').toLowerCase();
|
|
@@ -733,48 +750,63 @@ function getDocumentElement(node) {
|
|
|
733
750
|
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
734
751
|
}
|
|
735
752
|
function isNode(value) {
|
|
753
|
+
if (!hasWindow()) {
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
736
756
|
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
737
757
|
}
|
|
738
758
|
function isElement(value) {
|
|
759
|
+
if (!hasWindow()) {
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
739
762
|
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
740
763
|
}
|
|
741
764
|
function isHTMLElement(value) {
|
|
765
|
+
if (!hasWindow()) {
|
|
766
|
+
return false;
|
|
767
|
+
}
|
|
742
768
|
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
743
769
|
}
|
|
744
770
|
function isShadowRoot(value) {
|
|
745
|
-
|
|
746
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
771
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
747
772
|
return false;
|
|
748
773
|
}
|
|
749
774
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
750
775
|
}
|
|
776
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
751
777
|
function isOverflowElement(element) {
|
|
752
778
|
const {
|
|
753
779
|
overflow,
|
|
754
780
|
overflowX,
|
|
755
781
|
overflowY,
|
|
756
782
|
display
|
|
757
|
-
} = getComputedStyle(element);
|
|
758
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !
|
|
783
|
+
} = getComputedStyle$1(element);
|
|
784
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
759
785
|
}
|
|
786
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
760
787
|
function isTableElement(element) {
|
|
761
|
-
return
|
|
788
|
+
return tableElements.has(getNodeName(element));
|
|
762
789
|
}
|
|
790
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
763
791
|
function isTopLayer(element) {
|
|
764
|
-
return
|
|
792
|
+
return topLayerSelectors.some(selector => {
|
|
765
793
|
try {
|
|
766
794
|
return element.matches(selector);
|
|
767
|
-
} catch (
|
|
795
|
+
} catch (_e) {
|
|
768
796
|
return false;
|
|
769
797
|
}
|
|
770
798
|
});
|
|
771
799
|
}
|
|
800
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
801
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
802
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
772
803
|
function isContainingBlock(elementOrCss) {
|
|
773
804
|
const webkit = isWebKit();
|
|
774
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
805
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
775
806
|
|
|
776
807
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
777
|
-
|
|
808
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
809
|
+
return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
|
|
778
810
|
}
|
|
779
811
|
function getContainingBlock(element) {
|
|
780
812
|
let currentNode = getParentNode(element);
|
|
@@ -792,10 +824,11 @@ function isWebKit() {
|
|
|
792
824
|
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
793
825
|
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
794
826
|
}
|
|
827
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
795
828
|
function isLastTraversableNode(node) {
|
|
796
|
-
return
|
|
829
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
797
830
|
}
|
|
798
|
-
function getComputedStyle(element) {
|
|
831
|
+
function getComputedStyle$1(element) {
|
|
799
832
|
return getWindow(element).getComputedStyle(element);
|
|
800
833
|
}
|
|
801
834
|
function getNodeScroll(element) {
|
|
@@ -847,13 +880,17 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
847
880
|
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
848
881
|
const win = getWindow(scrollableAncestor);
|
|
849
882
|
if (isBody) {
|
|
850
|
-
|
|
883
|
+
const frameElement = getFrameElement(win);
|
|
884
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
851
885
|
}
|
|
852
886
|
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
853
887
|
}
|
|
888
|
+
function getFrameElement(win) {
|
|
889
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
890
|
+
}
|
|
854
891
|
|
|
855
892
|
function getCssDimensions(element) {
|
|
856
|
-
const css = getComputedStyle(element);
|
|
893
|
+
const css = getComputedStyle$1(element);
|
|
857
894
|
// In testing environments, the `width` and `height` properties are empty
|
|
858
895
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
859
896
|
let width = parseFloat(css.width) || 0;
|
|
@@ -954,11 +991,11 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
954
991
|
const win = getWindow(domElement);
|
|
955
992
|
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
956
993
|
let currentWin = win;
|
|
957
|
-
let currentIFrame = currentWin
|
|
994
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
958
995
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
959
996
|
const iframeScale = getScale(currentIFrame);
|
|
960
997
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
961
|
-
const css = getComputedStyle(currentIFrame);
|
|
998
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
962
999
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
963
1000
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
964
1001
|
x *= iframeScale.x;
|
|
@@ -968,7 +1005,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
968
1005
|
x += left;
|
|
969
1006
|
y += top;
|
|
970
1007
|
currentWin = getWindow(currentIFrame);
|
|
971
|
-
currentIFrame = currentWin
|
|
1008
|
+
currentIFrame = getFrameElement(currentWin);
|
|
972
1009
|
}
|
|
973
1010
|
}
|
|
974
1011
|
return rectToClientRect({
|
|
@@ -979,6 +1016,26 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
979
1016
|
});
|
|
980
1017
|
}
|
|
981
1018
|
|
|
1019
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1020
|
+
// incorrect for RTL.
|
|
1021
|
+
function getWindowScrollBarX(element, rect) {
|
|
1022
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1023
|
+
if (!rect) {
|
|
1024
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1025
|
+
}
|
|
1026
|
+
return rect.left + leftScroll;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
1030
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
1031
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
1032
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
1033
|
+
return {
|
|
1034
|
+
x,
|
|
1035
|
+
y
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
|
|
982
1039
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
983
1040
|
let {
|
|
984
1041
|
elements,
|
|
@@ -1010,11 +1067,12 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1010
1067
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1011
1068
|
}
|
|
1012
1069
|
}
|
|
1070
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1013
1071
|
return {
|
|
1014
1072
|
width: rect.width * scale.x,
|
|
1015
1073
|
height: rect.height * scale.y,
|
|
1016
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1017
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
1074
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1075
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1018
1076
|
};
|
|
1019
1077
|
}
|
|
1020
1078
|
|
|
@@ -1022,12 +1080,6 @@ function getClientRects(element) {
|
|
|
1022
1080
|
return Array.from(element.getClientRects());
|
|
1023
1081
|
}
|
|
1024
1082
|
|
|
1025
|
-
function getWindowScrollBarX(element) {
|
|
1026
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1027
|
-
// incorrect for RTL.
|
|
1028
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
1083
|
// Gets the entire size of the scrollable document area, even extending outside
|
|
1032
1084
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1033
1085
|
function getDocumentRect(element) {
|
|
@@ -1038,7 +1090,7 @@ function getDocumentRect(element) {
|
|
|
1038
1090
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1039
1091
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1040
1092
|
const y = -scroll.scrollTop;
|
|
1041
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
1093
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
1042
1094
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1043
1095
|
}
|
|
1044
1096
|
return {
|
|
@@ -1049,6 +1101,10 @@ function getDocumentRect(element) {
|
|
|
1049
1101
|
};
|
|
1050
1102
|
}
|
|
1051
1103
|
|
|
1104
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
1105
|
+
// calculation is affected by unusual styles.
|
|
1106
|
+
// Most scrollbars leave 15-18px of space.
|
|
1107
|
+
const SCROLLBAR_MAX = 25;
|
|
1052
1108
|
function getViewportRect(element, strategy) {
|
|
1053
1109
|
const win = getWindow(element);
|
|
1054
1110
|
const html = getDocumentElement(element);
|
|
@@ -1066,6 +1122,24 @@ function getViewportRect(element, strategy) {
|
|
|
1066
1122
|
y = visualViewport.offsetTop;
|
|
1067
1123
|
}
|
|
1068
1124
|
}
|
|
1125
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
1126
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
1127
|
+
// visual width of the <html> but this is not considered in the size
|
|
1128
|
+
// of `html.clientWidth`.
|
|
1129
|
+
if (windowScrollbarX <= 0) {
|
|
1130
|
+
const doc = html.ownerDocument;
|
|
1131
|
+
const body = doc.body;
|
|
1132
|
+
const bodyStyles = getComputedStyle(body);
|
|
1133
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1134
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1135
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
1136
|
+
width -= clippingStableScrollbarWidth;
|
|
1137
|
+
}
|
|
1138
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
1139
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
1140
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
1141
|
+
width += windowScrollbarX;
|
|
1142
|
+
}
|
|
1069
1143
|
return {
|
|
1070
1144
|
width,
|
|
1071
1145
|
height,
|
|
@@ -1074,6 +1148,7 @@ function getViewportRect(element, strategy) {
|
|
|
1074
1148
|
};
|
|
1075
1149
|
}
|
|
1076
1150
|
|
|
1151
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
1077
1152
|
// Returns the inner client rect, subtracting scrollbars if present.
|
|
1078
1153
|
function getInnerBoundingClientRect(element, strategy) {
|
|
1079
1154
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
@@ -1102,9 +1177,10 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1102
1177
|
} else {
|
|
1103
1178
|
const visualOffsets = getVisualOffsets(element);
|
|
1104
1179
|
rect = {
|
|
1105
|
-
...clippingAncestor,
|
|
1106
1180
|
x: clippingAncestor.x - visualOffsets.x,
|
|
1107
|
-
y: clippingAncestor.y - visualOffsets.y
|
|
1181
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1182
|
+
width: clippingAncestor.width,
|
|
1183
|
+
height: clippingAncestor.height
|
|
1108
1184
|
};
|
|
1109
1185
|
}
|
|
1110
1186
|
return rectToClientRect(rect);
|
|
@@ -1114,7 +1190,7 @@ function hasFixedPositionAncestor(element, stopNode) {
|
|
|
1114
1190
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1115
1191
|
return false;
|
|
1116
1192
|
}
|
|
1117
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1193
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1118
1194
|
}
|
|
1119
1195
|
|
|
1120
1196
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -1127,17 +1203,17 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1127
1203
|
}
|
|
1128
1204
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1129
1205
|
let currentContainingBlockComputedStyle = null;
|
|
1130
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
1206
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1131
1207
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1132
1208
|
|
|
1133
1209
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1134
1210
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1135
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
1211
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1136
1212
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1137
1213
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1138
1214
|
currentContainingBlockComputedStyle = null;
|
|
1139
1215
|
}
|
|
1140
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle &&
|
|
1216
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1141
1217
|
if (shouldDropCurrentNode) {
|
|
1142
1218
|
// Drop non-containing blocks.
|
|
1143
1219
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -1200,6 +1276,12 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1200
1276
|
scrollTop: 0
|
|
1201
1277
|
};
|
|
1202
1278
|
const offsets = createCoords(0);
|
|
1279
|
+
|
|
1280
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
1281
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
1282
|
+
function setLeftRTLScrollbarOffset() {
|
|
1283
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1284
|
+
}
|
|
1203
1285
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1204
1286
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1205
1287
|
scroll = getNodeScroll(offsetParent);
|
|
@@ -1209,11 +1291,15 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1209
1291
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1210
1292
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1211
1293
|
} else if (documentElement) {
|
|
1212
|
-
|
|
1294
|
+
setLeftRTLScrollbarOffset();
|
|
1213
1295
|
}
|
|
1214
1296
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1297
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1298
|
+
setLeftRTLScrollbarOffset();
|
|
1299
|
+
}
|
|
1300
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1301
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1302
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1217
1303
|
return {
|
|
1218
1304
|
x,
|
|
1219
1305
|
y,
|
|
@@ -1223,17 +1309,26 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1223
1309
|
}
|
|
1224
1310
|
|
|
1225
1311
|
function isStaticPositioned(element) {
|
|
1226
|
-
return getComputedStyle(element).position === 'static';
|
|
1312
|
+
return getComputedStyle$1(element).position === 'static';
|
|
1227
1313
|
}
|
|
1228
1314
|
|
|
1229
1315
|
function getTrueOffsetParent(element, polyfill) {
|
|
1230
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1316
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
1231
1317
|
return null;
|
|
1232
1318
|
}
|
|
1233
1319
|
if (polyfill) {
|
|
1234
1320
|
return polyfill(element);
|
|
1235
1321
|
}
|
|
1236
|
-
|
|
1322
|
+
let rawOffsetParent = element.offsetParent;
|
|
1323
|
+
|
|
1324
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
1325
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
1326
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
1327
|
+
// non-static.
|
|
1328
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1329
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1330
|
+
}
|
|
1331
|
+
return rawOffsetParent;
|
|
1237
1332
|
}
|
|
1238
1333
|
|
|
1239
1334
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
@@ -1279,7 +1374,7 @@ const getElementRects = async function (data) {
|
|
|
1279
1374
|
};
|
|
1280
1375
|
|
|
1281
1376
|
function isRTL(element) {
|
|
1282
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
1377
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
1283
1378
|
}
|
|
1284
1379
|
|
|
1285
1380
|
const platform = {
|
|
@@ -1295,6 +1390,10 @@ const platform = {
|
|
|
1295
1390
|
isRTL
|
|
1296
1391
|
};
|
|
1297
1392
|
|
|
1393
|
+
function rectsAreEqual(a, b) {
|
|
1394
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1298
1397
|
// https://samthor.au/2021/observing-dom/
|
|
1299
1398
|
function observeMove(element, onMove) {
|
|
1300
1399
|
let io = null;
|
|
@@ -1314,12 +1413,13 @@ function observeMove(element, onMove) {
|
|
|
1314
1413
|
threshold = 1;
|
|
1315
1414
|
}
|
|
1316
1415
|
cleanup();
|
|
1416
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1317
1417
|
const {
|
|
1318
1418
|
left,
|
|
1319
1419
|
top,
|
|
1320
1420
|
width,
|
|
1321
1421
|
height
|
|
1322
|
-
} =
|
|
1422
|
+
} = elementRectForRootMargin;
|
|
1323
1423
|
if (!skip) {
|
|
1324
1424
|
onMove();
|
|
1325
1425
|
}
|
|
@@ -1352,6 +1452,16 @@ function observeMove(element, onMove) {
|
|
|
1352
1452
|
refresh(false, ratio);
|
|
1353
1453
|
}
|
|
1354
1454
|
}
|
|
1455
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
1456
|
+
// It's possible that even though the ratio is reported as 1, the
|
|
1457
|
+
// element is not actually fully within the IntersectionObserver's root
|
|
1458
|
+
// area anymore. This can happen under performance constraints. This may
|
|
1459
|
+
// be a bug in the browser's IntersectionObserver implementation. To
|
|
1460
|
+
// work around this, we compare the element's bounding rect now with
|
|
1461
|
+
// what it was at the time we created the IntersectionObserver. If they
|
|
1462
|
+
// are not equal then the element moved, so we refresh.
|
|
1463
|
+
refresh();
|
|
1464
|
+
}
|
|
1355
1465
|
isFirstUpdate = false;
|
|
1356
1466
|
}
|
|
1357
1467
|
|
|
@@ -1363,7 +1473,7 @@ function observeMove(element, onMove) {
|
|
|
1363
1473
|
// Handle <iframe>s
|
|
1364
1474
|
root: root.ownerDocument
|
|
1365
1475
|
});
|
|
1366
|
-
} catch (
|
|
1476
|
+
} catch (_e) {
|
|
1367
1477
|
io = new IntersectionObserver(handleObserve, options);
|
|
1368
1478
|
}
|
|
1369
1479
|
io.observe(element);
|
|
@@ -1429,7 +1539,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1429
1539
|
}
|
|
1430
1540
|
function frameLoop() {
|
|
1431
1541
|
const nextRefRect = getBoundingClientRect(reference);
|
|
1432
|
-
if (prevRefRect && (
|
|
1542
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1433
1543
|
update();
|
|
1434
1544
|
}
|
|
1435
1545
|
prevRefRect = nextRefRect;
|
|
@@ -2032,6 +2142,6 @@ function defineCustomElement() {
|
|
|
2032
2142
|
}
|
|
2033
2143
|
|
|
2034
2144
|
export { CuraSelect as C, defineCustomElement as d };
|
|
2035
|
-
//# sourceMappingURL=p-
|
|
2145
|
+
//# sourceMappingURL=p-CvdWbsfO.js.map
|
|
2036
2146
|
|
|
2037
|
-
//# sourceMappingURL=p-
|
|
2147
|
+
//# sourceMappingURL=p-CvdWbsfO.js.map
|