@inboxsdk/core 0.2.29-alpha.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/inboxsdk.js +2 -2
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.d.ts.map +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +42 -43
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts +5 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.js +10 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.js +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +3 -0
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.js +5 -2
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts +1 -0
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.js +1 -1
- package/src/platform-implementation-js/views/app-menu-item-view.d.ts.map +1 -1
- package/src/platform-implementation-js/views/app-menu-item-view.js +28 -2
package/package.json
CHANGED
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail-load-event.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,iBAAiB,CAAC;AAO/C,wBAA8B,cAAc,CAAC,MAAM,EAAE,WAAW,iBA2C/D"}
|
|
@@ -1,43 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
1
|
+
/* @flow */
|
|
2
|
+
import isIntegratedViewGmail, { isCollapsiblePanelHidden, } from './isIntegratedViewGmail';
|
|
3
|
+
import { waitForMenuReady } from './add-nav-item';
|
|
4
|
+
import { isDarkTheme } from './track-gmail-styles';
|
|
5
|
+
export default async function gmailLoadEvent(driver) {
|
|
6
|
+
const pageCommunicator = driver.getPageCommunicator();
|
|
7
|
+
const isConversationViewDisabled = await pageCommunicator.isConversationViewDisabled();
|
|
8
|
+
await waitForMenuReady();
|
|
9
|
+
driver.getLogger().eventSite('gmailSettings', {
|
|
10
|
+
isGmailIntegratedView: isIntegratedViewGmail(),
|
|
11
|
+
isCollapsiblePanelHidden: isCollapsiblePanelHidden(),
|
|
12
|
+
isDarkTheme: isDarkTheme(),
|
|
13
|
+
screenWidth: window.screen?.width,
|
|
14
|
+
screenHeight: window.screen?.height,
|
|
15
|
+
windowWidth: window.innerWidth,
|
|
16
|
+
windowHeight: window.innerHeight,
|
|
17
|
+
language: pageCommunicator.getUserLanguage(),
|
|
18
|
+
isUsingSyncAPI: pageCommunicator.isUsingSyncAPI(),
|
|
19
|
+
previewPane: pageCommunicator.getUserOriginalPreviewPaneMode(),
|
|
20
|
+
isConversationViewDisabled,
|
|
21
|
+
wasAccountSwitcherReadyAtStart: driver.getEnvData().wasAccountSwitcherReadyAtStart,
|
|
22
|
+
timings: {
|
|
23
|
+
...{
|
|
24
|
+
responseStart: global.performance?.timing.responseStart,
|
|
25
|
+
responseEnd: global.performance?.timing.responseEnd,
|
|
26
|
+
domLoading: global.performance?.timing.domLoading,
|
|
27
|
+
domInteractive: global.performance?.timing.domInteractive,
|
|
28
|
+
domComplete: global.performance?.timing.domComplete,
|
|
29
|
+
domContentLoadedEventStart: global.performance?.timing.domContentLoadedEventStart,
|
|
30
|
+
domContentLoadedEventEnd: global.performance?.timing.domContentLoadedEventEnd,
|
|
31
|
+
domainLookupEnd: global.performance?.timing.domainLookupEnd,
|
|
32
|
+
domainLookupStart: global.performance?.timing.domainLookupStart,
|
|
33
|
+
fetchStart: global.performance?.timing.fetchStart,
|
|
34
|
+
loadEventStart: global.performance?.timing.loadEventStart,
|
|
35
|
+
loadEventEnd: global.performance?.timing.loadEventEnd,
|
|
36
|
+
navigationStart: global.performance?.timing.navigationStart,
|
|
37
|
+
requestStart: global.performance?.timing.requestStart,
|
|
38
|
+
},
|
|
39
|
+
...driver.getTimings(),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://support.google.com/mail/answer/11555490
|
|
3
|
+
*/
|
|
1
4
|
export default function isIntegratedViewGmail(): boolean;
|
|
5
|
+
/** @returns null if the app menu is configured off */
|
|
6
|
+
export declare function isCollapsiblePanelHidden(): boolean | null;
|
|
2
7
|
//# sourceMappingURL=isIntegratedViewGmail.d.ts.map
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isIntegratedViewGmail.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,qBAAqB,IAAI,OAAO,CAGvD"}
|
|
1
|
+
{"version":3,"file":"isIntegratedViewGmail.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,IAAI,OAAO,CAGvD;AAED,sDAAsD;AACtD,wBAAgB,wBAAwB,IAAI,OAAO,GAAG,IAAI,CAMzD"}
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/isIntegratedViewGmail.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://support.google.com/mail/answer/11555490
|
|
3
|
+
*/
|
|
1
4
|
export default function isIntegratedViewGmail() {
|
|
2
5
|
const nav = document.querySelector('div[role=navigation]');
|
|
3
6
|
return Boolean(nav?.firstElementChild?.classList.contains('Xa'));
|
|
4
7
|
}
|
|
8
|
+
/** @returns null if the app menu is configured off */
|
|
9
|
+
export function isCollapsiblePanelHidden() {
|
|
10
|
+
if (!isIntegratedViewGmail()) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return document.querySelector('div[role=navigation].aBA') != null;
|
|
14
|
+
}
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-gmail-styles.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"track-gmail-styles.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-gmail-styles.ts"],"names":[],"mappings":"AA8BA,wBAAgB,WAAW,IAAI,OAAO,CAyBrC;AAED,eAAO,MAAM,YAAY;UACf,OAAO;gBAAc,OAAO;WAEnC,CAAC;AAEJ,wBAA8B,gBAAgB,kBAmE7C"}
|
|
@@ -23,7 +23,7 @@ function getDensity() {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
const navItemSelector = '.aio';
|
|
26
|
-
function isDarkTheme() {
|
|
26
|
+
export function isDarkTheme() {
|
|
27
27
|
// get the color of the left-nav-menu entries to determine whether Gmail is
|
|
28
28
|
// in dark theme mode.
|
|
29
29
|
const navItem = document.querySelector(navItemSelector);
|
|
@@ -18,6 +18,7 @@ import GmailSupportItemView, {
|
|
|
18
18
|
import { AppMenuItemDescriptor } from '../../namespaces/app-menu';
|
|
19
19
|
import { GmailAppMenuItemView } from './views/gmail-app-menu-item-view';
|
|
20
20
|
import { RouteView } from '../../../inboxsdk';
|
|
21
|
+
import { EnvData } from '../../platform-implementation';
|
|
21
22
|
|
|
22
23
|
type GmailThreadView = any;
|
|
23
24
|
type GmailMessageView = any;
|
|
@@ -28,6 +29,8 @@ type GmailMoleViewDriver = any;
|
|
|
28
29
|
type GmailBackdrop = any;
|
|
29
30
|
|
|
30
31
|
export default class GmailDriver implements Driver {
|
|
32
|
+
getEnvData(): EnvData;
|
|
33
|
+
getTimings(): { [ix: string]: number | undefined | null };
|
|
31
34
|
public onready: Promise<void>;
|
|
32
35
|
public isUsingSyncAPI(): boolean;
|
|
33
36
|
public getLogger(): Logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail-element-getter.d.ts","sourceRoot":"","sources":["../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAA+B,EAC7B,mBAAmB,EACpB,MAAM,yCAAyC,CAAC;AAmBjD,QAAA,MAAM,kBAAkB;yBACD,WAAW,GAAG,IAAI;uCAcJ,WAAW,GAAG,IAAI;kDAKP,WAAW,GAAG,IAAI;+CAKrB,WAAW,GAAG,IAAI;wBAIzC,WAAW,GAAG,IAAI;iCAOT,WAAW,GAAG,IAAI;gCAInB,WAAW,GAAG,SAAS,GAAG,IAAI;2CA8BnB,WAAW,GAAG,IAAI;iDAIZ,MAAM,UAAU,CAC3D,mBAAmB,EACnB,KAAK,CACN;uBAgBkB,WAAW,GAAG,IAAI;kCAIP,WAAW,GAAG,IAAI;+BAUrB,WAAW,GAAG,IAAI;0CAIP,WAAW,GAAG,IAAI;+BAI7B,WAAW,GAAG,IAAI;+CAQrC,GAAG,KACR,MAAM,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC;qBAItB,WAAW,GAAG,IAAI;+BAOR,OAAO;;;;;;
|
|
1
|
+
{"version":3,"file":"gmail-element-getter.d.ts","sourceRoot":"","sources":["../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAA+B,EAC7B,mBAAmB,EACpB,MAAM,yCAAyC,CAAC;AAmBjD,QAAA,MAAM,kBAAkB;yBACD,WAAW,GAAG,IAAI;uCAcJ,WAAW,GAAG,IAAI;kDAKP,WAAW,GAAG,IAAI;+CAKrB,WAAW,GAAG,IAAI;wBAIzC,WAAW,GAAG,IAAI;iCAOT,WAAW,GAAG,IAAI;gCAInB,WAAW,GAAG,SAAS,GAAG,IAAI;2CA8BnB,WAAW,GAAG,IAAI;iDAIZ,MAAM,UAAU,CAC3D,mBAAmB,EACnB,KAAK,CACN;uBAgBkB,WAAW,GAAG,IAAI;kCAIP,WAAW,GAAG,IAAI;+BAUrB,WAAW,GAAG,IAAI;0CAIP,WAAW,GAAG,IAAI;+BAI7B,WAAW,GAAG,IAAI;+CAQrC,GAAG,KACR,MAAM,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC;qBAItB,WAAW,GAAG,IAAI;+BAOR,OAAO;;;;;;uDAqFiB,WAAW,GAAG,IAAI;mDAItB,WAAW,GAAG,IAAI;0BAQ3C,WAAW,EAAE;0BAIb,WAAW,GAAG,IAAI;sBAItB,gBAAgB,GAAG,IAAI;qCAMR,WAAW,GAAG,IAAI;kCAIrB,WAAW,GAAG,IAAI;2BAIzB,WAAW,GAAG,IAAI;iCAWZ,WAAW,GAAG,IAAI;yBAI1B,WAAW;8BAIN,WAAW,GAAG,IAAI;sBAM1B,OAAO;mBAaV,OAAO;qBAIL,OAAO;oBAIR,OAAO;iCAIM,OAAO;gCAOR,OAAO;;qCASJ,WAAW,GAAG,IAAI;;gCAKrB,QAAQ,IAAI,CAAC;CAG1C,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -169,8 +169,11 @@ const GmailElementGetter = {
|
|
|
169
169
|
}),
|
|
170
170
|
isAppBurgerMenuOpen() {
|
|
171
171
|
return (document
|
|
172
|
-
.querySelector('
|
|
173
|
-
?.getAttribute('aria-expanded') === 'true' ??
|
|
172
|
+
.querySelector('header[role="banner"] > div > div > div[aria-expanded]')
|
|
173
|
+
?.getAttribute('aria-expanded') === 'true' ??
|
|
174
|
+
// Default to true if we can't find the element because
|
|
175
|
+
// the majority of users seem to favor that version.
|
|
176
|
+
false);
|
|
174
177
|
},
|
|
175
178
|
getAppMenuContainer() {
|
|
176
179
|
return document.querySelector('.aqk.aql.bkL');
|
|
@@ -10,6 +10,7 @@ export type MessageEvents = {
|
|
|
10
10
|
export declare const NATIVE_CLASS: "Xa";
|
|
11
11
|
export declare const INBOXSDK_CLASS: "inboxsdk__appMenuItem";
|
|
12
12
|
export declare const ELEMENT_CLASS: "Xa inboxsdk__appMenuItem";
|
|
13
|
+
export declare const ICON_ELEMENT_SELECTOR: ".V6.CL";
|
|
13
14
|
declare const GmailAppMenuItemView_base: new () => TypedEventEmitter<MessageEvents>;
|
|
14
15
|
export declare class GmailAppMenuItemView extends GmailAppMenuItemView_base {
|
|
15
16
|
#private;
|
package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail-app-menu-item-view.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,iBAAiB,MAAM,eAAe,CAAC;AAO9C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,MAAgB,CAAC;AAC1C,eAAO,MAAM,cAAc,yBAAmC,CAAC;AAC/D,eAAO,MAAM,aAAa,4BAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"gmail-app-menu-item-view.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/views/gmail-app-menu-item-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,iBAAiB,MAAM,eAAe,CAAC;AAO9C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,MAAgB,CAAC;AAC1C,eAAO,MAAM,cAAc,yBAAmC,CAAC;AAC/D,eAAO,MAAM,aAAa,4BAA+C,CAAC;AAI1E,eAAO,MAAM,qBAAqB,UAAoB,CAAC;mDAGc,kBAAkB,aAAa,CAAC;AAArG,qBAAa,oBAAqB,SAAQ,yBAA4D;;IACpG,MAAM,CAAC,UAAU;;;MAGN;IAOX,IAAI,OAAO,gBAEV;IAED,IAAI,kBAAkB,CAAC,qBAAqB,uBAAA,EAG3C;IAED,IAAI,kBAAkB,0BAErB;gBAEW,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,qBAAqB;IAwB1E,MAAM;CA6GP"}
|
|
@@ -9,7 +9,7 @@ export const INBOXSDK_CLASS = 'inboxsdk__appMenuItem';
|
|
|
9
9
|
export const ELEMENT_CLASS = `${NATIVE_CLASS} ${INBOXSDK_CLASS}`;
|
|
10
10
|
const ICON_ELEMENT_CLASS = 'V6 CL';
|
|
11
11
|
const HEADING_ELEMENT_CLASS = 'apW';
|
|
12
|
-
const ICON_ELEMENT_SELECTOR = '.V6.CL';
|
|
12
|
+
export const ICON_ELEMENT_SELECTOR = '.V6.CL';
|
|
13
13
|
const HEADING_ELEMENT_SELECTOR = '.apW';
|
|
14
14
|
export class GmailAppMenuItemView extends EventEmitter {
|
|
15
15
|
static elementCss = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-menu-item-view.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/views/app-menu-item-view.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"app-menu-item-view.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/views/app-menu-item-view.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAYzC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAK3D,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;8CA0C8D,aAAa,aAAa,CAAC;AAH3F;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAAuD;;IA4Y1F,IAAI,kBAAkB,0BAErB;gBAQW,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,qBAAqB;IAsDpE,mBAAmB,CAAC,eAAe,EAAE,0BAA0B;IA2C/D,MAAM,CAAC,kBAAkB,EAAE,qBAAqB;IAMtD,MAAM;CAaP"}
|
|
@@ -2,7 +2,7 @@ import Kefir from 'kefir';
|
|
|
2
2
|
import kefirBus from 'kefir-bus';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import EventEmitter from '../lib/safe-event-emitter';
|
|
5
|
-
import { GmailAppMenuItemView, NATIVE_CLASS, INBOXSDK_CLASS, } from '../dom-driver/gmail/views/gmail-app-menu-item-view';
|
|
5
|
+
import { GmailAppMenuItemView, NATIVE_CLASS, INBOXSDK_CLASS, ICON_ELEMENT_SELECTOR, } from '../dom-driver/gmail/views/gmail-app-menu-item-view';
|
|
6
6
|
import { NATIVE_CLASS as PANEL_NATIVE_CLASS, CollapsiblePanelView, } from './collapsible-panel-view';
|
|
7
7
|
import { addCollapsiblePanel } from '../dom-driver/gmail/gmail-driver/add-collapsible-panel';
|
|
8
8
|
import GmailElementGetter from '../dom-driver/gmail/gmail-element-getter';
|
|
@@ -80,6 +80,22 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
static #isPanelDropdownShown() {
|
|
84
|
+
const sdkDropdown = document.querySelector('.inboxsdk__menu');
|
|
85
|
+
if (sdkDropdown) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
const mailDropdown = document.querySelector('.JM');
|
|
89
|
+
if (mailDropdown && mailDropdown.style.display !== 'none') {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
const chatAndSpacesDropdown = document.querySelector('.tP');
|
|
93
|
+
if (chatAndSpacesDropdown &&
|
|
94
|
+
chatAndSpacesDropdown.style.display !== 'none') {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
83
99
|
static #setUpRouteViewDriverStream(driver) {
|
|
84
100
|
if (AppMenuItemView.#routeViewDriverStream)
|
|
85
101
|
return;
|
|
@@ -174,6 +190,7 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
174
190
|
// Handle moving cursor out of panel. We use it to enhance the styling since it won't be handled by Gmail
|
|
175
191
|
const panel = AppMenuItemView.#menuItemToPanelMap.get(nativeMenuItem);
|
|
176
192
|
panel?.addEventListener('mouseleave', (e) => {
|
|
193
|
+
e.stopImmediatePropagation();
|
|
177
194
|
AppMenuItemView.#menuItemChangeBus.emit([
|
|
178
195
|
'mouseleave',
|
|
179
196
|
nativeMenuItem,
|
|
@@ -196,10 +213,15 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
196
213
|
activePanel.classList.remove(CollapsiblePanelView.elementCss.ACTIVE);
|
|
197
214
|
activePanel.classList.remove(CollapsiblePanelView.elementCss.HOVER);
|
|
198
215
|
}
|
|
199
|
-
// deactivate menu items
|
|
216
|
+
// deactivate menu items and handle keyboard accessibility
|
|
200
217
|
for (const menuItem_ of appMenuElement?.querySelectorAll(`.${NATIVE_CLASS}`) ?? []) {
|
|
201
218
|
menuItem_.classList.remove(ACTIVE);
|
|
202
219
|
menuItem_.classList.remove(HOVER);
|
|
220
|
+
// update tabindex
|
|
221
|
+
const iconElement = menuItem_.querySelector(ICON_ELEMENT_SELECTOR);
|
|
222
|
+
if (iconElement) {
|
|
223
|
+
iconElement.tabIndex = menuItem_ === menuItem ? 0 : -1;
|
|
224
|
+
}
|
|
203
225
|
}
|
|
204
226
|
// activate menu item
|
|
205
227
|
menuItem.classList.add(ACTIVE);
|
|
@@ -250,6 +272,10 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
250
272
|
break;
|
|
251
273
|
}
|
|
252
274
|
case 'mouseleave': {
|
|
275
|
+
// Do not handle blur event when we're in one of the panel's dropdowns
|
|
276
|
+
const isPanelDropdownShown = AppMenuItemView.#isPanelDropdownShown();
|
|
277
|
+
if (isPanelDropdownShown)
|
|
278
|
+
return;
|
|
253
279
|
const activeMenuItem = AppMenuItemView.#getActiveMenuItem();
|
|
254
280
|
const activePanel = AppMenuItemView.#getActivePanel();
|
|
255
281
|
const activeMenuItemPanel = activeMenuItem &&
|