accessify-widget 0.3.15 → 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-5qbCfZ0S.js";
1
+ import { d, i } from "./index-DLZwODEh.js";
2
2
  export {
3
3
  d as destroy,
4
4
  i as init
@@ -6004,10 +6004,9 @@ const PROFILES = [
6004
6004
  features: ["animation-stop", "reading-mask", "hide-images"]
6005
6005
  }
6006
6006
  ];
6007
- var root_3$2 = /* @__PURE__ */ from_svg(`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"></path></svg>`);
6008
- var root_2$2 = /* @__PURE__ */ from_html(`<button class="accessify-accordion-option"><span class="accessify-accordion-option-left"><span class="accessify-accordion-option-icon" aria-hidden="true"></span> <span class="accessify-accordion-option-text"><span class="accessify-accordion-option-name"> </span> <span class="accessify-accordion-option-desc"> </span></span></span> <!></button>`);
6009
- var root_1$3 = /* @__PURE__ */ from_html(`<div class="accessify-accordion-list" role="group"></div>`);
6010
- var root$3 = /* @__PURE__ */ from_html(`<div class="accessify-accordion" role="region"><button class="accessify-accordion-toggle"><span class="accessify-accordion-toggle-left"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M12 8v4l2 2"></path></svg> <span> </span></span> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg></button> <!></div>`);
6007
+ var root_2$2 = /* @__PURE__ */ from_svg(`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"></path></svg>`);
6008
+ var root_1$3 = /* @__PURE__ */ from_html(`<button class="accessify-accordion-option"><span class="accessify-accordion-option-left"><span class="accessify-accordion-option-icon" aria-hidden="true"></span> <span class="accessify-accordion-option-text"><span class="accessify-accordion-option-name"> </span> <span class="accessify-accordion-option-desc"> </span></span></span> <!></button>`);
6009
+ var root$3 = /* @__PURE__ */ from_html(`<div class="accessify-accordion" role="region"><button class="accessify-accordion-toggle"><span class="accessify-accordion-toggle-left"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M12 8v4l2 2"></path></svg> <span> </span></span> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg></button> <div class="accessify-accordion-list" role="group"></div></div>`);
6011
6010
  function ProfileSection($$anchor, $$props) {
6012
6011
  push($$props, true);
6013
6012
  let lang = prop($$props, "lang", 3, "en"), activeProfileId = prop($$props, "activeProfileId", 3, null);
@@ -6024,62 +6023,55 @@ function ProfileSection($$anchor, $$props) {
6024
6023
  var text = child(span_1);
6025
6024
  var svg = sibling(span, 2);
6026
6025
  let classes;
6027
- var node = sibling(button, 2);
6028
- {
6029
- var consequent_1 = ($$anchor2) => {
6030
- var div_1 = root_1$3();
6031
- each(div_1, 21, () => PROFILES, (profile) => profile.id, ($$anchor3, profile) => {
6032
- var button_1 = root_2$2();
6033
- var span_2 = child(button_1);
6034
- var span_3 = child(span_2);
6035
- html(span_3, () => getIcon(get(profile).iconId), true);
6036
- var span_4 = sibling(span_3, 2);
6037
- var span_5 = child(span_4);
6038
- var text_1 = child(span_5);
6039
- var span_6 = sibling(span_5, 2);
6040
- var text_2 = child(span_6);
6041
- var node_1 = sibling(span_2, 2);
6042
- {
6043
- var consequent = ($$anchor4) => {
6044
- var svg_1 = root_3$2();
6045
- append($$anchor4, svg_1);
6046
- };
6047
- if_block(node_1, ($$render) => {
6048
- if (activeProfileId() === get(profile).id) $$render(consequent);
6049
- });
6050
- }
6051
- template_effect(
6052
- ($0, $1) => {
6053
- set_attribute(button_1, "aria-pressed", activeProfileId() === get(profile).id);
6054
- set_attribute(button_1, "data-active", activeProfileId() === get(profile).id);
6055
- set_text(text_1, $0);
6056
- set_text(text_2, $1);
6057
- },
6058
- [
6059
- () => t(get(profile).nameKey, lang()),
6060
- () => t(get(profile).descKey, lang())
6061
- ]
6062
- );
6063
- delegated("click", button_1, () => $$props.onactivate(get(profile)));
6064
- append($$anchor3, button_1);
6026
+ var div_1 = sibling(button, 2);
6027
+ each(div_1, 21, () => PROFILES, (profile) => profile.id, ($$anchor2, profile) => {
6028
+ var button_1 = root_1$3();
6029
+ var span_2 = child(button_1);
6030
+ var span_3 = child(span_2);
6031
+ html(span_3, () => getIcon(get(profile).iconId), true);
6032
+ var span_4 = sibling(span_3, 2);
6033
+ var span_5 = child(span_4);
6034
+ var text_1 = child(span_5);
6035
+ var span_6 = sibling(span_5, 2);
6036
+ var text_2 = child(span_6);
6037
+ var node = sibling(span_2, 2);
6038
+ {
6039
+ var consequent = ($$anchor3) => {
6040
+ var svg_1 = root_2$2();
6041
+ append($$anchor3, svg_1);
6042
+ };
6043
+ if_block(node, ($$render) => {
6044
+ if (activeProfileId() === get(profile).id) $$render(consequent);
6065
6045
  });
6066
- template_effect(($0) => set_attribute(div_1, "aria-label", $0), [() => t("section.profiles", lang())]);
6067
- append($$anchor2, div_1);
6068
- };
6069
- if_block(node, ($$render) => {
6070
- if (get(isOpen)) $$render(consequent_1);
6071
- });
6072
- }
6046
+ }
6047
+ template_effect(
6048
+ ($0, $1) => {
6049
+ set_attribute(button_1, "aria-pressed", activeProfileId() === get(profile).id);
6050
+ set_attribute(button_1, "data-active", activeProfileId() === get(profile).id);
6051
+ set_text(text_1, $0);
6052
+ set_text(text_2, $1);
6053
+ },
6054
+ [
6055
+ () => t(get(profile).nameKey, lang()),
6056
+ () => t(get(profile).descKey, lang())
6057
+ ]
6058
+ );
6059
+ delegated("click", button_1, () => $$props.onactivate(get(profile)));
6060
+ append($$anchor2, button_1);
6061
+ });
6073
6062
  template_effect(
6074
- ($0, $1) => {
6063
+ ($0, $1, $2) => {
6075
6064
  set_attribute(div, "aria-label", $0);
6076
6065
  set_attribute(button, "aria-expanded", get(isOpen));
6077
6066
  set_text(text, $1);
6078
6067
  classes = set_class(svg, 0, "accessify-accordion-chevron", null, classes, { "accessify-accordion-chevron--open": get(isOpen) });
6068
+ set_attribute(div_1, "aria-label", $2);
6069
+ set_style(div_1, get(isOpen) ? "" : "display:none");
6079
6070
  },
6080
6071
  [
6081
6072
  () => t("section.profiles", lang()),
6082
- () => get(activeProfile) ? t(get(activeProfile).nameKey, lang()) : t("section.profiles", lang())
6073
+ () => get(activeProfile) ? t(get(activeProfile).nameKey, lang()) : t("section.profiles", lang()),
6074
+ () => t("section.profiles", lang())
6083
6075
  ]
6084
6076
  );
6085
6077
  delegated("click", button, () => {
@@ -6447,14 +6439,14 @@ function FeatureGrid($$anchor, $$props) {
6447
6439
  const FEATURE_LOADERS = {
6448
6440
  contrast: () => import("./contrast-CqsICAkU.js"),
6449
6441
  "text-size": () => import("./text-size-m_mHNPWo.js"),
6450
- "keyboard-nav": () => import("./keyboard-nav-CVsH7KMx.js"),
6442
+ "keyboard-nav": () => import("./keyboard-nav-BDDg0iCG.js"),
6451
6443
  "link-highlight": () => import("./link-highlight-DBGm067Y.js"),
6452
6444
  "reading-guide": () => import("./reading-guide-VT8NciIL.js"),
6453
6445
  "reading-mask": () => import("./reading-mask-BABChuCz.js"),
6454
6446
  "animation-stop": () => import("./animation-stop-C0MwseK0.js"),
6455
6447
  "hide-images": () => import("./hide-images-B_LeCBcd.js"),
6456
6448
  "big-cursor": () => import("./big-cursor-B2UKu9dQ.js"),
6457
- "page-structure": () => import("./page-structure-aKtVG7q2.js"),
6449
+ "page-structure": () => import("./page-structure-B52JJvs9.js"),
6458
6450
  tts: () => import("./tts-CjszLRnb.js"),
6459
6451
  "text-simplify": () => import("./text-simplify-Cvhpio7g.js"),
6460
6452
  "alt-text": () => Promise.resolve().then(() => altText)
@@ -8217,31 +8209,17 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8217
8209
  target.setAttribute(BADGE_ATTR, "1");
8218
8210
  const isImg = target.tagName === "IMG";
8219
8211
  let anchor;
8212
+ let badgeTop = "6px";
8213
+ let badgeLeft = "6px";
8220
8214
  if (isImg) {
8221
- let container = target.parentElement;
8222
- while (container && container !== document.body) {
8223
- const cs = getComputedStyle(container);
8224
- if (cs.overflow === "hidden" && cs.position !== "static") {
8225
- break;
8226
- }
8227
- container = container.parentElement;
8228
- }
8229
- if (container && container !== document.body && container !== target.parentElement) {
8230
- const pos = getComputedStyle(container).position;
8231
- if (pos === "static") container.style.position = "relative";
8232
- anchor = container;
8233
- } else {
8234
- const wrapper = document.createElement("span");
8235
- wrapper.setAttribute(WRAPPER_ATTR, "1");
8236
- Object.assign(wrapper.style, {
8237
- position: "relative",
8238
- display: "inline-block",
8239
- lineHeight: "0"
8240
- });
8241
- target.parentElement.insertBefore(wrapper, target);
8242
- wrapper.appendChild(target);
8243
- anchor = wrapper;
8244
- }
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`;
8245
8223
  } else {
8246
8224
  const pos = getComputedStyle(target).position;
8247
8225
  if (pos === "static") target.style.position = "relative";
@@ -8250,8 +8228,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8250
8228
  const badge = document.createElement("span");
8251
8229
  Object.assign(badge.style, {
8252
8230
  position: "absolute",
8253
- top: "6px",
8254
- left: "6px",
8231
+ top: badgeTop,
8232
+ left: badgeLeft,
8255
8233
  width: "22px",
8256
8234
  height: "22px",
8257
8235
  borderRadius: "50%",
@@ -8270,13 +8248,15 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8270
8248
  });
8271
8249
  badge.textContent = "i";
8272
8250
  badge.setAttribute("aria-hidden", "true");
8251
+ badge.setAttribute("translate", "no");
8252
+ badge.classList.add("notranslate");
8273
8253
  badge.setAttribute(BADGE_ATTR, "badge");
8274
8254
  const tooltip = document.createElement("span");
8275
8255
  Object.assign(tooltip.style, {
8276
8256
  display: "none",
8277
8257
  position: "absolute",
8278
- top: "32px",
8279
- left: "6px",
8258
+ top: `calc(${badgeTop} + 26px)`,
8259
+ left: badgeLeft,
8280
8260
  minWidth: "150px",
8281
8261
  maxWidth: "280px",
8282
8262
  padding: "6px 10px",
@@ -8292,6 +8272,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8292
8272
  boxShadow: "0 2px 8px rgba(0,0,0,0.3)"
8293
8273
  });
8294
8274
  tooltip.textContent = altText2;
8275
+ tooltip.setAttribute("translate", "no");
8276
+ tooltip.classList.add("notranslate");
8295
8277
  tooltip.setAttribute(BADGE_ATTR, "tooltip");
8296
8278
  badge.addEventListener("mouseenter", () => {
8297
8279
  badge.style.background = "rgba(0,0,0,0.85)";
@@ -8305,6 +8287,8 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8305
8287
  anchor.appendChild(tooltip);
8306
8288
  }
8307
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));
8308
8292
  document.querySelectorAll(`[${WRAPPER_ATTR}]`).forEach((wrapper) => {
8309
8293
  const img = wrapper.querySelector("img");
8310
8294
  if (img && wrapper.parentElement) {
@@ -8312,8 +8296,6 @@ function createAltTextModule(aiService, initialLang = "de", serverConfig) {
8312
8296
  wrapper.remove();
8313
8297
  }
8314
8298
  });
8315
- document.querySelectorAll(`[${BADGE_ATTR}="badge"], [${BADGE_ATTR}="tooltip"]`).forEach((el) => el.remove());
8316
- document.querySelectorAll(`[${BADGE_ATTR}]`).forEach((el) => el.removeAttribute(BADGE_ATTR));
8317
8299
  }
8318
8300
  function addBadgesToAllImages() {
8319
8301
  document.querySelectorAll("img").forEach((img) => {
@@ -8758,4 +8740,4 @@ export {
8758
8740
  init as i,
8759
8741
  t
8760
8742
  };
8761
- //# sourceMappingURL=index-5qbCfZ0S.js.map
8743
+ //# sourceMappingURL=index-DLZwODEh.js.map