@deephaven/jsapi-bootstrap 1.5.1 → 1.5.2-beta.1
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/dist/ApiBootstrap.js +3 -1
- package/dist/ApiBootstrap.js.map +1 -1
- package/package.json +7 -7
package/dist/ApiBootstrap.js
CHANGED
|
@@ -48,7 +48,9 @@ export function ApiBootstrap(_ref) {
|
|
|
48
48
|
loadApi();
|
|
49
49
|
}, [apiUrl, setGlobally]);
|
|
50
50
|
if (isLoading) {
|
|
51
|
-
return /*#__PURE__*/_jsx(LoadingOverlay, {
|
|
51
|
+
return /*#__PURE__*/_jsx(LoadingOverlay, {
|
|
52
|
+
"data-testid": "api-bootstrap-loading"
|
|
53
|
+
});
|
|
52
54
|
}
|
|
53
55
|
if (api == null) {
|
|
54
56
|
return failureElement !== null && failureElement !== void 0 ? failureElement : /*#__PURE__*/_jsxs(Modal, {
|
package/dist/ApiBootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiBootstrap.js","names":["createContext","useEffect","useState","LoadingOverlay","Modal","ModalBody","ModalHeader","Log","jsx","_jsx","jsxs","_jsxs","log","module","ApiContext","displayName","ApiBootstrap","_ref","apiUrl","children","failureElement","setGlobally","isLoading","setIsLoading","api","setApi","loadApi","_loadApi","apply","arguments","_asyncToGenerator","dh","default","info","debug","globalThis","e","error","isOpen","className","closeButton","Provider","value"],"sources":["../src/ApiBootstrap.tsx"],"sourcesContent":["import { createContext, type ReactNode, 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<typeof DhType | null>(null);\nApiContext.displayName = 'ApiContext';\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: ReactNode;\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): JSX.Element {\n const [isLoading, setIsLoading] = useState(true);\n const [api, setApi] = useState<typeof DhType>();\n useEffect(() => {\n async function loadApi(): Promise<void> {\n try {\n const dh: typeof DhType =\n // Ignore the warning about dynamic import in both Vite and Webpack.\n // We use Vite, but some clients may use Webpack.\n (await import(/* @vite-ignore */ /* webpackIgnore: true */ apiUrl))\n .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\">\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,SAASA,aAAa,EAAkBC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC1E,SACEC,cAAc,EACdC,KAAK,EACLC,SAAS,EACTC,WAAW,QACN,uBAAuB;AAE9B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;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C;EAEzB,IAAIC,SAAS,EAAE;IACb,oBAAOb,IAAA,CAACN,cAAc,
|
|
1
|
+
{"version":3,"file":"ApiBootstrap.js","names":["createContext","useEffect","useState","LoadingOverlay","Modal","ModalBody","ModalHeader","Log","jsx","_jsx","jsxs","_jsxs","log","module","ApiContext","displayName","ApiBootstrap","_ref","apiUrl","children","failureElement","setGlobally","isLoading","setIsLoading","api","setApi","loadApi","_loadApi","apply","arguments","_asyncToGenerator","dh","default","info","debug","globalThis","e","error","isOpen","className","closeButton","Provider","value"],"sources":["../src/ApiBootstrap.tsx"],"sourcesContent":["import { createContext, type ReactNode, 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<typeof DhType | null>(null);\nApiContext.displayName = 'ApiContext';\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: ReactNode;\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): JSX.Element {\n const [isLoading, setIsLoading] = useState(true);\n const [api, setApi] = useState<typeof DhType>();\n useEffect(() => {\n async function loadApi(): Promise<void> {\n try {\n const dh: typeof DhType =\n // Ignore the warning about dynamic import in both Vite and Webpack.\n // We use Vite, but some clients may use Webpack.\n (await import(/* @vite-ignore */ /* webpackIgnore: true */ apiUrl))\n .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 data-testid=\"api-bootstrap-loading\" />;\n }\n if (api == null) {\n return (\n failureElement ?? (\n <Modal isOpen className=\"modal-dialog-centered\">\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,SAASA,aAAa,EAAkBC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC1E,SACEC,cAAc,EACdC,KAAK,EACLC,SAAS,EACTC,WAAW,QACN,uBAAuB;AAE9B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEjC,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,yCAAyC,CAAC;AAEjE,OAAO,IAAMC,UAAU,gBAAGd,aAAa,CAAuB,IAAI,CAAC;AACnEc,UAAU,CAACC,WAAW,GAAG,YAAY;AAgBrC;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAAC,IAAA,EAKO;EAAA,IALN;IAC3BC,MAAM;IACNC,QAAQ;IACRC,cAAc;IACdC,WAAW,GAAG;EACG,CAAC,GAAAJ,IAAA;EAClB,IAAM,CAACK,SAAS,EAAEC,YAAY,CAAC,GAAGrB,QAAQ,CAAC,IAAI,CAAC;EAChD,IAAM,CAACsB,GAAG,EAAEC,MAAM,CAAC,GAAGvB,QAAQ,CAAgB,CAAC;EAC/CD,SAAS,CAAC,MAAM;IAAA,SACCyB,OAAOA,CAAA;MAAA,OAAAC,QAAA,CAAAC,KAA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CAACK,UAAU,CAAC2B,QAAQ;IAACC,KAAK,EAAElB,GAAI;IAAAL,QAAA,EAAEA;EAAQ,CAAsB,CAAC;AAC1E;AAEA,eAAeH,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/jsapi-bootstrap",
|
|
3
|
-
"version": "1.5.1",
|
|
3
|
+
"version": "1.5.2-beta.1+8793afa7",
|
|
4
4
|
"description": "Deephaven JSAPI Bootstrap",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@deephaven/components": "^1.5.1",
|
|
25
|
+
"@deephaven/components": "^1.5.2-beta.1+8793afa7",
|
|
26
26
|
"@deephaven/jsapi-types": "^1.0.0-dev0.39.4",
|
|
27
|
-
"@deephaven/log": "^1.1
|
|
28
|
-
"@deephaven/react-hooks": "^1.2.
|
|
29
|
-
"@deephaven/utils": "^1.1
|
|
27
|
+
"@deephaven/log": "^1.5.2-beta.1+8793afa7",
|
|
28
|
+
"@deephaven/react-hooks": "^1.5.2-beta.1+8793afa7",
|
|
29
|
+
"@deephaven/utils": "^1.5.2-beta.1+8793afa7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@deephaven/test-utils": "^1.1
|
|
32
|
+
"@deephaven/test-utils": "^1.5.2-beta.1+8793afa7",
|
|
33
33
|
"react": "^17.x"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "8793afa7d6549b898df34d939a63b5853c6758c3"
|
|
46
46
|
}
|