@unlk/keymaster 1.6.2 → 1.6.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Unlock Keymaster v1.6.2 (https://keymaster.unlock.com)
2
+ * Unlock Keymaster v1.6.3 (https://keymaster.unlock.com)
3
3
  * Copyright 2022-2026 Unlk Developers
4
4
  */
5
5
  (function (global, factory) {
@@ -7459,7 +7459,7 @@
7459
7459
  }
7460
7460
  }
7461
7461
 
7462
- const NAME$4 = 'datepicker';
7462
+ const NAME$2 = 'datepicker';
7463
7463
  const DATA_KEY = 'bs.datepicker';
7464
7464
  const EVENT_KEY = `.${DATA_KEY}`;
7465
7465
  const DATA_API_KEY = '.data-api';
@@ -7468,7 +7468,7 @@
7468
7468
  class Datepicker extends BaseComponent {
7469
7469
  // Getters
7470
7470
  static get NAME() {
7471
- return NAME$4;
7471
+ return NAME$2;
7472
7472
  }
7473
7473
 
7474
7474
  // Static
@@ -7610,50 +7610,52 @@
7610
7610
  }
7611
7611
  };
7612
7612
 
7613
- const NAME$3 = 'carouselCaption';
7614
7613
  const EVENT_SLID$1 = 'slid.bs.carousel';
7615
7614
  const SELECTOR_CAROUSEL$1 = '.carousel';
7616
7615
  const SELECTOR_CAPTION = '.carousel-caption-container p';
7617
- class CarouselCaption extends BaseComponent {
7616
+ const instances$1 = new WeakMap();
7617
+ class CarouselCaption {
7618
7618
  constructor(element) {
7619
- super(element);
7620
- this._captionEl = this._findCaptionEl();
7619
+ this._element = element;
7620
+ this._captionEl = element.querySelector(SELECTOR_CAPTION) || null;
7621
7621
  this._updateCaption();
7622
+ instances$1.set(element, this);
7622
7623
  }
7623
7624
  _updateCaption() {
7624
7625
  if (!this._captionEl) return;
7625
7626
  const activeItem = SelectorEngine.findOne('.carousel-item.active', this._element);
7626
7627
  this._captionEl.textContent = activeItem?.getAttribute('data-caption') ?? '';
7627
7628
  }
7628
- _findCaptionEl() {
7629
- return this._element.querySelector(SELECTOR_CAPTION) || null;
7630
- }
7631
- static get NAME() {
7632
- return NAME$3;
7633
- }
7634
- static jQueryInterface(config) {
7635
- return this.each(function () {
7636
- CarouselCaption.getOrCreateInstance(this, config);
7637
- });
7629
+ static getOrCreateInstance(element) {
7630
+ return instances$1.get(element) || new CarouselCaption(element);
7638
7631
  }
7639
7632
  }
7640
7633
  EventHandler.on(document, EVENT_SLID$1, SELECTOR_CAROUSEL$1, function () {
7641
7634
  CarouselCaption.getOrCreateInstance(this)._updateCaption();
7642
7635
  });
7643
- defineJQueryPlugin(CarouselCaption);
7644
7636
 
7645
- const NAME$2 = 'carouselHeight';
7646
7637
  const EVENT_SLIDE = 'slide.bs.carousel';
7647
7638
  const EVENT_SLID = 'slid.bs.carousel';
7648
7639
  const SELECTOR_CAROUSEL = '.carousel';
7649
7640
  const SELECTOR_INNER = '.carousel-inner';
7650
- class CarouselHeight extends BaseComponent {
7641
+ const instances = new WeakMap();
7642
+ class CarouselHeight {
7651
7643
  constructor(element) {
7652
- super(element);
7653
- this._inner = SelectorEngine.findOne(SELECTOR_INNER, this._element);
7644
+ this._element = element;
7645
+ this._inner = SelectorEngine.findOne(SELECTOR_INNER, element);
7646
+ if (this._inner) this._bindEvents();
7647
+ instances.set(element, this);
7648
+ }
7649
+ dispose() {
7650
+ EventHandler.off(this._element, EVENT_SLIDE);
7651
+ EventHandler.off(this._element, EVENT_SLID);
7652
+ instances.delete(this._element);
7653
+ }
7654
+ _bindEvents() {
7655
+ EventHandler.on(this._element, EVENT_SLIDE, e => this._onSlide(e));
7656
+ EventHandler.on(this._element, EVENT_SLID, () => this._onSlid());
7654
7657
  }
7655
7658
  _onSlide(e) {
7656
- if (!this._inner) return;
7657
7659
  const nextSlide = e.relatedTarget;
7658
7660
  if (!nextSlide) return;
7659
7661
  this._inner.style.height = `${this._inner.offsetHeight}px`;
@@ -7662,25 +7664,17 @@
7662
7664
  });
7663
7665
  }
7664
7666
  _onSlid() {
7665
- if (!this._inner) return;
7666
7667
  this._inner.style.height = '';
7667
7668
  }
7668
- static get NAME() {
7669
- return NAME$2;
7670
- }
7671
- static jQueryInterface(config) {
7672
- return this.each(function () {
7673
- CarouselHeight.getOrCreateInstance(this, config);
7674
- });
7669
+ static getOrCreateInstance(element) {
7670
+ return instances.get(element) || new CarouselHeight(element);
7675
7671
  }
7676
7672
  }
7677
- EventHandler.on(document, EVENT_SLIDE, SELECTOR_CAROUSEL, function (e) {
7678
- CarouselHeight.getOrCreateInstance(this)._onSlide(e);
7679
- });
7680
- EventHandler.on(document, EVENT_SLID, SELECTOR_CAROUSEL, function () {
7681
- CarouselHeight.getOrCreateInstance(this)._onSlid();
7673
+ document.addEventListener('DOMContentLoaded', () => {
7674
+ for (const el of SelectorEngine.find(SELECTOR_CAROUSEL)) {
7675
+ CarouselHeight.getOrCreateInstance(el);
7676
+ }
7682
7677
  });
7683
- defineJQueryPlugin(CarouselHeight);
7684
7678
 
7685
7679
  const NAME$1 = 'videoModal';
7686
7680
  const EVENT_SHOW = 'show.bs.modal';