@oksigenia/access-panel 0.7.1 → 0.7.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/CHANGELOG.md +9 -0
- package/dist/index.js +15 -12
- package/dist/index.js.map +1 -1
- package/dist/web-component.js +15 -12
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
package/dist/web-component.js
CHANGED
|
@@ -230,29 +230,32 @@ function escapeAttr(s) {
|
|
|
230
230
|
function positionRules(position) {
|
|
231
231
|
switch (position) {
|
|
232
232
|
case "top-left":
|
|
233
|
-
return { wrap: "top: 20px; left: 20px;", panel: "top: 80px; left: 20px;" };
|
|
233
|
+
return { wrap: "top: 20px; left: 20px;", panel: "top: 80px; left: 20px;", reserve: 100 };
|
|
234
234
|
case "top-center":
|
|
235
|
-
return { wrap: "top: 20px; left: 50%; transform: translateX(-50%);", panel: "top: 80px; left: 50%; transform: translateX(-50%);" };
|
|
235
|
+
return { wrap: "top: 20px; left: 50%; transform: translateX(-50%);", panel: "top: 80px; left: 50%; transform: translateX(-50%);", reserve: 100 };
|
|
236
236
|
case "top-right":
|
|
237
|
-
return { wrap: "top: 20px; right: 20px;", panel: "top: 80px; right: 20px;" };
|
|
237
|
+
return { wrap: "top: 20px; right: 20px;", panel: "top: 80px; right: 20px;", reserve: 100 };
|
|
238
238
|
case "mid-left":
|
|
239
|
-
return { wrap: "top: 50%; left: 20px; transform: translateY(-50%);", panel: "top: 50%; left: 90px; transform: translateY(-50%);" };
|
|
239
|
+
return { wrap: "top: 50%; left: 20px; transform: translateY(-50%);", panel: "top: 50%; left: 90px; transform: translateY(-50%);", reserve: 40 };
|
|
240
240
|
case "mid-center":
|
|
241
|
-
return { wrap: "top: 50%; left: 50%; transform: translate(-50%, -50%);", panel: "top: 50%; left: 50%; transform: translate(-50%, -50%);" };
|
|
241
|
+
return { wrap: "top: 50%; left: 50%; transform: translate(-50%, -50%);", panel: "top: 50%; left: 50%; transform: translate(-50%, -50%);", reserve: 40 };
|
|
242
242
|
case "mid-right":
|
|
243
|
-
return { wrap: "top: 50%; right: 20px; transform: translateY(-50%);", panel: "top: 50%; right: 90px; transform: translateY(-50%);" };
|
|
243
|
+
return { wrap: "top: 50%; right: 20px; transform: translateY(-50%);", panel: "top: 50%; right: 90px; transform: translateY(-50%);", reserve: 40 };
|
|
244
244
|
case "bottom-left":
|
|
245
|
-
return { wrap: "bottom: 20px; left: 20px;", panel: "bottom: 100px; left: 20px;" };
|
|
245
|
+
return { wrap: "bottom: 20px; left: 20px;", panel: "bottom: 100px; left: 20px;", reserve: 120 };
|
|
246
246
|
case "bottom-center":
|
|
247
|
-
return { wrap: "bottom: 20px; left: 50%; transform: translateX(-50%);", panel: "bottom: 100px; left: 50%; transform: translateX(-50%);" };
|
|
247
|
+
return { wrap: "bottom: 20px; left: 50%; transform: translateX(-50%);", panel: "bottom: 100px; left: 50%; transform: translateX(-50%);", reserve: 120 };
|
|
248
248
|
case "bottom-right":
|
|
249
|
-
return { wrap: "bottom: 20px; right: 20px;", panel: "bottom: 100px; right: 20px;" };
|
|
249
|
+
return { wrap: "bottom: 20px; right: 20px;", panel: "bottom: 100px; right: 20px;", reserve: 120 };
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
+
function panelMaxHeight(reserve) {
|
|
253
|
+
return `max-height: calc(100vh - ${reserve}px); max-height: calc(100dvh - ${reserve}px);`;
|
|
254
|
+
}
|
|
252
255
|
function positionCss(position, mobile) {
|
|
253
256
|
const d = positionRules(position);
|
|
254
257
|
let css = `.oks-access-wrapper { ${d.wrap} }`;
|
|
255
|
-
css += `@media (min-width: 769px) { .oks-access-panel { ${d.panel} } }`;
|
|
258
|
+
css += `@media (min-width: 769px) { .oks-access-panel { ${d.panel} ${panelMaxHeight(d.reserve)} } }`;
|
|
256
259
|
if (mobile && mobile !== position) {
|
|
257
260
|
const m = positionRules(mobile);
|
|
258
261
|
css += `@media (max-width: 768px) { .oks-access-wrapper { top: auto; right: auto; bottom: auto; left: auto; transform: none; ${m.wrap} } }`;
|
|
@@ -281,8 +284,8 @@ var DEFAULT_STATE = Object.freeze({
|
|
|
281
284
|
bigTargets: false
|
|
282
285
|
});
|
|
283
286
|
function loadState(key) {
|
|
284
|
-
if (typeof localStorage === "undefined") return { ...DEFAULT_STATE };
|
|
285
287
|
try {
|
|
288
|
+
if (typeof localStorage === "undefined") return { ...DEFAULT_STATE };
|
|
286
289
|
const raw = localStorage.getItem(key);
|
|
287
290
|
if (!raw) return { ...DEFAULT_STATE };
|
|
288
291
|
const parsed = JSON.parse(raw);
|
|
@@ -293,8 +296,8 @@ function loadState(key) {
|
|
|
293
296
|
}
|
|
294
297
|
}
|
|
295
298
|
function saveState(key, state) {
|
|
296
|
-
if (typeof localStorage === "undefined") return;
|
|
297
299
|
try {
|
|
300
|
+
if (typeof localStorage === "undefined") return;
|
|
298
301
|
const out = {};
|
|
299
302
|
for (const [k, v] of Object.entries(state)) {
|
|
300
303
|
if (typeof v === "number" && v > 0) out[k] = v;
|