@grafana/scenes 5.9.0 → 5.9.1--canary.867.10449271599.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,11 +25,13 @@ function VizPanelRenderer({ model }) {
25
25
  } = model.useState();
26
26
  const [ref, { width, height }] = useMeasure();
27
27
  const appEvents = useMemo(() => getAppEvents(), []);
28
- const setPanelAttention = useCallback(
29
- () => appEvents.publish(new SetPanelAttentionEvent({ panelId: model.state.key })),
30
- [model.state.key, appEvents]
28
+ const setPanelAttention = useCallback(() => {
29
+ appEvents.publish(new SetPanelAttentionEvent({ panelId: model.state.key }));
30
+ }, [model.state.key, appEvents]);
31
+ const debouncedMouseMove = useMemo(
32
+ () => debounce(setPanelAttention, 100, { leading: true, trailing: false }),
33
+ [setPanelAttention]
31
34
  );
32
- const debouncedMouseMove = useMemo(() => debounce(setPanelAttention, 100), [setPanelAttention]);
33
35
  const plugin = model.getPlugin();
34
36
  const { dragClass, dragClassCancel } = getDragClasses(model);
35
37
  const dataObject = sceneGraph.getData(model);
@@ -1 +1 @@
1
- {"version":3,"file":"VizPanelRenderer.js","sources":["../../../../src/components/VizPanel/VizPanelRenderer.tsx"],"sourcesContent":["import React, { RefCallback, useCallback, useMemo } from 'react';\nimport { useMeasure } from 'react-use';\n\n// @ts-ignore\nimport { AlertState, GrafanaTheme2, PanelData, PluginContextProvider, SetPanelAttentionEvent } from '@grafana/data';\n\nimport { getAppEvents } from '@grafana/runtime';\nimport { PanelChrome, ErrorBoundaryAlert, PanelContextProvider, Tooltip, useStyles2, Icon } from '@grafana/ui';\n\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { isSceneObject, SceneComponentProps, SceneLayout, SceneObject } from '../../core/types';\n\nimport { VizPanel } from './VizPanel';\nimport { css, cx } from '@emotion/css';\nimport { debounce } from 'lodash';\n\nexport function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>) {\n const {\n title,\n options,\n fieldConfig,\n _pluginLoadError,\n displayMode,\n hoverHeader,\n hoverHeaderOffset,\n menu,\n headerActions,\n titleItems,\n description,\n } = model.useState();\n const [ref, { width, height }] = useMeasure();\n const appEvents = useMemo(() => getAppEvents(), []);\n\n const setPanelAttention = useCallback(\n () => appEvents.publish(new SetPanelAttentionEvent({ panelId: model.state.key })),\n [model.state.key, appEvents]\n );\n const debouncedMouseMove = useMemo(() => debounce(setPanelAttention, 100), [setPanelAttention]);\n\n const plugin = model.getPlugin();\n\n const { dragClass, dragClassCancel } = getDragClasses(model);\n const dataObject = sceneGraph.getData(model);\n\n const rawData = dataObject.useState();\n const dataWithFieldConfig = model.applyFieldConfig(rawData.data!);\n const sceneTimeRange = sceneGraph.getTimeRange(model);\n const timeZone = sceneTimeRange.getTimeZone();\n const timeRange = model.getTimeRange(dataWithFieldConfig);\n\n // Interpolate title\n const titleInterpolated = model.interpolate(title, undefined, 'text');\n\n const alertStateStyles = useStyles2(getAlertStateStyles);\n\n if (!plugin) {\n return <div>Loading plugin panel...</div>;\n }\n\n if (!plugin.panel) {\n return <div>Panel plugin has no panel component</div>;\n }\n\n const PanelComponent = plugin.panel;\n\n // If we have a query runner on our level inform it of the container width (used to set auto max data points)\n if (dataObject && dataObject.setContainerWidth) {\n dataObject.setContainerWidth(Math.round(width));\n }\n\n let titleItemsElement: React.ReactNode[] = [];\n\n if (titleItems) {\n if (Array.isArray(titleItems)) {\n titleItemsElement = titleItemsElement.concat(\n titleItems.map((titleItem) => {\n return <titleItem.Component model={titleItem} key={`${titleItem.state.key}`} />;\n })\n );\n } else if (isSceneObject(titleItems)) {\n titleItemsElement.push(<titleItems.Component model={titleItems} />);\n } else {\n titleItemsElement.push(titleItems);\n }\n }\n\n // If we have local time range show that in panel header\n if (model.state.$timeRange) {\n titleItemsElement.push(<model.state.$timeRange.Component model={model.state.$timeRange} key={model.state.key} />);\n }\n\n if (dataWithFieldConfig.alertState) {\n titleItemsElement.push(\n <Tooltip content={dataWithFieldConfig.alertState.state ?? 'unknown'} key={`alert-states-icon-${model.state.key}`}>\n <PanelChrome.TitleItem\n className={cx({\n [alertStateStyles.ok]: dataWithFieldConfig.alertState.state === AlertState.OK,\n [alertStateStyles.pending]: dataWithFieldConfig.alertState.state === AlertState.Pending,\n [alertStateStyles.alerting]: dataWithFieldConfig.alertState.state === AlertState.Alerting,\n })}\n >\n <Icon\n name={dataWithFieldConfig.alertState.state === 'alerting' ? 'heart-break' : 'heart'}\n className=\"panel-alert-icon\"\n size=\"md\"\n />\n </PanelChrome.TitleItem>\n </Tooltip>\n );\n }\n\n let panelMenu;\n if (menu) {\n panelMenu = <menu.Component model={menu} />;\n }\n\n let actionsElement: React.ReactNode | undefined;\n\n if (headerActions) {\n if (Array.isArray(headerActions)) {\n actionsElement = (\n <>\n {headerActions.map((action) => {\n return <action.Component model={action} key={`${action.state.key}`} />;\n })}\n </>\n );\n } else if (isSceneObject(headerActions)) {\n actionsElement = <headerActions.Component model={headerActions} />;\n } else {\n actionsElement = headerActions;\n }\n }\n\n // Data is always returned. For non-data panels, empty PanelData is returned.\n const data = dataWithFieldConfig!;\n\n const isReadyToRender = dataObject.isDataReadyToDisplay ? dataObject.isDataReadyToDisplay() : true;\n\n const context = model.getPanelContext();\n const panelId = model.getLegacyPanelId();\n\n return (\n <div className={relativeWrapper}>\n <div ref={ref as RefCallback<HTMLDivElement>} className={absoluteWrapper} data-viz-panel-key={model.state.key}>\n {width > 0 && height > 0 && (\n <PanelChrome\n title={titleInterpolated}\n description={description?.trim() ? model.getDescription : undefined}\n loadingState={data.state}\n statusMessage={getChromeStatusMessage(data, _pluginLoadError)}\n statusMessageOnClick={model.onStatusMessageClick}\n width={width}\n height={height}\n displayMode={displayMode}\n hoverHeader={hoverHeader}\n hoverHeaderOffset={hoverHeaderOffset}\n titleItems={titleItemsElement}\n dragClass={dragClass}\n actions={actionsElement}\n dragClassCancel={dragClassCancel}\n padding={plugin.noPadding ? 'none' : 'md'}\n menu={panelMenu}\n onCancelQuery={model.onCancelQuery}\n // @ts-ignore\n onFocus={setPanelAttention}\n onMouseEnter={setPanelAttention}\n onMouseMove={debouncedMouseMove}\n >\n {(innerWidth, innerHeight) => (\n <>\n <ErrorBoundaryAlert dependencies={[plugin, data]}>\n <PluginContextProvider meta={plugin.meta}>\n <PanelContextProvider value={context}>\n {isReadyToRender && (\n <PanelComponent\n id={panelId}\n data={data}\n title={title}\n timeRange={timeRange}\n timeZone={timeZone}\n options={options}\n fieldConfig={fieldConfig}\n transparent={false}\n width={innerWidth}\n height={innerHeight}\n renderCounter={0}\n replaceVariables={model.interpolate}\n onOptionsChange={model.onOptionsChange}\n onFieldConfigChange={model.onFieldConfigChange}\n onChangeTimeRange={model.onTimeRangeChange}\n eventBus={context.eventBus}\n />\n )}\n </PanelContextProvider>\n </PluginContextProvider>\n </ErrorBoundaryAlert>\n </>\n )}\n </PanelChrome>\n )}\n </div>\n </div>\n );\n}\n\nfunction getDragClasses(panel: VizPanel) {\n const parentLayout = sceneGraph.getLayout(panel);\n const isDraggable = parentLayout?.isDraggable();\n\n if (!parentLayout || !isDraggable || itemDraggingDisabled(panel, parentLayout)) {\n return { dragClass: '', dragClassCancel: '' };\n }\n\n return { dragClass: parentLayout.getDragClass?.(), dragClassCancel: parentLayout?.getDragClassCancel?.() };\n}\n\n/**\n * Walks up the parent chain until it hits the layout object, trying to find the closest SceneGridItemLike ancestor.\n * It is not always the direct parent, because the VizPanel can be wrapped in other objects.\n */\nfunction itemDraggingDisabled(item: SceneObject, layout: SceneLayout) {\n let ancestor = item.parent;\n\n while (ancestor && ancestor !== layout) {\n if ('isDraggable' in ancestor.state && ancestor.state.isDraggable === false) {\n return true;\n }\n\n ancestor = ancestor.parent;\n }\n\n return false;\n}\n\nfunction getChromeStatusMessage(data: PanelData, pluginLoadingError: string | undefined) {\n if (pluginLoadingError) {\n return pluginLoadingError;\n }\n\n let message = data.error ? data.error.message : undefined;\n\n // Handling multiple errors with a single string until we integrate VizPanel with inspector\n if (data.errors) {\n message = data.errors.map((e) => e.message).join(', ');\n }\n return message;\n}\n\nconst relativeWrapper = css({\n position: 'relative',\n width: '100%',\n height: '100%',\n});\n\n/**\n * Sadly this this absolute wrapper is needed for the panel to adopt smaller sizes.\n * The combo of useMeasure and PanelChrome makes the panel take up the width it get's but that makes it impossible to\n * Then adapt to smaller space (say resizing the browser window or undocking menu).\n */\nconst absoluteWrapper = css({\n position: 'absolute',\n width: '100%',\n height: '100%',\n});\n\nconst getAlertStateStyles = (theme: GrafanaTheme2) => {\n return {\n ok: css({\n color: theme.colors.success.text,\n }),\n pending: css({\n color: theme.colors.warning.text,\n }),\n alerting: css({\n color: theme.colors.error.text,\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgBgB,SAAA,gBAAA,CAAiB,EAAE,KAAA,EAAwC,EAAA;AAhB3E,EAAA,IAAA,EAAA,CAAA;AAiBE,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,gBAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,IAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,GACF,GAAI,MAAM,QAAS,EAAA,CAAA;AACnB,EAAA,MAAM,CAAC,GAAK,EAAA,EAAE,OAAO,MAAO,EAAC,IAAI,UAAW,EAAA,CAAA;AAC5C,EAAA,MAAM,YAAY,OAAQ,CAAA,MAAM,YAAa,EAAA,EAAG,EAAE,CAAA,CAAA;AAElD,EAAA,MAAM,iBAAoB,GAAA,WAAA;AAAA,IACxB,MAAM,SAAU,CAAA,OAAA,CAAQ,IAAI,sBAAA,CAAuB,EAAE,OAAA,EAAS,KAAM,CAAA,KAAA,CAAM,GAAI,EAAC,CAAC,CAAA;AAAA,IAChF,CAAC,KAAA,CAAM,KAAM,CAAA,GAAA,EAAK,SAAS,CAAA;AAAA,GAC7B,CAAA;AACA,EAAM,MAAA,kBAAA,GAAqB,QAAQ,MAAM,QAAA,CAAS,mBAAmB,GAAG,CAAA,EAAG,CAAC,iBAAiB,CA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A;AAAA,GACH,CAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"VizPanelRenderer.js","sources":["../../../../src/components/VizPanel/VizPanelRenderer.tsx"],"sourcesContent":["import React, { RefCallback, useCallback, useMemo } from 'react';\nimport { useMeasure } from 'react-use';\n\n// @ts-ignore\nimport { AlertState, GrafanaTheme2, PanelData, PluginContextProvider, SetPanelAttentionEvent } from '@grafana/data';\n\nimport { getAppEvents } from '@grafana/runtime';\nimport { PanelChrome, ErrorBoundaryAlert, PanelContextProvider, Tooltip, useStyles2, Icon } from '@grafana/ui';\n\nimport { sceneGraph } from '../../core/sceneGraph';\nimport { isSceneObject, SceneComponentProps, SceneLayout, SceneObject } from '../../core/types';\n\nimport { VizPanel } from './VizPanel';\nimport { css, cx } from '@emotion/css';\nimport { debounce } from 'lodash';\n\nexport function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>) {\n const {\n title,\n options,\n fieldConfig,\n _pluginLoadError,\n displayMode,\n hoverHeader,\n hoverHeaderOffset,\n menu,\n headerActions,\n titleItems,\n description,\n } = model.useState();\n const [ref, { width, height }] = useMeasure();\n const appEvents = useMemo(() => getAppEvents(), []);\n\n const setPanelAttention = useCallback(() => {\n appEvents.publish(new SetPanelAttentionEvent({ panelId: model.state.key }));\n }, [model.state.key, appEvents]);\n const debouncedMouseMove = useMemo(\n () => debounce(setPanelAttention, 100, { leading: true, trailing: false }),\n [setPanelAttention]\n );\n\n const plugin = model.getPlugin();\n\n const { dragClass, dragClassCancel } = getDragClasses(model);\n const dataObject = sceneGraph.getData(model);\n\n const rawData = dataObject.useState();\n const dataWithFieldConfig = model.applyFieldConfig(rawData.data!);\n const sceneTimeRange = sceneGraph.getTimeRange(model);\n const timeZone = sceneTimeRange.getTimeZone();\n const timeRange = model.getTimeRange(dataWithFieldConfig);\n\n // Interpolate title\n const titleInterpolated = model.interpolate(title, undefined, 'text');\n\n const alertStateStyles = useStyles2(getAlertStateStyles);\n\n if (!plugin) {\n return <div>Loading plugin panel...</div>;\n }\n\n if (!plugin.panel) {\n return <div>Panel plugin has no panel component</div>;\n }\n\n const PanelComponent = plugin.panel;\n\n // If we have a query runner on our level inform it of the container width (used to set auto max data points)\n if (dataObject && dataObject.setContainerWidth) {\n dataObject.setContainerWidth(Math.round(width));\n }\n\n let titleItemsElement: React.ReactNode[] = [];\n\n if (titleItems) {\n if (Array.isArray(titleItems)) {\n titleItemsElement = titleItemsElement.concat(\n titleItems.map((titleItem) => {\n return <titleItem.Component model={titleItem} key={`${titleItem.state.key}`} />;\n })\n );\n } else if (isSceneObject(titleItems)) {\n titleItemsElement.push(<titleItems.Component model={titleItems} />);\n } else {\n titleItemsElement.push(titleItems);\n }\n }\n\n // If we have local time range show that in panel header\n if (model.state.$timeRange) {\n titleItemsElement.push(<model.state.$timeRange.Component model={model.state.$timeRange} key={model.state.key} />);\n }\n\n if (dataWithFieldConfig.alertState) {\n titleItemsElement.push(\n <Tooltip content={dataWithFieldConfig.alertState.state ?? 'unknown'} key={`alert-states-icon-${model.state.key}`}>\n <PanelChrome.TitleItem\n className={cx({\n [alertStateStyles.ok]: dataWithFieldConfig.alertState.state === AlertState.OK,\n [alertStateStyles.pending]: dataWithFieldConfig.alertState.state === AlertState.Pending,\n [alertStateStyles.alerting]: dataWithFieldConfig.alertState.state === AlertState.Alerting,\n })}\n >\n <Icon\n name={dataWithFieldConfig.alertState.state === 'alerting' ? 'heart-break' : 'heart'}\n className=\"panel-alert-icon\"\n size=\"md\"\n />\n </PanelChrome.TitleItem>\n </Tooltip>\n );\n }\n\n let panelMenu;\n if (menu) {\n panelMenu = <menu.Component model={menu} />;\n }\n\n let actionsElement: React.ReactNode | undefined;\n\n if (headerActions) {\n if (Array.isArray(headerActions)) {\n actionsElement = (\n <>\n {headerActions.map((action) => {\n return <action.Component model={action} key={`${action.state.key}`} />;\n })}\n </>\n );\n } else if (isSceneObject(headerActions)) {\n actionsElement = <headerActions.Component model={headerActions} />;\n } else {\n actionsElement = headerActions;\n }\n }\n\n // Data is always returned. For non-data panels, empty PanelData is returned.\n const data = dataWithFieldConfig!;\n\n const isReadyToRender = dataObject.isDataReadyToDisplay ? dataObject.isDataReadyToDisplay() : true;\n\n const context = model.getPanelContext();\n const panelId = model.getLegacyPanelId();\n\n return (\n <div className={relativeWrapper}>\n <div ref={ref as RefCallback<HTMLDivElement>} className={absoluteWrapper} data-viz-panel-key={model.state.key}>\n {width > 0 && height > 0 && (\n <PanelChrome\n title={titleInterpolated}\n description={description?.trim() ? model.getDescription : undefined}\n loadingState={data.state}\n statusMessage={getChromeStatusMessage(data, _pluginLoadError)}\n statusMessageOnClick={model.onStatusMessageClick}\n width={width}\n height={height}\n displayMode={displayMode}\n hoverHeader={hoverHeader}\n hoverHeaderOffset={hoverHeaderOffset}\n titleItems={titleItemsElement}\n dragClass={dragClass}\n actions={actionsElement}\n dragClassCancel={dragClassCancel}\n padding={plugin.noPadding ? 'none' : 'md'}\n menu={panelMenu}\n onCancelQuery={model.onCancelQuery}\n // @ts-ignore\n onFocus={setPanelAttention}\n onMouseEnter={setPanelAttention}\n onMouseMove={debouncedMouseMove}\n >\n {(innerWidth, innerHeight) => (\n <>\n <ErrorBoundaryAlert dependencies={[plugin, data]}>\n <PluginContextProvider meta={plugin.meta}>\n <PanelContextProvider value={context}>\n {isReadyToRender && (\n <PanelComponent\n id={panelId}\n data={data}\n title={title}\n timeRange={timeRange}\n timeZone={timeZone}\n options={options}\n fieldConfig={fieldConfig}\n transparent={false}\n width={innerWidth}\n height={innerHeight}\n renderCounter={0}\n replaceVariables={model.interpolate}\n onOptionsChange={model.onOptionsChange}\n onFieldConfigChange={model.onFieldConfigChange}\n onChangeTimeRange={model.onTimeRangeChange}\n eventBus={context.eventBus}\n />\n )}\n </PanelContextProvider>\n </PluginContextProvider>\n </ErrorBoundaryAlert>\n </>\n )}\n </PanelChrome>\n )}\n </div>\n </div>\n );\n}\n\nfunction getDragClasses(panel: VizPanel) {\n const parentLayout = sceneGraph.getLayout(panel);\n const isDraggable = parentLayout?.isDraggable();\n\n if (!parentLayout || !isDraggable || itemDraggingDisabled(panel, parentLayout)) {\n return { dragClass: '', dragClassCancel: '' };\n }\n\n return { dragClass: parentLayout.getDragClass?.(), dragClassCancel: parentLayout?.getDragClassCancel?.() };\n}\n\n/**\n * Walks up the parent chain until it hits the layout object, trying to find the closest SceneGridItemLike ancestor.\n * It is not always the direct parent, because the VizPanel can be wrapped in other objects.\n */\nfunction itemDraggingDisabled(item: SceneObject, layout: SceneLayout) {\n let ancestor = item.parent;\n\n while (ancestor && ancestor !== layout) {\n if ('isDraggable' in ancestor.state && ancestor.state.isDraggable === false) {\n return true;\n }\n\n ancestor = ancestor.parent;\n }\n\n return false;\n}\n\nfunction getChromeStatusMessage(data: PanelData, pluginLoadingError: string | undefined) {\n if (pluginLoadingError) {\n return pluginLoadingError;\n }\n\n let message = data.error ? data.error.message : undefined;\n\n // Handling multiple errors with a single string until we integrate VizPanel with inspector\n if (data.errors) {\n message = data.errors.map((e) => e.message).join(', ');\n }\n return message;\n}\n\nconst relativeWrapper = css({\n position: 'relative',\n width: '100%',\n height: '100%',\n});\n\n/**\n * Sadly this this absolute wrapper is needed for the panel to adopt smaller sizes.\n * The combo of useMeasure and PanelChrome makes the panel take up the width it get's but that makes it impossible to\n * Then adapt to smaller space (say resizing the browser window or undocking menu).\n */\nconst absoluteWrapper = css({\n position: 'absolute',\n width: '100%',\n height: '100%',\n});\n\nconst getAlertStateStyles = (theme: GrafanaTheme2) => {\n return {\n ok: css({\n color: theme.colors.success.text,\n }),\n pending: css({\n color: theme.colors.warning.text,\n }),\n alerting: css({\n color: theme.colors.error.text,\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgBgB,SAAA,gBAAA,CAAiB,EAAE,KAAA,EAAwC,EAAA;AAhB3E,EAAA,IAAA,EAAA,CAAA;AAiBE,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,gBAAA;AAAA,IACA,W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AAA,GACvD;AACA,EAAO,OAAA,OAAA,CAAA;AACT,CAAA;AAEA,MAAM,kBAAkB,GAAI,CAAA;AAAA,EAC1B,QAAU,EAAA,UAAA;AAAA,EACV,KAAO,EAAA,MAAA;AAAA,EACP,MAAQ,EAAA,MAAA;AACV,CAAC,CAAA,CAAA;AAOD,MAAM,kBAAkB,GAAI,CAAA;AAAA,EAC1B,QAAU,EAAA,UAAA;AAAA,EACV,KAAO,EAAA,MAAA;AAAA,EACP,MAAQ,EAAA,MAAA;AACV,CAAC,CAAA,CAAA;AAED,MAAM,mBAAA,GAAsB,CAAC,KAAyB,KAAA;AACpD,EAAO,OAAA;AAAA,IACL,IAAI,GAAI,CAAA;AAAA,MACN,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,OAAQ,CAAA,IAAA;AAAA,KAC7B,CAAA;AAAA,IACD,SAAS,GAAI,CAAA;AAAA,MACX,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,OAAQ,CAAA,IAAA;AAAA,KAC7B,CAAA;AAAA,IACD,UAAU,GAAI,CAAA;AAAA,MACZ,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,KAAM,CAAA,IAAA;AAAA,KAC3B,CAAA;AAAA,GACH,CAAA;AACF,CAAA;;;;"}
package/dist/index.js CHANGED
@@ -5270,11 +5270,13 @@ function VizPanelRenderer({ model }) {
5270
5270
  } = model.useState();
5271
5271
  const [ref, { width, height }] = reactUse.useMeasure();
5272
5272
  const appEvents = React.useMemo(() => runtime.getAppEvents(), []);
5273
- const setPanelAttention = React.useCallback(
5274
- () => appEvents.publish(new data.SetPanelAttentionEvent({ panelId: model.state.key })),
5275
- [model.state.key, appEvents]
5273
+ const setPanelAttention = React.useCallback(() => {
5274
+ appEvents.publish(new data.SetPanelAttentionEvent({ panelId: model.state.key }));
5275
+ }, [model.state.key, appEvents]);
5276
+ const debouncedMouseMove = React.useMemo(
5277
+ () => lodash.debounce(setPanelAttention, 100, { leading: true, trailing: false }),
5278
+ [setPanelAttention]
5276
5279
  );
5277
- const debouncedMouseMove = React.useMemo(() => lodash.debounce(setPanelAttention, 100), [setPanelAttention]);
5278
5280
  const plugin = model.getPlugin();
5279
5281
  const { dragClass, dragClassCancel } = getDragClasses(model);
5280
5282
  const dataObject = sceneGraph.getData(model);