kitzo 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/kitzo.esm.js +13 -10
- package/dist/kitzo.umd.js +13 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm i kitzo
|
|
|
21
21
|
or
|
|
22
22
|
|
|
23
23
|
```javascript
|
|
24
|
-
<script src="https://cdn.jsdelivr.net/npm/kitzo@1.1.
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/kitzo@1.1.6/dist/kitzo.umd.min.js"></script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
> Attach this script tag in the html head tag and you are good to go.
|
package/dist/kitzo.esm.js
CHANGED
|
@@ -151,12 +151,7 @@ function debounce(fn, delay = 300) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
function rippleStyles() {
|
|
154
|
-
return `.kitzo-
|
|
155
|
-
position: relative;
|
|
156
|
-
overflow: hidden;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.kitzo-ripples {
|
|
154
|
+
return `.kitzo-ripples {
|
|
160
155
|
display: block;
|
|
161
156
|
position: absolute;
|
|
162
157
|
top: 0;
|
|
@@ -191,6 +186,7 @@ function rippleStyles() {
|
|
|
191
186
|
|
|
192
187
|
//! Ripple effect
|
|
193
188
|
let rippleListenerAdded = false;
|
|
189
|
+
const rippleConfigMap = new WeakMap();
|
|
194
190
|
|
|
195
191
|
function ripple(element, config = {}) {
|
|
196
192
|
if (!element) {
|
|
@@ -210,22 +206,29 @@ function ripple(element, config = {}) {
|
|
|
210
206
|
config
|
|
211
207
|
);
|
|
212
208
|
|
|
213
|
-
const { opacity, color, duration, size } = config;
|
|
214
|
-
|
|
215
209
|
const allButtons = getButtons(element);
|
|
216
210
|
if (!allButtons) {
|
|
217
211
|
console.error('[kitzo.ripple] No elements found for kitzoRipple');
|
|
218
212
|
return;
|
|
219
213
|
}
|
|
220
214
|
allButtons.forEach((btn) => {
|
|
221
|
-
btn.
|
|
222
|
-
|
|
215
|
+
btn.setAttribute('data-kitzo-ripple', true);
|
|
216
|
+
rippleConfigMap.set(btn, config);
|
|
217
|
+
const { position, overflow } = window.getComputedStyle(btn);
|
|
218
|
+
console.log(position, overflow);
|
|
219
|
+
if (position === 'static') {
|
|
220
|
+
btn.style.position = 'relative';
|
|
221
|
+
}
|
|
222
|
+
if (overflow === 'visible') {
|
|
223
|
+
btn.style.overflow = 'hidden';
|
|
224
|
+
}
|
|
223
225
|
});
|
|
224
226
|
|
|
225
227
|
if (!rippleListenerAdded) {
|
|
226
228
|
document.addEventListener('mousedown', (e) => {
|
|
227
229
|
const btn = e.target.closest('[data-kitzo-ripple]');
|
|
228
230
|
if (btn) {
|
|
231
|
+
const { opacity, duration, color, size } = rippleConfigMap.get(btn);
|
|
229
232
|
const span = document.createElement('span');
|
|
230
233
|
span.className = 'kitzo-ripples';
|
|
231
234
|
btn.appendChild(span);
|
package/dist/kitzo.umd.js
CHANGED
|
@@ -157,12 +157,7 @@
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
function rippleStyles() {
|
|
160
|
-
return `.kitzo-
|
|
161
|
-
position: relative;
|
|
162
|
-
overflow: hidden;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.kitzo-ripples {
|
|
160
|
+
return `.kitzo-ripples {
|
|
166
161
|
display: block;
|
|
167
162
|
position: absolute;
|
|
168
163
|
top: 0;
|
|
@@ -197,6 +192,7 @@
|
|
|
197
192
|
|
|
198
193
|
//! Ripple effect
|
|
199
194
|
let rippleListenerAdded = false;
|
|
195
|
+
const rippleConfigMap = new WeakMap();
|
|
200
196
|
|
|
201
197
|
function ripple(element, config = {}) {
|
|
202
198
|
if (!element) {
|
|
@@ -216,22 +212,29 @@
|
|
|
216
212
|
config
|
|
217
213
|
);
|
|
218
214
|
|
|
219
|
-
const { opacity, color, duration, size } = config;
|
|
220
|
-
|
|
221
215
|
const allButtons = getButtons(element);
|
|
222
216
|
if (!allButtons) {
|
|
223
217
|
console.error('[kitzo.ripple] No elements found for kitzoRipple');
|
|
224
218
|
return;
|
|
225
219
|
}
|
|
226
220
|
allButtons.forEach((btn) => {
|
|
227
|
-
btn.
|
|
228
|
-
|
|
221
|
+
btn.setAttribute('data-kitzo-ripple', true);
|
|
222
|
+
rippleConfigMap.set(btn, config);
|
|
223
|
+
const { position, overflow } = window.getComputedStyle(btn);
|
|
224
|
+
console.log(position, overflow);
|
|
225
|
+
if (position === 'static') {
|
|
226
|
+
btn.style.position = 'relative';
|
|
227
|
+
}
|
|
228
|
+
if (overflow === 'visible') {
|
|
229
|
+
btn.style.overflow = 'hidden';
|
|
230
|
+
}
|
|
229
231
|
});
|
|
230
232
|
|
|
231
233
|
if (!rippleListenerAdded) {
|
|
232
234
|
document.addEventListener('mousedown', (e) => {
|
|
233
235
|
const btn = e.target.closest('[data-kitzo-ripple]');
|
|
234
236
|
if (btn) {
|
|
237
|
+
const { opacity, duration, color, size } = rippleConfigMap.get(btn);
|
|
235
238
|
const span = document.createElement('span');
|
|
236
239
|
span.className = 'kitzo-ripples';
|
|
237
240
|
btn.appendChild(span);
|