@deephaven/app-utils 0.33.1-auth-plugins.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +9 -0
  3. package/dist/components/AppBootstrap.d.ts +21 -0
  4. package/dist/components/AppBootstrap.d.ts.map +1 -0
  5. package/dist/components/AppBootstrap.js +33 -0
  6. package/dist/components/AppBootstrap.js.map +1 -0
  7. package/dist/components/AuthBootstrap.d.ts +13 -0
  8. package/dist/components/AuthBootstrap.d.ts.map +1 -0
  9. package/dist/components/AuthBootstrap.js +82 -0
  10. package/dist/components/AuthBootstrap.js.map +1 -0
  11. package/dist/components/ClientBootstrap.d.ts +20 -0
  12. package/dist/components/ClientBootstrap.d.ts.map +1 -0
  13. package/dist/components/ClientBootstrap.js +30 -0
  14. package/dist/components/ClientBootstrap.js.map +1 -0
  15. package/dist/components/ConnectionBootstrap.d.ts +16 -0
  16. package/dist/components/ConnectionBootstrap.d.ts.map +1 -0
  17. package/dist/components/ConnectionBootstrap.js +71 -0
  18. package/dist/components/ConnectionBootstrap.js.map +1 -0
  19. package/dist/components/FontBootstrap.d.ts +20 -0
  20. package/dist/components/FontBootstrap.d.ts.map +1 -0
  21. package/dist/components/FontBootstrap.js +33 -0
  22. package/dist/components/FontBootstrap.js.map +1 -0
  23. package/dist/components/FontsLoaded.d.ts +8 -0
  24. package/dist/components/FontsLoaded.d.ts.map +1 -0
  25. package/dist/components/FontsLoaded.js +17 -0
  26. package/dist/components/FontsLoaded.js.map +1 -0
  27. package/dist/components/PluginsBootstrap.d.ts +20 -0
  28. package/dist/components/PluginsBootstrap.d.ts.map +1 -0
  29. package/dist/components/PluginsBootstrap.js +39 -0
  30. package/dist/components/PluginsBootstrap.js.map +1 -0
  31. package/dist/components/index.d.ts +11 -0
  32. package/dist/components/index.d.ts.map +1 -0
  33. package/dist/components/index.js +11 -0
  34. package/dist/components/index.js.map +1 -0
  35. package/dist/components/useClient.d.ts +3 -0
  36. package/dist/components/useClient.d.ts.map +1 -0
  37. package/dist/components/useClient.js +11 -0
  38. package/dist/components/useClient.js.map +1 -0
  39. package/dist/components/useConnection.d.ts +3 -0
  40. package/dist/components/useConnection.d.ts.map +1 -0
  41. package/dist/components/useConnection.js +11 -0
  42. package/dist/components/useConnection.js.map +1 -0
  43. package/dist/components/usePlugins.d.ts +3 -0
  44. package/dist/components/usePlugins.d.ts.map +1 -0
  45. package/dist/components/usePlugins.js +11 -0
  46. package/dist/components/usePlugins.js.map +1 -0
  47. package/dist/index.d.ts +4 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +4 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/plugins/PluginUtils.d.ts +48 -0
  52. package/dist/plugins/PluginUtils.d.ts.map +1 -0
  53. package/dist/plugins/PluginUtils.js +184 -0
  54. package/dist/plugins/PluginUtils.js.map +1 -0
  55. package/dist/plugins/RemoteComponent.d.ts +3 -0
  56. package/dist/plugins/RemoteComponent.d.ts.map +1 -0
  57. package/dist/plugins/RemoteComponent.js +8 -0
  58. package/dist/plugins/RemoteComponent.js.map +1 -0
  59. package/dist/plugins/index.d.ts +3 -0
  60. package/dist/plugins/index.d.ts.map +1 -0
  61. package/dist/plugins/index.js +3 -0
  62. package/dist/plugins/index.js.map +1 -0
  63. package/dist/plugins/loadRemoteModule.d.ts +5 -0
  64. package/dist/plugins/loadRemoteModule.d.ts.map +1 -0
  65. package/dist/plugins/loadRemoteModule.js +8 -0
  66. package/dist/plugins/loadRemoteModule.js.map +1 -0
  67. package/dist/plugins/remote-component.config.d.ts +16 -0
  68. package/dist/plugins/remote-component.config.d.ts.map +1 -0
  69. package/dist/plugins/remote-component.config.js +19 -0
  70. package/dist/plugins/remote-component.config.js.map +1 -0
  71. package/dist/utils/ConnectUtils.d.ts +14 -0
  72. package/dist/utils/ConnectUtils.d.ts.map +1 -0
  73. package/dist/utils/ConnectUtils.js +28 -0
  74. package/dist/utils/ConnectUtils.js.map +1 -0
  75. package/dist/utils/index.d.ts +2 -0
  76. package/dist/utils/index.d.ts.map +1 -0
  77. package/dist/utils/index.js +2 -0
  78. package/dist/utils/index.js.map +1 -0
  79. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @deephaven/app-utils
2
+
3
+ A library with some utility functions used by Deephaven applications.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save @deephaven/app-utils
9
+ ```
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import '@deephaven/components/scss/BaseStyleSheet.scss';
3
+ export type AppBootstrapProps = {
4
+ /** URL of the API to load. */
5
+ apiUrl: string;
6
+ /** URL of the plugins to load. */
7
+ pluginsUrl: string;
8
+ /** Font class names to load. */
9
+ fontClassNames?: string[];
10
+ /**
11
+ * The children to render wrapped when everything is loaded and authenticated.
12
+ */
13
+ children: React.ReactNode;
14
+ };
15
+ /**
16
+ * AppBootstrap component. Handles loading the fonts, client, and authentication.
17
+ * Will display the children when everything is loaded and authenticated.
18
+ */
19
+ export declare function AppBootstrap({ apiUrl, fontClassNames, pluginsUrl, children, }: AppBootstrapProps): JSX.Element;
20
+ export default AppBootstrap;
21
+ //# sourceMappingURL=AppBootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/AppBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gDAAgD,CAAC;AASxD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IAEf,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IAEnB,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,cAAc,EACd,UAAU,EACV,QAAQ,GACT,EAAE,iBAAiB,eAgBnB;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import '@deephaven/components/scss/BaseStyleSheet.scss';
3
+ import FontBootstrap from "./FontBootstrap.js";
4
+ import ClientBootstrap from "./ClientBootstrap.js";
5
+ import PluginsBootstrap from "./PluginsBootstrap.js";
6
+ import AuthBootstrap from "./AuthBootstrap.js";
7
+ import ConnectionBootstrap from "./ConnectionBootstrap.js";
8
+ import { getBaseUrl, getConnectOptions } from "../utils/index.js";
9
+ import FontsLoaded from "./FontsLoaded.js";
10
+ /**
11
+ * AppBootstrap component. Handles loading the fonts, client, and authentication.
12
+ * Will display the children when everything is loaded and authenticated.
13
+ */
14
+ export function AppBootstrap(_ref) {
15
+ var {
16
+ apiUrl,
17
+ fontClassNames,
18
+ pluginsUrl,
19
+ children
20
+ } = _ref;
21
+ var serverUrl = getBaseUrl(apiUrl).origin;
22
+ var clientOptions = getConnectOptions();
23
+ return /*#__PURE__*/React.createElement(FontBootstrap, {
24
+ fontClassNames: fontClassNames
25
+ }, /*#__PURE__*/React.createElement(ClientBootstrap, {
26
+ serverUrl: serverUrl,
27
+ options: clientOptions
28
+ }, /*#__PURE__*/React.createElement(PluginsBootstrap, {
29
+ pluginsUrl: pluginsUrl
30
+ }, /*#__PURE__*/React.createElement(AuthBootstrap, null, /*#__PURE__*/React.createElement(ConnectionBootstrap, null, /*#__PURE__*/React.createElement(FontsLoaded, null, children))))));
31
+ }
32
+ export default AppBootstrap;
33
+ //# sourceMappingURL=AppBootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppBootstrap.js","names":["React","FontBootstrap","ClientBootstrap","PluginsBootstrap","AuthBootstrap","ConnectionBootstrap","getBaseUrl","getConnectOptions","FontsLoaded","AppBootstrap","apiUrl","fontClassNames","pluginsUrl","children","serverUrl","origin","clientOptions"],"sources":["../../src/components/AppBootstrap.tsx"],"sourcesContent":["import React from 'react';\nimport '@deephaven/components/scss/BaseStyleSheet.scss';\nimport FontBootstrap from './FontBootstrap';\nimport ClientBootstrap from './ClientBootstrap';\nimport PluginsBootstrap from './PluginsBootstrap';\nimport AuthBootstrap from './AuthBootstrap';\nimport ConnectionBootstrap from './ConnectionBootstrap';\nimport { getBaseUrl, getConnectOptions } from '../utils';\nimport FontsLoaded from './FontsLoaded';\n\nexport type AppBootstrapProps = {\n /** URL of the API to load. */\n apiUrl: string;\n\n /** URL of the plugins to load. */\n pluginsUrl: string;\n\n /** Font class names to load. */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped when everything is loaded and authenticated.\n */\n children: React.ReactNode;\n};\n\n/**\n * AppBootstrap component. Handles loading the fonts, client, and authentication.\n * Will display the children when everything is loaded and authenticated.\n */\nexport function AppBootstrap({\n apiUrl,\n fontClassNames,\n pluginsUrl,\n children,\n}: AppBootstrapProps) {\n const serverUrl = getBaseUrl(apiUrl).origin;\n const clientOptions = getConnectOptions();\n return (\n <FontBootstrap fontClassNames={fontClassNames}>\n <ClientBootstrap serverUrl={serverUrl} options={clientOptions}>\n <PluginsBootstrap pluginsUrl={pluginsUrl}>\n <AuthBootstrap>\n <ConnectionBootstrap>\n <FontsLoaded>{children}</FontsLoaded>\n </ConnectionBootstrap>\n </AuthBootstrap>\n </PluginsBootstrap>\n </ClientBootstrap>\n </FontBootstrap>\n );\n}\n\nexport default AppBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,gDAAgD;AAAC,OACjDC,aAAa;AAAA,OACbC,eAAe;AAAA,OACfC,gBAAgB;AAAA,OAChBC,aAAa;AAAA,OACbC,mBAAmB;AAAA,SACjBC,UAAU,EAAEC,iBAAiB;AAAA,OAC/BC,WAAW;AAkBlB;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAY,OAKN;EAAA,IALO;IAC3BC,MAAM;IACNC,cAAc;IACdC,UAAU;IACVC;EACiB,CAAC;EAClB,IAAMC,SAAS,GAAGR,UAAU,CAACI,MAAM,CAAC,CAACK,MAAM;EAC3C,IAAMC,aAAa,GAAGT,iBAAiB,EAAE;EACzC,oBACE,oBAAC,aAAa;IAAC,cAAc,EAAEI;EAAe,gBAC5C,oBAAC,eAAe;IAAC,SAAS,EAAEG,SAAU;IAAC,OAAO,EAAEE;EAAc,gBAC5D,oBAAC,gBAAgB;IAAC,UAAU,EAAEJ;EAAW,gBACvC,oBAAC,aAAa,qBACZ,oBAAC,mBAAmB,qBAClB,oBAAC,WAAW,QAAEC,QAAQ,CAAe,CACjB,CACR,CACC,CACH,CACJ;AAEpB;AAEA,eAAeJ,YAAY"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type AuthBootstrapProps = {
3
+ /**
4
+ * The children to render after authentication is completed.
5
+ */
6
+ children: React.ReactNode;
7
+ };
8
+ /**
9
+ * AuthBootstrap component. Handles displaying the auth plugin and authenticating.
10
+ */
11
+ export declare function AuthBootstrap({ children }: AuthBootstrapProps): JSX.Element;
12
+ export default AuthBootstrap;
13
+ //# sourceMappingURL=AuthBootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/AuthBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAYf,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AASF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,eA2E7D;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,82 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
4
+ import { AuthPluginAnonymous, AuthPluginParent, AuthPluginPsk } from '@deephaven/auth-plugins';
5
+ import { LoadingOverlay } from '@deephaven/components';
6
+ import { PluginsContext } from "./PluginsBootstrap.js";
7
+ import { getAuthPluginComponent } from "../plugins/index.js";
8
+ import useClient from "./useClient.js";
9
+ /** Core auth plugins that are always loaded */
10
+ var CORE_AUTH_PLUGINS = new Map([['@deephaven/auth-plugins.AuthPluginPsk', AuthPluginPsk], ['@deephaven/auth-plugins.AuthPluginParent', AuthPluginParent], ['@deephaven/auth-plugins.AuthPluginAnonymous', AuthPluginAnonymous]]);
11
+
12
+ /**
13
+ * AuthBootstrap component. Handles displaying the auth plugin and authenticating.
14
+ */
15
+ export function AuthBootstrap(_ref) {
16
+ var {
17
+ children
18
+ } = _ref;
19
+ var client = useClient();
20
+ var plugins = useContext(PluginsContext);
21
+ var [authConfig, setAuthConfig] = useState();
22
+ var [isLoggedIn, setIsLoggedIn] = useState(false);
23
+ var [error, setError] = useState();
24
+ useEffect(function initAuthConfigValues() {
25
+ var isCancelled = false;
26
+ function loadAuthConfigValues() {
27
+ return _loadAuthConfigValues.apply(this, arguments);
28
+ }
29
+ function _loadAuthConfigValues() {
30
+ _loadAuthConfigValues = _asyncToGenerator(function* () {
31
+ try {
32
+ var newAuthConfigValues = yield client.getAuthConfigValues();
33
+ if (!isCancelled) {
34
+ setAuthConfig(new Map(newAuthConfigValues));
35
+ }
36
+ } catch (e) {
37
+ if (!isCancelled) {
38
+ setError(e);
39
+ }
40
+ }
41
+ });
42
+ return _loadAuthConfigValues.apply(this, arguments);
43
+ }
44
+ loadAuthConfigValues();
45
+ return () => {
46
+ isCancelled = true;
47
+ };
48
+ }, [client]);
49
+ var AuthComponent = useMemo(() => {
50
+ if (plugins == null || authConfig == null) {
51
+ return undefined;
52
+ }
53
+ return getAuthPluginComponent(client, plugins, authConfig, CORE_AUTH_PLUGINS);
54
+ }, [authConfig, client, plugins]);
55
+ var handleLoginSuccess = useCallback(() => {
56
+ setIsLoggedIn(true);
57
+ }, []);
58
+ var handleLoginFailure = useCallback(e => {
59
+ setIsLoggedIn(false);
60
+ setError(e);
61
+ }, []);
62
+ var isLoading = AuthComponent == null || authConfig == null;
63
+ if (isLoading || error != null) {
64
+ return /*#__PURE__*/React.createElement(LoadingOverlay, {
65
+ isLoading: isLoading,
66
+ errorMessage: error != null ? "".concat(error) : undefined
67
+ });
68
+ }
69
+ if (!isLoggedIn) {
70
+ return /*#__PURE__*/React.createElement(AuthComponent, {
71
+ authConfigValues: authConfig,
72
+ client: client,
73
+ onSuccess: handleLoginSuccess,
74
+ onFailure: handleLoginFailure
75
+ });
76
+ }
77
+
78
+ // eslint-disable-next-line react/jsx-no-useless-fragment
79
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
80
+ }
81
+ export default AuthBootstrap;
82
+ //# sourceMappingURL=AuthBootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthBootstrap.js","names":["React","useCallback","useContext","useEffect","useMemo","useState","AuthPluginAnonymous","AuthPluginParent","AuthPluginPsk","LoadingOverlay","PluginsContext","getAuthPluginComponent","useClient","CORE_AUTH_PLUGINS","Map","AuthBootstrap","children","client","plugins","authConfig","setAuthConfig","isLoggedIn","setIsLoggedIn","error","setError","initAuthConfigValues","isCancelled","loadAuthConfigValues","newAuthConfigValues","getAuthConfigValues","e","AuthComponent","undefined","handleLoginSuccess","handleLoginFailure","isLoading"],"sources":["../../src/components/AuthBootstrap.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n AuthConfigMap,\n AuthPluginAnonymous,\n AuthPluginParent,\n AuthPluginPsk,\n} from '@deephaven/auth-plugins';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { PluginsContext } from './PluginsBootstrap';\nimport { getAuthPluginComponent } from '../plugins';\nimport useClient from './useClient';\n\nexport type AuthBootstrapProps = {\n /**\n * The children to render after authentication is completed.\n */\n children: React.ReactNode;\n};\n\n/** Core auth plugins that are always loaded */\nconst CORE_AUTH_PLUGINS = new Map([\n ['@deephaven/auth-plugins.AuthPluginPsk', AuthPluginPsk],\n ['@deephaven/auth-plugins.AuthPluginParent', AuthPluginParent],\n ['@deephaven/auth-plugins.AuthPluginAnonymous', AuthPluginAnonymous],\n]);\n\n/**\n * AuthBootstrap component. Handles displaying the auth plugin and authenticating.\n */\nexport function AuthBootstrap({ children }: AuthBootstrapProps) {\n const client = useClient();\n const plugins = useContext(PluginsContext);\n const [authConfig, setAuthConfig] = useState<AuthConfigMap>();\n const [isLoggedIn, setIsLoggedIn] = useState(false);\n const [error, setError] = useState<unknown>();\n\n useEffect(\n function initAuthConfigValues() {\n let isCancelled = false;\n async function loadAuthConfigValues() {\n try {\n const newAuthConfigValues = await client.getAuthConfigValues();\n if (!isCancelled) {\n setAuthConfig(new Map(newAuthConfigValues));\n }\n } catch (e) {\n if (!isCancelled) {\n setError(e);\n }\n }\n }\n loadAuthConfigValues();\n return () => {\n isCancelled = true;\n };\n },\n [client]\n );\n\n const AuthComponent = useMemo(() => {\n if (plugins == null || authConfig == null) {\n return undefined;\n }\n\n return getAuthPluginComponent(\n client,\n plugins,\n authConfig,\n CORE_AUTH_PLUGINS\n );\n }, [authConfig, client, plugins]);\n\n const handleLoginSuccess = useCallback(() => {\n setIsLoggedIn(true);\n }, []);\n\n const handleLoginFailure = useCallback((e: unknown) => {\n setIsLoggedIn(false);\n setError(e);\n }, []);\n\n const isLoading = AuthComponent == null || authConfig == null;\n\n if (isLoading || error != null) {\n return (\n <LoadingOverlay\n isLoading={isLoading}\n errorMessage={error != null ? `${error}` : undefined}\n />\n );\n }\n if (!isLoggedIn) {\n return (\n <AuthComponent\n authConfigValues={authConfig}\n client={client}\n onSuccess={handleLoginSuccess}\n onFailure={handleLoginFailure}\n />\n );\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default AuthBootstrap;\n"],"mappings":"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"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ConnectOptions, CoreClient } from '@deephaven/jsapi-types';
3
+ export declare const ClientContext: React.Context<CoreClient | null>;
4
+ export type ClientBootstrapProps = {
5
+ /** URL of the server to connect to */
6
+ serverUrl: string;
7
+ /** Connection options to pass to CoreClient when connecting */
8
+ options?: ConnectOptions;
9
+ /**
10
+ * The children to render wrapped with the ClientContext.
11
+ * Will not render children until the client is created.
12
+ */
13
+ children: React.ReactNode;
14
+ };
15
+ /**
16
+ * ClientBootstrap component. Handles creating the client.
17
+ */
18
+ export declare function ClientBootstrap({ serverUrl, options, children, }: ClientBootstrapProps): JSX.Element | null;
19
+ export default ClientBootstrap;
20
+ //# sourceMappingURL=ClientBootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ClientBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpE,eAAO,MAAM,aAAa,kCAAyC,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAElB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,oBAAoB,sBAoBtB;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,30 @@
1
+ import React, { createContext, useEffect, useState } from 'react';
2
+ import { useApi } from '@deephaven/jsapi-bootstrap';
3
+ export var ClientContext = /*#__PURE__*/createContext(null);
4
+ /**
5
+ * ClientBootstrap component. Handles creating the client.
6
+ */
7
+ export function ClientBootstrap(_ref) {
8
+ var {
9
+ serverUrl,
10
+ options,
11
+ children
12
+ } = _ref;
13
+ var api = useApi();
14
+ var [client, setClient] = useState();
15
+ useEffect(function initClient() {
16
+ var newClient = new api.CoreClient(serverUrl, options);
17
+ setClient(newClient);
18
+ return () => {
19
+ newClient.disconnect();
20
+ };
21
+ }, [api, options, serverUrl]);
22
+ if (client == null) {
23
+ return null;
24
+ }
25
+ return /*#__PURE__*/React.createElement(ClientContext.Provider, {
26
+ value: client
27
+ }, children);
28
+ }
29
+ export default ClientBootstrap;
30
+ //# sourceMappingURL=ClientBootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientBootstrap.js","names":["React","createContext","useEffect","useState","useApi","ClientContext","ClientBootstrap","serverUrl","options","children","api","client","setClient","initClient","newClient","CoreClient","disconnect"],"sources":["../../src/components/ClientBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { ConnectOptions, CoreClient } from '@deephaven/jsapi-types';\n\nexport const ClientContext = createContext<CoreClient | null>(null);\n\nexport type ClientBootstrapProps = {\n /** URL of the server to connect to */\n serverUrl: string;\n\n /** Connection options to pass to CoreClient when connecting */\n options?: ConnectOptions;\n\n /**\n * The children to render wrapped with the ClientContext.\n * Will not render children until the client is created.\n */\n children: React.ReactNode;\n};\n\n/**\n * ClientBootstrap component. Handles creating the client.\n */\nexport function ClientBootstrap({\n serverUrl,\n options,\n children,\n}: ClientBootstrapProps) {\n const api = useApi();\n const [client, setClient] = useState<CoreClient>();\n useEffect(\n function initClient() {\n const newClient = new api.CoreClient(serverUrl, options);\n setClient(newClient);\n return () => {\n newClient.disconnect();\n };\n },\n [api, options, serverUrl]\n );\n\n if (client == null) {\n return null;\n }\n return (\n <ClientContext.Provider value={client}>{children}</ClientContext.Provider>\n );\n}\n\nexport default ClientBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SAASC,MAAM,QAAQ,4BAA4B;AAGnD,OAAO,IAAMC,aAAa,gBAAGJ,aAAa,CAAoB,IAAI,CAAC;AAgBnE;AACA;AACA;AACA,OAAO,SAASK,eAAe,OAIN;EAAA,IAJO;IAC9BC,SAAS;IACTC,OAAO;IACPC;EACoB,CAAC;EACrB,IAAMC,GAAG,GAAGN,MAAM,EAAE;EACpB,IAAM,CAACO,MAAM,EAAEC,SAAS,CAAC,GAAGT,QAAQ,EAAc;EAClDD,SAAS,CACP,SAASW,UAAU,GAAG;IACpB,IAAMC,SAAS,GAAG,IAAIJ,GAAG,CAACK,UAAU,CAACR,SAAS,EAAEC,OAAO,CAAC;IACxDI,SAAS,CAACE,SAAS,CAAC;IACpB,OAAO,MAAM;MACXA,SAAS,CAACE,UAAU,EAAE;IACxB,CAAC;EACH,CAAC,EACD,CAACN,GAAG,EAAEF,OAAO,EAAED,SAAS,CAAC,CAC1B;EAED,IAAII,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,IAAI;EACb;EACA,oBACE,oBAAC,aAAa,CAAC,QAAQ;IAAC,KAAK,EAAEA;EAAO,GAAEF,QAAQ,CAA0B;AAE9E;AAEA,eAAeH,eAAe"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { IdeConnection } from '@deephaven/jsapi-types';
3
+ export declare const ConnectionContext: React.Context<IdeConnection | null>;
4
+ export type ConnectionBootstrapProps = {
5
+ /**
6
+ * The children to render wrapped with the ConnectionContext.
7
+ * Will not render children until the connection is created.
8
+ */
9
+ children: React.ReactNode;
10
+ };
11
+ /**
12
+ * ConnectionBootstrap component. Handles initializing the connection.
13
+ */
14
+ export declare function ConnectionBootstrap({ children }: ConnectionBootstrapProps): JSX.Element;
15
+ export default ConnectionBootstrap;
16
+ //# sourceMappingURL=ConnectionBootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMvD,eAAO,MAAM,iBAAiB,qCAA4C,CAAC;AAE3E,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE,wBAAwB,eA+DzE;AAED,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,71 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3
+ import React, { createContext, useEffect, useState } from 'react';
4
+ import { LoadingOverlay } from '@deephaven/components';
5
+ import { useApi } from '@deephaven/jsapi-bootstrap';
6
+ import Log from '@deephaven/log';
7
+ import useClient from "./useClient.js";
8
+ var log = Log.module('@deephaven/jsapi-components.ConnectionBootstrap');
9
+ export var ConnectionContext = /*#__PURE__*/createContext(null);
10
+ /**
11
+ * ConnectionBootstrap component. Handles initializing the connection.
12
+ */
13
+ export function ConnectionBootstrap(_ref) {
14
+ var {
15
+ children
16
+ } = _ref;
17
+ var api = useApi();
18
+ var client = useClient();
19
+ var [error, setError] = useState();
20
+ var [connection, setConnection] = useState();
21
+ useEffect(function initConnection() {
22
+ var isCancelled = false;
23
+ function loadConnection() {
24
+ return _loadConnection.apply(this, arguments);
25
+ }
26
+ function _loadConnection() {
27
+ _loadConnection = _asyncToGenerator(function* () {
28
+ try {
29
+ var newConnection = yield client.getAsIdeConnection();
30
+ if (isCancelled) {
31
+ return;
32
+ }
33
+ setConnection(newConnection);
34
+ } catch (e) {
35
+ if (isCancelled) {
36
+ return;
37
+ }
38
+ setError(e);
39
+ }
40
+ });
41
+ return _loadConnection.apply(this, arguments);
42
+ }
43
+ loadConnection();
44
+ return () => {
45
+ isCancelled = true;
46
+ };
47
+ }, [api, client]);
48
+ useEffect(function listenForShutdown() {
49
+ if (connection == null) return;
50
+ function handleShutdown(event) {
51
+ var {
52
+ detail
53
+ } = event;
54
+ log.info('Shutdown', "".concat(JSON.stringify(detail)));
55
+ setError("Server shutdown: ".concat(detail !== null && detail !== void 0 ? detail : 'Unknown reason'));
56
+ }
57
+ var removerFn = connection.addEventListener(api.IdeConnection.EVENT_SHUTDOWN, handleShutdown);
58
+ return removerFn;
59
+ }, [api, connection]);
60
+ if (connection == null || error != null) {
61
+ return /*#__PURE__*/React.createElement(LoadingOverlay, {
62
+ isLoading: connection == null,
63
+ errorMessage: "".concat(error)
64
+ });
65
+ }
66
+ return /*#__PURE__*/React.createElement(ConnectionContext.Provider, {
67
+ value: connection
68
+ }, children);
69
+ }
70
+ export default ConnectionBootstrap;
71
+ //# sourceMappingURL=ConnectionBootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionBootstrap.js","names":["React","createContext","useEffect","useState","LoadingOverlay","useApi","Log","useClient","log","module","ConnectionContext","ConnectionBootstrap","children","api","client","error","setError","connection","setConnection","initConnection","isCancelled","loadConnection","newConnection","getAsIdeConnection","e","listenForShutdown","handleShutdown","event","detail","info","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_SHUTDOWN"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { IdeConnection } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport useClient from './useClient';\n\nconst log = Log.module('@deephaven/jsapi-components.ConnectionBootstrap');\n\nexport const ConnectionContext = createContext<IdeConnection | null>(null);\n\nexport type ConnectionBootstrapProps = {\n /**\n * The children to render wrapped with the ConnectionContext.\n * Will not render children until the connection is created.\n */\n children: React.ReactNode;\n};\n\n/**\n * ConnectionBootstrap component. Handles initializing the connection.\n */\nexport function ConnectionBootstrap({ children }: ConnectionBootstrapProps) {\n const api = useApi();\n const client = useClient();\n const [error, setError] = useState<unknown>();\n const [connection, setConnection] = useState<IdeConnection>();\n useEffect(\n function initConnection() {\n let isCancelled = false;\n async function loadConnection() {\n try {\n const newConnection = await client.getAsIdeConnection();\n if (isCancelled) {\n return;\n }\n setConnection(newConnection);\n } catch (e) {\n if (isCancelled) {\n return;\n }\n setError(e);\n }\n }\n loadConnection();\n return () => {\n isCancelled = true;\n };\n },\n [api, client]\n );\n\n useEffect(\n function listenForShutdown() {\n if (connection == null) return;\n\n function handleShutdown(event: CustomEvent) {\n const { detail } = event;\n log.info('Shutdown', `${JSON.stringify(detail)}`);\n setError(`Server shutdown: ${detail ?? 'Unknown reason'}`);\n }\n\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_SHUTDOWN,\n handleShutdown\n );\n return removerFn;\n },\n [api, connection]\n );\n\n if (connection == null || error != null) {\n return (\n <LoadingOverlay\n isLoading={connection == null}\n errorMessage={`${error}`}\n />\n );\n }\n\n return (\n <ConnectionContext.Provider value={connection}>\n {children}\n </ConnectionContext.Provider>\n );\n}\n\nexport default ConnectionBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,MAAM,QAAQ,4BAA4B;AAEnD,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,SAAS;AAEhB,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAM,CAAC,iDAAiD,CAAC;AAEzE,OAAO,IAAMC,iBAAiB,gBAAGT,aAAa,CAAuB,IAAI,CAAC;AAU1E;AACA;AACA;AACA,OAAO,SAASU,mBAAmB,OAAyC;EAAA,IAAxC;IAAEC;EAAmC,CAAC;EACxE,IAAMC,GAAG,GAAGR,MAAM,EAAE;EACpB,IAAMS,MAAM,GAAGP,SAAS,EAAE;EAC1B,IAAM,CAACQ,KAAK,EAAEC,QAAQ,CAAC,GAAGb,QAAQ,EAAW;EAC7C,IAAM,CAACc,UAAU,EAAEC,aAAa,CAAC,GAAGf,QAAQ,EAAiB;EAC7DD,SAAS,CACP,SAASiB,cAAc,GAAG;IACxB,IAAIC,WAAW,GAAG,KAAK;IAAC,SACTC,cAAc;MAAA;IAAA;IAAA;MAAA,oCAA7B,aAAgC;QAC9B,IAAI;UACF,IAAMC,aAAa,SAASR,MAAM,CAACS,kBAAkB,EAAE;UACvD,IAAIH,WAAW,EAAE;YACf;UACF;UACAF,aAAa,CAACI,aAAa,CAAC;QAC9B,CAAC,CAAC,OAAOE,CAAC,EAAE;UACV,IAAIJ,WAAW,EAAE;YACf;UACF;UACAJ,QAAQ,CAACQ,CAAC,CAAC;QACb;MACF,CAAC;MAAA;IAAA;IACDH,cAAc,EAAE;IAChB,OAAO,MAAM;MACXD,WAAW,GAAG,IAAI;IACpB,CAAC;EACH,CAAC,EACD,CAACP,GAAG,EAAEC,MAAM,CAAC,CACd;EAEDZ,SAAS,CACP,SAASuB,iBAAiB,GAAG;IAC3B,IAAIR,UAAU,IAAI,IAAI,EAAE;IAExB,SAASS,cAAc,CAACC,KAAkB,EAAE;MAC1C,IAAM;QAAEC;MAAO,CAAC,GAAGD,KAAK;MACxBnB,GAAG,CAACqB,IAAI,CAAC,UAAU,YAAKC,IAAI,CAACC,SAAS,CAACH,MAAM,CAAC,EAAG;MACjDZ,QAAQ,4BAAqBY,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,gBAAgB,EAAG;IAC5D;IAEA,IAAMI,SAAS,GAAGf,UAAU,CAACgB,gBAAgB,CAC3CpB,GAAG,CAACqB,aAAa,CAACC,cAAc,EAChCT,cAAc,CACf;IACD,OAAOM,SAAS;EAClB,CAAC,EACD,CAACnB,GAAG,EAAEI,UAAU,CAAC,CAClB;EAED,IAAIA,UAAU,IAAI,IAAI,IAAIF,KAAK,IAAI,IAAI,EAAE;IACvC,oBACE,oBAAC,cAAc;MACb,SAAS,EAAEE,UAAU,IAAI,IAAK;MAC9B,YAAY,YAAKF,KAAK;IAAG,EACzB;EAEN;EAEA,oBACE,oBAAC,iBAAiB,CAAC,QAAQ;IAAC,KAAK,EAAEE;EAAW,GAC3CL,QAAQ,CACkB;AAEjC;AAEA,eAAeD,mBAAmB"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import 'fira';
3
+ export declare const FontsLoadedContext: React.Context<boolean>;
4
+ export type FontBootstrapProps = {
5
+ /**
6
+ * Class names of the font elements to pre load
7
+ */
8
+ fontClassNames?: string[];
9
+ /**
10
+ * The children to render wrapped with the FontsLoadedContext.
11
+ * Note that it renders the children even if the fonts aren't loaded yet.
12
+ */
13
+ children: React.ReactNode;
14
+ };
15
+ /**
16
+ * FontBootstrap component. Handles preloading fonts.
17
+ */
18
+ export declare function FontBootstrap({ fontClassNames, children, }: FontBootstrapProps): JSX.Element;
19
+ export default FontBootstrap;
20
+ //# sourceMappingURL=FontBootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/FontBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,MAAM,CAAC;AAEd,eAAO,MAAM,kBAAkB,wBAAgC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,cAAqE,EACrE,QAAQ,GACT,EAAE,kBAAkB,eAmCpB;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,33 @@
1
+ import React, { createContext, useEffect, useState } from 'react';
2
+ import 'fira';
3
+ export var FontsLoadedContext = /*#__PURE__*/createContext(false);
4
+ /**
5
+ * FontBootstrap component. Handles preloading fonts.
6
+ */
7
+ export function FontBootstrap(_ref) {
8
+ var {
9
+ fontClassNames = ['fira-sans-regular', 'fira-sans-bold', 'fira-mono'],
10
+ children
11
+ } = _ref;
12
+ var [isLoaded, setIsLoaded] = useState(false);
13
+ useEffect(function initFonts() {
14
+ document.fonts.ready.then(() => {
15
+ setIsLoaded(true);
16
+ });
17
+ }, []);
18
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FontsLoadedContext.Provider, {
19
+ value: isLoaded
20
+ }, children), /*#__PURE__*/React.createElement("div", {
21
+ id: "preload-fonts",
22
+ style: {
23
+ visibility: 'hidden',
24
+ position: 'absolute',
25
+ top: -10000
26
+ }
27
+ }, fontClassNames.map(className => /*#__PURE__*/React.createElement("p", {
28
+ key: className,
29
+ className: className
30
+ }, "preload"))));
31
+ }
32
+ export default FontBootstrap;
33
+ //# sourceMappingURL=FontBootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontBootstrap.js","names":["React","createContext","useEffect","useState","FontsLoadedContext","FontBootstrap","fontClassNames","children","isLoaded","setIsLoaded","initFonts","document","fonts","ready","then","visibility","position","top","map","className"],"sources":["../../src/components/FontBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport 'fira';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-bold', 'fira-mono'],\n children,\n}: FontBootstrapProps) {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,OAAO,MAAM;AAEb,OAAO,IAAMC,kBAAkB,gBAAGH,aAAa,CAAU,KAAK,CAAC;AAe/D;AACA;AACA;AACA,OAAO,SAASI,aAAa,OAGN;EAAA,IAHO;IAC5BC,cAAc,GAAG,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,WAAW,CAAC;IACrEC;EACkB,CAAC;EACnB,IAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGN,QAAQ,CAAC,KAAK,CAAC;EAC/CD,SAAS,CAAC,SAASQ,SAAS,GAAG;IAC7BC,QAAQ,CAACC,KAAK,CAACC,KAAK,CAACC,IAAI,CAAC,MAAM;MAC9BL,WAAW,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,oBACE,uDACE,oBAAC,kBAAkB,CAAC,QAAQ;IAAC,KAAK,EAAED;EAAS,GAC1CD,QAAQ,CACmB,eAU9B;IACE,EAAE,EAAC,eAAe;IAClB,KAAK,EAAE;MAAEQ,UAAU,EAAE,QAAQ;MAAEC,QAAQ,EAAE,UAAU;MAAEC,GAAG,EAAE,CAAC;IAAM;EAAE,GAGlEX,cAAc,CAACY,GAAG,CAACC,SAAS,iBAC3B;IAAG,GAAG,EAAEA,SAAU;IAAC,SAAS,EAAEA;EAAU,GAAC,SAEzC,CACD,CAAC,CACE,CACL;AAEP;AAEA,eAAed,aAAa"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export type FontsLoadedProps = {
3
+ /** Children to show when the fonts have completed loading */
4
+ children: React.ReactNode;
5
+ };
6
+ export declare function FontsLoaded({ children }: FontsLoadedProps): JSX.Element;
7
+ export default FontsLoaded;
8
+ //# sourceMappingURL=FontsLoaded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontsLoaded.d.ts","sourceRoot":"","sources":["../../src/components/FontsLoaded.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAI1C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6DAA6D;IAC7D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,eASzD;AAED,eAAe,WAAW,CAAC"}