@vaadin/menu-bar 24.8.2 → 24.8.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/menu-bar",
3
- "version": "24.8.2",
3
+ "version": "24.8.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,22 +37,22 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "~24.8.2",
41
- "@vaadin/button": "~24.8.2",
42
- "@vaadin/component-base": "~24.8.2",
43
- "@vaadin/context-menu": "~24.8.2",
44
- "@vaadin/item": "~24.8.2",
45
- "@vaadin/list-box": "~24.8.2",
46
- "@vaadin/overlay": "~24.8.2",
47
- "@vaadin/vaadin-lumo-styles": "~24.8.2",
48
- "@vaadin/vaadin-material-styles": "~24.8.2",
49
- "@vaadin/vaadin-themable-mixin": "~24.8.2",
40
+ "@vaadin/a11y-base": "~24.8.4",
41
+ "@vaadin/button": "~24.8.4",
42
+ "@vaadin/component-base": "~24.8.4",
43
+ "@vaadin/context-menu": "~24.8.4",
44
+ "@vaadin/item": "~24.8.4",
45
+ "@vaadin/list-box": "~24.8.4",
46
+ "@vaadin/overlay": "~24.8.4",
47
+ "@vaadin/vaadin-lumo-styles": "~24.8.4",
48
+ "@vaadin/vaadin-material-styles": "~24.8.4",
49
+ "@vaadin/vaadin-themable-mixin": "~24.8.4",
50
50
  "lit": "^3.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@vaadin/chai-plugins": "~24.8.2",
54
- "@vaadin/icon": "~24.8.2",
55
- "@vaadin/test-runner-commands": "~24.8.2",
53
+ "@vaadin/chai-plugins": "~24.8.4",
54
+ "@vaadin/icon": "~24.8.4",
55
+ "@vaadin/test-runner-commands": "~24.8.4",
56
56
  "@vaadin/testing-helpers": "^1.1.0",
57
57
  "sinon": "^18.0.0"
58
58
  },
@@ -60,5 +60,5 @@
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "f9e319ae7172ab06b3e567684465e36487f50bc6"
63
+ "gitHead": "849e54e967563080a685965e2dced02060b3ab23"
64
64
  }
@@ -10,7 +10,9 @@ import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
10
10
  import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
11
11
  import { isElementFocused, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
12
12
  import { KeyboardDirectionMixin } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
13
+ import { microTask } from '@vaadin/component-base/src/async.js';
13
14
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
15
+ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
14
16
  import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
15
17
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
16
18
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
@@ -347,13 +349,7 @@ export const MenuBarMixin = (superClass) =>
347
349
  const container = this.shadowRoot.querySelector('[part="container"]');
348
350
  container.addEventListener('click', this.__onButtonClick.bind(this));
349
351
  container.addEventListener('mouseover', (e) => this._onMouseOver(e));
350
-
351
- // Delay setting container to avoid rendering buttons immediately,
352
- // which would also trigger detecting overflow and force re-layout
353
- // See https://github.com/vaadin/web-components/issues/7271
354
- queueMicrotask(() => {
355
- this._container = container;
356
- });
352
+ this._container = container;
357
353
  }
358
354
 
359
355
  /**
@@ -382,7 +378,7 @@ export const MenuBarMixin = (superClass) =>
382
378
  * @override
383
379
  */
384
380
  _onResize() {
385
- this.__detectOverflow();
381
+ this.__scheduleOverflow();
386
382
  }
387
383
 
388
384
  /**
@@ -395,7 +391,7 @@ export const MenuBarMixin = (superClass) =>
395
391
  _themeChanged(theme, overflow, container) {
396
392
  if (overflow && container) {
397
393
  this.__renderButtons(this.items);
398
- this.__detectOverflow();
394
+ this.__scheduleOverflow();
399
395
 
400
396
  if (theme) {
401
397
  overflow.setAttribute('theme', theme);
@@ -415,7 +411,7 @@ export const MenuBarMixin = (superClass) =>
415
411
  */
416
412
  _reverseCollapseChanged(_reverseCollapse, overflow, container) {
417
413
  if (overflow && container) {
418
- this.__detectOverflow();
414
+ this.__scheduleOverflow();
419
415
  }
420
416
  }
421
417
 
@@ -451,7 +447,7 @@ export const MenuBarMixin = (superClass) =>
451
447
  if (items !== this._oldItems) {
452
448
  this._oldItems = items;
453
449
  this.__renderButtons(items);
454
- this.__detectOverflow();
450
+ this.__scheduleOverflow();
455
451
  }
456
452
 
457
453
  if (disabled !== this._oldDisabled) {
@@ -563,11 +559,14 @@ export const MenuBarMixin = (superClass) =>
563
559
  }
564
560
 
565
561
  /** @private */
566
- __detectOverflow() {
567
- if (!this._container) {
568
- return;
569
- }
562
+ __scheduleOverflow() {
563
+ this._overflowDebouncer = Debouncer.debounce(this._overflowDebouncer, microTask, () => {
564
+ this.__detectOverflow();
565
+ });
566
+ }
570
567
 
568
+ /** @private */
569
+ __detectOverflow() {
571
570
  const overflow = this._overflow;
572
571
  const buttons = this._buttons.filter((btn) => btn !== overflow);
573
572
  const oldOverflowCount = this.__getOverflowCount(overflow);
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/menu-bar",
4
- "version": "24.8.2",
4
+ "version": "24.8.4",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-menu-bar",
11
- "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
11
+ "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/menu-bar",
4
- "version": "24.8.2",
4
+ "version": "24.8.4",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-menu-bar",
19
- "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.8.2/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
19
+ "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.8.4/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {