@m3e/core 1.1.10 → 1.2.0

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.
@@ -10592,7 +10592,7 @@
10592
10592
  "name": "#focusController",
10593
10593
  "privacy": "private",
10594
10594
  "readonly": true,
10595
- "default": "new FocusController(this, { target: null, callback: (focused, focusVisible) => this.#handleFocusChange(focused && focusVisible), })"
10595
+ "default": "new FocusController(this, { target: null, callback: (_, focusVisible) => this.#handleFocusChange(focusVisible), })"
10596
10596
  },
10597
10597
  {
10598
10598
  "kind": "field",
@@ -10728,7 +10728,7 @@
10728
10728
  },
10729
10729
  "parameters": [
10730
10730
  {
10731
- "name": "focused",
10731
+ "name": "focusVisible",
10732
10732
  "type": {
10733
10733
  "text": "boolean"
10734
10734
  }
package/dist/index.js CHANGED
@@ -409,7 +409,7 @@ function rotateArray(arr, offset) {
409
409
  return out;
410
410
  }
411
411
  function bestCircularShift(target, source) {
412
- const n = target.length;
412
+ const n = Math.min(source.length, target.length);
413
413
  let bestK = 0;
414
414
  let bestScore = Infinity;
415
415
  for (let k = 0; k < n; k++) {
@@ -3499,16 +3499,19 @@ function KeyboardClick(base, allowEnter = true) {
3499
3499
  }
3500
3500
  }
3501
3501
  __KeyboardClickMixin_keyPressed = new WeakMap(), __KeyboardClickMixin_keyDownHandler = new WeakMap(), __KeyboardClickMixin_keyUpHandler = new WeakMap(), __KeyboardClickMixin_focusOutHandler = new WeakMap(), __KeyboardClickMixin_instances = new WeakSet(), __KeyboardClickMixin_handleKeyDown = function __KeyboardClickMixin_handleKeyDown(e) {
3502
- if (e.defaultPrevented || e.target !== e.currentTarget || isDisabledMixin(this) && this.disabled || isDisabledInteractiveMixin(this) && this.disabledInteractive) {
3502
+ if (e.target !== e.currentTarget || isDisabledMixin(this) && this.disabled || isDisabledInteractiveMixin(this) && this.disabledInteractive) {
3503
+ __classPrivateFieldSet(this, __KeyboardClickMixin_keyPressed, false, "f");
3503
3504
  return;
3504
3505
  }
3505
3506
  if (e.key === " " || allowEnter && e.key === "Enter") {
3506
3507
  __classPrivateFieldSet(this, __KeyboardClickMixin_keyPressed, true, "f");
3507
3508
  }
3508
3509
  }, __KeyboardClickMixin_handleKeyUp = function __KeyboardClickMixin_handleKeyUp(e) {
3509
- if (e.defaultPrevented || e.target !== e.currentTarget || isDisabledMixin(this) && this.disabled || isDisabledInteractiveMixin(this) && this.disabledInteractive || !__classPrivateFieldGet(this, __KeyboardClickMixin_keyPressed, "f")) {
3510
+ if (e.target !== e.currentTarget || isDisabledMixin(this) && this.disabled || isDisabledInteractiveMixin(this) && this.disabledInteractive || !__classPrivateFieldGet(this, __KeyboardClickMixin_keyPressed, "f")) {
3511
+ __classPrivateFieldSet(this, __KeyboardClickMixin_keyPressed, false, "f");
3510
3512
  return;
3511
3513
  }
3514
+ __classPrivateFieldSet(this, __KeyboardClickMixin_keyPressed, false, "f");
3512
3515
  // NOTE: the dispatched click event will not be trusted since it is synthetic.
3513
3516
  this.dispatchEvent(new MouseEvent("click", {
3514
3517
  cancelable: true,
@@ -5160,7 +5163,7 @@ let M3eStateLayerElement = class M3eStateLayerElement extends HtmlFor(Role(LitEl
5160
5163
  /** @private */
5161
5164
  _M3eStateLayerElement_focusController.set(this, new FocusController(this, {
5162
5165
  target: null,
5163
- callback: (focused, focusVisible) => __classPrivateFieldGet(this, _M3eStateLayerElement_instances, "m", _M3eStateLayerElement_handleFocusChange).call(this, focused && focusVisible)
5166
+ callback: (_, focusVisible) => __classPrivateFieldGet(this, _M3eStateLayerElement_instances, "m", _M3eStateLayerElement_handleFocusChange).call(this, focusVisible)
5164
5167
  }));
5165
5168
  /**
5166
5169
  * Whether hover and focus events will not trigger the state layer. State layers can still
@@ -5242,9 +5245,9 @@ _M3eStateLayerElement_handleHoverChange = function _M3eStateLayerElement_handleH
5242
5245
  }
5243
5246
  }
5244
5247
  };
5245
- _M3eStateLayerElement_handleFocusChange = function _M3eStateLayerElement_handleFocusChange(focused) {
5248
+ _M3eStateLayerElement_handleFocusChange = function _M3eStateLayerElement_handleFocusChange(focusVisible) {
5246
5249
  if (!this.disabled) {
5247
- if (focused) {
5250
+ if (focusVisible) {
5248
5251
  this.show("focused");
5249
5252
  } else {
5250
5253
  this.hide("focused");