@unlk/keymaster 1.4.3 → 1.4.5

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.4.3 (https://keymaster.unlock.com)
2
+ * Unlock Keymaster v1.4.5 (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$2 = 'datepicker';
7462
+ const NAME$3 = '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$2;
7471
+ return NAME$3;
7472
7472
  }
7473
7473
 
7474
7474
  // Static
@@ -7513,7 +7513,7 @@
7513
7513
  }
7514
7514
  });
7515
7515
  function isTouchDevice() {
7516
- return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
7516
+ return 'ontouchstart' in globalThis || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
7517
7517
  }
7518
7518
 
7519
7519
  /**
@@ -7610,39 +7610,26 @@
7610
7610
  }
7611
7611
  };
7612
7612
 
7613
- const NAME$1 = 'carouselCaption';
7614
- const EVENT_SLID = 'slid.bs.carousel';
7615
- const SELECTOR_CAROUSEL = '.carousel';
7613
+ const NAME$2 = 'carouselCaption';
7614
+ const EVENT_SLID$1 = 'slid.bs.carousel';
7615
+ const SELECTOR_CAROUSEL$1 = '.carousel';
7616
7616
  const SELECTOR_CAPTION = '.carousel-caption-container p';
7617
7617
  class CarouselCaption extends BaseComponent {
7618
7618
  constructor(element) {
7619
7619
  super(element);
7620
7620
  this._captionEl = this._findCaptionEl();
7621
- if (!this._captionEl) {
7622
- return;
7623
- }
7624
- this._updateCaption(); // Initialize
7625
- this._bindEvents();
7626
- }
7627
- dispose() {
7628
- EventHandler.off(this._element, EVENT_SLID);
7629
- super.dispose();
7630
- }
7631
- _bindEvents() {
7632
- EventHandler.on(this._element, EVENT_SLID, () => this._updateCaption());
7621
+ this._updateCaption();
7633
7622
  }
7634
7623
  _updateCaption() {
7624
+ if (!this._captionEl) return;
7635
7625
  const activeItem = SelectorEngine.findOne('.carousel-item.active', this._element);
7636
- const newCaption = activeItem?.getAttribute('data-caption');
7637
- if (this._captionEl && newCaption) {
7638
- this._captionEl.textContent = newCaption || '';
7639
- }
7626
+ this._captionEl.textContent = activeItem?.getAttribute('data-caption') ?? '';
7640
7627
  }
7641
7628
  _findCaptionEl() {
7642
7629
  return this._element.querySelector(SELECTOR_CAPTION) || null;
7643
7630
  }
7644
7631
  static get NAME() {
7645
- return NAME$1;
7632
+ return NAME$2;
7646
7633
  }
7647
7634
  static jQueryInterface(config) {
7648
7635
  return this.each(function () {
@@ -7650,26 +7637,63 @@
7650
7637
  });
7651
7638
  }
7652
7639
  }
7640
+ EventHandler.on(document, EVENT_SLID$1, SELECTOR_CAROUSEL$1, function () {
7641
+ CarouselCaption.getOrCreateInstance(this)._updateCaption();
7642
+ });
7643
+ defineJQueryPlugin(CarouselCaption);
7653
7644
 
7654
- // Auto-init on DOMContentLoaded
7655
- document.addEventListener('DOMContentLoaded', () => {
7656
- for (const el of SelectorEngine.find(SELECTOR_CAROUSEL)) {
7657
- CarouselCaption.getOrCreateInstance(el);
7645
+ const NAME$1 = 'carouselHeight';
7646
+ const EVENT_SLIDE = 'slide.bs.carousel';
7647
+ const EVENT_SLID = 'slid.bs.carousel';
7648
+ const SELECTOR_CAROUSEL = '.carousel';
7649
+ const SELECTOR_INNER = '.carousel-inner';
7650
+ class CarouselHeight extends BaseComponent {
7651
+ constructor(element) {
7652
+ super(element);
7653
+ this._inner = SelectorEngine.findOne(SELECTOR_INNER, this._element);
7658
7654
  }
7655
+ _onSlide(e) {
7656
+ if (!this._inner) return;
7657
+ const nextSlide = e.relatedTarget;
7658
+ if (!nextSlide) return;
7659
+ this._inner.style.height = `${this._inner.offsetHeight}px`;
7660
+ requestAnimationFrame(() => {
7661
+ this._inner.style.height = `${nextSlide.offsetHeight}px`;
7662
+ });
7663
+ }
7664
+ _onSlid() {
7665
+ if (!this._inner) return;
7666
+ this._inner.style.height = '';
7667
+ }
7668
+ static get NAME() {
7669
+ return NAME$1;
7670
+ }
7671
+ static jQueryInterface(config) {
7672
+ return this.each(function () {
7673
+ CarouselHeight.getOrCreateInstance(this, config);
7674
+ });
7675
+ }
7676
+ }
7677
+ EventHandler.on(document, EVENT_SLIDE, SELECTOR_CAROUSEL, function (e) {
7678
+ CarouselHeight.getOrCreateInstance(this)._onSlide(e);
7659
7679
  });
7660
- defineJQueryPlugin(CarouselCaption);
7680
+ EventHandler.on(document, EVENT_SLID, SELECTOR_CAROUSEL, function () {
7681
+ CarouselHeight.getOrCreateInstance(this)._onSlid();
7682
+ });
7683
+ defineJQueryPlugin(CarouselHeight);
7661
7684
 
7662
7685
  const NAME = 'videoModal';
7663
7686
  const EVENT_SHOW = 'show.bs.modal';
7664
7687
  const EVENT_HIDDEN = 'hidden.bs.modal';
7688
+ const SELECTOR_MODAL = '.modal';
7665
7689
  const SELECTOR_DIALOG = '.modal-dialog-media';
7666
7690
  const SELECTOR_RATIO = '.ratio';
7667
7691
  const youTubeAPIInitPromise = new Promise(resolve => {
7668
- if (window.YT?.Player) {
7692
+ if (globalThis.YT?.Player) {
7669
7693
  resolve();
7670
7694
  } else {
7671
- const prev = window.onYouTubeIframeAPIReady;
7672
- window.onYouTubeIframeAPIReady = () => {
7695
+ const prev = globalThis.onYouTubeIframeAPIReady;
7696
+ globalThis.onYouTubeIframeAPIReady = () => {
7673
7697
  try {
7674
7698
  if (typeof prev === 'function') prev();
7675
7699
  } catch {}
@@ -7681,7 +7705,7 @@
7681
7705
  }
7682
7706
  });
7683
7707
  const vimeoAPIInitPromise = new Promise(resolve => {
7684
- if (window.Vimeo?.Player) {
7708
+ if (globalThis.Vimeo?.Player) {
7685
7709
  resolve();
7686
7710
  } else {
7687
7711
  const script = document.createElement('script');
@@ -7697,15 +7721,10 @@
7697
7721
  super(element);
7698
7722
  this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
7699
7723
  this._container = SelectorEngine.findOne(SELECTOR_RATIO, this._element);
7700
- if (!this._dialog || !this._container) {
7701
- return;
7702
- }
7703
- this._youtubeSrc = this._container.getAttribute('data-src');
7704
- this._vimeoUrl = this._container.getAttribute('data-vimeo-url');
7724
+ this._youtubeSrc = this._container?.getAttribute('data-src');
7725
+ this._vimeoUrl = this._container?.getAttribute('data-vimeo-url');
7705
7726
  this._youtubePlayer = null;
7706
7727
  this._vimeoPlayer = null;
7707
- EventHandler.on(this._element, EVENT_SHOW, () => this._onShow());
7708
- EventHandler.on(this._element, EVENT_HIDDEN, () => this._onHide());
7709
7728
  }
7710
7729
  dispose() {
7711
7730
  this._onHide();
@@ -7719,7 +7738,7 @@
7719
7738
  if (this._vimeoUrl) {
7720
7739
  await vimeoAPIInitPromise;
7721
7740
  const vimeoId = this._getVimeoId(this._vimeoUrl);
7722
- this._vimeoPlayer = new window.Vimeo.Player(this._container, {
7741
+ this._vimeoPlayer = new globalThis.Vimeo.Player(this._container, {
7723
7742
  id: vimeoId,
7724
7743
  autoplay: true
7725
7744
  });
@@ -7731,7 +7750,7 @@
7731
7750
  await youTubeAPIInitPromise;
7732
7751
  const youtubeId = this._getYouTubeId(this._youtubeSrc);
7733
7752
  const playerDiv = this._container.querySelector(`#${playerID}`);
7734
- this._youtubePlayer = new window.YT.Player(playerDiv, {
7753
+ this._youtubePlayer = new globalThis.YT.Player(playerDiv, {
7735
7754
  videoId: youtubeId,
7736
7755
  playerVars: {
7737
7756
  autoplay: 1,
@@ -7773,17 +7792,13 @@
7773
7792
  });
7774
7793
  }
7775
7794
  }
7776
-
7777
- // Auto-init
7778
- document.addEventListener('DOMContentLoaded', () => {
7779
- const modals = SelectorEngine.find('[data-bs-toggle="modal"][data-bs-target]');
7780
- for (const btn of modals) {
7781
- const targetSelector = btn.getAttribute('data-bs-target');
7782
- const modal = document.querySelector(targetSelector);
7783
- if (modal?.querySelector(SELECTOR_DIALOG)) {
7784
- VideoModal.getOrCreateInstance(modal);
7785
- }
7786
- }
7795
+ EventHandler.on(document, EVENT_SHOW, SELECTOR_MODAL, function () {
7796
+ if (!SelectorEngine.findOne(SELECTOR_DIALOG, this)) return;
7797
+ VideoModal.getOrCreateInstance(this)._onShow();
7798
+ });
7799
+ EventHandler.on(document, EVENT_HIDDEN, SELECTOR_MODAL, function () {
7800
+ if (!SelectorEngine.findOne(SELECTOR_DIALOG, this)) return;
7801
+ VideoModal.getOrCreateInstance(this)._onHide();
7787
7802
  });
7788
7803
  defineJQueryPlugin(VideoModal);
7789
7804
 
@@ -7791,6 +7806,7 @@
7791
7806
  exports.Button = button;
7792
7807
  exports.Carousel = carousel;
7793
7808
  exports.CarouselCaption = CarouselCaption;
7809
+ exports.CarouselHeight = CarouselHeight;
7794
7810
  exports.Collapse = collapse;
7795
7811
  exports.Datepicker = Datepicker;
7796
7812
  exports.Dropdown = dropdown;