vrembem 3.0.6 → 3.0.9
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/dev/scripts.esm.js +122 -100
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +122 -100
- package/dev/scripts.js.map +1 -1
- package/dev/{scripts.modern.js → scripts.modern.mjs} +126 -95
- package/dev/scripts.modern.mjs.map +1 -0
- package/dev/scripts.umd.js +122 -100
- package/dev/scripts.umd.js.map +1 -1
- package/dev/styles.css +12 -127
- 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.mjs +2 -0
- package/dist/scripts.modern.mjs.map +1 -0
- 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/index.scss +2 -3
- package/package.json +26 -26
- package/dev/scripts.modern.js.map +0 -1
- package/dist/scripts.modern.js +0 -2
- package/dist/scripts.modern.js.map +0 -1
package/dev/scripts.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function _extends() {
|
|
26
|
-
_extends = Object.assign
|
|
26
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
27
27
|
for (var i = 1; i < arguments.length; i++) {
|
|
28
28
|
var source = arguments[i];
|
|
29
29
|
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
|
|
37
37
|
return target;
|
|
38
38
|
};
|
|
39
|
-
|
|
40
39
|
return _extends.apply(this, arguments);
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -48,11 +47,10 @@
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
function _setPrototypeOf(o, p) {
|
|
51
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
50
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
52
51
|
o.__proto__ = p;
|
|
53
52
|
return o;
|
|
54
53
|
};
|
|
55
|
-
|
|
56
54
|
return _setPrototypeOf(o, p);
|
|
57
55
|
}
|
|
58
56
|
|
|
@@ -434,7 +432,20 @@
|
|
|
434
432
|
return Collection;
|
|
435
433
|
}();
|
|
436
434
|
|
|
437
|
-
var focusableSelectors = [
|
|
435
|
+
var focusableSelectors = [
|
|
436
|
+
'a[href]:not([tabindex^="-"])',
|
|
437
|
+
'area[href]:not([tabindex^="-"])',
|
|
438
|
+
'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])',
|
|
439
|
+
'input[type="radio"]:not([disabled]):not([tabindex^="-"])',
|
|
440
|
+
'select:not([disabled]):not([tabindex^="-"])',
|
|
441
|
+
'textarea:not([disabled]):not([tabindex^="-"])',
|
|
442
|
+
'button:not([disabled]):not([tabindex^="-"])',
|
|
443
|
+
'iframe:not([tabindex^="-"])',
|
|
444
|
+
'audio[controls]:not([tabindex^="-"])',
|
|
445
|
+
'video[controls]:not([tabindex^="-"])',
|
|
446
|
+
'[contenteditable]:not([tabindex^="-"])',
|
|
447
|
+
'[tabindex]:not([tabindex^="-"])',
|
|
448
|
+
];
|
|
438
449
|
|
|
439
450
|
var _focusable = /*#__PURE__*/_classPrivateFieldLooseKey("focusable");
|
|
440
451
|
|
|
@@ -611,29 +622,23 @@
|
|
|
611
622
|
enable = true;
|
|
612
623
|
}
|
|
613
624
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
return new Proxy(getStore(), {
|
|
624
|
-
set: function set(target, property, value) {
|
|
625
|
-
console.log('localStore() => set');
|
|
626
|
-
|
|
627
|
-
if (value === undefined) {
|
|
628
|
-
delete target[property];
|
|
625
|
+
var local = localStorage.getItem(key);
|
|
626
|
+
var store = local ? JSON.parse(local) : {};
|
|
627
|
+
return {
|
|
628
|
+
get: function get(prop) {
|
|
629
|
+
return prop ? store[prop] : store;
|
|
630
|
+
},
|
|
631
|
+
set: function set(prop, value) {
|
|
632
|
+
if (value) {
|
|
633
|
+
store[prop] = value;
|
|
629
634
|
} else {
|
|
630
|
-
|
|
635
|
+
delete store[prop];
|
|
631
636
|
}
|
|
632
637
|
|
|
633
|
-
if (enable)
|
|
634
|
-
return
|
|
638
|
+
if (enable) localStorage.setItem(key, JSON.stringify(store));
|
|
639
|
+
return store;
|
|
635
640
|
}
|
|
636
|
-
}
|
|
641
|
+
};
|
|
637
642
|
}
|
|
638
643
|
|
|
639
644
|
/**
|
|
@@ -973,7 +978,8 @@
|
|
|
973
978
|
if (index >= 0) {
|
|
974
979
|
var _temp7 = function _temp7() {
|
|
975
980
|
// Remove entry from local store.
|
|
976
|
-
_this2.store
|
|
981
|
+
_this2.store.set(_entry.id); // Unmount the MatchMedia functionality.
|
|
982
|
+
|
|
977
983
|
|
|
978
984
|
_entry.unmountBreakpoint(); // Delete properties from collection entry.
|
|
979
985
|
|
|
@@ -1094,9 +1100,9 @@
|
|
|
1094
1100
|
var _this2 = this;
|
|
1095
1101
|
|
|
1096
1102
|
var _temp3 = function () {
|
|
1097
|
-
if (_this2.store
|
|
1103
|
+
if (_this2.store.get(entry.id)) {
|
|
1098
1104
|
var _temp4 = function () {
|
|
1099
|
-
if (_this2.store
|
|
1105
|
+
if (_this2.store.get(entry.id) === 'opened') {
|
|
1100
1106
|
return Promise.resolve(entry.open(false, false)).then(function () {});
|
|
1101
1107
|
} else {
|
|
1102
1108
|
return Promise.resolve(entry.close(false, false)).then(function () {});
|
|
@@ -1275,9 +1281,9 @@
|
|
|
1275
1281
|
|
|
1276
1282
|
entry.dialog.setAttribute('aria-modal', 'true'); // If there isn't a stored state but also has the opened state class...
|
|
1277
1283
|
|
|
1278
|
-
if (!_this4.store
|
|
1284
|
+
if (!_this4.store.get(entry.id) && entry.el.classList.contains(entry.getSetting('stateOpened'))) {
|
|
1279
1285
|
// Save the opened state in local store.
|
|
1280
|
-
_this4.store
|
|
1286
|
+
_this4.store.set(entry.id, 'opened');
|
|
1281
1287
|
} // Modal drawer defaults to closed state.
|
|
1282
1288
|
|
|
1283
1289
|
|
|
@@ -1398,7 +1404,7 @@
|
|
|
1398
1404
|
__state = value; // Save 'opened' and 'closed' states to store if mode is inline.
|
|
1399
1405
|
|
|
1400
1406
|
if (value === 'opened' || value === 'closed') {
|
|
1401
|
-
if (this.mode === 'inline') root.store
|
|
1407
|
+
if (this.mode === 'inline') root.store.set(this.id, this.state);
|
|
1402
1408
|
}
|
|
1403
1409
|
},
|
|
1404
1410
|
|
|
@@ -1691,14 +1697,6 @@
|
|
|
1691
1697
|
}
|
|
1692
1698
|
}
|
|
1693
1699
|
|
|
1694
|
-
function updateStackIndex(stack) {
|
|
1695
|
-
stack.forEach(function (entry, index) {
|
|
1696
|
-
entry.el.style.zIndex = null;
|
|
1697
|
-
var value = getComputedStyle(entry.el)['z-index'];
|
|
1698
|
-
entry.el.style.zIndex = parseInt(value) + index + 1;
|
|
1699
|
-
});
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
1700
|
var handleClick$1 = function handleClick(event) {
|
|
1703
1701
|
try {
|
|
1704
1702
|
var _this2 = this;
|
|
@@ -1792,15 +1790,8 @@
|
|
|
1792
1790
|
if (close && _entry.state === 'opened') {
|
|
1793
1791
|
return Promise.resolve(_entry.close(false)).then(function () {});
|
|
1794
1792
|
} else {
|
|
1795
|
-
//
|
|
1796
|
-
|
|
1797
|
-
return item.id === _entry.id;
|
|
1798
|
-
}); // Remove modal from stack array.
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
if (stackIndex >= 0) {
|
|
1802
|
-
_this2.stack.splice(stackIndex, 1);
|
|
1803
|
-
}
|
|
1793
|
+
// Remove modal from stack.
|
|
1794
|
+
_this2.stack.remove(_entry);
|
|
1804
1795
|
}
|
|
1805
1796
|
}();
|
|
1806
1797
|
|
|
@@ -1843,32 +1834,17 @@
|
|
|
1843
1834
|
var config = _extends({}, _this2.settings, modal.settings); // Add transition parameter to configuration.
|
|
1844
1835
|
|
|
1845
1836
|
|
|
1846
|
-
if (transition !== undefined) config.transition = transition; //
|
|
1847
|
-
|
|
1848
|
-
var index = _this2.stack.findIndex(function (entry) {
|
|
1849
|
-
return entry.id === modal.id;
|
|
1850
|
-
}); // If modal is already open.
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
if (index >= 0) {
|
|
1854
|
-
// Remove modal from stack array.
|
|
1855
|
-
_this2.stack.splice(index, 1); // Move back to end of stack.
|
|
1837
|
+
if (transition !== undefined) config.transition = transition; // Maybe add modal to top of stack.
|
|
1856
1838
|
|
|
1857
|
-
|
|
1858
|
-
_this2.stack.push(modal);
|
|
1859
|
-
} // If modal is closed.
|
|
1839
|
+
_this2.stack.moveToTop(modal); // If modal is closed.
|
|
1860
1840
|
|
|
1861
1841
|
|
|
1862
1842
|
var _temp4 = function () {
|
|
1863
1843
|
if (modal.state === 'closed') {
|
|
1864
1844
|
// Update modal state.
|
|
1865
|
-
modal.state = 'opening'; //
|
|
1866
|
-
|
|
1867
|
-
modal.el.style.zIndex = null;
|
|
1868
|
-
var value = getComputedStyle(modal.el)['z-index'];
|
|
1869
|
-
modal.el.style.zIndex = parseInt(value) + _this2.stack.length + 1; // Store modal in stack array.
|
|
1845
|
+
modal.state = 'opening'; // Add modal to stack.
|
|
1870
1846
|
|
|
1871
|
-
_this2.stack.
|
|
1847
|
+
_this2.stack.add(modal); // Run the open transition.
|
|
1872
1848
|
|
|
1873
1849
|
|
|
1874
1850
|
return Promise.resolve(openTransition(modal.el, config)).then(function () {
|
|
@@ -1908,15 +1884,8 @@
|
|
|
1908
1884
|
document.activeElement.blur(); // Run the close transition.
|
|
1909
1885
|
|
|
1910
1886
|
return Promise.resolve(closeTransition(modal.el, config)).then(function () {
|
|
1911
|
-
// Remove
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
var index = _this2.stack.findIndex(function (entry) {
|
|
1915
|
-
return entry.id === modal.id;
|
|
1916
|
-
}); // Remove modal from stack array.
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
_this2.stack.splice(index, 1); // Update focus if the focus param is true.
|
|
1887
|
+
// Remove modal from stack.
|
|
1888
|
+
_this2.stack.remove(modal); // Update focus if the focus param is true.
|
|
1920
1889
|
|
|
1921
1890
|
|
|
1922
1891
|
if (focus) {
|
|
@@ -1948,7 +1917,7 @@
|
|
|
1948
1917
|
var _this2 = this;
|
|
1949
1918
|
|
|
1950
1919
|
var result = [];
|
|
1951
|
-
return Promise.resolve(Promise.all(_this2.stack.map(function (modal) {
|
|
1920
|
+
return Promise.resolve(Promise.all(_this2.stack.value.map(function (modal) {
|
|
1952
1921
|
try {
|
|
1953
1922
|
var _temp3 = function _temp3() {
|
|
1954
1923
|
modal.trigger = null;
|
|
@@ -2130,6 +2099,70 @@
|
|
|
2130
2099
|
}
|
|
2131
2100
|
};
|
|
2132
2101
|
|
|
2102
|
+
function stack(settings) {
|
|
2103
|
+
var stackArray = [];
|
|
2104
|
+
return {
|
|
2105
|
+
get value() {
|
|
2106
|
+
return [].concat(stackArray);
|
|
2107
|
+
},
|
|
2108
|
+
|
|
2109
|
+
get top() {
|
|
2110
|
+
return stackArray[stackArray.length - 1];
|
|
2111
|
+
},
|
|
2112
|
+
|
|
2113
|
+
updateIndex: function updateIndex() {
|
|
2114
|
+
stackArray.forEach(function (entry, index) {
|
|
2115
|
+
entry.el.style.zIndex = null;
|
|
2116
|
+
var value = getComputedStyle(entry.el)['z-index'];
|
|
2117
|
+
entry.el.style.zIndex = parseInt(value) + index + 1;
|
|
2118
|
+
});
|
|
2119
|
+
},
|
|
2120
|
+
updateGlobalState: function updateGlobalState$1() {
|
|
2121
|
+
updateGlobalState(this.top, settings);
|
|
2122
|
+
|
|
2123
|
+
this.updateIndex();
|
|
2124
|
+
},
|
|
2125
|
+
add: function add(entry) {
|
|
2126
|
+
// Apply z-index styles based on stack length.
|
|
2127
|
+
entry.el.style.zIndex = null;
|
|
2128
|
+
var value = getComputedStyle(entry.el)['z-index'];
|
|
2129
|
+
entry.el.style.zIndex = parseInt(value) + stackArray.length + 1; // Move back to end of stack.
|
|
2130
|
+
|
|
2131
|
+
stackArray.push(entry); // Update the global state.
|
|
2132
|
+
|
|
2133
|
+
this.updateGlobalState();
|
|
2134
|
+
},
|
|
2135
|
+
remove: function remove(entry) {
|
|
2136
|
+
// Get the index of the entry.
|
|
2137
|
+
var index = stackArray.findIndex(function (item) {
|
|
2138
|
+
return item.id === entry.id;
|
|
2139
|
+
}); // If entry is in stack...
|
|
2140
|
+
|
|
2141
|
+
if (index >= 0) {
|
|
2142
|
+
// Remove z-index styles.
|
|
2143
|
+
entry.el.style.zIndex = null; // Remove entry from stack array.
|
|
2144
|
+
|
|
2145
|
+
stackArray.splice(index, 1); // Update the global state.
|
|
2146
|
+
|
|
2147
|
+
this.updateGlobalState();
|
|
2148
|
+
}
|
|
2149
|
+
},
|
|
2150
|
+
moveToTop: function moveToTop(entry) {
|
|
2151
|
+
// Get the index of the entry.
|
|
2152
|
+
var index = stackArray.findIndex(function (item) {
|
|
2153
|
+
return item.id === entry.id;
|
|
2154
|
+
}); // If entry is in stack...
|
|
2155
|
+
|
|
2156
|
+
if (index >= 0) {
|
|
2157
|
+
// Remove entry from stack array.
|
|
2158
|
+
stackArray.splice(index, 1); // Add entry back to top of stack.
|
|
2159
|
+
|
|
2160
|
+
this.add(entry);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2133
2166
|
var _handleClick = /*#__PURE__*/_classPrivateFieldLooseKey("handleClick");
|
|
2134
2167
|
|
|
2135
2168
|
var _handleKeydown$1 = /*#__PURE__*/_classPrivateFieldLooseKey("handleKeydown");
|
|
@@ -2152,20 +2185,9 @@
|
|
|
2152
2185
|
_this.defaults = defaults$1;
|
|
2153
2186
|
_this.settings = _extends({}, _this.defaults, options);
|
|
2154
2187
|
_this.trigger = null;
|
|
2155
|
-
_this.focusTrap = new FocusTrap(); // Setup
|
|
2156
|
-
|
|
2157
|
-
_this.stack = new Proxy([], {
|
|
2158
|
-
set: function set(target, property, value) {
|
|
2159
|
-
target[property] = value; // Update global state if stack length changed.
|
|
2188
|
+
_this.focusTrap = new FocusTrap(); // Setup stack module.
|
|
2160
2189
|
|
|
2161
|
-
|
|
2162
|
-
updateGlobalState(_this.active, _this.settings);
|
|
2163
|
-
updateStackIndex(_this.stack);
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
|
-
return true;
|
|
2167
|
-
}
|
|
2168
|
-
});
|
|
2190
|
+
_this.stack = stack(_this.settings);
|
|
2169
2191
|
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _handleClick)[_handleClick] = handleClick$1.bind(_assertThisInitialized(_this));
|
|
2170
2192
|
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _handleKeydown$1)[_handleKeydown$1] = handleKeydown$1.bind(_assertThisInitialized(_this));
|
|
2171
2193
|
if (_this.settings.autoInit) _this.init();
|
|
@@ -2279,7 +2301,7 @@
|
|
|
2279
2301
|
_createClass(Modal, [{
|
|
2280
2302
|
key: "active",
|
|
2281
2303
|
get: function get() {
|
|
2282
|
-
return this.stack
|
|
2304
|
+
return this.stack.top;
|
|
2283
2305
|
}
|
|
2284
2306
|
}]);
|
|
2285
2307
|
|
|
@@ -2835,17 +2857,17 @@
|
|
|
2835
2857
|
return true;
|
|
2836
2858
|
} // then fallback to custom implementation with Shadow DOM support
|
|
2837
2859
|
else if (rootNode && isShadowRoot(rootNode)) {
|
|
2838
|
-
|
|
2860
|
+
var next = child;
|
|
2839
2861
|
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2862
|
+
do {
|
|
2863
|
+
if (next && parent.isSameNode(next)) {
|
|
2864
|
+
return true;
|
|
2865
|
+
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
|
2844
2866
|
|
|
2845
2867
|
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2868
|
+
next = next.parentNode || next.host;
|
|
2869
|
+
} while (next);
|
|
2870
|
+
} // Give up, the result is false
|
|
2849
2871
|
|
|
2850
2872
|
|
|
2851
2873
|
return false;
|
|
@@ -3902,11 +3924,11 @@
|
|
|
3902
3924
|
|
|
3903
3925
|
function popperOffsets(_ref) {
|
|
3904
3926
|
var state = _ref.state,
|
|
3905
|
-
name = _ref.name;
|
|
3927
|
+
name = _ref.name;
|
|
3928
|
+
// Offsets are the actual position the popper needs to have to be
|
|
3906
3929
|
// properly positioned near its reference element
|
|
3907
3930
|
// This is the most basic placement, and will be adjusted by
|
|
3908
3931
|
// the modifiers in the next step
|
|
3909
|
-
|
|
3910
3932
|
state.modifiersData[name] = computeOffsets({
|
|
3911
3933
|
reference: state.rects.reference,
|
|
3912
3934
|
element: state.rects.popper,
|