@grafana/scenes 5.25.0 → 5.25.1--canary.967.11837797508.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,7 +39,8 @@ class SceneGridRow extends SceneObjectBase {
39
39
  width: GRID_COLUMN_COUNT
40
40
  }));
41
41
  this._variableDependency = new VariableDependencyConfig(this, {
42
- statePaths: ["title"]
42
+ statePaths: ["title"],
43
+ handleTimeMacros: true
43
44
  });
44
45
  this.onCollapseToggle = () => {
45
46
  if (!this.state.isCollapsible) {
@@ -1 +1 @@
1
- {"version":3,"file":"SceneGridRow.js","sources":["../../../../../src/components/layout/grid/SceneGridRow.tsx"],"sourcesContent":["import { css, cx } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Icon, useStyles2 } from '@grafana/ui';\n\nimport { SceneObjectBase } from '../../../core/SceneObjectBase';\nimport { SceneComponentProps, SceneObject, SceneObjectUrlValues } from '../../../core/types';\n\nimport { SceneGridLayout } from './SceneGridLayout';\nimport { GRID_COLUMN_COUNT } from './constants';\nimport { SceneGridItemLike, SceneGridItemStateLike } from './types';\nimport { sceneGraph } from '../../../core/sceneGraph';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { VariableDependencyConfig } from '../../../variables/VariableDependencyConfig';\n\nexport interface SceneGridRowState extends SceneGridItemStateLike {\n title: string;\n isCollapsible?: boolean;\n isCollapsed?: boolean;\n actions?: SceneObject;\n children: SceneGridItemLike[];\n}\n\nexport class SceneGridRow extends SceneObjectBase<SceneGridRowState> {\n public static Component = SceneGridRowRenderer;\n\n protected _variableDependency = new VariableDependencyConfig(this, {\n statePaths: ['title'],\n });\n\n public constructor(state: Partial<SceneGridRowState>) {\n super({\n children: state.children || [],\n isCollapsible: state.isCollapsible || true,\n title: state.title || '',\n ...state,\n x: 0,\n height: 1,\n width: GRID_COLUMN_COUNT,\n });\n }\n\n public getGridLayout(): SceneGridLayout {\n const layout = this.parent;\n\n if (!layout || !(layout instanceof SceneGridLayout)) {\n throw new Error('SceneGridRow must be a child of SceneGridLayout');\n }\n\n return layout;\n }\n\n public onCollapseToggle = () => {\n if (!this.state.isCollapsible) {\n return;\n }\n\n this.getGridLayout().toggleRow(this);\n };\n\n public getUrlState() {\n return { rowc: this.state.isCollapsed ? '1' : '0' };\n }\n\n public updateFromUrl(values: SceneObjectUrlValues) {\n if (values.rowc == null) {\n return;\n }\n\n if (values.rowc !== this.getUrlState().rowc) {\n this.onCollapseToggle();\n }\n }\n}\n\nexport function SceneGridRowRenderer({ model }: SceneComponentProps<SceneGridRow>) {\n const styles = useStyles2(getSceneGridRowStyles);\n const { isCollapsible, isCollapsed, title, actions, children } = model.useState();\n const layout = model.getGridLayout();\n const layoutDragClass = layout.getDragClass();\n const isDraggable = layout.isDraggable();\n\n const count = children ? children.length : 0;\n const panels = count === 1 ? 'panel' : 'panels';\n\n return (\n <div className={cx(styles.row, isCollapsed && styles.rowCollapsed)}>\n <div className={styles.rowTitleAndActionsGroup}>\n <button\n onClick={model.onCollapseToggle}\n className={styles.rowTitleButton}\n aria-label={isCollapsed ? 'Expand row' : 'Collapse row'}\n data-testid={selectors.components.DashboardRow.title(sceneGraph.interpolate(model, title, undefined, 'text'))}\n >\n {isCollapsible && <Icon name={isCollapsed ? 'angle-right' : 'angle-down'} />}\n <span className={styles.rowTitle} role=\"heading\">\n {sceneGraph.interpolate(model, title, undefined, 'text')}\n </span>\n </button>\n <span className={cx(styles.panelCount, isCollapsed && styles.panelCountCollapsed)}>\n ({count} {panels})\n </span>\n {actions && (\n <div className={styles.rowActions}>\n <actions.Component model={actions} />\n </div>\n )}\n </div>\n {isDraggable && isCollapsed && (\n <div className={cx(styles.dragHandle, layoutDragClass)}>\n <Icon name=\"draggabledots\" />\n </div>\n )}\n </div>\n );\n}\n\nexport const getSceneGridRowStyles = (theme: GrafanaTheme2) => {\n return {\n row: css({\n width: '100%',\n height: '30px',\n display: 'flex',\n justifyContent: 'space-between',\n gap: theme.spacing(1),\n }),\n rowTitleButton: css({\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n background: 'transparent',\n border: 'none',\n minWidth: 0,\n gap: theme.spacing(1),\n }),\n rowCollapsed: css({\n borderBottom: `1px solid ${theme.colors.border.weak}`,\n }),\n rowTitle: css({\n fontSize: theme.typography.h5.fontSize,\n fontWeight: theme.typography.fontWeightMedium,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '100%',\n flexGrow: 1,\n minWidth: 0,\n }),\n collapsedInfo: css({\n fontSize: theme.typography.bodySmall.fontSize,\n color: theme.colors.text.secondary,\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n rowTitleAndActionsGroup: css({\n display: 'flex',\n minWidth: 0,\n\n '&:hover, &:focus-within': {\n '& > div': {\n opacity: 1,\n },\n },\n }),\n rowActions: css({\n display: 'flex',\n whiteSpace: 'nowrap',\n opacity: 0,\n transition: '200ms opacity ease-in 200ms',\n\n '&:hover, &:focus-within': {\n opacity: 1,\n },\n }),\n dragHandle: css({\n display: 'flex',\n padding: theme.spacing(0, 1),\n alignItems: 'center',\n justifyContent: 'flex-end',\n cursor: 'move',\n color: theme.colors.text.secondary,\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n panelCount: css({\n whiteSpace: 'nowrap',\n paddingLeft: theme.spacing(2),\n color: theme.colors.text.secondary,\n fontStyle: 'italic',\n fontSize: theme.typography.size.sm,\n fontWeight: 'normal',\n display: 'none',\n lineHeight: '30px',\n }),\n panelCountCollapsed: css({\n display: 'inline-block',\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,qBAAqB,eAAmC,CAAA;AAAA,EAO5D,YAAY,KAAmC,EAAA;AACpD,IAAM,KAAA,CAAA,aAAA,CAAA,cAAA,CAAA;AAAA,MACJ,QAAA,EAAU,KAAM,CAAA,QAAA,IAAY,EAAC;AAAA,MAC7B,aAAA,EAAe,MAAM,aAAiB,IAAA,IAAA;AAAA,MAC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AAA;AAAA,MACd,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,OAAS,EAAA,CAAA;AAAA,MACT,UAAY,EAAA,6BAAA;AAAA,MAEZ,yBAA2B,EAAA;AAAA,QACzB,OAAS,EAAA,CAAA;AAAA,OACX;AAAA,KACD,CAAA;AAAA,IACD,YAAY,GAAI,CAAA;AAAA,MACd,OAAS,EAAA,MAAA;AAAA,MACT,OAAS,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,MAC3B,UAAY,EAAA,QAAA;AAAA,MACZ,cAAgB,EAAA,UAAA;AAAA,MAChB,MAAQ,EAAA,MAAA;AAAA,MACR,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,MACzB,SAAW,EAAA;AAAA,QACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,OAC3B;AAAA,KACD,CAAA;AAAA,IACD,YAAY,GAAI,CAAA;AAAA,MACd,UAAY,EAAA,QAAA;AAAA,MACZ,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC5B,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,MACzB,SAAW,EAAA,QAAA;AAAA,MACX,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,IAAK,CAAA,EAAA;AAAA,MAChC,UAAY,EAAA,QAAA;AAAA,MACZ,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,MAAA;AAAA,KACb,CAAA;AAAA,IACD,qBAAqB,GAAI,CAAA;AAAA,MACvB,OAAS,EAAA,cAAA;AAAA,KACV,CAAA;AAAA,GACH,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"SceneGridRow.js","sources":["../../../../../src/components/layout/grid/SceneGridRow.tsx"],"sourcesContent":["import { css, cx } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Icon, useStyles2 } from '@grafana/ui';\n\nimport { SceneObjectBase } from '../../../core/SceneObjectBase';\nimport { SceneComponentProps, SceneObject, SceneObjectUrlValues } from '../../../core/types';\n\nimport { SceneGridLayout } from './SceneGridLayout';\nimport { GRID_COLUMN_COUNT } from './constants';\nimport { SceneGridItemLike, SceneGridItemStateLike } from './types';\nimport { sceneGraph } from '../../../core/sceneGraph';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { VariableDependencyConfig } from '../../../variables/VariableDependencyConfig';\n\nexport interface SceneGridRowState extends SceneGridItemStateLike {\n title: string;\n isCollapsible?: boolean;\n isCollapsed?: boolean;\n actions?: SceneObject;\n children: SceneGridItemLike[];\n}\n\nexport class SceneGridRow extends SceneObjectBase<SceneGridRowState> {\n public static Component = SceneGridRowRenderer;\n\n protected _variableDependency = new VariableDependencyConfig(this, {\n statePaths: ['title'],\n handleTimeMacros: true,\n });\n\n public constructor(state: Partial<SceneGridRowState>) {\n super({\n children: state.children || [],\n isCollapsible: state.isCollapsible || true,\n title: state.title || '',\n ...state,\n x: 0,\n height: 1,\n width: GRID_COLUMN_COUNT,\n });\n }\n\n public getGridLayout(): SceneGridLayout {\n const layout = this.parent;\n\n if (!layout || !(layout instanceof SceneGridLayout)) {\n throw new Error('SceneGridRow must be a child of SceneGridLayout');\n }\n\n return layout;\n }\n\n public onCollapseToggle = () => {\n if (!this.state.isCollapsible) {\n return;\n }\n\n this.getGridLayout().toggleRow(this);\n };\n\n public getUrlState() {\n return { rowc: this.state.isCollapsed ? '1' : '0' };\n }\n\n public updateFromUrl(values: SceneObjectUrlValues) {\n if (values.rowc == null) {\n return;\n }\n\n if (values.rowc !== this.getUrlState().rowc) {\n this.onCollapseToggle();\n }\n }\n}\n\nexport function SceneGridRowRenderer({ model }: SceneComponentProps<SceneGridRow>) {\n const styles = useStyles2(getSceneGridRowStyles);\n const { isCollapsible, isCollapsed, title, actions, children } = model.useState();\n const layout = model.getGridLayout();\n const layoutDragClass = layout.getDragClass();\n const isDraggable = layout.isDraggable();\n\n const count = children ? children.length : 0;\n const panels = count === 1 ? 'panel' : 'panels';\n\n return (\n <div className={cx(styles.row, isCollapsed && styles.rowCollapsed)}>\n <div className={styles.rowTitleAndActionsGroup}>\n <button\n onClick={model.onCollapseToggle}\n className={styles.rowTitleButton}\n aria-label={isCollapsed ? 'Expand row' : 'Collapse row'}\n data-testid={selectors.components.DashboardRow.title(sceneGraph.interpolate(model, title, undefined, 'text'))}\n >\n {isCollapsible && <Icon name={isCollapsed ? 'angle-right' : 'angle-down'} />}\n <span className={styles.rowTitle} role=\"heading\">\n {sceneGraph.interpolate(model, title, undefined, 'text')}\n </span>\n </button>\n <span className={cx(styles.panelCount, isCollapsed && styles.panelCountCollapsed)}>\n ({count} {panels})\n </span>\n {actions && (\n <div className={styles.rowActions}>\n <actions.Component model={actions} />\n </div>\n )}\n </div>\n {isDraggable && isCollapsed && (\n <div className={cx(styles.dragHandle, layoutDragClass)}>\n <Icon name=\"draggabledots\" />\n </div>\n )}\n </div>\n );\n}\n\nexport const getSceneGridRowStyles = (theme: GrafanaTheme2) => {\n return {\n row: css({\n width: '100%',\n height: '30px',\n display: 'flex',\n justifyContent: 'space-between',\n gap: theme.spacing(1),\n }),\n rowTitleButton: css({\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n background: 'transparent',\n border: 'none',\n minWidth: 0,\n gap: theme.spacing(1),\n }),\n rowCollapsed: css({\n borderBottom: `1px solid ${theme.colors.border.weak}`,\n }),\n rowTitle: css({\n fontSize: theme.typography.h5.fontSize,\n fontWeight: theme.typography.fontWeightMedium,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '100%',\n flexGrow: 1,\n minWidth: 0,\n }),\n collapsedInfo: css({\n fontSize: theme.typography.bodySmall.fontSize,\n color: theme.colors.text.secondary,\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n rowTitleAndActionsGroup: css({\n display: 'flex',\n minWidth: 0,\n\n '&:hover, &:focus-within': {\n '& > div': {\n opacity: 1,\n },\n },\n }),\n rowActions: css({\n display: 'flex',\n whiteSpace: 'nowrap',\n opacity: 0,\n transition: '200ms opacity ease-in 200ms',\n\n '&:hover, &:focus-within': {\n opacity: 1,\n },\n }),\n dragHandle: css({\n display: 'flex',\n padding: theme.spacing(0, 1),\n alignItems: 'center',\n justifyContent: 'flex-end',\n cursor: 'move',\n color: theme.colors.text.secondary,\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n panelCount: css({\n whiteSpace: 'nowrap',\n paddingLeft: theme.spacing(2),\n color: theme.colors.text.secondary,\n fontStyle: 'italic',\n fontSize: theme.typography.size.sm,\n fontWeight: 'normal',\n display: 'none',\n lineHeight: '30px',\n }),\n panelCountCollapsed: css({\n display: 'inline-block',\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,qBAAqB,eAAmC,CAAA;AAAA,EAQ5D,YAAY,KAAmC,EAAA;AACpD,IAAM,KAAA,CAAA,aAAA,CAAA,cAAA,CAAA;AAAA,MACJ,QAAA,EAAU,KAAM,CAAA,QAAA,IAAY,EAAC;AAAA,MAC7B,aAAA,EAAe,MAAM,aAAiB,IAAA,IAAA;AAAA,MACtC,KAAA,EAAO,MAAM,KAAS,IAAA,EAAA;AAAA,KAAA,EACnB,KAJC,CAAA,EAAA;AAAA,MAKJ,CAAG,EAAA,CAAA;AAAA,MACH,MAAQ,EAAA,CAAA;AAAA,MACR,KAAO,EAAA,iBAAA;AAAA,KACR,CAAA,CAAA,CAAA;AAdH,IAAU,IAAA,CAAA,mBAAA,GAAsB,IAAI,wBAAA,CAAyB,IAAM,EAAA;AAAA,MACjE,UAAA,EAAY,CAAC,OAAO,CAAA;AAAA,MACpB,gBAAkB,EAAA,IAAA;AAAA,KACnB,CAAA,CAAA;AAwBD,IAAA,IAAA,CAAO,mBAAmB,MAAM;AAC9B,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,cAAgB,EAAA,UAAA;AAAA,MAChB,MAAQ,EAAA,MAAA;AAAA,MACR,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,MACzB,SAAW,EAAA;AAAA,QACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,OAC3B;AAAA,KACD,CAAA;AAAA,IACD,YAAY,GAAI,CAAA;AAAA,MACd,UAAY,EAAA,QAAA;AAAA,MACZ,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC5B,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,MACzB,SAAW,EAAA,QAAA;AAAA,MACX,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,IAAK,CAAA,EAAA;AAAA,MAChC,UAAY,EAAA,QAAA;AAAA,MACZ,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,MAAA;AAAA,KACb,CAAA;AAAA,IACD,qBAAqB,GAAI,CAAA;AAAA,MACvB,OAAS,EAAA,cAAA;AAAA,KACV,CAAA;AAAA,GACH,CAAA;AACF;;;;"}
@@ -41,6 +41,8 @@ function cloneSceneObjectState(sceneState, withState) {
41
41
  for (const child of propValue) {
42
42
  if (child instanceof SceneObjectBase) {
43
43
  newArray.push(child.clone());
44
+ } else if (typeof child === "object") {
45
+ newArray.push(__spreadValues({}, child));
44
46
  } else {
45
47
  newArray.push(child);
46
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/core/sceneGraph/utils.ts"],"sourcesContent":["import { SceneObject, SceneObjectState } from '../types';\n\nimport { SceneObjectBase } from '../SceneObjectBase';\nimport { SceneObjectRef } from '../SceneObjectRef';\n\n/**\n * Will create new SceneItem with shalled cloned state, but all states items of type SceneObject are deep cloned\n */\nexport function cloneSceneObject<T extends SceneObjectBase<TState>, TState extends SceneObjectState>(\n sceneObject: SceneObjectBase<TState>,\n withState?: Partial<TState>\n): T {\n const clonedState = cloneSceneObjectState(sceneObject.state, withState);\n return new (sceneObject.constructor as any)(clonedState);\n}\n\nexport function cloneSceneObjectState<TState extends SceneObjectState>(\n sceneState: TState,\n withState?: Partial<TState>\n): TState {\n const clonedState = { ...sceneState };\n\n Object.assign(clonedState, withState);\n\n // Clone any SceneItems in state\n for (const key in clonedState) {\n // Do not clone if was part of withState\n if (withState && withState[key] !== undefined) {\n continue;\n }\n\n const propValue = clonedState[key];\n if (propValue instanceof SceneObjectBase) {\n clonedState[key] = propValue.clone();\n }\n\n if (propValue instanceof SceneObjectRef) {\n console.warn('Cloning object with SceneObjectRef');\n continue;\n }\n\n // Clone scene objects in arrays\n if (Array.isArray(propValue)) {\n const newArray: any = [];\n for (const child of propValue) {\n if (child instanceof SceneObjectBase) {\n newArray.push(child.clone());\n } else {\n newArray.push(child);\n }\n }\n clonedState[key] = newArray;\n }\n }\n\n return clonedState;\n}\n\n/** Walks up the scene graph, returning the first non-undefined result of `extract` */\nexport function getClosest<T>(sceneObject: SceneObject, extract: (s: SceneObject) => T | undefined): T | undefined {\n let curSceneObject: SceneObject | undefined = sceneObject;\n let extracted: T | undefined = undefined;\n\n while (curSceneObject && !extracted) {\n extracted = extract(curSceneObject);\n curSceneObject = curSceneObject.parent;\n }\n\n return extracted;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAQgB,SAAA,gBAAA,CACd,aACA,SACG,EAAA;AACH,EAAA,MAAM,WAAc,GAAA,qBAAA,CAAsB,WAAY,CAAA,KAAA,EAAO,SAAS,CAAA,CAAA;AACtE,EAAO,OAAA,IAAK,WAAY,CAAA,WAAA,CAAoB,WAAW,CAAA,CAAA;AACzD,CAAA;AAEgB,SAAA,qBAAA,CACd,YACA,SACQ,EAAA;AACR,EAAA,MAAM,cAAc,cAAK,CAAA,EAAA,EAAA,UAAA,CAAA,CAAA;AAEzB,EAAO,MAAA,CAAA,MAAA,CAAO,aAAa,SAAS,CAAA,CAA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,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/core/sceneGraph/utils.ts"],"sourcesContent":["import { SceneObject, SceneObjectState } from '../types';\n\nimport { SceneObjectBase } from '../SceneObjectBase';\nimport { SceneObjectRef } from '../SceneObjectRef';\n\n/**\n * Will create new SceneItem with shalled cloned state, but all states items of type SceneObject are deep cloned\n */\nexport function cloneSceneObject<T extends SceneObjectBase<TState>, TState extends SceneObjectState>(\n sceneObject: SceneObjectBase<TState>,\n withState?: Partial<TState>\n): T {\n const clonedState = cloneSceneObjectState(sceneObject.state, withState);\n return new (sceneObject.constructor as any)(clonedState);\n}\n\nexport function cloneSceneObjectState<TState extends SceneObjectState>(\n sceneState: TState,\n withState?: Partial<TState>\n): TState {\n const clonedState = { ...sceneState };\n\n Object.assign(clonedState, withState);\n\n // Clone any SceneItems in state\n for (const key in clonedState) {\n // Do not clone if was part of withState\n if (withState && withState[key] !== undefined) {\n continue;\n }\n\n const propValue = clonedState[key];\n if (propValue instanceof SceneObjectBase) {\n clonedState[key] = propValue.clone();\n }\n\n if (propValue instanceof SceneObjectRef) {\n console.warn('Cloning object with SceneObjectRef');\n continue;\n }\n\n // Clone scene objects in arrays\n if (Array.isArray(propValue)) {\n const newArray: any = [];\n for (const child of propValue) {\n if (child instanceof SceneObjectBase) {\n newArray.push(child.clone());\n } else if (typeof child === 'object') {\n newArray.push({ ...child });\n } else {\n newArray.push(child);\n }\n }\n clonedState[key] = newArray;\n }\n }\n\n return clonedState;\n}\n\n/** Walks up the scene graph, returning the first non-undefined result of `extract` */\nexport function getClosest<T>(sceneObject: SceneObject, extract: (s: SceneObject) => T | undefined): T | undefined {\n let curSceneObject: SceneObject | undefined = sceneObject;\n let extracted: T | undefined = undefined;\n\n while (curSceneObject && !extracted) {\n extracted = extract(curSceneObject);\n curSceneObject = curSceneObject.parent;\n }\n\n return extracted;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAQgB,SAAA,gBAAA,CACd,a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AAA;AAAA,SACrB;AAAA,OACF;AACA,MAAA,WAAA,CAAY,GAAO,CAAA,GAAA,QAAA,CAAA;AAAA,KACrB;AAAA,GACF;AAEA,EAAO,OAAA,WAAA,CAAA;AACT,CAAA;AAGgB,SAAA,UAAA,CAAc,aAA0B,OAA2D,EAAA;AACjH,EAAA,IAAI,cAA0C,GAAA,WAAA,CAAA;AAC9C,EAAA,IAAI,SAA2B,GAAA,KAAA,CAAA,CAAA;AAE/B,EAAO,OAAA,cAAA,IAAkB,CAAC,SAAW,EAAA;AACnC,IAAA,SAAA,GAAY,QAAQ,cAAc,CAAA,CAAA;AAClC,IAAA,cAAA,GAAiB,cAAe,CAAA,MAAA,CAAA;AAAA,GAClC;AAEA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
@@ -3,6 +3,7 @@ import { sceneGraph } from '../core/sceneGraph/index.js';
3
3
  import { writeSceneLog } from '../utils/writeSceneLog.js';
4
4
  import { VARIABLE_REGEX } from './constants.js';
5
5
  import { safeStringifyValue } from './utils.js';
6
+ import { ConstantVariable } from './variants/ConstantVariable.js';
6
7
 
7
8
  class VariableDependencyConfig {
8
9
  constructor(_sceneObject, _options) {
@@ -12,6 +13,9 @@ class VariableDependencyConfig {
12
13
  this._isWaitingForVariables = false;
13
14
  this.scanCount = 0;
14
15
  this._statePaths = _options.statePaths;
16
+ if (this._options.handleTimeMacros) {
17
+ this.handleTimeMacros();
18
+ }
15
19
  }
16
20
  hasDependencyOn(name) {
17
21
  return this.getNames().has(name);
@@ -115,6 +119,31 @@ class VariableDependencyConfig {
115
119
  this._dependencies.add(variableName);
116
120
  }
117
121
  }
122
+ handleTimeMacros() {
123
+ this._sceneObject.addActivationHandler(() => {
124
+ const timeRange = sceneGraph.getTimeRange(this._sceneObject);
125
+ const sub = timeRange.subscribeToState((newState, oldState) => {
126
+ const deps = this.getNames();
127
+ const hasFromDep = deps.has("__from");
128
+ const hasToDep = deps.has("__to");
129
+ const hasTimeZone = deps.has("__timezone");
130
+ if (newState.value !== oldState.value) {
131
+ if (hasFromDep) {
132
+ const variable = new ConstantVariable({ name: "__from", value: newState.from });
133
+ this.variableUpdateCompleted(variable, true);
134
+ } else if (hasToDep) {
135
+ const variable = new ConstantVariable({ name: "__to", value: newState.to });
136
+ this.variableUpdateCompleted(variable, true);
137
+ }
138
+ }
139
+ if (newState.timeZone !== oldState.timeZone && hasTimeZone) {
140
+ const variable = new ConstantVariable({ name: "__timezone", value: newState.timeZone });
141
+ this.variableUpdateCompleted(variable, true);
142
+ }
143
+ });
144
+ return () => sub.unsubscribe();
145
+ });
146
+ }
118
147
  }
119
148
 
120
149
  export { VariableDependencyConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"VariableDependencyConfig.js","sources":["../../../src/variables/VariableDependencyConfig.ts"],"sourcesContent":["import { DataLinkBuiltInVars } from '@grafana/data';\nimport { sceneGraph } from '../core/sceneGraph';\nimport { SceneObject, SceneObjectState } from '../core/types';\nimport { writeSceneLog } from '../utils/writeSceneLog';\nimport { VARIABLE_REGEX } from './constants';\n\nimport { SceneVariable, SceneVariableDependencyConfigLike } from './types';\nimport { safeStringifyValue } from './utils';\n\ninterface VariableDependencyConfigOptions<TState extends SceneObjectState> {\n /**\n * State paths to scan / extract variable dependencies from. Leave empty to scan all paths.\n */\n statePaths?: Array<keyof TState | '*'>;\n\n /**\n * Explicit list of variable names to depend on. Leave empty to scan state for dependencies.\n */\n variableNames?: string[];\n\n /**\n * Optional way to customize how to handle when a dependent variable changes\n * If not specified the default behavior is to trigger a re-render\n */\n onReferencedVariableValueChanged?: (variable: SceneVariable) => void;\n\n /**\n * Two scenarios trigger this callback to be called.\n * 1. When any direct dependency changed value\n * 2. In case hasDependencyInLoadingState was called and returned true we really care about any variable update. So in this scenario this callback is called\n * after any variable update completes. This is to cover scenarios where an object is waiting for indirect dependencies to complete.\n */\n onVariableUpdateCompleted?: () => void;\n\n /**\n * Optional way to subscribe to all variable value changes, even to variables that are not dependencies.\n */\n onAnyVariableChanged?: (variable: SceneVariable) => void;\n}\n\nexport class VariableDependencyConfig<TState extends SceneObjectState> implements SceneVariableDependencyConfigLike {\n private _state: TState | undefined;\n private _dependencies = new Set<string>();\n private _statePaths?: Array<keyof TState | '*'>;\n private _isWaitingForVariables = false;\n\n public scanCount = 0;\n\n public constructor(\n private _sceneObject: SceneObject<TState>,\n private _options: VariableDependencyConfigOptions<TState>\n ) {\n this._statePaths = _options.statePaths;\n }\n\n /**\n * Used to check for dependency on a specific variable\n */\n public hasDependencyOn(name: string): boolean {\n return this.getNames().has(name);\n }\n\n /**\n * This is called whenever any set of variables have new values. It is up to this implementation to check if it's relevant given the current dependencies.\n */\n public variableUpdateCompleted(variable: SceneVariable, hasChanged: boolean) {\n const deps = this.getNames();\n let dependencyChanged = false;\n\n if ((deps.has(variable.state.name) || deps.has(DataLinkBuiltInVars.includeVars)) && hasChanged) {\n dependencyChanged = true;\n }\n\n writeSceneLog(\n 'VariableDependencyConfig',\n 'variableUpdateCompleted',\n variable.state.name,\n dependencyChanged,\n this._isWaitingForVariables\n );\n\n if (this._options.onAnyVariableChanged) {\n this._options.onAnyVariableChanged(variable);\n }\n\n // If custom handler called when dependency is changed or when we are waiting for variables\n if (this._options.onVariableUpdateCompleted && (this._isWaitingForVariables || dependencyChanged)) {\n this._options.onVariableUpdateCompleted();\n }\n\n if (dependencyChanged) {\n if (this._options.onReferencedVariableValueChanged) {\n this._options.onReferencedVariableValueChanged(variable);\n }\n\n // if no callbacks are specified then just do a forceRender\n if (!this._options.onReferencedVariableValueChanged && !this._options.onVariableUpdateCompleted) {\n this._sceneObject.forceRender();\n }\n }\n }\n\n public hasDependencyInLoadingState() {\n if (sceneGraph.hasVariableDependencyInLoadingState(this._sceneObject)) {\n this._isWaitingForVariables = true;\n return true;\n }\n\n this._isWaitingForVariables = false;\n return false;\n }\n\n public getNames(): Set<string> {\n const prevState = this._state;\n const newState = (this._state = this._sceneObject.state);\n\n if (!prevState) {\n // First time we always scan for dependencies\n this.scanStateForDependencies(this._state);\n return this._dependencies;\n }\n\n // Second time we only scan if state is a different and if any specific state path has changed\n if (newState !== prevState) {\n if (this._statePaths) {\n for (const path of this._statePaths) {\n if (path === '*' || newState[path] !== prevState[path]) {\n this.scanStateForDependencies(newState);\n break;\n }\n }\n } else {\n this.scanStateForDependencies(newState);\n }\n }\n\n return this._dependencies;\n }\n\n /**\n * Update variableNames\n */\n public setVariableNames(varNames: string[]) {\n this._options.variableNames = varNames;\n this.scanStateForDependencies(this._state!);\n }\n\n public setPaths(paths: Array<keyof TState | '*'>) {\n this._statePaths = paths;\n }\n\n private scanStateForDependencies(state: TState) {\n this._dependencies.clear();\n this.scanCount += 1;\n\n if (this._options.variableNames) {\n for (const name of this._options.variableNames) {\n this._dependencies.add(name);\n }\n }\n\n if (this._statePaths) {\n for (const path of this._statePaths) {\n if (path === '*') {\n this.extractVariablesFrom(state);\n break;\n } else {\n const value = state[path];\n if (value) {\n this.extractVariablesFrom(value);\n }\n }\n }\n }\n }\n\n private extractVariablesFrom(value: unknown) {\n VARIABLE_REGEX.lastIndex = 0;\n\n const stringToCheck = typeof value !== 'string' ? safeStringifyValue(value) : value;\n\n const matches = stringToCheck.matchAll(VARIABLE_REGEX);\n if (!matches) {\n return;\n }\n\n for (const match of matches) {\n const [, var1, var2, , var3] = match;\n const variableName = var1 || var2 || var3;\n this._dependencies.add(variableName);\n }\n }\n}\n"],"names":[],"mappings":";;;;;;AAwCO,MAAM,wBAAuG,CAAA;AAAA,EAQ3G,WAAA,CACG,cACA,QACR,EAAA;AAFQ,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA,CAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AARV,IAAQ,IAAA,CAAA,aAAA,uBAAoB,GAAY,EAAA,CAAA;AAExC,IAAA,IAAA,CAAQ,sBAAyB,GAAA,KAAA,CAAA;AAEjC,IAAA,IAAA,CAAO,SAAY,GAAA,CAAA,CAAA;AAMjB,IAAA,IAAA,CAAK,cAAc,QA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A,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,MAAA,MAAM,GAAG,IAAA,EAAM,IAAM,IAAE,IAAI,CAAI,GAAA,KAAA,CAAA;AAC/B,MAAM,MAAA,YAAA,GAAe,QAAQ,IAAQ,IAAA,IAAA,CAAA;AACrC,MAAK,IAAA,CAAA,aAAA,CAAc,IAAI,YAAY,CAAA,CAAA;AAAA,KACrC;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"VariableDependencyConfig.js","sources":["../../../src/variables/VariableDependencyConfig.ts"],"sourcesContent":["import { DataLinkBuiltInVars } from '@grafana/data';\nimport { sceneGraph } from '../core/sceneGraph';\nimport { SceneObject, SceneObjectState } from '../core/types';\nimport { writeSceneLog } from '../utils/writeSceneLog';\nimport { VARIABLE_REGEX } from './constants';\n\nimport { SceneVariable, SceneVariableDependencyConfigLike } from './types';\nimport { safeStringifyValue } from './utils';\nimport { ConstantVariable } from './variants/ConstantVariable';\n\ninterface VariableDependencyConfigOptions<TState extends SceneObjectState> {\n /**\n * State paths to scan / extract variable dependencies from. Leave empty to scan all paths.\n */\n statePaths?: Array<keyof TState | '*'>;\n\n /**\n * Explicit list of variable names to depend on. Leave empty to scan state for dependencies.\n */\n variableNames?: string[];\n\n /**\n * Optional way to customize how to handle when a dependent variable changes\n * If not specified the default behavior is to trigger a re-render\n */\n onReferencedVariableValueChanged?: (variable: SceneVariable) => void;\n\n /**\n * Two scenarios trigger this callback to be called.\n * 1. When any direct dependency changed value\n * 2. In case hasDependencyInLoadingState was called and returned true we really care about any variable update. So in this scenario this callback is called\n * after any variable update completes. This is to cover scenarios where an object is waiting for indirect dependencies to complete.\n */\n onVariableUpdateCompleted?: () => void;\n\n /**\n * Optional way to subscribe to all variable value changes, even to variables that are not dependencies.\n */\n onAnyVariableChanged?: (variable: SceneVariable) => void;\n\n /**\n * Handle time macros.\n */\n handleTimeMacros?: boolean;\n}\n\nexport class VariableDependencyConfig<TState extends SceneObjectState> implements SceneVariableDependencyConfigLike {\n private _state: TState | undefined;\n private _dependencies = new Set<string>();\n private _statePaths?: Array<keyof TState | '*'>;\n private _isWaitingForVariables = false;\n\n public scanCount = 0;\n\n public constructor(\n private _sceneObject: SceneObject<TState>,\n private _options: VariableDependencyConfigOptions<TState>\n ) {\n this._statePaths = _options.statePaths;\n\n if (this._options.handleTimeMacros) {\n this.handleTimeMacros();\n }\n }\n\n /**\n * Used to check for dependency on a specific variable\n */\n public hasDependencyOn(name: string): boolean {\n return this.getNames().has(name);\n }\n\n /**\n * This is called whenever any set of variables have new values. It is up to this implementation to check if it's relevant given the current dependencies.\n */\n public variableUpdateCompleted(variable: SceneVariable, hasChanged: boolean) {\n const deps = this.getNames();\n let dependencyChanged = false;\n\n if ((deps.has(variable.state.name) || deps.has(DataLinkBuiltInVars.includeVars)) && hasChanged) {\n dependencyChanged = true;\n }\n\n writeSceneLog(\n 'VariableDependencyConfig',\n 'variableUpdateCompleted',\n variable.state.name,\n dependencyChanged,\n this._isWaitingForVariables\n );\n\n if (this._options.onAnyVariableChanged) {\n this._options.onAnyVariableChanged(variable);\n }\n\n // If custom handler called when dependency is changed or when we are waiting for variables\n if (this._options.onVariableUpdateCompleted && (this._isWaitingForVariables || dependencyChanged)) {\n this._options.onVariableUpdateCompleted();\n }\n\n if (dependencyChanged) {\n if (this._options.onReferencedVariableValueChanged) {\n this._options.onReferencedVariableValueChanged(variable);\n }\n\n // if no callbacks are specified then just do a forceRender\n if (!this._options.onReferencedVariableValueChanged && !this._options.onVariableUpdateCompleted) {\n this._sceneObject.forceRender();\n }\n }\n }\n\n public hasDependencyInLoadingState() {\n if (sceneGraph.hasVariableDependencyInLoadingState(this._sceneObject)) {\n this._isWaitingForVariables = true;\n return true;\n }\n\n this._isWaitingForVariables = false;\n return false;\n }\n\n public getNames(): Set<string> {\n const prevState = this._state;\n const newState = (this._state = this._sceneObject.state);\n\n if (!prevState) {\n // First time we always scan for dependencies\n this.scanStateForDependencies(this._state);\n return this._dependencies;\n }\n\n // Second time we only scan if state is a different and if any specific state path has changed\n if (newState !== prevState) {\n if (this._statePaths) {\n for (const path of this._statePaths) {\n if (path === '*' || newState[path] !== prevState[path]) {\n this.scanStateForDependencies(newState);\n break;\n }\n }\n } else {\n this.scanStateForDependencies(newState);\n }\n }\n\n return this._dependencies;\n }\n\n /**\n * Update variableNames\n */\n public setVariableNames(varNames: string[]) {\n this._options.variableNames = varNames;\n this.scanStateForDependencies(this._state!);\n }\n\n public setPaths(paths: Array<keyof TState | '*'>) {\n this._statePaths = paths;\n }\n\n private scanStateForDependencies(state: TState) {\n this._dependencies.clear();\n this.scanCount += 1;\n\n if (this._options.variableNames) {\n for (const name of this._options.variableNames) {\n this._dependencies.add(name);\n }\n }\n\n if (this._statePaths) {\n for (const path of this._statePaths) {\n if (path === '*') {\n this.extractVariablesFrom(state);\n break;\n } else {\n const value = state[path];\n if (value) {\n this.extractVariablesFrom(value);\n }\n }\n }\n }\n }\n\n private extractVariablesFrom(value: unknown) {\n VARIABLE_REGEX.lastIndex = 0;\n\n const stringToCheck = typeof value !== 'string' ? safeStringifyValue(value) : value;\n\n const matches = stringToCheck.matchAll(VARIABLE_REGEX);\n if (!matches) {\n return;\n }\n\n for (const match of matches) {\n const [, var1, var2, , var3] = match;\n const variableName = var1 || var2 || var3;\n this._dependencies.add(variableName);\n }\n }\n\n private handleTimeMacros() {\n this._sceneObject.addActivationHandler(() => {\n const timeRange = sceneGraph.getTimeRange(this._sceneObject);\n\n const sub = timeRange.subscribeToState((newState, oldState) => {\n const deps = this.getNames();\n const hasFromDep = deps.has('__from');\n const hasToDep = deps.has('__to');\n const hasTimeZone = deps.has('__timezone');\n\n if (newState.value !== oldState.value) {\n // If you have both __from & __to as dependencies you only get notified that from changed and vice versa\n if (hasFromDep) {\n const variable = new ConstantVariable({ name: '__from', value: newState.from });\n this.variableUpdateCompleted(variable, true);\n } else if (hasToDep) {\n const variable = new ConstantVariable({ name: '__to', value: newState.to });\n this.variableUpdateCompleted(variable, true);\n }\n }\n\n if (newState.timeZone !== oldState.timeZone && hasTimeZone) {\n const variable = new ConstantVariable({ name: '__timezone', value: newState.timeZone });\n this.variableUpdateCompleted(variable, true);\n }\n });\n\n return () => sub.unsubscribe();\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;AA8CO,MAAM,wBAAuG,CAAA;AAAA,EAQ3G,WAAA,CACG,cACA,QACR,EAAA;AAFQ,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA,CAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AARV,IAAQ,IAAA,CAAA,aAAA,uBAAoB,GAAY,EAAA,CAAA;AAExC,IAAA,IAAA,CAAQ,sBAAyB,GAAA,KAAA,CAAA;AAEjC,IAAA,IAAA,CAAO,SAAY,GAAA,CAAA,CAAA;AAMjB,IAAA,IAAA,CAAK,cAAc,QAAS,CAAA,UAAA,CAAA;AAE5B,IAAI,IAAA,IAAA,CAAK,SAAS,gBAAkB,EAAA;AAClC,MAAA,IAAA,CAAK,gBAAiB,EAAA,CAAA;AAAA,KACxB;AAAA,GACF;AAAA,EAKO,gBAAgB,IAAuB,EAAA;AAC5C,IAAA,OAAO,IAAK,CAAA,QAAA,EAAW,CAAA,GAAA,CAAI,IAAI,CAAA,CAAA;AAAA,GACjC;AAAA,EAKO,uBAAA,CAAwB,UAAyB,UAAqB,EAAA;AAC3E,IAAM,MAAA,IAAA,GAAO,KAAK,QAAS,EAAA,CAAA;AAC3B,IAAA,IAAI,iBAAoB,GAAA,KAAA,CAAA;AAExB,IAAK,IAAA,CAAA,IAAA,CAAK,GAAI,CAAA,QAAA,CAAS,KAAM,CAAA,IAAI,CAAK,IAAA,IAAA,CAAK,GAAI,CAAA,mBAAA,CAAoB,WAAW,CAAA,KAAM,UAAY,EAAA;AAC9F,MAAoB,iBAAA,GAAA,IAAA,CAAA;AAAA,KACtB;AAEA,IAAA,aAAA;AAAA,MACE,0BAAA;AAAA,MACA,yBAAA;AAAA,MACA,SAAS,KAAM,CAAA,IAA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AA,CAAI,QAAQ,CAAA,CAAA;AACpC,QAAM,MAAA,QAAA,GAAW,IAAK,CAAA,GAAA,CAAI,MAAM,CAAA,CAAA;AAChC,QAAM,MAAA,WAAA,GAAc,IAAK,CAAA,GAAA,CAAI,YAAY,CAAA,CAAA;AAEzC,QAAI,IAAA,QAAA,CAAS,KAAU,KAAA,QAAA,CAAS,KAAO,EAAA;AAErC,UAAA,IAAI,UAAY,EAAA;AACd,YAAM,MAAA,QAAA,GAAW,IAAI,gBAAiB,CAAA,EAAE,MAAM,QAAU,EAAA,KAAA,EAAO,QAAS,CAAA,IAAA,EAAM,CAAA,CAAA;AAC9E,YAAK,IAAA,CAAA,uBAAA,CAAwB,UAAU,IAAI,CAAA,CAAA;AAAA,qBAClC,QAAU,EAAA;AACnB,YAAM,MAAA,QAAA,GAAW,IAAI,gBAAiB,CAAA,EAAE,MAAM,MAAQ,EAAA,KAAA,EAAO,QAAS,CAAA,EAAA,EAAI,CAAA,CAAA;AAC1E,YAAK,IAAA,CAAA,uBAAA,CAAwB,UAAU,IAAI,CAAA,CAAA;AAAA,WAC7C;AAAA,SACF;AAEA,QAAA,IAAI,QAAS,CAAA,QAAA,KAAa,QAAS,CAAA,QAAA,IAAY,WAAa,EAAA;AAC1D,UAAM,MAAA,QAAA,GAAW,IAAI,gBAAiB,CAAA,EAAE,MAAM,YAAc,EAAA,KAAA,EAAO,QAAS,CAAA,QAAA,EAAU,CAAA,CAAA;AACtF,UAAK,IAAA,CAAA,uBAAA,CAAwB,UAAU,IAAI,CAAA,CAAA;AAAA,SAC7C;AAAA,OACD,CAAA,CAAA;AAED,MAAO,OAAA,MAAM,IAAI,WAAY,EAAA,CAAA;AAAA,KAC9B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SceneVariableSet.js","sources":["../../../../src/variables/sets/SceneVariableSet.ts"],"sourcesContent":["import { VariableRefresh } from '@grafana/data';\nimport { Unsubscribable } from 'rxjs';\nimport { sceneGraph } from '../../core/sceneGraph';\n\nimport { SceneObjectBase } from '../../core/SceneObjectBase';\nimport { SceneObject } from '../../core/types';\nimport { writeSceneLog } from '../../utils/writeSceneLog';\nimport {\n SceneVariable,\n SceneVariableDependencyConfigLike,\n SceneVariables,\n SceneVariableSetState,\n SceneVariableValueChangedEvent,\n} from '../types';\nimport { VariableValueRecorder } from '../VariableValueRecorder';\n\nexport class SceneVariableSet extends SceneObjectBase<SceneVariableSetState> implements SceneVariables {\n /** Variables that have changed in since the activation or since the first manual value change */\n private _variablesThatHaveChanged = new Set<SceneVariable>();\n\n /** Variables that are scheduled to be validated and updated */\n private _variablesToUpdate = new Set<SceneVariable>();\n\n /** Variables currently updating */\n private _updating = new Map<SceneVariable, VariableUpdateInProgress>();\n\n private _variableValueRecorder = new VariableValueRecorder();\n\n /**\n * This makes sure SceneVariableSet's higher up in the chain notify us when parent level variables complete update batches.\n **/\n protected _variableDependency = new SceneVariableSetVariableDependencyHandler(\n this._handleParentVariableUpdatesCompleted.bind(this)\n );\n\n public getByName(name: string): SceneVariable | undefined {\n // TODO: Replace with index\n return this.state.variables.find((x) => x.state.name === name);\n }\n\n public constructor(state: SceneVariableSetState) {\n super(state);\n\n this.addActivationHandler(this._onActivate);\n }\n\n /**\n * Subscribes to child variable value changes, and starts the variable value validation process\n */\n private _onActivate = () => {\n const timeRange = sceneGraph.getTimeRange(this);\n // Subscribe to changes to child variables\n this._subs.add(\n this.subscribeToEvent(SceneVariableValueChangedEvent, (event) => this._handleVariableValueChanged(event.payload))\n );\n\n this._subs.add(\n timeRange.subscribeToState(() => {\n this._refreshTimeRangeBasedVariables();\n })\n );\n\n // Subscribe to state changes\n this._subs.add(this.subscribeToState(this._onStateChanged));\n\n this._checkForVariablesThatChangedWhileInactive();\n\n // Add all variables that need updating to queue\n for (const variable of this.state.variables) {\n if (this._variableNeedsUpdate(variable)) {\n this._variablesToUpdate.add(variable);\n }\n }\n\n this._updateNextBatch();\n\n // Return deactivation handler;\n return this._onDeactivate;\n };\n\n /**\n * Add all variables that depend on the changed variable to the update queue\n */\n private _refreshTimeRangeBasedVariables() {\n for (const variable of this.state.variables) {\n if ('refresh' in variable.state && variable.state.refresh === VariableRefresh.onTimeRangeChanged) {\n this._variablesToUpdate.add(variable);\n }\n }\n\n this._updateNextBatch();\n }\n\n /**\n * Cancel all currently running updates\n */\n private _onDeactivate = () => {\n for (const update of this._updating.values()) {\n update.subscription?.unsubscribe();\n }\n\n // Remember current variable values\n for (const variable of this.state.variables) {\n // if the current variable is not in queue to update and validate and not being actively updated then the value is ok\n if (!this._variablesToUpdate.has(variable) && !this._updating.has(variable)) {\n this._variableValueRecorder.recordCurrentValue(variable);\n }\n }\n\n this._variablesToUpdate.clear();\n this._updating.clear();\n };\n\n /**\n * Look for new variables that need to be initialized\n */\n private _onStateChanged = (newState: SceneVariableSetState, oldState: SceneVariableSetState) => {\n const variablesToUpdateCountStart = this._variablesToUpdate.size;\n\n // Check for removed variables\n for (const variable of oldState.variables) {\n if (!newState.variables.includes(variable)) {\n const updating = this._updating.get(variable);\n if (updating?.subscription) {\n updating.subscription.unsubscribe();\n }\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n }\n }\n\n // Check for new variables\n for (const variable of newState.variables) {\n if (!oldState.variables.includes(variable)) {\n if (this._variableNeedsUpdate(variable)) {\n this._variablesToUpdate.add(variable);\n }\n }\n }\n\n // Only start a new batch if there was no batch already running\n if (variablesToUpdateCountStart === 0 && this._variablesToUpdate.size > 0) {\n this._updateNextBatch();\n }\n };\n\n /**\n * If variables changed while in in-active state we don't get any change events, so we need to check for that here.\n */\n private _checkForVariablesThatChangedWhileInactive() {\n if (!this._variableValueRecorder.hasValues()) {\n return;\n }\n\n for (const variable of this.state.variables) {\n if (this._variableValueRecorder.hasValueChanged(variable)) {\n writeVariableTraceLog(variable, 'Changed while in-active');\n this._addDependentVariablesToUpdateQueue(variable);\n }\n }\n }\n\n private _variableNeedsUpdate(variable: SceneVariable): boolean {\n if (variable.isLazy) {\n return false;\n }\n\n if (!variable.validateAndUpdate) {\n return false;\n }\n\n // If we have recorded valid value (even if it has changed since we do not need to re-validate this variable)\n if (this._variableValueRecorder.hasRecordedValue(variable)) {\n writeVariableTraceLog(variable, 'Skipping updateAndValidate current value valid');\n return false;\n }\n\n return true;\n }\n\n /**\n * This loops through variablesToUpdate and update all that can.\n * If one has a dependency that is currently in variablesToUpdate it will be skipped for now.\n */\n private _updateNextBatch() {\n for (const variable of this._variablesToUpdate) {\n if (!variable.validateAndUpdate) {\n throw new Error('Variable added to variablesToUpdate but does not have validateAndUpdate');\n }\n\n // Ignore it if it's already started\n if (this._updating.has(variable)) {\n continue;\n }\n\n // Wait for variables that has dependencies that also needs updates\n if (sceneGraph.hasVariableDependencyInLoadingState(variable)) {\n continue;\n }\n\n const variableToUpdate: VariableUpdateInProgress = {\n variable,\n };\n\n this._updating.set(variable, variableToUpdate);\n writeVariableTraceLog(variable, 'updateAndValidate started');\n\n variableToUpdate.subscription = variable.validateAndUpdate().subscribe({\n next: () => this._validateAndUpdateCompleted(variable),\n complete: () => this._validateAndUpdateCompleted(variable),\n error: (err) => this._handleVariableError(variable, err),\n });\n }\n }\n\n /**\n * A variable has completed its update process. This could mean that variables that depend on it can now be updated in turn.\n */\n private _validateAndUpdateCompleted(variable: SceneVariable) {\n if (!this._updating.has(variable)) {\n return;\n }\n\n const update = this._updating.get(variable);\n update?.subscription?.unsubscribe();\n\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n\n writeVariableTraceLog(variable, 'updateAndValidate completed');\n\n this._notifyDependentSceneObjects(variable);\n this._updateNextBatch();\n }\n\n public cancel(variable: SceneVariable) {\n const update = this._updating.get(variable);\n update?.subscription?.unsubscribe();\n\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n }\n\n private _handleVariableError(variable: SceneVariable, err: Error) {\n const update = this._updating.get(variable);\n update?.subscription?.unsubscribe();\n\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n\n variable.setState({ loading: false, error: err.message });\n\n console.error('SceneVariableSet updateAndValidate error', err);\n\n writeVariableTraceLog(variable, 'updateAndValidate error', err);\n\n this._notifyDependentSceneObjects(variable);\n this._updateNextBatch();\n }\n\n private _handleVariableValueChanged(variableThatChanged: SceneVariable) {\n this._variablesThatHaveChanged.add(variableThatChanged);\n this._addDependentVariablesToUpdateQueue(variableThatChanged);\n\n // Ignore this change if it is currently updating\n if (!this._updating.has(variableThatChanged)) {\n this._updateNextBatch();\n this._notifyDependentSceneObjects(variableThatChanged);\n }\n }\n\n /**\n * This is called by any parent level variable set to notify scene that an update batch is completed.\n * This is the main mechanism lower level variable set's react to changes on higher levels.\n */\n private _handleParentVariableUpdatesCompleted(variable: SceneVariable, hasChanged: boolean) {\n // First loop through changed variables and add any of our variables that depend on the higher level variable to the update queue\n if (hasChanged) {\n this._addDependentVariablesToUpdateQueue(variable);\n }\n\n // If we have variables to update but none are currently updating kick of a new update batch\n if (this._variablesToUpdate.size > 0 && this._updating.size === 0) {\n this._updateNextBatch();\n }\n }\n\n private _addDependentVariablesToUpdateQueue(variableThatChanged: SceneVariable) {\n for (const otherVariable of this.state.variables) {\n if (otherVariable.variableDependency) {\n if (otherVariable.variableDependency.hasDependencyOn(variableThatChanged.state.name)) {\n writeVariableTraceLog(otherVariable, 'Added to update queue, dependant variable value changed');\n\n if (this._updating.has(otherVariable) && otherVariable.onCancel) {\n otherVariable.onCancel();\n }\n\n this._variablesToUpdate.add(otherVariable);\n }\n }\n }\n }\n\n /**\n * Walk scene object graph and update all objects that depend on variables that have changed\n */\n private _notifyDependentSceneObjects(variable: SceneVariable) {\n if (!this.parent) {\n return;\n }\n\n this._traverseSceneAndNotify(this.parent, variable, this._variablesThatHaveChanged.has(variable));\n this._variablesThatHaveChanged.delete(variable);\n }\n\n /**\n * Recursivly walk the full scene object graph and notify all objects with dependencies that include any of changed variables\n */\n private _traverseSceneAndNotify(sceneObject: SceneObject, variable: SceneVariable, hasChanged: boolean) {\n // No need to notify variables under this SceneVariableSet\n if (this === sceneObject) {\n return;\n }\n\n // Skip non active scene objects\n if (!sceneObject.isActive) {\n return;\n }\n\n // If we find a nested SceneVariableSet that has a variable with the same name we stop the traversal\n if (sceneObject.state.$variables && sceneObject.state.$variables !== this) {\n const localVar = sceneObject.state.$variables.getByName(variable.state.name);\n if (localVar) {\n return;\n }\n }\n\n if (sceneObject.variableDependency) {\n sceneObject.variableDependency.variableUpdateCompleted(variable, hasChanged);\n }\n\n sceneObject.forEachChild((child) => this._traverseSceneAndNotify(child, variable, hasChanged));\n }\n\n /**\n * Return true if variable is waiting to update or currently updating.\n * It also returns true if a dependency of the variable is loading.\n *\n * For example if C depends on variable B which depends on variable A and A is loading this returns true for variable C and B.\n */\n public isVariableLoadingOrWaitingToUpdate(variable: SceneVariable) {\n if (variable.isAncestorLoading && variable.isAncestorLoading()) {\n return true;\n }\n\n if (this._variablesToUpdate.has(variable) || this._updating.has(variable)) {\n return true;\n }\n\n // Last scenario is to check the variable's own dependencies as well\n return sceneGraph.hasVariableDependencyInLoadingState(variable);\n }\n}\n\nexport interface VariableUpdateInProgress {\n variable: SceneVariable;\n subscription?: Unsubscribable;\n}\n\nfunction writeVariableTraceLog(variable: SceneVariable, message: string, err?: Error) {\n if (err) {\n writeSceneLog('SceneVariableSet', `Variable[${variable.state.name}]: ${message}`, err);\n } else {\n writeSceneLog('SceneVariableSet', `Variable[${variable.state.name}]: ${message}`);\n }\n}\n\nclass SceneVariableSetVariableDependencyHandler implements SceneVariableDependencyConfigLike {\n public constructor(private _variableUpdatesCompleted: (variable: SceneVariable, hasChanged: boolean) => void) {}\n\n private _emptySet = new Set<string>();\n\n public getNames(): Set<string> {\n return this._emptySet;\n }\n\n public hasDependencyOn(name: string): boolean {\n return false;\n }\n\n public variableUpdateCompleted(variable: SceneVariable, hasChanged: boolean): void {\n this._variableUpdatesCompleted(variable, hasChanged);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAgBO,MAAM,yBAAyB,eAAiE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,OAAA,IAAA,CAAA;AAAA,KACT;AAEA,IAAI,IAAA,IAAA,CAAK,mBAAmB,GAAI,CAAA,QAAQ,KAAK,IAAK,CAAA,SAAA,CAAU,GAAI,CAAA,QAAQ,CAAG,EAAA;AACzE,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAGA,IAAO,OAAA,UAAA,CAAW,oCAAoC,QAAQ,CAAA,CAAA;AAAA,GAChE;AACF,CAAA;AAOA,SAAS,qBAAA,CAAsB,QAAyB,EAAA,OAAA,EAAiB,GAAa,EAAA;AACpF,EAAA,IAAI,GAAK,EAAA;AACP,IAAA,aAAA,CAAc,oBAAoB,CAAY,SAAA,EAAA,QAAA,CAAS,KAAM,CAAA,IAAA,CAAA,GAAA,EAAU,WAAW,GAAG,CAAA,CAAA;AAAA,GAChF,MAAA;AACL,IAAA,aAAA,CAAc,kBAAoB,EAAA,CAAA,SAAA,EAAY,QAAS,CAAA,KAAA,CAAM,UAAU,OAAS,CAAA,CAAA,CAAA,CAAA;AAAA,GAClF;AACF,CAAA;AAEA,MAAM,yCAAuF,CAAA;AAAA,EACpF,YAAoB,yBAAmF,EAAA;AAAnF,IAAA,IAAA,CAAA,yBAAA,GAAA,yBAAA,CAAA;AAE3B,IAAQ,IAAA,CAAA,SAAA,uBAAgB,GAAY,EAAA,CAAA;AAAA,GAF2E;AAAA,EAIxG,QAAwB,GAAA;AAC7B,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GACd;AAAA,EAEO,gBAAgB,IAAuB,EAAA;AAC5C,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAAA,EAEO,uBAAA,CAAwB,UAAyB,UAA2B,EAAA;AACjF,IAAK,IAAA,CAAA,yBAAA,CAA0B,UAAU,UAAU,CAAA,CAAA;AAAA,GACrD;AACF;;;;"}
1
+ {"version":3,"file":"SceneVariableSet.js","sources":["../../../../src/variables/sets/SceneVariableSet.ts"],"sourcesContent":["import { VariableRefresh } from '@grafana/data';\nimport { Unsubscribable } from 'rxjs';\nimport { sceneGraph } from '../../core/sceneGraph';\n\nimport { SceneObjectBase } from '../../core/SceneObjectBase';\nimport { SceneObject } from '../../core/types';\nimport { writeSceneLog } from '../../utils/writeSceneLog';\nimport {\n SceneVariable,\n SceneVariableDependencyConfigLike,\n SceneVariables,\n SceneVariableSetState,\n SceneVariableValueChangedEvent,\n} from '../types';\nimport { VariableValueRecorder } from '../VariableValueRecorder';\n\nexport class SceneVariableSet extends SceneObjectBase<SceneVariableSetState> implements SceneVariables {\n /** Variables that have changed in since the activation or since the first manual value change */\n private _variablesThatHaveChanged = new Set<SceneVariable>();\n\n /** Variables that are scheduled to be validated and updated */\n private _variablesToUpdate = new Set<SceneVariable>();\n\n /** Variables currently updating */\n private _updating = new Map<SceneVariable, VariableUpdateInProgress>();\n\n private _variableValueRecorder = new VariableValueRecorder();\n\n /**\n * This makes sure SceneVariableSet's higher up in the chain notify us when parent level variables complete update batches.\n **/\n protected _variableDependency = new SceneVariableSetVariableDependencyHandler(\n this._handleParentVariableUpdatesCompleted.bind(this)\n );\n\n public getByName(name: string): SceneVariable | undefined {\n // TODO: Replace with index\n return this.state.variables.find((x) => x.state.name === name);\n }\n\n public constructor(state: SceneVariableSetState) {\n super(state);\n\n this.addActivationHandler(this._onActivate);\n }\n\n /**\n * Subscribes to child variable value changes, and starts the variable value validation process\n */\n private _onActivate = () => {\n const timeRange = sceneGraph.getTimeRange(this);\n // Subscribe to changes to child variables\n this._subs.add(\n this.subscribeToEvent(SceneVariableValueChangedEvent, (event) => this._handleVariableValueChanged(event.payload))\n );\n\n this._subs.add(\n timeRange.subscribeToState(() => {\n this._refreshTimeRangeBasedVariables();\n })\n );\n\n // Subscribe to state changes\n this._subs.add(this.subscribeToState(this._onStateChanged));\n\n this._checkForVariablesThatChangedWhileInactive();\n\n // Add all variables that need updating to queue\n for (const variable of this.state.variables) {\n if (this._variableNeedsUpdate(variable)) {\n this._variablesToUpdate.add(variable);\n }\n }\n\n this._updateNextBatch();\n\n // Return deactivation handler;\n return this._onDeactivate;\n };\n\n /**\n * Add all variables that depend on the changed variable to the update queue\n */\n private _refreshTimeRangeBasedVariables() {\n for (const variable of this.state.variables) {\n if ('refresh' in variable.state && variable.state.refresh === VariableRefresh.onTimeRangeChanged) {\n this._variablesToUpdate.add(variable);\n }\n }\n this._updateNextBatch();\n }\n\n /**\n * Cancel all currently running updates\n */\n private _onDeactivate = () => {\n for (const update of this._updating.values()) {\n update.subscription?.unsubscribe();\n }\n\n // Remember current variable values\n for (const variable of this.state.variables) {\n // if the current variable is not in queue to update and validate and not being actively updated then the value is ok\n if (!this._variablesToUpdate.has(variable) && !this._updating.has(variable)) {\n this._variableValueRecorder.recordCurrentValue(variable);\n }\n }\n\n this._variablesToUpdate.clear();\n this._updating.clear();\n };\n\n /**\n * Look for new variables that need to be initialized\n */\n private _onStateChanged = (newState: SceneVariableSetState, oldState: SceneVariableSetState) => {\n const variablesToUpdateCountStart = this._variablesToUpdate.size;\n\n // Check for removed variables\n for (const variable of oldState.variables) {\n if (!newState.variables.includes(variable)) {\n const updating = this._updating.get(variable);\n if (updating?.subscription) {\n updating.subscription.unsubscribe();\n }\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n }\n }\n\n // Check for new variables\n for (const variable of newState.variables) {\n if (!oldState.variables.includes(variable)) {\n if (this._variableNeedsUpdate(variable)) {\n this._variablesToUpdate.add(variable);\n }\n }\n }\n\n // Only start a new batch if there was no batch already running\n if (variablesToUpdateCountStart === 0 && this._variablesToUpdate.size > 0) {\n this._updateNextBatch();\n }\n };\n\n /**\n * If variables changed while in in-active state we don't get any change events, so we need to check for that here.\n */\n private _checkForVariablesThatChangedWhileInactive() {\n if (!this._variableValueRecorder.hasValues()) {\n return;\n }\n\n for (const variable of this.state.variables) {\n if (this._variableValueRecorder.hasValueChanged(variable)) {\n writeVariableTraceLog(variable, 'Changed while in-active');\n this._addDependentVariablesToUpdateQueue(variable);\n }\n }\n }\n\n private _variableNeedsUpdate(variable: SceneVariable): boolean {\n if (variable.isLazy) {\n return false;\n }\n\n if (!variable.validateAndUpdate) {\n return false;\n }\n\n // If we have recorded valid value (even if it has changed since we do not need to re-validate this variable)\n if (this._variableValueRecorder.hasRecordedValue(variable)) {\n writeVariableTraceLog(variable, 'Skipping updateAndValidate current value valid');\n return false;\n }\n\n return true;\n }\n\n /**\n * This loops through variablesToUpdate and update all that can.\n * If one has a dependency that is currently in variablesToUpdate it will be skipped for now.\n */\n private _updateNextBatch() {\n for (const variable of this._variablesToUpdate) {\n if (!variable.validateAndUpdate) {\n throw new Error('Variable added to variablesToUpdate but does not have validateAndUpdate');\n }\n\n // Ignore it if it's already started\n if (this._updating.has(variable)) {\n continue;\n }\n\n // Wait for variables that has dependencies that also needs updates\n if (sceneGraph.hasVariableDependencyInLoadingState(variable)) {\n continue;\n }\n\n const variableToUpdate: VariableUpdateInProgress = {\n variable,\n };\n\n this._updating.set(variable, variableToUpdate);\n writeVariableTraceLog(variable, 'updateAndValidate started');\n\n variableToUpdate.subscription = variable.validateAndUpdate().subscribe({\n next: () => this._validateAndUpdateCompleted(variable),\n complete: () => this._validateAndUpdateCompleted(variable),\n error: (err) => this._handleVariableError(variable, err),\n });\n }\n }\n\n /**\n * A variable has completed its update process. This could mean that variables that depend on it can now be updated in turn.\n */\n private _validateAndUpdateCompleted(variable: SceneVariable) {\n if (!this._updating.has(variable)) {\n return;\n }\n\n const update = this._updating.get(variable);\n update?.subscription?.unsubscribe();\n\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n\n writeVariableTraceLog(variable, 'updateAndValidate completed');\n\n this._notifyDependentSceneObjects(variable);\n this._updateNextBatch();\n }\n\n public cancel(variable: SceneVariable) {\n const update = this._updating.get(variable);\n update?.subscription?.unsubscribe();\n\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n }\n\n private _handleVariableError(variable: SceneVariable, err: Error) {\n const update = this._updating.get(variable);\n update?.subscription?.unsubscribe();\n\n this._updating.delete(variable);\n this._variablesToUpdate.delete(variable);\n\n variable.setState({ loading: false, error: err.message });\n\n console.error('SceneVariableSet updateAndValidate error', err);\n\n writeVariableTraceLog(variable, 'updateAndValidate error', err);\n\n this._notifyDependentSceneObjects(variable);\n this._updateNextBatch();\n }\n\n private _handleVariableValueChanged(variableThatChanged: SceneVariable) {\n this._variablesThatHaveChanged.add(variableThatChanged);\n this._addDependentVariablesToUpdateQueue(variableThatChanged);\n\n // Ignore this change if it is currently updating\n if (!this._updating.has(variableThatChanged)) {\n this._updateNextBatch();\n this._notifyDependentSceneObjects(variableThatChanged);\n }\n }\n\n /**\n * This is called by any parent level variable set to notify scene that an update batch is completed.\n * This is the main mechanism lower level variable set's react to changes on higher levels.\n */\n private _handleParentVariableUpdatesCompleted(variable: SceneVariable, hasChanged: boolean) {\n // First loop through changed variables and add any of our variables that depend on the higher level variable to the update queue\n if (hasChanged) {\n this._addDependentVariablesToUpdateQueue(variable);\n }\n\n // If we have variables to update but none are currently updating kick of a new update batch\n if (this._variablesToUpdate.size > 0 && this._updating.size === 0) {\n this._updateNextBatch();\n }\n }\n\n private _addDependentVariablesToUpdateQueue(variableThatChanged: SceneVariable) {\n for (const otherVariable of this.state.variables) {\n if (otherVariable.variableDependency) {\n if (otherVariable.variableDependency.hasDependencyOn(variableThatChanged.state.name)) {\n writeVariableTraceLog(otherVariable, 'Added to update queue, dependant variable value changed');\n\n if (this._updating.has(otherVariable) && otherVariable.onCancel) {\n otherVariable.onCancel();\n }\n\n this._variablesToUpdate.add(otherVariable);\n }\n }\n }\n }\n\n /**\n * Walk scene object graph and update all objects that depend on variables that have changed\n */\n private _notifyDependentSceneObjects(variable: SceneVariable) {\n if (!this.parent) {\n return;\n }\n\n this._traverseSceneAndNotify(this.parent, variable, this._variablesThatHaveChanged.has(variable));\n this._variablesThatHaveChanged.delete(variable);\n }\n\n /**\n * Recursivly walk the full scene object graph and notify all objects with dependencies that include any of changed variables\n */\n private _traverseSceneAndNotify(sceneObject: SceneObject, variable: SceneVariable, hasChanged: boolean) {\n // No need to notify variables under this SceneVariableSet\n if (this === sceneObject) {\n return;\n }\n\n // Skip non active scene objects\n if (!sceneObject.isActive) {\n return;\n }\n\n // If we find a nested SceneVariableSet that has a variable with the same name we stop the traversal\n if (sceneObject.state.$variables && sceneObject.state.$variables !== this) {\n const localVar = sceneObject.state.$variables.getByName(variable.state.name);\n if (localVar) {\n return;\n }\n }\n\n if (sceneObject.variableDependency) {\n sceneObject.variableDependency.variableUpdateCompleted(variable, hasChanged);\n }\n\n sceneObject.forEachChild((child) => this._traverseSceneAndNotify(child, variable, hasChanged));\n }\n\n /**\n * Return true if variable is waiting to update or currently updating.\n * It also returns true if a dependency of the variable is loading.\n *\n * For example if C depends on variable B which depends on variable A and A is loading this returns true for variable C and B.\n */\n public isVariableLoadingOrWaitingToUpdate(variable: SceneVariable) {\n if (variable.isAncestorLoading && variable.isAncestorLoading()) {\n return true;\n }\n\n if (this._variablesToUpdate.has(variable) || this._updating.has(variable)) {\n return true;\n }\n\n // Last scenario is to check the variable's own dependencies as well\n return sceneGraph.hasVariableDependencyInLoadingState(variable);\n }\n}\n\nexport interface VariableUpdateInProgress {\n variable: SceneVariable;\n subscription?: Unsubscribable;\n}\n\nfunction writeVariableTraceLog(variable: SceneVariable, message: string, err?: Error) {\n if (err) {\n writeSceneLog('SceneVariableSet', `Variable[${variable.state.name}]: ${message}`, err);\n } else {\n writeSceneLog('SceneVariableSet', `Variable[${variable.state.name}]: ${message}`);\n }\n}\n\nclass SceneVariableSetVariableDependencyHandler implements SceneVariableDependencyConfigLike {\n public constructor(private _variableUpdatesCompleted: (variable: SceneVariable, hasChanged: boolean) => void) {}\n\n private _emptySet = new Set<string>();\n\n public getNames(): Set<string> {\n return this._emptySet;\n }\n\n public hasDependencyOn(name: string): boolean {\n return false;\n }\n\n public variableUpdateCompleted(variable: SceneVariable, hasChanged: boolean): void {\n this._variableUpdatesCompleted(variable, hasChanged);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAgBO,MAAM,y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AAC9D,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAEA,IAAI,IAAA,IAAA,CAAK,mBAAmB,GAAI,CAAA,QAAQ,KAAK,IAAK,CAAA,SAAA,CAAU,GAAI,CAAA,QAAQ,CAAG,EAAA;AACzE,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAGA,IAAO,OAAA,UAAA,CAAW,oCAAoC,QAAQ,CAAA,CAAA;AAAA,GAChE;AACF,CAAA;AAOA,SAAS,qBAAA,CAAsB,QAAyB,EAAA,OAAA,EAAiB,GAAa,EAAA;AACpF,EAAA,IAAI,GAAK,EAAA;AACP,IAAA,aAAA,CAAc,oBAAoB,CAAY,SAAA,EAAA,QAAA,CAAS,KAAM,CAAA,IAAA,CAAA,GAAA,EAAU,WAAW,GAAG,CAAA,CAAA;AAAA,GAChF,MAAA;AACL,IAAA,aAAA,CAAc,kBAAoB,EAAA,CAAA,SAAA,EAAY,QAAS,CAAA,KAAA,CAAM,UAAU,OAAS,CAAA,CAAA,CAAA,CAAA;AAAA,GAClF;AACF,CAAA;AAEA,MAAM,yCAAuF,CAAA;AAAA,EACpF,YAAoB,yBAAmF,EAAA;AAAnF,IAAA,IAAA,CAAA,yBAAA,GAAA,yBAAA,CAAA;AAE3B,IAAQ,IAAA,CAAA,SAAA,uBAAgB,GAAY,EAAA,CAAA;AAAA,GAF2E;AAAA,EAIxG,QAAwB,GAAA;AAC7B,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GACd;AAAA,EAEO,gBAAgB,IAAuB,EAAA;AAC5C,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAAA,EAEO,uBAAA,CAAwB,UAAyB,UAA2B,EAAA;AACjF,IAAK,IAAA,CAAA,yBAAA,CAA0B,UAAU,UAAU,CAAA,CAAA;AAAA,GACrD;AACF;;;;"}
package/dist/index.d.ts CHANGED
@@ -679,6 +679,10 @@ interface VariableDependencyConfigOptions<TState extends SceneObjectState> {
679
679
  * Optional way to subscribe to all variable value changes, even to variables that are not dependencies.
680
680
  */
681
681
  onAnyVariableChanged?: (variable: SceneVariable) => void;
682
+ /**
683
+ * Handle time macros.
684
+ */
685
+ handleTimeMacros?: boolean;
682
686
  }
683
687
  declare class VariableDependencyConfig<TState extends SceneObjectState> implements SceneVariableDependencyConfigLike {
684
688
  private _sceneObject;
@@ -706,6 +710,7 @@ declare class VariableDependencyConfig<TState extends SceneObjectState> implemen
706
710
  setPaths(paths: Array<keyof TState | '*'>): void;
707
711
  private scanStateForDependencies;
708
712
  private extractVariablesFrom;
713
+ private handleTimeMacros;
709
714
  }
710
715
 
711
716
  interface MultiValueVariableState extends SceneVariableState {