@openfin/core 29.72.18 → 29.73.2

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.
Files changed (64) hide show
  1. package/OpenFin.d.ts +40 -23
  2. package/package.json +1 -1
  3. package/src/api/application/Factory.js +3 -3
  4. package/src/api/application/index.js +7 -3
  5. package/src/api/base.js +18 -20
  6. package/src/api/external-application/index.js +7 -3
  7. package/src/api/fin.js +2 -2
  8. package/src/api/frame/Factory.js +2 -2
  9. package/src/api/frame/index.js +7 -3
  10. package/src/api/interappbus/channel/client.js +24 -26
  11. package/src/api/interappbus/channel/connection-manager.js +24 -26
  12. package/src/api/interappbus/channel/index.js +16 -18
  13. package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
  14. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +24 -26
  15. package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
  16. package/src/api/interappbus/channel/provider.js +134 -139
  17. package/src/api/interappbus/index.js +1 -1
  18. package/src/api/interop/InteropBroker.js +9 -9
  19. package/src/api/interop/InteropClient.js +38 -40
  20. package/src/api/interop/SessionContextGroupClient.js +22 -24
  21. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +17 -0
  22. package/src/api/interop/fdc3/PrivateChannelClient.js +82 -0
  23. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +40 -0
  24. package/src/api/interop/fdc3/PrivateChannelProvider.js +224 -0
  25. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -1
  26. package/src/api/interop/fdc3/fdc3-1.2.js +1 -27
  27. package/src/api/interop/fdc3/fdc3-2.0.d.ts +20 -1
  28. package/src/api/interop/fdc3/fdc3-2.0.js +29 -4
  29. package/src/api/interop/fdc3/utils.d.ts +4 -0
  30. package/src/api/interop/fdc3/utils.js +112 -4
  31. package/src/api/interop/index.js +7 -3
  32. package/src/api/interop/utils.js +20 -14
  33. package/src/api/platform/Factory.js +5 -5
  34. package/src/api/platform/Instance.js +11 -12
  35. package/src/api/platform/index.js +7 -3
  36. package/src/api/platform/layout/Factory.js +18 -20
  37. package/src/api/platform/layout/Instance.d.ts +1 -1
  38. package/src/api/platform/layout/Instance.js +2 -2
  39. package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
  40. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +17 -8
  41. package/src/api/platform/layout/controllers/tab-drag-controller.js +44 -22
  42. package/src/api/platform/layout/index.js +7 -3
  43. package/src/api/platform/layout/utils/bounds-observer.js +5 -3
  44. package/src/api/snapshot-source/Factory.js +1 -1
  45. package/src/api/snapshot-source/Instance.js +33 -35
  46. package/src/api/snapshot-source/index.js +7 -3
  47. package/src/api/snapshot-source/utils.js +2 -1
  48. package/src/api/view/Factory.js +2 -2
  49. package/src/api/view/Instance.d.ts +31 -1
  50. package/src/api/view/Instance.js +31 -1
  51. package/src/api/view/index.js +7 -3
  52. package/src/api/window/Factory.js +2 -2
  53. package/src/api/window/Instance.d.ts +3 -0
  54. package/src/api/window/Instance.js +3 -0
  55. package/src/api/window/index.js +7 -3
  56. package/src/environment/node-env.js +2 -2
  57. package/src/environment/openfin-env.js +15 -17
  58. package/src/fdc3.js +1 -1
  59. package/src/mock.js +1 -2
  60. package/src/transport/transport.js +26 -28
  61. package/src/transport/wire.d.ts +9 -7
  62. package/src/util/http.d.ts +1 -1
  63. package/src/util/http.js +16 -11
  64. package/src/util/normalize-config.js +5 -5
@@ -71,7 +71,7 @@ class PlatformModule extends base_1.Base {
71
71
  async init(options) {
72
72
  const overrideCallback = options === null || options === void 0 ? void 0 : options.overrideCallback;
73
73
  const interopBroker = await this.fin.Interop.init(this.fin.me.uuid, options === null || options === void 0 ? void 0 : options.interopOverride);
74
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
74
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
75
75
  // @ts-ignore debugging purposes
76
76
  window.interopBroker = interopBroker;
77
77
  return this._initializer(overrideCallback, interopBroker);
@@ -142,11 +142,11 @@ class PlatformModule extends base_1.Base {
142
142
  return new Promise(async (resolve, reject) => {
143
143
  try {
144
144
  const { uuid } = platformOptions;
145
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
145
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
146
146
  // @ts-ignore using private variable.
147
147
  const app = await this.fin.Application._create({ ...platformOptions, isPlatformController: true });
148
148
  app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid })));
149
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
149
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
150
150
  // @ts-ignore using private variable.
151
151
  app._run({ uuid });
152
152
  }
@@ -171,11 +171,11 @@ class PlatformModule extends base_1.Base {
171
171
  // eslint-disable-next-line no-async-promise-executor
172
172
  return new Promise(async (resolve, reject) => {
173
173
  try {
174
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
174
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
175
175
  // @ts-ignore using private variable.
176
176
  const app = await this.fin.Application._createFromManifest(manifestUrl);
177
177
  app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid: app.identity.uuid })));
178
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
178
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
179
179
  // @ts-ignore using private method without warning.
180
180
  app._run(opts);
181
181
  }
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to get private field on non-instance");
5
- }
6
- return privateMap.get(receiver);
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
6
  };
8
- var _connectToProvider;
7
+ var _Platform_connectToProvider;
9
8
  Object.defineProperty(exports, "__esModule", { value: true });
10
9
  exports.Platform = void 0;
11
10
  const base_1 = require("../base");
@@ -30,14 +29,14 @@ class Platform extends base_1.EmitterBase {
30
29
  const target = identity || this.identity;
31
30
  const { uuid } = target;
32
31
  if (!clientMap.has(uuid)) {
33
- const clientPromise = __classPrivateFieldGet(this, _connectToProvider).call(this, uuid);
32
+ const clientPromise = __classPrivateFieldGet(this, _Platform_connectToProvider, "f").call(this, uuid);
34
33
  clientMap.set(uuid, clientPromise);
35
34
  }
36
35
  // we set it above
37
36
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
38
37
  return clientMap.get(uuid);
39
38
  };
40
- _connectToProvider.set(this, async (uuid) => {
39
+ _Platform_connectToProvider.set(this, async (uuid) => {
41
40
  try {
42
41
  const channelName = `custom-frame-${uuid}`;
43
42
  const client = await this._channel.connect(channelName, { wait: false });
@@ -53,7 +52,7 @@ class Platform extends base_1.EmitterBase {
53
52
  });
54
53
  // Deprecated (renamed)
55
54
  this.launchLegacyManifest = this.launchContentManifest;
56
- const errorMsg = validate_1.validateIdentity(identity);
55
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
57
56
  if (errorMsg) {
58
57
  throw new Error(errorMsg);
59
58
  }
@@ -80,7 +79,7 @@ class Platform extends base_1.EmitterBase {
80
79
  opts: viewOptions,
81
80
  targetView
82
81
  });
83
- if (!response || validate_1.validateIdentity(response.identity)) {
82
+ if (!response || (0, validate_1.validateIdentity)(response.identity)) {
84
83
  throw new Error(`When overwriting the createView call, please return an object that has a valid 'identity' property: ${JSON.stringify(response)}`);
85
84
  }
86
85
  return this.fin.View.wrapSync(response.identity);
@@ -100,7 +99,7 @@ class Platform extends base_1.EmitterBase {
100
99
  options.reason = 'api-call';
101
100
  }
102
101
  const response = await client.dispatch('create-view-container', options);
103
- if (!response || validate_1.validateIdentity(response.identity)) {
102
+ if (!response || (0, validate_1.validateIdentity)(response.identity)) {
104
103
  throw new Error(`When overwriting the createWindow call, please return an object that has a valid 'identity' property: ${JSON.stringify(response)}`);
105
104
  }
106
105
  const { identity } = response;
@@ -311,4 +310,4 @@ class Platform extends base_1.EmitterBase {
311
310
  }
312
311
  }
313
312
  exports.Platform = Platform;
314
- _connectToProvider = new WeakMap();
313
+ _Platform_connectToProvider = new WeakMap();
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- }
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  const Factory_1 = require("./Factory");
14
18
  exports.default = Factory_1.default;
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to get private field on non-instance");
5
- }
6
- return privateMap.get(receiver);
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
6
  };
8
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
9
- if (!privateMap.has(receiver)) {
10
- throw new TypeError("attempted to set private field on non-instance");
11
- }
12
- privateMap.set(receiver, value);
13
- return value;
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
14
12
  };
15
- var _layoutManager;
13
+ var _LayoutModule_layoutManager;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  exports.LayoutModule = void 0;
18
16
  /* eslint-disable no-undef, import/prefer-default-export */
@@ -84,7 +82,7 @@ const view_overlay_1 = require("./utils/view-overlay");
84
82
  class LayoutModule extends base_1.Base {
85
83
  constructor() {
86
84
  super(...arguments);
87
- _layoutManager.set(this, void 0);
85
+ _LayoutModule_layoutManager.set(this, void 0);
88
86
  /**
89
87
  * Initialize the window's Layout. Must be called from a custom window that has a 'layout' option set upon creation of that window.
90
88
  * If a containerId is not provided, this method attempts to find an element with the id `layout-container`.
@@ -103,7 +101,7 @@ class LayoutModule extends base_1.Base {
103
101
  if (!this.fin.me.isWindow) {
104
102
  throw new Error('Layout.init can only be called from a Window context.');
105
103
  }
106
- else if (__classPrivateFieldGet(this, _layoutManager)) {
104
+ else if (__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f")) {
107
105
  throw new Error('Layout for this window already initialized, please use Layout.replace call to replace the layout.');
108
106
  }
109
107
  // We need to go through environment to make sure it is only imported/bundled in OpenFin.
@@ -111,8 +109,8 @@ class LayoutModule extends base_1.Base {
111
109
  const viewOverlay = new view_overlay_1.ViewOverlay(this.wire);
112
110
  const splitterController = new splitter_controller_1.SplitterController(viewOverlay);
113
111
  const tabDragController = new tab_drag_controller_1.TabDragController(viewOverlay);
114
- __classPrivateFieldSet(this, _layoutManager, new ManagerConstructor(splitterController, tabDragController));
115
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
112
+ __classPrivateFieldSet(this, _LayoutModule_layoutManager, new ManagerConstructor(splitterController, tabDragController), "f");
113
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
116
114
  // @ts-ignore - layout warning here for backwards compatibility, can remove layout check in .52
117
115
  let { layout, containerId } = options;
118
116
  if (layout) {
@@ -125,10 +123,10 @@ class LayoutModule extends base_1.Base {
125
123
  // Should we error here if there is no container? Getting a typescript complaint on createLayout
126
124
  // override here
127
125
  // pull createChannelConnection out of LayoutManager and setup channel connections here using layoutmanager instance methods?
128
- await __classPrivateFieldGet(this, _layoutManager).initManager();
129
- await __classPrivateFieldGet(this, _layoutManager).createLayout(layout, container);
126
+ await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").initManager();
127
+ await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").createLayout(layout, container);
130
128
  // Adding this to the returned instance undocumented/typed for Browser.
131
- return Object.assign(this.getCurrentSync(), { layoutManager: __classPrivateFieldGet(this, _layoutManager) });
129
+ return Object.assign(this.getCurrentSync(), { layoutManager: __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f") });
132
130
  };
133
131
  }
134
132
  /**
@@ -193,4 +191,4 @@ class LayoutModule extends base_1.Base {
193
191
  }
194
192
  }
195
193
  exports.LayoutModule = LayoutModule;
196
- _layoutManager = new WeakMap();
194
+ _LayoutModule_layoutManager = new WeakMap();
@@ -26,7 +26,7 @@ export declare class Layout extends Base {
26
26
  * @return { Promise<void> }
27
27
  * @tutorial Layout.replace
28
28
  */
29
- replace: (layout: any) => Promise<void>;
29
+ replace: (layout: OpenFin.LayoutOptions) => Promise<void>;
30
30
  /**
31
31
  * Replaces the specified view with a view with the provided configuration.
32
32
  * The old view is stripped of its listeners and either closed or attached to the provider window
@@ -63,7 +63,7 @@ class Layout extends base_1.Base {
63
63
  });
64
64
  const client = await this.platform.getClient();
65
65
  const { presetType } = options;
66
- if (!presetType || !common_utils_1.isValidPresetType(presetType)) {
66
+ if (!presetType || !(0, common_utils_1.isValidPresetType)(presetType)) {
67
67
  throw new Error('Cannot apply preset layout, please include an applicable presetType property in the PresetLayoutOptions.');
68
68
  }
69
69
  await client.dispatch('apply-preset-layout', {
@@ -71,7 +71,7 @@ class Layout extends base_1.Base {
71
71
  opts: { presetType }
72
72
  });
73
73
  };
74
- const errorMsg = validate_1.validateIdentity(identity);
74
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
75
75
  if (errorMsg) {
76
76
  throw new Error(errorMsg);
77
77
  }
@@ -68,7 +68,7 @@ class SplitterController {
68
68
  this.viewOverlay.renderOverlay(offsetBounds);
69
69
  };
70
70
  await this.viewOverlay.setStyle({ backgroundColor });
71
- const teardownBoundsObserver = bounds_observer_1.observeBounds(splitterDiv, onBoundsChange);
71
+ const teardownBoundsObserver = (0, bounds_observer_1.observeBounds)(splitterDiv, onBoundsChange);
72
72
  this.teardown = () => {
73
73
  teardownBoundsObserver();
74
74
  splitterDiv.style.visibility = initialVisibility;
@@ -9,17 +9,24 @@ export declare class TabDragController {
9
9
  constructor(viewOverlay: ViewOverlay);
10
10
  private dropZonePreview?;
11
11
  /**
12
- * When a tab is dragged from a stack greater than one, it's view will need to be hidden and the
13
- * view next in the stack shown.
14
12
  *
15
- * Conversely, when a view is the last view in a window, it will need to remain visible.
13
+ * When a tab is dragged out of a stack, it will need to be hidden from the stack.
16
14
  *
17
- * This function implements this logic accordingly
18
- * @param movingView The view which is currently being dragged
19
- * @param currentView The current active view of the tabstack
20
- * @param isOnlyViewInWindow Indicates whether the moving view is the only in the platform window.
15
+ * Additionally, if there is a new view to show in the stack, it will be shown at the position specified by
16
+ * containerBounds
17
+ *
18
+ * As drag interactions can under extreme circumstances complete before this chain of promises has completed,
19
+ * we need to pass in a isDragging() function which returns whether the drag is in progress.
20
+ * This allows us to cancel any layout affecting operations.
21
+ *
22
+ * @param draggingView The view which is currently being dragged
23
+ * @param isLastViewInWindow Whether the draggin view is the last view in a window or not. If false, the dragging view will not hide.
24
+ * @param isDragging A function which returns true if the drag is still in progress. As we chain some async calls here, we want to avoid
25
+ * modifying any views if the drag has completed (as the post drag procedure will have taken care of it.)
26
+ * @param containerBounds The bounds of the container of the view to be shown in the stack
27
+ * @param nextView The view which has become active after dragging the draggingView out.
21
28
  */
22
- handleTabStackActiveView: (movingView: View, currentView: View, isOnlyViewInWindow: boolean) => Promise<void>;
29
+ handleTabStackActiveView: (draggingView: View, isLastViewInWindow: boolean, isDragging: () => boolean, containerBounds?: OpenFin.Bounds, nextView?: View) => Promise<void>;
23
30
  /**
24
31
  * Extracts the border and backgroundColor css values from the drop zone preview,
25
32
  * and sets the viewOverlay to match them.
@@ -38,6 +45,8 @@ export declare class TabDragController {
38
45
  * Disables the click through setting on every view in the platform.
39
46
  */
40
47
  endDrag: () => Promise<void>;
48
+ private disposeObserve?;
49
+ disposeOverlayObserver: () => void;
41
50
  /**
42
51
  * Observes a golden-layout drop zone preview in order to render a BrowserView
43
52
  * overlay whenever a tab is dragged over a droppable region.
@@ -11,29 +11,36 @@ class TabDragController {
11
11
  constructor(viewOverlay) {
12
12
  this.viewOverlay = viewOverlay;
13
13
  /**
14
- * When a tab is dragged from a stack greater than one, it's view will need to be hidden and the
15
- * view next in the stack shown.
16
14
  *
17
- * Conversely, when a view is the last view in a window, it will need to remain visible.
15
+ * When a tab is dragged out of a stack, it will need to be hidden from the stack.
18
16
  *
19
- * This function implements this logic accordingly
20
- * @param movingView The view which is currently being dragged
21
- * @param currentView The current active view of the tabstack
22
- * @param isOnlyViewInWindow Indicates whether the moving view is the only in the platform window.
17
+ * Additionally, if there is a new view to show in the stack, it will be shown at the position specified by
18
+ * containerBounds
19
+ *
20
+ * As drag interactions can under extreme circumstances complete before this chain of promises has completed,
21
+ * we need to pass in a isDragging() function which returns whether the drag is in progress.
22
+ * This allows us to cancel any layout affecting operations.
23
+ *
24
+ * @param draggingView The view which is currently being dragged
25
+ * @param isLastViewInWindow Whether the draggin view is the last view in a window or not. If false, the dragging view will not hide.
26
+ * @param isDragging A function which returns true if the drag is still in progress. As we chain some async calls here, we want to avoid
27
+ * modifying any views if the drag has completed (as the post drag procedure will have taken care of it.)
28
+ * @param containerBounds The bounds of the container of the view to be shown in the stack
29
+ * @param nextView The view which has become active after dragging the draggingView out.
23
30
  */
24
- this.handleTabStackActiveView = async (movingView, currentView, isOnlyViewInWindow) => {
31
+ this.handleTabStackActiveView = async (draggingView, isLastViewInWindow, isDragging, containerBounds, nextView) => {
25
32
  if (this.dropZonePreview) {
26
- const hideMovingViewIfPossible = async () => {
27
- if (!isOnlyViewInWindow) {
28
- await movingView.hide();
33
+ if (nextView && containerBounds) {
34
+ if (isDragging()) {
35
+ await (nextView === null || nextView === void 0 ? void 0 : nextView.show());
29
36
  }
30
- };
31
- const showCurrentView = async () => {
32
- if (currentView.identity.name !== movingView.identity.name) {
33
- await currentView.show();
37
+ if (isDragging()) {
38
+ await (nextView === null || nextView === void 0 ? void 0 : nextView.setBounds(containerBounds));
34
39
  }
35
- };
36
- await Promise.all([hideMovingViewIfPossible(), showCurrentView()]);
40
+ }
41
+ if (isDragging() && !isLastViewInWindow) {
42
+ await draggingView.hide();
43
+ }
37
44
  }
38
45
  };
39
46
  /**
@@ -63,6 +70,12 @@ class TabDragController {
63
70
  this.endDrag = async () => {
64
71
  await this.viewOverlay.setIgnoreViewMouseEvents(false);
65
72
  };
73
+ this.disposeOverlayObserver = () => {
74
+ if (this.disposeObserve) {
75
+ this.disposeObserve();
76
+ }
77
+ this.dropZonePreview = undefined;
78
+ };
66
79
  /**
67
80
  * Observes a golden-layout drop zone preview in order to render a BrowserView
68
81
  * overlay whenever a tab is dragged over a droppable region.
@@ -74,10 +87,10 @@ class TabDragController {
74
87
  this.dropZonePreview = dropZonePreview;
75
88
  let lastBounds;
76
89
  dropZonePreview.style.visibility = 'hidden';
77
- dropZonePreview.addEventListener('drop-area-highlighted', async (e) => {
90
+ const onDropAreaHighlighted = async (e) => {
78
91
  try {
79
92
  const { bounds } = e.detail;
80
- if (!lastBounds || !bounds_observer_1.isDomRectEqual(lastBounds, bounds)) {
93
+ if (!lastBounds || !(0, bounds_observer_1.isDomRectEqual)(lastBounds, bounds)) {
81
94
  lastBounds = bounds;
82
95
  await this.viewOverlay.renderOverlay(bounds);
83
96
  }
@@ -85,8 +98,8 @@ class TabDragController {
85
98
  catch (error) {
86
99
  console.warn('Unexpected error encountered rendering tab drag preview.', error);
87
100
  }
88
- });
89
- dropZonePreview.addEventListener('drop-area-hidden', async () => {
101
+ };
102
+ const onDropAreaHidden = async () => {
90
103
  try {
91
104
  lastBounds = undefined;
92
105
  await this.viewOverlay.detachOverlay();
@@ -94,7 +107,16 @@ class TabDragController {
94
107
  catch (error) {
95
108
  console.warn('Unexpected error encountered hiding tab drag preview.', error);
96
109
  }
97
- });
110
+ };
111
+ dropZonePreview.addEventListener('drop-area-highlighted', onDropAreaHighlighted);
112
+ dropZonePreview.addEventListener('drop-area-hidden', onDropAreaHidden);
113
+ this.disposeObserve = () => {
114
+ dropZonePreview.removeEventListener('drop-area-highlighted', onDropAreaHighlighted);
115
+ dropZonePreview.removeEventListener('drop-area-hidden', onDropAreaHidden);
116
+ };
117
+ }
118
+ else {
119
+ console.warn('Tried to observe a drop zone overlay without disposing the previous.');
98
120
  }
99
121
  };
100
122
  }
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- }
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./Factory"), exports);
14
18
  __exportStar(require("./Instance"), exports);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.observeBounds = exports.isDomRectEqual = void 0;
4
- exports.isDomRectEqual = (a, b) => {
4
+ const isDomRectEqual = (a, b) => {
5
5
  if (a.top !== b.top ||
6
6
  a.left !== b.left ||
7
7
  a.width !== b.width ||
@@ -12,6 +12,7 @@ exports.isDomRectEqual = (a, b) => {
12
12
  }
13
13
  return true;
14
14
  };
15
+ exports.isDomRectEqual = isDomRectEqual;
15
16
  /**
16
17
  * Observes the bounding client box rectangle of the given element for changes.
17
18
  *
@@ -29,11 +30,11 @@ exports.isDomRectEqual = (a, b) => {
29
30
  * @returns Function which disposes the observers when invoked.
30
31
  * @ignore
31
32
  */
32
- exports.observeBounds = (element, onChange) => {
33
+ const observeBounds = (element, onChange) => {
33
34
  let lastBounds;
34
35
  const checkBounds = () => {
35
36
  const currentBounds = element.getBoundingClientRect();
36
- if (!lastBounds || !exports.isDomRectEqual(lastBounds, currentBounds)) {
37
+ if (!lastBounds || !(0, exports.isDomRectEqual)(lastBounds, currentBounds)) {
37
38
  lastBounds = currentBounds;
38
39
  onChange(element.getBoundingClientRect());
39
40
  }
@@ -48,3 +49,4 @@ exports.observeBounds = (element, onChange) => {
48
49
  mutationObserver.disconnect();
49
50
  };
50
51
  };
52
+ exports.observeBounds = observeBounds;
@@ -28,7 +28,7 @@ class SnapshotSourceModule extends base_1.Base {
28
28
  typeof provider.applySnapshot !== 'function') {
29
29
  throw new Error('you must pass in a valid SnapshotProvider');
30
30
  }
31
- const channel = await this.fin.InterApplicationBus.Channel.create(utils_1.getSnapshotSourceChannelName(fin.me.identity));
31
+ const channel = await this.fin.InterApplicationBus.Channel.create((0, utils_1.getSnapshotSourceChannelName)(fin.me.identity));
32
32
  channel.register('get-snapshot', async () => {
33
33
  const snapshot = await provider.getSnapshot();
34
34
  return { snapshot };
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8
7
  };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14
12
  };
15
- var _identity, _getConnection, _getClient, _startConnection, _setUpConnectionListener;
13
+ var _SnapshotSource_identity, _SnapshotSource_getConnection, _SnapshotSource_getClient, _SnapshotSource_startConnection, _SnapshotSource_setUpConnectionListener;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  exports.SnapshotSource = void 0;
18
16
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
@@ -26,46 +24,46 @@ const connectionMap = new Map();
26
24
  class SnapshotSource extends base_1.Base {
27
25
  constructor(wire, id) {
28
26
  super(wire);
29
- _identity.set(this, void 0);
30
- _getConnection.set(this, () => {
27
+ _SnapshotSource_identity.set(this, void 0);
28
+ _SnapshotSource_getConnection.set(this, () => {
31
29
  if (!connectionMap.has(this.identity.uuid)) {
32
30
  connectionMap.set(this.identity.uuid, { eventFired: null, clientPromise: null });
33
31
  }
34
32
  return connectionMap.get(this.identity.uuid);
35
33
  });
36
- _getClient.set(this, () => {
37
- if (!__classPrivateFieldGet(this, _getConnection).call(this).clientPromise) {
38
- __classPrivateFieldGet(this, _getConnection).call(this).clientPromise = __classPrivateFieldGet(this, _startConnection).call(this);
34
+ _SnapshotSource_getClient.set(this, () => {
35
+ if (!__classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).clientPromise) {
36
+ __classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).clientPromise = __classPrivateFieldGet(this, _SnapshotSource_startConnection, "f").call(this);
39
37
  }
40
- return __classPrivateFieldGet(this, _getConnection).call(this).clientPromise;
38
+ return __classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).clientPromise;
41
39
  });
42
- _startConnection.set(this, async () => {
43
- const channelName = utils_1.getSnapshotSourceChannelName(this.identity);
40
+ _SnapshotSource_startConnection.set(this, async () => {
41
+ const channelName = (0, utils_1.getSnapshotSourceChannelName)(this.identity);
44
42
  try {
45
- if (!__classPrivateFieldGet(this, _getConnection).call(this).eventFired) {
46
- await __classPrivateFieldGet(this, _setUpConnectionListener).call(this);
43
+ if (!__classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).eventFired) {
44
+ await __classPrivateFieldGet(this, _SnapshotSource_setUpConnectionListener, "f").call(this);
47
45
  }
48
46
  const client = await this.fin.InterApplicationBus.Channel.connect(channelName, { wait: false });
49
47
  client.onDisconnection(() => {
50
- __classPrivateFieldGet(this, _getConnection).call(this).clientPromise = null;
51
- __classPrivateFieldGet(this, _getConnection).call(this).eventFired = null;
48
+ __classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).clientPromise = null;
49
+ __classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).eventFired = null;
52
50
  });
53
51
  return client;
54
52
  }
55
53
  catch (e) {
56
- __classPrivateFieldGet(this, _getConnection).call(this).clientPromise = null;
54
+ __classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).clientPromise = null;
57
55
  throw new Error("The targeted SnapshotSource is not currently initialized. Await this object's ready() method.");
58
56
  }
59
57
  });
60
- _setUpConnectionListener.set(this, async () => {
61
- const channelName = utils_1.getSnapshotSourceChannelName(this.identity);
58
+ _SnapshotSource_setUpConnectionListener.set(this, async () => {
59
+ const channelName = (0, utils_1.getSnapshotSourceChannelName)(this.identity);
62
60
  let resolve;
63
61
  let reject;
64
62
  const eventFired = new Promise((y, n) => {
65
63
  resolve = y;
66
64
  reject = n;
67
65
  });
68
- __classPrivateFieldGet(this, _getConnection).call(this).eventFired = eventFired;
66
+ __classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).eventFired = eventFired;
69
67
  const listener = async (e) => {
70
68
  try {
71
69
  if (e.channelName === channelName) {
@@ -79,10 +77,10 @@ class SnapshotSource extends base_1.Base {
79
77
  };
80
78
  await this.fin.InterApplicationBus.Channel.on('connected', listener);
81
79
  });
82
- __classPrivateFieldSet(this, _identity, id);
80
+ __classPrivateFieldSet(this, _SnapshotSource_identity, id, "f");
83
81
  }
84
82
  get identity() {
85
- return __classPrivateFieldGet(this, _identity);
83
+ return __classPrivateFieldGet(this, _SnapshotSource_identity, "f");
86
84
  }
87
85
  /**
88
86
  * Method to determine if the SnapshotSource has been initialized.
@@ -99,11 +97,11 @@ class SnapshotSource extends base_1.Base {
99
97
  // eslint-disable-next-line no-async-promise-executor
100
98
  try {
101
99
  // If getClient was already called before this, do we have a timing issue where the channel might have been created but we missed the event but this still fails?
102
- await __classPrivateFieldGet(this, _getClient).call(this);
100
+ await __classPrivateFieldGet(this, _SnapshotSource_getClient, "f").call(this);
103
101
  }
104
102
  catch (e) {
105
103
  // it was not running.
106
- await __classPrivateFieldGet(this, _getConnection).call(this).eventFired;
104
+ await __classPrivateFieldGet(this, _SnapshotSource_getConnection, "f").call(this).eventFired;
107
105
  }
108
106
  }
109
107
  /**
@@ -114,7 +112,7 @@ class SnapshotSource extends base_1.Base {
114
112
  this.wire.sendAction('snapshot-source-get-snapshot').catch((e) => {
115
113
  // don't expose, analytics-only call
116
114
  });
117
- const client = await __classPrivateFieldGet(this, _getClient).call(this);
115
+ const client = await __classPrivateFieldGet(this, _SnapshotSource_getClient, "f").call(this);
118
116
  const response = (await client.dispatch('get-snapshot'));
119
117
  return (await response).snapshot;
120
118
  }
@@ -126,9 +124,9 @@ class SnapshotSource extends base_1.Base {
126
124
  this.wire.sendAction('snapshot-source-apply-snapshot').catch((e) => {
127
125
  // don't expose, analytics-only call
128
126
  });
129
- const client = await __classPrivateFieldGet(this, _getClient).call(this);
127
+ const client = await __classPrivateFieldGet(this, _SnapshotSource_getClient, "f").call(this);
130
128
  return client.dispatch('apply-snapshot', { snapshot });
131
129
  }
132
130
  }
133
131
  exports.SnapshotSource = SnapshotSource;
134
- _identity = new WeakMap(), _getConnection = new WeakMap(), _getClient = new WeakMap(), _startConnection = new WeakMap(), _setUpConnectionListener = new WeakMap();
132
+ _SnapshotSource_identity = new WeakMap(), _SnapshotSource_getConnection = new WeakMap(), _SnapshotSource_getClient = new WeakMap(), _SnapshotSource_startConnection = new WeakMap(), _SnapshotSource_setUpConnectionListener = new WeakMap();
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- }
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  const Factory_1 = require("./Factory");
14
18
  exports.default = Factory_1.default;