saasufy-components 7.7.7 → 7.9.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/package.json +1 -1
- package/styles.css +1 -1
- package/utils.js +32 -0
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -65,7 +65,7 @@ input[type=button][disabled],input[type=submit][disabled],button[disabled] {
|
|
|
65
65
|
opacity: .6;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
input[type=text],input[type=password],input[type=button],input[type=submit],input[type=number],select,textarea {
|
|
68
|
+
input[type=text],input[type=password],input[type=button],input[type=submit],input[type=number],select,textarea,button {
|
|
69
69
|
padding: 10px;
|
|
70
70
|
font-size: 18px;
|
|
71
71
|
width: 100%;
|
package/utils.js
CHANGED
|
@@ -484,6 +484,38 @@ export function formatError(error) {
|
|
|
484
484
|
return error.code === 1009 ? 'Resource exceeded the maximum size' : error.message;
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
+
export function logAttributeChanges(...elementSelectors) {
|
|
488
|
+
let domObserverCallback = (mutationList) => {
|
|
489
|
+
for (let mutation of mutationList) {
|
|
490
|
+
let matchingSelector = (elementSelectors || []).find(elementSelector => mutation.target?.matches(elementSelector));
|
|
491
|
+
let isWatchingElement = !elementSelectors.length || !!matchingSelector;
|
|
492
|
+
if (mutation.type === 'attributes' && isWatchingElement) {
|
|
493
|
+
let identifier = mutation.target.id || matchingSelector || mutation.target.nodeName?.toLowerCase();
|
|
494
|
+
console.log(
|
|
495
|
+
`[${identifier}] Attribute ${
|
|
496
|
+
mutation.attributeName
|
|
497
|
+
} changed to: ${
|
|
498
|
+
mutation.target.getAttribute(mutation.attributeName)
|
|
499
|
+
}`
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
let observer = new MutationObserver(domObserverCallback);
|
|
506
|
+
|
|
507
|
+
let config = {
|
|
508
|
+
attributes: true,
|
|
509
|
+
subtree: true,
|
|
510
|
+
attributeOldValue: true
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
observer.observe(document, config);
|
|
514
|
+
return () => {
|
|
515
|
+
observer.disconnect();
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
487
519
|
export function wait(duration) {
|
|
488
520
|
return new Promise((resolve) => setTimeout(resolve, duration));
|
|
489
521
|
}
|