winduum 0.1.15 → 0.1.17
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/package.json
CHANGED
package/src/libraries/dialog.js
CHANGED
|
@@ -15,6 +15,8 @@ const defaultOptions = {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const dialogSelector = selector => document.querySelectorAll(selector)[document.querySelectorAll(selector).length - 1]
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* Dismisses a dialog.
|
|
20
22
|
* @type {typeof import("./dialog").dismissDialog}
|
|
@@ -92,8 +94,6 @@ const closeDialog = async (selector, options = defaultOptions.close) => {
|
|
|
92
94
|
const insertDialog = async (content, options = defaultOptions.insert) => {
|
|
93
95
|
options = Object.assign({}, defaultOptions.insert, options)
|
|
94
96
|
|
|
95
|
-
const dialogSelector = selector => document.querySelectorAll(selector)[document.querySelectorAll(selector).length - 1]
|
|
96
|
-
|
|
97
97
|
if (!dialogSelector(options.selector) || options.append) {
|
|
98
98
|
document.body.insertAdjacentHTML('beforeend', `<dialog class="${options.class}">${content}</dialog>`)
|
|
99
99
|
} else {
|
|
@@ -115,7 +115,7 @@ const fetchDialog = async ({ url, insertOptions = {} }) => {
|
|
|
115
115
|
.then(async ({ content }) => await insertDialog(content, insertOptions))
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
export { showDialog, closeDialog, insertDialog, fetchDialog }
|
|
118
|
+
export { showDialog, closeDialog, insertDialog, fetchDialog, dialogSelector, dismissDialog }
|
|
119
119
|
|
|
120
120
|
export default {
|
|
121
121
|
defaults: defaultOptions,
|
package/src/libraries/ripple.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Shows a ripple effect.
|
|
3
3
|
* @type {typeof import("./ripple").showRipple}
|
|
4
4
|
*/
|
|
5
|
-
const showRipple = ({ currentTarget,
|
|
5
|
+
const showRipple = ({ currentTarget, layerX, layerY }, selector = currentTarget.querySelector('.lib-ripple')) => {
|
|
6
6
|
if (!selector) {
|
|
7
7
|
currentTarget.insertAdjacentHTML('beforeend', "<div class='lib-ripple'></div>")
|
|
8
8
|
selector = currentTarget.querySelector('.lib-ripple')
|
|
@@ -17,8 +17,8 @@ const showRipple = ({ currentTarget, pageX, pageY }, selector = currentTarget.qu
|
|
|
17
17
|
selector.style.height = d + 'px'
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
selector.style.top =
|
|
21
|
-
selector.style.left =
|
|
20
|
+
selector.style.top = layerX - (selector.clientWidth / 2) + 'px'
|
|
21
|
+
selector.style.left = layerY - (selector.clientHeight / 2) + 'px'
|
|
22
22
|
selector.classList.add('animation-ripple')
|
|
23
23
|
}
|
|
24
24
|
|