@20minutes/hela 2.2.8 → 2.3.1

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,6 +1,6 @@
1
1
  var Lt = Object.defineProperty;
2
2
  var Et = (s, t, e) => t in s ? Lt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var C = (s, t, e) => Et(s, typeof t != "symbol" ? t + "" : t, e);
3
+ var T = (s, t, e) => Et(s, typeof t != "symbol" ? t + "" : t, e);
4
4
  const Pt = () => {
5
5
  const s = document.querySelector("#js-election-selector");
6
6
  s && s.addEventListener("change", (t) => {
@@ -405,18 +405,18 @@ const Xt = (s) => s.matches("details:not([open]) *") && !s.matches("details>summ
405
405
  function Yt(s) {
406
406
  return s.shadowRoot && s.getAttribute("tabindex") === "-1" ? !1 : !s.matches(":disabled,[hidden],[inert]");
407
407
  }
408
- function B(s = document) {
408
+ function F(s = document) {
409
409
  const t = s.activeElement;
410
- return t ? t.shadowRoot ? B(t.shadowRoot) || document.activeElement : t : null;
410
+ return t ? t.shadowRoot ? F(t.shadowRoot) || document.activeElement : t : null;
411
411
  }
412
412
  function Qt(s, t) {
413
413
  const [e, i] = Kt(s);
414
414
  if (!e)
415
415
  return t.preventDefault();
416
- const n = B();
416
+ const n = F();
417
417
  t.shiftKey && n === e ? (i.focus(), t.preventDefault()) : !t.shiftKey && n === i && (e.focus(), t.preventDefault());
418
418
  }
419
- function T(s, t) {
419
+ function C(s, t) {
420
420
  function e(i) {
421
421
  return !i || i === document || i === window ? null : (i.assignedSlot && (i = i.assignedSlot), i.closest(s) || e(i.getRootNode().host));
422
422
  }
@@ -425,10 +425,10 @@ function T(s, t) {
425
425
  const z = "data-a11y-dialog";
426
426
  class ut {
427
427
  constructor(t) {
428
- C(this, "$el");
429
- C(this, "id");
430
- C(this, "previouslyFocused");
431
- C(this, "shown");
428
+ T(this, "$el");
429
+ T(this, "id");
430
+ T(this, "previouslyFocused");
431
+ T(this, "shown");
432
432
  this.$el = t, this.id = this.$el.getAttribute(z) || this.$el.id, this.previouslyFocused = null, this.shown = !1, this.maintainFocus = this.maintainFocus.bind(this), this.bindKeypress = this.bindKeypress.bind(this), this.handleTriggerClicks = this.handleTriggerClicks.bind(this), this.show = this.show.bind(this), this.hide = this.hide.bind(this), this.$el.setAttribute("aria-hidden", "true"), this.$el.setAttribute("aria-modal", "true"), this.$el.setAttribute("tabindex", "-1"), this.$el.hasAttribute("role") || this.$el.setAttribute("role", "dialog"), document.addEventListener("click", this.handleTriggerClicks, !0);
433
433
  }
434
434
  /**
@@ -444,7 +444,7 @@ class ut {
444
444
  */
445
445
  show(t) {
446
446
  var i;
447
- return this.shown ? this : this.fire("show", t).defaultPrevented ? this : (this.shown = !0, this.$el.removeAttribute("aria-hidden"), this.previouslyFocused = B(), ((i = this.previouslyFocused) == null ? void 0 : i.tagName) === "BODY" && (t != null && t.target) && (this.previouslyFocused = t.target), (t == null ? void 0 : t.type) === "focus" ? this.maintainFocus(t) : X(this.$el), document.body.addEventListener("focus", this.maintainFocus, !0), this.$el.addEventListener("keydown", this.bindKeypress, !0), this);
447
+ return this.shown ? this : this.fire("show", t).defaultPrevented ? this : (this.shown = !0, this.$el.removeAttribute("aria-hidden"), this.previouslyFocused = F(), ((i = this.previouslyFocused) == null ? void 0 : i.tagName) === "BODY" && (t != null && t.target) && (this.previouslyFocused = t.target), (t == null ? void 0 : t.type) === "focus" ? this.maintainFocus() : X(this.$el), document.body.addEventListener("focus", this.maintainFocus, !0), this.$el.addEventListener("keydown", this.bindKeypress, !0), this);
448
448
  }
449
449
  /**
450
450
  * Hide the dialog element, restore the focus to the previously active
@@ -484,7 +484,7 @@ class ut {
484
484
  * dialog are clicked, and call `show` or `hide`, respectively
485
485
  */
486
486
  handleTriggerClicks(t) {
487
- const e = t.composedPath()[0], i = T(`[${z}-show="${this.id}"]`, e), n = T(`[${z}-hide="${this.id}"]`, e), o = T(`[${z}-hide]`, e) && T('[aria-modal="true"]', e) === this.$el;
487
+ const e = t.composedPath()[0], i = C(`[${z}-show="${this.id}"]`, e), n = C(`[${z}-hide="${this.id}"]`, e), o = C(`[${z}-hide]`, e) && C('[aria-modal="true"]', e) === this.$el;
488
488
  i && this.show(t), (n || o) && this.hide(t);
489
489
  }
490
490
  /**
@@ -492,7 +492,7 @@ class ut {
492
492
  * (namely ESC and TAB)
493
493
  */
494
494
  bindKeypress(t) {
495
- if (T('[aria-modal="true"]', B()) !== this.$el)
495
+ if (C('[aria-modal="true"]', F()) !== this.$el)
496
496
  return;
497
497
  let e = !1;
498
498
  try {
@@ -503,12 +503,13 @@ class ut {
503
503
  }
504
504
  /**
505
505
  * If the dialog is shown and the focus is not within a dialog element (either
506
- * this one or another one in case of nested dialogs) or attribute, move it
507
- * back to the dialog container
506
+ * this one or another one in case of nested dialogs) or an element with the
507
+ * ignore attribute, move it back to the dialog container
508
508
  * See: https://github.com/KittyGiraudel/a11y-dialog/issues/177
509
509
  */
510
- maintainFocus(t) {
511
- t.target.closest(`[aria-modal="true"], [${z}-ignore-focus-trap]`) || X(this.$el);
510
+ maintainFocus() {
511
+ const t = F();
512
+ C(`[aria-modal="true"], [${z}-ignore-focus-trap]`, t) || X(this.$el);
512
513
  }
513
514
  }
514
515
  function tt() {
@@ -715,18 +716,18 @@ function W(s, t) {
715
716
  const e = Math.abs(s.x - t.x), i = Math.abs(s.y - t.y);
716
717
  return Math.sqrt(e * e + i * i);
717
718
  }
718
- function F(s, t) {
719
+ function R(s, t) {
719
720
  return s.x === t.x && s.y === t.y;
720
721
  }
721
- function k(s, t, e) {
722
+ function q(s, t, e) {
722
723
  return Math.min(Math.max(s, t), e);
723
724
  }
724
- function R(s, t, e) {
725
+ function k(s, t, e) {
725
726
  let i = `translate3d(${s}px,${t || 0}px,0)`;
726
727
  return e !== void 0 && (i += ` scale3d(${e},${e},1)`), i;
727
728
  }
728
729
  function I(s, t, e, i) {
729
- s.style.transform = R(t, e, i);
730
+ s.style.transform = k(t, e, i);
730
731
  }
731
732
  const re = "cubic-bezier(.4,0,.22,1)";
732
733
  function ft(s, t, e, i) {
@@ -927,7 +928,7 @@ class ue {
927
928
  * @returns {number}
928
929
  */
929
930
  correctPan(t, e) {
930
- return k(e, this.max[t], this.min[t]);
931
+ return q(e, this.max[t], this.min[t]);
931
932
  }
932
933
  }
933
934
  const it = 4e3;
@@ -1152,7 +1153,7 @@ class pe {
1152
1153
  transitionDuration: i
1153
1154
  }), o.animations.stopAllPan();
1154
1155
  const r = this.currZoomLevel;
1155
- n || (t = k(t, this.zoomLevels.min, this.zoomLevels.max)), this.setZoomLevel(t), this.pan.x = this.calculateZoomToPanOffset("x", e, r), this.pan.y = this.calculateZoomToPanOffset("y", e, r), pt(this.pan);
1156
+ n || (t = q(t, this.zoomLevels.min, this.zoomLevels.max)), this.setZoomLevel(t), this.pan.x = this.calculateZoomToPanOffset("x", e, r), this.pan.y = this.calculateZoomToPanOffset("y", e, r), pt(this.pan);
1156
1157
  const a = () => {
1157
1158
  this._setResolution(t), this.applyCurrentZoomPan();
1158
1159
  };
@@ -1260,7 +1261,7 @@ class pe {
1260
1261
  /** @returns {string} */
1261
1262
  getCurrentTransform() {
1262
1263
  const t = this.currZoomLevel / (this.currentResolution || this.zoomLevels.initial);
1263
- return R(this.pan.x, this.pan.y, t);
1264
+ return k(this.pan.x, this.pan.y, t);
1264
1265
  }
1265
1266
  /**
1266
1267
  * Set resolution and re-render the image.
@@ -1369,7 +1370,7 @@ class ve {
1369
1370
  onUpdate: (u) => {
1370
1371
  if (a && this.pswp.bgOpacity < 1) {
1371
1372
  const f = 1 - (c - u) / g;
1372
- this.pswp.applyBgOpacity(k(p + (1 - p) * f, 0, 1));
1373
+ this.pswp.applyBgOpacity(q(p + (1 - p) * f, 0, 1));
1373
1374
  }
1374
1375
  n[t] = Math.floor(u), i.applyCurrentZoomPan();
1375
1376
  }
@@ -1574,7 +1575,7 @@ class be {
1574
1575
  x: i.bounds.correctPan("x", c.x),
1575
1576
  y: i.bounds.correctPan("y", c.y)
1576
1577
  }, i.setZoomLevel(n);
1577
- const d = !F(c, h);
1578
+ const d = !R(c, h);
1578
1579
  if (!d && !r && !l) {
1579
1580
  i._setResolution(o), i.applyCurrentZoomPan();
1580
1581
  return;
@@ -1594,7 +1595,7 @@ class be {
1594
1595
  }
1595
1596
  i.applyCurrentZoomPan();
1596
1597
  }
1597
- l && e.bgOpacity < 1 && e.applyBgOpacity(k(a + (1 - a) * p, 0, 1));
1598
+ l && e.bgOpacity < 1 && e.applyBgOpacity(q(a + (1 - a) * p, 0, 1));
1598
1599
  },
1599
1600
  onComplete: () => {
1600
1601
  i._setResolution(o), i.applyCurrentZoomPan();
@@ -1803,7 +1804,7 @@ class xe {
1803
1804
  * @private
1804
1805
  */
1805
1806
  _rafRenderLoop() {
1806
- (this.isDragging || this.isZooming) && (this._updateVelocity(), this.isDragging ? F(this.p1, this.prevP1) || this.drag.change() : (!F(this.p1, this.prevP1) || !F(this.p2, this.prevP2)) && this.zoomLevels.change(), this._updatePrevPoints(), this.raf = requestAnimationFrame(this._rafRenderLoop.bind(this)));
1807
+ (this.isDragging || this.isZooming) && (this._updateVelocity(), this.isDragging ? R(this.p1, this.prevP1) || this.drag.change() : (!R(this.p1, this.prevP1) || !R(this.p2, this.prevP2)) && this.zoomLevels.change(), this._updatePrevPoints(), this.raf = requestAnimationFrame(this._rafRenderLoop.bind(this)));
1807
1808
  }
1808
1809
  /**
1809
1810
  * Update velocity at 50ms interval
@@ -2791,7 +2792,7 @@ let Qe = class {
2791
2792
  * @param {number} height
2792
2793
  */
2793
2794
  setDisplayedSize(t, e) {
2794
- this.element && (this.element.tagName === "IMG" ? (V(this.element, 250, "auto"), this.element.style.transformOrigin = "0 0", this.element.style.transform = R(0, 0, t / 250)) : V(this.element, t, e));
2795
+ this.element && (this.element.tagName === "IMG" ? (V(this.element, 250, "auto"), this.element.style.transformOrigin = "0 0", this.element.style.transform = k(0, 0, t / 250)) : V(this.element, t, e));
2795
2796
  }
2796
2797
  destroy() {
2797
2798
  var t;
@@ -3349,7 +3350,7 @@ class ri {
3349
3350
  } = e;
3350
3351
  if (this._croppedZoom && i && this._cropContainer1 && this._cropContainer2) {
3351
3352
  const r = -o.x + (this._thumbBounds.x - i.x) + i.w, a = -o.y + (this._thumbBounds.y - i.y) + i.h, l = o.x - i.w, h = o.y - i.h;
3352
- t ? (this._animateTo(this._cropContainer1, "transform", R(r, a)), this._animateTo(this._cropContainer2, "transform", R(l, h))) : (I(this._cropContainer1, r, a), I(this._cropContainer2, l, h));
3353
+ t ? (this._animateTo(this._cropContainer1, "transform", k(r, a)), this._animateTo(this._cropContainer2, "transform", k(l, h))) : (I(this._cropContainer1, r, a), I(this._cropContainer2, l, h));
3353
3354
  }
3354
3355
  n && (_(n.pan, i || this._thumbBounds), n.currZoomLevel = this._thumbBounds.w / n.width, t ? this._animateTo(n.container, "transform", n.getCurrentTransform()) : n.applyCurrentZoomPan());
3355
3356
  }
@@ -3446,7 +3447,7 @@ class li extends oi {
3446
3447
  */
3447
3448
  getLoopedIndex(t) {
3448
3449
  const e = this.getNumItems();
3449
- return this.options.loop && (t > e - 1 && (t -= e), t < 0 && (t += e)), k(t, 0, e - 1);
3450
+ return this.options.loop && (t > e - 1 && (t -= e), t < 0 && (t += e)), q(t, 0, e - 1);
3450
3451
  }
3451
3452
  appendHeavy() {
3452
3453
  this.mainScroll.itemHolders.forEach((t) => {
@@ -3564,7 +3565,7 @@ class li extends oi {
3564
3565
  if (this.isDestroying)
3565
3566
  return;
3566
3567
  const e = gt(this.options, this);
3567
- !t && F(e, this._prevViewportSize) || (_(this._prevViewportSize, e), this.dispatch("beforeResize"), _(this.viewportSize, this._prevViewportSize), this._updatePageScrollOffset(), this.dispatch("viewportSize"), this.mainScroll.resize(this.opener.isOpen), !this.hasMouse && window.matchMedia("(any-hover: hover)").matches && this.mouseDetected(), this.dispatch("resize"));
3568
+ !t && R(e, this._prevViewportSize) || (_(this._prevViewportSize, e), this.dispatch("beforeResize"), _(this.viewportSize, this._prevViewportSize), this._updatePageScrollOffset(), this.dispatch("viewportSize"), this.mainScroll.resize(this.opener.isOpen), !this.hasMouse && window.matchMedia("(any-hover: hover)").matches && this.mouseDetected(), this.dispatch("resize"));
3568
3569
  }
3569
3570
  /**
3570
3571
  * @param {number} opacity
@@ -4062,7 +4063,7 @@ function gi(s, t) {
4062
4063
  y: window.innerHeight
4063
4064
  };
4064
4065
  }
4065
- function q(s, t, e, i, n) {
4066
+ function N(s, t, e, i, n) {
4066
4067
  let o = 0;
4067
4068
  if (t.paddingFn)
4068
4069
  o = t.paddingFn(e, i, n)[s];
@@ -4076,8 +4077,8 @@ function q(s, t, e, i, n) {
4076
4077
  }
4077
4078
  function _i(s, t, e, i) {
4078
4079
  return {
4079
- x: t.x - q("left", s, t, e, i) - q("right", s, t, e, i),
4080
- y: t.y - q("top", s, t, e, i) - q("bottom", s, t, e, i)
4080
+ x: t.x - N("left", s, t, e, i) - N("right", s, t, e, i),
4081
+ y: t.y - N("top", s, t, e, i) - N("bottom", s, t, e, i)
4081
4082
  };
4082
4083
  }
4083
4084
  const at = 4e3;
@@ -4506,7 +4507,7 @@ const bi = () => {
4506
4507
  }, ht = () => {
4507
4508
  const s = document.querySelector(`${U}`);
4508
4509
  s && s.classList.remove(bt);
4509
- }, N = ({ type: s }) => {
4510
+ }, B = ({ type: s }) => {
4510
4511
  const t = window.getSelection();
4511
4512
  if (s === "selectionchange") {
4512
4513
  ht();
@@ -4526,7 +4527,7 @@ const bi = () => {
4526
4527
  console.warn("Selection API isn't supported");
4527
4528
  return;
4528
4529
  }
4529
- document.addEventListener("mouseup", N), document.addEventListener("selectionchange", N), document.addEventListener("touchend", N), document.addEventListener("touchcancel", N);
4530
+ document.addEventListener("mouseup", B), document.addEventListener("selectionchange", B), document.addEventListener("touchend", B), document.addEventListener("touchcancel", B);
4530
4531
  }, zi = (s) => {
4531
4532
  const { target: t } = s;
4532
4533
  if (t instanceof Element) {