@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @oksigenia/access-panel
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Two fixes:
|
|
8
|
+
|
|
9
|
+
- **The open panel no longer overflows short desktop viewports.** The panel was capped at a flat `90vh` while sitting 80–100px from its anchored edge, so at 1280×720 or on a 1366×768 laptop a `bottom-*` panel ran past the top of the screen and took the header with the close button with it (`top-*` panels overflowed the bottom the same way). Each anchor now caps the panel to the room it actually has (`calc(100dvh - <offset> - 20px)`, with a `vh` fallback), and the content area scrolls inside. Mobile is unchanged: it stays full-screen.
|
|
10
|
+
- **Blocked storage no longer breaks the panel.** `typeof localStorage` sat outside the `try`, and when storage is denied (all cookies blocked, sandboxed iframe) merely reading `window.localStorage` throws — the component lost its behaviour and the trigger did nothing. The check now lives inside the guard; the panel works and simply doesn't persist settings.
|
|
11
|
+
|
|
3
12
|
## 0.7.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -256,29 +256,32 @@ function escapeAttr(s) {
|
|
|
256
256
|
function positionRules(position) {
|
|
257
257
|
switch (position) {
|
|
258
258
|
case "top-left":
|
|
259
|
-
return { wrap: "top: 20px; left: 20px;", panel: "top: 80px; left: 20px;" };
|
|
259
|
+
return { wrap: "top: 20px; left: 20px;", panel: "top: 80px; left: 20px;", reserve: 100 };
|
|
260
260
|
case "top-center":
|
|
261
|
-
return { wrap: "top: 20px; left: 50%; transform: translateX(-50%);", panel: "top: 80px; left: 50%; transform: translateX(-50%);" };
|
|
261
|
+
return { wrap: "top: 20px; left: 50%; transform: translateX(-50%);", panel: "top: 80px; left: 50%; transform: translateX(-50%);", reserve: 100 };
|
|
262
262
|
case "top-right":
|
|
263
|
-
return { wrap: "top: 20px; right: 20px;", panel: "top: 80px; right: 20px;" };
|
|
263
|
+
return { wrap: "top: 20px; right: 20px;", panel: "top: 80px; right: 20px;", reserve: 100 };
|
|
264
264
|
case "mid-left":
|
|
265
|
-
return { wrap: "top: 50%; left: 20px; transform: translateY(-50%);", panel: "top: 50%; left: 90px; transform: translateY(-50%);" };
|
|
265
|
+
return { wrap: "top: 50%; left: 20px; transform: translateY(-50%);", panel: "top: 50%; left: 90px; transform: translateY(-50%);", reserve: 40 };
|
|
266
266
|
case "mid-center":
|
|
267
|
-
return { wrap: "top: 50%; left: 50%; transform: translate(-50%, -50%);", panel: "top: 50%; left: 50%; transform: translate(-50%, -50%);" };
|
|
267
|
+
return { wrap: "top: 50%; left: 50%; transform: translate(-50%, -50%);", panel: "top: 50%; left: 50%; transform: translate(-50%, -50%);", reserve: 40 };
|
|
268
268
|
case "mid-right":
|
|
269
|
-
return { wrap: "top: 50%; right: 20px; transform: translateY(-50%);", panel: "top: 50%; right: 90px; transform: translateY(-50%);" };
|
|
269
|
+
return { wrap: "top: 50%; right: 20px; transform: translateY(-50%);", panel: "top: 50%; right: 90px; transform: translateY(-50%);", reserve: 40 };
|
|
270
270
|
case "bottom-left":
|
|
271
|
-
return { wrap: "bottom: 20px; left: 20px;", panel: "bottom: 100px; left: 20px;" };
|
|
271
|
+
return { wrap: "bottom: 20px; left: 20px;", panel: "bottom: 100px; left: 20px;", reserve: 120 };
|
|
272
272
|
case "bottom-center":
|
|
273
|
-
return { wrap: "bottom: 20px; left: 50%; transform: translateX(-50%);", panel: "bottom: 100px; left: 50%; transform: translateX(-50%);" };
|
|
273
|
+
return { wrap: "bottom: 20px; left: 50%; transform: translateX(-50%);", panel: "bottom: 100px; left: 50%; transform: translateX(-50%);", reserve: 120 };
|
|
274
274
|
case "bottom-right":
|
|
275
|
-
return { wrap: "bottom: 20px; right: 20px;", panel: "bottom: 100px; right: 20px;" };
|
|
275
|
+
return { wrap: "bottom: 20px; right: 20px;", panel: "bottom: 100px; right: 20px;", reserve: 120 };
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
+
function panelMaxHeight(reserve) {
|
|
279
|
+
return `max-height: calc(100vh - ${reserve}px); max-height: calc(100dvh - ${reserve}px);`;
|
|
280
|
+
}
|
|
278
281
|
function positionCss(position, mobile) {
|
|
279
282
|
const d = positionRules(position);
|
|
280
283
|
let css = `.oks-access-wrapper { ${d.wrap} }`;
|
|
281
|
-
css += `@media (min-width: 769px) { .oks-access-panel { ${d.panel} } }`;
|
|
284
|
+
css += `@media (min-width: 769px) { .oks-access-panel { ${d.panel} ${panelMaxHeight(d.reserve)} } }`;
|
|
282
285
|
if (mobile && mobile !== position) {
|
|
283
286
|
const m = positionRules(mobile);
|
|
284
287
|
css += `@media (max-width: 768px) { .oks-access-wrapper { top: auto; right: auto; bottom: auto; left: auto; transform: none; ${m.wrap} } }`;
|
|
@@ -307,8 +310,8 @@ var DEFAULT_STATE = Object.freeze({
|
|
|
307
310
|
bigTargets: false
|
|
308
311
|
});
|
|
309
312
|
function loadState(key) {
|
|
310
|
-
if (typeof localStorage === "undefined") return { ...DEFAULT_STATE };
|
|
311
313
|
try {
|
|
314
|
+
if (typeof localStorage === "undefined") return { ...DEFAULT_STATE };
|
|
312
315
|
const raw = localStorage.getItem(key);
|
|
313
316
|
if (!raw) return { ...DEFAULT_STATE };
|
|
314
317
|
const parsed = JSON.parse(raw);
|
|
@@ -319,8 +322,8 @@ function loadState(key) {
|
|
|
319
322
|
}
|
|
320
323
|
}
|
|
321
324
|
function saveState(key, state) {
|
|
322
|
-
if (typeof localStorage === "undefined") return;
|
|
323
325
|
try {
|
|
326
|
+
if (typeof localStorage === "undefined") return;
|
|
324
327
|
const out = {};
|
|
325
328
|
for (const [k, v] of Object.entries(state)) {
|
|
326
329
|
if (typeof v === "number" && v > 0) out[k] = v;
|