@oksigenia/access-panel 0.7.0 → 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 +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/dist/web-component.js +26 -15
- 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;
|
|
@@ -902,6 +905,7 @@ var PANEL_CSS = `
|
|
|
902
905
|
}
|
|
903
906
|
.oks-access-panel.is-open { opacity: 1; pointer-events: all; }
|
|
904
907
|
.oks-access-header {
|
|
908
|
+
flex: 0 0 auto;
|
|
905
909
|
padding: 15px 20px;
|
|
906
910
|
border-bottom: 1px solid #eee;
|
|
907
911
|
display: flex;
|
|
@@ -925,7 +929,11 @@ var PANEL_CSS = `
|
|
|
925
929
|
}
|
|
926
930
|
.oks-access-close:hover { background: #e0e0e0; border-color: #ccc; }
|
|
927
931
|
.oks-access-close svg { width: 24px; height: 24px; stroke-width: 2.5px; }
|
|
928
|
-
|
|
932
|
+
/* flex:1 1 auto + min-height:0 lets the content scroll inside the 90vh panel.
|
|
933
|
+
Without min-height:0 a flex child won't shrink below its content, so the
|
|
934
|
+
header (\xD7) and footer (Reset) get pushed off-screen on short viewports or at
|
|
935
|
+
high zoom \u2014 the panel becomes impossible to close. */
|
|
936
|
+
.oks-access-content { flex: 1 1 auto; min-height: 0; padding: 0 20px 20px; overflow-y: auto; }
|
|
929
937
|
.oks-access-title {
|
|
930
938
|
margin: 10px 0 5px;
|
|
931
939
|
font-size: 11px;
|
|
@@ -1026,6 +1034,7 @@ var PANEL_CSS = `
|
|
|
1026
1034
|
.oks-access-opt[data-level="4"] .oks-levels span:nth-child(-n+4) { background: #000; }
|
|
1027
1035
|
.oks-access-opt:hover .oks-levels span { background: #555; }
|
|
1028
1036
|
.oks-access-footer {
|
|
1037
|
+
flex: 0 0 auto;
|
|
1029
1038
|
padding: 12px 20px;
|
|
1030
1039
|
border-top: 1px solid #eee;
|
|
1031
1040
|
text-align: center;
|
|
@@ -1232,12 +1241,14 @@ body.oks-a11y-bigtargets summary:not(oksigenia-access-panel):not(oksigenia-acces
|
|
|
1232
1241
|
}
|
|
1233
1242
|
`;
|
|
1234
1243
|
function scopedEffectCss(s) {
|
|
1235
|
-
|
|
1244
|
+
const isRoot = s === "body" || s === "html" || s === ":root";
|
|
1245
|
+
const zoom = isRoot ? "" : `
|
|
1236
1246
|
${s}.oks-zoom-1 { font-size: 110% !important; }
|
|
1237
1247
|
${s}.oks-zoom-2 { font-size: 120% !important; }
|
|
1238
1248
|
${s}.oks-zoom-3 { font-size: 135% !important; }
|
|
1239
1249
|
${s}.oks-zoom-4 { font-size: 150% !important; }
|
|
1240
|
-
|
|
1250
|
+
`;
|
|
1251
|
+
return `${zoom}
|
|
1241
1252
|
${s}.oks-lh-1 * { line-height: 1.6 !important; }
|
|
1242
1253
|
${s}.oks-lh-2 * { line-height: 1.9 !important; }
|
|
1243
1254
|
${s}.oks-lh-3 * { line-height: 2.2 !important; }
|