accessify-widget 0.3.16 → 0.3.17

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.
@@ -1,4 +1,4 @@
1
- import { d, i } from "./index-DISuvl6x.js";
1
+ import { d, i } from "./index-DLZwODEh.js";
2
2
  export {
3
3
  d as destroy,
4
4
  i as init
@@ -6439,14 +6439,14 @@ function FeatureGrid($$anchor, $$props) {
6439
6439
  const FEATURE_LOADERS = {
6440
6440
  contrast: () => import("./contrast-CqsICAkU.js"),
6441
6441
  "text-size": () => import("./text-size-m_mHNPWo.js"),
6442
- "keyboard-nav": () => import("./keyboard-nav-CQ6IoNn_.js"),
6442
+ "keyboard-nav": () => import("./keyboard-nav-BDDg0iCG.js"),
6443
6443
  "link-highlight": () => import("./link-highlight-DBGm067Y.js"),
6444
6444
  "reading-guide": () => import("./reading-guide-VT8NciIL.js"),
6445
6445
  "reading-mask": () => import("./reading-mask-BABChuCz.js"),
6446
6446
  "animation-stop": () => import("./animation-stop-C0MwseK0.js"),
6447
6447
  "hide-images": () => import("./hide-images-B_LeCBcd.js"),
6448
6448
  "big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
6449
- "page-structure": () => import("./page-structure-DOlGisQu.js"),
6449
+ "page-structure": () => import("./page-structure-B52JJvs9.js"),
6450
6450
  tts: () => import("./tts-CjszLRnb.js"),
6451
6451
  "text-simplify": () => import("./text-simplify-Cvhpio7g.js"),
6452
6452
  "alt-text": () => Promise.resolve().then(() => altText)
@@ -8209,31 +8209,17 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8209
8209
  target.setAttribute(BADGE_ATTR, "1");
8210
8210
  const isImg = target.tagName === "IMG";
8211
8211
  let anchor;
8212
+ let badgeTop = "6px";
8213
+ let badgeLeft = "6px";
8212
8214
  if (isImg) {
8213
- let container = target.parentElement;
8214
- while (container && container !== document.body) {
8215
- const cs = getComputedStyle(container);
8216
- if (cs.overflow === "hidden" && cs.position !== "static") {
8217
- break;
8218
- }
8219
- container = container.parentElement;
8220
- }
8221
- if (container && container !== document.body && container !== target.parentElement) {
8222
- const pos = getComputedStyle(container).position;
8223
- if (pos === "static") container.style.position = "relative";
8224
- anchor = container;
8225
- } else {
8226
- const wrapper = document.createElement("span");
8227
- wrapper.setAttribute(WRAPPER_ATTR, "1");
8228
- Object.assign(wrapper.style, {
8229
- position: "relative",
8230
- display: "inline-block",
8231
- lineHeight: "0"
8232
- });
8233
- target.parentElement.insertBefore(wrapper, target);
8234
- wrapper.appendChild(target);
8235
- anchor = wrapper;
8236
- }
8215
+ const parent = target.parentElement;
8216
+ if (!parent) return;
8217
+ const parentPos = getComputedStyle(parent).position;
8218
+ if (parentPos === "static") parent.style.position = "relative";
8219
+ anchor = parent;
8220
+ const imgEl = target;
8221
+ badgeTop = `${imgEl.offsetTop + 6}px`;
8222
+ badgeLeft = `${imgEl.offsetLeft + 6}px`;
8237
8223
  } else {
8238
8224
  const pos = getComputedStyle(target).position;
8239
8225
  if (pos === "static") target.style.position = "relative";
@@ -8242,8 +8228,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8242
8228
  const badge = document.createElement("span");
8243
8229
  Object.assign(badge.style, {
8244
8230
  position: "absolute",
8245
- top: "6px",
8246
- left: "6px",
8231
+ top: badgeTop,
8232
+ left: badgeLeft,
8247
8233
  width: "22px",
8248
8234
  height: "22px",
8249
8235
  borderRadius: "50%",
@@ -8269,8 +8255,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8269
8255
  Object.assign(tooltip.style, {
8270
8256
  display: "none",
8271
8257
  position: "absolute",
8272
- top: "32px",
8273
- left: "6px",
8258
+ top: `calc(${badgeTop} + 26px)`,
8259
+ left: badgeLeft,
8274
8260
  minWidth: "150px",
8275
8261
  maxWidth: "280px",
8276
8262
  padding: "6px 10px",
@@ -8301,6 +8287,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8301
8287
  anchor.appendChild(tooltip);
8302
8288
  }
8303
8289
  function removeAllBadges() {
8290
+ document.querySelectorAll(`[${BADGE_ATTR}="badge"], [${BADGE_ATTR}="tooltip"]`).forEach((el) => el.remove());
8291
+ document.querySelectorAll(`[${BADGE_ATTR}]`).forEach((el) => el.removeAttribute(BADGE_ATTR));
8304
8292
  document.querySelectorAll(`[${WRAPPER_ATTR}]`).forEach((wrapper) => {
8305
8293
  const img = wrapper.querySelector("img");
8306
8294
  if (img && wrapper.parentElement) {
@@ -8308,8 +8296,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8308
8296
  wrapper.remove();
8309
8297
  }
8310
8298
  });
8311
- document.querySelectorAll(`[${BADGE_ATTR}="badge"], [${BADGE_ATTR}="tooltip"]`).forEach((el) => el.remove());
8312
- document.querySelectorAll(`[${BADGE_ATTR}]`).forEach((el) => el.removeAttribute(BADGE_ATTR));
8313
8299
  }
8314
8300
  function addBadgesToAllImages() {
8315
8301
  document.querySelectorAll("img").forEach((img) => {
@@ -8754,4 +8740,4 @@ export {
8754
8740
  init as i,
8755
8741
  t
8756
8742
  };
8757
- //# sourceMappingURL=index-DISuvl6x.js.map
8743
+ //# sourceMappingURL=index-DLZwODEh.js.map