@grafana/scenes 4.26.3--canary.765.9399849393.0 → 4.27.0--canary.766.9367073867.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/CHANGELOG.md +0 -29
  2. package/README.md +0 -2
  3. package/dist/esm/components/EmbeddedScene.js +5 -0
  4. package/dist/esm/components/EmbeddedScene.js.map +1 -1
  5. package/dist/esm/components/SceneApp/SceneAppPage.js +5 -0
  6. package/dist/esm/components/SceneApp/SceneAppPage.js.map +1 -1
  7. package/dist/esm/components/SceneApp/SceneAppPageView.js +1 -3
  8. package/dist/esm/components/SceneApp/SceneAppPageView.js.map +1 -1
  9. package/dist/esm/components/SceneTimeRangeCompare.js +1 -55
  10. package/dist/esm/components/SceneTimeRangeCompare.js.map +1 -1
  11. package/dist/esm/components/VizPanel/VizPanel.js +0 -3
  12. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  13. package/dist/esm/core/sceneGraph/sceneGraph.js +1 -1
  14. package/dist/esm/core/types.js.map +1 -1
  15. package/dist/esm/index.js +1 -6
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/querying/SceneQueryRunner.js +88 -85
  18. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  19. package/dist/esm/querying/timeShiftQueryResponseOperator.js +60 -0
  20. package/dist/esm/querying/timeShiftQueryResponseOperator.js.map +1 -0
  21. package/dist/esm/services/UniqueUrlKeyMapper.js +16 -24
  22. package/dist/esm/services/UniqueUrlKeyMapper.js.map +1 -1
  23. package/dist/esm/services/UrlSyncManager.js +34 -27
  24. package/dist/esm/services/UrlSyncManager.js.map +1 -1
  25. package/dist/esm/services/utils.js +4 -10
  26. package/dist/esm/services/utils.js.map +1 -1
  27. package/dist/esm/utils/writeSceneLog.js +1 -5
  28. package/dist/esm/utils/writeSceneLog.js.map +1 -1
  29. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +40 -3
  30. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  31. package/dist/esm/variables/interpolation/sceneInterpolator.js +3 -3
  32. package/dist/esm/variables/interpolation/sceneInterpolator.js.map +1 -1
  33. package/dist/esm/variables/utils.js.map +1 -1
  34. package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
  35. package/dist/index.d.ts +159 -275
  36. package/dist/index.js +1672 -1884
  37. package/dist/index.js.map +1 -1
  38. package/package.json +7 -4
  39. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js +0 -78
  40. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js.map +0 -1
  41. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js +0 -114
  42. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js.map +0 -1
  43. package/dist/esm/querying/ExtraQueryProvider.js +0 -6
  44. package/dist/esm/querying/ExtraQueryProvider.js.map +0 -1
  45. package/dist/esm/querying/extraQueryProcessingOperator.js +0 -46
  46. package/dist/esm/querying/extraQueryProcessingOperator.js.map +0 -1
  47. package/dist/esm/services/UrlSyncContextProvider.js +0 -12
  48. package/dist/esm/services/UrlSyncContextProvider.js.map +0 -1
  49. package/dist/esm/services/useUrlSync.js +0 -27
  50. package/dist/esm/services/useUrlSync.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"QueryVariable.js","sources":["../../../../../src/variables/variants/query/QueryVariable.tsx"],"sourcesContent":["import { Observable, of, filter, take, mergeMap, catchError, throwError, from, lastValueFrom } from 'rxjs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n CoreApp,\n DataQueryRequest,\n LoadingState,\n PanelData,\n ScopedVars,\n VariableRefresh,\n VariableSort,\n} from '@grafana/data';\n\nimport { sceneGraph } from '../../../core/sceneGraph';\nimport { SceneComponentProps, SceneDataQuery } from '../../../core/types';\nimport { VariableDependencyConfig } from '../../VariableDependencyConfig';\nimport { renderSelectForVariable } from '../../components/VariableValueSelect';\nimport { VariableValueOption } from '../../types';\nimport { MultiValueVariable, MultiValueVariableState, VariableGetOptionsArgs } from '../MultiValueVariable';\n\nimport { createQueryVariableRunner } from './createQueryVariableRunner';\nimport { metricNamesToVariableValues } from './utils';\nimport { toMetricFindValues } from './toMetricFindValues';\nimport { getDataSource } from '../../../utils/getDataSource';\nimport { safeStringifyValue } from '../../utils';\nimport { DataQuery, DataSourceRef } from '@grafana/schema';\nimport { SEARCH_FILTER_VARIABLE } from '../../constants';\nimport { debounce } from 'lodash';\nimport { registerQueryWithController } from '../../../querying/registerQueryWithController';\n\nexport interface QueryVariableState extends MultiValueVariableState {\n type: 'query';\n datasource: DataSourceRef | null;\n query: string | SceneDataQuery;\n regex: string;\n refresh: VariableRefresh;\n sort: VariableSort;\n /** @internal Only for use inside core dashboards */\n definition?: string;\n}\n\nexport class QueryVariable extends MultiValueVariable<QueryVariableState> {\n protected _variableDependency = new VariableDependencyConfig(this, {\n statePaths: ['regex', 'query', 'datasource'],\n });\n\n public constructor(initialState: Partial<QueryVariableState>) {\n super({\n type: 'query',\n name: '',\n value: '',\n text: '',\n options: [],\n datasource: null,\n regex: '',\n query: { refId: 'A' },\n refresh: VariableRefresh.onDashboardLoad,\n sort: VariableSort.disabled,\n ...initialState,\n });\n }\n\n public getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]> {\n if (!this.state.query) {\n return of([]);\n }\n\n this.setState({ loading: true, error: null });\n\n return from(\n getDataSource(this.state.datasource, {\n __sceneObject: { text: '__sceneObject', value: this },\n })\n ).pipe(\n mergeMap((ds) => {\n const runner = createQueryVariableRunner(ds);\n const target = runner.getTarget(this);\n const request = this.getRequest(target, args.searchFilter);\n\n return runner.runRequest({ variable: this, searchFilter: args.searchFilter }, request).pipe(\n registerQueryWithController({\n type: 'variable',\n request: request,\n origin: this,\n }),\n filter((data) => data.state === LoadingState.Done || data.state === LoadingState.Error), // we only care about done or error for now\n take(1), // take the first result, using first caused a bug where it in some situations throw an uncaught error because of no results had been received yet\n mergeMap((data: PanelData) => {\n if (data.state === LoadingState.Error) {\n return throwError(() => data.error);\n }\n return of(data);\n }),\n toMetricFindValues(),\n mergeMap((values) => {\n let regex = '';\n if (this.state.regex) {\n regex = sceneGraph.interpolate(this, this.state.regex, undefined, 'regex');\n }\n return of(metricNamesToVariableValues(regex, this.state.sort, values));\n }),\n catchError((error) => {\n if (error.cancelled) {\n return of([]);\n }\n return throwError(() => error);\n })\n );\n })\n );\n }\n\n private getRequest(target: DataQuery | string, searchFilter?: string) {\n const scopedVars: ScopedVars = {\n __sceneObject: { text: '__sceneObject', value: this },\n };\n\n if (searchFilter) {\n scopedVars.__searchFilter = { value: searchFilter, text: searchFilter };\n }\n\n const range = sceneGraph.getTimeRange(this).state.value;\n\n const request: DataQueryRequest = {\n app: CoreApp.Dashboard,\n requestId: uuidv4(),\n timezone: '',\n range,\n interval: '',\n intervalMs: 0,\n // @ts-ignore\n targets: [target],\n scopedVars,\n startTime: Date.now(),\n };\n\n return request;\n }\n\n onSearchChange = (searchFilter: string) => {\n if (!containsSearchFilter(this.state.query)) {\n return;\n }\n\n this._updateOptionsBasedOnSearchFilter(searchFilter);\n };\n\n private _updateOptionsBasedOnSearchFilter = debounce(async (searchFilter: string) => {\n const result = await lastValueFrom(this.getValueOptions({ searchFilter }));\n this.setState({ options: result, loading: false });\n }, 400);\n\n public static Component = ({ model }: SceneComponentProps<MultiValueVariable>) => {\n return renderSelectForVariable(model);\n };\n}\n\nfunction containsSearchFilter(query: string | DataQuery) {\n const str = safeStringifyValue(query);\n return str.indexOf(SEARCH_FILTER_VARIABLE) > -1;\n}\n"],"names":["uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCO,MAAM,sBAAsB,kBAAuC,CAAA;AAAA,EAKjE,YAAY,YAA2C,EAAA;AAC5D,IAAM,KAAA,CAAA,cAAA,CAAA;AAAA,MACJ,IAAM,EAAA,OAAA;AAAA,MACN,IAAM,EAAA,EAAA;AAAA,MACN,KAAO,EAAA,EAAA;AAAA,MACP,IAAM,EAAA,EAAA;AAAA,MACN,SAAS,EAAC;AAAA,MACV,UAAY,EAAA,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,CAAA;AAAA,GACT;AAkBF,CAAA;AAlHa,aAAA,CA+GG,SAAY,GAAA,CAAC,EAAE,KAAA,EAAqD,KAAA;AAChF,EAAA,OAAO,wBAAwB,KAAK,CAAA,CAAA;AACtC,CAAA,CAAA;AAGF,SAAS,qBAAqB,KAA2B,EAAA;AACvD,EAAM,MAAA,GAAA,GAAM,mBAAmB,KAAK,CAAA,CAAA;AACpC,EAAO,OAAA,GAAA,CAAI,OAAQ,CAAA,sBAAsB,CAAI,GAAA,CAAA,CAAA,CAAA;AAC/C;;;;"}
1
+ {"version":3,"file":"QueryVariable.js","sources":["../../../../../src/variables/variants/query/QueryVariable.tsx"],"sourcesContent":["import { Observable, of, filter, take, mergeMap, catchError, throwError, from, lastValueFrom } from 'rxjs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n CoreApp,\n DataQueryRequest,\n LoadingState,\n PanelData,\n ScopedVars,\n VariableRefresh,\n VariableSort,\n} from '@grafana/data';\n\nimport { sceneGraph } from '../../../core/sceneGraph';\nimport { SceneComponentProps } from '../../../core/types';\nimport { VariableDependencyConfig } from '../../VariableDependencyConfig';\nimport { renderSelectForVariable } from '../../components/VariableValueSelect';\nimport { VariableValueOption } from '../../types';\nimport { MultiValueVariable, MultiValueVariableState, VariableGetOptionsArgs } from '../MultiValueVariable';\n\nimport { createQueryVariableRunner } from './createQueryVariableRunner';\nimport { metricNamesToVariableValues } from './utils';\nimport { toMetricFindValues } from './toMetricFindValues';\nimport { getDataSource } from '../../../utils/getDataSource';\nimport { safeStringifyValue } from '../../utils';\nimport { DataQuery, DataSourceRef } from '@grafana/schema';\nimport { SEARCH_FILTER_VARIABLE } from '../../constants';\nimport { DataQueryExtended } from '../../../querying/SceneQueryRunner';\nimport { debounce } from 'lodash';\nimport { registerQueryWithController } from '../../../querying/registerQueryWithController';\n\nexport interface QueryVariableState extends MultiValueVariableState {\n type: 'query';\n datasource: DataSourceRef | null;\n query: string | DataQueryExtended;\n regex: string;\n refresh: VariableRefresh;\n sort: VariableSort;\n /** @internal Only for use inside core dashboards */\n definition?: string;\n}\n\nexport class QueryVariable extends MultiValueVariable<QueryVariableState> {\n protected _variableDependency = new VariableDependencyConfig(this, {\n statePaths: ['regex', 'query', 'datasource'],\n });\n\n public constructor(initialState: Partial<QueryVariableState>) {\n super({\n type: 'query',\n name: '',\n value: '',\n text: '',\n options: [],\n datasource: null,\n regex: '',\n query: { refId: 'A' },\n refresh: VariableRefresh.onDashboardLoad,\n sort: VariableSort.disabled,\n ...initialState,\n });\n }\n\n public getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]> {\n if (!this.state.query) {\n return of([]);\n }\n\n this.setState({ loading: true, error: null });\n\n return from(\n getDataSource(this.state.datasource, {\n __sceneObject: { text: '__sceneObject', value: this },\n })\n ).pipe(\n mergeMap((ds) => {\n const runner = createQueryVariableRunner(ds);\n const target = runner.getTarget(this);\n const request = this.getRequest(target, args.searchFilter);\n\n return runner.runRequest({ variable: this, searchFilter: args.searchFilter }, request).pipe(\n registerQueryWithController({\n type: 'variable',\n request: request,\n origin: this,\n }),\n filter((data) => data.state === LoadingState.Done || data.state === LoadingState.Error), // we only care about done or error for now\n take(1), // take the first result, using first caused a bug where it in some situations throw an uncaught error because of no results had been received yet\n mergeMap((data: PanelData) => {\n if (data.state === LoadingState.Error) {\n return throwError(() => data.error);\n }\n return of(data);\n }),\n toMetricFindValues(),\n mergeMap((values) => {\n let regex = '';\n if (this.state.regex) {\n regex = sceneGraph.interpolate(this, this.state.regex, undefined, 'regex');\n }\n return of(metricNamesToVariableValues(regex, this.state.sort, values));\n }),\n catchError((error) => {\n if (error.cancelled) {\n return of([]);\n }\n return throwError(() => error);\n })\n );\n })\n );\n }\n\n private getRequest(target: DataQuery | string, searchFilter?: string) {\n const scopedVars: ScopedVars = {\n __sceneObject: { text: '__sceneObject', value: this },\n };\n\n if (searchFilter) {\n scopedVars.__searchFilter = { value: searchFilter, text: searchFilter };\n }\n\n const range = sceneGraph.getTimeRange(this).state.value;\n\n const request: DataQueryRequest = {\n app: CoreApp.Dashboard,\n requestId: uuidv4(),\n timezone: '',\n range,\n interval: '',\n intervalMs: 0,\n // @ts-ignore\n targets: [target],\n scopedVars,\n startTime: Date.now(),\n };\n\n return request;\n }\n\n onSearchChange = (searchFilter: string) => {\n if (!containsSearchFilter(this.state.query)) {\n return;\n }\n\n this._updateOptionsBasedOnSearchFilter(searchFilter);\n };\n\n private _updateOptionsBasedOnSearchFilter = debounce(async (searchFilter: string) => {\n const result = await lastValueFrom(this.getValueOptions({ searchFilter }));\n this.setState({ options: result, loading: false });\n }, 400);\n\n public static Component = ({ model }: SceneComponentProps<MultiValueVariable>) => {\n return renderSelectForVariable(model);\n };\n}\n\nfunction containsSearchFilter(query: string | DataQuery) {\n const str = safeStringifyValue(query);\n return str.indexOf(SEARCH_FILTER_VARIABLE) > -1;\n}\n"],"names":["uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CO,MAAM,sBAAsB,kBAAuC,CAAA;AAAA,EAKjE,YAAY,YAA2C,EAAA;AAC5D,IAAM,KAAA,CAAA,cAAA,CAAA;AAAA,MACJ,IAAM,EAAA,OAAA;AAAA,MACN,IAAM,EAAA,EAAA;AAAA,MACN,KAAO,EAAA,EAAA;AAAA,MACP,IAAM,EAAA,EAAA;AAAA,MACN,SAAS,EAAC;AAAA,MACV,UAAY,EAAA,IAAA;AAAA,MACZ,KAAO,EAAA,EAAA;AAAA,MACP,KAAA,EAAO,EAAE,KAAA,EAAO,GAAI,EAAA;AAAA,MACpB,SAAS,eAAgB,CAAA,eAAA;AAAA,MACzB,MAAM,YAAa,CAAA,QAAA;AAAA,KAAA,EAChB,YACJ,CAAA,CAAA,CAAA;AAjBH,IAAU,IAAA,CAAA,mBAAA,GAAsB,IAAI,wBAAA,CAAyB,IAAM,EAAA;AAAA,MACjE,UAAY,EAAA,CAAC,OAAS,EAAA,OAAA,EAAS,YAAY,CAAA;AAAA,KAC5C,CAAA,C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
@@ -1,13 +1,12 @@
1
1
  import * as _grafana_data from '@grafana/data';
2
- import { BusEventWithPayload, PanelData, BusEvent, BusEventType, BusEventHandler, TimeRange, DataQueryRequest, DataTransformContext, DataFrame, PanelPlugin, EventBus, DataQuery as DataQuery$1, DataSourceApi, Registry, RegistryItem, ScopedVars, AdHocVariableFilter, SelectableValue, MetricFindValue, VariableRefresh as VariableRefresh$1, VariableSort, EventFilterOptions, AnnotationEvent, AnnotationQuery, DataTransformerConfig, PanelMenuItem, FieldConfigSource, PanelModel, AbsoluteTimeRange, InterpolateFunction, IconName as IconName$1, FieldConfig, FieldType, FieldValueMatcherConfig } from '@grafana/data';
2
+ import { BusEventWithPayload, PanelData, BusEvent, BusEventType, BusEventHandler, TimeRange, DataQueryRequest, DataTransformContext, DataFrame, PanelPlugin, EventBus, DataQuery, DataSourceApi, Registry, RegistryItem, ScopedVars, AdHocVariableFilter, SelectableValue, MetricFindValue, VariableRefresh as VariableRefresh$1, VariableSort, EventFilterOptions, AnnotationEvent, AnnotationQuery, DataTransformerConfig, PanelMenuItem, FieldConfigSource, PanelModel, AbsoluteTimeRange, InterpolateFunction, IconName as IconName$1, FieldConfig, FieldType, FieldValueMatcherConfig } from '@grafana/data';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { CSSProperties, ComponentType } from 'react';
5
5
  import * as rxjs from 'rxjs';
6
6
  import { Observable, Unsubscribable, MonoTypeOperatorFunction, Subscription, ReplaySubject } from 'rxjs';
7
7
  import * as _grafana_schema from '@grafana/schema';
8
- import { VariableType, VariableHide, TimeZone, DataTopic, DataQuery, DataSourceRef, VariableRefresh, LoadingState, DashboardCursorSync, MatcherConfig, TableFieldOptions } from '@grafana/schema';
8
+ import { VariableType, VariableHide, TimeZone, DataTopic, DataSourceRef, DataQuery as DataQuery$1, VariableRefresh, LoadingState, DashboardCursorSync, MatcherConfig, TableFieldOptions } from '@grafana/schema';
9
9
  import { VariableInterpolation } from '@grafana/runtime';
10
- import { Location } from 'history';
11
10
  import { PanelContext, IconName } from '@grafana/ui';
12
11
  import ReactGridLayout from 'react-grid-layout';
13
12
  import { RouteComponentProps } from 'react-router-dom';
@@ -310,10 +309,6 @@ interface UseStateHookOptions {
310
309
  */
311
310
  shouldActivateOrKeepAlive?: boolean;
312
311
  }
313
- interface SceneDataQuery extends DataQuery {
314
- [key: string]: any;
315
- timeRangeCompare?: boolean;
316
- }
317
312
 
318
313
  /**
319
314
  *
@@ -427,7 +422,7 @@ declare function useSceneObjectState<TState extends SceneObjectState>(model: Sce
427
422
 
428
423
  declare function cloneSceneObjectState<TState extends SceneObjectState>(sceneState: TState, withState?: Partial<TState>): TState;
429
424
 
430
- declare abstract class RuntimeDataSource<TQuery extends DataQuery$1 = DataQuery$1> extends DataSourceApi<TQuery> {
425
+ declare abstract class RuntimeDataSource<TQuery extends DataQuery = DataQuery> extends DataSourceApi<TQuery> {
431
426
  constructor(pluginId: string, uid: string);
432
427
  testDatasource(): Promise<any>;
433
428
  }
@@ -482,6 +477,143 @@ interface MacroVariableConstructor {
482
477
  */
483
478
  declare function registerVariableMacro(name: string, macro: MacroVariableConstructor): () => void;
484
479
 
480
+ interface VariableDependencyConfigOptions<TState extends SceneObjectState> {
481
+ /**
482
+ * State paths to scan / extract variable dependencies from. Leave empty to scan all paths.
483
+ */
484
+ statePaths?: Array<keyof TState | '*'>;
485
+ /**
486
+ * Explicit list of variable names to depend on. Leave empty to scan state for dependencies.
487
+ */
488
+ variableNames?: string[];
489
+ /**
490
+ * Optional way to customize how to handle when a dependent variable changes
491
+ * If not specified the default behavior is to trigger a re-render
492
+ */
493
+ onReferencedVariableValueChanged?: (variable: SceneVariable) => void;
494
+ /**
495
+ * Two scenarios trigger this callback to be called.
496
+ * 1. When any direct dependency changed value
497
+ * 2. In case hasDependencyInLoadingState was called and returned true we really care about any variable update. So in this scenario this callback is called
498
+ * after any variable update completes. This is to cover scenarios where an object is waiting for indirect dependencies to complete.
499
+ */
500
+ onVariableUpdateCompleted?: () => void;
501
+ /**
502
+ * Optional way to subscribe to all variable value changes, even to variables that are not dependencies.
503
+ */
504
+ onAnyVariableChanged?: (variable: SceneVariable) => void;
505
+ }
506
+ declare class VariableDependencyConfig<TState extends SceneObjectState> implements SceneVariableDependencyConfigLike {
507
+ private _sceneObject;
508
+ private _options;
509
+ private _state;
510
+ private _dependencies;
511
+ private _statePaths?;
512
+ private _isWaitingForVariables;
513
+ scanCount: number;
514
+ constructor(_sceneObject: SceneObject<TState>, _options: VariableDependencyConfigOptions<TState>);
515
+ /**
516
+ * Used to check for dependency on a specific variable
517
+ */
518
+ hasDependencyOn(name: string): boolean;
519
+ /**
520
+ * 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.
521
+ */
522
+ variableUpdateCompleted(variable: SceneVariable, hasChanged: boolean): void;
523
+ hasDependencyInLoadingState(): boolean;
524
+ getNames(): Set<string>;
525
+ /**
526
+ * Update variableNames
527
+ */
528
+ setVariableNames(varNames: string[]): void;
529
+ setPaths(paths: Array<keyof TState | '*'>): void;
530
+ private scanStateForDependencies;
531
+ private extractVariablesFrom;
532
+ }
533
+
534
+ interface QueryRunnerState extends SceneObjectState {
535
+ data?: PanelData;
536
+ queries: DataQueryExtended[];
537
+ datasource?: DataSourceRef;
538
+ minInterval?: string;
539
+ maxDataPoints?: number;
540
+ liveStreaming?: boolean;
541
+ maxDataPointsFromWidth?: boolean;
542
+ cacheTimeout?: DataQueryRequest['cacheTimeout'];
543
+ queryCachingTTL?: DataQueryRequest['queryCachingTTL'];
544
+ dataLayerFilter?: DataLayerFilter;
545
+ _hasFetchedData?: boolean;
546
+ }
547
+ interface DataQueryExtended extends DataQuery$1 {
548
+ [key: string]: any;
549
+ timeRangeCompare?: boolean;
550
+ }
551
+ declare class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> implements SceneDataProvider {
552
+ private _querySub?;
553
+ private _dataLayersSub?;
554
+ private _dataLayersMerger;
555
+ private _timeSub?;
556
+ private _timeSubRange?;
557
+ private _containerWidth?;
558
+ private _variableValueRecorder;
559
+ private _results;
560
+ private _scopedVars;
561
+ private _layerAnnotations?;
562
+ private _resultAnnotations?;
563
+ private _adhocFiltersVar?;
564
+ private _groupByVar?;
565
+ getResultsStream(): ReplaySubject<SceneDataProviderResult>;
566
+ protected _variableDependency: VariableDependencyConfig<QueryRunnerState>;
567
+ constructor(initialState: QueryRunnerState);
568
+ private _onActivate;
569
+ private _handleDataLayers;
570
+ private _onLayersReceived;
571
+ /**
572
+ * This tries to start a new query whenever a variable completes or is changed.
573
+ *
574
+ * We care about variable update completions even when the variable has not changed and even when it is not a direct dependency.
575
+ * Example: Variables A and B (B depends on A). A update depends on time range. So when time change query runner will
576
+ * find that variable A is loading which is a dependency on of variable B so will set _isWaitingForVariables to true and
577
+ * not issue any query.
578
+ *
579
+ * When A completes it's loading (with no value change, so B never updates) it will cause a call of this function letting
580
+ * the query runner know that A has completed, and in case _isWaitingForVariables we try to run the query. The query will
581
+ * only run if all variables are in a non loading state so in other scenarios where a query depends on many variables this will
582
+ * be called many times until all dependencies are in a non loading state. *
583
+ */
584
+ private onVariableUpdatesCompleted;
585
+ /**
586
+ * Check if value changed is a adhoc filter o group by variable that did not exist when we issued the last query
587
+ */
588
+ private onAnyVariableChanged;
589
+ private _isRelevantAutoVariable;
590
+ private shouldRunQueriesOnActivate;
591
+ private _isDataTimeRangeStale;
592
+ private _onDeactivate;
593
+ setContainerWidth(width: number): void;
594
+ isDataReadyToDisplay(): boolean;
595
+ private subscribeToTimeRangeChanges;
596
+ runQueries(): void;
597
+ private getMaxDataPoints;
598
+ cancelQuery(): void;
599
+ private runWithTimeRange;
600
+ clone(withState?: Partial<QueryRunnerState>): this;
601
+ private prepareRequests;
602
+ private onDataReceived;
603
+ private _combineDataLayers;
604
+ private _setNoDataState;
605
+ /**
606
+ * Will walk up the scene graph and find the closest time range compare object
607
+ * It performs buttom-up search, including shallow search across object children for supporting controls/header actions
608
+ */
609
+ private getTimeCompare;
610
+ /**
611
+ * Walk up scene graph and find the closest filterset with matching data source
612
+ */
613
+ private findAndSubscribeToAdHocFilters;
614
+ private _updateExplicitVariableDependencies;
615
+ }
616
+
485
617
  declare function renderPrometheusLabelFilters(filters: AdHocVariableFilter[]): string;
486
618
 
487
619
  declare class AdHocFiltersVariableUrlSyncHandler implements SceneObjectUrlSyncHandler {
@@ -601,60 +733,6 @@ declare class ConstantVariable extends SceneObjectBase<ConstantVariableState> im
601
733
  getValue(): VariableValue;
602
734
  }
603
735
 
604
- interface VariableDependencyConfigOptions<TState extends SceneObjectState> {
605
- /**
606
- * State paths to scan / extract variable dependencies from. Leave empty to scan all paths.
607
- */
608
- statePaths?: Array<keyof TState | '*'>;
609
- /**
610
- * Explicit list of variable names to depend on. Leave empty to scan state for dependencies.
611
- */
612
- variableNames?: string[];
613
- /**
614
- * Optional way to customize how to handle when a dependent variable changes
615
- * If not specified the default behavior is to trigger a re-render
616
- */
617
- onReferencedVariableValueChanged?: (variable: SceneVariable) => void;
618
- /**
619
- * Two scenarios trigger this callback to be called.
620
- * 1. When any direct dependency changed value
621
- * 2. In case hasDependencyInLoadingState was called and returned true we really care about any variable update. So in this scenario this callback is called
622
- * after any variable update completes. This is to cover scenarios where an object is waiting for indirect dependencies to complete.
623
- */
624
- onVariableUpdateCompleted?: () => void;
625
- /**
626
- * Optional way to subscribe to all variable value changes, even to variables that are not dependencies.
627
- */
628
- onAnyVariableChanged?: (variable: SceneVariable) => void;
629
- }
630
- declare class VariableDependencyConfig<TState extends SceneObjectState> implements SceneVariableDependencyConfigLike {
631
- private _sceneObject;
632
- private _options;
633
- private _state;
634
- private _dependencies;
635
- private _statePaths?;
636
- private _isWaitingForVariables;
637
- scanCount: number;
638
- constructor(_sceneObject: SceneObject<TState>, _options: VariableDependencyConfigOptions<TState>);
639
- /**
640
- * Used to check for dependency on a specific variable
641
- */
642
- hasDependencyOn(name: string): boolean;
643
- /**
644
- * 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.
645
- */
646
- variableUpdateCompleted(variable: SceneVariable, hasChanged: boolean): void;
647
- hasDependencyInLoadingState(): boolean;
648
- getNames(): Set<string>;
649
- /**
650
- * Update variableNames
651
- */
652
- setVariableNames(varNames: string[]): void;
653
- setPaths(paths: Array<keyof TState | '*'>): void;
654
- private scanStateForDependencies;
655
- private extractVariablesFrom;
656
- }
657
-
658
736
  interface MultiValueVariableState extends SceneVariableState {
659
737
  value: VariableValue;
660
738
  text: VariableValue;
@@ -794,7 +872,7 @@ declare class TextBoxVariable extends SceneObjectBase<TextBoxVariableState> impl
794
872
  interface QueryVariableState extends MultiValueVariableState {
795
873
  type: 'query';
796
874
  datasource: DataSourceRef | null;
797
- query: string | SceneDataQuery;
875
+ query: string | DataQueryExtended;
798
876
  regex: string;
799
877
  refresh: VariableRefresh$1;
800
878
  sort: VariableSort;
@@ -1238,96 +1316,6 @@ declare class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase<SceneT
1238
1316
  onTimeZoneChange(timeZone: string): void;
1239
1317
  }
1240
1318
 
1241
- interface QueryRunnerState extends SceneObjectState {
1242
- data?: PanelData;
1243
- queries: SceneDataQuery[];
1244
- datasource?: DataSourceRef;
1245
- minInterval?: string;
1246
- maxDataPoints?: number;
1247
- liveStreaming?: boolean;
1248
- maxDataPointsFromWidth?: boolean;
1249
- cacheTimeout?: DataQueryRequest['cacheTimeout'];
1250
- queryCachingTTL?: DataQueryRequest['queryCachingTTL'];
1251
- dataLayerFilter?: DataLayerFilter;
1252
- _hasFetchedData?: boolean;
1253
- }
1254
- declare class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> implements SceneDataProvider {
1255
- private _querySub?;
1256
- private _dataLayersSub?;
1257
- private _dataLayersMerger;
1258
- private _timeSub?;
1259
- private _timeSubRange?;
1260
- private _containerWidth?;
1261
- private _variableValueRecorder;
1262
- private _results;
1263
- private _scopedVars;
1264
- private _layerAnnotations?;
1265
- private _resultAnnotations?;
1266
- private _adhocFiltersVar?;
1267
- private _groupByVar?;
1268
- getResultsStream(): ReplaySubject<SceneDataProviderResult>;
1269
- protected _variableDependency: VariableDependencyConfig<QueryRunnerState>;
1270
- constructor(initialState: QueryRunnerState);
1271
- private _onActivate;
1272
- private _handleDataLayers;
1273
- private _onLayersReceived;
1274
- /**
1275
- * This tries to start a new query whenever a variable completes or is changed.
1276
- *
1277
- * We care about variable update completions even when the variable has not changed and even when it is not a direct dependency.
1278
- * Example: Variables A and B (B depends on A). A update depends on time range. So when time change query runner will
1279
- * find that variable A is loading which is a dependency on of variable B so will set _isWaitingForVariables to true and
1280
- * not issue any query.
1281
- *
1282
- * When A completes it's loading (with no value change, so B never updates) it will cause a call of this function letting
1283
- * the query runner know that A has completed, and in case _isWaitingForVariables we try to run the query. The query will
1284
- * only run if all variables are in a non loading state so in other scenarios where a query depends on many variables this will
1285
- * be called many times until all dependencies are in a non loading state. *
1286
- */
1287
- private onVariableUpdatesCompleted;
1288
- /**
1289
- * Check if value changed is a adhoc filter o group by variable that did not exist when we issued the last query
1290
- */
1291
- private onAnyVariableChanged;
1292
- private _isRelevantAutoVariable;
1293
- private shouldRunQueriesOnActivate;
1294
- private _isDataTimeRangeStale;
1295
- private _onDeactivate;
1296
- setContainerWidth(width: number): void;
1297
- isDataReadyToDisplay(): boolean;
1298
- private subscribeToTimeRangeChanges;
1299
- runQueries(): void;
1300
- private getMaxDataPoints;
1301
- cancelQuery(): void;
1302
- private runWithTimeRange;
1303
- clone(withState?: Partial<QueryRunnerState>): this;
1304
- private prepareRequests;
1305
- private onDataReceived;
1306
- private _combineDataLayers;
1307
- private _setNoDataState;
1308
- /**
1309
- * Walk up the scene graph and find any ExtraQueryProviders.
1310
- *
1311
- * This will return an array of the closest provider of each type.
1312
- */
1313
- private getClosestExtraQueryProviders;
1314
- /**
1315
- * Walk up scene graph and find the closest filterset with matching data source
1316
- */
1317
- private findAndSubscribeToAdHocFilters;
1318
- private _updateExplicitVariableDependencies;
1319
- }
1320
-
1321
- type ExtraQueryDataProcessor = (primary: PanelData, secondary: PanelData) => Observable<PanelData>;
1322
- interface ExtraQueryDescriptor {
1323
- req: DataQueryRequest;
1324
- processor?: ExtraQueryDataProcessor;
1325
- }
1326
- interface ExtraQueryProvider<T extends SceneObjectState> extends SceneObjectBase<T> {
1327
- getExtraQueries(request: DataQueryRequest): ExtraQueryDescriptor[];
1328
- shouldRerun(prev: T, next: T): boolean;
1329
- }
1330
-
1331
1319
  declare abstract class SceneDataLayerSetBase<T extends SceneDataLayerProviderState> extends SceneObjectBase<T> implements SceneDataLayerProvider {
1332
1320
  /** Mark it as a data layer */
1333
1321
  isDataLayer: true;
@@ -1413,13 +1401,6 @@ declare class VariableValueSelectors extends SceneObjectBase<VariableValueSelect
1413
1401
  static Component: typeof VariableValueSelectorsRenderer;
1414
1402
  }
1415
1403
  declare function VariableValueSelectorsRenderer({ model }: SceneComponentProps<VariableValueSelectors>): React__default.JSX.Element;
1416
- interface VariableSelectProps {
1417
- layout?: ControlsLayout;
1418
- variable: SceneVariable;
1419
- /** To override hide from VariableValueSelectByName */
1420
- showAlways?: boolean;
1421
- }
1422
- declare function VariableValueSelectWrapper({ variable, layout, showAlways }: VariableSelectProps): React__default.JSX.Element | null;
1423
1404
 
1424
1405
  interface VariableValueControlState extends SceneObjectState {
1425
1406
  layout?: ControlsLayout;
@@ -1560,38 +1541,26 @@ interface UrlSyncManagerLike {
1560
1541
  initSync(root: SceneObject): void;
1561
1542
  cleanUp(root: SceneObject): void;
1562
1543
  getUrlState(root: SceneObject): SceneObjectUrlValues;
1563
- handleNewLocation(location: Location): void;
1564
- handleNewObject(sceneObj: SceneObject): void;
1565
1544
  }
1566
1545
  declare class UrlSyncManager implements UrlSyncManagerLike {
1567
1546
  private _urlKeyMapper;
1568
- private _sceneRoot?;
1547
+ private _sceneRoot;
1569
1548
  private _stateSub;
1570
- private _lastLocation;
1571
- private _urlParams;
1549
+ private _locationSub?;
1550
+ private _lastPath?;
1551
+ private _ignoreNextLocationUpdate;
1572
1552
  /**
1573
1553
  * Updates the current scene state to match URL state.
1574
1554
  */
1575
1555
  initSync(root: SceneObject): void;
1576
1556
  cleanUp(root: SceneObject): void;
1577
- handleNewLocation(location: Location): void;
1578
- handleNewObject(sceneObj: SceneObject): void;
1557
+ syncFrom(sceneObj: SceneObject): void;
1558
+ private _onLocationUpdate;
1579
1559
  private _onStateChanged;
1580
1560
  getUrlState(root: SceneObject): SceneObjectUrlValues;
1581
1561
  }
1582
1562
  declare function getUrlSyncManager(): UrlSyncManagerLike;
1583
1563
 
1584
- declare function useUrlSync(sceneRoot: SceneObject): boolean;
1585
-
1586
- interface UrlSyncContextProviderProps {
1587
- scene: SceneObject;
1588
- children: React.ReactNode;
1589
- }
1590
- /**
1591
- * Right now this is actually not defining a context, but think it might in the future (with UrlSyncManager as the context value)
1592
- */
1593
- declare function UrlSyncContextProvider({ children, scene }: UrlSyncContextProviderProps): React$1.ReactNode;
1594
-
1595
1564
  interface EmbeddedSceneState extends SceneObjectState {
1596
1565
  /**
1597
1566
  * The main content of the scene (usually a SceneFlexLayout)
@@ -1605,6 +1574,13 @@ interface EmbeddedSceneState extends SceneObjectState {
1605
1574
  declare class EmbeddedScene extends SceneObjectBase<EmbeddedSceneState> {
1606
1575
  static Component: typeof EmbeddedSceneRenderer;
1607
1576
  constructor(state: EmbeddedSceneState);
1577
+ /**
1578
+ * initUrlSync should be called before the scene is rendered to ensure that objects are in sync
1579
+ * before they get activated. This saves some unnecessary re-renders and makes sure variables
1580
+ * queries are issued as needed. If your using SceneAppPage you will not need to call this as
1581
+ * url sync is handled on the SceneAppPage level not this level.
1582
+ */
1583
+ initUrlSync(): void;
1608
1584
  }
1609
1585
  declare function EmbeddedSceneRenderer({ model }: SceneComponentProps<EmbeddedScene>): React__default.JSX.Element;
1610
1586
 
@@ -1692,7 +1668,6 @@ declare class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends Scen
1692
1668
  onFieldConfigChange: (fieldConfigUpdate: FieldConfigSource<DeepPartial<TFieldConfig>>, replace?: boolean) => void;
1693
1669
  interpolate: InterpolateFunction;
1694
1670
  getDescription: () => string;
1695
- clearFieldConfigCache(): void;
1696
1671
  /**
1697
1672
  * Called from the react render path to apply the field config to the data provided by the data provider
1698
1673
  */
@@ -1801,6 +1776,9 @@ declare class SceneRefreshPicker extends SceneObjectBase<SceneRefreshPickerState
1801
1776
  }
1802
1777
  declare function SceneRefreshPickerRenderer({ model }: SceneComponentProps<SceneRefreshPicker>): React__default.JSX.Element;
1803
1778
 
1779
+ interface TimeRangeCompareProvider {
1780
+ getCompareTimeRange(timeRange: TimeRange): TimeRange | undefined;
1781
+ }
1804
1782
  interface SceneTimeRangeCompareState extends SceneObjectState {
1805
1783
  compareWith?: string;
1806
1784
  compareOptions: Array<{
@@ -1808,7 +1786,7 @@ interface SceneTimeRangeCompareState extends SceneObjectState {
1808
1786
  value: string;
1809
1787
  }>;
1810
1788
  }
1811
- declare class SceneTimeRangeCompare extends SceneObjectBase<SceneTimeRangeCompareState> implements ExtraQueryProvider<SceneTimeRangeCompareState> {
1789
+ declare class SceneTimeRangeCompare extends SceneObjectBase<SceneTimeRangeCompareState> implements TimeRangeCompareProvider {
1812
1790
  static Component: typeof SceneTimeRangeCompareRenderer;
1813
1791
  protected _urlSync: SceneObjectUrlSyncConfig;
1814
1792
  constructor(state: Partial<SceneTimeRangeCompareState>);
@@ -1819,8 +1797,6 @@ declare class SceneTimeRangeCompare extends SceneObjectBase<SceneTimeRangeCompar
1819
1797
  }[];
1820
1798
  onCompareWithChanged: (compareWith: string) => void;
1821
1799
  onClearCompare: () => void;
1822
- getExtraQueries(request: DataQueryRequest): ExtraQueryDescriptor[];
1823
- shouldRerun(prev: SceneTimeRangeCompareState, next: SceneTimeRangeCompareState): boolean;
1824
1800
  getCompareTimeRange(timeRange: TimeRange): TimeRange | undefined;
1825
1801
  getUrlState(): SceneObjectUrlValues;
1826
1802
  updateFromUrl(values: SceneObjectUrlValues): void;
@@ -2220,12 +2196,6 @@ type StandardFieldConfigInterface<T, C, Prefix extends string> = {
2220
2196
  [K in Exclude<keyof T, keyof any[]> as `${Prefix}${Capitalize<string & K>}`]: (value: T[K]) => C;
2221
2197
  };
2222
2198
  type StandardFieldConfig = Pick<FieldConfig, 'color' | 'decimals' | 'displayName' | 'filterable' | 'links' | 'mappings' | 'max' | 'min' | 'noValue' | 'thresholds' | 'unit'>;
2223
- interface VizConfig<TOptions = {}, TFieldConfig = {}> {
2224
- pluginId: string;
2225
- pluginVersion: string;
2226
- options: DeepPartial<TOptions>;
2227
- fieldConfig: FieldConfigSource<DeepPartial<TFieldConfig>>;
2228
- }
2229
2199
 
2230
2200
  declare class StandardFieldConfigOverridesBuilder<T extends StandardFieldConfigOverridesBuilder<T>> implements StandardFieldConfigInterface<StandardFieldConfig, T, 'override'> {
2231
2201
  protected _overrides: Array<{
@@ -2534,92 +2504,6 @@ interface Props {
2534
2504
  */
2535
2505
  declare function SceneDebugger({ scene }: Props): React__default.JSX.Element;
2536
2506
 
2537
- declare class VizConfigBuilder<TOptions extends {}, TFieldConfig extends {}> implements StandardFieldConfigInterface<StandardFieldConfig, VizConfigBuilder<TOptions, TFieldConfig>, 'set'> {
2538
- private _fieldConfigBuilder;
2539
- private _panelOptionsBuilder;
2540
- private _pluginId;
2541
- private _pluginVersion;
2542
- constructor(pluginId: string, pluginVersion: string, defaultOptions?: () => Partial<TOptions>, defaultFieldConfig?: () => TFieldConfig);
2543
- /**
2544
- * Set color.
2545
- */
2546
- setColor(color: StandardFieldConfig['color']): this;
2547
- /**
2548
- * Set number of decimals to show.
2549
- */
2550
- setDecimals(decimals: StandardFieldConfig['decimals']): this;
2551
- /**
2552
- * Set field display name.
2553
- */
2554
- setDisplayName(displayName: StandardFieldConfig['displayName']): this;
2555
- /**
2556
- * Set the standard field config property filterable.
2557
- */
2558
- setFilterable(filterable: StandardFieldConfig['filterable']): this;
2559
- /**
2560
- * Set data links.
2561
- */
2562
- setLinks(links: StandardFieldConfig['links']): this;
2563
- /**
2564
- * Set value mappings.
2565
- */
2566
- setMappings(mappings: StandardFieldConfig['mappings']): this;
2567
- /**
2568
- * Set the standard field config property max.
2569
- */
2570
- setMax(max: StandardFieldConfig['max']): this;
2571
- /**
2572
- * Set the standard field config property min.
2573
- */
2574
- setMin(min: StandardFieldConfig['min']): this;
2575
- /**
2576
- * Set the standard field config property noValue.
2577
- */
2578
- setNoValue(noValue: StandardFieldConfig['noValue']): this;
2579
- /**
2580
- * Set the standard field config property thresholds.
2581
- */
2582
- setThresholds(thresholds: StandardFieldConfig['thresholds']): this;
2583
- /**
2584
- * Set the standard field config property unit.
2585
- */
2586
- setUnit(unit: StandardFieldConfig['unit']): this;
2587
- setCustomFieldConfig<T extends TFieldConfig, K extends keyof T>(id: K, value: DeepPartial<T[K]>): this;
2588
- setOverrides(builder: (b: FieldConfigOverridesBuilder<TFieldConfig>) => void): this;
2589
- /**
2590
- * Set an individual panel option. This will merge the value with the existing options.
2591
- */
2592
- setOption<T extends TOptions, K extends keyof T>(id: K, value: DeepPartial<T[K]>): this;
2593
- /**
2594
- * Build the panel.
2595
- */
2596
- build(): VizConfig<TOptions, TFieldConfig>;
2597
- }
2598
-
2599
- declare const VizConfigBuilders: {
2600
- barchart(): VizConfigBuilder<Options, FieldConfig$1>;
2601
- bargauge(): VizConfigBuilder<Options$1, {}>;
2602
- datagrid(): VizConfigBuilder<Options$2, {}>;
2603
- flamegraph(): VizConfigBuilder<{}, {}>;
2604
- gauge(): VizConfigBuilder<Options$3, {}>;
2605
- geomap(): VizConfigBuilder<Options$4, {}>;
2606
- heatmap(): VizConfigBuilder<Options$5, FieldConfig$2>;
2607
- histogram(): VizConfigBuilder<Options$6, FieldConfig$3>;
2608
- logs(): VizConfigBuilder<Options$7, {}>;
2609
- news(): VizConfigBuilder<Options$8, {}>;
2610
- nodegraph(): VizConfigBuilder<Options$9, {}>;
2611
- piechart(): VizConfigBuilder<Options$a, FieldConfig$4>;
2612
- stat(): VizConfigBuilder<Options$b, {}>;
2613
- statetimeline(): VizConfigBuilder<Options$c, FieldConfig$5>;
2614
- statushistory(): VizConfigBuilder<Options$d, FieldConfig$6>;
2615
- table(): VizConfigBuilder<Options$e, TableFieldOptions>;
2616
- text(): VizConfigBuilder<Options$f, {}>;
2617
- timeseries(): VizConfigBuilder<Options$g, FieldConfig$7>;
2618
- trend(): VizConfigBuilder<{}, {}>;
2619
- traces(): VizConfigBuilder<Options$h, FieldConfig$8>;
2620
- xychart(): VizConfigBuilder<Options$i, {}>;
2621
- };
2622
-
2623
2507
  declare const sceneUtils: {
2624
2508
  getUrlWithAppState: typeof getUrlWithAppState;
2625
2509
  registerRuntimePanelPlugin: typeof registerRuntimePanelPlugin;
@@ -2639,4 +2523,4 @@ declare const sceneUtils: {
2639
2523
  isGroupByVariable: typeof isGroupByVariable;
2640
2524
  };
2641
2525
 
2642
- export { AdHocFiltersVariable, CancelActivationHandler, ConstantVariable, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariable, CustomVariableValue, DataLayerFilter, DataRequestEnricher, DataSourceVariable, DeepPartial, EmbeddedScene, EmbeddedSceneState, ExtraQueryDataProcessor, ExtraQueryDescriptor, ExtraQueryProvider, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, FormatVariable, GroupByVariable, InterpolationFormatParameter, IntervalVariable, LocalValueVariable, MacroVariableConstructor, MultiValueVariable, NestedScene, PanelBuilders, PanelOptionsBuilders, QueryRunnerState, QueryVariable, RuntimeDataSource, SceneActivationHandler, SceneApp, SceneAppDrilldownView, SceneAppPage, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneComponent, SceneComponentProps, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataProvider, SceneDataProviderResult, SceneDataQuery, SceneDataState, SceneDataTransformer, SceneDeactivationHandler, SceneDebugger, SceneFlexItem, SceneFlexItemLike, SceneFlexItemState, SceneFlexLayout, SceneGridItem, SceneGridItemLike, SceneGridItemStateLike, SceneGridLayout, SceneGridRow, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectBase, SceneObjectRef, SceneObjectState, SceneObjectStateChangedEvent, SceneObjectStateChangedPayload, SceneObjectUrlSyncConfig, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneRefreshPickerState, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeLike, SceneTimeRangeState, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSet, SceneVariableSetState, SceneVariableState, SceneVariableValueChangedEvent, SceneVariables, SplitLayout, TestVariable, TextBoxVariable, UrlSyncContextProvider, UrlSyncManager, UrlSyncManagerLike, UseStateHookOptions, UserActionEvent, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableDependencyConfig, VariableValue, VariableValueControl, VariableValueOption, VariableValueSelectWrapper, VariableValueSelectors, VariableValueSingle, VizConfig, VizConfigBuilder, VizConfigBuilders, VizPanel, VizPanelBuilder, VizPanelMenu, VizPanelState, index$1 as behaviors, index as dataLayers, formatRegistry, getUrlSyncManager, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isSceneObject, registerQueryWithController, registerRuntimeDataSource, sceneGraph, sceneUtils, useSceneApp, useSceneObjectState, useUrlSync };
2526
+ export { AdHocFiltersVariable, CancelActivationHandler, ConstantVariable, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariable, CustomVariableValue, DataLayerFilter, DataRequestEnricher, DataSourceVariable, DeepPartial, EmbeddedScene, EmbeddedSceneState, FieldConfigBuilders, FieldConfigOverridesBuilder, FormatVariable, GroupByVariable, InterpolationFormatParameter, IntervalVariable, LocalValueVariable, MacroVariableConstructor, MultiValueVariable, NestedScene, PanelBuilders, PanelOptionsBuilders, QueryRunnerState, QueryVariable, RuntimeDataSource, SceneActivationHandler, SceneApp, SceneAppDrilldownView, SceneAppPage, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneComponent, SceneComponentProps, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataProvider, SceneDataProviderResult, SceneDataState, SceneDataTransformer, SceneDeactivationHandler, SceneDebugger, SceneFlexItem, SceneFlexItemLike, SceneFlexItemState, SceneFlexLayout, SceneGridItem, SceneGridItemLike, SceneGridItemStateLike, SceneGridLayout, SceneGridRow, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectBase, SceneObjectRef, SceneObjectState, SceneObjectStateChangedEvent, SceneObjectStateChangedPayload, SceneObjectUrlSyncConfig, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeLike, SceneTimeRangeState, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSet, SceneVariableSetState, SceneVariableState, SceneVariableValueChangedEvent, SceneVariables, SplitLayout, TestVariable, TextBoxVariable, UrlSyncManager, UrlSyncManagerLike, UseStateHookOptions, UserActionEvent, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableDependencyConfig, VariableValue, VariableValueControl, VariableValueOption, VariableValueSelectors, VariableValueSingle, VizPanel, VizPanelBuilder, VizPanelMenu, VizPanelState, index$1 as behaviors, index as dataLayers, formatRegistry, getUrlSyncManager, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isSceneObject, registerQueryWithController, registerRuntimeDataSource, sceneGraph, sceneUtils, useSceneApp, useSceneObjectState };