aliascss 1.3.3 → 1.3.4
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/dist/aliascss.js +1 -1
- package/lib/build/index.js +29 -4
- package/package.json +1 -1
package/lib/build/index.js
CHANGED
|
@@ -40,7 +40,32 @@ if (!window.AliasCSS) {
|
|
|
40
40
|
// @ts-ignore
|
|
41
41
|
window.AliasCSS = AliasCSS;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
43
|
+
(() => {
|
|
44
|
+
const runScript = () => {
|
|
45
|
+
AliasCSS.classPrinter.run();
|
|
46
|
+
};
|
|
47
|
+
// 1. Run after initial DOM is ready
|
|
48
|
+
if (document.readyState === 'loading') {
|
|
49
|
+
document.addEventListener('DOMContentLoaded', runScript);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
runScript(); // DOM already parsed, run immediately
|
|
53
|
+
}
|
|
54
|
+
// 2. Re-run on every DOM change and attribute change
|
|
55
|
+
const observer = new MutationObserver(() => {
|
|
56
|
+
observer.disconnect(); // pause to avoid infinite loop
|
|
57
|
+
runScript();
|
|
58
|
+
observer.observe(document.body, {
|
|
59
|
+
childList: true,
|
|
60
|
+
subtree: true,
|
|
61
|
+
attributes: true,
|
|
62
|
+
attributeOldValue: true,
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
observer.observe(document.body, {
|
|
66
|
+
childList: true,
|
|
67
|
+
subtree: true,
|
|
68
|
+
attributes: true,
|
|
69
|
+
attributeOldValue: true,
|
|
70
|
+
});
|
|
71
|
+
})();
|