webcimes-modal 1.1.1 → 1.1.2

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/webpack.config.ts CHANGED
@@ -6,31 +6,28 @@ import TerserPlugin from "terser-webpack-plugin";
6
6
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
7
7
  import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
8
8
  import RemovePlugin from "remove-files-webpack-plugin";
9
-
10
- const isProduction = process.env.NODE_ENV == 'production';
9
+ import TypescriptDeclarationPlugin from "typescript-declaration-webpack-plugin";
10
+ // const isProduction = process.env.NODE_ENV == 'production';
11
11
 
12
12
  // Config UDM
13
13
  const configUDM: webpack.Configuration = {
14
- mode: (isProduction ? "production" : "development"),
15
- // devtool: (isProduction ? false : "source-map"),
14
+ mode: "production",
16
15
  devtool: "source-map",
17
16
  entry: {
18
17
  "webcimes-modal.udm": "./src/ts/webcimes-modal.ts",
19
- "webcimes-modal.udm.min": "./src/ts/webcimes-modal.ts",
20
18
  },
21
19
  optimization: {
22
20
  minimize: true,
23
21
  minimizer: [
24
22
  new TerserPlugin({
25
- test: /\.min\.js$/i,
23
+ test: /\.js$/i,
26
24
  extractComments: false,
27
25
  }),
28
26
  ],
29
27
  },
30
28
  output: {
31
- filename: "js/udm/[name].js",
29
+ filename: "js/[name].js",
32
30
  path: path.resolve(__dirname, "dist"),
33
- // publicPath: "/dist/",
34
31
  libraryTarget: "umd",
35
32
  clean: false, // Clean the output directory before emit.
36
33
  },
@@ -42,22 +39,27 @@ const configUDM: webpack.Configuration = {
42
39
  },
43
40
  ],
44
41
  },
42
+ plugins: [
43
+ new TypescriptDeclarationPlugin({
44
+ out: "./js/webcimes-modal.udm.d.ts",
45
+ removeMergedDeclarations: false,
46
+ removeComments: false,
47
+ }),
48
+ ],
45
49
  };
46
50
 
47
51
  // Config ESM
48
52
  const configESM: webpack.Configuration = {
49
- mode: (isProduction ? "production" : "development"),
50
- // devtool: (isProduction ? false : "source-map"),
53
+ mode: "production",
51
54
  devtool: "source-map",
52
55
  entry: {
53
56
  "webcimes-modal.esm": "./src/ts/webcimes-modal.ts",
54
- "webcimes-modal.esm.min": "./src/ts/webcimes-modal.ts",
55
57
  },
56
58
  optimization: {
57
59
  minimize: true,
58
60
  minimizer: [
59
61
  new TerserPlugin({
60
- test: /\.min\.js$/i,
62
+ test: /\.js$/i,
61
63
  extractComments: false,
62
64
  }),
63
65
  ],
@@ -66,9 +68,8 @@ const configESM: webpack.Configuration = {
66
68
  outputModule: true,
67
69
  },
68
70
  output: {
69
- filename: "js/esm/[name].js",
71
+ filename: "js/[name].js",
70
72
  path: path.resolve(__dirname, "dist"),
71
- // publicPath: "/dist/",
72
73
  libraryTarget: "module",
73
74
  clean: false, // Clean the output directory before emit.
74
75
  },
@@ -80,29 +81,33 @@ const configESM: webpack.Configuration = {
80
81
  },
81
82
  ],
82
83
  },
84
+ plugins: [
85
+ new TypescriptDeclarationPlugin({
86
+ out: "./js/webcimes-modal.esm.d.ts",
87
+ removeMergedDeclarations: false,
88
+ removeComments: false,
89
+ }),
90
+ ],
83
91
  };
84
92
 
85
93
  // Config CSS + Remove plugin
86
94
  const configCSS: webpack.Configuration = {
87
- mode: (isProduction ? "production" : "development"),
88
- // devtool: (isProduction ? false : "source-map"),
95
+ mode: "production",
89
96
  devtool: "source-map",
90
97
  entry: {
91
98
  "webcimes-modal": "./src/css/webcimes-modal.css",
92
- "webcimes-modal.min": "./src/css/webcimes-modal.css",
93
99
  },
94
100
  optimization: {
95
101
  minimize: true,
96
102
  minimizer: [
97
103
  new CssMinimizerPlugin({
98
- test: /\.min\.css$/i,
104
+ test: /\.css$/i,
99
105
  }),
100
106
  ],
101
107
  },
102
108
  output: {
103
109
  filename: "css/[name].js",
104
110
  path: path.resolve(__dirname, "dist"),
105
- // publicPath: "/dist/",
106
111
  clean: false, // Clean the output directory before emit.
107
112
  },
108
113
  module: {
@@ -1,2 +0,0 @@
1
- .webcimesModals,.webcimesModals *,.webcimesModals :after,.webcimesModals :before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.webcimesModals{--webcimes-modals-background:rgba(0,0,0,.8);--webcimes-modals-z-index:5;align-items:center;background:var(--webcimes-modals-background);bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:var(--webcimes-modals-z-index)}.webcimesModals>.modal{--modal-color:inherit;--modal-background:#fff;--modal-border-color:#ddd;--modal-box-shadow:1px 1px 3px 0px #444;--modal-title-font-size:24px;--modal-button-cancel-background:#666;--modal-button-cancel-background-hover:hsla(0,0%,40%,.7);--modal-button-cancel-color:#fff;--modal-button-cancel-color-hover:#fff;--modal-button-confirm-background:#000;--modal-button-confirm-background-hover:rgba(0,0,0,.7);--modal-button-confirm-color:#fff;--modal-button-confirm-color-hover:#fff;background:var(--modal-background);border-radius:5px;-webkit-box-shadow:var(--modal-box-shadow);-moz-box-shadow:var(--modal-box-shadow);-o-box-shadow:var(--modal-box-shadow);box-shadow:var(--modal-box-shadow);color:var(--modal-color);overflow:auto;position:absolute}.webcimesModals>.modal button{background:none;border:none;font-family:inherit;font-size:inherit;font-weight:inherit}.webcimesModals>.modal>.modalHeader{align-items:center;background:var(--modal-background);border-bottom:1px solid var(--modal-border-color);display:flex;padding:20px 40px;position:relative}.webcimesModals>.modal>.modalHeader.sticky{position:sticky;top:0}.webcimesModals>.modal>.modalHeader.movable{cursor:move;touch-action:none}.webcimesModals>.modal>.modalHeader>.title{flex:1;font-size:var(--modal-title-font-size);overflow:hidden;text-overflow:ellipsis}.webcimesModals>.modal>.modalHeader>.close{background-image:url(../images/times.svg);cursor:pointer;height:20px;margin-top:-10px;opacity:1;position:absolute;right:15px;top:50%;-webkit-transition:opacity .6s ease 0s;-moz-transition:opacity .6s ease 0s;-o-transition:opacity .6s ease 0s;transition:opacity .6s ease 0s;width:12px}.webcimesModals>.modal>.modalHeader>.close:hover{opacity:.5}.webcimesModals>.modal>.modalBody{padding:20px 40px}.webcimesModals>.modal>.modalBody.movable{cursor:move}.webcimesModals>.modal>.modalFooter{background:var(--modal-background);border-top:1px solid var(--modal-border-color);display:flex;flex-wrap:wrap;justify-content:flex-end;padding:20px 40px}.webcimesModals>.modal>.modalFooter.sticky{bottom:0;position:sticky}.webcimesModals>.modal>.modalFooter.movable{cursor:move;touch-action:none}.webcimesModals>.modal>.modalFooter button{border-radius:5px;cursor:pointer;flex:0 0 auto;margin:5px;max-width:100%;overflow:hidden;padding:10px 30px;text-overflow:ellipsis;-webkit-transition:color .6s ease 0s,background .6s ease 0s;-moz-transition:color .6s ease 0s,background .6s ease 0s;-o-transition:color .6s ease 0s,background .6s ease 0s;transition:color .6s ease 0s,background .6s ease 0s}.webcimesModals>.modal>.modalFooter button.cancel{background:var(--modal-button-cancel-background);color:var(--modal-button-cancel-color)}.webcimesModals>.modal>.modalFooter button.cancel:hover{background:var(--modal-button-cancel-background-hover);color:var(--modal-button-cancel-color-hover)}.webcimesModals>.modal>.modalFooter button.confirm{background:var(--modal-button-confirm-background);color:var(--modal-button-confirm-color)}.webcimesModals>.modal>.modalFooter button.confirm:hover{background:var(--modal-button-confirm-background-hover);color:var(--modal-button-confirm-color-hover)}@-webkit-keyframes animFadeIn{0%{opacity:0}to{opacity:1}}@keyframes animFadeIn{0%{opacity:0}to{opacity:1}}.animFadeIn{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:animFadeIn;animation-name:animFadeIn}@-webkit-keyframes animFadeOut{0%{opacity:1}to{opacity:0}}@keyframes animFadeOut{0%{opacity:1}to{opacity:0}}.animFadeOut{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:animFadeOut;animation-name:animFadeOut}@-webkit-keyframes animDropDown{0%{opacity:0;-webkit-transform:translateY(-20vh);-moz-transform:translateY(-20vh);-ms-transform:translateY(-20vh);-o-transform:translateY(-20vh);transform:translateY(-20vh)}to{opacity:1;-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);transform:translateY(0)}}@keyframes animDropDown{0%{opacity:0;-webkit-transform:translateY(-20vh);-moz-transform:translateY(-20vh);-ms-transform:translateY(-20vh);-o-transform:translateY(-20vh);transform:translateY(-20vh)}to{opacity:1;-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);transform:translateY(0)}}.animDropDown{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:animDropDown;animation-name:animDropDown}@-webkit-keyframes animDropUp{0%{opacity:1;-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);transform:translateY(0)}to{opacity:0;-webkit-transform:translateY(-20vh);-moz-transform:translateY(-20vh);-ms-transform:translateY(-20vh);-o-transform:translateY(-20vh);transform:translateY(-20vh)}}@keyframes animDropUp{0%{opacity:1;-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);transform:translateY(0)}to{opacity:0;-webkit-transform:translateY(-20vh);-moz-transform:translateY(-20vh);-ms-transform:translateY(-20vh);-o-transform:translateY(-20vh);transform:translateY(-20vh)}}.animDropUp{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:animDropUp;animation-name:animDropUp}@-webkit-keyframes animGrowShrink{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.2);-moz-transform:scale(1.2);-ms-transform:scale(1.2);-o-transform:scale(1.2);transform:scale(1.2)}to{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}@keyframes animGrowShrink{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}to{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}.animGrowShrink{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:animGrowShrink;animation-name:animGrowShrink}
2
- /*# sourceMappingURL=webcimes-modal.min.css.map*/
@@ -1 +0,0 @@
1
- {"version":3,"file":"css/webcimes-modal.min.css","mappings":"AAYA,iFAKC,6BAA8B,CAC9B,0BAA2B,CAC3B,qBACD,CACA,gBAEC,2CAA6C,CAC7C,2BAA4B,CAS5B,kBAAmB,CANnB,4CAA6C,CAE7C,QAAS,CAGT,YAAa,CAEb,sBAAuB,CAJvB,MAAO,CAJP,cAAe,CAKf,OAAQ,CAHR,KAAM,CAON,sCACD,CACA,uBAEC,qBAAsB,CACtB,uBAAwB,CACxB,yBAA0B,CAC1B,uCAAwC,CACxC,4BAA6B,CAC7B,qCAAqD,CACrD,wDAA6D,CAC7D,gCAAiC,CACjC,sCAAuC,CACvC,sCAAgD,CAChD,sDAAwD,CACxD,iCAAkC,CAClC,uCAAwC,CAMxC,kCAAmC,CAHnC,iBAAkB,CAIlB,0CAA2C,CAC3C,uCAAwC,CACxC,qCAAsC,CACtC,kCAAmC,CALnC,wBAAyB,CADzB,aAAa,CAFb,iBASD,CACA,8BAMC,eAAgB,CADhB,WAAY,CAHZ,mBAAoB,CACpB,iBAAkB,CAClB,mBAGD,CACA,oCAOC,kBAAmB,CAJnB,kCAAmC,CAEnC,iDAAkD,CAClD,YAAa,CAFb,iBAAkB,CAFlB,iBAMD,CACA,2CAEC,eAAgB,CAChB,KACD,CACA,4CAEC,WAAY,CACZ,iBACD,CACA,2CAEC,MAAO,CAGP,sCAAuC,CAFvC,eAAgB,CAChB,sBAED,CACA,2CAQC,0CACG,cAAe,CANlB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AAiC,CACjC,wBAAyB,CACzB,qCAAsC,CACtC,6BACD","sources":["webpack://webcimes-modal/./src/css/webcimes-modal.css"],"sourcesContent":["/**\r\n * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)\r\n * MIT License - https://choosealicense.com/licenses/mit/\r\n * Date: 2023-03-25\r\n */\r\n\r\n/*\r\n-----------------------\r\n WEBCIMES MODAL\r\n-----------------------\r\n*/\r\n\r\n.webcimesModals,\r\n.webcimesModals *,\r\n.webcimesModals *::before,\r\n.webcimesModals *::after\r\n{ \r\n\t-webkit-box-sizing: border-box;\r\n\t-moz-box-sizing: border-box;\r\n\tbox-sizing: border-box;\r\n}\r\n.webcimesModals\r\n{\r\n\t--webcimes-modals-background: rgba(0,0,0,0.8);\r\n\t--webcimes-modals-z-index: 5;\r\n\r\n\tposition: fixed;\r\n\tbackground: var(--webcimes-modals-background);\r\n\ttop: 0;\r\n\tbottom: 0;\r\n\tleft: 0;\r\n\tright: 0;\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: center;\r\n\tz-index: var(--webcimes-modals-z-index);\r\n}\r\n.webcimesModals > .modal\r\n{\r\n\t--modal-color: inherit;\r\n\t--modal-background: #fff;\r\n\t--modal-border-color: #ddd;\r\n\t--modal-box-shadow: 1px 1px 3px 0px #444;\r\n\t--modal-title-font-size: 24px;\r\n\t--modal-button-cancel-background: rgba(102,102,102,1);\r\n\t--modal-button-cancel-background-hover: rgba(102,102,102,0.7);\r\n\t--modal-button-cancel-color: #fff;\r\n\t--modal-button-cancel-color-hover: #fff;\r\n\t--modal-button-confirm-background: rgba(0,0,0,1);\r\n\t--modal-button-confirm-background-hover: rgba(0,0,0,0.7);\r\n\t--modal-button-confirm-color: #fff;\r\n\t--modal-button-confirm-color-hover: #fff;\r\n\t\r\n\tposition: absolute;\r\n\tborder-radius: 5px;\r\n\toverflow:auto;\r\n\tcolor: var(--modal-color);\r\n\tbackground: var(--modal-background);\r\n\t-webkit-box-shadow: var(--modal-box-shadow);\r\n\t-moz-box-shadow: var(--modal-box-shadow);\r\n\t-o-box-shadow: var(--modal-box-shadow);\r\n\tbox-shadow: var(--modal-box-shadow);\r\n}\r\n.webcimesModals > .modal button\r\n{\r\n\tfont-family: inherit;\r\n\tfont-size: inherit;\r\n\tfont-weight: inherit;\r\n\tborder: none;\r\n\tbackground: none;\r\n}\r\n.webcimesModals > .modal > .modalHeader\r\n{\r\n\tposition: relative;\r\n\tbackground: var(--modal-background);\r\n\tpadding: 20px 40px;\r\n\tborder-bottom: 1px solid var(--modal-border-color);\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n}\r\n.webcimesModals > .modal > .modalHeader.sticky\r\n{\r\n\tposition: sticky;\r\n\ttop: 0;\r\n}\r\n.webcimesModals > .modal > .modalHeader.movable\r\n{\r\n\tcursor: move;\r\n\ttouch-action: none;\r\n}\r\n.webcimesModals > .modal > .modalHeader > .title\r\n{\r\n\tflex: 1;\r\n\toverflow: hidden;\r\n\ttext-overflow: ellipsis;\r\n\tfont-size: var(--modal-title-font-size);\r\n}\r\n.webcimesModals > .modal > .modalHeader > .close\r\n{\r\n\tposition: absolute;\r\n\theight: 20px;\r\n\twidth: 12px;\r\n\tright: 15px;\r\n\ttop: 50%;\r\n\tmargin-top: -10px;\r\n\tbackground-image: url(\"../images/times.svg\");\r\n cursor: pointer;\r\n\topacity: 1;\r\n -webkit-transition: opacity 0.6s ease 0s;\r\n -moz-transition: opacity 0.6s ease 0s;\r\n -o-transition: opacity 0.6s ease 0s;\r\n transition: opacity 0.6s ease 0s;\r\n}\r\n.webcimesModals > .modal > .modalHeader > .close:hover\r\n{\r\n\topacity: 0.5;\r\n}\r\n.webcimesModals > .modal > .modalBody\r\n{\r\n\tpadding: 20px 40px;\r\n}\r\n.webcimesModals > .modal > .modalBody.movable\r\n{\r\n\tcursor: move;\r\n}\r\n.webcimesModals > .modal > .modalFooter\r\n{\r\n\tbackground: var(--modal-background);\r\n\tpadding: 20px 40px;\r\n\tborder-top: 1px solid var(--modal-border-color);\r\n\tdisplay: flex;\r\n\tjustify-content: flex-end;\r\n\tflex-wrap: wrap;\r\n}\r\n.webcimesModals > .modal > .modalFooter.sticky\r\n{\r\n\tposition: sticky;\r\n\tbottom: 0;\r\n}\r\n.webcimesModals > .modal > .modalFooter.movable\r\n{\r\n\tcursor: move;\r\n\ttouch-action: none;\r\n}\r\n.webcimesModals > .modal > .modalFooter button\r\n{\r\n\tmax-width: 100%;\r\n\tflex: 0 0 auto;\r\n\tborder-radius: 5px;\r\n\tpadding: 10px 30px;\r\n\tmargin: 5px;\r\n\tcursor: pointer;\r\n\ttext-overflow: ellipsis;\r\n\toverflow: hidden;\r\n -webkit-transition: color 0.6s ease 0s, background 0.6s ease 0s;\r\n -moz-transition: color 0.6s ease 0s, background 0.6s ease 0s;\r\n -o-transition: color 0.6s ease 0s, background 0.6s ease 0s;\r\n transition: color 0.6s ease 0s, background 0.6s ease 0s;\r\n}\r\n.webcimesModals > .modal > .modalFooter button.cancel\r\n{\r\n\tbackground: var(--modal-button-cancel-background);\r\n\tcolor: var(--modal-button-cancel-color);\r\n}\r\n.webcimesModals > .modal > .modalFooter button.cancel:hover\r\n{\r\n\tbackground: var(--modal-button-cancel-background-hover);\r\n\tcolor: var(--modal-button-cancel-color-hover);\r\n}\r\n.webcimesModals > .modal > .modalFooter button.confirm\r\n{\r\n\tbackground: var(--modal-button-confirm-background);\r\n\tcolor: var(--modal-button-confirm-color);\r\n}\r\n.webcimesModals > .modal > .modalFooter button.confirm:hover\r\n{\r\n\tbackground: var(--modal-button-confirm-background-hover);\r\n\tcolor: var(--modal-button-confirm-color-hover);\r\n}\r\n\r\n/* ANIMATIONS */\r\n\r\n@-webkit-keyframes animFadeIn\r\n{\r\n\t0%\r\n\t{\r\n\t\topacity: 0;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\topacity: 1;\r\n\t}\r\n}\r\n@keyframes animFadeIn\r\n{\r\n\t0%\r\n\t{\r\n\t\topacity:0;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\topacity:1;\r\n\t}\r\n}\r\n.animFadeIn\r\n{\r\n\t-webkit-animation-duration: 0.5s;\r\n\tanimation-duration: 0.5s;\r\n\t-webkit-animation-fill-mode: both;\r\n\tanimation-fill-mode: both;\r\n\t-webkit-animation-name: animFadeIn;\r\n\tanimation-name: animFadeIn;\r\n}\r\n\r\n@-webkit-keyframes animFadeOut\r\n{\r\n\t0%\r\n\t{\r\n\t\topacity: 1;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\topacity: 0;\r\n\t}\r\n}\r\n@keyframes animFadeOut\r\n{\r\n\t0%\r\n\t{\r\n\t\topacity: 1;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\topacity: 0;\r\n\t}\r\n}\r\n.animFadeOut\r\n{\r\n\t-webkit-animation-duration: 0.5s;\r\n\tanimation-duration: 0.5s;\r\n\t-webkit-animation-fill-mode: both;\r\n\tanimation-fill-mode: both;\r\n\t-webkit-animation-name: animFadeOut;\r\n\tanimation-name: animFadeOut;\r\n}\r\n\r\n@-webkit-keyframes animDropDown\r\n{\r\n\t0%\r\n\t{\r\n\t\t-webkit-transform: translateY(-20vh);\r\n\t\t-moz-transform: translateY(-20vh);\r\n\t\t-ms-transform: translateY(-20vh);\r\n\t\t-o-transform: translateY(-20vh);\r\n\t\ttransform: translateY(-20vh);\r\n\t\topacity: 0;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\t-webkit-transform: translateY(0);\r\n\t\t-moz-transform: translateY(0);\r\n\t\t-ms-transform: translateY(0);\r\n\t\t-o-transform: translateY(0);\r\n\t\ttransform: translateY(0);\r\n\t\topacity: 1;\r\n\t}\r\n}\r\n\r\n@keyframes animDropDown\r\n{\r\n\t0%\r\n\t{\r\n\t\t-webkit-transform: translateY(-20vh);\r\n\t\t-moz-transform: translateY(-20vh);\r\n\t\t-ms-transform: translateY(-20vh);\r\n\t\t-o-transform: translateY(-20vh);\r\n\t\ttransform: translateY(-20vh);\r\n\t\topacity: 0;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\t-webkit-transform: translateY(0);\r\n\t\t-moz-transform: translateY(0);\r\n\t\t-ms-transform: translateY(0);\r\n\t\t-o-transform: translateY(0);\r\n\t\ttransform: translateY(0);\r\n\t\topacity: 1;\r\n\t}\r\n}\r\n.animDropDown\r\n{\r\n\t-webkit-animation-duration: 0.5s;\r\n\tanimation-duration: 0.5s;\r\n\t-webkit-animation-fill-mode: both;\r\n\tanimation-fill-mode: both;\r\n\t-webkit-animation-name: animDropDown;\r\n\tanimation-name: animDropDown;\r\n}\r\n\r\n@-webkit-keyframes animDropUp\r\n{\r\n\t0%\r\n\t{\r\n\t\t-webkit-transform: translateY(0);\r\n\t\t-moz-transform: translateY(0);\r\n\t\t-ms-transform: translateY(0);\r\n\t\t-o-transform: translateY(0);\r\n\t\ttransform: translateY(0);\r\n\t\topacity: 1;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\t-webkit-transform: translateY(-20vh);\r\n\t\t-moz-transform: translateY(-20vh);\r\n\t\t-ms-transform: translateY(-20vh);\r\n\t\t-o-transform: translateY(-20vh);\r\n\t\ttransform: translateY(-20vh);\r\n\t\topacity: 0;\r\n\t}\r\n}\r\n\r\n@keyframes animDropUp\r\n{\r\n\t0%\r\n\t{\r\n\t\t-webkit-transform: translateY(0);\r\n\t\t-moz-transform: translateY(0);\r\n\t\t-ms-transform: translateY(0);\r\n\t\t-o-transform: translateY(0);\r\n\t\ttransform: translateY(0);\r\n\t\topacity: 1;\r\n\t} \r\n\t100%\r\n\t{\r\n\t\t-webkit-transform: translateY(-20vh);\r\n\t\t-moz-transform: translateY(-20vh);\r\n\t\t-ms-transform: translateY(-20vh);\r\n\t\t-o-transform: translateY(-20vh);\r\n\t\ttransform: translateY(-20vh);\r\n\t\topacity: 0;\r\n\t}\r\n}\r\n.animDropUp\r\n{\r\n\t-webkit-animation-duration: 0.5s;\r\n\tanimation-duration: 0.5s;\r\n\t-webkit-animation-fill-mode: both;\r\n\tanimation-fill-mode: both;\r\n\t-webkit-animation-name: animDropUp;\r\n\tanimation-name: animDropUp;\r\n}\r\n\r\n@-webkit-keyframes animGrowShrink\r\n{\r\n\t0%\r\n\t{\r\n\t\t-webkit-transform: scale(1);\r\n\t\t-moz-transform: scale(1);\r\n\t\t-ms-transform: scale(1);\r\n\t\t-o-transform: scale(1);\r\n\t\ttransform: scale(1);\r\n\t}\r\n\t50%\r\n\t{\r\n\t\t-webkit-transform: scale(1.2);\r\n\t\t-moz-transform: scale(1.2);\r\n\t\t-ms-transform: scale(1.2);\r\n\t\t-o-transform: scale(1.2);\r\n\t\ttransform: scale(1.2);\r\n\t}\r\n\t100%\r\n\t{\r\n\t\t-webkit-transform: scale(1);\r\n\t\t-moz-transform: scale(1);\r\n\t\t-ms-transform: scale(1);\r\n\t\t-o-transform: scale(1);\r\n\t\ttransform: scale(1);\r\n\t}\r\n}\r\n\r\n@keyframes animGrowShrink\r\n{\r\n\t0%\r\n\t{\r\n\t\t-webkit-transform: scale(1);\r\n\t\t-moz-transform: scale(1);\r\n\t\t-ms-transform: scale(1);\r\n\t\t-o-transform: scale(1);\r\n\t\ttransform: scale(1);\r\n\t}\r\n\t50%\r\n\t{\r\n\t\t-webkit-transform: scale(1.1);\r\n\t\t-moz-transform: scale(1.1);\r\n\t\t-ms-transform: scale(1.1);\r\n\t\t-o-transform: scale(1.1);\r\n\t\ttransform: scale(1.1);\r\n\t}\r\n\t100%\r\n\t{\r\n\t\t-webkit-transform: scale(1);\r\n\t\t-moz-transform: scale(1);\r\n\t\t-ms-transform: scale(1);\r\n\t\t-o-transform: scale(1);\r\n\t\ttransform: scale(1);\r\n\t}\r\n}\r\n.animGrowShrink\r\n{\r\n\t-webkit-animation-duration: 0.5s;\r\n\tanimation-duration: 0.5s;\r\n\t-webkit-animation-fill-mode: both;\r\n\tanimation-fill-mode: both;\r\n\t-webkit-animation-name: animGrowShrink;\r\n\tanimation-name: animGrowShrink;\r\n}"],"names":[],"sourceRoot":""}
@@ -1,396 +0,0 @@
1
- /******/ // The require scope
2
- /******/ var __webpack_require__ = {};
3
- /******/
4
- /************************************************************************/
5
- /******/ /* webpack/runtime/define property getters */
6
- /******/ (() => {
7
- /******/ // define getter functions for harmony exports
8
- /******/ __webpack_require__.d = (exports, definition) => {
9
- /******/ for(var key in definition) {
10
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
11
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
12
- /******/ }
13
- /******/ }
14
- /******/ };
15
- /******/ })();
16
- /******/
17
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
18
- /******/ (() => {
19
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
20
- /******/ })();
21
- /******/
22
- /************************************************************************/
23
- var __webpack_exports__ = {};
24
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25
- /* harmony export */ V: () => (/* binding */ WebcimesModal)
26
- /* harmony export */ });
27
- /**
28
- * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)
29
- * MIT License - https://choosealicense.com/licenses/mit/
30
- * Date: 2023-03-25
31
- */
32
-
33
- /**
34
- * Class WebcimesModal
35
- */
36
- class WebcimesModal {
37
- webcimesModals;
38
- modal;
39
- options;
40
- eventCancelButton = () => {
41
- // Callback on cancel button
42
- if (typeof this.options.onCancelButton === 'function') {
43
- this.options.onCancelButton();
44
- }
45
- };
46
- eventConfirmButton = () => {
47
- // Callback on confirm button
48
- if (typeof this.options.onConfirmButton === 'function') {
49
- this.options.onConfirmButton();
50
- }
51
- };
52
- eventClickOutside = (e) => {
53
- if (e.target == this.webcimesModals) {
54
- if (this.options.allowCloseOutside) {
55
- // Destroy modal
56
- this.destroy();
57
- }
58
- else {
59
- // Add animation for show modal who can't be close
60
- this.modal.classList.add("animGrowShrink");
61
- // Delete animation after the animation delay
62
- setTimeout(() => {
63
- this.modal.classList.remove("animGrowShrink");
64
- }, this.options.animationDuration);
65
- }
66
- }
67
- };
68
- eventClickCloseButton = () => {
69
- // Destroy modal
70
- this.destroy();
71
- };
72
- eventDragModalOnTop = (e) => {
73
- // Only if target is not close button (for bug in chrome)
74
- if (!e.target.closest(".close")) {
75
- // If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top
76
- if (document.querySelectorAll(".modal").length > 1 && this.modal.nextElementSibling !== null) {
77
- let oldScrollTop = this.modal.scrollTop;
78
- this.webcimesModals.insertAdjacentElement("beforeend", this.modal);
79
- this.modal.scrollTop = oldScrollTop;
80
- }
81
- }
82
- };
83
- position;
84
- offset;
85
- isDragging = false;
86
- moveFromElements = [];
87
- eventDragStart = (e) => {
88
- // Start drag only if it's not a button
89
- if (!e.target.closest("button")) {
90
- this.isDragging = true;
91
- // Mouse
92
- if (e.clientX) {
93
- this.offset = {
94
- x: this.modal.offsetLeft - e.clientX,
95
- y: this.modal.offsetTop - e.clientY
96
- };
97
- }
98
- // Touch device (use the first touch only)
99
- else if (e.touches) {
100
- this.offset = {
101
- x: this.modal.offsetLeft - e.touches[0].clientX,
102
- y: this.modal.offsetTop - e.touches[0].clientY
103
- };
104
- }
105
- }
106
- };
107
- eventMove = (e) => {
108
- if (this.isDragging) {
109
- // Mouse
110
- if (e.clientX) {
111
- this.position = {
112
- x: e.clientX,
113
- y: e.clientY
114
- };
115
- }
116
- // Touch device (use the first touch only)
117
- else if (e.touches) {
118
- this.position = {
119
- x: e.touches[0].clientX,
120
- y: e.touches[0].clientY
121
- };
122
- }
123
- this.modal.style.left = (this.position.x + this.offset.x) + 'px';
124
- this.modal.style.top = (this.position.y + this.offset.y) + 'px';
125
- }
126
- };
127
- eventDragStop = () => {
128
- this.isDragging = false;
129
- };
130
- eventPreventSelectText = (e) => {
131
- if (this.isDragging) {
132
- e.preventDefault();
133
- }
134
- };
135
- eventResize = () => {
136
- this.modal.style.removeProperty("left");
137
- this.modal.style.removeProperty("top");
138
- };
139
- /**
140
- * Create modal
141
- * @param {Object} options
142
- * @param {string | null} options.setId - set a specific id on the modal. default "null"
143
- * @param {string | null} options.setClass - set a specific class on the modal, default "null"
144
- * @param {string} options.width - width (specify unit), default "auto"
145
- * @param {string} options.height - height (specify unit), default "auto"
146
- * @param {string | null} options.titleHtml - html for title, default "null"
147
- * @param {string | null} options.bodyHtml - html for body, default "null"
148
- * @param {string | null} options.buttonCancelHtml - html for cancel button, default "null"
149
- * @param {string | null} options.buttonConfirmHtml - html for confirm button, default "null"
150
- * @param {boolean} options.closeOnCancelButton - close modal after trigger cancel button, default "true"
151
- * @param {boolean} options.closeOnConfirmButton - close modal after trigger confirm button, default "true"
152
- * @param {boolean} options.showCloseButton - show close button, default "true"
153
- * @param {boolean} options.allowCloseOutside - allow the modal to close when clicked outside, default "true"
154
- * @param {boolean} options.allowMovement - ability to move modal, default "true"
155
- * @param {boolean} options.moveFromHeader - if allowMovement is set to "true", ability to move modal from header, default "true"
156
- * @param {boolean} options.moveFromBody - if allowMovement is set to "true", ability to move modal from body, default "false"
157
- * @param {boolean} options.moveFromFooter - if allowMovement is set to "true", ability to move modal from footer, default "true"
158
- * @param {boolean} options.stickyHeader - keep header sticky (visible) when scrolling, default "true"
159
- * @param {boolean} options.stickyFooter - keep footer sticky (visible) when scrolling, default "true"
160
- * @param {string | null} options.style - add extra css style to modal, default null
161
- * @param {"animDropDown" | "animFadeIn"} options.animationOnShow - "animDropDown" or "animFadeIn" for show animation, default "animDropDown"
162
- * @param {"animDropUp" | "animFadeOut"} options.animationOnDestroy - "animDropUp" or "animFadeOut" for destroy animation, default "animDropUp"
163
- * @param {number} options.animationDuration - animation duration in ms, default "500"
164
- * @param {() => void} options.beforeShow - callback before show modal
165
- * @param {() => void} options.afterShow - callback after show modal
166
- * @param {() => void} options.beforeDestroy - callback before destroy modal
167
- * @param {() => void} options.afterDestroy - callback after destroy modal
168
- * @param {() => void} options.onCancelButton - callback after triggering cancel button
169
- * @param {() => void} options.onConfirmButton - callback after triggering confirm button
170
- */
171
- constructor(options) {
172
- // Defaults
173
- const defaults = {
174
- setId: null,
175
- setClass: null,
176
- width: 'auto',
177
- height: 'auto',
178
- titleHtml: null,
179
- bodyHtml: null,
180
- buttonCancelHtml: null,
181
- buttonConfirmHtml: null,
182
- closeOnCancelButton: true,
183
- closeOnConfirmButton: true,
184
- showCloseButton: true,
185
- allowCloseOutside: true,
186
- allowMovement: true,
187
- moveFromHeader: true,
188
- moveFromBody: false,
189
- moveFromFooter: true,
190
- stickyHeader: true,
191
- stickyFooter: true,
192
- style: null,
193
- animationOnShow: 'animDropDown',
194
- animationOnDestroy: 'animDropUp',
195
- animationDuration: 500,
196
- beforeShow: () => { },
197
- afterShow: () => { },
198
- beforeDestroy: () => { },
199
- afterDestroy: () => { },
200
- onCancelButton: () => { },
201
- onConfirmButton: () => { },
202
- };
203
- this.options = { ...defaults, ...options };
204
- // Call init method
205
- this.init();
206
- }
207
- /**
208
- * Init modal
209
- */
210
- init() {
211
- // Create webcimesModals
212
- if (!document.querySelector(".webcimesModals")) {
213
- // Create webcimesModals
214
- document.body.insertAdjacentHTML("beforeend", '<div class="webcimesModals animFadeIn"></div>');
215
- this.webcimesModals = document.querySelector(".webcimesModals");
216
- // Set animation duration for webcimesModals
217
- this.webcimesModals.style.setProperty("animation-duration", this.options.animationDuration + "ms");
218
- // Delete enter animation after animation delay
219
- setTimeout(() => {
220
- this.webcimesModals.classList.remove("animFadeIn");
221
- }, this.options.animationDuration);
222
- }
223
- else {
224
- this.webcimesModals = document.querySelector(".webcimesModals");
225
- }
226
- // Create modal
227
- this.webcimesModals.insertAdjacentHTML("beforeend", `<div class="modal ` + (this.options.setClass ? this.options.setClass : '') + ` ` + this.options.animationOnShow + `" ` + (this.options.setId ? 'id="' + this.options.setId + '"' : '') + `>
228
- ` + (this.options.titleHtml || this.options.showCloseButton ?
229
- `<div class="modalHeader ` + (this.options.stickyHeader ? 'sticky' : '') + ` ` + (this.options.moveFromHeader ? 'movable' : '') + `">
230
- ` + (this.options.titleHtml ? '<div class="title">' + this.options.titleHtml + '</div>' : '') + `
231
- ` + (this.options.showCloseButton ? '<button class="close"></button>' : '') + `
232
- </div>`
233
- : '') + `
234
- ` + (this.options.bodyHtml ?
235
- `<div class="modalBody ` + (this.options.moveFromBody ? 'movable' : '') + `">
236
- ` + this.options.bodyHtml + `
237
- </div>`
238
- : '') + `
239
- ` + (this.options.buttonCancelHtml || this.options.buttonConfirmHtml ?
240
- `<div class="modalFooter ` + (this.options.stickyFooter ? 'sticky' : '') + ` ` + (this.options.moveFromFooter ? 'movable' : '') + `">
241
- ` + (this.options.buttonCancelHtml ? '<button class="cancel ' + (this.options.closeOnCancelButton ? 'close' : '') + '">' + this.options.buttonCancelHtml + '</button>' : '') + `
242
- ` + (this.options.buttonConfirmHtml ? '<button class="confirm ' + (this.options.closeOnConfirmButton ? 'close' : '') + '">' + this.options.buttonConfirmHtml + '</button>' : '') + `
243
- </div>`
244
- : '') + `
245
- </div>`);
246
- this.modal = this.webcimesModals.lastElementChild;
247
- // Callback before show modal
248
- if (typeof this.options.beforeShow === 'function') {
249
- // Set a timeout of zero, to wait for some dom to load
250
- setTimeout(() => {
251
- this.options.beforeShow();
252
- }, 0);
253
- }
254
- // Set animation duration for modal
255
- this.modal.style.setProperty("animation-duration", this.options.animationDuration + "ms");
256
- // Delete animation of enter after the animation delay
257
- setTimeout(() => {
258
- this.modal.classList.remove(this.options.animationOnShow);
259
- // Callback after show modal
260
- if (typeof this.options.afterShow === 'function') {
261
- this.options.afterShow();
262
- }
263
- }, this.options.animationDuration);
264
- // Width of modal
265
- this.modal.style.setProperty("max-width", "90%");
266
- if (this.options.width != "auto" && this.options.width) {
267
- this.modal.style.setProperty("width", this.options.width);
268
- }
269
- else {
270
- // "max-content" is for keep size in "auto" and for maximum to max-width
271
- this.modal.style.setProperty("width", "max-content");
272
- }
273
- // Height of modal
274
- this.modal.style.setProperty("max-height", "90%");
275
- if (this.options.height != "auto" && this.options.height) {
276
- this.modal.style.setProperty("height", this.options.height);
277
- }
278
- else {
279
- // "max-content" is for keep size in "auto" and for maximum to max-height
280
- this.modal.style.setProperty("height", "max-content");
281
- }
282
- // Style
283
- if (this.options.style) {
284
- let oldStyle = this.modal.getAttribute("style");
285
- this.modal.setAttribute("style", oldStyle + this.options.style);
286
- }
287
- // Event on cancel button
288
- if (this.options.buttonCancelHtml) {
289
- this.modal.querySelector(".cancel")?.addEventListener("click", this.eventCancelButton);
290
- }
291
- // Event on confirm button
292
- if (this.options.buttonConfirmHtml) {
293
- this.modal.querySelector(".confirm")?.addEventListener("click", this.eventConfirmButton);
294
- }
295
- // Event click outside (on webcimesModals)
296
- this.webcimesModals.addEventListener("click", this.eventClickOutside);
297
- // Event close modal when click on close button
298
- this.modal.querySelectorAll(".close").forEach((el) => {
299
- el.addEventListener("click", this.eventClickCloseButton);
300
- });
301
- // Place selected modal on top
302
- ['mousedown', 'touchstart'].forEach((typeEvent) => {
303
- this.modal.addEventListener(typeEvent, this.eventDragModalOnTop);
304
- });
305
- // Move modal
306
- if (this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter)) {
307
- if (this.options.moveFromHeader && this.modal.querySelector(".modalHeader")) {
308
- this.moveFromElements.push(this.modal.querySelector(".modalHeader"));
309
- }
310
- if (this.options.moveFromBody && this.modal.querySelector(".modalBody")) {
311
- this.moveFromElements.push(this.modal.querySelector(".modalBody"));
312
- }
313
- if (this.options.moveFromFooter && this.modal.querySelector(".modalFooter")) {
314
- this.moveFromElements.push(this.modal.querySelector(".modalFooter"));
315
- }
316
- ['mousedown', 'touchstart'].forEach((typeEvent) => {
317
- this.moveFromElements.forEach((el) => {
318
- el.addEventListener(typeEvent, this.eventDragStart);
319
- });
320
- });
321
- ['mousemove', 'touchmove'].forEach((typeEvent) => {
322
- document.addEventListener(typeEvent, this.eventMove);
323
- });
324
- ['mouseup', 'touchend'].forEach((typeEvent) => {
325
- document.addEventListener(typeEvent, this.eventDragStop);
326
- });
327
- document.addEventListener("selectstart", this.eventPreventSelectText);
328
- }
329
- // When resizing window, reset modal position to center
330
- window.addEventListener("resize", this.eventResize);
331
- }
332
- /**
333
- * Destroy modal
334
- */
335
- destroy() {
336
- // If modal is not already destroying
337
- if (!this.modal.getAttribute("data-destroying")) {
338
- // Callback before destroy modal
339
- if (typeof this.options.beforeDestroy === 'function') {
340
- this.options.beforeDestroy();
341
- }
342
- // Close webcimesModals (according the number of modal not already destroying)
343
- if (document.querySelectorAll(".modal:not([data-destroying])").length == 1) {
344
- this.webcimesModals.classList.add("animFadeOut");
345
- }
346
- // Close modal
347
- this.modal.setAttribute("data-destroying", "1");
348
- this.modal.classList.add(this.options.animationOnDestroy);
349
- // Destroy all events from modal and remove webcimesModals or modal after animation duration
350
- setTimeout(() => {
351
- if (typeof this.modal !== 'undefined') {
352
- // Destroy all events from modal
353
- if (this.options.buttonCancelHtml) {
354
- this.modal.querySelector(".cancel")?.removeEventListener("click", this.eventCancelButton);
355
- }
356
- if (this.options.buttonConfirmHtml) {
357
- this.modal.querySelector(".confirm")?.removeEventListener("click", this.eventConfirmButton);
358
- }
359
- this.webcimesModals.removeEventListener("click", this.eventClickOutside);
360
- this.modal.querySelectorAll(".close").forEach((el) => {
361
- el.removeEventListener("click", this.eventClickCloseButton);
362
- });
363
- ['mousedown', 'touchstart'].forEach((typeEvent) => {
364
- this.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);
365
- });
366
- if (this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter)) {
367
- ['mousedown', 'touchstart'].forEach((typeEvent) => {
368
- this.moveFromElements.forEach((el) => {
369
- el.removeEventListener(typeEvent, this.eventDragStart);
370
- });
371
- });
372
- ['mousemove', 'touchmove'].forEach((typeEvent) => {
373
- document.removeEventListener(typeEvent, this.eventMove);
374
- });
375
- ['mouseup', 'touchend'].forEach((typeEvent) => {
376
- document.removeEventListener(typeEvent, this.eventDragStop);
377
- });
378
- document.removeEventListener("selectstart", this.eventPreventSelectText);
379
- }
380
- window.removeEventListener("resize", this.eventResize);
381
- // Remove webcimesModals or modal according the number of modal
382
- (document.querySelectorAll(".modal").length > 1 ? this.modal : this.webcimesModals).remove();
383
- }
384
- // Callback after destroy modal
385
- if (typeof this.options.afterDestroy === 'function') {
386
- this.options.afterDestroy();
387
- }
388
- }, this.options.animationDuration);
389
- }
390
- }
391
- }
392
-
393
- var __webpack_exports__WebcimesModal = __webpack_exports__.V;
394
- export { __webpack_exports__WebcimesModal as WebcimesModal };
395
-
396
- //# sourceMappingURL=webcimes-modal.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"js/esm/webcimes-modal.esm.js","mappings":"SAAA;SACA;;;;;UCDA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;;;;ACAA;;;;GAIG;AAEU;AAgEb;;GAEG;AACI,MAAM,aAAa;IAElB,cAAc,CAAc;IAC5B,KAAK,CAAc;IAClB,OAAO,CAAU;IACjB,iBAAiB,GAAe,GAAG,EAAE;QAC5C,4BAA4B;QAC5B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,UAAU,EACpD;YACC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;SAC9B;IACF,CAAC,CAAC;IACM,kBAAkB,GAAe,GAAG,EAAE;QAC7C,6BAA6B;QAC7B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,KAAK,UAAU,EACrD;YACC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;SAC/B;IACF,CAAC,CAAC;IACM,iBAAiB,GAAuB,CAAC,CAAC,EAAE,EAAE;QACrD,IAAG,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,EAClC;YACC,IAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EACjC;gBACC,gBAAgB;gBAChB,IAAI,CAAC,OAAO,EAAE,CAAC;aACf;iBAED;gBACC,kDAAkD;gBAClD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAA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AAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAC,CAAC,EAAC,KAAI,CAAC,KAAK,EAAC,KAAI,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC;iBACvF;gBAED,+BAA+B;gBAC/B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,KAAK,UAAU,EAClD;oBACC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;iBAC5B;YACF,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;SACnC;IACF,CAAC;CACD","sources":["webpack://webcimes-modal/webpack/bootstrap","webpack://webcimes-modal/webpack/runtime/define property getters","webpack://webcimes-modal/webpack/runtime/hasOwnProperty shorthand","webpack://webcimes-modal/./src/ts/webcimes-modal.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/**\r\n * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)\r\n * MIT License - https://choosealicense.com/licenses/mit/\r\n * Date: 2023-03-25\r\n */\r\n\r\n\"use strict\";\r\n\r\n/**\r\n * Options\r\n */\r\ninterface Options {\r\n\t/** set a specific id on the modal. default \"null\" */\r\n\tsetId: string | null;\r\n\t/** set a specific class on the modal, default \"null\" */\r\n\tsetClass: string | null;\r\n\t/** width (specify unit), default \"auto\" */\r\n\twidth: string;\r\n\t/** height (specify unit), default \"auto\" */\r\n\theight: string;\r\n\t/** html for title, default \"null\" */\r\n\ttitleHtml: string | null;\r\n\t/** html for body, default \"null\" */\r\n\tbodyHtml: string | null;\r\n\t/** html for cancel button, default \"null\" */\r\n\tbuttonCancelHtml: string | null;\r\n\t/** html for confirm button, default \"null\" */\r\n\tbuttonConfirmHtml: string | null;\r\n\t/** close modal after trigger cancel button, default \"true\" */\r\n\tcloseOnCancelButton: boolean;\r\n\t/** close modal after trigger confirm button, default \"true\" */\r\n\tcloseOnConfirmButton: boolean;\r\n\t/** show close button, default \"true\" */\r\n\tshowCloseButton: boolean;\r\n\t/** allow the modal to close when clicked outside, default \"true\" */\r\n\tallowCloseOutside: boolean;\r\n\t/** ability to move modal, default \"true\" */\r\n\tallowMovement: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from header, default \"true\" */\r\n\tmoveFromHeader: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from body, default \"false\" */\r\n\tmoveFromBody: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from footer, default \"true\" */\r\n\tmoveFromFooter: boolean;\r\n\t/** keep header sticky (visible) when scrolling, default \"true\" */\r\n\tstickyHeader: boolean;\r\n\t/** keep footer sticky (visible) when scrolling, default \"true\" */\r\n\tstickyFooter: boolean;\r\n\t/** add extra css style to modal, default null */\r\n\tstyle: string | null;\r\n\t/** \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\" */\r\n\tanimationOnShow: \"animDropDown\" | \"animFadeIn\";\r\n\t/** \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\" */\r\n\tanimationOnDestroy: \"animDropUp\" | \"animFadeOut\";\r\n\t/** animation duration in ms, default \"500\" */\r\n\tanimationDuration: number;\r\n\t/** callback before show modal */\r\n\tbeforeShow: () => void;\r\n\t/** callback after show modal */\r\n\tafterShow: () => void;\r\n\t/** callback before destroy modal */\r\n\tbeforeDestroy: () => void;\r\n\t/** callback after destroy modal */\r\n\tafterDestroy: () => void;\r\n\t/** callback after triggering cancel button */\r\n\tonCancelButton: () => void;\r\n\t/** callback after triggering confirm button */\r\n\tonConfirmButton: () => void;\r\n}\r\n\r\n/**\r\n * Class WebcimesModal\r\n */\r\nexport class WebcimesModal\r\n{\r\n\tpublic webcimesModals: HTMLElement;\r\n\tpublic modal: HTMLElement;\r\n\tprivate options: Options;\r\n\tprivate eventCancelButton: () => void = () => {\r\n\t\t// Callback on cancel button\r\n\t\tif(typeof this.options.onCancelButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onCancelButton();\r\n\t\t}\r\n\t};\r\n\tprivate eventConfirmButton: () => void = () => {\r\n\t\t// Callback on confirm button\r\n\t\tif(typeof this.options.onConfirmButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onConfirmButton();\r\n\t\t}\r\n\t};\r\n\tprivate eventClickOutside: (e: Event) => void = (e) => {\r\n\t\tif(e.target == this.webcimesModals)\r\n\t\t{\r\n\t\t\tif(this.options.allowCloseOutside)\r\n\t\t\t{\r\n\t\t\t\t// Destroy modal\r\n\t\t\t\tthis.destroy();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Add animation for show modal who can't be close\r\n\t\t\t\tthis.modal.classList.add(\"animGrowShrink\");\r\n\r\n\t\t\t\t// Delete animation after the animation delay\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tthis.modal.classList.remove(\"animGrowShrink\");\r\n\t\t\t\t}, this.options.animationDuration);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tprivate eventClickCloseButton: () => void = () => {\r\n\t\t// Destroy modal\r\n\t\tthis.destroy();\r\n\t};\r\n\tprivate eventDragModalOnTop: (e: Event) => void = (e) => {\r\n\t\t// Only if target is not close button (for bug in chrome)\r\n\t\tif(!(<HTMLElement>e.target).closest(\".close\"))\r\n\t\t{\r\n\t\t\t// If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top\r\n\t\t\tif(document.querySelectorAll(\".modal\").length > 1 && this.modal.nextElementSibling !== null)\r\n\t\t\t{\r\n\t\t\t\tlet oldScrollTop = this.modal.scrollTop;\r\n\t\t\t\tthis.webcimesModals.insertAdjacentElement(\"beforeend\", this.modal);\r\n\t\t\t\tthis.modal.scrollTop = oldScrollTop;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tprivate position: {x: number, y: number};\r\n\tprivate offset: {x: number, y: number};\r\n\tprivate isDragging: boolean = false;\r\n\tprivate moveFromElements: HTMLElement[] = [];\r\n\tprivate eventDragStart: (e: Event) => void = (e) => {\r\n\t\t// Start drag only if it's not a button\r\n\t\tif(!(<HTMLElement>e.target).closest(\"button\"))\r\n\t\t{\r\n\t\t\tthis.isDragging = true;\r\n\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\tprivate eventMove: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tthis.modal.style.left = (this.position.x + this.offset.x)+'px';\r\n\t\t\tthis.modal.style.top = (this.position.y + this.offset.y)+'px';\r\n\t\t}\r\n\t};\r\n\tprivate eventDragStop: () => void = () => {\r\n\t\tthis.isDragging = false;\r\n\t};\r\n\tprivate eventPreventSelectText: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t};\r\n\tprivate eventResize: () => void = () => {\r\n\t\tthis.modal.style.removeProperty(\"left\");\r\n\t\tthis.modal.style.removeProperty(\"top\");\r\n\t\t\r\n\t};\r\n\r\n\t/**\r\n\t * Create modal\r\n\t * @param {Object} options\r\n\t * @param {string | null} options.setId - set a specific id on the modal. default \"null\" \r\n\t * @param {string | null} options.setClass - set a specific class on the modal, default \"null\"\r\n\t * @param {string} options.width - width (specify unit), default \"auto\"\r\n\t * @param {string} options.height - height (specify unit), default \"auto\"\r\n\t * @param {string | null} options.titleHtml - html for title, default \"null\"\r\n\t * @param {string | null} options.bodyHtml - html for body, default \"null\"\r\n\t * @param {string | null} options.buttonCancelHtml - html for cancel button, default \"null\"\r\n\t * @param {string | null} options.buttonConfirmHtml - html for confirm button, default \"null\"\r\n\t * @param {boolean} options.closeOnCancelButton - close modal after trigger cancel button, default \"true\"\r\n\t * @param {boolean} options.closeOnConfirmButton - close modal after trigger confirm button, default \"true\"\r\n\t * @param {boolean} options.showCloseButton - show close button, default \"true\"\r\n\t * @param {boolean} options.allowCloseOutside - allow the modal to close when clicked outside, default \"true\"\r\n\t * @param {boolean} options.allowMovement - ability to move modal, default \"true\"\r\n\t * @param {boolean} options.moveFromHeader - if allowMovement is set to \"true\", ability to move modal from header, default \"true\"\r\n\t * @param {boolean} options.moveFromBody - if allowMovement is set to \"true\", ability to move modal from body, default \"false\"\r\n\t * @param {boolean} options.moveFromFooter - if allowMovement is set to \"true\", ability to move modal from footer, default \"true\"\r\n\t * @param {boolean} options.stickyHeader - keep header sticky (visible) when scrolling, default \"true\"\r\n\t * @param {boolean} options.stickyFooter - keep footer sticky (visible) when scrolling, default \"true\"\r\n\t * @param {string | null} options.style - add extra css style to modal, default null\r\n\t * @param {\"animDropDown\" | \"animFadeIn\"} options.animationOnShow - \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\"\r\n\t * @param {\"animDropUp\" | \"animFadeOut\"} options.animationOnDestroy - \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\"\r\n\t * @param {number} options.animationDuration - animation duration in ms, default \"500\"\r\n\t * @param {() => void} options.beforeShow - callback before show modal\r\n\t * @param {() => void} options.afterShow - callback after show modal\r\n\t * @param {() => void} options.beforeDestroy - callback before destroy modal\r\n\t * @param {() => void} options.afterDestroy - callback after destroy modal\r\n\t * @param {() => void} options.onCancelButton - callback after triggering cancel button\r\n\t * @param {() => void} options.onConfirmButton - callback after triggering confirm button\r\n\t */\r\n\tconstructor(options: Options)\r\n\t{\r\n\t\t// Defaults\r\n\t\tconst defaults: Options = {\r\n\t\t\tsetId: null,\r\n\t\t\tsetClass: null,\r\n\t\t\twidth: 'auto',\r\n\t\t\theight: 'auto',\r\n\t\t\ttitleHtml: null,\r\n\t\t\tbodyHtml: null,\r\n\t\t\tbuttonCancelHtml: null,\r\n\t\t\tbuttonConfirmHtml: null,\r\n\t\t\tcloseOnCancelButton: true,\r\n\t\t\tcloseOnConfirmButton: true,\r\n\t\t\tshowCloseButton: true,\r\n\t\t\tallowCloseOutside: true,\r\n\t\t\tallowMovement: true,\r\n\t\t\tmoveFromHeader: true,\r\n\t\t\tmoveFromBody: false,\r\n\t\t\tmoveFromFooter: true,\r\n\t\t\tstickyHeader: true,\r\n\t\t\tstickyFooter: true,\r\n\t\t\tstyle: null,\r\n\t\t\tanimationOnShow: 'animDropDown',\r\n\t\t\tanimationOnDestroy: 'animDropUp',\r\n\t\t\tanimationDuration: 500,\r\n\t\t\tbeforeShow: () => {},\r\n\t\t\tafterShow: () => {},\r\n\t\t\tbeforeDestroy: () => {},\r\n\t\t\tafterDestroy: () => {},\r\n\t\t\tonCancelButton: () => {},\r\n\t\t\tonConfirmButton: () => {},\r\n\t\t}\r\n\t\tthis.options = {...defaults, ...options};\r\n\t\t\r\n\t\t// Call init method\r\n\t\tthis.init();\r\n\t}\r\n\r\n\t/**\r\n\t * Init modal\r\n\t */\r\n init()\r\n\t{\r\n\t\t// Create webcimesModals\r\n\t\tif(!document.querySelector(\".webcimesModals\"))\r\n\t\t{\r\n\t\t\t// Create webcimesModals\r\n\t\t\tdocument.body.insertAdjacentHTML(\"beforeend\", '<div class=\"webcimesModals animFadeIn\"></div>');\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\t\t\t\r\n\t\t\t// Set animation duration for webcimesModals\r\n\t\t\tthis.webcimesModals.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\r\n\t\t\t// Delete enter animation after animation delay\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.webcimesModals.classList.remove(\"animFadeIn\");\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\t\t}\r\n\t\r\n\t\t// Create modal\r\n\t\tthis.webcimesModals.insertAdjacentHTML(\"beforeend\", \r\n\t\t\t`<div class=\"modal `+(this.options.setClass?this.options.setClass:'')+` `+this.options.animationOnShow+`\" `+(this.options.setId?'id=\"'+this.options.setId+'\"':'')+`>\r\n\t\t\t\t`+(this.options.titleHtml||this.options.showCloseButton?\r\n\t\t\t\t\t`<div class=\"modalHeader `+(this.options.stickyHeader?'sticky':'')+` `+(this.options.moveFromHeader?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.titleHtml?'<div class=\"title\">'+this.options.titleHtml+'</div>':'')+`\r\n\t\t\t\t\t\t`+(this.options.showCloseButton?'<button class=\"close\"></button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.bodyHtml?\r\n\t\t\t\t\t`<div class=\"modalBody `+(this.options.moveFromBody?'movable':'')+`\">\r\n\t\t\t\t\t\t`+this.options.bodyHtml+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.buttonCancelHtml||this.options.buttonConfirmHtml?\r\n\t\t\t\t\t`<div class=\"modalFooter `+(this.options.stickyFooter?'sticky':'')+` `+(this.options.moveFromFooter?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.buttonCancelHtml?'<button class=\"cancel '+(this.options.closeOnCancelButton?'close':'')+'\">'+this.options.buttonCancelHtml+'</button>':'')+`\r\n\t\t\t\t\t\t`+(this.options.buttonConfirmHtml?'<button class=\"confirm '+(this.options.closeOnConfirmButton?'close':'')+'\">'+this.options.buttonConfirmHtml+'</button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t</div>`\r\n\t\t);\r\n\t\tthis.modal = <HTMLElement>this.webcimesModals.lastElementChild;\r\n\t\t\r\n\t\t// Callback before show modal\r\n\t\tif(typeof this.options.beforeShow === 'function')\r\n\t\t{\r\n\t\t\t// Set a timeout of zero, to wait for some dom to load\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.options.beforeShow();\r\n\t\t\t}, 0);\r\n\t\t}\r\n\t\t\r\n\t\t// Set animation duration for modal\r\n\t\tthis.modal.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\t\r\n\t\t// Delete animation of enter after the animation delay\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.classList.remove(this.options.animationOnShow);\r\n\t\r\n\t\t\t// Callback after show modal\r\n\t\t\tif(typeof this.options.afterShow === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.afterShow();\r\n\t\t\t}\r\n\t\t}, this.options.animationDuration);\r\n\t\r\n\t\t// Width of modal\r\n\t\tthis.modal.style.setProperty(\"max-width\", \"90%\");\r\n\t\tif(this.options.width != \"auto\" && this.options.width)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"width\", this.options.width);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-width\r\n\t\t\tthis.modal.style.setProperty(\"width\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Height of modal\r\n\t\tthis.modal.style.setProperty(\"max-height\", \"90%\");\r\n\t\tif(this.options.height != \"auto\" && this.options.height)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"height\", this.options.height);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-height\r\n\t\t\tthis.modal.style.setProperty(\"height\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Style\r\n\t\tif(this.options.style)\r\n\t\t{\r\n\t\t\tlet oldStyle = this.modal.getAttribute(\"style\");\r\n\t\t\tthis.modal.setAttribute(\"style\", oldStyle+this.options.style);\r\n\t\t}\r\n\t\r\n\t\t// Event on cancel button\r\n\t\tif(this.options.buttonCancelHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".cancel\")?.addEventListener(\"click\", this.eventCancelButton);\r\n\t\t}\r\n\t\r\n\t\t// Event on confirm button\r\n\t\tif(this.options.buttonConfirmHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".confirm\")?.addEventListener(\"click\", this.eventConfirmButton);\r\n\t\t}\r\n\t\t\r\n\t\t// Event click outside (on webcimesModals)\r\n\t\tthis.webcimesModals.addEventListener(\"click\", this.eventClickOutside);\r\n\t\r\n\t\t// Event close modal when click on close button\r\n\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\tel.addEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t});\r\n\t\r\n\t\t// Place selected modal on top\r\n\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\tthis.modal.addEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t});\r\n\t\t\r\n\t\t// Move modal\r\n\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t{\r\n\t\t\tif(this.options.moveFromHeader && this.modal.querySelector(\".modalHeader\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalHeader\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromBody && this.modal.querySelector(\".modalBody\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalBody\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromFooter && this.modal.querySelector(\".modalFooter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalFooter\"));\r\n\t\t\t}\r\n\t\r\n\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\tel.addEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventMove);\r\n\t\t\t});\r\n\r\n\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t});\r\n\r\n\t\t\tdocument.addEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t}\r\n\r\n\t\t// When resizing window, reset modal position to center\r\n\t\twindow.addEventListener(\"resize\", this.eventResize);\r\n }\r\n\r\n\t/**\r\n\t * Destroy modal\r\n\t */\r\n\tdestroy()\r\n\t{\r\n\t\t// If modal is not already destroying\r\n\t\tif(!this.modal.getAttribute(\"data-destroying\"))\r\n\t\t{\r\n\t\t\t// Callback before destroy modal\r\n\t\t\tif(typeof this.options.beforeDestroy === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.beforeDestroy();\r\n\t\t\t}\r\n\r\n\t\t\t// Close webcimesModals (according the number of modal not already destroying)\r\n\t\t\tif(document.querySelectorAll(\".modal:not([data-destroying])\").length == 1)\r\n\t\t\t{\r\n\t\t\t\tthis.webcimesModals.classList.add(\"animFadeOut\");\r\n\t\t\t}\r\n\r\n\t\t\t// Close modal\r\n\t\t\tthis.modal.setAttribute(\"data-destroying\", \"1\");\r\n\t\t\tthis.modal.classList.add(this.options.animationOnDestroy);\r\n\r\n\t\t\t// Destroy all events from modal and remove webcimesModals or modal after animation duration\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif(typeof this.modal !== 'undefined')\r\n\t\t\t\t{\r\n\t\t\t\t\t// Destroy all events from modal\r\n\r\n\t\t\t\t\tif(this.options.buttonCancelHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".cancel\")?.removeEventListener(\"click\", this.eventCancelButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(this.options.buttonConfirmHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".confirm\")?.removeEventListener(\"click\", this.eventConfirmButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.webcimesModals.removeEventListener(\"click\", this.eventClickOutside);\r\n\r\n\t\t\t\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\t\t\t\tel.removeEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\tthis.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\t\t\t\tel.removeEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventMove);\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tdocument.removeEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\twindow.removeEventListener(\"resize\", this.eventResize);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Remove webcimesModals or modal according the number of modal\r\n\t\t\t\t\t(document.querySelectorAll(\".modal\").length>1?this.modal:this.webcimesModals).remove();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Callback after destroy modal\r\n\t\t\t\tif(typeof this.options.afterDestroy === 'function')\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.options.afterDestroy();\r\n\t\t\t\t}\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t}\r\n}"],"names":[],"sourceRoot":""}