vrembem 1.42.0 → 1.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/scripts.esm.js +43 -30
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +43 -30
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.js +35 -22
- package/dev/scripts.modern.js.map +1 -1
- package/dev/scripts.umd.js +43 -30
- package/dev/scripts.umd.js.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/package.json +3 -3
package/dev/scripts.modern.js
CHANGED
|
@@ -891,6 +891,7 @@ var defaults$1 = {
|
|
|
891
891
|
dataClose: 'modal-close',
|
|
892
892
|
dataFocus: 'modal-focus',
|
|
893
893
|
dataRequired: 'modal-required',
|
|
894
|
+
dataConfig: 'modal-config',
|
|
894
895
|
// State classes
|
|
895
896
|
stateOpened: 'is-opened',
|
|
896
897
|
stateOpening: 'is-opening',
|
|
@@ -910,17 +911,40 @@ var defaults$1 = {
|
|
|
910
911
|
transition: true
|
|
911
912
|
};
|
|
912
913
|
|
|
914
|
+
function getModalConfig(modal) {
|
|
915
|
+
const json = modal.getAttribute(`data-${this.settings.dataConfig}`);
|
|
916
|
+
|
|
917
|
+
if (json) {
|
|
918
|
+
const config = JSON.parse(json);
|
|
919
|
+
return _extends({}, this.settings, config);
|
|
920
|
+
} else {
|
|
921
|
+
return this.settings;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
function getModal(modalKey) {
|
|
925
|
+
if (typeof modalKey !== 'string') return modalKey;
|
|
926
|
+
return document.querySelector(`[data-${this.settings.dataModal}="${modalKey}"]`);
|
|
927
|
+
}
|
|
928
|
+
function modalNotFound(key) {
|
|
929
|
+
return Promise.reject(new Error(`Did not find modal with key: "${key}"`));
|
|
930
|
+
}
|
|
931
|
+
function moveModals(type = this.settings.moveModals.type, ref = this.settings.moveModals.ref) {
|
|
932
|
+
const modals = document.querySelectorAll(`[data-${this.settings.dataModal}]`);
|
|
933
|
+
if (modals.length) moveElement(modals, type, ref);
|
|
934
|
+
}
|
|
935
|
+
|
|
913
936
|
async function close$1(returnFocus = true) {
|
|
914
937
|
const modal = document.querySelector(`[data-${this.settings.dataModal}].${this.settings.stateOpened}`);
|
|
915
938
|
|
|
916
939
|
if (modal) {
|
|
917
940
|
this.working = true;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
941
|
+
const config = getModalConfig.call(this, modal);
|
|
942
|
+
setInert(false, config.selectorInert);
|
|
943
|
+
setOverflowHidden(false, config.selectorOverflow);
|
|
944
|
+
await closeTransition(modal, config);
|
|
921
945
|
if (returnFocus) focusTrigger(this);
|
|
922
946
|
this.focusTrap.destroy();
|
|
923
|
-
modal.dispatchEvent(new CustomEvent(
|
|
947
|
+
modal.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
|
|
924
948
|
detail: this,
|
|
925
949
|
bubbles: true
|
|
926
950
|
}));
|
|
@@ -973,18 +997,6 @@ function handlerKeydown$1(event) {
|
|
|
973
997
|
}
|
|
974
998
|
}
|
|
975
999
|
|
|
976
|
-
function getModal(modalKey) {
|
|
977
|
-
if (typeof modalKey !== 'string') return modalKey;
|
|
978
|
-
return document.querySelector(`[data-${this.settings.dataModal}="${modalKey}"]`);
|
|
979
|
-
}
|
|
980
|
-
function modalNotFound(key) {
|
|
981
|
-
return Promise.reject(new Error(`Did not find modal with key: "${key}"`));
|
|
982
|
-
}
|
|
983
|
-
function moveModals(type = this.settings.moveModals.type, ref = this.settings.moveModals.ref) {
|
|
984
|
-
const modals = document.querySelectorAll(`[data-${this.settings.dataModal}]`);
|
|
985
|
-
if (modals.length) moveElement(modals, type, ref);
|
|
986
|
-
}
|
|
987
|
-
|
|
988
1000
|
function setInitialState() {
|
|
989
1001
|
const modals = document.querySelectorAll(`[data-${this.settings.dataModal}]`);
|
|
990
1002
|
modals.forEach(el => {
|
|
@@ -1005,15 +1017,16 @@ function setInitialState() {
|
|
|
1005
1017
|
async function open$1(modalKey) {
|
|
1006
1018
|
const modal = getModal.call(this, modalKey);
|
|
1007
1019
|
if (!modal) return modalNotFound(modalKey);
|
|
1020
|
+
const config = getModalConfig.call(this, modal);
|
|
1008
1021
|
|
|
1009
|
-
if (hasClass(modal,
|
|
1022
|
+
if (hasClass(modal, config.stateClosed)) {
|
|
1010
1023
|
this.working = true;
|
|
1011
|
-
setOverflowHidden(true,
|
|
1012
|
-
await openTransition(modal,
|
|
1024
|
+
setOverflowHidden(true, config.selectorOverflow);
|
|
1025
|
+
await openTransition(modal, config);
|
|
1013
1026
|
this.focusTrap.init(modal);
|
|
1014
|
-
focusTarget(modal,
|
|
1015
|
-
setInert(true,
|
|
1016
|
-
modal.dispatchEvent(new CustomEvent(
|
|
1027
|
+
focusTarget(modal, config);
|
|
1028
|
+
setInert(true, config.selectorInert);
|
|
1029
|
+
modal.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
|
|
1017
1030
|
detail: this,
|
|
1018
1031
|
bubbles: true
|
|
1019
1032
|
}));
|