@deephaven/jsapi-bootstrap 0.46.1-beta.2 → 0.46.1-beta.7

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.
@@ -3,6 +3,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
3
3
  import React, { createContext, useEffect, useState } from 'react';
4
4
  import { LoadingOverlay, Modal, ModalBody, ModalHeader } from '@deephaven/components';
5
5
  import Log from '@deephaven/log';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
8
  var log = Log.module('@deephaven/jsapi-bootstrap.ApiBootstrap');
7
9
  export var ApiContext = /*#__PURE__*/createContext(null);
8
10
  /**
@@ -42,21 +44,27 @@ export function ApiBootstrap(_ref) {
42
44
  loadApi();
43
45
  }, [apiUrl, setGlobally]);
44
46
  if (isLoading) {
45
- return /*#__PURE__*/React.createElement(LoadingOverlay, null);
47
+ return /*#__PURE__*/_jsx(LoadingOverlay, {});
46
48
  }
47
49
  if (api == null) {
48
- return failureElement !== null && failureElement !== void 0 ? failureElement : /*#__PURE__*/React.createElement(Modal, {
50
+ return failureElement !== null && failureElement !== void 0 ? failureElement : /*#__PURE__*/_jsxs(Modal, {
49
51
  isOpen: true,
50
- className: "modal-dialog-centered theme-bg-light"
51
- }, /*#__PURE__*/React.createElement(ModalHeader, {
52
- closeButton: false
53
- }, "Error: Unable to load API"), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement("p", {
54
- className: "text-break"
55
- }, "Ensure the server is running and you are able to reach ", apiUrl, ", then refresh the page.")));
52
+ className: "modal-dialog-centered theme-bg-light",
53
+ children: [/*#__PURE__*/_jsx(ModalHeader, {
54
+ closeButton: false,
55
+ children: "Error: Unable to load API"
56
+ }), /*#__PURE__*/_jsx(ModalBody, {
57
+ children: /*#__PURE__*/_jsxs("p", {
58
+ className: "text-break",
59
+ children: ["Ensure the server is running and you are able to reach ", apiUrl, ", then refresh the page."]
60
+ })
61
+ })]
62
+ });
56
63
  }
57
- return /*#__PURE__*/React.createElement(ApiContext.Provider, {
58
- value: api
59
- }, children);
64
+ return /*#__PURE__*/_jsx(ApiContext.Provider, {
65
+ value: api,
66
+ children: children
67
+ });
60
68
  }
61
69
  export default ApiBootstrap;
62
70
  //# sourceMappingURL=ApiBootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApiBootstrap.js","names":["React","createContext","useEffect","useState","LoadingOverlay","Modal","ModalBody","ModalHeader","Log","log","module","ApiContext","ApiBootstrap","apiUrl","children","failureElement","setGlobally","isLoading","setIsLoading","api","setApi","loadApi","dh","default","info","debug","globalThis","e","error"],"sources":["../src/ApiBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport {\n LoadingOverlay,\n Modal,\n ModalBody,\n ModalHeader,\n} from '@deephaven/components';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\n\nconst log = Log.module('@deephaven/jsapi-bootstrap.ApiBootstrap');\n\nexport const ApiContext = createContext<DhType | null>(null);\n\nexport type ApiBootstrapProps = {\n /** URL of the API to load */\n apiUrl: string;\n\n /** Children to render when the API has loaded */\n children: JSX.Element;\n\n /** Element to display if there is a failure loading the API */\n failureElement?: JSX.Element;\n\n /** Whether to set the API globally on window.dh when it has loaded */\n setGlobally?: boolean;\n};\n\n/**\n * ApiBootstrap loads the API from the provided URL, rendering the children once loaded.\n */\nexport function ApiBootstrap({\n apiUrl,\n children,\n failureElement,\n setGlobally = false,\n}: ApiBootstrapProps) {\n const [isLoading, setIsLoading] = useState(true);\n const [api, setApi] = useState<DhType>();\n useEffect(() => {\n async function loadApi() {\n try {\n const dh: DhType = (await import(/* @vite-ignore */ apiUrl)).default;\n log.info('API bootstrapped from', apiUrl);\n setApi(dh);\n if (setGlobally) {\n log.debug('API set globally');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (globalThis as any).dh = dh;\n }\n } catch (e) {\n log.error('Unable to bootstrap API', e);\n }\n setIsLoading(false);\n }\n loadApi();\n }, [apiUrl, setGlobally]);\n\n if (isLoading) {\n return <LoadingOverlay />;\n }\n if (api == null) {\n return (\n failureElement ?? (\n <Modal isOpen className=\"modal-dialog-centered theme-bg-light\">\n <ModalHeader closeButton={false}>\n Error: Unable to load API\n </ModalHeader>\n <ModalBody>\n <p className=\"text-break\">\n Ensure the server is running and you are able to reach {apiUrl},\n then refresh the page.\n </p>\n </ModalBody>\n </Modal>\n )\n );\n }\n return <ApiContext.Provider value={api}>{children}</ApiContext.Provider>;\n}\n\nexport default ApiBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SACEC,cAAc,EACdC,KAAK,EACLC,SAAS,EACTC,WAAW,QACN,uBAAuB;AAE9B,OAAOC,GAAG,MAAM,gBAAgB;AAEhC,IAAMC,GAAG,GAAGD,GAAG,CAACE,MAAM,CAAC,yCAAyC,CAAC;AAEjE,OAAO,IAAMC,UAAU,gBAAGV,aAAa,CAAgB,IAAI,CAAC;AAgB5D;AACA;AACA;AACA,OAAO,SAASW,YAAY,OAKN;EAAA,IALO;IAC3BC,MAAM;IACNC,QAAQ;IACRC,cAAc;IACdC,WAAW,GAAG;EACG,CAAC;EAClB,IAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGf,QAAQ,CAAC,IAAI,CAAC;EAChD,IAAM,CAACgB,GAAG,EAAEC,MAAM,CAAC,GAAGjB,QAAQ,EAAU;EACxCD,SAAS,CAAC,MAAM;IAAA,SACCmB,OAAO;MAAA;IAAA;IAAA;MAAA,6BAAtB,aAAyB;QACvB,IAAI;UACF,IAAMC,EAAU,GAAG,OAAO,MAAM,EAAC,kBAAmBT,MAAM,CAAC,EAAEU,OAAO;UACpEd,GAAG,CAACe,IAAI,CAAC,uBAAuB,EAAEX,MAAM,CAAC;UACzCO,MAAM,CAACE,EAAE,CAAC;UACV,IAAIN,WAAW,EAAE;YACfP,GAAG,CAACgB,KAAK,CAAC,kBAAkB,CAAC;YAC7B;YACCC,UAAU,CAASJ,EAAE,GAAGA,EAAE;UAC7B;QACF,CAAC,CAAC,OAAOK,CAAC,EAAE;UACVlB,GAAG,CAACmB,KAAK,CAAC,yBAAyB,EAAED,CAAC,CAAC;QACzC;QACAT,YAAY,CAAC,KAAK,CAAC;MACrB,CAAC;MAAA;IAAA;IACDG,OAAO,EAAE;EACX,CAAC,EAAE,CAACR,MAAM,EAAEG,WAAW,CAAC,CAAC;EAEzB,IAAIC,SAAS,EAAE;IACb,oBAAO,oBAAC,cAAc,OAAG;EAC3B;EACA,IAAIE,GAAG,IAAI,IAAI,EAAE;IACf,OACEJ,cAAc,aAAdA,cAAc,cAAdA,cAAc,gBACZ,oBAAC,KAAK;MAAC,MAAM;MAAC,SAAS,EAAC;IAAsC,gBAC5D,oBAAC,WAAW;MAAC,WAAW,EAAE;IAAM,GAAC,2BAEjC,CAAc,eACd,oBAAC,SAAS,qBACR;MAAG,SAAS,EAAC;IAAY,GAAC,yDAC+B,EAACF,MAAM,EAAC,0BAEjE,CAAI,CACM,CACN;EAGd;EACA,oBAAO,oBAAC,UAAU,CAAC,QAAQ;IAAC,KAAK,EAAEM;EAAI,GAAEL,QAAQ,CAAuB;AAC1E;AAEA,eAAeF,YAAY"}
1
+ {"version":3,"file":"ApiBootstrap.js","names":["React","createContext","useEffect","useState","LoadingOverlay","Modal","ModalBody","ModalHeader","Log","log","module","ApiContext","ApiBootstrap","apiUrl","children","failureElement","setGlobally","isLoading","setIsLoading","api","setApi","loadApi","dh","default","info","debug","globalThis","e","error"],"sources":["../src/ApiBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport {\n LoadingOverlay,\n Modal,\n ModalBody,\n ModalHeader,\n} from '@deephaven/components';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\n\nconst log = Log.module('@deephaven/jsapi-bootstrap.ApiBootstrap');\n\nexport const ApiContext = createContext<DhType | null>(null);\n\nexport type ApiBootstrapProps = {\n /** URL of the API to load */\n apiUrl: string;\n\n /** Children to render when the API has loaded */\n children: JSX.Element;\n\n /** Element to display if there is a failure loading the API */\n failureElement?: JSX.Element;\n\n /** Whether to set the API globally on window.dh when it has loaded */\n setGlobally?: boolean;\n};\n\n/**\n * ApiBootstrap loads the API from the provided URL, rendering the children once loaded.\n */\nexport function ApiBootstrap({\n apiUrl,\n children,\n failureElement,\n setGlobally = false,\n}: ApiBootstrapProps) {\n const [isLoading, setIsLoading] = useState(true);\n const [api, setApi] = useState<DhType>();\n useEffect(() => {\n async function loadApi() {\n try {\n const dh: DhType = (await import(/* @vite-ignore */ apiUrl)).default;\n log.info('API bootstrapped from', apiUrl);\n setApi(dh);\n if (setGlobally) {\n log.debug('API set globally');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (globalThis as any).dh = dh;\n }\n } catch (e) {\n log.error('Unable to bootstrap API', e);\n }\n setIsLoading(false);\n }\n loadApi();\n }, [apiUrl, setGlobally]);\n\n if (isLoading) {\n return <LoadingOverlay />;\n }\n if (api == null) {\n return (\n failureElement ?? (\n <Modal isOpen className=\"modal-dialog-centered theme-bg-light\">\n <ModalHeader closeButton={false}>\n Error: Unable to load API\n </ModalHeader>\n <ModalBody>\n <p className=\"text-break\">\n Ensure the server is running and you are able to reach {apiUrl},\n then refresh the page.\n </p>\n </ModalBody>\n </Modal>\n )\n );\n }\n return <ApiContext.Provider value={api}>{children}</ApiContext.Provider>;\n}\n\nexport default ApiBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SACEC,cAAc,EACdC,KAAK,EACLC,SAAS,EACTC,WAAW,QACN,uBAAuB;AAE9B,OAAOC,GAAG,MAAM,gBAAgB;AAAC;AAAA;AAEjC,IAAMC,GAAG,GAAGD,GAAG,CAACE,MAA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EjC,EAAc,eACd,KAAC,SAAS;QAAA,uBACR;UAAG,SAAS,EAAC,YAAY;UAAA,WAAC,yDAC+B,EAACF,MAAM,EAAC,0BAEjE;QAAA;MAAI,EACM;IAAA,EACN;EAGd;EACA,oBAAO,KAAC,UAAU,CAAC,QAAQ;IAAC,KAAK,EAAEM,GAAI;IAAA,UAAEL;EAAQ,EAAuB;AAC1E;AAEA,eAAeF,YAAY"}
@@ -1,5 +1,6 @@
1
1
  import React, { createContext } from 'react';
2
2
  import useCreateClient from "./useCreateClient.js";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
3
4
  export var ClientContext = /*#__PURE__*/createContext(null);
4
5
  /**
5
6
  * ClientBootstrap component. Handles creating the client.
@@ -11,9 +12,10 @@ export function ClientBootstrap(_ref) {
11
12
  children
12
13
  } = _ref;
13
14
  var client = useCreateClient(serverUrl, options);
14
- return /*#__PURE__*/React.createElement(ClientContext.Provider, {
15
- value: client
16
- }, children);
15
+ return /*#__PURE__*/_jsx(ClientContext.Provider, {
16
+ value: client,
17
+ children: children
18
+ });
17
19
  }
18
20
  export default ClientBootstrap;
19
21
  //# sourceMappingURL=ClientBootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientBootstrap.js","names":["React","createContext","useCreateClient","ClientContext","ClientBootstrap","serverUrl","options","children","client"],"sources":["../src/ClientBootstrap.tsx"],"sourcesContent":["import React, { createContext } from 'react';\nimport type { ConnectOptions, CoreClient } from '@deephaven/jsapi-types';\nimport useCreateClient from './useCreateClient';\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 client = useCreateClient(serverUrl, options);\n return (\n <ClientContext.Provider value={client}>{children}</ClientContext.Provider>\n );\n}\n\nexport default ClientBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAAC,OAEtCC,eAAe;AAEtB,OAAO,IAAMC,aAAa,gBAAGF,aAAa,CAAoB,IAAI,CAAC;AAgBnE;AACA;AACA;AACA,OAAO,SAASG,eAAe,OAIN;EAAA,IAJO;IAC9BC,SAAS;IACTC,OAAO;IACPC;EACoB,CAAC;EACrB,IAAMC,MAAM,GAAGN,eAAe,CAACG,SAAS,EAAEC,OAAO,CAAC;EAClD,oBACE,oBAAC,aAAa,CAAC,QAAQ;IAAC,KAAK,EAAEE;EAAO,GAAED,QAAQ,CAA0B;AAE9E;AAEA,eAAeH,eAAe"}
1
+ {"version":3,"file":"ClientBootstrap.js","names":["React","createContext","useCreateClient","ClientContext","ClientBootstrap","serverUrl","options","children","client"],"sources":["../src/ClientBootstrap.tsx"],"sourcesContent":["import React, { createContext } from 'react';\nimport type { ConnectOptions, CoreClient } from '@deephaven/jsapi-types';\nimport useCreateClient from './useCreateClient';\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 client = useCreateClient(serverUrl, options);\n return (\n <ClientContext.Provider value={client}>{children}</ClientContext.Provider>\n );\n}\n\nexport default ClientBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAAC,OAEtCC,eAAe;AAAA;AAEtB,OAAO,IAAMC,aAAa,gBAAGF,aAAa,CAAoB,IAAI,CAAC;AAgBnE;AACA;AACA;AACA,OAAO,SAASG,eAAe,OAIN;EAAA,IAJO;IAC9BC,SAAS;IACTC,OAAO;IACPC;EACoB,CAAC;EACrB,IAAMC,MAAM,GAAGN,eAAe,CAACG,SAAS,EAAEC,OAAO,CAAC;EAClD,oBACE,KAAC,aAAa,CAAC,QAAQ;IAAC,KAAK,EAAEE,MAAO;IAAA,UAAED;EAAQ,EAA0B;AAE9E;AAEA,eAAeH,eAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/jsapi-bootstrap",
3
- "version": "0.46.1-beta.2+a1893756",
3
+ "version": "0.46.1-beta.7+d59e9bed",
4
4
  "description": "Deephaven JSAPI Bootstrap",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -22,10 +22,10 @@
22
22
  "build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
23
23
  },
24
24
  "dependencies": {
25
- "@deephaven/components": "^0.46.1-beta.2+a1893756",
26
- "@deephaven/jsapi-types": "^0.46.1-beta.2+a1893756",
27
- "@deephaven/log": "^0.46.1-beta.2+a1893756",
28
- "@deephaven/react-hooks": "^0.46.1-beta.2+a1893756"
25
+ "@deephaven/components": "^0.46.1-beta.7+d59e9bed",
26
+ "@deephaven/jsapi-types": "^0.46.1-beta.7+d59e9bed",
27
+ "@deephaven/log": "^0.46.1-beta.7+d59e9bed",
28
+ "@deephaven/react-hooks": "^0.46.1-beta.7+d59e9bed"
29
29
  },
30
30
  "devDependencies": {
31
31
  "react": "^17.x"
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "a18937562f6e9ce2d62b27f79a60adc341a435e9"
43
+ "gitHead": "d59e9bed95152170626265a00ea27d716e1b2bcb"
44
44
  }