@open-slot-ui/core 0.3.0 → 0.3.2
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/index.cjs +28 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2010,26 +2010,40 @@ function installResponsive(ui, responsive) {
|
|
|
2010
2010
|
if (!c) continue;
|
|
2011
2011
|
base.set(id, { layout: cloneLayout(c.layout), hidden: ui.hidden.has(id) });
|
|
2012
2012
|
}
|
|
2013
|
+
let applying = false;
|
|
2013
2014
|
const apply = (screen) => {
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
const
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2015
|
+
applying = true;
|
|
2016
|
+
try {
|
|
2017
|
+
const keys = activeKeys(screen);
|
|
2018
|
+
for (const [id, b] of base) {
|
|
2019
|
+
const c = ui.control(id);
|
|
2020
|
+
if (!c) continue;
|
|
2021
|
+
let layout = b.layout;
|
|
2022
|
+
let hidden = b.hidden;
|
|
2023
|
+
for (const key of keys) {
|
|
2024
|
+
const ov = responsive[key]?.controls?.[id];
|
|
2025
|
+
if (!ov) continue;
|
|
2026
|
+
if (ov.layout) layout = ov.layout;
|
|
2027
|
+
if (ov.hidden != null) hidden = ov.hidden;
|
|
2028
|
+
}
|
|
2029
|
+
c.layout = cloneLayout(layout);
|
|
2030
|
+
ui.setHidden(id, hidden);
|
|
2025
2031
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2032
|
+
} finally {
|
|
2033
|
+
applying = false;
|
|
2028
2034
|
}
|
|
2029
2035
|
};
|
|
2036
|
+
const offVis = ui.on("visibilityChanged", ({ id, hidden }) => {
|
|
2037
|
+
if (applying) return;
|
|
2038
|
+
const b = base.get(id);
|
|
2039
|
+
if (b) b.hidden = hidden;
|
|
2040
|
+
});
|
|
2030
2041
|
const off = ui.screen.subscribe(apply);
|
|
2031
2042
|
apply(ui.screen.get());
|
|
2032
|
-
return
|
|
2043
|
+
return () => {
|
|
2044
|
+
off();
|
|
2045
|
+
offVis();
|
|
2046
|
+
};
|
|
2033
2047
|
}
|
|
2034
2048
|
|
|
2035
2049
|
// src/spec/createUI.ts
|