@altertable/data-app 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +38 -1
- package/CONTRIBUTING.md +37 -3
- package/README.md +1 -1
- package/dist/chunks/{contract-sm7j7k95.js → contract-13j5zb3c.js} +2 -144
- package/dist/chunks/contract-13j5zb3c.js.map +13 -0
- package/dist/chunks/contract-19ckn3n7.js +78 -0
- package/dist/chunks/contract-19ckn3n7.js.map +10 -0
- package/dist/chunks/{contract-a061yj6r.js → contract-e11m4y7f.js} +34 -70
- package/dist/chunks/contract-e11m4y7f.js.map +12 -0
- package/dist/chunks/{contract-g6hky7x6.js → contract-h8a6f559.js} +8 -4
- package/dist/chunks/contract-h8a6f559.js.map +12 -0
- package/dist/chunks/contract-havnjmdr.js +13011 -0
- package/dist/chunks/contract-havnjmdr.js.map +99 -0
- package/dist/chunks/{contract-txjy0en2.js → contract-m6n8ctfc.js} +64 -72
- package/dist/chunks/contract-m6n8ctfc.js.map +10 -0
- package/dist/chunks/contract-pk603qj7.js +146 -0
- package/dist/chunks/contract-pk603qj7.js.map +10 -0
- package/dist/chunks/{contract-yxbjea23.js → contract-rfbakka4.js} +179 -2
- package/dist/chunks/contract-rfbakka4.js.map +13 -0
- package/dist/client/index.js +11 -6
- package/dist/client/index.js.map +1 -1
- package/dist/core/appearance.js +1 -1
- package/dist/core/contract.js +13 -3
- package/dist/core/contract.js.map +1 -1
- package/dist/embed/index.js +9 -7
- package/dist/embed/index.js.map +2 -2
- package/dist/local.js +1 -1
- package/dist/local.js.map +2 -2
- package/dist/react/embed/index.js +1 -1
- package/dist/react/index.js +2532 -11545
- package/dist/react/index.js.map +16 -91
- package/dist/react/ui/index.js +1614 -0
- package/dist/react/ui/index.js.map +22 -0
- package/dist/server.js +1 -1
- package/dist/server.js.map +2 -2
- package/dist/types/client/annotations.d.ts +23 -0
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/core/annotations.d.ts +92 -0
- package/dist/types/core/appearance.d.ts +2 -2
- package/dist/types/core/contract.d.ts +2 -0
- package/dist/types/core/presentation.d.ts +2 -0
- package/dist/types/core/variables.d.ts +2 -5
- package/dist/types/react/annotations/AnnotationBar.d.ts +24 -0
- package/dist/types/react/annotations/AnnotationControls.d.ts +10 -0
- package/dist/types/react/annotations/AnnotationEditor.d.ts +15 -0
- package/dist/types/react/annotations/AnnotationMarkers.d.ts +19 -0
- package/dist/types/react/annotations/AnnotationSelectionLayer.d.ts +12 -0
- package/dist/types/react/annotations/AnnotationTarget.d.ts +9 -0
- package/dist/types/react/annotations/AnnotationTooltip.d.ts +9 -0
- package/dist/types/react/annotations/AnnotationTrigger.d.ts +10 -0
- package/dist/types/react/annotations/annotation-editor-state.d.ts +56 -0
- package/dist/types/react/annotations/annotation-screenshot.d.ts +4 -0
- package/dist/types/react/annotations/annotation-targets.d.ts +33 -0
- package/dist/types/react/annotations/getAnnotationProps.d.ts +15 -0
- package/dist/types/react/annotations/styles.d.ts +3 -0
- package/dist/types/react/annotations/useAnnotationGeometry.d.ts +22 -0
- package/dist/types/react/annotations/useDataAppAnnotations.d.ts +19 -0
- package/dist/types/react/bindings.d.ts +110 -0
- package/dist/types/react/content.d.ts +24 -11
- package/dist/types/react/hooks.d.ts +29 -787
- package/dist/types/react/index.d.ts +30 -105
- package/dist/types/react/source-owner.d.ts +2 -0
- package/dist/types/react/style-contract.d.ts +60 -0
- package/dist/types/react/style-validation.d.ts +2 -0
- package/dist/types/react/ui/AboutData.d.ts +9 -1
- package/dist/types/react/ui/AppHeader.d.ts +1 -2
- package/dist/types/react/ui/AppLayout.d.ts +3 -9
- package/dist/types/react/ui/AppToolbar.d.ts +5 -8
- package/dist/types/react/ui/AreaChart.d.ts +7 -0
- package/dist/types/react/ui/BarChart.d.ts +6 -0
- package/dist/types/react/ui/{ComparisonVisual.d.ts → Comparison.d.ts} +3 -3
- package/dist/types/react/ui/ContentSkeleton.d.ts +2 -0
- package/dist/types/react/ui/DataApp.d.ts +17 -58
- package/dist/types/react/ui/DataAppFrame.d.ts +42 -0
- package/dist/types/react/ui/DataBoundary.d.ts +4 -5
- package/dist/types/react/ui/DataSection.d.ts +6 -18
- package/dist/types/react/ui/DataSectionBoundary.d.ts +30 -0
- package/dist/types/react/ui/DataValue.d.ts +9 -0
- package/dist/types/react/ui/DataWidget.d.ts +2 -1
- package/dist/types/react/ui/DateTimeTooltip.d.ts +1 -1
- package/dist/types/react/ui/ExportControl.d.ts +1 -1
- package/dist/types/react/ui/HelpPopover.d.ts +3 -4
- package/dist/types/react/ui/InspectionContext.d.ts +2 -0
- package/dist/types/react/ui/InspectionProvider.d.ts +29 -0
- package/dist/types/react/ui/LineChart.d.ts +7 -0
- package/dist/types/react/ui/MetricWidget.d.ts +4 -3
- package/dist/types/react/ui/PieChart.d.ts +8 -0
- package/dist/types/react/ui/PresentStory.d.ts +2 -5
- package/dist/types/react/ui/RefreshControl.d.ts +1 -2
- package/dist/types/react/ui/ScatterChart.d.ts +17 -0
- package/dist/types/react/ui/SearchField.d.ts +1 -2
- package/dist/types/react/ui/SearchInput.d.ts +3 -1
- package/dist/types/react/ui/Sheet.d.ts +2 -1
- package/dist/types/react/ui/Skeleton.d.ts +5 -2
- package/dist/types/react/ui/StaticDataApp.d.ts +4 -0
- package/dist/types/react/ui/TableWidget.d.ts +19 -16
- package/dist/types/react/ui/Tabs.d.ts +6 -2
- package/dist/types/react/ui/TextWidget.d.ts +2 -1
- package/dist/types/react/ui/Tooltip.d.ts +4 -3
- package/dist/types/react/ui/TrendChart.d.ts +5 -0
- package/dist/types/react/ui/UpdatedAt.d.ts +1 -1
- package/dist/types/react/ui/VisualizationWidget.d.ts +12 -13
- package/dist/types/react/ui/WidgetViewTabs.d.ts +1 -1
- package/dist/types/react/ui/chart-data.d.ts +25 -0
- package/dist/types/react/ui/data-context.d.ts +18 -7
- package/dist/types/react/ui/icons.d.ts +1 -0
- package/dist/types/react/ui/index.d.ts +74 -0
- package/dist/types/react/ui/metric.d.ts +1 -1
- package/dist/types/react/ui/presentation.d.ts +5 -1
- package/dist/types/react/ui/shortcuts.d.ts +7 -1
- package/dist/types/react/view-runtime.d.ts +29 -0
- package/dist/types/react/view.d.ts +21 -4
- package/dist/types/react/widgets.d.ts +79 -0
- package/docs/app-authoring.md +58 -50
- package/docs/data-context.md +89 -0
- package/docs/formatting-and-appearance.md +52 -0
- package/docs/hosted-apps.md +0 -13
- package/docs/layout.md +4 -2
- package/docs/react-embed.md +2 -2
- package/docs/react.md +20 -316
- package/docs/stories-and-export.md +52 -0
- package/docs/styling.md +55 -0
- package/docs/ui-quality.md +20 -0
- package/docs/ui.md +41 -0
- package/docs/variables.md +98 -0
- package/docs/views.md +127 -0
- package/docs/widgets.md +142 -0
- package/examples/starter-data-app/index.tsx +82 -55
- package/package.json +12 -4
- package/dist/chunks/contract-a061yj6r.js.map +0 -12
- package/dist/chunks/contract-g6hky7x6.js.map +0 -12
- package/dist/chunks/contract-sm7j7k95.js.map +0 -14
- package/dist/chunks/contract-txjy0en2.js.map +0 -10
- package/dist/chunks/contract-yxbjea23.js.map +0 -12
- package/dist/types/react/ui/RefreshRegion.d.ts +0 -9
- package/dist/types/react/ui/SelectableBarChart.d.ts +0 -15
- package/docs/releasing.md +0 -79
- /package/dist/types/react/ui/{comparison.d.ts → metric-comparison.d.ts} +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { DataAppAnnotationDraft } from '../../core/annotations.js';
|
|
2
|
+
import type { AnnotationTargetElement } from './annotation-targets.js';
|
|
3
|
+
export type AnnotationEditorState = {
|
|
4
|
+
target: AnnotationTargetElement;
|
|
5
|
+
draft: DataAppAnnotationDraft;
|
|
6
|
+
annotationId?: string;
|
|
7
|
+
comment: string;
|
|
8
|
+
captureStatus: 'capturing' | 'ready' | 'failed';
|
|
9
|
+
error: string;
|
|
10
|
+
discardArmed: boolean;
|
|
11
|
+
shaking: boolean;
|
|
12
|
+
};
|
|
13
|
+
type AnnotationControlsState = {
|
|
14
|
+
annotationModeActive: boolean;
|
|
15
|
+
observedActive: boolean;
|
|
16
|
+
hoveredTarget?: AnnotationTargetElement;
|
|
17
|
+
editor?: AnnotationEditorState;
|
|
18
|
+
saving: boolean;
|
|
19
|
+
};
|
|
20
|
+
type AnnotationControlsAction = {
|
|
21
|
+
type: 'annotationModeChanged';
|
|
22
|
+
active: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'externalModeObserved';
|
|
25
|
+
active: boolean;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'targetHovered';
|
|
28
|
+
target?: AnnotationTargetElement;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'editorOpened';
|
|
31
|
+
editor: AnnotationEditorState;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'editorClosed';
|
|
34
|
+
} | {
|
|
35
|
+
type: 'commentChanged';
|
|
36
|
+
comment: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'captureCompleted';
|
|
39
|
+
draftId: string;
|
|
40
|
+
succeeded: boolean;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'editorEscaped';
|
|
43
|
+
hasUnsavedChanges: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'shakeFinished';
|
|
46
|
+
} | {
|
|
47
|
+
type: 'saveStarted';
|
|
48
|
+
} | {
|
|
49
|
+
type: 'saveFailed';
|
|
50
|
+
error: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'saveFinished';
|
|
53
|
+
};
|
|
54
|
+
export declare function createAnnotationControlsState(active: boolean): AnnotationControlsState;
|
|
55
|
+
export declare function annotationControlsReducer(state: AnnotationControlsState, action: AnnotationControlsAction): AnnotationControlsState;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnnotationRect } from './annotation-targets.js';
|
|
2
|
+
import type { DataAppAnnotationDraft } from '../../core/annotations.js';
|
|
3
|
+
/** Capture the visible target at selection time; never include annotation controls. */
|
|
4
|
+
export declare function captureAnnotationScreenshot(element: HTMLElement, region?: AnnotationRect): Promise<NonNullable<DataAppAnnotationDraft['context']['screenshot']>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type AnnotationPoint = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export type AnnotationRect = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export type AnnotationTargetElement = {
|
|
12
|
+
element: HTMLElement;
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
kind: 'widget' | 'element' | 'app';
|
|
16
|
+
};
|
|
17
|
+
export declare function discoverAnnotationTargets(root: HTMLElement | null): {
|
|
18
|
+
targets: AnnotationTargetElement[];
|
|
19
|
+
hasDuplicateIds: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare function annotationGeometry(element: HTMLElement): AnnotationRect;
|
|
22
|
+
export declare function annotationPoint(rect: AnnotationRect, point?: AnnotationPoint): {
|
|
23
|
+
cursor: AnnotationPoint;
|
|
24
|
+
anchor: {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/** The iframe document is a crop surface, never a selectable global-layout target. */
|
|
30
|
+
export declare function annotationRoot(root: HTMLElement | null): AnnotationTargetElement | undefined;
|
|
31
|
+
export declare function findAnnotationTarget(root: HTMLElement | null, id: string | undefined): AnnotationTargetElement | undefined;
|
|
32
|
+
export declare function normalizeAnnotationRect(area: AnnotationRect, target: AnnotationRect): AnnotationRect;
|
|
33
|
+
export declare function projectAnnotationRect(area: AnnotationRect, target: AnnotationRect): AnnotationRect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WidgetEvidence } from '../ui/WidgetEvidence.js';
|
|
2
|
+
type AnnotationPropsOptions = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
evidence?: WidgetEvidence;
|
|
6
|
+
kind?: 'widget' | 'element';
|
|
7
|
+
};
|
|
8
|
+
export declare function getAnnotationProps({ id, label, evidence, kind, }: AnnotationPropsOptions): {
|
|
9
|
+
'data-annotation-id': string | undefined;
|
|
10
|
+
'data-annotation-label': string | undefined;
|
|
11
|
+
'data-annotation-kind': "element" | "widget";
|
|
12
|
+
'data-annotation-queries': string;
|
|
13
|
+
'data-annotation-glossary': string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ComponentRef, type RefObject } from 'react';
|
|
2
|
+
import type { DataAppAnnotationPresentation } from '../../core/annotations.js';
|
|
3
|
+
import { type AnnotationRect, type AnnotationTargetElement } from './annotation-targets.js';
|
|
4
|
+
import type { AnnotationPin } from './AnnotationMarkers.js';
|
|
5
|
+
type AnnotationRootRef = RefObject<ComponentRef<'div'> | null>;
|
|
6
|
+
export declare function useAnnotationTargets(rootRef: AnnotationRootRef, active: boolean): {
|
|
7
|
+
targets: AnnotationTargetElement[];
|
|
8
|
+
hasDuplicateIds: boolean;
|
|
9
|
+
} & {
|
|
10
|
+
scope?: HTMLElement;
|
|
11
|
+
};
|
|
12
|
+
type AnnotationGeometryOptions = {
|
|
13
|
+
rootRef: AnnotationRootRef;
|
|
14
|
+
target?: AnnotationTargetElement;
|
|
15
|
+
region?: AnnotationRect;
|
|
16
|
+
targets: DataAppAnnotationPresentation['targets'];
|
|
17
|
+
};
|
|
18
|
+
export declare function useAnnotationGeometry({ rootRef, target, region, targets, }: AnnotationGeometryOptions): {
|
|
19
|
+
pins: AnnotationPin[];
|
|
20
|
+
outline?: AnnotationRect;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Bind annotation delivery to this app's current iframe bridge. The host owns storage and submission. */
|
|
2
|
+
export declare function useDataAppAnnotations(): {
|
|
3
|
+
reportAnnotationEditorState(state: {
|
|
4
|
+
hasUnsavedChanges: boolean;
|
|
5
|
+
}, options?: {
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}): Promise<null>;
|
|
8
|
+
addAnnotation(draft: import("../../core/annotations.js").DataAppAnnotationDraft, options?: {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}): Promise<null>;
|
|
11
|
+
updateAnnotation(id: string, comment: string, options?: {
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}): Promise<null>;
|
|
14
|
+
requestAnnotationModeChange(request: {
|
|
15
|
+
active: boolean;
|
|
16
|
+
}, options?: {
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
}): Promise<null>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { EvidenceDeclaration } from './ui/data-context.js';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { DateRangeRequest } from '../core/contract.js';
|
|
4
|
+
import type { DataView, DisplayedSnapshot } from '../core/data-view.js';
|
|
5
|
+
import type { MetricFormat } from '../core/format.js';
|
|
6
|
+
import type { DataReading, MetricValues } from '../core/reading.js';
|
|
7
|
+
import type { CsvCell, CsvTable, CsvExport } from './ui/csv-export.js';
|
|
8
|
+
import type { MetricDefinition } from './ui/metric.js';
|
|
9
|
+
import type { EmptyContent } from './ui/presentation.js';
|
|
10
|
+
import type { TableWidgetColumn } from './ui/TableWidget.js';
|
|
11
|
+
import type { WidgetEvidence } from './ui/WidgetEvidence.js';
|
|
12
|
+
/** Displayed data, or an initial loading reading. Pending filter values are never a source. */
|
|
13
|
+
export type ViewSource<Data, Input> = {
|
|
14
|
+
loading: true;
|
|
15
|
+
} | {
|
|
16
|
+
loading?: false;
|
|
17
|
+
data: Data;
|
|
18
|
+
input: Input;
|
|
19
|
+
};
|
|
20
|
+
type SourceReading<Source, Value> = Source extends {
|
|
21
|
+
loading: true;
|
|
22
|
+
} ? {
|
|
23
|
+
loading: true;
|
|
24
|
+
} : {
|
|
25
|
+
loading: false;
|
|
26
|
+
value: Value;
|
|
27
|
+
};
|
|
28
|
+
/** Keys supply IDs; accessors supply raw CSV values. Formats affect display only. */
|
|
29
|
+
export type DatasetColumn<Row> = {
|
|
30
|
+
label?: string;
|
|
31
|
+
} & ({
|
|
32
|
+
value: (row: Row) => CsvCell;
|
|
33
|
+
format?: (row: Row) => ReactNode;
|
|
34
|
+
} | {
|
|
35
|
+
value: (row: Row) => number | null | undefined;
|
|
36
|
+
format: MetricFormat;
|
|
37
|
+
});
|
|
38
|
+
export type DatasetDefinition<Data, Input, Row, Evidence = WidgetEvidence> = {
|
|
39
|
+
name: string;
|
|
40
|
+
select: (data: Data, input: Input) => readonly Row[];
|
|
41
|
+
columns: Record<string, DatasetColumn<NoInfer<Row>>>;
|
|
42
|
+
rowKey: (row: NoInfer<Row>) => string | number;
|
|
43
|
+
evidence: Evidence;
|
|
44
|
+
emptyFallback?: EmptyContent;
|
|
45
|
+
};
|
|
46
|
+
/** Authoring references are registered by the owning view. */
|
|
47
|
+
export type DatasetDeclaration<Data, Input, Row> = DatasetDefinition<Data, Input, Row, EvidenceDeclaration>;
|
|
48
|
+
/** Real view ownership and registered references, shared by metrics and datasets. */
|
|
49
|
+
export declare class RegisteredBinding {
|
|
50
|
+
#private;
|
|
51
|
+
constructor(owner?: object, evidence?: WidgetEvidence);
|
|
52
|
+
protected assertSource(source: object): void;
|
|
53
|
+
static evidence(binding: RegisteredBinding, owner: object): WidgetEvidence;
|
|
54
|
+
}
|
|
55
|
+
export declare function registeredEvidence(binding: RegisteredBinding, owner: object): WidgetEvidence;
|
|
56
|
+
export declare class ExportDataset<Data, Input> extends RegisteredBinding {
|
|
57
|
+
#private;
|
|
58
|
+
readonly name: string;
|
|
59
|
+
constructor(name: string, csv: (snapshot: DisplayedSnapshot<Data, Input>) => CsvTable, owner?: object, evidence?: WidgetEvidence);
|
|
60
|
+
static csv<Data, Input>(dataset: ExportDataset<Data, Input>, snapshot: DisplayedSnapshot<Data, Input>): CsvTable;
|
|
61
|
+
}
|
|
62
|
+
export declare class Dataset<Data, Input, Row> extends ExportDataset<Data, Input> {
|
|
63
|
+
#private;
|
|
64
|
+
readonly evidence: WidgetEvidence;
|
|
65
|
+
constructor(definition: DatasetDefinition<Data, Input, Row>, owner?: object);
|
|
66
|
+
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, readonly Row[]>;
|
|
67
|
+
static table<Data, Input, Row>(dataset: Dataset<Data, Input, Row>, source: ViewSource<Data, Input>): {
|
|
68
|
+
title: string;
|
|
69
|
+
columns: [TableWidgetColumn<Row>, ...TableWidgetColumn<Row>[]];
|
|
70
|
+
rowKey: (row: Row) => string | number;
|
|
71
|
+
evidence: WidgetEvidence;
|
|
72
|
+
emptyFallback: EmptyContent;
|
|
73
|
+
reading: {
|
|
74
|
+
loading: true;
|
|
75
|
+
} | {
|
|
76
|
+
loading: false;
|
|
77
|
+
value: readonly Row[];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export declare function bindDataset<Data, Input, Row>(definition: DatasetDefinition<Data, Input, Row>, owner?: object): Dataset<Data, Input, Row>;
|
|
82
|
+
export declare function datasetTable<Data, Input, Row>(dataset: Dataset<Data, Input, Row>, source: ViewSource<Data, Input>): {
|
|
83
|
+
title: string;
|
|
84
|
+
columns: [TableWidgetColumn<Row>, ...TableWidgetColumn<Row>[]];
|
|
85
|
+
rowKey: (row: Row) => string | number;
|
|
86
|
+
evidence: WidgetEvidence;
|
|
87
|
+
emptyFallback: EmptyContent;
|
|
88
|
+
reading: {
|
|
89
|
+
loading: true;
|
|
90
|
+
} | {
|
|
91
|
+
loading: false;
|
|
92
|
+
value: readonly Row[];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export declare function datasetCsv<Data, Input>(dataset: ExportDataset<Data, Input>, snapshot: DisplayedSnapshot<Data, Input>): CsvTable;
|
|
96
|
+
export declare class Metric<Data, Input> extends RegisteredBinding {
|
|
97
|
+
#private;
|
|
98
|
+
readonly definition: MetricDefinition;
|
|
99
|
+
constructor(definition: MetricDefinition, select: (data: Data, input: Input) => MetricValues, date?: (input: Input) => DateRangeRequest, owner?: object);
|
|
100
|
+
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, MetricValues & {
|
|
101
|
+
period?: DateRangeRequest;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
export declare function bindMetric<Data, Input>(definition: MetricDefinition, select: (data: Data, input: Input) => MetricValues, date?: (input: Input) => DateRangeRequest, owner?: object): Metric<Data, Input>;
|
|
105
|
+
export declare function displayedScope<Data, Input>(view: DataView<Data, Input>, describeInput: (input: Input) => string): DataReading<string>;
|
|
106
|
+
export declare function exportDatasets<Data, Input>(datasets: readonly [
|
|
107
|
+
ExportDataset<Data, Input>,
|
|
108
|
+
...ExportDataset<Data, Input>[]
|
|
109
|
+
], snapshot: DisplayedSnapshot<Data, Input>, scope: string, appTitle: string): CsvExport;
|
|
110
|
+
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import type { DeclaredView } from './view-runtime.js';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { DataReading
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
metric: (select: (data: Data) => MetricValues) => MetricReading;
|
|
7
|
-
};
|
|
8
|
-
export type DataContentState<Data, Input> = DataContentHelpers<Data, Input> & ({
|
|
3
|
+
import type { DataReading } from '../core/reading.js';
|
|
4
|
+
export type DataContentState<Data, Input> = {
|
|
5
|
+
scope: DataReading<string>;
|
|
6
|
+
} & ({
|
|
9
7
|
loading: true;
|
|
10
8
|
data?: never;
|
|
11
9
|
input?: never;
|
|
@@ -14,10 +12,25 @@ export type DataContentState<Data, Input> = DataContentHelpers<Data, Input> & ({
|
|
|
14
12
|
data: Data;
|
|
15
13
|
input: Input;
|
|
16
14
|
});
|
|
17
|
-
/**
|
|
15
|
+
/** Content receives only displayed data, its original input, and the derived scope. */
|
|
18
16
|
export declare function defineDataContent<Data, Input>(render: (state: DataContentState<Data, Input>) => ReactNode, options?: {
|
|
19
|
-
|
|
17
|
+
describeInput?: (input: Input) => string;
|
|
20
18
|
}): {
|
|
21
|
-
|
|
22
|
-
children(data: Data, input: Input): ReactNode;
|
|
19
|
+
loadingFallback: ReactNode;
|
|
20
|
+
children(this: void, data: Data, input: Input): ReactNode;
|
|
21
|
+
};
|
|
22
|
+
/** A section's request owner and render layout are declared together. */
|
|
23
|
+
export declare class ViewContent<Data, Input> {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(view: DeclaredView<Data, Input>, render: (source: DataContentState<Data, Input>) => ReactNode, describeInput: (input: Input) => string);
|
|
26
|
+
static section<Data, Input>(content: ViewContent<Data, Input>): {
|
|
27
|
+
loadingFallback: ReactNode;
|
|
28
|
+
children(this: void, data: Data, input: Input): ReactNode;
|
|
29
|
+
view: DeclaredView<Data, Input, unknown>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare function sectionContent<Data, Input>(content: ViewContent<Data, Input>): {
|
|
33
|
+
loadingFallback: ReactNode;
|
|
34
|
+
children(this: void, data: Data, input: Input): ReactNode;
|
|
35
|
+
view: DeclaredView<Data, Input, unknown>;
|
|
23
36
|
};
|