@deephaven/embed-widget 0.59.1-deferred-api.7 → 0.59.1-deferred-api.8
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/build/assets/{App-8e3788e6.js → App-00570737.js} +2 -2
- package/build/assets/{App-8e3788e6.js.map → App-00570737.js.map} +1 -1
- package/build/assets/{IrisGridModelFactory-828cd084.js → IrisGridModelFactory-dab97e97.js} +2 -2
- package/build/assets/{IrisGridModelFactory-828cd084.js.map → IrisGridModelFactory-dab97e97.js.map} +1 -1
- package/build/assets/{WidgetView-730b6fe6.js → WidgetView-2ecb9aca.js} +2 -2
- package/build/assets/{WidgetView-730b6fe6.js.map → WidgetView-2ecb9aca.js.map} +1 -1
- package/build/assets/index-0ff905b4.js +4 -0
- package/build/assets/index-0ff905b4.js.map +1 -0
- package/build/assets/{index-6aaba7b4.js → index-363531e6.js} +2 -2
- package/build/assets/{index-6aaba7b4.js.map → index-363531e6.js.map} +1 -1
- package/build/assets/{index-92b3ef5c.js → index-40f7081c.js} +2 -2
- package/build/assets/{index-92b3ef5c.js.map → index-40f7081c.js.map} +1 -1
- package/build/assets/{usePlugins-af3e0adf.js → usePlugins-3ebe3437.js} +2 -2
- package/build/assets/{usePlugins-af3e0adf.js.map → usePlugins-3ebe3437.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +15 -15
- package/build/assets/index-28eab808.js +0 -4
- package/build/assets/index-28eab808.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,C as o}from"./vendor-d09ca476.js";import{L as m,a as g}from"./index-
|
|
2
|
-
//# sourceMappingURL=App-
|
|
1
|
+
import{r as t,C as o}from"./vendor-d09ca476.js";import{L as m,a as g}from"./index-363531e6.js";import{u as w,C as h}from"./usePlugins-3ebe3437.js";import{E as x,W as E,f as y}from"./WidgetView-2ecb9aca.js";import"./helpers-042e6b4d.js";const c=m.module("EmbedWidget.App");function D(){const[s,l]=t.useState(),[e,u]=t.useState(),n=t.useMemo(()=>new URLSearchParams(window.location.search),[]).get("name"),i=w();t.useEffect(function(){async function p(){try{if(n==null)throw new Error('Missing URL parameter "name"');c.debug(`Loading widget definition for ${n}...`);const r=await y(i,n);u(r),c.debug(`Widget definition successfully loaded for ${n}`)}catch(r){c.error(`Unable to load widget definition for ${n}`,r),l(`${r}`)}}p()},[i,n]);const a=e!=null&&s==null,d=e==null&&s==null,f=t.useMemo(()=>e==null?async()=>{throw new Error("Definition is null")}:()=>i.getObject(e),[i,e]);return o.jsxs("div",{className:"App",children:[a&&o.jsx(x,{children:o.jsx(E,{type:e.type,fetch:f})}),!a&&o.jsx(g,{isLoaded:a,isLoading:d,errorMessage:s??null}),o.jsx(h,{})]})}export{D as default};
|
|
2
|
+
//# sourceMappingURL=App-00570737.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App-
|
|
1
|
+
{"version":3,"file":"App-00570737.js","sources":["../../src/App.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport {\n ContextMenuRoot,\n ErrorBoundary,\n LoadingOverlay,\n} from '@deephaven/components'; // Use the loading spinner from the Deephaven components package\nimport { useConnection } from '@deephaven/jsapi-components';\nimport type { VariableDefinition } from '@deephaven/jsapi-types';\nimport { fetchVariableDefinition } from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { WidgetView } from '@deephaven/plugin';\nimport './App.scss'; // Styles for in this app\n\nconst log = Log.module('EmbedWidget.App');\n\n/**\n * A functional React component that displays a Deephaven Widget using the @deephaven/plugin package.\n * It will attempt to open and display the widget specified with the `name` parameter, expecting it to be present on the server.\n * E.g. http://localhost:4030/?name=myWidget will attempt to open a widget `myWidget`\n * If no query param is provided, it will display an error.\n * By default, tries to connect to the server defined in the VITE_CORE_API_URL variable, which is set to http://localhost:10000/jsapi\n * See Vite docs for how to update these env vars: https://vitejs.dev/guide/env-and-mode.html\n */\nfunction App(): JSX.Element {\n const [error, setError] = useState<string>();\n const [definition, setDefinition] = useState<VariableDefinition>();\n const searchParams = useMemo(\n () => new URLSearchParams(window.location.search),\n []\n );\n // Get the widget name from the query param `name`.\n const name = searchParams.get('name');\n const connection = useConnection();\n\n useEffect(\n function initializeApp() {\n async function initApp(): Promise<void> {\n try {\n if (name == null) {\n throw new Error('Missing URL parameter \"name\"');\n }\n\n log.debug(`Loading widget definition for ${name}...`);\n\n const newDefinition = await fetchVariableDefinition(connection, name);\n\n setDefinition(newDefinition);\n\n log.debug(`Widget definition successfully loaded for ${name}`);\n } catch (e: unknown) {\n log.error(`Unable to load widget definition for ${name}`, e);\n setError(`${e}`);\n }\n }\n initApp();\n },\n [connection, name]\n );\n\n const isLoaded = definition != null && error == null;\n const isLoading = definition == null && error == null;\n\n const fetch = useMemo(() => {\n if (definition == null) {\n return async () => {\n throw new Error('Definition is null');\n };\n }\n return () => connection.getObject(definition);\n }, [connection, definition]);\n\n return (\n <div className=\"App\">\n {isLoaded && (\n <ErrorBoundary>\n <WidgetView type={definition.type} fetch={fetch} />\n </ErrorBoundary>\n )}\n {!isLoaded && (\n <LoadingOverlay\n isLoaded={isLoaded}\n isLoading={isLoading}\n errorMessage={error ?? null}\n />\n )}\n <ContextMenuRoot />\n </div>\n );\n}\n\nexport default App;\n"],"names":["log","Log","App","error","setError","useState","definition","setDefinition","name","useMemo","connection","useConnection","useEffect","initApp","newDefinition","fetchVariableDefinition","e","isLoaded","isLoading","fetch","jsxs","jsx","ErrorBoundary","WidgetView","LoadingOverlay","ContextMenuRoot"],"mappings":"4OAaA,MAAMA,EAAMC,EAAI,OAAO,iBAAiB,EAUxC,SAASC,GAAmB,CAC1B,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAiB,SAAA,EACrC,CAACC,EAAYC,CAAa,EAAIF,EAA6B,SAAA,EAM3DG,EALeC,EAAA,QACnB,IAAM,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAChD,CAAC,CAAA,EAGuB,IAAI,MAAM,EAC9BC,EAAaC,I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