fix: sliders in demo require reload to rerender

CSS custom property changes (--pxicon-ap-size, --pxicon-mode) aren't
observed by MutationObserver/ResizeObserver, so a live-mounted <px-icon>
never rechecked its config. Add a pxicon:refresh document event + exported
refreshAll() helper; demo calls it from its control handlers.
This commit is contained in:
mark
2026-08-08 15:56:58 +02:00
parent c6035b66bf
commit 0c2785ca3b
2 changed files with 22 additions and 2 deletions
+2 -1
View File
@@ -170,7 +170,7 @@
</div>
<script type="module">
import '../px-icon.js';
import { refreshAll } from '../px-icon.js';
const apSizeInput = document.getElementById('apSize');
const apSizeVal = document.getElementById('apSizeVal');
@@ -181,6 +181,7 @@ function applyConfig() {
apSizeVal.textContent = ap;
document.documentElement.style.setProperty('--pxicon-ap-size', ap + 'px');
document.documentElement.style.setProperty('--pxicon-mode', modeSelect.value);
refreshAll();
}
apSizeInput.addEventListener('input', applyConfig);
modeSelect.addEventListener('change', applyConfig);