@vaadin/app-layout 24.7.0-alpha8 → 24.7.0-alpha9

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/app-layout",
3
- "version": "24.7.0-alpha8",
3
+ "version": "24.7.0-alpha9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,17 +37,17 @@
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.0-alpha8",
41
- "@vaadin/button": "24.7.0-alpha8",
42
- "@vaadin/component-base": "24.7.0-alpha8",
43
- "@vaadin/vaadin-lumo-styles": "24.7.0-alpha8",
44
- "@vaadin/vaadin-material-styles": "24.7.0-alpha8",
45
- "@vaadin/vaadin-themable-mixin": "24.7.0-alpha8",
40
+ "@vaadin/a11y-base": "24.7.0-alpha9",
41
+ "@vaadin/button": "24.7.0-alpha9",
42
+ "@vaadin/component-base": "24.7.0-alpha9",
43
+ "@vaadin/vaadin-lumo-styles": "24.7.0-alpha9",
44
+ "@vaadin/vaadin-material-styles": "24.7.0-alpha9",
45
+ "@vaadin/vaadin-themable-mixin": "24.7.0-alpha9",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@vaadin/chai-plugins": "24.7.0-alpha8",
50
- "@vaadin/test-runner-commands": "24.7.0-alpha8",
49
+ "@vaadin/chai-plugins": "24.7.0-alpha9",
50
+ "@vaadin/test-runner-commands": "24.7.0-alpha9",
51
51
  "@vaadin/testing-helpers": "^1.1.0",
52
52
  "sinon": "^18.0.0"
53
53
  },
@@ -55,5 +55,5 @@
55
55
  "web-types.json",
56
56
  "web-types.lit.json"
57
57
  ],
58
- "gitHead": "d015035192480fcc8cc9df5d00a950f177b83c32"
58
+ "gitHead": "b0a16c6ed7fc50a22a42dcab0649d74f4c300485"
59
59
  }
@@ -4,28 +4,21 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
+ import type { I18nMixinClass, PartialI18n } from '@vaadin/component-base/src/i18n-mixin.js';
7
8
 
8
- export interface AppLayoutI18n {
9
+ export type AppLayoutI18n = PartialI18n<{
9
10
  drawer: string;
10
- }
11
+ }>;
11
12
 
12
13
  export declare function AppLayoutMixin<T extends Constructor<HTMLElement>>(
13
14
  base: T,
14
- ): Constructor<AppLayoutMixinClass> & T;
15
+ ): Constructor<AppLayoutMixinClass> & Constructor<I18nMixinClass<AppLayoutI18n>> & T;
15
16
 
16
17
  export declare class AppLayoutMixinClass {
17
18
  /**
18
- * The object used to localize this component.
19
- * To change the default localization, replace the entire
20
- * `i18n` object with a custom one.
21
- *
22
- * To update individual properties, extend the existing i18n object as follows:
23
- * ```js
24
- * appLayout.i18n = {
25
- * ...appLayout.i18n,
26
- * drawer: 'Drawer'
27
- * }
28
- * ```
19
+ * The object used to localize this component. To change the default
20
+ * localization, replace this with an object that provides all properties, or
21
+ * just the individual properties you want to change.
29
22
  *
30
23
  * The object has the following structure and default values:
31
24
  * ```
@@ -6,52 +6,24 @@
6
6
  import { afterNextRender, beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';
7
7
  import { AriaModalController } from '@vaadin/a11y-base/src/aria-modal-controller.js';
8
8
  import { FocusTrapController } from '@vaadin/a11y-base/src/focus-trap-controller.js';
9
+ import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
9
10
 
10
11
  /**
11
12
  * @typedef {import('./vaadin-app-layout.js').AppLayoutI18n} AppLayoutI18n
12
13
  */
13
14
 
15
+ const DEFAULT_I18N = {
16
+ drawer: 'Drawer',
17
+ };
18
+
14
19
  /**
15
20
  * @polymerMixin
21
+ * @mixes I18nMixin
16
22
  */
17
23
  export const AppLayoutMixin = (superclass) =>
18
- class AppLayoutMixinClass extends superclass {
24
+ class AppLayoutMixinClass extends I18nMixin(DEFAULT_I18N, superclass) {
19
25
  static get properties() {
20
26
  return {
21
- /**
22
- * The object used to localize this component.
23
- * To change the default localization, replace the entire
24
- * `i18n` object with a custom one.
25
- *
26
- * To update individual properties, extend the existing i18n object as follows:
27
- * ```js
28
- * appLayout.i18n = {
29
- * ...appLayout.i18n,
30
- * drawer: 'Drawer'
31
- * }
32
- * ```
33
- *
34
- * The object has the following structure and default values:
35
- * ```
36
- * {
37
- * drawer: 'Drawer'
38
- * }
39
- * ```
40
- *
41
- * @type {AppLayoutI18n}
42
- * @default {English/US}
43
- */
44
- i18n: {
45
- type: Object,
46
- observer: '__i18nChanged',
47
- sync: true,
48
- value: () => {
49
- return {
50
- drawer: 'Drawer',
51
- };
52
- },
53
- },
54
-
55
27
  /**
56
28
  * Defines whether navbar or drawer will come first visually.
57
29
  * - By default (`primary-section="navbar"`), the navbar takes the full available width and moves the drawer down.
@@ -114,6 +86,10 @@ export const AppLayoutMixin = (superclass) =>
114
86
  };
115
87
  }
116
88
 
89
+ static get observers() {
90
+ return ['__i18nChanged(__effectiveI18n)'];
91
+ }
92
+
117
93
  /**
118
94
  * Helper static method that dispatches a `close-overlay-drawer` event
119
95
  */
@@ -121,6 +97,27 @@ export const AppLayoutMixin = (superclass) =>
121
97
  window.dispatchEvent(new CustomEvent('close-overlay-drawer'));
122
98
  }
123
99
 
100
+ /**
101
+ * The object used to localize this component. To change the default
102
+ * localization, replace this with an object that provides all properties, or
103
+ * just the individual properties you want to change.
104
+ *
105
+ * The object has the following structure and default values:
106
+ * ```
107
+ * {
108
+ * drawer: 'Drawer'
109
+ * }
110
+ * ```
111
+ * @return {!AppLayoutI18n}
112
+ */
113
+ get i18n() {
114
+ return super.i18n;
115
+ }
116
+
117
+ set i18n(value) {
118
+ super.i18n = value;
119
+ }
120
+
124
121
  constructor() {
125
122
  super();
126
123
  // TODO(jouni): might want to debounce
@@ -357,7 +354,7 @@ export const AppLayoutMixin = (superclass) =>
357
354
  if (this.overlay) {
358
355
  drawer.setAttribute('role', 'dialog');
359
356
  drawer.setAttribute('aria-modal', 'true');
360
- drawer.setAttribute('aria-label', this.i18n.drawer);
357
+ drawer.setAttribute('aria-label', this.__effectiveI18n.drawer);
361
358
  } else {
362
359
  drawer.removeAttribute('role');
363
360
  drawer.removeAttribute('aria-modal');
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/app-layout",
4
- "version": "24.7.0-alpha8",
4
+ "version": "24.7.0-alpha9",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -53,7 +53,7 @@
53
53
  "properties": [
54
54
  {
55
55
  "name": "i18n",
56
- "description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nTo update individual properties, extend the existing i18n object as follows:\n```js\nappLayout.i18n = {\n ...appLayout.i18n,\n drawer: 'Drawer'\n}\n```\n\nThe object has the following structure and default values:\n```\n{\n drawer: 'Drawer'\n}\n```",
56
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n```\n{\n drawer: 'Drawer'\n}\n```",
57
57
  "value": {
58
58
  "type": [
59
59
  "AppLayoutI18n"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/app-layout",
4
- "version": "24.7.0-alpha8",
4
+ "version": "24.7.0-alpha9",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  {
30
30
  "name": ".i18n",
31
- "description": "The object used to localize this component.\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nTo update individual properties, extend the existing i18n object as follows:\n```js\nappLayout.i18n = {\n ...appLayout.i18n,\n drawer: 'Drawer'\n}\n```\n\nThe object has the following structure and default values:\n```\n{\n drawer: 'Drawer'\n}\n```",
31
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n```\n{\n drawer: 'Drawer'\n}\n```",
32
32
  "value": {
33
33
  "kind": "expression"
34
34
  }