@oksigenia/access-panel 0.7.1 → 0.7.3
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 +15 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -15
- package/dist/index.js.map +1 -1
- package/dist/web-component.js +19 -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;
|
|
@@ -1076,6 +1079,7 @@ var PANEL_CSS = `
|
|
|
1076
1079
|
.oks-access-reset { padding: 14px; font-size: 14px; }
|
|
1077
1080
|
}
|
|
1078
1081
|
`;
|
|
1082
|
+
var NOT_ICON_FONT = ':not(.fa, [class*="fa-"], .icon, [class^="icon-"], [class*=" icon-"], .dashicons, [class*="dashicons-"], .material-icons, [class^="material-symbols"], .glyphicon, [class^="bi-"], [class*=" bi-"])';
|
|
1079
1083
|
var EFFECT_CSS = `
|
|
1080
1084
|
html.oks-colorblind-1 { filter: url('#oks-filter-protanopia'); }
|
|
1081
1085
|
html.oks-colorblind-2 { filter: url('#oks-filter-deuteranopia'); }
|
|
@@ -1103,7 +1107,7 @@ body.oks-lh-3 * { line-height: 2.2 !important; }
|
|
|
1103
1107
|
|
|
1104
1108
|
body.oks-a11y-font { font-family: Arial, sans-serif !important; }
|
|
1105
1109
|
|
|
1106
|
-
body.oks-dyslexia
|
|
1110
|
+
body.oks-dyslexia *${NOT_ICON_FONT} {
|
|
1107
1111
|
font-family: 'Comic Sans MS', 'Verdana', sans-serif !important;
|
|
1108
1112
|
letter-spacing: 0.05em !important;
|
|
1109
1113
|
word-spacing: 0.1em !important;
|
|
@@ -1250,9 +1254,9 @@ ${s}.oks-lh-1 * { line-height: 1.6 !important; }
|
|
|
1250
1254
|
${s}.oks-lh-2 * { line-height: 1.9 !important; }
|
|
1251
1255
|
${s}.oks-lh-3 * { line-height: 2.2 !important; }
|
|
1252
1256
|
|
|
1253
|
-
${s}.oks-a11y-font, ${s}.oks-a11y-font
|
|
1257
|
+
${s}.oks-a11y-font, ${s}.oks-a11y-font *${NOT_ICON_FONT} { font-family: Arial, sans-serif !important; }
|
|
1254
1258
|
|
|
1255
|
-
${s}.oks-dyslexia
|
|
1259
|
+
${s}.oks-dyslexia *${NOT_ICON_FONT} {
|
|
1256
1260
|
font-family: 'Comic Sans MS', 'Verdana', sans-serif !important;
|
|
1257
1261
|
letter-spacing: 0.05em !important;
|
|
1258
1262
|
word-spacing: 0.1em !important;
|