@vaadin/menu-bar 24.7.8 → 24.7.10

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.7.8",
3
+ "version": "24.7.10",
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.7.8",
41
- "@vaadin/button": "~24.7.8",
42
- "@vaadin/component-base": "~24.7.8",
43
- "@vaadin/context-menu": "~24.7.8",
44
- "@vaadin/item": "~24.7.8",
45
- "@vaadin/list-box": "~24.7.8",
46
- "@vaadin/overlay": "~24.7.8",
47
- "@vaadin/vaadin-lumo-styles": "~24.7.8",
48
- "@vaadin/vaadin-material-styles": "~24.7.8",
49
- "@vaadin/vaadin-themable-mixin": "~24.7.8",
40
+ "@vaadin/a11y-base": "~24.7.10",
41
+ "@vaadin/button": "~24.7.10",
42
+ "@vaadin/component-base": "~24.7.10",
43
+ "@vaadin/context-menu": "~24.7.10",
44
+ "@vaadin/item": "~24.7.10",
45
+ "@vaadin/list-box": "~24.7.10",
46
+ "@vaadin/overlay": "~24.7.10",
47
+ "@vaadin/vaadin-lumo-styles": "~24.7.10",
48
+ "@vaadin/vaadin-material-styles": "~24.7.10",
49
+ "@vaadin/vaadin-themable-mixin": "~24.7.10",
50
50
  "lit": "^3.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@vaadin/chai-plugins": "~24.7.8",
54
- "@vaadin/icon": "~24.7.8",
55
- "@vaadin/test-runner-commands": "~24.7.8",
53
+ "@vaadin/chai-plugins": "~24.7.10",
54
+ "@vaadin/icon": "~24.7.10",
55
+ "@vaadin/test-runner-commands": "~24.7.10",
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": "03387032412d4256e3defd4d5d654b8494e55d7b"
63
+ "gitHead": "8fbf421b6afdb337bcff4d2e130390931796839b"
64
64
  }
@@ -7,7 +7,9 @@ import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
7
7
  import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
8
8
  import { isElementFocused, isElementHidden, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
9
9
  import { KeyboardDirectionMixin } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
10
+ import { microTask } from '@vaadin/component-base/src/async.js';
10
11
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
12
+ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
11
13
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
12
14
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
13
15
 
@@ -295,13 +297,7 @@ export const MenuBarMixin = (superClass) =>
295
297
  const container = this.shadowRoot.querySelector('[part="container"]');
296
298
  container.addEventListener('click', this.__onButtonClick.bind(this));
297
299
  container.addEventListener('mouseover', (e) => this._onMouseOver(e));
298
-
299
- // Delay setting container to avoid rendering buttons immediately,
300
- // which would also trigger detecting overflow and force re-layout
301
- // See https://github.com/vaadin/web-components/issues/7271
302
- queueMicrotask(() => {
303
- this._container = container;
304
- });
300
+ this._container = container;
305
301
  }
306
302
 
307
303
  /**
@@ -330,7 +326,7 @@ export const MenuBarMixin = (superClass) =>
330
326
  * @override
331
327
  */
332
328
  _onResize() {
333
- this.__detectOverflow();
329
+ this.__scheduleOverflow();
334
330
  }
335
331
 
336
332
  /**
@@ -360,7 +356,7 @@ export const MenuBarMixin = (superClass) =>
360
356
  _themeChanged(theme, overflow, container) {
361
357
  if (overflow && container) {
362
358
  this._buttons.forEach((btn) => this._setButtonTheme(btn, theme));
363
- this.__detectOverflow();
359
+ this.__scheduleOverflow();
364
360
  }
365
361
 
366
362
  if (theme) {
@@ -378,7 +374,7 @@ export const MenuBarMixin = (superClass) =>
378
374
  */
379
375
  _reverseCollapseChanged(_reverseCollapse, overflow, container) {
380
376
  if (overflow && container) {
381
- this.__detectOverflow();
377
+ this.__scheduleOverflow();
382
378
  }
383
379
  }
384
380
 
@@ -523,11 +519,14 @@ export const MenuBarMixin = (superClass) =>
523
519
  }
524
520
 
525
521
  /** @private */
526
- __detectOverflow() {
527
- if (!this._container) {
528
- return;
529
- }
522
+ __scheduleOverflow() {
523
+ this._overflowDebouncer = Debouncer.debounce(this._overflowDebouncer, microTask, () => {
524
+ this.__detectOverflow();
525
+ });
526
+ }
530
527
 
528
+ /** @private */
529
+ __detectOverflow() {
531
530
  const overflow = this._overflow;
532
531
  const buttons = this._buttons.filter((btn) => btn !== overflow);
533
532
  const oldOverflowCount = this.__getOverflowCount(overflow);
@@ -653,7 +652,7 @@ export const MenuBarMixin = (superClass) =>
653
652
  this._setButtonTheme(button, this._theme);
654
653
  });
655
654
 
656
- this.__detectOverflow();
655
+ this.__scheduleOverflow();
657
656
  }
658
657
 
659
658
  /**
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.7.8",
4
+ "version": "24.7.10",
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.7.8/#/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.7.8/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.8/#/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.7.8/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.8/#/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.7.10/#/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.7.10/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.10/#/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.7.10/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.10/#/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.7.8",
4
+ "version": "24.7.10",
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.7.8/#/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.7.8/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.8/#/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.7.8/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.8/#/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.7.10/#/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.7.10/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.10/#/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.7.10/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.10/#/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
  {