@material/web 1.0.0 → 1.0.1
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/checkbox/internal/_checkbox.scss +6 -0
- package/checkbox/internal/checkbox-styles.css.js +1 -1
- package/checkbox/internal/checkbox-styles.css.js.map +1 -1
- package/fab/internal/_fab.scss +4 -0
- package/fab/internal/fab-styles.css.js +1 -1
- package/fab/internal/fab-styles.css.js.map +1 -1
- package/field/internal/_filled-field.scss +1 -0
- package/field/internal/_outlined-field.scss +1 -0
- package/field/internal/filled-styles.css.js +1 -1
- package/field/internal/filled-styles.css.js.map +1 -1
- package/field/internal/outlined-styles.css.js +1 -1
- package/field/internal/outlined-styles.css.js.map +1 -1
- package/labs/item/internal/_item.scss +1 -1
- package/labs/item/internal/item-styles.css.js +1 -1
- package/labs/item/internal/item-styles.css.js.map +1 -1
- package/list/harness.d.ts +2 -1
- package/list/internal/listitem/_list-item.scss +18 -0
- package/list/internal/listitem/harness.d.ts +2 -2
- package/list/internal/listitem/harness.js.map +1 -1
- package/list/internal/listitem/list-item-styles.css.js +1 -1
- package/list/internal/listitem/list-item-styles.css.js.map +1 -1
- package/list/internal/listitem/list-item.js +1 -1
- package/list/internal/listitem/list-item.js.map +1 -1
- package/list/list-item.js +1 -2
- package/list/list-item.js.map +1 -1
- package/menu/internal/_menu.scss +8 -0
- package/menu/internal/controllers/menuItemController.d.ts +7 -0
- package/menu/internal/controllers/menuItemController.js +9 -1
- package/menu/internal/controllers/menuItemController.js.map +1 -1
- package/menu/internal/controllers/surfacePositionController.js +17 -9
- package/menu/internal/controllers/surfacePositionController.js.map +1 -1
- package/menu/internal/menu-styles.css.js +1 -1
- package/menu/internal/menu-styles.css.js.map +1 -1
- package/menu/internal/menu.d.ts +12 -5
- package/menu/internal/menu.js +53 -33
- package/menu/internal/menu.js.map +1 -1
- package/menu/internal/menuitem/_menu-item.scss +24 -0
- package/menu/internal/menuitem/harness.d.ts +3 -1
- package/menu/internal/menuitem/harness.js.map +1 -1
- package/menu/internal/menuitem/menu-item-styles.css.js +1 -1
- package/menu/internal/menuitem/menu-item-styles.css.js.map +1 -1
- package/menu/internal/menuitem/menu-item.js +2 -1
- package/menu/internal/menuitem/menu-item.js.map +1 -1
- package/menu/internal/submenu/sub-menu.d.ts +1 -0
- package/menu/internal/submenu/sub-menu.js +4 -0
- package/menu/internal/submenu/sub-menu.js.map +1 -1
- package/menu/menu-item.js +1 -2
- package/menu/menu-item.js.map +1 -1
- package/menu/menu.js +1 -2
- package/menu/menu.js.map +1 -1
- package/package.json +1 -1
- package/radio/internal/_radio.scss +144 -123
- package/radio/internal/radio-styles.css.js +1 -1
- package/radio/internal/radio-styles.css.js.map +1 -1
- package/radio/internal/radio.d.ts +5 -0
- package/radio/internal/radio.js +5 -0
- package/radio/internal/radio.js.map +1 -1
- package/radio/radio.js +1 -2
- package/radio/radio.js.map +1 -1
- package/ripple/internal/ripple.js +7 -9
- package/ripple/internal/ripple.js.map +1 -1
- package/select/internal/_shared.scss +4 -0
- package/select/internal/selectoption/select-option.js +2 -1
- package/select/internal/selectoption/select-option.js.map +1 -1
- package/select/internal/shared-styles.css.js +1 -1
- package/select/internal/shared-styles.css.js.map +1 -1
- package/select/select-option.js +1 -2
- package/select/select-option.js.map +1 -1
- package/slider/internal/_slider.scss +68 -30
- package/slider/internal/slider-styles.css.js +1 -1
- package/slider/internal/slider-styles.css.js.map +1 -1
- package/slider/internal/slider.js +1 -1
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/_handle.scss +159 -141
- package/switch/internal/_icon.scss +95 -72
- package/switch/internal/_switch.scss +90 -95
- package/switch/internal/_track.scss +110 -77
- package/switch/internal/switch-styles.css.js +1 -1
- package/switch/internal/switch-styles.css.js.map +1 -1
- package/switch/switch.js +1 -2
- package/switch/switch.js.map +1 -1
- package/tabs/internal/tab.d.ts +6 -0
- package/tabs/internal/tab.js +9 -0
- package/tabs/internal/tab.js.map +1 -1
- package/tabs/internal/tabs.d.ts +1 -2
- package/tabs/internal/tabs.js +5 -11
- package/tabs/internal/tabs.js.map +1 -1
- package/textfield/internal/text-field.d.ts +7 -0
- package/textfield/internal/text-field.js +15 -0
- package/textfield/internal/text-field.js.map +1 -1
- package/list/internal/listitem/forced-colors-styles.css.d.ts +0 -1
- package/list/internal/listitem/forced-colors-styles.css.js +0 -9
- package/list/internal/listitem/forced-colors-styles.css.js.map +0 -1
- package/list/internal/listitem/forced-colors-styles.scss +0 -19
- package/menu/internal/forced-colors-styles.css.d.ts +0 -1
- package/menu/internal/forced-colors-styles.css.js +0 -9
- package/menu/internal/forced-colors-styles.css.js.map +0 -1
- package/menu/internal/forced-colors-styles.scss +0 -12
- package/menu/internal/menuitem/forced-colors-styles.css.d.ts +0 -1
- package/menu/internal/menuitem/forced-colors-styles.css.js +0 -9
- package/menu/internal/menuitem/forced-colors-styles.css.js.map +0 -1
- package/menu/internal/menuitem/forced-colors-styles.scss +0 -26
- package/radio/internal/forced-colors-styles.css.d.ts +0 -1
- package/radio/internal/forced-colors-styles.css.js +0 -9
- package/radio/internal/forced-colors-styles.css.js.map +0 -1
- package/radio/internal/forced-colors-styles.scss +0 -29
- package/switch/internal/forced-colors-styles.css.d.ts +0 -1
- package/switch/internal/forced-colors-styles.css.js +0 -9
- package/switch/internal/forced-colors-styles.css.js.map +0 -1
- package/switch/internal/forced-colors-styles.scss +0 -42
package/list/harness.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { Harness } from '../testing/harness.js';
|
|
7
7
|
import { List } from './internal/list.js';
|
|
8
8
|
import { ListItemHarness } from './internal/listitem/harness.js';
|
|
9
|
+
import { ListItemEl } from './internal/listitem/list-item.js';
|
|
9
10
|
export { ListItemHarness } from './internal/listitem/harness.js';
|
|
10
11
|
declare const NAVIGABLE_KEYS: {
|
|
11
12
|
readonly ArrowDown: "ArrowDown";
|
|
@@ -27,7 +28,7 @@ export declare class ListHarness extends Harness<List> {
|
|
|
27
28
|
*/
|
|
28
29
|
protected getInteractiveElement(): Promise<List>;
|
|
29
30
|
/** @return List item harnesses. */
|
|
30
|
-
getItems(): ListItemHarness[];
|
|
31
|
+
getItems(): ListItemHarness<ListItemEl>[];
|
|
31
32
|
/**
|
|
32
33
|
* Constructs keyboard events that are handled by List and makes sure that
|
|
33
34
|
* they are constructed in a manner that List understands.
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
:host(:is([type='button']:not([disabled]), [type='link'])) {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
51
55
|
md-focus-ring {
|
|
52
56
|
z-index: 1;
|
|
53
57
|
|
|
@@ -64,6 +68,7 @@
|
|
|
64
68
|
// Resets. These can be removed once we're no longer use these tags
|
|
65
69
|
background: none;
|
|
66
70
|
border: none;
|
|
71
|
+
cursor: inherit;
|
|
67
72
|
padding: 0;
|
|
68
73
|
margin: 0;
|
|
69
74
|
text-align: unset;
|
|
@@ -74,6 +79,8 @@
|
|
|
74
79
|
border-radius: inherit;
|
|
75
80
|
display: flex;
|
|
76
81
|
flex: 1;
|
|
82
|
+
max-width: inherit;
|
|
83
|
+
min-width: inherit;
|
|
77
84
|
outline: none;
|
|
78
85
|
// hide android tap color since we have ripple
|
|
79
86
|
-webkit-tap-highlight-color: transparent;
|
|
@@ -143,4 +150,15 @@
|
|
|
143
150
|
[slot='end'] {
|
|
144
151
|
color: map.get($tokens, 'trailing-icon-color');
|
|
145
152
|
}
|
|
153
|
+
|
|
154
|
+
@media (forced-colors: active) {
|
|
155
|
+
.disabled slot {
|
|
156
|
+
color: GrayText;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.list-item.disabled {
|
|
160
|
+
color: GrayText;
|
|
161
|
+
opacity: 1;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
146
164
|
}
|
|
@@ -15,7 +15,7 @@ export type HandledListKeys = typeof NavigableKeys[keyof typeof NavigableKeys];
|
|
|
15
15
|
/**
|
|
16
16
|
* Test harness for list item.
|
|
17
17
|
*/
|
|
18
|
-
export declare class ListItemHarness extends
|
|
18
|
+
export declare class ListItemHarness<T extends LitElement = ListItem & LitElement> extends Harness<T> {
|
|
19
19
|
getInteractiveElement(): Promise<HTMLElement>;
|
|
20
20
|
/**
|
|
21
21
|
* Constructs keyboard events that are handled by List and makes sure that
|
|
@@ -23,5 +23,5 @@ export declare class ListItemHarness extends Harness<ListItem & LitElement> {
|
|
|
23
23
|
*
|
|
24
24
|
* @param key The key to dispatch on the list.
|
|
25
25
|
*/
|
|
26
|
-
pressHandledKey<
|
|
26
|
+
pressHandledKey<U extends string = HandledListKeys>(key: U): Promise<void>;
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAUpD;;GAEG;AACH,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAUpD;;GAEG;AACH,MAAM,OAAO,eACgC,SAAQ,OAAU;IACpD,KAAK,CAAC,qBAAqB;QAClC,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAgB,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAqC,GAAM;QAC9D,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {Harness} from '../../../testing/harness.js';\nimport {NavigableKeys} from '../list-controller.js';\nimport {ListItem} from '../list-navigation-helpers.js';\n\n/**\n * Keys that are handled by MdList. Keys not included in this are not handled by\n * MdList and should be dispatched by yourself.\n */\nexport type HandledListKeys = typeof NavigableKeys[keyof typeof NavigableKeys];\n\n/**\n * Test harness for list item.\n */\nexport class ListItemHarness<T extends LitElement = ListItem &\n LitElement> extends Harness<T> {\n override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.element.renderRoot.querySelector('.list-item') as HTMLElement;\n }\n\n /**\n * Constructs keyboard events that are handled by List and makes sure that\n * they are constructed in a manner that List understands.\n *\n * @param key The key to dispatch on the list.\n */\n async pressHandledKey<U extends string = HandledListKeys>(key: U) {\n await this.keypress(key, {code: key});\n }\n}\n"]}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
|
-
export const styles = css `:host{display:flex;--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}/*# sourceMappingURL=list-item-styles.css.map */
|
|
7
|
+
export const styles = css `:host{display:flex;--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}@media(forced-colors: active){.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}/*# sourceMappingURL=list-item-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=list-item-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item-styles.css.js","sourceRoot":"","sources":["list-item-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{display:flex;--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}/*# sourceMappingURL=list-item-styles.css.map */\n`;\n "]}
|
|
1
|
+
{"version":3,"file":"list-item-styles.css.js","sourceRoot":"","sources":["list-item-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{display:flex;--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}@media(forced-colors: active){.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}/*# sourceMappingURL=list-item-styles.css.map */\n`;\n "]}
|
|
@@ -177,7 +177,7 @@ __decorate([
|
|
|
177
177
|
property({ type: Boolean, reflect: true })
|
|
178
178
|
], ListItemEl.prototype, "disabled", void 0);
|
|
179
179
|
__decorate([
|
|
180
|
-
property()
|
|
180
|
+
property({ reflect: true })
|
|
181
181
|
], ListItemEl.prototype, "type", void 0);
|
|
182
182
|
__decorate([
|
|
183
183
|
property({ type: Boolean, attribute: 'md-list-item', reflect: true })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AAEpC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,IAAI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,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAKwC;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAMhC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCAA6B;AAMvD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAKN;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAAmD;AAEtB;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAoD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../ripple/ripple.js';\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {html as staticHtml, literal, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../../internal/aria/delegate.js';\nimport {createRequestActivationEvent, ListItem} from '../list-navigation-helpers.js';\n\n/**\n * Supported behaviors for a list item.\n */\nexport type ListItemType = 'text'|'button'|'link';\n\n/**\n * @fires request-activation\n */\nexport class ListItemEl extends LitElement implements ListItem {\n static {\n requestUpdateOnAriaChange(ListItemEl);\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior of the list item, defaults to \"text\". Change to \"link\" or\n * \"button\" for interactive items.\n */\n @property({reflect: true}) type: ListItemType = 'text';\n\n /**\n * READONLY. Sets the `md-list-item` attribute on the element.\n */\n @property({type: Boolean, attribute: 'md-list-item', reflect: true})\n isListItem = true;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank'|'_parent'|'_self'|'_top'|'' = '';\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement|null;\n\n private get isDisabled() {\n return this.disabled && this.type !== 'link';\n }\n\n protected override willUpdate(changed: PropertyValues<ListItemEl>) {\n if (this.href) {\n this.type = 'link';\n }\n\n super.willUpdate(changed);\n }\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()}\n ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.type) {\n case 'link':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'text':\n tag = literal`li`;\n break;\n }\n\n const isInteractive = this.type !== 'text';\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"listitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=\"${this.isDisabled || !isInteractive ? -1 : 0}\"\n ?disabled=${this.isDisabled}\n role=\"listitem\"\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @focus=${this.onFocus}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult|typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html`\n <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.isDisabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult|typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html`\n <md-focus-ring\n @visibility-changed=${this.onFocusRingVisibilityChanged}\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n protected onFocusRingVisibilityChanged(e: Event) {}\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {'disabled': this.isDisabled};\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n protected onFocus() {\n if (this.tabIndex !== -1) {\n return;\n }\n // Handles the case where the user clicks on the element and then tabs.\n this.dispatchEvent(createRequestActivationEvent());\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n}\n"]}
|
package/list/list-item.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { __decorate } from "tslib";
|
|
7
7
|
import { customElement } from 'lit/decorators.js';
|
|
8
|
-
import { styles as forcedColors } from './internal/listitem/forced-colors-styles.css.js';
|
|
9
8
|
import { ListItemEl as ListItem } from './internal/listitem/list-item.js';
|
|
10
9
|
import { styles } from './internal/listitem/list-item-styles.css.js';
|
|
11
10
|
/**
|
|
@@ -56,7 +55,7 @@ import { styles } from './internal/listitem/list-item-styles.css.js';
|
|
|
56
55
|
*/
|
|
57
56
|
export let MdListItem = class MdListItem extends ListItem {
|
|
58
57
|
};
|
|
59
|
-
MdListItem.styles = [styles
|
|
58
|
+
MdListItem.styles = [styles];
|
|
60
59
|
MdListItem = __decorate([
|
|
61
60
|
customElement('md-list-item')
|
|
62
61
|
], MdListItem);
|
package/list/list-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,UAAU,IAAI,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAC,MAAM,EAAC,MAAM,6CAA6C,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEI,WAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,QAAQ;;AACtB,iBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AADvB,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAEtB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {ListItemEl as ListItem} from './internal/listitem/list-item.js';\nimport {styles} from './internal/listitem/list-item-styles.css.js';\n\nexport {ListItemType} from './internal/listitem/list-item.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-list-item': MdListItem;\n }\n}\n\n/**\n * @summary\n * Lists are continuous, vertical indexes of text or images. Items are placed\n * inside the list.\n *\n * @description\n * Lists consist of one or more list items, and can contain actions represented\n * by icons and text. List items come in three sizes: one-line, two-line, and\n * three-line.\n *\n * __Takeaways:__\n *\n * - Lists should be sorted in logical ways that make content easy to scan, such\n * as alphabetical, numerical, chronological, or by user preference.\n * - Lists present content in a way that makes it easy to identify a specific\n * item in a collection and act on it.\n * - Lists should present icons, text, and actions in a consistent format.\n *\n * Acceptable slot child variants are:\n *\n * - `video[slot=start-video]`\n * - `video[slot=start-video-large]`\n * - `img,span[slot=start-avatar]`\n * - `img[slot=start-image]`\n * - `md-icon[slot=start-icon]`\n * - `svg[slot=start-icon]`\n * - `img[slot=start-icon]`\n * - `md-icon[slot=end-icon]`\n * - `svg[slot=end-icon]`\n * - `img[slot=end-icon]`\n *\n * @example\n * ```html\n * <md-list-item\n * headline=\"User Name\"\n * supportingText=\"user@name.com\">\n * <md-icon slot=\"start-icon\">account_circle</md-icon>\n * <md-icon slot=\"end-icon\">check</md-icon>\n * </md-list-item>\n * ```\n *\n * @example\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-list-item')\nexport class MdListItem extends ListItem {\n static override styles = [styles];\n}\n"]}
|
package/menu/internal/_menu.scss
CHANGED
|
@@ -60,6 +60,12 @@ export interface MenuItemControllerConfig {
|
|
|
60
60
|
* A function that returns the headline element of the menu item.
|
|
61
61
|
*/
|
|
62
62
|
getHeadlineElements: () => HTMLElement[];
|
|
63
|
+
/**
|
|
64
|
+
* The HTML Element that accepts user interactions like click. Used for
|
|
65
|
+
* occasions like programmatically clicking anchor tags when `Enter` is
|
|
66
|
+
* pressed.
|
|
67
|
+
*/
|
|
68
|
+
getInteractiveElement: () => HTMLElement | null;
|
|
63
69
|
}
|
|
64
70
|
/**
|
|
65
71
|
* A controller that provides most functionality of an element that implements
|
|
@@ -69,6 +75,7 @@ export declare class MenuItemController implements ReactiveController {
|
|
|
69
75
|
private readonly host;
|
|
70
76
|
private internalTypeaheadText;
|
|
71
77
|
private readonly getHeadlineElements;
|
|
78
|
+
private readonly getInteractiveElement;
|
|
72
79
|
/**
|
|
73
80
|
* @param host The MenuItem in which to attach this controller to.
|
|
74
81
|
* @param config The object that configures this controller's behavior.
|
|
@@ -30,6 +30,13 @@ export class MenuItemController {
|
|
|
30
30
|
* menu.
|
|
31
31
|
*/
|
|
32
32
|
this.onKeydown = (event) => {
|
|
33
|
+
// Check if the interactive element is an anchor tag. If so, click it.
|
|
34
|
+
if (this.host.href && event.code === 'Enter') {
|
|
35
|
+
const interactiveElement = this.getInteractiveElement();
|
|
36
|
+
if (interactiveElement instanceof HTMLAnchorElement) {
|
|
37
|
+
interactiveElement.click();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
33
40
|
if (this.host.keepOpen || event.defaultPrevented)
|
|
34
41
|
return;
|
|
35
42
|
const keyCode = event.code;
|
|
@@ -38,8 +45,9 @@ export class MenuItemController {
|
|
|
38
45
|
this.host.dispatchEvent(createDefaultCloseMenuEvent(this.host, { kind: CloseReason.KEYDOWN, key: keyCode }));
|
|
39
46
|
}
|
|
40
47
|
};
|
|
41
|
-
const { getHeadlineElements, } = config;
|
|
48
|
+
const { getHeadlineElements, getInteractiveElement, } = config;
|
|
42
49
|
this.getHeadlineElements = getHeadlineElements;
|
|
50
|
+
this.getInteractiveElement = getInteractiveElement;
|
|
43
51
|
this.host.addController(this);
|
|
44
52
|
}
|
|
45
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuItemController.js","sourceRoot":"","sources":["menuItemController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,WAAW,EAAE,2BAA2B,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"menuItemController.js","sourceRoot":"","sources":["menuItemController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,WAAW,EAAE,2BAA2B,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AA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AAC;IAED,UAAU;QACR,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAClB,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;SACzB;IACH,CAAC;IAoCD;;OAEG;IACH,gBAAgB,CAAC,IAAY;QAC3B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACpC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController, ReactiveControllerHost} from 'lit';\n\nimport {CloseReason, createDefaultCloseMenuEvent, isClosableKey} from './shared.js';\n\n/**\n * Interface specific to menu item and not HTMLElement.\n *\n * NOTE: required properties are expected to be reactive.\n */\ninterface MenuItemAdditions {\n /**\n * Whether or not the item is in the disabled state.\n */\n disabled: boolean;\n /**\n * The text of the item that will be used for typeahead. If not set, defaults\n * to the textContent of the element slotted into the headline.\n */\n typeaheadText: string;\n /**\n * Whether or not the item is in the selected visual state.\n */\n selected: boolean;\n /**\n * Sets the behavior and role of the menu item, defaults to \"menuitem\".\n */\n type: MenuItemType;\n /**\n * Whether it should keep the menu open after click.\n */\n keepOpen?: boolean;\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n href?: string;\n /**\n * Focuses the item.\n */\n focus: () => void;\n}\n\n/**\n * The interface of every menu item interactive with a menu. All menu items\n * should implement this interface to be compatible with md-menu. Additionally\n * it should have the `md-menu-item` attribute set.\n *\n * NOTE, the required properties are recommended to be reactive properties.\n */\nexport type MenuItem = MenuItemAdditions&HTMLElement;\n\n/**\n * Supported behaviors for a menu item.\n */\nexport type MenuItemType = 'menuitem'|'option'|'button'|'link';\n\n/**\n * The options used to inialize MenuItemController.\n */\nexport interface MenuItemControllerConfig {\n /**\n * A function that returns the headline element of the menu item.\n */\n getHeadlineElements: () => HTMLElement[];\n\n /**\n * The HTML Element that accepts user interactions like click. Used for\n * occasions like programmatically clicking anchor tags when `Enter` is\n * pressed.\n */\n getInteractiveElement: () => HTMLElement | null;\n}\n\n/**\n * A controller that provides most functionality of an element that implements\n * the MenuItem interface.\n */\nexport class MenuItemController implements ReactiveController {\n private internalTypeaheadText: string|null = null;\n private readonly getHeadlineElements:\n MenuItemControllerConfig['getHeadlineElements'];\n private readonly getInteractiveElement:\n MenuItemControllerConfig['getInteractiveElement'];\n\n /**\n * @param host The MenuItem in which to attach this controller to.\n * @param config The object that configures this controller's behavior.\n */\n constructor(\n private readonly host: ReactiveControllerHost&MenuItem,\n config: MenuItemControllerConfig) {\n const {\n getHeadlineElements,\n getInteractiveElement,\n } = config;\n this.getHeadlineElements = getHeadlineElements;\n this.getInteractiveElement = getInteractiveElement;\n this.host.addController(this);\n }\n\n /**\n * The text that is selectable via typeahead. If not set, defaults to the\n * innerText of the item slotted into the `\"headline\"` slot.\n */\n get typeaheadText() {\n if (this.internalTypeaheadText !== null) {\n return this.internalTypeaheadText;\n }\n\n const headlineElements = this.getHeadlineElements();\n\n const textParts: string[] = [];\n headlineElements.forEach((headlineElement) => {\n if (headlineElement.textContent && headlineElement.textContent.trim()) {\n textParts.push(headlineElement.textContent.trim());\n }\n });\n\n return textParts.join(' ');\n }\n\n /**\n * The recommended tag name to render as the list item.\n */\n get tagName() {\n const type = this.host.type;\n\n switch (type) {\n case 'link':\n return 'a' as const;\n case 'button':\n return 'button' as const;\n default:\n case 'menuitem':\n case 'option':\n return 'li' as const;\n }\n }\n\n /**\n * The recommended role of the menu item.\n */\n get role() {\n return this.host.type === 'option' ? 'option' : 'menuitem';\n }\n\n hostConnected() {\n this.host.toggleAttribute('md-menu-item', true);\n }\n\n hostUpdate() {\n if (this.host.href) {\n this.host.type = 'link';\n }\n }\n\n /**\n * Bind this click listener to the interactive element. Handles closing the\n * menu.\n */\n onClick = () => {\n if (this.host.keepOpen) return;\n\n this.host.dispatchEvent(createDefaultCloseMenuEvent(\n this.host, {kind: CloseReason.CLICK_SELECTION}));\n };\n\n /**\n * Bind this click listener to the interactive element. Handles closing the\n * menu.\n */\n onKeydown = (event: KeyboardEvent) => {\n // Check if the interactive element is an anchor tag. If so, click it.\n if (this.host.href && event.code === 'Enter') {\n const interactiveElement = this.getInteractiveElement();\n if (interactiveElement instanceof HTMLAnchorElement) {\n interactiveElement.click();\n }\n }\n\n if (this.host.keepOpen || event.defaultPrevented) return;\n const keyCode = event.code;\n\n if (!event.defaultPrevented && isClosableKey(keyCode)) {\n event.preventDefault();\n this.host.dispatchEvent(createDefaultCloseMenuEvent(\n this.host, {kind: CloseReason.KEYDOWN, key: keyCode}));\n }\n };\n\n /**\n * Use to set the typeaheadText when it changes.\n */\n setTypeaheadText(text: string) {\n this.internalTypeaheadText = text;\n }\n}"]}
|
|
@@ -56,6 +56,10 @@ export class SurfacePositionController {
|
|
|
56
56
|
if (!surfaceEl || !anchorEl) {
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
+
// Store these before we potentially resize the window with the next set of
|
|
60
|
+
// lines
|
|
61
|
+
const windowInnerWidth = window.innerWidth;
|
|
62
|
+
const windowInnerHeight = window.innerHeight;
|
|
59
63
|
// Paint the surface transparently so that we can get the position and the
|
|
60
64
|
// rect info of the surface.
|
|
61
65
|
this.surfaceStylesInternal = {
|
|
@@ -113,7 +117,8 @@ export class SurfacePositionController {
|
|
|
113
117
|
anchorBlock,
|
|
114
118
|
surfaceBlock,
|
|
115
119
|
yOffset,
|
|
116
|
-
positioning
|
|
120
|
+
positioning,
|
|
121
|
+
windowInnerHeight,
|
|
117
122
|
});
|
|
118
123
|
// If the surface should be out of bounds in the block direction, flip the
|
|
119
124
|
// surface and anchor corner block values and recalculate
|
|
@@ -126,7 +131,8 @@ export class SurfacePositionController {
|
|
|
126
131
|
anchorBlock: flippedAnchorBlock,
|
|
127
132
|
surfaceBlock: flippedSurfaceBlock,
|
|
128
133
|
yOffset,
|
|
129
|
-
positioning
|
|
134
|
+
positioning,
|
|
135
|
+
windowInnerHeight,
|
|
130
136
|
});
|
|
131
137
|
// In the case that the flipped verion would require less out of bounds
|
|
132
138
|
// correcting, use the flipped corner block values
|
|
@@ -146,6 +152,7 @@ export class SurfacePositionController {
|
|
|
146
152
|
xOffset,
|
|
147
153
|
positioning,
|
|
148
154
|
isLTR,
|
|
155
|
+
windowInnerWidth,
|
|
149
156
|
});
|
|
150
157
|
// If the surface should be out of bounds in the inline direction, flip the
|
|
151
158
|
// surface and anchor corner inline values and recalculate
|
|
@@ -160,6 +167,7 @@ export class SurfacePositionController {
|
|
|
160
167
|
xOffset,
|
|
161
168
|
positioning,
|
|
162
169
|
isLTR,
|
|
170
|
+
windowInnerWidth,
|
|
163
171
|
});
|
|
164
172
|
// In the case that the flipped verion would require less out of bounds
|
|
165
173
|
// correcting, use the flipped corner inline values
|
|
@@ -203,7 +211,7 @@ export class SurfacePositionController {
|
|
|
203
211
|
* for the surface in the block direction.
|
|
204
212
|
*/
|
|
205
213
|
calculateBlock(config) {
|
|
206
|
-
const { surfaceRect, anchorRect, anchorBlock, surfaceBlock, yOffset, positioning, } = config;
|
|
214
|
+
const { surfaceRect, anchorRect, anchorBlock, surfaceBlock, yOffset, positioning, windowInnerHeight, } = config;
|
|
207
215
|
// We use number booleans to multiply values rather than `if` / ternary
|
|
208
216
|
// statements because it _heavily_ cuts down on nesting and readability
|
|
209
217
|
const relativeToWindow = positioning === 'fixed' ? 1 : 0;
|
|
@@ -214,10 +222,10 @@ export class SurfacePositionController {
|
|
|
214
222
|
const blockAnchorOffset = isOneBlockEnd * anchorRect.height + yOffset;
|
|
215
223
|
// The absolute block position of the anchor relative to window
|
|
216
224
|
const blockTopLayerOffset = isSurfaceBlockStart * anchorRect.top +
|
|
217
|
-
isSurfaceBlockEnd * (
|
|
225
|
+
isSurfaceBlockEnd * (windowInnerHeight - anchorRect.bottom);
|
|
218
226
|
// If the surface's block would be out of bounds of the window, move it back
|
|
219
227
|
// in
|
|
220
|
-
const blockOutOfBoundsCorrection = Math.abs(Math.min(0,
|
|
228
|
+
const blockOutOfBoundsCorrection = Math.abs(Math.min(0, windowInnerHeight - blockTopLayerOffset - blockAnchorOffset -
|
|
221
229
|
surfaceRect.height));
|
|
222
230
|
// The block logical value of the surface
|
|
223
231
|
const blockInset = relativeToWindow * blockTopLayerOffset + blockAnchorOffset;
|
|
@@ -229,7 +237,7 @@ export class SurfacePositionController {
|
|
|
229
237
|
* for the surface in the inline direction.
|
|
230
238
|
*/
|
|
231
239
|
calculateInline(config) {
|
|
232
|
-
const { isLTR: isLTRBool, surfaceInline, anchorInline, anchorRect, surfaceRect, xOffset, positioning, } = config;
|
|
240
|
+
const { isLTR: isLTRBool, surfaceInline, anchorInline, anchorRect, surfaceRect, xOffset, positioning, windowInnerWidth, } = config;
|
|
233
241
|
// We use number booleans to multiply values rather than `if` / ternary
|
|
234
242
|
// statements because it _heavily_ cuts down on nesting and readability
|
|
235
243
|
const relativeToWindow = positioning === 'fixed' ? 1 : 0;
|
|
@@ -242,15 +250,15 @@ export class SurfacePositionController {
|
|
|
242
250
|
const inlineAnchorOffset = isOneInlineEnd * anchorRect.width + xOffset;
|
|
243
251
|
// The inline position of the anchor relative to window in LTR
|
|
244
252
|
const inlineTopLayerOffsetLTR = isSurfaceInlineStart * anchorRect.left +
|
|
245
|
-
isSurfaceInlineEnd * (
|
|
253
|
+
isSurfaceInlineEnd * (windowInnerWidth - anchorRect.right);
|
|
246
254
|
// The inline position of the anchor relative to window in RTL
|
|
247
|
-
const inlineTopLayerOffsetRTL = isSurfaceInlineStart * (
|
|
255
|
+
const inlineTopLayerOffsetRTL = isSurfaceInlineStart * (windowInnerWidth - anchorRect.right) +
|
|
248
256
|
isSurfaceInlineEnd * anchorRect.left;
|
|
249
257
|
// The inline position of the anchor relative to window
|
|
250
258
|
const inlineTopLayerOffset = isLTR * inlineTopLayerOffsetLTR + isRTL * inlineTopLayerOffsetRTL;
|
|
251
259
|
// If the surface's inline would be out of bounds of the window, move it
|
|
252
260
|
// back in
|
|
253
|
-
const inlineOutOfBoundsCorrection = Math.abs(Math.min(0,
|
|
261
|
+
const inlineOutOfBoundsCorrection = Math.abs(Math.min(0, windowInnerWidth - inlineTopLayerOffset - inlineAnchorOffset -
|
|
254
262
|
surfaceRect.width));
|
|
255
263
|
// The inline logical value of the surface
|
|
256
264
|
const inlineInset = relativeToWindow * inlineTopLayerOffset + inlineAnchorOffset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfacePositionController.js","sourceRoot":"","sources":["surfacePositionController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;CACd,CAAC;AA0FX;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IAUpC;;;;OAIG;IACH,YACqB,IAA4B,EAC5B,aAAwD;QADxD,SAAI,GAAJ,IAAI,CAAwB;QAC5B,kBAAa,GAAb,aAAa,CAA2C;QAhB7E,8CAA8C;QACtC,0BAAqB,GAAc;YACzC,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,wEAAwE;QACxE,+CAA+C;QACvC,eAAU,GAAwC,EAAC,MAAM,EAAE,KAAK,EACjC,CAAC;QAWtC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,YAAY,EAAE,eAAe,EAC7B,aAAa,EAAE,gBAAgB,EAC/B,WAAW,EACX,OAAO,EACP,OAAO,EACP,kBAAkB,GACnB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACzB,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,EAA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AU,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAEtC,IAAI,KAAK,CAAC,MAAM,EAAE;gBAChB,sEAAsE;gBACtE,kBAAkB;gBAClB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBAExB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACtB,KAAK,CAAC,MAAM,EAAE,CAAC;aAChB;iBAAM,IAAI,WAAW,EAAE;gBACtB,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC;gBAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,KAAK,CAAC,OAAO,EAAE,CAAC;aACjB;SACF;IACH,CAAC;IAED;;OAEG;IACK,KAAK;QACX,IAAI,CAAC,qBAAqB,GAAG;YAC3B,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController, ReactiveControllerHost} from 'lit';\nimport {StyleInfo} from 'lit/directives/style-map.js';\n\n/**\n * An enum of supported Menu corners\n */\n// tslint:disable-next-line:enforce-name-casing We are mimicking enum style\nexport const Corner = {\n END_START: 'end-start',\n END_END: 'end-end',\n START_START: 'start-start',\n START_END: 'start-end',\n} as const;\n\n/**\n * A corner of a box in the standard logical property style of <block>_<inline>\n */\nexport type Corner = typeof Corner[keyof typeof Corner];\n\n/**\n * An interface that provides a method to customize the rect from which to\n * calculate the anchor positioning. Useful for when you want a surface to\n * anchor to an element in your shadow DOM rather than the host element.\n */\nexport interface SurfacePositionTarget extends HTMLElement {\n getSurfacePositionClientRect?: () => DOMRect;\n}\n\n/**\n * The configurable options for the surface position controller.\n */\nexport interface SurfacePositionControllerProperties {\n /**\n * The corner of the anchor to align the surface's position.\n */\n anchorCorner: Corner;\n /**\n * The corner of the surface to align to the given anchor corner.\n */\n surfaceCorner: Corner;\n /**\n * The HTMLElement reference of the surface to be positioned.\n */\n surfaceEl: SurfacePositionTarget|null;\n /**\n * The HTMLElement reference of the anchor to align to.\n */\n anchorEl: SurfacePositionTarget|null;\n /**\n * Whether the positioning algorithim should calculate relative to the parent\n * of the anchor element (absolute) or relative to the window (fixed).\n *\n * Examples for `position = 'fixed'`:\n *\n * - If there is no `position:relative` in the given parent tree and the\n * surface is `position:absolute`\n * - If the surface is `position:fixed`\n * - If the surface is in the \"top layer\"\n * - The anchor and the surface do not share a common `position:relative`\n * ancestor\n */\n positioning: 'absolute'|'fixed';\n /**\n * Whether or not the surface should be \"open\" and visible\n */\n isOpen: boolean;\n /**\n * The number of pixels in which to offset from the inline axis relative to\n * logical property.\n *\n * Positive is right in LTR and left in RTL.\n */\n xOffset: number;\n /**\n * The number of pixes in which to offset the block axis.\n *\n * Positive is down and negative is up.\n */\n yOffset: number;\n /**\n * The strategy to follow when repositioning the menu to stay inside the\n * viewport. \"move\" will simply move the surface to stay in the viewport.\n * \"resize\" will attempt to resize the surface.\n *\n * Both strategies will still attempt to flip the anchor and surface corners.\n */\n repositionStrategy: 'move'|'resize';\n /**\n * A function to call after the surface has been positioned.\n */\n onOpen: () => void;\n /**\n * A function to call before the surface should be closed. (A good time to\n * perform animations while the surface is still visible)\n */\n beforeClose: () => Promise<void>;\n /**\n * A function to call after the surface has been closed.\n */\n onClose: () => void;\n}\n\n/**\n * Given a surface, an anchor, corners, and some options, this surface will\n * calculate the position of a surface to align the two given corners and keep\n * the surface inside the window viewport. It also provides a StyleInfo map that\n * can be applied to the surface to handle visiblility and position.\n */\nexport class SurfacePositionController implements ReactiveController {\n // The current styles to apply to the surface.\n private surfaceStylesInternal: StyleInfo = {\n 'display': 'none',\n };\n // Previous values stored for change detection. Open change detection is\n // calculated separately so initialize it here.\n private lastValues: SurfacePositionControllerProperties = {isOpen: false} as\n SurfacePositionControllerProperties;\n\n /**\n * @param host The host to connect the controller to.\n * @param getProperties A function that returns the properties for the\n * controller.\n */\n constructor(\n private readonly host: ReactiveControllerHost,\n private readonly getProperties: () => SurfacePositionControllerProperties,\n ) {\n this.host.addController(this);\n }\n\n /**\n * The StyleInfo map to apply to the surface via Lit's stylemap\n */\n get surfaceStyles() {\n return this.surfaceStylesInternal;\n }\n\n /**\n * Calculates the surface's new position required so that the surface's\n * `surfaceCorner` aligns to the anchor's `anchorCorner` while keeping the\n * surface inside the window viewport. This positioning also respects RTL by\n * checking `getComputedStyle()` on the surface element.\n */\n async position() {\n const {\n surfaceEl,\n anchorEl,\n anchorCorner: anchorCornerRaw,\n surfaceCorner: surfaceCornerRaw,\n positioning,\n xOffset,\n yOffset,\n repositionStrategy,\n } = this.getProperties();\n const anchorCorner = anchorCornerRaw.toLowerCase().trim();\n const surfaceCorner = surfaceCornerRaw.toLowerCase().trim();\n\n if (!surfaceEl || !anchorEl) {\n return;\n }\n\n // Paint the surface transparently so that we can get the position and the\n // rect info of the surface.\n this.surfaceStylesInternal = {\n 'display': 'block',\n 'opacity': '0',\n };\n\n // Wait for it to be visible.\n this.host.requestUpdate();\n await this.host.updateComplete;\n\n const surfaceRect = surfaceEl.getSurfacePositionClientRect ?\n surfaceEl.getSurfacePositionClientRect() :\n surfaceEl.getBoundingClientRect();\n const anchorRect = anchorEl.getSurfacePositionClientRect ?\n anchorEl.getSurfacePositionClientRect() :\n anchorEl.getBoundingClientRect();\n const [surfaceBlock, surfaceInline] =\n surfaceCorner.split('-') as Array<'start'|'end'>;\n const [anchorBlock, anchorInline] =\n anchorCorner.split('-') as Array<'start'|'end'>;\n\n // LTR depends on the direction of the SURFACE not the anchor.\n const isLTR =\n getComputedStyle(surfaceEl as HTMLElement).direction === 'ltr';\n\n /*\n * A diagram that helps describe some of the variables used in the following\n * calculations.\n *\n * ┌───── inline/blockTopLayerOffset\n * │ │\n * │ ┌─▼───┐ Window\n * │ ┌┼─────┴────────────────────────┐\n * │ ││ │\n * └──► ││ ┌──inline/blockAnchorOffset │\n * ││ │ │ │\n * └┤ │ ┌──▼───┐ │\n * │ │ ┌┼──────┤ │\n * │ └─►│Anchor│ │\n * │ └┴──────┘ │\n * │ │\n * │ ┌────────────────────────┼────┐\n * │ │ Surface │ │\n * │ │ │ │\n * │ │ │ │\n * │ │ │ │\n * │ │ │ │\n * │ │ │ │\n * └─────┼────────────────────────┘ ├┐\n * │ inline/blockOOBCorrection ││\n * │ │ ││\n * │ ├──►││\n * │ │ ││\n * └────────────────────────┐▼───┼┘\n * └────┘\n */\n\n // Calculate the block positioning properties\n let {blockInset, blockOutOfBoundsCorrection, surfaceBlockProperty} =\n this.calculateBlock({\n surfaceRect,\n anchorRect,\n anchorBlock,\n surfaceBlock,\n yOffset,\n positioning\n });\n\n // If the surface should be out of bounds in the block direction, flip the\n // surface and anchor corner block values and recalculate\n if (blockOutOfBoundsCorrection) {\n const flippedSurfaceBlock = surfaceBlock === 'start' ? 'end' : 'start';\n const flippedAnchorBlock = anchorBlock === 'start' ? 'end' : 'start';\n\n const flippedBlock = this.calculateBlock({\n surfaceRect,\n anchorRect,\n anchorBlock: flippedAnchorBlock,\n surfaceBlock: flippedSurfaceBlock,\n yOffset,\n positioning\n });\n\n // In the case that the flipped verion would require less out of bounds\n // correcting, use the flipped corner block values\n if (blockOutOfBoundsCorrection >\n flippedBlock.blockOutOfBoundsCorrection) {\n blockInset = flippedBlock.blockInset;\n blockOutOfBoundsCorrection = flippedBlock.blockOutOfBoundsCorrection;\n surfaceBlockProperty = flippedBlock.surfaceBlockProperty;\n }\n }\n\n // Calculate the inline positioning properties\n let {inlineInset, inlineOutOfBoundsCorrection, surfaceInlineProperty} =\n this.calculateInline({\n surfaceRect,\n anchorRect,\n anchorInline,\n surfaceInline,\n xOffset,\n positioning,\n isLTR,\n });\n\n // If the surface should be out of bounds in the inline direction, flip the\n // surface and anchor corner inline values and recalculate\n if (inlineOutOfBoundsCorrection) {\n const flippedSurfaceInline = surfaceInline === 'start' ? 'end' : 'start';\n const flippedAnchorInline = anchorInline === 'start' ? 'end' : 'start';\n\n const flippedInline = this.calculateInline({\n surfaceRect,\n anchorRect,\n anchorInline: flippedAnchorInline,\n surfaceInline: flippedSurfaceInline,\n xOffset,\n positioning,\n isLTR,\n });\n\n // In the case that the flipped verion would require less out of bounds\n // correcting, use the flipped corner inline values\n if (Math.abs(inlineOutOfBoundsCorrection) >\n Math.abs(flippedInline.inlineOutOfBoundsCorrection)) {\n inlineInset = flippedInline.inlineInset;\n inlineOutOfBoundsCorrection = flippedInline.inlineOutOfBoundsCorrection;\n surfaceInlineProperty = flippedInline.surfaceInlineProperty;\n }\n }\n\n // If we are simply repositioning the surface back inside the viewport,\n // subtract the out of bounds correction values from the positioning.\n if (repositionStrategy === 'move') {\n blockInset = blockInset - blockOutOfBoundsCorrection;\n inlineInset = inlineInset - inlineOutOfBoundsCorrection;\n }\n\n this.surfaceStylesInternal = {\n 'display': 'block',\n 'opacity': '1',\n [surfaceBlockProperty]: `${blockInset}px`,\n [surfaceInlineProperty]: `${inlineInset}px`,\n };\n\n // In the case that we are resizing the surface to stay inside the viewport\n // we need to set height and width on the surface.\n if (repositionStrategy === 'resize') {\n // Add a height property to the styles if there is block height correction\n if (blockOutOfBoundsCorrection) {\n this.surfaceStylesInternal['height'] =\n `${surfaceRect.height - blockOutOfBoundsCorrection}px`;\n }\n\n // Add a width property to the styles if there is block height correction\n if (inlineOutOfBoundsCorrection) {\n this.surfaceStylesInternal['width'] =\n `${surfaceRect.width - inlineOutOfBoundsCorrection}px`;\n }\n }\n\n this.host.requestUpdate();\n }\n\n /**\n * Calculates the css property, the inset, and the out of bounds correction\n * for the surface in the block direction.\n */\n private calculateBlock(config: {\n surfaceRect: DOMRect,\n anchorRect: DOMRect,\n anchorBlock: 'start'|'end',\n surfaceBlock: 'start'|'end',\n yOffset: number,\n positioning: 'absolute'|'fixed',\n }) {\n const {\n surfaceRect,\n anchorRect,\n anchorBlock,\n surfaceBlock,\n yOffset,\n positioning,\n } = config;\n // We use number booleans to multiply values rather than `if` / ternary\n // statements because it _heavily_ cuts down on nesting and readability\n const relativeToWindow = positioning === 'fixed' ? 1 : 0;\n const isSurfaceBlockStart = surfaceBlock === 'start' ? 1 : 0;\n const isSurfaceBlockEnd = surfaceBlock === 'end' ? 1 : 0;\n const isOneBlockEnd = anchorBlock !== surfaceBlock ? 1 : 0;\n\n // Whether or not to apply the height of the anchor\n const blockAnchorOffset = isOneBlockEnd * anchorRect.height + yOffset;\n // The absolute block position of the anchor relative to window\n const blockTopLayerOffset = isSurfaceBlockStart * anchorRect.top +\n isSurfaceBlockEnd * (window.innerHeight - anchorRect.bottom);\n // If the surface's block would be out of bounds of the window, move it back\n // in\n const blockOutOfBoundsCorrection = Math.abs(Math.min(\n 0,\n window.innerHeight - blockTopLayerOffset - blockAnchorOffset -\n surfaceRect.height));\n\n\n // The block logical value of the surface\n const blockInset =\n relativeToWindow * blockTopLayerOffset + blockAnchorOffset;\n\n const surfaceBlockProperty =\n surfaceBlock === 'start' ? 'inset-block-start' : 'inset-block-end';\n\n return {blockInset, blockOutOfBoundsCorrection, surfaceBlockProperty};\n }\n\n /**\n * Calculates the css property, the inset, and the out of bounds correction\n * for the surface in the inline direction.\n */\n private calculateInline(config: {\n isLTR: boolean,\n surfaceInline: 'start'|'end',\n anchorInline: 'start'|'end',\n anchorRect: DOMRect,\n surfaceRect: DOMRect,\n xOffset: number,\n positioning: 'absolute'|'fixed',\n }) {\n const {\n isLTR: isLTRBool,\n surfaceInline,\n anchorInline,\n anchorRect,\n surfaceRect,\n xOffset,\n positioning,\n } = config;\n // We use number booleans to multiply values rather than `if` / ternary\n // statements because it _heavily_ cuts down on nesting and readability\n const relativeToWindow = positioning === 'fixed' ? 1 : 0;\n const isLTR = isLTRBool ? 1 : 0;\n const isRTL = isLTRBool ? 0 : 1;\n const isSurfaceInlineStart = surfaceInline === 'start' ? 1 : 0;\n const isSurfaceInlineEnd = surfaceInline === 'end' ? 1 : 0;\n const isOneInlineEnd = anchorInline !== surfaceInline ? 1 : 0;\n\n // Whether or not to apply the width of the anchor\n const inlineAnchorOffset = isOneInlineEnd * anchorRect.width + xOffset;\n // The inline position of the anchor relative to window in LTR\n const inlineTopLayerOffsetLTR = isSurfaceInlineStart * anchorRect.left +\n isSurfaceInlineEnd * (window.innerWidth - anchorRect.right);\n // The inline position of the anchor relative to window in RTL\n const inlineTopLayerOffsetRTL =\n isSurfaceInlineStart * (window.innerWidth - anchorRect.right) +\n isSurfaceInlineEnd * anchorRect.left;\n // The inline position of the anchor relative to window\n const inlineTopLayerOffset =\n isLTR * inlineTopLayerOffsetLTR + isRTL * inlineTopLayerOffsetRTL;\n\n // If the surface's inline would be out of bounds of the window, move it\n // back in\n const inlineOutOfBoundsCorrection = Math.abs(Math.min(\n 0,\n window.innerWidth - inlineTopLayerOffset - inlineAnchorOffset -\n surfaceRect.width));\n\n\n // The inline logical value of the surface\n const inlineInset =\n relativeToWindow * inlineTopLayerOffset + inlineAnchorOffset;\n\n const surfaceInlineProperty =\n surfaceInline === 'start' ? 'inset-inline-start' : 'inset-inline-end';\n\n return {\n inlineInset,\n inlineOutOfBoundsCorrection,\n surfaceInlineProperty,\n };\n }\n\n hostUpdate() {\n this.onUpdate();\n }\n\n hostUpdated() {\n this.onUpdate();\n }\n\n /**\n * Checks whether the properties passed into the controller have changed since\n * the last positioning. If so, it will reposition if the surface is open or\n * close it if the surface should close.\n */\n private async onUpdate() {\n const props = this.getProperties();\n let hasChanged = false;\n for (const [key, value] of Object.entries(props)) {\n // tslint:disable-next-line\n hasChanged = hasChanged || (value !== (this.lastValues as any)[key]);\n if (hasChanged) break;\n }\n\n const openChanged = this.lastValues.isOpen !== props.isOpen;\n const hasAnchor = !!props.anchorEl;\n const hasSurface = !!props.surfaceEl;\n\n if (hasChanged && hasAnchor && hasSurface) {\n // Only update isOpen, because if it's closed, we do not want to waste\n // time on a useless reposition calculation. So save the other \"dirty\"\n // values until next time it opens.\n this.lastValues.isOpen = props.isOpen;\n\n if (props.isOpen) {\n // We are going to do a reposition, so save the prop values for future\n // dirty checking.\n this.lastValues = props;\n\n await this.position();\n props.onOpen();\n } else if (openChanged) {\n await props.beforeClose();\n this.close();\n props.onClose();\n }\n }\n }\n\n /**\n * Hides the surface.\n */\n private close() {\n this.surfaceStylesInternal = {\n 'display': 'none',\n };\n this.host.requestUpdate();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"surfacePositionController.js","sourceRoot":"","sources":["surfacePositionController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;CACd,CAAC;AA0FX;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IAUpC;;;;OAIG;IACH,YACqB,IAA4B,EAC5B,aAAwD;QADxD,SAAI,GAAJ,IAAI,CAAwB;QAC5B,kBAAa,GAAb,aAAa,CAA2C;QAhB7E,8CAA8C;QACtC,0BAAqB,GAAc;YACzC,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,wEAAwE;QACxE,+CAA+C;QACvC,eAAU,GAAwC,EAAC,MAAM,EAAE,KAAK,EACjC,CAAC;QAWtC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,YAAY,EAAE,eAAe,EAC7B,aAAa,EAAE,gBAAgB,EAC/B,WAAW,EACX,OAAO,EACP,OAAO,EACP,kBAAkB,GACnB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACzB,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC1D,MAAM,aAAa,GAAG,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AK,CAAC,SAAS,CAAC;QAErC,IAAI,UAAU,IAAI,SAAS,IAAI,UAAU,EAAE;YACzC,sEAAsE;YACtE,sEAAsE;YACtE,mCAAmC;YACnC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAEtC,IAAI,KAAK,CAAC,MAAM,EAAE;gBAChB,sEAAsE;gBACtE,kBAAkB;gBAClB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBAExB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACtB,KAAK,CAAC,MAAM,EAAE,CAAC;aAChB;iBAAM,IAAI,WAAW,EAAE;gBACtB,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC;gBAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,KAAK,CAAC,OAAO,EAAE,CAAC;aACjB;SACF;IACH,CAAC;IAED;;OAEG;IACK,KAAK;QACX,IAAI,CAAC,qBAAqB,GAAG;YAC3B,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController, ReactiveControllerHost} from 'lit';\nimport {StyleInfo} from 'lit/directives/style-map.js';\n\n/**\n * An enum of supported Menu corners\n */\n// tslint:disable-next-line:enforce-name-casing We are mimicking enum style\nexport const Corner = {\n END_START: 'end-start',\n END_END: 'end-end',\n START_START: 'start-start',\n START_END: 'start-end',\n} as const;\n\n/**\n * A corner of a box in the standard logical property style of <block>_<inline>\n */\nexport type Corner = typeof Corner[keyof typeof Corner];\n\n/**\n * An interface that provides a method to customize the rect from which to\n * calculate the anchor positioning. Useful for when you want a surface to\n * anchor to an element in your shadow DOM rather than the host element.\n */\nexport interface SurfacePositionTarget extends HTMLElement {\n getSurfacePositionClientRect?: () => DOMRect;\n}\n\n/**\n * The configurable options for the surface position controller.\n */\nexport interface SurfacePositionControllerProperties {\n /**\n * The corner of the anchor to align the surface's position.\n */\n anchorCorner: Corner;\n /**\n * The corner of the surface to align to the given anchor corner.\n */\n surfaceCorner: Corner;\n /**\n * The HTMLElement reference of the surface to be positioned.\n */\n surfaceEl: SurfacePositionTarget|null;\n /**\n * The HTMLElement reference of the anchor to align to.\n */\n anchorEl: SurfacePositionTarget|null;\n /**\n * Whether the positioning algorithim should calculate relative to the parent\n * of the anchor element (absolute) or relative to the window (fixed).\n *\n * Examples for `position = 'fixed'`:\n *\n * - If there is no `position:relative` in the given parent tree and the\n * surface is `position:absolute`\n * - If the surface is `position:fixed`\n * - If the surface is in the \"top layer\"\n * - The anchor and the surface do not share a common `position:relative`\n * ancestor\n */\n positioning: 'absolute'|'fixed';\n /**\n * Whether or not the surface should be \"open\" and visible\n */\n isOpen: boolean;\n /**\n * The number of pixels in which to offset from the inline axis relative to\n * logical property.\n *\n * Positive is right in LTR and left in RTL.\n */\n xOffset: number;\n /**\n * The number of pixes in which to offset the block axis.\n *\n * Positive is down and negative is up.\n */\n yOffset: number;\n /**\n * The strategy to follow when repositioning the menu to stay inside the\n * viewport. \"move\" will simply move the surface to stay in the viewport.\n * \"resize\" will attempt to resize the surface.\n *\n * Both strategies will still attempt to flip the anchor and surface corners.\n */\n repositionStrategy: 'move'|'resize';\n /**\n * A function to call after the surface has been positioned.\n */\n onOpen: () => void;\n /**\n * A function to call before the surface should be closed. (A good time to\n * perform animations while the surface is still visible)\n */\n beforeClose: () => Promise<void>;\n /**\n * A function to call after the surface has been closed.\n */\n onClose: () => void;\n}\n\n/**\n * Given a surface, an anchor, corners, and some options, this surface will\n * calculate the position of a surface to align the two given corners and keep\n * the surface inside the window viewport. It also provides a StyleInfo map that\n * can be applied to the surface to handle visiblility and position.\n */\nexport class SurfacePositionController implements ReactiveController {\n // The current styles to apply to the surface.\n private surfaceStylesInternal: StyleInfo = {\n 'display': 'none',\n };\n // Previous values stored for change detection. Open change detection is\n // calculated separately so initialize it here.\n private lastValues: SurfacePositionControllerProperties = {isOpen: false} as\n SurfacePositionControllerProperties;\n\n /**\n * @param host The host to connect the controller to.\n * @param getProperties A function that returns the properties for the\n * controller.\n */\n constructor(\n private readonly host: ReactiveControllerHost,\n private readonly getProperties: () => SurfacePositionControllerProperties,\n ) {\n this.host.addController(this);\n }\n\n /**\n * The StyleInfo map to apply to the surface via Lit's stylemap\n */\n get surfaceStyles() {\n return this.surfaceStylesInternal;\n }\n\n /**\n * Calculates the surface's new position required so that the surface's\n * `surfaceCorner` aligns to the anchor's `anchorCorner` while keeping the\n * surface inside the window viewport. This positioning also respects RTL by\n * checking `getComputedStyle()` on the surface element.\n */\n async position() {\n const {\n surfaceEl,\n anchorEl,\n anchorCorner: anchorCornerRaw,\n surfaceCorner: surfaceCornerRaw,\n positioning,\n xOffset,\n yOffset,\n repositionStrategy,\n } = this.getProperties();\n const anchorCorner = anchorCornerRaw.toLowerCase().trim();\n const surfaceCorner = surfaceCornerRaw.toLowerCase().trim();\n\n if (!surfaceEl || !anchorEl) {\n return;\n }\n\n // Store these before we potentially resize the window with the next set of\n // lines\n const windowInnerWidth = window.innerWidth;\n const windowInnerHeight = window.innerHeight;\n\n // Paint the surface transparently so that we can get the position and the\n // rect info of the surface.\n this.surfaceStylesInternal = {\n 'display': 'block',\n 'opacity': '0',\n };\n\n // Wait for it to be visible.\n this.host.requestUpdate();\n await this.host.updateComplete;\n\n const surfaceRect = surfaceEl.getSurfacePositionClientRect ?\n surfaceEl.getSurfacePositionClientRect() :\n surfaceEl.getBoundingClientRect();\n const anchorRect = anchorEl.getSurfacePositionClientRect ?\n anchorEl.getSurfacePositionClientRect() :\n anchorEl.getBoundingClientRect();\n const [surfaceBlock, surfaceInline] =\n surfaceCorner.split('-') as Array<'start'|'end'>;\n const [anchorBlock, anchorInline] =\n anchorCorner.split('-') as Array<'start'|'end'>;\n\n // LTR depends on the direction of the SURFACE not the anchor.\n const isLTR =\n getComputedStyle(surfaceEl as HTMLElement).direction === 'ltr';\n\n /*\n * A diagram that helps describe some of the variables used in the following\n * calculations.\n *\n * ┌───── inline/blockTopLayerOffset\n * │ │\n * │ ┌─▼───┐ Window\n * │ ┌┼─────┴────────────────────────┐\n * │ ││ │\n * └──► ││ ┌──inline/blockAnchorOffset │\n * ││ │ │ │\n * └┤ │ ┌──▼───┐ │\n * │ │ ┌┼──────┤ │\n * │ └─►│Anchor│ │\n * │ └┴──────┘ │\n * │ │\n * │ ┌────────────────────────┼────┐\n * │ │ Surface │ │\n * │ │ │ │\n * │ │ │ │\n * │ │ │ │\n * │ │ │ │\n * │ │ │ │\n * └─────┼────────────────────────┘ ├┐\n * │ inline/blockOOBCorrection ││\n * │ │ ││\n * │ ├──►││\n * │ │ ││\n * └────────────────────────┐▼───┼┘\n * └────┘\n */\n\n // Calculate the block positioning properties\n let {blockInset, blockOutOfBoundsCorrection, surfaceBlockProperty} =\n this.calculateBlock({\n surfaceRect,\n anchorRect,\n anchorBlock,\n surfaceBlock,\n yOffset,\n positioning,\n windowInnerHeight,\n });\n\n // If the surface should be out of bounds in the block direction, flip the\n // surface and anchor corner block values and recalculate\n if (blockOutOfBoundsCorrection) {\n const flippedSurfaceBlock = surfaceBlock === 'start' ? 'end' : 'start';\n const flippedAnchorBlock = anchorBlock === 'start' ? 'end' : 'start';\n\n const flippedBlock = this.calculateBlock({\n surfaceRect,\n anchorRect,\n anchorBlock: flippedAnchorBlock,\n surfaceBlock: flippedSurfaceBlock,\n yOffset,\n positioning,\n windowInnerHeight,\n });\n\n // In the case that the flipped verion would require less out of bounds\n // correcting, use the flipped corner block values\n if (blockOutOfBoundsCorrection >\n flippedBlock.blockOutOfBoundsCorrection) {\n blockInset = flippedBlock.blockInset;\n blockOutOfBoundsCorrection = flippedBlock.blockOutOfBoundsCorrection;\n surfaceBlockProperty = flippedBlock.surfaceBlockProperty;\n }\n }\n\n // Calculate the inline positioning properties\n let {inlineInset, inlineOutOfBoundsCorrection, surfaceInlineProperty} =\n this.calculateInline({\n surfaceRect,\n anchorRect,\n anchorInline,\n surfaceInline,\n xOffset,\n positioning,\n isLTR,\n windowInnerWidth,\n });\n\n // If the surface should be out of bounds in the inline direction, flip the\n // surface and anchor corner inline values and recalculate\n if (inlineOutOfBoundsCorrection) {\n const flippedSurfaceInline = surfaceInline === 'start' ? 'end' : 'start';\n const flippedAnchorInline = anchorInline === 'start' ? 'end' : 'start';\n\n const flippedInline = this.calculateInline({\n surfaceRect,\n anchorRect,\n anchorInline: flippedAnchorInline,\n surfaceInline: flippedSurfaceInline,\n xOffset,\n positioning,\n isLTR,\n windowInnerWidth,\n });\n\n // In the case that the flipped verion would require less out of bounds\n // correcting, use the flipped corner inline values\n if (Math.abs(inlineOutOfBoundsCorrection) >\n Math.abs(flippedInline.inlineOutOfBoundsCorrection)) {\n inlineInset = flippedInline.inlineInset;\n inlineOutOfBoundsCorrection = flippedInline.inlineOutOfBoundsCorrection;\n surfaceInlineProperty = flippedInline.surfaceInlineProperty;\n }\n }\n\n // If we are simply repositioning the surface back inside the viewport,\n // subtract the out of bounds correction values from the positioning.\n if (repositionStrategy === 'move') {\n blockInset = blockInset - blockOutOfBoundsCorrection;\n inlineInset = inlineInset - inlineOutOfBoundsCorrection;\n }\n\n this.surfaceStylesInternal = {\n 'display': 'block',\n 'opacity': '1',\n [surfaceBlockProperty]: `${blockInset}px`,\n [surfaceInlineProperty]: `${inlineInset}px`,\n };\n\n // In the case that we are resizing the surface to stay inside the viewport\n // we need to set height and width on the surface.\n if (repositionStrategy === 'resize') {\n // Add a height property to the styles if there is block height correction\n if (blockOutOfBoundsCorrection) {\n this.surfaceStylesInternal['height'] =\n `${surfaceRect.height - blockOutOfBoundsCorrection}px`;\n }\n\n // Add a width property to the styles if there is block height correction\n if (inlineOutOfBoundsCorrection) {\n this.surfaceStylesInternal['width'] =\n `${surfaceRect.width - inlineOutOfBoundsCorrection}px`;\n }\n }\n\n this.host.requestUpdate();\n }\n\n /**\n * Calculates the css property, the inset, and the out of bounds correction\n * for the surface in the block direction.\n */\n private calculateBlock(config: {\n surfaceRect: DOMRect,\n anchorRect: DOMRect,\n anchorBlock: 'start'|'end',\n surfaceBlock: 'start'|'end',\n yOffset: number,\n positioning: 'absolute'|'fixed',\n windowInnerHeight: number,\n }) {\n const {\n surfaceRect,\n anchorRect,\n anchorBlock,\n surfaceBlock,\n yOffset,\n positioning,\n windowInnerHeight,\n } = config;\n // We use number booleans to multiply values rather than `if` / ternary\n // statements because it _heavily_ cuts down on nesting and readability\n const relativeToWindow = positioning === 'fixed' ? 1 : 0;\n const isSurfaceBlockStart = surfaceBlock === 'start' ? 1 : 0;\n const isSurfaceBlockEnd = surfaceBlock === 'end' ? 1 : 0;\n const isOneBlockEnd = anchorBlock !== surfaceBlock ? 1 : 0;\n\n // Whether or not to apply the height of the anchor\n const blockAnchorOffset = isOneBlockEnd * anchorRect.height + yOffset;\n // The absolute block position of the anchor relative to window\n const blockTopLayerOffset = isSurfaceBlockStart * anchorRect.top +\n isSurfaceBlockEnd * (windowInnerHeight - anchorRect.bottom);\n // If the surface's block would be out of bounds of the window, move it back\n // in\n const blockOutOfBoundsCorrection = Math.abs(Math.min(\n 0,\n windowInnerHeight - blockTopLayerOffset - blockAnchorOffset -\n surfaceRect.height));\n\n\n // The block logical value of the surface\n const blockInset =\n relativeToWindow * blockTopLayerOffset + blockAnchorOffset;\n\n const surfaceBlockProperty =\n surfaceBlock === 'start' ? 'inset-block-start' : 'inset-block-end';\n\n return {blockInset, blockOutOfBoundsCorrection, surfaceBlockProperty};\n }\n\n /**\n * Calculates the css property, the inset, and the out of bounds correction\n * for the surface in the inline direction.\n */\n private calculateInline(config: {\n isLTR: boolean,\n surfaceInline: 'start'|'end',\n anchorInline: 'start'|'end',\n anchorRect: DOMRect,\n surfaceRect: DOMRect,\n xOffset: number,\n positioning: 'absolute'|'fixed',\n windowInnerWidth: number,\n }) {\n const {\n isLTR: isLTRBool,\n surfaceInline,\n anchorInline,\n anchorRect,\n surfaceRect,\n xOffset,\n positioning,\n windowInnerWidth,\n } = config;\n // We use number booleans to multiply values rather than `if` / ternary\n // statements because it _heavily_ cuts down on nesting and readability\n const relativeToWindow = positioning === 'fixed' ? 1 : 0;\n const isLTR = isLTRBool ? 1 : 0;\n const isRTL = isLTRBool ? 0 : 1;\n const isSurfaceInlineStart = surfaceInline === 'start' ? 1 : 0;\n const isSurfaceInlineEnd = surfaceInline === 'end' ? 1 : 0;\n const isOneInlineEnd = anchorInline !== surfaceInline ? 1 : 0;\n\n // Whether or not to apply the width of the anchor\n const inlineAnchorOffset = isOneInlineEnd * anchorRect.width + xOffset;\n // The inline position of the anchor relative to window in LTR\n const inlineTopLayerOffsetLTR = isSurfaceInlineStart * anchorRect.left +\n isSurfaceInlineEnd * (windowInnerWidth - anchorRect.right);\n // The inline position of the anchor relative to window in RTL\n const inlineTopLayerOffsetRTL =\n isSurfaceInlineStart * (windowInnerWidth - anchorRect.right) +\n isSurfaceInlineEnd * anchorRect.left;\n // The inline position of the anchor relative to window\n const inlineTopLayerOffset =\n isLTR * inlineTopLayerOffsetLTR + isRTL * inlineTopLayerOffsetRTL;\n\n // If the surface's inline would be out of bounds of the window, move it\n // back in\n const inlineOutOfBoundsCorrection = Math.abs(Math.min(\n 0,\n windowInnerWidth - inlineTopLayerOffset - inlineAnchorOffset -\n surfaceRect.width));\n\n\n // The inline logical value of the surface\n const inlineInset =\n relativeToWindow * inlineTopLayerOffset + inlineAnchorOffset;\n\n const surfaceInlineProperty =\n surfaceInline === 'start' ? 'inset-inline-start' : 'inset-inline-end';\n\n return {\n inlineInset,\n inlineOutOfBoundsCorrection,\n surfaceInlineProperty,\n };\n }\n\n hostUpdate() {\n this.onUpdate();\n }\n\n hostUpdated() {\n this.onUpdate();\n }\n\n /**\n * Checks whether the properties passed into the controller have changed since\n * the last positioning. If so, it will reposition if the surface is open or\n * close it if the surface should close.\n */\n private async onUpdate() {\n const props = this.getProperties();\n let hasChanged = false;\n for (const [key, value] of Object.entries(props)) {\n // tslint:disable-next-line\n hasChanged = hasChanged || (value !== (this.lastValues as any)[key]);\n if (hasChanged) break;\n }\n\n const openChanged = this.lastValues.isOpen !== props.isOpen;\n const hasAnchor = !!props.anchorEl;\n const hasSurface = !!props.surfaceEl;\n\n if (hasChanged && hasAnchor && hasSurface) {\n // Only update isOpen, because if it's closed, we do not want to waste\n // time on a useless reposition calculation. So save the other \"dirty\"\n // values until next time it opens.\n this.lastValues.isOpen = props.isOpen;\n\n if (props.isOpen) {\n // We are going to do a reposition, so save the prop values for future\n // dirty checking.\n this.lastValues = props;\n\n await this.position();\n props.onOpen();\n } else if (openChanged) {\n await props.beforeClose();\n this.close();\n props.onClose();\n }\n }\n }\n\n /**\n * Hides the surface.\n */\n private close() {\n this.surfaceStylesInternal = {\n 'display': 'none',\n };\n this.host.requestUpdate();\n }\n}\n"]}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
|
-
export const styles = css `:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, 4px)}.menu{border-radius:var(--md-menu-container-shape, 4px);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit}.item-padding{padding-block:8px}.has-overflow .items{overflow:visible}.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}/*# sourceMappingURL=menu-styles.css.map */
|
|
7
|
+
export const styles = css `:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, 4px)}.menu{border-radius:var(--md-menu-container-shape, 4px);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit}.item-padding{padding-block:8px}.has-overflow .items{overflow:visible}.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=menu-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=menu-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-styles.css.js","sourceRoot":"","sources":["menu-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, 4px)}.menu{border-radius:var(--md-menu-container-shape, 4px);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit}.item-padding{padding-block:8px}.has-overflow .items{overflow:visible}.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}/*# sourceMappingURL=menu-styles.css.map */\n`;\n "]}
|
|
1
|
+
{"version":3,"file":"menu-styles.css.js","sourceRoot":"","sources":["menu-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, 4px)}.menu{border-radius:var(--md-menu-container-shape, 4px);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit}.item-padding{padding-block:8px}.has-overflow .items{overflow:visible}.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=menu-styles.css.map */\n`;\n "]}
|