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:
+2
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user