vrembem 1.35.1 → 1.37.0
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/LICENSE +1 -1
- package/dev/scripts.esm.js +86 -26
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +86 -26
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.js +82 -22
- package/dev/scripts.modern.js.map +1 -1
- package/dev/scripts.umd.js +86 -26
- package/dev/scripts.umd.js.map +1 -1
- package/dev/styles.css +49 -6
- package/dev/styles.css.map +1 -1
- package/dist/scripts.esm.js +1 -1
- package/dist/scripts.esm.js.map +1 -1
- package/dist/scripts.js +1 -1
- package/dist/scripts.js.map +1 -1
- package/dist/scripts.modern.js +1 -1
- package/dist/scripts.modern.js.map +1 -1
- package/dist/scripts.umd.js +1 -1
- package/dist/scripts.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +27 -27
package/dev/scripts.umd.js
CHANGED
|
@@ -66,6 +66,8 @@
|
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
var focusableSelectors = ['a[href]:not([tabindex^="-"])', 'area[href]:not([tabindex^="-"])', 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])', 'input[type="radio"]:not([disabled]):not([tabindex^="-"])', 'select:not([disabled]):not([tabindex^="-"])', 'textarea:not([disabled]):not([tabindex^="-"])', 'button:not([disabled]):not([tabindex^="-"])', 'iframe:not([tabindex^="-"])', 'audio[controls]:not([tabindex^="-"])', 'video[controls]:not([tabindex^="-"])', '[contenteditable]:not([tabindex^="-"])', '[tabindex]:not([tabindex^="-"])'];
|
|
70
|
+
|
|
69
71
|
var focusTarget = function focusTarget(target, settings) {
|
|
70
72
|
var innerFocus = target.querySelector("[data-" + settings.dataFocus + "]");
|
|
71
73
|
|
|
@@ -118,6 +120,28 @@
|
|
|
118
120
|
this.target = null;
|
|
119
121
|
};
|
|
120
122
|
|
|
123
|
+
_proto.refresh = function refresh() {
|
|
124
|
+
// Check if a target has been set
|
|
125
|
+
if (!this.target) return; // Remove existing events
|
|
126
|
+
|
|
127
|
+
this.target.removeEventListener('keydown', this.__handlerFocusTrap);
|
|
128
|
+
this.target.removeEventListener('keydown', this.handlerFocusLock); // Get the focusable elements
|
|
129
|
+
|
|
130
|
+
this.focusable = this.getFocusable(); // Setup the focus handlers based on focusable length
|
|
131
|
+
|
|
132
|
+
if (this.focusable.length) {
|
|
133
|
+
// If there are focusable elements, setup focus trap
|
|
134
|
+
this.focusableFirst = this.focusable[0];
|
|
135
|
+
this.focusableLast = this.focusable[this.focusable.length - 1];
|
|
136
|
+
this.target.addEventListener('keydown', this.__handlerFocusTrap);
|
|
137
|
+
} else {
|
|
138
|
+
// If there are no focusable elements, setup focus lock
|
|
139
|
+
this.focusableFirst = null;
|
|
140
|
+
this.focusableLast = null;
|
|
141
|
+
this.target.addEventListener('keydown', this.handlerFocusLock);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
121
145
|
_proto.handlerFocusTrap = function handlerFocusTrap(event) {
|
|
122
146
|
var isTab = event.key === 'Tab' || event.keyCode === 9;
|
|
123
147
|
if (!isTab) return;
|
|
@@ -144,7 +168,7 @@
|
|
|
144
168
|
var focusable = [];
|
|
145
169
|
var initFocus = document.activeElement;
|
|
146
170
|
var initScrollTop = this.inner ? this.inner.scrollTop : 0;
|
|
147
|
-
this.target.querySelectorAll('
|
|
171
|
+
this.target.querySelectorAll(focusableSelectors.join(',')).forEach(function (el) {
|
|
148
172
|
el.focus();
|
|
149
173
|
|
|
150
174
|
if (el === document.activeElement) {
|
|
@@ -879,6 +903,7 @@
|
|
|
879
903
|
|
|
880
904
|
focusTarget(drawer, _this4.settings);
|
|
881
905
|
drawer.dispatchEvent(new CustomEvent(_this4.settings.customEventPrefix + 'opened', {
|
|
906
|
+
detail: _this4,
|
|
882
907
|
bubbles: true
|
|
883
908
|
}));
|
|
884
909
|
_this4.working = false;
|
|
@@ -917,6 +942,7 @@
|
|
|
917
942
|
_this6.focusTrap.destroy();
|
|
918
943
|
|
|
919
944
|
drawer.dispatchEvent(new CustomEvent(_this6.settings.customEventPrefix + 'closed', {
|
|
945
|
+
detail: _this6,
|
|
920
946
|
bubbles: true
|
|
921
947
|
}));
|
|
922
948
|
_this6.working = false;
|
|
@@ -963,10 +989,6 @@
|
|
|
963
989
|
|
|
964
990
|
var handlerClick$1 = function handlerClick(event) {
|
|
965
991
|
try {
|
|
966
|
-
var _exit2;
|
|
967
|
-
|
|
968
|
-
var _this2 = this;
|
|
969
|
-
|
|
970
992
|
var _temp3 = function _temp3(_result) {
|
|
971
993
|
if (_exit2) return _result;
|
|
972
994
|
|
|
@@ -985,6 +1007,10 @@
|
|
|
985
1007
|
}
|
|
986
1008
|
};
|
|
987
1009
|
|
|
1010
|
+
var _exit2;
|
|
1011
|
+
|
|
1012
|
+
var _this2 = this;
|
|
1013
|
+
|
|
988
1014
|
// Working catch
|
|
989
1015
|
if (_this2.working) return Promise.resolve(); // Trigger click
|
|
990
1016
|
|
|
@@ -1151,6 +1177,7 @@
|
|
|
1151
1177
|
focusTarget(modal, _this2.settings);
|
|
1152
1178
|
setInert(true, _this2.settings.selectorInert);
|
|
1153
1179
|
modal.dispatchEvent(new CustomEvent(_this2.settings.customEventPrefix + 'opened', {
|
|
1180
|
+
detail: _this2,
|
|
1154
1181
|
bubbles: true
|
|
1155
1182
|
}));
|
|
1156
1183
|
_this2.working = false;
|
|
@@ -1184,6 +1211,7 @@
|
|
|
1184
1211
|
_this4.focusTrap.destroy();
|
|
1185
1212
|
|
|
1186
1213
|
modal.dispatchEvent(new CustomEvent(_this4.settings.customEventPrefix + 'closed', {
|
|
1214
|
+
detail: _this4,
|
|
1187
1215
|
bubbles: true
|
|
1188
1216
|
}));
|
|
1189
1217
|
_this4.working = false;
|
|
@@ -1599,17 +1627,39 @@
|
|
|
1599
1627
|
return placement.split('-')[0];
|
|
1600
1628
|
}
|
|
1601
1629
|
|
|
1602
|
-
|
|
1630
|
+
// import { isHTMLElement } from './instanceOf';
|
|
1631
|
+
function getBoundingClientRect(element, // eslint-disable-next-line unused-imports/no-unused-vars
|
|
1632
|
+
includeScale) {
|
|
1633
|
+
|
|
1603
1634
|
var rect = element.getBoundingClientRect();
|
|
1635
|
+
var scaleX = 1;
|
|
1636
|
+
var scaleY = 1; // FIXME:
|
|
1637
|
+
// `offsetWidth` returns an integer while `getBoundingClientRect`
|
|
1638
|
+
// returns a float. This results in `scaleX` or `scaleY` being
|
|
1639
|
+
// non-1 when it should be for elements that aren't a full pixel in
|
|
1640
|
+
// width or height.
|
|
1641
|
+
// if (isHTMLElement(element) && includeScale) {
|
|
1642
|
+
// const offsetHeight = element.offsetHeight;
|
|
1643
|
+
// const offsetWidth = element.offsetWidth;
|
|
1644
|
+
// // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
|
|
1645
|
+
// // Fallback to 1 in case both values are `0`
|
|
1646
|
+
// if (offsetWidth > 0) {
|
|
1647
|
+
// scaleX = rect.width / offsetWidth || 1;
|
|
1648
|
+
// }
|
|
1649
|
+
// if (offsetHeight > 0) {
|
|
1650
|
+
// scaleY = rect.height / offsetHeight || 1;
|
|
1651
|
+
// }
|
|
1652
|
+
// }
|
|
1653
|
+
|
|
1604
1654
|
return {
|
|
1605
|
-
width: rect.width,
|
|
1606
|
-
height: rect.height,
|
|
1607
|
-
top: rect.top,
|
|
1608
|
-
right: rect.right,
|
|
1609
|
-
bottom: rect.bottom,
|
|
1610
|
-
left: rect.left,
|
|
1611
|
-
x: rect.left,
|
|
1612
|
-
y: rect.top
|
|
1655
|
+
width: rect.width / scaleX,
|
|
1656
|
+
height: rect.height / scaleY,
|
|
1657
|
+
top: rect.top / scaleY,
|
|
1658
|
+
right: rect.right / scaleX,
|
|
1659
|
+
bottom: rect.bottom / scaleY,
|
|
1660
|
+
left: rect.left / scaleX,
|
|
1661
|
+
x: rect.left / scaleX,
|
|
1662
|
+
y: rect.top / scaleY
|
|
1613
1663
|
};
|
|
1614
1664
|
}
|
|
1615
1665
|
|
|
@@ -1864,6 +1914,10 @@
|
|
|
1864
1914
|
requiresIfExists: ['preventOverflow']
|
|
1865
1915
|
};
|
|
1866
1916
|
|
|
1917
|
+
function getVariation(placement) {
|
|
1918
|
+
return placement.split('-')[1];
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1867
1921
|
var unsetSides = {
|
|
1868
1922
|
top: 'auto',
|
|
1869
1923
|
right: 'auto',
|
|
@@ -1890,6 +1944,7 @@
|
|
|
1890
1944
|
var popper = _ref2.popper,
|
|
1891
1945
|
popperRect = _ref2.popperRect,
|
|
1892
1946
|
placement = _ref2.placement,
|
|
1947
|
+
variation = _ref2.variation,
|
|
1893
1948
|
offsets = _ref2.offsets,
|
|
1894
1949
|
position = _ref2.position,
|
|
1895
1950
|
gpuAcceleration = _ref2.gpuAcceleration,
|
|
@@ -1916,7 +1971,7 @@
|
|
|
1916
1971
|
if (offsetParent === getWindow(popper)) {
|
|
1917
1972
|
offsetParent = getDocumentElement(popper);
|
|
1918
1973
|
|
|
1919
|
-
if (getComputedStyle$1(offsetParent).position !== 'static') {
|
|
1974
|
+
if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') {
|
|
1920
1975
|
heightProp = 'scrollHeight';
|
|
1921
1976
|
widthProp = 'scrollWidth';
|
|
1922
1977
|
}
|
|
@@ -1925,14 +1980,14 @@
|
|
|
1925
1980
|
|
|
1926
1981
|
offsetParent = offsetParent;
|
|
1927
1982
|
|
|
1928
|
-
if (placement === top) {
|
|
1983
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
1929
1984
|
sideY = bottom; // $FlowFixMe[prop-missing]
|
|
1930
1985
|
|
|
1931
1986
|
y -= offsetParent[heightProp] - popperRect.height;
|
|
1932
1987
|
y *= gpuAcceleration ? 1 : -1;
|
|
1933
1988
|
}
|
|
1934
1989
|
|
|
1935
|
-
if (placement === left) {
|
|
1990
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
1936
1991
|
sideX = right; // $FlowFixMe[prop-missing]
|
|
1937
1992
|
|
|
1938
1993
|
x -= offsetParent[widthProp] - popperRect.width;
|
|
@@ -1947,7 +2002,7 @@
|
|
|
1947
2002
|
if (gpuAcceleration) {
|
|
1948
2003
|
var _Object$assign;
|
|
1949
2004
|
|
|
1950
|
-
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1)
|
|
2005
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
1951
2006
|
}
|
|
1952
2007
|
|
|
1953
2008
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
@@ -1965,6 +2020,7 @@
|
|
|
1965
2020
|
|
|
1966
2021
|
var commonStyles = {
|
|
1967
2022
|
placement: getBasePlacement(state.placement),
|
|
2023
|
+
variation: getVariation(state.placement),
|
|
1968
2024
|
popper: state.elements.popper,
|
|
1969
2025
|
popperRect: state.rects.popper,
|
|
1970
2026
|
gpuAcceleration: gpuAcceleration
|
|
@@ -2267,10 +2323,6 @@
|
|
|
2267
2323
|
return clippingRect;
|
|
2268
2324
|
}
|
|
2269
2325
|
|
|
2270
|
-
function getVariation(placement) {
|
|
2271
|
-
return placement.split('-')[1];
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
2326
|
function computeOffsets(_ref) {
|
|
2275
2327
|
var reference = _ref.reference,
|
|
2276
2328
|
element = _ref.element,
|
|
@@ -2356,11 +2408,10 @@
|
|
|
2356
2408
|
padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
2357
2409
|
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
2358
2410
|
var altContext = elementContext === popper ? reference : popper;
|
|
2359
|
-
var referenceElement = state.elements.reference;
|
|
2360
2411
|
var popperRect = state.rects.popper;
|
|
2361
2412
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
2362
2413
|
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
|
2363
|
-
var referenceClientRect = getBoundingClientRect(
|
|
2414
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
2364
2415
|
var popperOffsets = computeOffsets({
|
|
2365
2416
|
reference: referenceClientRect,
|
|
2366
2417
|
element: popperRect,
|
|
@@ -2837,16 +2888,24 @@
|
|
|
2837
2888
|
}
|
|
2838
2889
|
}
|
|
2839
2890
|
|
|
2891
|
+
function isElementScaled(element) {
|
|
2892
|
+
var rect = element.getBoundingClientRect();
|
|
2893
|
+
var scaleX = rect.width / element.offsetWidth || 1;
|
|
2894
|
+
var scaleY = rect.height / element.offsetHeight || 1;
|
|
2895
|
+
return scaleX !== 1 || scaleY !== 1;
|
|
2896
|
+
} // Returns the composite rect of an element relative to its offsetParent.
|
|
2840
2897
|
// Composite means it takes into account transforms as well as layout.
|
|
2841
2898
|
|
|
2899
|
+
|
|
2842
2900
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
2843
2901
|
if (isFixed === void 0) {
|
|
2844
2902
|
isFixed = false;
|
|
2845
2903
|
}
|
|
2846
2904
|
|
|
2905
|
+
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2906
|
+
isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
2847
2907
|
var documentElement = getDocumentElement(offsetParent);
|
|
2848
2908
|
var rect = getBoundingClientRect(elementOrVirtualElement);
|
|
2849
|
-
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2850
2909
|
var scroll = {
|
|
2851
2910
|
scrollLeft: 0,
|
|
2852
2911
|
scrollTop: 0
|
|
@@ -3000,7 +3059,8 @@
|
|
|
3000
3059
|
var isDestroyed = false;
|
|
3001
3060
|
var instance = {
|
|
3002
3061
|
state: state,
|
|
3003
|
-
setOptions: function setOptions(
|
|
3062
|
+
setOptions: function setOptions(setOptionsAction) {
|
|
3063
|
+
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
|
3004
3064
|
cleanupModifierEffects();
|
|
3005
3065
|
state.options = Object.assign({}, defaultOptions, state.options, options);
|
|
3006
3066
|
state.scrollParents = {
|