sweetalert2 11.12.2 → 11.12.3
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/README.md +0 -2
- package/dist/sweetalert2.all.js +54 -98
- package/dist/sweetalert2.all.min.js +2 -2
- package/dist/sweetalert2.js +54 -98
- package/dist/sweetalert2.min.js +2 -2
- package/package.json +1 -1
- package/src/SweetAlert.js +1 -1
- package/src/types.js +74 -0
- package/src/utils/classes.js +0 -71
- package/src/utils/dom/renderers/renderInput.js +25 -7
- package/src/utils/getTemplateParams.js +32 -17
package/README.md
CHANGED
|
@@ -24,7 +24,6 @@ For all questions related to sponsorship please get in touch with me via email s
|
|
|
24
24
|
<tr>
|
|
25
25
|
<td align="center"><a href="https://roboflow.com/"><img src="https://sweetalert2.github.io/images/sponsors/roboflow.png" width="80"><br>Roboflow</a>
|
|
26
26
|
<td align="center"><a href="https://www.zezelife.com/"><img src="https://sweetalert2.github.io/images/sponsors/zezelife.png" width="80"><br>ZezeLife</a>
|
|
27
|
-
<td align="center"><a href="https://www.serpempire.com/"><img src="https://sweetalert2.github.io/images/sponsors/serpempire.png" width="80"><br>SERP Empire</a>
|
|
28
27
|
<td align="center"><a href="https://www.realspyapps.com/"><img src="https://sweetalert2.github.io/images/sponsors/realspyapps.jpeg" width="80"><br>Real Spy Apps</a>
|
|
29
28
|
</tr>
|
|
30
29
|
</table>
|
|
@@ -58,7 +57,6 @@ For all questions related to sponsorship please get in touch with me via email s
|
|
|
58
57
|
</table>
|
|
59
58
|
<table>
|
|
60
59
|
<tr>
|
|
61
|
-
<td align="center"><a href="https://www.bestblowjobmachines.com/"><img src="https://sweetalert2.github.io/images/sponsors/best-blowjob-machines.jpg" width="80"><br>Best Blowjob Machines</a></td>
|
|
62
60
|
<td align="center"><a href="https://nakedoll.com/"><img src="https://sweetalert2.github.io/images/sponsors/nakedoll.png" width="80"><br>NakeDoll</a></td>
|
|
63
61
|
<td align="center"><a href="https://www.onahole.com/"><img src="https://sweetalert2.github.io/images/sponsors/onahole.png" width="80"><br>hentai sex toys</a></td>
|
|
64
62
|
<td align="center"><a href="https://blowupdollshop.com/inflatable-sex-doll/"><img src="https://sweetalert2.github.io/images/sponsors/blowupdollshop.png" width="80"><br>Inflatable sex doll</a></td>
|
package/dist/sweetalert2.all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sweetalert2 v11.12.
|
|
2
|
+
* sweetalert2 v11.12.3
|
|
3
3
|
* Released under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -267,77 +267,6 @@
|
|
|
267
267
|
var swalPrefix = 'swal2-';
|
|
268
268
|
|
|
269
269
|
/**
|
|
270
|
-
* @typedef
|
|
271
|
-
* { | 'container'
|
|
272
|
-
* | 'shown'
|
|
273
|
-
* | 'height-auto'
|
|
274
|
-
* | 'iosfix'
|
|
275
|
-
* | 'popup'
|
|
276
|
-
* | 'modal'
|
|
277
|
-
* | 'no-backdrop'
|
|
278
|
-
* | 'no-transition'
|
|
279
|
-
* | 'toast'
|
|
280
|
-
* | 'toast-shown'
|
|
281
|
-
* | 'show'
|
|
282
|
-
* | 'hide'
|
|
283
|
-
* | 'close'
|
|
284
|
-
* | 'title'
|
|
285
|
-
* | 'html-container'
|
|
286
|
-
* | 'actions'
|
|
287
|
-
* | 'confirm'
|
|
288
|
-
* | 'deny'
|
|
289
|
-
* | 'cancel'
|
|
290
|
-
* | 'default-outline'
|
|
291
|
-
* | 'footer'
|
|
292
|
-
* | 'icon'
|
|
293
|
-
* | 'icon-content'
|
|
294
|
-
* | 'image'
|
|
295
|
-
* | 'input'
|
|
296
|
-
* | 'file'
|
|
297
|
-
* | 'range'
|
|
298
|
-
* | 'select'
|
|
299
|
-
* | 'radio'
|
|
300
|
-
* | 'checkbox'
|
|
301
|
-
* | 'label'
|
|
302
|
-
* | 'textarea'
|
|
303
|
-
* | 'inputerror'
|
|
304
|
-
* | 'input-label'
|
|
305
|
-
* | 'validation-message'
|
|
306
|
-
* | 'progress-steps'
|
|
307
|
-
* | 'active-progress-step'
|
|
308
|
-
* | 'progress-step'
|
|
309
|
-
* | 'progress-step-line'
|
|
310
|
-
* | 'loader'
|
|
311
|
-
* | 'loading'
|
|
312
|
-
* | 'styled'
|
|
313
|
-
* | 'top'
|
|
314
|
-
* | 'top-start'
|
|
315
|
-
* | 'top-end'
|
|
316
|
-
* | 'top-left'
|
|
317
|
-
* | 'top-right'
|
|
318
|
-
* | 'center'
|
|
319
|
-
* | 'center-start'
|
|
320
|
-
* | 'center-end'
|
|
321
|
-
* | 'center-left'
|
|
322
|
-
* | 'center-right'
|
|
323
|
-
* | 'bottom'
|
|
324
|
-
* | 'bottom-start'
|
|
325
|
-
* | 'bottom-end'
|
|
326
|
-
* | 'bottom-left'
|
|
327
|
-
* | 'bottom-right'
|
|
328
|
-
* | 'grow-row'
|
|
329
|
-
* | 'grow-column'
|
|
330
|
-
* | 'grow-fullscreen'
|
|
331
|
-
* | 'rtl'
|
|
332
|
-
* | 'timer-progress-bar'
|
|
333
|
-
* | 'timer-progress-bar-container'
|
|
334
|
-
* | 'scrollbar-measure'
|
|
335
|
-
* | 'icon-success'
|
|
336
|
-
* | 'icon-warning'
|
|
337
|
-
* | 'icon-info'
|
|
338
|
-
* | 'icon-question'
|
|
339
|
-
* | 'icon-error'
|
|
340
|
-
* } SwalClass
|
|
341
270
|
* @typedef {Record<SwalClass, string>} SwalClasses
|
|
342
271
|
*/
|
|
343
272
|
|
|
@@ -1406,6 +1335,9 @@
|
|
|
1406
1335
|
return;
|
|
1407
1336
|
}
|
|
1408
1337
|
var inputContainer = getInputContainer(params.input);
|
|
1338
|
+
if (!inputContainer) {
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1409
1341
|
var input = renderInputType[params.input](inputContainer, params);
|
|
1410
1342
|
show(inputContainer);
|
|
1411
1343
|
|
|
@@ -1434,7 +1366,11 @@
|
|
|
1434
1366
|
* @param {SweetAlertOptions['inputAttributes']} inputAttributes
|
|
1435
1367
|
*/
|
|
1436
1368
|
var setAttributes = function setAttributes(inputClass, inputAttributes) {
|
|
1437
|
-
var
|
|
1369
|
+
var popup = getPopup();
|
|
1370
|
+
if (!popup) {
|
|
1371
|
+
return;
|
|
1372
|
+
}
|
|
1373
|
+
var input = getInput$1(popup, inputClass);
|
|
1438
1374
|
if (!input) {
|
|
1439
1375
|
return;
|
|
1440
1376
|
}
|
|
@@ -1448,9 +1384,12 @@
|
|
|
1448
1384
|
* @param {SweetAlertOptions} params
|
|
1449
1385
|
*/
|
|
1450
1386
|
var setCustomClass = function setCustomClass(params) {
|
|
1387
|
+
if (!params.input) {
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1451
1390
|
var inputContainer = getInputContainer(params.input);
|
|
1452
|
-
if (
|
|
1453
|
-
|
|
1391
|
+
if (inputContainer) {
|
|
1392
|
+
applyCustomClass(inputContainer, params, 'input');
|
|
1454
1393
|
}
|
|
1455
1394
|
};
|
|
1456
1395
|
|
|
@@ -1459,7 +1398,7 @@
|
|
|
1459
1398
|
* @param {SweetAlertOptions} params
|
|
1460
1399
|
*/
|
|
1461
1400
|
var setInputPlaceholder = function setInputPlaceholder(input, params) {
|
|
1462
|
-
if (!input.placeholder
|
|
1401
|
+
if (!input.placeholder && params.inputPlaceholder) {
|
|
1463
1402
|
input.placeholder = params.inputPlaceholder;
|
|
1464
1403
|
}
|
|
1465
1404
|
};
|
|
@@ -1484,11 +1423,15 @@
|
|
|
1484
1423
|
};
|
|
1485
1424
|
|
|
1486
1425
|
/**
|
|
1487
|
-
* @param {
|
|
1488
|
-
* @returns {HTMLElement}
|
|
1426
|
+
* @param {SweetAlertInput} inputType
|
|
1427
|
+
* @returns {HTMLElement | undefined}
|
|
1489
1428
|
*/
|
|
1490
1429
|
var getInputContainer = function getInputContainer(inputType) {
|
|
1491
|
-
|
|
1430
|
+
var popup = getPopup();
|
|
1431
|
+
if (!popup) {
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
return getDirectChildByClass(popup, swalClasses[( /** @type {SwalClass} */inputType)] || swalClasses.input);
|
|
1492
1435
|
};
|
|
1493
1436
|
|
|
1494
1437
|
/**
|
|
@@ -1511,7 +1454,8 @@
|
|
|
1511
1454
|
* @param {SweetAlertOptions} params
|
|
1512
1455
|
* @returns {HTMLInputElement}
|
|
1513
1456
|
*/
|
|
1514
|
-
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month =
|
|
1457
|
+
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = /** @type {(input: Input | HTMLElement, params: SweetAlertOptions) => Input} */
|
|
1458
|
+
function (input, params) {
|
|
1515
1459
|
checkAndSetInputValue(input, params.inputValue);
|
|
1516
1460
|
setInputLabel(input, input, params);
|
|
1517
1461
|
setInputPlaceholder(input, params);
|
|
@@ -3945,8 +3889,7 @@
|
|
|
3945
3889
|
* @returns {SweetAlertOptions}
|
|
3946
3890
|
*/
|
|
3947
3891
|
var getTemplateParams = function getTemplateParams(params) {
|
|
3948
|
-
/** @type {HTMLTemplateElement} */
|
|
3949
|
-
var template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template;
|
|
3892
|
+
var template = typeof params.template === 'string' ? ( /** @type {HTMLTemplateElement} */document.querySelector(params.template)) : params.template;
|
|
3950
3893
|
if (!template) {
|
|
3951
3894
|
return {};
|
|
3952
3895
|
}
|
|
@@ -3959,16 +3902,20 @@
|
|
|
3959
3902
|
|
|
3960
3903
|
/**
|
|
3961
3904
|
* @param {DocumentFragment} templateContent
|
|
3962
|
-
* @returns {
|
|
3905
|
+
* @returns {Record<string, any>}
|
|
3963
3906
|
*/
|
|
3964
3907
|
var getSwalParams = function getSwalParams(templateContent) {
|
|
3908
|
+
/** @type {Record<string, any>} */
|
|
3965
3909
|
var result = {};
|
|
3966
3910
|
/** @type {HTMLElement[]} */
|
|
3967
3911
|
var swalParams = Array.from(templateContent.querySelectorAll('swal-param'));
|
|
3968
3912
|
swalParams.forEach(function (param) {
|
|
3969
3913
|
showWarningsForAttributes(param, ['name', 'value']);
|
|
3970
|
-
var paramName = param.getAttribute('name');
|
|
3914
|
+
var paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
|
|
3971
3915
|
var value = param.getAttribute('value');
|
|
3916
|
+
if (!paramName || !value) {
|
|
3917
|
+
return;
|
|
3918
|
+
}
|
|
3972
3919
|
if (typeof defaultParams[paramName] === 'boolean') {
|
|
3973
3920
|
result[paramName] = value !== 'false';
|
|
3974
3921
|
} else if (_typeof(defaultParams[paramName]) === 'object') {
|
|
@@ -3982,15 +3929,19 @@
|
|
|
3982
3929
|
|
|
3983
3930
|
/**
|
|
3984
3931
|
* @param {DocumentFragment} templateContent
|
|
3985
|
-
* @returns {
|
|
3932
|
+
* @returns {Record<string, any>}
|
|
3986
3933
|
*/
|
|
3987
3934
|
var getSwalFunctionParams = function getSwalFunctionParams(templateContent) {
|
|
3935
|
+
/** @type {Record<string, any>} */
|
|
3988
3936
|
var result = {};
|
|
3989
3937
|
/** @type {HTMLElement[]} */
|
|
3990
3938
|
var swalFunctions = Array.from(templateContent.querySelectorAll('swal-function-param'));
|
|
3991
3939
|
swalFunctions.forEach(function (param) {
|
|
3992
|
-
var paramName = param.getAttribute('name');
|
|
3940
|
+
var paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
|
|
3993
3941
|
var value = param.getAttribute('value');
|
|
3942
|
+
if (!paramName || !value) {
|
|
3943
|
+
return;
|
|
3944
|
+
}
|
|
3994
3945
|
result[paramName] = new Function("return ".concat(value))();
|
|
3995
3946
|
});
|
|
3996
3947
|
return result;
|
|
@@ -3998,15 +3949,19 @@
|
|
|
3998
3949
|
|
|
3999
3950
|
/**
|
|
4000
3951
|
* @param {DocumentFragment} templateContent
|
|
4001
|
-
* @returns {
|
|
3952
|
+
* @returns {Record<string, any>}
|
|
4002
3953
|
*/
|
|
4003
3954
|
var getSwalButtons = function getSwalButtons(templateContent) {
|
|
3955
|
+
/** @type {Record<string, any>} */
|
|
4004
3956
|
var result = {};
|
|
4005
3957
|
/** @type {HTMLElement[]} */
|
|
4006
3958
|
var swalButtons = Array.from(templateContent.querySelectorAll('swal-button'));
|
|
4007
3959
|
swalButtons.forEach(function (button) {
|
|
4008
3960
|
showWarningsForAttributes(button, ['type', 'color', 'aria-label']);
|
|
4009
3961
|
var type = button.getAttribute('type');
|
|
3962
|
+
if (!type || !['confirm', 'cancel', 'deny'].includes(type)) {
|
|
3963
|
+
return;
|
|
3964
|
+
}
|
|
4010
3965
|
result["".concat(type, "ButtonText")] = button.innerHTML;
|
|
4011
3966
|
result["show".concat(capitalizeFirstLetter(type), "Button")] = true;
|
|
4012
3967
|
if (button.hasAttribute('color')) {
|
|
@@ -4047,17 +4002,15 @@
|
|
|
4047
4002
|
|
|
4048
4003
|
/**
|
|
4049
4004
|
* @param {DocumentFragment} templateContent
|
|
4050
|
-
* @returns {
|
|
4005
|
+
* @returns {Record<string, any>}
|
|
4051
4006
|
*/
|
|
4052
4007
|
var getSwalIcon = function getSwalIcon(templateContent) {
|
|
4053
4008
|
var result = {};
|
|
4054
|
-
/** @type {HTMLElement} */
|
|
4009
|
+
/** @type {HTMLElement | null} */
|
|
4055
4010
|
var icon = templateContent.querySelector('swal-icon');
|
|
4056
4011
|
if (icon) {
|
|
4057
4012
|
showWarningsForAttributes(icon, ['type', 'color']);
|
|
4058
4013
|
if (icon.hasAttribute('type')) {
|
|
4059
|
-
/** @type {SweetAlertIcon} */
|
|
4060
|
-
// @ts-ignore
|
|
4061
4014
|
result.icon = icon.getAttribute('type');
|
|
4062
4015
|
}
|
|
4063
4016
|
if (icon.hasAttribute('color')) {
|
|
@@ -4070,16 +4023,15 @@
|
|
|
4070
4023
|
|
|
4071
4024
|
/**
|
|
4072
4025
|
* @param {DocumentFragment} templateContent
|
|
4073
|
-
* @returns {
|
|
4026
|
+
* @returns {Record<string, any>}
|
|
4074
4027
|
*/
|
|
4075
4028
|
var getSwalInput = function getSwalInput(templateContent) {
|
|
4029
|
+
/** @type {Record<string, any>} */
|
|
4076
4030
|
var result = {};
|
|
4077
|
-
/** @type {HTMLElement} */
|
|
4031
|
+
/** @type {HTMLElement | null} */
|
|
4078
4032
|
var input = templateContent.querySelector('swal-input');
|
|
4079
4033
|
if (input) {
|
|
4080
4034
|
showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);
|
|
4081
|
-
/** @type {SweetAlertInput} */
|
|
4082
|
-
// @ts-ignore
|
|
4083
4035
|
result.input = input.getAttribute('type') || 'text';
|
|
4084
4036
|
if (input.hasAttribute('label')) {
|
|
4085
4037
|
result.inputLabel = input.getAttribute('label');
|
|
@@ -4098,6 +4050,9 @@
|
|
|
4098
4050
|
inputOptions.forEach(function (option) {
|
|
4099
4051
|
showWarningsForAttributes(option, ['value']);
|
|
4100
4052
|
var optionValue = option.getAttribute('value');
|
|
4053
|
+
if (!optionValue) {
|
|
4054
|
+
return;
|
|
4055
|
+
}
|
|
4101
4056
|
var optionName = option.innerHTML;
|
|
4102
4057
|
result.inputOptions[optionValue] = optionName;
|
|
4103
4058
|
});
|
|
@@ -4108,13 +4063,14 @@
|
|
|
4108
4063
|
/**
|
|
4109
4064
|
* @param {DocumentFragment} templateContent
|
|
4110
4065
|
* @param {string[]} paramNames
|
|
4111
|
-
* @returns {
|
|
4066
|
+
* @returns {Record<string, any>}
|
|
4112
4067
|
*/
|
|
4113
4068
|
var getSwalStringParams = function getSwalStringParams(templateContent, paramNames) {
|
|
4069
|
+
/** @type {Record<string, any>} */
|
|
4114
4070
|
var result = {};
|
|
4115
4071
|
for (var i in paramNames) {
|
|
4116
4072
|
var paramName = paramNames[i];
|
|
4117
|
-
/** @type {HTMLElement} */
|
|
4073
|
+
/** @type {HTMLElement | null} */
|
|
4118
4074
|
var tag = templateContent.querySelector(paramName);
|
|
4119
4075
|
if (tag) {
|
|
4120
4076
|
showWarningsForAttributes(tag, []);
|
|
@@ -4658,7 +4614,7 @@
|
|
|
4658
4614
|
};
|
|
4659
4615
|
});
|
|
4660
4616
|
SweetAlert.DismissReason = DismissReason;
|
|
4661
|
-
SweetAlert.version = '11.12.
|
|
4617
|
+
SweetAlert.version = '11.12.3';
|
|
4662
4618
|
|
|
4663
4619
|
var Swal = SweetAlert;
|
|
4664
4620
|
// @ts-ignore
|