@inboxsdk/core 0.2.29-alpha.3 → 0.2.29-aplha.3
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 +17 -16
- package/inboxsdk.js.map +1 -1
- package/package.json +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts.map +1 -1
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.js +1 -2
- package/src/platform-implementation-js/dom-driver/gmail/gmail-element-getter.d.ts +2 -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 +14 -12
- 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 +2 -1
- package/src/platform-implementation-js/namespaces/app-menu.d.ts +2 -0
- package/src/platform-implementation-js/namespaces/app-menu.d.ts.map +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 +57 -24
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts +8 -7
- package/src/platform-implementation-js/views/collapsible-panel-view.d.ts.map +1 -1
- package/src/platform-implementation-js/views/collapsible-panel-view.js +54 -33
package/package.json
CHANGED
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-collapsible-panel.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAI1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"add-collapsible-panel.d.ts","sourceRoot":"","sources":["../../../../../../../src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAI1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,0BAA0B,6CAkB5C"}
|
package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-collapsible-panel.js
CHANGED
|
@@ -5,8 +5,7 @@ import Logger from '../../../lib/logger';
|
|
|
5
5
|
import { CollapsiblePanelView } from '../../../views/collapsible-panel-view';
|
|
6
6
|
export async function addCollapsiblePanel(driver, panelDescriptor) {
|
|
7
7
|
const injectionContainer = await waitForAppMenuParentReady();
|
|
8
|
-
const collapsiblePanelView = new CollapsiblePanelView(driver);
|
|
9
|
-
collapsiblePanelView.panelDescriptor = panelDescriptor;
|
|
8
|
+
const collapsiblePanelView = new CollapsiblePanelView(driver, panelDescriptor);
|
|
10
9
|
if (!injectionContainer || !collapsiblePanelView.element)
|
|
11
10
|
return;
|
|
12
11
|
const appMenu = await GmailElementGetter.getAppMenuAsync();
|
|
@@ -21,6 +21,8 @@ declare const GmailElementGetter: {
|
|
|
21
21
|
getAppMenuAsync: () => Promise<HTMLElement | undefined>;
|
|
22
22
|
isAppBurgerMenuOpen(): boolean;
|
|
23
23
|
getAppMenuContainer(): HTMLElement | null;
|
|
24
|
+
getAppMenu(): HTMLElement | null;
|
|
25
|
+
getAppHeader(): HTMLElement | null;
|
|
24
26
|
getSeparateSectionNavItemMenuInjectionContainer(): HTMLElement | null;
|
|
25
27
|
getSameSectionNavItemMenuInjectionContainer(): HTMLElement | null;
|
|
26
28
|
getRowListElements(): HTMLElement[];
|
|
@@ -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;
|
|
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;+BAOrB,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;;;;;;uDAgFiB,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"}
|
|
@@ -7,6 +7,14 @@ import getMainContentElementChangedStream from './gmail-element-getter/get-main-
|
|
|
7
7
|
import isIntegratedViewGmail from './gmail-driver/isIntegratedViewGmail';
|
|
8
8
|
import Logger from '../../lib/logger';
|
|
9
9
|
import waitFor from '../../lib/wait-for';
|
|
10
|
+
/**
|
|
11
|
+
* The selector for the new app menu https://support.google.com/mail/answer/11555490 -- FEB 2023
|
|
12
|
+
*/
|
|
13
|
+
const APP_MENU = '.aeN.WR.a6o.anZ.nH.oy8Mbf[role=navigation]';
|
|
14
|
+
/**
|
|
15
|
+
* If the APP_MENU selector is not found, NAV_MENU _might_ be present.
|
|
16
|
+
*/
|
|
17
|
+
const NAV_MENU = '.aeN.WR.nH.oy8Mbf[role=navigation]';
|
|
10
18
|
// TODO Figure out if these functions can and should be able to return null
|
|
11
19
|
const GmailElementGetter = {
|
|
12
20
|
getActiveMoreMenu() {
|
|
@@ -144,14 +152,6 @@ const GmailElementGetter = {
|
|
|
144
152
|
getAppMenuAsync: once(async () => {
|
|
145
153
|
if (!GmailElementGetter.isStandalone()) {
|
|
146
154
|
await GmailElementGetter.waitForGmailModeToSettle();
|
|
147
|
-
/**
|
|
148
|
-
* The selector for the new app menu https://support.google.com/mail/answer/11555490 -- FEB 2023
|
|
149
|
-
*/
|
|
150
|
-
const APP_MENU = '.aeN.WR.a6o.anZ.nH.oy8Mbf[role=navigation]';
|
|
151
|
-
/**
|
|
152
|
-
* If the APP_MENU selector is not found, NAV_MENU _might_ be present.
|
|
153
|
-
*/
|
|
154
|
-
const NAV_MENU = '.aeN.WR.nH.oy8Mbf[role=navigation]';
|
|
155
155
|
try {
|
|
156
156
|
const element = await waitFor(() => document.querySelector(`${APP_MENU}, ${NAV_MENU}`));
|
|
157
157
|
if (!document.querySelector(APP_MENU)) {
|
|
@@ -172,10 +172,12 @@ const GmailElementGetter = {
|
|
|
172
172
|
getAppMenuContainer() {
|
|
173
173
|
return document.querySelector('.aqk.aql.bkL');
|
|
174
174
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
getAppMenu() {
|
|
176
|
+
return document.querySelector(APP_MENU);
|
|
177
|
+
},
|
|
178
|
+
getAppHeader() {
|
|
179
|
+
return document.querySelector('.oy8Mbf.qp');
|
|
180
|
+
},
|
|
179
181
|
getSeparateSectionNavItemMenuInjectionContainer() {
|
|
180
182
|
return document.querySelector('.aeN');
|
|
181
183
|
},
|
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;AAK9C,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;mDAOL,kBAAkB,aAAa,CAAC;AAArG,qBAAa,oBAAqB,SAAQ,yBAA4D;;IACpG,MAAM,CAAC,UAAU;;;MAGN;IAOX,IAAI,OAAO,4BAEV;IAED,qBAAqB,CAAC,qBAAqB,EAAE,qBAAqB;IAKlE,IAAI,kBAAkB,sCAErB;gBAEW,MAAM,EAAE,WAAW;IAc/B,MAAM;IAON;;OAEG;IACH,IAAI;IAIJ;;OAEG;IACH,KAAK;
|
|
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;AAK9C,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;mDAOL,kBAAkB,aAAa,CAAC;AAArG,qBAAa,oBAAqB,SAAQ,yBAA4D;;IACpG,MAAM,CAAC,UAAU;;;MAGN;IAOX,IAAI,OAAO,4BAEV;IAED,qBAAqB,CAAC,qBAAqB,EAAE,qBAAqB;IAKlE,IAAI,kBAAkB,sCAErB;gBAEW,MAAM,EAAE,WAAW;IAc/B,MAAM;IAON;;OAEG;IACH,IAAI;IAIJ;;OAEG;IACH,KAAK;CA4FN"}
|
|
@@ -72,7 +72,8 @@ export class GmailAppMenuItemView extends EventEmitter {
|
|
|
72
72
|
const element = this.element;
|
|
73
73
|
if (!element)
|
|
74
74
|
return;
|
|
75
|
-
|
|
75
|
+
const existingClassNames = Object.values(GmailAppMenuItemView.elementCss).filter((className) => element.classList.contains(className));
|
|
76
|
+
element.className = cx(ELEMENT_CLASS, this.#menuItemDescriptor?.className, ...existingClassNames);
|
|
76
77
|
this.#updateName(element);
|
|
77
78
|
this.#updateIcon(element);
|
|
78
79
|
this.#updateARIA(element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-menu.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/namespaces/app-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,KAAK,UAAU,GACX,MAAM,GACN;IACE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,SAAS,EAAE,UAAU,CAAC;QACtB,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB;;;;OAIG;IACH,aAAa,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;QACjC,OAAO,CAAC,EAAE;YACR,SAAS,EAAE,MAAM,CAAC;YAClB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;;gBAGd,MAAM,EAAE,WAAW;IAI/B,WAAW,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,eAAe;IAKjE,OAAO;CAId"}
|
|
1
|
+
{"version":3,"file":"app-menu.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/namespaces/app-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,KAAK,UAAU,GACX,MAAM,GACN;IACE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,SAAS,EAAE,UAAU,CAAC;QACtB,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB;;;;OAIG;IACH,aAAa,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;QACjC,OAAO,CAAC,EAAE;YACR,SAAS,EAAE,MAAM,CAAC;YAClB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;;gBAGd,MAAM,EAAE,WAAW;IAI/B,WAAW,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,eAAe;IAKjE,OAAO;CAId"}
|
|
@@ -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;AAWzC,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;;IAqV1F,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;CAYP"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Kefir from 'kefir';
|
|
2
2
|
import kefirBus from 'kefir-bus';
|
|
3
|
+
import cx from 'classnames';
|
|
3
4
|
import EventEmitter from '../lib/safe-event-emitter';
|
|
4
5
|
import { GmailAppMenuItemView, NATIVE_CLASS, INBOXSDK_CLASS, } from '../dom-driver/gmail/views/gmail-app-menu-item-view';
|
|
5
6
|
import { NATIVE_CLASS as PANEL_NATIVE_CLASS, CollapsiblePanelView, } from './collapsible-panel-view';
|
|
@@ -55,10 +56,15 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
55
56
|
const button = appMenuElement?.querySelector(`.${NATIVE_CLASS}.${ACTIVE}`);
|
|
56
57
|
return button;
|
|
57
58
|
}
|
|
59
|
+
static #isPanelLess() {
|
|
60
|
+
const activePanel = AppMenuItemView.#getActivePanel();
|
|
61
|
+
return !activePanel;
|
|
62
|
+
}
|
|
58
63
|
static #setUpRouteViewDriverStream(driver) {
|
|
59
64
|
if (AppMenuItemView.#routeViewDriverStream)
|
|
60
65
|
return;
|
|
61
66
|
AppMenuItemView.#routeViewDriverStream = driver.getRouteViewDriverStream();
|
|
67
|
+
// Activate menu items on route changes. Used for deep-links, browser history navigation etc.
|
|
62
68
|
AppMenuItemView.#routeViewDriverStream.onValue(async (routeView) => {
|
|
63
69
|
const routeViewID = routeView.getRouteID();
|
|
64
70
|
const routeType = routeView.getRouteType();
|
|
@@ -72,7 +78,10 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
72
78
|
return descriptor?.isRouteActive(routeView);
|
|
73
79
|
}) ?? [];
|
|
74
80
|
if (gmailView?.element) {
|
|
75
|
-
AppMenuItemView.#menuItemChangeBus.emit([
|
|
81
|
+
AppMenuItemView.#menuItemChangeBus.emit([
|
|
82
|
+
'route-activated',
|
|
83
|
+
gmailView.element,
|
|
84
|
+
]);
|
|
76
85
|
return;
|
|
77
86
|
}
|
|
78
87
|
/* Handling native app menu items */
|
|
@@ -86,12 +95,15 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
86
95
|
const menuItemElement = menuItemClass &&
|
|
87
96
|
document.querySelector(`.${menuItemClass}`);
|
|
88
97
|
if (menuItemElement) {
|
|
89
|
-
AppMenuItemView.#menuItemChangeBus.emit([
|
|
98
|
+
AppMenuItemView.#menuItemChangeBus.emit([
|
|
99
|
+
'route-activated',
|
|
100
|
+
menuItemElement,
|
|
101
|
+
]);
|
|
90
102
|
}
|
|
91
103
|
});
|
|
92
104
|
}
|
|
93
105
|
static {
|
|
94
|
-
(async ()
|
|
106
|
+
(async function init() {
|
|
95
107
|
const gmailAppMenu = await GmailElementGetter.getAppMenuAsync();
|
|
96
108
|
if (!gmailAppMenu) {
|
|
97
109
|
return;
|
|
@@ -155,6 +167,28 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
155
167
|
AppMenuItemView.#menuItemChangeStream.onValue(async (v) => {
|
|
156
168
|
const [type, menuItem, mouseEvent] = v;
|
|
157
169
|
const { ACTIVE, HOVER } = GmailAppMenuItemView.elementCss;
|
|
170
|
+
function handleActivate() {
|
|
171
|
+
const appMenuElement = GmailElementGetter.getAppMenuContainer();
|
|
172
|
+
// deactivate active panel
|
|
173
|
+
const activePanel = AppMenuItemView.#getActivePanel();
|
|
174
|
+
if (activePanel) {
|
|
175
|
+
activePanel.style.removeProperty('height');
|
|
176
|
+
activePanel.classList.remove(CollapsiblePanelView.elementCss.ACTIVE);
|
|
177
|
+
activePanel.classList.remove(CollapsiblePanelView.elementCss.HOVER);
|
|
178
|
+
}
|
|
179
|
+
// deactivate menu items
|
|
180
|
+
for (const menuItem_ of appMenuElement?.querySelectorAll(`.${NATIVE_CLASS}`) ?? []) {
|
|
181
|
+
menuItem_.classList.remove(ACTIVE);
|
|
182
|
+
menuItem_.classList.remove(HOVER);
|
|
183
|
+
}
|
|
184
|
+
// activate menu item
|
|
185
|
+
menuItem.classList.add(ACTIVE);
|
|
186
|
+
// activate panel
|
|
187
|
+
const panel = AppMenuItemView.#menuItemToPanelMap.get(menuItem);
|
|
188
|
+
if (panel) {
|
|
189
|
+
panel.classList.add(CollapsiblePanelView.elementCss.ACTIVE);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
158
192
|
switch (type) {
|
|
159
193
|
case 'mouseenter': {
|
|
160
194
|
const panel = AppMenuItemView.#menuItemToPanelMap.get(menuItem);
|
|
@@ -226,26 +260,19 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
226
260
|
break;
|
|
227
261
|
}
|
|
228
262
|
case 'click': {
|
|
229
|
-
|
|
230
|
-
//
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
activePanel.classList.remove(CollapsiblePanelView.elementCss.ACTIVE);
|
|
235
|
-
activePanel.classList.remove(CollapsiblePanelView.elementCss.HOVER);
|
|
236
|
-
}
|
|
237
|
-
// deactivate menu items
|
|
238
|
-
for (const menuItem_ of appMenuElement?.querySelectorAll(`.${NATIVE_CLASS}`) ?? []) {
|
|
239
|
-
menuItem_.classList.remove(ACTIVE);
|
|
240
|
-
menuItem_.classList.remove(HOVER);
|
|
241
|
-
}
|
|
242
|
-
// activate menu item
|
|
243
|
-
menuItem.classList.add(ACTIVE);
|
|
244
|
-
// activate panel
|
|
245
|
-
const panel = AppMenuItemView.#menuItemToPanelMap.get(menuItem);
|
|
246
|
-
if (panel) {
|
|
247
|
-
panel.classList.add(CollapsiblePanelView.elementCss.ACTIVE);
|
|
263
|
+
handleActivate();
|
|
264
|
+
// handle panel-less mode
|
|
265
|
+
const isPanelLess = AppMenuItemView.#isPanelLess();
|
|
266
|
+
for (const panel of document.querySelectorAll(CollapsiblePanelView.elementSelectors.NATIVE) ?? []) {
|
|
267
|
+
panel.classList.toggle(CollapsiblePanelView.elementCss.PANEL_LESS, isPanelLess);
|
|
248
268
|
}
|
|
269
|
+
GmailElementGetter.getAppMenu()?.classList.toggle('aTO', isPanelLess);
|
|
270
|
+
GmailElementGetter.getAppHeader()?.classList.toggle('aTO', isPanelLess);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
case 'route-activated': {
|
|
274
|
+
handleActivate();
|
|
275
|
+
break;
|
|
249
276
|
}
|
|
250
277
|
}
|
|
251
278
|
});
|
|
@@ -273,7 +300,6 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
273
300
|
AppMenuItemView.#menuItemToPanelMap.set(gmailElement, undefined);
|
|
274
301
|
}
|
|
275
302
|
gmailView.on('destroy', () => {
|
|
276
|
-
AppMenuItemView.#menuItemChangeBus.end();
|
|
277
303
|
this.remove();
|
|
278
304
|
});
|
|
279
305
|
gmailView.on('click', () => {
|
|
@@ -302,7 +328,14 @@ export class AppMenuItemView extends EventEmitter {
|
|
|
302
328
|
AppMenuItemView.#appMenuItemViews.add(this);
|
|
303
329
|
}
|
|
304
330
|
async addCollapsiblePanel(panelDescriptor) {
|
|
305
|
-
const
|
|
331
|
+
const descriptor = {
|
|
332
|
+
...panelDescriptor,
|
|
333
|
+
className: cx(panelDescriptor.className, {
|
|
334
|
+
[CollapsiblePanelView.elementCss.COLLAPSED]: !GmailElementGetter.isAppBurgerMenuOpen(),
|
|
335
|
+
[CollapsiblePanelView.elementCss.PANEL_LESS]: AppMenuItemView.#isPanelLess(),
|
|
336
|
+
}),
|
|
337
|
+
};
|
|
338
|
+
const collapsiblePanel = await addCollapsiblePanel(this.#driver, descriptor);
|
|
306
339
|
if (collapsiblePanel) {
|
|
307
340
|
this.#gmailViewPromise.then((gmailView) => {
|
|
308
341
|
const gmailElement = gmailView.element;
|
|
@@ -23,16 +23,17 @@ export declare class CollapsiblePanelView extends CollapsiblePanelView_base {
|
|
|
23
23
|
/** A hover popover has both ACTIVE _and_ HOVER */
|
|
24
24
|
readonly HOVER: "aJu";
|
|
25
25
|
readonly COLLAPSED_HOVER: "bym";
|
|
26
|
+
readonly PANEL_LESS: "a3W";
|
|
26
27
|
};
|
|
27
|
-
get
|
|
28
|
+
get loading(): boolean;
|
|
29
|
+
setLoading(loading: boolean): void;
|
|
30
|
+
get panelDescriptor(): AppMenuItemPanelDescriptor;
|
|
28
31
|
set panelDescriptor(panelDescriptor: AppMenuItemPanelDescriptor);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
activate(): void;
|
|
32
|
+
get element(): HTMLElement;
|
|
33
|
+
get scrollablePaneElement(): Element | null;
|
|
34
|
+
constructor(driver: GmailDriver, panelDescriptor: AppMenuItemPanelDescriptor);
|
|
34
35
|
remove(): void;
|
|
35
|
-
addNavItem(navItemDescriptor: NavItemDescriptor | Kefir.Observable<NavItemDescriptor, any>): NavItemView
|
|
36
|
+
addNavItem(navItemDescriptor: NavItemDescriptor | Kefir.Observable<NavItemDescriptor, any>): NavItemView;
|
|
36
37
|
}
|
|
37
38
|
export {};
|
|
38
39
|
//# sourceMappingURL=collapsible-panel-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible-panel-view.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/views/collapsible-panel-view.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAIpE,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,eAAO,MAAM,YAAY,OAAiB,CAAC;AAC3C,eAAO,MAAM,cAAc,8BAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"collapsible-panel-view.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/views/collapsible-panel-view.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAIpE,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,eAAO,MAAM,YAAY,OAAiB,CAAC;AAC3C,eAAO,MAAM,cAAc,8BAAwC,CAAC;AAapE,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CAC/B,CAAC;mDAEmE,aAAa,aAAa,CAAC;AAAhG,qBAAa,oBAAqB,SAAQ,yBAAuD;;IAC/F,MAAM,CAAC,gBAAgB;;;MAGZ;IACX,MAAM,CAAC,UAAU;;;QAGf,kDAAkD;;;;MAIzC;IASX,IAAI,OAAO,YAEV;IAED,UAAU,CAAC,OAAO,EAAE,OAAO;IAS3B,IAAI,eAAe,IAIkB,0BAA0B,CAF9D;IAED,IAAI,eAAe,CAAC,eAAe,EAAE,0BAA0B,EAG9D;IAED,IAAI,OAAO,gBAEV;IAED,IAAI,qBAAqB,mBAExB;gBAGC,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,0BAA0B;IAW7C,MAAM;IAON,UAAU,CACR,iBAAiB,EACb,iBAAiB,GACjB,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,GAAG,CAAC;CAsL/C"}
|
|
@@ -11,6 +11,10 @@ export const INBOXSDK_CLASS = 'inboxsdk__collapsiblePanel';
|
|
|
11
11
|
const ELEMENT_CLASS = `${NATIVE_CLASS} ${INBOXSDK_CLASS} oy8Mbf`;
|
|
12
12
|
const PRIMARY_BUTTON_ELEMENT_CLASS = 'T-I T-I-KE L3';
|
|
13
13
|
const PRIMARY_BUTTON_ELEMENT_SELECTOR = '.T-I.T-I-KE.L3';
|
|
14
|
+
const scrollablePanelClass = 'at9';
|
|
15
|
+
const scrollablePanelSelector = `.${scrollablePanelClass}`;
|
|
16
|
+
const loadingElementClass = 'inboxsdk__collapsiblePanel_loading_container';
|
|
17
|
+
const loadingElementSelector = `.${loadingElementClass}`;
|
|
14
18
|
const NAV_MENU_CONTAINER_ELEMENT_SELECTOR = '.at9 .n3 .TK';
|
|
15
19
|
export class CollapsiblePanelView extends EventEmitter {
|
|
16
20
|
static elementSelectors = {
|
|
@@ -23,6 +27,7 @@ export class CollapsiblePanelView extends EventEmitter {
|
|
|
23
27
|
/** A hover popover has both ACTIVE _and_ HOVER */
|
|
24
28
|
HOVER: 'aJu',
|
|
25
29
|
COLLAPSED_HOVER: 'bym',
|
|
30
|
+
PANEL_LESS: 'a3W',
|
|
26
31
|
};
|
|
27
32
|
#panelDescriptor;
|
|
28
33
|
#element;
|
|
@@ -30,42 +35,49 @@ export class CollapsiblePanelView extends EventEmitter {
|
|
|
30
35
|
#id = Math.random().toFixed(3);
|
|
31
36
|
#ARIA_LABELLED_BY_ID = Math.random().toFixed(3);
|
|
32
37
|
#driver;
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
#loading = false;
|
|
39
|
+
get loading() {
|
|
40
|
+
return this.#loading;
|
|
41
|
+
}
|
|
42
|
+
setLoading(loading) {
|
|
43
|
+
const changed = this.#loading !== loading;
|
|
44
|
+
this.#loading = loading;
|
|
45
|
+
if (changed) {
|
|
46
|
+
this.#update();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
get panelDescriptor() {
|
|
50
|
+
return this.#panelDescriptor;
|
|
35
51
|
}
|
|
36
52
|
set panelDescriptor(panelDescriptor) {
|
|
37
53
|
this.#panelDescriptor = panelDescriptor;
|
|
38
54
|
this.#update();
|
|
39
55
|
}
|
|
40
|
-
|
|
56
|
+
get element() {
|
|
57
|
+
return this.#element;
|
|
58
|
+
}
|
|
59
|
+
get scrollablePaneElement() {
|
|
60
|
+
return this.element.querySelector(scrollablePanelSelector);
|
|
61
|
+
}
|
|
62
|
+
constructor(driver, panelDescriptor) {
|
|
41
63
|
super();
|
|
42
64
|
this.#driver = driver;
|
|
65
|
+
this.#panelDescriptor = panelDescriptor;
|
|
43
66
|
this.#element = this.#setupElement();
|
|
44
67
|
this.#element.addEventListener('mouseleave', (e) => {
|
|
45
68
|
this.emit('blur', e);
|
|
46
69
|
});
|
|
47
70
|
}
|
|
48
|
-
/**
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
activate() {
|
|
52
|
-
const element = this.element;
|
|
53
|
-
if (!element)
|
|
54
|
-
return;
|
|
55
|
-
element?.classList.remove(CollapsiblePanelView.elementCss.HOVER);
|
|
56
|
-
element.classList.add(CollapsiblePanelView.elementCss.ACTIVE);
|
|
57
|
-
}
|
|
58
71
|
remove() {
|
|
59
72
|
if (this.#destroyed)
|
|
60
73
|
return;
|
|
61
74
|
this.#destroyed = true;
|
|
62
|
-
this.element
|
|
75
|
+
this.element.remove();
|
|
63
76
|
this.emit('destroy');
|
|
64
77
|
}
|
|
65
78
|
addNavItem(navItemDescriptor) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return;
|
|
79
|
+
this.setLoading(false);
|
|
80
|
+
const { element } = this;
|
|
69
81
|
const navMenuContainerElement = querySelector(element, NAV_MENU_CONTAINER_ELEMENT_SELECTOR);
|
|
70
82
|
const appId = `collapsible-panel-${this.#id}`;
|
|
71
83
|
const navItemDescriptorPropertyStream = kefirCast(Kefir, navItemDescriptor).toProperty();
|
|
@@ -74,12 +86,11 @@ export class CollapsiblePanelView extends EventEmitter {
|
|
|
74
86
|
return navItemView;
|
|
75
87
|
}
|
|
76
88
|
#setupElement() {
|
|
77
|
-
const {
|
|
89
|
+
const { panelDescriptor } = this;
|
|
90
|
+
const { loadingIcon } = panelDescriptor;
|
|
91
|
+
const { iconUrl: themedIcons, className, name = '', } = panelDescriptor?.primaryButton ?? {};
|
|
78
92
|
const element = document.createElement('div');
|
|
79
|
-
|
|
80
|
-
element.className = cx(ELEMENT_CLASS, {
|
|
81
|
-
[CollapsiblePanelView.elementCss.COLLAPSED]: !burgerMenuOpen,
|
|
82
|
-
});
|
|
93
|
+
element.className = cx(ELEMENT_CLASS, this.panelDescriptor.className);
|
|
83
94
|
const primaryButtonClass = cx(PRIMARY_BUTTON_ELEMENT_CLASS, className);
|
|
84
95
|
let iconUrl;
|
|
85
96
|
if (themedIcons) {
|
|
@@ -99,7 +110,8 @@ export class CollapsiblePanelView extends EventEmitter {
|
|
|
99
110
|
</div>
|
|
100
111
|
</div>
|
|
101
112
|
</div>
|
|
102
|
-
<div class="
|
|
113
|
+
<div class="${scrollablePanelClass}">
|
|
114
|
+
<div class="${loadingElementClass}">${loadingIcon ? { __html: loadingIcon } : ''}</div>
|
|
103
115
|
<div class="Ls77Lb aZ6">
|
|
104
116
|
<div class="pp" style="user-select: none;">
|
|
105
117
|
<div>
|
|
@@ -131,25 +143,21 @@ export class CollapsiblePanelView extends EventEmitter {
|
|
|
131
143
|
return element;
|
|
132
144
|
}
|
|
133
145
|
#onPrimaryButtonClick = (e) => {
|
|
134
|
-
this
|
|
146
|
+
this.panelDescriptor.primaryButton?.onClick?.(e);
|
|
135
147
|
};
|
|
136
148
|
#update() {
|
|
137
149
|
const element = this.element;
|
|
138
150
|
if (!element)
|
|
139
151
|
return;
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const isCollapsed = element.classList.contains(COLLAPSED);
|
|
143
|
-
element.className = cx(ELEMENT_CLASS, this.#panelDescriptor?.className, {
|
|
144
|
-
[ACTIVE]: isActive,
|
|
145
|
-
[COLLAPSED]: isCollapsed,
|
|
146
|
-
});
|
|
152
|
+
const existingClassNames = Object.values(CollapsiblePanelView.elementCss).filter((className) => element.classList.contains(className));
|
|
153
|
+
element.className = cx(ELEMENT_CLASS, this.panelDescriptor.className, ...existingClassNames);
|
|
147
154
|
this.#updateName(element);
|
|
148
155
|
this.#updateIcon(element);
|
|
156
|
+
this.#updateScrollablePanelLoading(element);
|
|
149
157
|
}
|
|
150
158
|
#updateIcon(element) {
|
|
151
159
|
const iconContainerEl = querySelector(element, PRIMARY_BUTTON_ELEMENT_SELECTOR);
|
|
152
|
-
const { iconUrl, className } = this
|
|
160
|
+
const { iconUrl, className } = this.panelDescriptor.primaryButton ?? {};
|
|
153
161
|
if (iconUrl) {
|
|
154
162
|
const backgroundImage = `url(${GmailElementGetter.isDarkTheme()
|
|
155
163
|
? iconUrl.darkTheme
|
|
@@ -166,6 +174,19 @@ export class CollapsiblePanelView extends EventEmitter {
|
|
|
166
174
|
if (!buttonTextEl) {
|
|
167
175
|
return;
|
|
168
176
|
}
|
|
169
|
-
buttonTextEl.textContent = this
|
|
177
|
+
buttonTextEl.textContent = this.panelDescriptor.primaryButton?.name ?? '';
|
|
178
|
+
}
|
|
179
|
+
#updateScrollablePanelLoading(element) {
|
|
180
|
+
const scrollablePanelLoadingEl = element.querySelector(loadingElementSelector);
|
|
181
|
+
if (!scrollablePanelLoadingEl) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const panelLoadingClass = `${loadingElementClass}--active`;
|
|
185
|
+
if (this.loading) {
|
|
186
|
+
scrollablePanelLoadingEl.classList.add(panelLoadingClass);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
scrollablePanelLoadingEl.classList.remove(panelLoadingClass);
|
|
190
|
+
}
|
|
170
191
|
}
|
|
171
192
|
}
|