@camera.ui/browser 0.0.200 → 0.0.201
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.js +15 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4123,12 +4123,15 @@ function useCuiFullscreen(target, options = {}) {
|
|
|
4123
4123
|
const wrapper = document.createElement("div");
|
|
4124
4124
|
wrapper.className = `cui-fullscreen cui-fullscreen-${mode}`;
|
|
4125
4125
|
applyWrapperStyles(wrapper, mode);
|
|
4126
|
+
const placeholder = document.createComment("cui-fullscreen");
|
|
4127
|
+
el.before(placeholder);
|
|
4126
4128
|
const state = {
|
|
4127
4129
|
wrapper,
|
|
4128
4130
|
parent: el.parentElement,
|
|
4129
|
-
|
|
4131
|
+
placeholder,
|
|
4130
4132
|
bodyOverflow: document.body.style.overflow,
|
|
4131
|
-
htmlOverflow: document.documentElement.style.overflow
|
|
4133
|
+
htmlOverflow: document.documentElement.style.overflow,
|
|
4134
|
+
scrollY: window.scrollY
|
|
4132
4135
|
};
|
|
4133
4136
|
fsRegistry.set(el, state);
|
|
4134
4137
|
el.setAttribute("data-cui-fullscreen", mode);
|
|
@@ -4136,6 +4139,10 @@ function useCuiFullscreen(target, options = {}) {
|
|
|
4136
4139
|
wrapper.appendChild(el);
|
|
4137
4140
|
document.body.style.overflow = "hidden";
|
|
4138
4141
|
document.documentElement.style.overflow = "hidden";
|
|
4142
|
+
window.scrollTo({
|
|
4143
|
+
top: 0,
|
|
4144
|
+
behavior: "instant"
|
|
4145
|
+
});
|
|
4139
4146
|
document.addEventListener("keydown", onEscape);
|
|
4140
4147
|
fullscreenStack.push(wrapper);
|
|
4141
4148
|
refreshTopmost();
|
|
@@ -4148,13 +4155,15 @@ function useCuiFullscreen(target, options = {}) {
|
|
|
4148
4155
|
if (!state) return;
|
|
4149
4156
|
fsRegistry.delete(el);
|
|
4150
4157
|
el.removeAttribute("data-cui-fullscreen");
|
|
4151
|
-
if (state.
|
|
4152
|
-
|
|
4153
|
-
else state.parent.appendChild(el);
|
|
4154
|
-
}
|
|
4158
|
+
if (state.placeholder.parentNode) state.placeholder.replaceWith(el);
|
|
4159
|
+
else state.parent?.appendChild(el);
|
|
4155
4160
|
state.wrapper.remove();
|
|
4156
4161
|
document.body.style.overflow = state.bodyOverflow;
|
|
4157
4162
|
document.documentElement.style.overflow = state.htmlOverflow;
|
|
4163
|
+
window.scrollTo({
|
|
4164
|
+
top: state.scrollY,
|
|
4165
|
+
behavior: "instant"
|
|
4166
|
+
});
|
|
4158
4167
|
document.removeEventListener("keydown", onEscape);
|
|
4159
4168
|
const stackIndex = fullscreenStack.indexOf(state.wrapper);
|
|
4160
4169
|
if (stackIndex !== -1) fullscreenStack.splice(stackIndex, 1);
|