jb-modal 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/JBModal.js +160 -0
- package/dist/JBModal.js.map +1 -0
- package/dist/JBModal.umd.js +167 -0
- package/dist/JBModal.umd.js.map +1 -0
- package/index.js +1 -0
- package/lib/JBModal.html +8 -0
- package/lib/JBModal.js +157 -0
- package/lib/JBModal.scss +44 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 javad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/JBModal.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
var HTML = "<div class=\"jb-modal-web-component --closed\">\r\n <div class=\"modal-background\"></div>\r\n <div class=\"modal-content-wrapper\">\r\n <div class=\"modal-content\">\r\n <slot name=\"content\"></slot>\r\n </div>\r\n </div>\r\n</div>";
|
|
2
|
+
|
|
3
|
+
var css_248z = ".jb-modal-web-component {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n width: 100%;\n height: 100%; }\n .jb-modal-web-component.--closed {\n display: none; }\n .jb-modal-web-component.--opened {\n display: block; }\n .jb-modal-web-component .modal-background {\n position: absolute;\n top: 0;\n left: 0;\n background-color: rgba(255, 255, 255, 0.1);\n backdrop-filter: blur(10px);\n z-index: 2;\n width: 100%;\n height: 100%; }\n .jb-modal-web-component .modal-content-wrapper {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none; }\n .jb-modal-web-component .modal-content-wrapper .modal-content {\n pointer-events: all;\n width: auto;\n height: auto;\n background-color: #fff;\n border-radius: 24px; }\n\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkpCTW9kYWwuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtFQUNFLGVBQWU7RUFDZixNQUFNO0VBQ04sT0FBTztFQUNQLFVBQVU7RUFDVixXQUFXO0VBQ1gsWUFBWSxFQUFFO0VBQ2Q7SUFDRSxhQUFhLEVBQUU7RUFDakI7SUFDRSxjQUFjLEVBQUU7RUFDbEI7SUFDRSxrQkFBa0I7SUFDbEIsTUFBTTtJQUNOLE9BQU87SUFDUCwwQ0FBMEM7SUFDMUMsMkJBQTJCO0lBQzNCLFVBQVU7SUFDVixXQUFXO0lBQ1gsWUFBWSxFQUFFO0VBQ2hCO0lBQ0Usa0JBQWtCO0lBQ2xCLE1BQU07SUF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oOiAxMDAlO1xuICAgIGhlaWdodDogMTAwJTtcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgcG9pbnRlci1ldmVudHM6IG5vbmU7IH1cbiAgICAuamItbW9kYWwtd2ViLWNvbXBvbmVudCAubW9kYWwtY29udGVudC13cmFwcGVyIC5tb2RhbC1jb250ZW50IHtcbiAgICAgIHBvaW50ZXItZXZlbnRzOiBhbGw7XG4gICAgICB3aWR0aDogYXV0bztcbiAgICAgIGhlaWdodDogYXV0bztcbiAgICAgIGJhY2tncm91bmQtY29sb3I6ICNmZmY7XG4gICAgICBib3JkZXItcmFkaXVzOiAyNHB4OyB9XG4iXX0= */";
|
|
4
|
+
|
|
5
|
+
class JBModalWebComponent extends HTMLElement {
|
|
6
|
+
#isOpen = false;
|
|
7
|
+
#id = null;
|
|
8
|
+
get id() {
|
|
9
|
+
return this.#id || this.getAttribute('id');
|
|
10
|
+
}
|
|
11
|
+
set id(value) {
|
|
12
|
+
this.#id = value;
|
|
13
|
+
this.checkInitialOpenness();
|
|
14
|
+
}
|
|
15
|
+
get isOpen() {
|
|
16
|
+
return this.#isOpen;
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.initWebComponent();
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
// standard web component event that called when all of dom is binded
|
|
24
|
+
this.callOnLoadEvent();
|
|
25
|
+
this.initProp();
|
|
26
|
+
this.callOnInitEvent();
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
callOnLoadEvent() {
|
|
30
|
+
var event = new CustomEvent('load', { bubbles: true, composed: true });
|
|
31
|
+
this.dispatchEvent(event);
|
|
32
|
+
}
|
|
33
|
+
callOnInitEvent() {
|
|
34
|
+
var event = new CustomEvent('init', { bubbles: true, composed: true });
|
|
35
|
+
this.dispatchEvent(event);
|
|
36
|
+
}
|
|
37
|
+
initWebComponent() {
|
|
38
|
+
const shadowRoot = this.attachShadow({
|
|
39
|
+
mode: 'open'
|
|
40
|
+
});
|
|
41
|
+
const html = `<style>${css_248z}</style>` + '\n' + HTML;
|
|
42
|
+
const element = document.createElement('template');
|
|
43
|
+
element.innerHTML = html;
|
|
44
|
+
shadowRoot.appendChild(element.content.cloneNode(true));
|
|
45
|
+
this.elements = {
|
|
46
|
+
componentWrapper: shadowRoot.querySelector('.jb-modal-web-component'),
|
|
47
|
+
background: shadowRoot.querySelector('.modal-background')
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
registerEventListener() {
|
|
52
|
+
this.elements.background.addEventListener('click', this.onBackgroundClick.bind(this));
|
|
53
|
+
//TODO: remove listener on component unmount
|
|
54
|
+
window.addEventListener('popstate', this.onBrowserBack.bind(this));
|
|
55
|
+
}
|
|
56
|
+
initProp() {
|
|
57
|
+
this.config = {
|
|
58
|
+
autoCloseOnBackgroundClick: false
|
|
59
|
+
};
|
|
60
|
+
this.registerEventListener();
|
|
61
|
+
}
|
|
62
|
+
checkInitialOpenness() {
|
|
63
|
+
//if page has modal url we open it automatically
|
|
64
|
+
const location = window.location;
|
|
65
|
+
if (location.hash == `#${this.id}`) {
|
|
66
|
+
this.triggerUrlOpenEvent();
|
|
67
|
+
this.open();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
triggerUrlOpenEvent() {
|
|
71
|
+
//when modal open itself becuase url contain modal id
|
|
72
|
+
const event = new CustomEvent('urlOpen', { bubbles: true, composed: true });
|
|
73
|
+
this.dispatchEvent(event);
|
|
74
|
+
}
|
|
75
|
+
static get observedAttributes() {
|
|
76
|
+
return ['isOpen', 'id'];
|
|
77
|
+
}
|
|
78
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
79
|
+
// do something when an attribute has changed
|
|
80
|
+
this.onAttributeChange(name, newValue);
|
|
81
|
+
}
|
|
82
|
+
onAttributeChange(name, value) {
|
|
83
|
+
switch (name) {
|
|
84
|
+
case 'isOpen':
|
|
85
|
+
if (value == 'true') {
|
|
86
|
+
if (!this.#isOpen) {
|
|
87
|
+
this.open();
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
if (this.#isOpen) {
|
|
91
|
+
this.close();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
case 'id':
|
|
96
|
+
this.id = value;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
onBackgroundClick() {
|
|
102
|
+
this.dispatchCloseEvent('BACKGROUND_CLICK');
|
|
103
|
+
if (this.config.autoCloseOnBackgroundClick) {
|
|
104
|
+
this.close();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
dispatchCloseEvent(type) {
|
|
109
|
+
//we have many ways to dispatch close event like back button on close clicked
|
|
110
|
+
const event = new CustomEvent("close", { detail: { eventType: type } });
|
|
111
|
+
this.dispatchEvent(event);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @public
|
|
115
|
+
* will close modal
|
|
116
|
+
*/
|
|
117
|
+
close() {
|
|
118
|
+
this.#isOpen = false;
|
|
119
|
+
this.elements.componentWrapper.classList.remove('--opened');
|
|
120
|
+
this.elements.componentWrapper.classList.add('--closed');
|
|
121
|
+
const history = window.history;
|
|
122
|
+
const location = window.location;
|
|
123
|
+
if (location.hash == `#${this.id}`) {
|
|
124
|
+
history.go(-1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @public
|
|
129
|
+
* will open modal
|
|
130
|
+
*/
|
|
131
|
+
open() {
|
|
132
|
+
this.#isOpen = true;
|
|
133
|
+
this.elements.componentWrapper.classList.remove('--closed');
|
|
134
|
+
this.elements.componentWrapper.classList.add('--opened');
|
|
135
|
+
if (this.id) {
|
|
136
|
+
const history = window.history;
|
|
137
|
+
const location = window.location;
|
|
138
|
+
if (!(location.hash == `#${this.id}`)) {
|
|
139
|
+
history.pushState({ JBModal: {} }, "", `#${this.id}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @private
|
|
145
|
+
* when brower back button clicked physically or byy code
|
|
146
|
+
*/
|
|
147
|
+
onBrowserBack(e) {
|
|
148
|
+
if (this.isOpen) {
|
|
149
|
+
this.dispatchCloseEvent('HISTORY_BACK_EVENT');
|
|
150
|
+
if (this.config.autoCloseOnBackgroundClick) {
|
|
151
|
+
this.close();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const myElementNotExists = !customElements.get('jb-modal');
|
|
157
|
+
if (myElementNotExists) {
|
|
158
|
+
window.customElements.define('jb-modal', JBModalWebComponent);
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=JBModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JBModal.js","sources":["../lib/JBModal.js"],"sourcesContent":["import HTML from './JBModal.html';\r\nimport CSS from './JBModal.scss';\r\nclass JBModalWebComponent extends HTMLElement {\r\n #isOpen = false;\r\n #id = null;\r\n get id() {\r\n return this.#id || this.getAttribute('id');\r\n }\r\n set id(value) {\r\n this.#id = value;\r\n this.checkInitialOpenness();\r\n }\r\n get isOpen() {\r\n return this.#isOpen;\r\n }\r\n constructor() {\r\n super();\r\n this.initWebComponent();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is binded\r\n this.callOnLoadEvent();\r\n this.initProp();\r\n this.callOnInitEvent();\r\n\r\n }\r\n callOnLoadEvent() {\r\n var event = new CustomEvent('load', { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n callOnInitEvent() {\r\n var event = new CustomEvent('init', { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: 'open'\r\n });\r\n const html = `<style>${CSS}</style>` + '\\n' + HTML;\r\n const element = document.createElement('template');\r\n element.innerHTML = html;\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n this.elements = {\r\n componentWrapper: shadowRoot.querySelector('.jb-modal-web-component'),\r\n background: shadowRoot.querySelector('.modal-background')\r\n }\r\n\r\n }\r\n registerEventListener() {\r\n this.elements.background.addEventListener('click', this.onBackgroundClick.bind(this));\r\n //TODO: remove listener on component unmount\r\n window.addEventListener('popstate', this.onBrowserBack.bind(this))\r\n }\r\n initProp() {\r\n this.config = {\r\n autoCloseOnBackgroundClick: false\r\n }\r\n this.registerEventListener();\r\n }\r\n checkInitialOpenness() {\r\n //if page has modal url we open it automatically\r\n const location = window.location;\r\n if (location.hash == `#${this.id}`) {\r\n this.triggerUrlOpenEvent();\r\n this.open();\r\n }\r\n }\r\n triggerUrlOpenEvent() {\r\n //when modal open itself becuase url contain modal id\r\n const event = new CustomEvent('urlOpen', { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n static get observedAttributes() {\r\n return ['isOpen', 'id'];\r\n }\r\n attributeChangedCallback(name, oldValue, newValue) {\r\n // do something when an attribute has changed\r\n this.onAttributeChange(name, newValue);\r\n }\r\n onAttributeChange(name, value) {\r\n switch (name) {\r\n case 'isOpen':\r\n if (value == 'true') {\r\n if (!this.#isOpen) {\r\n this.open()\r\n }\r\n } else {\r\n if (this.#isOpen) {\r\n this.close()\r\n }\r\n }\r\n break;\r\n case 'id':\r\n this.id = value;\r\n break;\r\n }\r\n\r\n }\r\n onBackgroundClick() {\r\n this.dispatchCloseEvent('BACKGROUND_CLICK');\r\n if (this.config.autoCloseOnBackgroundClick) {\r\n this.close();\r\n }\r\n\r\n }\r\n dispatchCloseEvent(type) {\r\n //we have many ways to dispatch close event like back button on close clicked\r\n const event = new CustomEvent(\"close\", { detail: { eventType: type } });\r\n this.dispatchEvent(event);\r\n }\r\n /**\r\n * @public\r\n * will close modal\r\n */\r\n close() {\r\n this.#isOpen = false;\r\n this.elements.componentWrapper.classList.remove('--opened')\r\n this.elements.componentWrapper.classList.add('--closed');\r\n const history = window.history;\r\n const location = window.location;\r\n if (location.hash == `#${this.id}`) {\r\n history.go(-1)\r\n }\r\n }\r\n /**\r\n * @public\r\n * will open modal\r\n */\r\n open() {\r\n this.#isOpen = true;\r\n this.elements.componentWrapper.classList.remove('--closed');\r\n this.elements.componentWrapper.classList.add('--opened');\r\n if (this.id) {\r\n const history = window.history;\r\n const location = window.location;\r\n if (!(location.hash == `#${this.id}`)) {\r\n history.pushState({ JBModal: {} }, \"\", `#${this.id}`)\r\n }\r\n }\r\n }\r\n /**\r\n * @private\r\n * when brower back button clicked physically or byy code\r\n */\r\n onBrowserBack(e) {\r\n if (this.isOpen) {\r\n this.dispatchCloseEvent('HISTORY_BACK_EVENT');\r\n if (this.config.autoCloseOnBackgroundClick) {\r\n this.close();\r\n }\r\n }\r\n }\r\n}\r\nconst myElementNotExists = !customElements.get('jb-modal');\r\nif (myElementNotExists) {\r\n window.customElements.define('jb-modal', JBModalWebComponent);\r\n}\r\n"],"names":["CSS"],"mappings":";;;;AAEA,MAAM,mBAAmB,SAAS,WAAW,CAAC;AAC9C,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,IAAI,GAAG,GAAG,IAAI,CAAC;AACf,IAAI,IAAI,EAAE,GAAG;AACb,QAAQ,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,IAAI,EAAE,CAAC,KAAK,EAAE;AAClB,QAAQ,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC;AACzB,QAAQ,IAAI,CAAC,oBAAoB,EAAE,CAAC;AACpC,KAAK;AACL,IAAI,IAAI,MAAM,GAAG;AACjB,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC;AAC5B,KAAK;AACL,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE,CAAC;AAChB,QAAQ,IA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IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;AAC1D,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE;AACxD,gBAAgB,IAAI,CAAC,KAAK,EAAE,CAAC;AAC7B,aAAa;AACb,SAAS;AACT,KAAK;AACL,CAAC;AACD,MAAM,kBAAkB,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC3D,IAAI,kBAAkB,EAAE;AACxB,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;AAClE"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
3
|
+
factory();
|
|
4
|
+
})((function () { 'use strict';
|
|
5
|
+
|
|
6
|
+
var HTML = "<div class=\"jb-modal-web-component --closed\">\r\n <div class=\"modal-background\"></div>\r\n <div class=\"modal-content-wrapper\">\r\n <div class=\"modal-content\">\r\n <slot name=\"content\"></slot>\r\n </div>\r\n </div>\r\n</div>";
|
|
7
|
+
|
|
8
|
+
var css_248z = ".jb-modal-web-component {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 1;\n width: 100%;\n height: 100%; }\n .jb-modal-web-component.--closed {\n display: none; }\n .jb-modal-web-component.--opened {\n display: block; }\n .jb-modal-web-component .modal-background {\n position: absolute;\n top: 0;\n left: 0;\n background-color: rgba(255, 255, 255, 0.1);\n backdrop-filter: blur(10px);\n z-index: 2;\n width: 100%;\n height: 100%; }\n .jb-modal-web-component .modal-content-wrapper {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none; }\n .jb-modal-web-component .modal-content-wrapper .modal-content {\n pointer-events: all;\n width: auto;\n height: auto;\n background-color: #fff;\n border-radius: 24px; }\n\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJ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2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDA7XG4gICAgbGVmdDogMDtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDI1NSwgMjU1LCAyNTUsIDAuMSk7XG4gICAgYmFja2Ryb3AtZmlsdGVyOiBibHVyKDEwcHgpO1xuICAgIHotaW5kZXg6IDI7XG4gICAgd2lkdGg6IDEwMCU7XG4gICAgaGVpZ2h0OiAxMDAlOyB9XG4gIC5qYi1tb2RhbC13ZWItY29tcG9uZW50IC5tb2RhbC1jb250ZW50LXdyYXBwZXIge1xuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDA7XG4gICAgbGVmdDogMDtcbiAgICB6LWluZGV4OiAyO1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIGhlaWdodDogMTAwJTtcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgcG9pbnRlci1ldmVudHM6IG5vbmU7IH1cbiAgICAuamItbW9kYWwtd2ViLWNvbXBvbmVudCAubW9kYWwtY29udGVudC13cmFwcGVyIC5tb2RhbC1jb250ZW50IHtcbiAgICAgIHBvaW50ZXItZXZlbnRzOiBhbGw7XG4gICAgICB3aWR0aDogYXV0bztcbiAgICAgIGhlaWdodDogYXV0bztcbiAgICAgIGJhY2tncm91bmQtY29sb3I6ICNmZmY7XG4gICAgICBib3JkZXItcmFkaXVzOiAyNHB4OyB9XG4iXX0= */";
|
|
9
|
+
|
|
10
|
+
class JBModalWebComponent extends HTMLElement {
|
|
11
|
+
#isOpen = false;
|
|
12
|
+
#id = null;
|
|
13
|
+
get id() {
|
|
14
|
+
return this.#id || this.getAttribute('id');
|
|
15
|
+
}
|
|
16
|
+
set id(value) {
|
|
17
|
+
this.#id = value;
|
|
18
|
+
this.checkInitialOpenness();
|
|
19
|
+
}
|
|
20
|
+
get isOpen() {
|
|
21
|
+
return this.#isOpen;
|
|
22
|
+
}
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.initWebComponent();
|
|
26
|
+
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
// standard web component event that called when all of dom is binded
|
|
29
|
+
this.callOnLoadEvent();
|
|
30
|
+
this.initProp();
|
|
31
|
+
this.callOnInitEvent();
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
callOnLoadEvent() {
|
|
35
|
+
var event = new CustomEvent('load', { bubbles: true, composed: true });
|
|
36
|
+
this.dispatchEvent(event);
|
|
37
|
+
}
|
|
38
|
+
callOnInitEvent() {
|
|
39
|
+
var event = new CustomEvent('init', { bubbles: true, composed: true });
|
|
40
|
+
this.dispatchEvent(event);
|
|
41
|
+
}
|
|
42
|
+
initWebComponent() {
|
|
43
|
+
const shadowRoot = this.attachShadow({
|
|
44
|
+
mode: 'open'
|
|
45
|
+
});
|
|
46
|
+
const html = `<style>${css_248z}</style>` + '\n' + HTML;
|
|
47
|
+
const element = document.createElement('template');
|
|
48
|
+
element.innerHTML = html;
|
|
49
|
+
shadowRoot.appendChild(element.content.cloneNode(true));
|
|
50
|
+
this.elements = {
|
|
51
|
+
componentWrapper: shadowRoot.querySelector('.jb-modal-web-component'),
|
|
52
|
+
background: shadowRoot.querySelector('.modal-background')
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
registerEventListener() {
|
|
57
|
+
this.elements.background.addEventListener('click', this.onBackgroundClick.bind(this));
|
|
58
|
+
//TODO: remove listener on component unmount
|
|
59
|
+
window.addEventListener('popstate', this.onBrowserBack.bind(this));
|
|
60
|
+
}
|
|
61
|
+
initProp() {
|
|
62
|
+
this.config = {
|
|
63
|
+
autoCloseOnBackgroundClick: false
|
|
64
|
+
};
|
|
65
|
+
this.registerEventListener();
|
|
66
|
+
}
|
|
67
|
+
checkInitialOpenness() {
|
|
68
|
+
//if page has modal url we open it automatically
|
|
69
|
+
const location = window.location;
|
|
70
|
+
if (location.hash == `#${this.id}`) {
|
|
71
|
+
this.triggerUrlOpenEvent();
|
|
72
|
+
this.open();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
triggerUrlOpenEvent() {
|
|
76
|
+
//when modal open itself becuase url contain modal id
|
|
77
|
+
const event = new CustomEvent('urlOpen', { bubbles: true, composed: true });
|
|
78
|
+
this.dispatchEvent(event);
|
|
79
|
+
}
|
|
80
|
+
static get observedAttributes() {
|
|
81
|
+
return ['isOpen', 'id'];
|
|
82
|
+
}
|
|
83
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
84
|
+
// do something when an attribute has changed
|
|
85
|
+
this.onAttributeChange(name, newValue);
|
|
86
|
+
}
|
|
87
|
+
onAttributeChange(name, value) {
|
|
88
|
+
switch (name) {
|
|
89
|
+
case 'isOpen':
|
|
90
|
+
if (value == 'true') {
|
|
91
|
+
if (!this.#isOpen) {
|
|
92
|
+
this.open();
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
if (this.#isOpen) {
|
|
96
|
+
this.close();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case 'id':
|
|
101
|
+
this.id = value;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
onBackgroundClick() {
|
|
107
|
+
this.dispatchCloseEvent('BACKGROUND_CLICK');
|
|
108
|
+
if (this.config.autoCloseOnBackgroundClick) {
|
|
109
|
+
this.close();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
dispatchCloseEvent(type) {
|
|
114
|
+
//we have many ways to dispatch close event like back button on close clicked
|
|
115
|
+
const event = new CustomEvent("close", { detail: { eventType: type } });
|
|
116
|
+
this.dispatchEvent(event);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @public
|
|
120
|
+
* will close modal
|
|
121
|
+
*/
|
|
122
|
+
close() {
|
|
123
|
+
this.#isOpen = false;
|
|
124
|
+
this.elements.componentWrapper.classList.remove('--opened');
|
|
125
|
+
this.elements.componentWrapper.classList.add('--closed');
|
|
126
|
+
const history = window.history;
|
|
127
|
+
const location = window.location;
|
|
128
|
+
if (location.hash == `#${this.id}`) {
|
|
129
|
+
history.go(-1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @public
|
|
134
|
+
* will open modal
|
|
135
|
+
*/
|
|
136
|
+
open() {
|
|
137
|
+
this.#isOpen = true;
|
|
138
|
+
this.elements.componentWrapper.classList.remove('--closed');
|
|
139
|
+
this.elements.componentWrapper.classList.add('--opened');
|
|
140
|
+
if (this.id) {
|
|
141
|
+
const history = window.history;
|
|
142
|
+
const location = window.location;
|
|
143
|
+
if (!(location.hash == `#${this.id}`)) {
|
|
144
|
+
history.pushState({ JBModal: {} }, "", `#${this.id}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @private
|
|
150
|
+
* when brower back button clicked physically or byy code
|
|
151
|
+
*/
|
|
152
|
+
onBrowserBack(e) {
|
|
153
|
+
if (this.isOpen) {
|
|
154
|
+
this.dispatchCloseEvent('HISTORY_BACK_EVENT');
|
|
155
|
+
if (this.config.autoCloseOnBackgroundClick) {
|
|
156
|
+
this.close();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const myElementNotExists = !customElements.get('jb-modal');
|
|
162
|
+
if (myElementNotExists) {
|
|
163
|
+
window.customElements.define('jb-modal', JBModalWebComponent);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
}));
|
|
167
|
+
//# sourceMappingURL=JBModal.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JBModal.umd.js","sources":["../lib/JBModal.js"],"sourcesContent":["import HTML from './JBModal.html';\r\nimport CSS from './JBModal.scss';\r\nclass JBModalWebComponent extends HTMLElement {\r\n #isOpen = false;\r\n #id = null;\r\n get id() {\r\n return this.#id || this.getAttribute('id');\r\n }\r\n set id(value) {\r\n this.#id = value;\r\n this.checkInitialOpenness();\r\n }\r\n get isOpen() {\r\n return this.#isOpen;\r\n }\r\n constructor() {\r\n super();\r\n this.initWebComponent();\r\n }\r\n connectedCallback() {\r\n // standard web component event that called when all of dom is binded\r\n this.callOnLoadEvent();\r\n this.initProp();\r\n this.callOnInitEvent();\r\n\r\n }\r\n callOnLoadEvent() {\r\n var event = new CustomEvent('load', { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n callOnInitEvent() {\r\n var event = new CustomEvent('init', { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n initWebComponent() {\r\n const shadowRoot = this.attachShadow({\r\n mode: 'open'\r\n });\r\n const html = `<style>${CSS}</style>` + '\\n' + HTML;\r\n const element = document.createElement('template');\r\n element.innerHTML = html;\r\n shadowRoot.appendChild(element.content.cloneNode(true));\r\n this.elements = {\r\n componentWrapper: shadowRoot.querySelector('.jb-modal-web-component'),\r\n background: shadowRoot.querySelector('.modal-background')\r\n }\r\n\r\n }\r\n registerEventListener() {\r\n this.elements.background.addEventListener('click', this.onBackgroundClick.bind(this));\r\n //TODO: remove listener on component unmount\r\n window.addEventListener('popstate', this.onBrowserBack.bind(this))\r\n }\r\n initProp() {\r\n this.config = {\r\n autoCloseOnBackgroundClick: false\r\n }\r\n this.registerEventListener();\r\n }\r\n checkInitialOpenness() {\r\n //if page has modal url we open it automatically\r\n const location = window.location;\r\n if (location.hash == `#${this.id}`) {\r\n this.triggerUrlOpenEvent();\r\n this.open();\r\n }\r\n }\r\n triggerUrlOpenEvent() {\r\n //when modal open itself becuase url contain modal id\r\n const event = new CustomEvent('urlOpen', { bubbles: true, composed: true });\r\n this.dispatchEvent(event);\r\n }\r\n static get observedAttributes() {\r\n return ['isOpen', 'id'];\r\n }\r\n attributeChangedCallback(name, oldValue, newValue) {\r\n // do something when an attribute has changed\r\n this.onAttributeChange(name, newValue);\r\n }\r\n onAttributeChange(name, value) {\r\n switch (name) {\r\n case 'isOpen':\r\n if (value == 'true') {\r\n if (!this.#isOpen) {\r\n this.open()\r\n }\r\n } else {\r\n if (this.#isOpen) {\r\n this.close()\r\n }\r\n }\r\n break;\r\n case 'id':\r\n this.id = value;\r\n break;\r\n }\r\n\r\n }\r\n onBackgroundClick() {\r\n this.dispatchCloseEvent('BACKGROUND_CLICK');\r\n if (this.config.autoCloseOnBackgroundClick) {\r\n this.close();\r\n }\r\n\r\n }\r\n dispatchCloseEvent(type) {\r\n //we have many ways to dispatch close event like back button on close clicked\r\n const event = new CustomEvent(\"close\", { detail: { eventType: type } });\r\n this.dispatchEvent(event);\r\n }\r\n /**\r\n * @public\r\n * will close modal\r\n */\r\n close() {\r\n this.#isOpen = false;\r\n this.elements.componentWrapper.classList.remove('--opened')\r\n this.elements.componentWrapper.classList.add('--closed');\r\n const history = window.history;\r\n const location = window.location;\r\n if (location.hash == `#${this.id}`) {\r\n history.go(-1)\r\n }\r\n }\r\n /**\r\n * @public\r\n * will open modal\r\n */\r\n open() {\r\n this.#isOpen = true;\r\n this.elements.componentWrapper.classList.remove('--closed');\r\n this.elements.componentWrapper.classList.add('--opened');\r\n if (this.id) {\r\n const history = window.history;\r\n const location = window.location;\r\n if (!(location.hash == `#${this.id}`)) {\r\n history.pushState({ JBModal: {} }, \"\", `#${this.id}`)\r\n }\r\n }\r\n }\r\n /**\r\n * @private\r\n * when brower back button clicked physically or byy code\r\n */\r\n onBrowserBack(e) {\r\n if (this.isOpen) {\r\n this.dispatchCloseEvent('HISTORY_BACK_EVENT');\r\n if (this.config.autoCloseOnBackgroundClick) {\r\n this.close();\r\n }\r\n }\r\n }\r\n}\r\nconst myElementNotExists = !customElements.get('jb-modal');\r\nif (myElementNotExists) {\r\n window.customElements.define('jb-modal', JBModalWebComponent);\r\n}\r\n"],"names":["CSS"],"mappings":";;;;;;;;;IAEA,MAAM,mBAAmB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C,EAAE,EAAE;IACrB,YAAY,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC3C,YAAY,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC7C,YAAY,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;IACnD,gBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAAC;IACrE,aAAa;IACb,SAAS;IACT,KAAK;IACL;IACA;IACA;IACA;IACA,IAAI,aAAa,CAAC,CAAC,EAAE;IACrB,QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE;IACzB,YAAY,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IAC1D,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE;IACxD,gBAAgB,IAAI,CAAC,KAAK,EAAE,CAAC;IAC7B,aAAa;IACb,SAAS;IACT,KAAK;IACL,CAAC;IACD,MAAM,kBAAkB,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3D,IAAI,kBAAkB,EAAE;IACxB,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAClE;;;;;;"}
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './dist/JBModal.js';
|
package/lib/JBModal.html
ADDED
package/lib/JBModal.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import HTML from './JBModal.html';
|
|
2
|
+
import CSS from './JBModal.scss';
|
|
3
|
+
class JBModalWebComponent extends HTMLElement {
|
|
4
|
+
#isOpen = false;
|
|
5
|
+
#id = null;
|
|
6
|
+
get id() {
|
|
7
|
+
return this.#id || this.getAttribute('id');
|
|
8
|
+
}
|
|
9
|
+
set id(value) {
|
|
10
|
+
this.#id = value;
|
|
11
|
+
this.checkInitialOpenness();
|
|
12
|
+
}
|
|
13
|
+
get isOpen() {
|
|
14
|
+
return this.#isOpen;
|
|
15
|
+
}
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this.initWebComponent();
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
// standard web component event that called when all of dom is binded
|
|
22
|
+
this.callOnLoadEvent();
|
|
23
|
+
this.initProp();
|
|
24
|
+
this.callOnInitEvent();
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
callOnLoadEvent() {
|
|
28
|
+
var event = new CustomEvent('load', { bubbles: true, composed: true });
|
|
29
|
+
this.dispatchEvent(event);
|
|
30
|
+
}
|
|
31
|
+
callOnInitEvent() {
|
|
32
|
+
var event = new CustomEvent('init', { bubbles: true, composed: true });
|
|
33
|
+
this.dispatchEvent(event);
|
|
34
|
+
}
|
|
35
|
+
initWebComponent() {
|
|
36
|
+
const shadowRoot = this.attachShadow({
|
|
37
|
+
mode: 'open'
|
|
38
|
+
});
|
|
39
|
+
const html = `<style>${CSS}</style>` + '\n' + HTML;
|
|
40
|
+
const element = document.createElement('template');
|
|
41
|
+
element.innerHTML = html;
|
|
42
|
+
shadowRoot.appendChild(element.content.cloneNode(true));
|
|
43
|
+
this.elements = {
|
|
44
|
+
componentWrapper: shadowRoot.querySelector('.jb-modal-web-component'),
|
|
45
|
+
background: shadowRoot.querySelector('.modal-background')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
registerEventListener() {
|
|
50
|
+
this.elements.background.addEventListener('click', this.onBackgroundClick.bind(this));
|
|
51
|
+
//TODO: remove listener on component unmount
|
|
52
|
+
window.addEventListener('popstate', this.onBrowserBack.bind(this))
|
|
53
|
+
}
|
|
54
|
+
initProp() {
|
|
55
|
+
this.config = {
|
|
56
|
+
autoCloseOnBackgroundClick: false
|
|
57
|
+
}
|
|
58
|
+
this.registerEventListener();
|
|
59
|
+
}
|
|
60
|
+
checkInitialOpenness() {
|
|
61
|
+
//if page has modal url we open it automatically
|
|
62
|
+
const location = window.location;
|
|
63
|
+
if (location.hash == `#${this.id}`) {
|
|
64
|
+
this.triggerUrlOpenEvent();
|
|
65
|
+
this.open();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
triggerUrlOpenEvent() {
|
|
69
|
+
//when modal open itself becuase url contain modal id
|
|
70
|
+
const event = new CustomEvent('urlOpen', { bubbles: true, composed: true });
|
|
71
|
+
this.dispatchEvent(event);
|
|
72
|
+
}
|
|
73
|
+
static get observedAttributes() {
|
|
74
|
+
return ['isOpen', 'id'];
|
|
75
|
+
}
|
|
76
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
77
|
+
// do something when an attribute has changed
|
|
78
|
+
this.onAttributeChange(name, newValue);
|
|
79
|
+
}
|
|
80
|
+
onAttributeChange(name, value) {
|
|
81
|
+
switch (name) {
|
|
82
|
+
case 'isOpen':
|
|
83
|
+
if (value == 'true') {
|
|
84
|
+
if (!this.#isOpen) {
|
|
85
|
+
this.open()
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
if (this.#isOpen) {
|
|
89
|
+
this.close()
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case 'id':
|
|
94
|
+
this.id = value;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
onBackgroundClick() {
|
|
100
|
+
this.dispatchCloseEvent('BACKGROUND_CLICK');
|
|
101
|
+
if (this.config.autoCloseOnBackgroundClick) {
|
|
102
|
+
this.close();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
dispatchCloseEvent(type) {
|
|
107
|
+
//we have many ways to dispatch close event like back button on close clicked
|
|
108
|
+
const event = new CustomEvent("close", { detail: { eventType: type } });
|
|
109
|
+
this.dispatchEvent(event);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @public
|
|
113
|
+
* will close modal
|
|
114
|
+
*/
|
|
115
|
+
close() {
|
|
116
|
+
this.#isOpen = false;
|
|
117
|
+
this.elements.componentWrapper.classList.remove('--opened')
|
|
118
|
+
this.elements.componentWrapper.classList.add('--closed');
|
|
119
|
+
const history = window.history;
|
|
120
|
+
const location = window.location;
|
|
121
|
+
if (location.hash == `#${this.id}`) {
|
|
122
|
+
history.go(-1)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @public
|
|
127
|
+
* will open modal
|
|
128
|
+
*/
|
|
129
|
+
open() {
|
|
130
|
+
this.#isOpen = true;
|
|
131
|
+
this.elements.componentWrapper.classList.remove('--closed');
|
|
132
|
+
this.elements.componentWrapper.classList.add('--opened');
|
|
133
|
+
if (this.id) {
|
|
134
|
+
const history = window.history;
|
|
135
|
+
const location = window.location;
|
|
136
|
+
if (!(location.hash == `#${this.id}`)) {
|
|
137
|
+
history.pushState({ JBModal: {} }, "", `#${this.id}`)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @private
|
|
143
|
+
* when brower back button clicked physically or byy code
|
|
144
|
+
*/
|
|
145
|
+
onBrowserBack(e) {
|
|
146
|
+
if (this.isOpen) {
|
|
147
|
+
this.dispatchCloseEvent('HISTORY_BACK_EVENT');
|
|
148
|
+
if (this.config.autoCloseOnBackgroundClick) {
|
|
149
|
+
this.close();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const myElementNotExists = !customElements.get('jb-modal');
|
|
155
|
+
if (myElementNotExists) {
|
|
156
|
+
window.customElements.define('jb-modal', JBModalWebComponent);
|
|
157
|
+
}
|
package/lib/JBModal.scss
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.jb-modal-web-component {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
z-index: 1;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
&.--closed{
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
&.--opened{
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
.modal-background {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
19
|
+
backdrop-filter: blur(10px);
|
|
20
|
+
z-index: 2;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
.modal-content-wrapper{
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
z-index: 2;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
.modal-content{
|
|
36
|
+
pointer-events: all;
|
|
37
|
+
width: auto;
|
|
38
|
+
height: auto;
|
|
39
|
+
background-color: #fff;
|
|
40
|
+
border-radius: 24px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jb-modal",
|
|
3
|
+
"description": "modal web component",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "mohammad javad bathaei",
|
|
7
|
+
"email": "javadbat@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"jb",
|
|
11
|
+
"jb-modal",
|
|
12
|
+
"dialog",
|
|
13
|
+
"modal window",
|
|
14
|
+
"pop up",
|
|
15
|
+
"web component"
|
|
16
|
+
],
|
|
17
|
+
"version": "1.0.0",
|
|
18
|
+
"bugs": "https://github.com/javadbat/jb-modal/issues",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"files": [
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"README.md",
|
|
23
|
+
"lib/",
|
|
24
|
+
"dist/"
|
|
25
|
+
],
|
|
26
|
+
"main": "index.js",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git@github.com:javadbat/jb-modal.git"
|
|
30
|
+
}
|
|
31
|
+
}
|