kitzo 1.0.4 → 1.0.5
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 +28 -28
- package/dist/kitzo.umd.js +28 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npm i kitzo
|
|
|
20
20
|
> or
|
|
21
21
|
|
|
22
22
|
```javascript
|
|
23
|
-
<script src="https://cdn.jsdelivr.net/npm/kitzo@1.0.
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/kitzo@1.0.5/dist/kitzo.umd.min.js"></script>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
> Attach this script tag in the html head tag and you are good to go.
|
package/dist/kitzo.esm.js
CHANGED
|
@@ -102,18 +102,18 @@ function kitzoCopy(element, config = {}) {
|
|
|
102
102
|
|
|
103
103
|
const allButtons = getButtons(element);
|
|
104
104
|
if (!allButtons) {
|
|
105
|
-
console.error('No elements found for
|
|
105
|
+
console.error('No elements found for kitzoCopy');
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (!allowedEvents.includes(event)) {
|
|
110
|
-
console.warn(`[
|
|
110
|
+
console.warn(`[kitzoCopy] "${event}" is not allowed. Defaulting to "click".`);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
const safeEvent = allowedEvents.includes(event) ? event : 'click';
|
|
114
114
|
|
|
115
115
|
allButtons.forEach((btn) => {
|
|
116
|
-
btn.setAttribute('data-
|
|
116
|
+
btn.setAttribute('data-kitzo-copy', 'true');
|
|
117
117
|
|
|
118
118
|
copyConfigMap.set(btn, {
|
|
119
119
|
doc,
|
|
@@ -123,7 +123,7 @@ function kitzoCopy(element, config = {}) {
|
|
|
123
123
|
|
|
124
124
|
if (!attachedEvents.has(safeEvent)) {
|
|
125
125
|
document.addEventListener(safeEvent, (e) => {
|
|
126
|
-
const btn = e.target.closest('[data-
|
|
126
|
+
const btn = e.target.closest('[data-kitzo-copy]');
|
|
127
127
|
if (!btn) return;
|
|
128
128
|
|
|
129
129
|
const { doc, event } = copyConfigMap.get(btn);
|
|
@@ -145,12 +145,12 @@ function kitzoDebounce(fn, delay = 300) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
function rippleStyles() {
|
|
148
|
-
return `.
|
|
148
|
+
return `.kitzo-ripple {
|
|
149
149
|
position: relative;
|
|
150
150
|
overflow: hidden;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
.
|
|
153
|
+
.kitzo-ripples {
|
|
154
154
|
display: block;
|
|
155
155
|
position: absolute;
|
|
156
156
|
top: 0;
|
|
@@ -165,7 +165,7 @@ function rippleStyles() {
|
|
|
165
165
|
pointer-events: none;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
.
|
|
168
|
+
.kitzo-ripples.expand {
|
|
169
169
|
animation: expand-ripple var(--ripples-duration) linear forwards;
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -208,20 +208,20 @@ function kitzoRipple(element, config = {}) {
|
|
|
208
208
|
|
|
209
209
|
const allButtons = getButtons(element);
|
|
210
210
|
if (!allButtons) {
|
|
211
|
-
console.error('No elements found for
|
|
211
|
+
console.error('No elements found for kitzoRipple');
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
allButtons.forEach((btn) => {
|
|
215
|
-
btn.classList.add('
|
|
216
|
-
btn.setAttribute('data-
|
|
215
|
+
btn.classList.add('kitzo-ripple');
|
|
216
|
+
btn.setAttribute('data-kitzo-ripple', 'true');
|
|
217
217
|
});
|
|
218
218
|
|
|
219
219
|
if (!rippleListenerAdded) {
|
|
220
220
|
document.addEventListener('mousedown', (e) => {
|
|
221
|
-
const btn = e.target.closest('[data-
|
|
221
|
+
const btn = e.target.closest('[data-kitzo-ripple]');
|
|
222
222
|
if (btn) {
|
|
223
223
|
const span = document.createElement('span');
|
|
224
|
-
span.className = '
|
|
224
|
+
span.className = 'kitzo-ripples';
|
|
225
225
|
btn.appendChild(span);
|
|
226
226
|
|
|
227
227
|
const { left, top, width } = btn.getBoundingClientRect();
|
|
@@ -256,7 +256,7 @@ function tooltipStyles() {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
.
|
|
259
|
+
.kitzo-tooltip {
|
|
260
260
|
--tooltip-arrow-clr: var(--tooltip-bg-clr);
|
|
261
261
|
|
|
262
262
|
box-sizing: border-box;
|
|
@@ -282,42 +282,42 @@ function tooltipStyles() {
|
|
|
282
282
|
pointer-events: none;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
.
|
|
285
|
+
.kitzo-tooltip.show {
|
|
286
286
|
opacity: 1 !important;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
.
|
|
290
|
-
.
|
|
291
|
-
.
|
|
292
|
-
.
|
|
289
|
+
.kitzo-tooltip-top::before,
|
|
290
|
+
.kitzo-tooltip-right::before,
|
|
291
|
+
.kitzo-tooltip-bottom::before,
|
|
292
|
+
.kitzo-tooltip-left::before {
|
|
293
293
|
|
|
294
294
|
content: '';
|
|
295
295
|
position: absolute;
|
|
296
296
|
border: 6px solid;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
.
|
|
299
|
+
.kitzo-tooltip-top::before {
|
|
300
300
|
top: calc(100% - 1px);
|
|
301
301
|
left: 50%;
|
|
302
302
|
translate: -50% 0;
|
|
303
303
|
border-color: var(--tooltip-arrow-clr) transparent transparent transparent;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
.
|
|
306
|
+
.kitzo-tooltip-right::before {
|
|
307
307
|
top: 50%;
|
|
308
308
|
right: calc(100% - 1px);
|
|
309
309
|
translate: 0 -50%;
|
|
310
310
|
border-color: transparent var(--tooltip-arrow-clr) transparent transparent;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
.
|
|
313
|
+
.kitzo-tooltip-bottom::before {
|
|
314
314
|
bottom: calc(100% - 1px);
|
|
315
315
|
left: 50%;
|
|
316
316
|
translate: -50% 0;
|
|
317
317
|
border-color: transparent transparent var(--tooltip-arrow-clr) transparent;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
.
|
|
320
|
+
.kitzo-tooltip-left::before {
|
|
321
321
|
left: calc(100% - 1px);
|
|
322
322
|
top: 50%;
|
|
323
323
|
translate: 0 -50%;
|
|
@@ -354,20 +354,20 @@ function kitzoTooltip(element, config = {}) {
|
|
|
354
354
|
|
|
355
355
|
const allButtons = getButtons(element);
|
|
356
356
|
if (!allButtons) {
|
|
357
|
-
console.error('No elements found for
|
|
357
|
+
console.error('No elements found for kitzoTooltip');
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
const disAllowedStyles = ['top', 'left', 'right', 'bottom', 'position', 'zIndex', 'opacity', 'transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
362
362
|
for (const key of disAllowedStyles) {
|
|
363
363
|
if (key in config.style) {
|
|
364
|
-
console.warn(`[
|
|
364
|
+
console.warn(`[kitzoTooltip] "${key}" style is managed internally and will be ignored.`);
|
|
365
365
|
delete config.style[key];
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
allButtons.forEach((btn) => {
|
|
370
|
-
btn.setAttribute('data-
|
|
370
|
+
btn.setAttribute('data-kitzo-tooltip', true);
|
|
371
371
|
tooltipConfigMap.set(btn, config);
|
|
372
372
|
});
|
|
373
373
|
|
|
@@ -409,7 +409,7 @@ function kitzoTooltip(element, config = {}) {
|
|
|
409
409
|
|
|
410
410
|
if (!tooltipListenerAdded) {
|
|
411
411
|
document.addEventListener('mouseover', (e) => {
|
|
412
|
-
const btn = e.target.closest('[data-
|
|
412
|
+
const btn = e.target.closest('[data-kitzo-tooltip]');
|
|
413
413
|
if (btn) {
|
|
414
414
|
const { tooltip, direction, offset, customClass, style, arrow } = tooltipConfigMap.get(btn);
|
|
415
415
|
|
|
@@ -424,7 +424,7 @@ function kitzoTooltip(element, config = {}) {
|
|
|
424
424
|
|
|
425
425
|
const isArrowOn = arrow === 'on';
|
|
426
426
|
tooltipDiv.textContent = tooltip;
|
|
427
|
-
tooltipDiv.className = `
|
|
427
|
+
tooltipDiv.className = `kitzo-tooltip ${isArrowOn ? `kitzo-tooltip-${direction}` : ''} ${customClass.trim() ? customClass : ''}`;
|
|
428
428
|
|
|
429
429
|
if (isArrowOn) {
|
|
430
430
|
const color = getComputedStyle(tooltipDiv).backgroundColor;
|
|
@@ -441,7 +441,7 @@ function kitzoTooltip(element, config = {}) {
|
|
|
441
441
|
});
|
|
442
442
|
|
|
443
443
|
document.addEventListener('mouseout', (e) => {
|
|
444
|
-
const btn = e.target.closest('[data-
|
|
444
|
+
const btn = e.target.closest('[data-kitzo-tooltip]');
|
|
445
445
|
if (btn) {
|
|
446
446
|
tooltipDiv.classList.remove('show');
|
|
447
447
|
}
|
package/dist/kitzo.umd.js
CHANGED
|
@@ -108,18 +108,18 @@
|
|
|
108
108
|
|
|
109
109
|
const allButtons = getButtons(element);
|
|
110
110
|
if (!allButtons) {
|
|
111
|
-
console.error('No elements found for
|
|
111
|
+
console.error('No elements found for kitzoCopy');
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
if (!allowedEvents.includes(event)) {
|
|
116
|
-
console.warn(`[
|
|
116
|
+
console.warn(`[kitzoCopy] "${event}" is not allowed. Defaulting to "click".`);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
const safeEvent = allowedEvents.includes(event) ? event : 'click';
|
|
120
120
|
|
|
121
121
|
allButtons.forEach((btn) => {
|
|
122
|
-
btn.setAttribute('data-
|
|
122
|
+
btn.setAttribute('data-kitzo-copy', 'true');
|
|
123
123
|
|
|
124
124
|
copyConfigMap.set(btn, {
|
|
125
125
|
doc,
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
|
|
130
130
|
if (!attachedEvents.has(safeEvent)) {
|
|
131
131
|
document.addEventListener(safeEvent, (e) => {
|
|
132
|
-
const btn = e.target.closest('[data-
|
|
132
|
+
const btn = e.target.closest('[data-kitzo-copy]');
|
|
133
133
|
if (!btn) return;
|
|
134
134
|
|
|
135
135
|
const { doc, event } = copyConfigMap.get(btn);
|
|
@@ -151,12 +151,12 @@
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
function rippleStyles() {
|
|
154
|
-
return `.
|
|
154
|
+
return `.kitzo-ripple {
|
|
155
155
|
position: relative;
|
|
156
156
|
overflow: hidden;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
.
|
|
159
|
+
.kitzo-ripples {
|
|
160
160
|
display: block;
|
|
161
161
|
position: absolute;
|
|
162
162
|
top: 0;
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
pointer-events: none;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
.
|
|
174
|
+
.kitzo-ripples.expand {
|
|
175
175
|
animation: expand-ripple var(--ripples-duration) linear forwards;
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -214,20 +214,20 @@
|
|
|
214
214
|
|
|
215
215
|
const allButtons = getButtons(element);
|
|
216
216
|
if (!allButtons) {
|
|
217
|
-
console.error('No elements found for
|
|
217
|
+
console.error('No elements found for kitzoRipple');
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
allButtons.forEach((btn) => {
|
|
221
|
-
btn.classList.add('
|
|
222
|
-
btn.setAttribute('data-
|
|
221
|
+
btn.classList.add('kitzo-ripple');
|
|
222
|
+
btn.setAttribute('data-kitzo-ripple', 'true');
|
|
223
223
|
});
|
|
224
224
|
|
|
225
225
|
if (!rippleListenerAdded) {
|
|
226
226
|
document.addEventListener('mousedown', (e) => {
|
|
227
|
-
const btn = e.target.closest('[data-
|
|
227
|
+
const btn = e.target.closest('[data-kitzo-ripple]');
|
|
228
228
|
if (btn) {
|
|
229
229
|
const span = document.createElement('span');
|
|
230
|
-
span.className = '
|
|
230
|
+
span.className = 'kitzo-ripples';
|
|
231
231
|
btn.appendChild(span);
|
|
232
232
|
|
|
233
233
|
const { left, top, width } = btn.getBoundingClientRect();
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
.
|
|
265
|
+
.kitzo-tooltip {
|
|
266
266
|
--tooltip-arrow-clr: var(--tooltip-bg-clr);
|
|
267
267
|
|
|
268
268
|
box-sizing: border-box;
|
|
@@ -288,42 +288,42 @@
|
|
|
288
288
|
pointer-events: none;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
.
|
|
291
|
+
.kitzo-tooltip.show {
|
|
292
292
|
opacity: 1 !important;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
.
|
|
296
|
-
.
|
|
297
|
-
.
|
|
298
|
-
.
|
|
295
|
+
.kitzo-tooltip-top::before,
|
|
296
|
+
.kitzo-tooltip-right::before,
|
|
297
|
+
.kitzo-tooltip-bottom::before,
|
|
298
|
+
.kitzo-tooltip-left::before {
|
|
299
299
|
|
|
300
300
|
content: '';
|
|
301
301
|
position: absolute;
|
|
302
302
|
border: 6px solid;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
.
|
|
305
|
+
.kitzo-tooltip-top::before {
|
|
306
306
|
top: calc(100% - 1px);
|
|
307
307
|
left: 50%;
|
|
308
308
|
translate: -50% 0;
|
|
309
309
|
border-color: var(--tooltip-arrow-clr) transparent transparent transparent;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
.
|
|
312
|
+
.kitzo-tooltip-right::before {
|
|
313
313
|
top: 50%;
|
|
314
314
|
right: calc(100% - 1px);
|
|
315
315
|
translate: 0 -50%;
|
|
316
316
|
border-color: transparent var(--tooltip-arrow-clr) transparent transparent;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
.
|
|
319
|
+
.kitzo-tooltip-bottom::before {
|
|
320
320
|
bottom: calc(100% - 1px);
|
|
321
321
|
left: 50%;
|
|
322
322
|
translate: -50% 0;
|
|
323
323
|
border-color: transparent transparent var(--tooltip-arrow-clr) transparent;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
.
|
|
326
|
+
.kitzo-tooltip-left::before {
|
|
327
327
|
left: calc(100% - 1px);
|
|
328
328
|
top: 50%;
|
|
329
329
|
translate: 0 -50%;
|
|
@@ -360,20 +360,20 @@
|
|
|
360
360
|
|
|
361
361
|
const allButtons = getButtons(element);
|
|
362
362
|
if (!allButtons) {
|
|
363
|
-
console.error('No elements found for
|
|
363
|
+
console.error('No elements found for kitzoTooltip');
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
const disAllowedStyles = ['top', 'left', 'right', 'bottom', 'position', 'zIndex', 'opacity', 'transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
368
368
|
for (const key of disAllowedStyles) {
|
|
369
369
|
if (key in config.style) {
|
|
370
|
-
console.warn(`[
|
|
370
|
+
console.warn(`[kitzoTooltip] "${key}" style is managed internally and will be ignored.`);
|
|
371
371
|
delete config.style[key];
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
allButtons.forEach((btn) => {
|
|
376
|
-
btn.setAttribute('data-
|
|
376
|
+
btn.setAttribute('data-kitzo-tooltip', true);
|
|
377
377
|
tooltipConfigMap.set(btn, config);
|
|
378
378
|
});
|
|
379
379
|
|
|
@@ -415,7 +415,7 @@
|
|
|
415
415
|
|
|
416
416
|
if (!tooltipListenerAdded) {
|
|
417
417
|
document.addEventListener('mouseover', (e) => {
|
|
418
|
-
const btn = e.target.closest('[data-
|
|
418
|
+
const btn = e.target.closest('[data-kitzo-tooltip]');
|
|
419
419
|
if (btn) {
|
|
420
420
|
const { tooltip, direction, offset, customClass, style, arrow } = tooltipConfigMap.get(btn);
|
|
421
421
|
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
|
|
431
431
|
const isArrowOn = arrow === 'on';
|
|
432
432
|
tooltipDiv.textContent = tooltip;
|
|
433
|
-
tooltipDiv.className = `
|
|
433
|
+
tooltipDiv.className = `kitzo-tooltip ${isArrowOn ? `kitzo-tooltip-${direction}` : ''} ${customClass.trim() ? customClass : ''}`;
|
|
434
434
|
|
|
435
435
|
if (isArrowOn) {
|
|
436
436
|
const color = getComputedStyle(tooltipDiv).backgroundColor;
|
|
@@ -447,7 +447,7 @@
|
|
|
447
447
|
});
|
|
448
448
|
|
|
449
449
|
document.addEventListener('mouseout', (e) => {
|
|
450
|
-
const btn = e.target.closest('[data-
|
|
450
|
+
const btn = e.target.closest('[data-kitzo-tooltip]');
|
|
451
451
|
if (btn) {
|
|
452
452
|
tooltipDiv.classList.remove('show');
|
|
453
453
|
}
|