@interopio/groups-ui-react 2.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/README.md +27 -0
- package/dist/cjs/GroupElementCreationWrapper.d.ts +4 -0
- package/dist/cjs/GroupWrapper.d.ts +9 -0
- package/dist/cjs/Portal.d.ts +6 -0
- package/dist/cjs/defaultComponents/buttons/BaseButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/CloseButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/CustomButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/ExtractButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/FeedbackButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/LockButtons.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/MaximizeButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/MinimizeButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/RestoreButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/StickyButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/buttons/UnlockButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/captionEditor/CaptionEditor.d.ts +4 -0
- package/dist/cjs/defaultComponents/captionEditor/useCaptionEditor.d.ts +4 -0
- package/dist/cjs/defaultComponents/captionEditor/useCommitEditingRequested.d.ts +3 -0
- package/dist/cjs/defaultComponents/captionEditor/useEditableCaption.d.ts +4 -0
- package/dist/cjs/defaultComponents/channelSelector/BaseChannelSelector.d.ts +4 -0
- package/dist/cjs/defaultComponents/channelSelector/FlatChannelSelector.d.ts +4 -0
- package/dist/cjs/defaultComponents/channelSelector/TabChannelSelector.d.ts +4 -0
- package/dist/cjs/defaultComponents/channelSelector/utils.d.ts +1 -0
- package/dist/cjs/defaultComponents/flatCaptionBar/FlatButtons.d.ts +4 -0
- package/dist/cjs/defaultComponents/flatCaptionBar/FlatCaption.d.ts +4 -0
- package/dist/cjs/defaultComponents/flatCaptionBar/FlatCaptionBar.d.ts +4 -0
- package/dist/cjs/defaultComponents/flatCaptionBar/FlatCaptionEditor.d.ts +4 -0
- package/dist/cjs/defaultComponents/flatCaptionBar/FlatMoveArea.d.ts +4 -0
- package/dist/cjs/defaultComponents/flatCaptionBar/useCommitFlatCaptionEditingRequested.d.ts +2 -0
- package/dist/cjs/defaultComponents/groupCaptionBar/GroupButtons.d.ts +4 -0
- package/dist/cjs/defaultComponents/groupCaptionBar/GroupCaption.d.ts +4 -0
- package/dist/cjs/defaultComponents/groupCaptionBar/GroupCaptionBar.d.ts +4 -0
- package/dist/cjs/defaultComponents/groupCaptionBar/GroupCaptionEditor.d.ts +4 -0
- package/dist/cjs/defaultComponents/groupCaptionBar/GroupMoveArea.d.ts +4 -0
- package/dist/cjs/defaultComponents/groupCaptionBar/useCommitGroupCaptionEditingRequested.d.ts +2 -0
- package/dist/cjs/defaultComponents/loadingAnimation/FrameLoadingAnimation.d.ts +4 -0
- package/dist/cjs/defaultComponents/tabs/Tab.d.ts +4 -0
- package/dist/cjs/defaultComponents/tabs/TabCaption.d.ts +4 -0
- package/dist/cjs/defaultComponents/tabs/TabCaptionEditor.d.ts +4 -0
- package/dist/cjs/defaultComponents/tabs/TabCloseButton.d.ts +4 -0
- package/dist/cjs/defaultComponents/tabs/TabHeaderButtons.d.ts +4 -0
- package/dist/cjs/defaultComponents/tabs/useCommitTabCaptionEditingRequested.d.ts +2 -0
- package/dist/cjs/index.d.ts +49 -0
- package/dist/cjs/index.js +3256 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/api.d.ts +145 -0
- package/dist/cjs/types/defaultComponents.d.ts +130 -0
- package/dist/cjs/types/internal.d.ts +314 -0
- package/dist/cjs/useGDWindow.d.ts +2 -0
- package/dist/cjs/useGroupComponentVisibility.d.ts +3 -0
- package/dist/cjs/useIOConnectWindow.d.ts +2 -0
- package/dist/cjs/utils.d.ts +3 -0
- package/dist/cjs/webGroupsManager.d.ts +51 -0
- package/dist/cjs/webGroupsStore.d.ts +61 -0
- package/dist/esm/GroupElementCreationWrapper.d.ts +4 -0
- package/dist/esm/GroupWrapper.d.ts +9 -0
- package/dist/esm/Portal.d.ts +6 -0
- package/dist/esm/defaultComponents/buttons/BaseButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/CloseButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/CustomButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/ExtractButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/FeedbackButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/LockButtons.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/MaximizeButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/MinimizeButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/RestoreButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/StickyButton.d.ts +4 -0
- package/dist/esm/defaultComponents/buttons/UnlockButton.d.ts +4 -0
- package/dist/esm/defaultComponents/captionEditor/CaptionEditor.d.ts +4 -0
- package/dist/esm/defaultComponents/captionEditor/useCaptionEditor.d.ts +4 -0
- package/dist/esm/defaultComponents/captionEditor/useCommitEditingRequested.d.ts +3 -0
- package/dist/esm/defaultComponents/captionEditor/useEditableCaption.d.ts +4 -0
- package/dist/esm/defaultComponents/channelSelector/BaseChannelSelector.d.ts +4 -0
- package/dist/esm/defaultComponents/channelSelector/FlatChannelSelector.d.ts +4 -0
- package/dist/esm/defaultComponents/channelSelector/TabChannelSelector.d.ts +4 -0
- package/dist/esm/defaultComponents/channelSelector/utils.d.ts +1 -0
- package/dist/esm/defaultComponents/flatCaptionBar/FlatButtons.d.ts +4 -0
- package/dist/esm/defaultComponents/flatCaptionBar/FlatCaption.d.ts +4 -0
- package/dist/esm/defaultComponents/flatCaptionBar/FlatCaptionBar.d.ts +4 -0
- package/dist/esm/defaultComponents/flatCaptionBar/FlatCaptionEditor.d.ts +4 -0
- package/dist/esm/defaultComponents/flatCaptionBar/FlatMoveArea.d.ts +4 -0
- package/dist/esm/defaultComponents/flatCaptionBar/useCommitFlatCaptionEditingRequested.d.ts +2 -0
- package/dist/esm/defaultComponents/groupCaptionBar/GroupButtons.d.ts +4 -0
- package/dist/esm/defaultComponents/groupCaptionBar/GroupCaption.d.ts +4 -0
- package/dist/esm/defaultComponents/groupCaptionBar/GroupCaptionBar.d.ts +4 -0
- package/dist/esm/defaultComponents/groupCaptionBar/GroupCaptionEditor.d.ts +4 -0
- package/dist/esm/defaultComponents/groupCaptionBar/GroupMoveArea.d.ts +4 -0
- package/dist/esm/defaultComponents/groupCaptionBar/useCommitGroupCaptionEditingRequested.d.ts +2 -0
- package/dist/esm/defaultComponents/loadingAnimation/FrameLoadingAnimation.d.ts +4 -0
- package/dist/esm/defaultComponents/tabs/Tab.d.ts +4 -0
- package/dist/esm/defaultComponents/tabs/TabCaption.d.ts +4 -0
- package/dist/esm/defaultComponents/tabs/TabCaptionEditor.d.ts +4 -0
- package/dist/esm/defaultComponents/tabs/TabCloseButton.d.ts +4 -0
- package/dist/esm/defaultComponents/tabs/TabHeaderButtons.d.ts +4 -0
- package/dist/esm/defaultComponents/tabs/useCommitTabCaptionEditingRequested.d.ts +2 -0
- package/dist/esm/index.d.ts +49 -0
- package/dist/esm/index.js +3202 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/api.d.ts +145 -0
- package/dist/esm/types/defaultComponents.d.ts +130 -0
- package/dist/esm/types/internal.d.ts +314 -0
- package/dist/esm/useGDWindow.d.ts +2 -0
- package/dist/esm/useGroupComponentVisibility.d.ts +3 -0
- package/dist/esm/useIOConnectWindow.d.ts +2 -0
- package/dist/esm/utils.d.ts +3 -0
- package/dist/esm/webGroupsManager.d.ts +51 -0
- package/dist/esm/webGroupsStore.d.ts +61 -0
- package/dist/styles/fonts.css +2 -0
- package/dist/styles/groups.css +672 -0
- package/dist/styles/styles.css +679 -0
- package/dist/styles/themes.css +155 -0
- package/dist/styles/vars.css +105 -0
- package/package.json +85 -0
|
@@ -0,0 +1,3256 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('@interopio/react-hooks')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom', '@interopio/react-hooks'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["groups-ui-react"] = {}, global.React, global.ReactDOM, global["interopio-hooks"]));
|
|
5
|
+
})(this, (function (exports, React, ReactDOM, reactHooks) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
11
|
+
|
|
12
|
+
/*! *****************************************************************************
|
|
13
|
+
Copyright (c) Microsoft Corporation.
|
|
14
|
+
|
|
15
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
+
purpose with or without fee is hereby granted.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
+
***************************************************************************** */
|
|
26
|
+
/* global Reflect, Promise */
|
|
27
|
+
|
|
28
|
+
var extendStatics = function(d, b) {
|
|
29
|
+
extendStatics = Object.setPrototypeOf ||
|
|
30
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
31
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
32
|
+
return extendStatics(d, b);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function __extends(d, b) {
|
|
36
|
+
extendStatics(d, b);
|
|
37
|
+
function __() { this.constructor = d; }
|
|
38
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var __assign = function() {
|
|
42
|
+
__assign = Object.assign || function __assign(t) {
|
|
43
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
44
|
+
s = arguments[i];
|
|
45
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
46
|
+
}
|
|
47
|
+
return t;
|
|
48
|
+
};
|
|
49
|
+
return __assign.apply(this, arguments);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function __rest(s, e) {
|
|
53
|
+
var t = {};
|
|
54
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
55
|
+
t[p] = s[p];
|
|
56
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
57
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
58
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
59
|
+
t[p[i]] = s[p[i]];
|
|
60
|
+
}
|
|
61
|
+
return t;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var TargetType;
|
|
65
|
+
(function (TargetType) {
|
|
66
|
+
TargetType["Group"] = "group";
|
|
67
|
+
TargetType["Frame"] = "frame";
|
|
68
|
+
TargetType["TabBar"] = "tabBar";
|
|
69
|
+
TargetType["Tab"] = "tab";
|
|
70
|
+
})(TargetType || (TargetType = {}));
|
|
71
|
+
var StandardButtons;
|
|
72
|
+
(function (StandardButtons) {
|
|
73
|
+
StandardButtons["Feedback"] = "feedback";
|
|
74
|
+
StandardButtons["Sticky"] = "sticky";
|
|
75
|
+
StandardButtons["Extract"] = "extract";
|
|
76
|
+
StandardButtons["Lock"] = "lock";
|
|
77
|
+
StandardButtons["Unlock"] = "unlock";
|
|
78
|
+
StandardButtons["Minimize"] = "minimize";
|
|
79
|
+
StandardButtons["Maximize"] = "maximize";
|
|
80
|
+
StandardButtons["Restore"] = "restore";
|
|
81
|
+
StandardButtons["Close"] = "close";
|
|
82
|
+
})(StandardButtons || (StandardButtons = {}));
|
|
83
|
+
|
|
84
|
+
function createRegistry(options) {
|
|
85
|
+
if (options && options.errorHandling
|
|
86
|
+
&& typeof options.errorHandling !== "function"
|
|
87
|
+
&& options.errorHandling !== "log"
|
|
88
|
+
&& options.errorHandling !== "silent"
|
|
89
|
+
&& options.errorHandling !== "throw") {
|
|
90
|
+
throw new Error("Invalid options passed to createRegistry. Prop errorHandling should be [\"log\" | \"silent\" | \"throw\" | (err) => void], but " + typeof options.errorHandling + " was passed");
|
|
91
|
+
}
|
|
92
|
+
var _userErrorHandler = options && typeof options.errorHandling === "function" && options.errorHandling;
|
|
93
|
+
var callbacks = {};
|
|
94
|
+
function add(key, callback, replayArgumentsArr) {
|
|
95
|
+
var callbacksForKey = callbacks[key];
|
|
96
|
+
if (!callbacksForKey) {
|
|
97
|
+
callbacksForKey = [];
|
|
98
|
+
callbacks[key] = callbacksForKey;
|
|
99
|
+
}
|
|
100
|
+
callbacksForKey.push(callback);
|
|
101
|
+
if (replayArgumentsArr) {
|
|
102
|
+
setTimeout(function () {
|
|
103
|
+
replayArgumentsArr.forEach(function (replayArgument) {
|
|
104
|
+
var _a;
|
|
105
|
+
if ((_a = callbacks[key]) === null || _a === void 0 ? void 0 : _a.includes(callback)) {
|
|
106
|
+
try {
|
|
107
|
+
if (Array.isArray(replayArgument)) {
|
|
108
|
+
callback.apply(undefined, replayArgument);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
callback.apply(undefined, [replayArgument]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
_handleError(err, key);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}, 0);
|
|
120
|
+
}
|
|
121
|
+
return function () {
|
|
122
|
+
var allForKey = callbacks[key];
|
|
123
|
+
if (!allForKey) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
allForKey = allForKey.reduce(function (acc, element, index) {
|
|
127
|
+
if (!(element === callback && acc.length === index)) {
|
|
128
|
+
acc.push(element);
|
|
129
|
+
}
|
|
130
|
+
return acc;
|
|
131
|
+
}, []);
|
|
132
|
+
if (allForKey.length === 0) {
|
|
133
|
+
delete callbacks[key];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
callbacks[key] = allForKey;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function execute(key) {
|
|
141
|
+
var argumentsArr = [];
|
|
142
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
143
|
+
argumentsArr[_i - 1] = arguments[_i];
|
|
144
|
+
}
|
|
145
|
+
var callbacksForKey = callbacks[key];
|
|
146
|
+
if (!callbacksForKey || callbacksForKey.length === 0) {
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
var results = [];
|
|
150
|
+
callbacksForKey.forEach(function (callback) {
|
|
151
|
+
try {
|
|
152
|
+
var result = callback.apply(undefined, argumentsArr);
|
|
153
|
+
results.push(result);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
results.push(undefined);
|
|
157
|
+
_handleError(err, key);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return results;
|
|
161
|
+
}
|
|
162
|
+
function _handleError(exceptionArtifact, key) {
|
|
163
|
+
var errParam = exceptionArtifact instanceof Error ? exceptionArtifact : new Error(exceptionArtifact);
|
|
164
|
+
if (_userErrorHandler) {
|
|
165
|
+
_userErrorHandler(errParam);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
var msg = "[ERROR] callback-registry: User callback for key \"" + key + "\" failed: " + errParam.stack;
|
|
169
|
+
if (options) {
|
|
170
|
+
switch (options.errorHandling) {
|
|
171
|
+
case "log":
|
|
172
|
+
return console.error(msg);
|
|
173
|
+
case "silent":
|
|
174
|
+
return;
|
|
175
|
+
case "throw":
|
|
176
|
+
throw new Error(msg);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
console.error(msg);
|
|
180
|
+
}
|
|
181
|
+
function clear() {
|
|
182
|
+
callbacks = {};
|
|
183
|
+
}
|
|
184
|
+
function clearKey(key) {
|
|
185
|
+
var callbacksForKey = callbacks[key];
|
|
186
|
+
if (!callbacksForKey) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
delete callbacks[key];
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
add: add,
|
|
193
|
+
execute: execute,
|
|
194
|
+
clear: clear,
|
|
195
|
+
clearKey: clearKey
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
createRegistry.default = createRegistry;
|
|
199
|
+
var lib = createRegistry;
|
|
200
|
+
|
|
201
|
+
var WebGroupsManagerDecorator = /** @class */ (function () {
|
|
202
|
+
function WebGroupsManagerDecorator() {
|
|
203
|
+
this.registry = lib();
|
|
204
|
+
this.skipFocusStyle = "t42-skip-focus";
|
|
205
|
+
}
|
|
206
|
+
WebGroupsManagerDecorator.prototype.init = function (io, componentFactory) {
|
|
207
|
+
if (window.webGroupsManager) {
|
|
208
|
+
window.webGroupsManager.init(componentFactory);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
throw new Error("Could not find the webGroupsManager the groups library should be loaded as a group application");
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
WebGroupsManagerDecorator.prototype.getGroupId = function () {
|
|
215
|
+
return window.webGroupsManager.externalLibraryFactory.groupId;
|
|
216
|
+
};
|
|
217
|
+
WebGroupsManagerDecorator.prototype.notifyMoveAreaChanged = function () {
|
|
218
|
+
window.webGroupsManager.notifyMoveAreaChanged();
|
|
219
|
+
};
|
|
220
|
+
WebGroupsManagerDecorator.prototype.registerPopup = function (element) {
|
|
221
|
+
return window.webGroupsManager.registerPopup(element);
|
|
222
|
+
};
|
|
223
|
+
WebGroupsManagerDecorator.prototype.removePopup = function (element) {
|
|
224
|
+
return window.webGroupsManager.removePopup(element);
|
|
225
|
+
};
|
|
226
|
+
WebGroupsManagerDecorator.prototype.removePopupById = function (elementId) {
|
|
227
|
+
return window.webGroupsManager.removePopupById(elementId);
|
|
228
|
+
};
|
|
229
|
+
WebGroupsManagerDecorator.prototype.subscribeForWindowFocused = function (cb) {
|
|
230
|
+
return window.webGroupsManager.subscribeForWindowFocused(cb);
|
|
231
|
+
};
|
|
232
|
+
WebGroupsManagerDecorator.prototype.unmount = function () {
|
|
233
|
+
return window.webGroupsManager.unmount();
|
|
234
|
+
};
|
|
235
|
+
WebGroupsManagerDecorator.prototype.requestPageFocus = function () {
|
|
236
|
+
return window.webGroupsManager.externalLibraryFactory.focusPage();
|
|
237
|
+
};
|
|
238
|
+
WebGroupsManagerDecorator.prototype.requestFrameFocus = function (frameId) {
|
|
239
|
+
return window.webGroupsManager.externalLibraryFactory.focusFrame(frameId);
|
|
240
|
+
};
|
|
241
|
+
WebGroupsManagerDecorator.prototype.requestGroupFocus = function () {
|
|
242
|
+
return window.webGroupsManager.externalLibraryFactory.focusGroup();
|
|
243
|
+
};
|
|
244
|
+
WebGroupsManagerDecorator.prototype.closeFrame = function (targetId) {
|
|
245
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Close);
|
|
246
|
+
};
|
|
247
|
+
WebGroupsManagerDecorator.prototype.restoreFrame = function (targetId) {
|
|
248
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Restore);
|
|
249
|
+
};
|
|
250
|
+
WebGroupsManagerDecorator.prototype.maximizeFrame = function (targetId) {
|
|
251
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Maximize);
|
|
252
|
+
};
|
|
253
|
+
WebGroupsManagerDecorator.prototype.minimizeFrame = function (targetId) {
|
|
254
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Minimize);
|
|
255
|
+
};
|
|
256
|
+
WebGroupsManagerDecorator.prototype.lockFrame = function (targetId) {
|
|
257
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Lock);
|
|
258
|
+
};
|
|
259
|
+
WebGroupsManagerDecorator.prototype.unlockFrame = function (targetId) {
|
|
260
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Unlock);
|
|
261
|
+
};
|
|
262
|
+
WebGroupsManagerDecorator.prototype.feedbackFrame = function (targetId) {
|
|
263
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Feedback);
|
|
264
|
+
};
|
|
265
|
+
WebGroupsManagerDecorator.prototype.stickyFrame = function (targetId) {
|
|
266
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Sticky);
|
|
267
|
+
};
|
|
268
|
+
WebGroupsManagerDecorator.prototype.extractFrame = function (targetId) {
|
|
269
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Frame, targetId, StandardButtons.Extract);
|
|
270
|
+
};
|
|
271
|
+
WebGroupsManagerDecorator.prototype.closeTabBar = function (targetId) {
|
|
272
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Close);
|
|
273
|
+
};
|
|
274
|
+
WebGroupsManagerDecorator.prototype.restoreTabBar = function (targetId) {
|
|
275
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Restore);
|
|
276
|
+
};
|
|
277
|
+
WebGroupsManagerDecorator.prototype.maximizeTabBar = function (targetId) {
|
|
278
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Maximize);
|
|
279
|
+
};
|
|
280
|
+
WebGroupsManagerDecorator.prototype.minimizeTabBar = function (targetId) {
|
|
281
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Minimize);
|
|
282
|
+
};
|
|
283
|
+
WebGroupsManagerDecorator.prototype.lockTabBar = function (targetId) {
|
|
284
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Lock);
|
|
285
|
+
};
|
|
286
|
+
WebGroupsManagerDecorator.prototype.unlockTabBar = function (targetId) {
|
|
287
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Unlock);
|
|
288
|
+
};
|
|
289
|
+
WebGroupsManagerDecorator.prototype.feedbackTabBar = function (targetId) {
|
|
290
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Feedback);
|
|
291
|
+
};
|
|
292
|
+
WebGroupsManagerDecorator.prototype.stickyTabBar = function (targetId) {
|
|
293
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Sticky);
|
|
294
|
+
};
|
|
295
|
+
WebGroupsManagerDecorator.prototype.extractTabBar = function (targetId) {
|
|
296
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.TabBar, targetId, StandardButtons.Extract);
|
|
297
|
+
};
|
|
298
|
+
WebGroupsManagerDecorator.prototype.closeGroup = function (targetId) {
|
|
299
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Group, targetId, StandardButtons.Close);
|
|
300
|
+
};
|
|
301
|
+
WebGroupsManagerDecorator.prototype.restoreGroup = function (targetId) {
|
|
302
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Group, targetId, StandardButtons.Restore);
|
|
303
|
+
};
|
|
304
|
+
WebGroupsManagerDecorator.prototype.maximizeGroup = function (targetId) {
|
|
305
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Group, targetId, StandardButtons.Maximize);
|
|
306
|
+
};
|
|
307
|
+
WebGroupsManagerDecorator.prototype.minimizeGroup = function (targetId) {
|
|
308
|
+
window.webGroupsManager.externalLibraryFactory.onStandardButtonClick(TargetType.Group, targetId, StandardButtons.Minimize);
|
|
309
|
+
};
|
|
310
|
+
WebGroupsManagerDecorator.prototype.closeTab = function (targetId) {
|
|
311
|
+
window.webGroupsManager.externalLibraryFactory.onTabCloseButtonClick(targetId);
|
|
312
|
+
};
|
|
313
|
+
WebGroupsManagerDecorator.prototype.clickCustomButton = function (targetId, buttonId) {
|
|
314
|
+
window.webGroupsManager.externalLibraryFactory.onCustomButtonClick(TargetType.Frame, targetId, buttonId);
|
|
315
|
+
};
|
|
316
|
+
WebGroupsManagerDecorator.prototype.onGroupMoveAreaChanged = function (targetId) {
|
|
317
|
+
window.webGroupsManager.externalLibraryFactory.onMoveAreaChanged(TargetType.Group, targetId);
|
|
318
|
+
};
|
|
319
|
+
WebGroupsManagerDecorator.prototype.onTabChannelSelectorClick = function (targetId, selectorBounds) {
|
|
320
|
+
window.webGroupsManager.externalLibraryFactory.onTabChannelSelectorClick(targetId, selectorBounds);
|
|
321
|
+
};
|
|
322
|
+
WebGroupsManagerDecorator.prototype.onFrameChannelSelectorClick = function (targetId, selectorBounds) {
|
|
323
|
+
window.webGroupsManager.externalLibraryFactory.onFrameChannelSelectorClick(targetId, selectorBounds);
|
|
324
|
+
};
|
|
325
|
+
WebGroupsManagerDecorator.prototype.onCaptionTextBoundsChanged = function (targetType, targetId, bounds) {
|
|
326
|
+
if (typeof window.webGroupsManager.externalLibraryFactory.onCaptionTextBoundsChanged !== "function") {
|
|
327
|
+
// Handling the case when a new library is used with an older version of io.Connect Desktop
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
window.webGroupsManager.externalLibraryFactory.onCaptionTextBoundsChanged(targetType, targetId, bounds);
|
|
331
|
+
};
|
|
332
|
+
WebGroupsManagerDecorator.prototype.onCaptionEditorVisibleChanged = function (targetType, targetId, visible) {
|
|
333
|
+
if (typeof window.webGroupsManager.externalLibraryFactory.onCaptionEditorVisibleChanged !== "function") {
|
|
334
|
+
// Handling the case when a new library is used with an older version of io.Connect Desktop
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
window.webGroupsManager.externalLibraryFactory.onCaptionEditorVisibleChanged(targetType, targetId, visible);
|
|
338
|
+
};
|
|
339
|
+
WebGroupsManagerDecorator.prototype.onCaptionEditorBoundsChanged = function (targetType, targetId, bounds) {
|
|
340
|
+
if (typeof window.webGroupsManager.externalLibraryFactory.onCaptionEditorBoundsChanged !== "function") {
|
|
341
|
+
// Handling the case when a new library is used with an older version of io.Connect Desktop
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
window.webGroupsManager.externalLibraryFactory.onCaptionEditorBoundsChanged(targetType, targetId, bounds);
|
|
345
|
+
};
|
|
346
|
+
WebGroupsManagerDecorator.prototype.commitCaptionEditing = function (targetType, targetId, text) {
|
|
347
|
+
if (typeof window.webGroupsManager.externalLibraryFactory.commitCaptionEditing !== "function") {
|
|
348
|
+
// Handling the case when a new library is used with an older version of io.Connect Desktop
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
window.webGroupsManager.externalLibraryFactory.commitCaptionEditing(targetType, targetId, text);
|
|
352
|
+
};
|
|
353
|
+
WebGroupsManagerDecorator.prototype.onCommitCaptionEditingRequested = function (targetType, targetId, callback) {
|
|
354
|
+
return this.registry.add(targetType + "-" + targetId, callback);
|
|
355
|
+
};
|
|
356
|
+
WebGroupsManagerDecorator.prototype.requestCommitCaptionEditing = function (targetType, targetId) {
|
|
357
|
+
this.registry.execute(targetType + "-" + targetId);
|
|
358
|
+
};
|
|
359
|
+
return WebGroupsManagerDecorator;
|
|
360
|
+
}());
|
|
361
|
+
var webGroupsManager = new WebGroupsManagerDecorator();
|
|
362
|
+
|
|
363
|
+
var BaseButton = function (_a) {
|
|
364
|
+
var outerElement = _a.outerElement, innerElement = _a.innerElement;
|
|
365
|
+
return React__default["default"].createElement("li", __assign({}, outerElement, { className: webGroupsManager.skipFocusStyle + " " + outerElement.className }),
|
|
366
|
+
React__default["default"].createElement("div", __assign({}, innerElement)));
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
var CloseButton = function (_a) {
|
|
370
|
+
var onClick = _a.onClick, tooltip = _a.tooltip;
|
|
371
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-close" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-close", title: tooltip, onClick: onClick } });
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* A simple guard function:
|
|
376
|
+
*
|
|
377
|
+
* ```js
|
|
378
|
+
* Math.min(Math.max(low, value), high)
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
function guard(low, high, value) {
|
|
382
|
+
return Math.min(Math.max(low, value), high);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
class ColorError extends Error {
|
|
386
|
+
constructor(color) {
|
|
387
|
+
super(`Failed to parse color: "${color}"`);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
var ColorError$1 = ColorError;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Parses a color into red, gree, blue, alpha parts
|
|
396
|
+
*
|
|
397
|
+
* @param color the input color. Can be a RGB, RBGA, HSL, HSLA, or named color
|
|
398
|
+
*/
|
|
399
|
+
|
|
400
|
+
function parseToRgba(color) {
|
|
401
|
+
if (typeof color !== 'string') throw new ColorError$1(color);
|
|
402
|
+
if (color.trim().toLowerCase() === 'transparent') return [0, 0, 0, 0];
|
|
403
|
+
let normalizedColor = color.trim();
|
|
404
|
+
normalizedColor = namedColorRegex.test(color) ? nameToHex(color) : color;
|
|
405
|
+
const reducedHexMatch = reducedHexRegex.exec(normalizedColor);
|
|
406
|
+
|
|
407
|
+
if (reducedHexMatch) {
|
|
408
|
+
const arr = Array.from(reducedHexMatch).slice(1);
|
|
409
|
+
return [...arr.slice(0, 3).map(x => parseInt(r$1(x, 2), 16)), parseInt(r$1(arr[3] || 'f', 2), 16) / 255];
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const hexMatch = hexRegex.exec(normalizedColor);
|
|
413
|
+
|
|
414
|
+
if (hexMatch) {
|
|
415
|
+
const arr = Array.from(hexMatch).slice(1);
|
|
416
|
+
return [...arr.slice(0, 3).map(x => parseInt(x, 16)), parseInt(arr[3] || 'ff', 16) / 255];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const rgbaMatch = rgbaRegex.exec(normalizedColor);
|
|
420
|
+
|
|
421
|
+
if (rgbaMatch) {
|
|
422
|
+
const arr = Array.from(rgbaMatch).slice(1);
|
|
423
|
+
return [...arr.slice(0, 3).map(x => parseInt(x, 10)), parseFloat(arr[3] || '1')];
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const hslaMatch = hslaRegex.exec(normalizedColor);
|
|
427
|
+
|
|
428
|
+
if (hslaMatch) {
|
|
429
|
+
const [h, s, l, a] = Array.from(hslaMatch).slice(1).map(parseFloat);
|
|
430
|
+
if (guard(0, 100, s) !== s) throw new ColorError$1(color);
|
|
431
|
+
if (guard(0, 100, l) !== l) throw new ColorError$1(color);
|
|
432
|
+
return [...hslToRgb(h, s, l), a || 1];
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
throw new ColorError$1(color);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function hash(str) {
|
|
439
|
+
let hash = 5381;
|
|
440
|
+
let i = str.length;
|
|
441
|
+
|
|
442
|
+
while (i) {
|
|
443
|
+
hash = hash * 33 ^ str.charCodeAt(--i);
|
|
444
|
+
}
|
|
445
|
+
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
|
446
|
+
* integers. Since we want the results to be always positive, convert the
|
|
447
|
+
* signed int to an unsigned by doing an unsigned bitshift. */
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
return (hash >>> 0) % 2341;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const colorToInt = x => parseInt(x.replace(/_/g, ''), 36);
|
|
454
|
+
|
|
455
|
+
const compressedColorMap = '1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm'.split(' ').reduce((acc, next) => {
|
|
456
|
+
const key = colorToInt(next.substring(0, 3));
|
|
457
|
+
const hex = colorToInt(next.substring(3)).toString(16); // NOTE: padStart could be used here but it breaks Node 6 compat
|
|
458
|
+
// https://github.com/ricokahler/color2k/issues/351
|
|
459
|
+
|
|
460
|
+
let prefix = '';
|
|
461
|
+
|
|
462
|
+
for (let i = 0; i < 6 - hex.length; i++) {
|
|
463
|
+
prefix += '0';
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
acc[key] = `${prefix}${hex}`;
|
|
467
|
+
return acc;
|
|
468
|
+
}, {});
|
|
469
|
+
/**
|
|
470
|
+
* Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
|
|
471
|
+
*/
|
|
472
|
+
|
|
473
|
+
function nameToHex(color) {
|
|
474
|
+
const normalizedColorName = color.toLowerCase().trim();
|
|
475
|
+
const result = compressedColorMap[hash(normalizedColorName)];
|
|
476
|
+
if (!result) throw new ColorError$1(color);
|
|
477
|
+
return `#${result}`;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
const r$1 = (str, amount) => Array.from(Array(amount)).map(() => str).join('');
|
|
481
|
+
|
|
482
|
+
const reducedHexRegex = new RegExp(`^#${r$1('([a-f0-9])', 3)}([a-f0-9])?$`, 'i');
|
|
483
|
+
const hexRegex = new RegExp(`^#${r$1('([a-f0-9]{2})', 3)}([a-f0-9]{2})?$`, 'i');
|
|
484
|
+
const rgbaRegex = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${r$1(',\\s*(\\d+)\\s*', 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, 'i');
|
|
485
|
+
const hslaRegex = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i;
|
|
486
|
+
const namedColorRegex = /^[a-z]+$/i;
|
|
487
|
+
|
|
488
|
+
const roundColor = color => {
|
|
489
|
+
return Math.round(color * 255);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const hslToRgb = (hue, saturation, lightness) => {
|
|
493
|
+
let l = lightness / 100;
|
|
494
|
+
|
|
495
|
+
if (saturation === 0) {
|
|
496
|
+
// achromatic
|
|
497
|
+
return [l, l, l].map(roundColor);
|
|
498
|
+
} // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
const huePrime = (hue % 360 + 360) % 360 / 60;
|
|
502
|
+
const chroma = (1 - Math.abs(2 * l - 1)) * (saturation / 100);
|
|
503
|
+
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
504
|
+
let red = 0;
|
|
505
|
+
let green = 0;
|
|
506
|
+
let blue = 0;
|
|
507
|
+
|
|
508
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
509
|
+
red = chroma;
|
|
510
|
+
green = secondComponent;
|
|
511
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
512
|
+
red = secondComponent;
|
|
513
|
+
green = chroma;
|
|
514
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
515
|
+
green = chroma;
|
|
516
|
+
blue = secondComponent;
|
|
517
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
518
|
+
green = secondComponent;
|
|
519
|
+
blue = chroma;
|
|
520
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
521
|
+
red = secondComponent;
|
|
522
|
+
blue = chroma;
|
|
523
|
+
} else if (huePrime >= 5 && huePrime < 6) {
|
|
524
|
+
red = chroma;
|
|
525
|
+
blue = secondComponent;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
const lightnessModification = l - chroma / 2;
|
|
529
|
+
const finalRed = red + lightnessModification;
|
|
530
|
+
const finalGreen = green + lightnessModification;
|
|
531
|
+
const finalBlue = blue + lightnessModification;
|
|
532
|
+
return [finalRed, finalGreen, finalBlue].map(roundColor);
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// https://github.com/styled-components/polished/blob/0764c982551b487469043acb56281b0358b3107b/src/color/getLuminance.js
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Returns a number (float) representing the luminance of a color.
|
|
539
|
+
*/
|
|
540
|
+
|
|
541
|
+
function getLuminance(color) {
|
|
542
|
+
if (color === 'transparent') return 0;
|
|
543
|
+
|
|
544
|
+
function f(x) {
|
|
545
|
+
const channel = x / 255;
|
|
546
|
+
return channel <= 0.03928 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const [r, g, b] = parseToRgba(color);
|
|
550
|
+
return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* An alternative function to `readableColor`. Returns whether or not the
|
|
555
|
+
* readable color (i.e. the color to be place on top the input color) should be
|
|
556
|
+
* black.
|
|
557
|
+
*/
|
|
558
|
+
|
|
559
|
+
function readableColorIsBlack(color) {
|
|
560
|
+
return getLuminance(color) > 0.179;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function IsBlackReadable(color) {
|
|
564
|
+
try {
|
|
565
|
+
var rgba = parseToRgba(color);
|
|
566
|
+
var r = rgba[0];
|
|
567
|
+
var g = rgba[1];
|
|
568
|
+
var b = rgba[2];
|
|
569
|
+
var displayGamma = 2.2;
|
|
570
|
+
var backgroundWeight = 0.2126 * Math.pow(r / 255.0, displayGamma) +
|
|
571
|
+
0.7152 * Math.pow(g / 255.0, displayGamma) +
|
|
572
|
+
0.0722 * Math.pow(b / 255.0, displayGamma);
|
|
573
|
+
return backgroundWeight > Math.pow(0.5, displayGamma);
|
|
574
|
+
}
|
|
575
|
+
catch (_a) {
|
|
576
|
+
// Fallback to other implementation
|
|
577
|
+
}
|
|
578
|
+
try {
|
|
579
|
+
return readableColorIsBlack(color);
|
|
580
|
+
}
|
|
581
|
+
catch (error) {
|
|
582
|
+
// tslint:disable-next-line: no-console
|
|
583
|
+
console.error("Error while checking readable color for '" + color + "'", error);
|
|
584
|
+
}
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
var BaseChannelSelector = function (_a) {
|
|
589
|
+
var outsideClass = _a.outsideClass, contentClass = _a.contentClass, showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor;
|
|
590
|
+
var ref = React.useRef(null);
|
|
591
|
+
var wrappedOnClick = function () {
|
|
592
|
+
if (!ref.current) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
var bounds = ref.current.getBoundingClientRect();
|
|
596
|
+
showSelector({
|
|
597
|
+
left: bounds.left,
|
|
598
|
+
top: bounds.top,
|
|
599
|
+
width: bounds.width,
|
|
600
|
+
height: bounds.height,
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
React.useEffect(function () {
|
|
604
|
+
var _a;
|
|
605
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener("mousedown", function (e) {
|
|
606
|
+
e.stopPropagation();
|
|
607
|
+
});
|
|
608
|
+
}, [ref]);
|
|
609
|
+
var className = contentClass;
|
|
610
|
+
if (selectedChannel && selectedChannelColor) {
|
|
611
|
+
className = contentClass + " " + (IsBlackReadable(selectedChannelColor) ? "t42-channel-selector-content-dark" : "t42-channel-selector-content-light");
|
|
612
|
+
}
|
|
613
|
+
var style = {
|
|
614
|
+
background: selectedChannelColor
|
|
615
|
+
};
|
|
616
|
+
return React__default["default"].createElement("div", { title: selectedChannel !== null && selectedChannel !== void 0 ? selectedChannel : "", ref: ref, style: style, onClick: wrappedOnClick, className: "t42-buttons " + outsideClass },
|
|
617
|
+
React__default["default"].createElement("div", { className: className }));
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
var FlatChannelSelector = function (_a) {
|
|
621
|
+
var showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor;
|
|
622
|
+
return React__default["default"].createElement(BaseChannelSelector, { outsideClass: "t42-frame-caption-bar-element t42-frame-channel-selector", contentClass: "t42-frame-channel-selector-content", showSelector: showSelector, selectedChannel: selectedChannel, selectedChannelColor: selectedChannelColor });
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
var ExtractButton = function (_a) {
|
|
626
|
+
var onClick = _a.onClick, tooltip = _a.tooltip;
|
|
627
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-extract" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-extract", title: tooltip, onClick: onClick } });
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
var FeedbackButton = function (_a) {
|
|
631
|
+
var onClick = _a.onClick, tooltip = _a.tooltip;
|
|
632
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-feedback" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-feedback", title: tooltip, onClick: onClick } });
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
var StickyButton = function (_a) {
|
|
636
|
+
var onClick = _a.onClick, tooltip = _a.tooltip, isPressed = _a.isPressed;
|
|
637
|
+
var outerElementClassName = "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-sticky";
|
|
638
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-sticky" }, outerElement: { className: isPressed ? outerElementClassName + " active" : outerElementClassName, title: tooltip, onClick: onClick } });
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
var LockButton = function (_a) {
|
|
642
|
+
var tooltip = _a.tooltip, onClick = _a.onClick;
|
|
643
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-lock" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-lock", title: tooltip, onClick: onClick } });
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
var MaximizeButton = function (_a) {
|
|
647
|
+
var tooltip = _a.tooltip, onClick = _a.onClick;
|
|
648
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-maximize" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-maximize", title: tooltip, onClick: onClick } });
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
var MinimizeButton = function (_a) {
|
|
652
|
+
var onClick = _a.onClick, tooltip = _a.tooltip;
|
|
653
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-minimize" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-minimize", title: tooltip, onClick: onClick } });
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
var RestoreButton = function (_a) {
|
|
657
|
+
var tooltip = _a.tooltip, onClick = _a.onClick;
|
|
658
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-restore" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-restore", title: tooltip, onClick: onClick } });
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
var UnlockButton = function (_a) {
|
|
662
|
+
var tooltip = _a.tooltip, onClick = _a.onClick;
|
|
663
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-unlock" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-unlock", title: tooltip, onClick: onClick } });
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
var CustomButton = function (_a) {
|
|
667
|
+
var onClick = _a.onClick, tooltip = _a.tooltip, imageData = _a.imageData;
|
|
668
|
+
return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-custom-button", style: { backgroundImage: "url(\"" + imageData + "\")" } }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button", title: tooltip, onClick: onClick } });
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
var FlatButtons = function (_a) {
|
|
672
|
+
var extract = _a.extract, minimize = _a.minimize, maximize = _a.maximize, restore = _a.restore, close = _a.close, lock = _a.lock, unlock = _a.unlock, feedback = _a.feedback, sticky = _a.sticky, customButtons = _a.customButtons;
|
|
673
|
+
return React__default["default"].createElement("div", { className: "t42-buttons-container t42-frame-caption-bar-element" },
|
|
674
|
+
React__default["default"].createElement("ul", { className: "t42-buttons t42-tab-bar-element" }, customButtons.map(function (customButton) {
|
|
675
|
+
return customButton.visible && React__default["default"].createElement(CustomButton, __assign({ key: customButton.buttonId }, customButton));
|
|
676
|
+
})),
|
|
677
|
+
React__default["default"].createElement("ul", { className: "t42-buttons t42-frame-caption-bar-element" },
|
|
678
|
+
(feedback === null || feedback === void 0 ? void 0 : feedback.visible) && React__default["default"].createElement(FeedbackButton, __assign({}, feedback)),
|
|
679
|
+
(sticky === null || sticky === void 0 ? void 0 : sticky.visible) && React__default["default"].createElement(StickyButton, __assign({}, sticky)),
|
|
680
|
+
(extract === null || extract === void 0 ? void 0 : extract.visible) && React__default["default"].createElement(ExtractButton, __assign({}, extract)),
|
|
681
|
+
(lock === null || lock === void 0 ? void 0 : lock.visible) && React__default["default"].createElement(LockButton, __assign({}, lock)),
|
|
682
|
+
(unlock === null || unlock === void 0 ? void 0 : unlock.visible) && React__default["default"].createElement(UnlockButton, __assign({}, unlock)),
|
|
683
|
+
(minimize === null || minimize === void 0 ? void 0 : minimize.visible) && React__default["default"].createElement(MinimizeButton, __assign({}, minimize)),
|
|
684
|
+
(maximize === null || maximize === void 0 ? void 0 : maximize.visible) && React__default["default"].createElement(MaximizeButton, __assign({}, maximize)),
|
|
685
|
+
(restore === null || restore === void 0 ? void 0 : restore.visible) && React__default["default"].createElement(RestoreButton, __assign({}, restore)),
|
|
686
|
+
(close === null || close === void 0 ? void 0 : close.visible) && React__default["default"].createElement(CloseButton, __assign({}, close))));
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
var waitForWindow = function (io, windowId) {
|
|
690
|
+
return new Promise(function (res, rej) {
|
|
691
|
+
var unsub = io.windows.onWindowAdded(function (w) {
|
|
692
|
+
if (w.id === windowId) {
|
|
693
|
+
res(w);
|
|
694
|
+
unsub();
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
var windowInCollection = io.windows.list().find(function (w) { return w.id === windowId; });
|
|
698
|
+
if (windowInCollection) {
|
|
699
|
+
res(windowInCollection);
|
|
700
|
+
unsub();
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
};
|
|
704
|
+
var getElementBounds = function (element) {
|
|
705
|
+
var bounds = element.getBoundingClientRect();
|
|
706
|
+
return {
|
|
707
|
+
left: bounds.left,
|
|
708
|
+
top: bounds.top,
|
|
709
|
+
width: bounds.width,
|
|
710
|
+
height: bounds.height
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* A collection of shims that provide minimal functionality of the ES6 collections.
|
|
716
|
+
*
|
|
717
|
+
* These implementations are not meant to be used outside of the ResizeObserver
|
|
718
|
+
* modules as they cover only a limited range of use cases.
|
|
719
|
+
*/
|
|
720
|
+
/* eslint-disable require-jsdoc, valid-jsdoc */
|
|
721
|
+
var MapShim = (function () {
|
|
722
|
+
if (typeof Map !== 'undefined') {
|
|
723
|
+
return Map;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Returns index in provided array that matches the specified key.
|
|
727
|
+
*
|
|
728
|
+
* @param {Array<Array>} arr
|
|
729
|
+
* @param {*} key
|
|
730
|
+
* @returns {number}
|
|
731
|
+
*/
|
|
732
|
+
function getIndex(arr, key) {
|
|
733
|
+
var result = -1;
|
|
734
|
+
arr.some(function (entry, index) {
|
|
735
|
+
if (entry[0] === key) {
|
|
736
|
+
result = index;
|
|
737
|
+
return true;
|
|
738
|
+
}
|
|
739
|
+
return false;
|
|
740
|
+
});
|
|
741
|
+
return result;
|
|
742
|
+
}
|
|
743
|
+
return /** @class */ (function () {
|
|
744
|
+
function class_1() {
|
|
745
|
+
this.__entries__ = [];
|
|
746
|
+
}
|
|
747
|
+
Object.defineProperty(class_1.prototype, "size", {
|
|
748
|
+
/**
|
|
749
|
+
* @returns {boolean}
|
|
750
|
+
*/
|
|
751
|
+
get: function () {
|
|
752
|
+
return this.__entries__.length;
|
|
753
|
+
},
|
|
754
|
+
enumerable: true,
|
|
755
|
+
configurable: true
|
|
756
|
+
});
|
|
757
|
+
/**
|
|
758
|
+
* @param {*} key
|
|
759
|
+
* @returns {*}
|
|
760
|
+
*/
|
|
761
|
+
class_1.prototype.get = function (key) {
|
|
762
|
+
var index = getIndex(this.__entries__, key);
|
|
763
|
+
var entry = this.__entries__[index];
|
|
764
|
+
return entry && entry[1];
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* @param {*} key
|
|
768
|
+
* @param {*} value
|
|
769
|
+
* @returns {void}
|
|
770
|
+
*/
|
|
771
|
+
class_1.prototype.set = function (key, value) {
|
|
772
|
+
var index = getIndex(this.__entries__, key);
|
|
773
|
+
if (~index) {
|
|
774
|
+
this.__entries__[index][1] = value;
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
this.__entries__.push([key, value]);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
/**
|
|
781
|
+
* @param {*} key
|
|
782
|
+
* @returns {void}
|
|
783
|
+
*/
|
|
784
|
+
class_1.prototype.delete = function (key) {
|
|
785
|
+
var entries = this.__entries__;
|
|
786
|
+
var index = getIndex(entries, key);
|
|
787
|
+
if (~index) {
|
|
788
|
+
entries.splice(index, 1);
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
/**
|
|
792
|
+
* @param {*} key
|
|
793
|
+
* @returns {void}
|
|
794
|
+
*/
|
|
795
|
+
class_1.prototype.has = function (key) {
|
|
796
|
+
return !!~getIndex(this.__entries__, key);
|
|
797
|
+
};
|
|
798
|
+
/**
|
|
799
|
+
* @returns {void}
|
|
800
|
+
*/
|
|
801
|
+
class_1.prototype.clear = function () {
|
|
802
|
+
this.__entries__.splice(0);
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* @param {Function} callback
|
|
806
|
+
* @param {*} [ctx=null]
|
|
807
|
+
* @returns {void}
|
|
808
|
+
*/
|
|
809
|
+
class_1.prototype.forEach = function (callback, ctx) {
|
|
810
|
+
if (ctx === void 0) { ctx = null; }
|
|
811
|
+
for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
|
|
812
|
+
var entry = _a[_i];
|
|
813
|
+
callback.call(ctx, entry[1], entry[0]);
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
return class_1;
|
|
817
|
+
}());
|
|
818
|
+
})();
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Detects whether window and document objects are available in current environment.
|
|
822
|
+
*/
|
|
823
|
+
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
|
|
824
|
+
|
|
825
|
+
// Returns global object of a current environment.
|
|
826
|
+
var global$1 = (function () {
|
|
827
|
+
if (typeof global !== 'undefined' && global.Math === Math) {
|
|
828
|
+
return global;
|
|
829
|
+
}
|
|
830
|
+
if (typeof self !== 'undefined' && self.Math === Math) {
|
|
831
|
+
return self;
|
|
832
|
+
}
|
|
833
|
+
if (typeof window !== 'undefined' && window.Math === Math) {
|
|
834
|
+
return window;
|
|
835
|
+
}
|
|
836
|
+
// eslint-disable-next-line no-new-func
|
|
837
|
+
return Function('return this')();
|
|
838
|
+
})();
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* A shim for the requestAnimationFrame which falls back to the setTimeout if
|
|
842
|
+
* first one is not supported.
|
|
843
|
+
*
|
|
844
|
+
* @returns {number} Requests' identifier.
|
|
845
|
+
*/
|
|
846
|
+
var requestAnimationFrame$1 = (function () {
|
|
847
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
848
|
+
// It's required to use a bounded function because IE sometimes throws
|
|
849
|
+
// an "Invalid calling object" error if rAF is invoked without the global
|
|
850
|
+
// object on the left hand side.
|
|
851
|
+
return requestAnimationFrame.bind(global$1);
|
|
852
|
+
}
|
|
853
|
+
return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
|
|
854
|
+
})();
|
|
855
|
+
|
|
856
|
+
// Defines minimum timeout before adding a trailing call.
|
|
857
|
+
var trailingTimeout = 2;
|
|
858
|
+
/**
|
|
859
|
+
* Creates a wrapper function which ensures that provided callback will be
|
|
860
|
+
* invoked only once during the specified delay period.
|
|
861
|
+
*
|
|
862
|
+
* @param {Function} callback - Function to be invoked after the delay period.
|
|
863
|
+
* @param {number} delay - Delay after which to invoke callback.
|
|
864
|
+
* @returns {Function}
|
|
865
|
+
*/
|
|
866
|
+
function throttle (callback, delay) {
|
|
867
|
+
var leadingCall = false, trailingCall = false, lastCallTime = 0;
|
|
868
|
+
/**
|
|
869
|
+
* Invokes the original callback function and schedules new invocation if
|
|
870
|
+
* the "proxy" was called during current request.
|
|
871
|
+
*
|
|
872
|
+
* @returns {void}
|
|
873
|
+
*/
|
|
874
|
+
function resolvePending() {
|
|
875
|
+
if (leadingCall) {
|
|
876
|
+
leadingCall = false;
|
|
877
|
+
callback();
|
|
878
|
+
}
|
|
879
|
+
if (trailingCall) {
|
|
880
|
+
proxy();
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Callback invoked after the specified delay. It will further postpone
|
|
885
|
+
* invocation of the original function delegating it to the
|
|
886
|
+
* requestAnimationFrame.
|
|
887
|
+
*
|
|
888
|
+
* @returns {void}
|
|
889
|
+
*/
|
|
890
|
+
function timeoutCallback() {
|
|
891
|
+
requestAnimationFrame$1(resolvePending);
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Schedules invocation of the original function.
|
|
895
|
+
*
|
|
896
|
+
* @returns {void}
|
|
897
|
+
*/
|
|
898
|
+
function proxy() {
|
|
899
|
+
var timeStamp = Date.now();
|
|
900
|
+
if (leadingCall) {
|
|
901
|
+
// Reject immediately following calls.
|
|
902
|
+
if (timeStamp - lastCallTime < trailingTimeout) {
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
// Schedule new call to be in invoked when the pending one is resolved.
|
|
906
|
+
// This is important for "transitions" which never actually start
|
|
907
|
+
// immediately so there is a chance that we might miss one if change
|
|
908
|
+
// happens amids the pending invocation.
|
|
909
|
+
trailingCall = true;
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
leadingCall = true;
|
|
913
|
+
trailingCall = false;
|
|
914
|
+
setTimeout(timeoutCallback, delay);
|
|
915
|
+
}
|
|
916
|
+
lastCallTime = timeStamp;
|
|
917
|
+
}
|
|
918
|
+
return proxy;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// Minimum delay before invoking the update of observers.
|
|
922
|
+
var REFRESH_DELAY = 20;
|
|
923
|
+
// A list of substrings of CSS properties used to find transition events that
|
|
924
|
+
// might affect dimensions of observed elements.
|
|
925
|
+
var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
|
|
926
|
+
// Check if MutationObserver is available.
|
|
927
|
+
var mutationObserverSupported = typeof MutationObserver !== 'undefined';
|
|
928
|
+
/**
|
|
929
|
+
* Singleton controller class which handles updates of ResizeObserver instances.
|
|
930
|
+
*/
|
|
931
|
+
var ResizeObserverController = /** @class */ (function () {
|
|
932
|
+
/**
|
|
933
|
+
* Creates a new instance of ResizeObserverController.
|
|
934
|
+
*
|
|
935
|
+
* @private
|
|
936
|
+
*/
|
|
937
|
+
function ResizeObserverController() {
|
|
938
|
+
/**
|
|
939
|
+
* Indicates whether DOM listeners have been added.
|
|
940
|
+
*
|
|
941
|
+
* @private {boolean}
|
|
942
|
+
*/
|
|
943
|
+
this.connected_ = false;
|
|
944
|
+
/**
|
|
945
|
+
* Tells that controller has subscribed for Mutation Events.
|
|
946
|
+
*
|
|
947
|
+
* @private {boolean}
|
|
948
|
+
*/
|
|
949
|
+
this.mutationEventsAdded_ = false;
|
|
950
|
+
/**
|
|
951
|
+
* Keeps reference to the instance of MutationObserver.
|
|
952
|
+
*
|
|
953
|
+
* @private {MutationObserver}
|
|
954
|
+
*/
|
|
955
|
+
this.mutationsObserver_ = null;
|
|
956
|
+
/**
|
|
957
|
+
* A list of connected observers.
|
|
958
|
+
*
|
|
959
|
+
* @private {Array<ResizeObserverSPI>}
|
|
960
|
+
*/
|
|
961
|
+
this.observers_ = [];
|
|
962
|
+
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
|
|
963
|
+
this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Adds observer to observers list.
|
|
967
|
+
*
|
|
968
|
+
* @param {ResizeObserverSPI} observer - Observer to be added.
|
|
969
|
+
* @returns {void}
|
|
970
|
+
*/
|
|
971
|
+
ResizeObserverController.prototype.addObserver = function (observer) {
|
|
972
|
+
if (!~this.observers_.indexOf(observer)) {
|
|
973
|
+
this.observers_.push(observer);
|
|
974
|
+
}
|
|
975
|
+
// Add listeners if they haven't been added yet.
|
|
976
|
+
if (!this.connected_) {
|
|
977
|
+
this.connect_();
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
/**
|
|
981
|
+
* Removes observer from observers list.
|
|
982
|
+
*
|
|
983
|
+
* @param {ResizeObserverSPI} observer - Observer to be removed.
|
|
984
|
+
* @returns {void}
|
|
985
|
+
*/
|
|
986
|
+
ResizeObserverController.prototype.removeObserver = function (observer) {
|
|
987
|
+
var observers = this.observers_;
|
|
988
|
+
var index = observers.indexOf(observer);
|
|
989
|
+
// Remove observer if it's present in registry.
|
|
990
|
+
if (~index) {
|
|
991
|
+
observers.splice(index, 1);
|
|
992
|
+
}
|
|
993
|
+
// Remove listeners if controller has no connected observers.
|
|
994
|
+
if (!observers.length && this.connected_) {
|
|
995
|
+
this.disconnect_();
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* Invokes the update of observers. It will continue running updates insofar
|
|
1000
|
+
* it detects changes.
|
|
1001
|
+
*
|
|
1002
|
+
* @returns {void}
|
|
1003
|
+
*/
|
|
1004
|
+
ResizeObserverController.prototype.refresh = function () {
|
|
1005
|
+
var changesDetected = this.updateObservers_();
|
|
1006
|
+
// Continue running updates if changes have been detected as there might
|
|
1007
|
+
// be future ones caused by CSS transitions.
|
|
1008
|
+
if (changesDetected) {
|
|
1009
|
+
this.refresh();
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
/**
|
|
1013
|
+
* Updates every observer from observers list and notifies them of queued
|
|
1014
|
+
* entries.
|
|
1015
|
+
*
|
|
1016
|
+
* @private
|
|
1017
|
+
* @returns {boolean} Returns "true" if any observer has detected changes in
|
|
1018
|
+
* dimensions of it's elements.
|
|
1019
|
+
*/
|
|
1020
|
+
ResizeObserverController.prototype.updateObservers_ = function () {
|
|
1021
|
+
// Collect observers that have active observations.
|
|
1022
|
+
var activeObservers = this.observers_.filter(function (observer) {
|
|
1023
|
+
return observer.gatherActive(), observer.hasActive();
|
|
1024
|
+
});
|
|
1025
|
+
// Deliver notifications in a separate cycle in order to avoid any
|
|
1026
|
+
// collisions between observers, e.g. when multiple instances of
|
|
1027
|
+
// ResizeObserver are tracking the same element and the callback of one
|
|
1028
|
+
// of them changes content dimensions of the observed target. Sometimes
|
|
1029
|
+
// this may result in notifications being blocked for the rest of observers.
|
|
1030
|
+
activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
|
|
1031
|
+
return activeObservers.length > 0;
|
|
1032
|
+
};
|
|
1033
|
+
/**
|
|
1034
|
+
* Initializes DOM listeners.
|
|
1035
|
+
*
|
|
1036
|
+
* @private
|
|
1037
|
+
* @returns {void}
|
|
1038
|
+
*/
|
|
1039
|
+
ResizeObserverController.prototype.connect_ = function () {
|
|
1040
|
+
// Do nothing if running in a non-browser environment or if listeners
|
|
1041
|
+
// have been already added.
|
|
1042
|
+
if (!isBrowser || this.connected_) {
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
// Subscription to the "Transitionend" event is used as a workaround for
|
|
1046
|
+
// delayed transitions. This way it's possible to capture at least the
|
|
1047
|
+
// final state of an element.
|
|
1048
|
+
document.addEventListener('transitionend', this.onTransitionEnd_);
|
|
1049
|
+
window.addEventListener('resize', this.refresh);
|
|
1050
|
+
if (mutationObserverSupported) {
|
|
1051
|
+
this.mutationsObserver_ = new MutationObserver(this.refresh);
|
|
1052
|
+
this.mutationsObserver_.observe(document, {
|
|
1053
|
+
attributes: true,
|
|
1054
|
+
childList: true,
|
|
1055
|
+
characterData: true,
|
|
1056
|
+
subtree: true
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
document.addEventListener('DOMSubtreeModified', this.refresh);
|
|
1061
|
+
this.mutationEventsAdded_ = true;
|
|
1062
|
+
}
|
|
1063
|
+
this.connected_ = true;
|
|
1064
|
+
};
|
|
1065
|
+
/**
|
|
1066
|
+
* Removes DOM listeners.
|
|
1067
|
+
*
|
|
1068
|
+
* @private
|
|
1069
|
+
* @returns {void}
|
|
1070
|
+
*/
|
|
1071
|
+
ResizeObserverController.prototype.disconnect_ = function () {
|
|
1072
|
+
// Do nothing if running in a non-browser environment or if listeners
|
|
1073
|
+
// have been already removed.
|
|
1074
|
+
if (!isBrowser || !this.connected_) {
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
document.removeEventListener('transitionend', this.onTransitionEnd_);
|
|
1078
|
+
window.removeEventListener('resize', this.refresh);
|
|
1079
|
+
if (this.mutationsObserver_) {
|
|
1080
|
+
this.mutationsObserver_.disconnect();
|
|
1081
|
+
}
|
|
1082
|
+
if (this.mutationEventsAdded_) {
|
|
1083
|
+
document.removeEventListener('DOMSubtreeModified', this.refresh);
|
|
1084
|
+
}
|
|
1085
|
+
this.mutationsObserver_ = null;
|
|
1086
|
+
this.mutationEventsAdded_ = false;
|
|
1087
|
+
this.connected_ = false;
|
|
1088
|
+
};
|
|
1089
|
+
/**
|
|
1090
|
+
* "Transitionend" event handler.
|
|
1091
|
+
*
|
|
1092
|
+
* @private
|
|
1093
|
+
* @param {TransitionEvent} event
|
|
1094
|
+
* @returns {void}
|
|
1095
|
+
*/
|
|
1096
|
+
ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
|
|
1097
|
+
var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
|
|
1098
|
+
// Detect whether transition may affect dimensions of an element.
|
|
1099
|
+
var isReflowProperty = transitionKeys.some(function (key) {
|
|
1100
|
+
return !!~propertyName.indexOf(key);
|
|
1101
|
+
});
|
|
1102
|
+
if (isReflowProperty) {
|
|
1103
|
+
this.refresh();
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
/**
|
|
1107
|
+
* Returns instance of the ResizeObserverController.
|
|
1108
|
+
*
|
|
1109
|
+
* @returns {ResizeObserverController}
|
|
1110
|
+
*/
|
|
1111
|
+
ResizeObserverController.getInstance = function () {
|
|
1112
|
+
if (!this.instance_) {
|
|
1113
|
+
this.instance_ = new ResizeObserverController();
|
|
1114
|
+
}
|
|
1115
|
+
return this.instance_;
|
|
1116
|
+
};
|
|
1117
|
+
/**
|
|
1118
|
+
* Holds reference to the controller's instance.
|
|
1119
|
+
*
|
|
1120
|
+
* @private {ResizeObserverController}
|
|
1121
|
+
*/
|
|
1122
|
+
ResizeObserverController.instance_ = null;
|
|
1123
|
+
return ResizeObserverController;
|
|
1124
|
+
}());
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Defines non-writable/enumerable properties of the provided target object.
|
|
1128
|
+
*
|
|
1129
|
+
* @param {Object} target - Object for which to define properties.
|
|
1130
|
+
* @param {Object} props - Properties to be defined.
|
|
1131
|
+
* @returns {Object} Target object.
|
|
1132
|
+
*/
|
|
1133
|
+
var defineConfigurable = (function (target, props) {
|
|
1134
|
+
for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
|
|
1135
|
+
var key = _a[_i];
|
|
1136
|
+
Object.defineProperty(target, key, {
|
|
1137
|
+
value: props[key],
|
|
1138
|
+
enumerable: false,
|
|
1139
|
+
writable: false,
|
|
1140
|
+
configurable: true
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
return target;
|
|
1144
|
+
});
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* Returns the global object associated with provided element.
|
|
1148
|
+
*
|
|
1149
|
+
* @param {Object} target
|
|
1150
|
+
* @returns {Object}
|
|
1151
|
+
*/
|
|
1152
|
+
var getWindowOf = (function (target) {
|
|
1153
|
+
// Assume that the element is an instance of Node, which means that it
|
|
1154
|
+
// has the "ownerDocument" property from which we can retrieve a
|
|
1155
|
+
// corresponding global object.
|
|
1156
|
+
var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
|
|
1157
|
+
// Return the local global object if it's not possible extract one from
|
|
1158
|
+
// provided element.
|
|
1159
|
+
return ownerGlobal || global$1;
|
|
1160
|
+
});
|
|
1161
|
+
|
|
1162
|
+
// Placeholder of an empty content rectangle.
|
|
1163
|
+
var emptyRect = createRectInit(0, 0, 0, 0);
|
|
1164
|
+
/**
|
|
1165
|
+
* Converts provided string to a number.
|
|
1166
|
+
*
|
|
1167
|
+
* @param {number|string} value
|
|
1168
|
+
* @returns {number}
|
|
1169
|
+
*/
|
|
1170
|
+
function toFloat(value) {
|
|
1171
|
+
return parseFloat(value) || 0;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Extracts borders size from provided styles.
|
|
1175
|
+
*
|
|
1176
|
+
* @param {CSSStyleDeclaration} styles
|
|
1177
|
+
* @param {...string} positions - Borders positions (top, right, ...)
|
|
1178
|
+
* @returns {number}
|
|
1179
|
+
*/
|
|
1180
|
+
function getBordersSize(styles) {
|
|
1181
|
+
var positions = [];
|
|
1182
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1183
|
+
positions[_i - 1] = arguments[_i];
|
|
1184
|
+
}
|
|
1185
|
+
return positions.reduce(function (size, position) {
|
|
1186
|
+
var value = styles['border-' + position + '-width'];
|
|
1187
|
+
return size + toFloat(value);
|
|
1188
|
+
}, 0);
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Extracts paddings sizes from provided styles.
|
|
1192
|
+
*
|
|
1193
|
+
* @param {CSSStyleDeclaration} styles
|
|
1194
|
+
* @returns {Object} Paddings box.
|
|
1195
|
+
*/
|
|
1196
|
+
function getPaddings(styles) {
|
|
1197
|
+
var positions = ['top', 'right', 'bottom', 'left'];
|
|
1198
|
+
var paddings = {};
|
|
1199
|
+
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
1200
|
+
var position = positions_1[_i];
|
|
1201
|
+
var value = styles['padding-' + position];
|
|
1202
|
+
paddings[position] = toFloat(value);
|
|
1203
|
+
}
|
|
1204
|
+
return paddings;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Calculates content rectangle of provided SVG element.
|
|
1208
|
+
*
|
|
1209
|
+
* @param {SVGGraphicsElement} target - Element content rectangle of which needs
|
|
1210
|
+
* to be calculated.
|
|
1211
|
+
* @returns {DOMRectInit}
|
|
1212
|
+
*/
|
|
1213
|
+
function getSVGContentRect(target) {
|
|
1214
|
+
var bbox = target.getBBox();
|
|
1215
|
+
return createRectInit(0, 0, bbox.width, bbox.height);
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Calculates content rectangle of provided HTMLElement.
|
|
1219
|
+
*
|
|
1220
|
+
* @param {HTMLElement} target - Element for which to calculate the content rectangle.
|
|
1221
|
+
* @returns {DOMRectInit}
|
|
1222
|
+
*/
|
|
1223
|
+
function getHTMLElementContentRect(target) {
|
|
1224
|
+
// Client width & height properties can't be
|
|
1225
|
+
// used exclusively as they provide rounded values.
|
|
1226
|
+
var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
|
|
1227
|
+
// By this condition we can catch all non-replaced inline, hidden and
|
|
1228
|
+
// detached elements. Though elements with width & height properties less
|
|
1229
|
+
// than 0.5 will be discarded as well.
|
|
1230
|
+
//
|
|
1231
|
+
// Without it we would need to implement separate methods for each of
|
|
1232
|
+
// those cases and it's not possible to perform a precise and performance
|
|
1233
|
+
// effective test for hidden elements. E.g. even jQuery's ':visible' filter
|
|
1234
|
+
// gives wrong results for elements with width & height less than 0.5.
|
|
1235
|
+
if (!clientWidth && !clientHeight) {
|
|
1236
|
+
return emptyRect;
|
|
1237
|
+
}
|
|
1238
|
+
var styles = getWindowOf(target).getComputedStyle(target);
|
|
1239
|
+
var paddings = getPaddings(styles);
|
|
1240
|
+
var horizPad = paddings.left + paddings.right;
|
|
1241
|
+
var vertPad = paddings.top + paddings.bottom;
|
|
1242
|
+
// Computed styles of width & height are being used because they are the
|
|
1243
|
+
// only dimensions available to JS that contain non-rounded values. It could
|
|
1244
|
+
// be possible to utilize the getBoundingClientRect if only it's data wasn't
|
|
1245
|
+
// affected by CSS transformations let alone paddings, borders and scroll bars.
|
|
1246
|
+
var width = toFloat(styles.width), height = toFloat(styles.height);
|
|
1247
|
+
// Width & height include paddings and borders when the 'border-box' box
|
|
1248
|
+
// model is applied (except for IE).
|
|
1249
|
+
if (styles.boxSizing === 'border-box') {
|
|
1250
|
+
// Following conditions are required to handle Internet Explorer which
|
|
1251
|
+
// doesn't include paddings and borders to computed CSS dimensions.
|
|
1252
|
+
//
|
|
1253
|
+
// We can say that if CSS dimensions + paddings are equal to the "client"
|
|
1254
|
+
// properties then it's either IE, and thus we don't need to subtract
|
|
1255
|
+
// anything, or an element merely doesn't have paddings/borders styles.
|
|
1256
|
+
if (Math.round(width + horizPad) !== clientWidth) {
|
|
1257
|
+
width -= getBordersSize(styles, 'left', 'right') + horizPad;
|
|
1258
|
+
}
|
|
1259
|
+
if (Math.round(height + vertPad) !== clientHeight) {
|
|
1260
|
+
height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
// Following steps can't be applied to the document's root element as its
|
|
1264
|
+
// client[Width/Height] properties represent viewport area of the window.
|
|
1265
|
+
// Besides, it's as well not necessary as the <html> itself neither has
|
|
1266
|
+
// rendered scroll bars nor it can be clipped.
|
|
1267
|
+
if (!isDocumentElement(target)) {
|
|
1268
|
+
// In some browsers (only in Firefox, actually) CSS width & height
|
|
1269
|
+
// include scroll bars size which can be removed at this step as scroll
|
|
1270
|
+
// bars are the only difference between rounded dimensions + paddings
|
|
1271
|
+
// and "client" properties, though that is not always true in Chrome.
|
|
1272
|
+
var vertScrollbar = Math.round(width + horizPad) - clientWidth;
|
|
1273
|
+
var horizScrollbar = Math.round(height + vertPad) - clientHeight;
|
|
1274
|
+
// Chrome has a rather weird rounding of "client" properties.
|
|
1275
|
+
// E.g. for an element with content width of 314.2px it sometimes gives
|
|
1276
|
+
// the client width of 315px and for the width of 314.7px it may give
|
|
1277
|
+
// 314px. And it doesn't happen all the time. So just ignore this delta
|
|
1278
|
+
// as a non-relevant.
|
|
1279
|
+
if (Math.abs(vertScrollbar) !== 1) {
|
|
1280
|
+
width -= vertScrollbar;
|
|
1281
|
+
}
|
|
1282
|
+
if (Math.abs(horizScrollbar) !== 1) {
|
|
1283
|
+
height -= horizScrollbar;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return createRectInit(paddings.left, paddings.top, width, height);
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Checks whether provided element is an instance of the SVGGraphicsElement.
|
|
1290
|
+
*
|
|
1291
|
+
* @param {Element} target - Element to be checked.
|
|
1292
|
+
* @returns {boolean}
|
|
1293
|
+
*/
|
|
1294
|
+
var isSVGGraphicsElement = (function () {
|
|
1295
|
+
// Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
|
|
1296
|
+
// interface.
|
|
1297
|
+
if (typeof SVGGraphicsElement !== 'undefined') {
|
|
1298
|
+
return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
|
|
1299
|
+
}
|
|
1300
|
+
// If it's so, then check that element is at least an instance of the
|
|
1301
|
+
// SVGElement and that it has the "getBBox" method.
|
|
1302
|
+
// eslint-disable-next-line no-extra-parens
|
|
1303
|
+
return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
|
|
1304
|
+
typeof target.getBBox === 'function'); };
|
|
1305
|
+
})();
|
|
1306
|
+
/**
|
|
1307
|
+
* Checks whether provided element is a document element (<html>).
|
|
1308
|
+
*
|
|
1309
|
+
* @param {Element} target - Element to be checked.
|
|
1310
|
+
* @returns {boolean}
|
|
1311
|
+
*/
|
|
1312
|
+
function isDocumentElement(target) {
|
|
1313
|
+
return target === getWindowOf(target).document.documentElement;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Calculates an appropriate content rectangle for provided html or svg element.
|
|
1317
|
+
*
|
|
1318
|
+
* @param {Element} target - Element content rectangle of which needs to be calculated.
|
|
1319
|
+
* @returns {DOMRectInit}
|
|
1320
|
+
*/
|
|
1321
|
+
function getContentRect(target) {
|
|
1322
|
+
if (!isBrowser) {
|
|
1323
|
+
return emptyRect;
|
|
1324
|
+
}
|
|
1325
|
+
if (isSVGGraphicsElement(target)) {
|
|
1326
|
+
return getSVGContentRect(target);
|
|
1327
|
+
}
|
|
1328
|
+
return getHTMLElementContentRect(target);
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Creates rectangle with an interface of the DOMRectReadOnly.
|
|
1332
|
+
* Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
|
|
1333
|
+
*
|
|
1334
|
+
* @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
|
|
1335
|
+
* @returns {DOMRectReadOnly}
|
|
1336
|
+
*/
|
|
1337
|
+
function createReadOnlyRect(_a) {
|
|
1338
|
+
var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
1339
|
+
// If DOMRectReadOnly is available use it as a prototype for the rectangle.
|
|
1340
|
+
var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
|
|
1341
|
+
var rect = Object.create(Constr.prototype);
|
|
1342
|
+
// Rectangle's properties are not writable and non-enumerable.
|
|
1343
|
+
defineConfigurable(rect, {
|
|
1344
|
+
x: x, y: y, width: width, height: height,
|
|
1345
|
+
top: y,
|
|
1346
|
+
right: x + width,
|
|
1347
|
+
bottom: height + y,
|
|
1348
|
+
left: x
|
|
1349
|
+
});
|
|
1350
|
+
return rect;
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
|
|
1354
|
+
* Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
|
|
1355
|
+
*
|
|
1356
|
+
* @param {number} x - X coordinate.
|
|
1357
|
+
* @param {number} y - Y coordinate.
|
|
1358
|
+
* @param {number} width - Rectangle's width.
|
|
1359
|
+
* @param {number} height - Rectangle's height.
|
|
1360
|
+
* @returns {DOMRectInit}
|
|
1361
|
+
*/
|
|
1362
|
+
function createRectInit(x, y, width, height) {
|
|
1363
|
+
return { x: x, y: y, width: width, height: height };
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Class that is responsible for computations of the content rectangle of
|
|
1368
|
+
* provided DOM element and for keeping track of it's changes.
|
|
1369
|
+
*/
|
|
1370
|
+
var ResizeObservation = /** @class */ (function () {
|
|
1371
|
+
/**
|
|
1372
|
+
* Creates an instance of ResizeObservation.
|
|
1373
|
+
*
|
|
1374
|
+
* @param {Element} target - Element to be observed.
|
|
1375
|
+
*/
|
|
1376
|
+
function ResizeObservation(target) {
|
|
1377
|
+
/**
|
|
1378
|
+
* Broadcasted width of content rectangle.
|
|
1379
|
+
*
|
|
1380
|
+
* @type {number}
|
|
1381
|
+
*/
|
|
1382
|
+
this.broadcastWidth = 0;
|
|
1383
|
+
/**
|
|
1384
|
+
* Broadcasted height of content rectangle.
|
|
1385
|
+
*
|
|
1386
|
+
* @type {number}
|
|
1387
|
+
*/
|
|
1388
|
+
this.broadcastHeight = 0;
|
|
1389
|
+
/**
|
|
1390
|
+
* Reference to the last observed content rectangle.
|
|
1391
|
+
*
|
|
1392
|
+
* @private {DOMRectInit}
|
|
1393
|
+
*/
|
|
1394
|
+
this.contentRect_ = createRectInit(0, 0, 0, 0);
|
|
1395
|
+
this.target = target;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Updates content rectangle and tells whether it's width or height properties
|
|
1399
|
+
* have changed since the last broadcast.
|
|
1400
|
+
*
|
|
1401
|
+
* @returns {boolean}
|
|
1402
|
+
*/
|
|
1403
|
+
ResizeObservation.prototype.isActive = function () {
|
|
1404
|
+
var rect = getContentRect(this.target);
|
|
1405
|
+
this.contentRect_ = rect;
|
|
1406
|
+
return (rect.width !== this.broadcastWidth ||
|
|
1407
|
+
rect.height !== this.broadcastHeight);
|
|
1408
|
+
};
|
|
1409
|
+
/**
|
|
1410
|
+
* Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
|
|
1411
|
+
* from the corresponding properties of the last observed content rectangle.
|
|
1412
|
+
*
|
|
1413
|
+
* @returns {DOMRectInit} Last observed content rectangle.
|
|
1414
|
+
*/
|
|
1415
|
+
ResizeObservation.prototype.broadcastRect = function () {
|
|
1416
|
+
var rect = this.contentRect_;
|
|
1417
|
+
this.broadcastWidth = rect.width;
|
|
1418
|
+
this.broadcastHeight = rect.height;
|
|
1419
|
+
return rect;
|
|
1420
|
+
};
|
|
1421
|
+
return ResizeObservation;
|
|
1422
|
+
}());
|
|
1423
|
+
|
|
1424
|
+
var ResizeObserverEntry = /** @class */ (function () {
|
|
1425
|
+
/**
|
|
1426
|
+
* Creates an instance of ResizeObserverEntry.
|
|
1427
|
+
*
|
|
1428
|
+
* @param {Element} target - Element that is being observed.
|
|
1429
|
+
* @param {DOMRectInit} rectInit - Data of the element's content rectangle.
|
|
1430
|
+
*/
|
|
1431
|
+
function ResizeObserverEntry(target, rectInit) {
|
|
1432
|
+
var contentRect = createReadOnlyRect(rectInit);
|
|
1433
|
+
// According to the specification following properties are not writable
|
|
1434
|
+
// and are also not enumerable in the native implementation.
|
|
1435
|
+
//
|
|
1436
|
+
// Property accessors are not being used as they'd require to define a
|
|
1437
|
+
// private WeakMap storage which may cause memory leaks in browsers that
|
|
1438
|
+
// don't support this type of collections.
|
|
1439
|
+
defineConfigurable(this, { target: target, contentRect: contentRect });
|
|
1440
|
+
}
|
|
1441
|
+
return ResizeObserverEntry;
|
|
1442
|
+
}());
|
|
1443
|
+
|
|
1444
|
+
var ResizeObserverSPI = /** @class */ (function () {
|
|
1445
|
+
/**
|
|
1446
|
+
* Creates a new instance of ResizeObserver.
|
|
1447
|
+
*
|
|
1448
|
+
* @param {ResizeObserverCallback} callback - Callback function that is invoked
|
|
1449
|
+
* when one of the observed elements changes it's content dimensions.
|
|
1450
|
+
* @param {ResizeObserverController} controller - Controller instance which
|
|
1451
|
+
* is responsible for the updates of observer.
|
|
1452
|
+
* @param {ResizeObserver} callbackCtx - Reference to the public
|
|
1453
|
+
* ResizeObserver instance which will be passed to callback function.
|
|
1454
|
+
*/
|
|
1455
|
+
function ResizeObserverSPI(callback, controller, callbackCtx) {
|
|
1456
|
+
/**
|
|
1457
|
+
* Collection of resize observations that have detected changes in dimensions
|
|
1458
|
+
* of elements.
|
|
1459
|
+
*
|
|
1460
|
+
* @private {Array<ResizeObservation>}
|
|
1461
|
+
*/
|
|
1462
|
+
this.activeObservations_ = [];
|
|
1463
|
+
/**
|
|
1464
|
+
* Registry of the ResizeObservation instances.
|
|
1465
|
+
*
|
|
1466
|
+
* @private {Map<Element, ResizeObservation>}
|
|
1467
|
+
*/
|
|
1468
|
+
this.observations_ = new MapShim();
|
|
1469
|
+
if (typeof callback !== 'function') {
|
|
1470
|
+
throw new TypeError('The callback provided as parameter 1 is not a function.');
|
|
1471
|
+
}
|
|
1472
|
+
this.callback_ = callback;
|
|
1473
|
+
this.controller_ = controller;
|
|
1474
|
+
this.callbackCtx_ = callbackCtx;
|
|
1475
|
+
}
|
|
1476
|
+
/**
|
|
1477
|
+
* Starts observing provided element.
|
|
1478
|
+
*
|
|
1479
|
+
* @param {Element} target - Element to be observed.
|
|
1480
|
+
* @returns {void}
|
|
1481
|
+
*/
|
|
1482
|
+
ResizeObserverSPI.prototype.observe = function (target) {
|
|
1483
|
+
if (!arguments.length) {
|
|
1484
|
+
throw new TypeError('1 argument required, but only 0 present.');
|
|
1485
|
+
}
|
|
1486
|
+
// Do nothing if current environment doesn't have the Element interface.
|
|
1487
|
+
if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
if (!(target instanceof getWindowOf(target).Element)) {
|
|
1491
|
+
throw new TypeError('parameter 1 is not of type "Element".');
|
|
1492
|
+
}
|
|
1493
|
+
var observations = this.observations_;
|
|
1494
|
+
// Do nothing if element is already being observed.
|
|
1495
|
+
if (observations.has(target)) {
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
observations.set(target, new ResizeObservation(target));
|
|
1499
|
+
this.controller_.addObserver(this);
|
|
1500
|
+
// Force the update of observations.
|
|
1501
|
+
this.controller_.refresh();
|
|
1502
|
+
};
|
|
1503
|
+
/**
|
|
1504
|
+
* Stops observing provided element.
|
|
1505
|
+
*
|
|
1506
|
+
* @param {Element} target - Element to stop observing.
|
|
1507
|
+
* @returns {void}
|
|
1508
|
+
*/
|
|
1509
|
+
ResizeObserverSPI.prototype.unobserve = function (target) {
|
|
1510
|
+
if (!arguments.length) {
|
|
1511
|
+
throw new TypeError('1 argument required, but only 0 present.');
|
|
1512
|
+
}
|
|
1513
|
+
// Do nothing if current environment doesn't have the Element interface.
|
|
1514
|
+
if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
if (!(target instanceof getWindowOf(target).Element)) {
|
|
1518
|
+
throw new TypeError('parameter 1 is not of type "Element".');
|
|
1519
|
+
}
|
|
1520
|
+
var observations = this.observations_;
|
|
1521
|
+
// Do nothing if element is not being observed.
|
|
1522
|
+
if (!observations.has(target)) {
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
observations.delete(target);
|
|
1526
|
+
if (!observations.size) {
|
|
1527
|
+
this.controller_.removeObserver(this);
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
/**
|
|
1531
|
+
* Stops observing all elements.
|
|
1532
|
+
*
|
|
1533
|
+
* @returns {void}
|
|
1534
|
+
*/
|
|
1535
|
+
ResizeObserverSPI.prototype.disconnect = function () {
|
|
1536
|
+
this.clearActive();
|
|
1537
|
+
this.observations_.clear();
|
|
1538
|
+
this.controller_.removeObserver(this);
|
|
1539
|
+
};
|
|
1540
|
+
/**
|
|
1541
|
+
* Collects observation instances the associated element of which has changed
|
|
1542
|
+
* it's content rectangle.
|
|
1543
|
+
*
|
|
1544
|
+
* @returns {void}
|
|
1545
|
+
*/
|
|
1546
|
+
ResizeObserverSPI.prototype.gatherActive = function () {
|
|
1547
|
+
var _this = this;
|
|
1548
|
+
this.clearActive();
|
|
1549
|
+
this.observations_.forEach(function (observation) {
|
|
1550
|
+
if (observation.isActive()) {
|
|
1551
|
+
_this.activeObservations_.push(observation);
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
};
|
|
1555
|
+
/**
|
|
1556
|
+
* Invokes initial callback function with a list of ResizeObserverEntry
|
|
1557
|
+
* instances collected from active resize observations.
|
|
1558
|
+
*
|
|
1559
|
+
* @returns {void}
|
|
1560
|
+
*/
|
|
1561
|
+
ResizeObserverSPI.prototype.broadcastActive = function () {
|
|
1562
|
+
// Do nothing if observer doesn't have active observations.
|
|
1563
|
+
if (!this.hasActive()) {
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
var ctx = this.callbackCtx_;
|
|
1567
|
+
// Create ResizeObserverEntry instance for every active observation.
|
|
1568
|
+
var entries = this.activeObservations_.map(function (observation) {
|
|
1569
|
+
return new ResizeObserverEntry(observation.target, observation.broadcastRect());
|
|
1570
|
+
});
|
|
1571
|
+
this.callback_.call(ctx, entries, ctx);
|
|
1572
|
+
this.clearActive();
|
|
1573
|
+
};
|
|
1574
|
+
/**
|
|
1575
|
+
* Clears the collection of active observations.
|
|
1576
|
+
*
|
|
1577
|
+
* @returns {void}
|
|
1578
|
+
*/
|
|
1579
|
+
ResizeObserverSPI.prototype.clearActive = function () {
|
|
1580
|
+
this.activeObservations_.splice(0);
|
|
1581
|
+
};
|
|
1582
|
+
/**
|
|
1583
|
+
* Tells whether observer has active observations.
|
|
1584
|
+
*
|
|
1585
|
+
* @returns {boolean}
|
|
1586
|
+
*/
|
|
1587
|
+
ResizeObserverSPI.prototype.hasActive = function () {
|
|
1588
|
+
return this.activeObservations_.length > 0;
|
|
1589
|
+
};
|
|
1590
|
+
return ResizeObserverSPI;
|
|
1591
|
+
}());
|
|
1592
|
+
|
|
1593
|
+
// Registry of internal observers. If WeakMap is not available use current shim
|
|
1594
|
+
// for the Map collection as it has all required methods and because WeakMap
|
|
1595
|
+
// can't be fully polyfilled anyway.
|
|
1596
|
+
var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
|
|
1597
|
+
/**
|
|
1598
|
+
* ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
|
|
1599
|
+
* exposing only those methods and properties that are defined in the spec.
|
|
1600
|
+
*/
|
|
1601
|
+
var ResizeObserver = /** @class */ (function () {
|
|
1602
|
+
/**
|
|
1603
|
+
* Creates a new instance of ResizeObserver.
|
|
1604
|
+
*
|
|
1605
|
+
* @param {ResizeObserverCallback} callback - Callback that is invoked when
|
|
1606
|
+
* dimensions of the observed elements change.
|
|
1607
|
+
*/
|
|
1608
|
+
function ResizeObserver(callback) {
|
|
1609
|
+
if (!(this instanceof ResizeObserver)) {
|
|
1610
|
+
throw new TypeError('Cannot call a class as a function.');
|
|
1611
|
+
}
|
|
1612
|
+
if (!arguments.length) {
|
|
1613
|
+
throw new TypeError('1 argument required, but only 0 present.');
|
|
1614
|
+
}
|
|
1615
|
+
var controller = ResizeObserverController.getInstance();
|
|
1616
|
+
var observer = new ResizeObserverSPI(callback, controller, this);
|
|
1617
|
+
observers.set(this, observer);
|
|
1618
|
+
}
|
|
1619
|
+
return ResizeObserver;
|
|
1620
|
+
}());
|
|
1621
|
+
// Expose public methods of ResizeObserver.
|
|
1622
|
+
[
|
|
1623
|
+
'observe',
|
|
1624
|
+
'unobserve',
|
|
1625
|
+
'disconnect'
|
|
1626
|
+
].forEach(function (method) {
|
|
1627
|
+
ResizeObserver.prototype[method] = function () {
|
|
1628
|
+
var _a;
|
|
1629
|
+
return (_a = observers.get(this))[method].apply(_a, arguments);
|
|
1630
|
+
};
|
|
1631
|
+
});
|
|
1632
|
+
|
|
1633
|
+
var index = (function () {
|
|
1634
|
+
// Export existing implementation if available.
|
|
1635
|
+
if (typeof global$1.ResizeObserver !== 'undefined') {
|
|
1636
|
+
return global$1.ResizeObserver;
|
|
1637
|
+
}
|
|
1638
|
+
return ResizeObserver;
|
|
1639
|
+
})();
|
|
1640
|
+
|
|
1641
|
+
function useEditableCaption(ref, options) {
|
|
1642
|
+
React.useLayoutEffect(function () {
|
|
1643
|
+
if (!ref.current) {
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
var observer = new index(function () {
|
|
1647
|
+
if (ref.current && typeof options.notifyBoundsChanged === "function") {
|
|
1648
|
+
options.notifyBoundsChanged(getElementBounds(ref.current));
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
observer.observe(ref.current);
|
|
1652
|
+
if (ref.current && typeof options.notifyBoundsChanged === "function") {
|
|
1653
|
+
options.notifyBoundsChanged(getElementBounds(ref.current));
|
|
1654
|
+
}
|
|
1655
|
+
return function () {
|
|
1656
|
+
observer.disconnect();
|
|
1657
|
+
};
|
|
1658
|
+
}, [ref]);
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
var FlatCaption = function (_a) {
|
|
1662
|
+
var caption = _a.caption, notifyBoundsChanged = _a.notifyBoundsChanged;
|
|
1663
|
+
var ref = React.useRef(null);
|
|
1664
|
+
useEditableCaption(ref, { notifyBoundsChanged: notifyBoundsChanged });
|
|
1665
|
+
return React__default["default"].createElement("div", { ref: ref, className: "t42-caption t42-title t42-frame-caption-bar-element" }, caption);
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
function useCaptionEditor(ref, options) {
|
|
1669
|
+
React.useEffect(function () {
|
|
1670
|
+
if (!(ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
options.notifyEditorVisibilityChanged(true);
|
|
1674
|
+
var observer = new index(function () {
|
|
1675
|
+
if (ref.current) {
|
|
1676
|
+
options.notifyBoundsChanged(getElementBounds(ref.current));
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
observer.observe(ref.current);
|
|
1680
|
+
if (ref.current) {
|
|
1681
|
+
options.notifyBoundsChanged(getElementBounds(ref.current));
|
|
1682
|
+
}
|
|
1683
|
+
return function () {
|
|
1684
|
+
options.notifyEditorVisibilityChanged(false);
|
|
1685
|
+
observer.disconnect();
|
|
1686
|
+
};
|
|
1687
|
+
}, [ref]);
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
function useCommitEditingRequested(targetType, targetId, text) {
|
|
1691
|
+
React.useEffect(function () {
|
|
1692
|
+
var unsub = webGroupsManager.onCommitCaptionEditingRequested(targetType, targetId, function () {
|
|
1693
|
+
webGroupsManager.commitCaptionEditing(targetType, targetId, text);
|
|
1694
|
+
});
|
|
1695
|
+
return function () {
|
|
1696
|
+
unsub();
|
|
1697
|
+
};
|
|
1698
|
+
}, [targetType, targetId, text]);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
var CaptionEditor = function (_a) {
|
|
1702
|
+
var className = _a.className, commitChanges = _a.commitChanges, hideEditor = _a.hideEditor, notifyBoundsChanged = _a.notifyBoundsChanged, caption = _a.caption, notifyEditorVisibilityChanged = _a.notifyEditorVisibilityChanged, targetType = _a.targetType, targetId = _a.targetId;
|
|
1703
|
+
var _b = React.useState(caption), captionInEditor = _b[0], setCaptionInEditor = _b[1];
|
|
1704
|
+
var _c = React.useState(0), inputWidth = _c[0], setInputWidth = _c[1];
|
|
1705
|
+
var ref = React.useRef(null);
|
|
1706
|
+
var measurementRef = React.useRef(null);
|
|
1707
|
+
var onBlur = function () {
|
|
1708
|
+
commitChanges(captionInEditor);
|
|
1709
|
+
};
|
|
1710
|
+
var onChange = function (e) {
|
|
1711
|
+
setCaptionInEditor(e.target.value);
|
|
1712
|
+
};
|
|
1713
|
+
var onKeyDown = function (e) {
|
|
1714
|
+
if (e.key === "Enter") {
|
|
1715
|
+
e.preventDefault();
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
var onKeyUp = function (e) {
|
|
1719
|
+
if (e.key === "Escape") {
|
|
1720
|
+
hideEditor();
|
|
1721
|
+
}
|
|
1722
|
+
else if (e.key === "Enter") {
|
|
1723
|
+
commitChanges(captionInEditor);
|
|
1724
|
+
e.preventDefault();
|
|
1725
|
+
}
|
|
1726
|
+
};
|
|
1727
|
+
useCaptionEditor(ref, { notifyBoundsChanged: notifyBoundsChanged, notifyEditorVisibilityChanged: notifyEditorVisibilityChanged });
|
|
1728
|
+
useCommitEditingRequested(targetType, targetId, captionInEditor);
|
|
1729
|
+
React.useEffect(function () {
|
|
1730
|
+
if (!ref.current) {
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
var onMouseDown = function (e) {
|
|
1734
|
+
e.stopPropagation();
|
|
1735
|
+
};
|
|
1736
|
+
var element = ref.current;
|
|
1737
|
+
element.addEventListener("mousedown", onMouseDown);
|
|
1738
|
+
if (ref.current) {
|
|
1739
|
+
// Focus element on the next tick to have properly focused page
|
|
1740
|
+
setTimeout(function () {
|
|
1741
|
+
element === null || element === void 0 ? void 0 : element.focus();
|
|
1742
|
+
element === null || element === void 0 ? void 0 : element.select();
|
|
1743
|
+
}, 0);
|
|
1744
|
+
}
|
|
1745
|
+
return function () {
|
|
1746
|
+
element === null || element === void 0 ? void 0 : element.removeEventListener("mousedown", onMouseDown);
|
|
1747
|
+
};
|
|
1748
|
+
}, [ref]);
|
|
1749
|
+
React.useEffect(function () {
|
|
1750
|
+
if (!measurementRef.current) {
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
setInputWidth(measurementRef.current.scrollWidth);
|
|
1754
|
+
}, [measurementRef, captionInEditor]);
|
|
1755
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1756
|
+
React__default["default"].createElement("input", { ref: ref, style: {
|
|
1757
|
+
width: inputWidth + "px"
|
|
1758
|
+
}, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onChange: onChange, onBlur: onBlur, value: captionInEditor, className: className }),
|
|
1759
|
+
React__default["default"].createElement("span", { ref: measurementRef, style: { visibility: "hidden", position: "absolute", top: -30000, left: -30000 } }, captionInEditor));
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1762
|
+
var FlatCaptionEditor = function (props) {
|
|
1763
|
+
return React__default["default"].createElement(CaptionEditor, __assign({}, props, { targetId: props.frameId, targetType: TargetType.Frame, className: "t42-caption-editor t42-frame-caption-bar-element" }));
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
var FlatMoveArea = function (_a) {
|
|
1767
|
+
var children = _a.children, moveAreaId = _a.moveAreaId;
|
|
1768
|
+
return React__default["default"].createElement("div", { id: moveAreaId, className: "t42-move-area t42-frame-caption-bar-element" }, children);
|
|
1769
|
+
};
|
|
1770
|
+
|
|
1771
|
+
var FlatCaptionBar = function (_a) {
|
|
1772
|
+
var moveAreaId = _a.moveAreaId, caption = _a.caption, channels = _a.channels, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, rest = __rest(_a, ["moveAreaId", "caption", "channels", "captionEditor", "notifyCaptionBoundsChanged"]);
|
|
1773
|
+
return (React__default["default"].createElement("div", { className: "t42-react-caption-bar" },
|
|
1774
|
+
(channels === null || channels === void 0 ? void 0 : channels.visible) && React__default["default"].createElement(FlatChannelSelector, { showSelector: channels === null || channels === void 0 ? void 0 : channels.showSelector, selectedChannel: channels === null || channels === void 0 ? void 0 : channels.selectedChannel, selectedChannelColor: channels === null || channels === void 0 ? void 0 : channels.selectedChannelColor }),
|
|
1775
|
+
React__default["default"].createElement(FlatMoveArea, { moveAreaId: moveAreaId }, captionEditor.show ? React__default["default"].createElement(FlatCaptionEditor, __assign({}, captionEditor, { caption: captionEditor.text, frameId: rest.frameId })) : React__default["default"].createElement(FlatCaption, { notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption })),
|
|
1776
|
+
React__default["default"].createElement(FlatButtons, __assign({}, rest))));
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1779
|
+
var GroupMoveArea = function (_a) {
|
|
1780
|
+
var children = _a.children, moveAreaId = _a.moveAreaId;
|
|
1781
|
+
return React__default["default"].createElement("div", { id: moveAreaId, className: "t42-move-area t42-group-caption-bar-element" }, children);
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
var GroupButtons = function (_a) {
|
|
1785
|
+
var minimize = _a.minimize, restore = _a.restore, maximize = _a.maximize, close = _a.close;
|
|
1786
|
+
return React__default["default"].createElement("div", { className: "t42-buttons-container t42-group-caption-bar-element" },
|
|
1787
|
+
React__default["default"].createElement("ul", { className: "t42-buttons t42-group-caption-bar-element" },
|
|
1788
|
+
(minimize === null || minimize === void 0 ? void 0 : minimize.visible) && React__default["default"].createElement(MinimizeButton, __assign({}, minimize)),
|
|
1789
|
+
(restore === null || restore === void 0 ? void 0 : restore.visible) && React__default["default"].createElement(RestoreButton, __assign({}, restore)),
|
|
1790
|
+
(maximize === null || maximize === void 0 ? void 0 : maximize.visible) && React__default["default"].createElement(MaximizeButton, __assign({}, maximize)),
|
|
1791
|
+
(close === null || close === void 0 ? void 0 : close.visible) && React__default["default"].createElement(CloseButton, __assign({}, close))));
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
var GroupCaption = function (_a) {
|
|
1795
|
+
var caption = _a.caption, notifyBoundsChanged = _a.notifyBoundsChanged;
|
|
1796
|
+
var ref = React.useRef(null);
|
|
1797
|
+
useEditableCaption(ref, { notifyBoundsChanged: notifyBoundsChanged });
|
|
1798
|
+
return React__default["default"].createElement("div", { ref: ref, className: "t42-caption t42-title t42-group-caption-bar-element" }, caption);
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
var GroupCaptionEditor = function (props) {
|
|
1802
|
+
return React__default["default"].createElement(CaptionEditor, __assign({}, props, { targetId: props.groupId, targetType: TargetType.Group, className: "t42-caption-editor t42-group-caption-bar-element" }));
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
var GroupCaptionBar = function (_a) {
|
|
1806
|
+
var moveAreaId = _a.moveAreaId; _a.targetType; var targetId = _a.targetId, caption = _a.caption, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, rest = __rest(_a, ["moveAreaId", "targetType", "targetId", "caption", "captionEditor", "notifyCaptionBoundsChanged"]);
|
|
1807
|
+
return React__default["default"].createElement("div", { className: "t42-react-caption-bar" },
|
|
1808
|
+
React__default["default"].createElement(GroupMoveArea, { moveAreaId: moveAreaId }, (captionEditor === null || captionEditor === void 0 ? void 0 : captionEditor.show) ?
|
|
1809
|
+
React__default["default"].createElement(GroupCaptionEditor, __assign({}, captionEditor, { groupId: targetId, caption: captionEditor.text })) :
|
|
1810
|
+
React__default["default"].createElement(GroupCaption, { notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption })),
|
|
1811
|
+
React__default["default"].createElement(GroupButtons, __assign({}, rest)));
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
var TabChannelSelector = function (_a) {
|
|
1815
|
+
var showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor;
|
|
1816
|
+
return React__default["default"].createElement(BaseChannelSelector, { outsideClass: "t42-tab-bar-element t42-tab-channel-selector", contentClass: "t42-tab-channel-selector-content", showSelector: showSelector, selectedChannel: selectedChannel, selectedChannelColor: selectedChannelColor });
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
var TabCaption = function (_a) {
|
|
1820
|
+
var caption = _a.caption, selected = _a.selected, notifyBoundsChanged = _a.notifyBoundsChanged;
|
|
1821
|
+
var normalClassName = "t42-caption t42-tab-caption";
|
|
1822
|
+
var selectedClassName = "t42-caption t42-tab-caption t42-selected-tab-caption";
|
|
1823
|
+
var ref = React.useRef(null);
|
|
1824
|
+
useEditableCaption(ref, { notifyBoundsChanged: notifyBoundsChanged });
|
|
1825
|
+
return React__default["default"].createElement("div", { ref: ref, className: selected ? selectedClassName : normalClassName }, caption);
|
|
1826
|
+
};
|
|
1827
|
+
|
|
1828
|
+
var TabCaptionEditor = function (props) {
|
|
1829
|
+
var normalClassName = "t42-caption-editor t42-tab-caption-editor t42-caption t42-tab-caption";
|
|
1830
|
+
var selectedClassName = "t42-caption-editor t42-tab-caption-editor t42-caption t42-tab-caption t42-selected-tab-caption t42-selected-tab-element";
|
|
1831
|
+
return React__default["default"].createElement(CaptionEditor, __assign({}, props, { targetType: TargetType.Tab, targetId: props.windowId, className: props.selected ? selectedClassName : normalClassName }));
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1834
|
+
var TabCloseButton = function (_a) {
|
|
1835
|
+
var selected = _a.selected, close = _a.close;
|
|
1836
|
+
var normalClassName = "t42-tab-close-button t42-tab-bar-element";
|
|
1837
|
+
var selectedClassName = "t42-tab-close-button t42-tab-bar-element t42-selected-tab-close-button t42-selected-tab-element";
|
|
1838
|
+
var normalContentClassName = "t42-tab-close-button-content";
|
|
1839
|
+
var selectedContentClassName = "t42-tab-close-button-content t42-selected-tab-close-button-content";
|
|
1840
|
+
var ref = React.useRef(null);
|
|
1841
|
+
React.useEffect(function () {
|
|
1842
|
+
var _a;
|
|
1843
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener("mousedown", function (e) {
|
|
1844
|
+
e.stopPropagation();
|
|
1845
|
+
});
|
|
1846
|
+
}, [ref]);
|
|
1847
|
+
return React__default["default"].createElement("div", { ref: ref, onClick: close, className: selected ? selectedClassName : normalClassName, title: "close" },
|
|
1848
|
+
React__default["default"].createElement("div", { className: selected ? selectedContentClassName : normalContentClassName }));
|
|
1849
|
+
};
|
|
1850
|
+
|
|
1851
|
+
var Tab = function (_a) {
|
|
1852
|
+
var caption = _a.caption, selected = _a.selected, close = _a.close, channels = _a.channels, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, windowId = _a.windowId;
|
|
1853
|
+
return React__default["default"].createElement("div", { className: "t42-react-tab" },
|
|
1854
|
+
channels.visible && React__default["default"].createElement(TabChannelSelector, __assign({}, channels)),
|
|
1855
|
+
captionEditor.show ?
|
|
1856
|
+
React__default["default"].createElement(TabCaptionEditor, __assign({}, captionEditor, { caption: captionEditor.text, selected: selected, windowId: windowId })) :
|
|
1857
|
+
React__default["default"].createElement(TabCaption, { notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption, selected: selected }),
|
|
1858
|
+
React__default["default"].createElement(TabCloseButton, { selected: selected, close: close }));
|
|
1859
|
+
};
|
|
1860
|
+
|
|
1861
|
+
var TabHeaderButtons = function (_a) {
|
|
1862
|
+
var extract = _a.extract, minimize = _a.minimize, maximize = _a.maximize, restore = _a.restore, close = _a.close, lock = _a.lock, unlock = _a.unlock, feedback = _a.feedback, sticky = _a.sticky, customButtons = _a.customButtons;
|
|
1863
|
+
return React__default["default"].createElement("div", { className: "t42-buttons-container t42-tab-bar-element" },
|
|
1864
|
+
React__default["default"].createElement("ul", { className: "t42-buttons t42-tab-bar-element" }, customButtons.map(function (customButton) {
|
|
1865
|
+
return customButton.visible && React__default["default"].createElement(CustomButton, __assign({ key: customButton.buttonId }, customButton));
|
|
1866
|
+
})),
|
|
1867
|
+
React__default["default"].createElement("ul", { className: "t42-buttons t42-tab-bar-element" },
|
|
1868
|
+
(feedback === null || feedback === void 0 ? void 0 : feedback.visible) && React__default["default"].createElement(FeedbackButton, __assign({}, feedback)),
|
|
1869
|
+
(sticky === null || sticky === void 0 ? void 0 : sticky.visible) && React__default["default"].createElement(StickyButton, __assign({}, sticky)),
|
|
1870
|
+
(extract === null || extract === void 0 ? void 0 : extract.visible) && React__default["default"].createElement(ExtractButton, __assign({}, extract)),
|
|
1871
|
+
(lock === null || lock === void 0 ? void 0 : lock.visible) && React__default["default"].createElement(LockButton, __assign({}, lock)),
|
|
1872
|
+
(unlock === null || unlock === void 0 ? void 0 : unlock.visible) && React__default["default"].createElement(UnlockButton, __assign({}, unlock)),
|
|
1873
|
+
(minimize === null || minimize === void 0 ? void 0 : minimize.visible) && React__default["default"].createElement(MinimizeButton, __assign({}, minimize)),
|
|
1874
|
+
(restore === null || restore === void 0 ? void 0 : restore.visible) && React__default["default"].createElement(RestoreButton, __assign({}, restore)),
|
|
1875
|
+
(maximize === null || maximize === void 0 ? void 0 : maximize.visible) && React__default["default"].createElement(MaximizeButton, __assign({}, maximize)),
|
|
1876
|
+
(close === null || close === void 0 ? void 0 : close.visible) && React__default["default"].createElement(CloseButton, __assign({}, close))));
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1879
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
1880
|
+
return module = {
|
|
1881
|
+
path: basedir,
|
|
1882
|
+
exports: {},
|
|
1883
|
+
require: function (path, base) {
|
|
1884
|
+
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
1885
|
+
}
|
|
1886
|
+
}, fn(module, module.exports), module.exports;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
function commonjsRequire () {
|
|
1890
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=React__default["default"].useState,m=React__default["default"].useEffect,n=React__default["default"].useLayoutEffect,p=React__default["default"].useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c});},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c});})},[a]);p(d);return d}
|
|
1894
|
+
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k(a,d)}catch(f){return !0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;var useSyncExternalStore=void 0!==React__default["default"].useSyncExternalStore?React__default["default"].useSyncExternalStore:u;
|
|
1895
|
+
|
|
1896
|
+
var useSyncExternalStoreShim_production_min = {
|
|
1897
|
+
useSyncExternalStore: useSyncExternalStore
|
|
1898
|
+
};
|
|
1899
|
+
|
|
1900
|
+
var useSyncExternalStoreShim_development = createCommonjsModule(function (module, exports) {
|
|
1901
|
+
|
|
1902
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1903
|
+
(function() {
|
|
1904
|
+
|
|
1905
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
1906
|
+
if (
|
|
1907
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
1908
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
1909
|
+
'function'
|
|
1910
|
+
) {
|
|
1911
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1912
|
+
}
|
|
1913
|
+
var React = React__default["default"];
|
|
1914
|
+
|
|
1915
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1916
|
+
|
|
1917
|
+
function error(format) {
|
|
1918
|
+
{
|
|
1919
|
+
{
|
|
1920
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1921
|
+
args[_key2 - 1] = arguments[_key2];
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
printWarning('error', format, args);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
function printWarning(level, format, args) {
|
|
1930
|
+
// When changing this logic, you might want to also
|
|
1931
|
+
// update consoleWithStackDev.www.js as well.
|
|
1932
|
+
{
|
|
1933
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1934
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1935
|
+
|
|
1936
|
+
if (stack !== '') {
|
|
1937
|
+
format += '%s';
|
|
1938
|
+
args = args.concat([stack]);
|
|
1939
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
1940
|
+
|
|
1941
|
+
|
|
1942
|
+
var argsWithFormat = args.map(function (item) {
|
|
1943
|
+
return String(item);
|
|
1944
|
+
}); // Careful: RN currently depends on this prefix
|
|
1945
|
+
|
|
1946
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
1947
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
1948
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
1949
|
+
|
|
1950
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
1956
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
1957
|
+
*/
|
|
1958
|
+
function is(x, y) {
|
|
1959
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
1960
|
+
;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
1964
|
+
|
|
1965
|
+
// dispatch for CommonJS interop named imports.
|
|
1966
|
+
|
|
1967
|
+
var useState = React.useState,
|
|
1968
|
+
useEffect = React.useEffect,
|
|
1969
|
+
useLayoutEffect = React.useLayoutEffect,
|
|
1970
|
+
useDebugValue = React.useDebugValue;
|
|
1971
|
+
var didWarnOld18Alpha = false;
|
|
1972
|
+
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
|
|
1973
|
+
// because of a very particular set of implementation details and assumptions
|
|
1974
|
+
// -- change any one of them and it will break. The most important assumption
|
|
1975
|
+
// is that updates are always synchronous, because concurrent rendering is
|
|
1976
|
+
// only available in versions of React that also have a built-in
|
|
1977
|
+
// useSyncExternalStore API. And we only use this shim when the built-in API
|
|
1978
|
+
// does not exist.
|
|
1979
|
+
//
|
|
1980
|
+
// Do not assume that the clever hacks used by this hook also work in general.
|
|
1981
|
+
// The point of this shim is to replace the need for hacks by other libraries.
|
|
1982
|
+
|
|
1983
|
+
function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
1984
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
1985
|
+
// will need to track that themselves and return the correct value
|
|
1986
|
+
// from `getSnapshot`.
|
|
1987
|
+
getServerSnapshot) {
|
|
1988
|
+
{
|
|
1989
|
+
if (!didWarnOld18Alpha) {
|
|
1990
|
+
if (React.startTransition !== undefined) {
|
|
1991
|
+
didWarnOld18Alpha = true;
|
|
1992
|
+
|
|
1993
|
+
error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
} // Read the current snapshot from the store on every render. Again, this
|
|
1997
|
+
// breaks the rules of React, and only works here because of specific
|
|
1998
|
+
// implementation details, most importantly that updates are
|
|
1999
|
+
// always synchronous.
|
|
2000
|
+
|
|
2001
|
+
|
|
2002
|
+
var value = getSnapshot();
|
|
2003
|
+
|
|
2004
|
+
{
|
|
2005
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
2006
|
+
var cachedValue = getSnapshot();
|
|
2007
|
+
|
|
2008
|
+
if (!objectIs(value, cachedValue)) {
|
|
2009
|
+
error('The result of getSnapshot should be cached to avoid an infinite loop');
|
|
2010
|
+
|
|
2011
|
+
didWarnUncachedGetSnapshot = true;
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
} // Because updates are synchronous, we don't queue them. Instead we force a
|
|
2015
|
+
// re-render whenever the subscribed state changes by updating an some
|
|
2016
|
+
// arbitrary useState hook. Then, during render, we call getSnapshot to read
|
|
2017
|
+
// the current value.
|
|
2018
|
+
//
|
|
2019
|
+
// Because we don't actually use the state returned by the useState hook, we
|
|
2020
|
+
// can save a bit of memory by storing other stuff in that slot.
|
|
2021
|
+
//
|
|
2022
|
+
// To implement the early bailout, we need to track some things on a mutable
|
|
2023
|
+
// object. Usually, we would put that in a useRef hook, but we can stash it in
|
|
2024
|
+
// our useState hook instead.
|
|
2025
|
+
//
|
|
2026
|
+
// To force a re-render, we call forceUpdate({inst}). That works because the
|
|
2027
|
+
// new object always fails an equality check.
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
var _useState = useState({
|
|
2031
|
+
inst: {
|
|
2032
|
+
value: value,
|
|
2033
|
+
getSnapshot: getSnapshot
|
|
2034
|
+
}
|
|
2035
|
+
}),
|
|
2036
|
+
inst = _useState[0].inst,
|
|
2037
|
+
forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
|
|
2038
|
+
// in the layout phase so we can access it during the tearing check that
|
|
2039
|
+
// happens on subscribe.
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
useLayoutEffect(function () {
|
|
2043
|
+
inst.value = value;
|
|
2044
|
+
inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
|
|
2045
|
+
// commit phase if there was an interleaved mutation. In concurrent mode
|
|
2046
|
+
// this can happen all the time, but even in synchronous mode, an earlier
|
|
2047
|
+
// effect may have mutated the store.
|
|
2048
|
+
|
|
2049
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
2050
|
+
// Force a re-render.
|
|
2051
|
+
forceUpdate({
|
|
2052
|
+
inst: inst
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
}, [subscribe, value, getSnapshot]);
|
|
2056
|
+
useEffect(function () {
|
|
2057
|
+
// Check for changes right before subscribing. Subsequent changes will be
|
|
2058
|
+
// detected in the subscription handler.
|
|
2059
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
2060
|
+
// Force a re-render.
|
|
2061
|
+
forceUpdate({
|
|
2062
|
+
inst: inst
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
var handleStoreChange = function () {
|
|
2067
|
+
// TODO: Because there is no cross-renderer API for batching updates, it's
|
|
2068
|
+
// up to the consumer of this library to wrap their subscription event
|
|
2069
|
+
// with unstable_batchedUpdates. Should we try to detect when this isn't
|
|
2070
|
+
// the case and print a warning in development?
|
|
2071
|
+
// The store changed. Check if the snapshot changed since the last time we
|
|
2072
|
+
// read from the store.
|
|
2073
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
2074
|
+
// Force a re-render.
|
|
2075
|
+
forceUpdate({
|
|
2076
|
+
inst: inst
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
}; // Subscribe to the store and return a clean-up function.
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
return subscribe(handleStoreChange);
|
|
2083
|
+
}, [subscribe]);
|
|
2084
|
+
useDebugValue(value);
|
|
2085
|
+
return value;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
function checkIfSnapshotChanged(inst) {
|
|
2089
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
2090
|
+
var prevValue = inst.value;
|
|
2091
|
+
|
|
2092
|
+
try {
|
|
2093
|
+
var nextValue = latestGetSnapshot();
|
|
2094
|
+
return !objectIs(prevValue, nextValue);
|
|
2095
|
+
} catch (error) {
|
|
2096
|
+
return true;
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
2101
|
+
// Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
2102
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
2103
|
+
// will need to track that themselves and return the correct value
|
|
2104
|
+
// from `getSnapshot`.
|
|
2105
|
+
return getSnapshot();
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
2109
|
+
|
|
2110
|
+
var isServerEnvironment = !canUseDOM;
|
|
2111
|
+
|
|
2112
|
+
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
2113
|
+
var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
|
|
2114
|
+
|
|
2115
|
+
exports.useSyncExternalStore = useSyncExternalStore$2;
|
|
2116
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
2117
|
+
if (
|
|
2118
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
2119
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
2120
|
+
'function'
|
|
2121
|
+
) {
|
|
2122
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
})();
|
|
2126
|
+
}
|
|
2127
|
+
});
|
|
2128
|
+
|
|
2129
|
+
var shim = createCommonjsModule(function (module) {
|
|
2130
|
+
|
|
2131
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2132
|
+
module.exports = useSyncExternalStoreShim_production_min;
|
|
2133
|
+
} else {
|
|
2134
|
+
module.exports = useSyncExternalStoreShim_development;
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
|
|
2138
|
+
var GroupWrapper = /** @class */ (function (_super) {
|
|
2139
|
+
__extends(GroupWrapper, _super);
|
|
2140
|
+
function GroupWrapper() {
|
|
2141
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2142
|
+
}
|
|
2143
|
+
GroupWrapper.prototype.componentDidMount = function () {
|
|
2144
|
+
var componentFactory = {
|
|
2145
|
+
createGroupCaptionBar: this.props.onCreateGroupCaptionBarRequested,
|
|
2146
|
+
updateGroupCaptionBar: this.props.onUpdateGroupCaptionBarRequested,
|
|
2147
|
+
createGroupOverlay: this.props.onCreateGroupOverlayRequested,
|
|
2148
|
+
createFrameCaptionBar: this.props.onCreateFrameCaptionBarRequested,
|
|
2149
|
+
updateFrameCaptionBar: this.props.onUpdateFrameCaptionBarRequested,
|
|
2150
|
+
createFrameWindowOverlay: this.props.onCreateFrameWindowOverlayRequested,
|
|
2151
|
+
updateFrameWindowOverlay: this.props.onUpdateFrameWindowOverlayRequested,
|
|
2152
|
+
createAboveWindow: this.props.onCreateAboveWindowRequested,
|
|
2153
|
+
destroyAboveWindow: this.props.onRemoveAboveWindowRequested,
|
|
2154
|
+
createWindowContentOverlay: this.props.onCreateWindowContentOverlayRequested,
|
|
2155
|
+
destroyWindowContentOverlay: this.props.onRemoveWindowContentOverlayRequested,
|
|
2156
|
+
createFrameLoadingAnimation: this.props.onCreateFrameLoadingAnimationRequested,
|
|
2157
|
+
destroyFrameLoadingAnimation: this.props.onRemoveFrameLoadingAnimationRequested,
|
|
2158
|
+
createBelowWindow: this.props.onCreateBelowWindowRequested,
|
|
2159
|
+
destroyBelowWindow: this.props.onRemoveBelowWindowRequested,
|
|
2160
|
+
createAboveTabs: this.props.onCreateAboveTabsRequested,
|
|
2161
|
+
updateAboveTabs: this.props.onUpdateAboveTabsRequested,
|
|
2162
|
+
createBeforeTabs: this.props.onCreateBeforeTabsComponentRequested,
|
|
2163
|
+
updateBeforeTabs: this.props.onUpdateBeforeTabsComponentRequested,
|
|
2164
|
+
createTab: this.props.onCreateTabRequested,
|
|
2165
|
+
updateTab: this.props.onUpdateTabRequested,
|
|
2166
|
+
createAfterTabs: this.props.onCreateAfterTabsComponentRequested,
|
|
2167
|
+
updateAfterTabs: this.props.onUpdateAfterTabsComponentRequested,
|
|
2168
|
+
createTabBarButtonsContainerElement: this.props.onCreateTabHeaderButtonsRequested,
|
|
2169
|
+
createBelowTabs: this.props.onCreateBelowTabsRequested,
|
|
2170
|
+
updateBelowTabs: this.props.onUpdateBelowTabsRequested,
|
|
2171
|
+
updateFrame: this.props.onUpdateFrameRequested,
|
|
2172
|
+
updateStandardButton: this.props.onUpdateStandardButtonRequested,
|
|
2173
|
+
updateCustomButtons: this.props.onUpdateCustomButtonsRequested,
|
|
2174
|
+
destroyFrameCaptionBar: this.props.onRemoveFrameCaptionBarRequested,
|
|
2175
|
+
destroyFrameWindowOverlay: this.props.onRemoveFrameWindowOverlayRequested,
|
|
2176
|
+
destroyAboveTabs: this.props.onRemoveAboveTabsRequested,
|
|
2177
|
+
destroyBeforeTabs: this.props.onRemoveBeforeTabsComponentRequested,
|
|
2178
|
+
destroyTab: this.props.onRemoveTabRequested,
|
|
2179
|
+
destroyAfterTabs: this.props.onRemoveAfterTabsComponentRequested,
|
|
2180
|
+
destroyTabBarButtonsContainerElement: this.props.onRemoveTabHeaderButtonsRequested,
|
|
2181
|
+
destroyBelowTabs: this.props.onRemoveBelowTabsRequested,
|
|
2182
|
+
showCaptionEditor: this.props.onShowCaptionEditorRequested,
|
|
2183
|
+
commitCaptionEditing: this.props.onCommitCaptionEditingRequested,
|
|
2184
|
+
hideCaptionEditor: this.props.onHideCaptionEditorRequested,
|
|
2185
|
+
showLoadingAnimation: this.props.onShowLoadingAnimationRequested,
|
|
2186
|
+
hideLoadingAnimation: this.props.onHideLoadingAnimationRequested,
|
|
2187
|
+
};
|
|
2188
|
+
webGroupsManager.init(undefined, componentFactory);
|
|
2189
|
+
};
|
|
2190
|
+
GroupWrapper.prototype.componentWillUnmount = function () {
|
|
2191
|
+
// TODO
|
|
2192
|
+
};
|
|
2193
|
+
GroupWrapper.prototype.render = function () {
|
|
2194
|
+
var _this = this;
|
|
2195
|
+
return (React__default["default"].createElement("div", { id: "t42-group-container", ref: function (r) { return _this.containerRef = r; } },
|
|
2196
|
+
React__default["default"].createElement("div", { id: "t42-frames-container" })));
|
|
2197
|
+
};
|
|
2198
|
+
return GroupWrapper;
|
|
2199
|
+
}(React__default["default"].Component));
|
|
2200
|
+
|
|
2201
|
+
var Portal = /** @class */ (function (_super) {
|
|
2202
|
+
__extends(Portal, _super);
|
|
2203
|
+
function Portal() {
|
|
2204
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2205
|
+
}
|
|
2206
|
+
Portal.prototype.render = function () {
|
|
2207
|
+
return ReactDOM__default["default"].createPortal(this.props.children, this.props.parentElement);
|
|
2208
|
+
};
|
|
2209
|
+
return Portal;
|
|
2210
|
+
}(React__default["default"].Component));
|
|
2211
|
+
|
|
2212
|
+
var WebGroupsStore = /** @class */ (function () {
|
|
2213
|
+
function WebGroupsStore() {
|
|
2214
|
+
var _this = this;
|
|
2215
|
+
this.listeners = new Set();
|
|
2216
|
+
this.state = {
|
|
2217
|
+
groupCaptionBar: undefined,
|
|
2218
|
+
groupOverlay: undefined,
|
|
2219
|
+
frameCaptionBars: {},
|
|
2220
|
+
frameWindowOverlays: {},
|
|
2221
|
+
aboveWindowZones: {},
|
|
2222
|
+
windowContentOverlays: {},
|
|
2223
|
+
belowWindowZones: {},
|
|
2224
|
+
aboveTabsZones: {},
|
|
2225
|
+
beforeTabsZones: {},
|
|
2226
|
+
tabElements: {},
|
|
2227
|
+
afterTabsZones: {},
|
|
2228
|
+
tabHeaderButtons: {},
|
|
2229
|
+
belowTabsZones: {},
|
|
2230
|
+
frameLoadingAnimations: {},
|
|
2231
|
+
};
|
|
2232
|
+
this.subscribe = function (cb) {
|
|
2233
|
+
_this.listeners.add(cb);
|
|
2234
|
+
return function () {
|
|
2235
|
+
_this.listeners["delete"](cb);
|
|
2236
|
+
};
|
|
2237
|
+
};
|
|
2238
|
+
this.getSnapshot = function () {
|
|
2239
|
+
return _this.state;
|
|
2240
|
+
};
|
|
2241
|
+
this.onCreateGroupCaptionBarRequested = function (options) {
|
|
2242
|
+
if (options === _this.state.groupCaptionBar) {
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
_this.setState(function (s) {
|
|
2246
|
+
return __assign(__assign({}, s), { groupCaptionBar: options });
|
|
2247
|
+
});
|
|
2248
|
+
};
|
|
2249
|
+
this.onCreateGroupOverlayRequested = function (options) {
|
|
2250
|
+
if (options === _this.state.groupOverlay) {
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
_this.setState(function (s) {
|
|
2254
|
+
return __assign(__assign({}, s), { groupOverlay: options });
|
|
2255
|
+
});
|
|
2256
|
+
};
|
|
2257
|
+
this.onCreateFrameCaptionBarRequested = function (options) {
|
|
2258
|
+
if (options === _this.state.frameCaptionBars[options.targetId] || !options) {
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
_this.setState(function (s) {
|
|
2262
|
+
var _a;
|
|
2263
|
+
return __assign(__assign({}, s), { frameCaptionBars: __assign(__assign({}, s.frameCaptionBars), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2264
|
+
});
|
|
2265
|
+
};
|
|
2266
|
+
this.onCreateFrameWindowOverlayRequested = function (options) {
|
|
2267
|
+
if (options === _this.state.frameWindowOverlays[options.targetId] || !options) {
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
_this.setState(function (s) {
|
|
2271
|
+
var _a;
|
|
2272
|
+
return __assign(__assign({}, s), { frameWindowOverlays: __assign(__assign({}, s.frameWindowOverlays), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2273
|
+
});
|
|
2274
|
+
};
|
|
2275
|
+
this.onCreateAboveWindowRequested = function (options) {
|
|
2276
|
+
if (options === _this.state.aboveWindowZones[options.targetId] || !options) {
|
|
2277
|
+
return;
|
|
2278
|
+
}
|
|
2279
|
+
_this.setState(function (s) {
|
|
2280
|
+
var _a;
|
|
2281
|
+
return __assign(__assign({}, s), { aboveWindowZones: __assign(__assign({}, s.aboveWindowZones), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2282
|
+
});
|
|
2283
|
+
};
|
|
2284
|
+
this.onCreateWindowContentOverlayRequested = function (options) {
|
|
2285
|
+
if (options === _this.state.windowContentOverlays[options.targetId] || !options) {
|
|
2286
|
+
return;
|
|
2287
|
+
}
|
|
2288
|
+
_this.setState(function (s) {
|
|
2289
|
+
var _a;
|
|
2290
|
+
return __assign(__assign({}, s), { windowContentOverlays: __assign(__assign({}, s.windowContentOverlays), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2291
|
+
});
|
|
2292
|
+
};
|
|
2293
|
+
this.onCreateFrameLoadingAnimationRequested = function (options) {
|
|
2294
|
+
if (options === _this.state.frameLoadingAnimations[options.targetId] || !options) {
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
_this.setState(function (s) {
|
|
2298
|
+
var _a;
|
|
2299
|
+
return __assign(__assign({}, s), { frameLoadingAnimations: __assign(__assign({}, s.frameLoadingAnimations), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2300
|
+
});
|
|
2301
|
+
};
|
|
2302
|
+
this.onCreateBelowWindowRequested = function (options) {
|
|
2303
|
+
if (options === _this.state.belowWindowZones[options.targetId] || !options) {
|
|
2304
|
+
return;
|
|
2305
|
+
}
|
|
2306
|
+
_this.setState(function (s) {
|
|
2307
|
+
var _a;
|
|
2308
|
+
return __assign(__assign({}, s), { belowWindowZones: __assign(__assign({}, s.belowWindowZones), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2309
|
+
});
|
|
2310
|
+
};
|
|
2311
|
+
this.onCreateAboveTabsComponentRequested = function (options) {
|
|
2312
|
+
if (options === _this.state.aboveTabsZones[options.targetId] || !options) {
|
|
2313
|
+
return;
|
|
2314
|
+
}
|
|
2315
|
+
_this.setState(function (s) {
|
|
2316
|
+
var _a;
|
|
2317
|
+
return __assign(__assign({}, s), { aboveTabsZones: __assign(__assign({}, s.aboveTabsZones), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2318
|
+
});
|
|
2319
|
+
};
|
|
2320
|
+
this.onCreateBeforeTabsComponentRequested = function (options) {
|
|
2321
|
+
if (options === _this.state.beforeTabsZones[options.targetId] || !options) {
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2324
|
+
_this.setState(function (s) {
|
|
2325
|
+
var _a;
|
|
2326
|
+
return __assign(__assign({}, s), { beforeTabsZones: __assign(__assign({}, s.beforeTabsZones), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2327
|
+
});
|
|
2328
|
+
};
|
|
2329
|
+
this.onCreateTabElementRequested = function (options) {
|
|
2330
|
+
if (options === _this.state.tabElements[options.targetId] || !options) {
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
_this.setState(function (s) {
|
|
2334
|
+
var _a;
|
|
2335
|
+
var newTabElementsObj = Object.keys(s.tabElements).reduce(function (acc, targetId) {
|
|
2336
|
+
acc[targetId] = s.tabElements[targetId];
|
|
2337
|
+
return acc;
|
|
2338
|
+
}, {});
|
|
2339
|
+
newTabElementsObj[options.targetId] = options;
|
|
2340
|
+
return __assign(__assign({}, s), { tabElements: __assign(__assign({}, s.tabElements), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2341
|
+
});
|
|
2342
|
+
};
|
|
2343
|
+
this.onCreateAfterTabsComponentRequested = function (options) {
|
|
2344
|
+
if (options === _this.state.afterTabsZones[options.targetId] || !options) {
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2347
|
+
_this.setState(function (s) {
|
|
2348
|
+
var _a;
|
|
2349
|
+
return __assign(__assign({}, s), { afterTabsZones: __assign(__assign({}, s.afterTabsZones), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2350
|
+
});
|
|
2351
|
+
};
|
|
2352
|
+
this.onCreateTabHeaderButtonsRequested = function (options) {
|
|
2353
|
+
if (options === _this.state.tabHeaderButtons[options.targetId] || !options) {
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
_this.setState(function (s) {
|
|
2357
|
+
var _a;
|
|
2358
|
+
return __assign(__assign({}, s), { tabHeaderButtons: __assign(__assign({}, s.tabHeaderButtons), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2359
|
+
});
|
|
2360
|
+
};
|
|
2361
|
+
this.onCreateBelowTabsComponentRequested = function (options) {
|
|
2362
|
+
if (options === _this.state.belowTabsZones[options.targetId] || !options) {
|
|
2363
|
+
return;
|
|
2364
|
+
}
|
|
2365
|
+
_this.setState(function (s) {
|
|
2366
|
+
var _a;
|
|
2367
|
+
return __assign(__assign({}, s), { belowTabsZones: __assign(__assign({}, s.belowTabsZones), (_a = {}, _a[options.targetId] = options, _a)) });
|
|
2368
|
+
});
|
|
2369
|
+
};
|
|
2370
|
+
this.onUpdateGroupCaptionBarRequested = function (options) {
|
|
2371
|
+
if (options === _this.state.groupCaptionBar) {
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
_this.setState(function (s) {
|
|
2375
|
+
return __assign(__assign({}, s), { groupCaptionBar: Object.assign({}, s.groupCaptionBar, options) });
|
|
2376
|
+
});
|
|
2377
|
+
};
|
|
2378
|
+
this.onUpdateFrameCaptionBarRequested = function (options) {
|
|
2379
|
+
if (options === _this.state.frameCaptionBars[options.targetId] || !options) {
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
_this.setState(function (s) {
|
|
2383
|
+
var _a;
|
|
2384
|
+
return __assign(__assign({}, s), { frameCaptionBars: __assign(__assign({}, s.frameCaptionBars), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.frameCaptionBars[options.targetId]), options), _a)) });
|
|
2385
|
+
});
|
|
2386
|
+
};
|
|
2387
|
+
this.onUpdateFrameWindowOverlayRequested = function (options) {
|
|
2388
|
+
if (options === _this.state.frameWindowOverlays[options.targetId] || !options) {
|
|
2389
|
+
return;
|
|
2390
|
+
}
|
|
2391
|
+
_this.setState(function (s) {
|
|
2392
|
+
var _a;
|
|
2393
|
+
return __assign(__assign({}, s), { frameWindowOverlays: __assign(__assign({}, s.frameWindowOverlays), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.frameWindowOverlays[options.targetId]), options), _a)) });
|
|
2394
|
+
});
|
|
2395
|
+
};
|
|
2396
|
+
this.onUpdateAboveTabsRequested = function (options) {
|
|
2397
|
+
if (options === _this.state.aboveTabsZones[options.targetId] || !options) {
|
|
2398
|
+
return;
|
|
2399
|
+
}
|
|
2400
|
+
_this.setState(function (s) {
|
|
2401
|
+
var _a;
|
|
2402
|
+
return __assign(__assign({}, s), { aboveTabsZones: __assign(__assign({}, s.aboveTabsZones), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.aboveTabsZones[options.targetId]), options), _a)) });
|
|
2403
|
+
});
|
|
2404
|
+
};
|
|
2405
|
+
this.onUpdateBeforeTabsRequested = function (options) {
|
|
2406
|
+
if (options === _this.state.beforeTabsZones[options.targetId] || !options) {
|
|
2407
|
+
return;
|
|
2408
|
+
}
|
|
2409
|
+
_this.setState(function (s) {
|
|
2410
|
+
var _a;
|
|
2411
|
+
return __assign(__assign({}, s), { beforeTabsZones: __assign(__assign({}, s.beforeTabsZones), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.beforeTabsZones[options.targetId]), options), _a)) });
|
|
2412
|
+
});
|
|
2413
|
+
};
|
|
2414
|
+
this.onUpdateTabElementRequested = function (options) {
|
|
2415
|
+
if (options === _this.state.tabElements[options.targetId] || !options) {
|
|
2416
|
+
return;
|
|
2417
|
+
}
|
|
2418
|
+
_this.setState(function (s) {
|
|
2419
|
+
var _a;
|
|
2420
|
+
return __assign(__assign({}, s), { tabElements: __assign(__assign({}, s.tabElements), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.tabElements[options.targetId]), options), _a)) });
|
|
2421
|
+
});
|
|
2422
|
+
};
|
|
2423
|
+
this.onUpdateAfterTabsRequested = function (options) {
|
|
2424
|
+
if (options === _this.state.afterTabsZones[options.targetId] || !options) {
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
_this.setState(function (s) {
|
|
2428
|
+
var _a;
|
|
2429
|
+
return __assign(__assign({}, s), { afterTabsZones: __assign(__assign({}, s.afterTabsZones), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.afterTabsZones[options.targetId]), options), _a)) });
|
|
2430
|
+
});
|
|
2431
|
+
};
|
|
2432
|
+
this.onUpdateTabHeaderButtonsRequested = function (options) {
|
|
2433
|
+
if (options === _this.state.tabHeaderButtons[options.targetId] || !options) {
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
_this.setState(function (s) {
|
|
2437
|
+
var _a;
|
|
2438
|
+
return __assign(__assign({}, s), { tabHeaderButtons: __assign(__assign({}, s.tabHeaderButtons), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.tabHeaderButtons[options.targetId]), options), _a)) });
|
|
2439
|
+
});
|
|
2440
|
+
};
|
|
2441
|
+
this.onUpdateBelowTabsRequested = function (options) {
|
|
2442
|
+
if (options === _this.state.belowTabsZones[options.targetId] || !options) {
|
|
2443
|
+
return;
|
|
2444
|
+
}
|
|
2445
|
+
_this.setState(function (s) {
|
|
2446
|
+
var _a;
|
|
2447
|
+
return __assign(__assign({}, s), { belowTabsZones: __assign(__assign({}, s.belowTabsZones), (_a = {}, _a[options.targetId] = __assign(__assign({}, s.belowTabsZones[options.targetId]), options), _a)) });
|
|
2448
|
+
});
|
|
2449
|
+
};
|
|
2450
|
+
this.onUpdateFrame = function (options) {
|
|
2451
|
+
_this.setState(function (s) {
|
|
2452
|
+
var newState = __assign({}, s);
|
|
2453
|
+
var updateSelectionWindow = function (stateProp, targetId, selectedWindow) {
|
|
2454
|
+
var _a;
|
|
2455
|
+
var _b;
|
|
2456
|
+
if (stateProp === "groupOverlay" || stateProp === "groupCaptionBar" || stateProp === "tabElements") {
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
if (s[stateProp][targetId] && ((_b = s[stateProp][targetId]) === null || _b === void 0 ? void 0 : _b.selectedWindow) !== selectedWindow) {
|
|
2460
|
+
newState[stateProp] = __assign(__assign({}, s[stateProp]), (_a = {}, _a[targetId] = __assign(__assign({}, s[stateProp][targetId]), { selectedWindow: selectedWindow }), _a));
|
|
2461
|
+
}
|
|
2462
|
+
};
|
|
2463
|
+
updateSelectionWindow("frameCaptionBars", options.targetId, options.selectedWindow);
|
|
2464
|
+
updateSelectionWindow("frameWindowOverlays", options.targetId, options.selectedWindow);
|
|
2465
|
+
updateSelectionWindow("windowContentOverlays", options.targetId, options.selectedWindow);
|
|
2466
|
+
updateSelectionWindow("aboveWindowZones", options.targetId, options.selectedWindow);
|
|
2467
|
+
updateSelectionWindow("belowWindowZones", options.targetId, options.selectedWindow);
|
|
2468
|
+
updateSelectionWindow("aboveTabsZones", options.targetId, options.selectedWindow);
|
|
2469
|
+
updateSelectionWindow("beforeTabsZones", options.targetId, options.selectedWindow);
|
|
2470
|
+
updateSelectionWindow("afterTabsZones", options.targetId, options.selectedWindow);
|
|
2471
|
+
updateSelectionWindow("tabHeaderButtons", options.targetId, options.selectedWindow);
|
|
2472
|
+
updateSelectionWindow("belowTabsZones", options.targetId, options.selectedWindow);
|
|
2473
|
+
updateSelectionWindow("frameLoadingAnimations", options.targetId, options.selectedWindow);
|
|
2474
|
+
return newState;
|
|
2475
|
+
});
|
|
2476
|
+
};
|
|
2477
|
+
this.onUpdateStandardButton = function (options) {
|
|
2478
|
+
var _a, _b, _c;
|
|
2479
|
+
var isCaptionBar = options.targetType === TargetType.Group; //this.state.groupCaptionBar?.targetId === options.targetId;
|
|
2480
|
+
var isFrame = options.targetType === TargetType.Frame;
|
|
2481
|
+
var isTabHeaderButtons = options.targetType === TargetType.TabBar;
|
|
2482
|
+
if (isCaptionBar) {
|
|
2483
|
+
var currentState = _this.state.groupCaptionBar || { targetId: options.targetId };
|
|
2484
|
+
var newOptions = __assign(__assign({}, currentState), (_a = {}, _a[options.buttonId] = __assign({}, options), _a));
|
|
2485
|
+
_this.onUpdateGroupCaptionBarRequested(newOptions);
|
|
2486
|
+
}
|
|
2487
|
+
else if (isFrame && options.targetType === TargetType.Frame) {
|
|
2488
|
+
var currentState = _this.state.frameCaptionBars[options.targetId] || { targetId: options.targetId };
|
|
2489
|
+
var newOptions = __assign(__assign({}, currentState), (_b = {}, _b[options.buttonId] = __assign({}, options), _b));
|
|
2490
|
+
_this.onUpdateFrameCaptionBarRequested(newOptions);
|
|
2491
|
+
}
|
|
2492
|
+
else if (isTabHeaderButtons && options.targetType === TargetType.TabBar) {
|
|
2493
|
+
var currentState = _this.state.tabHeaderButtons[options.targetId] || { targetId: options.targetId };
|
|
2494
|
+
var newOptions = __assign(__assign({}, currentState), (_c = {}, _c[options.buttonId] = __assign({}, options), _c));
|
|
2495
|
+
_this.onUpdateTabHeaderButtonsRequested(newOptions);
|
|
2496
|
+
}
|
|
2497
|
+
};
|
|
2498
|
+
this.onUpdateCustomButtons = function (options) {
|
|
2499
|
+
var isFrame = options.targetType === TargetType.Frame;
|
|
2500
|
+
var isTabHeaderButtons = options.targetType === TargetType.TabBar;
|
|
2501
|
+
if (isFrame && options.targetType === TargetType.Frame) {
|
|
2502
|
+
var currentState = _this.state.frameCaptionBars[options.targetId] || { targetId: options.targetId };
|
|
2503
|
+
var newOptions = __assign(__assign({}, currentState), options);
|
|
2504
|
+
_this.onUpdateFrameCaptionBarRequested(newOptions);
|
|
2505
|
+
}
|
|
2506
|
+
else if (isTabHeaderButtons && options.targetType === TargetType.TabBar) {
|
|
2507
|
+
var currentState = _this.state.tabHeaderButtons.customButtons || { customButtons: options.customButtons };
|
|
2508
|
+
var newOptions = __assign(__assign({}, currentState), options);
|
|
2509
|
+
_this.onUpdateTabHeaderButtonsRequested(newOptions);
|
|
2510
|
+
}
|
|
2511
|
+
};
|
|
2512
|
+
this.onRemoveFrameCaptionBarRequested = function (options) {
|
|
2513
|
+
if (!_this.state.frameCaptionBars[options.targetId]) {
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
_this.setState(function (s) {
|
|
2517
|
+
var newCaptionBarsObj = Object.keys(s.frameCaptionBars).reduce(function (acc, targetId) {
|
|
2518
|
+
if (targetId !== options.targetId) {
|
|
2519
|
+
acc[targetId] = s.frameCaptionBars[targetId];
|
|
2520
|
+
}
|
|
2521
|
+
return acc;
|
|
2522
|
+
}, {});
|
|
2523
|
+
return __assign(__assign({}, s), { frameCaptionBars: newCaptionBarsObj });
|
|
2524
|
+
});
|
|
2525
|
+
};
|
|
2526
|
+
this.onRemoveFrameWindowOverlayRequested = function (options) {
|
|
2527
|
+
if (!_this.state.frameWindowOverlays[options.targetId]) {
|
|
2528
|
+
return;
|
|
2529
|
+
}
|
|
2530
|
+
_this.setState(function (s) {
|
|
2531
|
+
var newCaptionBarsObj = Object.keys(s.frameWindowOverlays).reduce(function (acc, targetId) {
|
|
2532
|
+
if (targetId !== options.targetId) {
|
|
2533
|
+
acc[targetId] = s.frameWindowOverlays[targetId];
|
|
2534
|
+
}
|
|
2535
|
+
return acc;
|
|
2536
|
+
}, {});
|
|
2537
|
+
return __assign(__assign({}, s), { frameWindowOverlays: newCaptionBarsObj });
|
|
2538
|
+
});
|
|
2539
|
+
};
|
|
2540
|
+
this.onRemoveAboveWindowRequested = function (options) {
|
|
2541
|
+
if (!_this.state.aboveWindowZones[options.targetId]) {
|
|
2542
|
+
return;
|
|
2543
|
+
}
|
|
2544
|
+
_this.setState(function (s) {
|
|
2545
|
+
var newCaptionBarsObj = Object.keys(s.aboveWindowZones).reduce(function (acc, targetId) {
|
|
2546
|
+
if (targetId !== options.targetId) {
|
|
2547
|
+
acc[targetId] = s.aboveWindowZones[targetId];
|
|
2548
|
+
}
|
|
2549
|
+
return acc;
|
|
2550
|
+
}, {});
|
|
2551
|
+
return __assign(__assign({}, s), { aboveWindowZones: newCaptionBarsObj });
|
|
2552
|
+
});
|
|
2553
|
+
};
|
|
2554
|
+
this.onRemoveWindowContentOverlayRequested = function (options) {
|
|
2555
|
+
if (!_this.state.windowContentOverlays[options.targetId]) {
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
_this.setState(function (s) {
|
|
2559
|
+
var newOverlaysObj = Object.keys(s.windowContentOverlays).reduce(function (acc, targetId) {
|
|
2560
|
+
if (targetId !== options.targetId) {
|
|
2561
|
+
acc[targetId] = s.windowContentOverlays[targetId];
|
|
2562
|
+
}
|
|
2563
|
+
return acc;
|
|
2564
|
+
}, {});
|
|
2565
|
+
return __assign(__assign({}, s), { windowContentOverlays: newOverlaysObj });
|
|
2566
|
+
});
|
|
2567
|
+
};
|
|
2568
|
+
this.onRemoveFrameLoadingAnimationRequested = function (options) {
|
|
2569
|
+
if (!_this.state.frameLoadingAnimations[options.targetId]) {
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
_this.setState(function (s) {
|
|
2573
|
+
var newLoadingAnimationObj = Object.keys(s.frameLoadingAnimations).reduce(function (acc, targetId) {
|
|
2574
|
+
if (targetId !== options.targetId) {
|
|
2575
|
+
acc[targetId] = s.frameLoadingAnimations[targetId];
|
|
2576
|
+
}
|
|
2577
|
+
return acc;
|
|
2578
|
+
}, {});
|
|
2579
|
+
return __assign(__assign({}, s), { frameLoadingAnimation: newLoadingAnimationObj });
|
|
2580
|
+
});
|
|
2581
|
+
};
|
|
2582
|
+
this.onRemoveBelowWindowRequested = function (options) {
|
|
2583
|
+
if (!_this.state.belowWindowZones[options.targetId]) {
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2586
|
+
_this.setState(function (s) {
|
|
2587
|
+
var newCaptionBarsObj = Object.keys(s.belowWindowZones).reduce(function (acc, targetId) {
|
|
2588
|
+
if (targetId !== options.targetId) {
|
|
2589
|
+
acc[targetId] = s.belowWindowZones[targetId];
|
|
2590
|
+
}
|
|
2591
|
+
return acc;
|
|
2592
|
+
}, {});
|
|
2593
|
+
return __assign(__assign({}, s), { belowWindowZones: newCaptionBarsObj });
|
|
2594
|
+
});
|
|
2595
|
+
};
|
|
2596
|
+
this.onRemoveAboveTabsRequested = function (options) {
|
|
2597
|
+
if (!_this.state.aboveTabsZones[options.targetId]) {
|
|
2598
|
+
return;
|
|
2599
|
+
}
|
|
2600
|
+
_this.setState(function (s) {
|
|
2601
|
+
var newTabElementsObj = Object.keys(s.aboveTabsZones).reduce(function (acc, targetId) {
|
|
2602
|
+
if (targetId != options.targetId) {
|
|
2603
|
+
acc[targetId] = s.aboveTabsZones[targetId];
|
|
2604
|
+
}
|
|
2605
|
+
return acc;
|
|
2606
|
+
}, {});
|
|
2607
|
+
return __assign(__assign({}, s), { aboveTabsZones: newTabElementsObj });
|
|
2608
|
+
});
|
|
2609
|
+
};
|
|
2610
|
+
this.onRemoveBeforeTabsComponentRequested = function (options) {
|
|
2611
|
+
if (!_this.state.beforeTabsZones[options.targetId]) {
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
_this.setState(function (s) {
|
|
2615
|
+
var newTabElementsObj = Object.keys(s.beforeTabsZones).reduce(function (acc, targetId) {
|
|
2616
|
+
if (targetId != options.targetId) {
|
|
2617
|
+
acc[targetId] = s.beforeTabsZones[targetId];
|
|
2618
|
+
}
|
|
2619
|
+
return acc;
|
|
2620
|
+
}, {});
|
|
2621
|
+
return __assign(__assign({}, s), { beforeTabsZones: newTabElementsObj });
|
|
2622
|
+
});
|
|
2623
|
+
};
|
|
2624
|
+
this.onRemoveTabElementRequested = function (options) {
|
|
2625
|
+
if (!_this.state.tabElements[options.targetId]) {
|
|
2626
|
+
return;
|
|
2627
|
+
}
|
|
2628
|
+
_this.setState(function (s) {
|
|
2629
|
+
var newTabElementsObj = Object.keys(s.tabElements).reduce(function (acc, targetId) {
|
|
2630
|
+
if (targetId != options.targetId) {
|
|
2631
|
+
acc[targetId] = s.tabElements[targetId];
|
|
2632
|
+
}
|
|
2633
|
+
return acc;
|
|
2634
|
+
}, {});
|
|
2635
|
+
return __assign(__assign({}, s), { tabElements: newTabElementsObj });
|
|
2636
|
+
});
|
|
2637
|
+
};
|
|
2638
|
+
this.onRemoveAfterTabsComponentRequested = function (options) {
|
|
2639
|
+
if (!_this.state.afterTabsZones[options.targetId]) {
|
|
2640
|
+
return;
|
|
2641
|
+
}
|
|
2642
|
+
_this.setState(function (s) {
|
|
2643
|
+
var newTabElementsObj = Object.keys(s.afterTabsZones).reduce(function (acc, targetId) {
|
|
2644
|
+
if (targetId != options.targetId) {
|
|
2645
|
+
acc[targetId] = s.afterTabsZones[targetId];
|
|
2646
|
+
}
|
|
2647
|
+
return acc;
|
|
2648
|
+
}, {});
|
|
2649
|
+
return __assign(__assign({}, s), { afterTabsZones: newTabElementsObj });
|
|
2650
|
+
});
|
|
2651
|
+
};
|
|
2652
|
+
this.onRemoveTabHeaderButtonsRequested = function (options) {
|
|
2653
|
+
if (!_this.state.tabHeaderButtons[options.targetId]) {
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
_this.setState(function (s) {
|
|
2657
|
+
var newTabElementsObj = Object.keys(s.tabHeaderButtons).reduce(function (acc, targetId) {
|
|
2658
|
+
if (targetId != options.targetId) {
|
|
2659
|
+
acc[targetId] = s.tabHeaderButtons[targetId];
|
|
2660
|
+
}
|
|
2661
|
+
return acc;
|
|
2662
|
+
}, {});
|
|
2663
|
+
return __assign(__assign({}, s), { tabHeaderButtons: newTabElementsObj });
|
|
2664
|
+
});
|
|
2665
|
+
};
|
|
2666
|
+
this.onRemoveBelowTabsRequested = function (options) {
|
|
2667
|
+
if (!_this.state.belowTabsZones[options.targetId]) {
|
|
2668
|
+
return;
|
|
2669
|
+
}
|
|
2670
|
+
_this.setState(function (s) {
|
|
2671
|
+
var newTabElementsObj = Object.keys(s.belowTabsZones).reduce(function (acc, targetId) {
|
|
2672
|
+
if (targetId != options.targetId) {
|
|
2673
|
+
acc[targetId] = s.belowTabsZones[targetId];
|
|
2674
|
+
}
|
|
2675
|
+
return acc;
|
|
2676
|
+
}, {});
|
|
2677
|
+
return __assign(__assign({}, s), { belowTabsZones: newTabElementsObj });
|
|
2678
|
+
});
|
|
2679
|
+
};
|
|
2680
|
+
this.onShowCaptionEditorRequested = function (targetType, targetId, text) {
|
|
2681
|
+
if (targetType === TargetType.Group) {
|
|
2682
|
+
_this.onShowGroupCaptionEditorRequested(targetId, text);
|
|
2683
|
+
}
|
|
2684
|
+
else if (targetType === TargetType.Frame) {
|
|
2685
|
+
_this.onShowFlatCaptionEditorRequested(targetId, text);
|
|
2686
|
+
}
|
|
2687
|
+
else if (targetType === TargetType.Tab) {
|
|
2688
|
+
_this.onShowTabCaptionEditorRequested(targetId, text);
|
|
2689
|
+
}
|
|
2690
|
+
};
|
|
2691
|
+
this.onCommitCaptionEditingRequested = function (targetType, targetId) {
|
|
2692
|
+
webGroupsManager.requestCommitCaptionEditing(targetType, targetId);
|
|
2693
|
+
};
|
|
2694
|
+
this.onHideCaptionEditorRequested = function (targetType, targetId) {
|
|
2695
|
+
if (targetType === TargetType.Group) {
|
|
2696
|
+
_this.onHideGroupCaptionEditorRequested(targetId);
|
|
2697
|
+
}
|
|
2698
|
+
else if (targetType === TargetType.Frame) {
|
|
2699
|
+
_this.onHideFlatCaptionEditorRequested(targetId);
|
|
2700
|
+
}
|
|
2701
|
+
else if (targetType === TargetType.Tab) {
|
|
2702
|
+
_this.onHideTabCaptionEditorRequested(targetId);
|
|
2703
|
+
}
|
|
2704
|
+
};
|
|
2705
|
+
this.onShowLoadingAnimationRequested = function (targetType, targetId) {
|
|
2706
|
+
if (targetType === TargetType.Frame) {
|
|
2707
|
+
_this.onShowLoadingAnimation(targetId);
|
|
2708
|
+
}
|
|
2709
|
+
else {
|
|
2710
|
+
console.warn("Loading animation for elements other than Frame are not supported");
|
|
2711
|
+
}
|
|
2712
|
+
};
|
|
2713
|
+
this.onHideLoadingAnimationRequested = function (targetType, targetId) {
|
|
2714
|
+
if (targetType === TargetType.Frame) {
|
|
2715
|
+
_this.onHideLoadingAnimation(targetId);
|
|
2716
|
+
}
|
|
2717
|
+
else {
|
|
2718
|
+
console.warn("Loading animation for elements other than Frame are not supported");
|
|
2719
|
+
}
|
|
2720
|
+
};
|
|
2721
|
+
this.onShowGroupCaptionEditorRequested = function (_, text) {
|
|
2722
|
+
if (!_this.state.groupCaptionBar) {
|
|
2723
|
+
return;
|
|
2724
|
+
}
|
|
2725
|
+
_this.setState(function (s) {
|
|
2726
|
+
var _a;
|
|
2727
|
+
var captionEditor = ((_a = s.groupCaptionBar) === null || _a === void 0 ? void 0 : _a.captionEditor) || {};
|
|
2728
|
+
var newState = __assign(__assign({}, s), { groupCaptionBar: __assign(__assign({}, s.groupCaptionBar), { captionEditor: __assign(__assign({}, captionEditor), { show: true, text: text }) }) });
|
|
2729
|
+
return newState;
|
|
2730
|
+
});
|
|
2731
|
+
};
|
|
2732
|
+
this.onHideGroupCaptionEditorRequested = function (_) {
|
|
2733
|
+
if (!_this.state.groupCaptionBar) {
|
|
2734
|
+
return;
|
|
2735
|
+
}
|
|
2736
|
+
_this.setState(function (s) {
|
|
2737
|
+
var _a;
|
|
2738
|
+
var captionEditor = ((_a = s.groupCaptionBar) === null || _a === void 0 ? void 0 : _a.captionEditor) || {};
|
|
2739
|
+
var newState = __assign(__assign({}, s), { groupCaptionBar: __assign(__assign({}, s.groupCaptionBar), { captionEditor: __assign(__assign({}, captionEditor), { show: false }) }) });
|
|
2740
|
+
return newState;
|
|
2741
|
+
});
|
|
2742
|
+
};
|
|
2743
|
+
this.onShowFlatCaptionEditorRequested = function (targetId, text) {
|
|
2744
|
+
if (!_this.state.frameCaptionBars[targetId]) {
|
|
2745
|
+
return;
|
|
2746
|
+
}
|
|
2747
|
+
_this.setState(function (s) {
|
|
2748
|
+
var _a;
|
|
2749
|
+
var _b;
|
|
2750
|
+
var captionEditor = ((_b = s.frameCaptionBars[targetId]) === null || _b === void 0 ? void 0 : _b.captionEditor) || {};
|
|
2751
|
+
var newState = __assign(__assign({}, s), { frameCaptionBars: __assign(__assign({}, s.frameCaptionBars), (_a = {}, _a[targetId] = __assign(__assign({}, s.frameCaptionBars[targetId]), { captionEditor: __assign(__assign({}, captionEditor), { show: true, text: text }) }), _a)) });
|
|
2752
|
+
return newState;
|
|
2753
|
+
});
|
|
2754
|
+
};
|
|
2755
|
+
this.onHideFlatCaptionEditorRequested = function (targetId) {
|
|
2756
|
+
if (!_this.state.frameCaptionBars[targetId]) {
|
|
2757
|
+
return;
|
|
2758
|
+
}
|
|
2759
|
+
_this.setState(function (s) {
|
|
2760
|
+
var _a;
|
|
2761
|
+
var _b;
|
|
2762
|
+
var captionEditor = ((_b = s.frameCaptionBars[targetId]) === null || _b === void 0 ? void 0 : _b.captionEditor) || {};
|
|
2763
|
+
var newState = __assign(__assign({}, s), { frameCaptionBars: __assign(__assign({}, s.frameCaptionBars), (_a = {}, _a[targetId] = __assign(__assign({}, s.frameCaptionBars[targetId]), { captionEditor: __assign(__assign({}, captionEditor), { show: false }) }), _a)) });
|
|
2764
|
+
return newState;
|
|
2765
|
+
});
|
|
2766
|
+
};
|
|
2767
|
+
this.onShowTabCaptionEditorRequested = function (targetId, text) {
|
|
2768
|
+
if (!_this.state.tabElements[targetId]) {
|
|
2769
|
+
return;
|
|
2770
|
+
}
|
|
2771
|
+
_this.setState(function (s) {
|
|
2772
|
+
var _a;
|
|
2773
|
+
var _b;
|
|
2774
|
+
var captionEditor = ((_b = s.tabElements[targetId]) === null || _b === void 0 ? void 0 : _b.captionEditor) || {};
|
|
2775
|
+
var newState = __assign(__assign({}, s), { tabElements: __assign(__assign({}, s.tabElements), (_a = {}, _a[targetId] = __assign(__assign({}, s.tabElements[targetId]), { captionEditor: __assign(__assign({}, captionEditor), { show: true, text: text }) }), _a)) });
|
|
2776
|
+
return newState;
|
|
2777
|
+
});
|
|
2778
|
+
};
|
|
2779
|
+
this.onHideTabCaptionEditorRequested = function (targetId) {
|
|
2780
|
+
if (!_this.state.tabElements[targetId]) {
|
|
2781
|
+
return;
|
|
2782
|
+
}
|
|
2783
|
+
_this.setState(function (s) {
|
|
2784
|
+
var _a;
|
|
2785
|
+
var _b;
|
|
2786
|
+
var captionEditor = ((_b = s.tabElements[targetId]) === null || _b === void 0 ? void 0 : _b.captionEditor) || {};
|
|
2787
|
+
var newState = __assign(__assign({}, s), { tabElements: __assign(__assign({}, s.tabElements), (_a = {}, _a[targetId] = __assign(__assign({}, s.tabElements[targetId]), { captionEditor: __assign(__assign({}, captionEditor), { show: false }) }), _a)) });
|
|
2788
|
+
return newState;
|
|
2789
|
+
});
|
|
2790
|
+
};
|
|
2791
|
+
this.onShowLoadingAnimation = function (targetId) {
|
|
2792
|
+
if (!_this.state.frameLoadingAnimations[targetId]) {
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
_this.setState(function (s) {
|
|
2796
|
+
var _a;
|
|
2797
|
+
var newState = __assign(__assign({}, s), { frameLoadingAnimations: __assign(__assign({}, s.frameLoadingAnimations), (_a = {}, _a[targetId] = __assign(__assign({}, s.frameLoadingAnimations[targetId]), { show: true }), _a)) });
|
|
2798
|
+
return newState;
|
|
2799
|
+
});
|
|
2800
|
+
};
|
|
2801
|
+
this.onHideLoadingAnimation = function (targetId) {
|
|
2802
|
+
if (!_this.state.frameLoadingAnimations[targetId]) {
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
_this.setState(function (s) {
|
|
2806
|
+
var _a;
|
|
2807
|
+
var newState = __assign(__assign({}, s), { frameLoadingAnimations: __assign(__assign({}, s.frameLoadingAnimations), (_a = {}, _a[targetId] = __assign(__assign({}, s.frameLoadingAnimations[targetId]), { show: false }), _a)) });
|
|
2808
|
+
return newState;
|
|
2809
|
+
});
|
|
2810
|
+
};
|
|
2811
|
+
this.setState = function (cb) {
|
|
2812
|
+
_this.state = cb(_this.state);
|
|
2813
|
+
_this.listeners.forEach(function (l) { return l(); });
|
|
2814
|
+
};
|
|
2815
|
+
}
|
|
2816
|
+
return WebGroupsStore;
|
|
2817
|
+
}());
|
|
2818
|
+
var webGroupsStore = new WebGroupsStore();
|
|
2819
|
+
|
|
2820
|
+
var GroupElementCreationWrapper = function (_a) {
|
|
2821
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
2822
|
+
var components = _a.components;
|
|
2823
|
+
var state = shim.useSyncExternalStore(webGroupsStore.subscribe, webGroupsStore.getSnapshot);
|
|
2824
|
+
var renderGroupCaptionBar = function () {
|
|
2825
|
+
var _a;
|
|
2826
|
+
var GroupCaptionBarCustomElement = (_a = components === null || components === void 0 ? void 0 : components.group) === null || _a === void 0 ? void 0 : _a.CaptionBar;
|
|
2827
|
+
if (!GroupCaptionBarCustomElement || (!state.groupCaptionBar || !state.groupCaptionBar.parentElement)) {
|
|
2828
|
+
return;
|
|
2829
|
+
}
|
|
2830
|
+
var _b = state.groupCaptionBar, parentElement = _b.parentElement, options = __rest(_b, ["parentElement"]);
|
|
2831
|
+
var minimize = __assign({ onClick: function () {
|
|
2832
|
+
webGroupsManager.minimizeGroup(options.targetId);
|
|
2833
|
+
} }, options.minimize);
|
|
2834
|
+
var restore = __assign({ onClick: function () {
|
|
2835
|
+
webGroupsManager.restoreGroup(options.targetId);
|
|
2836
|
+
} }, options.restore);
|
|
2837
|
+
var maximize = __assign({ onClick: function () {
|
|
2838
|
+
webGroupsManager.maximizeGroup(options.targetId);
|
|
2839
|
+
} }, options.maximize);
|
|
2840
|
+
var close = __assign({ onClick: function () {
|
|
2841
|
+
webGroupsManager.closeGroup(options.targetId);
|
|
2842
|
+
} }, options.close);
|
|
2843
|
+
var captionEditor = __assign(__assign({}, options.captionEditor), { commitChanges: function (text) {
|
|
2844
|
+
webGroupsManager.commitCaptionEditing(TargetType.Group, options.targetId, text);
|
|
2845
|
+
}, hideEditor: function () {
|
|
2846
|
+
webGroupsStore.onHideCaptionEditorRequested(TargetType.Group, options.targetId);
|
|
2847
|
+
}, notifyBoundsChanged: function (bounds) {
|
|
2848
|
+
webGroupsManager.onCaptionEditorBoundsChanged(TargetType.Group, options.targetId, bounds);
|
|
2849
|
+
}, notifyEditorVisibilityChanged: function (visible) {
|
|
2850
|
+
webGroupsManager.onCaptionEditorVisibleChanged(TargetType.Group, options.targetId, visible);
|
|
2851
|
+
} });
|
|
2852
|
+
var notifyCaptionBoundsChanged = function (bounds) { return webGroupsManager.onCaptionTextBoundsChanged(TargetType.Group, options.targetId, bounds); };
|
|
2853
|
+
return (React__default["default"].createElement(Portal, { parentElement: parentElement },
|
|
2854
|
+
React__default["default"].createElement(GroupCaptionBarCustomElement, __assign({}, options, { minimize: minimize, maximize: maximize, restore: restore, close: close, captionEditor: captionEditor, notifyCaptionBoundsChanged: notifyCaptionBoundsChanged }))));
|
|
2855
|
+
};
|
|
2856
|
+
var renderGroupOverlay = function () {
|
|
2857
|
+
var _a;
|
|
2858
|
+
var GroupOverlayCustomElement = (_a = components === null || components === void 0 ? void 0 : components.group) === null || _a === void 0 ? void 0 : _a.Overlay;
|
|
2859
|
+
if (!GroupOverlayCustomElement || (!state.groupOverlay || !state.groupOverlay.parentElement)) {
|
|
2860
|
+
return;
|
|
2861
|
+
}
|
|
2862
|
+
var _b = state.groupOverlay, parentElement = _b.parentElement, options = __rest(_b, ["parentElement"]);
|
|
2863
|
+
return React__default["default"].createElement(Portal, { parentElement: parentElement },
|
|
2864
|
+
React__default["default"].createElement(GroupOverlayCustomElement, __assign({}, options)));
|
|
2865
|
+
};
|
|
2866
|
+
var renderFrameCaptionBar = function () {
|
|
2867
|
+
var _a;
|
|
2868
|
+
var FrameCaptionBarCustomElement = (_a = components === null || components === void 0 ? void 0 : components.flat) === null || _a === void 0 ? void 0 : _a.CaptionBar;
|
|
2869
|
+
return Object.values(state.frameCaptionBars).map(function (fcb) {
|
|
2870
|
+
if (!FrameCaptionBarCustomElement || !fcb.parentElement) {
|
|
2871
|
+
return;
|
|
2872
|
+
}
|
|
2873
|
+
var parentElement = fcb.parentElement, options = __rest(fcb, ["parentElement"]);
|
|
2874
|
+
var feedback = __assign({ onClick: function () {
|
|
2875
|
+
webGroupsManager.feedbackFrame(options.targetId);
|
|
2876
|
+
} }, options.feedback);
|
|
2877
|
+
var sticky = __assign({ onClick: function () {
|
|
2878
|
+
webGroupsManager.stickyFrame(options.targetId);
|
|
2879
|
+
} }, options.sticky);
|
|
2880
|
+
var extract = __assign({ onClick: function () {
|
|
2881
|
+
webGroupsManager.extractFrame(options.targetId);
|
|
2882
|
+
} }, options.extract);
|
|
2883
|
+
var lock = __assign({ onClick: function () {
|
|
2884
|
+
webGroupsManager.lockFrame(options.targetId);
|
|
2885
|
+
} }, options.lock);
|
|
2886
|
+
var unlock = __assign({ onClick: function () {
|
|
2887
|
+
webGroupsManager.unlockFrame(options.targetId);
|
|
2888
|
+
} }, options.unlock);
|
|
2889
|
+
var minimize = __assign({ onClick: function () {
|
|
2890
|
+
webGroupsManager.minimizeFrame(options.targetId);
|
|
2891
|
+
} }, options.minimize);
|
|
2892
|
+
var restore = __assign({ onClick: function () {
|
|
2893
|
+
webGroupsManager.restoreFrame(options.targetId);
|
|
2894
|
+
} }, options.restore);
|
|
2895
|
+
var maximize = __assign({ onClick: function () {
|
|
2896
|
+
webGroupsManager.maximizeFrame(options.targetId);
|
|
2897
|
+
} }, options.maximize);
|
|
2898
|
+
var close = __assign({ onClick: function () {
|
|
2899
|
+
webGroupsManager.closeFrame(options.targetId);
|
|
2900
|
+
} }, options.close);
|
|
2901
|
+
var customButtonsProps = new Array();
|
|
2902
|
+
if (options.customButtons) {
|
|
2903
|
+
customButtonsProps = options.customButtons.map(function (cButton) {
|
|
2904
|
+
return {
|
|
2905
|
+
onClick: function () {
|
|
2906
|
+
webGroupsManager.clickCustomButton(options.targetId, cButton.buttonId);
|
|
2907
|
+
},
|
|
2908
|
+
visible: true,
|
|
2909
|
+
imageData: cButton.imageData,
|
|
2910
|
+
tooltip: cButton.tooltip,
|
|
2911
|
+
buttonId: cButton.buttonId
|
|
2912
|
+
};
|
|
2913
|
+
});
|
|
2914
|
+
}
|
|
2915
|
+
var showSelector = function (bounds) {
|
|
2916
|
+
webGroupsManager.onFrameChannelSelectorClick(options.targetId, bounds);
|
|
2917
|
+
};
|
|
2918
|
+
var channels = {
|
|
2919
|
+
showSelector: showSelector,
|
|
2920
|
+
visible: options.channelSelectorVisible,
|
|
2921
|
+
selectedChannel: options.selectedChannel,
|
|
2922
|
+
selectedChannelColor: options.selectedChannelColor
|
|
2923
|
+
};
|
|
2924
|
+
var captionEditor = __assign(__assign({}, options.captionEditor), { commitChanges: function (text) {
|
|
2925
|
+
webGroupsManager.commitCaptionEditing(TargetType.Frame, options.targetId, text);
|
|
2926
|
+
}, hideEditor: function () {
|
|
2927
|
+
webGroupsStore.onHideCaptionEditorRequested(TargetType.Frame, options.targetId);
|
|
2928
|
+
}, notifyBoundsChanged: function (bounds) {
|
|
2929
|
+
webGroupsManager.onCaptionEditorBoundsChanged(TargetType.Frame, options.targetId, bounds);
|
|
2930
|
+
}, notifyEditorVisibilityChanged: function (visible) {
|
|
2931
|
+
webGroupsManager.onCaptionEditorVisibleChanged(TargetType.Frame, options.targetId, visible);
|
|
2932
|
+
} });
|
|
2933
|
+
var notifyCaptionBoundsChanged = function (bounds) { return webGroupsManager.onCaptionTextBoundsChanged(TargetType.Frame, options.targetId, bounds); };
|
|
2934
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
2935
|
+
React__default["default"].createElement(FrameCaptionBarCustomElement, __assign({}, options, { feedback: feedback, sticky: sticky, extract: extract, lock: lock, unlock: unlock, minimize: minimize, maximize: maximize, restore: restore, close: close, channels: channels, customButtons: customButtonsProps, frameId: options.targetId, captionEditor: captionEditor, notifyCaptionBoundsChanged: notifyCaptionBoundsChanged })));
|
|
2936
|
+
});
|
|
2937
|
+
};
|
|
2938
|
+
var renderFrameWindowOverlay = function () {
|
|
2939
|
+
var _a;
|
|
2940
|
+
var FrameWindowOverlayCustomElement = (_a = components === null || components === void 0 ? void 0 : components.frame) === null || _a === void 0 ? void 0 : _a.Overlay;
|
|
2941
|
+
return Object.values(state.frameWindowOverlays).map(function (fcb) {
|
|
2942
|
+
if (!FrameWindowOverlayCustomElement || !fcb.parentElement) {
|
|
2943
|
+
return;
|
|
2944
|
+
}
|
|
2945
|
+
var parentElement = fcb.parentElement, options = __rest(fcb, ["parentElement"]);
|
|
2946
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
2947
|
+
React__default["default"].createElement(FrameWindowOverlayCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
2948
|
+
});
|
|
2949
|
+
};
|
|
2950
|
+
var renderAboveWindow = function () {
|
|
2951
|
+
var _a;
|
|
2952
|
+
var AboveWindowCustomElement = (_a = components === null || components === void 0 ? void 0 : components.frame) === null || _a === void 0 ? void 0 : _a.AboveWindow;
|
|
2953
|
+
return Object.values(state.aboveWindowZones).map(function (awz) {
|
|
2954
|
+
if (!AboveWindowCustomElement || !awz.parentElement) {
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
var parentElement = awz.parentElement, options = __rest(awz, ["parentElement"]);
|
|
2958
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
2959
|
+
React__default["default"].createElement(AboveWindowCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
2960
|
+
});
|
|
2961
|
+
};
|
|
2962
|
+
var renderWindowContentOverlays = function () {
|
|
2963
|
+
var _a;
|
|
2964
|
+
var WindowContentCustomElement = (_a = components === null || components === void 0 ? void 0 : components.frame) === null || _a === void 0 ? void 0 : _a.WindowContentOverlay;
|
|
2965
|
+
return Object.values(state.windowContentOverlays).map(function (wco) {
|
|
2966
|
+
if (!WindowContentCustomElement || !wco.parentElement) {
|
|
2967
|
+
return;
|
|
2968
|
+
}
|
|
2969
|
+
var parentElement = wco.parentElement, options = __rest(wco, ["parentElement"]);
|
|
2970
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
2971
|
+
React__default["default"].createElement(WindowContentCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
2972
|
+
});
|
|
2973
|
+
};
|
|
2974
|
+
var renderFrameLoadingAnimations = function () {
|
|
2975
|
+
var _a;
|
|
2976
|
+
var LoadingAnimationCustomElement = (_a = components === null || components === void 0 ? void 0 : components.frame) === null || _a === void 0 ? void 0 : _a.LoadingAnimation;
|
|
2977
|
+
return Object.values(state.frameLoadingAnimations).map(function (wla) {
|
|
2978
|
+
if (!LoadingAnimationCustomElement || !wla.parentElement) {
|
|
2979
|
+
return;
|
|
2980
|
+
}
|
|
2981
|
+
var parentElement = wla.parentElement, options = __rest(wla, ["parentElement"]);
|
|
2982
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
2983
|
+
React__default["default"].createElement(LoadingAnimationCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
2984
|
+
});
|
|
2985
|
+
};
|
|
2986
|
+
var renderBelowWindow = function () {
|
|
2987
|
+
var _a;
|
|
2988
|
+
var BelowWindowCustomElement = (_a = components === null || components === void 0 ? void 0 : components.frame) === null || _a === void 0 ? void 0 : _a.BelowWindow;
|
|
2989
|
+
return Object.values(state.belowWindowZones).map(function (bwz) {
|
|
2990
|
+
if (!BelowWindowCustomElement || !bwz.parentElement) {
|
|
2991
|
+
return;
|
|
2992
|
+
}
|
|
2993
|
+
var parentElement = bwz.parentElement, options = __rest(bwz, ["parentElement"]);
|
|
2994
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
2995
|
+
React__default["default"].createElement(BelowWindowCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
2996
|
+
});
|
|
2997
|
+
};
|
|
2998
|
+
var renderAboveTabs = function () {
|
|
2999
|
+
var _a;
|
|
3000
|
+
var AboveTabsCustomElement = (_a = components === null || components === void 0 ? void 0 : components.tabs) === null || _a === void 0 ? void 0 : _a.Above;
|
|
3001
|
+
return Object.values(state.aboveTabsZones).map(function (te) {
|
|
3002
|
+
if (!AboveTabsCustomElement || !te.parentElement) {
|
|
3003
|
+
return;
|
|
3004
|
+
}
|
|
3005
|
+
var parentElement = te.parentElement, options = __rest(te, ["parentElement"]);
|
|
3006
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
3007
|
+
React__default["default"].createElement(AboveTabsCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
3008
|
+
});
|
|
3009
|
+
};
|
|
3010
|
+
var renderBeforeTabsZones = function () {
|
|
3011
|
+
var _a;
|
|
3012
|
+
var BeforeTabsCustomElement = (_a = components === null || components === void 0 ? void 0 : components.tabs) === null || _a === void 0 ? void 0 : _a.Before;
|
|
3013
|
+
return Object.values(state.beforeTabsZones).map(function (te) {
|
|
3014
|
+
if (!BeforeTabsCustomElement || !te.parentElement) {
|
|
3015
|
+
return;
|
|
3016
|
+
}
|
|
3017
|
+
var parentElement = te.parentElement, options = __rest(te, ["parentElement"]);
|
|
3018
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
3019
|
+
React__default["default"].createElement(BeforeTabsCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
3020
|
+
});
|
|
3021
|
+
};
|
|
3022
|
+
var renderTabElements = function () {
|
|
3023
|
+
var _a;
|
|
3024
|
+
var TabCustomElement = (_a = components === null || components === void 0 ? void 0 : components.tabs) === null || _a === void 0 ? void 0 : _a.Element;
|
|
3025
|
+
return Object.values(state.tabElements).map(function (te) {
|
|
3026
|
+
var _a;
|
|
3027
|
+
if (!TabCustomElement || !te.parentElement) {
|
|
3028
|
+
return;
|
|
3029
|
+
}
|
|
3030
|
+
var parentElement = te.parentElement, options = __rest(te, ["parentElement"]);
|
|
3031
|
+
var onCloseClick = function () {
|
|
3032
|
+
webGroupsManager.closeTab(options.targetId);
|
|
3033
|
+
};
|
|
3034
|
+
var showSelector = function (bounds) {
|
|
3035
|
+
webGroupsManager.onTabChannelSelectorClick(options.targetId, bounds);
|
|
3036
|
+
};
|
|
3037
|
+
var channels = {
|
|
3038
|
+
showSelector: showSelector,
|
|
3039
|
+
visible: options.channelSelectorVisible,
|
|
3040
|
+
selectedChannel: options.selectedChannel,
|
|
3041
|
+
selectedChannelColor: (_a = options.selectedChannelColor) !== null && _a !== void 0 ? _a : options.selectedChannel // TODO remove the null check when the variable has been added
|
|
3042
|
+
};
|
|
3043
|
+
var captionEditor = __assign(__assign({}, options.captionEditor), { commitChanges: function (text) {
|
|
3044
|
+
webGroupsManager.commitCaptionEditing(TargetType.Tab, options.targetId, text);
|
|
3045
|
+
}, hideEditor: function () {
|
|
3046
|
+
webGroupsStore.onHideCaptionEditorRequested(TargetType.Tab, options.targetId);
|
|
3047
|
+
}, notifyBoundsChanged: function (bounds) {
|
|
3048
|
+
webGroupsManager.onCaptionEditorBoundsChanged(TargetType.Tab, options.targetId, bounds);
|
|
3049
|
+
}, notifyEditorVisibilityChanged: function (visible) {
|
|
3050
|
+
webGroupsManager.onCaptionEditorVisibleChanged(TargetType.Tab, options.targetId, visible);
|
|
3051
|
+
} });
|
|
3052
|
+
var notifyCaptionBoundsChanged = function (bounds) { return webGroupsManager.onCaptionTextBoundsChanged(TargetType.Tab, options.targetId, bounds); };
|
|
3053
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
3054
|
+
React__default["default"].createElement(TabCustomElement, __assign({}, options, { close: onCloseClick, channels: channels, windowId: options.targetId, captionEditor: captionEditor, notifyCaptionBoundsChanged: notifyCaptionBoundsChanged })));
|
|
3055
|
+
});
|
|
3056
|
+
};
|
|
3057
|
+
var renderAfterTabsZones = function () {
|
|
3058
|
+
var _a;
|
|
3059
|
+
var AfterTabsCustomElement = (_a = components === null || components === void 0 ? void 0 : components.tabs) === null || _a === void 0 ? void 0 : _a.After;
|
|
3060
|
+
return Object.values(state.afterTabsZones).map(function (te) {
|
|
3061
|
+
if (!AfterTabsCustomElement || !te.parentElement) {
|
|
3062
|
+
return;
|
|
3063
|
+
}
|
|
3064
|
+
var parentElement = te.parentElement, options = __rest(te, ["parentElement"]);
|
|
3065
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
3066
|
+
React__default["default"].createElement(AfterTabsCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
3067
|
+
});
|
|
3068
|
+
};
|
|
3069
|
+
var renderTabHeaderButtons = function () {
|
|
3070
|
+
var _a;
|
|
3071
|
+
var TabButtonsCustomElement = (_a = components === null || components === void 0 ? void 0 : components.tabs) === null || _a === void 0 ? void 0 : _a.Buttons;
|
|
3072
|
+
return Object.values(state.tabHeaderButtons).map(function (te) {
|
|
3073
|
+
if (!TabButtonsCustomElement || !te.parentElement) {
|
|
3074
|
+
return;
|
|
3075
|
+
}
|
|
3076
|
+
var parentElement = te.parentElement, options = __rest(te, ["parentElement"]);
|
|
3077
|
+
var feedback = __assign({ onClick: function () {
|
|
3078
|
+
webGroupsManager.feedbackTabBar(options.targetId);
|
|
3079
|
+
} }, options.feedback);
|
|
3080
|
+
var sticky = __assign({ onClick: function () {
|
|
3081
|
+
webGroupsManager.stickyTabBar(options.targetId);
|
|
3082
|
+
} }, options.sticky);
|
|
3083
|
+
var extract = __assign({ onClick: function () {
|
|
3084
|
+
webGroupsManager.extractTabBar(options.targetId);
|
|
3085
|
+
} }, options.extract);
|
|
3086
|
+
var lock = __assign({ onClick: function () {
|
|
3087
|
+
webGroupsManager.lockTabBar(options.targetId);
|
|
3088
|
+
} }, options.lock);
|
|
3089
|
+
var unlock = __assign({ onClick: function () {
|
|
3090
|
+
webGroupsManager.unlockTabBar(options.targetId);
|
|
3091
|
+
} }, options.unlock);
|
|
3092
|
+
var minimize = __assign({ onClick: function () {
|
|
3093
|
+
webGroupsManager.minimizeTabBar(options.targetId);
|
|
3094
|
+
} }, options.minimize);
|
|
3095
|
+
var restore = __assign({ onClick: function () {
|
|
3096
|
+
webGroupsManager.restoreTabBar(options.targetId);
|
|
3097
|
+
} }, options.restore);
|
|
3098
|
+
var maximize = __assign({ onClick: function () {
|
|
3099
|
+
webGroupsManager.maximizeTabBar(options.targetId);
|
|
3100
|
+
} }, options.maximize);
|
|
3101
|
+
var close = __assign({ onClick: function () {
|
|
3102
|
+
webGroupsManager.closeTabBar(options.targetId);
|
|
3103
|
+
} }, options.close);
|
|
3104
|
+
var customButtonsProps = new Array();
|
|
3105
|
+
if (options.customButtons) {
|
|
3106
|
+
customButtonsProps = options.customButtons.map(function (cButton) {
|
|
3107
|
+
return {
|
|
3108
|
+
onClick: function () {
|
|
3109
|
+
webGroupsManager.clickCustomButton(options.targetId, cButton.buttonId);
|
|
3110
|
+
},
|
|
3111
|
+
visible: true,
|
|
3112
|
+
imageData: cButton.imageData,
|
|
3113
|
+
tooltip: cButton.tooltip,
|
|
3114
|
+
buttonId: cButton.buttonId
|
|
3115
|
+
};
|
|
3116
|
+
});
|
|
3117
|
+
}
|
|
3118
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
3119
|
+
React__default["default"].createElement(TabButtonsCustomElement, __assign({}, options, { feedback: feedback, sticky: sticky, extract: extract, lock: lock, unlock: unlock, minimize: minimize, maximize: maximize, restore: restore, close: close, customButtons: customButtonsProps, frameId: options.targetId })));
|
|
3120
|
+
});
|
|
3121
|
+
};
|
|
3122
|
+
var renderBelowTabs = function () {
|
|
3123
|
+
var _a;
|
|
3124
|
+
var BelowTabsCustomElement = (_a = components === null || components === void 0 ? void 0 : components.tabs) === null || _a === void 0 ? void 0 : _a.Below;
|
|
3125
|
+
return Object.values(state.belowTabsZones).map(function (te) {
|
|
3126
|
+
if (!BelowTabsCustomElement || !te.parentElement) {
|
|
3127
|
+
return;
|
|
3128
|
+
}
|
|
3129
|
+
var parentElement = te.parentElement, options = __rest(te, ["parentElement"]);
|
|
3130
|
+
return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
|
|
3131
|
+
React__default["default"].createElement(BelowTabsCustomElement, __assign({}, options, { frameId: options.targetId })));
|
|
3132
|
+
});
|
|
3133
|
+
};
|
|
3134
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
3135
|
+
renderGroupCaptionBar(),
|
|
3136
|
+
renderGroupOverlay(),
|
|
3137
|
+
renderFrameCaptionBar(),
|
|
3138
|
+
renderFrameWindowOverlay(),
|
|
3139
|
+
renderAboveWindow(),
|
|
3140
|
+
renderWindowContentOverlays(),
|
|
3141
|
+
renderFrameLoadingAnimations(),
|
|
3142
|
+
renderBelowWindow(),
|
|
3143
|
+
renderAboveTabs(),
|
|
3144
|
+
renderBeforeTabsZones(),
|
|
3145
|
+
renderTabElements(),
|
|
3146
|
+
renderAfterTabsZones(),
|
|
3147
|
+
renderTabHeaderButtons(),
|
|
3148
|
+
renderBelowTabs(),
|
|
3149
|
+
React__default["default"].createElement(GroupWrapper, { onCreateGroupCaptionBarRequested: ((_b = components === null || components === void 0 ? void 0 : components.group) === null || _b === void 0 ? void 0 : _b.CaptionBar) ? webGroupsStore.onCreateGroupCaptionBarRequested : undefined, onCreateGroupOverlayRequested: ((_c = components === null || components === void 0 ? void 0 : components.group) === null || _c === void 0 ? void 0 : _c.Overlay) ? webGroupsStore.onCreateGroupOverlayRequested : undefined, onCreateFrameCaptionBarRequested: ((_d = components === null || components === void 0 ? void 0 : components.flat) === null || _d === void 0 ? void 0 : _d.CaptionBar) ? webGroupsStore.onCreateFrameCaptionBarRequested : undefined, onCreateFrameWindowOverlayRequested: ((_e = components === null || components === void 0 ? void 0 : components.frame) === null || _e === void 0 ? void 0 : _e.Overlay) ? webGroupsStore.onCreateFrameWindowOverlayRequested : undefined, onCreateAboveWindowRequested: ((_f = components === null || components === void 0 ? void 0 : components.frame) === null || _f === void 0 ? void 0 : _f.AboveWindow) ? webGroupsStore.onCreateAboveWindowRequested : undefined, onCreateWindowContentOverlayRequested: ((_g = components === null || components === void 0 ? void 0 : components.frame) === null || _g === void 0 ? void 0 : _g.WindowContentOverlay) ? webGroupsStore.onCreateWindowContentOverlayRequested : undefined, onCreateFrameLoadingAnimationRequested: ((_h = components === null || components === void 0 ? void 0 : components.frame) === null || _h === void 0 ? void 0 : _h.LoadingAnimation) ? webGroupsStore.onCreateFrameLoadingAnimationRequested : undefined, onCreateBelowWindowRequested: ((_j = components === null || components === void 0 ? void 0 : components.frame) === null || _j === void 0 ? void 0 : _j.BelowWindow) ? webGroupsStore.onCreateBelowWindowRequested : undefined, onCreateAboveTabsRequested: ((_k = components === null || components === void 0 ? void 0 : components.tabs) === null || _k === void 0 ? void 0 : _k.Above) ? webGroupsStore.onCreateAboveTabsComponentRequested : undefined, onCreateBeforeTabsComponentRequested: ((_l = components === null || components === void 0 ? void 0 : components.tabs) === null || _l === void 0 ? void 0 : _l.Before) ? webGroupsStore.onCreateBeforeTabsComponentRequested : undefined, onCreateTabRequested: ((_m = components === null || components === void 0 ? void 0 : components.tabs) === null || _m === void 0 ? void 0 : _m.Element) ? webGroupsStore.onCreateTabElementRequested : undefined, onCreateAfterTabsComponentRequested: ((_o = components === null || components === void 0 ? void 0 : components.tabs) === null || _o === void 0 ? void 0 : _o.After) ? webGroupsStore.onCreateAfterTabsComponentRequested : undefined, onCreateTabHeaderButtonsRequested: ((_p = components === null || components === void 0 ? void 0 : components.tabs) === null || _p === void 0 ? void 0 : _p.Buttons) ? webGroupsStore.onCreateTabHeaderButtonsRequested : undefined, onCreateBelowTabsRequested: ((_q = components === null || components === void 0 ? void 0 : components.tabs) === null || _q === void 0 ? void 0 : _q.Below) ? webGroupsStore.onCreateBelowTabsComponentRequested : undefined, onUpdateGroupCaptionBarRequested: ((_r = components === null || components === void 0 ? void 0 : components.group) === null || _r === void 0 ? void 0 : _r.CaptionBar) ? webGroupsStore.onUpdateGroupCaptionBarRequested : undefined, onUpdateFrameWindowOverlayRequested: ((_s = components === null || components === void 0 ? void 0 : components.group) === null || _s === void 0 ? void 0 : _s.Overlay) ? webGroupsStore.onUpdateFrameWindowOverlayRequested : undefined, onUpdateFrameCaptionBarRequested: ((_t = components === null || components === void 0 ? void 0 : components.flat) === null || _t === void 0 ? void 0 : _t.CaptionBar) ? webGroupsStore.onUpdateFrameCaptionBarRequested : undefined, onUpdateFrameRequested: webGroupsStore.onUpdateFrame, onUpdateStandardButtonRequested: webGroupsStore.onUpdateStandardButton, onUpdateCustomButtonsRequested: webGroupsStore.onUpdateCustomButtons, onUpdateAboveTabsRequested: ((_u = components === null || components === void 0 ? void 0 : components.tabs) === null || _u === void 0 ? void 0 : _u.Above) ? webGroupsStore.onUpdateAboveTabsRequested : undefined, onUpdateBeforeTabsComponentRequested: ((_v = components === null || components === void 0 ? void 0 : components.tabs) === null || _v === void 0 ? void 0 : _v.Before) ? webGroupsStore.onUpdateBeforeTabsRequested : undefined, onUpdateTabRequested: ((_w = components === null || components === void 0 ? void 0 : components.tabs) === null || _w === void 0 ? void 0 : _w.Element) ? webGroupsStore.onUpdateTabElementRequested : undefined, onUpdateAfterTabsComponentRequested: ((_x = components === null || components === void 0 ? void 0 : components.tabs) === null || _x === void 0 ? void 0 : _x.After) ? webGroupsStore.onUpdateAfterTabsRequested : undefined, onUpdateBelowTabsRequested: ((_y = components === null || components === void 0 ? void 0 : components.tabs) === null || _y === void 0 ? void 0 : _y.Below) ? webGroupsStore.onUpdateBelowTabsRequested : undefined, onRemoveFrameCaptionBarRequested: webGroupsStore.onRemoveFrameCaptionBarRequested, onRemoveFrameWindowOverlayRequested: webGroupsStore.onRemoveFrameWindowOverlayRequested, onRemoveAboveWindowRequested: webGroupsStore.onRemoveAboveWindowRequested, onRemoveWindowContentOverlayRequested: webGroupsStore.onRemoveWindowContentOverlayRequested, onRemoveFrameLoadingAnimationRequested: webGroupsStore.onRemoveFrameLoadingAnimationRequested, onRemoveBelowWindowRequested: webGroupsStore.onRemoveBelowWindowRequested, onRemoveAboveTabsRequested: webGroupsStore.onRemoveAboveTabsRequested, onRemoveBeforeTabsComponentRequested: webGroupsStore.onRemoveBeforeTabsComponentRequested, onRemoveTabRequested: webGroupsStore.onRemoveTabElementRequested, onRemoveAfterTabsComponentRequested: webGroupsStore.onRemoveAfterTabsComponentRequested, onRemoveTabHeaderButtonsRequested: webGroupsStore.onRemoveTabHeaderButtonsRequested, onRemoveBelowTabsRequested: webGroupsStore.onRemoveBelowTabsRequested, onShowCaptionEditorRequested: webGroupsStore.onShowCaptionEditorRequested, onCommitCaptionEditingRequested: webGroupsStore.onCommitCaptionEditingRequested, onHideCaptionEditorRequested: webGroupsStore.onHideCaptionEditorRequested, onShowLoadingAnimationRequested: webGroupsStore.onShowLoadingAnimationRequested, onHideLoadingAnimationRequested: webGroupsStore.onHideLoadingAnimationRequested }));
|
|
3150
|
+
};
|
|
3151
|
+
|
|
3152
|
+
function useIOConnectWindow(windowId) {
|
|
3153
|
+
var _a = React.useState(undefined), IOConnectWindow = _a[0], setIOConnectWindow = _a[1];
|
|
3154
|
+
var io = window.io || React.useContext(reactHooks.IOConnectContext);
|
|
3155
|
+
React.useEffect(function () {
|
|
3156
|
+
var unsub = io.windows.onWindowAdded(function (w) {
|
|
3157
|
+
if (w.id === windowId) {
|
|
3158
|
+
setIOConnectWindow(w);
|
|
3159
|
+
unsub();
|
|
3160
|
+
}
|
|
3161
|
+
});
|
|
3162
|
+
var windowInCollection = io.windows.list().find(function (w) { return w.id === windowId; });
|
|
3163
|
+
if (windowInCollection) {
|
|
3164
|
+
setIOConnectWindow(windowInCollection);
|
|
3165
|
+
unsub();
|
|
3166
|
+
}
|
|
3167
|
+
return unsub;
|
|
3168
|
+
}, [windowId]);
|
|
3169
|
+
return IOConnectWindow;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
function useGroupComponentVisibility() {
|
|
3173
|
+
var _a;
|
|
3174
|
+
var state = shim.useSyncExternalStore(webGroupsStore.subscribe, webGroupsStore.getSnapshot);
|
|
3175
|
+
return {
|
|
3176
|
+
groupCaptionBarVisible: (_a = state.groupCaptionBar) === null || _a === void 0 ? void 0 : _a.visible
|
|
3177
|
+
};
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
function useCommitTabCaptionEditingRequested(targetId, text) {
|
|
3181
|
+
useCommitEditingRequested(TargetType.Tab, targetId, text);
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
function useCommitGroupCaptionEditingRequested(targetId, text) {
|
|
3185
|
+
useCommitEditingRequested(TargetType.Group, targetId, text);
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
function useCommitFlatCaptionEditingRequested(targetId, text) {
|
|
3189
|
+
useCommitEditingRequested(TargetType.Frame, targetId, text);
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
var FrameLoadingAnimation = function (_a) {
|
|
3193
|
+
var show = _a.show;
|
|
3194
|
+
return (show ?
|
|
3195
|
+
(React__default["default"].createElement("div", { className: "loader-wraper active" },
|
|
3196
|
+
React__default["default"].createElement("div", { className: "loader" }),
|
|
3197
|
+
React__default["default"].createElement("div", { className: "loader-text" }, "Loading..."))) : React__default["default"].createElement(React__default["default"].Fragment, null));
|
|
3198
|
+
};
|
|
3199
|
+
|
|
3200
|
+
var getGroupId = function () { return webGroupsManager === null || webGroupsManager === void 0 ? void 0 : webGroupsManager.getGroupId(); };
|
|
3201
|
+
var requestPageFocus = function () { return webGroupsManager === null || webGroupsManager === void 0 ? void 0 : webGroupsManager.requestPageFocus(); };
|
|
3202
|
+
var requestFrameFocus = function (frameId) { return webGroupsManager === null || webGroupsManager === void 0 ? void 0 : webGroupsManager.requestFrameFocus(frameId); };
|
|
3203
|
+
var requestGroupFocus = function () { return webGroupsManager === null || webGroupsManager === void 0 ? void 0 : webGroupsManager.requestGroupFocus(); };
|
|
3204
|
+
var onCommitGroupCaptionEditingRequested = function (targetId, cb) { return webGroupsManager.onCommitCaptionEditingRequested(TargetType.Group, targetId, cb); };
|
|
3205
|
+
var onCommitFlatCaptionEditingRequested = function (targetId, cb) { return webGroupsManager.onCommitCaptionEditingRequested(TargetType.Frame, targetId, cb); };
|
|
3206
|
+
var onCommitTabCaptionEditingRequested = function (targetId, cb) { return webGroupsManager.onCommitCaptionEditingRequested(TargetType.Tab, targetId, cb); };
|
|
3207
|
+
|
|
3208
|
+
exports.CloseButton = CloseButton;
|
|
3209
|
+
exports.CustomButton = CustomButton;
|
|
3210
|
+
exports.ExtractButton = ExtractButton;
|
|
3211
|
+
exports.FeedbackButton = FeedbackButton;
|
|
3212
|
+
exports.FlatButtons = FlatButtons;
|
|
3213
|
+
exports.FlatCaption = FlatCaption;
|
|
3214
|
+
exports.FlatCaptionBar = FlatCaptionBar;
|
|
3215
|
+
exports.FlatCaptionEditor = FlatCaptionEditor;
|
|
3216
|
+
exports.FlatChannelSelector = FlatChannelSelector;
|
|
3217
|
+
exports.FlatMoveArea = FlatMoveArea;
|
|
3218
|
+
exports.FrameLoadingAnimation = FrameLoadingAnimation;
|
|
3219
|
+
exports.GroupButtons = GroupButtons;
|
|
3220
|
+
exports.GroupCaption = GroupCaption;
|
|
3221
|
+
exports.GroupCaptionBar = GroupCaptionBar;
|
|
3222
|
+
exports.GroupCaptionEditor = GroupCaptionEditor;
|
|
3223
|
+
exports.GroupMoveArea = GroupMoveArea;
|
|
3224
|
+
exports.LockButton = LockButton;
|
|
3225
|
+
exports.MaximizeButton = MaximizeButton;
|
|
3226
|
+
exports.MinimizeButton = MinimizeButton;
|
|
3227
|
+
exports.RestoreButton = RestoreButton;
|
|
3228
|
+
exports.StickyButton = StickyButton;
|
|
3229
|
+
exports.Tab = Tab;
|
|
3230
|
+
exports.TabCaption = TabCaption;
|
|
3231
|
+
exports.TabCaptionEditor = TabCaptionEditor;
|
|
3232
|
+
exports.TabChannelSelector = TabChannelSelector;
|
|
3233
|
+
exports.TabCloseButton = TabCloseButton;
|
|
3234
|
+
exports.TabHeaderButtons = TabHeaderButtons;
|
|
3235
|
+
exports.UnlockButton = UnlockButton;
|
|
3236
|
+
exports["default"] = GroupElementCreationWrapper;
|
|
3237
|
+
exports.getGroupId = getGroupId;
|
|
3238
|
+
exports.onCommitFlatCaptionEditingRequested = onCommitFlatCaptionEditingRequested;
|
|
3239
|
+
exports.onCommitGroupCaptionEditingRequested = onCommitGroupCaptionEditingRequested;
|
|
3240
|
+
exports.onCommitTabCaptionEditingRequested = onCommitTabCaptionEditingRequested;
|
|
3241
|
+
exports.requestFrameFocus = requestFrameFocus;
|
|
3242
|
+
exports.requestGroupFocus = requestGroupFocus;
|
|
3243
|
+
exports.requestPageFocus = requestPageFocus;
|
|
3244
|
+
exports.useCaptionEditor = useCaptionEditor;
|
|
3245
|
+
exports.useCommitFlatCaptionEditingRequested = useCommitFlatCaptionEditingRequested;
|
|
3246
|
+
exports.useCommitGroupCaptionEditingRequested = useCommitGroupCaptionEditingRequested;
|
|
3247
|
+
exports.useCommitTabCaptionEditingRequested = useCommitTabCaptionEditingRequested;
|
|
3248
|
+
exports.useEditableCaption = useEditableCaption;
|
|
3249
|
+
exports.useGroupComponentVisibility = useGroupComponentVisibility;
|
|
3250
|
+
exports.useIOConnectWindow = useIOConnectWindow;
|
|
3251
|
+
exports.waitForWindow = waitForWindow;
|
|
3252
|
+
|
|
3253
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3254
|
+
|
|
3255
|
+
}));
|
|
3256
|
+
//# sourceMappingURL=index.js.map
|