@m3e/core 1.1.7 → 1.1.9

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.
package/dist/index.js CHANGED
@@ -645,7 +645,7 @@ function scrollIntoViewIfNeeded(element, scrollContainer, options) {
645
645
  }
646
646
  }
647
647
 
648
- var _FocusController_instances, _FocusController_touch, _FocusController_callback, _FocusController_keyDownHandler, _FocusController_focusInHandler, _FocusController_focusOutHandler, _FocusController_touchStartHandler, _FocusController_touchEndHandler, _FocusController_handleKeyDown, _FocusController_handleFocusIn, _FocusController_handleFocusOut;
648
+ var _FocusController_instances, _FocusController_touch, _FocusController_callback, _FocusController_keyDownHandler, _FocusController_focusInHandler, _FocusController_focusOutHandler, _FocusController_touchStartHandler, _FocusController_touchEndHandler, _FocusController_hadKeydown, _FocusController_windowKeyDownHandler, _FocusController_windowPointerDownHandler, _FocusController_handleKeyDown, _FocusController_handleFocusIn, _FocusController_handleFocusOut;
649
649
  /** A `ReactiveController` used to monitor the focused state of one or more elements. */
650
650
  class FocusController extends MonitorControllerBase {
651
651
  /**
@@ -670,8 +670,35 @@ class FocusController extends MonitorControllerBase {
670
670
  _FocusController_touchStartHandler.set(this, () => __classPrivateFieldSet(this, _FocusController_touch, true, "f"));
671
671
  /** @private */
672
672
  _FocusController_touchEndHandler.set(this, () => __classPrivateFieldSet(this, _FocusController_touch, false, "f"));
673
+ /** @private */
674
+ _FocusController_hadKeydown.set(this, false);
675
+ /** @private */
676
+ _FocusController_windowKeyDownHandler.set(this, () => __classPrivateFieldSet(this, _FocusController_hadKeydown, true, "f"));
677
+ /** @private */
678
+ _FocusController_windowPointerDownHandler.set(this, () => __classPrivateFieldSet(this, _FocusController_hadKeydown, false, "f"));
673
679
  __classPrivateFieldSet(this, _FocusController_callback, options.callback, "f");
674
680
  }
681
+ /** @inheritdoc */
682
+ hostConnected() {
683
+ super.hostConnected();
684
+ window?.addEventListener("keydown", __classPrivateFieldGet(this, _FocusController_windowKeyDownHandler, "f"), {
685
+ capture: true,
686
+ passive: true
687
+ });
688
+ window?.addEventListener("pointerdown", __classPrivateFieldGet(this, _FocusController_windowPointerDownHandler, "f"), {
689
+ capture: true
690
+ });
691
+ }
692
+ /** @inheritdoc */
693
+ hostDisconnected() {
694
+ super.hostDisconnected();
695
+ window?.removeEventListener("keydown", __classPrivateFieldGet(this, _FocusController_windowKeyDownHandler, "f"), {
696
+ capture: true
697
+ });
698
+ window?.removeEventListener("pointerdown", __classPrivateFieldGet(this, _FocusController_windowPointerDownHandler, "f"), {
699
+ capture: true
700
+ });
701
+ }
675
702
  /**
676
703
  * Starts observing the specified element.
677
704
  * @param {HTMLElement} target The element to start observing.
@@ -697,7 +724,7 @@ class FocusController extends MonitorControllerBase {
697
724
  target.removeEventListener("touchcancel", __classPrivateFieldGet(this, _FocusController_touchEndHandler, "f"));
698
725
  }
699
726
  }
700
- _FocusController_touch = new WeakMap(), _FocusController_callback = new WeakMap(), _FocusController_keyDownHandler = new WeakMap(), _FocusController_focusInHandler = new WeakMap(), _FocusController_focusOutHandler = new WeakMap(), _FocusController_touchStartHandler = new WeakMap(), _FocusController_touchEndHandler = new WeakMap(), _FocusController_instances = new WeakSet(), _FocusController_handleKeyDown = function _FocusController_handleKeyDown(e) {
727
+ _FocusController_touch = new WeakMap(), _FocusController_callback = new WeakMap(), _FocusController_keyDownHandler = new WeakMap(), _FocusController_focusInHandler = new WeakMap(), _FocusController_focusOutHandler = new WeakMap(), _FocusController_touchStartHandler = new WeakMap(), _FocusController_touchEndHandler = new WeakMap(), _FocusController_hadKeydown = new WeakMap(), _FocusController_windowKeyDownHandler = new WeakMap(), _FocusController_windowPointerDownHandler = new WeakMap(), _FocusController_instances = new WeakSet(), _FocusController_handleKeyDown = function _FocusController_handleKeyDown(e) {
701
728
  const target = e.currentTarget;
702
729
  if (target.matches(":focus-within")) {
703
730
  __classPrivateFieldGet(this, _FocusController_instances, "m", _FocusController_handleFocusIn).call(this, e);
@@ -705,7 +732,7 @@ _FocusController_touch = new WeakMap(), _FocusController_callback = new WeakMap(
705
732
  }, _FocusController_handleFocusIn = function _FocusController_handleFocusIn(e) {
706
733
  if (__classPrivateFieldGet(this, _FocusController_touch, "f")) return;
707
734
  const target = e.currentTarget;
708
- __classPrivateFieldGet(this, _FocusController_callback, "f").call(this, true, target.matches(":focus-visible") || forcedColorsActive(), target);
735
+ __classPrivateFieldGet(this, _FocusController_callback, "f").call(this, true, target.matches(":focus-visible") || __classPrivateFieldGet(this, _FocusController_hadKeydown, "f") || forcedColorsActive(), target);
709
736
  }, _FocusController_handleFocusOut = function _FocusController_handleFocusOut(e) {
710
737
  if (__classPrivateFieldGet(this, _FocusController_touch, "f")) return;
711
738
  __classPrivateFieldGet(this, _FocusController_callback, "f").call(this, false, false, e.currentTarget);